[
  {
    "path": ".clang-format",
    "content": "---\nLanguage: Cpp\nAlignAfterOpenBracket: Align\nAlignConsecutiveMacros: true\nAlignConsecutiveAssignments: false\nAlignConsecutiveDeclarations: false\nAlignEscapedNewlines: Left\nAlignOperands: true\nAlignTrailingComments: false\nAllowAllArgumentsOnNextLine: false\nAllowAllParametersOfDeclarationOnNextLine: false\nAllowShortBlocksOnASingleLine: Never\nAllowShortCaseLabelsOnASingleLine: false\nAllowShortFunctionsOnASingleLine: None\nAllowShortIfStatementsOnASingleLine: Never\nAllowShortLoopsOnASingleLine: false\nAlwaysBreakAfterReturnType: AllDefinitions\nAlwaysBreakBeforeMultilineStrings: false\nBinPackArguments: false\nBinPackParameters: false\nBraceWrapping:\n  AfterCaseLabel: true\n  AfterControlStatement: Always\n  AfterEnum: true\n  AfterFunction: true\n  AfterStruct: true\n  AfterUnion: true\n  AfterExternBlock: false\n  BeforeElse: true\n  IndentBraces: false\n  SplitEmptyFunction: true\nBreakBeforeBinaryOperators: NonAssignment\nBreakBeforeBraces: Custom\nBreakBeforeTernaryOperators: true\nBreakStringLiterals: true\nColumnLimit: 120\nContinuationIndentWidth: 2\nCpp11BracedListStyle: false\nDeriveLineEnding: true\nDerivePointerAlignment: true\nDisableFormat: false\nExperimentalAutoDetectBinPacking: true\nIncludeBlocks: Regroup\nIncludeCategories:\n  - Regex: '<windows.h>'\n    Priority: 0\n  - Regex: '<[-./a-z]*>'\n    Priority: 1\n  - Regex: '\"jerryscript[-.a-z]*\"'\n    Priority: 2\n  - Regex: '\"ecma[-.a-z]*\"'\n    Priority: 3\n  - Regex: '.*'\n    Priority: 4\nIndentCaseLabels: true\nIndentGotoLabels: false\nIndentPPDirectives: None\nIndentWidth: 2\nIndentWrappedFunctionNames: false\nKeepEmptyLinesAtTheStartOfBlocks: false\nMacroBlockBegin: ''\nMacroBlockEnd: ''\nMaxEmptyLinesToKeep: 1\nPointerAlignment: Right\nReflowComments: true\nSortIncludes: true\nSpaceAfterCStyleCast: true\nSpaceAfterLogicalNot: false\nSpaceBeforeAssignmentOperators: true\nSpaceBeforeParens: Always\nSpaceInEmptyBlock: false\nSpaceInEmptyParentheses: false\nSpacesBeforeTrailingComments: 1\nSpacesInConditionalStatement: false\nSpacesInCStyleCastParentheses: false\nSpacesInParentheses: false\nSpacesInSquareBrackets: false\nSpaceBeforeSquareBrackets: false\nStandard: Auto\nStatementMacros:\n  - JERRY_ASSERT\n  - JERRY_STATIC_ASSERT\n  - JERRY_UNREACHABLE\nTabWidth: 0\nUseCRLF: false\nUseTab: Never\n...\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\n\n---\n\nFirst of all, when reporting a bug, give the issue a descriptive title.\n\nIn the body of the issue, optionally give a free-form text description of the\nbug. Give the context necessary for others to understand the problem.\n\nThen, provide information necessary to reproduce the bug.\nOmit sections that are irrelevant for the bug report, but note that information\nlike git revision, build platform, build command, and test case are required in\nalmost all cases.\n\n###### JerryScript revision\nIdentify the git hash(es) or tag(s) where the issue was observed.\n\n###### Build platform\nName the build platform. E.g., copy the output of\n`echo \"$(lsb_release -ds) ($(uname -mrs))\"` (on Linux),\n`echo \"$(sw_vers -productName) $(sw_vers -productVersion) ($(uname -mrs))\"` (on macOS), or\n`python -c \"import platform; print(platform.platform())\"` (should work everywhere).\n\n###### Build steps\nDescribe how to build JerryScript. Give all the necessary details of the build\n(e.g., environment variables, command(s), profile, command line options, etc.).\n\nE.g.:\n```sh\ntools/build.py --clean --debug\n```\nOr:\n```sh\nmkdir build && cmake -H. -Bbuild && make -C build\n```\n\nEven if the bug was originally observed when JerryScript was integrated into a\nlarger project, try to reproduce it with as few external code as possible,\npreferably by building the `jerry` command line tool.\n\n###### Build log\nCopy the build log if the reported issue is a build problem. Do a verbose build\nif necessary. Try and trim the log to relevant parts.\n\n###### Test case\nGive the JavaScript input that should be passed to the engine to trigger the\nbug. Try and post a reduced test case that is minimally necessary to reproduce\nthe issue. As a rule of thumb, use Markdown's fenced code block syntax for the\ntest case. Attach the file (renamed to .txt) if the test case contains\n'problematic' bytes that cannot be copied in the bug report directly.\n\n###### Execution platform\nUnnecessary if the same as the build platform.\n\n###### Execution steps\nList the steps that trigger the bug.\n\nE.g., if a bug is snapshot-specific:\n```sh\nbuild/bin/jerry-snapshot generate -o testcase.js.snapshot testcase.js\nbuild/bin/jerry --exec-snapshot testcase.js.snapshot\n```\n\nUnnecessary if trivial (i.e., `build/bin/jerry testcase.js`).\n\n###### Output\nCopy relevant output from the standard output and/or error channels.\n\n###### Backtrace\nIn case of a crash (assertion failure, etc.), try to copy the backtrace from a\ndebugger at the point of failure.\n\n###### Expected behavior\nDescribe what should happen instead of current behavior. Unnecessary if trivial\n(e.g., in case of a crash, the trivial expected behavior is not to crash).\n"
  },
  {
    "path": ".github/pull_request_template.md",
    "content": "**PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING**\n\nBefore submitting a PR, please, make sure that:\n\n- Changes are in a separate branch, not in master.\n- The branch contains only one commit on top of master (if not, squash them into\n  one commit).\n- The commit has a descriptive commit message with a concise title (first line).\n- The commit message contains `fixes #XXXX` or `closes #XXXX` to auto-close the\n  issue(s) that the PR fixes (if any).\n- Tests for the changes have been added (for bug fixes / features).\n- Documentation has been added / updated (if applicable).\n- All new and existing tests passed locally (if not, fix them first and amend\n  the commit).\n\nIMPORTANT: Please review the CONTRIBUTING.md file for detailed contributing\nguidelines.\n\n**PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING**\n"
  },
  {
    "path": ".github/workflows/gh-actions.yml",
    "content": "name: JerryScript CI\n\non: [push, pull_request]\n\nenv:\n  RUNNER: tools/run-tests.py\n\njobs:\n  Checks:\n    runs-on: ubuntu-22.04 # needed for checker version stability\n    steps:\n      - uses: actions/checkout@v2\n        with:\n          fetch-depth: 0\n      - uses: actions/setup-python@v2\n        with:\n          python-version: '3.10'\n      - run: sudo apt update\n      - run: sudo apt install pylint doxygen cppcheck clang-format-15\n      - run: $RUNNER --check-signed-off=gh-actions\n        if: ${{ always() }}\n      - run: $RUNNER --check-doxygen\n        if: ${{ always() }}\n      - run: $RUNNER --check-format\n        if: ${{ always() }}\n      - run: $RUNNER --check-license\n        if: ${{ always() }}\n      - run: $RUNNER --check-strings\n        if: ${{ always() }}\n      - run: $RUNNER --check-pylint\n        if: ${{ always() }}\n      - run: $RUNNER --check-cppcheck\n        if: ${{ always() }}\n\n  Linux_x86-64_Build_Correctness_Debugger_Tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: $RUNNER -q --jerry-tests\n      - run: $RUNNER -q --jerry-tests --build-debug\n      - run: $RUNNER -q --jerry-debugger\n      - run: $RUNNER -q --jerry-debugger --build-debug\n\n  Linux_x86_cpointer-32bit_Build_Correctness_Tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-multilib\n      - run: $RUNNER -q --jerry-tests --buildoptions=--compile-flag=-m32,--cpointer-32bit=on\n      - run: $RUNNER -q --jerry-tests --buildoptions=--compile-flag=-m32,--cpointer-32bit=on --build-debug\n\n  Win_x86-64_Conformance_Tests_ESNext:\n    runs-on: windows-latest\n    steps:\n      - uses: actions/checkout@v2\n      - run: python $env:RUNNER --test262 update\n\n  Win_x86-64_Conformance_Tests_ESNext_Debug:\n    runs-on: windows-latest\n    steps:\n      - uses: actions/checkout@v2\n      - run: python $env:RUNNER --test262 update --build-debug\n\n  Win_x86-64_Tests-MINGW:\n    runs-on: windows-latest\n    defaults:\n      run:\n        shell: msys2 {0}\n    steps:\n      - uses: actions/checkout@v4\n      - uses: msys2/setup-msys2@v2\n        with:\n          msystem: MINGW64\n          update: true\n          install: >-\n            mingw-w64-x86_64-python\n            mingw-w64-x86_64-cmake\n            mingw-w64-x86_64-make\n            mingw-w64-x86_64-toolchain\n      - run: python $RUNNER -q --jerry-tests\n      - run: python $RUNNER -q --unittests --build-config=''\n      # FIXME: enable it with upgrade valgrind - run: python $RUNNER -q --buildoption-test\n\n  Win_x86-64_Tests:\n    runs-on: windows-latest\n    steps:\n      - uses: actions/checkout@v2\n      - run: python $env:RUNNER -q --jerry-tests\n      - run: python $env:RUNNER -q --unittests\n      - run: python $env:RUNNER -q --buildoption-test\n\n  Win_x86-64_Tests_Debug:\n    runs-on: windows-latest\n    steps:\n      - uses: actions/checkout@v2\n      - run: python $env:RUNNER -q --jerry-tests --build-debug\n      - run: python $env:RUNNER -q --unittests --build-debug\n      - run: python $env:RUNNER -q --buildoption-test --build-debug\n\n  OSX_x86-64_Build_Correctness_Unit_Tests:\n    runs-on: macos-13\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: $RUNNER -q --jerry-tests\n      - run: $RUNNER -q --unittests\n\n  OSX_x86-64_Build_Correctness_Unit_Tests_Debug:\n    runs-on: macos-13\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: $RUNNER -q --jerry-tests --build-debug\n      - run: $RUNNER -q --unittests --build-debug\n\n  Linux_x86-64_Build_Option_Tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-multilib\n      - run: $RUNNER --buildoption-test\n\n  Conformance_Tests_ESNext:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: $RUNNER --test262 update\n      - uses: actions/upload-artifact@v4\n        if: success() || failure()\n        with:\n          name: Test262-ESNext-results\n          path:  |\n            build/tests/test262_tests_esnext/local/bin/test262.report\n\n  Conformance_Tests_ESNext_Debug_A:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: $RUNNER --test262 update --build-debug --test262-test-list=built-ins,annexB,harness,intl402\n      - uses: actions/upload-artifact@v4\n        if: success() || failure()\n        with:\n          name: Test262-ESNext-Debug-A-results\n          path: |\n            build/tests/test262_tests_esnext-debug/local/bin/test262.report\n\n  Conformance_Tests_ESNext_Debug_B:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: $RUNNER --test262 update --build-debug --test262-test-list=language\n      - uses: actions/upload-artifact@v4\n        if: success() || failure()\n        with:\n          name: Test262-ESNext-Debug-B-results\n          path: |\n            build/tests/test262_tests_esnext-debug/local/bin/test262.report\n\n  Unit_Tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: $RUNNER -q --unittests\n      - run: $RUNNER -q --unittests --build-debug\n\n  Clang_Unit_Build_Option_Tests:\n    runs-on: ubuntu-latest\n    env:\n      CC: clang\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-multilib\n      - run: $RUNNER -q --unittests\n      # clang has bug in supporting lto\n      - run: $RUNNER -q --buildoption-test --buildoptions=--lto=off\n\n  ASAN_Tests:\n    runs-on: ubuntu-latest\n    env:\n      ASAN_OPTIONS: detect_stack_use_after_return=1:check_initialization_order=true:strict_init_order=true\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-multilib\n      - run: >-\n          $RUNNER -q --jerry-tests\n          --buildoptions=--stack-limit=0,--compile-flag=-fsanitize=address,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--compile-flag=-O2,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold\n          --skip-list=parser-oom.js,parser-oom2.js,stack-limit.js,regression-test-issue-4870.js,regression-test-issue-4901.js,regression-test-issue-4848.js,regression-test-issue-4890.js,regression-test-issue-2190.js,regression-test-issue-2258-2963.js,regression-test-issue-2448.js,regression-test-issue-2905.js,regression-test-issue-3785.js,proxy-evil-recursion.js,regression-test-issue-5101.js\n\n  ASAN_Tests_Debug:\n    runs-on: ubuntu-latest\n    env:\n      ASAN_OPTIONS: detect_stack_use_after_return=1:check_initialization_order=true:strict_init_order=true\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-multilib\n      - run: >-\n          $RUNNER -q --jerry-tests --build-debug\n          --buildoptions=--stack-limit=0,--compile-flag=-fsanitize=address,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--compile-flag=-O2,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold\n          --skip-list=parser-oom.js,parser-oom2.js,stack-limit.js,regression-test-issue-4870.js,regression-test-issue-4901.js,regression-test-issue-4848.js,regression-test-issue-4890.js,regression-test-issue-2190.js,regression-test-issue-2258-2963.js,regression-test-issue-2448.js,regression-test-issue-2905.js,regression-test-issue-3785.js,proxy-evil-recursion.js,regression-test-issue-5101.js\n\n  UBSAN_Tests:\n    runs-on: ubuntu-latest\n    env:\n      UBSAN_OPTIONS: print_stacktrace=1\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-multilib\n      - run: >-\n          $RUNNER -q --jerry-tests\n          --buildoptions=--compile-flag=-fsanitize=undefined,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold\n          --skip-list=parser-oom.js,parser-oom2.js\n      - run: >-\n          $RUNNER -q --jerry-tests --build-debug\n          --buildoptions=--compile-flag=-fsanitize=undefined,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold\n          --skip-list=parser-oom.js,parser-oom2.js\n\n  Linux_ARMv7l_Tests:\n    runs-on: ubuntu-latest\n    env:\n      RUNTIME: qemu-arm-static\n      TIMEOUT: 300\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static\n      - run: >-\n          $RUNNER -q --jerry-tests\n          --buildoptions=--toolchain=cmake/toolchain_linux_armv7l.cmake,--linker-flag=-static\n\n  Linux_ARMv7l_Tests_Debug:\n    runs-on: ubuntu-latest\n    env:\n      RUNTIME: qemu-arm-static\n      TIMEOUT: 300\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static\n      - run: >-\n          $RUNNER -q --jerry-tests --build-debug\n          --buildoptions=--toolchain=cmake/toolchain_linux_armv7l.cmake,--linker-flag=-static\n\n  Linux_AArch64_Tests:\n    runs-on: ubuntu-latest\n    env:\n      RUNTIME: qemu-aarch64-static\n      TIMEOUT: 300\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-aarch64-linux-gnu libc6-dev-armhf-cross qemu-user-static\n      - run: >-\n          $RUNNER -q --jerry-tests\n          --buildoptions=--toolchain=cmake/toolchain_linux_aarch64.cmake,--linker-flag=-static\n\n  Linux_AArch64_Tests_Debug:\n    runs-on: ubuntu-latest\n    env:\n      RUNTIME: qemu-aarch64-static\n      TIMEOUT: 300\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-aarch64-linux-gnu libc6-dev-armhf-cross qemu-user-static\n      - run: >-\n          $RUNNER -q --jerry-tests --build-debug\n          --buildoptions=--toolchain=cmake/toolchain_linux_aarch64.cmake,--linker-flag=-static\n\n  MbedOS_K64F_Build_Test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-arm-none-eabi ninja-build\n      - run: make -f ./targets/os/mbedos/Makefile.travis install\n      - run: make -f ./targets/os/mbedos/Makefile.travis script\n\n  Zephyr_STM32F4_Build_Test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gperf dfu-util device-tree-compiler\n      - run: make -f ./targets/os/zephyr/Makefile.travis install\n      - run: make -f ./targets/os/zephyr/Makefile.travis script\n\n  NuttX_STM32F4_Build_Test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.6'\n      - run: sudo apt update\n      - run: sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi gperf\n      - run: make -f ./targets/os/nuttx/Makefile.travis install-noapt\n      - run: make -f ./targets/os/nuttx/Makefile.travis script\n\n  RIOT_STM32F4_Build_Test:\n    runs-on: ubuntu-latest\n    env:\n      CC: clang\n    steps:\n      - uses: actions/checkout@v2\n      - run: sudo apt -y install clang gcc-arm-none-eabi\n      - run: make -f ./targets/os/riot/Makefile.travis install-noapt\n      - run: make -f ./targets/os/riot/Makefile.travis script\n\n  ESP8266_RTOS_SDK_Build_Test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '>=3.8'\n      - run: make -f ./targets/baremetal-sdk/espressif/esp8266-rtos-sdk/Makefile.travis install-noapt\n      - run: make -f ./targets/baremetal-sdk/espressif/esp8266-rtos-sdk/Makefile.travis script\n\n  ESP_IDF_Build_Test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-python@v4\n        with:\n          python-version: '==3.8'\n      - run: make -f ./targets/baremetal-sdk/espressif/esp-idf/Makefile.travis install-noapt\n      - run: make -f ./targets/baremetal-sdk/espressif/esp-idf/Makefile.travis script\n\n  Notification:\n    runs-on: ubuntu-latest\n    if: false && github.event_name == 'push' && github.repository == 'jerryscript-project/jerryscript'\n    steps:\n      - uses: rectalogic/notify-irc@v1\n        with:\n          channel: '#jerryscript'\n          nickname: jerryscript-notification\n          message: |\n            @${{ github.actor }}: ${{ github.repository }} (${{ github.ref }}#${{ github.sha }})\n            ${{ join(github.event.commits.*.message) }}\n            ${{ github.event.compare }}\n"
  },
  {
    "path": ".gitignore",
    "content": "# Produced files\n.mbedignore\nbuild/*\n\n# IDE related files\nnbproject\n*.sublime-project\n*.sublime-workspace\n.idea\n\n# Random Trash\n*.swp\n*.swo\n*~\ncore\nvgcore.*\n*.orig\n*.directory\n*.patch\n.tags*\ncscope.*\n__pycache__\n*.pyc\n.DS_Store\n\n# ctags and ID database\ntags\nID\n\n# targets\njerry-targetjs.h\n.output\ntargets/esp8266/output.map\ntargets/esp8266/libs\n\n# Generated documentation\ndocs/doxygen\n\n# Tests\ntests/test262/\n.vs\n"
  },
  {
    "path": "CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required (VERSION 3.10)\nproject (Jerry C)\n\nif(NOT DEFINED PYTHON)\n  set(PYTHON \"python\")\nendif()\n# Determining version\nexecute_process(COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/tools/version.py\n                OUTPUT_VARIABLE JERRY_VERSION\n                OUTPUT_STRIP_TRAILING_WHITESPACE)\n\n# Determining platform\nset(PLATFORM \"${CMAKE_SYSTEM_NAME}\")\nstring(TOUPPER \"${PLATFORM}\" PLATFORM)\n\n# Determining compiler\nif(MSVC)\n  set(USING_MSVC 1)\nendif()\n\nif(CMAKE_C_COMPILER_ID MATCHES \"GNU\")\n  set(USING_GCC 1)\nendif()\n\n# Clang may support for MSVC\nif(NOT USING_MSVC AND CMAKE_C_COMPILER_ID MATCHES \"Clang\")\n  set(USING_CLANG 1)\nendif()\n\nif(CMAKE_C_COMPILER_ID MATCHES \"TI\")\n  set(USING_TI 1)\nendif()\n\n# Determining build type\nif(NOT CMAKE_BUILD_TYPE)\n  set(CMAKE_BUILD_TYPE \"MinSizeRel\")\nendif()\n\n# Optional components\nset(JERRY_CMDLINE           ON  CACHE BOOL \"Build jerry command line tool?\")\nset(JERRY_CMDLINE_TEST      OFF CACHE BOOL \"Build jerry test command line tool?\")\nset(JERRY_CMDLINE_SNAPSHOT  OFF CACHE BOOL \"Build jerry snapshot command line tool?\")\nset(JERRY_LIBFUZZER         OFF CACHE BOOL \"Build jerry with libfuzzer support?\")\nset(JERRY_PORT              ON  CACHE BOOL \"Build default jerry port implementation?\")\nset(JERRY_EXT               ON  CACHE BOOL \"Build jerry-ext?\")\nset(JERRY_MATH              OFF CACHE BOOL \"Build and use jerry-math?\")\nset(UNITTESTS               OFF CACHE BOOL \"Build unit tests?\")\nset(DOCTESTS                OFF CACHE BOOL \"Build doc tests?\")\n\n# Optional build settings\nset(BUILD_SHARED_LIBS         OFF CACHE BOOL \"Build shared libraries?\")\nset(ENABLE_AMALGAM            OFF CACHE BOOL \"Enable amalgamated build?\")\nset(ENABLE_LTO                ON  CACHE BOOL \"Enable LTO build?\")\nset(ENABLE_STRIP              ON  CACHE BOOL \"Enable stripping all symbols from release binary?\")\nset(ENABLE_COMPILE_COMMANDS   ON  CACHE BOOL \"Enable generating compile_commands.json?\")\n\nif(USING_MSVC)\n  set(ENABLE_STATIC_CRT         OFF CACHE BOOL \"Enable MSVC static CRT?\")\nendif()\n\n# Option overrides\nif(NOT USING_CLANG)\n  set(JERRY_LIBFUZZER OFF)\n\n  set(JERRY_LIBFUZZER_MESSAGE \" (FORCED BY COMPILER)\")\nendif()\n\nif(JERRY_CMDLINE OR JERRY_CMDLINE_TEST OR JERRY_CMDLINE_SNAPSHOT OR JERRY_LIBFUZZER OR UNITTESTS OR DOCTESTS)\n  set(JERRY_PORT ON)\n\n  set(JERRY_PORT_MESSAGE \" (FORCED BY CMDLINE OR LIBFUZZER OR TESTS)\")\nendif()\n\nif(JERRY_CMDLINE OR DOCTESTS)\n  set(JERRY_EXT ON)\n\n  set(JERRY_EXT_MESSAGE \" (FORCED BY CMDLINE OR TESTS)\")\nendif()\n\nif(\"${PLATFORM}\" STREQUAL \"DARWIN\")\n  set(ENABLE_LTO         OFF)\n  set(ENABLE_STRIP       OFF)\n\n  set(ENABLE_LTO_MESSAGE         \" (FORCED BY PLATFORM)\")\n  set(ENABLE_STRIP_MESSAGE       \" (FORCED BY PLATFORM)\")\nendif()\n\nif(\"${PLATFORM}\" STREQUAL \"ESP-IDF\")\n  set(ENABLE_LTO         OFF)\n  set(ENABLE_STRIP       OFF)\n\n  set(ENABLE_LTO_MESSAGE         \" (FORCED BY PLATFORM)\")\n  set(ENABLE_STRIP_MESSAGE       \" (FORCED BY PLATFORM)\")\nendif()\n\nif(USING_TI)\n  set(ENABLE_STRIP       OFF)\n\n  set(ENABLE_STRIP_MESSAGE       \" (FORCED BY COMPILER)\")\nendif()\n\nif(USING_MSVC)\n  set(ENABLE_STRIP       OFF)\n\n  set(ENABLE_STRIP_MESSAGE       \" (FORCED BY COMPILER)\")\nendif()\n\nif(CYGWIN OR MINGW OR MSYS)\n  set(ENABLE_LTO         OFF)\n\n  set(ENABLE_LTO_MESSAGE         \" (FORCED BY PLATFORM)\")\nendif()\n\n# Generate compile_commands.json\nset(CMAKE_EXPORT_COMPILE_COMMANDS ${ENABLE_COMPILE_COMMANDS})\n\n# Status messages\nmessage(STATUS \"CMAKE_BUILD_TYPE               \" ${CMAKE_BUILD_TYPE})\nmessage(STATUS \"CMAKE_C_COMPILER_ID            \" ${CMAKE_C_COMPILER_ID})\nmessage(STATUS \"CMAKE_SYSTEM_NAME              \" ${CMAKE_SYSTEM_NAME})\nmessage(STATUS \"CMAKE_SYSTEM_PROCESSOR         \" ${CMAKE_SYSTEM_PROCESSOR})\nmessage(STATUS \"BUILD_SHARED_LIBS              \" ${BUILD_SHARED_LIBS})\nmessage(STATUS \"ENABLE_AMALGAM                 \" ${ENABLE_AMALGAM} ${ENABLE_AMALGAM_MESSAGE})\nmessage(STATUS \"ENABLE_LTO                     \" ${ENABLE_LTO} ${ENABLE_LTO_MESSAGE})\nmessage(STATUS \"ENABLE_STRIP                   \" ${ENABLE_STRIP} ${ENABLE_STRIP_MESSAGE})\nmessage(STATUS \"ENABLE_STATIC_CRT              \" ${ENABLE_STATIC_CRT})\nmessage(STATUS \"ENABLE_COMPILE_COMMANDS        \" ${ENABLE_COMPILE_COMMANDS})\nmessage(STATUS \"JERRY_VERSION                  \" ${JERRY_VERSION})\nmessage(STATUS \"JERRY_CMDLINE                  \" ${JERRY_CMDLINE} ${JERRY_CMDLINE_MESSAGE})\nmessage(STATUS \"JERRY_CMDLINE_TEST             \" ${JERRY_CMDLINE_TEST} ${JERRY_CMDLINE_TEST_MESSAGE})\nmessage(STATUS \"JERRY_CMDLINE_SNAPSHOT         \" ${JERRY_CMDLINE_SNAPSHOT} ${JERRY_CMDLINE_SNAPSHOT_MESSAGE})\nmessage(STATUS \"JERRY_LIBFUZZER                \" ${JERRY_LIBFUZZER} ${JERRY_LIBFUZZER_MESSAGE})\nmessage(STATUS \"JERRY_PORT                     \" ${JERRY_PORT} ${JERRY_PORT_MESSAGE})\nmessage(STATUS \"JERRY_EXT                      \" ${JERRY_EXT} ${JERRY_EXT_MESSAGE})\nmessage(STATUS \"JERRY_MATH                     \" ${JERRY_MATH} ${JERRY_MATH_MESSAGE})\nmessage(STATUS \"UNITTESTS                      \" ${UNITTESTS})\nmessage(STATUS \"DOCTESTS                       \" ${DOCTESTS})\n\n# Setup directories\n# Note: This mimics a conventional file system layout in the build directory for\n# the sake of convenient location of build artefacts. Proper installation to\n# traditional locations is also supported, e.g., to /usr/local.\nset(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"${CMAKE_BINARY_DIR}/bin/\")\nset(CMAKE_ARCHIVE_OUTPUT_DIRECTORY \"${CMAKE_BINARY_DIR}/lib/\")\nset(CMAKE_LIBRARY_OUTPUT_DIRECTORY \"${CMAKE_BINARY_DIR}/lib/\")\n\n# Remove rdynamic option\nset(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS )\n\n# Compile/link flags\n# Helper macros\nmacro(jerry_add_flags VAR)\n  foreach(_flag ${ARGN})\n    set(${VAR} \"${${VAR}} ${_flag}\")\n  endforeach()\nendmacro()\n\nmacro(jerry_add_compile_flags)\n  jerry_add_flags(CMAKE_C_FLAGS ${ARGV})\nendmacro()\n\nmacro(jerry_add_compile_warnings)\n  foreach(_warning ${ARGV})\n    jerry_add_compile_flags(-W${_warning})\n    jerry_add_compile_flags(-Werror=${_warning})\n  endforeach()\nendmacro()\n\nmacro(jerry_add_link_flags)\n  jerry_add_flags(LINKER_FLAGS_COMMON ${ARGV})\nendmacro()\n\n# Architecture-specific compile/link flags\njerry_add_compile_flags(${FLAGS_COMMON_ARCH})\njerry_add_flags(CMAKE_EXE_LINKER_FLAGS ${FLAGS_COMMON_ARCH})\n\n# LTO\nif(ENABLE_LTO)\n  if(USING_GCC OR USING_CLANG)\n    jerry_add_compile_flags(-flto)\n    jerry_add_link_flags(-flto)\n  endif()\n  if(USING_GCC)\n    jerry_add_compile_flags(-fno-fat-lto-objects)\n    # Use gcc-ar and gcc-ranlib to support LTO\n    set(CMAKE_AR \"gcc-ar\")\n    set(CMAKE_RANLIB \"gcc-ranlib\")\n  endif()\n  if(USING_TI)\n    jerry_add_link_flags(-lto)\n  endif()\nendif()\n\n# Compiler / Linker flags\nif(\"${PLATFORM}\" STREQUAL \"DARWIN\")\n  jerry_add_link_flags(-lSystem)\n  set(CMAKE_C_ARCHIVE_CREATE \"<CMAKE_AR> Sqc <TARGET> <LINK_FLAGS> <OBJECTS>\")\n  if(\"${CMAKE_C_COMPILER_ID}\" STREQUAL \"AppleClang\")\n    set(CMAKE_C_ARCHIVE_FINISH \"<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>\")\n  else()\n    set(CMAKE_C_ARCHIVE_FINISH \"<CMAKE_RANLIB> <TARGET>\")\n  endif()\n  set(CMAKE_SHARED_LINKER_FLAGS  \"-undefined dynamic_lookup\")\nelseif((NOT CYGWIN AND NOT MINGW AND NOT MSYS) AND (USING_GCC OR USING_CLANG))\n  jerry_add_link_flags(-Wl,-z,noexecstack)\nendif()\n\nif(USING_GCC OR USING_CLANG)\n  jerry_add_compile_flags(-std=c99 -pedantic)\n  if(JERRY_MATH)\n    jerry_add_compile_flags(-fno-builtin)\n  endif()\n  jerry_add_compile_warnings(all extra format-nonliteral init-self sign-conversion format-security missing-declarations shadow strict-prototypes undef old-style-definition)\n  if(NOT \"${PLATFORM}\" STREQUAL \"WINDOWS\")\n    jerry_add_compile_warnings(conversion)\n  endif()\n  jerry_add_compile_flags(-Wno-stack-protector -Wno-attributes -Werror)\nendif()\n\nif(USING_GCC)\n  jerry_add_compile_warnings(logical-op)\n  # TODO: Remove workaround for gcc 7 bug if the fallthrough comment detection is fixed.\n  if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 7.0)\n    jerry_add_compile_flags(-Wno-implicit-fallthrough)\n  endif()\nendif()\n\nif(USING_CLANG)\n  jerry_add_compile_flags(-Wno-nested-anon-types -Wno-static-in-inline)\nendif()\n\nif(USING_TI)\n  jerry_add_compile_flags(--c99)\nendif()\n\nif(USING_MSVC)\n  jerry_add_link_flags(/OPT:NOREF)\n  # Disable MSVC warning 4996 globally because it stops us from using standard C functions.\n  jerry_add_compile_flags(/wd4996)\n\n  if(ENABLE_STATIC_CRT)\n    # Replace the existing /MD and /MDd values with /MT and /MTd.\n    set(COMPILER_FLAGS\n      CMAKE_CXX_FLAGS\n      CMAKE_CXX_FLAGS_DEBUG\n      CMAKE_CXX_FLAGS_RELEASE\n      CMAKE_C_FLAGS\n      CMAKE_C_FLAGS_DEBUG\n      CMAKE_C_FLAGS_RELEASE\n    )\n\n    foreach(_flag ${COMPILER_FLAGS})\n      string(REPLACE \"/MD\" \"/MT\" ${_flag} \"${${_flag}}\")\n    endforeach()\n  endif()\nendif()\n\nif(JERRY_LIBFUZZER)\n  jerry_add_compile_flags(-fsanitize=fuzzer-no-link)\nendif()\n\n# Strip binary\nif(ENABLE_STRIP AND NOT CMAKE_BUILD_TYPE STREQUAL \"Debug\")\n  jerry_add_link_flags(-s)\nendif()\n\n# External compiler & linker flags\nif(DEFINED EXTERNAL_COMPILE_FLAGS)\n  jerry_add_compile_flags(${EXTERNAL_COMPILE_FLAGS})\nendif()\n\nif(DEFINED EXTERNAL_LINKER_FLAGS)\n  jerry_add_link_flags(${EXTERNAL_LINKER_FLAGS})\nendif()\n\n# Used as placeholder to attach amalgamated build targets to\nadd_custom_target(amalgam)\n\n# Jerry's libm\nif(JERRY_MATH)\n  add_subdirectory(jerry-math)\nendif()\n\n# Jerry's core\nadd_subdirectory(jerry-core)\n\n# Jerry's extension tools\nif(JERRY_EXT)\n  add_subdirectory(jerry-ext)\nendif()\n\n# Jerry's default port implementation\nif(JERRY_PORT)\n  add_subdirectory(jerry-port)\nendif()\n\n# Jerry command line tool\nif(JERRY_CMDLINE OR JERRY_CMDLINE_TEST OR JERRY_CMDLINE_SNAPSHOT OR JERRY_LIBFUZZER)\n  add_subdirectory(jerry-main)\nendif()\n\n# Unittests\nif(UNITTESTS)\n  add_subdirectory(tests/unit-core)\n  if(JERRY_MATH)\n    add_subdirectory(tests/unit-math)\n  endif()\n  if(JERRY_EXT)\n    add_subdirectory(tests/unit-ext)\n  endif()\nendif()\n\n# Doctests\nif(DOCTESTS)\n  add_subdirectory(tests/unit-doc)\nendif()\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contribution Guidelines\n## Patch Submission Process\n\nThe following guidelines on the submission process are provided to help you be more effective when submitting code to the JerryScript project.\n\nWhen development is complete, a patch set should be submitted via GitHub pull requests. A review of the patch set will take place. When accepted, the patch set will be integrated into the master branch, verified, and tested. It is then the responsibility of the authoring developer to maintain the code throughout its lifecycle.\n\nPlease submit all patches in public by opening a pull request. Patches sent privately to Maintainers and Committers will not be considered. Because the JerryScript Project is an Open Source project, be prepared for feedback and criticism-it happens to everyone-. If asked to rework your code, be persistent and resubmit after making changes.\n\n### 1. Scope the patch\n\nSmaller patches are generally easier to understand and test, so please submit changes in the smallest increments possible, within reason. Smaller patches are less likely to have unintended consequences, and if they do, getting to the root cause is much easier for you and the Maintainers and Committers. Additionally, smaller patches are much more likely to be accepted.\n\n### 2. Ensure all files have a proper license header and copyright notice\n\nAny code that you want to contribute to the project must be licensed under the [Apache License 2.0](LICENSE). Contributions under a different license can not be accepted. Each file should start with the following header:\n\n```c\n/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n```\n\nAdding copyright notices other than the project-wide notice (\"Copyright JS Foundation and other contributors, http://js.foundation\") is not permitted. The only exception is adding third-party code which requires copyright notices to be preserved. Adding third-party code to the project generally requires a strong justification.\n\n### 3. Sign your work with the JerryScript [Developer's Certificate of Origin](DCO.md)\n\nThe sign-off is a simple line at the end of the commit message of the patch, which certifies that you wrote it or otherwise have the right to pass it on as an Open Source patch. The sign-off is required for a patch to be accepted.\n\nWe have the same requirements for using the signed-off-by process as the Linux kernel.\nIn short, you need to include a signed-off-by tag in every patch.\n\nYou should use your real name and email address in the format below:\n\n> JerryScript-DCO-1.0-Signed-off-by: Random J Developer random@developer.example.org\n\n\"JerryScript-DCO-1.0-Signed-off-by:\" this is a developer's certification that he or she has the right to submit the patch for inclusion into the project. It is an agreement to the JerryScript [Developer's Certificate of Origin](DCO.md). **Code without a proper signoff cannot be merged into the mainline.**\n\n### 4. Open a GitHub [pull request](https://github.com/jerryscript-project/jerryscript/pulls)\n\nYou can find instructions about opening a pull request [here](https://help.github.com/articles/creating-a-pull-request).\n\n### 5. What if my patch is rejected?\n\nIt happens all the time, for many reasons, and not necessarily because the code is bad. Take the feedback, adapt your code, and try again. Remember, the ultimate goal is to preserve the quality of the code and maintain the focus of the Project through intensive review.\n\nMaintainers and Committers typically have to process a lot of submissions, and the time for any individual response is generally limited. If the reason for rejection is unclear, please ask for more information from the Maintainers and Committers.\nIf you have a solid technical reason to disagree with feedback and you feel that reason has been overlooked, take the time to thoroughly explain it in your response.\n\n### 6. Code review\n\nCode review can be performed by all the members of the Project (not just Maintainers and Committers). Members can review code changes and share their opinion through comments guided by the following principles:\n* Discuss code; never discuss the code's author\n* Respect and acknowledge contributions, suggestions, and comments\n* Listen and be open to all different opinions\n* Help each other\n\nChanges are submitted via pull requests and only the Maintainers and Committers should approve or reject the pull request (note that only Maintainers can give binding review scores).\nChanges should be reviewed in reasonable amount of time. Maintainers and Committers should leave changes open for some time (at least 1 full business day) so others can offer feedback. Review times increase with the complexity of the review.\n\n## Tips on GitHub Pull Requests\n\n* [Fork](https://guides.github.com/activities/forking) the GitHub repository and clone it locally\n* Connect your local repository to the original upstream repository by adding it as a remote\n* Create a [branch](https://guides.github.com/introduction/flow) for your edits\n* Pull in upstream changes often to stay up-to-date so that when you submit your pull request, merge conflicts will be less likely\n\nFor more details, see the GitHub [fork syncing](https://help.github.com/articles/syncing-a-fork) guidelines.\n\n## How to add the DCO line to every single commit automatically\n\nIt is easy to forget adding the DCO line to the end of every commit message. Fortunately there is a nice way to do it automatically. Once you've cloned the repository into your local machine, you can add `prepare commit message hook` in `.git/hooks` directory like this:\n\n```\n#!/usr/bin/env python\n\nimport sys\n\ncommit_msg_filepath = sys.argv[1]\n\nwith open(commit_msg_filepath, \"r+\") as f:\n\tcontent = f.read()\n\tf.seek(0, 0)\n\tif \"Signed-off-by\" not in content:\n\t\tf.write(\"\\n\\nJerryScript-DCO-1.0-Signed-off-by: <Your Name> <Your Email>\\n%s\" % content)\n\telse:\n\t\tf.write(content)\n```\n\nPlease refer [Git Hooks](http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) for more information.\n"
  },
  {
    "path": "DCO.md",
    "content": "# JerryScript Developer's Certificate of Origin\n\nThe JerryScript project uses the signed-off-by language and process to give us a clear chain of trust for every patch received.\n\n> By making a contribution to this project, I certify that:\n\n> (a)\tThe contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or\n\n> (b)\tThe contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or\n\n> (c)\tThe contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.\n\n> (d)\tI understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project, under the same open source license.\n\nWe have the same requirements for using the signed-off-by process as the Linux kernel.\nIn short, you need to include a signed-off-by tag in the commit message of every patch.\n\nYou should use your real name and email address in the format below:\n\n> JerryScript-DCO-1.0-Signed-off-by: Random J Developer random@developer.example.org\n\n\"JerryScript-DCO-1.0-Signed-off-by:\" this is a developer's certification that he or she has the right to submit the patch for inclusion into the project. It is an agreement to the Developer's Certificate of Origin (above). **Code without a proper signoff cannot be merged into the mainline.**\n"
  },
  {
    "path": "Doxyfile",
    "content": "# Doxyfile 1.9.1\n\n# This file describes the settings to be used by the documentation system\n# doxygen (www.doxygen.org) for a project.\n#\n# All text after a double hash (##) is considered a comment and is placed in\n# front of the TAG it is preceding.\n#\n# All text after a single hash (#) is considered a comment and will be ignored.\n# The format is:\n# TAG = value [value, ...]\n# For lists, items can also be appended using:\n# TAG += value [value, ...]\n# Values that contain spaces should be placed between quotes (\\\" \\\").\n\n#---------------------------------------------------------------------------\n# Project related configuration options\n#---------------------------------------------------------------------------\n\n# This tag specifies the encoding used for all characters in the configuration\n# file that follow. The default is UTF-8 which is also the encoding used for all\n# text before the first occurrence of this tag. Doxygen uses libiconv (or the\n# iconv built into libc) for the transcoding. See\n# https://www.gnu.org/software/libiconv/ for the list of possible encodings.\n# The default value is: UTF-8.\n\nDOXYFILE_ENCODING      = UTF-8\n\n# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by\n# double-quotes, unless you are using Doxywizard) that should identify the\n# project for which the documentation is generated. This name is used in the\n# title of most generated pages and in a few other places.\n# The default value is: My Project.\n\nPROJECT_NAME           = JerryScript\n\n# The PROJECT_NUMBER tag can be used to enter a project or revision number. This\n# could be handy for archiving the generated documentation or if some version\n# control system is used.\n\nPROJECT_NUMBER         =\n\n# Using the PROJECT_BRIEF tag one can provide an optional one line description\n# for a project that appears at the top of each page and should give viewer a\n# quick idea about the purpose of the project. Keep the description short.\n\nPROJECT_BRIEF          = \"JavaScript Engine for Internet of Things\"\n\n# With the PROJECT_LOGO tag one can specify a logo or an icon that is included\n# in the documentation. The maximum height of the logo should not exceed 55\n# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy\n# the logo to the output directory.\n\nPROJECT_LOGO           =\n\n# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path\n# into which the generated documentation will be written. If a relative path is\n# entered, it will be relative to the location where doxygen was started. If\n# left blank the current directory will be used.\n\nOUTPUT_DIRECTORY       = docs/doxygen\n\n# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-\n# directories (in 2 levels) under the output directory of each output format and\n# will distribute the generated files over these directories. Enabling this\n# option can be useful when feeding doxygen a huge amount of source files, where\n# putting all generated files in the same directory would otherwise causes\n# performance problems for the file system.\n# The default value is: NO.\n\nCREATE_SUBDIRS         = NO\n\n# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII\n# characters to appear in the names of generated files. If set to NO, non-ASCII\n# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode\n# U+3044.\n# The default value is: NO.\n\nALLOW_UNICODE_NAMES    = NO\n\n# The OUTPUT_LANGUAGE tag is used to specify the language in which all\n# documentation generated by doxygen is written. Doxygen will use this\n# information to generate all constant output in the proper language.\n# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,\n# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),\n# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,\n# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),\n# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,\n# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,\n# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,\n# Ukrainian and Vietnamese.\n# The default value is: English.\n\nOUTPUT_LANGUAGE        = English\n\n# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all\n# documentation generated by doxygen is written. Doxygen will use this\n# information to generate all generated output in the proper direction.\n# Possible values are: None, LTR, RTL and Context.\n# The default value is: None.\n\nOUTPUT_TEXT_DIRECTION  = None\n\n# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member\n# descriptions after the members that are listed in the file and class\n# documentation (similar to Javadoc). Set to NO to disable this.\n# The default value is: YES.\n\nBRIEF_MEMBER_DESC      = YES\n\n# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief\n# description of a member or function before the detailed description\n#\n# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the\n# brief descriptions will be completely suppressed.\n# The default value is: YES.\n\nREPEAT_BRIEF           = YES\n\n# This tag implements a quasi-intelligent brief description abbreviator that is\n# used to form the text in various listings. Each string in this list, if found\n# as the leading text of the brief description, will be stripped from the text\n# and the result, after processing the whole list, is used as the annotated\n# text. Otherwise, the brief description is used as-is. If left blank, the\n# following values are used ($name is automatically replaced with the name of\n# the entity):The $name class, The $name widget, The $name file, is, provides,\n# specifies, contains, represents, a, an and the.\n\nABBREVIATE_BRIEF       =\n\n# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then\n# doxygen will generate a detailed section even if there is only a brief\n# description.\n# The default value is: NO.\n\nALWAYS_DETAILED_SEC    = YES\n\n# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all\n# inherited members of a class in the documentation of that class as if those\n# members were ordinary class members. Constructors, destructors and assignment\n# operators of the base classes will not be shown.\n# The default value is: NO.\n\nINLINE_INHERITED_MEMB  = NO\n\n# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path\n# before files name in the file list and in the header files. If set to NO the\n# shortest path that makes the file name unique will be used\n# The default value is: YES.\n\nFULL_PATH_NAMES        = YES\n\n# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.\n# Stripping is only done if one of the specified strings matches the left-hand\n# part of the path. The tag can be used to show relative paths in the file list.\n# If left blank the directory from which doxygen is run is used as the path to\n# strip.\n#\n# Note that you can specify absolute paths here, but also relative paths, which\n# will be relative from the directory where doxygen is started.\n# This tag requires that the tag FULL_PATH_NAMES is set to YES.\n\nSTRIP_FROM_PATH        =\n\n# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the\n# path mentioned in the documentation of a class, which tells the reader which\n# header file to include in order to use a class. If left blank only the name of\n# the header file containing the class definition is used. Otherwise one should\n# specify the list of include paths that are normally passed to the compiler\n# using the -I flag.\n\nSTRIP_FROM_INC_PATH    =\n\n# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but\n# less readable) file names. This can be useful is your file systems doesn't\n# support long names like on DOS, Mac, or CD-ROM.\n# The default value is: NO.\n\nSHORT_NAMES            = NO\n\n# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the\n# first line (until the first dot) of a Javadoc-style comment as the brief\n# description. If set to NO, the Javadoc-style will behave just like regular Qt-\n# style comments (thus requiring an explicit @brief command for a brief\n# description.)\n# The default value is: NO.\n\nJAVADOC_AUTOBRIEF      = YES\n\n# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line\n# such as\n# /***************\n# as being the beginning of a Javadoc-style comment \"banner\". If set to NO, the\n# Javadoc-style will behave just like regular comments and it will not be\n# interpreted by doxygen.\n# The default value is: NO.\n\nJAVADOC_BANNER         = NO\n\n# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first\n# line (until the first dot) of a Qt-style comment as the brief description. If\n# set to NO, the Qt-style will behave just like regular Qt-style comments (thus\n# requiring an explicit \\brief command for a brief description.)\n# The default value is: NO.\n\nQT_AUTOBRIEF           = NO\n\n# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a\n# multi-line C++ special comment block (i.e. a block of //! or /// comments) as\n# a brief description. This used to be the default behavior. The new default is\n# to treat a multi-line C++ comment block as a detailed description. Set this\n# tag to YES if you prefer the old behavior instead.\n#\n# Note that setting this tag to YES also means that rational rose comments are\n# not recognized any more.\n# The default value is: NO.\n\nMULTILINE_CPP_IS_BRIEF = NO\n\n# By default Python docstrings are displayed as preformatted text and doxygen's\n# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the\n# doxygen's special commands can be used and the contents of the docstring\n# documentation blocks is shown as doxygen documentation.\n# The default value is: YES.\n\nPYTHON_DOCSTRING       = YES\n\n# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the\n# documentation from any documented member that it re-implements.\n# The default value is: YES.\n\nINHERIT_DOCS           = YES\n\n# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new\n# page for each member. If set to NO, the documentation of a member will be part\n# of the file/class/namespace that contains it.\n# The default value is: NO.\n\nSEPARATE_MEMBER_PAGES  = NO\n\n# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen\n# uses this value to replace tabs by spaces in code fragments.\n# Minimum value: 1, maximum value: 16, default value: 4.\n\nTAB_SIZE               = 2\n\n# This tag can be used to specify a number of aliases that act as commands in\n# the documentation. An alias has the form:\n# name=value\n# For example adding\n# \"sideeffect=@par Side Effects:\\n\"\n# will allow you to put the command \\sideeffect (or @sideeffect) in the\n# documentation, which will result in a user-defined paragraph with heading\n# \"Side Effects:\". You can put \\n's in the value part of an alias to insert\n# newlines (in the resulting output). You can put ^^ in the value part of an\n# alias to insert a newline as if a physical newline was in the original file.\n# When you need a literal { or } or , in the value part of an alias you have to\n# escape them by means of a backslash (\\), this can lead to conflicts with the\n# commands \\{ and \\} for these it is advised to use the version @{ and @} or use\n# a double escape (\\\\{ and \\\\})\n\nALIASES                =\n\n# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources\n# only. Doxygen will then generate output that is more tailored for C. For\n# instance, some of the names that are used will be different. The list of all\n# members will be omitted, etc.\n# The default value is: NO.\n\nOPTIMIZE_OUTPUT_FOR_C  = YES\n\n# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or\n# Python sources only. Doxygen will then generate output that is more tailored\n# for that language. For instance, namespaces will be presented as packages,\n# qualified scopes will look different, etc.\n# The default value is: NO.\n\nOPTIMIZE_OUTPUT_JAVA   = NO\n\n# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran\n# sources. Doxygen will then generate output that is tailored for Fortran.\n# The default value is: NO.\n\nOPTIMIZE_FOR_FORTRAN   = NO\n\n# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL\n# sources. Doxygen will then generate output that is tailored for VHDL.\n# The default value is: NO.\n\nOPTIMIZE_OUTPUT_VHDL   = NO\n\n# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice\n# sources only. Doxygen will then generate output that is more tailored for that\n# language. For instance, namespaces will be presented as modules, types will be\n# separated into more groups, etc.\n# The default value is: NO.\n\nOPTIMIZE_OUTPUT_SLICE  = NO\n\n# Doxygen selects the parser to use depending on the extension of the files it\n# parses. With this tag you can assign which parser to use for a given\n# extension. Doxygen has a built-in mapping, but you can override or extend it\n# using this tag. The format is ext=language, where ext is a file extension, and\n# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,\n# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL,\n# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:\n# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser\n# tries to guess whether the code is fixed or free formatted code, this is the\n# default for Fortran type files). For instance to make doxygen treat .inc files\n# as Fortran files (default is PHP), and .f files as C (default is Fortran),\n# use: inc=Fortran f=C.\n#\n# Note: For files without extension you can use no_extension as a placeholder.\n#\n# Note that for custom extensions you also need to set FILE_PATTERNS otherwise\n# the files are not read by doxygen. When specifying no_extension you should add\n# * to the FILE_PATTERNS.\n#\n# Note see also the list of default file extension mappings.\n\nEXTENSION_MAPPING      =\n\n# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments\n# according to the Markdown format, which allows for more readable\n# documentation. See https://daringfireball.net/projects/markdown/ for details.\n# The output of markdown processing is further processed by doxygen, so you can\n# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in\n# case of backward compatibilities issues.\n# The default value is: YES.\n\nMARKDOWN_SUPPORT       = YES\n\n# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up\n# to that level are automatically included in the table of contents, even if\n# they do not have an id attribute.\n# Note: This feature currently applies only to Markdown headings.\n# Minimum value: 0, maximum value: 99, default value: 5.\n# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.\n\nTOC_INCLUDE_HEADINGS   = 5\n\n# When enabled doxygen tries to link words that correspond to documented\n# classes, or namespaces to their corresponding documentation. Such a link can\n# be prevented in individual cases by putting a % sign in front of the word or\n# globally by setting AUTOLINK_SUPPORT to NO.\n# The default value is: YES.\n\nAUTOLINK_SUPPORT       = YES\n\n# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want\n# to include (a tag file for) the STL sources as input, then you should set this\n# tag to YES in order to let doxygen match functions declarations and\n# definitions whose arguments contain STL classes (e.g. func(std::string);\n# versus func(std::string) {}). This also make the inheritance and collaboration\n# diagrams that involve STL classes more complete and accurate.\n# The default value is: NO.\n\nBUILTIN_STL_SUPPORT    = NO\n\n# If you use Microsoft's C++/CLI language, you should set this option to YES to\n# enable parsing support.\n# The default value is: NO.\n\nCPP_CLI_SUPPORT        = NO\n\n# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:\n# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen\n# will parse them like normal C++ but will assume all classes use public instead\n# of private inheritance when no explicit protection keyword is present.\n# The default value is: NO.\n\nSIP_SUPPORT            = NO\n\n# For Microsoft's IDL there are propget and propput attributes to indicate\n# getter and setter methods for a property. Setting this option to YES will make\n# doxygen to replace the get and set methods by a property in the documentation.\n# This will only work if the methods are indeed getting or setting a simple\n# type. If this is not the case, or you want to show the methods anyway, you\n# should set this option to NO.\n# The default value is: YES.\n\nIDL_PROPERTY_SUPPORT   = YES\n\n# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC\n# tag is set to YES then doxygen will reuse the documentation of the first\n# member in the group (if any) for the other members of the group. By default\n# all members of a group must be documented explicitly.\n# The default value is: NO.\n\nDISTRIBUTE_GROUP_DOC   = YES\n\n# If one adds a struct or class to a group and this option is enabled, then also\n# any nested class or struct is added to the same group. By default this option\n# is disabled and one has to add nested compounds explicitly via \\ingroup.\n# The default value is: NO.\n\nGROUP_NESTED_COMPOUNDS = NO\n\n# Set the SUBGROUPING tag to YES to allow class member groups of the same type\n# (for instance a group of public functions) to be put as a subgroup of that\n# type (e.g. under the Public Functions section). Set it to NO to prevent\n# subgrouping. Alternatively, this can be done per class using the\n# \\nosubgrouping command.\n# The default value is: YES.\n\nSUBGROUPING            = YES\n\n# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions\n# are shown inside the group in which they are included (e.g. using \\ingroup)\n# instead of on a separate page (for HTML and Man pages) or section (for LaTeX\n# and RTF).\n#\n# Note that this feature does not work in combination with\n# SEPARATE_MEMBER_PAGES.\n# The default value is: NO.\n\nINLINE_GROUPED_CLASSES = NO\n\n# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions\n# with only public data fields or simple typedef fields will be shown inline in\n# the documentation of the scope in which they are defined (i.e. file,\n# namespace, or group documentation), provided this scope is documented. If set\n# to NO, structs, classes, and unions are shown on a separate page (for HTML and\n# Man pages) or section (for LaTeX and RTF).\n# The default value is: NO.\n\nINLINE_SIMPLE_STRUCTS  = NO\n\n# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or\n# enum is documented as struct, union, or enum with the name of the typedef. So\n# typedef struct TypeS {} TypeT, will appear in the documentation as a struct\n# with name TypeT. When disabled the typedef will appear as a member of a file,\n# namespace, or class. And the struct will be named TypeS. This can typically be\n# useful for C code in case the coding convention dictates that all compound\n# types are typedef'ed and only the typedef is referenced, never the tag name.\n# The default value is: NO.\n\nTYPEDEF_HIDES_STRUCT   = NO\n\n# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This\n# cache is used to resolve symbols given their name and scope. Since this can be\n# an expensive process and often the same symbol appears multiple times in the\n# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small\n# doxygen will become slower. If the cache is too large, memory is wasted. The\n# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range\n# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536\n# symbols. At the end of a run doxygen will report the cache usage and suggest\n# the optimal cache size from a speed point of view.\n# Minimum value: 0, maximum value: 9, default value: 0.\n\nLOOKUP_CACHE_SIZE      = 0\n\n# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use\n# during processing. When set to 0 doxygen will based this on the number of\n# cores available in the system. You can set it explicitly to a value larger\n# than 0 to get more control over the balance between CPU load and processing\n# speed. At this moment only the input processing can be done using multiple\n# threads. Since this is still an experimental feature the default is set to 1,\n# which efficively disables parallel processing. Please report any issues you\n# encounter. Generating dot graphs in parallel is controlled by the\n# DOT_NUM_THREADS setting.\n# Minimum value: 0, maximum value: 32, default value: 1.\n\nNUM_PROC_THREADS       = 1\n\n#---------------------------------------------------------------------------\n# Build related configuration options\n#---------------------------------------------------------------------------\n\n# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in\n# documentation are documented, even if no documentation was available. Private\n# class members and static file members will be hidden unless the\n# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.\n# Note: This will also disable the warnings about undocumented members that are\n# normally produced when WARNINGS is set to YES.\n# The default value is: NO.\n\nEXTRACT_ALL            = NO\n\n# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will\n# be included in the documentation.\n# The default value is: NO.\n\nEXTRACT_PRIVATE        = YES\n\n# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual\n# methods of a class will be included in the documentation.\n# The default value is: NO.\n\nEXTRACT_PRIV_VIRTUAL   = NO\n\n# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal\n# scope will be included in the documentation.\n# The default value is: NO.\n\nEXTRACT_PACKAGE        = NO\n\n# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be\n# included in the documentation.\n# The default value is: NO.\n\nEXTRACT_STATIC         = YES\n\n# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined\n# locally in source files will be included in the documentation. If set to NO,\n# only classes defined in header files are included. Does not have any effect\n# for Java sources.\n# The default value is: YES.\n\nEXTRACT_LOCAL_CLASSES  = YES\n\n# This flag is only useful for Objective-C code. If set to YES, local methods,\n# which are defined in the implementation section but not in the interface are\n# included in the documentation. If set to NO, only methods in the interface are\n# included.\n# The default value is: NO.\n\nEXTRACT_LOCAL_METHODS  = YES\n\n# If this flag is set to YES, the members of anonymous namespaces will be\n# extracted and appear in the documentation as a namespace called\n# 'anonymous_namespace{file}', where file will be replaced with the base name of\n# the file that contains the anonymous namespace. By default anonymous namespace\n# are hidden.\n# The default value is: NO.\n\nEXTRACT_ANON_NSPACES   = NO\n\n# If this flag is set to YES, the name of an unnamed parameter in a declaration\n# will be determined by the corresponding definition. By default unnamed\n# parameters remain unnamed in the output.\n# The default value is: YES.\n\nRESOLVE_UNNAMED_PARAMS = YES\n\n# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all\n# undocumented members inside documented classes or files. If set to NO these\n# members will be included in the various overviews, but no documentation\n# section is generated. This option has no effect if EXTRACT_ALL is enabled.\n# The default value is: NO.\n\nHIDE_UNDOC_MEMBERS     = NO\n\n# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all\n# undocumented classes that are normally visible in the class hierarchy. If set\n# to NO, these classes will be included in the various overviews. This option\n# has no effect if EXTRACT_ALL is enabled.\n# The default value is: NO.\n\nHIDE_UNDOC_CLASSES     = NO\n\n# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend\n# declarations. If set to NO, these declarations will be included in the\n# documentation.\n# The default value is: NO.\n\nHIDE_FRIEND_COMPOUNDS  = NO\n\n# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any\n# documentation blocks found inside the body of a function. If set to NO, these\n# blocks will be appended to the function's detailed documentation block.\n# The default value is: NO.\n\nHIDE_IN_BODY_DOCS      = NO\n\n# The INTERNAL_DOCS tag determines if documentation that is typed after a\n# \\internal command is included. If the tag is set to NO then the documentation\n# will be excluded. Set it to YES to include the internal documentation.\n# The default value is: NO.\n\nINTERNAL_DOCS          = NO\n\n# With the correct setting of option CASE_SENSE_NAMES doxygen will better be\n# able to match the capabilities of the underlying filesystem. In case the\n# filesystem is case sensitive (i.e. it supports files in the same directory\n# whose names only differ in casing), the option must be set to YES to properly\n# deal with such files in case they appear in the input. For filesystems that\n# are not case sensitive the option should be be set to NO to properly deal with\n# output files written for symbols that only differ in casing, such as for two\n# classes, one named CLASS and the other named Class, and to also support\n# references to files without having to specify the exact matching casing. On\n# Windows (including Cygwin) and MacOS, users should typically set this option\n# to NO, whereas on Linux or other Unix flavors it should typically be set to\n# YES.\n# The default value is: system dependent.\n\nCASE_SENSE_NAMES       = YES\n\n# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with\n# their full class and namespace scopes in the documentation. If set to YES, the\n# scope will be hidden.\n# The default value is: NO.\n\nHIDE_SCOPE_NAMES       = NO\n\n# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will\n# append additional text to a page's title, such as Class Reference. If set to\n# YES the compound reference will be hidden.\n# The default value is: NO.\n\nHIDE_COMPOUND_REFERENCE= NO\n\n# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of\n# the files that are included by a file in the documentation of that file.\n# The default value is: YES.\n\nSHOW_INCLUDE_FILES     = YES\n\n# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each\n# grouped member an include statement to the documentation, telling the reader\n# which file to include in order to use the member.\n# The default value is: NO.\n\nSHOW_GROUPED_MEMB_INC  = NO\n\n# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include\n# files with double quotes in the documentation rather than with sharp brackets.\n# The default value is: NO.\n\nFORCE_LOCAL_INCLUDES   = NO\n\n# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the\n# documentation for inline members.\n# The default value is: YES.\n\nINLINE_INFO            = YES\n\n# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the\n# (detailed) documentation of file and class members alphabetically by member\n# name. If set to NO, the members will appear in declaration order.\n# The default value is: YES.\n\nSORT_MEMBER_DOCS       = YES\n\n# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief\n# descriptions of file, namespace and class members alphabetically by member\n# name. If set to NO, the members will appear in declaration order. Note that\n# this will also influence the order of the classes in the class list.\n# The default value is: NO.\n\nSORT_BRIEF_DOCS        = YES\n\n# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the\n# (brief and detailed) documentation of class members so that constructors and\n# destructors are listed first. If set to NO the constructors will appear in the\n# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.\n# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief\n# member documentation.\n# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting\n# detailed member documentation.\n# The default value is: NO.\n\nSORT_MEMBERS_CTORS_1ST = NO\n\n# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy\n# of group names into alphabetical order. If set to NO the group names will\n# appear in their defined order.\n# The default value is: NO.\n\nSORT_GROUP_NAMES       = NO\n\n# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by\n# fully-qualified names, including namespaces. If set to NO, the class list will\n# be sorted only by class name, not including the namespace part.\n# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.\n# Note: This option applies only to the class list, not to the alphabetical\n# list.\n# The default value is: NO.\n\nSORT_BY_SCOPE_NAME     = NO\n\n# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper\n# type resolution of all parameters of a function it will reject a match between\n# the prototype and the implementation of a member function even if there is\n# only one candidate or it is obvious which candidate to choose by doing a\n# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still\n# accept a match between prototype and implementation in such cases.\n# The default value is: NO.\n\nSTRICT_PROTO_MATCHING  = NO\n\n# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo\n# list. This list is created by putting \\todo commands in the documentation.\n# The default value is: YES.\n\nGENERATE_TODOLIST      = YES\n\n# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test\n# list. This list is created by putting \\test commands in the documentation.\n# The default value is: YES.\n\nGENERATE_TESTLIST      = YES\n\n# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug\n# list. This list is created by putting \\bug commands in the documentation.\n# The default value is: YES.\n\nGENERATE_BUGLIST       = YES\n\n# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)\n# the deprecated list. This list is created by putting \\deprecated commands in\n# the documentation.\n# The default value is: YES.\n\nGENERATE_DEPRECATEDLIST= YES\n\n# The ENABLED_SECTIONS tag can be used to enable conditional documentation\n# sections, marked by \\if <section_label> ... \\endif and \\cond <section_label>\n# ... \\endcond blocks.\n\nENABLED_SECTIONS       =\n\n# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the\n# initial value of a variable or macro / define can have for it to appear in the\n# documentation. If the initializer consists of more lines than specified here\n# it will be hidden. Use a value of 0 to hide initializers completely. The\n# appearance of the value of individual variables and macros / defines can be\n# controlled using \\showinitializer or \\hideinitializer command in the\n# documentation regardless of this setting.\n# Minimum value: 0, maximum value: 10000, default value: 30.\n\nMAX_INITIALIZER_LINES  = 30\n\n# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at\n# the bottom of the documentation of classes and structs. If set to YES, the\n# list will mention the files that were used to generate the documentation.\n# The default value is: YES.\n\nSHOW_USED_FILES        = YES\n\n# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This\n# will remove the Files entry from the Quick Index and from the Folder Tree View\n# (if specified).\n# The default value is: YES.\n\nSHOW_FILES             = YES\n\n# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces\n# page. This will remove the Namespaces entry from the Quick Index and from the\n# Folder Tree View (if specified).\n# The default value is: YES.\n\nSHOW_NAMESPACES        = YES\n\n# The FILE_VERSION_FILTER tag can be used to specify a program or script that\n# doxygen should invoke to get the current version for each file (typically from\n# the version control system). Doxygen will invoke the program by executing (via\n# popen()) the command command input-file, where command is the value of the\n# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided\n# by doxygen. Whatever the program writes to standard output is used as the file\n# version. For an example see the documentation.\n\nFILE_VERSION_FILTER    =\n\n# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed\n# by doxygen. The layout file controls the global structure of the generated\n# output files in an output format independent way. To create the layout file\n# that represents doxygen's defaults, run doxygen with the -l option. You can\n# optionally specify a file name after the option, if omitted DoxygenLayout.xml\n# will be used as the name of the layout file.\n#\n# Note that if you run doxygen from a directory containing a file called\n# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE\n# tag is left empty.\n\nLAYOUT_FILE            =\n\n# The CITE_BIB_FILES tag can be used to specify one or more bib files containing\n# the reference definitions. This must be a list of .bib files. The .bib\n# extension is automatically appended if omitted. This requires the bibtex tool\n# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.\n# For LaTeX the style of the bibliography can be controlled using\n# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the\n# search path. See also \\cite for info how to create references.\n\nCITE_BIB_FILES         =\n\n#---------------------------------------------------------------------------\n# Configuration options related to warning and progress messages\n#---------------------------------------------------------------------------\n\n# The QUIET tag can be used to turn on/off the messages that are generated to\n# standard output by doxygen. If QUIET is set to YES this implies that the\n# messages are off.\n# The default value is: NO.\n\nQUIET                  = NO\n\n# The WARNINGS tag can be used to turn on/off the warning messages that are\n# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES\n# this implies that the warnings are on.\n#\n# Tip: Turn warnings on while writing the documentation.\n# The default value is: YES.\n\nWARNINGS               = YES\n\n# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate\n# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag\n# will automatically be disabled.\n# The default value is: YES.\n\nWARN_IF_UNDOCUMENTED   = YES\n\n# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for\n# potential errors in the documentation, such as not documenting some parameters\n# in a documented function, or documenting parameters that don't exist or using\n# markup commands wrongly.\n# The default value is: YES.\n\nWARN_IF_DOC_ERROR      = YES\n\n# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that\n# are documented, but have no documentation for their parameters or return\n# value. If set to NO, doxygen will only warn about wrong or incomplete\n# parameter documentation, but not about the absence of documentation. If\n# EXTRACT_ALL is set to YES then this flag will automatically be disabled.\n# The default value is: NO.\n\nWARN_NO_PARAMDOC       = YES\n\n# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when\n# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS\n# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but\n# at the end of the doxygen process doxygen will return with a non-zero status.\n# Possible values are: NO, YES and FAIL_ON_WARNINGS.\n# The default value is: NO.\n\nWARN_AS_ERROR          = NO\n\n# The WARN_FORMAT tag determines the format of the warning messages that doxygen\n# can produce. The string should contain the $file, $line, and $text tags, which\n# will be replaced by the file and line number from which the warning originated\n# and the warning text. Optionally the format may contain $version, which will\n# be replaced by the version of the file (if it could be obtained via\n# FILE_VERSION_FILTER)\n# The default value is: $file:$line: $text.\n\nWARN_FORMAT            = \"$file:$line: $text\"\n\n# The WARN_LOGFILE tag can be used to specify a file to which warning and error\n# messages should be written. If left blank the output is written to standard\n# error (stderr).\n\nWARN_LOGFILE           =\n\n#---------------------------------------------------------------------------\n# Configuration options related to the input files\n#---------------------------------------------------------------------------\n\n# The INPUT tag is used to specify the files and/or directories that contain\n# documented source files. You may enter file names like myfile.cpp or\n# directories like /usr/src/myproject. Separate the files or directories with\n# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING\n# Note: If this tag is empty the current directory is searched.\n\nINPUT                  = jerry-core \\\n                         jerry-ext \\\n                         jerry-port\n\n# This tag can be used to specify the character encoding of the source files\n# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses\n# libiconv (or the iconv built into libc) for the transcoding. See the libiconv\n# documentation (see:\n# https://www.gnu.org/software/libiconv/) for the list of possible encodings.\n# The default value is: UTF-8.\n\nINPUT_ENCODING         = UTF-8\n\n# If the value of the INPUT tag contains directories, you can use the\n# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and\n# *.h) to filter out the source-files in the directories.\n#\n# Note that for custom extensions or not directly supported extensions you also\n# need to set EXTENSION_MAPPING for the extension otherwise the files are not\n# read by doxygen.\n#\n# Note the list of default checked file patterns might differ from the list of\n# default file extension mappings.\n#\n# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,\n# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,\n# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,\n# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),\n# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl,\n# *.ucf, *.qsf and *.ice.\n\nFILE_PATTERNS          = *.h \\\n                         *.c\n\n# The RECURSIVE tag can be used to specify whether or not subdirectories should\n# be searched for input files as well.\n# The default value is: NO.\n\nRECURSIVE              = YES\n\n# The EXCLUDE tag can be used to specify files and/or directories that should be\n# excluded from the INPUT source files. This way you can easily exclude a\n# subdirectory from a directory tree whose root is specified with the INPUT tag.\n#\n# Note that relative paths are relative to the directory from which doxygen is\n# run.\n\n# FIXME: None of these files are excluded light-heartedly. They should be\n# removed one-by-one and warnings reported by doxygen should be fixed by those\n# who are familiar with the undocumented parts.\nEXCLUDE                = jerry-core/ecma/base/ecma-globals.h \\\n                         jerry-core/ecma/operations/ecma-exceptions.h \\\n                         jerry-core/include/jerryscript-debugger-transport.h \\\n                         jerry-core/jcontext/jcontext.h \\\n                         jerry-core/parser/js/byte-code.h \\\n                         jerry-core/parser/js/common.h \\\n                         jerry-core/parser/js/js-lexer.h \\\n                         jerry-core/parser/js/js-parser-internal.h \\\n                         jerry-core/parser/regexp/re-parser.h \\\n                         jerry-core/vm/vm-stack.h\n\n# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or\n# directories that are symbolic links (a Unix file system feature) are excluded\n# from the input.\n# The default value is: NO.\n\nEXCLUDE_SYMLINKS       = NO\n\n# If the value of the INPUT tag contains directories, you can use the\n# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude\n# certain files from those directories.\n#\n# Note that the wildcards are matched against the file with absolute path, so to\n# exclude all test directories for example use the pattern */test/*\n\nEXCLUDE_PATTERNS       = *.inc.h\n\n# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names\n# (namespaces, classes, functions, etc.) that should be excluded from the\n# output. The symbol name can be a fully qualified name, a word, or if the\n# wildcard * is used, a substring. Examples: ANamespace, AClass,\n# AClass::ANamespace, ANamespace::*Test\n#\n# Note that the wildcards are matched against the file with absolute path, so to\n# exclude all test directories use the pattern */test/*\n\nEXCLUDE_SYMBOLS        =\n\n# The EXAMPLE_PATH tag can be used to specify one or more files or directories\n# that contain example code fragments that are included (see the \\include\n# command).\n\nEXAMPLE_PATH           =\n\n# If the value of the EXAMPLE_PATH tag contains directories, you can use the\n# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and\n# *.h) to filter out the source-files in the directories. If left blank all\n# files are included.\n\nEXAMPLE_PATTERNS       =\n\n# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be\n# searched for input files to be used with the \\include or \\dontinclude commands\n# irrespective of the value of the RECURSIVE tag.\n# The default value is: NO.\n\nEXAMPLE_RECURSIVE      = NO\n\n# The IMAGE_PATH tag can be used to specify one or more files or directories\n# that contain images that are to be included in the documentation (see the\n# \\image command).\n\nIMAGE_PATH             =\n\n# The INPUT_FILTER tag can be used to specify a program that doxygen should\n# invoke to filter for each input file. Doxygen will invoke the filter program\n# by executing (via popen()) the command:\n#\n# <filter> <input-file>\n#\n# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the\n# name of an input file. Doxygen will then use the output that the filter\n# program writes to standard output. If FILTER_PATTERNS is specified, this tag\n# will be ignored.\n#\n# Note that the filter must not add or remove lines; it is applied before the\n# code is scanned, but not when the output code is generated. If lines are added\n# or removed, the anchors will not be placed correctly.\n#\n# Note that for custom extensions or not directly supported extensions you also\n# need to set EXTENSION_MAPPING for the extension otherwise the files are not\n# properly processed by doxygen.\n\nINPUT_FILTER           =\n\n# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern\n# basis. Doxygen will compare the file name with each pattern and apply the\n# filter if there is a match. The filters are a list of the form: pattern=filter\n# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how\n# filters are used. If the FILTER_PATTERNS tag is empty or if none of the\n# patterns match the file name, INPUT_FILTER is applied.\n#\n# Note that for custom extensions or not directly supported extensions you also\n# need to set EXTENSION_MAPPING for the extension otherwise the files are not\n# properly processed by doxygen.\n\nFILTER_PATTERNS        =\n\n# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using\n# INPUT_FILTER) will also be used to filter the input files that are used for\n# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).\n# The default value is: NO.\n\nFILTER_SOURCE_FILES    = NO\n\n# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file\n# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and\n# it is also possible to disable source filtering for a specific pattern using\n# *.ext= (so without naming a filter).\n# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.\n\nFILTER_SOURCE_PATTERNS =\n\n# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that\n# is part of the input, its contents will be placed on the main page\n# (index.html). This can be useful if you have a project on for instance GitHub\n# and want to reuse the introduction page also for the doxygen output.\n\nUSE_MDFILE_AS_MAINPAGE =\n\n#---------------------------------------------------------------------------\n# Configuration options related to source browsing\n#---------------------------------------------------------------------------\n\n# If the SOURCE_BROWSER tag is set to YES then a list of source files will be\n# generated. Documented entities will be cross-referenced with these sources.\n#\n# Note: To get rid of all source code in the generated output, make sure that\n# also VERBATIM_HEADERS is set to NO.\n# The default value is: NO.\n\nSOURCE_BROWSER         = YES\n\n# Setting the INLINE_SOURCES tag to YES will include the body of functions,\n# classes and enums directly into the documentation.\n# The default value is: NO.\n\nINLINE_SOURCES         = NO\n\n# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any\n# special comment blocks from generated source code fragments. Normal C, C++ and\n# Fortran comments will always remain visible.\n# The default value is: YES.\n\nSTRIP_CODE_COMMENTS    = YES\n\n# If the REFERENCED_BY_RELATION tag is set to YES then for each documented\n# entity all documented functions referencing it will be listed.\n# The default value is: NO.\n\nREFERENCED_BY_RELATION = NO\n\n# If the REFERENCES_RELATION tag is set to YES then for each documented function\n# all documented entities called/used by that function will be listed.\n# The default value is: NO.\n\nREFERENCES_RELATION    = NO\n\n# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set\n# to YES then the hyperlinks from functions in REFERENCES_RELATION and\n# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will\n# link to the documentation.\n# The default value is: YES.\n\nREFERENCES_LINK_SOURCE = YES\n\n# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the\n# source code will show a tooltip with additional information such as prototype,\n# brief description and links to the definition and documentation. Since this\n# will make the HTML file larger and loading of large files a bit slower, you\n# can opt to disable this feature.\n# The default value is: YES.\n# This tag requires that the tag SOURCE_BROWSER is set to YES.\n\nSOURCE_TOOLTIPS        = YES\n\n# If the USE_HTAGS tag is set to YES then the references to source code will\n# point to the HTML generated by the htags(1) tool instead of doxygen built-in\n# source browser. The htags tool is part of GNU's global source tagging system\n# (see https://www.gnu.org/software/global/global.html). You will need version\n# 4.8.6 or higher.\n#\n# To use it do the following:\n# - Install the latest version of global\n# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file\n# - Make sure the INPUT points to the root of the source tree\n# - Run doxygen as normal\n#\n# Doxygen will invoke htags (and that will in turn invoke gtags), so these\n# tools must be available from the command line (i.e. in the search path).\n#\n# The result: instead of the source browser generated by doxygen, the links to\n# source code will now point to the output of htags.\n# The default value is: NO.\n# This tag requires that the tag SOURCE_BROWSER is set to YES.\n\nUSE_HTAGS              = NO\n\n# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a\n# verbatim copy of the header file for each class for which an include is\n# specified. Set to NO to disable this.\n# See also: Section \\class.\n# The default value is: YES.\n\nVERBATIM_HEADERS       = YES\n\n# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the\n# clang parser (see:\n# http://clang.llvm.org/) for more accurate parsing at the cost of reduced\n# performance. This can be particularly helpful with template rich C++ code for\n# which doxygen's built-in parser lacks the necessary type information.\n# Note: The availability of this option depends on whether or not doxygen was\n# generated with the -Duse_libclang=ON option for CMake.\n# The default value is: NO.\n\nCLANG_ASSISTED_PARSING = NO\n\n# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to\n# YES then doxygen will add the directory of each input to the include path.\n# The default value is: YES.\n\nCLANG_ADD_INC_PATHS    = YES\n\n# If clang assisted parsing is enabled you can provide the compiler with command\n# line options that you would normally use when invoking the compiler. Note that\n# the include paths will already be set by doxygen for the files and directories\n# specified with INPUT and INCLUDE_PATH.\n# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.\n\nCLANG_OPTIONS          =\n\n# If clang assisted parsing is enabled you can provide the clang parser with the\n# path to the directory containing a file called compile_commands.json. This\n# file is the compilation database (see:\n# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the\n# options used when the source files were built. This is equivalent to\n# specifying the -p option to a clang tool, such as clang-check. These options\n# will then be passed to the parser. Any options specified with CLANG_OPTIONS\n# will be added as well.\n# Note: The availability of this option depends on whether or not doxygen was\n# generated with the -Duse_libclang=ON option for CMake.\n\nCLANG_DATABASE_PATH    =\n\n#---------------------------------------------------------------------------\n# Configuration options related to the alphabetical class index\n#---------------------------------------------------------------------------\n\n# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all\n# compounds will be generated. Enable this if the project contains a lot of\n# classes, structs, unions or interfaces.\n# The default value is: YES.\n\nALPHABETICAL_INDEX     = YES\n\n# In case all classes in a project start with a common prefix, all classes will\n# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag\n# can be used to specify a prefix (or a list of prefixes) that should be ignored\n# while generating the index headers.\n# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.\n\nIGNORE_PREFIX          =\n\n#---------------------------------------------------------------------------\n# Configuration options related to the HTML output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output\n# The default value is: YES.\n\nGENERATE_HTML          = YES\n\n# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a\n# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of\n# it.\n# The default directory is: html.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_OUTPUT            = html\n\n# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each\n# generated HTML page (for example: .htm, .php, .asp).\n# The default value is: .html.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_FILE_EXTENSION    = .html\n\n# The HTML_HEADER tag can be used to specify a user-defined HTML header file for\n# each generated HTML page. If the tag is left blank doxygen will generate a\n# standard header.\n#\n# To get valid HTML the header file that includes any scripts and style sheets\n# that doxygen needs, which is dependent on the configuration options used (e.g.\n# the setting GENERATE_TREEVIEW). It is highly recommended to start with a\n# default header using\n# doxygen -w html new_header.html new_footer.html new_stylesheet.css\n# YourConfigFile\n# and then modify the file new_header.html. See also section \"Doxygen usage\"\n# for information on how to generate the default header that doxygen normally\n# uses.\n# Note: The header is subject to change so you typically have to regenerate the\n# default header when upgrading to a newer version of doxygen. For a description\n# of the possible markers and block names see the documentation.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_HEADER            =\n\n# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each\n# generated HTML page. If the tag is left blank doxygen will generate a standard\n# footer. See HTML_HEADER for more information on how to generate a default\n# footer and what special commands can be used inside the footer. See also\n# section \"Doxygen usage\" for information on how to generate the default footer\n# that doxygen normally uses.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_FOOTER            =\n\n# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style\n# sheet that is used by each HTML page. It can be used to fine-tune the look of\n# the HTML output. If left blank doxygen will generate a default style sheet.\n# See also section \"Doxygen usage\" for information on how to generate the style\n# sheet that doxygen normally uses.\n# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as\n# it is more robust and this tag (HTML_STYLESHEET) will in the future become\n# obsolete.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_STYLESHEET        =\n\n# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined\n# cascading style sheets that are included after the standard style sheets\n# created by doxygen. Using this option one can overrule certain style aspects.\n# This is preferred over using HTML_STYLESHEET since it does not replace the\n# standard style sheet and is therefore more robust against future updates.\n# Doxygen will copy the style sheet files to the output directory.\n# Note: The order of the extra style sheet files is of importance (e.g. the last\n# style sheet in the list overrules the setting of the previous ones in the\n# list). For an example see the documentation.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_EXTRA_STYLESHEET  =\n\n# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or\n# other source files which should be copied to the HTML output directory. Note\n# that these files will be copied to the base HTML output directory. Use the\n# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these\n# files. In the HTML_STYLESHEET file, use the file name only. Also note that the\n# files will be copied as-is; there are no commands or markers available.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_EXTRA_FILES       =\n\n# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen\n# will adjust the colors in the style sheet and background images according to\n# this color. Hue is specified as an angle on a colorwheel, see\n# https://en.wikipedia.org/wiki/Hue for more information. For instance the value\n# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300\n# purple, and 360 is red again.\n# Minimum value: 0, maximum value: 359, default value: 220.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_COLORSTYLE_HUE    = 220\n\n# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors\n# in the HTML output. For a value of 0 the output will use grayscales only. A\n# value of 255 will produce the most vivid colors.\n# Minimum value: 0, maximum value: 255, default value: 100.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_COLORSTYLE_SAT    = 100\n\n# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the\n# luminance component of the colors in the HTML output. Values below 100\n# gradually make the output lighter, whereas values above 100 make the output\n# darker. The value divided by 100 is the actual gamma applied, so 80 represents\n# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not\n# change the gamma.\n# Minimum value: 40, maximum value: 240, default value: 80.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_COLORSTYLE_GAMMA  = 80\n\n# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML\n# page will contain the date and time when the page was generated. Setting this\n# to YES can help to show when doxygen was last run and thus if the\n# documentation is up to date.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_TIMESTAMP         = NO\n\n# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML\n# documentation will contain a main index with vertical navigation menus that\n# are dynamically created via JavaScript. If disabled, the navigation index will\n# consists of multiple levels of tabs that are statically embedded in every HTML\n# page. Disable this option to support browsers that do not have JavaScript,\n# like the Qt help browser.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_DYNAMIC_MENUS     = YES\n\n# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML\n# documentation will contain sections that can be hidden and shown after the\n# page has loaded.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_DYNAMIC_SECTIONS  = YES\n\n# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries\n# shown in the various tree structured indices initially; the user can expand\n# and collapse entries dynamically later on. Doxygen will expand the tree to\n# such a level that at most the specified number of entries are visible (unless\n# a fully collapsed tree already exceeds this amount). So setting the number of\n# entries 1 will produce a full collapsed tree by default. 0 is a special value\n# representing an infinite number of entries and will result in a full expanded\n# tree by default.\n# Minimum value: 0, maximum value: 9999, default value: 100.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_INDEX_NUM_ENTRIES = 100\n\n# If the GENERATE_DOCSET tag is set to YES, additional index files will be\n# generated that can be used as input for Apple's Xcode 3 integrated development\n# environment (see:\n# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To\n# create a documentation set, doxygen will generate a Makefile in the HTML\n# output directory. Running make will produce the docset in that directory and\n# running make install will install the docset in\n# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at\n# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy\n# genXcode/_index.html for more information.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nGENERATE_DOCSET        = NO\n\n# This tag determines the name of the docset feed. A documentation feed provides\n# an umbrella under which multiple documentation sets from a single provider\n# (such as a company or product suite) can be grouped.\n# The default value is: Doxygen generated docs.\n# This tag requires that the tag GENERATE_DOCSET is set to YES.\n\nDOCSET_FEEDNAME        = \"Doxygen generated docs\"\n\n# This tag specifies a string that should uniquely identify the documentation\n# set bundle. This should be a reverse domain-name style string, e.g.\n# com.mycompany.MyDocSet. Doxygen will append .docset to the name.\n# The default value is: org.doxygen.Project.\n# This tag requires that the tag GENERATE_DOCSET is set to YES.\n\nDOCSET_BUNDLE_ID       = org.doxygen.Project\n\n# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify\n# the documentation publisher. This should be a reverse domain-name style\n# string, e.g. com.mycompany.MyDocSet.documentation.\n# The default value is: org.doxygen.Publisher.\n# This tag requires that the tag GENERATE_DOCSET is set to YES.\n\nDOCSET_PUBLISHER_ID    = org.doxygen.Publisher\n\n# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.\n# The default value is: Publisher.\n# This tag requires that the tag GENERATE_DOCSET is set to YES.\n\nDOCSET_PUBLISHER_NAME  = Publisher\n\n# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three\n# additional HTML index files: index.hhp, index.hhc, and index.hhk. The\n# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop\n# (see:\n# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows.\n#\n# The HTML Help Workshop contains a compiler that can convert all HTML output\n# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML\n# files are now used as the Windows 98 help format, and will replace the old\n# Windows help format (.hlp) on all Windows platforms in the future. Compressed\n# HTML files also contain an index, a table of contents, and you can search for\n# words in the documentation. The HTML workshop also contains a viewer for\n# compressed HTML files.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nGENERATE_HTMLHELP      = NO\n\n# The CHM_FILE tag can be used to specify the file name of the resulting .chm\n# file. You can add a path in front of the file if the result should not be\n# written to the html output directory.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nCHM_FILE               =\n\n# The HHC_LOCATION tag can be used to specify the location (absolute path\n# including file name) of the HTML help compiler (hhc.exe). If non-empty,\n# doxygen will try to run the HTML help compiler on the generated index.hhp.\n# The file has to be specified with full path.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nHHC_LOCATION           =\n\n# The GENERATE_CHI flag controls if a separate .chi index file is generated\n# (YES) or that it should be included in the main .chm file (NO).\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nGENERATE_CHI           = NO\n\n# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)\n# and project file content.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nCHM_INDEX_ENCODING     =\n\n# The BINARY_TOC flag controls whether a binary table of contents is generated\n# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it\n# enables the Previous and Next buttons.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nBINARY_TOC             = NO\n\n# The TOC_EXPAND flag can be set to YES to add extra items for group members to\n# the table of contents of the HTML help documentation and to the tree view.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTMLHELP is set to YES.\n\nTOC_EXPAND             = NO\n\n# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and\n# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that\n# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help\n# (.qch) of the generated HTML documentation.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nGENERATE_QHP           = NO\n\n# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify\n# the file name of the resulting .qch file. The path specified is relative to\n# the HTML output folder.\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQCH_FILE               =\n\n# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help\n# Project output. For more information please see Qt Help Project / Namespace\n# (see:\n# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).\n# The default value is: org.doxygen.Project.\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHP_NAMESPACE          = org.doxygen.Project\n\n# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt\n# Help Project output. For more information please see Qt Help Project / Virtual\n# Folders (see:\n# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders).\n# The default value is: doc.\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHP_VIRTUAL_FOLDER     = doc\n\n# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom\n# filter to add. For more information please see Qt Help Project / Custom\n# Filters (see:\n# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHP_CUST_FILTER_NAME   =\n\n# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the\n# custom filter to add. For more information please see Qt Help Project / Custom\n# Filters (see:\n# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHP_CUST_FILTER_ATTRS  =\n\n# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this\n# project's filter section matches. Qt Help Project / Filter Attributes (see:\n# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHP_SECT_FILTER_ATTRS  =\n\n# The QHG_LOCATION tag can be used to specify the location (absolute path\n# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to\n# run qhelpgenerator on the generated .qhp file.\n# This tag requires that the tag GENERATE_QHP is set to YES.\n\nQHG_LOCATION           =\n\n# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be\n# generated, together with the HTML files, they form an Eclipse help plugin. To\n# install this plugin and make it available under the help contents menu in\n# Eclipse, the contents of the directory containing the HTML and XML files needs\n# to be copied into the plugins directory of eclipse. The name of the directory\n# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.\n# After copying Eclipse needs to be restarted before the help appears.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nGENERATE_ECLIPSEHELP   = NO\n\n# A unique identifier for the Eclipse help plugin. When installing the plugin\n# the directory name containing the HTML and XML files should also have this\n# name. Each documentation set should have its own identifier.\n# The default value is: org.doxygen.Project.\n# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.\n\nECLIPSE_DOC_ID         = org.doxygen.Project\n\n# If you want full control over the layout of the generated HTML pages it might\n# be necessary to disable the index and replace it with your own. The\n# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top\n# of each HTML page. A value of NO enables the index and the value YES disables\n# it. Since the tabs in the index contain the same information as the navigation\n# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nDISABLE_INDEX          = YES\n\n# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index\n# structure should be generated to display hierarchical information. If the tag\n# value is set to YES, a side panel will be generated containing a tree-like\n# index structure (just like the one that is generated for HTML Help). For this\n# to work a browser that supports JavaScript, DHTML, CSS and frames is required\n# (i.e. any modern browser). Windows users are probably better off using the\n# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can\n# further fine-tune the look of the index. As an example, the default style\n# sheet generated by doxygen has an example that shows how to put an image at\n# the root of the tree instead of the PROJECT_NAME. Since the tree basically has\n# the same information as the tab index, you could consider setting\n# DISABLE_INDEX to YES when enabling this option.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nGENERATE_TREEVIEW      = YES\n\n# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that\n# doxygen will group on one line in the generated HTML documentation.\n#\n# Note that a value of 0 will completely suppress the enum values from appearing\n# in the overview section.\n# Minimum value: 0, maximum value: 20, default value: 4.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nENUM_VALUES_PER_LINE   = 4\n\n# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used\n# to set the initial width (in pixels) of the frame in which the tree is shown.\n# Minimum value: 0, maximum value: 1500, default value: 250.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nTREEVIEW_WIDTH         = 250\n\n# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to\n# external symbols imported via tag files in a separate window.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nEXT_LINKS_IN_WINDOW    = NO\n\n# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg\n# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see\n# https://inkscape.org) to generate formulas as SVG images instead of PNGs for\n# the HTML output. These images will generally look nicer at scaled resolutions.\n# Possible values are: png (the default) and svg (looks nicer but requires the\n# pdf2svg or inkscape tool).\n# The default value is: png.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nHTML_FORMULA_FORMAT    = png\n\n# Use this tag to change the font size of LaTeX formulas included as images in\n# the HTML documentation. When you change the font size after a successful\n# doxygen run you need to manually remove any form_*.png images from the HTML\n# output directory to force them to be regenerated.\n# Minimum value: 8, maximum value: 50, default value: 10.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nFORMULA_FONTSIZE       = 10\n\n# Use the FORMULA_TRANSPARENT tag to determine whether or not the images\n# generated for formulas are transparent PNGs. Transparent PNGs are not\n# supported properly for IE 6.0, but are supported on all modern browsers.\n#\n# Note that when changing this option you need to delete any form_*.png files in\n# the HTML output directory before the changes have effect.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nFORMULA_TRANSPARENT    = YES\n\n# The FORMULA_MACROFILE can contain LaTeX \\newcommand and \\renewcommand commands\n# to create new LaTeX commands to be used in formulas as building blocks. See\n# the section \"Including formulas\" for details.\n\nFORMULA_MACROFILE      =\n\n# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see\n# https://www.mathjax.org) which uses client side JavaScript for the rendering\n# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX\n# installed or if you want to formulas look prettier in the HTML output. When\n# enabled you may also need to install MathJax separately and configure the path\n# to it using the MATHJAX_RELPATH option.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nUSE_MATHJAX            = NO\n\n# When MathJax is enabled you can set the default output format to be used for\n# the MathJax output. See the MathJax site (see:\n# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details.\n# Possible values are: HTML-CSS (which is slower, but has the best\n# compatibility), NativeMML (i.e. MathML) and SVG.\n# The default value is: HTML-CSS.\n# This tag requires that the tag USE_MATHJAX is set to YES.\n\nMATHJAX_FORMAT         = HTML-CSS\n\n# When MathJax is enabled you need to specify the location relative to the HTML\n# output directory using the MATHJAX_RELPATH option. The destination directory\n# should contain the MathJax.js script. For instance, if the mathjax directory\n# is located at the same level as the HTML output directory, then\n# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax\n# Content Delivery Network so you can quickly see the result without installing\n# MathJax. However, it is strongly recommended to install a local copy of\n# MathJax from https://www.mathjax.org before deployment.\n# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2.\n# This tag requires that the tag USE_MATHJAX is set to YES.\n\nMATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest\n\n# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax\n# extension names that should be enabled during MathJax rendering. For example\n# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols\n# This tag requires that the tag USE_MATHJAX is set to YES.\n\nMATHJAX_EXTENSIONS     =\n\n# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces\n# of code that will be used on startup of the MathJax code. See the MathJax site\n# (see:\n# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an\n# example see the documentation.\n# This tag requires that the tag USE_MATHJAX is set to YES.\n\nMATHJAX_CODEFILE       =\n\n# When the SEARCHENGINE tag is enabled doxygen will generate a search box for\n# the HTML output. The underlying search engine uses javascript and DHTML and\n# should work on any modern browser. Note that when using HTML help\n# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)\n# there is already a search function so this one should typically be disabled.\n# For large projects the javascript based search engine can be slow, then\n# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to\n# search using the keyboard; to jump to the search box use <access key> + S\n# (what the <access key> is depends on the OS and browser, but it is typically\n# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down\n# key> to jump into the search results window, the results can be navigated\n# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel\n# the search. The filter options can be selected when the cursor is inside the\n# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>\n# to select a filter and <Enter> or <escape> to activate or cancel the filter\n# option.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_HTML is set to YES.\n\nSEARCHENGINE           = YES\n\n# When the SERVER_BASED_SEARCH tag is enabled the search engine will be\n# implemented using a web server instead of a web client using JavaScript. There\n# are two flavors of web server based searching depending on the EXTERNAL_SEARCH\n# setting. When disabled, doxygen will generate a PHP script for searching and\n# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing\n# and searching needs to be provided by external tools. See the section\n# \"External Indexing and Searching\" for details.\n# The default value is: NO.\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nSERVER_BASED_SEARCH    = NO\n\n# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP\n# script for searching. Instead the search results are written to an XML file\n# which needs to be processed by an external indexer. Doxygen will invoke an\n# external search engine pointed to by the SEARCHENGINE_URL option to obtain the\n# search results.\n#\n# Doxygen ships with an example indexer (doxyindexer) and search engine\n# (doxysearch.cgi) which are based on the open source search engine library\n# Xapian (see:\n# https://xapian.org/).\n#\n# See the section \"External Indexing and Searching\" for details.\n# The default value is: NO.\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nEXTERNAL_SEARCH        = NO\n\n# The SEARCHENGINE_URL should point to a search engine hosted by a web server\n# which will return the search results when EXTERNAL_SEARCH is enabled.\n#\n# Doxygen ships with an example indexer (doxyindexer) and search engine\n# (doxysearch.cgi) which are based on the open source search engine library\n# Xapian (see:\n# https://xapian.org/). See the section \"External Indexing and Searching\" for\n# details.\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nSEARCHENGINE_URL       =\n\n# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed\n# search data is written to a file for indexing by an external tool. With the\n# SEARCHDATA_FILE tag the name of this file can be specified.\n# The default file is: searchdata.xml.\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nSEARCHDATA_FILE        = searchdata.xml\n\n# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the\n# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is\n# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple\n# projects and redirect the results back to the right project.\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nEXTERNAL_SEARCH_ID     =\n\n# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen\n# projects other than the one defined by this configuration file, but that are\n# all added to the same external search index. Each project needs to have a\n# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of\n# to a relative location where the documentation can be found. The format is:\n# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...\n# This tag requires that the tag SEARCHENGINE is set to YES.\n\nEXTRA_SEARCH_MAPPINGS  =\n\n#---------------------------------------------------------------------------\n# Configuration options related to the LaTeX output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.\n# The default value is: YES.\n\nGENERATE_LATEX         = NO\n\n# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a\n# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of\n# it.\n# The default directory is: latex.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_OUTPUT           = latex\n\n# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be\n# invoked.\n#\n# Note that when not enabling USE_PDFLATEX the default is latex when enabling\n# USE_PDFLATEX the default is pdflatex and when in the later case latex is\n# chosen this is overwritten by pdflatex. For specific output languages the\n# default can have been set differently, this depends on the implementation of\n# the output language.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_CMD_NAME         = latex\n\n# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate\n# index for LaTeX.\n# Note: This tag is used in the Makefile / make.bat.\n# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file\n# (.tex).\n# The default file is: makeindex.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nMAKEINDEX_CMD_NAME     = makeindex\n\n# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to\n# generate index for LaTeX. In case there is no backslash (\\) as first character\n# it will be automatically added in the LaTeX code.\n# Note: This tag is used in the generated output file (.tex).\n# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.\n# The default value is: makeindex.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_MAKEINDEX_CMD    = makeindex\n\n# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX\n# documents. This may be useful for small projects and may help to save some\n# trees in general.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nCOMPACT_LATEX          = NO\n\n# The PAPER_TYPE tag can be used to set the paper type that is used by the\n# printer.\n# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x\n# 14 inches) and executive (7.25 x 10.5 inches).\n# The default value is: a4.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nPAPER_TYPE             = a4\n\n# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names\n# that should be included in the LaTeX output. The package can be specified just\n# by its name or with the correct syntax as to be used with the LaTeX\n# \\usepackage command. To get the times font for instance you can specify :\n# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}\n# To use the option intlimits with the amsmath package you can specify:\n# EXTRA_PACKAGES=[intlimits]{amsmath}\n# If left blank no extra packages will be included.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nEXTRA_PACKAGES         =\n\n# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the\n# generated LaTeX document. The header should contain everything until the first\n# chapter. If it is left blank doxygen will generate a standard header. See\n# section \"Doxygen usage\" for information on how to let doxygen write the\n# default header to a separate file.\n#\n# Note: Only use a user-defined header if you know what you are doing! The\n# following commands have a special meaning inside the header: $title,\n# $datetime, $date, $doxygenversion, $projectname, $projectnumber,\n# $projectbrief, $projectlogo. Doxygen will replace $title with the empty\n# string, for the replacement values of the other commands the user is referred\n# to HTML_HEADER.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_HEADER           =\n\n# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the\n# generated LaTeX document. The footer should contain everything after the last\n# chapter. If it is left blank doxygen will generate a standard footer. See\n# LATEX_HEADER for more information on how to generate a default footer and what\n# special commands can be used inside the footer.\n#\n# Note: Only use a user-defined footer if you know what you are doing!\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_FOOTER           =\n\n# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined\n# LaTeX style sheets that are included after the standard style sheets created\n# by doxygen. Using this option one can overrule certain style aspects. Doxygen\n# will copy the style sheet files to the output directory.\n# Note: The order of the extra style sheet files is of importance (e.g. the last\n# style sheet in the list overrules the setting of the previous ones in the\n# list).\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_EXTRA_STYLESHEET =\n\n# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or\n# other source files which should be copied to the LATEX_OUTPUT output\n# directory. Note that the files will be copied as-is; there are no commands or\n# markers available.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_EXTRA_FILES      =\n\n# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is\n# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will\n# contain links (just like the HTML output) instead of page references. This\n# makes the output suitable for online browsing using a PDF viewer.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nPDF_HYPERLINKS         = YES\n\n# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as\n# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX\n# files. Set this option to YES, to get a higher quality PDF documentation.\n#\n# See also section LATEX_CMD_NAME for selecting the engine.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nUSE_PDFLATEX           = YES\n\n# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode\n# command to the generated LaTeX files. This will instruct LaTeX to keep running\n# if errors occur, instead of asking the user for help. This option is also used\n# when generating formulas in HTML.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_BATCHMODE        = NO\n\n# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the\n# index chapters (such as File Index, Compound Index, etc.) in the output.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_HIDE_INDICES     = NO\n\n# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source\n# code with syntax highlighting in the LaTeX output.\n#\n# Note that which sources are shown also depends on other settings such as\n# SOURCE_BROWSER.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_SOURCE_CODE      = NO\n\n# The LATEX_BIB_STYLE tag can be used to specify the style to use for the\n# bibliography, e.g. plainnat, or ieeetr. See\n# https://en.wikipedia.org/wiki/BibTeX and \\cite for more info.\n# The default value is: plain.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_BIB_STYLE        = plain\n\n# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated\n# page will contain the date and time when the page was generated. Setting this\n# to NO can help when comparing the output of multiple runs.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_TIMESTAMP        = NO\n\n# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)\n# path from which the emoji images will be read. If a relative path is entered,\n# it will be relative to the LATEX_OUTPUT directory. If left blank the\n# LATEX_OUTPUT directory will be used.\n# This tag requires that the tag GENERATE_LATEX is set to YES.\n\nLATEX_EMOJI_DIRECTORY  =\n\n#---------------------------------------------------------------------------\n# Configuration options related to the RTF output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The\n# RTF output is optimized for Word 97 and may not look too pretty with other RTF\n# readers/editors.\n# The default value is: NO.\n\nGENERATE_RTF           = NO\n\n# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a\n# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of\n# it.\n# The default directory is: rtf.\n# This tag requires that the tag GENERATE_RTF is set to YES.\n\nRTF_OUTPUT             = rtf\n\n# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF\n# documents. This may be useful for small projects and may help to save some\n# trees in general.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_RTF is set to YES.\n\nCOMPACT_RTF            = NO\n\n# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will\n# contain hyperlink fields. The RTF file will contain links (just like the HTML\n# output) instead of page references. This makes the output suitable for online\n# browsing using Word or some other Word compatible readers that support those\n# fields.\n#\n# Note: WordPad (write) and others do not support links.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_RTF is set to YES.\n\nRTF_HYPERLINKS         = NO\n\n# Load stylesheet definitions from file. Syntax is similar to doxygen's\n# configuration file, i.e. a series of assignments. You only have to provide\n# replacements, missing definitions are set to their default value.\n#\n# See also section \"Doxygen usage\" for information on how to generate the\n# default style sheet that doxygen normally uses.\n# This tag requires that the tag GENERATE_RTF is set to YES.\n\nRTF_STYLESHEET_FILE    =\n\n# Set optional variables used in the generation of an RTF document. Syntax is\n# similar to doxygen's configuration file. A template extensions file can be\n# generated using doxygen -e rtf extensionFile.\n# This tag requires that the tag GENERATE_RTF is set to YES.\n\nRTF_EXTENSIONS_FILE    =\n\n# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code\n# with syntax highlighting in the RTF output.\n#\n# Note that which sources are shown also depends on other settings such as\n# SOURCE_BROWSER.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_RTF is set to YES.\n\nRTF_SOURCE_CODE        = NO\n\n#---------------------------------------------------------------------------\n# Configuration options related to the man page output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for\n# classes and files.\n# The default value is: NO.\n\nGENERATE_MAN           = NO\n\n# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a\n# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of\n# it. A directory man3 will be created inside the directory specified by\n# MAN_OUTPUT.\n# The default directory is: man.\n# This tag requires that the tag GENERATE_MAN is set to YES.\n\nMAN_OUTPUT             = man\n\n# The MAN_EXTENSION tag determines the extension that is added to the generated\n# man pages. In case the manual section does not start with a number, the number\n# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is\n# optional.\n# The default value is: .3.\n# This tag requires that the tag GENERATE_MAN is set to YES.\n\nMAN_EXTENSION          = .3\n\n# The MAN_SUBDIR tag determines the name of the directory created within\n# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by\n# MAN_EXTENSION with the initial . removed.\n# This tag requires that the tag GENERATE_MAN is set to YES.\n\nMAN_SUBDIR             =\n\n# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it\n# will generate one additional man file for each entity documented in the real\n# man page(s). These additional files only source the real man page, but without\n# them the man command would be unable to find the correct page.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_MAN is set to YES.\n\nMAN_LINKS              = NO\n\n#---------------------------------------------------------------------------\n# Configuration options related to the XML output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that\n# captures the structure of the code including all documentation.\n# The default value is: NO.\n\nGENERATE_XML           = NO\n\n# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a\n# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of\n# it.\n# The default directory is: xml.\n# This tag requires that the tag GENERATE_XML is set to YES.\n\nXML_OUTPUT             = xml\n\n# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program\n# listings (including syntax highlighting and cross-referencing information) to\n# the XML output. Note that enabling this will significantly increase the size\n# of the XML output.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_XML is set to YES.\n\nXML_PROGRAMLISTING     = YES\n\n# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include\n# namespace members in file scope as well, matching the HTML output.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_XML is set to YES.\n\nXML_NS_MEMB_FILE_SCOPE = NO\n\n#---------------------------------------------------------------------------\n# Configuration options related to the DOCBOOK output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files\n# that can be used to generate PDF.\n# The default value is: NO.\n\nGENERATE_DOCBOOK       = NO\n\n# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.\n# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in\n# front of it.\n# The default directory is: docbook.\n# This tag requires that the tag GENERATE_DOCBOOK is set to YES.\n\nDOCBOOK_OUTPUT         = docbook\n\n# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the\n# program listings (including syntax highlighting and cross-referencing\n# information) to the DOCBOOK output. Note that enabling this will significantly\n# increase the size of the DOCBOOK output.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_DOCBOOK is set to YES.\n\nDOCBOOK_PROGRAMLISTING = NO\n\n#---------------------------------------------------------------------------\n# Configuration options for the AutoGen Definitions output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an\n# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures\n# the structure of the code including all documentation. Note that this feature\n# is still experimental and incomplete at the moment.\n# The default value is: NO.\n\nGENERATE_AUTOGEN_DEF   = NO\n\n#---------------------------------------------------------------------------\n# Configuration options related to the Perl module output\n#---------------------------------------------------------------------------\n\n# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module\n# file that captures the structure of the code including all documentation.\n#\n# Note that this feature is still experimental and incomplete at the moment.\n# The default value is: NO.\n\nGENERATE_PERLMOD       = NO\n\n# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary\n# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI\n# output from the Perl module output.\n# The default value is: NO.\n# This tag requires that the tag GENERATE_PERLMOD is set to YES.\n\nPERLMOD_LATEX          = NO\n\n# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely\n# formatted so it can be parsed by a human reader. This is useful if you want to\n# understand what is going on. On the other hand, if this tag is set to NO, the\n# size of the Perl module output will be much smaller and Perl will parse it\n# just the same.\n# The default value is: YES.\n# This tag requires that the tag GENERATE_PERLMOD is set to YES.\n\nPERLMOD_PRETTY         = YES\n\n# The names of the make variables in the generated doxyrules.make file are\n# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful\n# so different doxyrules.make files included by the same Makefile don't\n# overwrite each other's variables.\n# This tag requires that the tag GENERATE_PERLMOD is set to YES.\n\nPERLMOD_MAKEVAR_PREFIX =\n\n#---------------------------------------------------------------------------\n# Configuration options related to the preprocessor\n#---------------------------------------------------------------------------\n\n# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all\n# C-preprocessor directives found in the sources and include files.\n# The default value is: YES.\n\nENABLE_PREPROCESSING   = YES\n\n# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names\n# in the source code. If set to NO, only conditional compilation will be\n# performed. Macro expansion can be done in a controlled way by setting\n# EXPAND_ONLY_PREDEF to YES.\n# The default value is: NO.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nMACRO_EXPANSION        = YES\n\n# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then\n# the macro expansion is limited to the macros specified with the PREDEFINED and\n# EXPAND_AS_DEFINED tags.\n# The default value is: NO.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nEXPAND_ONLY_PREDEF     = YES\n\n# If the SEARCH_INCLUDES tag is set to YES, the include files in the\n# INCLUDE_PATH will be searched if a #include is found.\n# The default value is: YES.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nSEARCH_INCLUDES        = YES\n\n# The INCLUDE_PATH tag can be used to specify one or more directories that\n# contain include files that are not input files but should be processed by the\n# preprocessor.\n# This tag requires that the tag SEARCH_INCLUDES is set to YES.\n\nINCLUDE_PATH           =\n\n# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard\n# patterns (like *.h and *.hpp) to filter out the header-files in the\n# directories. If left blank, the patterns specified with FILE_PATTERNS will be\n# used.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nINCLUDE_FILE_PATTERNS  =\n\n# The PREDEFINED tag can be used to specify one or more macro names that are\n# defined before the preprocessor is started (similar to the -D option of e.g.\n# gcc). The argument of the tag is a list of macros of the form: name or\n# name=definition (no spaces). If the definition and the \"=\" are omitted, \"=1\"\n# is assumed. To prevent a macro definition from being undefined via #undef or\n# recursively expanded use the := operator instead of the = operator.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nPREDEFINED             = \"JERRY_STATIC_ASSERT(x,y)=\" \\\n                         \"JERRY_ATTR_FORMAT(x,y,z)=\" \\\n                         \"JERRY_ATTR_ALWAYS_INLINE=\" \\\n                         \"JERRY_ATTR_NOINLINE=\" \\\n                         \"JERRY_ATTR_PURE=\" \\\n                         \"JERRY_ATTR_CONST=\" \\\n                         \"JERRY_ATTR_HOT=\" \\\n                         \"JERRY_ATTR_NORETURN=\" \\\n                         \"JERRY_ATTR_WEAK=\"\n\n# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this\n# tag can be used to specify a list of macro names that should be expanded. The\n# macro definition that is found in the sources will be used. Use the PREDEFINED\n# tag if you want to use a different macro definition that overrules the\n# definition found in the source code.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nEXPAND_AS_DEFINED      =\n\n# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will\n# remove all references to function-like macros that are alone on a line, have\n# an all uppercase name, and do not end with a semicolon. Such function macros\n# are typically used for boiler-plate code, and will confuse the parser if not\n# removed.\n# The default value is: YES.\n# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.\n\nSKIP_FUNCTION_MACROS   = YES\n\n#---------------------------------------------------------------------------\n# Configuration options related to external references\n#---------------------------------------------------------------------------\n\n# The TAGFILES tag can be used to specify one or more tag files. For each tag\n# file the location of the external documentation should be added. The format of\n# a tag file without this location is as follows:\n# TAGFILES = file1 file2 ...\n# Adding location for the tag files is done as follows:\n# TAGFILES = file1=loc1 \"file2 = loc2\" ...\n# where loc1 and loc2 can be relative or absolute paths or URLs. See the\n# section \"Linking to external documentation\" for more information about the use\n# of tag files.\n# Note: Each tag file must have a unique name (where the name does NOT include\n# the path). If a tag file is not located in the directory in which doxygen is\n# run, you must also specify the path to the tagfile here.\n\nTAGFILES               =\n\n# When a file name is specified after GENERATE_TAGFILE, doxygen will create a\n# tag file that is based on the input files it reads. See section \"Linking to\n# external documentation\" for more information about the usage of tag files.\n\nGENERATE_TAGFILE       =\n\n# If the ALLEXTERNALS tag is set to YES, all external class will be listed in\n# the class index. If set to NO, only the inherited external classes will be\n# listed.\n# The default value is: NO.\n\nALLEXTERNALS           = NO\n\n# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed\n# in the modules index. If set to NO, only the current project's groups will be\n# listed.\n# The default value is: YES.\n\nEXTERNAL_GROUPS        = YES\n\n# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in\n# the related pages index. If set to NO, only the current project's pages will\n# be listed.\n# The default value is: YES.\n\nEXTERNAL_PAGES         = YES\n\n#---------------------------------------------------------------------------\n# Configuration options related to the dot tool\n#---------------------------------------------------------------------------\n\n# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram\n# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to\n# NO turns the diagrams off. Note that this option also works with HAVE_DOT\n# disabled, but it is recommended to install and use dot, since it yields more\n# powerful graphs.\n# The default value is: YES.\n\nCLASS_DIAGRAMS         = YES\n\n# You can include diagrams made with dia in doxygen documentation. Doxygen will\n# then run dia to produce the diagram and insert it in the documentation. The\n# DIA_PATH tag allows you to specify the directory where the dia binary resides.\n# If left empty dia is assumed to be found in the default search path.\n\nDIA_PATH               =\n\n# If set to YES the inheritance and collaboration graphs will hide inheritance\n# and usage relations if the target is undocumented or is not a class.\n# The default value is: YES.\n\nHIDE_UNDOC_RELATIONS   = YES\n\n# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is\n# available from the path. This tool is part of Graphviz (see:\n# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent\n# Bell Labs. The other options in this section have no effect if this option is\n# set to NO\n# The default value is: YES.\n\nHAVE_DOT               = NO\n\n# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed\n# to run in parallel. When set to 0 doxygen will base this on the number of\n# processors available in the system. You can set it explicitly to a value\n# larger than 0 to get control over the balance between CPU load and processing\n# speed.\n# Minimum value: 0, maximum value: 32, default value: 0.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_NUM_THREADS        = 0\n\n# When you want a differently looking font in the dot files that doxygen\n# generates you can specify the font name using DOT_FONTNAME. You need to make\n# sure dot is able to find the font, which can be done by putting it in a\n# standard location or by setting the DOTFONTPATH environment variable or by\n# setting DOT_FONTPATH to the directory containing the font.\n# The default value is: Helvetica.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_FONTNAME           = Helvetica\n\n# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of\n# dot graphs.\n# Minimum value: 4, maximum value: 24, default value: 10.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_FONTSIZE           = 10\n\n# By default doxygen will tell dot to use the default font as specified with\n# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set\n# the path where dot can find it using this tag.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_FONTPATH           =\n\n# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for\n# each documented class showing the direct and indirect inheritance relations.\n# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nCLASS_GRAPH            = YES\n\n# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a\n# graph for each documented class showing the direct and indirect implementation\n# dependencies (inheritance, containment, and class references variables) of the\n# class with other documented classes.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nCOLLABORATION_GRAPH    = YES\n\n# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for\n# groups, showing the direct groups dependencies.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nGROUP_GRAPHS           = YES\n\n# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and\n# collaboration diagrams in a style similar to the OMG's Unified Modeling\n# Language.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nUML_LOOK               = NO\n\n# If the UML_LOOK tag is enabled, the fields and methods are shown inside the\n# class node. If there are many fields or methods and many nodes the graph may\n# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the\n# number of items for each type to make the size more manageable. Set this to 0\n# for no limit. Note that the threshold may be exceeded by 50% before the limit\n# is enforced. So when you set the threshold to 10, up to 15 fields may appear,\n# but if the number exceeds 15, the total amount of fields shown is limited to\n# 10.\n# Minimum value: 0, maximum value: 100, default value: 10.\n# This tag requires that the tag UML_LOOK is set to YES.\n\nUML_LIMIT_NUM_FIELDS   = 10\n\n# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and\n# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS\n# tag is set to YES, doxygen will add type and arguments for attributes and\n# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen\n# will not generate fields with class member information in the UML graphs. The\n# class diagrams will look similar to the default class diagrams but using UML\n# notation for the relationships.\n# Possible values are: NO, YES and NONE.\n# The default value is: NO.\n# This tag requires that the tag UML_LOOK is set to YES.\n\nDOT_UML_DETAILS        = NO\n\n# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters\n# to display on a single line. If the actual line length exceeds this threshold\n# significantly it will wrapped across multiple lines. Some heuristics are apply\n# to avoid ugly line breaks.\n# Minimum value: 0, maximum value: 1000, default value: 17.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_WRAP_THRESHOLD     = 17\n\n# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and\n# collaboration graphs will show the relations between templates and their\n# instances.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nTEMPLATE_RELATIONS     = NO\n\n# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to\n# YES then doxygen will generate a graph for each documented file showing the\n# direct and indirect include dependencies of the file with other documented\n# files.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nINCLUDE_GRAPH          = YES\n\n# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are\n# set to YES then doxygen will generate a graph for each documented file showing\n# the direct and indirect include dependencies of the file with other documented\n# files.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nINCLUDED_BY_GRAPH      = YES\n\n# If the CALL_GRAPH tag is set to YES then doxygen will generate a call\n# dependency graph for every global function or class method.\n#\n# Note that enabling this option will significantly increase the time of a run.\n# So in most cases it will be better to enable call graphs for selected\n# functions only using the \\callgraph command. Disabling a call graph can be\n# accomplished by means of the command \\hidecallgraph.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nCALL_GRAPH             = NO\n\n# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller\n# dependency graph for every global function or class method.\n#\n# Note that enabling this option will significantly increase the time of a run.\n# So in most cases it will be better to enable caller graphs for selected\n# functions only using the \\callergraph command. Disabling a caller graph can be\n# accomplished by means of the command \\hidecallergraph.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nCALLER_GRAPH           = NO\n\n# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical\n# hierarchy of all classes instead of a textual one.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nGRAPHICAL_HIERARCHY    = YES\n\n# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the\n# dependencies a directory has on other directories in a graphical way. The\n# dependency relations are determined by the #include relations between the\n# files in the directories.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDIRECTORY_GRAPH        = YES\n\n# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images\n# generated by dot. For an explanation of the image formats see the section\n# output formats in the documentation of the dot tool (Graphviz (see:\n# http://www.graphviz.org/)).\n# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order\n# to make the SVG files visible in IE 9+ (other browsers do not have this\n# requirement).\n# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,\n# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,\n# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo,\n# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and\n# png:gdiplus:gdiplus.\n# The default value is: png.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_IMAGE_FORMAT       = png\n\n# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to\n# enable generation of interactive SVG images that allow zooming and panning.\n#\n# Note that this requires a modern browser other than Internet Explorer. Tested\n# and working are Firefox, Chrome, Safari, and Opera.\n# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make\n# the SVG files visible. Older versions of IE do not have SVG support.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nINTERACTIVE_SVG        = NO\n\n# The DOT_PATH tag can be used to specify the path where the dot tool can be\n# found. If left blank, it is assumed the dot tool can be found in the path.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_PATH               =\n\n# The DOTFILE_DIRS tag can be used to specify one or more directories that\n# contain dot files that are included in the documentation (see the \\dotfile\n# command).\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOTFILE_DIRS           =\n\n# The MSCFILE_DIRS tag can be used to specify one or more directories that\n# contain msc files that are included in the documentation (see the \\mscfile\n# command).\n\nMSCFILE_DIRS           =\n\n# The DIAFILE_DIRS tag can be used to specify one or more directories that\n# contain dia files that are included in the documentation (see the \\diafile\n# command).\n\nDIAFILE_DIRS           =\n\n# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the\n# path where java can find the plantuml.jar file. If left blank, it is assumed\n# PlantUML is not used or called during a preprocessing step. Doxygen will\n# generate a warning when it encounters a \\startuml command in this case and\n# will not generate output for the diagram.\n\nPLANTUML_JAR_PATH      =\n\n# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a\n# configuration file for plantuml.\n\nPLANTUML_CFG_FILE      =\n\n# When using plantuml, the specified paths are searched for files specified by\n# the !include statement in a plantuml block.\n\nPLANTUML_INCLUDE_PATH  =\n\n# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes\n# that will be shown in the graph. If the number of nodes in a graph becomes\n# larger than this value, doxygen will truncate the graph, which is visualized\n# by representing a node as a red box. Note that doxygen if the number of direct\n# children of the root node in a graph is already larger than\n# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that\n# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.\n# Minimum value: 0, maximum value: 10000, default value: 50.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_GRAPH_MAX_NODES    = 50\n\n# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs\n# generated by dot. A depth value of 3 means that only nodes reachable from the\n# root by following a path via at most 3 edges will be shown. Nodes that lay\n# further from the root node will be omitted. Note that setting this option to 1\n# or 2 may greatly reduce the computation time needed for large code bases. Also\n# note that the size of a graph can be further restricted by\n# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.\n# Minimum value: 0, maximum value: 1000, default value: 0.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nMAX_DOT_GRAPH_DEPTH    = 0\n\n# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent\n# background. This is disabled by default, because dot on Windows does not seem\n# to support this out of the box.\n#\n# Warning: Depending on the platform used, enabling this option may lead to\n# badly anti-aliased labels on the edges of a graph (i.e. they become hard to\n# read).\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_TRANSPARENT        = NO\n\n# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output\n# files in one run (i.e. multiple -o and -T options on the command line). This\n# makes dot run faster, but since only newer versions of dot (>1.8.10) support\n# this, this feature is disabled by default.\n# The default value is: NO.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nDOT_MULTI_TARGETS      = NO\n\n# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page\n# explaining the meaning of the various boxes and arrows in the dot generated\n# graphs.\n# The default value is: YES.\n# This tag requires that the tag HAVE_DOT is set to YES.\n\nGENERATE_LEGEND        = YES\n\n# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate\n# files that are used to generate the various graphs.\n#\n# Note: This setting is not only used for dot files but also for msc and\n# plantuml temporary files.\n# The default value is: YES.\n\nDOT_CLEANUP            = YES\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright JS Foundation and other contributors, http://js.foundation\n\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright JS Foundation and other contributors, http://js.foundation\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "![](https://github.com/jerryscript-project/jerryscript/blob/master/LOGO.png)\n# JerryScript: JavaScript engine for the Internet of Things\n[![License](https://img.shields.io/badge/licence-Apache%202.0-brightgreen.svg?style=flat)](LICENSE)\n[![GitHub Actions Status](https://github.com/jerryscript-project/jerryscript/workflows/JerryScript%20CI/badge.svg)](https://github.com/jerryscript-project/jerryscript/actions)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjerryscript-project%2Fjerryscript.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjerryscript-project%2Fjerryscript?ref=badge_shield)\n[![IRC Channel](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](https://kiwiirc.com/client/irc.freenode.net/#jerryscript)\n\nJerryScript is a lightweight JavaScript engine for resource-constrained devices such as microcontrollers. It can run on devices with less than 64 KB of RAM and less than 200 KB of flash memory.\n\nKey characteristics of JerryScript:\n* Full ECMAScript 5.1 standard compliance\n* ECMAScript 2025 standard compliance is 70%\n  * [Kangax Compatibilty Table](https://compat-table.github.io/compat-table/es2016plus/)\n* 258K binary size when compiled for ARM Thumb-2\n* Heavily optimized for low memory consumption\n* Written in C99 for maximum portability\n* Snapshot support for precompiling JavaScript source code to byte code\n* Mature C API, easy to embed in applications\n\nAdditional information can be found on our [project page](http://jerryscript.net) and [Wiki](https://github.com/jerryscript-project/jerryscript/wiki).\n\nMailing list: jerryscript-dev@groups.io, you can subscribe [here](https://groups.io/g/jerryscript-dev) and access the mailing list archive [here](https://groups.io/g/jerryscript-dev/topics).\n\n## Quick Start\n### Getting the sources\n```bash\ngit clone https://github.com/jerryscript-project/jerryscript.git\ncd jerryscript\n```\n\n### Building JerryScript\n```bash\npython tools/build.py\n```\n\nFor additional information see [Getting Started](docs/00.GETTING-STARTED.md).\n\n## Documentation\n- [Getting Started](docs/00.GETTING-STARTED.md)\n- [Configuration](docs/01.CONFIGURATION.md)\n- [API Reference](docs/02.API-REFERENCE.md)\n- [API Example](docs/03.API-EXAMPLE.md)\n- [Port API](docs/05.PORT-API.md)\n- [Reference Couting](docs/06.REFERENCE-COUNTING.md)\n- [Debugger](docs/07.DEBUGGER.md)\n- [Coding Standards](docs/08.CODING-STANDARDS.md)\n- [Arguments Extension API](docs/09.EXT-REFERENCE-ARG.md)\n- [Property Extension API](docs/10.EXT-REFERENCE-HANDLER.md)\n- [Autorelease Extension API](docs/11.EXT-REFERENCE-AUTORELEASE.md)\n- [Module Extension API](docs/12.EXT-REFERENCE-MODULE.md)\n- [Debugger Transport Interface](docs/13.DEBUGGER-TRANSPORT.md)\n- [Scope Extension API](docs/14.EXT-REFERENCE-HANDLE-SCOPE.md)\n- [Module System](docs/15.MODULE-SYSTEM.md)\n- [Migration Guide](docs/16.MIGRATION-GUIDE.md)\n\n## Contributing\nThe project can only accept contributions which are licensed under the [Apache License 2.0](LICENSE) and are signed according to the JerryScript [Developer's Certificate of Origin](DCO.md). For further information please see our [Contribution Guidelines](CONTRIBUTING.md).\n\n## License\nJerryScript is open source software under the [Apache License 2.0](LICENSE). Complete license and copyright information can be found in the source code.\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjerryscript-project%2Fjerryscript.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjerryscript-project%2Fjerryscript?ref=badge_large)\n\n> Copyright JS Foundation and other contributors, http://js.foundation\n\n> Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n"
  },
  {
    "path": "cmake/toolchain-esp32.cmake",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nset(CMAKE_SYSTEM_NAME esp-idf)\nset(CMAKE_SYSTEM_PROCESSOR xtensa)\n\nset(CMAKE_C_COMPILER xtensa-esp32-elf-gcc)\nset(CMAKE_CXX_COMPILER xtensa-esp32-elf-g++)\nset(CMAKE_ASM_COMPILER xtensa-esp32-elf-gcc)\n\n# uncomment that if you want 4-bytes float (much faster on esp32)\n#add_definitions(-DJERRY_NUMBER_TYPE_FLOAT64=0)\n\nset(CMAKE_C_FLAGS \"-mlongcalls -Wno-frame-address\" CACHE STRING \"C Compiler Base Flags\")\nset(CMAKE_CXX_FLAGS \"-mlongcalls -Wno-frame-address\" CACHE STRING \"C++ Compiler Base Flags\")\n\n# Can be removed after gcc 5.2.0 support is removed (ref GCC_NOT_5_2_0)\nset(CMAKE_EXE_LINKER_FLAGS \"-nostdlib\" CACHE STRING \"Linker Base Flags\")\n"
  },
  {
    "path": "cmake/toolchain_linux_aarch64.cmake",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nset(CMAKE_SYSTEM_NAME Linux)\nset(CMAKE_SYSTEM_PROCESSOR aarch64)\n\nset(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)\n"
  },
  {
    "path": "cmake/toolchain_linux_armv7l-el.cmake",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nset(CMAKE_SYSTEM_NAME Linux)\nset(CMAKE_SYSTEM_PROCESSOR armv7l-el)\n\nset(CMAKE_C_COMPILER arm-linux-gnueabi-gcc)\n\nset(FLAGS_COMMON_ARCH -mlittle-endian -mthumb)\n"
  },
  {
    "path": "cmake/toolchain_linux_armv7l.cmake",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nset(CMAKE_SYSTEM_NAME Linux)\nset(CMAKE_SYSTEM_PROCESSOR armv7l)\n\nset(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)\n#\n# Limit fpu to VFPv3 with d0-d15 registers\n#\n# If this is changed, setjmp / longjmp for ARMv7 should be updated accordingly\n#\nset(FLAGS_COMMON_ARCH -mthumb -mfpu=vfp -march=armv7)\n"
  },
  {
    "path": "cmake/toolchain_linux_i686.cmake",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nset(FLAGS_COMMON_ARCH -mfpmath=sse -msse2)\n"
  },
  {
    "path": "cmake/toolchain_mcu_stm32f3.cmake",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nset(CMAKE_SYSTEM_NAME MCU)\nset(CMAKE_SYSTEM_PROCESSOR armv7l)\nset(CMAKE_SYSTEM_VERSION STM32F3)\n\nset(FLAGS_COMMON_ARCH -mlittle-endian -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard)\n\nset(CMAKE_C_COMPILER arm-none-eabi-gcc)\nset(CMAKE_C_COMPILER_WORKS TRUE)\n"
  },
  {
    "path": "cmake/toolchain_mcu_stm32f4.cmake",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nset(CMAKE_SYSTEM_NAME MCU)\nset(CMAKE_SYSTEM_PROCESSOR armv7l)\nset(CMAKE_SYSTEM_VERSION STM32F4)\n\nset(FLAGS_COMMON_ARCH -mlittle-endian -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard)\n\nset(CMAKE_C_COMPILER arm-none-eabi-gcc)\nset(CMAKE_C_COMPILER_WORKS TRUE)\n"
  },
  {
    "path": "cmake/toolchain_mcu_stm32f7.cmake",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nset(CMAKE_SYSTEM_NAME MCU)\nset(CMAKE_SYSTEM_PROCESSOR armv7l)\nset(CMAKE_SYSTEM_VERSION STM32F7)\n\nset(FLAGS_COMMON_ARCH -mthumb -mcpu=cortex-m7 -march=armv7e-m -mfloat-abi=hard)\n\nset(CMAKE_C_COMPILER arm-none-eabi-gcc)\nset(CMAKE_C_COMPILER_WORKS TRUE)\n"
  },
  {
    "path": "cmake/toolchain_mcu_tim4f.cmake",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation \n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ninclude(CMakeForceCompiler)\n\nset(CMAKE_SYSTEM_NAME MCU)\nset(CMAKE_SYSTEM_PROCESSOR armv7l)\nset(CMAKE_SYSTEM_VERSION TIM4F)\n\nset(FLAGS_COMMON_ARCH --little_endian --silicon_version=7M4 --float_support=FPv4SPD16)\n\nCMAKE_FORCE_C_COMPILER(armcl TI)\n\nSET (CMAKE_C_FLAGS_DEBUG_INIT          \"-g\")\nSET (CMAKE_C_FLAGS_MINSIZEREL_INIT     \"-o4 -mf0 -DNDEBUG\")\nSET (CMAKE_C_FLAGS_RELEASE_INIT        \"-o4 -DNDEBUG\")\nSET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT \"-o2 -g\")\n\nSET (CMAKE_CXX_FLAGS_DEBUG_INIT          \"-g\")\nSET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT     \"-o4 -mf0 -DNDEBUG\")\nSET (CMAKE_CXX_FLAGS_RELEASE_INIT        \"-o4 -DNDEBUG\")\nSET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT \"-o2 -g\")\n"
  },
  {
    "path": "cmake/toolchain_openwrt_mips.cmake",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nset(CMAKE_SYSTEM_NAME Openwrt)\nset(CMAKE_SYSTEM_PROCESSOR mips)\n\nset(CMAKE_C_COMPILER mips-openwrt-linux-gcc)\n"
  },
  {
    "path": "cmake/toolchain_openwrt_mipsel.cmake",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nset(CMAKE_SYSTEM_NAME Openwrt)\nset(CMAKE_SYSTEM_PROCESSOR mips)\n\nset(CMAKE_C_COMPILER mipsel-openwrt-linux-gcc)\n"
  },
  {
    "path": "docs/00.GETTING-STARTED.md",
    "content": "## Setting up prerequisites\n\nCurrently, only Ubuntu 18.04+ is officially supported as primary development environment.\n\nThere are several dependencies, that should be installed manually. The following list is the absolute minimum for building:\n\n- `gcc` or any C99-compliant compiler (native or cross, e.g., arm-none-eabi)\n- `cmake` >= `3.10`\n\nSeveral scripts and tools help the building and development process, thus it is recommended to have the following installed as well:\n\n- `bash` >= `4.3.11`\n- `cppcheck` >= `2.7`\n- `clang-format-15`\n- `python` >= `3.10`\n\n```bash\nsudo apt-get install gcc gcc-arm-none-eabi cmake cppcheck clang-format-15 python\n```\n\nTo make our scripts run correctly, several shell utilities should be available on the system:\n\n- `awk`\n- `bc`\n- `find`\n- `sed`\n\n## Building JerryScript\n\n**To build debug version for Linux**\n\n```bash\npython tools/build.py --debug\n```\n\n**To build debug version for Linux without LTO (Link Time Optimization)**\n\n```bash\npython tools/build.py --debug --lto=off\n```\n\n**To enable more verbose outputs for debugging**\n\n```bash\ntools/build.py --debug --logging=on --error-messages=on --line-info=on\n```\n\n**Add custom arguments to CMake**\n\n```bash\npython tools/build.py --cmake-param=CMAKE_PARAM\n```\n\n**Set a profile mode (es.next, minimal)**\n\n```bash\npython tools/build.py --profile=es.next|minimal\n```\n\nSee also the related [README.md](../jerry-core/profiles/README.md).\n\n**Use (compiler-default, external) libc**\n\nThe default libc is the compiler-default libc but you can use an external libc as well:\n\n- compiler-default libc:\n\n```bash\npython tools/build.py\n```\n\n- external libc:\n\n```bash\npython tools/build.py --compile-flag=\"-nostdlib -I/path/to/ext-libc/include\" --link-lib=\"ext-c\"\n```\n\n**Add toolchain file**\n\nThe ```cmake``` dir already contains some usable toolchain files, which you can use in the following format:\n\n```bash\npython tools/build.py --toolchain=TOOLCHAIN\n```\n\nFor example the cross-compile to RaspberryPi 2 is something like this:\n\n```bash\npython tools/build.py --toolchain=cmake/toolchain_linux_armv7l.cmake\n```\n\n**Use system memory allocator**\n\n```bash\npython tools/build.py --system-allocator=on\n```\n\n*Note*: System allocator is only supported on 32 bit systems.\n\n**Enable 32bit compressed pointers**\n\n```bash\npython tools/build.py --cpointer-32bit=on\n```\n\n*Note*: There is no compression/decompression on 32 bit systems, if enabled.\n\n**Change default heap size (512K)**\n\n```bash\npython tools/build.py --mem-heap=256\n```\n\nIf you would like to use more than 512K, then you must enable the 32 bit compressed pointers.\n\n```bash\npython tools/build.py --cpointer-32bit=on --mem-heap=1024\n```\n\n*Note*: The heap size will be allocated statically at compile time, when JerryScript memory\nallocator is used.\n\n**To build with libfuzzer support**\n\n```bash\nCC=clang python tools/build.py --libfuzzer=on --compile-flag=-fsanitize=address --lto=off\n```\n\nCheck the documentation of libfuzzer to get the runtime settings of the created fuzzer\nbinary: https://llvm.org/docs/LibFuzzer.html.\n\n**To get a list of all the available buildoptions for Linux**\n\n```bash\npython tools/build.py --help\n```\n\n## Checking patch\n\n```bash\npython tools/run-tests.py --precommit\n```\n\n### Running only one type of test\n\n**To run build option tests**\n\n```bash\npython tools/run-tests.py --buildoption-test\n```\n\n**To run unittests**\n\n```bash\npython tools/run-tests.py --unittests\n```\n\n**To run jerry-tests**\n\n```bash\npython tools/run-tests.py --jerry-tests\n```\n\n**To run signed-off check**\n\n```bash\npython tools/run-tests.py --check-signed-off\n```\n\n**To run cppcheck**\n\n```bash\npython tools/run-tests.py --check-cppcheck\n```\n\n**To run format check**\n\n```bash\npython tools/run-tests.py --check-format\n```\n\n**To get a list of all the available test options**\n\n```bash\npython tools/run-tests.py --help\n```\n"
  },
  {
    "path": "docs/01.CONFIGURATION.md",
    "content": "# Configuration\n\nJerryScript provides a large number of configuration options which can be used to enable or disable specific features, allowing users to fine tune the engine to best suit their needs.\nA configuration option's value can be changed either by providing specific C preprocessor definitions, by adding CMake definitions, or by using the arguments of the `tools/build.py` script.\nThis document lists the available configuration options, shows the configuration name for C, CMake, and python, and provides a brief description that explains the effect of the options.\n\n\n### Amalgamated build\n\nEnables the amalgamated build process, which aggregates the contents of each source file per library\n(i.e., JerryScript's core, port, and math libraries), and uses these combined files to compile the project.\nThis process can provide comparable results to link-time optimization, and can be useful when LTO is not available otherwise.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `<none>`                                     |\n| CMake:  | `-DENABLE_AMALGAM=ON/OFF`                    |\n| Python: | `--amalgam=ON/OFF`                           |\n\nSee also: [Amalgamated sources](#amalgamated-sources)\n\n### Jerry debugger\n\nEnables debugger support in the engine, which can be used to debug running JavaScript code. For more information on using the debugger see [Debugger](07.DEBUGGER.md).\nThe debugger is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_DEBUGGER=0/1`                       |\n| CMake:  | `-DJERRY_DEBUGGER=ON/OFF`                    |\n| Python: | `--jerry-debugger=ON/OFF`                    |\n\n### Line information\n\nBy default, all source code information is discarded after parsing is complete. This option can be used to augment the created bytecode to provide line information during runtime,\nthat can be used by the debugger to identify the currently executed source context. See [Debugger](07.DEBUGGER.md).\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_LINE_INFO=0/1`                      |\n| CMake:  | `-DJERRY_LINE_INFO=ON/OFF`                   |\n| Python: | `--line-info=ON/OFF`                         |\n\n### Profiles\n\nThis option can be used to enable/disable available JavaScript language features by providing profile files. Profile files contain a list of C definitions that configure each individual feature.\nThe `path` value for CMake and Python arguments should be a file path to the profile file, or one of `es.next` or `minimal`, which are the pre-defined profiles.\nTo see how a profile file should be created, or what configuration options are available in C, see the profile [README](https://github.com/jerryscript-project/jerryscript/blob/master/jerry-core/profiles/README.md).\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `<see description>`                          |\n| CMake:  | `-DJERRY_PROFILE=\"path\"`                     |\n| Python: | `--profile=\"path\"`                           |\n\n### Promise callback\n\nEnables Promise event notification support. This feature allows setting a user callback, which is called when certain Promise related events occur such as\ncreating a new Promise, resolving a Promise with a value, etc.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_PROMISE_CALLBACK=0/1`               |\n| CMake:  | `-DJERRY_PROMISE_CALLBACK=ON/OFF`            |\n| Python: | `--promise-callback=ON/OFF`                  |\n\n### External context\n\nEnables external context support in the engine. By default, JerryScript uses a statically allocated context to store the current state of the engine internals.\nWhen this option is enabled, an externally allocated memory region can be provided through the port API to the engine, to be used as the context.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_EXTERNAL_CONTEXT=0/1`               |\n| CMake:  | `-DJERRY_EXTERNAL_CONTEXT=ON/OFF`            |\n| Python: | `--external-context=ON/OFF`                  |\n\n### Snapshot execution\n\nThis option can be used to enable snapshot execution in the engine.\nThis option is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_SNAPSHOT_EXEC=0/1`                  |\n| CMake:  | `-DJERRY_SNAPSHOT_EXEC=ON/OFF`               |\n| Python: | `--snapshot-exec=ON/OFF`                     |\n\n### Snapshot saving\n\nThis option can be used to enable snapshot saving in the engine.\nThis option is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_SNAPSHOT_SAVE=0/1`                  |\n| CMake:  | `-DJERRY_SNAPSHOT_SAVE=ON/OFF`               |\n| Python: | `--snapshot-save=ON/OFF`                     |\n\n### Jerry parser\n\nThis option can be used to enable or disable the parser. When the parser is disabled all features that depend on source parsing are unavailable (eg. `jerry_parse`, `eval`, Function constructor).\nThis option can be useful in combination with the snapshot feature. The parser is enabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_PARSER=0/1`                         |\n| CMake:  | `-DJERRY_PARSER=ON/OFF`                      |\n| Python: | `--js-parser=ON/OFF`                         |\n\n### Dump bytecode\n\nThis option can be used to display created bytecode in a human readable format. See [Internals](04.INTERNALS.md#byte-code) for more details.\nThis option is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_PARSER_DUMP_BYTE_CODE=0/1`          |\n| CMake:  | `-DJERRY_PARSER_DUMP_BYTE_CODE=ON/OFF`       |\n| Python: | `--show-opcodes=ON/OFF`                      |\n\n### Dump RegExp bytecode\n\nThis option can be used to display created RegExp bytecode in a human readable format. The RegExp bytecode is different from the bytecode used by the virtual machine.\nThis option is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_REGEXP_DUMP_BYTE_CODE=0/1`          |\n| CMake:  | `-DJERRY_REGEXP_DUMP_BYTE_CODE=ON/OFF`       |\n| Python: | `--show-regexp-opcodes=ON/OFF`               |\n\n### Strict RegExp\n\nThis option can be used to enable strict RegExp mode. The standard RegExp syntax is a lot stricter than what is common in current JavaScript implementations.\nWhen enabled, this flag disables all of the non-standard, quality-of-life RegExp features, that are implemented to provide compatibility with other commonly used engines.\nThis option is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_REGEXP_STRICT_MODE=0/1`             |\n| CMake:  | `-DJERRY_REGEXP_STRICT_MODE=ON/OFF`          |\n| Python: | `--regexp-strict-mode=ON/OFF`                |\n\n### Error messages\n\nEnables error messages for thrown Error objects. By default, error messages are omitted to reduce memory usage.\nEnabling this feature provides detailed error messages where available, like line information for Syntax errors, variable names for Reference errors, Type/Range error messages for built-in routines, etc.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_ERROR_MESSAGES=0/1`                 |\n| CMake:  | `-DJERRY_ERROR_MESSAGES=ON/OFF`              |\n| Python: | `--error-messages=ON/OFF`                    |\n\n### Logging\n\nThis option can be used to enable log messages during runtime. When enabled the engine will use the `jerry_port_log` port API function to print relevant log messages.\nThis feature is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_LOGGING=0/1`                        |\n| CMake:  | `-DJERRY_LOGGING=ON/OFF`                     |\n| Python: | `--logging=ON/OFF`                           |\n\n### LCache\n\nThis option enables the LCache, allowing faster access to object properties. The LCache uses a statically allocated hash-map, which increases memory consumption.\nSee [Internals](04.INTERNALS.md#lcache) for further details.\nThis option is enabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_LCACHE=0/1`                         |\n| CMake:  | `<none>`                                     |\n| Python: | `<none>`                                     |\n\n### Property hashmaps\n\nThis option enables the creation of hashmaps for object properties, which allows faster property access, at the cost of increased memory consumption.\nSee [Internals](04.INTERNALS.md#property-hashmap) for further details.\nThis option is enabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_PROPERTY_HASHMAP=0/1`               |\n| CMake:  | `<none>`                                     |\n| Python: | `<none>`                                     |\n\n### Memory statistics\n\nThis option can be used to provide memory usage statistics either upon engine termination, or during runtime using the `jerry_heap_stats` jerry API function.\nThe feature can create a significant performance overhead, and should only be used for measurement purposes. This option is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_MEM_STATS=0/1`                      |\n| CMake:  | `-DJERRY_MEM_STATS=ON/OFF`                   |\n| Python: | `--mem-stats=ON/OFF`                         |\n\n### Heap size\n\nThis option can be used to adjust the size of the internal heap, represented in kilobytes. The provided value should be an integer. Values larger than 512 require 32-bit compressed pointers to be enabled.\nThe default value is 512.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_GLOBAL_HEAP_SIZE=(int)`             |\n| CMake:  | `-DJERRY_GLOBAL_HEAP_SIZE=(int)`             |\n| Python: | `--mem-heap=(int)`                           |\n\n### Garbage collection limit\n\nThis option can be used to adjust the maximum allowed heap usage increase until triggering the next garbage collection, in bytes.\nWhen the total allocated memory size reaches the current gc limit, garbage collection will be triggered to try and reduce clutter from unreachable objects.\nIf the total allocated memory can't be reduced below the current limit, then the limit will be increased by the amount specified via this option.\nSimilarly, when the total allocated memory goes well below the current gc limit, the limit is reduced by this amount.\nThe default value is 1/32 of the total heap size, but not greater than 8192 bytes.\nA value of 0 will use the default value.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_GC_LIMIT=(int)`                     |\n| CMake:  | `-DJERRY_GC_LIMIT=(int)`                     |\n| Python: | `--gc-limit=(int)`                           |\n\n### GC mark recursion limit\n\nThis option can be used to adjust the maximum recursion depth during the GC mark phase. The provided value should be an integer, which represents the allowed number of recursive calls. Increasing the depth of the recursion reduces the time of GC cycles, however increases stack usage.\nA value of 0 will prevent any recursive GC calls.\n\n| Options |                                                   |\n|---------|---------------------------------------------------|\n| C:      | `-DJERRY_GC_MARK_LIMIT=(int)`                     |\n| CMake:  | `-DJERRY_GC_MARK_LIMIT=(int)`                     |\n| Python: | `--gc-mark-limit=(int)`                           |\n\n### Stack limit\n\nThis option can be used to cap the stack usage of the engine, and prevent stack overflows due to recursion. The provided value should be an integer, which represents the allowed stack usage in kilobytes.\nThe default value is 0 (unlimited).\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_STACK_LIMIT=(int)`                  |\n| CMake:  | `-DJERRY_STACK_LIMIT=(int)`                  |\n| Python: | `--stack-limit=(int)`                        |\n\n### 32-bit compressed pointers\n\nEnables 32-bit pointers instead of the default 16-bit compressed pointers. This allows the engine to use a much larger heap, but also comes with slightly increased memory usage, as objects can't be packed as tightly.\nThis option must be enabled when using the system allocator.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_CPOINTER_32_BIT=0/1`                |\n| CMake:  | `-DJERRY_CPOINTER_32_BIT=ON/OFF`             |\n| Python: | `--cpointer-32bit=ON/OFF`                    |\n\n### System allocator\n\nThis option enables the use of malloc/free instead of the internal JerryScript allocator. This feature requires 32-bit compressed pointers, and is unsupported on 64-bit architectures.\nThis option is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_SYSTEM_ALLOCATOR=0/1`               |\n| CMake:  | `-DJERRY_SYSTEM_ALLOCATOR=ON/OFF`            |\n| Python: | `--system-allocator=ON/OFF`                  |\n\n### Valgrind support\n\nThis option enables valgrind support for the internal allocator. When enabled, valgrind will be able to properly identify allocated memory regions, and report leaks or out-of-bounds memory accesses.\nThis option is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_VALGRIND=0/1`                       |\n| CMake:  | `-DJERRY_VALGRIND=ON/OFF`                    |\n| Python: | `--valgrind=ON/OFF`                          |\n\n### Memory stress test\n\nThis option can be used to stress test memory management, by running garbage collection before every allocation attempt.\nThis option is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_MEM_GC_BEFORE_EACH_ALLOC=0/1`       |\n| CMake:  | `-DJERRY_MEM_GC_BEFORE_EACH_ALLOC=ON/OFF`    |\n| Python: | `--mem-stress-test=ON/OFF`                   |\n\n### MSVC CRT\n\nThis option enables the use of the MSVC CRT library and is disabled by default.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `<none>`                                     |\n| CMake:  | `-DENABLE_STATIC_CRT=ON/OFF`                 |\n| Python: | `--static-crt=ON/OFF`                        |\n\n### Architecture\n\nSpecify the platform name if it is supported by the generator.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `<none>`                                     |\n| CMake:  | `-A (string)`                                |\n| Python: | `--arch=(string)`                            |\n\n### Tostring function\n\nEnable function toString.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_FUNCTION_TO_STRING=0/1`             |\n| CMake:  | `-DJERRY_FUNCTION_TO_STRING=ON/OFF`          |\n| Python: | `--function-to-string=ON/OFF`                |\n\n\n### VM throw\n\nEnable VM throw.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_VM_THROW=0/1`                       |\n| CMake:  | `-DJERRY_VM_THROW=ON/OFF`                    |\n| Python: | `--vm-throw=ON/OFF`                          |\n\n\n### Promise callback\n\nEnable Promise callback.\n\n| Options |                                              |\n|---------|----------------------------------------------|\n| C:      | `-DJERRY_PROMISE_CALLBACK=0/1`               |\n| CMake:  | `-DJERRY_PROMISE_CALLBACK=ON/OFF`            |\n| Python: | `--promise-callback=ON/OFF`                  |\n\n\n# Amalgamated sources\n\nThe sources of JerryScript can be combined into a handful of files to allow their easy integration\nin other projects. To achieve this, the following command can be executed to create a set of files\ninto the `amalgam` directory:\n\n```sh\n$ python tools/amalgam.py --output-dir amalgam --jerry-core --jerry-port --jerry-math\n```\n\n(Note: In the example above, the command is executed from the project's root directory, but that is\nnot mandatory.)\n\nThe command creates the following files in the `amalgam` dir:\n\n* `jerryscript.c`\n* `jerryscript.h`\n* `jerryscript-config.h`\n* `jerryscript-port.c`\n* `jerryscript-math.c`\n* `math.h`\n\n**Important**: the `jerryscript-config.h` contains the configurations mentioned above and\nshould be adapted to the required use-case. See the file contents for more details and for the\ndefault configuration. (Note: This config file is created from the the `jerry-core/config.h` file.)\n\nThese files can be directly compiled with an application using the JerryScript API.\nE.g., using a command similar to the one below:\n\n```sh\n$ gcc -Wall -o demo_app demo_app.c amalgam/jerryscript.c amalgam/jerryscript-port.c amalgam/jerryscript-math.c -Iamalgam/\n```\n\n(Note: The headers must be available on the include path.)\n\nThis approach is also under the hood of the [amalgamated build](#amalgamated-build) process.\n\n# Target specific information\n\n## x86 with GCC\n\nWhen building for Intel 32 bit architecture it is possible that GCC uses conservative options, thus assuming the most\nbasic floating-point support (that is it does not generate SSE or others instructions).\nHowever this could lead to loss off precision and/or different results than what is required by the JavaScript standard\nin regards of floating-point values and arithmetic.\n\nTo resolve this precision problem it is advised to use at least SSE2.\nTo do this with GCC please provide the `-mfpmath=sse -msse2` options during build.\n\nThese options can also be specified via the `build.py` script:\n\n```sh\n$ ./tools/build.py --compile-flag=-mfpmath=sse --compile-flag=-msse2 --compile-flag=-m32\n```\n"
  },
  {
    "path": "docs/02.API-REFERENCE.md",
    "content": "# JerryScript types\n\n## jerry_init_flag_t\n\nEnum that contains the following elements:\n\n - JERRY_INIT_EMPTY - empty flag set\n - JERRY_INIT_SHOW_OPCODES - dump byte-code to log after parse\n - JERRY_INIT_SHOW_REGEXP_OPCODES - dump regexp byte-code to log after compilation\n - JERRY_INIT_MEM_STATS - dump memory statistics\n\n *`JERRY_INIT_MEM_STATS_SEPARATE` and `JERRY_INIT_DEBUGGER`, which were deprecated in version 2.0, have been completely removed in version 3.0*.\n\n## jerry_log_level_t\n\nEnum that represents the configurable logging levels.\nThe levels are ordered by severity, with the most serious levels listed first..\n\n - JERRY_LOG_LEVEL_ERROR - the engine will terminate after the message is printed\n - JERRY_LOG_LEVEL_WARNING - a request is aborted, but the engine continues its operation\n - JERRY_LOG_LEVEL_DEBUG - debug messages from the engine, low volume\n - JERRY_LOG_LEVEL_TRACE - detailed info about engine internals, potentially high volume\n\n*Introduced in version 3.0*.\n\n## jerry_type_t\n\nEnum that contains JerryScript API value types:\n\n - JERRY_TYPE_NONE - no type information\n - JERRY_TYPE_UNDEFINED - undefined type\n - JERRY_TYPE_NULL - null type\n - JERRY_TYPE_BOOLEAN - boolean type\n - JERRY_TYPE_NUMBER - number type\n - JERRY_TYPE_STRING - string type\n - JERRY_TYPE_OBJECT - object type\n - JERRY_TYPE_FUNCTION - function type\n - JERRY_TYPE_EXCEPTION - exception/abort type\n - JERRY_TYPE_SYMBOL - symbol type\n - JERRY_TYPE_BIGINT - bigint type\n\n*Introduced in version 2.0*.\n\n*Updated in version 2.4*: Added `JERRY_TYPE_BIGINT` value.\n\n## jerry_object_type_t\n\nEnum that contains JerryScript **object** value types:\n\n - JERRY_OBJECT_TYPE_NONE - Non-object type\n - JERRY_OBJECT_TYPE_GENERIC - Generic JavaScript object without any internal property\n - JERRY_OBJECT_TYPE_MODULE_NAMESPACE - Module namespace object\n - JERRY_OBJECT_TYPE_ARRAY - Array object\n - JERRY_OBJECT_TYPE_PROXY - Proxy object\n - JERRY_OBJECT_TYPE_SCRIPT - Script object (see [jerry_parse](#jerry_parse))\n - JERRY_OBJECT_TYPE_MODULE - Module object (see [jerry_parse](#jerry_parse))\n - JERRY_OBJECT_TYPE_PROMISE - Promise object\n - JERRY_OBJECT_TYPE_DATAVIEW - Dataview object\n - JERRY_OBJECT_TYPE_FUNCTION - Function object (see [jerry_function_type](#jerry_function_type))\n - JERRY_OBJECT_TYPE_TYPEDARRAY - %TypedArray% object (see [jerry_typedarray_type](#jerry_typedarray_type))\n - JERRY_OBJECT_TYPE_ITERATOR - Iterator object (see [jerry_iterator_type](#jerry_typedarray_type))\n - JERRY_OBJECT_TYPE_CONTAINER - Container object (see [jerry_container_type](#jerry_container_type))\n - JERRY_OBJECT_TYPE_ERROR - Error object (see [jerry_error_type](#jerry_error_type))\n - JERRY_OBJECT_TYPE_ARRAYBUFFER - ArrayBuffer object\n - JERRY_OBJECT_TYPE_SHARED_ARRAYBUFFER - SharedArrayBuffer object\n - JERRY_OBJECT_TYPE_ARGUMENTS - Arguments object\n - JERRY_OBJECT_TYPE_BOOLEAN - Boolean object\n - JERRY_OBJECT_TYPE_DATE - Date object\n - JERRY_OBJECT_TYPE_NUMBER - Number object\n - JERRY_OBJECT_TYPE_REGEXP - RegExp object\n - JERRY_OBJECT_TYPE_STRING - String object\n - JERRY_OBJECT_TYPE_SYMBOL - Symbol object\n - JERRY_OBJECT_TYPE_GENERATOR - Generator object\n - JERRY_OBJECT_TYPE_BIGINT - BigInt object\n - JERRY_OBJECT_TYPE_WEAKREF - WeakRef object\n\n*Introduced in version 2.4*.\n\n*Updated in version 3.0*: Added `JERRY_OBJECT_TYPE_MODULE_NAMESPACE`, `JERRY_OBJECT_TYPE_PROMISE`, `JERRY_OBJECT_TYPE_DATAVIEW`,\n                                       `JERRY_OBJECT_TYPE_ERROR`, `JERRY_OBJECT_TYPE_SHARED_ARRAYBUFFER`, `JERRY_OBJECT_TYPE_WEAKREF`,\n                                       `JERRY_OBJECT_TYPE_SCRIPT`, and `JERRY_OBJECT_TYPE_MODULE` values.\n\n## jerry_function_type_t\n\nEnum that contains JerryScript **function** value types:\n\n - JERRY_FUNCTION_TYPE_NONE - Non-function type\n - JERRY_FUNCTION_TYPE_GENERIC - Generic JavaScript function\n - JERRY_FUNCTION_TYPE_ACCESSOR - Accessor function\n - JERRY_FUNCTION_TYPE_BOUND - Bound function\n - JERRY_FUNCTION_TYPE_ARROW - Arrow function\n - JERRY_FUNCTION_TYPE_GENERATOR - Generator function object\n\n*Introduced in version 2.4*.\n\n## jerry_iterator_type_t\n\nEnum that contains JerryScript **iterator** value types:\n\n - JERRY_ITERATOR_TYPE_NONE - Non-iterator type\n - JERRY_ITERATOR_TYPE_ARRAY - Array iterator\n - JERRY_ITERATOR_TYPE_STRING - String iterator\n - JERRY_ITERATOR_TYPE_MAP - Map iterator\n - JERRY_ITERATOR_TYPE_SET - Set iterator\n\n*Introduced in version 2.4*.\n\n## jerry_proxy_custom_behavior_t\n\nThese option bits allow specializing Proxies with non-standard behaviour.\nThese flags are recommended only for those trusted Proxies, whose handlers\nproduce correct results.\n\n- JERRY_PROXY_SKIP_RESULT_VALIDATION - skip result validation for `[[GetPrototypeOf]]`, `[[SetPrototypeOf]]`, `[[IsExtensible]]`,\n                                       `[[PreventExtensions]]`, `[[GetOwnProperty]]`, `[[DefineOwnProperty]]`, `[[HasProperty]]`,\n                                       `[[Get]]`, `[[Set]]`, `[[Delete]]` and `[[OwnPropertyKeys]]`\n\n*Introduced in version 3.0*.\n\n## jerry_property_filter_t\n\nEnum that contains JerryScript **property filter** options bits:\n\n - JERRY_PROPERTY_FILTER_ALL - List all property keys independently from key type or property value attributes (equivalent to Reflect.ownKeys call)\n - JERRY_PROPERTY_FILTER_TRAVERSE_PROTOTYPE_CHAIN - Include keys from the objects' prototype chain as well\n - JERRY_PROPERTY_FILTER_EXCLUDE_NON_CONFIGURABLE - Exclude property key if the property is non-configurable\n - JERRY_PROPERTY_FILTER_EXCLUDE_NON_ENUMERABLE - Exclude property key if the property is non-enumerable\n - JERRY_PROPERTY_FILTER_EXCLUDE_NON_WRITABLE - Exclude property key if the property is non-writable\n - JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS - Exclude property key if it is a string\n - JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS - Exclude property key if it is a symbol\n - JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES - Exclude property key if it is an integer index\n - JERRY_PROPERTY_FILTER_INTEGER_INDICES_AS_NUMBER - By default integer index property keys are converted to string. Enabling this flags keeps integer index property keys as numbers\n\n*Introduced in version 2.4*.\n\n*Updated in version 3.0*: The following values have been modified due to typos in their names:\n                                       `JERRY_PROPERTY_FILTER_EXLCUDE_NON_CONFIGURABLE`, `JERRY_PROPERTY_FILTER_EXLCUDE_NON_ENUMERABLE`,\n                                       `JERRY_PROPERTY_FILTER_EXLCUDE_NON_WRITABLE`, `JERRY_PROPERTY_FILTER_EXLCUDE_STRINGS`,\n                                       `JERRY_PROPERTY_FILTER_EXLCUDE_SYMBOLS`, `JERRY_PROPERTY_FILTER_EXLCUDE_INTEGER_INDICES`.\n\n## jerry_error_t\n\nPossible types of an Error object:\n\n - JERRY_ERROR_COMMON - Error\n - JERRY_ERROR_EVAL - EvalError\n - JERRY_ERROR_RANGE - RangeError\n - JERRY_ERROR_REFERENCE - ReferenceError\n - JERRY_ERROR_SYNTAX - SyntaxError\n - JERRY_ERROR_TYPE - TypeError\n - JERRY_ERROR_URI - URIError\n - JERRY_ERROR_AGGREGATE - AggregateError\n\nThere is also a special value `JERRY_ERROR_NONE` which is not an error type\nthis value can only be returned by the [jerry_error_type](#jerry_error_type).\n\n*Updated in version 2.0*: The `JERRY_ERROR_NONE` was added to be used by the [jerry_error_type](#jerry_error_type) method.\n\n## jerry_feature_t\n\nPossible compile time enabled feature types:\n\n - JERRY_FEATURE_CPOINTER_32_BIT - 32 bit compressed pointers\n - JERRY_FEATURE_ERROR_MESSAGES - error messages\n - JERRY_FEATURE_JS_PARSER - js-parser\n - JERRY_FEATURE_HEAP_STATS - memory statistics\n - JERRY_FEATURE_PARSER_DUMP - parser byte-code dumps\n - JERRY_FEATURE_REGEXP_DUMP - regexp byte-code dumps\n - JERRY_FEATURE_SNAPSHOT_SAVE - saving snapshot files\n - JERRY_FEATURE_SNAPSHOT_EXEC - executing snapshot files\n - JERRY_FEATURE_DEBUGGER - debugging\n - JERRY_FEATURE_VM_EXEC_STOP - stopping ECMAScript execution\n - JERRY_FEATURE_VM_THROW - capturing ECMAScript throws\n - JERRY_FEATURE_JSON - JSON support\n - JERRY_FEATURE_TYPEDARRAY - Typedarray support\n - JERRY_FEATURE_DATE - Date support\n - JERRY_FEATURE_REGEXP - RegExp support\n - JERRY_FEATURE_LINE_INFO - line info available\n - JERRY_FEATURE_LOGGING - logging\n - JERRY_FEATURE_SYMBOL - symbol support\n - JERRY_FEATURE_DATAVIEW - DataView support\n - JERRY_FEATURE_PROXY - Proxy support\n - JERRY_FEATURE_MAP - Map support\n - JERRY_FEATURE_SET - Set support\n - JERRY_FEATURE_WEAKMAP - WeakMap support\n - JERRY_FEATURE_WEAKSET - WeakSet support\n - JERRY_FEATURE_BIGINT - BigInt support\n - JERRY_FEATURE_REALM - realm support\n - JERRY_FEATURE_GLOBAL_THIS - GlobalThisValue support\n - JERRY_FEATURE_PROMISE_CALLBACK - Promise callback support\n - JERRY_FEATURE_MODULE - Module support\n - JERRY_FEATURE_WEAKREF - WeakRef support\n - JERRY_FEATURE_FUNCTION_TO_STRING - function toString support\n\n*Introduced in version 2.0*.\n\n*Updated in version 2.3*: Added `JERRY_FEATURE_WEAKMAP`, `JERRY_FEATURE_WEAKSET` values.\n\n*Updated in version 2.4*: Added `JERRY_FEATURE_BIGINT`, `JERRY_FEATURE_REALM` values.\n\n*Updated in version 3.0*: Added `JERRY_FEATURE_VM_THROW`, `JERRY_FEATURE_GLOBAL_THIS`,\n                                `JERRY_FEATURE_PROMISE_CALLBACK`, and `JERRY_FEATURE_MODULE`,\n                                `JERRY_FEATURE_WEAKREF`, and `JERRY_FEATURE_FUNCTION_TO_STRING` values.\n                          Removed `JERRY_FEATURE_PROMISE.`\n\n## jerry_container_type_t\n\nContainer object types:\n\n - JERRY_CONTAINER_TYPE_INVALID - Invalid container\n - JERRY_CONTAINER_TYPE_MAP - Map type\n - JERRY_CONTAINER_TYPE_SET - Set type\n - JERRY_CONTAINER_TYPE_WEAKMAP - WeakMap type\n - JERRY_CONTAINER_TYPE_WEAKSET - WeakSet type\n\n *Introduced in version 2.3*.\n\n## jerry_well_known_symbol_t\n\nWell-known symbols:\n\n - JERRY_SYMBOL_ASYNC_ITERATOR - @@asyncIterator well-known symbol\n - JERRY_SYMBOL_HAS_INSTANCE - @@hasInstance well-known symbol\n - JERRY_SYMBOL_IS_CONCAT_SPREADABLE - @@isConcatSpreadable well-known symbol\n - JERRY_SYMBOL_ITERATOR - @@iterator well-known symbol\n - JERRY_SYMBOL_MATCH - @@match well-known symbol\n - JERRY_SYMBOL_REPLACE - @@replace well-known symbol\n - JERRY_SYMBOL_SEARCH - @@search well-known symbol\n - JERRY_SYMBOL_SPECIES - @@species well-known symbol\n - JERRY_SYMBOL_SPLIT - @@split well-known symbol\n - JERRY_SYMBOL_TO_PRIMITIVE - @@toPrimitive well-known symbol\n - JERRY_SYMBOL_TO_STRING_TAG - @@toStringTag well-known symbol\n - JERRY_SYMBOL_UNSCOPABLES - @@unscopables well-known symbol\n - JERRY_SYMBOL_MATCH_ALL - @@matchAll well-known symbol\n\n *Introduced in version 2.4*.\n\n## jerry_regexp_flags_t\n\nRegExp object optional flags:\n\n  - JERRY_REGEXP_FLAG_GLOBAL - global match; find all matches rather than stopping after the first match\n  - JERRY_REGEXP_FLAG_IGNORE_CASE - ignore case\n  - JERRY_REGEXP_FLAG_MULTILINE - multiline; treat beginning and end characters (^ and $) as working\n    over\n    multiple lines (i.e., match the beginning or end of each line (delimited by \\n or \\r), not only the\n    very beginning or end of the whole input string)\n  - JERRY_REGEXP_FLAG_STICKY - The sticky flag indicates that it matches only from the index indicated\n    by the lastIndex property\n  - JERRY_REGEXP_FLAG_UNICODE - The unicode flag enables various Unicode-related features\n  - JERRY_REGEXP_FLAG_DOTALL -The dotall flag indicates that the dot special character (\".\") should\n    additionally match the following line terminator (\"newline\") characters in a string;\n\n\n*Introduced in version 2.0*.\n\n*Updated in version 2.4*: Added `JERRY_REGEXP_FLAG_STICKY`, `JERRY_REGEXP_FLAG_UNICODE` , `JERRY_REGEXP_FLAG_DOTALL` values.\n\n\n## jerry_parse_option_enable_feature_t\n\nOption bits for [jerry_parse_options_t](#jerry_parse_options_t).\n\n - JERRY_PARSE_NO_OPTS - No options passed\n - JERRY_PARSE_STRICT_MODE - Enable strict mode\n - JERRY_PARSE_MODULE - Parse source as an ECMAScript module\n - JERRY_PARSE_HAS_ARGUMENT_LIST - `argument_list` field is valid, this also means that function parsing will be done\n - JERRY_PARSE_HAS_SOURCE_NAME - `source_name` field is valid\n - JERRY_PARSE_HAS_START - `start_line` and `start_column` fields are valid\n - JERRY_PARSE_HAS_USER_VALUE - `user_value` field is valid\n\n*Introduced in version 3.0*.\n\nUsing both `JERRY_PARSE_MODULE` and `JERRY_PARSE_HAS_ARGUMENT_LIST` is an invalid combination and will result in\nan exception during parsing.\n\n**See also**\n\n- [jerry_parse_options_t](#jerry_parse_options_t)\n\n\n## jerry_gc_mode_t\n\nSet garbage collection operational mode\n\n - JERRY_GC_PRESSURE_LOW - free unused objects\n - JERRY_GC_PRESSURE_HIGH - free as much memory as possible\n\nThe difference between `JERRY_GC_PRESSURE_LOW` and `JERRY_GC_PRESSURE_HIGH`\nis that the former keeps memory allocated for performance improvements such\nas property hash tables for large objects. The latter frees all possible\nmemory blocks but the performance may drop after the garbage collection.\n\n*Introduced in version 2.0*.\n\n\n## jerry_frame_type_t\n\nList of backtrace frame types returned by\n[jerry_frame_type](#jerry_frame_type).\n\n - JERRY_BACKTRACE_FRAME_JS - indicates that the frame is created for a JavaScript function/method\n\n*Introduced in version 3.0*.\n\n\n## jerry_generate_snapshot_opts_t\n\nFlags for [jerry_generate_snapshot](#jerry_generate_snapshot):\n\n - JERRY_SNAPSHOT_SAVE_STATIC - generate static snapshot (see below)\n\n**Generate static snapshots**\nSnapshots contain literal pools, and these literal pools contain references\nto constant literals (strings, numbers, etc.). When a snapshot is executed,\nthese literals are converted to jerry values and the literal pool entries\nare changed to their corresponding jerry value. To support this conversion,\nthe literals and literal pools are copied into RAM even if the\n`JERRY_SNAPSHOT_EXEC_COPY_DATA` option is passed to\n[jerry_exec_snapshot](#jerry_exec_snapshot). This non-negligible memory\nconsumption can be avoided by using static snapshots. The literals of\nthese snapshots are limited to magic strings and 28 bit signed integers,\nso their constant pools do not need to be loaded into the memory.\nHence these snapshots can be executed from ROM.\n\n***Important note:*** The [jerry_exec_snapshot](#jerry_exec_snapshot)\nfunction rejects static snapshots unless the `JERRY_SNAPSHOT_EXEC_ALLOW_STATIC`\noption bit is set. The caller must also ensure that the same magic\nstrings are set by [jerry_register_magic_strings](#jerry_register_magic_strings)\nwhen the snapshot is generated and executed. Furthermore the\n`JERRY_SNAPSHOT_EXEC_COPY_DATA` option is not allowed.\n\n*Introduced in version 2.0*.\n\n*Updated in version 3.0*: The `JERRY_SNAPSHOT_SAVE_STRICT` value is removed, `JERRY_PARSE_STRICT_MODE` should be used instead.\n\n\n## jerry_exec_snapshot_opts_t\n\nFlags for [jerry_exec_snapshot](#jerry_exec_snapshot) functions:\n\n - JERRY_SNAPSHOT_EXEC_COPY_DATA - copy snapshot data into memory (see below)\n - JERRY_SNAPSHOT_EXEC_ALLOW_STATIC - allow executing static snapshots\n - JERRY_SNAPSHOT_EXEC_LOAD_AS_FUNCTION - load snapshot as function instead of executing it\n - JERRY_SNAPSHOT_EXEC_HAS_SOURCE_NAME - `source_name` field is valid\n                                      in [jerry_exec_snapshot_option_values_t](#jerry_exec_snapshot_option_values_t)\n - JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE - `user_value` field is valid\n                                        in [jerry_exec_snapshot_option_values_t](#jerry_exec_snapshot_option_values_t)\n\n*Updated in version 3.0*: The `JERRY_SNAPSHOT_EXEC_LOAD_AS_FUNCTION` value is added,\n                                       which replaces the `jerry_load_function_snapshot` function.\n\n**Copy snapshot data into memory**\n\nBy default the snapshot buffer is expected to be present in memory until\n[jerry_cleanup](#jerry_cleanup) is called. For example `static const` buffers\ncompiled into the application binary satisfy this requirement.\n\nIf the snapshot buffer is freed after [jerry_exec_snapshot](#jerry_exec_snapshot)\nis called the `JERRY_SNAPSHOT_EXEC_COPY_DATA` must be passed to copy the necessary\nparts of the snapshot buffer into memory.\n\nThe `JERRY_SNAPSHOT_EXEC_COPY_DATA` option is not allowed for static snapshots.\n\n*Introduced in version 2.0*.\n\n\n## jerry_char_t\n\n**Summary**\n\nJerry's char value\n\n**Prototype**\n\n```c\ntypedef uint8_t jerry_char_t;\n```\n\n## jerry_size_t\n\n**Summary**\n\nJerry's size\n\n**Prototype**\n\n```c\ntypedef uint32_t jerry_size_t;\n```\n\n## jerry_length_t\n\n**Summary**\n\nJerry's length\n\n**Prototype**\n\n```c\ntypedef uint32_t jerry_length_t;\n```\n\n## jerry_encoding_t\n\nSupported string encodings.\n\n - JERRY_ENCODING_CESU8 - cesu-8 encoding\n - JERRY_ENCODING_UTF8 - utf-8 encoding\n\n*Introduced in version 3.0*.\n\n## jerry_value_t\n\n**Summary**\n\nA JerryScript value can be undefined, null, boolean, number, string, object, or an exception value. Exception values\nrepresent thrown exceptions during execution. Exception values cannot be passed as an argument to regular API function,\nonly to those that work with exception values specifically.\n\nReturned and created values by the API functions must be freed with\n[jerry_value_free](#jerry_value_free) when they are no longer needed.\n\n**Prototype**\n\n```c\ntypedef uint32_t jerry_value_t;\n```\n\n\n## jerry_context_data_manager_t\n\n**Summary**\n\nStructure that defines how a context data item will be initialized and deinitialized. JerryScript zeroes out the memory\nfor the item by default, and if the `init_cb` field is not NULL, it will be called with the pointer to the memory as\nan additional custom initializer. The `deinit_cb` (if non-`NULL`) is called during a call to `jerry_cleanup ()` to run\nany custom deinitialization *before* the VM has been fully cleaned up. The `finalize_cb` (if non-`NULL`) is also called\nduring a call to `jerry_cleanup ()` to run any custom deinitialization *after* the VM has been fully cleaned up.\nIf bytes_needed field is 0, no buffer is allocated for the manager, callback functions are called with NULL pointer.\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  /**\n   * Callback responsible for initializing a context item, or NULL to zero out the memory. This is called lazily, the\n   * first time jerry_context_data () is called with this manager.\n   *\n   * @param [in] data The buffer that JerryScript allocated for the manager. The buffer is zeroed out. The size is\n   * determined by the bytes_needed field. The buffer is kept alive until jerry_cleanup () is called.\n   */\n  void (*init_cb) (void *data);\n\n  /**\n   * Callback responsible for deinitializing a context item, or NULL. This is called as part of jerry_cleanup (),\n   * right *before* the VM has been cleaned up. This is a good place to release strong references to jerry_value_t's\n   * that the manager may be holding.\n   * Note: because the VM has not been fully cleaned up yet, jerry_object_native_info_t free_cb's can still get called\n   * *after* all deinit_cb's have been run. See finalize_cb for a callback that is guaranteed to run *after* all\n   * free_cb's have been run.\n   *\n   * @param [in] data The buffer that JerryScript allocated for the manager.\n   */\n  void (*deinit_cb) (void *data);\n\n  /**\n   * Callback responsible for finalizing a context item, or NULL. This is called as part of jerry_cleanup (),\n   * right *after* the VM has been cleaned up and destroyed and jerry_... APIs cannot be called any more. At this point,\n   * all values in the VM have been cleaned up. This is a good place to clean up native state that can only be cleaned\n   * up at the very end when there are no more VM values around that may need to access that state.\n   *\n   * @param [in] data The buffer that JerryScript allocated for the manager. After returning from this callback,\n   * the data pointer may no longer be used.\n   */\n  void (*finalize_cb) (void *data);\n\n  /**\n   * Number of bytes to allocate for this manager. This is the size of the buffer that JerryScript will allocate on\n   * behalf of the manager. The pointer to this buffer is passed into init_cb, deinit_cb and finalize_cb. It is also\n   * returned from the jerry_context_data () API.\n   */\n  size_t bytes_needed;\n} jerry_context_data_manager_t;\n```\n\n*Introduced in version 2.0*.\n\n\n## jerry_context_alloc_t\n\n**Summary**\n\nFunction type for allocating buffer for JerryScript context.\n\n**Prototype**\n\n```c\ntypedef void *(*jerry_context_alloc_t) (size_t size, void *cb_data_p);\n```\n\n- `size` - allocation size\n- `cb_data_p` - pointer to user data\n\n**Introduced in version 2.0*.*\n*External context allocation has been moved to the port API in version 3.0.*\n\n\n## jerry_context_t\n\n**Summary**\n\nAn opaque declaration of the JerryScript context structure.\n\n**Prototype**\n\n```c\ntypedef struct jerry_context_t jerry_context_t;\n```\n\n*Introduced in version 2.0*.\n\n## jerry_container_op_t\n\nEnum that contains the supported container operation types\n  - JERRY_CONTAINER_OP_ADD - Set/WeakSet add operation\n  - JERRY_CONTAINER_OP_GET - Map/WeakMap get operation\n  - JERRY_CONTAINER_OP_SET - Map/WeakMap set operation\n  - JERRY_CONTAINER_OP_HAS - Set/WeakSet/Map/WeakMap has operation\n  - JERRY_CONTAINER_OP_DELETE - Set/WeakSet/Map/WeakMap delete operation\n  - JERRY_CONTAINER_OP_SIZE - Set/WeakSet/Map/WeakMap size operation\n  - JERRY_CONTAINER_OP_CLEAR - Set/Map clear operation\n\n*Introduced in version 3.0*.\n\n## jerry_binary_op_t\n\nEnum that contains the supported binary operation types\n - JERRY_BIN_OP_EQUAL - equal comparison (==)\n - JERRY_BIN_OP_STRICT_EQUAL - strict equal comparison (===)\n - JERRY_BIN_OP_LESS - less relation (<)\n - JERRY_BIN_OP_LESS_EQUAL - less or equal relation (<=)\n - JERRY_BIN_OP_GREATER - greater relation (>)\n - JERRY_BIN_OP_GREATER_EQUAL - greater or equal relation (>=)\n - JERRY_BIN_OP_INSTANCEOF - instanceof operation\n - JERRY_BIN_OP_ADD - addition operator (+)\n - JERRY_BIN_OP_SUB - subtraction operator (-)\n - JERRY_BIN_OP_MUL - multiplication operator (*)\n - JERRY_BIN_OP_DIV - division operator (/)\n - JERRY_BIN_OP_REM - remainder operator (%)\n\n*Introduced in version 2.0*.\n\n**See also**\n\n- [jerry_binary_op](#jerry_binary_op)\n\n## jerry_property_descriptor_flags_t\n\nEnum that contains the flags of property descriptors.\n\n - JERRY_PROP_NO_OPTS - empty property descriptor\n - JERRY_PROP_IS_CONFIGURABLE - [[Configurable]]\n - JERRY_PROP_IS_ENUMERABLE - [[Enumerable]]\n - JERRY_PROP_IS_WRITABLE - [[Writable]]\n - JERRY_PROP_IS_CONFIGURABLE_DEFINED - Is [[Configurable]] defined?\n - JERRY_PROP_IS_ENUMERABLE_DEFINED - Is [[Enumerable]] defined?\n - JERRY_PROP_IS_WRITABLE_DEFINED - Is [[Writable]] defined?\n - JERRY_PROP_IS_VALUE_DEFINED - Is [[Value]] defined?\n - JERRY_PROP_IS_GET_DEFINED - Is [[Get]] defined?\n - JERRY_PROP_IS_SET_DEFINED - Is [[Set]] defined?\n - JERRY_PROP_SHOULD_THROW - Should throw in case of an exception, instead of returning with false\n\n*Introduced in version 3.0*.\n\n**See also**\n\n- [jerry_property_descriptor_t](#jerry_property_descriptor_t)\n\n## jerry_parse_options_t\n\n**Summary**\n\nVarious configuration options for parsing functions such as [jerry_parse](#jerry_parse).\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  uint32_t options; /**< combination of jerry_parse_option_enable_feature_t values */\n  jerry_value_t argument_list; /**< function argument list if JERRY_PARSE_HAS_ARGUMENT_LIST is set in options\n                                *   Note: must be string value */\n  jerry_value_t source_name; /**< source name string (usually a file name)\n                              *   if JERRY_PARSE_HAS_SOURCE_NAME is set in options\n                              *   Note: must be string value */\n  uint32_t start_line; /**< start line of the source code if JERRY_PARSE_HAS_START is set in options */\n  uint32_t start_column; /**< start column of the source code if JERRY_PARSE_HAS_START is set in options */\n  jerry_value_t user_value; /**< user value assigned to all functions created by this script including eval\n                             *   calls executed by the script if JERRY_PARSE_HAS_USER_VALUE is set in options */\n} jerry_parse_options_t;\n```\n\n*Introduced in version 3.0*.\n\n**See also**\n\n- [jerry_parse](#jerry_parse)\n- [jerry_generate_snapshot](#jerry_generate_snapshot)\n- [jerry_exec_snapshot](#jerry_exec_snapshot)\n- [jerry_parse_option_enable_feature_t](#jerry_parse_option_enable_feature_t)\n\n## jerry_property_descriptor_t\n\n**Summary**\n\nDescription of ECMA property descriptor. This struct can be used\nfor the [jerry_object_define_own_prop](#jerry_object_define_own_prop) method to\nconfigure how the property should be registered.\n\nThe naming scheme is similar to the JavaScript `Object.defineProperty` method.\n\nFields should be used in pairs. That is if the `is_value_defined` is set to `true`\nthe `value` field should contain the value for the property.\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  uint16_t flags; /**< any combination of jerry_property_descriptor_flags_t bits */\n  jerry_value_t value; /**< [[Value]] */\n  jerry_value_t getter; /**< [[Get]] */\n  jerry_value_t setter; /**< [[Set]] */\n} jerry_property_descriptor_t;\n```\n\n*Updated in version 3.0*: The `is_value_defined`, `is_get_defined`, `is_set_defined`,\n                              `is_writable_defined`, `is_writable`, `is_enumerable_defined`,\n                              `is_enumerable`, `is_configurable_defined`, and `is_configurable`\n                              fields are replaced by the `flags` field.\n\n**See also**\n\n- [jerry_property_descriptor_flags_t](#jerry_property_descriptor_flags_t)\n- [jerry_object_define_own_prop](#jerry_object_define_own_prop)\n\n## jerry_frame_location_t\n\n**Summary**\n\nSource code location data retrieved by\n[jerry_frame_location](#jerry_frame_location).\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  jerry_value_t source_name; /**< source name */\n  jerry_size_t line; /**< line index */\n  jerry_size_t column; /**< column index */\n} jerry_frame_location_t;\n```\n\n*Renamed in version 3.0, it was previously known as `jerry_backtrace_location_t` in earlier versions.*\n\n## jerry_frame_t\n\n**Summary**\n\nBacktrace frame data passed to the [jerry_backtrace_cb_t](#jerry_backtrace_cb_t)\nhandler. This is an internal data structure which fields can be accessed by helper functions\nsuch as [jerry_frame_location](#jerry_frame_location).\n\n**Prototype**\n\n```c\n/**\n * Internal data structure for jerry_frame_t definition.\n */\nstruct jerry_frame_internal_t;\n\n/**\n * Backtrace frame data passed to the jerry_backtrace_cb_t handler.\n */\ntypedef struct jerry_frame_internal_t jerry_frame_t;\n```\n\n*Introduced in version 3.0*.\n\n## jerry_heap_stats_t\n\n**Summary**\n\nDescription of JerryScript heap memory stats.\nIt is for memory profiling.\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  size_t version /**< the version of the stats struct */\n  size_t size; /**< heap total size */\n  size_t allocated_bytes; /**< currently allocated bytes */\n  size_t peak_allocated_bytes; /**< peak allocated bytes */\n  size_t reserved[4]; /**< padding for future extensions */\n} jerry_heap_stats_t;\n```\n\n*Introduced in version 2.0*.\n\n**See also**\n\n- [jerry_heap_stats](#jerry_heap_stats)\n\n## jerry_call_info_t\n\n**Summary**\n\nCall related information passed to [jerry_external_handler_t](#jerry_external_handler_t).\n\n**Prototype**\n\n```c\ntypedef struct jerry_call_info_t\n{\n  jerry_value_t function; /**< invoked function object */\n  jerry_value_t this_value; /**< this value passed to the function */\n  jerry_value_t new_target; /**< current new target value, undefined for non-constructor calls */\n} jerry_call_info_t;\n```\n\n*Introduced in version 3.0*. Contents of this struct replaces the `jerry_get_new_target` function.\n\n**See also**\n\n- [jerry_external_handler_t](#jerry_external_handler_t)\n\n## jerry_external_handler_t\n\n**Summary**\n\nType of an external function handler\n\n**Prototype**\n\n```c\ntypedef jerry_value_t (*jerry_external_handler_t) (const jerry_call_info_t *call_info_p,\n                                                   const jerry_value_t args_p[],\n                                                   const jerry_length_t args_count);\n```\n\n- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)\n                  structure which holds call related information.\n- `args_p` - the function arguments, array of JavaScript values.\n- `args_count` - the number of arguments.\n- return value\n  - The function's return value. If there is no return value, use [jerry_undefined()](#jerry_undefined).\n\n**See also**\n\n- [jerry_function_external](#jerry_function_external)\n\n## jerry_value_free_callback_t\n\n**Summary**\n\nNative free callback of generic value types.\n\n*Note*:\n- Referred values by this method must have at least 1 reference. (Correct API usage satisfies this condition)\n\n**Prototype**\n\n```c\ntypedef void (*jerry_value_free_callback_t) (void *native_p);\n```\n\n*Introduced in version 3.0*.\n\n**See also**\n\n- [jerry_string_external_sz](#jerry_string_external_sz)\n- [jerry_string_external](#jerry_string_external)\n- [jerry_arraybuffer_external](#jerry_arraybuffer_external)\n\n## jerry_object_native_free_cb_t\n\n**Summary**\n\nNative free callback of an object. The callback receives both the memory pointer and the type\ninformation passed to [jerry_object_set_native_ptr](#jerry_object_set_native_ptr).\n\n*Note*:\n- Referred values by this method must have at least 1 reference. (Correct API usage satisfies this condition)\n\n**Prototype**\n\n```c\ntypedef void (*jerry_object_native_free_cb_t) (void *native_p, struct jerry_object_native_info_t *info_p);\n```\n\n- `native_p` - native pointer passed to [jerry_object_set_native_ptr](#jerry_object_set_native_ptr).\n- `info_p` - native type info passed to [jerry_object_set_native_ptr](#jerry_object_set_native_ptr).\n\n*Introduced in version 2.0*: Renamed from `jerry_object_free_callback_t`.\n\n*Updated in version 2.2*: API calls are once again allowed. (See note)\n\n*Updated in version 3.0*: `info_p` argument is added and renamed, it was previously known as `jerry_object_native_free_callback_t` in earlier versions.\n\n**See also**\n\n- [jerry_object_native_info_t](#jerry_object_native_info_t)\n\n## jerry_external_string_free_cb_t\n\n**Summary**\n\nFree callback for external strings. See\n[jerry_string_external_on_free](#jerry_string_external_on_free)\nfor more information.\n\n**Prototype**\n\n```c\ntypedef void (*jerry_external_string_free_cb_t) (jerry_char_t *string_p,\n                                                 jerry_size_t string_size,\n                                                 void *user_p);\n```\n\n- `string_p` - external string pointer\n- `string_size` - size of external string\n- `user_p` - pointer passed when the external string is created\n\n*Renamed in version 3.0, it was previously known as `jerry_external_string_free_callback_t` in earlier versions.*\n\n**See also**\n\n- [jerry_string_external_on_free](#jerry_string_external_on_free)\n- [jerry_string_external_sz](#jerry_string_external_sz)\n- [jerry_string_external](#jerry_string_external)\n\n## jerry_error_object_created_cb_t\n\n**Summary**\n\nDecorator callback for Error objects. This native callback is called every time when an Error\nobject is created and the decorator can create or update any properties of the newly created\nError object.\n\n*Note*:\n- The callback function cannot be called recursively, so the Error objects created\n  when the callback is running are not updated.\n\n**Prototype**\n\n```c\ntypedef void (*jerry_error_object_created_cb_t) (const jerry_value_t error_object, void *user_p);\n```\n\n- `error_object` - the newly created Error object.\n- `user_p` - pointer passed to [jerry_error_on_created](#jerry_error_on_created).\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_error_object_created_callback_t` in earlier versions.*\n\n**See also**\n\n- [jerry_error_on_created](#jerry_error_on_created)\n\n## jerry_module_state_t\n\nAn enum representing the current status of a module\n\n - JERRY_MODULE_STATE_INVALID - Return value for jerry_module_state when its argument is not a module\n - JERRY_MODULE_STATE_UNLINKED - Module is currently unlinked\n - JERRY_MODULE_STATE_LINKING - Module is currently being linked\n - JERRY_MODULE_STATE_LINKED - Module has been linked (its dependencies has been resolved)\n - JERRY_MODULE_STATE_EVALUATING - Module is currently being evaluated\n - JERRY_MODULE_STATE_EVALUATED - Module has been evaluated (its source code has been executed)\n - JERRY_MODULE_STATE_ERROR - An exception has been encountered before the evaluated state is reached\n\n*Introduced in version 3.0*.\n\n## jerry_module_resolve_cb_t\n\n**Summary**\n\nCallback which is called by [jerry_module_link](#jerry_module_link) to get the referenced module.\n\n*Note*:\n- If realms are enabled, the returned module should be created in the current\n  realm (see: [jerry_current_realm](#jerry_current_realm))\n\n**Prototype**\n\n```c\ntypedef jerry_value_t (*jerry_module_resolve_cb_t) (const jerry_value_t specifier,\n                                                    const jerry_value_t referrer,\n                                                    void *user_p);\n```\n\n- `specifier` - a module specifier string (usually used as a path to the module)\n- `referrer` - a module object which contains the `specifier` in its source code\n- `user_p` - pointer passed to [jerry_module_link](#jerry_module_link).\n- return value\n  - a module object - if it can be resolved successfully\n  - an exception - otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_module_resolve_callback_t` in earlier versions.*\n\n**See also**\n- [jerry_module_link](#jerry_module_link)\n- [jerry_current_realm](#jerry_current_realm)\n\n## jerry_module_import_cb_t\n\n**Summary**\n\nCallback which is called when an import is resolved dynamically to get the referenced module.\n\n*Note*:\n- If the function returns with a promise, the import call returns with this promise. The\n  application should try to resolve the requested module later. If the module is evaluated\n  successfully, the returned promise should be resolved with the namespace object of the\n  module. Otherwise, the returned promise should be rejected with an exception.\n- If the function returns with a resolved module, a promise is created and resolved with the\n  namespace object of the module. The import call returns with the resolved promise.\n- If the function returns with an exception, a promise is created and rejected with the\n  returned exception. The import call returns with the rejected promise.\n- All other return values are considered invalid. In this case the import call returns\n  with a rejected promise. The rejected promise has a fixed error message, it does not\n  specify the reason of the fail.\n- If realms are enabled, the returned module should be created in the current\n  realm (see: [jerry_current_realm](#jerry_current_realm))\n\n**Prototype**\n\n```c\ntypedef jerry_value_t (*jerry_module_import_cb_t) (const jerry_value_t specifier,\n                                                   const jerry_value_t user_value,\n                                                   void *user_p);\n```\n\n- `specifier` - a module specifier string (usually used as a path to the module)\n- `user_value` - the user value assigned to the script (see [jerry_parse_options_t](#jerry_parse_options_t))\n- `user_p` - pointer passed to [jerry_module_on_import](#jerry_module_on_import).\n- return value\n  - promise or resolved module - if the operation is successful\n  - an exception - otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_module_import_callback_t` in earlier versions.*\n\n**See also**\n- [jerry_module_on_import](#jerry_module_on_import)\n- [jerry_current_realm](#jerry_current_realm)\n\n## jerry_module_state_changed_cb_t\n\n**Summary**\n\nCallback which is called after the module enters into linked, evaluated or error state.\n\n**Prototype**\n\n```c\ntypedef void (*jerry_module_state_changed_cb_t) (jerry_module_state_t new_state,\n                                                 const jerry_value_t module,\n                                                 const jerry_value_t value,\n                                                 void *user_p);\n```\n\n- `new_state` - new state of the module.\n- `module` - a module whose state is changed\n- `value` - depends on the state: undefined for linked, module script result for evaluated,\n            and exception value for error state.\n- `user_p` - pointer passed to [jerry_module_on_state_changed](#jerry_module_on_state_changed).\n\n*Renamed in version 3.0, it was previously known as `jerry_module_state_changed_callback_t` in earlier versions.*\n\n**See also**\n- [jerry_module_on_state_changed](#jerry_module_on_state_changed)\n\n## jerry_module_import_meta_cb_t\n\n**Summary**\n\nCallback which is called when an import.meta expression of a module is evaluated the first time.\nThe object returned by import.meta is passed as the `meta_object` argument to the callback, and\nthe callback can set the initial status of the object (e.g. add properties or set prototype).\n\n**Prototype**\n\n```c\ntypedef void (*jerry_module_import_meta_cb_t) (const jerry_value_t module,\n                                               const jerry_value_t meta_object,\n                                               void *user_p);\n```\n\n- `module` - module whose import.meta object is requested.\n- `meta_object` - import.meta object created for the module.\n- `user_p` - pointer passed to [jerry_module_on_import_meta](#jerry_module_on_import_meta).\n\n*Renamed in version 3.0, it was previously known as `jerry_module_import_meta_callback_t` in earlier versions.*\n\n**See also**\n- [jerry_module_on_import_meta](#jerry_module_on_import_meta)\n\n## jerry_native_module_evaluate_cb_t\n\n**Summary**\n\nCallback which is called by [jerry_module_evaluate](#jerry_module_evaluate) to evaluate the native module.\n\nNote:\n - Native pointers can be used to assign private data to a native module,\n   see [jerry_object_set_native_ptr](#jerry_object_set_native_ptr)\n\n**Prototype**\n\n```c\ntypedef jerry_value_t (*jerry_native_module_evaluate_cb_t) (const jerry_value_t native_module);\n```\n\n- `native_module` - a native module\n- return value\n  - any non-exception value - if the module is evaluated successfully\n  - an exception - otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_native_module_evaluate_callback_t` in earlier versions.*\n\n**See also**\n- [jerry_module_evaluate](#jerry_module_evaluate)\n\n## jerry_backtrace_cb_t\n\n**Summary**\n\nCallback function which is called by [jerry_backtrace_capture](#jerry_backtrace_capture)\nfor each stack frame.\n\n**Prototype**\n\n```c\ntypedef bool (*jerry_backtrace_cb_t) (jerry_frame_t *frame_p, void *user_p);\n```\n\n- `frame_p` - pointer to [jerry_frame_t](#jerry_frame_t) data.\n- `user_p` - pointer passed to [jerry_backtrace_capture](#jerry_backtrace_capture).\n- return value\n  - true, to continue capturing more frames\n  - false, to end the stack capturing\n\n*Renamed in version 3.0, it was previously known as `jerry_backtrace_callback_t` in earlier versions.*\n\n**See also**\n\n- [jerry_backtrace_capture](#jerry_backtrace_capture)\n- [jerry_frame_t](#jerry_frame_t)\n\n## jerry_object_native_info_t\n\n**Summary**\n\nType information for native pointers. Since each native pointer has a type information,\nmultiple native pointers can be assigned to an object, and these can be updated or\ndeleted independently.\n\nThe type information has a free callback, which is called when the object is freed\nby the garbage collector. If the callback is NULL, the application is not notified\nabout the destruction of the object.\n\nThe buffer pointed by the native pointer can have a fixed number of jerry values,\nwhich refer to other values as long as the object is alive. The starting byte\noffset and the number of these values are specified by `offset_of_references` and\n`number_of_references` fields respectively. Before a buffer is attached to an\nobject by [jerry_object_set_native_ptr](#jerry_object_set_native_ptr),\nthe values must be initialized to undefined by\n[jerry_native_ptr_init](#jerry_native_ptr_init).\nWhen a buffer is no longer attached to any object, the\n[jerry_native_ptr_free](#jerry_native_ptr_free)\nmust be called to release the values. A single buffer can be attached to any\nnumber of living objects. When a buffer is currently attached to at least\none object, the references can be updated by\n[jerry_native_ptr_set](#jerry_native_ptr_set).\nHowever, if the buffer is no longer attached to an object, the finalize function\nmust be called even if the buffer is reattached to another object later. In this\ncase, calling the init function after the finalization is optional, because the\nfinalize function also initializes all values to undefined.\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  jerry_object_native_free_cb_t free_cb; /**< the free callback of the native pointer */\n  uint16_t number_of_references; /**< the number of value references which are marked by the garbage collector */\n  uint16_t offset_of_references; /**< byte offset indicating the start offset of value\n                                  *   references in the user allocated buffer */\n} jerry_object_native_info_t;\n```\n\n*Introduced in version 2.0*.\n\n*Updated in version 3.0*: Added `number_of_references`, and `offset_of_references` fields.\n\n**See also**\n\n- [jerry_object_set_native_ptr](#jerry_object_set_native_ptr)\n- [jerry_object_get_native_ptr](#jerry_object_get_native_ptr)\n- [jerry_object_delete_native_ptr](#jerry_object_delete_native_ptr)\n- [jerry_native_ptr_init](#jerry_native_ptr_init)\n- [jerry_native_ptr_free](#jerry_native_ptr_free)\n- [jerry_native_ptr_set](#jerry_native_ptr_set)\n\n## jerry_object_property_foreach_cb_t\n\n**Summary**\n\nFunction type used as a callback for the [jerry_object_foreach](#jerry_object_foreach)\nmethod. A function with this type must return \"true\" to continue the iteration or \"false\" to finish the\niteration on the object's properties.\n\n**Prototype**\n\n```c\ntypedef bool (*jerry_object_property_foreach_cb_t) (const jerry_value_t property_name,\n                                                    const jerry_value_t property_value,\n                                                    void *user_data_p);\n```\n\n- `property_name` - a property name, this is not always a string.\n- `property_value` - the value for the given property.\n- `user_data_p` - optional user data pointer supplied via the (jerry_object_foreach)[#jerry_object_foreach] method.\n- return value\n  - true, to continue the iteration\n  - false, to stop the iteration\n\n*Renamed in version 3.0, it was previously known as `jerry_object_property_foreach_t` in earlier versions.*\n\n**See also**\n\n- [jerry_object_foreach](#jerry_object_foreach)\n\n## jerry_foreach_live_object_cb_t\n\n**Summary**\n\nFunction type used as a callback for the (jerry_foreach_live_object)[#jerry_foreach_live_object] method.\nA function with this type must return \"true\" to continue the iteration or \"false\" to finish the\niteration on the object's properties.\n\n**Prototype**\n\n```c\ntypedef bool (*jerry_foreach_live_object_cb_t) (const jerry_value_t object,\n                                                void *user_data_p);\n```\n\n- `object` - the current JavaScript object in the for-each iteration.\n- `user_data_p` - optional user data pointer supplied via the (jerry_foreach_live_object)[#jerry_foreach_live_object] method.\n- return value\n  - true, to continue the iteration\n  - false, to stop the iteration\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_objects_foreach_t` in earlier versions.*\n\n**See also**\n\n- [jerry_foreach_live_object](#jerry_foreach_live_object)\n\n## jerry_foreach_live_object_with_info_cb_t\n\n**Summary**\n\nFunction type used as a callback for the (jerry_foreach_live_object_with_info)[#jerry_foreach_live_object_with_info]\nmethod. A function with this type must return \"true\" to continue the iteration or \"false\" to finish the\niteration on the object's properties.\n\n**Prototype**\n\n```c\ntypedef bool (*jerry_foreach_live_object_with_info_cb_t) (const jerry_value_t object,\n                                                          void *object_data_p,\n                                                          void *user_data_p);\n```\n\n- `object` - the current JavaScript object in the for-each iteration.\n- `object_data_p` - the current object's native data pointer.\n- `user_data_p` - optional user data pointer supplied via the (jerry_foreach_live_object_with_info)[#jerry_foreach_live_object_with_info] method.\n- return value\n  - true, to continue the iteration\n  - false, to stop the iteration\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_objects_foreach_by_native_info_t` in earlier versions.*\n\n**See also**\n\n- [jerry_foreach_live_object_with_info](#jerry_foreach_live_object_with_info)\n\n## jerry_halt_cb_t\n\n**Summary**\n\nCallback which is called periodically by the engine, and polls whether the ECMAScript execution should be stopped. If\nthe callback returns with an undefined value the ECMAScript execution continues. Otherwise the result is thrown by the\nengine as an exception, and execution returns to the caller. The callback function might be called again even if it\nthrew an exception. In this case the function must throw the same exception again.\n\n**Prototype**\n\n```c\ntypedef jerry_value_t (*jerry_halt_cb_t) (void *user_p);\n```\n\n*Introduced in version 2.0*.\n\n**See also**\n\n- [jerry_halt_handler](#jerry_halt_handler)\n\n## jerry_throw_cb_t\n\n**Summary**\n\nCallback which is called when a value is thrown in an ECMAScript code. The callback\nshould not change the `exception_value`. The callback is not called again until the value\nis caught.\n\nNote:\n - The engine considers exceptions thrown by external functions as never caught. The\n   application can maintain a status flag to ignore the next call of the callback\n   if necessary.\n   See: [jerry_function_external](#jerry_function_external)\n\n**Prototype**\n\n```c\ntypedef void (*jerry_throw_cb_t) (const jerry_value_t exception_value, void *user_data_p);\n```\n - `exception_value` - the thrown exception\n - `user_data_p` -  optional user data pointer\n\n*Renamed in version 3.0, it was previously known as `jerry_vm_throw_callback_t` in earlier versions.*\n\n**See also**\n\n- [jerry_on_throw](#jerry_on_throw)\n\n\n## jerry_string_iterate_cb_t\n\n**Summary**\n\n**Prototype**\n\n```c\ntypedef void (*jerry_string_iterate_cb_t) (uint32_t value, void *user_data_p);\n```\n\n- `value` - encoded byte value\n- `user_data_p` - optional user data pointer supplied via the (jerry_string_iterate)[#jerry_string_iterate] method.\n\n*Introduced in version 3.0*.\n\n**See also**\n\n- [jerry_string_iterate](#jerry_string_iterate)\n\n\n## jerry_promise_state_t\n\nEnum which describes the state of a Promise.\n\nPossible values:\n\n - JERRY_PROMISE_STATE_NONE - Invalid/Unknown state (possibly called on a non-promise object).\n - JERRY_PROMISE_STATE_PENDING - Promise is in \"Pending\" state.\n - JERRY_PROMISE_STATE_FULFILLED - Promise is in \"Fulfilled\" state.\n - JERRY_PROMISE_STATE_REJECTED - Promise is in \"Rejected\" state.\n\n*Introduced in version 2.2*.\n\n**See also**\n\n- [jerry_promise_result](#jerry_promise_result)\n\n## jerry_promise_event_type_t\n\nEvent types for [jerry_promise_event_cb_t](#jerry_promise_event_cb_t) callback function.\nThe description of the `object` and `value` arguments are provided for each type.\n\nPossible values:\n\n- JERRY_PROMISE_EVENT_CREATE - A new Promise object is created.\n  - object - the new Promise object\n  - value - parent Promise for `then` chains, undefined otherwise.\n- JERRY_PROMISE_EVENT_RESOLVE - Called when a Promise is about to be resolved.\n  - object - the Promise object\n  - value - value for resolving.\n- JERRY_PROMISE_EVENT_REJECT - Called when a Promise is about to be rejected.\n  - object - the Promise object\n  - value - value for rejecting.\n- JERRY_PROMISE_EVENT_RESOLVE_FULFILLED - Called when a resolve is called on a fulfilled Promise.\n  - object - the Promise object\n  - value - value for resolving\n- JERRY_PROMISE_EVENT_REJECT_FULFILLED - Called when a reject is called on a fulfilled Promise.\n  - object - the Promise object\n  - value - value for rejecting\n- JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER - Called when a Promise is rejected without a handler.\n  - object - the Promise object\n  - value - value for rejecting\n- JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED - Called when a catch handler is added to a rejected\n                                            Promise which did not have a catch handler before.\n  - object - the Promise object\n  - value - undefined\n- JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB - Called before executing a Promise reaction job.\n  - object - the Promise object\n  - value - undefined\n- JERRY_PROMISE_EVENT_AFTER_REACTION_JOB - Called after a Promise reaction job is completed.\n  - object - the Promise object\n  - value - undefined\n- JERRY_PROMISE_EVENT_ASYNC_AWAIT - Called when an async function awaits the result of a Promise object.\n  - object - internal object representing the execution status\n  - value - the Promise object\n- JERRY_PROMISE_EVENT_ASYNC_BEFORE_RESOLVE - Called when an async function is continued with resolve.\n  - object - internal object representing the execution status\n  - value - value for resolving\n- JERRY_PROMISE_EVENT_ASYNC_BEFORE_REJECT - Called when an async function is continued with reject.\n  - object - internal object representing the execution status\n  - value - value for rejecting\n- JERRY_PROMISE_EVENT_ASYNC_AFTER_RESOLVE - Called when an async function resolve is completed.\n  - object - internal object representing the execution status\n  - value - value for resolving\n- JERRY_PROMISE_EVENT_ASYNC_AFTER_REJECT - Called when an async function reject is completed.\n  - object - internal object representing the execution status\n  - value - value for rejecting\n\n*Introduced in version 3.0*.\n\n**See also**\n\n- [jerry_promise_event_cb_t](#jerry_promise_event_cb_t)\n- [jerry_promise_on_event](#jerry_promise_on_event)\n\n\n## jerry_promise_event_filter_t\n\nFilter types for [jerry_promise_on_event](#jerry_promise_on_event) callback function.\nThe callback is only called for those events which are enabled by the filters. The events are\ndescribed in [jerry_promise_event_type_t](#jerry_promise_event_type_t).\n\nPossible values:\n\n- JERRY_PROMISE_EVENT_FILTER_DISABLE - Disable reporting of all events.\n- JERRY_PROMISE_EVENT_FILTER_CREATE - Enables the following event:\n  - JERRY_PROMISE_EVENT_CREATE\n- JERRY_PROMISE_EVENT_FILTER_RESOLVE - Enables the following event:\n  - JERRY_PROMISE_EVENT_RESOLVE\n- JERRY_PROMISE_EVENT_FILTER_REJECT - Enables the following event:\n  - JERRY_PROMISE_EVENT_REJECT\n- JERRY_PROMISE_EVENT_FILTER_ERROR - Enables the following events:\n  - JERRY_PROMISE_EVENT_RESOLVE_FULFILLED\n  - JERRY_PROMISE_EVENT_REJECT_FULFILLED\n  - JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER\n  - JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED\n- JERRY_PROMISE_EVENT_FILTER_REACTION_JOB - Enables the following events:\n  - JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB\n  - JERRY_PROMISE_EVENT_AFTER_REACTION_JOB\n- JERRY_PROMISE_EVENT_FILTER_ASYNC_MAIN - Enables the following events:\n  - JERRY_PROMISE_EVENT_ASYNC_AWAIT\n- JERRY_PROMISE_EVENT_FILTER_ASYNC_REACTION_JOB - Enables the following events:\n  - JERRY_PROMISE_EVENT_ASYNC_BEFORE_RESOLVE\n  - JERRY_PROMISE_EVENT_ASYNC_BEFORE_REJECT\n  - JERRY_PROMISE_EVENT_ASYNC_AFTER_RESOLVE\n  - JERRY_PROMISE_EVENT_ASYNC_AFTER_REJECT\n\n*Introduced in version 3.0*.\n\n**See also**\n\n- [jerry_promise_event_type_t](#jerry_promise_event_type_t)\n- [jerry_promise_on_event](#jerry_promise_on_event)\n\n\n## jerry_promise_event_cb_t\n\n**Summary**\n\nNotification callback for tracking Promise and async function operations. The arguments\npassed to the callback depends on the `event_type` which is detailed in the\ndescription of [jerry_promise_event_type_t](#jerry_promise_event_type_t).\n\n**Prototype**\n\n```c\ntypedef void (*jerry_promise_event_cb_t) (jerry_promise_event_type_t event_type,\n                                          const jerry_value_t object, const jerry_value_t value,\n                                          void *user_p);\n```\n\n- `event_type` - type of the event notification.\n- `object` - object corresponding to the event.\n- `value` - optional value argument.\n- `user_data_p` - optional user data pointer supplied via the (jerry_promise_on_event)[#jerry_promise_on_event] method.\n\n*Renamed in version 3.0, it was previously known as `jerry_promise_callback_t` in earlier versions.*\n\n**See also**\n\n- [jerry_promise_event_type_t](#jerry_promise_event_type_t)\n- [jerry_promise_on_event](#jerry_promise_on_event)\n\n## jerry_typedarray_type_t\n\nEnum which describes the TypedArray types.\nPossible values:\n\n - JERRY_TYPEDARRAY_UINT8 - represents the Uint8Array TypedArray\n - JERRY_TYPEDARRAY_UINT8CLAMPED - represents the Uint8ClampedArray TypedArray\n - JERRY_TYPEDARRAY_INT8 - represents the Int8Array TypedArray\n - JERRY_TYPEDARRAY_UINT16 - represents the Uint16Array TypedArray\n - JERRY_TYPEDARRAY_INT16 - represents the Int16Array TypedArray\n - JERRY_TYPEDARRAY_UINT32 - represents the Uint32Array TypedArray\n - JERRY_TYPEDARRAY_INT32 - represents the Int32Array TypedArray\n - JERRY_TYPEDARRAY_FLOAT32 - represents the Float32Array TypedArray\n - JERRY_TYPEDARRAY_FLOAT64 - represents the Float64Array TypedArray\n - JERRY_TYPEDARRAY_BIGINT64 - represents the BigInt64Array TypedArray\n - JERRY_TYPEDARRAY_BIGUINT64 - represents the BigUint64Array TypedArray\n - JERRY_TYPEDARRAY_INVALID - represents an invalid TypedArray\n\nAPI functions can return the `JERRY_TYPEDARRAY_INVALID` value if the\nTypedArray support is not in the engine.\n\n*Introduced in version 2.0*.\n\n*Updated in version 2.4*: Added `JERRY_TYPEDARRAY_BIGINT64`, `JERRY_TYPEDARRAY_BIGUINT64` values.\n\n**See also**\n\n- [jerry_typedarray_type](#jerry_typedarray_type)\n\n\n## jerry_exec_snapshot_option_values_t\n\n**Summary**\n\nVarious configuration options for [jerry_exec_snapshot](#jerry_exec_snapshot)\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  jerry_value_t source_name; /**< source name string (usually a file name)\n                              *   if JERRY_SNAPSHOT_EXEC_HAS_SOURCE_NAME is set in exec_snapshot_opts\n                              *   Note: non-string values are ignored */\n  jerry_value_t user_value; /**< user value assigned to all functions created by this script including\n                             *   eval calls executed by the script if JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE\n                             *   is set in exec_snapshot_opts */\n} jerry_exec_snapshot_option_values_t;\n```\n\n*Introduced in version 3.0*.\n\n**See also**\n\n- [jerry_exec_snapshot](#jerry_exec_snapshot)\n\n## jerry_source_info_enabled_fields_t\n\nEnum which describes the enabled fields of [jerry_source_info_t](#jerry_source_info_t).\nPossible values:\n\n - JERRY_SOURCE_INFO_HAS_SOURCE_CODE - source_code field is valid\n - JERRY_SOURCE_INFO_HAS_FUNCTION_ARGUMENTS - function_arguments field is valid\n - JERRY_SOURCE_INFO_HAS_SOURCE_RANGE - both source_range_start and source_range_length fields are valid\n\n*Introduced in version 3.0*.\n\n**See also**\n\n- [jerry_source_info_t](#jerry_source_info_t)\n- [jerry_source_info](#jerry_source_info)\n\n## jerry_source_info_t\n\n**Summary**\n\nSource related information of a script/module/function.\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  uint32_t enabled_fields; /**< combination of jerry_source_info_enabled_fields_t values */\n  jerry_value_t source_code; /**< script source code or function body */\n  jerry_value_t function_arguments; /**< function arguments */\n  uint32_t source_range_start; /**< start position of the function in the source code */\n  uint32_t source_range_length; /**< source length of the function in the source code */\n} jerry_source_info_t;\n```\n\n*Introduced in version 3.0*.\n\n**See also**\n\n- [jerry_source_info_enabled_fields_t](#jerry_source_info_enabled_fields_t)\n- [jerry_source_info](#jerry_source_info)\n\n## jerry_arraybuffer_type_t\n\n**Summary**\n\nEnum that contains the JerryScript type of an array buffer:\n\n - JERRY_ARRAYBUFFER_TYPE_ARRAYBUFFER - the object is an array buffer object\n - JERRY_ARRAYBUFFER_TYPE_SHARED_ARRAYBUFFER - the object is a shared array buffer object\n\n*Introduced in version 3.0*.\n\n**See also**\n\n- [jerry_arraybuffer_allocate_cb_t](#jerry_arraybuffer_allocate_cb_t)\n- [jerry_arraybuffer_free_cb_t](#jerry_arraybuffer_free_cb_t)\n\n## jerry_arraybuffer_allocate_cb_t\n\n**Summary**\n\nCallback for allocating the backing store of array buffer or shared array buffer objects.\n\n*Note*:\n- The value referenced by `arraybuffer_user_p` is always NULL unless the buffer is created by\n  [jerry_arraybuffer_external](#jerry_arraybuffer_external) or\n  [jerry_shared_arraybuffer_external](#jerry_shared_arraybuffer_external).\n  The value referenced by `arraybuffer_user_p` can be changed, and the new value is passed to\n  [jerry_arraybuffer_free_cb_t](#jerry_arraybuffer_free_cb_t).\n\n**Prototype**\n\n```c\ntypedef uint8_t *(*jerry_arraybuffer_allocate_cb_t) (jerry_arraybuffer_type_t buffer_type,\n                                                     uint32_t buffer_size,\n                                                     void **arraybuffer_user_p,\n                                                     void *user_p);\n```\n\n- `buffer_type` - type of the array buffer object, see: [jerry_arraybuffer_type_t](#jerry_arraybuffer_type_t).\n- `buffer_size` - size of the requested buffer.\n- `arraybuffer_user_p` - [in/out] user pointer assigned to the array buffer or shared array buffer object.\n- `user_p` - user pointer passed to [jerry_arraybuffer_allocator](#jerry_arraybuffer_allocator)\n- return value\n  - Pointer to the buffer, if the allocation is successful, NULL otherwise.\n\n*Renamed in version 3.0, it was previously known as `jerry_arraybuffer_allocate_t` in earlier versions.*\n\n**See also**\n\n- [jerry_arraybuffer_allocator](#jerry_arraybuffer_allocator)\n\n## jerry_arraybuffer_free_cb_t\n\n**Summary**\n\nCallback for freeing the backing store of array buffer or shared array buffer objects.\n\n*Note*:\n- The value passed to `arraybuffer_user_p` is always NULL unless the buffer is created by\n  [jerry_arraybuffer_external](#jerry_arraybuffer_external) or\n  [jerry_shared_arraybuffer_external](#jerry_shared_arraybuffer_external),\n  or the value is modified by [jerry_arraybuffer_allocate_cb_t](#jerry_arraybuffer_allocate_cb_t).\n\n**Prototype**\n\n```c\ntypedef void (*jerry_arraybuffer_free_cb_t) (jerry_arraybuffer_type_t buffer_type,\n                                             uint8_t *buffer_p,\n                                             uint32_t buffer_size,\n                                             void *arraybuffer_user_p,\n                                             void *user_p);\n```\n\n- `buffer_type` - type of the array buffer object, see: [jerry_arraybuffer_type_t](#jerry_arraybuffer_type_t).\n- `buffer_p` - pointer to the allocated buffer.\n- `buffer_size` - size of the allocated buffer.\n- `arraybuffer_user_p` - [in/out] user pointer assigned to the array buffer or shared array buffer object.\n- `user_p` - user pointer passed to [jerry_arraybuffer_allocator](#jerry_arraybuffer_allocator)\n\n*Renamed in version 3.0, it was previously known as `jerry_arraybuffer_free_t` in earlier versions.*\n\n**See also**\n\n- [jerry_arraybuffer_allocator](#jerry_arraybuffer_allocator)\n\n\n# General engine functions\n\n## jerry_init\n\n**Summary**\n\nInitializes the JerryScript engine, making it possible to run JavaScript code and perform operations\non JavaScript values. This is required for almost all API functions.\n\n**Prototype**\n\n```c\nvoid\njerry_init (jerry_init_flag_t flags)\n```\n\n`flags` - combination of various engine configuration flags [jerry_init_flag_t](#jerry_init_flag_t).\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_SHOW_OPCODES | JERRY_INIT_SHOW_REGEXP_OPCODES);\n\n  // ...\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_init_flag_t](#jerry_init_flag_t)\n- [jerry_cleanup](#jerry_cleanup)\n\n\n## jerry_cleanup\n\n**Summary**\n\nFinish JavaScript engine execution, freeing memory and JavaScript values.\n\n*Note*:\n- JavaScript values, received from engine, will be inaccessible after the cleanup.\n\n**Prototype**\n\n```c\nvoid\njerry_cleanup (void);\n```\n\n**See also**\n\n- [jerry_init](#jerry_init)\n\n\n## jerry_context_data\n\n**Summary**\n\nRetrieve a pointer to the item stored within the current context by the given manager.\n\n*Note*:\n- Since internally the pointer to a manager's context data item is linked to the next\n  such pointer in a linked list, it is inadvisable to invoke too many different managers,\n  because doing so will increase the time it takes to retrieve a manager's context data\n  item, degrading performance. For example, try to keep the number of managers below five.\n\n**Prototype**\n\n```c\nvoid *\njerry_context_data (const jerry_context_data_manager *manager_p);\n```\n\n- `manager_p`: the manager of this context data item.\n- return value: the item created by `manager_p` when `jerry_context_data ()` was first called, or a new item created\n  by `manager_p`, which will be stored for future identical calls to `jerry_context_data ()`, and which will be\n  deinitialized using the `deinit_cb` callback provided by `manager_p` when the context will be destroyed.\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_context_data` in earlier versions.*\n\n**Example**\n\n[doctest]: # (test=\"compile\")\n\n```c\n#include \"jerryscript.h\"\n\ntypedef struct\n{\n  int my_data1;\n  double my_data2;\n  char *my_data3;\n} my_context_data_t;\n\n/* Define how context items will be initialized. */\nstatic void\nmy_context_data_new (void *user_data_p)\n{\n  my_context_data_t *my_data_p = (my_context_data_t *) user_data_p;\n\n  /*\n   * Initialize my_data_p. JerryScript will store it on the current context and return it whenever\n   * jerry_context_data () is called with a pointer to my_manager as defined below.\n   */\n}\n\n/* Define how context items will be deinitialized */\nstatic void\nmy_context_data_free (void *user_data_p)\n{\n  my_context_data_t *my_data_p = ((my_context_data_t *) user_data_p);\n\n  /* Perform any necessary cleanup on my_data. JerryScript will free the pointer after this function completes. */\n}\n\n/* Wrap the creation and destruction functions into a manager */\nstatic const jerry_context_data_manager_t my_manager =\n{\n  .init_cb = my_context_data_new,\n  .deinit_cb = my_context_data_free,\n  .bytes_needed = sizeof (my_context_data_t)\n};\n\n/*\n * Then, in some function in your code, you can retrieve an item of type my_context_data_t from the currently active\n * context such that JerryScript will create and store such an item if one was not previously created\n */\nstatic void\nsomeplace_in_the_code (void)\n{\n  my_context_data_t *my_data = (my_context_data_t *) jerry_context_data (&my_manager);\n  /* Perform useful things using the data found in my_data */\n}\n```\n\n\n## jerry_register_magic_strings\n\n**Summary**\n\nRegisters an external magic string array.\n\n*Note*:\n- The strings in the array must be sorted by size at first, then lexicographically.\n- The maximum number of external magic strings is limited to 2147483648 (UINT32_MAX / 2).\n  If there are more than 2147483648 external magic strings the extra is cropped.\n\n**Prototype**\n\n```c\nvoid\njerry_register_magic_strings (const jerry_char_t * const *ex_str_items_p,\n                              uint32_t count,\n                              const jerry_length_t *str_lengths_p);\n```\n\n- `ex_str_items_p` - character arrays, representing external magic strings' contents\n- `count` - number of elements in `ext_str_items_p` array\n- `str_lengths_p` - array of lengths for each magic string\n\n*Updated in version 2.0*: The first function argument type was changed.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  // must be static, because 'jerry_register_magic_strings' does not copy\n  // the items must be sorted by size at first, then lexicographically\n  static const jerry_char_t * const magic_string_items[] = {\n                                                             (const jerry_char_t *) \"magicstring1\",\n                                                             (const jerry_char_t *) \"magicstring2\",\n                                                             (const jerry_char_t *) \"magicstring3\"\n                                                           };\n  uint32_t num_magic_string_items = (uint32_t) (sizeof (magic_string_items) / sizeof (jerry_char_t *));\n\n  // must be static, because 'jerry_register_magic_strings' does not copy\n  static const jerry_length_t magic_string_lengths[] = {\n                                                         12,\n                                                         12,\n                                                         12\n                                                       };\n  jerry_register_magic_strings (magic_string_items, num_magic_string_items, magic_string_lengths);\n}\n```\n\n**See also**\n\n- [jerry_init](#jerry_init)\n- [jerry_cleanup](#jerry_cleanup)\n- [jerry_get_literals_from_snapshot](#jerry_get_literals_from_snapshot)\n\n\n## jerry_heap_stats\n\n**Summary**\n\nGet heap memory stats.\n\n*Note*:\n- The engine must be initialized with the `JERRY_INIT_MEM_STATS` option to allow\n  heap statistic collections. See [jerry_init](#jerry_init)\n- This API depends on a build option (`JERRY_MEM_STATS`) and can be checked\n  in runtime with the `JERRY_FEATURE_HEAP_STATS` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\nbool\njerry_heap_stats (jerry_heap_stats_t *out_stats_p);\n```\n\n- `out_stats_p` - out parameter, that provides the heap statistics.\n- return value\n  - true, if stats were written into the `out_stats_p` pointer.\n  - false, otherwise. Usually it is because the `JERRY_FEATURE_HEAP_STATS` feature is not enabled.\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_memory_stats` in earlier versions.*\n\n**Example**\n\n```c\njerry_init (JERRY_INIT_MEM_STATS);\n// ...\n\njerry_heap_stats_t stats = {0};\nbool get_stats_ret = jerry_heap_stats (&stats);\n```\n\n**See also**\n\n- [jerry_init](#jerry_init)\n\n\n## jerry_heap_gc\n\n**Summary**\n\nPerforms garbage collection.\n\n**Prototype**\n\n```c\nvoid\njerry_heap_gc (jerry_gc_mode_t mode);\n```\n\n- `mode` - operational mode, see [jerry_gc_mode_t](#jerry_gc_mode_t)\n\n*Updated in version 2.0*: Added `mode` argument.\n\n*Renamed in version 3.0, it was previously known as `jerry_gc` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t object_value = jerry_object ();\n  jerry_value_free (object_value);\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n\n  jerry_cleanup ();\n}\n```\n\n**See also**\n\n- [jerry_gc_mode_t](#jerry_gc_mode_t)\n- [jerry_init](#jerry_init)\n- [jerry_cleanup](#jerry_cleanup)\n\n# Parser and executor functions\n\nFunctions to parse and run JavaScript source code.\n\n## jerry_parse\n\n**Summary**\n\nParse a script, module, or function and create a compiled code using a character string.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_parse (const jerry_char_t *source_p,\n             size_t source_size,\n             const jerry_parse_options_t *options_p);\n```\n\n- `source_p` - string, containing source code to parse (must be a valid UTF8 string).\n- `source_size` - size of the string, in bytes.\n- `options_p` - additional parsing options, can be NULL if not used\n- return value\n  - function object value, if script was parsed successfully,\n  - thrown exception, otherwise\n\n*Updated in version 2.0*: Added `source_name_p`, and `source_name_length` arguments.\n\n*Updated in version 3.0*: The `source_name_p`, `source_name_length`, and `parse_opts` arguments are replaced by `options_p`.\n                                       This function replaces the `jerry_parse_function` method.\n\n**Example 1**\n\n[doctest]: # (name=\"02.API-REFERENCE-parse-simple.c\")\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Parsing a script. */\n  const jerry_char_t script[] = \"print ('Hello, World!');\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_STRICT_MODE | JERRY_PARSE_HAS_SOURCE_NAME | JERRY_PARSE_HAS_START;\n  parse_options.source_name = jerry_string_sz (\"hello.js\");\n  /* This example script is extracted from the middle of a file. */\n  parse_options.start_line = 10;\n  parse_options.start_column = 1;\n\n  jerry_value_t parsed_code = jerry_parse (script, sizeof (script) - 1, &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  /* Run the \"parsed_code\" script with \"jerry_run\". */\n\n  jerry_value_free (jerry_run (parsed_code));\n  jerry_value_free (parsed_code);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**Example - function parsing**\n\n[doctest]: # (name=\"02.API-REFERENCE-parse-function.c\")\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Specify the argument list to parse a function. */\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_ARGUMENT_LIST;\n  parse_options.argument_list = jerry_string_sz (\"a, b\");\n\n  const jerry_char_t function_code[] = \"return a + b;\";\n  jerry_value_t parsed_function = jerry_parse (function_code, sizeof (function_code) - 1, &parse_options);\n  jerry_value_free (parse_options.argument_list);\n\n  /* Use the \"parsed_function\" as a normal JavaScript function. */\n\n  jerry_value_t args[] = {\n    jerry_number (3),\n    jerry_number (4),\n  };\n  jerry_size_t argc = sizeof (args) / sizeof (args[0]);\n  jerry_value_t call_result = jerry_call (parsed_function,\n                                          jerry_undefined(),\n                                          args,\n                                          argc);\n\n  /* use the function result */\n  jerry_value_free (call_result);\n  jerry_value_free (parsed_function);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_parse_value](#jerry_parse_value)\n- [jerry_run](#jerry_run)\n- [jerry_parse_options_t](#jerry_parse_options_t)\n\n## jerry_parse_value\n\n**Summary**\n\nParse a script, module, or function and create a compiled code using a string value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_parse_value (const jerry_value_t source_value,\n                   const jerry_parse_options_t *options_p);\n```\n\n- `source_value` - string value, containing source code to parse (only string values are accepted).\n- `options_p` - additional parsing options, can be NULL if not used\n- return value\n  - function object value, if script was parsed successfully,\n  - thrown exception, otherwise\n\n*Introduced in version 3.0*.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t script_value = jerry_string_sz (\"print ('Hello, World!');\");\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_STRICT_MODE | JERRY_PARSE_HAS_SOURCE_NAME | JERRY_PARSE_HAS_START;\n  parse_options.source_name = jerry_string_sz (\"hello.js\");\n  /* This example script is extracted from the middle of a file. */\n  parse_options.start_line = 10;\n  parse_options.start_column = 1;\n\n  jerry_value_t parsed_code = jerry_parse_value (script_value, &parse_options);\n  jerry_value_free (parse_options.source_name);\n  jerry_value_free (script_value);\n  jerry_value_free (parsed_code);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_parse](#jerry_parse)\n- [jerry_run](#jerry_run)\n- [jerry_parse_options_t](#jerry_parse_options_t)\n\n## jerry_run\n\n**Summary**\n\nRun a Script or Module created by [jerry_parse](#jerry_parse).\n\n*Note*:\n- The code should be previously parsed with `jerry_parse`.\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_run (const jerry_value_t func_val);\n```\n\n- `func_val` - function to run\n- return value\n  - result of bytecode, if run was successful\n  - thrown exception, otherwise\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  const jerry_char_t script[] = \"print ('Hello, World!');\";\n\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Setup Global scope code */\n  jerry_value_t parsed_code = jerry_parse (script, sizeof (script) - 1, NULL);\n\n  if (!jerry_value_is_exception (parsed_code))\n  {\n    /* Execute the parsed source code in the Global scope */\n    jerry_value_t ret_value = jerry_run (parsed_code);\n\n    /* Returned value must be freed */\n    jerry_value_free (ret_value);\n  }\n\n  /* Parsed source code must be freed */\n  jerry_value_free (parsed_code);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n}\n```\n\n**See also**\n\n- [jerry_parse](#jerry_parse)\n\n\n## jerry_eval\n\n**Summary**\n\nPerform JavaScript `eval` function call (ECMA-262 v5.1 sec-15.1.2.1).\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_eval (const jerry_char_t *source_p,\n            size_t source_size,\n            uint32_t parse_opts);\n```\n\n- `source_p` - source code to evaluate, it must be a valid utf8 string.\n- `source_size` - length of the source code\n- `parse_opts` - combination of [jerry_parse_option_enable_feature_t](#jerry_parse_option_enable_feature_t) flags.\n                 The following flags are allowed: JERRY_PARSE_STRICT_MODE\n- return value - result of eval, may be an exception value.\n\n**Example**\n\n```c\n{\n  jerry_value_t ret_val = jerry_eval (str_to_eval,\n                                      strlen (str_to_eval),\n                                      JERRY_PARSE_NO_OPTS);\n}\n```\n\n**See also**\n\n- [jerry_function_external](#jerry_function_external)\n- [jerry_external_handler_t](#jerry_external_handler_t)\n\n## jerry_run_jobs\n\n**Summary**\n\nRun enqueued Promise tasks until the first thrown exception or until all tasks get executed.\n\n*Important Note*: The task queue is not guaranteed to be empty after the function call has returned a value.\nTherefore, this function is best used in a while loop, handling each exception it returns, until the queue is empty.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_run_jobs (void)\n```\n\n- return value - result of last executed job, may be an exception value.\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_run_all_enqueued_jobs` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"new Promise(function(f,r) { f('Hello, World!'); }).then(function(x) { print(x); });\";\n\n  jerry_value_t parsed_code = jerry_parse (script, sizeof (script) - 1, NULL);\n  jerry_value_t script_value = jerry_run (parsed_code);\n\n  jerry_value_t job_value;\n  while (true)\n  {\n    job_value = jerry_run_jobs ();\n\n    if (jerry_value_is_exception (job_value))\n    {\n      if (jerry_value_is_abort (job_value))\n      {\n        // Terminate the engine\n      }\n\n      // Handle the exception here\n    }\n    else\n    {\n      // The queue should be empty now\n      break;\n    }\n  }\n\n  jerry_value_free (job_value);\n  jerry_value_free (script_value);\n  jerry_value_free (parsed_code);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n\n# Get the global context\n\n## jerry_current_realm\n\n**Summary**\n\nGet the Global object.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_current_realm (void);\n```\n\n- return value - api value of global object\n\n*Renamed in version 3.0, it was previously known as `jerry_get_global_object` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t glob_obj_val = jerry_current_realm ();\n\n  ... // Do something with global object, ex: add properties\n\n  jerry_value_free (glob_obj_val);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_object_define_own_prop](#jerry_object_define_own_prop)\n\n\n# Checker functions\n\nFunctions to check the type of an API value ([jerry_value_t](#jerry_value_t)).\n\n## jerry_value_is_abort\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is an abort exception value.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_abort (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is an abort exception\n  - false, otherwise\n\n*Introduced in version 2.0*.\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_abort (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_t](#jerry_value_t)\n- [jerry_value_is_exception](#jerry_value_is_exception)\n\n## jerry_value_is_array\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is an array.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_array (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is an array\n  - false, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_array (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n## jerry_value_is_arraybuffer\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is an ArrayBuffer object.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\n  in runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nbool\njerry_value_is_arraybuffer (const jerry_value_t value)\n```\n\n- `value` - api value to check.\n- return value\n  - true, if the given `jerry_value_t` is an ArrayBuffer object.\n  - false, otherwise\n\n*Introduced in version 2.0*.\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_arraybuffer (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer](#jerry_arraybuffer)\n- [jerry_arraybuffer_external](#jerry_arraybuffer_external)\n\n## jerry_value_is_shared_arraybuffer\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a SharedArrayBuffer object.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\n  in runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nbool\njerry_value_is_shared_arraybuffer (const jerry_value_t value);\n```\n\n- `value` - api value to check.\n- return value\n    - true, if the given `jerry_value_t` is a SharedArrayBuffer object.\n    - false, otherwise\n\n*Introduced in version 3.0*.\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_shared_arraybuffer (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_shared_arraybuffer](#jerry_shared_arraybuffer)\n- [jerry_shared_arraybuffer_external](#jerry_shared_arraybuffer_external)\n\n\n## jerry_value_is_boolean\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a boolean value.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_boolean (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is a boolean value\n  - false, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_boolean (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n## jerry_value_is_true\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a true value.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_true (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value\n    - true, if the given `jerry_value_t` is true value\n    - false, otherwise\n\n*Introduced in version 3.0*. Replaces the `jerry_get_boolean_value` method.\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_true (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n## jerry_value_is_false\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a false value.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_false (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value\n    - true, if the given `jerry_value_t` is false value\n    - false, otherwise\n\n*Introduced in version 3.0*.\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_false (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n## jerry_value_is_constructor\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a constructor function.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_constructor (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is a constructor\n  - false, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_constructor (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n## jerry_value_is_dataview\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a DataView object value.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_DATAVIEW`) and can be checked\n  in runtime with the `JERRY_FEATURE_DATAVIEW` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nbool\njerry_value_is_dataview (const jerry_value_t value)\n```\n\n- `value` - API value\n- return value\n  - true, if the given `jerry_value_t` is a DataView object\n  - false, otherwise\n\n*Introduced in version 2.0*.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t arraybuffer = jerry_arraybuffer (16);\n  jerry_value_t dataview = jerry_dataview (arraybuffer, 0, 16);\n\n  if (jerry_value_is_dataview (dataview))\n  {\n    // usage of dataview\n  }\n\n  jerry_value_free (dataview);\n  jerry_value_free (arraybuffer);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_dataview](#jerry_dataview)\n\n\n## jerry_value_is_exception\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is an exception value.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_exception (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is an exception value.\n  - false, otherwise\n\n*Renamed in version 3.0 from `jerry_value_is_error` to `jerry_value_is_exception`*.\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_exception (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_t](#jerry_value_t)\n- [jerry_value_is_abort](#jerry_value_is_abort)\n\n## jerry_value_is_function\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a function.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_function (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is a function\n  - false, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_function (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_value_is_async_function\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is an async function.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_async_function (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is an async function\n  - false, otherwise\n\n*Introduced in version 2.4*.\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_async_function (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n## jerry_value_is_number\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a number.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_number (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is a number\n  - false, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_number (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_value_is_null\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a null value.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_null (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is a null\n  - false, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_null (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_value_is_object\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is an object value.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_object (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is an object\n  - false, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_object (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_value_is_promise\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a promise value.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_promise (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is a promise\n  - false, otherwise\n\n*Introduced in version 2.0*.\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_promise (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_promise](#jerry_promise)\n\n\n## jerry_value_is_proxy\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a proxy value.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_PROXY`) and can be checked\n  in runtime with the `JERRY_FEATURE_PROXY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\nbool\njerry_value_is_proxy (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is a proxy object\n  - false, otherwise\n\n*Introduced in version 2.3*.\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_proxy (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_proxy](#jerry_proxy)\n- [jerry_proxy_custom](#jerry_proxy_custom)\n\n\n## jerry_value_is_string\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a string value.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_string (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is a string\n  - false, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_string (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_value_is_symbol\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a symbol value.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_symbol (const jerry_value_t value)\n```\n\n- `value` - API value\n- return value\n  - true, if the given `jerry_value_t` is a symbol\n  - false, otherwise\n\n*Introduced in version 2.0*.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t string_value = jerry_string_sz (\"Symbol description string\");\n  jerry_value_t symbol_value = jerry_symbol_with_description (string_value);\n\n  jerry_value_free (string_value);\n\n  if (jerry_value_is_symbol (symbol_value))\n  {\n    // usage of symbol_value\n  }\n\n  jerry_value_free (symbol_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_symbol](#jerry_symbol)\n\n\n## jerry_value_is_bigint\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is a bigint value.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_BIGINT`) and can be checked\n  in runtime with the `JERRY_FEATURE_BIGINT` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nbool\njerry_value_is_bigint (const jerry_value_t value)\n```\n\n- `value` - API value\n- return value\n  - true, if the given `jerry_value_t` is a BigInt\n  - false, otherwise\n\n*Introduced in version 2.4*.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t string_value = jerry_string_sz (\"12345678\");\n  jerry_value_t bigint_value = jerry_value_to_bigint (string_value);\n\n  jerry_value_free (string_value);\n\n  if (jerry_value_is_bigint (bigint_value))\n  {\n    // usage of bigint_value\n  }\n\n  jerry_value_free (bigint_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_bigint](#jerry_bigint)\n- [jerry_value_to_bigint](#jerry_value_to_bigint)\n\n\n## jerry_value_is_typedarray\n\n**Summary**\n\nChecks whether the given `jerry_value_t` is a TypedArray object or not.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\n  in runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nbool\njerry_value_is_typedarray (const jerry_value_t value)\n```\n\n- `value` - object to check\n- return value\n  - true, if the given `jerry_value_t` is a TypedArray object.\n  - false, otherwise\n\n*Introduced in version 2.0*.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t value = jerry_typedarray (JERRY_TYPEDARRAY_UINT16, 15);\n\n  if (jerry_value_is_typedarray (value))\n  {\n    /* \"value\" is a typedarray. */\n  }\n\n  jerry_value_free (value);\n\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_typedarray](#jerry_typedarray)\n\n\n## jerry_container_type\n\n**Summary**\n\nChecks whether the given `jerry_value_t` is the given `jerry_container_type_t` type container object.\n\n*Note*:\n- This API function depends on a build option (`JERRY_BUILTIN_CONTAINER`) and can be checked\n  runtime with the `JERRY_FEATURE_MAP, JERRY_FEATURE_SET, JERRY_FEATURE_WEAKMAP, JERRY_FEATURE_WEAKSET`\n  feature enum values.\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_container_type_t\njerry_container_type (const jerry_value_t value)\n```\n\n- `value` - Container object\n- return value\n  - The corresponding enum value of `jerry_container_type_t`, or `JERRY_CONTAINER_TYPE_INVALID` if the container\n    was not a valid container object.\n\n*Introduced in version 2.3*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_container_type` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t value = jerry_container (JERRY_CONTAINER_TYPE_MAP, NULL, 0);\n\n  if (jerry_container_type (value) == JERRY_CONTAINER_TYPE_MAP)\n  {\n    /* \"value\" is a map. */\n  }\n\n  jerry_value_free (value);\n\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_container](#jerry_container)\n- [jerry_container_type_t](#jerry_container_type_t)\n\n\n## jerry_value_is_undefined\n\n**Summary**\n\nReturns whether the given `jerry_value_t` is an undefined value.\n\n**Prototype**\n\n```c\nbool\njerry_value_is_undefined (const jerry_value_t value)\n```\n\n- `value` - api value\n- return value\n  - true, if the given `jerry_value_t` is an undefined value\n  - false, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_undefined (value))\n  {\n    ...\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n## jerry_value_type\n\n**Summary**\n\nReturns the JavaScript type\nfor a given value as a [jerry_type_t](#jerry_type_t) enum value.\n\nThis is a similar operation to the 'typeof' operator\nin the standard with an exception that the 'null'\nvalue has its own enum value.\n\n**Prototype**\n\n```c\njerry_type_t\njerry_value_type (const jerry_value_t value);\n```\n\n- `value` - JavaScript value to check.\n- return value\n  - One of the [jerry_type_t](#jerry_type_t) value.\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_value_get_type` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t number = jerry_number (3.3);\n\n  jerry_type_t type_info = jerry_value_type (number);\n\n  if (type_info == JERRY_TYPE_NUMBER)\n  {\n    /* ... */\n  }\n\n  jerry_value_free (number);\n}\n```\n\n**See also**\n\n- [jerry_type_t](#jerry_type_t)\n\n## jerry_object_type\n\n**Summary**\n\nReturns the **object** type\nfor a given value as a [jerry_object_type_t](#jerry_object_type_t) enum value.\n\nNote: For non-object parameters `JERRY_OBJECT_TYPE_NONE` is returned.\nNote: the returned type can be checked for more detailed type information in the following cases:\n  - `JERRY_OBJECT_TYPE_CONTAINER`, *see also:* [jerry_container_get_type](#jerry_container_get_type)\n  - `JERRY_OBJECT_TYPE_FUNCTION`, *see also:* [jerry_function_type](#jerry_function_type)\n  - `JERRY_OBJECT_TYPE_ITERATOR`, *see also:* [jerry_iterator_type](#jerry_iterator_type)\n  - `JERRY_OBJECT_TYPE_TYPEDARRAY`, *see also:* [jerry_typedarray_type](#jerry_typedarray_type)\n\n**Prototype**\n\n```c\njerry_object_type_t\njerry_object_type (const jerry_value_t value);\n```\n\n- `value` - JavaScript value to check.\n- return value\n  - One of the [jerry_object_type_t](#jerry_object_type_t) value.\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_object_get_type` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t object = jerry_object ();\n\n  jerry_object_type_t object_type_info = jerry_object_type (object);\n\n  if (type_info == JERRY_OBJECT_TYPE_GENERIC)\n  {\n    /* ... */\n  }\n\n  jerry_value_free (object);\n}\n```\n\n**See also**\n\n- [jerry_object_type_t](#jerry_object_type_t)\n\n## jerry_function_type\n\n**Summary**\n\nReturns the **function** type\nfor a given value as a [jerry_function_type_t](#jerry_function_type_t) enum value.\n\n**Prototype**\n\n```c\njerry_function_type_t\njerry_function_type (const jerry_value_t value);\n```\n\n- `value` - JavaScript value to check.\n- return value\n  - One of the [jerry_function_type_t](#jerry_function_type_t) value.\n\nNote: For non-function parameters `JERRY_FUNCTION_TYPE_NONE` is returned.\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_function_get_type` in earlier versions.*\n\n**Example**\n\n```c\n{\n  const jerry_char_t script[] = \"function f() {}; f\";\n  jerry_value_t function_object = jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);\n\n  jerry_function_type_t function_type_info = jerry_function_type (function_object);\n\n  if (type_info == JERRY_FUNCTION_TYPE_GENERIC)\n  {\n    /* ... */\n  }\n\n  jerry_value_free (function_object);\n}\n```\n\n**See also**\n\n- [jerry_function_type_t](#jerry_function_type_t)\n\n## jerry_iterator_type\n\n**Summary**\n\nReturns the **iterator** type\nfor a given value as a [jerry_iterator_type_t](#jerry_iterator_type_t) enum value.\n\n**Prototype**\n\n```c\njerry_iterator_type_t\njerry_iterator_type (const jerry_value_t value);\n```\n\n- `value` - JavaScript value to check.\n- return value\n  - One of the [jerry_iterator_type_t](#jerry_iterator_type_t) value.\n\nNote: For non-iterator parameters `JERRY_ITERATOR_TYPE_NONE` is returned.\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_iterator_get_type` in earlier versions.*\n\n**Example**\n\n```c\n{\n  const jerry_char_t script[] = \"[1, 2, 3].values()\";\n  jerry_value_t iterator = jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);\n\n  jerry_iterator_type_t iterator_type_info = jerry_iterator_type (iterator);\n\n  if (type_info == JERRY_ITERATOR_TYPE_ARRAY)\n  {\n    /* ... */\n  }\n\n  jerry_value_free (iterator);\n}\n```\n\n**See also**\n\n- [jerry_iterator_type_t](#jerry_iterator_type_t)\n\n## jerry_feature_enabled\n\n**Summary**\n\nReturns whether the specified compile time feature is enabled.\n\n**Prototype**\n\n```c\nbool\njerry_feature_enabled (const jerry_feature_t feature);\n```\n\n- `feature` - jerry feature\n- return value\n  - true, if the given `jerry_feature_t` is enabled\n  - false, otherwise\n\n*Renamed in version 3.0 from `jerry_is_feature_enabled` to `jerry_feature_enabled`*.\n\n**Example**\n\n```c\n{\n  /* ... */\n  jerry_feature_t feature = JERRY_FEATURE_SNAPSHOT_SAVE;\n\n  if (jerry_feature_enabled (feature))\n  {\n    /* ... */\n  }\n\n}\n```\n\n**See also**\n\n- [jerry_feature_t](#jerry_feature_t)\n\n\n# Binary operations\n\n## jerry_binary_op\n\n**Summary**\n\nPerform binary operation on the given operands (==, ===, <, >, etc.).\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_binary_op (jerry_binary_op_t op,\n                 const jerry_value_t lhs,\n                 const jerry_value_t rhs);\n```\n\n- `op` - binary operation\n- `lhs` - left-hand side operand\n- `rhs` - right-hand side operand\n- return value\n  - exception, if operation is unsuccessful or unsupported\n  - the result of the binary operation on the given operands otherwise\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_binary_operation` in earlier versions.*\n\n**Example - JERRY_BIN_OP_EQUAL**\n\n```c\n{\n  jerry_value_t value1;\n  jerry_value_t value2;\n  ... // create or copy value\n  jerry_value_t result = jerry_binary_op (JERRY_BIN_OP_EQUAL, value1, value2)\n\n  if (!jerry_value_is_exception (result))\n  {\n    if (jerry_value_is_true (result))\n    {\n       // value1 and value2 are equal\n    }\n    else\n    {\n      // value1 and value2 are NOT equal\n    }\n  }\n  else\n  {\n    ... // handle error\n  }\n\n  jerry_value_free (value1);\n  jerry_value_free (value2);\n  jerry_value_free (result);\n}\n```\n\n**Example - JERRY_BIN_OP_INSTANCEOF**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nstatic jerry_value_t\nmy_constructor (const jerry_call_info_t *call_info_p,\n                const jerry_value_t argv[],\n                const jerry_length_t argc)\n{\n  return jerry_undefined ();\n}\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t base_obj = jerry_object ();\n  jerry_value_t constructor = jerry_function_external (my_constructor);\n\n  /* External functions does not have a prototype by default, so we need to create one */\n  jerry_value_t prototype_str = jerry_string_sz (\"prototype\");\n  jerry_value_free (jerry_object_set (constructor, prototype_str, base_obj));\n  jerry_value_free (prototype_str);\n\n  /* Construct the instance. */\n  jerry_value_t instance_val = jerry_construct (constructor, NULL, 0);\n\n  /* Call the API function of 'instanceof'. */\n  jerry_value_t is_instance = jerry_binary_op (JERRY_BIN_OP_INSTANCEOF,\n                                               instance_val,\n                                               constructor);\n  if (!jerry_value_is_exception (is_instance)\n      && jerry_value_is_true (is_instance))\n  {\n    /* ... */\n  }\n\n  /* Free all of the jerry values and cleanup the engine. */\n  jerry_value_free (base_obj);\n  jerry_value_free (constructor);\n  jerry_value_free (instance_val);\n  jerry_value_free (is_instance);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_binary_op_t](#jerry_binary_op_t)\n\n\n# Exception manipulation functions\n\n*Updated in version 2.0*: The exception handling and manipulation have been modified, and the old methods were replaced.\n\n## jerry_throw_abort\n\n**Summary**\n\nCreate (api) abort from a value.\n\nThis function creates an API abort value from an API value. The second argument defines\nwhether the input value must be released or not. If it is set to `true`,\nthen a [`jerry_value_free`](#jerry_value_free) function will be called\nfor the first argument, so the api value won't be available after the call of\n`jerry_throw_abort`. The second argument should be false if both value\nand created abort value are needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_throw_abort (jerry_value_t value, bool take_ownersip);\n```\n\n- `value` - api value\n- `take_ownership` - raw boolean, defines whether input value should be copied\n- return value - abort exception value\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_abort_from_value` in earlier versions.*\n\n**Example 1**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  jerry_value_t abort = jerry_throw_abort (value, true);\n  // using the 'value' variable after release is invalid.\n\n  jerry_value_free (abort);\n}\n```\n\n**Example 2**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  jerry_value_t abort = jerry_throw_abort (value, false);\n  // both 'abort' and 'value' can be used and must be released when they are no longer needed\n\n  jerry_value_free (abort);\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_t](#jerry_value_t)\n- [jerry_exception_value](#jerry_exception_value)\n- [jerry_throw](#jerry_throw)\n\n## jerry_throw\n\n**Summary**\n\nCreate exception from a value.\n\nThis function creates an API exception value from an API value. The second argument defines\nwhether the input value should be taken by the exception or copied. If it is set to `true`,\nthen then the ownership of the argument value is taken, so it won't be available after the call to\n`jerry_throw`. The second argument should be false if both the original value and created exception are needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_throw (jerry_value_t value, bool take_ownership);\n```\n\n- `value` - api value\n- `take_ownership` - raw boolean, defines whether input value should be copied\n- return value - exception value\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_value_from_error` in earlier versions.*\n\n**Example 1**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  jerry_value_t exception = jerry_throw (value, true);\n  // using the 'value' variable after release is invalid.\n\n\n  jerry_value_free (exception);\n}\n```\n\n**Example 2**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  jerry_value_t exception = jerry_throw_value (value, false);\n  // both 'exception' and 'value' can be used and must be released when they are no longer needed\n\n  jerry_value_free (exception);\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_t](#jerry_value_t)\n- [jerry_exception_value](#jerry_exception_value)\n- [jerry_throw_abort](#jerry_throw_abort)\n\n## jerry_error_type\n\n**Summary**\n\nReturns the type of the Error object if possible. If a non-error object is used as the input for the function the\nmethod will return `JERRY_ERROR_NONE` indicating that the value was not an Error object.\n\nNote: If an exception value is passed as an argument, the function will inspect the contained value instead.\n\n**Prototype**\n\n```c\njerry_error_t\njerry_error_type (const jerry_value_t value);\n```\n\n- `value` - api value (possible exception object)\n- return value\n  - JERRY_ERROR_NONE if the input is not an error object\n  - one of the [jerry_error_t](#jerry_error_t) value\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_error_type` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t error_obj = jerry_error_sz (JERRY_ERROR_RANGE, \"error msg\");\n  jerry_error_t error_type = jerry_error_type (error_obj);\n\n  // error_type is now JERRY_ERROR_RANGE.\n\n  jerry_value_free (error_obj);\n}\n```\n\n**See also**\n\n- [jerry_error](#jerry_error)\n- [jerry_value_is_exception](#jerry_value_is_exception)\n\n## jerry_exception_value\n\n**Summary**\n\nGet the value contained in an exception.\n\nMany API functions cannot be called with an exception value.\nThis function extracts the API value from an exception. The second argument defines\nwhether the input exception value should be released or not. If it is set to `true`,\nthen a [`jerry_value_free`](#jerry_value_free) function will be called\nfor the first argument, so the exception value won't be available after the call of\n`jerry_exception_value`. The second argument should be false if both the exception\nand its contained value are needed.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_exception_value (jerry_value_t value, bool release)\n```\n\n- `value` - exception value\n- `release` - raw boolean, defines whether input value must be released\n- return value - api value\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_error_from_value` in earlier versions.*\n\n**Example 1**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  jerry_value_t exception = jerry_throw_value (value, true);\n  jerry_value_t value_from_error = jerry_exception_value (exception, true);\n  // using the 'exception' variable after release is invalid.\n\n  jerry_value_free (value_from_error);\n}\n```\n\n**Example 2**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  jerry_value_t exception = jerry_throw_value (value, true);\n  jerry_value_t value_from_error = jerry_exception_value (exception, false);\n  // both 'exception' and 'value_from_error' can be used and must be released when they are no longer needed\n\n  jerry_value_free (value_from_error);\n  jerry_value_free (exception);\n}\n```\n\n**See also**\n\n- [jerry_value_t](#jerry_value_t)\n- [jerry_throw](#jerry_throw)\n- [jerry_throw_abort](#jerry_throw_abort)\n\n## jerry_error_on_created\n\n**Summary**\n\nSet the decorator callback for newly created Error objects. The operation of the callback\nis described in [jerry_error_object_created_cb_t](#jerry_error_object_created_cb_t).\n\n**Prototype**\n\n```c\nvoid jerry_error_on_created (jerry_error_object_created_cb_t callback, void *user_p);\n```\n\n- `callback` - callback function, the previously set value is overwritten, and setting NULL\n               disables the operation\n- `user_p` - pointer passed to the callback function, can be NULL\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_set_error_object_created_callback` in earlier versions.*\n\n**Example**\n\n```c\nstatic void\nerror_object_created_callback (const jerry_value_t error_object) /**< new error object */\n                               void *user_p) /**< user pointer */\n{\n  (void) error_object;\n  (void) user_p;\n  printf (\"Notification: a new error is created\\n\");\n} /* error_object_created_callback */\n\nvoid main(void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_error_on_created (error_object_created_callback, NULL);\n\n  jerry_value_free (jerry_error_sz (JERRY_ERROR_COMMON, \"Message\"));\n\n  jerry_cleanup ();\n} /* main */\n```\n\n**See also**\n\n- [jerry_error_object_created_cb_t](#jerry_error_object_created_cb_t)\n\n## jerry_on_throw\n\n**Summary**\n\nThe callback passed to this function is called when an exception is thrown\nin ECMAScript code. The callback is not called again until the value is\ncaught. See: [jerry_throw_cb_t](#jerry_throw_cb_t).\n\n*Note*:\n- This API depends on a build option (`JERRY_VM_THROW`) and can be checked\n  in runtime with the `JERRY_FEATURE_VM_THROW` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nvoid\njerry_on_throw (jerry_throw_cb_t throw_cb,\n                void *user_p);\n```\n\n- `throw_cb` - callback which is called on throws (passing NULL disables this feature)\n- `user_p` - user pointer passed to the `throw_cb` function\n\n*Renamed in version 3.0, it was previously known as `jerry_set_vm_throw_callback` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nstatic void\nvm_throw_callback (const jerry_value_t error_value, /**< captured exception */\n                   void *user_p) /**< user pointer */\n{\n  (void) error_value;\n\n  /* Counts the number of throws. */\n  int *counter_p = (int *) user_p;\n  (*counter_p)++;\n}\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  int counter = 0;\n  jerry_on_throw (vm_throw_callback, &counter);\n\n  const jerry_char_t script[] = \"try { throw new Error('1') } catch (e) { throw new Error('2') }\";\n\n  jerry_value_free (jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS));\n\n  /* The counter contains 2. */\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_throw_cb_t](#jerry_throw_cb_t)\n- [jerry_exception_is_captured](#jerry_exception_is_captured)\n- [jerry_exception_allow_capture](#jerry_exception_allow_capture)\n\n\n## jerry_exception_is_captured\n\n**Summary**\n\nChecks whether the callback set by [jerry_on_throw](#jerry_on_throw)\ncaptured the exception.\n\n*Note*:\n- This API depends on a build option (`JERRY_VM_THROW`) and can be checked\n  in runtime with the `JERRY_FEATURE_VM_THROW` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nbool jerry_exception_is_captured (jerry_value_t value);\n```\n\n- `value` - api value (should be an exception)\n- return value\n  - true, if the vm throw callback captured the exception\n  - false, otherwise\n\n*Renamed in version 3.0 from `jerry_error_is_throw_captured` to `jerry_exception_is_captured`*.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nstatic void\nvm_throw_callback (const jerry_value_t error_value, /**< captured exception */\n                   void *user_p) /**< user pointer */\n{\n  (void) error_value;\n  (void) user_p;\n}\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  int counter = 0;\n  jerry_on_throw (vm_throw_callback, &counter);\n\n  const jerry_char_t script[] = \"throw new Error()\";\n  jerry_value_t result_value = jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);\n\n  if (jerry_exception_is_captured (result_value))\n  {\n    /* Code enters here, because the vm_throw_callback function is called. */\n  }\n\n  jerry_value_free (result_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_on_throw](#jerry_on_throw)\n- [jerry_exception_allow_capture](#jerry_exception_allow_capture)\n\n## jerry_exception_allow_capture\n\n**Summary**\n\nSets whether the callback set by [jerry_on_throw](#jerry_on_throw)\nshould capture the exception or not.\n\n*Note*:\n- This API depends on a build option (`JERRY_VM_THROW`) and can be checked\n  in runtime with the `JERRY_FEATURE_VM_THROW` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nvoid jerry_exception_allow_capture (jerry_value_t value, bool should_capture);\n```\n\n- `value` - api value (should be an exception)\n- `should_capture` - callback should capture this error\n\n*Renamed in version 3.0, it was previously known as `jerry_error_set_throw_capture` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nstatic void\nvm_throw_callback (const jerry_value_t error_value, /**< captured exception */\n                   void *user_p) /**< user pointer */\n{\n  (void) error_value;\n  (void) user_p;\n}\n\nstatic jerry_value_t\nthrow_exception (const jerry_call_info_t *call_info_p, /**< call info */\n                 const jerry_value_t argv[], /**< argument list */\n                 const jerry_length_t argc) /**< argument count */\n{\n  (void) call_info_p;\n  (void) argv;\n  (void) argc;\n\n  jerry_value_t result_value = jerry_throw_sz (JERRY_ERROR_COMMON, \"Error!\");\n\n  /* Ignore calling the vm_throw_callback function. */\n  jerry_exception_allow_capture (result_value, false);\n  return result_value;\n}\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  int counter = 0;\n  jerry_on_throw (vm_throw_callback, &counter);\n\n  jerry_value_t global_object_value = jerry_current_realm ();\n  jerry_value_t function_value = jerry_function_external (throw_exception);\n  jerry_value_t function_name_value = jerry_string_sz (\"throw_exception\");\n\n  jerry_value_free (jerry_object_set (global_object_value, function_name_value, function_value));\n  jerry_value_free (function_name_value);\n  jerry_value_free (function_value);\n  jerry_value_free (global_object_value);\n\n  const jerry_char_t script[] = \"throw_exception()\";\n  jerry_value_free (jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS));\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_on_throw](#jerry_on_throw)\n- [jerry_exception_is_captured](#jerry_exception_is_captured)\n\n\n# Getter functions of 'jerry_value_t'\n\nGet raw data from API values.\n\n## jerry_value_as_number\n\n**Summary**\n\nGets the number value of the given `jerry_value_t` parameter as a raw double.\n\nIf the argument passed is not a number `0.0` will be returned.\n\n**Prototype**\n\n```c\ndouble\njerry_value_as_number (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value\n  - the number value of the given `jerry_value_t` parameter as a raw double.\n  - `0.0` if the api value passed is not a number.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_number_value` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  if (jerry_value_is_number (value))\n  {\n    double raw_value = jerry_value_as_number (value);\n\n    ... // usage of raw value\n\n  }\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_is_number](#jerry_value_is_number)\n- [jerry_value_free](#jerry_value_free)\n\n\n# Functions for string values\n\n## jerry_string_size\n\n**Summary**\n\nGet the size of a string. Returns zero, if the value parameter is not a string.\nThis is effectively the number of bytes required to store the string's characters.\n\n**Prototype**\n\n```c\njerry_size_t jerry_string_size (const jerry_value_t value, jerry_encoding_t encoding);\n```\n- `value` - api value\n- `encoding` - the requested [encoding](#jerry_encoding_t) for the string\n- return value - number of bytes in the buffer needed to represent the string.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_string_size` in earlier versions.*\n\n**Example**\n\n```c\n{\n  const char char_array[] = \"a string\";\n  jerry_value_t string = jerry_string_sz (char_array);\n\n  jerry_size_t string_size = jerry_string_size (string, JERRY_ENCODING_CESU8);\n\n  ... // usage of string_size\n\n  jerry_value_free (string);\n}\n```\n\n**See also**\n\n- [jerry_string_sz](#jerry_string_sz)\n- [jerry_string_length](#jerry_string_length)\n- [jerry_validate_string](#jerry_validate_string)\n\n\n## jerry_string_length\n\n**Summary**\n\nGet the length of a string. Returns zero, if the value parameter is not a string.\n\n*Note*:\n- The difference from [jerry_string_size](#jerry_string_size) is that it\n  returns the number of bytes used for the string.\n- This is **not** the number of bytes required to store the string.\n\n**Prototype**\n\n```c\njerry_length_t\njerry_string_length (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value - number of characters in the string\n\n*Renamed in version 3.0, it was previously known as `jerry_get_string_length` in earlier versions.*\n\n**Example**\n\n```c\n{\n  const char char_array[] = \"a string\";\n  jerry_value_t string = jerry_string_sz (char_array);\n\n  jerry_length_t string_length = jerry_string_length (string);\n\n  ... // usage of string_length\n\n  jerry_value_free (string);\n}\n```\n\n**See also**\n\n- [jerry_string_sz](#jerry_string_sz)\n- [jerry_string_size](#jerry_string_size)\n- [jerry_validate_string](#jerry_validate_string)\n\n\n## jerry_string_substr\n\n**Summary**\n\nCreate a substring of the input string value.\nReturn an empty string if input value is not a string.\n\n**Prototype**\n\n```c\njerry_size_t jerry_string_substr (const jerry_value_t value, jerry_length_t start, jerry_length_t end);\n```\n\n- `value` - the input string value\n- `start` - start position of the substring\n- `end` - end position of the substring\n- return value - created string\n\n*Introduced in version 3.0. There were `jerry_substring_to_char_buffer` and `jerry_substring_to_utf8_char_buffer` in previous versions with a similar functionality.\n\n**Example**\n\n```c\n{\n  jerry_value_t str = jerry_string_sz (\"Demo string\");\n\n  // Read the string into a byte buffer.\n  jerry_value_t sub_str = jerry_string_substr (str, 0, 3);\n\n  // usage of 'sub_str'\n\n  jerry_value_free (sub_str);\n  jerry_value_free (str);\n}\n```\n\n**See also**\n\n- [jerry_string_sz](#jerry_string_sz)\n\n\n## jerry_string_iterate\n\n**Summary**\n\nIterate over the input string value in the specified encoding, visiting each unit of the encoded string once. If the input value is not a string, the function will do nothing.\n\n\n**Prototype**\n\n```c\nvoid jerry_string_iterate (const jerry_value_t value,\n                           jerry_encoding_t encoding,\n                           jerry_string_iterate_cb_t callback,\n                           void *user_p);\n```\n\n- `value` - the input string value\n- `encoding` - the requested [encoding](#jerry_encoding_t) for the string\n- `callback` - callback function called for each byte of the encoded string, see [jerry_string_iterate_cb_t](#jerry_string_iterate_cb_t)\n- `user_p` - user pointer passed to the callback function\n\n*Introduced in version 3.0.*\n\n**Example**\n\n```c\nstatic void my_str_iterator_cb_func (uint32_t value, void *user_p)\n{\n  // usage of the encoded byte value and the user pointer (if non-null)\n}\n\n...\n\nvoid foo () {\n  jerry_value_t string = jerry_string_sz (\"Demo string\");\n\n  jerry_string_iterate (string, JERRY_ENCODING_UTF8, &jerryx_buffered_print, NULL);\n\n  jerry_value_free (string);\n}\n```\n\n**See also**\n\n- [jerry_string_sz](#jerry_string_sz)\n- [jerry_encoding_t](#jerry_encoding_t)\n- [jerry_string_iterate_cb_t](#jerry_string_iterate_cb_t)\n\n\n## jerry_string_to_buffer\n\n**Summary**\n\nCopy the characters of a string into a specified cesu-8 buffer.\nThe '\\0' character could occur in the character buffer. Returns 0,\nif the input value is not a string.\n\n*Note*:\n- Does not put '\\0' to the end of string, the return value identifies\n  the number of valid bytes in the output buffer.\n- If the size of the string is larger than the size of the\n  target buffer, the string will be cropped.\n\n**Prototype**\n\n```c\njerry_size_t\njerry_string_to_buffer (const jerry_value_t value,\n                        jerry_encoding_t encoding,\n                        jerry_char_t *buffer_p,\n                        jerry_size_t buffer_size);\n```\n\n- `value` - input string value\n- `encoding` - encoding oh the string data\n- `buffer_p` - pointer to output buffer\n- `buffer_size` - size of the buffer\n- return value - number of bytes copied to the buffer\n\n*Renamed in version 3.0, it was previously known as `jerry_string_to_char_buffer` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <stdio.h>\n#include <stdlib.h>\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t value;\n  // create or copy value\n  value = jerry_string_sz (\"Demo string\");\n\n  // Read the string into a byte buffer.\n  jerry_size_t string_size = jerry_string_size (value, JERRY_ENCODING_CESU8);\n  jerry_char_t *string_buffer_p = (jerry_char_t *) malloc (sizeof (jerry_char_t) * (string_size + 1));\n\n  jerry_size_t copied_bytes = jerry_string_to_buffer (value, JERRY_ENCODING_CESU8, string_buffer_p, string_size);\n  string_buffer_p[copied_bytes] = '\\0';\n\n  jerry_value_free (value);\n\n  jerry_cleanup ();\n\n  printf (\"Test string: %s\\n\", string_buffer_p);\n  free (string_buffer_p);\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_encoding_t](#jerry_encoding_t)\n- [jerry_string_sz](#jerry_string_sz)\n- [jerry_string_size](#jerry_string_size)\n\n\n## jerry_string_external_on_free\n\n**Summary**\n\nSets the global callback which is called when the string data of an external\nstring is no longer used. It is recommended to set this function before the\nfirst external string is created.\n\n*Note*:\n- When the callback is NULL, no function is called when an external string is freed.\n- In some cases (e.g. when the string is also a magic string registered by\n  [jerry_register_magic_strings](#jerry_register_magic_strings)), the callback\n  is called when the string is created, not when it is released.\n\n**Prototype**\n\n```c\nvoid jerry_string_external_on_free (jerry_external_string_free_cb_t callback_p);\n```\n\n- `callback_p` - callback which is called when an external string is freed.\n\n*Renamed in version 3.0, it was previously known as `jerry_string_set_external_free_callback` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n#include <stdio.h>\n\nstatic void\nexternal_string_free_callback (jerry_char_t *string_p, /**< string pointer */\n                               jerry_size_t string_size, /**< size of the string */\n                               void *user_p) /**< user pointer */\n{\n  printf (\"External string is freed!\\n\");\n}\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_string_external_on_free (external_string_free_callback);\n\n  const char *string_p = \"This is a long external string, should not be duplicated!\";\n  jerry_value_t external_string = jerry_string_external_sz (string_p, NULL);\n  /* The external_string_free_callback is called. */\n  jerry_value_free (external_string);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_external_string_free_cb_t](#jerry_external_string_free_cb_t)\n- [jerry_string_user_ptr](#jerry_string_user_ptr)\n- [jerry_string_external_sz](#jerry_string_external_sz)\n- [jerry_string_external](#jerry_string_external)\n\n\n## jerry_string_user_ptr\n\n**Summary**\n\nReturns the user pointer assigned to an external string.\n\n*Note*:\n- In some cases (e.g. when the string is also a magic string registered by\n  [jerry_register_magic_strings](#jerry_register_magic_strings)), the\n  string is a normal string without a user pointer even if it is created\n  by [jerry_string_external_sz](#jerry_string_external_sz).\n\n**Prototype**\n\n```c\nvoid *jerry_string_user_ptr (const jerry_value_t value,\n                             bool *is_external);\n```\n\n- `value` - string value.\n- `is_external` - when `is_external` is non-NULL, the referenced boolean value is set\n                  to true, if `value` is an external string, and set to false otherwise\n- return value\n  - user pointer - if `value` argument is an external string\n  - NULL - otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_string_get_external_user_pointer` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n#include <stdio.h>\n\nstatic int user_value = 1;\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const char *string_p = \"This is a long external string, should not be duplicated!\";\n\n  jerry_value_t external_string = jerry_string_external_sz (string_p, (void *) &user_value);\n\n  bool is_external;\n  void *user_p = jerry_string_user_ptr (external_string, &is_external);\n\n  if (is_external)\n  {\n    /* Prints the address of user_value. */\n    printf(\"User pointer of an external string: %p\\n\", user_p);\n  }\n\n  jerry_value_free (external_string);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_string_set_external_string_free_callback](#jerry_string_set_external_string_free_callback)\n- [jerry_string_external_sz](#jerry_string_external_sz)\n- [jerry_string_external](#jerry_string_external)\n\n\n# Functions for array object values\n\n## jerry_array_length\n\n**Summary**\n\nGet length of an array object. Returns zero, if the given parameter is not an array object.\n\n**Prototype**\n\n```c\nuint32_t\njerry_array_length (const jerry_value_t value);\n```\n\n- `value` - input array value\n- return value - length of the given array\n\n*Renamed in version 3.0, it was previously known as `jerry_get_array_length` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  uint32_t len = jerry_array_length (value);\n\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_array](#jerry_array)\n\n\n# Converters of 'jerry_value_t'\n\nFunctions for converting API values to another value type.\n\n## jerry_value_to_boolean\n\n**Summary**\n\nCall ToBoolean operation on the api value.\n\n**Prototype**\n\n```c\nbool\njerry_value_to_boolean (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value\n  - true, if the logical value is true\n  - false, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  bool b = jerry_value_to_boolean (value);\n\n  jerry_value_free (value);\n}\n\n```\n\n**See also**\n\n- [jerry_value_to_primitive](#jerry_value_to_primitive)\n\n## jerry_value_to_number\n\n**Summary**\n\nCall ToNumber operation on the api value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_value_to_number (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value\n  - converted number value, if success\n  - thrown exception, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  jerry_value_t number_value = jerry_value_to_number (value);\n\n  jerry_value_free (number_value);\n  jerry_value_free (value);\n}\n\n```\n\n**See also**\n\n- [jerry_value_to_primitive](#jerry_value_to_primitive)\n\n## jerry_value_to_object\n\n**Summary**\n\nCall ToObject operation on the api value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_value_to_object (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value\n  - converted object value, if success\n  - thrown exception, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  jerry_value_t object_value = jerry_value_to_object (value);\n\n  jerry_value_free (object_value);\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_to_primitive](#jerry_value_to_primitive)\n\n## jerry_value_to_primitive\n\n**Summary**\n\nCall ToPrimitive operation on the api value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_value_to_primitive (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value\n  - converted primitive value, if success\n  - thrown exception, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  jerry_value_t prim_value = jerry_value_to_primitive (value);\n\n  jerry_value_free (prim_value);\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_t](#jerry_value_t)\n\n## jerry_value_to_string\n\n**Summary**\n\nCall the ToString ecma builtin operation on the api value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_value_to_string (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value\n  - converted string value, if success\n  - thrown exception, otherwise\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  jerry_value_t string_value = jerry_value_to_string (value);\n\n  jerry_value_free (string_value);\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_to_primitive](#jerry_value_to_primitive)\n\n\n## jerry_value_to_bigint\n\n**Summary**\n\nCall the BigInt constructor ecma builtin operation on the api value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_value_to_bigint (const jerry_value_t value);\n```\n\n- `value` - api value\n- return value\n  - converted BigInt value, if success\n  - thrown exception, otherwise\n\n*Introduced in version 2.4*.\n\n**Example**\n\n```c\n{\n  jerry_value_t value;\n  ... // create or copy value\n\n  jerry_value_t bigint_value = jerry_value_to_bigint (value);\n\n  jerry_value_free (bigint_value);\n  jerry_value_free (value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_value_is_bigint](#jerry_value_is_bigint)\n- [jerry_bigint_to_digits](#jerry_bigint_to_digits)\n\n## jerry_value_as_integer\n\n**Summary**\n\nConvert any number to integer number. Returns 0 if value is not number.\nBased on ECMA 262 v11 7.1.5\n\n**Prototype**\n\n```c\ndouble\njerry_value_as_integer (const jerry_value_t value);\n```\n\n- `value` - api value\n- return\n  - 0, if value is not a number\n  - integer representation of the number, otherwise\n\n*Introduced in version 2.4*.\n\n**Example**\n\n```c\n{\n  jerry_value_t number_val = jerry_number (123321);\n  double number = jerry_value_as_integer (number_val);\n  jerry_value_free (number_val);\n}\n```\n\n## jerry_value_as_int32\n\n**Summary**\n\nConvert any number to int32 number. Returns 0 if value is not number.\nBased on ECMA 262 v11 7.1.6\n\n**Prototype**\n\n```c\nint32_t\njerry_value_as_int32 (const jerry_value_t value);\n```\n\n- `value` - api value\n- return\n  - 0, if value is not a number\n  - int32 representation of the number, otherwise\n\n*Introduced in version 2.4*.\n\n**Example**\n\n```c\n{\n  jerry_value_t number_val = jerry_number (123321);\n  int32_t number = jerry_value_as_int32 (number_val);\n  jerry_value_free (number_val);\n}\n```\n\n## jerry_value_as_uint32\n\n**Summary**\n\nConvert any number to uint32 number. Returns 0 if value is not number.\nBased on ECMA 262 v11 7.1.7\n\n**Prototype**\n\n```c\nuint32_t\njerry_value_as_uint32 (const jerry_value_t value);\n```\n\n- `value` - api value\n- return\n  - 0, if value is not a number\n  - uint32 representation of the number, otherwise\n\n*Introduced in version 2.4*.\n\n**Example**\n\n```c\n{\n  jerry_value_t number_val = jerry_number (123321);\n  uint32_t number = jerry_value_as_uint32 (number_val);\n  jerry_value_free (number_val);\n}\n```\n\n# Functions for module objects\n\nThese APIs all depend on module support.\n\n## jerry_module_link\n\n**Summary**\n\nLink modules to their dependencies. The dependencies are resolved by a user callback.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_value_t jerry_module_link (const jerry_value_t module_val,\n                                 jerry_module_resolve_cb_t callback, void *user_p)\n```\n\n- `module_val` - module object in unlinked state\n- `callback` - user callback which is called to resolve dependencies,\n               uses `jerry_port_module_resolve` when NULL is passed\n- `user_p` - user pointer passed to the callback\n- return\n  - true - if linking is successful\n  - exception - otherwise\n\n*Introduced in version 3.0*.\n\n**Example**\n\n[doctest]: # (test=\"link\")\n\n```c\n#include <jerryscript.h>\n\nstatic jerry_value_t\nmodule_resolve_callback (const jerry_value_t specifier,\n                         const jerry_value_t referrer,\n                         void *user_data_p)\n{\n  /* In this case, the specifier contains 'b.mjs', and the referrer is the module\n   * created in the main() function below. Normally the specifier string should be\n   * extended to a full file system path, and it should be checked whether a module\n   * corresponding to this path has been loaded already. For simplicity, this function\n   * returns with a new module. */\n\n  const jerry_char_t script[] = \"export var a = 5\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"b.mjs\");\n\n  jerry_value_t result = jerry_parse (script, sizeof (script) - 1, &parse_options);\n  jerry_value_free (parse_options.source_name);\n  return result;\n} /* module_resolve_callback */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"import a from 'b.mjs'\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"a.mjs\");\n\n  jerry_value_t ret_value = jerry_parse (script, sizeof (script) - 1, &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  jerry_module_link (ret_value, module_resolve_callback, NULL);\n\n  jerry_value_free (ret_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n- [jerry_module_resolve_cb_t](#jerry_module_resolve_cb_t)\n\n## jerry_module_evaluate\n\nEvaluate a module and its dependencies. The module must be in linked state.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_value_t jerry_module_evaluate (const jerry_value_t module_val);\n```\n\n- `module_val` - module object\n- return\n  - result of module bytecode execution - if evaluation was successful\n  - exception, otherwise\n\n*Introduced in version 3.0*.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <jerryscript.h>\n#include <stdio.h>\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"export var a = 6\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"a.mjs\");\n\n  jerry_value_t module_value = jerry_parse (script, sizeof (script) - 1, &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  jerry_value_free (jerry_module_link (module_value, NULL, NULL));\n  jerry_value_free (jerry_module_evaluate (module_value));\n\n  jerry_value_free (module_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_module_link](#jerry_module_link)\n\n\n## jerry_module_cleanup\n\n**Summary**\n\nRelease known modules in the current context. If realm parameter is supplied, cleans up modules native to that realm only. This function should be called by the user application when the module database in the current context is no longer needed.\n\n**Prototype**\n\n```c\nvoid jerry_module_cleanup (const jerry_value_t realm);\n```\n\n- `realm` - release only those modules whose realm value is equal to this argument.\n\n*Introduced in version 3.0*\n\n**Example**\n\n```c\njerry_module_cleanup (jerry_current_realm ());\n```\n\n**See also**\n\n- [jerry_current_realm](#jerry_current_realm)\n- [jerry_module_state](#jerry_module_state)\n- [jerry_module_evaluate](#jerry_module_evaluate)\n- [jerry_module_link](#jerry_module_link)\n\n\n## jerry_module_state\n\n**Summary**\n\nReturns the current status of a module. The available values\nare listed in [jerry_module_state_t](#jerry_module_state_t)\n\n*Note*:\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_module_state_t jerry_module_state (const jerry_value_t module_val);\n```\n\n- `module_val` - module object\n- return\n  - current status - if module_val is a module\n  - JERRY_MODULE_STATE_INVALID - otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_module_get_state` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <jerryscript.h>\n#include <stdio.h>\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"import a from 'b.mjs'\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"a.mjs\");\n\n  jerry_value_t module_value = jerry_parse (script, sizeof (script) - 1, &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  if (jerry_module_state (module_value) == JERRY_MODULE_STATE_UNLINKED)\n  {\n    printf (\"Module parsing has been successful\\n\");\n  }\n\n  jerry_value_free (module_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_module_state_t](#jerry_module_state_t)\n\n## jerry_module_on_state_changed\n\n**Summary**\n\nSets a callback which is called after a module state is changed to linked, evaluated, or error.\n\n*Note*:\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nvoid jerry_module_on_state_changed (jerry_module_state_changed_cb_t callback,\n                                    void *user_p);\n```\n\n- `callback` - callback, which is called after the state change.\n- `user_p` - pointer passed to the callback function.\n\n*Renamed in version 3.0, it was previously known as `jerry_module_set_state_changed_callback` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <jerryscript.h>\n#include <stdio.h>\n\nstatic void\nmodule_state_changed (jerry_module_state_t new_state, /**< new state of the module */\n                      const jerry_value_t module_val, /**< a module whose state is changed */\n                      const jerry_value_t value, /**< value argument */\n                      void *user_p) /**< user pointer */\n{\n  (void) module_val;\n  (void) value;\n  (void) user_p;\n\n  if (new_state == JERRY_MODULE_STATE_LINKED)\n  {\n    printf (\"A module is entered into linked state\\n\");\n  }\n} /* module_state_changed */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"12\";\n\n  jerry_module_on_state_changed (module_state_changed, NULL);\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"a.mjs\");\n\n  jerry_value_t module_value = jerry_parse (script, sizeof (script) - 1, &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  jerry_value_free (jerry_module_link (module_value, NULL, NULL));\n\n  jerry_value_free (module_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_module_state_t](#jerry_module_state_t)\n- [jerry_module_state_changed_cb_t](#jerry_module_state_changed_cb_t)\n\n## jerry_module_on_import_meta\n\n**Summary**\n\nSets a callback which is called when an import.meta expression of a module is evaluated the first time.\n\n*Note*:\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nvoid jerry_module_on_import_meta (jerry_module_import_meta_cb_t callback,\n                                  void *user_p);\n```\n\n- `callback` - callback, which is called when an import.meta\n               expression of a module is evaluated the first time\n- `user_p` - pointer passed to the callback function.\n\n*Renamed in version 3.0, it was previously known as `jerry_module_set_import_meta_callback` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <jerryscript.h>\n#include <stdio.h>\n\nstatic void\nmodule_import_meta_callback (const jerry_value_t module, /**< module */\n                             const jerry_value_t meta_object, /**< import.meta object */\n                             void *user_p) /**< user pointer */\n{\n  (void) user_p;\n\n  /* Create a property for the meta object */\n  jerry_value_t property_name_value = jerry_string_sz (\"prop\");\n  jerry_value_t property_value = jerry_string_sz (\"prop\");\n  jerry_value_t result_value = jerry_object_set (meta_object, property_name_value, property_value);\n  jerry_value_free (result_value);\n  jerry_value_free (property_value);\n  jerry_value_free (property_name_value);\n} /* module_import_meta_callback */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"import.meta\";\n\n  jerry_module_on_import_meta (module_import_meta_callback, NULL);\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE;\n\n  jerry_value_t module_value = jerry_parse (script, sizeof (script) - 1, &parse_options);\n\n  jerry_value_free (jerry_module_link (module_value, NULL, NULL));\n  jerry_value_free (jerry_module_evaluate (module_value));\n\n  jerry_value_free (module_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_module_import_meta_cb_t](#jerry_module_import_meta_cb_t)\n\n## jerry_module_request_count\n\n**Summary**\n\nReturns the number of import/export requests of a module.\nThe requests can be queried by [jerry_module_request](#jerry_module_request).\n\n\n*Note*:\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nsize_t jerry_module_request_count (const jerry_value_t module_val);\n```\n\n- `module_val` - module object\n- return\n  - number of import/export requests of a module, if `module_val` is module,\n  - 0, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_module_get_number_of_requests` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <jerryscript.h>\n#include <stdio.h>\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"export * from 'b.mjs'\"\n                                \"import a from 'c.mjs'\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"a.mjs\");\n\n  jerry_value_t module_value = jerry_parse (script, sizeof (script) - 1, &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  /* Prints 2. */\n  printf (\"Number of requests: %d\\n\", (int) jerry_module_request_count (module_value));\n\n  jerry_value_free (module_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_module_request](#jerry_module_request)\n- [jerry_parse](#jerry_parse)\n- [jerry_module_link](#jerry_module_link)\n\n## jerry_module_request\n\n**Summary**\n\nReturns the module request specified by the `request_index` argument. The requests\nare ordered in source code occurrence. When parsing is completed, all returned values\nare strings. If [jerry_module_link](#jerry_module_link) is completed successfully\nall returned values are module objects instead. If linking is in progress or fails,\nthe successfully resolved dependencies are module objects, the rest are strings.\nThe number of requests can be queried by\n[jerry_module_request_count](#jerry_module_request_count).\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_value_t jerry_module_request (const jerry_value_t module_val, size_t request_index);\n```\n\n- `module_val` - module object\n- return\n  - string, if the request has not been resolved yet\n  - module object, if the request has been resolved successfully\n  - exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_module_get_request` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <jerryscript.h>\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"export * from 'b.mjs'\"\n                                \"import a from 'c.mjs'\";\n  const jerry_char_t file[] = \"a.mjs\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"a.mjs\");\n\n  jerry_value_t module_value = jerry_parse (script, sizeof (script) - 1, &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  jerry_value_t request_value = jerry_module_request (module_value, 0);\n  /* Returns with b.mjs */\n  jerry_value_free (request_value);\n\n  request_value = jerry_module_request (module_value, 1);\n  /* Returns with c.mjs */\n  jerry_value_free (request_value);\n\n  jerry_value_free (module_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_module_request_count](#jerry_module_request_count)\n- [jerry_parse](#jerry_parse)\n- [jerry_module_link](#jerry_module_link)\n\n## jerry_module_namespace\n\nReturns the namespace object of a module\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_value_t jerry_module_namespace (const jerry_value_t module_val);\n```\n\n- `module_val` - module object\n- return\n  - object, if namespace object is available\n  - exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_module_get_namespace` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <jerryscript.h>\n#include <stdio.h>\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"export var a = 6\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"a.mjs\");\n\n  jerry_value_t module_value = jerry_parse (script, sizeof (script) - 1, &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  jerry_value_free (jerry_module_link (module_value, NULL, NULL));\n  jerry_value_free (jerry_module_evaluate (module_value));\n\n  jerry_value_t namespace_value = jerry_module_namespace (module_value);\n\n  /* Exports can be checked. */\n\n  jerry_value_free (namespace_value);\n  jerry_value_free (module_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_module_link](#jerry_module_link)\n- [jerry_module_evaluate](#jerry_module_evaluate)\n\n## jerry_module_on_import\n\nSets the callback which is called when dynamic imports are resolved. The resolver\nreceives the `user_value` assigned to the currently executed script, which should\nprovide all the information that is necessary for the resolve.\n\n*Note*:\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n- The possible return values of the callback is explained\n  in [jerry_module_import_cb_t](#jerry_module_import_cb_t)\n\n**Prototype**\n\n```c\nvoid\njerry_module_on_import (jerry_module_import_cb_t callback_p,\n                        void *user_p)\n```\n\n- `callback_p` - a [jerry_module_import_cb_t](#jerry_module_import_cb_t) callback which handles `import()` calls\n- `user_p` - user pointer passed to the callback\n\n*Renamed in version 3.0, it was previously known as `jerry_module_set_import_callback` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <jerryscript.h>\n#include <stdio.h>\n\ntypedef struct {\n  jerry_value_t specifier;\n  jerry_value_t user_value;\n  jerry_value_t promise;\n} resolve_module_task_t;\n\nstatic jerry_value_t\nresolve_dynamic (const jerry_value_t specifier, /**< module specifier */\n                 const jerry_value_t user_value, /**< user value assigned to the script */\n                 void *user_p) /**< user data */\n{\n  /* If the specified module has already been evaluated, this callback can\n   * return with it and the promise creation is automatically done by the engine.\n   * Otherwise the application usually adds a resolve task to a command queue. */\n\n  /* This very simple command queue supports only one task. */\n  resolve_module_task_t *task_p = (resolve_module_task_t *) user_p;\n  task_p->specifier = jerry_value_copy (specifier);\n  task_p->user_value = jerry_value_copy (user_value);\n\n  /* This Promise should be evaluated later. */\n  jerry_value_t promise = jerry_promise ();\n  task_p->promise = jerry_value_copy (promise);\n  return promise;\n}\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  resolve_module_task_t task;\n  jerry_module_on_import (resolve_dynamic, &task);\n\n  const jerry_char_t script[] = \"import('modules/my_module.mjs').then(\\n\"\n                                \"  function (namespace) { /* use namespace */},\\n\"\n                                \"  function (error) { /* handle error */}\\n\"\n                                \")\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME | JERRY_PARSE_HAS_USER_VALUE;\n\n  /* Resource is usually used for debugging purposes, e.g. for generating backtrace. */\n  parse_options.source_name = jerry_string_sz (\"dir/my_script.js\");\n\n  /* User value should provide information for resolving dynamic imports.\n   * In this case it contains the full path excluding the filename. */\n  parse_options.user_value = jerry_string_sz (\"/home/user/dir\");\n\n  jerry_value_t script_value = jerry_parse (script, sizeof (script) - 1, &parse_options);\n  jerry_value_free (parse_options.source_name);\n  jerry_value_free (parse_options.user_value);\n  jerry_value_free (jerry_run (script_value));\n  jerry_value_free (script_value);\n\n  /* The application resolves both the module and the promise using the specifier\n   * and the user_value. In this example the specifier is modules/my_module.mjs. */\n  const jerry_char_t module_script[] = \"export var a = 5\";\n\n  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME | JERRY_PARSE_HAS_USER_VALUE;\n  parse_options.source_name = jerry_string_sz (\"modules/my_module.mjs\");\n  parse_options.user_value = jerry_string_sz (\"/home/user/dir/modules\");\n\n  jerry_value_t module_value = jerry_parse (module_script, sizeof (module_script) - 1, &parse_options);\n  jerry_value_free (parse_options.source_name);\n  jerry_value_free (parse_options.user_value);\n  jerry_value_free (jerry_module_link (module_value, NULL, NULL));\n  jerry_value_free (jerry_module_evaluate (module_value));\n\n  /* The promise must be resolved with the namespace object, not the module. */\n  jerry_value_t namespace_value = jerry_module_namespace (module_value);\n  jerry_value_free (jerry_promise_resolve (task.promise, namespace_value));\n\n  jerry_value_free (namespace_value);\n  jerry_value_free (module_value);\n  jerry_value_free (task.specifier);\n  jerry_value_free (task.user_value);\n  jerry_value_free (task.promise);\n\n  /* Process promise handlers. */\n  jerry_value_free (jerry_run_jobs ());\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n- [jerry_module_import_cb_t](#jerry_module_import_cb_t)\n\n## jerry_native_module\n\nCreates a native module with a list of exports. The initial state of the module is linked.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n- Native pointers can be used to assign private data to a native module,\n  see [jerry_object_set_native_ptr](#jerry_object_set_native_ptr)\n- When `callback` is `NULL`, no function is called when the module is evaluated,\n  only its state is changed to evaluated.\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_value_t\njerry_native_module (jerry_native_module_evaluate_cb_t callback,\n                     const jerry_value_t * const exports_p,\n                     size_t number_of_exports);\n```\n\n- `callback` - a [jerry_native_module_evaluate_cb_t](#jerry_native_module_evaluate_cb_t) callback\n               which is called by [jerry_module_evaluate](#jerry_module_evaluate) to evaluate the native module.\n- `exports_p` - list of the exported bindings of the module, must be valid string identifiers.\n- `number_of_exports` - number of exports in the `exports_p` list.\n- return\n  - a native module, if the module is successfully created\n  - exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_native_module_create` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <jerryscript.h>\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t exports[2] =\n  {\n    jerry_string_sz (\"first_export\"),\n    jerry_string_sz (\"second_export\")\n  };\n\n  jerry_value_t native_module = jerry_native_module (NULL, exports, 2);\n\n  jerry_value_free (exports[0]);\n  jerry_value_free (exports[1]);\n  jerry_value_free (native_module);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_module_link](#jerry_module_link)\n- [jerry_module_evaluate](#jerry_module_evaluate)\n- [jerry_native_module_get](#jerry_native_module_get)\n- [jerry_native_module_set](#jerry_native_module_set)\n\n## jerry_native_module_get\n\nGets the value of an export binding which belongs to a native module.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_value_t\njerry_native_module_get (const jerry_value_t native_module_val,\n                         const jerry_value_t export_name_val);\n```\n\n- `native_module_val` - a native module object.\n- `export_name_val` - string identifier of the export.\n- return\n  - value of the export, if success\n  - exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_native_module_get_export` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <jerryscript.h>\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t export = jerry_string_sz (\"an_export\");\n\n  jerry_value_t native_module = jerry_native_module (NULL, &export, 1);\n\n  jerry_value_t value = jerry_native_module_get (native_module, export);\n  jerry_value_free (value);\n\n  jerry_value_free (export);\n  jerry_value_free (native_module);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_native_module](#jerry_native_module)\n- [jerry_native_module_set](#jerry_native_module_set)\n\n## jerry_native_module_set\n\nSets the value of an export binding which belongs to a native module.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n- This API depends on a build option (`JERRY_MODULE_SYSTEM`) and can be checked\n  in runtime with the `JERRY_FEATURE_MODULE` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_value_t\njerry_value_t jerry_native_module_set (const jerry_value_t native_module_val,\n                                       const jerry_value_t export_name_val,\n                                       const jerry_value_t value_to_set)\n```\n\n- `native_module_val` - a native module object.\n- `export_name_val` - string identifier of the export.\n- `value_to_set` - new value of the export.\n- return\n  - true, if success\n  - exception, otherwise\n\n*Introduced in version 3.0*.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <jerryscript.h>\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t export = jerry_string_sz (\"an_export\");\n\n  jerry_value_t native_module = jerry_native_module (NULL, &export, 1);\n\n  jerry_value_t number = jerry_number (3.5);\n  jerry_value_t value = jerry_native_module_set (native_module, export, number);\n  jerry_value_free (value);\n  jerry_value_free (number);\n\n  jerry_value_free (export);\n  jerry_value_free (native_module);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_native_module](#jerry_native_module)\n- [jerry_native_module_get](#jerry_native_module_get)\n\n# Functions for promise objects\n\nThese APIs are always enabled.\n\n## jerry_promise_result\n\n**Summary**\n\nThe function returns the result of a Promise object.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_promise_result (const jerry_value_t promise);\n```\n\n- `promise` - the input Promise object.\n- return\n  - The result of the Promise.\n  - If the Promise is not resolved yet the result is the 'undefined' value.\n  - A TypeError is returned if the input argument was not a Promise object or\n    the Promise support was not built into the library.\n\n*Introduced in version 2.2*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_promise_result` in earlier versions.*\n\n**Example**\n\n[doctest]: # (test=\"compile\")\n\n```c\n#include <jerryscript.h>\n\nstatic void\nexample (void)\n{\n  // create a promise object.\n  jerry_value_t promise = jerry_promise ();\n  {\n    // prepare the argument for the resolve or reject.\n    jerry_value_t argument = jerry_number (33);\n\n    jerry_value_t is_ok = jerry_promise_resolve (promise, argument);\n\n    // 'is_ok' should be checked if it is an exception or not.\n    // skipped in this example\n    jerry_value_free (is_ok);\n    jerry_value_free (argument);\n  }\n\n  jerry_value_t promise_result = jerry_promise_result (promise);\n  // 'promise_result' is now the number 33.\n\n  jerry_value_free (promise_result);\n  jerry_value_free (promise);\n}\n```\n\n**See also**\n\n- [jerry_promise](#jerry_promise)\n- [jerry_promise_state_t](#jerry_promise_state_t)\n\n## jerry_promise_state\n\n**Summary**\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_promise_state_t\njerry_promise_state (const jerry_value_t promise);\n```\n\n- `promise` - the input promise object.\n- return\n  - [jerry_promise_state_t](#jerry_promise_state_t)\n  - `JERRY_PROMISE_STATE_NONE` is returned if the input argument was not a promise object or\n    the Promise support was not built into the library.\n\n*Introduced in version 2.2*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_promise_state` in earlier versions.*\n\n**Example**\n\n[doctest]: # (test=\"compile\")\n\n```c\n#include <jerryscript.h>\n\nstatic void\nexample (void)\n{\n  // create a promise object.\n  jerry_value_t promise = jerry_promise ();\n\n  jerry_promise_state_t start_state = jerry_promise_state (promise);\n  // a Promise have a default state of JERRY_PROMISE_STATE_PENDING\n\n  {\n    // prepare the argument for the resolve or reject.\n    jerry_value_t argument = jerry_number (33);\n\n    jerry_value_t is_ok = jerry_promise_resolve (promise, argument);\n\n    // 'is_ok' should be checked if it is an exception or not.\n    // skipped in this example\n    jerry_value_free (is_ok);\n    jerry_value_free (argument);\n  }\n\n  jerry_promise_state_t current_state = jerry_promise_state (promise);\n  // at this point the Promise should be in the JERRY_PROMISE_STATE_FULFILLED state.\n\n  jerry_value_free (promise);\n}\n```\n\n**See also**\n\n- [jerry_promise](#jerry_promise)\n- [jerry_promise_state_t](#jerry_promise_state_t)\n\n## jerry_promise_on_event\n\n**Summary**\n\nSets a callback for tracking Promise and async operations.\n\n*Note*:\n- This API depends on a build option (`JERRY_PROMISE_CALLBACK`) and can be checked\n  in runtime with the `JERRY_FEATURE_PROMISE_CALLBACK` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\nvoid jerry_promise_on_event (jerry_promise_event_filter_t filters, jerry_promise_event_cb_t callback,\n                             void *user_p);\n```\n\n- `filters` - combination of [jerry_promise_event_filter_t](#jerry_promise_event_filter_t) options\n- `callback` - callback function, the previously set value is overwritten,\n               and setting NULL disables the tracking\n- `user_p` - pointer passed to the callback function, can be NULL\n\n*Renamed in version 3.0, it was previously known as `jerry_promise_set_callback` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <stdio.h>\n#include <string.h>\n#include \"jerryscript.h\"\n\nstatic void\npromise_callback (jerry_promise_event_type_t event_type, /**< event type */\n                  const jerry_value_t object, /**< target object */\n                  const jerry_value_t value, /**< optional argument */\n                  void *user_p) /**< user pointer passed to the callback */\n{\n  if (event_type == JERRY_PROMISE_EVENT_CREATE)\n  {\n    printf (\"A new promise is created\\n\");\n\n    if (!jerry_value_is_undefined (value))\n    {\n      printf (\"  The Promise is created by Promise.then() built-in.\\n\");\n    }\n  }\n} /* promise_callback */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_promise_on_event (JERRY_PROMISE_EVENT_FILTER_CREATE, promise_callback, NULL);\n\n  const char *source_p = \"var p = Promise.resolve(0)\\n\"\n                         \"p.then(function (v) { return v; })\";\n  jerry_value_free (jerry_eval ((const jerry_char_t *) source_p,\n                                strlen (source_p),\n                                JERRY_PARSE_NO_OPTS));\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n```\n\n**See also**\n\n- [jerry_promise](#jerry_promise)\n- [jerry_promise_state_t](#jerry_promise_state_t)\n\n## jerry_property_descriptor_to_object\n\n**Summary**\n\nThis API function is equivalent to FromPropertyDescriptor operation defined in ECMA 262 v11 6.2.5.4.\nIt returns with an ECMAScript Object which represents the property attributes.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_property_descriptor_to_object (const jerry_property_descriptor_t *src_prop_desc_p)\n```\n\n- `src_prop_desc_p` - the input property descriptor.\n- return\n  - [jerry_value_t](#jerry_value_t)\n  - object value - if success\n  - exception - otherwise\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_from_property_descriptor` in earlier versions.*\n\n**Example**\n\n[doctest]: # (test=\"compile\")\n\n```c\n#include <jerryscript.h>\n\nstatic void\nexample (void)\n{\n  jerry_value_t prop_name = jerry_string_sz (\"value\");\n\n  jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n\n  prop_desc.value = prop_name;\n  prop_desc.flags |= JERRY_PROP_IS_VALUE_DEFINED;\n\n  jerry_value_t from_object = jerry_property_descriptor_to_object (&prop_desc);\n\n  jerry_value_free (prop_name);\n  jerry_value_free (from_object);\n  jerry_property_descriptor_free (&prop_desc);\n}\n```\n\n## jerry_property_descriptor_from_object\n\n**Summary**\n\nThis API function is equivalent to ToPropertyDescriptor operation defined in ECMA 262 v11 6.2.5.5.\nIt decodes the ECMAScript object and fills the fields of a JerryScript property descriptor.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_property_descriptor_from_object (jerry_value_t obj_value, jerry_property_descriptor_t *out_prop_desc_p);\n```\n\n- `obj_value` - the input object\n- `src_prop_desc_p` - the output property descriptor.\n- return\n  - [jerry_value_t](#jerry_value_t)\n  - true, if success\n  - thrown exception, otherwise\n\n*Introduced in version 2.4*.\n\n**Example**\n\n[doctest]: # (test=\"compile\")\n\n```c\n#include <jerryscript.h>\n\nstatic void\nexample (void)\n{\n  jerry_value_t object = jerry_object ();\n  jerry_value_t prop_name = jerry_string_sz (\"value\");\n  jerry_value_t value = jerry_boolean (true);\n  jerry_property_descriptor_t prop_desc;\n\n  jerry_value_free (jerry_object_set (object, prop_name, prop_name));\n\n  jerry_value_free (jerry_property_descriptor_from_object (object, &prop_desc));\n\n  jerry_value_free (object);\n  jerry_value_free (prop_name);\n  jerry_value_free (value);\n  jerry_property_descriptor_free (&prop_desc);\n}\n```\n\n\n## jerry_promise_resolve\n\n**Summary**\n\nResolve the promise with an argument.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_promise_resolve (jerry_value_t promise, jerry_value_t argument);\n```\n\n- `promise` - the promise value\n- `argument` - the argument value\n- return value\n  - undefined - if resolve call was successful\n  - exception - otherwise\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_resolve_or_reject_promise` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t promise = ... // create/copy a promise object.\n\n  ...\n\n  jerry_value_t argument = ... // prepare the argument for resolve.\n\n  jerry_value_t is_ok = jerry_promise_resolve (promise, argument);\n\n  if (jerry_value_is_exception (is_ok))\n  {\n    // handle the exception.\n  }\n\n  jerry_value_free (is_ok);\n  jerry_value_free (argument);\n  jerry_value_free (promise);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_value_is_exception](#jerry_value_is_exception)\n\n\n## jerry_promise_reject\n\n**Summary**\n\nReject the promise with an argument.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_promise_reject (jerry_value_t promise, jerry_value_t argument);\n```\n\n- `promise` - the promise value\n- `argument` - the argument value\n- return value\n  - undefined - if reject call was successful\n  - exception - otherwise\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_resolve_or_reject_promise` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t promise = ... // create/copy a promise object.\n\n  ...\n\n  jerry_value_t argument = ... // prepare the argument for reject.\n\n  jerry_value_t is_ok = jerry_promise_reject (promise, argument);\n\n  if (jerry_value_is_exception (is_ok))\n  {\n    // handle the exception.\n  }\n\n  jerry_value_free (is_ok);\n  jerry_value_free (argument);\n  jerry_value_free (promise);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_value_is_exception](#jerry_value_is_exception)\n\n# Functions for symbols\n\nThese APIs are always enabled.\n\n## jerry_symbol\n\n**Summary**\n\nGet the well-known symbol corresponding to the given [well-known symbol id](#jerry_well_known_symbol_t).\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n- If the symbol support is not enabled an undefined will be returned.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_symbol (jerry_well_known_symbol_t symbol);\n```\n\n- `symbol` - [jerry_well_known_symbol_t](#jerry_well_known_symbol_t) enum value\n- return value\n  - undefined value - if invalid well-known symbol was requested\n  - well-known symbol value, otherwise\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_well_known_symbol` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t array_value = jerry_array (5);\n  jerry_value_t symbol_iterator = jerry_symbol (JERRY_SYMBOL_ITERATOR);\n  jerry_value_t array_iterator = jerry_object_get (array_value, symbol_iterator);\n\n  // usage of array_iterator\n\n  jerry_value_free (array_iterator);\n  jerry_value_free (symbol_iterator);\n  jerry_value_free (array_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_well_known_symbol_t](#jerry_well_known_symbol_t)\n\n## jerry_symbol_description\n\n**Summary**\n\nReturns with the `[[Description]]` internal property of a symbol value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_symbol_description (const jerry_value_t value);\n```\n\n- `value` - symbol value\n- return value\n  - string or undefined value containing the symbol's description - if success\n  - thrown exception, otherwise\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_symbol_description` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t string_value = jerry_string_sz (\"foo\");\n  jerry_value_t symbol_value = jerry_symbol_with_description (string_value);\n\n  jerry_value_free (string_value);\n\n  jerry_value_t symbol_description = jerry_symbol_description (symbol_value);\n\n  // usage of symbol_desc_string\n\n  jerry_value_free (symbol_description);\n  jerry_value_free (symbol_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_symbol_descriptive_string](#jerry_symbol_descriptive_string)\n\n## jerry_symbol_descriptive_string\n\n**Summary**\n\nCall the SymbolDescriptiveString ecma builtin operation on the API value.\nBased on ECMA 262 v6 19.4.3.2.1 this is in the form of `Symbol(<description>)`.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_symbol_descriptive_string (const jerry_value_t value);\n```\n\n- `value` - symbol value\n- return value\n  - string value containing the symbol's descriptive string - if success\n  - thrown exception, otherwise\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_symbol_descriptive_string` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t string_value = jerry_string_sz (\"foo\");\n  jerry_value_t symbol_value = jerry_symbol_with_description (string_value);\n\n  jerry_value_free (string_value);\n\n  jerry_value_t symbol_desc_string = jerry_symbol_descriptive_string (symbol_value);\n\n  // usage of symbol_desc_string\n\n  jerry_value_free (symbol_desc_string);\n  jerry_value_free (symbol_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_symbol_description](#jerry_symbol_description)\n\n# Functions for BigInts\n\nThese APIs all depend on build option (`JERRY_BUILTIN_BIGINT`).\n\n## jerry_bigint_digit_count\n\n**Summary**\n\nReturns the size of uint64 digits of a BigInt value. This value is the\nminimum size of the buffer which can hold all digits of a BigInt value when\nthe digits are retrieved by `[jerry_bigint_to_digits](#jerry_bigint_to_digits)`.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_BIGINT`) and can be checked\n  in runtime with the `JERRY_FEATURE_BIGINT` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\nuint32_t\njerry_bigint_digit_count (jerry_value_t value)\n```\n\n- `value` - BigInt value\n- return value\n  - number of digits (can be zero for BigInt zero)\n  - if value is not a BigInt value, it returns with zero\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_bigint_size_in_digits` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <stdio.h>\n\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  uint64_t digits[4] = { 0x1, 0x1, 0x0, 0x0 };\n  jerry_value_t bigint_value = jerry_bigint (digits, 4, true);\n\n  /* Prints two, because the leading zeroes in digits buffer are discarded. */\n  printf(\"size: %d\\n\", (int) jerry_bigint_digit_count (bigint_value));\n\n  jerry_value_free (bigint_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_value_is_bigint](#jerry_value_is_bigint)\n- [jerry_bigint_to_digits](#jerry_bigint_to_digits)\n\n\n## jerry_bigint_to_digits\n\n**Summary**\n\nCopies the uint64 digits of a BigInt value into a buffer. This function supports any\nbuffer sizes. If the buffer size is smaller than the size returned by\n`[jerry_bigint_digit_count](#jerry_bigint_digit_count)`, only the\nleast significant digits are copied into the buffer. If the buffer size is greater,\nthe unused digits are filled with zero.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_BIGINT`) and can be checked\n  in runtime with the `JERRY_FEATURE_BIGINT` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\nvoid\njerry_bigint_to_digits (jerry_value_t value, uint64_t *digits_p, uint32_t size, bool *sign_p)\n```\n\n- `value` - BigInt value\n- `digits_p` - output buffer for digits\n- `size` - size of the output buffer\n- `sign_p` - the boolean passed to the function is set to false when the BigInt\n             is positive, and set to true otherwise (this parameter can be NULL)\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_bigint_digits` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  uint64_t digits[4] = { 0x1, 0x1, 0x0, 0x0 };\n  jerry_value_t bigint_value = jerry_bigint (digits, 4, true);\n\n  uint64_t get_digits[4];\n  bool sign;\n  jerry_bigint_to_digits (bigint_value, get_digits, 2, &sign);\n\n  jerry_value_free (bigint_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_value_is_bigint](#jerry_value_is_bigint)\n- [jerry_bigint_digit_count](#jerry_bigint_digit_count)\n\n\n# Functions for Proxy objects\n\nThese APIs all depend on build option (`JERRY_BUILTIN_PROXY`).\n\n## jerry_proxy_target\n\n**Summary**\n\nGets the target object of a Proxy object.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_PROXY`) and can be checked\n  in runtime with the `JERRY_FEATURE_PROXY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_proxy_target (jerry_value_t proxy_value);\n```\n\n- `proxy_value` - Proxy object value\n- return value\n  - type error exception - if proxy_value is not a Proxy object\n  - target object - otherwise\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_proxy_target` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t target = jerry_object ();\n  jerry_value_t handler = jerry_object ();\n  jerry_value_t proxy = jerry_proxy (target, handler);\n\n  jerry_value_free (target);\n  jerry_value_free (handler);\n\n  target = jerry_proxy_target (proxy);\n\n  // ... usage of the target\n\n  jerry_value_free (target);\n  jerry_value_free (proxy);\n}\n```\n\n**See also**\n\n- [jerry_proxy](#jerry_proxy)\n- [jerry_proxy_custom](#jerry_proxy_custom)\n- [jerry_proxy_handler](#jerry_proxy_handler)\n\n## jerry_proxy_handler\n\n**Summary**\n\nGets the handler object of a Proxy object.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_PROXY`) and can be checked\n  in runtime with the `JERRY_FEATURE_PROXY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_proxy_handler (jerry_value_t proxy_value);\n```\n\n- `proxy_value` - Proxy object value\n- return value\n  - type error exception - if proxy_value is not a Proxy object\n  - handler object - otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_get_proxy_handler` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t target = jerry_object ();\n  jerry_value_t handler = jerry_object ();\n  jerry_value_t proxy = jerry_proxy (target, handler);\n\n  jerry_value_free (target);\n  jerry_value_free (handler);\n\n  handler = jerry_proxy_handler (proxy);\n\n  // ... usage of the handler\n\n  jerry_value_free (handler);\n  jerry_value_free (proxy);\n}\n```\n\n**See also**\n\n- [jerry_proxy](#jerry_proxy)\n- [jerry_proxy_custom](#jerry_proxy_custom)\n- [jerry_proxy_target](#jerry_proxy_target)\n\n\n# Copy and free API values\n\n## jerry_value_copy\n\n**Summary**\n\nCopies the specified Jerry API value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_value_copy (jerry_value_t value);\n```\n\n- `value` - api value\n- return value - copied value\n\n*Renamed in version 3.0, it was previously known as `jerry_acquire_value` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t object_value = jerry_object ();\n\n  jerry_value_t copied_object = jerry_value_copy (object_value);\n\n  jerry_value_free (object_value);\n\n  // copied_object refers to the created object and makes it\n  // available after the release of 'object_value'\n\n  jerry_value_free (copied_object);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_value_t](#jerry_value_t)\n\n\n## jerry_value_free\n\n**Summary**\n\nRelease specified Jerry API value.\n\n**Prototype**\n\n```c\nvoid\njerry_value_free (jerry_value_t value);\n```\n\n- `value` - api value\n\n*Renamed in version 3.0, it was previously known as `jerry_release_value` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t object_value = jerry_object ();\n\n  ...\n\n  jerry_value_free (object_value);\n}\n```\n\n\n# Create API values\n\nFunction for creating [API values](#jerry_value_t).\n\n*Note*:\n- Every created API value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n## jerry_array\n\n**Summary**\n\nCreate an array object value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_array (uint32_t size);\n```\n\n - `size` - size of array;\n - return value - value of the constructed array object\n\n*Renamed in version 3.0, it was previously known as `jerry_create_array` in earlier versions.*\n\n **Example**\n\n```c\n{\n    jerry_value_t array = jerry_array (10);\n\n    ...\n\n    jerry_value_free (array);\n}\n```\n\n**See also**\n\n- [jerry_object_set_index](#jerry_object_set_index)\n- [jerry_object_get_index](#jerry_object_get_index)\n\n\n## jerry_arraybuffer\n\n**Summary**\n\nCreate a jerry_value_t representing an ArrayBuffer object.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\n  in runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_arraybuffer (jerry_length_t size);\n```\n\n - `size` - size of the backing store allocated for the array buffer **in bytes**.\n - return value - the new ArrayBuffer as a `jerry_value_t`\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_arraybuffer` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t buffer_value = jerry_arraybuffer (15);\n\n  ... // use the ArrayBuffer\n\n  jerry_value_free (buffer_value);\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer_read](#jerry_arraybuffer_read)\n- [jerry_arraybuffer_write](#jerry_arraybuffer_write)\n- [jerry_value_is_arraybuffer](#jerry_value_is_arraybuffer)\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_arraybuffer_external\n\n**Summary**\n\nCreates a jerry_value_t representing an ArrayBuffer object with\nuser specified back-buffer.\n\nUser must pass a buffer pointer which is at least `size` big.\nAfter the object is not needed the GC will call the `free_cb`\nso the user can release the buffer which was provided.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\n  in runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n- If `buffer_p` is NULL, the buffer is allocated by the allocator callback passed to\n  [jerry_arraybuffer_allocator](#jerry_arraybuffer_allocator)\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_arraybuffer_external (uint8_t *buffer_p,\n                            const jerry_length_t size\n                            void *arraybuffer_user_p);\n```\n\n- `size` - size of the buffer **in bytes**.\n- `buffer_p` - the backing store used by the array buffer object.\n- `arraybuffer_user_p` - user pointer assigned to the array buffer object.\n- return value\n  - value of the newly constructed array buffer object.\n\n*Introduced in version 2.0*.\n\n*Updated in version 3.0*: `free_cb` has been replaced by `arraybuffer_user_p`.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_arraybuffer_external` in earlier versions.*\n\n**Example**\n\n```c\n{\n  uint8_t buffer_p[15];\n  jerry_value_t buffer_value = jerry_arraybuffer_external (buffer_p, 15, NULL);\n\n  ... // use the array buffer\n\n  jerry_value_free (buffer_value);\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer_data](#jerry_arraybuffer_data)\n- [jerry_arraybuffer_read](#jerry_arraybuffer_read)\n- [jerry_arraybuffer_write](#jerry_arraybuffer_write)\n- [jerry_value_is_arraybuffer](#jerry_value_is_arraybuffer)\n- [jerry_value_free](#jerry_value_free)\n- [jerry_object_native_free_cb_t](#jerry_object_native_free_cb_t)\n\n\n## jerry_shared_arraybuffer\n\n**Summary**\n\nCreate a jerry_value_t representing a SharedArrayBuffer object.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_SHAREDARRAYBUFFER`).\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_shared_arraybuffer (jerry_length_t size);\n```\n\n- `size` - size of the backing store allocated for the shared array buffer **in bytes**.\n- return value - the new SharedArrayBuffer as a `jerry_value_t`\n\n*Renamed in version 3.0, it was previously known as `jerry_create_shared_arraybuffer` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t buffer_value = jerry_shared_arraybuffer (15);\n\n  ... // use the SharedArrayBuffer\n\n  jerry_value_free (buffer_value);\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer_read](#jerry_arraybuffer_read)\n- [jerry_arraybuffer_write](#jerry_arraybuffer_write)\n- [jerry_value_is_shared_arraybuffer](#jerry_value_is_shared_arraybuffer)\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_shared_arraybuffer_external\n\n**Summary**\n\nCreates a jerry_value_t representing an SharedArrayBuffer object with\nuser specified back-buffer.\n\nUser must pass a buffer pointer which is at least `size` big.\nAfter the object is not needed the GC will call the `free_cb`\nso the user can release the buffer which was provided.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_SHAREDARRAYBUFFER`).\n- If `buffer_p` is NULL, the buffer is allocated by the allocator callback passed to\n  [jerry_arraybuffer_allocator](#jerry_arraybuffer_allocator)\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_shared_arraybuffer_external (uint8_t *buffer_p,\n                                   const jerry_length_t size,\n                                   jerry_value_free_callback_t free_cb);\n```\n\n- `buffer_p` - the backing store used by the shared array buffer object.\n- `size` - size of the buffer **in bytes**.\n- `arraybuffer_user_p` - user pointer assigned to the shared array buffer object.\n- return value\n    - value of the newly constructed shared array buffer object.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_shared_arraybuffer_external` in earlier versions.*\n\n**Example**\n\n```c\n{\n  uint8_t buffer_p[15];\n  jerry_value_t buffer_value = jerry_shared_arraybuffer_external (buffer_p, 15, NULL);\n\n  ... // use the shared array buffer\n\n  jerry_value_free (buffer_value);\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer_data](#jerry_arraybuffer_data)\n- [jerry_arraybuffer_read](#jerry_arraybuffer_read)\n- [jerry_arraybuffer_write](#jerry_arraybuffer_write)\n- [jerry_value_is_shared_arraybuffer](#jerry_value_is_shared_arraybuffer)\n- [jerry_value_free](#jerry_value_free)\n- [jerry_object_native_free_cb_t](#jerry_object_native_free_cb_t)\n\n\n## jerry_boolean\n\n**Summary**\n\nCreate a jerry_value_t representing a boolean value from the given boolean parameter.\n\n*Note*:\n- The boolean values (true/false) are fixed constants. Their values can be copied\n  any number of times without calling [jerry_value_copy](#jerry_value_copy), and\n  freeing it with [jerry_value_free](#jerry_value_free) is optional.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_boolean (bool value);\n```\n\n- `value` - raw boolean value.\n- return value - a `jerry_value_t` created from the given boolean argument.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_boolean` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t boolean_value = jerry_boolean (true);\n\n  ... // usage of the value\n\n  jerry_value_free (boolean_value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_error\n\n**Summary**\n\nCreate new JavaScript Error object with the specified error message.\n\nImportant! The `error_type` argument *must not be* `JERRY_ERROR_NONE`.\nCreating an Error object with no error type is not valid.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_error (jerry_error_t error_type, jerry_value_t message);\n```\n\n- `error_type` - type of error\n- `message` - error message string\n- return value - constructed error object\n\n*Renamed in version 3.0, it was previously known as `jerry_create_error` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t message = jerry_string_sz (\"error\");\n  jerry_value_t error_obj = jerry_error (JERRY_ERROR_COMMON, message);\n\n  ... // usage of error_obj\n\n\n  jerry_value_free (error_obj);\n  jerry_value_free (message);\n}\n```\n\n**See also**\n\n- [jerry_value_is_exception](#jerry_value_is_exception)\n- [jerry_exception_value](#jerry_exception_value)\n- [jerry_throw](#jerry_throw)\n\n\n## jerry_error_sz\n\n**Summary**\n\nCreate new JavaScript Error object, using the a zero-terminated string as the error message.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_error_sz (jerry_error_t error_type, const char *message_p);\n```\n\n- `error_type` - type of the error\n- `message_p` - value of 'message' property of the constructed error object\n- return value - constructed error object\n\n*Renamed in version 3.0, it was previously known as `jerry_create_error` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t error_obj = jerry_error_sz (JERRY_ERROR_TYPE, \"error\");\n\n  ... // usage of error_obj\n\n  jerry_value_free (error_obj);\n}\n```\n\n**See also**\n\n- [jerry_error](#jerry_error)\n\n\n## jerry_dataview\n\n**Summary**\n\nCreate new JavaScript DataView object.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_DATAVIEW`) and can be checked\n  in runtime with the `JERRY_FEATURE_DATAVIEW` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_dataview (const jerry_value_t array_buffer,\n                const jerry_length_t byte_offset,\n                const jerry_length_t byte_length)\n```\n\n- `array_buffer` - arrayBuffer to create DataView from\n- `byte_offset` - offset in bytes, to the first byte in the buffer\n- `byte_length` - number of elements in the byte array\n- return value\n  - value of the constructed DataView object - if success\n  - exception - otherwise\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_dataview` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t arraybuffer = jerry_arraybuffer (16);\n  jerry_value_t dataview = jerry_dataview (arraybuffer, 0, 16);\n\n  // usage of dataview\n\n  jerry_value_free (dataview);\n  jerry_value_free (arraybuffer);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_value_is_dataview](#jerry_value_is_dataview)\n- [jerry_arraybuffer](#jerry_arraybuffer)\n\n\n## jerry_function_external\n\n**Summary**\n\nCreate an external function object.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_function_external (jerry_external_handler_t handler_p);\n```\n\n- `handler_p` - pointer to native handler of the function object\n- return value - value of the constructed function object\n\n*Renamed in version 3.0, it was previously known as `jerry_create_external_function` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <stdio.h>\n#include <string.h>\n#include \"jerryscript.h\"\n\nstatic jerry_value_t\nhandler (const jerry_call_info_t *call_info_p,\n         const jerry_value_t args_p[],\n         const jerry_length_t args_cnt)\n{\n  printf (\"Native handler called!\\n\");\n\n  return jerry_boolean (true);\n}\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t func_val = jerry_function_external (handler);\n  jerry_value_t glob_obj = jerry_current_realm ();\n\n  // after this, script can invoke the native handler through \"handler_field (1, 2, 3);\"\n  jerry_value_t prop_name = jerry_string_sz (\"handler_field\");\n  // set property and release the return value without any check\n  jerry_value_free (jerry_object_set (glob_obj, prop_name, func_val));\n  jerry_value_free (prop_name);\n\n  jerry_value_free (func_val);\n  jerry_value_free (glob_obj);\n\n  // Test the method by calling it\n  const char *test_src = \"handler_field ();\";\n  jerry_value_t ret_val = jerry_eval ((const jerry_char_t *) test_src,\n                                      strlen (test_src),\n                                      JERRY_PARSE_NO_OPTS);\n  // release the eval result\n  jerry_value_free (ret_val);\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_external_handler_t](#jerry_external_handler_t)\n- [jerry_object_set](#jerry_object_set)\n- [jerry_call](#jerry_call)\n\n\n## jerry_number\n\n**Summary**\n\nCreates a `jerry_value_t` representing a number value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_number (double value);\n```\n\n- `value` - double value from which a `jerry_value_t` will be created\n- return value - a `jerry_value_t` created from the given double argument\n\n*Renamed in version 3.0, it was previously known as `jerry_create_number` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t number_value = jerry_number (3.14);\n\n  ... // usage of the value\n\n  jerry_value_free (number_value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_infinity](#jerry_infinity)\n- [jerry_nan](#jerry_nan)\n\n\n## jerry_infinity\n\n**Summary**\n\nCreates a `jerry_value_t` representing a positive or negative infinity value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_infinity (bool sign);\n```\n\n- `sign` - true for negative Infinity and false for positive Infinity\n- return value - a `jerry_value_t` representing the infinity value\n\n*Renamed in version 3.0, it was previously known as `jerry_create_number_infinity` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t positive_inf_value = jerry_infinity (false);\n\n  ... // usage of the positive_inf_value\n\n  jerry_value_free (positive_inf_value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_number](#jerry_number)\n- [jerry_nan](#jerry_nan)\n\n\n## jerry_nan\n\n**Summary**\n\nCreates a `jerry_value_t` representing a not-a-number value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_nan (void);\n```\n\n- return value - a `jerry_value_t` representing the not-a-number value\n\n*Renamed in version 3.0, it was previously known as `jerry_create_number_nan` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t nan_value = jerry_nan ();\n\n  ... // usage of the nan_value\n\n  jerry_value_free (nan_value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_number](#jerry_number)\n- [jerry_infinity](#jerry_infinity)\n\n\n## jerry_null\n\n**Summary**\n\nCreates and returns a `jerry_value_t` with type null object.\n\n*Note*:\n- The null value is a fixed constant. Its value can be copied any number of times without\n  calling [jerry_value_copy](#jerry_value_copy), and freeing it\n  with [jerry_value_free](#jerry_value_free) is optional.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_null (void);\n```\n\n- return value - a `jerry_value_t` representing null.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_null` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t null_value = jerry_null ();\n\n  ... // usage of the value\n\n  jerry_value_free (null_value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_object\n\n**Summary**\n\nCreate new JavaScript object, like with new Object().\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object (void);\n```\n\n- return value - value of the created object\n\n*Renamed in version 3.0, it was previously known as `jerry_create_object` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t object_value = jerry_object ();\n\n  ... // usage of object_value\n\n  jerry_value_free (object_value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_promise\n\n**Summary**\n\nCreate an empty promise object which can be resolved or rejected later\nby calling jerry_promise_resolve or jerry_promise_reject.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_promise (void)\n```\n\n- return value - value of the newly created promise\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_promise` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t p = jerry_promise ();\n\n  ...// usage of the promise\n\n  jerry_value_free (p);\n}\n```\n\n**See also**\n\n- [jerry_promise_resolve](#jerry_promise_resolve)\n- [jerry_promise_reject](#jerry_promise_reject)\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_proxy\n\n**Summary**\n\nCreate a new Proxy object with the given target and handler.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_PROXY`) and can be checked\n  in runtime with the `JERRY_FEATURE_PROXY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_proxy (const jerry_value_t target, const jerry_value_t handler);\n```\n\n- `target` - proxy target\n- `handler` - proxy handler\n- return exception - if the Proxy construction fails\n         value of the newly created proxy object - otherwise\n\n*Introduced in version 2.3*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_proxy` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t target = jerry_object ();\n  jerry_value_t handler = jerry_object ();\n  jerry_value_t proxy = jerry_proxy (target, handler);\n\n  jerry_value_free (target);\n  jerry_value_free (handler);\n\n  // usage of the proxy\n\n  jerry_value_free (proxy);\n\n  jerry_cleanup ();\n}\n```\n\n**See also**\n\n- [jerry_value_is_proxy](#jerry_value_is_proxy)\n- [jerry_proxy_custom](#jerry_proxy_custom)\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_proxy_custom\n\n**Summary**\n\nCreate a new Proxy object with the given target and handler.\nThe behaviour of the Proxy can be specialized with an options argument.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_PROXY`) and can be checked\n  in runtime with the `JERRY_FEATURE_PROXY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_proxy_custom (const jerry_value_t target,\n                    const jerry_value_t handler,\n                    uint32_t options);\n```\n\n- `target` - proxy target\n- `handler` - proxy handler\n- `options` - any combination of [jerry_proxy_custom_behavior_t](#jerry_proxy_custom_behavior_t) options\n- return thrown exception - if the Proxy construction fails\n         value of the newly created proxy object - otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_create_special_proxy` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t target = jerry_object ();\n  jerry_value_t handler = jerry_object ();\n  jerry_value_t proxy = jerry_proxy_custom (target, handler, JERRY_PROXY_SKIP_RESULT_VALIDATION);\n\n  jerry_value_free (target);\n  jerry_value_free (handler);\n\n  // usage of the proxy\n\n  jerry_value_free (proxy);\n\n  jerry_cleanup ();\n}\n```\n\n**See also**\n\n- [jerry_value_is_proxy](#jerry_value_is_proxy)\n- [jerry_proxy_custom](#jerry_proxy_custom)\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_string_sz\n\n**Summary**\n\nCreate string from a zero-terminated ASCII string.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_string_sz (const char *str_p);\n```\n\n- `str_p` - non-null pointer to zero-terminated string\n- return value - created string\n\n*Renamed in version 3.0, it was previously known as `jerry_create_string` in earlier versions.*\n\n**Example**\n\n```c\n{\n  const char char_array[] = \"a string\";\n  jerry_value_t string_value = jerry_string_sz (char_array);\n\n  ... // usage of string_value\n\n  jerry_value_free (string_value);\n}\n```\n\n**See also**\n\n- [jerry_string](#jerry_string)\n\n\n## jerry_string\n\n**Summary**\n\nCreate a string from a buffer using the specified encoding. The data in the buffer must be valid for the encoding.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_string (const jerry_char_t *buffer_p,\n              jerry_size_t buf_size,\n              jerry_encoding_t encoding)\n```\n\n- `buffer_p` - non-null pointer to buffer\n- `buf_size` - size of the buffer\n- `encoding` - encoding of the string data\n- return value - value of the created string\n\n*Renamed in version 3.0, it was previously known as `jerry_create_string_sz` in earlier versions.*\n\n**Example**\n\n```c\n{\n  const jerry_char_t char_array[] = \"a string\";\n  jerry_value_t string_value = jerry_string (char_array,\n                                             sizeof (char_array) - 1,\n                                             JERRY_ENCODING_CESU8);\n\n  ... // usage of string_value\n\n  jerry_value_free (string_value);\n}\n\n```\n\n**See also**\n\n- [jerry_validate_string](#jerry_validate_string)\n- [jerry_string_sz](#jerry_string_sz)\n\n\n## jerry_string_external_sz\n\n**Summary**\n\nCreate an external string from a zero-terminated ASCII string. The string buffer passed to the function\nshould not be modified until the free callback is called. This function can be used to avoid\nthe duplication of large strings.\n\n*Note*:\n- The free callback can be set by [jerry_string_external_on_free](#jerry_string_external_on_free)\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_string_external_sz (const char *str_p, void *user_p);\n```\n\n- `str_p` - non-null pointer to a zero-terminated string\n- `user_p` - user pointer passed to the callback when the string is freed\n- return value - value of the created string\n\n*Introduced in version 2.4*.\n\n*Updated in version 3.0*: `free_cb` is replaced by `user_p`.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_external_string` in earlier versions.*\n\n**Example**\n\n```c\n{\n  const char* string_p = \"a large and immutable string: this is a story about ....\";\n  jerry_value_t string_value = jerry_string_external_sz (string_p, NULL);\n\n  ... // usage of string_value\n\n  jerry_value_free (string_value);\n}\n```\n\n**See also**\n\n- [jerry_string_external](#jerry_string_external)\n- [jerry_string_external_on_free](#jerry_string_external_on_free)\n\n\n## jerry_string_external\n\n**Summary**\n\nCreate an external string from a valid CESU8 string. The string buffer passed to the function\nshould not be modified until the free callback is called. This function can be used to avoid\nthe duplication of large strings.\n\n*Note*:\n- The free callback can be set by [jerry_string_external_on_free](#jerry_string_external_on_free)\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_string_external (const jerry_char_t *str_p,\n                       jerry_size_t str_size,\n                       void *user_p);\n```\n\n- `str_p` - non-null pointer to string\n- `str_size` - size of the string\n- `user_p` - user pointer passed to the callback when the string is freed\n- return value - value of the created string\n\n*Introduced in version 2.4*.\n\n*Updated in version 3.0*: `free_cb` is replaced by `user_p`.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_external_string_sz` in earlier versions.*\n\n**Example**\n\n```c\n{\n  const char* string_p = \"a large and immutable string: this is a story about ....\";\n  jerry_value_t string_value = jerry_string_external ((const jerry_char_t *) string_p,\n                                                      strlen (string_p),\n                                                      NULL);\n\n  ... // usage of string_value\n\n  jerry_value_free (string_value);\n}\n\n```\n\n**See also**\n\n- [jerry_validate_string](#jerry_validate_string)\n- [jerry_string_external_sz](#jerry_string_external_sz)\n- [jerry_string_external_on_free](#jerry_string_external_on_free)\n\n\n## jerry_symbol_with_description\n\n**Summary**\n\nCreate symbol from an API value.\n\n*Note*:\n- The given argument is converted to string. This operation can throw an exception.\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_symbol_with_description (const jerry_value_t value)\n```\n\n- `value` - API value\n- return value\n  - value of the created symbol, if success\n  - thrown exception, otherwise\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_symbol` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t string_value = jerry_string_sz (\"Symbol description string\");\n  jerry_value_t symbol_value = jerry_symbol_with_description (string_value);\n\n  // The description value is no longer needed\n  jerry_value_free (string_value);\n\n  // usage of symbol_value\n\n  jerry_value_free (symbol_value);\n\n  jerry_cleanup ();\n}\n```\n\n**See also**\n\n- [jerry_value_is_symbol](#jerry_value_is_symbol)\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_bigint\n\n**Summary**\n\nCreate BigInt value from uint64 digits\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_BIGINT`) and can be checked\n  in runtime with the `JERRY_FEATURE_BIGINT` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_bigint (const uint64_t *digits_p, uint32_t size, bool sign)\n```\n\n- `digits_p` - array of uint64 digits, least significant digit first\n- `size` - size of the `digits_p` array\n- `sign` - false if the created value should be positive, and true if the created value should be negative\n- return value\n  - value of the created bigint, if success\n  - thrown exception, otherwise\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_bigint` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  uint64_t digits[2] = { 0x1, 0x1 };\n  jerry_value_t bigint_value = jerry_bigint (digits, 2, true);\n\n  // usage of bigint_value\n\n  jerry_value_free (bigint_value);\n\n  jerry_cleanup ();\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n- [jerry_value_is_bigint](#jerry_value_is_bigint)\n- [jerry_bigint_to_digits](#jerry_bigint_to_digits)\n\n\n## jerry_regexp_sz\n\n**Summary**\n\nReturns a RegExp object created from the argument of a zero-terminated UTF-8 string pattern, or an exception\nif the construction of the object fails. Optional flags can be set using [jerry_regexp_flags_t](#jerry_regexp_flags_t).\nThese flags can be combined together with the binary OR operator or used on their own as enum values.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n```c\njerry_value_t\njerry_regexp_sz (const jerry_char_t *pattern_p, uint16_t flags);\n```\n\n- `pattern_p` - the RegExp pattern as a zero-terminated UTF-8 string\n- `flags` - optional flags for the RegExp object, see [jerry_regexp_flags_t](#jerry_regexp_flags_t)\n- return value - the RegExp object as a `jerry_value_t`\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_regexp` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_char_t pattern_p = \"[cgt]gggtaaa|tttaccc[acg]\";\n  uint16_t pattern_flags = JERRY_REGEXP_FLAG_IGNORE_CASE;\n\n  jerry_value_t regexp = jerry_regexp_sz (pattern_p, pattern_flags);\n\n  ...\n\n  jerry_value_free (regexp);\n}\n```\n\n\n## jerry_regexp\n\n**Summary**\n\nReturns a RegExp object from the argument pattern, or an exception if the construction of the object fails. Optional\nflags can be set using [jerry_regexp_flags_t](#jerry_regexp_flags_t). These flags can be combined together with the\nbinary OR operator or used on their own as enum values.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n```c\njerry_value_t\njerry_regexp (const jerry_value_t pattern, uint16_t flags);\n```\n\n- `pattern_p` - the RegExp pattern as a zero-terminated UTF-8 string\n- `pattern_size` - size of the `pattern`\n- `flags` - optional flags for the RegExp object, see [jerry_regexp_flags_t](#jerry_regexp_flags_t)\n- return value - the RegExp object as a `jerry_value_t`\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_regexp_sz` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_char_t pattern_p = \"[cgt]gggtaaa|tttaccc[acg]\";\n  jerry_size_t pattern_size = sizeof (pattern_p) - 1;\n  jerry_value_t pattern_str = jerry_string (pattern_p, pattern_size, JERRY_ENCODING_UTF8);\n\n  uint16_t pattern_flags = JERRY_REGEXP_FLAG_IGNORE_CASE;\n\n  jerry_value_t regexp = jerry_regexp (pattern_str, pattern_flags);\n  jerry_value_free (pattern_str);\n\n  ...\n\n  jerry_value_free (regexp);\n}\n```\n\n\n## jerry_typedarray\n\n**Summary**\n\nCreate a jerry_value_t representing an TypedArray object.\n\nFor the new object the type of the TypedArray (see: [jerry_typedarray_type_t](#jerry_typedarray_type_t))\nand element count can be specified.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n- This API depends on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\n  in runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_typedarray (jerry_typedarray_type_t type_name, jerry_length_t item_count);\n```\n\n- `type_name` - type of TypedArray to create\n- `item_count` - number of items in the new TypedArray\n- return value - the new TypedArray as a `jerry_value_t`\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_typedarray` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t array = jerry_typedarray (JERRY_TYPEDARRAY_UINT16, 15);\n\n  ... // use the TypedArray\n\n  jerry_value_free (array);\n}\n```\n\n**See also**\n\n- [jerry_typedarray_type_t](#jerry_typedarray_type_t)\n- [jerry_value_is_typedarray](#jerry_value_is_typedarray)\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_typedarray_with_buffer\n\n**Summary**\n\nCreate a jerry_value_t representing an TypedArray object using\nan already existing ArrayBuffer object.\n\nFor the new object the type of the TypedArray (see: [jerry_typedarray_type_t](#jerry_typedarray_type_t))\nand element count can be specified.\n\nThe developer must ensure that the ArrayBuffer has the correct length for the given\ntype of TypedArray otherwise an exception is generated.\n\nThe JavaScript equivalent of this function is: `new %TypedArray%(arraybuffer)` where `%TypedArray%` is\none of the allowed TypedArray functions.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n- This API depends on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\n  in runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_typedarray_with_buffer (jerry_typedarray_type_t type_name,\n                              const jerry_value_t arraybuffer);\n```\n\n- `type_name` - type of TypedArray to create\n- `arraybuffer` - the ArrayBuffer to use for the new TypedArray\n- return value\n  - the new TypedArray as a `jerry_value_t`\n  - exception if the ArrayBuffer does not have enough space for the given type of TypedArray\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_typedarray_for_arraybuffer` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t buffer = jerry_array_buffer (12 * 2);\n  jerry_value_t array = jerry_typedarray_with_buffer (JERRY_TYPEDARRAY_UINT16, buffer);\n  jerry_value_free (buffer);\n\n  ... // use the TypedArray\n\n  jerry_value_free (array);\n}\n```\n\n**See also**\n\n- [jerry_typedarray_type_t](#jerry_typedarray_type_t)\n- [jerry_value_is_typedarray](#jerry_value_is_typedarray)\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_typedarray_with_buffer_span\n\n**Summary**\n\nCreate a jerry_value_t representing an TypedArray object using\nan already existing ArrayBuffer object and by specifying the byteOffset, and length properties.\n\nFor the new object the type of the TypedArray (see: [jerry_typedarray_type_t](#jerry_typedarray_type_t))\nand element count can be specified.\n\nThe developer must ensure that the ArrayBuffer has the correct length for the given\ntype of TypedArray otherwise an exception is generated.\n\nThe JavaScript equivalent of this function is: `new %TypedArray%(arraybuffer, byteOffset, length)` where `%TypedArray%` is\none of the allowed TypedArray functions.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n- This API depends on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\n  in runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_typedarray_with_buffer_span (jerry_typedarray_type_t type_name,\n                                   const jerry_value_t arraybuffer,\n                                   jerry_length_t byte_offset,\n                                   jerry_length_t length);\n```\n\n- `type_name` - type of TypedArray to create\n- `arraybuffer` - the ArrayBuffer to use for the new TypedArray\n- `byte_offset` - start offset to use for the ArrayBuffer\n- `length` - number of elements to used from the ArrayBuffer (this is not the same as the byteLength)\n- return value\n  - the new TypedArray as a `jerry_value_t`\n  - exception if the ArrayBuffer does not have enough space for the given type of TypedArray\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_typedarray_for_arraybuffer_sz` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t buffer = jerry_array_buffer (12 * 2);\n  jerry_value_t array = jerry_typedarray_with_buffer_span (JERRY_TYPEDARRAY_UINT16, buffer, 4, 10);\n  jerry_value_free (buffer);\n\n  ... // use the TypedArray\n\n  jerry_value_free (array);\n}\n```\n\n**See also**\n\n- [jerry_typedarray_type_t](#jerry_typedarray_type_t)\n- [jerry_value_is_typedarray](#jerry_value_is_typedarray)\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_container\n\n**Summary**\n\nCreate a jerry_value_t representing a given type container object.\n\n*Note*:\n- This method is expected to work the same way as the JavaScript Map constructor.\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n- This API depends on a build option (`JERRY_BUILTIN_CONTAINER`) and can be checked\n  in runtime with the `JERRY_FEATURE_MAP, JERRY_FEATURE_SET, JERRY_FEATURE_WEAKMAP, JERRY_FEATURE_WEAKSET`\n  feature enum values.\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_container (jerry_container_type_t container_type,\n                 const jerry_value_t *arguments_list_p,\n                 jerry_length_t arguments_list_len);\n```\n\n- `container_type` - Type of the container to be created, see `jerry_container_type_t`.\n- `arguments_list_p` - The arguments passed to the container constructor to be inserted to the container.\n- `arguments_list_len` - The length of the above arguments.\n- return value - the new container object as a `jerry_value_t`\n\n*Introduced in version 2.3*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_container` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n  jerry_char_t src[] = \"[1,2,3,4].entries()\";\n  jerry_value_t iterable = jerry_eval (src, sizeof (src) - 1, JERRY_PARSE_NO_OPTS);\n\n  jerry_value_t map = jerry_container (JERRY_CONTAINER_TYPE_MAP, &iterable, 1);\n  jerry_value_free (iterable);\n\n  // use the Map\n\n  jerry_value_free (map);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_container_type_t](#jerry_container_type_t)\n- [jerry_container_type](#jerry_container_type)\n\n\n## jerry_undefined\n\n**Summary**\n\nCreates a `jerry_value_t` representing an undefined value.\n\n*Note*:\n- The undefined value is a fixed constant. Its value can be copied any number of\n  times without calling [jerry_value_copy](#jerry_value_copy), and freeing it\n  with [jerry_value_free](#jerry_value_free) is optional.\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_undefined (void);\n```\n\n- return value - value of undefined\n\n*Renamed in version 3.0, it was previously known as `jerry_create_undefined` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t undefined_value = jerry_undefined ();\n\n  ... // usage of the value\n\n  jerry_value_free (undefined_value);\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n\n## jerry_realm\n\n**Summary**\n\nCreates a `jerry_value_t` representing a new global object.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free)\n  when it is no longer needed.\n- This API depends on a build option (`JERRY_BUILTIN_REALMS`) and can be checked\n  in runtime with the `JERRY_FEATURE_REALM` feature enum value.\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_realm (void);\n```\n\n- return value - realm object value\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_create_realm` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t realm_value = jerry_realm ();\n\n  // usage of the value\n\n  jerry_value_free (realm_value);\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_value_free](#jerry_value_free)\n\n\n# General API functions of JS objects\n\n## jerry_object_has\n\n**Summary**\n\nChecks whether the object or its prototype objects have the given property.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_has (const jerry_value_t obj_val,\n                  const jerry_value_t prop_name_val);\n```\n\n- `obj_val` - object value\n- `prop_name_val` - property name\n- return value - JavaScript value that evaluates to\n  -  exception - if the operation fail\n  -  true/false API value - depend on whether the property exists\n\n*Updated in version 2.0*: The return value type is now a JavaScript value and not a primitive boolean value.\n\n*Updated in version 2.3*: The return value can be an exception value.\n\n*Renamed in version 3.0, it was previously known as `jerry_has_property` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_object = jerry_current_realm ();\n  jerry_value_t prop_name = jerry_string_sz (\"handler_field\");\n\n  jerry_value_t has_prop_js = jerry_object_has (global_object, prop_name);\n  bool has_prop = jerry_value_is_true (has_prop_js);\n\n  jerry_value_free (has_prop_js);\n  jerry_value_free (prop_name);\n  jerry_value_free (global_object);\n\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object_has_own](#jerry_object_has_own)\n- [jerry_object_delete](#jerry_object_delete)\n\n\n## jerry_object_has_sz\n\n**Summary**\n\nChecks whether the object or its prototype objects have the given property.\n\n*Note*: Returned value must be freed with [jerry_value_free](#jerry_value_free) when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t jerry_object_has_sz (const jerry_value_t object, const char *key_p);\n```\n\n- `object` - object value\n- `key_p` - property name (zero-terminated string)\n- return value - JavaScript value that evaluates to\n  -  exception - if the operation fail\n  -  true/false API value - depend on whether the property exists\n\n*Introduced in version 3.0*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_object = jerry_current_realm ();\n\n  jerry_value_t has_prop_js = jerry_object_has_sz (global_object, \"handler_field\");\n  bool has_prop = jerry_value_is_true (has_prop_js);\n\n  jerry_value_free (has_prop_js);\n  jerry_value_free (global_object);\n\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object_has](#jerry_object_has)\n\n\n## jerry_object_has_own\n\n**Summary**\n\nChecks whether the object has the given property.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_has_own (const jerry_value_t obj_val,\n                      const jerry_value_t prop_name_val);\n```\n\n- `obj_val` - object value\n- `prop_name_val` - property name\n- return value - JavaScript value that evaluates to\n  -  exception - if the operation fails\n  -  true/false API value - depend on whether the property exists\n\n*Updated in version 2.0*: The return value type is now a JavaScript value and not a primitive boolean value.\n\n*Updated in version 2.3*: The return value can be an exception value.\n\n*Renamed in version 3.0, it was previously known as `jerry_has_own_property` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_object = jerry_current_realm ();\n  jerry_value_t prop_name = jerry_string_sz (\"handler_field\");\n\n  jerry_value_t has_prop_js = jerry_object_has_own (global_object, prop_name);\n  bool has_prop = jerry_value_is_true (has_prop_js);\n\n  jerry_value_free (has_prop_js);\n  jerry_value_free (prop_name);\n  jerry_value_free (global_object);\n\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object_has](#jerry_object_has)\n- [jerry_object_delete](#jerry_object_delete)\n\n\n## jerry_object_has_internal\n\n**Summary**\n\nChecks whether the object has the given internal property.\n\n*Note*:\n- Properties which were not created with [jerry_object_set_internal](#jerry_object_set_internal)\n  are excluded during the operation.\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\nbool\njerry_object_has_internal (const jerry_value_t obj_val,\n                           const jerry_value_t prop_name_val);\n```\n\n- `obj_val` - object value\n- `prop_name_val` - property name\n- return value\n  - true, if the property exists\n  - false, otherwise\n\n*Introduced in version 2.2*.\n\n*Renamed in version 3.0, it was previously known as `jerry_has_internal_property` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_object = jerry_current_realm ();\n  jerry_value_t prop_name = jerry_string_sz (\"hidden_property\");\n\n  bool has_internal_js_prop = jerry_object_has_internal (global_object, prop_name);\n\n  jerry_value_free (prop_name);\n  jerry_value_free (global_object);\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object_delete_internal](#jerry_object_delete_internal)\n- [jerry_object_get_internal](#jerry_object_get_internal)\n- [jerry_object_set_internal](#jerry_object_set_internal)\n\n\n## jerry_object_delete\n\n**Summary**\n\nDelete a property from an object.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_delete (const jerry_value_t obj_val,\n                     const jerry_value_t prop_name_val);\n```\n\n- `obj_val` - object value\n- `prop_name_val` - property name\n- return value\n  - true, if property was deleted successfully\n  - exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_delete_property` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t global_object = jerry_current_realm ();\n  jerry_value_t prop_name = jerry_string_sz (\"my_prop\");\n\n  jerry_value_t delete_result = jerry_object_delete (global_object, prop_name);\n  /* use \"delete_result\" */\n\n  jerry_value_free (delete_result);\n  jerry_value_free (prop_name);\n  jerry_value_free (global_object);\n}\n```\n\n**See also**\n\n- [jerry_object_has](#jerry_object_has)\n- [jerry_object_has_own](#jerry_object_has_own)\n- [jerry_object_delete_index](#jerry_object_delete_index)\n- [jerry_object_get](#jerry_object_get)\n\n\n## jerry_object_delete_sz\n\n**Summary**\n\nDelete a property from an object.\n\n**Prototype**\n\n```c\njerry_value_t jerry_object_delete_sz (const jerry_value_t object, const char *key_p);\n```\n\n- `obj_val` - object value\n- `key_p` - property name (zero-terminated string)\n- return value\n  - true, if property was deleted successfully\n  - exception, otherwise\n\n*Introduced in version 3.0*\n\n**Example**\n\n```c\n{\n  jerry_value_t global_object = jerry_current_realm ();\n\n  jerry_value_t delete_result = jerry_object_delete_sz (global_object, \"my_prop\");\n  /* use \"delete_result\" */\n\n  jerry_value_free (delete_result);\n  jerry_value_free (global_object);\n}\n```\n\n**See also**\n\n- [jerry_object_delete](#jerry_object_delete)\n\n\n## jerry_object_delete_index\n\n**Summary**\n\nDelete indexed property from the specified object.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_delete_index (const jerry_value_t obj_val,\n                           uint32_t index);\n```\n\n- `obj_val` - object value\n- `index` - index number\n- return value\n  - true value, if property was deleted successfully\n  - exception, otherwise\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_delete_property_by_index` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t object;\n\n  ... // create or copy object\n\n  jerry_value_t delete_result = jerry_object_delete_index (object, 5);\n\n  jerry_value_free (delete_result);\n  jerry_value_free (object);\n}\n```\n\n**See also**\n\n- [jerry_object_has](#jerry_object_has)\n- [jerry_object_has_own](#jerry_object_has_own)\n- [jerry_object_delete](#jerry_object_delete)\n- [jerry_object_get](#jerry_object_get)\n- [jerry_object_set](#jerry_object_set)\n- [jerry_object_get_index](#jerry_object_get_index)\n- [jerry_object_set_index](#jerry_object_set_index)\n\n## jerry_object_delete_internal\n\n**Summary**\n\nDelete an internal property from an object.\n\n*Note*:\n- Properties which were not created with [jerry_object_set_internal](#jerry_object_set_internal)\n  are excluded during the operation.\n\n**Prototype**\n\n```c\nbool\njerry_object_delete_internal (const jerry_value_t obj_val,\n                              const jerry_value_t prop_name_val);\n```\n\n- `obj_val` - object value\n- `prop_name_val` - property name\n- return value\n  - true, if property was deleted successfully\n  - false, otherwise\n\n*Introduced in version 2.2*.\n\n*Renamed in version 3.0, it was previously known as `jerry_delete_internal_property` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t global_object = jerry_current_realm ();\n  jerry_value_t prop_name = jerry_string_sz (\"hidden_property\");\n\n  bool delete_result = jerry_object_delete_internal (global_object, prop_name);\n  /* use \"delete_result\" */\n\n  jerry_value_free (prop_name);\n  jerry_value_free (global_object);\n}\n```\n\n**See also**\n\n- [jerry_object_has_internal](#jerry_object_has_internal)\n- [jerry_object_get_internal](#jerry_object_get_internal)\n- [jerry_object_set_internal](#jerry_object_set_internal)\n\n\n## jerry_object_get\n\n**Summary**\n\nGet value of a property to the specified object with the given name.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_get (const jerry_value_t obj_val,\n                  const jerry_value_t prop_name_val);\n```\n\n- `obj_val` - object value\n- `prop_name_val` - property name\n- return value\n  - value of property, if success\n  - thrown exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_get_property` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_object = jerry_current_realm ();\n  jerry_value_t prop_name = jerry_string_sz (\"Object\");\n\n  jerry_value_t prop_value = jerry_object_get (global_object, prop_name);\n\n  /* use \"prop_value\" then release it. */\n\n  jerry_value_free (prop_value);\n  jerry_value_free (prop_name);\n  jerry_value_free (global_object);\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object_has](#jerry_object_has)\n- [jerry_object_has_own](#jerry_object_has_own)\n- [jerry_object_delete](#jerry_object_delete)\n- [jerry_object_delete_index](#jerry_object_delete_index)\n- [jerry_object_set](#jerry_object_set)\n- [jerry_object_get_index](#jerry_object_get_index)\n- [jerry_object_set_index](#jerry_object_set_index)\n\n\n## jerry_object_get_sz\n\n**Summary**\n\nGet value of a property to the specified object with the given name.\n\n*Note*: Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\nis no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t jerry_object_get_sz (const jerry_value_t object, const char *key_p);\n```\n\n- `obj_val` - object value\n- `key_p` - property name (zero-terminated string)\n- return value\n  - value of property, if success\n  - thrown exception, otherwise\n\n*Introduced in version 3.0*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_object = jerry_current_realm ();\n\n  jerry_value_t prop_value = jerry_object_get_sz (global_object, \"Object\");\n\n  /* use \"prop_value\" then release it. */\n\n  jerry_value_free (prop_value);\n  jerry_value_free (global_object);\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object_get](#jerry_object_get)\n\n\n## jerry_object_get_index\n\n**Summary**\n\nGet value by an index from the specified object.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_get_index (const jerry_value_t obj_val,\n                        uint32_t index);\n```\n\n- `obj_val` - object value\n- `index` - index number\n- return value\n  - stored value on the specified index, if success\n  - thrown exception, otherwise.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_property_by_index` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t object;\n\n  ... // create or copy object\n\n  jerry_value_t value = jerry_object_get_index (object, 5);\n\n  ...\n\n  jerry_value_free (value);\n  jerry_value_free (object);\n}\n```\n\n**See also**\n\n- [jerry_object_has](#jerry_object_has)\n- [jerry_object_has_own](#jerry_object_has_own)\n- [jerry_object_delete](#jerry_object_delete)\n- [jerry_object_delete_index](#jerry_object_delete_index)\n- [jerry_object_get](#jerry_object_get)\n- [jerry_object_set](#jerry_object_set)\n- [jerry_object_set_index](#jerry_object_set_index)\n\n## jerry_object_find_own\n\n**Summary**\n\nGet the own property value of an object with the given name. The function tells\nwhether the property is found, and the receiver object can be specified as well.\nThe receiver is passed as the `this` argument for getters, and the receiver\nargument for Proxy `get` traps.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it is no longer needed.\n- The `found_p` argument is ignored if its value is NULL.\n- The target value of `found_p` argument is set to false when the arguments are invalid, e.g. `obj_val` is not an object.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_find_own (const jerry_value_t obj_val,\n                       const jerry_value_t prop_name_val,\n                       const jerry_value_t receiver_val,\n                       bool *found_p);\n```\n\n- `obj_val` - object value\n- `prop_name_val` - property name\n- `receiver_val` - receiver object\n- `found_p` - [out] true, if the property is found or obj_val is a Proxy object, false otherwise\n- return value\n  - value of property, if success\n  - thrown exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_get_own_property` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n#include \"stdio.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_object = jerry_current_realm ();\n  jerry_value_t prop_name = jerry_string_sz (\"Object\");\n\n  bool found;\n  jerry_value_t prop_value = jerry_object_find_own (global_object, prop_name, global_object, &found);\n\n  if (found)\n  {\n    printf (\"Property is found!\\n\");\n  }\n\n  /* use \"prop_value\" then release it. */\n\n  jerry_value_free (prop_value);\n  jerry_value_free (prop_name);\n  jerry_value_free (global_object);\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object_get](#jerry_object_get)\n- [jerry_object_get_index](#jerry_object_get_index)\n\n## jerry_object_get_internal\n\n**Summary**\n\nGet value of an internal property to the specified object with the given name.\n\n*Note*:\n- Properties which were not created with [jerry_object_set_internal](#jerry_object_set_internal)\n  are excluded during the operation.\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_get_internal (const jerry_value_t obj_val,\n                           const jerry_value_t prop_name_val);\n```\n\n- `obj_val` - object value\n- `prop_name_val` - property name\n- return value\n  - value of property, if the internal property exists\n  - undefined value, if the, if the internal does not property exists\n  - thrown exception, otherwise\n\n*Introduced in version 2.2*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_internal_property` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_object = jerry_current_realm ();\n  jerry_value_t prop_name = jerry_string_sz (\"hidden_property\");\n\n  jerry_value_t prop_value = jerry_object_get_internal (global_object, prop_name);\n\n  /* use \"prop_value\" then release it. */\n\n  jerry_value_free (prop_value);\n  jerry_value_free (prop_name);\n  jerry_value_free (global_object);\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object_has_internal](#jerry_object_has_internal)\n- [jerry_object_delete_internal](#jerry_object_delete_internal)\n- [jerry_object_set_internal](#jerry_object_set_internal)\n\n\n## jerry_object_set\n\n**Summary**\n\nSet a property to the specified object with the given name.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_set (const jerry_value_t obj_val,\n                  const jerry_value_t prop_name_val,\n                  const jerry_value_t value_to_set)\n```\n\n- `obj_val` - object value\n- `prop_name_val` - property name\n- `value_to_set` - value to set\n- return value\n  - true, if success\n  - thrown exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_set_property` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t value_to_set;\n\n  ... // create or copy value to set\n\n  jerry_value_t glob_obj = jerry_current_realm ();\n  jerry_value_t prop_name = jerry_string_sz (\"my_prop\");\n\n  jerry_value_t set_result = jerry_object_set (glob_obj, prop_name, value_to_set);\n\n  ... // check result of property set call\n\n  jerry_value_free (set_result);\n  jerry_value_free (prop_name);\n\n  ...\n\n  jerry_value_free (value_to_set);\n  jerry_value_free (glob_obj);\n}\n```\n\n**See also**\n\n- [jerry_object_has](#jerry_object_has)\n- [jerry_object_has_own](#jerry_object_has_own)\n- [jerry_object_delete](#jerry_object_delete)\n- [jerry_object_delete_index](#jerry_object_delete_index)\n- [jerry_object_get](#jerry_object_get)\n- [jerry_object_get_index](#jerry_object_get_index)\n- [jerry_object_set_index](#jerry_object_set_index)\n\n\n## jerry_object_set_sz\n\n**Summary**\n\nSet a property to the specified object with the given name.\n\n*Note*: Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\nis no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t jerry_object_set_sz (jerry_value_t object, const char *key_p, const jerry_value_t value);\n```\n\n- `obj_val` - object value\n- `key_p` - property name (zero-terminated string)\n- `value_to_set` - value to set\n- return value\n  - true, if success\n  - thrown exception, otherwise\n\n*Introduced in version 3.0*\n\n**Example**\n\n```c\n{\n  jerry_value_t value_to_set;\n\n  ... // create or copy value to set\n\n  jerry_value_t glob_obj = jerry_current_realm ();\n\n  jerry_value_t set_result = jerry_object_set_sz (glob_obj, \"my_prop\", value_to_set);\n\n  ... // check result of property set call\n\n  jerry_value_free (set_result);\n\n  ...\n\n  jerry_value_free (value_to_set);\n  jerry_value_free (glob_obj);\n}\n```\n\n**See also**\n\n- [jerry_object_set](#jerry_object_set)\n\n\n## jerry_object_set_index\n\n**Summary**\n\nSet indexed value in the specified object\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_set_index (const jerry_value_t obj_val,\n                        uint32_t index,\n                        const jerry_value_t value_to_set);\n```\n\n- `obj_val` - object value\n- `index` - index number\n- `value_to_set` - value to set\n- return value\n  - true, if field value was set successfully\n  - thrown exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_set_property_by_index` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t object;\n  jerry_value_t value_to_set;\n\n  ... // create or copy object and value to set\n\n  jerry_value_t ret_val = jerry_object_set_index (object, 5, value_to_set);\n\n  ...\n\n  jerry_value_free (value_to_set);\n  jerry_value_free (ret_val);\n  jerry_value_free (object);\n}\n```\n\n**See also**\n\n- [jerry_object_has](#jerry_object_has)\n- [jerry_object_has_own](#jerry_object_has_own)\n- [jerry_object_delete](#jerry_object_delete)\n- [jerry_object_delete_index](#jerry_object_delete_index)\n- [jerry_object_get](#jerry_object_get)\n- [jerry_object_set](#jerry_object_set)\n- [jerry_object_get_index](#jerry_object_get_index)\n\n\n## jerry_object_set_internal\n\n**Summary**\n\nSet an internal property to the specified object with the given name.\n\n*Note*:\n- The property cannot be accessed from the JavaScript context, only from the public API.\n- It is different from [jerry_object_set_native_ptr](#jerry_object_set_native_ptr) in that any jerry API value\n  can be hidden from the JavaScript context, not only native pointers.\n\n**Prototype**\n\n```c\nbool\njerry_object_set_internal (const jerry_value_t obj_val,\n                           const jerry_value_t prop_name_val,\n                           const jerry_value_t value_to_set)\n```\n\n- `obj_val` - object value\n- `prop_name_val` - property name\n- `value_to_set` - value to set\n- return value\n  - true, if success\n  - thrown exception, otherwise\n\n*Introduced in version 2.2*.\n\n*Renamed in version 3.0, it was previously known as `jerry_set_internal_property` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_object = jerry_current_realm ();\n  jerry_value_t prop_name = jerry_string_sz (\"hidden_property\");\n  jerry_value_t value_to_set = jerry_number (5);\n\n  bool set_result = jerry_object_set_internal (global_object, prop_name, value_to_set);\n\n  /* check the result of internal property set call */\n\n  jerry_value_free (value_to_set);\n  jerry_value_free (prop_name);\n  jerry_value_free (global_object);\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object_has_internal](#jerry_object_has_internal)\n- [jerry_object_delete_internal](#jerry_object_delete_internal)\n- [jerry_object_get_internal](#jerry_object_get_internal)\n\n\n## jerry_property_descriptor\n\n**Summary**\n\nCreate a property descriptor and initialize it with default values. This means that all fields in\nthe `jerry_property_descriptor_t` struct will be set to zero or false depending on the field's type.\n\n**Prototype**\n\n```c\njerry_property_descriptor_t\njerry_property_descriptor (void);\n```\n\n*Renamed in version 3.0, it was previously known as `jerry_property_descriptor_create` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n\n  ... // usage of prop_desc\n\n  jerry_property_descriptor_free (&prop_desc);\n}\n```\n\nFor a more complete example see [jerry_object_define_own_prop](#jerry_object_define_own_prop).\n\n**See also**\n\n- [jerry_property_descriptor_t](#jerry_property_descriptor_t)\n- [jerry_object_define_own_prop](#jerry_object_define_own_prop)\n- [jerry_object_get_own_prop](#jerry_object_get_own_prop)\n- [jerry_property_descriptor_free](#jerry_property_descriptor_free)\n\n\n## jerry_object_define_own_prop\n\n**Summary**\n\nDefine a property to the specified object with the given name.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_define_own_prop (const jerry_value_t obj_val,\n                              const jerry_value_t prop_name_val,\n                              const jerry_property_descriptor_t *prop_desc_p);\n```\n\n- `obj_val` - target object where the property should be registered\n- `prop_name_val` - property name\n- `prop_desc_p` - pointer to property descriptor\n- return value\n  - true, if success\n  - thrown exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_define_own_property` in earlier versions.*\n\n**Example**\n\nRegistering a simple value property via the `jerry_object_define_own_prop` method:\n\n[doctest]: # (name=\"02.API-REFERENCE-define-property.c\")\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_obj_val = jerry_current_realm ();\n\n  // configure the property\n  jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n\n  // create or copy value to set\n  // For example:\n  jerry_value_t value_to_set = jerry_number (33);\n\n  // set the property descriptor fields:\n  // set the \"JERRY_PROP_IS_VALUE_DEFINED\" flag to indicate the \"value\"\n  //  field should be used during the property registration.\n  // set the writable, configurable, enumerable flags to true\n  prop_desc.flags |= (JERRY_PROP_IS_WRITABLE_DEFINED\n                      | JERRY_PROP_IS_WRITABLE\n                      | JERRY_PROP_IS_CONFIGURABLE_DEFINED\n                      | JERRY_PROP_IS_CONFIGURABLE\n                      | JERRY_PROP_IS_ENUMERABLE_DEFINED\n                      | JERRY_PROP_IS_ENUMERABLE\n                      | JERRY_PROP_IS_VALUE_DEFINED);\n\n  // set the \"value\" field to the number 33\n  prop_desc.value = value_to_set;\n\n  // add the property as \"my_prop\" for the global object\n  jerry_value_t prop_name = jerry_string_sz (\"my_prop\");\n  jerry_value_t return_value = jerry_object_define_own_prop (global_obj_val, prop_name, &prop_desc);\n  if (jerry_value_is_exception (return_value))\n  {\n    // there was an error\n  }\n\n  // re-define the property with the enumerable flag set to false\n  prop_desc.flags &= (uint16_t) ~JERRY_PROP_IS_ENUMERABLE;\n  return_value = jerry_object_define_own_prop (global_obj_val, prop_name, &prop_desc);\n  if (jerry_value_is_exception (return_value))\n  {\n    // there was an error\n  }\n\n  // if there was no exception at this point the global object should have a \"my_prop\" property\n\n  jerry_value_free (return_value);\n  jerry_value_free (prop_name);\n\n  jerry_property_descriptor_free (&prop_desc);\n  jerry_value_free (global_obj_val);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n\nRegistering a getter/setter property via the `jerry_object_define_own_prop` method:\n\n[doctest]: # (name=\"02.API-REFERENCE-define-property-getset.c\")\n\n```c\n#include <stdio.h>\n#include <string.h>\n#include \"jerryscript.h\"\n\nstatic int counter = 0;\n\nstatic jerry_value_t\nmethod_getter (const jerry_call_info_t *call_info_p,\n               const jerry_value_t args[],\n               const jerry_length_t argc)\n{\n  counter++;\n  printf(\"Getter called, returning: %d\\n\", counter);\n\n  return jerry_number (counter);\n}\n\nstatic jerry_value_t\nmethod_setter (const jerry_call_info_t *call_info_p,\n               const jerry_value_t args[],\n               const jerry_length_t argc)\n{\n  // Note: the arguments count and type should be checked\n  // in this example it is omitted!\n\n  double new_value = jerry_value_as_number (args[0]);\n  counter = (int) new_value;\n\n  printf(\"Setter called, setting: %d\\n\", counter);\n\n  return jerry_undefined ();\n}\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_obj_val = jerry_current_realm ();\n\n  // configure the property\n  jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n\n  // set the property descriptor fields:\n\n  prop_desc.flags |= JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED;\n  prop_desc.getter = jerry_function_external (method_getter);\n  prop_desc.setter = jerry_function_external (method_setter);\n\n  // add the property as \"my_prop\" for the global object\n  jerry_value_t prop_name = jerry_string_sz (\"my_prop\");\n  jerry_value_t return_value = jerry_object_define_own_prop (global_obj_val, prop_name, &prop_desc);\n  if (jerry_value_is_exception (return_value))\n  {\n    // there was an error\n  }\n\n  // if there was no exception at this point the global object should have a \"my_prop\" property\n\n  jerry_value_free (return_value);\n  jerry_value_free (prop_name);\n\n  jerry_property_descriptor_free (&prop_desc);\n  jerry_value_free (global_obj_val);\n\n  // run an example js code to use the getter/setters\n\n  const char *src_p = \"this.my_prop; this.my_prop; this.my_prop = 4; this.my_prop\";\n  jerry_value_t eval_result = jerry_eval ((const jerry_char_t *) src_p, strlen (src_p), JERRY_PARSE_NO_OPTS);\n\n  // \"eval_result\" is the last result of \"this.my_prop\" that is \"5\" currently.\n  double result_number = jerry_value_as_number (eval_result);\n  printf(\"output: %lf\\n\", result_number);\n\n  jerry_cleanup ();\n\n  return result_number != 5.0;\n}\n```\n\n**See also**\n\n- [jerry_property_descriptor_t](#jerry_property_descriptor_t)\n- [jerry_property_descriptor](#jerry_property_descriptor)\n- [jerry_object_get_own_prop](#jerry_object_get_own_prop)\n- [jerry_property_descriptor_free](#jerry_property_descriptor_free)\n\n\n## jerry_object_get_own_prop\n\n**Summary**\n\nConstruct property descriptor from specified property.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_get_own_prop (const jerry_value_t obj_val,\n                           const jerry_value_t prop_name_val,\n                           jerry_property_descriptor_t *prop_desc_p);\n```\n\n- `obj_val` - object value\n- `prop_name_val` - property name\n- `prop_desc_p` - pointer to property descriptor\n- return value\n\n*Renamed in version 3.0, it was previously known as `jerry_get_own_property_descriptor` in earlier versions. Return value type is changed to `jerry_value_t`.*\n\n**Example**\n\n```c\n{\n  jerry_value_t global_obj_val = jerry_current_realm ();\n\n  jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n\n  jerry_value_t prop_name = jerry_string_sz (\"my_prop\");\n  jerry_object_get_own_prop (global_obj_val, prop_name, &prop_desc);\n  jerry_value_free (prop_name);\n\n  ... // usage of property descriptor\n\n  jerry_property_descriptor_free (&prop_desc);\n  jerry_value_free (global_obj_val);\n}\n```\n\n**See also**\n\n- [jerry_property_descriptor_t](#jerry_property_descriptor_t)\n- [jerry_property_descriptor](#jerry_property_descriptor)\n- [jerry_object_define_own_prop](#jerry_object_define_own_prop)\n- [jerry_property_descriptor_free](#jerry_property_descriptor_free)\n\n\n## jerry_property_descriptor_free\n\n**Summary**\n\nFree fields of property descriptor (setter, getter and value).\n\n**Prototype**\n\n```c\nvoid\njerry_property_descriptor_free (const jerry_property_descriptor_t *prop_desc_p);\n```\n\n- `prop_desc_p` - pointer to property descriptor\n\n*Introduced in version 3.0*: Replaces `jerry_free_property_descriptor_fields`.\n\n**Example**\n\n```c\n{\n  jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n\n  ... // usage of property descriptor\n\n  jerry_property_descriptor_free (&prop_desc);\n}\n```\n\n**See also**\n\n- [jerry_property_descriptor](#jerry_property_descriptor)\n- [jerry_object_define_own_prop](#jerry_object_define_own_prop)\n- [jerry_object_get_own_prop](#jerry_object_get_own_prop)\n\n\n## jerry_call\n\n**Summary**\n\nCall function specified by a function value. The argument values must not be exceptions.\nValue of `this` parameter should be set to `undefined` for non-method calls.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_call (const jerry_value_t func_obj_val,\n            const jerry_value_t this_val,\n            const jerry_value_t args_p[],\n            jerry_size_t args_count);\n```\n\n- `func_obj_val` - the function object to call\n- `this_val` - object for 'this' binding\n- `args_p` - function's call arguments\n- `args_count` - number of arguments\n- return value - returned jerry value of the called function\n\n*Renamed in version 3.0, it was previously known as `jerry_call_function` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t target_function;\n\n  ... // create or get \"target_function\"\n\n  if (jerry_value_is_function (target_function))\n  {\n    jerry_value_t this_val = jerry_undefined ();\n    jerry_value_t ret_val = jerry_call (target_function, this_val, NULL, 0);\n\n    if (!jerry_value_is_exception (ret_val))\n    {\n      ... // handle return value\n    }\n\n    jerry_value_free (ret_val);\n    jerry_value_free (this_val);\n  }\n\n  jerry_value_free (target_function);\n}\n```\n\n**See also**\n\n- [jerry_is_function](#jerry_is_function)\n- [jerry_function_external](#jerry_function_external)\n\n\n## jerry_construct\n\n**Summary**\n\nConstruct object, invoking specified function object as constructor.\nError flag must not be set for any arguments of this function.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_construct (const jerry_value_t func_obj_val,\n                 const jerry_value_t args_p[],\n                 jerry_size_t args_count);\n```\n\n- `func_obj_val` - function object to call\n- `args_p` - function's call arguments\n- `args_count` - number of arguments\n- return value - returned value of the invoked constructor\n\n*Renamed in version 3.0, it was previously known as `jerry_construct_object` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t val;\n\n  ... // receiving val\n\n  if (jerry_is_constructor (val))\n  {\n    jerry_value_t ret_val = jerry_construct (val, NULL, 0);\n\n    if (!jerry_value_is_exception (ret_val))\n    {\n      ... // handle return value\n    }\n\n    jerry_value_free (ret_val);\n  }\n}\n```\n\n**See also**\n\n - [jerry_is_constructor](#jerry_is_constructor)\n\n\n## jerry_object_keys\n\n**Summary**\n\nGet keys of the specified object value.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_keys (const jerry_value_t obj_val);\n```\n\n- `obj_val` - object value\n- return value\n  - array object value, if success\n  - thrown exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_get_object_keys` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t object;\n  ... // create or copy object\n\n  jerry_value_t keys_array = jerry_object_keys (object);\n\n  ... // usage of keys_array\n\n  jerry_value_free (keys_array);\n}\n```\n\n**See also**\n\n- [jerry_object_get](#jerry_object_get)\n- [jerry_object_set](#jerry_object_set)\n\n\n## jerry_object_proto\n\n**Summary**\n\nGet the prototype of the specified object.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_proto (const jerry_value_t obj_val);\n```\n\n- `obj_val` - object value\n- return value\n  - object value, if success\n  - null or thrown exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_get_prototype` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t object;\n  ... // create or copy object\n\n  jerry_value_t prototype = jerry_object_proto (object);\n\n  ... // usage of prototype object\n\n  jerry_value_free (prototype);\n  jerry_value_free (object);\n}\n```\n\n**See also**\n\n- [jerry_object_set_proto](#jerry_object_set_proto)\n\n\n## jerry_object_set_proto\n\n**Summary**\n\nSet the prototype of the specified object.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_set_proto (const jerry_value_t obj_val,\n                        const jerry_value_t proto_obj_val);\n```\n\n- `obj_val` - object value\n- `proto_obj_val` - prototype object value\n- return value\n  - true, if success\n  - thrown exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_set_prototype` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t object;\n  jerry_value_t prototype;\n\n  ... // create or copy object and prototype\n\n  jerry_value_t ret_val = jerry_object_set_proto (object, prototype);\n\n  jerry_value_free (ret_val);\n  jerry_value_free (prototype);\n  jerry_value_free (object);\n}\n```\n\n**See also**\n\n- [jerry_object_proto](#jerry_object_proto)\n\n\n## jerry_object_get_native_ptr\n\n**Summary**\n\nGet native pointer by the given type information.\nThe pointer and the type information are previously associated with the object by\n[jerry_object_set_native_ptr](#jerry_object_set_native_ptr).\n\n*Note*:\n- `native_info_p` can be NULL\n\n**Prototype**\n\n```c\nvoid *\njerry_object_get_native_ptr (const jerry_value_t object,\n                             const jerry_object_native_info_t *native_info_p)\n```\n\n- `object` - object value to get native pointer from.\n- `native_info_p` - native pointer's type information.\n- return value\n  - native pointer associated with the argument object for the given native type info\n\n*Introduced in version 2.0*: Changed from `jerry_get_object_native_handle`.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_object_native_pointer` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"jerryscript.h\"\n\ntypedef struct\n{\n  char *data_p;\n  unsigned int length;\n} buffer_native_object_t;\n\ntypedef struct\n{\n  int area;\n  int perimeter;\n} shape_native_object_t;\n\n#define SECRET_INFO ((void *) 42)\n\nstatic void\nbuffer_native_freecb (void *native_p,\n                      jerry_object_native_info_t *info_p)\n{\n  (void) info_p;\n\n  char *data_p = ((buffer_native_object_t*)native_p)->data_p;\n\n  if (data_p != NULL)\n  {\n    free (data_p);\n  }\n\n  free (native_p);\n}\n\nstatic void\nshape_native_freecb (void *native_p,\n                     jerry_object_native_info_t *info_p)\n{\n  (void) info_p;\n\n  free (native_p);\n}\n\nstatic void\ndestructor_freecb (void *native_p,\n                   jerry_object_native_info_t *info_p)\n{\n  (void) native_p;\n  (void) info_p;\n\n   printf(\"Note: the object has been freed\\n\");\n}\n\n// NOTE: The address (!) of type_info acts as a way to uniquely \"identify\" the\n// C type `buffer_native_object_t *`.\nstatic const jerry_object_native_info_t buffer_obj_type_info =\n{\n  .free_cb = buffer_native_freecb\n};\n\n// NOTE: The address (!) of type_info acts as a way to uniquely \"identify\" the\n// C type `shape_native_object_t *`.\nstatic const jerry_object_native_info_t shape_obj_type_info =\n{\n  .free_cb = shape_native_freecb\n};\n\n// NOTE: The address (!) of type_info is the unique \"identifier\"\nstatic const jerry_object_native_info_t destructor_obj_type_info =\n{\n  .free_cb = destructor_freecb\n};\n\nstatic void\nprint_buffer (char *data_p,\n              unsigned int length)\n{\n  for (unsigned int i = 0; i < length; ++i)\n  {\n    printf(\"%c\", data_p[i]);\n  }\n\n  printf(\"\\n\");\n}\n\nstatic void\ndo_stuff (jerry_value_t object)\n{\n  if (!jerry_object_has_native_ptr (object, &buffer_obj_type_info))\n  {\n    // Process the error\n    return;\n  }\n\n  void *native_p = jerry_object_get_native_ptr (object, &buffer_obj_type_info);\n\n  // It is safe to cast to buffer_native_object_t * and dereference the pointer:\n  buffer_native_object_t *buffer_p = (buffer_native_object_t *) native_p;\n  print_buffer (buffer_p->data_p, buffer_p->length); // Usage of buffer_p\n\n  bool need_shape_info = true; // implementation dependent\n\n  if (need_shape_info)\n  {\n    if (!jerry_object_has_native_ptr (object, &shape_obj_type_info))\n    {\n      // Process the error\n      return;\n    }\n\n    native_p = jerry_object_get_native_ptr (object, &shape_obj_type_info);\n\n    // It is safe to cast to shape_native_object_t * and dereference the pointer:\n    shape_native_object_t *shape_p = (shape_native_object_t *) native_p;\n\n    printf(\"Area: %d\\tPerimeter: %d\\n\", shape_p->area, shape_p->perimeter); // Usage of shape_p\n  }\n\n  bool need_secret_info = true; // implementation dependent\n\n  if (need_secret_info)\n  {\n    native_p = jerry_object_get_native_ptr (object, NULL);\n\n    if (native_p == NULL)\n    {\n      // Process the error\n      return;\n    }\n\n    printf(\"Secret: %d\\n\", (int)((uintptr_t) native_p)); // Usage of native_p\n\n    bool deleted = jerry_object_delete_native_ptr (object, NULL);\n\n    if (deleted)\n    {\n      printf(\"The secret is no longer available\\n\");\n    }\n  }\n}\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t object = jerry_object ();\n  buffer_native_object_t *buffer_p = (buffer_native_object_t *) malloc (sizeof (buffer_native_object_t));\n  buffer_p->length = 14;\n  buffer_p->data_p = (char *) malloc (buffer_p->length * sizeof (char));\n  memcpy (buffer_p->data_p, \"My buffer data\", buffer_p->length);\n  jerry_object_set_native_ptr (object, &buffer_obj_type_info, buffer_p);\n\n  shape_native_object_t *shape_p = (shape_native_object_t *) malloc (sizeof (shape_native_object_t));\n  shape_p->area = 6;\n  shape_p->perimeter = 12;\n  jerry_object_set_native_ptr (object, &shape_obj_type_info, shape_p);\n\n  // The native pointer can be NULL. This gives possibly to get notified via the native type info's\n  // free callback when the object has been freed by the GC.\n  jerry_object_set_native_ptr (object, &destructor_obj_type_info, NULL);\n\n  // The native type info can be NULL as well. In this case the registered property is simply freed\n  // when the object is freed by the GC.\n  jerry_object_set_native_ptr (object, NULL, SECRET_INFO);\n\n  do_stuff (object);\n\n  jerry_value_free (object);\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object](#jerry_object)\n- [jerry_object_set_native_ptr](#jerry_object_set_native_ptr)\n- [jerry_object_native_info_t](#jerry_object_native_info_t)\n\n\n## jerry_object_has_native_ptr\n\n**Summary**\n\nChecks whether the argument object has a native pointer set for the specified native type info.\n\n**Prototype**\n\n```c\nbool jerry_object_has_native_ptr (const jerry_value_t object, const jerry_object_native_info_t *native_info_p);\n```\n\n- `object` - object to set native pointer in\n- `native_info_p` - object's native type info\n- return value\n  - true if the native pointer has been set,\n  - false otherwise\n\n*Introduced in version 3.0*\n\n**Example**\n\nSee [jerry_object_get_native_ptr](#jerry_object_get_native_ptr) for a\nbest-practice example.\n\n**See also**\n\n- [jerry_object_set_native_ptr](#jerry_object_set_native_ptr)\n- [jerry_object_get_native_ptr](#jerry_object_get_native_ptr)\n- [jerry_object_native_info_t](#jerry_object_native_info_t)\n\n\n## jerry_object_set_native_ptr\n\n**Summary**\n\nSet native pointer and an optional type information for the specified object.\nYou can get them by calling [jerry_object_get_native_ptr](#jerry_object_get_native_ptr) later.\n\n*Note*:\n- If a native pointer was already set for the object with the same type information, its value is updated.\n- If a non-NULL free callback is specified in the native type information,\n  it will be called by the garbage collector when the object is freed.\n- If the object is only referenced via the \"global\" object (or one of it's \"child\"),\n  the free callback will be invoked during the execution of `jerry_cleanup`.\n- The free callback can invoke API functions.\n- If possible do not store API values in native pointers, rather check\n  [jerry_object_set_internal](#jerry_object_set_internal).\n\n**Prototype**\n\n```c\nvoid\njerry_object_set_native_ptr (const jerry_value_t obj_val,\n                             const jerry_object_native_info_t *info_p,\n                             void *native_p);\n```\n\n- `obj_val` - object to set native pointer in.\n- `info_p` - native pointer's type information or NULL. When used, this should\n             be a long-lived pointer, usually a pointer to a\n             `static const jerry_object_native_info_t` makes most sense.\n- `native_p` - native pointer.\n\n*Introduced in version 2.0*: Changed from `jerry_set_object_native_handle`.\n\n*Renamed in version 3.0, it was previously known as `jerry_set_object_native_pointer` in earlier versions.*\n\n**Example**\n\nSee [jerry_object_get_native_ptr](#jerry_object_get_native_ptr) for a\nbest-practice example.\n\n**See also**\n\n- [jerry_object](#jerry_object)\n- [jerry_object_get_native_ptr](#jerry_object_get_native_ptr)\n- [jerry_object_native_info_t](#jerry_object_native_info_t)\n\n## jerry_object_delete_native_ptr\n\n**Summary**\n\nDelete the native pointer of the specified object associated with the given native type info.\n\n*Note*:\n- If the specified object has no matching native pointer for the given native type info the operation has no effect.\n- The method does not invoke the free callback specified in the type info.\n  If the native pointer should be freed then one must get the native pointer first and invoke the free callback manually\n  before calling this method.\n- This operation cannot throw an exception.\n\n**Prototype**\n\n```c\nbool\njerry_object_delete_native_ptr (const jerry_value_t obj_val,\n                                const jerry_object_native_info_t *info_p)\n```\n\n- `obj_val` - object to delete native pointer from.\n- `info_p` - native pointer's type information.\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_delete_object_native_pointer` in earlier versions.*\n\n**Example**\n\nSee [jerry_object_get_native_ptr](#jerry_object_get_native_ptr) for a\nbest-practice example.\n\n**See also**\n\n- [jerry_object](#jerry_object)\n- [jerry_object_get_native_ptr](#jerry_object_get_native_ptr)\n- [jerry_object_get_native_ptr](#jerry_object_set_native_ptr)\n- [jerry_object_native_info_t](#jerry_object_native_info_t)\n\n\n## jerry_native_ptr_init\n\n**Summary**\n\nInitialize the references stored in a buffer pointed by a native pointer.\nThe references are initialized to undefined. This function must be called\nbefore the buffer is attached to an object by\n[jerry_object_set_native_ptr](#jerry_object_set_native_ptr).\n\n*Note*:\n- The description of [jerry_object_native_info_t](#jerry_object_native_info_t)\n  provides detailed information about these references.\n\n**Prototype**\n\n```c\nvoid\njerry_native_ptr_init (void *native_pointer_p,\n                       const jerry_object_native_info_t *native_info_p);\n```\n\n- `native_pointer_p` - a valid non-NULL pointer to a native buffer.\n- `native_info_p` - native pointer's type information.\n\n*Renamed in version 3.0, it was previously known as `jerry_native_pointer_release_references` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <stdlib.h>\n#include \"jerryscript.h\"\n\ntypedef struct\n{\n  uint32_t user_data;\n  jerry_value_t a;\n  jerry_value_t b;\n  uint32_t user_other_data;\n} user_buffer_t;\n\nstatic void\nnative_references_free_callback (void *native_p, /**< native pointer */\n                                 jerry_object_native_info_t *info_p) /**< native info */\n{\n  /* References must be finalized when a buffer is no longer attached. */\n  jerry_native_ptr_free (native_p, info_p);\n  free (native_p);\n} /* native_references_free_callback */\n\nstatic const jerry_object_native_info_t native_info =\n{\n  .free_cb = native_references_free_callback,\n  .number_of_references = 2,\n  .offset_of_references = offsetof(user_buffer_t, a),\n};\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t object_value = jerry_object ();\n\n  user_buffer_t *buffer_p = (user_buffer_t *) malloc (sizeof (user_buffer_t));\n\n  /* References must be initialized before a buffer is attached. */\n  jerry_native_ptr_init ((void *) buffer_p, &native_info);\n\n  jerry_object_set_native_ptr (object_value, &native_info, (void *) buffer_p);\n\n  /* References can be modified after the buffer is attached.\n   * This example sets a self reference. */\n  jerry_native_ptr_set (&buffer_p->a, object_value);\n\n  jerry_value_free (object_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object_set_native_ptr](#jerry_object_set_native_ptr)\n- [jerry_native_ptr_free](#jerry_native_ptr_free)\n- [jerry_native_ptr_set](#jerry_native_ptr_set)\n\n## jerry_native_ptr_free\n\n**Summary**\n\nRelease the value references stored in a buffer pointed by a native pointer.\nThis function must be called after a buffer is no longer attached to any\nobject, even if the buffer is attached to another object again. This\nfunction also initializes the values to undefined, so calling\n[jerry_native_ptr_init](#jerry_native_ptr_init)\nis optional before the buffer is attached again.\n\n*Note*:\n- The description of [jerry_object_native_info_t](#jerry_object_native_info_t)\n  provides detailed information about these references.\n\n**Prototype**\n\n```c\nvoid\njerry_native_ptr_free (void *native_pointer_p,\n                       const jerry_object_native_info_t *native_info_p);\n```\n\n- `native_pointer_p` - a valid non-NULL pointer to a native buffer.\n- `native_info_p` - native pointer's type information.\n\n*Renamed in version 3.0, it was previously known as `jerry_native_pointer_init_references` in earlier versions.*\n\n**Example**\n\nSee the example of [jerry_native_ptr_init](#jerry_native_ptr_init).\n\n**See also**\n\n- [jerry_object_set_native_ptr](#jerry_object_set_native_ptr)\n- [jerry_native_ptr_init](#jerry_native_ptr_init)\n- [jerry_native_ptr_set](#jerry_native_ptr_set)\n\n\n## jerry_native_ptr_set\n\n**Summary**\n\nUpdates a value reference inside the area specified by the `number_of_references` and\n`offset_of_references` fields in its corresponding\n[jerry_object_native_info_t](#jerry_object_native_info_t) data. The area must be\npart of a buffer which is currently assigned to an object.\n\n*Note*:\n- The description of [jerry_object_native_info_t](#jerry_object_native_info_t)\n  provides detailed information about these references.\n\n**Prototype**\n\n```c\nvoid\njerry_native_ptr_set (jerry_value_t *reference_p,\n                      jerry_value_t value)\n```\n\n- `reference_p` - a valid non-NULL pointer to a reference in a native buffer.\n- `value` - new value of the reference.\n\n*Renamed in version 3.0, it was previously known as `jerry_native_pointer_set_reference` in earlier versions.*\n\n**Example**\n\nSee the example of [jerry_native_ptr_init](#jerry_native_ptr_init).\n\n**See also**\n\n- [jerry_object_set_native_ptr](#jerry_object_set_native_ptr)\n- [jerry_native_ptr_init](#jerry_native_ptr_init)\n- [jerry_native_ptr_free](#jerry_native_ptr_free)\n\n\n## jerry_object_property_names\n\n**Summary**\n\nGets the property keys for the given object using the selected filters.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_object_property_names (jerry_value_t obj_val,\n                             jerry_property_filter_t filter);\n```\n\n- `obj_val` - object value\n- `filter` - any combination of [jerry_property_filter_t](#jerry_property_filter_t) options\n- return value\n  - array containing the filtered property keys in successful operation\n  - exception, otherwise\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_object_get_property_names` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t global_object = jerry_current_realm ();\n  jerry_value_t keys = jerry_object_property_names (object, JERRY_PROPERTY_FILTER_ALL);\n\n  ... // usage of keys\n\n  jerry_value_free (keys);\n  jerry_value_free (global_object);\n}\n```\n\n**See also**\n\n- [jerry_property_filter_t](#jerry_property_filter_t)\n\n## jerry_object_foreach\n\n**Summary**\n\nApplies the given function to every enumerable(!) property in the given object.\n\nThe \"iterator\" `foreach_p` method should return `true` value to continue the iteration.\nIf the method returns `false` the iteration will end.\n\n**Prototype**\n\n```c\nbool\njerry_object_foreach (jerry_value_t obj_val,\n                      jerry_object_property_foreach_cb_t foreach_p,\n                      void *user_data_p);\n```\n\n- `obj_val` - object value\n- `foreach_p` - foreach function, that will be applied for each property\n- `user_data_p` - user data for foreach function\n- return value\n  - true, if object fields traversal was performed successfully, i.e.:\n    - no unhandled exceptions were thrown in object fields traversal\n    - object fields traversal was stopped on callback that returned false\n  - false, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_foreach_object_property` in earlier versions.*\n\n**Example**\n\n[doctest]: # (name=\"02.API-REFERENCE-foreach-property.c\")\n\n```c\n#include <stdio.h>\n#include \"jerryscript.h\"\n\n/* Example structure used as user data for the property iteration. */\nstruct iteration_data {\n  int string_property_count;\n};\n\n/*\n * Example foreach function to print out property names.\n */\nstatic bool\nforeach_function (const jerry_value_t prop_name,\n                  const jerry_value_t prop_value,\n                  void *user_data_p)\n{\n  if (jerry_value_is_string (prop_name)) {\n    jerry_char_t string_buffer[128];\n    jerry_size_t copied_bytes = jerry_string_to_buffer (prop_name,\n                                                        JERRY_ENCODING_UTF8,\n                                                        string_buffer,\n                                                        sizeof (string_buffer) - 1);\n    string_buffer[copied_bytes] = '\\0';\n\n    printf (\"Property: %s\\n\", string_buffer);\n\n    struct iteration_data *data = (struct iteration_data *) user_data_p;\n    data->string_property_count++;\n  }\n\n  /* return true to continue iteration */\n  return true;\n}\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Construct an example object with a single property. */\n  jerry_value_t object = jerry_object ();\n  {\n    jerry_value_t test_property = jerry_string_sz (\"DemoProp\");\n    jerry_value_t test_value = jerry_number (3);\n    /* By default all properties added to an object are enumerable. */\n    jerry_value_t set_result = jerry_object_set (object, test_property, test_value);\n    /* The `set_result` should be checked if it is an exception or not. */\n    jerry_value_free (set_result);\n    jerry_value_free (test_value);\n    jerry_value_free (test_property);\n  }\n\n  /* Iterate on the object's properties with the given user data. */\n  struct iteration_data user_data = { 0 };\n\n  bool iteration_result = jerry_object_foreach (object, foreach_function, &user_data);\n  /* Check and process the `iteration_result` if required. */\n\n  jerry_value_free (object);\n\n  jerry_cleanup ();\n\n  return user_data.string_property_count == 0;\n}\n```\n\n**See also**\n\n- [jerry_object_property_foreach_cb_t](#jerry_object_property_foreach_cb_t)\n\n## jerry_foreach_live_object\n\n**Summary**\n\nIterate over all objects available in the engine.\n\nThe \"iterator\" `foreach_p` method should return `true` value to continue the search.\nIf the method returns `false` the search for the object is finished.\n\n*Note*:\n- Values obtained in `foreach_p` must be retained using [jerry_value_copy](#jerry_value_copy).\n\n**Prototype**\n\n```c\nbool\njerry_foreach_live_object (jerry_foreach_live_object_cb_t foreach_p,\n                           void *user_data_p);\n```\n\n- `foreach_p` - function that will be invoked for each object.\n- `user_data_p` - User data to pass to the function.\n- return value\n  - `true`, if the search function terminated the traversal by returning `false`\n  - `false`, if the end of the list of objects was reached\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_objects_foreach` in earlier versions.*\n\n**Example**\n\n[doctest]: # (name=\"02.API-REFERENCE-objects-foreach.c\")\n\n```c\n#include <stdio.h>\n#include \"jerryscript.h\"\n\n/* Create a custom structure to guide the search and store the result. */\ntypedef struct\n{\n  jerry_value_t property_name;\n  jerry_value_t result;\n} find_my_object_info_t;\n\n/*\n * Find the first object with the given property.\n */\nstatic bool\nfind_my_object (const jerry_value_t candidate,\n                void *user_data_p)\n{\n  find_my_object_info_t *info_p = (find_my_object_info_t *) user_data_p;\n\n  /* Check if the given object has the required property. */\n  jerry_value_t has_property = jerry_object_has (candidate, info_p->property_name);\n  bool object_found = jerry_value_is_true (has_property);\n\n  if (object_found)\n  {\n    /* We found it, so we copy the value and record it. */\n    info_p->result = jerry_value_copy (candidate);\n  }\n\n  jerry_value_free (has_property);\n\n  /* If the object was not found continue the search. */\n  return !object_found;\n} /* find_my_object */\n\nint\nmain (void)\n{\n  int return_value = 0;\n\n  /* Initialize JerryScript engine. */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Create the test object. */\n  {\n    jerry_value_t test_object = jerry_object ();\n\n    {\n      jerry_value_t test_property = jerry_string_sz (\"DemoProp\");\n      jerry_value_t test_value = jerry_number (3);\n      jerry_value_t set_result = jerry_object_set (test_object, test_property, test_value);\n      /* The `set_result` should be checked if it is an exception or not. */\n      jerry_value_free (set_result);\n      jerry_value_free (test_value);\n      jerry_value_free (test_property);\n    }\n\n    {\n      /* Register the test object into the global object. */\n      jerry_value_t global_object = jerry_current_realm ();\n      jerry_value_t demo_property = jerry_string_sz (\"DemoObject\");\n      jerry_value_t set_result = jerry_object_set (global_object, demo_property, test_object);\n      /* The `set_result` should be checked if it is an exception or not. */\n      jerry_value_free (set_result);\n      jerry_value_free (demo_property);\n      jerry_value_free (global_object);\n    }\n\n    jerry_value_free (test_object);\n  }\n\n  /* Look up the test object base on a property name. */\n  find_my_object_info_t search_info =\n  {\n    .property_name = jerry_string_sz (\"DemoProp\")\n  };\n\n  if (jerry_foreach_live_object (find_my_object, &search_info))\n  {\n    /* The search was successful. Do something useful with search_info.result. */\n    // ...\n    printf (\"Object found\\n\");\n\n    /* Release the found object after we're done using it. */\n    jerry_value_free (search_info.result);\n  }\n  else\n  {\n    /* The search has failed. */\n    printf (\"Object not found\\n\");\n\n    return_value = 1;\n  }\n\n  jerry_value_free (search_info.property_name);\n\n  /* Engine cleanup */\n  jerry_cleanup ();\n  return return_value;\n}\n```\n\n**See also**\n\n- [jerry_foreach_live_object_cb_t](#jerry_foreach_live_object_cb_t)\n\n## jerry_foreach_live_object_with_info\n\n**Summary**\n\nIterate over all objects in the engine matching a certain native data type.\n\nThe \"iterator\" `foreach_p` method should return `true` value to continue the search.\nIf the method returns `false` the search for the object is finished.\n\n*Note*:\n- Values obtained in `foreach_p` must be retained using [jerry_value_copy](#jerry_value_copy).\n\n**Prototype**\n\n```c\nbool\njerry_foreach_live_object_with_info (const jerry_object_native_info_t *native_info_p,\n                                     jerry_foreach_live_object_with_info_cb_t foreach_p,\n                                     void *user_data_p);\n```\n\n- `native_info_p` - native pointer's type information.\n- `foreach_p` - function that will be invoked for each object.\n- return value\n  - `true`, if the search function terminated the traversal by returning `false`\n  - `false`, if the end of the list of objects was reached\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_objects_foreach_by_native_info` in earlier versions.*\n\n**Example**\n\n[doctest]: # (name=\"02.API-REFERENCE-objects-foreach-nativeptr.c\")\n\n```c\n#include <stdio.h>\n#include <stdlib.h>\n#include \"jerryscript.h\"\n\ntypedef struct\n{\n  int foo;\n  bool bar;\n} native_obj_t;\n\ntypedef struct\n{\n  jerry_value_t found_object;\n  native_obj_t *found_native_data_p;\n\n  int match_foo_value;\n} find_object_data_t;\n\nstatic void native_freecb (void *native_p,\n                           jerry_object_native_info_t *info_p)\n{\n  (void) info_p;\n\n  /* `native_p` was allocated via malloc. */\n  free (native_p);\n} /* native_freecb */\n\n/*\n * NOTE: The address (!) of type_info acts as a way to uniquely \"identify\" the\n * C type `native_obj_t *`.\n */\nstatic const jerry_object_native_info_t native_obj_type_info =\n{\n  .free_cb = native_freecb\n};\n\n/*\n * Function creating JS object that is \"backed\" by a `native_obj_t`.\n */\nstatic void\nadd_object_with_nativeptr (int foo_value)\n{\n  // construct object and native_set value:\n  jerry_value_t test_object = jerry_object ();\n  native_obj_t *native_obj_p = malloc (sizeof (*native_obj_p));\n  native_obj_p->foo = foo_value;\n  native_obj_p->bar = true;\n\n  jerry_object_set_native_ptr (test_object, &native_obj_type_info, native_obj_p);\n\n  /* Register the test object into the global object. */\n  jerry_value_t global_object = jerry_current_realm ();\n  jerry_value_t demo_property = jerry_string_sz (\"DemoObject\");\n  jerry_value_t set_result = jerry_object_set (global_object, demo_property, test_object);\n  /* The `set_result` should be checked if it is an exception or not. */\n  jerry_value_free (set_result);\n  jerry_value_free (demo_property);\n  jerry_value_free (global_object);\n\n  jerry_value_free (test_object);\n} /* create_object_with_nativeptr */\n\n/*\n * Example native method that searches for a JavaScript object\n * with a `native_obj_type_info` has the correct value.\n */\nstatic bool\nfind_object (const jerry_value_t candidate, void *data_p, void *user_data_p)\n{\n  find_object_data_t *find_data_p = (find_object_data_t *) user_data_p;\n  native_obj_t *native_obj_p = (native_obj_t *) data_p;\n\n  if (find_data_p->match_foo_value == native_obj_p->foo)\n  {\n    /* If the object was found, copy it and store it in the user data. */\n    find_data_p->found_object = jerry_value_copy (candidate);\n    find_data_p->found_native_data_p = native_obj_p;\n\n    /* Stop traversing over the objects. */\n    return false;\n  }\n\n  /* Indicate that the object was not found, so traversal must continue. */\n  return true;\n} /* find_object */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  add_object_with_nativeptr (4);\n  add_object_with_nativeptr (3);\n  add_object_with_nativeptr (2);\n\n  find_object_data_t find_data =\n  {\n    .match_foo_value = 3,\n  };\n\n  if (jerry_foreach_live_object_with_info (&native_obj_type_info, find_object, &find_data))\n  {\n    /* The object was found and is now stored in `find_data.found_object`. After using it, it must be released. */\n    printf (\"Object found, native foo value: %d\\n\", find_data.found_native_data_p->foo);\n\n    jerry_value_free (find_data.found_object);\n  }\n  else\n  {\n    printf (\"Object not found\\n\");\n  }\n\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_object](#jerry_object)\n- [jerry_object_set_native_ptr](#jerry_object_set_native_ptr)\n- [jerry_object_get_native_ptr](#jerry_object_get_native_ptr)\n- [jerry_object_native_info_t](#jerry_object_native_info_t)\n- [jerry_foreach_live_object](#jerry_foreach_live_object)\n\n\n# Input validator functions\n\n## jerry_validate_string\n\n**Summary**\n\nCheck if a given character buffer is a valid in the specified encoding string.\n\n*Note*:\n- Calling this method is safe in any time. It can be called\n  even before engine initialization.\n\n**Prototype**\n\n```c\nbool\njerry_validate_string (const jerry_char_t *buffer_p, /**< string data */\n                       jerry_size_t buf_size, /**< string size */\n                       jerry_encoding_t encoding); /**< encoding */\n```\n\n- `buffer_p` - input string buffer.\n- `buf_size` - input string buffer size in bytes.\n- `encoding` - string encoding\n- return value\n  - true, if the provided string was a valid UTF-8 string.\n  - false, if the string is not valid as an UTF-8 string.\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_is_valid_cesu8_string` or `jerry_is_valid_utf8_string` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  const jerry_char_t script[] = \"print ('Hello, World!');\";\n  const jerry_size_t script_size = sizeof (script) - 1;\n\n  if (!jerry_validate_string (script, script_size, JERRY_ENCODING_CESU8))\n  {\n    return 1;\n  }\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_string](#jerry_string)\n- [jerry_string_size](#jerry_string_size)\n- [jerry_string_length](#jerry_string_length)\n- [jerry_string_to_buffer](#jerry_string_to_buffer)\n\n# Dynamic memory management functions\n\n## jerry_heap_alloc\n\n**Summary**\n\nAllocate memory on the engine's heap.\n\n*Note*:\n- This function may take away memory from the executed JavaScript code.\n  If any other dynamic memory allocation API is available (e.g., libc malloc), it\n  should be used instead.\n\n**Prototype**\n\n```c\nvoid *jerry_heap_alloc (size_t size);\n```\n\n- `size`: size of the memory block.\n- return value: non-NULL pointer, if the memory is successfully allocated,\n                NULL otherwise.\n\n*Introduced in version 2.0*.\n\n**See also**\n\n- [jerry_heap_free](#jerry_heap_free)\n\n## jerry_heap_free\n\n**Summary**\n\nFree memory allocated on the engine's heap.\n\n**Prototype**\n\n```c\nvoid jerry_heap_free (void *mem_p, size_t size);\n```\n\n- `mem_p`: value returned by `jerry_heap_alloc`.\n- `size`: same size as passed to `jerry_heap_alloc`.\n\n*Introduced in version 2.0*.\n\n**See also**\n\n- [jerry_heap_alloc](#jerry_heap_alloc)\n\n\n# Snapshot functions\n\n## jerry_generate_snapshot\n\n**Summary**\n\nGenerate snapshot from the specified source code.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n- This API depends on a build option (`JERRY_SNAPSHOT_SAVE`) and can be checked in runtime with\n  the `JERRY_FEATURE_SNAPSHOT_SAVE` feature enum value, see [jerry_feature_enabled](#jerry_feature_enabled).\n  If the feature is not enabled the function will return an exception.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_generate_snapshot (jerry_value_t compiled_code,\n                         uint32_t generate_snapshot_opts,\n                         uint32_t *buffer_p,\n                         size_t buffer_size);\n```\n\n- `compiled_code` - compiled script or function (see: [jerry_parse](#jerry_parse)).\n- `generate_snapshot_opts` - any combination of [jerry_generate_snapshot_opts_t](#jerry_generate_snapshot_opts_t) flags.\n- `buffer_p` - output buffer (aligned to 4 bytes) to save snapshot to.\n- `buffer_size` - the output buffer's size in bytes.\n- return value\n  - the size of the generated snapshot in bytes as number value, if it was generated successfully (i.e. there\n    are no syntax errors in source code, buffer size is sufficient, and snapshot support is enabled in\n    current configuration through JERRY_SNAPSHOT_SAVE)\n  - thrown exception, otherwise.\n\n*Introduced in version 2.0*.\n\n*Updated in version 3.0*: The `source_p`, `source_size`, `source_name_p`,\n                                       and `source_name_length` arguments are replaced by `compiled_code`\n                                       which should contain a compiled ECMAScript script / function.\n                                       The `jerry_generate_function_snapshot` is now removed and can be reproduced\n                                       by calling `jerry_parse` with function arguments and using this method\n                                       (see [jerry_exec_snapshot](#jerry_exec_snapshot)).\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  static uint32_t global_mode_snapshot_buffer[256];\n  const jerry_char_t script_to_snapshot[] = \"(function () { return 'string from snapshot'; }) ();\";\n\n  jerry_value_t parse_result = jerry_parse (script_to_snapshot,\n                                            sizeof (script_to_snapshot) - 1,\n                                            NULL);\n\n  size_t buffer_size = sizeof (global_mode_snapshot_buffer) / sizeof (uint32_t);\n  jerry_value_t generate_result = jerry_generate_snapshot (parse_result,\n                                                           0,\n                                                           global_mode_snapshot_buffer,\n                                                           buffer_size);\n  jerry_value_free (parse_result);\n\n  if (!jerry_value_is_exception (generate_result))\n  {\n    size_t snapshot_size = (size_t) jerry_value_as_number (generate_result);\n  }\n\n  jerry_value_free (generate_result);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_parse](#jerry_parse)\n- [jerry_parse_value](#jerry_parse_value)\n- [jerry_exec_snapshot](#jerry_exec_snapshot)\n- [jerry_parse_options_t](#jerry_parse_options_t)\n\n\n## jerry_exec_snapshot\n\n**Summary**\n\nExecute/load snapshot from the specified buffer.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n- This API depends on a build option (`JERRY_SNAPSHOT_EXEC`) and can be checked in runtime with\n  the `JERRY_FEATURE_SNAPSHOT_EXEC` feature enum value, see [jerry_feature_enabled](#jerry_feature_enabled).\n  If the feature is not enabled the function will return an exception.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_exec_snapshot (const uint32_t *snapshot_p,\n                     size_t snapshot_size,\n                     size_t func_index,\n                     uint32_t exec_snapshot_opts,\n                     const jerry_exec_snapshot_option_values_t *options_values_p);\n```\n\n- `snapshot_p` - pointer to snapshot.\n- `snapshot_size` - size of snapshot in bytes.\n- `func_index` - index of executed function.\n- `exec_snapshot_opts` - any combination of [jerry_exec_snapshot_opts_t](#jerry_exec_snapshot_opts_t) flags.\n- `options_values_p` - additional loading options, can be NULL if not used. The fields are described in\n                       [jerry_exec_snapshot_option_values_t](#jerry_exec_snapshot_option_values_t).\n- return value\n  - result of bytecode, if run was successful.\n  - thrown exception, otherwise (an exception is reported if the snapshot execution feature is not enabled).\n\n*Updated in version 2.0*: Added `func_index` and `exec_snapshot_opts` arguments. Removed the `copy_bytecode` last argument.\n\n*Updated in version 3.0*: Added `options_p` argument.\n\n**Example 1**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  static uint32_t snapshot_buffer[256];\n\n  /* 1st example: global mode snapshot. */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script_to_snapshot[] = \"(function () { return 'string from snapshot'; }) ();\";\n\n  jerry_value_t parse_result = jerry_parse (script_to_snapshot,\n                                            sizeof (script_to_snapshot) - 1,\n                                            NULL);\n\n  size_t buffer_size = sizeof (snapshot_buffer) / sizeof (uint32_t);\n  jerry_value_t generate_result = jerry_generate_snapshot (parse_result,\n                                                           0,\n                                                           snapshot_buffer,\n                                                           buffer_size);\n  jerry_value_free (parse_result);\n\n  /* 'generate_result' variable should be checked whether it contains an exception. */\n\n  size_t snapshot_size = (size_t) jerry_value_as_number (generate_result);\n  jerry_value_free (generate_result);\n\n  jerry_cleanup ();\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t res = jerry_exec_snapshot (snapshot_buffer,\n                                           snapshot_size,\n                                           0,\n                                           0,\n                                           NULL);\n\n  /* 'res' now contains 'string from snapshot' */\n  jerry_value_free (res);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**Example 2**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  static uint32_t snapshot_buffer[256];\n\n  /* 2nd example: function snapshot. */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t function_to_snapshot[] = \"return a + b;\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_ARGUMENT_LIST;\n  parse_options.argument_list = jerry_string_sz (\"a, b\");\n\n  jerry_value_t parse_result = jerry_parse (function_to_snapshot,\n                                            sizeof (function_to_snapshot) - 1,\n                                            &parse_options);\n\n  size_t buffer_size = sizeof (snapshot_buffer) / sizeof (uint32_t);\n  jerry_value_t generate_result = jerry_generate_snapshot (parse_result,\n                                                           0,\n                                                           snapshot_buffer,\n                                                           buffer_size);\n  jerry_value_free (parse_result);\n  jerry_value_free (parse_options.argument_list);\n\n  /* 'generate_result' variable should be checked whether it contains an exception. */\n\n  size_t snapshot_size = (size_t) jerry_value_as_number (generate_result);\n  jerry_value_free (generate_result);\n\n  jerry_cleanup ();\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t func = jerry_exec_snapshot (snapshot_buffer,\n                                            snapshot_size,\n                                            0,\n                                            JERRY_SNAPSHOT_EXEC_LOAD_AS_FUNCTION,\n                                            NULL);\n  /* 'func' can be used now as a function object. */\n\n  jerry_value_t this_value = jerry_undefined ();\n  jerry_value_t args[2];\n  args[0] = jerry_number (1.0);\n  args[1] = jerry_number (2.0);\n\n  jerry_value_t res = jerry_call (func, this_value, args, 2);\n\n  /* 'res' now contains the value 3 as a jerry_value_t. */\n  jerry_value_free (res);\n  jerry_value_free (args[0]);\n  jerry_value_free (args[1]);\n  jerry_value_free (this_value);\n  jerry_value_free (func);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_init](#jerry_init)\n- [jerry_cleanup](#jerry_cleanup)\n- [jerry_generate_snapshot](#jerry_generate_snapshot)\n\n## jerry_merge_snapshots\n\n**Summary**\n\nMerge multiple snapshots into a single buffer\n\n**Prototype**\n\n```c\nsize_t jerry_merge_snapshots (const uint32_t **inp_buffers_p,\n                              size_t *inp_buffer_sizes_p,\n                              size_t number_of_snapshots,\n                              uint32_t *out_buffer_p,\n                              size_t out_buffer_size,\n                              const char **error_p);\n```\n\n- `inp_buffers_p` - array of (pointers to start of) input buffers\n- `inp_buffer_sizes_p` - array of input buffer sizes\n- `number_of_snapshots` - number of snapshots\n- `out_buffer_p` - output buffer\n- `out_buffer_size` - output buffer size\n- `error_p` - error description\n- return value\n  - length of the merged snapshot file\n  - 0 on error\n\n**Example**\n\n```c\n  static uint32_t snapshot_buffer_0[SNAPSHOT_BUFFER_SIZE];\n  static uint32_t snapshot_buffer_1[SNAPSHOT_BUFFER_SIZE];\n  size_t snapshot_sizes[2];\n  static uint32_t merged_snapshot_buffer[SNAPSHOT_BUFFER_SIZE];\n\n  const jerry_char_t code_to_snapshot1[] = \"var a = 'hello'; 123\";\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t parse_result = jerry_parse (code_to_snapshot1, sizeof (code_to_snapshot1) - 1, NULL);\n  jerry_value_t generate_result = jerry_generate_snapshot (parse_result, 0, snapshot_buffer_0, SNAPSHOT_BUFFER_SIZE);\n  jerry_value_free (parse_result);\n\n  snapshot_sizes[0] = (size_t) jerry_value_as_number (generate_result);\n  jerry_value_free (generate_result);\n\n  jerry_cleanup ();\n\n  const jerry_char_t code_to_snapshot2[] = \"var b = 'hello'; 456\";\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  parse_result = jerry_parse (code_to_snapshot2, sizeof (code_to_snapshot2) - 1, NULL);\n  generate_result = jerry_generate_snapshot (parse_result, 0, snapshot_buffer_1, SNAPSHOT_BUFFER_SIZE);\n  jerry_value_free (parse_result);\n\n  snapshot_sizes[1] = (size_t) jerry_value_as_number (generate_result);\n  jerry_value_free (generate_result);\n\n  jerry_cleanup ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const char *error_p;\n  const uint32_t *snapshot_buffers[2];\n\n  snapshot_buffers[0] = snapshot_buffer_0;\n  snapshot_buffers[1] = snapshot_buffer_1;\n\n  static uint32_t snapshot_buffer_0_bck[SNAPSHOT_BUFFER_SIZE];\n  static uint32_t snapshot_buffer_1_bck[SNAPSHOT_BUFFER_SIZE];\n\n  memcpy (snapshot_buffer_0_bck, snapshot_buffer_0, SNAPSHOT_BUFFER_SIZE);\n  memcpy (snapshot_buffer_1_bck, snapshot_buffer_1, SNAPSHOT_BUFFER_SIZE);\n\n  size_t merged_size = jerry_merge_snapshots (snapshot_buffers,\n                                              snapshot_sizes,\n                                              2,\n                                              merged_snapshot_buffer,\n                                              SNAPSHOT_BUFFER_SIZE,\n                                              &error_p);\n\n  jerry_cleanup ();\n```\n\n**See also**\n\n- [jerry_generate_snapshot](#jerry_generate_snapshot)\n- [jerry_exec_snapshot](#jerry_exec_snapshot)\n\n\n## jerry_get_literals_from_snapshot\n\n**Summary**\n\nCollect the used literals from the given snapshot and save them into a buffer in list or C format.\nNone of these literals are magic strings. In C format only valid identifiers are collected.\n\n*Note*:\n- This API depends on a build option (`JERRY_SNAPSHOT_SAVE`) and can be checked in runtime with\n  the `JERRY_FEATURE_SNAPSHOT_SAVE` feature enum value, see [jerry_feature_enabled](#jerry_feature_enabled).\n  If the feature is not enabled the function will return zero.\n\n**Prototype**\n\n```c\nsize_t\njerry_get_literals_from_snapshot (const uint32_t *snapshot_p,\n                                  size_t snapshot_size,\n                                  jerry_char_t *lit_buf_p,\n                                  size_t lit_buf_size,\n                                  bool is_c_format);\n```\n\n- `snapshot_p` - input snapshot buffer.\n- `snapshot_size` - size of snapshot in bytes.\n- `lit_buf_p` - buffer to save literals to.\n- `lit_buf_size` - the buffer's size.\n- `is_c_format` - the output format would be C-style (true) or a simple list (false).\n- return value\n  - the size of the literal-list, if it was generated successfully (i.e. the list of literals isn't empty,\n    and literal-save support is enabled in current configuration through `JERRY_SNAPSHOT_SAVE`)\n  - 0 otherwise.\n\n*Introduced in version 2.0*.\n\n**Example**\n\n[doctest]: # (test=\"link\")\n\n```c\n#include <stdio.h>\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  static jerry_char_t literal_buffer[256];\n  static uint32_t snapshot_buffer[256];\n  const jerry_char_t script_for_literal_save[] = \"var obj = { a:'aa', bb:'Bb' }\";\n\n  jerry_value_t parse_result = jerry_parse (script_for_literal_save,\n                                            sizeof (script_for_literal_save) - 1,\n                                            NULL);\n\n  size_t buffer_size = sizeof (snapshot_buffer) / sizeof (uint32_t);\n  jerry_value_t generate_result = jerry_generate_snapshot (parse_result,\n                                                           0,\n                                                           snapshot_buffer,\n                                                           buffer_size);\n  jerry_value_free (parse_result);\n\n  size_t snapshot_size = (size_t) jerry_value_as_number (generate_result);\n  jerry_value_free (generate_result);\n\n  const size_t literal_size = jerry_get_literals_from_snapshot (snapshot_buffer,\n                                                                snapshot_size,\n                                                                literal_buffer,\n                                                                256,\n                                                                true);\n\n  if (literal_size != 0)\n  {\n    FILE *literal_file_p = fopen (\"literals.h\", \"wb\");\n    fwrite (literal_buffer, sizeof (uint8_t), literal_size, literal_file_p);\n    fclose (literal_file_p);\n  }\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_init](#jerry_init)\n- [jerry_cleanup](#jerry_cleanup)\n- [jerry_register_magic_strings](#jerry_register_magic_strings)\n\n\n# Backtrace functions\n\n## jerry_backtrace\n\n**Summary**\n\nGet backtrace. The backtrace is an array of strings where\neach string contains the position of the corresponding frame.\nThe array length is zero if the backtrace is not available.\n\nThis function is typically called from native callbacks.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n- This feature depends on build option (`JERRY_LINE_INFO`) and can be checked\n  in runtime with the `JERRY_FEATURE_LINE_INFO` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_value_t\njerry_backtrace (uint32_t max_depth);\n```\n\n- `max_depth` - backtrace collection stops after reaching this value, 0 = unlimited\n- return value\n  - a newly constructed JS array\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_backtrace` in earlier versions.*\n\n**Example**\n\n[doctest]: # (name=\"02.API-REFERENCE-jsbacktrace.c\")\n\n```c\n#include <stdio.h>\n#include <string.h>\n#include \"jerryscript.h\"\n\nstatic jerry_value_t\nbacktrace_handler (const jerry_call_info_t *call_info_p,\n                   const jerry_value_t args_p[],\n                   const jerry_length_t args_count)\n{\n  if (!jerry_feature_enabled (JERRY_FEATURE_LINE_INFO))\n  {\n    printf (\"Line info disabled, no backtrace will be printed\\n\");\n    return jerry_undefined ();\n  }\n\n  /* If the line info feature is disabled an empty array will be returned. */\n  jerry_value_t backtrace_array = jerry_backtrace (5);\n  uint32_t array_length = jerry_array_length (backtrace_array);\n\n  for (uint32_t idx = 0; idx < array_length; idx++)\n  {\n    jerry_value_t property = jerry_object_get_index (backtrace_array, idx);\n\n    jerry_char_t string_buffer[64];\n    jerry_size_t copied_bytes = jerry_string_to_buffer (property,\n                                                        JERRY_ENCODING_UTF8,\n                                                        string_buffer,\n                                                        sizeof (string_buffer) - 1);\n    string_buffer[copied_bytes] = '\\0';\n    printf(\" %d: %s\\n\", idx, string_buffer);\n\n    jerry_value_free (property);\n  }\n\n  jerry_value_free (backtrace_array);\n\n  return jerry_undefined ();\n} /* backtrace_handler */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global = jerry_current_realm ();\n\n  /* Register the \"capture_backtrace\" method. */\n  {\n    jerry_value_t func = jerry_function_external (backtrace_handler);\n    jerry_value_t name = jerry_string_sz (\"backtrace\");\n    jerry_value_t result = jerry_object_set (global, name, func);\n    jerry_value_free (result);\n    jerry_value_free (name);\n    jerry_value_free (func);\n  }\n\n  jerry_value_free (global);\n\n  const char *source = (\"function f() { g (); }\\n\"\n                        \"function g() { h (); }\\n\"\n                        \"function h() { backtrace (); }\\n\"\n                        \"f ();\\n\");\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"demo_memory.js\");\n\n  jerry_value_t program = jerry_parse ((const jerry_char_t *) source,\n                                       strlen (source),\n                                       &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  if (!jerry_value_is_exception (program))\n  {\n    jerry_value_t run_result = jerry_run (program);\n    jerry_value_free (run_result);\n  }\n\n  jerry_value_free (program);\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_function_external](#jerry_function_external)\n\n\n## jerry_backtrace_capture\n\n**Summary**\n\nLow-level function to capture each backtrace frame. The captured frame data\nis passed to a callback function. To improve performance, the majority of\nthe frame data is not initialized when the callback function is called. The\ninitialization of these fields can be done later by helper functions such\nas [jerry_frame_location](#jerry_frame_location).\n\n**Prototype**\n\n```c\nvoid\njerry_backtrace_capture (jerry_backtrace_cb_t callback, void *user_p);\n```\n\n- `callback` - a [jerry_backtrace_cb_t](#jerry_backtrace_cb_t) callback\n               which is called for each captured frame\n- `user_p` - pointer passed to the `callback` function, can be NULL\n\n*Introduced in version 3.0*.\n\n**Example**\n\n[doctest]: # (name=\"02.API-REFERENCE-jscapturebacktrace.c\")\n\n```c\n#include <stdio.h>\n#include <string.h>\n#include \"jerryscript.h\"\n\nstatic bool\nbacktrace_callback (jerry_frame_t *frame_p,\n                    void *user_p)\n{\n  printf (\" A stack frame is captured\\n\");\n  return true;\n}\n\nstatic jerry_value_t\nbacktrace_handler (const jerry_call_info_t *call_info_p,\n                   const jerry_value_t args_p[],\n                   const jerry_length_t args_count)\n{\n  (void) call_info_p;\n  (void) args_p;\n  (void) args_count;\n\n  jerry_backtrace_capture (&backtrace_callback, NULL);\n\n  return jerry_undefined ();\n} /* backtrace_handler */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global = jerry_current_realm ();\n\n  /* Register the \"dump_backtrace\" method. */\n  {\n    jerry_value_t func = jerry_function_external (backtrace_handler);\n    jerry_value_t name = jerry_string_sz (\"backtrace\");\n    jerry_value_t result = jerry_object_set (global, name, func);\n    jerry_value_free (result);\n    jerry_value_free (name);\n    jerry_value_free (func);\n  }\n\n  jerry_value_free (global);\n\n  const char *source = (\"function f() { g (); }\\n\"\n                        \"function g() { h (); }\\n\"\n                        \"function h() { backtrace (g); }\\n\"\n                        \"f ();\\n\");\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"demo_backtrace.js\");\n\n  jerry_value_t program = jerry_parse ((const jerry_char_t *) source,\n                                       strlen (source),\n                                       &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  if (!jerry_value_is_exception (program))\n  {\n    jerry_value_t run_result = jerry_run (program);\n    jerry_value_free (run_result);\n  }\n\n  jerry_value_free (program);\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_backtrace_capture](#jerry_backtrace_capture)\n- [jerry_frame_type](#jerry_frame_type)\n- [jerry_frame_location](#jerry_frame_location)\n- [jerry_frame_callee](#jerry_frame_callee)\n- [jerry_frame_this](#jerry_frame_this)\n- [jerry_frame_is_strict](#jerry_frame_is_strict)\n\n\n## jerry_frame_type\n\n**Summary**\n\nReturns with the type of the backtrace frame. This function can only be called\nfrom the callback function of [jerry_backtrace_capture](#jerry_backtrace_capture),\nand the value becomes invalid after the callback returns.\n\n**Prototype**\n\n```c\njerry_frame_type_t\njerry_frame_type (jerry_frame_t *frame_p);\n```\n\n- `frame_p` - a frame passed to the [jerry_backtrace_cb_t](#jerry_backtrace_cb_t) callback\n- return value\n  - frame type listed in [jerry_frame_type_t](#jerry_frame_type_t)\n\n*Renamed in version 3.0, it was previously known as `jerry_backtrace_get_frame_type` in earlier versions.*\n\n**Example**\n\nSee the example of [jerry_backtrace_capture](#jerry_backtrace_capture)\nwith the following callback function:\n\n```c\nstatic bool\nbacktrace_callback (jerry_frame_t *frame_p,\n                    void *user_p)\n{\n  switch (jerry_frame_type (frame_p))\n  {\n    case JERRY_BACKTRACE_FRAME_JS:\n    {\n      printf (\" ECMAScript frame\\n\");\n      break;\n    }\n    default:\n    {\n      printf (\" Other frame\\n\");\n      break;\n    }\n  }\n\n  return true;\n}\n```\n\n**See also**\n\n- [jerry_backtrace_capture](#jerry_backtrace_capture)\n\n\n## jerry_frame_location\n\n**Summary**\n\nInitialize and return with the location private field of a backtrace\nframe. If the location is not available, the returned value is NULL.\nThis function can only be called from the callback function of\n[jerry_backtrace_capture](#jerry_backtrace_capture), and the value\nbecomes invalid after the callback returns.\n\n*Note*:\n- Location information can only be retrieved if JERRY_FEATURE_LINE_INFO feature is\n  enabled. Otherwise the function always returns with NULL.\n- The returned data must not be modified, and does not need to be freed.\n  Any cleanup is done automatically after the callback is returned.\n\n**Prototype**\n\n```c\nconst jerry_frame_location_t *\njerry_frame_location (jerry_frame_t *frame_p);\n```\n\n- `frame_p` - a frame passed to the [jerry_backtrace_cb_t](#jerry_backtrace_cb_t) callback\n- return value\n  - pointer to the location private field if the location is available,\n  - NULL otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_backtrace_get_location` in earlier versions.*\n\n**Example**\n\nSee the example of [jerry_backtrace_capture](#jerry_backtrace_capture)\nwith the following callback function:\n\n```c\nstatic bool\nbacktrace_callback (jerry_frame_t *frame_p,\n                    void *user_p)\n{\n  const jerry_frame_location_t *location_p;\n  location_p = jerry_frame_location (frame_p);\n\n  if (location_p == NULL)\n  {\n    printf (\"No location info is available\\n\");\n    return true;\n  }\n\n  jerry_char_t string_buffer[64];\n  jerry_size_t copied_bytes = jerry_string_to_buffer (location_p->source_name,\n                                                      JERRY_ENCODING_UTF8\n                                                      string_buffer,\n                                                      sizeof (string_buffer) - 1);\n  string_buffer[copied_bytes] = '\\0';\n  printf(\" %s:%d:%d\\n\", string_buffer, (int) location_p->line, (int) location_p->column);\n  return true;\n}\n```\n\n**See also**\n\n- [jerry_backtrace_capture](#jerry_backtrace_capture)\n\n\n## jerry_frame_callee\n\n**Summary**\n\nInitialize and return with the called function private field of a backtrace frame.\nThe backtrace frame is created for running the code bound to this function. This\nfunction can only be called from the callback function of\n[jerry_backtrace_capture](#jerry_backtrace_capture), and the value becomes invalid\nafter the callback returns.\n\n*Note*:\n- The returned data must not be modified, and does not need to be freed.\n  Any cleanup is done automatically after the callback is returned.\n\n**Prototype**\n\n```c\nconst jerry_value_t *\njerry_frame_callee (jerry_frame_t *frame_p);\n```\n\n- `frame_p` - a frame passed to the [jerry_backtrace_cb_t](#jerry_backtrace_cb_t) callback\n- return value\n  - pointer to the called function if the function is available,\n  - NULL otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_backtrace_get_function` in earlier versions.*\n\n**Example**\n\nSee the example of [jerry_backtrace_capture](#jerry_backtrace_capture)\nwith the following callback function:\n\n```c\nstatic bool\nbacktrace_callback (jerry_frame_t *frame_p,\n                    void *user_p)\n{\n  jerry_value_t *function_p = jerry_frame_callee (frame_p);\n\n  if (function_p != NULL)\n  {\n    printf (\"Called function is available\");\n    return true;\n  }\n\n  printf (\"Called function is NOT available\");\n  return true;\n}\n```\n\n**See also**\n\n- [jerry_backtrace_capture](#jerry_backtrace_capture)\n\n\n## jerry_frame_this\n\n**Summary**\n\nInitialize and return with the 'this' binding private field of a backtrace frame.\nThe 'this' binding is a hidden value passed to the called function. As for arrow\nfunctions, the 'this' binding is assigned at function creation. This getter\nfunction can only be called from the callback function of\n[jerry_backtrace_capture](#jerry_backtrace_capture), and the value becomes invalid\nafter the callback returns.\n\n*Note*:\n- The returned data must not be modified, and does not need to be freed.\n  Any cleanup is done automatically after the callback is returned.\n\n**Prototype**\n\n```c\nconst jerry_value_t *\njerry_frame_this (jerry_frame_t *frame_p);\n```\n\n- `frame_p` - a frame passed to the [jerry_backtrace_cb_t](#jerry_backtrace_cb_t) callback\n- return value\n  - pointer to the 'this' binding if the binding is available,\n  - NULL otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_backtrace_get_this` in earlier versions.*\n\n**Example**\n\nSee the example of [jerry_backtrace_capture](#jerry_backtrace_capture)\nwith the following callback function:\n\n```c\nstatic bool\nbacktrace_callback (jerry_frame_t *frame_p,\n                    void *user_p)\n{\n  jerry_value_t *this_p = jerry_frame_this (frame_p);\n\n  if (this_p != NULL)\n  {\n    printf (\"The 'this' binding is available\");\n    return true;\n  }\n\n  printf (\"The 'this' binding is NOT available\");\n  return true;\n}\n```\n\n**See also**\n\n- [jerry_backtrace_capture](#jerry_backtrace_capture)\n\n\n## jerry_frame_is_strict\n\n**Summary**\n\nReturns true, if the code bound to the backtrace frame is strict mode\ncode. This function can only be called from the callback function of\n[jerry_backtrace_capture](#jerry_backtrace_capture), and the value\nbecomes invalid after the callback returns.\n\n**Prototype**\n\n```c\nbool\njerry_frame_is_strict (jerry_frame_t *frame_p);\n```\n\n- `frame_p` - a frame passed to the [jerry_backtrace_cb_t](#jerry_backtrace_cb_t) callback\n- return value\n  - true, if strict mode code is bound to the frame\n  - false, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_backtrace_is_strict` in earlier versions.*\n\n**Example**\n\nSee the example of [jerry_backtrace_capture](#jerry_backtrace_capture)\nwith the following callback function:\n\n```c\nstatic bool\nbacktrace_callback (jerry_frame_t *frame_p,\n                    void *user_p)\n{\n  if (jerry_frame_is_strict (frame_p))\n  {\n    printf (\"Strict mode code is running\");\n    return true;\n  }\n\n  printf (\"Non-strict mode code is running\");\n  return true;\n}\n```\n\n**See also**\n\n- [jerry_backtrace_capture](#jerry_backtrace_capture)\n\n\n# Miscellaneous functions\n\n## jerry_log\n\n**Summary**\n\n Log a zero-terminated formatted message with the specified log level.\n\n**Prototype**\n\n```c\nvoid jerry_log (jerry_log_level_t level, const char *format_p, ...);\n```\n\n- `level` - message log level, see [jerry_log_level_t](#jerry_log_level_t)\n- `format_p` - format string\n  Supported format specifiers:\n    `%s`: zero-terminated string\n    `%c`: character\n    `%u`: unsigned integer\n    `%d`: decimal integer\n    `%x`: unsigned hexadecimal\n  Width and padding sub-modifiers are also supported.\n- rest - variables to substitue into the format string\n\n*Introduced in version 3.0*.\n\n**Example**\n\n```c\njerry_log (JERRY_LOG_LEVEL_DEBUG,\n           \"My debug message with a number param: %d.\\n\", 42);\n```\n\n**See also**\n\n- [jerry_log_level_t](#jerry_log_level_t)\n- [jerry_log_set_level](#jerry_log_set_level)\n\n\n## jerry_log_set_level\n\n**Summary**\n\nSet the log level of the engine.\nLog messages with lower significance than the current log level will be ignored by `jerry_log`.\n\n**Prototype**\n\n```c\nvoid jerry_log_set_level (jerry_log_level_t level);\n```\n\n- `level` - log level to be set, see [jerry_log_level_t](#jerry_log_level_t)\n\n*Introduced in version 3.0*.\n\n**Example**\n\n```c\njerry_log_set_level (JERRY_LOG_LEVEL_WARNING);\n```\n\n**See also**\n\n- [jerry_log_level_t](#jerry_log_level_t)\n- [jerry_log](#jerry_log)\n\n\n## jerry_halt_handler\n\n**Summary**\n\nThe callback passed to this function is periodically called when\nJerryScript executes an ECMAScript program.\n\nIf the callback returns with undefined value the ECMAScript execution continues.\nOtherwise the result is thrown by the engine. The callback function might be\ncalled again even if it threw an exception. In this case the function must throw the\nsame exception again.\n\nTo reduce the CPU overhead of constantly checking the termination\ncondition the callback is called when a backward jump is executed\nor an exception is caught. Setting the `interval` to a greater\nthan `1` value reduces this overhead further. If its value is N\nonly every Nth event (backward jump, etc.) trigger the next check.\n\n*Note*:\n- This API depends on a build option (`JERRY_VM_HALT`) and can be checked\n  in runtime with the `JERRY_FEATURE_VM_EXEC_STOP` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nvoid\njerry_halt_handler (uint32_t interval,\n                    jerry_halt_cb_t callback\n                    void *user_p);\n```\n\n- `interval` - interval of calling the `callback` function\n- `callback` - periodically called callback (passing NULL disables this feature)\n- `user_p` - user pointer passed to the `callback` function\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_set_vm_exec_stop_callback` in earlier versions.*\n\n**Example**\n\n[doctest]: # (test=\"link\")\n\n```c\n#include \"jerryscript.h\"\n\nstatic jerry_value_t\nvm_exec_stop_callback (void *user_p)\n{\n  int *countdown_p = (int *) user_p;\n\n  while (*countdown_p > 0)\n  {\n    (*countdown_p)--;\n    return jerry_undefined ();\n  }\n\n  // The value will be automatically wrapped into an exception.\n  return jerry_string_sz (\"Abort script\");\n}\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  int countdown = 10;\n  jerry_halt_handler (16, vm_exec_stop_callback, &countdown);\n\n  // Infinite loop.\n  const jerry_char_t script[] = \"while(true) {}\";\n\n  jerry_value_t parsed_code = jerry_parse (script, sizeof (script) - 1, NULL);\n  jerry_value_free (jerry_run (parsed_code));\n  jerry_value_free (parsed_code);\n  jerry_cleanup ();\n}\n```\n\n**See also**\n\n- [jerry_halt_cb_t](#jerry_halt_cb_t)\n\n## jerry_source_name\n\n**Summary**\n\nGet the source name (usually a file name) of the currently executed script or the given function object.\n\nThis function is typically called from native callbacks.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n- This feature depends on build option (`JERRY_LINE_INFO`) and can be checked\n  in runtime with the `JERRY_FEATURE_LINE_INFO` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_value_t\njerry_source_name (jerry_value_t value);\n```\n- `value` - api value to obtain the source name from\n- return string value constructed from\n  - the currently executed function object's source name, if the given value is undefined\n  - source name of the function object, if the given value is a function object\n  - \"<anonymous>\", otherwise\n\n*Introduced in version 2.2*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_resource_name` in earlier versions.*\n\n**Example**\n\n[doctest]: # (name=\"02.API-REFERENCE-jssourcename.c\")\n\n```c\n#include <stdio.h>\n#include <string.h>\n#include \"jerryscript.h\"\n\nstatic jerry_value_t\nsource_name_handler (const jerry_call_info_t *call_info_p,\n                     const jerry_value_t args_p[],\n                     const jerry_length_t args_count)\n{\n  jerry_value_t undefined_value = jerry_undefined ();\n  jerry_value_t source_name = jerry_source_name (args_count > 0 ? args_p[0] : undefined_value);\n  jerry_value_free (undefined_value);\n\n  return source_name;\n} /* source_name_handler */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global = jerry_current_realm ();\n\n  /* Register the sourceName\" method. */\n  {\n    jerry_value_t func = jerry_function_external (source_name_handler);\n    jerry_value_t name = jerry_string_sz (\"sourceName\");\n    jerry_value_t result = jerry_object_set (global, name, func);\n    jerry_value_free (result);\n    jerry_value_free (name);\n    jerry_value_free (func);\n  }\n\n  jerry_value_free (global);\n\n  const jerry_char_t source[] = \"function myFunction() { return sourceName() }; myFunction()\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"demo.js\");\n\n  jerry_value_t program = jerry_parse (source,\n                                       sizeof (source) - 1,\n                                       &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  if (!jerry_value_is_exception (program))\n  {\n    /* `run_result` contains \"demo.js\" */\n    jerry_value_t run_result = jerry_run (program);\n\n    /* usage of `run_result` */\n\n    jerry_value_free (run_result);\n  }\n\n  jerry_value_free (program);\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_function_external](#jerry_function_external)\n\n## jerry_source_user_value\n\n**Summary**\n\nReturns the user value assigned to a script / module / function. This value is\nset by the parser when the JERRY_PARSE_HAS_USER_VALUE flag is set in the `options`\nmember of the [jerry_parse_options_t](#jerry_parse_options_t) structure.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_source_user_value (const jerry_value_t value);\n```\n- `value` - script / module / function value which executes ECMAScript\n            code (native modules / functions do not have user value).\n- return\n  - user value - if available,\n  - undefined - otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_get_user_value` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"function abc() {} abc\";\n\n  jerry_value_t user_value = jerry_object ();\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  parse_options.user_value = user_value;\n\n  jerry_value_t parsed_code = jerry_parse (script, sizeof (script) - 1, &parse_options);\n  jerry_value_free (user_value);\n\n  /* The jerry_source_user_value returns the object which\n   * was created by jerry_object before. */\n\n  user_value = jerry_source_user_value (parsed_code);\n  jerry_value_free (parsed_code);\n\n  jerry_value_free (user_value);\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_parse](#jerry_parse)\n- [jerry_generate_snapshot](#jerry_generate_snapshot)\n- [jerry_exec_snapshot](#jerry_exec_snapshot)\n\n## jerry_function_is_dynamic\n\n**Summary**\n\nChecks whether an ECMAScript code is compiled by eval like (eval, new Function,\n[jerry_eval](#jerry_eval), etc.) command.\n\n**Prototype**\n\n```c\nbool jerry_function_is_dynamic (const jerry_value_t value);\n```\n- `value` - script / module / function value which executes ECMAScript code\n- return\n  - true - if code is compiled by eval like command\n  - false - otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_is_eval_code` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"eval('(function (a) { return a; })')\";\n\n  jerry_value_t script_value = jerry_parse (script, sizeof (script) - 1, NULL);\n  jerry_value_t function_value = jerry_run (script_value);\n  jerry_value_free (script_value);\n\n  if (jerry_function_is_dynamic (function_value))\n  {\n    /* Code enters here. */\n  }\n\n  jerry_value_free (function_value);\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_parse](#jerry_parse)\n- [jerry_generate_snapshot](#jerry_generate_snapshot)\n- [jerry_exec_snapshot](#jerry_exec_snapshot)\n\n## jerry_source_info\n\n**Summary**\n\nReturns a newly created source info structure corresponding to the passed script/module/function.\nThe function is lower level than `toString()` operation, but provides more contextual information.\n\n*Note*:\n- Returned value must be freed with [jerry_source_info_free](#jerry_source_info_free) when it\n  is no longer needed.\n- This API depends on a build option (`JERRY_FUNCTION_TO_STRING`) and can be checked\n  in runtime with the `JERRY_FEATURE_FUNCTION_TO_STRING` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\njerry_source_info_t *jerry_source_info (const jerry_value_t value);\n```\n- `value` - script / module / function value which executes JavaScript\n            code (native modules / functions do not have source info).\n- return\n  - source info - a newly created source info, if at least one field is available,\n  - NULL - otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_get_source_info` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"function abc() {} abc\";\n\n  jerry_value_t parsed_code = jerry_parse (script, sizeof (script) - 1, NULL);\n\n  jerry_source_info_t *source_info_p = jerry_source_info (parsed_code);\n  jerry_value_free (parsed_code);\n\n  if (source_info_p != NULL)\n  {\n    /* Check the information provided by jerry_source_info. */\n  }\n\n  jerry_source_info_free (source_info_p);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_source_info_free](#jerry_source_info_free)\n- [jerry_source_info_t](#jerry_source_info_t)\n\n## jerry_source_info_free\n\n**Summary**\n\nFrees the the source info structure returned by [jerry_source_info](#jerry_source_info).\n\n*Note*:\n- This API depends on a build option (`JERRY_FUNCTION_TO_STRING`) and can be checked\n  in runtime with the `JERRY_FEATURE_FUNCTION_TO_STRING` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nvoid jerry_source_info_free (jerry_source_info_t *source_info_p)\n```\n- `source_info_p` - source info structure returned by [jerry_source_info](#jerry_source_info)\n\n*Renamed in version 3.0, it was previously known as `jerry_free_source_info` in earlier versions.*\n\n**Example**\n\nSee [jerry_source_info](#jerry_source_info)\n\n**See also**\n\n- [jerry_source_info](#jerry_source_info)\n- [jerry_source_info_t](#jerry_source_info_t)\n\n\n# Functions for realm objects\n\nThese APIs all depend on build option (`JERRY_BUILTIN_REALMS`).\n\n## jerry_set_realm\n\n**Summary**\n\nReplaces the currently active realm (including the global object) with another realm.\nThe replacement should be temporary, and the original realm must be restored after\nthe tasks are completed. During the replacement, the realm must be referenced\nby the application (i.e. the gc must not reclaim it). This is also true to\nthe returned previously active realm, so there is no need to free the value\nafter the restoration. The function can only fail if realms are not supported\nor the passed argument is not a realm. In this case the returned exception must\nbe freed by [jerry_value_free](#jerry_value_free).\n\nThis function is useful to parse a script, create a native function, load a snapshot\nor create an exception in another realm. Each ECMAScript code runs in the realm\nwhich was active when the code was parsed or loaded regardless of the current realm.\n\n*Note*:\n- This feature depends on build option (`JERRY_BUILTIN_REALMS`) and can be checked\n  in runtime with the `JERRY_FEATURE_REALM` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_set_realm (jerry_value_t realm_value);\n```\n- `realm_value` - the new realm value\n- return\n  - previous realm value - if the passed value is a realm\n  - exception - otherwise\n\n*Introduced in version 2.4*.\n\n**Example**\n\n```c\n{\n  jerry_value_t realm_value = jerry_realm ();\n\n  jerry_value_t old_realm = jerry_set_realm (realm_value);\n\n  ... // usage of the realm\n\n  jerry_set_realm (old_realm);\n}\n```\n\n**See also**\n\n- [jerry_realm](#jerry_realm)\n\n## jerry_realm_this\n\n**Summary**\n\nGets the 'this' binding of a realm. The 'this' binding is always an object.\nBy default the 'this' binding is the same as the realm object and can be\nchanged by [jerry_realm_set_this](#jerry_realm_set_this).\n\n*Note*:\n- This feature depends on build option (`JERRY_BUILTIN_REALMS`) and can be checked\n  in runtime with the `JERRY_FEATURE_REALM` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_realm_this (jerry_value_t realm_value)\n```\n- `realm_value` - realm value\n- return\n  - type error exception- if realm_value is not a realm\n  - 'this' binding object - otherwise\n\n*Introduced in version 2.4*.\n\n*Renamed in version 3.0, it was previously known as `jerry_realm_get_this` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t realm_value = jerry_realm ();\n\n  jerry_value_t this_value = jerry_realm_this (realm_value);\n\n  ... // usage of the this_value\n\n  jerry_value_free (this_value);\n  jerry_value_free (realm_value);\n}\n```\n\n**See also**\n\n- [jerry_realm](#jerry_realm)\n- [jerry_realm_set_this](#jerry_realm_set_this)\n\n## jerry_realm_set_this\n\n**Summary**\n\nSets the 'this' binding of a realm. This function must be called before executing\nany script on the realm. Otherwise the operation is undefined.\n\n*Note*:\n- This feature depends on build option (`JERRY_BUILTIN_REALMS`) and can be checked\n  in runtime with the `JERRY_FEATURE_REALM` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_realm_set_this (jerry_value_t realm_value, jerry_value_t this_value)\n```\n- `realm_value` - realm value\n- `this_value` - new this value\n- return\n  - type error exception- if realm_value is not a realm or this_value is not object\n  - true - otherwise\n\n*Introduced in version 2.4*.\n\n**Example**\n\n```c\n{\n  jerry_value_t realm_value = jerry_realm ();\n\n  jerry_value_t old_realm = jerry_set_realm (realm_value);\n  /* The prototype of the object comes from the new realm. */\n  jerry_value_t this_value = jerry_object ();\n  jerry_set_realm (old_realm);\n\n  jerry_value_t result = jerry_realm_set_this (realm_value, this_value);\n\n  ... // usage of the realm\n}\n```\n\n**See also**\n\n- [jerry_realm](#jerry_realm)\n- [jerry_set_realm](#jerry_set_realm)\n- [jerry_realm_this](#jerry_realm_this)\n\n# ArrayBuffer and TypedArray functions\n\nThese APIs all depend on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\nin runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\nsee: [jerry_feature_enabled](#jerry_feature_enabled).\n\n## jerry_arraybuffer_size\n\n**Summary**\n\nGet the byte length property of the ArrayBuffer or SharedArrayBuffer. This is the\nsame value which was passed to the ArrayBuffer constructor call.\n\n**Prototype**\n\n```c\njerry_length_t\njerry_arraybuffer_size (const jerry_value_t value);\n```\n\n- `value` - ArrayBuffer object\n- return value\n  - size of the ArrayBuffer in bytes\n  - 0 if the `value` parameter is not an ArrayBuffer\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_arraybuffer_byte_length` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t buffer = jerry_arraybuffer (15);\n  jerry_length_t length = jerry_arraybuffer_size (buffer);\n  // length should be 15\n\n  jerry_value_free (buffer);\n}\n```\n\n**See also**\n- [jerry_arraybuffer](#jerry_arraybuffer)\n\n\n## jerry_arraybuffer_read\n\n**Summary**\n\nCopy the portion of the ArrayBuffer or SharedArrayBuffer into a user provided buffer.\nThe start offset of the read operation can be specified.\n\nThe number bytes to be read can be specified via the `buf_size`\nparameter. It is not possible to read more than the length of\nthe ArrayBuffer.\n\nFunction returns the number of bytes read from the ArrayBuffer\n(and written to the buffer parameter). This value is\ncalculated in the following way: `min(array buffer length - offset, buf_size)`.\n\n**Prototype**\n\n```c\njerry_length_t\njerry_arraybuffer_read (const jerry_value_t value,\n                        jerry_length_t offset,\n                        uint8_t *buf_p,\n                        jerry_length_t buf_size);\n```\n\n- `value` - ArrayBuffer to read from\n- `offset` - start offset of the read operation\n- `buf_p` - buffer to read the data to\n- `buf_size` - maximum number of bytes to read into the buffer\n- return value\n  - number of bytes written into the buffer (read from the ArrayBuffer)\n  - 0 if the `value` is not an ArrayBuffer object\n  - 0 if the `buf_size` is zero or there is nothing to read\n\n*Introduced in version 2.0*.\n\n**Example**\n\n```c\n{\n  uint8_t data[20];\n  jerry_value_t buffer;\n  // ... create the ArrayBuffer or copy it from somewhere.\n\n  jerry_value_t bytes_read;\n\n  // read 10 bytes from the start of the ArrayBuffer.\n  bytes_read = jerry_arraybuffer_read (buffer, 0, data, 10);\n  // read the next 10 bytes\n  bytes_read += jerry_arraybuffer_read (buffer, bytes_read, data + bytes_read, 10);\n\n  // process the data variable\n\n  jerry_value_free (buffer);\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer](#jerry_arraybuffer)\n- [jerry_arraybuffer_write](#jerry_arraybuffer_write)\n- [jerry_arraybuffer_size](#jerry_arraybuffer_size)\n\n\n## jerry_arraybuffer_write\n\n**Summary**\n\nCopy the contents of a buffer into the ArrayBuffer or SharedArrayBuffer.\nThe start offset of the write operation can be specified.\n\nThe number bytes to be written can be specified via the `buf_size`\nparameter. It is not possible to write more than the length of\nthe ArrayBuffer.\n\nFunction returns the number of bytes written into the ArrayBuffer\n(and read from the buffer parameter). This value is\ncalculated in the following way: `min(array buffer length - offset, buf_size)`.\n\n**Prototype**\n\n```c\njerry_length_t\njerry_arraybuffer_write (const jerry_value_t value,\n                         jerry_length_t offset,\n                         const uint8_t *buf_p,\n                         jerry_length_t buf_size);\n```\n\n- `value` - ArrayBuffer to write to\n- `offset` - start offset of the write operation\n- `buf_p` - buffer to read the data from\n- `buf_size` - maximum number of bytes to write into the ArrayBuffer\n- return value\n  - number of bytes written into the ArrayBuffer (read from the buffer parameter)\n  - 0 if the `value` is not an ArrayBuffer object\n  - 0 if the `buf_size` is zero or there is nothing to write\n\n*Introduced in version 2.0*.\n\n**Example**\n\n```c\n{\n  uint8_t data[20];\n\n  // fill the data with values\n  for (int i = 0; i < 20; i++)\n  {\n    data[i] = (uint8_t) (i * 2);\n  }\n\n  jerry_value_t buffer;\n  // ... create the ArrayBuffer or copy it from somewhere.\n\n  jerry_value_t bytes_written;\n\n  // write 10 bytes from to the start of the ArrayBuffer.\n  bytes_written = jerry_arraybuffer_write (buffer, 0, data, 10);\n  // read the next 10 bytes\n  bytes_written += jerry_arraybuffer_write (buffer, bytes_written, data + bytes_written, 10);\n\n  // use the ArrayBuffer\n\n  jerry_value_free (buffer);\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer](#jerry_arraybuffer)\n- [jerry_arraybuffer_write](#jerry_arraybuffer_write)\n- [jerry_arraybuffer_size](#jerry_arraybuffer_size)\n\n\n## jerry_arraybuffer_data\n\n**Summary**\n\nThe function allows access to the contents of the Array Buffer directly.\n\n**WARNING!** This operation is for expert use only! The programmer must\nensure that the returned memory area is used correctly. That is\nthere is no out of bounds reads or writes. The lifetime of the underlying\ndata buffer is managed by the ArrayBuffer value. Make sure to copy the\nvalue with [`jerry_value_copy`](#jerry_value_copy) if the data\nbuffer is needed later.\n\n**Prototype**\n\n```c\nuint8_t *\njerry_arraybuffer_data (const jerry_value_t value);\n```\n\n- `value` - Array Buffer object.\n- return value\n  - pointer to the Array Buffer's data area.\n  - NULL if the `value` is:\n    - not an ArrayBuffer object\n    - an external ArrayBuffer has been detached\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_arraybuffer_pointer` in earlier versions.*\n\n**Example**\n\n```c\n{\n  // create the ArrayBuffer\n  jerry_value_t buffer = jerry_arraybuffer (16);\n\n  uint8_t *const data = jerry_arraybuffer_data (buffer);\n\n  for (int i = 0; i < 16; i++)\n  {\n    data[i] = (uint8_t) (i + 4);\n  }\n\n  // use the Array Buffer\n\n  // release buffer as it is not needed after this point\n  jerry_value_free (buffer);\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer_external](#jerry_arraybuffer_external)\n\n## jerry_arraybuffer_is_detachable\n\n**Summary**\n\nGet if the ArrayBuffer is detachable.\n\n**Prototype**\n\n```c\nbool\njerry_arraybuffer_is_detachable (const jerry_value_t value);\n```\n\n- `value` - ArrayBuffer to be detached\n- return\n  - true if the arraybuffer is detachable\n  - false otherwise\n\n*Introduced in version 2.2*.\n\n*Renamed in version 3.0, it was previously known as `jerry_is_arraybuffer_detachable` in earlier versions.*\n\n**Example**\n\n```c\n{\n  // create the ArrayBuffer\n  jerry_value_t buffer = jerry_arraybuffer (16);\n\n  bool is_detachable = jerry_arraybuffer_is_detachable (buffer);\n\n  // release buffer as it is not needed after this point\n  jerry_value_free (buffer);\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer_detach](#jerry_arraybuffer_detach)\n\n## jerry_arraybuffer_detach\n\n**Summary**\n\nDetach the underlying data block from ArrayBuffer and set its bytelength to 0.\n\nThis operation requires the ArrayBuffer to be an external buffer created by\n`jerry_arraybuffer_external`.\n\n*Note*:\n- If the ArrayBuffer has been created with `jerry_arraybuffer_external` the optional free callback is\n  called on a successful detach operation\n\n**Prototype**\n\n```c\njerry_value_t\njerry_arraybuffer_detach (const jerry_value_t value);\n```\n\n- `value` - ArrayBuffer to be detached\n- return\n  - null value if success\n  - exception otherwise\n\n*Introduced in version 2.2*.\n\n*Renamed in version 3.0, it was previously known as `jerry_detach_arraybuffer` in earlier versions.*\n\n**Example**\n\n```c\n{\n  uint8_t buf[1];\n  jerry_size_t length = 1;\n  // create the ArrayBuffer\n  jerry_value_t buffer = jerry_arraybuffer (length, buf, NULL);\n\n  jerry_value_t res = jerry_arraybuffer_detach (buffer);\n\n  // release buffer as it is not needed after this point\n  jerry_value_free (res);\n  jerry_value_free (buffer);\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer_is_detachable](#jerry_arraybuffer_is_detachable)\n\n## jerry_arraybuffer_has_buffer\n\n**Summary**\n\nChecks whether a buffer is currently allocated for an array buffer or typed array.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\n  in runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n**Prototype**\n\n```c\nbool\njerry_arraybuffer_has_buffer (const jerry_value_t value);\n```\n\n- `value` - array buffer or typed array value.\n- return\n  - true, if a buffer is allocated for an array buffer or typed array\n  - false, otherwise\n\n*Introduced in version 3.0*.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t array_buffer_value = jerry_arraybuffer (1024 * 1024);\n\n  /* By default, the backing store of large array buffers\n   * is allocated when it is used the first time. */\n\n  if (!jerry_arraybuffer_has_buffer (array_buffer_value))\n  {\n    /* Code enters here in this case. */\n  }\n\n  jerry_value_free (array_buffer_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer_external](#jerry_arraybuffer_external)\n- [jerry_shared_arraybuffer_external](#jerry_shared_arraybuffer_external)\n- [jerry_arraybuffer_heap_allocation_limit](#jerry_arraybuffer_heap_allocation_limit)\n- [jerry_arraybuffer_allocator](#jerry_arraybuffer_allocator)\n\n## jerry_arraybuffer_heap_allocation_limit\n\n**Summary**\n\nArray buffers which size is less or equal than the limit passed to this\nfunction are allocated in a single memory block. The allocator callbacks set by\n[jerry_arraybuffer_set_allocation_callbacks](#jerry_arraybuffer_set_allocation_callbacks)\nare not called for these array buffers.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\n  in runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n- The default limit is 256 bytes.\n- When an array buffer is allocated in a single memory block, its\n  backing store is not freed when the array buffer is detached.\n- This limit does not affect shared array buffers, their backing store is always\n  allocated by the allocator callback.\n\n**Prototype**\n\n```c\nvoid\njerry_arraybuffer_heap_allocation_limit (const jerry_length_t allocation_limit);\n```\n\n- `allocation_limit` - maximum size of compact allocation.\n\n*Renamed in version 3.0, it was previously known as `jerry_arraybuffer_set_compact_allocation_limit` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_arraybuffer_heap_allocation_limit (1);\n\n  jerry_value_t array_buffer_value = jerry_arraybuffer (1);\n\n  if (jerry_arraybuffer_has_buffer (array_buffer_value))\n  {\n    /* Code enters here because the backing store\n     * is allocated during buffer creation. */\n  }\n\n  jerry_value_free (array_buffer_value);\n\n  array_buffer_value = jerry_arraybuffer (2);\n\n  if (jerry_arraybuffer_has_buffer (array_buffer_value))\n  {\n    /* Code does not enter here because the backing store\n     * is allocated when it is used the first time. */\n  }\n\n  jerry_value_free (array_buffer_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer_has_buffer](#jerry_arraybuffer_has_buffer)\n- [jerry_arraybuffer_allocator](#jerry_arraybuffer_allocator)\n\n## jerry_arraybuffer_allocator\n\n**Summary**\n\nSet callbacks for allocating and freeing backing stores for array buffer objects.\n\n*Note*:\n- This API depends on a build option (`JERRY_BUILTIN_TYPEDARRAY`) and can be checked\n  in runtime with the `JERRY_FEATURE_TYPEDARRAY` feature enum value,\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n- This function is recommended to be called after [jerry_init](#jerry_init) before\n  any array buffer is allocated.\n- The callbacks can be NULL to use the default callbacks. The default `allocate_callback`\n  allocates memory using [jerry_heap_alloc](#jerry_heap_alloc) and the default\n  `free_callback` frees memory using [jerry_heap_free](#jerry_heap_free).\n\n\n**Prototype**\n\n```c\nvoid\njerry_arraybuffer_allocator (jerry_arraybuffer_allocate_cb_t allocate_callback,\n                             jerry_arraybuffer_free_cb_t free_callback,\n                             void *user_p)\n```\n\n- `allocate_callback` - callback for allocating array buffer memory.\n- `free_callback` - callback for freeing array buffer memory.\n- `user_p` - user pointer passed to the callbacks.\n\n*Renamed in version 3.0, it was previously known as `jerry_arraybuffer_set_allocator_callbacks` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nstatic uint8_t global_buffer[64];\n\nstatic void\narray_buffer_free_cb (jerry_arraybuffer_type_t buffer_type, /**< type of the array buffer object */\n                      uint8_t *buffer_p, /**< pointer to the allocated buffer */\n                      uint32_t buffer_size, /**< size of the allocated buffer */\n                      void *arraybuffer_user_p, /**< user pointer assigned to the array buffer object */\n                      void *user_p) /**< user pointer passed to jerry_arraybuffer_set_allocation_callbacks */\n{\n  (void) buffer_type;\n  (void) user_p;\n\n  /* As for this example, only the free callback is redirected. This callback\n   * function does not free the memory if the arraybuffer_user_p is non-NULL. */\n\n  if (arraybuffer_user_p == NULL)\n  {\n    jerry_heap_free (buffer_p, buffer_size);\n  }\n} /* array_buffer_free_cb */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_arraybuffer_allocator (NULL, array_buffer_free_cb, NULL);\n\n  /* The buffer of the array buffer object is allocated by the default\n   * allocator using jerry_heap_alloc and freed by array_buffer_free_cb. */\n\n  const jerry_char_t script[] = \"var result = new uint32Array(1024); result[0] = 1; result\";\n  jerry_value_t array_buffer_value = jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);\n  jerry_value_free (array_buffer_value);\n\n  /* The buffer of the array buffer object has a non-NULL\n   * arraybuffer_user_p value, so it is not freed by array_buffer_free_cb. */\n\n  array_buffer_value = jerry_arraybuffer_external (global_buffer, sizeof (global_buffer), global_buffer);\n  jerry_value_free (array_buffer_value);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_arraybuffer_has_buffer](#jerry_arraybuffer_has_buffer)\n- [jerry_arraybuffer_allocator](#jerry_arraybuffer_allocator)\n\n## jerry_dataview_buffer\n\n**Summary**\n\nGet the ArrayBuffer object used by a DataView object.\nAdditionally returns the byteLength and byteOffset properties\nof the DataView object.\n\nFor the returned ArrayBuffer the [jerry_value_free](#jerry_value_free)\nmust be called when it is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_dataview_buffer (const jerry_value_t value,\n                       jerry_length_t *byteOffset,\n                       jerry_length_t *byteLength);\n```\n\n- `value` - DataView to get the ArrayBuffer from\n- `byteOffset` - (Optional) returns the start offset of the ArrayBuffer for the DataView\n- `byteLength` - (Optional) returns the number of bytes used from the ArrayBuffer for the DataView\n- return\n  - DataView object's underlying ArrayBuffer object\n  - TypeError if the `value` is not a DataView object\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_dataview_buffer` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t arraybuffer = jerry_arraybuffer (16);\n  jerry_value_t dataview = jerry_dataview (arraybuffer, 0, 16);\n  jerry_length_t byteOffset = 0;\n  jerry_length_t byteLength = 0;\n  jerry_value_t buffer = jerry_dataview_buffer (dataview, &byteOffset, &byteLength);\n\n  // buffer is an ArrayBuffer object and ArrayBuffer operations can be performed on it\n  // byteOffset is 0\n  // byteLength is 16\n\n  // usage of buffer\n\n  jerry_value_free (buffer);\n  jerry_value_free (dataview);\n  jerry_value_free (arraybuffer);\n\n  jerry_cleanup ();\n}\n```\n\n**See also**\n\n- [jerry_dataview](#jerry_dataview)\n\n\n## jerry_typedarray_type\n\n**Summary**\n\nGet the type of the TypedArray.\n\nThe returned type is one of the [jerry_typedarray_type_t](#jerry_typedarray_type_t)\nenum value.\n\n**Prototype**\n\n```c\njerry_typedarray_type_t\njerry_typedarray_type (jerry_value_t value);\n```\n\n- `value` - TypedArray object to query for type.\n- return\n  - the type of the TypedArray\n  - JERRY_TYPEDARRAY_INVALID if the object was not a TypedArray\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_typedarray_type` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_typedarray_type_t expected_type = JERRY_TYPEDARRAY_UINT32;\n  jerry_value_t typedarray = jerry_typedarray (expected_class, 25);\n\n  jerry_typedarray_type_t type = jerry_typedarray_type (typedarray);\n\n  // 'type' is now JERRY_TYPEDARRAY_UINT32\n\n  jerry_value_free (typedarray);\n}\n```\n\n**See also**\n\n- [jerry_typedarray](#jerry_typedarray)\n- [jerry_typedarray_type_t](#jerry_typedarray_type_t)\n\n\n## jerry_typedarray_length\n\n**Summary**\n\nGet the element count of the TypedArray as specified during creation.\n\nThis is not the same as the byteLength property of a TypedArray object.\n\n**Prototype**\n\n```\njerry_length_t\njerry_typedarray_length (jerry_value_t value);\n```\n\n- `value` - TypedArray object to query\n- return\n  - length (element count) of the TypedArray object\n  - 0 if the object is not a TypedArray\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_typedarray_length` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t array = jerry_typedarray (JERRY_TYPEDARRAY_INT32, 21);\n\n  jerry_length_t element_count = jerry_typedarray_length (array);\n\n  // element_count is now 21.\n\n  jerry_value_free (array);\n}\n```\n\n**See also**\n\n- [jerry_typedarray](#jerry_typedarray)\n\n\n## jerry_typedarray_buffer\n\n**Summary**\n\nGet the ArrayBuffer object used by a TypedArray object.\nAdditionally returns the byteLength and byteOffset properties\nof the TypedArray object.\n\nFor the returned ArrayBuffer the [jerry_value_free](#jerry_value_free)\nmust be called.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_typedarray_buffer (jerry_value_t value,\n                         jerry_length_t *byteOffset,\n                         jerry_length_t *byteLength);\n```\n\n- `value` - TypedArray to get the ArrayBuffer from\n- `byteOffset` - (Optional) returns the start offset of the ArrayBuffer for the TypedArray\n- `byteLength` - (Optional) returns the number of bytes used from the ArrayBuffer for the TypedArray\n- return\n  - TypedArray object's underlying ArrayBuffer object\n  - TypeError if the `value` is not a TypedArray object\n\n*Introduced in version 2.0*.\n\n*Renamed in version 3.0, it was previously known as `jerry_get_typedarray_buffer` in earlier versions.*\n\n**Example**\n\n```c\n{\n  jerry_value_t array = jerry_typedarray (JERRY_TYPEDARRAY_INT16, 11);\n\n  jerry_length_t byteLength = 0;\n  jerry_length_t byteOffset = 0;\n  jerry_value_t buffer = jerry_typedarray_buffer (array, &byteOffset, &byteLength);\n\n  // buffer is an ArrayBuffer object and ArrayBuffer operations can be performed on it\n  // byteLength is 11 * 2 (2 as the TypedArray stores Int16 that is 2 byte elements)\n  // byteOffset is 0\n\n  jerry_value_free (buffer);\n  jerry_value_free (array);\n}\n```\n\n**See also**\n\n- [jerry_typedarray](#jerry_typedarray)\n\n# JSON functions\n\n## jerry_json_parse\n\n**Summary**\n\nParses a CESU-8 or UTF-8 encoded string as a JSON string, creating a JavaScript value. The behaviour is equivalent with\nthe \"JSON.parse(string)\" JS call.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_json_parse (const jerry_char_t *string_p,\n                  jerry_size_t string_size);\n```\n\n- `string_p` - pointer to a JSON string.\n- `string_size` - size of the string.\n- return\n  - `jerry_value_t` containing a JavaScript value.\n  - exception value in case of any parse error.\n\n*Introduced in version 2.0*.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t data[] = \"{\\\"name\\\": \\\"John\\\", \\\"age\\\": 5}\";\n  jerry_value_t obj = jerry_json_parse (data, sizeof (data) - 1);\n\n  /* \"obj\" now contains and object created from the \"data\" JSON string. */\n\n  jerry_value_free (obj);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n## jerry_json_stringify\n\n**Summary**\n\nCreate a JSON string value from a JavaScript value. The behaviour is equivalent with\nthe \"JSON.stringify(input_value)\" JS call.\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_json_stringify (const jerry_value_t input_value);\n```\n\n- `input_value` - a `jerry_value_t` to stringify.\n- return\n  - `jerry_value_t` containing a JSON string.\n  - exception value in case of any stringification error.\n\n*Introduced in version 2.0*.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t obj = jerry_object ();\n  {\n    jerry_value_t key = jerry_string_sz (\"name\");\n    jerry_value_t value = jerry_string_sz (\"John\");\n    jerry_value_free (jerry_object_set (obj, key, value));\n    jerry_value_free (key);\n    jerry_value_free (value);\n  }\n\n  jerry_value_t stringified = jerry_json_stringify (obj);\n\n  /* \"stringified\" now contains a JSON string */\n\n  jerry_value_free (stringified);\n  jerry_value_free (obj);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n# Container Functions\n\n## jerry_container_to_array\n\n**Summary**\n\nReturn a new array containing elements from a Container, or a Container Iterator. Sets the is_key_value_p to true.\nif the container object contains key-value structure and false if not.\n\n*Note*:\n- The return value will be an empty array if the Map/Set or Iterator object was empty or finished.\n- This API function depends on a build option (`JERRY_BUILTIN_CONTAINER`) and can be checked\n  runtime with the `JERRY_FEATURE_MAP, JERRY_FEATURE_SET, JERRY_FEATURE_WEAKMAP, JERRY_FEATURE_WEAKSET`\n  feature enum values.\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n*Introduced in version 3.0*.\n\n**Prototype**\n\n```c\njerry_value_t\njerry_container_to_array (jerry_value_t value,\n                          bool *is_key_value_p);\n```\n\n- `value` - Map/Set or iterator object\n- `is_key_value` - Will be set to `true` if the given container has key-value pairs, `false` otherwise.\n- return value\n  - jerry_value_t containing an array of values from the Map/Set or iterator object\n  - exception if the `value` is nor a Container or a Container Iterator.\n  - `undefined` if the `value` is undefined/null.\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_char_t src[] = \"var map = new Map(); map.set(1,2); map.entries()\";\n  jerry_value_t iterable = jerry_eval (src, sizeof (src) - 1, JERRY_PARSE_NO_OPTS);\n\n  bool is_key_value_container = false;\n  jerry_value_t buffer_from_map = jerry_container_to_array (iterable, &is_key_value_container);\n\n  /*\n    The buffer_from_map contains two elements: 1 and 2, which is the key/value pair of the only item in the set.\n    is_key_value set to true, as the original is a key-value structure (a Map Iterator)\n  */\n\n  jerry_value_free (iterable);\n  jerry_value_free (buffer_from_map);\n\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_container](#jerry_container)\n- [jerry_container_type_t](#jerry_container_type_t)\n\n\n## jerry_container_op\n\n**Summary**\n\nPerform container operation on the given operands (add, delete, set, etc.).\n\n*Note*:\n- Returned value must be freed with [jerry_value_free](#jerry_value_free) when it\n  is no longer needed.\n- This API function depends on a build option (`JERRY_BUILTIN_CONTAINER`) and can be checked\n  runtime with the `JERRY_FEATURE_MAP` , `JERRY_FEATURE_SET` , `JERRY_FEATURE_WEAKMAP` , `JERRY_FEATURE_WEAKSET`\n  feature enum values.\n  see: [jerry_feature_enabled](#jerry_feature_enabled).\n\n\n**Prototype**\n\n```c\njerry_value_t\njerry_container_op (jerry_container_op_t operation,\n                    jerry_value_t container,\n                    jerry_value_t *arguments,\n                    uint32_t arguments_number)\n```\n\n - `operation` - container operation\n - `container` - this value\n - `arguments` - array of arguments\n - `arguments_number` - number of arguments\n - result if the operation is successful\n - exception, otherwise\n\n*Renamed in version 3.0, it was previously known as `jerry_container_operation` in earlier versions.*\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t map = jerry_container (JERRY_CONTAINER_TYPE_MAP, NULL, 0);\n  jerry_value_t key_str = jerry_string_sz (\"number\");\n  jerry_value_t number = jerry_number (10);\n  jerry_value_t args[2] = {key_str, number};\n\n  jerry_value_t result = jerry_container_op (JERRY_CONTAINER_OP_SET, map, args, 2);\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_SIZE, map, NULL, 0);\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_CLEAR, map, NULL, 0);\n  jerry_value_free (result);\n\n  jerry_value_free (map);\n  jerry_value_free (key_str);\n  jerry_value_free (number);\n\n  jerry_cleanup ();\n  return 0;\n}\n```\n\n**See also**\n\n- [jerry_container](#jerry_container)\n- [jerry_container_type_t](#jerry_container_type_t)\n"
  },
  {
    "path": "docs/03.API-EXAMPLE.md",
    "content": "JerryScript Engine can be embedded into any application, providing the way to run JavaScript in a large range of environments - from desktops to low-memory microcontrollers.\n\nThis guide is intended to introduce you to JerryScript embedding API and to create a minimal JavaScript shell.\nThe examples are not using all API methods please also check out the API reference document which contains additional examples.\n\n\n## Before trying out the examples: Get and build JerryScript library\n\nBefore getting started using the JerryScript library it should be cloned and built for a target os/device.\n\nThere are quite a few configuration options but for these examples the JerryScript is built\n**with default configuration** and installed to a user directory on a Linux system.\nThis is done by the following commands:\n\n```sh\n$ mkdir jerry\n$ cd jerry\n$ git clone https://github.com/jerryscript-project/jerryscript.git\n$ jerryscript/tools/build.py --builddir=$(pwd)/example_build --cmake-param=\"-DCMAKE_INSTALL_PREFIX=$(pwd)/example_install/\"\n$ make -C $(pwd)/example_build install\n```\n\nWith this the JerryScript library is installed into the `$(pwd)/example_install/{include,lib}` directories.\n\nIn this guide we will use `pkg-config` to ease the usage of headers and libraries.\nIn order to do so, the following export is required (executed from the jerry directory):\n\n```sh\n$ export PKG_CONFIG_PATH=$(pwd)/example_install/lib/pkgconfig/\n```\n\nTest if the `pkg-config` works for JerryScript:\n\n```sh\n$ pkg-config --cflags --libs libjerry-core libjerry-port libjerry-ext libjerry-math\n```\n\n## Example 2. Split engine initialization and script execution.\n\nIn this example the engine is initialized directly with the `jerry_init` method\nand cleaned up with the `jerry_cleanup` method. The example JavaScript code\nis directly parsed and executed via the `jerry_eval` method. Each `jerry_value_t`\nreturned by the API methods is freed with the `jerry_value_free` method.\n\nTo make sure that the code parsing and execution was ok, the `jerry_value_is_exception`\nmethod is used to check for any errors.\n\nUse the following code for the `api-example-2.c` file:\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  const jerry_char_t script[] = \"var str = 'Hello, World!';\";\n  const jerry_length_t script_size = sizeof (script) - 1;\n  /* Note: sizeof can be used here only because the compiler knows the static character arrays's size.\n   * If this is not the case, strlen should be used instead.\n   */\n\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Run the demo script with 'eval' */\n  jerry_value_t eval_ret = jerry_eval (script,\n                                       script_size,\n                                       JERRY_PARSE_NO_OPTS);\n\n  /* Check if there was any error (syntax or runtime) */\n  bool run_ok = !jerry_value_is_exception (eval_ret);\n\n  /* Parsed source code must be freed */\n  jerry_value_free (eval_ret);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return (run_ok ? 0 : 1);\n}\n```\n\nTo compile it one can use the following command:\n\n```sh\n$ gcc api-example-2.c -o api-example-2 $(pkg-config --cflags --libs libjerry-core libjerry-port libjerry-math)\n```\n\nIf everything is correct the application returns with a zero exit code:\n\n```\n$ ./api-example-2\n$ echo $?\n```\n\n## Example 3. Split JavaScript parsing and script execution\n\nIn this example the `jerry_eval` is replaced with a more common API calls:\n\n- script code setup - `jerry_parse`.\n- script execution - `jerry_run`.\n\nThe `api-example-3.c` file should contain the following code:\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n\nint\nmain (void)\n{\n  bool run_ok = false;\n\n  const jerry_char_t script[] = \"var str = 'Hello, World!';\";\n\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Setup Global scope code */\n  jerry_value_t parsed_code = jerry_parse (script, sizeof (script) - 1, NULL);\n\n  /* Check if there is any JS code parse error */\n  if (!jerry_value_is_exception (parsed_code))\n  {\n    /* Execute the parsed source code in the Global scope */\n    jerry_value_t ret_value = jerry_run (parsed_code);\n\n    /* Check the execution return value if there is any error */\n    run_ok = !jerry_value_is_exception (ret_value);\n\n    /* Returned value must be freed */\n    jerry_value_free (ret_value);\n  }\n\n  /* Parsed source code must be freed */\n  jerry_value_free (parsed_code);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return (run_ok ? 0 : 1);\n}\n```\n\nTo compile it one can use the following command:\n\n```sh\n$ gcc api-example-3.c -o api-example-3 $(pkg-config --cflags --libs libjerry-core libjerry-port libjerry-math)\n```\n\nIf everything is correct the application returns with a zero exit code:\n\n```\n$ ./api-example-3\n$ echo $?\n```\n\n## Example 4. Adding a C method for JavaScript\n\nThe previous examples were not that eye catching as there were no visual output by the JavaScript code\nand C program.\n\nIn this example a very simple \"print\" method is added which prints out a static string.\nThis method will be implemented in C and will be called from the JavaScript code.\nFor this a few extra API methods are required:\n\n- `jerry_current_realm`\n- `jerry_string_sz`\n- `jerry_object_set`\n- `jerry_function_external`\n\nThe `api-example-4.c` file should contain the following code:\n\n[doctest]: # ()\n\n```c\n#include <stdio.h>\n#include \"jerryscript.h\"\n\nstatic jerry_value_t\nprint_handler (const jerry_call_info_t *call_info_p,\n               const jerry_value_t arguments[],\n               const jerry_length_t argument_count)\n{\n  /* No arguments are used in this example */\n  /* Print out a static string */\n  printf (\"Print handler was called\\n\");\n\n  /* Return an \"undefined\" value to the JavaScript engine */\n  return jerry_undefined ();\n}\n\nint\nmain (void)\n{\n  const jerry_char_t script[] = \"print ();\";\n  const jerry_length_t script_size = sizeof (script) - 1;\n\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Add the \"print\" method for the JavaScript global object */\n  {\n    /* Get the \"global\" object */\n    jerry_value_t global_object = jerry_current_realm ();\n    /* Create a \"print\" JS string */\n    jerry_value_t property_name_print = jerry_string_sz (\"print\");\n    /* Create a function from a native C method (this function will be called from JS) */\n    jerry_value_t property_value_func = jerry_function_external (print_handler);\n    /* Add the \"print\" property with the function value to the \"global\" object */\n    jerry_value_t set_result = jerry_object_set (global_object, property_name_print, property_value_func);\n\n    /* Check if there was no error when adding the property (in this case it should never happen) */\n    if (jerry_value_is_exception (set_result)) {\n      printf (\"Failed to add the 'print' property\\n\");\n    }\n\n    /* Release all jerry_value_t-s */\n    jerry_value_free (set_result);\n    jerry_value_free (property_value_func);\n    jerry_value_free (property_name_print);\n    jerry_value_free (global_object);\n  }\n\n  /* Setup Global scope code */\n  jerry_value_t parsed_code = jerry_parse (script, script_size, NULL);\n\n  if (!jerry_value_is_exception (parsed_code))\n  {\n    /* Execute the parsed source code in the Global scope */\n    jerry_value_t ret_value = jerry_run (parsed_code);\n\n    /* Returned value must be freed */\n    jerry_value_free (ret_value);\n  }\n\n  /* Parsed source code must be freed */\n  jerry_value_free (parsed_code);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n\nTo compile it one can use the following command:\n\n```sh\n$ gcc api-example-4.c -o api-example-4 $(pkg-config --cflags --libs libjerry-core libjerry-port libjerry-math)\n```\n\nIf everything is correct the application should print out the message present in the `print_handler` method:\n\n```\n$ ./api-example-4\n```\n\n## Example 5. Passing and processing arguments for native C code\n\nIn the previous example the `print_handler` simply wrote a static string to the standard output.\nHowever in most cases this is not useful, ideally the method's argument(s) should be printed.\n\nIn this example the `print_handler` is extended to convert the first\nargument (which probably comes from a JavaScript source) to a JS string and prints it out to the standard output.\n\nNew API methods used:\n\n- `jerry_value_to_string`\n- `jerry_string_to_buffer`\n\nThe `api-example-5.c` file should contain the following code:\n\n[doctest]: # ()\n\n```c\n#include <stdio.h>\n#include \"jerryscript.h\"\n\nstatic jerry_value_t\nprint_handler (const jerry_call_info_t *call_info_p,\n               const jerry_value_t arguments[],\n               const jerry_length_t arguments_count)\n{\n  /* There should be at least one argument */\n  if (arguments_count > 0)\n  {\n    /* Convert the first argument to a string (JS \"toString\" operation) */\n    jerry_value_t string_value = jerry_value_to_string (arguments[0]);\n\n    /* A naive allocation of buffer for the string */\n    jerry_char_t buffer[256];\n\n    /* Copy the whole string to the buffer, without a null termination character,\n     * Please note that if the string does not fit into the buffer nothing will be copied.\n     * More details on the API reference page\n     */\n    jerry_size_t copied_bytes = jerry_string_to_buffer (string_value, JERRY_ENCODING_UTF8, buffer, sizeof (buffer) - 1);\n    buffer[copied_bytes] = '\\0';\n\n    /* Release the \"toString\" result */\n    jerry_value_free (string_value);\n\n    printf (\"%s\\n\", (const char *)buffer);\n  }\n\n  /* Return an \"undefined\" value to the JavaScript engine */\n  return jerry_undefined ();\n}\n\nint\nmain (void)\n{\n  const jerry_char_t script[] = \"print ('Hello from JS!');\";\n  const jerry_length_t script_size = sizeof (script) - 1;\n\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Add the \"print\" method for the JavaScript global object */\n  {\n    /* Get the \"global\" object */\n    jerry_value_t global_object = jerry_current_realm ();\n    /* Create a \"print\" JS string */\n    jerry_value_t property_name_print = jerry_string_sz (\"print\");\n    /* Create a function from a native C method (this function will be called from JS) */\n    jerry_value_t property_value_func = jerry_function_external (print_handler);\n    /* Add the \"print\" property with the function value to the \"global\" object */\n    jerry_value_t set_result = jerry_object_set (global_object, property_name_print, property_value_func);\n\n    /* Check if there was no error when adding the property (in this case it should never happen) */\n    if (jerry_value_is_exception (set_result)) {\n      printf (\"Failed to add the 'print' property\\n\");\n    }\n\n    /* Release all jerry_value_t-s */\n    jerry_value_free (set_result);\n    jerry_value_free (property_value_func);\n    jerry_value_free (property_name_print);\n    jerry_value_free (global_object);\n  }\n\n  /* Setup Global scope code */\n  jerry_value_t parsed_code = jerry_parse (script, script_size, NULL);\n\n  if (!jerry_value_is_exception (parsed_code))\n  {\n    /* Execute the parsed source code in the Global scope */\n    jerry_value_t ret_value = jerry_run (parsed_code);\n\n    /* Returned value must be freed */\n    jerry_value_free (ret_value);\n  }\n\n  /* Parsed source code must be freed */\n  jerry_value_free (parsed_code);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n\nTo compile it one can use the following command:\n\n```sh\n$ gcc api-example-5.c -o api-example-5 $(pkg-config --cflags --libs libjerry-core libjerry-port libjerry-math)\n```\n\nIf everything is correct the application should print out the string passed for the `print` method in the JS code:\n\n```\n$ ./api-example-5\n```\n\n\n## Example 6. Using JerryScript Extensions\n\nSome of the previous examples used a \"print\" method to write data out to the standard output.\nFor convenience JerryScript provides an extension to add a simple \"print\" handler which\ncan be used by other applications.\n\nIn this example the following extension methods are used:\n\n- `jerryx_register_global`\n- `jerryx_handler_print`\n\nIn further examples this \"print\" handler will be used.\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/handlers.h\"\n\nint\nmain (void)\n{\n  const jerry_char_t script[] = \"print ('Hello from JS with ext!');\";\n  const jerry_length_t script_size = sizeof (script) - 1;\n\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Register 'print' function from the extensions to the global object */\n  jerryx_register_global (\"print\", jerryx_handler_print);\n\n  /* Setup Global scope code */\n  jerry_value_t parsed_code = jerry_parse (script, script_size, NULL);\n\n  if (!jerry_value_is_exception (parsed_code))\n  {\n    /* Execute the parsed source code in the Global scope */\n    jerry_value_t ret_value = jerry_run (parsed_code);\n\n    /* Returned value must be freed */\n    jerry_value_free (ret_value);\n  }\n\n  /* Parsed source code must be freed */\n  jerry_value_free (parsed_code);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n\nTo compile it one can use the following command:\n\n(**Note** that the `libjerry-ext` was added **before** the `libjerry-port` entry for the `pkg-config` call.\n\n```sh\n$ gcc api-example-6.c -o api-example-6 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port libjerry-math)\n```\n\nIf everything is correct the application should print out the string passed for the `print` method in the JS code:\n\n```\n$ ./api-example-6\n```\n\n## Example 7. Interaction with JavaScript environment - adding a string property\n\nPreviously a C method was registered for the global object, now this examples show how one can add a string\nproperty.\n\nUse the following code as the `api-example-7.c` file:\n\n[doctest]: # ()\n\n```c\n#include <stdio.h>\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n\nint\nmain (void)\n{\n  const jerry_char_t script[] = \"print (my_var);\";\n\n  /* Initializing JavaScript environment */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Register 'print' function from the extensions */\n  jerryx_register_global (\"print\", jerryx_handler_print);\n\n  /* Getting pointer to the Global object */\n  jerry_value_t global_object = jerry_current_realm ();\n\n  /* Constructing strings */\n  jerry_value_t prop_name = jerry_string_sz (\"my_var\");\n  jerry_value_t prop_value = jerry_string_sz (\"Hello from C!\");\n\n  /* Setting the string value as a property of the Global object */\n  jerry_value_t set_result = jerry_object_set (global_object, prop_name, prop_value);\n  /* The 'set_result' should be checked if there was any error */\n  if (jerry_value_is_exception (set_result)) {\n    printf (\"Failed to add the 'my_var' property\\n\");\n  }\n  jerry_value_free (set_result);\n\n  /* Releasing string values, as it is no longer necessary outside of engine */\n  jerry_value_free (prop_name);\n  jerry_value_free (prop_value);\n\n  /* Releasing the Global object */\n  jerry_value_free (global_object);\n\n  /* Now starting script that would output value of just initialized field */\n  jerry_value_t eval_ret = jerry_eval (script,\n                                       sizeof (script) - 1,\n                                       JERRY_PARSE_NO_OPTS);\n\n  /* Free JavaScript value, returned by eval */\n  jerry_value_free (eval_ret);\n\n  /* Freeing engine */\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\nTo compile it one can use the following command:\n\n(**Note** that the `libjerry-ext` was added **before** the `libjerry-port` entry for the `pkg-config` call.\n\n```sh\n$ gcc api-example-7.c -o api-example-7 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port libjerry-math)\n```\n\nThe sample will output 'Hello from C!'. However, now it is not just a part of the source script, but the value, dynamically supplied to the engine:\n\n```\n$ ./api-example-7\n```\n\n## Example 8. Description of JerryScript value descriptors\n\nJerryScript value can be a boolean, number, null, object, string, undefined or some special type of objects (arraybuffer, symbols, etc).\n\nThere is a special \"error\" value which wraps another value. This \"error\" can be created by throwing a JavaScript value from JS code\nor via API method(s). It is advised to check for this error with the `jerry_value_is_exception` method as not all API methods\ncan process error values. To extract the value from the \"error\" the API method `jerry_exception_value` should be used.\nIf an error object is created via API method (for example with `jerry_error`) the \"error\" value is automatically created.\n\nNotice the difference between error value and error object:\n- The error object is a object which was constructed via one of the `Error` objects (available from the global object or from API).\n  For example in JS such object be created with the following code example:\n\n```js\nvar error_object = new Error (\"error message\");\n```\n\n- The error value is not an object on its own. This is the exception raised/thrown either via API methods or from JS.\n  For example, creating such error value in JS would look like this:\n\n```js\nthrow \"message\";\n```\n\nTo check what type a given `jerry_value_t` is the `jerry_value_is_*` methods or the `jerry_value_type` could be used.\nFor example the following code snippet could print out a few types (not all types are checked):\n\n[doctest]: # (test=\"compile\")\n\n```c\n#include <stdio.h>\n#include <stdlib.h>\n#include \"jerryscript.h\"\n\nstatic void\nprint_value (const jerry_value_t jsvalue)\n{\n  jerry_value_t value;\n  /* If there is an error extract the object from it */\n  if (jerry_value_is_exception (jsvalue))\n  {\n    printf (\"Error value detected: \");\n    value = jerry_exception_value (jsvalue, false);\n  }\n  else\n  {\n    value = jerry_value_copy (jsvalue);\n  }\n\n  if (jerry_value_is_undefined (value))\n  {\n    printf (\"undefined\");\n  }\n  else if (jerry_value_is_null (value))\n  {\n    printf (\"null\");\n  }\n  else if (jerry_value_is_boolean (value))\n  {\n    if (jerry_value_is_true (value))\n    {\n      printf (\"true\");\n    }\n    else\n    {\n      printf (\"false\");\n    }\n  }\n  /* Float value */\n  else if (jerry_value_is_number (value))\n  {\n    printf (\"number: %lf\", jerry_value_as_number (value));\n  }\n  /* String value */\n  else if (jerry_value_is_string (value))\n  {\n    jerry_char_t str_buf_p[256];\n\n    /* Determining required buffer size */\n    jerry_size_t req_sz = jerry_string_size (value, JERRY_ENCODING_CESU8);\n\n    if (req_sz <= 255)\n    {\n      jerry_string_to_buffer (value, JERRY_ENCODING_CESU8, str_buf_p, req_sz);\n      str_buf_p[req_sz] = '\\0';\n      printf (\"%s\", (const char *) str_buf_p);\n    }\n    else\n    {\n      printf (\"error: buffer isn't big enough\");\n    }\n  }\n  /* Object reference */\n  else if (jerry_value_is_object (value))\n  {\n    printf (\"[JS object]\");\n  }\n\n  printf (\"\\n\");\n  jerry_value_free (value);\n}\n```\n\n## Example 8: Simple JavaScript shell\n\nNow all building blocks, necessary to construct JavaScript shell, are ready.\n\nShell operation can be described with the following loop:\n\n- read command;\n- if command is 'quit'\n  - exit loop;\n- else\n  - eval (command);\n  - print result of eval;\n  - loop.\n\nSee the following `api-example-8-shell.c` file:\n\n[doctest]: # (test=\"link\")\n\n```c\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n\nstatic void\nprint_value (const jerry_value_t jsvalue)\n{\n  jerry_value_t value;\n  /* If there is an error extract the object from it */\n  if (jerry_value_is_exception (jsvalue))\n  {\n    printf (\"Error value detected: \");\n    value = jerry_exception_value (jsvalue, false);\n  }\n  else\n  {\n    value = jerry_value_copy (jsvalue);\n  }\n\n  if (jerry_value_is_undefined (value))\n  {\n    printf (\"undefined\");\n  }\n  else if (jerry_value_is_null (value))\n  {\n    printf (\"null\");\n  }\n  else if (jerry_value_is_boolean (value))\n  {\n    if (jerry_value_is_true (value))\n    {\n      printf (\"true\");\n    }\n    else\n    {\n      printf (\"false\");\n    }\n  }\n  /* Float value */\n  else if (jerry_value_is_number (value))\n  {\n    printf (\"number: %lf\", jerry_value_as_number (value));\n  }\n  /* String value */\n  else if (jerry_value_is_string (value))\n  {\n    jerry_char_t str_buf_p[256];\n\n    /* Determining required buffer size */\n    jerry_size_t req_sz = jerry_string_size (value, JERRY_ENCODING_CESU8);\n\n    if (req_sz <= 255)\n    {\n      jerry_string_to_buffer (value, JERRY_ENCODING_CESU8, str_buf_p, req_sz);\n      str_buf_p[req_sz] = '\\0';\n      printf (\"%s\", (const char *) str_buf_p);\n    }\n    else\n    {\n      printf (\"error: buffer isn't big enough\");\n    }\n  }\n  /* Object reference */\n  else if (jerry_value_is_object (value))\n  {\n    printf (\"[JS object]\");\n  }\n\n  printf (\"\\n\");\n  jerry_value_free (value);\n}\n\nint\nmain (void)\n{\n  bool is_done = false;\n\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Register 'print' function from the extensions */\n  jerryx_register_global (\"print\", jerryx_handler_print);\n\n  while (!is_done)\n  {\n    char cmd[256];\n    char *cmd_tail = cmd;\n    size_t len = 0;\n\n    printf (\"> \");\n\n    /* Read next command */\n    while (true)\n    {\n      if (fread (cmd_tail, 1, 1, stdin) != 1 && len == 0)\n      {\n        is_done = true;\n        break;\n      }\n      if (*cmd_tail == '\\n')\n      {\n        break;\n      }\n\n      cmd_tail++;\n      len++;\n    }\n\n    /* If the command is \"quit\", break the loop */\n    if (!strncmp (cmd, \"quit\\n\", sizeof (\"quit\\n\") - 1))\n    {\n      break;\n    }\n\n    jerry_value_t ret_val;\n\n    /* Evaluate entered command */\n    ret_val = jerry_eval ((const jerry_char_t *) cmd,\n                          len,\n                          JERRY_PARSE_NO_OPTS);\n\n    /* Print out the value */\n    print_value (ret_val);\n\n    jerry_value_free (ret_val);\n  }\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\nTo compile it one can use the following command:\n\n(**Note** that the `libjerry-ext` was added **before** the `libjerry-port` entry for the `pkg-config` call.\n\n```sh\n$ gcc api-example-8-shell.c -o api-example-8-shell $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port libjerry-math)\n```\n\nThe application reads lines from standard input and evaluates them, one after another. To try out run:\n\n```\n$ ./api-example-8-shell\n```\n\n\n## Example 9. Creating JS object in global context\n\nIn this example (`api-example-9.c`) an object with a native function is added to the global object.\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n\nstruct my_struct\n{\n  const char *msg;\n} my_struct;\n\n/**\n * Get a string from a native object\n */\nstatic jerry_value_t\nget_msg_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                 const jerry_value_t *args_p, /**< function arguments */\n                 const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  return jerry_string_sz (my_struct.msg);\n} /* get_msg_handler */\n\nint\nmain (void)\n{\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Register 'print' function from the extensions */\n  jerryx_register_global (\"print\", jerryx_handler_print);\n\n  /* Do something with the native object */\n  my_struct.msg = \"Hello, World!\";\n\n  /* Create an empty JS object */\n  jerry_value_t object = jerry_object ();\n\n  /* Create a JS function object and wrap into a jerry value */\n  jerry_value_t func_obj = jerry_function_external (get_msg_handler);\n\n  /* Set the native function as a property of the empty JS object */\n  jerry_value_t prop_name = jerry_string_sz (\"myFunc\");\n  jerry_value_free (jerry_object_set (object, prop_name, func_obj));\n  jerry_value_free (prop_name);\n  jerry_value_free (func_obj);\n\n  /* Wrap the JS object (not empty anymore) into a jerry api value */\n  jerry_value_t global_object = jerry_current_realm ();\n\n  /* Add the JS object to the global context */\n  prop_name = jerry_string_sz (\"MyObject\");\n  jerry_value_free (jerry_object_set (global_object, prop_name, object));\n  jerry_value_free (prop_name);\n  jerry_value_free (object);\n  jerry_value_free (global_object);\n\n  /* Now we have a \"builtin\" object called MyObject with a function called myFunc()\n   *\n   * Equivalent JS code:\n   *                    var MyObject = { myFunc : function () { return \"some string value\"; } }\n   */\n  const jerry_char_t script[] = \" \\\n    var str = MyObject.myFunc (); \\\n    print (str); \\\n  \";\n\n  /* Evaluate script */\n  jerry_value_t eval_ret = jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);\n\n  /* Free JavaScript value, returned by eval */\n  jerry_value_free (eval_ret);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\nTo compile it one can use the following command:\n\n(**Note** that the `libjerry-ext` was added **before** the `libjerry-port` entry for the `pkg-config` call.\n\n```sh\n$ gcc api-example-9.c -o api-example-9 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port libjerry-math)\n```\n\nExecute the example with:\n\n```\n$ ./api-example-9\n```\n\nThe application will generate the following output:\n\n```bash\nHello, World\n```\n\n## Example 10. Extending JS Objects with native functions\n\nThe example creates a JS Object with `jerry_eval`, then it is extended from C with a native function.\nIn addition this native function shows how to get a property value from the object and how to manipulate it.\n\n\nUse the following code for `api-example-10.c`:\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n\n/**\n * Add param to 'this.x'\n */\nstatic jerry_value_t\nadd_handler (const jerry_call_info_t *call_info_p, /**< call information */\n             const jerry_value_t args_p[], /**< function arguments */\n             const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  /* The the 'this_val' is the 'MyObject' from the JS code below */\n  /* Note: that the argument count check is ignored for the example's case */\n\n  /* Get 'this.x' */\n  jerry_value_t prop_name = jerry_string_sz (\"x\");\n  jerry_value_t x_val = jerry_object_get (call_info_p->this_value, prop_name);\n\n  if (!jerry_value_is_exception (x_val))\n  {\n    /* Convert Jerry API values to double */\n    double x = jerry_value_as_number (x_val);\n    double d = jerry_value_as_number (args_p[0]);\n\n    /* Add the parameter to 'x' */\n    jerry_value_t res_val = jerry_number (x + d);\n\n    /* Set the new value of 'this.x' */\n    jerry_value_free (jerry_object_set (call_info_p->this_value, prop_name, res_val));\n    jerry_value_free (res_val);\n  }\n\n  jerry_value_free (x_val);\n  jerry_value_free (prop_name);\n\n  return jerry_undefined ();\n} /* add_handler */\n\nint\nmain (void)\n{\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Register 'print' function from the extensions */\n  jerryx_register_global (\"print\", jerryx_handler_print);\n\n  /* Create a JS object */\n  const jerry_char_t my_js_object[] = \" \\\n    MyObject = \\\n    { x : 12, \\\n      y : 'Value of x is ', \\\n      foo: function () \\\n      { \\\n        return this.y + this.x; \\\n      } \\\n    } \\\n  \";\n\n  jerry_value_t my_js_obj_val;\n\n  /* Evaluate script */\n  my_js_obj_val = jerry_eval (my_js_object,\n                              sizeof (my_js_object) - 1,\n                              JERRY_PARSE_NO_OPTS);\n\n  /* Create a JS function object and wrap into a jerry value */\n  jerry_value_t add_func_obj = jerry_function_external (add_handler);\n\n  /* Set the native function as a property of previously created MyObject */\n  jerry_value_t prop_name = jerry_string_sz (\"add2x\");\n  jerry_value_free (jerry_object_set (my_js_obj_val, prop_name, add_func_obj));\n  jerry_value_free (add_func_obj);\n  jerry_value_free (prop_name);\n\n  /* Free JavaScript value, returned by eval (my_js_object) */\n  jerry_value_free (my_js_obj_val);\n\n  const jerry_char_t script[] = \" \\\n    var str = MyObject.foo (); \\\n    print (str); \\\n    MyObject.add2x (5); \\\n    print (MyObject.foo ()); \\\n  \";\n\n  /* Evaluate script */\n  jerry_value_t eval_ret = jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);\n\n  /* Free JavaScript value, returned by eval */\n  jerry_value_free (eval_ret);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\nTo compile it one can use the following command:\n\n(**Note** that the `libjerry-ext` was added **before** the `libjerry-port` entry for the `pkg-config` call.\n\n```sh\n$ gcc api-example-10.c -o api-example-10 $(pkg-config --cflags --libs libjerry-core libjerry-ext libjerry-port libjerry-math)\n```\n\nExecute the example with:\n\n```\n$ ./api-example-10\n```\n\n```bash\nValue of x is 12\nValue of x is 17\n```\n\n## Example 11. Changing the seed of pseudorandom generated numbers\n\nIf you want to change the seed of `Math.random()` generated numbers, you have to initialize the seed value with `srand`.\nA recommended method is using `jerry_port_current_time()` or something based on a constantly changing value, therefore every run produces truly random numbers.\n\n[doctest]: # ()\n\n```c\n#include <stdlib.h>\n#include \"jerryscript.h\"\n#include \"jerryscript-port.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n\nint\nmain (void)\n{\n  /* Initialize srand value */\n  union { double d; unsigned u; } now = { .d = jerry_port_current_time () };\n  srand (now.u);\n\n  /* Generate a random number, and print it */\n  const jerry_char_t script[] = \"var a = Math.random (); print(a)\";\n\n  /* Initialize the engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Register the print function */\n  jerryx_register_global (\"print\", jerryx_handler_print);\n\n  /* Evaluate the script */\n  jerry_value_t eval_ret = jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);\n\n  /* Free the JavaScript value returned by eval */\n  jerry_value_free (eval_ret);\n\n  /* Cleanup the engine */\n  jerry_cleanup ();\n\n  return 0;\n}\n```\n\n## Further steps\n\nFor further API description, please visit [API Reference page](https://jerryscript-project.github.io/jerryscript/api-reference/) on [JerryScript home page](https://jerryscript-project.github.io/jerryscript/).\n"
  },
  {
    "path": "docs/04.INTERNALS.md",
    "content": "# High-Level Design\n![High-Level Design](img/engines_high_level_design.png)\n\nThe diagram above shows the interactions between the major components of JerryScript: Parser and Virtual Machine (VM). Parser performs translation of input ECMAScript application into the byte-code with the specified format (refer to [Bytecode](#byte-code) and [Parser](#parser) page for details). Prepared bytecode is executed by the Virtual Machine that performs interpretation (refer to [Virtual Machine](#virtual-machine) and [ECMA](#ecma) pages for details).\n\n# Parser\n\nThe parser is implemented as a recursive descent parser. The parser converts the JavaScript source code directly into byte-code without building an Abstract Syntax Tree. The parser depends on the following subcomponents.\n\n## Lexer\n\nThe lexer splits input string (ECMAScript program) into sequence of tokens. It is able to scan the input string not only forward, but it is possible to move to an arbitrary position. The token structure described by structure `lexer_token_t` in `./jerry-core/parser/js/js-lexer.h`.\n\n## Scanner\n\nScanner (`./jerry-core/parser/js/js-parser-scanner.c`) pre-scans the input string to find certain tokens. For example, scanner determines whether the keyword `for` defines a general for or a for-in loop. Reading tokens in a while loop is not enough because a slash (`/`) can indicate the start of a regular expression or can be a division operator.\n\n## Expression Parser\n\nExpression parser is responsible for parsing JavaScript expressions. It is implemented in `./jerry-core/parser/js/js-parser-expr.c`.\n\n## Statement Parser\n\nJavaScript statements are parsed by this component. It uses the [Expression parser](#expression-parser) to parse the constituent expressions. The implementation of Statement parser is located in `./jerry-core/parser/js/js-parser-statm.c`.\n\nFunction `parser_parse_source` carries out the parsing and compiling of the input ECMAScript source code. When a function appears in the source `parser_parse_source` calls `parser_parse_function` which is responsible for processing the source code of functions recursively including argument parsing and context handling. After the parsing, function `parser_post_processing` dumps the created opcodes and returns an `ecma_compiled_code_t*` that points to the compiled bytecode sequence.\n\nThe interactions between the major components shown on the following figure.\n\n![Parser dependency](img/parser_dependency.png)\n\n# Byte-code\n\nThis section describes the compact byte-code (CBC) representation. The key focus is reducing memory consumption of the byte-code representation without sacrificing considerable performance. Other byte-code representations often focus on performance only so inventing this representation is an original research.\n\nCBC is a CISC like instruction set which assigns shorter instructions for frequent operations. Many instructions represent multiple atomic tasks which reduces the bytecode size. This technique is basically a data compression method.\n\n## Compiled Code Format\n\nThe memory layout of the compiled bytecode is the following.\n\n![CBC layout](img/CBC_layout.png)\n\nThe header is a `cbc_compiled_code` structure with several fields. These fields contain the key properties of the compiled code.\n\nThe literals part is an array of ecma values. These values can contain any ECMAScript value types, e.g. strings, numbers, functions and regexp templates. The number of literals is stored in the `literal_end` field of the header.\n\nCBC instruction list is a sequence of bytecode instructions which represents the compiled code.\n\n## Byte-code Format\n\nThe memory layout of a byte-code is the following:\n\n![byte-code layout](img/opcode_layout.png)\n\nEach byte-code starts with an opcode. The opcode is one byte long for frequent and two byte long for rare instructions. The first byte of the rare instructions is always zero (`CBC_EXT_OPCODE`), and the second byte represents the extended opcode. The name of common and rare instructions start with `CBC_` and `CBC_EXT_` prefix respectively.\n\nThe maximum number of opcodes is 511, since 255 common (zero value excluded) and 256 rare instructions can be defined. Currently around 215 frequent and 70 rare instructions are available.\n\nThere are three types of bytecode arguments in CBC:\n\n * __byte argument__: A value between 0 and 255, which often represents the argument count of call like opcodes (function call, new, eval, etc.).\n\n * __literal argument__: An integer index which is greater or equal than zero and less than the `literal_end` field of the header. For further information see next section Literals (next).\n\n * __relative branch__: An 1-3 byte long offset. The branch argument might also represent the end of an instruction range. For example the branch argument of `CBC_EXT_WITH_CREATE_CONTEXT` shows the end of a `with` statement. More precisely the position after the last instruction in the with clause.\n\nArgument combinations are limited to the following seven forms:\n\n* no arguments\n* a literal argument\n* a byte argument\n* a branch argument\n* a byte and a literal arguments\n* two literal arguments\n* three literal arguments\n\n## Literals\n\nLiterals are organized into groups whose represent various literal types. Having these groups consuming less space than assigning flag bits to each literal.\n(In the followings, the mentioned ranges represent those indices which are greater than or equal to the left side and less than the right side of the range. For example a range between `ident_end` and `literal_end` fields of the byte-code header contains those indices, which are greater than or equal to `ident_end`\nand less than `literal_end`. If `ident_end` equals to `literal_end` the range is empty.)\n\nThe two major group of literals are _identifiers_ and _values_.\n\n  * __identifier__: A named reference to a variable. Literals between zero and `ident_end` of the header belongs to here. All of these literals must be a string or undefined. Undefined can only be used for those literals which cannot be accessed by a literal name. For example `function (arg,arg)` has two arguments, but the `arg` identifier only refers to the second argument. In such cases the name of the first argument is undefined. Furthermore optimizations such as *CSE* may also introduce literals without name.\n\n  * __value__: A reference to an immediate value. Literals between `ident_end` and `const_literal_end` are constant values such as numbers or strings. These literals can be used directly by the Virtual Machine. Literals between `const_literal_end` and `literal_end` are template literals. A new object needs to be constructed each time when their value is accessed. These literals are functions and regular expressions.\n\nThere are two other sub-groups of identifiers. *Registers* are those identifiers which are stored in the function call stack. *Arguments* are those registers which are passed by a caller function.\n\nThere are two types of literal encoding in CBC. Both are variable length, where the length is one or two byte long.\n\n  * __small__: maximum 511 literals can be encoded.\n\nOne byte encoding for literals 0 - 254.\n\n```c\nbyte[0] = literal_index\n```\n\nTwo byte encoding for literals 255 - 510.\n\n```c\nbyte[0] = 0xff\nbyte[1] = literal_index - 0xff\n```\n\n  * __full__: maximum 32767 literal can be encoded.\n\nOne byte encoding for literals 0 - 127.\n\n```c\nbyte[0] = literal_index\n```\n\nTwo byte encoding for literals 128 - 32767.\n\n```c\nbyte[0] = (literal_index >> 8) | 0x80\nbyte[1] = (literal_index & 0xff)\n```\n\nSince most functions require less than 255 literal, small encoding provides a single byte literal index for all literals. Small encoding consumes less space than full encoding, but it has a limited range.\n\n## Literal Store\n\nJerryScript does not have a global string table for literals, but stores them into the Literal Store. During the parsing phase, when a new literal appears with the same identifier that has already occurred before, the string won't be stored once again, but the identifier in the Literal Store will be used. If a new literal is not in the Literal Store yet, it will be inserted.\n\n## Byte-code Categories\n\nByte-codes can be placed into four main categories.\n\n### Push Byte-codes\n\nByte-codes of this category serve for placing objects onto the stack. As there are many instructions representing multiple atomic tasks in CBC, there are also many instructions for pushing objects onto the stack according to the number and the type of the arguments. The following table list a few of these opcodes with a brief description.\n\n<span class=\"CSSTableGenerator\" markdown=\"block\">\n\n| byte-code             | description                                           |\n| --------------------- | ----------------------------------------------------- |\n| CBC_PUSH_LITERAL      | Pushes the value of the given literal argument.       |\n| CBC_PUSH_TWO_LITERALS | Pushes the values of the given two literal arguments. |\n| CBC_PUSH_UNDEFINED    | Pushes an undefined value.                            |\n| CBC_PUSH_TRUE         | Pushes a logical true.                                |\n| CBC_PUSH_PROP_LITERAL | Pushes a property whose base object is popped from the stack, and the property name is passed as a literal argument. |\n\n</span>\n\n### Call Byte-codes\n\nThe byte-codes of this category perform calls in different ways.\n\n<span class=\"CSSTableGenerator\" markdown=\"block\">\n\n| byte-code             | description                                                                          |\n| --------------------- | ------------------------------------------------------------------------------------ |\n| CBC_CALL0             | Calls a function without arguments. The return value won't be pushed onto the stack. |\n| CBC_CALL1             | Calls a function with one argument. The return value won't be pushed onto the stack. |\n| CBC_CALL              | Calls a function with n arguments. n is passed as a byte argument. The return value won't be pushed onto the stack. |\n| CBC_CALL0_PUSH_RESULT | Calls a function without arguments. The return value will be pushed onto the stack.  |\n| CBC_CALL1_PUSH_RESULT | Calls a function with one argument. The return value will be pushed onto the stack.  |\n| CBC_CALL2_PROP        | Calls a property function with two arguments. The base object, the property name, and the two arguments are on the stack. |\n\n</span>\n\n### Arithmetic, Logical, Bitwise and Assignment Byte-codes\n\nThe opcodes of this category perform arithmetic, logical, bitwise and assignment operations.\n\n<span class=\"CSSTableGenerator\" markdown=\"block\">\n\n| byte-code               | description                                                                                         |\n| ----------------------- | --------------------------------------------------------------------------------------------------- |\n| CBC_LOGICAL_NOT         | Negates the logical value that popped from the stack. The result is pushed onto the stack.          |\n| CBC_LOGICAL_NOT_LITERAL | Negates the logical value that given in literal argument. The result is pushed onto the stack.      |\n| CBC_ADD                 | Adds two values that are popped from the stack. The result is pushed onto the stack.                |\n| CBC_ADD_RIGHT_LITERAL   | Adds two values. The left one popped from the stack, the right one is given as literal argument.    |\n| CBC_ADD_TWO_LITERALS    | Adds two values. Both are given as literal arguments.                                               |\n| CBC_ASSIGN              | Assigns a value to a property. It has three arguments: base object, property name, value to assign. |\n| CBC_ASSIGN_PUSH_RESULT  | Assigns a value to a property. It has three arguments: base object, property name, value to assign. The result will be pushed onto the stack. |\n\n</span>\n\n### Branch Byte-codes\n\nBranch byte-codes are used to perform conditional and unconditional jumps in the byte-code. The arguments of these instructions are 1-3 byte long relative offsets. The number of bytes is part of the opcode, so each byte-code with a branch argument has three forms. The direction (forward, backward) is also defined by the opcode since the offset is an unsigned value. Thus, certain branch instructions has six forms. Some examples can be found in the following table.\n\n<span class=\"CSSTableGenerator\" markdown=\"block\">\n\n| byte-code                  | description                                                 |\n| -------------------------- | ----------------------------------------------------------- |\n| CBC_JUMP_FORWARD           | Jumps forward by the 1 byte long relative offset argument.  |\n| CBC_JUMP_FORWARD_2         | Jumps forward by the 2 byte long relative offset argument.  |\n| CBC_JUMP_FORWARD_3         | Jumps forward by the 3 byte long relative offset argument.  |\n| CBC_JUMP_BACKWARD          | Jumps backward by the 1 byte long relative offset argument. |\n| CBC_JUMP_BACKWARD_2        | Jumps backward by the 2 byte long relative offset argument. |\n| CBC_JUMP_BACKWARD_3        | Jumps backward by the 3 byte long relative offset argument. |\n| CBC_BRANCH_IF_TRUE_FORWARD | Jumps forward if the value on the top of the stack is true by the 1 byte long relative offset argument. |\n\n</span>\n\n## Snapshot\n\nThe compiled byte-code can be saved into a snapshot, which also can be loaded back for execution. Directly executing the snapshot saves the costs of parsing the source in terms of memory consumption and performance. The snapshot can also be executed from ROM, in which case the overhead of loading it into the memory can also be saved.\n\n\n# Virtual Machine\n\nVirtual machine is an interpreter which executes byte-code instructions one by one. The function that starts the interpretation is `vm_run` in `./jerry-core/vm/vm.c`. `vm_loop` is the main loop of the virtual machine, which has the peculiarity that it is *non-recursive*. This means that in case of function calls it does not calls itself recursively but returns, which has the benefit that it does not burdens the stack as a recursive implementation.\n\n# ECMA\n\nECMA component of the engine is responsible for the following notions:\n\n* Data representation\n* Runtime representation\n* Garbage collection (GC)\n\n## Data Representation\n\nThe major structure for data representation is `ECMA_value`. The lower three bits of this structure encode value tag, which determines the type of the value:\n\n* simple\n* number\n* string\n* object\n* symbol\n* error\n\n![ECMA value representation](img/ecma_value.png)\n\nIn case of number, string and object the value contains an encoded pointer, and\nsimple value is a pre-defined constant which can be:\n\n* undefined\n* null\n* true\n* false\n* empty (uninitialized value)\n\n### Compressed Pointers\n\nCompressed pointers were introduced to save heap space.\n\n![Compressed Pointer](img/ecma_compressed.png)\n\nThese pointers are 8 byte aligned 16 bit long pointers which can address 512 Kb of\nmemory which is also the maximum size of the JerryScript heap. To support even more\nmemory the size of compressed pointers can be extended to 32 bit to cover the entire\naddress space of a 32 bit system by passing \"--cpointer_32_bit on\" to the build\nsystem. These \"uncompressed pointers\" increases the memory consumption by around 20%.\n\n### Number\n\nThere are two possible representation of numbers according to standard IEEE 754:\nThe default is 8-byte (double),\nbut the engine supports the 4-byte (single precision) representation by setting JERRY_NUMBER_TYPE_FLOAT64 to 0 as well.\n\n![Number](img/number.png)\n\nSeveral references to single allocated number are not supported. Each reference holds its own copy of a number.\n\n### String\n\nStrings in JerryScript are not just character sequences, but can hold numbers and so-called magic ids too. For common character sequences (defined in `./jerry-core/lit/lit-magic-strings.ini`) there is a table in the read only memory that contains magic id and character sequence pairs. If a string is already in this table, the magic id of its string is stored, not the character sequence itself. Using numbers speeds up the property access. These techniques save memory.\n\n### Object / Lexical Environment\n\nAn object can be a conventional data object or a lexical environment object. Unlike other data types, object can have references (called properties) to other data types. Because of circular references, reference counting is not always enough to determine dead objects. Hence a chain list is formed from all existing objects, which can be used to find unreferenced objects during garbage collection. The `gc-next` pointer of each object shows the next allocated object in the chain list.\n\n[Lexical environments](http://www.ecma-international.org/ecma-262/5.1/#sec-10.2) are implemented as objects in JerryScript, since lexical environments contains key-value pairs (called bindings) like objects. This simplifies the implementation and reduces code size.\n\n![Object/Lexical environment structures](img/ecma_object.png)\n\nThe objects are represented as following structure:\n\n  * Reference counter - number of hard (non-property) references\n  * Next object pointer for the garbage collector\n  * type (function object, lexical environment, etc.)\n\n### Properties of Objects\n\n![Object properties](img/ecma_object_property.png)\n\nObjects have a linked list that contains their properties. This list actually contains property pairs, in order to save memory described in the followings:\nA property has a one byte long descriptor, a two byte long name and four byte long value. Hence 14 bytes consumed by a property pair. Another two bytes is\nused to show the next property pair, so the total size (16 byte) is divisible by 8.\n\n#### Property Hashmap\n\nIf the number of property pairs reach a limit (currently this limit is defined to 16), a hash map (called [Property Hashmap](#property-hashmap)) is inserted at the first position of the property pair list, in order to find a property using it, instead of finding it by iterating linearly over the property pairs.\n\nProperty hashmap contains 2<sup>n</sup> elements, where 2<sup>n</sup> is larger than the number of properties of the object. Each element can have tree types of value:\n\n* null, indicating an empty element\n* deleted, indicating a deleted property, or\n* reference to the existing property\n\nThis hashmap is a must-return type cache, meaning that every property that the object have, can be found using it.\n\n#### Internal Properties\n\nInternal properties are special properties that carry meta-information that cannot be accessed by the JavaScript code, but important for the engine itself. Some examples of internal properties are listed below:\n\n* [[Class]] - class (type) of the object (ECMA-defined)\n* [[Code]] - points where to find bytecode of the function\n* native code - points where to find the code of a native function\n* [[PrimitiveValue]] for Boolean - stores the boolean value of a Boolean object\n* [[PrimitiveValue]] for Number - stores the numeric value of a Number object\n\n### LCache\n\nLCache is a hashmap for finding a property specified by an object and by a property name. The object-name-property layout of the LCache presents multiple times in a row as it is shown in the figure below.\n\n![LCache](img/ecma_lcache.png)\n\nWhen a property access occurs, a hash value is extracted from the demanded property name and than this hash is used to index the LCache. After that, in the indexed row the specified object and property name will be searched.\n\nIt is important to note, that if the specified property is not found in the LCache, it does not mean that it does not exist (i.e. LCache is a may-return cache). If the property is not found, it will be searched in the property-list of the object, and if it is found there, the property will be placed into the LCache.\n\n### Collections\n\nCollections are array-like data structures, which are optimized to save memory. Actually, a collection is a linked list whose elements are not single elements, but arrays which can contain multiple elements.\n\n### Exception Handling\n\nIn order to implement a sense of exception handling, the return values of JerryScript functions are able to indicate their faulty or \"exceptional\" operation. The return values are ECMA values (see section [Data Representation](#data-representation)) and if an erroneous operation occurred the ECMA_VALUE_ERROR simple value is returned.\n\n### Value Management and Ownership\n\nEvery ECMA value stored by the engine is associated with a virtual \"ownership\", that defines how to manage the value: when to free it when it is not needed anymore and how to pass the value to an other function.\n\nInitially, value is allocated by its owner (i.e. with ownership). The owner has the responsibility for freeing the allocated value. When the value is passed to a function as an argument, the ownership of it will not pass, the called function have to make an own copy of the value. However, as long as a function returns a value, the ownership will pass, thus the caller will be responsible for freeing it.\n"
  },
  {
    "path": "docs/05.PORT-API.md",
    "content": "# Reference\n\n## Process management\n\nIt is questionable whether a library should be able to terminate an application. Any API function can signal an error (ex.: cannot allocate memory), so the engine use the termination approach with this port function.\n\n```c\n/**\n * Init the program\n */\nvoid jerry_port_init (void);\n```\n\n```c\n/**\n * Signal the port that jerry experienced a fatal failure from which it cannot\n * recover.\n *\n * @param code gives the cause of the error.\n *\n * Note:\n *      Jerry expects the function not to return.\n *\n * Example: a libc-based port may implement this with exit() or abort(), or both.\n */\nvoid jerry_port_fatal (jerry_fatal_code_t code);\n```\n\nError codes\n\n```c\ntypedef enum\n{\n  JERRY_FATAL_OUT_OF_MEMORY = 10,\n  JERRY_FATAL_REF_COUNT_LIMIT = 12,\n  JERRY_FATAL_DISABLED_BYTE_CODE = 13,\n  JERRY_FATAL_UNTERMINATED_GC_LOOPS = 14,\n  JERRY_FATAL_FAILED_ASSERTION = 120\n} jerry_fatal_code_t;\n```\n\n```c\n/**\n * Makes the process sleep for a given time.\n *\n * Note:\n *      This port function is called by jerry-core when JERRY_DEBUGGER is set to 1.\n *      Otherwise this function is not used.\n *\n * @param sleep_time milliseconds to sleep.\n */\nvoid jerry_port_sleep (uint32_t sleep_time);\n```\n\n## External context\n\nAllows the user to provide external buffer for isolated engine contexts, so that user\ncan configure the heap size at runtime and run multiple JS applications\nsimultaneously.\n\n```c\n/**\n * Allocate a new context for the engine.\n *\n * This port function is called by jerry_init when JERRY_EXTERNAL_CONTEXT is enabled. Otherwise this function is not\n * used. The engine will pass the size required for the context structure. An implementation must make sure to\n * allocate at least this amount.\n *\n * Excess allocated space will be used as the engine heap when jerryscript is configured to use it's internal allocator,\n * this can be used to control the internal heap size.\n *\n * NOTE: The allocated memory must be pointer-aligned, otherwise the behavior is\n *       undefined.\n *\n * @param context_size: the size of the internal context structure\n *\n * @return total size of the allocated buffer\n */\nsize_t jerry_port_context_alloc (size_t context_size);\n```\n\n```c\n/**\n * Get the currently active context of the engine.\n *\n * This port function is called by jerry-core when JERRY_EXTERNAL_CONTEXT is enabled.\n * Otherwise this function is not used.\n *\n * @return the pointer to the currently used engine context.\n */\nstruct jerry_context_t *jerry_port_context_get (void);\n```\n\n```c\n/**\n * Free the currently used context.\n *\n * This port function is called by jerry_cleanup when JERRY_EXTERNAL_CONTEXT is enabled.\n * Otherwise this function is not used.\n *\n * @return the pointer to the engine context.\n */\nvoid jerry_port_context_free (void);\n```\n\n## I/O\n\n```c\n/**\n * Display or log a debug/error message.\n *\n * The message is passed as a zero-terminated string. Messages may be logged in parts, which\n * will result in multiple calls to this functions. The implementation should consider\n * this before appending or prepending strings to the argument.\n *\n * This function is called with messages coming from the jerry engine as\n * the result of some abnormal operation or describing its internal operations\n * (e.g., data structure dumps or tracing info).\n *\n * The implementation can decide whether error and debug messages are logged to\n * the console, or saved to a database or to a file.\n *\n * @param message_p: the message to log.\n */\nvoid jerry_port_log (const char *message_p);\n```\n\n```c\n/**\n * Print a buffer to standard output\n *\n * This port function is never called from jerry-core directly, it is only used by jerry-ext components to print\n * information.\n *\n * @param buffer_p: input buffer\n * @param buffer_size: data size\n */\nvoid jerry_port_print_buffer (const jerry_char_t *buffer_p, jerry_size_t buffer_size);\n```\n\n```c\n/**\n * Read a line from standard input.\n *\n * The implementation should allocate storage necessary for the string. The result string should include the ending line\n * terminator character(s) and should be zero terminated.\n *\n * An implementation may return NULL to signal that the end of input is reached, or an error occured.\n *\n * When a non-NULL value is returned, the caller will pass the returned value to `jerry_port_line_free` when the line is\n * no longer needed. This can be used to finalize dynamically allocated buffers if necessary.\n *\n * This port function is never called from jerry-core directly, it is only used by some jerry-ext components that\n * require user input.\n *\n * @param out_size_p: size of the input string in bytes, excluding terminating zero byte\n *\n * @return pointer to the buffer storing the string,\n *         or NULL if end of input\n */\njerry_char_t *jerry_port_line_read (jerry_size_t *out_size_p);\n```\n\n```c\n/**\n * Free a line buffer allocated by jerry_port_line_read\n *\n * @param buffer_p: buffer returned by jerry_port_line_read\n */\nvoid jerry_port_line_free (jerry_char_t *buffer_p);\n```\n\n## Filesystem\n\n```\n/**\n * Canonicalize a file path.\n *\n * If possible, the implementation should resolve symbolic links and other directory references found in the input path,\n * and create a fully canonicalized file path as the result.\n *\n * The function may return with NULL in case an error is encountered, in which case the calling operation will not\n * proceed.\n *\n * The implementation should allocate storage for the result path as necessary. Non-NULL return values will be passed\n * to `jerry_port_path_free` when the result is no longer needed by the caller, which can be used to finalize\n * dynamically allocated buffers.\n *\n * NOTE: The implementation must not return directly with the input, as the input buffer is released after the call.\n *\n * @param path_p: zero-terminated string containing the input path\n * @param path_size: size of the input path string in bytes, excluding terminating zero\n *\n * @return buffer with the normalized path if the operation is successful,\n *         NULL otherwise\n */\njerry_char_t *jerry_port_path_normalize (const jerry_char_t *path_p, jerry_size_t path_size);\n```\n\n```c\n/**\n * Free a path buffer returned by jerry_port_path_normalize.\n *\n * @param path_p: the path buffer to free\n */\nvoid jerry_port_path_free (jerry_char_t *path_p);\n```\n\n```c\n/**\n * Get the offset of the basename component in the input path.\n *\n * The implementation should return the offset of the first character after the last path separator found in the path.\n * This is used by the caller to split the path into a directory name and a file name.\n *\n * @param path_p: input zero-terminated path string\n *\n * @return offset of the basename component in the input path\n */\njerry_size_t jerry_port_path_base (const jerry_char_t *path_p);\n```\n\n```c\n/**\n * Open a source file and read its contents into a buffer.\n *\n * When the source file is no longer needed by the caller, the returned pointer will be passed to\n * `jerry_port_source_free`, which can be used to finalize the buffer.\n *\n * @param file_name_p: Path that points to the source file in the filesystem.\n * @param out_size_p: The opened file's size in bytes.\n *\n * @return pointer to the buffer which contains the content of the file.\n */\njerry_char_t *jerry_port_source_read (const char *file_name_p, jerry_size_t *out_size_p);\n```\n\n```c\n/**\n * Free a source file buffer.\n *\n * @param buffer_p: buffer returned by jerry_port_source_read\n */\nvoid jerry_port_source_free (jerry_char_t *buffer_p);\n```\n\n## Date\n\n```c\n/**\n * Get local time zone adjustment in milliseconds for the given input time.\n *\n * The argument is a time value representing milliseconds since unix epoch.\n *\n * Ideally, this function should satisfy the stipulations applied to LocalTZA\n * in section 21.4.1.7 of the ECMAScript version 12.0, as if called with isUTC true.\n *\n * This port function can be called by jerry-core when JERRY_BUILTIN_DATE is enabled.\n * Otherwise this function is not used.\n *\n * @param unix_ms: time value in milliseconds since unix epoch\n *\n * @return local time offset in milliseconds applied to UTC for the given time value\n */\nint32_t jerry_port_local_tza (double unix_ms);\n```\n\n```c\n/**\n * Get the current system time in UTC.\n *\n * This port function is called by jerry-core when JERRY_BUILTIN_DATE is enabled.\n * It can also be used in the implementing application to initialize the random number generator.\n *\n * @return milliseconds since Unix epoch\n */\ndouble jerry_port_current_time (void);\n```\n"
  },
  {
    "path": "docs/06.REFERENCE-COUNTING.md",
    "content": "## Reference counting in JerryScript\n\nIn JerryScript all `jerry_value_t` values are independent\nreferences to internal objects. Values returned by JerryScript\nAPI functions are always live references and must be released\nby `jerry_value_free`.\n\n```c\n  jerry_value_t global = jerry_current_realm ();\n\n  /* The value stored in the 'global' variable contains a live\n   * reference to the global object. The system also keeps its\n   * own live reference to the global object. These two references\n   * are independent, and both must be destroyed before the global\n   * object can be freed. */\n\n  jerry_value_free (global);\n\n  /* Without jerry_value_free() the global object will not\n   * be freed even by jerry_cleanup(). After the reference\n   * is released it becomes a dead reference and cannot be\n   * used anymore. */\n```\n\nMultiple references might refer to the same internal object\neven though their `jerry_value_t` representation might be different.\n\n```c\n  jerry_value_t pi_ref1 = jerry_number (3.14);\n  jerry_value_t pi_ref2 = jerry_value_copy (pi_ref1);\n\n  /* Both pi_ref1 and pi_ref2 refer to the same 3.14 value\n   * although they might not be equal in C (pi_ref1 != pi_ref2). */\n\n  /* Both references must be released. */\n  jerry_value_free (pi_ref1);\n  jerry_value_free (pi_ref2);\n```\n\nReleasing the same `jerry_value_t` twice to release two live\nreferences is not allowed and it might cause crashes. Hence the\nfollowing code is an **INCORRECT WAY** of releasing the 3.14 value.\n\n```c\n  jerry_value_free (pi_ref1);\n  jerry_value_free (pi_ref1);\n```\n\nJerryScript API functions returning with a `jerry_value_t` always\nreturn with a new live reference. Passing a `jerry_value_t` to\nan API function never releases its reference (unless explicitly\nstated in the documentation). The next example shows this\nbehaviour through property getting and setting.\n\n```c\n  jerry_value_t prop_value = jerry_object_get (...);\n\n  /* The prop_value must be released later because both the base\n   * object and the prop_value have an independent reference to\n   * the same JavaScript value. When the operation fails, the\n   * prop_value contains a live reference to an error object.\n   * This reference must be released as well. */\n\n  if (jerry_value_is_exception (prop_value))\n  {\n    /* Errors can be handled here. */\n  }\n  else\n  {\n    /* The application has a live reference to the property\n     * value even if the base object is freed by the garbage\n     * collector. */\n  }\n\n  /* The prop_value must be released. */\n  jerry_value_free (prop_value);\n\n  /* Property setting is the same. */\n\n  jerry_value_t new_prop_value = jerry_number (2.718);\n  jerry_value_t result = jerry_object_set (..., new_prop_value);\n\n  /* If the property set is successful, a new reference is created\n   * for the value referenced by new_prop_value. The new_prop_value\n   * reference must be released regardless of whether the operation\n   * is successful. */\n\n  /* The new_prop_value can be passed to other JerryScript API\n   * functions before the jerry_value_free () call. */\n\n  jerry_value_free (new_prop_value);\n\n  /* The reference stored in the 'result' variable is live whether\n   * the operation is successful or not, and must also be freed. */\n\n  if (jerry_value_is_exception (result))\n  {\n    /* Errors can be handled here. */\n  }\n  else\n  {\n    /* A reference to a true primitive value is returned. */\n  }\n\n  jerry_value_free (result);\n```\n\nThe simplest form of setting a property without error checking\nis the following:\n\n```c\n  /* There are no 'ifs' in this snippet. */\n  jerry_value_free (jerry_object_set (..., new_prop_value));\n  jerry_value_free (new_prop_value);\n```\n\nThe reference returned by a `jerry_external_handler_t` callback\ntransfers the ownership of the live reference. Otherwise the\nreferenced object could be freed by the garbage collector.\n\n```c\njerry_value_t my_external_handler (const jerry_value_t function_obj,\n                                   const jerry_value_t this_val,\n                                   const jerry_value_t args_p[],\n                                   const jerry_length_t args_count\n{\n  /* Do not release function_obj, this_val, and args_p because\n   * these references are automatically released after the handler\n   * is returned. This approach reduces code size which is useful\n   * on embedded systems. However you can create other references\n   * to them by calling jerry_value_copy () if needed. */\n\n  /* Since the ownership of the reference is transferred to the\n   * caller the following snippet is valid. */\n\n  /* If the value to be returned is needed for other purposes the\n   * jerry_value_copy () can be used to create new references. */\n  return jerry_string (...);\n}\n```\n\nDuplicating a `jerry_value_t` in C does not create another live reference.\n\n```c\n  jerry_value_t undef = jerry_undefined ();\n  jerry_value_t undef2 = undef;\n\n  /* Releasing either undef or undef2 is valid but not both.\n   * After the release both references become dead (invalid). */\n  jerry_value_free (undef2);\n\n  /* Dead references can be reassigned again. */\n  undef = jerry_boolean (true);\n```\n\nReferences can be duplicated in C as long as only one of them is freed.\n\n```c\n  jerry_value_t a = jerry_boolean (true);\n\n  jerry_value_t b = a;\n  jerry_value_t c = a;\n\n  /* A new reference is assigned to 'a'. */\n  a = jerry_boolean (false);\n\n  [...]\n\n  jerry_value_free (a);\n  /* The 'a' (boolean false) reference becomes dead (invalid). */\n\n  jerry_value_free (c);\n  /* Both 'b' and 'c' (boolean true) references become dead. */\n\n  /* Since all references are released, no memory leak occurs. */\n```\n"
  },
  {
    "path": "docs/07.DEBUGGER.md",
    "content": "## JerryScript debugger interface\n\nJerryScript provides a remote debugger which allows debugging\nJavaScript programs. The debugger has two main components:\na server which is part of the JerryScript binary and a\nseparate client application. Currently a Python-based debugger\nclient is available in the /jerry-debugger subdirectory.\nThis simple application demonstrates the communication protocol\nbetween the client and server, and can be reused by integrated\ndevelopment environments.\n\n## Setting up the debugger server\n\nThe following arguments must be passed to `tools/build.py`:\n\n`--jerry-debugger=on`\n\nThe transport layer of the communication protocol is pluggable.\nAt the moment, a WebSocket-based implementation is provided as a\nJerryScript extension, which transmits messages over TCP/IP networks.\nIf necessary/implemented, any reliable stream or datagram based\nprotocol can be used for transmitting debugger messages.\n\n## Debugging JavaScript applications\n\nThe debugger client must be connected to the server before the\nJavaScript application runs. On-the-fly attachment is supported\nfor more than one file, right after the engine initialization\n(this feature is available with the python client). The debugging\ninformation (e.g. line index of each possible breakpoint location)\nis not preserved by JerryScript. The client is expected to be run\non a system with much more resources and it should be capable of\nstoring this information. JerryScript frees all debug information\nafter it is transmitted to the client to save memory.\n\nThe following argument makes JerryScript wait for a client\nconnection:\n\n`--start-debug-server`\n\nThe following argument makes JerryScript wait for a client\nsource code:\n\n`--debugger-wait-source`\n\nIt is also recommended to increase the log level to see\nthe *Waiting for client connection* message:\n\n`--log-level 2`\n\nThe Python client can connect to the server by specifying its\nIP address on the command line. The address can be localhost\nif the server and the client are running on the same machine.\n\nAfter the connection is established the execution can be\ncontrolled by the debugger. The debugger always stops at\nthe first possible breakpoint location. The effect is the\nsame as using the `stop` command. This allows inserting\nbreakpoints right before the meaningful part of the execution\nstarts.\n\nAll available commands of the client can be queried by the\n`help` command.\n\n## Integrating debugger support into applications using JerryScript\n\nWhen using the extension-provided WebSocket transport layer, the\ndebugger can be enabled by calling `jerryx_debugger_after_connect\n(jerryx_debugger_tcp_create (debug_port) && jerryx_debugger_ws_create ())`\nafter the `jerry_init ()` function. It initializes the debugger and\nblocks until a client connects.\n(Custom transport layers may be implemented and initialized similarly.\nCurrently, `jerryx_debugger_rp_create ()` for raw packet transport layer and\n`jerryx_debugger_serial_create (const char* config)` for serial protocol\nare also available.)\n\nThe source name provided to `jerry_parse ()` is used by the client\nto identify the source name of the source code. This source name\nis usually a file name.\n\n## JerryScript debugger C-API interface\n\nThe following section describes the debugger functions\navailable to the host application.\n\n## JerryScript debugger types\n\n## jerry_debugger_wait_for_source_callback_t\n\n**Summary**\n\nThis callback function is called by\n[jerry_debugger_wait_for_client_source](#jerry_debugger_wait_for_client_source)\nwhen a source code is received successfully.\n\n**Prototype**\n\n```c\ntypedef jerry_value_t\n(*jerry_debugger_wait_for_source_callback_t) (const jerry_char_t *source_name_p,\n                                              size_t source_name_size,\n                                              const jerry_char_t *source_p,\n                                              size_t source_size,\n                                              void *user_p);\n```\n\n- `source_name_p` - source (usually a file) name of the source code\n- `source_name_size` - size of source name\n- `source_p` - source code character data\n- `source_size` - size of source code\n- `user_p` - custom pointer passed to [jerry_debugger_wait_for_client_source](#jerry_debugger_wait_for_client_source)\n\n\n## JerryScript debugger functions\n\n### jerry_debugger_is_connected\n\n**Summary**\n\nReturns true if a remote debugger client is connected.\n\n**Prototype**\n\n```c\nbool\njerry_debugger_is_connected (void);\n```\n\n**Example**\n\n[doctest]: # (test=\"link\")\n\n```c\n#include <stdio.h>\n\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/debugger.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n  jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)\n                                 && jerryx_debugger_ws_create ());\n\n  if (jerry_debugger_is_connected ())\n  {\n    printf (\"A remote debugger client is connected.\");\n  }\n\n  jerry_cleanup ();\n}\n```\n\n### jerry_debugger_stop\n\n**Summary**\n\nStops execution at the next available breakpoint if a remote\ndebugger client is connected and the engine is not waiting at\na breakpoint. The engine will stop regardless the breakpoint\nis enabled or not.\n\n**Prototype**\n\n```c\nvoid\njerry_debugger_stop (void)\n```\n\n**Example**\n\n[doctest]: # (test=\"link\")\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/debugger.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n  jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)\n                                 && jerryx_debugger_ws_create ());\n\n  jerry_debugger_stop ();\n\n  jerry_cleanup ();\n}\n```\n\n**See also**\n\n- [jerry_debugger_continue](#jerry_debugger_continue)\n\n### jerry_debugger_continue\n\n**Summary**\n\nIf the engine would stop at the next available breakpoint it\ncancels this effect. The engine will still stop at enabled\nbreakpoints. This function effectively negates the effect of\n[jerry_debugger_stop ()](#jerry_debugger_stop) calls or stop\nrequests issued by the debugger client.\n\n**Prototype**\n\n```c\nvoid\njerry_debugger_continue (void)\n```\n\n**Example**\n\n[doctest]: # (test=\"link\")\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/debugger.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n  jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)\n                                 && jerryx_debugger_ws_create ());\n\n  jerry_debugger_continue ();\n\n  jerry_cleanup ();\n}\n```\n\n**See also**\n\n- [jerry_debugger_stop](#jerry_debugger_stop)\n\n### jerry_debugger_stop_at_breakpoint\n\n**Summary**\n\nEnables or disables stopping at breakpoints. When stopping is\ndisabled all breakpoints are ignored including user enabled\nbreakpoints. This allows hidden execution of ECMAScript code.\n\n**Prototype**\n\n```c\nvoid\njerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint)\n```\n\n- `enable_stop_at_breakpoint` - enable (=`true`) or disable (=`false`) stopping at breakpoints\n\n**Example**\n\n[doctest]: # (test=\"link\")\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/debugger.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n  jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)\n                                 && jerryx_debugger_ws_create ());\n\n  jerry_debugger_stop_at_breakpoint (true);\n\n  // Protected execution of JavaScript code.\n  const jerry_char_t script[] = \"42\";\n  jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);\n\n  jerry_debugger_stop_at_breakpoint (false);\n\n  jerry_cleanup ();\n}\n```\n\n### jerry_debugger_wait_for_client_source\n\n**Summary**\n\nAsks the client to provide the next source code. The function\nwaits until the whole source code is received. As a reply the\nthe client may request a context reset or notify that no more\nsource is available. These notifications are passed back as the\nreturn value of the function.\n\n**Prototype**\n\n```c\njerry_debugger_wait_for_source_status_t\njerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t callback_p,\n                                       void *user_p,\n                                       jerry_value_t *return_value)\n```\n\n**Example**\n\n[doctest]: # (test=\"link\")\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/debugger.h\"\n\n/**\n * Runs the source code received by jerry_debugger_wait_for_client_source.\n */\nstatic jerry_value_t\nwait_for_source_callback (const jerry_char_t *source_name_p, /**< source name */\n                          size_t source_name_size, /**< size of source name */\n                          const jerry_char_t *source_p, /**< source code */\n                          size_t source_size, /**< source code size */\n                          void *user_p /**< user pointer */)\n{\n  (void) user_p;\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string ((const jerry_char_t *) source_name_p,\n                                              (jerry_size_t) source_name_size,\n                                              JERRY_ENCODING_UTF8);\n\n  jerry_value_t ret_val = jerry_parse (source_p,\n                                       source_size,\n                                       &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  if (!jerry_value_is_exception (ret_val))\n  {\n    jerry_value_t func_val = ret_val;\n    ret_val = jerry_run (func_val);\n    jerry_value_free (func_val);\n  }\n\n  return ret_val;\n} /* wait_for_source_callback */\n\nint\nmain (void)\n{\n  jerry_debugger_wait_for_source_status_t receive_status;\n\n  do\n  {\n    /* Create a new JerryScript instance when a context reset is\n     * received. Applications usually registers their core bindings\n     * here as well (e.g. print, setTimeout). */\n    jerry_init (JERRY_INIT_EMPTY);\n    jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)\n                                   && jerryx_debugger_ws_create ());\n\n    do\n    {\n      jerry_value_t run_result;\n\n      receive_status = jerry_debugger_wait_for_client_source (wait_for_source_callback,\n                                                              NULL,\n                                                              &run_result);\n\n      jerry_value_free (run_result);\n    }\n    while (receive_status == JERRY_DEBUGGER_SOURCE_RECEIVED);\n\n    jerry_cleanup ();\n  }\n  while (receive_status == JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED);\n\n  if (receive_status == JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED)\n  {\n    // Handle the failure (e.g. display an error).\n  }\n  return 0;\n}\n```\n\n### jerry_debugger_send_output\n\n**Summary**\n\nSends the program's output to the debugger client.\n\n**Prototype**\n\n```c\nvoid\njerry_debugger_send_output (const jerry_char_t *buffer, jerry_size_t str_size)\n```\n\n**Example**\n\n[doctest]: # (test=\"link\")\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/debugger.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n  jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)\n                                 && jerryx_debugger_ws_create ());\n\n  jerry_char_t my_output[] = \"Hey, this should be sent too!\";\n  jerry_size_t my_output_size = sizeof (my_output);\n\n  jerry_debugger_send_output (my_output, my_output_size);\n\n  jerry_cleanup ();\n}\n```\n"
  },
  {
    "path": "docs/08.CODING-STANDARDS.md",
    "content": "# JerryScript Coding Standards\n\nThis text is a brief overview of JerryScript Coding Standards.\nEach rule starts with a short description followed by several\nexamples. We believe examples are better than long explanations.\nPlease follow these guidelines when you submit a patch for\nreview.\n\n## General rules\n\n* Indentation is two spaces.\n* Tab characters are not allowed.\n* Maximum line length is 120 characters (excluding newline).\n* No trailing white space is allowed.\n* Run `tools/run-tests.py --check-format` to check several\n  of the coding conventions automatically.\n\n## Comments\n\nOnly block comments (`/* */`) are allowed in JerryScript.\nComments should be complete sentences (e.g. start with an\nupper case letter), except for return value, field and\nargument descriptions (see the exceptions below). The\ntext part of a comment should focus on explaining *why*\nthe code is doing something rather than *what* the code\nis doing.\n\n```diff\n+++ Good +++\n```\n\n```c\n  /* A perfect comment. */\n\n  /* A perfect multiline\n   * comment. Each line should\n   * start with an asterisk. */\n```\n\n```diff\n--- Bad ---\n```\n\n```c\n  // Double slash comments are not allowed.\n\n  /* not a complete sentence */\n\n  /* A bad multiline\n     comment. */\n```\n\nAll types, constants and functions require a description in\nJerryScript. These comments should start with `/**`. The starting\n`/**` and ending `*/` must be on separate lines.\n\n```diff\n+++ Good +++\n```\n\n```c\n/**\n * A correct description.\n */\n```\n\n```diff\n--- Bad ---\n```\n\n```c\n/** An incorrect description. */\n```\n\n## Preprocessor defines\n\nThe name of a preprocessor macro must be an uppercase string\nand these macros must be preceded by a description.\nAbbreviations are allowed but not preferred in new code.\n\n```diff\n+++ Good +++\n```\n\n```c\n/**\n * Short description about the constant.\n */\n#define JERRY_VALUE_SEVEN 7\n\n/**\n * Short description about the macro function.\n */\n#define JERRY_ADD_TWO_NUMBERS(arg1, arg2) \\\n  ((arg1) + (arg2))\n\n/**\n * Although this is correct, a reviewer might request\n * to change NUMS to NUMBERS. Hence it is recommended\n * to use NUMBERS in the first place.\n */\n#define JERRY_ADD_TWO_NUMS(arg1, arg2) \\\n  ((arg1) + (arg2))\n```\n\n```diff\n--- Bad ---\n```\n\n```c\n#define JERRY_CONSTANT_WITHOUT_DESCRIPTION 5\n\n#define JeRrY_mIxEd_CaSe_NaMe \"str\"\n```\n\n## Conditional preprocessor directives\n\nA comment is required after `#else` and `#endif` in JerryScript.\nThe defined keyword should be omitted from these comments.\n\n```diff\n+++ Good +++\n```\n\n```c\n#ifdef JERRY_A\n\n#else /* !JERRY_A */\n\n#endif /* JERRY_A */\n\n#ifdef JERRY_A\n#if defined JERRY_B && defined JERRY_C && (JERRY_C > 6)\n\n#else /* !(JERRY_B && JERRY_C && (JERRY_C > 6)) */\n\n#endif /* JERRY_B && JERRY_C && (JERRY_C > 6) */\n#endif /* JERRY_A */\n```\n\n```diff\n--- Bad ---\n```\n\n```c\n#ifdef JERRY_A\n\n#endif\n\n#ifdef JERRY_A\n\n#endif /* defined JERRY_A */\n\n#ifdef JERRY_B\n  /* Missing comment after else. */\n#else\n\n#endif /* JERRY_B */\n```\n\n## Code blocks\n\nEach code block must be enclosed in curly braces even\nif it is a single line statement. These braces must\nbe on separate lines. There must be a single space\nbefore the opening parenthesis of the expression\nafter if/while/switch keywords.\n\n```diff\n+++ Good +++\n```\n\n```c\nif (value > 6)\n{\n  function_call ();\n}\n\nif (value > 1)\n{\n  function_call_a ();\n}\nelse\n{\n  function_call_b ();\n}\n\ndo\n{\n  function_call ();\n  value++;\n}\nwhile (value < 6);\n\nswitch (value)\n{\n  case A:\n  {\n    /* FALLTHRU comment is allowed if a\n     * switch-case is not terminated by\n     * break/continue/return. */\n\n    /* FALLTHRU */\n  }\n  case B:\n  case C:\n  {\n    break;\n  }\n  case D:\n  {\n    /* We can use continue if we are in a loop. */\n    continue;\n  }\n  default:\n  {\n    return;\n  }\n}\n```\n\n```diff\n--- Bad ---\n```\n\n```c\nif (value > 6)\n  function_call_a ();\nelse\n  function_call_b ();\n\nif (value > 6) {\n  function_call_a ();\n}\n\nif (value > 6) function_call_a ();\nelse { function_call_b (); }\n\nif\n(value > 6)\n{\n}\n\nswitch (value) {\n  case 0: break;\n  default: {\n    return 5;\n  }\n}\n\nswitch (value)\n{\n  case A:\n  {\n    if (value > 6)\n    {\n      CASE B:\n      {\n        /* This is allowed in C but\n         * not in JerryScript. */\n        break;\n      }\n    }\n  }\n}\n\ndo\n  value++;\nwhile (value < 5);\n\ndo {\n  value++;\n} while (value < 5);\n\ndo\n{\n  value++;\n} while (value < 5);\n```\n\n## Newlines\n\nA newline in JerryScript is a separator which separates different\nparts of the source code. Its primary purpose is to improve\nreadability. Unlike other rules developers have some freedom\nto add newlines to their code. However there are some rules.\n\n* Only a single newline separator is allowed.\n* Source files must be terminated by a newline.\n* Global declarations must be separated by a newline.\n* Newlines are not allowed after an opening curly brace or before\n  a closing curly brace\n* No newlines are allowed between control statements (if-else, while,\n  for, switch, etc.) and their code blocks.\n* There should be a newline after the variable declarations\n  if they are the first statements of a block.\n\n```diff\n+++ Good +++\n```\n\n```c\nif (a > 5)\n{\n  /* Newline must be present after the first\n   * variable declarations of a code block. */\n  int j = a - 1;\n  int k = a * 2;\n\n  return j + k;\n}\n\nwhile (a < 5)\n{\n  a++;\n\n  /* It is recommended to put a newline after\n   * intermediate variable declarations. */\n  int i = a * 2;\n\n  b = i - 3;\n}\n\n/* It is a recommended to put newlines around asserts. */\na = b + 5;\n\nJERRY_ASSERT (a < 20);\n\nc = a + 7;\n\n/* It is a good practice to put a newline after a multiline\n * function call (see Function calls later). */\nf (a,\n   b,\n   c);\n\na = 6;\n```\n\n```diff\n--- Bad ---\n```\n\n```c\n/* No newlines are allowed after an opening curly\n * brace or before a closing curly brace */\n\nwhile (a > 0)\n{\n\n  a = 6;\n\n}\n\nif (a > 5)\n{\n  while (b < 6)\n  {\n\n    b++;\n  }\n\n}\n\n\n/* Two or more newlines are not allowed. */\na = 6;\n\n\nb = 7;\n\n/* No newlines are allowed between control statements\n * and their code blocks. */\n\nif (a > 6)\n\n{\n}\n\nelse\n\n{\n}\n\ndo\n\n{\n}\n\nwhile (a < 6);\n```\n\n## Expressions\n\nSpaces are required around binary operators. No space is\nneeded otherwise.\n\n```diff\n+++ Good +++\n```\n\n```c\na = b + c;\na = (b + c) << 3;\na = b = c + ~d;\na += ++c + d++;\ncall_function (a * (b + !!c) - d + (e % f));\nif (a)\n{\n}\n```\n\n```diff\n--- Bad ---\n```\n\n```c\na=b+c;\na = b+c;\na  +=  c  +  ( d );\n/* Introduce temporary variables or macros\n * if the expression is too long. Occurs rarely.. */\na = b\n  + c;\nif ( a + b > 0 )\n{\n}\n```\n\n## Logical operators\n\nAll expressions with && and || logical operators must be\nenclosed in parentheses. A single and multiline form is\nallowed for these expressions. In the latter case each\nline must start with the logical operator and each line\nmust be aligned to the column right after the opening\nparenthesis.\n\n```diff\n+++ Good +++\n```\n\n```c\n/* Single line form. */\na = ((c && d) || (e && f));\n\na = (c\n     && d);\n\na = (c\n     && (d || e)\n     && f);\n\ndo\n{\n}\nwhile (a\n       && b);\n\n/* This form is rarely used but it is ok. */\nif (a\n    && (b\n        || c\n        || d)\n    && e)\n{\n}\n```\n\n```diff\n--- Bad ---\n```\n\n```c\nif (a || b ||\n    c)\n{\n}\n\n/* Parentheses are missing. */\na = b || c;\n\n/* Misaligned &&. */\nif (a\n  && b)\n{\n}\n```\n\n## Ternary conditional operators\n\nA special form of ternary conditional operators are allowed\nin JerryScript where the ? and : operators are on separate\nlines in the same column.\n\n```diff\n+++ Good +++\n```\n\n```c\na = (b ? c\n       : d);\n\n/* Single line form is accepted as well. */\na = (b ? c : d);\n\n/* This form is rarely used but it is ok. */\nif (a ? b\n      : (c ? d\n           : e))\n{\n}\n```\n\n```diff\n--- Bad ---\n```\n\n```c\na = b ?\n    c : d;\n\nwhile (a ? b\n       : c)\n{\n}\n\nif (a\n    ? b\n    : c)\n{\n}\n```\n\n## Function calls\n\nThere must be a space after the function name. Each argument\nmust be in the same or separated lines. In the former case\nthere must be a space before the next argument and in the\nlatter case all arguments must be aligned to the same column.\n\n```diff\n+++ Good +++\n```\n\n```c\nfunction_a ();\nfunction_b (a);\nfunction_c (a, b, c);\n\nfunction_c (a,\n            b,\n            c);\n\nfunction_c (a,\n            b,\n            function_c (a,\n                        b,\n                        c);\n```\n\n```diff\n--- Bad ---\n```\n\n```c\n/* No space before the opening parenthesis. */\nfunction_f();\n\nfunction_f (\n);\n\nfunction_g(a);\n\nfunction_g\n  (a\n  );\n\n/* Two arguments on the same line. */\nfunction_h (a, b,\n            c);\n\nfunction_h (a,\n            b, c);\n\n/* Misaligned arguments. */\nfunction_h (a,\n     b,\n     c);\n```\n\n## Variable declarations\n\nJerryScript is a pure C99 codebase so variable\ndeclarations can be anywhere in the code including\ninside for-loops. It is recommended to declare a\nvariable before the first use.\n\n```diff\n+++ Good +++\n```\n\n```c\nfor (int i = 0; i < 10; i++)\n{\n  int j = i + 1;\n  while (j < 10)\n  {\n    ++j;\n  }\n}\n\n/* Multiline form of for loops. */\nfor (int i = 0;\n     i < 10;\n     i++)\n{\n}\n```\n\n## Type casting\n\nThere must be a space after the closing parenthesis\nof the type cast. Type casting has no multiline form\nin JerryScript.\n\n```diff\n+++ Good +++\n```\n\n```c\nint a = (int) double_variable;\n\nint a = (int) (long) (float) double_variable;\n```\n\n```diff\n--- Bad ---\n```\n\n```c\n/* Wrong spaces. */\nint a = ( int )double_variable;\n\n/* No multiline form. */\nint a = (int)\n        double_variable;\n```\n\n## Pointers and asterisk character\n\nEach pointer in JerryScript must be a lowercase string\nwhich is ending with a `_p` suffix. Furthermore there\nmust be a space before the asterisk character.\n\n```diff\n+++ Good +++\n```\n\n```c\n  int *int_p;\n\n  /* No need to add multiple _p-s for multiple indirections.\n   * It is recommended to avoid these constructs using typedef\n   * declarations. A reviewer might request such a change. */\n  int ***int_p;\n\n  /* This rule applies for type casting as well. */\n  char = *(char *) type_p;\n```\n\n```diff\n--- Bad ---\n```\n\n```c\n  /* No _p after the name. */\n  int *ptr;\n\n  /* Wrong asterisk position. */\n  int* ptr_p;\n\n  char_p = * (char*)type_p;\n```\n\n## Types\n\nEach type in JerryScript must be a lowercase string\nwhich ends with a `_t` suffix. Furthermore each type\ndeclaration must be preceded by a short description\nof the type and each field must have a short description\nas well.\n\n```diff\n+++ Good +++\n```\n\n```c\n/**\n * Short description of the following structure.\n */\ntypedef struct\n{\n  /* Field descriptions do not start with capital letters\n   * and there is no full stop at the end. */\n  field1_t field1; /**< description of field 1 */\n  field2_t field2; /**< description of field 2 */\n\n  field_n_t field_n; /**< description of field n */\n} structure_name_t;\n\n/**\n * Another integer type.\n */\ntypedef int jerry_int;\n```\n\n```diff\n--- Bad ---\n```\n\n```c\ntypedef struct\n{\n  field_t field_without_description;\n} structure_without_description_t;\n\ntypedef struct { int a; } single_line_struct;\n\ntypedef\nunion {\n}\nwrong_newlines_t;\n\n/*\n  * Bad comment format.\n   */\ntypedef\nchar wrong_newlines_again_t;\n```\n\n### Type usage conventions\n\n - Passing the number of arguments for a function call is always `uint32_t`\n - String size/length/position related operation should use `lit_utf8_size_t`\n - Extended objects internal fields must be `uint32_t`\n\n## Function declarations\n\nFunction declarations in JerryScript are verbose but this format\nreduces the maintenance cost and allows faster understanding of\nthe code.\n\n```diff\n+++ Good +++\n```\n\n```c\n/**\n * Short overview about the purpose of this function.\n *\n * A more detailed explanation if needed.\n *\n * Note:\n *   Extra notes if needed.\n *\n * @return short description about the value\n *         returned by the function\n */\nreturn_value_type_t\nfunction_name (argument1, /**< description of argument1 */\n               argument2, /**< description of argument2 */\n               ...\n               argument_n, /**< description of argument n */\n{\n\n  /* Function body. */\n\n} /* function_name */\n```\n\n```diff\n--- Bad ---\n```\n\n```c\nstatic int\nprint (char *text) /**< description of text argument */\n{\n  /* Missing comment before the function. */\n} /* print */\n\n/**\n * Prints the text received by the function.\n *\n * @return number of characters printed by the function\n */\nint print(char *text)\n{\n  /* No description of text argument. */\n  /* Missing comment at the end of the function. */\n}\n```\n"
  },
  {
    "path": "docs/09.EXT-REFERENCE-ARG.md",
    "content": "# jerryx_arg types\n\n## jerryx_arg_t\n\n**Summary**\n\nThe structure defining a single validation/transformation step.\n\n*Note*: For commonly used validators, `arg.h` provides helpers to create the `jerryx_arg_t`s.\nFor example, `jerryx_arg_number ()`, `jerryx_arg_boolean ()`, etc.\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  /** the transform function */\n  jerryx_arg_transform_func_t func;\n  /** pointer to destination where func should store the result */\n  void *dest;\n  /** extra information, specific to func */\n  uintptr_t extra_info;\n} jerryx_arg_t;\n```\n\n**See also**\n\n- [jerryx_arg_number](#jerryx_arg_number)\n- [jerryx_arg_boolean](#jerryx_arg_boolean)\n- [jerryx_arg_string](#jerryx_arg_string)\n- [jerryx_arg_utf8_string](#jerryx_arg_utf8_string)\n- [jerryx_arg_function](#jerryx_arg_function)\n- [jerryx_arg_native_pointer](#jerryx_arg_native_pointer)\n- [jerryx_arg_ignore](#jerryx_arg_ignore)\n- [jerryx_arg_object_properties](#jerryx_arg_object_properties)\n\n## jerryx_arg_object_props_t\n\n**Summary**\n\nThe structure is used in `jerryx_arg_object_properties`. It provides the properties' names,\nits corresponding JS-to-C mapping and other related information.\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  const jerry_char_t **name_p; /**< property name list of the JS object */\n  jerry_length_t name_cnt; /**< count of the name list */\n  const jerryx_arg_t *c_arg_p; /**< points to the array of transformation steps */\n  jerry_length_t c_arg_cnt; /**< the count of the `c_arg_p` array */\n} jerryx_arg_object_props_t;\n```\n\n**See also**\n\n- [jerryx_arg_object_properties](#jerryx_arg_object_properties)\n\n## jerryx_arg_array_items_t\n\n**Summary**\n\nThe structure is used in `jerryx_arg_array`. It provides the array items' corresponding\nJS-to-C mappings and count.\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  const jerryx_arg_t *c_arg_p; /**< points to the array of transformation steps */\n  jerry_length_t c_arg_cnt; /**< the count of the `c_arg_p` array */\n} jerryx_arg_array_items_t;\n```\n\n**See also**\n\n- [jerryx_arg_array](#jerryx_arg_array)\n\n## jerryx_arg_transform_func_t\n\n**Summary**\n\nSignature of the transform function.\n\nUsers can create custom transformations by implementing a transform function\nand using `jerryx_arg_custom ()`.\n\nThe function is expected to return `undefined` if it ran successfully or\nreturn an `Error` in case it failed. The function can use the iterator and the\nhelpers `jerryx_arg_js_iterator_pop ()` and `jerryx_arg_js_iterator_peek ()` to\nget the next input value.\n\n*Note*: A transform function is allowed to consume any number of input values!\nThis enables complex validation like handling different JS function signatures,\nmapping multiple input arguments to a C struct, etc.\n\nThe function is expected to store the result of\na successful transformation into `c_arg_p->dest`. In case the validation did\nnot pass, the transform should not modify `c_arg_p->dest`.\n\nAdditional parameters can be provided to the function through `c_arg_p->extra_info`.\n\n**Prototype**\n\n```c\ntypedef jerry_value_t (*jerryx_arg_transform_func_t) (jerryx_arg_js_iterator_t *js_arg_iter_p,\n                                                      const jerryx_arg_t *c_arg_p);\n```\n\n**See also**\n\n- [jerryx_arg_custom](#jerryx_arg_custom)\n- [jerryx_arg_js_iterator_pop](#jerryx_arg_js_iterator_pop)\n- [jerryx_arg_js_iterator_peek](#jerryx_arg_js_iterator_peek)\n\n\n## jerryx_arg_coerce_t\n\nEnum that indicates whether an argument is allowed to be coerced into the expected JS type.\n\n - JERRYX_ARG_COERCE - the transform will invoke toNumber, toBoolean, toString, etc.\n - JERRYX_ARG_NO_COERCE - the type coercion is not allowed. The transform will fail if the type does not match the expectation.\n\n**See also**\n\n- [jerryx_arg_number](#jerryx_arg_number)\n- [jerryx_arg_boolean](#jerryx_arg_boolean)\n- [jerryx_arg_string](#jerryx_arg_string)\n\n## jerryx_arg_optional_t\n\nEnum that indicates whether an argument is optional or required.\n\n - JERRYX_ARG_OPTIONAL - The argument is optional. If the argument is `undefined` the transform is successful and `c_arg_p->dest` remains untouched.\n - JERRYX_ARG_REQUIRED - The argument is required. If the argument is `undefined` the transform will fail and `c_arg_p->dest` remains untouched.\n\n**See also**\n\n- [jerryx_arg_number](#jerryx_arg_number)\n- [jerryx_arg_boolean](#jerryx_arg_boolean)\n- [jerryx_arg_string](#jerryx_arg_string)\n- [jerryx_arg_function](#jerryx_arg_function)\n- [jerryx_arg_native_pointer](#jerryx_arg_native_pointer)\n\n## jerryx_arg_round_t\n\nEnum that indicates the rounding policy which will be chosen to transform an integer.\n\n - JERRYX_ARG_ROUND - use round() method.\n - JERRYX_ARG_FLOOR - use floor() method.\n - JERRYX_ARG_CEIL - use ceil() method.\n\n**See also**\n\n- [jerryx_arg_uint8](#jerryx_arg_uint8)\n- [jerryx_arg_uint16](#jerryx_arg_uint16)\n- [jerryx_arg_uint32](#jerryx_arg_uint32)\n- [jerryx_arg_int8](#jerryx_arg_int8)\n- [jerryx_arg_int16](#jerryx_arg_int16)\n- [jerryx_arg_int32](#jerryx_arg_int32)\n\n\n## jerryx_arg_clamp_t\n\n Indicates the clamping policy which will be chosen to transform an integer.\n If the policy is NO_CLAMP, and the number is out of range,\n then the transformer will throw a range error.\n\n - JERRYX_ARG_CLAMP - clamp the number when it is out of range\n - JERRYX_ARG_NO_CLAMP - throw a range error\n\n**See also**\n\n- [jerryx_arg_uint8](#jerryx_arg_uint8)\n- [jerryx_arg_uint16](#jerryx_arg_uint16)\n- [jerryx_arg_uint32](#jerryx_arg_uint32)\n- [jerryx_arg_int8](#jerryx_arg_int8)\n- [jerryx_arg_int16](#jerryx_arg_int16)\n- [jerryx_arg_int32](#jerryx_arg_int32)\n\n# Main functions\n\n## jerryx_arg_transform_this_and_args\n\n**Summary**\n\nValidate the this value and the JS arguments, and assign them to the native arguments.\nThis function is useful to perform input validation inside external function handlers (see `jerry_external_handler_t`).\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_arg_transform_this_and_args (const jerry_value_t this_val,\n                                    const jerry_value_t *js_arg_p,\n                                    const jerry_length_t js_arg_cnt,\n                                    const jerryx_arg_t *c_arg_p,\n                                    jerry_length_t c_arg_cnt)\n```\n\n - `this_val` - `this` value. Note this is processed as the first value, before the array of arguments.\n - `js_arg_p` - points to the array with JS arguments.\n - `js_arg_cnt` - the count of the `js_arg_p` array.\n - `c_arg_p` - points to the array of validation/transformation steps\n - `c_arg_cnt` - the count of the `c_arg_p` array.\n - return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.\n\n**Example**\n\n[doctest]: # (test=\"compile\")\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/arg.h\"\n\n/* JS signature: function (requiredBool, requiredString, optionalNumber) */\nstatic jerry_value_t\nmy_external_handler (const jerry_value_t function_obj,\n                     const jerry_value_t this_val,\n                     const jerry_value_t args_p[],\n                     const jerry_length_t args_count)\n{\n  bool required_bool;\n  char required_str[16];\n  double optional_num = 1234.567;  // default value\n\n  /* \"mapping\" defines the steps to transform input arguments to C variables. */\n  const jerryx_arg_t mapping[] =\n  {\n    /* `this` is the first value. No checking needed on `this` for this function. */\n    jerryx_arg_ignore (),\n\n    jerryx_arg_boolean (&required_bool, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_string (required_str, sizeof (required_str), JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_number (&optional_num, JERRYX_ARG_NO_COERCE, JERRYX_ARG_OPTIONAL),\n  };\n\n  /* Validate and transform. */\n  const jerry_value_t rv = jerryx_arg_transform_this_and_args (this_val,\n                                                               args_p,\n                                                               args_count,\n                                                               mapping,\n                                                               4);\n\n  if (jerry_value_is_exception (rv))\n  {\n    /* Handle error. */\n    return rv;\n  }\n\n  /*\n   * Validated and transformed successfully!\n   * required_bool, required_str and optional_num can now be used.\n   */\n\n  return jerry_undefined (); /* Or return something more meaningful. */\n}\n```\n\n**See also**\n\n- [jerryx_arg_ignore](#jerryx_arg_ignore)\n- [jerryx_arg_number](#jerryx_arg_number)\n- [jerryx_arg_boolean](#jerryx_arg_boolean)\n- [jerryx_arg_string](#jerryx_arg_string)\n- [jerryx_arg_function](#jerryx_arg_function)\n- [jerryx_arg_native_pointer](#jerryx_arg_native_pointer)\n- [jerryx_arg_custom](#jerryx_arg_custom)\n- [jerryx_arg_object_properties](#jerryx_arg_object_properties)\n\n\n## jerryx_arg_transform_args\n\n**Summary**\n\nValidate an array of `jerry_value_t` and assign them to the native arguments.\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_arg_transform_args (const jerry_value_t *js_arg_p,\n                           const jerry_length_t js_arg_cnt,\n                           const jerryx_arg_t *c_arg_p,\n                           jerry_length_t c_arg_cnt)\n```\n\n - `js_arg_p` - points to the array with JS arguments.\n - `js_arg_cnt` - the count of the `js_arg_p` array.\n - `c_arg_p` - points to the array of validation/transformation steps\n - `c_arg_cnt` - the count of the `c_arg_p` array.\n - return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.\n\n**See also**\n\n- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)\n\n\n## jerryx_arg_transform_object_properties\n\n**Summary**\n\nValidate the properties of a JS object and assign them to the native arguments.\n\n*Note*: This function transforms properties of a single JS object into native C values.\nTo transform multiple objects in one pass (for example when converting multiple arguments\nto an external handler), please use `jerryx_arg_object_properties` together with\n`jerryx_arg_transform_this_and_args` or `jerryx_arg_transform_args`.\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_arg_transform_object_properties (const jerry_value_t obj_val,\n                                        const jerry_char_t **name_p,\n                                        const jerry_length_t name_cnt,\n                                        const jerryx_arg_t *c_arg_p,\n                                        jerry_length_t c_arg_cnt);\n\n```\n\n - `obj_val` - the JS object.\n - `name_p` - points to the array of property names.\n - `name_cnt` - the count of the `name_p` array.\n - `c_arg_p` - points to the array of validation/transformation steps\n - `c_arg_cnt` - the count of the `c_arg_p` array.\n - return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.\n\n**See also**\n\n- [jerryx_arg_object_properties](#jerryx_arg_object_properties)\n\n## jerryx_arg_transform_array\n\n**Summary**\n\nValidate the JS array and assign its items to the native arguments.\n\n*Note*: This function transforms items of a single JS array into native C values.\nTo transform multiple JS arguments in one pass, please use `jerryx_arg_array` together with\n`jerryx_arg_transform_this_and_args` or `jerryx_arg_transform_args`.\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_arg_transform_array (const jerry_value_t array_val,\n                            const jerryx_arg_t *c_arg_p,\n                            jerry_length_t c_arg_cnt);\n\n```\n\n - `array_val` - the JS array.\n - `c_arg_p` - points to the array of validation/transformation steps\n - `c_arg_cnt` - the count of the `c_arg_p` array.\n - return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.\n\n**See also**\n\n- [jerryx_arg_array](#jerryx_arg_array)\n\n## jerryx_arg_transform_optional\n\n**Summary**\n\nThe common function to deal with optional arguments. The core transform function is provided by argument `func`.\n\n**Prototype**\n\n```c\njerry_value_t jerryx_arg_transform_optional (jerryx_arg_js_iterator_t *js_arg_iter_p,\n                                             const jerryx_arg_t *c_arg_p,\n                                             jerryx_arg_transform_func_t func);\n```\n\n - `js_arg_iter_p` - the JS arg iterator.\n - `c_arg_p` - the native arg.\n - `func` - the core transform function.\n - return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.\n\n**See also**\n\n- [jerryx_arg_transform_func_t](#jerryx_arg_transform_func_t)\n\n# Helpers for commonly used validations\n\n## jerryx_arg_uint8\n\n## jerryx_arg_uint16\n\n## jerryx_arg_uint32\n\n## jerryx_arg_int8\n\n## jerryx_arg_int16\n\n## jerryx_arg_int32\n\n**Summary**\n\nAll above jerryx_arg_[u]intX functions are used to create a validation/transformation step\n(`jerryx_arg_t`) that expects to consume one `number` JS argument\nand stores it into a C integer (uint8, int8, uint16, ...)\n\n**Prototype**\n\nTake jerryx_arg_int32 as an example\n\n```c\nstatic inline jerryx_arg_t\njerryx_arg_int32 (int32_t *dest,\n                  jerryx_arg_round_t round_flag,\n                  jerryx_arg_clamp_t clamp_flag,\n                  jerryx_arg_coerce_t coerce_flag,\n                  jerryx_arg_optional_t opt_flag);\n```\n\n - return value - the created `jerryx_arg_t` instance.\n - `dest` - pointer to the `int32_t` where the result should be stored.\n - `round_flag` - the rounding policy.\n - `clamp_flag` - the clamping policy.\n - `coerce_flag` - whether type coercion is allowed.\n - `opt_flag` - whether the argument is optional.\n\n**See also**\n\n- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)\n\n\n## jerryx_arg_number\n\n**Summary**\n\nCreate a validation/transformation step (`jerryx_arg_t`) that expects to consume\none `number` JS argument and stores it into a C `double`.\n\n**Prototype**\n\n```c\nstatic inline jerryx_arg_t\njerryx_arg_number (double *dest,\n                   jerryx_arg_coerce_t coerce_flag,\n                   jerryx_arg_optional_t opt_flag)\n```\n\n - return value - the created `jerryx_arg_t` instance.\n - `dest` - pointer to the `double` where the result should be stored.\n - `coerce_flag` - whether type coercion is allowed.\n - `opt_flag` - whether the argument is optional.\n\n**See also**\n\n- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)\n\n## jerryx_arg_boolean\n\n**Summary**\n\nCreate a validation/transformation step (`jerryx_arg_t`) that expects to\nconsume one `boolean` JS argument and stores it into a C `bool`.\n\n**Prototype**\n\n```c\nstatic inline jerryx_arg_t\njerryx_arg_boolean (bool *dest,\n                    jerryx_arg_coerce_t coerce_flag,\n                    jerryx_arg_optional_t opt_flag)\n```\n - return value - the created `jerryx_arg_t` instance.\n - `dest` - pointer to the `bool` where the result should be stored.\n - `coerce_flag` - whether type coercion is allowed.\n - `opt_flag` - whether the argument is optional.\n\n**See also**\n\n- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)\n\n\n## jerryx_arg_string\n\n**Summary**\n\nCreate a validation/transformation step (`jerryx_arg_t`) that expects to\nconsume one `string` JS argument and stores it into a CESU-8 C `char` array.\n\n**Prototype**\n\n```c\nstatic inline jerryx_arg_t\njerryx_arg_string (char *dest,\n                   uint32_t size,\n                   jerryx_arg_coerce_t coerce_flag,\n                   jerryx_arg_optional_t opt_flag)\n```\n\n - return value - the created `jerryx_arg_t` instance.\n - `dest` - pointer to the native char array where the result should be stored.\n - `size` - the size of native char array.\n - `coerce_flag` - whether type coercion is allowed.\n - `opt_flag` - whether the argument is optional.\n\n**See also**\n\n- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)\n- [jerry_arg_utf8_string](#jerry_arg_utf8_string)\n\n\n## jerryx_arg_utf8_string\n\n**Summary**\n\nCreate a validation/transformation step (`jerryx_arg_t`) that expects to\nconsume one `string` JS argument and stores it into a UTF-8 C `char` array.\n\n**Prototype**\n\n```c\nstatic inline jerryx_arg_t\njerryx_arg_utf8_string (char *dest,\n                        uint32_t size,\n                        jerryx_arg_coerce_t coerce_flag,\n                        jerryx_arg_optional_t opt_flag)\n```\n\n - return value - the created `jerryx_arg_t` instance.\n - `dest` - pointer to the native char array where the result should be stored.\n - `size` - the size of native char array.\n - `coerce_flag` - whether type coercion is allowed.\n - `opt_flag` - whether the argument is optional.\n\n**See also**\n\n- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)\n- [jerry_arg_string](#jerry_arg_string)\n\n\n## jerryx_arg_function\n\n**Summary**\n\nCreate a validation/transformation step (`jerryx_arg_t`) that expects to\nconsume one `function` JS argument and stores it into a C `jerry_value_t`.\n\n**Prototype**\n\n```c\nstatic inline jerryx_arg_t\njerryx_arg_function (jerry_value_t *dest,\n                     jerryx_arg_optional_t opt_flag)\n\n```\n - return value - the created `jerryx_arg_t` instance.\n - `dest` - pointer to the `jerry_value_t` where the result should be stored.\n - `opt_flag` - whether the argument is optional.\n\n**See also**\n\n- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)\n\n## jerryx_arg_native_pointer\n\n**Summary**\n\nCreate a validation/transformation step (`jerryx_arg_t`) that expects to\nconsume one `object` JS argument that is 'backed' with a native pointer with\na given type info. In case the native pointer info matches, the transform\nwill succeed and the object's native pointer will be assigned to `*dest`.\n\n**Prototype**\n\n```c\nstatic inline jerryx_arg_t\njerryx_arg_native_pointer (void **dest,\n                           const jerry_object_native_info_t *info_p,\n                           jerryx_arg_optional_t opt_flag)\n```\n - return value - the created `jerryx_arg_t` instance.\n - `dest` - pointer to where the resulting native pointer should be stored.\n - `info_p` - expected the type info.\n - `opt_flag` - whether the argument is optional.\n\n**See also**\n\n- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)\n\n## jerryx_arg_object_properties\n\n**Summary**\n\nCreate a validation/transformation step (`jerryx_arg_t`) that expects to\nconsume one `object` JS argument and call `jerryx_arg_transform_object_properties` inside\nto transform its properties to native arguments.\nUser should prepare the `jerryx_arg_object_props_t` instance, and pass it to this function.\n\n**Prototype**\n\n```c\nstatic inline jerryx_arg_t\njerryx_arg_object_properties (const jerryx_arg_object_props_t *obj_prop_p,\n                              jerryx_arg_optional_t opt_flag);\n```\n - return value - the created `jerryx_arg_t` instance.\n - `obj_prop_p` - provides information for properties transform.\n - `opt_flag` - whether the argument is optional.\n\n**Example**\n\n[doctest]: # (test=\"compile\")\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/arg.h\"\n\n/**\n * The binding function expects args_p[0] is an object, which has 3 properties:\n *     \"enable\": boolean\n *     \"data\": number\n *     \"extra_data\": number, optional\n */\nstatic jerry_value_t\nmy_external_handler (const jerry_value_t function_obj,\n                     const jerry_value_t this_val,\n                     const jerry_value_t args_p[],\n                     const jerry_length_t args_count)\n{\n  bool required_bool;\n  double required_num;\n  double optional_num = 1234.567;  // default value\n\n  /* \"prop_name_p\" defines the name list of the expected properties' names. */\n  const char *prop_name_p[] = { \"enable\", \"data\", \"extra_data\" };\n\n  /* \"prop_mapping\" defines the steps to transform properties to C variables. */\n  const jerryx_arg_t prop_mapping[] =\n  {\n    jerryx_arg_boolean (&required_bool, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_number (&required_num, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_number (&optional_num, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL)\n  };\n\n  /* Prepare the jerryx_arg_object_props_t instance. */\n  const jerryx_arg_object_props_t prop_info =\n  {\n    .name_p = (const jerry_char_t **) prop_name_p,\n    .name_cnt = 3,\n    .c_arg_p = prop_mapping,\n    .c_arg_cnt = 3\n  };\n\n  /* It is the mapping used in the jerryx_arg_transform_args. */\n  const jerryx_arg_t mapping[] =\n  {\n    jerryx_arg_object_properties (&prop_info, JERRYX_ARG_REQUIRED)\n  };\n\n  /* Validate and transform. */\n  const jerry_value_t rv = jerryx_arg_transform_args (args_p,\n                                                      args_count,\n                                                      mapping,\n                                                      1);\n\n  if (jerry_value_is_exception (rv))\n  {\n    /* Handle error. */\n    return rv;\n  }\n\n  /*\n   * Validated and transformed successfully!\n   * required_bool, required_num and optional_num can now be used.\n   */\n\n   return jerry_undefined (); /* Or return something more meaningful. */\n}\n\n```\n\n **See also**\n\n- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)\n- [jerryx_arg_transform_object_properties](#jerryx_arg_transform_object_properties)\n\n## jerryx_arg_array\n\n**Summary**\n\nCreate a validation/transformation step (`jerryx_arg_t`) that expects to\nconsume one `array` JS argument and call `jerryx_arg_transform_array_items` inside\nto transform its items to native arguments.\nUser should prepare the `jerryx_arg_array_items_t` instance, and pass it to this function.\n\n**Prototype**\n\n```c\nstatic inline jerryx_arg_t\njerryx_arg_array (const jerryx_arg_array_items_t *array_items_p, jerryx_arg_optional_t opt_flag);\n```\n - return value - the created `jerryx_arg_t` instance.\n - `array_items_p` - provides items information for transform.\n - `opt_flag` - whether the argument is optional.\n\n**Example**\n\n[doctest]: # (test=\"compile\")\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/arg.h\"\n\n/**\n * The binding function expects args_p[0] is an array, which has 3 items:\n *     first: boolean\n *     second: number\n *     third: number, optional\n */\nstatic jerry_value_t\nmy_external_handler (const jerry_value_t function_obj,\n                     const jerry_value_t this_val,\n                     const jerry_value_t args_p[],\n                     const jerry_length_t args_count)\n{\n  bool required_bool;\n  double required_num;\n  double optional_num = 1234.567;  // default value\n\n  /* \"item_mapping\" defines the steps to transform array items to C variables. */\n  const jerryx_arg_t item_mapping[] =\n  {\n    jerryx_arg_boolean (&required_bool, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_number (&required_num, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_number (&optional_num, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL)\n  };\n\n  /* Prepare the jerryx_arg_array_items_t instance. */\n  const jerryx_arg_array_items_t array_info =\n  {\n    .c_arg_p = item_mapping,\n    .c_arg_cnt = 3\n  };\n\n  /* It is the mapping used in the jerryx_arg_transform_args. */\n  const jerryx_arg_t mapping[] =\n  {\n    jerryx_arg_array (&array_info, JERRYX_ARG_REQUIRED)\n  };\n\n  /* Validate and transform. */\n  const jerry_value_t rv = jerryx_arg_transform_args (args_p,\n                                                      args_count,\n                                                      mapping,\n                                                      1);\n\n  if (jerry_value_is_exception (rv))\n  {\n    /* Handle error. */\n    return rv;\n  }\n\n  /*\n   * Validated and transformed successfully!\n   * required_bool, required_num and optional_num can now be used.\n   */\n\n   return jerry_undefined (); /* Or return something more meaningful. */\n}\n\n```\n\n **See also**\n\n- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)\n- [jerryx_arg_transform_object_properties](#jerryx_arg_transform_object_properties)\n\n# Functions to create custom validations\n\n## jerryx_arg_ignore\n\n**Summary**\n\nCreate a jerryx_arg_t instance for ignored argument.\n\n**Prototype**\n\n```c\nstatic inline jerryx_arg_t jerryx_arg_ignore (void);\n```\n - return value - the created `jerryx_arg_t` instance.\n\n**See also**\n\n- [jerryx_arg_t](#jerryx_arg_t)\n\n## jerryx_arg_custom\n\n**Summary**\n\nCreate a jerryx_arg_t instance with custom transform.\n\n**Prototype**\n\n```c\nstatic inline jerryx_arg_t\njerryx_arg_custom (void *dest,\n                   uintptr_t extra_info,\n                   jerryx_arg_transform_func_t func)\n\n```\n - return value - the created `jerryx_arg_t` instance.\n - `dest` - pointer to the native argument where the result should be stored.\n - `extra_info` - the extra parameter data, specific to the transform function.\n - `func` - the custom transform function.\n\n**See also**\n\n- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)\n\n\n\n## jerryx_arg_js_iterator_pop\n\n**Summary**\n\nPop the current `jerry_value_t` argument from the iterator.\nIt will change the `js_arg_idx` and `js_arg_p` value in the iterator.\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_arg_js_iterator_pop (jerryx_arg_js_iterator_t *js_arg_iter_p)\n```\n - return value - the `jerry_value_t` argument that was popped.\n - `js_arg_iter_p` - the JS arg iterator from which to pop.\n\n## jerryx_arg_js_iterator_peek\n\n**Summary**\n\nGet the current JS argument from the iterator, without moving the iterator forward.\n*Note:* Unlike `jerryx_arg_js_iterator_pop ()`, it will not change `js_arg_idx` and\n`js_arg_p` value in the iterator.\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_arg_js_iterator_peek (jerryx_arg_js_iterator_t *js_arg_iter_p)\n```\n - return value - the current `jerry_value_t` argument.\n - `js_arg_iter_p` - the JS arg iterator from which to peek.\n\n## jerryx_arg_js_iterator_restore\n\n**Summary**\n\nRestore the last item popped from the stack.  This can be called as\nmany times as there are arguments on the stack -- if called when the\nfirst element in the array is the current top of the stack, this\nfunction does nothing.\n\n*Note:* This function relies on the underlying implementation of the\narg stack as an array, as its function is to simply back up the \"top\nof stack\" pointer to point to the previous element of the array.\n\n*Note:* Like `jerryx_arg_js_iterator_pop ()`, this function will\nchange the `js_arg_idx` and `js_arg_p` values in the iterator.\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_arg_js_iterator_restore (jerryx_arg_js_iterator_t *js_arg_iter_p)\n```\n - return value - the the new top of the stack.\n - `js_arg_iter_p` - the JS arg iterator to restore.\n\n\n## jerryx_arg_js_iterator_index\n\n**Summary**\n\nGet the index of the current JS argument from the iterator.\n\n**Prototype**\n\n```c\njerry_length_t\njerryx_arg_js_iterator_index (jerryx_arg_js_iterator_t *js_arg_iter_p)\n```\n - return value - the index of current JS argument.\n - `js_arg_iter_p` - the JS arg iterator from which to peek.\n"
  },
  {
    "path": "docs/10.EXT-REFERENCE-HANDLER.md",
    "content": "# Common methods to handle properties\n\nThe `jerryscript-ext/properties.h` header defines a set of convenience methods\nwhich makes the property access a bit straightforward.\n\n# Utility to register multiple properties in bulk\n\nIn some cases it is useful to register multiple properties for a given object\nfor this the following utility structures and methods are provided.\n\n## jerryx_property_entry\n\n**Summary**\n\nStructure to define an array of properties with `name` and `value` fields which\ncan be registered to a target object.\n\nThe engine must be initialized before specifying the `jerry_value_t` in the struct.\n\n\n**Prototype**\n\n```c\ntypedef struct {\n  const char *name;\n  jerry_value_t value;\n} jerryx_property_entry;\n```\n\n**See also**\n\n- [jerryx_set_properties](#jerryx_set_properties)\n\n\n## jerryx_register_result\n\n**Summary**\n\nStructure returned as the result of the [jerryx_set_properties](#jerryx_set_properties) operation.\nThe `result` field will either be a JavaScript undefined value or an error object.\nIn every case the `registered` field is used to indicated the number of\nsuccessfully registered methods.\n\nThis must be passed for the [jerryx_release_property_entry](#jerryx_release_property_entry) method\nafter the property registration.\n\nIf any error occurred during the property registration the `result` field of the structure\nmust be manually released after processing the error value.\n\n**Prototype**\n\n```c\ntypedef struct {\n  jerry_value_t result;\n  uint32_t registered;\n} jerryx_register_result;\n```\n\n**See also**\n\n- [jerryx_set_properties](#jerryx_set_properties)\n- [jerryx_release_property_entry](#jerryx_release_property_entry)\n\n\n## jerryx_set_properties\n\n**Summary**\n\nSet multiple properties on a target object.\n\nThe properties are an array of (name, jerry_value_t) pairs and\nthis list must end with a (NULL, 0) entry.\n\nImportant notes:\n* Each property value in the input array is released after a successful property registration.\n* The method [jerryx_release_property_entry](#jerryx_release_property_entry) must be called if there is any failed registration\n  to release the values in the entries array.\n  It is safe to call this cleanup method in every case not just in case of failure.\n* If the error value is reported via the result it must be freed manually.\n\n**Prototype**\n\n```c\njerryx_register_result\njerryx_set_properties (const jerry_value_t target_object,\n                       const jerryx_property_entry entries[]);\n```\n\n- `target_object` - object on which the entries will be set.\n- `entries` - array of (name, jerry_value_t) pairs.\n- return a [jerryx_register_result](#jerryx_register_result).\n   - if everything is ok, the struct's `result` field is set to a JS undefined value.\n   - otherwise the `result` field is an error object indicating the problem.\n   - in every case the `registered` field contains the number of successfully registered properties.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include <stdio.h>\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n\nstatic jerry_value_t\nhandler (const jerry_call_info_t *call_info_p,\n         const jerry_value_t args_p[],\n         const jerry_length_t args_cnt)\n{\n  printf (\"native handler called!\\n\");\n\n  return jerry_boolean (true);\n}\n\nint\nmain (int argc, char **argv)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerryx_property_entry methods[] =\n  {\n    { \"demo\", jerry_function_external (handler) },\n    { NULL, 0 },\n  };\n\n  jerry_value_t global = jerry_current_realm ();\n  jerryx_register_result reg = jerryx_set_properties (global, methods);\n  /* if `reg.result` is undefined all methods are registered */\n  if (jerry_value_is_exception (reg.result))\n  {\n    printf (\"Only registered %d properties\\r\\n\", reg.registered);\n    /* clean up not registered property values */\n    jerryx_release_property_entry (methods, reg);\n\n    /* clean up the error */\n    jerry_value_free (reg.result);\n  }\n\n  jerry_value_free (global);\n\n  jerry_cleanup();\n\n  return 0;\n}\n```\n\n**Convenience macros**\n\nTo make property registration convenient, there are a set of macros to use\nwhen setting a property entry:\n\n* `JERRYX_PROPERTY_NUMBER(NAME, NUMBER)` - creates a number entry.\n* `JERRYX_PROPERTY_STRING(NAME, STR, SIZE)` - creates an UTF-8 string entry using `SIZE` bytes from the string.\n* `JERRYX_PROPERTY_STRING_SZ(NAME, STR)` - creates an ASCII string entry. This string must be zero terminated.\n* `JERRYX_PROPERTY_BOOLEAN(NAME, VALUE)` - creates a boolean entry.\n* `JERRYX_PROPERTY_FUNCTION(NAME, NATIVE)` - creates a native C function entry.\n* `JERRYX_PROPERTY_UNDEFINED(NAME)` - creates an undefined property entry.\n* `JERRYX_PROPERTY_LIST_END()` - indicates the end of the property list.\n\n**Example usage of Convenience macros**\n\n[doctest]: # ()\n\n```c\n#include <stdio.h>\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n\nstatic jerry_value_t\nhandler (const jerry_call_info_t *call_info_p,\n         const jerry_value_t args_p[],\n         const jerry_length_t args_cnt)\n{\n  printf (\"native handler called!\\n\");\n\n  return jerry_boolean (true);\n}\n\nint\nmain (int argc, char **argv)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /**\n   * Create a array of properties to be registered.\n   * This must be done after initializing the engine as creating `jerry_value_t`\n   * elements are invalid before `jerry_init`.\n   */\n  jerryx_property_entry methods[] =\n  {\n    JERRYX_PROPERTY_FUNCTION (\"demo\", handler),\n    JERRYX_PROPERTY_NUMBER (\"test_num\", 2.3),\n    JERRYX_PROPERTY_UNDEFINED (\"this_is_undefined\"),\n    JERRYX_PROPERTY_LIST_END(),\n  };\n\n  jerry_value_t global = jerry_current_realm ();\n  jerryx_register_result reg = jerryx_set_properties (global, methods);\n  /* if `reg.result` is undefined all methods are registered */\n  if (jerry_value_is_exception (reg.result))\n  {\n    printf (\"Only registered %d properties\\r\\n\", reg.registered);\n    /* clean up not registered property values */\n    jerryx_release_property_entry (methods, reg);\n\n    /* clean up the error */\n    jerry_value_free (reg.result);\n  }\n\n  jerry_value_free (global);\n\n  jerry_cleanup();\n\n  return 0;\n}\n```\n\n\n**See also**\n\n- [jerryx_property_entry](#jerryx_property_entry)\n- [jerryx_release_property_entry](#jerryx_release_property_entry)\n- [jerryx_register_result](#jerryx_register_result)\n\n## jerryx_release_property_entry\n\n**Summary**\n\nRelease all `jerry_value_t` in a `jerryx_property_entry` array based on a previous [jerryx_set_properties](#jerryx_set_properties) call\nand also the error value (if any) in the `jerryx_register_result` structure.\nIn case of a successful registration it is safe to call this method.\n\nAfter the method call the `entries` array should not be used as all values are released.\n\n**Prototype**\n\n```\nvoid\njerryx_release_property_entry (const jerryx_property_entry entries[],\n                               const jerryx_register_result register_result);\n```\n\n- `entries` - array of [jerryx_property_entry](#jerryx_property_entry).\n- `register_result` - result of a previous [jerryx_set_properties](#jerryx_set_properties) call.\n\n**Example**\n\nFor example usage see [jerryx_set_properties](#jerryx_set_properties).\n\n\n#  Common external function handlers\n\n## jerryx_handler_assert\n\n**Summary**\n\nHard assert for scripts. The routine calls `jerry_port_fatal` on assertion failure.\n\nIf the `JERRY_FEATURE_LINE_INFO` runtime feature is enabled (build option: `JERRY_LINE_INFO`)\na backtrace is also printed out.\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_handler_assert (const jerry_call_info_t *call_info_p,\n                       const jerry_value_t args_p[],\n                       const jerry_length_t args_cnt);\n```\n\n- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)\n                  structure which holds call related information (unused).\n- `args_p` - the array of function arguments.\n- `args_cnt` - the number of function arguments.\n- return value - `jerry_value_t` representing boolean true, if only one argument\n  was passed and that argument was a boolean true. Note that the function does\n  not return otherwise.\n\n**See also**\n\n- [jerryx_register_global](#jerryx_register_global)\n\n\n## jerryx_handler_gc\n\n**Summary**\n\nExpose garbage collector to scripts. If the first argument of the function\nis logical true, it performs a high pressure gc. Otherwise a low pressure\ngc is performed, which is also the default if no parameters passed.\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_handler_gc (const jerry_call_info_t *call_info_p,\n                   const jerry_value_t args_p[],\n                   const jerry_length_t args_cnt);\n```\n\n- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)\n                  structure which holds call related information (unused).\n- `args_p` - the array of function arguments (unused).\n- `args_cnt` - the number of function arguments (unused).\n- return value - `jerry_value_t` representing `undefined`.\n\n**See also**\n\n- [jerryx_register_global](#jerryx_register_global)\n\n\n## jerryx_handler_print\n\n**Summary**\n\nProvide a `print` implementation for scripts. The routine converts all of its\narguments to strings and outputs them by using `jerry_port_print_buffer`.\nThe NULL character is output as \"\\u0000\", other characters are output bytewise.\n\n*Note*: This implementation does not use standard C `printf` to print its\noutput. This allows more flexibility but also extends the core JerryScript\nengine port API. Applications that want to use `jerryx_handler_print` must\nensure that their port implementation also provides\n`jerry_port_print_buffer`.\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_handler_print (const jerry_call_info_t *call_info_p,\n                      const jerry_value_t args_p[],\n                      const jerry_length_t args_cnt);\n```\n\n- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)\n                  structure which holds call related information (unused).\n- `args_p` - the array of function arguments.\n- `args_cnt` - the number of function arguments.\n- return value - `jerry_value_t` representing `undefined` if all arguments could\n  be converted to strings, an `Error` otherwise.\n\n**See also**\n\n- [jerryx_register_global](#jerryx_register_global)\n- [jerry_port_print_buffer](05.PORT-API.md#jerry_port_print_buffer)\n\n\n# Handler registration helper\n\n## jerryx_register_global\n\n**Summary**\n\nRegister a JavaScript function in the global object.\n\n*Note*: Returned value must be freed with `jerry_value_free`, when it is no\nlonger needed.\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_register_global (const char *name_p,\n                        jerry_external_handler_t handler_p);\n```\n\n- `name_p` - the name of the function to be registered.\n- `handler_p` - the address of the external function handler.\n- return value - `jerry_value_t` representing boolean true, if the operation was\n  successful, an `Error` otherwise.\n\n**Example**\n\n[doctest]: # (test=\"compile\")\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n\nstatic const struct {\n  const char *name_p;\n  jerry_external_handler_t handler_p;\n} common_functions[] =\n{\n  { \"assert\", jerryx_handler_assert },\n  { \"gc\", jerryx_handler_gc },\n  { \"print\", jerryx_handler_print },\n  { NULL, NULL }\n};\n\nstatic void\nregister_common_functions (void)\n{\n  jerry_value_t ret = jerry_undefined ();\n\n  for (int i = 0; common_functions[i].name_p != NULL && !jerry_value_is_exception (ret); i++)\n  {\n    ret = jerryx_register_global (common_functions[i].name_p,\n                                  common_functions[i].handler_p);\n  }\n\n  jerry_value_free (ret);\n}\n```\n"
  },
  {
    "path": "docs/11.EXT-REFERENCE-AUTORELEASE.md",
    "content": "#  Autorelease values\n\n## JERRYX_AR_VALUE_T\n\n**Summary**\n\nMacro for `const jerry_value_t` for which jerry_value_free() is\nautomatically called when the variable goes out of scope.\n\n*Note*: The macro depends on compiler support. For GCC and LLVM/clang, the macro is implemented\nusing the `__cleanup__` variable attribute. For other compilers, no support has been added yet.\n\n**Example**\n\n[doctest]: # (test=\"compile\", name=\"11.EXT-REFERENCE-AUTORELEASE.c\")\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/autorelease.h\"\n\nstatic void\nfoo (bool enable)\n{\n  JERRYX_AR_VALUE_T bar = jerry_string_sz (\"...\");\n\n  if (enable)\n  {\n    JERRYX_AR_VALUE_T baz = jerry_current_realm ();\n\n    /* bar and baz can now be used. */\n\n    /*\n     * jerry_value_free (baz) and jerry_value_free (bar) is called automatically before\n     * returning, because `baz` and `bar` go out of scope.\n     */\n    return;\n  }\n\n  /*\n   * jerry_value_free (bar) is called automatically when the function returns,\n   * because `bar` goes out of scope.\n   */\n}\n```\n\n**See also**\n\n- [jerry_value_t](../docs/02.API-REFERENCE.md#jerry_value_t)\n- [jerry_value_copy](../docs/02.API-REFERENCE.md#jerry_value_copy)\n- [jerry_value_free](../docs/02.API-REFERENCE.md#jerry_value_free)\n"
  },
  {
    "path": "docs/12.EXT-REFERENCE-MODULE.md",
    "content": "#  Module API\n\nThis is a JerryScript extension that provides a means of loading modules. Fundamentally, a module is a name (stored as\na string) that resolves to a `jerry_value_t`. This extension provides the function `jerryx_module_resolve()` which\naccepts the name of the module being requested as well as an array of so-called \"resolvers\" - structures containing two\nfunction pointers: one for a function which computes a canonical name for the requested module or returns a reference\nto the requested name, and one that converts a canonical name to a `jerry_value_t`, thus \"resolving\" or \"loading\" the\nrequested module.\n\nThe resolvers are first called in sequence to each compute the canonical name of the requested module. This is\naccomplished by calling the `get_canonical_name` function pointer they provide. If the function pointer is `NULL`, the\nrequested module name is assumed to be what the resolver considers to be its canonical name. `jerryx_module_resolve`\nsearches its cache of loaded modules for each canonical name as returned by a `get_canonical_name` function pointer. If\none of the loaded modules in the cache corresponds to a canonical name, it is returned.\n\nIf no cached module is found, `jerryx_module_resolve` calls each resolver's `resolve` function pointer, passing it its\npreviously computed interpretation of the requested module's canonical name. If the resolver successfully creates the\n`jerry_value_t` that represents the loaded module, it returns `true` and the `jerry_value_t` in its out parameter.\n\nWhen `jerryx_module_resolve` receives a value of `true` from a resolver, it stops iterating over the remaining\nresolvers in the sequence and, if the `jerry_value_t` returned from the resolver's `resolve` does not have the error\nflag set, it will add the `jerry_value_t` to its cache under the module's canonical name and return it. Thus, on\nsubsequent calls to `jerryx_module_resolve` with a module name whose canonical name is associated with the\n`jerry_value_t`, no `resolve` callback need be called again.\n\nThe purpose of having resolvers is to be able to account for the fact that different types of modules may be structured\ndifferently and thus, for each type of module a module resolver must be supplied at the point where an instance of that\ntype of module is requested.\n\nIndividual modules may be removed from the cache by calling `jerryx_module_clear_cache`. This function behaves\nidentically to `jerryx_module_resolve` in that it first checks the cache for the requested module, except that it\nremoves the module if found. Additionally, it clears the entire cache of all modules if called using a JavaScript value\nof `undefined` as its first parameter.\n\nAdditionally, this extension provides a means of easily defining so-called \"native\" JerryScript modules which can be\nresolved using the native JerryScript module resolver `jerryx_module_native_resolver`, which can be passed to\n`jerryx_module_resolve()`. Native modules are registered during application startup and by calling `dlopen()` by means\nof library constructors, support for which can be turned on using the `FEATURE_INIT_FINI` build flag. In the absence of\nsuch a flag, the module registration and unregistration functions are exposed as global symbols which can be called\nexplicitly. Note: On windows, `FEATURE_INIT_FINI` build flag only supported with GNU toolchain or Microsoft Visual C/C++ Compiler\n2008 and upper.\n\n## jerryx_module_resolve\n\n**Summary**\n\nLoad a copy of a module into the current context or return one that was already loaded if it is found.\n\nFor each resolver passed in via `resolvers_p`, its `get_canonical_name` function pointer gets called in order to\nestablish the resolver's interpretation of what the canonical name for the module should be. If `get_canonical_name` is\n`NULL`, it is assumed that the requested module's name as passed in is its canonical name.\n\nThen, for each resolver passed in via `resolvers_p`, its `resolve` function pointer gets called with its interpretation\nof what the module's canonical name should be, as computed in the previous step.\n\nIf the resolver's `resolve` function pointer returns `true`, the `jerry_value_t` returned in its out-parameter will be\nreturned by `jerryx_module_resolve` as the result of the request. If no error flag is set on the `jerry_value_t` it\nwill be cached under its canonical name so as to avoid loading the same module twice in the event of a subsequent call\nto `jerryx_module_resolve` with a module name whose canonical name matches an already loaded module.\n\n**Prototype**\n\n```c\njerry_value_t\njerryx_module_resolve (const jerry_value_t name,\n                       const jerryx_module_resolver_t **resolvers_p,\n                       size_t resolver_count);\n```\n\n- `name` - the name of the module to load\n- `resolvers_p` - the list of resolvers to call in sequence\n- `resolver_count` - the number of resolvers in `resolvers_p`\n- return value - `jerry_value_t` representing the module that was loaded, or the error that occurred in the process.\n\n\n## jerryx_module_clear_cache\n\n**Summary**\n\nRemove a module from the current context's cache, or clear the cache entirely.\n\n**Prototype**\n\n```c\nvoid\njerryx_module_clear_cache (const jerry_value_t name,\n                           const jerryx_module_resolver_t **resolvers_p,\n                           size_t resolver_count);\n```\n\n- `name` - the name of the module to remove from cache or a JavaScript `undefined` to clear the entire cache\n- `resolvers_p` - the list of resolvers to call in sequence\n- `resolver_count` - the number of resolvers in `resolvers_p`\n\n\n## jerryx_module_native_resolver\n\n**Summary**\n\nThe resolver for native JerryScript modules. A pointer to this structure can be passed in the second parameter to\n`jerryx_module_resolve` to search for the module among the native JerryScript modules built into the binary. This\nfunction is available only if the preprocessor directive `JERRYX_NATIVE_MODULES_SUPPORTED` is defined.\n\n**Prototype**\n\n```c\nextern jerry_module_resolver_t jerryx_native_module_resolver;\n```\n\n# Module data types\n\n## jerryx_module_get_canonical_name_t\n\n**Summary**\n\nThe function pointer type for converting a module's requested name to its canonical name.\n\n**Prototype**\n\n```c\ntypedef jerry_value_t (*jerryx_module_get_canonical_name_t) (const jerry_value_t name);\n```\n\n## jerryx_module_resolve_t\n\n**Summary**\n\nFunction pointer type for module resolution.\n\n**Prototype**\n\n```c\ntypedef bool (*jerryx_module_resolve_t) (const jerry_value_t canonical_name,\n                                        jerry_value_t *result);\n```\n\n## jerryx_module_resolver_t\n\n**Summary**\n\nStructure defining a module resolver.\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  jerryx_module_get_canonical_name_t get_canonical_name_p;\n  jerryx_module_resolve_t resolve_p;\n} jerryx_module_resolver_t;\n```\n\n- `get_canonical_name_p` - function pointer to be called when the canonical name corresponding to the requested name\nof a module must be established.\n- `resolve_p` - function pointer to be called when a module with the given canonical name needs to be converted to the\n`jerry_value_t` that will become the loaded module.\n\n**Example**\n```c\nstatic bool\nload_and_evaluate_js_file (const jerry_value_t name, jerry_value_t *result)\n{\n  bool return_value = false;\n  char *js_file_contents = NULL;\n  int file_size = 0;\n\n  jerry_size_t name_size = jerry_string_size (name, JERRY_ENCODING_UTF8);\n  jerry_char_t name_string[name_size + 1];\n  jerry_string_to_buffer (name, JERRY_ENCODING_UTF8, name_string, name_size);\n  name_string[name_size] = 0;\n\n  FILE *js_file = fopen (name_string, \"r\");\n\n  if (js_file)\n  {\n    /* We have successfully opened the file. Now, we establish its size. */\n    file_size = fseek (js_file, 0, SEEK_END);\n    fseek (js_file, 0, SEEK_SET);\n\n    /* We allocate enough memory to store the contents of the file. */\n    js_file_contents = malloc (file_size);\n    if (js_file_contents)\n    {\n      /* We read the file into memory and call jerry_eval (), assigning the result to the out-parameter. */\n      fread (js_file_contents, file_size, 1, js_file);\n      (*result) = jerry_eval (js_file_contents, file_size, JERRY_PARSE_NO_OPTS);\n\n      /* We release the memory holding the contents of the file. */\n      free (js_file_contents);\n      return_value = true;\n    }\n\n    /* We close the file. */\n    fclose (js_file);\n  }\n\n  return return_value;\n}\n\nstatic jerry_value_t\ncanonicalize_file_path (const jerry_value_t name)\n{\n  jerry_value_t absolute_path;\n\n  /**\n   * Since a file on the file system can be referred to by multiple relative paths, but only by one absolute path, the\n   * absolute path becomes the canonical name for the module. Thus, to establish this canonical name, we must search\n   * name for \"./\" and \"../\", follow symlinks, etc., then create absolute_path via jerry_string () and return\n   * it, because it is the canonical name for this module. Thus, we avoid loading the same JavaScript file twice.\n   */\n\n  return absolute_path;\n}\n\nstatic jerryx_module_resolver_t js_file_loader\n{\n  canonicalize_file_path,\n  load_and_evaluate_js_file\n};\n```\n\nWe can now load JavaScript files:\n```c\nstatic const jerryx_module_resolver_t *resolvers[] =\n{\n  /*\n   * Consult the resolver for native JerryScript modules first, in case the requested module is a native JerryScript\n   * module.\n   */\n  &jerryx_module_native_resolver,\n\n  /*\n   * If the requested module is not a native JerryScript module, assume it is a JavaScript file on disk and use the\n   * above-defined JavaScript file loader to load it.\n   */\n  &js_file_loader\n};\njerry_value_t js_module = jerryx_module_resolve (requested_module, resolvers, 2);\n```\n\n# Module helper macros\n\n## JERRYX_NATIVE_MODULE\n\n**Summary**\n\nHelper macro to define a native JerryScript module. Currently declares a global static structure of type\n`jerryx_native_module_t` and a constructor/destructor pair that calls `jerryx_native_module_register()` resp.\n`jerryx_native_module_unregister()`. If the extension is built without the FEATURE_INIT_FINI flag, indicating that\nsupport for library constructors and destructors is absent, the constructor and destructor are declared as global\nsymbols so that they may be called explicitly from within the application.\n\n**Note**: The helper macro must appear at the bottom of a source file, and no semicolon must follow it.\n\n**Prototype**\n```c\n#define JERRYX_NATIVE_MODULE(module_name, on_resolve_cb)\n```\n\n- `module_name` - the name of the module without quotes. This value is used as the prefix for the registration and unregistration functions. For example, when `module_name` is `example_module`, this results in the declaration of two functions `example_module_register()` and `example_module_unregister()`. These functions are declared global if support for library constructors/destructors is absent, allowing you to call them from other parts of the code by\nfirst forward-declaring them.\n- `on_resolve_cb` - the function of type `jerryx_native_module_on_resolve_t` that will be called when the module needs to be\nloaded.\n\n**Example**\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/module.h\"\n\nstatic jerry_value_t\nmy_module_on_resolve (void)\n{\n  return jerry_function_external (very_useful_function);\n} /* my_module_on_resolve */\n\n/* Note that there is no semicolon at the end of the next line. This is how it must be. */\nJERRYX_NATIVE_MODULE (my_module, my_module_on_resolve)\n```\n\n**Example Usage When Library Constructors Are Unavailable**\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/module.h\"\n\n/**\n * Forward-declare the module registration and unregistration function.\n */\nextern void my_module_register (void);\nextern void my_module_unregister (void);\nint\nmain (int argc, char **argv)\n{\n  jerryx_module_resolver_t resolvers[] =\n  {\n    jerryx_native_module_resolver\n  };\n\n  /* This plays the role of the library constructor. */\n  my_module_register ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n  ...\n  jerry_value_t my_module = jerryx_module_resolve (\"my_module\", resolvers, 1);\n  ...\n  jerry_cleanup ();\n\n  /* This plays the role of the library destructor */\n  my_module_unregister();\n\n  return 0;\n}\n```\n"
  },
  {
    "path": "docs/13.DEBUGGER-TRANSPORT.md",
    "content": "# JerryScript debugger transport interface\n\nThe transport interface support allows dynamic selection of transportation\nlayers which can encode/decode or send/receive messages transmitted between\nthe debugger client and server.\n\n# Types\n\n## jerry_debugger_transport_receive_context_t\n\n**Summary**\n\nThis context represents the current status of processing received data.\nThe final state is returned by\n[jerry_debugger_transport_receive](#jerry_debugger_transport_receive)\nand must be passed to\n[jerry_debugger_transport_receive_completed](#jerry_debugger_transport_receive_completed)\nafter the message is processed.\n\n**Prototype**\n\n```c\ntypedef struct\n{\n  uint8_t *buffer_p; /**< buffer for storing the received data */\n  size_t received_length; /**< number of currently received bytes */\n  uint8_t *message_p; /**< start of the received message */\n  size_t message_length; /**< length of the received message */\n  size_t message_total_length; /**< total length for datagram protocols,\n                                *   0 for stream protocols */\n} jerry_debugger_transport_receive_context_t;\n```\n\n## jerry_debugger_transport_header_t\n\n**Summary**\n\nShared header for each transport interface. It mostly contains callback functions\nused by the JerryScript debugger server.\n\n**Prototype**\n\n```c\ntypedef struct jerry_debugger_transport_layer_t\n{\n  /* The following fields must be filled before calling jerry_debugger_transport_add(). */\n  jerry_debugger_transport_close_t close; /**< close connection callback */\n  jerry_debugger_transport_send_t send;  /**< send data callback */\n  jerry_debugger_transport_receive_t receive; /**< receive data callback */\n\n  /* The following fields are filled by jerry_debugger_transport_add(). */\n  struct jerry_debugger_transport_layer_t *next_p; /**< next transport layer */\n} jerry_debugger_transport_header_t;\n```\n\n## jerry_debugger_transport_close_t\n\n**Summary**\n\nCalled when the connection is closed. Must release all resources (including the\nmemory area for the transport interface) allocated for the transport interface.\n\n**Prototype**\n\n```c\ntypedef void (*jerry_debugger_transport_close_t) (struct jerry_debugger_transport_interface_t *header_p);\n```\n\n## jerry_debugger_transport_send_t\n\n**Summary**\n\nCalled when a message needs to be sent. Must either transmit the message or call\nthe `header_p->next_p->send()` method.\n\n**Prototype**\n\n```c\ntypedef bool (*jerry_debugger_transport_send_t) (struct jerry_debugger_transport_interface_t *header_p,\n                                                 uint8_t *message_p,\n                                                 size_t message_length);\n```\n\n## jerry_debugger_transport_receive_t\n\n**Summary**\n\nCalled during message processing. If messages are available it must return with\nthe next message.\n\n**Prototype**\n\n```c\ntypedef bool (*jerry_debugger_transport_receive_t) (struct jerry_debugger_transport_interface_t *header_p,\n                                                    jerry_debugger_transport_receive_context_t *context_p);\n```\n\n# Transport interface API functions\n\n## jerry_debugger_transport_add\n\n**Summary**\n\nAdd a new interface to the transportation interface chain. The interface\nwill be the first item of the interface chain.\n\n**Prototype**\n\n```c\nvoid jerry_debugger_transport_add (jerry_debugger_transport_header_t *header_p,\n                                   size_t send_message_header_size,\n                                   size_t max_send_message_size,\n                                   size_t receive_message_header_size,\n                                   size_t max_receive_message_size);\n```\n\n- `header_p`: header of a transportation interface.\n- `send_message_header_size`: size of the outgoing message header, can be 0.\n- `max_send_message_size`: maximum outgoing message size supported by the interface.\n- `receive_message_header_size`: size of the incoming message header, can be 0.\n- `max_receive_message_size`: maximum incoming message size supported by the interface.\n\n## jerry_debugger_transport_start\n\n**Summary**\n\nStarts the communication to the debugger client. Must be called after the\nconnection is successfully established.\n\n**Prototype**\n\n```c\nvoid jerry_debugger_transport_start (void);\n```\n\n## jerry_debugger_transport_is_connected\n\n**Summary**\n\nTells whether a debugger client is connected to the debugger server.\n\n**Prototype**\n\n```c\nbool jerry_debugger_transport_is_connected (void);\n```\n\n- return value: `true`, if a client is connected, `false` otherwise.\n\n## jerry_debugger_transport_close\n\n**Summary**\n\nDisconnect from the current debugger client. It does nothing if a client is\nnot connected.\n\n**Prototype**\n\n```c\nvoid jerry_debugger_transport_close (void);\n```\n\n## jerry_debugger_transport_send\n\n**Summary**\n\nSend message to the client.\n\n**Prototype**\n\n```c\nbool jerry_debugger_transport_send (const uint8_t *message_p, size_t message_length);\n```\n\n- `message_p`: message to be sent.\n- `message_length`: message length in bytes.\n- return value: `true`, if a client is still connected, `false` otherwise.\n\n## jerry_debugger_transport_receive\n\n**Summary**\n\nReceive message from the client.\n\n**Prototype**\n\n```c\nbool jerry_debugger_transport_receive (jerry_debugger_transport_receive_context_t *context_p);\n```\n\n- `context_p`: an unused [jerry_debugger_transport_receive_context_t](#jerry_debugger_transport_receive_context_t).\n- return value: `true`, if a client is still connected, `false` otherwise.\n\n## jerry_debugger_transport_receive_completed\n\n**Summary**\n\nMust be called after [jerry_debugger_transport_receive](#jerry_debugger_transport_receive)\nreturns with a valid message. Must not be called otherwise.\n\n**Prototype**\n\n```c\nvoid jerry_debugger_transport_receive_completed (jerry_debugger_transport_receive_context_t *context_p);\n```\n\n- `context_p`: a [jerry_debugger_transport_receive_context_t](#jerry_debugger_transport_receive_context_t)\n               passed to [jerry_debugger_transport_receive](#jerry_debugger_transport_receive).\n\n## jerry_debugger_transport_sleep\n\n**Summary**\n\nCan be used to wait for incoming messages. Currently the delay is 100ms.\n\n**Prototype**\n\n```c\nvoid jerry_debugger_transport_sleep (void);\n```\n"
  },
  {
    "path": "docs/14.EXT-REFERENCE-HANDLE-SCOPE.md",
    "content": "# Handle Scope\n\n## jerryx_handle_scope\n\n**Summary**\nIt is often necessary to make the lifespan of handles shorter than the lifespan of a native method. Even though the native code could only use the most recent handle, all of the associated objects would also be kept alive since they all share the same scope.\n\nTo handle this case, JerryScript HandleScope extension provides the ability to establish a new 'scope' to which newly created handles will be associated. Once those handles are no longer required, the scope can be 'closed' and any handles associated with the scope are invalidated. The methods available to open/close scopes are `jerryx_open_handle_scope` and `jerryx_close_handle_scope`.\n\nJerryScript only supports a single nested hierarchy of scopes. There is only one active scope at any time, and all new handles will be associated with that scope while it is active. Scopes must be closed in the reverse order from which they are opened. In addition, all scopes created within a native method must be closed before returning from that method.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/handle-scope.h\"\n\nstatic jerry_value_t\ncreate_object (void)\n{\n  jerry_value_t obj = jerry_object ();\n  return obj;\n} /* create_object */\n\nstatic void\ntest_handle_scope_val (void)\n{\n  jerryx_handle_scope scope;\n  jerryx_open_handle_scope (&scope);\n  jerry_value_t obj = jerryx_create_handle (create_object ());\n\n  jerryx_close_handle_scope (scope);\n  // now obj has been released\n} /* test_handle_scope_val */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  test_handle_scope_val ();\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n\n  jerry_cleanup ();\n} /* main */\n```\n\n## jerryx_escapable_handle_scope\n\n**Summary**\n\nIt is necessary in common cases that a handle has to be promote to outer scope and prevent from been garbage collected. To handle this case, a escapable handle scope has been proposed from which one object can be promoted to the outer scope. The method available to escape an object from been release at current scope is `jerryx_escape_handle`.\n\n**Example**\n\n[doctest]: # ()\n\n```c\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/handle-scope.h\"\n\nstatic jerry_value_t\ncreate_object (void)\n{\n  jerryx_escapable_handle_scope scope;\n  jerryx_open_escapable_handle_scope (&scope);\n  jerry_value_t obj = jerryx_create_handle (jerry_object ());\n\n  jerry_value_t escaped_obj;\n  jerryx_escape_handle(scope, obj, &escaped_obj);\n  jerryx_close_handle_scope (scope);\n  // escaped_obj has now been escaped to outer scope, thus not released at this point\n\n  return escaped_obj;\n} /* create_object */\n\nstatic void\ntest_handle_scope_val (void)\n{\n  jerryx_handle_scope scope;\n  jerryx_open_handle_scope (&scope);\n  jerry_value_t obj = create_object ();\n\n  jerryx_close_handle_scope (scope);\n  // now obj has been released\n} /* test_handle_scope_val */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  test_handle_scope_val ();\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n\n  jerry_cleanup ();\n} /* main */\n```\n\n**See also**\n\n- [jerry_value_t](../docs/02.API-REFERENCE.md#jerry_value_t)\n- [jerry_value_copy](../docs/02.API-REFERENCE.md#jerry_value_copy)\n- [jerry_value_free](../docs/02.API-REFERENCE.md#jerry_value_free)\n\n## Pre-allocated list of handle scopes and handles\n\nTo prevent trapping into system calls frequently, a pre-allocated dedicated list mechanism has been introduced to the implementation of JerryX handle scope.\n\nTo change the size of pre-allocation list, use build definition `JERRYX_HANDLE_PRELIST_SIZE` and `JERRYX_SCOPE_PRELIST_SIZE` to alter the default value of 20.\n"
  },
  {
    "path": "docs/15.MODULE-SYSTEM.md",
    "content": "# ES6 module support for JerryScript\n\nThe module system allows users to write import and export statements in scripts, which can be used to separate the logic of the application into custom modules.\nThe standard's relevant part can be found [here](https://www.ecma-international.org/ecma-262/6.0/#sec-modules).\nEmbedders wishing to use native builtin modules with ES6 imports can use the [Port API](05.PORT-API.md#jerry-module-system) to do so.\n\n## General\n\nIf a script contains import statements, then JerryScript will open and evaluate the the referenced modules before the main script runs, resolving and creating bindings for the referenced identifiers in the process.\nIt is not necessary to use any specific filename extensions for modules, JerryScript will try to open the given file paths as they are, but will try to normalize them before doing so. The exact normalization process is dependant on the port implementation provided. It is the user's responsibility to verify that the given files are valid ECMAScript modules.\n\nmain.js\n\n```js\nimport { exported_value } from \"./module.js\"\n\nprint (exported_value);\n```\n\nmodule.js\n\n```js\nvar exported_value = 42;\n\nexport exported_value;\n```\n\n## Supported features\n\n* exporting identifiers from the module's lexical environment\n  * specifying export names for the exported values\n* importing exported identifiers from a module\n  * specifying local binding names for the imported values\n* module namespace imports\n  * `import * as module from 'module.js`\n* indirect export statements\n  * `export {variable} from 'module.js'`\n* star export statements\n  * `export * from 'module.js'`\n* importing a module for side-effects\n  * `import 'module.js'`\n* default import and export statements\n  * `export default local_identifier`\n  * `import def from 'module.js'`\n* anonymous default exports\n  * `export default function () {}`\n\n### Example\n\n```js\nimport {\n  engine,\n  version as v\n} from \"./module.js\"\n\nimport { getFeatureDetails } from \"./module_2.js\"\n\nvar version = \"v3.1415\";\n\nprint(\"> main.js\");\n\nprint(\">> Engine: \" + engine);\nprint(\">> Version: \" + v);\n\nprint (\">> \" + getFeatureDetails());\nprint (\">> Script version: \" + version);\n```\n\n```js\n// module.js\nvar _engine = \"JerryScript\";\nexport _engine as engine;\n\nexport var version = \"1.0 (e92ae0fb)\";\n```\n\n```js\n// module_2.js\nvar featureName = \"ECMAScript modules\";\nvar year = 2018;\n\nexport function getFeatureDetails() {\n  return \"Feature name: \" + featureName + \" | developed in \" + year;\n}\n```\n\n### Module namespace import statements\n\nA module namespace object can be imported. In this case the local binding will contain an object holding the exported values of the module, including local exports and all indirect exports. Ambiguous exported names are excluded from the namespace object.\n\n```js\nimport * as module from './module.js';\n\nprint(\">> Engine: \" + module.engine);\nprint(\">> Version: \" + module.version);\n```\n\n### Indirect export statements\n\nAn export statement can transitively export variables from another module, either via named indirect exports or a star export statement. In this case the resolving process will follow the chain until it reaches a module containing a local binding for that export name. If there are multiple modules which satisfy the export, that means the export is ambiguous, and will result in a SyntaxError.\n\n```js\nimport { a, b } from 'module.js'\n\nprint (a + b);\n```\n\n```js\n// module.js\nexport var a = 2;\nexport { b } from 'module2.js'\n```\n\n```js\n// module2.js\nexport var b = 40;\n```\n\n### Default imports and exports\n\nEach module can optionally provide a single default export by using the `export default` statement. Default exports can either reference identifiers in the module's lexical environment, or be an anonymous default export, in which case they will only be accessible by an importing script.\n\n```js\nimport defaultExport, { b as c } from 'module.js'\n\nprint (defaultExport); // 2\nprint (c ()); // 42\n```\n\n```js\n// module.js\nexport default 2;\nexport function b () {\n  return 42;\n}\n```\n\n### Importing modules for side-effects\n\nEvaluate a module without importing anything. Any errors encountered in the module will be propagated.\n\n```js\nimport 'module.js' // > module.js\n// \"> module.js\" is printed\nb (); // (ReferenceError) b is not defined\n```\n\n```js\n// module.js\nexport function b () {\n  print (\"> module.js\");\n  return 42;\n}\nb ();\n```\n\n## Unsupported features\n\n* **snapshot**\n"
  },
  {
    "path": "docs/16.MIGRATION-GUIDE.md",
    "content": "# Migration guide\n\nThis guide intends to describe the major changes between the JerryScript 1.0 and 2.0 versions.\nIn addition it is designed to provide a guide on how to modify the 1.0 version code to a\n2.0 compliant code.\n\nDuring the development it was important to minimize the changes in the API functions and types.\nEach API method removal or change is described below providing a ***before*** and ***after***\ncode example.\nFor more information on the current API methods please check the [API reference](02.API-REFERENCE.md) document.\n\n# Short list of removed/renamed headers, types, functions, and macros\n\n***Removed legacy headers***\n\n- `jerry-internal.h`\n\n***Renamed headers***\n\n- `jerry-api.h` to `jerryscript.h`\n- `jerry-port.h` to `jerryscript-port.h`\n\n***Removed API types***\n\n- `jerry_char_ptr_t` usage replaced with `jerry_char_t *`\n- `jerry_object_free_callback_t` replaced by `jerry_object_native_free_callback_t`\n\n***Removed API methods***\n\n- `jerry_get_memory_limits`\n- `jerry_get_object_native_handle` replaced by `jerry_get_object_native_pointer`\n- `jerry_set_object_native_handle` replaced by `jerry_set_object_native_pointer`\n- `jerry_value_set_abort_flag` replaced by `jerry_create_abort_from_value`\n- `jerry_value_has_abort_flag` replaced by `jerry_value_is_abort`\n- `jerry_value_set_error_flag` replaced by `jerry_create_error_from_value`\n- `jerry_value_has_error_flag` replaced by `jerry_value_is_error`\n- `jerry_value_clear_error_flag` replaced by `jerry_get_value_from_error`\n- `jerry_get_value_without_error_flag` replaced by `jerry_get_value_from_error`\n- `jerry_parse_and_save_snapshot` replaced by `jerry_generate_snapshot`\n- `jerry_parse_and_save_function_snapshot` replaced by `jerry_generate_function_snapshot`\n\n\n***Removed unused configuration macros***\n\n- `CONFIG_MEM_DATA_LIMIT_MINUS_HEAP_SIZE`\n- `CONFIG_MEM_STACK_LIMIT`\n- `CONFIG_VM_STACK_FRAME_INLINED_VALUES_NUMBER`\n- `CONFIG_ECMA_GLOBAL_ENVIRONMENT_DECLARATIVE`\n- All `CONFIG_..` macros have been renamed to use the `JERRY_` prefix format.\n\n\n# Modified API functions\n\n## Error manipulating functions\n\nThe most important changes in the API are related to error handling and manipulation.\n\n### jerry_value_set_abort_flag\n\nThis function was replaced with  [`jerry_create_abort_from_value`](02.API-REFERENCE.md#jerry_create_abort_from_value).\nTake note of the second argument of the new `jerry_create_abort_from_value` function which controls if the\nfirst argument should be usable after the call or not.\n\n**Before**\n\n```c\n{\n  jerry_value_t value;\n  // create or acquire value\n  // ...\n\n  jerry_value_set_abort_flag (&value);\n\n  jerry_release_value (value);\n}\n```\n\n**After**\n\n```c\n{\n  jerry_value_t value;\n  // create or acquire value\n  // ...\n\n  jerry_value_t abort = jerry_create_abort_from_value (value, true);\n  // using the 'value' variable after release is invalid\n\n  jerry_release_value (abort);\n}\n```\n\n- OR\n\n```c\n{\n  jerry_value_t value;\n  ... // create or acquire value\n\n  jerry_value_t abort = jerry_create_abort_from_value (value, false);\n  // both 'abort' and 'value' can be used and must be released when they are no longer needed\n\n  jerry_release_value (abort);\n  jerry_release_value (value);\n}\n```\n\n### jerry_value_has_abort_flag\n\nThis function was renamed to  [`jerry_value_is_abort`](02.API-REFERENCE.md#jerry_value_is_abort).\n\n**Before**\n\n```c\n{\n  jerry_value_t value;\n  // create or acquire value\n  // ...\n\n  if (jerry_value_has_abort_flag (value))\n  {\n    // ...\n  }\n\n  jerry_release_value (value);\n}\n```\n\n**After**\n\n```c\n{\n  jerry_value_t value;\n  // create or acquire value\n  // ...\n\n  if (jerry_value_is_abort (value))\n  {\n    // ...\n  }\n\n  jerry_release_value (value);\n}\n```\n\n### jerry_value_set_error_flag\n\nThis function was replaced with  [`jerry_create_error_from_value`](02.API-REFERENCE.md#jerry_create_error_from_value).\nTake note of the second argument of the new `jerry_create_error_from_value` function which controls if the\nfirst argument should be usable after the call or not.\n\n**Before**\n\n```c\n{\n  jerry_value_t value;\n  // create or acquire value\n  // ...\n\n  jerry_value_set_error_flag (&value);\n\n  jerry_release_value (value);\n}\n```\n\n**After**\n\n```c\n{\n  jerry_value_t value;\n  // create or acquire value\n  // ...\n\n  jerry_value_t error = jerry_create_error_from_value (value, true);\n  // using the 'value' variable after release is invalid\n\n  jerry_release_value (error);\n}\n```\n\n- OR\n\n```c\n{\n  jerry_value_t value;\n  // create or acquire value\n  // ...\n\n  jerry_value_t error = jerry_create_error_from_value (value, false);\n  // both 'error' and 'value' can be used and must be released when they are no longer needed\n\n  jerry_release_value (error);\n  jerry_release_value (value);\n}\n```\n\n### jerry_value_has_error_flag\n\nThis function was renamed to  [`jerry_value_is_error`](02.API-REFERENCE.md#jerry_value_is_error).\n\n**Before**\n\n```c\n{\n  jerry_value_t value;\n  // create or acquire value\n  // ...\n\n  if (jerry_value_has_error_flag (value))\n  {\n    // ...\n  }\n\n  jerry_release_value (value);\n}\n```\n\n**After**\n\n```c\n{\n  jerry_value_t value;\n  // create or acquire value\n  // ...\n\n  if (jerry_value_is_error (value))\n  {\n    // ...\n  }\n\n  jerry_release_value (value);\n}\n```\n\n### jerry_value_clear_error_flag AND jerry_get_value_without_error_flag\n\nThese functions were merged into [`jerry_get_value_from_error`](02.API-REFERENCE.md#jerry_get_value_from_error).\nPlease note the second argument of the new function which controls if the first argument passed should be released\nor not.\n\n**Before**\n\n```c\n{\n  jerry_value_t value;\n  // create or acquire value\n  // ...\n\n  jerry_value_set_error_flag (&value);\n  jerry_value_clear_error_flag (&value);\n  // or\n  jerry_value_t real_value = jerry_get_value_without_error_flag (value);\n\n  jerry_release_value (value);\n  jerry_release_value (real_value);\n}\n```\n\n**After**\n\n```c\n{\n  jerry_value_t value;\n  // create or acquire value\n  // ...\n\n  jerry_value_t error = jerry_create_error_from_value (value, true);\n\n  jerry_value_t real_value = jerry_get_value_from_error (error, true);\n\n  jerry_release_value (real_value);\n}\n```\n\n## Other functions changed\n\n### jerry_register_magic_strings\n\nIn case of the `jerry_register_magic_strings` function the change is that\nthe first argument's base type `jerry_char_ptr_t` was changed to `jerry_char_t*`.\nFor more details see: [`jerry_register_magic_strings`](02.API-REFERENCE.md#jerry_register_magic_strings).\n\nIn the following code parts please take note of the type used for the `magic_string_items` array.\n\n**Before**\n\n```c\n{\n  // must be static, because 'jerry_register_magic_strings' does not copy\n  // the items must be sorted by size at first, then lexicographically\n  static const jerry_char_ptr_t magic_string_items[] = {\n                                                          (const jerry_char_ptr_t) \"magicstring1\",\n                                                          (const jerry_char_ptr_t) \"magicstring2\",\n                                                          (const jerry_char_ptr_t) \"magicstring3\"\n                                                        };\n  uint32_t num_magic_string_items = (uint32_t) (sizeof (magic_string_items) / sizeof (jerry_char_ptr_t));\n\n  // must be static, because 'jerry_register_magic_strings' does not copy\n  static const jerry_length_t magic_string_lengths[] = { 12, 12, 12 };\n  jerry_register_magic_strings (magic_string_items, num_magic_string_items, magic_string_lengths);\n}\n```\n\n**After**\n\n```c\n{\n  // must be static, because 'jerry_register_magic_strings' does not copy\n  // the items must be sorted by size at first, then lexicographically\n  static const jerry_char_t *magic_string_items[] = {\n                                                      (const jerry_char_t *) \"magicstring1\",\n                                                      (const jerry_char_t *) \"magicstring2\",\n                                                      (const jerry_char_t *) \"magicstring3\"\n                                                    };\n  uint32_t num_magic_string_items = (uint32_t) (sizeof (magic_string_items) / sizeof (jerry_char_t *));\n\n  // must be static, because 'jerry_register_magic_strings' does not copy\n  static const jerry_length_t magic_string_lengths[] = { 12, 12, 12 };\n  jerry_register_magic_strings (magic_string_items, num_magic_string_items, magic_string_lengths);\n}\n```\n\n## Snapshot generating API\n\n### jerry_parse_and_save_snapshot\n\nThis function was replaced with [`jerry_generate_snapshot`](02.API-REFERENCE.md#jerry_generate_snapshot).\nThe function returns an error object if there was any problem during snapshot generation and\nif there was no problem the return value is a number value containing the snapshot size in bytes.\n\n**Before**\n\n```c\n{\n  static uint32_t global_mode_snapshot_buffer[256];\n  const jerry_char_t *code_to_snapshot_p = (const jerry_char_t *) \"(function () { return 'string from snapshot'; }) ();\";\n\n  size_t global_mode_snapshot_size =\n    jerry_parse_and_save_snapshot (code_to_snapshot_p,\n                                   strlen ((const char *) code_to_snapshot_p),\n                                   true,\n                                   false,\n                                   global_mode_snapshot_buffer,\n                                   sizeof (global_mode_snapshot_buffer) / sizeof (uint32_t));\n  // use \"global_mode_snapshot_buffer\"\n}\n```\n\n**After**\n\n```c\n{\n  static uint32_t global_mode_snapshot_buffer[256];\n  const jerry_char_t *code_to_snapshot_p = (const jerry_char_t *) \"(function () { return 'string from snapshot'; }) ();\";\n\n  jerry_value_t generate_result;\n  generate_result = jerry_generate_snapshot (NULL,\n                                             0,\n                                             code_to_snapshot_p,\n                                             strlen ((const char *) code_to_snapshot_p),\n                                             global_mode_snapshot_buffer,\n                                             sizeof (global_mode_snapshot_buffer) / sizeof (uint32_t));\n  if (jerry_value_is_error (generate_result))\n  {\n    // There was a problem during snapshot generation, for example there is a SyntaxError.\n    // Use the \"generate_result\" to check the error.\n  }\n  else\n  {\n    size_t snapshot_size = (size_t) jerry_get_number_value (generate_result);\n    // use \"global_mode_snapshot_buffer\"\n  }\n  jerry_release_value (generate_result);\n}\n```\n\n### jerry_parse_and_save_function_snapshot\n\nThis function was replaced with [`jerry_generate_function_snapshot`](02.API-REFERENCE.md#jerry_parse_and_save_function_snapshot).\nThe function returns an error object if there was any problem during snapshot generation and\nif there was no problem the return value is a number value containing the snapshot size in bytes.\n\n**Before**\n\n```c\n{\n  static uint32_t func_snapshot_buffer[1024];\n\n  const jerry_char_t *args_p = (const jerry_char_t *) \"a, b\";\n  const jerry_char_t *src_p = (const jerry_char_t *) \"return a + b;\";\n\n  size_t func_snapshot_size =\n  jerry_parse_and_save_function_snapshot (src_p,\n                                          strlen ((const char *) src_p),\n                                          args_p,\n                                          strlen ((const char *) args_p),\n                                          false,\n                                          func_snapshot_buffer,\n                                          sizeof (func_snapshot_buffer) / sizeof (uint32_t));\n  // check \"function_snapshot_size\" and use \"func_snapshot_buffer\"\n}\n```\n\n**After**\n\n```c\n{\n  static uint32_t func_snapshot_buffer[1024];\n\n  const jerry_char_t *args_p = (const jerry_char_t *) \"a, b\";\n  const jerry_char_t *src_p = (const jerry_char_t *) \"return a + b;\";\n\n  jerry_value_t generate_result;\n  generate_result = jerry_generate_function_snapshot (NULL,\n                                                      0,\n                                                      src_p,\n                                                      strlen ((const char *) src_p),\n                                                      args_p,\n                                                      strlen ((const char *) args_p),\n                                                      0,\n                                                      func_snapshot_buffer,\n                                                      sizeof (func_snapshot_buffer) / sizeof (uint32_t));\n  if (jerry_value_is_error (generate_result))\n  {\n    // There was a problem during snapshot generation, for example there is a SyntaxError.\n    // Use the \"generate_result\" to check the error.\n  }\n  else\n  {\n    size_t snapshot_size = (size_t) jerry_get_number_value (generate_result);\n    // use \"func_snapshot_buffer\"\n  }\n\n  jerry_release_value (generate_result)\n}\n```\n\n## Garbage collection\n\n### jerry_gc\n\nThe [`jerry_gc`](02.API-REFERENCE.md#jerry_gc) function was modified to handle an argument which represents the pressure for the garbage collector.\nFor more information checkout the [`jerry_gc_mode_t`](02.API-REFERENCE.md#jerry_gc_mode_t) reference.\n\n**Before**\n\n```c\n{\n  jerry_gc ();\n}\n```\n\n**After**\n\n```c\n{\n  jerry_gc (JERRY_GC_PRESSURE_LOW);\n}\n```\n\n## jerry_eval\n\nThe third argument of [`jerry_eval`](02.API-REFERENCE.md#jerry_eval) has been changed\nfrom `bool` to [`jerry_parse_opts_t`](02.API-REFERENCE.md#jerry_parse_opts_t).\n\n**Before**\n\n```c\nconst jerry_char_t *str_to_eval = (const jerry_char_t *) \"1 + 1\";\njerry_value_t ret_val = jerry_eval (str_to_eval,\n                                    strlen ((const char *) str_to_eval),\n                                    false);\n```\n\n**After**\n\n```c\nconst jerry_char_t *str_to_eval = (const jerry_char_t *) \"1 + 1\";\njerry_value_t ret_val = jerry_eval (str_to_eval,\n                                    strlen ((const char *) str_to_eval),\n                                    JERRY_PARSE_NO_OPTS);\n```\n\n## Port API\n\n### jerry_port_get_time_zone\n\nThe port API of handling timezones has been changed. The previous interface did not\nallow timezones to be handled correctly, even if the host system was up to the task.\nCheck [the related issue](https://github.com/jerryscript-project/jerryscript/issues/1661)\nfor more details.\n\nThe new port API function name is [jerry_port_get_local_time_zone_adjustment](05.PORT-API.md#date-1].\n\nBelow is the default implementations for both versions:\n\n**Before**\n\n```c\nbool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)\n{\n  struct timeval tv;\n  struct timezone tz;\n\n  /* gettimeofday may not fill tz, so zero-initializing */\n  tz.tz_minuteswest = 0;\n  tz.tz_dsttime = 0;\n\n  if (gettimeofday (&tv, &tz) != 0)\n  {\n    return false;\n  }\n\n  tz_p->offset = tz.tz_minuteswest;\n  tz_p->daylight_saving_time = tz.tz_dsttime > 0 ? 1 : 0;\n\n  return true;\n} /* jerry_port_get_time_zone */\n```\n\n**After**\n\n```c\ndouble jerry_port_get_local_time_zone_adjustment (double unix_ms,\n                                                  bool is_utc)\n{\n  struct tm tm;\n  time_t now = (time_t) (unix_ms / 1000);\n  localtime_r (&now, &tm);\n  if (!is_utc)\n  {\n    now -= tm.tm_gmtoff;\n    localtime_r (&now, &tm);\n  }\n  return ((double) tm.tm_gmtoff) * 1000;\n} /* jerry_port_get_local_time_zone_adjustment */\n```\n\n## Native pointers\n\nThe assignment of native pointers (previously called handles) have been changed\nsince v1.0. In the previous version only one native pointer could be assigned to\na `jerry_value_t`. Now it is allowed to register multiple native infos, which\ncan be accessed with the corresponding\n[`jerry_object_native_info_t`](02.API-REFERENCE.md#jerry_object_native_info_t).\nThe old functions were removed and replaced by new ones.\n\n- `jerry_object_free_callback_t` callback type is replaced by `jerry_object_native_info_t`\n- `jerry_get_object_native_handle` is replaced by [`jerry_get_object_native_pointer`](02.API-REFERENCE.md#jerry_get_object_native_pointer)\n- `jerry_set_object_native_handle` is replaced by [`jerry_set_object_native_pointer`](02.API-REFERENCE.md#jerry_set_object_native_pointer)\n\n**Before**\n\n```c\nstruct\n{\n  int data;\n} my_info;\n\nstatic void\nhandler_construct_freecb (uintptr_t native_p)\n{\n  // Invoked when the JS object is released and the\n  // native data should be freed.\n\n  struct my_info *info = (struct my_info *) native_p;\n  free (info);\n}\n\nvoid\ndemo (void)\n{\n  jerry_value_t this_val;\n  // create or acquire this_val\n  // ...\n\n  struct my_info *info = (struct my_info *) malloc (sizeof (struct my_info));\n  info->data = 11;\n\n  // setting the native handle\n  jerry_set_object_native_handle (this_val,\n                                  (uintptr_t) info,\n                                  handler_construct_freecb);\n  // ...\n  // reading back the native handle\n  uintptr_t ptr = (uintptr_t) NULL;\n  bool is_ok = jerry_get_object_native_handle (this_val, &ptr);\n  if (is_ok)\n  {\n    struct my_info *obj_info = (struct my_info *) ptr;\n    // use \"obj_info\"\n  }\n}\n```\n\n\n**After**\n\n```c\nstruct\n{\n  int data;\n} my_info;\n\nstatic void\nhandler_construct_freecb (void *native_p)\n{\n  // Invoked when the JS object is released and the\n  // native data should be freed.\n\n  struct my_info *info = (struct my_info *) native_p;\n  free (info);\n}\n\nstatic const jerry_object_native_info_t my_info_type_info =\n{\n  .free_cb = handler_construct_freecb\n};\n\nvoid\ndemo (void)\n{\n  jerry_value_t this_val;\n  // create or acquire this_val\n  // ...\n\n  struct my_info *info = (struct my_info *) malloc (sizeof (struct my_info));\n  info->data = 11;\n\n  // setting the native handle\n  jerry_set_object_native_pointer (this_val,\n                                   info,\n                                   &my_info_type_info);\n  // ...\n  // reading back the native handle pointed by the \"my_info_type_info\" variable\n  void *ptr = NULL;\n  bool has_p = jerry_get_object_native_pointer (this_val, &ptr, &my_info_type_info);\n  if (has_p)\n  {\n    struct my_info *obj_info = (struct my_info *) ptr;\n    // use \"obj_info\"\n  }\n}\n```\n\n# New API functions\n\nIn this section the new API functions are listed.\n\n## Built-in objects\n\n***ArrayBuffer***\n\n- [`jerry_create_arraybuffer`](02.API-REFERENCE.md#jerry_create_arraybuffer)\n- [`jerry_create_arraybuffer_external`](02.API-REFERENCE.md#jerry_create_arraybuffer_external)\n- [`jerry_get_arraybuffer_pointer`](02.API-REFERENCE.md#jerry_get_arraybuffer_pointer)\n\n***DataView***\n\n- [`jerry_create_dataview`](02.API-REFERENCE.md#jerry_create_dataview)\n- [`jerry_value_is_dataview`](02.API-REFERENCE.md#jerry_value_is_dataview)\n- [`jerry_get_dataview_buffer`](02.API-REFERENCE.md#jerry_get_dataview_buffer)\n\n***JSON***\n\n- [`jerry_json_parse`](02.API-REFERENCE.md#jerry_json_parse)\n- [`jerry_json_stringify`](02.API-REFERENCE.md#jerry_json_stringify)\n\n***Number***\n\n- [`jerry_create_number_infinity`](02.API-REFERENCE.md#jerry_create_number_infinity)\n- [`jerry_create_number_nan`](02.API-REFERENCE.md#jerry_create_number_nan)\n\n***Promise***\n\n- [`jerry_run_all_enqueued_jobs`](02.API-REFERENCE.md#jerry_run_all_enqueued_jobs)\n- [`jerry_create_promise`](02.API-REFERENCE.md#jerry_create_promise)\n- [`jerry_resolve_or_reject_promise`](02.API-REFERENCE.md#jerry_resolve_or_reject_promise)\n- [`jerry_value_is_promise`](02.API-REFERENCE.md#jerry_value_is_promise)\n\n***RegExp***\n\n- [`jerry_create_regexp`](02.API-REFERENCE.md#jerry_create_regexp)\n- [`jerry_create_regexp_sz`](02.API-REFERENCE.md#jerry_create_regexp_sz)\n\n***String***\n\n- [`jerry_substring_to_utf8_char_buffer`](02.API-REFERENCE.md#jerry_substring_to_utf8_char_buffer)\n- [`jerry_get_utf8_string_size`](02.API-REFERENCE.md#jerry_get_utf8_string_size)\n- [`jerry_get_utf8_string_length`](02.API-REFERENCE.md#jerry_get_utf8_string_length)\n- [`jerry_create_string_from_utf8`](02.API-REFERENCE.md#jerry_create_string_from_utf8)\n- [`jerry_create_string_sz_from_utf8`](02.API-REFERENCE.md#jerry_create_string_sz_from_utf8)\n\n***Symbol***\n\n- [`jerry_create_symbol`](02.API-REFERENCE.md#jerry_create_symbol)\n- [`jerry_get_symbol_descriptive_string`](02.API-REFERENCE.md#jerry_get_symbol_descriptive_string)\n- [`jerry_value_is_symbol`](02.API-REFERENCE.md#jerry_value_is_symbol)\n\n***TypedArray***\n\n- [`jerry_create_typedarray`](02.API-REFERENCE.md#jerry_create_typedarray)\n- [`jerry_create_typedarray_for_arraybuffer`](02.API-REFERENCE.md#jerry_create_typedarray_for_arraybuffer)\n- [`jerry_create_typedarray_for_arraybuffer_sz`](02.API-REFERENCE.md#jerry_create_typedarray_for_arraybuffer_sz)\n- [`jerry_get_typedarray_type`](02.API-REFERENCE.md#jerry_get_typedarray_type)\n- [`jerry_get_typedarray_length`](02.API-REFERENCE.md#jerry_get_typedarray_length)\n- [`jerry_get_typedarray_buffer`](02.API-REFERENCE.md#jerry_get_typedarray_buffer)\n- [`jerry_value_is_typedarray`](02.API-REFERENCE.md#jerry_value_is_typedarray)\n\n\n## Instances and memory management\n\n***JerryScript instances***\n\n- [`jerry_create_context`](02.API-REFERENCE.md#jerry_create_context)\n- [`jerry_get_context_data`](02.API-REFERENCE.md#jerry_get_context_data)\n\n***Memory management***\n\n- [`jerry_heap_alloc`](02.API-REFERENCE.md#jerry_heap_alloc)\n- [`jerry_heap_free`](02.API-REFERENCE.md#jerry_heap_free)\n\n\n## Operations with JavaScript values\n\n***Binary operations***\n\n- [`jerry_binary_operation`](02.API-REFERENCE.md#jerry_binary_operation)\n\n***Error manipulating***\n\n- [`jerry_get_error_type`](02.API-REFERENCE.md#jerry_get_error_type)\n- [`jerry_get_backtrace`](02.API-REFERENCE.md#jerry_get_backtrace)\n\n***Native pointers***\n\n- [`jerry_delete_object_native_pointer`](02.API-REFERENCE.md#jerry_delete_object_native_pointer)\n- [`jerry_objects_foreach_by_native_info`](02.API-REFERENCE.md#jerry_objects_foreach_by_native_info)\n\n***Property***\n\n- [`jerry_delete_property_by_index`](02.API-REFERENCE.md#jerry_delete_property_by_index)\n- [`jerry_objects_foreach`](02.API-REFERENCE.md#jerry_objects_foreach)\n\n\n## Debugger\n\n- [`jerry_debugger_is_connected`](07.DEBUGGER.md#jerry_debugger_is_connected)\n- [`jerry_debugger_stop`](07.DEBUGGER.md#jerry_debugger_stop)\n- [`jerry_debugger_continue`](07.DEBUGGER.md#jerry_debugger_continue)\n- [`jerry_debugger_stop_at_breakpoint`](07.DEBUGGER.md#jerry_debugger_stop_at_breakpoint)\n- [`jerry_debugger_wait_for_client_source`](07.DEBUGGER.md#jerry_debugger_wait_for_client_source)\n- [`jerry_debugger_send_output`](07.DEBUGGER.md#jerry_debugger_send_output)\n- [`jerry_debugger_send_log`](07.DEBUGGER.md#jerry_debugger_send_log)\n\n\n## Other\n\n- [`jerry_is_feature_enabled`](02.API-REFERENCE.md#jerry_is_feature_enabled)\n- [`jerry_parse_and_save_literals`](02.API-REFERENCE.md#jerry_parse_and_save_literals)\n- [`jerry_set_vm_exec_stop_callback`](02.API-REFERENCE.md#jerry_set_vm_exec_stop_callback)\n\n\n## Port API functions\n\n- [`jerry_port_normalize_path`](05.PORT-API.md#jerry_port_normalize_path)\n- [`jerry_port_read_source`](05.PORT-API.md#jerry_port_read_source)\n- [`jerry_port_release_source`](05.PORT-API.md#jerry_port_release_source)\n- [`jerry_port_print_char`](05.PORT-API.md#jerry_port_print_char)\n- [`jerry_port_get_current_context`](05.PORT-API.md#jerry_port_get_current_context)\n- [`jerry_port_fatal`](05.PORT-API.md#jerry_port_fatal)\n- [`jerry_port_sleep`](05.PORT-API.md#jerry_port_sleep)\n- [`jerry_port_print_byte`](05.PORT-API.md#jerry_port_print_byte)\n\n# Migrating from 2.x to 3.x\n\nThe most significant change in JerryScript 3.0 was the API rework. Most of the API functions had been\nrenamed in this version. There are notes for every such function in the [API Reference](02.API-REFERENCE.md)\nto help you to migrate from an older version. For example:\n\n*Renamed in version 3.0, it was previously known as `jerry_get_global_object` in earlier versions.*\n"
  },
  {
    "path": "jerry-core/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required (VERSION 3.10)\nset(JERRY_CORE_NAME jerry-core)\nproject (${JERRY_CORE_NAME} C)\n\ninclude(CheckLibraryExists)\n\n# Optional features\nset(JERRY_CPOINTER_32_BIT           OFF          CACHE BOOL   \"Enable 32 bit compressed pointers?\")\nset(JERRY_DEBUGGER                  OFF          CACHE BOOL   \"Enable JerryScript debugger?\")\nset(JERRY_ERROR_MESSAGES            OFF          CACHE BOOL   \"Enable error messages?\")\nset(JERRY_EXTERNAL_CONTEXT          OFF          CACHE BOOL   \"Enable external context?\")\nset(JERRY_PARSER                    ON           CACHE BOOL   \"Enable javascript-parser?\")\nset(JERRY_FUNCTION_TO_STRING        OFF          CACHE BOOL   \"Enable function toString operation?\")\nset(JERRY_LINE_INFO                 OFF          CACHE BOOL   \"Enable line info?\")\nset(JERRY_LOGGING                   OFF          CACHE BOOL   \"Enable logging?\")\nset(JERRY_MEM_STATS                 OFF          CACHE BOOL   \"Enable memory statistics?\")\nset(JERRY_MEM_GC_BEFORE_EACH_ALLOC  OFF          CACHE BOOL   \"Enable mem-stress test?\")\nset(JERRY_PARSER_DUMP_BYTE_CODE     OFF          CACHE BOOL   \"Enable parser byte-code dumps?\")\nset(JERRY_PROFILE                   \"es.next\"    CACHE STRING \"Use default or other profile?\")\nset(JERRY_PROMISE_CALLBACK          OFF          CACHE BOOL   \"Enable Promise callbacks?\")\nset(JERRY_REGEXP_STRICT_MODE        OFF          CACHE BOOL   \"Enable regexp strict mode?\")\nset(JERRY_REGEXP_DUMP_BYTE_CODE     OFF          CACHE BOOL   \"Enable regexp byte-code dumps?\")\nset(JERRY_SNAPSHOT_EXEC             OFF          CACHE BOOL   \"Enable executing snapshot files?\")\nset(JERRY_SNAPSHOT_SAVE             OFF          CACHE BOOL   \"Enable saving snapshot files?\")\nset(JERRY_SYSTEM_ALLOCATOR          OFF          CACHE BOOL   \"Enable system allocator?\")\nset(JERRY_VALGRIND                  OFF          CACHE BOOL   \"Enable Valgrind support?\")\nset(JERRY_VM_HALT                   OFF          CACHE BOOL   \"Enable VM execution stop callback?\")\nset(JERRY_VM_THROW                  OFF          CACHE BOOL   \"Enable VM throw callback?\")\nset(JERRY_GLOBAL_HEAP_SIZE          \"(512)\"      CACHE STRING \"Size of memory heap, in kilobytes\")\nset(JERRY_GC_LIMIT                  \"(0)\"        CACHE STRING \"Heap usage limit to trigger garbage collection\")\nset(JERRY_STACK_LIMIT               \"(0)\"        CACHE STRING \"Maximum stack usage size, in kilobytes\")\nset(JERRY_GC_MARK_LIMIT             \"(8)\"        CACHE STRING \"Maximum depth of recursion during GC mark phase\")\n\n# Option overrides\nif(JERRY_SYSTEM_ALLOCATOR)\n  set(JERRY_CPOINTER_32_BIT ON)\n\n  set(JERRY_CPOINTER_32_BIT_MESSAGE \" (FORCED BY SYSTEM ALLOCATOR)\")\nendif()\n\nif (JERRY_GLOBAL_HEAP_SIZE GREATER 512)\n  set(JERRY_CPOINTER_32_BIT ON)\n\n  set(JERRY_CPOINTER_32_BIT_MESSAGE \" (FORCED BY HEAP SIZE)\")\nendif()\n\nif(NOT JERRY_PARSER)\n  set(JERRY_SNAPSHOT_EXEC ON)\n  set(JERRY_PARSER_DUMP   OFF)\n\n  set(JERRY_SNAPSHOT_EXEC_MESSAGE \" (FORCED BY DISABLED JS PARSER)\")\n  set(JERRY_PARSER_DUMP_MESSAGE   \" (FORCED BY DISABLED JS PARSER)\")\nendif()\n\nif(JERRY_CMDLINE_SNAPSHOT)\n  set(JERRY_SNAPSHOT_SAVE ON)\n\n  set(JERRY_SNAPSHOT_SAVE_MESSAGE \" (FORCED BY SNAPSHOT TOOL)\")\nendif()\n\nif(JERRY_MEM_STATS OR JERRY_PARSER_DUMP_BYTE_CODE OR JERRY_REGEXP_DUMP_BYTE_CODE)\n  set(JERRY_LOGGING ON)\n\n  set(JERRYRE_LOGGING_MESSAGE \" (FORCED BY STATS OR DUMP)\")\nendif()\n\n# Status messages\nmessage(STATUS \"JERRY_CPOINTER_32_BIT          \" ${JERRY_CPOINTER_32_BIT} ${JERRY_CPOINTER_32_BIT_MESSAGE})\nmessage(STATUS \"JERRY_DEBUGGER                 \" ${JERRY_DEBUGGER})\nmessage(STATUS \"JERRY_ERROR_MESSAGES           \" ${JERRY_ERROR_MESSAGES})\nmessage(STATUS \"JERRY_EXTERNAL_CONTEXT         \" ${JERRY_EXTERNAL_CONTEXT})\nmessage(STATUS \"JERRY_PARSER                   \" ${JERRY_PARSER})\nmessage(STATUS \"JERRY_FUNCTION_TO_STRING       \" ${JERRY_FUNCTION_TO_STRING})\nmessage(STATUS \"JERRY_LINE_INFO                \" ${JERRY_LINE_INFO})\nmessage(STATUS \"JERRY_LOGGING                  \" ${JERRY_LOGGING} ${JERRY_LOGGING_MESSAGE})\nmessage(STATUS \"JERRY_MEM_STATS                \" ${JERRY_MEM_STATS})\nmessage(STATUS \"JERRY_MEM_GC_BEFORE_EACH_ALLOC \" ${JERRY_MEM_GC_BEFORE_EACH_ALLOC})\nmessage(STATUS \"JERRY_PARSER_DUMP_BYTE_CODE    \" ${JERRY_PARSER_DUMP_BYTE_CODE} ${JERRY_PARSER_DUMP_MESSAGE})\nmessage(STATUS \"JERRY_PROFILE                  \" ${JERRY_PROFILE})\nmessage(STATUS \"JERRY_PROMISE_CALLBACK         \" ${JERRY_PROMISE_CALLBACK})\nmessage(STATUS \"JERRY_REGEXP_STRICT_MODE       \" ${JERRY_REGEXP_STRICT_MODE})\nmessage(STATUS \"JERRY_REGEXP_DUMP_BYTE_CODE    \" ${JERRY_REGEXP_DUMP_BYTE_CODE})\nmessage(STATUS \"JERRY_SNAPSHOT_EXEC            \" ${JERRY_SNAPSHOT_EXEC} ${JERRY_SNAPSHOT_EXEC_MESSAGE})\nmessage(STATUS \"JERRY_SNAPSHOT_SAVE            \" ${JERRY_SNAPSHOT_SAVE} ${JERRY_SNAPSHOT_SAVE_MESSAGE})\nmessage(STATUS \"JERRY_SYSTEM_ALLOCATOR         \" ${JERRY_SYSTEM_ALLOCATOR})\nmessage(STATUS \"JERRY_VALGRIND                 \" ${JERRY_VALGRIND})\nmessage(STATUS \"JERRY_VM_HALT                  \" ${JERRY_VM_HALT})\nmessage(STATUS \"JERRY_VM_THROW                 \" ${JERRY_VM_THROW})\nmessage(STATUS \"JERRY_GLOBAL_HEAP_SIZE         \" ${JERRY_GLOBAL_HEAP_SIZE})\nmessage(STATUS \"JERRY_GC_LIMIT                 \" ${JERRY_GC_LIMIT})\nmessage(STATUS \"JERRY_STACK_LIMIT              \" ${JERRY_STACK_LIMIT})\nmessage(STATUS \"JERRY_GC_MARK_LIMIT            \" ${JERRY_GC_MARK_LIMIT})\n\n# Include directories\nset(INCLUDE_CORE_PUBLIC \"${CMAKE_CURRENT_SOURCE_DIR}/include\")\nset(INCLUDE_CORE_PRIVATE\n    \"${CMAKE_CURRENT_SOURCE_DIR}\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/api\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/debugger\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/ecma/base\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/ecma/builtin-objects\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/ecma/builtin-objects/typedarray\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/ecma/operations\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/jcontext\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/jmem\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/jrt\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/lit\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/parser/js\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/parser/regexp\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/vm\")\n\n# Third-party\n# Valgrind\nset(INCLUDE_THIRD_PARTY_VALGRIND \"${CMAKE_SOURCE_DIR}/third-party/valgrind\")\nif(JERRY_VALGRIND)\n  set(INCLUDE_CORE_PRIVATE ${INCLUDE_CORE_PRIVATE} ${INCLUDE_THIRD_PARTY_VALGRIND})\nendif()\n\nset(INCLUDE_CORE_PUBLIC ${INCLUDE_CORE_PUBLIC} PARENT_SCOPE) # for jerry-port\nset(INCLUDE_CORE_PRIVATE ${INCLUDE_CORE_PRIVATE} PARENT_SCOPE) # for tests/unit-core\n\n# Sources\n# Jerry core\nset(SOURCE_CORE_FILES\n  api/jerry-debugger-transport.c\n  api/jerry-debugger.c\n  api/jerry-module.c\n  api/jerry-snapshot.c\n  api/jerryscript.c\n  debugger/debugger.c\n  ecma/base/ecma-alloc.c\n  ecma/base/ecma-gc.c\n  ecma/base/ecma-errors.c\n  ecma/base/ecma-extended-info.c\n  ecma/base/ecma-helpers-collection.c\n  ecma/base/ecma-helpers-conversion.c\n  ecma/base/ecma-helpers-errol.c\n  ecma/base/ecma-helpers-external-pointers.c\n  ecma/base/ecma-helpers-number.c\n  ecma/base/ecma-helpers-string.c\n  ecma/base/ecma-helpers-value.c\n  ecma/base/ecma-helpers.c\n  ecma/base/ecma-init-finalize.c\n  ecma/base/ecma-lcache.c\n  ecma/base/ecma-line-info.c\n  ecma/base/ecma-literal-storage.c\n  ecma/base/ecma-module.c\n  ecma/base/ecma-property-hashmap.c\n  ecma/builtin-objects/ecma-builtin-aggregateerror.c\n  ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c\n  ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c\n  ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c\n  ecma/builtin-objects/ecma-builtin-array-prototype.c\n  ecma/builtin-objects/ecma-builtin-array.c\n  ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c\n  ecma/builtin-objects/ecma-builtin-arraybuffer.c\n  ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c\n  ecma/builtin-objects/ecma-builtin-async-function-prototype.c\n  ecma/builtin-objects/ecma-builtin-async-function.c\n  ecma/builtin-objects/ecma-builtin-async-generator-function.c\n  ecma/builtin-objects/ecma-builtin-async-generator-prototype.c\n  ecma/builtin-objects/ecma-builtin-async-generator.c\n  ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c\n  ecma/builtin-objects/ecma-builtin-atomics.c\n  ecma/builtin-objects/ecma-builtin-bigint-prototype.c\n  ecma/builtin-objects/ecma-builtin-bigint.c\n  ecma/builtin-objects/ecma-builtin-boolean-prototype.c\n  ecma/builtin-objects/ecma-builtin-boolean.c\n  ecma/builtin-objects/ecma-builtin-dataview-prototype.c\n  ecma/builtin-objects/ecma-builtin-dataview.c\n  ecma/builtin-objects/ecma-builtin-date-prototype.c\n  ecma/builtin-objects/ecma-builtin-date.c\n  ecma/builtin-objects/ecma-builtin-error-prototype.c\n  ecma/builtin-objects/ecma-builtin-error.c\n  ecma/builtin-objects/ecma-builtin-evalerror-prototype.c\n  ecma/builtin-objects/ecma-builtin-evalerror.c\n  ecma/builtin-objects/ecma-builtin-function-prototype.c\n  ecma/builtin-objects/ecma-builtin-function.c\n  ecma/builtin-objects/ecma-builtin-generator-function.c\n  ecma/builtin-objects/ecma-builtin-generator-prototype.c\n  ecma/builtin-objects/ecma-builtin-generator.c\n  ecma/builtin-objects/ecma-builtin-global.c\n  ecma/builtin-objects/ecma-builtin-handlers.c\n  ecma/builtin-objects/ecma-builtin-helpers-date.c\n  ecma/builtin-objects/ecma-builtin-helpers-error.c\n  ecma/builtin-objects/ecma-builtin-helpers-json.c\n  ecma/builtin-objects/ecma-builtin-helpers-sort.c\n  ecma/builtin-objects/ecma-builtin-helpers.c\n  ecma/builtin-objects/ecma-builtin-intrinsic.c\n  ecma/builtin-objects/ecma-builtin-iterator-prototype.c\n  ecma/builtin-objects/ecma-builtin-json.c\n  ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c\n  ecma/builtin-objects/ecma-builtin-map-prototype.c\n  ecma/builtin-objects/ecma-builtin-map.c\n  ecma/builtin-objects/ecma-builtin-math.c\n  ecma/builtin-objects/ecma-builtin-number-prototype.c\n  ecma/builtin-objects/ecma-builtin-number.c\n  ecma/builtin-objects/ecma-builtin-object-prototype.c\n  ecma/builtin-objects/ecma-builtin-object.c\n  ecma/builtin-objects/ecma-builtin-promise-prototype.c\n  ecma/builtin-objects/ecma-builtin-promise.c\n  ecma/builtin-objects/ecma-builtin-proxy.c\n  ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c\n  ecma/builtin-objects/ecma-builtin-rangeerror.c\n  ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c\n  ecma/builtin-objects/ecma-builtin-referenceerror.c\n  ecma/builtin-objects/ecma-builtin-reflect.c\n  ecma/builtin-objects/ecma-builtin-regexp-prototype.c\n  ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c\n  ecma/builtin-objects/ecma-builtin-regexp.c\n  ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c\n  ecma/builtin-objects/ecma-builtin-set-prototype.c\n  ecma/builtin-objects/ecma-builtin-set.c\n  ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c\n  ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c\n  ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c\n  ecma/builtin-objects/ecma-builtin-string-prototype.c\n  ecma/builtin-objects/ecma-builtin-string.c\n  ecma/builtin-objects/ecma-builtin-symbol-prototype.c\n  ecma/builtin-objects/ecma-builtin-symbol.c\n  ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c\n  ecma/builtin-objects/ecma-builtin-syntaxerror.c\n  ecma/builtin-objects/ecma-builtin-type-error-thrower.c\n  ecma/builtin-objects/ecma-builtin-typeerror-prototype.c\n  ecma/builtin-objects/ecma-builtin-typeerror.c\n  ecma/builtin-objects/ecma-builtin-urierror-prototype.c\n  ecma/builtin-objects/ecma-builtin-urierror.c\n  ecma/builtin-objects/ecma-builtin-weakmap-prototype.c\n  ecma/builtin-objects/ecma-builtin-weakmap.c\n  ecma/builtin-objects/ecma-builtin-weakref-prototype.c\n  ecma/builtin-objects/ecma-builtin-weakref.c\n  ecma/builtin-objects/ecma-builtin-weakset-prototype.c\n  ecma/builtin-objects/ecma-builtin-weakset.c\n  ecma/builtin-objects/ecma-builtins.c\n  ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c\n  ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c\n  ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-float32array.c\n  ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-float64array.c\n  ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-int16array.c\n  ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-int32array.c\n  ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-int8array.c\n  ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c\n  ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c\n  ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c\n  ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c\n  ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c\n  ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c\n  ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c\n  ecma/operations/ecma-arguments-object.c\n  ecma/operations/ecma-array-object.c\n  ecma/operations/ecma-arraybuffer-object.c\n  ecma/operations/ecma-async-generator-object.c\n  ecma/operations/ecma-atomics-object.c\n  ecma/operations/ecma-big-uint.c\n  ecma/operations/ecma-bigint-object.c\n  ecma/operations/ecma-bigint.c\n  ecma/operations/ecma-boolean-object.c\n  ecma/operations/ecma-comparison.c\n  ecma/operations/ecma-container-object.c\n  ecma/operations/ecma-conversion.c\n  ecma/operations/ecma-dataview-object.c\n  ecma/operations/ecma-eval.c\n  ecma/operations/ecma-exceptions.c\n  ecma/operations/ecma-function-object.c\n  ecma/operations/ecma-get-put-value.c\n  ecma/operations/ecma-iterator-object.c\n  ecma/operations/ecma-jobqueue.c\n  ecma/operations/ecma-lex-env.c\n  ecma/operations/ecma-number-object.c\n  ecma/operations/ecma-objects-general.c\n  ecma/operations/ecma-objects.c\n  ecma/operations/ecma-promise-object.c\n  ecma/operations/ecma-proxy-object.c\n  ecma/operations/ecma-reference.c\n  ecma/operations/ecma-regexp-object.c\n  ecma/operations/ecma-shared-arraybuffer-object.c\n  ecma/operations/ecma-string-object.c\n  ecma/operations/ecma-symbol-object.c\n  ecma/operations/ecma-typedarray-object.c\n  jcontext/jcontext.c\n  jmem/jmem-allocator.c\n  jmem/jmem-heap.c\n  jmem/jmem-poolman.c\n  jrt/jrt-fatals.c\n  jrt/jrt-logging.c\n  lit/lit-char-helpers.c\n  lit/lit-magic-strings.c\n  lit/lit-strings.c\n  parser/js/byte-code.c\n  parser/js/common.c\n  parser/js/js-lexer.c\n  parser/js/js-parser-expr.c\n  parser/js/js-parser-line-info-create.c\n  parser/js/js-parser-mem.c\n  parser/js/js-parser-module.c\n  parser/js/js-parser-statm.c\n  parser/js/js-parser-tagged-template-literal.c\n  parser/js/js-parser-util.c\n  parser/js/js-parser.c\n  parser/js/js-scanner-ops.c\n  parser/js/js-scanner-util.c\n  parser/js/js-scanner.c\n  parser/js/parser-errors.c\n  parser/regexp/re-bytecode.c\n  parser/regexp/re-compiler.c\n  parser/regexp/re-parser.c\n  vm/opcodes-ecma-arithmetics.c\n  vm/opcodes-ecma-bitwise.c\n  vm/opcodes-ecma-relational-equality.c\n  vm/opcodes.c\n  vm/vm-stack.c\n  vm/vm-utils.c\n  vm/vm.c\n)\n\n# Amalgamated JerryScript source/header build.\n#  The process will create the following files:\n#   * jerryscript.c\n#   * jerryscript.h\n#   * jerryscript-config.h\nif(ENABLE_AMALGAM)\n\n  # Create single C/H file\n  set(HEADER_CORE_FILES\n    api/jerry-snapshot.h\n    debugger/debugger.h\n    ecma/base/ecma-alloc.h\n    ecma/base/ecma-error-messages.inc.h\n    ecma/base/ecma-errors.h\n    ecma/base/ecma-gc.h\n    ecma/base/ecma-globals.h\n    ecma/base/ecma-helpers.h\n    ecma/base/ecma-init-finalize.h\n    ecma/base/ecma-lcache.h\n    ecma/base/ecma-line-info.h\n    ecma/base/ecma-literal-storage.h\n    ecma/base/ecma-module.h\n    ecma/base/ecma-property-hashmap.h\n    ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h\n    ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h\n    ecma/builtin-objects/ecma-builtin-array-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-array.inc.h\n    ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h\n    ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-async-function.inc.h\n    ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h\n    ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-async-generator.inc.h\n    ecma/builtin-objects/ecma-builtin-async-iterator-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-atomics.inc.h\n    ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-bigint.inc.h\n    ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-boolean.inc.h\n    ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-dataview.inc.h\n    ecma/builtin-objects/ecma-builtin-date-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-date.inc.h\n    ecma/builtin-objects/ecma-builtin-error-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-error.inc.h\n    ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-evalerror.inc.h\n    ecma/builtin-objects/ecma-builtin-function-prototype.h\n    ecma/builtin-objects/ecma-builtin-function-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-function.inc.h\n    ecma/builtin-objects/ecma-builtin-generator-function.inc.h\n    ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-generator.inc.h\n    ecma/builtin-objects/ecma-builtin-global.inc.h\n    ecma/builtin-objects/ecma-builtin-handlers.h\n    ecma/builtin-objects/ecma-builtin-handlers.inc.h\n    ecma/builtin-objects/ecma-builtin-helpers-macro-defines.inc.h\n    ecma/builtin-objects/ecma-builtin-helpers-macro-undefs.inc.h\n    ecma/builtin-objects/ecma-builtin-helpers.h\n    ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h\n    ecma/builtin-objects/ecma-builtin-intrinsic.inc.h\n    ecma/builtin-objects/ecma-builtin-iterator-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-json.inc.h\n    ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-map-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-map.inc.h\n    ecma/builtin-objects/ecma-builtin-math.inc.h\n    ecma/builtin-objects/ecma-builtin-number-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-number.inc.h\n    ecma/builtin-objects/ecma-builtin-object-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-object.h\n    ecma/builtin-objects/ecma-builtin-object.inc.h\n    ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-promise.inc.h\n    ecma/builtin-objects/ecma-builtin-proxy.inc.h\n    ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-rangeerror.inc.h\n    ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-referenceerror.inc.h\n    ecma/builtin-objects/ecma-builtin-reflect.inc.h\n    ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-regexp.inc.h\n    ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-set-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-set.inc.h\n    ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h\n    ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-string-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-string.inc.h\n    ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-symbol.inc.h\n    ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h\n    ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h\n    ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-typeerror.inc.h\n    ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-urierror.inc.h\n    ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-weakmap.inc.h\n    ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-weakref.inc.h\n    ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h\n    ecma/builtin-objects/ecma-builtin-weakset.inc.h\n    ecma/builtin-objects/ecma-builtins-internal.h\n    ecma/builtin-objects/ecma-builtins.h\n    ecma/builtin-objects/ecma-builtins.inc.h\n    ecma/operations/ecma-arguments-object.h\n    ecma/operations/ecma-array-object.h\n    ecma/operations/ecma-arraybuffer-object.h\n    ecma/operations/ecma-async-generator-object.h\n    ecma/operations/ecma-atomics-object.h\n    ecma/operations/ecma-big-uint.h\n    ecma/operations/ecma-bigint-object.h\n    ecma/operations/ecma-bigint.h\n    ecma/operations/ecma-boolean-object.h\n    ecma/operations/ecma-comparison.h\n    ecma/operations/ecma-container-object.h\n    ecma/operations/ecma-conversion.h\n    ecma/operations/ecma-dataview-object.h\n    ecma/operations/ecma-eval.h\n    ecma/operations/ecma-exceptions.h\n    ecma/operations/ecma-function-object.h\n    ecma/operations/ecma-iterator-object.h\n    ecma/operations/ecma-jobqueue.h\n    ecma/operations/ecma-lex-env.h\n    ecma/operations/ecma-number-object.h\n    ecma/operations/ecma-objects-general.h\n    ecma/operations/ecma-objects.h\n    ecma/operations/ecma-promise-object.h\n    ecma/operations/ecma-proxy-object.h\n    ecma/operations/ecma-reference.h\n    ecma/operations/ecma-regexp-object.h\n    ecma/operations/ecma-shared-arraybuffer-object.h\n    ecma/operations/ecma-string-object.h\n    ecma/operations/ecma-symbol-object.h\n    ecma/operations/ecma-typedarray-object.h\n    include/jerryscript-compiler.h\n    include/jerryscript-core.h\n    include/jerryscript-debugger-transport.h\n    include/jerryscript-debugger.h\n    include/jerryscript-port.h\n    include/jerryscript-snapshot.h\n    include/jerryscript.h\n    jcontext/jcontext.h\n    jmem/jmem-allocator-internal.h\n    jmem/jmem.h\n    jrt/jrt-bit-fields.h\n    jrt/jrt-libc-includes.h\n    jrt/jrt-types.h\n    jrt/jrt.h\n    lit/lit-char-helpers.h\n    lit/lit-globals.h\n    lit/lit-magic-strings.h\n    lit/lit-magic-strings.inc.h\n    lit/lit-strings.h\n    lit/lit-unicode-conversions-sup.inc.h\n    lit/lit-unicode-conversions.inc.h\n    lit/lit-unicode-folding.inc.h\n    lit/lit-unicode-ranges-sup.inc.h\n    lit/lit-unicode-ranges.inc.h\n    vm/opcodes.h\n    vm/vm-defines.h\n    vm/vm-stack.h\n    vm/vm.h\n  )\n\n  # Generated files\n  set(AMALGAM_CORE_C \"${CMAKE_BINARY_DIR}/amalgam/jerryscript.c\")\n  set(AMALGAM_CORE_H \"${CMAKE_BINARY_DIR}/amalgam/jerryscript.h\")\n  set(AMALGAM_CONFIG_H \"${CMAKE_BINARY_DIR}/amalgam/jerryscript-config.h\")\n\n  add_custom_command(OUTPUT ${AMALGAM_CORE_C} ${AMALGAM_CORE_H}\n                     COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/tools/amalgam.py\n                             --jerry-core\n                             --output-dir ${CMAKE_BINARY_DIR}/amalgam\n                     DEPENDS ${SOURCE_CORE_FILES}\n                             ${HEADER_CORE_FILES}\n                             ${CMAKE_SOURCE_DIR}/tools/amalgam.py\n  )\n\n  # The \"true\" jerryscript-config.h will be generated by the configure_file below,\n  # which contains the default options and the ones passed for the CMake.\n  # The input for this is the jerryscript-config.h generated by the command above.\n  set(JERRYSCRIPT_GEN_CONFIG_H ${CMAKE_CURRENT_BINARY_DIR}/jerryscript-config.h)\n  add_custom_command(OUTPUT ${AMALGAM_CONFIG_H}\n                     COMMAND ${CMAKE_COMMAND} -E copy ${JERRYSCRIPT_GEN_CONFIG_H} ${AMALGAM_CONFIG_H}\n                     DEPENDS ${AMALGAM_CORE_C} ${AMALGAM_CORE_H})\n  add_custom_target(amalgam-jerry DEPENDS ${AMALGAM_CORE_C} ${AMALGAM_CORE_H} ${AMALGAM_CONFIG_H})\n  add_dependencies(amalgam amalgam-jerry)\n\n  set(SOURCE_CORE_FILES ${AMALGAM_CORE_C} ${AMALGAM_CORE_H} ${AMALGAM_CONFIG_H})\n  set(INCLUDE_CORE_PUBLIC PARENT_SCOPE)\n  set(INCLUDE_CORE_PRIVATE PARENT_SCOPE)\nendif()\n\n# build mode specific compile/link flags\nset(DEFINES_JERRY ${DEFINES_JERRY} $<$<NOT:$<CONFIG:Debug>>:JERRY_NDEBUG>)\n\n# Jerry heap-section\nif(DEFINED JERRY_ATTR_GLOBAL_HEAP)\n  set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ATTR_GLOBAL_HEAP=${JERRY_ATTR_GLOBAL_HEAP})\nendif()\n\n# Memory usage limit for triggering garbage collection\nif(JERRY_GC_LIMIT)\n  set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_GC_LIMIT=${JERRY_GC_LIMIT})\nendif()\n\n# Helper macro to set 0/1 switch as Jerry Defines\nmacro(jerry_add_define01 NAME)\n  if(${NAME})\n    set(DEFINES_JERRY ${DEFINES_JERRY} ${NAME}=1)\n  else()\n    set(DEFINES_JERRY ${DEFINES_JERRY} ${NAME}=0)\n  endif()\nendmacro(jerry_add_define01)\n\n# Checks the optional features\n# Enable 32 bit cpointers\njerry_add_define01(JERRY_CPOINTER_32_BIT)\n\n# Fill error messages for builtin error objects\njerry_add_define01(JERRY_ERROR_MESSAGES)\n\n# Use external context instead of static one\njerry_add_define01(JERRY_EXTERNAL_CONTEXT)\n\n# JS-Parser\njerry_add_define01(JERRY_PARSER)\n\n# JS function toString\njerry_add_define01(JERRY_FUNCTION_TO_STRING)\n\n# JS line info\njerry_add_define01(JERRY_LINE_INFO)\n\n# Logging\njerry_add_define01(JERRY_LOGGING)\n\n# Memory statistics\njerry_add_define01(JERRY_MEM_STATS)\n\n# Enable debugger\njerry_add_define01(JERRY_DEBUGGER)\n\n# Memory management stress-test mode\njerry_add_define01(JERRY_MEM_GC_BEFORE_EACH_ALLOC)\n\n# Parser byte-code dumps\njerry_add_define01(JERRY_PARSER_DUMP_BYTE_CODE)\n\n# Profile\nif (${JERRY_PROFILE} STREQUAL \"es2015-subset\")\n  message(DEPRECATION \"'es2015-subset' profile is deprecated, please use 'es.next' instead.\")\nendif()\n\nif (NOT IS_ABSOLUTE ${JERRY_PROFILE})\n  set(JERRY_PROFILE \"${CMAKE_CURRENT_SOURCE_DIR}/profiles/${JERRY_PROFILE}.profile\")\nendif()\n\nif(EXISTS ${JERRY_PROFILE})\n  file(READ \"${JERRY_PROFILE}\" PROFILE_SETTINGS)\n  string(REGEX REPLACE \"[ \\t]*#[^\\n]*\" \"\" PROFILE_SETTINGS \"${PROFILE_SETTINGS}\")\n  string(REGEX REPLACE \"[\\r\\n]\" \";\" PROFILE_SETTINGS \"${PROFILE_SETTINGS}\")\n\n  # Process entries and save them as CMake variables.\n  # This is required to correctly generate the jerryscript-config.h file.\n  foreach(PROFILE_ENTRY ${PROFILE_SETTINGS})\n    string(REPLACE \"=\" \";\" PROFILE_ENTRY \"${PROFILE_ENTRY}\")\n    list(GET PROFILE_ENTRY 0 PROFILE_KEY)\n    list(GET PROFILE_ENTRY 1 PROFILE_VALUE)\n    set(${PROFILE_KEY} ${PROFILE_VALUE})\n  endforeach()\n\n  set(DEFINES_JERRY ${DEFINES_JERRY} ${PROFILE_SETTINGS})\nelse()\n  message(FATAL_ERROR \"Profile file: '${JERRY_PROFILE}' doesn't exist!\")\nendif()\n\n# Promise callback\njerry_add_define01(JERRY_PROMISE_CALLBACK)\n\n# RegExp strict mode\njerry_add_define01(JERRY_REGEXP_STRICT_MODE)\n\n# RegExp byte-code dumps\njerry_add_define01(JERRY_REGEXP_DUMP_BYTE_CODE)\n\n# Snapshot exec\njerry_add_define01(JERRY_SNAPSHOT_EXEC)\n\n# Snapshot save\njerry_add_define01(JERRY_SNAPSHOT_SAVE)\n\n# Enable system allocator\njerry_add_define01(JERRY_SYSTEM_ALLOCATOR)\n\n# Valgrind\njerry_add_define01(JERRY_VALGRIND)\n\n# Enable VM execution stop callback\njerry_add_define01(JERRY_VM_HALT)\n\n# Enable VM throw callback\njerry_add_define01(JERRY_VM_THROW)\n\n# Size of heap\nset(DEFINES_JERRY ${DEFINES_JERRY} JERRY_GLOBAL_HEAP_SIZE=${JERRY_GLOBAL_HEAP_SIZE})\n\n# Maximum size of stack memory usage\nset(DEFINES_JERRY ${DEFINES_JERRY} JERRY_STACK_LIMIT=${JERRY_STACK_LIMIT})\n\n# Maximum depth of recursion during GC mark phase\nset(DEFINES_JERRY ${DEFINES_JERRY} JERRY_GC_MARK_LIMIT=${JERRY_GC_MARK_LIMIT})\n\n## This function is to read \"config.h\" for default values\nfunction(read_set_defines FILE PREFIX OUTPUTVAR)\n  file(READ \"${CMAKE_CURRENT_SOURCE_DIR}/${FILE}\" INPUT_FILE_CONTENTS)\n\n  # match all \"#define <PREFIX>\\n\" lines\n  # notes:\n  #  * before the \"#\" there must be a newline and any number of spaces.\n  #  * after the \"#\" there can be any number of spaces.\n  string(REGEX MATCHALL \"\\r?\\n[ ]*#[ ]*define ${PREFIX}[^\\n]*\"\n         RAW_DEFINES \"${INPUT_FILE_CONTENTS}\")\n\n  set(SELECTED_VARS )\n\n  # Transform the defines to a list of (<name>; <value>; <name 2>; <value 2>; ...) list\n  foreach(DEFINE_ENTRY ${RAW_DEFINES})\n    # by default every define value is empty\n    set(DEFINE_VALUE \" \")\n\n    # split up the define at the space between the define name and value (if there is any)\n\n    # first remove \"#define\" part of the string\n    string(REGEX REPLACE \"\\r?\\n[ ]*#[ ]*define[ ]+\" \"\" DEFINE_KEY_VALUE \"${DEFINE_ENTRY}\")\n    string(FIND \"${DEFINE_KEY_VALUE}\" \" \" DEFINE_KEY_IDX)\n    string(LENGTH \"${DEFINE_KEY_VALUE}\" DEFINE_LENGTH)\n\n    if (DEFINE_KEY_IDX EQUAL \"-1\")\n        set(DEFINE_KEY ${DEFINE_KEY_VALUE})\n    else()\n        string(SUBSTRING \"${DEFINE_KEY_VALUE}\" 0 ${DEFINE_KEY_IDX} DEFINE_KEY)\n        string(SUBSTRING \"${DEFINE_KEY_VALUE}\" ${DEFINE_KEY_IDX} -1 DEFINE_VALUE)\n        string(STRIP \"${DEFINE_VALUE}\" DEFINE_VALUE)\n    endif()\n\n    list(APPEND SELECTED_VARS ${DEFINE_KEY} ${DEFINE_VALUE})\n  endforeach()\n\n  set(${OUTPUTVAR} ${SELECTED_VARS} PARENT_SCOPE)\nendfunction(read_set_defines)\n\n# CONFIG_DEFAULTS contains define name and values which have the JERRY_ prefix\n# as a list of (<name>; <value>; <name 2>; <value 2>; ...)\nread_set_defines(\"config.h\" JERRY_ CONFIG_DEFAULTS)\n\n\n## Process the default values and build options to generate build config defines\nlist(LENGTH CONFIG_DEFAULTS CONFIG_DEFAULT_LENGTH)\nmath(EXPR CONFIG_DEFAULT_LENGTH \"${CONFIG_DEFAULT_LENGTH} - 1\")\n\nset(JERRY_MODIFIED_OPTIONS)\nforeach(CONFIG_IDX RANGE 0 ${CONFIG_DEFAULT_LENGTH} 2)\n  list(GET CONFIG_DEFAULTS ${CONFIG_IDX} KEY)\n  math(EXPR VALUE_IDX \"${CONFIG_IDX} + 1\")\n  list(GET CONFIG_DEFAULTS ${VALUE_IDX} VALUE)\n\n  # ${KEY} is the value for the given variable (aka define)\n  # normalize ON/OFF cmake values to 1/0 for easier processing.\n  if(${KEY} STREQUAL \"ON\")\n    set(${KEY} 1)\n  elseif(${KEY} STREQUAL \"OFF\")\n    set(${KEY} 0)\n  endif()\n\n  # Generate \"#define JERRY_<CONFIG> <CONFIG_VALUE>\" entries if it is different from\n  # the config default.\n\n  # If the define loaded from the config file have a different value than the\n  # relevant option passed for the CMake means that it does not have a default value.\n  if(DEFINED ${KEY} AND NOT (${KEY} STREQUAL ${VALUE}))\n    set(JERRY_MODIFIED_OPTIONS \"${JERRY_MODIFIED_OPTIONS}#define ${KEY} ${${KEY}}\\n\")\n  endif()\nendforeach()\n\n# Generate the jerryscript-config.h file into the build directory\n# This file will contain the options different from the default (aka it's the build config).\nif(JERRY_MODIFIED_OPTIONS)\n  set(JERRY_BUILD_CFG\n      \"Generated differences from default by CMake based on build options:\\n${JERRY_MODIFIED_OPTIONS}\")\nelse()\n  set(JERRY_BUILD_CFG \"JerryScript configuration\")\nendif()\nconfigure_file(config.h jerryscript-config.h @ONLY)\n\nadd_library(${JERRY_CORE_NAME} ${SOURCE_CORE_FILES})\n\ntarget_compile_definitions(${JERRY_CORE_NAME} PUBLIC ${DEFINES_JERRY})\ntarget_include_directories(${JERRY_CORE_NAME} PUBLIC ${INCLUDE_CORE_PUBLIC})\ntarget_include_directories(${JERRY_CORE_NAME} PRIVATE ${INCLUDE_CORE_PRIVATE})\nadd_dependencies(${JERRY_CORE_NAME} amalgam)\n\nset(JERRY_CORE_PKGCONFIG_REQUIRES)\nset(JERRY_CORE_PKGCONFIG_LIBS)\nset(JERRY_CORE_PKGCONFIG_CFLAGS)\n\nif(ENABLE_LTO)\n  set(JERRY_CORE_PKGCONFIG_CFLAGS \"${JERRY_CORE_PKGCONFIG_CFLAGS} -flto\")\nendif()\n\nif(JERRY_MATH)\n  target_link_libraries(${JERRY_CORE_NAME} jerry-math)\n  set(JERRY_CORE_PKGCONFIG_REQUIRES libjerry-math)\nelse()\n  if(USING_GCC OR USING_CLANG)\n    set(CMAKE_REQUIRED_FLAGS \"-Wno-error -Wno-error=strict-prototypes\")\n  endif()\n  check_library_exists(m sin \"\" HAVE_M_LIB)\n  if(HAVE_M_LIB)\n    target_link_libraries(${JERRY_CORE_NAME} m)\n    set(JERRY_CORE_PKGCONFIG_LIBS \"${JERRY_CORE_PKGCONFIG_LIBS} -lm\")\n  endif()\nendif()\n\nseparate_arguments(EXTERNAL_LINK_LIBS)\nforeach(EXT_LIB ${EXTERNAL_LINK_LIBS})\n  target_link_libraries(${JERRY_CORE_NAME} ${EXT_LIB})\n  set(JERRY_CORE_PKGCONFIG_LIBS \"${JERRY_CORE_PKGCONFIG_LIBS} -l${EXT_LIB}\")\nendforeach()\n\nconfigure_file(libjerry-core.pc.in libjerry-core.pc @ONLY)\n\ninstall(TARGETS ${JERRY_CORE_NAME} DESTINATION lib)\ninstall(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjerry-core.pc DESTINATION lib/pkgconfig)\ninstall(FILES ${CMAKE_CURRENT_BINARY_DIR}/jerryscript-config.h DESTINATION include)\ninstall(DIRECTORY ${INCLUDE_CORE_PUBLIC}/ DESTINATION include)\n"
  },
  {
    "path": "jerry-core/api/jerry-debugger-transport.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"debugger.h\"\n#include \"jcontext.h\"\n\n#if JERRY_DEBUGGER\n\n/**\n * Minimum number of bytes transmitted or received.\n */\n#define JERRY_DEBUGGER_TRANSPORT_MIN_BUFFER_SIZE 64\n\n/**\n * Sleep time in milliseconds between each jerry_debugger_receive call\n */\n#define JERRY_DEBUGGER_TRANSPORT_TIMEOUT 100\n\n/**\n * Add a new transport layer.\n */\nvoid\njerry_debugger_transport_add (jerry_debugger_transport_header_t *header_p, /**< transport implementation */\n                              size_t send_message_header_size, /**< header bytes reserved for outgoing messages */\n                              size_t max_send_message_size, /**< maximum number of bytes transmitted in a message */\n                              size_t receive_message_header_size, /**< header bytes reserved for incoming messages */\n                              size_t max_receive_message_size) /**< maximum number of bytes received in a message */\n{\n  JERRY_ASSERT (max_send_message_size > JERRY_DEBUGGER_TRANSPORT_MIN_BUFFER_SIZE\n                && max_receive_message_size > JERRY_DEBUGGER_TRANSPORT_MIN_BUFFER_SIZE);\n\n  header_p->next_p = JERRY_CONTEXT (debugger_transport_header_p);\n  JERRY_CONTEXT (debugger_transport_header_p) = header_p;\n\n  uint8_t *payload_p;\n  size_t max_send_size;\n  size_t max_receive_size;\n\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    payload_p = JERRY_CONTEXT (debugger_send_buffer_payload_p);\n    max_send_size = JERRY_CONTEXT (debugger_max_send_size);\n    max_receive_size = JERRY_CONTEXT (debugger_max_receive_size);\n  }\n  else\n  {\n    JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_CONNECTED);\n    payload_p = JERRY_CONTEXT (debugger_send_buffer);\n    max_send_size = JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE;\n    max_receive_size = JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE;\n  }\n\n  JERRY_ASSERT (max_send_size > JERRY_DEBUGGER_TRANSPORT_MIN_BUFFER_SIZE + send_message_header_size);\n  JERRY_ASSERT (max_receive_size > JERRY_DEBUGGER_TRANSPORT_MIN_BUFFER_SIZE + receive_message_header_size);\n\n  JERRY_CONTEXT (debugger_send_buffer_payload_p) = payload_p + send_message_header_size;\n\n  max_send_size = max_send_size - send_message_header_size;\n  max_receive_size = max_receive_size - receive_message_header_size;\n\n  if (max_send_size > max_send_message_size)\n  {\n    max_send_size = max_send_message_size;\n  }\n\n  if (max_receive_size > max_receive_message_size)\n  {\n    max_receive_size = max_receive_message_size;\n  }\n\n  JERRY_CONTEXT (debugger_max_send_size) = (uint8_t) max_send_size;\n  JERRY_CONTEXT (debugger_max_receive_size) = (uint8_t) max_receive_size;\n} /* jerry_debugger_transport_add */\n\n/**\n * Starts the communication to the debugger client.\n * Must be called after the connection is successfully established.\n */\nvoid\njerry_debugger_transport_start (void)\n{\n  JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n\n  if (jerry_debugger_send_configuration (JERRY_CONTEXT (debugger_max_receive_size)))\n  {\n    JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_STOP);\n    JERRY_CONTEXT (debugger_stop_context) = NULL;\n  }\n} /* jerry_debugger_transport_start */\n\n/**\n * Returns true if a debugger client is connected.\n *\n * @return true - a debugger client is connected,\n *         false - otherwise\n */\nbool\njerry_debugger_transport_is_connected (void)\n{\n  return (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) != 0;\n} /* jerry_debugger_transport_is_connected */\n\n/**\n * Notifies the debugger server that the connection is closed.\n */\nvoid\njerry_debugger_transport_close (void)\n{\n  if (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED))\n  {\n    return;\n  }\n\n  JERRY_CONTEXT (debugger_flags) = JERRY_DEBUGGER_VM_IGNORE;\n\n  jerry_debugger_transport_header_t *current_p = JERRY_CONTEXT (debugger_transport_header_p);\n\n  JERRY_ASSERT (current_p != NULL);\n\n  do\n  {\n    jerry_debugger_transport_header_t *next_p = current_p->next_p;\n\n    current_p->close (current_p);\n\n    current_p = next_p;\n  } while (current_p != NULL);\n\n  jerry_log (JERRY_LOG_LEVEL_DEBUG, \"Debugger client connection closed.\\n\");\n\n  jerry_debugger_free_unreferenced_byte_code ();\n} /* jerry_debugger_transport_close */\n\n/**\n * Send data over the current connection\n *\n * @return true - data sent successfully,\n *         false - connection closed\n */\nbool\njerry_debugger_transport_send (const uint8_t *message_p, /**< message to be sent */\n                               size_t message_length) /**< message length in bytes */\n{\n  JERRY_ASSERT (jerry_debugger_transport_is_connected ());\n  JERRY_ASSERT (message_length > 0);\n\n  jerry_debugger_transport_header_t *header_p = JERRY_CONTEXT (debugger_transport_header_p);\n  uint8_t *payload_p = JERRY_CONTEXT (debugger_send_buffer_payload_p);\n  size_t max_send_size = JERRY_CONTEXT (debugger_max_send_size);\n\n  do\n  {\n    size_t fragment_length = (message_length <= max_send_size ? message_length : max_send_size);\n\n    memcpy (payload_p, message_p, fragment_length);\n\n    if (!header_p->send (header_p, payload_p, fragment_length))\n    {\n      return false;\n    }\n\n    message_p += fragment_length;\n    message_length -= fragment_length;\n  } while (message_length > 0);\n\n  return true;\n} /* jerry_debugger_transport_send */\n\n/**\n * Receive data from the current connection\n *\n * Note:\n *   A message is received if message_start_p is not NULL\n *\n * @return true - function successfully completed,\n *         false - connection closed\n */\nbool\njerry_debugger_transport_receive (jerry_debugger_transport_receive_context_t *context_p) /**< [out] receive\n                                                                                          *   context */\n{\n  JERRY_ASSERT (jerry_debugger_transport_is_connected ());\n\n  context_p->buffer_p = JERRY_CONTEXT (debugger_receive_buffer);\n  context_p->received_length = JERRY_CONTEXT (debugger_received_length);\n  context_p->message_p = NULL;\n  context_p->message_length = 0;\n  context_p->message_total_length = 0;\n\n  jerry_debugger_transport_header_t *header_p = JERRY_CONTEXT (debugger_transport_header_p);\n\n  return header_p->receive (header_p, context_p);\n} /* jerry_debugger_transport_receive */\n\n/**\n * Clear the message buffer after the message is processed\n */\nvoid\njerry_debugger_transport_receive_completed (jerry_debugger_transport_receive_context_t *context_p) /**< receive\n                                                                                                    *   context */\n{\n  JERRY_ASSERT (context_p->message_p != NULL);\n  JERRY_ASSERT (context_p->buffer_p == JERRY_CONTEXT (debugger_receive_buffer));\n\n  size_t message_total_length = context_p->message_total_length;\n  size_t received_length = context_p->received_length;\n\n  JERRY_ASSERT (message_total_length <= received_length);\n\n  if (message_total_length == 0 || message_total_length == received_length)\n  {\n    /* All received data is processed. */\n    JERRY_CONTEXT (debugger_received_length) = 0;\n    return;\n  }\n\n  uint8_t *buffer_p = context_p->buffer_p;\n  received_length -= message_total_length;\n\n  memmove (buffer_p, buffer_p + message_total_length, received_length);\n\n  JERRY_CONTEXT (debugger_received_length) = (uint16_t) received_length;\n} /* jerry_debugger_transport_receive_completed */\n\n/**\n * Suspend execution for a predefined time (JERRY_DEBUGGER_TRANSPORT_TIMEOUT ms).\n */\nvoid\njerry_debugger_transport_sleep (void)\n{\n  jerry_port_sleep (JERRY_DEBUGGER_TRANSPORT_TIMEOUT);\n} /* jerry_debugger_transport_sleep */\n\n#endif /* JERRY_DEBUGGER */\n"
  },
  {
    "path": "jerry-core/api/jerry-debugger.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"debugger.h\"\n#include \"jcontext.h\"\n\n/**\n * Checks whether the debugger is connected.\n *\n * @return true - if the debugger is connected\n *         false - otherwise\n */\nbool\njerry_debugger_is_connected (void)\n{\n#if JERRY_DEBUGGER\n  return JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED;\n#else /* !JERRY_DEBUGGER */\n  return false;\n#endif /* JERRY_DEBUGGER */\n} /* jerry_debugger_is_connected */\n\n/**\n * Stop execution at the next available breakpoint.\n */\nvoid\njerry_debugger_stop (void)\n{\n#if JERRY_DEBUGGER\n  if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n      && !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))\n  {\n    JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_STOP);\n    JERRY_CONTEXT (debugger_stop_context) = NULL;\n  }\n#endif /* JERRY_DEBUGGER */\n} /* jerry_debugger_stop */\n\n/**\n * Continue execution.\n */\nvoid\njerry_debugger_continue (void)\n{\n#if JERRY_DEBUGGER\n  if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n      && !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))\n  {\n    JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_STOP);\n    JERRY_CONTEXT (debugger_stop_context) = NULL;\n  }\n#endif /* JERRY_DEBUGGER */\n} /* jerry_debugger_continue */\n\n/**\n * Sets whether the engine should stop at breakpoints.\n */\nvoid\njerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint) /**< enable/disable stop at breakpoint */\n{\n#if JERRY_DEBUGGER\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED\n      && !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))\n  {\n    if (enable_stop_at_breakpoint)\n    {\n      JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_IGNORE);\n    }\n    else\n    {\n      JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_IGNORE);\n    }\n  }\n#else /* !JERRY_DEBUGGER */\n  JERRY_UNUSED (enable_stop_at_breakpoint);\n#endif /* JERRY_DEBUGGER */\n} /* jerry_debugger_stop_at_breakpoint */\n\n/**\n * Sets whether the engine should wait and run a source.\n *\n * @return enum JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED - if the source is not received\n *              JERRY_DEBUGGER_SOURCE_RECEIVED - if a source code received\n *              JERRY_DEBUGGER_SOURCE_END - the end of the source codes\n *              JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED - the end of the context\n */\njerry_debugger_wait_for_source_status_t\njerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t callback_p, /**< callback function */\n                                       void *user_p, /**< user pointer passed to the callback */\n                                       jerry_value_t *return_value) /**< [out] parse and run return value */\n{\n  *return_value = jerry_undefined ();\n\n#if JERRY_DEBUGGER\n  if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n      && !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))\n  {\n    JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_CLIENT_SOURCE_MODE);\n    jerry_debugger_uint8_data_t *client_source_data_p = NULL;\n    jerry_debugger_wait_for_source_status_t ret_type = JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED;\n\n    /* Notify the client about that the engine is waiting for a source. */\n    jerry_debugger_send_type (JERRY_DEBUGGER_WAIT_FOR_SOURCE);\n\n    while (true)\n    {\n      if (jerry_debugger_receive (&client_source_data_p))\n      {\n        if (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED))\n        {\n          break;\n        }\n\n        /* Stop executing the current context. */\n        if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONTEXT_RESET_MODE))\n        {\n          ret_type = JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED;\n          JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_CONTEXT_RESET_MODE);\n          break;\n        }\n\n        /* Stop waiting for a new source file. */\n        if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CLIENT_NO_SOURCE))\n        {\n          ret_type = JERRY_DEBUGGER_SOURCE_END;\n          JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_CLIENT_SOURCE_MODE);\n          break;\n        }\n\n        /* The source arrived. */\n        if (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CLIENT_SOURCE_MODE))\n        {\n          JERRY_ASSERT (client_source_data_p != NULL);\n\n          jerry_char_t *source_name_p = (jerry_char_t *) (client_source_data_p + 1);\n          size_t source_name_size = strlen ((const char *) source_name_p);\n\n          *return_value = callback_p (source_name_p,\n                                      source_name_size,\n                                      source_name_p + source_name_size + 1,\n                                      client_source_data_p->uint8_size - source_name_size - 1,\n                                      user_p);\n\n          ret_type = JERRY_DEBUGGER_SOURCE_RECEIVED;\n          break;\n        }\n      }\n\n      jerry_debugger_transport_sleep ();\n    }\n\n    JERRY_ASSERT (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CLIENT_SOURCE_MODE)\n                  || !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED));\n\n    if (client_source_data_p != NULL)\n    {\n      /* The data may partly arrived. */\n      jmem_heap_free_block (client_source_data_p,\n                            client_source_data_p->uint8_size + sizeof (jerry_debugger_uint8_data_t));\n    }\n\n    return ret_type;\n  }\n\n  return JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED;\n#else /* !JERRY_DEBUGGER */\n  JERRY_UNUSED (callback_p);\n  JERRY_UNUSED (user_p);\n\n  return JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED;\n#endif /* JERRY_DEBUGGER */\n} /* jerry_debugger_wait_for_client_source */\n\n/**\n * Send the output of the program to the debugger client.\n * Currently only sends print output.\n */\nvoid\njerry_debugger_send_output (const jerry_char_t *buffer, /**< buffer */\n                            jerry_size_t str_size) /**< string size */\n{\n#if JERRY_DEBUGGER\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    jerry_debugger_send_string (JERRY_DEBUGGER_OUTPUT_RESULT,\n                                JERRY_DEBUGGER_OUTPUT_PRINT,\n                                (const uint8_t *) buffer,\n                                sizeof (uint8_t) * str_size);\n  }\n#else /* !JERRY_DEBUGGER */\n  JERRY_UNUSED (buffer);\n  JERRY_UNUSED (str_size);\n#endif /* JERRY_DEBUGGER */\n} /* jerry_debugger_send_output */\n"
  },
  {
    "path": "jerry-core/api/jerry-module.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-core.h\"\n#include \"jerryscript-port.h\"\n\n#include \"ecma-errors.h\"\n\n#include \"lit-magic-strings.h\"\n#include \"lit-strings.h\"\n\n#if JERRY_MODULE_SYSTEM\n\n/**\n * A module descriptor.\n */\ntypedef struct jerry_module_t\n{\n  struct jerry_module_t *next_p; /**< next_module */\n  jerry_char_t *path_p; /**< path to the module */\n  jerry_size_t basename_offset; /**< offset of the basename in the module path*/\n  jerry_value_t realm; /**< the realm of the module */\n  jerry_value_t module; /**< the module itself */\n} jerry_module_t;\n\n/**\n * Native info descriptor for modules.\n */\nstatic const jerry_object_native_info_t jerry_module_native_info JERRY_ATTR_CONST_DATA = {\n  .free_cb = NULL,\n};\n\n/**\n * Default module manager.\n */\ntypedef struct\n{\n  jerry_module_t *module_head_p; /**< first module */\n} jerry_module_manager_t;\n\n/**\n * Release known modules.\n */\nstatic void\njerry_module_free (jerry_module_manager_t *manager_p, /**< module manager */\n                   const jerry_value_t realm) /**< if this argument is object, release only those modules,\n                                               *   which realm value is equal to this argument. */\n{\n  jerry_module_t *module_p = manager_p->module_head_p;\n\n  bool release_all = !jerry_value_is_object (realm);\n\n  jerry_module_t *prev_p = NULL;\n\n  while (module_p != NULL)\n  {\n    jerry_module_t *next_p = module_p->next_p;\n\n    if (release_all || module_p->realm == realm)\n    {\n      jerry_port_path_free (module_p->path_p);\n      jerry_value_free (module_p->realm);\n      jerry_value_free (module_p->module);\n\n      jerry_heap_free (module_p, sizeof (jerry_module_t));\n\n      if (prev_p == NULL)\n      {\n        manager_p->module_head_p = next_p;\n      }\n      else\n      {\n        prev_p->next_p = next_p;\n      }\n    }\n    else\n    {\n      prev_p = module_p;\n    }\n\n    module_p = next_p;\n  }\n} /* jerry_module_free */\n\n/**\n * Initialize the default module manager.\n */\nstatic void\njerry_module_manager_init (void *user_data_p)\n{\n  ((jerry_module_manager_t *) user_data_p)->module_head_p = NULL;\n} /* jerry_module_manager_init */\n\n/**\n * Deinitialize the default module manager.\n */\nstatic void\njerry_module_manager_deinit (void *user_data_p) /**< context pointer to deinitialize */\n{\n  jerry_value_t undef = jerry_undefined ();\n  jerry_module_free ((jerry_module_manager_t *) user_data_p, undef);\n  jerry_value_free (undef);\n} /* jerry_module_manager_deinit */\n\n/**\n * Declare the context data manager for modules.\n */\nstatic const jerry_context_data_manager_t jerry_module_manager JERRY_ATTR_CONST_DATA = {\n  .init_cb = jerry_module_manager_init,\n  .deinit_cb = jerry_module_manager_deinit,\n  .bytes_needed = sizeof (jerry_module_manager_t)\n};\n\n#endif /* JERRY_MODULE_SYSTEM */\n\n/**\n * Default module resolver.\n *\n * @return a module object if resolving is successful, an error otherwise\n */\njerry_value_t\njerry_module_resolve (const jerry_value_t specifier, /**< module specifier string */\n                      const jerry_value_t referrer, /**< parent module */\n                      void *user_p) /**< user data */\n{\n#if JERRY_MODULE_SYSTEM\n  JERRY_UNUSED (user_p);\n\n  const jerry_char_t *directory_p = lit_get_magic_string_utf8 (LIT_MAGIC_STRING__EMPTY);\n  jerry_size_t directory_size = lit_get_magic_string_size (LIT_MAGIC_STRING__EMPTY);\n\n  jerry_module_t *module_p = jerry_object_get_native_ptr (referrer, &jerry_module_native_info);\n\n  if (module_p != NULL)\n  {\n    directory_p = module_p->path_p;\n    directory_size = module_p->basename_offset;\n  }\n\n  jerry_size_t specifier_size = jerry_string_size (specifier, JERRY_ENCODING_UTF8);\n  jerry_size_t reference_size = directory_size + specifier_size;\n  jerry_char_t *reference_path_p = jerry_heap_alloc (reference_size + 1);\n\n  memcpy (reference_path_p, directory_p, directory_size);\n  jerry_string_to_buffer (specifier, JERRY_ENCODING_UTF8, reference_path_p + directory_size, specifier_size);\n  reference_path_p[reference_size] = '\\0';\n\n  jerry_char_t *path_p = jerry_port_path_normalize (reference_path_p, reference_size);\n  jerry_heap_free (reference_path_p, reference_size + 1);\n\n  if (path_p == NULL)\n  {\n    return jerry_throw_sz (JERRY_ERROR_SYNTAX, \"Failed to resolve module\");\n  }\n\n  jerry_value_t realm = jerry_current_realm ();\n\n  jerry_module_manager_t *manager_p;\n  manager_p = (jerry_module_manager_t *) jerry_context_data (&jerry_module_manager);\n\n  module_p = manager_p->module_head_p;\n\n  while (module_p != NULL)\n  {\n    if (module_p->realm == realm && strcmp ((const char *) module_p->path_p, (const char *) path_p) == 0)\n    {\n      jerry_value_free (realm);\n      jerry_port_path_free (path_p);\n      return jerry_value_copy (module_p->module);\n    }\n\n    module_p = module_p->next_p;\n  }\n\n  jerry_size_t source_size;\n  jerry_char_t *source_p = jerry_port_source_read ((const char *) path_p, &source_size);\n\n  if (source_p == NULL)\n  {\n    jerry_value_free (realm);\n    jerry_port_path_free (path_p);\n\n    return jerry_throw_sz (JERRY_ERROR_SYNTAX, \"Module file not found\");\n  }\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_value_copy (specifier);\n\n  jerry_value_t ret_value = jerry_parse (source_p, source_size, &parse_options);\n  jerry_value_free (parse_options.source_name);\n\n  jerry_port_source_free (source_p);\n\n  if (jerry_value_is_exception (ret_value))\n  {\n    jerry_port_path_free (path_p);\n    jerry_value_free (realm);\n    return ret_value;\n  }\n\n  module_p = (jerry_module_t *) jerry_heap_alloc (sizeof (jerry_module_t));\n\n  module_p->next_p = manager_p->module_head_p;\n  module_p->path_p = path_p;\n  module_p->basename_offset = jerry_port_path_base (module_p->path_p);\n  module_p->realm = realm;\n  module_p->module = jerry_value_copy (ret_value);\n\n  jerry_object_set_native_ptr (ret_value, &jerry_module_native_info, module_p);\n  manager_p->module_head_p = module_p;\n\n  return ret_value;\n#else /* JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (specifier);\n  JERRY_UNUSED (referrer);\n  JERRY_UNUSED (user_p);\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_MODULE_NOT_SUPPORTED));\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_module_resolve */\n\n/**\n * Release known modules.\n */\nvoid\njerry_module_cleanup (const jerry_value_t realm) /**< if this argument is object, release only those modules,\n                                                  *   whose realm value is equal to this argument. */\n{\n#if JERRY_MODULE_SYSTEM\n  jerry_module_free ((jerry_module_manager_t *) jerry_context_data (&jerry_module_manager), realm);\n#else /* JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (realm);\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_module_cleanup */\n"
  },
  {
    "path": "jerry-core/api/jerry-snapshot.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerry-snapshot.h\"\n\n#include \"jerryscript.h\"\n\n#include \"ecma-conversion.h\"\n#include \"ecma-errors.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-literal-storage.h\"\n\n#include \"jcontext.h\"\n#include \"js-parser-internal.h\"\n#include \"js-parser.h\"\n#include \"lit-char-helpers.h\"\n#include \"re-compiler.h\"\n\n/** \\addtogroup jerrysnapshot Jerry snapshot operations\n * @{\n */\n\n#if JERRY_SNAPSHOT_SAVE || JERRY_SNAPSHOT_EXEC\n\n/**\n * Get snapshot configuration flags.\n *\n * @return configuration flags\n */\nstatic inline uint32_t JERRY_ATTR_ALWAYS_INLINE\nsnapshot_get_global_flags (bool has_regex, /**< regex literal is present */\n                           bool has_class) /**< class literal is present */\n{\n  JERRY_UNUSED (has_regex);\n  JERRY_UNUSED (has_class);\n\n  uint32_t flags = 0;\n\n#if JERRY_BUILTIN_REGEXP\n  flags |= (has_regex ? JERRY_SNAPSHOT_HAS_REGEX_LITERAL : 0);\n#endif /* JERRY_BUILTIN_REGEXP */\n\n  flags |= (has_class ? JERRY_SNAPSHOT_HAS_CLASS_LITERAL : 0);\n\n  return flags;\n} /* snapshot_get_global_flags */\n\n/**\n * Checks whether the global_flags argument matches to the current feature set.\n *\n * @return true if global_flags accepted, false otherwise\n */\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\nsnapshot_check_global_flags (uint32_t global_flags) /**< global flags */\n{\n#if JERRY_BUILTIN_REGEXP\n  global_flags &= (uint32_t) ~JERRY_SNAPSHOT_HAS_REGEX_LITERAL;\n#endif /* JERRY_BUILTIN_REGEXP */\n\n  global_flags &= (uint32_t) ~JERRY_SNAPSHOT_HAS_CLASS_LITERAL;\n\n  return global_flags == snapshot_get_global_flags (false, false);\n} /* snapshot_check_global_flags */\n\n#endif /* JERRY_SNAPSHOT_SAVE || JERRY_SNAPSHOT_EXEC */\n\n#if JERRY_SNAPSHOT_SAVE\n\n/**\n * Variables required to take a snapshot.\n */\ntypedef struct\n{\n  size_t snapshot_buffer_write_offset;\n  ecma_value_t snapshot_error;\n  bool regex_found;\n  bool class_found;\n} snapshot_globals_t;\n\n/**\n * Write data into the specified buffer.\n *\n * Note:\n *      Offset is in-out and is incremented if the write operation completes successfully.\n *\n * @return true - if write was successful, i.e. offset + data_size doesn't exceed buffer size,\n *         false - otherwise\n */\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\nsnapshot_write_to_buffer_by_offset (uint8_t *buffer_p, /**< buffer */\n                                    size_t buffer_size, /**< size of buffer */\n                                    size_t *in_out_buffer_offset_p, /**< [in,out] offset to write to\n                                                                     * incremented with data_size */\n                                    const void *data_p, /**< data */\n                                    size_t data_size) /**< size of the writable data */\n{\n  if (*in_out_buffer_offset_p + data_size > buffer_size)\n  {\n    return false;\n  }\n\n  memcpy (buffer_p + *in_out_buffer_offset_p, data_p, data_size);\n  *in_out_buffer_offset_p += data_size;\n\n  return true;\n} /* snapshot_write_to_buffer_by_offset */\n\n/**\n * Maximum snapshot write buffer offset.\n */\n#if !JERRY_NUMBER_TYPE_FLOAT64\n#define JERRY_SNAPSHOT_MAXIMUM_WRITE_OFFSET (0x7fffff >> 1)\n#else /* JERRY_NUMBER_TYPE_FLOAT64 */\n#define JERRY_SNAPSHOT_MAXIMUM_WRITE_OFFSET (UINT32_MAX >> 1)\n#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Save snapshot helper.\n *\n * @return start offset\n */\nstatic uint32_t\nsnapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, /**< compiled code */\n                            uint8_t *snapshot_buffer_p, /**< snapshot buffer */\n                            size_t snapshot_buffer_size, /**< snapshot buffer size */\n                            snapshot_globals_t *globals_p) /**< snapshot globals */\n{\n  const char *error_buffer_too_small_p = \"Snapshot buffer too small\";\n\n  if (!ecma_is_value_empty (globals_p->snapshot_error))\n  {\n    return 0;\n  }\n\n  JERRY_ASSERT ((globals_p->snapshot_buffer_write_offset & (JMEM_ALIGNMENT - 1)) == 0);\n\n  if (globals_p->snapshot_buffer_write_offset > JERRY_SNAPSHOT_MAXIMUM_WRITE_OFFSET)\n  {\n    globals_p->snapshot_error = jerry_throw_sz (JERRY_ERROR_RANGE, ecma_get_error_msg (ECMA_ERR_MAXIMUM_SNAPSHOT_SIZE));\n    return 0;\n  }\n\n  /* The snapshot generator always parses a single file,\n   * so the base always starts right after the snapshot header. */\n  uint32_t start_offset = (uint32_t) (globals_p->snapshot_buffer_write_offset - sizeof (jerry_snapshot_header_t));\n\n  uint8_t *copied_code_start_p = snapshot_buffer_p + globals_p->snapshot_buffer_write_offset;\n  ecma_compiled_code_t *copied_code_p = (ecma_compiled_code_t *) copied_code_start_p;\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)\n  {\n    globals_p->snapshot_error =\n      jerry_throw_sz (JERRY_ERROR_RANGE, ecma_get_error_msg (ECMA_ERR_TAGGED_TEMPLATE_LITERALS));\n    return 0;\n  }\n\n  if (CBC_FUNCTION_GET_TYPE (compiled_code_p->status_flags) == CBC_FUNCTION_CONSTRUCTOR)\n  {\n    globals_p->class_found = true;\n  }\n\n#if JERRY_BUILTIN_REGEXP\n  if (!CBC_IS_FUNCTION (compiled_code_p->status_flags))\n  {\n    /* Regular expression. */\n    if (globals_p->snapshot_buffer_write_offset + sizeof (ecma_compiled_code_t) > snapshot_buffer_size)\n    {\n      globals_p->snapshot_error = jerry_throw_sz (JERRY_ERROR_RANGE, error_buffer_too_small_p);\n      return 0;\n    }\n\n    globals_p->snapshot_buffer_write_offset += sizeof (ecma_compiled_code_t);\n\n    ecma_value_t pattern = ((re_compiled_code_t *) compiled_code_p)->source;\n    ecma_string_t *pattern_string_p = ecma_get_string_from_value (pattern);\n\n    lit_utf8_size_t pattern_size = 0;\n\n    ECMA_STRING_TO_UTF8_STRING (pattern_string_p, buffer_p, buffer_size);\n\n    pattern_size = buffer_size;\n\n    if (!snapshot_write_to_buffer_by_offset (snapshot_buffer_p,\n                                             snapshot_buffer_size,\n                                             &globals_p->snapshot_buffer_write_offset,\n                                             buffer_p,\n                                             buffer_size))\n    {\n      globals_p->snapshot_error = jerry_throw_sz (JERRY_ERROR_RANGE, error_buffer_too_small_p);\n      /* cannot return inside ECMA_FINALIZE_UTF8_STRING */\n    }\n\n    ECMA_FINALIZE_UTF8_STRING (buffer_p, buffer_size);\n\n    if (!ecma_is_value_empty (globals_p->snapshot_error))\n    {\n      return 0;\n    }\n\n    globals_p->regex_found = true;\n    globals_p->snapshot_buffer_write_offset = JERRY_ALIGNUP (globals_p->snapshot_buffer_write_offset, JMEM_ALIGNMENT);\n\n    /* Regexp character size is stored in refs. */\n    copied_code_p->refs = (uint16_t) pattern_size;\n\n    pattern_size += (lit_utf8_size_t) sizeof (ecma_compiled_code_t);\n    copied_code_p->size = (uint16_t) ((pattern_size + JMEM_ALIGNMENT - 1) >> JMEM_ALIGNMENT_LOG);\n\n    copied_code_p->status_flags = compiled_code_p->status_flags;\n\n    return start_offset;\n  }\n#endif /* JERRY_BUILTIN_REGEXP */\n\n  JERRY_ASSERT (CBC_IS_FUNCTION (compiled_code_p->status_flags));\n\n  if (!snapshot_write_to_buffer_by_offset (snapshot_buffer_p,\n                                           snapshot_buffer_size,\n                                           &globals_p->snapshot_buffer_write_offset,\n                                           compiled_code_p,\n                                           ((size_t) compiled_code_p->size) << JMEM_ALIGNMENT_LOG))\n  {\n    globals_p->snapshot_error = jerry_throw_sz (JERRY_ERROR_RANGE, error_buffer_too_small_p);\n    return 0;\n  }\n\n  /* Sub-functions and regular expressions are stored recursively. */\n  uint8_t *buffer_p = (uint8_t *) copied_code_p;\n  ecma_value_t *literal_start_p;\n  uint32_t const_literal_end;\n  uint32_t literal_end;\n\n#if JERRY_LINE_INFO\n  /* TODO: support snapshots. */\n  ((ecma_compiled_code_t *) buffer_p)->status_flags &= (uint16_t) ~CBC_CODE_FLAGS_HAS_LINE_INFO;\n#endif /* JERRY_LINE_INFO */\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    literal_start_p = (ecma_value_t *) (buffer_p + sizeof (cbc_uint16_arguments_t));\n\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) buffer_p;\n    literal_end = (uint32_t) (args_p->literal_end - args_p->register_end);\n    const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n  }\n  else\n  {\n    literal_start_p = (ecma_value_t *) (buffer_p + sizeof (cbc_uint8_arguments_t));\n\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) buffer_p;\n    literal_end = (uint32_t) (args_p->literal_end - args_p->register_end);\n    const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n  }\n\n  for (uint32_t i = const_literal_end; i < literal_end; i++)\n  {\n    ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_start_p[i]);\n\n    if (bytecode_p == compiled_code_p)\n    {\n      literal_start_p[i] = 0;\n    }\n    else\n    {\n      uint32_t offset = snapshot_add_compiled_code (bytecode_p, snapshot_buffer_p, snapshot_buffer_size, globals_p);\n\n      JERRY_ASSERT (!ecma_is_value_empty (globals_p->snapshot_error) || offset > start_offset);\n\n      literal_start_p[i] = offset - start_offset;\n    }\n  }\n\n  return start_offset;\n} /* snapshot_add_compiled_code */\n\n/**\n * Create unsupported literal error.\n */\nstatic void\nstatic_snapshot_error_unsupported_literal (snapshot_globals_t *globals_p, /**< snapshot globals */\n                                           ecma_value_t literal) /**< literal form the literal pool */\n{\n  lit_utf8_byte_t *str_p = (lit_utf8_byte_t *) \"Unsupported static snapshot literal: \";\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create_raw (str_p, 37);\n\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (literal));\n\n  ecma_string_t *literal_string_p = ecma_op_to_string (literal);\n  JERRY_ASSERT (literal_string_p != NULL);\n\n  ecma_stringbuilder_append (&builder, literal_string_p);\n\n  ecma_deref_ecma_string (literal_string_p);\n\n  ecma_object_t *error_object_p = ecma_new_standard_error (JERRY_ERROR_RANGE, ecma_stringbuilder_finalize (&builder));\n\n  globals_p->snapshot_error = ecma_create_exception_from_object (error_object_p);\n} /* static_snapshot_error_unsupported_literal */\n\n/**\n * Save static snapshot helper.\n *\n * @return start offset\n */\nstatic uint32_t\nstatic_snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, /**< compiled code */\n                                   uint8_t *snapshot_buffer_p, /**< snapshot buffer */\n                                   size_t snapshot_buffer_size, /**< snapshot buffer size */\n                                   snapshot_globals_t *globals_p) /**< snapshot globals */\n{\n  if (!ecma_is_value_empty (globals_p->snapshot_error))\n  {\n    return 0;\n  }\n\n  JERRY_ASSERT ((globals_p->snapshot_buffer_write_offset & (JMEM_ALIGNMENT - 1)) == 0);\n\n  if (globals_p->snapshot_buffer_write_offset >= JERRY_SNAPSHOT_MAXIMUM_WRITE_OFFSET)\n  {\n    globals_p->snapshot_error = jerry_throw_sz (JERRY_ERROR_RANGE, ecma_get_error_msg (ECMA_ERR_MAXIMUM_SNAPSHOT_SIZE));\n    return 0;\n  }\n\n  /* The snapshot generator always parses a single file,\n   * so the base always starts right after the snapshot header. */\n  uint32_t start_offset = (uint32_t) (globals_p->snapshot_buffer_write_offset - sizeof (jerry_snapshot_header_t));\n\n  uint8_t *copied_code_start_p = snapshot_buffer_p + globals_p->snapshot_buffer_write_offset;\n  ecma_compiled_code_t *copied_code_p = (ecma_compiled_code_t *) copied_code_start_p;\n\n  if (!CBC_IS_FUNCTION (compiled_code_p->status_flags))\n  {\n    /* Regular expression literals are not supported. */\n    globals_p->snapshot_error =\n      jerry_throw_sz (JERRY_ERROR_RANGE, ecma_get_error_msg (ECMA_ERR_REGULAR_EXPRESSION_NOT_SUPPORTED));\n    return 0;\n  }\n\n  if (!snapshot_write_to_buffer_by_offset (snapshot_buffer_p,\n                                           snapshot_buffer_size,\n                                           &globals_p->snapshot_buffer_write_offset,\n                                           compiled_code_p,\n                                           ((size_t) compiled_code_p->size) << JMEM_ALIGNMENT_LOG))\n  {\n    globals_p->snapshot_error = jerry_throw_sz (JERRY_ERROR_RANGE, ecma_get_error_msg (ECMA_ERR_SNAPSHOT_BUFFER_SMALL));\n    return 0;\n  }\n\n  /* Sub-functions and regular expressions are stored recursively. */\n  uint8_t *buffer_p = (uint8_t *) copied_code_p;\n  ecma_value_t *literal_start_p;\n  uint32_t const_literal_end;\n  uint32_t literal_end;\n\n  ((ecma_compiled_code_t *) copied_code_p)->status_flags |= CBC_CODE_FLAGS_STATIC_FUNCTION;\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    literal_start_p = (ecma_value_t *) (buffer_p + sizeof (cbc_uint16_arguments_t));\n\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) buffer_p;\n    literal_end = (uint32_t) (args_p->literal_end - args_p->register_end);\n    const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n\n    args_p->script_value = JMEM_CP_NULL;\n  }\n  else\n  {\n    literal_start_p = (ecma_value_t *) (buffer_p + sizeof (cbc_uint8_arguments_t));\n\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) buffer_p;\n    literal_end = (uint32_t) (args_p->literal_end - args_p->register_end);\n    const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n\n    args_p->script_value = JMEM_CP_NULL;\n  }\n\n  for (uint32_t i = 0; i < const_literal_end; i++)\n  {\n    if (!ecma_is_value_direct (literal_start_p[i]) && !ecma_is_value_direct_string (literal_start_p[i]))\n    {\n      static_snapshot_error_unsupported_literal (globals_p, literal_start_p[i]);\n      return 0;\n    }\n  }\n\n  for (uint32_t i = const_literal_end; i < literal_end; i++)\n  {\n    ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_start_p[i]);\n\n    if (bytecode_p == compiled_code_p)\n    {\n      literal_start_p[i] = 0;\n    }\n    else\n    {\n      uint32_t offset =\n        static_snapshot_add_compiled_code (bytecode_p, snapshot_buffer_p, snapshot_buffer_size, globals_p);\n\n      JERRY_ASSERT (!ecma_is_value_empty (globals_p->snapshot_error) || offset > start_offset);\n\n      literal_start_p[i] = offset - start_offset;\n    }\n  }\n\n  buffer_p += ((size_t) compiled_code_p->size) << JMEM_ALIGNMENT_LOG;\n  literal_start_p = ecma_snapshot_resolve_serializable_values (compiled_code_p, buffer_p);\n\n  while (literal_start_p < (ecma_value_t *) buffer_p)\n  {\n    if (!ecma_is_value_direct_string (*literal_start_p) && !ecma_is_value_empty (*literal_start_p))\n    {\n      static_snapshot_error_unsupported_literal (globals_p, *literal_start_p);\n      return 0;\n    }\n\n    literal_start_p++;\n  }\n\n  return start_offset;\n} /* static_snapshot_add_compiled_code */\n\n/**\n * Set the uint16_t offsets in the code area.\n */\nstatic void\njerry_snapshot_set_offsets (uint32_t *buffer_p, /**< buffer */\n                            uint32_t size, /**< buffer size */\n                            lit_mem_to_snapshot_id_map_entry_t *lit_map_p) /**< literal map */\n{\n  JERRY_ASSERT (size > 0);\n\n  do\n  {\n    ecma_compiled_code_t *bytecode_p = (ecma_compiled_code_t *) buffer_p;\n    uint32_t code_size = ((uint32_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG;\n\n    if (CBC_IS_FUNCTION (bytecode_p->status_flags))\n    {\n      ecma_value_t *literal_start_p;\n      uint32_t const_literal_end;\n\n      if (bytecode_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n      {\n        literal_start_p = (ecma_value_t *) (((uint8_t *) buffer_p) + sizeof (cbc_uint16_arguments_t));\n\n        cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) buffer_p;\n        const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n      }\n      else\n      {\n        literal_start_p = (ecma_value_t *) (((uint8_t *) buffer_p) + sizeof (cbc_uint8_arguments_t));\n\n        cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) buffer_p;\n        const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n      }\n\n      for (uint32_t i = 0; i < const_literal_end; i++)\n      {\n        if (ecma_is_value_string (literal_start_p[i])\n#if JERRY_BUILTIN_BIGINT\n            || ecma_is_value_bigint (literal_start_p[i])\n#endif /* JERRY_BUILTIN_BIGINT */\n            || ecma_is_value_float_number (literal_start_p[i]))\n        {\n          lit_mem_to_snapshot_id_map_entry_t *current_p = lit_map_p;\n\n          while (current_p->literal_id != literal_start_p[i])\n          {\n            current_p++;\n          }\n\n          literal_start_p[i] = current_p->literal_offset;\n        }\n      }\n\n      uint8_t *byte_p = (uint8_t *) bytecode_p + (((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);\n      literal_start_p = ecma_snapshot_resolve_serializable_values (bytecode_p, byte_p);\n\n      while (literal_start_p < (ecma_value_t *) byte_p)\n      {\n        if (*literal_start_p != ECMA_VALUE_EMPTY)\n        {\n          JERRY_ASSERT (ecma_is_value_string (*literal_start_p));\n\n          lit_mem_to_snapshot_id_map_entry_t *current_p = lit_map_p;\n\n          while (current_p->literal_id != *literal_start_p)\n          {\n            current_p++;\n          }\n\n          *literal_start_p = current_p->literal_offset;\n        }\n\n        literal_start_p++;\n      }\n\n      /* Set reference counter to 1. */\n      bytecode_p->refs = 1;\n    }\n\n    JERRY_ASSERT ((code_size % sizeof (uint32_t)) == 0);\n    buffer_p += code_size / sizeof (uint32_t);\n    size -= code_size;\n  } while (size > 0);\n} /* jerry_snapshot_set_offsets */\n\n#endif /* JERRY_SNAPSHOT_SAVE */\n\n#if JERRY_SNAPSHOT_EXEC\n\n/**\n * Byte code blocks shorter than this threshold are always copied into the memory.\n * The memory / performance trade-of of byte code redirection does not worth\n * in such cases.\n */\n#define BYTECODE_NO_COPY_THRESHOLD 8\n\n/**\n * Load byte code from snapshot.\n *\n * @return byte code\n */\nstatic ecma_compiled_code_t *\nsnapshot_load_compiled_code (const uint8_t *base_addr_p, /**< base address of the\n                                                          *   current primary function */\n                             const uint8_t *literal_base_p, /**< literal start */\n                             cbc_script_t *script_p, /**< script */\n                             bool copy_bytecode) /**< byte code should be copied to memory */\n{\n  ecma_compiled_code_t *bytecode_p = (ecma_compiled_code_t *) base_addr_p;\n  uint32_t code_size = ((uint32_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG;\n\n#if JERRY_BUILTIN_REGEXP\n  if (!CBC_IS_FUNCTION (bytecode_p->status_flags))\n  {\n    const uint8_t *regex_start_p = ((const uint8_t *) bytecode_p) + sizeof (ecma_compiled_code_t);\n\n    /* Real size is stored in refs. */\n    ecma_string_t *pattern_str_p = ecma_new_ecma_string_from_utf8 (regex_start_p, bytecode_p->refs);\n\n    const re_compiled_code_t *re_bytecode_p = re_compile_bytecode (pattern_str_p, bytecode_p->status_flags);\n    ecma_deref_ecma_string (pattern_str_p);\n\n    return (ecma_compiled_code_t *) re_bytecode_p;\n  }\n#else /* !JERRY_BUILTIN_REGEXP */\n  JERRY_ASSERT (CBC_IS_FUNCTION (bytecode_p->status_flags));\n#endif /* JERRY_BUILTIN_REGEXP */\n\n  size_t header_size;\n  uint32_t argument_end;\n  uint32_t const_literal_end;\n  uint32_t literal_end;\n\n  if (JERRY_UNLIKELY (script_p->refs_and_type >= CBC_SCRIPT_REF_MAX))\n  {\n    /* This is probably never happens in practice. */\n    jerry_fatal (JERRY_FATAL_REF_COUNT_LIMIT);\n  }\n\n  script_p->refs_and_type += CBC_SCRIPT_REF_ONE;\n\n  if (bytecode_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    uint8_t *byte_p = (uint8_t *) bytecode_p;\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) byte_p;\n\n    argument_end = args_p->argument_end;\n    const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n    literal_end = (uint32_t) (args_p->literal_end - args_p->register_end);\n    header_size = sizeof (cbc_uint16_arguments_t);\n\n    ECMA_SET_INTERNAL_VALUE_POINTER (args_p->script_value, script_p);\n  }\n  else\n  {\n    uint8_t *byte_p = (uint8_t *) bytecode_p;\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) byte_p;\n\n    argument_end = args_p->argument_end;\n    const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n    literal_end = (uint32_t) (args_p->literal_end - args_p->register_end);\n    header_size = sizeof (cbc_uint8_arguments_t);\n\n    ECMA_SET_INTERNAL_VALUE_POINTER (args_p->script_value, script_p);\n  }\n\n  if (copy_bytecode || (header_size + (literal_end * sizeof (uint16_t)) + BYTECODE_NO_COPY_THRESHOLD > code_size))\n  {\n    bytecode_p = (ecma_compiled_code_t *) jmem_heap_alloc_block (code_size);\n\n#if JERRY_MEM_STATS\n    jmem_stats_allocate_byte_code_bytes (code_size);\n#endif /* JERRY_MEM_STATS */\n\n    memcpy (bytecode_p, base_addr_p, code_size);\n  }\n  else\n  {\n    uint32_t start_offset = (uint32_t) (header_size + literal_end * sizeof (ecma_value_t));\n\n    uint8_t *real_bytecode_p = ((uint8_t *) bytecode_p) + start_offset;\n    uint32_t new_code_size = (uint32_t) (start_offset + 1 + sizeof (uint8_t *));\n    uint32_t extra_bytes = 0;\n\n    if (bytecode_p->status_flags & CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED)\n    {\n      extra_bytes += (uint32_t) (argument_end * sizeof (ecma_value_t));\n    }\n\n    /* function name */\n    if (CBC_FUNCTION_GET_TYPE (bytecode_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)\n    {\n      extra_bytes += (uint32_t) sizeof (ecma_value_t);\n    }\n\n    /* tagged template literals */\n    if (bytecode_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)\n    {\n      extra_bytes += (uint32_t) sizeof (ecma_value_t);\n    }\n\n#if JERRY_SOURCE_NAME\n    /* source name */\n    extra_bytes += (uint32_t) sizeof (ecma_value_t);\n#endif /* JERRY_SOURCE_NAME */\n\n    new_code_size = JERRY_ALIGNUP (new_code_size + extra_bytes, JMEM_ALIGNMENT);\n\n    bytecode_p = (ecma_compiled_code_t *) jmem_heap_alloc_block (new_code_size);\n\n#if JERRY_MEM_STATS\n    jmem_stats_allocate_byte_code_bytes (new_code_size);\n#endif /* JERRY_MEM_STATS */\n\n    memcpy (bytecode_p, base_addr_p, start_offset);\n\n    bytecode_p->size = (uint16_t) (new_code_size >> JMEM_ALIGNMENT_LOG);\n\n    uint8_t *byte_p = (uint8_t *) bytecode_p;\n\n    uint8_t *new_base_p = byte_p + new_code_size - extra_bytes;\n    const uint8_t *base_p = base_addr_p + code_size - extra_bytes;\n\n    if (extra_bytes != 0)\n    {\n      memcpy (new_base_p, base_p, extra_bytes);\n    }\n\n    byte_p[start_offset] = CBC_SET_BYTECODE_PTR;\n    memcpy (byte_p + start_offset + 1, &real_bytecode_p, sizeof (uintptr_t));\n\n    code_size = new_code_size;\n  }\n\n  JERRY_ASSERT (bytecode_p->refs == 1);\n\n#if JERRY_DEBUGGER\n  bytecode_p->status_flags = (uint16_t) (bytecode_p->status_flags | CBC_CODE_FLAGS_DEBUGGER_IGNORE);\n#endif /* JERRY_DEBUGGER */\n\n  ecma_value_t *literal_start_p = (ecma_value_t *) (((uint8_t *) bytecode_p) + header_size);\n\n  for (uint32_t i = 0; i < const_literal_end; i++)\n  {\n    if ((literal_start_p[i] & ECMA_VALUE_TYPE_MASK) == ECMA_TYPE_SNAPSHOT_OFFSET)\n    {\n      literal_start_p[i] = ecma_snapshot_get_literal (literal_base_p, literal_start_p[i]);\n    }\n  }\n\n  for (uint32_t i = const_literal_end; i < literal_end; i++)\n  {\n    size_t literal_offset = (size_t) literal_start_p[i];\n\n    if (literal_offset == 0)\n    {\n      /* Self reference */\n      ECMA_SET_INTERNAL_VALUE_POINTER (literal_start_p[i], bytecode_p);\n    }\n    else\n    {\n      ecma_compiled_code_t *literal_bytecode_p;\n      literal_bytecode_p =\n        snapshot_load_compiled_code (base_addr_p + literal_offset, literal_base_p, script_p, copy_bytecode);\n\n      ECMA_SET_INTERNAL_VALUE_POINTER (literal_start_p[i], literal_bytecode_p);\n    }\n  }\n\n  uint8_t *byte_p = ((uint8_t *) bytecode_p) + code_size;\n  literal_start_p = ecma_snapshot_resolve_serializable_values (bytecode_p, byte_p);\n\n  while (literal_start_p < (ecma_value_t *) byte_p)\n  {\n    if ((*literal_start_p & ECMA_VALUE_TYPE_MASK) == ECMA_TYPE_SNAPSHOT_OFFSET)\n    {\n      *literal_start_p = ecma_snapshot_get_literal (literal_base_p, *literal_start_p);\n    }\n\n    literal_start_p++;\n  }\n\n  return bytecode_p;\n} /* snapshot_load_compiled_code */\n\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n/**\n * Generate snapshot from specified source and arguments\n *\n * @return size of snapshot (a number value), if it was generated succesfully\n *          (i.e. there are no syntax errors in source code, buffer size is sufficient,\n *           and snapshot support is enabled in current configuration through JERRY_SNAPSHOT_SAVE),\n *         error object otherwise\n */\njerry_value_t\njerry_generate_snapshot (jerry_value_t compiled_code, /**< parsed script or function */\n                         uint32_t generate_snapshot_opts, /**< jerry_generate_snapshot_opts_t option bits */\n                         uint32_t *buffer_p, /**< buffer to save snapshot to */\n                         size_t buffer_size) /**< the buffer's size */\n{\n#if JERRY_SNAPSHOT_SAVE\n  uint32_t allowed_options = JERRY_SNAPSHOT_SAVE_STATIC;\n\n  if ((generate_snapshot_opts & ~allowed_options) != 0)\n  {\n    return jerry_throw_sz (JERRY_ERROR_RANGE, ecma_get_error_msg (ECMA_ERR_SNAPSHOT_FLAG_NOT_SUPPORTED));\n  }\n\n  const ecma_compiled_code_t *bytecode_data_p = NULL;\n\n  if (ecma_is_value_object (compiled_code))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (compiled_code);\n\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SCRIPT))\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      bytecode_data_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);\n    }\n    else if (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION)\n    {\n      ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;\n\n      bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p);\n\n      uint16_t type = CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags);\n\n      if (type != CBC_FUNCTION_NORMAL)\n      {\n        bytecode_data_p = NULL;\n      }\n    }\n  }\n\n  if (JERRY_UNLIKELY (bytecode_data_p == NULL))\n  {\n    return jerry_throw_sz (JERRY_ERROR_RANGE, ecma_get_error_msg (ECMA_ERR_SNAPSHOT_UNSUPPORTED_COMPILED_CODE));\n  }\n\n  snapshot_globals_t globals;\n  const uint32_t aligned_header_size = JERRY_ALIGNUP (sizeof (jerry_snapshot_header_t), JMEM_ALIGNMENT);\n\n  globals.snapshot_buffer_write_offset = aligned_header_size;\n  globals.snapshot_error = ECMA_VALUE_EMPTY;\n  globals.regex_found = false;\n  globals.class_found = false;\n\n  if (generate_snapshot_opts & JERRY_SNAPSHOT_SAVE_STATIC)\n  {\n    static_snapshot_add_compiled_code (bytecode_data_p, (uint8_t *) buffer_p, buffer_size, &globals);\n  }\n  else\n  {\n    snapshot_add_compiled_code (bytecode_data_p, (uint8_t *) buffer_p, buffer_size, &globals);\n  }\n\n  if (!ecma_is_value_empty (globals.snapshot_error))\n  {\n    return globals.snapshot_error;\n  }\n\n  jerry_snapshot_header_t header;\n  header.magic = JERRY_SNAPSHOT_MAGIC;\n  header.version = JERRY_SNAPSHOT_VERSION;\n  header.global_flags = snapshot_get_global_flags (globals.regex_found, globals.class_found);\n  header.lit_table_offset = (uint32_t) globals.snapshot_buffer_write_offset;\n  header.number_of_funcs = 1;\n  header.func_offsets[0] = aligned_header_size;\n\n  lit_mem_to_snapshot_id_map_entry_t *lit_map_p = NULL;\n  uint32_t literals_num = 0;\n\n  if (!(generate_snapshot_opts & JERRY_SNAPSHOT_SAVE_STATIC))\n  {\n    ecma_collection_t *lit_pool_p = ecma_new_collection ();\n\n    ecma_save_literals_add_compiled_code (bytecode_data_p, lit_pool_p);\n\n    if (!ecma_save_literals_for_snapshot (lit_pool_p,\n                                          buffer_p,\n                                          buffer_size,\n                                          &globals.snapshot_buffer_write_offset,\n                                          &lit_map_p,\n                                          &literals_num))\n    {\n      JERRY_ASSERT (lit_map_p == NULL);\n      return jerry_throw_sz (JERRY_ERROR_COMMON, ecma_get_error_msg (ECMA_ERR_CANNOT_ALLOCATE_MEMORY_LITERALS));\n    }\n\n    jerry_snapshot_set_offsets (buffer_p + (aligned_header_size / sizeof (uint32_t)),\n                                (uint32_t) (header.lit_table_offset - aligned_header_size),\n                                lit_map_p);\n  }\n\n  size_t header_offset = 0;\n\n  snapshot_write_to_buffer_by_offset ((uint8_t *) buffer_p, buffer_size, &header_offset, &header, sizeof (header));\n\n  if (lit_map_p != NULL)\n  {\n    jmem_heap_free_block (lit_map_p, literals_num * sizeof (lit_mem_to_snapshot_id_map_entry_t));\n  }\n\n  return ecma_make_number_value ((ecma_number_t) globals.snapshot_buffer_write_offset);\n#else /* !JERRY_SNAPSHOT_SAVE */\n  JERRY_UNUSED (compiled_code);\n  JERRY_UNUSED (generate_snapshot_opts);\n  JERRY_UNUSED (buffer_p);\n  JERRY_UNUSED (buffer_size);\n\n  return jerry_throw_sz (JERRY_ERROR_COMMON, ecma_get_error_msg (ECMA_ERR_SNAPSHOT_SAVE_DISABLED));\n#endif /* JERRY_SNAPSHOT_SAVE */\n} /* jerry_generate_snapshot */\n\n/**\n * Execute/load snapshot from specified buffer\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return result of bytecode - if run was successful\n *         thrown error - otherwise\n */\njerry_value_t\njerry_exec_snapshot (const uint32_t *snapshot_p, /**< snapshot */\n                     size_t snapshot_size, /**< size of snapshot */\n                     size_t func_index, /**< index of primary function */\n                     uint32_t exec_snapshot_opts, /**< jerry_exec_snapshot_opts_t option bits */\n                     const jerry_exec_snapshot_option_values_t *option_values_p) /**< additional option values,\n                                                                                  *   can be NULL if not used */\n{\n#if JERRY_SNAPSHOT_EXEC\n  JERRY_ASSERT (snapshot_p != NULL);\n\n  uint32_t allowed_opts =\n    (JERRY_SNAPSHOT_EXEC_COPY_DATA | JERRY_SNAPSHOT_EXEC_ALLOW_STATIC | JERRY_SNAPSHOT_EXEC_LOAD_AS_FUNCTION\n     | JERRY_SNAPSHOT_EXEC_HAS_SOURCE_NAME | JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE);\n\n  if ((exec_snapshot_opts & ~(allowed_opts)) != 0)\n  {\n    return jerry_throw_sz (JERRY_ERROR_RANGE,\n                           ecma_get_error_msg (ECMA_ERR_UNSUPPORTED_SNAPSHOT_EXEC_FLAGS_ARE_SPECIFIED));\n  }\n\n  const uint8_t *snapshot_data_p = (uint8_t *) snapshot_p;\n\n  if (snapshot_size <= sizeof (jerry_snapshot_header_t))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_INVALID_SNAPSHOT_FORMAT));\n  }\n\n  const jerry_snapshot_header_t *header_p = (const jerry_snapshot_header_t *) snapshot_data_p;\n\n  if (header_p->magic != JERRY_SNAPSHOT_MAGIC || header_p->version != JERRY_SNAPSHOT_VERSION\n      || !snapshot_check_global_flags (header_p->global_flags))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_INVALID_SNAPSHOT_VERSION_OR_FEATURES));\n  }\n\n  if (header_p->lit_table_offset > snapshot_size)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_INVALID_SNAPSHOT_VERSION_OR_FEATURES));\n  }\n\n  if (func_index >= header_p->number_of_funcs)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_FUNCTION_INDEX_IS_HIGHER_THAN_MAXIMUM));\n  }\n\n  JERRY_ASSERT ((header_p->lit_table_offset % sizeof (uint32_t)) == 0);\n\n  uint32_t func_offset = header_p->func_offsets[func_index];\n  ecma_compiled_code_t *bytecode_p = (ecma_compiled_code_t *) (snapshot_data_p + func_offset);\n\n  if (bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)\n  {\n    if (!(exec_snapshot_opts & JERRY_SNAPSHOT_EXEC_ALLOW_STATIC))\n    {\n      return jerry_throw_sz (JERRY_ERROR_COMMON, ecma_get_error_msg (ECMA_ERR_STATIC_SNAPSHOTS_ARE_NOT_ENABLED));\n    }\n\n    if (exec_snapshot_opts & JERRY_SNAPSHOT_EXEC_COPY_DATA)\n    {\n      return jerry_throw_sz (JERRY_ERROR_COMMON,\n                             ecma_get_error_msg (ECMA_ERR_STATIC_SNAPSHOTS_CANNOT_BE_COPIED_INTO_MEMORY));\n    }\n  }\n  else\n  {\n    ecma_value_t user_value = ECMA_VALUE_EMPTY;\n\n    if ((exec_snapshot_opts & JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE) && option_values_p != NULL)\n    {\n      user_value = option_values_p->user_value;\n    }\n\n    size_t script_size = sizeof (cbc_script_t);\n\n    if (user_value != ECMA_VALUE_EMPTY)\n    {\n      script_size += sizeof (ecma_value_t);\n    }\n\n    cbc_script_t *script_p = jmem_heap_alloc_block (script_size);\n\n    CBC_SCRIPT_SET_TYPE (script_p, user_value, CBC_SCRIPT_REF_ONE);\n\n#if JERRY_BUILTIN_REALMS\n    script_p->realm_p = (ecma_object_t *) JERRY_CONTEXT (global_object_p);\n#endif /* JERRY_BUILTIN_REALMS */\n\n#if JERRY_SOURCE_NAME\n    ecma_value_t source_name = ecma_make_magic_string_value (LIT_MAGIC_STRING_SOURCE_NAME_ANON);\n\n    if ((exec_snapshot_opts & JERRY_SNAPSHOT_EXEC_HAS_SOURCE_NAME) && option_values_p != NULL\n        && ecma_is_value_string (option_values_p->source_name) > 0)\n    {\n      ecma_ref_ecma_string (ecma_get_string_from_value (option_values_p->source_name));\n      source_name = option_values_p->source_name;\n    }\n\n    script_p->source_name = source_name;\n#endif /* JERRY_SOURCE_NAME */\n\n#if JERRY_FUNCTION_TO_STRING\n    script_p->source_code = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n    const uint8_t *literal_base_p = snapshot_data_p + header_p->lit_table_offset;\n\n    bytecode_p = snapshot_load_compiled_code ((const uint8_t *) bytecode_p,\n                                              literal_base_p,\n                                              script_p,\n                                              (exec_snapshot_opts & JERRY_SNAPSHOT_EXEC_COPY_DATA) != 0);\n\n    if (bytecode_p == NULL)\n    {\n      JERRY_ASSERT (script_p->refs_and_type >= CBC_SCRIPT_REF_ONE);\n      jmem_heap_free_block (script_p, script_size);\n      return ecma_raise_type_error (ECMA_ERR_INVALID_SNAPSHOT_FORMAT);\n    }\n\n    script_p->refs_and_type -= CBC_SCRIPT_REF_ONE;\n\n    if (user_value != ECMA_VALUE_EMPTY)\n    {\n      CBC_SCRIPT_GET_USER_VALUE (script_p) = ecma_copy_value_if_not_object (user_value);\n    }\n  }\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (JERRY_CONTEXT (jerry_init_flags) & JERRY_INIT_SHOW_OPCODES)\n  {\n    util_print_cbc (bytecode_p);\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  ecma_value_t ret_val;\n\n  if (exec_snapshot_opts & JERRY_SNAPSHOT_EXEC_LOAD_AS_FUNCTION)\n  {\n    ecma_object_t *global_object_p = ecma_builtin_get_global ();\n\n#if JERRY_BUILTIN_REALMS\n    JERRY_ASSERT (global_object_p == (ecma_object_t *) ecma_op_function_get_realm (bytecode_p));\n#endif /* JERRY_BUILTIN_REALMS */\n\n    if (bytecode_p->status_flags & CBC_CODE_FLAGS_LEXICAL_BLOCK_NEEDED)\n    {\n      ecma_create_global_lexical_block (global_object_p);\n    }\n\n    ecma_object_t *lex_env_p = ecma_get_global_scope (global_object_p);\n    ecma_object_t *func_obj_p = ecma_op_create_simple_function_object (lex_env_p, bytecode_p);\n\n    if (!(bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))\n    {\n      ecma_bytecode_deref (bytecode_p);\n    }\n    ret_val = ecma_make_object_value (func_obj_p);\n  }\n  else\n  {\n    ret_val = vm_run_global (bytecode_p, NULL);\n    if (!(bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))\n    {\n      ecma_bytecode_deref (bytecode_p);\n    }\n  }\n\n  if (ECMA_IS_VALUE_ERROR (ret_val))\n  {\n    return ecma_create_exception_from_context ();\n  }\n\n  return ret_val;\n#else /* !JERRY_SNAPSHOT_EXEC */\n  JERRY_UNUSED (snapshot_p);\n  JERRY_UNUSED (snapshot_size);\n  JERRY_UNUSED (func_index);\n  JERRY_UNUSED (exec_snapshot_opts);\n  JERRY_UNUSED (option_values_p);\n\n  return jerry_throw_sz (JERRY_ERROR_COMMON, ecma_get_error_msg (ECMA_ERR_SNAPSHOT_EXEC_DISABLED));\n#endif /* JERRY_SNAPSHOT_EXEC */\n} /* jerry_exec_snapshot */\n\n#if JERRY_SNAPSHOT_SAVE\n\n/**\n * Collect all literals from a snapshot file.\n */\nstatic void\nscan_snapshot_functions (const uint8_t *buffer_p, /**< snapshot buffer start */\n                         const uint8_t *buffer_end_p, /**< snapshot buffer end */\n                         ecma_collection_t *lit_pool_p, /**< list of known values */\n                         const uint8_t *literal_base_p) /**< start of literal data */\n{\n  JERRY_ASSERT (buffer_end_p > buffer_p);\n\n  do\n  {\n    const ecma_compiled_code_t *bytecode_p = (ecma_compiled_code_t *) buffer_p;\n    uint32_t code_size = ((uint32_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG;\n\n    if (CBC_IS_FUNCTION (bytecode_p->status_flags) && !(bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))\n    {\n      const ecma_value_t *literal_start_p;\n      uint32_t const_literal_end;\n\n      if (bytecode_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n      {\n        literal_start_p = (ecma_value_t *) (buffer_p + sizeof (cbc_uint16_arguments_t));\n\n        cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) buffer_p;\n        const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n      }\n      else\n      {\n        literal_start_p = (ecma_value_t *) (buffer_p + sizeof (cbc_uint8_arguments_t));\n\n        cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) buffer_p;\n        const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n      }\n\n      for (uint32_t i = 0; i < const_literal_end; i++)\n      {\n        if ((literal_start_p[i] & ECMA_VALUE_TYPE_MASK) == ECMA_TYPE_SNAPSHOT_OFFSET)\n        {\n          ecma_value_t lit_value = ecma_snapshot_get_literal (literal_base_p, literal_start_p[i]);\n          ecma_save_literals_append_value (lit_value, lit_pool_p);\n        }\n      }\n\n      uint8_t *byte_p = (uint8_t *) bytecode_p + (((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);\n      literal_start_p = ecma_snapshot_resolve_serializable_values ((ecma_compiled_code_t *) bytecode_p, byte_p);\n\n      while (literal_start_p < (ecma_value_t *) byte_p)\n      {\n        if ((*literal_start_p & ECMA_VALUE_TYPE_MASK) == ECMA_TYPE_SNAPSHOT_OFFSET)\n        {\n          ecma_value_t lit_value = ecma_snapshot_get_literal (literal_base_p, *literal_start_p);\n          ecma_save_literals_append_value (lit_value, lit_pool_p);\n        }\n\n        literal_start_p++;\n      }\n    }\n\n    buffer_p += code_size;\n  } while (buffer_p < buffer_end_p);\n} /* scan_snapshot_functions */\n\n/**\n * Update all literal offsets in a snapshot data.\n */\nstatic void\nupdate_literal_offsets (uint8_t *buffer_p, /**< [in,out] snapshot buffer start */\n                        const uint8_t *buffer_end_p, /**< snapshot buffer end */\n                        const lit_mem_to_snapshot_id_map_entry_t *lit_map_p, /**< literal map */\n                        const uint8_t *literal_base_p) /**< start of literal data */\n{\n  JERRY_ASSERT (buffer_end_p > buffer_p);\n\n  do\n  {\n    const ecma_compiled_code_t *bytecode_p = (ecma_compiled_code_t *) buffer_p;\n    uint32_t code_size = ((uint32_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG;\n\n    if (CBC_IS_FUNCTION (bytecode_p->status_flags) && !(bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))\n    {\n      ecma_value_t *literal_start_p;\n      uint32_t const_literal_end;\n\n      if (bytecode_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n      {\n        literal_start_p = (ecma_value_t *) (buffer_p + sizeof (cbc_uint16_arguments_t));\n\n        cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) buffer_p;\n        const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n      }\n      else\n      {\n        literal_start_p = (ecma_value_t *) (buffer_p + sizeof (cbc_uint8_arguments_t));\n\n        cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) buffer_p;\n        const_literal_end = (uint32_t) (args_p->const_literal_end - args_p->register_end);\n      }\n\n      for (uint32_t i = 0; i < const_literal_end; i++)\n      {\n        if ((literal_start_p[i] & ECMA_VALUE_TYPE_MASK) == ECMA_TYPE_SNAPSHOT_OFFSET)\n        {\n          ecma_value_t lit_value = ecma_snapshot_get_literal (literal_base_p, literal_start_p[i]);\n          const lit_mem_to_snapshot_id_map_entry_t *current_p = lit_map_p;\n\n          while (current_p->literal_id != lit_value)\n          {\n            current_p++;\n          }\n\n          literal_start_p[i] = current_p->literal_offset;\n        }\n      }\n\n      uint8_t *byte_p = (uint8_t *) bytecode_p + (((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);\n      literal_start_p = ecma_snapshot_resolve_serializable_values ((ecma_compiled_code_t *) bytecode_p, byte_p);\n\n      while (literal_start_p < (ecma_value_t *) byte_p)\n      {\n        if ((*literal_start_p & ECMA_VALUE_TYPE_MASK) == ECMA_TYPE_SNAPSHOT_OFFSET)\n        {\n          ecma_value_t lit_value = ecma_snapshot_get_literal (literal_base_p, *literal_start_p);\n          const lit_mem_to_snapshot_id_map_entry_t *current_p = lit_map_p;\n\n          while (current_p->literal_id != lit_value)\n          {\n            current_p++;\n          }\n\n          *literal_start_p = current_p->literal_offset;\n        }\n\n        literal_start_p++;\n      }\n    }\n\n    buffer_p += code_size;\n  } while (buffer_p < buffer_end_p);\n} /* update_literal_offsets */\n\n#endif /* JERRY_SNAPSHOT_SAVE */\n\n/**\n * Merge multiple snapshots into a single buffer\n *\n * @return length of merged snapshot file\n *         0 on error\n */\nsize_t\njerry_merge_snapshots (const uint32_t **inp_buffers_p, /**< array of (pointers to start of) input buffers */\n                       size_t *inp_buffer_sizes_p, /**< array of input buffer sizes */\n                       size_t number_of_snapshots, /**< number of snapshots */\n                       uint32_t *out_buffer_p, /**< output buffer */\n                       size_t out_buffer_size, /**< output buffer size */\n                       const char **error_p) /**< error description */\n{\n#if JERRY_SNAPSHOT_SAVE\n  uint32_t number_of_funcs = 0;\n  uint32_t merged_global_flags = 0;\n  size_t functions_size = sizeof (jerry_snapshot_header_t);\n\n  if (number_of_snapshots < 2)\n  {\n    *error_p = \"at least two snapshots must be passed\";\n    return 0;\n  }\n\n  ecma_collection_t *lit_pool_p = ecma_new_collection ();\n\n  for (uint32_t i = 0; i < number_of_snapshots; i++)\n  {\n    if (inp_buffer_sizes_p[i] < sizeof (jerry_snapshot_header_t))\n    {\n      *error_p = \"invalid snapshot file\";\n      ecma_collection_destroy (lit_pool_p);\n      return 0;\n    }\n\n    const jerry_snapshot_header_t *header_p = (const jerry_snapshot_header_t *) inp_buffers_p[i];\n\n    if (header_p->magic != JERRY_SNAPSHOT_MAGIC || header_p->version != JERRY_SNAPSHOT_VERSION\n        || !snapshot_check_global_flags (header_p->global_flags))\n    {\n      *error_p = \"invalid snapshot version or unsupported features present\";\n      ecma_collection_destroy (lit_pool_p);\n      return 0;\n    }\n\n    merged_global_flags |= header_p->global_flags;\n\n    uint32_t start_offset = header_p->func_offsets[0];\n    const uint8_t *data_p = (const uint8_t *) inp_buffers_p[i];\n    const uint8_t *literal_base_p = data_p + header_p->lit_table_offset;\n\n    JERRY_ASSERT (header_p->number_of_funcs > 0);\n\n    number_of_funcs += header_p->number_of_funcs;\n    functions_size += header_p->lit_table_offset - start_offset;\n\n    scan_snapshot_functions (data_p + start_offset, literal_base_p, lit_pool_p, literal_base_p);\n  }\n\n  JERRY_ASSERT (number_of_funcs > 0);\n\n  functions_size += JERRY_ALIGNUP ((number_of_funcs - 1) * sizeof (uint32_t), JMEM_ALIGNMENT);\n\n  if (functions_size >= out_buffer_size)\n  {\n    *error_p = \"output buffer is too small\";\n    ecma_collection_destroy (lit_pool_p);\n    return 0;\n  }\n\n  jerry_snapshot_header_t *header_p = (jerry_snapshot_header_t *) out_buffer_p;\n\n  header_p->magic = JERRY_SNAPSHOT_MAGIC;\n  header_p->version = JERRY_SNAPSHOT_VERSION;\n  header_p->global_flags = merged_global_flags;\n  header_p->lit_table_offset = (uint32_t) functions_size;\n  header_p->number_of_funcs = number_of_funcs;\n\n  lit_mem_to_snapshot_id_map_entry_t *lit_map_p;\n  uint32_t literals_num;\n\n  if (!ecma_save_literals_for_snapshot (lit_pool_p,\n                                        out_buffer_p,\n                                        out_buffer_size,\n                                        &functions_size,\n                                        &lit_map_p,\n                                        &literals_num))\n  {\n    *error_p = \"buffer is too small\";\n    return 0;\n  }\n\n  uint32_t *func_offset_p = header_p->func_offsets;\n  uint8_t *dst_p = ((uint8_t *) out_buffer_p) + sizeof (jerry_snapshot_header_t);\n  dst_p += JERRY_ALIGNUP ((number_of_funcs - 1) * sizeof (uint32_t), JMEM_ALIGNMENT);\n\n  for (uint32_t i = 0; i < number_of_snapshots; i++)\n  {\n    const jerry_snapshot_header_t *current_header_p = (const jerry_snapshot_header_t *) inp_buffers_p[i];\n\n    uint32_t start_offset = current_header_p->func_offsets[0];\n\n    memcpy (dst_p,\n            ((const uint8_t *) inp_buffers_p[i]) + start_offset,\n            current_header_p->lit_table_offset - start_offset);\n\n    const uint8_t *literal_base_p = ((const uint8_t *) inp_buffers_p[i]) + current_header_p->lit_table_offset;\n    update_literal_offsets (dst_p,\n                            dst_p + current_header_p->lit_table_offset - start_offset,\n                            lit_map_p,\n                            literal_base_p);\n\n    uint32_t current_offset = (uint32_t) (dst_p - (uint8_t *) out_buffer_p) - start_offset;\n\n    for (uint32_t j = 0; j < current_header_p->number_of_funcs; j++)\n    {\n      /* Updating offset without changing any flags. */\n      *func_offset_p++ = current_header_p->func_offsets[j] + current_offset;\n    }\n\n    dst_p += current_header_p->lit_table_offset - start_offset;\n  }\n\n  JERRY_ASSERT ((uint32_t) (dst_p - (uint8_t *) out_buffer_p) == header_p->lit_table_offset);\n\n  if (lit_map_p != NULL)\n  {\n    jmem_heap_free_block (lit_map_p, literals_num * sizeof (lit_mem_to_snapshot_id_map_entry_t));\n  }\n\n  *error_p = NULL;\n  return functions_size;\n#else /* !JERRY_SNAPSHOT_SAVE */\n  JERRY_UNUSED (inp_buffers_p);\n  JERRY_UNUSED (inp_buffer_sizes_p);\n  JERRY_UNUSED (number_of_snapshots);\n  JERRY_UNUSED (out_buffer_p);\n  JERRY_UNUSED (out_buffer_size);\n  JERRY_UNUSED (error_p);\n\n  *error_p = \"snapshot merge not supported\";\n  return 0;\n#endif /* JERRY_SNAPSHOT_SAVE */\n} /* jerry_merge_snapshots */\n\n#if JERRY_SNAPSHOT_SAVE\n\n/**\n * ====================== Functions for literal saving ==========================\n */\n\n/**\n * Compare two ecma_strings by size, then lexicographically.\n *\n * @return true - if the first string is less than the second one,\n *         false - otherwise\n */\nstatic bool\njerry_save_literals_compare (ecma_string_t *literal1, /**< first literal */\n                             ecma_string_t *literal2) /**< second literal */\n{\n  const lit_utf8_size_t lit1_size = ecma_string_get_size (literal1);\n  const lit_utf8_size_t lit2_size = ecma_string_get_size (literal2);\n\n  if (lit1_size == lit2_size)\n  {\n    return ecma_compare_ecma_strings_relational (literal1, literal2);\n  }\n\n  return (lit1_size < lit2_size);\n} /* jerry_save_literals_compare */\n\n/**\n * Helper function for the heapsort algorithm.\n *\n * @return index of the maximum value\n */\nstatic lit_utf8_size_t\njerry_save_literals_heap_max (ecma_string_t *literals[], /**< array of literals */\n                              lit_utf8_size_t num_of_nodes, /**< number of nodes */\n                              lit_utf8_size_t node_idx, /**< index of parent node */\n                              lit_utf8_size_t child_idx1, /**< index of the first child */\n                              lit_utf8_size_t child_idx2) /**< index of the second child */\n{\n  lit_utf8_size_t max_idx = node_idx;\n\n  if (child_idx1 < num_of_nodes && jerry_save_literals_compare (literals[max_idx], literals[child_idx1]))\n  {\n    max_idx = child_idx1;\n  }\n\n  if (child_idx2 < num_of_nodes && jerry_save_literals_compare (literals[max_idx], literals[child_idx2]))\n  {\n    max_idx = child_idx2;\n  }\n\n  return max_idx;\n} /* jerry_save_literals_heap_max */\n\n/**\n * Helper function for the heapsort algorithm.\n */\nstatic void\njerry_save_literals_down_heap (ecma_string_t *literals[], /**< array of literals */\n                               lit_utf8_size_t num_of_nodes, /**< number of nodes */\n                               lit_utf8_size_t node_idx) /**< index of parent node */\n{\n  while (true)\n  {\n    lit_utf8_size_t max_idx =\n      jerry_save_literals_heap_max (literals, num_of_nodes, node_idx, 2 * node_idx + 1, 2 * node_idx + 2);\n    if (max_idx == node_idx)\n    {\n      break;\n    }\n\n    ecma_string_t *tmp_str_p = literals[node_idx];\n    literals[node_idx] = literals[max_idx];\n    literals[max_idx] = tmp_str_p;\n\n    node_idx = max_idx;\n  }\n} /* jerry_save_literals_down_heap */\n\n/**\n * Helper function for a heapsort algorithm.\n */\nstatic void\njerry_save_literals_sort (ecma_string_t *literals[], /**< array of literals */\n                          lit_utf8_size_t num_of_literals) /**< number of literals */\n{\n  if (num_of_literals < 2)\n  {\n    return;\n  }\n\n  lit_utf8_size_t lit_idx = (num_of_literals - 2) / 2;\n\n  while (lit_idx <= (num_of_literals - 2) / 2)\n  {\n    jerry_save_literals_down_heap (literals, num_of_literals, lit_idx--);\n  }\n\n  for (lit_idx = 0; lit_idx < num_of_literals; lit_idx++)\n  {\n    const lit_utf8_size_t last_idx = num_of_literals - lit_idx - 1;\n\n    ecma_string_t *tmp_str_p = literals[last_idx];\n    literals[last_idx] = literals[0];\n    literals[0] = tmp_str_p;\n\n    jerry_save_literals_down_heap (literals, last_idx, 0);\n  }\n} /* jerry_save_literals_sort */\n\n/**\n * Append characters to the specified buffer.\n *\n * @return the position of the buffer pointer after copy.\n */\nstatic uint8_t *\njerry_append_chars_to_buffer (uint8_t *buffer_p, /**< buffer */\n                              uint8_t *buffer_end_p, /**< the end of the buffer */\n                              const jerry_char_t *chars, /**< string */\n                              jerry_size_t string_size) /**< string size */\n{\n  if (buffer_p > buffer_end_p)\n  {\n    return buffer_p;\n  }\n\n  if (buffer_p + string_size <= buffer_end_p)\n  {\n    memcpy ((char *) buffer_p, (const char *) chars, string_size);\n\n    return buffer_p + string_size;\n  }\n\n  /* Move the pointer behind the buffer to prevent further writes. */\n  return buffer_end_p + 1;\n} /* jerry_append_chars_to_buffer */\n\n/**\n * Append an ecma-string to the specified buffer.\n *\n * @return the position of the buffer pointer after copy.\n */\nstatic uint8_t *\njerry_append_ecma_string_to_buffer (uint8_t *buffer_p, /**< buffer */\n                                    uint8_t *buffer_end_p, /**< the end of the buffer */\n                                    ecma_string_t *string_p) /**< ecma-string */\n{\n  ECMA_STRING_TO_UTF8_STRING (string_p, str_buffer_p, str_buffer_size);\n\n  /* Append the string to the buffer. */\n  uint8_t *new_buffer_p = jerry_append_chars_to_buffer (buffer_p,\n                                                        buffer_end_p,\n                                                        (const jerry_char_t *) str_buffer_p,\n                                                        (jerry_size_t) str_buffer_size);\n\n  ECMA_FINALIZE_UTF8_STRING (str_buffer_p, str_buffer_size);\n\n  return new_buffer_p;\n} /* jerry_append_ecma_string_to_buffer */\n\n/**\n * Append an unsigned number to the specified buffer.\n *\n * @return the position of the buffer pointer after copy.\n */\nstatic uint8_t *\njerry_append_number_to_buffer (uint8_t *buffer_p, /**< buffer */\n                               uint8_t *buffer_end_p, /**< the end of the buffer */\n                               lit_utf8_size_t number) /**< number */\n{\n  lit_utf8_byte_t uint32_to_str_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];\n  lit_utf8_size_t utf8_str_size =\n    ecma_uint32_to_utf8_string (number, uint32_to_str_buffer, ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);\n\n  JERRY_ASSERT (utf8_str_size <= ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);\n\n  return jerry_append_chars_to_buffer (buffer_p,\n                                       buffer_end_p,\n                                       (const jerry_char_t *) uint32_to_str_buffer,\n                                       (jerry_size_t) utf8_str_size);\n} /* jerry_append_number_to_buffer */\n\n#endif /* JERRY_SNAPSHOT_SAVE */\n\n/**\n * Get the literals from a snapshot. Copies certain string literals into the given\n * buffer in a specified format.\n *\n * Note:\n *      Only valid identifiers are saved in C format.\n *\n * @return size of the literal-list in bytes, at most equal to the buffer size,\n *         if the list of the literals isn't empty,\n *         0 - otherwise.\n */\nsize_t\njerry_get_literals_from_snapshot (const uint32_t *snapshot_p, /**< input snapshot buffer */\n                                  size_t snapshot_size, /**< size of the input snapshot buffer */\n                                  jerry_char_t *lit_buf_p, /**< [out] buffer to save literals to */\n                                  size_t lit_buf_size, /**< the buffer's size */\n                                  bool is_c_format) /**< format-flag */\n{\n#if JERRY_SNAPSHOT_SAVE\n  const uint8_t *snapshot_data_p = (uint8_t *) snapshot_p;\n  const jerry_snapshot_header_t *header_p = (const jerry_snapshot_header_t *) snapshot_data_p;\n\n  if (snapshot_size <= sizeof (jerry_snapshot_header_t) || header_p->magic != JERRY_SNAPSHOT_MAGIC\n      || header_p->version != JERRY_SNAPSHOT_VERSION || !snapshot_check_global_flags (header_p->global_flags))\n  {\n    /* Invalid snapshot format */\n    return 0;\n  }\n\n  JERRY_ASSERT ((header_p->lit_table_offset % sizeof (uint32_t)) == 0);\n  const uint8_t *literal_base_p = snapshot_data_p + header_p->lit_table_offset;\n\n  ecma_collection_t *lit_pool_p = ecma_new_collection ();\n  scan_snapshot_functions (snapshot_data_p + header_p->func_offsets[0], literal_base_p, lit_pool_p, literal_base_p);\n\n  lit_utf8_size_t literal_count = 0;\n  ecma_value_t *buffer_p = lit_pool_p->buffer_p;\n\n  /* Count the valid and non-magic identifiers in the list. */\n  for (uint32_t i = 0; i < lit_pool_p->item_count; i++)\n  {\n    if (ecma_is_value_string (buffer_p[i]))\n    {\n      ecma_string_t *literal_p = ecma_get_string_from_value (buffer_p[i]);\n\n      if (ecma_get_string_magic (literal_p) == LIT_MAGIC_STRING__COUNT)\n      {\n        literal_count++;\n      }\n    }\n  }\n\n  if (literal_count == 0)\n  {\n    ecma_collection_destroy (lit_pool_p);\n    return 0;\n  }\n\n  jerry_char_t *const buffer_start_p = lit_buf_p;\n  jerry_char_t *const buffer_end_p = lit_buf_p + lit_buf_size;\n\n  JMEM_DEFINE_LOCAL_ARRAY (literal_array, literal_count, ecma_string_t *);\n  lit_utf8_size_t literal_idx = 0;\n\n  buffer_p = lit_pool_p->buffer_p;\n\n  /* Count the valid and non-magic identifiers in the list. */\n  for (uint32_t i = 0; i < lit_pool_p->item_count; i++)\n  {\n    if (ecma_is_value_string (buffer_p[i]))\n    {\n      ecma_string_t *literal_p = ecma_get_string_from_value (buffer_p[i]);\n\n      if (ecma_get_string_magic (literal_p) == LIT_MAGIC_STRING__COUNT)\n      {\n        literal_array[literal_idx++] = literal_p;\n      }\n    }\n  }\n\n  ecma_collection_destroy (lit_pool_p);\n\n  /* Sort the strings by size at first, then lexicographically. */\n  jerry_save_literals_sort (literal_array, literal_count);\n\n  if (is_c_format)\n  {\n    /* Save literal count. */\n    lit_buf_p =\n      jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"jerry_length_t literal_count = \"));\n\n    lit_buf_p = jerry_append_number_to_buffer (lit_buf_p, buffer_end_p, literal_count);\n\n    /* Save the array of literals. */\n    lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\";\\n\\njerry_char_t *literals[\"));\n\n    lit_buf_p = jerry_append_number_to_buffer (lit_buf_p, buffer_end_p, literal_count);\n    lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"] =\\n{\\n\"));\n\n    for (lit_utf8_size_t i = 0; i < literal_count; i++)\n    {\n      lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"  \\\"\"));\n      ECMA_STRING_TO_UTF8_STRING (literal_array[i], str_buffer_p, str_buffer_size);\n      for (lit_utf8_size_t j = 0; j < str_buffer_size; j++)\n      {\n        uint8_t byte = str_buffer_p[j];\n        if (byte < 32 || byte > 127)\n        {\n          lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"\\\\x\"));\n          ecma_char_t hex_digit = (ecma_char_t) (byte >> 4);\n          *lit_buf_p++ = (lit_utf8_byte_t) ((hex_digit > 9) ? (hex_digit + ('A' - 10)) : (hex_digit + '0'));\n          hex_digit = (lit_utf8_byte_t) (byte & 0xf);\n          *lit_buf_p++ = (lit_utf8_byte_t) ((hex_digit > 9) ? (hex_digit + ('A' - 10)) : (hex_digit + '0'));\n        }\n        else\n        {\n          if (byte == '\\\\' || byte == '\"')\n          {\n            *lit_buf_p++ = '\\\\';\n          }\n          *lit_buf_p++ = byte;\n        }\n      }\n\n      ECMA_FINALIZE_UTF8_STRING (str_buffer_p, str_buffer_size);\n      lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"\\\"\"));\n\n      if (i < literal_count - 1)\n      {\n        lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\",\"));\n      }\n\n      lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"\\n\"));\n    }\n\n    lit_buf_p =\n      jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"};\\n\\njerry_length_t literal_sizes[\"));\n\n    lit_buf_p = jerry_append_number_to_buffer (lit_buf_p, buffer_end_p, literal_count);\n    lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"] =\\n{\\n\"));\n  }\n\n  /* Save the literal sizes respectively. */\n  for (lit_utf8_size_t i = 0; i < literal_count; i++)\n  {\n    lit_utf8_size_t str_size = ecma_string_get_size (literal_array[i]);\n\n    if (is_c_format)\n    {\n      lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"  \"));\n    }\n\n    lit_buf_p = jerry_append_number_to_buffer (lit_buf_p, buffer_end_p, str_size);\n    lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\" \"));\n\n    if (is_c_format)\n    {\n      /* Show the given string as a comment. */\n      lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"/* \"));\n      lit_buf_p = jerry_append_ecma_string_to_buffer (lit_buf_p, buffer_end_p, literal_array[i]);\n      lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\" */\"));\n\n      if (i < literal_count - 1)\n      {\n        lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\",\"));\n      }\n    }\n    else\n    {\n      lit_buf_p = jerry_append_ecma_string_to_buffer (lit_buf_p, buffer_end_p, literal_array[i]);\n    }\n\n    lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"\\n\"));\n  }\n\n  if (is_c_format)\n  {\n    lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, JERRY_ZSTR_ARG (\"};\\n\"));\n  }\n\n  JMEM_FINALIZE_LOCAL_ARRAY (literal_array);\n\n  return lit_buf_p <= buffer_end_p ? (size_t) (lit_buf_p - buffer_start_p) : 0;\n#else /* !JERRY_SNAPSHOT_SAVE */\n  JERRY_UNUSED (snapshot_p);\n  JERRY_UNUSED (snapshot_size);\n  JERRY_UNUSED (lit_buf_p);\n  JERRY_UNUSED (lit_buf_size);\n  JERRY_UNUSED (is_c_format);\n\n  return 0;\n#endif /* JERRY_SNAPSHOT_SAVE */\n} /* jerry_get_literals_from_snapshot */\n\n/**\n * @}\n */\n"
  },
  {
    "path": "jerry-core/api/jerry-snapshot.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRY_SNAPSHOT_H\n#define JERRY_SNAPSHOT_H\n\n#include \"ecma-globals.h\"\n\n/**\n * Snapshot header\n */\ntypedef struct\n{\n  /* The size of this structure is recommended to be divisible by\n   * uint32_t alignment. Otherwise some bytes after the header are wasted. */\n  uint32_t magic; /**< four byte magic number */\n  uint32_t version; /**< version number */\n  uint32_t global_flags; /**< global configuration and feature flags */\n  uint32_t lit_table_offset; /**< byte offset of the literal table */\n  uint32_t number_of_funcs; /**< number of primary ECMAScript functions */\n  uint32_t func_offsets[1]; /**< function offsets (lowest bit: global(0) or eval(1) context) */\n} jerry_snapshot_header_t;\n\n/**\n * Jerry snapshot magic marker.\n */\n#define JERRY_SNAPSHOT_MAGIC (0x5952524Au)\n\n/**\n * Snapshot configuration flags.\n */\ntypedef enum\n{\n  /* 8 bits are reserved for dynamic features */\n  JERRY_SNAPSHOT_HAS_REGEX_LITERAL = (1u << 0), /**< byte code has regex literal */\n  JERRY_SNAPSHOT_HAS_CLASS_LITERAL = (1u << 1), /**< byte code has class literal */\n  /* 24 bits are reserved for compile time features */\n  JERRY_SNAPSHOT_FOUR_BYTE_CPOINTER = (1u << 8) /**< deprecated, an unused placeholder now */\n} jerry_snapshot_global_flags_t;\n\n#endif /* !JERRY_SNAPSHOT_H */\n"
  },
  {
    "path": "jerry-core/api/jerryscript.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include <math.h>\n#include <stdarg.h>\n#include <stdio.h>\n\n#include \"jerryscript-debugger-transport.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-comparison.h\"\n#include \"ecma-container-object.h\"\n#include \"ecma-dataview-object.h\"\n#include \"ecma-errors.h\"\n#include \"ecma-eval.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-extended-info.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-init-finalize.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-line-info.h\"\n#include \"ecma-literal-storage.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-promise-object.h\"\n#include \"ecma-proxy-object.h\"\n#include \"ecma-regexp-object.h\"\n#include \"ecma-shared-arraybuffer-object.h\"\n#include \"ecma-symbol-object.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"debugger.h\"\n#include \"jcontext.h\"\n#include \"jmem.h\"\n#include \"jrt.h\"\n#include \"js-parser.h\"\n#include \"lit-char-helpers.h\"\n#include \"opcodes.h\"\n#include \"re-compiler.h\"\n\nJERRY_STATIC_ASSERT (sizeof (jerry_value_t) == sizeof (ecma_value_t),\n                     size_of_jerry_value_t_must_be_equal_to_size_of_ecma_value_t);\n\n#if JERRY_BUILTIN_REGEXP\nJERRY_STATIC_ASSERT ((int) RE_FLAG_GLOBAL == (int) JERRY_REGEXP_FLAG_GLOBAL\n                       && (int) RE_FLAG_MULTILINE == (int) JERRY_REGEXP_FLAG_MULTILINE\n                       && (int) RE_FLAG_IGNORE_CASE == (int) JERRY_REGEXP_FLAG_IGNORE_CASE\n                       && (int) RE_FLAG_STICKY == (int) JERRY_REGEXP_FLAG_STICKY\n                       && (int) RE_FLAG_UNICODE == (int) JERRY_REGEXP_FLAG_UNICODE\n                       && (int) RE_FLAG_DOTALL == (int) JERRY_REGEXP_FLAG_DOTALL,\n                     re_flags_t_must_be_equal_to_jerry_regexp_flags_t);\n#endif /* JERRY_BUILTIN_REGEXP */\n\n/* The internal ECMA_PROMISE_STATE_* values are \"one byte away\" from the API values */\nJERRY_STATIC_ASSERT ((int) ECMA_PROMISE_IS_PENDING == (int) JERRY_PROMISE_STATE_PENDING\n                       && (int) ECMA_PROMISE_IS_FULFILLED == (int) JERRY_PROMISE_STATE_FULFILLED,\n                     promise_internal_state_matches_external);\n\n/**\n * Offset between internal and external arithmetic operator types\n */\n#define ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET (JERRY_BIN_OP_SUB - NUMBER_ARITHMETIC_SUBTRACTION)\n\nJERRY_STATIC_ASSERT (((NUMBER_ARITHMETIC_SUBTRACTION + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_SUB)\n                       && ((NUMBER_ARITHMETIC_MULTIPLICATION + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET)\n                           == JERRY_BIN_OP_MUL)\n                       && ((NUMBER_ARITHMETIC_DIVISION + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_DIV)\n                       && ((NUMBER_ARITHMETIC_REMAINDER + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_REM),\n                     number_arithmetics_operation_type_matches_external);\n\n#if !JERRY_PARSER && !JERRY_SNAPSHOT_EXEC\n#error \"JERRY_SNAPSHOT_EXEC must be enabled if JERRY_PARSER is disabled!\"\n#endif /* !JERRY_PARSER && !JERRY_SNAPSHOT_EXEC */\n\n/** \\addtogroup jerry Jerry engine interface\n * @{\n */\n\n/**\n * Assert that it is correct to call API in current state.\n *\n * Note:\n *         By convention, there are some states when API could not be invoked.\n *\n *         The API can be and only be invoked when the ECMA_STATUS_API_ENABLED\n *         flag is set.\n *\n *         This procedure checks whether the API is available, and terminates\n *         the engine if it is unavailable. Otherwise it is a no-op.\n *\n * Note:\n *         The API could not be invoked in the following cases:\n *           - before jerry_init and after jerry_cleanup\n *           - between enter to and return from a native free callback\n */\nstatic inline void JERRY_ATTR_ALWAYS_INLINE\njerry_assert_api_enabled (void)\n{\n  JERRY_ASSERT (JERRY_CONTEXT (status_flags) & ECMA_STATUS_API_ENABLED);\n} /* jerry_assert_api_enabled */\n\n/**\n * Turn on API availability\n */\nstatic inline void JERRY_ATTR_ALWAYS_INLINE\njerry_api_enable (void)\n{\n#ifndef JERRY_NDEBUG\n  JERRY_CONTEXT (status_flags) |= ECMA_STATUS_API_ENABLED;\n#endif /* JERRY_NDEBUG */\n} /* jerry_make_api_available */\n\n/**\n * Turn off API availability\n */\nstatic inline void JERRY_ATTR_ALWAYS_INLINE\njerry_api_disable (void)\n{\n#ifndef JERRY_NDEBUG\n  JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_API_ENABLED;\n#endif /* JERRY_NDEBUG */\n} /* jerry_make_api_unavailable */\n\n/**\n * Create an API compatible return value.\n *\n * @return return value for Jerry API functions\n */\nstatic jerry_value_t\njerry_return (const jerry_value_t value) /**< return value */\n{\n  if (ECMA_IS_VALUE_ERROR (value))\n  {\n    return ecma_create_exception_from_context ();\n  }\n\n  return value;\n} /* jerry_return */\n\n/**\n * Jerry engine initialization\n */\nvoid\njerry_init (jerry_init_flag_t flags) /**< combination of Jerry flags */\n{\n  jerry_port_init ();\n#if JERRY_EXTERNAL_CONTEXT\n  size_t total_size = jerry_port_context_alloc (sizeof (jerry_context_t));\n  JERRY_UNUSED (total_size);\n#endif /* JERRY_EXTERNAL_CONTEXT */\n\n  jerry_context_t *context_p = &JERRY_CONTEXT_STRUCT;\n  memset (context_p, 0, sizeof (jerry_context_t));\n\n#if JERRY_EXTERNAL_CONTEXT && !JERRY_SYSTEM_ALLOCATOR\n  uint32_t heap_start_offset = JERRY_ALIGNUP (sizeof (jerry_context_t), JMEM_ALIGNMENT);\n  uint8_t *heap_p = ((uint8_t *) context_p) + heap_start_offset;\n  uint32_t heap_size = JERRY_ALIGNDOWN (total_size - heap_start_offset, JMEM_ALIGNMENT);\n\n  JERRY_ASSERT (heap_p + heap_size <= ((uint8_t *) context_p) + total_size);\n\n  context_p->heap_p = (jmem_heap_t *) heap_p;\n  context_p->heap_size = heap_size;\n#endif /* JERRY_EXTERNAL_CONTEXT && !JERRY_SYSTEM_ALLOCATOR */\n\n  JERRY_CONTEXT (jerry_init_flags) = flags;\n\n  jerry_api_enable ();\n\n  jmem_init ();\n  ecma_init ();\n} /* jerry_init */\n\n/**\n * Terminate Jerry engine\n */\nvoid\njerry_cleanup (void)\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_DEBUGGER\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    jerry_debugger_send_type (JERRY_DEBUGGER_CLOSE_CONNECTION);\n\n    jerry_debugger_transport_close ();\n  }\n#endif /* JERRY_DEBUGGER */\n\n  for (jerry_context_data_header_t *this_p = JERRY_CONTEXT (context_data_p); this_p != NULL; this_p = this_p->next_p)\n  {\n    if (this_p->manager_p->deinit_cb)\n    {\n      void *data = (this_p->manager_p->bytes_needed > 0) ? JERRY_CONTEXT_DATA_HEADER_USER_DATA (this_p) : NULL;\n      this_p->manager_p->deinit_cb (data);\n    }\n  }\n\n  ecma_free_all_enqueued_jobs ();\n  ecma_finalize ();\n  jerry_api_disable ();\n\n  for (jerry_context_data_header_t *this_p = JERRY_CONTEXT (context_data_p), *next_p = NULL; this_p != NULL;\n       this_p = next_p)\n  {\n    next_p = this_p->next_p;\n\n    if (this_p->manager_p->finalize_cb)\n    {\n      void *data = (this_p->manager_p->bytes_needed > 0) ? JERRY_CONTEXT_DATA_HEADER_USER_DATA (this_p) : NULL;\n      this_p->manager_p->finalize_cb (data);\n    }\n\n    jmem_heap_free_block (this_p, sizeof (jerry_context_data_header_t) + this_p->manager_p->bytes_needed);\n  }\n\n  jmem_finalize ();\n#if JERRY_EXTERNAL_CONTEXT\n  jerry_port_context_free ();\n#endif /* JERRY_EXTERNAL_CONTEXT */\n} /* jerry_cleanup */\n\n/**\n * Retrieve a context data item, or create a new one.\n *\n * @param manager_p pointer to the manager whose context data item should be returned.\n *\n * @return a pointer to the user-provided context-specific data item for the given manager, creating such a pointer if\n * none was found.\n */\nvoid *\njerry_context_data (const jerry_context_data_manager_t *manager_p)\n{\n  void *ret = NULL;\n  jerry_context_data_header_t *item_p;\n\n  for (item_p = JERRY_CONTEXT (context_data_p); item_p != NULL; item_p = item_p->next_p)\n  {\n    if (item_p->manager_p == manager_p)\n    {\n      return (manager_p->bytes_needed > 0) ? JERRY_CONTEXT_DATA_HEADER_USER_DATA (item_p) : NULL;\n    }\n  }\n\n  item_p = jmem_heap_alloc_block (sizeof (jerry_context_data_header_t) + manager_p->bytes_needed);\n  item_p->manager_p = manager_p;\n  item_p->next_p = JERRY_CONTEXT (context_data_p);\n  JERRY_CONTEXT (context_data_p) = item_p;\n\n  if (manager_p->bytes_needed > 0)\n  {\n    ret = JERRY_CONTEXT_DATA_HEADER_USER_DATA (item_p);\n    memset (ret, 0, manager_p->bytes_needed);\n  }\n\n  if (manager_p->init_cb)\n  {\n    manager_p->init_cb (ret);\n  }\n\n  return ret;\n} /* jerry_context_data */\n\n/**\n * Register external magic string array\n */\nvoid\njerry_register_magic_strings (const jerry_char_t *const *ext_strings_p, /**< character arrays, representing\n                                                                         *   external magic strings' contents */\n                              uint32_t count, /**< number of the strings */\n                              const jerry_length_t *str_lengths_p) /**< lengths of all strings */\n{\n  jerry_assert_api_enabled ();\n\n  lit_magic_strings_ex_set ((const lit_utf8_byte_t *const *) ext_strings_p,\n                            count,\n                            (const lit_utf8_size_t *) str_lengths_p);\n} /* jerry_register_magic_strings */\n\n/**\n * Run garbage collection\n */\nvoid\njerry_heap_gc (jerry_gc_mode_t mode) /**< operational mode */\n{\n  jerry_assert_api_enabled ();\n\n  if (mode == JERRY_GC_PRESSURE_LOW)\n  {\n    /* Call GC directly, because 'ecma_free_unused_memory' might decide it's not yet worth it. */\n    ecma_gc_run ();\n    return;\n  }\n\n  ecma_free_unused_memory (JMEM_PRESSURE_HIGH);\n} /* jerry_heap_gc */\n\n/**\n * Get heap memory stats.\n *\n * @return true - get the heap stats successful\n *         false - otherwise. Usually it is because the MEM_STATS feature is not enabled.\n */\nbool\njerry_heap_stats (jerry_heap_stats_t *out_stats_p) /**< [out] heap memory stats */\n{\n#if JERRY_MEM_STATS\n  if (out_stats_p == NULL)\n  {\n    return false;\n  }\n\n  jmem_heap_stats_t jmem_heap_stats;\n  memset (&jmem_heap_stats, 0, sizeof (jmem_heap_stats));\n  jmem_heap_get_stats (&jmem_heap_stats);\n\n  *out_stats_p = (jerry_heap_stats_t){ .version = 1,\n                                       .size = jmem_heap_stats.size,\n                                       .allocated_bytes = jmem_heap_stats.allocated_bytes,\n                                       .peak_allocated_bytes = jmem_heap_stats.peak_allocated_bytes };\n\n  return true;\n#else /* !JERRY_MEM_STATS */\n  JERRY_UNUSED (out_stats_p);\n  return false;\n#endif /* JERRY_MEM_STATS */\n} /* jerry_heap_stats */\n\n#if JERRY_PARSER\n/**\n * Common code for parsing a script, module, or function.\n *\n * @return function object value - if script was parsed successfully,\n *         thrown error - otherwise\n */\nstatic jerry_value_t\njerry_parse_common (void *source_p, /**< script source */\n                    const jerry_parse_options_t *options_p, /**< parsing options, can be NULL if not used */\n                    uint32_t parse_opts) /**< internal parsing options */\n{\n  jerry_assert_api_enabled ();\n\n  if (options_p != NULL)\n  {\n    const uint32_t allowed_options =\n      (JERRY_PARSE_STRICT_MODE | JERRY_PARSE_MODULE | JERRY_PARSE_HAS_ARGUMENT_LIST | JERRY_PARSE_HAS_SOURCE_NAME\n       | JERRY_PARSE_HAS_START | JERRY_PARSE_HAS_USER_VALUE);\n    uint32_t options = options_p->options;\n\n    if ((options & ~allowed_options) != 0\n        || ((options_p->options & JERRY_PARSE_HAS_ARGUMENT_LIST)\n            && ((options_p->options & JERRY_PARSE_MODULE) || !ecma_is_value_string (options_p->argument_list)))\n        || ((options_p->options & JERRY_PARSE_HAS_SOURCE_NAME) && !ecma_is_value_string (options_p->source_name)))\n    {\n      return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n    }\n  }\n\n#if JERRY_DEBUGGER\n  if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) && options_p != NULL\n      && (options_p->options & JERRY_PARSE_HAS_SOURCE_NAME) && ecma_is_value_string (options_p->source_name))\n  {\n    ECMA_STRING_TO_UTF8_STRING (ecma_get_string_from_value (options_p->source_name),\n                                source_name_start_p,\n                                source_name_size);\n    jerry_debugger_send_string (JERRY_DEBUGGER_SOURCE_CODE_NAME,\n                                JERRY_DEBUGGER_NO_SUBTYPE,\n                                source_name_start_p,\n                                source_name_size);\n    ECMA_FINALIZE_UTF8_STRING (source_name_start_p, source_name_size);\n  }\n#endif /* JERRY_DEBUGGER */\n\n  if (options_p != NULL)\n  {\n    parse_opts |= options_p->options & (JERRY_PARSE_STRICT_MODE | JERRY_PARSE_MODULE);\n  }\n\n  if ((parse_opts & JERRY_PARSE_MODULE) != 0)\n  {\n#if JERRY_MODULE_SYSTEM\n    JERRY_CONTEXT (module_current_p) = ecma_module_create ();\n#else /* !JERRY_MODULE_SYSTEM */\n    return jerry_throw_sz (JERRY_ERROR_SYNTAX, ecma_get_error_msg (ECMA_ERR_MODULE_NOT_SUPPORTED));\n#endif /* JERRY_MODULE_SYSTEM */\n  }\n\n  ecma_compiled_code_t *bytecode_data_p;\n  bytecode_data_p = parser_parse_script (source_p, parse_opts, options_p);\n\n  if (JERRY_UNLIKELY (bytecode_data_p == NULL))\n  {\n#if JERRY_MODULE_SYSTEM\n    if ((parse_opts & JERRY_PARSE_MODULE) != 0)\n    {\n      ecma_module_cleanup_context ();\n    }\n#endif /* JERRY_MODULE_SYSTEM */\n\n    return ecma_create_exception_from_context ();\n  }\n\n#if JERRY_MODULE_SYSTEM\n  if (JERRY_UNLIKELY (parse_opts & JERRY_PARSE_MODULE))\n  {\n    ecma_module_t *module_p = JERRY_CONTEXT (module_current_p);\n    module_p->u.compiled_code_p = bytecode_data_p;\n\n    JERRY_CONTEXT (module_current_p) = NULL;\n\n    return ecma_make_object_value ((ecma_object_t *) module_p);\n  }\n#endif /* JERRY_MODULE_SYSTEM */\n\n  if (JERRY_UNLIKELY (options_p != NULL && (options_p->options & JERRY_PARSE_HAS_ARGUMENT_LIST)))\n  {\n    ecma_object_t *global_object_p = ecma_builtin_get_global ();\n\n#if JERRY_BUILTIN_REALMS\n    JERRY_ASSERT (global_object_p == (ecma_object_t *) ecma_op_function_get_realm (bytecode_data_p));\n#endif /* JERRY_BUILTIN_REALMS */\n\n    ecma_object_t *lex_env_p = ecma_get_global_environment (global_object_p);\n    ecma_object_t *func_obj_p = ecma_op_create_simple_function_object (lex_env_p, bytecode_data_p);\n    ecma_bytecode_deref (bytecode_data_p);\n\n    return ecma_make_object_value (func_obj_p);\n  }\n\n  ecma_object_t *object_p = ecma_create_object (NULL, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_SCRIPT;\n  ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p->u.cls.u3.value, bytecode_data_p);\n\n  return ecma_make_object_value (object_p);\n} /* jerry_parse_common */\n\n#endif /* JERRY_PARSER */\n\n/**\n * Parse a script, module, or function and create a compiled code using a character string\n *\n * @return function object value - if script was parsed successfully,\n *         thrown error - otherwise\n */\njerry_value_t\njerry_parse (const jerry_char_t *source_p, /**< script source */\n             size_t source_size, /**< script source size */\n             const jerry_parse_options_t *options_p) /**< parsing options, can be NULL if not used */\n{\n#if JERRY_PARSER\n  parser_source_char_t source_char;\n  source_char.source_p = source_p;\n  source_char.source_size = source_size;\n\n  return jerry_parse_common ((void *) &source_char, options_p, JERRY_PARSE_NO_OPTS);\n#else /* !JERRY_PARSER */\n  JERRY_UNUSED (source_p);\n  JERRY_UNUSED (source_size);\n  JERRY_UNUSED (options_p);\n\n  return jerry_throw_sz (JERRY_ERROR_SYNTAX, ecma_get_error_msg (ECMA_ERR_PARSER_NOT_SUPPORTED));\n#endif /* JERRY_PARSER */\n} /* jerry_parse */\n\n/**\n * Parse a script, module, or function and create a compiled code using a string value\n *\n * @return function object value - if script was parsed successfully,\n *         thrown error - otherwise\n */\njerry_value_t\njerry_parse_value (const jerry_value_t source, /**< script source */\n                   const jerry_parse_options_t *options_p) /**< parsing options, can be NULL if not used */\n{\n#if JERRY_PARSER\n  if (!ecma_is_value_string (source))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  return jerry_parse_common ((void *) &source, options_p, ECMA_PARSE_HAS_SOURCE_VALUE);\n#else /* !JERRY_PARSER */\n  JERRY_UNUSED (source);\n  JERRY_UNUSED (options_p);\n\n  return jerry_throw_sz (JERRY_ERROR_SYNTAX, ecma_get_error_msg (ECMA_ERR_PARSER_NOT_SUPPORTED));\n#endif /* JERRY_PARSER */\n} /* jerry_parse_value */\n\n/**\n * Run a Script or Module created by jerry_parse.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return result of bytecode - if run was successful\n *         thrown error - otherwise\n */\njerry_value_t\njerry_run (const jerry_value_t script) /**< script or module to run */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (script))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (script);\n\n  if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SCRIPT))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n  const ecma_compiled_code_t *bytecode_data_p;\n  bytecode_data_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);\n\n  JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_SCRIPT);\n\n  return jerry_return (vm_run_global (bytecode_data_p, object_p));\n} /* jerry_run */\n\n/**\n * Perform eval\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return result of eval, may be error value.\n */\njerry_value_t\njerry_eval (const jerry_char_t *source_p, /**< source code */\n            size_t source_size, /**< length of source code */\n            uint32_t flags) /**< jerry_parse_opts_t flags */\n{\n  jerry_assert_api_enabled ();\n\n  uint32_t allowed_parse_options = JERRY_PARSE_STRICT_MODE;\n\n  if ((flags & ~allowed_parse_options) != 0)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  parser_source_char_t source_char;\n  source_char.source_p = source_p;\n  source_char.source_size = source_size;\n\n  return jerry_return (ecma_op_eval_chars_buffer ((void *) &source_char, flags));\n} /* jerry_eval */\n\n/**\n * Link modules to their dependencies. The dependencies are resolved by a user callback.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return true - if linking is successful, error - otherwise\n */\njerry_value_t\njerry_module_link (const jerry_value_t module, /**< root module */\n                   jerry_module_resolve_cb_t callback, /**< resolve module callback, uses\n                                                        *   jerry_module_resolve when NULL is passed */\n                   void *user_p) /**< pointer passed to the resolve callback */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  if (callback == NULL)\n  {\n    callback = jerry_module_resolve;\n  }\n\n  ecma_module_t *module_p = ecma_module_get_resolved_module (module);\n\n  if (module_p == NULL)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_NOT_MODULE));\n  }\n\n  return jerry_return (ecma_module_link (module_p, callback, user_p));\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (module);\n  JERRY_UNUSED (callback);\n  JERRY_UNUSED (user_p);\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_MODULE_NOT_SUPPORTED));\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_module_link */\n\n/**\n * Evaluate a module and its dependencies. The module must be in linked state.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return result of module bytecode execution - if evaluation was successful\n *         error - otherwise\n */\njerry_value_t\njerry_module_evaluate (const jerry_value_t module) /**< root module */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  ecma_module_t *module_p = ecma_module_get_resolved_module (module);\n\n  if (module_p == NULL)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_NOT_MODULE));\n  }\n\n  if (module_p->header.u.cls.u1.module_state != JERRY_MODULE_STATE_LINKED)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_MODULE_MUST_BE_IN_LINKED_STATE));\n  }\n\n  return jerry_return (ecma_module_evaluate (module_p));\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (module);\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_MODULE_NOT_SUPPORTED));\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_module_evaluate */\n\n/**\n * Returns the current status of a module\n *\n * @return current status - if module is a module,\n *         JERRY_MODULE_STATE_INVALID - otherwise\n */\njerry_module_state_t\njerry_module_state (const jerry_value_t module) /**< module object */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  ecma_module_t *module_p = ecma_module_get_resolved_module (module);\n\n  if (module_p == NULL)\n  {\n    return JERRY_MODULE_STATE_INVALID;\n  }\n\n  return (jerry_module_state_t) module_p->header.u.cls.u1.module_state;\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (module);\n\n  return JERRY_MODULE_STATE_INVALID;\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_module_state */\n\n/**\n * Sets a callback which is called after a module state is changed to linked, evaluated, or error.\n */\nvoid\njerry_module_on_state_changed (jerry_module_state_changed_cb_t callback, /**< callback */\n                               void *user_p) /**< pointer passed to the callback */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  JERRY_CONTEXT (module_state_changed_callback_p) = callback;\n  JERRY_CONTEXT (module_state_changed_callback_user_p) = user_p;\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (callback);\n  JERRY_UNUSED (user_p);\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_module_on_state_changed */\n\n/**\n * Sets a callback which is called when an import.meta expression of a module is evaluated the first time.\n */\nvoid\njerry_module_on_import_meta (jerry_module_import_meta_cb_t callback, /**< callback */\n                             void *user_p) /**< pointer passed to the callback */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  JERRY_CONTEXT (module_import_meta_callback_p) = callback;\n  JERRY_CONTEXT (module_import_meta_callback_user_p) = user_p;\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (callback);\n  JERRY_UNUSED (user_p);\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_module_on_import_meta */\n\n/**\n * Returns the number of import/export requests of a module\n *\n * @return number of import/export requests of a module\n */\nsize_t\njerry_module_request_count (const jerry_value_t module) /**< module */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  ecma_module_t *module_p = ecma_module_get_resolved_module (module);\n\n  if (module_p == NULL)\n  {\n    return 0;\n  }\n\n  size_t number_of_requests = 0;\n\n  ecma_module_node_t *node_p = module_p->imports_p;\n\n  while (node_p != NULL)\n  {\n    number_of_requests++;\n    node_p = node_p->next_p;\n  }\n\n  return number_of_requests;\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (module);\n\n  return 0;\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_module_request_count */\n\n/**\n * Returns the module request specified by the request_index argument\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return string - if the request has not been resolved yet,\n *         module object - if the request has been resolved successfully,\n *         error - otherwise\n */\njerry_value_t\njerry_module_request (const jerry_value_t module, /**< module */\n                      size_t request_index) /**< request index */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  ecma_module_t *module_p = ecma_module_get_resolved_module (module);\n\n  if (module_p == NULL)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_NOT_MODULE));\n  }\n\n  ecma_module_node_t *node_p = module_p->imports_p;\n\n  while (node_p != NULL)\n  {\n    if (request_index == 0)\n    {\n      return ecma_copy_value (node_p->u.path_or_module);\n    }\n\n    --request_index;\n    node_p = node_p->next_p;\n  }\n\n  return jerry_throw_sz (JERRY_ERROR_RANGE, ecma_get_error_msg (ECMA_ERR_REQUEST_IS_NOT_AVAILABLE));\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (module);\n  JERRY_UNUSED (request_index);\n\n  return jerry_throw_sz (JERRY_ERROR_RANGE, ecma_get_error_msg (ECMA_ERR_MODULE_NOT_SUPPORTED));\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_module_request */\n\n/**\n * Returns the namespace object of a module\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return object - if namespace object is available,\n *         error - otherwise\n */\njerry_value_t\njerry_module_namespace (const jerry_value_t module) /**< module */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  ecma_module_t *module_p = ecma_module_get_resolved_module (module);\n\n  if (module_p == NULL)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_NOT_MODULE));\n  }\n\n  if (module_p->header.u.cls.u1.module_state < JERRY_MODULE_STATE_LINKED\n      || module_p->header.u.cls.u1.module_state > JERRY_MODULE_STATE_EVALUATED)\n  {\n    return jerry_throw_sz (JERRY_ERROR_RANGE, ecma_get_error_msg (ECMA_ERR_NAMESPACE_OBJECT_IS_NOT_AVAILABLE));\n  }\n\n  JERRY_ASSERT (module_p->namespace_object_p != NULL);\n\n  ecma_ref_object (module_p->namespace_object_p);\n  return ecma_make_object_value (module_p->namespace_object_p);\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (module);\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_MODULE_NOT_SUPPORTED));\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_module_namespace */\n\n/**\n * Sets the callback which is called when dynamic imports are resolved\n */\nvoid\njerry_module_on_import (jerry_module_import_cb_t callback_p, /**< callback which handles\n                                                              *   dynamic import calls */\n                        void *user_p) /**< user pointer passed to the callback */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  JERRY_CONTEXT (module_import_callback_p) = callback_p;\n  JERRY_CONTEXT (module_import_callback_user_p) = user_p;\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (callback_p);\n  JERRY_UNUSED (user_p);\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_module_on_import */\n\n/**\n * Creates a native module with a list of exports. The initial state of the module is linked.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return native module - if the module is successfully created,\n *         error - otherwise\n */\njerry_value_t\njerry_native_module (jerry_native_module_evaluate_cb_t callback, /**< evaluation callback for\n                                                                  *   native modules */\n                     const jerry_value_t *const exports_p, /**< list of the exported bindings of the module,\n                                                            *   must be valid string identifiers */\n                     size_t export_count) /**< number of exports in the exports_p list */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  ecma_object_t *global_object_p = ecma_builtin_get_global ();\n  ecma_object_t *scope_p = ecma_create_decl_lex_env (ecma_get_global_environment (global_object_p));\n  ecma_module_names_t *local_exports_p = NULL;\n\n  for (size_t i = 0; i < export_count; i++)\n  {\n    if (!ecma_is_value_string (exports_p[i]))\n    {\n      ecma_deref_object (scope_p);\n      ecma_module_release_module_names (local_exports_p);\n      return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_MODULE_EXPORTS_MUST_BE_STRING_VALUES));\n    }\n\n    ecma_string_t *name_str_p = ecma_get_string_from_value (exports_p[i]);\n\n    bool valid_identifier = false;\n\n    ECMA_STRING_TO_UTF8_STRING (name_str_p, name_start_p, name_size);\n\n    if (name_size > 0)\n    {\n      const lit_utf8_byte_t *name_p = name_start_p;\n      const lit_utf8_byte_t *name_end_p = name_start_p + name_size;\n      lit_code_point_t code_point;\n\n      lit_utf8_size_t size = lit_read_code_point_from_cesu8 (name_p, name_end_p, &code_point);\n\n      if (lit_code_point_is_identifier_start (code_point))\n      {\n        name_p += size;\n\n        valid_identifier = true;\n\n        while (name_p < name_end_p)\n        {\n          size = lit_read_code_point_from_cesu8 (name_p, name_end_p, &code_point);\n\n          if (!lit_code_point_is_identifier_part (code_point))\n          {\n            valid_identifier = false;\n            break;\n          }\n\n          name_p += size;\n        }\n      }\n    }\n\n    ECMA_FINALIZE_UTF8_STRING (name_start_p, name_size);\n\n    if (!valid_identifier)\n    {\n      ecma_deref_object (scope_p);\n      ecma_module_release_module_names (local_exports_p);\n      return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_MODULE_EXPORTS_MUST_BE_VALID_IDENTIFIERS));\n    }\n\n    if (ecma_find_named_property (scope_p, name_str_p) != NULL)\n    {\n      continue;\n    }\n\n    ecma_create_named_data_property (scope_p, name_str_p, ECMA_PROPERTY_FLAG_WRITABLE, NULL);\n\n    ecma_module_names_t *new_export_p;\n    new_export_p = (ecma_module_names_t *) jmem_heap_alloc_block (sizeof (ecma_module_names_t));\n\n    new_export_p->next_p = local_exports_p;\n    local_exports_p = new_export_p;\n\n    ecma_ref_ecma_string (name_str_p);\n    new_export_p->imex_name_p = name_str_p;\n\n    ecma_ref_ecma_string (name_str_p);\n    new_export_p->local_name_p = name_str_p;\n  }\n\n  ecma_module_t *module_p = ecma_module_create ();\n\n  module_p->header.u.cls.u2.module_flags |= ECMA_MODULE_IS_NATIVE;\n  module_p->scope_p = scope_p;\n  module_p->local_exports_p = local_exports_p;\n  module_p->u.callback = callback;\n\n  ecma_deref_object (scope_p);\n\n  return ecma_make_object_value (&module_p->header.object);\n\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (callback);\n  JERRY_UNUSED (exports_p);\n  JERRY_UNUSED (export_count);\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_MODULE_NOT_SUPPORTED));\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_native_module */\n\n/**\n * Gets the value of an export which belongs to a native module.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the export - if success\n *         error - otherwise\n */\njerry_value_t\njerry_native_module_get (const jerry_value_t native_module, /**< a native module object */\n                         const jerry_value_t export_name) /**< string identifier of the export */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  ecma_module_t *module_p = ecma_module_get_resolved_module (native_module);\n\n  if (module_p == NULL)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_NOT_MODULE));\n  }\n\n  if (!(module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE) || !ecma_is_value_string (export_name))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (module_p->scope_p, ecma_get_string_from_value (export_name));\n\n  if (property_p == NULL)\n  {\n    return jerry_throw_sz (JERRY_ERROR_REFERENCE, ecma_get_error_msg (ECMA_ERR_UNKNOWN_EXPORT));\n  }\n\n  return ecma_copy_value (ECMA_PROPERTY_VALUE_PTR (property_p)->value);\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (native_module);\n  JERRY_UNUSED (export_name);\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_MODULE_NOT_SUPPORTED));\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_native_module_get */\n\n/**\n * Sets the value of an export which belongs to a native module.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return true value - if the operation was successful\n *         error - otherwise\n */\njerry_value_t\njerry_native_module_set (jerry_value_t native_module, /**< a native module object */\n                         const jerry_value_t export_name, /**< string identifier of the export */\n                         const jerry_value_t value) /**< new value of the export */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_MODULE_SYSTEM\n  ecma_module_t *module_p = ecma_module_get_resolved_module (native_module);\n\n  if (module_p == NULL)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_NOT_MODULE));\n  }\n\n  if (!(module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE) || !ecma_is_value_string (export_name)\n      || ecma_is_value_exception (value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (module_p->scope_p, ecma_get_string_from_value (export_name));\n\n  if (property_p == NULL)\n  {\n    return jerry_throw_sz (JERRY_ERROR_REFERENCE, ecma_get_error_msg (ECMA_ERR_UNKNOWN_EXPORT));\n  }\n\n  ecma_named_data_property_assign_value (module_p->scope_p, ECMA_PROPERTY_VALUE_PTR (property_p), value);\n  return ECMA_VALUE_TRUE;\n#else /* !JERRY_MODULE_SYSTEM */\n  JERRY_UNUSED (native_module);\n  JERRY_UNUSED (export_name);\n  JERRY_UNUSED (value);\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_MODULE_NOT_SUPPORTED));\n#endif /* JERRY_MODULE_SYSTEM */\n} /* jerry_native_module_set */\n\n/**\n * Run enqueued microtasks created by Promise or AsyncFunction objects.\n * Tasks are executed until an exception is thrown or all tasks are executed.\n *\n * Note: returned value must be freed with jerry_value_free\n *\n * @return result of last executed job, possibly an exception.\n */\njerry_value_t\njerry_run_jobs (void)\n{\n  jerry_assert_api_enabled ();\n\n  return jerry_return (ecma_process_all_enqueued_jobs ());\n} /* jerry_run_jobs */\n\n/**\n * Get global object\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return api value of global object\n */\njerry_value_t\njerry_current_realm (void)\n{\n  jerry_assert_api_enabled ();\n  ecma_object_t *global_obj_p = ecma_builtin_get_global ();\n  ecma_ref_object (global_obj_p);\n  return ecma_make_object_value (global_obj_p);\n} /* jerry_current_realm */\n\n/**\n * Check if the specified value is an abort value.\n *\n * @return true  - if both the error and abort values are set,\n *         false - otherwise\n */\nbool\njerry_value_is_abort (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_exception (value))\n  {\n    return false;\n  }\n\n  ecma_extended_primitive_t *error_ref_p = ecma_get_extended_primitive_from_value (value);\n\n  return (error_ref_p->refs_and_type & ECMA_ERROR_API_FLAG_ABORT) != 0;\n} /* jerry_value_is_abort */\n\n/**\n * Check if the specified value is an array object value.\n *\n * @return true  - if the specified value is an array object,\n *         false - otherwise\n */\nbool\njerry_value_is_array (const jerry_value_t value) /**< jerry api value */\n{\n  jerry_assert_api_enabled ();\n\n  return (ecma_is_value_object (value)\n          && ecma_get_object_base_type (ecma_get_object_from_value (value)) == ECMA_OBJECT_BASE_TYPE_ARRAY);\n} /* jerry_value_is_array */\n\n/**\n * Check if the specified value is boolean.\n *\n * @return true  - if the specified value is boolean,\n *         false - otherwise\n */\nbool\njerry_value_is_boolean (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_value_boolean (value);\n} /* jerry_value_is_boolean */\n\n/**\n * Check if the specified value is true.\n *\n * @return true  - if the specified value is true\n *         false - otherwise\n */\nbool\njerry_value_is_true (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_value_true (value);\n} /* jerry_value_is_true */\n\n/**\n * Check if the specified value is false.\n *\n * @return true  - if the specified value is false\n *         false - otherwise\n */\nbool\njerry_value_is_false (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_value_false (value);\n} /* jerry_value_is_false */\n\n/**\n * Check if the specified value is a constructor function object value.\n *\n * @return true - if the specified value is a function value that implements [[Construct]],\n *         false - otherwise\n */\nbool\njerry_value_is_constructor (const jerry_value_t value) /**< jerry api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_constructor (value);\n} /* jerry_value_is_constructor */\n\n/**\n * Check if the specified value is an error or abort value.\n *\n * @return true  - if the specified value is an error value,\n *         false - otherwise\n */\nbool\njerry_value_is_exception (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_value_exception (value);\n} /* jerry_value_is_exception */\n\n/**\n * Check if the specified value is a function object value.\n *\n * @return true - if the specified value is callable,\n *         false - otherwise\n */\nbool\njerry_value_is_function (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_op_is_callable (value);\n} /* jerry_value_is_function */\n\n/**\n * Check if the specified value is an async function object value.\n *\n * @return true - if the specified value is an async function,\n *         false - otherwise\n */\nbool\njerry_value_is_async_function (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_object (value))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (value);\n\n    if (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_FUNCTION)\n    {\n      const ecma_compiled_code_t *bytecode_data_p;\n      bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) obj_p);\n      uint16_t type = CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags);\n\n      return (type == CBC_FUNCTION_ASYNC || type == CBC_FUNCTION_ASYNC_ARROW || type == CBC_FUNCTION_ASYNC_GENERATOR);\n    }\n  }\n\n  return false;\n} /* jerry_value_is_async_function */\n\n/**\n * Check if the specified value is number.\n *\n * @return true  - if the specified value is number,\n *         false - otherwise\n */\nbool\njerry_value_is_number (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_value_number (value);\n} /* jerry_value_is_number */\n\n/**\n * Check if the specified value is null.\n *\n * @return true  - if the specified value is null,\n *         false - otherwise\n */\nbool\njerry_value_is_null (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_value_null (value);\n} /* jerry_value_is_null */\n\n/**\n * Check if the specified value is object.\n *\n * @return true  - if the specified value is object,\n *         false - otherwise\n */\nbool\njerry_value_is_object (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_value_object (value);\n} /* jerry_value_is_object */\n\n/**\n * Check if the specified value is promise.\n *\n * @return true  - if the specified value is promise,\n *         false - otherwise\n */\nbool\njerry_value_is_promise (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return (ecma_is_value_object (value) && ecma_is_promise (ecma_get_object_from_value (value)));\n} /* jerry_value_is_promise */\n\n/**\n * Check if the specified value is a proxy object.\n *\n * @return true  - if the specified value is a proxy object,\n *         false - otherwise\n */\nbool\njerry_value_is_proxy (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n#if JERRY_BUILTIN_PROXY\n  return (ecma_is_value_object (value) && ECMA_OBJECT_IS_PROXY (ecma_get_object_from_value (value)));\n#else /* !JERRY_BUILTIN_PROXY */\n  JERRY_UNUSED (value);\n  return false;\n#endif /* JERRY_BUILTIN_PROXY */\n} /* jerry_value_is_proxy */\n\n/**\n * Check if the specified value is string.\n *\n * @return true  - if the specified value is string,\n *         false - otherwise\n */\nbool\njerry_value_is_string (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_value_string (value);\n} /* jerry_value_is_string */\n\n/**\n * Check if the specified value is symbol.\n *\n * @return true  - if the specified value is symbol,\n *         false - otherwise\n */\nbool\njerry_value_is_symbol (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_value_symbol (value);\n} /* jerry_value_is_symbol */\n\n/**\n * Check if the specified value is BigInt.\n *\n * @return true  - if the specified value is BigInt,\n *         false - otherwise\n */\nbool\njerry_value_is_bigint (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_BIGINT\n  return ecma_is_value_bigint (value);\n#else /* !JERRY_BUILTIN_BIGINT */\n  JERRY_UNUSED (value);\n  return false;\n#endif /* JERRY_BUILTIN_BIGINT */\n} /* jerry_value_is_bigint */\n\n/**\n * Check if the specified value is undefined.\n *\n * @return true  - if the specified value is undefined,\n *         false - otherwise\n */\nbool\njerry_value_is_undefined (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_value_undefined (value);\n} /* jerry_value_is_undefined */\n\n/**\n * Perform the base type of the JavaScript value.\n *\n * @return jerry_type_t value\n */\njerry_type_t\njerry_value_type (const jerry_value_t value) /**< input value to check */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (value))\n  {\n    return JERRY_TYPE_EXCEPTION;\n  }\n\n  lit_magic_string_id_t lit_id = ecma_get_typeof_lit_id (value);\n\n  JERRY_ASSERT (lit_id != LIT_MAGIC_STRING__EMPTY);\n\n  switch (lit_id)\n  {\n    case LIT_MAGIC_STRING_UNDEFINED:\n    {\n      return JERRY_TYPE_UNDEFINED;\n    }\n    case LIT_MAGIC_STRING_BOOLEAN:\n    {\n      return JERRY_TYPE_BOOLEAN;\n    }\n    case LIT_MAGIC_STRING_NUMBER:\n    {\n      return JERRY_TYPE_NUMBER;\n    }\n    case LIT_MAGIC_STRING_STRING:\n    {\n      return JERRY_TYPE_STRING;\n    }\n    case LIT_MAGIC_STRING_SYMBOL:\n    {\n      return JERRY_TYPE_SYMBOL;\n    }\n    case LIT_MAGIC_STRING_FUNCTION:\n    {\n      return JERRY_TYPE_FUNCTION;\n    }\n#if JERRY_BUILTIN_BIGINT\n    case LIT_MAGIC_STRING_BIGINT:\n    {\n      return JERRY_TYPE_BIGINT;\n    }\n#endif /* JERRY_BUILTIN_BIGINT */\n    default:\n    {\n      JERRY_ASSERT (lit_id == LIT_MAGIC_STRING_OBJECT);\n\n      /* Based on the ECMA 262 5.1 standard the 'null' value is an object.\n       * Thus we'll do an extra check for 'null' here.\n       */\n      return ecma_is_value_null (value) ? JERRY_TYPE_NULL : JERRY_TYPE_OBJECT;\n    }\n  }\n} /* jerry_value_type */\n\n/**\n * Used by jerry_object_type to get the type of class objects\n */\nstatic const uint8_t jerry_class_object_type[] = {\n  /* These objects require custom property resolving. */\n  JERRY_OBJECT_TYPE_STRING, /**< type of ECMA_OBJECT_CLASS_STRING */\n  JERRY_OBJECT_TYPE_ARGUMENTS, /**< type of ECMA_OBJECT_CLASS_ARGUMENTS */\n#if JERRY_BUILTIN_TYPEDARRAY\n  JERRY_OBJECT_TYPE_TYPEDARRAY, /**< type of ECMA_OBJECT_CLASS_TYPEDARRAY */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_MODULE_SYSTEM\n  JERRY_OBJECT_TYPE_MODULE_NAMESPACE, /**< type of ECMA_OBJECT_CLASS_MODULE_NAMESPACE */\n#endif /* JERRY_MODULE_SYSTEM */\n\n  /* These objects are marked by Garbage Collector. */\n  JERRY_OBJECT_TYPE_GENERATOR, /**< type of ECMA_OBJECT_CLASS_GENERATOR */\n  JERRY_OBJECT_TYPE_GENERATOR, /**< type of ECMA_OBJECT_CLASS_ASYNC_GENERATOR */\n  JERRY_OBJECT_TYPE_ITERATOR, /**< type of ECMA_OBJECT_CLASS_ARRAY_ITERATOR */\n  JERRY_OBJECT_TYPE_ITERATOR, /**< type of ECMA_OBJECT_CLASS_SET_ITERATOR */\n  JERRY_OBJECT_TYPE_ITERATOR, /**< type of ECMA_OBJECT_CLASS_MAP_ITERATOR */\n#if JERRY_BUILTIN_REGEXP\n  JERRY_OBJECT_TYPE_ITERATOR, /**< type of ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR */\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_MODULE_SYSTEM\n  JERRY_OBJECT_TYPE_MODULE, /**< type of ECMA_OBJECT_CLASS_MODULE */\n#endif /* JERRY_MODULE_SYSTEM */\n  JERRY_OBJECT_TYPE_PROMISE, /**< type of ECMA_OBJECT_CLASS_PROMISE */\n  JERRY_OBJECT_TYPE_GENERIC, /**< type of ECMA_OBJECT_CLASS_PROMISE_CAPABILITY */\n  JERRY_OBJECT_TYPE_GENERIC, /**< type of ECMA_OBJECT_CLASS_ASYNC_FROM_SYNC_ITERATOR */\n#if JERRY_BUILTIN_DATAVIEW\n  JERRY_OBJECT_TYPE_DATAVIEW, /**< type of ECMA_OBJECT_CLASS_DATAVIEW */\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_CONTAINER\n  JERRY_OBJECT_TYPE_CONTAINER, /**< type of ECMA_OBJECT_CLASS_CONTAINER */\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n  /* Normal objects. */\n  JERRY_OBJECT_TYPE_BOOLEAN, /**< type of ECMA_OBJECT_CLASS_BOOLEAN */\n  JERRY_OBJECT_TYPE_NUMBER, /**< type of ECMA_OBJECT_CLASS_NUMBER */\n  JERRY_OBJECT_TYPE_ERROR, /**< type of ECMA_OBJECT_CLASS_ERROR */\n  JERRY_OBJECT_TYPE_GENERIC, /**< type of ECMA_OBJECT_CLASS_INTERNAL_OBJECT */\n#if JERRY_PARSER\n  JERRY_OBJECT_TYPE_SCRIPT, /**< type of ECMA_OBJECT_CLASS_SCRIPT */\n#endif /* JERRY_PARSER */\n#if JERRY_BUILTIN_DATE\n  JERRY_OBJECT_TYPE_DATE, /**< type of ECMA_OBJECT_CLASS_DATE */\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_REGEXP\n  JERRY_OBJECT_TYPE_REGEXP, /**< type of ECMA_OBJECT_CLASS_REGEXP */\n#endif /* JERRY_BUILTIN_REGEXP */\n  JERRY_OBJECT_TYPE_SYMBOL, /**< type of ECMA_OBJECT_CLASS_SYMBOL */\n  JERRY_OBJECT_TYPE_ITERATOR, /**< type of ECMA_OBJECT_CLASS_STRING_ITERATOR */\n#if JERRY_BUILTIN_TYPEDARRAY\n  JERRY_OBJECT_TYPE_ARRAYBUFFER, /**< type of ECMA_OBJECT_CLASS_ARRAY_BUFFER */\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n  JERRY_OBJECT_TYPE_SHARED_ARRAY_BUFFER, /**< type of ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER */\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_BIGINT\n  JERRY_OBJECT_TYPE_BIGINT, /**< type of ECMA_OBJECT_CLASS_BIGINT */\n#endif /* JERRY_BUILTIN_BIGINT */\n#if JERRY_BUILTIN_WEAKREF\n  JERRY_OBJECT_TYPE_WEAKREF, /**< type of ECMA_OBJECT_CLASS_WEAKREF */\n#endif /* JERRY_BUILTIN_WEAKREF */\n};\n\nJERRY_STATIC_ASSERT (sizeof (jerry_class_object_type) == ECMA_OBJECT_CLASS__MAX,\n                     jerry_class_object_type_must_have_object_class_max_elements);\n\n/**\n * Get the object type of the given value\n *\n * @return JERRY_OBJECT_TYPE_NONE - if the given value is not an object\n *         jerry_object_type_t value - otherwise\n */\njerry_object_type_t\njerry_object_type (const jerry_value_t value) /**< input value to check */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (value))\n  {\n    return JERRY_OBJECT_TYPE_NONE;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (value);\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n  switch (ecma_get_object_type (obj_p))\n  {\n    case ECMA_OBJECT_TYPE_CLASS:\n    case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:\n    {\n      JERRY_ASSERT (ext_obj_p->u.cls.type < ECMA_OBJECT_CLASS__MAX);\n      return jerry_class_object_type[ext_obj_p->u.cls.type];\n    }\n    case ECMA_OBJECT_TYPE_ARRAY:\n    case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:\n    {\n      return JERRY_OBJECT_TYPE_ARRAY;\n    }\n    case ECMA_OBJECT_TYPE_PROXY:\n    {\n      return JERRY_OBJECT_TYPE_PROXY;\n    }\n    case ECMA_OBJECT_TYPE_FUNCTION:\n    case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n    case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:\n    case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n    {\n      return JERRY_OBJECT_TYPE_FUNCTION;\n    }\n    default:\n    {\n      break;\n    }\n  }\n\n  return JERRY_OBJECT_TYPE_GENERIC;\n} /* jerry_object_type */\n\n/**\n * Get the function type of the given value\n *\n * @return JERRY_FUNCTION_TYPE_NONE - if the given value is not a function object\n *         jerry_function_type_t value - otherwise\n */\njerry_function_type_t\njerry_function_type (const jerry_value_t value) /**< input value to check */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_object (value))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (value);\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n    switch (ecma_get_object_type (obj_p))\n    {\n      case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n      {\n        return JERRY_FUNCTION_TYPE_BOUND;\n      }\n      case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:\n      case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n      {\n        return JERRY_FUNCTION_TYPE_GENERIC;\n      }\n      case ECMA_OBJECT_TYPE_FUNCTION:\n      {\n        const ecma_compiled_code_t *bytecode_data_p = ecma_op_function_get_compiled_code (ext_obj_p);\n\n        switch (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags))\n        {\n          case CBC_FUNCTION_ARROW:\n          case CBC_FUNCTION_ASYNC_ARROW:\n          {\n            return JERRY_FUNCTION_TYPE_ARROW;\n          }\n          case CBC_FUNCTION_GENERATOR:\n          case CBC_FUNCTION_ASYNC_GENERATOR:\n          {\n            return JERRY_FUNCTION_TYPE_GENERATOR;\n          }\n          case CBC_FUNCTION_ACCESSOR:\n          {\n            return JERRY_FUNCTION_TYPE_ACCESSOR;\n          }\n          default:\n          {\n            break;\n          }\n        }\n        return JERRY_FUNCTION_TYPE_GENERIC;\n      }\n      default:\n      {\n        break;\n      }\n    }\n  }\n\n  return JERRY_FUNCTION_TYPE_NONE;\n} /* jerry_function_type */\n\n/**\n * Get the itearator type of the given value\n *\n * @return JERRY_ITERATOR_TYPE_NONE - if the given value is not an iterator object\n *         jerry_iterator_type_t value - otherwise\n */\njerry_iterator_type_t\njerry_iterator_type (const jerry_value_t value) /**< input value to check */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_object (value))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (value);\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n    if (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_CLASS)\n    {\n      switch (ext_obj_p->u.cls.type)\n      {\n        case ECMA_OBJECT_CLASS_ARRAY_ITERATOR:\n        {\n          return JERRY_ITERATOR_TYPE_ARRAY;\n        }\n#if JERRY_BUILTIN_CONTAINER\n        case ECMA_OBJECT_CLASS_SET_ITERATOR:\n        {\n          return JERRY_ITERATOR_TYPE_SET;\n        }\n        case ECMA_OBJECT_CLASS_MAP_ITERATOR:\n        {\n          return JERRY_ITERATOR_TYPE_MAP;\n        }\n#endif /* JERRY_BUILTIN_CONTAINER */\n        case ECMA_OBJECT_CLASS_STRING_ITERATOR:\n        {\n          return JERRY_ITERATOR_TYPE_STRING;\n        }\n        default:\n        {\n          break;\n        }\n      }\n    }\n  }\n\n  return JERRY_ITERATOR_TYPE_NONE;\n} /* jerry_iterator_type */\n\n/**\n * Check if the specified feature is enabled.\n *\n * @return true  - if the specified feature is enabled,\n *         false - otherwise\n */\nbool\njerry_feature_enabled (const jerry_feature_t feature) /**< feature to check */\n{\n  JERRY_ASSERT (feature < JERRY_FEATURE__COUNT);\n\n  return (false\n#if JERRY_CPOINTER_32_BIT\n          || feature == JERRY_FEATURE_CPOINTER_32_BIT\n#endif /* JERRY_CPOINTER_32_BIT */\n#if JERRY_ERROR_MESSAGES\n          || feature == JERRY_FEATURE_ERROR_MESSAGES\n#endif /* JERRY_ERROR_MESSAGES */\n#if JERRY_PARSER\n          || feature == JERRY_FEATURE_JS_PARSER\n#endif /* JERRY_PARSER */\n#if JERRY_MEM_STATS\n          || feature == JERRY_FEATURE_HEAP_STATS\n#endif /* JERRY_MEM_STATS */\n#if JERRY_PARSER_DUMP_BYTE_CODE\n          || feature == JERRY_FEATURE_PARSER_DUMP\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n#if JERRY_REGEXP_DUMP_BYTE_CODE\n          || feature == JERRY_FEATURE_REGEXP_DUMP\n#endif /* JERRY_REGEXP_DUMP_BYTE_CODE */\n#if JERRY_SNAPSHOT_SAVE\n          || feature == JERRY_FEATURE_SNAPSHOT_SAVE\n#endif /* JERRY_SNAPSHOT_SAVE */\n#if JERRY_SNAPSHOT_EXEC\n          || feature == JERRY_FEATURE_SNAPSHOT_EXEC\n#endif /* JERRY_SNAPSHOT_EXEC */\n#if JERRY_DEBUGGER\n          || feature == JERRY_FEATURE_DEBUGGER\n#endif /* JERRY_DEBUGGER */\n#if JERRY_VM_HALT\n          || feature == JERRY_FEATURE_VM_EXEC_STOP\n#endif /* JERRY_VM_HALT */\n#if JERRY_VM_THROW\n          || feature == JERRY_FEATURE_VM_THROW\n#endif /* JERRY_VM_THROW */\n#if JERRY_BUILTIN_JSON\n          || feature == JERRY_FEATURE_JSON\n#endif /* JERRY_BUILTIN_JSON */\n#if JERRY_BUILTIN_TYPEDARRAY\n          || feature == JERRY_FEATURE_TYPEDARRAY\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_DATAVIEW\n          || feature == JERRY_FEATURE_DATAVIEW\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_PROXY\n          || feature == JERRY_FEATURE_PROXY\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_DATE\n          || feature == JERRY_FEATURE_DATE\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_REGEXP\n          || feature == JERRY_FEATURE_REGEXP\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_LINE_INFO\n          || feature == JERRY_FEATURE_LINE_INFO\n#endif /* JERRY_LINE_INFO */\n#if JERRY_LOGGING\n          || feature == JERRY_FEATURE_LOGGING\n#endif /* JERRY_LOGGING */\n#if JERRY_BUILTIN_GLOBAL_THIS\n          || feature == JERRY_FEATURE_GLOBAL_THIS\n#endif /* JERRY_BUILTIN_GLOBAL_THIS */\n#if JERRY_BUILTIN_CONTAINER\n          || feature == JERRY_FEATURE_MAP || feature == JERRY_FEATURE_SET || feature == JERRY_FEATURE_WEAKMAP\n          || feature == JERRY_FEATURE_WEAKSET\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_WEAKREF\n          || feature == JERRY_FEATURE_WEAKREF\n#endif /* JERRY_BUILTIN_WEAKREF */\n#if JERRY_BUILTIN_BIGINT\n          || feature == JERRY_FEATURE_BIGINT\n#endif /* JERRY_BUILTIN_BIGINT */\n#if JERRY_BUILTIN_REALMS\n          || feature == JERRY_FEATURE_REALM\n#endif /* JERRY_BUILTIN_REALMS */\n#if JERRY_PROMISE_CALLBACK\n          || feature == JERRY_FEATURE_PROMISE_CALLBACK\n#endif /* JERRY_PROMISE_CALLBACK */\n#if JERRY_MODULE_SYSTEM\n          || feature == JERRY_FEATURE_MODULE\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_FUNCTION_TO_STRING\n          || feature == JERRY_FEATURE_FUNCTION_TO_STRING\n#endif /* JERRY_FUNCTION_TO_STRING */\n  );\n} /* jerry_feature_enabled */\n\n/**\n * Perform binary operation on the given operands (==, ===, <, >, etc.).\n *\n * @return error - if argument has an error flag or operation is unsuccessful or unsupported\n *         true/false - the result of the binary operation on the given operands otherwise\n */\njerry_value_t\njerry_binary_op (jerry_binary_op_t operation, /**< operation */\n                 const jerry_value_t lhs, /**< first operand */\n                 const jerry_value_t rhs) /**< second operand */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (lhs) || ecma_is_value_exception (rhs))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n  }\n\n  switch (operation)\n  {\n    case JERRY_BIN_OP_EQUAL:\n    {\n      return jerry_return (ecma_op_abstract_equality_compare (lhs, rhs));\n    }\n    case JERRY_BIN_OP_STRICT_EQUAL:\n    {\n      return ecma_make_boolean_value (ecma_op_strict_equality_compare (lhs, rhs));\n    }\n    case JERRY_BIN_OP_LESS:\n    {\n      return jerry_return (opfunc_relation (lhs, rhs, true, false));\n    }\n    case JERRY_BIN_OP_LESS_EQUAL:\n    {\n      return jerry_return (opfunc_relation (lhs, rhs, false, true));\n    }\n    case JERRY_BIN_OP_GREATER:\n    {\n      return jerry_return (opfunc_relation (lhs, rhs, false, false));\n    }\n    case JERRY_BIN_OP_GREATER_EQUAL:\n    {\n      return jerry_return (opfunc_relation (lhs, rhs, true, true));\n    }\n    case JERRY_BIN_OP_INSTANCEOF:\n    {\n      if (!ecma_is_value_object (lhs) || !ecma_op_is_callable (rhs))\n      {\n        return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n      }\n\n      ecma_object_t *proto_obj_p = ecma_get_object_from_value (rhs);\n      return jerry_return (ecma_op_object_has_instance (proto_obj_p, lhs));\n    }\n    case JERRY_BIN_OP_ADD:\n    {\n      return jerry_return (opfunc_addition (lhs, rhs));\n    }\n    case JERRY_BIN_OP_SUB:\n    case JERRY_BIN_OP_MUL:\n    case JERRY_BIN_OP_DIV:\n    case JERRY_BIN_OP_REM:\n    {\n      return jerry_return (do_number_arithmetic (operation - ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET, lhs, rhs));\n    }\n    default:\n    {\n      return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_UNSUPPORTED_BINARY_OPERATION));\n    }\n  }\n} /* jerry_binary_op */\n\n/**\n * Create an abort value containing the argument value. If the second argument is true\n * the function will take ownership ofthe input value, otherwise the value will be copied.\n *\n * @return api abort value\n */\njerry_value_t\njerry_throw_abort (jerry_value_t value, /**< api value */\n                   bool take_ownership) /**< release api value */\n{\n  jerry_assert_api_enabled ();\n\n  if (JERRY_UNLIKELY (ecma_is_value_exception (value)))\n  {\n    /* This is a rare case so it is optimized for\n     * binary size rather than performance. */\n    if (jerry_value_is_abort (value))\n    {\n      return take_ownership ? value : jerry_value_copy (value);\n    }\n\n    value = jerry_exception_value (value, take_ownership);\n    take_ownership = true;\n  }\n\n  if (!take_ownership)\n  {\n    value = ecma_copy_value (value);\n  }\n\n  return ecma_create_exception (value, ECMA_ERROR_API_FLAG_ABORT);\n} /* jerry_throw_abort */\n\n/**\n * Create an exception value containing the argument value. If the second argument is true\n * the function will take ownership ofthe input value, otherwise the value will be copied.\n *\n * @return exception value\n */\njerry_value_t\njerry_throw_value (jerry_value_t value, /**< value */\n                   bool take_ownership) /**< take ownership of the value */\n{\n  jerry_assert_api_enabled ();\n\n  if (JERRY_UNLIKELY (ecma_is_value_exception (value)))\n  {\n    /* This is a rare case so it is optimized for\n     * binary size rather than performance. */\n    if (!jerry_value_is_abort (value))\n    {\n      return take_ownership ? value : jerry_value_copy (value);\n    }\n\n    value = jerry_exception_value (value, take_ownership);\n    take_ownership = true;\n  }\n\n  if (!take_ownership)\n  {\n    value = ecma_copy_value (value);\n  }\n\n  return ecma_create_exception (value, ECMA_ERROR_API_FLAG_NONE);\n} /* jerry_throw_value */\n\n/**\n * Get the value contained in an exception. If the second argument is true\n * it will release the argument exception value in the process.\n *\n * @return value in exception\n */\njerry_value_t\njerry_exception_value (jerry_value_t value, /**< api value */\n                       bool free_exception) /**< release api value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_exception (value))\n  {\n    return free_exception ? value : ecma_copy_value (value);\n  }\n\n  jerry_value_t ret_val = jerry_value_copy (ecma_get_extended_primitive_from_value (value)->u.value);\n\n  if (free_exception)\n  {\n    jerry_value_free (value);\n  }\n  return ret_val;\n} /* jerry_exception_value */\n\n/**\n * Set new decorator callback for Error objects. The decorator can\n * create or update any properties of the newly created Error object.\n */\nvoid\njerry_error_on_created (jerry_error_object_created_cb_t callback, /**< new callback */\n                        void *user_p) /**< user pointer passed to the callback */\n{\n  jerry_assert_api_enabled ();\n\n  JERRY_CONTEXT (error_object_created_callback_p) = callback;\n  JERRY_CONTEXT (error_object_created_callback_user_p) = user_p;\n} /* jerry_error_on_created */\n\n/**\n * When JERRY_VM_THROW is enabled, the callback passed to this\n * function is called when an error is thrown in ECMAScript code.\n */\nvoid\njerry_on_throw (jerry_throw_cb_t callback, /**< callback which is called on throws */\n                void *user_p) /**< pointer passed to the function */\n{\n#if JERRY_VM_THROW\n  JERRY_CONTEXT (vm_throw_callback_p) = callback;\n  JERRY_CONTEXT (vm_throw_callback_user_p) = user_p;\n#else /* !JERRY_VM_THROW */\n  JERRY_UNUSED (callback);\n  JERRY_UNUSED (user_p);\n#endif /* JERRY_VM_THROW */\n} /* jerry_on_throw */\n\n/**\n * Checks whether the callback set by jerry_on_throw captured the error\n *\n * @return true, if the vm throw callback captured the error\n *         false, otherwise\n */\nbool\njerry_exception_is_captured (const jerry_value_t value) /**< exception value */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_VM_THROW\n  if (!ecma_is_value_exception (value))\n  {\n    return false;\n  }\n\n  ecma_extended_primitive_t *error_ref_p = ecma_get_extended_primitive_from_value (value);\n\n  return (error_ref_p->refs_and_type & ECMA_ERROR_API_FLAG_THROW_CAPTURED) != 0;\n#else /* !JERRY_VM_THROW */\n  JERRY_UNUSED (value);\n  return false;\n#endif /* JERRY_VM_THROW */\n} /* jerry_exception_is_captured */\n\n/**\n * Sets whether the callback set by jerry_on_throw should capture the exception or not\n */\nvoid\njerry_exception_allow_capture (jerry_value_t value, /**< exception value */\n                               bool should_capture) /**< callback should capture this error */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_VM_THROW\n  if (!ecma_is_value_exception (value))\n  {\n    return;\n  }\n\n  ecma_extended_primitive_t *error_ref_p = ecma_get_extended_primitive_from_value (value);\n\n  if (should_capture)\n  {\n    error_ref_p->refs_and_type &= ~(uint32_t) ECMA_ERROR_API_FLAG_THROW_CAPTURED;\n    return;\n  }\n\n  error_ref_p->refs_and_type |= ECMA_ERROR_API_FLAG_THROW_CAPTURED;\n#else /* !JERRY_VM_THROW */\n  JERRY_UNUSED (value);\n  JERRY_UNUSED (should_capture);\n#endif /* JERRY_VM_THROW */\n} /* jerry_exception_allow_capture */\n\n/**\n * Check if the given value is an Error object.\n *\n * @return true - if it is an Error object\n *         false - otherwise\n */\nbool\njerry_value_is_error (const jerry_value_t value) /**< api value */\n{\n  return ecma_is_value_object (value)\n         && ecma_object_class_is (ecma_get_object_from_value (value), ECMA_OBJECT_CLASS_ERROR);\n} /* jerry_value_is_error */\n\n/**\n * Return the type of the Error object if possible.\n *\n * @return one of the jerry_error_t value as the type of the Error object\n *         JERRY_ERROR_NONE - if the input value is not an Error object\n */\njerry_error_t\njerry_error_type (jerry_value_t value) /**< api value */\n{\n  if (JERRY_UNLIKELY (ecma_is_value_exception (value)))\n  {\n    value = ecma_get_extended_primitive_from_value (value)->u.value;\n  }\n\n  if (!ecma_is_value_object (value))\n  {\n    return JERRY_ERROR_NONE;\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (value);\n  /* TODO(check if error object) */\n  jerry_error_t error_type = ecma_get_error_type (object_p);\n\n  return (jerry_error_t) error_type;\n} /* jerry_error_type */\n\n/**\n * Get number from the specified value as a double.\n *\n * @return stored number as double\n */\ndouble\njerry_value_as_number (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_number (value))\n  {\n    return 0;\n  }\n\n  return (double) ecma_get_number_from_value (value);\n} /* jerry_value_as_number */\n\n/**\n * Call ToBoolean operation on the api value.\n *\n * @return true  - if the logical value is true\n *         false - otherwise\n */\nbool\njerry_value_to_boolean (const jerry_value_t value) /**< input value */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (value))\n  {\n    return false;\n  }\n\n  return ecma_op_to_boolean (value);\n} /* jerry_value_to_boolean */\n\n/**\n * Call ToNumber operation on the api value.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return converted number value - if success\n *         thrown error - otherwise\n */\njerry_value_t\njerry_value_to_number (const jerry_value_t value) /**< input value */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n  }\n\n  ecma_number_t num;\n  ecma_value_t ret_value = ecma_op_to_number (value, &num);\n\n  if (ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    return ecma_create_exception_from_context ();\n  }\n\n  return ecma_make_number_value (num);\n} /* jerry_value_to_number */\n\n/**\n * Call ToObject operation on the api value.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return converted object value - if success\n *         thrown error - otherwise\n */\njerry_value_t\njerry_value_to_object (const jerry_value_t value) /**< input value */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n  }\n\n  return jerry_return (ecma_op_to_object (value));\n} /* jerry_value_to_object */\n\n/**\n * Call ToPrimitive operation on the api value.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return converted primitive value - if success\n *         thrown error - otherwise\n */\njerry_value_t\njerry_value_to_primitive (const jerry_value_t value) /**< input value */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n  }\n\n  return jerry_return (ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_NO));\n} /* jerry_value_to_primitive */\n\n/**\n * Call the ToString ecma builtin operation on the api value.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return converted string value - if success\n *         thrown error - otherwise\n */\njerry_value_t\njerry_value_to_string (const jerry_value_t value) /**< input value */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n  }\n\n  ecma_string_t *str_p = ecma_op_to_string (value);\n  if (JERRY_UNLIKELY (str_p == NULL))\n  {\n    return ecma_create_exception_from_context ();\n  }\n\n  return ecma_make_string_value (str_p);\n} /* jerry_value_to_string */\n\n/**\n * Call the BigInt constructor ecma builtin operation on the api value.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return BigInt value - if success\n *         thrown error - otherwise\n */\njerry_value_t\njerry_value_to_bigint (const jerry_value_t value) /**< input value */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_BIGINT\n  if (ecma_is_value_exception (value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n  }\n\n  return jerry_return (ecma_bigint_to_bigint (value, true));\n#else /* !JERRY_BUILTIN_BIGINT */\n  JERRY_UNUSED (value);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_BIGINT_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_BIGINT */\n} /* jerry_value_to_bigint */\n\n/**\n * Convert any number to integer number.\n *\n * Note:\n *      For non-number values 0 is returned.\n *\n * @return integer representation of the number.\n */\ndouble\njerry_value_as_integer (const jerry_value_t value) /**< input value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_number (value))\n  {\n    return 0;\n  }\n\n  double number = ecma_get_number_from_value (value);\n\n  if (ecma_number_is_nan (number))\n  {\n    return ECMA_NUMBER_ZERO;\n  }\n\n  if (ecma_number_is_zero (number) || ecma_number_is_infinity (number))\n  {\n    return number;\n  }\n\n  ecma_number_t floor_fabs = (ecma_number_t) floor (fabs (number));\n\n  return ecma_number_is_negative (number) ? -floor_fabs : floor_fabs;\n} /* jerry_value_as_integer */\n\n/**\n * Convert any number to int32 number.\n *\n * Note:\n *      For non-number values 0 is returned.\n *\n * @return int32 representation of the number.\n */\nint32_t\njerry_value_as_int32 (const jerry_value_t value) /**< input value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_number (value))\n  {\n    return 0;\n  }\n\n  return ecma_number_to_int32 (ecma_get_number_from_value (value));\n} /* jerry_value_as_int32 */\n\n/**\n * Convert any number to uint32 number.\n *\n * Note:\n *      For non-number values 0 is returned.\n *\n * @return uint32 representation of the number.\n */\nuint32_t\njerry_value_as_uint32 (const jerry_value_t value) /**< input value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_number (value))\n  {\n    return 0;\n  }\n\n  return ecma_number_to_uint32 (ecma_get_number_from_value (value));\n} /* jerry_value_as_uint32 */\n\n/**\n * Take additional ownership over the argument value.\n * The value will be copied by reference when possible, changes made to the new value will be reflected\n * in the original.\n *\n * @return copied value\n */\njerry_value_t\njerry_value_copy (const jerry_value_t value) /**< value */\n{\n  jerry_assert_api_enabled ();\n\n  if (JERRY_UNLIKELY (ecma_is_value_exception (value)))\n  {\n    ecma_ref_extended_primitive (ecma_get_extended_primitive_from_value (value));\n    return value;\n  }\n\n  return ecma_copy_value (value);\n} /* jerry_value_copy */\n\n/**\n * Release ownership of the argument value\n */\nvoid\njerry_value_free (jerry_value_t value) /**< value */\n{\n  jerry_assert_api_enabled ();\n\n  if (JERRY_UNLIKELY (ecma_is_value_exception (value)))\n  {\n    ecma_deref_exception (ecma_get_extended_primitive_from_value (value));\n    return;\n  }\n\n  ecma_free_value (value);\n} /* jerry_value_free */\n\n/**\n * Create an array object value\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the constructed array object\n */\njerry_value_t\njerry_array (jerry_length_t length) /**< length of array */\n{\n  jerry_assert_api_enabled ();\n\n  ecma_object_t *array_p = ecma_op_new_array_object (length);\n  return ecma_make_object_value (array_p);\n} /* jerry_array */\n\n/**\n * Create a jerry_value_t representing a boolean value from the given boolean parameter.\n *\n * @return value of the created boolean\n */\njerry_value_t\njerry_boolean (bool value) /**< bool value from which a jerry_value_t will be created */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_make_boolean_value (value);\n} /* jerry_boolean */\n\n/**\n * Create an Error object with the provided string value as the error message.\n * If the message value is not a string, the created error will not have a message property.\n *\n * @return Error object\n */\njerry_value_t\njerry_error (jerry_error_t error_type, /**< type of error */\n             const jerry_value_t message) /**< message of the error */\n{\n  jerry_assert_api_enabled ();\n\n  ecma_string_t *message_p = NULL;\n  if (ecma_is_value_string (message))\n  {\n    message_p = ecma_get_string_from_value (message);\n  }\n\n  ecma_object_t *error_object_p = ecma_new_standard_error ((jerry_error_t) error_type, message_p);\n\n  return ecma_make_object_value (error_object_p);\n} /* jerry_error */\n\n/**\n * Create an Error object with a zero-terminated string as a message. If the message string is NULL, the created error\n * will not have a message property.\n *\n * @return Error object\n */\njerry_value_t\njerry_error_sz (jerry_error_t error_type, /**< type of error */\n                const char *message_p) /**< value of 'message' property\n                                        *   of constructed error object */\n{\n  jerry_value_t message = ECMA_VALUE_UNDEFINED;\n\n  if (message_p != NULL)\n  {\n    message = jerry_string_sz (message_p);\n  }\n\n  ecma_value_t error = jerry_error (error_type, message);\n  ecma_free_value (message);\n\n  return error;\n} /* jerry_error_sz */\n\n/**\n * Create an exception by constructing an Error object with the specified type and the provided string value as the\n * error message.  If the message value is not a string, the created error will not have a message property.\n *\n * @return exception value\n */\njerry_value_t\njerry_throw (jerry_error_t error_type, /**< type of error */\n             const jerry_value_t message) /**< message value */\n{\n  return jerry_throw_value (jerry_error (error_type, message), true);\n} /* jerry_throw */\n\n/**\n * Create an exception by constructing an Error object with the specified type and the provided zero-terminated ASCII\n * string as the error message.  If the message string is NULL, the created error will not have a message property.\n *\n * @return exception value\n */\njerry_value_t\njerry_throw_sz (jerry_error_t error_type, /**< type of error */\n                const char *message_p) /**< value of 'message' property\n                                        *   of constructed error object */\n{\n  return jerry_throw_value (jerry_error_sz (error_type, message_p), true);\n} /* jerry_throw_sz */\n\n/**\n * Create an external function object\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the constructed function object\n */\njerry_value_t\njerry_function_external (jerry_external_handler_t handler) /**< native handler\n                                                            *   for the function */\n{\n  jerry_assert_api_enabled ();\n\n  ecma_object_t *func_obj_p = ecma_op_create_external_function_object (handler);\n  return ecma_make_object_value (func_obj_p);\n} /* jerry_function_external */\n\n/**\n * Creates a jerry_value_t representing a number value.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return jerry_value_t created from the given double argument.\n */\njerry_value_t\njerry_number (double value) /**< double value from which a jerry_value_t will be created */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_make_number_value ((ecma_number_t) value);\n} /* jerry_number */\n\n/**\n * Creates a jerry_value_t representing a positive or negative infinity value.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return jerry_value_t representing an infinity value.\n */\njerry_value_t\njerry_infinity (bool sign) /**< true for negative Infinity\n                            *   false for positive Infinity */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_make_number_value (ecma_number_make_infinity (sign));\n} /* jerry_infinity */\n\n/**\n * Creates a jerry_value_t representing a not-a-number value.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return jerry_value_t representing a not-a-number value.\n */\njerry_value_t\njerry_nan (void)\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_make_nan_value ();\n} /* jerry_nan */\n\n/**\n * Creates a jerry_value_t representing an undefined value.\n *\n * @return value of undefined\n */\njerry_value_t\njerry_undefined (void)\n{\n  jerry_assert_api_enabled ();\n\n  return ECMA_VALUE_UNDEFINED;\n} /* jerry_undefined */\n\n/**\n * Creates and returns a jerry_value_t with type null object.\n *\n * @return jerry_value_t representing null\n */\njerry_value_t\njerry_null (void)\n{\n  jerry_assert_api_enabled ();\n\n  return ECMA_VALUE_NULL;\n} /* jerry_null */\n\n/**\n * Create new JavaScript object, like with new Object().\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the created object\n */\njerry_value_t\njerry_object (void)\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_make_object_value (ecma_op_create_object_object_noarg ());\n} /* jerry_object */\n\n/**\n * Create an empty Promise object which can be resolved/rejected later\n * by calling jerry_promise_resolve or jerry_promise_reject.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the created object\n */\njerry_value_t\njerry_promise (void)\n{\n  jerry_assert_api_enabled ();\n\n  return jerry_return (ecma_op_create_promise_object (ECMA_VALUE_EMPTY, ECMA_VALUE_UNDEFINED, NULL));\n} /* jerry_create_promise */\n\n/**\n * Create a new Proxy object with the given target and handler\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the created Proxy object\n */\njerry_value_t\njerry_proxy (const jerry_value_t target, /**< target argument */\n             const jerry_value_t handler) /**< handler argument */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (target) || ecma_is_value_exception (handler))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n#if JERRY_BUILTIN_PROXY\n  ecma_object_t *proxy_p = ecma_proxy_create (target, handler, 0);\n\n  if (proxy_p == NULL)\n  {\n    return ecma_create_exception_from_context ();\n  }\n\n  return ecma_make_object_value (proxy_p);\n#else /* !JERRY_BUILTIN_PROXY */\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_PROXY_IS_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_PROXY */\n} /* jerry_proxy */\n\n#if JERRY_BUILTIN_PROXY\n\nJERRY_STATIC_ASSERT ((int) JERRY_PROXY_SKIP_RESULT_VALIDATION == (int) ECMA_PROXY_SKIP_RESULT_VALIDATION,\n                     jerry_and_ecma_proxy_skip_result_validation_must_be_equal);\n\n#endif /* JERRY_BUILTIN_PROXY */\n\n/**\n * Create a new Proxy object with the given target, handler, and special options\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the created Proxy object\n */\njerry_value_t\njerry_proxy_custom (const jerry_value_t target, /**< target argument */\n                    const jerry_value_t handler, /**< handler argument */\n                    uint32_t flags) /**< jerry_proxy_custom_behavior_t option bits */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (target) || ecma_is_value_exception (handler))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n#if JERRY_BUILTIN_PROXY\n  flags &= JERRY_PROXY_SKIP_RESULT_VALIDATION;\n\n  ecma_object_t *proxy_p = ecma_proxy_create (target, handler, flags);\n\n  if (proxy_p == NULL)\n  {\n    return ecma_create_exception_from_context ();\n  }\n\n  return ecma_make_object_value (proxy_p);\n#else /* !JERRY_BUILTIN_PROXY */\n  JERRY_UNUSED (flags);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_PROXY_IS_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_PROXY */\n} /* jerry_proxy_custom */\n\n/**\n * Create string value from the input zero-terminated ASCII string.\n *\n * @return created string\n */\njerry_value_t\njerry_string_sz (const char *str_p) /**< pointer to string */\n{\n  const jerry_char_t *data_p = (const jerry_char_t *) str_p;\n  return jerry_string (data_p, lit_zt_utf8_string_size (data_p), JERRY_ENCODING_CESU8);\n} /* jerry_string_sz */\n\n/**\n * Create a string value from the input buffer using the specified encoding.\n * The content of the buffer is assumed to be valid in the specified encoding, it's the callers responsibility to\n * validate the input.\n *\n * See also: jerry_validate_string\n *\n * @return created string\n */\njerry_value_t\njerry_string (const jerry_char_t *buffer_p, /**< pointer to buffer */\n              jerry_size_t buffer_size, /**< buffer size */\n              jerry_encoding_t encoding) /**< buffer encoding */\n{\n  jerry_assert_api_enabled ();\n  ecma_string_t *ecma_str_p = NULL;\n  JERRY_ASSERT (jerry_validate_string (buffer_p, buffer_size, encoding));\n\n  switch (encoding)\n  {\n    case JERRY_ENCODING_CESU8:\n    {\n      ecma_str_p = ecma_new_ecma_string_from_utf8 (buffer_p, buffer_size);\n      break;\n    }\n    case JERRY_ENCODING_UTF8:\n    {\n      ecma_str_p = ecma_new_ecma_string_from_utf8_converted_to_cesu8 (buffer_p, buffer_size);\n      break;\n    }\n    default:\n    {\n      return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_INVALID_ENCODING));\n    }\n  }\n\n  return ecma_make_string_value (ecma_str_p);\n} /* jerry_string */\n\n/**\n * Create external string from input zero-terminated ASCII string.\n *\n * @return created external string\n */\njerry_value_t\njerry_string_external_sz (const char *str_p, /**< pointer to string */\n                          void *user_p) /**< user pointer passed to the callback when the string is freed */\n{\n  const jerry_char_t *data_p = (const jerry_char_t *) str_p;\n  return jerry_string_external (data_p, lit_zt_utf8_string_size (data_p), user_p);\n} /* jerry_string_external_sz */\n\n/**\n * Create external string from a valid CESU-8 encoded string.\n * The content of the buffer is assumed be encoded correctly, it's the callers responsibility to\n * validate the input.\n *\n * See also: jerry_validate_string\n *\n * @return created external string\n */\njerry_value_t\njerry_string_external (const jerry_char_t *buffer_p, /**< pointer to string */\n                       jerry_size_t buffer_size, /**< string size */\n                       void *user_p) /**< user pointer passed to the callback when the string is freed */\n{\n  jerry_assert_api_enabled ();\n\n  JERRY_ASSERT (jerry_validate_string (buffer_p, buffer_size, JERRY_ENCODING_CESU8));\n  ecma_string_t *ecma_str_p = ecma_new_ecma_external_string_from_cesu8 (buffer_p, buffer_size, user_p);\n  return ecma_make_string_value (ecma_str_p);\n} /* jerry_string_external_sz_sz */\n\n/**\n * Create symbol with a description value\n *\n * Note: The given argument is converted to string. This operation can throw an exception.\n *\n * @return created symbol,\n *         or thrown exception\n */\njerry_value_t\njerry_symbol_with_description (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  return jerry_return (ecma_op_create_symbol (&value, 1));\n} /* jerry_create_symbol */\n\n/**\n * Create BigInt from a sequence of uint64 digits.\n *\n * Note: This operation can throw an exception.\n *\n * @return created bigint,\n *         or thrown exception\n */\njerry_value_t\njerry_bigint (const uint64_t *digits_p, /**< BigInt digits (lowest digit first) */\n              uint32_t digit_count, /**< number of BigInt digits */\n              bool sign) /**< sign bit, true if the result should be negative */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_BIGINT\n  return jerry_return (ecma_bigint_create_from_digits (digits_p, digit_count, sign));\n#else /* !JERRY_BUILTIN_BIGINT */\n  JERRY_UNUSED (digits_p);\n  JERRY_UNUSED (digit_count);\n  JERRY_UNUSED (sign);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_BIGINT_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_BIGINT */\n} /* jerry_bigint */\n\n/**\n * Creates a RegExp object with the given ASCII pattern and flags.\n *\n * @return value of the constructed RegExp object.\n */\njerry_value_t\njerry_regexp_sz (const char *pattern_p, /**< RegExp pattern as zero-terminated ASCII string */\n                 uint16_t flags) /**< RegExp flags */\n{\n  jerry_assert_api_enabled ();\n\n  jerry_value_t pattern = jerry_string_sz (pattern_p);\n  jerry_value_t result = jerry_regexp (pattern, flags);\n\n  jerry_value_free (pattern);\n  return jerry_return (result);\n} /* jerry_regexp_sz */\n\n/**\n * Creates a RegExp object with the given pattern and flags.\n *\n * @return value of the constructed RegExp object.\n */\njerry_value_t\njerry_regexp (const jerry_value_t pattern, /**< pattern string */\n              uint16_t flags) /**< RegExp flags */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_REGEXP\n  if (!ecma_is_value_string (pattern))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_object_t *regexp_obj_p = ecma_op_regexp_alloc (NULL);\n\n  if (JERRY_UNLIKELY (regexp_obj_p == NULL))\n  {\n    return ecma_create_exception_from_context ();\n  }\n\n  jerry_value_t result = ecma_op_create_regexp_with_flags (regexp_obj_p, pattern, flags);\n\n  return jerry_return (result);\n\n#else /* !JERRY_BUILTIN_REGEXP */\n  JERRY_UNUSED (pattern);\n  JERRY_UNUSED (flags);\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_REGEXP_IS_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_REGEXP */\n} /* jerry_regexp */\n\n/**\n * Creates a new realm (global object).\n *\n * @return new realm object\n */\njerry_value_t\njerry_realm (void)\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_REALMS\n  ecma_global_object_t *global_object_p = ecma_builtin_create_global_object ();\n  return ecma_make_object_value ((ecma_object_t *) global_object_p);\n#else /* !JERRY_BUILTIN_REALMS */\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_REALMS_ARE_DISABLED));\n#endif /* JERRY_BUILTIN_REALMS */\n} /* jerry_realm */\n\n/**\n * Get length of an array object\n *\n * Note:\n *      Returns 0, if the value parameter is not an array object.\n *\n * @return length of the given array\n */\njerry_length_t\njerry_array_length (const jerry_value_t value) /**< api value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!jerry_value_is_object (value))\n  {\n    return 0;\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (value);\n\n  if (JERRY_LIKELY (ecma_get_object_base_type (object_p) == ECMA_OBJECT_BASE_TYPE_ARRAY))\n  {\n    return ecma_array_get_length (object_p);\n  }\n\n  return 0;\n} /* jerry_array_length */\n\n/**\n * Get the size of a string value in the specified encoding.\n *\n * @return number of bytes required by the string,\n *         0 - if value is not a string\n */\njerry_size_t\njerry_string_size (const jerry_value_t value, /**< input string */\n                   jerry_encoding_t encoding) /**< encoding */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_string (value))\n  {\n    return 0;\n  }\n\n  switch (encoding)\n  {\n    case JERRY_ENCODING_CESU8:\n    {\n      return ecma_string_get_size (ecma_get_string_from_value (value));\n    }\n    case JERRY_ENCODING_UTF8:\n    {\n      return ecma_string_get_utf8_size (ecma_get_string_from_value (value));\n    }\n    default:\n    {\n      return 0;\n    }\n  }\n} /* jerry_string_size */\n\n/**\n * Get length of a string value\n *\n * @return number of characters in the string\n *         0 - if value is not a string\n */\njerry_length_t\njerry_string_length (const jerry_value_t value) /**< input string */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_string (value))\n  {\n    return 0;\n  }\n\n  return ecma_string_get_length (ecma_get_string_from_value (value));\n} /* jerry_string_length */\n\n/**\n * Copy the characters of a string into the specified buffer using the specified encoding.  The string is truncated to\n * fit the buffer. If the value is not a string, nothing will be copied to the buffer.\n *\n * @return number of bytes copied to the buffer\n */\njerry_size_t\njerry_string_to_buffer (const jerry_value_t value, /**< input string value */\n                        jerry_encoding_t encoding, /**< output encoding */\n                        jerry_char_t *buffer_p, /**< [out] output characters buffer */\n                        jerry_size_t buffer_size) /**< size of output buffer */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_string (value) || buffer_p == NULL)\n  {\n    return 0;\n  }\n\n  ecma_string_t *str_p = ecma_get_string_from_value (value);\n\n  return ecma_string_copy_to_buffer (str_p, (lit_utf8_byte_t *) buffer_p, buffer_size, encoding);\n} /* jerry_string_to_char_buffer */\n\n/**\n * Create a substring of the input string value.\n * Return an empty string if input value is not a string.\n *\n * @param value  the input string value\n * @param start  start position of the substring\n * @param end    end position of the substring\n *\n * @return created string\n */\njerry_value_t\njerry_string_substr (const jerry_value_t value, jerry_length_t start, jerry_length_t end)\n{\n  if (!ecma_is_value_string (value))\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  return ecma_make_string_value (ecma_string_substr (ecma_get_string_from_value (value), start, end));\n} /* jerry_string_substr */\n\n/**\n * Iterate over the input string value in the specified encoding, visiting each unit of the encoded string once. If\n * the input value is not a string, the function will do nothing.\n *\n * @param value     the input string value\n * @param callback  callback function called for each byte of the encoded string.\n * @param encoding  the requested encoding for the string\n * @param user_p    User pointer passed to the callback function\n */\nvoid\njerry_string_iterate (const jerry_value_t value,\n                      jerry_encoding_t encoding,\n                      jerry_string_iterate_cb_t callback,\n                      void *user_p)\n{\n  if (!ecma_is_value_string (value))\n  {\n    return;\n  }\n\n  ecma_string_t *str_p = ecma_get_string_from_value (value);\n  ECMA_STRING_TO_UTF8_STRING (str_p, buffer_p, buffer_size);\n\n  const lit_utf8_byte_t *current_p = buffer_p;\n  const lit_utf8_byte_t *end_p = buffer_p + buffer_size;\n\n  switch (encoding)\n  {\n    case JERRY_ENCODING_UTF8:\n    {\n      while (current_p < end_p)\n      {\n        if (JERRY_UNLIKELY (*current_p >= LIT_UTF8_3_BYTE_MARKER))\n        {\n          lit_code_point_t cp;\n          lit_utf8_size_t read_size = lit_read_code_point_from_cesu8 (current_p, end_p, &cp);\n\n          lit_utf8_byte_t bytes[LIT_UTF8_MAX_BYTES_IN_CODE_POINT];\n          lit_utf8_size_t encoded_size = lit_code_point_to_utf8 (cp, bytes);\n\n          for (uint32_t i = 0; i < encoded_size; i++)\n          {\n            callback (bytes[i], user_p);\n          }\n\n          current_p += read_size;\n          continue;\n        }\n\n        callback (*current_p++, user_p);\n      }\n\n      break;\n    }\n    case JERRY_ENCODING_CESU8:\n    {\n      while (current_p < end_p)\n      {\n        callback (*current_p++, user_p);\n      }\n\n      break;\n    }\n    default:\n    {\n      break;\n    }\n  }\n  ECMA_FINALIZE_UTF8_STRING (buffer_p, buffer_size);\n} /* jerry_string_iterate */\n\n/**\n * Sets the global callback which is called when an external string is freed.\n */\nvoid\njerry_string_external_on_free (jerry_external_string_free_cb_t callback) /**< free callback */\n{\n  JERRY_CONTEXT (external_string_free_callback_p) = callback;\n} /* jerry_string_external_on_free */\n\n/**\n * Returns the user pointer assigned to an external string.\n *\n * @return user pointer, if value is an external string\n *         NULL, otherwise\n */\nvoid *\njerry_string_user_ptr (const jerry_value_t value, /**< string value */\n                       bool *is_external) /**< [out] true - if value is an external string,\n                                           *         false - otherwise */\n{\n  if (is_external != NULL)\n  {\n    *is_external = false;\n  }\n\n  if (!ecma_is_value_string (value))\n  {\n    return NULL;\n  }\n\n  ecma_string_t *string_p = ecma_get_string_from_value (value);\n\n  if (ECMA_IS_DIRECT_STRING (string_p)\n      || ECMA_STRING_GET_CONTAINER (string_p) != ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING)\n  {\n    return NULL;\n  }\n\n  ecma_long_string_t *long_string_p = (ecma_long_string_t *) string_p;\n\n  if (long_string_p->string_p == ECMA_LONG_STRING_BUFFER_START (long_string_p))\n  {\n    return NULL;\n  }\n\n  if (is_external != NULL)\n  {\n    *is_external = true;\n  }\n\n  return ((ecma_external_string_t *) string_p)->user_p;\n} /* jerry_string_user_ptr */\n\n/**\n * Checks whether the object or it's prototype objects have the given property.\n *\n * @return raised error - if the operation fail\n *         true/false API value  - depend on whether the property exists\n */\njerry_value_t\njerry_object_has (const jerry_value_t object, /**< object value */\n                  const jerry_value_t key) /**< property name (string value) */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object) || !ecma_is_value_prop_name (key))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n  ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (key);\n\n  return jerry_return (ecma_op_object_has_property (obj_p, prop_name_p));\n} /* jerry_object_has */\n\n/**\n * Checks whether the object or it's prototype objects have the given property.\n *\n * @return raised error - if the operation fail\n *         true/false API value  - depend on whether the property exists\n */\njerry_value_t\njerry_object_has_sz (const jerry_value_t object, /**< object value */\n                     const char *key_p) /**< property key */\n{\n  jerry_assert_api_enabled ();\n\n  jerry_value_t key_str = jerry_string_sz (key_p);\n  jerry_value_t result = jerry_object_has (object, key_str);\n  ecma_free_value (key_str);\n\n  return result;\n} /* jerry_object_has */\n\n/**\n * Checks whether the object has the given property.\n *\n * @return ECMA_VALUE_ERROR - if the operation raises error\n *         ECMA_VALUE_{TRUE, FALSE} - based on whether the property exists\n */\njerry_value_t\njerry_object_has_own (const jerry_value_t object, /**< object value */\n                      const jerry_value_t key) /**< property name (string value) */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object) || !ecma_is_value_prop_name (key))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n  ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (key);\n\n  return jerry_return (ecma_op_object_has_own_property (obj_p, prop_name_p));\n} /* jerry_has_own_property */\n\n/**\n * Checks whether the object has the given internal property.\n *\n * @return true  - if the internal property exists\n *         false - otherwise\n */\nbool\njerry_object_has_internal (const jerry_value_t object, /**< object value */\n                           const jerry_value_t key) /**< property name value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object) || !ecma_is_value_prop_name (key))\n  {\n    return false;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n\n  ecma_string_t *internal_string_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_API_INTERNAL);\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    return false;\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (obj_p, internal_string_p);\n\n  if (property_p == NULL)\n  {\n    return false;\n  }\n\n  ecma_object_t *internal_object_p = ecma_get_object_from_value (ECMA_PROPERTY_VALUE_PTR (property_p)->value);\n  property_p = ecma_find_named_property (internal_object_p, ecma_get_prop_name_from_value (key));\n\n  return property_p != NULL;\n} /* jerry_object_has_internal */\n\n/**\n * Delete a property from an object.\n *\n * @return boolean value - wether the property was deleted successfully\n *         exception - otherwise\n */\njerry_value_t\njerry_object_delete (jerry_value_t object, /**< object value */\n                     const jerry_value_t key) /**< property name (string value) */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object) || !ecma_is_value_prop_name (key))\n  {\n    return false;\n  }\n\n  return ecma_op_object_delete (ecma_get_object_from_value (object), ecma_get_prop_name_from_value (key), false);\n} /* jerry_object_delete */\n\n/**\n * Delete a property from an object.\n *\n * @return boolean value - wether the property was deleted successfully\n *         exception - otherwise\n */\njerry_value_t\njerry_object_delete_sz (jerry_value_t object, /**< object value */\n                        const char *key_p) /**< property key */\n{\n  jerry_assert_api_enabled ();\n\n  jerry_value_t key_str = jerry_string_sz (key_p);\n  jerry_value_t result = jerry_object_delete (object, key_str);\n  ecma_free_value (key_str);\n\n  return result;\n} /* jerry_object_delete */\n\n/**\n * Delete indexed property from the specified object.\n *\n * @return boolean value - wether the property was deleted successfully\n *         false - otherwise\n */\njerry_value_t\njerry_object_delete_index (jerry_value_t object, /**< object value */\n                           uint32_t index) /**< index to be written */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object))\n  {\n    return false;\n  }\n\n  ecma_string_t *str_idx_p = ecma_new_ecma_string_from_uint32 (index);\n  ecma_value_t ret_value = ecma_op_object_delete (ecma_get_object_from_value (object), str_idx_p, false);\n  ecma_deref_ecma_string (str_idx_p);\n\n  return ret_value;\n} /* jerry_object_delete_index */\n\n/**\n * Delete an internal property from an object.\n *\n * @return true  - if property was deleted successfully\n *         false - otherwise\n */\nbool\njerry_object_delete_internal (jerry_value_t object, /**< object value */\n                              const jerry_value_t key) /**< property name value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object) || !ecma_is_value_prop_name (key))\n  {\n    return false;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n\n  ecma_string_t *internal_string_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_API_INTERNAL);\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    return true;\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (obj_p, internal_string_p);\n\n  if (property_p == NULL)\n  {\n    return true;\n  }\n\n  ecma_object_t *internal_object_p = ecma_get_object_from_value (ECMA_PROPERTY_VALUE_PTR (property_p)->value);\n  property_p = ecma_find_named_property (internal_object_p, ecma_get_prop_name_from_value (key));\n\n  if (property_p == NULL)\n  {\n    return true;\n  }\n\n  ecma_delete_property (internal_object_p, ECMA_PROPERTY_VALUE_PTR (property_p));\n\n  return true;\n} /* jerry_object_delete_internal */\n\n/**\n * Get value of a property to the specified object with the given name.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the property - if success\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_get (const jerry_value_t object, /**< object value */\n                  const jerry_value_t key) /**< property name (string value) */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object) || !ecma_is_value_prop_name (key))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  jerry_value_t ret_value =\n    ecma_op_object_get (ecma_get_object_from_value (object), ecma_get_prop_name_from_value (key));\n  return jerry_return (ret_value);\n} /* jerry_object_get */\n\n/**\n * Get value of a property to the specified object with the given name.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the property - if success\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_get_sz (const jerry_value_t object, /**< object value */\n                     const char *key_p) /**< property key */\n{\n  jerry_assert_api_enabled ();\n\n  jerry_value_t key_str = jerry_string_sz (key_p);\n  jerry_value_t result = jerry_object_get (object, key_str);\n  ecma_free_value (key_str);\n\n  return result;\n} /* jerry_object_get */\n\n/**\n * Get value by an index from the specified object.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the property specified by the index - if success\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_get_index (const jerry_value_t object, /**< object value */\n                        uint32_t index) /**< index to be written */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_value_t ret_value = ecma_op_object_get_by_index (ecma_get_object_from_value (object), index);\n\n  return jerry_return (ret_value);\n} /* jerry_object_get_index */\n\n/**\n * Get the own property value of an object with the given name.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the property - if success\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_find_own (const jerry_value_t object, /**< object value */\n                       const jerry_value_t key, /**< property name (string value) */\n                       const jerry_value_t receiver, /**< receiver object value */\n                       bool *found_p) /**< [out] true, if the property is found\n                                       *   or object is a Proxy object, false otherwise */\n{\n  jerry_assert_api_enabled ();\n\n  if (found_p != NULL)\n  {\n    *found_p = false;\n  }\n\n  if (!ecma_is_value_object (object) || !ecma_is_value_prop_name (key) || !ecma_is_value_object (receiver))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (object);\n  ecma_string_t *property_name_p = ecma_get_prop_name_from_value (key);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (object_p))\n  {\n    if (found_p != NULL)\n    {\n      *found_p = true;\n    }\n\n    return jerry_return (ecma_proxy_object_get (object_p, property_name_p, receiver));\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_value_t ret_value = ecma_op_object_find_own (receiver, object_p, property_name_p);\n\n  if (ecma_is_value_found (ret_value))\n  {\n    if (found_p != NULL)\n    {\n      *found_p = true;\n    }\n\n    return jerry_return (ret_value);\n  }\n\n  return ECMA_VALUE_UNDEFINED;\n} /* jerry_object_find_own */\n\n/**\n * Get value of an internal property to the specified object with the given name.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return value of the internal property - if the internal property exists\n *         undefined value - if the internal does not property exists\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_get_internal (const jerry_value_t object, /**< object value */\n                           const jerry_value_t key) /**< property name value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object) || !ecma_is_value_prop_name (key))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n\n  ecma_string_t *internal_string_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_API_INTERNAL);\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    return jerry_return (ECMA_VALUE_UNDEFINED);\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (obj_p, internal_string_p);\n\n  if (property_p == NULL)\n  {\n    return jerry_return (ECMA_VALUE_UNDEFINED);\n  }\n\n  ecma_object_t *internal_object_p = ecma_get_object_from_value (ECMA_PROPERTY_VALUE_PTR (property_p)->value);\n  property_p = ecma_find_named_property (internal_object_p, ecma_get_prop_name_from_value (key));\n\n  if (property_p == NULL)\n  {\n    return jerry_return (ECMA_VALUE_UNDEFINED);\n  }\n\n  return jerry_return (ecma_copy_value (ECMA_PROPERTY_VALUE_PTR (property_p)->value));\n} /* jerry_object_get_internal */\n\n/**\n * Set a property to the specified object with the given name.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return true value - if the operation was successful\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_set (jerry_value_t object, /**< object value */\n                  const jerry_value_t key, /**< property name (string value) */\n                  const jerry_value_t value) /**< value to set */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (value) || !ecma_is_value_object (object) || !ecma_is_value_prop_name (key))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  return jerry_return (\n    ecma_op_object_put (ecma_get_object_from_value (object), ecma_get_prop_name_from_value (key), value, true));\n} /* jerry_object_set */\n\n/**\n * Set a property to the specified object with the given name.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return true value - if the operation was successful\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_set_sz (jerry_value_t object, /**< object value */\n                     const char *key_p, /**< property key */\n                     const jerry_value_t value) /**< value to set */\n{\n  jerry_assert_api_enabled ();\n\n  jerry_value_t key_str = jerry_string_sz (key_p);\n  jerry_value_t result = jerry_object_set (object, key_str, value);\n  ecma_free_value (key_str);\n\n  return result;\n} /* jerry_object_set */\n\n/**\n * Set indexed value in the specified object\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return true value - if the operation was successful\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_set_index (jerry_value_t object, /**< object value */\n                        uint32_t index, /**< index to be written */\n                        const jerry_value_t value) /**< value to set */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (value) || !ecma_is_value_object (object))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_value_t ret_value = ecma_op_object_put_by_index (ecma_get_object_from_value (object), index, value, true);\n\n  return jerry_return (ret_value);\n} /* jerry_object_set_index */\n\n/**\n * Set an internal property to the specified object with the given name.\n *\n * Note:\n *      - the property cannot be accessed from the JavaScript context, only from the public API\n *      - returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return true value - if the operation was successful\n *         value marked with error flag - otherwise\n */\nbool\njerry_object_set_internal (jerry_value_t object, /**< object value */\n                           const jerry_value_t key, /**< property name value */\n                           const jerry_value_t value) /**< value to set */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (value) || !ecma_is_value_object (object) || !ecma_is_value_prop_name (key))\n  {\n    return false;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n\n  ecma_string_t *internal_string_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_API_INTERNAL);\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_fast_array_convert_to_normal (obj_p);\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (obj_p, internal_string_p);\n  ecma_object_t *internal_object_p;\n\n  if (property_p == NULL)\n  {\n    ecma_property_value_t *value_p =\n      ecma_create_named_data_property (obj_p, internal_string_p, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL);\n\n    internal_object_p = ecma_create_object (NULL, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n    {\n      ecma_extended_object_t *container_p = (ecma_extended_object_t *) internal_object_p;\n      container_p->u.cls.type = ECMA_OBJECT_CLASS_INTERNAL_OBJECT;\n    }\n\n    value_p->value = ecma_make_object_value (internal_object_p);\n    ecma_deref_object (internal_object_p);\n  }\n  else\n  {\n    internal_object_p = ecma_get_object_from_value (ECMA_PROPERTY_VALUE_PTR (property_p)->value);\n  }\n\n  ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (key);\n  property_p = ecma_find_named_property (internal_object_p, prop_name_p);\n\n  if (property_p == NULL)\n  {\n    ecma_property_value_t *value_p = ecma_create_named_data_property (internal_object_p,\n                                                                      prop_name_p,\n                                                                      ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                                      NULL);\n\n    value_p->value = ecma_copy_value_if_not_object (value);\n  }\n  else\n  {\n    ecma_named_data_property_assign_value (internal_object_p, ECMA_PROPERTY_VALUE_PTR (property_p), value);\n  }\n\n  return true;\n} /* jerry_object_set_internal */\n\n/**\n * Construct empty property descriptor, i.e.:\n *  property descriptor with all is_defined flags set to false and the rest - to default value.\n *\n * @return empty property descriptor\n */\njerry_property_descriptor_t\njerry_property_descriptor (void)\n{\n  jerry_property_descriptor_t prop_desc;\n\n  prop_desc.flags = JERRY_PROP_NO_OPTS;\n  prop_desc.value = ECMA_VALUE_UNDEFINED;\n  prop_desc.getter = ECMA_VALUE_UNDEFINED;\n  prop_desc.setter = ECMA_VALUE_UNDEFINED;\n\n  return prop_desc;\n} /* jerry_property_descriptor */\n\n/**\n * Convert a ecma_property_descriptor_t to a jerry_property_descriptor_t\n *\n * if error occurs the property descriptor's value field is filled with ECMA_VALUE_ERROR\n *\n * @return jerry_property_descriptor_t\n */\nstatic jerry_property_descriptor_t\njerry_property_descriptor_from_ecma (const ecma_property_descriptor_t *prop_desc_p) /**<[out] property_descriptor */\n{\n  jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n\n  prop_desc.flags = prop_desc_p->flags;\n\n  if (prop_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED))\n  {\n    prop_desc.value = prop_desc_p->value;\n  }\n\n  if (prop_desc_p->flags & JERRY_PROP_IS_GET_DEFINED)\n  {\n    prop_desc.getter = ECMA_VALUE_NULL;\n\n    if (prop_desc_p->get_p != NULL)\n    {\n      prop_desc.getter = ecma_make_object_value (prop_desc_p->get_p);\n      JERRY_ASSERT (ecma_op_is_callable (prop_desc.getter));\n    }\n  }\n\n  if (prop_desc_p->flags & JERRY_PROP_IS_SET_DEFINED)\n  {\n    prop_desc.setter = ECMA_VALUE_NULL;\n\n    if (prop_desc_p->set_p != NULL)\n    {\n      prop_desc.setter = ecma_make_object_value (prop_desc_p->set_p);\n      JERRY_ASSERT (ecma_op_is_callable (prop_desc.setter));\n    }\n  }\n\n  return prop_desc;\n} /* jerry_property_descriptor_from_ecma */\n\n/**\n * Convert a jerry_property_descriptor_t to a ecma_property_descriptor_t\n *\n * Note:\n *     if error occurs the property descriptor's value field\n *     is set to ECMA_VALUE_ERROR, but no error is thrown\n *\n * @return ecma_property_descriptor_t\n */\nstatic ecma_property_descriptor_t\njerry_property_descriptor_to_ecma (const jerry_property_descriptor_t *prop_desc_p) /**< input property_descriptor */\n{\n  ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();\n\n  prop_desc.flags = prop_desc_p->flags;\n\n  /* Copy data property info. */\n  if (prop_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n  {\n    if (ecma_is_value_exception (prop_desc_p->value)\n        || (prop_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)))\n    {\n      prop_desc.value = ECMA_VALUE_ERROR;\n      return prop_desc;\n    }\n\n    prop_desc.value = prop_desc_p->value;\n  }\n\n  /* Copy accessor property info. */\n  if (prop_desc_p->flags & JERRY_PROP_IS_GET_DEFINED)\n  {\n    ecma_value_t getter = prop_desc_p->getter;\n\n    if (ecma_is_value_exception (getter))\n    {\n      prop_desc.value = ECMA_VALUE_ERROR;\n      return prop_desc;\n    }\n\n    if (ecma_op_is_callable (getter))\n    {\n      prop_desc.get_p = ecma_get_object_from_value (getter);\n    }\n    else if (!ecma_is_value_null (getter))\n    {\n      prop_desc.value = ECMA_VALUE_ERROR;\n      return prop_desc;\n    }\n  }\n\n  if (prop_desc_p->flags & JERRY_PROP_IS_SET_DEFINED)\n  {\n    ecma_value_t setter = prop_desc_p->setter;\n\n    if (ecma_is_value_exception (setter))\n    {\n      prop_desc.value = ECMA_VALUE_ERROR;\n      return prop_desc;\n    }\n\n    if (ecma_op_is_callable (setter))\n    {\n      prop_desc.set_p = ecma_get_object_from_value (setter);\n    }\n    else if (!ecma_is_value_null (setter))\n    {\n      prop_desc.value = ECMA_VALUE_ERROR;\n      return prop_desc;\n    }\n  }\n\n  const uint16_t configurable_mask = JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_CONFIGURABLE_DEFINED;\n  const uint16_t enumerable_mask = JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_ENUMERABLE_DEFINED;\n  const uint16_t writable_mask = JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_WRITABLE_DEFINED;\n\n  if ((prop_desc_p->flags & configurable_mask) == JERRY_PROP_IS_CONFIGURABLE\n      || (prop_desc_p->flags & enumerable_mask) == JERRY_PROP_IS_ENUMERABLE\n      || (prop_desc_p->flags & writable_mask) == JERRY_PROP_IS_WRITABLE)\n  {\n    prop_desc.value = ECMA_VALUE_ERROR;\n    return prop_desc;\n  }\n\n  prop_desc.flags |= (uint16_t) (prop_desc_p->flags | JERRY_PROP_SHOULD_THROW);\n\n  return prop_desc;\n} /* jerry_property_descriptor_to_ecma */\n\n/** Helper function to return false value or error depending on the given flag.\n *\n * @return value marked with error flag - if is_throw is true\n *         false value - otherwise\n */\nstatic jerry_value_t\njerry_type_error_or_false (ecma_error_msg_t msg, /**< message */\n                           uint16_t flags) /**< property descriptor flags */\n{\n  if (!(flags & JERRY_PROP_SHOULD_THROW))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (msg));\n} /* jerry_type_error_or_false */\n\n/**\n * Define a property to the specified object with the given name.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return true value - if the operation was successful\n *         false value - if the property cannot be defined and JERRY_PROP_SHOULD_THROW is not set\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_define_own_prop (jerry_value_t object, /**< object value */\n                              const jerry_value_t key, /**< property name (string value) */\n                              const jerry_property_descriptor_t *prop_desc_p) /**< property descriptor */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object) || !ecma_is_value_prop_name (key))\n  {\n    return jerry_type_error_or_false (ECMA_ERR_WRONG_ARGS_MSG, prop_desc_p->flags);\n  }\n\n  if (prop_desc_p->flags & (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_VALUE_DEFINED)\n      && prop_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))\n  {\n    return jerry_type_error_or_false (ECMA_ERR_WRONG_ARGS_MSG, prop_desc_p->flags);\n  }\n\n  ecma_property_descriptor_t prop_desc = jerry_property_descriptor_to_ecma (prop_desc_p);\n\n  if (ECMA_IS_VALUE_ERROR (prop_desc.value))\n  {\n    return jerry_type_error_or_false (ECMA_ERR_WRONG_ARGS_MSG, prop_desc_p->flags);\n  }\n\n  return jerry_return (ecma_op_object_define_own_property (ecma_get_object_from_value (object),\n                                                           ecma_get_prop_name_from_value (key),\n                                                           &prop_desc));\n} /* jerry_object_define_own_prop */\n\n/**\n * Construct property descriptor from specified property.\n *\n * @return true - if success, the prop_desc_p fields contains the property info\n *         false - otherwise, the prop_desc_p is unchanged\n */\njerry_value_t\njerry_object_get_own_prop (const jerry_value_t object, /**< object value */\n                           const jerry_value_t key, /**< property name (string value) */\n                           jerry_property_descriptor_t *prop_desc_p) /**< property descriptor */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object) || !ecma_is_value_prop_name (key))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_property_descriptor_t prop_desc;\n\n  ecma_value_t status = ecma_op_object_get_own_property_descriptor (ecma_get_object_from_value (object),\n                                                                    ecma_get_prop_name_from_value (key),\n                                                                    &prop_desc);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_IS_VALUE_ERROR (status))\n  {\n    return ecma_create_exception_from_context ();\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  if (!ecma_is_value_true (status))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  /* The flags are always filled in the returned descriptor. */\n  JERRY_ASSERT (\n    (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED) && (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE_DEFINED)\n    && ((prop_desc.flags & JERRY_PROP_IS_WRITABLE_DEFINED) || !(prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED)));\n\n  prop_desc_p->flags = prop_desc.flags;\n  prop_desc_p->value = ECMA_VALUE_UNDEFINED;\n  prop_desc_p->getter = ECMA_VALUE_UNDEFINED;\n  prop_desc_p->setter = ECMA_VALUE_UNDEFINED;\n\n  if (prop_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n  {\n    prop_desc_p->value = prop_desc.value;\n  }\n\n  if (prop_desc_p->flags & JERRY_PROP_IS_GET_DEFINED)\n  {\n    if (prop_desc.get_p != NULL)\n    {\n      prop_desc_p->getter = ecma_make_object_value (prop_desc.get_p);\n    }\n    else\n    {\n      prop_desc_p->getter = ECMA_VALUE_NULL;\n    }\n  }\n\n  if (prop_desc_p->flags & JERRY_PROP_IS_SET_DEFINED)\n  {\n    if (prop_desc.set_p != NULL)\n    {\n      prop_desc_p->setter = ecma_make_object_value (prop_desc.set_p);\n    }\n    else\n    {\n      prop_desc_p->setter = ECMA_VALUE_NULL;\n    }\n  }\n\n  return ECMA_VALUE_TRUE;\n} /* jerry_object_get_own_prop */\n\n/**\n * Free fields of property descriptor (setter, getter and value).\n */\nvoid\njerry_property_descriptor_free (jerry_property_descriptor_t *prop_desc_p) /**< property descriptor */\n{\n  if (prop_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n  {\n    jerry_value_free (prop_desc_p->value);\n  }\n\n  if (prop_desc_p->flags & JERRY_PROP_IS_GET_DEFINED)\n  {\n    jerry_value_free (prop_desc_p->getter);\n  }\n\n  if (prop_desc_p->flags & JERRY_PROP_IS_SET_DEFINED)\n  {\n    jerry_value_free (prop_desc_p->setter);\n  }\n} /* jerry_property_descriptor_free */\n\n/**\n * Call function specified by a function value\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *      error flag must not be set for any arguments of this function.\n *\n * @return returned jerry value of the called function\n */\njerry_value_t\njerry_call (const jerry_value_t func_object, /**< function object to call */\n            const jerry_value_t this_value, /**< object for 'this' binding */\n            const jerry_value_t *args_p, /**< function's call arguments */\n            jerry_size_t args_count) /**< number of the arguments */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_exception (this_value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  for (jerry_size_t i = 0; i < args_count; i++)\n  {\n    if (ecma_is_value_exception (args_p[i]))\n    {\n      return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n    }\n  }\n\n  return jerry_return (ecma_op_function_validated_call (func_object, this_value, args_p, args_count));\n} /* jerry_call */\n\n/**\n * Construct object value invoking specified function value as a constructor\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *      error flag must not be set for any arguments of this function.\n *\n * @return returned jerry value of the invoked constructor\n */\njerry_value_t\njerry_construct (const jerry_value_t func_object, /**< function object to call */\n                 const jerry_value_t *args_p, /**< function's call arguments\n                                               *   (NULL if arguments number is zero) */\n                 jerry_size_t args_count) /**< number of the arguments */\n{\n  jerry_assert_api_enabled ();\n\n  if (!jerry_value_is_constructor (func_object))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  for (jerry_size_t i = 0; i < args_count; i++)\n  {\n    if (ecma_is_value_exception (args_p[i]))\n    {\n      return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n    }\n  }\n\n  return jerry_return (ecma_op_function_construct (ecma_get_object_from_value (func_object),\n                                                   ecma_get_object_from_value (func_object),\n                                                   args_p,\n                                                   args_count));\n} /* jerry_construct */\n\n/**\n * Get keys of the specified object value\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return array object value - if success\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_keys (const jerry_value_t object) /**< object value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_collection_t *prop_names =\n    ecma_op_object_get_enumerable_property_names (ecma_get_object_from_value (object), ECMA_ENUMERABLE_PROPERTY_KEYS);\n\n#if JERRY_BUILTIN_PROXY\n  if (JERRY_UNLIKELY (prop_names == NULL))\n  {\n    return ecma_create_exception_from_context ();\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  return ecma_op_new_array_object_from_collection (prop_names, false);\n} /* jerry_object_keys */\n\n/**\n * Get the prototype of the specified object\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return prototype object or null value - if success\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_proto (const jerry_value_t object) /**< object value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    return jerry_return (ecma_proxy_object_get_prototype_of (obj_p));\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  if (obj_p->u2.prototype_cp == JMEM_CP_NULL)\n  {\n    return ECMA_VALUE_NULL;\n  }\n\n  ecma_object_t *proto_obj_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, obj_p->u2.prototype_cp);\n  ecma_ref_object (proto_obj_p);\n\n  return ecma_make_object_value (proto_obj_p);\n} /* jerry_object_proto */\n\n/**\n * Set the prototype of the specified object\n *\n * @return true value - if success\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_set_proto (jerry_value_t object, /**< object value */\n                        const jerry_value_t proto) /**< prototype object value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object) || ecma_is_value_exception (proto)\n      || (!ecma_is_value_object (proto) && !ecma_is_value_null (proto)))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    return jerry_return (ecma_proxy_object_set_prototype_of (obj_p, proto));\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  return ecma_op_ordinary_object_set_prototype_of (obj_p, proto);\n} /* jerry_object_set_proto */\n\n/**\n * Utility to check if a given object can be used for the foreach api calls.\n *\n * Some objects/classes uses extra internal objects to correctly store data.\n * These extre object should never be exposed externally to the API user.\n *\n * @returns true - if the user can access the object in the callback.\n *          false - if the object is an internal object which should no be accessed by the user.\n */\nstatic bool\njerry_object_is_valid_foreach (ecma_object_t *object_p) /**< object to test */\n{\n  if (ecma_is_lexical_environment (object_p))\n  {\n    return false;\n  }\n\n  ecma_object_type_t object_type = ecma_get_object_type (object_p);\n\n  if (object_type == ECMA_OBJECT_TYPE_CLASS)\n  {\n    ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n    switch (ext_object_p->u.cls.type)\n    {\n      /* An object's internal property object should not be iterable by foreach. */\n      case ECMA_OBJECT_CLASS_INTERNAL_OBJECT:\n      {\n        return false;\n      }\n    }\n  }\n\n  return true;\n} /* jerry_object_is_valid_foreach */\n\n/**\n * Traverse objects.\n *\n * @return true - traversal was interrupted by the callback.\n *         false - otherwise - traversal visited all objects.\n */\nbool\njerry_foreach_live_object (jerry_foreach_live_object_cb_t callback, /**< function pointer of the iterator function */\n                           void *user_data_p) /**< pointer to user data */\n{\n  jerry_assert_api_enabled ();\n\n  JERRY_ASSERT (callback != NULL);\n\n  jmem_cpointer_t iter_cp = JERRY_CONTEXT (ecma_gc_objects_cp);\n\n  while (iter_cp != JMEM_CP_NULL)\n  {\n    ecma_object_t *iter_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, iter_cp);\n\n    if (jerry_object_is_valid_foreach (iter_p) && !callback (ecma_make_object_value (iter_p), user_data_p))\n    {\n      return true;\n    }\n\n    iter_cp = iter_p->gc_next_cp;\n  }\n\n  return false;\n} /* jerry_foreach_live_object */\n\n/**\n * Traverse objects having a given native type info.\n *\n * @return true - traversal was interrupted by the callback.\n *         false - otherwise - traversal visited all objects.\n */\nbool\njerry_foreach_live_object_with_info (const jerry_object_native_info_t *native_info_p, /**< the type info\n                                                                                       *   of the native pointer */\n                                     jerry_foreach_live_object_with_info_cb_t callback, /**< function to apply for\n                                                                                         *   each matching object */\n                                     void *user_data_p) /**< pointer to user data */\n{\n  jerry_assert_api_enabled ();\n\n  JERRY_ASSERT (native_info_p != NULL);\n  JERRY_ASSERT (callback != NULL);\n\n  ecma_native_pointer_t *native_pointer_p;\n\n  jmem_cpointer_t iter_cp = JERRY_CONTEXT (ecma_gc_objects_cp);\n\n  while (iter_cp != JMEM_CP_NULL)\n  {\n    ecma_object_t *iter_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, iter_cp);\n\n    if (jerry_object_is_valid_foreach (iter_p))\n    {\n      native_pointer_p = ecma_get_native_pointer_value (iter_p, (void *) native_info_p);\n      if (native_pointer_p && !callback (ecma_make_object_value (iter_p), native_pointer_p->native_p, user_data_p))\n      {\n        return true;\n      }\n    }\n\n    iter_cp = iter_p->gc_next_cp;\n  }\n\n  return false;\n} /* jerry_foreach_live_object_with_info */\n\n/**\n * Get native pointer and its type information, associated with the given native type info.\n *\n * Note:\n *  If native pointer is present, its type information is returned in out_native_pointer_p\n *\n * @return found native pointer,\n *         or NULL\n */\nvoid *\njerry_object_get_native_ptr (const jerry_value_t object, /**< object to get native pointer from */\n                             const jerry_object_native_info_t *native_info_p) /**< the type info\n                                                                               *   of the native pointer */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object))\n  {\n    return NULL;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n  ecma_native_pointer_t *native_pointer_p = ecma_get_native_pointer_value (obj_p, (void *) native_info_p);\n\n  if (native_pointer_p == NULL)\n  {\n    return NULL;\n  }\n\n  return native_pointer_p->native_p;\n} /* jerry_object_get_native_ptr */\n\n/**\n * Set native pointer and an optional type info for the specified object.\n *\n *\n * Note:\n *      If native pointer was already set for the object, its value is updated.\n *\n * Note:\n *      If a non-NULL free callback is specified in the native type info,\n *      it will be called by the garbage collector when the object is freed.\n *      Referred values by this method must have at least 1 reference. (Correct API usage satisfies this condition)\n *      The type info always overwrites the previous value, so passing\n *      a NULL value deletes the current type info.\n */\nvoid\njerry_object_set_native_ptr (jerry_value_t object, /**< object to set native pointer in */\n                             const jerry_object_native_info_t *native_info_p, /**< object's native type info */\n                             void *native_pointer_p) /**< native pointer */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_object (object))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (object);\n\n    ecma_create_native_pointer_property (object_p, native_pointer_p, native_info_p);\n  }\n} /* jerry_object_set_native_ptr */\n\n/**\n * Checks whether the argument object has a native pointer set for the specified native type info.\n *\n * @return true if the native pointer has been set,\n *         false otherwise\n */\nbool\njerry_object_has_native_ptr (const jerry_value_t object, /**< object to set native pointer in */\n                             const jerry_object_native_info_t *native_info_p) /**< object's native type info */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object))\n  {\n    return false;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n  ecma_native_pointer_t *native_pointer_p = ecma_get_native_pointer_value (obj_p, (void *) native_info_p);\n\n  return native_pointer_p != NULL;\n} /* jerry_object_has_native_ptr */\n\n/**\n * Delete the previously set native pointer by the native type info from the specified object.\n *\n * Note:\n *      If the specified object has no matching native pointer for the given native type info\n *      the function has no effect.\n *\n * Note:\n *      This operation cannot throw an exception.\n *\n * @return true - if the native pointer has been deleted succesfully\n *         false - otherwise\n */\nbool\njerry_object_delete_native_ptr (jerry_value_t object, /**< object to delete native pointer from */\n                                const jerry_object_native_info_t *native_info_p) /**< object's native type info */\n{\n  jerry_assert_api_enabled ();\n\n  if (ecma_is_value_object (object))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (object);\n\n    return ecma_delete_native_pointer_property (object_p, (void *) native_info_p);\n  }\n\n  return false;\n} /* jerry_object_delete_native_ptr */\n\n/**\n * Initialize the references stored in a buffer pointed by a native pointer.\n * The references are initialized to undefined.\n */\nvoid\njerry_native_ptr_init (void *native_pointer_p, /**< a valid non-NULL pointer to a native buffer */\n                       const jerry_object_native_info_t *native_info_p) /**< the type info of\n                                                                         *   the native pointer */\n{\n  jerry_assert_api_enabled ();\n\n  if (native_pointer_p == NULL || native_info_p == NULL)\n  {\n    return;\n  }\n\n  ecma_value_t *value_p = (ecma_value_t *) (((uint8_t *) native_pointer_p) + native_info_p->offset_of_references);\n  ecma_value_t *end_p = value_p + native_info_p->number_of_references;\n\n  while (value_p < end_p)\n  {\n    *value_p++ = ECMA_VALUE_UNDEFINED;\n  }\n} /* jerry_native_ptr_init */\n\n/**\n * Release the value references after a buffer pointed by a native pointer\n * is not attached to an object anymore. All references are set to undefined\n * similar to jerry_native_ptr_init.\n */\nvoid\njerry_native_ptr_free (void *native_pointer_p, /**< a valid non-NULL pointer to a native buffer */\n                       const jerry_object_native_info_t *native_info_p) /**< the type info of\n                                                                         *   the native pointer */\n{\n  jerry_assert_api_enabled ();\n\n  if (native_pointer_p == NULL || native_info_p == NULL)\n  {\n    return;\n  }\n\n  ecma_value_t *value_p = (ecma_value_t *) (((uint8_t *) native_pointer_p) + native_info_p->offset_of_references);\n  ecma_value_t *end_p = value_p + native_info_p->number_of_references;\n\n  while (value_p < end_p)\n  {\n    ecma_free_value_if_not_object (*value_p);\n    *value_p++ = ECMA_VALUE_UNDEFINED;\n  }\n} /* jerry_native_ptr_free */\n\n/**\n * Updates a value reference inside the area specified by the number_of_references and\n * offset_of_references fields in its corresponding jerry_object_native_info_t data.\n * The area must be part of a buffer which is currently assigned to an object.\n *\n * Note:\n *      Error references are not supported, they are replaced by undefined values.\n */\nvoid\njerry_native_ptr_set (jerry_value_t *reference_p, /**< a valid non-NULL pointer to\n                                                   *   a reference in a native buffer. */\n                      const jerry_value_t value) /**< new value of the reference */\n{\n  jerry_assert_api_enabled ();\n\n  if (reference_p == NULL)\n  {\n    return;\n  }\n\n  ecma_free_value_if_not_object (*reference_p);\n\n  if (ecma_is_value_exception (value))\n  {\n    *reference_p = ECMA_VALUE_UNDEFINED;\n    return;\n  }\n\n  *reference_p = ecma_copy_value_if_not_object (value);\n} /* jerry_native_ptr_set */\n\n/**\n * Applies the given function to the every property in the object.\n *\n * @return true - if object fields traversal was performed successfully, i.e.:\n *                - no unhandled exceptions were thrown in object fields traversal;\n *                - object fields traversal was stopped on callback that returned false;\n *         false - otherwise,\n *                 if getter of field threw a exception or unhandled exceptions were thrown during traversal;\n */\nbool\njerry_object_foreach (const jerry_value_t object, /**< object value */\n                      jerry_object_property_foreach_cb_t foreach_p, /**< foreach function */\n                      void *user_data_p) /**< user data for foreach function */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object))\n  {\n    return false;\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (object);\n  ecma_collection_t *names_p = ecma_op_object_enumerate (object_p);\n\n#if JERRY_BUILTIN_PROXY\n  if (names_p == NULL)\n  {\n    // TODO: Due to Proxies the return value must be changed to jerry_value_t on next release\n    jcontext_release_exception ();\n    return false;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_value_t *buffer_p = names_p->buffer_p;\n\n  ecma_value_t property_value = ECMA_VALUE_EMPTY;\n\n  bool continuous = true;\n\n  for (uint32_t i = 0; continuous && (i < names_p->item_count); i++)\n  {\n    ecma_string_t *property_name_p = ecma_get_string_from_value (buffer_p[i]);\n\n    property_value = ecma_op_object_get (object_p, property_name_p);\n\n    if (ECMA_IS_VALUE_ERROR (property_value))\n    {\n      break;\n    }\n\n    continuous = foreach_p (buffer_p[i], property_value, user_data_p);\n    ecma_free_value (property_value);\n  }\n\n  ecma_collection_free (names_p);\n\n  if (!ECMA_IS_VALUE_ERROR (property_value))\n  {\n    return true;\n  }\n\n  jcontext_release_exception ();\n  return false;\n} /* jerry_object_foreach */\n\n/**\n * Gets the property keys for the given object using the selected filters.\n *\n * @return array containing the filtered property keys in successful operation\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_object_property_names (const jerry_value_t object, /**< object */\n                             jerry_property_filter_t filter) /**< property filter options */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_object (object))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n  ecma_object_t *obj_iter_p = obj_p;\n  ecma_collection_t *result_p = ecma_new_collection ();\n\n  ecma_ref_object (obj_iter_p);\n\n  while (true)\n  {\n    /* Step 1. Get Object.[[OwnKeys]] */\n    ecma_collection_t *prop_names_p = ecma_op_object_own_property_keys (obj_iter_p, filter);\n\n#if JERRY_BUILTIN_PROXY\n    if (prop_names_p == NULL)\n    {\n      ecma_deref_object (obj_iter_p);\n      return ecma_create_exception_from_context ();\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    for (uint32_t i = 0; i < prop_names_p->item_count; i++)\n    {\n      ecma_value_t key = prop_names_p->buffer_p[i];\n      ecma_string_t *key_p = ecma_get_prop_name_from_value (key);\n      uint32_t index = ecma_string_get_array_index (key_p);\n\n      /* Step 2. Filter by key type */\n      if (filter\n          & (JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS | JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS\n             | JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES))\n      {\n        if (ecma_is_value_symbol (key))\n        {\n          if (filter & JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS)\n          {\n            continue;\n          }\n        }\n        else if (index != ECMA_STRING_NOT_ARRAY_INDEX)\n        {\n          if ((filter & JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES)\n              || ((filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS)\n                  && !(filter & JERRY_PROPERTY_FILTER_INTEGER_INDICES_AS_NUMBER)))\n          {\n            continue;\n          }\n        }\n        else if (filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS)\n        {\n          continue;\n        }\n      }\n\n      /* Step 3. Filter property attributes */\n      if (filter\n          & (JERRY_PROPERTY_FILTER_EXCLUDE_NON_CONFIGURABLE | JERRY_PROPERTY_FILTER_EXCLUDE_NON_ENUMERABLE\n             | JERRY_PROPERTY_FILTER_EXCLUDE_NON_WRITABLE))\n      {\n        ecma_property_descriptor_t prop_desc;\n        ecma_value_t status = ecma_op_object_get_own_property_descriptor (obj_iter_p, key_p, &prop_desc);\n\n#if JERRY_BUILTIN_PROXY\n        if (ECMA_IS_VALUE_ERROR (status))\n        {\n          ecma_collection_free (prop_names_p);\n          ecma_collection_free (result_p);\n          ecma_deref_object (obj_iter_p);\n          return ecma_create_exception_from_context ();\n        }\n#endif /* JERRY_BUILTIN_PROXY */\n\n        JERRY_ASSERT (ecma_is_value_true (status));\n        uint16_t flags = prop_desc.flags;\n        ecma_free_property_descriptor (&prop_desc);\n\n        if ((!(flags & JERRY_PROP_IS_CONFIGURABLE) && (filter & JERRY_PROPERTY_FILTER_EXCLUDE_NON_CONFIGURABLE))\n            || (!(flags & JERRY_PROP_IS_ENUMERABLE) && (filter & JERRY_PROPERTY_FILTER_EXCLUDE_NON_ENUMERABLE))\n            || (!(flags & JERRY_PROP_IS_WRITABLE) && (filter & JERRY_PROPERTY_FILTER_EXCLUDE_NON_WRITABLE)))\n        {\n          continue;\n        }\n      }\n\n      if (index != ECMA_STRING_NOT_ARRAY_INDEX && (filter & JERRY_PROPERTY_FILTER_INTEGER_INDICES_AS_NUMBER))\n      {\n        ecma_deref_ecma_string (key_p);\n        key = ecma_make_uint32_value (index);\n      }\n      else\n      {\n        ecma_ref_ecma_string (key_p);\n      }\n\n      if ((filter & JERRY_PROPERTY_FILTER_TRAVERSE_PROTOTYPE_CHAIN) && obj_iter_p != obj_p)\n      {\n        uint32_t duplicate_idx = 0;\n        while (duplicate_idx < result_p->item_count)\n        {\n          ecma_value_t value = result_p->buffer_p[duplicate_idx];\n          JERRY_ASSERT (ecma_is_value_prop_name (value) || ecma_is_value_number (value));\n          if (JERRY_UNLIKELY (ecma_is_value_number (value)))\n          {\n            if (ecma_get_number_from_value (value) == ecma_get_number_from_value (key))\n            {\n              break;\n            }\n          }\n          else if (ecma_compare_ecma_strings (ecma_get_prop_name_from_value (value), key_p))\n          {\n            break;\n          }\n\n          duplicate_idx++;\n        }\n\n        if (duplicate_idx == result_p->item_count)\n        {\n          ecma_collection_push_back (result_p, key);\n        }\n      }\n      else\n      {\n        ecma_collection_push_back (result_p, key);\n      }\n    }\n\n    ecma_collection_free (prop_names_p);\n\n    /* Step 4: Traverse prototype chain */\n\n    if ((filter & JERRY_PROPERTY_FILTER_TRAVERSE_PROTOTYPE_CHAIN) != JERRY_PROPERTY_FILTER_TRAVERSE_PROTOTYPE_CHAIN)\n    {\n      break;\n    }\n\n    ecma_object_t *proto_p = ecma_op_object_get_prototype_of (obj_iter_p);\n\n    if (proto_p == NULL)\n    {\n      break;\n    }\n\n    ecma_deref_object (obj_iter_p);\n\n    if (JERRY_UNLIKELY (proto_p == ECMA_OBJECT_POINTER_ERROR))\n    {\n      ecma_collection_free (result_p);\n      return ecma_create_exception_from_context ();\n    }\n\n    obj_iter_p = proto_p;\n  }\n\n  ecma_deref_object (obj_iter_p);\n\n  return ecma_op_new_array_object_from_collection (result_p, false);\n} /* jerry_object_property_names */\n\n/**\n * FromPropertyDescriptor abstract operation.\n *\n * @return new jerry_value_t - if success\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_property_descriptor_to_object (const jerry_property_descriptor_t *src_prop_desc_p) /**< property descriptor */\n{\n  jerry_assert_api_enabled ();\n\n  ecma_property_descriptor_t prop_desc = jerry_property_descriptor_to_ecma (src_prop_desc_p);\n\n  if (ECMA_IS_VALUE_ERROR (prop_desc.value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_object_t *desc_obj_p = ecma_op_from_property_descriptor (&prop_desc);\n\n  return ecma_make_object_value (desc_obj_p);\n} /* jerry_property_descriptor_to_object */\n\n/**\n * ToPropertyDescriptor abstract operation.\n *\n * @return true - if the conversion is successful\n *         thrown error - otherwise\n */\njerry_value_t\njerry_property_descriptor_from_object (const jerry_value_t object, /**< object value */\n                                       jerry_property_descriptor_t *out_prop_desc_p) /**< [out] filled property\n                                                                                      * descriptor if return value is\n                                                                                      * true, unmodified otherwise */\n{\n  jerry_assert_api_enabled ();\n\n  ecma_property_descriptor_t prop_desc;\n  jerry_value_t result = ecma_op_to_property_descriptor (object, &prop_desc);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return ecma_create_exception_from_context ();\n  }\n\n  JERRY_ASSERT (result == ECMA_VALUE_EMPTY);\n\n  *out_prop_desc_p = jerry_property_descriptor_from_ecma (&prop_desc);\n  return ECMA_VALUE_TRUE;\n} /* jerry_property_descriptor_from_object */\n\n/**\n * Resolve a promise value with an argument.\n *\n * @return undefined - if success,\n *         exception - otherwise\n */\njerry_value_t\njerry_promise_resolve (jerry_value_t promise, /**< the promise value */\n                       const jerry_value_t argument) /**< the argument */\n{\n  jerry_assert_api_enabled ();\n\n  if (!jerry_value_is_promise (promise))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  if (ecma_is_value_exception (argument))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n  }\n\n  return ecma_fulfill_promise_with_checks (promise, argument);\n} /* jerry_promise_resolve */\n\n/**\n * Reject a promise value with an argument.\n *\n * @return undefined - if success,\n *         exception - otherwise\n */\njerry_value_t\njerry_promise_reject (jerry_value_t promise, /**< the promise value */\n                      const jerry_value_t argument) /**< the argument */\n{\n  jerry_assert_api_enabled ();\n\n  if (!jerry_value_is_promise (promise))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  if (ecma_is_value_exception (argument))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n  }\n\n  return ecma_reject_promise_with_checks (promise, argument);\n} /* jerry_promise_reject */\n\n/**\n * Get the result of a promise.\n *\n * @return - Promise result\n *         - Type error if the promise support was not enabled or the input was not a promise object\n */\njerry_value_t\njerry_promise_result (const jerry_value_t promise) /**< promise object to get the result from */\n{\n  jerry_assert_api_enabled ();\n\n  if (!jerry_value_is_promise (promise))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  return ecma_promise_get_result (ecma_get_object_from_value (promise));\n} /* jerry_get_promise_result */\n\n/**\n * Get the state of a promise object.\n *\n * @return - the state of the promise (one of the jerry_promise_state_t enum values)\n *         - JERRY_PROMISE_STATE_NONE is only returned if the input is not a promise object\n *           or the promise support was not enabled.\n */\njerry_promise_state_t\njerry_promise_state (const jerry_value_t promise) /**< promise object to get the state from */\n{\n  jerry_assert_api_enabled ();\n\n  if (!jerry_value_is_promise (promise))\n  {\n    return JERRY_PROMISE_STATE_NONE;\n  }\n\n  uint16_t flags = ecma_promise_get_flags (ecma_get_object_from_value (promise));\n  flags &= (ECMA_PROMISE_IS_PENDING | ECMA_PROMISE_IS_FULFILLED);\n\n  return (flags ? flags : JERRY_PROMISE_STATE_REJECTED);\n} /* jerry_get_promise_state */\n\n/**\n * Sets a callback for tracking Promise and async operations.\n *\n * Note:\n *     the previous callback is overwritten\n */\nvoid\njerry_promise_on_event (jerry_promise_event_filter_t filters, /**< combination of event filters */\n                        jerry_promise_event_cb_t callback, /**< notification callback */\n                        void *user_p) /**< user pointer passed to the callback */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_PROMISE_CALLBACK\n  if (filters == JERRY_PROMISE_EVENT_FILTER_DISABLE || callback == NULL)\n  {\n    JERRY_CONTEXT (promise_callback_filters) = JERRY_PROMISE_EVENT_FILTER_DISABLE;\n    return;\n  }\n\n  JERRY_CONTEXT (promise_callback_filters) = (uint32_t) filters;\n  JERRY_CONTEXT (promise_callback) = callback;\n  JERRY_CONTEXT (promise_callback_user_p) = user_p;\n#else /* !JERRY_PROMISE_CALLBACK */\n  JERRY_UNUSED (filters);\n  JERRY_UNUSED (callback);\n  JERRY_UNUSED (user_p);\n#endif /* JERRY_PROMISE_CALLBACK */\n} /* jerry_promise_set_callback */\n\n/**\n * Get the well-knwon symbol represented by the given `symbol` enum value.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return undefined value - if invalid well-known symbol was requested\n *         well-known symbol value - otherwise\n */\njerry_value_t\njerry_symbol (jerry_well_known_symbol_t symbol) /**< jerry_well_known_symbol_t enum value */\n{\n  jerry_assert_api_enabled ();\n\n  lit_magic_string_id_t id = (lit_magic_string_id_t) (LIT_GLOBAL_SYMBOL__FIRST + symbol);\n\n  if (!LIT_IS_GLOBAL_SYMBOL (id))\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  return ecma_make_symbol_value (ecma_op_get_global_symbol (id));\n} /* jerry_get_well_known_symbol */\n\n/**\n * Returns the description internal property of a symbol.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return string or undefined value containing the symbol's description - if success\n *         thrown error - otherwise\n */\njerry_value_t\njerry_symbol_description (const jerry_value_t symbol) /**< symbol value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_symbol (symbol))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  /* Note: This operation cannot throw an error */\n  return ecma_copy_value (ecma_get_symbol_description (ecma_get_symbol_from_value (symbol)));\n} /* jerry_get_symbol_description */\n\n/**\n * Call the SymbolDescriptiveString ecma builtin operation on the symbol value.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return string value containing the symbol's descriptive string - if success\n *         thrown error - otherwise\n */\njerry_value_t\njerry_symbol_descriptive_string (const jerry_value_t symbol) /**< symbol value */\n{\n  jerry_assert_api_enabled ();\n\n  if (!ecma_is_value_symbol (symbol))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  /* Note: This operation cannot throw an error */\n  return ecma_get_symbol_descriptive_string (symbol);\n} /* jerry_get_symbol_descriptive_string */\n\n/**\n * Get the number of uint64 digits of a BigInt value\n *\n * @return number of uint64 digits\n */\nuint32_t\njerry_bigint_digit_count (const jerry_value_t value) /**< BigInt value */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_BIGINT\n  if (!ecma_is_value_bigint (value))\n  {\n    return 0;\n  }\n\n  return ecma_bigint_get_size_in_digits (value);\n#else /* !JERRY_BUILTIN_BIGINT */\n  JERRY_UNUSED (value);\n  return 0;\n#endif /* JERRY_BUILTIN_BIGINT */\n} /* jerry_bigint_digit_count */\n\n/**\n * Get the uint64 digits of a BigInt value (lowest digit first)\n */\nvoid\njerry_bigint_to_digits (const jerry_value_t value, /**< BigInt value */\n                        uint64_t *digits_p, /**< [out] buffer for digits */\n                        uint32_t digit_count, /**< buffer size in digits */\n                        bool *sign_p) /**< [out] sign of BigInt */\n{\n#if JERRY_BUILTIN_BIGINT\n  if (!ecma_is_value_bigint (value))\n  {\n    if (sign_p != NULL)\n    {\n      *sign_p = false;\n    }\n    memset (digits_p, 0, digit_count * sizeof (uint64_t));\n  }\n\n  ecma_bigint_get_digits_and_sign (value, digits_p, digit_count, sign_p);\n#else /* !JERRY_BUILTIN_BIGINT */\n  JERRY_UNUSED (value);\n\n  if (sign_p != NULL)\n  {\n    *sign_p = false;\n  }\n  memset (digits_p, 0, digit_count * sizeof (uint64_t));\n#endif /* JERRY_BUILTIN_BIGINT */\n} /* jerry_bigint_to_digits */\n\n/**\n * Get the target object of a Proxy object\n *\n * @return type error - if proxy_value is not a Proxy object\n *         target object - otherwise\n */\njerry_value_t\njerry_proxy_target (const jerry_value_t proxy_value) /**< proxy value */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_PROXY\n  if (ecma_is_value_object (proxy_value))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (proxy_value);\n\n    if (ECMA_OBJECT_IS_PROXY (object_p))\n    {\n      ecma_proxy_object_t *proxy_object_p = (ecma_proxy_object_t *) object_p;\n\n      if (!ecma_is_value_null (proxy_object_p->target))\n      {\n        ecma_ref_object (ecma_get_object_from_value (proxy_object_p->target));\n      }\n      return proxy_object_p->target;\n    }\n  }\n#else /* !JERRY_BUILTIN_PROXY */\n  JERRY_UNUSED (proxy_value);\n#endif /* JERRY_BUILTIN_PROXY */\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_ARGUMENT_IS_NOT_A_PROXY));\n} /* jerry_proxy_target */\n\n/**\n * Get the handler object of a Proxy object\n *\n * @return type error - if proxy_value is not a Proxy object\n *         handler object - otherwise\n */\njerry_value_t\njerry_proxy_handler (const jerry_value_t proxy_value) /**< proxy value */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_PROXY\n  if (ecma_is_value_object (proxy_value))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (proxy_value);\n\n    if (ECMA_OBJECT_IS_PROXY (object_p))\n    {\n      ecma_proxy_object_t *proxy_object_p = (ecma_proxy_object_t *) object_p;\n\n      if (!ecma_is_value_null (proxy_object_p->handler))\n      {\n        ecma_ref_object (ecma_get_object_from_value (proxy_object_p->handler));\n      }\n      return proxy_object_p->handler;\n    }\n  }\n#else /* !JERRY_BUILTIN_PROXY */\n  JERRY_UNUSED (proxy_value);\n#endif /* JERRY_BUILTIN_PROXY */\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_ARGUMENT_IS_NOT_A_PROXY));\n} /* jerry_proxy_handler */\n\n/**\n * Validate string buffer for the specified encoding\n *\n * @return true - if string is well-formed\n *         false - otherwise\n */\nbool\njerry_validate_string (const jerry_char_t *buffer_p, /**< string buffer */\n                       jerry_size_t buffer_size, /**< buffer size */\n                       jerry_encoding_t encoding) /**< buffer encoding */\n{\n  switch (encoding)\n  {\n    case JERRY_ENCODING_CESU8:\n    {\n      return lit_is_valid_cesu8_string (buffer_p, buffer_size);\n    }\n    case JERRY_ENCODING_UTF8:\n    {\n      return lit_is_valid_utf8_string (buffer_p, buffer_size, true);\n    }\n    default:\n    {\n      return false;\n    }\n  }\n} /* jerry_validate_string */\n\n/**\n * Set the log level of the engine.\n *\n * Log messages with lower significance than the current log level will be ignored by `jerry_log`.\n *\n * @param level: requested log level\n */\nvoid\njerry_log_set_level (jerry_log_level_t level)\n{\n  jerry_jrt_set_log_level (level);\n} /* jerry_log_set_level */\n\n/**\n * Log buffer size\n */\n#define JERRY_LOG_BUFFER_SIZE 64\n\n/**\n * Log a zero-terminated string message.\n *\n * @param str_p: message\n */\nstatic void\njerry_log_string (const char *str_p)\n{\n  jerry_port_log (str_p);\n\n#if JERRY_DEBUGGER\n  if (jerry_debugger_is_connected ())\n  {\n    jerry_debugger_send_string (JERRY_DEBUGGER_OUTPUT_RESULT,\n                                JERRY_DEBUGGER_OUTPUT_LOG,\n                                (const uint8_t *) str_p,\n                                strlen (str_p));\n  }\n#endif /* JERRY_DEBUGGER */\n} /* jerry_log_string */\n\n/**\n * Log a fixed-size string message.\n *\n * @param str_p: message\n * @param size: size\n * @param buffer_p: buffer to use\n */\nstatic void\njerry_log_string_fixed (const char *str_p, size_t size, char *buffer_p)\n{\n  const size_t batch_size = JERRY_LOG_BUFFER_SIZE - 1;\n\n  while (size > batch_size)\n  {\n    memcpy (buffer_p, str_p, batch_size);\n    buffer_p[batch_size] = '\\0';\n    jerry_log_string (buffer_p);\n\n    str_p += batch_size;\n    size -= batch_size;\n  }\n\n  memcpy (buffer_p, str_p, size);\n  buffer_p[size] = '\\0';\n  jerry_log_string (buffer_p);\n} /* jerry_log_string_fixed */\n\n/**\n * Format an unsigned number.\n *\n * @param num: number\n * @param width: minimum width of the number\n * @param padding: padding to be used when extending to minimum width\n * @param radix: number radix\n * @param buffer_p: buffer used to construct the number string\n *\n * @return formatted number as string\n */\nstatic char *\njerry_format_unsigned (unsigned int num, uint8_t width, char padding, uint8_t radix, char *buffer_p)\n{\n  static const char digits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };\n  char *cursor_p = buffer_p + JERRY_LOG_BUFFER_SIZE;\n  *(--cursor_p) = '\\0';\n  uint8_t count = 0;\n\n  do\n  {\n    *(--cursor_p) = digits[num % radix];\n    num /= radix;\n    count++;\n  } while (num > 0);\n\n  while (count < width)\n  {\n    *(--cursor_p) = padding;\n    count++;\n  }\n\n  return cursor_p;\n} /* jerry_format_unsigned */\n\n/**\n * Format an integer number.\n *\n * @param num: number\n * @param width: minimum width of the number\n * @param padding: padding to be used when extending to minimum width\n * @param buffer_p: buffer used to construct the number string\n *\n * @return formatted number as string\n */\nstatic char *\njerry_format_int (int num, uint8_t width, char padding, char *buffer_p)\n{\n  if (num >= 0)\n  {\n    return jerry_format_unsigned ((unsigned) num, width, padding, 10, buffer_p);\n  }\n\n  num = -num;\n\n  if (padding == '0' && width > 0)\n  {\n    char *cursor_p = jerry_format_unsigned ((unsigned) num, --width, padding, 10, buffer_p);\n    *(--cursor_p) = '-';\n    return cursor_p;\n  }\n\n  char *cursor_p = jerry_format_unsigned ((unsigned) num, 0, ' ', 10, buffer_p);\n  *(--cursor_p) = '-';\n\n  char *indent_p = buffer_p + JERRY_LOG_BUFFER_SIZE - width - 1;\n\n  while (cursor_p > indent_p)\n  {\n    *(--cursor_p) = ' ';\n  }\n\n  return cursor_p;\n} /* jerry_foramt_int */\n\n/**\n * Log a zero-terminated formatted message with the specified log level.\n *\n * Supported format specifiers:\n *   %s: zero-terminated string\n *   %c: character\n *   %u: unsigned integer\n *   %d: decimal integer\n *   %x: unsigned hexadecimal\n *\n * Width and padding sub-modifiers are also supported.\n *\n * @param format_p: format string\n * @param level: message log level\n */\nvoid\njerry_log (jerry_log_level_t level, const char *format_p, ...)\n{\n  if (level > jerry_jrt_get_log_level ())\n  {\n    return;\n  }\n\n  va_list vl;\n  char buffer_p[JERRY_LOG_BUFFER_SIZE];\n  uint32_t buffer_index = 0;\n  const char *cursor_p = format_p;\n  va_start (vl, format_p);\n\n  while (*cursor_p != '\\0')\n  {\n    if (*cursor_p == '%' || buffer_index > JERRY_LOG_BUFFER_SIZE - 2)\n    {\n      buffer_p[buffer_index] = '\\0';\n      jerry_log_string (buffer_p);\n      buffer_index = 0;\n    }\n\n    if (*cursor_p != '%')\n    {\n      buffer_p[buffer_index++] = *cursor_p++;\n      continue;\n    }\n\n    ++cursor_p;\n    uint8_t width = 0;\n    size_t precision = 0;\n    char padding = ' ';\n\n    if (*cursor_p == '0')\n    {\n      padding = '0';\n      cursor_p++;\n    }\n\n    if (lit_char_is_decimal_digit ((ecma_char_t) *cursor_p))\n    {\n      width = (uint8_t) (*cursor_p - '0');\n      cursor_p++;\n    }\n    else if (*cursor_p == '*')\n    {\n      width = (uint8_t) JERRY_MAX (va_arg (vl, int), 10);\n      cursor_p++;\n    }\n    else if (*cursor_p == '.' && *(cursor_p + 1) == '*')\n    {\n      precision = (size_t) va_arg (vl, int);\n      cursor_p += 2;\n    }\n\n    if (*cursor_p == '\\0')\n    {\n      buffer_p[buffer_index++] = '%';\n      break;\n    }\n\n    /* The buffer is always flushed before a substitution, and can be reused to for formatting. */\n    switch (*cursor_p++)\n    {\n      case 's':\n      {\n        char *str_p = va_arg (vl, char *);\n\n        if (precision == 0)\n        {\n          jerry_log_string (str_p);\n          break;\n        }\n\n        jerry_log_string_fixed (str_p, precision, buffer_p);\n        break;\n      }\n      case 'c':\n      {\n        /* Arguments of types narrower than int are promoted to int for variadic functions */\n        buffer_p[buffer_index++] = (char) va_arg (vl, int);\n        break;\n      }\n      case 'd':\n      {\n        jerry_log_string (jerry_format_int (va_arg (vl, int), width, padding, buffer_p));\n        break;\n      }\n      case 'u':\n      {\n        jerry_log_string (jerry_format_unsigned (va_arg (vl, unsigned int), width, padding, 10, buffer_p));\n        break;\n      }\n      case 'x':\n      {\n        jerry_log_string (jerry_format_unsigned (va_arg (vl, unsigned int), width, padding, 16, buffer_p));\n        break;\n      }\n      default:\n      {\n        buffer_p[buffer_index++] = '%';\n        break;\n      }\n    }\n  }\n\n  if (buffer_index > 0)\n  {\n    buffer_p[buffer_index] = '\\0';\n    jerry_log_string (buffer_p);\n  }\n\n  va_end (vl);\n} /* jerry_log */\n\n/**\n * Allocate memory on the engine's heap.\n *\n * Note:\n *      This function may take away memory from the executed JavaScript code.\n *      If any other dynamic memory allocation API is available (e.g., libc\n *      malloc), it should be used instead.\n *\n * @return allocated memory on success\n *         NULL otherwise\n */\nvoid *\njerry_heap_alloc (jerry_size_t size) /**< size of the memory block */\n{\n  jerry_assert_api_enabled ();\n\n  return jmem_heap_alloc_block_null_on_error (size);\n} /* jerry_heap_alloc */\n\n/**\n * Free memory allocated on the engine's heap.\n */\nvoid\njerry_heap_free (void *mem_p, /**< value returned by jerry_heap_alloc */\n                 jerry_size_t size) /**< same size as passed to jerry_heap_alloc */\n{\n  jerry_assert_api_enabled ();\n\n  jmem_heap_free_block (mem_p, size);\n} /* jerry_heap_free */\n\n/**\n * When JERRY_VM_HALT is enabled, the callback passed to this function\n * is periodically called with the user_p argument. If interval is greater\n * than 1, the callback is only called at every interval ticks.\n */\nvoid\njerry_halt_handler (uint32_t interval, /**< interval of the function call */\n                    jerry_halt_cb_t callback, /**< periodically called user function */\n                    void *user_p) /**< pointer passed to the function */\n{\n#if JERRY_VM_HALT\n  if (interval == 0)\n  {\n    interval = 1;\n  }\n\n  JERRY_CONTEXT (vm_exec_stop_frequency) = interval;\n  JERRY_CONTEXT (vm_exec_stop_counter) = interval;\n  JERRY_CONTEXT (vm_exec_stop_cb) = callback;\n  JERRY_CONTEXT (vm_exec_stop_user_p) = user_p;\n#else /* !JERRY_VM_HALT */\n  JERRY_UNUSED (interval);\n  JERRY_UNUSED (callback);\n  JERRY_UNUSED (user_p);\n#endif /* JERRY_VM_HALT */\n} /* jerry_halt_handler */\n\n/**\n * Get backtrace. The backtrace is an array of strings where\n * each string contains the position of the corresponding frame.\n * The array length is zero if the backtrace is not available.\n *\n * @return array value\n */\njerry_value_t\njerry_backtrace (uint32_t max_depth) /**< depth limit of the backtrace */\n{\n  return vm_get_backtrace (max_depth);\n} /* jerry_backtrace */\n\n/**\n * Low-level function to capture each backtrace frame.\n * The captured frame data is passed to a callback function.\n */\nvoid\njerry_backtrace_capture (jerry_backtrace_cb_t callback, /**< callback function */\n                         void *user_p) /**< user pointer passed to the callback function */\n{\n  jerry_frame_t frame;\n  vm_frame_ctx_t *context_p = JERRY_CONTEXT (vm_top_context_p);\n\n  while (context_p != NULL)\n  {\n    frame.context_p = context_p;\n    frame.frame_type = JERRY_BACKTRACE_FRAME_JS;\n\n    if (!callback (&frame, user_p))\n    {\n      return;\n    }\n\n    context_p = context_p->prev_context_p;\n  }\n} /* jerry_backtrace */\n\n/**\n * Returns with the type of the backtrace frame.\n *\n * @return frame type listed in jerry_frame_type_t\n */\njerry_frame_type_t\njerry_frame_type (const jerry_frame_t *frame_p) /**< frame pointer */\n{\n  return (jerry_frame_type_t) frame_p->frame_type;\n} /* jerry_frame_type */\n\n/**\n * Initialize and return with the location private field of a backtrace frame.\n *\n * @return pointer to the location private field - if the location is available,\n *         NULL - otherwise\n */\nconst jerry_frame_location_t *\njerry_frame_location (jerry_frame_t *frame_p) /**< frame pointer */\n{\n  JERRY_UNUSED (frame_p);\n\n#if JERRY_LINE_INFO\n  if (frame_p->frame_type == JERRY_BACKTRACE_FRAME_JS)\n  {\n    vm_frame_ctx_t *context_p = frame_p->context_p;\n    const ecma_compiled_code_t *bytecode_header_p = context_p->shared_p->bytecode_header_p;\n\n    if (!(bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO))\n    {\n      return NULL;\n    }\n\n    frame_p->location.source_name = ecma_get_source_name (bytecode_header_p);\n\n    ecma_line_info_get (ecma_compiled_code_get_line_info (bytecode_header_p),\n                        (uint32_t) (context_p->byte_code_p - context_p->byte_code_start_p),\n                        &frame_p->location);\n\n    return &frame_p->location;\n  }\n#endif /* JERRY_LINE_INFO */\n\n  return NULL;\n} /* jerry_frame_location */\n\n/**\n * Initialize and return with the called function private field of a backtrace frame.\n * The backtrace frame is created for running the code bound to this function.\n *\n * @return pointer to the called function - if the function is available,\n *         NULL - otherwise\n */\nconst jerry_value_t *\njerry_frame_callee (jerry_frame_t *frame_p) /**< frame pointer */\n{\n  if (frame_p->frame_type == JERRY_BACKTRACE_FRAME_JS)\n  {\n    vm_frame_ctx_t *context_p = frame_p->context_p;\n\n    if (context_p->shared_p->function_object_p != NULL)\n    {\n      frame_p->function = ecma_make_object_value (context_p->shared_p->function_object_p);\n      return &frame_p->function;\n    }\n  }\n\n  return NULL;\n} /* jerry_frame_callee */\n\n/**\n * Initialize and return with the 'this' binding private field of a backtrace frame.\n * The 'this' binding is a hidden value passed to the called function. As for arrow\n * functions, the 'this' binding is assigned at function creation.\n *\n * @return pointer to the 'this' binding - if the binding is available,\n *         NULL - otherwise\n */\nconst jerry_value_t *\njerry_frame_this (jerry_frame_t *frame_p) /**< frame pointer */\n{\n  if (frame_p->frame_type == JERRY_BACKTRACE_FRAME_JS)\n  {\n    frame_p->this_binding = frame_p->context_p->this_binding;\n    return &frame_p->this_binding;\n  }\n\n  return NULL;\n} /* jerry_frame_this */\n\n/**\n * Returns true, if the code bound to the backtrace frame is strict mode code.\n *\n * @return true - if strict mode code is bound to the frame,\n *         false - otherwise\n */\nbool\njerry_frame_is_strict (jerry_frame_t *frame_p) /**< frame pointer */\n{\n  return (frame_p->frame_type == JERRY_BACKTRACE_FRAME_JS\n          && (frame_p->context_p->status_flags & VM_FRAME_CTX_IS_STRICT) != 0);\n} /* jerry_frame_is_strict */\n\n/**\n * Get the source name (usually a file name) of the currently executed script or the given function object\n *\n * Note: returned value must be freed with jerry_value_free, when it is no longer needed\n *\n * @return JS string constructed from\n *         - the currently executed function object's source name, if the given value is undefined\n *         - source name of the function object, if the given value is a function object\n *         - \"<anonymous>\", otherwise\n */\njerry_value_t\njerry_source_name (const jerry_value_t value) /**< jerry api value */\n{\n#if JERRY_SOURCE_NAME\n  if (ecma_is_value_undefined (value) && JERRY_CONTEXT (vm_top_context_p) != NULL)\n  {\n    return ecma_copy_value (ecma_get_source_name (JERRY_CONTEXT (vm_top_context_p)->shared_p->bytecode_header_p));\n  }\n\n  ecma_value_t script_value = ecma_script_get_from_value (value);\n\n  if (script_value == JMEM_CP_NULL)\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING_SOURCE_NAME_ANON);\n  }\n\n  const cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n\n  return ecma_copy_value (script_p->source_name);\n#else /* !JERRY_SOURCE_NAME */\n  JERRY_UNUSED (value);\n  return ecma_make_magic_string_value (LIT_MAGIC_STRING_SOURCE_NAME_ANON);\n#endif /* JERRY_SOURCE_NAME */\n} /* jerry_source_name */\n\n/**\n * Returns the user value assigned to a script / module / function.\n *\n * Note:\n *    This value is usually set by the parser when\n *    the JERRY_PARSE_HAS_USER_VALUE flag is passed.\n *\n * @return user value\n */\njerry_value_t\njerry_source_user_value (const jerry_value_t value) /**< jerry api value */\n{\n  ecma_value_t script_value = ecma_script_get_from_value (value);\n\n  if (script_value == JMEM_CP_NULL)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  const cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n\n  if (!(script_p->refs_and_type & CBC_SCRIPT_HAS_USER_VALUE))\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  return ecma_copy_value (CBC_SCRIPT_GET_USER_VALUE (script_p));\n} /* jerry_source_user_value */\n\n/**\n * Checks whether an ECMAScript code is compiled by eval\n * like (eval, new Function, jerry_eval, etc.) command.\n *\n * @return true, if code is compiled by eval like command\n *         false, otherwise\n */\nbool\njerry_function_is_dynamic (const jerry_value_t value) /**< jerry api value */\n{\n  ecma_value_t script_value = ecma_script_get_from_value (value);\n\n  if (script_value == JMEM_CP_NULL)\n  {\n    return false;\n  }\n\n  const cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n\n  return (script_p->refs_and_type & CBC_SCRIPT_IS_EVAL_CODE) != 0;\n} /* jerry_function_is_dynamic */\n\n/**\n * Returns a newly created source info structure corresponding to the passed script/module/function.\n *\n * @return a newly created source info, if at least one field is available, NULL otherwise\n */\njerry_source_info_t *\njerry_source_info (const jerry_value_t value) /**< jerry api value */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_FUNCTION_TO_STRING\n  if (!ecma_is_value_object (value))\n  {\n    return NULL;\n  }\n\n  jerry_source_info_t source_info;\n\n  source_info.enabled_fields = 0;\n  source_info.source_code = ECMA_VALUE_UNDEFINED;\n  source_info.function_arguments = ECMA_VALUE_UNDEFINED;\n  source_info.source_range_start = 0;\n  source_info.source_range_length = 0;\n\n  ecma_object_t *object_p = ecma_get_object_from_value (value);\n  cbc_script_t *script_p = NULL;\n\n  while (true)\n  {\n    switch (ecma_get_object_type (object_p))\n    {\n      case ECMA_OBJECT_TYPE_CLASS:\n      {\n        ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n        const ecma_compiled_code_t *bytecode_p = NULL;\n\n        if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_SCRIPT)\n        {\n          bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);\n        }\n#if JERRY_MODULE_SYSTEM\n        else if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_MODULE)\n        {\n          ecma_module_t *module_p = (ecma_module_t *) object_p;\n\n          if (!(module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE))\n          {\n            bytecode_p = module_p->u.compiled_code_p;\n          }\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n\n        if (bytecode_p == NULL)\n        {\n          return NULL;\n        }\n\n        ecma_value_t script_value = ((cbc_uint8_arguments_t *) bytecode_p)->script_value;\n        script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_FUNCTION:\n      {\n        const ecma_compiled_code_t *bytecode_p;\n        bytecode_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);\n\n        ecma_value_t script_value = ((cbc_uint8_arguments_t *) bytecode_p)->script_value;\n        script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n\n        if (bytecode_p->status_flags & CBC_CODE_FLAGS_HAS_EXTENDED_INFO)\n        {\n          uint8_t *extended_info_p = ecma_compiled_code_resolve_extended_info (bytecode_p);\n          uint8_t extended_info = *extended_info_p;\n\n          if (extended_info & CBC_EXTENDED_CODE_FLAGS_HAS_ARGUMENT_LENGTH)\n          {\n            ecma_extended_info_decode_vlq (&extended_info_p);\n          }\n\n          if (extended_info & CBC_EXTENDED_CODE_FLAGS_SOURCE_CODE_IN_ARGUMENTS)\n          {\n            ecma_value_t function_arguments = CBC_SCRIPT_GET_FUNCTION_ARGUMENTS (script_p, script_p->refs_and_type);\n\n            ecma_ref_ecma_string (ecma_get_string_from_value (function_arguments));\n\n            source_info.enabled_fields |= JERRY_SOURCE_INFO_HAS_SOURCE_CODE;\n            source_info.source_code = function_arguments;\n            script_p = NULL;\n          }\n\n          source_info.enabled_fields |= JERRY_SOURCE_INFO_HAS_SOURCE_RANGE;\n          source_info.source_range_start = ecma_extended_info_decode_vlq (&extended_info_p);\n          source_info.source_range_length = ecma_extended_info_decode_vlq (&extended_info_p);\n        }\n\n        JERRY_ASSERT (script_p != NULL || (source_info.enabled_fields & JERRY_SOURCE_INFO_HAS_SOURCE_CODE));\n\n        if (source_info.enabled_fields == 0 && (script_p->refs_and_type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS))\n        {\n          ecma_value_t function_arguments = CBC_SCRIPT_GET_FUNCTION_ARGUMENTS (script_p, script_p->refs_and_type);\n\n          ecma_ref_ecma_string (ecma_get_string_from_value (function_arguments));\n\n          source_info.enabled_fields |= JERRY_SOURCE_INFO_HAS_FUNCTION_ARGUMENTS;\n          source_info.function_arguments = function_arguments;\n        }\n        break;\n      }\n      case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n      {\n        ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n        object_p =\n          ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_object_p->u.bound_function.target_function);\n        continue;\n      }\n      case ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION:\n      {\n        ecma_value_t script_value = ((ecma_extended_object_t *) object_p)->u.constructor_function.script_value;\n        script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n        break;\n      }\n      default:\n      {\n        return NULL;\n      }\n    }\n\n    break;\n  }\n\n  jerry_source_info_t *source_info_p = jmem_heap_alloc_block_null_on_error (sizeof (jerry_source_info_t));\n\n  if (source_info_p == NULL)\n  {\n    return NULL;\n  }\n\n  if (script_p != NULL)\n  {\n    ecma_ref_ecma_string (ecma_get_string_from_value (script_p->source_code));\n\n    source_info.enabled_fields |= JERRY_SOURCE_INFO_HAS_SOURCE_CODE;\n    source_info.source_code = script_p->source_code;\n  }\n\n  JERRY_ASSERT (source_info.enabled_fields != 0);\n\n  *source_info_p = source_info;\n  return source_info_p;\n#else /* !JERRY_FUNCTION_TO_STRING */\n  JERRY_UNUSED (value);\n  return NULL;\n#endif /* JERRY_FUNCTION_TO_STRING */\n} /* jerry_source_info */\n\n/**\n * Frees the the source info structure returned by jerry_source_info.\n */\nvoid\njerry_source_info_free (jerry_source_info_t *source_info_p) /**< source info block */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_FUNCTION_TO_STRING\n  if (source_info_p != NULL)\n  {\n    ecma_free_value (source_info_p->source_code);\n    ecma_free_value (source_info_p->function_arguments);\n    jmem_heap_free_block (source_info_p, sizeof (jerry_source_info_t));\n  }\n#else /* !JERRY_FUNCTION_TO_STRING */\n  JERRY_UNUSED (source_info_p);\n#endif /* JERRY_FUNCTION_TO_STRING */\n} /* jerry_source_info_free */\n\n/**\n * Replaces the currently active realm with another realm.\n *\n * The replacement should be temporary, and the original realm must be\n * restored after the tasks are completed. During the replacement, the\n * realm must be referenced by the application (i.e. the gc must not\n * reclaim it). This is also true to the returned previously active\n * realm, so there is no need to free the value after the restoration.\n *\n * @return previous realm value - if the passed value is a realm\n *         exception - otherwise\n */\njerry_value_t\njerry_set_realm (jerry_value_t realm_value) /**< jerry api value */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_REALMS\n  if (ecma_is_value_object (realm_value))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (realm_value);\n\n    if (ecma_builtin_is_global (object_p))\n    {\n      ecma_global_object_t *previous_global_object_p = JERRY_CONTEXT (global_object_p);\n      JERRY_CONTEXT (global_object_p) = (ecma_global_object_t *) object_p;\n      return ecma_make_object_value ((ecma_object_t *) previous_global_object_p);\n    }\n  }\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_PASSED_ARGUMENT_IS_NOT_A_REALM));\n#else /* !JERRY_BUILTIN_REALMS */\n  JERRY_UNUSED (realm_value);\n  return jerry_throw_sz (JERRY_ERROR_REFERENCE, ecma_get_error_msg (ECMA_ERR_REALM_IS_NOT_AVAILABLE));\n#endif /* JERRY_BUILTIN_REALMS */\n} /* jerry_set_realm */\n\n/**\n * Gets the 'this' binding of a realm\n *\n * @return type error - if realm_value is not a realm\n *         this value - otherwise\n */\njerry_value_t\njerry_realm_this (jerry_value_t realm) /**< realm value */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_REALMS\n  if (ecma_is_value_object (realm))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (realm);\n\n    if (ecma_builtin_is_global (object_p))\n    {\n      ecma_global_object_t *global_object_p = (ecma_global_object_t *) object_p;\n\n      ecma_ref_object (ecma_get_object_from_value (global_object_p->this_binding));\n      return global_object_p->this_binding;\n    }\n  }\n\n#else /* !JERRY_BUILTIN_REALMS */\n  ecma_object_t *global_object_p = ecma_builtin_get_global ();\n\n  if (realm == ecma_make_object_value (global_object_p))\n  {\n    ecma_ref_object (global_object_p);\n    return realm;\n  }\n#endif /* JERRY_BUILTIN_REALMS */\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_PASSED_ARGUMENT_IS_NOT_A_REALM));\n} /* jerry_realm_this */\n\n/**\n * Sets the 'this' binding of a realm\n *\n * This function must be called before executing any script on the realm.\n * Otherwise the operation is undefined.\n *\n * @return type error - if realm_value is not a realm or this_value is not object\n *         true - otherwise\n */\njerry_value_t\njerry_realm_set_this (jerry_value_t realm, /**< realm value */\n                      jerry_value_t this_value) /**< this value */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_REALMS\n  if (!ecma_is_value_object (this_value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_SECOND_ARGUMENT_MUST_BE_AN_OBJECT));\n  }\n\n  if (ecma_is_value_object (realm))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (realm);\n\n    if (ecma_builtin_is_global (object_p))\n    {\n      ecma_global_object_t *global_object_p = (ecma_global_object_t *) object_p;\n      global_object_p->this_binding = this_value;\n\n      ecma_object_t *global_lex_env_p = ecma_create_object_lex_env (NULL, ecma_get_object_from_value (this_value));\n\n      ECMA_SET_NON_NULL_POINTER (global_object_p->global_env_cp, global_lex_env_p);\n      global_object_p->global_scope_cp = global_object_p->global_env_cp;\n\n      ecma_deref_object (global_lex_env_p);\n      return ECMA_VALUE_TRUE;\n    }\n  }\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_FIRST_ARGUMENT_IS_NOT_A_REALM));\n#else /* !JERRY_BUILTIN_REALMS */\n  JERRY_UNUSED (realm);\n  JERRY_UNUSED (this_value);\n  return jerry_throw_sz (JERRY_ERROR_REFERENCE, ecma_get_error_msg (ECMA_ERR_REALM_IS_NOT_AVAILABLE));\n#endif /* JERRY_BUILTIN_REALMS */\n} /* jerry_realm_set_this */\n\n/**\n * Check if the given value is an ArrayBuffer object.\n *\n * @return true - if it is an ArrayBuffer object\n *         false - otherwise\n */\nbool\njerry_value_is_arraybuffer (const jerry_value_t value) /**< value to check if it is an ArrayBuffer */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  return ecma_is_arraybuffer (value);\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (value);\n  return false;\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_value_is_arraybuffer */\n\n/**\n * Creates an ArrayBuffer object with the given length (size).\n *\n * Notes:\n *      * the length is specified in bytes.\n *      * returned value must be freed with jerry_value_free, when it is no longer needed.\n *      * if the typed arrays are disabled this will return a TypeError.\n *\n * @return value of the constructed ArrayBuffer object\n */\njerry_value_t\njerry_arraybuffer (const jerry_length_t size) /**< size of the backing store allocated\n                                               *   for the array buffer in bytes */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  return jerry_return (ecma_make_object_value (ecma_arraybuffer_new_object (size)));\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (size);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_TYPED_ARRAY_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_arraybuffer */\n\n/**\n * Creates an ArrayBuffer object with user specified buffer.\n *\n * Notes:\n *     * the size is specified in bytes.\n *     * the buffer passed should be at least the specified bytes big.\n *     * if the typed arrays are disabled this will return a TypeError.\n *     * if the size is zero or buffer_p is a null pointer this will return an empty ArrayBuffer.\n *\n * @return value of the newly constructed array buffer object\n */\njerry_value_t\njerry_arraybuffer_external (uint8_t *buffer_p, /**< the backing store used by the array buffer object */\n                            jerry_length_t size, /**< size of the buffer in bytes */\n                            void *user_p) /**< user pointer assigned to the array buffer object */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  ecma_object_t *arraybuffer_p;\n\n  if (JERRY_UNLIKELY (size == 0))\n  {\n    arraybuffer_p = ecma_arraybuffer_new_object (0);\n  }\n  else\n  {\n    arraybuffer_p = ecma_arraybuffer_create_object_with_buffer (ECMA_OBJECT_CLASS_ARRAY_BUFFER, size);\n\n    ecma_arraybuffer_pointer_t *arraybuffer_pointer_p = (ecma_arraybuffer_pointer_t *) arraybuffer_p;\n    arraybuffer_pointer_p->arraybuffer_user_p = user_p;\n\n    if (buffer_p != NULL)\n    {\n      arraybuffer_pointer_p->extended_object.u.cls.u1.array_buffer_flags |= ECMA_ARRAYBUFFER_ALLOCATED;\n      arraybuffer_pointer_p->buffer_p = buffer_p;\n    }\n  }\n\n  return jerry_return (ecma_make_object_value (arraybuffer_p));\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (size);\n  JERRY_UNUSED (buffer_p);\n  JERRY_UNUSED (user_p);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_TYPED_ARRAY_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_arraybuffer_external */\n\n/**\n * Check if the given value is a SharedArrayBuffer object.\n *\n * @return true - if it is a SharedArrayBuffer object\n *         false - otherwise\n */\nbool\njerry_value_is_shared_arraybuffer (const jerry_value_t value) /**< value to check if it is a SharedArrayBuffer */\n{\n  jerry_assert_api_enabled ();\n\n  return ecma_is_shared_arraybuffer (value);\n} /* jerry_value_is_shared_arraybuffer */\n\n/**\n * Creates a SharedArrayBuffer object with the given length (size).\n *\n * Notes:\n *      * the length is specified in bytes.\n *      * returned value must be freed with jerry_value_free, when it is no longer needed.\n *      * if the typed arrays are disabled this will return a TypeError.\n *\n * @return value of the constructed SharedArrayBuffer object\n */\njerry_value_t\njerry_shared_arraybuffer (jerry_length_t size) /**< size of the backing store allocated\n                                                *   for the shared array buffer in bytes */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n  return jerry_return (ecma_make_object_value (ecma_shared_arraybuffer_new_object (size)));\n#else /* !JERRY_BUILTIN_SHAREDARRAYBUFFER */\n  JERRY_UNUSED (size);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_SHARED_ARRAYBUFFER_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n} /* jerry_shared_arraybuffer */\n\n/**\n * Creates a SharedArrayBuffer object with user specified buffer.\n *\n * Notes:\n *     * the size is specified in bytes.\n *     * the buffer passed should be at least the specified bytes big.\n *     * if the typed arrays are disabled this will return a TypeError.\n *     * if the size is zero or buffer_p is a null pointer this will return an empty SharedArrayBuffer.\n *\n * @return value of the newly constructed shared array buffer object\n */\njerry_value_t\njerry_shared_arraybuffer_external (uint8_t *buffer_p, /**< the backing store used by the\n                                                       *   shared array buffer object */\n                                   jerry_length_t size, /**< size of the buffer in bytes */\n                                   void *user_p) /**< user pointer assigned to the\n                                                  *   shared array buffer object */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n  ecma_object_t *shared_arraybuffer_p;\n\n  if (JERRY_UNLIKELY (size == 0))\n  {\n    shared_arraybuffer_p = ecma_shared_arraybuffer_new_object (0);\n  }\n  else\n  {\n    shared_arraybuffer_p = ecma_arraybuffer_create_object_with_buffer (ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER, size);\n\n    ecma_arraybuffer_pointer_t *shared_arraybuffer_pointer_p = (ecma_arraybuffer_pointer_t *) shared_arraybuffer_p;\n    shared_arraybuffer_pointer_p->arraybuffer_user_p = user_p;\n\n    if (buffer_p != NULL)\n    {\n      shared_arraybuffer_pointer_p->extended_object.u.cls.u1.array_buffer_flags |= ECMA_ARRAYBUFFER_ALLOCATED;\n      shared_arraybuffer_pointer_p->buffer_p = buffer_p;\n    }\n  }\n\n  return ecma_make_object_value (shared_arraybuffer_p);\n#else /* !JERRY_BUILTIN_SHAREDARRAYBUFFER */\n  JERRY_UNUSED (size);\n  JERRY_UNUSED (buffer_p);\n  JERRY_UNUSED (user_p);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_SHARED_ARRAYBUFFER_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n} /* jerry_shared_arraybuffer_external */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/**\n * Allocate a backing store for an array buffer, ignores allocation fails.\n *\n * @return true on success,\n *         false otherwise\n */\nstatic bool\njerry_arraybuffer_allocate_buffer_no_throw (ecma_object_t *arraybuffer_p) /**< ArrayBuffer object */\n{\n  JERRY_ASSERT (!(ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_ALLOCATED));\n\n  if (ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_DETACHED)\n  {\n    return false;\n  }\n\n  return ecma_arraybuffer_allocate_buffer (arraybuffer_p) != ECMA_VALUE_ERROR;\n} /* jerry_arraybuffer_allocate_buffer_no_throw */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n/**\n * Copy bytes into the ArrayBuffer or SharedArrayBuffer from a buffer.\n *\n * Note:\n *     * returns 0, if the passed object is not an ArrayBuffer or SharedArrayBuffer\n *\n * @return number of bytes copied into the ArrayBuffer or SharedArrayBuffer.\n */\njerry_length_t\njerry_arraybuffer_write (jerry_value_t value, /**< target ArrayBuffer or SharedArrayBuffer */\n                         jerry_length_t offset, /**< start offset of the ArrayBuffer */\n                         const uint8_t *buf_p, /**< buffer to copy from */\n                         jerry_length_t buf_size) /**< number of bytes to copy from the buffer */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (!(ecma_is_arraybuffer (value) || ecma_is_shared_arraybuffer (value)))\n  {\n    return 0;\n  }\n\n  ecma_object_t *arraybuffer_p = ecma_get_object_from_value (value);\n\n  if (!(ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_ALLOCATED)\n      && !jerry_arraybuffer_allocate_buffer_no_throw (arraybuffer_p))\n  {\n    return 0;\n  }\n\n  jerry_length_t length = ecma_arraybuffer_get_length (arraybuffer_p);\n\n  if (offset >= length)\n  {\n    return 0;\n  }\n\n  jerry_length_t copy_count = JERRY_MIN (length - offset, buf_size);\n\n  if (copy_count > 0)\n  {\n    lit_utf8_byte_t *buffer_p = ecma_arraybuffer_get_buffer (arraybuffer_p);\n\n    memcpy ((void *) (buffer_p + offset), (void *) buf_p, copy_count);\n  }\n\n  return copy_count;\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (value);\n  JERRY_UNUSED (offset);\n  JERRY_UNUSED (buf_p);\n  JERRY_UNUSED (buf_size);\n  return 0;\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_arraybuffer_write */\n\n/**\n * Copy bytes from a buffer into an ArrayBuffer or SharedArrayBuffer.\n *\n * Note:\n *     * if the object passed is not an ArrayBuffer or SharedArrayBuffer will return 0.\n *\n * @return number of bytes read from the ArrayBuffer.\n */\njerry_length_t\njerry_arraybuffer_read (const jerry_value_t value, /**< ArrayBuffer or SharedArrayBuffer to read from */\n                        jerry_length_t offset, /**< start offset of the ArrayBuffer or SharedArrayBuffer */\n                        uint8_t *buf_p, /**< destination buffer to copy to */\n                        jerry_length_t buf_size) /**< number of bytes to copy into the buffer */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (!(ecma_is_arraybuffer (value) || ecma_is_shared_arraybuffer (value)))\n  {\n    return 0;\n  }\n\n  ecma_object_t *arraybuffer_p = ecma_get_object_from_value (value);\n\n  if (!(ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_ALLOCATED)\n      && !jerry_arraybuffer_allocate_buffer_no_throw (arraybuffer_p))\n  {\n    return 0;\n  }\n\n  jerry_length_t length = ecma_arraybuffer_get_length (arraybuffer_p);\n\n  if (offset >= length)\n  {\n    return 0;\n  }\n\n  jerry_length_t copy_count = JERRY_MIN (length - offset, buf_size);\n\n  if (copy_count > 0)\n  {\n    lit_utf8_byte_t *buffer_p = ecma_arraybuffer_get_buffer (arraybuffer_p);\n\n    memcpy ((void *) buf_p, (void *) (buffer_p + offset), copy_count);\n  }\n\n  return copy_count;\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (value);\n  JERRY_UNUSED (offset);\n  JERRY_UNUSED (buf_p);\n  JERRY_UNUSED (buf_size);\n  return 0;\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_arraybuffer_read */\n\n/**\n * Get the length (size) of the ArrayBuffer or SharedArrayBuffer in bytes.\n *\n * Note:\n *     This is the 'byteLength' property of an ArrayBuffer or SharedArrayBuffer.\n *\n * @return the length of the ArrayBuffer in bytes.\n */\njerry_length_t\njerry_arraybuffer_size (const jerry_value_t value) /**< ArrayBuffer or SharedArrayBuffer */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (ecma_is_arraybuffer (value) || ecma_is_shared_arraybuffer (value))\n  {\n    ecma_object_t *arraybuffer_p = ecma_get_object_from_value (value);\n    return ecma_arraybuffer_get_length (arraybuffer_p);\n  }\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (value);\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n  return 0;\n} /* jerry_arraybuffer_size */\n\n/**\n * Get a pointer for the start of the ArrayBuffer.\n *\n * Note:\n *    * This is a high-risk operation as the bounds are not checked\n *      when accessing the pointer elements.\n *\n * @return pointer to the back-buffer of the ArrayBuffer.\n *         pointer is NULL if:\n *            - the parameter is not an ArrayBuffer\n *            - an external ArrayBuffer has been detached\n */\nuint8_t *\njerry_arraybuffer_data (const jerry_value_t array_buffer) /**< Array Buffer to use */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (!(ecma_is_arraybuffer (array_buffer) || ecma_is_shared_arraybuffer (array_buffer)))\n  {\n    return NULL;\n  }\n\n  ecma_object_t *arraybuffer_p = ecma_get_object_from_value (array_buffer);\n\n  if (!(ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_ALLOCATED)\n      && !jerry_arraybuffer_allocate_buffer_no_throw (arraybuffer_p))\n  {\n    return NULL;\n  }\n\n  return (uint8_t *) ecma_arraybuffer_get_buffer (arraybuffer_p);\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (array_buffer);\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n  return NULL;\n} /* jerry_arraybuffer_data */\n\n/**\n * Get if the ArrayBuffer is detachable.\n *\n * @return boolean value - if success\n *         value marked with error flag - otherwise\n */\nbool\njerry_arraybuffer_is_detachable (const jerry_value_t value) /**< ArrayBuffer */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (ecma_is_arraybuffer (value))\n  {\n    ecma_object_t *buffer_p = ecma_get_object_from_value (value);\n    return !ecma_arraybuffer_is_detached (buffer_p);\n  }\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (value);\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n  return false;\n} /* jerry_arraybuffer_is_detachable */\n\n/**\n * Detach the underlying data block from ArrayBuffer and set its bytelength to 0.\n *\n * Note: if the ArrayBuffer has a separate data buffer, the free callback set by\n *       jerry_arraybuffer_set_allocation_callbacks is called for this buffer\n *\n * @return null value - if success\n *         value marked with error flag - otherwise\n */\njerry_value_t\njerry_arraybuffer_detach (jerry_value_t value) /**< ArrayBuffer */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (ecma_is_arraybuffer (value))\n  {\n    ecma_object_t *buffer_p = ecma_get_object_from_value (value);\n    if (ecma_arraybuffer_detach (buffer_p))\n    {\n      return ECMA_VALUE_NULL;\n    }\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_ARRAY_BUFFER_DETACHED));\n  }\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (value);\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_EXPECTED_AN_ARRAYBUFFER));\n} /* jerry_arraybuffer_detach */\n\n/**\n * Checks whether a buffer is currently allocated for an array buffer or typed array.\n *\n * @return true, if a buffer is allocated for an array buffer or typed array\n *         false, otherwise\n */\nbool\njerry_arraybuffer_has_buffer (const jerry_value_t value) /**< array buffer or typed array value */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (!ecma_is_value_object (value))\n  {\n    return false;\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (value);\n\n  if (ecma_object_is_typedarray (object_p))\n  {\n    object_p = ecma_typedarray_get_arraybuffer (object_p);\n  }\n  else if (!(ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)\n             || ecma_object_is_shared_arraybuffer (object_p)))\n  {\n    return false;\n  }\n\n  return (ECMA_ARRAYBUFFER_GET_FLAGS (object_p) & ECMA_ARRAYBUFFER_ALLOCATED) != 0;\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (value);\n  return false;\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_arraybuffer_has_buffer */\n\n/**\n * Array buffers which size is less or equal than the limit passed to this function are allocated in\n * a single memory block. The allocator callbacks set by jerry_arraybuffer_set_allocation_callbacks\n * are not called for these array buffers. The default limit is 256 bytes.\n */\nvoid\njerry_arraybuffer_heap_allocation_limit (jerry_length_t allocation_limit) /**< maximum size of\n                                                                           *   compact allocation */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  JERRY_CONTEXT (arraybuffer_compact_allocation_limit) = allocation_limit;\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (allocation_limit);\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_arraybuffer_heap_allocation_limit */\n\n/**\n * Set callbacks for allocating and freeing backing stores for array buffer objects.\n */\nvoid\njerry_arraybuffer_allocator (jerry_arraybuffer_allocate_cb_t allocate_callback, /**< callback for allocating\n                                                                                 *   array buffer memory */\n                             jerry_arraybuffer_free_cb_t free_callback, /**< callback for freeing\n                                                                         *   array buffer memory */\n                             void *user_p) /**< user pointer passed to the callbacks */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  JERRY_CONTEXT (arraybuffer_allocate_callback) = allocate_callback;\n  JERRY_CONTEXT (arraybuffer_free_callback) = free_callback;\n  JERRY_CONTEXT (arraybuffer_allocate_callback_user_p) = user_p;\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (allocate_callback);\n  JERRY_UNUSED (free_callback);\n  JERRY_UNUSED (user_p);\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_arraybuffer_allocator */\n\n/**\n * DataView related functions\n */\n\n/**\n * Creates a DataView object with the given ArrayBuffer, ByteOffset and ByteLength arguments.\n *\n * Notes:\n *      * returned value must be freed with jerry_value_free, when it is no longer needed.\n *      * if the DataView bulitin is disabled this will return a TypeError.\n *\n * @return value of the constructed DataView object - if success\n *         created error - otherwise\n */\njerry_value_t\njerry_dataview (const jerry_value_t array_buffer, /**< arraybuffer to create DataView from */\n                jerry_length_t byte_offset, /**< offset in bytes, to the first byte in the buffer */\n                jerry_length_t byte_length) /**< number of elements in the byte array */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_DATAVIEW\n  if (ecma_is_value_exception (array_buffer))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_value_t arguments_p[3] = { array_buffer,\n                                  ecma_make_uint32_value (byte_offset),\n                                  ecma_make_uint32_value (byte_length) };\n  ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target_p);\n  if (old_new_target_p == NULL)\n  {\n    JERRY_CONTEXT (current_new_target_p) = ecma_builtin_get (ECMA_BUILTIN_ID_DATAVIEW);\n  }\n\n  ecma_value_t dataview_value = ecma_op_dataview_create (arguments_p, 3);\n  JERRY_CONTEXT (current_new_target_p) = old_new_target_p;\n  return jerry_return (dataview_value);\n#else /* !JERRY_BUILTIN_DATAVIEW */\n  JERRY_UNUSED (array_buffer);\n  JERRY_UNUSED (byte_offset);\n  JERRY_UNUSED (byte_length);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_DATA_VIEW_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_DATAVIEW */\n} /* jerry_dataview */\n\n/**\n * Check if the given value is a DataView object.\n *\n * @return true - if it is a DataView object\n *         false - otherwise\n */\nbool\njerry_value_is_dataview (const jerry_value_t value) /**< value to check if it is a DataView object */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_DATAVIEW\n  return ecma_is_dataview (value);\n#else /* !JERRY_BUILTIN_DATAVIEW */\n  JERRY_UNUSED (value);\n  return false;\n#endif /* JERRY_BUILTIN_DATAVIEW */\n} /* jerry_value_is_dataview */\n\n/**\n * Get the underlying ArrayBuffer from a DataView.\n *\n * Additionally the byteLength and byteOffset properties are also returned\n * which were specified when the DataView was created.\n *\n * Note:\n *     the returned value must be freed with a jerry_value_free call\n *\n * @return ArrayBuffer of a DataView\n *         TypeError if the object is not a DataView.\n */\njerry_value_t\njerry_dataview_buffer (const jerry_value_t value, /**< DataView to get the arraybuffer from */\n                       jerry_length_t *byte_offset, /**< [out] byteOffset property */\n                       jerry_length_t *byte_length) /**< [out] byteLength property */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_DATAVIEW\n  if (ecma_is_value_exception (value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n  }\n\n  ecma_dataview_object_t *dataview_p = ecma_op_dataview_get_object (value);\n\n  if (JERRY_UNLIKELY (dataview_p == NULL))\n  {\n    return ecma_create_exception_from_context ();\n  }\n\n  if (byte_offset != NULL)\n  {\n    *byte_offset = dataview_p->byte_offset;\n  }\n\n  if (byte_length != NULL)\n  {\n    *byte_length = dataview_p->header.u.cls.u3.length;\n  }\n\n  ecma_object_t *arraybuffer_p = dataview_p->buffer_p;\n  ecma_ref_object (arraybuffer_p);\n\n  return ecma_make_object_value (arraybuffer_p);\n#else /* !JERRY_BUILTIN_DATAVIEW */\n  JERRY_UNUSED (value);\n  JERRY_UNUSED (byte_offset);\n  JERRY_UNUSED (byte_length);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_DATA_VIEW_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_DATAVIEW */\n} /* jerry_dataview_buffer */\n\n/**\n * TypedArray related functions\n */\n\n/**\n * Check if the given value is a TypedArray object.\n *\n * @return true - if it is a TypedArray object\n *         false - otherwise\n */\nbool\njerry_value_is_typedarray (const jerry_value_t value) /**< value to check if it is a TypedArray */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  return ecma_is_typedarray (value);\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (value);\n  return false;\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_value_is_typedarray */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n/**\n * TypedArray mapping type\n */\ntypedef struct\n{\n  jerry_typedarray_type_t api_type; /**< api type */\n  ecma_builtin_id_t prototype_id; /**< prototype ID */\n  ecma_typedarray_type_t id; /**< typedArray ID */\n  uint8_t element_size_shift; /**< element size shift */\n} jerry_typedarray_mapping_t;\n\n/**\n * List of TypedArray mappings\n */\nstatic jerry_typedarray_mapping_t jerry_typedarray_mappings[] = {\n#define TYPEDARRAY_ENTRY(NAME, LIT_NAME, SIZE_SHIFT)                                                      \\\n  {                                                                                                       \\\n    JERRY_TYPEDARRAY_##NAME, ECMA_BUILTIN_ID_##NAME##ARRAY_PROTOTYPE, ECMA_##LIT_NAME##_ARRAY, SIZE_SHIFT \\\n  }\n\n  TYPEDARRAY_ENTRY (UINT8, UINT8, 0),       TYPEDARRAY_ENTRY (UINT8CLAMPED, UINT8_CLAMPED, 0),\n  TYPEDARRAY_ENTRY (INT8, INT8, 0),         TYPEDARRAY_ENTRY (UINT16, UINT16, 1),\n  TYPEDARRAY_ENTRY (INT16, INT16, 1),       TYPEDARRAY_ENTRY (UINT32, UINT32, 2),\n  TYPEDARRAY_ENTRY (INT32, INT32, 2),       TYPEDARRAY_ENTRY (FLOAT32, FLOAT32, 2),\n#if JERRY_NUMBER_TYPE_FLOAT64\n  TYPEDARRAY_ENTRY (FLOAT64, FLOAT64, 3),\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#if JERRY_BUILTIN_BIGINT\n  TYPEDARRAY_ENTRY (BIGINT64, BIGINT64, 3), TYPEDARRAY_ENTRY (BIGUINT64, BIGUINT64, 3),\n#endif /* JERRY_BUILTIN_BIGINT */\n#undef TYPEDARRAY_ENTRY\n};\n\n/**\n * Helper function to get the TypedArray prototype, typedArray id, and element size shift\n * information.\n *\n * @return true - if the TypedArray information was found\n *         false - if there is no such TypedArray type\n */\nstatic bool\njerry_typedarray_find_by_type (jerry_typedarray_type_t type_name, /**< type of the TypedArray */\n                               ecma_builtin_id_t *prototype_id, /**< [out] found prototype object id */\n                               ecma_typedarray_type_t *id, /**< [out] found typedArray id */\n                               uint8_t *element_size_shift) /**< [out] found element size shift value */\n{\n  JERRY_ASSERT (prototype_id != NULL);\n  JERRY_ASSERT (id != NULL);\n  JERRY_ASSERT (element_size_shift != NULL);\n\n  for (uint32_t i = 0; i < sizeof (jerry_typedarray_mappings) / sizeof (jerry_typedarray_mappings[0]); i++)\n  {\n    if (type_name == jerry_typedarray_mappings[i].api_type)\n    {\n      *prototype_id = jerry_typedarray_mappings[i].prototype_id;\n      *id = jerry_typedarray_mappings[i].id;\n      *element_size_shift = jerry_typedarray_mappings[i].element_size_shift;\n      return true;\n    }\n  }\n\n  return false;\n} /* jerry_typedarray_find_by_type */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n/**\n * Create a TypedArray object with a given type and length.\n *\n * Notes:\n *      * returns TypeError if an incorrect type (type_name) is specified.\n *      * byteOffset property will be set to 0.\n *      * byteLength property will be a multiple of the length parameter (based on the type).\n *\n * @return - new TypedArray object\n */\njerry_value_t\njerry_typedarray (jerry_typedarray_type_t type_name, /**< type of TypedArray to create */\n                  jerry_length_t length) /**< element count of the new TypedArray */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  ecma_builtin_id_t prototype_id = 0;\n  ecma_typedarray_type_t id = 0;\n  uint8_t element_size_shift = 0;\n\n  if (!jerry_typedarray_find_by_type (type_name, &prototype_id, &id, &element_size_shift))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_INCORRECT_TYPE_FOR_TYPEDARRAY));\n  }\n\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (prototype_id);\n\n  ecma_value_t array_value =\n    ecma_typedarray_create_object_with_length (length, NULL, prototype_obj_p, element_size_shift, id);\n\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (array_value));\n\n  return array_value;\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (type_name);\n  JERRY_UNUSED (length);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_TYPED_ARRAY_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_typedarray */\n\n/**\n * Create a TypedArray object using the given arraybuffer and size information.\n *\n * Notes:\n *      * returns TypeError if an incorrect type (type_name) is specified.\n *      * this is the 'new %TypedArray%(arraybuffer, byteOffset, length)' equivalent call.\n *\n * @return - new TypedArray object\n */\njerry_value_t\njerry_typedarray_with_buffer_span (jerry_typedarray_type_t type, /**< type of TypedArray to create */\n                                   const jerry_value_t arraybuffer, /**< ArrayBuffer to use */\n                                   jerry_length_t byte_offset, /**< offset for the ArrayBuffer */\n                                   jerry_length_t length) /**< number of elements to use from ArrayBuffer */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (ecma_is_value_exception (arraybuffer))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n  }\n\n  ecma_builtin_id_t prototype_id = 0;\n  ecma_typedarray_type_t id = 0;\n  uint8_t element_size_shift = 0;\n\n  if (!jerry_typedarray_find_by_type (type, &prototype_id, &id, &element_size_shift))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_INCORRECT_TYPE_FOR_TYPEDARRAY));\n  }\n\n  if (!ecma_is_arraybuffer (arraybuffer))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_ARGUMENT_NOT_ARRAY_BUFFER));\n  }\n\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (prototype_id);\n  ecma_value_t arguments_p[3] = { arraybuffer, ecma_make_uint32_value (byte_offset), ecma_make_uint32_value (length) };\n\n  ecma_value_t array_value = ecma_op_create_typedarray (arguments_p, 3, prototype_obj_p, element_size_shift, id);\n  ecma_free_value (arguments_p[1]);\n  ecma_free_value (arguments_p[2]);\n\n  return jerry_return (array_value);\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (type);\n  JERRY_UNUSED (arraybuffer);\n  JERRY_UNUSED (byte_offset);\n  JERRY_UNUSED (length);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_TYPED_ARRAY_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_typedarray_with_buffer_span */\n\n/**\n * Create a TypedArray object using the given arraybuffer and size information.\n *\n * Notes:\n *      * returns TypeError if an incorrect type (type_name) is specified.\n *      * this is the 'new %TypedArray%(arraybuffer)' equivalent call.\n *\n * @return - new TypedArray object\n */\njerry_value_t\njerry_typedarray_with_buffer (jerry_typedarray_type_t type, /**< type of TypedArray to create */\n                              const jerry_value_t arraybuffer) /**< ArrayBuffer to use */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (ecma_is_value_exception (arraybuffer))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n  }\n\n  jerry_length_t byte_length = jerry_arraybuffer_size (arraybuffer);\n  return jerry_typedarray_with_buffer_span (type, arraybuffer, 0, byte_length);\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (type);\n  JERRY_UNUSED (arraybuffer);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_TYPED_ARRAY_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_typedarray_with_buffer */\n\n/**\n * Get the type of the TypedArray.\n *\n * @return - type of the TypedArray\n *         - JERRY_TYPEDARRAY_INVALID if the argument is not a TypedArray\n */\njerry_typedarray_type_t\njerry_typedarray_type (const jerry_value_t value) /**< object to get the TypedArray type */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (!ecma_is_typedarray (value))\n  {\n    return JERRY_TYPEDARRAY_INVALID;\n  }\n\n  ecma_object_t *array_p = ecma_get_object_from_value (value);\n  ecma_typedarray_type_t class_type = ecma_get_typedarray_id (array_p);\n\n  for (uint32_t i = 0; i < sizeof (jerry_typedarray_mappings) / sizeof (jerry_typedarray_mappings[0]); i++)\n  {\n    if (class_type == jerry_typedarray_mappings[i].id)\n    {\n      return jerry_typedarray_mappings[i].api_type;\n    }\n  }\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (value);\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n  return JERRY_TYPEDARRAY_INVALID;\n} /* jerry_typedarray_type */\n\n/**\n * Get the element count of the TypedArray.\n *\n * @return length of the TypedArray.\n */\njerry_length_t\njerry_typedarray_length (const jerry_value_t value) /**< TypedArray to query */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (ecma_is_typedarray (value))\n  {\n    ecma_object_t *array_p = ecma_get_object_from_value (value);\n    return ecma_typedarray_get_length (array_p);\n  }\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (value);\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n  return 0;\n} /* jerry_typedarray_length */\n\n/**\n * Get the underlying ArrayBuffer from a TypedArray.\n *\n * Additionally the byteLength and byteOffset properties are also returned\n * which were specified when the TypedArray was created.\n *\n * Note:\n *     the returned value must be freed with a jerry_value_free call\n *\n * @return ArrayBuffer of a TypedArray\n *         TypeError if the object is not a TypedArray.\n */\njerry_value_t\njerry_typedarray_buffer (const jerry_value_t value, /**< TypedArray to get the arraybuffer from */\n                         jerry_length_t *byte_offset, /**< [out] byteOffset property */\n                         jerry_length_t *byte_length) /**< [out] byteLength property */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (!ecma_is_typedarray (value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_OBJECT_IS_NOT_A_TYPEDARRAY));\n  }\n\n  ecma_object_t *array_p = ecma_get_object_from_value (value);\n  uint8_t shift = ecma_typedarray_get_element_size_shift (array_p);\n\n  if (byte_length != NULL)\n  {\n    *byte_length = (jerry_length_t) (ecma_typedarray_get_length (array_p) << shift);\n  }\n\n  if (byte_offset != NULL)\n  {\n    *byte_offset = (jerry_length_t) ecma_typedarray_get_offset (array_p);\n  }\n\n  ecma_object_t *arraybuffer_p = ecma_typedarray_get_arraybuffer (array_p);\n  ecma_ref_object (arraybuffer_p);\n  return jerry_return (ecma_make_object_value (arraybuffer_p));\n#else /* !JERRY_BUILTIN_TYPEDARRAY */\n  JERRY_UNUSED (value);\n  JERRY_UNUSED (byte_length);\n  JERRY_UNUSED (byte_offset);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_TYPED_ARRAY_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* jerry_typedarray_buffer */\n\n/**\n * Parse the given input buffer as a JSON string. The behaviour is equivalent with the \"JSON.parse(string)\" JS\n * call. The input buffer can be encoded as either cesu-8 or utf-8, but it is the callers responsibility to make sure\n * the encoding is valid.\n *\n *\n * @return object value, or exception\n */\njerry_value_t\njerry_json_parse (const jerry_char_t *string_p, /**< json string */\n                  jerry_size_t string_size) /**< json string size */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_JSON\n  ecma_value_t ret_value = ecma_builtin_json_parse_buffer (string_p, string_size);\n\n  if (ecma_is_value_undefined (ret_value))\n  {\n    ret_value = jerry_throw_sz (JERRY_ERROR_SYNTAX, ecma_get_error_msg (ECMA_ERR_JSON_STRING_PARSE_ERROR));\n  }\n\n  return jerry_return (ret_value);\n#else /* !JERRY_BUILTIN_JSON */\n  JERRY_UNUSED (string_p);\n  JERRY_UNUSED (string_size);\n\n  return jerry_throw_sz (JERRY_ERROR_SYNTAX, ecma_get_error_msg (ECMA_ERR_JSON_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_JSON */\n} /* jerry_json_parse */\n\n/**\n * Create a JSON string from a JavaScript value.\n *\n * The behaviour is equivalent with the \"JSON.stringify(input_value)\" JS call.\n *\n * Note:\n *      The returned value must be freed with jerry_value_free,\n *\n * @return - jerry_value_t containing a JSON string.\n *         - Error value if there was a problem during the stringification.\n */\njerry_value_t\njerry_json_stringify (const jerry_value_t input_value) /**< a value to stringify */\n{\n  jerry_assert_api_enabled ();\n#if JERRY_BUILTIN_JSON\n  if (ecma_is_value_exception (input_value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n  }\n\n  ecma_value_t ret_value = ecma_builtin_json_stringify_no_opts (input_value);\n\n  if (ecma_is_value_undefined (ret_value))\n  {\n    ret_value = jerry_throw_sz (JERRY_ERROR_SYNTAX, ecma_get_error_msg (ECMA_ERR_JSON_STRINGIFY_ERROR));\n  }\n\n  return jerry_return (ret_value);\n#else /* JERRY_BUILTIN_JSON */\n  JERRY_UNUSED (input_value);\n\n  return jerry_throw_sz (JERRY_ERROR_SYNTAX, ecma_get_error_msg (ECMA_ERR_JSON_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_JSON */\n} /* jerry_json_stringify */\n\n/**\n * Create a container type specified in jerry_container_type_t.\n * The container can be created with a list of arguments, which will be passed to the container constructor to be\n * inserted to the container.\n *\n * Note:\n *      The returned value must be freed with jerry_value_free\n * @return jerry_value_t representing a container with the given type.\n */\njerry_value_t\njerry_container (jerry_container_type_t container_type, /**< Type of the container */\n                 const jerry_value_t *arguments_list_p, /**< arguments list */\n                 jerry_length_t arguments_list_len) /**< Length of arguments list */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_CONTAINER\n  for (jerry_length_t i = 0; i < arguments_list_len; i++)\n  {\n    if (ecma_is_value_exception (arguments_list_p[i]))\n    {\n      return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_VALUE_MSG));\n    }\n  }\n\n  lit_magic_string_id_t lit_id;\n  ecma_builtin_id_t proto_id;\n  ecma_builtin_id_t ctor_id;\n\n  switch (container_type)\n  {\n    case JERRY_CONTAINER_TYPE_MAP:\n    {\n      lit_id = LIT_MAGIC_STRING_MAP_UL;\n      proto_id = ECMA_BUILTIN_ID_MAP_PROTOTYPE;\n      ctor_id = ECMA_BUILTIN_ID_MAP;\n      break;\n    }\n    case JERRY_CONTAINER_TYPE_SET:\n    {\n      lit_id = LIT_MAGIC_STRING_SET_UL;\n      proto_id = ECMA_BUILTIN_ID_SET_PROTOTYPE;\n      ctor_id = ECMA_BUILTIN_ID_SET;\n      break;\n    }\n    case JERRY_CONTAINER_TYPE_WEAKMAP:\n    {\n      lit_id = LIT_MAGIC_STRING_WEAKMAP_UL;\n      proto_id = ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE;\n      ctor_id = ECMA_BUILTIN_ID_WEAKMAP;\n      break;\n    }\n    case JERRY_CONTAINER_TYPE_WEAKSET:\n    {\n      lit_id = LIT_MAGIC_STRING_WEAKSET_UL;\n      proto_id = ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE;\n      ctor_id = ECMA_BUILTIN_ID_WEAKSET;\n      break;\n    }\n    default:\n    {\n      return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_INVALID_CONTAINER_TYPE));\n    }\n  }\n  ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target_p);\n\n  if (old_new_target_p == NULL)\n  {\n    JERRY_CONTEXT (current_new_target_p) = ecma_builtin_get (ctor_id);\n  }\n\n  ecma_value_t container_value = ecma_op_container_create (arguments_list_p, arguments_list_len, lit_id, proto_id);\n\n  JERRY_CONTEXT (current_new_target_p) = old_new_target_p;\n  return jerry_return (container_value);\n#else /* !JERRY_BUILTIN_CONTAINER */\n  JERRY_UNUSED (arguments_list_p);\n  JERRY_UNUSED (arguments_list_len);\n  JERRY_UNUSED (container_type);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_CONTAINER_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_CONTAINER */\n} /* jerry_container */\n\n/**\n * Get the type of the given container object.\n *\n * @return Corresponding type to the given container object.\n */\njerry_container_type_t\njerry_container_type (const jerry_value_t value) /**< the container object */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_CONTAINER\n  if (ecma_is_value_object (value))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (value);\n\n    if (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_CONTAINER))\n    {\n      switch (((ecma_extended_object_t *) obj_p)->u.cls.u2.container_id)\n      {\n        case LIT_MAGIC_STRING_MAP_UL:\n        {\n          return JERRY_CONTAINER_TYPE_MAP;\n        }\n        case LIT_MAGIC_STRING_SET_UL:\n        {\n          return JERRY_CONTAINER_TYPE_SET;\n        }\n        case LIT_MAGIC_STRING_WEAKMAP_UL:\n        {\n          return JERRY_CONTAINER_TYPE_WEAKMAP;\n        }\n        case LIT_MAGIC_STRING_WEAKSET_UL:\n        {\n          return JERRY_CONTAINER_TYPE_WEAKSET;\n        }\n        default:\n        {\n          return JERRY_CONTAINER_TYPE_INVALID;\n        }\n      }\n    }\n  }\n\n#else /* !JERRY_BUILTIN_CONTAINER */\n  JERRY_UNUSED (value);\n#endif /* JERRY_BUILTIN_CONTAINER */\n  return JERRY_CONTAINER_TYPE_INVALID;\n} /* jerry_container_type */\n\n/**\n * Return a new array containing elements from a Container or a Container Iterator.\n * Sets the boolean input value to `true` if the container object has key/value pairs.\n *\n * Note:\n *     the returned value must be freed with a jerry_value_free call\n *\n * @return an array of items for maps/sets or their iterators, error otherwise\n */\njerry_value_t\njerry_container_to_array (const jerry_value_t value, /**< the container or iterator object */\n                          bool *is_key_value_p) /**< [out] is key-value structure */\n{\n  jerry_assert_api_enabled ();\n\n#if JERRY_BUILTIN_CONTAINER\n  if (!ecma_is_value_object (value))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_CONTAINER_NEEDED));\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (value);\n\n  if (ecma_get_object_type (obj_p) != ECMA_OBJECT_TYPE_CLASS)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_CONTAINER_NEEDED));\n  }\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n  uint32_t entry_count;\n  uint8_t entry_size;\n\n  uint32_t index = 0;\n  uint8_t iterator_kind = ECMA_ITERATOR__COUNT;\n  ecma_value_t *start_p;\n\n  *is_key_value_p = false;\n\n  if (ext_obj_p->u.cls.type == ECMA_OBJECT_CLASS_MAP_ITERATOR\n      || ext_obj_p->u.cls.type == ECMA_OBJECT_CLASS_SET_ITERATOR)\n  {\n    ecma_value_t iterated_value = ext_obj_p->u.cls.u3.iterated_value;\n\n    if (ecma_is_value_empty (iterated_value))\n    {\n      return ecma_op_new_array_object_from_collection (ecma_new_collection (), false);\n    }\n\n    ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) (ecma_get_object_from_value (iterated_value));\n\n    ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n    entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);\n    index = ext_obj_p->u.cls.u2.iterator_index;\n\n    entry_size = ecma_op_container_entry_size (map_object_p->u.cls.u2.container_id);\n    start_p = ECMA_CONTAINER_START (container_p);\n\n    iterator_kind = ext_obj_p->u.cls.u1.iterator_kind;\n  }\n  else if (jerry_container_type (value) != JERRY_CONTAINER_TYPE_INVALID)\n  {\n    ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, ext_obj_p->u.cls.u3.value);\n    entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);\n    entry_size = ecma_op_container_entry_size (ext_obj_p->u.cls.u2.container_id);\n\n    index = 0;\n    iterator_kind = ECMA_ITERATOR_KEYS;\n    start_p = ECMA_CONTAINER_START (container_p);\n\n    if (ext_obj_p->u.cls.u2.container_id == LIT_MAGIC_STRING_MAP_UL\n        || ext_obj_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKMAP_UL)\n    {\n      iterator_kind = ECMA_ITERATOR_ENTRIES;\n    }\n  }\n  else\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_CONTAINER_NEEDED));\n  }\n\n  *is_key_value_p = (iterator_kind == ECMA_ITERATOR_ENTRIES);\n  ecma_collection_t *collection_buffer = ecma_new_collection ();\n\n  for (uint32_t i = index; i < entry_count; i += entry_size)\n  {\n    ecma_value_t *entry_p = start_p + i;\n\n    if (ecma_is_value_empty (*entry_p))\n    {\n      continue;\n    }\n\n    if (iterator_kind != ECMA_ITERATOR_VALUES)\n    {\n      ecma_collection_push_back (collection_buffer, ecma_copy_value_if_not_object (entry_p[0]));\n    }\n\n    if (iterator_kind != ECMA_ITERATOR_KEYS)\n    {\n      ecma_collection_push_back (collection_buffer, ecma_copy_value_if_not_object (entry_p[1]));\n    }\n  }\n  return ecma_op_new_array_object_from_collection (collection_buffer, false);\n#else /* !JERRY_BUILTIN_CONTAINER */\n  JERRY_UNUSED (value);\n  JERRY_UNUSED (is_key_value_p);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_CONTAINER_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_CONTAINER */\n} /* jerry_container_to_array */\n\n/**\n * Perform container operation on the given operands (add, get, set, has, delete, size, clear).\n *\n * @return error - if argument is invalid or operation is unsuccessful or unsupported\n *                 result of the container operation - otherwise.\n */\njerry_value_t\njerry_container_op (jerry_container_op_t operation, /**< container operation */\n                    jerry_value_t container, /**< container */\n                    const jerry_value_t *arguments, /**< list of arguments */\n                    uint32_t arguments_number) /**< number of arguments */\n{\n  jerry_assert_api_enabled ();\n#if JERRY_BUILTIN_CONTAINER\n  if (!ecma_is_value_object (container))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_CONTAINER_IS_NOT_AN_OBJECT));\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (container);\n\n  if (ecma_get_object_type (obj_p) != ECMA_OBJECT_TYPE_CLASS)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_CONTAINER_IS_NOT_A_CONTAINER_OBJECT));\n  }\n  uint16_t type = ((ecma_extended_object_t *) obj_p)->u.cls.u2.container_id;\n  ecma_extended_object_t *container_object_p = ecma_op_container_get_object (container, type);\n\n  if (container_object_p == NULL)\n  {\n    return ecma_create_exception_from_context ();\n  }\n\n  switch (operation)\n  {\n    case JERRY_CONTAINER_OP_ADD:\n    case JERRY_CONTAINER_OP_DELETE:\n    case JERRY_CONTAINER_OP_GET:\n    case JERRY_CONTAINER_OP_HAS:\n    {\n      if (arguments_number != 1 || ecma_is_value_exception (arguments[0]))\n      {\n        return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n      }\n      break;\n    }\n    case JERRY_CONTAINER_OP_SET:\n    {\n      if (arguments_number != 2 || ecma_is_value_exception (arguments[0]) || ecma_is_value_exception (arguments[1]))\n      {\n        return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n      }\n      break;\n    }\n    case JERRY_CONTAINER_OP_CLEAR:\n    case JERRY_CONTAINER_OP_SIZE:\n    {\n      if (arguments_number != 0)\n      {\n        return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n      }\n      break;\n    }\n    default:\n    {\n      return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));\n    }\n  }\n\n  jerry_value_t result;\n\n  switch (operation)\n  {\n    case JERRY_CONTAINER_OP_ADD:\n    {\n      if (type == LIT_MAGIC_STRING_MAP_UL || type == LIT_MAGIC_STRING_WEAKMAP_UL)\n      {\n        return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_INCORRECT_TYPE_CALL));\n      }\n      result = ecma_op_container_set (container_object_p, arguments[0], arguments[0], type);\n      break;\n    }\n    case JERRY_CONTAINER_OP_GET:\n    {\n      if (type == LIT_MAGIC_STRING_SET_UL || type == LIT_MAGIC_STRING_WEAKSET_UL)\n      {\n        return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_INCORRECT_TYPE_CALL));\n      }\n      result = ecma_op_container_get (container_object_p, arguments[0], type);\n      break;\n    }\n    case JERRY_CONTAINER_OP_SET:\n    {\n      if (type == LIT_MAGIC_STRING_SET_UL || type == LIT_MAGIC_STRING_WEAKSET_UL)\n      {\n        return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_INCORRECT_TYPE_CALL));\n      }\n      result = ecma_op_container_set (container_object_p, arguments[0], arguments[1], type);\n      break;\n    }\n    case JERRY_CONTAINER_OP_HAS:\n    {\n      result = ecma_op_container_has (container_object_p, arguments[0], type);\n      break;\n    }\n    case JERRY_CONTAINER_OP_DELETE:\n    {\n      if (type == LIT_MAGIC_STRING_WEAKMAP_UL || type == LIT_MAGIC_STRING_WEAKSET_UL)\n      {\n        result = ecma_op_container_delete_weak (container_object_p, arguments[0], type);\n        break;\n      }\n      result = ecma_op_container_delete (container_object_p, arguments[0], type);\n      break;\n    }\n    case JERRY_CONTAINER_OP_SIZE:\n    {\n      result = ecma_op_container_size (container_object_p);\n      break;\n    }\n    case JERRY_CONTAINER_OP_CLEAR:\n    {\n      if (type == LIT_MAGIC_STRING_WEAKSET_UL || type == LIT_MAGIC_STRING_WEAKMAP_UL)\n      {\n        return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_INCORRECT_TYPE_CALL));\n      }\n      result = ecma_op_container_clear (container_object_p);\n      break;\n    }\n    default:\n    {\n      result = jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_UNSUPPORTED_CONTAINER_OPERATION));\n      break;\n    }\n  }\n  return jerry_return (result);\n#else /* !JERRY_BUILTIN_CONTAINER */\n  JERRY_UNUSED (operation);\n  JERRY_UNUSED (container);\n  JERRY_UNUSED (arguments);\n  JERRY_UNUSED (arguments_number);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_CONTAINER_NOT_SUPPORTED));\n#endif /* JERRY_BUILTIN_CONTAINER */\n} /* jerry_container_op */\n\n/**\n * @}\n */\n"
  },
  {
    "path": "jerry-core/config.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYSCRIPT_CONFIG_H\n#define JERRYSCRIPT_CONFIG_H\n\n// @JERRY_BUILD_CFG@\n\n/**\n * Built-in configurations\n *\n * Allowed values for built-in defines:\n *  0: Disable the given built-in.\n *  1: Enable the given built-in.\n */\n/*\n * By default all built-ins are enabled if they are not defined.\n */\n#ifndef JERRY_BUILTINS\n#define JERRY_BUILTINS 1\n#endif /* !defined (JERRY_BUILTINS) */\n\n#ifndef JERRY_BUILTIN_ANNEXB\n#define JERRY_BUILTIN_ANNEXB JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_ANNEXB) */\n\n#ifndef JERRY_BUILTIN_ARRAY\n#define JERRY_BUILTIN_ARRAY JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_ARRAY) */\n\n#ifndef JERRY_BUILTIN_BOOLEAN\n#define JERRY_BUILTIN_BOOLEAN JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_BOOLEAN) */\n\n#ifndef JERRY_BUILTIN_DATE\n#define JERRY_BUILTIN_DATE JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_DATE) */\n\n#ifndef JERRY_BUILTIN_ERRORS\n#define JERRY_BUILTIN_ERRORS JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_ERRORS) */\n\n#ifndef JERRY_BUILTIN_JSON\n#define JERRY_BUILTIN_JSON JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_JSON) */\n\n#ifndef JERRY_BUILTIN_MATH\n#define JERRY_BUILTIN_MATH JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_MATH) */\n\n#ifndef JERRY_BUILTIN_NUMBER\n#define JERRY_BUILTIN_NUMBER JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_NUMBER) */\n\n#ifndef JERRY_BUILTIN_REGEXP\n#define JERRY_BUILTIN_REGEXP JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_REGEXP) */\n\n#ifndef JERRY_BUILTIN_STRING\n#define JERRY_BUILTIN_STRING JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_STRING) */\n\n#ifndef JERRY_BUILTIN_BIGINT\n#define JERRY_BUILTIN_BIGINT JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_BIGINT) */\n\n#ifndef JERRY_BUILTIN_CONTAINER\n#define JERRY_BUILTIN_CONTAINER JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_CONTAINER) */\n\n#ifndef JERRY_BUILTIN_DATAVIEW\n#define JERRY_BUILTIN_DATAVIEW JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_DATAVIEW) */\n\n#ifndef JERRY_BUILTIN_GLOBAL_THIS\n#define JERRY_BUILTIN_GLOBAL_THIS JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_GLOBAL_THIS) */\n\n#ifndef JERRY_BUILTIN_PROXY\n#define JERRY_BUILTIN_PROXY JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_PROXY) */\n\n#ifndef JERRY_BUILTIN_REALMS\n#define JERRY_BUILTIN_REALMS JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_REALMS) */\n\n#ifndef JERRY_BUILTIN_REFLECT\n#define JERRY_BUILTIN_REFLECT JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_REFLECT) */\n\n#ifndef JERRY_BUILTIN_TYPEDARRAY\n#define JERRY_BUILTIN_TYPEDARRAY JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_TYPEDARRAY) */\n\n#ifndef JERRY_BUILTIN_SHAREDARRAYBUFFER\n#define JERRY_BUILTIN_SHAREDARRAYBUFFER JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_SHAREDARRAYBUFFER) */\n\n#ifndef JERRY_BUILTIN_ATOMICS\n#define JERRY_BUILTIN_ATOMICS JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_ATOMICS) */\n\n#ifndef JERRY_BUILTIN_WEAKREF\n#define JERRY_BUILTIN_WEAKREF JERRY_BUILTINS\n#endif /* !defined (JERRY_BUILTIN_WEAKREF) */\n\n#ifndef JERRY_MODULE_SYSTEM\n#define JERRY_MODULE_SYSTEM JERRY_BUILTINS\n#endif /* !defined (JERRY_MODULE_SYSTEM) */\n\n/**\n * Engine internal and misc configurations.\n */\n\n/**\n * Specifies the compressed pointer representation\n *\n * Allowed values:\n *  0: use 16 bit representation\n *  1: use 32 bit representation\n *\n * Default value: 0\n * For more details see: jmem/jmem.h\n */\n#ifndef JERRY_CPOINTER_32_BIT\n#define JERRY_CPOINTER_32_BIT 0\n#endif /* !defined (JERRY_CPOINTER_32_BIT) */\n\n/**\n * Enable/Disable the engine's JavaScript debugger interface\n *\n * Allowed values:\n *  0: Disable the debugger parts.\n *  1: Enable the debugger.\n */\n#ifndef JERRY_DEBUGGER\n#define JERRY_DEBUGGER 0\n#endif /* !defined (JERRY_DEBUGGER) */\n\n/**\n * Enable/Disable built-in error messages for error objects.\n *\n * Allowed values:\n *  0: Disable error messages.\n *  1: Enable error message.\n *\n * Default value: 0\n */\n#ifndef JERRY_ERROR_MESSAGES\n#define JERRY_ERROR_MESSAGES 0\n#endif /* !defined (JERRY_ERROR_MESSAGES) */\n\n/**\n * Enable/Disable external context.\n *\n * Allowed values:\n *  0: Disable external context.\n *  1: Enable external context support.\n *\n * Default value: 0\n */\n#ifndef JERRY_EXTERNAL_CONTEXT\n#define JERRY_EXTERNAL_CONTEXT 0\n#endif /* !defined (JERRY_EXTERNAL_CONTEXT) */\n\n/**\n * Maximum size of heap in kilobytes\n *\n * Default value: 512 KiB\n */\n#ifndef JERRY_GLOBAL_HEAP_SIZE\n#define JERRY_GLOBAL_HEAP_SIZE (512)\n#endif /* !defined (JERRY_GLOBAL_HEAP_SIZE) */\n\n/**\n * The allowed heap usage limit until next garbage collection, in bytes.\n *\n * If value is 0, the default is 1/32 of JERRY_HEAP_SIZE\n */\n#ifndef JERRY_GC_LIMIT\n#define JERRY_GC_LIMIT 0\n#endif /* !defined (JERRY_GC_LIMIT) */\n\n/**\n * Maximum stack usage size in kilobytes\n *\n * Note: This feature cannot be used when 'detect_stack_use_after_return=1' ASAN option is enabled.\n * For more detailed description:\n *   - https://github.com/google/sanitizers/wiki/AddressSanitizerUseAfterReturn#compatibility\n *\n * Default value: 0, unlimited\n */\n#ifndef JERRY_STACK_LIMIT\n#define JERRY_STACK_LIMIT (0)\n#endif /* !defined (JERRY_STACK_LIMIT) */\n\n/**\n * Maximum depth of recursion during GC mark phase\n *\n * Default value: 8\n */\n#ifndef JERRY_GC_MARK_LIMIT\n#define JERRY_GC_MARK_LIMIT (8)\n#endif /* !defined (JERRY_GC_MARK_LIMIT) */\n\n/**\n * Enable/Disable property lookup cache.\n *\n * Allowed values:\n *  0: Disable lookup cache.\n *  1: Enable lookup cache.\n *\n * Default value: 1\n */\n#ifndef JERRY_LCACHE\n#define JERRY_LCACHE 1\n#endif /* !defined (JERRY_LCACHE) */\n\n/**\n * Enable/Disable function toString operation.\n *\n * Allowed values:\n *  0: Disable function toString operation.\n *  1: Enable function toString operation.\n *\n * Default value: 0\n */\n#ifndef JERRY_FUNCTION_TO_STRING\n#define JERRY_FUNCTION_TO_STRING 0\n#endif /* !defined (JERRY_FUNCTION_TO_STRING) */\n\n/**\n * Enable/Disable line-info management inside the engine.\n *\n * Allowed values:\n *  0: Disable line-info in the engine.\n *  1: Enable line-info management.\n *\n * Default value: 0\n */\n#ifndef JERRY_LINE_INFO\n#define JERRY_LINE_INFO 0\n#endif /* !defined (JERRY_LINE_INFO) */\n\n/**\n * Enable/Disable logging inside the engine.\n *\n * Allowed values:\n *  0: Disable internal logging.\n *  1: Enable internal logging.\n *\n * Default value: 0\n */\n#ifndef JERRY_LOGGING\n#define JERRY_LOGGING 0\n#endif /* !defined (JERRY_LOGGING) */\n\n/**\n * Enable/Disable gc call before every allocation.\n *\n * Allowed values:\n *  0: Disable gc call before each allocation.\n *  1: Enable and force gc call before each allocation.\n *\n * Default value: 0\n * Warning!: This is an advanced option and will slow down the engine!\n *           Only enable it for debugging purposes.\n */\n#ifndef JERRY_MEM_GC_BEFORE_EACH_ALLOC\n#define JERRY_MEM_GC_BEFORE_EACH_ALLOC 0\n#endif /* !defined (JERRY_MEM_GC_BEFORE_EACH_ALLOC) */\n\n/**\n * Enable/Disable the collection if run-time memory statistics.\n *\n * Allowed values:\n *  0: Disable run-time memory information collection.\n *  1: Enable run-time memory statistics collection.\n *\n * Default value: 0\n */\n#ifndef JERRY_MEM_STATS\n#define JERRY_MEM_STATS 0\n#endif /* !defined (JERRY_MEM_STATS) */\n\n/**\n * Use 32-bit/64-bit float for ecma-numbers\n * This option is for expert use only!\n *\n * Allowed values:\n *  1: use 64-bit floating point number mode\n *  0: use 32-bit floating point number mode\n *\n * Default value: 1\n */\n#ifndef JERRY_NUMBER_TYPE_FLOAT64\n#define JERRY_NUMBER_TYPE_FLOAT64 1\n#endif /* !defined (JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Enable/Disable the JavaScript parser.\n *\n * Allowed values:\n *  0: Disable the JavaScript parser and all related functionallity.\n *  1: Enable the JavaScript parser.\n *\n * Default value: 1\n */\n#ifndef JERRY_PARSER\n#define JERRY_PARSER 1\n#endif /* !defined (JERRY_PARSER) */\n\n/**\n * Enable/Disable JerryScript byte code dump functions during parsing.\n * To dump the JerryScript byte code the engine must be initialized with opcodes\n * display flag. This option does not influence RegExp byte code dumps.\n *\n * Allowed values:\n *  0: Disable all bytecode dump functions.\n *  1: Enable bytecode dump functions.\n *\n * Default value: 0\n */\n#ifndef JERRY_PARSER_DUMP_BYTE_CODE\n#define JERRY_PARSER_DUMP_BYTE_CODE 0\n#endif /* defined (JERRY_PARSER_DUMP_BYTE_CODE) */\n\n/**\n * Enable/Disable ECMA property hashmap.\n *\n * Allowed values:\n *  0: Disable property hasmap.\n *  1: Enable property hashmap.\n *\n * Default value: 1\n */\n#ifndef JERRY_PROPERTY_HASHMAP\n#define JERRY_PROPERTY_HASHMAP 1\n#endif /* !defined (JERRY_PROPERTY_HASHMAP) */\n\n/**\n * Enables/disables the Promise event callbacks\n *\n * Default value: 0\n */\n#ifndef JERRY_PROMISE_CALLBACK\n#define JERRY_PROMISE_CALLBACK 0\n#endif /* !defined (JERRY_PROMISE_CALLBACK) */\n\n/**\n * Enable/Disable byte code dump functions for RegExp objects.\n * To dump the RegExp byte code the engine must be initialized with\n * regexp opcodes display flag. This option does not influence the\n * JerryScript byte code dumps.\n *\n * Allowed values:\n *  0: Disable all bytecode dump functions.\n *  1: Enable bytecode dump functions.\n *\n * Default value: 0\n */\n#ifndef JERRY_REGEXP_DUMP_BYTE_CODE\n#define JERRY_REGEXP_DUMP_BYTE_CODE 0\n#endif /* !defined (JERRY_REGEXP_DUMP_BYTE_CODE) */\n\n/**\n * Enables/disables the RegExp strict mode\n *\n * Default value: 0\n */\n#ifndef JERRY_REGEXP_STRICT_MODE\n#define JERRY_REGEXP_STRICT_MODE 0\n#endif /* !defined (JERRY_REGEXP_STRICT_MODE) */\n\n/**\n * Enable/Disable the snapshot execution functions.\n *\n * Allowed values:\n *  0: Disable snapshot execution.\n *  1: Enable snapshot execution.\n *\n * Default value: 0\n */\n#ifndef JERRY_SNAPSHOT_EXEC\n#define JERRY_SNAPSHOT_EXEC 0\n#endif /* !defined (JERRY_SNAPSHOT_EXEC) */\n\n/**\n * Enable/Disable the snapshot save functions.\n *\n * Allowed values:\n *  0: Disable snapshot save functions.\n *  1: Enable snapshot save functions.\n */\n#ifndef JERRY_SNAPSHOT_SAVE\n#define JERRY_SNAPSHOT_SAVE 0\n#endif /* !defined (JERRY_SNAPSHOT_SAVE) */\n\n/**\n * Enable/Disable usage of system allocator.\n *\n * Allowed values:\n *  0: Disable usage of system allocator.\n *  1: Enable usage of system allocator.\n *\n * Default value: 0\n */\n#ifndef JERRY_SYSTEM_ALLOCATOR\n#define JERRY_SYSTEM_ALLOCATOR 0\n#endif /* !defined (JERRY_SYSTEM_ALLOCATOR) */\n\n/**\n * Enables/disables the unicode case conversion in the engine.\n * By default Unicode case conversion is enabled.\n */\n#ifndef JERRY_UNICODE_CASE_CONVERSION\n#define JERRY_UNICODE_CASE_CONVERSION 1\n#endif /* !defined (JERRY_UNICODE_CASE_CONVERSION) */\n\n/**\n * Configures if the internal memory allocations are exposed to Valgrind or not.\n *\n * Allowed values:\n *  0: Disable the Valgrind specific memory allocation notifications.\n *  1: Enable the Valgrind specific allocation notifications.\n */\n#ifndef JERRY_VALGRIND\n#define JERRY_VALGRIND 0\n#endif /* !defined (JERRY_VALGRIND) */\n\n/**\n * Enable/Disable the vm execution stop callback function.\n *\n * Allowed values:\n *  0: Disable vm exec stop callback support.\n *  1: Enable vm exec stop callback support.\n */\n#ifndef JERRY_VM_HALT\n#define JERRY_VM_HALT 0\n#endif /* !defined (JERRY_VM_HALT) */\n\n/**\n * Enable/Disable the vm throw callback function.\n *\n * Allowed values:\n *  0: Disable vm throw callback support.\n *  1: Enable vm throw callback support.\n */\n#ifndef JERRY_VM_THROW\n#define JERRY_VM_THROW 0\n#endif /* !defined (JERRY_VM_THROW) */\n\n/**\n * Advanced section configurations.\n */\n\n/**\n * Allow configuring attributes on a few constant data inside the engine.\n *\n * One of the main usages:\n * Normally compilers store const(ant)s in ROM. Thus saving RAM.\n * But if your compiler does not support it then the directive below can force it.\n *\n * For the moment it is mainly meant for the following targets:\n *      - ESP8266\n *\n * Example configuration for moving (some) constatns into a given section:\n *  # define JERRY_ATTR_CONST_DATA __attribute__((section(\".rodata.const\")))\n */\n#ifndef JERRY_ATTR_CONST_DATA\n#define JERRY_ATTR_CONST_DATA\n#endif /* !defined (JERRY_ATTR_CONST_DATA) */\n\n/**\n * The JERRY_ATTR_GLOBAL_HEAP allows adding extra attributes for the Jerry global heap.\n *\n * Example on how to move the global heap into it's own section:\n *   #define JERRY_ATTR_GLOBAL_HEAP __attribute__((section(\".text.globalheap\")))\n */\n#ifndef JERRY_ATTR_GLOBAL_HEAP\n#define JERRY_ATTR_GLOBAL_HEAP\n#endif /* !defined (JERRY_ATTR_GLOBAL_HEAP) */\n\n/**\n * Sanity check for macros to see if the values are 0 or 1\n *\n * If a new feature is added this should be updated.\n */\n/**\n * Check base builtins.\n */\n#if (JERRY_BUILTIN_ANNEXB != 0) && (JERRY_BUILTIN_ANNEXB != 1)\n#error \"Invalid value for JERRY_BUILTIN_ANNEXB macro.\"\n#endif /* (JERRY_BUILTIN_ANNEXB != 0) && (JERRY_BUILTIN_ANNEXB != 1) */\n#if (JERRY_BUILTIN_ARRAY != 0) && (JERRY_BUILTIN_ARRAY != 1)\n#error \"Invalid value for JERRY_BUILTIN_ARRAY macro.\"\n#endif /* (JERRY_BUILTIN_ARRAY != 0) && (JERRY_BUILTIN_ARRAY != 1) */\n#if (JERRY_BUILTIN_BOOLEAN != 0) && (JERRY_BUILTIN_BOOLEAN != 1)\n#error \"Invalid value for JERRY_BUILTIN_BOOLEAN macro.\"\n#endif /* (JERRY_BUILTIN_BOOLEAN != 0) && (JERRY_BUILTIN_BOOLEAN != 1) */\n#if (JERRY_BUILTIN_DATE != 0) && (JERRY_BUILTIN_DATE != 1)\n#error \"Invalid value for JERRY_BUILTIN_DATE macro.\"\n#endif /* (JERRY_BUILTIN_DATE != 0) && (JERRY_BUILTIN_DATE != 1) */\n#if (JERRY_BUILTIN_ERRORS != 0) && (JERRY_BUILTIN_ERRORS != 1)\n#error \"Invalid value for JERRY_BUILTIN_ERRORS macro.\"\n#endif /* (JERRY_BUILTIN_ERRORS != 0) && (JERRY_BUILTIN_ERRORS != 1) */\n#if (JERRY_BUILTIN_JSON != 0) && (JERRY_BUILTIN_JSON != 1)\n#error \"Invalid value for JERRY_BUILTIN_JSON macro.\"\n#endif /* (JERRY_BUILTIN_JSON != 0) && (JERRY_BUILTIN_JSON != 1) */\n#if (JERRY_BUILTIN_MATH != 0) && (JERRY_BUILTIN_MATH != 1)\n#error \"Invalid value for JERRY_BUILTIN_MATH macro.\"\n#endif /* (JERRY_BUILTIN_MATH != 0) && (JERRY_BUILTIN_MATH != 1) */\n#if (JERRY_BUILTIN_NUMBER != 0) && (JERRY_BUILTIN_NUMBER != 1)\n#error \"Invalid value for JERRY_BUILTIN_NUMBER macro.\"\n#endif /* (JERRY_BUILTIN_NUMBER != 0) && (JERRY_BUILTIN_NUMBER != 1) */\n#if (JERRY_BUILTIN_REGEXP != 0) && (JERRY_BUILTIN_REGEXP != 1)\n#error \"Invalid value for JERRY_BUILTIN_REGEXP macro.\"\n#endif /* (JERRY_BUILTIN_REGEXP != 0) && (JERRY_BUILTIN_REGEXP != 1) */\n#if (JERRY_BUILTIN_STRING != 0) && (JERRY_BUILTIN_STRING != 1)\n#error \"Invalid value for JERRY_BUILTIN_STRING macro.\"\n#endif /* (JERRY_BUILTIN_STRING != 0) && (JERRY_BUILTIN_STRING != 1) */\n#if (JERRY_BUILTINS != 0) && (JERRY_BUILTINS != 1)\n#error \"Invalid value for JERRY_BUILTINS macro.\"\n#endif /* (JERRY_BUILTINS != 0) && (JERRY_BUILTINS != 1) */\n#if (JERRY_BUILTIN_REALMS != 0) && (JERRY_BUILTIN_REALMS != 1)\n#error \"Invalid value for JERRY_BUILTIN_REALMS macro.\"\n#endif /* (JERRY_BUILTIN_REALMS != 0) && (JERRY_BUILTIN_REALMS != 1) */\n#if (JERRY_BUILTIN_DATAVIEW != 0) && (JERRY_BUILTIN_DATAVIEW != 1)\n#error \"Invalid value for JERRY_BUILTIN_DATAVIEW macro.\"\n#endif /* (JERRY_BUILTIN_DATAVIEW != 0) && (JERRY_BUILTIN_DATAVIEW != 1) */\n#if (JERRY_BUILTIN_GLOBAL_THIS != 0) && (JERRY_BUILTIN_GLOBAL_THIS != 1)\n#error \"Invalid value for JERRY_BUILTIN_GLOBAL_THIS macro.\"\n#endif /* (JERRY_BUILTIN_GLOBAL_THIS != 0) && (JERRY_BUILTIN_GLOBAL_THIS != 1) */\n#if (JERRY_BUILTIN_REFLECT != 0) && (JERRY_BUILTIN_REFLECT != 1)\n#error \"Invalid value for JERRY_BUILTIN_REFLECT macro.\"\n#endif /* (JERRY_BUILTIN_REFLECT != 0) && (JERRY_BUILTIN_REFLECT != 1) */\n#if (JERRY_BUILTIN_WEAKREF != 0) && (JERRY_BUILTIN_WEAKREF != 1)\n#error \"Invalid value for JERRY_BUILTIN_WEAKREF macro.\"\n#endif /* (JERRY_BUILTIN_WEAKREF != 0) && (JERRY_BUILTIN_WEAKREF != 1) */\n#if (JERRY_BUILTIN_PROXY != 0) && (JERRY_BUILTIN_PROXY != 1)\n#error \"Invalid value for JERRY_BUILTIN_PROXY macro.\"\n#endif /* (JERRY_BUILTIN_PROXY != 0) && (JERRY_BUILTIN_PROXY != 1) */\n#if (JERRY_BUILTIN_TYPEDARRAY != 0) && (JERRY_BUILTIN_TYPEDARRAY != 1)\n#error \"Invalid value for JERRY_BUILTIN_TYPEDARRAY macro.\"\n#endif /* (JERRY_BUILTIN_TYPEDARRAY != 0) && (JERRY_BUILTIN_TYPEDARRAY != 1) */\n#if (JERRY_BUILTIN_SHAREDARRAYBUFFER != 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER != 1)\n#error \"Invalid value for JERRY_BUILTIN_SHAREDARRAYBUFFER macro.\"\n#endif /* (JERRY_BUILTIN_SHAREDARRAYBUFFER != 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER != 1) */\n#if (JERRY_BUILTIN_ATOMICS != 0) && (JERRY_BUILTIN_ATOMICS != 1)\n#error \"Invalid value for JERRY_BUILTIN_ATOMICS macro.\"\n#endif /* (JERRY_BUILTIN_ATOMICS != 0) && (JERRY_BUILTIN_ATOMICS != 1) */\n#if (JERRY_BUILTIN_BIGINT != 0) && (JERRY_BUILTIN_BIGINT != 1)\n#error \"Invalid value for JERRY_BUILTIN_BIGINT macro.\"\n#endif /* (JERRY_BUILTIN_BIGINT != 0) && (JERRY_BUILTIN_BIGINT != 1) */\n#if (JERRY_MODULE_SYSTEM != 0) && (JERRY_MODULE_SYSTEM != 1)\n#error \"Invalid value for JERRY_MODULE_SYSTEM macro.\"\n#endif /* (JERRY_MODULE_SYSTEM != 0) && (JERRY_MODULE_SYSTEM != 1) */\n#if (JERRY_BUILTIN_TYPEDARRAY == 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER == 1)\n#error \"JERRY_BUILTIN_TYPEDARRAY should be enabled too to enable JERRY_BUILTIN_SHAREDARRAYBUFFER macro.\"\n#endif /* (JERRY_BUILTIN_TYPEDARRAY == 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER == 1) */\n#if (JERRY_BUILTIN_SHAREDARRAYBUFFER == 0) && (JERRY_BUILTIN_ATOMICS == 1)\n#error \"JERRY_BUILTIN_SHAREDARRAYBUFFER should be enabled too to enable JERRY_BUILTIN_ATOMICS macro.\"\n#endif /* (JERRY_BUILTIN_SHAREDARRAYBUFFER == 0) && (JERRY_BUILTIN_ATOMICS == 1) */\n\n/**\n * Internal options.\n */\n#if (JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1)\n#error \"Invalid value for 'JERRY_CPOINTER_32_BIT' macro.\"\n#endif /* (JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1) */\n#if (JERRY_DEBUGGER != 0) && (JERRY_DEBUGGER != 1)\n#error \"Invalid value for 'JERRY_DEBUGGER' macro.\"\n#endif /* (JERRY_DEBUGGER != 0) && (JERRY_DEBUGGER != 1) */\n#if (JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1)\n#error \"Invalid value for 'JERRY_ERROR_MESSAGES' macro.\"\n#endif /* (JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1) */\n#if (JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1)\n#error \"Invalid value for 'JERRY_EXTERNAL_CONTEXT' macro.\"\n#endif /* (JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1) */\n#if JERRY_GLOBAL_HEAP_SIZE <= 0\n#error \"Invalid value for 'JERRY_GLOBAL_HEAP_SIZE' macro.\"\n#endif /* JERRY_GLOBAL_HEAP_SIZE <= 0 */\n#if JERRY_GC_LIMIT < 0\n#error \"Invalid value for 'JERRY_GC_LIMIT' macro.\"\n#endif /* JERRY_GC_LIMIT < 0 */\n#if JERRY_STACK_LIMIT < 0\n#error \"Invalid value for 'JERRY_STACK_LIMIT' macro.\"\n#endif /* JERRY_STACK_LIMIT < 0 */\n#if JERRY_GC_MARK_LIMIT < 0\n#error \"Invalid value for 'JERRY_GC_MARK_LIMIT' macro.\"\n#endif /* JERRY_GC_MARK_LIMIT < 0 */\n#if (JERRY_LCACHE != 0) && (JERRY_LCACHE != 1)\n#error \"Invalid value for 'JERRY_LCACHE' macro.\"\n#endif /* (JERRY_LCACHE != 0) && (JERRY_LCACHE != 1) */\n#if (JERRY_FUNCTION_TO_STRING != 0) && (JERRY_FUNCTION_TO_STRING != 1)\n#error \"Invalid value for 'JERRY_FUNCTION_TO_STRING' macro.\"\n#endif /* (JERRY_FUNCTION_TO_STRING != 0) && (JERRY_FUNCTION_TO_STRING != 1) */\n#if (JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1)\n#error \"Invalid value for 'JERRY_LINE_INFO' macro.\"\n#endif /* (JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1) */\n#if (JERRY_LOGGING != 0) && (JERRY_LOGGING != 1)\n#error \"Invalid value for 'JERRY_LOGGING' macro.\"\n#endif /* (JERRY_LOGGING != 0) && (JERRY_LOGGING != 1) */\n#if (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1)\n#error \"Invalid value for 'JERRY_MEM_GC_BEFORE_EACH_ALLOC' macro.\"\n#endif /* (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1) */\n#if (JERRY_MEM_STATS != 0) && (JERRY_MEM_STATS != 1)\n#error \"Invalid value for 'JERRY_MEM_STATS' macro.\"\n#endif /* (JERRY_MEM_STATS != 0) && (JERRY_MEM_STATS != 1) */\n#if (JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1)\n#error \"Invalid value for 'JERRY_NUMBER_TYPE_FLOAT64' macro.\"\n#endif /* (JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1) */\n#if (JERRY_PARSER != 0) && (JERRY_PARSER != 1)\n#error \"Invalid value for 'JERRY_PARSER' macro.\"\n#endif /* (JERRY_PARSER != 0) && (JERRY_PARSER != 1) */\n#if (JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1)\n#error \"Invalid value for 'JERRY_PARSER_DUMP_BYTE_CODE' macro.\"\n#endif /* (JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1) */\n#if (JERRY_PROPERTY_HASHMAP != 0) && (JERRY_PROPERTY_HASHMAP != 1)\n#error \"Invalid value for 'JERRY_PROPERTY_HASHMAP' macro.\"\n#endif /* (JERRY_PROPERTY_HASHMAP != 0) && (JERRY_PROPERTY_HASHMAP != 1) */\n#if (JERRY_PROMISE_CALLBACK != 0) && (JERRY_PROMISE_CALLBACK != 1)\n#error \"Invalid value for 'JERRY_PROMISE_CALLBACK' macro.\"\n#endif /* (JERRY_PROMISE_CALLBACK != 0) && (JERRY_PROMISE_CALLBACK != 1) */\n#if (JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1)\n#error \"Invalid value for 'JERRY_REGEXP_DUMP_BYTE_CODE' macro.\"\n#endif /* (JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1) */\n#if (JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1)\n#error \"Invalid value for 'JERRY_REGEXP_STRICT_MODE' macro.\"\n#endif /* (JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1) */\n#if (JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1)\n#error \"Invalid value for 'JERRY_SNAPSHOT_EXEC' macro.\"\n#endif /* (JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1) */\n#if (JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1)\n#error \"Invalid value for 'JERRY_SNAPSHOT_SAVE' macro.\"\n#endif /* (JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1) */\n#if (JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1)\n#error \"Invalid value for 'JERRY_SYSTEM_ALLOCATOR' macro.\"\n#endif /* (JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1) */\n#if (JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1)\n#error \"Invalid value for 'JERRY_UNICODE_CASE_CONVERSION' macro.\"\n#endif /* (JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1) */\n#if (JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1)\n#error \"Invalid value for 'JERRY_VALGRIND' macro.\"\n#endif /* (JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1) */\n#if (JERRY_VM_HALT != 0) && (JERRY_VM_HALT != 1)\n#error \"Invalid value for 'JERRY_VM_HALT' macro.\"\n#endif /* (JERRY_VM_HALT != 0) && (JERRY_VM_HALT != 1) */\n#if (JERRY_VM_THROW != 0) && (JERRY_VM_THROW != 1)\n#error \"Invalid value for 'JERRY_VM_THROW' macro.\"\n#endif /* (JERRY_VM_THROW != 0) && (JERRY_VM_THROW != 1) */\n\n/**\n * Cross component requirements check.\n */\n\n/**\n * The date module can only use the float 64 number types.\n */\n#if JERRY_BUILTIN_DATE && !JERRY_NUMBER_TYPE_FLOAT64\n#error \"Date does not support float32\"\n#endif /* JERRY_BUILTIN_DATE && !JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Source name related types into a single guard\n */\n#if JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM\n#define JERRY_SOURCE_NAME 1\n#else /* !(JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM) */\n#define JERRY_SOURCE_NAME 0\n#endif /* JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM */\n\n#endif /* !JERRYSCRIPT_CONFIG_H */\n"
  },
  {
    "path": "jerry-core/debugger/debugger.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"debugger.h\"\n\n#include \"jerryscript-debugger.h\"\n\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-eval.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-objects.h\"\n\n#include \"byte-code.h\"\n#include \"jcontext.h\"\n#include \"lit-char-helpers.h\"\n\n#if JERRY_DEBUGGER\n\n/**\n * Incoming message: next message of string data.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n} jerry_debugger_receive_uint8_data_part_t;\n\n/**\n * The number of message types in the debugger should reflect the\n * debugger versioning.\n */\nJERRY_STATIC_ASSERT (JERRY_DEBUGGER_MESSAGES_OUT_MAX_COUNT == 33 && JERRY_DEBUGGER_MESSAGES_IN_MAX_COUNT == 21\n                       && JERRY_DEBUGGER_VERSION == 9,\n                     debugger_version_correlates_to_message_type_count);\n\n/**\n * Waiting for data from the client.\n */\n#define JERRY_DEBUGGER_RECEIVE_DATA_MODE (JERRY_DEBUGGER_BREAKPOINT_MODE | JERRY_DEBUGGER_CLIENT_SOURCE_MODE)\n\n/**\n * Type cast the debugger send buffer into a specific type.\n */\n#define JERRY_DEBUGGER_SEND_BUFFER_AS(type, name_p) \\\n  type *name_p = (type *) (JERRY_CONTEXT (debugger_send_buffer_payload_p))\n\n/**\n * Type cast the debugger receive buffer into a specific type.\n */\n#define JERRY_DEBUGGER_RECEIVE_BUFFER_AS(type, name_p) type *name_p = ((type *) recv_buffer_p)\n\n/**\n * Free all unreferenced byte code structures which\n * were not acknowledged by the debugger client.\n */\nvoid\njerry_debugger_free_unreferenced_byte_code (void)\n{\n  jerry_debugger_byte_code_free_t *byte_code_free_p;\n\n  byte_code_free_p =\n    JMEM_CP_GET_POINTER (jerry_debugger_byte_code_free_t, JERRY_CONTEXT (debugger_byte_code_free_tail));\n\n  while (byte_code_free_p != NULL)\n  {\n    jerry_debugger_byte_code_free_t *prev_byte_code_free_p;\n    prev_byte_code_free_p = JMEM_CP_GET_POINTER (jerry_debugger_byte_code_free_t, byte_code_free_p->prev_cp);\n\n    jmem_heap_free_block (byte_code_free_p, ((size_t) byte_code_free_p->size) << JMEM_ALIGNMENT_LOG);\n\n    byte_code_free_p = prev_byte_code_free_p;\n  }\n} /* jerry_debugger_free_unreferenced_byte_code */\n\n/**\n * Send data over an active connection.\n *\n * @return true - if the data was sent successfully\n *         false - otherwise\n */\nstatic bool\njerry_debugger_send (size_t message_length) /**< message length in bytes */\n{\n  JERRY_ASSERT (message_length <= JERRY_CONTEXT (debugger_max_send_size));\n\n  jerry_debugger_transport_header_t *header_p = JERRY_CONTEXT (debugger_transport_header_p);\n  uint8_t *payload_p = JERRY_CONTEXT (debugger_send_buffer_payload_p);\n\n  return header_p->send (header_p, payload_p, message_length);\n} /* jerry_debugger_send */\n\n/**\n * Send backtrace.\n */\nstatic void\njerry_debugger_send_backtrace (const uint8_t *recv_buffer_p) /**< pointer to the received data */\n{\n  JERRY_DEBUGGER_RECEIVE_BUFFER_AS (jerry_debugger_receive_get_backtrace_t, get_backtrace_p);\n\n  uint32_t min_depth;\n  memcpy (&min_depth, get_backtrace_p->min_depth, sizeof (uint32_t));\n  uint32_t max_depth;\n  memcpy (&max_depth, get_backtrace_p->max_depth, sizeof (uint32_t));\n\n  if (max_depth == 0)\n  {\n    max_depth = UINT32_MAX;\n  }\n\n  if (get_backtrace_p->get_total_frame_count != 0)\n  {\n    JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_backtrace_total_t, backtrace_total_p);\n    backtrace_total_p->type = JERRY_DEBUGGER_BACKTRACE_TOTAL;\n\n    vm_frame_ctx_t *iter_frame_ctx_p = JERRY_CONTEXT (vm_top_context_p);\n    uint32_t frame_count = 0;\n    while (iter_frame_ctx_p != NULL)\n    {\n      if (!(iter_frame_ctx_p->shared_p->bytecode_header_p->status_flags & (CBC_CODE_FLAGS_STATIC_FUNCTION)))\n      {\n        frame_count++;\n      }\n      iter_frame_ctx_p = iter_frame_ctx_p->prev_context_p;\n    }\n    memcpy (backtrace_total_p->frame_count, &frame_count, sizeof (frame_count));\n\n    jerry_debugger_send (sizeof (jerry_debugger_send_type_t) + sizeof (frame_count));\n  }\n\n  JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_backtrace_t, backtrace_p);\n\n  backtrace_p->type = JERRY_DEBUGGER_BACKTRACE;\n\n  vm_frame_ctx_t *frame_ctx_p = JERRY_CONTEXT (vm_top_context_p);\n\n  size_t current_frame = 0;\n  const size_t max_frame_count = JERRY_DEBUGGER_SEND_MAX (jerry_debugger_frame_t);\n  const size_t max_message_size = JERRY_DEBUGGER_SEND_SIZE (max_frame_count, jerry_debugger_frame_t);\n\n  if (min_depth <= max_depth)\n  {\n    uint32_t min_depth_offset = 0;\n\n    while (frame_ctx_p != NULL && min_depth_offset < min_depth)\n    {\n      frame_ctx_p = frame_ctx_p->prev_context_p;\n      min_depth_offset++;\n    }\n\n    while (frame_ctx_p != NULL && min_depth_offset++ < max_depth)\n    {\n      if (frame_ctx_p->shared_p->bytecode_header_p->status_flags\n          & (CBC_CODE_FLAGS_DEBUGGER_IGNORE | CBC_CODE_FLAGS_STATIC_FUNCTION))\n      {\n        frame_ctx_p = frame_ctx_p->prev_context_p;\n        continue;\n      }\n\n      if (current_frame >= max_frame_count)\n      {\n        if (!jerry_debugger_send (max_message_size))\n        {\n          return;\n        }\n        current_frame = 0;\n      }\n\n      jerry_debugger_frame_t *frame_p = backtrace_p->frames + current_frame;\n\n      jmem_cpointer_t byte_code_cp;\n      JMEM_CP_SET_NON_NULL_POINTER (byte_code_cp, frame_ctx_p->shared_p->bytecode_header_p);\n      memcpy (frame_p->byte_code_cp, &byte_code_cp, sizeof (jmem_cpointer_t));\n\n      uint32_t offset = (uint32_t) (frame_ctx_p->byte_code_p - (uint8_t *) frame_ctx_p->shared_p->bytecode_header_p);\n      memcpy (frame_p->offset, &offset, sizeof (uint32_t));\n\n      frame_ctx_p = frame_ctx_p->prev_context_p;\n      current_frame++;\n    }\n  }\n\n  size_t message_size = current_frame * sizeof (jerry_debugger_frame_t);\n\n  backtrace_p->type = JERRY_DEBUGGER_BACKTRACE_END;\n\n  jerry_debugger_send (sizeof (jerry_debugger_send_type_t) + message_size);\n} /* jerry_debugger_send_backtrace */\n\n/**\n * Send the scope chain types.\n */\nstatic void\njerry_debugger_send_scope_chain (void)\n{\n  vm_frame_ctx_t *iter_frame_ctx_p = JERRY_CONTEXT (vm_top_context_p);\n\n  const size_t max_byte_count = JERRY_DEBUGGER_SEND_MAX (uint8_t);\n  const size_t max_message_size = JERRY_DEBUGGER_SEND_SIZE (max_byte_count, uint8_t);\n\n  JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_string_t, message_type_p);\n  message_type_p->type = JERRY_DEBUGGER_SCOPE_CHAIN;\n\n  size_t buffer_pos = 0;\n  bool next_func_is_local = true;\n  ecma_object_t *lex_env_p = iter_frame_ctx_p->lex_env_p;\n\n  while (true)\n  {\n    JERRY_ASSERT (ecma_is_lexical_environment (lex_env_p));\n\n    if (buffer_pos == max_byte_count)\n    {\n      if (!jerry_debugger_send (max_message_size))\n      {\n        return;\n      }\n\n      buffer_pos = 0;\n    }\n\n    if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n    {\n      if ((lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK) != 0)\n      {\n        message_type_p->string[buffer_pos++] = JERRY_DEBUGGER_SCOPE_NON_CLOSURE;\n      }\n      else if (next_func_is_local)\n      {\n        message_type_p->string[buffer_pos++] = JERRY_DEBUGGER_SCOPE_LOCAL;\n        next_func_is_local = false;\n      }\n      else\n      {\n        message_type_p->string[buffer_pos++] = JERRY_DEBUGGER_SCOPE_CLOSURE;\n      }\n    }\n    else if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND)\n    {\n      if (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL)\n      {\n        message_type_p->string[buffer_pos++] = JERRY_DEBUGGER_SCOPE_GLOBAL;\n        break;\n      }\n      else\n      {\n        message_type_p->string[buffer_pos++] = JERRY_DEBUGGER_SCOPE_WITH;\n      }\n    }\n\n    JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);\n    lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n  }\n\n  message_type_p->type = JERRY_DEBUGGER_SCOPE_CHAIN_END;\n\n  jerry_debugger_send (sizeof (jerry_debugger_send_type_t) + buffer_pos);\n} /* jerry_debugger_send_scope_chain */\n\n/**\n * Get type of the scope variable property.\n * @return (jerry_debugger_scope_variable_type_t)\n */\nstatic uint8_t\njerry_debugger_get_variable_type (ecma_value_t value) /**< input ecma value */\n{\n  uint8_t ret_value = JERRY_DEBUGGER_VALUE_NONE;\n\n  if (ecma_is_value_undefined (value))\n  {\n    ret_value = JERRY_DEBUGGER_VALUE_UNDEFINED;\n  }\n  else if (ecma_is_value_null (value))\n  {\n    ret_value = JERRY_DEBUGGER_VALUE_NULL;\n  }\n  else if (ecma_is_value_boolean (value))\n  {\n    ret_value = JERRY_DEBUGGER_VALUE_BOOLEAN;\n  }\n  else if (ecma_is_value_number (value))\n  {\n    ret_value = JERRY_DEBUGGER_VALUE_NUMBER;\n  }\n  else if (ecma_is_value_string (value))\n  {\n    ret_value = JERRY_DEBUGGER_VALUE_STRING;\n  }\n  else\n  {\n    JERRY_ASSERT (ecma_is_value_object (value));\n\n    if (ecma_get_object_type (ecma_get_object_from_value (value)) == ECMA_OBJECT_TYPE_ARRAY)\n    {\n      ret_value = JERRY_DEBUGGER_VALUE_ARRAY;\n    }\n    else\n    {\n      ret_value = ecma_op_is_callable (value) ? JERRY_DEBUGGER_VALUE_FUNCTION : JERRY_DEBUGGER_VALUE_OBJECT;\n    }\n  }\n\n  JERRY_ASSERT (ret_value != JERRY_DEBUGGER_VALUE_NONE);\n\n  return ret_value;\n} /* jerry_debugger_get_variable_type */\n\n/**\n * Helper function for jerry_debugger_send_scope_variables.\n *\n * It will copies the given scope values type, length and value into the outgoing message string.\n *\n * @param variable_type type (jerry_debugger_scope_variable_type_t)\n * @return true - if the copy was successfully\n *         false - otherwise\n */\nstatic bool\njerry_debugger_copy_variables_to_string_message (uint8_t variable_type, /**< type */\n                                                 ecma_string_t *value_str, /**< property name or value string */\n                                                 jerry_debugger_send_string_t *message_string_p, /**< msg pointer */\n                                                 size_t *buffer_pos) /**< string data position of the message */\n{\n  const size_t max_byte_count = JERRY_DEBUGGER_SEND_MAX (uint8_t);\n  const size_t max_message_size = JERRY_DEBUGGER_SEND_SIZE (max_byte_count, uint8_t);\n\n  ECMA_STRING_TO_UTF8_STRING (value_str, str_buff, str_buff_size);\n\n  size_t str_size = 0;\n  size_t str_limit = 255;\n  bool result = true;\n\n  bool type_processed = false;\n\n  while (true)\n  {\n    if (*buffer_pos == max_byte_count)\n    {\n      if (!jerry_debugger_send (max_message_size))\n      {\n        result = false;\n        break;\n      }\n\n      *buffer_pos = 0;\n    }\n\n    if (!type_processed)\n    {\n      if (variable_type != JERRY_DEBUGGER_VALUE_NONE)\n      {\n        message_string_p->string[*buffer_pos] = variable_type;\n        *buffer_pos += 1;\n      }\n      type_processed = true;\n      continue;\n    }\n\n    if (variable_type == JERRY_DEBUGGER_VALUE_FUNCTION)\n    {\n      str_size = 0; // do not copy function values\n    }\n    else\n    {\n      str_size = (str_buff_size > str_limit) ? str_limit : str_buff_size;\n    }\n\n    message_string_p->string[*buffer_pos] = (uint8_t) str_size;\n    *buffer_pos += 1;\n    break;\n  }\n\n  if (result)\n  {\n    size_t free_bytes = max_byte_count - *buffer_pos;\n    const uint8_t *string_p = str_buff;\n\n    while (str_size > free_bytes)\n    {\n      memcpy (message_string_p->string + *buffer_pos, string_p, free_bytes);\n\n      if (!jerry_debugger_send (max_message_size))\n      {\n        result = false;\n        break;\n      }\n\n      string_p += free_bytes;\n      str_size -= free_bytes;\n      free_bytes = max_byte_count;\n      *buffer_pos = 0;\n    }\n\n    if (result)\n    {\n      memcpy (message_string_p->string + *buffer_pos, string_p, str_size);\n      *buffer_pos += str_size;\n    }\n  }\n\n  ECMA_FINALIZE_UTF8_STRING (str_buff, str_buff_size);\n\n  return result;\n} /* jerry_debugger_copy_variables_to_string_message */\n\n/**\n * Send variables of the given scope chain level.\n */\nstatic void\njerry_debugger_send_scope_variables (const uint8_t *recv_buffer_p) /**< pointer to the received data */\n{\n  JERRY_DEBUGGER_RECEIVE_BUFFER_AS (jerry_debugger_receive_get_scope_variables_t, get_scope_variables_p);\n\n  uint32_t chain_index;\n  memcpy (&chain_index, get_scope_variables_p->chain_index, sizeof (uint32_t));\n\n  vm_frame_ctx_t *iter_frame_ctx_p = JERRY_CONTEXT (vm_top_context_p);\n  ecma_object_t *lex_env_p = iter_frame_ctx_p->lex_env_p;\n\n  while (chain_index != 0)\n  {\n    if (JERRY_UNLIKELY (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL))\n    {\n      jerry_debugger_send_type (JERRY_DEBUGGER_SCOPE_VARIABLES_END);\n      return;\n    }\n\n    lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n\n    if ((ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND)\n        || (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE))\n    {\n      chain_index--;\n    }\n  }\n\n  jmem_cpointer_t prop_iter_cp;\n\n  if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n  {\n    prop_iter_cp = lex_env_p->u1.property_list_cp;\n  }\n  else\n  {\n    JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n    ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);\n\n    if (JERRY_UNLIKELY (ecma_op_object_is_fast_array (binding_obj_p)))\n    {\n      ecma_fast_array_convert_to_normal (binding_obj_p);\n    }\n\n    prop_iter_cp = binding_obj_p->u1.property_list_cp;\n  }\n\n  JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_string_t, message_string_p);\n  message_string_p->type = JERRY_DEBUGGER_SCOPE_VARIABLES;\n\n  size_t buffer_pos = 0;\n\n  while (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n    ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n    for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      if (ECMA_PROPERTY_IS_NAMED_PROPERTY (prop_iter_p->types[i]))\n      {\n        if (ECMA_PROPERTY_GET_NAME_TYPE (prop_iter_p->types[i]) == ECMA_DIRECT_STRING_MAGIC\n            && prop_pair_p->names_cp[i] >= LIT_NON_INTERNAL_MAGIC_STRING__COUNT)\n        {\n          continue;\n        }\n\n        ecma_string_t *prop_name = ecma_string_from_property_name (prop_iter_p->types[i], prop_pair_p->names_cp[i]);\n\n        if (!jerry_debugger_copy_variables_to_string_message (JERRY_DEBUGGER_VALUE_NONE,\n                                                              prop_name,\n                                                              message_string_p,\n                                                              &buffer_pos))\n        {\n          ecma_deref_ecma_string (prop_name);\n          return;\n        }\n\n        ecma_deref_ecma_string (prop_name);\n\n        ecma_property_value_t prop_value_p = prop_pair_p->values[i];\n\n        uint8_t variable_type = jerry_debugger_get_variable_type (prop_value_p.value);\n\n        ecma_string_t *str_p = ecma_op_to_string (prop_value_p.value);\n        JERRY_ASSERT (str_p != NULL);\n\n        if (!jerry_debugger_copy_variables_to_string_message (variable_type, str_p, message_string_p, &buffer_pos))\n        {\n          ecma_deref_ecma_string (str_p);\n          return;\n        }\n\n        ecma_deref_ecma_string (str_p);\n      }\n    }\n\n    prop_iter_cp = prop_iter_p->next_property_cp;\n  }\n\n  message_string_p->type = JERRY_DEBUGGER_SCOPE_VARIABLES_END;\n  jerry_debugger_send (sizeof (jerry_debugger_send_type_t) + buffer_pos);\n} /* jerry_debugger_send_scope_variables */\n\n/**\n * Send result of evaluated expression or throw an error.\n *\n * @return true - if execution should be resumed\n *         false - otherwise\n */\nstatic bool\njerry_debugger_send_eval (const lit_utf8_byte_t *eval_string_p, /**< evaluated string */\n                          size_t eval_string_size) /**< evaluated string size */\n{\n  JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n  JERRY_ASSERT (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_IGNORE));\n\n  JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_IGNORE);\n\n  uint32_t chain_index;\n  memcpy (&chain_index, eval_string_p, sizeof (uint32_t));\n  uint32_t parse_opts = ECMA_PARSE_DIRECT_EVAL;\n  JERRY_CONTEXT (debugger_eval_chain_index) = (uint16_t) chain_index;\n\n  parser_source_char_t source_char;\n  source_char.source_p = eval_string_p + 5;\n  source_char.source_size = eval_string_size - 5;\n\n  ecma_value_t result = ecma_op_eval_chars_buffer ((void *) &source_char, parse_opts);\n  JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_IGNORE);\n\n  if (!ECMA_IS_VALUE_ERROR (result))\n  {\n    if (eval_string_p[4] != JERRY_DEBUGGER_EVAL_EVAL)\n    {\n      JERRY_ASSERT (eval_string_p[4] == JERRY_DEBUGGER_EVAL_THROW || eval_string_p[4] == JERRY_DEBUGGER_EVAL_ABORT);\n      JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);\n\n      /* Stop where the error is caught. */\n      JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_STOP);\n      JERRY_CONTEXT (debugger_stop_context) = NULL;\n\n      jcontext_raise_exception (result);\n      jcontext_set_abort_flag (eval_string_p[4] == JERRY_DEBUGGER_EVAL_ABORT);\n\n      return true;\n    }\n\n    if (!ecma_is_value_string (result))\n    {\n      ecma_string_t *str_p = ecma_op_to_string (result);\n      ecma_value_t to_string_value = ecma_make_string_value (str_p);\n      ecma_free_value (result);\n      result = to_string_value;\n    }\n  }\n\n  ecma_value_t message = result;\n  uint8_t type = JERRY_DEBUGGER_EVAL_OK;\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    type = JERRY_DEBUGGER_EVAL_ERROR;\n    result = JERRY_CONTEXT (error_value);\n\n    if (ecma_is_value_object (result))\n    {\n      message =\n        ecma_op_object_find (ecma_get_object_from_value (result), ecma_get_magic_string (LIT_MAGIC_STRING_MESSAGE));\n\n      if (!ecma_is_value_string (message) || ecma_string_is_empty (ecma_get_string_from_value (message)))\n      {\n        ecma_free_value (message);\n        lit_magic_string_id_t id = ecma_object_get_class_name (ecma_get_object_from_value (result));\n        ecma_free_value (result);\n\n        const lit_utf8_byte_t *string_p = lit_get_magic_string_utf8 (id);\n        jerry_debugger_send_string (JERRY_DEBUGGER_EVAL_RESULT, type, string_p, strlen ((const char *) string_p));\n        return false;\n      }\n    }\n    else\n    {\n      /* Primitive type. */\n      ecma_string_t *str_p = ecma_op_to_string (result);\n      JERRY_ASSERT (str_p != NULL);\n\n      message = ecma_make_string_value (str_p);\n    }\n\n    ecma_free_value (result);\n  }\n\n  ecma_string_t *string_p = ecma_get_string_from_value (message);\n\n  ECMA_STRING_TO_UTF8_STRING (string_p, buffer_p, buffer_size);\n  jerry_debugger_send_string (JERRY_DEBUGGER_EVAL_RESULT, type, buffer_p, buffer_size);\n  ECMA_FINALIZE_UTF8_STRING (buffer_p, buffer_size);\n\n  ecma_free_value (message);\n\n  return false;\n} /* jerry_debugger_send_eval */\n\n/**\n * Check received packet size.\n */\n#define JERRY_DEBUGGER_CHECK_PACKET_SIZE(type)  \\\n  if (message_size != sizeof (type))            \\\n  {                                             \\\n    JERRY_ERROR_MSG (\"Invalid message size\\n\"); \\\n    jerry_debugger_transport_close ();          \\\n    return false;                               \\\n  }\n\n/**\n * Receive message from the client.\n *\n * @return true - if message is processed successfully\n *         false - otherwise\n */\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\njerry_debugger_process_message (const uint8_t *recv_buffer_p, /**< pointer to the received data */\n                                uint32_t message_size, /**< message size */\n                                bool *resume_exec_p, /**< pointer to the resume exec flag */\n                                uint8_t *expected_message_type_p, /**< message type */\n                                jerry_debugger_uint8_data_t **message_data_p) /**< custom message data */\n{\n  /* Process the received message. */\n\n  if (recv_buffer_p[0] >= JERRY_DEBUGGER_CONTINUE && !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))\n  {\n    JERRY_ERROR_MSG (\"Message requires breakpoint mode\\n\");\n    jerry_debugger_transport_close ();\n    return false;\n  }\n\n  if (*expected_message_type_p != 0)\n  {\n    JERRY_ASSERT (*expected_message_type_p == JERRY_DEBUGGER_EVAL_PART\n                  || *expected_message_type_p == JERRY_DEBUGGER_CLIENT_SOURCE_PART);\n\n    jerry_debugger_uint8_data_t *uint8_data_p = (jerry_debugger_uint8_data_t *) *message_data_p;\n\n    if (recv_buffer_p[0] != *expected_message_type_p)\n    {\n      jmem_heap_free_block (uint8_data_p, uint8_data_p->uint8_size + sizeof (jerry_debugger_uint8_data_t));\n      JERRY_ERROR_MSG (\"Unexpected message\\n\");\n      jerry_debugger_transport_close ();\n      return false;\n    }\n\n    JERRY_DEBUGGER_RECEIVE_BUFFER_AS (jerry_debugger_receive_uint8_data_part_t, uint8_data_part_p);\n\n    if (message_size < sizeof (jerry_debugger_receive_uint8_data_part_t) + 1)\n    {\n      jmem_heap_free_block (uint8_data_p, uint8_data_p->uint8_size + sizeof (jerry_debugger_uint8_data_t));\n      JERRY_ERROR_MSG (\"Invalid message size\\n\");\n      jerry_debugger_transport_close ();\n      return false;\n    }\n\n    uint32_t expected_data = uint8_data_p->uint8_size - uint8_data_p->uint8_offset;\n\n    message_size -= (uint32_t) sizeof (jerry_debugger_receive_uint8_data_part_t);\n\n    if (message_size > expected_data)\n    {\n      jmem_heap_free_block (uint8_data_p, uint8_data_p->uint8_size + sizeof (jerry_debugger_uint8_data_t));\n      JERRY_ERROR_MSG (\"Invalid message size\\n\");\n      jerry_debugger_transport_close ();\n      return false;\n    }\n\n    lit_utf8_byte_t *string_p = (lit_utf8_byte_t *) (uint8_data_p + 1);\n    memcpy (string_p + uint8_data_p->uint8_offset, (lit_utf8_byte_t *) (uint8_data_part_p + 1), message_size);\n\n    if (message_size < expected_data)\n    {\n      uint8_data_p->uint8_offset += message_size;\n      return true;\n    }\n\n    bool result;\n\n    if (*expected_message_type_p == JERRY_DEBUGGER_EVAL_PART)\n    {\n      if (jerry_debugger_send_eval (string_p, uint8_data_p->uint8_size))\n      {\n        *resume_exec_p = true;\n      }\n      result = (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) != 0;\n    }\n    else\n    {\n      result = true;\n      JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_CLIENT_SOURCE_MODE);\n      *resume_exec_p = true;\n    }\n\n    *expected_message_type_p = 0;\n    return result;\n  }\n\n  switch (recv_buffer_p[0])\n  {\n    case JERRY_DEBUGGER_FREE_BYTE_CODE_CP:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_byte_code_cp_t);\n\n      JERRY_DEBUGGER_RECEIVE_BUFFER_AS (jerry_debugger_receive_byte_code_cp_t, byte_code_p);\n\n      jmem_cpointer_t byte_code_free_cp;\n      memcpy (&byte_code_free_cp, byte_code_p->byte_code_cp, sizeof (jmem_cpointer_t));\n\n      if (byte_code_free_cp != JERRY_CONTEXT (debugger_byte_code_free_tail))\n      {\n        JERRY_ERROR_MSG (\"Invalid byte code free order\\n\");\n        jerry_debugger_transport_close ();\n        return false;\n      }\n\n      jerry_debugger_byte_code_free_t *byte_code_free_p;\n      byte_code_free_p = JMEM_CP_GET_NON_NULL_POINTER (jerry_debugger_byte_code_free_t, byte_code_free_cp);\n\n      if (byte_code_free_p->prev_cp != ECMA_NULL_POINTER)\n      {\n        JERRY_CONTEXT (debugger_byte_code_free_tail) = byte_code_free_p->prev_cp;\n      }\n      else\n      {\n        JERRY_CONTEXT (debugger_byte_code_free_head) = ECMA_NULL_POINTER;\n        JERRY_CONTEXT (debugger_byte_code_free_tail) = ECMA_NULL_POINTER;\n      }\n\n#if JERRY_MEM_STATS\n      jmem_stats_free_byte_code_bytes (((size_t) byte_code_free_p->size) << JMEM_ALIGNMENT_LOG);\n#endif /* JERRY_MEM_STATS */\n\n      jmem_heap_free_block (byte_code_free_p, ((size_t) byte_code_free_p->size) << JMEM_ALIGNMENT_LOG);\n      return true;\n    }\n\n    case JERRY_DEBUGGER_UPDATE_BREAKPOINT:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_update_breakpoint_t);\n\n      JERRY_DEBUGGER_RECEIVE_BUFFER_AS (jerry_debugger_receive_update_breakpoint_t, update_breakpoint_p);\n\n      jmem_cpointer_t byte_code_cp;\n      memcpy (&byte_code_cp, update_breakpoint_p->byte_code_cp, sizeof (jmem_cpointer_t));\n      uint8_t *byte_code_p = JMEM_CP_GET_NON_NULL_POINTER (uint8_t, byte_code_cp);\n\n      uint32_t offset;\n      memcpy (&offset, update_breakpoint_p->offset, sizeof (uint32_t));\n      byte_code_p += offset;\n\n      JERRY_ASSERT (*byte_code_p == CBC_BREAKPOINT_ENABLED || *byte_code_p == CBC_BREAKPOINT_DISABLED);\n\n      *byte_code_p = update_breakpoint_p->is_set_breakpoint ? CBC_BREAKPOINT_ENABLED : CBC_BREAKPOINT_DISABLED;\n      return true;\n    }\n\n    case JERRY_DEBUGGER_MEMSTATS:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_type_t);\n\n      jerry_debugger_send_memstats ();\n      return true;\n    }\n\n    case JERRY_DEBUGGER_STOP:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_type_t);\n\n      JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_STOP);\n      JERRY_CONTEXT (debugger_stop_context) = NULL;\n      *resume_exec_p = false;\n      return true;\n    }\n\n    case JERRY_DEBUGGER_CONTINUE:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_type_t);\n\n      JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_STOP);\n      JERRY_CONTEXT (debugger_stop_context) = NULL;\n      *resume_exec_p = true;\n      return true;\n    }\n\n    case JERRY_DEBUGGER_STEP:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_type_t);\n\n      JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_STOP);\n      JERRY_CONTEXT (debugger_stop_context) = NULL;\n      *resume_exec_p = true;\n      return true;\n    }\n\n    case JERRY_DEBUGGER_NEXT:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_type_t);\n\n      JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_STOP);\n      JERRY_CONTEXT (debugger_stop_context) = JERRY_CONTEXT (vm_top_context_p);\n      *resume_exec_p = true;\n      return true;\n    }\n\n    case JERRY_DEBUGGER_FINISH:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_type_t);\n\n      JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_STOP);\n\n      /* This will point to the current context's parent (where the function was called)\n       * and in case of NULL the result will the same as in case of STEP. */\n      JERRY_CONTEXT (debugger_stop_context) = JERRY_CONTEXT (vm_top_context_p->prev_context_p);\n      *resume_exec_p = true;\n      return true;\n    }\n\n    case JERRY_DEBUGGER_GET_BACKTRACE:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_get_backtrace_t);\n\n      jerry_debugger_send_backtrace (recv_buffer_p);\n      return true;\n    }\n\n    case JERRY_DEBUGGER_GET_SCOPE_CHAIN:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_type_t);\n\n      jerry_debugger_send_scope_chain ();\n\n      return true;\n    }\n\n    case JERRY_DEBUGGER_GET_SCOPE_VARIABLES:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_get_scope_variables_t);\n\n      jerry_debugger_send_scope_variables (recv_buffer_p);\n\n      return true;\n    }\n\n    case JERRY_DEBUGGER_EXCEPTION_CONFIG:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_exception_config_t);\n      JERRY_DEBUGGER_RECEIVE_BUFFER_AS (jerry_debugger_receive_exception_config_t, exception_config_p);\n\n      if (exception_config_p->enable == 0)\n      {\n        JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_IGNORE_EXCEPTION);\n        JERRY_DEBUG_MSG (\"Stop at exception disabled\\n\");\n      }\n      else\n      {\n        JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_IGNORE_EXCEPTION);\n        JERRY_DEBUG_MSG (\"Stop at exception enabled\\n\");\n      }\n\n      return true;\n    }\n\n    case JERRY_DEBUGGER_PARSER_CONFIG:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_parser_config_t);\n      JERRY_DEBUGGER_RECEIVE_BUFFER_AS (jerry_debugger_receive_parser_config_t, parser_config_p);\n\n      if (parser_config_p->enable_wait != 0)\n      {\n        JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_PARSER_WAIT);\n        JERRY_DEBUG_MSG (\"Waiting after parsing enabled\\n\");\n      }\n      else\n      {\n        JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_PARSER_WAIT);\n        JERRY_DEBUG_MSG (\"Waiting after parsing disabled\\n\");\n      }\n\n      return true;\n    }\n\n    case JERRY_DEBUGGER_PARSER_RESUME:\n    {\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_type_t);\n\n      if (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_PARSER_WAIT_MODE))\n      {\n        JERRY_ERROR_MSG (\"Not in parser wait mode\\n\");\n        jerry_debugger_transport_close ();\n        return false;\n      }\n\n      JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_PARSER_WAIT_MODE);\n      return true;\n    }\n\n    case JERRY_DEBUGGER_EVAL:\n    {\n      if (message_size < sizeof (jerry_debugger_receive_eval_first_t) + 5)\n      {\n        JERRY_ERROR_MSG (\"Invalid message size\\n\");\n        jerry_debugger_transport_close ();\n        return false;\n      }\n\n      JERRY_DEBUGGER_RECEIVE_BUFFER_AS (jerry_debugger_receive_eval_first_t, eval_first_p);\n\n      uint32_t eval_size;\n      memcpy (&eval_size, eval_first_p->eval_size, sizeof (uint32_t));\n\n      if (eval_size <= JERRY_CONTEXT (debugger_max_receive_size) - sizeof (jerry_debugger_receive_eval_first_t))\n      {\n        if (eval_size != message_size - sizeof (jerry_debugger_receive_eval_first_t))\n        {\n          JERRY_ERROR_MSG (\"Invalid message size\\n\");\n          jerry_debugger_transport_close ();\n          return false;\n        }\n\n        if (jerry_debugger_send_eval ((lit_utf8_byte_t *) (eval_first_p + 1), eval_size))\n        {\n          *resume_exec_p = true;\n        }\n\n        return (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) != 0;\n      }\n\n      jerry_debugger_uint8_data_t *eval_uint8_data_p;\n      size_t eval_data_size = sizeof (jerry_debugger_uint8_data_t) + eval_size;\n\n      eval_uint8_data_p = (jerry_debugger_uint8_data_t *) jmem_heap_alloc_block (eval_data_size);\n\n      eval_uint8_data_p->uint8_size = eval_size;\n      eval_uint8_data_p->uint8_offset = (uint32_t) (message_size - sizeof (jerry_debugger_receive_eval_first_t));\n\n      lit_utf8_byte_t *eval_string_p = (lit_utf8_byte_t *) (eval_uint8_data_p + 1);\n      memcpy (eval_string_p,\n              (lit_utf8_byte_t *) (eval_first_p + 1),\n              message_size - sizeof (jerry_debugger_receive_eval_first_t));\n\n      *message_data_p = eval_uint8_data_p;\n      *expected_message_type_p = JERRY_DEBUGGER_EVAL_PART;\n\n      return true;\n    }\n\n    case JERRY_DEBUGGER_CLIENT_SOURCE:\n    {\n      if (message_size <= sizeof (jerry_debugger_receive_client_source_first_t))\n      {\n        JERRY_ERROR_MSG (\"Invalid message size\\n\");\n        jerry_debugger_transport_close ();\n        return false;\n      }\n\n      if (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CLIENT_SOURCE_MODE))\n      {\n        JERRY_ERROR_MSG (\"Not in client source mode\\n\");\n        jerry_debugger_transport_close ();\n        return false;\n      }\n\n      JERRY_DEBUGGER_RECEIVE_BUFFER_AS (jerry_debugger_receive_client_source_first_t, client_source_first_p);\n\n      uint32_t client_source_size;\n      memcpy (&client_source_size, client_source_first_p->code_size, sizeof (uint32_t));\n\n      uint32_t header_size = sizeof (jerry_debugger_receive_client_source_first_t);\n\n      if (client_source_size <= JERRY_CONTEXT (debugger_max_receive_size) - header_size\n          && client_source_size != message_size - header_size)\n      {\n        JERRY_ERROR_MSG (\"Invalid message size\\n\");\n        jerry_debugger_transport_close ();\n        return false;\n      }\n\n      jerry_debugger_uint8_data_t *client_source_data_p;\n      size_t client_source_data_size = sizeof (jerry_debugger_uint8_data_t) + client_source_size;\n\n      client_source_data_p = (jerry_debugger_uint8_data_t *) jmem_heap_alloc_block (client_source_data_size);\n\n      client_source_data_p->uint8_size = client_source_size;\n      client_source_data_p->uint8_offset =\n        (uint32_t) (message_size - sizeof (jerry_debugger_receive_client_source_first_t));\n\n      lit_utf8_byte_t *client_source_string_p = (lit_utf8_byte_t *) (client_source_data_p + 1);\n      memcpy (client_source_string_p,\n              (lit_utf8_byte_t *) (client_source_first_p + 1),\n              message_size - sizeof (jerry_debugger_receive_client_source_first_t));\n\n      *message_data_p = client_source_data_p;\n\n      if (client_source_data_p->uint8_size != client_source_data_p->uint8_offset)\n      {\n        *expected_message_type_p = JERRY_DEBUGGER_CLIENT_SOURCE_PART;\n      }\n      else\n      {\n        JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_CLIENT_SOURCE_MODE);\n        *resume_exec_p = true;\n      }\n      return true;\n    }\n\n    case JERRY_DEBUGGER_NO_MORE_SOURCES:\n    {\n      if (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CLIENT_SOURCE_MODE))\n      {\n        JERRY_ERROR_MSG (\"Not in client source mode\\n\");\n        jerry_debugger_transport_close ();\n        return false;\n      }\n\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_type_t);\n\n      JERRY_DEBUGGER_UPDATE_FLAGS (JERRY_DEBUGGER_CLIENT_NO_SOURCE, JERRY_DEBUGGER_CLIENT_SOURCE_MODE);\n\n      *resume_exec_p = true;\n\n      return true;\n    }\n\n    case JERRY_DEBUGGER_CONTEXT_RESET:\n    {\n      if (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CLIENT_SOURCE_MODE))\n      {\n        JERRY_ERROR_MSG (\"Not in client source mode\\n\");\n        jerry_debugger_transport_close ();\n        return false;\n      }\n\n      JERRY_DEBUGGER_CHECK_PACKET_SIZE (jerry_debugger_receive_type_t);\n\n      JERRY_DEBUGGER_UPDATE_FLAGS (JERRY_DEBUGGER_CONTEXT_RESET_MODE, JERRY_DEBUGGER_CLIENT_SOURCE_MODE);\n\n      *resume_exec_p = true;\n\n      return true;\n    }\n\n    default:\n    {\n      JERRY_ERROR_MSG (\"Unexpected message.\");\n      jerry_debugger_transport_close ();\n      return false;\n    }\n  }\n} /* jerry_debugger_process_message */\n\n/**\n * Receive message from the client.\n *\n * Note:\n *   If the function returns with true, the value of\n *   JERRY_DEBUGGER_VM_STOP flag should be ignored.\n *\n * @return true - if execution should be resumed,\n *         false - otherwise\n */\nbool\njerry_debugger_receive (jerry_debugger_uint8_data_t **message_data_p) /**< [out] data received from client */\n{\n  JERRY_ASSERT (jerry_debugger_transport_is_connected ());\n\n  JERRY_ASSERT (message_data_p != NULL ? !!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_RECEIVE_DATA_MODE)\n                                       : !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_RECEIVE_DATA_MODE));\n\n  JERRY_CONTEXT (debugger_message_delay) = JERRY_DEBUGGER_MESSAGE_FREQUENCY;\n\n  bool resume_exec = false;\n  uint8_t expected_message_type = 0;\n\n  while (true)\n  {\n    jerry_debugger_transport_receive_context_t context;\n    if (!jerry_debugger_transport_receive (&context))\n    {\n      JERRY_ASSERT (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED));\n      return true;\n    }\n\n    if (context.message_p == NULL)\n    {\n      JERRY_CONTEXT (debugger_received_length) = (uint16_t) context.received_length;\n\n      if (expected_message_type != 0)\n      {\n        jerry_debugger_transport_sleep ();\n        continue;\n      }\n\n      return resume_exec;\n    }\n\n    /* Only datagram packets are supported. */\n    JERRY_ASSERT (context.message_total_length > 0);\n\n    /* The jerry_debugger_process_message function is inlined\n     * so passing these arguments is essentially free. */\n    if (!jerry_debugger_process_message (context.message_p,\n                                         (uint32_t) context.message_length,\n                                         &resume_exec,\n                                         &expected_message_type,\n                                         message_data_p))\n    {\n      JERRY_ASSERT (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED));\n      return true;\n    }\n\n    jerry_debugger_transport_receive_completed (&context);\n  }\n} /* jerry_debugger_receive */\n\n#undef JERRY_DEBUGGER_CHECK_PACKET_SIZE\n\n/**\n * Tell the client that a breakpoint has been hit and wait for further debugger commands.\n */\nvoid\njerry_debugger_breakpoint_hit (uint8_t message_type) /**< message type */\n{\n  JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n\n  JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_breakpoint_hit_t, breakpoint_hit_p);\n\n  breakpoint_hit_p->type = message_type;\n\n  vm_frame_ctx_t *frame_ctx_p = JERRY_CONTEXT (vm_top_context_p);\n\n  jmem_cpointer_t byte_code_header_cp;\n  JMEM_CP_SET_NON_NULL_POINTER (byte_code_header_cp, frame_ctx_p->shared_p->bytecode_header_p);\n  memcpy (breakpoint_hit_p->byte_code_cp, &byte_code_header_cp, sizeof (jmem_cpointer_t));\n\n  uint32_t offset = (uint32_t) (frame_ctx_p->byte_code_p - (uint8_t *) frame_ctx_p->shared_p->bytecode_header_p);\n  memcpy (breakpoint_hit_p->offset, &offset, sizeof (uint32_t));\n\n  if (!jerry_debugger_send (sizeof (jerry_debugger_send_breakpoint_hit_t)))\n  {\n    return;\n  }\n\n  JERRY_DEBUGGER_UPDATE_FLAGS (JERRY_DEBUGGER_BREAKPOINT_MODE, JERRY_DEBUGGER_VM_EXCEPTION_THROWN);\n\n  jerry_debugger_uint8_data_t *uint8_data = NULL;\n\n  while (!jerry_debugger_receive (&uint8_data))\n  {\n    jerry_debugger_transport_sleep ();\n  }\n\n  if (uint8_data != NULL)\n  {\n    jmem_heap_free_block (uint8_data, uint8_data->uint8_size + sizeof (jerry_debugger_uint8_data_t));\n  }\n\n  JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_BREAKPOINT_MODE);\n\n  JERRY_CONTEXT (debugger_message_delay) = JERRY_DEBUGGER_MESSAGE_FREQUENCY;\n} /* jerry_debugger_breakpoint_hit */\n\n/**\n * Send the type signal to the client.\n */\nvoid\njerry_debugger_send_type (jerry_debugger_header_type_t type) /**< message type */\n{\n  JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n\n  JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_type_t, message_type_p);\n\n  message_type_p->type = (uint8_t) type;\n\n  jerry_debugger_send (sizeof (jerry_debugger_send_type_t));\n} /* jerry_debugger_send_type */\n\n/**\n * Send the type signal to the client.\n *\n * @return true - if the data sent successfully to the debugger client,\n *         false - otherwise\n */\nbool\njerry_debugger_send_configuration (uint8_t max_message_size) /**< maximum message size */\n{\n  JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_configuration_t, configuration_p);\n\n  /* Helper structure for endianness check. */\n  union\n  {\n    uint16_t uint16_value; /**< a 16-bit value */\n    uint8_t uint8_value[2]; /**< lower and upper byte of a 16-bit value */\n  } endian_data;\n\n  endian_data.uint16_value = 1;\n\n  configuration_p->type = JERRY_DEBUGGER_CONFIGURATION;\n  configuration_p->configuration = 0;\n\n  if (endian_data.uint8_value[0] == 1)\n  {\n    configuration_p->configuration |= (uint8_t) JERRY_DEBUGGER_LITTLE_ENDIAN;\n  }\n\n  uint32_t version = JERRY_DEBUGGER_VERSION;\n  memcpy (configuration_p->version, &version, sizeof (uint32_t));\n\n  configuration_p->max_message_size = max_message_size;\n  configuration_p->cpointer_size = sizeof (jmem_cpointer_t);\n\n  return jerry_debugger_send (sizeof (jerry_debugger_send_configuration_t));\n} /* jerry_debugger_send_configuration */\n\n/**\n * Send raw data to the debugger client.\n */\nvoid\njerry_debugger_send_data (jerry_debugger_header_type_t type, /**< message type */\n                          const void *data, /**< raw data */\n                          size_t size) /**< size of data */\n{\n  JERRY_ASSERT (size <= JERRY_DEBUGGER_SEND_MAX (uint8_t));\n\n  JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_type_t, message_type_p);\n\n  message_type_p->type = (uint8_t) type;\n  memcpy (message_type_p + 1, data, size);\n\n  jerry_debugger_send (sizeof (jerry_debugger_send_type_t) + size);\n} /* jerry_debugger_send_data */\n\n/**\n * Send string to the debugger client.\n *\n * @return true - if the data sent successfully to the debugger client,\n *         false - otherwise\n */\nbool\njerry_debugger_send_string (uint8_t message_type, /**< message type */\n                            uint8_t sub_type, /**< subtype of the string */\n                            const uint8_t *string_p, /**< string data */\n                            size_t string_length) /**< length of string */\n{\n  JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n\n  const size_t max_byte_count = JERRY_DEBUGGER_SEND_MAX (uint8_t);\n  const size_t max_message_size = JERRY_DEBUGGER_SEND_SIZE (max_byte_count, uint8_t);\n\n  JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_string_t, message_string_p);\n\n  message_string_p->type = message_type;\n\n  if (sub_type != JERRY_DEBUGGER_NO_SUBTYPE)\n  {\n    string_length += 1;\n  }\n\n  while (string_length > max_byte_count)\n  {\n    memcpy (message_string_p->string, string_p, max_byte_count);\n\n    if (!jerry_debugger_send (max_message_size))\n    {\n      return false;\n    }\n\n    string_length -= max_byte_count;\n    string_p += max_byte_count;\n  }\n\n  message_string_p->type = (uint8_t) (message_type + 1);\n\n  if (sub_type != JERRY_DEBUGGER_NO_SUBTYPE)\n  {\n    memcpy (message_string_p->string, string_p, string_length - 1);\n    message_string_p->string[string_length - 1] = sub_type;\n  }\n  else\n  {\n    memcpy (message_string_p->string, string_p, string_length);\n  }\n\n  return jerry_debugger_send (sizeof (jerry_debugger_send_type_t) + string_length);\n} /* jerry_debugger_send_string */\n\n/**\n * Send the function compressed pointer to the debugger client.\n *\n * @return true - if the data was sent successfully to the debugger client,\n *         false - otherwise\n */\nbool\njerry_debugger_send_function_cp (jerry_debugger_header_type_t type, /**< message type */\n                                 ecma_compiled_code_t *compiled_code_p) /**< byte code pointer */\n{\n  JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n\n  JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_byte_code_cp_t, byte_code_cp_p);\n\n  byte_code_cp_p->type = (uint8_t) type;\n\n  jmem_cpointer_t compiled_code_cp;\n  JMEM_CP_SET_NON_NULL_POINTER (compiled_code_cp, compiled_code_p);\n  memcpy (byte_code_cp_p->byte_code_cp, &compiled_code_cp, sizeof (jmem_cpointer_t));\n\n  return jerry_debugger_send (sizeof (jerry_debugger_send_byte_code_cp_t));\n} /* jerry_debugger_send_function_cp */\n\n/**\n * Send function data to the debugger client.\n *\n * @return true - if the data sent successfully to the debugger client,\n *         false - otherwise\n */\nbool\njerry_debugger_send_parse_function (uint32_t line, /**< line */\n                                    uint32_t column) /**< column */\n{\n  JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n\n  JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_parse_function_t, message_parse_function_p);\n\n  message_parse_function_p->type = JERRY_DEBUGGER_PARSE_FUNCTION;\n  memcpy (message_parse_function_p->line, &line, sizeof (uint32_t));\n  memcpy (message_parse_function_p->column, &column, sizeof (uint32_t));\n\n  return jerry_debugger_send (sizeof (jerry_debugger_send_parse_function_t));\n} /* jerry_debugger_send_parse_function */\n\n/**\n * Send memory statistics to the debugger client.\n */\nvoid\njerry_debugger_send_memstats (void)\n{\n  JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n\n  JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_memstats_t, memstats_p);\n\n  memstats_p->type = JERRY_DEBUGGER_MEMSTATS_RECEIVE;\n\n#if JERRY_MEM_STATS /* if memory statistics feature is enabled */\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  uint32_t allocated_bytes = (uint32_t) heap_stats->allocated_bytes;\n  memcpy (memstats_p->allocated_bytes, &allocated_bytes, sizeof (uint32_t));\n  uint32_t byte_code_bytes = (uint32_t) heap_stats->byte_code_bytes;\n  memcpy (memstats_p->byte_code_bytes, &byte_code_bytes, sizeof (uint32_t));\n  uint32_t string_bytes = (uint32_t) heap_stats->string_bytes;\n  memcpy (memstats_p->string_bytes, &string_bytes, sizeof (uint32_t));\n  uint32_t object_bytes = (uint32_t) heap_stats->object_bytes;\n  memcpy (memstats_p->object_bytes, &object_bytes, sizeof (uint32_t));\n  uint32_t property_bytes = (uint32_t) heap_stats->property_bytes;\n  memcpy (memstats_p->property_bytes, &property_bytes, sizeof (uint32_t));\n#else /* !JERRY_MEM_STATS if not, just put zeros */\n  memset (memstats_p->allocated_bytes, 0, sizeof (uint32_t));\n  memset (memstats_p->byte_code_bytes, 0, sizeof (uint32_t));\n  memset (memstats_p->string_bytes, 0, sizeof (uint32_t));\n  memset (memstats_p->object_bytes, 0, sizeof (uint32_t));\n  memset (memstats_p->property_bytes, 0, sizeof (uint32_t));\n#endif /* JERRY_MEM_STATS */\n\n  jerry_debugger_send (sizeof (jerry_debugger_send_memstats_t));\n} /* jerry_debugger_send_memstats */\n\n/*\n * Converts an standard error into a string.\n *\n * @return standard error string\n */\nstatic ecma_string_t *\njerry_debugger_exception_object_to_string (ecma_value_t exception_obj_value) /**< exception object */\n{\n  ecma_object_t *object_p = ecma_get_object_from_value (exception_obj_value);\n\n  jmem_cpointer_t prototype_cp = object_p->u2.prototype_cp;\n\n  if (prototype_cp == JMEM_CP_NULL)\n  {\n    return NULL;\n  }\n\n  ecma_object_t *prototype_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, prototype_cp);\n\n  if (ecma_get_object_type (prototype_p) != ECMA_OBJECT_TYPE_BUILT_IN_GENERAL)\n  {\n    return NULL;\n  }\n\n  lit_magic_string_id_t string_id;\n\n  switch (((ecma_extended_object_t *) prototype_p)->u.built_in.id)\n  {\n#if JERRY_BUILTIN_ERRORS\n    case ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE:\n    {\n      string_id = LIT_MAGIC_STRING_EVAL_ERROR_UL;\n      break;\n    }\n    case ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE:\n    {\n      string_id = LIT_MAGIC_STRING_RANGE_ERROR_UL;\n      break;\n    }\n    case ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE:\n    {\n      string_id = LIT_MAGIC_STRING_REFERENCE_ERROR_UL;\n      break;\n    }\n    case ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE:\n    {\n      string_id = LIT_MAGIC_STRING_SYNTAX_ERROR_UL;\n      break;\n    }\n    case ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE:\n    {\n      string_id = LIT_MAGIC_STRING_TYPE_ERROR_UL;\n      break;\n    }\n    case ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE:\n    {\n      string_id = LIT_MAGIC_STRING_AGGREGATE_ERROR_UL;\n      break;\n    }\n    case ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE:\n    {\n      string_id = LIT_MAGIC_STRING_URI_ERROR_UL;\n      break;\n    }\n#endif /* JERRY_BUILTIN_ERRORS */\n    case ECMA_BUILTIN_ID_ERROR_PROTOTYPE:\n    {\n      string_id = LIT_MAGIC_STRING_ERROR_UL;\n      break;\n    }\n    default:\n    {\n      return NULL;\n    }\n  }\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  ecma_stringbuilder_append_magic (&builder, string_id);\n\n  ecma_property_t *property_p;\n  property_p = ecma_find_named_property (ecma_get_object_from_value (exception_obj_value),\n                                         ecma_get_magic_string (LIT_MAGIC_STRING_MESSAGE));\n\n  if (property_p == NULL || !(*property_p & ECMA_PROPERTY_FLAG_DATA))\n  {\n    return ecma_stringbuilder_finalize (&builder);\n  }\n\n  ecma_property_value_t *prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n  if (!ecma_is_value_string (prop_value_p->value))\n  {\n    return ecma_stringbuilder_finalize (&builder);\n  }\n\n  ecma_stringbuilder_append_byte (&builder, LIT_CHAR_COLON);\n  ecma_stringbuilder_append_byte (&builder, LIT_CHAR_SP);\n  ecma_stringbuilder_append (&builder, ecma_get_string_from_value (prop_value_p->value));\n\n  return ecma_stringbuilder_finalize (&builder);\n} /* jerry_debugger_exception_object_to_string */\n\n/**\n * Send string representation of exception to the client.\n *\n * @return true - if the data sent successfully to the debugger client,\n *         false - otherwise\n */\nbool\njerry_debugger_send_exception_string (ecma_value_t exception_value)\n{\n  JERRY_ASSERT (jcontext_has_pending_exception ());\n  ecma_string_t *string_p = NULL;\n\n  if (ecma_is_value_object (exception_value))\n  {\n    string_p = jerry_debugger_exception_object_to_string (exception_value);\n\n    if (string_p == NULL)\n    {\n      string_p = ecma_get_string_from_value (ecma_builtin_helper_object_to_string (exception_value));\n    }\n  }\n  else if (ecma_is_value_string (exception_value))\n  {\n    string_p = ecma_get_string_from_value (exception_value);\n    ecma_ref_ecma_string (string_p);\n  }\n  else\n  {\n    string_p = ecma_op_to_string (exception_value);\n  }\n\n  ECMA_STRING_TO_UTF8_STRING (string_p, string_data_p, string_size);\n\n  bool result =\n    jerry_debugger_send_string (JERRY_DEBUGGER_EXCEPTION_STR, JERRY_DEBUGGER_NO_SUBTYPE, string_data_p, string_size);\n\n  ECMA_FINALIZE_UTF8_STRING (string_data_p, string_size);\n\n  ecma_deref_ecma_string (string_p);\n  return result;\n} /* jerry_debugger_send_exception_string */\n\n#endif /* JERRY_DEBUGGER */\n"
  },
  {
    "path": "jerry-core/debugger/debugger.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef DEBUGGER_H\n#define DEBUGGER_H\n\n#include \"jerryscript-debugger-transport.h\"\n\n#include \"ecma-globals.h\"\n\n#if JERRY_DEBUGGER\n\n/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */\n\n/**\n * Frequency of calling jerry_debugger_receive() by the VM.\n */\n#define JERRY_DEBUGGER_MESSAGE_FREQUENCY 5\n\n/**\n * This constant represents that the string to be sent has no subtype.\n */\n#define JERRY_DEBUGGER_NO_SUBTYPE 0\n\n/**\n * Limited resources available for the engine, so it is important to\n * check the maximum buffer size. It needs to be between 64 and 256 bytes.\n */\n#if JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE < 64 || JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE > 256\n#error Please define the MAX_BUFFER_SIZE between 64 and 256 bytes.\n#endif /* JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE < 64 || JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE > 256 */\n\n/**\n * Calculate the maximum number of items for a given type\n * which can be transmitted in one message.\n */\n#define JERRY_DEBUGGER_SEND_MAX(type) \\\n  ((size_t) ((JERRY_CONTEXT (debugger_max_send_size) - sizeof (jerry_debugger_send_type_t)) / sizeof (type)))\n\n/**\n * Calculate the size of a message when a count number of items transmitted.\n */\n#define JERRY_DEBUGGER_SEND_SIZE(count, type) ((size_t) ((count * sizeof (type)) + sizeof (jerry_debugger_send_type_t)))\n\n/**\n * Debugger operation modes:\n *\n * The debugger has two operation modes: run mode and breakpoint mode.\n *\n * In run mode the debugger server accepts only a limited number of message\n * types from the debugger client (e.g. stop execution, set breakpoint).\n *\n * In breakpoint mode the JavaScript execution is stopped at a breakpoint and\n * more message types are accepted (e.g. get backtrace, evaluate expression).\n *\n * Switching between modes:\n *\n * When the JavaScript execution stops at a breakpoint the server sends a\n * JERRY_DEBUGGER_BREAKPOINT_HIT message to the client. The client can only\n * issue breakpoint mode commands after this message is received.\n *\n * Certain breakpoint mode commands (e.g. continue) resumes the JavaScript\n * execution and the client must not send any breakpoint mode messages\n * until the JERRY_DEBUGGER_BREAKPOINT_HIT is received again.\n *\n * The debugger server starts in run mode but stops at the first available\n * breakpoint.\n */\n\n/**\n * Debugger option flags.\n */\ntypedef enum\n{\n  JERRY_DEBUGGER_CONNECTED = 1u << 0, /**< debugger is connected */\n  JERRY_DEBUGGER_BREAKPOINT_MODE = 1u << 1, /**< debugger waiting at a breakpoint */\n  JERRY_DEBUGGER_VM_STOP = 1u << 2, /**< stop at the next breakpoint even if disabled */\n  JERRY_DEBUGGER_VM_IGNORE = 1u << 3, /**< ignore all breakpoints */\n  JERRY_DEBUGGER_VM_IGNORE_EXCEPTION = 1u << 4, /**< debugger doesn't stop at any exception */\n  JERRY_DEBUGGER_VM_EXCEPTION_THROWN = 1u << 5, /**< no need to stop for this exception */\n  JERRY_DEBUGGER_PARSER_WAIT = 1u << 6, /**< debugger should wait after parsing is completed */\n  JERRY_DEBUGGER_PARSER_WAIT_MODE = 1u << 7, /**< debugger is waiting after parsing is completed */\n  JERRY_DEBUGGER_CLIENT_SOURCE_MODE = 1u << 8, /**< debugger waiting for client code */\n  JERRY_DEBUGGER_CLIENT_NO_SOURCE = 1u << 9, /**< debugger leaving the client source loop */\n  JERRY_DEBUGGER_CONTEXT_RESET_MODE = 1u << 10, /**< debugger and engine reinitialization mode */\n} jerry_debugger_flags_t;\n\n/**\n * Set debugger flags.\n */\n#define JERRY_DEBUGGER_SET_FLAGS(flags) \\\n  JERRY_CONTEXT (debugger_flags) = (JERRY_CONTEXT (debugger_flags) | (uint32_t) (flags))\n\n/**\n * Clear debugger flags.\n */\n#define JERRY_DEBUGGER_CLEAR_FLAGS(flags) \\\n  JERRY_CONTEXT (debugger_flags) = (JERRY_CONTEXT (debugger_flags) & (uint32_t) ~(flags))\n\n/**\n * Set and clear debugger flags.\n */\n#define JERRY_DEBUGGER_UPDATE_FLAGS(flags_to_set, flags_to_clear) \\\n  JERRY_CONTEXT (debugger_flags) =                                \\\n    ((JERRY_CONTEXT (debugger_flags) | (uint32_t) (flags_to_set)) & (uint32_t) ~(flags_to_clear))\n\n/**\n * Types for the package.\n */\ntypedef enum\n{\n  /* Messages sent by the server to client. */\n  /* This is a handshake message, sent once during initialization. */\n  JERRY_DEBUGGER_CONFIGURATION = 1, /**< debugger configuration */\n  /* These messages are sent by the parser. */\n  JERRY_DEBUGGER_PARSE_ERROR = 2, /**< parse error */\n  JERRY_DEBUGGER_BYTE_CODE_CP = 3, /**< byte code compressed pointer */\n  JERRY_DEBUGGER_PARSE_FUNCTION = 4, /**< parsing a new function */\n  JERRY_DEBUGGER_BREAKPOINT_LIST = 5, /**< list of line offsets */\n  JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST = 6, /**< list of byte code offsets */\n  JERRY_DEBUGGER_SOURCE_CODE = 7, /**< source code fragment */\n  JERRY_DEBUGGER_SOURCE_CODE_END = 8, /**< source code last fragment */\n  JERRY_DEBUGGER_SOURCE_CODE_NAME = 9, /**< source code name fragment */\n  JERRY_DEBUGGER_SOURCE_CODE_NAME_END = 10, /**< source code name last fragment */\n  JERRY_DEBUGGER_FUNCTION_NAME = 11, /**< function name fragment */\n  JERRY_DEBUGGER_FUNCTION_NAME_END = 12, /**< function name last fragment */\n  JERRY_DEBUGGER_WAITING_AFTER_PARSE = 13, /**< engine waiting for a parser resume */\n  /* These messages are generic messages. */\n  JERRY_DEBUGGER_RELEASE_BYTE_CODE_CP = 14, /**< invalidate byte code compressed pointer */\n  JERRY_DEBUGGER_MEMSTATS_RECEIVE = 15, /**< memstats sent to the client */\n  JERRY_DEBUGGER_BREAKPOINT_HIT = 16, /**< notify breakpoint hit */\n  JERRY_DEBUGGER_EXCEPTION_HIT = 17, /**< notify exception hit */\n  JERRY_DEBUGGER_EXCEPTION_STR = 18, /**< exception string fragment */\n  JERRY_DEBUGGER_EXCEPTION_STR_END = 19, /**< exception string last fragment */\n  JERRY_DEBUGGER_BACKTRACE_TOTAL = 20, /**< number of total frames */\n  JERRY_DEBUGGER_BACKTRACE = 21, /**< backtrace data */\n  JERRY_DEBUGGER_BACKTRACE_END = 22, /**< last backtrace data */\n  JERRY_DEBUGGER_EVAL_RESULT = 23, /**< eval result */\n  JERRY_DEBUGGER_EVAL_RESULT_END = 24, /**< last part of eval result */\n  JERRY_DEBUGGER_WAIT_FOR_SOURCE = 25, /**< engine waiting for source code */\n  JERRY_DEBUGGER_OUTPUT_RESULT = 26, /**< output sent by the program to the debugger */\n  JERRY_DEBUGGER_OUTPUT_RESULT_END = 27, /**< last output result data */\n  JERRY_DEBUGGER_SCOPE_CHAIN = 28, /**< scope chain */\n  JERRY_DEBUGGER_SCOPE_CHAIN_END = 29, /**< last output of scope chain */\n  JERRY_DEBUGGER_SCOPE_VARIABLES = 30, /**< scope variables */\n  JERRY_DEBUGGER_SCOPE_VARIABLES_END = 31, /**< last output of scope variables */\n  JERRY_DEBUGGER_CLOSE_CONNECTION = 32, /**< close connection with the client */\n  JERRY_DEBUGGER_MESSAGES_OUT_MAX_COUNT, /**< number of different type of output messages by the debugger */\n\n  /* Messages sent by the client to server. */\n\n  /* The following messages are accepted in both run and breakpoint modes. */\n  JERRY_DEBUGGER_FREE_BYTE_CODE_CP = 1, /**< free byte code compressed pointer */\n  JERRY_DEBUGGER_UPDATE_BREAKPOINT = 2, /**< update breakpoint status */\n  JERRY_DEBUGGER_EXCEPTION_CONFIG = 3, /**< exception handler config */\n  JERRY_DEBUGGER_PARSER_CONFIG = 4, /**< parser config */\n  JERRY_DEBUGGER_MEMSTATS = 5, /**< list memory statistics */\n  JERRY_DEBUGGER_STOP = 6, /**< stop execution */\n  /* The following message is only available in waiting after parse mode. */\n  JERRY_DEBUGGER_PARSER_RESUME = 7, /**< stop waiting after parse */\n  /* The following four messages are only available in client switch mode. */\n  JERRY_DEBUGGER_CLIENT_SOURCE = 8, /**< first message of client source */\n  JERRY_DEBUGGER_CLIENT_SOURCE_PART = 9, /**< next message of client source */\n  JERRY_DEBUGGER_NO_MORE_SOURCES = 10, /**< no more sources notification */\n  JERRY_DEBUGGER_CONTEXT_RESET = 11, /**< context reset request */\n  /* The following messages are only available in breakpoint\n   * mode and they switch the engine to run mode. */\n  JERRY_DEBUGGER_CONTINUE = 12, /**< continue execution */\n  JERRY_DEBUGGER_STEP = 13, /**< next breakpoint, step into functions */\n  JERRY_DEBUGGER_NEXT = 14, /**< next breakpoint in the same context */\n  JERRY_DEBUGGER_FINISH = 15, /**< Continue running just after the function in the current stack frame returns */\n  /* The following messages are only available in breakpoint\n   * mode and this mode is kept after the message is processed. */\n  JERRY_DEBUGGER_GET_BACKTRACE = 16, /**< get backtrace */\n  JERRY_DEBUGGER_EVAL = 17, /**< first message of evaluating a string */\n  JERRY_DEBUGGER_EVAL_PART = 18, /**< next message of evaluating a string */\n  JERRY_DEBUGGER_GET_SCOPE_CHAIN = 19, /**< get type names of the scope chain */\n  JERRY_DEBUGGER_GET_SCOPE_VARIABLES = 20, /**< get variables of a scope */\n  JERRY_DEBUGGER_MESSAGES_IN_MAX_COUNT, /**< number of different type of input messages */\n} jerry_debugger_header_type_t;\n\n/**\n * Debugger option flags.\n */\ntypedef enum\n{\n  JERRY_DEBUGGER_LITTLE_ENDIAN = 1u << 0, /**< little endian */\n} jerry_debugger_configuration_flags_t;\n\n/**\n * Subtypes of eval.\n */\ntypedef enum\n{\n  JERRY_DEBUGGER_EVAL_EVAL = 0, /**< evaluate expression */\n  JERRY_DEBUGGER_EVAL_THROW = 1, /**< evaluate expression and throw the result */\n  JERRY_DEBUGGER_EVAL_ABORT = 2, /**< evaluate expression and abrot with the result */\n} jerry_debugger_eval_type_t;\n\n/**\n * Subtypes of eval_result.\n */\ntypedef enum\n{\n  JERRY_DEBUGGER_EVAL_OK = 1, /**< eval result, no error */\n  JERRY_DEBUGGER_EVAL_ERROR = 2, /**< eval result when an error has occurred */\n} jerry_debugger_eval_result_type_t;\n\n/**\n * Subtypes of output_result.\n *\n * Note:\n *      This enum has to be kept in sync with jerry_log_level_t with an offset\n *      of +2.\n */\ntypedef enum\n{\n  JERRY_DEBUGGER_OUTPUT_PRINT = 1, /**< printed output */\n  JERRY_DEBUGGER_OUTPUT_LOG = 2, /**< logged output */\n} jerry_debugger_output_subtype_t;\n\n/**\n * Types of scopes.\n */\ntypedef enum\n{\n  JERRY_DEBUGGER_SCOPE_WITH = 1, /**< with */\n  JERRY_DEBUGGER_SCOPE_LOCAL = 2, /**< local */\n  JERRY_DEBUGGER_SCOPE_CLOSURE = 3, /**< closure */\n  JERRY_DEBUGGER_SCOPE_GLOBAL = 4, /**< global */\n  JERRY_DEBUGGER_SCOPE_NON_CLOSURE = 5 /**< non closure */\n} jerry_debugger_scope_chain_type_t;\n\n/**\n * Type of scope variables.\n */\ntypedef enum\n{\n  JERRY_DEBUGGER_VALUE_NONE = 1,\n  JERRY_DEBUGGER_VALUE_UNDEFINED = 2,\n  JERRY_DEBUGGER_VALUE_NULL = 3,\n  JERRY_DEBUGGER_VALUE_BOOLEAN = 4,\n  JERRY_DEBUGGER_VALUE_NUMBER = 5,\n  JERRY_DEBUGGER_VALUE_STRING = 6,\n  JERRY_DEBUGGER_VALUE_FUNCTION = 7,\n  JERRY_DEBUGGER_VALUE_ARRAY = 8,\n  JERRY_DEBUGGER_VALUE_OBJECT = 9\n} jerry_debugger_scope_variable_type_t;\n\n/**\n * Byte data for evaluating expressions and receiving client source.\n */\ntypedef struct\n{\n  uint32_t uint8_size; /**< total size of the client source */\n  uint32_t uint8_offset; /**< current offset in the client source */\n} jerry_debugger_uint8_data_t;\n\n/**\n * Delayed free of byte code data.\n */\ntypedef struct\n{\n  uint16_t size; /**< size of the byte code header divided by JMEM_ALIGNMENT */\n  jmem_cpointer_t prev_cp; /**< previous byte code data to be freed */\n} jerry_debugger_byte_code_free_t;\n\n/**\n * Outgoing message: JerryScript configuration.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t configuration; /**< configuration option bits */\n  uint8_t version[sizeof (uint32_t)]; /**< debugger version */\n  uint8_t max_message_size; /**< maximum incoming message size */\n  uint8_t cpointer_size; /**< size of compressed pointers */\n} jerry_debugger_send_configuration_t;\n\n/**\n * Outgoing message: message without arguments.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n} jerry_debugger_send_type_t;\n\n/**\n * Incoming message: message without arguments.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n} jerry_debugger_receive_type_t;\n\n/**\n * Outgoing message: string (Source file name or function name).\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t string[]; /**< string data */\n} jerry_debugger_send_string_t;\n\n/**\n * Outgoing message: uint32 value.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t line[sizeof (uint32_t)]; /**< value data */\n  uint8_t column[sizeof (uint32_t)]; /**< value data */\n} jerry_debugger_send_parse_function_t;\n\n/**\n * Outgoing message: byte code compressed pointer.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */\n} jerry_debugger_send_byte_code_cp_t;\n\n/**\n * Incoming message: byte code compressed pointer.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */\n} jerry_debugger_receive_byte_code_cp_t;\n\n/**\n * Incoming message: update (enable/disable) breakpoint status.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t is_set_breakpoint; /**< set or clear breakpoint */\n  uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */\n  uint8_t offset[sizeof (uint32_t)]; /**< breakpoint offset */\n} jerry_debugger_receive_update_breakpoint_t;\n\n/**\n * Outgoing message: send memory statistics\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t allocated_bytes[sizeof (uint32_t)]; /**< allocated bytes */\n  uint8_t byte_code_bytes[sizeof (uint32_t)]; /**< byte code bytes */\n  uint8_t string_bytes[sizeof (uint32_t)]; /**< string bytes */\n  uint8_t object_bytes[sizeof (uint32_t)]; /**< object bytes */\n  uint8_t property_bytes[sizeof (uint32_t)]; /**< property bytes */\n} jerry_debugger_send_memstats_t;\n\n/**\n * Outgoing message: notify breakpoint hit.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */\n  uint8_t offset[sizeof (uint32_t)]; /**< breakpoint offset */\n} jerry_debugger_send_breakpoint_hit_t;\n\n/**\n * Stack frame descriptor for sending backtrace information.\n */\ntypedef struct\n{\n  uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */\n  uint8_t offset[sizeof (uint32_t)]; /**< last breakpoint offset */\n} jerry_debugger_frame_t;\n\n/**\n * Outgoing message: backtrace information.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  jerry_debugger_frame_t frames[]; /**< frames */\n} jerry_debugger_send_backtrace_t;\n\n/**\n * Outgoing message: scope chain.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t scope_types[]; /**< scope types */\n} jerry_debugger_send_scope_chain_t;\n\n/**\n * Outgoing message: number of total frames in backtrace.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t frame_count[sizeof (uint32_t)]; /**< total number of frames */\n} jerry_debugger_send_backtrace_total_t;\n\n/**\n * Incoming message: set behaviour when exception occures.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t enable; /**< non-zero: enable stop at exception */\n} jerry_debugger_receive_exception_config_t;\n\n/**\n * Incoming message: set parser configuration.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t enable_wait; /**< non-zero: wait after parsing is completed */\n} jerry_debugger_receive_parser_config_t;\n\n/**\n * Incoming message: get backtrace.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t min_depth[sizeof (uint32_t)]; /**< minimum depth*/\n  uint8_t max_depth[sizeof (uint32_t)]; /**< maximum depth (0 - unlimited) */\n  uint8_t get_total_frame_count; /**< non-zero: if total frame count is also requested */\n} jerry_debugger_receive_get_backtrace_t;\n\n/**\n * Incoming message: first message of evaluating expression.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t eval_size[sizeof (uint32_t)]; /**< total size of the message */\n} jerry_debugger_receive_eval_first_t;\n\n/**\n * Incoming message: get scope variables\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t chain_index[sizeof (uint32_t)]; /**< index element of the scope */\n} jerry_debugger_receive_get_scope_variables_t;\n\n/**\n * Incoming message: first message of client source.\n */\ntypedef struct\n{\n  uint8_t type; /**< type of the message */\n  uint8_t code_size[sizeof (uint32_t)]; /**< total size of the message */\n} jerry_debugger_receive_client_source_first_t;\n\nvoid jerry_debugger_free_unreferenced_byte_code (void);\n\nbool jerry_debugger_receive (jerry_debugger_uint8_data_t **message_data_p);\n\nvoid jerry_debugger_breakpoint_hit (uint8_t message_type);\n\nvoid jerry_debugger_send_type (jerry_debugger_header_type_t type);\nbool jerry_debugger_send_configuration (uint8_t max_message_size);\nvoid jerry_debugger_send_data (jerry_debugger_header_type_t type, const void *data, size_t size);\nbool jerry_debugger_send_string (uint8_t message_type, uint8_t sub_type, const uint8_t *string_p, size_t string_length);\nbool jerry_debugger_send_function_cp (jerry_debugger_header_type_t type, ecma_compiled_code_t *compiled_code_p);\nbool jerry_debugger_send_parse_function (uint32_t line, uint32_t column);\nvoid jerry_debugger_send_memstats (void);\nbool jerry_debugger_send_exception_string (ecma_value_t exception_value);\n\n#endif /* JERRY_DEBUGGER */\n\n#endif /* !DEBUGGER_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-alloc.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n\n#include \"jmem.h\"\n#include \"jrt.h\"\n\nJERRY_STATIC_ASSERT (sizeof (ecma_property_value_t) == sizeof (ecma_value_t),\n                     size_of_ecma_property_value_t_must_be_equal_to_size_of_ecma_value_t);\nJERRY_STATIC_ASSERT (((sizeof (ecma_property_value_t) - 1) & sizeof (ecma_property_value_t)) == 0,\n                     size_of_ecma_property_value_t_must_be_power_of_2);\n\nJERRY_STATIC_ASSERT (sizeof (ecma_extended_object_t) - sizeof (ecma_object_t) <= sizeof (uint64_t),\n                     size_of_ecma_extended_object_part_must_be_less_than_or_equal_to_8_bytes);\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaalloc Routines for allocation/freeing memory for ECMA data types\n * @{\n */\n\n/**\n * Implementation of routines for allocation/freeing memory for ECMA data types.\n *\n * All allocation routines from this module have the same structure:\n *  1. Try to allocate memory.\n *  2. If allocation was successful, return pointer to the allocated block.\n *  3. Run garbage collection.\n *  4. Try to allocate memory.\n *  5. If allocation was successful, return pointer to the allocated block;\n *     else - shutdown engine.\n */\n\n/**\n * Allocate memory for ecma-number\n *\n * @return pointer to allocated memory\n */\nextern inline ecma_number_t *JERRY_ATTR_ALWAYS_INLINE\necma_alloc_number (void)\n{\n  return (ecma_number_t *) jmem_pools_alloc (sizeof (ecma_number_t));\n} /* ecma_alloc_number */\n\n/**\n * Dealloc memory from an ecma-number\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_dealloc_number (ecma_number_t *number_p) /**< number to be freed */\n{\n  jmem_pools_free ((uint8_t *) number_p, sizeof (ecma_number_t));\n} /* ecma_dealloc_number */\n\n/**\n * Allocate memory for ecma-object\n *\n * @return pointer to allocated memory\n */\nextern inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE\necma_alloc_object (void)\n{\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_object_bytes (sizeof (ecma_object_t));\n#endif /* JERRY_MEM_STATS */\n\n  return (ecma_object_t *) jmem_pools_alloc (sizeof (ecma_object_t));\n} /* ecma_alloc_object */\n\n/**\n * Dealloc memory from an ecma-object\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */\n{\n#if JERRY_MEM_STATS\n  jmem_stats_free_object_bytes (sizeof (ecma_object_t));\n#endif /* JERRY_MEM_STATS */\n\n  jmem_pools_free (object_p, sizeof (ecma_object_t));\n} /* ecma_dealloc_object */\n\n/**\n * Allocate memory for extended object\n *\n * @return pointer to allocated memory\n */\nextern inline ecma_extended_object_t *JERRY_ATTR_ALWAYS_INLINE\necma_alloc_extended_object (size_t size) /**< size of object */\n{\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_object_bytes (size);\n#endif /* JERRY_MEM_STATS */\n\n  return jmem_heap_alloc_block (size);\n} /* ecma_alloc_extended_object */\n\n/**\n * Dealloc memory of an extended object\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */\n                              size_t size) /**< size of object */\n{\n#if JERRY_MEM_STATS\n  jmem_stats_free_object_bytes (size);\n#endif /* JERRY_MEM_STATS */\n\n  jmem_heap_free_block (object_p, size);\n} /* ecma_dealloc_extended_object */\n\n/**\n * Allocate memory for ecma-string descriptor\n *\n * @return pointer to allocated memory\n */\nextern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE\necma_alloc_string (void)\n{\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_string_bytes (sizeof (ecma_string_t));\n#endif /* JERRY_MEM_STATS */\n\n  return (ecma_string_t *) jmem_pools_alloc (sizeof (ecma_string_t));\n} /* ecma_alloc_string */\n\n/**\n * Dealloc memory from ecma-string descriptor\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */\n{\n#if JERRY_MEM_STATS\n  jmem_stats_free_string_bytes (sizeof (ecma_string_t));\n#endif /* JERRY_MEM_STATS */\n\n  jmem_pools_free (string_p, sizeof (ecma_string_t));\n} /* ecma_dealloc_string */\n\n/**\n * Allocate memory for extended ecma-string descriptor\n *\n * @return pointer to allocated memory\n */\nextern inline ecma_extended_string_t *JERRY_ATTR_ALWAYS_INLINE\necma_alloc_extended_string (void)\n{\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_string_bytes (sizeof (ecma_extended_string_t));\n#endif /* JERRY_MEM_STATS */\n\n  return (ecma_extended_string_t *) jmem_heap_alloc_block (sizeof (ecma_extended_string_t));\n} /* ecma_alloc_extended_string */\n\n/**\n * Dealloc memory from extended ecma-string descriptor\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_dealloc_extended_string (ecma_extended_string_t *ext_string_p) /**< extended string to be freed */\n{\n#if JERRY_MEM_STATS\n  jmem_stats_free_string_bytes (sizeof (ecma_extended_string_t));\n#endif /* JERRY_MEM_STATS */\n\n  jmem_heap_free_block (ext_string_p, sizeof (ecma_extended_string_t));\n} /* ecma_dealloc_extended_string */\n\n/**\n * Allocate memory for external ecma-string descriptor\n *\n * @return pointer to allocated memory\n */\nextern inline ecma_external_string_t *JERRY_ATTR_ALWAYS_INLINE\necma_alloc_external_string (void)\n{\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_string_bytes (sizeof (ecma_external_string_t));\n#endif /* JERRY_MEM_STATS */\n\n  return (ecma_external_string_t *) jmem_heap_alloc_block (sizeof (ecma_external_string_t));\n} /* ecma_alloc_external_string */\n\n/**\n * Dealloc memory from external ecma-string descriptor\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_dealloc_external_string (ecma_external_string_t *ext_string_p) /**< external string to be freed */\n{\n#if JERRY_MEM_STATS\n  jmem_stats_free_string_bytes (sizeof (ecma_external_string_t));\n#endif /* JERRY_MEM_STATS */\n\n  jmem_heap_free_block (ext_string_p, sizeof (ecma_external_string_t));\n} /* ecma_dealloc_external_string */\n\n/**\n * Allocate memory for an string with character data\n *\n * @return pointer to allocated memory\n */\nextern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE\necma_alloc_string_buffer (size_t size) /**< size of string */\n{\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_string_bytes (size);\n#endif /* JERRY_MEM_STATS */\n\n  return jmem_heap_alloc_block (size);\n} /* ecma_alloc_string_buffer */\n\n/**\n * Dealloc memory of a string with character data\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */\n                            size_t size) /**< size of string */\n{\n#if JERRY_MEM_STATS\n  jmem_stats_free_string_bytes (size);\n#endif /* JERRY_MEM_STATS */\n\n  jmem_heap_free_block (string_p, size);\n} /* ecma_dealloc_string_buffer */\n\n/**\n * Allocate memory for ecma-property pair\n *\n * @return pointer to allocated memory\n */\nextern inline ecma_property_pair_t *JERRY_ATTR_ALWAYS_INLINE\necma_alloc_property_pair (void)\n{\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_property_bytes (sizeof (ecma_property_pair_t));\n#endif /* JERRY_MEM_STATS */\n\n  return jmem_heap_alloc_block (sizeof (ecma_property_pair_t));\n} /* ecma_alloc_property_pair */\n\n/**\n * Dealloc memory of an ecma-property\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_dealloc_property_pair (ecma_property_pair_t *property_pair_p) /**< property pair to be freed */\n{\n#if JERRY_MEM_STATS\n  jmem_stats_free_property_bytes (sizeof (ecma_property_pair_t));\n#endif /* JERRY_MEM_STATS */\n\n  jmem_heap_free_block (property_pair_p, sizeof (ecma_property_pair_t));\n} /* ecma_dealloc_property_pair */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-alloc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_ALLOC_H\n#define ECMA_ALLOC_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaalloc Routines for allocation/freeing memory for ECMA data types\n * @{\n */\n\n/**\n * Allocate memory for ecma-object\n *\n * @return pointer to allocated memory\n */\necma_object_t *ecma_alloc_object (void);\n\n/**\n * Dealloc memory from an ecma-object\n */\nvoid ecma_dealloc_object (ecma_object_t *object_p);\n\n/**\n * Allocate memory for extended object\n *\n * @return pointer to allocated memory\n */\necma_extended_object_t *ecma_alloc_extended_object (size_t size);\n\n/**\n * Dealloc memory of an extended object\n */\nvoid ecma_dealloc_extended_object (ecma_object_t *object_p, size_t size);\n\n/**\n * Allocate memory for ecma-number\n *\n * @return pointer to allocated memory\n */\necma_number_t *ecma_alloc_number (void);\n\n/**\n * Dealloc memory from an ecma-number\n */\nvoid ecma_dealloc_number (ecma_number_t *number_p);\n\n/**\n * Allocate memory for ecma-string descriptor\n *\n * @return pointer to allocated memory\n */\necma_string_t *ecma_alloc_string (void);\n\n/**\n * Dealloc memory from ecma-string descriptor\n */\nvoid ecma_dealloc_string (ecma_string_t *string_p);\n\n/**\n * Allocate memory for extended ecma-string descriptor\n *\n * @return pointer to allocated memory\n */\necma_extended_string_t *ecma_alloc_extended_string (void);\n\n/**\n * Dealloc memory from extended ecma-string descriptor\n */\nvoid ecma_dealloc_extended_string (ecma_extended_string_t *string_p);\n\n/**\n * Allocate memory for external ecma-string descriptor\n *\n * @return pointer to allocated memory\n */\necma_external_string_t *ecma_alloc_external_string (void);\n\n/**\n * Dealloc memory from external ecma-string descriptor\n */\nvoid ecma_dealloc_external_string (ecma_external_string_t *string_p);\n\n/**\n * Allocate memory for string with character data\n *\n * @return pointer to allocated memory\n */\necma_string_t *ecma_alloc_string_buffer (size_t size);\n\n/**\n * Dealloc memory of a string with character data\n */\nvoid ecma_dealloc_string_buffer (ecma_string_t *string_p, size_t size);\n\n/**\n * Allocate memory for ecma-property pair\n *\n * @return pointer to allocated memory\n */\necma_property_pair_t *ecma_alloc_property_pair (void);\n\n/**\n * Dealloc memory from an ecma-property pair\n */\nvoid ecma_dealloc_property_pair (ecma_property_pair_t *property_pair_p);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_ALLOC_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-error-messages.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file is automatically generated by the gen-strings.py script\n * from ecma-error-messages.ini. Do not edit! */\n\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_INVALID_GROUP, \"Invalid group\")\nECMA_ERROR_DEF (ECMA_ERR_INVALID_ESCAPE, \"Invalid escape\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_ATOMICS || JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_INVALID_LENGTH, \"Invalid length\")\n#endif /* JERRY_BUILTIN_ATOMICS \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_INVALID_OFFSET, \"Invalid offset\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nECMA_ERROR_DEF (ECMA_ERR_OBJECT_EXPECTED, \"Object expected\")\n#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_INVALID_ARGUMENT, \"Invalid argument\")\n#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_REGEXP */\nECMA_ERROR_DEF (ECMA_ERR_INVALID_ENCODING, \"Invalid encoding\")\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_NOTHING_TO_REPEAT, \"Nothing to repeat\")\n#endif /* JERRY_BUILTIN_REGEXP */\nECMA_ERROR_DEF (ECMA_ERR_EXPECTED_AN_OBJECT, \"Expected an object\")\nECMA_ERROR_DEF (ECMA_ERR_INVALID_CAPABILITY, \"Invalid capability\")\n#if JERRY_BUILTIN_STRING\nECMA_ERROR_DEF (ECMA_ERR_INVALID_CODE_POINT, \"Invalid code point\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_INVALID_QUANTIFIER, \"Invalid quantifier\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_NO_SOURCE_ARGUMENT, \"No source argument\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_UNTERMINATED_GROUP, \"Unterminated group\")\n#endif /* JERRY_BUILTIN_REGEXP */\nECMA_ERROR_DEF (ECMA_ERR_EXPECTED_A_FUNCTION, \"Expected a function\")\n#if JERRY_BUILTIN_JSON\nECMA_ERROR_DEF (ECMA_ERR_INVALID_JSON_FORMAT, \"Invalid JSON format\")\n#endif /* JERRY_BUILTIN_JSON */\nECMA_ERROR_DEF (ECMA_ERR_INVALID_UTF8_STRING, \"Invalid UTF8 string\")\n#if JERRY_BUILTIN_STRING\nECMA_ERROR_DEF (ECMA_ERR_INVALID_COUNT_VALUE, \"Invalid count value\")\n#endif /* JERRY_BUILTIN_STRING */\n#if !(JERRY_BUILTIN_REALMS)\nECMA_ERROR_DEF (ECMA_ERR_REALMS_ARE_DISABLED, \"Realms are disabled\")\n#endif /* !(JERRY_BUILTIN_REALMS) */\nECMA_ERROR_DEF (ECMA_ERR_UNDEFINED_REFERENCE, \"Undefined reference\")\nECMA_ERROR_DEF (ECMA_ERR_INVALID_ARRAY_LENGTH, \"Invalid Array length\")\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_INVALID_REGEXP_FLAGS, \"Invalid RegExp flags\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_JSON\nECMA_ERROR_DEF (ECMA_ERR_JSON_STRINGIFY_ERROR, \"JSON stringify error\")\n#endif /* JERRY_BUILTIN_JSON */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_STACK_LIMIT_EXCEEDED, \"Stack limit exceeded\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_WEAKREF\nECMA_ERROR_DEF (ECMA_ERR_TARGET_IS_NOT_OBJECT, \"Target is not Object\")\n#endif /* JERRY_BUILTIN_WEAKREF */\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_BIGINT_VALUE_EXCPECTED, \"BigInt value expected\")\n#endif /* JERRY_BUILTIN_BIGINT */\nECMA_ERROR_DEF (ECMA_ERR_BINDING_CANNOT_SET, \"Binding cannot be set\")\n#if JERRY_BUILTIN_STRING\nECMA_ERROR_DEF (ECMA_ERR_INVALID_STRING_, \"Invalid string length\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_CONTAINER\nECMA_ERROR_DEF (ECMA_ERR_KEY_MUST_BE_AN_OBJECT, \"Key must be an object\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_ARRAY\nECMA_ERROR_DEF (ECMA_ERR_MISSING_ARRAY_ELEMENT, \"Missing Array element\")\n#endif /* JERRY_BUILTIN_ARRAY */\n#if JERRY_BUILTIN_WEAKREF\nECMA_ERROR_DEF (ECMA_ERR_TARGET_IS_NOT_WEAKREF, \"Target is not weakRef\")\n#endif /* JERRY_BUILTIN_WEAKREF */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TARGET_NOT_EXTENSIBLE, \"Target not extensible\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_ANNEXB\nECMA_ERROR_DEF (ECMA_ERR_GETTER_IS_NOT_CALLABLE, \"Getter is not callable\")\n#endif /* JERRY_BUILTIN_ANNEXB */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_HANDLER_CANNOT_BE_NULL, \"Handler cannot be null\")\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_ERROR_DEF (ECMA_ERR_INVALID_UTF8_CHARACTER, \"Invalid UTF8 character\")\nECMA_ERROR_DEF (ECMA_ERR_INVALID_UTF8_CODEPOINT, \"Invalid UTF8 codepoint\")\n#if JERRY_BUILTIN_CONTAINER\nECMA_ERROR_DEF (ECMA_ERR_INVALID_CONTAINER_TYPE, \"Invalid container type\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_INVALID_RANGE_OF_INDEX, \"Invalid range of index\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if !(JERRY_BUILTIN_PROXY)\nECMA_ERROR_DEF (ECMA_ERR_PROXY_IS_NOT_SUPPORTED, \"Proxy is not supported\")\n#endif /* !(JERRY_BUILTIN_PROXY) */\n#if !(JERRY_BUILTIN_REALMS)\nECMA_ERROR_DEF (ECMA_ERR_REALM_IS_NOT_AVAILABLE, \"Realm is not available\")\n#endif /* !(JERRY_BUILTIN_REALMS) */\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_BIGINT_ZERO_DIVISION, \"BigInt division by zero\")\n#endif /* JERRY_BUILTIN_BIGINT */\nECMA_ERROR_DEF (ECMA_ERR_EXPECTED_AN_ARRAYBUFFER, \"Expected an ArrayBuffer\")\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_INVALID_CHARACTER_CLASS, \"Invalid character class\")\nECMA_ERROR_DEF (ECMA_ERR_INVALID_ESCAPE_SEQUENCE, \"Invalid escape sequence\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_SNAPSHOT_EXEC\nECMA_ERROR_DEF (ECMA_ERR_INVALID_SNAPSHOT_FORMAT, \"Invalid snapshot format\")\n#endif /* JERRY_SNAPSHOT_EXEC */\n#if JERRY_BUILTIN_JSON\nECMA_ERROR_DEF (ECMA_ERR_JSON_STRING_PARSE_ERROR, \"JSON string parse error\")\n#endif /* JERRY_BUILTIN_JSON */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_LONE_QUANTIFIER_BRACKET, \"Lone quantifier bracket\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_OBJECT_CANNOT_BE_FROZEN, \"Object cannot be frozen\")\nECMA_ERROR_DEF (ECMA_ERR_OBJECT_CANNOT_BE_SEALED, \"Object cannot be sealed\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if !(JERRY_BUILTIN_REGEXP)\nECMA_ERROR_DEF (ECMA_ERR_REGEXP_IS_NOT_SUPPORTED, \"RegExp is not supported\")\n#endif /* !(JERRY_BUILTIN_REGEXP) */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_UNMATCHED_CLOSE_BRACKET, \"Unmatched close bracket\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_NOT_MODULE, \"Argument is not a module\")\n#endif /* JERRY_MODULE_SYSTEM */\nECMA_ERROR_DEF (ECMA_ERR_SET_PROTOTYPE, \"Cannot set [[Prototype]]\")\n#if JERRY_BUILTIN_ARRAY\nECMA_ERROR_DEF (ECMA_ERR_INVALID_NEW_ARRAY_LENGTH, \"Invalid new Array length\")\n#endif /* JERRY_BUILTIN_ARRAY */\nECMA_ERROR_DEF (ECMA_ERR_ITERATOR_IS_NOT_CALLABLE, \"Iterator is not callable\")\n#if !(JERRY_BUILTIN_JSON)\nECMA_ERROR_DEF (ECMA_ERR_JSON_NOT_SUPPORTED, \"JSON support is disabled\")\n#endif /* !(JERRY_BUILTIN_JSON) */\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_MODULE_IS_IN_ERROR_STATE, \"Module is in error state\")\n#endif /* JERRY_MODULE_SYSTEM */\nECMA_ERROR_DEF (ECMA_ERR_REJECT_MUST_BE_UNDEFINED, \"Reject must be undefined\")\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_REQUEST_IS_NOT_AVAILABLE, \"Request is not available\")\n#endif /* JERRY_MODULE_SYSTEM */\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT, \"Argument is not an object\")\n#if JERRY_BUILTIN_ATOMICS\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_NOT_SUPPORTED, \"Argument is not supported\")\n#endif /* JERRY_BUILTIN_ATOMICS */\n#if JERRY_BUILTIN_STRING\nECMA_ERROR_DEF (ECMA_ERR_INVALID_CODE_POINT_ERROR, \"Error: Invalid code point\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_INVALID_TYPEDARRAY_LENGTH, \"Invalid TypedArray length\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nECMA_ERROR_DEF (ECMA_ERR_INVALID_HEXADECIMAL_VALUE, \"Invalid hexadecimal value\")\nECMA_ERROR_DEF (ECMA_ERR_ITERATOR_IS_NOT_AN_OBJECT, \"Iterator is not an object\")\nECMA_ERROR_DEF (ECMA_ERR_RESOLVE_MUST_BE_UNDEFINED, \"Resolve must be undefined\")\n#if JERRY_SNAPSHOT_SAVE\nECMA_ERROR_DEF (ECMA_ERR_SNAPSHOT_BUFFER_SMALL, \"Snapshot buffer too small\")\n#endif /* JERRY_SNAPSHOT_SAVE */\n#if JERRY_BUILTIN_JSON\nECMA_ERROR_DEF (ECMA_ERR_THE_STRUCTURE_IS_CYCLICAL, \"The structure is cyclical\")\n#endif /* JERRY_BUILTIN_JSON */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_UNEXPECTED_END_OF_PATTERN, \"Unexpected end of pattern\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_SNAPSHOT_SAVE\nECMA_ERROR_DEF (ECMA_ERR_SNAPSHOT_UNSUPPORTED_COMPILED_CODE, \"Unsupported compiled code\")\n#endif /* JERRY_SNAPSHOT_SAVE */\n#if !(JERRY_BUILTIN_BIGINT)\nECMA_ERROR_DEF (ECMA_ERR_BIGINT_NOT_SUPPORTED, \"BigInt support is disabled\")\n#endif /* !(JERRY_BUILTIN_BIGINT) */\n#if JERRY_BUILTIN_DATAVIEW\nECMA_ERROR_DEF (ECMA_ERR_EXPECTED_A_DATAVIEW_OBJECT, \"Expected a DataView object\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\nECMA_ERROR_DEF (ECMA_ERR_EXPECTED_A_FUNCTION_OBJECT, \"Expected a function object\")\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_INVALID_ARRAYBUFFER_LENGTH, \"Invalid ArrayBuffer length\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if !(JERRY_MODULE_SYSTEM)\nECMA_ERROR_DEF (ECMA_ERR_MODULE_NOT_SUPPORTED, \"Module support is disabled\")\n#endif /* !(JERRY_MODULE_SYSTEM) */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_OBJECT_IS_NOT_A_TYPEDARRAY, \"Object is not a TypedArray\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nECMA_ERROR_DEF (ECMA_ERR_RECEIVER_MUST_BE_AN_OBJECT, \"Receiver must be an object\")\n#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_JSON\nECMA_ERROR_DEF (ECMA_ERR_BIGINT_SERIALIZED, \"BigInt cannot be serialized\")\n#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_JSON */\n#if JERRY_BUILTIN_CONTAINER\nECMA_ERROR_DEF (ECMA_ERR_CONTAINER_IS_NOT_AN_OBJECT, \"Container is not an object.\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_INVALID_HEX_ESCAPE_SEQUENCE, \"Invalid hex escape sequence\")\n#endif /* JERRY_BUILTIN_REGEXP */\nECMA_ERROR_DEF (ECMA_ERR_INVALID_SPECIES_CONSTRUCTOR, \"Invalid species constructor\")\nECMA_ERROR_DEF (ECMA_ERR_PROXY_TRAP_RETURNED_FALSISH, \"Proxy trap returned falsish\")\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_MIN_GREATER_THAN_MAX, \"Quantifier error: min > max\")\n#endif /* JERRY_BUILTIN_REGEXP */\nECMA_ERROR_DEF (ECMA_ERR_SYMBOL_IS_NOT_A_CONSTRUCTOR, \"Symbol is not a constructor\")\n#if JERRY_BUILTIN_REFLECT\nECMA_ERROR_DEF (ECMA_ERR_TARGET_IS_NOT_A_CONSTRUCTOR, \"Target is not a constructor\")\n#endif /* JERRY_BUILTIN_REFLECT */\nECMA_ERROR_DEF (ECMA_ERR_ACCESSOR_WRITABLE, \"Accessors cannot be writable\")\n#if !(JERRY_BUILTIN_DATAVIEW)\nECMA_ERROR_DEF (ECMA_ERR_DATA_VIEW_NOT_SUPPORTED, \"DataView support is disabled\")\n#endif /* !(JERRY_BUILTIN_DATAVIEW) */\n#if JERRY_BUILTIN_DATE\nECMA_ERROR_DEF (ECMA_ERR_DATE_MUST_BE_A_FINITE_NUMBER, \"Date must be a finite number\")\n#endif /* JERRY_BUILTIN_DATE */\nECMA_ERROR_DEF (ECMA_ERR_LOCAL_VARIABLE_IS_REDECLARED, \"Local variable is redeclared\")\nECMA_ERROR_DEF (ECMA_ERR_UNSUPPORTED_BINARY_OPERATION, \"Unsupported binary operation\")\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_UNTERMINATED_CHARACTER_CLASS, \"Unterminated character class\")\n#endif /* JERRY_BUILTIN_REGEXP */\nECMA_ERROR_DEF (ECMA_ERR_ARRAYBUFFER_IS_DETACHED, \"ArrayBuffer has been detached\")\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_NOT_AN_OBJECT, \"Constructor must be an object\")\n#if !(JERRY_BUILTIN_CONTAINER)\nECMA_ERROR_DEF (ECMA_ERR_CONTAINER_NOT_SUPPORTED, \"Container support is disabled\")\n#endif /* !(JERRY_BUILTIN_CONTAINER) */\n#if JERRY_BUILTIN_REALMS\nECMA_ERROR_DEF (ECMA_ERR_FIRST_ARGUMENT_IS_NOT_A_REALM, \"First argument is not a realm\")\n#endif /* JERRY_BUILTIN_REALMS */\n#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_INCOMPATIBLE_TYPEDARRAY_TYPES, \"Incompatible TypedArray types\")\n#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_INCORRECT_TYPE_FOR_TYPEDARRAY, \"Incorrect type for TypedArray\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nECMA_ERROR_DEF (ECMA_ERR_INVALID_OR_OUT_OF_RANGE_INDEX, \"Invalid or out-of-range index\")\n#if JERRY_SNAPSHOT_SAVE\nECMA_ERROR_DEF (ECMA_ERR_MAXIMUM_SNAPSHOT_SIZE, \"Maximum snapshot size reached\")\n#endif /* JERRY_SNAPSHOT_SAVE */\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_MODULE_CANNOT_BE_INSTANTIATED, \"Module cannot be instantiated\")\n#endif /* JERRY_MODULE_SYSTEM */\nECMA_ERROR_DEF (ECMA_ERR_SPECIES_MUST_BE_A_CONSTRUCTOR, \"Species must be a constructor\")\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_IS_NOT_A_PROXY, \"Argument is not a Proxy object\")\n#if JERRY_BUILTIN_ATOMICS || JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_NOT_ARRAY_BUFFER, \"Argument is not an ArrayBuffer\")\n#endif /* JERRY_BUILTIN_ATOMICS \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_CONTAINER\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_MAP_REQUIRES_NEW, \"Constructor Map requires 'new'\")\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_SET_REQUIRES_NEW, \"Constructor Set requires 'new'\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_MODULE_MUST_BE_IN_LINKED_STATE, \"Module must be in linked state\")\nECMA_ERROR_DEF (ECMA_ERR_UNKNOWN_EXPORT, \"Native module export not found\")\n#endif /* JERRY_MODULE_SYSTEM */\nECMA_ERROR_DEF (ECMA_ERR_PASSED_ARGUMENT_IS_NOT_A_REALM, \"Passed argument is not a realm\")\nECMA_ERROR_DEF (ECMA_ERR_PRIVATE_METHOD_IS_NOT_WRITABLE, \"Private method is not writable\")\n#if JERRY_BUILTIN_BIGINT || JERRY_BUILTIN_NUMBER\nECMA_ERROR_DEF (ECMA_ERR_RADIX_IS_OUT_OF_RANGE, \"Radix must be between 2 and 36\")\n#endif /* JERRY_BUILTIN_BIGINT \\\n|| JERRY_BUILTIN_NUMBER */\n#if !(JERRY_SNAPSHOT_EXEC)\nECMA_ERROR_DEF (ECMA_ERR_SNAPSHOT_EXEC_DISABLED, \"Snapshot execution is disabled\")\n#endif /* !(JERRY_SNAPSHOT_EXEC) */\n#if !(JERRY_BUILTIN_TYPEDARRAY)\nECMA_ERROR_DEF (ECMA_ERR_TYPED_ARRAY_NOT_SUPPORTED, \"TypedArray support is disabled\")\n#endif /* !(JERRY_BUILTIN_TYPEDARRAY) */\nECMA_ERROR_DEF (ECMA_ERR_UNICODE_SURROGATE_PAIR_MISSING, \"Unicode surrogate pair missing\")\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_INVALID_CONTROL_ESCAPE_SEQUENCE, \"Invalid control escape sequence\")\nECMA_ERROR_DEF (ECMA_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE, \"Invalid unicode escape sequence\")\n#endif /* JERRY_BUILTIN_REGEXP */\nECMA_ERROR_DEF (ECMA_ERR_ITERATOR_NEXT_IS_NOT_CALLABLE, \"Iterator 'next' is not callable\")\nECMA_ERROR_DEF (ECMA_ERR_ITERATOR_VALUE_IS_NOT_AN_OBJECT, \"Iterator value is not an object\")\nECMA_ERROR_DEF (ECMA_ERR_RESOLVE_METHOD_MUST_BE_CALLABLE, \"Resolve method must be callable\")\n#if !(JERRY_SNAPSHOT_SAVE)\nECMA_ERROR_DEF (ECMA_ERR_SNAPSHOT_SAVE_DISABLED, \"Snapshot generation is disabled\")\n#endif /* !(JERRY_SNAPSHOT_SAVE) */\n#if !(JERRY_PARSER)\nECMA_ERROR_DEF (ECMA_ERR_PARSER_NOT_SUPPORTED, \"Source code parsing is disabled\")\n#endif /* !(JERRY_PARSER) */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TRAP_MUST_RETURN_WITH_AN_OBJECT, \"Trap must return with an object\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_CONTAINER\nECMA_ERROR_DEF (ECMA_ERR_UNSUPPORTED_CONTAINER_OPERATION, \"Unsupported container operation\")\n#endif /* JERRY_BUILTIN_CONTAINER */\nECMA_ERROR_DEF (ECMA_ERR_METHOD_RETURN_IS_NOT_CALLABLE, \"method 'return' is not callable\")\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_PROMISE, \"Argument 'this' is not a Promise\")\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT, \"Argument 'this' is not an object\")\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_SYMBOL, \"Argument 'this' must be a Symbol\")\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_CALLBACK_RESULT_NOT_MODULE, \"Callback result must be a module\")\n#endif /* JERRY_MODULE_SYSTEM */\nECMA_ERROR_DEF (ECMA_ERR_CLASS_CONSTRUCTOR_REQUIRES_NEW, \"Class constructor requires 'new'\")\n#if JERRY_BUILTIN_ARRAY\nECMA_ERROR_DEF (ECMA_ERR_COMPARE_FUNC_NOT_CALLABLE, \"Compare function is not callable\")\n#endif /* JERRY_BUILTIN_ARRAY */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_PROXY_REQUIRES_NEW, \"Constructor Proxy requires 'new'\")\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_ERROR_DEF (ECMA_ERR_EXPECTED_A_CONFIGURABLE_PROPERTY, \"Expected a configurable property\")\nECMA_ERROR_DEF (ECMA_ERR_FIRST_PARAMETER_MUST_BE_CALLABLE, \"First parameter must be callable\")\n#if JERRY_BUILTIN_CONTAINER\nECMA_ERROR_DEF (ECMA_ERR_FUNCTION_ADD_ORSET_IS_NOT_CALLABLE, \"Function add/set is not callable\")\n#endif /* JERRY_BUILTIN_CONTAINER */\nECMA_ERROR_DEF (ECMA_ERR_ITERATOR_RESULT_IS_NOT_AN_OBJECT, \"Iterator result is not an object\")\n#if (JERRY_STACK_LIMIT != 0)\nECMA_ERROR_DEF (ECMA_ERR_MAXIMUM_CALL_STACK_SIZE_EXCEEDED, \"Maximum call stack size exceeded\")\n#endif /* (JERRY_STACK_LIMIT != 0) */\nECMA_ERROR_DEF (ECMA_ERR_MAXIMUM_STRING_LENGTH_IS_REACHED, \"Maximum string length is reached\")\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_MODULE_MUST_BE_IN_UNLINKED_STATE, \"Module must be in unlinked state\")\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_SNAPSHOT_EXEC\nECMA_ERROR_DEF (ECMA_ERR_STATIC_SNAPSHOTS_ARE_NOT_ENABLED, \"Static snapshots are not enabled\")\n#endif /* JERRY_SNAPSHOT_EXEC */\n#if JERRY_BUILTIN_WEAKREF\nECMA_ERROR_DEF (ECMA_ERR_WEAKREF_TARGET_MUST_BE_AN_OBJECT, \"WeakRef target must be an object\")\n#endif /* JERRY_BUILTIN_WEAKREF */\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_FUNCTION, \"Argument 'this' is not a function\")\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_CONTAINER || JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE, \"Callback function is not callable\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_CONTAINER    \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_INITIAL_VALUE_CANNOT_BE_UNDEFINED, \"Initial value cannot be undefined\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\nECMA_ERROR_DEF (ECMA_ERR_INVALID_SHARED_ARRAYBUFFER_LENGTH, \"Invalid Shared ArrayBuffer length\")\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\nECMA_ERROR_DEF (ECMA_ERR_INVALID_TYPE_FOR_CONSTRUCTOR_CALL, \"Invalid type for constructor call\")\nECMA_ERROR_DEF (ECMA_ERR_ITERATOR_THROW_IS_NOT_AVAILABLE, \"Iterator 'throw' is not available\")\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_NAMESPACE_OBJECT_IS_NOT_AVAILABLE, \"Namespace object is not available\")\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_PROXY_TARGET_IS_NOT_A_CONSTRUCTOR, \"Proxy target is not a constructor\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_REALMS\nECMA_ERROR_DEF (ECMA_ERR_SECOND_ARGUMENT_MUST_BE_AN_OBJECT, \"Second argument must be an object\")\n#endif /* JERRY_BUILTIN_REALMS */\n#if JERRY_BUILTIN_DATAVIEW\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_BUFFER_NOT_OBJECT, \"Argument 'buffer' is not an object\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_ITERATOR, \"Argument 'this' is not an iterator\")\nECMA_ERROR_DEF (ECMA_ERR_VALUE_MSG, \"Argument cannot be marked as error\")\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_PROMISE_REQUIRES_NEW, \"Constructor Promise requires 'new'\")\n#if JERRY_BUILTIN_CONTAINER\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_WEAKMAP_REQUIRES_NEW, \"Constructor WeakMap requires 'new'\")\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_WEAKSET_REQUIRES_NEW, \"Constructor WeakSet requires 'new'\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_DEBUGGER\nECMA_ERROR_DEF (ECMA_ERR_INVALID_SCOPE_CHAIN_INDEX_FOR_EVAL, \"Invalid scope chain index for eval\")\n#endif /* JERRY_DEBUGGER */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_MAXIMUM_TYPEDARRAY_SIZE_IS_REACHED, \"Maximum TypedArray size is reached\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nECMA_ERROR_DEF (ECMA_ERR_THE_GIVEN_ARGUMENT_IS_NOT_A_SYMBOL, \"The given argument is not a Symbol\")\nECMA_ERROR_DEF (ECMA_ERR_PARAMETER_REJECT_MUST_BE_CALLABLE, \"'reject' parameter must be callable\")\n#if JERRY_BUILTIN_ATOMICS || JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_TYPED_ARRAY, \"Argument 'this' is not a TypedArray\")\n#endif /* JERRY_BUILTIN_ATOMICS \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_SNAPSHOT_SAVE\nECMA_ERROR_DEF (ECMA_ERR_CANNOT_ALLOCATE_MEMORY_LITERALS, \"Cannot allocate memory for literals\")\n#endif /* JERRY_SNAPSHOT_SAVE */\nECMA_ERROR_DEF (ECMA_ERR_INVOKE_NULLABLE_SUPER_METHOD, \"Cannot invoke nullable super method\")\n#if JERRY_BUILTIN_DATAVIEW\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_DATAVIEW_REQUIRES_NEW, \"Constructor DataView requires 'new'\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_WEAKREF\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_WEAKREF_REQUIRES_NEW, \"Constructor WeakRef requires 'new'.\")\n#endif /* JERRY_BUILTIN_WEAKREF */\nECMA_ERROR_DEF (ECMA_ERR_SUPER_BINDING_MUST_BE_A_CONSTRUCTOR, \"Super binding must be a constructor\")\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_VALUE_CANNOT_BE_CONVERTED_TO_BIGINT, \"Value cannot be converted to BigInt\")\n#endif /* JERRY_BUILTIN_BIGINT */\nECMA_ERROR_DEF (ECMA_ERR_PARAMETER_RESOLVE_MUST_BE_CALLABLE, \"'resolve' parameter must be callable\")\n#if JERRY_BUILTIN_DATE\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_DATE_OBJECT, \"Argument 'this' is not a Date object\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_CONSTRUCTOR, \"Argument 'this' is not a constructor\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_BIGINT_FUNCTION_NOT_CONSTRUCTOR, \"BigInt function is not a constructor\")\n#endif /* JERRY_BUILTIN_BIGINT */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTED_OBJECT_IS_NOT_TYPEDARRAY, \"Constructed object is not TypedArray\")\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_INT8_ARRAY_REQUIRES_NEW, \"Constructor Int8Array requires 'new'\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_CONTAINER\nECMA_ERROR_DEF (ECMA_ERR_CONTAINER_IS_NOT_A_CONTAINER_OBJECT, \"Container is not a container object.\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_DATE\nECMA_ERROR_DEF (ECMA_ERR_INVALID_ARGUMENT_TYPE_IN_TOPRIMITIVE, \"Invalid argument type in toPrimitive\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_ERROR_MESSAGES\nECMA_ERROR_DEF (ECMA_ERR_METHODS_INVOKE_WITH_NEW, \"Methods cannot be invoked with 'new'\")\n#endif /* JERRY_ERROR_MESSAGES */\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_MODULE_EXPORTS_MUST_BE_STRING_VALUES, \"Module exports must be string values\")\n#endif /* JERRY_MODULE_SYSTEM */\nECMA_ERROR_DEF (ECMA_ERR_PROTOTYPE_IS_NEITHER_OBJECT_NOR_NULL, \"Prototype is neither object nor null\")\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_THE_MAPFN_ARGUMENT_IS_NOT_CALLABLE, \"The 'mapfn' argument is not callable\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_THE_TWO_DESCRIPTORS_ARE_INCOMPATIBLE, \"The two descriptors are incompatible\")\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_ERROR_DEF (ECMA_ERR_WRONG_ARGS_MSG, \"This type of argument is not allowed\")\n#if JERRY_BUILTIN_CONTAINER\nECMA_ERROR_DEF (ECMA_ERR_CONTAINER_NEEDED, \"Value is not a Container or Iterator\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP, \"Argument 'this' is not a valid RegExp\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_ARRAY_BUFFER_DETACHED, \"ArrayBuffer has already been detached\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nECMA_ERROR_DEF (ECMA_ERR_BULTIN_ROUTINES_HAVE_NO_CONSTRUCTOR, \"Built-in routines have no constructor\")\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_INT16_ARRAY_REQUIRES_NEW, \"Constructor Int16Array requires 'new'\")\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_INT32_ARRAY_REQUIRES_NEW, \"Constructor Int32Array requires 'new'\")\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_UINT8_ARRAY_REQUIRES_NEW, \"Constructor Uint8Array requires 'new'\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_SNAPSHOT_EXEC\nECMA_ERROR_DEF (ECMA_ERR_FUNCTION_INDEX_IS_HIGHER_THAN_MAXIMUM, \"Function index is higher than maximum\")\n#endif /* JERRY_SNAPSHOT_EXEC */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_RANGE_OUT_OF_ORDER_IN_CHARACTER_CLASS, \"Range out of order in character class\")\n#endif /* JERRY_BUILTIN_REGEXP */\nECMA_ERROR_DEF (ECMA_ERR_RESULT_OF_DEFAULTVALUE_IS_INVALID, \"Result of [[DefaultValue]] is invalid\")\nECMA_ERROR_DEF (ECMA_ERR_RIGHT_VALUE_OF_IN_MUST_BE_AN_OBJECT, \"Right value of 'in' must be an object\")\n#if !(JERRY_BUILTIN_SHAREDARRAYBUFFER)\nECMA_ERROR_DEF (ECMA_ERR_SHARED_ARRAYBUFFER_NOT_SUPPORTED, \"SharedArrayBuffer support is disabled\")\n#endif /* !(JERRY_BUILTIN_SHAREDARRAYBUFFER) */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TRAP_RETURNED_NEITHER_OBJECT_NOR_NULL, \"Trap returned neither object nor null\")\nECMA_ERROR_DEF (ECMA_ERR_TRAP_WITH_DUPLICATED_ENTRIES, \"Trap returned with duplicated entries\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_UNARY_PLUS_IS_NOT_ALLOWED_FOR_BIGINTS, \"Unary plus is not allowed for BigInts\")\n#endif /* JERRY_BUILTIN_BIGINT */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_IS_NOT_AN_REGEXP, \"Argument 'this' is not a RegExp object\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_ALLOCATE_ARRAY_BUFFER, \"Cannot allocate memory for ArrayBuffer\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nECMA_ERROR_DEF (ECMA_ERR_CONSTANT_BINDINGS_CANNOT_BE_REASSIGNED, \"Constant bindings cannot be reassigned\")\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_ARRAYBUFFER_REQUIRES_NEW, \"Constructor ArrayBuffer requires 'new'\")\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_UINT16_ARRAY_REQUIRES_NEW, \"Constructor Uint16Array requires 'new'\")\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_UINT32_ARRAY_REQUIRES_NEW, \"Constructor Uint32Array requires 'new'\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nECMA_ERROR_DEF (ECMA_ERR_GENERATOR_IS_CURRENTLY_UNDER_EXECUTION, \"Generator is currently under execution\")\nECMA_ERROR_DEF (ECMA_ERR_ITERATOR_RETURN_RESULT_IS_NOT_OBJECT, \"Iterator 'return' result is not object\")\nECMA_ERROR_DEF (ECMA_ERR_SEARCH_STRING_CANNOT_BE_OF_TYPE_REGEXP, \"Search string can't be of type: RegExp\")\nECMA_ERROR_DEF (ECMA_ERR_VALUE_RECEIVED_BY_YIELD_IS_NOT_OBJECT, \"Value received by yield* is not object\")\n#if JERRY_BUILTIN_BOOLEAN\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_BOOLEAN_OBJECT, \"Argument 'this' is not a Boolean object\")\n#endif /* JERRY_BUILTIN_BOOLEAN */\nECMA_ERROR_DEF (ECMA_ERR_CANNOT_DECLARE_SAME_PRIVATE_FIELD_TWICE, \"Cannot declare same private field twice\")\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_FLOAT32_ARRAY_REQUIRES_NEW, \"Constructor Float32Array requires 'new'\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_TYPEDARRAY && JERRY_NUMBER_TYPE_FLOAT64\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_FLOAT64_ARRAY_REQUIRES_NEW, \"Constructor Float64Array requires 'new'\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY && JERRY_NUMBER_TYPE_FLOAT64 */\nECMA_ERROR_DEF (ECMA_ERR_FUNCTION_PROTOTYPE_NOT_A_CONSTRUCTOR, \"Function.prototype is not a constructor\")\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_IMPORTED_BINDING_SHADOWS_LOCAL_VARIABLE, \"Imported binding shadows local variable\")\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_PROTOTYPE_FROM_REVOKED_PROXY_IS_INVALID, \"Prototype from revoked Proxy is invalid\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING\nECMA_ERROR_DEF (ECMA_ERR_REGEXP_ARGUMENT_SHOULD_HAVE_GLOBAL_FLAG, \"RegExp argument should have global flag\")\n#endif /* JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TRAP_IS_NEITHER_AN_OBJECT_NOR_UNDEFINED, \"Trap is neither an object nor undefined\")\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_ERROR_DEF (ECMA_ERR_PROMISE_RESOLVE_ITSELF, \"A promise cannot be resolved with itself\")\n#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_BIGINT64_ARRAY_REQUIRES_NEW, \"Constructor BigInt64Array requires 'new'\")\n#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_MODULE_EXPORTS_MUST_BE_VALID_IDENTIFIERS, \"Module exports must be valid identifiers\")\n#endif /* JERRY_MODULE_SYSTEM */\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_GENERATOR_OBJECT, \"Argument 'this' is not a generator object\")\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_CANNOT_CONVERT_TO_OBJECT, \"Argument cannot be converted to an object\")\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_ALLOCATE_BIGINT_VALUE, \"Cannot allocate memory for a BigInt value\")\nECMA_ERROR_DEF (ECMA_ERR_CONVERT_BIGINT_TO_NUMBER, \"Cannot convert a BigInt value to a number\")\n#endif /* JERRY_BUILTIN_BIGINT */\nECMA_ERROR_DEF (ECMA_ERR_CONVERT_SYMBOL_TO_NUMBER, \"Cannot convert a Symbol value to a number\")\nECMA_ERROR_DEF (ECMA_ERR_CONVERT_SYMBOL_TO_STRING, \"Cannot convert a Symbol value to a string\")\n#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_BIG_UINT64_ARRAY_REQUIRES_NEW, \"Constructor BigUInt64Array requires 'new'\")\n#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_NUMBER\nECMA_ERROR_DEF (ECMA_ERR_FRACTION_DIGITS_OUT_OF_RANGE, \"Fraction digits must be between 0 and 100\")\n#endif /* JERRY_BUILTIN_NUMBER */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_RETURN_VALUE_IS_NOT_AN_ARRAYBUFFER_OBJECT, \"Return value is not an ArrayBuffer object\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nECMA_ERROR_DEF (ECMA_ERR_SUPER_CONSTRUCTOR_MAY_ONLY_BE_CALLED_ONCE, \"Super constructor may only be called once\")\nECMA_ERROR_DEF (ECMA_ERR_BINDING_NOT_EXIST_OR_UNINITIALIZED, \"Binding does not exist or is uninitialised\")\n#if JERRY_BUILTIN_ARRAY\nECMA_ERROR_DEF (ECMA_ERR_CANNOT_CONVERT_TO_OBJECT, \"Cannot convert undefined or null to object\")\n#endif /* JERRY_BUILTIN_ARRAY */\n#if JERRY_BUILTIN_NUMBER\nECMA_ERROR_DEF (ECMA_ERR_PRECISION_DIGITS_MUST_BE_BETWEEN_IN_RANGE, \"Precision digits must be between 1 and 100\")\n#endif /* JERRY_BUILTIN_NUMBER */\nECMA_ERROR_DEF (ECMA_ERR_PRIVATE_FIELD_WAS_DEFINED_WITHOUT_A_GETTER, \"Private field was defined without a getter\")\nECMA_ERROR_DEF (ECMA_ERR_PRIVATE_FIELD_WAS_DEFINED_WITHOUT_A_SETTER, \"Private field was defined without a setter\")\nECMA_ERROR_DEF (ECMA_ERR_PROPERTY_NAME_IS_NEITHER_SYMBOL_NOR_STRING, \"Property name is neither Symbol nor string\")\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_STRING_CANNOT_BE_CONVERTED_TO_BIGINT_VALUE, \"String cannot be converted to BigInt value\")\n#endif /* JERRY_BUILTIN_BIGINT */\n#if JERRY_BUILTIN_CONTAINER\nECMA_ERROR_DEF (ECMA_ERR_INCORRECT_TYPE_CALL, \"Operator called on incorrect container type\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_ARRAY\nECMA_ERROR_DEF (ECMA_ERR_REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE, \"Reduce of empty Array with no initial value\")\n#endif /* JERRY_BUILTIN_ARRAY */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP_OBJECT, \"Argument 'this' is not a valid RegExp object\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_ARRAY_BUFFER_OBJECT, \"Argument 'this' is not an ArrayBuffer object\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_ERROR_MESSAGES\nECMA_ERROR_DEF (ECMA_ERR_ARROW_FUNCTIONS_INVOKE_WITH_NEW, \"Arrow functions cannot be invoked with 'new'\")\nECMA_ERROR_DEF (ECMA_ERR_ASYNC_FUNCTIONS_INVOKE_WITH_NEW, \"Async functions cannot be invoked with 'new'\")\n#endif /* JERRY_ERROR_MESSAGES */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_SET_EXTENSIBLE_PROPERTY, \"Cannot set [[Extensible]] property of object\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_SHAREDARRAYBUFFER_REQUIRES_NEW, \"Constructor SharedArrayBuffer requires 'new'\")\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_UINT8_CLAMPED_ARRAY_REQUIRES_NEW, \"Constructor Uint8ClampedArray requires 'new'\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_NEGATIVE_EXPONENT_IS_NOT_ALLOWED_FOR_BIGINTS, \"Negative exponent is not allowed for BigInts\")\n#endif /* JERRY_BUILTIN_BIGINT */\nECMA_ERROR_DEF (ECMA_ERR_PROMISE_ALL_REMAINING_ELEMENTS_LIMIT_REACHED, \"Promise.all remaining elements limit reached\")\nECMA_ERROR_DEF (ECMA_ERR_VALUE_RECEIVED_BY_FOR_ASYNC_OF_IS_NOT_OBJECT, \"Value received by for-async-of is not object\")\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_INFINITY_OR_NAN_CANNOT_BE_CONVERTED_TO_BIGINT, \"Infinity or NaN cannot be converted to BigInt\")\n#endif /* JERRY_BUILTIN_BIGINT */\nECMA_ERROR_DEF (ECMA_ERR_OPERATOR_DELETE_RETURNED_FALSE_IN_STRICT_MODE, \"Operator delete returned false in strict mode\")\nECMA_ERROR_DEF (ECMA_ERR_PROPERTY_PROTOTYPE_IS_NOT_AN_OBJECT, \"Property 'prototype' is not an object or null\")\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_PROXY_HANDLER_IS_NULL_FOR_ISARRAY_OPERATION, \"Proxy handler is null for 'isArray' operation\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_SNAPSHOT_SAVE\nECMA_ERROR_DEF (ECMA_ERR_REGULAR_EXPRESSION_NOT_SUPPORTED, \"Regular expression literals are not supported\")\n#endif /* JERRY_SNAPSHOT_SAVE */\nECMA_ERROR_DEF (ECMA_ERR_RIGHT_VALUE_OF_INSTANCEOF_MUST_BE_AN_OBJECT, \"Right value of 'instanceof' must be an object\")\n#if JERRY_SNAPSHOT_EXEC\nECMA_ERROR_DEF (ECMA_ERR_STATIC_SNAPSHOTS_CANNOT_BE_COPIED_INTO_MEMORY, \"Static snapshots cannot be copied into memory\")\n#endif /* JERRY_SNAPSHOT_EXEC */\n#if JERRY_SNAPSHOT_SAVE\nECMA_ERROR_DEF (ECMA_ERR_TAGGED_TEMPLATE_LITERALS, \"Unsupported feature: tagged template literals\")\nECMA_ERROR_DEF (ECMA_ERR_SNAPSHOT_FLAG_NOT_SUPPORTED, \"Unsupported generate snapshot flags specified\")\n#endif /* JERRY_SNAPSHOT_SAVE */\n#if JERRY_SNAPSHOT_EXEC\nECMA_ERROR_DEF (ECMA_ERR_UNSUPPORTED_SNAPSHOT_EXEC_FLAGS_ARE_SPECIFIED, \"Unsupported snapshot exec flags are specified\")\n#endif /* JERRY_SNAPSHOT_EXEC */\nECMA_ERROR_DEF (ECMA_ERR_VALUE_FOR_CLASS_HERITAGE_IS_NOT_A_CONSTRUCTOR, \"Value for class heritage is not a constructor\")\nECMA_ERROR_DEF (ECMA_ERR_TOO_MANY_ARGUMENTS_DECLARED_FOR_FUNCTION_APPLY,\n                \"Too many arguments declared for Function.apply\")\n#if JERRY_ERROR_MESSAGES\nECMA_ERROR_DEF (ECMA_ERR_ACCESSOR_FUNCTIONS_INVOKE_WITH_NEW, \"Accessor functions cannot be invoked with 'new'\")\n#endif /* JERRY_ERROR_MESSAGES */\n#if JERRY_MODULE_SYSTEM\nECMA_ERROR_DEF (ECMA_ERR_LINK_TO_MODULE_IN_ERROR_STATE, \"Cannot link to a module which is in error state\")\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_ONLY_INTEGER_NUMBERS_CAN_BE_CONVERTED_TO_BIGINT,\n                \"Only integer numbers can be converted to BigInt\")\n#endif /* JERRY_BUILTIN_BIGINT */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_TYPEDARRAY_INTRINSTIC_DIRECTLY_CALLED, \"TypedArray intrinstic cannot be directly called\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_UNSIGNED_RIGHT_SHIFT_IS_NOT_ALLOWED_FOR_BIGINTS,\n                \"Unsigned right shift is not allowed for BigInts\")\n#endif /* JERRY_BUILTIN_BIGINT */\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_ASYNC_GENERATOR, \"Argument 'this' is not an async generator object\")\nECMA_ERROR_DEF (ECMA_ERR_CLASS_EXTENDS_NOT_CONSTRUCTOR, \"Class extends value is not a constructor or null\")\n#if JERRY_ERROR_MESSAGES\nECMA_ERROR_DEF (ECMA_ERR_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW, \"Generator functions cannot be invoked with 'new'\")\n#endif /* JERRY_ERROR_MESSAGES */\n#if JERRY_BUILTIN_REGEXP\nECMA_ERROR_DEF (ECMA_ERR_RETURN_VALUE_OF_EXEC_MUST_BE_AN_OBJECT_OR_NULL,\n                \"Return value of 'exec' must be an object or null\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_DATAVIEW\nECMA_ERROR_DEF (ECMA_ERR_START_OFFSET_IS_OUTSIDE_THE_BOUNDS_OF_THE_BUFFER,\n                \"Start offset is outside the bounds of the buffer\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER, \"Argument 'this' is not a SharedArrayBuffer object\")\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\nECMA_ERROR_DEF (ECMA_ERR_CLASS_CONSTRUCTOR_NEW, \"Class constructor cannot be invoked without 'new'\")\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_INCORRECT_RETURN_PROXY_GET_TRAP, \"Incorrect value is returned by a Proxy 'get' trap\")\nECMA_ERROR_DEF (ECMA_ERR_INCORRECT_RETURN_PROXY_SET_TRAP, \"Incorrect value is returned by a Proxy 'set' trap\")\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_ERROR_DEF (ECMA_ERR_CLASS_IS_NON_CONFIGURABLE, \"Prototype property of a class is non-configurable\")\n#if JERRY_BUILTIN_ARRAY\nECMA_ERROR_DEF (ECMA_ERR_PUSHING_TOO_HIGH_ELEMENT, \"Pushing element over 2**53-1 length is disallowed\")\n#endif /* JERRY_BUILTIN_ARRAY */\nECMA_ERROR_DEF (ECMA_ERR_THE_REQUESTED_PROPERTY_UPDATE_CANNOT_BE_PERFORMED,\n                \"The requested property update cannot be performed\")\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_CONFIGURABLE_KEYS,\n                \"Trap result did not include all configurable keys\")\nECMA_ERROR_DEF (ECMA_ERR_TRAP_TRUISH_TARGET_NOT_EXTENSIBLE, \"Trap returned truish for target is not extensible\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_NUMBER\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_NUMBER, \"Argument 'this' is not a number or a Number object\")\n#endif /* JERRY_BUILTIN_NUMBER */\n#if JERRY_BUILTIN_STRING\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_STRING_OBJECT, \"Argument 'this' is not a string or a String object\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER_OBJECT,\n                \"Argument 'this' is not an SharedArrayBuffer object\")\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n#if JERRY_ERROR_MESSAGES\nECMA_ERROR_DEF (ECMA_ERR_ASYNC_ARROW_FUNCTIONS_INVOKE_WITH_NEW, \"Async arrow functions cannot be invoked with 'new'\")\n#endif /* JERRY_ERROR_MESSAGES */\n#if JERRY_BUILTIN_ARRAY\nECMA_ERROR_DEF (ECMA_ERR_UNSHIFT_TOO_HIGH, \"Unshift elements over 2**53-1 length is disallowed\")\n#endif /* JERRY_BUILTIN_ARRAY */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_NON_CONFIGURABLE_KEYS,\n                \"Trap result did not include all non-configurable keys\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_ERROR_MESSAGES\nECMA_ERROR_DEF (ECMA_ERR_ASYNC_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW,\n                \"Async generator functions cannot be invoked with 'new'\")\n#endif /* JERRY_ERROR_MESSAGES */\n#if JERRY_BUILTIN_REFLECT\nECMA_ERROR_DEF (ECMA_ERR_REFLECT_EXPECTS_AN_OBJECT_AS_SECOND_ARGUMENT,\n                \"Reflect.construct expects an object as second argument\")\n#endif /* JERRY_BUILTIN_REFLECT */\n#if JERRY_ERROR_MESSAGES\nECMA_ERROR_DEF (ECMA_ERR_SCRIPT_GLOBAL_FUNCTIONS_INVOKE_WITH_NEW,\n                \"Script (global) functions cannot be invoked with 'new'\")\n#endif /* JERRY_ERROR_MESSAGES */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_CANNOT_CREATE_PROXY, \"Cannot create Proxy with a non-object target or handler\")\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_ERROR_DEF (ECMA_ERR_DERIVED_CTOR_RETURN_NOR_OBJECT_OR_UNDEFINED,\n                \"Derived constructors may only return object or undefined\")\n#if JERRY_SNAPSHOT_EXEC\nECMA_ERROR_DEF (ECMA_ERR_INVALID_SNAPSHOT_VERSION_OR_FEATURES,\n                \"Invalid snapshot version or unsupported features present\")\n#endif /* JERRY_SNAPSHOT_EXEC */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_TYPEDARRAY_SMALLER_THAN_FILTER_CALL_RESULT,\n                \"Constructed TypedArray is smaller than filter call result\")\nECMA_ERROR_DEF (ECMA_ERR_DERIVED_ARRAY_BUFFER_CTOR_BUFFER_TOO_SMALL,\n                \"Derived ArrayBuffer constructor created a too small buffer\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_EXTENSIBILITY,\n                \"Trap result does not reflect extensibility of Proxy target\")\nECMA_ERROR_DEF (ECMA_ERR_TRAP_EXTRA_KEYS_FOR_A_NON_EXTENSIBLE_TARGET,\n                \"Trap returned extra keys for a non-extensible Proxy target\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_ARRAY_BUFFER_RETURNED_THIS_FROM_CONSTRUCTOR,\n                \"ArrayBuffer subclass returned this from species constructor\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_DATAVIEW\nECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_BUFFER_NOT_ARRAY_OR_SHARED_BUFFER,\n                \"Argument 'buffer' is not an ArrayBuffer or SharedArrayBuffer\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_INEXTENSIBILITY,\n                \"Trap result does not reflect inextensibility of Proxy target\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_TYPEDARRAY_INTRINSTIC_CALLED_BY_NEW_EXPRESSION,\n                \"TypedArray intrinstic cannot be called by a 'new' expression\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY\nECMA_ERROR_DEF (ECMA_ERR_CONTENTTYPE_RETURNED_TYPEDARRAY_NOT_MATCH_SOURCE,\n                \"TypedArray returned by [[ContentType]] does not match source\")\n#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_BIGINT\nECMA_ERROR_DEF (ECMA_ERR_ALLOCATE_BIGINT_STRING, \"Cannot allocate memory for a string representation of a BigInt value\")\n#endif /* JERRY_BUILTIN_BIGINT */\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TARGET_NOT_EXTENSIBLE_DIFFERENT_PROTOTYPE_RETURNED,\n                \"Target object is non-extensible and trap returned different prototype\")\nECMA_ERROR_DEF (ECMA_ERR_TRAP_TRUISH_ADDING_PROPERTY_NON_EXTENSIBLE_TARGET,\n                \"Trap returned truish for adding property to the non-extensible target\")\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_ERROR_DEF (ECMA_ERR_CANNOT_READ_PRIVATE_MEMBER_TO_AN_OBJECT_WHOSE_CLASS_DID_NOT_DECLARE_IT,\n                \"Cannot read private member to an object whose class did not declare it\")\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_GIVEN_PROPERTY_IS_A_NON_CONFIGURABLE,\n                \"Given property is a non-configurable data property on the proxy target\")\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_ERROR_DEF (ECMA_ERR_CANNOT_WRITE_PRIVATE_MEMBER_TO_AN_OBJECT_WHOSE_CLASS_DID_NOT_DECLARE_IT,\n                \"Cannot write private member to an object whose class did not declare it\")\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TRAP_FALSISH_PROPERTY_TARGET_NOT_EXTENSIBLE,\n                \"Trap returned falsish for property but the proxy target is not extensible\")\nECMA_ERROR_DEF (ECMA_ERR_PROXY_PROPERTY_NOT_CONFIGURABLE_NOT_HAVE_GETTER,\n                \"Property of a Proxy is non-configurable and does not have a getter function\")\nECMA_ERROR_DEF (ECMA_ERR_TARGET_PROPERTY_CONFIGURE_ACCESSOR_WITHOUT_SETTER,\n                \"The property of a Proxy target is a non configurable accessor without a setter\")\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_ERROR_DEF (ECMA_ERR_LET_CONST_NOT_INITIALIZED,\n                \"Variables declared by let/const must be initialized before reading their value\")\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TRAP_TRUISH_PROPERTY_NON_CONFIGURABLE,\n                \"Trap returned truish for property which is non-configurable in the proxy target\")\nECMA_ERROR_DEF (ECMA_ERR_TARGET_NOT_EXTENSIBLE_NOT_RETURNED_ITS_PROTOTYPE,\n                \"Proxy target is non-extensible, but the trap did not return its actual prototype\")\nECMA_ERROR_DEF (ECMA_ERR_TRAP_FALSISH_PROPERTY_NON_CONFIGURABLE,\n                \"Trap returned falsish for property which exists in the proxy target as non-configurable\")\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_ERROR_DEF (ECMA_ERR_CALL_SUPER_CONSTRUCTOR_DERIVED_CLASS_BEFORE_THIS,\n                \"Must call super constructor in derived class before accessing 'this' or returning from it\")\n#if JERRY_BUILTIN_PROXY\nECMA_ERROR_DEF (ECMA_ERR_TRAP_TRUISH_DEFINING_NON_EXISTENT_PROPERTY,\n                \"Trap returned truish for defining non-configurable property which is non-existent in the target\")\nECMA_ERROR_DEF (\n  ECMA_ERR_TRAP_TRUISH_ADD_PROPERTY_INCOMPATIBLE_OTHER_PROP,\n  \"Trap returned truish for adding property that is incompatible with the existing property in the target\")\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_ERROR_DEF (ECMA_ERR_CANNOT_ACCESS_CALLER_CALLE_ARGUMENTS,\n                \"'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the \"\n                \"arguments objects for calls to them\")\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-error-messages.ini",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n[ECMA_ERROR_MESSAGES]\n\nECMA_ERR_CANNOT_ACCESS_CALLER_CALLE_ARGUMENTS = \"'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them\"\nECMA_ERR_PARAMETER_REJECT_MUST_BE_CALLABLE = \"'reject' parameter must be callable\"\nECMA_ERR_PARAMETER_RESOLVE_MUST_BE_CALLABLE = \"'resolve' parameter must be callable\"\nECMA_ERR_PROMISE_RESOLVE_ITSELF = \"A promise cannot be resolved with itself\"\nECMA_ERR_ACCESSOR_WRITABLE = \"Accessors cannot be writable\"\nECMA_ERR_ARGUMENT_BUFFER_NOT_ARRAY_OR_SHARED_BUFFER = \"Argument 'buffer' is not an ArrayBuffer or SharedArrayBuffer\"\nECMA_ERR_ARGUMENT_BUFFER_NOT_OBJECT = \"Argument 'buffer' is not an object\"\nECMA_ERR_ARGUMENT_THIS_NOT_ARRAY_BUFFER_OBJECT = \"Argument 'this' is not an ArrayBuffer object\"\nECMA_ERR_ARGUMENT_THIS_NOT_BOOLEAN_OBJECT = \"Argument 'this' is not a Boolean object\"\nECMA_ERR_ARGUMENT_THIS_NOT_DATE_OBJECT = \"Argument 'this' is not a Date object\"\nECMA_ERR_ARGUMENT_THIS_NOT_PROMISE = \"Argument 'this' is not a Promise\"\nECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER = \"Argument 'this' is not a SharedArrayBuffer object\"\nECMA_ERR_ARGUMENT_THIS_NOT_TYPED_ARRAY = \"Argument 'this' is not a TypedArray\"\nECMA_ERR_ARGUMENT_THIS_NOT_CONSTRUCTOR = \"Argument 'this' is not a constructor\"\nECMA_ERR_ARGUMENT_THIS_NOT_FUNCTION = \"Argument 'this' is not a function\"\nECMA_ERR_ARGUMENT_THIS_NOT_GENERATOR_OBJECT = \"Argument 'this' is not a generator object\"\nECMA_ERR_ARGUMENT_THIS_NOT_NUMBER = \"Argument 'this' is not a number or a Number object\"\nECMA_ERR_ARGUMENT_THIS_NOT_STRING_OBJECT = \"Argument 'this' is not a string or a String object\"\nECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP = \"Argument 'this' is not a valid RegExp\"\nECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP_OBJECT = \"Argument 'this' is not a valid RegExp object\"\nECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER_OBJECT = \"Argument 'this' is not an SharedArrayBuffer object\"\nECMA_ERR_ARGUMENT_THIS_NOT_ASYNC_GENERATOR = \"Argument 'this' is not an async generator object\"\nECMA_ERR_ARGUMENT_THIS_NOT_ITERATOR = \"Argument 'this' is not an iterator\"\nECMA_ERR_ARGUMENT_THIS_NOT_OBJECT = \"Argument 'this' is not an object\"\nECMA_ERR_ARGUMENT_THIS_NOT_SYMBOL = \"Argument 'this' must be a Symbol\"\nECMA_ERR_ARGUMENT_CANNOT_CONVERT_TO_OBJECT = \"Argument cannot be converted to an object\"\nECMA_ERR_ARGUMENT_NOT_ARRAY_BUFFER = \"Argument is not an ArrayBuffer\"\nECMA_ERR_ARGUMENT_NOT_SUPPORTED = \"Argument is not supported\"\nECMA_ERR_ARRAY_BUFFER_DETACHED = \"ArrayBuffer has already been detached\"\nECMA_ERR_ARRAY_BUFFER_RETURNED_THIS_FROM_CONSTRUCTOR = \"ArrayBuffer subclass returned this from species constructor\"\nECMA_ERR_BIGINT_SERIALIZED = \"BigInt cannot be serialized\"\nECMA_ERR_BIGINT_ZERO_DIVISION = \"BigInt division by zero\"\nECMA_ERR_BIGINT_FUNCTION_NOT_CONSTRUCTOR = \"BigInt function is not a constructor\"\nECMA_ERR_BIGINT_VALUE_EXCPECTED = \"BigInt value expected\"\nECMA_ERR_BINDING_CANNOT_SET = \"Binding cannot be set\"\nECMA_ERR_BINDING_NOT_EXIST_OR_UNINITIALIZED = \"Binding does not exist or is uninitialised\"\nECMA_ERR_BULTIN_ROUTINES_HAVE_NO_CONSTRUCTOR = \"Built-in routines have no constructor\"\nECMA_ERR_CALLBACK_RESULT_NOT_MODULE = \"Callback result must be a module\"\nECMA_ERR_ALLOCATE_ARRAY_BUFFER = \"Cannot allocate memory for ArrayBuffer\"\nECMA_ERR_ALLOCATE_BIGINT_VALUE = \"Cannot allocate memory for a BigInt value\"\nECMA_ERR_ALLOCATE_BIGINT_STRING = \"Cannot allocate memory for a string representation of a BigInt value\"\nECMA_ERR_CONVERT_BIGINT_TO_NUMBER = \"Cannot convert a BigInt value to a number\"\nECMA_ERR_CONVERT_SYMBOL_TO_NUMBER = \"Cannot convert a Symbol value to a number\"\nECMA_ERR_CONVERT_SYMBOL_TO_STRING = \"Cannot convert a Symbol value to a string\"\nECMA_ERR_CANNOT_CREATE_PROXY = \"Cannot create Proxy with a non-object target or handler\"\nECMA_ERR_INVOKE_NULLABLE_SUPER_METHOD = \"Cannot invoke nullable super method\"\nECMA_ERR_LINK_TO_MODULE_IN_ERROR_STATE = \"Cannot link to a module which is in error state\"\nECMA_ERR_SET_EXTENSIBLE_PROPERTY = \"Cannot set [[Extensible]] property of object\"\nECMA_ERR_SET_PROTOTYPE = \"Cannot set [[Prototype]]\"\nECMA_ERR_CLASS_CONSTRUCTOR_REQUIRES_NEW = \"Class constructor requires 'new'\"\nECMA_ERR_CLASS_EXTENDS_NOT_CONSTRUCTOR = \"Class extends value is not a constructor or null\"\nECMA_ERR_COMPARE_FUNC_NOT_CALLABLE = \"Compare function is not callable\"\nECMA_ERR_CONSTANT_BINDINGS_CANNOT_BE_REASSIGNED = \"Constant bindings cannot be reassigned\"\nECMA_ERR_TYPEDARRAY_SMALLER_THAN_FILTER_CALL_RESULT = \"Constructed TypedArray is smaller than filter call result\"\nECMA_ERR_CONSTRUCTED_OBJECT_IS_NOT_TYPEDARRAY = \"Constructed object is not TypedArray\"\nECMA_ERR_CONSTRUCTOR_ARRAYBUFFER_REQUIRES_NEW = \"Constructor ArrayBuffer requires 'new'\"\nECMA_ERR_CONSTRUCTOR_BIGINT64_ARRAY_REQUIRES_NEW = \"Constructor BigInt64Array requires 'new'\"\nECMA_ERR_CONSTRUCTOR_BIG_UINT64_ARRAY_REQUIRES_NEW = \"Constructor BigUInt64Array requires 'new'\"\nECMA_ERR_CONSTRUCTOR_DATAVIEW_REQUIRES_NEW = \"Constructor DataView requires 'new'\"\nECMA_ERR_CONSTRUCTOR_FLOAT32_ARRAY_REQUIRES_NEW = \"Constructor Float32Array requires 'new'\"\nECMA_ERR_CONSTRUCTOR_FLOAT64_ARRAY_REQUIRES_NEW = \"Constructor Float64Array requires 'new'\"\nECMA_ERR_CONSTRUCTOR_INT16_ARRAY_REQUIRES_NEW = \"Constructor Int16Array requires 'new'\"\nECMA_ERR_CONSTRUCTOR_INT32_ARRAY_REQUIRES_NEW = \"Constructor Int32Array requires 'new'\"\nECMA_ERR_CONSTRUCTOR_INT8_ARRAY_REQUIRES_NEW = \"Constructor Int8Array requires 'new'\"\nECMA_ERR_CONSTRUCTOR_MAP_REQUIRES_NEW = \"Constructor Map requires 'new'\"\nECMA_ERR_CONSTRUCTOR_PROMISE_REQUIRES_NEW = \"Constructor Promise requires 'new'\"\nECMA_ERR_CONSTRUCTOR_PROXY_REQUIRES_NEW = \"Constructor Proxy requires 'new'\"\nECMA_ERR_CONSTRUCTOR_SET_REQUIRES_NEW = \"Constructor Set requires 'new'\"\nECMA_ERR_CONSTRUCTOR_SHAREDARRAYBUFFER_REQUIRES_NEW = \"Constructor SharedArrayBuffer requires 'new'\"\nECMA_ERR_CONSTRUCTOR_UINT16_ARRAY_REQUIRES_NEW = \"Constructor Uint16Array requires 'new'\"\nECMA_ERR_CONSTRUCTOR_UINT32_ARRAY_REQUIRES_NEW = \"Constructor Uint32Array requires 'new'\"\nECMA_ERR_CONSTRUCTOR_UINT8_ARRAY_REQUIRES_NEW = \"Constructor Uint8Array requires 'new'\"\nECMA_ERR_CONSTRUCTOR_UINT8_CLAMPED_ARRAY_REQUIRES_NEW = \"Constructor Uint8ClampedArray requires 'new'\"\nECMA_ERR_CONSTRUCTOR_WEAKMAP_REQUIRES_NEW = \"Constructor WeakMap requires 'new'\"\nECMA_ERR_CONSTRUCTOR_WEAKREF_REQUIRES_NEW = \"Constructor WeakRef requires 'new'.\"\nECMA_ERR_CONSTRUCTOR_WEAKSET_REQUIRES_NEW = \"Constructor WeakSet requires 'new'\"\nECMA_ERR_CONSTRUCTOR_NOT_AN_OBJECT = \"Constructor must be an object\"\nECMA_ERR_CONTAINER_IS_NOT_A_CONTAINER_OBJECT = \"Container is not a container object.\"\nECMA_ERR_CONTAINER_IS_NOT_AN_OBJECT = \"Container is not an object.\"\nECMA_ERR_DATE_MUST_BE_A_FINITE_NUMBER = \"Date must be a finite number\"\nECMA_ERR_DERIVED_ARRAY_BUFFER_CTOR_BUFFER_TOO_SMALL = \"Derived ArrayBuffer constructor created a too small buffer\"\nECMA_ERR_DERIVED_CTOR_RETURN_NOR_OBJECT_OR_UNDEFINED = \"Derived constructors may only return object or undefined\"\nECMA_ERR_INVALID_CODE_POINT_ERROR = \"Error: Invalid code point\"\nECMA_ERR_EXPECTED_A_DATAVIEW_OBJECT = \"Expected a DataView object\"\nECMA_ERR_EXPECTED_A_CONFIGURABLE_PROPERTY = \"Expected a configurable property\"\nECMA_ERR_EXPECTED_A_FUNCTION_OBJECT = \"Expected a function object\"\nECMA_ERR_EXPECTED_AN_ARRAYBUFFER = \"Expected an ArrayBuffer\"\nECMA_ERR_EXPECTED_AN_OBJECT = \"Expected an object\"\nECMA_ERR_FIRST_ARGUMENT_IS_NOT_A_REALM = \"First argument is not a realm\"\nECMA_ERR_FIRST_PARAMETER_MUST_BE_CALLABLE = \"First parameter must be callable\"\nECMA_ERR_FRACTION_DIGITS_OUT_OF_RANGE = \"Fraction digits must be between 0 and 100\"\nECMA_ERR_FUNCTION_ADD_ORSET_IS_NOT_CALLABLE = \"Function add/set is not callable\"\nECMA_ERR_FUNCTION_INDEX_IS_HIGHER_THAN_MAXIMUM = \"Function index is higher than maximum\"\nECMA_ERR_FUNCTION_PROTOTYPE_NOT_A_CONSTRUCTOR = \"Function.prototype is not a constructor\"\nECMA_ERR_GENERATOR_IS_CURRENTLY_UNDER_EXECUTION = \"Generator is currently under execution\"\nECMA_ERR_GETTER_IS_NOT_CALLABLE = \"Getter is not callable\"\nECMA_ERR_GIVEN_PROPERTY_IS_A_NON_CONFIGURABLE = \"Given property is a non-configurable data property on the proxy target\"\nECMA_ERR_HANDLER_CANNOT_BE_NULL = \"Handler cannot be null\"\nECMA_ERR_IMPORTED_BINDING_SHADOWS_LOCAL_VARIABLE = \"Imported binding shadows local variable\"\nECMA_ERR_INCOMPATIBLE_TYPEDARRAY_TYPES = \"Incompatible TypedArray types\"\nECMA_ERR_INCORRECT_TYPE_FOR_TYPEDARRAY = \"Incorrect type for TypedArray\"\nECMA_ERR_INCORRECT_RETURN_PROXY_GET_TRAP = \"Incorrect value is returned by a Proxy 'get' trap\"\nECMA_ERR_INCORRECT_RETURN_PROXY_SET_TRAP = \"Incorrect value is returned by a Proxy 'set' trap\"\nECMA_ERR_INFINITY_OR_NAN_CANNOT_BE_CONVERTED_TO_BIGINT = \"Infinity or NaN cannot be converted to BigInt\"\nECMA_ERR_INITIAL_VALUE_CANNOT_BE_UNDEFINED = \"Initial value cannot be undefined\"\nECMA_ERR_INVALID_ARRAYBUFFER_LENGTH = \"Invalid ArrayBuffer length\"\nECMA_ERR_INVALID_JSON_FORMAT = \"Invalid JSON format\"\nECMA_ERR_INVALID_REGEXP_FLAGS = \"Invalid RegExp flags\"\nECMA_ERR_INVALID_SHARED_ARRAYBUFFER_LENGTH = \"Invalid Shared ArrayBuffer length\"\nECMA_ERR_INVALID_TYPEDARRAY_LENGTH = \"Invalid TypedArray length\"\nECMA_ERR_INVALID_UTF8_CHARACTER = \"Invalid UTF8 character\"\nECMA_ERR_INVALID_UTF8_CODEPOINT = \"Invalid UTF8 codepoint\"\nECMA_ERR_INVALID_UTF8_STRING = \"Invalid UTF8 string\"\nECMA_ERR_INVALID_ENCODING = \"Invalid encoding\"\nECMA_ERR_INVALID_ARGUMENT = \"Invalid argument\"\nECMA_ERR_INVALID_ARGUMENT_TYPE_IN_TOPRIMITIVE = \"Invalid argument type in toPrimitive\"\nECMA_ERR_INVALID_CAPABILITY = \"Invalid capability\"\nECMA_ERR_INVALID_CHARACTER_CLASS = \"Invalid character class\"\nECMA_ERR_INVALID_CODE_POINT = \"Invalid code point\"\nECMA_ERR_INVALID_CONTAINER_TYPE = \"Invalid container type\"\nECMA_ERR_INVALID_CONTROL_ESCAPE_SEQUENCE = \"Invalid control escape sequence\"\nECMA_ERR_INVALID_COUNT_VALUE = \"Invalid count value\"\nECMA_ERR_INVALID_ESCAPE = \"Invalid escape\"\nECMA_ERR_INVALID_ESCAPE_SEQUENCE = \"Invalid escape sequence\"\nECMA_ERR_INVALID_GROUP = \"Invalid group\"\nECMA_ERR_INVALID_HEX_ESCAPE_SEQUENCE = \"Invalid hex escape sequence\"\nECMA_ERR_INVALID_HEXADECIMAL_VALUE = \"Invalid hexadecimal value\"\nECMA_ERR_INVALID_LENGTH = \"Invalid length\"\nECMA_ERR_INVALID_NEW_ARRAY_LENGTH = \"Invalid new Array length\"\nECMA_ERR_INVALID_OFFSET = \"Invalid offset\"\nECMA_ERR_INVALID_OR_OUT_OF_RANGE_INDEX = \"Invalid or out-of-range index\"\nECMA_ERR_INVALID_QUANTIFIER = \"Invalid quantifier\"\nECMA_ERR_INVALID_RANGE_OF_INDEX = \"Invalid range of index\"\nECMA_ERR_INVALID_SCOPE_CHAIN_INDEX_FOR_EVAL = \"Invalid scope chain index for eval\"\nECMA_ERR_INVALID_SPECIES_CONSTRUCTOR = \"Invalid species constructor\"\nECMA_ERR_INVALID_STRING_ = \"Invalid string length\"\nECMA_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE = \"Invalid unicode escape sequence\"\nECMA_ERR_ITERATOR_NEXT_IS_NOT_CALLABLE = \"Iterator 'next' is not callable\"\nECMA_ERR_ITERATOR_RETURN_RESULT_IS_NOT_OBJECT = \"Iterator 'return' result is not object\"\nECMA_ERR_ITERATOR_THROW_IS_NOT_AVAILABLE = \"Iterator 'throw' is not available\"\nECMA_ERR_ITERATOR_IS_NOT_AN_OBJECT = \"Iterator is not an object\"\nECMA_ERR_ITERATOR_IS_NOT_CALLABLE = \"Iterator is not callable\"\nECMA_ERR_ITERATOR_RESULT_IS_NOT_AN_OBJECT = \"Iterator result is not an object\"\nECMA_ERR_ITERATOR_VALUE_IS_NOT_AN_OBJECT = \"Iterator value is not an object\"\nECMA_ERR_JSON_STRING_PARSE_ERROR = \"JSON string parse error\"\nECMA_ERR_JSON_STRINGIFY_ERROR = \"JSON stringify error\"\nECMA_ERR_KEY_MUST_BE_AN_OBJECT = \"Key must be an object\"\nECMA_ERR_LONE_QUANTIFIER_BRACKET = \"Lone quantifier bracket\"\nECMA_ERR_MAXIMUM_TYPEDARRAY_SIZE_IS_REACHED = \"Maximum TypedArray size is reached\"\nECMA_ERR_MAXIMUM_STRING_LENGTH_IS_REACHED = \"Maximum string length is reached\"\nECMA_ERR_MISSING_ARRAY_ELEMENT = \"Missing Array element\"\nECMA_ERR_MODULE_CANNOT_BE_INSTANTIATED = \"Module cannot be instantiated\"\nECMA_ERR_MODULE_EXPORTS_MUST_BE_STRING_VALUES = \"Module exports must be string values\"\nECMA_ERR_MODULE_EXPORTS_MUST_BE_VALID_IDENTIFIERS = \"Module exports must be valid identifiers\"\nECMA_ERR_MODULE_IS_IN_ERROR_STATE = \"Module is in error state\"\nECMA_ERR_MODULE_MUST_BE_IN_LINKED_STATE = \"Module must be in linked state\"\nECMA_ERR_MODULE_MUST_BE_IN_UNLINKED_STATE = \"Module must be in unlinked state\"\nECMA_ERR_CALL_SUPER_CONSTRUCTOR_DERIVED_CLASS_BEFORE_THIS = \"Must call super constructor in derived class before accessing 'this' or returning from it\"\nECMA_ERR_NAMESPACE_OBJECT_IS_NOT_AVAILABLE = \"Namespace object is not available\"\nECMA_ERR_NEGATIVE_EXPONENT_IS_NOT_ALLOWED_FOR_BIGINTS = \"Negative exponent is not allowed for BigInts\"\nECMA_ERR_NO_SOURCE_ARGUMENT = \"No source argument\"\nECMA_ERR_NOTHING_TO_REPEAT = \"Nothing to repeat\"\nECMA_ERR_OBJECT_CANNOT_BE_FROZEN = \"Object cannot be frozen\"\nECMA_ERR_OBJECT_CANNOT_BE_SEALED = \"Object cannot be sealed\"\nECMA_ERR_OBJECT_EXPECTED = \"Object expected\"\nECMA_ERR_OBJECT_IS_NOT_A_TYPEDARRAY = \"Object is not a TypedArray\"\nECMA_ERR_ONLY_INTEGER_NUMBERS_CAN_BE_CONVERTED_TO_BIGINT = \"Only integer numbers can be converted to BigInt\"\nECMA_ERR_OPERATOR_DELETE_RETURNED_FALSE_IN_STRICT_MODE = \"Operator delete returned false in strict mode\"\nECMA_ERR_PASSED_ARGUMENT_IS_NOT_A_REALM = \"Passed argument is not a realm\"\nECMA_ERR_PRECISION_DIGITS_MUST_BE_BETWEEN_IN_RANGE = \"Precision digits must be between 1 and 100\"\nECMA_ERR_PROMISE_ALL_REMAINING_ELEMENTS_LIMIT_REACHED = \"Promise.all remaining elements limit reached\"\nECMA_ERR_PROPERTY_PROTOTYPE_IS_NOT_AN_OBJECT = \"Property 'prototype' is not an object or null\"\nECMA_ERR_PROPERTY_NAME_IS_NEITHER_SYMBOL_NOR_STRING = \"Property name is neither Symbol nor string\"\nECMA_ERR_PROXY_PROPERTY_NOT_CONFIGURABLE_NOT_HAVE_GETTER = \"Property of a Proxy is non-configurable and does not have a getter function\"\nECMA_ERR_PROTOTYPE_FROM_REVOKED_PROXY_IS_INVALID = \"Prototype from revoked Proxy is invalid\"\nECMA_ERR_PROTOTYPE_IS_NEITHER_OBJECT_NOR_NULL = \"Prototype is neither object nor null\"\nECMA_ERR_PROXY_HANDLER_IS_NULL_FOR_ISARRAY_OPERATION = \"Proxy handler is null for 'isArray' operation\"\nECMA_ERR_PROXY_IS_NOT_SUPPORTED = \"Proxy is not supported\"\nECMA_ERR_TARGET_NOT_EXTENSIBLE_NOT_RETURNED_ITS_PROTOTYPE = \"Proxy target is non-extensible, but the trap did not return its actual prototype\"\nECMA_ERR_PROXY_TRAP_RETURNED_FALSISH = \"Proxy trap returned falsish\"\nECMA_ERR_PUSHING_TOO_HIGH_ELEMENT = \"Pushing element over 2**53-1 length is disallowed\"\nECMA_ERR_MIN_GREATER_THAN_MAX = \"Quantifier error: min > max\"\nECMA_ERR_RADIX_IS_OUT_OF_RANGE = \"Radix must be between 2 and 36\"\nECMA_ERR_RANGE_OUT_OF_ORDER_IN_CHARACTER_CLASS = \"Range out of order in character class\"\nECMA_ERR_REALM_IS_NOT_AVAILABLE = \"Realm is not available\"\nECMA_ERR_REALMS_ARE_DISABLED = \"Realms are disabled\"\nECMA_ERR_REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE = \"Reduce of empty Array with no initial value\"\nECMA_ERR_REFLECT_EXPECTS_AN_OBJECT_AS_SECOND_ARGUMENT = \"Reflect.construct expects an object as second argument\"\nECMA_ERR_REGEXP_ARGUMENT_SHOULD_HAVE_GLOBAL_FLAG = \"RegExp argument should have global flag\"\nECMA_ERR_REGEXP_IS_NOT_SUPPORTED = \"RegExp is not supported\"\nECMA_ERR_REJECT_MUST_BE_UNDEFINED = \"Reject must be undefined\"\nECMA_ERR_REQUEST_IS_NOT_AVAILABLE = \"Request is not available\"\nECMA_ERR_RESOLVE_METHOD_MUST_BE_CALLABLE = \"Resolve method must be callable\"\nECMA_ERR_RESOLVE_MUST_BE_UNDEFINED = \"Resolve must be undefined\"\nECMA_ERR_RESULT_OF_DEFAULTVALUE_IS_INVALID = \"Result of [[DefaultValue]] is invalid\"\nECMA_ERR_RETURN_VALUE_IS_NOT_AN_ARRAYBUFFER_OBJECT = \"Return value is not an ArrayBuffer object\"\nECMA_ERR_RETURN_VALUE_OF_EXEC_MUST_BE_AN_OBJECT_OR_NULL = \"Return value of 'exec' must be an object or null\"\nECMA_ERR_RIGHT_VALUE_OF_IN_MUST_BE_AN_OBJECT = \"Right value of 'in' must be an object\"\nECMA_ERR_RIGHT_VALUE_OF_INSTANCEOF_MUST_BE_AN_OBJECT = \"Right value of 'instanceof' must be an object\"\nECMA_ERR_SEARCH_STRING_CANNOT_BE_OF_TYPE_REGEXP = \"Search string can't be of type: RegExp\"\nECMA_ERR_SECOND_ARGUMENT_MUST_BE_AN_OBJECT = \"Second argument must be an object\"\nECMA_ERR_SPECIES_MUST_BE_A_CONSTRUCTOR = \"Species must be a constructor\"\nECMA_ERR_STACK_LIMIT_EXCEEDED = \"Stack limit exceeded\"\nECMA_ERR_START_OFFSET_IS_OUTSIDE_THE_BOUNDS_OF_THE_BUFFER = \"Start offset is outside the bounds of the buffer\"\nECMA_ERR_STATIC_SNAPSHOTS_ARE_NOT_ENABLED = \"Static snapshots are not enabled\"\nECMA_ERR_STATIC_SNAPSHOTS_CANNOT_BE_COPIED_INTO_MEMORY = \"Static snapshots cannot be copied into memory\"\nECMA_ERR_STRING_CANNOT_BE_CONVERTED_TO_BIGINT_VALUE = \"String cannot be converted to BigInt value\"\nECMA_ERR_SUPER_BINDING_MUST_BE_A_CONSTRUCTOR = \"Super binding must be a constructor\"\nECMA_ERR_SUPER_CONSTRUCTOR_MAY_ONLY_BE_CALLED_ONCE = \"Super constructor may only be called once\"\nECMA_ERR_SYMBOL_IS_NOT_A_CONSTRUCTOR = \"Symbol is not a constructor\"\nECMA_ERR_TARGET_IS_NOT_OBJECT = \"Target is not Object\"\nECMA_ERR_TARGET_IS_NOT_WEAKREF = \"Target is not weakRef\"\nECMA_ERR_TARGET_NOT_EXTENSIBLE = \"Target not extensible\"\nECMA_ERR_TARGET_NOT_EXTENSIBLE_DIFFERENT_PROTOTYPE_RETURNED = \"Target object is non-extensible and trap returned different prototype\"\nECMA_ERR_THE_MAPFN_ARGUMENT_IS_NOT_CALLABLE = \"The 'mapfn' argument is not callable\"\nECMA_ERR_THE_GIVEN_ARGUMENT_IS_NOT_A_SYMBOL = \"The given argument is not a Symbol\"\nECMA_ERR_TARGET_PROPERTY_CONFIGURE_ACCESSOR_WITHOUT_SETTER = \"The property of a Proxy target is a non configurable accessor without a setter\"\nECMA_ERR_THE_REQUESTED_PROPERTY_UPDATE_CANNOT_BE_PERFORMED = \"The requested property update cannot be performed\"\nECMA_ERR_THE_STRUCTURE_IS_CYCLICAL = \"The structure is cyclical\"\nECMA_ERR_THE_TWO_DESCRIPTORS_ARE_INCOMPATIBLE = \"The two descriptors are incompatible\"\nECMA_ERR_TOO_MANY_ARGUMENTS_DECLARED_FOR_FUNCTION_APPLY = \"Too many arguments declared for Function.apply\"\nECMA_ERR_TRAP_IS_NEITHER_AN_OBJECT_NOR_UNDEFINED = \"Trap is neither an object nor undefined\"\nECMA_ERR_TRAP_MUST_RETURN_WITH_AN_OBJECT = \"Trap must return with an object\"\nECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_CONFIGURABLE_KEYS = \"Trap result did not include all configurable keys\"\nECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_NON_CONFIGURABLE_KEYS = \"Trap result did not include all non-configurable keys\"\nECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_EXTENSIBILITY = \"Trap result does not reflect extensibility of Proxy target\"\nECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_INEXTENSIBILITY = \"Trap result does not reflect inextensibility of Proxy target\"\nECMA_ERR_TRAP_EXTRA_KEYS_FOR_A_NON_EXTENSIBLE_TARGET = \"Trap returned extra keys for a non-extensible Proxy target\"\nECMA_ERR_TRAP_FALSISH_PROPERTY_TARGET_NOT_EXTENSIBLE = \"Trap returned falsish for property but the proxy target is not extensible\"\nECMA_ERR_TRAP_FALSISH_PROPERTY_NON_CONFIGURABLE = \"Trap returned falsish for property which exists in the proxy target as non-configurable\"\nECMA_ERR_TRAP_RETURNED_NEITHER_OBJECT_NOR_NULL = \"Trap returned neither object nor null\"\nECMA_ERR_TRAP_TRUISH_ADDING_PROPERTY_NON_EXTENSIBLE_TARGET = \"Trap returned truish for adding property to the non-extensible target\"\nECMA_ERR_TRAP_TRUISH_ADD_PROPERTY_INCOMPATIBLE_OTHER_PROP = \"Trap returned truish for adding property that is incompatible with the existing property in the target\"\nECMA_ERR_TRAP_TRUISH_DEFINING_NON_EXISTENT_PROPERTY = \"Trap returned truish for defining non-configurable property which is non-existent in the target\"\nECMA_ERR_TRAP_TRUISH_PROPERTY_NON_CONFIGURABLE = \"Trap returned truish for property which is non-configurable in the proxy target\"\nECMA_ERR_TRAP_TRUISH_TARGET_NOT_EXTENSIBLE = \"Trap returned truish for target is not extensible\"\nECMA_ERR_TRAP_WITH_DUPLICATED_ENTRIES = \"Trap returned with duplicated entries\"\nECMA_ERR_TYPEDARRAY_INTRINSTIC_CALLED_BY_NEW_EXPRESSION = \"TypedArray intrinstic cannot be called by a 'new' expression\"\nECMA_ERR_TYPEDARRAY_INTRINSTIC_DIRECTLY_CALLED = \"TypedArray intrinstic cannot be directly called\"\nECMA_ERR_CONTENTTYPE_RETURNED_TYPEDARRAY_NOT_MATCH_SOURCE = \"TypedArray returned by [[ContentType]] does not match source\"\nECMA_ERR_UNARY_PLUS_IS_NOT_ALLOWED_FOR_BIGINTS = \"Unary plus is not allowed for BigInts\"\nECMA_ERR_UNDEFINED_REFERENCE = \"Undefined reference\"\nECMA_ERR_UNEXPECTED_END_OF_PATTERN = \"Unexpected end of pattern\"\nECMA_ERR_UNICODE_SURROGATE_PAIR_MISSING = \"Unicode surrogate pair missing\"\nECMA_ERR_UNMATCHED_CLOSE_BRACKET = \"Unmatched close bracket\"\nECMA_ERR_UNSHIFT_TOO_HIGH = \"Unshift elements over 2**53-1 length is disallowed\"\nECMA_ERR_UNSIGNED_RIGHT_SHIFT_IS_NOT_ALLOWED_FOR_BIGINTS = \"Unsigned right shift is not allowed for BigInts\"\nECMA_ERR_UNSUPPORTED_BINARY_OPERATION = \"Unsupported binary operation\"\nECMA_ERR_UNSUPPORTED_CONTAINER_OPERATION = \"Unsupported container operation\"\nECMA_ERR_UNSUPPORTED_SNAPSHOT_EXEC_FLAGS_ARE_SPECIFIED = \"Unsupported snapshot exec flags are specified\"\nECMA_ERR_UNTERMINATED_CHARACTER_CLASS = \"Unterminated character class\"\nECMA_ERR_UNTERMINATED_GROUP = \"Unterminated group\"\nECMA_ERR_VALUE_CANNOT_BE_CONVERTED_TO_BIGINT = \"Value cannot be converted to BigInt\"\nECMA_ERR_VALUE_FOR_CLASS_HERITAGE_IS_NOT_A_CONSTRUCTOR = \"Value for class heritage is not a constructor\"\nECMA_ERR_VALUE_RECEIVED_BY_FOR_ASYNC_OF_IS_NOT_OBJECT = \"Value received by for-async-of is not object\"\nECMA_ERR_VALUE_RECEIVED_BY_YIELD_IS_NOT_OBJECT = \"Value received by yield* is not object\"\nECMA_ERR_WEAKREF_TARGET_MUST_BE_AN_OBJECT = \"WeakRef target must be an object\"\nECMA_ERR_METHOD_RETURN_IS_NOT_CALLABLE = \"method 'return' is not callable\"\nECMA_ERR_VALUE_MSG = \"Argument cannot be marked as error\"\nECMA_ERR_WRONG_ARGS_MSG = \"This type of argument is not allowed\"\nECMA_ERR_PARSER_NOT_SUPPORTED = \"Source code parsing is disabled\"\nECMA_ERR_JSON_NOT_SUPPORTED = \"JSON support is disabled\"\nECMA_ERR_TYPED_ARRAY_NOT_SUPPORTED = \"TypedArray support is disabled\"\nECMA_ERR_SHARED_ARRAYBUFFER_NOT_SUPPORTED = \"SharedArrayBuffer support is disabled\"\nECMA_ERR_DATA_VIEW_NOT_SUPPORTED = \"DataView support is disabled\"\nECMA_ERR_BIGINT_NOT_SUPPORTED = \"BigInt support is disabled\"\nECMA_ERR_CONTAINER_NOT_SUPPORTED = \"Container support is disabled\"\nECMA_ERR_NOT_MODULE = \"Argument is not a module\"\nECMA_ERR_UNKNOWN_EXPORT = \"Native module export not found\"\nECMA_ERR_MODULE_NOT_SUPPORTED = \"Module support is disabled\"\nECMA_ERR_CALLBACK_IS_NOT_CALLABLE = \"Callback function is not callable\"\nECMA_ERR_ARRAYBUFFER_IS_DETACHED = \"ArrayBuffer has been detached\"\nECMA_ERR_CANNOT_CONVERT_TO_OBJECT = \"Cannot convert undefined or null to object\"\nECMA_ERR_CLASS_IS_NON_CONFIGURABLE = \"Prototype property of a class is non-configurable\"\nECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT = \"Argument is not an object\"\nECMA_ERR_ARGUMENT_IS_NOT_A_PROXY = \"Argument is not a Proxy object\"\nECMA_ERR_TARGET_IS_NOT_A_CONSTRUCTOR = \"Target is not a constructor\"\nECMA_ERR_ARGUMENT_IS_NOT_AN_REGEXP = \"Argument 'this' is not a RegExp object\"\nECMA_ERR_INVALID_ARRAY_LENGTH = \"Invalid Array length\"\nECMA_ERR_LOCAL_VARIABLE_IS_REDECLARED = \"Local variable is redeclared\"\nECMA_ERR_EXPECTED_A_FUNCTION = \"Expected a function\"\nECMA_ERR_CLASS_CONSTRUCTOR_NEW = \"Class constructor cannot be invoked without 'new'\"\nECMA_ERR_LET_CONST_NOT_INITIALIZED = \"Variables declared by let/const must be initialized before reading their value\"\nECMA_ERR_MAXIMUM_SNAPSHOT_SIZE = \"Maximum snapshot size reached\"\nECMA_ERR_REGULAR_EXPRESSION_NOT_SUPPORTED = \"Regular expression literals are not supported\"\nECMA_ERR_SNAPSHOT_BUFFER_SMALL = \"Snapshot buffer too small\"\nECMA_ERR_SNAPSHOT_UNSUPPORTED_COMPILED_CODE = \"Unsupported compiled code\"\nECMA_ERR_SNAPSHOT_FLAG_NOT_SUPPORTED = \"Unsupported generate snapshot flags specified\"\nECMA_ERR_SNAPSHOT_SAVE_DISABLED = \"Snapshot generation is disabled\"\nECMA_ERR_SNAPSHOT_EXEC_DISABLED = \"Snapshot execution is disabled\"\nECMA_ERR_CANNOT_ALLOCATE_MEMORY_LITERALS = \"Cannot allocate memory for literals\"\nECMA_ERR_TAGGED_TEMPLATE_LITERALS = \"Unsupported feature: tagged template literals\"\nECMA_ERR_CONTAINER_NEEDED = \"Value is not a Container or Iterator\"\nECMA_ERR_INCORRECT_TYPE_CALL =  \"Operator called on incorrect container type\"\nECMA_ERR_INVALID_TYPE_FOR_CONSTRUCTOR_CALL = \"Invalid type for constructor call\"\nECMA_ERR_SCRIPT_GLOBAL_FUNCTIONS_INVOKE_WITH_NEW = \"Script (global) functions cannot be invoked with 'new'\"\nECMA_ERR_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW = \"Generator functions cannot be invoked with 'new'\"\nECMA_ERR_ASYNC_FUNCTIONS_INVOKE_WITH_NEW = \"Async functions cannot be invoked with 'new'\"\nECMA_ERR_ASYNC_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW = \"Async generator functions cannot be invoked with 'new'\"\nECMA_ERR_ACCESSOR_FUNCTIONS_INVOKE_WITH_NEW = \"Accessor functions cannot be invoked with 'new'\"\nECMA_ERR_METHODS_INVOKE_WITH_NEW = \"Methods cannot be invoked with 'new'\"\nECMA_ERR_ARROW_FUNCTIONS_INVOKE_WITH_NEW = \"Arrow functions cannot be invoked with 'new'\"\nECMA_ERR_ASYNC_ARROW_FUNCTIONS_INVOKE_WITH_NEW = \"Async arrow functions cannot be invoked with 'new'\"\nECMA_ERR_PROXY_TARGET_IS_NOT_A_CONSTRUCTOR = \"Proxy target is not a constructor\"\nECMA_ERR_MAXIMUM_CALL_STACK_SIZE_EXCEEDED = \"Maximum call stack size exceeded\"\nECMA_ERR_INVALID_SNAPSHOT_FORMAT = \"Invalid snapshot format\"\nECMA_ERR_INVALID_SNAPSHOT_VERSION_OR_FEATURES = \"Invalid snapshot version or unsupported features present\"\nECMA_ERR_RECEIVER_MUST_BE_AN_OBJECT = \"Receiver must be an object\"\nECMA_ERR_CANNOT_DECLARE_SAME_PRIVATE_FIELD_TWICE = \"Cannot declare same private field twice\"\nECMA_ERR_CANNOT_WRITE_PRIVATE_MEMBER_TO_AN_OBJECT_WHOSE_CLASS_DID_NOT_DECLARE_IT = \"Cannot write private member to an object whose class did not declare it\"\nECMA_ERR_PRIVATE_METHOD_IS_NOT_WRITABLE = \"Private method is not writable\"\nECMA_ERR_PRIVATE_FIELD_WAS_DEFINED_WITHOUT_A_SETTER = \"Private field was defined without a setter\"\nECMA_ERR_CANNOT_READ_PRIVATE_MEMBER_TO_AN_OBJECT_WHOSE_CLASS_DID_NOT_DECLARE_IT = \"Cannot read private member to an object whose class did not declare it\"\nECMA_ERR_PRIVATE_FIELD_WAS_DEFINED_WITHOUT_A_GETTER = \"Private field was defined without a getter\"\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-errors.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-errors.h\"\n\n#if JERRY_ERROR_MESSAGES\n/**\n * Struct to store ecma error message with its size.\n */\ntypedef struct\n{\n  char *text; /* Text of ecma error message. */\n  uint8_t size; /* Size of ecma error message. */\n} ecma_error_message_t;\n\n/* Error message texts with size. */\nstatic ecma_error_message_t ecma_error_messages[] JERRY_ATTR_CONST_DATA = {\n  { \"\", 0 }, /* ECMA_ERR_EMPTY */\n/** @cond doxygen_suppress */\n#define ECMA_ERROR_DEF(id, string) { string, sizeof (string) - 1 },\n#include \"ecma-error-messages.inc.h\"\n#undef ECMA_ERROR_DEF\n  /** @endcond */\n};\n#endif /* JERRY_ERROR_MESSAGES */\n\n/**\n * Get specified ecma error as zero-terminated string\n *\n * @return pointer to zero-terminated ecma error\n */\nconst char *\necma_get_error_msg (ecma_error_msg_t id) /**< ecma error id */\n{\n  JERRY_ASSERT (id != ECMA_IS_VALID_CONSTRUCTOR);\n\n#if JERRY_ERROR_MESSAGES\n  return ecma_error_messages[id].text;\n#else /* !JERRY_ERROR_MESSAGES */\n  return NULL;\n#endif /* JERRY_ERROR_MESSAGES */\n} /* ecma_get_error_msg */\n\n/**\n * Get size of specified ecma error\n *\n * @return size in bytes\n */\nlit_utf8_size_t\necma_get_error_size (ecma_error_msg_t id) /**< ecma error id */\n{\n  JERRY_ASSERT (id != ECMA_IS_VALID_CONSTRUCTOR);\n\n#if JERRY_ERROR_MESSAGES\n  return ecma_error_messages[id].size;\n#else /* !JERRY_ERROR_MESSAGES */\n  return 0;\n#endif /* JERRY_ERROR_MESSAGES */\n} /* ecma_get_error_size */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-errors.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_ERRORS_H\n#define ECMA_ERRORS_H\n\n#include \"lit-globals.h\"\n\ntypedef enum\n{\n  ECMA_ERR_EMPTY,\n/** @cond doxygen_suppress */\n#if JERRY_ERROR_MESSAGES\n#define ECMA_ERROR_DEF(id, ascii_zt_string) id,\n#else /* !JERRY_ERROR_MESSAGES */\n#define ECMA_ERROR_DEF(id, ascii_zt_string) id = ECMA_ERR_EMPTY,\n#endif /* JERRY_ERROR_MESSAGES */\n#include \"ecma-error-messages.inc.h\"\n#undef ECMA_ERROR_DEF\n  /** @endcond */\n  ECMA_IS_VALID_CONSTRUCTOR /* used as return value when checking constructor */\n} ecma_error_msg_t;\n\nconst char* ecma_get_error_msg (ecma_error_msg_t id);\nlit_utf8_size_t ecma_get_error_size (ecma_error_msg_t id);\n\n#endif /* !ECMA_ERRORS_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-extended-info.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-extended-info.h\"\n\n#include \"ecma-helpers.h\"\n\n#include \"byte-code.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaextendedinfo Extended info\n * @{\n */\n\n/**\n * Decodes an uint32_t number, and updates the buffer position.\n *\n * @return the decoded value\n */\nuint32_t\necma_extended_info_decode_vlq (uint8_t **buffer_p) /**< [in/out] target buffer */\n{\n  uint8_t *source_p = *buffer_p;\n  uint32_t value = 0;\n\n  do\n  {\n    source_p--;\n    value = (value << ECMA_EXTENDED_INFO_VLQ_SHIFT) | (*source_p & ECMA_EXTENDED_INFO_VLQ_MASK);\n  } while (*source_p & ECMA_EXTENDED_INFO_VLQ_CONTINUE);\n\n  *buffer_p = source_p;\n  return value;\n} /* ecma_extended_info_decode_vlq */\n\n/**\n * Encodes an uint32_t number into a buffer.\n */\nvoid\necma_extended_info_encode_vlq (uint8_t **buffer_p, /**< target buffer */\n                               uint32_t value) /**< encoded value */\n{\n  uint8_t *destination_p = *buffer_p - 1;\n\n  if (value <= ECMA_EXTENDED_INFO_VLQ_MASK)\n  {\n    *destination_p = (uint8_t) value;\n    *buffer_p = destination_p;\n    return;\n  }\n\n  uint32_t length = 0;\n  uint32_t current_value = value >> ECMA_EXTENDED_INFO_VLQ_SHIFT;\n\n  do\n  {\n    current_value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT;\n    length++;\n  } while (current_value > 0);\n\n  destination_p -= length;\n  *buffer_p = destination_p;\n\n  do\n  {\n    *destination_p++ = (uint8_t) (value | ECMA_EXTENDED_INFO_VLQ_CONTINUE);\n    value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT;\n  } while (value > 0);\n\n  **buffer_p &= ECMA_EXTENDED_INFO_VLQ_MASK;\n} /* ecma_extended_info_encode_vlq */\n\n/**\n * Gets the encoded length of a number.\n *\n * @return encoded length\n */\nuint32_t\necma_extended_info_get_encoded_length (uint32_t value) /**< encoded value */\n{\n  uint32_t length = 0;\n\n  do\n  {\n    value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT;\n    length++;\n  } while (value > 0);\n\n  return length;\n} /* ecma_extended_info_get_encoded_length */\n\n/**\n * Get the extended info from a byte code\n *\n * @return pointer to the extended info\n */\nuint8_t *\necma_compiled_code_resolve_extended_info (const ecma_compiled_code_t *bytecode_header_p) /**< compiled code */\n{\n  JERRY_ASSERT (bytecode_header_p != NULL);\n  JERRY_ASSERT (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_EXTENDED_INFO);\n\n  ecma_value_t *base_p = ecma_compiled_code_resolve_arguments_start (bytecode_header_p);\n\n  if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)\n  {\n    base_p--;\n  }\n\n  if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)\n  {\n    base_p--;\n  }\n\n#if JERRY_LINE_INFO\n  if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO)\n  {\n    base_p--;\n  }\n#endif /* JERRY_LINE_INFO */\n\n  JERRY_ASSERT (((uint8_t *) base_p)[-1] != 0);\n\n  return ((uint8_t *) base_p) - 1;\n} /* ecma_compiled_code_resolve_extended_info */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-extended-info.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_EXTENDED_INFO_H\n#define ECMA_EXTENDED_INFO_H\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaextendedinfo Extended info\n * @{\n */\n\n#include \"ecma-globals.h\"\n\n/**\n * Vlq encoding: flag which is set for all bytes except the last one.\n */\n#define ECMA_EXTENDED_INFO_VLQ_CONTINUE 0x80\n\n/**\n * Vlq encoding: mask to decode the number fragment.\n */\n#define ECMA_EXTENDED_INFO_VLQ_MASK 0x7f\n\n/**\n * Vlq encoding: number of bits stored in a byte.\n */\n#define ECMA_EXTENDED_INFO_VLQ_SHIFT 7\n\nuint32_t ecma_extended_info_decode_vlq (uint8_t **buffer_p);\nvoid ecma_extended_info_encode_vlq (uint8_t **buffer_p, uint32_t value);\nuint32_t ecma_extended_info_get_encoded_length (uint32_t value);\n\nuint8_t *ecma_compiled_code_resolve_extended_info (const ecma_compiled_code_t *bytecode_header_p);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_EXTENDED_INFO_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-gc.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Garbage collector implementation\n */\n\n#include \"ecma-gc.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-builtin-handlers.h\"\n#include \"ecma-container-object.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-lcache.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-property-hashmap.h\"\n#include \"ecma-proxy-object.h\"\n\n#include \"jcontext.h\"\n#include \"jrt-bit-fields.h\"\n#include \"jrt-libc-includes.h\"\n#include \"jrt.h\"\n#include \"re-compiler.h\"\n#include \"vm-defines.h\"\n#include \"vm-stack.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#include \"ecma-typedarray-object.h\"\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n#include \"ecma-promise-object.h\"\n\n/* TODO: Extract GC to a separate component */\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmagc Garbage collector\n * @{\n */\n\n/*\n * The garbage collector uses the reference counter\n * of object: it increases the counter by one when\n * the object is marked at the first time.\n */\n\n/**\n * Get visited flag of the object.\n *\n * @return true  - if visited\n *         false - otherwise\n */\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\necma_gc_is_object_visited (ecma_object_t *object_p) /**< object */\n{\n  JERRY_ASSERT (object_p != NULL);\n\n  return (object_p->type_flags_refs < ECMA_OBJECT_NON_VISITED);\n} /* ecma_gc_is_object_visited */\n\n/**\n * Mark objects as visited starting from specified object as root\n */\nstatic void ecma_gc_mark (ecma_object_t *object_p);\n\n/**\n * Set visited flag of the object.\n */\nstatic void\necma_gc_set_object_visited (ecma_object_t *object_p) /**< object */\n{\n  if (object_p->type_flags_refs >= ECMA_OBJECT_NON_VISITED)\n  {\n#if (JERRY_GC_MARK_LIMIT != 0)\n    if (JERRY_CONTEXT (ecma_gc_mark_recursion_limit) != 0)\n    {\n      JERRY_CONTEXT (ecma_gc_mark_recursion_limit)--;\n      /* Set the reference count of gray object to 0 */\n      object_p->type_flags_refs &= (ecma_object_descriptor_t) (ECMA_OBJECT_REF_ONE - 1);\n      ecma_gc_mark (object_p);\n      JERRY_CONTEXT (ecma_gc_mark_recursion_limit)++;\n    }\n    else\n    {\n      /* Set the reference count of the non-marked gray object to 1 */\n      object_p->type_flags_refs &= (ecma_object_descriptor_t) ((ECMA_OBJECT_REF_ONE << 1) - 1);\n      JERRY_ASSERT (object_p->type_flags_refs >= ECMA_OBJECT_REF_ONE);\n    }\n#else /* (JERRY_GC_MARK_LIMIT == 0) */\n    /* Set the reference count of gray object to 0 */\n    object_p->type_flags_refs &= (ecma_object_descriptor_t) (ECMA_OBJECT_REF_ONE - 1);\n#endif /* (JERRY_GC_MARK_LIMIT != 0) */\n  }\n} /* ecma_gc_set_object_visited */\n\n/**\n * Initialize GC information for the object\n */\nextern inline void\necma_init_gc_info (ecma_object_t *object_p) /**< object */\n{\n  JERRY_CONTEXT (ecma_gc_objects_number)++;\n  JERRY_CONTEXT (ecma_gc_new_objects)++;\n\n  JERRY_ASSERT (object_p->type_flags_refs < ECMA_OBJECT_REF_ONE);\n  object_p->type_flags_refs |= ECMA_OBJECT_REF_ONE;\n\n  object_p->gc_next_cp = JERRY_CONTEXT (ecma_gc_objects_cp);\n  ECMA_SET_NON_NULL_POINTER (JERRY_CONTEXT (ecma_gc_objects_cp), object_p);\n} /* ecma_init_gc_info */\n\n/**\n * Increase reference counter of an object\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_ref_object_inline (ecma_object_t *object_p) /**< object */\n{\n  if (JERRY_LIKELY (object_p->type_flags_refs < ECMA_OBJECT_MAX_REF))\n  {\n    object_p->type_flags_refs = (ecma_object_descriptor_t) (object_p->type_flags_refs + ECMA_OBJECT_REF_ONE);\n  }\n  else\n  {\n    jerry_fatal (JERRY_FATAL_REF_COUNT_LIMIT);\n  }\n} /* ecma_ref_object_inline */\n\n/**\n * Increase reference counter of an object\n */\nvoid\necma_ref_object (ecma_object_t *object_p) /**< object */\n{\n  ecma_ref_object_inline (object_p);\n} /* ecma_ref_object */\n\n/**\n * Decrease reference counter of an object\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_deref_object (ecma_object_t *object_p) /**< object */\n{\n  JERRY_ASSERT (object_p->type_flags_refs >= ECMA_OBJECT_REF_ONE);\n  object_p->type_flags_refs = (ecma_object_descriptor_t) (object_p->type_flags_refs - ECMA_OBJECT_REF_ONE);\n} /* ecma_deref_object */\n\n/**\n * Mark objects referenced by global object\n */\nstatic void\necma_gc_mark_global_object (ecma_global_object_t *global_object_p) /**< global object */\n{\n  JERRY_ASSERT (global_object_p->extended_object.u.built_in.routine_id == 0);\n\n  ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER (ecma_object_t, global_object_p->global_env_cp));\n\n#if JERRY_BUILTIN_REALMS\n  ecma_gc_set_object_visited (ecma_get_object_from_value (global_object_p->this_binding));\n#endif /* JERRY_BUILTIN_REALMS */\n\n  if (global_object_p->global_scope_cp != global_object_p->global_env_cp)\n  {\n    ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER (ecma_object_t, global_object_p->global_scope_cp));\n  }\n\n  jmem_cpointer_t *builtin_objects_p = global_object_p->builtin_objects;\n\n  for (int i = 0; i < ECMA_BUILTIN_OBJECTS_COUNT; i++)\n  {\n    if (builtin_objects_p[i] != JMEM_CP_NULL)\n    {\n      ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER (ecma_object_t, builtin_objects_p[i]));\n    }\n  }\n} /* ecma_gc_mark_global_object */\n\n/**\n * Mark objects referenced by arguments object\n */\nstatic void\necma_gc_mark_arguments_object (ecma_extended_object_t *ext_object_p) /**< arguments object */\n{\n  JERRY_ASSERT (ecma_get_object_type ((ecma_object_t *) ext_object_p) == ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_unmapped_arguments_t *arguments_p = (ecma_unmapped_arguments_t *) ext_object_p;\n  ecma_gc_set_object_visited (ecma_get_object_from_value (arguments_p->callee));\n\n  ecma_value_t *argv_p = (ecma_value_t *) (arguments_p + 1);\n\n  if (ext_object_p->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED)\n  {\n    ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;\n    argv_p = (ecma_value_t *) (mapped_arguments_p + 1);\n\n    ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env));\n  }\n\n  uint32_t arguments_number = arguments_p->header.u.cls.u3.arguments_number;\n\n  for (uint32_t i = 0; i < arguments_number; i++)\n  {\n    if (ecma_is_value_object (argv_p[i]))\n    {\n      ecma_gc_set_object_visited (ecma_get_object_from_value (argv_p[i]));\n    }\n  }\n} /* ecma_gc_mark_arguments_object */\n\n/**\n * Mark referenced object from property\n */\nstatic void\necma_gc_mark_properties (ecma_object_t *object_p, /**< object */\n                         bool mark_references) /**< mark references */\n{\n  JERRY_UNUSED (mark_references);\n\n#if !JERRY_MODULE_SYSTEM\n  JERRY_ASSERT (!mark_references);\n#endif /* !JERRY_MODULE_SYSTEM */\n\n  jmem_cpointer_t prop_iter_cp = object_p->u1.property_list_cp;\n\n#if JERRY_PROPERTY_HASHMAP\n  if (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n    {\n      prop_iter_cp = prop_iter_p->next_property_cp;\n    }\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n  while (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n    ecma_property_pair_t *property_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n    for (uint32_t index = 0; index < ECMA_PROPERTY_PAIR_ITEM_COUNT; index++)\n    {\n      uint8_t property = property_pair_p->header.types[index];\n\n      if (JERRY_LIKELY (ECMA_PROPERTY_IS_RAW (property)))\n      {\n        if (property & ECMA_PROPERTY_FLAG_DATA)\n        {\n          ecma_value_t value = property_pair_p->values[index].value;\n\n          if (ecma_is_value_object (value))\n          {\n            ecma_gc_set_object_visited (ecma_get_object_from_value (value));\n          }\n          continue;\n        }\n\n#if JERRY_MODULE_SYSTEM\n        if (mark_references)\n        {\n          continue;\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n\n        ecma_property_value_t *accessor_objs_p = property_pair_p->values + index;\n\n        ecma_getter_setter_pointers_t *get_set_pair_p = ecma_get_named_accessor_property (accessor_objs_p);\n\n        if (get_set_pair_p->getter_cp != JMEM_CP_NULL)\n        {\n          ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER (ecma_object_t, get_set_pair_p->getter_cp));\n        }\n\n        if (get_set_pair_p->setter_cp != JMEM_CP_NULL)\n        {\n          ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER (ecma_object_t, get_set_pair_p->setter_cp));\n        }\n\n        continue;\n      }\n\n      if (!ECMA_PROPERTY_IS_INTERNAL (property))\n      {\n        JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_DELETED || property == ECMA_PROPERTY_TYPE_HASHMAP);\n        continue;\n      }\n\n      JERRY_ASSERT (property_pair_p->names_cp[index] >= LIT_INTERNAL_MAGIC_STRING_FIRST_DATA\n                    && property_pair_p->names_cp[index] < LIT_MAGIC_STRING__COUNT);\n\n      switch (property_pair_p->names_cp[index])\n      {\n        case LIT_INTERNAL_MAGIC_STRING_ENVIRONMENT_RECORD:\n        {\n          ecma_environment_record_t *environment_record_p;\n          environment_record_p =\n            ECMA_GET_INTERNAL_VALUE_POINTER (ecma_environment_record_t, property_pair_p->values[index].value);\n\n          if (environment_record_p->this_binding != ECMA_VALUE_UNINITIALIZED)\n          {\n            JERRY_ASSERT (ecma_is_value_object (environment_record_p->this_binding));\n            ecma_gc_set_object_visited (ecma_get_object_from_value (environment_record_p->this_binding));\n          }\n\n          JERRY_ASSERT (ecma_is_value_object (environment_record_p->function_object));\n          ecma_gc_set_object_visited (ecma_get_object_from_value (environment_record_p->function_object));\n          break;\n        }\n        case LIT_INTERNAL_MAGIC_STRING_CLASS_PRIVATE_ELEMENTS:\n        {\n          ecma_value_t *compact_collection_p;\n          compact_collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, property_pair_p->values[index].value);\n\n          ecma_value_t *end_p = ecma_compact_collection_end (compact_collection_p);\n          ecma_value_t *current_p = compact_collection_p + 1;\n\n          while (end_p - current_p >= ECMA_PRIVATE_ELEMENT_LIST_SIZE)\n          {\n            current_p++; /* skip the type */\n            current_p++; /* skip the name */\n            ecma_value_t value = *current_p++;\n\n            if (!ecma_is_value_undefined (value))\n            {\n              ecma_gc_set_object_visited (ecma_get_object_from_value (value));\n            }\n          }\n          break;\n        }\n#if JERRY_BUILTIN_CONTAINER\n        case LIT_INTERNAL_MAGIC_STRING_WEAK_REFS:\n        {\n          ecma_value_t key_arg = ecma_make_object_value (object_p);\n          ecma_collection_t *refs_p;\n\n          refs_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, property_pair_p->values[index].value);\n\n          for (uint32_t j = 0; j < refs_p->item_count; j++)\n          {\n            const ecma_value_t reference_value = refs_p->buffer_p[j];\n\n            if (ecma_is_value_empty (reference_value))\n            {\n              continue;\n            }\n\n            ecma_object_t *reference_object_p = ecma_get_object_from_value (reference_value);\n\n            JERRY_ASSERT (ecma_get_object_type (reference_object_p) == ECMA_OBJECT_TYPE_CLASS);\n\n            ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) reference_object_p;\n\n            if (map_object_p->u.cls.type != ECMA_OBJECT_CLASS_CONTAINER\n                || map_object_p->u.cls.u2.container_id != LIT_MAGIC_STRING_WEAKMAP_UL\n                || !ecma_gc_is_object_visited (reference_object_p))\n            {\n              continue;\n            }\n\n            ecma_value_t value = ecma_op_container_find_weak_value (reference_object_p, key_arg);\n\n            if (ecma_is_value_object (value))\n            {\n              ecma_gc_set_object_visited (ecma_get_object_from_value (value));\n            }\n          }\n          break;\n        }\n#endif /* JERRY_BUILTIN_CONTAINER */\n        case LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER_WITH_REFERENCES:\n        {\n          jerry_value_t value = property_pair_p->values[index].value;\n\n          if (value == JMEM_CP_NULL)\n          {\n            JERRY_ASSERT (!(property & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL));\n            break;\n          }\n\n          ecma_native_pointer_t *item_p;\n          item_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value);\n\n          do\n          {\n            jerry_object_native_info_t *native_info_p = item_p->native_info_p;\n\n            JERRY_ASSERT (native_info_p != NULL && native_info_p->number_of_references > 0);\n\n            uint8_t *start_p = ((uint8_t *) item_p->native_p) + native_info_p->offset_of_references;\n            ecma_value_t *value_p = (ecma_value_t *) start_p;\n            ecma_value_t *end_p = value_p + native_info_p->number_of_references;\n\n            do\n            {\n              if (ecma_is_value_object (*value_p))\n              {\n                ecma_gc_set_object_visited (ecma_get_object_from_value (*value_p));\n              }\n            } while (++value_p < end_p);\n\n            if (property & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL)\n            {\n              break;\n            }\n\n            item_p = &(((ecma_native_pointer_chain_t *) item_p)->next_p->data);\n          } while (item_p != NULL);\n\n          break;\n        }\n      }\n    }\n\n    prop_iter_cp = prop_iter_p->next_property_cp;\n  }\n} /* ecma_gc_mark_properties */\n\n/**\n * Mark compiled code.\n */\nstatic void\necma_gc_mark_compiled_code (ecma_value_t script_value) /**< script value */\n{\n  cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n\n  if (script_p->refs_and_type & CBC_SCRIPT_USER_VALUE_IS_OBJECT)\n  {\n    ecma_value_t user_value = CBC_SCRIPT_GET_USER_VALUE (script_p);\n\n    JERRY_ASSERT (ecma_is_value_object (user_value));\n    ecma_gc_set_object_visited (ecma_get_object_from_value (user_value));\n  }\n\n#if JERRY_MODULE_SYSTEM\n  if (script_p->refs_and_type & CBC_SCRIPT_HAS_IMPORT_META)\n  {\n    ecma_value_t import_meta = CBC_SCRIPT_GET_IMPORT_META (script_p, script_p->refs_and_type);\n\n    JERRY_ASSERT (ecma_is_value_object (import_meta));\n    ecma_gc_set_object_visited (ecma_get_object_from_value (import_meta));\n  }\n#endif /* JERRY_MODULE_SYSTEM */\n\n#if JERRY_BUILTIN_REALMS\n  ecma_gc_set_object_visited (script_p->realm_p);\n#endif /* JERRY_BUILTIN_REALMS */\n} /* ecma_gc_mark_compiled_code */\n\n/**\n * Mark objects referenced by bound function object.\n */\nstatic void JERRY_ATTR_NOINLINE\necma_gc_mark_bound_function_object (ecma_object_t *object_p) /**< bound function object */\n{\n  JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION);\n\n  ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) object_p;\n\n  ecma_object_t *target_func_p;\n  target_func_p =\n    ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);\n\n  ecma_gc_set_object_visited (target_func_p);\n\n  ecma_value_t args_len_or_this = bound_func_p->header.u.bound_function.args_len_or_this;\n\n  if (!ecma_is_value_integer_number (args_len_or_this))\n  {\n    if (ecma_is_value_object (args_len_or_this))\n    {\n      ecma_gc_set_object_visited (ecma_get_object_from_value (args_len_or_this));\n    }\n\n    return;\n  }\n\n  ecma_integer_value_t args_length = ecma_get_integer_from_value (args_len_or_this);\n  ecma_value_t *args_p = (ecma_value_t *) (bound_func_p + 1);\n\n  JERRY_ASSERT (args_length > 0);\n\n  for (ecma_integer_value_t i = 0; i < args_length; i++)\n  {\n    if (ecma_is_value_object (args_p[i]))\n    {\n      ecma_gc_set_object_visited (ecma_get_object_from_value (args_p[i]));\n    }\n  }\n} /* ecma_gc_mark_bound_function_object */\n\n/**\n * Mark objects referenced by Promise built-in.\n */\nstatic void\necma_gc_mark_promise_object (ecma_extended_object_t *ext_object_p) /**< extended object */\n{\n  /* Mark promise result. */\n  ecma_value_t result = ext_object_p->u.cls.u3.value;\n\n  if (ecma_is_value_object (result))\n  {\n    ecma_gc_set_object_visited (ecma_get_object_from_value (result));\n  }\n\n  /* Mark all reactions. */\n  ecma_promise_object_t *promise_object_p = (ecma_promise_object_t *) ext_object_p;\n\n  ecma_collection_t *collection_p = promise_object_p->reactions;\n\n  if (collection_p != NULL)\n  {\n    ecma_value_t *buffer_p = collection_p->buffer_p;\n    ecma_value_t *buffer_end_p = buffer_p + collection_p->item_count;\n\n    while (buffer_p < buffer_end_p)\n    {\n      ecma_value_t value = *buffer_p++;\n\n      ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, value));\n\n      if (JMEM_CP_GET_FIRST_BIT_FROM_POINTER_TAG (value))\n      {\n        ecma_gc_set_object_visited (ecma_get_object_from_value (*buffer_p++));\n      }\n\n      if (JMEM_CP_GET_SECOND_BIT_FROM_POINTER_TAG (value))\n      {\n        ecma_gc_set_object_visited (ecma_get_object_from_value (*buffer_p++));\n      }\n    }\n  }\n} /* ecma_gc_mark_promise_object */\n\n#if JERRY_BUILTIN_CONTAINER\n/**\n * Mark objects referenced by Map built-in.\n */\nstatic void\necma_gc_mark_map_object (ecma_object_t *object_p) /**< object */\n{\n  JERRY_ASSERT (object_p != NULL);\n\n  ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n  ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);\n  uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);\n\n  for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_PAIR_SIZE)\n  {\n    ecma_container_pair_t *entry_p = (ecma_container_pair_t *) (start_p + i);\n\n    if (ecma_is_value_empty (entry_p->key))\n    {\n      continue;\n    }\n\n    if (ecma_is_value_object (entry_p->key))\n    {\n      ecma_gc_set_object_visited (ecma_get_object_from_value (entry_p->key));\n    }\n\n    if (ecma_is_value_object (entry_p->value))\n    {\n      ecma_gc_set_object_visited (ecma_get_object_from_value (entry_p->value));\n    }\n  }\n} /* ecma_gc_mark_map_object */\n\n/**\n * Mark objects referenced by WeakMap built-in.\n */\nstatic void\necma_gc_mark_weakmap_object (ecma_object_t *object_p) /**< object */\n{\n  JERRY_ASSERT (object_p != NULL);\n\n  ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n  ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);\n  uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);\n\n  for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_PAIR_SIZE)\n  {\n    ecma_container_pair_t *entry_p = (ecma_container_pair_t *) (start_p + i);\n\n    if (ecma_is_value_empty (entry_p->key))\n    {\n      continue;\n    }\n\n    JERRY_ASSERT (ecma_is_value_object (entry_p->key));\n\n    if (ecma_is_value_object (entry_p->value) && ecma_gc_is_object_visited (ecma_get_object_from_value (entry_p->key)))\n    {\n      ecma_gc_set_object_visited (ecma_get_object_from_value (entry_p->value));\n    }\n  }\n} /* ecma_gc_mark_weakmap_object */\n\n/**\n * Mark objects referenced by Set built-in.\n */\nstatic void\necma_gc_mark_set_object (ecma_object_t *object_p) /**< object */\n{\n  JERRY_ASSERT (object_p != NULL);\n\n  ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n  ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);\n  uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);\n\n  for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_VALUE_SIZE)\n  {\n    ecma_value_t *entry_p = start_p + i;\n\n    if (ecma_is_value_empty (*entry_p))\n    {\n      continue;\n    }\n\n    if (ecma_is_value_object (*entry_p))\n    {\n      ecma_gc_set_object_visited (ecma_get_object_from_value (*entry_p));\n    }\n  }\n} /* ecma_gc_mark_set_object */\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n/**\n * Mark objects referenced by inactive generator functions, async functions, etc.\n */\nstatic void\necma_gc_mark_executable_object (ecma_object_t *object_p) /**< object */\n{\n  vm_executable_object_t *executable_object_p = (vm_executable_object_t *) object_p;\n\n  if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_ASYNC_GENERATOR_CALLED)\n  {\n    ecma_value_t task = executable_object_p->extended_object.u.cls.u3.head;\n\n    while (!ECMA_IS_INTERNAL_VALUE_NULL (task))\n    {\n      ecma_async_generator_task_t *task_p;\n      task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t, task);\n\n      JERRY_ASSERT (ecma_is_value_object (task_p->promise));\n      ecma_gc_set_object_visited (ecma_get_object_from_value (task_p->promise));\n\n      if (ecma_is_value_object (task_p->operation_value))\n      {\n        ecma_gc_set_object_visited (ecma_get_object_from_value (task_p->operation_value));\n      }\n\n      task = task_p->next;\n    }\n  }\n\n  ecma_gc_set_object_visited (executable_object_p->frame_ctx.lex_env_p);\n  ecma_gc_set_object_visited (executable_object_p->shared.function_object_p);\n\n  if (!ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED (executable_object_p)\n      && !(executable_object_p->extended_object.u.cls.u2.executable_obj_flags\n           & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD))\n  {\n    /* All objects referenced by running executable objects are strong roots,\n     * and a finished executable object cannot refer to other values. */\n    return;\n  }\n\n  if (ecma_is_value_object (executable_object_p->frame_ctx.this_binding))\n  {\n    ecma_gc_set_object_visited (ecma_get_object_from_value (executable_object_p->frame_ctx.this_binding));\n  }\n\n  const ecma_compiled_code_t *bytecode_header_p = executable_object_p->shared.bytecode_header_p;\n  size_t register_end;\n\n  if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_header_p;\n    register_end = args_p->register_end;\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_header_p;\n    register_end = args_p->register_end;\n  }\n\n  ecma_value_t *register_p = VM_GET_REGISTERS (&executable_object_p->frame_ctx);\n  ecma_value_t *register_end_p = register_p + register_end;\n\n  while (register_p < register_end_p)\n  {\n    if (ecma_is_value_object (*register_p))\n    {\n      ecma_gc_set_object_visited (ecma_get_object_from_value (*register_p));\n    }\n\n    register_p++;\n  }\n\n  if (executable_object_p->frame_ctx.context_depth > 0)\n  {\n    ecma_value_t *context_end_p = register_p;\n\n    register_p += executable_object_p->frame_ctx.context_depth;\n\n    ecma_value_t *context_top_p = register_p;\n\n    do\n    {\n      if (VM_CONTEXT_IS_VARIABLE_LENGTH (VM_GET_CONTEXT_TYPE (context_top_p[-1])))\n      {\n        ecma_value_t *last_item_p = context_top_p - VM_GET_CONTEXT_END (context_top_p[-1]);\n        JERRY_ASSERT (last_item_p >= context_end_p);\n        context_top_p--;\n\n        do\n        {\n          --context_top_p;\n          if (ecma_is_value_object (*context_top_p))\n          {\n            ecma_gc_set_object_visited (ecma_get_object_from_value (*context_top_p));\n          }\n        } while (context_top_p > last_item_p);\n\n        continue;\n      }\n\n      uint32_t offsets = vm_get_context_value_offsets (context_top_p);\n\n      while (VM_CONTEXT_HAS_NEXT_OFFSET (offsets))\n      {\n        int32_t offset = VM_CONTEXT_GET_NEXT_OFFSET (offsets);\n\n        if (ecma_is_value_object (context_top_p[offset]))\n        {\n          ecma_gc_set_object_visited (ecma_get_object_from_value (context_top_p[offset]));\n        }\n\n        offsets >>= VM_CONTEXT_OFFSET_SHIFT;\n      }\n\n      JERRY_ASSERT (context_top_p >= context_end_p + offsets);\n      context_top_p -= offsets;\n    } while (context_top_p > context_end_p);\n  }\n\n  register_end_p = executable_object_p->frame_ctx.stack_top_p;\n\n  while (register_p < register_end_p)\n  {\n    if (ecma_is_value_object (*register_p))\n    {\n      ecma_gc_set_object_visited (ecma_get_object_from_value (*register_p));\n    }\n\n    register_p++;\n  }\n\n  if (ecma_is_value_object (executable_object_p->iterator))\n  {\n    ecma_gc_set_object_visited (ecma_get_object_from_value (executable_object_p->iterator));\n  }\n} /* ecma_gc_mark_executable_object */\n\n#if JERRY_BUILTIN_PROXY\n/**\n * Mark the objects referenced by a proxy object\n */\nstatic void\necma_gc_mark_proxy_object (ecma_object_t *object_p) /**< proxy object */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (object_p));\n\n  ecma_proxy_object_t *proxy_p = (ecma_proxy_object_t *) object_p;\n\n  if (!ecma_is_value_null (proxy_p->target))\n  {\n    ecma_gc_set_object_visited (ecma_get_object_from_value (proxy_p->target));\n  }\n\n  if (!ecma_is_value_null (proxy_p->handler))\n  {\n    ecma_gc_set_object_visited (ecma_get_object_from_value (proxy_p->handler));\n  }\n} /* ecma_gc_mark_proxy_object */\n#endif /* JERRY_BUILTIN_PROXY */\n\n/**\n * Mark objects as visited starting from specified object as root\n */\nstatic void\necma_gc_mark (ecma_object_t *object_p) /**< object to mark from */\n{\n  JERRY_ASSERT (object_p != NULL);\n  JERRY_ASSERT (ecma_gc_is_object_visited (object_p));\n\n  if (ecma_is_lexical_environment (object_p))\n  {\n    jmem_cpointer_t outer_lex_env_cp = object_p->u2.outer_reference_cp;\n\n    if (outer_lex_env_cp != JMEM_CP_NULL)\n    {\n      ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER (ecma_object_t, outer_lex_env_cp));\n    }\n\n    switch (ecma_get_lex_env_type (object_p))\n    {\n      case ECMA_LEXICAL_ENVIRONMENT_CLASS:\n      {\n#if JERRY_MODULE_SYSTEM\n        if (object_p->type_flags_refs & ECMA_OBJECT_FLAG_LEXICAL_ENV_HAS_DATA)\n        {\n          if (ECMA_LEX_ENV_CLASS_IS_MODULE (object_p))\n          {\n            ecma_gc_mark_properties (object_p, true);\n          }\n\n          ecma_gc_set_object_visited (((ecma_lexical_environment_class_t *) object_p)->object_p);\n          return;\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n        /* FALLTHRU */\n      }\n      case ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND:\n      {\n        ecma_object_t *binding_object_p = ecma_get_lex_env_binding_object (object_p);\n        ecma_gc_set_object_visited (binding_object_p);\n        return;\n      }\n      default:\n      {\n        break;\n      }\n    }\n  }\n  else\n  {\n    /**\n     * Have the object's prototype here so the object could set it to JMEM_CP_NULL\n     * if the prototype should be ignored (like in case of PROXY).\n     */\n    jmem_cpointer_t proto_cp = object_p->u2.prototype_cp;\n\n    switch (ecma_get_object_type (object_p))\n    {\n      case ECMA_OBJECT_TYPE_BUILT_IN_GENERAL:\n      {\n        ecma_extended_object_t *extended_object_p = (ecma_extended_object_t *) object_p;\n\n        if (extended_object_p->u.built_in.id == ECMA_BUILTIN_ID_GLOBAL)\n        {\n          ecma_gc_mark_global_object ((ecma_global_object_t *) object_p);\n        }\n\n#if JERRY_BUILTIN_REALMS\n        ecma_value_t realm_value = extended_object_p->u.built_in.realm_value;\n        ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, realm_value));\n#endif /* JERRY_BUILTIN_REALMS */\n        break;\n      }\n      case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:\n      {\n#if JERRY_BUILTIN_REALMS\n        ecma_value_t realm_value = ((ecma_extended_built_in_object_t *) object_p)->built_in.realm_value;\n        ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, realm_value));\n#endif /* JERRY_BUILTIN_REALMS */\n        /* FALLTHRU */\n      }\n      case ECMA_OBJECT_TYPE_CLASS:\n      {\n        ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n        switch (ext_object_p->u.cls.type)\n        {\n          case ECMA_OBJECT_CLASS_ARGUMENTS:\n          {\n            ecma_gc_mark_arguments_object (ext_object_p);\n            break;\n          }\n#if JERRY_PARSER\n          case ECMA_OBJECT_CLASS_SCRIPT:\n          {\n            const ecma_compiled_code_t *compiled_code_p;\n            compiled_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);\n\n            JERRY_ASSERT (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION));\n            ecma_gc_mark_compiled_code (((cbc_uint8_arguments_t *) compiled_code_p)->script_value);\n            break;\n          }\n#endif /* JERRY_PARSER */\n#if JERRY_BUILTIN_TYPEDARRAY\n          case ECMA_OBJECT_CLASS_TYPEDARRAY:\n          {\n            ecma_gc_set_object_visited (ecma_typedarray_get_arraybuffer (object_p));\n            break;\n          }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_MODULE_SYSTEM\n          case ECMA_OBJECT_CLASS_MODULE_NAMESPACE:\n          {\n            JERRY_ASSERT (proto_cp == JMEM_CP_NULL);\n            ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, ext_object_p->u.cls.u3.value));\n            ecma_gc_mark_properties (object_p, true);\n            return;\n          }\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_MODULE_SYSTEM\n          case ECMA_OBJECT_CLASS_MODULE:\n          {\n            ecma_module_t *module_p = ((ecma_module_t *) ext_object_p);\n\n            if (module_p->scope_p != NULL)\n            {\n              ecma_gc_set_object_visited (((ecma_module_t *) ext_object_p)->scope_p);\n            }\n\n            if (module_p->namespace_object_p != NULL)\n            {\n              ecma_gc_set_object_visited (((ecma_module_t *) ext_object_p)->namespace_object_p);\n            }\n\n            if (!(module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE)\n                && module_p->u.compiled_code_p != NULL)\n            {\n              const ecma_compiled_code_t *compiled_code_p = module_p->u.compiled_code_p;\n\n              JERRY_ASSERT (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION));\n              ecma_gc_mark_compiled_code (((cbc_uint8_arguments_t *) compiled_code_p)->script_value);\n            }\n\n            ecma_module_node_t *node_p = module_p->imports_p;\n\n            while (node_p != NULL)\n            {\n              if (ecma_is_value_object (node_p->u.path_or_module))\n              {\n                ecma_gc_set_object_visited (ecma_get_object_from_value (node_p->u.path_or_module));\n              }\n\n              node_p = node_p->next_p;\n            }\n            break;\n          }\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_BUILTIN_DATAVIEW\n          case ECMA_OBJECT_CLASS_DATAVIEW:\n          {\n            ecma_dataview_object_t *dataview_p = (ecma_dataview_object_t *) object_p;\n            ecma_gc_set_object_visited (dataview_p->buffer_p);\n            break;\n          }\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_CONTAINER\n          case ECMA_OBJECT_CLASS_CONTAINER:\n          {\n            if (ext_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_MAP_UL)\n            {\n              ecma_gc_mark_map_object (object_p);\n              break;\n            }\n            if (ext_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKMAP_UL)\n            {\n              ecma_gc_mark_weakmap_object (object_p);\n              break;\n            }\n            if (ext_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_SET_UL)\n            {\n              ecma_gc_mark_set_object (object_p);\n              break;\n            }\n            JERRY_ASSERT (ext_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKSET_UL);\n            break;\n          }\n#endif /* JERRY_BUILTIN_CONTAINER */\n          case ECMA_OBJECT_CLASS_GENERATOR:\n          case ECMA_OBJECT_CLASS_ASYNC_GENERATOR:\n          {\n            ecma_gc_mark_executable_object (object_p);\n            break;\n          }\n          case ECMA_OBJECT_CLASS_PROMISE:\n          {\n            ecma_gc_mark_promise_object (ext_object_p);\n            break;\n          }\n          case ECMA_OBJECT_CLASS_PROMISE_CAPABILITY:\n          {\n            ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) object_p;\n\n            if (ecma_is_value_object (capability_p->header.u.cls.u3.promise))\n            {\n              ecma_gc_set_object_visited (ecma_get_object_from_value (capability_p->header.u.cls.u3.promise));\n            }\n            if (ecma_is_value_object (capability_p->resolve))\n            {\n              ecma_gc_set_object_visited (ecma_get_object_from_value (capability_p->resolve));\n            }\n            if (ecma_is_value_object (capability_p->reject))\n            {\n              ecma_gc_set_object_visited (ecma_get_object_from_value (capability_p->reject));\n            }\n            break;\n          }\n          case ECMA_OBJECT_CLASS_ASYNC_FROM_SYNC_ITERATOR:\n          {\n            ecma_async_from_sync_iterator_object_t *iter_p = (ecma_async_from_sync_iterator_object_t *) ext_object_p;\n\n            ecma_gc_set_object_visited (ecma_get_object_from_value (iter_p->header.u.cls.u3.sync_iterator));\n\n            if (!ecma_is_value_undefined (iter_p->sync_next_method))\n            {\n              ecma_gc_set_object_visited (ecma_get_object_from_value (iter_p->sync_next_method));\n            }\n\n            break;\n          }\n          case ECMA_OBJECT_CLASS_ARRAY_ITERATOR:\n          case ECMA_OBJECT_CLASS_SET_ITERATOR:\n          case ECMA_OBJECT_CLASS_MAP_ITERATOR:\n          {\n            ecma_value_t iterated_value = ext_object_p->u.cls.u3.iterated_value;\n            if (!ecma_is_value_empty (iterated_value))\n            {\n              ecma_gc_set_object_visited (ecma_get_object_from_value (iterated_value));\n            }\n            break;\n          }\n#if JERRY_BUILTIN_REGEXP\n          case ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR:\n          {\n            ecma_regexp_string_iterator_t *regexp_string_iterator_obj = (ecma_regexp_string_iterator_t *) object_p;\n            ecma_value_t regexp = regexp_string_iterator_obj->iterating_regexp;\n            ecma_gc_set_object_visited (ecma_get_object_from_value (regexp));\n            break;\n          }\n#endif /* JERRY_BUILTIN_REGEXP */\n          default:\n          {\n            /* The ECMA_OBJECT_CLASS__MAX type represents an uninitialized class. */\n            JERRY_ASSERT (ext_object_p->u.cls.type <= ECMA_OBJECT_CLASS__MAX);\n            break;\n          }\n        }\n\n        break;\n      }\n      case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:\n      {\n#if JERRY_BUILTIN_REALMS\n        ecma_value_t realm_value = ((ecma_extended_built_in_object_t *) object_p)->built_in.realm_value;\n        ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, realm_value));\n#endif /* JERRY_BUILTIN_REALMS */\n        /* FALLTHRU */\n      }\n      case ECMA_OBJECT_TYPE_ARRAY:\n      {\n        ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n        if (JERRY_UNLIKELY (ext_object_p->u.array.length_prop_and_hole_count & ECMA_ARRAY_TEMPLATE_LITERAL))\n        {\n          /* Template objects are never marked. */\n          JERRY_ASSERT (object_p->type_flags_refs >= ECMA_OBJECT_REF_ONE);\n          return;\n        }\n\n        if (ecma_op_array_is_fast_array (ext_object_p))\n        {\n          if (object_p->u1.property_list_cp != JMEM_CP_NULL)\n          {\n            ecma_value_t *values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n\n            for (uint32_t i = 0; i < ext_object_p->u.array.length; i++)\n            {\n              if (ecma_is_value_object (values_p[i]))\n              {\n                ecma_gc_set_object_visited (ecma_get_object_from_value (values_p[i]));\n              }\n            }\n          }\n\n          if (proto_cp != JMEM_CP_NULL)\n          {\n            ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER (ecma_object_t, proto_cp));\n          }\n          return;\n        }\n        break;\n      }\n#if JERRY_BUILTIN_PROXY\n      case ECMA_OBJECT_TYPE_PROXY:\n      {\n        ecma_gc_mark_proxy_object (object_p);\n        /* Prototype of proxy object is a bit set. */\n        proto_cp = JMEM_CP_NULL;\n        break;\n      }\n#endif /* JERRY_BUILTIN_PROXY */\n      case ECMA_OBJECT_TYPE_FUNCTION:\n      {\n        ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;\n        ecma_gc_set_object_visited (\n          ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_func_p->u.function.scope_cp));\n\n        const ecma_compiled_code_t *compiled_code_p = ecma_op_function_get_compiled_code (ext_func_p);\n\n        if (CBC_FUNCTION_IS_ARROW (compiled_code_p->status_flags))\n        {\n          ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) object_p;\n\n          if (ecma_is_value_object (arrow_func_p->this_binding))\n          {\n            ecma_gc_set_object_visited (ecma_get_object_from_value (arrow_func_p->this_binding));\n          }\n\n          if (ecma_is_value_object (arrow_func_p->new_target))\n          {\n            ecma_gc_set_object_visited (ecma_get_object_from_value (arrow_func_p->new_target));\n          }\n        }\n\n#if JERRY_SNAPSHOT_EXEC\n        if (JERRY_UNLIKELY (compiled_code_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))\n        {\n          /* Static snapshot functions have a global realm */\n          break;\n        }\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n        JERRY_ASSERT (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION));\n        ecma_gc_mark_compiled_code (((cbc_uint8_arguments_t *) compiled_code_p)->script_value);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n      {\n        ecma_gc_mark_bound_function_object (object_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n      {\n        ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;\n\n#if JERRY_BUILTIN_REALMS\n        ecma_value_t realm_value = ext_func_p->u.built_in.realm_value;\n        ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, realm_value));\n#endif /* JERRY_BUILTIN_REALMS */\n\n        if (ext_func_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER)\n        {\n          switch (ext_func_p->u.built_in.routine_id)\n          {\n            case ECMA_NATIVE_HANDLER_PROMISE_RESOLVE:\n            case ECMA_NATIVE_HANDLER_PROMISE_REJECT:\n            {\n              ecma_promise_resolver_t *resolver_obj_p = (ecma_promise_resolver_t *) object_p;\n              ecma_gc_set_object_visited (ecma_get_object_from_value (resolver_obj_p->promise));\n              break;\n            }\n            case ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY:\n            case ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY:\n            {\n              ecma_promise_finally_function_t *finally_obj_p = (ecma_promise_finally_function_t *) object_p;\n              ecma_gc_set_object_visited (ecma_get_object_from_value (finally_obj_p->constructor));\n              ecma_gc_set_object_visited (ecma_get_object_from_value (finally_obj_p->on_finally));\n              break;\n            }\n            case ECMA_NATIVE_HANDLER_PROMISE_CAPABILITY_EXECUTOR:\n            {\n              ecma_promise_capability_executor_t *executor_p = (ecma_promise_capability_executor_t *) object_p;\n              ecma_gc_set_object_visited (ecma_get_object_from_value (executor_p->capability));\n              break;\n            }\n            case ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER:\n            {\n              ecma_promise_all_executor_t *executor_p = (ecma_promise_all_executor_t *) object_p;\n              ecma_gc_set_object_visited (ecma_get_object_from_value (executor_p->capability));\n              ecma_gc_set_object_visited (ecma_get_object_from_value (executor_p->values));\n              ecma_gc_set_object_visited (ecma_get_object_from_value (executor_p->remaining_elements));\n              break;\n            }\n#if JERRY_BUILTIN_PROXY\n            case ECMA_NATIVE_HANDLER_PROXY_REVOKE:\n            {\n              ecma_revocable_proxy_object_t *rev_proxy_p = (ecma_revocable_proxy_object_t *) object_p;\n\n              if (!ecma_is_value_null (rev_proxy_p->proxy))\n              {\n                ecma_gc_set_object_visited (ecma_get_object_from_value (rev_proxy_p->proxy));\n              }\n\n              break;\n            }\n#endif /* JERRY_BUILTIN_PROXY */\n            case ECMA_NATIVE_HANDLER_VALUE_THUNK:\n            case ECMA_NATIVE_HANDLER_VALUE_THROWER:\n            {\n              ecma_promise_value_thunk_t *thunk_obj_p = (ecma_promise_value_thunk_t *) object_p;\n\n              if (ecma_is_value_object (thunk_obj_p->value))\n              {\n                ecma_gc_set_object_visited (ecma_get_object_from_value (thunk_obj_p->value));\n              }\n              break;\n            }\n            case ECMA_NATIVE_HANDLER_ASYNC_FROM_SYNC_ITERATOR_UNWRAP:\n            {\n              break;\n            }\n            default:\n            {\n              JERRY_UNREACHABLE ();\n            }\n          }\n        }\n        break;\n      }\n      case ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION:\n      {\n        ecma_gc_mark_compiled_code (((ecma_extended_object_t *) object_p)->u.constructor_function.script_value);\n        break;\n      }\n#if JERRY_BUILTIN_REALMS\n      case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:\n      {\n        ecma_native_function_t *native_function_p = (ecma_native_function_t *) object_p;\n        ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, native_function_p->realm_value));\n        break;\n      }\n#endif /* JERRY_BUILTIN_REALMS */\n      default:\n      {\n        break;\n      }\n    }\n\n    if (proto_cp != JMEM_CP_NULL)\n    {\n      ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER (ecma_object_t, proto_cp));\n    }\n  }\n\n  ecma_gc_mark_properties (object_p, false);\n} /* ecma_gc_mark */\n\n/**\n * Free the native handle/pointer by calling its free callback.\n */\nstatic void\necma_gc_free_native_pointer (ecma_property_t property, /**< property descriptor */\n                             ecma_value_t value) /**< property value */\n{\n  if (JERRY_LIKELY (property & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL))\n  {\n    JERRY_ASSERT (value != JMEM_CP_NULL);\n\n    ecma_native_pointer_t *native_pointer_p;\n    native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value);\n\n    if (native_pointer_p->native_info_p != NULL)\n    {\n      jerry_object_native_free_cb_t free_cb = native_pointer_p->native_info_p->free_cb;\n\n      if (free_cb != NULL)\n      {\n        free_cb (native_pointer_p->native_p, native_pointer_p->native_info_p);\n      }\n    }\n\n    jmem_heap_free_block (native_pointer_p, sizeof (ecma_native_pointer_t));\n    return;\n  }\n\n  if (value == JMEM_CP_NULL)\n  {\n    return;\n  }\n\n  ecma_native_pointer_chain_t *item_p;\n  item_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_chain_t, value);\n\n  do\n  {\n    if (item_p->data.native_info_p != NULL)\n    {\n      jerry_object_native_free_cb_t free_cb = item_p->data.native_info_p->free_cb;\n\n      if (free_cb != NULL)\n      {\n        free_cb (item_p->data.native_p, item_p->data.native_info_p);\n      }\n    }\n\n    ecma_native_pointer_chain_t *next_p = item_p->next_p;\n\n    jmem_heap_free_block (item_p, sizeof (ecma_native_pointer_chain_t));\n\n    item_p = next_p;\n  } while (item_p != NULL);\n} /* ecma_gc_free_native_pointer */\n\n/**\n * Free specified arguments object.\n *\n * @return allocated object's size\n */\nstatic size_t\necma_free_arguments_object (ecma_extended_object_t *ext_object_p) /**< arguments object */\n{\n  JERRY_ASSERT (ecma_get_object_type ((ecma_object_t *) ext_object_p) == ECMA_OBJECT_TYPE_CLASS);\n\n  size_t object_size = sizeof (ecma_unmapped_arguments_t);\n\n  if (ext_object_p->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED)\n  {\n    ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;\n    object_size = sizeof (ecma_mapped_arguments_t);\n\n#if JERRY_SNAPSHOT_EXEC\n    if (!(mapped_arguments_p->unmapped.header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE))\n#endif /* JERRY_SNAPSHOT_EXEC */\n    {\n      ecma_compiled_code_t *byte_code_p =\n        ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, mapped_arguments_p->u.byte_code);\n\n      ecma_bytecode_deref (byte_code_p);\n    }\n  }\n\n  ecma_value_t *argv_p = (ecma_value_t *) (((uint8_t *) ext_object_p) + object_size);\n  ecma_unmapped_arguments_t *arguments_p = (ecma_unmapped_arguments_t *) ext_object_p;\n  uint32_t arguments_number = arguments_p->header.u.cls.u3.arguments_number;\n\n  for (uint32_t i = 0; i < arguments_number; i++)\n  {\n    ecma_free_value_if_not_object (argv_p[i]);\n  }\n\n  uint32_t saved_argument_count = JERRY_MAX (arguments_number, arguments_p->header.u.cls.u2.formal_params_number);\n\n  return object_size + (saved_argument_count * sizeof (ecma_value_t));\n} /* ecma_free_arguments_object */\n\n/**\n * Free specified fast access mode array object.\n */\nstatic void\necma_free_fast_access_array (ecma_object_t *object_p) /**< fast access mode array object to free */\n{\n  JERRY_ASSERT (ecma_op_object_is_fast_array (object_p));\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  const uint32_t aligned_length = ECMA_FAST_ARRAY_ALIGN_LENGTH (ext_object_p->u.array.length);\n\n  if (object_p->u1.property_list_cp != JMEM_CP_NULL)\n  {\n    ecma_value_t *values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n\n    for (uint32_t i = 0; i < aligned_length; i++)\n    {\n      ecma_free_value_if_not_object (values_p[i]);\n    }\n\n    jmem_heap_free_block (values_p, aligned_length * sizeof (ecma_value_t));\n  }\n\n  ecma_dealloc_extended_object (object_p, sizeof (ecma_extended_object_t));\n} /* ecma_free_fast_access_array */\n\n/**\n * Free non-objects referenced by inactive generator functions, async functions, etc.\n *\n * @return total object size\n */\nstatic size_t\necma_gc_free_executable_object (ecma_object_t *object_p) /**< object */\n{\n  vm_executable_object_t *executable_object_p = (vm_executable_object_t *) object_p;\n\n  const ecma_compiled_code_t *bytecode_header_p = executable_object_p->shared.bytecode_header_p;\n  size_t size, register_end;\n\n  if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_header_p;\n\n    register_end = args_p->register_end;\n    size = (register_end + (size_t) args_p->stack_limit) * sizeof (ecma_value_t);\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_header_p;\n\n    register_end = args_p->register_end;\n    size = (register_end + (size_t) args_p->stack_limit) * sizeof (ecma_value_t);\n  }\n\n  size = JERRY_ALIGNUP (sizeof (vm_executable_object_t) + size, sizeof (uintptr_t));\n  ecma_bytecode_deref ((ecma_compiled_code_t *) bytecode_header_p);\n\n  uint16_t executable_obj_flags = executable_object_p->extended_object.u.cls.u2.executable_obj_flags;\n\n  JERRY_ASSERT (!(executable_obj_flags & ECMA_EXECUTABLE_OBJECT_RUNNING));\n\n  if (executable_obj_flags & ECMA_ASYNC_GENERATOR_CALLED)\n  {\n    ecma_value_t task = executable_object_p->extended_object.u.cls.u3.head;\n\n    while (!ECMA_IS_INTERNAL_VALUE_NULL (task))\n    {\n      ecma_async_generator_task_t *task_p;\n      task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t, task);\n\n      JERRY_ASSERT (ecma_is_value_object (task_p->promise));\n      ecma_free_value_if_not_object (task_p->operation_value);\n\n      task = task_p->next;\n      jmem_heap_free_block (task_p, sizeof (ecma_async_generator_task_t));\n    }\n  }\n\n  if (executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED)\n  {\n    return size;\n  }\n\n  ecma_free_value_if_not_object (executable_object_p->frame_ctx.this_binding);\n\n  ecma_value_t *register_p = VM_GET_REGISTERS (&executable_object_p->frame_ctx);\n  ecma_value_t *register_end_p = register_p + register_end;\n\n  while (register_p < register_end_p)\n  {\n    ecma_free_value_if_not_object (*register_p++);\n  }\n\n  if (executable_object_p->frame_ctx.context_depth > 0)\n  {\n    ecma_value_t *context_end_p = register_p;\n\n    register_p += executable_object_p->frame_ctx.context_depth;\n\n    ecma_value_t *context_top_p = register_p;\n\n    do\n    {\n      context_top_p[-1] &= (uint32_t) ~VM_CONTEXT_HAS_LEX_ENV;\n\n      if (VM_CONTEXT_IS_VARIABLE_LENGTH (VM_GET_CONTEXT_TYPE (context_top_p[-1])))\n      {\n        ecma_value_t *last_item_p = context_top_p - VM_GET_CONTEXT_END (context_top_p[-1]);\n        JERRY_ASSERT (last_item_p >= context_end_p);\n        context_top_p--;\n\n        do\n        {\n          ecma_free_value_if_not_object (*(--context_top_p));\n        } while (context_top_p > last_item_p);\n\n        continue;\n      }\n\n      uint32_t offsets = vm_get_context_value_offsets (context_top_p);\n\n      while (VM_CONTEXT_HAS_NEXT_OFFSET (offsets))\n      {\n        int32_t offset = VM_CONTEXT_GET_NEXT_OFFSET (offsets);\n\n        if (ecma_is_value_object (context_top_p[offset]))\n        {\n          context_top_p[offset] = ECMA_VALUE_UNDEFINED;\n        }\n\n        offsets >>= VM_CONTEXT_OFFSET_SHIFT;\n      }\n\n      context_top_p = vm_stack_context_abort (&executable_object_p->frame_ctx, context_top_p);\n    } while (context_top_p > context_end_p);\n  }\n\n  register_end_p = executable_object_p->frame_ctx.stack_top_p;\n\n  while (register_p < register_end_p)\n  {\n    ecma_free_value_if_not_object (*register_p++);\n  }\n\n  return size;\n} /* ecma_gc_free_executable_object */\n\nJERRY_STATIC_ASSERT (!ECMA_PROPERTY_IS_RAW (ECMA_PROPERTY_TYPE_DELETED),\n                     ecma_property_type_deleted_must_not_be_raw_property);\nJERRY_STATIC_ASSERT ((ECMA_PROPERTY_TYPE_DELETED & ECMA_PROPERTY_FLAG_LCACHED) == 0,\n                     ecma_property_type_deleted_must_not_have_lcached_flag);\nJERRY_STATIC_ASSERT (ECMA_GC_FREE_SECOND_PROPERTY == 1, ecma_gc_free_second_must_be_one);\n\n/**\n * Free property of an object\n */\nvoid\necma_gc_free_property (ecma_object_t *object_p, /**< object */\n                       ecma_property_pair_t *prop_pair_p, /**< property pair */\n                       uint32_t options) /**< option bits including property index */\n{\n  /* Both cannot be deleted. */\n  JERRY_ASSERT (prop_pair_p->header.types[0] != ECMA_PROPERTY_TYPE_DELETED\n                || prop_pair_p->header.types[1] != ECMA_PROPERTY_TYPE_DELETED);\n  JERRY_ASSERT (prop_pair_p->header.types[0] != ECMA_PROPERTY_TYPE_HASHMAP);\n\n  uint32_t index = (options & ECMA_GC_FREE_SECOND_PROPERTY);\n  jmem_cpointer_t name_cp = prop_pair_p->names_cp[index];\n  ecma_property_t *property_p = prop_pair_p->header.types + index;\n  ecma_property_t property = *property_p;\n\n#if JERRY_LCACHE\n  if ((property & ECMA_PROPERTY_FLAG_LCACHED) != 0)\n  {\n    ecma_lcache_invalidate (object_p, name_cp, property_p);\n  }\n#endif /* JERRY_LCACHE */\n\n  if (ECMA_PROPERTY_IS_RAW (property))\n  {\n    if (ECMA_PROPERTY_GET_NAME_TYPE (property) == ECMA_DIRECT_STRING_PTR)\n    {\n      ecma_string_t *prop_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, name_cp);\n      ecma_deref_ecma_string (prop_name_p);\n    }\n\n    if (property & ECMA_PROPERTY_FLAG_DATA)\n    {\n      ecma_free_value_if_not_object (prop_pair_p->values[index].value);\n      return;\n    }\n\n    if (JERRY_UNLIKELY (options & ECMA_GC_FREE_REFERENCES))\n    {\n      return;\n    }\n\n#if JERRY_CPOINTER_32_BIT\n    ecma_getter_setter_pointers_t *getter_setter_pair_p;\n    getter_setter_pair_p =\n      ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_pair_p->values[index].getter_setter_pair_cp);\n    jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));\n#endif /* JERRY_CPOINTER_32_BIT */\n    return;\n  }\n\n  if (property == ECMA_PROPERTY_TYPE_DELETED)\n  {\n    return;\n  }\n\n  ecma_value_t value = prop_pair_p->values[index].value;\n\n  switch (name_cp)\n  {\n    case LIT_INTERNAL_MAGIC_STRING_ENVIRONMENT_RECORD:\n    {\n      ecma_environment_record_t *environment_record_p;\n      environment_record_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_environment_record_t, value);\n      jmem_heap_free_block (environment_record_p, sizeof (ecma_environment_record_t));\n      break;\n    }\n    case LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_COMPUTED:\n    {\n      ecma_value_t *compact_collection_p;\n      compact_collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, value);\n      ecma_compact_collection_free (compact_collection_p);\n      break;\n    }\n    case LIT_INTERNAL_MAGIC_STRING_CLASS_PRIVATE_ELEMENTS:\n    {\n      ecma_value_t *compact_collection_p;\n      compact_collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, value);\n\n      ecma_value_t *end_p = ecma_compact_collection_end (compact_collection_p);\n      ecma_value_t *current_p = compact_collection_p + 1;\n\n      JERRY_ASSERT ((end_p - current_p) % ECMA_PRIVATE_ELEMENT_LIST_SIZE == 0);\n\n      while (current_p < end_p)\n      {\n        current_p++; /* skip the type */\n        ecma_deref_ecma_string (ecma_get_prop_name_from_value (*current_p++));\n        current_p++; /* skip the value */\n      }\n\n      ecma_compact_collection_destroy (compact_collection_p);\n      break;\n    }\n#if JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER\n    case LIT_INTERNAL_MAGIC_STRING_WEAK_REFS:\n    {\n      ecma_collection_t *refs_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, value);\n      for (uint32_t j = 0; j < refs_p->item_count; j++)\n      {\n        const ecma_value_t reference_value = refs_p->buffer_p[j];\n\n        if (!ecma_is_value_empty (reference_value))\n        {\n          ecma_object_t *obj_p = ecma_get_object_from_value (reference_value);\n\n          if (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_WEAKREF))\n          {\n            ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n            ext_obj_p->u.cls.u3.target = ECMA_VALUE_UNDEFINED;\n            continue;\n          }\n          ecma_op_container_remove_weak_entry (obj_p, ecma_make_object_value (object_p));\n        }\n      }\n\n      ecma_collection_destroy (refs_p);\n      break;\n    }\n#endif /* JERRY_BUILTIN_CONTAINER */\n    default:\n    {\n      JERRY_ASSERT (name_cp == LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER\n                    || name_cp == LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER_WITH_REFERENCES);\n      ecma_gc_free_native_pointer (property, value);\n      break;\n    }\n  }\n} /* ecma_gc_free_property */\n\n/**\n * Free properties of an object\n */\nvoid\necma_gc_free_properties (ecma_object_t *object_p, /**< object */\n                         uint32_t options) /**< option bits */\n{\n  jmem_cpointer_t prop_iter_cp = object_p->u1.property_list_cp;\n\n#if JERRY_PROPERTY_HASHMAP\n  if (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n    {\n      ecma_property_hashmap_free (object_p);\n      prop_iter_cp = object_p->u1.property_list_cp;\n    }\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n  while (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n    ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n    for (uint32_t i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      ecma_gc_free_property (object_p, prop_pair_p, i | options);\n    }\n\n    prop_iter_cp = prop_iter_p->next_property_cp;\n\n    ecma_dealloc_property_pair (prop_pair_p);\n  }\n} /* ecma_gc_free_properties */\n\n/**\n * Free specified object.\n */\nstatic void\necma_gc_free_object (ecma_object_t *object_p) /**< object to free */\n{\n  JERRY_ASSERT (object_p != NULL && !ecma_gc_is_object_visited (object_p));\n\n  JERRY_ASSERT (JERRY_CONTEXT (ecma_gc_objects_number) > 0);\n  JERRY_CONTEXT (ecma_gc_objects_number)--;\n\n  if (ecma_is_lexical_environment (object_p))\n  {\n#if JERRY_MODULE_SYSTEM\n    if (ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_CLASS\n        && (object_p->type_flags_refs & ECMA_OBJECT_FLAG_LEXICAL_ENV_HAS_DATA))\n    {\n      if (ECMA_LEX_ENV_CLASS_IS_MODULE (object_p))\n      {\n        ecma_gc_free_properties (object_p, ECMA_GC_FREE_REFERENCES);\n      }\n\n      ecma_dealloc_extended_object (object_p, sizeof (ecma_lexical_environment_class_t));\n      return;\n    }\n#endif /* JERRY_MODULE_SYSTEM */\n\n    if (ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n    {\n      ecma_gc_free_properties (object_p, ECMA_GC_FREE_NO_OPTIONS);\n    }\n\n    ecma_dealloc_object (object_p);\n    return;\n  }\n\n  ecma_object_type_t object_type = ecma_get_object_type (object_p);\n\n  size_t ext_object_size = sizeof (ecma_extended_object_t);\n\n  switch (object_type)\n  {\n    case ECMA_OBJECT_TYPE_GENERAL:\n    {\n      ecma_gc_free_properties (object_p, ECMA_GC_FREE_NO_OPTIONS);\n      ecma_dealloc_object (object_p);\n      return;\n    }\n    case ECMA_OBJECT_TYPE_BUILT_IN_GENERAL:\n    {\n      if (((ecma_extended_object_t *) object_p)->u.built_in.id == ECMA_BUILTIN_ID_GLOBAL)\n      {\n        ext_object_size = sizeof (ecma_global_object_t);\n        break;\n      }\n\n      uint8_t bitset_size = ((ecma_extended_object_t *) object_p)->u.built_in.u.length_and_bitset_size;\n      ext_object_size += sizeof (uint64_t) * (bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);\n      break;\n    }\n    case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:\n    {\n      ext_object_size = sizeof (ecma_extended_built_in_object_t);\n      uint8_t bitset_size = ((ecma_extended_built_in_object_t *) object_p)->built_in.u.length_and_bitset_size;\n      ext_object_size += sizeof (uint64_t) * (bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);\n      /* FALLTHRU */\n    }\n    case ECMA_OBJECT_TYPE_CLASS:\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      switch (ext_object_p->u.cls.type)\n      {\n        case ECMA_OBJECT_CLASS_STRING:\n        case ECMA_OBJECT_CLASS_NUMBER:\n        case ECMA_OBJECT_CLASS_SYMBOL:\n#if JERRY_BUILTIN_BIGINT\n        case ECMA_OBJECT_CLASS_BIGINT:\n#endif /* JERRY_BUILTIN_BIGINT */\n        {\n          ecma_free_value (ext_object_p->u.cls.u3.value);\n          break;\n        }\n        case ECMA_OBJECT_CLASS_ARGUMENTS:\n        {\n          ext_object_size = ecma_free_arguments_object (ext_object_p);\n          break;\n        }\n#if JERRY_BUILTIN_TYPEDARRAY\n        case ECMA_OBJECT_CLASS_TYPEDARRAY:\n        {\n          if (ext_object_p->u.cls.u2.typedarray_flags & ECMA_TYPEDARRAY_IS_EXTENDED)\n          {\n            ext_object_size = sizeof (ecma_extended_typedarray_object_t);\n          }\n          break;\n        }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_MODULE_SYSTEM\n        case ECMA_OBJECT_CLASS_MODULE_NAMESPACE:\n        {\n          ecma_gc_free_properties (object_p, ECMA_GC_FREE_REFERENCES);\n          ecma_dealloc_extended_object (object_p, sizeof (ecma_extended_object_t));\n          return;\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_PARSER\n        case ECMA_OBJECT_CLASS_SCRIPT:\n        {\n          ecma_compiled_code_t *compiled_code_p;\n          compiled_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);\n\n          ecma_bytecode_deref (compiled_code_p);\n          break;\n        }\n#endif /* JERRY_PARSER */\n#if JERRY_BUILTIN_DATE\n        case ECMA_OBJECT_CLASS_DATE:\n        {\n          ext_object_size = sizeof (ecma_date_object_t);\n          break;\n        }\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_REGEXP\n        case ECMA_OBJECT_CLASS_REGEXP:\n        {\n          ecma_compiled_code_t *bytecode_p =\n            ECMA_GET_INTERNAL_VALUE_ANY_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);\n\n          ecma_bytecode_deref (bytecode_p);\n\n          break;\n        }\n#endif /* JERRY_BUILTIN_REGEXP */\n        case ECMA_OBJECT_CLASS_STRING_ITERATOR:\n        {\n          ecma_value_t iterated_value = ext_object_p->u.cls.u3.iterated_value;\n\n          if (!ecma_is_value_empty (iterated_value))\n          {\n            ecma_deref_ecma_string (ecma_get_string_from_value (iterated_value));\n          }\n\n          break;\n        }\n#if JERRY_BUILTIN_REGEXP\n        case ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR:\n        {\n          ecma_regexp_string_iterator_t *regexp_string_iterator_obj = (ecma_regexp_string_iterator_t *) object_p;\n          ecma_value_t iterated_string = regexp_string_iterator_obj->iterated_string;\n\n          if (!ecma_is_value_empty (iterated_string))\n          {\n            ecma_deref_ecma_string (ecma_get_string_from_value (iterated_string));\n          }\n\n          ext_object_size = sizeof (ecma_regexp_string_iterator_t);\n          break;\n        }\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_TYPEDARRAY\n        case ECMA_OBJECT_CLASS_ARRAY_BUFFER:\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n        case ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER:\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n        {\n          if (!(ECMA_ARRAYBUFFER_GET_FLAGS (ext_object_p) & ECMA_ARRAYBUFFER_HAS_POINTER))\n          {\n            ext_object_size += ext_object_p->u.cls.u3.length;\n            break;\n          }\n\n          ext_object_size = sizeof (ecma_arraybuffer_pointer_t);\n\n          if (ECMA_ARRAYBUFFER_GET_FLAGS (ext_object_p) & ECMA_ARRAYBUFFER_ALLOCATED)\n          {\n            ecma_arraybuffer_release_buffer (object_p);\n          }\n          break;\n        }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_WEAKREF\n        case ECMA_OBJECT_CLASS_WEAKREF:\n        {\n          ecma_value_t target = ext_object_p->u.cls.u3.target;\n\n          if (!ecma_is_value_undefined (target))\n          {\n            ecma_op_object_unref_weak (ecma_get_object_from_value (target), ecma_make_object_value (object_p));\n          }\n          break;\n        }\n#endif /* JERRY_BUILTIN_WEAKREF */\n#if JERRY_BUILTIN_CONTAINER\n        case ECMA_OBJECT_CLASS_CONTAINER:\n        {\n          ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;\n          ecma_collection_t *container_p =\n            ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n          ecma_op_container_free_entries (object_p);\n          ecma_collection_destroy (container_p);\n          break;\n        }\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_DATAVIEW\n        case ECMA_OBJECT_CLASS_DATAVIEW:\n        {\n          ext_object_size = sizeof (ecma_dataview_object_t);\n          break;\n        }\n#endif /* JERRY_BUILTIN_DATAVIEW */\n        case ECMA_OBJECT_CLASS_GENERATOR:\n        case ECMA_OBJECT_CLASS_ASYNC_GENERATOR:\n        {\n          ext_object_size = ecma_gc_free_executable_object (object_p);\n          break;\n        }\n        case ECMA_OBJECT_CLASS_PROMISE:\n        {\n          ecma_free_value_if_not_object (ext_object_p->u.cls.u3.value);\n\n          /* Reactions only contains objects. */\n          ecma_collection_destroy (((ecma_promise_object_t *) object_p)->reactions);\n\n          ext_object_size = sizeof (ecma_promise_object_t);\n          break;\n        }\n        case ECMA_OBJECT_CLASS_PROMISE_CAPABILITY:\n        {\n          ext_object_size = sizeof (ecma_promise_capabality_t);\n          break;\n        }\n        case ECMA_OBJECT_CLASS_ASYNC_FROM_SYNC_ITERATOR:\n        {\n          ext_object_size = sizeof (ecma_async_from_sync_iterator_object_t);\n          break;\n        }\n#if JERRY_MODULE_SYSTEM\n        case ECMA_OBJECT_CLASS_MODULE:\n        {\n          ecma_module_release_module ((ecma_module_t *) ext_object_p);\n          ext_object_size = sizeof (ecma_module_t);\n          break;\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n        default:\n        {\n          /* The ECMA_OBJECT_CLASS__MAX type represents an uninitialized class. */\n          JERRY_ASSERT (ext_object_p->u.cls.type <= ECMA_OBJECT_CLASS__MAX);\n          break;\n        }\n      }\n\n      break;\n    }\n    case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:\n    {\n      ext_object_size = sizeof (ecma_extended_built_in_object_t);\n      uint8_t bitset_size = ((ecma_extended_built_in_object_t *) object_p)->built_in.u.length_and_bitset_size;\n      ext_object_size += sizeof (uint64_t) * (bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);\n      /* FALLTHRU */\n    }\n    case ECMA_OBJECT_TYPE_ARRAY:\n    {\n      if (ecma_op_array_is_fast_array ((ecma_extended_object_t *) object_p))\n      {\n        ecma_free_fast_access_array (object_p);\n        return;\n      }\n      break;\n    }\n#if JERRY_BUILTIN_PROXY\n    case ECMA_OBJECT_TYPE_PROXY:\n    {\n      ext_object_size = sizeof (ecma_proxy_object_t);\n      break;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n    case ECMA_OBJECT_TYPE_FUNCTION:\n    {\n      /* Function with byte-code (not a built-in function). */\n      ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;\n\n#if JERRY_SNAPSHOT_EXEC\n      if (ext_func_p->u.function.bytecode_cp != ECMA_NULL_POINTER)\n      {\n#endif /* JERRY_SNAPSHOT_EXEC */\n        ecma_compiled_code_t *byte_code_p =\n          (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_func_p->u.function.bytecode_cp));\n\n        if (CBC_FUNCTION_IS_ARROW (byte_code_p->status_flags))\n        {\n          ecma_free_value_if_not_object (((ecma_arrow_function_t *) object_p)->this_binding);\n          ecma_free_value_if_not_object (((ecma_arrow_function_t *) object_p)->new_target);\n          ext_object_size = sizeof (ecma_arrow_function_t);\n        }\n\n        ecma_bytecode_deref (byte_code_p);\n#if JERRY_SNAPSHOT_EXEC\n      }\n      else\n      {\n        ext_object_size = sizeof (ecma_static_function_t);\n      }\n#endif /* JERRY_SNAPSHOT_EXEC */\n      break;\n    }\n    case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n    {\n      ecma_extended_object_t *extended_func_p = (ecma_extended_object_t *) object_p;\n\n      if (!ecma_builtin_function_is_routine (object_p))\n      {\n        uint8_t bitset_size = extended_func_p->u.built_in.u.length_and_bitset_size;\n        ext_object_size += sizeof (uint64_t) * (bitset_size >> ECMA_BUILT_IN_BITSET_SHIFT);\n        break;\n      }\n\n      if (extended_func_p->u.built_in.id != ECMA_BUILTIN_ID_HANDLER)\n      {\n        break;\n      }\n\n      switch (extended_func_p->u.built_in.routine_id)\n      {\n        case ECMA_NATIVE_HANDLER_PROMISE_RESOLVE:\n        case ECMA_NATIVE_HANDLER_PROMISE_REJECT:\n        {\n          ext_object_size = sizeof (ecma_promise_resolver_t);\n          break;\n        }\n        case ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY:\n        case ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY:\n        {\n          ext_object_size = sizeof (ecma_promise_finally_function_t);\n          break;\n        }\n        case ECMA_NATIVE_HANDLER_PROMISE_CAPABILITY_EXECUTOR:\n        {\n          ext_object_size = sizeof (ecma_promise_capability_executor_t);\n          break;\n        }\n        case ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER:\n        {\n          ext_object_size = sizeof (ecma_promise_all_executor_t);\n          break;\n        }\n#if JERRY_BUILTIN_PROXY\n        case ECMA_NATIVE_HANDLER_PROXY_REVOKE:\n        {\n          ext_object_size = sizeof (ecma_revocable_proxy_object_t);\n          break;\n        }\n#endif /* JERRY_BUILTIN_PROXY */\n        case ECMA_NATIVE_HANDLER_VALUE_THUNK:\n        case ECMA_NATIVE_HANDLER_VALUE_THROWER:\n        {\n          ecma_free_value_if_not_object (((ecma_promise_value_thunk_t *) object_p)->value);\n          ext_object_size = sizeof (ecma_promise_value_thunk_t);\n          break;\n        }\n        case ECMA_NATIVE_HANDLER_ASYNC_FROM_SYNC_ITERATOR_UNWRAP:\n        {\n          break;\n        }\n        default:\n        {\n          JERRY_UNREACHABLE ();\n        }\n      }\n      break;\n    }\n    case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n    {\n      ext_object_size = sizeof (ecma_bound_function_t);\n      ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) object_p;\n\n      ecma_value_t args_len_or_this = bound_func_p->header.u.bound_function.args_len_or_this;\n\n      ecma_free_value (bound_func_p->target_length);\n\n      if (!ecma_is_value_integer_number (args_len_or_this))\n      {\n        ecma_free_value_if_not_object (args_len_or_this);\n        break;\n      }\n\n      ecma_integer_value_t args_length = ecma_get_integer_from_value (args_len_or_this);\n      ecma_value_t *args_p = (ecma_value_t *) (bound_func_p + 1);\n\n      for (ecma_integer_value_t i = 0; i < args_length; i++)\n      {\n        ecma_free_value_if_not_object (args_p[i]);\n      }\n\n      size_t args_size = ((size_t) args_length) * sizeof (ecma_value_t);\n      ext_object_size += args_size;\n      break;\n    }\n    case ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION:\n    {\n      ecma_script_deref (((ecma_extended_object_t *) object_p)->u.constructor_function.script_value);\n      break;\n    }\n    case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:\n    {\n      ext_object_size = sizeof (ecma_native_function_t);\n      break;\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n\n  ecma_gc_free_properties (object_p, ECMA_GC_FREE_NO_OPTIONS);\n  ecma_dealloc_extended_object (object_p, ext_object_size);\n} /* ecma_gc_free_object */\n\n/**\n * Run garbage collection, freeing objects that are no longer referenced.\n */\nvoid\necma_gc_run (void)\n{\n#if (JERRY_GC_MARK_LIMIT != 0)\n  JERRY_ASSERT (JERRY_CONTEXT (ecma_gc_mark_recursion_limit) == JERRY_GC_MARK_LIMIT);\n#endif /* (JERRY_GC_MARK_LIMIT != 0) */\n\n  JERRY_CONTEXT (ecma_gc_new_objects) = 0;\n\n  ecma_object_t black_list_head;\n  black_list_head.gc_next_cp = JMEM_CP_NULL;\n  ecma_object_t *black_end_p = &black_list_head;\n\n  ecma_object_t white_gray_list_head;\n  white_gray_list_head.gc_next_cp = JERRY_CONTEXT (ecma_gc_objects_cp);\n\n  ecma_object_t *obj_prev_p = &white_gray_list_head;\n  jmem_cpointer_t obj_iter_cp = obj_prev_p->gc_next_cp;\n  ecma_object_t *obj_iter_p;\n\n  /* Move root objects (i.e. they have global or stack references) to the black list. */\n  while (obj_iter_cp != JMEM_CP_NULL)\n  {\n    obj_iter_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_object_t, obj_iter_cp);\n    const jmem_cpointer_t obj_next_cp = obj_iter_p->gc_next_cp;\n\n    JERRY_ASSERT (obj_prev_p == NULL\n                  || ECMA_GET_NON_NULL_POINTER (ecma_object_t, obj_prev_p->gc_next_cp) == obj_iter_p);\n\n    if (obj_iter_p->type_flags_refs >= ECMA_OBJECT_REF_ONE)\n    {\n      /* Moving the object to list of marked objects. */\n      obj_prev_p->gc_next_cp = obj_next_cp;\n\n      black_end_p->gc_next_cp = obj_iter_cp;\n      black_end_p = obj_iter_p;\n    }\n    else\n    {\n      obj_iter_p->type_flags_refs |= ECMA_OBJECT_NON_VISITED;\n      obj_prev_p = obj_iter_p;\n    }\n\n    obj_iter_cp = obj_next_cp;\n  }\n\n  black_end_p->gc_next_cp = JMEM_CP_NULL;\n\n  /* Mark root objects. */\n  obj_iter_cp = black_list_head.gc_next_cp;\n  while (obj_iter_cp != JMEM_CP_NULL)\n  {\n    obj_iter_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_object_t, obj_iter_cp);\n    ecma_gc_mark (obj_iter_p);\n    obj_iter_cp = obj_iter_p->gc_next_cp;\n  }\n\n  /* Mark non-root objects. */\n  bool marked_anything_during_current_iteration;\n\n  do\n  {\n#if (JERRY_GC_MARK_LIMIT != 0)\n    JERRY_ASSERT (JERRY_CONTEXT (ecma_gc_mark_recursion_limit) == JERRY_GC_MARK_LIMIT);\n#endif /* (JERRY_GC_MARK_LIMIT != 0) */\n\n    marked_anything_during_current_iteration = false;\n\n    obj_prev_p = &white_gray_list_head;\n    obj_iter_cp = obj_prev_p->gc_next_cp;\n\n    while (obj_iter_cp != JMEM_CP_NULL)\n    {\n      obj_iter_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_object_t, obj_iter_cp);\n      const jmem_cpointer_t obj_next_cp = obj_iter_p->gc_next_cp;\n\n      JERRY_ASSERT (obj_prev_p == NULL\n                    || ECMA_GET_NON_NULL_POINTER (ecma_object_t, obj_prev_p->gc_next_cp) == obj_iter_p);\n\n      if (ecma_gc_is_object_visited (obj_iter_p))\n      {\n        /* Moving the object to list of marked objects */\n        obj_prev_p->gc_next_cp = obj_next_cp;\n\n        black_end_p->gc_next_cp = obj_iter_cp;\n        black_end_p = obj_iter_p;\n\n#if (JERRY_GC_MARK_LIMIT != 0)\n        if (obj_iter_p->type_flags_refs >= ECMA_OBJECT_REF_ONE)\n        {\n          /* Set the reference count of non-marked gray object to 0 */\n          obj_iter_p->type_flags_refs &= (ecma_object_descriptor_t) (ECMA_OBJECT_REF_ONE - 1);\n          ecma_gc_mark (obj_iter_p);\n          marked_anything_during_current_iteration = true;\n        }\n#else /* (JERRY_GC_MARK_LIMIT == 0) */\n        marked_anything_during_current_iteration = true;\n#endif /* (JERRY_GC_MARK_LIMIT != 0) */\n      }\n      else\n      {\n        obj_prev_p = obj_iter_p;\n      }\n\n      obj_iter_cp = obj_next_cp;\n    }\n  } while (marked_anything_during_current_iteration);\n\n  black_end_p->gc_next_cp = JMEM_CP_NULL;\n  JERRY_CONTEXT (ecma_gc_objects_cp) = black_list_head.gc_next_cp;\n\n  /* Sweep objects that are currently unmarked. */\n  obj_iter_cp = white_gray_list_head.gc_next_cp;\n\n  while (obj_iter_cp != JMEM_CP_NULL)\n  {\n    obj_iter_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_object_t, obj_iter_cp);\n    const jmem_cpointer_t obj_next_cp = obj_iter_p->gc_next_cp;\n\n    JERRY_ASSERT (!ecma_gc_is_object_visited (obj_iter_p));\n\n    ecma_gc_free_object (obj_iter_p);\n    obj_iter_cp = obj_next_cp;\n  }\n\n#if JERRY_BUILTIN_REGEXP\n  /* Free RegExp bytecodes stored in cache */\n  re_cache_gc ();\n#endif /* JERRY_BUILTIN_REGEXP */\n} /* ecma_gc_run */\n\n/**\n * Try to free some memory (depending on memory pressure).\n *\n * When called with JMEM_PRESSURE_FULL, the engine will be terminated with JERRY_FATAL_OUT_OF_MEMORY.\n */\nvoid\necma_free_unused_memory (jmem_pressure_t pressure) /**< current pressure */\n{\n#if JERRY_DEBUGGER\n  while ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n         && JERRY_CONTEXT (debugger_byte_code_free_tail) != ECMA_NULL_POINTER)\n  {\n    /* Wait until all byte code is freed or the connection is aborted. */\n    jerry_debugger_receive (NULL);\n  }\n#endif /* JERRY_DEBUGGER */\n\n  if (JERRY_LIKELY (pressure == JMEM_PRESSURE_LOW))\n  {\n#if JERRY_PROPERTY_HASHMAP\n    if (JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) > ECMA_PROP_HASHMAP_ALLOC_ON)\n    {\n      --JERRY_CONTEXT (ecma_prop_hashmap_alloc_state);\n    }\n    JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_HIGH_PRESSURE_GC;\n#endif /* JERRY_PROPERTY_HASHMAP */\n    /*\n     * If there is enough newly allocated objects since last GC, probably it is worthwhile to start GC now.\n     * Otherwise, probability to free sufficient space is considered to be low.\n     */\n    size_t new_objects_fraction = CONFIG_ECMA_GC_NEW_OBJECTS_FRACTION;\n\n    if (JERRY_CONTEXT (ecma_gc_new_objects) * new_objects_fraction > JERRY_CONTEXT (ecma_gc_objects_number))\n    {\n      ecma_gc_run ();\n    }\n\n    return;\n  }\n  else if (pressure == JMEM_PRESSURE_HIGH)\n  {\n    /* Freeing as much memory as we currently can */\n#if JERRY_PROPERTY_HASHMAP\n    if (JERRY_CONTEXT (status_flags) & ECMA_STATUS_HIGH_PRESSURE_GC)\n    {\n      JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) = ECMA_PROP_HASHMAP_ALLOC_MAX;\n    }\n    else if (JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) < ECMA_PROP_HASHMAP_ALLOC_MAX)\n    {\n      ++JERRY_CONTEXT (ecma_prop_hashmap_alloc_state);\n      JERRY_CONTEXT (status_flags) |= ECMA_STATUS_HIGH_PRESSURE_GC;\n    }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n    ecma_gc_run ();\n\n#if JERRY_PROPERTY_HASHMAP\n    /* Free hashmaps of remaining objects. */\n    jmem_cpointer_t obj_iter_cp = JERRY_CONTEXT (ecma_gc_objects_cp);\n\n    while (obj_iter_cp != JMEM_CP_NULL)\n    {\n      ecma_object_t *obj_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, obj_iter_cp);\n\n      if (!ecma_is_lexical_environment (obj_iter_p)\n          || ecma_get_lex_env_type (obj_iter_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n      {\n        if (!ecma_is_lexical_environment (obj_iter_p) && ecma_op_object_is_fast_array (obj_iter_p))\n        {\n          obj_iter_cp = obj_iter_p->gc_next_cp;\n          continue;\n        }\n\n        jmem_cpointer_t prop_iter_cp = obj_iter_p->u1.property_list_cp;\n\n        if (prop_iter_cp != JMEM_CP_NULL)\n        {\n          ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n\n          if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n          {\n            ecma_property_hashmap_free (obj_iter_p);\n          }\n        }\n      }\n\n      obj_iter_cp = obj_iter_p->gc_next_cp;\n    }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n    jmem_pools_collect_empty ();\n    return;\n  }\n  else if (JERRY_UNLIKELY (pressure == JMEM_PRESSURE_FULL))\n  {\n    jerry_fatal (JERRY_FATAL_OUT_OF_MEMORY);\n  }\n  else\n  {\n    JERRY_ASSERT (pressure == JMEM_PRESSURE_NONE);\n    JERRY_UNREACHABLE ();\n  }\n} /* ecma_free_unused_memory */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-gc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_GC_H\n#define ECMA_GC_H\n\n#include \"ecma-globals.h\"\n\n#include \"jmem.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmagc Garbage collector\n * @{\n */\n\n/**\n * Free option flags\n */\ntypedef enum\n{\n  ECMA_GC_FREE_NO_OPTIONS = 0, /**< no options */\n  ECMA_GC_FREE_SECOND_PROPERTY = (1 << 0), /**< free second property of a property pair */\n  ECMA_GC_FREE_REFERENCES = (1 << 1), /**< free references */\n} ecma_gc_free_options_t;\n\nvoid ecma_init_gc_info (ecma_object_t *object_p);\nvoid ecma_ref_object (ecma_object_t *object_p);\nvoid ecma_ref_object_inline (ecma_object_t *object_p);\nvoid ecma_deref_object (ecma_object_t *object_p);\nvoid ecma_gc_free_property (ecma_object_t *object_p, ecma_property_pair_t *prop_pair_p, uint32_t options);\nvoid ecma_gc_free_properties (ecma_object_t *object_p, uint32_t options);\nvoid ecma_gc_run (void);\nvoid ecma_free_unused_memory (jmem_pressure_t pressure);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_GC_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-globals.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_GLOBALS_H\n#define ECMA_GLOBALS_H\n\n#include \"ecma-errors.h\"\n\n#include \"config.h\"\n#include \"jmem.h\"\n#include \"jrt.h\"\n#include \"lit-magic-strings.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmatypes ECMA types\n * @{\n *\n * \\addtogroup compressedpointer Compressed pointer\n * @{\n */\n\n/**\n * The NULL value for compressed pointers\n */\n#define ECMA_NULL_POINTER JMEM_CP_NULL\n\n#if defined(JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY)\n\n/**\n * JMEM_ALIGNMENT_LOG aligned pointers can be stored directly in ecma_value_t\n */\n#define ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY\n\n#endif /* JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY */\n\n/**\n * @}\n */\n\n/**\n * JerryScript status flags.\n */\ntypedef enum\n{\n  ECMA_STATUS_API_ENABLED = (1u << 0), /**< api available */\n  ECMA_STATUS_DIRECT_EVAL = (1u << 1), /**< eval is called directly */\n#if JERRY_PROPERTY_HASHMAP\n  ECMA_STATUS_HIGH_PRESSURE_GC = (1u << 2), /**< last gc was under high pressure */\n#endif /* JERRY_PROPERTY_HASHMAP */\n  ECMA_STATUS_EXCEPTION = (1u << 3), /**< last exception is a normal exception */\n  ECMA_STATUS_ABORT = (1u << 4), /**< last exception is an abort */\n  ECMA_STATUS_ERROR_UPDATE = (1u << 5), /**< the error_object_created_callback_p is called */\n#if JERRY_VM_THROW\n  ECMA_STATUS_ERROR_THROWN = (1u << 6), /**< the vm_throw_callback_p is called */\n#endif /* JERRY_VM_THROW */\n} ecma_status_flag_t;\n\n/**\n * Type of ecma value\n */\ntypedef enum\n{\n  ECMA_TYPE_DIRECT = 0, /**< directly encoded value, a 28 bit signed integer or a simple value */\n  ECMA_TYPE_STRING = 1, /**< pointer to description of a string */\n  ECMA_TYPE_FLOAT = 2, /**< pointer to a 64 or 32 bit floating point number */\n  ECMA_TYPE_OBJECT = 3, /**< pointer to description of an object */\n  ECMA_TYPE_SYMBOL = 4, /**< pointer to description of a symbol */\n  ECMA_TYPE_DIRECT_STRING = 5, /**< directly encoded string values */\n  ECMA_TYPE_BIGINT = 6, /**< pointer to a bigint primitive */\n  ECMA_TYPE_ERROR = 7, /**< pointer to description of an error reference (only supported by C API) */\n  ECMA_TYPE_SNAPSHOT_OFFSET = ECMA_TYPE_ERROR, /**< offset to a snapshot number/string */\n  ECMA_TYPE___MAX = ECMA_TYPE_ERROR /** highest value for ecma types */\n} ecma_type_t;\n\n/**\n * Option flags for parser_parse_script and internal flags for global_status_flags in parser context.\n */\ntypedef enum\n{\n  ECMA_PARSE_NO_OPTS = 0, /**< no options passed */\n  ECMA_PARSE_STRICT_MODE = (1u << 0), /**< enable strict mode, must be same as PARSER_IS_STRICT */\n  ECMA_PARSE_MODULE = (1u << 1), /**< module is parsed */\n  ECMA_PARSE_EVAL = (1u << 2), /**< eval is called */\n  ECMA_PARSE_DIRECT_EVAL = (1u << 3), /**< eval is called directly (ECMA-262 v5, 15.1.2.1.1) */\n  ECMA_PARSE_CLASS_CONSTRUCTOR = (1u << 4), /**< a class constructor is being parsed */\n\n  /* These five status flags must be in this order. The first four are also parser status flags.\n   * See PARSER_SAVE_STATUS_FLAGS / PARSER_RESTORE_STATUS_FLAGS. */\n  ECMA_PARSE_ALLOW_SUPER = (1u << 5), /**< allow super property access */\n  ECMA_PARSE_ALLOW_SUPER_CALL = (1u << 6), /**< allow super constructor call */\n  ECMA_PARSE_FUNCTION_IS_PARSING_ARGS = (1u << 7), /**< set when parsing function arguments */\n  ECMA_PARSE_INSIDE_CLASS_FIELD = (1u << 8), /**< a class field is being parsed */\n  ECMA_PARSE_ALLOW_NEW_TARGET = (1u << 9), /**< allow new.target access */\n  ECMA_PARSE_FUNCTION_CONTEXT = (1u << 10), /**< function context is present (ECMA_PARSE_DIRECT_EVAL must be set) */\n\n  ECMA_PARSE_HAS_SOURCE_VALUE = (1u << 11), /**< source_p points to a value list\n                                             *   and the first value is the source code */\n  ECMA_PARSE_HAS_ARGUMENT_LIST_VALUE = (1u << 12), /**< source_p points to a value list\n                                                    *   and the second value is the argument list */\n  ECMA_PARSE_GENERATOR_FUNCTION = (1u << 13), /**< generator function is parsed */\n  ECMA_PARSE_ASYNC_FUNCTION = (1u << 14), /**< async function is parsed */\n\n  /* These flags are internally used by the parser. */\n  ECMA_PARSE_INTERNAL_FREE_SOURCE = (1u << 15), /**< free source_p data */\n  ECMA_PARSE_INTERNAL_FREE_ARG_LIST = (1u << 16), /**< free arg_list_p data */\n  ECMA_PARSE_INTERNAL_PRE_SCANNING = (1u << 17), /**< the parser is in pre-scanning mode */\n#if JERRY_MODULE_SYSTEM\n  ECMA_PARSE_INTERNAL_HAS_IMPORT_META = (1u << 18), /**< module has import.meta expression */\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_FUNCTION_TO_STRING\n  ECMA_PARSE_INTERNAL_HAS_4_BYTE_MARKER = (1u << 19), /**< source has 4 byte marker */\n#endif /* JERRY_FUNCTION_TO_STRING */\n#ifndef JERRY_NDEBUG\n  /**\n   * This flag represents an error in for in/of statements, which cannot be set\n   * if the parsing is completed successfully.\n   */\n  ECMA_PARSE_INTERNAL_FOR_IN_OFF_CONTEXT_ERROR = (1u << 30),\n#endif /* !JERRY_NDEBUG */\n} ecma_parse_opts_t;\n\n/**\n * Description of an ecma value\n *\n * Bit-field structure: type (3) | value (29)\n */\ntypedef uint32_t ecma_value_t;\n\n/**\n * Type for directly encoded integer numbers in JerryScript.\n */\ntypedef int32_t ecma_integer_value_t;\n\n/**\n * Mask for ecma types in ecma_value_t\n */\n#define ECMA_VALUE_TYPE_MASK 0x7u\n\n/**\n * Shift for value part in ecma_value_t\n */\n#define ECMA_VALUE_SHIFT 3\n\n/**\n * Mask for directly encoded values\n */\n#define ECMA_DIRECT_TYPE_MASK ((1u << ECMA_VALUE_SHIFT) | ECMA_VALUE_TYPE_MASK)\n\n/**\n * Ecma integer value type\n */\n#define ECMA_DIRECT_TYPE_INTEGER_VALUE ((0u << ECMA_VALUE_SHIFT) | ECMA_TYPE_DIRECT)\n\n/**\n * Ecma simple value type\n */\n#define ECMA_DIRECT_TYPE_SIMPLE_VALUE ((1u << ECMA_VALUE_SHIFT) | ECMA_TYPE_DIRECT)\n\n/**\n * Shift for directly encoded values in ecma_value_t\n */\n#define ECMA_DIRECT_SHIFT 4\n\n/**\n * ECMA make simple value\n */\n#define ECMA_MAKE_VALUE(value) ((((ecma_value_t) (value)) << ECMA_DIRECT_SHIFT) | ECMA_DIRECT_TYPE_SIMPLE_VALUE)\n\n/**\n * Simple ecma values\n */\nenum\n{\n  /**\n   * Empty value is implementation defined value, used for representing:\n   *   - empty (uninitialized) values\n   *   - immutable binding values\n   *   - special register or stack values for vm\n   */\n  ECMA_VALUE_EMPTY = ECMA_MAKE_VALUE (0), /**< uninitialized value */\n  ECMA_VALUE_ERROR = ECMA_MAKE_VALUE (1), /**< an error is currently thrown */\n  ECMA_VALUE_FALSE = ECMA_MAKE_VALUE (2), /**< boolean false */\n  ECMA_VALUE_TRUE = ECMA_MAKE_VALUE (3), /**< boolean true */\n  ECMA_VALUE_UNDEFINED = ECMA_MAKE_VALUE (4), /**< undefined value */\n  ECMA_VALUE_NULL = ECMA_MAKE_VALUE (5), /**< null value */\n  ECMA_VALUE_UNINITIALIZED = ECMA_MAKE_VALUE (6), /**< a special value for uninitialized let/const declarations */\n  ECMA_VALUE_NOT_FOUND = ECMA_MAKE_VALUE (7), /**< a special value returned by\n                                               *   ecma_op_object_find */\n  /* Values for controlling the VM */\n  ECMA_VALUE_ARRAY_HOLE = ECMA_MAKE_VALUE (8), /**< array hole, used for\n                                                *   initialization of an array literal */\n  ECMA_VALUE_REGISTER_REF = ECMA_MAKE_VALUE (9), /**< register reference,\n                                                  *   a special \"base\" value for vm */\n  ECMA_VALUE_RELEASE_LEX_ENV = ECMA_MAKE_VALUE (10), /**< if this error remains on the stack when an exception occurs\n                                                         the top lexical environment of the VM frame should be popped */\n  ECMA_VALUE_SPREAD_ELEMENT = ECMA_MAKE_VALUE (11), /**< a special value for spread elements in array initialization\n                                                     *   or function call argument list */\n  /* Other values */\n  ECMA_VALUE_ARGUMENT_NO_TRACK = ECMA_MAKE_VALUE (12), /**< represents not-tracked arguments formal parameter */\n  ECMA_VALUE_SYNC_ITERATOR = ECMA_MAKE_VALUE (13), /**< option for ecma_op_get_iterator: sync iterator is requested */\n  ECMA_VALUE_ASYNC_ITERATOR = ECMA_MAKE_VALUE (14), /**< option for ecma_op_get_iterator: async iterator is requested */\n#if JERRY_BUILTIN_GLOBAL_THIS\n  ECMA_VALUE_GLOBAL_THIS = ECMA_MAKE_VALUE (15), /**< globalThis built-in */\n#endif /* JERRY_BUILTIN_GLOBAL_THIS */\n};\n\n#if !JERRY_NUMBER_TYPE_FLOAT64\n/**\n * Maximum integer number for an ecma value\n */\n#define ECMA_INTEGER_NUMBER_MAX 0x7fffff\n/**\n * Maximum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT)\n */\n#define ECMA_INTEGER_NUMBER_MAX_SHIFTED 0x7fffff0\n#else /* JERRY_NUMBER_TYPE_FLOAT64 */\n/**\n * Maximum integer number for an ecma value\n */\n#define ECMA_INTEGER_NUMBER_MAX         0x7ffffff\n/**\n * Maximum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT)\n */\n#define ECMA_INTEGER_NUMBER_MAX_SHIFTED 0x7ffffff0\n#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */\n\n#if !JERRY_NUMBER_TYPE_FLOAT64\n/**\n * Minimum integer number for an ecma value\n */\n#define ECMA_INTEGER_NUMBER_MIN -0x7fffff\n/**\n * Minimum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT)\n */\n#define ECMA_INTEGER_NUMBER_MIN_SHIFTED -0x7fffff0\n#else /* JERRY_NUMBER_TYPE_FLOAT64 */\n/**\n * Minimum integer number for an ecma value\n */\n#define ECMA_INTEGER_NUMBER_MIN         -0x8000000\n/**\n * Minimum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT)\n */\n#define ECMA_INTEGER_NUMBER_MIN_SHIFTED (-0x7fffffff - 1) /* -0x80000000 */\n#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */\n\n#if ECMA_DIRECT_SHIFT != 4\n#error \"Please update ECMA_INTEGER_NUMBER_MIN/MAX_SHIFTED according to the new value of ECMA_DIRECT_SHIFT.\"\n#endif /* ECMA_DIRECT_SHIFT != 4 */\n\n/**\n * Checks whether the integer number is in the integer number range.\n */\n#define ECMA_IS_INTEGER_NUMBER(num) (ECMA_INTEGER_NUMBER_MIN <= (num) && (num) <= ECMA_INTEGER_NUMBER_MAX)\n\n/**\n * Maximum integer number, which if squared, still fits in ecma_integer_value_t\n */\n#if !JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_INTEGER_MULTIPLY_MAX 0xb50\n#else /* JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_INTEGER_MULTIPLY_MAX 0x2d41\n#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Checks whether the error flag is set.\n */\n#define ECMA_IS_VALUE_ERROR(value) (JERRY_UNLIKELY ((value) == ECMA_VALUE_ERROR))\n\n/**\n * Callback which tells whether the ECMAScript execution should be stopped.\n */\ntypedef ecma_value_t (*ecma_vm_exec_stop_callback_t) (void *user_p);\n\n/**\n * Forward definition of jerry_call_info_t.\n */\nstruct jerry_call_info_t;\n\n/**\n * Type of an external function handler.\n */\ntypedef ecma_value_t (*ecma_native_handler_t) (const struct jerry_call_info_t *call_info_p,\n                                               const ecma_value_t args_p[],\n                                               const uint32_t args_count);\n\n/**\n * Representation of native pointer data.\n */\ntypedef struct\n{\n  void *native_p; /**< points to the data of the object */\n  jerry_object_native_info_t *native_info_p; /**< native info */\n} ecma_native_pointer_t;\n\n/**\n * Representation of native pointer data chain.\n */\ntypedef struct ecma_native_pointer_chain_t\n{\n  ecma_native_pointer_t data; /**< pointer data */\n  struct ecma_native_pointer_chain_t *next_p; /**< next in the list */\n} ecma_native_pointer_chain_t;\n\n/**\n * Representation for class constructor environment record.\n */\ntypedef struct\n{\n  ecma_value_t this_binding; /**< this binding */\n  ecma_value_t function_object; /**< function object */\n} ecma_environment_record_t;\n\n/**\n * Property list:\n *   The property list of an object is a chain list of various items.\n *   The type of each item is stored in the first byte of the item.\n *\n *   The most common item is the property pair, which contains two\n *   ecmascript properties. It is also important, that after the\n *   first property pair, only property pair items are allowed.\n *\n *   Example for other items is property name hash map, or array of items.\n */\n\n/**\n * Property name listing options.\n */\ntypedef enum\n{\n  ECMA_LIST_NO_OPTS = (0), /**< no options are provided */\n  ECMA_LIST_ARRAY_INDICES = (1 << 0), /**< exclude properties with names\n                                       *   that are not indices */\n  ECMA_LIST_ENUMERABLE = (1 << 1), /**< exclude non-enumerable properties */\n  ECMA_LIST_PROTOTYPE = (1 << 2), /**< list properties from prototype chain */\n  ECMA_LIST_SYMBOLS = (1 << 3), /**< list symbol properties */\n  ECMA_LIST_SYMBOLS_ONLY = (1 << 4), /**< list symbol properties only */\n  ECMA_LIST_CONVERT_FAST_ARRAYS = (1 << 5), /**< after listing the properties convert\n                                             *   the fast access mode array back to normal array */\n} ecma_list_properties_options_t;\n\n/**\n * Enumerable property name listing options.\n */\ntypedef enum\n{\n  ECMA_ENUMERABLE_PROPERTY_KEYS, /**< List only property names */\n  ECMA_ENUMERABLE_PROPERTY_VALUES, /**< List only property values */\n  ECMA_ENUMERABLE_PROPERTY_ENTRIES, /**< List both propery names and values */\n\n  ECMA_ENUMERABLE_PROPERTY__COUNT /**< Number of enumerable property listing types */\n} ecma_enumerable_property_names_options_t;\n\n/**\n * List enumerable properties and include the prototype chain.\n */\n#define ECMA_LIST_ENUMERABLE_PROTOTYPE (ECMA_LIST_ENUMERABLE | ECMA_LIST_PROTOTYPE)\n\n/**\n * Property flag list. Several flags are alias\n */\ntypedef enum\n{\n  ECMA_PROPERTY_FLAG_CONFIGURABLE = (1u << 0), /**< property is configurable */\n  ECMA_PROPERTY_FLAG_ENUMERABLE = (1u << 1), /**< property is enumerable */\n  ECMA_PROPERTY_FLAG_WRITABLE = (1u << 2), /**< property is writable */\n  ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL = (1u << 2), /**< only one external pointer is assigned to this object */\n  ECMA_PROPERTY_FLAG_DELETED = (1u << 3), /**< property is deleted */\n  ECMA_PROPERTY_FLAG_BUILT_IN = (1u << 3), /**< property is defined by the ECMAScript standard */\n  ECMA_FAST_ARRAY_FLAG = (1u << 3), /**< array is fast array */\n  ECMA_PROPERTY_FLAG_LCACHED = (1u << 4), /**< property is lcached */\n  ECMA_ARRAY_TEMPLATE_LITERAL = (1u << 4), /**< array is a template literal constructed by the parser */\n  ECMA_PROPERTY_FLAG_DATA = (1u << 5), /**< property contains data */\n  /* The last two bits contains an ECMA_DIRECT_STRING value. */\n} ecma_property_flags_t;\n\n/**\n * Property flags configurable, enumerable, writable.\n */\n#define ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE \\\n  (ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_ENUMERABLE | ECMA_PROPERTY_FLAG_WRITABLE)\n\n/**\n * Property flags configurable, enumerable.\n */\n#define ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE (ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_ENUMERABLE)\n\n/**\n * Property flags configurable, enumerable.\n */\n#define ECMA_PROPERTY_CONFIGURABLE_WRITABLE (ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_WRITABLE)\n\n/**\n * Property flag built-in.\n */\n#define ECMA_PROPERTY_BUILT_IN_FIXED (ECMA_PROPERTY_FLAG_BUILT_IN)\n\n/**\n * Property flags enumerable, writable.\n */\n#define ECMA_PROPERTY_ENUMERABLE_WRITABLE (ECMA_PROPERTY_FLAG_ENUMERABLE | ECMA_PROPERTY_FLAG_WRITABLE)\n\n/**\n * Property flags built-in, configurable.\n */\n#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/**\n * Property flags built-in, configurable, enumerable.\n */\n#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_ENUMERABLE \\\n  (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE)\n\n/**\n * Property flags built-in, configurable, writable.\n */\n#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/**\n * Property flags built-in, writable.\n */\n#define ECMA_PROPERTY_BUILT_IN_WRITABLE (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_FLAG_WRITABLE)\n\n/**\n * Property flags built-in, configurable, enumerable, writable.\n */\n#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_ENUMERABLE_WRITABLE \\\n  (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\n/**\n * No attributes can be changed for this property.\n */\n#define ECMA_PROPERTY_FIXED 0\n\n/**\n * Default flag of length property.\n */\n#define ECMA_PROPERTY_FLAG_DEFAULT_LENGTH ECMA_PROPERTY_FLAG_CONFIGURABLE\n\n/**\n * Shift for property name part.\n */\n#define ECMA_PROPERTY_NAME_TYPE_SHIFT 6\n\n/**\n * Type of hash-map property.\n */\n#define ECMA_PROPERTY_TYPE_HASHMAP (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT)\n\n/**\n * Type of deleted property.\n */\n#define ECMA_PROPERTY_TYPE_DELETED \\\n  (ECMA_PROPERTY_FLAG_DELETED | (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))\n\n/**\n * Type of property not found.\n */\n#define ECMA_PROPERTY_TYPE_NOT_FOUND ECMA_PROPERTY_TYPE_HASHMAP\n\n/**\n * Type of property not found and no more searching in the proto chain.\n */\n#define ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP ECMA_PROPERTY_TYPE_DELETED\n\n/**\n * Type of property not found and an exception is thrown.\n */\n#define ECMA_PROPERTY_TYPE_NOT_FOUND_AND_THROW \\\n  (ECMA_PROPERTY_FLAG_LCACHED | (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))\n\n/**\n * Checks whether a property is not found.\n */\n#define ECMA_PROPERTY_IS_FOUND(property)                                                                    \\\n  (((property) & (ECMA_PROPERTY_FLAG_DATA | (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))) \\\n   != (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))\n\n/**\n * Abstract property representation.\n *\n * A property is a type_and_flags byte and an ecma_value_t value pair.\n * This pair is represented by a single pointer in JerryScript. Although\n * a packed struct would only consume sizeof(ecma_value_t)+1 memory\n * bytes, accessing such structure is inefficient from the CPU viewpoint\n * because the value is not naturally aligned. To improve performance,\n * two type bytes and values are packed together. The memory layout is\n * the following:\n *\n *  [type 1, type 2, unused byte 1, unused byte 2][value 1][value 2]\n *\n * The unused two bytes are used to store a compressed pointer for the\n * next property pair.\n *\n * The advantage of this layout is that the value reference can be computed\n * from the property address. However, property pointers cannot be compressed\n * anymore.\n */\ntypedef uint8_t ecma_property_t; /**< ecma_property_types_t (3 bit) and ecma_property_flags_t */\n\n/**\n * Number of items in a property pair.\n */\n#define ECMA_PROPERTY_PAIR_ITEM_COUNT 2\n\n/**\n * Property header for all items in a property list.\n */\ntypedef struct\n{\n#if JERRY_CPOINTER_32_BIT\n  jmem_cpointer_t next_property_cp; /**< next cpointer */\n#endif /* JERRY_CPOINTER_32_BIT */\n  ecma_property_t types[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< two property type slot. The first represent\n                                                         *   the type of this property (e.g. property pair) */\n#if JERRY_CPOINTER_32_BIT\n  uint16_t padding; /**< an unused value */\n#else /* !JERRY_CPOINTER_32_BIT */\n  jmem_cpointer_t next_property_cp; /**< next cpointer */\n#endif /* JERRY_CPOINTER_32_BIT */\n} ecma_property_header_t;\n\n/**\n * Pair of pointers - to property's getter and setter\n */\ntypedef struct\n{\n  jmem_cpointer_t getter_cp; /**< compressed pointer to getter object */\n  jmem_cpointer_t setter_cp; /**< compressed pointer to setter object */\n} ecma_getter_setter_pointers_t;\n\n/**\n * Property data.\n */\ntypedef union\n{\n  ecma_value_t value; /**< value of a property */\n#if JERRY_CPOINTER_32_BIT\n  jmem_cpointer_t getter_setter_pair_cp; /**< cpointer to getter setter pair */\n#else /* !JERRY_CPOINTER_32_BIT */\n  ecma_getter_setter_pointers_t getter_setter_pair; /**< getter setter pair */\n#endif /* JERRY_CPOINTER_32_BIT */\n} ecma_property_value_t;\n\n/**\n * Property pair.\n */\ntypedef struct\n{\n  ecma_property_header_t header; /**< header of the property */\n  ecma_property_value_t values[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< property value slots */\n  jmem_cpointer_t names_cp[ECMA_PROPERTY_PAIR_ITEM_COUNT]; /**< property name slots */\n} ecma_property_pair_t;\n\n/**\n * Get property name type.\n */\n#define ECMA_PROPERTY_GET_NAME_TYPE(property) ((property) >> ECMA_PROPERTY_NAME_TYPE_SHIFT)\n\n/**\n * Returns true if the property pointer is a property pair.\n */\n#define ECMA_PROPERTY_IS_PROPERTY_PAIR(property_header_p) ((property_header_p)->types[0] != ECMA_PROPERTY_TYPE_HASHMAP)\n\n/**\n * Property value of all internal properties\n */\n#define ECMA_PROPERTY_INTERNAL (ECMA_PROPERTY_FLAG_DATA | (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))\n\n/**\n * Checks whether a property is internal property\n */\n#define ECMA_PROPERTY_IS_INTERNAL(property) ((property) >= ECMA_PROPERTY_INTERNAL)\n\n/**\n * Checks whether a property is raw data or accessor property\n */\n#define ECMA_PROPERTY_IS_RAW(property) ((property) < (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))\n\n/**\n * Checks whether a property is raw data property (should only be used in assertions)\n */\n#define ECMA_PROPERTY_IS_RAW_DATA(property) \\\n  (((property) &ECMA_PROPERTY_FLAG_DATA) && (property) < ECMA_PROPERTY_INTERNAL)\n\n/**\n * Create internal property.\n */\n#define ECMA_CREATE_INTERNAL_PROPERTY(object_p, name_p, property_p, property_value_p)              \\\n  do                                                                                               \\\n  {                                                                                                \\\n    (property_value_p) = ecma_create_named_data_property ((object_p), (name_p), 0, &(property_p)); \\\n    JERRY_ASSERT (*(property_p) == ECMA_PROPERTY_INTERNAL);                                        \\\n  } while (0)\n\n/**\n * Property type of all virtual properties\n */\n#define ECMA_PROPERTY_VIRTUAL ECMA_PROPERTY_INTERNAL\n\n/**\n * Checks whether a property is virtual property\n */\n#define ECMA_PROPERTY_IS_VIRTUAL(property) ECMA_PROPERTY_IS_INTERNAL (property)\n\n/**\n * Returns true if the property is named property.\n */\n#define ECMA_PROPERTY_IS_NAMED_PROPERTY(property) \\\n  ((property) < ECMA_PROPERTY_TYPE_HASHMAP || (property) >= ECMA_PROPERTY_INTERNAL)\n\n/**\n * Add the offset part to a property for computing its property data pointer.\n */\n#define ECMA_PROPERTY_VALUE_ADD_OFFSET(property_p) \\\n  ((uintptr_t) ((((uint8_t *) (property_p)) + (sizeof (ecma_property_value_t) * 2 - 1))))\n\n/**\n * Align the property for computing its property data pointer.\n */\n#define ECMA_PROPERTY_VALUE_DATA_PTR(property_p) \\\n  (ECMA_PROPERTY_VALUE_ADD_OFFSET (property_p) & ~(sizeof (ecma_property_value_t) - 1))\n\n/**\n * Compute the property data pointer of a property.\n * The property must be part of a property pair.\n */\n#define ECMA_PROPERTY_VALUE_PTR(property_p) ((ecma_property_value_t *) ECMA_PROPERTY_VALUE_DATA_PTR (property_p))\n\n/**\n * Property reference. It contains the value pointer\n * for real, and the value itself for virtual properties.\n */\ntypedef union\n{\n  ecma_property_value_t *value_p; /**< property value pointer for real properties */\n  ecma_value_t virtual_value; /**< property value for virtual properties */\n} ecma_property_ref_t;\n\n/**\n * Extended property reference, which also contains the\n * property descriptor pointer for real properties.\n */\ntypedef struct\n{\n  ecma_property_ref_t property_ref; /**< property reference */\n  ecma_property_t *property_p; /**< property descriptor pointer for real properties */\n} ecma_extended_property_ref_t;\n\n/**\n * Option flags for ecma_op_object_get_property.\n */\ntypedef enum\n{\n  ECMA_PROPERTY_GET_NO_OPTIONS = 0, /**< no option flags for ecma_op_object_get_property */\n  ECMA_PROPERTY_GET_VALUE = 1u << 0, /**< fill virtual_value field for virtual properties */\n  ECMA_PROPERTY_GET_EXT_REFERENCE = 1u << 1, /**< get extended reference to the property */\n} ecma_property_get_option_bits_t;\n\n/**\n * Internal object types.\n */\ntypedef enum\n{\n  ECMA_OBJECT_TYPE_GENERAL = 0, /**< all objects that are not belongs to the sub-types below */\n  ECMA_OBJECT_TYPE_BUILT_IN_GENERAL = 1, /**< built-in general object */\n  ECMA_OBJECT_TYPE_CLASS = 2, /**< Objects with class property */\n  ECMA_OBJECT_TYPE_BUILT_IN_CLASS = 3, /**< built-in object with class property */\n  ECMA_OBJECT_TYPE_ARRAY = 4, /**< Array object (15.4) */\n  ECMA_OBJECT_TYPE_BUILT_IN_ARRAY = 5, /**< Built-in array object */\n  ECMA_OBJECT_TYPE_PROXY = 6, /**< Proxy object ECMAScript v6 26.2 */\n  /* Note: these 4 types must be in this order. See IsCallable operation.  */\n  ECMA_OBJECT_TYPE_FUNCTION = 7, /**< Function objects (15.3), created through 13.2 routine */\n  ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION = 8, /**< Native built-in function object */\n  ECMA_OBJECT_TYPE_BOUND_FUNCTION = 9, /**< Function objects (15.3), created through 15.3.4.5 routine */\n  ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION = 10, /**< implicit class constructor function */\n  ECMA_OBJECT_TYPE_NATIVE_FUNCTION = 11, /**< Native function object */\n\n  ECMA_OBJECT_TYPE__MAX /**< maximum value */\n} ecma_object_type_t;\n\n/**\n * Base object types without built-in flag.\n *\n * Note:\n *     only these types can be checked with ecma_get_object_base_type.\n */\ntypedef enum\n{\n  ECMA_OBJECT_BASE_TYPE_GENERAL = ECMA_OBJECT_TYPE_GENERAL, /**< generic objects */\n  ECMA_OBJECT_BASE_TYPE_CLASS = ECMA_OBJECT_TYPE_CLASS, /**< Objects with class property */\n  ECMA_OBJECT_BASE_TYPE_ARRAY = ECMA_OBJECT_TYPE_ARRAY, /**< Array object (15.4) */\n} ecma_object_base_type_t;\n\n/**\n * Types of objects with class property.\n *\n * Note:\n *     when this type is changed, both ecma_class_object_magic_string_id\n *     and jerry_class_object_type must be updated as well\n */\ntypedef enum\n{\n  /* These objects require custom property resolving. */\n  ECMA_OBJECT_CLASS_STRING, /**< String Object (ECMAScript v5.1, 4.3.18) */\n  ECMA_OBJECT_CLASS_ARGUMENTS, /**< Arguments object (10.6) */\n#if JERRY_BUILTIN_TYPEDARRAY\n  ECMA_OBJECT_CLASS_TYPEDARRAY, /**< TypedArray which does NOT need extra space to store length and offset */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_MODULE_SYSTEM\n  ECMA_OBJECT_CLASS_MODULE_NAMESPACE, /**< Module Namespace (ECMAScript v11, 9.4.6) */\n#endif /* JERRY_MODULE_SYSTEM */\n\n  /* These objects are marked by Garbage Collector. */\n  ECMA_OBJECT_CLASS_GENERATOR, /**< Generator object (ECMAScript v6, 25.2) */\n  ECMA_OBJECT_CLASS_ASYNC_GENERATOR, /**< Async generator object (ECMAScript v11, 25.3) */\n  ECMA_OBJECT_CLASS_ARRAY_ITERATOR, /**< Array iterator object (ECMAScript v6, 22.1.5.1) */\n  ECMA_OBJECT_CLASS_SET_ITERATOR, /**< Set iterator object (ECMAScript v6, 23.2.5.1) */\n  ECMA_OBJECT_CLASS_MAP_ITERATOR, /**< Map iterator object (ECMAScript v6, 23.1.5.1) */\n#if JERRY_BUILTIN_REGEXP\n  ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR, /** RegExp string iterator object (ECMAScript v11, 21.2.7) */\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_MODULE_SYSTEM\n  ECMA_OBJECT_CLASS_MODULE, /**< Module (ECMAScript v6, 15.2) */\n#endif /* JERRY_MODULE_SYSTEM */\n  ECMA_OBJECT_CLASS_PROMISE, /**< Promise (ECMAScript v6, 25.4) */\n  ECMA_OBJECT_CLASS_PROMISE_CAPABILITY, /**< Promise capability (ECMAScript v6, 25.4.1.1) */\n  ECMA_OBJECT_CLASS_ASYNC_FROM_SYNC_ITERATOR, /**< AsyncFromSyncIterator (ECMAScript v11, 25.1.4) */\n#if JERRY_BUILTIN_DATAVIEW\n  ECMA_OBJECT_CLASS_DATAVIEW, /**< DataView (ECMAScript v6, 24.2) */\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_CONTAINER\n  ECMA_OBJECT_CLASS_CONTAINER, /**< Container (Map, WeakMap, Set, WeakSet) */\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n  /* Normal objects. */\n  ECMA_OBJECT_CLASS_BOOLEAN, /**< Boolean Object (ECMAScript v5.1, 4.3.15) */\n  ECMA_OBJECT_CLASS_NUMBER, /**< Number Object (ECMAScript v5.1, 4.3.21) */\n  ECMA_OBJECT_CLASS_ERROR, /**< Error Object (ECMAScript v5.1, 15.11) */\n  ECMA_OBJECT_CLASS_INTERNAL_OBJECT, /**< object for internal properties */\n#if JERRY_PARSER\n  ECMA_OBJECT_CLASS_SCRIPT, /**< Compiled ECMAScript byte code */\n#endif /* JERRY_PARSER */\n#if JERRY_BUILTIN_DATE\n  ECMA_OBJECT_CLASS_DATE, /**< Date Object (ECMAScript v5.1, 15.9) */\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_REGEXP\n  ECMA_OBJECT_CLASS_REGEXP, /**< RegExp Object (ECMAScript v5.1, 15.10) */\n#endif /* JERRY_BUILTIN_REGEXP */\n  ECMA_OBJECT_CLASS_SYMBOL, /**< Symbol object (ECMAScript v6, 4.3.27) */\n  ECMA_OBJECT_CLASS_STRING_ITERATOR, /**< String iterator object (ECMAScript v6, 22.1.5.1) */\n#if JERRY_BUILTIN_TYPEDARRAY\n  ECMA_OBJECT_CLASS_ARRAY_BUFFER, /**< Array Buffer (ECMAScript v6, 24.1) */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n  ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER, /**< Shared Array Buffer (ECMAScript v11 24.2) */\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n#if JERRY_BUILTIN_BIGINT\n  ECMA_OBJECT_CLASS_BIGINT, /**< Bigint (ECMAScript v11, 4.3.27) */\n#endif /* JERRY_BUILTIN_BIGINT */\n#if JERRY_BUILTIN_WEAKREF\n  ECMA_OBJECT_CLASS_WEAKREF, /**< WeakRef (Not standardized yet) */\n#endif /* JERRY_BUILTIN_WEAKREF */\n\n  ECMA_OBJECT_CLASS__MAX /**< maximum value */\n} ecma_object_class_type_t;\n\n/**\n * Types of lexical environments.\n */\ntypedef enum\n{\n  /* Types between 0 - 12 are ecma_object_type_t. */\n  ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE = 13, /**< declarative lexical environment */\n  ECMA_LEXICAL_ENVIRONMENT_CLASS = 14, /**< lexical environment with class */\n  ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND = 15, /**< object-bound lexical environment */\n\n  ECMA_LEXICAL_ENVIRONMENT_TYPE_START = ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE, /**< first lexical\n                                                                               *   environment type */\n  ECMA_LEXICAL_ENVIRONMENT_TYPE__MAX = ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND /**< maximum value */\n} ecma_lexical_environment_type_t;\n\n/**\n * Types of array iterators.\n */\ntypedef enum\n{\n  ECMA_ITERATOR_KEYS, /**< keys iterator */\n  ECMA_ITERATOR_VALUES, /**< values iterator */\n  ECMA_ITERATOR_ENTRIES, /**< entries iterator */\n  ECMA_ITERATOR__COUNT, /**< number of iterator kinds */\n} ecma_iterator_kind_t;\n\n/**\n * Offset for JERRY_CONTEXT (status_flags) top 8 bits.\n */\n#define ECMA_LOCAL_PARSE_OPTS_OFFSET ((sizeof (uint32_t) - sizeof (uint8_t)) * JERRY_BITSINBYTE)\n\n/**\n * Set JERRY_CONTEXT (status_flags) top 8 bits to the specified 'opts'.\n */\n#define ECMA_SET_LOCAL_PARSE_OPTS(opts)                                                                          \\\n  do                                                                                                             \\\n  {                                                                                                              \\\n    JERRY_CONTEXT (status_flags) |= ((uint32_t) opts << ECMA_LOCAL_PARSE_OPTS_OFFSET) | ECMA_STATUS_DIRECT_EVAL; \\\n  } while (0)\n\n/**\n * Get JERRY_CONTEXT (status_flags) top 8 bits.\n */\n#define ECMA_GET_LOCAL_PARSE_OPTS() \\\n  (JERRY_CONTEXT (status_flags) >> (ECMA_LOCAL_PARSE_OPTS_OFFSET - JERRY_LOG2 (ECMA_PARSE_ALLOW_SUPER)))\n\n/**\n * Clear JERRY_CONTEXT (status_flags) top 8 bits.\n */\n#define ECMA_CLEAR_LOCAL_PARSE_OPTS()                                          \\\n  do                                                                           \\\n  {                                                                            \\\n    JERRY_CONTEXT (status_flags) &= ((1 << ECMA_LOCAL_PARSE_OPTS_OFFSET) - 1); \\\n  } while (0)\n\n/**\n * Ecma object type mask for getting the object type.\n */\n#define ECMA_OBJECT_TYPE_MASK 0x00fu\n\n/**\n * Extensible object.\n */\n#define ECMA_OBJECT_FLAG_EXTENSIBLE 0x10\n\n/**\n * Declarative lexical environments created for non-closure code blocks\n */\n#define ECMA_OBJECT_FLAG_BLOCK ECMA_OBJECT_FLAG_EXTENSIBLE\n\n/**\n * Lexical environments with class has extra data\n */\n#define ECMA_OBJECT_FLAG_LEXICAL_ENV_HAS_DATA ECMA_OBJECT_FLAG_EXTENSIBLE\n\n/**\n * Bitshift index for an ecma-object reference count field\n */\n#define ECMA_OBJECT_REF_SHIFT 5\n\n/**\n * Value for increasing or decreasing the object reference counter.\n */\n#define ECMA_OBJECT_REF_ONE (1u << ECMA_OBJECT_REF_SHIFT)\n\n#if JERRY_CPOINTER_32_BIT\n\n/**\n * Type of the descriptor field of an object\n */\ntypedef uint32_t ecma_object_descriptor_t;\n\n#else /* !JERRY_CPOINTER_32_BIT */\n\n/**\n * Type of the descriptor field of an object\n */\ntypedef uint16_t ecma_object_descriptor_t;\n\n#endif /* JERRY_CPOINTER_32_BIT */\n\n/**\n * Bitmask for an ecma-object reference count field\n */\n#define ECMA_OBJECT_REF_MASK ((ecma_object_descriptor_t) (~0u << ECMA_OBJECT_REF_SHIFT))\n\n/**\n * Represents non-visited white object\n */\n#define ECMA_OBJECT_NON_VISITED ECMA_OBJECT_REF_MASK\n\n/**\n * Maximum value of the object reference counter (1022 / 67108862).\n */\n#define ECMA_OBJECT_MAX_REF (ECMA_OBJECT_NON_VISITED - ECMA_OBJECT_REF_ONE)\n\n/**\n * Description of ECMA-object or lexical environment\n * (depending on is_lexical_environment).\n */\ntypedef struct\n{\n  /** type : 4 bit : ecma_object_type_t or ecma_lexical_environment_type_t\n                     depending on ECMA_OBJECT_FLAG_BUILT_IN_OR_LEXICAL_ENV\n      flags : 2 bit : ECMA_OBJECT_FLAG_BUILT_IN_OR_LEXICAL_ENV,\n                      ECMA_OBJECT_FLAG_EXTENSIBLE or ECMA_OBJECT_FLAG_BLOCK\n      refs : 10 / 26 bit (max 1022 / 67108862) */\n  ecma_object_descriptor_t type_flags_refs;\n\n  /** next in the object chain maintained by the garbage collector */\n  jmem_cpointer_t gc_next_cp;\n\n  /** compressed pointer to property list or bound object */\n  union\n  {\n    jmem_cpointer_t property_list_cp; /**< compressed pointer to object's\n                                       *   or declerative lexical environments's property list */\n    jmem_cpointer_t bound_object_cp; /**< compressed pointer to lexical environments's the bound object */\n    jmem_cpointer_t home_object_cp; /**< compressed pointer to lexical environments's the home object */\n  } u1;\n\n  /** object prototype or outer reference */\n  union\n  {\n    jmem_cpointer_t prototype_cp; /**< compressed pointer to the object's prototype  */\n    jmem_cpointer_t outer_reference_cp; /**< compressed pointer to the lexical environments's outer reference  */\n  } u2;\n} ecma_object_t;\n\n/**\n * Description of built-in properties of an object.\n */\ntypedef struct\n{\n  uint8_t id; /**< built-in id */\n  uint8_t routine_id; /**< routine id for built-in functions */\n  /** built-in specific field */\n  union\n  {\n    uint8_t length_and_bitset_size; /**< length and bit set size for generic built-ins */\n    uint8_t routine_index; /**< property descriptor index for built-in routines */\n  } u;\n  /** extra built-in info */\n  union\n  {\n    uint8_t instantiated_bitset[1]; /**< instantiated property bit set for generic built-ins */\n    uint8_t routine_flags; /**< flags for built-in routines */\n  } u2;\n\n#if JERRY_BUILTIN_REALMS\n  ecma_value_t realm_value; /**< realm value */\n#else /* !JERRY_BUILTIN_REALMS */\n  uint32_t continue_instantiated_bitset[1]; /**< bit set for instantiated properties */\n#endif /* JERRY_BUILTIN_REALMS */\n} ecma_built_in_props_t;\n\n/**\n * Type of a built-in function handler.\n */\ntypedef ecma_value_t (*ecma_builtin_handler_t) (ecma_object_t *function_obj_p,\n                                                const ecma_value_t args_p[],\n                                                const uint32_t args_count);\n\n#if JERRY_BUILTIN_REALMS\n\n/**\n * Number of bits available in the instantiated bitset without allocation\n */\n#define ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE (8)\n\n#else /* !JERRY_BUILTIN_REALMS */\n\n/**\n * Number of bits available in the instantiated bitset without allocation\n */\n#define ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE (8 + 32)\n\n#endif /* JERRY_BUILTIN_REALMS */\n\n/**\n * Builtin routine function object status flags\n */\ntypedef enum\n{\n  ECMA_BUILTIN_ROUTINE_NO_OPTS = 0, /**< No options are provided */\n  ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED = (1u << 0), /**< 'length' property has been initialized */\n  ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED = (1u << 1), /**< 'name' property has been initialized */\n  ECMA_BUILTIN_ROUTINE_GETTER = (1u << 2), /**< this routine is getter */\n  ECMA_BUILTIN_ROUTINE_SETTER = (1u << 3), /**< this routine is setter */\n} ecma_builtin_routine_flags_t;\n\n/**\n * Start position of bit set size in length_and_bitset_size field.\n */\n#define ECMA_BUILT_IN_BITSET_SHIFT 5\n\n/**\n * Description of extended ECMA-object.\n *\n * The extended object is an object with extra fields.\n */\ntypedef struct\n{\n  ecma_object_t object; /**< object header */\n\n  /**\n   * Description of extra fields. These extra fields depend on the object type.\n   */\n  union\n  {\n    ecma_built_in_props_t built_in; /**< built-in object part */\n\n    /**\n     * Description of objects with class.\n     *\n     * Note:\n     *     class is a reserved word in c++, so cls is used instead\n     */\n    struct\n    {\n      uint8_t type; /**< class type of the object */\n      /**\n       * Description of 8 bit extra fields. These extra fields depend on the type.\n       */\n      union\n      {\n        uint8_t arguments_flags; /**< arguments object flags */\n        uint8_t error_type; /**< jerry_error_t type of native error objects */\n#if JERRY_BUILTIN_DATE\n        uint8_t date_flags; /**< flags for date objects */\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_MODULE_SYSTEM\n        uint8_t module_state; /**< Module state */\n#endif /* JERRY_MODULE_SYSTEM */\n        uint8_t iterator_kind; /**< type of iterator */\n        uint8_t regexp_string_iterator_flags; /**< flags for RegExp string iterator */\n        uint8_t promise_flags; /**< Promise object flags */\n#if JERRY_BUILTIN_CONTAINER\n        uint8_t container_flags; /**< container object flags */\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_TYPEDARRAY\n        uint8_t array_buffer_flags; /**< ArrayBuffer flags */\n        uint8_t typedarray_type; /**< type of typed array */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n      } u1;\n      /**\n       * Description of 16 bit extra fields. These extra fields depend on the type.\n       */\n      union\n      {\n        uint16_t formal_params_number; /**< for arguments: formal parameters number */\n#if JERRY_MODULE_SYSTEM\n        uint16_t module_flags; /**< Module flags */\n#endif /* JERRY_MODULE_SYSTEM */\n        uint16_t iterator_index; /**< for %Iterator%: [[%Iterator%NextIndex]] property */\n        uint16_t executable_obj_flags; /**< executable object flags */\n#if JERRY_BUILTIN_CONTAINER\n        uint16_t container_id; /**< magic string id of a container */\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_TYPEDARRAY\n        uint16_t typedarray_flags; /**< typed array object flags */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n      } u2;\n      /**\n       * Description of 32 bit / value. These extra fields depend on the type.\n       */\n      union\n      {\n        ecma_value_t value; /**< value of the object (e.g. boolean, number, string, etc.) */\n        ecma_value_t target; /**< [[ProxyTarget]] or [[WeakRefTarget]] internal property */\n#if JERRY_BUILTIN_TYPEDARRAY\n        ecma_value_t arraybuffer; /**< for typedarray: ArrayBuffer reference */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n        ecma_value_t head; /**< points to the async generator task queue head item */\n        ecma_value_t iterated_value; /**< for %Iterator%: [[IteratedObject]] property */\n        ecma_value_t promise; /**< PromiseCapability[[Promise]] internal slot */\n        ecma_value_t sync_iterator; /**< IteratorRecord [[Iterator]] internal slot for AsyncFromSyncIterator */\n        ecma_value_t spread_value; /**< for spread object: spreaded element */\n        int32_t tza; /**< TimeZone adjustment for date objects */\n        uint32_t length; /**< length related property (e.g. length of ArrayBuffer) */\n        uint32_t arguments_number; /**< for arguments: arguments number */\n#if JERRY_MODULE_SYSTEM\n        uint32_t dfs_ancestor_index; /**< module dfs ancestor index (ES2020 15.2.1.16) */\n#endif /* JERRY_MODULE_SYSTEM */\n      } u3;\n    } cls;\n\n    /**\n     * Description of function objects.\n     */\n    struct\n    {\n      jmem_cpointer_tag_t scope_cp; /**< function scope */\n      ecma_value_t bytecode_cp; /**< function byte code */\n    } function;\n\n    /**\n     * Description of array objects.\n     */\n    struct\n    {\n      uint32_t length; /**< length property value */\n      uint32_t length_prop_and_hole_count; /**< length property attributes and number of array holes in\n                                            *   a fast access mode array multiplied ECMA_FAST_ACCESS_HOLE_ONE */\n    } array;\n\n    /**\n     * Description of bound function object.\n     */\n    struct\n    {\n      jmem_cpointer_tag_t target_function; /**< target function */\n      ecma_value_t args_len_or_this; /**< length of arguments or this value */\n    } bound_function;\n\n    /**\n     * Description of implicit class constructor function.\n     */\n    struct\n    {\n      ecma_value_t script_value; /**< script value */\n      uint8_t flags; /**< constructor flags */\n    } constructor_function;\n  } u;\n} ecma_extended_object_t;\n\n/**\n * Description of built-in extended ECMA-object.\n */\ntypedef struct\n{\n  ecma_extended_object_t extended_object; /**< extended object part */\n  ecma_built_in_props_t built_in; /**< built-in object part */\n} ecma_extended_built_in_object_t;\n\n/**\n * Type of lexical environment with class\n */\ntypedef enum\n{\n  ECMA_LEX_ENV_CLASS_TYPE_MODULE, /**< module object reference */\n  ECMA_LEX_ENV_CLASS_TYPE_CLASS_ENV, /**< class constructor object reference */\n} ecma_lexical_environment_class_type_t;\n\n/**\n * Description of lexical environment with class\n */\ntypedef struct\n{\n  ecma_object_t lexical_env; /**< lexical environment header */\n  uint32_t type; /**< element of ecma_lexical_environment_class_type_t */\n  ecma_object_t *object_p; /**< object reference */\n} ecma_lexical_environment_class_t;\n\n/**\n * Check whether the given lexical class environment is a module\n */\n#define ECMA_LEX_ENV_CLASS_IS_MODULE(lex_env_p)                           \\\n  (((lex_env_p)->type_flags_refs & ECMA_OBJECT_FLAG_LEXICAL_ENV_HAS_DATA) \\\n   && ((ecma_lexical_environment_class_t *) (lex_env_p))->type == ECMA_LEX_ENV_CLASS_TYPE_MODULE)\n\n/**\n * Description of native functions\n */\ntypedef struct\n{\n  ecma_extended_object_t extended_object; /**< extended object part */\n#if JERRY_BUILTIN_REALMS\n  ecma_value_t realm_value; /**< realm value */\n#endif /* JERRY_BUILTIN_REALMS */\n  ecma_native_handler_t native_handler_cb; /**< external function */\n} ecma_native_function_t;\n\n/**\n * Alignment for the fast access mode array length.\n * The real length is aligned up for allocating the underlying buffer.\n */\n#define ECMA_FAST_ARRAY_ALIGNMENT (8)\n\n/**\n * Align the length of the fast mode array to get the allocated size of the underlying buffer\n */\n#define ECMA_FAST_ARRAY_ALIGN_LENGTH(length) \\\n  (uint32_t) ((((length)) + ECMA_FAST_ARRAY_ALIGNMENT - 1) / ECMA_FAST_ARRAY_ALIGNMENT * ECMA_FAST_ARRAY_ALIGNMENT)\n\n/**\n * Compiled byte code data.\n */\ntypedef struct\n{\n  uint16_t size; /**< real size >> JMEM_ALIGNMENT_LOG */\n  uint16_t refs; /**< reference counter for the byte code */\n  uint16_t status_flags; /**< various status flags:\n                          *   CBC_IS_FUNCTION check tells whether the byte code\n                          *   is function or regular expression.\n                          *   If function, the other flags must be CBC_CODE_FLAGS...\n                          *   If regexp, the other flags must be RE_FLAG... */\n} ecma_compiled_code_t;\n\n/**\n * Description of bound function objects.\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< extended object header */\n  ecma_value_t target_length; /**< length of target function */\n} ecma_bound_function_t;\n\n#if JERRY_SNAPSHOT_EXEC\n\n/**\n * Description of static function objects.\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< header part */\n  const ecma_compiled_code_t *bytecode_p; /**< real byte code pointer */\n} ecma_static_function_t;\n\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n/**\n * Description of arrow function objects.\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< extended object header */\n  ecma_value_t this_binding; /**< value of 'this' binding */\n  ecma_value_t new_target; /**< value of new.target */\n} ecma_arrow_function_t;\n\n#if JERRY_SNAPSHOT_EXEC\n\n/**\n * Description of static arrow function objects.\n */\ntypedef struct\n{\n  ecma_arrow_function_t header;\n  const ecma_compiled_code_t *bytecode_p;\n} ecma_static_arrow_function_t;\n\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n#if JERRY_BUILTIN_CONTAINER\n/**\n * Flags for container objects\n */\ntypedef enum\n{\n  ECMA_CONTAINER_FLAGS_EMPTY = (0), /** empty flags */\n  ECMA_CONTAINER_FLAGS_WEAK = (1 << 0) /** container object is weak */\n} ecma_container_flags_t;\n\n/**\n * Description of map collection.\n */\ntypedef struct\n{\n  ecma_value_t key; /**< key value */\n  ecma_value_t value; /**< value of the key */\n} ecma_container_pair_t;\n\n/**\n * Size of a single element (in ecma_value_t unit).\n */\n#define ECMA_CONTAINER_VALUE_SIZE 1\n\n/**\n * Size of a key - value pair (in ecma_value_t unit).\n */\n#define ECMA_CONTAINER_PAIR_SIZE 2\n\n/**\n * Size of the internal buffer.\n */\n#define ECMA_CONTAINER_GET_SIZE(container_p) (container_p->buffer_p[0])\n\n/**\n * Remove the size field of the internal buffer.\n */\n#define ECMA_CONTAINER_SET_SIZE(container_p, size) (container_p->buffer_p[0] = (ecma_value_t) (size))\n\n/**\n * Number of entries of the internal buffer.\n */\n#define ECMA_CONTAINER_ENTRY_COUNT(collection_p) (collection_p->item_count - 1)\n\n/**\n * Pointer to the first entry of the internal buffer.\n */\n#define ECMA_CONTAINER_START(collection_p) (collection_p->buffer_p + 1)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n/**\n * Description of ECMA property descriptor\n *\n * See also: ECMA-262 v5, 8.10.\n *\n * Note:\n *      If a component of descriptor is undefined then corresponding\n *      field should contain it's default value.\n */\ntypedef struct\n{\n  uint16_t flags; /**< any combination of jerry_property_descriptor_flags_t bits */\n  ecma_value_t value; /**< [[Value]] */\n  ecma_object_t *get_p; /**< [[Get]] */\n  ecma_object_t *set_p; /**< [[Set]] */\n} ecma_property_descriptor_t;\n\n/**\n * Bitfield which represents a namedata property options in an ecma_property_descriptor_t\n * Attributes:\n *  - is_get_defined, is_set_defined : false\n *  - is_configurable, is_writable, is_enumerable : undefined (false)\n *  - is_throw : undefined (false)\n *  - is_value_defined : true\n *  - is_configurable_defined, is_writable_defined, is_enumerable_defined : true\n */\n#define ECMA_NAME_DATA_PROPERTY_DESCRIPTOR_BITS                                                                    \\\n  ((uint16_t) (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE_DEFINED \\\n               | JERRY_PROP_IS_WRITABLE_DEFINED))\n\n/**\n * Bitmask to get a the physical property flags from an ecma_property_descriptor\n */\n#define ECMA_PROPERTY_FLAGS_MASK \\\n  ((uint16_t) (JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_WRITABLE))\n\n/**\n * Description of an ecma-number\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\ntypedef double ecma_number_t;\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\ntypedef float ecma_number_t;\n#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Convert double to an ecma-number.\n */\n#define DOUBLE_TO_ECMA_NUMBER_T(value) ((ecma_number_t) (value))\n\n/**\n * Value '0' of ecma_number_t\n */\n#define ECMA_NUMBER_ZERO ((ecma_number_t) 0.0f)\n\n/**\n * Value '1' of ecma_number_t\n */\n#define ECMA_NUMBER_ONE ((ecma_number_t) 1.0f)\n\n/**\n * Value '2' of ecma_number_t\n */\n#define ECMA_NUMBER_TWO ((ecma_number_t) 2.0f)\n\n/**\n * Value '0.5' of ecma_number_t\n */\n#define ECMA_NUMBER_HALF ((ecma_number_t) 0.5f)\n\n/**\n * Value '-1' of ecma_number_t\n */\n#define ECMA_NUMBER_MINUS_ONE ((ecma_number_t) -1.0f)\n\n/**\n * Maximum number of characters in string representation of ecma-number\n */\n#define ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER 64\n\n/**\n * Maximum number of characters in string representation of ecma-uint32\n */\n#define ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32 10\n\n/**\n * String is not a valid array index.\n */\n#define ECMA_STRING_NOT_ARRAY_INDEX UINT32_MAX\n\n/**\n * Ecma-collection: a growable list of ecma-values.\n */\ntypedef struct\n{\n  uint32_t item_count; /**< number of items in the collection */\n  uint32_t capacity; /**< number of items can be stored in the underlying buffer */\n  ecma_value_t *buffer_p; /**< underlying data buffer */\n} ecma_collection_t;\n\n/**\n * Initial capacity of an ecma-collection\n */\n#define ECMA_COLLECTION_INITIAL_CAPACITY 4\n\n/**\n * Ecma-collenction grow factor when the collection underlying buffer need to be reallocated\n */\n#define ECMA_COLLECTION_GROW_FACTOR (ECMA_COLLECTION_INITIAL_CAPACITY * 2)\n\n/**\n * Compute the total allocated size of the collection based on it's capacity\n */\n#define ECMA_COLLECTION_ALLOCATED_SIZE(capacity) (uint32_t) (capacity * sizeof (ecma_value_t))\n\n/**\n * Initial allocated size of an ecma-collection\n */\n#define ECMA_COLLECTION_INITIAL_SIZE ECMA_COLLECTION_ALLOCATED_SIZE (ECMA_COLLECTION_INITIAL_CAPACITY)\n\n/**\n * Size shift of a compact collection\n */\n#define ECMA_COMPACT_COLLECTION_SIZE_SHIFT 3\n\n/**\n * Get the size of the compact collection\n */\n#define ECMA_COMPACT_COLLECTION_GET_SIZE(compact_collection_p) \\\n  ((compact_collection_p)[0] >> ECMA_COMPACT_COLLECTION_SIZE_SHIFT)\n\n/**\n * Direct string types (2 bit).\n */\ntypedef enum\n{\n  ECMA_DIRECT_STRING_PTR = 0, /**< string is a string pointer, only used by property names */\n  ECMA_DIRECT_STRING_MAGIC = 1, /**< string is a magic string */\n  ECMA_DIRECT_STRING_UINT = 2, /**< string is an unsigned int */\n  ECMA_DIRECT_STRING_SPECIAL = 3, /**< string is special */\n} ecma_direct_string_type_t;\n\n/**\n * Maximum value of the immediate part of a direct magic string.\n * Must be compatible with the immediate property name.\n */\n#if JERRY_CPOINTER_32_BIT\n#define ECMA_DIRECT_STRING_MAX_IMM 0x07ffffff\n#else /* !JERRY_CPOINTER_32_BIT */\n#define ECMA_DIRECT_STRING_MAX_IMM 0x0000ffff\n#endif /* JERRY_CPOINTER_32_BIT */\n\n/**\n * Shift for direct string value part in ecma_value_t.\n */\n#define ECMA_DIRECT_STRING_SHIFT (ECMA_VALUE_SHIFT + 2)\n\n/**\n * Full mask for direct strings.\n */\n#define ECMA_DIRECT_STRING_MASK ((uintptr_t) (ECMA_DIRECT_TYPE_MASK | (0x3u << ECMA_VALUE_SHIFT)))\n\n/**\n * Create an ecma direct string.\n */\n#define ECMA_CREATE_DIRECT_STRING(type, value) \\\n  ((uintptr_t) (ECMA_TYPE_DIRECT_STRING | ((type) << ECMA_VALUE_SHIFT) | (value) << ECMA_DIRECT_STRING_SHIFT))\n\n/**\n * Create an ecma direct string from the given number.\n *\n * Note: the given number must be less or equal than ECMA_DIRECT_STRING_MAX_IMM\n */\n#define ECMA_CREATE_DIRECT_UINT32_STRING(uint32_number) \\\n  ((ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_UINT, (uintptr_t) uint32_number))\n\n/**\n * Checks whether the string is direct.\n */\n#define ECMA_IS_DIRECT_STRING(string_p) ((((uintptr_t) (string_p)) & 0x1) != 0)\n\n/**\n * Checks whether the string is direct.\n */\n#define ECMA_IS_DIRECT_STRING_WITH_TYPE(string_p, type) \\\n  ((((uintptr_t) (string_p)) & ECMA_DIRECT_STRING_MASK) == ECMA_CREATE_DIRECT_STRING (type, 0))\n\n/**\n * Returns the type of a direct string.\n */\n#define ECMA_GET_DIRECT_STRING_TYPE(string_p) ((((uintptr_t) (string_p)) >> ECMA_VALUE_SHIFT) & 0x3)\n\n/**\n * Shift applied to type conversions.\n */\n#define ECMA_STRING_TYPE_CONVERSION_SHIFT (ECMA_PROPERTY_NAME_TYPE_SHIFT - ECMA_VALUE_SHIFT)\n\n/**\n * Converts direct string type to property name type.\n */\n#define ECMA_DIRECT_STRING_TYPE_TO_PROP_NAME_TYPE(string_p) \\\n  ((((uintptr_t) (string_p)) & (0x3 << ECMA_VALUE_SHIFT)) << ECMA_STRING_TYPE_CONVERSION_SHIFT)\n\n/**\n * Returns the value of a direct string.\n */\n#define ECMA_GET_DIRECT_STRING_VALUE(string_p) (((uintptr_t) (string_p)) >> ECMA_DIRECT_STRING_SHIFT)\n\n/**\n * Maximum number of bytes that a long-utf8-string is able to store\n */\n#define ECMA_STRING_SIZE_LIMIT UINT32_MAX\n\ntypedef enum\n{\n  ECMA_STRING_CONTAINER_HEAP_UTF8_STRING, /**< actual data is on the heap as an utf-8 (cesu8) string\n                                           *   maximum size is 2^16. */\n  ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING, /**< the string is a long string or provided externally\n                                                  *   and only its attributes are stored. */\n  ECMA_STRING_CONTAINER_UINT32_IN_DESC, /**< string representation of an uint32 number */\n  ECMA_STRING_CONTAINER_HEAP_ASCII_STRING, /**< actual data is on the heap as an ASCII string\n                                            *   maximum size is 2^16. */\n  ECMA_STRING_CONTAINER_MAGIC_STRING_EX, /**< the ecma-string is equal to one of external magic strings */\n  ECMA_STRING_CONTAINER_SYMBOL, /**< the ecma-string is a symbol */\n\n  ECMA_STRING_CONTAINER__MAX = ECMA_STRING_CONTAINER_SYMBOL /**< maximum value */\n} ecma_string_container_t;\n\n/**\n * Mask for getting the container of a string.\n */\n#define ECMA_STRING_CONTAINER_MASK 0x7u\n\n/**\n * Value for increasing or decreasing the reference counter.\n */\n#define ECMA_STRING_REF_ONE (1u << 4)\n\n/**\n * Maximum value of the reference counter (4294967280).\n */\n#define ECMA_STRING_MAX_REF (0xFFFFFFF0)\n\n/**\n * Flag that identifies that the string is static which means it is stored in JERRY_CONTEXT (string_list_cp)\n */\n#define ECMA_STATIC_STRING_FLAG (1 << 3)\n\n/**\n * Set an ecma-string as static string\n */\n#define ECMA_SET_STRING_AS_STATIC(string_p) (string_p)->refs_and_container |= ECMA_STATIC_STRING_FLAG\n\n/**\n * Checks whether the ecma-string is static string\n */\n#define ECMA_STRING_IS_STATIC(string_p) ((string_p)->refs_and_container & ECMA_STATIC_STRING_FLAG)\n\n/**\n * Returns with the container type of a string.\n */\n#define ECMA_STRING_GET_CONTAINER(string_desc_p) \\\n  ((ecma_string_container_t) ((string_desc_p)->refs_and_container & ECMA_STRING_CONTAINER_MASK))\n\n/**\n * Checks whether the reference counter is 1 of a string.\n */\n#define ECMA_STRING_IS_REF_EQUALS_TO_ONE(string_desc_p) (((string_desc_p)->refs_and_container >> 4) == 1)\n\n/**\n * Checks whether the reference counter is 1 of an extended primitive.\n */\n#define ECMA_EXTENDED_PRIMITIVE_IS_REF_EQUALS_TO_ONE(extended_primitive_p) \\\n  (((extended_primitive_p)->refs_and_type >> 3) == 1)\n\n/**\n * ECMA string-value descriptor\n */\ntypedef struct\n{\n  /** Reference counter for the string */\n  uint32_t refs_and_container;\n\n  /**\n   * Actual data or identifier of it's place in container (depending on 'container' field)\n   */\n  union\n  {\n    lit_string_hash_t hash; /**< hash of the ASCII/UTF8 string */\n    uint32_t magic_string_ex_id; /**< identifier of an external magic string (lit_magic_string_ex_id_t) */\n    uint32_t uint32_number; /**< uint32-represented number placed locally in the descriptor */\n  } u;\n} ecma_string_t;\n\n/**\n * ECMA UTF8 string-value descriptor\n */\ntypedef struct\n{\n  ecma_string_t header; /**< string header */\n  uint16_t size; /**< size of this utf-8 string in bytes */\n  uint16_t length; /**< length of this utf-8 string in characters */\n} ecma_short_string_t;\n\n/**\n * Long or external CESU8 string-value descriptor\n */\ntypedef struct\n{\n  ecma_string_t header; /**< string header */\n  const lit_utf8_byte_t *string_p; /**< string data */\n  lit_utf8_size_t size; /**< size of this external string in bytes */\n  lit_utf8_size_t length; /**< length of this external string in characters */\n} ecma_long_string_t;\n\n/**\n * External UTF8 string-value descriptor\n */\ntypedef struct\n{\n  ecma_long_string_t header; /**< long string header */\n  void *user_p; /**< user pointer passed to the callback when the string is freed */\n} ecma_external_string_t;\n\n/**\n * Header size of an ecma ASCII string\n */\n#define ECMA_ASCII_STRING_HEADER_SIZE ((lit_utf8_size_t) (sizeof (ecma_string_t) + sizeof (uint8_t)))\n\n/**\n * Get the size of an ecma ASCII string\n */\n#define ECMA_ASCII_STRING_GET_SIZE(string_p) \\\n  ((lit_utf8_size_t) * ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_string_t)) + 1)\n\n/**\n * Set the size of an ecma ASCII string\n */\n#define ECMA_ASCII_STRING_SET_SIZE(string_p, size) \\\n  (*((lit_utf8_byte_t *) (string_p) + sizeof (ecma_string_t)) = (uint8_t) ((size) -1))\n\n/**\n * Get the start position of the string buffer of an ecma ASCII string\n */\n#define ECMA_ASCII_STRING_GET_BUFFER(string_p) ((lit_utf8_byte_t *) (string_p) + ECMA_ASCII_STRING_HEADER_SIZE)\n\n/**\n * Get the start position of the string buffer of an ecma UTF8 string\n */\n#define ECMA_SHORT_STRING_GET_BUFFER(string_p) ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_short_string_t))\n\n/**\n * Get the start position of the string buffer of an ecma long CESU8 string\n */\n#define ECMA_LONG_STRING_BUFFER_START(string_p) ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_long_string_t))\n\n/**\n * ECMA extended string-value descriptor\n */\ntypedef struct\n{\n  ecma_string_t header; /**< string header */\n\n  union\n  {\n    ecma_value_t symbol_descriptor; /**< symbol descriptor string-value */\n    ecma_value_t value; /**< original key value corresponds to the map key string */\n  } u;\n} ecma_extended_string_t;\n\n/**\n * Required number of ecma values in a compact collection to represent PrivateElement\n */\n#define ECMA_PRIVATE_ELEMENT_LIST_SIZE 3\n\n/**\n * String builder header\n */\ntypedef struct\n{\n  lit_utf8_size_t current_size; /**< size of the data in the buffer */\n} ecma_stringbuilder_header_t;\n\n/**\n * Get pointer to the beginning of the stored string in the string builder\n */\n#define ECMA_STRINGBUILDER_STRING_PTR(header_p) \\\n  ((lit_utf8_byte_t *) (((lit_utf8_byte_t *) header_p) + ECMA_ASCII_STRING_HEADER_SIZE))\n\n/**\n * Get the size of the stored string in the string builder\n */\n#define ECMA_STRINGBUILDER_STRING_SIZE(header_p) \\\n  ((lit_utf8_size_t) (header_p->current_size - ECMA_ASCII_STRING_HEADER_SIZE))\n\n/**\n * String builder handle\n */\ntypedef struct\n{\n  ecma_stringbuilder_header_t *header_p; /**< pointer to header */\n} ecma_stringbuilder_t;\n\n#ifndef JERRY_BUILTIN_BIGINT\n/**\n * BigInt type.\n */\n#define ECMA_EXTENDED_PRIMITIVE_BIGINT 0\n#endif /* !defined (JERRY_BUILTIN_BIGINT) */\n\n/**\n * Flags for exception values.\n */\ntypedef enum\n{\n  ECMA_ERROR_API_FLAG_NONE = 0,\n  ECMA_ERROR_API_FLAG_ABORT = (1u << 0), /**< abort flag */\n  ECMA_ERROR_API_FLAG_THROW_CAPTURED = (1u << 1), /**< throw captured flag */\n} ecma_error_api_flags_t;\n\n/**\n * Representation of a thrown value on API level.\n */\ntypedef struct\n{\n  uint32_t refs_and_type; /**< reference counter and type */\n  union\n  {\n    ecma_value_t value; /**< referenced value */\n    uint32_t bigint_sign_and_size; /**< BigInt properties */\n  } u;\n} ecma_extended_primitive_t;\n\n/**\n * Value for increasing or decreasing the reference counter.\n */\n#define ECMA_EXTENDED_PRIMITIVE_REF_ONE (1u << 3)\n\n/**\n * Maximum value of the reference counter.\n */\n#define ECMA_EXTENDED_PRIMITIVE_MAX_REF (UINT32_MAX - (ECMA_EXTENDED_PRIMITIVE_REF_ONE - 1))\n\n#if JERRY_PROPERTY_HASHMAP\n\n/**\n * The lowest state of the ecma_prop_hashmap_alloc_state counter.\n * If ecma_prop_hashmap_alloc_state other other than this value, it is\n * disabled.\n */\n#define ECMA_PROP_HASHMAP_ALLOC_ON 0\n\n/**\n * The highest state of the ecma_prop_hashmap_alloc_state counter.\n */\n#define ECMA_PROP_HASHMAP_ALLOC_MAX 4\n\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n/**\n * Number of values in a literal storage item\n */\n#define ECMA_LIT_STORAGE_VALUE_COUNT 3\n\n/**\n * Literal storage item\n */\ntypedef struct\n{\n  jmem_cpointer_t next_cp; /**< cpointer ot next item */\n  jmem_cpointer_t values[ECMA_LIT_STORAGE_VALUE_COUNT]; /**< list of values */\n} ecma_lit_storage_item_t;\n\n#if JERRY_LCACHE\n/**\n * Container of an LCache entry identifier\n */\n#if JERRY_CPOINTER_32_BIT\ntypedef uint64_t ecma_lcache_hash_entry_id_t;\n#else /* !JERRY_CPOINTER_32_BIT */\ntypedef uint32_t ecma_lcache_hash_entry_id_t;\n#endif /* JERRY_CPOINTER_32_BIT */\n\n/**\n * Entry of LCache hash table\n */\ntypedef struct\n{\n  /** Pointer to a property of the object */\n  ecma_property_t *prop_p;\n\n  /** Entry identifier in LCache */\n  ecma_lcache_hash_entry_id_t id;\n} ecma_lcache_hash_entry_t;\n\n/**\n * Number of rows in LCache's hash table\n */\n#define ECMA_LCACHE_HASH_ROWS_COUNT 128\n\n/**\n * Number of entries in a row of LCache's hash table\n */\n#define ECMA_LCACHE_HASH_ROW_LENGTH 2\n\n#endif /* JERRY_LCACHE */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/**\n * Function callback descriptor of a %TypedArray% object getter\n */\ntypedef ecma_value_t (*ecma_typedarray_getter_fn_t) (lit_utf8_byte_t *src);\n\n/**\n * Function callback descriptor of a %TypedArray% object setter\n */\ntypedef ecma_value_t (*ecma_typedarray_setter_fn_t) (lit_utf8_byte_t *src, ecma_value_t value);\n\n/**\n * Builtin id for the different types of TypedArray's\n */\ntypedef enum\n{\n  ECMA_INT8_ARRAY, /**< Int8Array */\n  ECMA_UINT8_ARRAY, /**< Uint8Array */\n  ECMA_UINT8_CLAMPED_ARRAY, /**< Uint8ClampedArray */\n  ECMA_INT16_ARRAY, /**< Int16Array */\n  ECMA_UINT16_ARRAY, /**< Uint16Array */\n  ECMA_INT32_ARRAY, /**< Int32Array */\n  ECMA_UINT32_ARRAY, /**< Uint32Array */\n  ECMA_FLOAT32_ARRAY, /**< Float32Array */\n  ECMA_FLOAT64_ARRAY, /**< Float64Array */\n  /* ECMA_TYPEDARRAY_IS_BIGINT_TYPE macro should be updated when new types are added */\n  ECMA_BIGINT64_ARRAY, /**< BigInt64Array */\n  ECMA_BIGUINT64_ARRAY, /**< BigUInt64Array */\n} ecma_typedarray_type_t;\n\n/**\n * TypedArray flags.\n */\ntypedef enum\n{\n  ECMA_TYPEDARRAY_IS_EXTENDED = (1u << 0), /* an ecma_extended_typedarray_object_t is allocated for the TypedArray */\n} ecma_typedarray_flag_t;\n\n/**\n * Array buffer flags.\n */\ntypedef enum\n{\n  ECMA_ARRAYBUFFER_HAS_POINTER = (1u << 0), /* ArrayBuffer has a buffer pointer. */\n  ECMA_ARRAYBUFFER_ALLOCATED = (1u << 1), /* ArrayBuffer memory is allocated */\n  ECMA_ARRAYBUFFER_DETACHED = (1u << 2), /* ArrayBuffer has been detached */\n} ecma_arraybuffer_flag_t;\n\n/**\n * Structure for array buffers with a backing store pointer.\n */\ntypedef struct\n{\n  ecma_extended_object_t extended_object; /**< extended object part */\n  void *buffer_p; /**< pointer to the backing store of the array buffer object */\n  void *arraybuffer_user_p; /**< user pointer passed to the free callback */\n} ecma_arraybuffer_pointer_t;\n\n/**\n * Some internal properties of TypedArray object.\n * It is only used when the offset is not 0, and\n * the array-length is not buffer-length / element_size.\n */\ntypedef struct\n{\n  ecma_extended_object_t extended_object; /**< extended object part */\n  uint32_t byte_offset; /**< the byteoffset of the above arraybuffer */\n  uint32_t array_length; /**< the array length */\n} ecma_extended_typedarray_object_t;\n\n/**\n * General structure for query %TypedArray% object's properties.\n **/\ntypedef struct\n{\n  ecma_object_t *array_buffer_p; /**< pointer to the typedArray's [[ViewedArrayBuffer]] internal slot */\n  ecma_typedarray_type_t id; /**< [[TypedArrayName]] internal slot */\n  uint32_t length; /**< [[ByteLength]] internal slot */\n  uint32_t offset; /**< [[ByteOffset]] internal slot. */\n  uint8_t shift; /**< the element size shift in the typedArray */\n  uint8_t element_size; /**< element size based on [[TypedArrayName]] in Table 49 */\n} ecma_typedarray_info_t;\n\n#if JERRY_BUILTIN_BIGINT\n/**\n * Checks whether a given typedarray is BigInt type or not.\n **/\n#define ECMA_TYPEDARRAY_IS_BIGINT_TYPE(id) ((id) >= ECMA_BIGINT64_ARRAY)\n\n#endif /* JERRY_BUILTIN_BIGINT */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n/**\n * Executable (e.g. generator, async) object flags.\n */\ntypedef enum\n{\n  ECMA_EXECUTABLE_OBJECT_COMPLETED = (1u << 0), /**< executable object is completed and cannot be resumed */\n  ECMA_EXECUTABLE_OBJECT_RUNNING = (1u << 1), /**< executable object is currently running */\n  /* Generator specific flags. */\n  ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD = (1u << 2), /**< the executable object performs\n                                                         *   an await or a yield* operation */\n  ECMA_ASYNC_GENERATOR_CALLED = (1u << 3), /**< the async generator was executed before */\n  /* This must be the last generator specific flag. */\n  ECMA_AWAIT_STATE_SHIFT = 4, /**< shift for await states */\n} ecma_executable_object_flags_t;\n\n/**\n * Async function states after an await is completed.\n */\ntypedef enum\n{\n  ECMA_AWAIT_YIELD_NEXT, /**< wait for an iterator result object */\n  ECMA_AWAIT_YIELD_NEXT_RETURN, /**< wait for an iterator result object after a return operation */\n  ECMA_AWAIT_YIELD_RETURN, /**< wait for the argument passed to return operation */\n  ECMA_AWAIT_YIELD_NEXT_VALUE, /**< wait for the value property of an iterator result object */\n  ECMA_AWAIT_YIELD_OPERATION, /**< wait for the generator operation (next/throw/return) */\n  ECMA_AWAIT_YIELD_CLOSE, /**< wait for the result of iterator close operation */\n  /* After adding new ECMA_AWAIT_YIELD items, the ECMA_AWAIT_YIELD_END should be updated. */\n  ECMA_AWAIT_FOR_CLOSE, /**< wait for a close iterator result object of for-await-of statement */\n  ECMA_AWAIT_FOR_NEXT, /**< wait for an iterator result object of for-await-of statement */\n} ecma_await_states_t;\n\n/**\n * Checks whether the executable object is waiting for resuming.\n */\n#define ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED(executable_object_p)          \\\n  (!((executable_object_p)->extended_object.u.cls.u2.executable_obj_flags \\\n     & (ECMA_EXECUTABLE_OBJECT_COMPLETED | ECMA_EXECUTABLE_OBJECT_RUNNING)))\n\n/**\n * Last item of yield* related await states.\n */\n#define ECMA_AWAIT_YIELD_END ECMA_AWAIT_YIELD_CLOSE\n\n/**\n * Helper macro for ECMA_EXECUTABLE_OBJECT_RESUME_EXEC.\n */\n#define ECMA_EXECUTABLE_OBJECT_RESUME_EXEC_MASK ((uint16_t) ~ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)\n\n/**\n * Resume execution of the byte code.\n */\n#define ECMA_EXECUTABLE_OBJECT_RESUME_EXEC(executable_object_p) \\\n  ((executable_object_p)->extended_object.u.cls.u2.executable_obj_flags &= ECMA_EXECUTABLE_OBJECT_RESUME_EXEC_MASK)\n\n/**\n * Enqueued task of an AsyncGenerator.\n *\n * An execution of a task has three steps:\n *  1) Perform a next/throw/return operation\n *  2) Resume the execution of the AsyncGenerator\n *  3) Fulfill or reject a promise if the AsyncGenerator yielded a value\n *     (these Promises are created by the AsyncGenerator itself)\n */\ntypedef struct\n{\n  ecma_value_t next; /**< points to the next task which will be performed after this task is completed */\n  ecma_value_t promise; /**< promise which will be fulfilled or rejected after this task is completed */\n  ecma_value_t operation_value; /**< value argument of the operation */\n  uint8_t operation_type; /**< type of operation (see ecma_async_generator_operation_type_t) */\n} ecma_async_generator_task_t;\n\n/**\n * Definition of PromiseCapability Records\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< object header, and [[Promise]] internal slot */\n  ecma_value_t resolve; /**< [[Resolve]] internal slot */\n  ecma_value_t reject; /**< [[Reject]] internal slot */\n} ecma_promise_capabality_t;\n\n/**\n * Definition of GetCapabilitiesExecutor Functions\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< object header */\n  ecma_value_t capability; /**< [[Capability]] internal slot */\n} ecma_promise_capability_executor_t;\n\n/**\n * Definition of Promise.all Resolve Element Functions\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< object header */\n  ecma_value_t remaining_elements; /**< [[Remaining elements]] internal slot */\n  ecma_value_t capability; /**< [[Capabilities]] internal slot */\n  ecma_value_t values; /**< [[Values]] or [[Errors]] internal slot */\n  uint32_t index; /**< [[Index]] and [[AlreadyCalled]] internal slot\n                   *   0 - if the element has been resolved\n                   *   real index + 1 in the [[Values]] list - otherwise */\n} ecma_promise_all_executor_t;\n\n/**\n * Promise prototype methods helper.\n */\ntypedef enum\n{\n  ECMA_PROMISE_ALL_RESOLVE, /**< promise.all resolve */\n  ECMA_PROMISE_ALLSETTLED_RESOLVE, /**< promise.allSettled resolve */\n  ECMA_PROMISE_ALLSETTLED_REJECT, /**< promise.allSettled reject */\n  ECMA_PROMISE_ANY_REJECT, /**< promise.any reject */\n} ecma_promise_executor_type_t;\n\n#if JERRY_BUILTIN_DATAVIEW\n/**\n * Description of DataView objects.\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< header part */\n  ecma_object_t *buffer_p; /**< [[ViewedArrayBuffer]] internal slot */\n  uint32_t byte_offset; /**< [[ByteOffset]] internal slot */\n} ecma_dataview_object_t;\n#endif /* JERRY_BUILTIN_DATAVIEW */\n\ntypedef enum\n{\n  ECMA_SYMBOL_FLAG_NONE = 0, /**< no options */\n  ECMA_SYMBOL_FLAG_GLOBAL = (1 << 0), /**< symbol is a well known symbol, See also: 6.1.5.1 */\n  ECMA_SYMBOL_FLAG_PRIVATE_KEY = (1 << 1), /**< symbol is a private field */\n  ECMA_SYMBOL_FLAG_PRIVATE_INSTANCE_METHOD = (1 << 2), /**< symbol is a private method or accessor */\n} ecma_symbol_flags_t;\n\n/**\n * Bitshift index for the symbol hash property\n */\n#define ECMA_SYMBOL_FLAGS_SHIFT 3\n\n/**\n * Bitmask for symbol hash flags\n */\n#define ECMA_SYMBOL_FLAGS_MASK ((1 << ECMA_SYMBOL_FLAGS_SHIFT) - 1)\n\n#if (JERRY_STACK_LIMIT != 0)\n/**\n * Check the current stack usage. If the limit is reached a RangeError is raised.\n * The macro argument specifies the return value which is usally ECMA_VALUE_ERROR or NULL.\n */\n#define ECMA_CHECK_STACK_USAGE_RETURN(RETURN_VALUE)               \\\n  do                                                              \\\n  {                                                               \\\n    if (ecma_get_current_stack_usage () > CONFIG_MEM_STACK_LIMIT) \\\n    {                                                             \\\n      ecma_raise_maximum_callstack_error ();                      \\\n      return RETURN_VALUE;                                        \\\n    }                                                             \\\n  } while (0)\n\n/**\n * Specialized version of ECMA_CHECK_STACK_USAGE_RETURN which returns ECMA_VALUE_ERROR.\n * This version should be used in most cases.\n */\n#define ECMA_CHECK_STACK_USAGE() ECMA_CHECK_STACK_USAGE_RETURN (ECMA_VALUE_ERROR)\n#else /* JERRY_STACK_LIMIT == 0) */\n/**\n * If the stack limit is unlimited, this check is an empty macro.\n */\n#define ECMA_CHECK_STACK_USAGE_RETURN(RETURN_VALUE)\n\n/**\n * If the stack limit is unlimited, this check is an empty macro.\n */\n#define ECMA_CHECK_STACK_USAGE()\n#endif /* (JERRY_STACK_LIMIT != 0) */\n\n/**\n * Invalid object pointer which represents abrupt completion\n */\n#define ECMA_OBJECT_POINTER_ERROR ((ecma_object_t *) 0x01)\n\n/**\n * Invalid property pointer which represents abrupt completion\n */\n#define ECMA_PROPERTY_POINTER_ERROR ((ecma_property_t *) 0x01)\n\n#if JERRY_BUILTIN_PROXY\n\n/**\n * Proxy object flags.\n */\ntypedef enum\n{\n  ECMA_PROXY_SKIP_RESULT_VALIDATION = (1u << 0), /**< skip result validation for [[GetPrototypeOf]],\n                                                  *   [[SetPrototypeOf]], [[IsExtensible]],\n                                                  *   [[PreventExtensions]], [[GetOwnProperty]],\n                                                  *   [[DefineOwnProperty]], [[HasProperty]], [[Get]],\n                                                  *   [[Set]], [[Delete]] and [[OwnPropertyKeys]] */\n  ECMA_PROXY_IS_CALLABLE = (1u << 1), /**< proxy is callable */\n  ECMA_PROXY_IS_CONSTRUCTABLE = (1u << 2), /**< proxy is constructable */\n} ecma_proxy_flag_types_t;\n\n/**\n * Description of Proxy objects.\n *\n * A Proxy object's property list is used to store extra information:\n *  * The \"header.u2.prototype_cp\" 1st tag bit stores the IsCallable information.\n *  * The \"header.u2.prototype_cp\" 2nd tag bit stores the IsConstructor information.\n */\ntypedef struct\n{\n  ecma_object_t header; /**< header part */\n  ecma_value_t target; /**< [[ProxyTarget]] internal slot */\n  ecma_value_t handler; /**< [[ProxyHandler]] internal slot */\n} ecma_proxy_object_t;\n\n/**\n * Description of Proxy objects.\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< header part */\n  ecma_value_t proxy; /**< [[RevocableProxy]] internal slot */\n} ecma_revocable_proxy_object_t;\n#endif /* JERRY_BUILTIN_PROXY */\n\n/**\n * Type to repesent the maximum property index\n *\n * For ES6+ the maximum valid property index is 2**53 - 1\n */\ntypedef uint64_t ecma_length_t;\n\n#if JERRY_BUILTIN_BIGINT\n\n/**\n * BigUInt data is a sequence of uint32_t numbers.\n */\ntypedef uint32_t ecma_bigint_digit_t;\n\n/**\n * Special BigInt value representing zero.\n */\n#define ECMA_BIGINT_ZERO ((ecma_value_t) ECMA_TYPE_BIGINT)\n\n/**\n * Special BigInt value representing zero when the result is pointer.\n */\n#define ECMA_BIGINT_POINTER_TO_ZERO ((ecma_extended_primitive_t *) 0x1)\n\n/**\n * Return the size of a BigInt value in ecma_bigint_data_t units.\n */\n#define ECMA_BIGINT_GET_SIZE(value_p) \\\n  ((value_p)->u.bigint_sign_and_size & ~(uint32_t) (sizeof (ecma_bigint_digit_t) - 1))\n\n/**\n * Size of memory needs to be allocated for the digits of a BigInt.\n * The value is rounded up for two digits.\n */\n#define ECMA_BIGINT_GET_BYTE_SIZE(size) \\\n  (size_t) (((size) + sizeof (ecma_bigint_digit_t)) & ~(2 * sizeof (ecma_bigint_digit_t) - 1))\n\n#endif /* JERRY_BUILTIN_BIGINT */\n\n/**\n * Struct for counting the different types properties in objects\n */\ntypedef struct\n{\n  uint32_t array_index_named_props; /**< number of array index named properties */\n  uint32_t string_named_props; /**< number of string named properties */\n  uint32_t symbol_named_props; /**< number of symbol named properties */\n} ecma_property_counter_t;\n\n/**\n * Arguments object related status flags\n */\ntypedef enum\n{\n  ECMA_ARGUMENTS_OBJECT_NO_FLAGS = 0, /* unmapped arguments object */\n  ECMA_ARGUMENTS_OBJECT_MAPPED = (1 << 0), /* mapped arguments object */\n  ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE = (1 << 1), /* static mapped arguments object */\n  ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED = (1 << 2), /* 'callee' property has been lazy initialized */\n  ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED = (1 << 3), /* 'length' property has been lazy initialized */\n  ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED = (1 << 4), /* 'Symbol.iterator' property has been lazy initialized */\n} ecma_arguments_object_flags_t;\n\n/**\n * Definition of unmapped arguments object\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< object header */\n  ecma_value_t callee; /**< 'callee' property */\n} ecma_unmapped_arguments_t;\n\n/**\n * Definition of mapped arguments object\n */\ntypedef struct\n{\n  ecma_unmapped_arguments_t unmapped; /**< unmapped arguments object header */\n  ecma_value_t lex_env; /**< environment reference */\n  union\n  {\n    ecma_value_t byte_code; /**< callee's compiled code */\n#if JERRY_SNAPSHOT_EXEC\n    ecma_compiled_code_t *byte_code_p; /**< real byte code pointer */\n#endif /* JERRY_SNAPSHOT_EXEC */\n  } u;\n} ecma_mapped_arguments_t;\n\n/**\n * Date object descriptor flags\n */\ntypedef enum\n{\n  ECMA_DATE_TZA_NONE = 0, /**< no time-zone adjustment is set */\n  ECMA_DATE_TZA_SET = (1 << 0), /**< time-zone adjustment is set */\n} ecma_date_object_flags_t;\n\n/**\n * Definition of date object\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< object header */\n  ecma_number_t date_value; /**< [[DateValue]] internal property */\n} ecma_date_object_t;\n\n/**\n * Implicit class constructor flags\n */\ntypedef enum\n{\n  ECMA_CONSTRUCTOR_FUNCTION_HAS_HERITAGE = (1 << 0), /**< heritage object is present */\n} ecma_constructor_function_flags_t;\n\n/**\n * Description of AsyncFromSyncIterator objects.\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< header part */\n  ecma_value_t sync_next_method; /**< IteratorRecord [[NextMethod]] internal slot */\n} ecma_async_from_sync_iterator_object_t;\n\n/**\n * Private method kind\n */\ntypedef enum\n{\n  ECMA_PRIVATE_FIELD = 0, /**< private field */\n  ECMA_PRIVATE_METHOD, /**< private method */\n  ECMA_PRIVATE_GETTER, /**< private setter */\n  ECMA_PRIVATE_SETTER, /**< private getter */\n} ecma_private_property_kind_t;\n\n/**\n * Private static property flag\n */\n#define ECMA_PRIVATE_PROPERTY_STATIC_FLAG (1 << 2)\n\n/*\n * Get private property kind from a descriptor\n */\n#define ECMA_PRIVATE_PROPERTY_KIND(prop) ((prop) & ((ECMA_PRIVATE_PROPERTY_STATIC_FLAG - 1)))\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_GLOBALS_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-helpers-collection.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n#include \"jrt.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmahelpers Helpers for operations with ECMA data types\n * @{\n */\n\n/**\n * Allocate a collection of ecma values.\n *\n * @return pointer to the collection\n */\necma_collection_t *\necma_new_collection (void)\n{\n  ecma_collection_t *collection_p;\n  collection_p = (ecma_collection_t *) jmem_heap_alloc_block (sizeof (ecma_collection_t));\n\n  collection_p->item_count = 0;\n  collection_p->capacity = ECMA_COLLECTION_INITIAL_CAPACITY;\n  const uint32_t size = ECMA_COLLECTION_ALLOCATED_SIZE (ECMA_COLLECTION_INITIAL_CAPACITY);\n  collection_p->buffer_p = (ecma_value_t *) jmem_heap_alloc_block (size);\n\n  return collection_p;\n} /* ecma_new_collection */\n\n/**\n * Deallocate a collection of ecma values without freeing it's values\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_collection_destroy (ecma_collection_t *collection_p) /**< value collection */\n{\n  JERRY_ASSERT (collection_p != NULL);\n\n  jmem_heap_free_block (collection_p->buffer_p, ECMA_COLLECTION_ALLOCATED_SIZE (collection_p->capacity));\n  jmem_heap_free_block (collection_p, sizeof (ecma_collection_t));\n} /* ecma_collection_destroy */\n\n/**\n * Free the object collection elements and deallocate the collection\n */\nvoid\necma_collection_free_objects (ecma_collection_t *collection_p) /**< value collection */\n{\n  JERRY_ASSERT (collection_p != NULL);\n\n  ecma_value_t *buffer_p = collection_p->buffer_p;\n\n  for (uint32_t i = 0; i < collection_p->item_count; i++)\n  {\n    if (ecma_is_value_object (buffer_p[i]))\n    {\n      ecma_deref_object (ecma_get_object_from_value (buffer_p[i]));\n    }\n  }\n\n  ecma_collection_destroy (collection_p);\n} /* ecma_collection_free_objects */\n\n/**\n * Free the template literal objects and deallocate the collection\n */\nvoid\necma_collection_free_template_literal (ecma_collection_t *collection_p) /**< value collection */\n{\n  for (uint32_t i = 0; i < collection_p->item_count; i++)\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (collection_p->buffer_p[i]);\n\n    JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_ARRAY);\n\n    ecma_extended_object_t *array_object_p = (ecma_extended_object_t *) object_p;\n\n    JERRY_ASSERT (array_object_p->u.array.length_prop_and_hole_count & ECMA_ARRAY_TEMPLATE_LITERAL);\n    array_object_p->u.array.length_prop_and_hole_count &= (uint32_t) ~ECMA_ARRAY_TEMPLATE_LITERAL;\n\n    ecma_property_value_t *property_value_p;\n\n    property_value_p = ecma_get_named_data_property (object_p, ecma_get_magic_string (LIT_MAGIC_STRING_RAW));\n    ecma_object_t *raw_object_p = ecma_get_object_from_value (property_value_p->value);\n\n    JERRY_ASSERT (ecma_get_object_type (raw_object_p) == ECMA_OBJECT_TYPE_ARRAY);\n\n    array_object_p = (ecma_extended_object_t *) raw_object_p;\n\n    JERRY_ASSERT (array_object_p->u.array.length_prop_and_hole_count & ECMA_ARRAY_TEMPLATE_LITERAL);\n    array_object_p->u.array.length_prop_and_hole_count &= (uint32_t) ~ECMA_ARRAY_TEMPLATE_LITERAL;\n\n    ecma_deref_object (raw_object_p);\n    ecma_deref_object (object_p);\n  }\n\n  ecma_collection_destroy (collection_p);\n} /* ecma_collection_free_template_literal */\n\n/**\n * Free the non-object collection elements and deallocate the collection\n */\nvoid\necma_collection_free_if_not_object (ecma_collection_t *collection_p) /**< value collection */\n{\n  JERRY_ASSERT (collection_p != NULL);\n\n  ecma_value_t *buffer_p = collection_p->buffer_p;\n\n  for (uint32_t i = 0; i < collection_p->item_count; i++)\n  {\n    ecma_free_value_if_not_object (buffer_p[i]);\n  }\n\n  ecma_collection_destroy (collection_p);\n} /* ecma_collection_free_if_not_object */\n\n/**\n * Free the collection elements and deallocate the collection\n */\nvoid\necma_collection_free (ecma_collection_t *collection_p) /**< value collection */\n{\n  JERRY_ASSERT (collection_p != NULL);\n\n  ecma_value_t *buffer_p = collection_p->buffer_p;\n\n  for (uint32_t i = 0; i < collection_p->item_count; i++)\n  {\n    ecma_free_value (buffer_p[i]);\n  }\n\n  ecma_collection_destroy (collection_p);\n} /* ecma_collection_free */\n\n/**\n * Append new value to ecma values collection\n *\n * Note: The reference count of the values are not increased\n */\nvoid\necma_collection_push_back (ecma_collection_t *collection_p, /**< value collection */\n                           ecma_value_t value) /**< ecma value to append */\n{\n  JERRY_ASSERT (collection_p != NULL);\n\n  ecma_value_t *buffer_p = collection_p->buffer_p;\n\n  if (JERRY_LIKELY (collection_p->item_count < collection_p->capacity))\n  {\n    buffer_p[collection_p->item_count++] = value;\n    return;\n  }\n\n  const uint32_t new_capacity = collection_p->capacity + ECMA_COLLECTION_GROW_FACTOR;\n  const uint32_t old_size = ECMA_COLLECTION_ALLOCATED_SIZE (collection_p->capacity);\n  const uint32_t new_size = ECMA_COLLECTION_ALLOCATED_SIZE (new_capacity);\n\n  buffer_p = jmem_heap_realloc_block (buffer_p, old_size, new_size);\n  buffer_p[collection_p->item_count++] = value;\n  collection_p->capacity = new_capacity;\n\n  collection_p->buffer_p = buffer_p;\n} /* ecma_collection_push_back */\n\n/**\n * Reserve space for the given amount of ecma_values in the collection\n */\nvoid\necma_collection_reserve (ecma_collection_t *collection_p, /**< value collection */\n                         uint32_t count) /**< number of ecma values to reserve */\n{\n  JERRY_ASSERT (collection_p != NULL);\n  JERRY_ASSERT (UINT32_MAX - count > collection_p->capacity);\n\n  const uint32_t new_capacity = collection_p->capacity + count;\n  const uint32_t old_size = ECMA_COLLECTION_ALLOCATED_SIZE (collection_p->capacity);\n  const uint32_t new_size = ECMA_COLLECTION_ALLOCATED_SIZE (new_capacity);\n\n  ecma_value_t *buffer_p = collection_p->buffer_p;\n  buffer_p = jmem_heap_realloc_block (buffer_p, old_size, new_size);\n\n  collection_p->capacity = new_capacity;\n  collection_p->buffer_p = buffer_p;\n} /* ecma_collection_reserve */\n\n/**\n * Append a list of values to the end of the collection\n */\nvoid\necma_collection_append (ecma_collection_t *collection_p, /**< value collection */\n                        const ecma_value_t *buffer_p, /**< values to append */\n                        uint32_t count) /**< number of ecma values to append */\n{\n  JERRY_ASSERT (collection_p != NULL);\n  JERRY_ASSERT (collection_p->capacity >= collection_p->item_count);\n\n  uint32_t free_count = collection_p->capacity - collection_p->item_count;\n\n  if (free_count < count)\n  {\n    ecma_collection_reserve (collection_p, count - free_count);\n  }\n\n  memcpy (collection_p->buffer_p + collection_p->item_count, buffer_p, count * sizeof (ecma_value_t));\n  collection_p->item_count += count;\n} /* ecma_collection_append */\n\n/**\n * Helper function to check if a given collection have duplicated properties or not\n *\n * @return true - if there are duplicated properties in the collection\n *         false - otherwise\n */\nbool\necma_collection_check_duplicated_entries (ecma_collection_t *collection_p) /**< prop name collection */\n{\n  if (collection_p->item_count == 0)\n  {\n    return false;\n  }\n\n  ecma_value_t *buffer_p = collection_p->buffer_p;\n\n  for (uint32_t i = 0; i < collection_p->item_count - 1; i++)\n  {\n    ecma_string_t *current_name_p = ecma_get_prop_name_from_value (buffer_p[i]);\n\n    for (uint32_t j = i + 1; j < collection_p->item_count; j++)\n    {\n      if (ecma_compare_ecma_strings (current_name_p, ecma_get_prop_name_from_value (buffer_p[j])))\n      {\n        return true;\n      }\n    }\n  }\n\n  return false;\n} /* ecma_collection_check_duplicated_entries */\n\n/**\n * Check the string value existance in the collection.\n *\n * Used by:\n *         - ecma_builtin_json_stringify step 4.b.ii.5\n *         - ecma_op_object_enumerate\n *\n * @return true, if the string is already in the collection.\n */\nbool\necma_collection_has_string_value (ecma_collection_t *collection_p, /**< collection */\n                                  ecma_string_t *string_p) /**< string */\n{\n  ecma_value_t *buffer_p = collection_p->buffer_p;\n\n  for (uint32_t i = 0; i < collection_p->item_count; i++)\n  {\n    ecma_string_t *current_p = ecma_get_string_from_value (buffer_p[i]);\n\n    if (ecma_compare_ecma_strings (current_p, string_p))\n    {\n      return true;\n    }\n  }\n\n  return false;\n} /* ecma_collection_has_string_value */\n\n/**\n * Initial capacity of an ecma-collection\n */\n#define ECMA_COMPACT_COLLECTION_GROWTH 8\n\n/**\n * Set the size of the compact collection\n */\n#define ECMA_COMPACT_COLLECTION_SET_SIZE(compact_collection_p, item_count, unused_items) \\\n  ((compact_collection_p)[0] = (((item_count) << ECMA_COMPACT_COLLECTION_SIZE_SHIFT) | (unused_items)))\n\n/**\n * Set the size of the compact collection\n */\n#define ECMA_COMPACT_COLLECTION_GET_UNUSED_ITEM_COUNT(compact_collection_p) \\\n  ((compact_collection_p)[0] & ((1 << ECMA_COMPACT_COLLECTION_SIZE_SHIFT) - 1))\n\n/**\n * Allocate a compact collection of ecma values\n *\n * @return pointer to the compact collection\n */\necma_value_t *\necma_new_compact_collection (void)\n{\n  size_t size = (ECMA_COMPACT_COLLECTION_GROWTH / 2) * sizeof (ecma_value_t);\n  ecma_value_t *compact_collection_p = (ecma_value_t *) jmem_heap_alloc_block (size);\n\n  ECMA_COMPACT_COLLECTION_SET_SIZE (compact_collection_p,\n                                    ECMA_COMPACT_COLLECTION_GROWTH / 2,\n                                    (ECMA_COMPACT_COLLECTION_GROWTH / 2) - 1);\n  return compact_collection_p;\n} /* ecma_new_compact_collection */\n\n/**\n * Append a value to the compact collection\n *\n * @return updated pointer to the compact collection\n */\necma_value_t *\necma_compact_collection_push_back (ecma_value_t *compact_collection_p, /**< compact collection */\n                                   ecma_value_t value) /**< ecma value to append */\n{\n  ecma_value_t size = ECMA_COMPACT_COLLECTION_GET_SIZE (compact_collection_p);\n  ecma_value_t unused_items = ECMA_COMPACT_COLLECTION_GET_UNUSED_ITEM_COUNT (compact_collection_p);\n\n  if (unused_items > 0)\n  {\n    compact_collection_p[size - unused_items] = value;\n    (*compact_collection_p)--;\n    return compact_collection_p;\n  }\n\n  if (size == ECMA_COMPACT_COLLECTION_GROWTH / 2)\n  {\n    size_t old_size = (ECMA_COMPACT_COLLECTION_GROWTH / 2) * sizeof (ecma_value_t);\n    size_t new_size = ECMA_COMPACT_COLLECTION_GROWTH * sizeof (ecma_value_t);\n    compact_collection_p = jmem_heap_realloc_block (compact_collection_p, old_size, new_size);\n\n    compact_collection_p[ECMA_COMPACT_COLLECTION_GROWTH / 2] = value;\n\n    ECMA_COMPACT_COLLECTION_SET_SIZE (compact_collection_p,\n                                      ECMA_COMPACT_COLLECTION_GROWTH,\n                                      (ECMA_COMPACT_COLLECTION_GROWTH / 2) - 1);\n    return compact_collection_p;\n  }\n\n  size_t old_size = size * sizeof (ecma_value_t);\n  size_t new_size = old_size + (ECMA_COMPACT_COLLECTION_GROWTH * sizeof (ecma_value_t));\n\n  compact_collection_p = jmem_heap_realloc_block (compact_collection_p, old_size, new_size);\n  compact_collection_p[size] = value;\n\n  ECMA_COMPACT_COLLECTION_SET_SIZE (compact_collection_p,\n                                    size + ECMA_COMPACT_COLLECTION_GROWTH,\n                                    ECMA_COMPACT_COLLECTION_GROWTH - 1);\n  return compact_collection_p;\n} /* ecma_compact_collection_push_back */\n\n/**\n * Discard the unused elements of a compact collection\n *\n * Note:\n *     further items should not be added after this call\n *\n * @return updated pointer to the compact collection\n */\necma_value_t *\necma_compact_collection_shrink (ecma_value_t *compact_collection_p) /**< compact collection */\n{\n  ecma_value_t unused_items = ECMA_COMPACT_COLLECTION_GET_UNUSED_ITEM_COUNT (compact_collection_p);\n\n  if (unused_items == 0)\n  {\n    return compact_collection_p;\n  }\n\n  ecma_value_t size = ECMA_COMPACT_COLLECTION_GET_SIZE (compact_collection_p);\n\n  size_t old_size = size * sizeof (ecma_value_t);\n  size_t new_size = (size - unused_items) * sizeof (ecma_value_t);\n\n  compact_collection_p = jmem_heap_realloc_block (compact_collection_p, old_size, new_size);\n\n  ECMA_COMPACT_COLLECTION_SET_SIZE (compact_collection_p, size - unused_items, 0);\n  return compact_collection_p;\n} /* ecma_compact_collection_shrink */\n\n/**\n * Free a compact collection\n */\nvoid\necma_compact_collection_free (ecma_value_t *compact_collection_p) /**< compact collection */\n{\n  ecma_value_t size = ECMA_COMPACT_COLLECTION_GET_SIZE (compact_collection_p);\n  ecma_value_t unused_items = ECMA_COMPACT_COLLECTION_GET_UNUSED_ITEM_COUNT (compact_collection_p);\n\n  ecma_value_t *end_p = compact_collection_p + size - unused_items;\n  ecma_value_t *current_p = compact_collection_p + 1;\n\n  while (current_p < end_p)\n  {\n    ecma_free_value (*current_p++);\n  }\n\n  jmem_heap_free_block (compact_collection_p, size * sizeof (ecma_value_t));\n} /* ecma_compact_collection_free */\n\n/**\n * Get the end of a compact collection\n *\n * @return pointer to the compact collection end\n */\necma_value_t *\necma_compact_collection_end (ecma_value_t *compact_collection_p) /**< compact collection */\n{\n  ecma_value_t size = ECMA_COMPACT_COLLECTION_GET_SIZE (compact_collection_p);\n  ecma_value_t unused_items = ECMA_COMPACT_COLLECTION_GET_UNUSED_ITEM_COUNT (compact_collection_p);\n\n  return compact_collection_p + size - unused_items;\n} /* ecma_compact_collection_end */\n\n/**\n * Destroy a compact collection\n */\nvoid\necma_compact_collection_destroy (ecma_value_t *compact_collection_p) /**< compact collection */\n{\n  ecma_value_t size = ECMA_COMPACT_COLLECTION_GET_SIZE (compact_collection_p);\n\n  jmem_heap_free_block (compact_collection_p, size * sizeof (ecma_value_t));\n} /* ecma_compact_collection_destroy */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-helpers-conversion.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <math.h>\n\n#include \"ecma-globals.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n\n#include \"jrt-libc-includes.h\"\n#include \"lit-char-helpers.h\"\n#include \"lit-magic-strings.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmahelpers Helpers for operations with ECMA data types\n * @{\n */\n\n#if JERRY_NUMBER_TYPE_FLOAT64\n\n/**\n * \\addtogroup ecmahelpersbigintegers Helpers for operations intermediate 128-bit integers\n * @{\n */\n\n/**\n * 128-bit integer type\n */\ntypedef struct\n{\n  uint64_t hi; /**< high 64 bits */\n  uint64_t lo; /**< low 64 bits */\n} ecma_uint128_t;\n\n/**\n * Round high part of 128-bit integer to uint64_t\n *\n * @return rounded high to uint64_t\n */\nstatic uint64_t\necma_round_high_to_uint64 (ecma_uint128_t *num_p) /**< 128-bit unsigned integer */\n{\n  uint64_t masked_lo = num_p->lo & ~(1ULL << 63u);\n  uint64_t masked_hi = num_p->hi & 0x1;\n\n  if ((num_p->lo >> 63u != 0) && (masked_lo > 0 || masked_hi != 0))\n  {\n    return (num_p->hi + 1);\n  }\n\n  return num_p->hi;\n} /* ecma_round_high_to_uint64 */\n\n/**\n * Left shift 128-bit integer by max 63 bits.\n */\nstatic void JERRY_ATTR_ALWAYS_INLINE\necma_uint128_shift_left (ecma_uint128_t *num_p, /**< 128-bit unsigned integer */\n                         int32_t shift) /**< left shift count */\n{\n  num_p->hi = (num_p->hi << shift) | (num_p->lo >> (64 - shift));\n  num_p->lo <<= shift;\n} /* ecma_uint128_shift_left */\n\n/**\n * Right shift 128-bit integer by max 63 bits.\n */\nstatic void JERRY_ATTR_ALWAYS_INLINE\necma_uint128_shift_right (ecma_uint128_t *num_p, /**< 128-bit unsigned integer */\n                          int32_t shift) /**< right shift count */\n{\n  num_p->lo = (num_p->lo >> shift) | (num_p->hi << (64 - shift));\n  num_p->hi >>= shift;\n} /* ecma_uint128_shift_right */\n\n/**\n * Add two 128-bit integer values and assign the result to the left one.\n */\nstatic void\necma_uint128_add (ecma_uint128_t *left_p, /**< left 128-bit unsigned integer */\n                  ecma_uint128_t *right_p) /**< right 128-bit unsigned integer */\n{\n  left_p->hi += right_p->hi;\n  left_p->lo += right_p->lo;\n\n  if (left_p->lo < right_p->lo)\n  {\n    left_p->hi++;\n  }\n} /* ecma_uint128_add */\n\n/**\n * Multiply 128-bit integer by 10\n */\nstatic void\necma_uint128_mul10 (ecma_uint128_t *num_p) /**< 128-bit unsigned integer */\n{\n  ecma_uint128_shift_left (num_p, 1u);\n\n  ecma_uint128_t tmp = { .hi = num_p->hi, .lo = num_p->lo };\n  ecma_uint128_shift_left (&tmp, 2u);\n\n  ecma_uint128_add (num_p, &tmp);\n} /* ecma_uint128_mul10 */\n\n/**\n * Divide 128-bit integer by 10\n *\n * N = N3 *2^96  + N2 *2^64  + N1 *2^32  + N0 *2^0     // 128-bit dividend\n * T = T3 *2^-32 + T2 *2^-64 + T1 *2^-96 + T0 *2^-128  // 128-bit divisor reciprocal, 1/10 * 2^-128\n *\n * N * T    = N3*T3 *2^64 + N2*T3 *2^32 + N1*T3 *2^0 + N0*T3 *2^-32\n *          +               N3*T2 *2^32 + N2*T2 *2^0 + N1*T2 *2^-32 + N0*T2 *2^-64\n *          +                             N3*T1 *2^0 + N2*T1 *2^-32 + N1*T1 *2^-64 + N0*T1 *2^-96\n *          +                                          N3*T0 *2^-32 + N2*T0 *2^-64 + N1*T0 *2^-96 + N0*T0 *2^-128\n *\n *  Q3=carry  Q2=^+carry    Q1=^+carry    Q0=^+carry   fraction=^...\n *\n * Q = Q3 *2^96  + Q2 *2^64  + Q1 *2^32  + Q0 *2^0     // 128-bit quotient\n */\nstatic void\necma_uint128_div10 (ecma_uint128_t *num_p) /**< 128-bit unsigned integer */\n{\n  /* estimation of reciprocal of 10, 128 bits right of the binary point (T1 == T2) */\n  const uint64_t tenth_l = 0x9999999aul;\n  const uint64_t tenth_m = 0x99999999ul;\n  const uint64_t tenth_h = 0x19999999ul;\n\n  const uint64_t l0 = ((uint32_t) num_p->lo) * tenth_l;\n  const uint64_t l1 = (num_p->lo >> 32u) * tenth_l;\n  const uint64_t l2 = ((uint32_t) num_p->hi) * tenth_l;\n  const uint64_t l3 = (num_p->hi >> 32u) * tenth_l;\n  const uint64_t m0 = ((uint32_t) num_p->lo) * tenth_m;\n  const uint64_t m1 = (num_p->lo >> 32u) * tenth_m;\n  const uint64_t m2 = ((uint32_t) num_p->hi) * tenth_m;\n  const uint64_t m3 = (num_p->hi >> 32u) * tenth_m;\n  const uint64_t h0 = ((uint32_t) num_p->lo) * tenth_h;\n  const uint64_t h1 = (num_p->lo >> 32u) * tenth_h;\n  const uint64_t h2 = ((uint32_t) num_p->hi) * tenth_h;\n  const uint64_t h3 = (num_p->hi >> 32u) * tenth_h;\n\n  uint64_t q0 = l0 >> 32u;\n  q0 += (uint32_t) l1;\n  q0 += (uint32_t) m0;\n\n  q0 >>= 32u;\n  q0 += l1 >> 32u;\n  q0 += m0 >> 32u;\n  q0 += (uint32_t) l2;\n  q0 += (uint32_t) m1;\n  q0 += (uint32_t) m0;\n\n  q0 >>= 32u;\n  q0 += l2 >> 32u;\n  q0 += m1 >> 32u;\n  q0 += m0 >> 32u;\n  q0 += (uint32_t) l3;\n  q0 += (uint32_t) m2;\n  q0 += (uint32_t) m1;\n  q0 += (uint32_t) h0;\n\n  q0 >>= 32u;\n  q0 += l3 >> 32u;\n  q0 += m2 >> 32u;\n  q0 += m1 >> 32u;\n  q0 += h0 >> 32u;\n  q0 += (uint32_t) m3;\n  q0 += (uint32_t) m2;\n  q0 += (uint32_t) h1;\n\n  uint64_t q1 = q0 >> 32u;\n  q1 += m3 >> 32u;\n  q1 += m2 >> 32u;\n  q1 += h1 >> 32u;\n  q1 += (uint32_t) m3;\n  q1 += (uint32_t) h2;\n\n  uint64_t q32 = q1 >> 32u;\n  q32 += m3 >> 32u;\n  q32 += h2 >> 32u;\n  q32 += h3;\n\n  num_p->lo = (q1 << 32u) | ((uint32_t) q0);\n  num_p->hi = q32;\n} /* ecma_uint128_div10 */\n\n/**\n * Count leading zeros in a 64-bit integer. The behaviour is undefined for 0.\n *\n * @return number of leading zeros.\n */\ninline static int JERRY_ATTR_CONST\necma_uint64_clz (uint64_t n) /**< integer to count leading zeros in */\n{\n#if defined(__GNUC__) || defined(__clang__)\n  return __builtin_clzll (n);\n#else /* !defined (__GNUC__) && !defined (__clang__) */\n  JERRY_ASSERT (n != 0);\n\n  int cnt = 0;\n  uint64_t one = 0x8000000000000000ull;\n\n  while ((n & one) == 0)\n  {\n    cnt++;\n    one >>= 1;\n  }\n\n  return cnt;\n#endif /* !defined (__GNUC__) && !defined (__clang__) */\n} /* ecma_uint64_clz */\n\n/**\n * Count leading zeros in the top 4 bits of a 64-bit integer.\n *\n * @return number of leading zeros in top 4 bits.\n */\ninline static int JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_uint64_clz_top4 (uint64_t n) /**< integer to count leading zeros in */\n{\n  static const uint8_t ecma_uint4_clz[] = { 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };\n  return ecma_uint4_clz[n >> 60];\n} /* ecma_uint64_clz */\n\n/**\n * Shift required to clear 4 bits of a 64-bit integer.\n *\n * @return 0-4\n */\ninline static int JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_uint64_normalize_shift (uint64_t n) /**< integer to count leading zeros in */\n{\n  static const uint8_t ecma_uint4_shift[] = { 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4 };\n\n  return ecma_uint4_shift[n >> 60];\n} /* ecma_uint64_normalize_shift */\n\n/**\n * @}\n */\n\n/**\n * Number.MAX_VALUE exponent part when using 64 bit float representation.\n */\n#define NUMBER_MAX_DECIMAL_EXPONENT 308\n/**\n * Number.MIN_VALUE exponent part when using 64 bit float representation.\n */\n#define NUMBER_MIN_DECIMAL_EXPONENT -324\n\n#elif !JERRY_NUMBER_TYPE_FLOAT64\n\n/**\n * Number.MAX_VALUE exponent part when using 32 bit float representation.\n */\n#define NUMBER_MAX_DECIMAL_EXPONENT 38\n/**\n * Number.MIN_VALUE exponent part when using 32 bit float representation.\n */\n#define NUMBER_MIN_DECIMAL_EXPONENT -45\n\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Value of epsilon\n */\n#define EPSILON 0.0000001\n\n/**\n * ECMA-defined conversion from string to number for different radixes (2, 8, 16).\n *\n * See also:\n *          ECMA-262 v5 9.3.1\n *          ECMA-262 v6 7.1.3.1\n *\n * @return NaN - if the conversion fails\n *         converted number - otherwise\n */\necma_number_t\necma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 string */\n                                     const lit_utf8_size_t string_size, /**< end of utf-8 string  */\n                                     uint32_t radix, /**< radix */\n                                     uint32_t options) /**< option flags */\n{\n  JERRY_ASSERT (radix == 2 || radix == 8 || radix == 16);\n  JERRY_ASSERT (*str_p == LIT_CHAR_0);\n\n  const lit_utf8_byte_t *end_p = str_p + string_size;\n\n  /* Skip leading zero */\n  str_p++;\n\n  if (radix != 8 || LEXER_TO_ASCII_LOWERCASE (*str_p) == LIT_CHAR_LOWERCASE_O)\n  {\n    /* Skip radix specifier */\n    str_p++;\n  }\n\n  ecma_number_t num = ECMA_NUMBER_ZERO;\n\n  while (str_p < end_p)\n  {\n    lit_utf8_byte_t digit = *str_p++;\n\n    if (digit == LIT_CHAR_UNDERSCORE && (options & ECMA_CONVERSION_ALLOW_UNDERSCORE))\n    {\n      continue;\n    }\n\n    if (!lit_char_is_hex_digit (digit))\n    {\n      return ecma_number_make_nan ();\n    }\n\n    uint32_t value = lit_char_hex_to_int (digit);\n\n    if (value >= radix)\n    {\n      return ecma_number_make_nan ();\n    }\n\n    num = num * radix + value;\n  }\n\n  return num;\n} /* ecma_utf8_string_to_number_by_radix */\n\n/**\n * ECMA-defined conversion of string to Number.\n *\n * See also:\n *          ECMA-262 v5, 9.3.1\n *\n * @return NaN - if the conversion fails\n *         converted number - otherwise\n */\necma_number_t\necma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */\n                            lit_utf8_size_t str_size, /**< string size */\n                            uint32_t options) /**< allowing underscore option bit */\n{\n  ecma_string_trim_helper (&str_p, &str_size);\n  const lit_utf8_byte_t *end_p = str_p + str_size;\n\n  if (str_size == 0)\n  {\n    return ECMA_NUMBER_ZERO;\n  }\n\n  bool sign = false;\n\n  if (str_p + 2 < end_p && str_p[0] == LIT_CHAR_0)\n  {\n    uint8_t radix = lit_char_to_radix (str_p[1]);\n\n    if (radix != 10)\n    {\n      return ecma_utf8_string_to_number_by_radix (str_p, str_size, radix, options);\n    }\n  }\n\n  if (*str_p == LIT_CHAR_PLUS)\n  {\n    str_p++;\n  }\n  else if (*str_p == LIT_CHAR_MINUS)\n  {\n    sign = true;\n    str_p++;\n  }\n\n  /* Check if string is equal to \"Infinity\". */\n  const lit_utf8_byte_t *infinity_str_p = lit_get_magic_string_utf8 (LIT_MAGIC_STRING_INFINITY_UL);\n  const lit_utf8_size_t infinity_length = lit_get_magic_string_size (LIT_MAGIC_STRING_INFINITY_UL);\n\n  if ((lit_utf8_size_t) (end_p - str_p) == infinity_length && memcmp (infinity_str_p, str_p, infinity_length) == 0)\n  {\n    return ecma_number_make_infinity (sign);\n  }\n\n  uint64_t significand = 0;\n  uint32_t digit_count = 0;\n  int32_t decimal_exponent = 0;\n  bool has_significand = false;\n\n  /* Parsing integer part */\n  while (str_p < end_p)\n  {\n    if (*str_p == LIT_CHAR_UNDERSCORE && (options & ECMA_CONVERSION_ALLOW_UNDERSCORE))\n    {\n      str_p++;\n      continue;\n    }\n\n    if (!lit_char_is_decimal_digit (*str_p))\n    {\n      break;\n    }\n\n    has_significand = true;\n    uint32_t digit_value = (uint32_t) (*str_p++ - LIT_CHAR_0);\n\n    if (digit_count == 0 && digit_value == 0)\n    {\n      /* Leading zeros are omitted. */\n      continue;\n    }\n\n    if (digit_count >= ECMA_NUMBER_MAX_DIGITS)\n    {\n      decimal_exponent++;\n      continue;\n    }\n\n    significand = significand * 10 + digit_value;\n    digit_count++;\n  }\n\n  /* Parse fraction part */\n  if (str_p < end_p && *str_p == LIT_CHAR_DOT)\n  {\n    str_p++;\n\n    while (str_p < end_p)\n    {\n      if (*str_p == LIT_CHAR_UNDERSCORE && (options & ECMA_CONVERSION_ALLOW_UNDERSCORE))\n      {\n        str_p++;\n        continue;\n      }\n\n      if (!lit_char_is_decimal_digit (*str_p))\n      {\n        break;\n      }\n\n      has_significand = true;\n      uint32_t digit_value = (uint32_t) (*str_p++ - LIT_CHAR_0);\n\n      if (digit_count == 0 && digit_value == 0)\n      {\n        /* Leading zeros are omitted. */\n        decimal_exponent--;\n        continue;\n      }\n\n      if (digit_count < ECMA_NUMBER_MAX_DIGITS)\n      {\n        significand = significand * 10 + digit_value;\n        digit_count++;\n        decimal_exponent--;\n      }\n    }\n  }\n\n  /* Parsing exponent */\n  if (str_p < end_p && LEXER_TO_ASCII_LOWERCASE (*str_p) == LIT_CHAR_LOWERCASE_E)\n  {\n    str_p++;\n\n    int32_t exponent = 0;\n    int32_t exponent_sign = 1;\n\n    if (str_p >= end_p)\n    {\n      return ecma_number_make_nan ();\n    }\n\n    if (*str_p == LIT_CHAR_PLUS)\n    {\n      str_p++;\n    }\n    else if (*str_p == LIT_CHAR_MINUS)\n    {\n      exponent_sign = -1;\n      str_p++;\n    }\n\n    if (str_p >= end_p || !lit_char_is_decimal_digit (*str_p))\n    {\n      return ecma_number_make_nan ();\n    }\n\n    while (str_p < end_p)\n    {\n      if (*str_p == LIT_CHAR_UNDERSCORE && (options & ECMA_CONVERSION_ALLOW_UNDERSCORE))\n      {\n        str_p++;\n        continue;\n      }\n\n      if (!lit_char_is_decimal_digit (*str_p))\n      {\n        break;\n      }\n\n      int32_t digit_value = (*str_p++ - LIT_CHAR_0);\n      exponent = exponent * 10 + digit_value;\n\n      if (exponent_sign * exponent > NUMBER_MAX_DECIMAL_EXPONENT)\n      {\n        return ecma_number_make_infinity (sign);\n      }\n\n      if (exponent_sign * exponent < NUMBER_MIN_DECIMAL_EXPONENT)\n      {\n        return sign ? -ECMA_NUMBER_ZERO : ECMA_NUMBER_ZERO;\n      }\n    }\n\n    decimal_exponent += exponent_sign * exponent;\n  }\n\n  if (!has_significand || str_p < end_p)\n  {\n    return ecma_number_make_nan ();\n  }\n\n  if (significand == 0)\n  {\n    return sign ? -ECMA_NUMBER_ZERO : ECMA_NUMBER_ZERO;\n  }\n\n#if JERRY_NUMBER_TYPE_FLOAT64\n  /*\n   * 128-bit mantissa storage\n   *\n   * Normalized: |4 bits zero|124-bit mantissa with highest bit set to 1|\n   */\n  ecma_uint128_t significand_uint128 = { .hi = significand, .lo = 0 };\n\n  /* Normalizing mantissa */\n  int shift = 4 - ecma_uint64_clz (significand_uint128.hi);\n\n  if (shift < 0)\n  {\n    ecma_uint128_shift_left (&significand_uint128, -shift);\n  }\n  else\n  {\n    ecma_uint128_shift_right (&significand_uint128, shift);\n  }\n\n  int32_t binary_exponent = ECMA_NUMBER_FRACTION_WIDTH + shift;\n\n  while (decimal_exponent > 0)\n  {\n    JERRY_ASSERT (ecma_uint64_clz (significand_uint128.hi) == 4);\n\n    ecma_uint128_mul10 (&significand_uint128);\n    decimal_exponent--;\n\n    /* Re-normalizing mantissa */\n    shift = ecma_uint64_normalize_shift (significand_uint128.hi);\n    JERRY_ASSERT (shift >= 0 && shift <= 4);\n\n    ecma_uint128_shift_right (&significand_uint128, shift);\n    binary_exponent += shift;\n  }\n\n  while (decimal_exponent < 0)\n  {\n    /* Denormalizing mantissa, moving highest 1 to bit 127 */\n    JERRY_ASSERT (ecma_uint64_clz (significand_uint128.hi) <= 4);\n    shift = ecma_uint64_clz_top4 (significand_uint128.hi);\n    JERRY_ASSERT (shift >= 0 && shift <= 4);\n\n    ecma_uint128_shift_left (&significand_uint128, shift);\n    binary_exponent -= shift;\n\n    ecma_uint128_div10 (&significand_uint128);\n    decimal_exponent++;\n  }\n\n  /*\n   * Preparing mantissa for conversion to 52-bit representation, converting it to:\n   *\n   * |11 zero bits|1|116 mantissa bits|\n   */\n  JERRY_ASSERT (ecma_uint64_clz (significand_uint128.hi) <= 4);\n  shift = 11 - ecma_uint64_clz_top4 (significand_uint128.hi);\n  ecma_uint128_shift_right (&significand_uint128, shift);\n  binary_exponent += shift;\n\n  JERRY_ASSERT (ecma_uint64_clz (significand_uint128.hi) == 11);\n\n  binary_exponent += ECMA_NUMBER_EXPONENT_BIAS;\n\n  /* Handle denormal numbers */\n  if (binary_exponent < 1)\n  {\n    ecma_uint128_shift_right (&significand_uint128, -binary_exponent + 1);\n    binary_exponent = 0;\n  }\n\n  significand = ecma_round_high_to_uint64 (&significand_uint128);\n\n  if (significand >= 1ull << (ECMA_NUMBER_FRACTION_WIDTH + 1))\n  {\n    /* Rounding carried over to the most significant bit, re-normalize.\n     * No need to shift mantissa right, as the low 52 bits will be 0 regardless. */\n    binary_exponent++;\n  }\n\n  if (binary_exponent >= ((1 << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1))\n  {\n    return ecma_number_make_infinity (sign);\n  }\n\n  /* Mask low 52 bits. */\n  significand &= ((1ull << ECMA_NUMBER_FRACTION_WIDTH) - 1);\n\n  JERRY_ASSERT (binary_exponent < (1 << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1);\n  JERRY_ASSERT (significand < (1ull << ECMA_NUMBER_FRACTION_WIDTH));\n\n  return ecma_number_create (sign, (uint32_t) binary_exponent, significand);\n#elif !JERRY_NUMBER_TYPE_FLOAT64\n  /* Less precise conversion */\n  ecma_number_t num = (ecma_number_t) (uint32_t) fraction_uint64;\n\n  ecma_number_t m = e_sign ? (ecma_number_t) 0.1 : (ecma_number_t) 10.0;\n\n  while (e)\n  {\n    if (e % 2)\n    {\n      num *= m;\n    }\n\n    m *= m;\n    e /= 2;\n  }\n\n  return num;\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n} /* ecma_utf8_string_to_number */\n\n/**\n * ECMA-defined conversion of UInt32 to String (zero-terminated).\n *\n * See also:\n *          ECMA-262 v5, 9.8.1\n *\n * @return number of bytes copied to buffer\n */\nlit_utf8_size_t\necma_uint32_to_utf8_string (uint32_t value, /**< value to convert */\n                            lit_utf8_byte_t *out_buffer_p, /**< buffer for string */\n                            lit_utf8_size_t buffer_size) /**< size of buffer */\n{\n  lit_utf8_byte_t *buf_p = out_buffer_p + buffer_size;\n\n  do\n  {\n    JERRY_ASSERT (buf_p >= out_buffer_p);\n\n    buf_p--;\n    *buf_p = (lit_utf8_byte_t) ((value % 10) + LIT_CHAR_0);\n    value /= 10;\n  } while (value != 0);\n\n  JERRY_ASSERT (buf_p >= out_buffer_p);\n\n  lit_utf8_size_t bytes_copied = (lit_utf8_size_t) (out_buffer_p + buffer_size - buf_p);\n\n  if (JERRY_LIKELY (buf_p != out_buffer_p))\n  {\n    memmove (out_buffer_p, buf_p, bytes_copied);\n  }\n\n  return bytes_copied;\n} /* ecma_uint32_to_utf8_string */\n\n/**\n * ECMA-defined conversion of Number value to UInt32 value\n *\n * See also:\n *          ECMA-262 v5, 9.6\n *\n * @return 32-bit unsigned integer - result of conversion.\n */\nuint32_t\necma_number_to_uint32 (ecma_number_t num) /**< ecma-number */\n{\n  if (JERRY_UNLIKELY (ecma_number_is_zero (num) || !ecma_number_is_finite (num)))\n  {\n    return 0;\n  }\n\n  const bool sign = ecma_number_is_negative (num);\n  const ecma_number_t abs_num = sign ? -num : num;\n\n  /* 2 ^ 32 */\n  const uint64_t uint64_2_pow_32 = (1ull << 32);\n\n  const ecma_number_t num_2_pow_32 = (float) uint64_2_pow_32;\n\n  ecma_number_t num_in_uint32_range;\n\n  if (abs_num >= num_2_pow_32)\n  {\n    num_in_uint32_range = ecma_number_remainder (abs_num, num_2_pow_32);\n  }\n  else\n  {\n    num_in_uint32_range = abs_num;\n  }\n\n  /* Check that the floating point value can be represented with uint32_t. */\n  JERRY_ASSERT (num_in_uint32_range < uint64_2_pow_32);\n  uint32_t uint32_num = (uint32_t) num_in_uint32_range;\n\n  const uint32_t ret = sign ? -uint32_num : uint32_num;\n\n#ifndef JERRY_NDEBUG\n  if (sign && uint32_num != 0)\n  {\n    JERRY_ASSERT (ret == uint64_2_pow_32 - uint32_num);\n  }\n  else\n  {\n    JERRY_ASSERT (ret == uint32_num);\n  }\n#endif /* !JERRY_NDEBUG */\n\n  return ret;\n} /* ecma_number_to_uint32 */\n\n/**\n * ECMA-defined conversion of Number value to Int32 value\n *\n * See also:\n *          ECMA-262 v5, 9.5\n *\n * @return 32-bit signed integer - result of conversion.\n */\nint32_t\necma_number_to_int32 (ecma_number_t num) /**< ecma-number */\n{\n  uint32_t uint32_num = ecma_number_to_uint32 (num);\n\n  /* 2 ^ 32 */\n  const int64_t int64_2_pow_32 = (1ll << 32);\n\n  /* 2 ^ 31 */\n  const uint32_t uint32_2_pow_31 = (1ull << 31);\n\n  int32_t ret;\n\n  if (uint32_num >= uint32_2_pow_31)\n  {\n    ret = (int32_t) (uint32_num - int64_2_pow_32);\n  }\n  else\n  {\n    ret = (int32_t) uint32_num;\n  }\n\n#ifndef JERRY_NDEBUG\n  int64_t int64_num = uint32_num;\n\n  JERRY_ASSERT (int64_num >= 0);\n\n  if (int64_num >= uint32_2_pow_31)\n  {\n    JERRY_ASSERT (ret == int64_num - int64_2_pow_32);\n  }\n  else\n  {\n    JERRY_ASSERT (ret == int64_num);\n  }\n#endif /* !JERRY_NDEBUG */\n\n  return ret;\n} /* ecma_number_to_int32 */\n\n/**\n * Perform conversion of ecma-number to decimal representation with decimal exponent.\n *\n * Note:\n *      The calculated values correspond to s, n, k parameters in ECMA-262 v5, 9.8.1, item 5:\n *         - parameter out_digits_p corresponds to s, the digits of the number;\n *         - parameter out_decimal_exp_p corresponds to n, the decimal exponent;\n *         - return value corresponds to k, the number of digits.\n *\n * @return the number of digits\n */\nlit_utf8_size_t\necma_number_to_decimal (ecma_number_t num, /**< ecma-number */\n                        lit_utf8_byte_t *out_digits_p, /**< [out] buffer to fill with digits */\n                        int32_t *out_decimal_exp_p) /**< [out] decimal exponent */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (num));\n  JERRY_ASSERT (!ecma_number_is_zero (num));\n  JERRY_ASSERT (!ecma_number_is_infinity (num));\n  JERRY_ASSERT (!ecma_number_is_negative (num));\n\n  return ecma_errol0_dtoa ((double) num, out_digits_p, out_decimal_exp_p);\n} /* ecma_number_to_decimal */\n\n/**\n * Convert ecma-number to zero-terminated string\n *\n * See also:\n *          ECMA-262 v5, 9.8.1\n *\n *\n * @return size of utf-8 string\n */\nlit_utf8_size_t\necma_number_to_utf8_string (ecma_number_t num, /**< ecma-number */\n                            lit_utf8_byte_t *buffer_p, /**< buffer for utf-8 string */\n                            lit_utf8_size_t buffer_size) /**< size of buffer */\n{\n  lit_utf8_byte_t *dst_p;\n\n  if (ecma_number_is_nan (num))\n  {\n    /* 1. */\n    dst_p = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_NAN, buffer_p, buffer_size);\n    return (lit_utf8_size_t) (dst_p - buffer_p);\n  }\n\n  if (ecma_number_is_zero (num))\n  {\n    /* 2. */\n    *buffer_p = LIT_CHAR_0;\n    JERRY_ASSERT (1 <= buffer_size);\n    return 1;\n  }\n\n  dst_p = buffer_p;\n\n  if (ecma_number_is_negative (num))\n  {\n    /* 3. */\n    *dst_p++ = LIT_CHAR_MINUS;\n    num = -num;\n  }\n\n  if (ecma_number_is_infinity (num))\n  {\n    /* 4. */\n    dst_p = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_INFINITY_UL,\n                                             dst_p,\n                                             (lit_utf8_size_t) (buffer_p + buffer_size - dst_p));\n    JERRY_ASSERT (dst_p <= buffer_p + buffer_size);\n    return (lit_utf8_size_t) (dst_p - buffer_p);\n  }\n\n  /* 5. */\n  uint32_t num_uint32 = ecma_number_to_uint32 (num);\n\n  if (((ecma_number_t) num_uint32) == num)\n  {\n    dst_p += ecma_uint32_to_utf8_string (num_uint32, dst_p, (lit_utf8_size_t) (buffer_p + buffer_size - dst_p));\n    JERRY_ASSERT (dst_p <= buffer_p + buffer_size);\n    return (lit_utf8_size_t) (dst_p - buffer_p);\n  }\n\n  /* decimal exponent */\n  int32_t n;\n  /* number of digits in mantissa */\n  int32_t k;\n\n  k = (int32_t) ecma_number_to_decimal (num, dst_p, &n);\n\n  if (k <= n && n <= 21)\n  {\n    /* 6. */\n    dst_p += k;\n\n    memset (dst_p, LIT_CHAR_0, (size_t) (n - k));\n    dst_p += n - k;\n\n    JERRY_ASSERT (dst_p <= buffer_p + buffer_size);\n    return (lit_utf8_size_t) (dst_p - buffer_p);\n  }\n\n  if (0 < n && n <= 21)\n  {\n    /* 7. */\n    memmove (dst_p + n + 1, dst_p + n, (size_t) (k - n));\n    *(dst_p + n) = LIT_CHAR_DOT;\n    dst_p += k + 1;\n\n    JERRY_ASSERT (dst_p <= buffer_p + buffer_size);\n    return (lit_utf8_size_t) (dst_p - buffer_p);\n  }\n\n  if (-6 < n && n <= 0)\n  {\n    /* 8. */\n    memmove (dst_p + 2 - n, dst_p, (size_t) k);\n    memset (dst_p + 2, LIT_CHAR_0, (size_t) -n);\n    *dst_p = LIT_CHAR_0;\n    *(dst_p + 1) = LIT_CHAR_DOT;\n    dst_p += k - n + 2;\n\n    JERRY_ASSERT (dst_p <= buffer_p + buffer_size);\n    return (lit_utf8_size_t) (dst_p - buffer_p);\n  }\n\n  if (k == 1)\n  {\n    /* 9. */\n    dst_p++;\n  }\n  else\n  {\n    /* 10. */\n    memmove (dst_p + 2, dst_p + 1, (size_t) (k - 1));\n    *(dst_p + 1) = LIT_CHAR_DOT;\n    dst_p += k + 1;\n  }\n\n  /* 9., 10. */\n  *dst_p++ = LIT_CHAR_LOWERCASE_E;\n  *dst_p++ = (n >= 1) ? LIT_CHAR_PLUS : LIT_CHAR_MINUS;\n  uint32_t t = (uint32_t) (n >= 1 ? (n - 1) : -(n - 1));\n\n  dst_p += ecma_uint32_to_utf8_string (t, dst_p, (lit_utf8_size_t) (buffer_p + buffer_size - dst_p));\n\n  JERRY_ASSERT (dst_p <= buffer_p + buffer_size);\n\n  return (lit_utf8_size_t) (dst_p - buffer_p);\n} /* ecma_number_to_utf8_string */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-helpers-errol.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *   Copyright (c) 2016 Marc Andrysco\n *\n *   Permission is hereby granted, free of charge, to any person obtaining a copy\n *   of this software and associated documentation files (the \"Software\"), to deal\n *   in the Software without restriction, including without limitation the rights\n *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n *   copies of the Software, and to permit persons to whom the Software is\n *   furnished to do so, subject to the following conditions:\n *\n *   The above copyright notice and this permission notice shall be included in all\n *   copies or substantial portions of the Software.\n *\n *   THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n *   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n *   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n *   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n *   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n *   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n *   SOFTWARE.\n */\n\n#include <math.h>\n\n#include \"ecma-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmahelpers Helpers for operations with ECMA data types\n * @{\n */\n\n/**\n * Printing Floating-Point Numbers\n *\n * available at http://cseweb.ucsd.edu/~mandrysc/pub/dtoa.pdf\n */\n\n/**\n * Floating point format definitions (next float value)\n */\n#define ECMA_NEXT_FLOAT(value) (nextafter ((value), INFINITY))\n/**\n * Floating point format definitions (previous float value)\n */\n#define ECMA_PREV_FLOAT(value) (nextafter ((value), -INFINITY))\n\n/**\n * Value of epsilon\n */\n#define ERROL0_EPSILON 0.0000001\n\n/**\n * High-precision data structure.\n */\ntypedef struct\n{\n  double value; /**< value */\n  double offset; /**< offset */\n} ecma_high_prec_t;\n\n/**\n * Normalize the number by factoring in the error.\n */\nstatic inline void JERRY_ATTR_ALWAYS_INLINE\necma_normalize_high_prec_data (ecma_high_prec_t *hp_data_p) /**< [in, out] float pair */\n{\n  double val = hp_data_p->value;\n\n  hp_data_p->value += hp_data_p->offset;\n  hp_data_p->offset += val - hp_data_p->value;\n} /* ecma_normalize_high_prec_data */\n\n/**\n * Multiply the high-precision number by ten.\n */\nstatic inline void JERRY_ATTR_ALWAYS_INLINE\necma_multiply_high_prec_by_10 (ecma_high_prec_t *hp_data_p) /**< [in, out] high-precision number */\n{\n  double value = hp_data_p->value;\n\n  hp_data_p->value *= 10.0;\n  hp_data_p->offset *= 10.0;\n\n  double offset = hp_data_p->value;\n\n  offset -= value * 8.0;\n  offset -= value * 2.0;\n\n  hp_data_p->offset -= offset;\n\n  ecma_normalize_high_prec_data (hp_data_p);\n} /* ecma_multiply_high_prec_by_10 */\n\n/**\n * Divide the high-precision number by ten.\n */\nstatic void\necma_divide_high_prec_by_10 (ecma_high_prec_t *hp_data_p) /**< [in, out] high-precision number */\n{\n  double value = hp_data_p->value;\n\n  hp_data_p->value /= 10.0;\n  hp_data_p->offset /= 10.0;\n\n  value -= hp_data_p->value * 8.0;\n  value -= hp_data_p->value * 2.0;\n\n  hp_data_p->offset += value / 10.0;\n\n  ecma_normalize_high_prec_data (hp_data_p);\n} /* ecma_divide_high_prec_by_10 */\n\n/**\n * Errol0 double to ASCII conversion, guaranteed correct but possibly not optimal.\n *\n * @return number of generated digits\n */\nextern inline lit_utf8_size_t JERRY_ATTR_ALWAYS_INLINE\necma_errol0_dtoa (double val, /**< ecma number */\n                  lit_utf8_byte_t *buffer_p, /**< buffer to generate digits into */\n                  int32_t *exp_p) /**< [out] exponent */\n{\n  double power_of_10 = 1.0;\n  int32_t exponent = 1;\n\n  /* normalize the midpoint */\n  ecma_high_prec_t mid;\n\n  mid.value = val;\n  mid.offset = 0.0;\n\n  while (((mid.value > 10.0) || ((mid.value == 10.0) && (mid.offset >= 0.0))) && (exponent < 308))\n  {\n    exponent++;\n    ecma_divide_high_prec_by_10 (&mid);\n    power_of_10 /= 10.0;\n  }\n\n  while (((mid.value < 1.0) || ((mid.value == 1.0) && (mid.offset < 0.0))) && (exponent > -307))\n  {\n    exponent--;\n    ecma_multiply_high_prec_by_10 (&mid);\n    power_of_10 *= 10.0;\n  }\n\n  ecma_high_prec_t high_bound, low_bound;\n\n  high_bound.value = mid.value;\n  high_bound.offset = mid.offset;\n\n  if (ECMA_NEXT_FLOAT (val) != INFINITY)\n  {\n    high_bound.offset += (ECMA_NEXT_FLOAT (val) - val) * power_of_10 / (2.0 + ERROL0_EPSILON);\n  }\n\n  low_bound.value = mid.value;\n  low_bound.offset = mid.offset + (ECMA_PREV_FLOAT (val) - val) * power_of_10 / (2.0 + ERROL0_EPSILON);\n\n  ecma_normalize_high_prec_data (&high_bound);\n  ecma_normalize_high_prec_data (&low_bound);\n\n  /* normalized boundaries */\n\n  while (high_bound.value > 10.0 || (high_bound.value == 10.0 && (high_bound.offset >= 0.0)))\n  {\n    exponent++;\n    ecma_divide_high_prec_by_10 (&high_bound);\n    ecma_divide_high_prec_by_10 (&low_bound);\n  }\n\n  while (high_bound.value < 1.0 || (high_bound.value == 1.0 && (high_bound.offset < 0.0)))\n  {\n    exponent--;\n    ecma_multiply_high_prec_by_10 (&high_bound);\n    ecma_multiply_high_prec_by_10 (&low_bound);\n  }\n\n  /* digit generation */\n\n  lit_utf8_byte_t *dst_p = buffer_p;\n\n  while (high_bound.value != 0.0 || high_bound.offset != 0.0)\n  {\n    uint8_t high_digit = (uint8_t) high_bound.value;\n\n    if ((high_bound.value == high_digit) && (high_bound.offset < 0))\n    {\n      high_digit = (uint8_t) (high_digit - 1u);\n    }\n\n    uint8_t low_digit = (uint8_t) low_bound.value;\n\n    if ((low_bound.value == low_digit) && (low_bound.offset < 0))\n    {\n      low_digit = (uint8_t) (low_digit - 1u);\n    }\n\n    if (low_digit != high_digit)\n    {\n      break;\n    }\n\n    *dst_p++ = (lit_utf8_byte_t) ('0' + high_digit);\n\n    high_bound.value -= high_digit;\n    ecma_multiply_high_prec_by_10 (&high_bound);\n\n    low_bound.value -= low_digit;\n    ecma_multiply_high_prec_by_10 (&low_bound);\n  }\n\n  double mdig = (high_bound.value + low_bound.value) / 2.0 + 0.5;\n  *dst_p++ = (lit_utf8_byte_t) ('0' + (uint8_t) mdig);\n\n  *exp_p = exponent;\n\n  return (lit_utf8_size_t) (dst_p - buffer_p);\n} /* ecma_errol0_dtoa */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-helpers-external-pointers.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmahelpers Helpers for operations with ECMA data types\n * @{\n */\n\n/**\n * Create a native pointer property to store the native pointer and its type info.\n *\n * @return true - if property was just created with specified value,\n *         false - otherwise, if property existed before the call, it's value was updated\n */\nbool\necma_create_native_pointer_property (ecma_object_t *obj_p, /**< object to create property in */\n                                     void *native_p, /**< native pointer */\n                                     const jerry_object_native_info_t *native_info_p) /**< native type info */\n{\n  ecma_string_t *name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER);\n\n  if (native_info_p != NULL && native_info_p->number_of_references > 0)\n  {\n    name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER_WITH_REFERENCES);\n  }\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_fast_array_convert_to_normal (obj_p);\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p);\n\n  bool is_new = (property_p == NULL);\n\n  ecma_native_pointer_t *native_pointer_p;\n\n  if (property_p == NULL)\n  {\n    native_pointer_p = (ecma_native_pointer_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_t));\n\n    ecma_property_value_t *value_p;\n    ECMA_CREATE_INTERNAL_PROPERTY (obj_p, name_p, property_p, value_p);\n\n    ECMA_SET_INTERNAL_VALUE_POINTER (value_p->value, native_pointer_p);\n    *property_p |= ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL;\n  }\n  else if (*property_p & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL)\n  {\n    ecma_property_value_t *value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n    native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value_p->value);\n\n    if (native_pointer_p->native_info_p == native_info_p)\n    {\n      native_pointer_p->native_p = native_p;\n      return false;\n    }\n\n    value_p->value = JMEM_CP_NULL;\n    (void) value_p->value; /* Make cppcheck happy. */\n    *property_p &= (ecma_property_t) ~ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL;\n\n    ecma_native_pointer_chain_t *item_p;\n    item_p = (ecma_native_pointer_chain_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_chain_t));\n    item_p->data = *native_pointer_p;\n\n    jmem_heap_free_block (native_pointer_p, sizeof (ecma_native_pointer_t));\n\n    item_p->next_p = (ecma_native_pointer_chain_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_chain_t));\n    item_p->next_p->next_p = NULL;\n\n    native_pointer_p = &item_p->next_p->data;\n    ECMA_SET_INTERNAL_VALUE_POINTER (value_p->value, item_p);\n  }\n  else\n  {\n    ecma_property_value_t *value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n    if (value_p->value == JMEM_CP_NULL)\n    {\n      native_pointer_p = (ecma_native_pointer_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_t));\n      ECMA_SET_INTERNAL_VALUE_POINTER (value_p->value, native_pointer_p);\n\n      *property_p |= ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL;\n    }\n    else\n    {\n      ecma_native_pointer_chain_t *item_p;\n      item_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_chain_t, value_p->value);\n\n      /* There should be at least 2 native pointers in the chain */\n      JERRY_ASSERT (item_p != NULL && item_p->next_p != NULL);\n\n      while (true)\n      {\n        if (item_p->data.native_info_p == native_info_p)\n        {\n          /* The native info already exists -> update the corresponding data */\n          item_p->data.native_p = native_p;\n          return false;\n        }\n\n        if (item_p->next_p == NULL)\n        {\n          /* The native info does not exist -> append a new element to the chain */\n          break;\n        }\n\n        item_p = item_p->next_p;\n      }\n\n      ecma_native_pointer_chain_t *new_item_p;\n\n      new_item_p = (ecma_native_pointer_chain_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_chain_t));\n      item_p->next_p = new_item_p;\n      new_item_p->next_p = NULL;\n\n      native_pointer_p = &new_item_p->data;\n    }\n  }\n\n  native_pointer_p->native_p = native_p;\n  native_pointer_p->native_info_p = (jerry_object_native_info_t *) native_info_p;\n\n  return is_new;\n} /* ecma_create_native_pointer_property */\n\n/**\n * Get value of native package stored in the object's property with specified identifier\n *\n * Note:\n *      property identifier should be one of the following:\n *        - LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER\n *\n * @return native pointer data if property exists\n *         NULL otherwise\n */\necma_native_pointer_t *\necma_get_native_pointer_value (ecma_object_t *obj_p, /**< object to get property value from */\n                               const jerry_object_native_info_t *native_info_p) /**< native type info */\n{\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    /* Fast access mode array can not have native pointer properties */\n    return NULL;\n  }\n\n  ecma_string_t *name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER);\n\n  if (native_info_p != NULL && native_info_p->number_of_references > 0)\n  {\n    name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER_WITH_REFERENCES);\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p);\n\n  if (property_p == NULL)\n  {\n    return NULL;\n  }\n\n  ecma_property_value_t *value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n  if (JERRY_LIKELY (*property_p & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL))\n  {\n    ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value_p->value);\n\n    if (native_pointer_p->native_info_p == native_info_p)\n    {\n      return native_pointer_p;\n    }\n\n    return NULL;\n  }\n\n  if (value_p->value == JMEM_CP_NULL)\n  {\n    return NULL;\n  }\n\n  ecma_native_pointer_chain_t *item_p;\n  item_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_chain_t, value_p->value);\n\n  /* There should be at least 2 native pointers in the chain */\n  JERRY_ASSERT (item_p != NULL && item_p->next_p != NULL);\n\n  do\n  {\n    if (item_p->data.native_info_p == native_info_p)\n    {\n      return &item_p->data;\n    }\n\n    item_p = item_p->next_p;\n  } while (item_p != NULL);\n\n  return NULL;\n} /* ecma_get_native_pointer_value */\n\n/**\n * Delete the previously set native pointer by the native type info from the specified object.\n *\n * Note:\n *      If the specified object has no matching native pointer for the given native type info\n *      the function has no effect.\n *\n * @return true - if the native pointer has been deleted succesfully\n *         false - otherwise\n */\nbool\necma_delete_native_pointer_property (ecma_object_t *obj_p, /**< object to delete property from */\n                                     const jerry_object_native_info_t *native_info_p) /**< native type info */\n{\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    /* Fast access mode array can not have native pointer properties */\n    return false;\n  }\n\n  ecma_string_t *name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER);\n\n  if (native_info_p != NULL && native_info_p->number_of_references > 0)\n  {\n    name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER_WITH_REFERENCES);\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p);\n\n  if (property_p == NULL)\n  {\n    return false;\n  }\n\n  ecma_property_value_t *value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n  if (JERRY_LIKELY (*property_p & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL))\n  {\n    ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value_p->value);\n\n    if (native_pointer_p->native_info_p != native_info_p)\n    {\n      return false;\n    }\n\n    value_p->value = JMEM_CP_NULL;\n    *property_p &= (ecma_property_t) ~ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL;\n    jmem_heap_free_block (native_pointer_p, sizeof (ecma_native_pointer_t));\n    return true;\n  }\n\n  if (value_p->value == JMEM_CP_NULL)\n  {\n    return false;\n  }\n\n  ecma_native_pointer_chain_t *first_p;\n  first_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_chain_t, value_p->value);\n\n  /* There should be at least 2 native pointers in the chain */\n  JERRY_ASSERT (first_p != NULL && first_p->next_p != NULL);\n\n  ecma_native_pointer_chain_t *item_p = first_p;\n  ecma_native_pointer_chain_t *prev_p = NULL;\n\n  do\n  {\n    if (item_p->data.native_info_p == native_info_p)\n    {\n      if (prev_p == NULL)\n      {\n        /* The first element is deleted from the chain: change the property value. */\n        first_p = item_p->next_p;\n        ECMA_SET_INTERNAL_VALUE_POINTER (value_p->value, first_p);\n      }\n      else\n      {\n        /* A non-first element is deleted from the chain: update the previous pointer. */\n        prev_p->next_p = item_p->next_p;\n      }\n\n      jmem_heap_free_block (item_p, sizeof (ecma_native_pointer_chain_t));\n\n      if (first_p->next_p != NULL)\n      {\n        return true;\n      }\n\n      /* Only one item remained. The ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL flag is\n       * set early to avoid using the chain if the allocation below triggers a GC. */\n      *property_p |= ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL;\n\n      ecma_native_pointer_t *native_pointer_p;\n      native_pointer_p = (ecma_native_pointer_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_t));\n      *native_pointer_p = first_p->data;\n\n      ECMA_SET_INTERNAL_VALUE_POINTER (value_p->value, native_pointer_p);\n\n      jmem_heap_free_block (first_p, sizeof (ecma_native_pointer_chain_t));\n      return true;\n    }\n\n    prev_p = item_p;\n    item_p = item_p->next_p;\n  } while (item_p != NULL);\n\n  return false;\n} /* ecma_delete_native_pointer_property */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-helpers-number.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-helpers-number.h\"\n\n#include <math.h>\n\n#include \"ecma-conversion.h\"\n\n#include \"lit-char-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmahelpers Helpers for operations with ECMA data types\n * @{\n */\n\nJERRY_STATIC_ASSERT (sizeof (ecma_value_t) == sizeof (ecma_integer_value_t),\n                     size_of_ecma_value_t_must_be_equal_to_the_size_of_ecma_integer_value_t);\n\nJERRY_STATIC_ASSERT (ECMA_DIRECT_SHIFT == ECMA_VALUE_SHIFT + 1, currently_directly_encoded_values_has_one_extra_flag);\n\nJERRY_STATIC_ASSERT (((1 << (ECMA_DIRECT_SHIFT - 1)) | ECMA_TYPE_DIRECT) == ECMA_DIRECT_TYPE_SIMPLE_VALUE,\n                     currently_directly_encoded_values_start_after_direct_type_simple_value);\n\nJERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (ecma_binary_num_t),\n                     size_of_ecma_number_t_must_be_equal_to_binary_representation);\n\n/**\n * Convert an ecma-number to it's binary representation.\n *\n * @return binary representation\n */\nextern inline ecma_binary_num_t JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_number_to_binary (ecma_number_t number) /**< ecma number */\n{\n  ecma_number_accessor_t f;\n  f.as_number = number;\n\n  return f.as_binary;\n} /* ecma_number_to_binary */\n\n/**\n * Convert a binary representation to the corresponding ecma-number.\n *\n * @return ecma-number\n */\nextern inline ecma_number_t JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_number_from_binary (ecma_binary_num_t binary) /**< binary representation */\n{\n  ecma_number_accessor_t f;\n  f.as_binary = binary;\n\n  return f.as_number;\n} /* ecma_number_from_binary */\n\n/**\n * Check signedness of the binary number.\n *\n * @return true  - if sign bit is set\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_number_sign (ecma_binary_num_t binary) /**< binary representation */\n{\n  return (binary & ECMA_NUMBER_SIGN_BIT) != 0;\n} /* ecma_number_sign */\n\n/**\n * Get biased exponent field of the binary number.\n *\n * @return unsigned integer value of the biased exponent field\n */\nextern inline uint32_t JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_number_biased_exp (ecma_binary_num_t binary) /**< binary representation */\n{\n  return (uint32_t) ((binary & ~ECMA_NUMBER_SIGN_BIT) >> ECMA_NUMBER_FRACTION_WIDTH);\n} /* ecma_number_biased_exp */\n\n/**\n * Get fraction field of the binary number.\n *\n * @return unsigned integer value of the fraction field\n */\nextern inline uint64_t JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_number_fraction (ecma_binary_num_t binary) /**< binary representation */\n{\n  return binary & ((1ull << ECMA_NUMBER_FRACTION_WIDTH) - 1);\n} /* ecma_number_fraction */\n\n/**\n * Packing sign, fraction and biased exponent to ecma-number\n *\n * @return ecma-number with specified sign, biased_exponent and fraction\n */\necma_number_t\necma_number_create (bool sign, /**< sign */\n                    uint32_t biased_exp, /**< biased exponent */\n                    uint64_t fraction) /**< fraction */\n{\n  JERRY_ASSERT ((biased_exp & ~((1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1)) == 0);\n  JERRY_ASSERT ((fraction & ~((1ull << ECMA_NUMBER_FRACTION_WIDTH) - 1)) == 0);\n\n  ecma_binary_num_t binary = biased_exp;\n  binary <<= ECMA_NUMBER_FRACTION_WIDTH;\n\n  binary |= fraction;\n\n  if (sign)\n  {\n    binary |= ECMA_NUMBER_SIGN_BIT;\n  }\n\n  return ecma_number_from_binary (binary);\n} /* ecma_number_create */\n\n/**\n * Check if ecma-number is NaN\n *\n * @return true - if biased exponent is filled with 1 bits and\n                  fraction is filled with anything but not all zero bits,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_number_is_nan (ecma_number_t num) /**< ecma-number */\n{\n  bool is_nan = (num != num);\n\n#ifndef JERRY_NDEBUG\n  /* IEEE-754 2008, 3.4, a */\n  ecma_binary_num_t binary = ecma_number_to_binary (num);\n  bool is_nan_exponent = (ecma_number_biased_exp (binary) == (1 << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1);\n  bool is_nan_fraction = (ecma_number_fraction (binary) > 0);\n\n  bool is_nan_ieee754 = is_nan_exponent && is_nan_fraction;\n  JERRY_ASSERT (is_nan == is_nan_ieee754);\n#endif /* !JERRY_NDEBUG */\n\n  return is_nan;\n} /* ecma_number_is_nan */\n\n/**\n * Make a NaN.\n *\n * @return NaN value\n */\nextern inline ecma_number_t JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_number_make_nan (void)\n{\n  ecma_number_accessor_t f;\n  f.as_binary = ECMA_NUMBER_BINARY_QNAN;\n\n  return f.as_number;\n} /* ecma_number_make_nan */\n\n/**\n * Make an Infinity.\n *\n * @return if !sign - +Infinity value,\n *         else - -Infinity value.\n */\nextern inline ecma_number_t JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_number_make_infinity (bool sign) /**< sign of the value */\n{\n  ecma_number_accessor_t f;\n  f.as_binary = ECMA_NUMBER_BINARY_INF;\n\n  if (sign)\n  {\n    f.as_binary |= ECMA_NUMBER_SIGN_BIT;\n  }\n\n  return f.as_number;\n} /* ecma_number_make_infinity */\n\n/**\n * Check if ecma-number is negative\n *\n * @return true - if sign bit of ecma-number is set\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_number_is_negative (ecma_number_t num) /**< ecma-number */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (num));\n\n  return (ecma_number_to_binary (num) & ECMA_NUMBER_SIGN_BIT) != 0;\n} /* ecma_number_is_negative */\n\n/**\n * Check if ecma-number is zero\n *\n * @return true - if fraction is zero and biased exponent is zero,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_number_is_zero (ecma_number_t num) /**< ecma-number */\n{\n  bool is_zero = (num == ECMA_NUMBER_ZERO);\n\n#ifndef JERRY_NDEBUG\n  bool is_zero_ieee754 = ((ecma_number_to_binary (num) & ~ECMA_NUMBER_SIGN_BIT) == 0);\n  JERRY_ASSERT (is_zero == is_zero_ieee754);\n#endif /* !JERRY_NDEBUG */\n\n  return is_zero;\n} /* ecma_number_is_zero */\n\n/**\n * Check if number is infinity\n *\n * @return true - if biased exponent is filled with 1 bits and\n *                fraction is filled with zero bits,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_number_is_infinity (ecma_number_t num) /**< ecma-number */\n{\n  return (ecma_number_to_binary (num) & ~ECMA_NUMBER_SIGN_BIT) == ECMA_NUMBER_BINARY_INF;\n} /* ecma_number_is_infinity */\n\n/**\n * Check if number is finite\n *\n * @return true  - if number is finite\n *         false - if number is NaN or infinity\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_number_is_finite (ecma_number_t num) /**< ecma-number */\n{\n#if defined(__GNUC__) || defined(__clang__)\n  return __builtin_isfinite (num);\n#elif defined(_WIN32)\n  return isfinite (num);\n#else /* !(defined(__GNUC__) || defined(__clang__) || defined(_WIN32)) */\n  return !ecma_number_is_nan (num) && !ecma_number_is_infinity (num);\n#endif /* defined (__GNUC__) || defined (__clang__) */\n} /* ecma_number_is_finite */\n\n/**\n * Get previous representable ecma-number\n *\n * @return maximum ecma-number that is less compared to passed argument\n */\necma_number_t JERRY_ATTR_CONST\necma_number_get_prev (ecma_number_t num) /**< ecma-number */\n{\n#if defined(__GNUC__) || defined(__clang__)\n  return __builtin_nextafter (num, -INFINITY);\n#else /* !defined (__GNUC__) && !defined (__clang__) */\n  JERRY_ASSERT (!ecma_number_is_nan (num));\n  ecma_binary_num_t binary = ecma_number_to_binary (num);\n\n  /* If -Infinity, return self */\n  if (binary == (ECMA_NUMBER_SIGN_BIT | ECMA_NUMBER_BINARY_INF))\n  {\n    return num;\n  }\n\n  /* If +0.0, return -0.0 */\n  if (binary == ECMA_NUMBER_BINARY_ZERO)\n  {\n    return -num;\n  }\n\n  if (ecma_number_sign (binary))\n  {\n    return ecma_number_from_binary (binary + 1);\n  }\n\n  return ecma_number_from_binary (binary - 1);\n#endif /* !defined (__GNUC__) && !defined (__clang__) */\n} /* ecma_number_get_prev */\n\n/**\n * Get next representable ecma-number\n *\n * @return minimum ecma-number that is greater compared to passed argument\n */\necma_number_t JERRY_ATTR_CONST\necma_number_get_next (ecma_number_t num) /**< ecma-number */\n{\n#if defined(__GNUC__) || defined(__clang__)\n  return __builtin_nextafter (num, INFINITY);\n#else /* !defined (__GNUC__) && !defined (__clang__) */\n  JERRY_ASSERT (!ecma_number_is_nan (num));\n  ecma_binary_num_t binary = ecma_number_to_binary (num);\n\n  /* If +Infinity, return self */\n  if (binary == ECMA_NUMBER_BINARY_INF)\n  {\n    return num;\n  }\n\n  /* If -0.0, return +0.0 */\n  if (binary == (ECMA_NUMBER_SIGN_BIT | ECMA_NUMBER_BINARY_ZERO))\n  {\n    return -num;\n  }\n\n  if (ecma_number_sign (binary))\n  {\n    return ecma_number_from_binary (binary - 1);\n  }\n\n  return ecma_number_from_binary (binary + 1);\n#endif /* !defined (__GNUC__) && !defined (__clang__) */\n} /* ecma_number_get_next */\n\n/**\n * Truncate fractional part of the number\n *\n * @return integer part of the number\n */\necma_number_t JERRY_ATTR_CONST\necma_number_trunc (ecma_number_t num) /**< ecma-number */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (num));\n\n  ecma_binary_num_t binary = ecma_number_to_binary (num);\n  uint32_t exponent = ecma_number_biased_exp (binary);\n\n  if (exponent < ECMA_NUMBER_EXPONENT_BIAS)\n  {\n    return ECMA_NUMBER_ZERO;\n  }\n\n  uint32_t unbiased_exp = exponent - ECMA_NUMBER_EXPONENT_BIAS;\n\n  if (unbiased_exp >= ECMA_NUMBER_FRACTION_WIDTH)\n  {\n    return num;\n  }\n\n  binary &= ~((1ull << (ECMA_NUMBER_FRACTION_WIDTH - unbiased_exp)) - 1);\n  return ecma_number_from_binary (binary);\n} /* ecma_number_trunc */\n\n/**\n * Calculate remainder of division of two numbers,\n * as specified in ECMA-262 v5, 11.5.3, item 6.\n *\n * Note:\n *      operands shouldn't contain NaN, Infinity, or zero.\n *\n * @return number - calculated remainder.\n */\necma_number_t JERRY_ATTR_CONST\necma_number_remainder (ecma_number_t left_num, /**< left operand */\n                       ecma_number_t right_num) /**< right operand */\n{\n  JERRY_ASSERT (ecma_number_is_finite (left_num) && !ecma_number_is_zero (left_num));\n  JERRY_ASSERT (ecma_number_is_finite (right_num) && !ecma_number_is_zero (right_num));\n\n  const ecma_number_t q = ecma_number_trunc (left_num / right_num);\n  ecma_number_t r = left_num - right_num * q;\n\n  if (ecma_number_is_zero (r) && ecma_number_is_negative (left_num))\n  {\n    r = -r;\n  }\n\n  return r;\n} /* ecma_number_remainder */\n\n/**\n * Compute power operation according to the ES standard.\n *\n * @return x ** y\n */\necma_number_t JERRY_ATTR_CONST\necma_number_pow (ecma_number_t x, /**< left operand */\n                 ecma_number_t y) /**< right operand */\n{\n  if (ecma_number_is_nan (y) || (ecma_number_is_infinity (y) && (x == ECMA_NUMBER_ONE || x == ECMA_NUMBER_MINUS_ONE)))\n  {\n    /* Handle differences between ES5.1 and ISO C standards for pow. */\n    return ecma_number_make_nan ();\n  }\n\n  if (ecma_number_is_zero (y))\n  {\n    /* Handle differences between ES5.1 and ISO C standards for pow. */\n    return ECMA_NUMBER_ONE;\n  }\n\n  return DOUBLE_TO_ECMA_NUMBER_T (pow (x, y));\n} /* ecma_number_pow */\n\n/**\n * ECMA-integer number multiplication.\n *\n * @return number - result of multiplication.\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_integer_multiply (ecma_integer_value_t left_integer, /**< left operand */\n                       ecma_integer_value_t right_integer) /**< right operand */\n{\n#if defined(__GNUC__) || defined(__clang__)\n  /* Check if either integer is power of 2 */\n  if (JERRY_UNLIKELY ((left_integer & (left_integer - 1)) == 0))\n  {\n    /* Right shift right_integer with log2 (left_integer) */\n    return ecma_make_integer_value (\n      (int32_t) ((uint32_t) right_integer << (__builtin_ctz ((unsigned int) left_integer))));\n  }\n\n  if (JERRY_UNLIKELY ((right_integer & (right_integer - 1)) == 0))\n  {\n    /* Right shift left_integer with log2 (right_integer) */\n    return ecma_make_integer_value (\n      (int32_t) ((uint32_t) left_integer << (__builtin_ctz ((unsigned int) right_integer))));\n  }\n#endif /* defined (__GNUC__) || defined (__clang__) */\n\n  return ecma_make_integer_value (left_integer * right_integer);\n} /* ecma_integer_multiply */\n\n/**\n * The Number object's 'parseInt' routine\n *\n * See also:\n *          ECMA-262 v5, 15.1.2.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_number_parse_int (const lit_utf8_byte_t *str_p, /**< routine's first argument's\n                                                      *   string buffer */\n                       lit_utf8_size_t str_size, /**< routine's first argument's\n                                                  *   string buffer's size */\n                       ecma_value_t radix_value) /**< routine's second argument */\n{\n  /* 2. Remove leading whitespace. */\n  ecma_string_trim_helper (&str_p, &str_size);\n\n  if (str_size == 0)\n  {\n    return ecma_make_nan_value ();\n  }\n\n  const lit_utf8_byte_t *str_end_p = str_p + str_size;\n\n  /* 3. */\n  bool sign = false;\n\n  /* 4. */\n  if (*str_p == LIT_CHAR_MINUS)\n  {\n    sign = true;\n    str_p++;\n  }\n  /* 5. */\n  else if (*str_p == LIT_CHAR_PLUS)\n  {\n    str_p++;\n  }\n\n  /* 6. */\n  ecma_number_t radix_num;\n  radix_value = ecma_op_to_number (radix_value, &radix_num);\n\n  if (ECMA_IS_VALUE_ERROR (radix_value))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  int32_t radix = ecma_number_to_int32 (radix_num);\n\n  /* 7.*/\n  bool strip_prefix = true;\n\n  /* 8. */\n  if (radix != 0)\n  {\n    /* 8.a */\n    if (radix < 2 || radix > 36)\n    {\n      return ecma_make_nan_value ();\n    }\n    /* 8.b */\n    else if (radix != 16)\n    {\n      strip_prefix = false;\n    }\n  }\n  /* 9. */\n  else\n  {\n    radix = 10;\n  }\n\n  /* 10. */\n  if (strip_prefix && ((str_end_p - str_p) >= 2) && (str_p[0] == LIT_CHAR_0)\n      && (LEXER_TO_ASCII_LOWERCASE (str_p[1]) == LIT_CHAR_LOWERCASE_X))\n  {\n    str_p += 2;\n    radix = 16;\n  }\n\n  ecma_number_t value = ECMA_NUMBER_ZERO;\n  const lit_utf8_byte_t *digit_start_p = str_p;\n\n  /* 11. Check if characters are in [0, Radix - 1]. We also convert them to number values in the process. */\n  while (str_p < str_end_p)\n  {\n    ecma_char_t ch = *str_p;\n\n    int32_t digit = 0;\n\n    if (lit_char_is_decimal_digit (ch))\n    {\n      digit = ch - LIT_CHAR_0;\n    }\n    else if (LEXER_TO_ASCII_LOWERCASE (ch) >= LIT_CHAR_LOWERCASE_A\n             && LEXER_TO_ASCII_LOWERCASE (ch) <= LIT_CHAR_LOWERCASE_Z)\n    {\n      digit = LEXER_TO_ASCII_LOWERCASE (ch) - LIT_CHAR_LOWERCASE_A + 10;\n    }\n    else\n    {\n      /* Not a valid digit char, set to invalid value */\n      digit = radix;\n    }\n\n    if (digit >= radix)\n    {\n      break;\n    }\n\n    value *= radix;\n    value += digit;\n\n    str_p++;\n  }\n\n  /* 12. */\n  if (str_p == digit_start_p)\n  {\n    return ecma_make_nan_value ();\n  }\n\n  /* 15. */\n  if (sign)\n  {\n    value *= ECMA_NUMBER_MINUS_ONE;\n  }\n\n  return ecma_make_number_value (value);\n} /* ecma_number_parse_int */\n\n/**\n * The Number object's 'parseFloat' routine\n *\n * See also:\n *          ECMA-262 v5, 15.1.2.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_number_parse_float (const lit_utf8_byte_t *str_p, /**< routine's first argument's\n                                                        *   string buffer */\n                         lit_utf8_size_t str_size) /**< routine's first argument's\n                                                    *   string buffer's size */\n{\n  /* 2. Remove leading whitespace. */\n  ecma_string_trim_helper (&str_p, &str_size);\n\n  const lit_utf8_byte_t *str_end_p = str_p + str_size;\n  bool sign = false;\n\n  if (str_size == 0)\n  {\n    return ecma_make_nan_value ();\n  }\n\n  if (*str_p == LIT_CHAR_PLUS)\n  {\n    str_p++;\n  }\n  else if (*str_p == LIT_CHAR_MINUS)\n  {\n    sign = true;\n    str_p++;\n  }\n\n  /* Check if string is equal to \"Infinity\". */\n  const lit_utf8_byte_t *infinity_str_p = lit_get_magic_string_utf8 (LIT_MAGIC_STRING_INFINITY_UL);\n  const lit_utf8_size_t infinity_length = lit_get_magic_string_size (LIT_MAGIC_STRING_INFINITY_UL);\n\n  /* The input string should be at least the length of \"Infinity\" to be correctly processed as\n   * the infinity value.\n   */\n  if ((lit_utf8_size_t) (str_end_p - str_p) >= infinity_length && memcmp (infinity_str_p, str_p, infinity_length) == 0)\n  {\n    return ecma_make_number_value (ecma_number_make_infinity (sign));\n  }\n\n  const lit_utf8_byte_t *num_start_p = str_p;\n  const lit_utf8_byte_t *num_end_p = str_p;\n\n  while (str_p < str_end_p && lit_char_is_decimal_digit (*str_p))\n  {\n    str_p++;\n  }\n\n  if (str_p < str_end_p && *str_p == LIT_CHAR_DOT)\n  {\n    str_p++;\n\n    while (str_p < str_end_p && lit_char_is_decimal_digit (*str_p))\n    {\n      str_p++;\n    }\n  }\n\n  num_end_p = str_p;\n\n  if (str_p < str_end_p && LEXER_TO_ASCII_LOWERCASE (*str_p) == LIT_CHAR_LOWERCASE_E)\n  {\n    str_p++;\n\n    if (str_p < str_end_p && (*str_p == LIT_CHAR_PLUS || *str_p == LIT_CHAR_MINUS))\n    {\n      str_p++;\n    }\n\n    if (str_p < str_end_p && lit_char_is_decimal_digit (*str_p))\n    {\n      str_p++;\n\n      while (str_p < str_end_p && lit_char_is_decimal_digit (*str_p))\n      {\n        str_p++;\n      }\n\n      num_end_p = str_p;\n    }\n  }\n\n  lit_utf8_size_t num_size = (lit_utf8_size_t) (num_end_p - num_start_p);\n\n  if (num_size == 0)\n  {\n    return ecma_make_nan_value ();\n  }\n\n  /* 5. */\n  ecma_number_t ret_num = ecma_utf8_string_to_number (num_start_p, num_size, 0);\n\n  if (sign)\n  {\n    ret_num *= ECMA_NUMBER_MINUS_ONE;\n  }\n\n  return ecma_make_number_value (ret_num);\n} /* ecma_number_parse_float */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-helpers-number.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_HELPERS_NUMBER_H\n#define ECMA_HELPERS_NUMBER_H\n\n#include \"ecma-globals.h\"\n\n#include \"config.h\"\n\n/**\n * Binary representation of an ecma-number\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\ntypedef uint64_t ecma_binary_num_t;\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\ntypedef uint32_t ecma_binary_num_t;\n#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Makes it possible to read/write the binary representation of an ecma_number_t\n * without strict aliasing rule violation.\n */\ntypedef union\n{\n  ecma_number_t as_number; /**< ecma-number */\n  ecma_binary_num_t as_binary; /**< binary representation */\n} ecma_number_accessor_t;\n\necma_binary_num_t ecma_number_to_binary (ecma_number_t number);\necma_number_t ecma_number_from_binary (ecma_binary_num_t binary);\n\nbool ecma_number_sign (ecma_binary_num_t binary);\nuint32_t ecma_number_biased_exp (ecma_binary_num_t binary);\nuint64_t ecma_number_fraction (ecma_binary_num_t binary);\necma_number_t ecma_number_create (bool sign, uint32_t biased_exp, uint64_t fraction);\n\n/**\n * Maximum number of significant decimal digits that an ecma-number can store\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_MAX_DIGITS (19)\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_MAX_DIGITS (9)\n#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Width of sign field\n *\n * See also:\n *          IEEE-754 2008, 3.6, Table 3.5\n */\n#define ECMA_NUMBER_SIGN_WIDTH (1)\n\n/**\n * Width of biased exponent field\n *\n * See also:\n *          IEEE-754 2008, 3.6, Table 3.5\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_BIASED_EXP_WIDTH (11)\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_BIASED_EXP_WIDTH (8)\n#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Exponent bias\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_EXPONENT_BIAS (1023)\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_EXPONENT_BIAS (127)\n#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Width of fraction field\n *\n * See also:\n *          IEEE-754 2008, 3.6, Table 3.5\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_FRACTION_WIDTH (52)\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_FRACTION_WIDTH (23)\n#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Sign bit in ecma-numbers\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_SIGN_BIT 0x8000000000000000ull\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_SIGN_BIT 0x7f800000u;\n#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Binary representation of an IEEE-754 QNaN value.\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_BINARY_QNAN 0x7ff8000000000000ull\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_BINARY_QNAN 0x7fc00000u\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Binary representation of an IEEE-754 Infinity value.\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_BINARY_INF 0x7ff0000000000000ull\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_BINARY_INF 0x7f800000u\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Binary representation of an IEEE-754 zero value.\n */\n#define ECMA_NUMBER_BINARY_ZERO 0x0ull\n\n/**\n * Number.MIN_VALUE (i.e., the smallest positive value of ecma-number)\n *\n * See also: ECMA_262 v5, 15.7.3.3\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_MIN_VALUE ((ecma_number_t) 5e-324)\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_MIN_VALUE (FLT_MIN)\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Number.MAX_VALUE (i.e., the maximum value of ecma-number)\n *\n * See also: ECMA_262 v5, 15.7.3.2\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_MAX_VALUE ((ecma_number_t) 1.7976931348623157e+308)\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_MAX_VALUE (FLT_MAX)\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Number.EPSILON\n *\n * See also: ECMA_262 v6, 20.1.2.1\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_EPSILON ((ecma_number_t) 2.2204460492503130808472633361816e-16)\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_EPSILON ((ecma_number_t) 1.1920928955078125e-7)\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Number.MAX_SAFE_INTEGER\n *\n * See also: ECMA_262 v6, 20.1.2.6\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0x1FFFFFFFFFFFFF)\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0xFFFFFF)\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Number.MIN_SAFE_INTEGER\n *\n * See also: ECMA_262 v6, 20.1.2.8\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0x1FFFFFFFFFFFFF)\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0xFFFFFF)\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Number.MAX_VALUE exponent part\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define NUMBER_MAX_DECIMAL_EXPONENT 308\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define NUMBER_MAX_DECIMAL_EXPONENT 38\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Number.MIN_VALUE exponent part\n */\n#if JERRY_NUMBER_TYPE_FLOAT64\n#define NUMBER_MIN_DECIMAL_EXPONENT -324\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n#define NUMBER_MIN_DECIMAL_EXPONENT -45\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Euler number\n */\n#define ECMA_NUMBER_E ((ecma_number_t) 2.7182818284590452354)\n\n/**\n * Natural logarithm of 10\n */\n#define ECMA_NUMBER_LN10 ((ecma_number_t) 2.302585092994046)\n\n/**\n * Natural logarithm of 2\n */\n#define ECMA_NUMBER_LN2 ((ecma_number_t) 0.6931471805599453)\n\n/**\n * Logarithm base 2 of the Euler number\n */\n#define ECMA_NUMBER_LOG2E ((ecma_number_t) 1.4426950408889634)\n\n/**\n * Logarithm base 10 of the Euler number\n */\n#define ECMA_NUMBER_LOG10E ((ecma_number_t) 0.4342944819032518)\n\n/**\n * Pi number\n */\n#define ECMA_NUMBER_PI ((ecma_number_t) 3.1415926535897932)\n\n/**\n * Square root of 0.5\n */\n#define ECMA_NUMBER_SQRT_1_2 ((ecma_number_t) 0.7071067811865476)\n\n/**\n * Square root of 2\n */\n#define ECMA_NUMBER_SQRT2 ((ecma_number_t) 1.4142135623730951)\n\n#endif /* !ECMA_HELPERS_NUMBER_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-helpers-string.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n\n#include \"jcontext.h\"\n#include \"jrt-libc-includes.h\"\n#include \"jrt.h\"\n#include \"lit-char-helpers.h\"\n#include \"lit-magic-strings.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmahelpers Helpers for operations with ECMA data types\n * @{\n */\n\nJERRY_STATIC_ASSERT (ECMA_STRING_CONTAINER_MASK >= ECMA_STRING_CONTAINER__MAX,\n                     ecma_string_container_types_must_be_lower_than_the_container_mask);\n\nJERRY_STATIC_ASSERT ((ECMA_STRING_MAX_REF | ECMA_STRING_CONTAINER_MASK | ECMA_STATIC_STRING_FLAG) == UINT32_MAX,\n                     ecma_string_ref_and_container_fields_should_fill_the_32_bit_field);\n\nJERRY_STATIC_ASSERT (ECMA_STRING_NOT_ARRAY_INDEX == UINT32_MAX,\n                     ecma_string_not_array_index_must_be_equal_to_uint32_max);\n\nJERRY_STATIC_ASSERT ((ECMA_TYPE_DIRECT_STRING & 0x1) != 0, ecma_type_direct_string_must_be_odd_number);\n\nJERRY_STATIC_ASSERT (LIT_MAGIC_STRING__COUNT <= ECMA_DIRECT_STRING_MAX_IMM,\n                     all_magic_strings_must_be_encoded_as_direct_string);\n\nJERRY_STATIC_ASSERT ((int) ECMA_DIRECT_STRING_UINT == (int) ECMA_STRING_CONTAINER_UINT32_IN_DESC,\n                     ecma_direct_and_container_types_must_match);\n\nJERRY_STATIC_ASSERT (ECMA_PROPERTY_NAME_TYPE_SHIFT > ECMA_VALUE_SHIFT,\n                     ecma_property_name_type_shift_must_be_greater_than_ecma_value_shift);\n\nJERRY_STATIC_ASSERT (sizeof (ecma_stringbuilder_header_t) <= ECMA_ASCII_STRING_HEADER_SIZE,\n                     ecma_stringbuilder_header_must_not_be_larger_than_ecma_ascii_string);\n\n/**\n * Convert a string to an unsigned 32 bit value if possible\n *\n * @return true if the conversion is successful\n *         false otherwise\n */\nstatic bool\necma_string_to_array_index (const lit_utf8_byte_t *string_p, /**< utf-8 string */\n                            lit_utf8_size_t string_size, /**< string size */\n                            uint32_t *result_p) /**< [out] converted value */\n{\n  JERRY_ASSERT (string_size > 0 && *string_p >= LIT_CHAR_0 && *string_p <= LIT_CHAR_9);\n\n  if (*string_p == LIT_CHAR_0)\n  {\n    *result_p = 0;\n    return (string_size == 1);\n  }\n\n  if (string_size > ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32)\n  {\n    return false;\n  }\n\n  uint32_t index = 0;\n  const lit_utf8_byte_t *string_end_p = string_p + string_size;\n\n  if (string_size == ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32)\n  {\n    string_end_p--;\n  }\n\n  do\n  {\n    if (*string_p > LIT_CHAR_9 || *string_p < LIT_CHAR_0)\n    {\n      return false;\n    }\n\n    index = (index * 10) + (uint32_t) (*string_p++ - LIT_CHAR_0);\n  } while (string_p < string_end_p);\n\n  if (string_size < ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32)\n  {\n    *result_p = index;\n    return true;\n  }\n\n  /* Overflow must be checked as well when size is\n   * equal to ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32. */\n  if (*string_p > LIT_CHAR_9 || *string_p < LIT_CHAR_0 || index > (UINT32_MAX / 10)\n      || (index == (UINT32_MAX / 10) && *string_p > LIT_CHAR_5))\n  {\n    return false;\n  }\n\n  *result_p = (index * 10) + (uint32_t) (*string_p - LIT_CHAR_0);\n  return true;\n} /* ecma_string_to_array_index */\n\n/**\n * Returns the characters and size of a string.\n *\n * Note:\n *   UINT type is not supported\n *\n * @return byte array start - if the byte array of a string is available\n *         NULL - otherwise\n */\nstatic const lit_utf8_byte_t *\necma_string_get_chars_fast (const ecma_string_t *string_p, /**< ecma-string */\n                            lit_utf8_size_t *size_p) /**< [out] size of the ecma string */\n{\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    if (ECMA_GET_DIRECT_STRING_TYPE (string_p) == ECMA_DIRECT_STRING_MAGIC)\n    {\n      uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p);\n\n      if (id >= LIT_MAGIC_STRING__COUNT)\n      {\n        id -= LIT_MAGIC_STRING__COUNT;\n\n        *size_p = lit_get_magic_string_ex_size (id);\n        return lit_get_magic_string_ex_utf8 (id);\n      }\n\n      *size_p = lit_get_magic_string_size (id);\n      return lit_get_magic_string_utf8 (id);\n    }\n  }\n\n  JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);\n\n  switch (ECMA_STRING_GET_CONTAINER (string_p))\n  {\n    case ECMA_STRING_CONTAINER_HEAP_UTF8_STRING:\n    {\n      *size_p = ((ecma_short_string_t *) string_p)->size;\n      return ECMA_SHORT_STRING_GET_BUFFER (string_p);\n    }\n    case ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING:\n    {\n      ecma_long_string_t *long_string_p = (ecma_long_string_t *) string_p;\n      *size_p = long_string_p->size;\n      return long_string_p->string_p;\n    }\n    case ECMA_STRING_CONTAINER_HEAP_ASCII_STRING:\n    {\n      *size_p = ECMA_ASCII_STRING_GET_SIZE (string_p);\n      return ECMA_ASCII_STRING_GET_BUFFER (string_p);\n    }\n    default:\n    {\n      JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX);\n\n      lit_magic_string_ex_id_t id = LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id;\n      *size_p = lit_get_magic_string_ex_size (id);\n      return lit_get_magic_string_ex_utf8 (id);\n    }\n  }\n} /* ecma_string_get_chars_fast */\n\n/**\n * Allocate new ecma-string and fill it with reference to ECMA magic string\n *\n * @return pointer to ecma-string descriptor\n */\nstatic ecma_string_t *\necma_new_ecma_string_from_magic_string_ex_id (lit_magic_string_ex_id_t id) /**< identifier of externl magic string */\n{\n  JERRY_ASSERT (id < lit_get_magic_string_ex_count ());\n\n  uintptr_t string_id = (uintptr_t) (id + LIT_MAGIC_STRING__COUNT);\n\n  if (JERRY_LIKELY (string_id <= ECMA_DIRECT_STRING_MAX_IMM))\n  {\n    return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_MAGIC, string_id);\n  }\n\n  ecma_string_t *string_desc_p = ecma_alloc_string ();\n\n  string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_MAGIC_STRING_EX | ECMA_STRING_REF_ONE;\n  string_desc_p->u.magic_string_ex_id = id + LIT_MAGIC_STRING__COUNT;\n\n  return string_desc_p;\n} /* ecma_new_ecma_string_from_magic_string_ex_id */\n\n/**\n * Allocate new ecma-string and fill it with reference to the symbol descriptor\n *\n * Note:\n *     Takes the reference to the string_desc\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_new_symbol_from_descriptor_string (ecma_value_t string_desc) /**< ecma-string */\n{\n  JERRY_ASSERT (!ecma_is_value_symbol (string_desc));\n\n  ecma_extended_string_t *symbol_p = ecma_alloc_extended_string ();\n  symbol_p->header.refs_and_container = ECMA_STRING_REF_ONE | ECMA_STRING_CONTAINER_SYMBOL;\n  symbol_p->u.symbol_descriptor = string_desc;\n  symbol_p->header.u.hash = (lit_string_hash_t) (((uintptr_t) symbol_p) & (uintptr_t) ~ECMA_SYMBOL_FLAGS_MASK);\n\n  return (ecma_string_t *) symbol_p;\n} /* ecma_new_symbol_from_descriptor_string */\n\n/**\n * Check whether an ecma-string contains an ecma-symbol\n *\n * @return true - if the ecma-string contains an ecma-symbol\n *         false - otherwise\n */\nbool\necma_prop_name_is_symbol (ecma_string_t *string_p) /**< ecma-string */\n{\n  JERRY_ASSERT (string_p != NULL);\n\n  return (!ECMA_IS_DIRECT_STRING (string_p) && ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_SYMBOL);\n} /* ecma_prop_name_is_symbol */\n\n/**\n * Allocate new UTF8 ecma-string and fill it with characters from the given utf8 buffer\n *\n * @return pointer to ecma-string descriptor\n */\nstatic inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE\necma_new_ecma_string_from_utf8_buffer (lit_utf8_size_t length, /**< length of the buffer */\n                                       lit_utf8_size_t size, /**< size of the buffer */\n                                       lit_utf8_byte_t **data_p) /**< [out] pointer to the start of the string buffer */\n{\n  if (JERRY_LIKELY (size <= UINT16_MAX))\n  {\n    if (JERRY_LIKELY (length == size) && size <= (UINT8_MAX + 1))\n    {\n      ecma_string_t *string_desc_p;\n      string_desc_p = (ecma_string_t *) ecma_alloc_string_buffer (size + ECMA_ASCII_STRING_HEADER_SIZE);\n      string_desc_p->refs_and_container = ECMA_STRING_CONTAINER_HEAP_ASCII_STRING | ECMA_STRING_REF_ONE;\n      ECMA_ASCII_STRING_SET_SIZE (string_desc_p, size);\n\n      *data_p = ECMA_ASCII_STRING_GET_BUFFER (string_desc_p);\n      return (ecma_string_t *) string_desc_p;\n    }\n\n    ecma_short_string_t *string_desc_p;\n    string_desc_p = (ecma_short_string_t *) ecma_alloc_string_buffer (size + sizeof (ecma_short_string_t));\n    string_desc_p->header.refs_and_container = ECMA_STRING_CONTAINER_HEAP_UTF8_STRING | ECMA_STRING_REF_ONE;\n    string_desc_p->size = (uint16_t) size;\n    string_desc_p->length = (uint16_t) length;\n\n    *data_p = ECMA_SHORT_STRING_GET_BUFFER (string_desc_p);\n    return (ecma_string_t *) string_desc_p;\n  }\n\n  ecma_long_string_t *long_string_p;\n  long_string_p = (ecma_long_string_t *) ecma_alloc_string_buffer (size + sizeof (ecma_long_string_t));\n  long_string_p->header.refs_and_container = ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING | ECMA_STRING_REF_ONE;\n  long_string_p->string_p = ECMA_LONG_STRING_BUFFER_START (long_string_p);\n  long_string_p->size = size;\n  long_string_p->length = length;\n\n  *data_p = ECMA_LONG_STRING_BUFFER_START (long_string_p);\n  return (ecma_string_t *) long_string_p;\n} /* ecma_new_ecma_string_from_utf8_buffer */\n\n/**\n * Checks whether a string has a special representation, that is, the string is either a magic string,\n * an external magic string, or an uint32 number, and creates an ecma string using the special representation,\n * if available.\n *\n * @return pointer to ecma string with the special representation\n *         NULL, if there is no special representation for the string\n */\nstatic ecma_string_t *\necma_find_special_string (const lit_utf8_byte_t *string_p, /**< utf8 string */\n                          lit_utf8_size_t string_size) /**< string size */\n{\n  JERRY_ASSERT (string_p != NULL || string_size == 0);\n  lit_magic_string_id_t magic_string_id = lit_is_utf8_string_magic (string_p, string_size);\n\n  if (magic_string_id != LIT_MAGIC_STRING__COUNT)\n  {\n    return ecma_get_magic_string (magic_string_id);\n  }\n\n  JERRY_ASSERT (string_size > 0);\n\n  if (*string_p >= LIT_CHAR_0 && *string_p <= LIT_CHAR_9)\n  {\n    uint32_t array_index;\n\n    if (ecma_string_to_array_index (string_p, string_size, &array_index))\n    {\n      return ecma_new_ecma_string_from_uint32 (array_index);\n    }\n  }\n\n  if (lit_get_magic_string_ex_count () > 0)\n  {\n    lit_magic_string_ex_id_t magic_string_ex_id = lit_is_ex_utf8_string_magic (string_p, string_size);\n\n    if (magic_string_ex_id < lit_get_magic_string_ex_count ())\n    {\n      return ecma_new_ecma_string_from_magic_string_ex_id (magic_string_ex_id);\n    }\n  }\n\n  return NULL;\n} /* ecma_find_special_string */\n\n/**\n * Allocate new ecma-string and fill it with characters from ascii characters\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_new_ecma_string_from_ascii (const lit_utf8_byte_t *string_p, /**< ascii string */\n                                 lit_utf8_size_t string_size) /**< string size */\n{\n  JERRY_ASSERT (string_p != NULL || string_size == 0);\n\n  ecma_string_t *string_desc_p = ecma_find_special_string (string_p, string_size);\n\n  if (string_desc_p != NULL)\n  {\n    return string_desc_p;\n  }\n\n  lit_utf8_byte_t *data_p;\n  string_desc_p = ecma_new_ecma_string_from_utf8_buffer (string_size, string_size, &data_p);\n\n  string_desc_p->u.hash = lit_utf8_string_calc_hash (string_p, string_size);\n  memcpy (data_p, string_p, string_size);\n\n  return string_desc_p;\n} /* ecma_new_ecma_string_from_ascii */\n\n/**\n * Allocate new ecma-string and fill it with characters from the utf8 string\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, /**< utf-8 string */\n                                lit_utf8_size_t string_size) /**< string size */\n{\n  JERRY_ASSERT (string_p != NULL || string_size == 0);\n  JERRY_ASSERT (lit_is_valid_cesu8_string (string_p, string_size));\n\n  ecma_string_t *string_desc_p = ecma_find_special_string (string_p, string_size);\n\n  if (string_desc_p != NULL)\n  {\n    return string_desc_p;\n  }\n\n  lit_utf8_byte_t *data_p;\n  string_desc_p =\n    ecma_new_ecma_string_from_utf8_buffer (lit_utf8_string_length (string_p, string_size), string_size, &data_p);\n\n  string_desc_p->u.hash = lit_utf8_string_calc_hash (string_p, string_size);\n  memcpy (data_p, string_p, string_size);\n\n  return string_desc_p;\n} /* ecma_new_ecma_string_from_utf8 */\n\n/**\n * Allocate a new ecma-string and initialize it from the utf8 string argument.\n * All 4-bytes long unicode sequences are converted into two 3-bytes long sequences.\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string_p, /**< utf-8 string */\n                                                   lit_utf8_size_t string_size) /**< utf-8 string size */\n{\n  JERRY_ASSERT (string_p != NULL || string_size == 0);\n\n  lit_utf8_size_t converted_string_length = 0;\n  lit_utf8_size_t converted_string_size = 0;\n  lit_utf8_size_t pos = 0;\n\n  /* Calculate the required length and size information of the converted cesu-8 encoded string */\n  while (pos < string_size)\n  {\n    if ((string_p[pos] & LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER)\n    {\n      pos++;\n    }\n    else if ((string_p[pos] & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER)\n    {\n      pos += 2;\n    }\n    else if ((string_p[pos] & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER)\n    {\n      pos += 3;\n    }\n    else\n    {\n      JERRY_ASSERT ((string_p[pos] & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER);\n      pos += 4;\n      converted_string_size += 2;\n      converted_string_length++;\n    }\n\n    converted_string_length++;\n  }\n\n  JERRY_ASSERT (pos == string_size);\n\n  if (converted_string_size == 0)\n  {\n    return ecma_new_ecma_string_from_utf8 (string_p, string_size);\n  }\n\n  converted_string_size += string_size;\n\n  JERRY_ASSERT (lit_is_valid_utf8_string (string_p, string_size, false));\n\n  lit_utf8_byte_t *data_p;\n  ecma_string_t *string_desc_p =\n    ecma_new_ecma_string_from_utf8_buffer (converted_string_length, converted_string_size, &data_p);\n\n  const lit_utf8_byte_t *const begin_data_p = data_p;\n  pos = 0;\n\n  while (pos < string_size)\n  {\n    if ((string_p[pos] & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER)\n    {\n      /* Processing 4 byte unicode sequence. Always converted to two 3 byte long sequence. */\n      lit_four_byte_utf8_char_to_cesu8 (data_p, string_p + pos);\n      data_p += 3 * 2;\n      pos += 4;\n    }\n    else\n    {\n      *data_p++ = string_p[pos++];\n    }\n  }\n\n  JERRY_ASSERT (pos == string_size);\n\n  string_desc_p->u.hash = lit_utf8_string_calc_hash (begin_data_p, converted_string_size);\n\n  return (ecma_string_t *) string_desc_p;\n} /* ecma_new_ecma_string_from_utf8_converted_to_cesu8 */\n\n/**\n * Allocate new ecma-external-string and fill it with characters from the cesu8 string\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_new_ecma_external_string_from_cesu8 (const lit_utf8_byte_t *string_p, /**< cesu-8 string */\n                                          lit_utf8_size_t string_size, /**< string size */\n                                          void *user_p) /**< user pointer passed to the callback\n                                                         *   when the string is freed */\n{\n  JERRY_ASSERT (string_p != NULL || string_size == 0);\n  JERRY_ASSERT (lit_is_valid_cesu8_string (string_p, string_size));\n\n  if (string_size < (sizeof (ecma_external_string_t) - sizeof (ecma_short_string_t)))\n  {\n    /* Normal strings are created for short strings. */\n    ecma_string_t *string_desc_p = ecma_new_ecma_string_from_utf8 (string_p, string_size);\n\n    jerry_external_string_free_cb_t free_cb = JERRY_CONTEXT (external_string_free_callback_p);\n\n    if (free_cb != NULL)\n    {\n      free_cb ((lit_utf8_byte_t *) string_p, string_size, user_p);\n    }\n    return string_desc_p;\n  }\n\n  ecma_string_t *string_desc_p = ecma_find_special_string (string_p, string_size);\n\n  if (string_desc_p != NULL)\n  {\n    jerry_external_string_free_cb_t free_cb = JERRY_CONTEXT (external_string_free_callback_p);\n\n    if (free_cb != NULL)\n    {\n      free_cb ((lit_utf8_byte_t *) string_p, string_size, user_p);\n    }\n    return string_desc_p;\n  }\n\n  ecma_external_string_t *external_string_p = ecma_alloc_external_string ();\n  ecma_long_string_t *long_string_p = (ecma_long_string_t *) external_string_p;\n\n  long_string_p->header.refs_and_container = ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING | ECMA_STRING_REF_ONE;\n  long_string_p->header.u.hash = lit_utf8_string_calc_hash (string_p, string_size);\n  long_string_p->string_p = string_p;\n  long_string_p->size = string_size;\n  long_string_p->length = lit_utf8_string_length (string_p, string_size);\n  external_string_p->user_p = user_p;\n\n  return (ecma_string_t *) external_string_p;\n} /* ecma_new_ecma_external_string_from_cesu8 */\n\n/**\n * Allocate new ecma-string and fill it with cesu-8 character which represents specified code unit\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_new_ecma_string_from_code_unit (ecma_char_t code_unit) /**< code unit */\n{\n  lit_utf8_byte_t lit_utf8_bytes[LIT_UTF8_MAX_BYTES_IN_CODE_UNIT];\n  lit_utf8_size_t bytes_size = lit_code_unit_to_utf8 (code_unit, lit_utf8_bytes);\n\n  return ecma_new_ecma_string_from_utf8 (lit_utf8_bytes, bytes_size);\n} /* ecma_new_ecma_string_from_code_unit */\n\n/**\n * Allocate new ecma-string and fill it with cesu-8 character which represents specified code units\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_new_ecma_string_from_code_units (ecma_char_t first_code_unit, /**< code unit */\n                                      ecma_char_t second_code_unit) /**< code unit */\n{\n  lit_utf8_byte_t lit_utf8_bytes[2 * LIT_UTF8_MAX_BYTES_IN_CODE_UNIT];\n  lit_utf8_size_t bytes_size = lit_code_unit_to_utf8 (first_code_unit, lit_utf8_bytes);\n  bytes_size += lit_code_unit_to_utf8 (second_code_unit, lit_utf8_bytes + bytes_size);\n\n  return ecma_new_ecma_string_from_utf8 (lit_utf8_bytes, bytes_size);\n} /* ecma_new_ecma_string_from_code_units */\n\n/**\n * Allocate new ecma-string and fill it with ecma-number\n *\n * Note: the number cannot be represented as direct string\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_new_non_direct_string_from_uint32 (uint32_t uint32_number) /**< uint32 value of the string */\n{\n  JERRY_ASSERT (uint32_number > ECMA_DIRECT_STRING_MAX_IMM);\n\n  ecma_string_t *string_p = ecma_alloc_string ();\n\n  string_p->refs_and_container = ECMA_STRING_CONTAINER_UINT32_IN_DESC | ECMA_STRING_REF_ONE;\n  string_p->u.uint32_number = uint32_number;\n\n  return string_p;\n} /* ecma_new_non_direct_string_from_uint32 */\n\n/**\n * Allocate new ecma-string and fill it with property length number\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_new_ecma_string_from_length (ecma_length_t number) /**< property length */\n{\n  if (JERRY_LIKELY (number <= ECMA_DIRECT_STRING_MAX_IMM))\n  {\n    return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_UINT, (uintptr_t) number);\n  }\n\n  JERRY_ASSERT ((ecma_number_t) number <= ECMA_NUMBER_MAX_SAFE_INTEGER);\n\n  if (JERRY_UNLIKELY (number > UINT32_MAX))\n  {\n    return ecma_new_ecma_string_from_number ((ecma_number_t) number);\n  }\n\n  return ecma_new_non_direct_string_from_uint32 ((uint32_t) number);\n} /* ecma_new_ecma_string_from_length */\n\n/**\n * Allocate new ecma-string and fill it with uint32 number\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_new_ecma_string_from_uint32 (uint32_t uint32_number) /**< uint32 value of the string */\n{\n  if (JERRY_LIKELY (uint32_number <= ECMA_DIRECT_STRING_MAX_IMM))\n  {\n    return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_UINT, (uintptr_t) uint32_number);\n  }\n\n  return ecma_new_non_direct_string_from_uint32 (uint32_number);\n} /* ecma_new_ecma_string_from_uint32 */\n\n/**\n * Returns the constant assigned to the uint32 number.\n *\n * Note:\n *   Calling ecma_deref_ecma_string on the returned pointer is optional.\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_get_ecma_string_from_uint32 (uint32_t uint32_number) /**< input number */\n{\n  JERRY_ASSERT (uint32_number <= ECMA_DIRECT_STRING_MAX_IMM);\n\n  return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_UINT, (uintptr_t) uint32_number);\n} /* ecma_get_ecma_string_from_uint32 */\n\n/**\n * Allocate new ecma-string and fill it with ecma-number\n *\n * @return pointer to ecma-string descriptor\n */\necma_string_t *\necma_new_ecma_string_from_number (ecma_number_t num) /**< ecma-number */\n{\n  uint32_t uint32_num = ecma_number_to_uint32 (num);\n  if (num == ((ecma_number_t) uint32_num))\n  {\n    return ecma_new_ecma_string_from_uint32 (uint32_num);\n  }\n\n  if (ecma_number_is_nan (num))\n  {\n    return ecma_get_magic_string (LIT_MAGIC_STRING_NAN);\n  }\n\n  if (ecma_number_is_infinity (num))\n  {\n    lit_magic_string_id_t id =\n      (ecma_number_is_negative (num) ? LIT_MAGIC_STRING_NEGATIVE_INFINITY_UL : LIT_MAGIC_STRING_INFINITY_UL);\n    return ecma_get_magic_string (id);\n  }\n\n  lit_utf8_byte_t str_buf[ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER];\n  lit_utf8_size_t str_size = ecma_number_to_utf8_string (num, str_buf, sizeof (str_buf));\n\n  JERRY_ASSERT (str_size > 0);\n#ifndef JERRY_NDEBUG\n  JERRY_ASSERT (lit_is_utf8_string_magic (str_buf, str_size) == LIT_MAGIC_STRING__COUNT\n                && lit_is_ex_utf8_string_magic (str_buf, str_size) == lit_get_magic_string_ex_count ());\n#endif /* !JERRY_NDEBUG */\n\n  lit_utf8_byte_t *data_p;\n  ecma_string_t *string_desc_p =\n    ecma_new_ecma_string_from_utf8_buffer (lit_utf8_string_length (str_buf, str_size), str_size, &data_p);\n\n  string_desc_p->u.hash = lit_utf8_string_calc_hash (str_buf, str_size);\n  memcpy (data_p, str_buf, str_size);\n\n  return string_desc_p;\n} /* ecma_new_ecma_string_from_number */\n\n/**\n * Returns the constant assigned to the magic string id.\n *\n * Note:\n *   Calling ecma_deref_ecma_string on the returned pointer is optional.\n *\n * @return pointer to ecma-string descriptor\n */\nextern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE\necma_get_magic_string (lit_magic_string_id_t id) /**< identifier of magic string */\n{\n  JERRY_ASSERT (id < LIT_MAGIC_STRING__COUNT);\n  return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_MAGIC, (uintptr_t) id);\n} /* ecma_get_magic_string */\n\n/**\n * Returns the constant assigned to the internal magic string id.\n *\n * Note:\n *   Calling ecma_deref_ecma_string on the returned pointer is optional.\n *\n * @return pointer to ecma-string descriptor\n */\nextern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE\necma_get_internal_string (lit_magic_string_id_t id) /**< identifier of magic string */\n{\n  JERRY_ASSERT (id >= LIT_NON_INTERNAL_MAGIC_STRING__COUNT && id < LIT_MAGIC_STRING__COUNT);\n  return (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_SPECIAL, (uintptr_t) id);\n} /* ecma_get_internal_string */\n\n/**\n * Append a cesu8 string after an ecma-string\n *\n * Note:\n *   The string1_p argument is freed. If it needs to be preserved,\n *   call ecma_ref_ecma_string with string1_p before the call.\n *\n * @return concatenation of an ecma-string and a cesu8 string\n */\necma_string_t *\necma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */\n                             const lit_utf8_byte_t *cesu8_string2_p, /**< characters to be appended */\n                             lit_utf8_size_t cesu8_string2_size, /**< byte size of cesu8_string2_p */\n                             lit_utf8_size_t cesu8_string2_length) /**< character length of cesu8_string2_p */\n{\n  JERRY_ASSERT (string1_p != NULL && cesu8_string2_size > 0 && cesu8_string2_length > 0);\n\n  if (JERRY_UNLIKELY (ecma_string_is_empty (string1_p)))\n  {\n    return ecma_new_ecma_string_from_utf8 (cesu8_string2_p, cesu8_string2_size);\n  }\n\n  lit_utf8_size_t cesu8_string1_size;\n  lit_utf8_size_t cesu8_string1_length;\n  uint8_t flags = ECMA_STRING_FLAG_IS_ASCII;\n  lit_utf8_byte_t uint32_to_string_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];\n\n  const lit_utf8_byte_t *cesu8_string1_p =\n    ecma_string_get_chars (string1_p, &cesu8_string1_size, &cesu8_string1_length, uint32_to_string_buffer, &flags);\n\n  JERRY_ASSERT (!(flags & ECMA_STRING_FLAG_MUST_BE_FREED));\n  JERRY_ASSERT (cesu8_string1_length > 0);\n  JERRY_ASSERT (cesu8_string1_length <= cesu8_string1_size);\n\n  lit_utf8_size_t new_size = cesu8_string1_size + cesu8_string2_size;\n\n  /* Poor man's carry flag check: it is impossible to allocate this large string. */\n  if (new_size < (cesu8_string1_size | cesu8_string2_size))\n  {\n    jerry_fatal (JERRY_FATAL_OUT_OF_MEMORY);\n  }\n\n  lit_magic_string_id_t magic_string_id;\n  magic_string_id =\n    lit_is_utf8_string_pair_magic (cesu8_string1_p, cesu8_string1_size, cesu8_string2_p, cesu8_string2_size);\n\n  if (magic_string_id != LIT_MAGIC_STRING__COUNT)\n  {\n    ecma_deref_ecma_string (string1_p);\n    return ecma_get_magic_string (magic_string_id);\n  }\n\n  if ((flags & ECMA_STRING_FLAG_IS_UINT32) && new_size <= ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32)\n  {\n    memcpy (uint32_to_string_buffer + cesu8_string1_size, cesu8_string2_p, cesu8_string2_size);\n\n    uint32_t array_index;\n\n    if (ecma_string_to_array_index (uint32_to_string_buffer, new_size, &array_index))\n    {\n      ecma_deref_ecma_string (string1_p);\n      return ecma_new_ecma_string_from_uint32 (array_index);\n    }\n  }\n\n  if (lit_get_magic_string_ex_count () > 0)\n  {\n    lit_magic_string_ex_id_t magic_string_ex_id;\n    magic_string_ex_id =\n      lit_is_ex_utf8_string_pair_magic (cesu8_string1_p, cesu8_string1_size, cesu8_string2_p, cesu8_string2_size);\n\n    if (magic_string_ex_id < lit_get_magic_string_ex_count ())\n    {\n      ecma_deref_ecma_string (string1_p);\n      return ecma_new_ecma_string_from_magic_string_ex_id (magic_string_ex_id);\n    }\n  }\n\n  lit_utf8_byte_t *data_p;\n  ecma_string_t *string_desc_p =\n    ecma_new_ecma_string_from_utf8_buffer (cesu8_string1_length + cesu8_string2_length, new_size, &data_p);\n\n  lit_string_hash_t hash_start;\n\n  if (JERRY_UNLIKELY (flags & ECMA_STRING_FLAG_REHASH_NEEDED))\n  {\n    hash_start = lit_utf8_string_calc_hash (cesu8_string1_p, cesu8_string1_size);\n  }\n  else\n  {\n    JERRY_ASSERT (!ECMA_IS_DIRECT_STRING (string1_p));\n    hash_start = string1_p->u.hash;\n  }\n\n  string_desc_p->u.hash = lit_utf8_string_hash_combine (hash_start, cesu8_string2_p, cesu8_string2_size);\n\n  memcpy (data_p, cesu8_string1_p, cesu8_string1_size);\n  memcpy (data_p + cesu8_string1_size, cesu8_string2_p, cesu8_string2_size);\n\n  ecma_deref_ecma_string (string1_p);\n  return (ecma_string_t *) string_desc_p;\n} /* ecma_append_chars_to_string */\n\n/**\n * Concatenate ecma-strings\n *\n * Note:\n *   The string1_p argument is freed. If it needs to be preserved,\n *   call ecma_ref_ecma_string with string1_p before the call.\n *\n * @return concatenation of two ecma-strings\n */\necma_string_t *\necma_concat_ecma_strings (ecma_string_t *string1_p, /**< first ecma-string */\n                          ecma_string_t *string2_p) /**< second ecma-string */\n{\n  JERRY_ASSERT (string1_p != NULL && string2_p != NULL);\n\n  if (JERRY_UNLIKELY (ecma_string_is_empty (string1_p)))\n  {\n    ecma_ref_ecma_string (string2_p);\n    return string2_p;\n  }\n  else if (JERRY_UNLIKELY (ecma_string_is_empty (string2_p)))\n  {\n    return string1_p;\n  }\n\n  lit_utf8_size_t cesu8_string2_size;\n  lit_utf8_size_t cesu8_string2_length;\n  lit_utf8_byte_t uint32_to_string_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];\n  uint8_t flags = ECMA_STRING_FLAG_IS_ASCII;\n\n  const lit_utf8_byte_t *cesu8_string2_p =\n    ecma_string_get_chars (string2_p, &cesu8_string2_size, &cesu8_string2_length, uint32_to_string_buffer, &flags);\n\n  JERRY_ASSERT (cesu8_string2_p != NULL);\n\n  ecma_string_t *result_p =\n    ecma_append_chars_to_string (string1_p, cesu8_string2_p, cesu8_string2_size, cesu8_string2_length);\n\n  JERRY_ASSERT (!(flags & ECMA_STRING_FLAG_MUST_BE_FREED));\n\n  return result_p;\n} /* ecma_concat_ecma_strings */\n\n/**\n * Increase reference counter of non-direct ecma-string.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_ref_ecma_string_non_direct (ecma_string_t *string_p) /**< string descriptor */\n{\n  JERRY_ASSERT (string_p != NULL);\n  JERRY_ASSERT (!ECMA_IS_DIRECT_STRING (string_p));\n\n#ifdef JERRY_NDEBUG\n  if (ECMA_STRING_IS_STATIC (string_p))\n  {\n    return;\n  }\n#endif /* JERRY_NDEBUG */\n\n  JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);\n\n  if (JERRY_LIKELY (string_p->refs_and_container < ECMA_STRING_MAX_REF))\n  {\n    /* Increase reference counter. */\n    string_p->refs_and_container += ECMA_STRING_REF_ONE;\n  }\n  else\n  {\n    jerry_fatal (JERRY_FATAL_REF_COUNT_LIMIT);\n  }\n} /* ecma_ref_ecma_string_non_direct */\n\n/**\n * Increase reference counter of ecma-string.\n */\nvoid\necma_ref_ecma_string (ecma_string_t *string_p) /**< string descriptor */\n{\n  JERRY_ASSERT (string_p != NULL);\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    return;\n  }\n\n  ecma_ref_ecma_string_non_direct (string_p);\n} /* ecma_ref_ecma_string */\n\n/**\n * Decrease reference counter and deallocate a non-direct ecma-string\n * if the counter becomes zero.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_deref_ecma_string_non_direct (ecma_string_t *string_p) /**< ecma-string */\n{\n  JERRY_ASSERT (!ECMA_IS_DIRECT_STRING (string_p));\n\n#ifdef JERRY_NDEBUG\n  if (ECMA_STRING_IS_STATIC (string_p))\n  {\n    return;\n  }\n#endif /* JERRY_NDEBUG */\n\n  JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);\n\n  /* Decrease reference counter. */\n  string_p->refs_and_container -= ECMA_STRING_REF_ONE;\n\n  if (string_p->refs_and_container >= ECMA_STRING_REF_ONE)\n  {\n    return;\n  }\n\n  ecma_destroy_ecma_string (string_p);\n} /* ecma_deref_ecma_string_non_direct */\n\n/**\n * Decrease reference counter and deallocate ecma-string\n * if the counter becomes zero.\n */\nvoid\necma_deref_ecma_string (ecma_string_t *string_p) /**< ecma-string */\n{\n  JERRY_ASSERT (string_p != NULL);\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    return;\n  }\n\n  ecma_deref_ecma_string_non_direct (string_p);\n} /* ecma_deref_ecma_string */\n\n/**\n * Deallocate an ecma-string\n */\nvoid\necma_destroy_ecma_string (ecma_string_t *string_p) /**< ecma-string */\n{\n  JERRY_ASSERT (string_p != NULL);\n  JERRY_ASSERT (!ECMA_IS_DIRECT_STRING (string_p));\n  JERRY_ASSERT ((string_p->refs_and_container < ECMA_STRING_REF_ONE) || ECMA_STRING_IS_STATIC (string_p));\n\n  switch (ECMA_STRING_GET_CONTAINER (string_p))\n  {\n    case ECMA_STRING_CONTAINER_HEAP_UTF8_STRING:\n    {\n      ecma_dealloc_string_buffer (string_p, ((ecma_short_string_t *) string_p)->size + sizeof (ecma_short_string_t));\n      return;\n    }\n    case ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING:\n    {\n      ecma_long_string_t *long_string_p = (ecma_long_string_t *) string_p;\n\n      if (long_string_p->string_p == ECMA_LONG_STRING_BUFFER_START (long_string_p))\n      {\n        ecma_dealloc_string_buffer (string_p, long_string_p->size + sizeof (ecma_long_string_t));\n        return;\n      }\n\n      ecma_external_string_t *external_string_p = (ecma_external_string_t *) string_p;\n      jerry_external_string_free_cb_t free_cb = JERRY_CONTEXT (external_string_free_callback_p);\n\n      if (free_cb != NULL)\n      {\n        free_cb ((lit_utf8_byte_t *) external_string_p->header.string_p,\n                 external_string_p->header.size,\n                 external_string_p->user_p);\n      }\n\n      ecma_dealloc_external_string (external_string_p);\n      return;\n    }\n    case ECMA_STRING_CONTAINER_HEAP_ASCII_STRING:\n    {\n      ecma_dealloc_string_buffer (string_p, ECMA_ASCII_STRING_GET_SIZE (string_p) + ECMA_ASCII_STRING_HEADER_SIZE);\n      return;\n    }\n    case ECMA_STRING_CONTAINER_SYMBOL:\n    {\n      ecma_extended_string_t *symbol_p = (ecma_extended_string_t *) string_p;\n      ecma_free_value (symbol_p->u.symbol_descriptor);\n      ecma_dealloc_extended_string (symbol_p);\n      return;\n    }\n    default:\n    {\n      JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC\n                    || ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX);\n\n      /* only the string descriptor itself should be freed */\n      ecma_dealloc_string (string_p);\n    }\n  }\n} /* ecma_destroy_ecma_string */\n\n/**\n * Convert ecma-string to number\n *\n * @return converted ecma-number\n */\necma_number_t\necma_string_to_number (const ecma_string_t *string_p) /**< ecma-string */\n{\n  JERRY_ASSERT (string_p != NULL);\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    if (ECMA_IS_DIRECT_STRING_WITH_TYPE (string_p, ECMA_DIRECT_STRING_UINT))\n    {\n      return (ecma_number_t) ECMA_GET_DIRECT_STRING_VALUE (string_p);\n    }\n  }\n  else if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC)\n  {\n    return ((ecma_number_t) string_p->u.uint32_number);\n  }\n\n  lit_utf8_size_t size;\n  const lit_utf8_byte_t *chars_p = ecma_string_get_chars_fast (string_p, &size);\n\n  JERRY_ASSERT (chars_p != NULL);\n\n  if (size == 0)\n  {\n    return ECMA_NUMBER_ZERO;\n  }\n\n  return ecma_utf8_string_to_number (chars_p, size, 0);\n} /* ecma_string_to_number */\n\n/**\n * Check if string is array index.\n *\n * @return ECMA_STRING_NOT_ARRAY_INDEX if string is not array index\n *         the array index otherwise\n */\nextern inline uint32_t JERRY_ATTR_ALWAYS_INLINE\necma_string_get_array_index (const ecma_string_t *str_p) /**< ecma-string */\n{\n  if (ECMA_IS_DIRECT_STRING (str_p))\n  {\n    if (ECMA_IS_DIRECT_STRING_WITH_TYPE (str_p, ECMA_DIRECT_STRING_UINT))\n    {\n      /* Value cannot be equal to the maximum value of a 32 bit unsigned number. */\n      return (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (str_p);\n    }\n\n    return ECMA_STRING_NOT_ARRAY_INDEX;\n  }\n\n  if (ECMA_STRING_GET_CONTAINER (str_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC)\n  {\n    /* When the uint32_number is equal to the maximum value of 32 bit unsigned integer number,\n     * it is also an invalid array index. The comparison to ECMA_STRING_NOT_ARRAY_INDEX will\n     * be true in this case. */\n    return str_p->u.uint32_number;\n  }\n\n  return ECMA_STRING_NOT_ARRAY_INDEX;\n} /* ecma_string_get_array_index */\n\n/**\n * Copy digits of uint32 number, truncating if buffer is not large enough.\n *\n * @return number of digits copied\n */\nstatic lit_utf8_size_t\necma_uint32_to_buffer (uint32_t num, /**< number */\n                       lit_utf8_byte_t *buffer_p /**< destination buffer */,\n                       lit_utf8_size_t buffer_size /**< buffer size */)\n{\n  lit_utf8_byte_t digits[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];\n  lit_utf8_size_t digit_count = ecma_uint32_to_utf8_string (num, digits, ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);\n\n  digit_count = JERRY_MIN (buffer_size, digit_count);\n  memcpy (buffer_p, digits, digit_count);\n  return digit_count;\n} /* ecma_uint32_to_buffer */\n\n/**\n * Convert ecma-string's contents to the specified encoding and copy it to the buffer.\n * String data will be truncated to fit the buffer.\n *\n * @return number of bytes copied to the buffer.\n */\nlit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT\necma_string_copy_to_buffer (const ecma_string_t *string_p, /**< ecma-string descriptor */\n                            lit_utf8_byte_t *buffer_p, /**< destination buffer pointer\n                                                        * (can be NULL if buffer_size == 0) */\n                            lit_utf8_size_t buffer_size, /**< size of buffer */\n                            jerry_encoding_t encoding) /**< encoding */\n{\n  JERRY_ASSERT (string_p != NULL);\n  JERRY_ASSERT (buffer_p != NULL || buffer_size == 0);\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    if (ECMA_IS_DIRECT_STRING_WITH_TYPE (string_p, ECMA_DIRECT_STRING_UINT))\n    {\n      return ecma_uint32_to_buffer ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p), buffer_p, buffer_size);\n    }\n  }\n  else\n  {\n    JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);\n\n    if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC)\n    {\n      return ecma_uint32_to_buffer (string_p->u.uint32_number, buffer_p, buffer_size);\n    }\n  }\n\n  lit_utf8_size_t string_size;\n  const lit_utf8_byte_t *chars_p = ecma_string_get_chars_fast (string_p, &string_size);\n  lit_utf8_size_t copy_size = 0;\n\n  JERRY_ASSERT (chars_p != NULL);\n\n  switch (encoding)\n  {\n    case JERRY_ENCODING_CESU8:\n    {\n      copy_size = JERRY_MIN (string_size, buffer_size);\n\n      if (copy_size < string_size)\n      {\n        /* Do not copy partial characters */\n        while ((chars_p[copy_size] & LIT_UTF8_EXTRA_BYTE_MASK) == LIT_UTF8_EXTRA_BYTE_MARKER)\n        {\n          copy_size--;\n        }\n      }\n\n      memcpy (buffer_p, chars_p, copy_size);\n      break;\n    }\n    case JERRY_ENCODING_UTF8:\n    {\n      if (string_size == ecma_string_get_length (string_p))\n      {\n        copy_size = JERRY_MIN (string_size, buffer_size);\n\n        memcpy (buffer_p, chars_p, copy_size);\n        break;\n      }\n\n      copy_size = lit_convert_cesu8_string_to_utf8_string (chars_p, string_size, buffer_p, buffer_size);\n      break;\n    }\n    default:\n    {\n      break;\n    }\n  }\n\n  return copy_size;\n} /* ecma_string_copy_to_buffer */\n\n/**\n * Convert ecma-string's contents to a cesu-8 string and put it to the buffer.\n * It is the caller's responsibility to make sure that the string fits in the buffer.\n * Check if the size of the string is equal with the size of the buffer.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_string_to_cesu8_bytes (const ecma_string_t *string_desc_p, /**< ecma-string descriptor */\n                            lit_utf8_byte_t *buffer_p, /**< destination buffer pointer\n                                                        * (can be NULL if buffer_size == 0) */\n                            lit_utf8_size_t buffer_size) /**< size of buffer */\n{\n  const lit_utf8_size_t size = ecma_string_copy_to_buffer (string_desc_p, buffer_p, buffer_size, JERRY_ENCODING_CESU8);\n  JERRY_ASSERT (size == buffer_size);\n} /* ecma_string_to_cesu8_bytes */\n\n/**\n * Get size of the uint32 number stored locally in the string's descriptor\n *\n * Note: the represented number size and length are equal\n *\n * @return size in bytes\n */\nstatic inline lit_utf8_size_t JERRY_ATTR_ALWAYS_INLINE\necma_string_get_uint32_size (const uint32_t uint32_number) /**< number in the string-descriptor */\n{\n  uint32_t prev_number = 1;\n  uint32_t next_number = 100;\n  lit_utf8_size_t size = 1;\n\n  const uint32_t max_size = 9;\n\n  while (size < max_size && uint32_number >= next_number)\n  {\n    prev_number = next_number;\n    next_number *= 100;\n    size += 2;\n  }\n\n  if (uint32_number >= prev_number * 10)\n  {\n    size++;\n  }\n\n  return size;\n} /* ecma_string_get_uint32_size */\n\n/**\n * Checks whether the given string is a sequence of ascii characters.\n */\n#define ECMA_STRING_IS_ASCII(char_p, size) ((size) == lit_utf8_string_length ((char_p), (size)))\n\n/**\n * Returns with the cesu8 character array of a string.\n *\n * Note:\n *   - This function returns with a newly allocated buffer for uint32 strings,\n *     which must be freed if the optional uint32_buff_p parameter is NULL.\n *   - The ASCII check only happens if the flags parameter gets\n *     'ECMA_STRING_FLAG_IS_ASCII' as an input.\n *\n * @return start of cesu8 characters\n */\nconst lit_utf8_byte_t *\necma_string_get_chars (const ecma_string_t *string_p, /**< ecma-string */\n                       lit_utf8_size_t *size_p, /**< [out] size of the ecma string */\n                       lit_utf8_size_t *length_p, /**< [out] optional argument. If the pointer is not NULL the pointed\n                                                   *    memory area is filled with the length of the ecma string */\n                       lit_utf8_byte_t *uint32_buff_p, /**< [out] optional argument. If the pointer is not NULL the\n                                                        *    pointed memory area is filled with the string converted\n                                                        *    uint32 string descriptor */\n                       uint8_t *flags_p) /**< [in,out] any combination of ecma_string_flag_t bits */\n{\n  lit_utf8_size_t length;\n  lit_utf8_size_t size;\n  const lit_utf8_byte_t *result_p;\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    *flags_p |= ECMA_STRING_FLAG_REHASH_NEEDED;\n\n    switch (ECMA_GET_DIRECT_STRING_TYPE (string_p))\n    {\n      case ECMA_DIRECT_STRING_MAGIC:\n      {\n        uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p);\n\n        if (id >= LIT_MAGIC_STRING__COUNT)\n        {\n          id -= LIT_MAGIC_STRING__COUNT;\n          size = lit_get_magic_string_ex_size (id);\n          result_p = lit_get_magic_string_ex_utf8 (id);\n          length = 0;\n\n          if (JERRY_UNLIKELY (*flags_p & ECMA_STRING_FLAG_IS_ASCII))\n          {\n            length = lit_utf8_string_length (result_p, size);\n          }\n        }\n        else\n        {\n          size = lit_get_magic_string_size (id);\n          length = size;\n\n          result_p = lit_get_magic_string_utf8 (id);\n\n          /* All magic strings must be ascii strings. */\n          JERRY_ASSERT (ECMA_STRING_IS_ASCII (result_p, size));\n        }\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (ECMA_GET_DIRECT_STRING_TYPE (string_p) == ECMA_DIRECT_STRING_UINT);\n        uint32_t uint32_number = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p);\n        size = (lit_utf8_size_t) ecma_string_get_uint32_size (uint32_number);\n\n        if (uint32_buff_p != NULL)\n        {\n          result_p = uint32_buff_p;\n        }\n        else\n        {\n          result_p = (const lit_utf8_byte_t *) jmem_heap_alloc_block (size);\n          *flags_p |= ECMA_STRING_FLAG_MUST_BE_FREED;\n        }\n\n        length = ecma_uint32_to_utf8_string (uint32_number, (lit_utf8_byte_t *) result_p, size);\n\n        JERRY_ASSERT (length == size);\n        *flags_p |= ECMA_STRING_FLAG_IS_UINT32;\n        break;\n      }\n    }\n  }\n  else\n  {\n    JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);\n\n    switch (ECMA_STRING_GET_CONTAINER (string_p))\n    {\n      case ECMA_STRING_CONTAINER_HEAP_UTF8_STRING:\n      {\n        ecma_short_string_t *short_string_p = (ecma_short_string_t *) string_p;\n        size = short_string_p->size;\n        length = short_string_p->length;\n        result_p = ECMA_SHORT_STRING_GET_BUFFER (short_string_p);\n        break;\n      }\n      case ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING:\n      {\n        ecma_long_string_t *long_string_desc_p = (ecma_long_string_t *) string_p;\n        size = long_string_desc_p->size;\n        length = long_string_desc_p->length;\n        result_p = long_string_desc_p->string_p;\n        break;\n      }\n      case ECMA_STRING_CONTAINER_HEAP_ASCII_STRING:\n      {\n        size = ECMA_ASCII_STRING_GET_SIZE (string_p);\n        length = size;\n        result_p = ECMA_ASCII_STRING_GET_BUFFER (string_p);\n        break;\n      }\n      case ECMA_STRING_CONTAINER_UINT32_IN_DESC:\n      {\n        size = (lit_utf8_size_t) ecma_string_get_uint32_size (string_p->u.uint32_number);\n\n        if (uint32_buff_p != NULL)\n        {\n          result_p = uint32_buff_p;\n        }\n        else\n        {\n          result_p = (const lit_utf8_byte_t *) jmem_heap_alloc_block (size);\n          *flags_p |= ECMA_STRING_FLAG_MUST_BE_FREED;\n        }\n\n        length = ecma_uint32_to_utf8_string (string_p->u.uint32_number, (lit_utf8_byte_t *) result_p, size);\n\n        JERRY_ASSERT (length == size);\n        *flags_p |= ECMA_STRING_FLAG_IS_UINT32 | ECMA_STRING_FLAG_REHASH_NEEDED;\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX);\n\n        lit_magic_string_ex_id_t id = LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id;\n        size = lit_get_magic_string_ex_size (id);\n        length = 0;\n\n        if (JERRY_UNLIKELY (*flags_p & ECMA_STRING_FLAG_IS_ASCII))\n        {\n          length = lit_utf8_string_length (lit_get_magic_string_ex_utf8 (id), size);\n        }\n\n        result_p = lit_get_magic_string_ex_utf8 (id);\n        *flags_p |= ECMA_STRING_FLAG_REHASH_NEEDED;\n        break;\n      }\n    }\n  }\n\n  *size_p = size;\n  if (length_p != NULL)\n  {\n    *length_p = length;\n  }\n\n  if ((*flags_p & ECMA_STRING_FLAG_IS_ASCII) && length != size)\n  {\n    *flags_p = (uint8_t) (*flags_p & (uint8_t) ~ECMA_STRING_FLAG_IS_ASCII);\n  }\n\n  return result_p;\n} /* ecma_string_get_chars */\n\n/**\n * Checks whether the string equals to the magic string id.\n *\n * @return true - if the string equals to the magic string id\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_compare_ecma_string_to_magic_id (const ecma_string_t *string_p, /**< property name */\n                                      lit_magic_string_id_t id) /**< magic string id */\n{\n  return (string_p == ecma_get_magic_string (id));\n} /* ecma_compare_ecma_string_to_magic_id */\n\n/**\n * Checks whether ecma string is empty or not\n *\n * @return true - if the string is an empty string\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_string_is_empty (const ecma_string_t *string_p) /**< ecma-string */\n{\n  return ecma_compare_ecma_string_to_magic_id (string_p, LIT_MAGIC_STRING__EMPTY);\n} /* ecma_string_is_empty */\n\n/**\n * Checks whether the string equals to \"length\".\n *\n * @return true - if the string equals to \"length\"\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_string_is_length (const ecma_string_t *string_p) /**< property name */\n{\n  return ecma_compare_ecma_string_to_magic_id (string_p, LIT_MAGIC_STRING_LENGTH);\n} /* ecma_string_is_length */\n\n/**\n * Converts a property name into a string\n *\n * @return pointer to the converted ecma string\n */\nstatic inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE\necma_property_to_string (ecma_property_t property, /**< property name type */\n                         jmem_cpointer_t prop_name_cp) /**< property name compressed pointer */\n{\n  uintptr_t property_string = ((uintptr_t) (property)) & (0x3 << ECMA_PROPERTY_NAME_TYPE_SHIFT);\n  property_string = (property_string >> ECMA_STRING_TYPE_CONVERSION_SHIFT) | ECMA_TYPE_DIRECT_STRING;\n  return (ecma_string_t *) (property_string | (((uintptr_t) prop_name_cp) << ECMA_DIRECT_STRING_SHIFT));\n} /* ecma_property_to_string */\n\n/**\n * Converts a string into a property name\n *\n * @return the compressed pointer part of the name\n */\nextern inline jmem_cpointer_t JERRY_ATTR_ALWAYS_INLINE\necma_string_to_property_name (ecma_string_t *prop_name_p, /**< property name */\n                              ecma_property_t *name_type_p) /**< [out] property name type */\n{\n  if (ECMA_IS_DIRECT_STRING (prop_name_p))\n  {\n    *name_type_p = (ecma_property_t) ECMA_DIRECT_STRING_TYPE_TO_PROP_NAME_TYPE (prop_name_p);\n    return (jmem_cpointer_t) ECMA_GET_DIRECT_STRING_VALUE (prop_name_p);\n  }\n\n  *name_type_p = ECMA_DIRECT_STRING_PTR << ECMA_PROPERTY_NAME_TYPE_SHIFT;\n\n  ecma_ref_ecma_string (prop_name_p);\n\n  jmem_cpointer_t prop_name_cp;\n  ECMA_SET_NON_NULL_POINTER (prop_name_cp, prop_name_p);\n  return prop_name_cp;\n} /* ecma_string_to_property_name */\n\n/**\n * Converts a property name into a string\n *\n * @return the string pointer\n *         string must be released with ecma_deref_ecma_string\n */\necma_string_t *\necma_string_from_property_name (ecma_property_t property, /**< property name type */\n                                jmem_cpointer_t prop_name_cp) /**< property name compressed pointer */\n{\n  if (ECMA_PROPERTY_GET_NAME_TYPE (property) != ECMA_DIRECT_STRING_PTR)\n  {\n    return ecma_property_to_string (property, prop_name_cp);\n  }\n\n  ecma_string_t *prop_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, prop_name_cp);\n  ecma_ref_ecma_string (prop_name_p);\n  return prop_name_p;\n} /* ecma_string_from_property_name */\n\n/**\n * Get hash code of property name\n *\n * @return hash code of property name\n */\nextern inline lit_string_hash_t JERRY_ATTR_ALWAYS_INLINE\necma_string_get_property_name_hash (ecma_property_t property, /**< property name type */\n                                    jmem_cpointer_t prop_name_cp) /**< property name compressed pointer */\n{\n  if (ECMA_PROPERTY_GET_NAME_TYPE (property) == ECMA_DIRECT_STRING_PTR)\n  {\n    ecma_string_t *prop_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, prop_name_cp);\n    return prop_name_p->u.hash;\n  }\n\n  return (lit_string_hash_t) prop_name_cp;\n} /* ecma_string_get_property_name_hash */\n\n/**\n * Check if property name is array index.\n *\n * @return ECMA_STRING_NOT_ARRAY_INDEX if string is not array index\n *         the array index otherwise\n */\nuint32_t\necma_string_get_property_index (ecma_property_t property, /**< property name type */\n                                jmem_cpointer_t prop_name_cp) /**< property name compressed pointer */\n{\n  switch (ECMA_PROPERTY_GET_NAME_TYPE (property))\n  {\n    case ECMA_DIRECT_STRING_UINT:\n    {\n      return (uint32_t) prop_name_cp;\n    }\n    case ECMA_DIRECT_STRING_PTR:\n    {\n      ecma_string_t *prop_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, prop_name_cp);\n      return ecma_string_get_array_index (prop_name_p);\n    }\n    default:\n    {\n      return ECMA_STRING_NOT_ARRAY_INDEX;\n    }\n  }\n} /* ecma_string_get_property_index */\n\n/**\n * Compare a property name to a string\n *\n * @return true if they are equals\n *         false otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_string_compare_to_property_name (ecma_property_t property, /**< property name type */\n                                      jmem_cpointer_t prop_name_cp, /**< property name compressed pointer */\n                                      const ecma_string_t *string_p) /**< other string */\n{\n  if (ECMA_PROPERTY_GET_NAME_TYPE (property) != ECMA_DIRECT_STRING_PTR)\n  {\n    return ecma_property_to_string (property, prop_name_cp) == string_p;\n  }\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    return false;\n  }\n\n  ecma_string_t *prop_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, prop_name_cp);\n  return ecma_compare_ecma_non_direct_strings (prop_name_p, string_p);\n} /* ecma_string_compare_to_property_name */\n\n/**\n * Helper for ecma_compare_ecma_strings_longpath to get string data\n *\n * @return string characters\n */\nstatic const lit_utf8_byte_t *\necma_compare_get_string_chars (const ecma_string_t *string_p, /**< ecma-string */\n                               lit_utf8_size_t *size_and_length_p) /**< [out] size and length */\n{\n  switch (ECMA_STRING_GET_CONTAINER (string_p))\n  {\n    case ECMA_STRING_CONTAINER_HEAP_UTF8_STRING:\n    {\n      ecma_short_string_t *short_string_p = (ecma_short_string_t *) string_p;\n      size_and_length_p[0] = short_string_p->size;\n      size_and_length_p[1] = short_string_p->length;\n      return ECMA_SHORT_STRING_GET_BUFFER (string_p);\n    }\n    case ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING:\n    {\n      ecma_long_string_t *long_string_p = (ecma_long_string_t *) string_p;\n      size_and_length_p[0] = long_string_p->size;\n      size_and_length_p[1] = long_string_p->length;\n      return long_string_p->string_p;\n    }\n    case ECMA_STRING_CONTAINER_HEAP_ASCII_STRING:\n    {\n      size_and_length_p[0] = ECMA_ASCII_STRING_GET_SIZE (string_p);\n      size_and_length_p[1] = size_and_length_p[0];\n      return ECMA_ASCII_STRING_GET_BUFFER (string_p);\n    }\n    default:\n    {\n      return NULL;\n    }\n  }\n} /* ecma_compare_get_string_chars */\n\n/**\n * Long path part of ecma-string to ecma-string comparison routine\n *\n * See also:\n *          ecma_compare_ecma_strings\n *\n * @return true - if strings are equal;\n *         false - otherwise\n */\nstatic bool JERRY_ATTR_NOINLINE\necma_compare_ecma_strings_longpath (const ecma_string_t *string1_p, /**< ecma-string */\n                                    const ecma_string_t *string2_p) /**< ecma-string */\n{\n  const lit_utf8_byte_t *utf8_string1_p, *utf8_string2_p;\n  lit_utf8_size_t string1_size_and_length[2] = { 0 };\n  lit_utf8_size_t string2_size_and_length[2] = { 0 };\n\n  utf8_string1_p = ecma_compare_get_string_chars (string1_p, string1_size_and_length);\n  utf8_string2_p = ecma_compare_get_string_chars (string2_p, string2_size_and_length);\n\n  if (utf8_string1_p == NULL || utf8_string2_p == NULL)\n  {\n    return false;\n  }\n\n  if (string1_size_and_length[0] != string2_size_and_length[0]\n      || string1_size_and_length[1] != string2_size_and_length[1])\n  {\n    return false;\n  }\n\n  return !memcmp ((char *) utf8_string1_p, (char *) utf8_string2_p, string1_size_and_length[0]);\n} /* ecma_compare_ecma_strings_longpath */\n\n/**\n * Compare two ecma-strings\n *\n * @return true - if strings are equal;\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_compare_ecma_strings (const ecma_string_t *string1_p, /**< ecma-string */\n                           const ecma_string_t *string2_p) /**< ecma-string */\n{\n  JERRY_ASSERT (string1_p != NULL && string2_p != NULL);\n\n  /* Fast paths first. */\n  if (string1_p == string2_p)\n  {\n    return true;\n  }\n\n  /* Either string is direct, return with false. */\n  if (ECMA_IS_DIRECT_STRING (((uintptr_t) string1_p) | ((uintptr_t) string2_p)))\n  {\n    return false;\n  }\n\n  /* Also compares uint32 values in descriptor. */\n  if (string1_p->u.hash != string2_p->u.hash)\n  {\n    return false;\n  }\n\n  if (ECMA_STRING_GET_CONTAINER (string1_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC)\n  {\n    return ECMA_STRING_GET_CONTAINER (string2_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC;\n  }\n\n  return ecma_compare_ecma_strings_longpath (string1_p, string2_p);\n} /* ecma_compare_ecma_strings */\n\n/**\n * Compare two non-direct ecma-strings\n *\n * @return true - if strings are equal;\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_compare_ecma_non_direct_strings (const ecma_string_t *string1_p, /**< ecma-string */\n                                      const ecma_string_t *string2_p) /**< ecma-string */\n{\n  JERRY_ASSERT (string1_p != NULL && string2_p != NULL);\n  JERRY_ASSERT (!ECMA_IS_DIRECT_STRING (string1_p) && !ECMA_IS_DIRECT_STRING (string2_p));\n\n  /* Fast paths first. */\n  if (string1_p == string2_p)\n  {\n    return true;\n  }\n\n  if (string1_p->u.hash != string2_p->u.hash)\n  {\n    return false;\n  }\n\n  if (ECMA_STRING_GET_CONTAINER (string1_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC)\n  {\n    return ECMA_STRING_GET_CONTAINER (string2_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC;\n  }\n\n  return ecma_compare_ecma_strings_longpath (string1_p, string2_p);\n} /* ecma_compare_ecma_non_direct_strings */\n\n/**\n * Relational compare of ecma-strings.\n *\n * First string is less than second string if:\n *  - strings are not equal;\n *  - first string is prefix of second or is lexicographically less than second.\n *\n * @return true - if first string is less than second string,\n *         false - otherwise\n */\nbool\necma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-string */\n                                      const ecma_string_t *string2_p) /**< ecma-string */\n{\n  if (ecma_compare_ecma_strings (string1_p, string2_p))\n  {\n    return false;\n  }\n\n  const lit_utf8_byte_t *utf8_string1_p, *utf8_string2_p;\n  lit_utf8_size_t utf8_string1_size, utf8_string2_size;\n\n  lit_utf8_byte_t uint32_to_string_buffer1[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];\n  lit_utf8_byte_t uint32_to_string_buffer2[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];\n\n  if (ECMA_IS_DIRECT_STRING (string1_p))\n  {\n    if (ECMA_GET_DIRECT_STRING_TYPE (string1_p) != ECMA_DIRECT_STRING_UINT)\n    {\n      utf8_string1_p = ecma_string_get_chars_fast (string1_p, &utf8_string1_size);\n    }\n    else\n    {\n      utf8_string1_size = ecma_uint32_to_utf8_string ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string1_p),\n                                                      uint32_to_string_buffer1,\n                                                      ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);\n      utf8_string1_p = uint32_to_string_buffer1;\n    }\n  }\n  else\n  {\n    JERRY_ASSERT (string1_p->refs_and_container >= ECMA_STRING_REF_ONE);\n\n    if (ECMA_STRING_GET_CONTAINER (string1_p) != ECMA_STRING_CONTAINER_UINT32_IN_DESC)\n    {\n      utf8_string1_p = ecma_string_get_chars_fast (string1_p, &utf8_string1_size);\n    }\n    else\n    {\n      utf8_string1_size = ecma_uint32_to_utf8_string (string1_p->u.uint32_number,\n                                                      uint32_to_string_buffer1,\n                                                      ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);\n      utf8_string1_p = uint32_to_string_buffer1;\n    }\n  }\n\n  if (ECMA_IS_DIRECT_STRING (string2_p))\n  {\n    if (ECMA_GET_DIRECT_STRING_TYPE (string2_p) != ECMA_DIRECT_STRING_UINT)\n    {\n      utf8_string2_p = ecma_string_get_chars_fast (string2_p, &utf8_string2_size);\n    }\n    else\n    {\n      utf8_string2_size = ecma_uint32_to_utf8_string ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string2_p),\n                                                      uint32_to_string_buffer2,\n                                                      ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);\n      utf8_string2_p = uint32_to_string_buffer2;\n    }\n  }\n  else\n  {\n    JERRY_ASSERT (string2_p->refs_and_container >= ECMA_STRING_REF_ONE);\n\n    if (ECMA_STRING_GET_CONTAINER (string2_p) != ECMA_STRING_CONTAINER_UINT32_IN_DESC)\n    {\n      utf8_string2_p = ecma_string_get_chars_fast (string2_p, &utf8_string2_size);\n    }\n    else\n    {\n      utf8_string2_size = ecma_uint32_to_utf8_string (string2_p->u.uint32_number,\n                                                      uint32_to_string_buffer2,\n                                                      ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);\n      utf8_string2_p = uint32_to_string_buffer2;\n    }\n  }\n\n  return lit_compare_utf8_strings_relational (utf8_string1_p, utf8_string1_size, utf8_string2_p, utf8_string2_size);\n} /* ecma_compare_ecma_strings_relational */\n\n/**\n * Special value to represent that no size is available.\n */\n#define ECMA_STRING_NO_ASCII_SIZE 0xffffffff\n\n/**\n * Return the size of uint32 and magic strings.\n * The length of these strings are equal to their size.\n *\n * @return number of characters in the string\n */\nstatic lit_utf8_size_t\necma_string_get_ascii_size (const ecma_string_t *string_p) /**< ecma-string */\n{\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    switch (ECMA_GET_DIRECT_STRING_TYPE (string_p))\n    {\n      case ECMA_DIRECT_STRING_MAGIC:\n      {\n        uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p);\n\n        if (id >= LIT_MAGIC_STRING__COUNT)\n        {\n          return ECMA_STRING_NO_ASCII_SIZE;\n        }\n\n        JERRY_ASSERT (ECMA_STRING_IS_ASCII (lit_get_magic_string_utf8 (id), lit_get_magic_string_size (id)));\n\n        return lit_get_magic_string_size (id);\n      }\n      default:\n      {\n        JERRY_ASSERT (ECMA_GET_DIRECT_STRING_TYPE (string_p) == ECMA_DIRECT_STRING_UINT);\n        uint32_t uint32_number = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p);\n        return ecma_string_get_uint32_size (uint32_number);\n      }\n    }\n  }\n\n  JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);\n\n  if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_UINT32_IN_DESC)\n  {\n    return ecma_string_get_uint32_size (string_p->u.uint32_number);\n  }\n  else if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_HEAP_ASCII_STRING)\n  {\n    return ECMA_ASCII_STRING_GET_SIZE (string_p);\n  }\n\n  return ECMA_STRING_NO_ASCII_SIZE;\n} /* ecma_string_get_ascii_size */\n\n/**\n * Get length of ecma-string\n *\n * @return number of characters in the string\n */\nlit_utf8_size_t\necma_string_get_length (const ecma_string_t *string_p) /**< ecma-string */\n{\n  lit_utf8_size_t length = ecma_string_get_ascii_size (string_p);\n\n  if (length != ECMA_STRING_NO_ASCII_SIZE)\n  {\n    return length;\n  }\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    JERRY_ASSERT (ECMA_GET_DIRECT_STRING_TYPE (string_p) == ECMA_DIRECT_STRING_MAGIC);\n    JERRY_ASSERT ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) >= LIT_MAGIC_STRING__COUNT);\n\n    uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) - LIT_MAGIC_STRING__COUNT;\n    return lit_utf8_string_length (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));\n  }\n\n  if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_HEAP_UTF8_STRING)\n  {\n    return ((ecma_short_string_t *) string_p)->length;\n  }\n\n  if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING)\n  {\n    return ((ecma_long_string_t *) string_p)->length;\n  }\n\n  JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX);\n\n  lit_magic_string_ex_id_t id = LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id;\n  return lit_utf8_string_length (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));\n} /* ecma_string_get_length */\n\n/**\n * Get length of UTF-8 encoded string length from ecma-string\n *\n * @return number of characters in the UTF-8 encoded string\n */\nlit_utf8_size_t\necma_string_get_utf8_length (const ecma_string_t *string_p) /**< ecma-string */\n{\n  lit_utf8_size_t length = ecma_string_get_ascii_size (string_p);\n\n  if (length != ECMA_STRING_NO_ASCII_SIZE)\n  {\n    return length;\n  }\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    JERRY_ASSERT (ECMA_GET_DIRECT_STRING_TYPE (string_p) == ECMA_DIRECT_STRING_MAGIC);\n    JERRY_ASSERT ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) >= LIT_MAGIC_STRING__COUNT);\n\n    uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) - LIT_MAGIC_STRING__COUNT;\n    return lit_get_utf8_length_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));\n  }\n\n  if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_HEAP_UTF8_STRING)\n  {\n    ecma_short_string_t *short_string_p = (ecma_short_string_t *) string_p;\n    lit_utf8_size_t size = short_string_p->size;\n\n    if (size == short_string_p->length)\n    {\n      return size;\n    }\n\n    return lit_get_utf8_length_of_cesu8_string (ECMA_SHORT_STRING_GET_BUFFER (string_p), size);\n  }\n\n  if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING)\n  {\n    ecma_long_string_t *long_string_p = (ecma_long_string_t *) string_p;\n    lit_utf8_size_t size = long_string_p->size;\n\n    if (size == long_string_p->length)\n    {\n      return size;\n    }\n\n    return lit_get_utf8_length_of_cesu8_string (long_string_p->string_p, size);\n  }\n\n  JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX);\n\n  lit_magic_string_ex_id_t id = LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id;\n\n  return lit_get_utf8_length_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));\n} /* ecma_string_get_utf8_length */\n\n/**\n * Get size of ecma-string\n *\n * @return number of bytes in the buffer needed to represent the string\n */\nlit_utf8_size_t\necma_string_get_size (const ecma_string_t *string_p) /**< ecma-string */\n{\n  lit_utf8_size_t length = ecma_string_get_ascii_size (string_p);\n\n  if (length != ECMA_STRING_NO_ASCII_SIZE)\n  {\n    return length;\n  }\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    JERRY_ASSERT (ECMA_GET_DIRECT_STRING_TYPE (string_p) == ECMA_DIRECT_STRING_MAGIC);\n    JERRY_ASSERT ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) >= LIT_MAGIC_STRING__COUNT);\n\n    return lit_get_magic_string_ex_size ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) - LIT_MAGIC_STRING__COUNT);\n  }\n\n  if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_HEAP_UTF8_STRING)\n  {\n    return ((ecma_short_string_t *) string_p)->size;\n  }\n\n  if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING)\n  {\n    return ((ecma_long_string_t *) string_p)->size;\n  }\n\n  JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX);\n\n  return lit_get_magic_string_ex_size (LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id);\n} /* ecma_string_get_size */\n\n/**\n * Get the UTF-8 encoded string size from ecma-string\n *\n * @return number of bytes in the buffer needed to represent an UTF-8 encoded string\n */\nlit_utf8_size_t\necma_string_get_utf8_size (const ecma_string_t *string_p) /**< ecma-string */\n{\n  lit_utf8_size_t length = ecma_string_get_ascii_size (string_p);\n\n  if (length != ECMA_STRING_NO_ASCII_SIZE)\n  {\n    return length;\n  }\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    JERRY_ASSERT (ECMA_GET_DIRECT_STRING_TYPE (string_p) == ECMA_DIRECT_STRING_MAGIC);\n    JERRY_ASSERT ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) >= LIT_MAGIC_STRING__COUNT);\n\n    uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) - LIT_MAGIC_STRING__COUNT;\n    return lit_get_utf8_size_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));\n  }\n\n  if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_HEAP_UTF8_STRING)\n  {\n    ecma_short_string_t *short_string_p = (ecma_short_string_t *) string_p;\n    lit_utf8_size_t size = short_string_p->size;\n\n    if (size == short_string_p->length)\n    {\n      return size;\n    }\n\n    return lit_get_utf8_size_of_cesu8_string (ECMA_SHORT_STRING_GET_BUFFER (string_p), size);\n  }\n\n  if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING)\n  {\n    ecma_long_string_t *long_string_p = (ecma_long_string_t *) string_p;\n\n    if (long_string_p->size == long_string_p->length)\n    {\n      return long_string_p->size;\n    }\n\n    return lit_get_utf8_size_of_cesu8_string (long_string_p->string_p, long_string_p->size);\n  }\n\n  JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX);\n\n  lit_magic_string_ex_id_t id = LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id;\n  return lit_get_utf8_size_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));\n} /* ecma_string_get_utf8_size */\n\n/**\n * Get character from specified position in an external ecma-string.\n *\n * @return character value\n */\nstatic ecma_char_t JERRY_ATTR_NOINLINE\necma_external_string_get_char_at_pos (lit_utf8_size_t id, /**< id of the external magic string */\n                                      lit_utf8_size_t index) /**< index of character */\n{\n  id -= LIT_MAGIC_STRING__COUNT;\n  const lit_utf8_byte_t *data_p = lit_get_magic_string_ex_utf8 (id);\n  lit_utf8_size_t size = lit_get_magic_string_ex_size (id);\n  lit_utf8_size_t length = lit_utf8_string_length (data_p, size);\n\n  if (JERRY_LIKELY (size == length))\n  {\n    return (ecma_char_t) data_p[index];\n  }\n\n  return lit_utf8_string_code_unit_at (data_p, size, index);\n} /* ecma_external_string_get_char_at_pos */\n\n/**\n * Get character from specified position in the ecma-string.\n *\n * @return character value\n */\necma_char_t\necma_string_get_char_at_pos (const ecma_string_t *string_p, /**< ecma-string */\n                             lit_utf8_size_t index) /**< index of character */\n{\n  JERRY_ASSERT (index < ecma_string_get_length (string_p));\n\n  lit_utf8_byte_t uint32_to_string_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    switch (ECMA_GET_DIRECT_STRING_TYPE (string_p))\n    {\n      case ECMA_DIRECT_STRING_MAGIC:\n      {\n        uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p);\n\n        if (JERRY_LIKELY (id < LIT_MAGIC_STRING__COUNT))\n        {\n          /* All magic strings must be ascii strings. */\n          const lit_utf8_byte_t *data_p = lit_get_magic_string_utf8 (id);\n\n          return (ecma_char_t) data_p[index];\n        }\n\n        return ecma_external_string_get_char_at_pos (id, index);\n      }\n      default:\n      {\n        JERRY_ASSERT (ECMA_GET_DIRECT_STRING_TYPE (string_p) == ECMA_DIRECT_STRING_UINT);\n        uint32_t uint32_number = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p);\n\n        ecma_uint32_to_utf8_string (uint32_number, uint32_to_string_buffer, ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);\n\n        return (ecma_char_t) uint32_to_string_buffer[index];\n      }\n    }\n  }\n\n  JERRY_ASSERT (string_p->refs_and_container >= ECMA_STRING_REF_ONE);\n\n  switch (ECMA_STRING_GET_CONTAINER (string_p))\n  {\n    case ECMA_STRING_CONTAINER_HEAP_UTF8_STRING:\n    {\n      ecma_short_string_t *short_string_p = (ecma_short_string_t *) string_p;\n      lit_utf8_size_t size = short_string_p->size;\n      const lit_utf8_byte_t *data_p = ECMA_SHORT_STRING_GET_BUFFER (string_p);\n\n      if (JERRY_LIKELY (size == short_string_p->length))\n      {\n        return (ecma_char_t) data_p[index];\n      }\n\n      return lit_utf8_string_code_unit_at (data_p, size, index);\n    }\n    case ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING:\n    {\n      ecma_long_string_t *long_string_p = (ecma_long_string_t *) string_p;\n      lit_utf8_size_t size = long_string_p->size;\n      const lit_utf8_byte_t *data_p = long_string_p->string_p;\n\n      if (JERRY_LIKELY (size == long_string_p->length))\n      {\n        return (ecma_char_t) data_p[index];\n      }\n\n      return lit_utf8_string_code_unit_at (data_p, size, index);\n    }\n    case ECMA_STRING_CONTAINER_HEAP_ASCII_STRING:\n    {\n      const lit_utf8_byte_t *data_p = ECMA_ASCII_STRING_GET_BUFFER (string_p);\n      return (ecma_char_t) data_p[index];\n    }\n    case ECMA_STRING_CONTAINER_UINT32_IN_DESC:\n    {\n      ecma_uint32_to_utf8_string (string_p->u.uint32_number,\n                                  uint32_to_string_buffer,\n                                  ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);\n\n      return (ecma_char_t) uint32_to_string_buffer[index];\n    }\n    default:\n    {\n      JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX);\n      return ecma_external_string_get_char_at_pos (string_p->u.magic_string_ex_id, index);\n    }\n  }\n} /* ecma_string_get_char_at_pos */\n\n/**\n * Check if passed string equals to one of magic strings\n * and if equal magic string was found, return it's id in 'out_id_p' argument.\n *\n * @return id - if magic string equal to passed string was found,\n *         LIT_MAGIC_STRING__COUNT - otherwise.\n */\nlit_magic_string_id_t\necma_get_string_magic (const ecma_string_t *string_p) /**< ecma-string */\n{\n  if (ECMA_IS_DIRECT_STRING_WITH_TYPE (string_p, ECMA_DIRECT_STRING_MAGIC))\n  {\n    uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p);\n\n    if (id < LIT_MAGIC_STRING__COUNT)\n    {\n      return (lit_magic_string_id_t) id;\n    }\n  }\n\n  return LIT_MAGIC_STRING__COUNT;\n} /* ecma_get_string_magic */\n\n/**\n * Try to calculate hash of the ecma-string\n *\n * @return calculated hash\n */\nextern inline lit_string_hash_t JERRY_ATTR_ALWAYS_INLINE\necma_string_hash (const ecma_string_t *string_p) /**< ecma-string to calculate hash for */\n{\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    return (lit_string_hash_t) ECMA_GET_DIRECT_STRING_VALUE (string_p);\n  }\n\n  return (lit_string_hash_t) string_p->u.hash;\n} /* ecma_string_hash */\n\n/**\n * Create a substring from an ecma string\n *\n * @return a newly consturcted ecma string with its value initialized to a copy of a substring of the first argument\n */\necma_string_t *\necma_string_substr (const ecma_string_t *string_p, /**< pointer to an ecma string */\n                    lit_utf8_size_t start_pos, /**< start position, should be less or equal than string length */\n                    lit_utf8_size_t end_pos) /**< end position, should be less or equal than string length */\n{\n  const lit_utf8_size_t string_length = ecma_string_get_length (string_p);\n  JERRY_ASSERT (start_pos <= string_length);\n  JERRY_ASSERT (end_pos <= string_length);\n\n  if (start_pos >= end_pos)\n  {\n    return ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  ecma_string_t *ecma_string_p = NULL;\n  end_pos -= start_pos;\n\n  ECMA_STRING_TO_UTF8_STRING (string_p, start_p, buffer_size);\n\n  if (string_length == buffer_size)\n  {\n    ecma_string_p = ecma_new_ecma_string_from_utf8 (start_p + start_pos, (lit_utf8_size_t) end_pos);\n  }\n  else\n  {\n    while (start_pos--)\n    {\n      start_p += lit_get_unicode_char_size_by_utf8_first_byte (*start_p);\n    }\n\n    const lit_utf8_byte_t *end_p = start_p;\n    while (end_pos--)\n    {\n      end_p += lit_get_unicode_char_size_by_utf8_first_byte (*end_p);\n    }\n\n    ecma_string_p = ecma_new_ecma_string_from_utf8 (start_p, (lit_utf8_size_t) (end_p - start_p));\n  }\n\n  ECMA_FINALIZE_UTF8_STRING (start_p, buffer_size);\n\n  return ecma_string_p;\n} /* ecma_string_substr */\n\n/**\n * Helper function for trimming.\n *\n * Used by:\n *        - ecma_string_trim_helper\n *        - ecma_builtin_global_object_parse_int\n *        - ecma_builtin_global_object_parse_float\n *\n * @return position of the first non whitespace character.\n */\nconst lit_utf8_byte_t *\necma_string_trim_front (const lit_utf8_byte_t *start_p, /**< current string's start position */\n                        const lit_utf8_byte_t *end_p) /**< current string's end position */\n{\n  ecma_char_t ch;\n\n  while (start_p < end_p)\n  {\n    lit_utf8_size_t read_size = lit_read_code_unit_from_cesu8 (start_p, &ch);\n\n    if (!lit_char_is_white_space (ch))\n    {\n      break;\n    }\n\n    start_p += read_size;\n  }\n\n  return start_p;\n} /* ecma_string_trim_front */\n\n/**\n * Helper function for trimming.\n *\n * Used by:\n *        - ecma_string_trim_helper\n *\n * @return position of the last non whitespace character.\n */\nconst lit_utf8_byte_t *\necma_string_trim_back (const lit_utf8_byte_t *start_p, /**< current string's start position */\n                       const lit_utf8_byte_t *end_p) /**< current string's end position */\n{\n  ecma_char_t ch;\n\n  while (end_p > start_p)\n  {\n    lit_utf8_size_t read_size = lit_read_prev_code_unit_from_utf8 (end_p, &ch);\n\n    if (!lit_char_is_white_space (ch))\n    {\n      break;\n    }\n\n    end_p -= read_size;\n  }\n\n  return end_p;\n} /* ecma_string_trim_back */\n\n/**\n * Helper function for trimming.\n *\n * Used by:\n *        - ecma_string_trim\n *        - ecma_utf8_string_to_number\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_string_trim_helper (const lit_utf8_byte_t **utf8_str_p, /**< [in, out] current string position */\n                         lit_utf8_size_t *utf8_str_size) /**< [in, out] size of the given string */\n{\n  const lit_utf8_byte_t *end_p = *utf8_str_p + *utf8_str_size;\n  const lit_utf8_byte_t *start_p = *utf8_str_p;\n\n  const lit_utf8_byte_t *new_start_p = ecma_string_trim_front (start_p, end_p);\n  const lit_utf8_byte_t *new_end_p = ecma_string_trim_back (new_start_p, end_p);\n\n  *utf8_str_size = (lit_utf8_size_t) (new_end_p - new_start_p);\n  *utf8_str_p = new_start_p;\n} /* ecma_string_trim_helper */\n\n/**\n * Trim leading and trailing whitespace characters from string.\n *\n * @return trimmed ecma string\n */\necma_string_t *\necma_string_trim (const ecma_string_t *string_p) /**< pointer to an ecma string */\n{\n  ecma_string_t *ret_string_p;\n\n  lit_utf8_size_t utf8_str_size;\n  uint8_t flags = ECMA_STRING_FLAG_IS_ASCII;\n  const lit_utf8_byte_t *utf8_str_p = ecma_string_get_chars (string_p, &utf8_str_size, NULL, NULL, &flags);\n\n  if (utf8_str_size > 0)\n  {\n    ecma_string_trim_helper (&utf8_str_p, &utf8_str_size);\n    ret_string_p = ecma_new_ecma_string_from_utf8 (utf8_str_p, utf8_str_size);\n  }\n  else\n  {\n    ret_string_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  if (flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n  {\n    jmem_heap_free_block ((void *) utf8_str_p, utf8_str_size);\n  }\n\n  return ret_string_p;\n} /* ecma_string_trim */\n\n/**\n * Pad the beginning or the end of string with parameter given in fill_string to the length of max_length.\n *\n * @return new string from original, padded with given parameters\n */\necma_value_t\necma_string_pad (ecma_value_t original_string_p, /**< Input ecma string */\n                 ecma_value_t max_length, /**< Length to pad to, including original length */\n                 ecma_value_t fill_string, /**< The string to pad with */\n                 bool pad_on_start) /**< true - if we are padding to the start, calling with padStart\n                                         false - if we are padding to the end, calling with padEnd */\n{\n  /* 3 */\n  ecma_length_t int_max_length;\n  if (ECMA_IS_VALUE_ERROR (ecma_op_to_length (max_length, &int_max_length)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n  /* 4 */\n  ecma_string_t *original_str_val_p = ecma_get_string_from_value (original_string_p);\n  const uint32_t string_length = ecma_string_get_length (original_str_val_p);\n  /* 5 */\n  if (int_max_length <= string_length)\n  {\n    ecma_ref_ecma_string (original_str_val_p);\n    return original_string_p;\n  }\n\n  ecma_string_t *filler_p = ecma_get_magic_string (LIT_MAGIC_STRING_SPACE_CHAR);\n  /* 6 - 7 */\n  if (!ecma_is_value_undefined (fill_string))\n  {\n    filler_p = ecma_op_to_string (fill_string);\n    if (filler_p == NULL)\n    {\n      return ECMA_VALUE_ERROR;\n    }\n    if (ecma_string_is_empty (filler_p))\n    {\n      ecma_ref_ecma_string (original_str_val_p);\n      return original_string_p;\n    }\n  }\n\n  if (int_max_length >= UINT32_MAX)\n  {\n    ecma_deref_ecma_string (filler_p);\n    return ecma_raise_range_error (ECMA_ERR_MAXIMUM_STRING_LENGTH_IS_REACHED);\n  }\n\n  /* 9 */\n  uint32_t fill_len = (uint32_t) int_max_length - string_length;\n\n  /* 10 */\n  uint32_t filler_length = ecma_string_get_length (filler_p);\n  uint32_t prepend_count = fill_len / filler_length;\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  if (!pad_on_start)\n  {\n    ecma_stringbuilder_append (&builder, original_str_val_p);\n  }\n\n  for (uint32_t i = 0; i < prepend_count; i++)\n  {\n    ecma_stringbuilder_append (&builder, filler_p);\n  }\n\n  uint32_t remaining = fill_len - (prepend_count * filler_length);\n\n  ECMA_STRING_TO_UTF8_STRING (filler_p, start_p, utf8_str_size);\n  const lit_utf8_byte_t *temp_start_p = start_p;\n  while (remaining > 0)\n  {\n    ecma_char_t ch;\n    lit_utf8_size_t read_size = lit_read_code_unit_from_cesu8 (temp_start_p, &ch);\n    ecma_stringbuilder_append_char (&builder, ch);\n    temp_start_p += read_size;\n    remaining--;\n  }\n  ECMA_FINALIZE_UTF8_STRING (start_p, utf8_str_size);\n  ecma_deref_ecma_string (filler_p);\n\n  /* 11 - 12 */\n  if (pad_on_start)\n  {\n    ecma_stringbuilder_append (&builder, original_str_val_p);\n  }\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_string_pad */\n\n/**\n * Create an empty string builder\n *\n * @return new string builder\n */\necma_stringbuilder_t\necma_stringbuilder_create (void)\n{\n  const lit_utf8_size_t initial_size = ECMA_ASCII_STRING_HEADER_SIZE;\n  ecma_stringbuilder_header_t *header_p = (ecma_stringbuilder_header_t *) jmem_heap_alloc_block (initial_size);\n  header_p->current_size = initial_size;\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_string_bytes (initial_size);\n#endif /* JERRY_MEM_STATS */\n\n  ecma_stringbuilder_t ret = { .header_p = header_p };\n  return ret;\n} /* ecma_stringbuilder_create */\n\n/**\n * Create a string builder from an ecma string\n *\n * @return new string builder\n */\necma_stringbuilder_t\necma_stringbuilder_create_from (ecma_string_t *string_p) /**< ecma string */\n{\n  const lit_utf8_size_t string_size = ecma_string_get_size (string_p);\n  const lit_utf8_size_t initial_size = string_size + ECMA_ASCII_STRING_HEADER_SIZE;\n\n  ecma_stringbuilder_header_t *header_p = (ecma_stringbuilder_header_t *) jmem_heap_alloc_block (initial_size);\n  header_p->current_size = initial_size;\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_string_bytes (initial_size);\n#endif /* JERRY_MEM_STATS */\n\n  ecma_string_to_cesu8_bytes (string_p, ECMA_STRINGBUILDER_STRING_PTR (header_p), string_size);\n\n  ecma_stringbuilder_t ret = { .header_p = header_p };\n  return ret;\n} /* ecma_stringbuilder_create_from */\n\n/**\n * Create a string builder from a raw string\n *\n * @return new string builder\n */\necma_stringbuilder_t\necma_stringbuilder_create_raw (const lit_utf8_byte_t *data_p, /**< pointer to data */\n                               const lit_utf8_size_t data_size) /**< size of the data */\n{\n  const lit_utf8_size_t initial_size = data_size + ECMA_ASCII_STRING_HEADER_SIZE;\n\n  ecma_stringbuilder_header_t *header_p = (ecma_stringbuilder_header_t *) jmem_heap_alloc_block (initial_size);\n  header_p->current_size = initial_size;\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_string_bytes (initial_size);\n#endif /* JERRY_MEM_STATS */\n\n  memcpy (ECMA_STRINGBUILDER_STRING_PTR (header_p), data_p, data_size);\n\n  ecma_stringbuilder_t ret = { .header_p = header_p };\n  return ret;\n} /* ecma_stringbuilder_create_raw */\n\n/**\n * Grow the underlying buffer of a string builder\n *\n * @return pointer to the end of the data in the underlying buffer\n */\nstatic lit_utf8_byte_t *\necma_stringbuilder_grow (ecma_stringbuilder_t *builder_p, /**< string builder */\n                         lit_utf8_size_t required_size) /**< required size */\n{\n  ecma_stringbuilder_header_t *header_p = builder_p->header_p;\n  JERRY_ASSERT (header_p != NULL);\n\n  const lit_utf8_size_t new_size = header_p->current_size + required_size;\n  header_p = jmem_heap_realloc_block (header_p, header_p->current_size, new_size);\n  header_p->current_size = new_size;\n  builder_p->header_p = header_p;\n\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_string_bytes (required_size);\n#endif /* JERRY_MEM_STATS */\n\n  return ((lit_utf8_byte_t *) header_p) + header_p->current_size - required_size;\n} /* ecma_stringbuilder_grow */\n\n/**\n * Get the current size of the string in a string builder\n *\n * @return the size of the string data\n */\nlit_utf8_size_t\necma_stringbuilder_get_size (ecma_stringbuilder_t *builder_p) /**< string builder */\n{\n  ecma_stringbuilder_header_t *header_p = builder_p->header_p;\n  JERRY_ASSERT (header_p != NULL);\n\n  return ECMA_STRINGBUILDER_STRING_SIZE (header_p);\n} /* ecma_stringbuilder_get_size */\n\n/**\n * Get pointer to the raw string data in a string builder\n *\n * @return pointer to the string data\n */\nlit_utf8_byte_t *\necma_stringbuilder_get_data (ecma_stringbuilder_t *builder_p) /**< string builder */\n{\n  ecma_stringbuilder_header_t *header_p = builder_p->header_p;\n  JERRY_ASSERT (header_p != NULL);\n\n  return ECMA_STRINGBUILDER_STRING_PTR (header_p);\n} /* ecma_stringbuilder_get_data */\n\n/**\n * Revert the string builder to a smaller size\n */\nvoid\necma_stringbuilder_revert (ecma_stringbuilder_t *builder_p, /**< string builder */\n                           const lit_utf8_size_t size) /**< new size */\n{\n  ecma_stringbuilder_header_t *header_p = builder_p->header_p;\n  JERRY_ASSERT (header_p != NULL);\n\n  const lit_utf8_size_t new_size = size + ECMA_ASCII_STRING_HEADER_SIZE;\n  JERRY_ASSERT (new_size <= header_p->current_size);\n\n#if JERRY_MEM_STATS\n  jmem_stats_free_string_bytes (header_p->current_size - new_size);\n#endif /* JERRY_MEM_STATS */\n\n  header_p = jmem_heap_realloc_block (header_p, header_p->current_size, new_size);\n  header_p->current_size = new_size;\n  builder_p->header_p = header_p;\n} /* ecma_stringbuilder_revert */\n\n/**\n * Append an ecma_string_t to a string builder\n */\nvoid\necma_stringbuilder_append (ecma_stringbuilder_t *builder_p, /**< string builder */\n                           const ecma_string_t *string_p) /**< ecma string */\n{\n  const lit_utf8_size_t string_size = ecma_string_get_size (string_p);\n  lit_utf8_byte_t *dest_p = ecma_stringbuilder_grow (builder_p, string_size);\n\n  ecma_string_to_cesu8_bytes (string_p, dest_p, string_size);\n} /* ecma_stringbuilder_append */\n\n/**\n * Append a magic string to a string builder\n */\nvoid\necma_stringbuilder_append_magic (ecma_stringbuilder_t *builder_p, /**< string builder */\n                                 const lit_magic_string_id_t id) /**< magic string id */\n{\n  const lit_utf8_size_t string_size = lit_get_magic_string_size (id);\n  lit_utf8_byte_t *dest_p = ecma_stringbuilder_grow (builder_p, string_size);\n\n  const lit_utf8_byte_t *string_data_p = lit_get_magic_string_utf8 (id);\n  memcpy (dest_p, string_data_p, string_size);\n} /* ecma_stringbuilder_append_magic */\n\n/**\n * Append raw string data to a string builder\n */\nvoid\necma_stringbuilder_append_raw (ecma_stringbuilder_t *builder_p, /**< string builder */\n                               const lit_utf8_byte_t *data_p, /**< pointer to data */\n                               const lit_utf8_size_t data_size) /**< size of the data */\n{\n  lit_utf8_byte_t *dest_p = ecma_stringbuilder_grow (builder_p, data_size);\n  memcpy (dest_p, data_p, data_size);\n} /* ecma_stringbuilder_append_raw */\n\n/**\n * Append a codepoint to a string builder\n */\nvoid\necma_stringbuilder_append_codepoint (ecma_stringbuilder_t *builder_p, /**< string builder */\n                                     lit_code_point_t cp) /**< code point */\n{\n  const lit_utf8_size_t size = (lit_utf8_size_t) lit_code_point_get_cesu8_length (cp);\n  lit_utf8_byte_t *dest_p = ecma_stringbuilder_grow (builder_p, size);\n\n  lit_code_point_to_cesu8_bytes (dest_p, cp);\n} /* ecma_stringbuilder_append_codepoint */\n\n/**\n * Append an ecma_char_t to a string builder\n */\nvoid\necma_stringbuilder_append_char (ecma_stringbuilder_t *builder_p, /**< string builder */\n                                const ecma_char_t c) /**< ecma char */\n{\n  ecma_stringbuilder_append_codepoint (builder_p, c);\n} /* ecma_stringbuilder_append_char */\n\n/**\n * Append a single byte to a string builder\n */\nvoid\necma_stringbuilder_append_byte (ecma_stringbuilder_t *builder_p, /**< string builder */\n                                const lit_utf8_byte_t byte) /**< byte */\n{\n  lit_utf8_byte_t *dest_p = ecma_stringbuilder_grow (builder_p, 1);\n  *dest_p = byte;\n} /* ecma_stringbuilder_append_byte */\n\n/**\n * Finalize a string builder, returning the created string, and releasing the underlying buffer.\n *\n * Note:\n *      The builder should no longer be used.\n *\n * @return the created string\n */\necma_string_t *\necma_stringbuilder_finalize (ecma_stringbuilder_t *builder_p) /**< string builder */\n{\n  ecma_stringbuilder_header_t *header_p = builder_p->header_p;\n  JERRY_ASSERT (header_p != NULL);\n\n  const lit_utf8_size_t string_size = ECMA_STRINGBUILDER_STRING_SIZE (header_p);\n  lit_utf8_byte_t *string_begin_p = ECMA_STRINGBUILDER_STRING_PTR (header_p);\n\n  ecma_string_t *string_p = ecma_find_special_string (string_begin_p, string_size);\n\n  if (JERRY_UNLIKELY (string_p != NULL))\n  {\n    ecma_stringbuilder_destroy (builder_p);\n    return string_p;\n  }\n\n#ifndef JERRY_NDEBUG\n  builder_p->header_p = NULL;\n#endif /* !defined (JERRY_NDEBUG) */\n\n  size_t container_size = sizeof (ecma_short_string_t);\n  const lit_string_hash_t hash = lit_utf8_string_calc_hash (string_begin_p, string_size);\n  const lit_utf8_size_t length = lit_utf8_string_length (string_begin_p, string_size);\n\n  if (JERRY_LIKELY (string_size <= UINT16_MAX))\n  {\n    if (JERRY_LIKELY (length == string_size) && string_size <= (UINT8_MAX + 1))\n    {\n      string_p = (ecma_string_t *) header_p;\n      string_p->refs_and_container = ECMA_STRING_CONTAINER_HEAP_ASCII_STRING | ECMA_STRING_REF_ONE;\n      string_p->u.hash = hash;\n      ECMA_ASCII_STRING_SET_SIZE (string_p, string_size);\n\n      return (ecma_string_t *) string_p;\n    }\n  }\n  else\n  {\n    container_size = sizeof (ecma_long_string_t);\n  }\n\n  const size_t utf8_string_size = string_size + container_size;\n  header_p = jmem_heap_realloc_block (header_p, header_p->current_size, utf8_string_size);\n  memmove (((lit_utf8_byte_t *) header_p + container_size), ECMA_STRINGBUILDER_STRING_PTR (header_p), string_size);\n\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_string_bytes (container_size - ECMA_ASCII_STRING_HEADER_SIZE);\n#endif /* JERRY_MEM_STATS */\n\n  if (JERRY_LIKELY (string_size <= UINT16_MAX))\n  {\n    ecma_short_string_t *short_string_p = (ecma_short_string_t *) header_p;\n\n    short_string_p->header.refs_and_container = ECMA_STRING_CONTAINER_HEAP_UTF8_STRING | ECMA_STRING_REF_ONE;\n    short_string_p->header.u.hash = hash;\n    short_string_p->size = (uint16_t) string_size;\n    short_string_p->length = (uint16_t) length;\n\n    return (ecma_string_t *) short_string_p;\n  }\n\n  ecma_long_string_t *long_string_p = (ecma_long_string_t *) header_p;\n\n  long_string_p->header.refs_and_container = ECMA_STRING_CONTAINER_LONG_OR_EXTERNAL_STRING | ECMA_STRING_REF_ONE;\n  long_string_p->header.u.hash = hash;\n  long_string_p->string_p = ECMA_LONG_STRING_BUFFER_START (long_string_p);\n  long_string_p->size = string_size;\n  long_string_p->length = length;\n\n  return (ecma_string_t *) long_string_p;\n} /* ecma_stringbuilder_finalize */\n\n/**\n * Destroy a string builder that is no longer needed without creating a string from the contents.\n */\nvoid\necma_stringbuilder_destroy (ecma_stringbuilder_t *builder_p) /**< string builder */\n{\n  JERRY_ASSERT (builder_p->header_p != NULL);\n  const lit_utf8_size_t size = builder_p->header_p->current_size;\n  jmem_heap_free_block (builder_p->header_p, size);\n\n#ifndef JERRY_NDEBUG\n  builder_p->header_p = NULL;\n#endif /* !defined (JERRY_NDEBUG) */\n\n#if JERRY_MEM_STATS\n  jmem_stats_free_string_bytes (size);\n#endif /* JERRY_MEM_STATS */\n} /* ecma_stringbuilder_destroy */\n\n/**\n * AdvanceStringIndex operation\n *\n * See also:\n *          ECMA-262 v6.0, 21.2.5.2.3\n *\n * @return uint32_t - the proper character index based on the operation\n */\necma_length_t\necma_op_advance_string_index (ecma_string_t *str_p, /**< input string */\n                              ecma_length_t index, /**< given character index */\n                              bool is_unicode) /**< true - if regexp object's \"unicode\" flag is set\n                                                    false - otherwise */\n{\n  JERRY_ASSERT ((ecma_number_t) index <= ECMA_NUMBER_MAX_SAFE_INTEGER);\n  ecma_length_t next_index = index + 1;\n\n  if (!is_unicode)\n  {\n    return next_index;\n  }\n\n  lit_utf8_size_t str_len = ecma_string_get_length (str_p);\n\n  if (next_index >= str_len)\n  {\n    return next_index;\n  }\n\n  JERRY_ASSERT (index < UINT32_MAX);\n  ecma_char_t first = ecma_string_get_char_at_pos (str_p, (lit_utf8_size_t) index);\n\n  if (!lit_is_code_point_utf16_high_surrogate (first))\n  {\n    return next_index;\n  }\n\n  ecma_char_t second = ecma_string_get_char_at_pos (str_p, (lit_utf8_size_t) next_index);\n\n  if (!lit_is_code_point_utf16_low_surrogate (second))\n  {\n    return next_index;\n  }\n\n  return next_index + 1;\n} /* ecma_op_advance_string_index */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-helpers-value.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n\n#include \"jrt-bit-fields.h\"\n#include \"jrt.h\"\n#include \"vm-defines.h\"\n\nJERRY_STATIC_ASSERT (ECMA_TYPE___MAX <= ECMA_VALUE_TYPE_MASK, ecma_types_must_be_less_than_mask);\n\nJERRY_STATIC_ASSERT ((ECMA_VALUE_TYPE_MASK + 1) == (1 << ECMA_VALUE_SHIFT), ecma_value_part_must_start_after_flags);\n\nJERRY_STATIC_ASSERT (ECMA_VALUE_SHIFT <= JMEM_ALIGNMENT_LOG,\n                     ecma_value_shift_must_be_less_than_or_equal_than_mem_alignment_log);\n\nJERRY_STATIC_ASSERT (sizeof (jmem_cpointer_t) <= sizeof (ecma_value_t),\n                     size_of_jmem_cpointer_t_must_be_less_or_equal_to_the_size_of_ecma_value_t);\n\nJERRY_STATIC_ASSERT (sizeof (jmem_cpointer_t) <= sizeof (jmem_cpointer_tag_t),\n                     size_of_jmem_cpointer_t_must_be_less_or_equal_to_the_size_of_jmem_cpointer_tag_t);\n\n#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY\n\n/* cppcheck-suppress zerodiv */\nJERRY_STATIC_ASSERT (sizeof (uintptr_t) <= sizeof (ecma_value_t), uintptr_t_must_fit_in_ecma_value_t);\n\n#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */\n\nJERRY_STATIC_ASSERT (sizeof (uintptr_t) > sizeof (ecma_value_t), uintptr_t_must_not_fit_in_ecma_value_t);\n\n#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */\n\nJERRY_STATIC_ASSERT ((ECMA_VALUE_FALSE | (1 << ECMA_DIRECT_SHIFT)) == ECMA_VALUE_TRUE\n                       && ECMA_VALUE_FALSE != ECMA_VALUE_TRUE,\n                     only_the_lowest_bit_must_be_different_for_simple_value_true_and_false);\n\n#if JERRY_BUILTIN_BIGINT\n\nJERRY_STATIC_ASSERT (ECMA_NULL_POINTER == (ECMA_BIGINT_ZERO & ~(ecma_value_t) ECMA_VALUE_TYPE_MASK),\n                     ecma_bigint_zero_must_be_encoded_as_null_pointer);\n\n#endif /* JERRY_BUILTIN_BIGINT */\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmahelpers Helpers for operations with ECMA data types\n * @{\n */\n\n/**\n * Get type field of ecma value\n *\n * @return type field\n */\nextern inline ecma_type_t JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_get_value_type_field (ecma_value_t value) /**< ecma value */\n{\n  return value & ECMA_VALUE_TYPE_MASK;\n} /* ecma_get_value_type_field */\n\n/**\n * Convert a pointer into an ecma value.\n *\n * @return ecma value\n */\nstatic inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_pointer_to_ecma_value (const void *ptr) /**< pointer */\n{\n#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY\n\n  JERRY_ASSERT (ptr != NULL);\n  uintptr_t uint_ptr = (uintptr_t) ptr;\n  JERRY_ASSERT ((uint_ptr & ECMA_VALUE_TYPE_MASK) == 0);\n  return (ecma_value_t) uint_ptr;\n\n#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */\n\n  jmem_cpointer_t ptr_cp;\n  ECMA_SET_NON_NULL_POINTER (ptr_cp, ptr);\n  return ((ecma_value_t) ptr_cp) << ECMA_VALUE_SHIFT;\n\n#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */\n} /* ecma_pointer_to_ecma_value */\n\n/**\n * Get a pointer from an ecma value\n *\n * @return pointer\n */\nstatic inline void *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_get_pointer_from_ecma_value (ecma_value_t value) /**< value */\n{\n#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY\n  void *ptr = (void *) (uintptr_t) ((value) & ~ECMA_VALUE_TYPE_MASK);\n  JERRY_ASSERT (ptr != NULL);\n  return ptr;\n#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */\n  return ECMA_GET_NON_NULL_POINTER (void, value >> ECMA_VALUE_SHIFT);\n#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */\n} /* ecma_get_pointer_from_ecma_value */\n\n/**\n * Check if the value is direct ecma-value.\n *\n * @return true - if the value is a direct value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_direct (ecma_value_t value) /**< ecma value */\n{\n  return (ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT);\n} /* ecma_is_value_direct */\n\n/**\n * Check if the value is simple ecma-value.\n *\n * @return true - if the value is a simple value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_simple (ecma_value_t value) /**< ecma value */\n{\n  return (value & ECMA_DIRECT_TYPE_MASK) == ECMA_DIRECT_TYPE_SIMPLE_VALUE;\n} /* ecma_is_value_simple */\n\n/**\n * Check whether the value is a given simple value.\n *\n * @return true - if the value is equal to the given simple value,\n *         false - otherwise\n */\nstatic inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_equal_to_simple_value (ecma_value_t value, /**< ecma value */\n                                     ecma_value_t simple_value) /**< simple value */\n{\n  return value == simple_value;\n} /* ecma_is_value_equal_to_simple_value */\n\n/**\n * Check if the value is empty.\n *\n * @return true - if the value contains implementation-defined empty simple value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_empty (ecma_value_t value) /**< ecma value */\n{\n  return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_EMPTY);\n} /* ecma_is_value_empty */\n\n/**\n * Check if the value is undefined.\n *\n * @return true - if the value contains ecma-undefined simple value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_undefined (ecma_value_t value) /**< ecma value */\n{\n  return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_UNDEFINED);\n} /* ecma_is_value_undefined */\n\n/**\n * Check if the value is null.\n *\n * @return true - if the value contains ecma-null simple value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_null (ecma_value_t value) /**< ecma value */\n{\n  return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_NULL);\n} /* ecma_is_value_null */\n\n/**\n * Check if the value is boolean.\n *\n * @return true - if the value contains ecma-true or ecma-false simple values,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_boolean (ecma_value_t value) /**< ecma value */\n{\n  return ecma_is_value_true (value | (1 << ECMA_DIRECT_SHIFT));\n} /* ecma_is_value_boolean */\n\n/**\n * Check if the value is true.\n *\n * @return true - if the value contains ecma-true simple value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_true (ecma_value_t value) /**< ecma value */\n{\n  return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_TRUE);\n} /* ecma_is_value_true */\n\n/**\n * Check if the value is false.\n *\n * @return true - if the value contains ecma-false simple value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_false (ecma_value_t value) /**< ecma value */\n{\n  return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_FALSE);\n} /* ecma_is_value_false */\n\n/**\n * Check if the value is not found.\n *\n * @return true - if the value contains ecma-not-found simple value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_found (ecma_value_t value) /**< ecma value */\n{\n  return value != ECMA_VALUE_NOT_FOUND;\n} /* ecma_is_value_found */\n\n/**\n * Check if the value is array hole.\n *\n * @return true - if the value contains ecma-array-hole simple value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_array_hole (ecma_value_t value) /**< ecma value */\n{\n  return ecma_is_value_equal_to_simple_value (value, ECMA_VALUE_ARRAY_HOLE);\n} /* ecma_is_value_array_hole */\n\n/**\n * Check if the value is integer ecma-number.\n *\n * @return true - if the value contains an integer ecma-number value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_integer_number (ecma_value_t value) /**< ecma value */\n{\n  return (value & ECMA_DIRECT_TYPE_MASK) == ECMA_DIRECT_TYPE_INTEGER_VALUE;\n} /* ecma_is_value_integer_number */\n\n/**\n * Check if both values are integer ecma-numbers.\n *\n * @return true - if both values contain integer ecma-number values,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_are_values_integer_numbers (ecma_value_t first_value, /**< first ecma value */\n                                 ecma_value_t second_value) /**< second ecma value */\n{\n  JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_INTEGER_VALUE == 0, ecma_direct_type_integer_value_must_be_zero);\n\n  return ((first_value | second_value) & ECMA_DIRECT_TYPE_MASK) == ECMA_DIRECT_TYPE_INTEGER_VALUE;\n} /* ecma_are_values_integer_numbers */\n\n/**\n * Check if the value is floating-point ecma-number.\n *\n * @return true - if the value contains a floating-point ecma-number value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_float_number (ecma_value_t value) /**< ecma value */\n{\n  return (ecma_get_value_type_field (value) == ECMA_TYPE_FLOAT);\n} /* ecma_is_value_float_number */\n\n/**\n * Check if the value is ecma-number.\n *\n * @return true - if the value contains ecma-number value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_number (ecma_value_t value) /**< ecma value */\n{\n  return (ecma_is_value_integer_number (value) || ecma_is_value_float_number (value));\n} /* ecma_is_value_number */\n\nJERRY_STATIC_ASSERT ((ECMA_TYPE_STRING | 0x4) == ECMA_TYPE_DIRECT_STRING,\n                     ecma_type_string_and_direct_string_must_have_one_bit_difference);\n\n/**\n * Check if the value is ecma-string.\n *\n * @return true - if the value contains ecma-string value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_string (ecma_value_t value) /**< ecma value */\n{\n  return ((value & (ECMA_VALUE_TYPE_MASK - 0x4)) == ECMA_TYPE_STRING);\n} /* ecma_is_value_string */\n\n/**\n * Check if the value is symbol.\n *\n * @return true - if the value contains symbol value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_symbol (ecma_value_t value) /**< ecma value */\n{\n  return (ecma_get_value_type_field (value) == ECMA_TYPE_SYMBOL);\n} /* ecma_is_value_symbol */\n\n/**\n * Check if the value is a specific magic string.\n *\n * @return true - if the value the magic string value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_magic_string (ecma_value_t value, /**< ecma value */\n                            lit_magic_string_id_t id) /**< magic string id */\n{\n  return value == ecma_make_magic_string_value (id);\n} /* ecma_is_value_magic_string */\n\n/**\n * Check if the value is bigint.\n *\n * @return true - if the value contains bigint value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_bigint (ecma_value_t value) /**< ecma value */\n{\n#if JERRY_BUILTIN_BIGINT\n  return (ecma_get_value_type_field (value) == ECMA_TYPE_BIGINT);\n#else /* !JERRY_BUILTIN_BIGINT */\n  JERRY_UNUSED (value);\n  return false;\n#endif /* JERRY_BUILTIN_BIGINT */\n} /* ecma_is_value_bigint */\n\n/**\n * Check if the value can be property name.\n *\n * @return true - if the value can be property name value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_prop_name (ecma_value_t value) /**< ecma value */\n{\n  return ecma_is_value_string (value) || ecma_is_value_symbol (value);\n} /* ecma_is_value_prop_name */\n\n/**\n * Check if the value is direct ecma-string.\n *\n * @return true - if the value contains direct ecma-string value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_direct_string (ecma_value_t value) /**< ecma value */\n{\n  return (ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT_STRING);\n} /* ecma_is_value_direct_string */\n\n/**\n * Check if the value is non-direct ecma-string.\n *\n * @return true - if the value contains non-direct ecma-string value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_non_direct_string (ecma_value_t value) /**< ecma value */\n{\n  return (ecma_get_value_type_field (value) == ECMA_TYPE_STRING);\n} /* ecma_is_value_non_direct_string */\n\n/**\n * Check if the value is object.\n *\n * @return true - if the value contains object value,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_object (ecma_value_t value) /**< ecma value */\n{\n  return (ecma_get_value_type_field (value) == ECMA_TYPE_OBJECT);\n} /* ecma_is_value_object */\n\n/**\n * Check if the value is error reference.\n *\n * @return true - if the value contains an error reference,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_value_exception (ecma_value_t value) /**< ecma value */\n{\n  return (ecma_get_value_type_field (value) == ECMA_TYPE_ERROR);\n} /* ecma_is_value_exception */\n\n/**\n * Debug assertion that specified value's type is one of ECMA-defined\n * script-visible types, i.e.: undefined, null, boolean, number, string, object.\n */\nvoid\necma_check_value_type_is_spec_defined (ecma_value_t value) /**< ecma value */\n{\n  JERRY_ASSERT (ecma_is_value_undefined (value) || ecma_is_value_null (value) || ecma_is_value_boolean (value)\n                || ecma_is_value_number (value) || ecma_is_value_string (value) || ecma_is_value_bigint (value)\n                || ecma_is_value_symbol (value) || ecma_is_value_object (value));\n} /* ecma_check_value_type_is_spec_defined */\n\n/**\n * Checks if the given argument is an array or not.\n *\n * @return ECMA_VALUE_ERROR- if the operation fails\n *         ECMA_VALUE_{TRUE/FALSE} - depends on whether 'arg' is an array object\n */\necma_value_t\necma_is_value_array (ecma_value_t arg) /**< argument */\n{\n  if (!ecma_is_value_object (arg))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_object_t *arg_obj_p = ecma_get_object_from_value (arg);\n\n  if (ecma_get_object_base_type (arg_obj_p) == ECMA_OBJECT_BASE_TYPE_ARRAY)\n  {\n    return ECMA_VALUE_TRUE;\n  }\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (arg_obj_p))\n  {\n    ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) arg_obj_p;\n\n    if (proxy_obj_p->handler == ECMA_VALUE_NULL)\n    {\n      return ecma_raise_type_error (ECMA_ERR_PROXY_HANDLER_IS_NULL_FOR_ISARRAY_OPERATION);\n    }\n\n    return ecma_is_value_array (proxy_obj_p->target);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  return ECMA_VALUE_FALSE;\n} /* ecma_is_value_array */\n\n/**\n * Creates an ecma value from the given raw boolean.\n *\n * @return boolean ecma_value\n */\nextern inline ecma_value_t JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_make_boolean_value (bool boolean_value) /**< raw bool value from which the ecma value will be created */\n{\n  return boolean_value ? ECMA_VALUE_TRUE : ECMA_VALUE_FALSE;\n} /* ecma_make_boolean_value */\n\n/**\n * Encode an integer number into an ecma-value without allocating memory\n *\n * Note:\n *   The value must fit into the range of allowed ecma integer values\n *\n * @return ecma-value\n */\nextern inline ecma_value_t JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_make_integer_value (ecma_integer_value_t integer_value) /**< integer number to be encoded */\n{\n  JERRY_ASSERT (ECMA_IS_INTEGER_NUMBER (integer_value));\n\n  return (((ecma_value_t) integer_value) << ECMA_DIRECT_SHIFT) | ECMA_DIRECT_TYPE_INTEGER_VALUE;\n} /* ecma_make_integer_value */\n\n/**\n * Allocate and initialize a new float number without checks.\n *\n * @return ecma-value\n */\nstatic ecma_value_t\necma_create_float_number (ecma_number_t ecma_number) /**< value of the float number */\n{\n  ecma_number_t *ecma_num_p = ecma_alloc_number ();\n\n  *ecma_num_p = ecma_number;\n\n  return ecma_pointer_to_ecma_value (ecma_num_p) | ECMA_TYPE_FLOAT;\n} /* ecma_create_float_number */\n\n/**\n * Encode float number without checks.\n *\n * @return ecma-value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_make_float_value (ecma_number_t *ecma_num_p) /**< pointer to the float number */\n{\n  return ecma_pointer_to_ecma_value (ecma_num_p) | ECMA_TYPE_FLOAT;\n} /* ecma_make_float_value */\n\n/**\n * Create a new NaN value.\n *\n * @return ecma-value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_CONST\necma_make_nan_value (void)\n{\n  return ecma_create_float_number (ecma_number_make_nan ());\n} /* ecma_make_nan_value */\n\n/**\n * Checks whether the passed number is +0.0\n *\n * @return true, if it is +0.0, false otherwise\n */\nstatic inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_is_number_equal_to_positive_zero (ecma_number_t ecma_number) /**< number */\n{\n  return ecma_number_to_binary (ecma_number) == ECMA_NUMBER_BINARY_ZERO;\n} /* ecma_is_number_equal_to_positive_zero */\n\n/**\n * Encode a property length number into an ecma-value\n *\n * @return ecma-value\n */\necma_value_t\necma_make_length_value (ecma_length_t number) /**< number to be encoded */\n{\n  if (number <= ECMA_INTEGER_NUMBER_MAX)\n  {\n    return ecma_make_integer_value ((ecma_integer_value_t) number);\n  }\n\n  return ecma_create_float_number ((ecma_number_t) number);\n} /* ecma_make_length_value */\n\n/**\n * Encode a number into an ecma-value\n *\n * @return ecma-value\n */\necma_value_t\necma_make_number_value (ecma_number_t ecma_number) /**< number to be encoded */\n{\n  ecma_integer_value_t integer_value = (ecma_integer_value_t) ecma_number;\n\n  if ((ecma_number_t) integer_value == ecma_number\n      && ((integer_value == 0) ? ecma_is_number_equal_to_positive_zero (ecma_number)\n                               : ECMA_IS_INTEGER_NUMBER (integer_value)))\n  {\n    return ecma_make_integer_value (integer_value);\n  }\n\n  return ecma_create_float_number (ecma_number);\n} /* ecma_make_number_value */\n\n/**\n * Encode an int32 number into an ecma-value\n *\n * @return ecma-value\n */\necma_value_t\necma_make_int32_value (int32_t int32_number) /**< int32 number to be encoded */\n{\n  if (ECMA_IS_INTEGER_NUMBER (int32_number))\n  {\n    return ecma_make_integer_value ((ecma_integer_value_t) int32_number);\n  }\n\n  return ecma_create_float_number ((ecma_number_t) int32_number);\n} /* ecma_make_int32_value */\n\n/**\n * Encode an unsigned int32 number into an ecma-value\n *\n * @return ecma-value\n */\necma_value_t\necma_make_uint32_value (uint32_t uint32_number) /**< uint32 number to be encoded */\n{\n  if (uint32_number <= ECMA_INTEGER_NUMBER_MAX)\n  {\n    return ecma_make_integer_value ((ecma_integer_value_t) uint32_number);\n  }\n\n  return ecma_create_float_number ((ecma_number_t) uint32_number);\n} /* ecma_make_uint32_value */\n\n/**\n * String value constructor\n *\n * @return ecma-value representation of the string argument\n */\nextern inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_make_string_value (const ecma_string_t *ecma_string_p) /**< string to reference in value */\n{\n  JERRY_ASSERT (ecma_string_p != NULL);\n  JERRY_ASSERT (!ecma_prop_name_is_symbol ((ecma_string_t *) ecma_string_p));\n\n  if ((((uintptr_t) ecma_string_p) & ECMA_VALUE_TYPE_MASK) != 0)\n  {\n    return (ecma_value_t) (uintptr_t) ecma_string_p;\n  }\n\n  return ecma_pointer_to_ecma_value (ecma_string_p) | ECMA_TYPE_STRING;\n} /* ecma_make_string_value */\n\n/**\n * Symbol value constructor\n *\n * @return ecma-value representation of the string argument\n */\nextern inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_make_symbol_value (const ecma_string_t *ecma_symbol_p) /**< symbol to reference in value */\n{\n  JERRY_ASSERT (ecma_symbol_p != NULL);\n  JERRY_ASSERT (ecma_prop_name_is_symbol ((ecma_string_t *) ecma_symbol_p));\n\n  return ecma_pointer_to_ecma_value (ecma_symbol_p) | ECMA_TYPE_SYMBOL;\n} /* ecma_make_symbol_value */\n\n/**\n * Property-name value constructor\n *\n * @return ecma-value representation of a property name argument\n */\nextern inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_make_prop_name_value (const ecma_string_t *ecma_prop_name_p) /**< property name to reference in value */\n{\n  JERRY_ASSERT (ecma_prop_name_p != NULL);\n\n  if (ecma_prop_name_is_symbol ((ecma_string_t *) ecma_prop_name_p))\n  {\n    return ecma_make_symbol_value (ecma_prop_name_p);\n  }\n\n  return ecma_make_string_value (ecma_prop_name_p);\n} /* ecma_make_prop_name_value */\n\n/**\n * String value constructor\n *\n * @return ecma-value representation of the string argument\n */\nextern inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_make_magic_string_value (lit_magic_string_id_t id) /**< magic string id */\n{\n  return (ecma_value_t) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_MAGIC, (uintptr_t) id);\n} /* ecma_make_magic_string_value */\n\n/**\n * Object value constructor\n *\n * @return ecma-value representation of the object argument\n */\nextern inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_make_object_value (const ecma_object_t *object_p) /**< object to reference in value */\n{\n  JERRY_ASSERT (object_p != NULL);\n\n  return ecma_pointer_to_ecma_value (object_p) | ECMA_TYPE_OBJECT;\n} /* ecma_make_object_value */\n\n/**\n * Error reference constructor\n *\n * @return ecma-value representation of the Error reference\n */\nextern inline ecma_value_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_make_extended_primitive_value (const ecma_extended_primitive_t *primitve_p, /**< extended primitve value */\n                                    uint32_t type) /**< ecma type of extended primitve value */\n{\n  JERRY_ASSERT (primitve_p != NULL);\n#if JERRY_BUILTIN_BIGINT\n  JERRY_ASSERT (primitve_p != ECMA_BIGINT_POINTER_TO_ZERO);\n#endif /* JERRY_BUILTIN_BIGINT */\n  JERRY_ASSERT (type == ECMA_TYPE_BIGINT || type == ECMA_TYPE_ERROR);\n\n  return ecma_pointer_to_ecma_value (primitve_p) | type;\n} /* ecma_make_extended_primitive_value */\n\n/**\n * Get integer value from an integer ecma value\n *\n * @return integer value\n */\nextern inline ecma_integer_value_t JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_get_integer_from_value (ecma_value_t value) /**< ecma value */\n{\n  JERRY_ASSERT (ecma_is_value_integer_number (value));\n\n  return ((ecma_integer_value_t) value) >> ECMA_DIRECT_SHIFT;\n} /* ecma_get_integer_from_value */\n\n/**\n * Get floating point value from an ecma value\n *\n * @return floating point value\n */\nextern inline ecma_number_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_get_float_from_value (ecma_value_t value) /**< ecma value */\n{\n  JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_FLOAT);\n\n  return *(ecma_number_t *) ecma_get_pointer_from_ecma_value (value);\n} /* ecma_get_float_from_value */\n\n/**\n * Get floating point value pointer from an ecma value\n *\n * @return floating point value\n */\nextern inline ecma_number_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_get_pointer_from_float_value (ecma_value_t value) /**< ecma value */\n{\n  JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_FLOAT);\n\n  return (ecma_number_t *) ecma_get_pointer_from_ecma_value (value);\n} /* ecma_get_pointer_from_float_value */\n\n/**\n * Get floating point value from an ecma value\n *\n * @return floating point value\n */\necma_number_t JERRY_ATTR_PURE\necma_get_number_from_value (ecma_value_t value) /**< ecma value */\n{\n  if (ecma_is_value_integer_number (value))\n  {\n    return (ecma_number_t) ecma_get_integer_from_value (value);\n  }\n\n  return ecma_get_float_from_value (value);\n} /* ecma_get_number_from_value */\n\n/**\n * Get pointer to ecma-string from ecma value\n *\n * @return the string pointer\n */\nextern inline ecma_string_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_get_string_from_value (ecma_value_t value) /**< ecma value */\n{\n  JERRY_ASSERT (ecma_is_value_string (value));\n\n  if ((value & ECMA_VALUE_TYPE_MASK) == ECMA_TYPE_DIRECT_STRING)\n  {\n    return (ecma_string_t *) (uintptr_t) value;\n  }\n\n  return (ecma_string_t *) ecma_get_pointer_from_ecma_value (value);\n} /* ecma_get_string_from_value */\n\n/**\n * Get pointer to ecma-string from ecma value\n *\n * @return the string pointer\n */\nextern inline ecma_string_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_get_symbol_from_value (ecma_value_t value) /**< ecma value */\n{\n  JERRY_ASSERT (ecma_is_value_symbol (value));\n\n  return (ecma_string_t *) ecma_get_pointer_from_ecma_value (value);\n} /* ecma_get_symbol_from_value */\n\n/**\n * Get pointer to a property name from ecma value\n *\n * @return the string pointer\n */\nextern inline ecma_string_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_get_prop_name_from_value (ecma_value_t value) /**< ecma value */\n{\n  JERRY_ASSERT (ecma_is_value_prop_name (value));\n\n  if ((value & ECMA_VALUE_TYPE_MASK) == ECMA_TYPE_DIRECT_STRING)\n  {\n    return (ecma_string_t *) (uintptr_t) value;\n  }\n\n  return (ecma_string_t *) ecma_get_pointer_from_ecma_value (value);\n} /* ecma_get_prop_name_from_value */\n\n/**\n * Get pointer to ecma-object from ecma value\n *\n * @return the pointer\n */\nextern inline ecma_object_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_get_object_from_value (ecma_value_t value) /**< ecma value */\n{\n  JERRY_ASSERT (ecma_is_value_object (value));\n\n  return (ecma_object_t *) ecma_get_pointer_from_ecma_value (value);\n} /* ecma_get_object_from_value */\n\n/**\n * Get pointer to error reference from ecma value\n *\n * @return the pointer\n */\nextern inline ecma_extended_primitive_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_get_extended_primitive_from_value (ecma_value_t value) /**< ecma value */\n{\n#if JERRY_BUILTIN_BIGINT\n  JERRY_ASSERT (value != ECMA_BIGINT_ZERO);\n#endif /* JERRY_BUILTIN_BIGINT */\n  JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_BIGINT\n                || ecma_get_value_type_field (value) == ECMA_TYPE_ERROR);\n\n  return (ecma_extended_primitive_t *) ecma_get_pointer_from_ecma_value (value);\n} /* ecma_get_extended_primitive_from_value */\n\n/**\n * Invert a boolean value\n *\n * @return ecma value\n */\nextern inline ecma_value_t JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE\necma_invert_boolean_value (ecma_value_t value) /**< ecma value */\n{\n  JERRY_ASSERT (ecma_is_value_boolean (value));\n\n  return (value ^ (1 << ECMA_DIRECT_SHIFT));\n} /* ecma_invert_boolean_value */\n\n/**\n * Copy ecma value.\n *\n * @return copy of the given value\n */\necma_value_t\necma_copy_value (ecma_value_t value) /**< value description */\n{\n  switch (ecma_get_value_type_field (value))\n  {\n    case ECMA_TYPE_FLOAT:\n    {\n      ecma_number_t *num_p = (ecma_number_t *) ecma_get_pointer_from_ecma_value (value);\n      ecma_number_t *new_num_p = ecma_alloc_number ();\n\n      *new_num_p = *num_p;\n\n      return ecma_make_float_value (new_num_p);\n    }\n    case ECMA_TYPE_SYMBOL:\n    case ECMA_TYPE_STRING:\n    {\n      ecma_string_t *string_p = (ecma_string_t *) ecma_get_pointer_from_ecma_value (value);\n      ecma_ref_ecma_string_non_direct (string_p);\n      return value;\n    }\n#if JERRY_BUILTIN_BIGINT\n    case ECMA_TYPE_BIGINT:\n    {\n      if (value != ECMA_BIGINT_ZERO)\n      {\n        ecma_ref_extended_primitive (ecma_get_extended_primitive_from_value (value));\n      }\n      return value;\n    }\n#endif /* JERRY_BUILTIN_BIGINT */\n    case ECMA_TYPE_OBJECT:\n    {\n      ecma_ref_object_inline (ecma_get_object_from_value (value));\n      return value;\n    }\n    default:\n    {\n      JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT\n                    || ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT_STRING);\n\n      return value;\n    }\n  }\n} /* ecma_copy_value */\n\n/**\n * Copy ecma value.\n *\n * Note:\n *   this function is similar to ecma_copy_value, but it is\n *   faster for direct values since no function call is performed.\n *   It also increases the binary size so it is recommended for\n *   critical code paths only.\n *\n * @return copy of the given value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_fast_copy_value (ecma_value_t value) /**< value description */\n{\n  return (ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT) ? value : ecma_copy_value (value);\n} /* ecma_fast_copy_value */\n\n/**\n * Copy the ecma value if not an object\n *\n * @return copy of the given value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_copy_value_if_not_object (ecma_value_t value) /**< value description */\n{\n  if (!ecma_is_value_object (value))\n  {\n    return ecma_copy_value (value);\n  }\n\n  return value;\n} /* ecma_copy_value_if_not_object */\n\n/**\n * Increase reference counter of a value if it is an object.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_ref_if_object (ecma_value_t value) /**< value description */\n{\n  if (ecma_is_value_object (value))\n  {\n    ecma_ref_object (ecma_get_object_from_value (value));\n  }\n} /* ecma_ref_if_object */\n\n/**\n * Decrease reference counter of a value if it is an object.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_deref_if_object (ecma_value_t value) /**< value description */\n{\n  if (ecma_is_value_object (value))\n  {\n    ecma_deref_object (ecma_get_object_from_value (value));\n  }\n} /* ecma_deref_if_object */\n\n/**\n * Assign a new value to an ecma-value\n *\n * Note:\n *      value previously stored in the property is freed\n */\nvoid\necma_value_assign_value (ecma_value_t *value_p, /**< [in, out] ecma value */\n                         ecma_value_t ecma_value) /**< value to assign */\n{\n  JERRY_STATIC_ASSERT (ECMA_TYPE_DIRECT == 0, ecma_type_direct_must_be_zero_for_the_next_check);\n\n  if (*value_p == ecma_value)\n  {\n    return;\n  }\n\n  if (ecma_get_value_type_field (ecma_value || *value_p) == ECMA_TYPE_DIRECT)\n  {\n    *value_p = ecma_value;\n  }\n  else if (ecma_is_value_float_number (ecma_value) && ecma_is_value_float_number (*value_p))\n  {\n    const ecma_number_t *num_src_p = (ecma_number_t *) ecma_get_pointer_from_ecma_value (ecma_value);\n    ecma_number_t *num_dst_p = (ecma_number_t *) ecma_get_pointer_from_ecma_value (*value_p);\n\n    *num_dst_p = *num_src_p;\n  }\n  else\n  {\n    ecma_free_value_if_not_object (*value_p);\n    *value_p = ecma_copy_value_if_not_object (ecma_value);\n  }\n} /* ecma_value_assign_value */\n\n/**\n * Update the value of a float number to a new value\n *\n * Note:\n *   The original value is destroyed.\n *\n * @return updated ecma value\n */\necma_value_t\necma_update_float_number (ecma_value_t float_value, /**< original float value */\n                          ecma_number_t new_number) /**< updated number value */\n{\n  JERRY_ASSERT (ecma_is_value_float_number (float_value));\n\n  ecma_integer_value_t integer_number = (ecma_integer_value_t) new_number;\n  ecma_number_t *number_p = (ecma_number_t *) ecma_get_pointer_from_ecma_value (float_value);\n\n  if ((ecma_number_t) integer_number == new_number\n      && ((integer_number == 0) ? ecma_is_number_equal_to_positive_zero (new_number)\n                                : ECMA_IS_INTEGER_NUMBER (integer_number)))\n  {\n    ecma_dealloc_number (number_p);\n    return ecma_make_integer_value (integer_number);\n  }\n\n  *number_p = new_number;\n  return float_value;\n} /* ecma_update_float_number */\n\n/**\n * Assign a float number to an ecma-value\n *\n * Note:\n *      value previously stored in the property is freed\n */\nstatic void\necma_value_assign_float_number (ecma_value_t *value_p, /**< [in, out] ecma value */\n                                ecma_number_t ecma_number) /**< number to assign */\n{\n  if (ecma_is_value_float_number (*value_p))\n  {\n    ecma_number_t *num_dst_p = (ecma_number_t *) ecma_get_pointer_from_ecma_value (*value_p);\n\n    *num_dst_p = ecma_number;\n    return;\n  }\n\n  if (ecma_get_value_type_field (*value_p) != ECMA_TYPE_DIRECT\n      && ecma_get_value_type_field (*value_p) != ECMA_TYPE_OBJECT)\n  {\n    ecma_free_value (*value_p);\n  }\n\n  *value_p = ecma_create_float_number (ecma_number);\n} /* ecma_value_assign_float_number */\n\n/**\n * Assign a number to an ecma-value\n *\n * Note:\n *      value previously stored in the property is freed\n */\nvoid\necma_value_assign_number (ecma_value_t *value_p, /**< [in, out] ecma value */\n                          ecma_number_t ecma_number) /**< number to assign */\n{\n  ecma_integer_value_t integer_value = (ecma_integer_value_t) ecma_number;\n\n  if ((ecma_number_t) integer_value == ecma_number\n      && ((integer_value == 0) ? ecma_is_number_equal_to_positive_zero (ecma_number)\n                               : ECMA_IS_INTEGER_NUMBER (integer_value)))\n  {\n    if (ecma_get_value_type_field (*value_p) != ECMA_TYPE_DIRECT\n        && ecma_get_value_type_field (*value_p) != ECMA_TYPE_OBJECT)\n    {\n      ecma_free_value (*value_p);\n    }\n    *value_p = ecma_make_integer_value (integer_value);\n    return;\n  }\n\n  ecma_value_assign_float_number (value_p, ecma_number);\n} /* ecma_value_assign_number */\n\n/**\n * Free the ecma value\n */\nvoid\necma_free_value (ecma_value_t value) /**< value description */\n{\n  switch (ecma_get_value_type_field (value))\n  {\n    case ECMA_TYPE_FLOAT:\n    {\n      ecma_number_t *number_p = (ecma_number_t *) ecma_get_pointer_from_ecma_value (value);\n      ecma_dealloc_number (number_p);\n      break;\n    }\n    case ECMA_TYPE_SYMBOL:\n    case ECMA_TYPE_STRING:\n    {\n      ecma_string_t *string_p = (ecma_string_t *) ecma_get_pointer_from_ecma_value (value);\n      ecma_deref_ecma_string_non_direct (string_p);\n      break;\n    }\n    case ECMA_TYPE_OBJECT:\n    {\n      ecma_deref_object (ecma_get_object_from_value (value));\n      break;\n    }\n#if JERRY_BUILTIN_BIGINT\n    case ECMA_TYPE_BIGINT:\n    {\n      if (value != ECMA_BIGINT_ZERO)\n      {\n        ecma_deref_bigint (ecma_get_extended_primitive_from_value (value));\n      }\n\n      break;\n    }\n#endif /* JERRY_BUILTIN_BIGINT */\n    default:\n    {\n      JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT\n                    || ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT_STRING);\n\n      /* no memory is allocated */\n      break;\n    }\n  }\n} /* ecma_free_value */\n\n/**\n * Free the ecma value\n *\n * Note:\n *   this function is similar to ecma_free_value, but it is\n *   faster for direct values since no function call is performed.\n *   It also increases the binary size so it is recommended for\n *   critical code paths only.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_fast_free_value (ecma_value_t value) /**< value description */\n{\n  if (ecma_get_value_type_field (value) != ECMA_TYPE_DIRECT)\n  {\n    ecma_free_value (value);\n  }\n} /* ecma_fast_free_value */\n\n/**\n * Free the ecma value if not an object\n */\nvoid\necma_free_value_if_not_object (ecma_value_t value) /**< value description */\n{\n  if (ecma_get_value_type_field (value) != ECMA_TYPE_OBJECT)\n  {\n    ecma_free_value (value);\n  }\n} /* ecma_free_value_if_not_object */\n\n/**\n * Free an ecma-value object\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_free_object (ecma_value_t value) /**< value description */\n{\n  ecma_deref_object (ecma_get_object_from_value (value));\n} /* ecma_free_object */\n\n/**\n * Free an ecma-value number\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_free_number (ecma_value_t value) /**< value description */\n{\n  JERRY_ASSERT (ecma_is_value_number (value));\n\n  if (ecma_is_value_float_number (value))\n  {\n    ecma_number_t *number_p = (ecma_number_t *) ecma_get_pointer_from_ecma_value (value);\n    ecma_dealloc_number (number_p);\n  }\n} /* ecma_free_number */\n\n/**\n * Get the literal id associated with the given ecma_value type.\n * This operation is equivalent to the JavaScript 'typeof' operator.\n *\n * @returns one of the following value:\n *          - LIT_MAGIC_STRING_UNDEFINED\n *          - LIT_MAGIC_STRING_OBJECT\n *          - LIT_MAGIC_STRING_BOOLEAN\n *          - LIT_MAGIC_STRING_NUMBER\n *          - LIT_MAGIC_STRING_STRING\n *          - LIT_MAGIC_STRING_FUNCTION\n */\nlit_magic_string_id_t\necma_get_typeof_lit_id (ecma_value_t value) /**< input ecma value */\n{\n  lit_magic_string_id_t ret_value = LIT_MAGIC_STRING__EMPTY;\n\n  if (ecma_is_value_undefined (value))\n  {\n    ret_value = LIT_MAGIC_STRING_UNDEFINED;\n  }\n  else if (ecma_is_value_null (value))\n  {\n    ret_value = LIT_MAGIC_STRING_OBJECT;\n  }\n  else if (ecma_is_value_boolean (value))\n  {\n    ret_value = LIT_MAGIC_STRING_BOOLEAN;\n  }\n  else if (ecma_is_value_number (value))\n  {\n    ret_value = LIT_MAGIC_STRING_NUMBER;\n  }\n  else if (ecma_is_value_string (value))\n  {\n    ret_value = LIT_MAGIC_STRING_STRING;\n  }\n  else if (ecma_is_value_symbol (value))\n  {\n    ret_value = LIT_MAGIC_STRING_SYMBOL;\n  }\n#if JERRY_BUILTIN_BIGINT\n  else if (ecma_is_value_bigint (value))\n  {\n    ret_value = LIT_MAGIC_STRING_BIGINT;\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n  else\n  {\n    JERRY_ASSERT (ecma_is_value_object (value));\n\n    ret_value = ecma_op_is_callable (value) ? LIT_MAGIC_STRING_FUNCTION : LIT_MAGIC_STRING_OBJECT;\n  }\n\n  JERRY_ASSERT (ret_value != LIT_MAGIC_STRING__EMPTY);\n\n  return ret_value;\n} /* ecma_get_typeof_lit_id */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-helpers.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-helpers.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-lcache.h\"\n#include \"ecma-line-info.h\"\n#include \"ecma-property-hashmap.h\"\n\n#include \"byte-code.h\"\n#include \"jcontext.h\"\n#include \"jrt-bit-fields.h\"\n#include \"re-compiler.h\"\n\n#if JERRY_DEBUGGER\n#include \"debugger.h\"\n#endif /* JERRY_DEBUGGER */\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmahelpers Helpers for operations with ECMA data types\n * @{\n */\n\nJERRY_STATIC_ASSERT (ECMA_OBJECT_TYPE_MASK >= ECMA_OBJECT_TYPE__MAX - 1,\n                     ecma_object_types_must_be_lower_than_the_container_mask);\n\nJERRY_STATIC_ASSERT (ECMA_OBJECT_TYPE_MASK >= ECMA_LEXICAL_ENVIRONMENT_TYPE__MAX,\n                     ecma_lexical_environment_types_must_be_lower_than_the_container_mask);\n\nJERRY_STATIC_ASSERT (ECMA_OBJECT_FLAG_EXTENSIBLE == ECMA_OBJECT_TYPE_MASK + 1,\n                     ecma_extensible_flag_must_follow_the_object_type);\n\nJERRY_STATIC_ASSERT (ECMA_OBJECT_REF_ONE == (ECMA_OBJECT_FLAG_EXTENSIBLE << 1),\n                     ecma_object_ref_one_must_follow_the_extensible_flag);\n\nJERRY_STATIC_ASSERT ((ECMA_OBJECT_MAX_REF + ECMA_OBJECT_REF_ONE) == ECMA_OBJECT_REF_MASK,\n                     ecma_object_max_ref_does_not_fill_the_remaining_bits);\n\nJERRY_STATIC_ASSERT ((ECMA_OBJECT_REF_MASK & (ECMA_OBJECT_TYPE_MASK | ECMA_OBJECT_FLAG_EXTENSIBLE)) == 0,\n                     ecma_object_ref_mask_overlaps_with_object_type_or_extensible);\n\nJERRY_STATIC_ASSERT (ECMA_PROPERTY_FLAGS_MASK == ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                     ecma_property_flags_mask_must_use_the_configurable_enumerable_writable_flags);\n\n/* These checks are needed by ecma_get_object_base_type. */\nJERRY_STATIC_ASSERT ((int) ECMA_OBJECT_TYPE_BUILT_IN_GENERAL == ((int) ECMA_OBJECT_TYPE_GENERAL | 0x1)\n                       && ((int) ECMA_OBJECT_TYPE_GENERAL & 0x1) == 0,\n                     ecma_object_type_built_in_general_has_unexpected_value);\nJERRY_STATIC_ASSERT ((int) ECMA_OBJECT_TYPE_BUILT_IN_CLASS == ((int) ECMA_OBJECT_TYPE_CLASS | 0x1)\n                       && ((int) ECMA_OBJECT_TYPE_CLASS & 0x1) == 0,\n                     ecma_object_type_built_in_class_has_unexpected_value);\nJERRY_STATIC_ASSERT ((int) ECMA_OBJECT_TYPE_BUILT_IN_ARRAY == ((int) ECMA_OBJECT_TYPE_ARRAY | 0x1)\n                       && ((int) ECMA_OBJECT_TYPE_ARRAY & 0x1) == 0,\n                     ecma_object_type_built_in_array_has_unexpected_value);\n\n/**\n * Create an object with specified prototype object\n * (or NULL prototype if there is not prototype for the object)\n * and value of 'Extensible' attribute.\n *\n * Reference counter's value will be set to one.\n *\n * @return pointer to the object's descriptor\n */\necma_object_t *\necma_create_object (ecma_object_t *prototype_object_p, /**< pointer to prototybe of the object (or NULL) */\n                    size_t ext_object_size, /**< size of extended objects */\n                    ecma_object_type_t type) /**< object type */\n{\n  ecma_object_t *new_object_p;\n\n  if (ext_object_size > 0)\n  {\n    new_object_p = (ecma_object_t *) ecma_alloc_extended_object (ext_object_size);\n  }\n  else\n  {\n    new_object_p = ecma_alloc_object ();\n  }\n\n  new_object_p->type_flags_refs = (ecma_object_descriptor_t) (type | ECMA_OBJECT_FLAG_EXTENSIBLE);\n\n  ecma_init_gc_info (new_object_p);\n\n  new_object_p->u1.property_list_cp = JMEM_CP_NULL;\n\n  ECMA_SET_POINTER (new_object_p->u2.prototype_cp, prototype_object_p);\n\n  return new_object_p;\n} /* ecma_create_object */\n\n/**\n * Create a declarative lexical environment with specified outer lexical environment\n * (or NULL if the environment is not nested).\n *\n * See also: ECMA-262 v5, 10.2.1.1\n *\n * Reference counter's value will be set to one.\n *\n * @return pointer to the descriptor of lexical environment\n */\necma_object_t *\necma_create_decl_lex_env (ecma_object_t *outer_lexical_environment_p) /**< outer lexical environment */\n{\n  ecma_object_t *new_lexical_environment_p = ecma_alloc_object ();\n\n  new_lexical_environment_p->type_flags_refs = ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE;\n\n  ecma_init_gc_info (new_lexical_environment_p);\n\n  new_lexical_environment_p->u1.property_list_cp = JMEM_CP_NULL;\n\n  ECMA_SET_POINTER (new_lexical_environment_p->u2.outer_reference_cp, outer_lexical_environment_p);\n\n  return new_lexical_environment_p;\n} /* ecma_create_decl_lex_env */\n\n/**\n * Create a object lexical environment with specified outer lexical environment\n * (or NULL if the environment is not nested), and binding object.\n *\n * See also: ECMA-262 v5, 10.2.1.2\n *\n * Reference counter's value will be set to one.\n *\n * @return pointer to the descriptor of lexical environment\n */\necma_object_t *\necma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< outer lexical environment */\n                            ecma_object_t *binding_obj_p) /**< binding object */\n{\n  JERRY_ASSERT (binding_obj_p != NULL && !ecma_is_lexical_environment (binding_obj_p));\n\n  ecma_object_t *new_lexical_environment_p = ecma_alloc_object ();\n\n  new_lexical_environment_p->type_flags_refs = ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND;\n\n  ecma_init_gc_info (new_lexical_environment_p);\n\n  ECMA_SET_NON_NULL_POINTER (new_lexical_environment_p->u1.bound_object_cp, binding_obj_p);\n\n  ECMA_SET_POINTER (new_lexical_environment_p->u2.outer_reference_cp, outer_lexical_environment_p);\n\n  return new_lexical_environment_p;\n} /* ecma_create_object_lex_env */\n\n/**\n * Create a lexical environment with a specified size.\n *\n * @return pointer to the descriptor of the lexical environment\n */\necma_object_t *\necma_create_lex_env_class (ecma_object_t *outer_lexical_environment_p, /**< outer lexical environment */\n                           size_t lexical_env_size) /**< size of the lexical environment */\n{\n  ecma_object_t *new_lexical_environment_p;\n\n  ecma_object_descriptor_t type_flags_refs = ECMA_LEXICAL_ENVIRONMENT_CLASS;\n\n  if (lexical_env_size > 0)\n  {\n    new_lexical_environment_p = (ecma_object_t *) ecma_alloc_extended_object (lexical_env_size);\n    type_flags_refs |= ECMA_OBJECT_FLAG_LEXICAL_ENV_HAS_DATA;\n  }\n  else\n  {\n    new_lexical_environment_p = ecma_alloc_object ();\n  }\n\n  new_lexical_environment_p->type_flags_refs = type_flags_refs;\n\n  ecma_init_gc_info (new_lexical_environment_p);\n\n  new_lexical_environment_p->u1.property_list_cp = JMEM_CP_NULL;\n\n  ECMA_SET_POINTER (new_lexical_environment_p->u2.outer_reference_cp, outer_lexical_environment_p);\n\n  return new_lexical_environment_p;\n} /* ecma_create_lex_env_class */\n\n/**\n * Check if the object is lexical environment.\n *\n * @return true  - if object is a lexical environment\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_PURE\necma_is_lexical_environment (const ecma_object_t *object_p) /**< object or lexical environment */\n{\n  JERRY_ASSERT (object_p != NULL);\n\n  return (object_p->type_flags_refs & ECMA_OBJECT_TYPE_MASK) >= ECMA_LEXICAL_ENVIRONMENT_TYPE_START;\n} /* ecma_is_lexical_environment */\n\n/**\n * Set value of [[Extensible]] object's internal property.\n */\nextern inline void\necma_op_ordinary_object_set_extensible (ecma_object_t *object_p) /**< object */\n{\n  JERRY_ASSERT (object_p != NULL);\n  JERRY_ASSERT (!ecma_is_lexical_environment (object_p));\n\n  object_p->type_flags_refs |= ECMA_OBJECT_FLAG_EXTENSIBLE;\n} /* ecma_op_ordinary_object_set_extensible */\n\n/**\n * Get the internal type of an object.\n *\n * @return type of the object (ecma_object_type_t)\n */\nextern inline ecma_object_type_t JERRY_ATTR_PURE\necma_get_object_type (const ecma_object_t *object_p) /**< object */\n{\n  JERRY_ASSERT (object_p != NULL);\n  JERRY_ASSERT (!ecma_is_lexical_environment (object_p));\n\n  return (ecma_object_type_t) (object_p->type_flags_refs & ECMA_OBJECT_TYPE_MASK);\n} /* ecma_get_object_type */\n\n/**\n * Get the internal base type of an object.\n *\n * @return base type of the object (ecma_object_base_type_t)\n */\nextern inline ecma_object_base_type_t JERRY_ATTR_PURE\necma_get_object_base_type (const ecma_object_t *object_p) /**< object */\n{\n  JERRY_ASSERT (object_p != NULL);\n  JERRY_ASSERT (!ecma_is_lexical_environment (object_p));\n\n  return (ecma_object_base_type_t) (object_p->type_flags_refs & (ECMA_OBJECT_TYPE_MASK - 0x1));\n} /* ecma_get_object_base_type */\n\n/**\n * Get value of an object if the class matches\n *\n * @return value of the object if the class matches\n *         ECMA_VALUE_NOT_FOUND otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_object_class_is (ecma_object_t *object_p, /**< object */\n                      ecma_object_class_type_t class_id) /**< class id */\n{\n  if (ecma_get_object_base_type (object_p) == ECMA_OBJECT_BASE_TYPE_CLASS)\n  {\n    ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n    if (ext_object_p->u.cls.type == (uint8_t) class_id)\n    {\n      return true;\n    }\n  }\n\n  return false;\n} /* ecma_object_class_is */\n\n/**\n * Get type of lexical environment.\n *\n * @return type of the lexical environment (ecma_lexical_environment_type_t)\n */\nextern inline ecma_lexical_environment_type_t JERRY_ATTR_PURE\necma_get_lex_env_type (const ecma_object_t *object_p) /**< lexical environment */\n{\n  JERRY_ASSERT (object_p != NULL);\n  JERRY_ASSERT (ecma_is_lexical_environment (object_p));\n\n  return (ecma_lexical_environment_type_t) (object_p->type_flags_refs & ECMA_OBJECT_TYPE_MASK);\n} /* ecma_get_lex_env_type */\n\n/**\n * Get lexical environment's bound object.\n *\n * @return pointer to ecma object\n */\nextern inline ecma_object_t *JERRY_ATTR_PURE\necma_get_lex_env_binding_object (const ecma_object_t *object_p) /**< object-bound lexical environment */\n{\n  JERRY_ASSERT (object_p != NULL);\n  JERRY_ASSERT (ecma_is_lexical_environment (object_p));\n  JERRY_ASSERT (ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND\n                || (ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_CLASS\n                    && !ECMA_LEX_ENV_CLASS_IS_MODULE (object_p)));\n\n  return ECMA_GET_NON_NULL_POINTER (ecma_object_t, object_p->u1.bound_object_cp);\n} /* ecma_get_lex_env_binding_object */\n\n/**\n * Create a new lexical environment with the same property list as the passed lexical environment\n *\n * @return pointer to the newly created lexical environment\n */\necma_object_t *\necma_clone_decl_lexical_environment (ecma_object_t *lex_env_p, /**< declarative lexical environment */\n                                     bool copy_values) /**< copy property values as well */\n{\n  JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);\n  JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);\n\n  ecma_object_t *outer_lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n  ecma_object_t *new_lex_env_p = ecma_create_decl_lex_env (outer_lex_env_p);\n\n  jmem_cpointer_t prop_iter_cp = lex_env_p->u1.property_list_cp;\n  ecma_property_header_t *prop_iter_p;\n\n  JERRY_ASSERT (prop_iter_cp != JMEM_CP_NULL);\n\n#if JERRY_PROPERTY_HASHMAP\n  prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n\n  if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n  {\n    prop_iter_cp = prop_iter_p->next_property_cp;\n  }\n\n  JERRY_ASSERT (prop_iter_cp != JMEM_CP_NULL);\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n  do\n  {\n    prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n    ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n    for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      if (prop_iter_p->types[i] != ECMA_PROPERTY_TYPE_DELETED)\n      {\n        JERRY_ASSERT (ECMA_PROPERTY_IS_RAW_DATA (prop_iter_p->types[i]));\n\n        uint8_t prop_attributes = (uint8_t) (prop_iter_p->types[i] & ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n        ecma_string_t *name_p = ecma_string_from_property_name (prop_iter_p->types[i], prop_pair_p->names_cp[i]);\n\n        ecma_property_value_t *property_value_p;\n        property_value_p = ecma_create_named_data_property (new_lex_env_p, name_p, prop_attributes, NULL);\n\n        ecma_deref_ecma_string (name_p);\n\n        JERRY_ASSERT (property_value_p->value == ECMA_VALUE_UNDEFINED);\n\n        if (copy_values)\n        {\n          property_value_p->value = ecma_copy_value_if_not_object (prop_pair_p->values[i].value);\n        }\n        else\n        {\n          property_value_p->value = ECMA_VALUE_UNINITIALIZED;\n        }\n      }\n    }\n\n    prop_iter_cp = prop_iter_p->next_property_cp;\n  } while (prop_iter_cp != JMEM_CP_NULL);\n\n  ecma_deref_object (lex_env_p);\n  return new_lex_env_p;\n} /* ecma_clone_decl_lexical_environment */\n\n/**\n * Create a property in an object and link it into\n * the object's properties' linked-list (at start of the list).\n *\n * @return pointer to the newly created property value\n */\nstatic ecma_property_value_t *\necma_create_property (ecma_object_t *object_p, /**< the object */\n                      ecma_string_t *name_p, /**< property name */\n                      uint8_t type_and_flags, /**< type and flags, see ecma_property_info_t */\n                      ecma_property_value_t value, /**< property value */\n                      ecma_property_t **out_prop_p) /**< [out] the property is also returned\n                                                     *         if this field is non-NULL */\n{\n  JERRY_ASSERT (ECMA_PROPERTY_PAIR_ITEM_COUNT == 2);\n  JERRY_ASSERT (name_p != NULL);\n  JERRY_ASSERT (object_p != NULL);\n\n  jmem_cpointer_t *property_list_head_p = &object_p->u1.property_list_cp;\n\n  if (*property_list_head_p != ECMA_NULL_POINTER)\n  {\n    /* If the first entry is free (deleted), it is reused. */\n    ecma_property_header_t *first_property_p =\n      ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, *property_list_head_p);\n\n#if JERRY_PROPERTY_HASHMAP\n    bool has_hashmap = false;\n\n    if (first_property_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n    {\n      property_list_head_p = &first_property_p->next_property_cp;\n      first_property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, *property_list_head_p);\n      has_hashmap = true;\n    }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (first_property_p));\n\n    if (first_property_p->types[0] == ECMA_PROPERTY_TYPE_DELETED)\n    {\n      ecma_property_pair_t *first_property_pair_p = (ecma_property_pair_t *) first_property_p;\n\n      ecma_property_t name_type;\n      first_property_pair_p->names_cp[0] = ecma_string_to_property_name (name_p, &name_type);\n      first_property_p->types[0] = (ecma_property_t) (type_and_flags | name_type);\n\n      ecma_property_t *property_p = first_property_p->types + 0;\n\n      JERRY_ASSERT (ECMA_PROPERTY_VALUE_PTR (property_p) == first_property_pair_p->values + 0);\n\n      if (out_prop_p != NULL)\n      {\n        *out_prop_p = property_p;\n      }\n\n      first_property_pair_p->values[0] = value;\n\n#if JERRY_PROPERTY_HASHMAP\n      /* The property must be fully initialized before ecma_property_hashmap_insert\n       * is called, because the insert operation may reallocate the hashmap, and\n       * that triggers garbage collection which scans all properties of all objects.\n       * A not fully initialized but queued property may cause a crash. */\n\n      if (has_hashmap)\n      {\n        ecma_property_hashmap_insert (object_p, name_p, first_property_pair_p, 0);\n      }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n      return first_property_pair_p->values + 0;\n    }\n  }\n\n  /* Otherwise we create a new property pair and use its second value. */\n  ecma_property_pair_t *first_property_pair_p = ecma_alloc_property_pair ();\n\n  /* Need to query property_list_head_p again and recheck the existennce\n   * of property hasmap, because ecma_alloc_property_pair may delete them. */\n  property_list_head_p = &object_p->u1.property_list_cp;\n#if JERRY_PROPERTY_HASHMAP\n  bool has_hashmap = false;\n\n  if (*property_list_head_p != ECMA_NULL_POINTER)\n  {\n    ecma_property_header_t *first_property_p =\n      ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, *property_list_head_p);\n\n    if (first_property_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n    {\n      property_list_head_p = &first_property_p->next_property_cp;\n      has_hashmap = true;\n    }\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n  /* Just copy the previous value (no need to decompress, compress). */\n  first_property_pair_p->header.next_property_cp = *property_list_head_p;\n  first_property_pair_p->header.types[0] = ECMA_PROPERTY_TYPE_DELETED;\n  first_property_pair_p->names_cp[0] = LIT_INTERNAL_MAGIC_STRING_DELETED;\n\n  ecma_property_t name_type;\n  first_property_pair_p->names_cp[1] = ecma_string_to_property_name (name_p, &name_type);\n\n  first_property_pair_p->header.types[1] = (ecma_property_t) (type_and_flags | name_type);\n\n  ECMA_SET_NON_NULL_POINTER (*property_list_head_p, &first_property_pair_p->header);\n\n  ecma_property_t *property_p = first_property_pair_p->header.types + 1;\n\n  JERRY_ASSERT (ECMA_PROPERTY_VALUE_PTR (property_p) == first_property_pair_p->values + 1);\n\n  if (out_prop_p != NULL)\n  {\n    *out_prop_p = property_p;\n  }\n\n  first_property_pair_p->values[1] = value;\n\n#if JERRY_PROPERTY_HASHMAP\n  /* See the comment before the other ecma_property_hashmap_insert above. */\n\n  if (has_hashmap)\n  {\n    ecma_property_hashmap_insert (object_p, name_p, first_property_pair_p, 1);\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n  return first_property_pair_p->values + 1;\n} /* ecma_create_property */\n\n/**\n * Create named data property with given name, attributes and undefined value\n * in the specified object.\n *\n * @return pointer to the newly created property value\n */\necma_property_value_t *\necma_create_named_data_property (ecma_object_t *object_p, /**< object */\n                                 ecma_string_t *name_p, /**< property name */\n                                 uint8_t prop_attributes, /**< property attributes (See: ecma_property_flags_t) */\n                                 ecma_property_t **out_prop_p) /**< [out] the property is also returned\n                                                                *         if this field is non-NULL */\n{\n  JERRY_ASSERT (object_p != NULL && name_p != NULL);\n  JERRY_ASSERT (ecma_is_lexical_environment (object_p) || !ecma_op_object_is_fast_array (object_p));\n  JERRY_ASSERT (ecma_find_named_property (object_p, name_p) == NULL);\n  JERRY_ASSERT ((prop_attributes & ~ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_ENUMERABLE_WRITABLE) == 0);\n\n  uint8_t type_and_flags = ECMA_PROPERTY_FLAG_DATA | prop_attributes;\n\n  ecma_property_value_t value;\n  value.value = ECMA_VALUE_UNDEFINED;\n\n  return ecma_create_property (object_p, name_p, type_and_flags, value, out_prop_p);\n} /* ecma_create_named_data_property */\n\n/**\n * Create named accessor property with given name, attributes, getter and setter.\n *\n * @return pointer to the newly created property value\n */\necma_property_value_t *\necma_create_named_accessor_property (ecma_object_t *object_p, /**< object */\n                                     ecma_string_t *name_p, /**< property name */\n                                     ecma_object_t *get_p, /**< getter */\n                                     ecma_object_t *set_p, /**< setter */\n                                     uint8_t prop_attributes, /**< property attributes */\n                                     ecma_property_t **out_prop_p) /**< [out] the property is also returned\n                                                                    *         if this field is non-NULL */\n{\n  JERRY_ASSERT (object_p != NULL && name_p != NULL);\n  JERRY_ASSERT (ecma_is_lexical_environment (object_p) || !ecma_op_object_is_fast_array (object_p));\n  JERRY_ASSERT (ecma_find_named_property (object_p, name_p) == NULL);\n  JERRY_ASSERT ((prop_attributes & ~ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_ENUMERABLE) == 0);\n\n  uint8_t type_and_flags = prop_attributes;\n\n  ecma_property_value_t value;\n#if JERRY_CPOINTER_32_BIT\n  ecma_getter_setter_pointers_t *getter_setter_pair_p;\n  getter_setter_pair_p = jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));\n  ECMA_SET_POINTER (getter_setter_pair_p->getter_cp, get_p);\n  ECMA_SET_POINTER (getter_setter_pair_p->setter_cp, set_p);\n  ECMA_SET_NON_NULL_POINTER (value.getter_setter_pair_cp, getter_setter_pair_p);\n#else /* !JERRY_CPOINTER_32_BIT */\n  ECMA_SET_POINTER (value.getter_setter_pair.getter_cp, get_p);\n  ECMA_SET_POINTER (value.getter_setter_pair.setter_cp, set_p);\n#endif /* JERRY_CPOINTER_32_BIT */\n\n  return ecma_create_property (object_p, name_p, type_and_flags, value, out_prop_p);\n} /* ecma_create_named_accessor_property */\n\n#if JERRY_MODULE_SYSTEM\n/**\n * Create property reference\n */\nvoid\necma_create_named_reference_property (ecma_object_t *object_p, /**< object */\n                                      ecma_string_t *name_p, /**< property name */\n                                      ecma_value_t reference) /**< property reference */\n{\n  JERRY_ASSERT (object_p != NULL && name_p != NULL);\n  JERRY_ASSERT (ecma_find_named_property (object_p, name_p) == NULL);\n  JERRY_ASSERT ((ecma_is_lexical_environment (object_p)\n                 && ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_CLASS\n                 && ECMA_LEX_ENV_CLASS_IS_MODULE (object_p))\n                || ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_MODULE_NAMESPACE));\n\n  uint8_t type_and_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE;\n  ecma_property_value_t value;\n\n  value.value = reference;\n\n  ecma_create_property (object_p, name_p, type_and_flags, value, NULL);\n} /* ecma_create_named_reference_property */\n\n#endif /* JERRY_MODULE_SYSTEM */\n\n/**\n * Find named data property or named accessor property in a specified object.\n *\n * @return pointer to the property, if it is found,\n *         NULL - otherwise.\n */\necma_property_t *\necma_find_named_property (ecma_object_t *obj_p, /**< object to find property in */\n                          ecma_string_t *name_p) /**< property's name */\n{\n  JERRY_ASSERT (obj_p != NULL);\n  JERRY_ASSERT (name_p != NULL);\n  JERRY_ASSERT (ecma_is_lexical_environment (obj_p) || !ecma_op_object_is_fast_array (obj_p));\n\n#if JERRY_LCACHE\n  ecma_property_t *property_p = ecma_lcache_lookup (obj_p, name_p);\n  if (property_p != NULL)\n  {\n    return property_p;\n  }\n#else /* !JERRY_LCACHE */\n  ecma_property_t *property_p = NULL;\n#endif /* JERRY_LCACHE */\n\n  jmem_cpointer_t prop_iter_cp = obj_p->u1.property_list_cp;\n\n#if JERRY_PROPERTY_HASHMAP\n  if (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n    {\n      jmem_cpointer_t property_real_name_cp;\n      property_p = ecma_property_hashmap_find ((ecma_property_hashmap_t *) prop_iter_p, name_p, &property_real_name_cp);\n#if JERRY_LCACHE\n      if (property_p != NULL && !ecma_is_property_lcached (property_p))\n      {\n        ecma_lcache_insert (obj_p, property_real_name_cp, property_p);\n      }\n#endif /* JERRY_LCACHE */\n      return property_p;\n    }\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n#if JERRY_PROPERTY_HASHMAP\n  uint32_t steps = 0;\n#endif /* JERRY_PROPERTY_HASHMAP */\n  jmem_cpointer_t property_name_cp = ECMA_NULL_POINTER;\n\n  if (ECMA_IS_DIRECT_STRING (name_p))\n  {\n    ecma_property_t prop_name_type = (ecma_property_t) ECMA_GET_DIRECT_STRING_TYPE (name_p);\n    property_name_cp = (jmem_cpointer_t) ECMA_GET_DIRECT_STRING_VALUE (name_p);\n\n    JERRY_ASSERT (prop_name_type > 0);\n\n    while (prop_iter_cp != JMEM_CP_NULL)\n    {\n      ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n\n      JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n      ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n      if (prop_pair_p->names_cp[0] == property_name_cp\n          && ECMA_PROPERTY_GET_NAME_TYPE (prop_iter_p->types[0]) == prop_name_type)\n      {\n        JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (prop_iter_p->types[0]));\n\n        property_p = prop_iter_p->types + 0;\n        break;\n      }\n\n      if (prop_pair_p->names_cp[1] == property_name_cp\n          && ECMA_PROPERTY_GET_NAME_TYPE (prop_iter_p->types[1]) == prop_name_type)\n      {\n        JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (prop_iter_p->types[1]));\n\n        property_p = prop_iter_p->types + 1;\n        break;\n      }\n\n#if JERRY_PROPERTY_HASHMAP\n      steps++;\n#endif /* JERRY_PROPERTY_HASHMAP */\n      prop_iter_cp = prop_iter_p->next_property_cp;\n    }\n  }\n  else\n  {\n    while (prop_iter_cp != JMEM_CP_NULL)\n    {\n      ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n\n      JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n      ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n      if (ECMA_PROPERTY_GET_NAME_TYPE (prop_iter_p->types[0]) == ECMA_DIRECT_STRING_PTR)\n      {\n        property_name_cp = prop_pair_p->names_cp[0];\n        ecma_string_t *prop_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, property_name_cp);\n\n        if (ecma_compare_ecma_non_direct_strings (name_p, prop_name_p))\n        {\n          property_p = prop_iter_p->types + 0;\n          break;\n        }\n      }\n\n      if (ECMA_PROPERTY_GET_NAME_TYPE (prop_iter_p->types[1]) == ECMA_DIRECT_STRING_PTR)\n      {\n        property_name_cp = prop_pair_p->names_cp[1];\n        ecma_string_t *prop_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, property_name_cp);\n\n        if (ecma_compare_ecma_non_direct_strings (name_p, prop_name_p))\n        {\n          property_p = prop_iter_p->types + 1;\n          break;\n        }\n      }\n\n#if JERRY_PROPERTY_HASHMAP\n      steps++;\n#endif /* JERRY_PROPERTY_HASHMAP */\n      prop_iter_cp = prop_iter_p->next_property_cp;\n    }\n  }\n\n#if JERRY_PROPERTY_HASHMAP\n  if (steps >= (ECMA_PROPERTY_HASMAP_MINIMUM_SIZE / 2))\n  {\n    ecma_property_hashmap_create (obj_p);\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n#if JERRY_LCACHE\n  if (property_p != NULL && !ecma_is_property_lcached (property_p))\n  {\n    ecma_lcache_insert (obj_p, property_name_cp, property_p);\n  }\n#endif /* JERRY_LCACHE */\n\n  return property_p;\n} /* ecma_find_named_property */\n\n/**\n * Get named data property or named access property in specified object.\n *\n * Warning:\n *         the property must exist\n *\n * @return pointer to the property, if it is found,\n *         NULL - otherwise.\n */\necma_property_value_t *\necma_get_named_data_property (ecma_object_t *obj_p, /**< object to find property in */\n                              ecma_string_t *name_p) /**< property's name */\n{\n  JERRY_ASSERT (obj_p != NULL);\n  JERRY_ASSERT (name_p != NULL);\n  JERRY_ASSERT (ecma_is_lexical_environment (obj_p) || !ecma_op_object_is_fast_array (obj_p));\n\n  ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p);\n\n  JERRY_ASSERT (property_p != NULL && ECMA_PROPERTY_IS_RAW_DATA (*property_p));\n\n  return ECMA_PROPERTY_VALUE_PTR (property_p);\n} /* ecma_get_named_data_property */\n\n/**\n * Delete the object's property referenced by its value pointer.\n *\n * Note: specified property must be owned by specified object.\n */\nvoid\necma_delete_property (ecma_object_t *object_p, /**< object */\n                      ecma_property_value_t *prop_value_p) /**< property value reference */\n{\n  jmem_cpointer_t cur_prop_cp = object_p->u1.property_list_cp;\n\n  ecma_property_header_t *prev_prop_p = NULL;\n\n#if JERRY_PROPERTY_HASHMAP\n  ecma_property_hashmap_delete_status hashmap_status = ECMA_PROPERTY_HASHMAP_DELETE_NO_HASHMAP;\n\n  if (cur_prop_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *cur_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, cur_prop_cp);\n\n    if (cur_prop_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n    {\n      prev_prop_p = cur_prop_p;\n      cur_prop_cp = cur_prop_p->next_property_cp;\n      hashmap_status = ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP;\n    }\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n  while (cur_prop_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *cur_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, cur_prop_cp);\n\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (cur_prop_p));\n\n    ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) cur_prop_p;\n\n    for (uint32_t i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      if ((prop_pair_p->values + i) == prop_value_p)\n      {\n        JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (cur_prop_p->types[i]));\n\n#if JERRY_PROPERTY_HASHMAP\n        if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP)\n        {\n          hashmap_status = ecma_property_hashmap_delete (object_p, prop_pair_p->names_cp[i], cur_prop_p->types + i);\n        }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n        ecma_gc_free_property (object_p, prop_pair_p, i);\n        cur_prop_p->types[i] = ECMA_PROPERTY_TYPE_DELETED;\n        prop_pair_p->names_cp[i] = LIT_INTERNAL_MAGIC_STRING_DELETED;\n\n        JERRY_ASSERT (ECMA_PROPERTY_PAIR_ITEM_COUNT == 2);\n\n        if (cur_prop_p->types[1 - i] != ECMA_PROPERTY_TYPE_DELETED)\n        {\n#if JERRY_PROPERTY_HASHMAP\n          /* The other property is still valid. */\n          if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP)\n          {\n            ecma_property_hashmap_free (object_p);\n            ecma_property_hashmap_create (object_p);\n          }\n#endif /* JERRY_PROPERTY_HASHMAP */\n          return;\n        }\n\n        JERRY_ASSERT (cur_prop_p->types[i] == ECMA_PROPERTY_TYPE_DELETED);\n\n        if (prev_prop_p == NULL)\n        {\n          object_p->u1.property_list_cp = cur_prop_p->next_property_cp;\n        }\n        else\n        {\n          prev_prop_p->next_property_cp = cur_prop_p->next_property_cp;\n        }\n\n        ecma_dealloc_property_pair ((ecma_property_pair_t *) cur_prop_p);\n\n#if JERRY_PROPERTY_HASHMAP\n        if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP)\n        {\n          ecma_property_hashmap_free (object_p);\n          ecma_property_hashmap_create (object_p);\n        }\n#endif /* JERRY_PROPERTY_HASHMAP */\n        return;\n      }\n    }\n\n    prev_prop_p = cur_prop_p;\n    cur_prop_cp = cur_prop_p->next_property_cp;\n  }\n} /* ecma_delete_property */\n\n/**\n * Check whether the object contains a property\n */\nstatic void\necma_assert_object_contains_the_property (const ecma_object_t *object_p, /**< ecma-object */\n                                          const ecma_property_value_t *prop_value_p, /**< property value */\n                                          bool is_data) /**< property should be data property */\n{\n#ifndef JERRY_NDEBUG\n  jmem_cpointer_t prop_iter_cp = object_p->u1.property_list_cp;\n  JERRY_ASSERT (prop_iter_cp != JMEM_CP_NULL);\n\n  ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n\n  if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n  {\n    prop_iter_cp = prop_iter_p->next_property_cp;\n  }\n\n  while (prop_iter_cp != JMEM_CP_NULL)\n  {\n    prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n    ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n    for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      if ((prop_pair_p->values + i) == prop_value_p)\n      {\n        JERRY_ASSERT (is_data == ((prop_pair_p->header.types[i] & ECMA_PROPERTY_FLAG_DATA) != 0));\n        return;\n      }\n    }\n\n    prop_iter_cp = prop_iter_p->next_property_cp;\n  }\n#else /* JERRY_NDEBUG */\n  JERRY_UNUSED (object_p);\n  JERRY_UNUSED (prop_value_p);\n  JERRY_UNUSED (is_data);\n#endif /* !JERRY_NDEBUG */\n} /* ecma_assert_object_contains_the_property */\n\n/**\n * Assign value to named data property\n *\n * Note:\n *      value previously stored in the property is freed\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_named_data_property_assign_value (ecma_object_t *obj_p, /**< object */\n                                       ecma_property_value_t *prop_value_p, /**< property value reference */\n                                       ecma_value_t value) /**< value to assign */\n{\n  ecma_assert_object_contains_the_property (obj_p, prop_value_p, true);\n\n  ecma_value_assign_value (&prop_value_p->value, value);\n} /* ecma_named_data_property_assign_value */\n\n/**\n * Get named accessor property getter-setter-pair\n *\n * @return pointer to object's getter-setter pair\n */\necma_getter_setter_pointers_t *\necma_get_named_accessor_property (const ecma_property_value_t *prop_value_p) /**< property value reference */\n{\n#if JERRY_CPOINTER_32_BIT\n  return ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_value_p->getter_setter_pair_cp);\n#else /* !JERRY_CPOINTER_32_BIT */\n  return (ecma_getter_setter_pointers_t *) &prop_value_p->getter_setter_pair;\n#endif /* JERRY_CPOINTER_32_BIT */\n} /* ecma_get_named_accessor_property */\n\n/**\n * Set getter of named accessor property\n */\nvoid\necma_set_named_accessor_property_getter (ecma_object_t *object_p, /**< the property's container */\n                                         ecma_property_value_t *prop_value_p, /**< property value reference */\n                                         ecma_object_t *getter_p) /**< getter object */\n{\n  ecma_assert_object_contains_the_property (object_p, prop_value_p, false);\n\n#if JERRY_CPOINTER_32_BIT\n  ecma_getter_setter_pointers_t *getter_setter_pair_p;\n  getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_value_p->getter_setter_pair_cp);\n  ECMA_SET_POINTER (getter_setter_pair_p->getter_cp, getter_p);\n#else /* !JERRY_CPOINTER_32_BIT */\n  ECMA_SET_POINTER (prop_value_p->getter_setter_pair.getter_cp, getter_p);\n#endif /* JERRY_CPOINTER_32_BIT */\n} /* ecma_set_named_accessor_property_getter */\n\n/**\n * Set setter of named accessor property\n */\nvoid\necma_set_named_accessor_property_setter (ecma_object_t *object_p, /**< the property's container */\n                                         ecma_property_value_t *prop_value_p, /**< property value reference */\n                                         ecma_object_t *setter_p) /**< setter object */\n{\n  ecma_assert_object_contains_the_property (object_p, prop_value_p, false);\n\n#if JERRY_CPOINTER_32_BIT\n  ecma_getter_setter_pointers_t *getter_setter_pair_p;\n  getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_value_p->getter_setter_pair_cp);\n  ECMA_SET_POINTER (getter_setter_pair_p->setter_cp, setter_p);\n#else /* !JERRY_CPOINTER_32_BIT */\n  ECMA_SET_POINTER (prop_value_p->getter_setter_pair.setter_cp, setter_p);\n#endif /* JERRY_CPOINTER_32_BIT */\n} /* ecma_set_named_accessor_property_setter */\n\n#if JERRY_MODULE_SYSTEM\n\n/**\n * Construct a reference to a given property\n *\n * @return property reference\n */\necma_value_t\necma_property_to_reference (ecma_property_t *property_p) /**< data or reference property */\n{\n  ecma_property_value_t *referenced_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n  if (!(*property_p & ECMA_PROPERTY_FLAG_DATA))\n  {\n    return referenced_value_p->value;\n  }\n\n  jmem_cpointer_tag_t offset = (jmem_cpointer_tag_t) (((uintptr_t) property_p) & 0x1);\n\n#if JERRY_CPOINTER_32_BIT\n  if (offset != 0)\n  {\n    --referenced_value_p;\n  }\n#else /* !JERRY_CPOINTER_32_BIT */\n  if (offset == 0)\n  {\n    ++referenced_value_p;\n  }\n#endif /* JERRY_CPOINTER_32_BIT */\n\n  JERRY_ASSERT ((((uintptr_t) referenced_value_p) & (((uintptr_t) 1 << JMEM_ALIGNMENT_LOG) - 1)) == 0);\n\n  ecma_value_t result;\n  ECMA_SET_NON_NULL_POINTER_TAG (result, referenced_value_p, offset);\n  return result;\n} /* ecma_property_to_reference */\n\n/**\n * Gets the referenced property value\n *\n * @return pointer to the value\n */\nextern inline ecma_property_value_t *JERRY_ATTR_ALWAYS_INLINE\necma_get_property_value_from_named_reference (ecma_property_value_t *reference_p) /**< data property reference */\n{\n  ecma_value_t value = reference_p->value;\n  reference_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_property_value_t, value);\n\n#if JERRY_CPOINTER_32_BIT\n  if (ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (value))\n  {\n    ++reference_p;\n  }\n#else /* !JERRY_CPOINTER_32_BIT */\n  if (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (value))\n  {\n    --reference_p;\n  }\n#endif /* JERRY_CPOINTER_32_BIT */\n\n  return reference_p;\n} /* ecma_get_property_value_from_named_reference */\n\n#endif /* JERRY_MODULE_SYSTEM */\n\n/**\n * Get property's 'Writable' attribute value\n *\n * @return true - property is writable,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_is_property_writable (ecma_property_t property) /**< property */\n{\n  JERRY_ASSERT (property & ECMA_PROPERTY_FLAG_DATA);\n\n  return (property & ECMA_PROPERTY_FLAG_WRITABLE) != 0;\n} /* ecma_is_property_writable */\n\n/**\n * Set property's 'Writable' attribute value\n */\nvoid\necma_set_property_writable_attr (ecma_property_t *property_p, /**< [in,out] property */\n                                 bool is_writable) /**< new value for writable flag */\n{\n  JERRY_ASSERT (ECMA_PROPERTY_IS_RAW_DATA (*property_p));\n\n  if (is_writable)\n  {\n    *property_p = (uint8_t) (*property_p | ECMA_PROPERTY_FLAG_WRITABLE);\n  }\n  else\n  {\n    *property_p = (uint8_t) (*property_p & ~ECMA_PROPERTY_FLAG_WRITABLE);\n  }\n} /* ecma_set_property_writable_attr */\n\n/**\n * Get property's 'Enumerable' attribute value\n *\n * @return true - property is enumerable,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_is_property_enumerable (ecma_property_t property) /**< property */\n{\n  JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (property));\n\n  return (property & ECMA_PROPERTY_FLAG_ENUMERABLE) != 0;\n} /* ecma_is_property_enumerable */\n\n/**\n * Set property's 'Enumerable' attribute value\n */\nvoid\necma_set_property_enumerable_attr (ecma_property_t *property_p, /**< [in,out] property */\n                                   bool is_enumerable) /**< new value for enumerable flag */\n{\n  JERRY_ASSERT (ECMA_PROPERTY_IS_RAW (*property_p));\n\n  if (is_enumerable)\n  {\n    *property_p = (uint8_t) (*property_p | ECMA_PROPERTY_FLAG_ENUMERABLE);\n  }\n  else\n  {\n    *property_p = (uint8_t) (*property_p & ~ECMA_PROPERTY_FLAG_ENUMERABLE);\n  }\n} /* ecma_set_property_enumerable_attr */\n\n/**\n * Get property's 'Configurable' attribute value\n *\n * @return true - property is configurable,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_is_property_configurable (ecma_property_t property) /**< property */\n{\n  JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (property));\n\n  return (property & ECMA_PROPERTY_FLAG_CONFIGURABLE) != 0;\n} /* ecma_is_property_configurable */\n\n/**\n * Set property's 'Configurable' attribute value\n */\nvoid\necma_set_property_configurable_attr (ecma_property_t *property_p, /**< [in,out] property */\n                                     bool is_configurable) /**< new value for configurable flag */\n{\n  JERRY_ASSERT (ECMA_PROPERTY_IS_RAW (*property_p));\n\n  if (is_configurable)\n  {\n    *property_p = (uint8_t) (*property_p | ECMA_PROPERTY_FLAG_CONFIGURABLE);\n  }\n  else\n  {\n    *property_p = (uint8_t) (*property_p & ~ECMA_PROPERTY_FLAG_CONFIGURABLE);\n  }\n} /* ecma_set_property_configurable_attr */\n\n#if JERRY_LCACHE\n\n/**\n * Check whether the property is registered in LCache\n *\n * @return true / false\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_is_property_lcached (ecma_property_t *property_p) /**< property */\n{\n  JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (*property_p));\n\n  return (*property_p & ECMA_PROPERTY_FLAG_LCACHED) != 0;\n} /* ecma_is_property_lcached */\n\n/**\n * Set value of flag indicating whether the property is registered in LCache\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\necma_set_property_lcached (ecma_property_t *property_p, /**< property */\n                           bool is_lcached) /**< new value for lcached flag */\n{\n  JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (*property_p));\n\n  if (is_lcached)\n  {\n    *property_p = (uint8_t) (*property_p | ECMA_PROPERTY_FLAG_LCACHED);\n  }\n  else\n  {\n    *property_p = (uint8_t) (*property_p & ~ECMA_PROPERTY_FLAG_LCACHED);\n  }\n} /* ecma_set_property_lcached */\n\n#endif /* JERRY_LCACHE */\n\n/**\n * Construct empty property descriptor, i.e.:\n *  property descriptor with all is_defined flags set to false and the rest - to default value.\n *\n * @return empty property descriptor\n */\necma_property_descriptor_t\necma_make_empty_property_descriptor (void)\n{\n  ecma_property_descriptor_t prop_desc;\n\n  prop_desc.flags = 0;\n  prop_desc.value = ECMA_VALUE_UNDEFINED;\n  prop_desc.get_p = NULL;\n  prop_desc.set_p = NULL;\n\n  return prop_desc;\n} /* ecma_make_empty_property_descriptor */\n\n/**\n * Free values contained in the property descriptor\n * and make it empty property descriptor\n */\nvoid\necma_free_property_descriptor (ecma_property_descriptor_t *prop_desc_p) /**< property descriptor */\n{\n  if (prop_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n  {\n    ecma_free_value (prop_desc_p->value);\n  }\n\n  if ((prop_desc_p->flags & JERRY_PROP_IS_GET_DEFINED) && prop_desc_p->get_p != NULL)\n  {\n    ecma_deref_object (prop_desc_p->get_p);\n  }\n\n  if ((prop_desc_p->flags & JERRY_PROP_IS_SET_DEFINED) && prop_desc_p->set_p != NULL)\n  {\n    ecma_deref_object (prop_desc_p->set_p);\n  }\n\n  *prop_desc_p = ecma_make_empty_property_descriptor ();\n} /* ecma_free_property_descriptor */\n\n/**\n * Increase ref count of an extended primitve value.\n */\nvoid\necma_ref_extended_primitive (ecma_extended_primitive_t *primitve_p) /**< extended primitve value */\n{\n  if (JERRY_LIKELY (primitve_p->refs_and_type < ECMA_EXTENDED_PRIMITIVE_MAX_REF))\n  {\n    primitve_p->refs_and_type += ECMA_EXTENDED_PRIMITIVE_REF_ONE;\n  }\n  else\n  {\n    jerry_fatal (JERRY_FATAL_REF_COUNT_LIMIT);\n  }\n} /* ecma_ref_extended_primitive */\n\n/**\n * Decrease ref count of an error reference.\n */\nvoid\necma_deref_exception (ecma_extended_primitive_t *error_ref_p) /**< error reference */\n{\n  JERRY_ASSERT (error_ref_p->refs_and_type >= ECMA_EXTENDED_PRIMITIVE_REF_ONE);\n\n  error_ref_p->refs_and_type -= ECMA_EXTENDED_PRIMITIVE_REF_ONE;\n\n  if (error_ref_p->refs_and_type < ECMA_EXTENDED_PRIMITIVE_REF_ONE)\n  {\n    ecma_free_value (error_ref_p->u.value);\n    jmem_pools_free (error_ref_p, sizeof (ecma_extended_primitive_t));\n  }\n} /* ecma_deref_exception */\n\n#if JERRY_BUILTIN_BIGINT\n\n/**\n * Decrease ref count of a bigint value.\n */\nvoid\necma_deref_bigint (ecma_extended_primitive_t *bigint_p) /**< bigint value */\n{\n  JERRY_ASSERT (bigint_p->refs_and_type >= ECMA_EXTENDED_PRIMITIVE_REF_ONE);\n\n  bigint_p->refs_and_type -= ECMA_EXTENDED_PRIMITIVE_REF_ONE;\n\n  if (bigint_p->refs_and_type >= ECMA_EXTENDED_PRIMITIVE_REF_ONE)\n  {\n    return;\n  }\n\n  uint32_t size = ECMA_BIGINT_GET_SIZE (bigint_p);\n\n  JERRY_ASSERT (size > 0);\n\n  size_t mem_size = ECMA_BIGINT_GET_BYTE_SIZE (size) + sizeof (ecma_extended_primitive_t);\n  jmem_heap_free_block (bigint_p, mem_size);\n} /* ecma_deref_bigint */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n\n/**\n * Create an error reference from a given value.\n *\n * Note:\n *   Reference of the value is taken.\n *\n * @return error reference value\n */\necma_value_t\necma_create_exception (ecma_value_t value, /**< referenced value */\n                       uint32_t options) /**< ECMA_ERROR_API_* options */\n{\n  ecma_extended_primitive_t *error_ref_p;\n  error_ref_p = (ecma_extended_primitive_t *) jmem_pools_alloc (sizeof (ecma_extended_primitive_t));\n\n  error_ref_p->refs_and_type = ECMA_EXTENDED_PRIMITIVE_REF_ONE | options;\n  error_ref_p->u.value = value;\n  return ecma_make_extended_primitive_value (error_ref_p, ECMA_TYPE_ERROR);\n} /* ecma_create_exception */\n\n/**\n * Create an error reference from the currently thrown error value.\n *\n * @return error reference value\n */\necma_value_t\necma_create_exception_from_context (void)\n{\n  uint32_t options = 0;\n  uint32_t status_flags = JERRY_CONTEXT (status_flags);\n\n  if (status_flags & ECMA_STATUS_ABORT)\n  {\n    options |= ECMA_ERROR_API_FLAG_ABORT;\n  }\n\n#if JERRY_VM_THROW\n  if (status_flags & ECMA_STATUS_ERROR_THROWN)\n  {\n    options |= ECMA_ERROR_API_FLAG_THROW_CAPTURED;\n  }\n#endif /* JERRY_VM_THROW */\n\n  return ecma_create_exception (jcontext_take_exception (), options);\n} /* ecma_create_exception_from_context */\n\n/**\n * Create an exception from a given object.\n *\n * Note:\n *   Reference of the object is taken.\n *\n * @return exception value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_create_exception_from_object (ecma_object_t *object_p) /**< referenced object */\n{\n  return ecma_create_exception (ecma_make_object_value (object_p), 0);\n} /* ecma_create_exception_from_object */\n\n/**\n * Raise a new exception from the argument exception value.\n *\n * Note: the argument exceptions reference count is decreased\n */\nvoid\necma_throw_exception (ecma_value_t value) /**< error reference */\n{\n  JERRY_ASSERT (!jcontext_has_pending_exception () && !jcontext_has_pending_abort ());\n  ecma_extended_primitive_t *error_ref_p = ecma_get_extended_primitive_from_value (value);\n\n  JERRY_ASSERT (error_ref_p->refs_and_type >= ECMA_EXTENDED_PRIMITIVE_REF_ONE);\n\n  ecma_value_t referenced_value = error_ref_p->u.value;\n  uint32_t status_flags = JERRY_CONTEXT (status_flags);\n\n  status_flags |= (ECMA_STATUS_EXCEPTION\n#if JERRY_VM_THROW\n                   | ECMA_STATUS_ERROR_THROWN\n#endif /* JERRY_VM_THROW */\n                   | ECMA_STATUS_ABORT);\n\n  if (!(error_ref_p->refs_and_type & ECMA_ERROR_API_FLAG_ABORT))\n  {\n    status_flags &= ~(uint32_t) ECMA_STATUS_ABORT;\n  }\n\n#if JERRY_VM_THROW\n  if (!(error_ref_p->refs_and_type & ECMA_ERROR_API_FLAG_THROW_CAPTURED))\n  {\n    status_flags &= ~(uint32_t) ECMA_STATUS_ERROR_THROWN;\n  }\n#endif /* JERRY_VM_THROW */\n\n  JERRY_CONTEXT (status_flags) = status_flags;\n\n  if (error_ref_p->refs_and_type >= 2 * ECMA_EXTENDED_PRIMITIVE_REF_ONE)\n  {\n    error_ref_p->refs_and_type -= ECMA_EXTENDED_PRIMITIVE_REF_ONE;\n    referenced_value = ecma_copy_value (referenced_value);\n  }\n  else\n  {\n    jmem_pools_free (error_ref_p, sizeof (ecma_extended_primitive_t));\n  }\n\n  JERRY_CONTEXT (error_value) = referenced_value;\n} /* ecma_throw_exception */\n\n/**\n * Decrease the reference counter of a script value.\n */\nvoid\necma_script_deref (ecma_value_t script_value) /**< script value */\n{\n  cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n  script_p->refs_and_type -= CBC_SCRIPT_REF_ONE;\n\n  if (script_p->refs_and_type >= CBC_SCRIPT_REF_ONE)\n  {\n    return;\n  }\n\n  size_t script_size = sizeof (cbc_script_t);\n  uint32_t type = script_p->refs_and_type;\n\n  if (type & CBC_SCRIPT_HAS_USER_VALUE)\n  {\n    script_size += sizeof (ecma_value_t);\n\n    if (!(type & CBC_SCRIPT_USER_VALUE_IS_OBJECT))\n    {\n      ecma_value_t user_value = CBC_SCRIPT_GET_USER_VALUE (script_p);\n\n      JERRY_ASSERT (!ecma_is_value_object (user_value));\n      ecma_free_value (user_value);\n    }\n  }\n\n#if JERRY_SOURCE_NAME\n  ecma_deref_ecma_string (ecma_get_string_from_value (script_p->source_name));\n#endif /* JERRY_SOURCE_NAME */\n\n#if JERRY_MODULE_SYSTEM\n  if (type & CBC_SCRIPT_HAS_IMPORT_META)\n  {\n    JERRY_ASSERT (!(type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS));\n    JERRY_ASSERT (ecma_is_value_object (CBC_SCRIPT_GET_IMPORT_META (script_p, type)));\n\n    script_size += sizeof (ecma_value_t);\n  }\n#endif /* JERRY_MODULE_SYSTEM */\n\n#if JERRY_FUNCTION_TO_STRING\n  ecma_deref_ecma_string (ecma_get_string_from_value (script_p->source_code));\n\n  if (type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS)\n  {\n    ecma_deref_ecma_string (ecma_get_string_from_value (CBC_SCRIPT_GET_FUNCTION_ARGUMENTS (script_p, type)));\n    script_size += sizeof (ecma_value_t);\n  }\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n  jmem_heap_free_block (script_p, script_size);\n} /* ecma_script_deref */\n\n/**\n * Increase reference counter of Compact\n * Byte Code or regexp byte code.\n */\nvoid\necma_bytecode_ref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */\n{\n  /* Abort program if maximum reference number is reached. */\n  if (bytecode_p->refs >= UINT16_MAX)\n  {\n    jerry_fatal (JERRY_FATAL_REF_COUNT_LIMIT);\n  }\n\n  bytecode_p->refs++;\n} /* ecma_bytecode_ref */\n\n/**\n * Decrease reference counter of Compact\n * Byte Code or regexp byte code.\n */\nvoid\necma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */\n{\n  JERRY_ASSERT (bytecode_p->refs > 0);\n  JERRY_ASSERT (!CBC_IS_FUNCTION (bytecode_p->status_flags)\n                || !(bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION));\n\n  bytecode_p->refs--;\n\n  if (bytecode_p->refs > 0)\n  {\n    /* Non-zero reference counter. */\n    return;\n  }\n\n  if (CBC_IS_FUNCTION (bytecode_p->status_flags))\n  {\n    ecma_value_t *literal_start_p = NULL;\n    uint32_t literal_end;\n    uint32_t const_literal_end;\n\n    if (bytecode_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n    {\n      cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_p;\n      literal_end = args_p->literal_end;\n      const_literal_end = args_p->const_literal_end;\n\n      literal_start_p = (ecma_value_t *) ((uint8_t *) bytecode_p + sizeof (cbc_uint16_arguments_t));\n      literal_start_p -= args_p->register_end;\n    }\n    else\n    {\n      cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_p;\n      literal_end = args_p->literal_end;\n      const_literal_end = args_p->const_literal_end;\n\n      literal_start_p = (ecma_value_t *) ((uint8_t *) bytecode_p + sizeof (cbc_uint8_arguments_t));\n      literal_start_p -= args_p->register_end;\n    }\n\n    for (uint32_t i = const_literal_end; i < literal_end; i++)\n    {\n      ecma_compiled_code_t *bytecode_literal_p =\n        ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_start_p[i]);\n\n      /* Self references are ignored. */\n      if (bytecode_literal_p != bytecode_p)\n      {\n        ecma_bytecode_deref (bytecode_literal_p);\n      }\n    }\n\n    ecma_script_deref (((cbc_uint8_arguments_t *) bytecode_p)->script_value);\n\n    if (bytecode_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)\n    {\n      ecma_collection_t *collection_p = ecma_compiled_code_get_tagged_template_collection (bytecode_p);\n\n      /* Since the objects in the tagged template collection are not strong referenced anymore by the compiled code\n         we can treat them as 'new' objects. */\n      JERRY_CONTEXT (ecma_gc_new_objects) += collection_p->item_count * 2;\n      ecma_collection_free_template_literal (collection_p);\n    }\n\n#if JERRY_LINE_INFO\n    if (bytecode_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO)\n    {\n      ecma_line_info_free (ecma_compiled_code_get_line_info (bytecode_p));\n    }\n#endif /* JERRY_LINE_INFO */\n\n#if JERRY_DEBUGGER\n    if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n        && !(bytecode_p->status_flags & CBC_CODE_FLAGS_DEBUGGER_IGNORE)\n        && jerry_debugger_send_function_cp (JERRY_DEBUGGER_RELEASE_BYTE_CODE_CP, bytecode_p))\n    {\n      /* Delay the byte code free until the debugger client is notified.\n       * If the connection is aborted the pointer is still freed by\n       * jerry_debugger_close_connection(). */\n      jerry_debugger_byte_code_free_t *byte_code_free_p = (jerry_debugger_byte_code_free_t *) bytecode_p;\n      jmem_cpointer_t byte_code_free_head = JERRY_CONTEXT (debugger_byte_code_free_head);\n\n      byte_code_free_p->prev_cp = ECMA_NULL_POINTER;\n\n      jmem_cpointer_t byte_code_free_cp;\n      JMEM_CP_SET_NON_NULL_POINTER (byte_code_free_cp, byte_code_free_p);\n\n      if (byte_code_free_head == ECMA_NULL_POINTER)\n      {\n        JERRY_CONTEXT (debugger_byte_code_free_tail) = byte_code_free_cp;\n      }\n      else\n      {\n        jerry_debugger_byte_code_free_t *first_byte_code_free_p;\n\n        first_byte_code_free_p = JMEM_CP_GET_NON_NULL_POINTER (jerry_debugger_byte_code_free_t, byte_code_free_head);\n        first_byte_code_free_p->prev_cp = byte_code_free_cp;\n      }\n\n      JERRY_CONTEXT (debugger_byte_code_free_head) = byte_code_free_cp;\n      return;\n    }\n#endif /* JERRY_DEBUGGER */\n\n#if JERRY_MEM_STATS\n    jmem_stats_free_byte_code_bytes (((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);\n#endif /* JERRY_MEM_STATS */\n  }\n  else\n  {\n#if JERRY_BUILTIN_REGEXP\n    re_compiled_code_t *re_bytecode_p = (re_compiled_code_t *) bytecode_p;\n\n    ecma_deref_ecma_string (ecma_get_string_from_value (re_bytecode_p->source));\n#endif /* JERRY_BUILTIN_REGEXP */\n  }\n\n  jmem_heap_free_block (bytecode_p, ((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);\n} /* ecma_bytecode_deref */\n\n/**\n * Gets the script data asigned to a script / module / function\n *\n * @return script data - if available, JMEM_CP_NULL - otherwise\n */\necma_value_t\necma_script_get_from_value (ecma_value_t value) /**< compiled code */\n{\n  if (!ecma_is_value_object (value))\n  {\n    return JMEM_CP_NULL;\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (value);\n  const ecma_compiled_code_t *bytecode_p = NULL;\n\n  while (true)\n  {\n    switch (ecma_get_object_type (object_p))\n    {\n      case ECMA_OBJECT_TYPE_CLASS:\n      {\n        ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n        if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_SCRIPT)\n        {\n          bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);\n          break;\n        }\n\n#if JERRY_MODULE_SYSTEM\n        if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_MODULE)\n        {\n          ecma_module_t *module_p = (ecma_module_t *) object_p;\n\n          if (!(module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE))\n          {\n            bytecode_p = module_p->u.compiled_code_p;\n            break;\n          }\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n        return JMEM_CP_NULL;\n      }\n      case ECMA_OBJECT_TYPE_FUNCTION:\n      {\n        bytecode_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n      {\n        ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n        object_p =\n          ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_object_p->u.bound_function.target_function);\n        continue;\n      }\n      case ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION:\n      {\n        return ((ecma_extended_object_t *) object_p)->u.constructor_function.script_value;\n      }\n      default:\n      {\n        return JMEM_CP_NULL;\n      }\n    }\n\n    JERRY_ASSERT (bytecode_p != NULL);\n    return ((cbc_uint8_arguments_t *) bytecode_p)->script_value;\n  }\n} /* ecma_script_get_from_value */\n\n/**\n * Resolve the position of the arguments list start of the compiled code\n *\n * @return start position of the arguments list start of the compiled code\n */\necma_value_t *\necma_compiled_code_resolve_arguments_start (const ecma_compiled_code_t *bytecode_header_p) /**< compiled code */\n{\n  JERRY_ASSERT (bytecode_header_p != NULL);\n\n  uint8_t *byte_p = (uint8_t *) bytecode_header_p;\n  byte_p += ((size_t) bytecode_header_p->size) << JMEM_ALIGNMENT_LOG;\n\n  if (!(bytecode_header_p->status_flags & CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED))\n  {\n    return ((ecma_value_t *) byte_p);\n  }\n\n  if (JERRY_LIKELY (!(bytecode_header_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)))\n  {\n    return ((ecma_value_t *) byte_p) - ((cbc_uint8_arguments_t *) bytecode_header_p)->argument_end;\n  }\n\n  return ((ecma_value_t *) byte_p) - ((cbc_uint16_arguments_t *) bytecode_header_p)->argument_end;\n} /* ecma_compiled_code_resolve_arguments_start */\n\n/**\n * Resolve the position of the function name of the compiled code\n *\n * @return position of the function name of the compiled code\n */\nextern inline ecma_value_t *JERRY_ATTR_ALWAYS_INLINE\necma_compiled_code_resolve_function_name (const ecma_compiled_code_t *bytecode_header_p) /**< compiled code */\n{\n  JERRY_ASSERT (bytecode_header_p != NULL);\n  ecma_value_t *base_p = ecma_compiled_code_resolve_arguments_start (bytecode_header_p);\n\n  if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)\n  {\n    base_p--;\n  }\n\n  return base_p;\n} /* ecma_compiled_code_resolve_function_name */\n\n/**\n * Get the tagged template collection of the compiled code\n *\n * @return pointer to the tagged template collection\n */\necma_collection_t *\necma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *bytecode_header_p) /**< compiled code */\n{\n  JERRY_ASSERT (bytecode_header_p != NULL);\n  JERRY_ASSERT (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS);\n\n  ecma_value_t *base_p = ecma_compiled_code_resolve_function_name (bytecode_header_p);\n  return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, base_p[-1]);\n} /* ecma_compiled_code_get_tagged_template_collection */\n\n#if JERRY_LINE_INFO\n\n/**\n * Get the line info data from the byte code\n *\n * @return pointer to the line info data\n */\nuint8_t *\necma_compiled_code_get_line_info (const ecma_compiled_code_t *bytecode_header_p) /**< compiled code */\n{\n  JERRY_ASSERT (bytecode_header_p != NULL);\n  JERRY_ASSERT (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO);\n\n  ecma_value_t *base_p = ecma_compiled_code_resolve_arguments_start (bytecode_header_p);\n\n  if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)\n  {\n    base_p--;\n  }\n\n  if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)\n  {\n    base_p--;\n  }\n\n  return ECMA_GET_INTERNAL_VALUE_POINTER (uint8_t, base_p[-1]);\n} /* ecma_compiled_code_get_line_info */\n\n#endif /* JERRY_LINE_INFO */\n\n/**\n * Get the source name of a compiled code.\n *\n * @return source name value\n */\necma_value_t\necma_get_source_name (const ecma_compiled_code_t *bytecode_p) /**< compiled code */\n{\n#if JERRY_SOURCE_NAME\n#if JERRY_SNAPSHOT_EXEC\n  if (JERRY_UNLIKELY (bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING_SOURCE_NAME_ANON);\n  }\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n  ecma_value_t script_value = ((cbc_uint8_arguments_t *) bytecode_p)->script_value;\n  return ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value)->source_name;\n#else /* !JERRY_SOURCE_NAME */\n  JERRY_UNUSED (bytecode_p);\n  return ecma_make_magic_string_value (LIT_MAGIC_STRING_SOURCE_NAME_ANON);\n#endif /* !JERRY_SOURCE_NAME */\n} /* ecma_get_source_name */\n\n#if (JERRY_STACK_LIMIT != 0)\n/**\n * Check the current stack usage by calculating the difference from the initial stack base.\n *\n * @return current stack usage in bytes\n */\nuintptr_t JERRY_ATTR_NOINLINE\necma_get_current_stack_usage (void)\n{\n  volatile int __sp;\n  return (uintptr_t) (JERRY_CONTEXT (stack_base) - (uintptr_t) &__sp);\n} /* ecma_get_current_stack_usage */\n\n#endif /* (JERRY_STACK_LIMIT != 0) */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-helpers.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_HELPERS_H\n#define ECMA_HELPERS_H\n\n#include \"ecma-globals.h\"\n\n#include \"jmem.h\"\n#include \"lit-strings.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmahelpers Helpers for operations with ECMA data types\n * @{\n */\n\n/**\n * Get value of pointer from specified non-null compressed pointer.\n */\n#define ECMA_GET_NON_NULL_POINTER(type, field) JMEM_CP_GET_NON_NULL_POINTER (type, field)\n\n/**\n * Extract value of pointer from specified pointer-tag value\n */\n#define ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG(type, field) \\\n  JMEM_CP_GET_NON_NULL_POINTER_FROM_POINTER_TAG (type, field)\n\n/**\n * Get value of pointer from specified compressed pointer.\n */\n#define ECMA_GET_POINTER(type, field) JMEM_CP_GET_POINTER (type, field)\n\n/**\n * Set value of non-null compressed pointer so that it will correspond\n * to specified non_compressed_pointer.\n */\n#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) \\\n  JMEM_CP_SET_NON_NULL_POINTER (field, non_compressed_pointer)\n\n/**\n * Set value of pointer-tag value so that it will correspond\n * to specified non_compressed_pointer along with tag\n */\n#define ECMA_SET_NON_NULL_POINTER_TAG(field, non_compressed_pointer, tag) \\\n  JMEM_CP_SET_NON_NULL_POINTER_TAG (field, non_compressed_pointer, tag)\n\n/**\n * Set value of compressed pointer so that it will correspond\n * to specified non_compressed_pointer.\n */\n#define ECMA_SET_POINTER(field, non_compressed_pointer) JMEM_CP_SET_POINTER (field, non_compressed_pointer)\n\n/**\n * Get value of each tag bit from specified pointer-tag value\n */\n#define ECMA_GET_FIRST_BIT_FROM_POINTER_TAG(field) \\\n  JMEM_CP_GET_FIRST_BIT_FROM_POINTER_TAG (field) /**< get first tag bit from jmem_cpointer_tag_t **/\n#define ECMA_GET_SECOND_BIT_FROM_POINTER_TAG(field) \\\n  JMEM_CP_GET_SECOND_BIT_FROM_POINTER_TAG (field) /**< get second tag bit from jmem_cpointer_tag_t **/\n#define ECMA_GET_THIRD_BIT_FROM_POINTER_TAG(field) \\\n  JMEM_CP_GET_THIRD_BIT_FROM_POINTER_TAG (field) /**< get third tag bit from jmem_cpointer_tag_t **/\n\n/**\n * Set value of each tag bit to specified pointer-tag value\n */\n#define ECMA_SET_FIRST_BIT_TO_POINTER_TAG(field) \\\n  JMEM_CP_SET_FIRST_BIT_TO_POINTER_TAG (field) /**< set first tag bit to jmem_cpointer_tag_t **/\n#define ECMA_SET_SECOND_BIT_TO_POINTER_TAG(field) \\\n  JMEM_CP_SET_SECOND_BIT_TO_POINTER_TAG (field) /**< set second tag bit to jmem_cpointer_tag_t **/\n#define ECMA_SET_THIRD_BIT_TO_POINTER_TAG(field) \\\n  JMEM_CP_SET_THIRD_BIT_TO_POINTER_TAG (field) /**< set third tag bit to jmem_cpointer_tag_t **/\n\n/**\n * Status flags for ecma_string_get_chars function\n */\ntypedef enum\n{\n  ECMA_STRING_FLAG_EMPTY = 0, /**< No options are provided. */\n  ECMA_STRING_FLAG_IS_ASCII = (1 << 0), /**< The string contains only ASCII characters. */\n  ECMA_STRING_FLAG_REHASH_NEEDED = (1 << 1), /**< The hash of the string must be recalculated.\n                                              *   For more details see ecma_append_chars_to_string */\n  ECMA_STRING_FLAG_IS_UINT32 = (1 << 2), /**< The string repesents an UINT32 number */\n  ECMA_STRING_FLAG_MUST_BE_FREED = (1 << 3), /**< The returned buffer must be freed */\n} ecma_string_flag_t;\n\n/**\n * Underscore is ignored when this option is passed.\n */\n#define ECMA_CONVERSION_ALLOW_UNDERSCORE 0x1\n\n/**\n * Convert ecma-string's contents to a cesu-8 string and put it into a buffer.\n */\n#define ECMA_STRING_TO_UTF8_STRING(ecma_str_ptr, /**< ecma string pointer */       \\\n                                   utf8_ptr, /**< [out] output buffer pointer */   \\\n                                   utf8_str_size) /**< [out] output buffer size */ \\\n  lit_utf8_size_t utf8_str_size;                                                   \\\n  uint8_t utf8_ptr##flags = ECMA_STRING_FLAG_EMPTY;                                \\\n  const lit_utf8_byte_t *utf8_ptr = ecma_string_get_chars (ecma_str_ptr, &utf8_str_size, NULL, NULL, &utf8_ptr##flags);\n\n/**\n * Free the cesu-8 string buffer allocated by 'ECMA_STRING_TO_UTF8_STRING'\n */\n#define ECMA_FINALIZE_UTF8_STRING(utf8_ptr, /**< pointer to character buffer */ \\\n                                  utf8_str_size) /**< buffer size */            \\\n  if (utf8_ptr##flags & ECMA_STRING_FLAG_MUST_BE_FREED)                         \\\n  {                                                                             \\\n    JERRY_ASSERT (utf8_ptr != NULL);                                            \\\n    jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size);                    \\\n  }\n\n#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY\n\n/**\n * Set an internal property value from pointer.\n */\n#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) ((field) = ((ecma_value_t) pointer))\n\n/**\n * Set an internal property value from pointer. Pointer can be NULL.\n */\n#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) ((field) = ((ecma_value_t) pointer))\n\n/**\n * Convert an internal property value to pointer.\n */\n#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) ((type *) field)\n\n/**\n * Convert an internal property value to pointer. Result can be NULL.\n */\n#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) ((type *) field)\n\n/**\n * Checks whether an internal property is NULL.\n */\n#define ECMA_IS_INTERNAL_VALUE_NULL(field) ((field) == ((ecma_value_t) NULL))\n\n#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */\n\n/**\n * Set an internal property value from pointer.\n */\n#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer)     ECMA_SET_NON_NULL_POINTER (field, pointer)\n\n/**\n * Set an internal property value from pointer. Pointer can be NULL.\n */\n#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) ECMA_SET_POINTER (field, pointer)\n\n/**\n * Convert an internal property value to pointer.\n */\n#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field)        ECMA_GET_NON_NULL_POINTER (type, field)\n\n/**\n * Convert an internal property value to pointer. Result can be NULL.\n */\n#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field)    ECMA_GET_POINTER (type, field)\n\n/**\n * Checks whether an internal property is NULL.\n */\n#define ECMA_IS_INTERNAL_VALUE_NULL(field)                  ((field) == ((ecma_value_t) JMEM_CP_NULL))\n\n#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */\n\n/**\n * Convert boolean to bitfield value.\n */\n#define ECMA_BOOL_TO_BITFIELD(x) ((x) ? 1 : 0)\n\n/**\n * Check whether the given type is ECMA_OBJECT_TYPE_PROXY\n *\n * @param type object type\n */\n#define ECMA_OBJECT_TYPE_IS_PROXY(type) (JERRY_UNLIKELY ((type) == ECMA_OBJECT_TYPE_PROXY))\n\n/**\n * Check whether the given object has [[ProxyHandler]] and [[ProxyTarger]] internal slots\n *\n * @param obj_p ecma-object\n */\n#if JERRY_BUILTIN_PROXY\n#define ECMA_OBJECT_IS_PROXY(obj_p) (ECMA_OBJECT_TYPE_IS_PROXY (ecma_get_object_type ((obj_p))))\n#else /* !JERRY_BUILTIN_PROXY */\n#define ECMA_OBJECT_IS_PROXY(obj_p) (false)\n#endif /* JERRY_BUILTIN_PROXY */\n\n/* ecma-helpers-value.c */\necma_type_t JERRY_ATTR_CONST ecma_get_value_type_field (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_direct (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_simple (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_empty (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_undefined (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_null (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_boolean (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_true (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_false (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_found (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_array_hole (ecma_value_t value);\n\nbool JERRY_ATTR_CONST ecma_is_value_integer_number (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_are_values_integer_numbers (ecma_value_t first_value, ecma_value_t second_value);\nbool JERRY_ATTR_CONST ecma_is_value_float_number (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_number (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_string (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_symbol (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_magic_string (ecma_value_t value, lit_magic_string_id_t id);\nbool JERRY_ATTR_CONST ecma_is_value_bigint (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_prop_name (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_direct_string (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_non_direct_string (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_object (ecma_value_t value);\nbool JERRY_ATTR_CONST ecma_is_value_exception (ecma_value_t value);\necma_value_t ecma_is_value_array (ecma_value_t arg);\n\nvoid ecma_check_value_type_is_spec_defined (ecma_value_t value);\n\necma_value_t JERRY_ATTR_CONST ecma_make_boolean_value (bool boolean_value);\necma_value_t JERRY_ATTR_CONST ecma_make_integer_value (ecma_integer_value_t integer_value);\necma_value_t ecma_make_nan_value (void);\necma_value_t ecma_make_float_value (ecma_number_t *ecma_num_p);\necma_value_t ecma_make_length_value (ecma_length_t length);\necma_value_t ecma_make_number_value (ecma_number_t ecma_number);\necma_value_t ecma_make_int32_value (int32_t int32_number);\necma_value_t ecma_make_uint32_value (uint32_t uint32_number);\necma_value_t JERRY_ATTR_PURE ecma_make_string_value (const ecma_string_t *ecma_string_p);\necma_value_t JERRY_ATTR_PURE ecma_make_symbol_value (const ecma_string_t *ecma_symbol_p);\necma_value_t JERRY_ATTR_PURE ecma_make_prop_name_value (const ecma_string_t *ecma_prop_name_p);\necma_value_t JERRY_ATTR_PURE ecma_make_magic_string_value (lit_magic_string_id_t id);\necma_value_t JERRY_ATTR_PURE ecma_make_object_value (const ecma_object_t *object_p);\necma_value_t JERRY_ATTR_PURE ecma_make_extended_primitive_value (const ecma_extended_primitive_t *primitve_p,\n                                                                 uint32_t type);\necma_integer_value_t JERRY_ATTR_CONST ecma_get_integer_from_value (ecma_value_t value);\necma_number_t JERRY_ATTR_PURE ecma_get_float_from_value (ecma_value_t value);\necma_number_t *ecma_get_pointer_from_float_value (ecma_value_t value);\necma_number_t JERRY_ATTR_PURE ecma_get_number_from_value (ecma_value_t value);\necma_string_t JERRY_ATTR_PURE *ecma_get_string_from_value (ecma_value_t value);\necma_string_t JERRY_ATTR_PURE *ecma_get_symbol_from_value (ecma_value_t value);\necma_string_t JERRY_ATTR_PURE *ecma_get_prop_name_from_value (ecma_value_t value);\necma_object_t JERRY_ATTR_PURE *ecma_get_object_from_value (ecma_value_t value);\necma_extended_primitive_t JERRY_ATTR_PURE *ecma_get_extended_primitive_from_value (ecma_value_t value);\necma_value_t JERRY_ATTR_CONST ecma_invert_boolean_value (ecma_value_t value);\necma_value_t ecma_copy_value (ecma_value_t value);\necma_value_t ecma_fast_copy_value (ecma_value_t value);\necma_value_t ecma_copy_value_if_not_object (ecma_value_t value);\nvoid ecma_ref_if_object (ecma_value_t value);\nvoid ecma_deref_if_object (ecma_value_t value);\necma_value_t ecma_update_float_number (ecma_value_t float_value, ecma_number_t new_number);\nvoid ecma_value_assign_value (ecma_value_t *value_p, ecma_value_t ecma_value);\nvoid ecma_value_assign_number (ecma_value_t *value_p, ecma_number_t ecma_number);\nvoid ecma_free_value (ecma_value_t value);\nvoid ecma_fast_free_value (ecma_value_t value);\nvoid ecma_free_value_if_not_object (ecma_value_t value);\nvoid ecma_free_object (ecma_value_t value);\nvoid ecma_free_number (ecma_value_t value);\nlit_magic_string_id_t ecma_get_typeof_lit_id (ecma_value_t value);\n\n/* ecma-helpers-string.c */\necma_string_t *ecma_new_symbol_from_descriptor_string (ecma_value_t string_desc);\nbool ecma_prop_name_is_symbol (ecma_string_t *string_p);\necma_length_t ecma_op_advance_string_index (ecma_string_t *str_p, ecma_length_t index_num, bool is_unicode);\n#if JERRY_BUILTIN_CONTAINER\necma_string_t *ecma_new_map_key_string (ecma_value_t value);\nbool ecma_prop_name_is_map_key (ecma_string_t *string_p);\n#endif /* JERRY_BUILTIN_CONTAINER */\necma_string_t *ecma_new_ecma_string_from_ascii (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);\necma_string_t *ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);\necma_string_t *ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string_p,\n                                                                  lit_utf8_size_t string_size);\necma_string_t *\necma_new_ecma_external_string_from_cesu8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size, void *user_p);\necma_string_t *ecma_new_ecma_string_from_code_unit (ecma_char_t code_unit);\necma_string_t *ecma_new_ecma_string_from_code_units (ecma_char_t first_code_unit, ecma_char_t second_code_unit);\necma_string_t *ecma_new_ecma_string_from_length (ecma_length_t index);\necma_string_t *ecma_new_ecma_string_from_uint32 (uint32_t uint32_number);\necma_string_t *ecma_new_non_direct_string_from_uint32 (uint32_t uint32_number);\necma_string_t *ecma_get_ecma_string_from_uint32 (uint32_t uint32_number);\necma_string_t *ecma_new_ecma_string_from_number (ecma_number_t num);\necma_string_t *ecma_get_magic_string (lit_magic_string_id_t id);\necma_string_t *ecma_get_internal_string (lit_magic_string_id_t id);\necma_string_t *ecma_append_chars_to_string (ecma_string_t *string1_p,\n                                            const lit_utf8_byte_t *cesu8_string2_p,\n                                            lit_utf8_size_t cesu8_string2_size,\n                                            lit_utf8_size_t cesu8_string2_length);\necma_string_t *ecma_concat_ecma_strings (ecma_string_t *string1_p, ecma_string_t *string2_p);\nvoid ecma_ref_ecma_string (ecma_string_t *string_p);\nvoid ecma_ref_ecma_string_non_direct (ecma_string_t *string_p);\nvoid ecma_deref_ecma_string (ecma_string_t *string_p);\nvoid ecma_deref_ecma_string_non_direct (ecma_string_t *string_p);\nvoid ecma_destroy_ecma_string (ecma_string_t *string_p);\necma_number_t ecma_string_to_number (const ecma_string_t *str_p);\nuint32_t ecma_string_get_array_index (const ecma_string_t *str_p);\n\nlit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT ecma_string_copy_to_buffer (const ecma_string_t *string_desc_p,\n                                                                          lit_utf8_byte_t *buffer_p,\n                                                                          lit_utf8_size_t buffer_size,\n                                                                          jerry_encoding_t encoding);\nvoid\necma_string_to_cesu8_bytes (const ecma_string_t *string_desc_p, lit_utf8_byte_t *buffer_p, lit_utf8_size_t buffer_size);\nconst lit_utf8_byte_t *ecma_string_get_chars (const ecma_string_t *string_p,\n                                              lit_utf8_size_t *size_p,\n                                              lit_utf8_size_t *length_p,\n                                              lit_utf8_byte_t *uint32_buff_p,\n                                              uint8_t *flags_p);\nbool ecma_compare_ecma_string_to_magic_id (const ecma_string_t *string_p, lit_magic_string_id_t id);\nbool ecma_string_is_empty (const ecma_string_t *string_p);\nbool ecma_string_is_length (const ecma_string_t *string_p);\n\njmem_cpointer_t ecma_string_to_property_name (ecma_string_t *prop_name_p, ecma_property_t *name_type_p);\necma_string_t *ecma_string_from_property_name (ecma_property_t property, jmem_cpointer_t prop_name_cp);\nlit_string_hash_t ecma_string_get_property_name_hash (ecma_property_t property, jmem_cpointer_t prop_name_cp);\nuint32_t ecma_string_get_property_index (ecma_property_t property, jmem_cpointer_t prop_name_cp);\nbool ecma_string_compare_to_property_name (ecma_property_t property,\n                                           jmem_cpointer_t prop_name_cp,\n                                           const ecma_string_t *string_p);\n\nbool ecma_compare_ecma_strings (const ecma_string_t *string1_p, const ecma_string_t *string2_p);\nbool ecma_compare_ecma_non_direct_strings (const ecma_string_t *string1_p, const ecma_string_t *string2_p);\nbool ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, const ecma_string_t *string2_p);\nlit_utf8_size_t ecma_string_get_length (const ecma_string_t *string_p);\nlit_utf8_size_t ecma_string_get_utf8_length (const ecma_string_t *string_p);\nlit_utf8_size_t ecma_string_get_size (const ecma_string_t *string_p);\nlit_utf8_size_t ecma_string_get_utf8_size (const ecma_string_t *string_p);\necma_char_t ecma_string_get_char_at_pos (const ecma_string_t *string_p, lit_utf8_size_t index);\n\nlit_magic_string_id_t ecma_get_string_magic (const ecma_string_t *string_p);\n\nlit_string_hash_t ecma_string_hash (const ecma_string_t *string_p);\necma_string_t *ecma_string_substr (const ecma_string_t *string_p, lit_utf8_size_t start_pos, lit_utf8_size_t end_pos);\nconst lit_utf8_byte_t *ecma_string_trim_front (const lit_utf8_byte_t *start_p, const lit_utf8_byte_t *end_p);\nconst lit_utf8_byte_t *ecma_string_trim_back (const lit_utf8_byte_t *start_p, const lit_utf8_byte_t *end_p);\nvoid ecma_string_trim_helper (const lit_utf8_byte_t **utf8_str_p, lit_utf8_size_t *utf8_str_size);\necma_string_t *ecma_string_trim (const ecma_string_t *string_p);\necma_value_t\necma_string_pad (ecma_value_t original_string_p, ecma_value_t max_length, ecma_value_t fill_string, bool pad_on_start);\n\necma_stringbuilder_t ecma_stringbuilder_create (void);\necma_stringbuilder_t ecma_stringbuilder_create_from (ecma_string_t *string_p);\necma_stringbuilder_t ecma_stringbuilder_create_raw (const lit_utf8_byte_t *data_p, const lit_utf8_size_t data_size);\nlit_utf8_size_t ecma_stringbuilder_get_size (ecma_stringbuilder_t *builder_p);\nlit_utf8_byte_t *ecma_stringbuilder_get_data (ecma_stringbuilder_t *builder_p);\nvoid ecma_stringbuilder_revert (ecma_stringbuilder_t *builder_p, const lit_utf8_size_t size);\nvoid ecma_stringbuilder_append (ecma_stringbuilder_t *builder_p, const ecma_string_t *string_p);\nvoid ecma_stringbuilder_append_magic (ecma_stringbuilder_t *builder_p, const lit_magic_string_id_t id);\nvoid ecma_stringbuilder_append_raw (ecma_stringbuilder_t *builder_p,\n                                    const lit_utf8_byte_t *data_p,\n                                    const lit_utf8_size_t data_size);\nvoid ecma_stringbuilder_append_codepoint (ecma_stringbuilder_t *builder_p, lit_code_point_t cp);\nvoid ecma_stringbuilder_append_char (ecma_stringbuilder_t *builder_p, const ecma_char_t c);\nvoid ecma_stringbuilder_append_byte (ecma_stringbuilder_t *builder_p, const lit_utf8_byte_t);\necma_string_t *ecma_stringbuilder_finalize (ecma_stringbuilder_t *builder_p);\nvoid ecma_stringbuilder_destroy (ecma_stringbuilder_t *builder_p);\n\n/* ecma-helpers-number.c */\necma_number_t ecma_number_make_nan (void);\necma_number_t ecma_number_make_infinity (bool sign);\nbool ecma_number_is_nan (ecma_number_t num);\nbool ecma_number_is_negative (ecma_number_t num);\nbool ecma_number_is_zero (ecma_number_t num);\nbool ecma_number_is_infinity (ecma_number_t num);\nbool ecma_number_is_finite (ecma_number_t num);\necma_number_t ecma_number_get_prev (ecma_number_t num);\necma_number_t ecma_number_get_next (ecma_number_t num);\necma_number_t ecma_number_trunc (ecma_number_t num);\necma_number_t ecma_number_remainder (ecma_number_t left_num, ecma_number_t right_num);\necma_number_t ecma_number_pow (ecma_number_t x, ecma_number_t y);\necma_value_t\necma_number_parse_int (const lit_utf8_byte_t *string_buff, lit_utf8_size_t string_buff_size, ecma_value_t radix);\necma_value_t ecma_number_parse_float (const lit_utf8_byte_t *string_buff, lit_utf8_size_t string_buff_size);\necma_value_t ecma_integer_multiply (ecma_integer_value_t left_integer, ecma_integer_value_t right_integer);\nlit_utf8_size_t ecma_number_to_decimal (ecma_number_t num, lit_utf8_byte_t *out_digits_p, int32_t *out_decimal_exp_p);\n\n/* ecma-helpers-collection.c */\necma_collection_t *ecma_new_collection (void);\nvoid ecma_collection_push_back (ecma_collection_t *collection_p, ecma_value_t value);\nvoid ecma_collection_reserve (ecma_collection_t *collection_p, uint32_t count);\nvoid ecma_collection_append (ecma_collection_t *collection_p, const ecma_value_t *buffer_p, uint32_t count);\nvoid ecma_collection_destroy (ecma_collection_t *collection_p);\nvoid ecma_collection_free (ecma_collection_t *collection_p);\nvoid ecma_collection_free_if_not_object (ecma_collection_t *collection_p);\nvoid ecma_collection_free_objects (ecma_collection_t *collection_p);\nvoid ecma_collection_free_template_literal (ecma_collection_t *collection_p);\nbool ecma_collection_check_duplicated_entries (ecma_collection_t *collection_p);\nbool ecma_collection_has_string_value (ecma_collection_t *collection_p, ecma_string_t *string_p);\n\necma_value_t *ecma_new_compact_collection (void);\necma_value_t *ecma_compact_collection_push_back (ecma_value_t *compact_collection_p, ecma_value_t value);\necma_value_t *ecma_compact_collection_shrink (ecma_value_t *compact_collection_p);\nvoid ecma_compact_collection_free (ecma_value_t *compact_collection_p);\necma_value_t *ecma_compact_collection_end (ecma_value_t *compact_collection_p);\nvoid ecma_compact_collection_destroy (ecma_value_t *compact_collection_p);\n\n/* ecma-helpers.c */\necma_object_t *ecma_create_object (ecma_object_t *prototype_object_p, size_t ext_object_size, ecma_object_type_t type);\necma_object_t *ecma_create_decl_lex_env (ecma_object_t *outer_lexical_environment_p);\necma_object_t *ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, ecma_object_t *binding_obj_p);\necma_object_t *ecma_create_lex_env_class (ecma_object_t *outer_lexical_environment_p, size_t lexical_env_size);\nbool JERRY_ATTR_PURE ecma_is_lexical_environment (const ecma_object_t *object_p);\nvoid ecma_op_ordinary_object_set_extensible (ecma_object_t *object_p);\necma_object_type_t JERRY_ATTR_PURE ecma_get_object_type (const ecma_object_t *object_p);\necma_object_base_type_t JERRY_ATTR_PURE ecma_get_object_base_type (const ecma_object_t *object_p);\nbool JERRY_ATTR_PURE ecma_object_class_is (ecma_object_t *object_p, ecma_object_class_type_t class_id);\necma_lexical_environment_type_t JERRY_ATTR_PURE ecma_get_lex_env_type (const ecma_object_t *object_p);\necma_object_t JERRY_ATTR_PURE *ecma_get_lex_env_binding_object (const ecma_object_t *object_p);\necma_object_t *ecma_clone_decl_lexical_environment (ecma_object_t *lex_env_p, bool copy_values);\n\necma_property_value_t *ecma_create_named_data_property (ecma_object_t *object_p,\n                                                        ecma_string_t *name_p,\n                                                        uint8_t prop_attributes,\n                                                        ecma_property_t **out_prop_p);\necma_property_value_t *ecma_create_named_accessor_property (ecma_object_t *object_p,\n                                                            ecma_string_t *name_p,\n                                                            ecma_object_t *get_p,\n                                                            ecma_object_t *set_p,\n                                                            uint8_t prop_attributes,\n                                                            ecma_property_t **out_prop_p);\n#if JERRY_MODULE_SYSTEM\nvoid ecma_create_named_reference_property (ecma_object_t *object_p, ecma_string_t *name_p, ecma_value_t reference);\n#endif /* JERRY_MODULE_SYSTEM */\necma_property_t *ecma_find_named_property (ecma_object_t *obj_p, ecma_string_t *name_p);\necma_property_value_t *ecma_get_named_data_property (ecma_object_t *obj_p, ecma_string_t *name_p);\n\nvoid ecma_delete_property (ecma_object_t *object_p, ecma_property_value_t *prop_value_p);\n\nvoid\necma_named_data_property_assign_value (ecma_object_t *obj_p, ecma_property_value_t *prop_value_p, ecma_value_t value);\n\necma_getter_setter_pointers_t *ecma_get_named_accessor_property (const ecma_property_value_t *prop_value_p);\nvoid ecma_set_named_accessor_property_getter (ecma_object_t *object_p,\n                                              ecma_property_value_t *prop_value_p,\n                                              ecma_object_t *getter_p);\nvoid ecma_set_named_accessor_property_setter (ecma_object_t *object_p,\n                                              ecma_property_value_t *prop_value_p,\n                                              ecma_object_t *setter_p);\n#if JERRY_MODULE_SYSTEM\necma_value_t ecma_property_to_reference (ecma_property_t *property_p);\necma_property_value_t *ecma_get_property_value_from_named_reference (ecma_property_value_t *reference_p);\n#endif /* JERRY_MODULE_SYSTEM */\nbool ecma_is_property_writable (ecma_property_t property);\nvoid ecma_set_property_writable_attr (ecma_property_t *property_p, bool is_writable);\nbool ecma_is_property_enumerable (ecma_property_t property);\nvoid ecma_set_property_enumerable_attr (ecma_property_t *property_p, bool is_enumerable);\nbool ecma_is_property_configurable (ecma_property_t property);\nvoid ecma_set_property_configurable_attr (ecma_property_t *property_p, bool is_configurable);\n\n#if JERRY_LCACHE\nbool ecma_is_property_lcached (ecma_property_t *property_p);\nvoid ecma_set_property_lcached (ecma_property_t *property_p, bool is_lcached);\n#endif /* JERRY_LCACHE */\n\necma_property_descriptor_t ecma_make_empty_property_descriptor (void);\nvoid ecma_free_property_descriptor (ecma_property_descriptor_t *prop_desc_p);\n\nvoid ecma_ref_extended_primitive (ecma_extended_primitive_t *primitve_p);\nvoid ecma_deref_exception (ecma_extended_primitive_t *exception_p);\n#if JERRY_BUILTIN_BIGINT\nvoid ecma_deref_bigint (ecma_extended_primitive_t *bigint_p);\n#endif /* JERRY_BUILTIN_BIGINT */\n\necma_value_t ecma_create_exception (ecma_value_t value, uint32_t options);\necma_value_t ecma_create_exception_from_context (void);\necma_value_t ecma_create_exception_from_object (ecma_object_t *object_p);\nvoid ecma_throw_exception (ecma_value_t value);\n\nvoid ecma_script_deref (ecma_value_t script_value);\nvoid ecma_bytecode_ref (ecma_compiled_code_t *bytecode_p);\nvoid ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p);\necma_value_t ecma_script_get_from_value (ecma_value_t value);\necma_value_t *ecma_compiled_code_resolve_arguments_start (const ecma_compiled_code_t *bytecode_header_p);\necma_value_t *ecma_compiled_code_resolve_function_name (const ecma_compiled_code_t *bytecode_header_p);\necma_collection_t *ecma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *bytecode_header_p);\n#if JERRY_LINE_INFO\nuint8_t *ecma_compiled_code_get_line_info (const ecma_compiled_code_t *bytecode_header_p);\n#endif /* JERRY_LINE_INFO */\necma_value_t ecma_get_source_name (const ecma_compiled_code_t *bytecode_p);\n#if (JERRY_STACK_LIMIT != 0)\nuintptr_t ecma_get_current_stack_usage (void);\n#endif /* (JERRY_STACK_LIMIT != 0) */\n\n/* ecma-helpers-external-pointers.c */\nbool ecma_create_native_pointer_property (ecma_object_t *obj_p,\n                                          void *native_p,\n                                          const jerry_object_native_info_t *native_info_p);\necma_native_pointer_t *ecma_get_native_pointer_value (ecma_object_t *obj_p,\n                                                      const jerry_object_native_info_t *native_info_p);\nbool ecma_delete_native_pointer_property (ecma_object_t *obj_p, const jerry_object_native_info_t *native_info_p);\n\n/* ecma-helpers-conversion.c */\necma_number_t ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, lit_utf8_size_t str_size, uint32_t option);\necma_number_t ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p,\n                                                   lit_utf8_size_t str_size,\n                                                   uint32_t radix,\n                                                   uint32_t option);\nlit_utf8_size_t ecma_uint32_to_utf8_string (uint32_t value, lit_utf8_byte_t *out_buffer_p, lit_utf8_size_t buffer_size);\nuint32_t ecma_number_to_uint32 (ecma_number_t num);\nint32_t ecma_number_to_int32 (ecma_number_t num);\nlit_utf8_size_t ecma_number_to_utf8_string (ecma_number_t num, lit_utf8_byte_t *buffer_p, lit_utf8_size_t buffer_size);\n\n/* ecma-helpers-errol.c */\nlit_utf8_size_t ecma_errol0_dtoa (double val, lit_utf8_byte_t *buffer_p, int32_t *exp_p);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_HELPERS_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-init-finalize.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-init-finalize.h\"\n\n#include \"ecma-builtins.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-literal-storage.h\"\n\n#include \"jcontext.h\"\n#include \"jmem.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmainitfinalize Initialization and finalization of ECMA components\n * @{\n */\n\n/**\n * Maximum number of GC loops on cleanup.\n */\n#define JERRY_GC_LOOP_LIMIT 100\n\n/**\n * Initialize ECMA components\n */\nvoid\necma_init (void)\n{\n#if (JERRY_GC_MARK_LIMIT != 0)\n  JERRY_CONTEXT (ecma_gc_mark_recursion_limit) = JERRY_GC_MARK_LIMIT;\n#endif /* (JERRY_GC_MARK_LIMIT != 0) */\n\n  ecma_init_global_environment ();\n\n#if JERRY_PROPERTY_HASHMAP\n  JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) = ECMA_PROP_HASHMAP_ALLOC_ON;\n  JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_HIGH_PRESSURE_GC;\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n#if (JERRY_STACK_LIMIT != 0)\n  volatile int sp;\n  JERRY_CONTEXT (stack_base) = (uintptr_t) &sp;\n#endif /* (JERRY_STACK_LIMIT != 0) */\n\n  ecma_job_queue_init ();\n\n  JERRY_CONTEXT (current_new_target_p) = NULL;\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  JERRY_CONTEXT (arraybuffer_compact_allocation_limit) = 256;\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n} /* ecma_init */\n\n/**\n * Finalize ECMA components\n */\nvoid\necma_finalize (void)\n{\n  JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) == NULL);\n\n  ecma_finalize_global_environment ();\n  uint8_t runs = 0;\n\n  do\n  {\n    ecma_gc_run ();\n    if (++runs >= JERRY_GC_LOOP_LIMIT)\n    {\n      jerry_fatal (JERRY_FATAL_UNTERMINATED_GC_LOOPS);\n    }\n  } while (JERRY_CONTEXT (ecma_gc_new_objects) != 0);\n\n  jmem_cpointer_t *global_symbols_cp = JERRY_CONTEXT (global_symbols_cp);\n\n  for (uint32_t i = 0; i < ECMA_BUILTIN_GLOBAL_SYMBOL_COUNT; i++)\n  {\n    if (global_symbols_cp[i] != JMEM_CP_NULL)\n    {\n      ecma_deref_ecma_string (ECMA_GET_NON_NULL_POINTER (ecma_string_t, global_symbols_cp[i]));\n    }\n  }\n\n  ecma_finalize_lit_storage ();\n} /* ecma_finalize */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-init-finalize.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_INIT_FINALIZE_H\n#define ECMA_INIT_FINALIZE_H\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmainitfinalize Initialization and finalization of ECMA components\n * @{\n */\n\nvoid ecma_init (void);\nvoid ecma_finalize (void);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_INIT_FINALIZE_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-lcache.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-lcache.h\"\n\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n#include \"jcontext.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmalcache Property lookup cache\n * @{\n */\n\n#if JERRY_LCACHE\n\n/**\n * Bitshift index for calculating hash.\n */\n#if JERRY_CPOINTER_32_BIT\n#define ECMA_LCACHE_HASH_BITSHIFT_INDEX (2 * JMEM_ALIGNMENT_LOG)\n#else /* !JERRY_CPOINTER_32_BIT */\n#define ECMA_LCACHE_HASH_BITSHIFT_INDEX 0\n#endif /* JERRY_CPOINTER_32_BIT */\n\n/**\n * Mask for hash bits\n */\n#define ECMA_LCACHE_HASH_MASK ((ECMA_LCACHE_HASH_ROWS_COUNT - 1) << ECMA_LCACHE_HASH_BITSHIFT_INDEX)\n\n/**\n * Bitshift index for creating property identifier\n */\n#define ECMA_LCACHE_HASH_ENTRY_ID_SHIFT (8 * sizeof (jmem_cpointer_t))\n\n/**\n * Create property identifier\n */\n#define ECMA_LCACHE_CREATE_ID(object_cp, name_cp) \\\n  (((ecma_lcache_hash_entry_id_t) (object_cp) << ECMA_LCACHE_HASH_ENTRY_ID_SHIFT) | (name_cp))\n\n/**\n * Invalidate specified LCache entry\n */\nstatic inline void JERRY_ATTR_ALWAYS_INLINE\necma_lcache_invalidate_entry (ecma_lcache_hash_entry_t *entry_p) /**< entry to invalidate */\n{\n  JERRY_ASSERT (entry_p != NULL);\n  JERRY_ASSERT (entry_p->id != 0);\n  JERRY_ASSERT (entry_p->prop_p != NULL);\n\n  entry_p->id = 0;\n  ecma_set_property_lcached (entry_p->prop_p, false);\n} /* ecma_lcache_invalidate_entry */\n\n/**\n * Compute the row index of object / property name pair\n *\n * @return row index\n */\nstatic inline size_t JERRY_ATTR_ALWAYS_INLINE\necma_lcache_row_index (jmem_cpointer_t object_cp, /**< compressed pointer to object */\n                       jmem_cpointer_t name_cp) /**< compressed pointer to property name */\n{\n  /* Randomize the property name with the object pointer using a xor operation,\n   * so properties of different objects with the same name can be cached effectively. */\n  return (size_t) (((name_cp ^ object_cp) & ECMA_LCACHE_HASH_MASK) >> ECMA_LCACHE_HASH_BITSHIFT_INDEX);\n} /* ecma_lcache_row_index */\n\n/**\n * Insert an entry into LCache\n */\nvoid\necma_lcache_insert (const ecma_object_t *object_p, /**< object */\n                    const jmem_cpointer_t name_cp, /**< property name */\n                    ecma_property_t *prop_p) /**< property */\n{\n  JERRY_ASSERT (object_p != NULL);\n  JERRY_ASSERT (prop_p != NULL && !ecma_is_property_lcached (prop_p));\n  JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (*prop_p));\n\n  jmem_cpointer_t object_cp;\n\n  ECMA_SET_NON_NULL_POINTER (object_cp, object_p);\n\n  size_t row_index = ecma_lcache_row_index (object_cp, name_cp);\n  ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index];\n  ecma_lcache_hash_entry_t *entry_end_p = entry_p + ECMA_LCACHE_HASH_ROW_LENGTH;\n\n  do\n  {\n    if (entry_p->id == 0)\n    {\n      goto insert;\n    }\n\n    entry_p++;\n  } while (entry_p < entry_end_p);\n\n  /* Invalidate the last entry. */\n  ecma_lcache_invalidate_entry (--entry_p);\n\n  /* Shift other entries towards the end. */\n  for (uint32_t i = 0; i < ECMA_LCACHE_HASH_ROW_LENGTH - 1; i++)\n  {\n    entry_p->id = entry_p[-1].id;\n    entry_p->prop_p = entry_p[-1].prop_p;\n    entry_p--;\n  }\n\ninsert:\n  entry_p->prop_p = prop_p;\n  entry_p->id = ECMA_LCACHE_CREATE_ID (object_cp, name_cp);\n\n  ecma_set_property_lcached (entry_p->prop_p, true);\n} /* ecma_lcache_insert */\n\n/**\n * Lookup property in the LCache\n *\n * @return a pointer to an ecma_property_t if the lookup is successful\n *         NULL otherwise\n */\nextern inline ecma_property_t *JERRY_ATTR_ALWAYS_INLINE\necma_lcache_lookup (const ecma_object_t *object_p, /**< object */\n                    const ecma_string_t *prop_name_p) /**< property's name */\n{\n  JERRY_ASSERT (object_p != NULL);\n  JERRY_ASSERT (prop_name_p != NULL);\n\n  jmem_cpointer_t object_cp;\n  ECMA_SET_NON_NULL_POINTER (object_cp, object_p);\n\n  ecma_property_t prop_name_type = ECMA_DIRECT_STRING_PTR;\n  jmem_cpointer_t prop_name_cp;\n\n  if (JERRY_UNLIKELY (ECMA_IS_DIRECT_STRING (prop_name_p)))\n  {\n    prop_name_type = (ecma_property_t) ECMA_GET_DIRECT_STRING_TYPE (prop_name_p);\n    prop_name_cp = (jmem_cpointer_t) ECMA_GET_DIRECT_STRING_VALUE (prop_name_p);\n  }\n  else\n  {\n    ECMA_SET_NON_NULL_POINTER (prop_name_cp, prop_name_p);\n  }\n\n  size_t row_index = ecma_lcache_row_index (object_cp, prop_name_cp);\n\n  ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index];\n  ecma_lcache_hash_entry_t *entry_end_p = entry_p + ECMA_LCACHE_HASH_ROW_LENGTH;\n  ecma_lcache_hash_entry_id_t id = ECMA_LCACHE_CREATE_ID (object_cp, prop_name_cp);\n\n  do\n  {\n    if (entry_p->id == id && JERRY_LIKELY (ECMA_PROPERTY_GET_NAME_TYPE (*entry_p->prop_p) == prop_name_type))\n    {\n      JERRY_ASSERT (entry_p->prop_p != NULL && ecma_is_property_lcached (entry_p->prop_p));\n      return entry_p->prop_p;\n    }\n    entry_p++;\n  } while (entry_p < entry_end_p);\n\n  return NULL;\n} /* ecma_lcache_lookup */\n\n/**\n * Invalidate LCache entries associated with given object and property name / property\n */\nvoid\necma_lcache_invalidate (const ecma_object_t *object_p, /**< object */\n                        const jmem_cpointer_t name_cp, /**< property name */\n                        ecma_property_t *prop_p) /**< property */\n{\n  JERRY_ASSERT (object_p != NULL);\n  JERRY_ASSERT (prop_p != NULL && ecma_is_property_lcached (prop_p));\n  JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (*prop_p));\n\n  jmem_cpointer_t object_cp;\n  ECMA_SET_NON_NULL_POINTER (object_cp, object_p);\n\n  size_t row_index = ecma_lcache_row_index (object_cp, name_cp);\n  ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index];\n\n  while (true)\n  {\n    /* The property must be present. */\n    JERRY_ASSERT (entry_p - JERRY_CONTEXT (lcache)[row_index] < ECMA_LCACHE_HASH_ROW_LENGTH);\n\n    if (entry_p->id != 0 && entry_p->prop_p == prop_p)\n    {\n      JERRY_ASSERT (entry_p->id == ECMA_LCACHE_CREATE_ID (object_cp, name_cp));\n\n      ecma_lcache_invalidate_entry (entry_p);\n      return;\n    }\n    entry_p++;\n  }\n} /* ecma_lcache_invalidate */\n\n#endif /* JERRY_LCACHE */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-lcache.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_LCACHE_H\n#define ECMA_LCACHE_H\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmalcache Property lookup cache\n * @{\n */\n\n#include \"ecma-globals.h\"\n\n#if JERRY_LCACHE\nvoid ecma_lcache_insert (const ecma_object_t *object_p, const jmem_cpointer_t name_cp, ecma_property_t *prop_p);\necma_property_t *ecma_lcache_lookup (const ecma_object_t *object_p, const ecma_string_t *prop_name_p);\nvoid ecma_lcache_invalidate (const ecma_object_t *object_p, const jmem_cpointer_t name_cp, ecma_property_t *prop_p);\n\n#endif /* JERRY_LCACHE */\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_LCACHE_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-line-info.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-line-info.h\"\n\n#include \"ecma-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmalineinfo Line info\n * @{\n */\n\n#if JERRY_LINE_INFO\n\n/* The layout of the structure is defined in js-parser-line-info-create.c */\n\nJERRY_STATIC_ASSERT ((ECMA_LINE_INFO_COLUMN_DEFAULT - 1) == ((ECMA_LINE_INFO_ENCODE_TWO_BYTE >> 1) - 1),\n                     ecma_line_info_column_1_must_be_accessible_with_the_highest_one_byte_negative_value);\n\n/**\n * Decodes an uint32_t number, and updates the buffer position.\n * Numbers expected to be larger values.\n *\n * @return the decoded value\n */\nuint32_t\necma_line_info_decode_vlq (uint8_t **buffer_p) /**< [in/out] target buffer */\n{\n  uint8_t *source_p = *buffer_p;\n  uint32_t value = 0;\n\n  do\n  {\n    value = (value << ECMA_LINE_INFO_VLQ_SHIFT) | (*source_p & ECMA_LINE_INFO_VLQ_MASK);\n  } while (*source_p++ & ECMA_LINE_INFO_VLQ_CONTINUE);\n\n  *buffer_p = source_p;\n  return value;\n} /* ecma_line_info_decode_vlq */\n\n/**\n * Decodes an uint32_t number, and updates the buffer position.\n * Numbers expected to be smaller values.\n *\n * @return the decoded value\n */\nstatic uint32_t\necma_line_info_decode_small (uint8_t **buffer_p) /**< [in/out] target buffer */\n{\n  uint8_t *source_p = *buffer_p;\n  uint32_t type = source_p[0];\n\n  *buffer_p = source_p + 1;\n\n  if (type < ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN)\n  {\n    return type;\n  }\n\n  if (type == ECMA_LINE_INFO_ENCODE_TWO_BYTE)\n  {\n    *buffer_p = source_p + 2;\n    return ((uint32_t) source_p[1]) + ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN;\n  }\n\n  JERRY_ASSERT (type == ECMA_LINE_INFO_ENCODE_VLQ);\n  return ecma_line_info_decode_vlq (buffer_p) + ECMA_LINE_INFO_ENCODE_VLQ_MIN;\n} /* ecma_line_info_decode_small */\n\n/**\n * Updates a value using an encoded difference.\n *\n * @return updated value\n */\nextern inline uint32_t JERRY_ATTR_ALWAYS_INLINE\necma_line_info_difference_update (uint32_t current_value, /**< current value */\n                                  uint32_t difference_value) /**< encoded difference */\n{\n  if ((difference_value & 0x1) == ECMA_LINE_INFO_INCREASE)\n  {\n    return current_value + (difference_value >> 1) + 1;\n  }\n\n  return current_value - (difference_value >> 1);\n} /* ecma_line_info_difference_update */\n\n/**\n * Release line info data.\n */\nvoid\necma_line_info_free (uint8_t *line_info_p) /**< line info buffer */\n{\n  uint8_t *source_p = line_info_p;\n  uint32_t total_length = ecma_line_info_decode_vlq (&source_p);\n\n  jmem_heap_free_block (line_info_p, total_length + (uint32_t) (source_p - line_info_p));\n} /* ecma_line_info_free */\n\n/**\n * Returns the line/column information for a given byte code offset.\n */\nvoid\necma_line_info_get (uint8_t *line_info_p, /**< line info buffer */\n                    uint32_t offset, /**< byte code offset */\n                    jerry_frame_location_t *location_p) /**< [out] location */\n{\n  uint32_t line = 1;\n  uint32_t column = ECMA_LINE_INFO_COLUMN_DEFAULT;\n  uint32_t end_offset = 0;\n  uint32_t end_offset_increase;\n  uint32_t value;\n\n  /* Skip total_length. */\n  ecma_line_info_decode_vlq (&line_info_p);\n\n  while (true)\n  {\n    value = ecma_line_info_decode_vlq (&line_info_p);\n    line = ecma_line_info_difference_update (line, value);\n\n    if (*line_info_p == 0)\n    {\n      break;\n    }\n\n    uint8_t *size_p = line_info_p + *line_info_p + (ECMA_LINE_INFO_STREAM_SIZE_MIN + 1);\n\n    uint32_t next_end_offset = end_offset + ecma_line_info_decode_vlq (&size_p);\n\n    if (offset < next_end_offset)\n    {\n      break;\n    }\n\n    end_offset = next_end_offset;\n    line_info_p = size_p;\n  }\n\n  line_info_p++;\n\n  do\n  {\n    end_offset_increase = ecma_line_info_decode_small (&line_info_p);\n\n    if (end_offset_increase & ECMA_LINE_INFO_HAS_LINE)\n    {\n      value = ecma_line_info_decode_small (&line_info_p);\n      line = ecma_line_info_difference_update (line, value);\n      column = ECMA_LINE_INFO_COLUMN_DEFAULT;\n    }\n\n    end_offset_increase >>= 1;\n\n    value = ecma_line_info_decode_small (&line_info_p);\n    column = ecma_line_info_difference_update (column, value);\n\n    end_offset += end_offset_increase;\n  } while (end_offset_increase != 0 && end_offset <= offset);\n\n  location_p->line = line;\n  location_p->column = column;\n} /* ecma_line_info_get */\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n\n/**\n * Dumps line info data.\n */\nvoid\necma_line_info_dump (uint8_t *line_info_p) /**< dumps line info data */\n{\n  bool block_last = false;\n  uint32_t block_line = 1;\n  uint32_t block_byte_code_offset = 0;\n  uint32_t value;\n\n  value = ecma_line_info_decode_vlq (&line_info_p);\n  JERRY_DEBUG_MSG (\"\\nLine info size: %d bytes\\n\", (int) value);\n\n  while (true)\n  {\n    value = ecma_line_info_decode_vlq (&line_info_p);\n    block_line = ecma_line_info_difference_update (block_line, value);\n\n    JERRY_DEBUG_MSG (\"\\nNew block: line: %d\", (int) block_line);\n\n    if (*line_info_p == 0)\n    {\n      JERRY_DEBUG_MSG (\" StreamLength: [last]\\n\");\n      block_last = true;\n    }\n    else\n    {\n      uint8_t *size_p = line_info_p + *line_info_p + (ECMA_LINE_INFO_STREAM_SIZE_MIN + 1);\n\n      value = ecma_line_info_decode_vlq (&size_p);\n\n      JERRY_DEBUG_MSG (\" StreamLength: %d ByteCodeSize: %d\\n\",\n                       (int) (*line_info_p + ECMA_LINE_INFO_STREAM_SIZE_MIN),\n                       (int) value);\n    }\n\n    line_info_p++;\n\n    uint32_t stream_line = block_line;\n    uint32_t stream_column = ECMA_LINE_INFO_COLUMN_DEFAULT;\n    uint32_t stream_end_offset = block_byte_code_offset;\n\n    while (true)\n    {\n      uint32_t stream_end_offset_increase = ecma_line_info_decode_small (&line_info_p);\n\n      if (stream_end_offset_increase & ECMA_LINE_INFO_HAS_LINE)\n      {\n        value = ecma_line_info_decode_small (&line_info_p);\n        stream_line = ecma_line_info_difference_update (stream_line, value);\n        stream_column = ECMA_LINE_INFO_COLUMN_DEFAULT;\n      }\n\n      stream_end_offset_increase >>= 1;\n\n      value = ecma_line_info_decode_small (&line_info_p);\n      stream_column = ecma_line_info_difference_update (stream_column, value);\n\n      if (stream_end_offset_increase == 0)\n      {\n        JERRY_DEBUG_MSG (\"  ByteCodeEndOffset: [unterminated] Line: %d Column: %d\\n\",\n                         (int) stream_line,\n                         (int) stream_column);\n        break;\n      }\n\n      stream_end_offset += stream_end_offset_increase;\n\n      JERRY_DEBUG_MSG (\"  ByteCodeEndOffset: %d Line: %d Column: %d\\n\",\n                       (int) stream_end_offset,\n                       (int) stream_line,\n                       (int) stream_column);\n    }\n\n    if (block_last)\n    {\n      break;\n    }\n\n    block_byte_code_offset += ecma_line_info_decode_vlq (&line_info_p);\n  }\n} /* ecma_line_info_dump */\n\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n#endif /* JERRY_LINE_INFO */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-line-info.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_LINE_INFO_H\n#define ECMA_LINE_INFO_H\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmalineinfo Line info\n * @{\n */\n\n#if JERRY_LINE_INFO\n\n#include \"ecma-globals.h\"\n\n/**\n * Increase the current value of line or column.\n */\n#define ECMA_LINE_INFO_INCREASE 0x0\n\n/**\n * Decrease the current value of line or column.\n */\n#define ECMA_LINE_INFO_DECREASE 0x1\n\n/**\n * Line update is present.\n */\n#define ECMA_LINE_INFO_HAS_LINE 0x1\n\n/**\n * A default value for columns after a line update.\n */\n#define ECMA_LINE_INFO_COLUMN_DEFAULT 127\n\n/**\n * Vlq encoding: flag which is set for all bytes except the last one.\n */\n#define ECMA_LINE_INFO_VLQ_CONTINUE 0x80\n\n/**\n * Vlq encoding: mask to decode the number fragment.\n */\n#define ECMA_LINE_INFO_VLQ_MASK 0x7f\n\n/**\n * Vlq encoding: number of bits stored in a byte.\n */\n#define ECMA_LINE_INFO_VLQ_SHIFT 7\n\n/**\n * Small encoding: a value which represents a two byte long number.\n */\n#define ECMA_LINE_INFO_ENCODE_TWO_BYTE (UINT8_MAX - 1)\n\n/**\n * Small encoding: minimum value of an encoded two byte long number.\n */\n#define ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN (UINT8_MAX - 1)\n\n/**\n * Small encoding: a value which represents a three byte long number.\n */\n#define ECMA_LINE_INFO_ENCODE_VLQ UINT8_MAX\n\n/**\n * Small encoding: minimum value of an encoded three byte long number.\n */\n#define ECMA_LINE_INFO_ENCODE_VLQ_MIN (ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN + UINT8_MAX + 1)\n\n/**\n * Maximum number of line/column entries stored in a stream.\n */\n#define ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX 48\n\n/**\n * Minimum size of a stream (except the last one).\n */\n#define ECMA_LINE_INFO_STREAM_SIZE_MIN ((2 * ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX) - 1)\n\n/* Helper functions for parser/js/js-parser-line-info-create.c. */\nuint32_t ecma_line_info_decode_vlq (uint8_t **buffer_p);\nuint32_t ecma_line_info_difference_update (uint32_t current_value, uint32_t difference_value);\n\n/* General functions. */\nvoid ecma_line_info_free (uint8_t *line_info_p);\nvoid ecma_line_info_get (uint8_t *line_info_p, uint32_t offset, jerry_frame_location_t *location_p);\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\nvoid ecma_line_info_dump (uint8_t *line_info_p);\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n#endif /* JERRY_LINE_INFO */\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_LINE_INFO_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-literal-storage.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-literal-storage.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-big-uint.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-helpers.h\"\n\n#include \"jcontext.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmalitstorage Literal storage\n * @{\n */\n\n/**\n * Free symbol list\n */\nstatic void\necma_free_symbol_list (jmem_cpointer_t symbol_list_cp) /**< symbol list */\n{\n  while (symbol_list_cp != JMEM_CP_NULL)\n  {\n    ecma_lit_storage_item_t *symbol_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, symbol_list_cp);\n\n    for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n    {\n      if (symbol_list_p->values[i] != JMEM_CP_NULL)\n      {\n        ecma_string_t *string_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, symbol_list_p->values[i]);\n\n        JERRY_ASSERT (ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p));\n        ecma_deref_ecma_string (string_p);\n      }\n    }\n\n    jmem_cpointer_t next_item_cp = symbol_list_p->next_cp;\n    jmem_pools_free (symbol_list_p, sizeof (ecma_lit_storage_item_t));\n    symbol_list_cp = next_item_cp;\n  }\n} /* ecma_free_symbol_list */\n\n/**\n * Free string list\n */\nstatic void\necma_free_string_list (jmem_cpointer_t string_list_cp) /**< string list */\n{\n  while (string_list_cp != JMEM_CP_NULL)\n  {\n    ecma_lit_storage_item_t *string_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, string_list_cp);\n\n    for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n    {\n      if (string_list_p->values[i] != JMEM_CP_NULL)\n      {\n        ecma_string_t *string_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, string_list_p->values[i]);\n\n        JERRY_ASSERT (ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p));\n        ecma_destroy_ecma_string (string_p);\n      }\n    }\n\n    jmem_cpointer_t next_item_cp = string_list_p->next_cp;\n    jmem_pools_free (string_list_p, sizeof (ecma_lit_storage_item_t));\n    string_list_cp = next_item_cp;\n  }\n} /* ecma_free_string_list */\n\n/**\n * Free number list\n */\nstatic void\necma_free_number_list (jmem_cpointer_t number_list_cp) /**< number list */\n{\n  while (number_list_cp != JMEM_CP_NULL)\n  {\n    ecma_lit_storage_item_t *number_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, number_list_cp);\n\n    for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n    {\n      if (number_list_p->values[i] != JMEM_CP_NULL)\n      {\n        ecma_dealloc_number (JMEM_CP_GET_NON_NULL_POINTER (ecma_number_t, number_list_p->values[i]));\n      }\n    }\n\n    jmem_cpointer_t next_item_cp = number_list_p->next_cp;\n    jmem_pools_free (number_list_p, sizeof (ecma_lit_storage_item_t));\n    number_list_cp = next_item_cp;\n  }\n} /* ecma_free_number_list */\n\n#if JERRY_BUILTIN_BIGINT\n\n/**\n * Free bigint list\n */\nstatic void\necma_free_bigint_list (jmem_cpointer_t bigint_list_cp) /**< bigint list */\n{\n  while (bigint_list_cp != JMEM_CP_NULL)\n  {\n    ecma_lit_storage_item_t *bigint_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, bigint_list_cp);\n\n    for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n    {\n      if (bigint_list_p->values[i] != JMEM_CP_NULL)\n      {\n        ecma_extended_primitive_t *bigint_p =\n          JMEM_CP_GET_NON_NULL_POINTER (ecma_extended_primitive_t, bigint_list_p->values[i]);\n        JERRY_ASSERT (ECMA_EXTENDED_PRIMITIVE_IS_REF_EQUALS_TO_ONE (bigint_p));\n        ecma_deref_bigint (bigint_p);\n      }\n    }\n\n    jmem_cpointer_t next_item_cp = bigint_list_p->next_cp;\n    jmem_pools_free (bigint_list_p, sizeof (ecma_lit_storage_item_t));\n    bigint_list_cp = next_item_cp;\n  }\n} /* ecma_free_bigint_list */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n\n/**\n * Finalize literal storage\n */\nvoid\necma_finalize_lit_storage (void)\n{\n  ecma_free_symbol_list (JERRY_CONTEXT (symbol_list_first_cp));\n  ecma_free_string_list (JERRY_CONTEXT (string_list_first_cp));\n  ecma_free_number_list (JERRY_CONTEXT (number_list_first_cp));\n#if JERRY_BUILTIN_BIGINT\n  ecma_free_bigint_list (JERRY_CONTEXT (bigint_list_first_cp));\n#endif /* JERRY_BUILTIN_BIGINT */\n} /* ecma_finalize_lit_storage */\n\n/**\n * Find or create a literal string.\n *\n * @return ecma_string_t compressed pointer\n */\necma_value_t\necma_find_or_create_literal_string (const lit_utf8_byte_t *chars_p, /**< string to be searched */\n                                    lit_utf8_size_t size, /**< size of the string */\n                                    bool is_ascii) /**< encode of the string */\n{\n  ecma_string_t *string_p =\n    (is_ascii ? ecma_new_ecma_string_from_ascii (chars_p, size) : ecma_new_ecma_string_from_utf8 (chars_p, size));\n\n  if (ECMA_IS_DIRECT_STRING (string_p))\n  {\n    return ecma_make_string_value (string_p);\n  }\n\n  jmem_cpointer_t string_list_cp = JERRY_CONTEXT (string_list_first_cp);\n  jmem_cpointer_t *empty_cpointer_p = NULL;\n\n  while (string_list_cp != JMEM_CP_NULL)\n  {\n    ecma_lit_storage_item_t *string_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, string_list_cp);\n\n    for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n    {\n      if (string_list_p->values[i] == JMEM_CP_NULL)\n      {\n        if (empty_cpointer_p == NULL)\n        {\n          empty_cpointer_p = string_list_p->values + i;\n        }\n      }\n      else\n      {\n        ecma_string_t *value_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, string_list_p->values[i]);\n\n        if (ecma_compare_ecma_strings (string_p, value_p))\n        {\n          /* Return with string if found in the list. */\n          ecma_deref_ecma_string (string_p);\n          return ecma_make_string_value (value_p);\n        }\n      }\n    }\n\n    string_list_cp = string_list_p->next_cp;\n  }\n\n  ECMA_SET_STRING_AS_STATIC (string_p);\n  jmem_cpointer_t result;\n  JMEM_CP_SET_NON_NULL_POINTER (result, string_p);\n\n  if (empty_cpointer_p != NULL)\n  {\n    *empty_cpointer_p = result;\n    return ecma_make_string_value (string_p);\n  }\n\n  ecma_lit_storage_item_t *new_item_p;\n  new_item_p = (ecma_lit_storage_item_t *) jmem_pools_alloc (sizeof (ecma_lit_storage_item_t));\n\n  new_item_p->values[0] = result;\n  for (int i = 1; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n  {\n    new_item_p->values[i] = JMEM_CP_NULL;\n  }\n\n  new_item_p->next_cp = JERRY_CONTEXT (string_list_first_cp);\n  JMEM_CP_SET_NON_NULL_POINTER (JERRY_CONTEXT (string_list_first_cp), new_item_p);\n\n  return ecma_make_string_value (string_p);\n} /* ecma_find_or_create_literal_string */\n\n/**\n * Find or create a literal number.\n *\n * @return ecma value\n */\necma_value_t\necma_find_or_create_literal_number (ecma_number_t number_arg) /**< number to be searched */\n{\n  ecma_value_t num = ecma_make_number_value (number_arg);\n\n  if (ecma_is_value_integer_number (num))\n  {\n    return num;\n  }\n\n  JERRY_ASSERT (ecma_is_value_float_number (num));\n\n  jmem_cpointer_t number_list_cp = JERRY_CONTEXT (number_list_first_cp);\n  jmem_cpointer_t *empty_cpointer_p = NULL;\n\n  while (number_list_cp != JMEM_CP_NULL)\n  {\n    ecma_lit_storage_item_t *number_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, number_list_cp);\n\n    for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n    {\n      if (number_list_p->values[i] == JMEM_CP_NULL)\n      {\n        if (empty_cpointer_p == NULL)\n        {\n          empty_cpointer_p = number_list_p->values + i;\n        }\n      }\n      else\n      {\n        ecma_number_t *number_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_number_t, number_list_p->values[i]);\n\n        if (*number_p == number_arg)\n        {\n          ecma_free_value (num);\n          return ecma_make_float_value (number_p);\n        }\n      }\n    }\n\n    number_list_cp = number_list_p->next_cp;\n  }\n\n  jmem_cpointer_t result;\n  JMEM_CP_SET_NON_NULL_POINTER (result, ecma_get_pointer_from_float_value (num));\n\n  if (empty_cpointer_p != NULL)\n  {\n    *empty_cpointer_p = result;\n    return num;\n  }\n\n  ecma_lit_storage_item_t *new_item_p;\n  new_item_p = (ecma_lit_storage_item_t *) jmem_pools_alloc (sizeof (ecma_lit_storage_item_t));\n\n  new_item_p->values[0] = result;\n  for (int i = 1; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n  {\n    new_item_p->values[i] = JMEM_CP_NULL;\n  }\n\n  new_item_p->next_cp = JERRY_CONTEXT (number_list_first_cp);\n  JMEM_CP_SET_NON_NULL_POINTER (JERRY_CONTEXT (number_list_first_cp), new_item_p);\n\n  return num;\n} /* ecma_find_or_create_literal_number */\n\n#if JERRY_BUILTIN_BIGINT\n\n/**\n * Find or create a literal BigInt.\n *\n * @return BigInt value\n */\necma_value_t\necma_find_or_create_literal_bigint (ecma_value_t bigint) /**< bigint to be searched */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (bigint));\n\n  if (bigint == ECMA_BIGINT_ZERO)\n  {\n    return bigint;\n  }\n\n  jmem_cpointer_t bigint_list_cp = JERRY_CONTEXT (bigint_list_first_cp);\n  jmem_cpointer_t *empty_cpointer_p = NULL;\n\n  while (bigint_list_cp != JMEM_CP_NULL)\n  {\n    ecma_lit_storage_item_t *bigint_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, bigint_list_cp);\n\n    for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n    {\n      if (bigint_list_p->values[i] == JMEM_CP_NULL)\n      {\n        if (empty_cpointer_p == NULL)\n        {\n          empty_cpointer_p = bigint_list_p->values + i;\n        }\n      }\n      else\n      {\n        ecma_extended_primitive_t *other_bigint_p =\n          JMEM_CP_GET_NON_NULL_POINTER (ecma_extended_primitive_t, bigint_list_p->values[i]);\n        ecma_value_t other_bigint = ecma_make_extended_primitive_value (other_bigint_p, ECMA_TYPE_BIGINT);\n\n        if (ecma_bigint_is_equal_to_bigint (bigint, other_bigint))\n        {\n          ecma_free_value (bigint);\n          return other_bigint;\n        }\n      }\n    }\n\n    bigint_list_cp = bigint_list_p->next_cp;\n  }\n\n  jmem_cpointer_t result;\n  JMEM_CP_SET_NON_NULL_POINTER (result, ecma_get_extended_primitive_from_value (bigint));\n\n  if (empty_cpointer_p != NULL)\n  {\n    *empty_cpointer_p = result;\n    return bigint;\n  }\n\n  ecma_lit_storage_item_t *new_item_p;\n  new_item_p = (ecma_lit_storage_item_t *) jmem_pools_alloc (sizeof (ecma_lit_storage_item_t));\n\n  new_item_p->values[0] = result;\n  for (int i = 1; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n  {\n    new_item_p->values[i] = JMEM_CP_NULL;\n  }\n\n  new_item_p->next_cp = JERRY_CONTEXT (bigint_list_first_cp);\n  JMEM_CP_SET_NON_NULL_POINTER (JERRY_CONTEXT (bigint_list_first_cp), new_item_p);\n\n  return bigint;\n} /* ecma_find_or_create_literal_bigint */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n\n/**\n * Log2 of snapshot literal alignment.\n */\n#define JERRY_SNAPSHOT_LITERAL_ALIGNMENT_LOG 1\n\n/**\n * Snapshot literal alignment.\n */\n#define JERRY_SNAPSHOT_LITERAL_ALIGNMENT (1u << JERRY_SNAPSHOT_LITERAL_ALIGNMENT_LOG)\n\n/**\n * Literal offset shift.\n */\n#define JERRY_SNAPSHOT_LITERAL_SHIFT (ECMA_VALUE_SHIFT + 2)\n\n/**\n * Literal value is number.\n */\n#define JERRY_SNAPSHOT_LITERAL_IS_NUMBER (1u << ECMA_VALUE_SHIFT)\n\n#if JERRY_BUILTIN_BIGINT\n/**\n * Literal value is BigInt.\n */\n#define JERRY_SNAPSHOT_LITERAL_IS_BIGINT (2u << ECMA_VALUE_SHIFT)\n#endif /* JERRY_BUILTIN_BIGINT */\n\n#if JERRY_SNAPSHOT_SAVE\n\n/**\n * Append the value at the end of the appropriate list if it is not present there.\n */\nvoid\necma_save_literals_append_value (ecma_value_t value, /**< value to be appended */\n                                 ecma_collection_t *lit_pool_p) /**< list of known values */\n{\n  /* Unlike direct numbers, direct strings are converted to character literals. */\n  if (!ecma_is_value_string (value)\n#if JERRY_BUILTIN_BIGINT\n      && (!ecma_is_value_bigint (value) || value == ECMA_BIGINT_ZERO)\n#endif /* JERRY_BUILTIN_BIGINT */\n      && !ecma_is_value_float_number (value))\n  {\n    return;\n  }\n\n  ecma_value_t *buffer_p = lit_pool_p->buffer_p;\n\n  for (uint32_t i = 0; i < lit_pool_p->item_count; i++)\n  {\n    /* Strings / numbers are direct strings or stored in the literal storage.\n     * Therefore direct comparison is enough to find the same strings / numbers. */\n    if (buffer_p[i] == value)\n    {\n      return;\n    }\n  }\n\n  ecma_collection_push_back (lit_pool_p, value);\n} /* ecma_save_literals_append_value */\n\n/**\n * Add names from a byte-code data to a list.\n */\nvoid\necma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, /**< byte-code data */\n                                      ecma_collection_t *lit_pool_p) /**< list of known values */\n{\n  ecma_value_t *literal_p;\n  uint32_t argument_end;\n  uint32_t register_end;\n  uint32_t const_literal_end;\n  uint32_t literal_end;\n\n  JERRY_ASSERT (CBC_IS_FUNCTION (compiled_code_p->status_flags));\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) compiled_code_p;\n    uint8_t *byte_p = (uint8_t *) compiled_code_p;\n\n    literal_p = (ecma_value_t *) (byte_p + sizeof (cbc_uint16_arguments_t));\n    register_end = args_p->register_end;\n    const_literal_end = args_p->const_literal_end - register_end;\n    literal_end = args_p->literal_end - register_end;\n    argument_end = args_p->argument_end;\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) compiled_code_p;\n    uint8_t *byte_p = (uint8_t *) compiled_code_p;\n\n    literal_p = (ecma_value_t *) (byte_p + sizeof (cbc_uint8_arguments_t));\n    register_end = args_p->register_end;\n    const_literal_end = args_p->const_literal_end - register_end;\n    literal_end = args_p->literal_end - register_end;\n    argument_end = args_p->argument_end;\n  }\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED)\n  {\n    for (uint32_t i = 0; i < argument_end; i++)\n    {\n      ecma_save_literals_append_value (literal_p[i], lit_pool_p);\n    }\n  }\n\n  for (uint32_t i = 0; i < const_literal_end; i++)\n  {\n    ecma_save_literals_append_value (literal_p[i], lit_pool_p);\n  }\n\n  for (uint32_t i = const_literal_end; i < literal_end; i++)\n  {\n    ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_p[i]);\n\n    if (CBC_IS_FUNCTION (bytecode_p->status_flags) && bytecode_p != compiled_code_p)\n    {\n      ecma_save_literals_add_compiled_code (bytecode_p, lit_pool_p);\n    }\n  }\n\n  uint8_t *byte_p = ((uint8_t *) compiled_code_p) + (((size_t) compiled_code_p->size) << JMEM_ALIGNMENT_LOG);\n  literal_p = ecma_snapshot_resolve_serializable_values ((ecma_compiled_code_t *) compiled_code_p, byte_p);\n\n  while (literal_p < (ecma_value_t *) byte_p)\n  {\n    ecma_save_literals_append_value (*literal_p, lit_pool_p);\n    literal_p++;\n  }\n} /* ecma_save_literals_add_compiled_code */\n\n/**\n * Save literals to specified snapshot buffer.\n *\n * Note:\n *      Frees 'lit_pool_p' regardless of success.\n *\n * @return true - if save was performed successfully (i.e. buffer size is sufficient),\n *         false - otherwise\n */\nbool\necma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p, /**< list of known values */\n                                 uint32_t *buffer_p, /**< [out] output snapshot buffer */\n                                 size_t buffer_size, /**< size of the buffer */\n                                 size_t *in_out_buffer_offset_p, /**< [in,out] write position in the buffer */\n                                 lit_mem_to_snapshot_id_map_entry_t **out_map_p, /**< [out] map from literal identifiers\n                                                                                  *   to the literal offsets\n                                                                                  *   in snapshot */\n                                 uint32_t *out_map_len_p) /**< [out] number of literals */\n{\n  if (lit_pool_p->item_count == 0)\n  {\n    *out_map_p = NULL;\n    *out_map_len_p = 0;\n  }\n\n  uint32_t lit_table_size = 0;\n  size_t max_lit_table_size = buffer_size - *in_out_buffer_offset_p;\n\n  if (max_lit_table_size > (UINT32_MAX >> JERRY_SNAPSHOT_LITERAL_SHIFT))\n  {\n    max_lit_table_size = (UINT32_MAX >> JERRY_SNAPSHOT_LITERAL_SHIFT);\n  }\n\n  ecma_value_t *lit_buffer_p = lit_pool_p->buffer_p;\n\n  /* Compute the size of the literal pool. */\n  for (uint32_t i = 0; i < lit_pool_p->item_count; i++)\n  {\n    if (ecma_is_value_float_number (lit_buffer_p[i]))\n    {\n      lit_table_size += (uint32_t) sizeof (ecma_number_t);\n    }\n#if JERRY_BUILTIN_BIGINT\n    else if (ecma_is_value_bigint (lit_buffer_p[i]))\n    {\n      ecma_extended_primitive_t *bigint_p = ecma_get_extended_primitive_from_value (lit_buffer_p[i]);\n\n      lit_table_size += (uint32_t) JERRY_ALIGNUP (sizeof (uint32_t) + ECMA_BIGINT_GET_SIZE (bigint_p),\n                                                  JERRY_SNAPSHOT_LITERAL_ALIGNMENT);\n    }\n#endif /* JERRY_BUILTIN_BIGINT */\n    else\n    {\n      ecma_string_t *string_p = ecma_get_string_from_value (lit_buffer_p[i]);\n\n      lit_table_size += (uint32_t) JERRY_ALIGNUP (sizeof (uint16_t) + ecma_string_get_size (string_p),\n                                                  JERRY_SNAPSHOT_LITERAL_ALIGNMENT);\n    }\n\n    /* Check whether enough space is available and the maximum size is not reached. */\n    if (lit_table_size > max_lit_table_size)\n    {\n      ecma_collection_destroy (lit_pool_p);\n      return false;\n    }\n  }\n\n  lit_mem_to_snapshot_id_map_entry_t *map_p;\n  uint32_t total_count = lit_pool_p->item_count;\n\n  map_p = jmem_heap_alloc_block (total_count * sizeof (lit_mem_to_snapshot_id_map_entry_t));\n\n  /* Set return values (no error is possible from here). */\n  JERRY_ASSERT ((*in_out_buffer_offset_p % sizeof (uint32_t)) == 0);\n\n  uint8_t *destination_p = (uint8_t *) (buffer_p + (*in_out_buffer_offset_p / sizeof (uint32_t)));\n  uint32_t literal_offset = 0;\n\n  *in_out_buffer_offset_p += lit_table_size;\n  *out_map_p = map_p;\n  *out_map_len_p = total_count;\n\n  lit_buffer_p = lit_pool_p->buffer_p;\n\n  /* Generate literal pool data. */\n  for (uint32_t i = 0; i < lit_pool_p->item_count; i++)\n  {\n    map_p->literal_id = lit_buffer_p[i];\n    map_p->literal_offset = (literal_offset << JERRY_SNAPSHOT_LITERAL_SHIFT) | ECMA_TYPE_SNAPSHOT_OFFSET;\n\n    lit_utf8_size_t length;\n\n    if (ecma_is_value_float_number (lit_buffer_p[i]))\n    {\n      map_p->literal_offset |= JERRY_SNAPSHOT_LITERAL_IS_NUMBER;\n\n      ecma_number_t num = ecma_get_float_from_value (lit_buffer_p[i]);\n      memcpy (destination_p, &num, sizeof (ecma_number_t));\n\n      length = JERRY_ALIGNUP (sizeof (ecma_number_t), JERRY_SNAPSHOT_LITERAL_ALIGNMENT);\n    }\n#if JERRY_BUILTIN_BIGINT\n    else if (ecma_is_value_bigint (lit_buffer_p[i]))\n    {\n      map_p->literal_offset |= JERRY_SNAPSHOT_LITERAL_IS_BIGINT;\n\n      ecma_extended_primitive_t *bigint_p = ecma_get_extended_primitive_from_value (lit_buffer_p[i]);\n      uint32_t size = ECMA_BIGINT_GET_SIZE (bigint_p);\n\n      memcpy (destination_p, &bigint_p->u.bigint_sign_and_size, sizeof (uint32_t));\n      memcpy (destination_p + sizeof (uint32_t), ECMA_BIGINT_GET_DIGITS (bigint_p, 0), size);\n\n      length = JERRY_ALIGNUP (sizeof (uint32_t) + size, JERRY_SNAPSHOT_LITERAL_ALIGNMENT);\n    }\n#endif /* JERRY_BUILTIN_BIGINT */\n    else\n    {\n      ecma_string_t *string_p = ecma_get_string_from_value (lit_buffer_p[i]);\n      length = ecma_string_get_size (string_p);\n\n      *(uint16_t *) destination_p = (uint16_t) length;\n\n      ecma_string_to_cesu8_bytes (string_p, destination_p + sizeof (uint16_t), length);\n\n      length = JERRY_ALIGNUP (sizeof (uint16_t) + length, JERRY_SNAPSHOT_LITERAL_ALIGNMENT);\n    }\n\n    JERRY_ASSERT ((length % sizeof (uint16_t)) == 0);\n    destination_p += length;\n    literal_offset += length;\n\n    map_p++;\n  }\n\n  ecma_collection_destroy (lit_pool_p);\n  return true;\n} /* ecma_save_literals_for_snapshot */\n\n#endif /* JERRY_SNAPSHOT_SAVE */\n\n#if JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE\n\n/**\n * Get the compressed pointer of a given literal.\n *\n * @return literal compressed pointer\n */\necma_value_t\necma_snapshot_get_literal (const uint8_t *literal_base_p, /**< literal start */\n                           ecma_value_t literal_value) /**< string / number offset */\n{\n  JERRY_ASSERT ((literal_value & ECMA_VALUE_TYPE_MASK) == ECMA_TYPE_SNAPSHOT_OFFSET);\n\n  const uint8_t *literal_p = literal_base_p + (literal_value >> JERRY_SNAPSHOT_LITERAL_SHIFT);\n\n  if (literal_value & JERRY_SNAPSHOT_LITERAL_IS_NUMBER)\n  {\n    ecma_number_t num;\n    memcpy (&num, literal_p, sizeof (ecma_number_t));\n    return ecma_find_or_create_literal_number (num);\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (literal_value & JERRY_SNAPSHOT_LITERAL_IS_BIGINT)\n  {\n    uint32_t bigint_sign_and_size = *(uint32_t *) literal_p;\n    uint32_t size = bigint_sign_and_size & ~(uint32_t) (sizeof (ecma_bigint_digit_t) - 1);\n\n    ecma_extended_primitive_t *bigint_p = ecma_bigint_create (size);\n\n    if (bigint_p == NULL)\n    {\n      jerry_fatal (JERRY_FATAL_OUT_OF_MEMORY);\n    }\n\n    /* Only the sign bit can differ. */\n    JERRY_ASSERT (bigint_p->u.bigint_sign_and_size == (bigint_sign_and_size & ~(uint32_t) ECMA_BIGINT_SIGN));\n\n    bigint_p->u.bigint_sign_and_size = bigint_sign_and_size;\n    memcpy (ECMA_BIGINT_GET_DIGITS (bigint_p, 0), literal_p + sizeof (uint32_t), size);\n    return ecma_find_or_create_literal_bigint (ecma_make_extended_primitive_value (bigint_p, ECMA_TYPE_BIGINT));\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  uint16_t length = *(const uint16_t *) literal_p;\n\n  return ecma_find_or_create_literal_string (literal_p + sizeof (uint16_t), length, false);\n} /* ecma_snapshot_get_literal */\n\n/**\n * Compute the start of the serializable ecma-values of the bytecode\n * Related values:\n *  - function argument names, if CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED is present\n *  - function name, if CBC_CODE_FLAGS_CLASS_CONSTRUCTOR is not present and es.next profile is enabled\n *\n * @return pointer to the beginning of the serializable ecma-values\n */\necma_value_t *\necma_snapshot_resolve_serializable_values (const ecma_compiled_code_t *compiled_code_p, /**< compiled code */\n                                           uint8_t *bytecode_end_p) /**< end of the bytecode */\n{\n  ecma_value_t *base_p = (ecma_value_t *) bytecode_end_p;\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED)\n  {\n    uint32_t argument_end;\n    if (compiled_code_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n    {\n      argument_end = ((cbc_uint16_arguments_t *) compiled_code_p)->argument_end;\n    }\n    else\n    {\n      argument_end = ((cbc_uint8_arguments_t *) compiled_code_p)->argument_end;\n    }\n\n    base_p -= argument_end;\n  }\n\n  /* function name */\n  if (CBC_FUNCTION_GET_TYPE (compiled_code_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)\n  {\n    base_p--;\n  }\n\n  return base_p;\n} /* ecma_snapshot_resolve_serializable_values */\n#endif /* JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-literal-storage.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_LIT_STORAGE_H\n#define ECMA_LIT_STORAGE_H\n\n#include \"ecma-globals.h\"\n\n#include \"jmem.h\"\n#include \"lit-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmalitstorage Literal storage\n * @{\n */\n\n#if JERRY_SNAPSHOT_SAVE\n/**\n * Snapshot literal - offset map\n */\ntypedef struct\n{\n  ecma_value_t literal_id; /**< literal id */\n  ecma_value_t literal_offset; /**< literal offset */\n} lit_mem_to_snapshot_id_map_entry_t;\n#endif /* JERRY_SNAPSHOT_SAVE */\n\nvoid ecma_finalize_lit_storage (void);\n\necma_value_t ecma_find_or_create_literal_string (const lit_utf8_byte_t *chars_p, lit_utf8_size_t size, bool is_ascii);\necma_value_t ecma_find_or_create_literal_number (ecma_number_t number_arg);\n#if JERRY_BUILTIN_BIGINT\necma_value_t ecma_find_or_create_literal_bigint (ecma_value_t bigint);\n#endif /* JERRY_BUILTIN_BIGINT */\n\n#if JERRY_SNAPSHOT_SAVE\nvoid ecma_save_literals_append_value (ecma_value_t value, ecma_collection_t *lit_pool_p);\nvoid ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, ecma_collection_t *lit_pool_p);\nbool ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p,\n                                      uint32_t *buffer_p,\n                                      size_t buffer_size,\n                                      size_t *in_out_buffer_offset_p,\n                                      lit_mem_to_snapshot_id_map_entry_t **out_map_p,\n                                      uint32_t *out_map_len_p);\n#endif /* JERRY_SNAPSHOT_SAVE */\n\n#if JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE\necma_value_t ecma_snapshot_get_literal (const uint8_t *literal_base_p, ecma_value_t literal_value);\necma_value_t *ecma_snapshot_resolve_serializable_values (const ecma_compiled_code_t *compiled_code_p,\n                                                         uint8_t *byte_code_end_p);\n#endif /* JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE */\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_LIT_STORAGE_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-module.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-module.h\"\n\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"lit-char-helpers.h\"\n#include \"vm.h\"\n\n#if JERRY_MODULE_SYSTEM\n\n/**\n * Type of the result returned by ecma_module_resolve_export.\n */\ntypedef enum\n{\n  ECMA_MODULE_RESOLVE_NOT_FOUND, /**< reference not found */\n  ECMA_MODULE_RESOLVE_CIRCULAR, /**< only circular references are found */\n  ECMA_MODULE_RESOLVE_ERROR, /**< module in error state is encountered */\n  ECMA_MODULE_RESOLVE_AMBIGUOUS, /**< reference is ambiguous */\n  ECMA_MODULE_RESOLVE_FOUND, /**< reference found */\n} ecma_module_resolve_result_type_t;\n\n/**\n *  A record that stores the result of ecma_module_resolve_export.\n */\ntypedef struct\n{\n  ecma_module_resolve_result_type_t result_type; /**< result type */\n  ecma_value_t result; /**< result value */\n} ecma_module_resolve_result_t;\n\n/**\n * This flag is set in the result if the value is a namespace object.\n */\n#define ECMA_MODULE_NAMESPACE_RESULT_FLAG 0x2\n\n/**\n * Initialize context variables for the root module.\n *\n * @return new module\n */\necma_module_t *\necma_module_create (void)\n{\n  JERRY_ASSERT (JERRY_CONTEXT (module_current_p) == NULL);\n\n  ecma_object_t *obj_p = ecma_create_object (NULL, sizeof (ecma_module_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n  ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_MODULE;\n  ext_object_p->u.cls.u1.module_state = JERRY_MODULE_STATE_UNLINKED;\n  ext_object_p->u.cls.u2.module_flags = 0;\n\n  ecma_module_t *module_p = (ecma_module_t *) obj_p;\n\n  module_p->scope_p = NULL;\n  module_p->namespace_object_p = NULL;\n  module_p->imports_p = NULL;\n  module_p->local_exports_p = NULL;\n  module_p->indirect_exports_p = NULL;\n  module_p->star_exports_p = NULL;\n  module_p->u.compiled_code_p = NULL;\n\n  return module_p;\n} /* ecma_module_create */\n\n/**\n * Cleanup context variables for the root module.\n */\nvoid\necma_module_cleanup_context (void)\n{\n  ecma_deref_object ((ecma_object_t *) JERRY_CONTEXT (module_current_p));\n#ifndef JERRY_NDEBUG\n  JERRY_CONTEXT (module_current_p) = NULL;\n#endif /* JERRY_NDEBUG */\n} /* ecma_module_cleanup_context */\n\n/**\n * Sets module state to error.\n */\nstatic void\necma_module_set_error_state (ecma_module_t *module_p) /**< module */\n{\n  module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_ERROR;\n\n  if (JERRY_CONTEXT (module_state_changed_callback_p) != NULL && !jcontext_has_pending_abort ())\n  {\n    jerry_value_t exception = jcontext_take_exception ();\n\n    JERRY_CONTEXT (module_state_changed_callback_p)\n    (JERRY_MODULE_STATE_ERROR,\n     ecma_make_object_value (&module_p->header.object),\n     exception,\n     JERRY_CONTEXT (module_state_changed_callback_user_p));\n    jcontext_raise_exception (exception);\n  }\n} /* ecma_module_set_error_state */\n\n/**\n * Gets the internal module pointer of a module\n *\n * @return module pointer\n */\nstatic inline ecma_module_t *JERRY_ATTR_ALWAYS_INLINE\necma_module_get_from_object (ecma_value_t module_val) /**< module */\n{\n  JERRY_ASSERT (ecma_is_value_object (module_val));\n\n  ecma_object_t *object_p = ecma_get_object_from_value (module_val);\n\n  JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_MODULE));\n\n  return (ecma_module_t *) object_p;\n} /* ecma_module_get_from_object */\n\n/**\n * Cleans up a list of module names.\n */\nvoid\necma_module_release_module_names (ecma_module_names_t *module_name_p) /**< first module name */\n{\n  while (module_name_p != NULL)\n  {\n    ecma_module_names_t *next_p = module_name_p->next_p;\n\n    ecma_deref_ecma_string (module_name_p->imex_name_p);\n    ecma_deref_ecma_string (module_name_p->local_name_p);\n    jmem_heap_free_block (module_name_p, sizeof (ecma_module_names_t));\n\n    module_name_p = next_p;\n  }\n} /* ecma_module_release_module_names */\n\n/**\n * Cleans up a list of module nodes.\n */\nstatic void\necma_module_release_module_nodes (ecma_module_node_t *module_node_p, /**< first module node */\n                                  bool is_import) /**< free path variable */\n{\n  while (module_node_p != NULL)\n  {\n    ecma_module_node_t *next_p = module_node_p->next_p;\n\n    ecma_module_release_module_names (module_node_p->module_names_p);\n\n    if (is_import && ecma_is_value_string (module_node_p->u.path_or_module))\n    {\n      ecma_deref_ecma_string (ecma_get_string_from_value (module_node_p->u.path_or_module));\n    }\n\n    jmem_heap_free_block (module_node_p, sizeof (ecma_module_node_t));\n    module_node_p = next_p;\n  }\n} /* ecma_module_release_module_nodes */\n\n/**\n *  Creates a new resolve set item from a {module, export_name} pair.\n *\n *  @return new resolve set item\n */\nstatic ecma_module_resolve_set_t *\necma_module_resolve_set_create (ecma_module_t *const module_p, /**< module */\n                                ecma_string_t *const export_name_p) /**< export name */\n{\n  ecma_module_resolve_set_t *new_p;\n  new_p = (ecma_module_resolve_set_t *) jmem_heap_alloc_block (sizeof (ecma_module_resolve_set_t));\n\n  new_p->next_p = NULL;\n  new_p->module_p = module_p;\n  new_p->name_p = export_name_p;\n\n  return new_p;\n} /* ecma_module_resolve_set_create */\n\n/**\n *  Appends a {module, export_name} record into a resolve set.\n *\n *  @return true - if the record is appended successfully\n *          false - otherwise\n */\nstatic bool\necma_module_resolve_set_append (ecma_module_resolve_set_t *set_p, /**< resolve set */\n                                ecma_module_t *const module_p, /**< module */\n                                ecma_string_t *const export_name_p) /**< export name */\n{\n  JERRY_ASSERT (set_p != NULL);\n  ecma_module_resolve_set_t *current_p = set_p;\n\n  while (true)\n  {\n    if (current_p->module_p == module_p && ecma_compare_ecma_strings (current_p->name_p, export_name_p))\n    {\n      return false;\n    }\n\n    ecma_module_resolve_set_t *next_p = current_p->next_p;\n\n    if (next_p == NULL)\n    {\n      current_p->next_p = ecma_module_resolve_set_create (module_p, export_name_p);\n      return true;\n    }\n\n    current_p = next_p;\n  }\n} /* ecma_module_resolve_set_append */\n\n/**\n * Cleans up contents of a resolve set.\n */\nstatic void\necma_module_resolve_set_cleanup (ecma_module_resolve_set_t *set_p) /**< resolve set */\n{\n  while (set_p != NULL)\n  {\n    ecma_module_resolve_set_t *next_p = set_p->next_p;\n    jmem_heap_free_block (set_p, sizeof (ecma_module_resolve_set_t));\n    set_p = next_p;\n  }\n} /* ecma_module_resolve_set_cleanup */\n\n/**\n * Throws the appropriate error based on the resolve result\n *\n * @return error value\n */\nstatic ecma_value_t\necma_module_resolve_throw (ecma_module_resolve_result_t *resolve_result_p, /**< resolve result */\n                           ecma_string_t *name_p) /**< referenced value */\n{\n#if JERRY_ERROR_MESSAGES\n  ecma_value_t name_val = ecma_make_string_value (name_p);\n  const char *msg_p;\n\n  switch (resolve_result_p->result_type)\n  {\n    case ECMA_MODULE_RESOLVE_CIRCULAR:\n    {\n      msg_p = \"Detected cycle while resolving name '%' (module)\";\n      break;\n    }\n    case ECMA_MODULE_RESOLVE_AMBIGUOUS:\n    {\n      msg_p = \"Name '%' is ambiguous (module)\";\n      break;\n    }\n    default:\n    {\n      JERRY_ASSERT (resolve_result_p->result_type == ECMA_MODULE_RESOLVE_NOT_FOUND\n                    || resolve_result_p->result_type == ECMA_MODULE_RESOLVE_ERROR);\n\n      msg_p = \"Name '%' is not found (module)\";\n      break;\n    }\n  }\n\n  return ecma_raise_standard_error_with_format (JERRY_ERROR_SYNTAX, msg_p, name_val);\n#else /* JERRY_ERROR_MESSAGES */\n  JERRY_UNUSED (resolve_result_p);\n  JERRY_UNUSED (name_p);\n\n  return ecma_raise_syntax_error (ECMA_ERR_EMPTY);\n#endif /* !JERRY_ERROR_MESSAGES */\n} /* ecma_module_resolve_throw */\n\n/**\n * Updates the resolve record with the passed type/value pair\n *\n * @return true - if the record is updated successfully\n *         false - otherwise\n */\nstatic bool\necma_module_resolve_update (ecma_module_resolve_result_t *resolve_result_p, /**< [in,out] resolve result */\n                            ecma_value_t result) /**< result value */\n{\n  JERRY_ASSERT (resolve_result_p->result_type != ECMA_MODULE_RESOLVE_AMBIGUOUS\n                && resolve_result_p->result_type != ECMA_MODULE_RESOLVE_ERROR);\n\n  if (resolve_result_p->result_type == ECMA_MODULE_RESOLVE_NOT_FOUND\n      || resolve_result_p->result_type == ECMA_MODULE_RESOLVE_CIRCULAR)\n  {\n    resolve_result_p->result_type = ECMA_MODULE_RESOLVE_FOUND;\n    resolve_result_p->result = result;\n    return true;\n  }\n\n  JERRY_ASSERT (resolve_result_p->result_type == ECMA_MODULE_RESOLVE_FOUND);\n\n  if (resolve_result_p->result == result)\n  {\n    return true;\n  }\n\n  resolve_result_p->result_type = ECMA_MODULE_RESOLVE_AMBIGUOUS;\n  return false;\n} /* ecma_module_resolve_update */\n\n/**\n * Finds the reference in the imported bindings.\n *\n * Note:\n *     This function is needed because the namespace object is created before the imports are connected\n *\n * @return true - if the record is updated successfully\n *         false - otherwise\n */\nstatic bool\necma_module_resolve_import (ecma_module_resolve_result_t *resolve_result_p, /**< [in,out] resolve result */\n                            ecma_module_resolve_set_t *resolve_set_p, /**< resolve set */\n                            ecma_module_t *module_p, /**< base module */\n                            ecma_string_t *local_name_p) /**< local name */\n{\n  ecma_module_node_t *import_node_p = module_p->imports_p;\n\n  while (true)\n  {\n    JERRY_ASSERT (import_node_p != NULL);\n\n    for (ecma_module_names_t *import_names_p = import_node_p->module_names_p; import_names_p != NULL;\n         import_names_p = import_names_p->next_p)\n    {\n      if (ecma_compare_ecma_strings (local_name_p, import_names_p->local_name_p))\n      {\n        ecma_module_t *imported_module_p = ecma_module_get_from_object (import_node_p->u.path_or_module);\n\n        if (ecma_compare_ecma_string_to_magic_id (import_names_p->imex_name_p, LIT_MAGIC_STRING_ASTERIX_CHAR))\n        {\n          /* Namespace import. */\n          ecma_value_t namespace = ecma_make_object_value (imported_module_p->namespace_object_p);\n\n          JERRY_ASSERT (namespace & ECMA_MODULE_NAMESPACE_RESULT_FLAG);\n\n          return ecma_module_resolve_update (resolve_result_p, namespace);\n        }\n\n        if (!ecma_module_resolve_set_append (resolve_set_p, imported_module_p, import_names_p->imex_name_p)\n            && resolve_result_p->result_type == ECMA_MODULE_RESOLVE_NOT_FOUND)\n        {\n          resolve_result_p->result_type = ECMA_MODULE_RESOLVE_CIRCULAR;\n        }\n\n        return true;\n      }\n    }\n\n    import_node_p = import_node_p->next_p;\n  }\n} /* ecma_module_resolve_import */\n\n/**\n * Resolves which module satisfies an export based from a specific module in the import tree.\n *\n * Note: See ES11 15.2.1.17.3\n */\nstatic void\necma_module_resolve_export (ecma_module_t *const module_p, /**< base module */\n                            ecma_string_t *const export_name_p, /**< export name */\n                            ecma_module_resolve_result_t *resolve_result_p) /**< [out] resolve result */\n{\n  ecma_module_resolve_set_t *resolve_set_p = ecma_module_resolve_set_create (module_p, export_name_p);\n  ecma_module_resolve_set_t *current_set_p = resolve_set_p;\n\n  resolve_result_p->result_type = ECMA_MODULE_RESOLVE_NOT_FOUND;\n  resolve_result_p->result = ECMA_VALUE_UNDEFINED;\n\n  do\n  {\n    ecma_module_t *current_module_p = current_set_p->module_p;\n    ecma_string_t *current_export_name_p = current_set_p->name_p;\n\n    if (current_module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_ERROR)\n    {\n      resolve_result_p->result_type = ECMA_MODULE_RESOLVE_ERROR;\n      goto exit;\n    }\n\n    if (current_module_p->header.u.cls.u2.module_flags & ECMA_MODULE_HAS_NAMESPACE)\n    {\n      ecma_property_t *property_p =\n        ecma_find_named_property (current_module_p->namespace_object_p, current_export_name_p);\n\n      if (property_p != NULL)\n      {\n        ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n        JERRY_ASSERT (\n          (!(*property_p & ECMA_PROPERTY_FLAG_DATA) && !(property_value_p->value & ECMA_MODULE_NAMESPACE_RESULT_FLAG))\n          || ((*property_p & ECMA_PROPERTY_FLAG_DATA) && ecma_is_value_object (property_value_p->value)\n              && ecma_object_class_is (ecma_get_object_from_value (property_value_p->value),\n                                       ECMA_OBJECT_CLASS_MODULE_NAMESPACE)));\n\n        if (!ecma_module_resolve_update (resolve_result_p, property_value_p->value))\n        {\n          goto exit;\n        }\n\n        goto next_iteration;\n      }\n    }\n    else\n    {\n      /* 6. */\n      ecma_module_names_t *export_names_p = current_module_p->local_exports_p;\n\n      while (export_names_p != NULL)\n      {\n        if (ecma_compare_ecma_strings (current_export_name_p, export_names_p->imex_name_p))\n        {\n          ecma_property_t *property_p =\n            ecma_find_named_property (current_module_p->scope_p, export_names_p->local_name_p);\n\n          if (property_p != NULL)\n          {\n            ecma_value_t reference = ecma_property_to_reference (property_p);\n\n            JERRY_ASSERT (!(reference & ECMA_MODULE_NAMESPACE_RESULT_FLAG));\n\n            if (!ecma_module_resolve_update (resolve_result_p, reference))\n            {\n              goto exit;\n            }\n          }\n          else if (!ecma_module_resolve_import (resolve_result_p,\n                                                resolve_set_p,\n                                                current_module_p,\n                                                export_names_p->local_name_p))\n          {\n            goto exit;\n          }\n\n          goto next_iteration;\n        }\n\n        export_names_p = export_names_p->next_p;\n      }\n\n      /* 7. */\n      ecma_module_node_t *indirect_export_p = current_module_p->indirect_exports_p;\n\n      while (indirect_export_p != NULL)\n      {\n        export_names_p = indirect_export_p->module_names_p;\n\n        while (export_names_p != NULL)\n        {\n          if (ecma_compare_ecma_strings (current_export_name_p, export_names_p->imex_name_p))\n          {\n            ecma_module_t *target_module_p = ecma_module_get_from_object (*indirect_export_p->u.module_object_p);\n\n            if (ecma_compare_ecma_string_to_magic_id (export_names_p->local_name_p, LIT_MAGIC_STRING_ASTERIX_CHAR))\n            {\n              /* Namespace export. */\n              ecma_value_t namespace = ecma_make_object_value (target_module_p->namespace_object_p);\n\n              JERRY_ASSERT (namespace & ECMA_MODULE_NAMESPACE_RESULT_FLAG);\n\n              if (!ecma_module_resolve_update (resolve_result_p, namespace))\n              {\n                goto exit;\n              }\n            }\n            else if (!ecma_module_resolve_set_append (resolve_set_p, target_module_p, export_names_p->local_name_p)\n                     && resolve_result_p->result_type == ECMA_MODULE_RESOLVE_NOT_FOUND)\n            {\n              resolve_result_p->result_type = ECMA_MODULE_RESOLVE_CIRCULAR;\n            }\n\n            goto next_iteration;\n          }\n\n          export_names_p = export_names_p->next_p;\n        }\n\n        indirect_export_p = indirect_export_p->next_p;\n      }\n    }\n\n    /* 8. */\n    if (ecma_compare_ecma_string_to_magic_id (current_export_name_p, LIT_MAGIC_STRING_DEFAULT))\n    {\n      goto exit;\n    }\n\n    /* 10. */\n    ecma_module_node_t *star_export_p = current_module_p->star_exports_p;\n    while (star_export_p != NULL)\n    {\n      JERRY_ASSERT (star_export_p->module_names_p == NULL);\n\n      ecma_module_t *target_module_p = ecma_module_get_from_object (*star_export_p->u.module_object_p);\n\n      if (!ecma_module_resolve_set_append (resolve_set_p, target_module_p, current_export_name_p)\n          && resolve_result_p->result_type == ECMA_MODULE_RESOLVE_NOT_FOUND)\n      {\n        resolve_result_p->result_type = ECMA_MODULE_RESOLVE_CIRCULAR;\n      }\n\n      star_export_p = star_export_p->next_p;\n    }\n\nnext_iteration:\n    current_set_p = current_set_p->next_p;\n  } while (current_set_p != NULL);\n\nexit:\n  ecma_module_resolve_set_cleanup (resolve_set_p);\n} /* ecma_module_resolve_export */\n\n/**\n * Evaluates an EcmaScript module.\n *\n * @return ECMA_VALUE_ERROR - if an error occurred\n *         ECMA_VALUE_EMPTY - otherwise\n */\necma_value_t\necma_module_evaluate (ecma_module_t *module_p) /**< module */\n{\n  if (module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_ERROR)\n  {\n    return ecma_raise_range_error (ECMA_ERR_MODULE_IS_IN_ERROR_STATE);\n  }\n\n  if (module_p->header.u.cls.u1.module_state >= JERRY_MODULE_STATE_EVALUATING)\n  {\n    return ECMA_VALUE_EMPTY;\n  }\n\n  JERRY_ASSERT (module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_LINKED);\n  JERRY_ASSERT (module_p->scope_p != NULL);\n\n  module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_EVALUATING;\n\n  ecma_value_t ret_value;\n\n  if (module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE)\n  {\n    ret_value = ECMA_VALUE_UNDEFINED;\n\n    if (module_p->u.callback)\n    {\n      ret_value = module_p->u.callback (ecma_make_object_value (&module_p->header.object));\n\n      if (JERRY_UNLIKELY (ecma_is_value_exception (ret_value)))\n      {\n        ecma_throw_exception (ret_value);\n        ret_value = ECMA_VALUE_ERROR;\n      }\n    }\n  }\n  else\n  {\n    ret_value = vm_run_module (module_p);\n  }\n\n  if (JERRY_LIKELY (!ECMA_IS_VALUE_ERROR (ret_value)))\n  {\n    module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_EVALUATED;\n\n    if (JERRY_CONTEXT (module_state_changed_callback_p) != NULL)\n    {\n      JERRY_CONTEXT (module_state_changed_callback_p)\n      (JERRY_MODULE_STATE_EVALUATED,\n       ecma_make_object_value (&module_p->header.object),\n       ret_value,\n       JERRY_CONTEXT (module_state_changed_callback_user_p));\n    }\n  }\n  else\n  {\n    ecma_module_set_error_state (module_p);\n  }\n\n  if (!(module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE))\n  {\n    ecma_bytecode_deref (module_p->u.compiled_code_p);\n  }\n\n  module_p->u.compiled_code_p = NULL;\n  return ret_value;\n} /* ecma_module_evaluate */\n\n/**\n * Resolves an export and adds it to the modules namespace object, if the export name is not yet handled.\n * Note: See 15.2.1.16.2 and 15.2.1.18\n *\n * @return ECMA_VALUE_ERROR - if an error occurred\n *         ECMA_VALUE_EMPTY - otherwise\n */\nstatic ecma_value_t\necma_module_namespace_object_add_export_if_needed (ecma_collection_t *properties_p, /**< collection of properties */\n                                                   ecma_module_t *module_p, /**< module */\n                                                   ecma_string_t *export_name_p, /**< export name */\n                                                   bool allow_default) /**< allow default export */\n{\n  if (!allow_default)\n  {\n    if (ecma_compare_ecma_string_to_magic_id (export_name_p, LIT_MAGIC_STRING_DEFAULT))\n    {\n      return ECMA_VALUE_EMPTY;\n    }\n\n    /* No need to check duplications before star exports are processed. */\n    ecma_value_t *buffer_p = properties_p->buffer_p;\n    ecma_value_t *buffer_end_p = properties_p->buffer_p + properties_p->item_count;\n\n    while (buffer_p < buffer_end_p)\n    {\n      if (ecma_compare_ecma_strings (ecma_get_string_from_value (*buffer_p), export_name_p))\n      {\n        return ECMA_VALUE_EMPTY;\n      }\n\n      buffer_p += 2;\n    }\n  }\n\n  ecma_module_resolve_result_t resolve_result;\n  ecma_module_resolve_export (module_p, export_name_p, &resolve_result);\n\n  if (resolve_result.result_type == ECMA_MODULE_RESOLVE_AMBIGUOUS)\n  {\n    return ECMA_VALUE_EMPTY;\n  }\n\n  if (resolve_result.result_type != ECMA_MODULE_RESOLVE_FOUND)\n  {\n    return ecma_module_resolve_throw (&resolve_result, export_name_p);\n  }\n\n  ecma_collection_push_back (properties_p, ecma_make_string_value (export_name_p));\n  ecma_collection_push_back (properties_p, resolve_result.result);\n  return ECMA_VALUE_EMPTY;\n} /* ecma_module_namespace_object_add_export_if_needed */\n\n/**\n * Helper routine for heapsort algorithm.\n */\nstatic void\necma_module_heap_sort_shift_down (ecma_value_t *buffer_p, /**< array of items */\n                                  uint32_t item_count, /**< number of items */\n                                  uint32_t item_index) /**< index of updated item */\n{\n  while (true)\n  {\n    uint32_t highest_index = item_index;\n    uint32_t current_index = (item_index << 1) + 2;\n\n    if (current_index >= item_count)\n    {\n      return;\n    }\n\n    if (ecma_compare_ecma_strings_relational (ecma_get_string_from_value (buffer_p[highest_index]),\n                                              ecma_get_string_from_value (buffer_p[current_index])))\n    {\n      highest_index = current_index;\n    }\n\n    current_index += 2;\n\n    if (current_index < item_count\n        && ecma_compare_ecma_strings_relational (ecma_get_string_from_value (buffer_p[highest_index]),\n                                                 ecma_get_string_from_value (buffer_p[current_index])))\n    {\n      highest_index = current_index;\n    }\n\n    if (highest_index == item_index)\n    {\n      return;\n    }\n\n    ecma_value_t tmp = buffer_p[highest_index];\n    buffer_p[highest_index] = buffer_p[item_index];\n    buffer_p[item_index] = tmp;\n\n    tmp = buffer_p[highest_index + 1];\n    buffer_p[highest_index + 1] = buffer_p[item_index + 1];\n    buffer_p[item_index + 1] = tmp;\n\n    item_index = highest_index;\n  }\n} /* ecma_module_heap_sort_shift_down */\n\n/**\n * Creates a namespace object for a module.\n * Note: See 15.2.1.18\n *\n * @return ECMA_VALUE_ERROR - if an error occurred\n *         ECMA_VALUE_EMPTY - otherwise\n */\nstatic ecma_value_t\necma_module_create_namespace_object (ecma_module_t *module_p) /**< module */\n{\n  JERRY_ASSERT (module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_LINKING);\n  JERRY_ASSERT (module_p->namespace_object_p != NULL);\n  JERRY_ASSERT (!(module_p->header.u.cls.u2.module_flags & ECMA_MODULE_HAS_NAMESPACE));\n\n  ecma_module_resolve_set_t *resolve_set_p;\n  resolve_set_p = ecma_module_resolve_set_create (module_p, ecma_get_magic_string (LIT_MAGIC_STRING_ASTERIX_CHAR));\n\n  /* The properties collection stores name / result item pairs. Name is always\n   * a string, and result can be a property reference or namespace object. */\n  ecma_module_resolve_set_t *current_set_p = resolve_set_p;\n  ecma_collection_t *properties_p = ecma_new_collection ();\n  ecma_value_t result = ECMA_VALUE_EMPTY;\n  bool allow_default = true;\n\n  do\n  {\n    ecma_module_t *current_module_p = current_set_p->module_p;\n\n    if (current_module_p->header.u.cls.u2.module_flags & ECMA_MODULE_HAS_NAMESPACE)\n    {\n      JERRY_ASSERT (!allow_default);\n\n      jmem_cpointer_t prop_iter_cp = current_module_p->namespace_object_p->u1.property_list_cp;\n\n#if JERRY_PROPERTY_HASHMAP\n      if (prop_iter_cp != JMEM_CP_NULL)\n      {\n        ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n        if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n        {\n          prop_iter_cp = prop_iter_p->next_property_cp;\n        }\n      }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n      while (prop_iter_cp != JMEM_CP_NULL)\n      {\n        ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n\n        JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n        ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n        for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n        {\n          if (!ECMA_PROPERTY_IS_RAW (prop_iter_p->types[i]))\n          {\n            continue;\n          }\n\n          ecma_string_t *name_p = ecma_string_from_property_name (prop_iter_p->types[i], prop_pair_p->names_cp[i]);\n          result = ecma_module_namespace_object_add_export_if_needed (properties_p, module_p, name_p, false);\n          ecma_deref_ecma_string (name_p);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto exit;\n          }\n        }\n\n        prop_iter_cp = prop_iter_p->next_property_cp;\n      }\n    }\n    else\n    {\n      ecma_module_names_t *export_names_p = current_module_p->local_exports_p;\n\n      if (export_names_p != NULL)\n      {\n        do\n        {\n          result = ecma_module_namespace_object_add_export_if_needed (properties_p,\n                                                                      module_p,\n                                                                      export_names_p->imex_name_p,\n                                                                      allow_default);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto exit;\n          }\n\n          export_names_p = export_names_p->next_p;\n        } while (export_names_p != NULL);\n      }\n\n      ecma_module_node_t *indirect_export_p = current_module_p->indirect_exports_p;\n\n      while (indirect_export_p != NULL)\n      {\n        export_names_p = indirect_export_p->module_names_p;\n\n        while (export_names_p != NULL)\n        {\n          result = ecma_module_namespace_object_add_export_if_needed (properties_p,\n                                                                      module_p,\n                                                                      export_names_p->imex_name_p,\n                                                                      allow_default);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto exit;\n          }\n\n          export_names_p = export_names_p->next_p;\n        }\n\n        indirect_export_p = indirect_export_p->next_p;\n      }\n    }\n\n    allow_default = false;\n\n    ecma_module_node_t *star_export_p = current_module_p->star_exports_p;\n\n    while (star_export_p != NULL)\n    {\n      JERRY_ASSERT (star_export_p->module_names_p == NULL);\n\n      /* Circular imports are ignored */\n      ecma_module_resolve_set_append (resolve_set_p,\n                                      ecma_module_get_from_object (*star_export_p->u.module_object_p),\n                                      ecma_get_magic_string (LIT_MAGIC_STRING_ASTERIX_CHAR));\n\n      star_export_p = star_export_p->next_p;\n    }\n\n    current_set_p = current_set_p->next_p;\n  } while (current_set_p != NULL);\n\n  ecma_value_t *buffer_p = properties_p->buffer_p;\n  uint32_t item_count = properties_p->item_count;\n\n  if (item_count >= 4)\n  {\n    /* Sort items with heapsort if at least two items are stored in the buffer. */\n    uint32_t end = (item_count >> 1) & ~(uint32_t) 0x1;\n\n    do\n    {\n      end -= 2;\n      ecma_module_heap_sort_shift_down (buffer_p, item_count, end);\n    } while (end > 0);\n\n    end = item_count - 2;\n\n    do\n    {\n      ecma_value_t tmp = buffer_p[end];\n      buffer_p[end] = buffer_p[0];\n      buffer_p[0] = tmp;\n\n      tmp = buffer_p[end + 1];\n      buffer_p[end + 1] = buffer_p[1];\n      buffer_p[1] = tmp;\n\n      ecma_module_heap_sort_shift_down (buffer_p, end, 0);\n      end -= 2;\n    } while (end > 0);\n  }\n\n  ecma_value_t *buffer_end_p = properties_p->buffer_p + item_count;\n\n  while (buffer_p < buffer_end_p)\n  {\n    if (buffer_p[1] & ECMA_MODULE_NAMESPACE_RESULT_FLAG)\n    {\n      ecma_property_value_t *property_value_p;\n      property_value_p = ecma_create_named_data_property (module_p->namespace_object_p,\n                                                          ecma_get_string_from_value (buffer_p[0]),\n                                                          ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE,\n                                                          NULL);\n      property_value_p->value = buffer_p[1];\n    }\n    else\n    {\n      ecma_create_named_reference_property (module_p->namespace_object_p,\n                                            ecma_get_string_from_value (buffer_p[0]),\n                                            buffer_p[1]);\n    }\n\n    buffer_p += 2;\n  }\n\n  module_p->header.u.cls.u2.module_flags |= ECMA_MODULE_HAS_NAMESPACE;\n\n  ecma_module_release_module_names (module_p->local_exports_p);\n  module_p->local_exports_p = NULL;\n\n  ecma_module_release_module_nodes (module_p->indirect_exports_p, false);\n  module_p->indirect_exports_p = NULL;\n\nexit:\n  /* Clean up. */\n  ecma_module_resolve_set_cleanup (resolve_set_p);\n  ecma_collection_destroy (properties_p);\n  return result;\n} /* ecma_module_create_namespace_object */\n\n/**\n * Connects imported values to the current module scope.\n *\n * @return ECMA_VALUE_ERROR - if an error occurred\n *         ECMA_VALUE_EMPTY - otherwise\n */\nstatic ecma_value_t\necma_module_connect_imports (ecma_module_t *module_p)\n{\n  ecma_object_t *local_env_p = module_p->scope_p;\n  JERRY_ASSERT (ecma_is_lexical_environment (local_env_p));\n\n  ecma_module_node_t *import_node_p = module_p->imports_p;\n\n  /* Check that the imported bindings don't exist yet. */\n  while (import_node_p != NULL)\n  {\n    ecma_module_names_t *import_names_p = import_node_p->module_names_p;\n\n    JERRY_ASSERT (local_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK);\n\n    while (import_names_p != NULL)\n    {\n      ecma_property_t *binding_p = ecma_find_named_property (local_env_p, import_names_p->local_name_p);\n\n      if (binding_p != NULL)\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_IMPORTED_BINDING_SHADOWS_LOCAL_VARIABLE);\n      }\n\n      import_names_p = import_names_p->next_p;\n    }\n\n    import_node_p = import_node_p->next_p;\n  }\n\n  import_node_p = module_p->imports_p;\n\n  /* Resolve imports and create local bindings. */\n  while (import_node_p != NULL)\n  {\n    ecma_module_names_t *import_names_p = import_node_p->module_names_p;\n    ecma_module_t *imported_module_p = ecma_module_get_from_object (import_node_p->u.path_or_module);\n\n    while (import_names_p != NULL)\n    {\n      if (ecma_compare_ecma_string_to_magic_id (import_names_p->imex_name_p, LIT_MAGIC_STRING_ASTERIX_CHAR))\n      {\n        /* Namespace import. */\n        ecma_property_value_t *value_p;\n        value_p =\n          ecma_create_named_data_property (module_p->scope_p, import_names_p->local_name_p, ECMA_PROPERTY_FIXED, NULL);\n        value_p->value = ecma_make_object_value (imported_module_p->namespace_object_p);\n      }\n      else\n      {\n        ecma_module_resolve_result_t resolve_result;\n        ecma_module_resolve_export (imported_module_p, import_names_p->imex_name_p, &resolve_result);\n\n        if (resolve_result.result_type != ECMA_MODULE_RESOLVE_FOUND)\n        {\n          return ecma_module_resolve_throw (&resolve_result, import_names_p->imex_name_p);\n        }\n\n        if (resolve_result.result & ECMA_MODULE_NAMESPACE_RESULT_FLAG)\n        {\n          ecma_property_value_t *property_value_p;\n          property_value_p = ecma_create_named_data_property (module_p->scope_p,\n                                                              import_names_p->local_name_p,\n                                                              ECMA_PROPERTY_FIXED,\n                                                              NULL);\n          property_value_p->value = resolve_result.result;\n        }\n        else\n        {\n          ecma_create_named_reference_property (module_p->scope_p, import_names_p->local_name_p, resolve_result.result);\n        }\n      }\n\n      import_names_p = import_names_p->next_p;\n    }\n\n    ecma_module_release_module_names (import_node_p->module_names_p);\n    import_node_p->module_names_p = NULL;\n\n    import_node_p = import_node_p->next_p;\n  }\n\n  return ECMA_VALUE_EMPTY;\n} /* ecma_module_connect_imports */\n\n/**\n * Initialize the current module by creating the local binding for the imported variables\n * and verifying indirect exports.\n *\n * @return ECMA_VALUE_ERROR - if an error occurred\n *         ECMA_VALUE_EMPTY - otherwise\n */\necma_value_t\necma_module_initialize (ecma_module_t *module_p) /**< module */\n{\n  ecma_module_node_t *import_node_p = module_p->imports_p;\n\n  while (import_node_p != NULL)\n  {\n    /* Module is evaluated even if it is used only in export-from statements. */\n    ecma_value_t result = ecma_module_evaluate (ecma_module_get_from_object (import_node_p->u.path_or_module));\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      return result;\n    }\n\n    ecma_free_value (result);\n\n    import_node_p = import_node_p->next_p;\n  }\n\n  return ECMA_VALUE_EMPTY;\n} /* ecma_module_initialize */\n\n/**\n * Gets the internal module pointer of a module\n *\n * @return module pointer - if module_val is a valid module,\n *         NULL - otherwise\n */\necma_module_t *\necma_module_get_resolved_module (ecma_value_t module_val) /**< module */\n{\n  if (!ecma_is_value_object (module_val))\n  {\n    return NULL;\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (module_val);\n\n  if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_MODULE))\n  {\n    return NULL;\n  }\n\n  return (ecma_module_t *) object_p;\n} /* ecma_module_get_resolved_module */\n\n/**\n * A module stack for depth-first search\n */\ntypedef struct ecma_module_stack_item_t\n{\n  struct ecma_module_stack_item_t *prev_p; /**< prev in the stack */\n  struct ecma_module_stack_item_t *parent_p; /**< parent item in the stack */\n  ecma_module_t *module_p; /**< currently processed module */\n  ecma_module_node_t *node_p; /**< currently processed node */\n  uint32_t dfs_index; /**< dfs index (ES2020 15.2.1.16) */\n} ecma_module_stack_item_t;\n\n/**\n * Link module dependencies\n *\n * @return ECMA_VALUE_ERROR - if an error occurred\n *         ECMA_VALUE_UNDEFINED - otherwise\n */\necma_value_t\necma_module_link (ecma_module_t *module_p, /**< root module */\n                  jerry_module_resolve_cb_t callback, /**< resolve module callback */\n                  void *user_p) /**< pointer passed to the resolve callback */\n{\n  if (module_p->header.u.cls.u1.module_state != JERRY_MODULE_STATE_UNLINKED)\n  {\n    return ecma_raise_type_error (ECMA_ERR_MODULE_MUST_BE_IN_UNLINKED_STATE);\n  }\n\n  module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_LINKING;\n\n  uint32_t dfs_index = 0;\n  ecma_module_stack_item_t *last_p;\n  ecma_module_node_t *node_p;\n\n  last_p = (ecma_module_stack_item_t *) jmem_heap_alloc_block (sizeof (ecma_module_stack_item_t));\n  last_p->prev_p = NULL;\n  last_p->parent_p = NULL;\n  last_p->module_p = module_p;\n  last_p->node_p = module_p->imports_p;\n  last_p->dfs_index = dfs_index;\n\n  module_p->header.u.cls.u3.dfs_ancestor_index = dfs_index;\n\n  ecma_value_t module_val = ecma_make_object_value (&module_p->header.object);\n  ecma_module_stack_item_t *current_p = last_p;\n\nrestart:\n  /* Entering into processing new node phase. Resolve dependencies first. */\n  node_p = current_p->node_p;\n\n  JERRY_ASSERT (ecma_module_get_from_object (module_val)->imports_p == node_p);\n\n  while (node_p != NULL)\n  {\n    ecma_module_t *resolved_module_p;\n\n    if (!ecma_is_value_object (node_p->u.path_or_module))\n    {\n      JERRY_ASSERT (ecma_is_value_string (node_p->u.path_or_module));\n\n      ecma_value_t resolve_result = callback (node_p->u.path_or_module, module_val, user_p);\n\n      if (JERRY_UNLIKELY (ecma_is_value_exception (resolve_result)))\n      {\n        ecma_throw_exception (resolve_result);\n        goto error;\n      }\n\n      resolved_module_p = ecma_module_get_resolved_module (resolve_result);\n\n      if (resolved_module_p == NULL)\n      {\n        ecma_free_value (resolve_result);\n        ecma_raise_type_error (ECMA_ERR_CALLBACK_RESULT_NOT_MODULE);\n        goto error;\n      }\n\n      ecma_deref_ecma_string (ecma_get_string_from_value (node_p->u.path_or_module));\n      node_p->u.path_or_module = resolve_result;\n      ecma_deref_object (ecma_get_object_from_value (resolve_result));\n    }\n    else\n    {\n      resolved_module_p = ecma_module_get_from_object (node_p->u.path_or_module);\n    }\n\n    if (resolved_module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_ERROR)\n    {\n      ecma_raise_type_error (ECMA_ERR_LINK_TO_MODULE_IN_ERROR_STATE);\n      goto error;\n    }\n\n    node_p = node_p->next_p;\n  }\n\n  /* Find next unlinked node, or return to parent */\n  while (true)\n  {\n    ecma_module_t *current_module_p = current_p->module_p;\n    node_p = current_p->node_p;\n\n    while (node_p != NULL)\n    {\n      module_p = ecma_module_get_from_object (node_p->u.path_or_module);\n\n      if (module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_UNLINKED)\n      {\n        current_p->node_p = node_p->next_p;\n        module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_LINKING;\n\n        ecma_module_stack_item_t *item_p;\n        item_p = (ecma_module_stack_item_t *) jmem_heap_alloc_block (sizeof (ecma_module_stack_item_t));\n\n        dfs_index++;\n\n        item_p->prev_p = last_p;\n        item_p->parent_p = current_p;\n        item_p->module_p = module_p;\n        item_p->node_p = module_p->imports_p;\n        item_p->dfs_index = dfs_index;\n\n        module_p->header.u.cls.u3.dfs_ancestor_index = dfs_index;\n\n        last_p = item_p;\n        current_p = item_p;\n        module_val = node_p->u.path_or_module;\n        goto restart;\n      }\n\n      if (module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_LINKING)\n      {\n        uint32_t dfs_ancestor_index = module_p->header.u.cls.u3.dfs_ancestor_index;\n\n        if (dfs_ancestor_index < current_module_p->header.u.cls.u3.dfs_ancestor_index)\n        {\n          current_module_p->header.u.cls.u3.dfs_ancestor_index = dfs_ancestor_index;\n        }\n      }\n\n      node_p = node_p->next_p;\n    }\n\n    if (current_module_p->scope_p == NULL)\n    {\n      JERRY_ASSERT (!(current_module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE));\n\n      /* Initialize scope for handling circular references. */\n      ecma_value_t result = vm_init_module_scope (current_module_p);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        ecma_module_set_error_state (current_module_p);\n        goto error;\n      }\n\n      JERRY_ASSERT (result == ECMA_VALUE_EMPTY);\n    }\n\n    if (current_module_p->namespace_object_p == NULL)\n    {\n      ecma_object_t *namespace_object_p =\n        ecma_create_object (NULL, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n      namespace_object_p->type_flags_refs &= (ecma_object_descriptor_t) ~ECMA_OBJECT_FLAG_EXTENSIBLE;\n\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) namespace_object_p;\n      ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_MODULE_NAMESPACE;\n      ECMA_SET_INTERNAL_VALUE_POINTER (ext_object_p->u.cls.u3.value, module_p);\n\n      current_module_p->namespace_object_p = namespace_object_p;\n      ecma_deref_object (namespace_object_p);\n    }\n\n    if (current_module_p->header.u.cls.u3.dfs_ancestor_index != current_p->dfs_index)\n    {\n      current_p = current_p->parent_p;\n      JERRY_ASSERT (current_p != NULL);\n\n      uint32_t dfs_ancestor_index = current_module_p->header.u.cls.u3.dfs_ancestor_index;\n\n      if (dfs_ancestor_index < current_p->module_p->header.u.cls.u3.dfs_ancestor_index)\n      {\n        current_p->module_p->header.u.cls.u3.dfs_ancestor_index = dfs_ancestor_index;\n      }\n      continue;\n    }\n\n    ecma_module_stack_item_t *end_p = current_p->prev_p;\n    current_p = current_p->parent_p;\n\n    ecma_module_stack_item_t *iterator_p = last_p;\n\n    do\n    {\n      JERRY_ASSERT (iterator_p->module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_LINKING);\n\n      if (ECMA_IS_VALUE_ERROR (ecma_module_create_namespace_object (iterator_p->module_p)))\n      {\n        ecma_module_set_error_state (iterator_p->module_p);\n        goto error;\n      }\n\n      iterator_p = iterator_p->prev_p;\n    } while (iterator_p != end_p);\n\n    iterator_p = last_p;\n\n    do\n    {\n      JERRY_ASSERT (iterator_p->module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_LINKING);\n\n      if (ECMA_IS_VALUE_ERROR (ecma_module_connect_imports (iterator_p->module_p)))\n      {\n        ecma_module_set_error_state (iterator_p->module_p);\n        goto error;\n      }\n\n      iterator_p = iterator_p->prev_p;\n    } while (iterator_p != end_p);\n\n    do\n    {\n      ecma_module_stack_item_t *prev_p = last_p->prev_p;\n\n      JERRY_ASSERT (last_p->module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_LINKING);\n      last_p->module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_LINKED;\n\n      if (JERRY_CONTEXT (module_state_changed_callback_p) != NULL)\n      {\n        JERRY_CONTEXT (module_state_changed_callback_p)\n        (JERRY_MODULE_STATE_LINKED,\n         ecma_make_object_value (&last_p->module_p->header.object),\n         ECMA_VALUE_UNDEFINED,\n         JERRY_CONTEXT (module_state_changed_callback_user_p));\n      }\n\n      jmem_heap_free_block (last_p, sizeof (ecma_module_stack_item_t));\n      last_p = prev_p;\n    } while (last_p != end_p);\n\n    if (current_p == NULL)\n    {\n      return ECMA_VALUE_TRUE;\n    }\n  }\n\nerror:\n  JERRY_ASSERT (last_p != NULL);\n\n  do\n  {\n    ecma_module_stack_item_t *prev_p = last_p->prev_p;\n\n    if (last_p->module_p->header.u.cls.u1.module_state != JERRY_MODULE_STATE_ERROR)\n    {\n      JERRY_ASSERT (last_p->module_p->header.u.cls.u1.module_state == JERRY_MODULE_STATE_LINKING);\n      last_p->module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_UNLINKED;\n    }\n\n    jmem_heap_free_block (last_p, sizeof (ecma_module_stack_item_t));\n    last_p = prev_p;\n  } while (last_p != NULL);\n\n  return ECMA_VALUE_ERROR;\n} /* ecma_module_link */\n\n/**\n * Compute the result of 'import()' calls\n *\n * @return promise object representing the result of the operation\n */\necma_value_t\necma_module_import (ecma_value_t specifier, /**< module specifier */\n                    ecma_value_t user_value) /**< user value assigned to the script */\n{\n  ecma_string_t *specifier_p = ecma_op_to_string (specifier);\n\n  if (JERRY_UNLIKELY (specifier_p == NULL))\n  {\n    goto error;\n  }\n\n  if (JERRY_CONTEXT (module_import_callback_p) == NULL)\n  {\n    ecma_deref_ecma_string (specifier_p);\n    goto error_module_instantiate;\n  }\n\n  jerry_value_t result;\n  result = JERRY_CONTEXT (module_import_callback_p) (ecma_make_string_value (specifier_p),\n                                                     user_value,\n                                                     JERRY_CONTEXT (module_import_callback_user_p));\n  ecma_deref_ecma_string (specifier_p);\n\n  if (JERRY_UNLIKELY (ecma_is_value_exception (result)))\n  {\n    ecma_throw_exception (result);\n    goto error;\n  }\n\n  if (ecma_is_value_object (result) && ecma_is_promise (ecma_get_object_from_value (result)))\n  {\n    return result;\n  }\n\n  ecma_module_t *module_p = ecma_module_get_resolved_module (result);\n\n  if (module_p == NULL)\n  {\n    ecma_free_value (result);\n    goto error_module_instantiate;\n  }\n\n  if (module_p->header.u.cls.u1.module_state != JERRY_MODULE_STATE_EVALUATED)\n  {\n    ecma_deref_object (&module_p->header.object);\n    goto error_module_instantiate;\n  }\n\n  result = ecma_op_create_promise_object (ECMA_VALUE_EMPTY, ECMA_VALUE_UNDEFINED, NULL);\n  ecma_fulfill_promise (result, ecma_make_object_value (module_p->namespace_object_p));\n  ecma_deref_object (&module_p->header.object);\n  return result;\n\nerror_module_instantiate:\n  ecma_raise_range_error (ECMA_ERR_MODULE_CANNOT_BE_INSTANTIATED);\n\nerror:\n  if (jcontext_has_pending_abort ())\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t exception = jcontext_take_exception ();\n\n  ecma_value_t promise = ecma_op_create_promise_object (ECMA_VALUE_EMPTY, ECMA_VALUE_UNDEFINED, NULL);\n  ecma_reject_promise (promise, exception);\n  ecma_free_value (exception);\n  return promise;\n} /* ecma_module_import */\n\n/**\n * Cleans up and releases a module structure including all referenced modules.\n */\nvoid\necma_module_release_module (ecma_module_t *module_p) /**< module */\n{\n  jerry_module_state_t state = (jerry_module_state_t) module_p->header.u.cls.u1.module_state;\n\n  JERRY_ASSERT (state != JERRY_MODULE_STATE_INVALID);\n\n#ifndef JERRY_NDEBUG\n  module_p->scope_p = NULL;\n  module_p->namespace_object_p = NULL;\n#endif /* JERRY_NDEBUG */\n\n  ecma_module_release_module_names (module_p->local_exports_p);\n\n  if (module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE)\n  {\n    return;\n  }\n\n  ecma_module_release_module_nodes (module_p->imports_p, true);\n  ecma_module_release_module_nodes (module_p->indirect_exports_p, false);\n  ecma_module_release_module_nodes (module_p->star_exports_p, false);\n\n  if (module_p->u.compiled_code_p != NULL)\n  {\n    ecma_bytecode_deref (module_p->u.compiled_code_p);\n#ifndef JERRY_NDEBUG\n    module_p->u.compiled_code_p = NULL;\n#endif /* JERRY_NDEBUG */\n  }\n} /* ecma_module_release_module */\n\n#endif /* JERRY_MODULE_SYSTEM */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-module.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_MODULE_H\n#define ECMA_MODULE_H\n\n#include \"ecma-globals.h\"\n\n#include \"common.h\"\n\n#if JERRY_MODULE_SYSTEM\n\n#define ECMA_MODULE_MAX_PATH 255u\n\n/**\n * Module status flags.\n */\ntypedef enum\n{\n  ECMA_MODULE_IS_NATIVE = (1 << 0), /**< native module */\n  ECMA_MODULE_HAS_NAMESPACE = (1 << 1), /**< namespace object has been initialized */\n} ecma_module_flags_t;\n\n/**\n * Imported or exported names, such as \"a as b\"\n * Note: See https://www.ecma-international.org/ecma-262/6.0/#table-39\n *       and https://www.ecma-international.org/ecma-262/6.0/#table-41\n */\ntypedef struct ecma_module_names\n{\n  struct ecma_module_names *next_p; /**< next linked list node */\n  ecma_string_t *imex_name_p; /**< Import/export name of the item */\n  ecma_string_t *local_name_p; /**< Local name of the item */\n} ecma_module_names_t;\n\n/**\n * Module structure storing an instance of a module\n *\n * Note:\n *      The imports_p list follows the order of import-from/export-from statements in the source\n *      code of a module, even if a given module specifier is only used by export-from statements.\n */\ntypedef struct ecma_module\n{\n  /* Note: state is stored in header.u.class_prop.extra_info */\n  ecma_extended_object_t header; /**< header part */\n  /* TODO(dbatyai): These could be compressed pointers */\n  ecma_object_t *scope_p; /**< lexical lenvironment of the module */\n  ecma_object_t *namespace_object_p; /**< namespace object of the module */\n  struct ecma_module_node *imports_p; /**< import requests of the module */\n  ecma_module_names_t *local_exports_p; /**< local exports of the module */\n  struct ecma_module_node *indirect_exports_p; /**< indirect exports of the module */\n  struct ecma_module_node *star_exports_p; /**< star exports of the module */\n\n  /* Code used for evaluating a module */\n  union\n  {\n    ecma_compiled_code_t *compiled_code_p; /**< compiled code for the module */\n    jerry_native_module_evaluate_cb_t callback; /**< callback for evaluating native modules */\n  } u;\n} ecma_module_t;\n\n/**\n * Module node to store imports / exports.\n *\n * Note:\n *      Only one module node is created for each module specifier: the names are\n *      concatenated if the same specifier is used multiple times in the source code.\n *      However, multiple nodes are created for modules with multiple alias\n *      (for example ./a.mjs and ././a.mjs can refer to the same module).\n */\ntypedef struct ecma_module_node\n{\n  struct ecma_module_node *next_p; /**< next linked list node */\n  ecma_module_names_t *module_names_p; /**< names of the requested import/export node */\n\n  union\n  {\n    ecma_value_t path_or_module; /**< imports: module specifier (if string) or module reference (if object) */\n    ecma_value_t *module_object_p; /**< non-imports: reference to a path_or_module field in the imports */\n  } u;\n} ecma_module_node_t;\n\n/**\n *  A list of module records that can be used to identify circular imports during resolution\n */\ntypedef struct ecma_module_resolve_set\n{\n  struct ecma_module_resolve_set *next_p; /**< next in linked list */\n  ecma_module_t *module_p; /**< module */\n  ecma_string_t *name_p; /**< identifier name */\n} ecma_module_resolve_set_t;\n\n/**\n * A list that is used like a stack to drive the resolution process, instead of recursion.\n */\ntypedef struct ecma_module_resolve_stack\n{\n  struct ecma_module_resolve_stack *next_p; /**< next in linked list */\n  ecma_module_t *module_p; /**< module request */\n  ecma_string_t *export_name_p; /**< export identifier name */\n  bool resolving; /**< flag storing wether the current frame started resolving */\n} ecma_module_resolve_stack_t;\n\necma_value_t ecma_module_initialize (ecma_module_t *module_p);\necma_module_t *ecma_module_get_resolved_module (ecma_value_t module_val);\n\necma_value_t ecma_module_link (ecma_module_t *module_p, jerry_module_resolve_cb_t callback_p, void *user_p);\necma_value_t ecma_module_evaluate (ecma_module_t *module_p);\necma_value_t ecma_module_import (ecma_value_t specifier, ecma_value_t user_value);\n\necma_module_t *ecma_module_create (void);\nvoid ecma_module_cleanup_context (void);\n\nvoid ecma_module_release_module_names (ecma_module_names_t *module_name_p);\nvoid ecma_module_release_module (ecma_module_t *module_p);\n\n#endif /* JERRY_MODULE_SYSTEM */\n\n#endif /* !ECMA_MODULE_H */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-property-hashmap.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-property-hashmap.h\"\n\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n#include \"jcontext.h\"\n#include \"jrt-libc-includes.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmapropertyhashmap Property hashmap\n * @{\n */\n\n#if JERRY_PROPERTY_HASHMAP\n\n/**\n * Compute the total size of the property hashmap.\n */\n#define ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE(max_property_count) \\\n  (sizeof (ecma_property_hashmap_t) + (max_property_count * sizeof (jmem_cpointer_t)) + (max_property_count >> 3))\n\n/**\n * Number of items in the stepping table.\n */\n#define ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS 8\n\n/**\n * Stepping values for searching items in the hashmap.\n */\nstatic const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS] JERRY_ATTR_CONST_DATA = {\n  3, 5, 7, 11, 13, 17, 19, 23\n};\n\n/**\n * Get the value of a bit in a bitmap.\n */\n#define ECMA_PROPERTY_HASHMAP_GET_BIT(byte_p, index) ((byte_p)[(index) >> 3] & (1 << ((index) &0x7)))\n\n/**\n * Clear the value of a bit in a bitmap.\n */\n#define ECMA_PROPERTY_HASHMAP_CLEAR_BIT(byte_p, index) \\\n  ((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] & ~(1 << ((index) &0x7))))\n\n/**\n * Set the value of a bit in a bitmap.\n */\n#define ECMA_PROPERTY_HASHMAP_SET_BIT(byte_p, index) \\\n  ((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] | (1 << ((index) &0x7))))\n\n/**\n * Create a new property hashmap for the object.\n * The object must not have a property hashmap.\n */\nvoid\necma_property_hashmap_create (ecma_object_t *object_p) /**< object */\n{\n  if (JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) != ECMA_PROP_HASHMAP_ALLOC_ON)\n  {\n    return;\n  }\n\n  jmem_cpointer_t prop_iter_cp = object_p->u1.property_list_cp;\n\n  if (prop_iter_cp == JMEM_CP_NULL)\n  {\n    return;\n  }\n\n  uint32_t named_property_count = 0;\n\n  while (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n    for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      if (prop_iter_p->types[i] != ECMA_PROPERTY_TYPE_DELETED)\n      {\n        JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (prop_iter_p->types[i]));\n        named_property_count++;\n      }\n    }\n    prop_iter_cp = prop_iter_p->next_property_cp;\n  }\n\n  if (named_property_count < (ECMA_PROPERTY_HASMAP_MINIMUM_SIZE / 2))\n  {\n    return;\n  }\n\n  /* The max_property_count must be power of 2. */\n  uint32_t max_property_count = ECMA_PROPERTY_HASMAP_MINIMUM_SIZE;\n\n  /* At least 1/3 items must be NULL. */\n  while (max_property_count < (named_property_count + (named_property_count >> 1)))\n  {\n    max_property_count <<= 1;\n  }\n\n  size_t total_size = ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (max_property_count);\n\n  ecma_property_hashmap_t *hashmap_p = (ecma_property_hashmap_t *) jmem_heap_alloc_block_null_on_error (total_size);\n\n  if (hashmap_p == NULL)\n  {\n    return;\n  }\n\n  memset (hashmap_p, 0, total_size);\n\n  hashmap_p->header.types[0] = ECMA_PROPERTY_TYPE_HASHMAP;\n  hashmap_p->header.next_property_cp = object_p->u1.property_list_cp;\n  hashmap_p->max_property_count = max_property_count;\n  hashmap_p->null_count = max_property_count - named_property_count;\n  hashmap_p->unused_count = max_property_count - named_property_count;\n\n  jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);\n  uint8_t *bits_p = (uint8_t *) (pair_list_p + max_property_count);\n  uint32_t mask = max_property_count - 1;\n\n  prop_iter_cp = object_p->u1.property_list_cp;\n  ECMA_SET_NON_NULL_POINTER (object_p->u1.property_list_cp, hashmap_p);\n\n  while (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n    for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      if (prop_iter_p->types[i] == ECMA_PROPERTY_TYPE_DELETED)\n      {\n        continue;\n      }\n\n      JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (prop_iter_p->types[i]));\n\n      ecma_property_pair_t *property_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n      uint32_t entry_index = ecma_string_get_property_name_hash (prop_iter_p->types[i], property_pair_p->names_cp[i]);\n      uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];\n\n      entry_index &= mask;\n#ifndef JERRY_NDEBUG\n      /* Because max_property_count (power of 2) and step (a prime\n       * number) are relative primes, all entries of the hasmap are\n       * visited exactly once before the start entry index is reached\n       * again. Furthermore because at least one NULL is present in\n       * the hashmap, the while loop must be terminated before the\n       * the starting index is reached again. */\n      uint32_t start_entry_index = entry_index;\n#endif /* !JERRY_NDEBUG */\n\n      while (pair_list_p[entry_index] != ECMA_NULL_POINTER)\n      {\n        entry_index = (entry_index + step) & mask;\n\n#ifndef JERRY_NDEBUG\n        JERRY_ASSERT (entry_index != start_entry_index);\n#endif /* !JERRY_NDEBUG */\n      }\n\n      ECMA_SET_NON_NULL_POINTER (pair_list_p[entry_index], property_pair_p);\n\n      if (i != 0)\n      {\n        ECMA_PROPERTY_HASHMAP_SET_BIT (bits_p, entry_index);\n      }\n    }\n\n    prop_iter_cp = prop_iter_p->next_property_cp;\n  }\n} /* ecma_property_hashmap_create */\n\n/**\n * Free the hashmap of the object.\n * The object must have a property hashmap.\n */\nvoid\necma_property_hashmap_free (ecma_object_t *object_p) /**< object */\n{\n  /* Property hash must be exists and must be the first property. */\n  JERRY_ASSERT (object_p->u1.property_list_cp != JMEM_CP_NULL);\n\n  ecma_property_header_t *property_p =\n    ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, object_p->u1.property_list_cp);\n\n  JERRY_ASSERT (property_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP);\n\n  ecma_property_hashmap_t *hashmap_p = (ecma_property_hashmap_t *) property_p;\n\n  object_p->u1.property_list_cp = property_p->next_property_cp;\n\n  jmem_heap_free_block (hashmap_p, ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count));\n} /* ecma_property_hashmap_free */\n\n/**\n * Insert named property into the hashmap.\n */\nvoid\necma_property_hashmap_insert (ecma_object_t *object_p, /**< object */\n                              ecma_string_t *name_p, /**< name of the property */\n                              ecma_property_pair_t *property_pair_p, /**< property pair */\n                              int property_index) /**< property index in the pair (0 or 1) */\n{\n  JERRY_ASSERT (property_pair_p != NULL);\n\n  ecma_property_hashmap_t *hashmap_p =\n    ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t, object_p->u1.property_list_cp);\n\n  JERRY_ASSERT (hashmap_p->header.types[0] == ECMA_PROPERTY_TYPE_HASHMAP);\n\n  /* The NULLs are reduced below 1/8 of the hashmap. */\n  if (hashmap_p->null_count < (hashmap_p->max_property_count >> 3))\n  {\n    ecma_property_hashmap_free (object_p);\n    ecma_property_hashmap_create (object_p);\n    return;\n  }\n\n  JERRY_ASSERT (property_index < ECMA_PROPERTY_PAIR_ITEM_COUNT);\n\n  uint32_t entry_index = ecma_string_hash (name_p);\n  uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];\n  uint32_t mask = hashmap_p->max_property_count - 1;\n  entry_index &= mask;\n\n#ifndef JERRY_NDEBUG\n  /* See the comment for this variable in ecma_property_hashmap_create. */\n  uint32_t start_entry_index = entry_index;\n#endif /* !JERRY_NDEBUG */\n\n  jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);\n\n  while (pair_list_p[entry_index] != ECMA_NULL_POINTER)\n  {\n    entry_index = (entry_index + step) & mask;\n\n#ifndef JERRY_NDEBUG\n    JERRY_ASSERT (entry_index != start_entry_index);\n#endif /* !JERRY_NDEBUG */\n  }\n\n  ECMA_SET_NON_NULL_POINTER (pair_list_p[entry_index], property_pair_p);\n\n  uint8_t *bits_p = (uint8_t *) (pair_list_p + hashmap_p->max_property_count);\n  bits_p += (entry_index >> 3);\n  mask = (uint32_t) (1 << (entry_index & 0x7));\n\n  if (!(*bits_p & mask))\n  {\n    /* Deleted entries also has ECMA_NULL_POINTER\n     * value, but they are not NULL values. */\n    hashmap_p->null_count--;\n    JERRY_ASSERT (hashmap_p->null_count > 0);\n  }\n\n  hashmap_p->unused_count--;\n  JERRY_ASSERT (hashmap_p->unused_count > 0);\n\n  if (property_index == 0)\n  {\n    *bits_p = (uint8_t) ((*bits_p) & ~mask);\n  }\n  else\n  {\n    *bits_p = (uint8_t) ((*bits_p) | mask);\n  }\n} /* ecma_property_hashmap_insert */\n\n/**\n * Delete named property from the hashmap.\n *\n * @return ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP if hashmap should be recreated\n *         ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP otherwise\n */\necma_property_hashmap_delete_status\necma_property_hashmap_delete (ecma_object_t *object_p, /**< object */\n                              jmem_cpointer_t name_cp, /**< property name */\n                              ecma_property_t *property_p) /**< property */\n{\n  ecma_property_hashmap_t *hashmap_p =\n    ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t, object_p->u1.property_list_cp);\n\n  JERRY_ASSERT (hashmap_p->header.types[0] == ECMA_PROPERTY_TYPE_HASHMAP);\n\n  hashmap_p->unused_count++;\n\n  /* The NULLs are above 3/4 of the hashmap. */\n  if (hashmap_p->unused_count > ((hashmap_p->max_property_count * 3) >> 2))\n  {\n    return ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP;\n  }\n\n  uint32_t entry_index = ecma_string_get_property_name_hash (*property_p, name_cp);\n  uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];\n  uint32_t mask = hashmap_p->max_property_count - 1;\n  jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);\n  uint8_t *bits_p = (uint8_t *) (pair_list_p + hashmap_p->max_property_count);\n\n  entry_index &= mask;\n\n#ifndef JERRY_NDEBUG\n  /* See the comment for this variable in ecma_property_hashmap_create. */\n  uint32_t start_entry_index = entry_index;\n#endif /* !JERRY_NDEBUG */\n\n  while (true)\n  {\n    if (pair_list_p[entry_index] != ECMA_NULL_POINTER)\n    {\n      size_t offset = 0;\n\n      if (ECMA_PROPERTY_HASHMAP_GET_BIT (bits_p, entry_index))\n      {\n        offset = 1;\n      }\n\n      ecma_property_pair_t *property_pair_p =\n        ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]);\n\n      if ((property_pair_p->header.types + offset) == property_p)\n      {\n        JERRY_ASSERT (property_pair_p->names_cp[offset] == name_cp);\n\n        pair_list_p[entry_index] = ECMA_NULL_POINTER;\n        ECMA_PROPERTY_HASHMAP_SET_BIT (bits_p, entry_index);\n        return ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP;\n      }\n    }\n    else\n    {\n      /* Must be a deleted entry. */\n      JERRY_ASSERT (ECMA_PROPERTY_HASHMAP_GET_BIT (bits_p, entry_index));\n    }\n\n    entry_index = (entry_index + step) & mask;\n\n#ifndef JERRY_NDEBUG\n    JERRY_ASSERT (entry_index != start_entry_index);\n#endif /* !JERRY_NDEBUG */\n  }\n} /* ecma_property_hashmap_delete */\n\n/**\n * Find a named property.\n *\n * @return pointer to the property if found or NULL otherwise\n */\necma_property_t *\necma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */\n                            ecma_string_t *name_p, /**< property name */\n                            jmem_cpointer_t *property_real_name_cp) /**< [out] property real name */\n{\n#ifndef JERRY_NDEBUG\n  /* A sanity check in debug mode: a named property must be present\n   * in both the property hashmap and in the property chain, or missing\n   * from both data collection. The following code checks the property\n   * chain, and sets the property_found variable. */\n  bool property_found = false;\n\n  jmem_cpointer_t prop_iter_cp = hashmap_p->header.next_property_cp;\n\n  while (prop_iter_cp != JMEM_CP_NULL && !property_found)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n    ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n    for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      if (ECMA_PROPERTY_IS_NAMED_PROPERTY (prop_iter_p->types[i]))\n      {\n        if (ecma_string_compare_to_property_name (prop_iter_p->types[i], prop_pair_p->names_cp[i], name_p))\n        {\n          /* Property is found */\n          property_found = true;\n          break;\n        }\n      }\n    }\n\n    prop_iter_cp = prop_iter_p->next_property_cp;\n  }\n#endif /* !JERRY_NDEBUG */\n\n  uint32_t entry_index = ecma_string_hash (name_p);\n  uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];\n  uint32_t mask = hashmap_p->max_property_count - 1;\n  jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);\n  uint8_t *bits_p = (uint8_t *) (pair_list_p + hashmap_p->max_property_count);\n  entry_index &= mask;\n\n#ifndef JERRY_NDEBUG\n  /* See the comment for this variable in ecma_property_hashmap_create. */\n  uint32_t start_entry_index = entry_index;\n#endif /* !JERRY_NDEBUG */\n\n  if (ECMA_IS_DIRECT_STRING (name_p))\n  {\n    ecma_property_t prop_name_type = (ecma_property_t) ECMA_GET_DIRECT_STRING_TYPE (name_p);\n    jmem_cpointer_t property_name_cp = (jmem_cpointer_t) ECMA_GET_DIRECT_STRING_VALUE (name_p);\n\n    JERRY_ASSERT (prop_name_type > 0);\n\n    while (true)\n    {\n      if (pair_list_p[entry_index] != ECMA_NULL_POINTER)\n      {\n        size_t offset = 0;\n        if (ECMA_PROPERTY_HASHMAP_GET_BIT (bits_p, entry_index))\n        {\n          offset = 1;\n        }\n\n        ecma_property_pair_t *property_pair_p =\n          ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]);\n\n        ecma_property_t *property_p = property_pair_p->header.types + offset;\n\n        JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (*property_p));\n\n        if (property_pair_p->names_cp[offset] == property_name_cp\n            && ECMA_PROPERTY_GET_NAME_TYPE (*property_p) == prop_name_type)\n        {\n#ifndef JERRY_NDEBUG\n          JERRY_ASSERT (property_found);\n#endif /* !JERRY_NDEBUG */\n\n          *property_real_name_cp = property_name_cp;\n          return property_p;\n        }\n      }\n      else\n      {\n        if (!ECMA_PROPERTY_HASHMAP_GET_BIT (bits_p, entry_index))\n        {\n#ifndef JERRY_NDEBUG\n          JERRY_ASSERT (!property_found);\n#endif /* !JERRY_NDEBUG */\n\n          return NULL;\n        }\n        /* Otherwise it is a deleted entry. */\n      }\n\n      entry_index = (entry_index + step) & mask;\n\n#ifndef JERRY_NDEBUG\n      JERRY_ASSERT (entry_index != start_entry_index);\n#endif /* !JERRY_NDEBUG */\n    }\n  }\n\n  while (true)\n  {\n    if (pair_list_p[entry_index] != ECMA_NULL_POINTER)\n    {\n      size_t offset = 0;\n      if (ECMA_PROPERTY_HASHMAP_GET_BIT (bits_p, entry_index))\n      {\n        offset = 1;\n      }\n\n      ecma_property_pair_t *property_pair_p =\n        ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]);\n\n      ecma_property_t *property_p = property_pair_p->header.types + offset;\n\n      JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (*property_p));\n\n      if (ECMA_PROPERTY_GET_NAME_TYPE (*property_p) == ECMA_DIRECT_STRING_PTR)\n      {\n        ecma_string_t *prop_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, property_pair_p->names_cp[offset]);\n\n        if (ecma_compare_ecma_non_direct_strings (prop_name_p, name_p))\n        {\n#ifndef JERRY_NDEBUG\n          JERRY_ASSERT (property_found);\n#endif /* !JERRY_NDEBUG */\n\n          *property_real_name_cp = property_pair_p->names_cp[offset];\n          return property_p;\n        }\n      }\n    }\n    else\n    {\n      if (!ECMA_PROPERTY_HASHMAP_GET_BIT (bits_p, entry_index))\n      {\n#ifndef JERRY_NDEBUG\n        JERRY_ASSERT (!property_found);\n#endif /* !JERRY_NDEBUG */\n\n        return NULL;\n      }\n      /* Otherwise it is a deleted entry. */\n    }\n\n    entry_index = (entry_index + step) & mask;\n\n#ifndef JERRY_NDEBUG\n    JERRY_ASSERT (entry_index != start_entry_index);\n#endif /* !JERRY_NDEBUG */\n  }\n} /* ecma_property_hashmap_find */\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/base/ecma-property-hashmap.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_PROPERTY_HASHMAP_H\n#define ECMA_PROPERTY_HASHMAP_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmapropertyhashmap Property hashmap\n * @{\n */\n\n/**\n * Recommended minimum number of items in a property cache.\n */\n#define ECMA_PROPERTY_HASMAP_MINIMUM_SIZE 32\n\n/**\n * Property hash.\n */\ntypedef struct\n{\n  ecma_property_header_t header; /**< header of the property */\n  uint32_t max_property_count; /**< maximum property count (power of 2) */\n  uint32_t null_count; /**< number of NULLs in the map */\n  uint32_t unused_count; /**< number of unused entries in the map */\n\n  /*\n   * The hash is followed by max_property_count ecma_cpointer_t\n   * compressed pointers and (max_property_count + 7) / 8 bytes\n   * which stores a flag for each compressed pointer.\n   *\n   * If the compressed pointer is equal to ECMA_NULL_POINTER\n   *   - flag is cleared if the entry is NULL\n   *   - flag is set if the entry is deleted\n   *\n   * If the compressed pointer is not equal to ECMA_NULL_POINTER\n   *   - flag is cleared if the first entry of a property pair is referenced\n   *   - flag is set if the second entry of a property pair is referenced\n   */\n} ecma_property_hashmap_t;\n\n#if JERRY_PROPERTY_HASHMAP\n\n/**\n * Simple ecma values\n */\ntypedef enum\n{\n  ECMA_PROPERTY_HASHMAP_DELETE_NO_HASHMAP, /**< object has no hashmap */\n  ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP, /**< object has hashmap */\n  ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP, /**< hashmap should be recreated */\n} ecma_property_hashmap_delete_status;\n\nvoid ecma_property_hashmap_create (ecma_object_t *object_p);\nvoid ecma_property_hashmap_free (ecma_object_t *object_p);\nvoid ecma_property_hashmap_insert (ecma_object_t *object_p,\n                                   ecma_string_t *name_p,\n                                   ecma_property_pair_t *property_pair_p,\n                                   int property_index);\necma_property_hashmap_delete_status\necma_property_hashmap_delete (ecma_object_t *object_p, jmem_cpointer_t name_cp, ecma_property_t *property_p);\n\necma_property_t *ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p,\n                                             ecma_string_t *name_p,\n                                             jmem_cpointer_t *property_real_name_cp);\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_PROPERTY_HASHMAP_H */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jrt.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-aggregateerror-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  aggregate_error_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * AggregateError.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.7.8 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_AGGREGATE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.9 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.10 */\nSTRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-aggregateerror.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  aggregate_error\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup aggregateerror ECMA AggregateError object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in AggregateError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_aggregate_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                            uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n  ecma_value_t message_val = ECMA_VALUE_UNDEFINED;\n  ecma_value_t error_val = ECMA_VALUE_UNDEFINED;\n\n  if (arguments_list_len > 0)\n  {\n    error_val = arguments_list_p[0];\n\n    if (arguments_list_len > 1)\n    {\n      message_val = arguments_list_p[1];\n    }\n  }\n\n  return ecma_new_aggregate_error (error_val, message_val);\n} /* ecma_builtin_aggregate_error_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in AggregateError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_aggregate_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                 uint32_t arguments_list_len) /**< number of arguments */\n{\n  ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),\n                                                                   ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE);\n\n  if (proto_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ecma_builtin_aggregate_error_dispatch_call (arguments_list_p, arguments_list_len);\n\n  if (!ECMA_IS_VALUE_ERROR (result))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (result);\n    ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, proto_p);\n  }\n\n  ecma_deref_object (proto_p);\n\n  return result;\n} /* ecma_builtin_aggregate_error_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * AggregateError built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 2, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-typedarray-object.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_ARRAY_ITERATOR_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_ARRAY_ITERATOR_PROTOTYPE_OBJECT_NEXT,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-array-iterator-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  array_iterator_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup %arrayiteratorprototype% ECMA %ArrayIteratorPrototype% object built-in\n * @{\n */\n\n/**\n * The %ArrayIteratorPrototype% object's 'next' routine\n *\n * See also:\n *          ECMA-262 v6, 22.1.5.2.1\n *\n * Note:\n *     Returned value must be freed with ecma_free_value.\n *\n * @return iterator result object, if success\n *         error - otherwise\n */\nstatic ecma_value_t\necma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< this argument */\n{\n  /* 1 - 2. */\n  if (!ecma_is_value_object (this_val))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (this_val);\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n  /* 3. */\n  if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARRAY_ITERATOR))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_ITERATOR);\n  }\n\n  ecma_value_t iterated_value = ext_obj_p->u.cls.u3.iterated_value;\n\n  /* 4 - 5 */\n  if (ecma_is_value_empty (iterated_value))\n  {\n    return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n  }\n\n  ecma_object_t *array_object_p = ecma_get_object_from_value (iterated_value);\n\n  /* 8. */\n  ecma_length_t length;\n  if (ecma_object_is_typedarray (array_object_p))\n  {\n    /* a. */\n    ecma_object_t *arraybuffer_p = ecma_typedarray_get_arraybuffer (array_object_p);\n    if (ecma_arraybuffer_is_detached (arraybuffer_p))\n    {\n      return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n    }\n\n    /* b. */\n    length = ecma_typedarray_get_length (array_object_p);\n  }\n  else\n  {\n    ecma_value_t len_value = ecma_op_object_get_length (array_object_p, &length);\n\n    if (ECMA_IS_VALUE_ERROR (len_value))\n    {\n      return len_value;\n    }\n  }\n\n  ecma_length_t index = ext_obj_p->u.cls.u2.iterator_index;\n\n  if (JERRY_UNLIKELY (index == ECMA_ITERATOR_INDEX_LIMIT))\n  {\n    /* After the ECMA_ITERATOR_INDEX_LIMIT limit is reached the [[%Iterator%NextIndex]]\n       property is stored as an internal property */\n    ecma_string_t *prop_name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_ITERATOR_NEXT_INDEX);\n    ecma_value_t index_value = ecma_op_object_get (obj_p, prop_name_p);\n\n    if (!ecma_is_value_undefined (index_value))\n    {\n      index = (ecma_length_t) (ecma_get_number_from_value (index_value) + 1);\n    }\n\n    ecma_value_t put_result = ecma_op_object_put (obj_p, prop_name_p, ecma_make_length_value (index), true);\n\n    JERRY_ASSERT (ecma_is_value_true (put_result));\n\n    ecma_free_value (index_value);\n  }\n  else\n  {\n    /* 11. */\n    ext_obj_p->u.cls.u2.iterator_index++;\n  }\n\n  if (index >= length)\n  {\n    ext_obj_p->u.cls.u3.iterated_value = ECMA_VALUE_EMPTY;\n    return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n  }\n\n  /* 7. */\n  uint8_t iterator_kind = ext_obj_p->u.cls.u1.iterator_kind;\n\n  if (iterator_kind == ECMA_ITERATOR_KEYS)\n  {\n    /* 12. */\n    return ecma_create_iter_result_object (ecma_make_length_value (index), ECMA_VALUE_FALSE);\n  }\n\n  /* 14. */\n  ecma_value_t get_value = ecma_op_object_get_by_index (array_object_p, index);\n\n  /* 15. */\n  if (ECMA_IS_VALUE_ERROR (get_value))\n  {\n    return get_value;\n  }\n\n  ecma_value_t result;\n\n  /* 16. */\n  if (iterator_kind == ECMA_ITERATOR_VALUES)\n  {\n    result = ecma_create_iter_result_object (get_value, ECMA_VALUE_FALSE);\n  }\n  else\n  {\n    /* 17.a */\n    JERRY_ASSERT (iterator_kind == ECMA_ITERATOR_ENTRIES);\n\n    /* 17.b */\n    ecma_value_t entry_array_value;\n    entry_array_value = ecma_create_array_from_iter_element (get_value, ecma_make_length_value (index));\n\n    result = ecma_create_iter_result_object (entry_array_value, ECMA_VALUE_FALSE);\n    ecma_free_value (entry_array_value);\n  }\n\n  ecma_free_value (get_value);\n\n  return result;\n} /* ecma_builtin_array_iterator_prototype_object_next */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_array_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in routine identifier */\n                                                        ecma_value_t this_arg, /**< 'this' argument value */\n                                                        const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                                *   passed to routine */\n                                                        uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (arguments_list_p, arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_ARRAY_ITERATOR_PROTOTYPE_OBJECT_NEXT:\n    {\n      return ecma_builtin_array_iterator_prototype_object_next (this_arg);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_array_iterator_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %ArrayIteratorPrototype% built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_NEXT, ECMA_ARRAY_ITERATOR_PROTOTYPE_OBJECT_NEXT, 0, 0)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-array-prototype-unscopables.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  array_prototype_unscopables\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Array.prototype[@@unscopables] built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\nSIMPLE_VALUE (LIT_MAGIC_STRING_AT, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\nSIMPLE_VALUE (LIT_MAGIC_STRING_COPY_WITHIN, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\nSIMPLE_VALUE (LIT_MAGIC_STRING_ENTRIES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\nSIMPLE_VALUE (LIT_MAGIC_STRING_FILL, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\nSIMPLE_VALUE (LIT_MAGIC_STRING_FIND, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\nSIMPLE_VALUE (LIT_MAGIC_STRING_FIND_INDEX, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\nSIMPLE_VALUE (LIT_MAGIC_STRING_FLAT, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\nSIMPLE_VALUE (LIT_MAGIC_STRING_FLATMAP, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\nSIMPLE_VALUE (LIT_MAGIC_STRING_INCLUDES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\nSIMPLE_VALUE (LIT_MAGIC_STRING_KEYS, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\nSIMPLE_VALUE (LIT_MAGIC_STRING_VALUES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-comparison.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n#include \"lit-char-helpers.h\"\n\n#if JERRY_BUILTIN_ARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_ARRAY_PROTOTYPE_ROUTINE_START = 0,\n  /* Note: these 2 routine ids must be in this order */\n  ECMA_ARRAY_PROTOTYPE_SORT,\n  ECMA_ARRAY_PROTOTYPE_CONCAT,\n  ECMA_ARRAY_PROTOTYPE_TO_LOCALE_STRING,\n  ECMA_ARRAY_PROTOTYPE_JOIN,\n  ECMA_ARRAY_PROTOTYPE_POP,\n  ECMA_ARRAY_PROTOTYPE_PUSH,\n  ECMA_ARRAY_PROTOTYPE_REVERSE,\n  ECMA_ARRAY_PROTOTYPE_SHIFT,\n  ECMA_ARRAY_PROTOTYPE_SLICE,\n  ECMA_ARRAY_PROTOTYPE_SPLICE,\n  ECMA_ARRAY_PROTOTYPE_UNSHIFT,\n  ECMA_ARRAY_PROTOTYPE_AT,\n  ECMA_ARRAY_PROTOTYPE_INDEX_OF,\n  ECMA_ARRAY_PROTOTYPE_LAST_INDEX_OF,\n  /* Note these 3 routines must be in this order */\n  ECMA_ARRAY_PROTOTYPE_EVERY,\n  ECMA_ARRAY_PROTOTYPE_SOME,\n  ECMA_ARRAY_PROTOTYPE_FOR_EACH,\n  ECMA_ARRAY_PROTOTYPE_MAP,\n  ECMA_ARRAY_PROTOTYPE_FILTER,\n  /* Note these 2 routines must be in this order */\n  ECMA_ARRAY_PROTOTYPE_REDUCE,\n  ECMA_ARRAY_PROTOTYPE_REDUCE_RIGHT,\n  ECMA_ARRAY_PROTOTYPE_FIND,\n  ECMA_ARRAY_PROTOTYPE_FIND_INDEX,\n  ECMA_ARRAY_PROTOTYPE_ENTRIES,\n  ECMA_ARRAY_PROTOTYPE_KEYS,\n  ECMA_ARRAY_PROTOTYPE_SYMBOL_ITERATOR,\n  ECMA_ARRAY_PROTOTYPE_FILL,\n  ECMA_ARRAY_PROTOTYPE_COPY_WITHIN,\n  ECMA_ARRAY_PROTOTYPE_INCLUDES,\n  ECMA_ARRAY_PROTOTYPE_FLAT,\n  ECMA_ARRAY_PROTOTYPE_FLATMAP,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-array-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  array_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup arrayprototype ECMA Array.prototype object built-in\n * @{\n */\n\n/**\n * Helper function to set an object's length property\n *\n * @return ecma value (return value of the [[Put]] method)\n *         Calling ecma_free_value on the returned value is optional if it is not abrupt completion.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_helper_set_length (ecma_object_t *object, /**< object*/\n                                                ecma_number_t length) /**< new length */\n{\n  ecma_value_t length_value = ecma_make_number_value (length);\n  ecma_value_t ret_value =\n    ecma_op_object_put (object, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), length_value, true);\n\n  ecma_free_value (length_value);\n\n  JERRY_ASSERT (ecma_is_value_boolean (ret_value) || ecma_is_value_empty (ret_value)\n                || ECMA_IS_VALUE_ERROR (ret_value));\n  return ret_value;\n} /* ecma_builtin_array_prototype_helper_set_length */\n\n/**\n * The Array.prototype object's 'toLocaleString' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_to_locale_string (ecma_object_t *obj_p, /**< object */\n                                                      ecma_length_t length) /**< object's length */\n{\n  /* 5. */\n  if (length == 0)\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  /* 7-8. */\n  ecma_string_t *first_string_p = ecma_builtin_helper_get_to_locale_string_at_index (obj_p, 0);\n\n  if (JERRY_UNLIKELY (first_string_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (first_string_p);\n  ecma_deref_ecma_string (first_string_p);\n\n  /* 9-10. */\n  for (ecma_length_t k = 1; k < length; k++)\n  {\n    /* 4. Implementation-defined: set the separator to a single comma character. */\n    ecma_stringbuilder_append_byte (&builder, LIT_CHAR_COMMA);\n\n    ecma_string_t *next_string_p = ecma_builtin_helper_get_to_locale_string_at_index (obj_p, k);\n\n    if (JERRY_UNLIKELY (next_string_p == NULL))\n    {\n      ecma_stringbuilder_destroy (&builder);\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_stringbuilder_append (&builder, next_string_p);\n    ecma_deref_ecma_string (next_string_p);\n  }\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_array_prototype_object_to_locale_string */\n\n/**\n * The Array.prototype object's 'concat' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_concat (const ecma_value_t args[], /**< arguments list */\n                                            uint32_t args_number, /**< number of arguments */\n                                            ecma_object_t *obj_p) /**< array object */\n{\n  /* 2. */\n  ecma_object_t *new_array_p = ecma_op_array_species_create (obj_p, 0);\n\n  if (JERRY_UNLIKELY (new_array_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 3. */\n  ecma_length_t new_length = 0;\n\n  /* 5.b - 5.c for this_arg */\n  ecma_value_t concat_this_value =\n    ecma_builtin_helper_array_concat_value (new_array_p, &new_length, ecma_make_object_value (obj_p));\n  if (ECMA_IS_VALUE_ERROR (concat_this_value))\n  {\n    ecma_deref_object (new_array_p);\n    return concat_this_value;\n  }\n\n  JERRY_ASSERT (ecma_is_value_empty (concat_this_value));\n\n  /* 5. */\n  for (uint32_t arg_index = 0; arg_index < args_number; arg_index++)\n  {\n    ecma_value_t concat_value = ecma_builtin_helper_array_concat_value (new_array_p, &new_length, args[arg_index]);\n\n    if (ECMA_IS_VALUE_ERROR (concat_value))\n    {\n      ecma_deref_object (new_array_p);\n      return concat_value;\n    }\n\n    JERRY_ASSERT (ecma_is_value_empty (concat_value));\n  }\n\n  ecma_value_t set_length_value =\n    ecma_builtin_array_prototype_helper_set_length (new_array_p, ((ecma_number_t) new_length));\n  if (ECMA_IS_VALUE_ERROR (set_length_value))\n  {\n    ecma_deref_object (new_array_p);\n    return set_length_value;\n  }\n\n  return ecma_make_object_value (new_array_p);\n} /* ecma_builtin_array_prototype_object_concat */\n\n/**\n * The Array.prototype.toString's separator creation routine\n *\n * See also:\n *          ECMA-262 v5.1, 15.4.4.2 4th step\n *\n * @return NULL - if the conversion fails\n *         ecma_string_t * - otherwise\n */\n\nstatic ecma_string_t *\necma_op_array_get_separator_string (ecma_value_t separator) /**< possible separator */\n{\n  if (ecma_is_value_undefined (separator))\n  {\n    return ecma_get_magic_string (LIT_MAGIC_STRING_COMMA_CHAR);\n  }\n\n  return ecma_op_to_string (separator);\n} /* ecma_op_array_get_separator_string */\n\n/**\n * The Array.prototype's 'toString' single element operation routine\n *\n * See also:\n *          ECMA-262 v5.1, 15.4.4.2\n *\n * @return NULL - if the conversion fails\n *         ecma_string_t * - otherwise\n */\nstatic ecma_string_t *\necma_op_array_get_to_string_at_index (ecma_object_t *obj_p, /**< this object */\n                                      ecma_length_t index) /**< array index */\n{\n  ecma_value_t index_value = ecma_op_object_get_by_index (obj_p, index);\n\n  if (ECMA_IS_VALUE_ERROR (index_value))\n  {\n    return NULL;\n  }\n\n  if (ecma_is_value_undefined (index_value) || ecma_is_value_null (index_value))\n  {\n    return ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  ecma_string_t *ret_str_p = ecma_op_to_string (index_value);\n\n  ecma_free_value (index_value);\n\n  return ret_str_p;\n} /* ecma_op_array_get_to_string_at_index */\n\n/**\n * The Array.prototype object's 'join' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_join (ecma_value_t separator_arg, /**< separator argument */\n                                   ecma_object_t *obj_p, /**< object */\n                                   ecma_length_t length) /**< object's length */\n{\n  /* 4-5. */\n  ecma_string_t *separator_string_p = ecma_op_array_get_separator_string (separator_arg);\n\n  if (JERRY_UNLIKELY (separator_string_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (length == 0)\n  {\n    /* 6. */\n    ecma_deref_ecma_string (separator_string_p);\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  /* 7-8. */\n  ecma_string_t *first_string_p = ecma_op_array_get_to_string_at_index (obj_p, 0);\n\n  if (JERRY_UNLIKELY (first_string_p == NULL))\n  {\n    ecma_deref_ecma_string (separator_string_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (first_string_p);\n  ecma_deref_ecma_string (first_string_p);\n\n  /* 9-10. */\n  for (ecma_length_t k = 1; k < length; k++)\n  {\n    /* 10.a */\n    ecma_stringbuilder_append (&builder, separator_string_p);\n\n    /* 10.d */\n    ecma_string_t *next_string_p = ecma_op_array_get_to_string_at_index (obj_p, k);\n\n    if (JERRY_UNLIKELY (next_string_p == NULL))\n    {\n      ecma_deref_ecma_string (separator_string_p);\n      ecma_stringbuilder_destroy (&builder);\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_stringbuilder_append (&builder, next_string_p);\n    ecma_deref_ecma_string (next_string_p);\n  }\n\n  ecma_deref_ecma_string (separator_string_p);\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_array_prototype_join */\n\n/**\n * The Array.prototype object's 'pop' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.6\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_pop (ecma_object_t *obj_p, /**< object */\n                                         ecma_length_t len) /**< object's length */\n{\n  /* 4. */\n  if (len == 0)\n  {\n    /* 4.a */\n    ecma_value_t set_length_value = ecma_builtin_array_prototype_helper_set_length (obj_p, ECMA_NUMBER_ZERO);\n\n    /* 4.b */\n    return ECMA_IS_VALUE_ERROR (set_length_value) ? set_length_value : ECMA_VALUE_UNDEFINED;\n  }\n\n  /* 5.b */\n  len--;\n  ecma_value_t get_value = ecma_op_object_get_by_index (obj_p, len);\n\n  if (ECMA_IS_VALUE_ERROR (get_value))\n  {\n    return get_value;\n  }\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_delete_fast_array_properties (obj_p, (uint32_t) len);\n\n    return get_value;\n  }\n\n  /* 5.c */\n  ecma_value_t del_value = ecma_op_object_delete_by_index (obj_p, len, true);\n\n  if (ECMA_IS_VALUE_ERROR (del_value))\n  {\n    ecma_free_value (get_value);\n    return del_value;\n  }\n\n  ecma_free_value (del_value);\n\n  /* 5.d */\n  ecma_value_t set_length_value = ecma_builtin_array_prototype_helper_set_length (obj_p, ((ecma_number_t) len));\n\n  if (ECMA_IS_VALUE_ERROR (set_length_value))\n  {\n    ecma_free_value (get_value);\n    return set_length_value;\n  }\n\n  return get_value;\n} /* ecma_builtin_array_prototype_object_pop */\n\n/**\n * The Array.prototype object's 'push' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.7\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_push (const ecma_value_t *argument_list_p, /**< arguments list */\n                                          uint32_t arguments_number, /**< number of arguments */\n                                          ecma_object_t *obj_p, /**< object */\n                                          ecma_length_t length) /**< object's length */\n{\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    if ((ecma_number_t) (length + arguments_number) > UINT32_MAX)\n    {\n      return ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH);\n    }\n\n    if (arguments_number == 0)\n    {\n      return ecma_make_uint32_value ((uint32_t) length);\n    }\n\n    uint32_t new_length = ((uint32_t) length) + arguments_number;\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n    ecma_value_t *buffer_p = ecma_fast_array_extend (obj_p, new_length) + length;\n\n    for (uint32_t index = 0; index < arguments_number; index++)\n    {\n      buffer_p[index] = ecma_copy_value_if_not_object (argument_list_p[index]);\n    }\n\n    ext_obj_p->u.array.length_prop_and_hole_count -= ECMA_FAST_ARRAY_HOLE_ONE * arguments_number;\n\n    return ecma_make_uint32_value (new_length);\n  }\n\n  /* 5. */\n  if ((ecma_number_t) (length + arguments_number) > ECMA_NUMBER_MAX_SAFE_INTEGER)\n  {\n    return ecma_raise_type_error (ECMA_ERR_PUSHING_TOO_HIGH_ELEMENT);\n  }\n\n  /* 6. */\n  for (ecma_length_t index = 0; index < arguments_number; index++, length++)\n  {\n    /* 6.b */\n    ecma_value_t put_value = ecma_op_object_put_by_index (obj_p, length, argument_list_p[index], true);\n\n    if (ECMA_IS_VALUE_ERROR (put_value))\n    {\n      return put_value;\n    }\n  }\n\n  /* 6 - 7. */\n  ecma_value_t set_length_value = ecma_builtin_array_prototype_helper_set_length (obj_p, (ecma_number_t) length);\n\n  if (ECMA_IS_VALUE_ERROR (set_length_value))\n  {\n    return set_length_value;\n  }\n\n  return ecma_make_length_value (length);\n} /* ecma_builtin_array_prototype_object_push */\n\n/**\n * The Array.prototype object's 'reverse' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.8\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_reverse (ecma_value_t this_arg, /**< this argument */\n                                             ecma_object_t *obj_p, /**< object */\n                                             ecma_length_t len) /**< object's length */\n{\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    uint32_t middle = (uint32_t) len / 2;\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n    if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0)\n    {\n      ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);\n\n      for (uint32_t i = 0; i < middle; i++)\n      {\n        ecma_value_t tmp = buffer_p[i];\n        buffer_p[i] = buffer_p[len - 1 - i];\n        buffer_p[len - 1 - i] = tmp;\n      }\n\n      return ecma_copy_value (this_arg);\n    }\n  }\n\n  ecma_length_t middle = len / 2;\n  for (ecma_length_t lower = 0; lower < middle; lower++)\n  {\n    ecma_length_t upper = len - lower - 1;\n    ecma_value_t ret_value = ECMA_VALUE_ERROR;\n\n    ecma_string_t *lower_str_p = ecma_new_ecma_string_from_length (lower);\n    ecma_string_t *upper_str_p = ecma_new_ecma_string_from_length (upper);\n\n    ecma_value_t lower_value = ECMA_VALUE_EMPTY;\n    ecma_value_t upper_value = ECMA_VALUE_EMPTY;\n\n    ecma_value_t has_lower = ecma_op_object_has_property (obj_p, lower_str_p);\n\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_IS_VALUE_ERROR (has_lower))\n    {\n      goto clean_up;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    bool lower_exist = ecma_is_value_true (has_lower);\n\n    if (lower_exist)\n    {\n      lower_value = ecma_op_object_get (obj_p, lower_str_p);\n\n      if (ECMA_IS_VALUE_ERROR (lower_value))\n      {\n        goto clean_up;\n      }\n    }\n\n    ecma_value_t has_upper = ecma_op_object_has_property (obj_p, upper_str_p);\n\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_IS_VALUE_ERROR (has_upper))\n    {\n      goto clean_up;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    bool upper_exist = ecma_is_value_true (has_upper);\n\n    if (upper_exist)\n    {\n      upper_value = ecma_op_object_get (obj_p, upper_str_p);\n\n      if (ECMA_IS_VALUE_ERROR (upper_value))\n      {\n        goto clean_up;\n      }\n    }\n\n    if (lower_exist && upper_exist)\n    {\n      ecma_value_t outer_put_value = ecma_op_object_put (obj_p, lower_str_p, upper_value, true);\n\n      if (ECMA_IS_VALUE_ERROR (outer_put_value))\n      {\n        goto clean_up;\n      }\n\n      ecma_value_t inner_put_value = ecma_op_object_put (obj_p, upper_str_p, lower_value, true);\n\n      if (ECMA_IS_VALUE_ERROR (inner_put_value))\n      {\n        goto clean_up;\n      }\n    }\n    else if (!lower_exist && upper_exist)\n    {\n      ecma_value_t put_value = ecma_op_object_put (obj_p, lower_str_p, upper_value, true);\n\n      if (ECMA_IS_VALUE_ERROR (put_value))\n      {\n        goto clean_up;\n      }\n\n      ecma_value_t del_value = ecma_op_object_delete (obj_p, upper_str_p, true);\n\n      if (ECMA_IS_VALUE_ERROR (del_value))\n      {\n        goto clean_up;\n      }\n    }\n    else if (lower_exist)\n    {\n      ecma_value_t del_value = ecma_op_object_delete (obj_p, lower_str_p, true);\n\n      if (ECMA_IS_VALUE_ERROR (del_value))\n      {\n        goto clean_up;\n      }\n\n      ecma_value_t put_value = ecma_op_object_put (obj_p, upper_str_p, lower_value, true);\n\n      if (ECMA_IS_VALUE_ERROR (put_value))\n      {\n        goto clean_up;\n      }\n    }\n\n    ret_value = ECMA_VALUE_EMPTY;\n\nclean_up:\n    ecma_free_value (upper_value);\n    ecma_free_value (lower_value);\n    ecma_deref_ecma_string (lower_str_p);\n    ecma_deref_ecma_string (upper_str_p);\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      return ret_value;\n    }\n  }\n\n  return ecma_copy_value (this_arg);\n} /* ecma_builtin_array_prototype_object_reverse */\n\n/**\n * The Array.prototype object's 'shift' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.9\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_shift (ecma_object_t *obj_p, /**< object */\n                                           ecma_length_t len) /**< object's length */\n{\n  /* 4. */\n  if (len == 0)\n  {\n    ecma_value_t set_length_value = ecma_builtin_array_prototype_helper_set_length (obj_p, ECMA_NUMBER_ZERO);\n\n    return ECMA_IS_VALUE_ERROR (set_length_value) ? set_length_value : ECMA_VALUE_UNDEFINED;\n  }\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n    if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0)\n    {\n      ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);\n      ecma_value_t ret_value = buffer_p[0];\n\n      if (ecma_is_value_object (ret_value))\n      {\n        ecma_ref_object (ecma_get_object_from_value (ret_value));\n      }\n\n      memmove (buffer_p, buffer_p + 1, (size_t) (sizeof (ecma_value_t) * (len - 1)));\n\n      buffer_p[len - 1] = ECMA_VALUE_UNDEFINED;\n      ecma_delete_fast_array_properties (obj_p, (uint32_t) (len - 1));\n\n      return ret_value;\n    }\n  }\n\n  /* 5. */\n  ecma_value_t first_value = ecma_op_object_get_by_index (obj_p, 0);\n\n  if (ECMA_IS_VALUE_ERROR (first_value))\n  {\n    return first_value;\n  }\n\n  /* 6. and 7. */\n  for (ecma_length_t k = 1; k < len; k++)\n  {\n    /* 7.a - 7.c */\n    ecma_value_t curr_value = ecma_op_object_find_by_index (obj_p, k);\n\n    if (ECMA_IS_VALUE_ERROR (curr_value))\n    {\n      ecma_free_value (first_value);\n      return curr_value;\n    }\n\n    /* 7.b */\n    ecma_length_t to = k - 1;\n    ecma_value_t operation_value;\n\n    if (ecma_is_value_found (curr_value))\n    {\n      /* 7.d.i, 7.d.ii */\n      operation_value = ecma_op_object_put_by_index (obj_p, to, curr_value, true);\n      ecma_free_value (curr_value);\n    }\n    else\n    {\n      /* 7.e.i */\n      operation_value = ecma_op_object_delete_by_index (obj_p, to, true);\n    }\n\n    if (ECMA_IS_VALUE_ERROR (operation_value))\n    {\n      ecma_free_value (first_value);\n      return operation_value;\n    }\n  }\n\n  /* 8. */\n  ecma_value_t del_value = ecma_op_object_delete_by_index (obj_p, --len, true);\n\n  if (ECMA_IS_VALUE_ERROR (del_value))\n  {\n    ecma_free_value (first_value);\n    return del_value;\n  }\n\n  /* 9. */\n  ecma_value_t set_length_value = ecma_builtin_array_prototype_helper_set_length (obj_p, ((ecma_number_t) len));\n\n  if (ECMA_IS_VALUE_ERROR (set_length_value))\n  {\n    ecma_free_value (first_value);\n    return set_length_value;\n  }\n\n  /* 10. */\n  return first_value;\n} /* ecma_builtin_array_prototype_object_shift */\n\n/**\n * The Array.prototype object's 'slice' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.10\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_slice (ecma_value_t arg1, /**< start */\n                                           ecma_value_t arg2, /**< end */\n                                           ecma_object_t *obj_p, /**< object */\n                                           ecma_length_t len) /**< object's length */\n{\n  ecma_length_t start = 0, end = len;\n\n  /* 5. 6.*/\n  if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg1, len, &start)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 7. */\n  if (ecma_is_value_undefined (arg2))\n  {\n    end = len;\n  }\n  else\n  {\n    /* 7. part 2, 8.*/\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg2, len, &end)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  JERRY_ASSERT (start <= len && end <= len);\n\n  bool use_fast_path = ecma_op_object_is_fast_array (obj_p);\n  ecma_length_t copied_length = (end > start) ? end - start : 0;\n\n  ecma_object_t *new_array_p = ecma_op_array_species_create (obj_p, copied_length);\n\n  if (JERRY_UNLIKELY (new_array_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  use_fast_path &= ecma_op_object_is_fast_array (new_array_p);\n\n  if (use_fast_path && copied_length > 0)\n  {\n    ecma_extended_object_t *ext_from_obj_p = (ecma_extended_object_t *) obj_p;\n\n    if (ext_from_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE)\n    {\n      if (JERRY_UNLIKELY (obj_p->u1.property_list_cp == JMEM_CP_NULL))\n      {\n        /**\n         * Very unlikely case: the buffer copied from is a fast buffer and the property list was deleted.\n         * There is no need to do any copy.\n         */\n        return ecma_make_object_value (new_array_p);\n      }\n\n      /* Source array's length could be changed during the start/end normalization.\n       * If the \"end\" value is greater than the current length, clamp the value to avoid buffer-overflow. */\n      if (ext_from_obj_p->u.array.length < end)\n      {\n        end = ext_from_obj_p->u.array.length;\n      }\n\n      ecma_extended_object_t *ext_to_obj_p = (ecma_extended_object_t *) new_array_p;\n\n      uint32_t target_length = ext_to_obj_p->u.array.length;\n      ecma_value_t *to_buffer_p;\n      JERRY_ASSERT (copied_length <= UINT32_MAX);\n\n      if (copied_length == target_length)\n      {\n        to_buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, new_array_p->u1.property_list_cp);\n      }\n      else if (copied_length > target_length)\n      {\n        to_buffer_p = ecma_fast_array_extend (new_array_p, (uint32_t) copied_length);\n      }\n      else\n      {\n        ecma_delete_fast_array_properties (new_array_p, (uint32_t) copied_length);\n        to_buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, new_array_p->u1.property_list_cp);\n      }\n\n      ecma_value_t *from_buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);\n\n      /* 9. */\n      uint32_t n = 0;\n\n      for (uint32_t k = (uint32_t) start; k < (uint32_t) end; k++, n++)\n      {\n        ecma_free_value_if_not_object (to_buffer_p[n]);\n        to_buffer_p[n] = ecma_copy_value_if_not_object (from_buffer_p[k]);\n      }\n\n      ext_to_obj_p->u.array.length_prop_and_hole_count &= ECMA_FAST_ARRAY_HOLE_ONE - 1;\n\n      return ecma_make_object_value (new_array_p);\n    }\n  }\n\n  /* 9. */\n  ecma_length_t n = 0;\n\n  /* 10. */\n  for (ecma_length_t k = start; k < end; k++, n++)\n  {\n    /* 10.c */\n    ecma_value_t get_value = ecma_op_object_find_by_index (obj_p, k);\n\n    if (ECMA_IS_VALUE_ERROR (get_value))\n    {\n      ecma_deref_object (new_array_p);\n      return get_value;\n    }\n\n    if (ecma_is_value_found (get_value))\n    {\n      /* 10.c.ii */\n      ecma_value_t put_comp;\n      put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p,\n                                                        n,\n                                                        get_value,\n                                                        ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE\n                                                          | JERRY_PROP_SHOULD_THROW);\n      ecma_free_value (get_value);\n\n      if (ECMA_IS_VALUE_ERROR (put_comp))\n      {\n        ecma_deref_object (new_array_p);\n        return put_comp;\n      }\n    }\n  }\n\n  ecma_value_t set_length_value = ecma_builtin_array_prototype_helper_set_length (new_array_p, ((ecma_number_t) n));\n\n  if (ECMA_IS_VALUE_ERROR (set_length_value))\n  {\n    ecma_deref_object (new_array_p);\n    return set_length_value;\n  }\n\n  return ecma_make_object_value (new_array_p);\n} /* ecma_builtin_array_prototype_object_slice */\n\n/**\n * SortCompare abstract method\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.11\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_sort_compare_helper (ecma_value_t lhs, /**< left value */\n                                                         ecma_value_t rhs, /**< right value */\n                                                         ecma_value_t compare_func, /**< compare function */\n                                                         ecma_object_t *array_buffer_p) /**< arrayBuffer */\n{\n  JERRY_UNUSED (array_buffer_p);\n  /*\n   * ECMA-262 v5, 15.4.4.11 NOTE1: Because non-existent property values always\n   * compare greater than undefined property values, and undefined always\n   * compares greater than any other value, undefined property values always\n   * sort to the end of the result, followed by non-existent property values.\n   */\n  bool lhs_is_undef = ecma_is_value_undefined (lhs);\n  bool rhs_is_undef = ecma_is_value_undefined (rhs);\n\n  if (lhs_is_undef)\n  {\n    return ecma_make_integer_value (rhs_is_undef ? 0 : 1);\n  }\n\n  if (rhs_is_undef)\n  {\n    return ecma_make_integer_value (-1);\n  }\n\n  ecma_number_t result = ECMA_NUMBER_ZERO;\n\n  if (ecma_is_value_undefined (compare_func))\n  {\n    /* Default comparison when no compare_func is passed. */\n    ecma_string_t *lhs_str_p = ecma_op_to_string (lhs);\n    if (JERRY_UNLIKELY (lhs_str_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_string_t *rhs_str_p = ecma_op_to_string (rhs);\n    if (JERRY_UNLIKELY (rhs_str_p == NULL))\n    {\n      ecma_deref_ecma_string (lhs_str_p);\n      return ECMA_VALUE_ERROR;\n    }\n\n    if (ecma_compare_ecma_strings_relational (lhs_str_p, rhs_str_p))\n    {\n      result = ECMA_NUMBER_MINUS_ONE;\n    }\n    else if (!ecma_compare_ecma_strings (lhs_str_p, rhs_str_p))\n    {\n      result = ECMA_NUMBER_ONE;\n    }\n    else\n    {\n      result = ECMA_NUMBER_ZERO;\n    }\n\n    ecma_deref_ecma_string (rhs_str_p);\n    ecma_deref_ecma_string (lhs_str_p);\n  }\n  else\n  {\n    /*\n     * compare_func, if not undefined, will always contain a callable function object.\n     * We checked this previously, before this function was called.\n     */\n    JERRY_ASSERT (ecma_op_is_callable (compare_func));\n    ecma_object_t *comparefn_obj_p = ecma_get_object_from_value (compare_func);\n\n    ecma_value_t compare_args[] = { lhs, rhs };\n\n    ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p, ECMA_VALUE_UNDEFINED, compare_args, 2);\n    if (ECMA_IS_VALUE_ERROR (call_value))\n    {\n      return call_value;\n    }\n\n    if (!ecma_is_value_number (call_value))\n    {\n      ecma_number_t ret_num;\n\n      if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (call_value, &ret_num)))\n      {\n        ecma_free_value (call_value);\n        return ECMA_VALUE_ERROR;\n      }\n\n      result = ret_num;\n    }\n    else\n    {\n      result = ecma_get_number_from_value (call_value);\n    }\n\n    ecma_free_value (call_value);\n  }\n\n  return ecma_make_number_value (result);\n} /* ecma_builtin_array_prototype_object_sort_compare_helper */\n\n/**\n * The Array.prototype object's 'sort' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.11\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argument */\n                                          ecma_value_t arg1, /**< comparefn */\n                                          ecma_object_t *obj_p) /**< object */\n{\n  /* Check if the provided compare function is callable. */\n  if (!ecma_is_value_undefined (arg1) && !ecma_op_is_callable (arg1))\n  {\n    return ecma_raise_type_error (ECMA_ERR_COMPARE_FUNC_NOT_CALLABLE);\n  }\n\n  ecma_length_t len;\n  ecma_value_t len_value = ecma_op_object_get_length (obj_p, &len);\n\n  if (ECMA_IS_VALUE_ERROR (len_value))\n  {\n    return len_value;\n  }\n  ecma_collection_t *array_index_props_p = ecma_new_collection ();\n\n  for (uint32_t i = 0; i < len; i++)\n  {\n    ecma_string_t *prop_name_p = ecma_new_ecma_string_from_uint32 (i);\n\n    ecma_property_descriptor_t prop_desc;\n    ecma_value_t get_desc = ecma_op_object_get_own_property_descriptor (obj_p, prop_name_p, &prop_desc);\n\n    if (ECMA_IS_VALUE_ERROR (get_desc))\n    {\n      ecma_collection_free (array_index_props_p);\n      ecma_deref_ecma_string (prop_name_p);\n      return get_desc;\n    }\n\n    if (ecma_is_value_true (get_desc))\n    {\n      ecma_ref_ecma_string (prop_name_p);\n      ecma_collection_push_back (array_index_props_p, ecma_make_string_value (prop_name_p));\n      ecma_free_property_descriptor (&prop_desc);\n      continue;\n    }\n  }\n\n  uint32_t defined_prop_count = array_index_props_p->item_count;\n\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n  uint32_t copied_num = 0;\n  JMEM_DEFINE_LOCAL_ARRAY (values_buffer, defined_prop_count, ecma_value_t);\n\n  ecma_value_t *buffer_p = array_index_props_p->buffer_p;\n\n  /* Copy unsorted array into a native c array. */\n  for (uint32_t i = 0; i < array_index_props_p->item_count; i++)\n  {\n    ecma_string_t *property_name_p = ecma_get_string_from_value (buffer_p[i]);\n\n    uint32_t index = ecma_string_get_array_index (property_name_p);\n    JERRY_ASSERT (index != ECMA_STRING_NOT_ARRAY_INDEX);\n\n    if (index >= len)\n    {\n      break;\n    }\n\n    ecma_value_t index_value = ecma_op_object_get (obj_p, property_name_p);\n\n    if (ECMA_IS_VALUE_ERROR (index_value))\n    {\n      goto clean_up;\n    }\n\n    values_buffer[copied_num++] = index_value;\n  }\n\n  JERRY_ASSERT (copied_num == defined_prop_count);\n\n  /* Sorting. */\n  if (copied_num > 1)\n  {\n    const ecma_builtin_helper_sort_compare_fn_t sort_cb = &ecma_builtin_array_prototype_object_sort_compare_helper;\n    ecma_value_t sort_value =\n      ecma_builtin_helper_array_merge_sort_helper (values_buffer, (uint32_t) (copied_num), arg1, sort_cb, NULL);\n    if (ECMA_IS_VALUE_ERROR (sort_value))\n    {\n      goto clean_up;\n    }\n\n    ecma_free_value (sort_value);\n  }\n\n  /* Put sorted values to the front of the array. */\n  for (uint32_t index = 0; index < copied_num; index++)\n  {\n    ecma_value_t put_value = ecma_op_object_put_by_index (obj_p, index, values_buffer[index], true);\n\n    if (ECMA_IS_VALUE_ERROR (put_value))\n    {\n      goto clean_up;\n    }\n  }\n\n  ret_value = ECMA_VALUE_EMPTY;\n\nclean_up:\n  /* Free values that were copied to the local array. */\n  for (uint32_t index = 0; index < copied_num; index++)\n  {\n    ecma_free_value (values_buffer[index]);\n  }\n\n  JMEM_FINALIZE_LOCAL_ARRAY (values_buffer);\n\n  if (ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    ecma_collection_free (array_index_props_p);\n    return ret_value;\n  }\n\n  JERRY_ASSERT (ecma_is_value_empty (ret_value));\n\n  /* Undefined properties should be in the back of the array. */\n  ecma_value_t *buffer_p = array_index_props_p->buffer_p;\n\n  for (uint32_t i = 0; i < array_index_props_p->item_count; i++)\n  {\n    ecma_string_t *property_name_p = ecma_get_string_from_value (buffer_p[i]);\n\n    uint32_t index = ecma_string_get_array_index (property_name_p);\n    JERRY_ASSERT (index != ECMA_STRING_NOT_ARRAY_INDEX);\n\n    if (index >= copied_num && index < len)\n    {\n      ecma_value_t del_value = ecma_op_object_delete (obj_p, property_name_p, true);\n\n      if (ECMA_IS_VALUE_ERROR (del_value))\n      {\n        ecma_collection_free (array_index_props_p);\n        return del_value;\n      }\n    }\n  }\n\n  ecma_collection_free (array_index_props_p);\n\n  return ecma_copy_value (this_arg);\n} /* ecma_builtin_array_prototype_object_sort */\n\n/**\n * The Array.prototype object's 'splice' routine\n *\n * See also:\n *          ECMA-262 v11, 22.1.3.28\n *          ECMA-262 v5, 15.4.4.12\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< arguments list */\n                                            uint32_t args_number, /**< number of arguments */\n                                            ecma_object_t *obj_p, /**< object */\n                                            ecma_length_t len) /**< object's length */\n{\n  ecma_length_t actual_start = 0;\n  ecma_length_t actual_delete_count = 0;\n  ecma_length_t insert_count = 0;\n\n  if (args_number > 0)\n  {\n    /* ES5.1: 6, ES11: 4. */\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (args[0], len, &actual_start)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    /* ES11: 6. */\n    if (args_number == 1)\n    {\n      actual_delete_count = len - actual_start;\n    }\n    /* ES11: 7. */\n    else\n    {\n      insert_count = args_number - 2;\n\n      ecma_number_t delete_num;\n      if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (args[1], &delete_num)))\n      {\n        return ECMA_VALUE_ERROR;\n      }\n\n      /* ES5.1: 7 */\n      actual_delete_count =\n        (ecma_length_t) (JERRY_MIN (JERRY_MAX (delete_num, 0), (ecma_number_t) (len - actual_start)));\n    }\n  }\n\n  ecma_length_t new_length = len + insert_count - actual_delete_count;\n\n  /* ES11: 8. */\n  if ((ecma_number_t) new_length > ECMA_NUMBER_MAX_SAFE_INTEGER)\n  {\n    return ecma_raise_type_error (ECMA_ERR_INVALID_NEW_ARRAY_LENGTH);\n  }\n\n  /* ES11: 9. */\n  ecma_object_t *new_array_p = ecma_op_array_species_create (obj_p, actual_delete_count);\n\n  if (JERRY_UNLIKELY (new_array_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* ES5.1: 8, ES11: 10. */\n  ecma_length_t k = 0;\n\n  /* ES5.1: 9, ES11: 11. */\n  for (; k < actual_delete_count; k++)\n  {\n    ecma_length_t from = actual_start + k;\n    ecma_value_t from_present = ecma_op_object_find_by_index (obj_p, from);\n\n    if (ECMA_IS_VALUE_ERROR (from_present))\n    {\n      ecma_deref_object (new_array_p);\n      return from_present;\n    }\n\n    if (ecma_is_value_found (from_present))\n    {\n      ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p,\n                                                                     k,\n                                                                     from_present,\n                                                                     ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE\n                                                                       | JERRY_PROP_SHOULD_THROW);\n      ecma_free_value (from_present);\n\n      if (ECMA_IS_VALUE_ERROR (put_comp))\n      {\n        ecma_deref_object (new_array_p);\n        return put_comp;\n      }\n    }\n  }\n\n  /* ES11: 12. */\n  ecma_value_t set_length =\n    ecma_builtin_array_prototype_helper_set_length (new_array_p, ((ecma_number_t) actual_delete_count));\n\n  if (ECMA_IS_VALUE_ERROR (set_length))\n  {\n    ecma_deref_object (new_array_p);\n    return set_length;\n  }\n\n  /* ES5.1: 12, ES11: 15. */\n  if (insert_count < actual_delete_count)\n  {\n    for (k = actual_start; k < len - actual_delete_count; k++)\n    {\n      ecma_length_t from = k + actual_delete_count;\n      ecma_length_t to = k + insert_count;\n\n      ecma_value_t from_present = ecma_op_object_find_by_index (obj_p, from);\n\n      if (ECMA_IS_VALUE_ERROR (from_present))\n      {\n        ecma_deref_object (new_array_p);\n        return from_present;\n      }\n\n      ecma_value_t operation_value;\n\n      if (ecma_is_value_found (from_present))\n      {\n        operation_value = ecma_op_object_put_by_index (obj_p, to, from_present, true);\n        ecma_free_value (from_present);\n      }\n      else\n      {\n        operation_value = ecma_op_object_delete_by_index (obj_p, to, true);\n      }\n\n      if (ECMA_IS_VALUE_ERROR (operation_value))\n      {\n        ecma_deref_object (new_array_p);\n        return operation_value;\n      }\n    }\n\n    k = len;\n\n    for (k = len; k > new_length; k--)\n    {\n      ecma_value_t del_value = ecma_op_object_delete_by_index (obj_p, k - 1, true);\n\n      if (ECMA_IS_VALUE_ERROR (del_value))\n      {\n        ecma_deref_object (new_array_p);\n        return del_value;\n      }\n    }\n  }\n  /* ES5.1: 13, ES11: 16. */\n  else if (insert_count > actual_delete_count)\n  {\n    for (k = len - actual_delete_count; k > actual_start; k--)\n    {\n      ecma_length_t from = k + actual_delete_count - 1;\n      ecma_length_t to = k + insert_count - 1;\n\n      ecma_value_t from_present = ecma_op_object_find_by_index (obj_p, from);\n\n      if (ECMA_IS_VALUE_ERROR (from_present))\n      {\n        ecma_deref_object (new_array_p);\n        return from_present;\n      }\n\n      ecma_value_t operation_value;\n\n      if (ecma_is_value_found (from_present))\n      {\n        operation_value = ecma_op_object_put_by_index (obj_p, to, from_present, true);\n        ecma_free_value (from_present);\n      }\n      else\n      {\n        operation_value = ecma_op_object_delete_by_index (obj_p, to, true);\n      }\n\n      if (ECMA_IS_VALUE_ERROR (operation_value))\n      {\n        ecma_deref_object (new_array_p);\n        return operation_value;\n      }\n    }\n  }\n\n  /* ES5.1: 14, ES11: 17. */\n  k = actual_start;\n\n  /* ES5.1: 15, ES11: 18. */\n  uint32_t idx = 0;\n  for (uint32_t arg_index = 2; arg_index < args_number; arg_index++, idx++)\n  {\n    ecma_value_t put_value = ecma_op_object_put_by_index (obj_p, actual_start + idx, args[arg_index], true);\n\n    if (ECMA_IS_VALUE_ERROR (put_value))\n    {\n      ecma_deref_object (new_array_p);\n      return put_value;\n    }\n  }\n\n  /* ES5.1: 16, ES11: 19. */\n  ecma_value_t set_new_length = ecma_builtin_array_prototype_helper_set_length (obj_p, ((ecma_number_t) new_length));\n\n  if (ECMA_IS_VALUE_ERROR (set_new_length))\n  {\n    ecma_deref_object (new_array_p);\n    return set_new_length;\n  }\n\n  /* ES5.1: 17, ES11: 20. */\n  return ecma_make_object_value (new_array_p);\n} /* ecma_builtin_array_prototype_object_splice */\n\n/**\n * The Array.prototype object's 'unshift' routine\n *\n * See also:\n *          ECMA-262  v5, 15.4.4.13\n *          ECMA-262 v11, 22.1.3.31\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_unshift (const ecma_value_t args[], /**< arguments list */\n                                             uint32_t args_number, /**< number of arguments */\n                                             ecma_object_t *obj_p, /**< object */\n                                             ecma_length_t len) /**< object's length */\n{\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n    if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0)\n    {\n      if (args_number > UINT32_MAX - len)\n      {\n        return ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH);\n      }\n\n      if (args_number == 0)\n      {\n        return ecma_make_uint32_value ((uint32_t) len);\n      }\n\n      uint32_t new_length = ((uint32_t) len) + args_number;\n      ecma_value_t *buffer_p = ecma_fast_array_extend (obj_p, new_length);\n      memmove (buffer_p + args_number, buffer_p, (size_t) (sizeof (ecma_value_t) * len));\n\n      uint32_t index = 0;\n\n      while (index < args_number)\n      {\n        buffer_p[index] = ecma_copy_value_if_not_object (args[index]);\n        index++;\n      }\n\n      ext_obj_p->u.array.length_prop_and_hole_count -= args_number * ECMA_FAST_ARRAY_HOLE_ONE;\n\n      return ecma_make_uint32_value (new_length);\n    }\n  }\n\n  if (args_number > 0)\n  {\n    /* ES11:4.a. */\n    if ((ecma_number_t) (len + args_number) > ECMA_NUMBER_MAX_SAFE_INTEGER)\n    {\n      return ecma_raise_type_error (ECMA_ERR_UNSHIFT_TOO_HIGH);\n    }\n\n    /* ES5.1:5.,6. ES11: 4.b, 4.c */\n    for (ecma_length_t k = len; k > 0; k--)\n    {\n      /* ES5.1:6.a, 6.c, ES11:4.c.i., 4.c.iii.  */\n      ecma_value_t get_value = ecma_op_object_find_by_index (obj_p, k - 1);\n\n      if (ECMA_IS_VALUE_ERROR (get_value))\n      {\n        return get_value;\n      }\n\n      /* ES5.1:6.b, ES11:4.c.ii. */\n      ecma_number_t new_idx = ((ecma_number_t) k) + ((ecma_number_t) args_number) - 1;\n      ecma_string_t *index_str_p = ecma_new_ecma_string_from_number (new_idx);\n      ecma_value_t operation_value;\n\n      if (ecma_is_value_found (get_value))\n      {\n        /* ES5.1:6.d.i, 6.d.ii, ES11:4.c.iv. */\n        operation_value = ecma_op_object_put (obj_p, index_str_p, get_value, true);\n        ecma_free_value (get_value);\n      }\n      else\n      {\n        /* ES5.1:6.e.i, ES11:4.c.v. */\n        operation_value = ecma_op_object_delete (obj_p, index_str_p, true);\n      }\n\n      ecma_deref_ecma_string (index_str_p);\n\n      if (ECMA_IS_VALUE_ERROR (operation_value))\n      {\n        return operation_value;\n      }\n    }\n\n    for (uint32_t arg_index = 0; arg_index < args_number; arg_index++)\n    {\n      /* ES5.1:9.b, ES11:4.f.ii.  */\n      ecma_value_t put_value = ecma_op_object_put_by_index (obj_p, arg_index, args[arg_index], true);\n\n      if (ECMA_IS_VALUE_ERROR (put_value))\n      {\n        return put_value;\n      }\n    }\n  }\n\n  /* ES5.1:10., ES11:5. */\n  ecma_number_t new_len = ((ecma_number_t) len) + ((ecma_number_t) args_number);\n  ecma_value_t set_length_value = ecma_builtin_array_prototype_helper_set_length (obj_p, new_len);\n\n  if (ECMA_IS_VALUE_ERROR (set_length_value))\n  {\n    return set_length_value;\n  }\n\n  return ecma_make_number_value (new_len);\n} /* ecma_builtin_array_prototype_object_unshift */\n\n/**\n * The Array.prototype object's 'at' routine\n *\n * See also:\n *          ECMA-262 Stage 3 Draft Relative Indexing Method proposal\n *          from: https://tc39.es/proposal-relative-indexing-method\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_at (const ecma_value_t index, /**< index argument */\n                                        ecma_object_t *obj_p, /**< object */\n                                        ecma_length_t len) /**< object's length */\n{\n  ecma_length_t res_index;\n  ecma_value_t return_value = ecma_builtin_helper_calculate_index (index, len, &res_index);\n\n  if (return_value != ECMA_VALUE_EMPTY)\n  {\n    return return_value;\n  }\n\n  return ecma_op_object_get_by_index (obj_p, res_index);\n} /* ecma_builtin_array_prototype_object_at */\n\n/**\n * The Array.prototype object's 'indexOf' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.14\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_index_of (const ecma_value_t args[], /**< arguments list */\n                                              uint32_t args_number, /**< number of arguments */\n                                              ecma_object_t *obj_p, /**< object */\n                                              ecma_length_t len) /**< object's length */\n{\n  /* 4. */\n  if (len == 0)\n  {\n    return ecma_make_integer_value (-1);\n  }\n\n  /* 5. */\n  ecma_number_t idx = 0;\n  if (args_number > 1)\n  {\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (args[1], &idx)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  /* 6. */\n  if (idx >= (ecma_number_t) len)\n  {\n    return ecma_make_number_value (-1);\n  }\n\n  /* 7. */\n  ecma_length_t from_idx = (ecma_length_t) idx;\n\n  /* 8. */\n  if (idx < 0)\n  {\n    from_idx = (ecma_length_t) JERRY_MAX ((ecma_number_t) len + idx, 0);\n  }\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n    if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE)\n    {\n      if (JERRY_UNLIKELY (obj_p->u1.property_list_cp == JMEM_CP_NULL))\n      {\n        return ecma_make_integer_value (-1);\n      }\n\n      len = JERRY_MIN (ext_obj_p->u.array.length, len);\n\n      ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);\n\n      while (from_idx < len)\n      {\n        if (ecma_op_strict_equality_compare (args[0], buffer_p[from_idx]))\n        {\n          return ecma_make_uint32_value ((uint32_t) from_idx);\n        }\n\n        from_idx++;\n      }\n\n      return ecma_make_integer_value (-1);\n    }\n  }\n\n  /* 6. */\n  while (from_idx < len)\n  {\n    /* 9.a */\n    ecma_value_t get_value = ecma_op_object_find_by_index (obj_p, from_idx);\n\n    if (ECMA_IS_VALUE_ERROR (get_value))\n    {\n      return get_value;\n    }\n\n    /* 9.b.i, 9.b.ii */\n    if (ecma_is_value_found (get_value) && ecma_op_strict_equality_compare (args[0], get_value))\n    {\n      ecma_free_value (get_value);\n      return ecma_make_length_value (from_idx);\n    }\n\n    from_idx++;\n\n    ecma_free_value (get_value);\n  }\n\n  return ecma_make_integer_value (-1);\n} /* ecma_builtin_array_prototype_object_index_of */\n\n/**\n * The Array.prototype object's 'lastIndexOf' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.15\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_last_index_of (const ecma_value_t args[], /**< arguments list */\n                                                   uint32_t args_number, /**< number of arguments */\n                                                   ecma_object_t *obj_p, /**< object */\n                                                   ecma_length_t len) /**< object's length */\n{\n  /* 4. */\n  if (len == 0)\n  {\n    return ecma_make_integer_value (-1);\n  }\n\n  /* 5. */\n  ecma_number_t idx = (ecma_number_t) len - 1;\n  if (args_number > 1)\n  {\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (args[1], &idx)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  ecma_length_t from_idx;\n\n  /* 6 */\n  if (idx >= 0)\n  {\n    from_idx = (ecma_length_t) (JERRY_MIN (idx, (ecma_number_t) (len - 1)));\n  }\n  else\n  {\n    ecma_number_t k = (ecma_number_t) len + idx;\n    if (k < 0)\n    {\n      return ecma_make_integer_value (-1);\n    }\n    from_idx = (ecma_length_t) k;\n  }\n\n  ecma_value_t search_element = (args_number > 0) ? args[0] : ECMA_VALUE_UNDEFINED;\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n    if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE)\n    {\n      if (JERRY_UNLIKELY (obj_p->u1.property_list_cp == JMEM_CP_NULL))\n      {\n        return ecma_make_integer_value (-1);\n      }\n\n      len = JERRY_MIN (ext_obj_p->u.array.length, len);\n\n      ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);\n\n      while (from_idx < len)\n      {\n        if (ecma_op_strict_equality_compare (search_element, buffer_p[from_idx]))\n        {\n          return ecma_make_uint32_value ((uint32_t) from_idx);\n        }\n        from_idx--;\n      }\n      return ecma_make_integer_value (-1);\n    }\n  }\n\n  /* 8. */\n  while (from_idx < len)\n  {\n    /* 8.a */\n    ecma_value_t get_value = ecma_op_object_find_by_index (obj_p, from_idx);\n\n    if (ECMA_IS_VALUE_ERROR (get_value))\n    {\n      return get_value;\n    }\n\n    /* 8.b.i, 8.b.ii */\n    if (ecma_is_value_found (get_value) && ecma_op_strict_equality_compare (search_element, get_value))\n    {\n      ecma_free_value (get_value);\n      return ecma_make_length_value (from_idx);\n    }\n\n    from_idx--;\n\n    ecma_free_value (get_value);\n  }\n\n  return ecma_make_integer_value (-1);\n} /* ecma_builtin_array_prototype_object_last_index_of */\n\n/**\n * Type of array routine.\n */\ntypedef enum\n{\n  ARRAY_ROUTINE_EVERY, /**< Array.every: ECMA-262 v5, 15.4.4.16 */\n  ARRAY_ROUTINE_SOME, /**< Array.some: ECMA-262 v5, 15.4.4.17 */\n  ARRAY_ROUTINE_FOREACH, /**< Array.forEach: ECMA-262 v5, 15.4.4.18 */\n  ARRAY_ROUTINE__COUNT /**< count of the modes */\n} array_routine_mode;\n\n/**\n * Applies the provided function to each element of the array as long as\n * the return value stays empty. The common function for 'every', 'some'\n * and 'forEach' of the Array prototype.\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.16\n *          ECMA-262 v5, 15.4.4.17\n *          ECMA-262 v5, 15.4.4.18\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_apply (ecma_value_t arg1, /**< callbackfn */\n                          ecma_value_t arg2, /**< thisArg */\n                          array_routine_mode mode, /**< array routine mode */\n                          ecma_object_t *obj_p, /**< object */\n                          ecma_length_t len) /**< object's length */\n\n{\n  JERRY_ASSERT (mode < ARRAY_ROUTINE__COUNT);\n\n  /* 4. */\n  if (!ecma_op_is_callable (arg1))\n  {\n    return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);\n  }\n\n  /* We already checked that arg1 is callable */\n  ecma_object_t *func_object_p = ecma_get_object_from_value (arg1);\n  ecma_value_t current_index;\n\n  /* 7. */\n  for (ecma_length_t index = 0; index < len; index++)\n  {\n    /* 7.a - 7.c */\n    ecma_value_t get_value = ecma_op_object_find_by_index (obj_p, index);\n\n    if (ECMA_IS_VALUE_ERROR (get_value))\n    {\n      return get_value;\n    }\n\n    if (ecma_is_value_found (get_value))\n    {\n      /* 7.c.i */\n      current_index = ecma_make_length_value (index);\n\n      ecma_value_t call_args[] = { get_value, current_index, ecma_make_object_value (obj_p) };\n      /* 7.c.ii */\n      ecma_value_t call_value = ecma_op_function_call (func_object_p, arg2, call_args, 3);\n\n      if (ECMA_IS_VALUE_ERROR (call_value))\n      {\n        ecma_free_value (get_value);\n        return call_value;\n      }\n\n      bool to_boolean = ecma_op_to_boolean (call_value);\n\n      ecma_free_value (call_value);\n      ecma_free_value (get_value);\n\n      /* 7.c.iii */\n      if (mode == ARRAY_ROUTINE_EVERY && !to_boolean)\n      {\n        return ECMA_VALUE_FALSE;\n      }\n      else if (mode == ARRAY_ROUTINE_SOME && to_boolean)\n      {\n        return ECMA_VALUE_TRUE;\n      }\n    }\n  }\n\n  /* 8. */\n\n  if (mode == ARRAY_ROUTINE_EVERY)\n  {\n    return ECMA_VALUE_TRUE;\n  }\n  else if (mode == ARRAY_ROUTINE_SOME)\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  JERRY_ASSERT (mode == ARRAY_ROUTINE_FOREACH);\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_builtin_array_apply */\n\n/**\n * The Array.prototype object's 'map' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.19\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_map (ecma_value_t arg1, /**< callbackfn */\n                                         ecma_value_t arg2, /**< thisArg */\n                                         ecma_object_t *obj_p, /**< object */\n                                         ecma_length_t len) /**< object's length */\n{\n  /* 4. */\n  if (!ecma_op_is_callable (arg1))\n  {\n    return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);\n  }\n\n  /* 6. */\n  ecma_object_t *new_array_p = ecma_op_array_species_create (obj_p, len);\n\n  if (JERRY_UNLIKELY (new_array_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  JERRY_ASSERT (ecma_is_value_object (arg1));\n  ecma_object_t *func_object_p = ecma_get_object_from_value (arg1);\n\n  /* 7-8. */\n  ecma_value_t current_index;\n\n  for (ecma_length_t index = 0; index < len; index++)\n  {\n    /* 8.a - 8.b */\n    ecma_value_t current_value = ecma_op_object_find_by_index (obj_p, index);\n\n    if (ECMA_IS_VALUE_ERROR (current_value))\n    {\n      ecma_deref_object (new_array_p);\n      return current_value;\n    }\n\n    if (ecma_is_value_found (current_value))\n    {\n      /* 8.c.i, 8.c.ii */\n      current_index = ecma_make_length_value (index);\n      ecma_value_t call_args[] = { current_value, current_index, ecma_make_object_value (obj_p) };\n\n      ecma_value_t mapped_value = ecma_op_function_call (func_object_p, arg2, call_args, 3);\n\n      if (ECMA_IS_VALUE_ERROR (mapped_value))\n      {\n        ecma_free_value (current_value);\n        ecma_deref_object (new_array_p);\n        return mapped_value;\n      }\n\n      /* 8.c.iii */\n      ecma_value_t put_comp;\n      put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p,\n                                                        index,\n                                                        mapped_value,\n                                                        ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE\n                                                          | JERRY_PROP_SHOULD_THROW);\n\n      ecma_free_value (mapped_value);\n      ecma_free_value (current_value);\n\n      if (ECMA_IS_VALUE_ERROR (put_comp))\n      {\n        ecma_deref_object (new_array_p);\n        return put_comp;\n      }\n    }\n  }\n\n  return ecma_make_object_value (new_array_p);\n} /* ecma_builtin_array_prototype_object_map */\n\n/**\n * The Array.prototype object's 'filter' routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.20\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_filter (ecma_value_t arg1, /**< callbackfn */\n                                            ecma_value_t arg2, /**< thisArg */\n                                            ecma_object_t *obj_p, /**< object */\n                                            ecma_length_t len) /**< object's length */\n{\n  /* 4. */\n  if (!ecma_op_is_callable (arg1))\n  {\n    return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);\n  }\n\n  /* 6. */\n  ecma_object_t *new_array_p = ecma_op_array_species_create (obj_p, 0);\n\n  if (JERRY_UNLIKELY (new_array_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* ES11: 22.1.3.7. 7.c.iii.1 */\n  const uint32_t prop_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;\n\n  /* We already checked that arg1 is callable, so it will always be an object. */\n  JERRY_ASSERT (ecma_is_value_object (arg1));\n  ecma_object_t *func_object_p = ecma_get_object_from_value (arg1);\n\n  /* 8. */\n  ecma_length_t new_array_index = 0;\n  ecma_value_t current_index;\n\n  /* 9. */\n  for (ecma_length_t index = 0; index < len; index++)\n  {\n    /* 9.a - 9.c */\n    ecma_value_t get_value = ecma_op_object_find_by_index (obj_p, index);\n\n    if (ECMA_IS_VALUE_ERROR (get_value))\n    {\n      ecma_deref_object (new_array_p);\n      return get_value;\n    }\n\n    if (ecma_is_value_found (get_value))\n    {\n      /* 9.c.i */\n      current_index = ecma_make_length_value (index);\n\n      ecma_value_t call_args[] = { get_value, current_index, ecma_make_object_value (obj_p) };\n      /* 9.c.ii */\n      ecma_value_t call_value = ecma_op_function_call (func_object_p, arg2, call_args, 3);\n\n      if (ECMA_IS_VALUE_ERROR (call_value))\n      {\n        ecma_free_value (get_value);\n        ecma_deref_object (new_array_p);\n        return call_value;\n      }\n\n      /* 9.c.iii */\n      if (ecma_op_to_boolean (call_value))\n      {\n        ecma_value_t put_comp;\n        put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, new_array_index, get_value, prop_flags);\n\n        if (ECMA_IS_VALUE_ERROR (put_comp))\n        {\n          ecma_free_value (call_value);\n          ecma_free_value (get_value);\n          ecma_deref_object (new_array_p);\n\n          return put_comp;\n        }\n\n        new_array_index++;\n      }\n\n      ecma_free_value (call_value);\n      ecma_free_value (get_value);\n    }\n  }\n\n  return ecma_make_object_value (new_array_p);\n} /* ecma_builtin_array_prototype_object_filter */\n\n/**\n * The Array.prototype object's 'reduce' and 'reduceRight' routine\n *\n * See also:\n *         ECMA-262 v5, 15.4.4.21\n *         ECMA-262 v5, 15.4.4.22\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_reduce_from (const ecma_value_t args_p[], /**< routine's arguments */\n                                uint32_t args_number, /**< arguments list length */\n                                bool start_from_left, /**< whether the reduce starts from left or right */\n                                ecma_object_t *obj_p, /**< object */\n                                ecma_length_t len) /**< object's length */\n{\n  /* 4. */\n  if (!ecma_op_is_callable (args_p[0]))\n  {\n    return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);\n  }\n\n  /* 5. */\n  if (len == 0 && args_number == 1)\n  {\n    return ecma_raise_type_error (ECMA_ERR_REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE);\n  }\n\n  JERRY_ASSERT (ecma_is_value_object (args_p[0]));\n  ecma_object_t *func_object_p = ecma_get_object_from_value (args_p[0]);\n\n  ecma_value_t accumulator = ECMA_VALUE_UNDEFINED;\n\n  /* 6. */\n  ecma_length_t index = 0;\n  const ecma_length_t last_index = len - 1;\n\n  /* 7.a */\n  if (args_number > 1)\n  {\n    accumulator = ecma_copy_value (args_p[1]);\n  }\n  else\n  {\n    /* 8.a */\n    bool k_present = false;\n\n    /* 8.b */\n    while (!k_present && index < len)\n    {\n      /* 8.b.i */\n      k_present = true;\n\n      /* 8.b.ii-iii */\n      ecma_value_t current_value = ecma_op_object_find_by_index (obj_p, start_from_left ? index : last_index - index);\n\n      if (ECMA_IS_VALUE_ERROR (current_value))\n      {\n        return current_value;\n      }\n\n      if (ecma_is_value_found (current_value))\n      {\n        accumulator = current_value;\n      }\n      else\n      {\n        k_present = false;\n      }\n\n      /* 8.b.iv */\n      index++;\n    }\n\n    /* 8.c */\n    if (!k_present)\n    {\n      return ecma_raise_type_error (ECMA_ERR_MISSING_ARRAY_ELEMENT);\n    }\n  }\n  /* 9. */\n  ecma_value_t current_index;\n\n  for (; index < len; index++)\n  {\n    const ecma_length_t corrected_index = start_from_left ? index : last_index - index;\n\n    /* 9.a - 9.b */\n    ecma_value_t current_value = ecma_op_object_find_by_index (obj_p, corrected_index);\n\n    if (ECMA_IS_VALUE_ERROR (current_value))\n    {\n      ecma_free_value (accumulator);\n      return current_value;\n    }\n\n    if (ecma_is_value_found (current_value))\n    {\n      /* 9.c.i, 9.c.ii */\n      current_index = ecma_make_length_value (corrected_index);\n      ecma_value_t call_args[] = { accumulator, current_value, current_index, ecma_make_object_value (obj_p) };\n\n      ecma_value_t call_value = ecma_op_function_call (func_object_p, ECMA_VALUE_UNDEFINED, call_args, 4);\n      ecma_free_value (current_index);\n      ecma_free_value (accumulator);\n      ecma_free_value (current_value);\n\n      if (ECMA_IS_VALUE_ERROR (call_value))\n      {\n        return call_value;\n      }\n\n      accumulator = call_value;\n    }\n  }\n\n  return accumulator;\n} /* ecma_builtin_array_reduce_from */\n\n/**\n * The Array.prototype object's 'fill' routine\n *\n * Note: this method only supports length up to uint32, instead of max_safe_integer\n *\n * See also:\n *          ECMA-262 v6, 22.1.3.6\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_fill (ecma_value_t value, /**< value */\n                                   ecma_value_t start_val, /**< start value */\n                                   ecma_value_t end_val, /**< end value */\n                                   ecma_object_t *obj_p, /**< object */\n                                   ecma_length_t len) /**< object's length */\n{\n  ecma_length_t k, final;\n\n  /* 5. 6. 7. */\n  if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (start_val, len, &k)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 8. */\n  if (ecma_is_value_undefined (end_val))\n  {\n    final = len;\n  }\n  else\n  {\n    /* 8 part 2, 9, 10 */\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (end_val, len, &final)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n    if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE)\n    {\n      if (JERRY_UNLIKELY (obj_p->u1.property_list_cp == JMEM_CP_NULL))\n      {\n        ecma_ref_object (obj_p);\n        return ecma_make_object_value (obj_p);\n      }\n\n      ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);\n\n      while (k < final)\n      {\n        ecma_free_value_if_not_object (buffer_p[k]);\n        buffer_p[k] = ecma_copy_value_if_not_object (value);\n        k++;\n      }\n\n      ecma_ref_object (obj_p);\n      return ecma_make_object_value (obj_p);\n    }\n  }\n\n  /* 11. */\n  while (k < final)\n  {\n    /* 11.a - 11.b */\n    ecma_value_t put_val = ecma_op_object_put_by_index (obj_p, k, value, true);\n\n    /* 11. c */\n    if (ECMA_IS_VALUE_ERROR (put_val))\n    {\n      return put_val;\n    }\n\n    /* 11.d */\n    k++;\n  }\n\n  ecma_ref_object (obj_p);\n  return ecma_make_object_value (obj_p);\n} /* ecma_builtin_array_prototype_fill */\n\n/**\n * The Array.prototype object's 'find' and 'findIndex' routine\n *\n * See also:\n *          ECMA-262 v6, 22.1.3.8\n *          ECMA-262 v6, 22.1.3.9\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_find (ecma_value_t predicate, /**< callback function */\n                                          ecma_value_t predicate_this_arg, /**< this argument for\n                                                                            *   invoke predicate */\n                                          bool is_find, /**< true - find routine\n                                                         *   false - findIndex routine */\n                                          ecma_object_t *obj_p, /**< object */\n                                          ecma_length_t len) /**< object's length */\n{\n  /* 5. */\n  if (!ecma_op_is_callable (predicate))\n  {\n    return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);\n  }\n\n  /* We already checked that predicate is callable, so it will always be an object. */\n  JERRY_ASSERT (ecma_is_value_object (predicate));\n  ecma_object_t *func_object_p = ecma_get_object_from_value (predicate);\n\n  /* 7 - 8. */\n  for (ecma_length_t index = 0; index < len; index++)\n  {\n    /* 8.a - 8.c */\n    ecma_value_t get_value = ecma_op_object_get_by_index (obj_p, index);\n\n    if (ECMA_IS_VALUE_ERROR (get_value))\n    {\n      return get_value;\n    }\n\n    /* 8.d - 8.e */\n    ecma_value_t current_index = ecma_make_length_value (index);\n\n    ecma_value_t call_args[] = { get_value, current_index, ecma_make_object_value (obj_p) };\n\n    ecma_value_t call_value = ecma_op_function_call (func_object_p, predicate_this_arg, call_args, 3);\n\n    if (ECMA_IS_VALUE_ERROR (call_value))\n    {\n      ecma_free_value (get_value);\n      return call_value;\n    }\n\n    bool call_value_to_bool = ecma_op_to_boolean (call_value);\n\n    ecma_free_value (call_value);\n\n    if (call_value_to_bool)\n    {\n      /* 8.f */\n      if (is_find)\n      {\n        ecma_free_value (current_index);\n        return get_value;\n      }\n\n      ecma_free_value (get_value);\n      return current_index;\n    }\n\n    ecma_free_value (get_value);\n    ecma_free_value (current_index);\n  }\n\n  /* 9. */\n  return is_find ? ECMA_VALUE_UNDEFINED : ecma_make_integer_value (-1);\n} /* ecma_builtin_array_prototype_object_find */\n\n/**\n * The Array.prototype object's 'copyWithin' routine\n *\n * See also:\n *          ECMA-262 v6, 22.1.3.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_copy_within (const ecma_value_t args[], /**< arguments list */\n                                                 uint32_t args_number, /**< number of arguments */\n                                                 ecma_object_t *obj_p, /**< object */\n                                                 ecma_length_t len) /**< object's length */\n{\n  if (args_number == 0)\n  {\n    return ecma_copy_value (ecma_make_object_value (obj_p));\n  }\n\n  /* 5 - 7 */\n  ecma_length_t target;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (args[0], len, &target)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_length_t start = 0;\n  ecma_length_t end = len;\n\n  if (args_number > 1)\n  {\n    /* 8 - 10 */\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (args[1], len, &start)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    if (args_number > 2)\n    {\n      /* 11 */\n      if (ecma_is_value_undefined (args[2]))\n      {\n        end = len;\n      }\n      else\n      {\n        /* 11 part 2, 12, 13 */\n        if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (args[2], len, &end)))\n        {\n          return ECMA_VALUE_ERROR;\n        }\n      }\n    }\n  }\n\n  ecma_length_t count = JERRY_MIN (end - start, len - target);\n  if (end <= start || len <= target) /* count <= 0 check, but variables are unsigned */\n  {\n    ecma_ref_object (obj_p);\n    return ecma_make_object_value (obj_p);\n  }\n\n  bool forward = true;\n\n  if (start < target && target < start + count)\n  {\n    start = start + count - 1;\n    target = target + count - 1;\n    forward = false;\n  }\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n    const uint32_t actual_length = ext_obj_p->u.array.length;\n\n    if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE\n        && ((forward && (target + count - 1 < actual_length)) || (!forward && (target < actual_length))))\n    {\n      if (obj_p->u1.property_list_cp != JMEM_CP_NULL)\n      {\n        ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);\n\n        for (; count > 0; count--)\n        {\n          ecma_value_t copy_value = ecma_copy_value_if_not_object (buffer_p[start]);\n\n          ecma_free_value_if_not_object (buffer_p[target]);\n\n          buffer_p[target] = copy_value;\n\n          if (forward)\n          {\n            start++;\n            target++;\n          }\n          else\n          {\n            start--;\n            target--;\n          }\n        }\n      }\n\n      ecma_ref_object (obj_p);\n      return ecma_make_object_value (obj_p);\n    }\n  }\n\n  while (count > 0)\n  {\n    ecma_value_t get_value = ecma_op_object_find_by_index (obj_p, start);\n\n    if (ECMA_IS_VALUE_ERROR (get_value))\n    {\n      return get_value;\n    }\n\n    ecma_value_t op_value;\n\n    if (ecma_is_value_found (get_value))\n    {\n      op_value = ecma_op_object_put_by_index (obj_p, target, get_value, true);\n    }\n    else\n    {\n      op_value = ecma_op_object_delete_by_index (obj_p, target, true);\n    }\n\n    ecma_free_value (get_value);\n\n    if (ECMA_IS_VALUE_ERROR (op_value))\n    {\n      return op_value;\n    }\n\n    ecma_free_value (op_value);\n\n    if (forward)\n    {\n      start++;\n      target++;\n    }\n    else\n    {\n      start--;\n      target--;\n    }\n\n    count--;\n  }\n\n  return ecma_copy_value (ecma_make_object_value (obj_p));\n} /* ecma_builtin_array_prototype_object_copy_within */\n\n/**\n * The Array.prototype object's 'includes' routine\n *\n * See also:\n *          ECMA-262 v11, 22.1.3.13\n *\n * @return ECMA_VALUE_ERROR -if the operation fails\n *         ECMA_VALUE_{TRUE/FALSE} - depends on whether the search element is in the array or not\n */\nstatic ecma_value_t\necma_builtin_array_prototype_includes (const ecma_value_t args[], /**< arguments list */\n                                       uint32_t args_number, /**< number of arguments */\n                                       ecma_object_t *obj_p, /**< object */\n                                       ecma_length_t len) /**< object's length */\n{\n  /* 3. */\n  if (len == 0)\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_length_t from_index = 0;\n\n  /* 4-7. */\n  if (args_number > 1)\n  {\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (args[1], len, &from_index)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  /* Fast array path */\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n    if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE)\n    {\n      if (obj_p->u1.property_list_cp != JMEM_CP_NULL)\n      {\n        len = JERRY_MIN (ext_obj_p->u.array.length, len);\n\n        ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);\n\n        while (from_index < len)\n        {\n          if (ecma_op_same_value_zero (buffer_p[from_index], args[0], false))\n          {\n            return ECMA_VALUE_TRUE;\n          }\n\n          from_index++;\n        }\n      }\n\n      return ECMA_VALUE_FALSE;\n    }\n  }\n\n  /* 8. */\n  while (from_index < len)\n  {\n    ecma_value_t element = ecma_op_object_get_by_index (obj_p, from_index);\n\n    if (ECMA_IS_VALUE_ERROR (element))\n    {\n      return element;\n    }\n\n    if (ecma_op_same_value_zero (element, args[0], false))\n    {\n      ecma_free_value (element);\n      return ECMA_VALUE_TRUE;\n    }\n\n    ecma_free_value (element);\n    from_index++;\n  }\n\n  /* 9. */\n  return ECMA_VALUE_FALSE;\n} /* ecma_builtin_array_prototype_includes */\n\n/**\n * Abstract operation: FlattenIntoArray\n *\n * See also:\n *          ECMA-262 v10, 22.1.3.10.1\n *\n * @return  ECMA_VALUE_ERROR -if the operation fails\n *          ecma value which contains target_index\n */\nstatic ecma_value_t\necma_builtin_array_flatten_into_array (ecma_value_t target, /**< target will contains source's elements  */\n                                       ecma_object_t *source, /**< source object */\n                                       ecma_length_t source_len, /**< source object length */\n                                       ecma_length_t start, /**< remaining recursion depth */\n                                       ecma_number_t depth, /**< start index offset */\n                                       ecma_value_t mapped_value, /**< mapped value  */\n                                       ecma_value_t thisArg) /**< this arg */\n{\n  ECMA_CHECK_STACK_USAGE ();\n\n  /* 7. */\n  ecma_length_t target_index = start;\n\n  /* 9. */\n  for (ecma_length_t source_index = 0; source_index < source_len; source_index++)\n  {\n    /* a. */\n    ecma_value_t element = ecma_op_object_find_by_index (source, source_index);\n\n    if (ECMA_IS_VALUE_ERROR (element))\n    {\n      return element;\n    }\n\n    if (!ecma_is_value_found (element))\n    {\n      continue;\n    }\n\n    /* b-c. */\n    if (!ecma_is_value_undefined (mapped_value))\n    {\n      /* i-ii. */\n      ecma_value_t source_val = ecma_make_length_value (source_index);\n      ecma_value_t args[] = { element, source_val, ecma_make_object_value (source) };\n      ecma_value_t temp_element = ecma_op_function_call (ecma_get_object_from_value (mapped_value), thisArg, args, 3);\n\n      ecma_free_value (element);\n      ecma_free_value (source_val);\n\n      if (ECMA_IS_VALUE_ERROR (temp_element))\n      {\n        return temp_element;\n      }\n\n      element = temp_element;\n    }\n\n    /* iv-v. */\n    if (depth > 0)\n    {\n      ecma_value_t is_array = ecma_is_value_array (element);\n\n      if (ECMA_IS_VALUE_ERROR (is_array))\n      {\n        ecma_free_value (element);\n        return is_array;\n      }\n\n      if (ecma_is_value_true (is_array))\n      {\n        ecma_object_t *element_obj = ecma_get_object_from_value (element);\n        ecma_length_t element_len;\n        ecma_value_t len_value = ecma_op_object_get_length (element_obj, &element_len);\n\n        if (ECMA_IS_VALUE_ERROR (len_value))\n        {\n          ecma_deref_object (element_obj);\n          return len_value;\n        }\n\n        ecma_value_t target_index_val = ecma_builtin_array_flatten_into_array (target,\n                                                                               element_obj,\n                                                                               element_len,\n                                                                               target_index,\n                                                                               depth - 1,\n                                                                               ECMA_VALUE_UNDEFINED,\n                                                                               ECMA_VALUE_UNDEFINED);\n\n        ecma_deref_object (element_obj);\n\n        if (ECMA_IS_VALUE_ERROR (target_index_val))\n        {\n          return target_index_val;\n        }\n\n        target_index = (ecma_length_t) ecma_get_number_from_value (target_index_val);\n        continue;\n      }\n    }\n\n    /* vi. */\n    const uint32_t flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;\n    ecma_value_t element_temp =\n      ecma_builtin_helper_def_prop_by_index (ecma_get_object_from_value (target), target_index, element, flags);\n\n    ecma_free_value (element);\n\n    if (ECMA_IS_VALUE_ERROR (element_temp))\n    {\n      return element_temp;\n    }\n\n    target_index++;\n  }\n  /* 10. */\n  return ecma_make_length_value (target_index);\n} /* ecma_builtin_array_flatten_into_array */\n\n/**\n * The Array.prototype object's 'flat' routine\n *\n * See also:\n *          ECMA-262 v10, 22.1.3.10\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_flat (const ecma_value_t args[], /**< arguments list */\n                                          uint32_t args_number, /**< number of arguments */\n                                          ecma_object_t *obj_p, /**< array object */\n                                          ecma_length_t len) /**< array object's length */\n{\n  /* 3. */\n  ecma_number_t depth_num = 1;\n\n  /* 4. */\n  if (args_number > 0 && ECMA_IS_VALUE_ERROR (ecma_op_to_integer (args[0], &depth_num)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 5. */\n  ecma_object_t *new_array_p = ecma_op_array_species_create (obj_p, 0);\n\n  if (JERRY_UNLIKELY (new_array_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 6. */\n  ecma_value_t flatten_val = ecma_builtin_array_flatten_into_array (ecma_make_object_value (new_array_p),\n                                                                    obj_p,\n                                                                    len,\n                                                                    0,\n                                                                    depth_num,\n                                                                    ECMA_VALUE_UNDEFINED,\n                                                                    ECMA_VALUE_UNDEFINED);\n\n  if (ECMA_IS_VALUE_ERROR (flatten_val))\n  {\n    ecma_deref_object (new_array_p);\n    return flatten_val;\n  }\n\n  /* 7. */\n  return ecma_make_object_value (new_array_p);\n} /* ecma_builtin_array_prototype_object_flat */\n\n/**\n * The Array.prototype object's 'flatMap' routine\n *\n * See also:\n *          ECMA-262 v10, 22.1.3.11\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_prototype_object_flat_map (ecma_value_t callback, /**< callbackFn */\n                                              ecma_value_t this_arg, /**< thisArg */\n                                              ecma_object_t *obj_p, /**< array object */\n                                              ecma_length_t len) /**< array object's length */\n{\n  if (!ecma_op_is_callable (callback))\n  {\n    return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);\n  }\n\n  /* 4. */\n  ecma_object_t *new_array_p = ecma_op_array_species_create (obj_p, 0);\n\n  if (JERRY_UNLIKELY (new_array_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 5. */\n  ecma_value_t flatten_val =\n    ecma_builtin_array_flatten_into_array (ecma_make_object_value (new_array_p), obj_p, len, 0, 1, callback, this_arg);\n  if (ECMA_IS_VALUE_ERROR (flatten_val))\n  {\n    ecma_deref_object (new_array_p);\n    return flatten_val;\n  }\n\n  /* 6. */\n  return ecma_make_object_value (new_array_p);\n} /* ecma_builtin_array_prototype_object_flat_map */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                               ecma_value_t this_arg, /**< 'this' argument value */\n                                               const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                       *   passed to routine */\n                                               uint32_t arguments_number) /**< length of arguments' list */\n{\n  ecma_value_t obj_this = ecma_op_to_object (this_arg);\n\n  if (ECMA_IS_VALUE_ERROR (obj_this))\n  {\n    return obj_this;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (obj_this);\n\n  if (JERRY_UNLIKELY (builtin_routine_id <= ECMA_ARRAY_PROTOTYPE_CONCAT))\n  {\n    ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n    if (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_SORT)\n    {\n      ret_value = ecma_builtin_array_prototype_object_sort (this_arg, arguments_list_p[0], obj_p);\n    }\n    else if (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_CONCAT)\n    {\n      ret_value = ecma_builtin_array_prototype_object_concat (arguments_list_p, arguments_number, obj_p);\n    }\n\n    ecma_deref_object (obj_p);\n    return ret_value;\n  }\n\n  if (JERRY_UNLIKELY (builtin_routine_id >= ECMA_ARRAY_PROTOTYPE_ENTRIES\n                      && builtin_routine_id <= ECMA_ARRAY_PROTOTYPE_KEYS))\n  {\n    ecma_value_t ret_value;\n\n    if (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_ENTRIES)\n    {\n      ret_value = ecma_op_create_array_iterator (obj_p, ECMA_ITERATOR_ENTRIES);\n    }\n    else\n    {\n      JERRY_ASSERT (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_KEYS);\n      ret_value = ecma_op_create_array_iterator (obj_p, ECMA_ITERATOR_KEYS);\n    }\n\n    ecma_deref_object (obj_p);\n    return ret_value;\n  }\n\n  ecma_length_t length;\n  ecma_value_t len_value = ecma_op_object_get_length (obj_p, &length);\n\n  if (ECMA_IS_VALUE_ERROR (len_value))\n  {\n    ecma_deref_object (obj_p);\n    return len_value;\n  }\n\n  ecma_value_t ret_value;\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_ARRAY_PROTOTYPE_TO_LOCALE_STRING:\n    {\n      ret_value = ecma_builtin_array_prototype_object_to_locale_string (obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_JOIN:\n    {\n      ret_value = ecma_builtin_array_prototype_join (arguments_list_p[0], obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_POP:\n    {\n      ret_value = ecma_builtin_array_prototype_object_pop (obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_PUSH:\n    {\n      ret_value = ecma_builtin_array_prototype_object_push (arguments_list_p, arguments_number, obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_REVERSE:\n    {\n      ret_value = ecma_builtin_array_prototype_object_reverse (this_arg, obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_SHIFT:\n    {\n      ret_value = ecma_builtin_array_prototype_object_shift (obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_SLICE:\n    {\n      ret_value = ecma_builtin_array_prototype_object_slice (arguments_list_p[0], arguments_list_p[1], obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_SPLICE:\n    {\n      ret_value = ecma_builtin_array_prototype_object_splice (arguments_list_p, arguments_number, obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_UNSHIFT:\n    {\n      ret_value = ecma_builtin_array_prototype_object_unshift (arguments_list_p, arguments_number, obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_AT:\n    {\n      ret_value = ecma_builtin_array_prototype_object_at (arguments_list_p[0], obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_INDEX_OF:\n    {\n      ret_value = ecma_builtin_array_prototype_object_index_of (arguments_list_p, arguments_number, obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_LAST_INDEX_OF:\n    {\n      ret_value = ecma_builtin_array_prototype_object_last_index_of (arguments_list_p, arguments_number, obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_EVERY:\n    case ECMA_ARRAY_PROTOTYPE_SOME:\n    case ECMA_ARRAY_PROTOTYPE_FOR_EACH:\n    {\n      ret_value = ecma_builtin_array_apply (arguments_list_p[0],\n                                            arguments_list_p[1],\n                                            (array_routine_mode) builtin_routine_id - ECMA_ARRAY_PROTOTYPE_EVERY,\n                                            obj_p,\n                                            length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_MAP:\n    {\n      ret_value = ecma_builtin_array_prototype_object_map (arguments_list_p[0], arguments_list_p[1], obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_REDUCE:\n    case ECMA_ARRAY_PROTOTYPE_REDUCE_RIGHT:\n    {\n      ret_value = ecma_builtin_array_reduce_from (arguments_list_p,\n                                                  arguments_number,\n                                                  builtin_routine_id == ECMA_ARRAY_PROTOTYPE_REDUCE,\n                                                  obj_p,\n                                                  length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_COPY_WITHIN:\n    {\n      ret_value = ecma_builtin_array_prototype_object_copy_within (arguments_list_p, arguments_number, obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_FIND:\n    case ECMA_ARRAY_PROTOTYPE_FIND_INDEX:\n    {\n      ret_value = ecma_builtin_array_prototype_object_find (arguments_list_p[0],\n                                                            arguments_list_p[1],\n                                                            builtin_routine_id == ECMA_ARRAY_PROTOTYPE_FIND,\n                                                            obj_p,\n                                                            length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_FILL:\n    {\n      ret_value = ecma_builtin_array_prototype_fill (arguments_list_p[0],\n                                                     arguments_list_p[1],\n                                                     arguments_list_p[2],\n                                                     obj_p,\n                                                     length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_INCLUDES:\n    {\n      ret_value = ecma_builtin_array_prototype_includes (arguments_list_p, arguments_number, obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_FLAT:\n    {\n      ret_value = ecma_builtin_array_prototype_object_flat (arguments_list_p, arguments_number, obj_p, length);\n      break;\n    }\n    case ECMA_ARRAY_PROTOTYPE_FLATMAP:\n    {\n      ret_value =\n        ecma_builtin_array_prototype_object_flat_map (arguments_list_p[0], arguments_list_p[1], obj_p, length);\n      break;\n    }\n    default:\n    {\n      JERRY_ASSERT (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_FILTER);\n\n      ret_value = ecma_builtin_array_prototype_object_filter (arguments_list_p[0], arguments_list_p[1], obj_p, length);\n      break;\n    }\n  }\n\n  ecma_free_value (len_value);\n  ecma_deref_object (obj_p);\n\n  return ret_value;\n} /* ecma_builtin_array_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_ARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Array.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ARRAY\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.4.4.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 22.1.3.31 */\nOBJECT_VALUE (LIT_GLOBAL_SYMBOL_UNSCOPABLES,\n              ECMA_BUILTIN_ID_ARRAY_PROTOTYPE_UNSCOPABLES,\n              ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Number properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.4.4 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_WRITABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_ARRAY_PROTOTYPE_TO_LOCALE_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_CONCAT, ECMA_ARRAY_PROTOTYPE_CONCAT, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_JOIN, ECMA_ARRAY_PROTOTYPE_JOIN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_POP, ECMA_ARRAY_PROTOTYPE_POP, 0, 0)\nROUTINE (LIT_MAGIC_STRING_PUSH, ECMA_ARRAY_PROTOTYPE_PUSH, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_REVERSE, ECMA_ARRAY_PROTOTYPE_REVERSE, 0, 0)\nROUTINE (LIT_MAGIC_STRING_SHIFT, ECMA_ARRAY_PROTOTYPE_SHIFT, 0, 0)\nROUTINE (LIT_MAGIC_STRING_SLICE, ECMA_ARRAY_PROTOTYPE_SLICE, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SORT, ECMA_ARRAY_PROTOTYPE_SORT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_AT, ECMA_ARRAY_PROTOTYPE_AT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SPLICE, ECMA_ARRAY_PROTOTYPE_SPLICE, NON_FIXED, 2)\nROUTINE (LIT_MAGIC_STRING_UNSHIFT, ECMA_ARRAY_PROTOTYPE_UNSHIFT, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_INDEX_OF_UL, ECMA_ARRAY_PROTOTYPE_INDEX_OF, 2, 1)\nROUTINE (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, ECMA_ARRAY_PROTOTYPE_LAST_INDEX_OF, NON_FIXED, 1)\n/* Note these 3 routines must be in this order */\nROUTINE (LIT_MAGIC_STRING_EVERY, ECMA_ARRAY_PROTOTYPE_EVERY, 2, 1)\nROUTINE (LIT_MAGIC_STRING_SOME, ECMA_ARRAY_PROTOTYPE_SOME, 2, 1)\nROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_ARRAY_PROTOTYPE_FOR_EACH, 2, 1)\nROUTINE (LIT_MAGIC_STRING_MAP, ECMA_ARRAY_PROTOTYPE_MAP, 2, 1)\nROUTINE (LIT_MAGIC_STRING_FILTER, ECMA_ARRAY_PROTOTYPE_FILTER, 2, 1)\n/* Note these 2 routines must be in this order */\nROUTINE (LIT_MAGIC_STRING_REDUCE, ECMA_ARRAY_PROTOTYPE_REDUCE, 2, 1)\nROUTINE (LIT_MAGIC_STRING_REDUCE_RIGHT_UL, ECMA_ARRAY_PROTOTYPE_REDUCE_RIGHT, 2, 1)\nROUTINE (LIT_MAGIC_STRING_FIND, ECMA_ARRAY_PROTOTYPE_FIND, 2, 1)\nROUTINE (LIT_MAGIC_STRING_FIND_INDEX, ECMA_ARRAY_PROTOTYPE_FIND_INDEX, 2, 1)\nROUTINE (LIT_MAGIC_STRING_FILL, ECMA_ARRAY_PROTOTYPE_FILL, 3, 1)\nROUTINE (LIT_MAGIC_STRING_COPY_WITHIN, ECMA_ARRAY_PROTOTYPE_COPY_WITHIN, NON_FIXED, 2)\nROUTINE (LIT_MAGIC_STRING_ENTRIES, ECMA_ARRAY_PROTOTYPE_ENTRIES, 0, 0)\nROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_ARRAY_PROTOTYPE_KEYS, 0, 0)\nROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_ARRAY_PROTOTYPE_INCLUDES, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_FLAT, ECMA_ARRAY_PROTOTYPE_FLAT, 1, 0)\nROUTINE (LIT_MAGIC_STRING_FLATMAP, ECMA_ARRAY_PROTOTYPE_FLATMAP, 2, 1)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES,\n                    LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,\n                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR,\n                    LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,\n                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#endif /* JERRY_BUILTIN_ARRAY */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-array.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_ARRAY_ROUTINE_START = 0,\n  ECMA_ARRAY_ROUTINE_IS_ARRAY,\n  ECMA_ARRAY_ROUTINE_FROM,\n  ECMA_ARRAY_ROUTINE_OF,\n  ECMA_ARRAY_ROUTINE_SPECIES_GET\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-array.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  array\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup array ECMA Array object built-in\n * @{\n */\n\n/**\n * The Array object's 'from' routine\n *\n * See also:\n *          ECMA-262 v6, 22.1.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */\n                                const ecma_value_t *arguments_list_p, /**< arguments list */\n                                uint32_t arguments_list_len) /**< number of arguments */\n{\n  /* 1. */\n  ecma_value_t constructor = this_arg;\n  ecma_value_t call_this_arg = ECMA_VALUE_UNDEFINED;\n  ecma_value_t items = arguments_list_p[0];\n  ecma_value_t mapfn = (arguments_list_len > 1) ? arguments_list_p[1] : ECMA_VALUE_UNDEFINED;\n\n  /* 2. */\n  ecma_object_t *mapfn_obj_p = NULL;\n\n  /* 3. */\n  if (!ecma_is_value_undefined (mapfn))\n  {\n    /* 3.a */\n    if (!ecma_op_is_callable (mapfn))\n    {\n      return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);\n    }\n\n    /* 3.b */\n    if (arguments_list_len > 2)\n    {\n      call_this_arg = arguments_list_p[2];\n    }\n\n    /* 3.c */\n    mapfn_obj_p = ecma_get_object_from_value (mapfn);\n  }\n\n  /* 4. */\n  ecma_value_t using_iterator = ecma_op_get_method_by_symbol_id (items, LIT_GLOBAL_SYMBOL_ITERATOR);\n\n  /* 5. */\n  if (ECMA_IS_VALUE_ERROR (using_iterator))\n  {\n    return using_iterator;\n  }\n\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n\n  /* 6. */\n  if (!ecma_is_value_undefined (using_iterator))\n  {\n    ecma_object_t *array_obj_p;\n\n    /* 6.a */\n    if (ecma_is_constructor (constructor))\n    {\n      ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor);\n\n      ecma_value_t array = ecma_op_function_construct (constructor_obj_p, constructor_obj_p, NULL, 0);\n\n      if (ecma_is_value_undefined (array) || ecma_is_value_null (array))\n      {\n        ecma_free_value (using_iterator);\n        return ecma_raise_type_error (ECMA_ERR_CANNOT_CONVERT_TO_OBJECT);\n      }\n\n      /* 6.c */\n      if (ECMA_IS_VALUE_ERROR (array))\n      {\n        ecma_free_value (using_iterator);\n        return array;\n      }\n\n      array_obj_p = ecma_get_object_from_value (array);\n    }\n    else\n    {\n      /* 6.b */\n      array_obj_p = ecma_op_new_array_object (0);\n    }\n\n    /* 6.d */\n    ecma_value_t next_method;\n    ecma_value_t iterator = ecma_op_get_iterator (items, using_iterator, &next_method);\n    ecma_free_value (using_iterator);\n\n    /* 6.e */\n    if (ECMA_IS_VALUE_ERROR (iterator))\n    {\n      ecma_deref_object (array_obj_p);\n      return iterator;\n    }\n\n    /* 6.f */\n    uint32_t k = 0;\n\n    /* 6.g */\n    while (true)\n    {\n      /* 6.g.ii */\n      ecma_value_t next = ecma_op_iterator_step (iterator, next_method);\n\n      /* 6.g.iii */\n      if (ECMA_IS_VALUE_ERROR (next))\n      {\n        goto iterator_cleanup;\n      }\n\n      /* 6.g.iii */\n      if (ecma_is_value_false (next))\n      {\n        /* 6.g.iv.1 */\n        ecma_value_t len_value = ecma_make_uint32_value (k);\n        ecma_value_t set_status =\n          ecma_op_object_put (array_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len_value, true);\n        ecma_free_value (len_value);\n\n        /* 6.g.iv.2 */\n        if (ECMA_IS_VALUE_ERROR (set_status))\n        {\n          goto iterator_cleanup;\n        }\n\n        ecma_free_value (iterator);\n        ecma_free_value (next_method);\n        /* 6.g.iv.3 */\n        return ecma_make_object_value (array_obj_p);\n      }\n\n      /* 6.g.v */\n      ecma_value_t next_value = ecma_op_iterator_value (next);\n\n      ecma_free_value (next);\n\n      /* 6.g.vi */\n      if (ECMA_IS_VALUE_ERROR (next_value))\n      {\n        goto iterator_cleanup;\n      }\n\n      ecma_value_t mapped_value;\n      /* 6.g.vii */\n      if (mapfn_obj_p != NULL)\n      {\n        /* 6.g.vii.1 */\n        ecma_value_t args_p[2] = { next_value, ecma_make_uint32_value (k) };\n        /* 6.g.vii.3 */\n        mapped_value = ecma_op_function_call (mapfn_obj_p, call_this_arg, args_p, 2);\n        ecma_free_value (args_p[1]);\n        ecma_free_value (next_value);\n\n        /* 6.g.vii.2 */\n        if (ECMA_IS_VALUE_ERROR (mapped_value))\n        {\n          ecma_op_iterator_close (iterator);\n          goto iterator_cleanup;\n        }\n      }\n      else\n      {\n        /* 6.g.viii */\n        mapped_value = next_value;\n      }\n\n      /* 6.g.ix */\n      const uint32_t flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;\n      ecma_value_t set_status = ecma_builtin_helper_def_prop_by_index (array_obj_p, k, mapped_value, flags);\n\n      ecma_free_value (mapped_value);\n\n      /* 6.g.x */\n      if (ECMA_IS_VALUE_ERROR (set_status))\n      {\n        ecma_op_iterator_close (iterator);\n        goto iterator_cleanup;\n      }\n\n      /* 6.g.xi */\n      k++;\n    }\n\niterator_cleanup:\n    ecma_free_value (iterator);\n    ecma_free_value (next_method);\n    ecma_deref_object (array_obj_p);\n\n    return ret_value;\n  }\n\n  /* 8. */\n  ecma_value_t array_like = ecma_op_to_object (items);\n\n  /* 9. */\n  if (ECMA_IS_VALUE_ERROR (array_like))\n  {\n    return array_like;\n  }\n\n  ecma_object_t *array_like_obj_p = ecma_get_object_from_value (array_like);\n\n  /* 10. */\n  ecma_length_t len;\n  ecma_value_t len_value = ecma_op_object_get_length (array_like_obj_p, &len);\n\n  /* 11. */\n  if (ECMA_IS_VALUE_ERROR (len_value))\n  {\n    goto cleanup;\n  }\n\n  /* 12. */\n  ecma_object_t *array_obj_p;\n\n  /* 12.a */\n  if (ecma_is_constructor (constructor))\n  {\n    ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor);\n\n    len_value = ecma_make_length_value (len);\n    ecma_value_t array = ecma_op_function_construct (constructor_obj_p, constructor_obj_p, &len_value, 1);\n    ecma_free_value (len_value);\n\n    if (ecma_is_value_undefined (array) || ecma_is_value_null (array))\n    {\n      ecma_raise_type_error (ECMA_ERR_CANNOT_CONVERT_TO_OBJECT);\n      goto cleanup;\n    }\n\n    /* 14. */\n    if (ECMA_IS_VALUE_ERROR (array))\n    {\n      goto cleanup;\n    }\n\n    array_obj_p = ecma_get_object_from_value (array);\n  }\n  else\n  {\n    /* 13.a */\n    array_obj_p = ecma_op_new_array_object_from_length (len);\n\n    if (JERRY_UNLIKELY (array_obj_p == NULL))\n    {\n      goto cleanup;\n    }\n  }\n\n  /* 15. */\n  ecma_length_t k = 0;\n\n  /* 16. */\n  while (k < len)\n  {\n    /* 16.b */\n    ecma_value_t k_value = ecma_op_object_get_by_index (array_like_obj_p, k);\n\n    /* 16.c */\n    if (ECMA_IS_VALUE_ERROR (k_value))\n    {\n      goto construct_cleanup;\n    }\n\n    ecma_value_t mapped_value;\n    /* 16.d */\n    if (mapfn_obj_p != NULL)\n    {\n      /* 16.d.i */\n      ecma_value_t args_p[2] = { k_value, ecma_make_length_value (k) };\n      mapped_value = ecma_op_function_call (mapfn_obj_p, call_this_arg, args_p, 2);\n      ecma_free_value (args_p[1]);\n      ecma_free_value (k_value);\n\n      /* 16.d.ii */\n      if (ECMA_IS_VALUE_ERROR (mapped_value))\n      {\n        goto construct_cleanup;\n      }\n    }\n    else\n    {\n      /* 16.e */\n      mapped_value = k_value;\n    }\n\n    /* 16.f */\n    const uint32_t flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;\n    ecma_value_t set_status = ecma_builtin_helper_def_prop_by_index (array_obj_p, k, mapped_value, flags);\n\n    ecma_free_value (mapped_value);\n\n    /* 16.g */\n    if (ECMA_IS_VALUE_ERROR (set_status))\n    {\n      goto construct_cleanup;\n    }\n\n    /* 16.h */\n    k++;\n  }\n\n  /* 17. */\n  len_value = ecma_make_length_value (k);\n  ecma_value_t set_status =\n    ecma_op_object_put (array_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len_value, true);\n  ecma_free_value (len_value);\n\n  /* 18. */\n  if (ECMA_IS_VALUE_ERROR (set_status))\n  {\n    goto construct_cleanup;\n  }\n\n  /* 19. */\n  ecma_deref_object (array_like_obj_p);\n  return ecma_make_object_value (array_obj_p);\n\nconstruct_cleanup:\n  ecma_deref_object (array_obj_p);\ncleanup:\n  ecma_deref_object (array_like_obj_p);\n  return ret_value;\n} /* ecma_builtin_array_object_from */\n\n/**\n * The Array object's 'of' routine\n *\n * See also:\n *          ECMA-262 v6, 22.1.2.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_array_object_of (ecma_value_t this_arg, /**< 'this' argument */\n                              const ecma_value_t *arguments_list_p, /**< arguments list */\n                              uint32_t arguments_list_len) /**< number of arguments */\n{\n  if (!ecma_is_constructor (this_arg))\n  {\n    return ecma_op_new_array_object_from_buffer (arguments_list_p, arguments_list_len);\n  }\n\n  ecma_value_t len = ecma_make_uint32_value (arguments_list_len);\n\n  ecma_value_t ret_val =\n    ecma_op_function_construct (ecma_get_object_from_value (this_arg), ecma_get_object_from_value (this_arg), &len, 1);\n\n  if (ECMA_IS_VALUE_ERROR (ret_val))\n  {\n    ecma_free_value (len);\n    return ret_val;\n  }\n\n  uint32_t k = 0;\n  ecma_object_t *obj_p = ecma_get_object_from_value (ret_val);\n  const uint32_t prop_status_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;\n\n  while (k < arguments_list_len)\n  {\n    ecma_value_t define_status =\n      ecma_builtin_helper_def_prop_by_index (obj_p, k, arguments_list_p[k], prop_status_flags);\n\n    if (ECMA_IS_VALUE_ERROR (define_status))\n    {\n      ecma_free_value (len);\n      ecma_deref_object (obj_p);\n      return define_status;\n    }\n\n    k++;\n  }\n\n  ret_val = ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len, true);\n\n  ecma_free_value (len);\n\n  if (ECMA_IS_VALUE_ERROR (ret_val))\n  {\n    ecma_deref_object (obj_p);\n    return ret_val;\n  }\n\n  return ecma_make_object_value (obj_p);\n} /* ecma_builtin_array_object_of */\n\n/**\n * Handle calling [[Call]] of built-in Array object\n *\n * @return ECMA_VALUE_ERROR - if the array construction fails\n *         constructed array object - otherwise\n */\necma_value_t\necma_builtin_array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                  uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  if (arguments_list_len != 1 || !ecma_is_value_number (arguments_list_p[0]))\n  {\n    return ecma_op_new_array_object_from_buffer (arguments_list_p, arguments_list_len);\n  }\n\n  ecma_number_t num = ecma_get_number_from_value (arguments_list_p[0]);\n  uint32_t num_uint32 = ecma_number_to_uint32 (num);\n\n  if (num != ((ecma_number_t) num_uint32))\n  {\n    return ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH);\n  }\n\n  return ecma_make_object_value (ecma_op_new_array_object (num_uint32));\n} /* ecma_builtin_array_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Array object\n *\n * @return ECMA_VALUE_ERROR - if the array construction fails\n *         constructed array object - otherwise\n */\necma_value_t\necma_builtin_array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                       uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  ecma_object_t *proto_p =\n    ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_ARRAY_PROTOTYPE);\n\n  if (proto_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ecma_builtin_array_dispatch_call (arguments_list_p, arguments_list_len);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    ecma_deref_object (proto_p);\n    return result;\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (result);\n  ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, proto_p);\n  ecma_deref_object (proto_p);\n  return result;\n} /* ecma_builtin_array_dispatch_construct */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_array_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                     ecma_value_t this_arg, /**< 'this' argument value */\n                                     const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                             *   passed to routine */\n                                     uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_ARRAY_ROUTINE_IS_ARRAY:\n    {\n      JERRY_UNUSED (this_arg);\n\n      return ecma_is_value_array (arguments_list_p[0]);\n    }\n    case ECMA_ARRAY_ROUTINE_FROM:\n    {\n      return ecma_builtin_array_object_from (this_arg, arguments_list_p, arguments_number);\n    }\n    case ECMA_ARRAY_ROUTINE_OF:\n    {\n      return ecma_builtin_array_object_of (this_arg, arguments_list_p, arguments_number);\n    }\n    case ECMA_ARRAY_ROUTINE_SPECIES_GET:\n    {\n      return ecma_copy_value (this_arg);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_array_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_ARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-array.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Array description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ARRAY\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.4.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n/* Number properties:\n *  (property name, object pointer getter) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ARRAY_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_IS_ARRAY_UL, ECMA_ARRAY_ROUTINE_IS_ARRAY, 1, 1)\nROUTINE (LIT_MAGIC_STRING_FROM, ECMA_ARRAY_ROUTINE_FROM, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_OF, ECMA_ARRAY_ROUTINE_OF, NON_FIXED, 0)\n\n/* ECMA-262 v6, 22.1.2.5 */\nACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ECMA_ARRAY_ROUTINE_SPECIES_GET, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* !(JERRY_BUILTIN_ARRAY) */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jrt-libc-includes.h\"\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-arraybuffer-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  arraybuffer_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup arraybufferprototype ECMA ArrayBuffer.prototype object built-in\n * @{\n */\n\n/**\n * The ArrayBuffer.prototype.bytelength accessor\n *\n * See also:\n *          ES2015, 24.1.4.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_arraybuffer_prototype_bytelength_getter (ecma_value_t this_arg) /**< this argument */\n{\n  if (ecma_is_value_object (this_arg))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER))\n    {\n      if (ecma_arraybuffer_is_detached (object_p))\n      {\n        return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n      }\n      uint32_t len = ecma_arraybuffer_get_length (object_p);\n\n      return ecma_make_uint32_value (len);\n    }\n  }\n\n  return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_ARRAY_BUFFER_OBJECT);\n} /* ecma_builtin_arraybuffer_prototype_bytelength_getter */\n\n/**\n * The ArrayBuffer.prototype object's 'slice' routine\n *\n * See also:\n *          ECMA-262 v11, 24.1.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< this argument */\n                                                 const ecma_value_t *argument_list_p, /**< arguments list */\n                                                 uint32_t arguments_number) /**< number of arguments */\n{\n  if (!ecma_is_value_object (this_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n  /* 2. */\n  if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_ARRAY_BUFFER_OBJECT);\n  }\n\n  return ecma_builtin_arraybuffer_slice (this_arg, argument_list_p, arguments_number);\n} /* ecma_builtin_arraybuffer_prototype_object_slice */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * ArrayBuffer.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ARRAYBUFFER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* Readonly accessor properties */\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,\n                    ecma_builtin_arraybuffer_prototype_bytelength_getter,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 24.1.4.4 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_SLICE, ecma_builtin_arraybuffer_prototype_object_slice, NON_FIXED, 2)\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-dataview-object.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-arraybuffer.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  arraybuffer\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup arraybuffer ECMA ArrayBuffer object built-in\n * @{\n */\n\n/**\n * The ArrayBuffer object's 'isView' routine\n *\n * See also:\n *         ES2015 24.1.3.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_arraybuffer_object_is_view (ecma_value_t this_arg, /**< 'this' argument */\n                                         ecma_value_t arg) /**< argument 1 */\n{\n  JERRY_UNUSED (this_arg);\n\n  return ecma_make_boolean_value (ecma_is_typedarray (arg) || ecma_is_dataview (arg));\n} /* ecma_builtin_arraybuffer_object_is_view */\n\n/**\n * Handle calling [[Call]] of built-in ArrayBuffer object\n *\n * ES2015 24.1.2 ArrayBuffer is not intended to be called as\n * a function and will throw an exception when called in\n * that manner.\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_arraybuffer_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                        uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_ARRAYBUFFER_REQUIRES_NEW);\n} /* ecma_builtin_arraybuffer_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in ArrayBuffer object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_arraybuffer_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                             uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_op_create_arraybuffer_object (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_arraybuffer_dispatch_construct */\n\n/**\n * 24.1.3.3 get ArrayBuffer [ @@species ] accessor\n *\n * @return ecma_value\n *         returned value must be freed with ecma_free_value\n */\necma_value_t\necma_builtin_arraybuffer_species_get (ecma_value_t this_value) /**< This Value */\n{\n  return ecma_copy_value (this_value);\n} /* ecma_builtin_arraybuffer_species_get */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * ArrayBuffer built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\n\n/* ES2015 24.1.3.1 */\nROUTINE (LIT_MAGIC_STRING_IS_VIEW_UL, ecma_builtin_arraybuffer_object_is_view, 1, 1)\n\n/* ES2015 24.1.3.3 */\nACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_arraybuffer_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-types.h\"\n\n#include \"ecma-builtin-handlers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-promise-object.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n#include \"lit-magic-strings.h\"\n#include \"lit-strings.h\"\n#include \"opcodes.h\"\n#include \"vm-defines.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_ROUTINE_START = 0, /**< buitlin routine start id */\n  ECMA_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_ROUTINE_NEXT, /**< 'next' routine v11, 25.1.4.2.1  */\n  ECMA_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_ROUTINE_RETURN, /**< 'return' routine v11, 25.1.4.2.2  */\n  ECMA_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_ROUTINE_THROW /**< 'throw' routine v11, 25.1.4.2.3  */\n} ecma_async_from_sync_iterator_operation_type_t;\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-async-from-sync-iterator-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  async_from_sync_iterator_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup asyncfromsynciteratorprototype ECMA %AsyncFromSyncIteratorPrototype% object built-in\n * @{\n */\n\n/**\n * AsyncFromSyncIteratorContinuation operation\n *\n * See also:\n *         ECMAScript v11, 25.1.4.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_op_async_from_sync_iterator_prototype_continuation (ecma_value_t result, /**< routine's 'result' argument */\n                                                         ecma_object_t *capability_obj_p) /**< promise capability */\n{\n  /* 1. */\n  ecma_value_t done = ecma_op_iterator_complete (result);\n\n  /* 2. */\n  if (ECMA_IS_VALUE_ERROR (ecma_op_if_abrupt_reject_promise (&done, capability_obj_p)))\n  {\n    return done;\n  }\n\n  uint16_t done_flag = ecma_is_value_false (done) ? 0 : (1 << ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT);\n  ecma_free_value (done);\n\n  /* 3. */\n  ecma_value_t value = ecma_op_iterator_value (result);\n\n  /* 4. */\n  if (ECMA_IS_VALUE_ERROR (ecma_op_if_abrupt_reject_promise (&value, capability_obj_p)))\n  {\n    return value;\n  }\n\n  /* 5. */\n  ecma_value_t builtin_promise = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_PROMISE));\n  ecma_value_t value_wrapper = ecma_promise_reject_or_resolve (builtin_promise, value, true);\n  ecma_free_value (value);\n\n  /* 6. */\n  if (ECMA_IS_VALUE_ERROR (ecma_op_if_abrupt_reject_promise (&value_wrapper, capability_obj_p)))\n  {\n    return value_wrapper;\n  }\n\n  /* 8 - 9. */\n  ecma_object_t *on_fullfilled = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_ASYNC_FROM_SYNC_ITERATOR_UNWRAP,\n                                                                sizeof (ecma_extended_object_t));\n  ((ecma_extended_object_t *) on_fullfilled)->u.built_in.u2.routine_flags = (uint8_t) done_flag;\n\n  /* 10. */\n  ecma_value_t then_result = ecma_promise_perform_then (value_wrapper,\n                                                        ecma_make_object_value (on_fullfilled),\n                                                        ECMA_VALUE_UNDEFINED,\n                                                        capability_obj_p);\n\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (then_result));\n  ecma_deref_object (on_fullfilled);\n  ecma_free_value (value_wrapper);\n\n  /* 11. */\n  return then_result;\n} /* ecma_op_async_from_sync_iterator_prototype_continuation */\n\n/**\n * The %AsyncFromSyncIteratorPrototype% object's 'next' routine\n *\n * See also:\n *         ECMAScript v11, 25.1.4.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_async_from_sync_iterator_prototype_next (ecma_async_from_sync_iterator_object_t *iter_p, /**< iterator\n                                                                                                       *   record*/\n                                                      ecma_object_t *capability_p, /**< promise capability */\n                                                      ecma_value_t value) /**< routine's 'value' argument */\n{\n  /* 5. */\n  ecma_value_t next_result =\n    ecma_op_iterator_next (iter_p->header.u.cls.u3.sync_iterator, iter_p->sync_next_method, value);\n\n  /* 6. */\n  if (ECMA_IS_VALUE_ERROR (ecma_op_if_abrupt_reject_promise (&next_result, capability_p)))\n  {\n    return next_result;\n  }\n\n  /* 7. */\n  ecma_value_t result = ecma_op_async_from_sync_iterator_prototype_continuation (next_result, capability_p);\n  ecma_free_value (next_result);\n\n  return result;\n} /* ecma_builtin_async_from_sync_iterator_prototype_next */\n\n/**\n * The %AsyncFromSyncIteratorPrototype% object's 'return' and 'throw' routines\n *\n * See also:\n *         ECMAScript v11, 25.1.4.2.2\n *         ECMAScript v11, 25.1.4.2.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_async_from_sync_iterator_prototype_do (ecma_async_from_sync_iterator_object_t *iter_p, /**< iterator\n                                                                                                     *   record*/\n                                                    ecma_object_t *capability_obj_p, /**< promise capability */\n                                                    ecma_value_t value, /**< routine's 'value' argument */\n                                                    lit_magic_string_id_t method_id) /**< method id */\n{\n  /* 5. */\n  ecma_value_t sync_iterator = iter_p->header.u.cls.u3.sync_iterator;\n  ecma_value_t method = ecma_op_get_method_by_magic_id (sync_iterator, method_id);\n\n  /* 6. */\n  if (ECMA_IS_VALUE_ERROR (ecma_op_if_abrupt_reject_promise (&method, capability_obj_p)))\n  {\n    return method;\n  }\n\n  ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;\n\n  ecma_value_t call_arg;\n  uint32_t arg_size;\n\n  if (ecma_is_value_empty (value))\n  {\n    arg_size = 0;\n    call_arg = ECMA_VALUE_UNDEFINED;\n  }\n  else\n  {\n    arg_size = 1;\n    call_arg = value;\n  }\n\n  /* 7. */\n  if (ecma_is_value_undefined (method))\n  {\n    ecma_value_t func_obj;\n\n    if (method_id == LIT_MAGIC_STRING_RETURN)\n    {\n      /* 7.a. */\n      call_arg = ecma_create_iter_result_object (call_arg, ECMA_VALUE_TRUE);\n      arg_size = 1;\n      func_obj = capability_p->resolve;\n    }\n    else\n    {\n      func_obj = capability_p->reject;\n    }\n\n    /* 7.b. */\n    ecma_value_t resolve =\n      ecma_op_function_call (ecma_get_object_from_value (func_obj), ECMA_VALUE_UNDEFINED, &call_arg, arg_size);\n    JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (resolve));\n    ecma_free_value (resolve);\n\n    if (method_id == LIT_MAGIC_STRING_RETURN)\n    {\n      ecma_free_value (call_arg);\n    }\n\n    /* 7.c. */\n    return ecma_copy_value (capability_p->header.u.cls.u3.promise);\n  }\n\n  /* 8. */\n  ecma_value_t call_result = ecma_op_function_validated_call (method, sync_iterator, &call_arg, arg_size);\n  ecma_free_value (method);\n\n  /* 9. */\n  if (ECMA_IS_VALUE_ERROR (ecma_op_if_abrupt_reject_promise (&call_result, capability_obj_p)))\n  {\n    return call_result;\n  }\n\n  /* 10. */\n  if (!ecma_is_value_object (call_result))\n  {\n    ecma_free_value (call_result);\n\n#if JERRY_ERROR_MESSAGES\n    const lit_utf8_byte_t *msg_p = (lit_utf8_byte_t *) ecma_get_error_msg (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);\n    lit_utf8_size_t msg_size = ecma_get_error_size (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);\n    ecma_string_t *error_msg_p = ecma_new_ecma_string_from_ascii (msg_p, msg_size);\n#else /* !JERRY_ERROR_MESSAGES */\n    ecma_string_t *error_msg_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n#endif /* JERRY_ERROR_MESSAGES */\n\n    ecma_object_t *type_error_obj_p = ecma_new_standard_error (JERRY_ERROR_TYPE, error_msg_p);\n\n#if JERRY_ERROR_MESSAGES\n    ecma_deref_ecma_string (error_msg_p);\n#endif /* JERRY_ERROR_MESSAGES */\n\n    ecma_value_t type_error = ecma_make_object_value (type_error_obj_p);\n\n    /* 10.a. */\n    ecma_value_t reject =\n      ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), ECMA_VALUE_UNDEFINED, &type_error, 1);\n    JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (reject));\n    ecma_deref_object (type_error_obj_p);\n    ecma_free_value (reject);\n\n    /* 10.b. */\n    return ecma_copy_value (capability_p->header.u.cls.u3.promise);\n  }\n\n  ecma_value_t result = ecma_op_async_from_sync_iterator_prototype_continuation (call_result, capability_obj_p);\n  ecma_free_value (call_result);\n\n  return result;\n} /* ecma_builtin_async_from_sync_iterator_prototype_do */\n\n/**\n * Dispatcher of the %AsyncFromSyncIteratorPrototype% built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_async_from_sync_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide\n                                                                                               *   routine\n                                                                                               *   identifier */\n                                                                  ecma_value_t this_arg, /**< 'this' argument value */\n                                                                  const ecma_value_t arguments_list_p[], /**< list of\n                                                                                                          *   arguments\n                                                                                                          *   passed to\n                                                                                                          *   routine */\n                                                                  uint32_t arguments_number) /**< length of\n                                                                                              *   arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n  JERRY_ASSERT (ecma_is_value_object (this_arg));\n\n  ecma_object_t *this_obj_p = ecma_get_object_from_value (this_arg);\n\n  JERRY_ASSERT (ecma_object_class_is (this_obj_p, ECMA_OBJECT_CLASS_ASYNC_FROM_SYNC_ITERATOR));\n\n  ecma_async_from_sync_iterator_object_t *iter_p = (ecma_async_from_sync_iterator_object_t *) this_obj_p;\n\n  ecma_value_t builtin_promise = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_PROMISE));\n  ecma_object_t *capability_p = ecma_promise_new_capability (builtin_promise, ECMA_VALUE_UNDEFINED);\n  JERRY_ASSERT (capability_p != NULL);\n\n  ecma_value_t result;\n  ecma_value_t arg = (arguments_number == 0 ? ECMA_VALUE_EMPTY : arguments_list_p[0]);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_ROUTINE_NEXT:\n    {\n      result = ecma_builtin_async_from_sync_iterator_prototype_next (iter_p, capability_p, arg);\n      break;\n    }\n    case ECMA_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_ROUTINE_RETURN:\n    {\n      result = ecma_builtin_async_from_sync_iterator_prototype_do (iter_p, capability_p, arg, LIT_MAGIC_STRING_RETURN);\n      break;\n    }\n    case ECMA_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_ROUTINE_THROW:\n    {\n      result = ecma_builtin_async_from_sync_iterator_prototype_do (iter_p, capability_p, arg, LIT_MAGIC_STRING_THROW);\n      break;\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n      break;\n    }\n  }\n\n  ecma_deref_object (capability_p);\n\n  return result;\n} /* ecma_builtin_async_from_sync_iterator_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %AsyncFromSyncIteratorPrototype% built-in description (AsyncFunction.prototype)\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_NEXT, ECMA_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_ROUTINE_NEXT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_RETURN, ECMA_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_ROUTINE_RETURN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_THROW, ECMA_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE_ROUTINE_THROW, 1, 1)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-globals.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-async-function-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  async_function_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup asyncfunctionprototype ECMA AsyncFunction.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %AsyncFunctionPrototype% built-in description (AsyncFunction.prototype)\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* ECMA-262 v11, 25.7.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v11, 25.7.3.2 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-function.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-globals.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n#include \"ecma-function-object.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-async-function.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  async_function\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup asyncfunction ECMA AsyncFunction object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in AsyncFunction object\n *\n * @return constructed async function object - if success\n *         raised error otherwise\n */\necma_value_t\necma_builtin_async_function_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                           uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_op_create_dynamic_function (arguments_list_p, arguments_list_len, ECMA_PARSE_ASYNC_FUNCTION);\n} /* ecma_builtin_async_function_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in AsyncFunction object\n *\n * @return constructed async function object - if success\n *        raised error otherwise\n */\necma_value_t\necma_builtin_async_function_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_async_function_dispatch_call (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_async_function_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-function.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %AsyncFunction% built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* ECMA-262 v11, 25.7.2 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v11, 25.7.2.1 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v10, 25.7.2.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v11, 25.7.3.2 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-globals.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n#include \"ecma-function-object.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-async-generator-function.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  async_generator_function\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup asyncgeneratorfunction ECMA AsyncGeneratorFunction object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in AsyncGeneratorFunction object\n *\n * @return constructed async generator function object - if success\n *         raised error otherwise\n */\necma_value_t\necma_builtin_async_generator_function_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                     uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_op_create_dynamic_function (arguments_list_p,\n                                          arguments_list_len,\n                                          ECMA_PARSE_GENERATOR_FUNCTION | ECMA_PARSE_ASYNC_FUNCTION);\n} /* ecma_builtin_async_generator_function_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in AsyncGeneratorFunction object\n *\n * @return constructed async generator function object - if success\n *        raised error otherwise\n */\necma_value_t\necma_builtin_async_generator_function_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                          uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_async_generator_function_dispatch_call (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_async_generator_function_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %AsyncGeneratorFunction% built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* ECMA-262 v10, 25.3.2 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v10, 25.3.2.1 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 25.3.2.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_GENERATOR, ECMA_PROPERTY_FIXED)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-async-generator-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-promise-object.h\"\n\n#include \"jcontext.h\"\n#include \"opcodes.h\"\n#include \"vm-defines.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT,\n  ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_THROW,\n  ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_RETURN\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-async-generator-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  async_generator_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup asyncgeneratorprototype ECMA AsyncGenerator.prototype object built-in\n * @{\n */\n\n/**\n * Convert routine type to operation type.\n */\n#define ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION(type) \\\n  ((ecma_async_generator_operation_type_t) ((type) -ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT))\n\nJERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT)\n                       == ECMA_ASYNC_GENERATOR_DO_NEXT,\n                     convert_ecma_async_generator_routine_next_to_ecma_async_generator_do_next_failed);\n\nJERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_THROW)\n                       == ECMA_ASYNC_GENERATOR_DO_THROW,\n                     convert_ecma_async_generator_routine_throw_to_ecma_async_generator_do_throw_failed);\n\nJERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_RETURN)\n                       == ECMA_ASYNC_GENERATOR_DO_RETURN,\n                     convert_ecma_async_generator_routine_return_to_ecma_async_generator_do_return_failed);\n\n/**\n * Dispatcher of the Generator built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_async_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine\n                                                                                      *   identifier */\n                                                         ecma_value_t this_arg, /**< 'this' argument value */\n                                                         const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                                 *   passed to\n                                                                                                 *   routine */\n                                                         uint32_t arguments_number) /**< length of arguments'\n                                                                                     *   list */\n{\n  JERRY_UNUSED (arguments_number);\n\n  vm_executable_object_t *executable_object_p = NULL;\n\n  if (ecma_is_value_object (this_arg))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ASYNC_GENERATOR))\n    {\n      executable_object_p = (vm_executable_object_t *) object_p;\n    }\n  }\n\n  if (executable_object_p == NULL)\n  {\n    const char *msg_p = ecma_get_error_msg (ECMA_ERR_ARGUMENT_THIS_NOT_ASYNC_GENERATOR);\n    lit_utf8_size_t msg_size = ecma_get_error_size (ECMA_ERR_ARGUMENT_THIS_NOT_ASYNC_GENERATOR);\n    ecma_string_t *error_msg_p = ecma_new_ecma_string_from_ascii ((const lit_utf8_byte_t *) msg_p, msg_size);\n\n    ecma_object_t *type_error_obj_p = ecma_new_standard_error (JERRY_ERROR_TYPE, error_msg_p);\n    ecma_deref_ecma_string (error_msg_p);\n\n    ecma_value_t promise = ecma_op_create_promise_object (ECMA_VALUE_EMPTY, ECMA_VALUE_UNDEFINED, NULL);\n    ecma_reject_promise (promise, ecma_make_object_value (type_error_obj_p));\n    ecma_deref_object (type_error_obj_p);\n\n    return promise;\n  }\n\n  if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED)\n  {\n    ecma_value_t promise = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_PROMISE));\n\n    if (JERRY_UNLIKELY (builtin_routine_id == ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_THROW))\n    {\n      return ecma_promise_reject_or_resolve (promise, arguments_list_p[0], false);\n    }\n\n    ecma_value_t iter_result = ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n    ecma_value_t result = ecma_promise_reject_or_resolve (promise, iter_result, true);\n    ecma_free_value (iter_result);\n    return result;\n  }\n\n  return ecma_async_generator_enqueue (executable_object_p,\n                                       ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (builtin_routine_id),\n                                       arguments_list_p[0]);\n} /* ecma_builtin_async_generator_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * AsyncGenerator.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 25.3.1.5 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_GENERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 25.2.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_GENERATOR, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_NEXT, ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_RETURN, ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_RETURN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_THROW, ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_THROW, 1, 1)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-globals.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-async-generator.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  async_generator\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup asyncgenerator ECMA AsyncGenerator object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %AsyncGenerator% built-in description (AsyncGeneratorFunction.prototype)\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* ECMA-262 v6, 25.3.2.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 25.3.2.3.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 25.3.2.3.3 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,\n              LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL,\n              ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-iterator-object.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BUILTIN_ASYNC_ITERATOR_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_BUILTIN_ASYNC_ITERATOR_PROTOTYPE_OBJECT_ASYNC_ITERATOR,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-async-iterator-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  async_iterator_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup %asynciteratorprototype% ECMA %AsyncIteratorPrototype% object built-in\n * @{\n */\n\n/**\n * The %AsyncIteratorPrototype% object's '@@asyncIterator' routine\n *\n * See also:\n *          ECMA-262 v10, 25.1.3.1\n *\n * Note:\n *     Returned value must be freed with ecma_free_value.\n *\n * @return the given this value\n */\nstatic ecma_value_t\necma_builtin_async_iterator_prototype_object_async_iterator (ecma_value_t this_val) /**< this argument */\n{\n  /* 1. */\n  return ecma_copy_value (this_val);\n} /* ecma_builtin_async_iterator_prototype_object_async_iterator */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_async_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide\n                                                                                     *   routine identifier */\n                                                        ecma_value_t this_arg, /**< 'this' argument value */\n                                                        const ecma_value_t arguments_list_p[], /**<\n                                                                                                * list of arguments\n                                                                                                * passed to routine */\n                                                        uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (arguments_list_p, arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_BUILTIN_ASYNC_ITERATOR_PROTOTYPE_OBJECT_ASYNC_ITERATOR:\n    {\n      return ecma_builtin_async_iterator_prototype_object_async_iterator (this_arg);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_async_iterator_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-async-iterator-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %AsyncIteratorPrototype% built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_GLOBAL_SYMBOL_ASYNC_ITERATOR, ECMA_BUILTIN_ASYNC_ITERATOR_PROTOTYPE_OBJECT_ASYNC_ITERATOR, 0, 0)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-atomics.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-atomics-object.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-errors.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-shared-arraybuffer-object.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ATOMICS\n\n#define ECMA_BUILTINS_INTERNAL\n\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_ATOMICS_ROUTINE_START = 0, /**< Special value, should be ignored */\n  ECMA_ATOMICS_ROUTINE_ADD, /**< Atomics add routine */\n  ECMA_ATOMICS_ROUTINE_AND, /**< Atomics and routine */\n  ECMA_ATOMICS_ROUTINE_COMPAREEXCHANGE, /**< Atomics compare exchange routine */\n  ECMA_ATOMICS_ROUTINE_EXCHANGE, /**< Atomics exchange routine */\n  ECMA_ATOMICS_ROUTINE_ISLOCKFREE, /**< Atomics is lock free routine */\n  ECMA_ATOMICS_ROUTINE_LOAD, /**< Atomics load routine */\n  ECMA_ATOMICS_ROUTINE_OR, /**< Atomics or routine */\n  ECMA_ATOMICS_ROUTINE_STORE, /**< Atomics store routine */\n  ECMA_ATOMICS_ROUTINE_SUB, /**< Atomics sub routine */\n  ECMA_ATOMICS_ROUTINE_WAIT, /**< Atomics wait routine */\n  ECMA_ATOMICS_ROUTINE_NOTIFY, /**< Atomics notify routine */\n  ECMA_ATOMICS_ROUTINE_XOR, /**< Atomics xor routine */\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-atomics.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  atomics\n\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup atomics ECMA Atomics object built-in\n * @{\n */\n\n/**\n * Convert ecma_number to the appropriate type according to the element type of typedarray.\n */\nstatic ecma_value_t\necma_convert_number_to_typed_array_type (ecma_number_t num, /**< ecma_number argument */\n                                         ecma_typedarray_type_t element_type) /**< element type of typedarray */\n{\n  uint32_t value = ecma_typedarray_setter_number_to_uint32 (num);\n\n  switch (element_type)\n  {\n    case ECMA_INT8_ARRAY:\n    {\n      return ecma_make_number_value ((int8_t) value);\n    }\n    case ECMA_UINT8_ARRAY:\n    {\n      return ecma_make_number_value ((uint8_t) value);\n    }\n    case ECMA_INT16_ARRAY:\n    {\n      return ecma_make_number_value ((int16_t) value);\n    }\n    case ECMA_UINT16_ARRAY:\n    {\n      return ecma_make_number_value ((uint16_t) value);\n    }\n    case ECMA_INT32_ARRAY:\n    {\n      return ecma_make_number_value ((int32_t) value);\n    }\n    default:\n    {\n      JERRY_ASSERT (element_type == ECMA_UINT32_ARRAY);\n\n      return ecma_make_number_value (value);\n    }\n  }\n} /* ecma_convert_number_to_typed_array_type */\n\n/**\n * The Atomics object's 'compareExchange' routine\n *\n * See also: ES12 25.4.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_atomics_compare_exchange (ecma_value_t typedarray, /**< typedArray argument */\n                                       ecma_value_t index, /**< index argument */\n                                       ecma_value_t expected_value, /**< expectedValue argument */\n                                       ecma_value_t replacement_value) /**< replacementValue argument*/\n{\n  ecma_value_t buffer = ecma_validate_integer_typedarray (typedarray, false);\n\n  if (ECMA_IS_VALUE_ERROR (buffer))\n  {\n    return buffer;\n  }\n\n  uint32_t idx = ecma_validate_atomic_access (typedarray, index);\n\n  if (idx == ECMA_STRING_NOT_ARRAY_INDEX)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (typedarray);\n  ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (target_info.array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_typedarray_type_t element_type = target_info.id;\n  ecma_value_t expected;\n  ecma_value_t replacement;\n\n#if JERRY_BUILTIN_BIGINT\n  if (ECMA_TYPEDARRAY_IS_BIGINT_TYPE (element_type))\n  {\n    expected = ecma_bigint_to_bigint (expected_value, false);\n\n    if (ECMA_IS_VALUE_ERROR (expected))\n    {\n      return expected;\n    }\n\n    if (element_type == ECMA_BIGUINT64_ARRAY)\n    {\n      uint64_t num;\n      bool sign;\n\n      ecma_bigint_get_digits_and_sign (expected, &num, 1, &sign);\n\n      if (sign)\n      {\n        num = (uint64_t) (-(int64_t) num);\n      }\n\n      if (expected != ECMA_BIGINT_ZERO)\n      {\n        ecma_deref_bigint (ecma_get_extended_primitive_from_value (expected));\n      }\n\n      expected = ecma_bigint_create_from_digits (&num, 1, false);\n    }\n\n    replacement = ecma_bigint_to_bigint (replacement_value, false);\n\n    if (ECMA_IS_VALUE_ERROR (replacement))\n    {\n      ecma_free_value (expected);\n      return replacement;\n    }\n  }\n  else\n#endif /* JERRY_BUILTIN_BIGINT */\n  {\n    ecma_number_t tmp_exp;\n    ecma_number_t tmp_rep;\n\n    expected = ecma_op_to_integer (expected_value, &tmp_exp);\n\n    if (ECMA_IS_VALUE_ERROR (expected))\n    {\n      return expected;\n    }\n\n    expected = ecma_convert_number_to_typed_array_type (tmp_exp, element_type);\n\n    replacement = ecma_op_to_integer (replacement_value, &tmp_rep);\n\n    if (ECMA_IS_VALUE_ERROR (replacement))\n    {\n      ecma_free_value (expected);\n      return replacement;\n    }\n\n    replacement = ecma_make_number_value (tmp_rep);\n  }\n\n  uint8_t element_size = target_info.element_size;\n  uint32_t offset = target_info.offset;\n  uint32_t indexed_position = idx * element_size + offset;\n\n  if (ecma_arraybuffer_is_detached (ecma_get_object_from_value (buffer)))\n  {\n    ecma_free_value (expected);\n    ecma_free_value (replacement);\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  ecma_typedarray_getter_fn_t typedarray_getter_cb = ecma_get_typedarray_getter_fn (element_type);\n\n  ecma_object_t *buffer_obj_p = ecma_get_object_from_value (buffer);\n  lit_utf8_byte_t *pos = ecma_arraybuffer_get_buffer (buffer_obj_p) + indexed_position;\n  ecma_value_t stored_value = typedarray_getter_cb (pos);\n\n  // TODO: Handle shared array buffers differently.\n  if (ecma_op_same_value (stored_value, expected))\n  {\n    ecma_typedarray_setter_fn_t typedarray_setter_cb = ecma_get_typedarray_setter_fn (element_type);\n    typedarray_setter_cb (ecma_arraybuffer_get_buffer (buffer_obj_p) + indexed_position, replacement);\n  }\n\n  ecma_free_value (expected);\n  ecma_free_value (replacement);\n\n  return stored_value;\n} /* ecma_builtin_atomics_compare_exchange */\n\n/**\n * The Atomics object's 'isLockFree' routine\n *\n * See also: ES11 24.4.6\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_atomics_is_lock_free (ecma_value_t size) /**< size argument */\n{\n  JERRY_UNUSED (size);\n\n  return ECMA_VALUE_FALSE;\n} /* ecma_builtin_atomics_is_lock_free */\n\n/**\n * The Atomics object's 'store' routine\n *\n * See also: ES11 24.4.9\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_atomics_store (ecma_value_t typedarray, /**< typedArray argument */\n                            ecma_value_t index, /**< index argument */\n                            ecma_value_t value) /**< value argument */\n{\n  /* 1. */\n  ecma_value_t buffer = ecma_validate_integer_typedarray (typedarray, false);\n\n  if (ECMA_IS_VALUE_ERROR (buffer))\n  {\n    return buffer;\n  }\n\n  /* 2. */\n  uint32_t idx = ecma_validate_atomic_access (typedarray, index);\n\n  if (idx == ECMA_STRING_NOT_ARRAY_INDEX)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (typedarray);\n  ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (target_info.array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_typedarray_type_t element_type = target_info.id;\n\n  ecma_typedarray_setter_fn_t typedarray_setter_cb = ecma_get_typedarray_setter_fn (element_type);\n\n  ecma_value_t value_to_store;\n#if JERRY_BUILTIN_BIGINT\n  if (element_type == ECMA_BIGINT64_ARRAY || element_type == ECMA_BIGUINT64_ARRAY)\n  {\n    value_to_store = ecma_bigint_to_bigint (value, false);\n\n    if (ECMA_IS_VALUE_ERROR (value_to_store))\n    {\n      return value_to_store;\n    }\n  }\n  else\n#endif /* JERRY_BUILTIN_BIGINT */\n  {\n    ecma_number_t num_int;\n\n    value_to_store = ecma_op_to_integer (value, &num_int);\n\n    if (ECMA_IS_VALUE_ERROR (value_to_store))\n    {\n      return value_to_store;\n    }\n\n    if (ecma_number_is_zero (num_int) && ecma_number_is_negative (num_int))\n    {\n      num_int = (ecma_number_t) 0;\n    }\n\n    value_to_store = ecma_make_number_value (num_int);\n  }\n\n  ecma_object_t *buffer_obj_p = ecma_get_object_from_value (buffer);\n\n  if (ecma_arraybuffer_is_detached (buffer_obj_p))\n  {\n    ecma_free_value (value_to_store);\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  uint8_t element_size = target_info.element_size;\n\n  uint32_t offset = target_info.offset;\n\n  uint32_t indexed_position = idx * element_size + offset;\n\n  // TODO: Handle shared array buffers differently.\n  typedarray_setter_cb (ecma_arraybuffer_get_buffer (buffer_obj_p) + indexed_position, value_to_store);\n\n  return value_to_store;\n} /* ecma_builtin_atomics_store */\n\n/**\n * The Atomics object's 'wait' routine\n *\n * See also: ES11 24.4.11\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_atomics_wait (ecma_value_t typedarray, /**< typedArray argument */\n                           ecma_value_t index, /**< index argument */\n                           ecma_value_t value, /**< value argument */\n                           ecma_value_t timeout) /**< timeout argument */\n{\n  JERRY_UNUSED (typedarray);\n  JERRY_UNUSED (index);\n  JERRY_UNUSED (value);\n  JERRY_UNUSED (timeout);\n\n  return ecma_make_uint32_value (0);\n} /* ecma_builtin_atomics_wait */\n\n/**\n * The Atomics object's 'notify' routine\n *\n * See also: ES11 24.4.12\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_atomics_notify (ecma_value_t typedarray, /**< typedArray argument */\n                             ecma_value_t index, /**< index argument */\n                             ecma_value_t count) /**< count argument */\n{\n  JERRY_UNUSED (typedarray);\n  JERRY_UNUSED (index);\n  JERRY_UNUSED (count);\n\n  return ecma_make_uint32_value (0);\n} /* ecma_builtin_atomics_notify */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_atomics_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                       ecma_value_t this_arg, /**< 'this' argument value */\n                                       const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                               *   passed to routine */\n                                       uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (this_arg);\n  ecma_value_t arg1 = arguments_list_p[0];\n  ecma_value_t arg2 = arguments_list_p[1];\n  ecma_value_t arg3 = arguments_list_p[2];\n  ecma_value_t arg4 = (arguments_number > 3) ? arguments_list_p[3] : ECMA_VALUE_UNDEFINED;\n\n  ecma_atomics_op_t type;\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_ATOMICS_ROUTINE_ADD:\n    {\n      type = ECMA_ATOMICS_ADD;\n      break;\n    }\n    case ECMA_ATOMICS_ROUTINE_AND:\n    {\n      type = ECMA_ATOMICS_AND;\n      break;\n    }\n    case ECMA_ATOMICS_ROUTINE_COMPAREEXCHANGE:\n    {\n      return ecma_builtin_atomics_compare_exchange (arg1, arg2, arg3, arg4);\n    }\n    case ECMA_ATOMICS_ROUTINE_EXCHANGE:\n    {\n      type = ECMA_ATOMICS_EXCHANGE;\n      break;\n    }\n    case ECMA_ATOMICS_ROUTINE_ISLOCKFREE:\n    {\n      return ecma_builtin_atomics_is_lock_free (arg1);\n    }\n    case ECMA_ATOMICS_ROUTINE_LOAD:\n    {\n      return ecma_atomic_load (arg1, arg2);\n    }\n    case ECMA_ATOMICS_ROUTINE_OR:\n    {\n      type = ECMA_ATOMICS_OR;\n      break;\n    }\n    case ECMA_ATOMICS_ROUTINE_STORE:\n    {\n      return ecma_builtin_atomics_store (arg1, arg2, arg3);\n    }\n    case ECMA_ATOMICS_ROUTINE_SUB:\n    {\n      type = ECMA_ATOMICS_SUBTRACT;\n      break;\n    }\n    case ECMA_ATOMICS_ROUTINE_WAIT:\n    {\n      return ecma_builtin_atomics_wait (arg1, arg2, arg3, arg4);\n    }\n    case ECMA_ATOMICS_ROUTINE_NOTIFY:\n    {\n      return ecma_builtin_atomics_notify (arg1, arg2, arg3);\n    }\n    case ECMA_ATOMICS_ROUTINE_XOR:\n    {\n      type = ECMA_ATOMICS_XOR;\n      break;\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n  return ecma_atomic_read_modify_write (arg1, arg2, arg3, type);\n} /* ecma_builtin_atomics_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_ATOMICS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-atomics.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Atomics built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ATOMICS\n\n/* ECMA-262 v11, 24.4.14 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ATOMICS_U, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_ADD, ECMA_ATOMICS_ROUTINE_ADD, 3, 3)\nROUTINE (LIT_MAGIC_STRING_ATOMICS_AND, ECMA_ATOMICS_ROUTINE_AND, 3, 3)\nROUTINE (LIT_MAGIC_STRING_ATOMICS_COMPAREEXCHANGE, ECMA_ATOMICS_ROUTINE_COMPAREEXCHANGE, 4, 4)\nROUTINE (LIT_MAGIC_STRING_ATOMICS_EXCHANGE, ECMA_ATOMICS_ROUTINE_EXCHANGE, 3, 3)\nROUTINE (LIT_MAGIC_STRING_ATOMICS_ISLOCKFREE, ECMA_ATOMICS_ROUTINE_ISLOCKFREE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ATOMICS_LOAD, ECMA_ATOMICS_ROUTINE_LOAD, 2, 2)\nROUTINE (LIT_MAGIC_STRING_ATOMICS_OR, ECMA_ATOMICS_ROUTINE_OR, 3, 3)\nROUTINE (LIT_MAGIC_STRING_ATOMICS_STORE, ECMA_ATOMICS_ROUTINE_STORE, 3, 3)\nROUTINE (LIT_MAGIC_STRING_ATOMICS_SUB, ECMA_ATOMICS_ROUTINE_SUB, 3, 3)\nROUTINE (LIT_MAGIC_STRING_ATOMICS_WAIT, ECMA_ATOMICS_ROUTINE_WAIT, 4, 4)\nROUTINE (LIT_MAGIC_STRING_ATOMICS_NOTIFY, ECMA_ATOMICS_ROUTINE_NOTIFY, 3, 3)\nROUTINE (LIT_MAGIC_STRING_ATOMICS_XOR, ECMA_ATOMICS_ROUTINE_XOR, 3, 3)\n\n#endif /* JERRY_BUILTIN_ATOMICS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-bigint.h\"\n#include \"ecma-exceptions.h\"\n\n#if JERRY_BUILTIN_BIGINT\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BIGINT_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_BIGINT_PROTOTYPE_VALUE_OF,\n  ECMA_BIGINT_PROTOTYPE_TO_STRING,\n  ECMA_BIGINT_PROTOTYPE_TO_LOCALE_STRING,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-bigint-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  bigint_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup bigint ECMA BigInt object built-in\n * @{\n */\n\n/**\n * The BigInt.prototype object's 'valueOf' routine\n *\n * See also:\n *          ECMA-262 v11, 20.2.3.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_bigint_prototype_object_value_of (ecma_value_t this_arg) /**< this argument */\n{\n  if (ecma_is_value_bigint (this_arg))\n  {\n    return ecma_copy_value (this_arg);\n  }\n\n  if (ecma_is_value_object (this_arg))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_BIGINT))\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      JERRY_ASSERT (ecma_is_value_bigint (ext_object_p->u.cls.u3.value));\n\n      return ecma_copy_value (ext_object_p->u.cls.u3.value);\n    }\n  }\n\n  return ecma_raise_type_error (ECMA_ERR_BIGINT_VALUE_EXCPECTED);\n} /* ecma_builtin_bigint_prototype_object_value_of */\n\n/**\n * The BigInt.prototype object's 'toString' routine\n *\n * See also:\n *          ECMA-262 v11, 20.2.3.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_bigint_prototype_object_to_string (ecma_value_t this_arg, /**< this argument */\n                                                const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                uint32_t arguments_list_len) /**< number of arguments */\n{\n  uint32_t radix = 10;\n\n  if (arguments_list_len > 0 && !ecma_is_value_undefined (arguments_list_p[0]))\n  {\n    ecma_number_t arg_num;\n\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (arguments_list_p[0], &arg_num)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    if (arg_num < 2 || arg_num > 36)\n    {\n      return ecma_raise_range_error (ECMA_ERR_RADIX_IS_OUT_OF_RANGE);\n    }\n\n    radix = (uint32_t) arg_num;\n  }\n\n  ecma_string_t *string_p = ecma_bigint_to_string (this_arg, radix);\n\n  if (string_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  return ecma_make_string_value (string_p);\n} /* ecma_builtin_bigint_prototype_object_to_string */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_bigint_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine\n                                                                             *   identifier */\n                                                ecma_value_t this_arg, /**< 'this' argument value */\n                                                const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                        *   passed to routine */\n                                                uint32_t arguments_number) /**< length of arguments' list */\n{\n  ecma_value_t this_value = ecma_builtin_bigint_prototype_object_value_of (this_arg);\n  ecma_value_t ret_val;\n\n  if (ECMA_IS_VALUE_ERROR (this_value))\n  {\n    return this_value;\n  }\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_BIGINT_PROTOTYPE_VALUE_OF:\n    {\n      ret_val = this_value;\n      break;\n    }\n    case ECMA_BIGINT_PROTOTYPE_TO_STRING:\n    {\n      ret_val = ecma_builtin_bigint_prototype_object_to_string (this_value, arguments_list_p, arguments_number);\n      ecma_free_value (this_value);\n      break;\n    }\n    case ECMA_BIGINT_PROTOTYPE_TO_LOCALE_STRING:\n    {\n      ret_val = ecma_builtin_bigint_prototype_object_to_string (this_value, 0, 0);\n      ecma_free_value (this_value);\n      break;\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n  return ret_val;\n} /* ecma_builtin_bigint_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * BigInt.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_BIGINT\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v11, 20.2.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_BIGINT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v11, 20.2.3.5 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_BIGINT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_BIGINT_PROTOTYPE_TO_STRING, NON_FIXED, 0)\nROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_BIGINT_PROTOTYPE_VALUE_OF, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_BIGINT_PROTOTYPE_TO_LOCALE_STRING, 0, 0)\n\n#endif /* JERRY_BUILTIN_BIGINT */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-big-uint.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n\n#if JERRY_BUILTIN_BIGINT\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BUILTIN_BIGINT_START = 0, /**< Special value, should be ignored */\n  ECMA_BUILTIN_BIGINT_AS_INT_N, /**< The 'asIntN' routine of the BigInt object */\n  ECMA_BUILTIN_BIGINT_AS_U_INT_N, /**< The 'asUintN' routine of the BigInt object */\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-bigint.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  bigint\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup bigint ECMA BigInt object built-in\n * @{\n */\n\n/**\n * The BigInt object's 'asIntN' and 'asUintN' routines\n *\n * See also:\n *          ECMA-262 v15, 21.2.2\n *\n * @return ecma value\n *         Truncated BigInt value for the given number of LSBs\n *         as an integer or unsigned integer.\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_bigint_object_as_int_n (ecma_value_t bits, /**< number of bits */\n                                     ecma_value_t bigint, /**< bigint number */\n                                     bool is_signed) /**< The operation is signed */\n{\n  ecma_number_t input_bits;\n  ecma_value_t bit_value = ecma_op_to_index (bits, &input_bits);\n\n  if (ECMA_IS_VALUE_ERROR (bit_value))\n  {\n    return bit_value;\n  }\n\n  ecma_value_t bigint_value = ecma_bigint_to_bigint (bigint, false);\n\n  if (ECMA_IS_VALUE_ERROR (bigint_value))\n  {\n    return bigint_value;\n  }\n\n  if (input_bits == 0 || bigint_value == ECMA_BIGINT_ZERO)\n  {\n    ecma_free_value (bigint_value);\n    return ECMA_BIGINT_ZERO;\n  }\n\n  ecma_extended_primitive_t *input_bigint_p = ecma_get_extended_primitive_from_value (bigint_value);\n  uint32_t bigint_size = ECMA_BIGINT_GET_SIZE (input_bigint_p);\n\n  if (input_bits >= UINT32_MAX)\n  {\n    return bigint_value;\n  }\n\n  uint8_t input_bigint_sign = input_bigint_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN;\n  const uint32_t size_of_divisor_in_bits = sizeof (uint32_t) * JERRY_BITSINBYTE;\n  uint32_t whole_part = (uint32_t) input_bits / size_of_divisor_in_bits;\n  uint32_t remainder = (uint32_t) input_bits % size_of_divisor_in_bits;\n  uint32_t input_bit_length =\n    (whole_part == 0 || remainder == 0) ? (uint32_t) input_bits : (whole_part + 1) * size_of_divisor_in_bits;\n\n  uint32_t input_byte_size = (uint32_t) input_bits / JERRY_BITSINBYTE;\n\n  if ((uint32_t) input_bits % JERRY_BITSINBYTE != 0)\n  {\n    input_byte_size += 1;\n  }\n\n  const uint32_t input_bits_in_byte = (uint32_t) input_bit_length / JERRY_BITSINBYTE;\n  uint32_t min_size = (input_bits_in_byte < bigint_size) ? input_bits_in_byte : bigint_size;\n\n  if (input_bigint_sign && (input_byte_size > bigint_size))\n  {\n    min_size = (input_bits_in_byte > bigint_size) ? input_bits_in_byte : bigint_size;\n  }\n\n  if (min_size < sizeof (uint32_t))\n  {\n    min_size = sizeof (uint32_t);\n  }\n\n  ecma_extended_primitive_t *result_p = ecma_bigint_create ((uint32_t) min_size);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    ecma_deref_bigint (input_bigint_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_bigint_digit_t *last_digit_p = ECMA_BIGINT_GET_DIGITS (input_bigint_p, bigint_size);\n\n  /* Calculate the leading zeros of the input_bigint */\n\n  ecma_bigint_digit_t zeros = ecma_big_uint_count_leading_zero (last_digit_p[-1]);\n  uint32_t bits_of_bigint = (uint32_t) (bigint_size * JERRY_BITSINBYTE) - zeros;\n  uint32_t exact_size =\n    (input_bigint_sign || ((bits_of_bigint > (size_of_divisor_in_bits - 1)) && (input_byte_size < bigint_size)))\n      ? (uint32_t) input_byte_size\n      : bigint_size;\n\n  if (input_bigint_sign)\n  {\n    bits_of_bigint += 1;\n  }\n\n  if (bits_of_bigint > (input_bits - 1) || input_bigint_sign)\n  {\n    ecma_bigint_digit_t *digits_p = ECMA_BIGINT_GET_DIGITS (input_bigint_p, 0);\n    ecma_bigint_digit_t *digits_end_p = ECMA_BIGINT_GET_DIGITS (input_bigint_p, exact_size);\n    ecma_bigint_digit_t *result_number_p = ECMA_BIGINT_GET_DIGITS (result_p, 0);\n    int32_t first_cell = 0;\n    uint32_t surplus_bits =\n      (whole_part > 0) ? (uint32_t) (whole_part * size_of_divisor_in_bits) : (uint32_t) size_of_divisor_in_bits;\n    uint32_t mask_bit = (whole_part == 0) ? (uint32_t) input_bits : (uint32_t) input_bits - surplus_bits;\n\n    if (mask_bit == 0)\n    {\n      mask_bit = size_of_divisor_in_bits - 1;\n    }\n\n    uint32_t check_sign_mask = (uint32_t) 1 << (mask_bit - 1);\n    uint32_t mask = ((uint32_t) 1 << mask_bit) - 1;\n    uint32_t last_cell = (exact_size >= sizeof (uint32_t)) ? (uint32_t) (min_size / sizeof (uint32_t)) - 1 : 0;\n    bool is_positive = false;\n    bool is_representation_positive = false;\n\n    if (is_signed)\n    {\n      if (input_bigint_sign && ((~digits_p[last_cell] + 1) & check_sign_mask) == 0)\n      {\n        is_positive = true;\n      }\n\n      if ((digits_p[last_cell] & check_sign_mask) == 0)\n      {\n        is_representation_positive = true;\n      }\n    }\n\n    do\n    {\n      *result_number_p++ =\n        (is_representation_positive || (!is_signed && !input_bigint_sign)) ? *digits_p++ : ~(*digits_p++);\n      first_cell--;\n    } while (digits_p < digits_end_p);\n\n    int16_t equal_bits = 0;\n\n    if (remainder != 0)\n    {\n      equal_bits = -1;\n    }\n\n    int32_t last_cell_negative = (last_cell != 0) ? ((int32_t) last_cell * (-1)) : -1;\n    bool is_zero_values = false;\n\n    if (!is_signed)\n    {\n      if (input_bigint_sign)\n      {\n        is_zero_values = true;\n      }\n    }\n    else\n    {\n      if (((digits_p[-1] & check_sign_mask) > 0) || (result_number_p[-1] & check_sign_mask) > 0)\n      {\n        is_zero_values = true;\n      }\n    }\n\n    if (is_zero_values)\n    {\n      result_number_p[first_cell] += 1;\n\n      if (result_number_p[first_cell] == 0)\n      {\n        do\n        {\n          result_number_p[++first_cell] += 1;\n        } while (first_cell != equal_bits);\n\n        first_cell = last_cell_negative;\n      }\n    }\n\n    result_number_p[-1] &= mask;\n    uint32_t surplus = (uint32_t) (min_size - exact_size) / sizeof (ecma_char_t);\n    uint32_t new_size = result_p->u.bigint_sign_and_size;\n\n    if ((min_size - exact_size) % (sizeof (ecma_char_t)) > 0 && surplus == 0)\n    {\n      surplus += (uint32_t) sizeof (ecma_char_t);\n    }\n    else\n    {\n      surplus = (uint32_t) (surplus * sizeof (ecma_char_t));\n    }\n\n    if (min_size / JERRY_BITSINBYTE < 1)\n    {\n      surplus = 0;\n    }\n\n    if (is_signed)\n    {\n      if (result_p->u.bigint_sign_and_size > exact_size && min_size > sizeof (uint32_t)\n          && result_number_p[last_cell_negative] < 1)\n      {\n        new_size -= surplus;\n      }\n\n      new_size += 1;\n\n      if (is_positive || ((digits_p[-1] & check_sign_mask) == 0 && !input_bigint_sign))\n      {\n        new_size -= 1;\n      }\n    }\n\n    while (first_cell != 0 && result_number_p[first_cell] == 0)\n    {\n      first_cell++;\n    }\n\n    if (first_cell == 0)\n    {\n      ecma_deref_bigint (result_p);\n      ecma_deref_bigint (input_bigint_p);\n\n      return ECMA_BIGINT_ZERO;\n    }\n\n    last_cell_negative = first_cell + (int32_t) last_cell;\n    int16_t zero_section_cnt = 0;\n\n    while (last_cell_negative > first_cell)\n    {\n      if (result_number_p[last_cell_negative] == 0)\n      {\n        zero_section_cnt++;\n      }\n\n      last_cell_negative--;\n    }\n\n    uint32_t size_limit = sizeof (uint32_t);\n\n    if (zero_section_cnt >= 1)\n    {\n      size_limit = new_size - (uint32_t) zero_section_cnt * size_limit;\n      new_size = (size_limit < sizeof (uint32_t)) ? (uint32_t) (JERRY_BITSINBYTE - size_limit) : size_limit;\n    }\n\n    if (new_size < result_p->u.bigint_sign_and_size)\n    {\n      result_p->refs_and_type = ECMA_EXTENDED_PRIMITIVE_REF_ONE | ECMA_TYPE_BIGINT;\n      uint32_t new_size_remainder = new_size % sizeof (uint32_t);\n      ecma_extended_primitive_t *new_result_p = ecma_bigint_create (new_size - new_size_remainder);\n\n      new_result_p->u.bigint_sign_and_size += new_size_remainder;\n      memcpy (new_result_p + 1, result_p + 1, new_size - new_size_remainder);\n\n      ecma_deref_bigint (result_p);\n      ecma_deref_bigint (input_bigint_p);\n\n      return ecma_make_extended_primitive_value (new_result_p, ECMA_TYPE_BIGINT);\n    }\n\n    result_p->u.bigint_sign_and_size = new_size;\n    result_p->refs_and_type = ECMA_EXTENDED_PRIMITIVE_REF_ONE | ECMA_TYPE_BIGINT;\n\n    ecma_deref_bigint (input_bigint_p);\n    return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n  }\n\n  memcpy (result_p + 1, input_bigint_p + 1, exact_size);\n  result_p->refs_and_type = ECMA_EXTENDED_PRIMITIVE_REF_ONE | ECMA_TYPE_BIGINT;\n\n  if (input_bigint_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)\n  {\n    ecma_deref_bigint (input_bigint_p);\n    return ecma_bigint_negate (result_p);\n  }\n\n  ecma_deref_bigint (input_bigint_p);\n  return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n} /* ecma_builtin_bigint_object_as_int_n */\n\n/**\n * Handle calling [[Call]] of built-in BigInt object\n *\n * See also:\n *          ECMA-262 v11, 20.2.1.1\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_bigint_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                   uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  ecma_value_t value = (arguments_list_len == 0) ? ECMA_VALUE_UNDEFINED : arguments_list_p[0];\n  return ecma_bigint_to_bigint (value, true);\n} /* ecma_builtin_bigint_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in BigInt object\n *\n * See also:\n *          ECMA-262 v11, 20.2.1\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_bigint_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                        uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_BIGINT_FUNCTION_NOT_CONSTRUCTOR);\n} /* ecma_builtin_bigint_dispatch_construct */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_bigint_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                      ecma_value_t this_arg, /**< 'this' argument value */\n                                      const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                              *   passed to routine */\n                                      uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (this_arg, arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_BUILTIN_BIGINT_AS_INT_N:\n    {\n      return ecma_builtin_bigint_object_as_int_n (arguments_list_p[0], arguments_list_p[1], true);\n    }\n    case ECMA_BUILTIN_BIGINT_AS_U_INT_N:\n    {\n      return ecma_builtin_bigint_object_as_int_n (arguments_list_p[0], arguments_list_p[1], false);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_bigint_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-bigint.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * BigInt built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_BIGINT\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\n/* ECMA-262 v11, 20.2.1 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v11, 20.2.1 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_BIGINT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v11, 20.2.2.3 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_BIGINT_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\n\nROUTINE (LIT_MAGIC_STRING_AS_INT_N, ECMA_BUILTIN_BIGINT_AS_INT_N, 2, 2)\nROUTINE (LIT_MAGIC_STRING_AS_U_INT_N, ECMA_BUILTIN_BIGINT_AS_U_INT_N, 2, 2)\n#endif /* JERRY_BUILTIN_BIGINT */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_BOOLEAN\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BOOLEAN_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_BOOLEAN_PROTOTYPE_ROUTINE_TO_STRING,\n  ECMA_BOOLEAN_PROTOTYPE_ROUTINE_VALUE_OF\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-boolean-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  boolean_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup booleanprototype ECMA Boolean.prototype object built-in\n * @{\n */\n\n/**\n * The Boolean.prototype object's 'valueOf' routine\n *\n * See also:\n *          ECMA-262 v5, 15.6.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_boolean_prototype_object_value_of (ecma_value_t this_arg) /**< this argument */\n{\n  if (ecma_is_value_boolean (this_arg))\n  {\n    return this_arg;\n  }\n  else if (ecma_is_value_object (this_arg))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_BOOLEAN))\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      JERRY_ASSERT (ecma_is_value_boolean (ext_object_p->u.cls.u3.value));\n\n      return ext_object_p->u.cls.u3.value;\n    }\n  }\n\n  return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_BOOLEAN_OBJECT);\n} /* ecma_builtin_boolean_prototype_object_value_of */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_boolean_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine\n                                                                              *   identifier */\n                                                 ecma_value_t this_arg, /**< 'this' argument value */\n                                                 const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                         *   passed to routine */\n                                                 uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (arguments_number, arguments_list_p);\n\n  ecma_value_t value_of_ret = ecma_builtin_boolean_prototype_object_value_of (this_arg);\n  if (builtin_routine_id == ECMA_BOOLEAN_PROTOTYPE_ROUTINE_VALUE_OF)\n  {\n    return value_of_ret;\n  }\n\n  JERRY_ASSERT (builtin_routine_id == ECMA_BOOLEAN_PROTOTYPE_ROUTINE_TO_STRING);\n\n  if (ECMA_IS_VALUE_ERROR (value_of_ret))\n  {\n    return value_of_ret;\n  }\n\n  if (ecma_is_value_true (value_of_ret))\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING_TRUE);\n  }\n\n  JERRY_ASSERT (ecma_is_value_false (value_of_ret));\n\n  return ecma_make_magic_string_value (LIT_MAGIC_STRING_FALSE);\n} /* ecma_builtin_boolean_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_BOOLEAN */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Boolean.prototype description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_BOOLEAN\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.6.4.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_BOOLEAN, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_BOOLEAN_PROTOTYPE_ROUTINE_TO_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_BOOLEAN_PROTOTYPE_ROUTINE_VALUE_OF, 0, 0)\n\n#endif /* JERRY_BUILTIN_BOOLEAN */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-boolean-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_BOOLEAN\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-boolean.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  boolean\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup boolean ECMA Boolean object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in Boolean object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_boolean_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                    uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  ecma_value_t arg_value;\n\n  if (arguments_list_len == 0)\n  {\n    arg_value = ECMA_VALUE_UNDEFINED;\n  }\n  else\n  {\n    arg_value = arguments_list_p[0];\n  }\n\n  return ecma_make_boolean_value (ecma_op_to_boolean (arg_value));\n} /* ecma_builtin_boolean_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Boolean object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_boolean_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                         uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  if (arguments_list_len == 0)\n  {\n    return ecma_op_create_boolean_object (ECMA_VALUE_FALSE);\n  }\n  else\n  {\n    return ecma_op_create_boolean_object (arguments_list_p[0]);\n  }\n} /* ecma_builtin_boolean_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_BOOLEAN */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-boolean.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Boolean description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_BOOLEAN\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.6.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n/* Number properties:\n *  (property name, object pointer getter) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_BOOLEAN_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_BOOLEAN */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-dataview-object.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n\n#if JERRY_BUILTIN_DATAVIEW\n\n#if !JERRY_BUILTIN_TYPEDARRAY\n#error \"DataView builtin requires ES2015 TypedArray builtin\"\n#endif /* !JERRY_BUILTIN_TYPEDARRAY */\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_DATAVIEW_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER,\n  ECMA_DATAVIEW_PROTOTYPE_BYTE_LENGTH_GETTER,\n  ECMA_DATAVIEW_PROTOTYPE_BYTE_OFFSET_GETTER,\n  ECMA_DATAVIEW_PROTOTYPE_GET_INT8,\n  ECMA_DATAVIEW_PROTOTYPE_GET_UINT8,\n  ECMA_DATAVIEW_PROTOTYPE_GET_UINT8_CLAMPED, /* unused value */\n  ECMA_DATAVIEW_PROTOTYPE_GET_INT16,\n  ECMA_DATAVIEW_PROTOTYPE_GET_UINT16,\n  ECMA_DATAVIEW_PROTOTYPE_GET_INT32,\n  ECMA_DATAVIEW_PROTOTYPE_GET_UINT32,\n  ECMA_DATAVIEW_PROTOTYPE_GET_FLOAT32,\n#if JERRY_NUMBER_TYPE_FLOAT64\n  ECMA_DATAVIEW_PROTOTYPE_GET_FLOAT64,\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#if JERRY_BUILTIN_BIGINT\n  ECMA_DATAVIEW_PROTOTYPE_GET_BIGINT64,\n  ECMA_DATAVIEW_PROTOTYPE_GET_BIGUINT64,\n#endif /* JERRY_BUILTIN_BIGINT */\n  ECMA_DATAVIEW_PROTOTYPE_SET_INT8,\n  ECMA_DATAVIEW_PROTOTYPE_SET_UINT8,\n  ECMA_DATAVIEW_PROTOTYPE_SET_UINT8_CLAMPED, /* unused value */\n  ECMA_DATAVIEW_PROTOTYPE_SET_INT16,\n  ECMA_DATAVIEW_PROTOTYPE_SET_UINT16,\n  ECMA_DATAVIEW_PROTOTYPE_SET_INT32,\n  ECMA_DATAVIEW_PROTOTYPE_SET_UINT32,\n  ECMA_DATAVIEW_PROTOTYPE_SET_FLOAT32,\n#if JERRY_NUMBER_TYPE_FLOAT64\n  ECMA_DATAVIEW_PROTOTYPE_SET_FLOAT64,\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#if JERRY_BUILTIN_BIGINT\n  ECMA_DATAVIEW_PROTOTYPE_SET_BIGINT64,\n  ECMA_DATAVIEW_PROTOTYPE_SET_BIGUINT64,\n#endif /* JERRY_BUILTIN_BIGINT */\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-dataview-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  dataview_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup dataviewprototype ECMA DataView.prototype object built-in\n * @{\n */\n\n/**\n * The DataView.prototype object's {buffer, byteOffset, byteLength} getters\n *\n * See also:\n *          ECMA-262 v6, 24.2.4.1\n *          ECMA-262 v6, 24.2.4.2\n *          ECMA-262 v6, 24.2.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_dataview_prototype_object_getters (ecma_value_t this_arg, /**< this argument */\n                                                uint16_t builtin_routine_id) /**< built-in wide routine identifier */\n{\n  ecma_dataview_object_t *obj_p = ecma_op_dataview_get_object (this_arg);\n\n  if (JERRY_UNLIKELY (obj_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER:\n    {\n      ecma_object_t *buffer_p = obj_p->buffer_p;\n      ecma_ref_object (buffer_p);\n\n      return ecma_make_object_value (buffer_p);\n    }\n    case ECMA_DATAVIEW_PROTOTYPE_BYTE_LENGTH_GETTER:\n    {\n      if (ecma_arraybuffer_is_detached (obj_p->buffer_p))\n      {\n        return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n      }\n      return ecma_make_uint32_value (obj_p->header.u.cls.u3.length);\n    }\n    default:\n    {\n      JERRY_ASSERT (builtin_routine_id == ECMA_DATAVIEW_PROTOTYPE_BYTE_OFFSET_GETTER);\n\n      if (ecma_arraybuffer_is_detached (obj_p->buffer_p))\n      {\n        return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n      }\n      return ecma_make_uint32_value (obj_p->byte_offset);\n    }\n  }\n} /* ecma_builtin_dataview_prototype_object_getters */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_dataview_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                                  ecma_value_t this_arg, /**< 'this' argument value */\n                                                  const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                          *   passed to routine */\n                                                  uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n  switch (builtin_routine_id)\n  {\n    case ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER:\n    case ECMA_DATAVIEW_PROTOTYPE_BYTE_LENGTH_GETTER:\n    case ECMA_DATAVIEW_PROTOTYPE_BYTE_OFFSET_GETTER:\n    {\n      return ecma_builtin_dataview_prototype_object_getters (this_arg, builtin_routine_id);\n    }\n    case ECMA_DATAVIEW_PROTOTYPE_GET_FLOAT32:\n#if JERRY_NUMBER_TYPE_FLOAT64\n    case ECMA_DATAVIEW_PROTOTYPE_GET_FLOAT64:\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n    case ECMA_DATAVIEW_PROTOTYPE_GET_INT16:\n    case ECMA_DATAVIEW_PROTOTYPE_GET_INT32:\n    case ECMA_DATAVIEW_PROTOTYPE_GET_UINT16:\n    case ECMA_DATAVIEW_PROTOTYPE_GET_UINT32:\n#if JERRY_BUILTIN_BIGINT\n    case ECMA_DATAVIEW_PROTOTYPE_GET_BIGINT64:\n    case ECMA_DATAVIEW_PROTOTYPE_GET_BIGUINT64:\n#endif /* JERRY_BUILTIN_BIGINT */\n    {\n      ecma_typedarray_type_t id = (ecma_typedarray_type_t) (builtin_routine_id - ECMA_DATAVIEW_PROTOTYPE_GET_INT8);\n\n      return ecma_op_dataview_get_set_view_value (this_arg,\n                                                  arguments_list_p[0],\n                                                  arguments_list_p[1],\n                                                  ECMA_VALUE_EMPTY,\n                                                  id);\n    }\n    case ECMA_DATAVIEW_PROTOTYPE_SET_FLOAT32:\n#if JERRY_NUMBER_TYPE_FLOAT64\n    case ECMA_DATAVIEW_PROTOTYPE_SET_FLOAT64:\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n    case ECMA_DATAVIEW_PROTOTYPE_SET_INT16:\n    case ECMA_DATAVIEW_PROTOTYPE_SET_INT32:\n    case ECMA_DATAVIEW_PROTOTYPE_SET_UINT16:\n    case ECMA_DATAVIEW_PROTOTYPE_SET_UINT32:\n#if JERRY_BUILTIN_BIGINT\n    case ECMA_DATAVIEW_PROTOTYPE_SET_BIGINT64:\n    case ECMA_DATAVIEW_PROTOTYPE_SET_BIGUINT64:\n#endif /* JERRY_BUILTIN_BIGINT */\n    {\n      ecma_typedarray_type_t id = (ecma_typedarray_type_t) (builtin_routine_id - ECMA_DATAVIEW_PROTOTYPE_SET_INT8);\n\n      return ecma_op_dataview_get_set_view_value (this_arg,\n                                                  arguments_list_p[0],\n                                                  arguments_list_p[2],\n                                                  arguments_list_p[1],\n                                                  id);\n    }\n    case ECMA_DATAVIEW_PROTOTYPE_GET_INT8:\n    case ECMA_DATAVIEW_PROTOTYPE_GET_UINT8:\n    {\n      ecma_typedarray_type_t id = (ecma_typedarray_type_t) (builtin_routine_id - ECMA_DATAVIEW_PROTOTYPE_GET_INT8);\n\n      return ecma_op_dataview_get_set_view_value (this_arg,\n                                                  arguments_list_p[0],\n                                                  ECMA_VALUE_FALSE,\n                                                  ECMA_VALUE_EMPTY,\n                                                  id);\n    }\n    default:\n    {\n      JERRY_ASSERT (builtin_routine_id == ECMA_DATAVIEW_PROTOTYPE_SET_INT8\n                    || builtin_routine_id == ECMA_DATAVIEW_PROTOTYPE_SET_UINT8);\n      ecma_typedarray_type_t id = (ecma_typedarray_type_t) (builtin_routine_id - ECMA_DATAVIEW_PROTOTYPE_SET_INT8);\n\n      return ecma_op_dataview_get_set_view_value (this_arg,\n                                                  arguments_list_p[0],\n                                                  ECMA_VALUE_FALSE,\n                                                  arguments_list_p[1],\n                                                  id);\n    }\n  }\n} /* ecma_builtin_dataview_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_DATAVIEW */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * DataView.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_DATAVIEW\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 24.2.3 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_DATAVIEW, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 23.2.4.21 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_GET_FLOAT_32_UL, ECMA_DATAVIEW_PROTOTYPE_GET_FLOAT32, 2, 1)\n#if JERRY_NUMBER_TYPE_FLOAT64\nROUTINE (LIT_MAGIC_STRING_GET_FLOAT_64_UL, ECMA_DATAVIEW_PROTOTYPE_GET_FLOAT64, 2, 1)\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\nROUTINE (LIT_MAGIC_STRING_GET_INT8_UL, ECMA_DATAVIEW_PROTOTYPE_GET_INT8, 1, 1)\nROUTINE (LIT_MAGIC_STRING_GET_INT16_UL, ECMA_DATAVIEW_PROTOTYPE_GET_INT16, 2, 1)\nROUTINE (LIT_MAGIC_STRING_GET_INT32_UL, ECMA_DATAVIEW_PROTOTYPE_GET_INT32, 2, 1)\nROUTINE (LIT_MAGIC_STRING_GET_UINT8_UL, ECMA_DATAVIEW_PROTOTYPE_GET_UINT8, 2, 1)\nROUTINE (LIT_MAGIC_STRING_GET_UINT16_UL, ECMA_DATAVIEW_PROTOTYPE_GET_UINT16, 2, 1)\nROUTINE (LIT_MAGIC_STRING_GET_UINT32_UL, ECMA_DATAVIEW_PROTOTYPE_GET_UINT32, 2, 1)\nROUTINE (LIT_MAGIC_STRING_SET_FLOAT_32_UL, ECMA_DATAVIEW_PROTOTYPE_SET_FLOAT32, 2, 2)\n#if JERRY_NUMBER_TYPE_FLOAT64\nROUTINE (LIT_MAGIC_STRING_SET_FLOAT_64_UL, ECMA_DATAVIEW_PROTOTYPE_SET_FLOAT64, 2, 2)\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\nROUTINE (LIT_MAGIC_STRING_SET_INT8_UL, ECMA_DATAVIEW_PROTOTYPE_SET_INT8, 1, 2)\nROUTINE (LIT_MAGIC_STRING_SET_INT16_UL, ECMA_DATAVIEW_PROTOTYPE_SET_INT16, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SET_INT32_UL, ECMA_DATAVIEW_PROTOTYPE_SET_INT32, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SET_UINT8_UL, ECMA_DATAVIEW_PROTOTYPE_SET_UINT8, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SET_UINT16_UL, ECMA_DATAVIEW_PROTOTYPE_SET_UINT16, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SET_UINT32_UL, ECMA_DATAVIEW_PROTOTYPE_SET_UINT32, 2, 2)\n#if JERRY_BUILTIN_BIGINT\nROUTINE (LIT_MAGIC_STRING_GET_BIGINT64, ECMA_DATAVIEW_PROTOTYPE_GET_BIGINT64, 2, 1)\nROUTINE (LIT_MAGIC_STRING_GET_BIGUINT64, ECMA_DATAVIEW_PROTOTYPE_GET_BIGUINT64, 2, 1)\nROUTINE (LIT_MAGIC_STRING_SET_BIGINT64, ECMA_DATAVIEW_PROTOTYPE_SET_BIGINT64, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SET_BIGUINT64, ECMA_DATAVIEW_PROTOTYPE_SET_BIGUINT64, 2, 2)\n#endif /* JERRY_BUILTIN_BIGINT */\n\n/* ECMA-262 v6, 24.2.4.1 */\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BUFFER, ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 24.2.4.2 */\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,\n                    ECMA_DATAVIEW_PROTOTYPE_BYTE_LENGTH_GETTER,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 24.2.4.3 */\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_OFFSET_UL,\n                    ECMA_DATAVIEW_PROTOTYPE_BYTE_OFFSET_GETTER,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_DATAVIEW */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-dataview-object.h\"\n#include \"ecma-exceptions.h\"\n\n#if JERRY_BUILTIN_DATAVIEW\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-dataview.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  dataview\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup dataview ECMA DataView object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in DataView object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_dataview_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                     uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_DATAVIEW_REQUIRES_NEW);\n} /* ecma_builtin_dataview_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in DataView object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_dataview_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                          uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_op_dataview_create (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_dataview_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_DATAVIEW */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-dataview.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * DataView built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_DATAVIEW\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\n/* ECMA-262 v6, 23.1.2 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 23.1 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 23.1.2.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n#endif /* JERRY_BUILTIN_DATAVIEW */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <math.h>\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#if JERRY_BUILTIN_DATE\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * Checks whether the function uses UTC time zone.\n */\n#define BUILTIN_DATE_FUNCTION_IS_UTC(builtin_routine_id) \\\n  (((builtin_routine_id) -ECMA_DATE_PROTOTYPE_GET_FULL_YEAR) & 0x1)\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_DATE_PROTOTYPE_ROUTINE_START = 0,\n\n  ECMA_DATE_PROTOTYPE_GET_FULL_YEAR, /* ECMA-262 v5 15.9.5.10 */\n  ECMA_DATE_PROTOTYPE_GET_UTC_FULL_YEAR, /* ECMA-262 v5 15.9.5.11 */\n#if JERRY_BUILTIN_ANNEXB\n  ECMA_DATE_PROTOTYPE_GET_YEAR, /* ECMA-262 v5, AnnexB.B.2.4 */\n  ECMA_DATE_PROTOTYPE_GET_UTC_YEAR, /* has no UTC variant */\n#endif /* JERRY_BUILTIN_ANNEXB */\n  ECMA_DATE_PROTOTYPE_GET_MONTH, /* ECMA-262 v5 15.9.5.12 */\n  ECMA_DATE_PROTOTYPE_GET_UTC_MONTH, /* ECMA-262 v5 15.9.5.13 */\n  ECMA_DATE_PROTOTYPE_GET_DATE, /* ECMA-262 v5 15.9.5.14 */\n  ECMA_DATE_PROTOTYPE_GET_UTC_DATE, /* ECMA-262 v5 15.9.5.15 */\n  ECMA_DATE_PROTOTYPE_GET_DAY, /* ECMA-262 v5 15.9.5.16 */\n  ECMA_DATE_PROTOTYPE_GET_UTC_DAY, /* ECMA-262 v5 15.9.5.17 */\n  ECMA_DATE_PROTOTYPE_GET_HOURS, /* ECMA-262 v5 15.9.5.18 */\n  ECMA_DATE_PROTOTYPE_GET_UTC_HOURS, /* ECMA-262 v5 15.9.5.19 */\n  ECMA_DATE_PROTOTYPE_GET_MINUTES, /* ECMA-262 v5 15.9.5.20 */\n  ECMA_DATE_PROTOTYPE_GET_UTC_MINUTES, /* ECMA-262 v5 15.9.5.21 */\n  ECMA_DATE_PROTOTYPE_GET_SECONDS, /* ECMA-262 v5 15.9.5.22 */\n  ECMA_DATE_PROTOTYPE_GET_UTC_SECONDS, /* ECMA-262 v5 15.9.5.23 */\n  ECMA_DATE_PROTOTYPE_GET_MILLISECONDS, /* ECMA-262 v5 15.9.5.24 */\n  ECMA_DATE_PROTOTYPE_GET_UTC_MILLISECONDS, /* ECMA-262 v5 15.9.5.25 */\n  ECMA_DATE_PROTOTYPE_GET_TIMEZONE_OFFSET, /* has no local time zone variant */\n  ECMA_DATE_PROTOTYPE_GET_UTC_TIMEZONE_OFFSET, /* ECMA-262 v5 15.9.5.26 */\n\n  ECMA_DATE_PROTOTYPE_SET_FULL_YEAR, /* ECMA-262 v5, 15.9.5.40 */\n  ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR, /* ECMA-262 v5, 15.9.5.41 */\n#if JERRY_BUILTIN_ANNEXB\n  ECMA_DATE_PROTOTYPE_SET_YEAR, /* ECMA-262 v5, ECMA-262 v5, AnnexB.B.2.5 */\n  ECMA_DATE_PROTOTYPE_SET_UTC_YEAR, /* has no UTC variant */\n#endif /* JERRY_BUILTIN_ANNEXB */\n  ECMA_DATE_PROTOTYPE_SET_MONTH, /* ECMA-262 v5, 15.9.5.38 */\n  ECMA_DATE_PROTOTYPE_SET_UTC_MONTH, /* ECMA-262 v5, 15.9.5.39 */\n  ECMA_DATE_PROTOTYPE_SET_DATE, /* ECMA-262 v5, 15.9.5.36 */\n  ECMA_DATE_PROTOTYPE_SET_UTC_DATE, /* ECMA-262 v5, 15.9.5.37 */\n  ECMA_DATE_PROTOTYPE_SET_HOURS, /* ECMA-262 v5, 15.9.5.34 */\n  ECMA_DATE_PROTOTYPE_SET_UTC_HOURS, /* ECMA-262 v5, 15.9.5.35 */\n  ECMA_DATE_PROTOTYPE_SET_MINUTES, /* ECMA-262 v5, 15.9.5.32 */\n  ECMA_DATE_PROTOTYPE_SET_UTC_MINUTES, /* ECMA-262 v5, 15.9.5.33 */\n  ECMA_DATE_PROTOTYPE_SET_SECONDS, /* ECMA-262 v5, 15.9.5.30 */\n  ECMA_DATE_PROTOTYPE_SET_UTC_SECONDS, /* ECMA-262 v5, 15.9.5.31 */\n  ECMA_DATE_PROTOTYPE_SET_MILLISECONDS, /* ECMA-262 v5, 15.9.5.28 */\n  ECMA_DATE_PROTOTYPE_SET_UTC_MILLISECONDS, /* ECMA-262 v5, 15.9.5.29 */\n\n  ECMA_DATE_PROTOTYPE_TO_STRING, /* ECMA-262 v5, 15.9.5.2 */\n  ECMA_DATE_PROTOTYPE_TO_DATE_STRING, /* ECMA-262 v5, 15.9.5.3 */\n  ECMA_DATE_PROTOTYPE_TO_TIME_STRING, /* ECMA-262 v5, 15.9.5.4 */\n  ECMA_DATE_PROTOTYPE_TO_ISO_STRING, /* ECMA-262 v5, 15.9.5.43 */\n\n  ECMA_DATE_PROTOTYPE_GET_TIME, /* ECMA-262 v5, 15.9.5.9 */\n  ECMA_DATE_PROTOTYPE_SET_TIME, /* ECMA-262 v5, 15.9.5.27 */\n  ECMA_DATE_PROTOTYPE_TO_JSON, /* ECMA-262 v5, 15.9.5.44 */\n\n  ECMA_DATE_PROTOTYPE_TO_PRIMITIVE, /*  ECMA-262 v6 20.3.4.45 */\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-date-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  date_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup dateprototype ECMA Date.prototype object built-in\n * @{\n */\n\n/**\n * The Date.prototype object's 'toJSON' routine\n *\n * See also:\n *          ECMA-262 v5, 15.9.5.44\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_date_prototype_to_json (ecma_value_t this_arg) /**< this argument */\n{\n  /* 1. */\n  ecma_value_t obj = ecma_op_to_object (this_arg);\n\n  if (ECMA_IS_VALUE_ERROR (obj))\n  {\n    return obj;\n  }\n\n  /* 2. */\n  ecma_value_t tv = ecma_op_to_primitive (obj, ECMA_PREFERRED_TYPE_NUMBER);\n\n  if (ECMA_IS_VALUE_ERROR (tv))\n  {\n    ecma_free_value (obj);\n    return tv;\n  }\n\n  /* 3. */\n  if (ecma_is_value_number (tv))\n  {\n    ecma_number_t num_value = ecma_get_number_from_value (tv);\n\n    ecma_free_value (tv);\n\n    if (ecma_number_is_nan (num_value) || ecma_number_is_infinity (num_value))\n    {\n      ecma_free_value (obj);\n      return ECMA_VALUE_NULL;\n    }\n  }\n  else\n  {\n    ecma_free_value (tv);\n  }\n\n  ecma_object_t *value_obj_p = ecma_get_object_from_value (obj);\n\n  /* 4. */\n  ecma_value_t ret_value = ecma_op_invoke_by_magic_id (obj, LIT_MAGIC_STRING_TO_ISO_STRING_UL, NULL, 0);\n\n  ecma_deref_object (value_obj_p);\n\n  return ret_value;\n} /* ecma_builtin_date_prototype_to_json */\n\n/**\n * The Date.prototype object's toPrimitive routine\n *\n * See also:\n *          ECMA-262 v6, 20.3.4.45\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_date_prototype_to_primitive (ecma_value_t this_arg, /**< this argument */\n                                          ecma_value_t hint_arg) /**< {\"default\", \"number\", \"string\"} */\n{\n  if (ecma_is_value_object (this_arg) && ecma_is_value_string (hint_arg))\n  {\n    ecma_string_t *hint_str_p = ecma_get_string_from_value (hint_arg);\n\n    ecma_preferred_type_hint_t hint = ECMA_PREFERRED_TYPE_NO;\n\n    if (hint_str_p == ecma_get_magic_string (LIT_MAGIC_STRING_STRING)\n        || hint_str_p == ecma_get_magic_string (LIT_MAGIC_STRING_DEFAULT))\n    {\n      hint = ECMA_PREFERRED_TYPE_STRING;\n    }\n    else if (hint_str_p == ecma_get_magic_string (LIT_MAGIC_STRING_NUMBER))\n    {\n      hint = ECMA_PREFERRED_TYPE_NUMBER;\n    }\n\n    if (hint != ECMA_PREFERRED_TYPE_NO)\n    {\n      return ecma_op_general_object_ordinary_value (ecma_get_object_from_value (this_arg), hint);\n    }\n  }\n\n  return ecma_raise_type_error (ECMA_ERR_INVALID_ARGUMENT_TYPE_IN_TOPRIMITIVE);\n} /* ecma_builtin_date_prototype_to_primitive */\n\n/**\n * Dispatch get date functions\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_date_prototype_dispatch_get (uint16_t builtin_routine_id, /**< built-in wide routine\n                                                                        *   identifier */\n                                          ecma_number_t date_value) /**< date converted to number */\n{\n  if (ecma_number_is_nan (date_value))\n  {\n    return ecma_make_nan_value ();\n  }\n\n  int32_t result;\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_DATE_PROTOTYPE_GET_FULL_YEAR:\n    case ECMA_DATE_PROTOTYPE_GET_UTC_FULL_YEAR:\n    {\n      result = ecma_date_year_from_time (date_value);\n      break;\n    }\n#if JERRY_BUILTIN_ANNEXB\n    case ECMA_DATE_PROTOTYPE_GET_YEAR:\n    {\n      result = (ecma_date_year_from_time (date_value) - 1900);\n      break;\n    }\n#endif /* JERRY_BUILTIN_ANNEXB */\n    case ECMA_DATE_PROTOTYPE_GET_MONTH:\n    case ECMA_DATE_PROTOTYPE_GET_UTC_MONTH:\n    {\n      result = ecma_date_month_from_time (date_value);\n      break;\n    }\n    case ECMA_DATE_PROTOTYPE_GET_DATE:\n    case ECMA_DATE_PROTOTYPE_GET_UTC_DATE:\n    {\n      result = ecma_date_date_from_time (date_value);\n      break;\n    }\n    case ECMA_DATE_PROTOTYPE_GET_DAY:\n    case ECMA_DATE_PROTOTYPE_GET_UTC_DAY:\n    {\n      result = ecma_date_week_day (date_value);\n      break;\n    }\n    case ECMA_DATE_PROTOTYPE_GET_HOURS:\n    case ECMA_DATE_PROTOTYPE_GET_UTC_HOURS:\n    {\n      result = ecma_date_hour_from_time (date_value);\n      break;\n    }\n    case ECMA_DATE_PROTOTYPE_GET_MINUTES:\n    case ECMA_DATE_PROTOTYPE_GET_UTC_MINUTES:\n    {\n      result = ecma_date_min_from_time (date_value);\n      break;\n    }\n    case ECMA_DATE_PROTOTYPE_GET_SECONDS:\n    case ECMA_DATE_PROTOTYPE_GET_UTC_SECONDS:\n    {\n      result = ecma_date_sec_from_time (date_value);\n      break;\n    }\n    case ECMA_DATE_PROTOTYPE_GET_MILLISECONDS:\n    case ECMA_DATE_PROTOTYPE_GET_UTC_MILLISECONDS:\n    {\n      result = ecma_date_ms_from_time (date_value);\n      break;\n    }\n    default:\n    {\n      JERRY_ASSERT (builtin_routine_id == ECMA_DATE_PROTOTYPE_GET_UTC_TIMEZONE_OFFSET);\n\n      result = -ecma_date_local_time_zone_adjustment (date_value) / ECMA_DATE_MS_PER_MINUTE;\n      break;\n    }\n  }\n\n  return ecma_make_int32_value (result);\n} /* ecma_builtin_date_prototype_dispatch_get */\n\n#if JERRY_BUILTIN_ANNEXB\n\n/**\n * Returns true, if the built-in id sets a year.\n */\n#define ECMA_DATE_PROTOTYPE_IS_SET_YEAR_ROUTINE(builtin_routine_id) \\\n  ((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR        \\\n   || (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR \\\n   || (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_YEAR)\n\n#else /* !JERRY_BUILTIN_ANNEXB */\n\n/**\n * Returns true, if the built-in id sets a year.\n */\n#define ECMA_DATE_PROTOTYPE_IS_SET_YEAR_ROUTINE(builtin_routine_id) \\\n  ((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR        \\\n   || (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR)\n\n#endif /* JERRY_BUILTIN_ANNEXB */\n\n/**\n * Dispatch set date functions\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_date_prototype_dispatch_set (uint16_t builtin_routine_id, /**< built-in wide routine\n                                                                        *   identifier */\n                                          ecma_object_t *object_p, /**< date object */\n                                          const ecma_value_t arguments_list[], /**< list of arguments\n                                                                                *   passed to routine */\n                                          uint32_t arguments_number) /**< length of arguments' list */\n{\n  ecma_number_t converted_number[4];\n  uint32_t conversions = 0;\n\n  /* If the first argument is not specified, it is always converted to NaN. */\n  converted_number[0] = ecma_number_make_nan ();\n\n  switch (builtin_routine_id)\n  {\n#if JERRY_BUILTIN_ANNEXB\n    case ECMA_DATE_PROTOTYPE_SET_YEAR:\n#endif /* JERRY_BUILTIN_ANNEXB */\n    case ECMA_DATE_PROTOTYPE_SET_DATE:\n    case ECMA_DATE_PROTOTYPE_SET_UTC_DATE:\n    case ECMA_DATE_PROTOTYPE_SET_UTC_MILLISECONDS:\n    case ECMA_DATE_PROTOTYPE_SET_MILLISECONDS:\n    {\n      conversions = 1;\n      break;\n    }\n    case ECMA_DATE_PROTOTYPE_SET_MONTH:\n    case ECMA_DATE_PROTOTYPE_SET_UTC_MONTH:\n    case ECMA_DATE_PROTOTYPE_SET_UTC_SECONDS:\n    case ECMA_DATE_PROTOTYPE_SET_SECONDS:\n    {\n      conversions = 2;\n      break;\n    }\n    case ECMA_DATE_PROTOTYPE_SET_FULL_YEAR:\n    case ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR:\n    case ECMA_DATE_PROTOTYPE_SET_MINUTES:\n    case ECMA_DATE_PROTOTYPE_SET_UTC_MINUTES:\n    {\n      conversions = 3;\n      break;\n    }\n    default:\n    {\n      JERRY_ASSERT (builtin_routine_id == ECMA_DATE_PROTOTYPE_SET_HOURS\n                    || builtin_routine_id == ECMA_DATE_PROTOTYPE_SET_UTC_HOURS);\n\n      conversions = 4;\n      break;\n    }\n  }\n\n  if (conversions > arguments_number)\n  {\n    conversions = arguments_number;\n  }\n\n  for (uint32_t i = 0; i < conversions; i++)\n  {\n    ecma_value_t value = ecma_op_to_number (arguments_list[i], &converted_number[i]);\n\n    if (ECMA_IS_VALUE_ERROR (value))\n    {\n      return value;\n    }\n  }\n\n  ecma_date_object_t *date_object_p = (ecma_date_object_t *) object_p;\n  ecma_number_t *date_value_p = &date_object_p->date_value;\n  ecma_number_t date_value = *date_value_p;\n\n  if (!BUILTIN_DATE_FUNCTION_IS_UTC (builtin_routine_id))\n  {\n    ecma_number_t local_tza;\n\n    if (date_object_p->header.u.cls.u1.date_flags & ECMA_DATE_TZA_SET)\n    {\n      local_tza = date_object_p->header.u.cls.u3.tza;\n      JERRY_ASSERT (local_tza == ecma_date_local_time_zone_adjustment (date_value));\n    }\n    else\n    {\n      local_tza = ecma_date_local_time_zone_adjustment (date_value);\n    }\n\n    date_value += local_tza;\n  }\n\n  ecma_number_t day_part;\n  ecma_number_t time_part;\n\n  if (builtin_routine_id <= ECMA_DATE_PROTOTYPE_SET_UTC_DATE)\n  {\n    if (ecma_number_is_nan (date_value))\n    {\n      if (!ECMA_DATE_PROTOTYPE_IS_SET_YEAR_ROUTINE (builtin_routine_id))\n      {\n        return ecma_make_number_value (date_value);\n      }\n\n      date_value = ECMA_NUMBER_ZERO;\n    }\n\n    time_part = ecma_date_time_in_day_from_time (date_value);\n\n    ecma_number_t year = ecma_date_year_from_time (date_value);\n    ecma_number_t month = ecma_date_month_from_time (date_value);\n    ecma_number_t day = ecma_date_date_from_time (date_value);\n\n    switch (builtin_routine_id)\n    {\n      case ECMA_DATE_PROTOTYPE_SET_FULL_YEAR:\n      case ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR:\n      {\n        year = converted_number[0];\n        if (conversions >= 2)\n        {\n          month = converted_number[1];\n        }\n        if (conversions >= 3)\n        {\n          day = converted_number[2];\n        }\n        break;\n      }\n#if JERRY_BUILTIN_ANNEXB\n      case ECMA_DATE_PROTOTYPE_SET_YEAR:\n      {\n        if (ecma_number_is_nan (converted_number[0]))\n        {\n          *date_value_p = converted_number[0];\n          date_object_p->header.u.cls.u1.date_flags &= (uint8_t) ~ECMA_DATE_TZA_SET;\n          return ecma_make_number_value (converted_number[0]);\n        }\n\n        year = ecma_number_trunc (converted_number[0]);\n        if (year >= 0 && year <= 99)\n        {\n          year += 1900;\n        }\n        break;\n      }\n#endif /* JERRY_BUILTIN_ANNEXB */\n      case ECMA_DATE_PROTOTYPE_SET_MONTH:\n      case ECMA_DATE_PROTOTYPE_SET_UTC_MONTH:\n      {\n        month = converted_number[0];\n        if (conversions >= 2)\n        {\n          day = converted_number[1];\n        }\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (builtin_routine_id == ECMA_DATE_PROTOTYPE_SET_DATE\n                      || builtin_routine_id == ECMA_DATE_PROTOTYPE_SET_UTC_DATE);\n\n        day = converted_number[0];\n        break;\n      }\n    }\n\n    day_part = ecma_date_make_day (year, month, day);\n\n#if JERRY_BUILTIN_ANNEXB\n    if (builtin_routine_id == ECMA_DATE_PROTOTYPE_SET_YEAR)\n    {\n      if (ecma_number_is_nan (converted_number[0]))\n      {\n        day_part = 0;\n        time_part = converted_number[0];\n      }\n    }\n#endif /* JERRY_BUILTIN_ANNEXB */\n  }\n  else\n  {\n    if (ecma_number_is_nan (date_value))\n    {\n      return ecma_make_number_value (date_value);\n    }\n\n    day_part = ecma_date_day_from_time (date_value) * (ecma_number_t) ECMA_DATE_MS_PER_DAY;\n\n    ecma_number_t hour = ecma_date_hour_from_time (date_value);\n    ecma_number_t min = ecma_date_min_from_time (date_value);\n    ecma_number_t sec = ecma_date_sec_from_time (date_value);\n    ecma_number_t ms = ecma_date_ms_from_time (date_value);\n\n    switch (builtin_routine_id)\n    {\n      case ECMA_DATE_PROTOTYPE_SET_HOURS:\n      case ECMA_DATE_PROTOTYPE_SET_UTC_HOURS:\n      {\n        hour = converted_number[0];\n        if (conversions >= 2)\n        {\n          min = converted_number[1];\n        }\n        if (conversions >= 3)\n        {\n          sec = converted_number[2];\n        }\n        if (conversions >= 4)\n        {\n          ms = converted_number[3];\n        }\n        break;\n      }\n      case ECMA_DATE_PROTOTYPE_SET_MINUTES:\n      case ECMA_DATE_PROTOTYPE_SET_UTC_MINUTES:\n      {\n        min = converted_number[0];\n        if (conversions >= 2)\n        {\n          sec = converted_number[1];\n        }\n        if (conversions >= 3)\n        {\n          ms = converted_number[2];\n        }\n        break;\n      }\n      case ECMA_DATE_PROTOTYPE_SET_UTC_SECONDS:\n      case ECMA_DATE_PROTOTYPE_SET_SECONDS:\n      {\n        sec = converted_number[0];\n        if (conversions >= 2)\n        {\n          ms = converted_number[1];\n        }\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (builtin_routine_id == ECMA_DATE_PROTOTYPE_SET_UTC_MILLISECONDS\n                      || builtin_routine_id == ECMA_DATE_PROTOTYPE_SET_MILLISECONDS);\n\n        ms = converted_number[0];\n        break;\n      }\n    }\n\n    time_part = ecma_date_make_time (hour, min, sec, ms);\n  }\n\n  bool is_utc = BUILTIN_DATE_FUNCTION_IS_UTC (builtin_routine_id);\n\n  ecma_number_t full_date = ecma_date_make_date (day_part, time_part);\n\n  if (!is_utc)\n  {\n    full_date = ecma_date_utc (full_date);\n  }\n\n  full_date = ecma_date_time_clip (full_date);\n\n  *date_value_p = full_date;\n\n  date_object_p->header.u.cls.u1.date_flags &= (uint8_t) ~ECMA_DATE_TZA_SET;\n\n  return ecma_make_number_value (full_date);\n} /* ecma_builtin_date_prototype_dispatch_set */\n\n#undef ECMA_DATE_PROTOTYPE_IS_SET_YEAR_ROUTINE\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine\n                                                                           *   identifier */\n                                              ecma_value_t this_arg, /**< 'this' argument value */\n                                              const ecma_value_t arguments_list[], /**< list of arguments\n                                                                                    *   passed to routine */\n                                              uint32_t arguments_number) /**< length of arguments' list */\n{\n  if (JERRY_UNLIKELY (builtin_routine_id == ECMA_DATE_PROTOTYPE_TO_JSON))\n  {\n    return ecma_builtin_date_prototype_to_json (this_arg);\n  }\n\n  if (JERRY_UNLIKELY (builtin_routine_id == ECMA_DATE_PROTOTYPE_TO_PRIMITIVE))\n  {\n    return ecma_builtin_date_prototype_to_primitive (this_arg, arguments_list[0]);\n  }\n\n  if (!ecma_is_value_object (this_arg)\n      || !ecma_object_class_is (ecma_get_object_from_value (this_arg), ECMA_OBJECT_CLASS_DATE))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_DATE_OBJECT);\n  }\n\n  ecma_object_t *this_obj_p = ecma_get_object_from_value (this_arg);\n\n  ecma_date_object_t *date_object_p = (ecma_date_object_t *) this_obj_p;\n  ecma_number_t *date_value_p = &date_object_p->date_value;\n  ecma_number_t date_value = *date_value_p;\n\n  if (builtin_routine_id == ECMA_DATE_PROTOTYPE_GET_TIME)\n  {\n    return ecma_make_number_value (date_value);\n  }\n\n  if (builtin_routine_id == ECMA_DATE_PROTOTYPE_SET_TIME)\n  {\n    ecma_number_t time_num;\n\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (arguments_list[0], &time_num)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    *date_value_p = ecma_date_time_clip (time_num);\n    date_object_p->header.u.cls.u1.date_flags &= (uint8_t) ~ECMA_DATE_TZA_SET;\n\n    return ecma_make_number_value (*date_value_p);\n  }\n\n  if (builtin_routine_id <= ECMA_DATE_PROTOTYPE_SET_UTC_MILLISECONDS)\n  {\n    if (builtin_routine_id <= ECMA_DATE_PROTOTYPE_GET_UTC_TIMEZONE_OFFSET)\n    {\n      if (!BUILTIN_DATE_FUNCTION_IS_UTC (builtin_routine_id))\n      {\n        ecma_number_t local_tza;\n\n        if (date_object_p->header.u.cls.u1.date_flags & ECMA_DATE_TZA_SET)\n        {\n          local_tza = date_object_p->header.u.cls.u3.tza;\n          JERRY_ASSERT (local_tza == ecma_date_local_time_zone_adjustment (date_value));\n        }\n        else\n        {\n          local_tza = ecma_date_local_time_zone_adjustment (date_value);\n          JERRY_ASSERT (local_tza <= INT32_MAX && local_tza >= INT32_MIN);\n          date_object_p->header.u.cls.u3.tza = (int32_t) local_tza;\n          date_object_p->header.u.cls.u1.date_flags |= ECMA_DATE_TZA_SET;\n        }\n\n        date_value += local_tza;\n      }\n\n      return ecma_builtin_date_prototype_dispatch_get (builtin_routine_id, date_value);\n    }\n\n    return ecma_builtin_date_prototype_dispatch_set (builtin_routine_id, this_obj_p, arguments_list, arguments_number);\n  }\n\n  if (builtin_routine_id == ECMA_DATE_PROTOTYPE_TO_ISO_STRING)\n  {\n    if (ecma_number_is_nan (date_value))\n    {\n      return ecma_raise_range_error (ECMA_ERR_DATE_MUST_BE_A_FINITE_NUMBER);\n    }\n\n    return ecma_date_value_to_iso_string (date_value);\n  }\n\n  if (ecma_number_is_nan (date_value))\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING_INVALID_DATE_UL);\n  }\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_DATE_PROTOTYPE_TO_STRING:\n    {\n      return ecma_date_value_to_string (date_value);\n    }\n    case ECMA_DATE_PROTOTYPE_TO_DATE_STRING:\n    {\n      return ecma_date_value_to_date_string (date_value);\n    }\n    default:\n    {\n      JERRY_ASSERT (builtin_routine_id == ECMA_DATE_PROTOTYPE_TO_TIME_STRING);\n\n      return ecma_date_value_to_time_string (date_value);\n    }\n  }\n} /* ecma_builtin_date_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_DATE */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Date.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_DATE\n\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_DATE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_DATE_PROTOTYPE_TO_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_DATE_STRING_UL, ECMA_DATE_PROTOTYPE_TO_DATE_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_TIME_STRING_UL, ECMA_DATE_PROTOTYPE_TO_TIME_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_DATE_PROTOTYPE_TO_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_LOCALE_DATE_STRING_UL, ECMA_DATE_PROTOTYPE_TO_DATE_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_LOCALE_TIME_STRING_UL, ECMA_DATE_PROTOTYPE_TO_TIME_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_DATE_PROTOTYPE_GET_TIME, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_TIME_UL, ECMA_DATE_PROTOTYPE_GET_TIME, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_FULL_YEAR_UL, ECMA_DATE_PROTOTYPE_GET_FULL_YEAR, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_UTC_FULL_YEAR_UL, ECMA_DATE_PROTOTYPE_GET_UTC_FULL_YEAR, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_MONTH_UL, ECMA_DATE_PROTOTYPE_GET_MONTH, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_UTC_MONTH_UL, ECMA_DATE_PROTOTYPE_GET_UTC_MONTH, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_DATE_UL, ECMA_DATE_PROTOTYPE_GET_DATE, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_UTC_DATE_UL, ECMA_DATE_PROTOTYPE_GET_UTC_DATE, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_DAY_UL, ECMA_DATE_PROTOTYPE_GET_DAY, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_UTC_DAY_UL, ECMA_DATE_PROTOTYPE_GET_UTC_DAY, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_HOURS_UL, ECMA_DATE_PROTOTYPE_GET_HOURS, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_UTC_HOURS_UL, ECMA_DATE_PROTOTYPE_GET_UTC_HOURS, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_MINUTES_UL, ECMA_DATE_PROTOTYPE_GET_MINUTES, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_UTC_MINUTES_UL, ECMA_DATE_PROTOTYPE_GET_UTC_MINUTES, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_SECONDS_UL, ECMA_DATE_PROTOTYPE_GET_SECONDS, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_UTC_SECONDS_UL, ECMA_DATE_PROTOTYPE_GET_UTC_SECONDS, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_MILLISECONDS_UL, ECMA_DATE_PROTOTYPE_GET_MILLISECONDS, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_UTC_MILLISECONDS_UL, ECMA_DATE_PROTOTYPE_GET_UTC_MILLISECONDS, 0, 0)\nROUTINE (LIT_MAGIC_STRING_GET_TIMEZONE_OFFSET_UL, ECMA_DATE_PROTOTYPE_GET_UTC_TIMEZONE_OFFSET, 0, 0)\nROUTINE (LIT_MAGIC_STRING_SET_TIME_UL, ECMA_DATE_PROTOTYPE_SET_TIME, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SET_MILLISECONDS_UL, ECMA_DATE_PROTOTYPE_SET_MILLISECONDS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SET_UTC_MILLISECONDS_UL, ECMA_DATE_PROTOTYPE_SET_UTC_MILLISECONDS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SET_SECONDS_UL, ECMA_DATE_PROTOTYPE_SET_SECONDS, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SET_UTC_SECONDS_UL, ECMA_DATE_PROTOTYPE_SET_UTC_SECONDS, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SET_MINUTES_UL, ECMA_DATE_PROTOTYPE_SET_MINUTES, NON_FIXED, 3)\nROUTINE (LIT_MAGIC_STRING_SET_UTC_MINUTES_UL, ECMA_DATE_PROTOTYPE_SET_UTC_MINUTES, NON_FIXED, 3)\nROUTINE (LIT_MAGIC_STRING_SET_HOURS_UL, ECMA_DATE_PROTOTYPE_SET_HOURS, NON_FIXED, 4)\nROUTINE (LIT_MAGIC_STRING_SET_UTC_HOURS_UL, ECMA_DATE_PROTOTYPE_SET_UTC_HOURS, NON_FIXED, 4)\nROUTINE (LIT_MAGIC_STRING_SET_DATE_UL, ECMA_DATE_PROTOTYPE_SET_DATE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SET_UTC_DATE_UL, ECMA_DATE_PROTOTYPE_SET_UTC_DATE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SET_MONTH_UL, ECMA_DATE_PROTOTYPE_SET_MONTH, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SET_UTC_MONTH_UL, ECMA_DATE_PROTOTYPE_SET_UTC_MONTH, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SET_FULL_YEAR_UL, ECMA_DATE_PROTOTYPE_SET_FULL_YEAR, NON_FIXED, 3)\nROUTINE (LIT_MAGIC_STRING_SET_UTC_FULL_YEAR_UL, ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR, NON_FIXED, 3)\nROUTINE (LIT_MAGIC_STRING_TO_ISO_STRING_UL, ECMA_DATE_PROTOTYPE_TO_ISO_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_JSON_UL, ECMA_DATE_PROTOTYPE_TO_JSON, 1, 1)\nROUTINE_CONFIGURABLE_ONLY (LIT_GLOBAL_SYMBOL_TO_PRIMITIVE, ECMA_DATE_PROTOTYPE_TO_PRIMITIVE, 1, 1)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_UTC_STRING_UL,\n                    LIT_MAGIC_STRING_TO_UTC_STRING_UL,\n                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#if JERRY_BUILTIN_ANNEXB\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_GMT_STRING_UL,\n                    LIT_MAGIC_STRING_TO_UTC_STRING_UL,\n                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nROUTINE (LIT_MAGIC_STRING_GET_YEAR_UL, ECMA_DATE_PROTOTYPE_GET_YEAR, 0, 0)\nROUTINE (LIT_MAGIC_STRING_SET_YEAR_UL, ECMA_DATE_PROTOTYPE_SET_YEAR, 1, 1)\n\n#endif /* JERRY_BUILTIN_ANNEXB */\n\n#endif /* JERRY_BUILTIN_DATE */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-date.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <math.h>\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n#include \"jcontext.h\"\n#include \"lit-char-helpers.h\"\n\n#if JERRY_BUILTIN_DATE\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_DATE_ROUTINE_START = 0,\n  ECMA_DATE_ROUTINE_PARSE,\n  ECMA_DATE_ROUTINE_UTC,\n  ECMA_DATE_ROUTINE_NOW,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-date.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  date\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup date ECMA Date object built-in\n * @{\n */\n\n/**\n * Encode minimum/maximum limits\n *\n * See: ecma_date_parse_date_chars\n *\n * @param min: 8 bits unsigned number\n * @param max: 24 bits unsigned number\n */\n#define ECMA_DATE_LIMIT(min, max) (min << 24 | max)\n\n/**\n * Decode the minimum value from the encoded limit\n */\n#define ECMA_DATE_LIMIT_MIN(limit) (limit >> 24)\n\n/**\n * Decode the maximum value from the encoded limit\n */\n#define ECMA_DATE_LIMIT_MAX(limit) (limit & ((1 << 24) - 1))\n\n/**\n * Helper function to try to parse a part of a date string\n *\n * @return NaN if cannot read from string, ToNumber() otherwise\n */\nstatic ecma_number_t\necma_date_parse_date_chars (const lit_utf8_byte_t **str_p, /**< pointer to the cesu8 string */\n                            const lit_utf8_byte_t *str_end_p, /**< pointer to the end of the string */\n                            uint32_t num_of_chars, /**< number of characters to read and convert */\n                            uint32_t limit) /**< minimum/maximum valid value */\n{\n  JERRY_ASSERT (num_of_chars > 0 && num_of_chars <= 6);\n\n  if (*str_p + num_of_chars > str_end_p)\n  {\n    return ecma_number_make_nan ();\n  }\n\n  str_end_p = *str_p + num_of_chars;\n\n  uint32_t num = 0;\n\n  while (num_of_chars--)\n  {\n    lit_utf8_byte_t c = **str_p;\n    if (!lit_char_is_decimal_digit (c))\n    {\n      return ecma_number_make_nan ();\n    }\n\n    num = (num * 10) + (uint32_t) ((c - LIT_CHAR_0));\n    (*str_p)++;\n  }\n\n  if (num >= ECMA_DATE_LIMIT_MIN (limit) && num <= ECMA_DATE_LIMIT_MAX (limit))\n  {\n    return (ecma_number_t) num;\n  }\n\n  return ecma_number_make_nan ();\n} /* ecma_date_parse_date_chars */\n\n/**\n * Helper function to try to parse a special chracter (+,-,T,Z,:,.) in a date string\n *\n * @return true if the first character is same as the expected, false otherwise\n */\nstatic bool\necma_date_parse_special_char (const lit_utf8_byte_t **str_p, /**< pointer to the cesu8 string */\n                              const lit_utf8_byte_t *str_end_p, /**< pointer to the end of the string */\n                              ecma_char_t expected_char) /**< expected character */\n{\n  if ((*str_p < str_end_p) && (**str_p == expected_char))\n  {\n    (*str_p)++;\n    return true;\n  }\n\n  return false;\n} /* ecma_date_parse_special_char */\n\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\necma_date_check_two_chars (const lit_utf8_byte_t *str_p, /**< pointer to the cesu8 string */\n                           const lit_utf8_byte_t *str_end_p, /**< pointer to the end of the string */\n                           ecma_char_t expected_char1, /**< first expected character */\n                           ecma_char_t expected_char2) /**< second expected character */\n{\n  return (str_p < str_end_p && (*str_p == expected_char1 || *str_p == expected_char2));\n} /* ecma_date_check_two_chars */\n\n/**\n * Helper function to try to parse a 4-5-6 digit year with optional negative sign in a date string\n *\n * Date.prototype.toString() and Date.prototype.toUTCString() emits year\n * in this format and Date.parse() should parse this format too.\n *\n * @return the parsed year or NaN.\n */\nstatic ecma_number_t\necma_date_parse_year (const lit_utf8_byte_t **str_p, /**< pointer to the cesu8 string */\n                      const lit_utf8_byte_t *str_end_p) /**< pointer to the end of the string */\n{\n  bool is_year_sign_negative = ecma_date_parse_special_char (str_p, str_end_p, LIT_CHAR_MINUS);\n  const lit_utf8_byte_t *str_start_p = *str_p;\n  int32_t parsed_year = 0;\n\n  while ((str_start_p - *str_p < 6) && (str_start_p < str_end_p) && lit_char_is_decimal_digit (*str_start_p))\n  {\n    parsed_year = 10 * parsed_year + *str_start_p - LIT_CHAR_0;\n    str_start_p++;\n  }\n\n  if (str_start_p - *str_p >= 4)\n  {\n    *str_p = str_start_p;\n    return is_year_sign_negative ? -parsed_year : parsed_year;\n  }\n\n  return ecma_number_make_nan ();\n} /* ecma_date_parse_year */\n\n/**\n * Helper function to try to parse a day name in a date string\n * Valid day names: Sun, Mon, Tue, Wed, Thu, Fri, Sat\n * See also:\n *          ECMA-262 v9, 20.3.4.41.2 Table 46\n *\n * @return true if the string starts with a valid day name, false otherwise\n */\nstatic bool\necma_date_parse_day_name (const lit_utf8_byte_t **str_p, /**< pointer to the cesu8 string */\n                          const lit_utf8_byte_t *str_end_p) /**< pointer to the end of the string */\n{\n  if (*str_p + 3 < str_end_p)\n  {\n    for (uint32_t i = 0; i < 7; i++)\n    {\n      if (!memcmp (day_names_p[i], *str_p, 3))\n      {\n        (*str_p) += 3;\n        return true;\n      }\n    }\n  }\n  return false;\n} /* ecma_date_parse_day_name */\n\n/**\n * Helper function to try to parse a month name in a date string\n * Valid month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec\n * See also:\n *          ECMA-262 v9, 20.3.4.41.2 Table 47\n *\n * @return number of the month if the string starts with a valid month name, 0 otherwise\n */\nstatic uint32_t\necma_date_parse_month_name (const lit_utf8_byte_t **str_p, /**< pointer to the cesu8 string */\n                            const lit_utf8_byte_t *str_end_p) /**< pointer to the end of the string */\n{\n  if (*str_p + 3 < str_end_p)\n  {\n    for (uint32_t i = 0; i < 12; i++)\n    {\n      if (!memcmp (month_names_p[i], *str_p, 3))\n      {\n        (*str_p) += 3;\n        return (i + 1);\n      }\n    }\n  }\n  return 0;\n} /* ecma_date_parse_month_name */\n\n/**\n * Calculate MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)) for Date constructor and UTC\n *\n * See also:\n *          ECMA-262 v11, 20.4.3.4\n *\n * @return false - if the operation fails\n *         true - otherwise\n */\nstatic bool\necma_date_construct_helper (const ecma_value_t *args, /**< arguments passed to the Date constructor */\n                            uint32_t args_len, /**< number of arguments */\n                            ecma_number_t *tv_p) /**< [out] time value */\n{\n  ecma_number_t date_nums[7] = {\n    ECMA_NUMBER_ZERO, /* year */\n    ECMA_NUMBER_ZERO, /* month */\n    ECMA_NUMBER_ONE, /* date */\n    ECMA_NUMBER_ZERO, /* hours */\n    ECMA_NUMBER_ZERO, /* minutes */\n    ECMA_NUMBER_ZERO, /* seconds */\n    ECMA_NUMBER_ZERO /* miliseconds */\n  };\n\n  args_len = JERRY_MIN (args_len, sizeof (date_nums) / sizeof (date_nums[0]));\n\n  /* 1-7. */\n  for (uint32_t i = 0; i < args_len; i++)\n  {\n    ecma_value_t status = ecma_op_to_number (args[i], date_nums + i);\n\n    if (ECMA_IS_VALUE_ERROR (status))\n    {\n      return false;\n    }\n  }\n\n  /* 8. */\n  if (!ecma_number_is_nan (date_nums[0]))\n  {\n    /* 9.a */\n    ecma_number_t yi = ecma_number_trunc (date_nums[0]);\n\n    /* 9.b */\n    if (yi >= 0 && yi <= 99)\n    {\n      date_nums[0] = 1900 + yi;\n    }\n  }\n\n  /* 10. */\n  *tv_p = ecma_date_make_date (ecma_date_make_day (date_nums[0], date_nums[1], date_nums[2]),\n                               ecma_date_make_time (date_nums[3], date_nums[4], date_nums[5], date_nums[6]));\n  return true;\n} /* ecma_date_construct_helper */\n\n/**\n * Helper function used by ecma_builtin_date_parse\n *\n * See also:\n *          ECMA-262 v5, 15.9.4.2  Date.parse (string)\n *          ECMA-262 v5, 15.9.1.15 Date Time String Format\n *\n * @return the parsed date as ecma_number_t or NaN otherwise\n */\nstatic ecma_number_t\necma_builtin_date_parse_basic (const lit_utf8_byte_t *date_str_curr_p, /**< date string start */\n                               const lit_utf8_byte_t *date_str_end_p) /**< date string end */\n{\n  /* 1. read year */\n\n  uint32_t year_digits = 4;\n  uint32_t year_limit = 9999;\n\n  bool is_year_sign_negative = false;\n\n  if (ecma_date_check_two_chars (date_str_curr_p, date_str_end_p, LIT_CHAR_MINUS, LIT_CHAR_PLUS))\n  {\n    is_year_sign_negative = (*date_str_curr_p++ == LIT_CHAR_MINUS);\n    year_digits = 6;\n    year_limit = 999999;\n  }\n\n  ecma_number_t year =\n    ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, year_digits, ECMA_DATE_LIMIT (0, year_limit));\n  if (is_year_sign_negative)\n  {\n    year = -year;\n  }\n\n  if (ecma_number_is_nan (year))\n  {\n    return year;\n  }\n\n  ecma_number_t month = ECMA_NUMBER_ONE;\n  ecma_number_t day = ECMA_NUMBER_ONE;\n  ecma_number_t time = ECMA_NUMBER_ZERO;\n\n  /* 2. read month if any */\n  if (ecma_date_check_two_chars (date_str_curr_p, date_str_end_p, LIT_CHAR_MINUS, LIT_CHAR_SLASH))\n  {\n    lit_utf8_byte_t separator = *date_str_curr_p++;\n    month = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (1, 12));\n\n    /* 3. read day if any */\n    if (ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, separator))\n    {\n      day = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (1, 31));\n    }\n  }\n\n  bool is_utc = true;\n  /* 4. read time if any */\n  if (ecma_date_check_two_chars (date_str_curr_p, date_str_end_p, LIT_CHAR_UPPERCASE_T, LIT_CHAR_SP))\n  {\n    date_str_curr_p++;\n\n    ecma_number_t hours = ECMA_NUMBER_ZERO;\n    ecma_number_t minutes = ECMA_NUMBER_ZERO;\n    ecma_number_t seconds = ECMA_NUMBER_ZERO;\n    ecma_number_t milliseconds = ECMA_NUMBER_ZERO;\n\n    /* 'HH:mm' must present */\n    if (date_str_end_p - date_str_curr_p < 5)\n    {\n      return ecma_number_make_nan ();\n    }\n\n    /* 4.1 read hours and minutes */\n    hours = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 24));\n\n    if (!ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_COLON))\n    {\n      return ecma_number_make_nan ();\n    }\n\n    minutes = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 59));\n\n    /* 4.2 read seconds if any */\n    if (ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_COLON))\n    {\n      seconds = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 59));\n\n      /* 4.3 read milliseconds if any */\n      if (ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_DOT))\n      {\n        milliseconds = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 3, ECMA_DATE_LIMIT (0, 999));\n      }\n    }\n\n    if (hours == 24 && (minutes != 0 || seconds != 0 || milliseconds != 0))\n    {\n      return ecma_number_make_nan ();\n    }\n\n    time = ecma_date_make_time (hours, minutes, seconds, milliseconds);\n\n    if (ecma_number_is_nan (time))\n    {\n      return time;\n    }\n\n    /* 4.4 read timezone if any */\n    if (!ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_UPPERCASE_Z))\n    {\n      if ((date_str_end_p - date_str_curr_p) == 6\n          && (*date_str_curr_p == LIT_CHAR_MINUS || *date_str_curr_p == LIT_CHAR_PLUS))\n      {\n        bool is_timezone_sign_negative = (*date_str_curr_p++ == LIT_CHAR_MINUS);\n        /* read hours and minutes */\n        hours = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 24));\n\n        if (hours == 24)\n        {\n          hours = ECMA_NUMBER_ZERO;\n        }\n\n        if (!ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_COLON))\n        {\n          return ecma_number_make_nan ();\n        }\n\n        minutes = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 59));\n        ecma_number_t timezone_offset = ecma_date_make_time (hours, minutes, ECMA_NUMBER_ZERO, ECMA_NUMBER_ZERO);\n        time += is_timezone_sign_negative ? timezone_offset : -timezone_offset;\n      }\n      else\n      {\n        is_utc = false;\n      }\n    }\n  }\n\n  if (date_str_curr_p < date_str_end_p)\n  {\n    return ecma_number_make_nan ();\n  }\n\n  ecma_number_t date = ecma_date_make_day (year, month - 1, day);\n  ecma_number_t result_date = ecma_date_make_date (date, time);\n\n  if (!is_utc)\n  {\n    result_date = ecma_date_utc (result_date);\n  }\n\n  return result_date;\n} /* ecma_builtin_date_parse_basic */\n\n/**\n * Helper function used by ecma_builtin_date_parse\n *\n * See also:\n *          ECMA-262 v5, 15.9.4.2  Date.parse (string)\n *          ECMA-262 v9, 20.3.4.41 Date.prototype.toString ()\n *          ECMA-262 v9, 20.3.4.43 Date.prototype.toUTCString ()\n *\n * Used by: ecma_builtin_date_parse\n *\n * @return the parsed date as ecma_number_t or NaN otherwise\n */\nstatic ecma_number_t\necma_builtin_date_parse_toString_formats (const lit_utf8_byte_t *date_str_curr_p, const lit_utf8_byte_t *date_str_end_p)\n{\n  const ecma_number_t nan = ecma_number_make_nan ();\n\n  if (!ecma_date_parse_day_name (&date_str_curr_p, date_str_end_p))\n  {\n    return nan;\n  }\n\n  const bool is_toUTCString_format = ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_COMMA);\n\n  if (!ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_SP))\n  {\n    return nan;\n  }\n\n  ecma_number_t month = 0;\n  ecma_number_t day = 0;\n  if (is_toUTCString_format)\n  {\n    day = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 31));\n\n    if (ecma_number_is_nan (day))\n    {\n      return nan;\n    }\n\n    if (!ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_SP))\n    {\n      return nan;\n    }\n\n    month = ecma_date_parse_month_name (&date_str_curr_p, date_str_end_p);\n\n    if (month == 0)\n    {\n      return ecma_number_make_nan ();\n    }\n  }\n  else\n  {\n    month = ecma_date_parse_month_name (&date_str_curr_p, date_str_end_p);\n\n    if (month == 0)\n    {\n      return nan;\n    }\n\n    if (!ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_SP))\n    {\n      return nan;\n    }\n\n    day = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 31));\n\n    if (ecma_number_is_nan (day))\n    {\n      return nan;\n    }\n  }\n\n  if (!ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_SP))\n  {\n    return nan;\n  }\n\n  ecma_number_t year = ecma_date_parse_year (&date_str_curr_p, date_str_end_p);\n\n  if (ecma_number_is_nan (year))\n  {\n    return nan;\n  }\n\n  if (!ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_SP))\n  {\n    return nan;\n  }\n\n  ecma_number_t hours = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 24));\n\n  if (ecma_number_is_nan (hours))\n  {\n    return nan;\n  }\n\n  if (!ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_COLON))\n  {\n    return nan;\n  }\n\n  ecma_number_t minutes = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 59));\n\n  if (ecma_number_is_nan (minutes))\n  {\n    return nan;\n  }\n\n  if (!ecma_date_parse_special_char (&date_str_curr_p, date_str_end_p, LIT_CHAR_COLON))\n  {\n    return nan;\n  }\n\n  ecma_number_t seconds = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 59));\n\n  if (ecma_number_is_nan (seconds))\n  {\n    return nan;\n  }\n\n  if (hours == 24 && (minutes != 0 || seconds != 0))\n  {\n    return nan;\n  }\n\n  const char gmt_p[] = \" GMT\";\n  if (date_str_end_p - date_str_curr_p < 4 || memcmp (date_str_curr_p, gmt_p, 4) != 0)\n  {\n    return nan;\n  }\n\n  date_str_curr_p += 4;\n\n  ecma_number_t time = ecma_date_make_time (hours, minutes, seconds, 0);\n\n  if (!is_toUTCString_format)\n  {\n    if (!ecma_date_check_two_chars (date_str_curr_p, date_str_end_p, LIT_CHAR_MINUS, LIT_CHAR_PLUS))\n    {\n      return nan;\n    }\n\n    bool is_timezone_sign_negative = (*date_str_curr_p++ == LIT_CHAR_MINUS);\n\n    hours = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 24));\n\n    if (ecma_number_is_nan (hours))\n    {\n      return nan;\n    }\n\n    if (hours == 24)\n    {\n      hours = ECMA_NUMBER_ZERO;\n    }\n\n    minutes = ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, 2, ECMA_DATE_LIMIT (0, 59));\n\n    if (ecma_number_is_nan (minutes))\n    {\n      return nan;\n    }\n\n    ecma_number_t timezone_offset = ecma_date_make_time (hours, minutes, ECMA_NUMBER_ZERO, ECMA_NUMBER_ZERO);\n\n    time += is_timezone_sign_negative ? timezone_offset : -timezone_offset;\n  }\n\n  if (date_str_curr_p < date_str_end_p)\n  {\n    return nan;\n  }\n\n  ecma_number_t date = ecma_date_make_day (year, month - 1, day);\n  return ecma_date_make_date (date, time);\n} /* ecma_builtin_date_parse_toString_formats */\n\n/**\n * The Date object's 'parse' routine\n *\n * See also:\n *          ECMA-262 v5, 15.9.4.2  Date.parse (string)\n *          ECMA-262 v5, 15.9.1.15 Date Time String Format\n *          ECMA-262 v9, 20.3.4.41 Date.prototype.toString ()\n *          ECMA-262 v9, 20.3.4.43 Date.prototype.toUTCString ()\n *\n * @return parsed time\n */\nstatic ecma_number_t\necma_builtin_date_parse (ecma_string_t *string_p) /**< string */\n{\n  ECMA_STRING_TO_UTF8_STRING (string_p, str_p, str_size);\n  const lit_utf8_byte_t *date_str_curr_p = str_p;\n  const lit_utf8_byte_t *date_str_end_p = str_p + str_size;\n\n  /* try to parse date string as ISO string - ECMA-262 v5, 15.9.1.15 */\n  ecma_number_t tv = ecma_builtin_date_parse_basic (date_str_curr_p, date_str_end_p);\n\n  if (ecma_number_is_nan (tv))\n  {\n    /* try to parse date string in Date.prototype.toString() or toUTCString() format */\n    tv = ecma_builtin_date_parse_toString_formats (date_str_curr_p, date_str_end_p);\n  }\n\n  ECMA_FINALIZE_UTF8_STRING (str_p, str_size);\n\n  return tv;\n} /* ecma_builtin_date_parse */\n\n/**\n * The Date object's 'UTC' routine\n *\n * See also:\n *          ECMA-262 v5, 15.9.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_date_utc (const ecma_value_t args[], /**< arguments list */\n                       uint32_t args_number) /**< number of arguments */\n{\n  if (args_number < 1)\n  {\n    return ecma_make_nan_value ();\n  }\n\n  ecma_number_t tv;\n\n  if (!ecma_date_construct_helper (args, args_number, &tv))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  return ecma_make_number_value ((ecma_number_t) ecma_date_time_clip (tv));\n} /* ecma_builtin_date_utc */\n\n/**\n * Helper method to get the current time\n *\n * @return ecma_number_t\n */\nstatic ecma_number_t\necma_builtin_date_now_helper (void)\n{\n  return floor (DOUBLE_TO_ECMA_NUMBER_T (jerry_port_current_time ()));\n} /* ecma_builtin_date_now_helper */\n\n/**\n * Construct a date object with the given [[DateValue]]\n *\n * Note: New target must be a valid object\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         constructed date object - otherwise\n */\nstatic ecma_value_t\necma_builtin_date_create (ecma_number_t tv)\n{\n  JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) != NULL);\n\n  ecma_object_t *prototype_obj_p =\n    ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_DATE_PROTOTYPE);\n\n  if (JERRY_UNLIKELY (prototype_obj_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_object_t *obj_p = ecma_create_object (prototype_obj_p, sizeof (ecma_date_object_t), ECMA_OBJECT_TYPE_CLASS);\n  ecma_deref_object (prototype_obj_p);\n\n  ecma_date_object_t *date_object_p = (ecma_date_object_t *) obj_p;\n  date_object_p->header.u.cls.type = ECMA_OBJECT_CLASS_DATE;\n  date_object_p->header.u.cls.u1.date_flags = ECMA_DATE_TZA_NONE;\n  date_object_p->header.u.cls.u3.tza = 0;\n  date_object_p->date_value = tv;\n\n  return ecma_make_object_value (obj_p);\n} /* ecma_builtin_date_create */\n\n/**\n * Handle calling [[Call]] of built-in Date object\n *\n * See also:\n *          ECMA-262 v5, 15.9.2.1\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_date_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                 uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_UNUSED (arguments_list_p);\n  JERRY_UNUSED (arguments_list_len);\n\n  return ecma_date_value_to_string (ecma_builtin_date_now_helper ());\n} /* ecma_builtin_date_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Date object\n *\n * See also:\n *          ECMA-262 v5, 15.9.3.1\n *          ECMA-262 v11, 20.4.2\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_date_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                      uint32_t arguments_list_len) /**< number of arguments */\n{\n  /* 20.4.2.3 */\n  if (arguments_list_len == 0)\n  {\n    return ecma_builtin_date_create (ecma_builtin_date_now_helper ());\n  }\n\n  ecma_number_t tv;\n  /* 20.4.2.2 */\n  if (arguments_list_len == 1)\n  {\n    ecma_value_t argument = arguments_list_p[0];\n\n    /* 4.a */\n    if (ecma_is_value_object (argument)\n        && ecma_object_class_is (ecma_get_object_from_value (argument), ECMA_OBJECT_CLASS_DATE))\n    {\n      return ecma_builtin_date_create (((ecma_date_object_t *) ecma_get_object_from_value (argument))->date_value);\n    }\n    /* 4.b */\n    ecma_value_t primitive = ecma_op_to_primitive (argument, ECMA_PREFERRED_TYPE_NO);\n\n    if (ECMA_IS_VALUE_ERROR (primitive))\n    {\n      return primitive;\n    }\n\n    if (ecma_is_value_string (primitive))\n    {\n      ecma_string_t *prim_str_p = ecma_get_string_from_value (primitive);\n      tv = ecma_builtin_date_parse (prim_str_p);\n      ecma_deref_ecma_string (prim_str_p);\n    }\n    else\n    {\n      ecma_value_t prim_value = ecma_op_to_number (primitive, &tv);\n      ecma_free_value (primitive);\n\n      if (ECMA_IS_VALUE_ERROR (prim_value))\n      {\n        return prim_value;\n      }\n    }\n  }\n  /* 20.4.2.1 */\n  else if (ecma_date_construct_helper (arguments_list_p, arguments_list_len, &tv))\n  {\n    tv = ecma_date_utc (tv);\n  }\n  else\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  return ecma_builtin_date_create (ecma_date_time_clip (tv));\n} /* ecma_builtin_date_dispatch_construct */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_date_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine  identifier */\n                                    ecma_value_t this_arg, /**< 'this' argument value */\n                                    const ecma_value_t arguments_list_p[], /**< list of arguments passed to routine */\n                                    uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (this_arg);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_DATE_ROUTINE_NOW:\n    {\n      return ecma_make_number_value (ecma_builtin_date_now_helper ());\n    }\n    case ECMA_DATE_ROUTINE_UTC:\n    {\n      return ecma_builtin_date_utc (arguments_list_p, arguments_number);\n    }\n    case ECMA_DATE_ROUTINE_PARSE:\n    {\n      if (arguments_number < 1)\n      {\n        return ecma_make_nan_value ();\n      }\n\n      ecma_string_t *str_p = ecma_op_to_string (arguments_list_p[0]);\n\n      if (JERRY_UNLIKELY (str_p == NULL))\n      {\n        return ECMA_VALUE_ERROR;\n      }\n\n      ecma_value_t result = ecma_make_number_value (ecma_date_time_clip (ecma_builtin_date_parse (str_p)));\n      ecma_deref_ecma_string (str_p);\n\n      return result;\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_date_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_DATE */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-date.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Date built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_DATE\n\n/* ECMA-262 v5, 15.9.4.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_DATE_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 7, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\nROUTINE (LIT_MAGIC_STRING_PARSE, ECMA_DATE_ROUTINE_PARSE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_UTC_U, ECMA_DATE_ROUTINE_UTC, NON_FIXED, 7)\nROUTINE (LIT_MAGIC_STRING_NOW, ECMA_DATE_ROUTINE_NOW, 0, 0)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_DATE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_DATE */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jrt.h\"\n#include \"lit-char-helpers.h\"\n#include \"lit-magic-strings.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_ERROR_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_ERROR_PROTOTYPE_ROUTINE_TO_STRING,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-error-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  error_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup errorprototype ECMA Error.prototype object built-in\n * @{\n */\n\n/**\n * Helper method to get a property value from an error object\n *\n * @return ecma_string_t\n */\nstatic ecma_string_t *\necma_builtin_error_prototype_object_to_string_helper (ecma_object_t *obj_p, /**< error object */\n                                                      lit_magic_string_id_t property_id, /**< property id */\n                                                      lit_magic_string_id_t default_value) /**< default prop value */\n{\n  ecma_value_t prop_value = ecma_op_object_get_by_magic_id (obj_p, property_id);\n\n  if (ECMA_IS_VALUE_ERROR (prop_value))\n  {\n    return NULL;\n  }\n\n  if (ecma_is_value_undefined (prop_value))\n  {\n    return ecma_get_magic_string (default_value);\n  }\n\n  ecma_string_t *ret_str_p = ecma_op_to_string (prop_value);\n  ecma_free_value (prop_value);\n\n  return ret_str_p;\n} /* ecma_builtin_error_prototype_object_to_string_helper */\n\n/**\n * The Error.prototype object's 'toString' routine\n *\n * See also:\n *          ECMA-262 v5, 15.11.4.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this argument */\n{\n  /* 2. */\n  if (!ecma_is_value_object (this_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);\n\n  ecma_string_t *name_string_p =\n    ecma_builtin_error_prototype_object_to_string_helper (obj_p, LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL);\n\n  if (JERRY_UNLIKELY (name_string_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_string_t *msg_string_p =\n    ecma_builtin_error_prototype_object_to_string_helper (obj_p, LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY);\n\n  if (JERRY_UNLIKELY (msg_string_p == NULL))\n  {\n    ecma_deref_ecma_string (name_string_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_string_is_empty (name_string_p))\n  {\n    return ecma_make_string_value (msg_string_p);\n  }\n\n  if (ecma_string_is_empty (msg_string_p))\n  {\n    return ecma_make_string_value (name_string_p);\n  }\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (name_string_p);\n\n  ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) \": \", 2);\n  ecma_stringbuilder_append (&builder, msg_string_p);\n\n  ecma_deref_ecma_string (name_string_p);\n  ecma_deref_ecma_string (msg_string_p);\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_error_prototype_object_to_string */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_error_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine\n                                                                            *   identifier */\n                                               ecma_value_t this_arg, /**< 'this' argument value */\n                                               const ecma_value_t arguments_list_p[], /**< list of arguments passed to\n                                                                                       *  routine */\n                                               uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (arguments_number, arguments_list_p);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_ERROR_PROTOTYPE_ROUTINE_TO_STRING:\n    {\n      return ecma_builtin_error_prototype_object_to_string (this_arg);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_error_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Error.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.4.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.4.2 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.4.3 */\nSTRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_ERROR_PROTOTYPE_ROUTINE_TO_STRING, 0, 0)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-error.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-error.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  error\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup error ECMA Error object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in Error object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                  uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_helper_error_dispatch_call (JERRY_ERROR_COMMON, arguments_list_p, arguments_list_len);\n} /* ecma_builtin_error_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Error object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                       uint32_t arguments_list_len) /**< number of arguments */\n{\n  ecma_object_t *proto_p =\n    ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_ERROR_PROTOTYPE);\n\n  if (proto_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ecma_builtin_error_dispatch_call (arguments_list_p, arguments_list_len);\n\n  if (!ECMA_IS_VALUE_ERROR (result))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (result);\n    ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, proto_p);\n  }\n\n  ecma_deref_object (proto_p);\n\n  return result;\n} /* ecma_builtin_error_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-error.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Error built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.7.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-evalerror-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  eval_error_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * EvalError.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.7.8 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_EVAL_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.9 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.10 */\nSTRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-evalerror.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  eval_error\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup evalerror ECMA EvalError object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in EvalError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_eval_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                       uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_helper_error_dispatch_call (JERRY_ERROR_EVAL, arguments_list_p, arguments_list_len);\n} /* ecma_builtin_eval_error_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in EvalError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_eval_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                            uint32_t arguments_list_len) /**< number of arguments */\n{\n  ecma_object_t *proto_p =\n    ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE);\n\n  if (proto_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ecma_builtin_eval_error_dispatch_call (arguments_list_p, arguments_list_len);\n\n  if (!ECMA_IS_VALUE_ERROR (result))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (result);\n    ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, proto_p);\n  }\n\n  ecma_deref_object (proto_p);\n\n  return result;\n} /* ecma_builtin_eval_error_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * EvalError built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-function-prototype.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-extended-info.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-proxy-object.h\"\n\n#include \"jrt.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_FUNCTION_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_FUNCTION_PROTOTYPE_TO_STRING,\n  ECMA_FUNCTION_PROTOTYPE_CALL,\n  ECMA_FUNCTION_PROTOTYPE_APPLY,\n  ECMA_FUNCTION_PROTOTYPE_BIND,\n  ECMA_FUNCTION_PROTOTYPE_SYMBOL_HAS_INSTANCE,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-function-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  function_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup functionprototype ECMA Function.prototype object built-in\n * @{\n */\n\n/**\n * Maximum number of arguments for an apply function.\n */\n#define ECMA_FUNCTION_APPLY_ARGUMENT_COUNT_LIMIT 65535\n\n/**\n * The Function.prototype object's 'toString' routine\n *\n * See also:\n *          ECMA-262 v5, 15.3.4.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_function_prototype_object_to_string (ecma_object_t *func_obj_p) /**< this argument object */\n{\n  if (ecma_get_object_type (func_obj_p) != ECMA_OBJECT_TYPE_FUNCTION)\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE);\n  }\n\n#if JERRY_FUNCTION_TO_STRING\n  const ecma_compiled_code_t *bytecode_p;\n  bytecode_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) func_obj_p);\n\n  ecma_value_t script_value = ((cbc_uint8_arguments_t *) bytecode_p)->script_value;\n  cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n\n  if (bytecode_p->status_flags & CBC_CODE_FLAGS_HAS_EXTENDED_INFO)\n  {\n    uint8_t *extended_info_p = ecma_compiled_code_resolve_extended_info (bytecode_p);\n    uint8_t extended_info = *extended_info_p;\n\n    if (extended_info & CBC_EXTENDED_CODE_FLAGS_HAS_SOURCE_CODE_RANGE)\n    {\n      if (extended_info & CBC_EXTENDED_CODE_FLAGS_HAS_ARGUMENT_LENGTH)\n      {\n        ecma_extended_info_decode_vlq (&extended_info_p);\n      }\n\n      uint32_t range_start = ecma_extended_info_decode_vlq (&extended_info_p);\n      uint32_t range_size = ecma_extended_info_decode_vlq (&extended_info_p);\n      ecma_value_t source_code;\n\n      if (!(extended_info & CBC_EXTENDED_CODE_FLAGS_SOURCE_CODE_IN_ARGUMENTS))\n      {\n        source_code = script_p->source_code;\n#if JERRY_SNAPSHOT_EXEC\n        if (ecma_is_value_magic_string (source_code, LIT_MAGIC_STRING__EMPTY))\n        {\n          return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA);\n        }\n#endif /* JERRY_SNAPSHOT_EXEC */\n      }\n      else\n      {\n#if JERRY_SNAPSHOT_EXEC\n        if (!(script_p->refs_and_type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS))\n        {\n          return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA);\n        }\n#else /* !JERRY_SNAPSHOT_EXEC */\n        JERRY_ASSERT (script_p->refs_and_type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS);\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n        source_code = CBC_SCRIPT_GET_FUNCTION_ARGUMENTS (script_p, script_p->refs_and_type);\n      }\n\n      ecma_string_t *result_string_p;\n\n      ECMA_STRING_TO_UTF8_STRING (ecma_get_string_from_value (source_code), source_p, source_size);\n      result_string_p = ecma_new_ecma_string_from_utf8 (source_p + range_start, range_size);\n      ECMA_FINALIZE_UTF8_STRING (source_p, source_size);\n\n      return ecma_make_string_value (result_string_p);\n    }\n  }\n\n#if JERRY_SNAPSHOT_EXEC\n  if (!(script_p->refs_and_type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS))\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA);\n  }\n#else /* !JERRY_SNAPSHOT_EXEC */\n  JERRY_ASSERT (script_p->refs_and_type & CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS);\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n  lit_magic_string_id_t header_id = LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON;\n\n  switch (CBC_FUNCTION_GET_TYPE (bytecode_p->status_flags))\n  {\n    case CBC_FUNCTION_GENERATOR:\n    {\n      header_id = LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_GENERATOR;\n      break;\n    }\n    case CBC_FUNCTION_ASYNC_GENERATOR:\n    {\n      header_id = LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC_GENERATOR;\n      break;\n    }\n    case CBC_FUNCTION_ASYNC:\n    {\n      header_id = LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC;\n      break;\n    }\n  }\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (ecma_get_magic_string (header_id));\n  ecma_value_t function_arguments = CBC_SCRIPT_GET_FUNCTION_ARGUMENTS (script_p, script_p->refs_and_type);\n\n  ecma_stringbuilder_append (&builder, ecma_get_string_from_value (function_arguments));\n  ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) \"\\n) {\\n\", 5);\n  ecma_stringbuilder_append (&builder, ecma_get_string_from_value (script_p->source_code));\n  ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) \"\\n}\", 2);\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n#else /* !JERRY_FUNCTION_TO_STRING */\n  return ecma_make_magic_string_value (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA);\n#endif /* JERRY_FUNCTION_TO_STRING */\n} /* ecma_builtin_function_prototype_object_to_string */\n\n/**\n * The Function.prototype object's 'apply' routine\n *\n * See also:\n *          ECMA-262 v5, 15.3.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< this argument object */\n                                              ecma_value_t arg1, /**< first argument */\n                                              ecma_value_t arg2) /**< second argument */\n{\n  /* 2. */\n  if (ecma_is_value_null (arg2) || ecma_is_value_undefined (arg2))\n  {\n    return ecma_op_function_call (func_obj_p, arg1, NULL, 0);\n  }\n\n  /* 3. */\n  if (!ecma_is_value_object (arg2))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (arg2);\n\n  /* 4-5. */\n  ecma_length_t length;\n  ecma_value_t len_value = ecma_op_object_get_length (obj_p, &length);\n\n  if (ECMA_IS_VALUE_ERROR (len_value))\n  {\n    return len_value;\n  }\n\n  if (length >= ECMA_FUNCTION_APPLY_ARGUMENT_COUNT_LIMIT)\n  {\n    return ecma_raise_range_error (ECMA_ERR_TOO_MANY_ARGUMENTS_DECLARED_FOR_FUNCTION_APPLY);\n  }\n\n  /* 6. */\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n  JMEM_DEFINE_LOCAL_ARRAY (arguments_list_p, length, ecma_value_t);\n  ecma_length_t index = 0;\n\n  /* 7. */\n  for (index = 0; index < length; index++)\n  {\n    ecma_value_t get_value = ecma_op_object_get_by_index (obj_p, index);\n\n    if (ECMA_IS_VALUE_ERROR (get_value))\n    {\n      ret_value = get_value;\n      break;\n    }\n\n    arguments_list_p[index] = get_value;\n  }\n\n  if (ecma_is_value_empty (ret_value))\n  {\n    JERRY_ASSERT (index == length);\n    ret_value = ecma_op_function_call (func_obj_p, arg1, arguments_list_p, (uint32_t) length);\n  }\n\n  for (uint32_t remove_index = 0; remove_index < index; remove_index++)\n  {\n    ecma_free_value (arguments_list_p[remove_index]);\n  }\n\n  JMEM_FINALIZE_LOCAL_ARRAY (arguments_list_p);\n\n  return ret_value;\n} /* ecma_builtin_function_prototype_object_apply */\n\n/**\n * The Function.prototype object's 'call' routine\n *\n * See also:\n *          ECMA-262 v5, 15.3.4.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_function_prototype_object_call (ecma_object_t *func_obj_p, /**< this argument object */\n                                             const ecma_value_t *arguments_list_p, /**< list of arguments */\n                                             uint32_t arguments_number) /**< number of arguments */\n{\n  if (arguments_number == 0)\n  {\n    /* Even a 'this' argument is missing. */\n    return ecma_op_function_call (func_obj_p, ECMA_VALUE_UNDEFINED, NULL, 0);\n  }\n\n  return ecma_op_function_call (func_obj_p,\n                                arguments_list_p[0],\n                                arguments_list_p + 1,\n                                (uint32_t) (arguments_number - 1u));\n} /* ecma_builtin_function_prototype_object_call */\n\n/**\n * The Function.prototype object's 'bind' routine\n *\n * See also:\n *          ECMA-262 v5, 15.3.4.5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p, /**< this argument object */\n                                             const ecma_value_t *arguments_list_p, /**< list of arguments */\n                                             uint32_t arguments_number) /**< number of arguments */\n{\n  /* 4. 11. 18. */\n  ecma_object_t *prototype_obj_p;\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (this_arg_obj_p))\n  {\n    ecma_value_t proto = ecma_proxy_object_get_prototype_of (this_arg_obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (proto))\n    {\n      return proto;\n    }\n    prototype_obj_p = ecma_is_value_null (proto) ? NULL : ecma_get_object_from_value (proto);\n  }\n  else\n  {\n#endif /* JERRY_BUILTIN_PROXY */\n    jmem_cpointer_t proto_cp = ecma_op_ordinary_object_get_prototype_of (this_arg_obj_p);\n    if (proto_cp != JMEM_CP_NULL)\n    {\n      prototype_obj_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, proto_cp);\n      ecma_ref_object (prototype_obj_p);\n    }\n    else\n    {\n      prototype_obj_p = NULL;\n    }\n#if JERRY_BUILTIN_PROXY\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_object_t *function_p;\n  ecma_bound_function_t *bound_func_p;\n\n  if (arguments_number == 0 || (arguments_number == 1 && !ecma_is_value_integer_number (arguments_list_p[0])))\n  {\n    function_p = ecma_create_object (prototype_obj_p, sizeof (ecma_bound_function_t), ECMA_OBJECT_TYPE_BOUND_FUNCTION);\n\n    /* 8. */\n    bound_func_p = (ecma_bound_function_t *) function_p;\n    ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function, this_arg_obj_p, 0);\n\n    bound_func_p->header.u.bound_function.args_len_or_this = ECMA_VALUE_UNDEFINED;\n\n    if (arguments_number != 0)\n    {\n      bound_func_p->header.u.bound_function.args_len_or_this = ecma_copy_value_if_not_object (arguments_list_p[0]);\n    }\n  }\n  else\n  {\n    JERRY_ASSERT (arguments_number > 0);\n\n    size_t obj_size = sizeof (ecma_bound_function_t) + (arguments_number * sizeof (ecma_value_t));\n\n    function_p = ecma_create_object (prototype_obj_p, obj_size, ECMA_OBJECT_TYPE_BOUND_FUNCTION);\n\n    /* 8. */\n    bound_func_p = (ecma_bound_function_t *) function_p;\n    ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function, this_arg_obj_p, 0);\n\n    /* NOTE: This solution provides temporary false data about the object's size\n       but prevents GC from freeing it until it's not fully initialized. */\n    bound_func_p->header.u.bound_function.args_len_or_this = ECMA_VALUE_UNDEFINED;\n    ecma_value_t *args_p = (ecma_value_t *) (bound_func_p + 1);\n\n    for (uint32_t i = 0; i < arguments_number; i++)\n    {\n      *args_p++ = ecma_copy_value_if_not_object (arguments_list_p[i]);\n    }\n\n    ecma_value_t args_len_or_this = ecma_make_integer_value ((ecma_integer_value_t) arguments_number);\n    bound_func_p->header.u.bound_function.args_len_or_this = args_len_or_this;\n  }\n\n  if (prototype_obj_p != NULL)\n  {\n    ecma_deref_object (prototype_obj_p);\n  }\n\n  bound_func_p->target_length = ecma_make_integer_value (0);\n\n  ecma_string_t *len_string = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);\n  ecma_property_descriptor_t prop_desc;\n  ecma_value_t status = ecma_op_object_get_own_property_descriptor (this_arg_obj_p, len_string, &prop_desc);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_IS_VALUE_ERROR (status))\n  {\n    ecma_deref_object (function_p);\n    return status;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  if (ecma_is_value_true (status))\n  {\n    ecma_free_property_descriptor (&prop_desc);\n    ecma_value_t len_value = ecma_op_object_get (this_arg_obj_p, len_string);\n\n    if (ECMA_IS_VALUE_ERROR (len_value))\n    {\n      ecma_deref_object (function_p);\n      return len_value;\n    }\n\n    if (ecma_is_value_number (len_value))\n    {\n      ecma_number_t len_num;\n      ecma_op_to_integer (len_value, &len_num);\n      bound_func_p->target_length = ecma_make_number_value (len_num);\n    }\n    ecma_free_value (len_value);\n  }\n\n  /* 12. */\n  ecma_value_t name_value = ecma_op_object_get_by_magic_id (this_arg_obj_p, LIT_MAGIC_STRING_NAME);\n  if (ECMA_IS_VALUE_ERROR (name_value))\n  {\n    ecma_deref_object (function_p);\n    return name_value;\n  }\n\n  ecma_string_t *name_p;\n\n  if (ecma_is_value_string (name_value))\n  {\n    name_p = ecma_get_string_from_value (name_value);\n  }\n  else\n  {\n    ecma_free_value (name_value);\n    name_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  ecma_value_t bound_function_name = ecma_op_function_form_name (name_p, \"bound \", 6);\n\n  ecma_deref_ecma_string (name_p);\n\n  ecma_property_value_t *name_prop_value_p;\n  name_prop_value_p = ecma_create_named_data_property (function_p,\n                                                       ecma_get_magic_string (LIT_MAGIC_STRING_NAME),\n                                                       ECMA_PROPERTY_FLAG_CONFIGURABLE,\n                                                       NULL);\n\n  name_prop_value_p->value = bound_function_name;\n\n  /*\n   * [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_FUNCTION type.\n   *\n   * See also: ecma_object_get_class_name\n   */\n\n  /* 22. */\n  return ecma_make_object_value (function_p);\n} /* ecma_builtin_function_prototype_object_bind */\n\n/**\n * Handle calling [[Call]] of built-in Function.prototype object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_function_prototype_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                               uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_builtin_function_prototype_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Function.prototype object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_function_prototype_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                    uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_FUNCTION_PROTOTYPE_NOT_A_CONSTRUCTOR);\n} /* ecma_builtin_function_prototype_dispatch_construct */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_function_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                                  ecma_value_t this_arg, /**< 'this' argument value */\n                                                  const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                          *   passed to routine */\n                                                  uint32_t arguments_number) /**< length of arguments' list */\n{\n  if (!ecma_op_is_callable (this_arg))\n  {\n    if (JERRY_UNLIKELY (builtin_routine_id == ECMA_FUNCTION_PROTOTYPE_SYMBOL_HAS_INSTANCE))\n    {\n      return ECMA_VALUE_FALSE;\n    }\n\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_FUNCTION);\n  }\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (this_arg);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_FUNCTION_PROTOTYPE_TO_STRING:\n    {\n      return ecma_builtin_function_prototype_object_to_string (func_obj_p);\n    }\n    case ECMA_FUNCTION_PROTOTYPE_APPLY:\n    {\n      return ecma_builtin_function_prototype_object_apply (func_obj_p, arguments_list_p[0], arguments_list_p[1]);\n    }\n    case ECMA_FUNCTION_PROTOTYPE_CALL:\n    {\n      return ecma_builtin_function_prototype_object_call (func_obj_p, arguments_list_p, arguments_number);\n    }\n    case ECMA_FUNCTION_PROTOTYPE_BIND:\n    {\n      return ecma_builtin_function_prototype_object_bind (func_obj_p, arguments_list_p, arguments_number);\n    }\n    case ECMA_FUNCTION_PROTOTYPE_SYMBOL_HAS_INSTANCE:\n    {\n      return ecma_op_object_has_instance (func_obj_p, arguments_list_p[0]);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_function_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_BUILTIN_FUNCTION_PROTOTYPE_H\n#define ECMA_BUILTIN_FUNCTION_PROTOTYPE_H\n\n#include \"ecma-globals.h\"\n\necma_value_t\necma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, ecma_value_t arg1, ecma_value_t arg2);\n\n#endif /* !ECMA_BUILTIN_FUNCTION_PROTOTYPE_H */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Function.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.3.4.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_FUNCTION, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* Number properties:\n *  (property name, object pointer getter) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_FUNCTION_PROTOTYPE_TO_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_APPLY, ECMA_FUNCTION_PROTOTYPE_APPLY, 2, 2)\nROUTINE (LIT_MAGIC_STRING_CALL, ECMA_FUNCTION_PROTOTYPE_CALL, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_BIND, ECMA_FUNCTION_PROTOTYPE_BIND, NON_FIXED, 1)\n\n/**\n * ECMA-262 v6.0 19.2.3.6 @@hasInstance\n *  the property attributes are: { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.\n */\nROUTINE_WITH_FLAGS (LIT_GLOBAL_SYMBOL_HAS_INSTANCE, ECMA_FUNCTION_PROTOTYPE_SYMBOL_HAS_INSTANCE, 1, 1, 0 /* flags */)\nACCESSOR_BUILTIN_FUNCTION (LIT_MAGIC_STRING_ARGUMENTS,\n                           ECMA_BUILTIN_ID_TYPE_ERROR_THROWER,\n                           ECMA_BUILTIN_ID_TYPE_ERROR_THROWER,\n                           ECMA_PROPERTY_FLAG_CONFIGURABLE)\nACCESSOR_BUILTIN_FUNCTION (LIT_MAGIC_STRING_CALLER,\n                           ECMA_BUILTIN_ID_TYPE_ERROR_THROWER,\n                           ECMA_BUILTIN_ID_TYPE_ERROR_THROWER,\n                           ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-function.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-eval.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-lex-env.h\"\n\n#include \"js-parser.h\"\n#include \"lit-magic-strings.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-function.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  function\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup function ECMA Function object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in Function object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_function_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                     uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_builtin_function_dispatch_construct (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_function_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Function object\n *\n * See also:\n *          ECMA-262 v5, 15.3.\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_function_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                          uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_op_create_dynamic_function (arguments_list_p, arguments_list_len, ECMA_PARSE_NO_OPTS);\n} /* ecma_builtin_function_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-function.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Function built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.3.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n/* Number properties:\n *  (property name, object pointer getter) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-globals.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n#include \"ecma-function-object.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-generator-function.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  generator_function\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup generatorfunction ECMA GeneratorFunction object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in GeneratorFunction object\n *\n * @return constructed generator function object - if success\n *         raised error otherwise\n */\necma_value_t\necma_builtin_generator_function_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                               uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_op_create_dynamic_function (arguments_list_p, arguments_list_len, ECMA_PARSE_GENERATOR_FUNCTION);\n} /* ecma_builtin_generator_function_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in GeneratorFunction object\n *\n * @return constructed generator function object - if success\n *        raised error otherwise\n */\necma_value_t\necma_builtin_generator_function_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                    uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_generator_function_dispatch_call (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_generator_function_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %GeneratorFunction% built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* ECMA-262 v6, 25.2.2 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 25.2.2.1 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 25.2.2.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_GENERATOR, ECMA_PROPERTY_FIXED)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n\n#include \"jcontext.h\"\n#include \"opcodes.h\"\n#include \"vm-defines.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_GENERATOR_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT,\n  ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW,\n  ECMA_GENERATOR_PROTOTYPE_ROUTINE_RETURN\n} ecma_generator_operation_type_t;\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-generator-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  generator_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup generatorprototype ECMA Generator.prototype object built-in\n * @{\n */\n\n/**\n * Convert routine type to operation type.\n */\n#define ECMA_GENERATOR_ROUTINE_TO_OPERATION(type) \\\n  ((ecma_iterator_command_type_t) ((type) -ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT))\n\nJERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT) == ECMA_ITERATOR_NEXT,\n                     convert_ecma_generator_routine_next_to_ecma_iterator_next_failed);\n\nJERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW)\n                       == ECMA_ITERATOR_THROW,\n                     convert_ecma_generator_routine_throw_to_ecma_iterator_throw_failed);\n\nJERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_RETURN)\n                       == ECMA_ITERATOR_RETURN,\n                     convert_ecma_generator_routine_return_to_ecma_iterator_return_failed);\n\n/**\n * Helper function for next / return / throw\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_generator_prototype_object_do (vm_executable_object_t *generator_object_p, /**< generator object */\n                                            ecma_value_t arg, /**< argument */\n                                            ecma_iterator_command_type_t resume_mode) /**< resume mode */\n{\n  arg = ecma_copy_value (arg);\n\n  while (true)\n  {\n    if (generator_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)\n    {\n      if (generator_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_RUNNING)\n      {\n        return ecma_raise_type_error (ECMA_ERR_GENERATOR_IS_CURRENTLY_UNDER_EXECUTION);\n      }\n\n      ecma_value_t iterator = generator_object_p->iterator;\n      ecma_value_t next_method = generator_object_p->frame_ctx.stack_top_p[-1];\n\n      bool done = false;\n\n      generator_object_p->extended_object.u.cls.u2.executable_obj_flags |= ECMA_EXECUTABLE_OBJECT_RUNNING;\n      ecma_value_t result = ecma_op_iterator_do (resume_mode, iterator, next_method, arg, &done);\n      ecma_free_value (arg);\n      generator_object_p->extended_object.u.cls.u2.executable_obj_flags &= (uint8_t) ~ECMA_EXECUTABLE_OBJECT_RUNNING;\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        arg = result;\n      }\n      else if (done)\n      {\n        arg = ecma_op_iterator_value (result);\n        ecma_free_value (result);\n\n        if (resume_mode == ECMA_ITERATOR_THROW)\n        {\n          resume_mode = ECMA_ITERATOR_NEXT;\n        }\n      }\n      else\n      {\n        return result;\n      }\n\n      ECMA_EXECUTABLE_OBJECT_RESUME_EXEC (generator_object_p);\n      generator_object_p->iterator = ECMA_VALUE_UNDEFINED;\n\n      JERRY_ASSERT (generator_object_p->frame_ctx.stack_top_p[-1] == ECMA_VALUE_UNDEFINED\n                    || ecma_is_value_object (generator_object_p->frame_ctx.stack_top_p[-1]));\n      generator_object_p->frame_ctx.stack_top_p--;\n\n      if (ECMA_IS_VALUE_ERROR (arg))\n      {\n        arg = jcontext_take_exception ();\n        resume_mode = ECMA_ITERATOR_THROW;\n      }\n    }\n\n    if (resume_mode == ECMA_ITERATOR_RETURN)\n    {\n      generator_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_return;\n    }\n    else if (resume_mode == ECMA_ITERATOR_THROW)\n    {\n      generator_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_throw;\n    }\n\n    ecma_value_t value = opfunc_resume_executable_object (generator_object_p, arg);\n\n    if (ECMA_IS_VALUE_ERROR (value))\n    {\n      return value;\n    }\n\n    bool done;\n    done = (generator_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED);\n\n    if (!done)\n    {\n      const uint8_t *byte_code_p = generator_object_p->frame_ctx.byte_code_p;\n\n      JERRY_ASSERT (byte_code_p[-2] == CBC_EXT_OPCODE\n                    && (byte_code_p[-1] == CBC_EXT_YIELD || byte_code_p[-1] == CBC_EXT_YIELD_ITERATOR));\n\n      if (byte_code_p[-1] == CBC_EXT_YIELD_ITERATOR)\n      {\n        ecma_value_t iterator =\n          ecma_op_get_iterator (value, ECMA_VALUE_SYNC_ITERATOR, generator_object_p->frame_ctx.stack_top_p);\n        ecma_free_value (value);\n\n        if (ECMA_IS_VALUE_ERROR (iterator))\n        {\n          resume_mode = ECMA_ITERATOR_THROW;\n          arg = jcontext_take_exception ();\n          continue;\n        }\n\n        ecma_deref_object (ecma_get_object_from_value (iterator));\n        generator_object_p->extended_object.u.cls.u2.executable_obj_flags |= ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD;\n        generator_object_p->iterator = iterator;\n\n        if (generator_object_p->frame_ctx.stack_top_p[0] != ECMA_VALUE_UNDEFINED)\n        {\n          ecma_deref_object (ecma_get_object_from_value (generator_object_p->frame_ctx.stack_top_p[0]));\n        }\n\n        generator_object_p->frame_ctx.stack_top_p++;\n        arg = ECMA_VALUE_UNDEFINED;\n        continue;\n      }\n    }\n\n    ecma_value_t result = ecma_create_iter_result_object (value, ecma_make_boolean_value (done));\n    ecma_fast_free_value (value);\n    return result;\n  }\n} /* ecma_builtin_generator_prototype_object_do */\n\n/**\n * Dispatcher of the Generator built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine\n                                                                                *   identifier */\n                                                   ecma_value_t this_arg, /**< 'this' argument value */\n                                                   const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                           *   passed to routine */\n                                                   uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n\n  vm_executable_object_t *executable_object_p = NULL;\n\n  if (ecma_is_value_object (this_arg))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_GENERATOR))\n    {\n      executable_object_p = (vm_executable_object_t *) object_p;\n    }\n  }\n\n  if (executable_object_p == NULL)\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_GENERATOR_OBJECT);\n  }\n\n  if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_RUNNING)\n  {\n    return ecma_raise_type_error (ECMA_ERR_GENERATOR_IS_CURRENTLY_UNDER_EXECUTION);\n  }\n\n  if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED)\n  {\n    if (builtin_routine_id != ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW)\n    {\n      return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n    }\n\n    jcontext_raise_exception (ecma_copy_value (arguments_list_p[0]));\n    return ECMA_VALUE_ERROR;\n  }\n\n  return ecma_builtin_generator_prototype_object_do (executable_object_p,\n                                                     arguments_list_p[0],\n                                                     ECMA_GENERATOR_ROUTINE_TO_OPERATION (builtin_routine_id));\n} /* ecma_builtin_generator_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Generator.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 25.3.1.5 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_GENERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 25.2.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_GENERATOR, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_NEXT, ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_RETURN, ECMA_GENERATOR_PROTOTYPE_ROUTINE_RETURN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_THROW, ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW, 1, 1)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-generator.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-globals.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-generator.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  generator\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup generator ECMA Generator object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-generator.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %Generator% built-in description (GeneratorFunction.prototype)\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* ECMA-262 v6, 25.3.2.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_GENERATOR_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 25.3.2.3.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 25.3.2.3.3 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-global.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-eval.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n#include \"jcontext.h\"\n#include \"jrt-bit-fields.h\"\n#include \"jrt-libc-includes.h\"\n#include \"jrt.h\"\n#include \"lit-char-helpers.h\"\n#include \"lit-magic-strings.h\"\n#include \"lit-strings.h\"\n#include \"vm.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_GLOBAL_ROUTINE_START = 0,\n  /* Note: these 5 routine ids must be in this order */\n  ECMA_GLOBAL_IS_NAN,\n  ECMA_GLOBAL_IS_FINITE,\n  ECMA_GLOBAL_EVAL,\n  ECMA_GLOBAL_PARSE_INT,\n  ECMA_GLOBAL_PARSE_FLOAT,\n  ECMA_GLOBAL_DECODE_URI,\n  ECMA_GLOBAL_DECODE_URI_COMPONENT,\n  ECMA_GLOBAL_ENCODE_URI,\n  ECMA_GLOBAL_ENCODE_URI_COMPONENT,\n  ECMA_GLOBAL_ESCAPE,\n  ECMA_GLOBAL_UNESCAPE,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-global.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  global\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup global ECMA Global object built-in\n * @{\n */\n\n/**\n * The Global object's 'eval' routine\n *\n * See also:\n *          ECMA-262 v5, 15.1.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_global_object_eval (ecma_value_t x) /**< routine's first argument */\n{\n  if (JERRY_UNLIKELY (!ecma_is_value_string (x)))\n  {\n    /* step 1 */\n    return ecma_copy_value (x);\n  }\n\n  uint32_t parse_opts = vm_is_direct_eval_form_call () ? ECMA_PARSE_DIRECT_EVAL : ECMA_PARSE_NO_OPTS;\n\n  /* See also: ECMA-262 v5, 10.1.1 */\n  if (parse_opts && vm_is_strict_mode ())\n  {\n    JERRY_ASSERT (parse_opts & ECMA_PARSE_DIRECT_EVAL);\n    parse_opts |= ECMA_PARSE_STRICT_MODE;\n  }\n\n  if (vm_is_direct_eval_form_call ())\n  {\n    parse_opts |= ECMA_GET_LOCAL_PARSE_OPTS ();\n  }\n\n  /* steps 2 to 8 */\n  return ecma_op_eval (x, parse_opts);\n} /* ecma_builtin_global_object_eval */\n\n/**\n * The Global object's 'isNaN' routine\n *\n * See also:\n *          ECMA-262 v5, 15.1.2.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_global_object_is_nan (ecma_number_t arg_num) /**< routine's first argument */\n{\n  return ecma_make_boolean_value (ecma_number_is_nan (arg_num));\n} /* ecma_builtin_global_object_is_nan */\n\n/**\n * The Global object's 'isFinite' routine\n *\n * See also:\n *          ECMA-262 v5, 15.1.2.5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_global_object_is_finite (ecma_number_t arg_num) /**< routine's first argument */\n{\n  bool is_finite = !(ecma_number_is_nan (arg_num) || ecma_number_is_infinity (arg_num));\n\n  return ecma_make_boolean_value (is_finite);\n} /* ecma_builtin_global_object_is_finite */\n\n/**\n * Helper function to check whether a character is in a character bitset.\n *\n * @return true if the character is in the character bitset.\n */\nstatic bool\necma_builtin_global_object_character_is_in (uint32_t character, /**< character */\n                                            const uint8_t *bitset) /**< character set */\n{\n  JERRY_ASSERT (character < 128);\n  return (bitset[character >> 3] & (1u << (character & 0x7))) != 0;\n} /* ecma_builtin_global_object_character_is_in */\n\n/**\n * Unescaped URI characters bitset:\n *   One bit for each character between 0 - 127.\n *   Bit is set if the character is in the unescaped URI set.\n */\nstatic const uint8_t unescaped_uri_set[16] = { 0x0,  0x0,  0x0,  0x0,  0xda, 0xff, 0xff, 0xaf,\n                                               0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47 };\n\n/**\n * Unescaped URI component characters bitset:\n *   One bit for each character between 0 - 127.\n *   Bit is set if the character is in the unescaped component URI set.\n */\nstatic const uint8_t unescaped_uri_component_set[16] = { 0x0,  0x0,  0x0,  0x0,  0x82, 0x67, 0xff, 0x3,\n                                                         0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47 };\n\n/**\n * Format is a percent sign followed by two hex digits.\n */\n#define URI_ENCODED_BYTE_SIZE (3)\n\n/**\n * The Global object's 'decodeURI' and 'decodeURIComponent' routines\n *\n * See also:\n *          ECMA-262 v5, 15.1.3.1\n *          ECMA-262 v5, 15.1.3.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /**< routine's first argument's\n                                                                               *   string buffer */\n                                              lit_utf8_size_t input_size, /**< routine's first argument's\n                                                                           *   string buffer's size */\n                                              const uint8_t *reserved_uri_bitset) /**< reserved characters bitset */\n{\n  lit_utf8_byte_t *input_char_p = input_start_p;\n  lit_utf8_byte_t *input_end_p = input_start_p + input_size;\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  while (input_char_p < input_end_p)\n  {\n    if (*input_char_p != '%')\n    {\n      ecma_stringbuilder_append_byte (&builder, *input_char_p++);\n      continue;\n    }\n\n    uint32_t hex_value = lit_char_hex_lookup (input_char_p + 1, input_end_p, 2);\n    if (hex_value == UINT32_MAX)\n    {\n      ecma_stringbuilder_destroy (&builder);\n      return ecma_raise_uri_error (ECMA_ERR_INVALID_HEXADECIMAL_VALUE);\n    }\n\n    ecma_char_t decoded_byte = (ecma_char_t) hex_value;\n    input_char_p += URI_ENCODED_BYTE_SIZE;\n\n    if (decoded_byte <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)\n    {\n      if (ecma_builtin_global_object_character_is_in (decoded_byte, reserved_uri_bitset)\n          && !ecma_builtin_global_object_character_is_in (decoded_byte, unescaped_uri_component_set))\n      {\n        ecma_stringbuilder_append_char (&builder, LIT_CHAR_PERCENT);\n        input_char_p -= 2;\n      }\n      else\n      {\n        ecma_stringbuilder_append_byte (&builder, (lit_utf8_byte_t) decoded_byte);\n      }\n    }\n    else\n    {\n      uint32_t bytes_count;\n\n      if ((decoded_byte & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER)\n      {\n        bytes_count = 2;\n      }\n      else if ((decoded_byte & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER)\n      {\n        bytes_count = 3;\n      }\n      else if ((decoded_byte & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER)\n      {\n        bytes_count = 4;\n      }\n      else\n      {\n        ecma_stringbuilder_destroy (&builder);\n        return ecma_raise_uri_error (ECMA_ERR_INVALID_UTF8_CHARACTER);\n      }\n\n      lit_utf8_byte_t octets[LIT_UTF8_MAX_BYTES_IN_CODE_POINT];\n      octets[0] = (lit_utf8_byte_t) decoded_byte;\n      bool is_valid = true;\n\n      for (uint32_t i = 1; i < bytes_count; i++)\n      {\n        if (input_char_p >= input_end_p || *input_char_p != '%')\n        {\n          is_valid = false;\n          break;\n        }\n        else\n        {\n          hex_value = lit_char_hex_lookup (input_char_p + 1, input_end_p, 2);\n\n          if (hex_value == UINT32_MAX || (hex_value & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER)\n          {\n            is_valid = false;\n            break;\n          }\n\n          input_char_p += URI_ENCODED_BYTE_SIZE;\n          octets[i] = (lit_utf8_byte_t) hex_value;\n        }\n      }\n\n      if (!is_valid || !lit_is_valid_utf8_string (octets, bytes_count, true))\n      {\n        ecma_stringbuilder_destroy (&builder);\n        return ecma_raise_uri_error (ECMA_ERR_INVALID_UTF8_STRING);\n      }\n\n      lit_code_point_t cp;\n      lit_read_code_point_from_utf8 (octets, bytes_count, &cp);\n\n      if (lit_is_code_point_utf16_high_surrogate (cp) || lit_is_code_point_utf16_low_surrogate (cp))\n      {\n        ecma_stringbuilder_destroy (&builder);\n        return ecma_raise_uri_error (ECMA_ERR_INVALID_UTF8_CODEPOINT);\n      }\n\n      lit_utf8_byte_t result_chars[LIT_CESU8_MAX_BYTES_IN_CODE_POINT];\n      lit_utf8_size_t cp_size = lit_code_point_to_cesu8 (cp, result_chars);\n      ecma_stringbuilder_append_raw (&builder, result_chars, cp_size);\n    }\n  }\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_global_object_decode_uri_helper */\n\n/**\n * Helper function to encode byte as hexadecimal values.\n */\nstatic void\necma_builtin_global_object_byte_to_hex (lit_utf8_byte_t *dest_p, /**< destination pointer */\n                                        uint32_t byte) /**< value */\n{\n  JERRY_ASSERT (byte < 256);\n\n  dest_p[0] = LIT_CHAR_PERCENT;\n  ecma_char_t hex_digit = (ecma_char_t) (byte >> 4);\n  dest_p[1] = (lit_utf8_byte_t) ((hex_digit > 9) ? (hex_digit + ('A' - 10)) : (hex_digit + '0'));\n  hex_digit = (lit_utf8_byte_t) (byte & 0xf);\n  dest_p[2] = (lit_utf8_byte_t) ((hex_digit > 9) ? (hex_digit + ('A' - 10)) : (hex_digit + '0'));\n} /* ecma_builtin_global_object_byte_to_hex */\n\n/**\n * The Global object's 'encodeURI' and 'encodeURIComponent' routines\n *\n * See also:\n *          ECMA-262 v5, 15.1.3.3\n *          ECMA-262 v5, 15.1.3.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_global_object_encode_uri_helper (lit_utf8_byte_t *input_start_p, /**< routine's first argument's\n                                                                               *   string buffer */\n                                              lit_utf8_size_t input_size, /**< routine's first argument's\n                                                                           *   string buffer's size */\n                                              const uint8_t *unescaped_uri_bitset_p) /**< unescaped bitset */\n{\n  lit_utf8_byte_t *input_char_p = input_start_p;\n  const lit_utf8_byte_t *input_end_p = input_start_p + input_size;\n  ecma_char_t ch;\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n  lit_utf8_byte_t octets[LIT_UTF8_MAX_BYTES_IN_CODE_POINT];\n  memset (octets, LIT_BYTE_NULL, LIT_UTF8_MAX_BYTES_IN_CODE_POINT);\n\n  while (input_char_p < input_end_p)\n  {\n    input_char_p += lit_read_code_unit_from_cesu8 (input_char_p, &ch);\n\n    if (lit_is_code_point_utf16_low_surrogate (ch))\n    {\n      ecma_stringbuilder_destroy (&builder);\n      return ecma_raise_uri_error (ECMA_ERR_UNICODE_SURROGATE_PAIR_MISSING);\n    }\n\n    lit_code_point_t cp = ch;\n\n    if (lit_is_code_point_utf16_high_surrogate (ch))\n    {\n      if (input_char_p == input_end_p)\n      {\n        ecma_stringbuilder_destroy (&builder);\n        return ecma_raise_uri_error (ECMA_ERR_UNICODE_SURROGATE_PAIR_MISSING);\n      }\n\n      ecma_char_t next_ch;\n      lit_utf8_size_t read_size = lit_read_code_unit_from_cesu8 (input_char_p, &next_ch);\n\n      if (lit_is_code_point_utf16_low_surrogate (next_ch))\n      {\n        cp = lit_convert_surrogate_pair_to_code_point (ch, next_ch);\n        input_char_p += read_size;\n      }\n      else\n      {\n        ecma_stringbuilder_destroy (&builder);\n        return ecma_raise_uri_error (ECMA_ERR_UNICODE_SURROGATE_PAIR_MISSING);\n      }\n    }\n\n    lit_utf8_size_t utf_size = lit_code_point_to_utf8 (cp, octets);\n    lit_utf8_byte_t result_chars[URI_ENCODED_BYTE_SIZE];\n\n    if (utf_size == 1)\n    {\n      if (ecma_builtin_global_object_character_is_in (octets[0], unescaped_uri_bitset_p))\n      {\n        ecma_stringbuilder_append_byte (&builder, octets[0]);\n      }\n      else\n      {\n        ecma_builtin_global_object_byte_to_hex (result_chars, octets[0]);\n        ecma_stringbuilder_append_raw (&builder, result_chars, URI_ENCODED_BYTE_SIZE);\n      }\n    }\n    else\n    {\n      for (uint32_t i = 0; i < utf_size; i++)\n      {\n        JERRY_ASSERT (utf_size <= LIT_UTF8_MAX_BYTES_IN_CODE_POINT);\n        ecma_builtin_global_object_byte_to_hex (result_chars, octets[i]);\n        ecma_stringbuilder_append_raw (&builder, result_chars, URI_ENCODED_BYTE_SIZE);\n      }\n    }\n  }\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_global_object_encode_uri_helper */\n\n#if JERRY_BUILTIN_ANNEXB\n\n/**\n * Maximum value of a byte.\n */\n#define ECMA_ESCAPE_MAXIMUM_BYTE_VALUE (255)\n\n/**\n * Format is a percent sign followed by lowercase u and four hex digits.\n */\n#define ECMA_ESCAPE_ENCODED_UNICODE_CHARACTER_SIZE (6)\n\n/**\n * Escape characters bitset:\n *   One bit for each character between 0 - 127.\n *   Bit is set if the character does not need to be converted to %xx form.\n *   These characters are: a-z A-Z 0-9 @ * _ + - . /\n */\nstatic const uint8_t ecma_escape_set[16] = { 0x0,  0x0,  0x0,  0x0,  0x0,  0xec, 0xff, 0x3,\n                                             0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x7 };\n\n/**\n * The Global object's 'escape' routine\n *\n * See also:\n *          ECMA-262 v5, B.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_global_object_escape (lit_utf8_byte_t *input_start_p, /**< routine's first argument's\n                                                                    *   string buffer */\n                                   lit_utf8_size_t input_size) /**< routine's first argument's\n                                                                *   string buffer's size */\n{\n  const lit_utf8_byte_t *input_curr_p = input_start_p;\n  const lit_utf8_byte_t *input_end_p = input_start_p + input_size;\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n  lit_utf8_byte_t result_chars[URI_ENCODED_BYTE_SIZE];\n\n  while (input_curr_p < input_end_p)\n  {\n    ecma_char_t chr = lit_cesu8_read_next (&input_curr_p);\n\n    if (chr <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)\n    {\n      if (ecma_builtin_global_object_character_is_in ((uint32_t) chr, ecma_escape_set))\n      {\n        ecma_stringbuilder_append_char (&builder, chr);\n      }\n      else\n      {\n        ecma_builtin_global_object_byte_to_hex (result_chars, chr);\n        ecma_stringbuilder_append_raw (&builder, result_chars, URI_ENCODED_BYTE_SIZE);\n      }\n    }\n    else if (chr > ECMA_ESCAPE_MAXIMUM_BYTE_VALUE)\n    {\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_PERCENT);\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_LOWERCASE_U);\n\n      ecma_builtin_global_object_byte_to_hex (result_chars, (chr >> JERRY_BITSINBYTE));\n      ecma_stringbuilder_append_raw (&builder, result_chars + 1, 2);\n\n      ecma_builtin_global_object_byte_to_hex (result_chars, (chr & 0xff));\n      ecma_stringbuilder_append_raw (&builder, result_chars + 1, 2);\n    }\n    else\n    {\n      ecma_builtin_global_object_byte_to_hex (result_chars, chr);\n      ecma_stringbuilder_append_raw (&builder, result_chars, URI_ENCODED_BYTE_SIZE);\n    }\n  }\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_global_object_escape */\n\n/**\n * Utility method to resolve character sequences for the 'unescape' method.\n *\n * Expected formats: %uxxxx or %yy\n *\n * @return number of characters processed during the escape resolve\n */\nstatic uint8_t\necma_builtin_global_object_unescape_resolve_escape (const lit_utf8_byte_t *buffer_p, /**< character buffer */\n                                                    bool unicode_sequence, /**< true if unescaping unicode sequence */\n                                                    ecma_char_t *out_result_p) /**< [out] resolved character */\n{\n  JERRY_ASSERT (buffer_p != NULL);\n  JERRY_ASSERT (out_result_p != NULL);\n\n  ecma_char_t unescaped_chr = 0;\n  uint8_t sequence_length = unicode_sequence ? 5 : 2;\n  uint8_t start = unicode_sequence ? 1 : 0;\n\n  for (uint8_t i = start; i < sequence_length; i++)\n  {\n    const lit_utf8_byte_t current_char = buffer_p[i];\n\n    if (!lit_char_is_hex_digit (current_char))\n    {\n      /* This was not an escape sequence, skip processing */\n      return 0;\n    }\n\n    unescaped_chr = (ecma_char_t) ((unescaped_chr << 4) + (ecma_char_t) lit_char_hex_to_int (current_char));\n  }\n\n  *out_result_p = unescaped_chr;\n\n  return sequence_length;\n} /* ecma_builtin_global_object_unescape_resolve_escape */\n\n/**\n * The Global object's 'unescape' routine\n *\n * See also:\n *          ECMA-262 v5, B.2.2\n *          ECMA-262 v11, B.2.1.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_global_object_unescape (lit_utf8_byte_t *input_start_p, /**< routine's first argument's\n                                                                      *   string buffer */\n                                     lit_utf8_size_t input_size) /**< routine's first argument's\n                                                                  *   string buffer's size */\n{\n  if (input_size == 0)\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  const lit_utf8_byte_t *input_curr_p = input_start_p;\n  const lit_utf8_byte_t *input_end_p = input_start_p + input_size;\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  while (input_curr_p < input_end_p)\n  {\n    ecma_char_t chr = lit_cesu8_read_next (&input_curr_p);\n\n    // potential pattern\n    if (chr == LIT_CHAR_PERCENT)\n    {\n      const lit_utf8_size_t chars_leftover = (lit_utf8_size_t) (input_end_p - input_curr_p);\n\n      // potential unicode sequence\n      if (chars_leftover >= 5 && input_curr_p[0] == LIT_CHAR_LOWERCASE_U)\n      {\n        input_curr_p += ecma_builtin_global_object_unescape_resolve_escape (input_curr_p, true, &chr);\n      }\n      // potential two hexa sequence\n      else if (chars_leftover >= 2)\n      {\n        input_curr_p += ecma_builtin_global_object_unescape_resolve_escape (input_curr_p, false, &chr);\n      }\n    }\n\n    ecma_stringbuilder_append_char (&builder, chr);\n  }\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_global_object_unescape */\n\n#endif /* JERRY_BUILTIN_ANNEXB */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                      ecma_value_t this_arg, /**< 'this' argument value */\n                                      const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                              *   passed to routine */\n                                      uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (this_arg, arguments_number);\n\n  ecma_value_t routine_arg_1 = arguments_list_p[0];\n\n  if (builtin_routine_id == ECMA_GLOBAL_EVAL)\n  {\n    return ecma_builtin_global_object_eval (routine_arg_1);\n  }\n\n  if (builtin_routine_id <= ECMA_GLOBAL_IS_FINITE)\n  {\n    ecma_number_t arg_num;\n\n    routine_arg_1 = ecma_op_to_number (routine_arg_1, &arg_num);\n\n    if (!ecma_is_value_empty (routine_arg_1))\n    {\n      return routine_arg_1;\n    }\n\n    if (builtin_routine_id == ECMA_GLOBAL_IS_NAN)\n    {\n      return ecma_builtin_global_object_is_nan (arg_num);\n    }\n\n    JERRY_ASSERT (builtin_routine_id == ECMA_GLOBAL_IS_FINITE);\n\n    return ecma_builtin_global_object_is_finite (arg_num);\n  }\n\n  ecma_string_t *str_p = ecma_op_to_string (routine_arg_1);\n\n  if (JERRY_UNLIKELY (str_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t ret_value;\n\n  if (builtin_routine_id <= ECMA_GLOBAL_PARSE_FLOAT)\n  {\n    ECMA_STRING_TO_UTF8_STRING (str_p, string_buff, string_buff_size);\n\n    if (builtin_routine_id == ECMA_GLOBAL_PARSE_INT)\n    {\n      ret_value = ecma_number_parse_int (string_buff, string_buff_size, arguments_list_p[1]);\n    }\n    else\n    {\n      JERRY_ASSERT (builtin_routine_id == ECMA_GLOBAL_PARSE_FLOAT);\n      ret_value = ecma_number_parse_float (string_buff, string_buff_size);\n    }\n\n    ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size);\n    ecma_deref_ecma_string (str_p);\n    return ret_value;\n  }\n\n  lit_utf8_size_t input_size = ecma_string_get_size (str_p);\n\n  JMEM_DEFINE_LOCAL_ARRAY (input_start_p, input_size + 1, lit_utf8_byte_t);\n\n  ecma_string_to_cesu8_bytes (str_p, input_start_p, input_size);\n\n  input_start_p[input_size] = LIT_BYTE_NULL;\n\n  switch (builtin_routine_id)\n  {\n#if JERRY_BUILTIN_ANNEXB\n    case ECMA_GLOBAL_ESCAPE:\n    {\n      ret_value = ecma_builtin_global_object_escape (input_start_p, input_size);\n      break;\n    }\n    case ECMA_GLOBAL_UNESCAPE:\n    {\n      ret_value = ecma_builtin_global_object_unescape (input_start_p, input_size);\n      break;\n    }\n#endif /* JERRY_BUILTIN_ANNEXB */\n    case ECMA_GLOBAL_DECODE_URI:\n    case ECMA_GLOBAL_DECODE_URI_COMPONENT:\n    {\n      const uint8_t *uri_set =\n        (builtin_routine_id == ECMA_GLOBAL_DECODE_URI ? unescaped_uri_set : unescaped_uri_component_set);\n\n      ret_value = ecma_builtin_global_object_decode_uri_helper (input_start_p, input_size, uri_set);\n      break;\n    }\n    default:\n    {\n      JERRY_ASSERT (builtin_routine_id == ECMA_GLOBAL_ENCODE_URI\n                    || builtin_routine_id == ECMA_GLOBAL_ENCODE_URI_COMPONENT);\n\n      const uint8_t *uri_set =\n        (builtin_routine_id == ECMA_GLOBAL_ENCODE_URI ? unescaped_uri_set : unescaped_uri_component_set);\n\n      ret_value = ecma_builtin_global_object_encode_uri_helper (input_start_p, input_size, uri_set);\n      break;\n    }\n  }\n\n  JMEM_FINALIZE_LOCAL_ARRAY (input_start_p);\n\n  ecma_deref_ecma_string (str_p);\n  return ret_value;\n} /* ecma_builtin_global_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Global built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Simple value properties:\n * (property name, simple value, writable, enumerable, configurable) */\n\n/* ECMA-262 v5, 15.1.1.3 */\nSIMPLE_VALUE (LIT_MAGIC_STRING_UNDEFINED, ECMA_VALUE_UNDEFINED, ECMA_PROPERTY_FIXED)\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\n/* ECMA-262 v5, 15.1.1.1 */\nNUMBER_VALUE (LIT_MAGIC_STRING_NAN, ECMA_BUILTIN_NUMBER_NAN, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.1.1.2 */\nNUMBER_VALUE (LIT_MAGIC_STRING_INFINITY_UL, ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, ECMA_PROPERTY_FIXED)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.1.4.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_OBJECT_UL, ECMA_BUILTIN_ID_OBJECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.1.4.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_FUNCTION_UL, ECMA_BUILTIN_ID_FUNCTION, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.1.4.3 */\n#if JERRY_BUILTIN_ARRAY\nOBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_UL, ECMA_BUILTIN_ID_ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_ARRAY */\n\n#if JERRY_BUILTIN_STRING\n/* ECMA-262 v5, 15.1.4.4 */\nOBJECT_VALUE (LIT_MAGIC_STRING_STRING_UL, ECMA_BUILTIN_ID_STRING, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_STRING */\n\n#if JERRY_BUILTIN_BOOLEAN\n/* ECMA-262 v5, 15.1.4.5 */\nOBJECT_VALUE (LIT_MAGIC_STRING_BOOLEAN_UL, ECMA_BUILTIN_ID_BOOLEAN, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_BOOLEAN */\n\n#if JERRY_BUILTIN_NUMBER\n/* ECMA-262 v5, 15.1.4.6 */\nOBJECT_VALUE (LIT_MAGIC_STRING_NUMBER_UL, ECMA_BUILTIN_ID_NUMBER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_NUMBER */\n\n#if JERRY_BUILTIN_DATE\n/* ECMA-262 v5, 15.1.4.7 */\nOBJECT_VALUE (LIT_MAGIC_STRING_DATE_UL, ECMA_BUILTIN_ID_DATE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_DATE */\n\n#if JERRY_BUILTIN_REGEXP\n/* ECMA-262 v5, 15.1.4.8 */\nOBJECT_VALUE (LIT_MAGIC_STRING_REGEXP_UL, ECMA_BUILTIN_ID_REGEXP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_REGEXP */\n\n/* ECMA-262 v5, 15.1.4.9 */\nOBJECT_VALUE (LIT_MAGIC_STRING_ERROR_UL, ECMA_BUILTIN_ID_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#if JERRY_BUILTIN_ERRORS\n\n/* ECMA-262 v5, 15.1.4.10 */\nOBJECT_VALUE (LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_BUILTIN_ID_EVAL_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.1.4.11 */\nOBJECT_VALUE (LIT_MAGIC_STRING_RANGE_ERROR_UL, ECMA_BUILTIN_ID_RANGE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.1.4.12 */\nOBJECT_VALUE (LIT_MAGIC_STRING_REFERENCE_ERROR_UL, ECMA_BUILTIN_ID_REFERENCE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.1.4.13 */\nOBJECT_VALUE (LIT_MAGIC_STRING_SYNTAX_ERROR_UL, ECMA_BUILTIN_ID_SYNTAX_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.1.4.14 */\nOBJECT_VALUE (LIT_MAGIC_STRING_TYPE_ERROR_UL, ECMA_BUILTIN_ID_TYPE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.1.4.15 */\nOBJECT_VALUE (LIT_MAGIC_STRING_URI_ERROR_UL, ECMA_BUILTIN_ID_URI_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#if JERRY_BUILTIN_MATH\n/* ECMA-262 v5, 15.1.5.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_MATH_UL, ECMA_BUILTIN_ID_MATH, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_REFLECT\n/* ECMA-262 v6, 26.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_REFLECT_UL, ECMA_BUILTIN_ID_REFLECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_REFLECT */\n\n#if JERRY_BUILTIN_JSON\n/* ECMA-262 v5, 15.1.5.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_JSON_U, ECMA_BUILTIN_ID_JSON, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_JSON */\n\n#if JERRY_BUILTIN_ATOMICS\n/* ECMA-262 v5, 15.1.5.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_ATOMICS_U, ECMA_BUILTIN_ID_ATOMICS, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_ATOMICS */\n\n#if JERRY_BUILTIN_TYPEDARRAY\nOBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_BUILTIN_ID_ARRAYBUFFER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\nOBJECT_VALUE (LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL,\n              ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER,\n              ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_INT8_ARRAY_UL, ECMA_BUILTIN_ID_INT8ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nOBJECT_VALUE (LIT_MAGIC_STRING_UINT8_ARRAY_UL, ECMA_BUILTIN_ID_UINT8ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nOBJECT_VALUE (LIT_MAGIC_STRING_INT16_ARRAY_UL, ECMA_BUILTIN_ID_INT16ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nOBJECT_VALUE (LIT_MAGIC_STRING_UINT16_ARRAY_UL, ECMA_BUILTIN_ID_UINT16ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nOBJECT_VALUE (LIT_MAGIC_STRING_INT32_ARRAY_UL, ECMA_BUILTIN_ID_INT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nOBJECT_VALUE (LIT_MAGIC_STRING_UINT32_ARRAY_UL, ECMA_BUILTIN_ID_UINT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nOBJECT_VALUE (LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, ECMA_BUILTIN_ID_FLOAT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#if JERRY_NUMBER_TYPE_FLOAT64\nOBJECT_VALUE (LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, ECMA_BUILTIN_ID_FLOAT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n#if JERRY_BUILTIN_BIGINT\nOBJECT_VALUE (LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, ECMA_BUILTIN_ID_BIGINT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nOBJECT_VALUE (LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, ECMA_BUILTIN_ID_BIGUINT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_BIGINT */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL,\n              ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY,\n              ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n#if JERRY_BUILTIN_CONTAINER\n/* ECMA-262 v6, 23.1.1.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_WEAKSET_UL, ECMA_BUILTIN_ID_WEAKSET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 23.1.1.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_MAP_UL, ECMA_BUILTIN_ID_MAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 23.1.1.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_SET_UL, ECMA_BUILTIN_ID_SET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 23.1.1.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_WEAKMAP_UL, ECMA_BUILTIN_ID_WEAKMAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#if JERRY_BUILTIN_WEAKREF\nOBJECT_VALUE (LIT_MAGIC_STRING_WEAKREF_UL, ECMA_BUILTIN_ID_WEAKREF, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_WEAKREF */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_BUILTIN_ID_AGGREGATE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nOBJECT_VALUE (LIT_MAGIC_STRING_PROMISE_UL, ECMA_BUILTIN_ID_PROMISE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 19.4.1.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_SYMBOL_UL, ECMA_BUILTIN_ID_SYMBOL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#if JERRY_BUILTIN_GLOBAL_THIS\n/* ECMA-262 v11, 18.1.1 */\nSIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL_THIS_UL, ECMA_VALUE_GLOBAL_THIS, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_GLOBAL_THIS */\n\n#if JERRY_BUILTIN_DATAVIEW\n/* ECMA-262 v6, 23.1.1.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_BUILTIN_ID_DATAVIEW, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_DATAVIEW */\n\n#if JERRY_BUILTIN_PROXY\n/* ECMA-262 v6, 26.2.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROXY_UL, ECMA_BUILTIN_ID_PROXY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_PROXY */\n\n#if JERRY_BUILTIN_BIGINT\n/* ECMA-262 v11, 20.2.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_BIGINT_UL, ECMA_BUILTIN_ID_BIGINT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_BIGINT */\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\n\nROUTINE (LIT_MAGIC_STRING_EVAL, ECMA_GLOBAL_EVAL, 1, 1)\nROUTINE (LIT_MAGIC_STRING_IS_NAN, ECMA_GLOBAL_IS_NAN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_IS_FINITE, ECMA_GLOBAL_IS_FINITE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_DECODE_URI, ECMA_GLOBAL_DECODE_URI, 1, 1)\nROUTINE (LIT_MAGIC_STRING_DECODE_URI_COMPONENT, ECMA_GLOBAL_DECODE_URI_COMPONENT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ENCODE_URI, ECMA_GLOBAL_ENCODE_URI, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ENCODE_URI_COMPONENT, ECMA_GLOBAL_ENCODE_URI_COMPONENT, 1, 1)\n\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_PARSE_FLOAT, LIT_MAGIC_STRING_PARSE_FLOAT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_PARSE_INT, LIT_MAGIC_STRING_PARSE_INT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#if JERRY_BUILTIN_ANNEXB\nROUTINE (LIT_MAGIC_STRING_ESCAPE, ECMA_GLOBAL_ESCAPE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_UNESCAPE, ECMA_GLOBAL_UNESCAPE, 1, 1)\n#endif /* JERRY_BUILTIN_ANNEXB */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-handlers.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-handlers.h\"\n\n#include \"ecma-globals.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-promise-object.h\"\n\nstatic const ecma_builtin_handler_t ecma_native_handlers[] = {\n/** @cond doxygen_suppress */\n#define ECMA_NATIVE_HANDLER(id, handler, length) handler,\n#include \"ecma-builtin-handlers.inc.h\"\n#undef ECMA_NATIVE_HANDLER\n  /** @endcond */\n};\n\nstatic const uint8_t ecma_native_handler_lengths[] = {\n/** @cond doxygen_suppress */\n#define ECMA_NATIVE_HANDLER(id, handler, length) length,\n#include \"ecma-builtin-handlers.inc.h\"\n#undef ECMA_NATIVE_HANDLER\n  /** @endcond */\n};\n\n/**\n * Get the native handler of a built-in handler type.\n *\n * return Function pointer of the handler\n */\necma_builtin_handler_t\necma_builtin_handler_get (ecma_native_handler_id_t id) /**< handler id */\n{\n  JERRY_ASSERT (id != ECMA_NATIVE_HANDLER_START && id < ECMA_NATIVE_HANDLER__COUNT);\n  return ecma_native_handlers[id - 1];\n} /* ecma_builtin_handler_get */\n\n/**\n * Get the initial 'length' value of a built-in handler type.\n *\n * return 'length' value of the handler\n */\nuint8_t\necma_builtin_handler_get_length (ecma_native_handler_id_t id) /**< handler id */\n{\n  JERRY_ASSERT (id != ECMA_NATIVE_HANDLER_START && id < ECMA_NATIVE_HANDLER__COUNT);\n  return ecma_native_handler_lengths[id - 1];\n} /* ecma_builtin_handler_get_length */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-handlers.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_BUILTIN_HANDLERS_H\n#define ECMA_BUILTIN_HANDLERS_H\n\n#include \"ecma-builtins.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-promise-object.h\"\n#include \"ecma-proxy-object.h\"\n\ntypedef enum\n{\n  /** @cond doxygen_suppress */\n  ECMA_NATIVE_HANDLER_START = 0,\n#define ECMA_NATIVE_HANDLER(id, handler, length) id,\n#include \"ecma-builtin-handlers.inc.h\"\n#undef ECMA_NATIVE_HANDLER\n  ECMA_NATIVE_HANDLER__COUNT\n  /** @endcond */\n} ecma_native_handler_id_t;\n\ntypedef enum\n{\n  ECMA_NATIVE_HANDLER_FLAGS_NONE = 0,\n  ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED = (1 << 0),\n  ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED = (1 << 1),\n} ecma_native_handler_flags_t;\n\n/**\n * Shift for Promise helper handler function.\n */\n#define ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT 2\n\necma_builtin_handler_t ecma_builtin_handler_get (ecma_native_handler_id_t id);\nuint8_t ecma_builtin_handler_get_length (ecma_native_handler_id_t id);\n\n#endif /* !ECMA_BUILTIN_HANDLERS_H */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-handlers.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nECMA_NATIVE_HANDLER (ECMA_NATIVE_HANDLER_PROMISE_RESOLVE, ecma_promise_resolve_handler, 1)\nECMA_NATIVE_HANDLER (ECMA_NATIVE_HANDLER_PROMISE_REJECT, ecma_promise_reject_handler, 1)\nECMA_NATIVE_HANDLER (ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY, ecma_promise_then_finally_cb, 1)\nECMA_NATIVE_HANDLER (ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY, ecma_promise_catch_finally_cb, 1)\nECMA_NATIVE_HANDLER (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER, ecma_promise_all_or_all_settled_handler_cb, 1)\nECMA_NATIVE_HANDLER (ECMA_NATIVE_HANDLER_PROMISE_CAPABILITY_EXECUTOR, ecma_op_get_capabilities_executor_cb, 2)\nECMA_NATIVE_HANDLER (ECMA_NATIVE_HANDLER_ASYNC_FROM_SYNC_ITERATOR_UNWRAP, ecma_async_from_sync_iterator_unwrap_cb, 1)\n#if JERRY_BUILTIN_PROXY\nECMA_NATIVE_HANDLER (ECMA_NATIVE_HANDLER_PROXY_REVOKE, ecma_proxy_revoke_cb, 0)\n#endif /* JERRY_BUILTIN_PROXY */\nECMA_NATIVE_HANDLER (ECMA_NATIVE_HANDLER_VALUE_THUNK, ecma_value_thunk_helper_cb, 0)\nECMA_NATIVE_HANDLER (ECMA_NATIVE_HANDLER_VALUE_THROWER, ecma_value_thunk_thrower_cb, 0)\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <math.h>\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"lit-char-helpers.h\"\n\n#if JERRY_BUILTIN_DATE\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltinhelpers ECMA builtin helper operations\n * @{\n */\n\n/**\n * Day names\n */\nconst char day_names_p[7][3] = { \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\" };\n\n/**\n * Month names\n */\nconst char month_names_p[12][3] = {\n  \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"\n};\n\n/**\n * Calculate the elapsed days since Unix Epoch\n *\n * @return elapsed days since Unix Epoch\n */\nextern inline int32_t JERRY_ATTR_ALWAYS_INLINE\necma_date_day_from_time (ecma_number_t time) /**< time value */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (time));\n\n  if (time < 0)\n  {\n    time -= ECMA_DATE_MS_PER_DAY - 1;\n  }\n\n  return (int32_t) (time / ECMA_DATE_MS_PER_DAY);\n} /* ecma_date_day_from_time */\n\n/**\n * Abstract operation: DayFromYear\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.3\n *\n * @return first of day in the given year\n */\nstatic int32_t\necma_date_day_from_year (int32_t year) /**< year value */\n{\n  JERRY_ASSERT (fabs (365.0 * (year - 1970) + ((year - 1969) / 4.0) - ((year - 1901) / 100.0) + ((year - 1601) / 400.0))\n                < INT32_MAX);\n\n  if (JERRY_LIKELY (year >= 1970))\n  {\n    return (int32_t) (365 * (year - 1970) + ((year - 1969) / 4) - ((year - 1901) / 100) + ((year - 1601) / 400));\n  }\n\n  return (int32_t) (365 * (year - 1970) + floor ((year - 1969) / 4.0) - floor ((year - 1901) / 100.0)\n                    + floor ((year - 1601) / 400.0));\n} /* ecma_date_day_from_year */\n\n/**\n * Abstract operation: DaysInYear\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.3\n *\n * @return number of days in the given year\n */\nstatic int\necma_date_days_in_year (int32_t year) /**< year */\n{\n  if (year % 4 != 0 || (year % 100 == 0 && (year % 400 != 0)))\n  {\n    return ECMA_DATE_DAYS_IN_YEAR;\n  }\n\n  return ECMA_DATE_DAYS_IN_LEAP_YEAR;\n} /* ecma_date_days_in_year */\n\n/**\n * Abstract operation: InLeapYear\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.3\n *\n * @return 1 - if the year is leap\n *         0 - otherwise\n */\nstatic int32_t\necma_date_in_leap_year (int32_t year) /**< time value */\n{\n  return ecma_date_days_in_year (year) - ECMA_DATE_DAYS_IN_YEAR;\n} /* ecma_date_in_leap_year */\n\n/**\n * First days of months in normal and leap years\n */\nstatic const uint16_t first_day_in_month[2][12] = { {\n                                                      0,\n                                                      31,\n                                                      59,\n                                                      90,\n                                                      120,\n                                                      151,\n                                                      181,\n                                                      212,\n                                                      243,\n                                                      273,\n                                                      304,\n                                                      334, /* normal year */\n                                                    },\n                                                    {\n                                                      0,\n                                                      31,\n                                                      60,\n                                                      91,\n                                                      121,\n                                                      152,\n                                                      182,\n                                                      213,\n                                                      244,\n                                                      274,\n                                                      305,\n                                                      335 /* leap year */\n                                                    } };\n\n/**\n * Abstract operation: YearFromTime\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.3\n *\n * @return year corresponds to the given time\n */\nint32_t\necma_date_year_from_time (ecma_number_t time) /**< time value */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (time));\n\n  int32_t approx = (int32_t) (floor (time / ECMA_DATE_MS_PER_DAY / 365.2425) + 1970);\n  int64_t year_ms = ecma_date_day_from_year (approx) * ((int64_t) ECMA_DATE_MS_PER_DAY);\n\n  if ((ecma_number_t) year_ms > time)\n  {\n    approx--;\n  }\n\n  if ((ecma_number_t) (year_ms + ecma_date_days_in_year (approx) * ((int64_t) ECMA_DATE_MS_PER_DAY)) <= time)\n  {\n    approx++;\n  }\n\n  return approx;\n} /* ecma_date_year_from_time */\n\n/**\n * Abstract operation: MonthFromTime\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.4\n *\n * @return month corresponds to the given time\n */\nint32_t\necma_date_month_from_time (ecma_number_t time) /**< time value */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (time));\n\n  int32_t year = ecma_date_year_from_time (time);\n  int32_t day_within_year = ecma_date_day_from_time (time) - ecma_date_day_from_year (year);\n\n  JERRY_ASSERT (day_within_year >= 0 && day_within_year < ECMA_DATE_DAYS_IN_LEAP_YEAR);\n\n  int32_t in_leap_year = ecma_date_in_leap_year (year);\n\n  for (int i = 1; i < 12; i++)\n  {\n    if (day_within_year < first_day_in_month[in_leap_year][i])\n    {\n      return i - 1;\n    }\n  }\n\n  return 11;\n} /* ecma_date_month_from_time */\n\n/**\n * Abstract operation: DateFromTime\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.4\n *\n * @return date corresponds to the given time\n */\nint32_t\necma_date_date_from_time (ecma_number_t time) /**< time value */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (time));\n\n  int32_t year = ecma_date_year_from_time (time);\n  int32_t day_within_year = ecma_date_day_from_time (time) - ecma_date_day_from_year (year);\n\n  JERRY_ASSERT (day_within_year >= 0 && day_within_year < ECMA_DATE_DAYS_IN_LEAP_YEAR);\n\n  int32_t in_leap_year = ecma_date_in_leap_year (year);\n\n  int32_t month = 11;\n\n  for (int i = 1; i < 12; i++)\n  {\n    if (day_within_year < first_day_in_month[in_leap_year][i])\n    {\n      month = i - 1;\n      break;\n    }\n  }\n\n  return day_within_year + 1 - first_day_in_month[in_leap_year][month];\n} /* ecma_date_date_from_time */\n\n/**\n * Abstract operation: WeekDay\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.4\n *\n * @return weekday corresponds to the given time\n */\nint32_t\necma_date_week_day (ecma_number_t time) /**< time value */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (time));\n\n  int32_t day = ecma_date_day_from_time (time);\n\n  int week_day = (day + 4) % 7;\n\n  return week_day >= 0 ? week_day : week_day + 7;\n} /* ecma_date_week_day */\n\n/**\n * Abstract operation: LocalTZA\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.7\n *\n * @return local time zone adjustment\n */\nextern inline int32_t JERRY_ATTR_ALWAYS_INLINE\necma_date_local_time_zone_adjustment (ecma_number_t time) /**< time value */\n{\n  return jerry_port_local_tza (time);\n} /* ecma_date_local_time_zone_adjustment */\n\n/**\n * Abstract operation: UTC\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.9\n *\n * @return UTC time\n */\necma_number_t\necma_date_utc (ecma_number_t time) /**< time value */\n{\n  return time - jerry_port_local_tza (time);\n} /* ecma_date_utc */\n\n/**\n * Calculate the time component from the given time\n *\n * @return time component of the given time\n */\nint32_t\necma_date_time_in_day_from_time (ecma_number_t time) /**< time value */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (time));\n\n  ecma_number_t day = ecma_date_day_from_time (time);\n\n  return (int32_t) (time - (day * ECMA_DATE_MS_PER_DAY));\n} /* ecma_date_time_in_day_from_time */\n\n/**\n * Abstract operation: HourFromTime\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.10\n *\n * @return hours component of the given time\n */\nint32_t\necma_date_hour_from_time (ecma_number_t time) /**< time value */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (time));\n\n  int32_t time_in_day = ecma_date_time_in_day_from_time (time);\n\n  return (int32_t) (time_in_day / ECMA_DATE_MS_PER_HOUR);\n} /* ecma_date_hour_from_time */\n\n/**\n * Abstract operation: HourFromTime\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.10\n *\n * @return minutes component of the given time\n */\nint32_t\necma_date_min_from_time (ecma_number_t time) /**< time value */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (time));\n\n  int32_t time_in_day = ecma_date_time_in_day_from_time (time);\n\n  return ((int32_t) (time_in_day / ECMA_DATE_MS_PER_MINUTE)) % ECMA_DATE_MINUTES_PER_HOUR;\n} /* ecma_date_min_from_time */\n\n/**\n * Abstract operation: HourFromTime\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.10\n *\n * @return seconds component of the given time\n */\nint32_t\necma_date_sec_from_time (ecma_number_t time) /**< time value */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (time));\n\n  int32_t time_in_day = ecma_date_time_in_day_from_time (time);\n\n  return ((int32_t) (time_in_day / ECMA_DATE_MS_PER_SECOND)) % ECMA_DATE_SECONDS_PER_MINUTE;\n} /* ecma_date_sec_from_time */\n\n/**\n * Abstract operation: HourFromTime\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.10\n *\n * @return milliseconds component of the given time\n */\nint32_t\necma_date_ms_from_time (ecma_number_t time) /**< time value */\n{\n  JERRY_ASSERT (!ecma_number_is_nan (time));\n\n  int32_t time_in_day = ecma_date_time_in_day_from_time (time);\n\n  return (int32_t) (time_in_day % ECMA_DATE_MS_PER_SECOND);\n} /* ecma_date_ms_from_time */\n\n/**\n * Abstract operation: MakeTime\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.11\n *\n * @return constructed time in milliseconds\n */\necma_number_t\necma_date_make_time (ecma_number_t hour, /**< hour value */\n                     ecma_number_t min, /**< minute value */\n                     ecma_number_t sec, /**< second value */\n                     ecma_number_t ms) /**< millisecond value */\n{\n  if (!ecma_number_is_finite (hour) || !ecma_number_is_finite (min) || !ecma_number_is_finite (sec)\n      || !ecma_number_is_finite (ms))\n  {\n    return ecma_number_make_nan ();\n  }\n\n  ecma_number_t h = ecma_number_trunc (hour);\n  ecma_number_t m = ecma_number_trunc (min);\n  ecma_number_t s = ecma_number_trunc (sec);\n  ecma_number_t milli = ecma_number_trunc (ms);\n\n  return h * ECMA_DATE_MS_PER_HOUR + m * ECMA_DATE_MS_PER_MINUTE + s * ECMA_DATE_MS_PER_SECOND + milli;\n} /* ecma_date_make_time */\n\n/**\n * Abstract operation: MakeDay\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.12\n *\n * @return elpased number of days since Unix Epoch\n */\necma_number_t\necma_date_make_day (ecma_number_t year, /**< year value */\n                    ecma_number_t month, /**< month value */\n                    ecma_number_t date) /**< date value */\n{\n  /* 1. */\n  if (!ecma_number_is_finite (year) || !ecma_number_is_finite (month) || !ecma_number_is_finite (date))\n  {\n    return ecma_number_make_nan ();\n  }\n\n  /* 2., 3., 4. */\n  ecma_number_t m = ecma_number_trunc (month);\n  ecma_number_t dt = ecma_number_trunc (date);\n\n  /* 5. */\n  year += (floor (m / 12));\n  if (fabs (year) > ECMA_DATE_YEAR_LIMIT)\n  {\n    return ecma_number_make_nan ();\n  }\n\n  int32_t int_year = (int32_t) year;\n\n  /* 6. */\n  int32_t mn = (int32_t) fmod (m, 12);\n\n  if (mn < 0)\n  {\n    mn += 12;\n  }\n\n  /* 7. */\n  ecma_number_t days =\n    (ecma_date_day_from_year (int_year) + first_day_in_month[ecma_date_in_leap_year (int_year)][mn] + (dt - 1));\n  return days * ECMA_DATE_MS_PER_DAY;\n} /* ecma_date_make_day */\n\n/**\n * Abstract operation: MakeTime\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.13\n *\n * @return elpased number of milliceconds since Unix Epoch\n */\necma_number_t\necma_date_make_date (ecma_number_t day, /**< day value */\n                     ecma_number_t time) /**< time value */\n{\n  if (!ecma_number_is_finite (day) || !ecma_number_is_finite (time))\n  {\n    return ecma_number_make_nan ();\n  }\n\n  return day + time;\n} /* ecma_date_make_date */\n\n/**\n * Abstract operation: TimeClip\n *\n *  See also:\n *          ECMA-262 v11, 20.4.1.14\n *\n * @return elpased number of milliceconds since Unix Epoch\n */\necma_number_t\necma_date_time_clip (ecma_number_t time) /**< time value */\n{\n  if (!ecma_number_is_finite (time) || fabs (time) > ECMA_DATE_MAX_VALUE)\n  {\n    return ecma_number_make_nan ();\n  }\n\n  return ecma_number_trunc (time);\n} /* ecma_date_time_clip */\n\n/**\n * Common function to convert date to string.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_date_to_string_format (ecma_number_t datetime_number, /**< datetime */\n                            const char *format_p) /**< format buffer */\n{\n  const uint32_t date_buffer_length = 37;\n  JERRY_VLA (lit_utf8_byte_t, date_buffer, date_buffer_length);\n\n  lit_utf8_byte_t *dest_p = date_buffer;\n\n  while (*format_p != LIT_CHAR_NULL)\n  {\n    if (*format_p != LIT_CHAR_DOLLAR_SIGN)\n    {\n      *dest_p++ = (lit_utf8_byte_t) *format_p++;\n      continue;\n    }\n\n    format_p++;\n\n    const char *str_p = NULL;\n    int32_t number = 0;\n    int32_t number_length = 0;\n\n    switch (*format_p)\n    {\n      case LIT_CHAR_UPPERCASE_Y: /* Year. */\n      {\n        number = ecma_date_year_from_time (datetime_number);\n\n        if (number >= 100000 || number <= -100000)\n        {\n          number_length = 6;\n        }\n        else if (number >= 10000 || number <= -10000)\n        {\n          number_length = 5;\n        }\n        else\n        {\n          number_length = 4;\n        }\n        break;\n      }\n      case LIT_CHAR_LOWERCASE_Y: /* ISO Year: -000001, 0000, 0001, 9999, +012345 */\n      {\n        number = ecma_date_year_from_time (datetime_number);\n        if (0 <= number && number <= 9999)\n        {\n          number_length = 4;\n        }\n        else\n        {\n          number_length = 6;\n        }\n        break;\n      }\n      case LIT_CHAR_UPPERCASE_M: /* Month. */\n      {\n        int32_t month = ecma_date_month_from_time (datetime_number);\n\n        JERRY_ASSERT (month >= 0 && month <= 11);\n\n        str_p = month_names_p[month];\n        break;\n      }\n      case LIT_CHAR_UPPERCASE_O: /* Month as number. */\n      {\n        /* The 'ecma_date_month_from_time' (ECMA 262 v5, 15.9.1.4) returns a\n         * number from 0 to 11, but we have to print the month from 1 to 12\n         * for ISO 8601 standard (ECMA 262 v5, 15.9.1.15). */\n        number = ecma_date_month_from_time (datetime_number) + 1;\n        number_length = 2;\n        break;\n      }\n      case LIT_CHAR_UPPERCASE_D: /* Day. */\n      {\n        number = ecma_date_date_from_time (datetime_number);\n        number_length = 2;\n        break;\n      }\n      case LIT_CHAR_UPPERCASE_W: /* Day of week. */\n      {\n        int32_t day = ecma_date_week_day (datetime_number);\n\n        JERRY_ASSERT (day >= 0 && day <= 6);\n\n        str_p = day_names_p[day];\n        break;\n      }\n      case LIT_CHAR_LOWERCASE_H: /* Hour. */\n      {\n        number = ecma_date_hour_from_time (datetime_number);\n        number_length = 2;\n        break;\n      }\n      case LIT_CHAR_LOWERCASE_M: /* Minutes. */\n      {\n        number = ecma_date_min_from_time (datetime_number);\n        number_length = 2;\n        break;\n      }\n      case LIT_CHAR_LOWERCASE_S: /* Seconds. */\n      {\n        number = ecma_date_sec_from_time (datetime_number);\n        number_length = 2;\n        break;\n      }\n      case LIT_CHAR_LOWERCASE_I: /* Milliseconds. */\n      {\n        number = ecma_date_ms_from_time (datetime_number);\n        number_length = 3;\n        break;\n      }\n      case LIT_CHAR_LOWERCASE_Z: /* Time zone hours part. */\n      {\n        int32_t time_zone = ecma_date_local_time_zone_adjustment (datetime_number);\n\n        if (time_zone >= 0)\n        {\n          *dest_p++ = LIT_CHAR_PLUS;\n        }\n        else\n        {\n          *dest_p++ = LIT_CHAR_MINUS;\n          time_zone = -time_zone;\n        }\n\n        number = time_zone / ECMA_DATE_MS_PER_HOUR;\n        number_length = 2;\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (*format_p == LIT_CHAR_UPPERCASE_Z); /* Time zone minutes part. */\n\n        int32_t time_zone = ecma_date_local_time_zone_adjustment (datetime_number);\n\n        if (time_zone < 0)\n        {\n          time_zone = -time_zone;\n        }\n\n        number = (time_zone % ECMA_DATE_MS_PER_HOUR) / ECMA_DATE_MS_PER_MINUTE;\n        number_length = 2;\n        break;\n      }\n    }\n\n    format_p++;\n\n    if (str_p != NULL)\n    {\n      /* Print string values: month or day name which is always 3 characters */\n      memcpy (dest_p, str_p, 3);\n      dest_p += 3;\n      continue;\n    }\n\n    /* Print right aligned number values. */\n    JERRY_ASSERT (number_length > 0);\n\n    if (number < 0)\n    {\n      number = -number;\n      *dest_p++ = '-';\n    }\n    else if (*(format_p - 1) == LIT_CHAR_LOWERCASE_Y && number_length == 6)\n    {\n      /* positive sign is compulsory for extended years */\n      *dest_p++ = '+';\n    }\n\n    dest_p += number_length;\n    lit_utf8_byte_t *buffer_p = dest_p;\n\n    do\n    {\n      buffer_p--;\n      *buffer_p = (lit_utf8_byte_t) ((number % 10) + (int32_t) LIT_CHAR_0);\n      number /= 10;\n    } while (--number_length);\n  }\n\n  JERRY_ASSERT (dest_p <= date_buffer + date_buffer_length);\n\n  return ecma_make_string_value (\n    ecma_new_ecma_string_from_ascii (date_buffer, (lit_utf8_size_t) (dest_p - date_buffer)));\n} /* ecma_date_to_string_format */\n\n/**\n * Common function to create a time zone specific string from a numeric value.\n *\n * Used by:\n *        - The Date routine.\n *        - The Date.prototype.toString routine.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_date_value_to_string (ecma_number_t datetime_number) /**< datetime */\n{\n  datetime_number += ecma_date_local_time_zone_adjustment (datetime_number);\n  return ecma_date_to_string_format (datetime_number, \"$W $M $D $Y $h:$m:$s GMT$z$Z\");\n} /* ecma_date_value_to_string */\n\n/**\n * Common function to create a time zone specific string from a numeric value.\n *\n * Used by:\n *        - The Date.prototype.toUTCString routine.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_date_value_to_utc_string (ecma_number_t datetime_number) /**< datetime */\n{\n  return ecma_date_to_string_format (datetime_number, \"$W, $D $M $Y $h:$m:$s GMT\");\n} /* ecma_date_value_to_utc_string */\n\n/**\n * Common function to create a ISO specific string from a numeric value.\n *\n * Used by:\n *        - The Date.prototype.toISOString routine.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_date_value_to_iso_string (ecma_number_t datetime_number) /**<datetime */\n{\n  return ecma_date_to_string_format (datetime_number, \"$y-$O-$DT$h:$m:$s.$iZ\");\n} /* ecma_date_value_to_iso_string */\n\n/**\n * Common function to create a date string from a numeric value.\n *\n * Used by:\n *        - The Date.prototype.toDateString routine.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_date_value_to_date_string (ecma_number_t datetime_number) /**<datetime */\n{\n  return ecma_date_to_string_format (datetime_number, \"$W $M $D $Y\");\n} /* ecma_date_value_to_date_string */\n\n/**\n * Common function to create a time string from a numeric value.\n *\n * Used by:\n *        - The Date.prototype.toTimeString routine.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_date_value_to_time_string (ecma_number_t datetime_number) /**<datetime */\n{\n  return ecma_date_to_string_format (datetime_number, \"$h:$m:$s GMT$z$Z\");\n} /* ecma_date_value_to_time_string */\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_DATE */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-helpers-error.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jrt.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltinhelpers ECMA builtin helper operations\n * @{\n */\n\n/**\n * Handle calling [[Call]] of a built-in error object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_helper_error_dispatch_call (jerry_error_t error_type, /**< native error type */\n                                         const ecma_value_t *arguments_list_p, /**< arguments list */\n                                         uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  if (arguments_list_len != 0 && !ecma_is_value_undefined (arguments_list_p[0]))\n  {\n    ecma_string_t *message_string_p = ecma_op_to_string (arguments_list_p[0]);\n\n    if (JERRY_UNLIKELY (message_string_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_object_t *new_error_object_p = ecma_new_standard_error (error_type, message_string_p);\n\n    ecma_deref_ecma_string (message_string_p);\n    return ecma_make_object_value (new_error_object_p);\n  }\n\n  ecma_object_t *new_error_object_p = ecma_new_standard_error (error_type, NULL);\n\n  return ecma_make_object_value (new_error_object_p);\n} /* ecma_builtin_helper_error_dispatch_call */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-helpers-json.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-helpers.h\"\n\n#include \"lit-char-helpers.h\"\n\n#if JERRY_BUILTIN_JSON\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltinhelpers ECMA builtin helper operations\n * @{\n */\n\n/**\n * Check whether the object is pushed onto the occurrence stack\n *\n * Used by:\n *         - ecma_builtin_json_object step 1\n *         - ecma_builtin_json_array step 1\n *\n * @return true - if the object is pushed onto the occurrence stack\n *         false - otherwise\n */\nbool\necma_json_has_object_in_stack (ecma_json_occurrence_stack_item_t *stack_p, /**< stack */\n                               ecma_object_t *object_p) /**< object */\n{\n  while (stack_p != NULL)\n  {\n    if (stack_p->object_p == object_p)\n    {\n      return true;\n    }\n\n    stack_p = stack_p->next_p;\n  }\n\n  return false;\n} /* ecma_json_has_object_in_stack */\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_JSON */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-helpers-macro-defines.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef SIMPLE_VALUE\n#define SIMPLE_VALUE(name, simple_value, prop_attributes)\n#endif /* !SIMPLE_VALUE */\n\n#ifndef NUMBER_VALUE\n#define NUMBER_VALUE(name, number_value, prop_attributes)\n#endif /* !NUMBER_VALUE */\n\n#ifndef STRING_VALUE\n#define STRING_VALUE(name, magic_string_id, prop_attributes)\n#endif /* !STRING_VALUE */\n\n#ifndef SYMBOL_VALUE\n#define SYMBOL_VALUE(symbol, desc_magic_string_id)\n#endif /* !SYMBOL_VALUE */\n\n#ifndef INTRINSIC_PROPERTY\n#define INTRINSIC_PROPERTY(name, magic_string_id, prop_attributes)\n#endif /* !INTRINSIC_PROPERTY */\n\n#ifndef ACCESSOR_BUILTIN_FUNCTION_OBJECT\n#define ACCESSOR_BUILTIN_FUNCTION_OBJECT(name, getter_builtin_id, setter_builtin_id, prop_attributes)\n#endif /* !ACCESSOR_BUILTIN_FUNCTION_OBJECT */\n\n#ifndef OBJECT_VALUE\n#define OBJECT_VALUE(name, obj_builtin_id, prop_attributes)\n#endif /* !OBJECT_VALUE */\n\n#ifndef ROUTINE\n#define ROUTINE(name, c_function_name, args_number, length_prop_value)\n#endif /* !ROUTINE */\n\n#ifndef ROUTINE_CONFIGURABLE_ONLY\n#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value)\n#endif /* !ROUTINE_CONFIGURABLE_ONLY */\n\n#ifndef ROUTINE_WITH_FLAGS\n#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags)\n#endif /* !ROUTINE_WITH_FLAGS */\n\n#ifndef ACCESSOR_READ_WRITE\n#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes)\n#endif /* !ACCESSOR_READ_WRITE */\n\n#ifndef ACCESSOR_READ_ONLY\n#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes)\n#endif /* !ACCESSOR_READ_ONLY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-helpers-macro-undefs.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#undef SIMPLE_VALUE\n#undef NUMBER_VALUE\n#undef STRING_VALUE\n#undef SYMBOL_VALUE\n#undef INTRINSIC_PROPERTY\n#undef ACCESSOR_BUILTIN_FUNCTION_OBJECT\n#undef OBJECT_VALUE\n#undef ROUTINE\n#undef ROUTINE_CONFIGURABLE_ONLY\n#undef ROUTINE_WITH_FLAGS\n#undef ACCESSOR_READ_WRITE\n#undef ACCESSOR_READ_ONLY\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-helpers-sort.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers-number.h\"\n\n/**\n * Function used to merge two arrays for merge sort.\n * Arrays are stored as below:\n * First  -> source_array_p [left_idx : right_idx - 1]\n * Second -> source_array_p [right_idx : end_idx - 1]\n * Output -> output_array_p\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_helper_array_merge_sort_bottom_up (ecma_value_t *source_array_p, /**< arrays to merge */\n                                                uint32_t left_idx, /**< first array begin */\n                                                uint32_t right_idx, /**< first array end */\n                                                uint32_t end_idx, /**< second array end */\n                                                ecma_value_t *output_array_p, /**< output array */\n                                                ecma_value_t compare_func, /**< compare function */\n                                                const ecma_builtin_helper_sort_compare_fn_t sort_cb, /**< sorting cb */\n                                                ecma_object_t *array_buffer_p) /* array_buffer_p */\n{\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n  uint32_t i = left_idx, j = right_idx;\n\n  for (uint32_t k = left_idx; k < end_idx; k++)\n  {\n    ecma_value_t compare_value = ecma_make_number_value (ECMA_NUMBER_ZERO);\n\n    if (i < right_idx && j < end_idx)\n    {\n      compare_value = sort_cb (source_array_p[i], source_array_p[j], compare_func, array_buffer_p);\n      if (ECMA_IS_VALUE_ERROR (compare_value))\n      {\n        ret_value = ECMA_VALUE_ERROR;\n        break;\n      }\n    }\n\n    if (i < right_idx && ecma_get_number_from_value (compare_value) <= ECMA_NUMBER_ZERO)\n    {\n      output_array_p[k] = source_array_p[i];\n      i++;\n    }\n    else\n    {\n      output_array_p[k] = source_array_p[j];\n      j++;\n    }\n    ecma_free_value (compare_value);\n  }\n\n  return ret_value;\n} /* ecma_builtin_helper_array_merge_sort_bottom_up */\n\n/**\n * Mergesort function\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_helper_array_merge_sort_helper (ecma_value_t *array_p, /**< array to sort */\n                                             uint32_t length, /**< length */\n                                             ecma_value_t compare_func, /**< compare function */\n                                             const ecma_builtin_helper_sort_compare_fn_t sort_cb, /**< sorting cb */\n                                             ecma_object_t *array_buffer_p) /**< arrayBuffer */\n{\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n  JMEM_DEFINE_LOCAL_ARRAY (dest_array_p, length, ecma_value_t);\n\n  ecma_value_t *temp_p;\n  ecma_value_t *base_array_p = array_p;\n  uint32_t r, e;\n\n  for (uint32_t w = 1; w < length; w = 2 * w)\n  {\n    for (uint32_t i = 0; i < length; i = i + 2 * w)\n    {\n      // End of first array\n      r = i + w;\n      if (r > length)\n      {\n        r = length;\n      }\n\n      // End of second array\n      e = i + 2 * w;\n      if (e > length)\n      {\n        e = length;\n      }\n\n      // Merge two arrays\n      ret_value = ecma_builtin_helper_array_merge_sort_bottom_up (array_p,\n                                                                  i,\n                                                                  r,\n                                                                  e,\n                                                                  dest_array_p,\n                                                                  compare_func,\n                                                                  sort_cb,\n                                                                  array_buffer_p);\n      if (ECMA_IS_VALUE_ERROR (ret_value))\n      {\n        break;\n      }\n    }\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      break;\n    }\n\n    // Swap arrays\n    temp_p = dest_array_p;\n    dest_array_p = array_p;\n    array_p = temp_p;\n  }\n\n  // Sorted array is in dest_array_p - there was uneven number of arrays swaps\n  if (dest_array_p == base_array_p)\n  {\n    uint32_t index = 0;\n    temp_p = dest_array_p;\n    dest_array_p = array_p;\n    array_p = temp_p;\n\n    while (index < length)\n    {\n      array_p[index] = dest_array_p[index];\n      index++;\n    }\n    JERRY_ASSERT (index == length);\n  }\n\n  JMEM_FINALIZE_LOCAL_ARRAY (dest_array_p);\n\n  return ret_value;\n} /* ecma_builtin_helper_array_merge_sort_helper */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jmem.h\"\n#include \"lit-char-helpers.h\"\n#include \"lit-magic-strings.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltinhelpers ECMA builtin helper operations\n * @{\n */\n\n/**\n * Helper function for Object.prototype.toString routine when\n * the @@toStringTag property is present\n *\n * See also:\n *          ECMA-262 v6, 19.1.3.6\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_helper_object_to_string_tag_helper (ecma_value_t tag_value) /**< string tag */\n{\n  JERRY_ASSERT (ecma_is_value_string (tag_value));\n\n  ecma_string_t *tag_str_p = ecma_get_string_from_value (tag_value);\n  lit_utf8_size_t tag_str_size = ecma_string_get_size (tag_str_p);\n  ecma_string_t *ret_string_p;\n\n  /* Building string \"[object #@@toStringTag#]\"\n     The string size will be size(\"[object \") + size(#@@toStringTag#) + size (\"]\"). */\n  const lit_utf8_size_t buffer_size = 9 + tag_str_size;\n  JMEM_DEFINE_LOCAL_ARRAY (str_buffer, buffer_size, lit_utf8_byte_t);\n\n  lit_utf8_byte_t *buffer_ptr = str_buffer;\n\n  const lit_magic_string_id_t magic_string_ids[] = {\n    LIT_MAGIC_STRING_LEFT_SQUARE_CHAR,\n    LIT_MAGIC_STRING_OBJECT,\n    LIT_MAGIC_STRING_SPACE_CHAR,\n  };\n\n  /* Copy to buffer the \"[object \" string */\n  for (uint32_t i = 0; i < sizeof (magic_string_ids) / sizeof (lit_magic_string_id_t); ++i)\n  {\n    buffer_ptr = lit_copy_magic_string_to_buffer (magic_string_ids[i],\n                                                  buffer_ptr,\n                                                  (lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr));\n\n    JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size);\n  }\n\n  /* Copy to buffer the #@@toStringTag# string */\n  ecma_string_to_cesu8_bytes (tag_str_p, buffer_ptr, tag_str_size);\n  buffer_ptr += tag_str_size;\n\n  JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size);\n\n  /* Copy to buffer the \"]\" string */\n  buffer_ptr = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_RIGHT_SQUARE_CHAR,\n                                                buffer_ptr,\n                                                (lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr));\n\n  JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size);\n\n  ret_string_p = ecma_new_ecma_string_from_utf8 (str_buffer, (lit_utf8_size_t) (buffer_ptr - str_buffer));\n\n  JMEM_FINALIZE_LOCAL_ARRAY (str_buffer);\n  ecma_deref_ecma_string (tag_str_p);\n\n  return ecma_make_string_value (ret_string_p);\n} /* ecma_builtin_helper_object_to_string_tag_helper */\n\n/**\n * Common implementation of the Object.prototype.toString routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.4.2\n *\n * Used by:\n *         - The Object.prototype.toString routine.\n *         - The Array.prototype.toString routine as fallback.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\n\necma_value_t\necma_builtin_helper_object_to_string (const ecma_value_t this_arg) /**< this argument */\n{\n  lit_magic_string_id_t builtin_tag;\n\n  if (ecma_is_value_undefined (this_arg))\n  {\n    builtin_tag = LIT_MAGIC_STRING_UNDEFINED_UL;\n  }\n  else if (ecma_is_value_null (this_arg))\n  {\n    builtin_tag = LIT_MAGIC_STRING_NULL_UL;\n  }\n  else\n  {\n    ecma_value_t obj_this = ecma_op_to_object (this_arg);\n\n    if (ECMA_IS_VALUE_ERROR (obj_this))\n    {\n      return obj_this;\n    }\n\n    JERRY_ASSERT (ecma_is_value_object (obj_this));\n\n    ecma_object_t *obj_p = ecma_get_object_from_value (obj_this);\n\n    builtin_tag = ecma_object_get_class_name (obj_p);\n\n    ecma_value_t is_array = ecma_is_value_array (obj_this);\n\n    if (ECMA_IS_VALUE_ERROR (is_array))\n    {\n      ecma_deref_object (obj_p);\n      return is_array;\n    }\n\n    if (ecma_is_value_true (is_array))\n    {\n      builtin_tag = LIT_MAGIC_STRING_ARRAY_UL;\n    }\n\n    ecma_value_t tag = ecma_op_object_get_by_symbol_id (obj_p, LIT_GLOBAL_SYMBOL_TO_STRING_TAG);\n\n    if (ECMA_IS_VALUE_ERROR (tag))\n    {\n      ecma_deref_object (obj_p);\n      return tag;\n    }\n\n    if (ecma_is_value_string (tag))\n    {\n      ecma_deref_object (obj_p);\n      return ecma_builtin_helper_object_to_string_tag_helper (tag);\n    }\n    else if (builtin_tag != LIT_MAGIC_STRING_ARGUMENTS_UL && builtin_tag != LIT_MAGIC_STRING_FUNCTION_UL\n             && builtin_tag != LIT_MAGIC_STRING_ERROR_UL && builtin_tag != LIT_MAGIC_STRING_BOOLEAN_UL\n             && builtin_tag != LIT_MAGIC_STRING_NUMBER_UL && builtin_tag != LIT_MAGIC_STRING_STRING_UL\n             && builtin_tag != LIT_MAGIC_STRING_DATE_UL && builtin_tag != LIT_MAGIC_STRING_REGEXP_UL\n             && builtin_tag != LIT_MAGIC_STRING_ARRAY_UL)\n    {\n      builtin_tag = LIT_MAGIC_STRING_OBJECT_UL;\n    }\n\n    ecma_free_value (tag);\n    ecma_deref_object (obj_p);\n  }\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  ecma_stringbuilder_append_magic (&builder, LIT_MAGIC_STRING_OBJECT_TO_STRING_UL);\n  ecma_stringbuilder_append_magic (&builder, builtin_tag);\n  ecma_stringbuilder_append_byte (&builder, LIT_CHAR_RIGHT_SQUARE);\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_helper_object_to_string */\n\n/**\n * The Array.prototype's 'toLocaleString' single element operation routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.3 steps 6-8 and 10.b-d\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_string_t *\necma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, /**< this object */\n                                                   ecma_length_t index) /**< array index */\n{\n  ecma_value_t index_value = ecma_op_object_get_by_index (obj_p, index);\n\n  if (ECMA_IS_VALUE_ERROR (index_value))\n  {\n    return NULL;\n  }\n\n  if (ecma_is_value_undefined (index_value) || ecma_is_value_null (index_value))\n  {\n    return ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  ecma_value_t call_value = ecma_op_invoke_by_magic_id (index_value, LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, NULL, 0);\n\n  ecma_free_value (index_value);\n\n  if (ECMA_IS_VALUE_ERROR (call_value))\n  {\n    return NULL;\n  }\n\n  ecma_string_t *ret_string_p = ecma_op_to_string (call_value);\n\n  ecma_free_value (call_value);\n\n  return ret_string_p;\n} /* ecma_builtin_helper_get_to_locale_string_at_index */\n\n/**\n * Helper function to normalizing an array index\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.10 steps 5, 6, 7 part 2, 8\n *          ECMA-262 v5, 15.4.4.12 steps 5, 6\n *\n *          ECMA-262 v6, 22.1.3.6 steps 5 - 7, 8 part 2, 9, 10\n *          ECMA-262 v6, 22.1.3.3 steps 5 - 10, 11 part 2, 12, 13\n *\n * Used by:\n *         - The Array.prototype.slice routine.\n *         - The Array.prototype.splice routine.\n *         - The Array.prototype.fill routine.\n *         - The Array.prototype.copyWithin routine.\n *\n * @return ECMA_VALUE_EMPTY if successful\n *         conversion error otherwise\n */\necma_value_t\necma_builtin_helper_array_index_normalize (ecma_value_t arg, /**< index */\n                                           ecma_length_t length, /**< array's length */\n                                           ecma_length_t *number_p) /**< [out] ecma_length_t */\n{\n  ecma_number_t to_int;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (arg, &to_int)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  *number_p = ((to_int < 0) ? (ecma_length_t) JERRY_MAX (((ecma_number_t) length + to_int), 0)\n                            : (ecma_length_t) JERRY_MIN (to_int, (ecma_number_t) length));\n\n  return ECMA_VALUE_EMPTY;\n} /* ecma_builtin_helper_array_index_normalize */\n\n/**\n * Helper function to normalizing an uint32 index\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.13 steps 4 - 7\n *          ECMA-262 v6, 22.2.3.5 steps 5 - 10, 11 part 2, 12, 13\n *          ECMA-262 v6, 22.2.3.23 steps 5 - 10\n *          ECMA-262 v6, 24.1.4.3 steps 6 - 8, 9 part 2, 10, 11\n *          ECMA-262 v6, 22.2.3.26 steps 7 - 9, 10 part 2, 11, 12\n *          ECMA-262 v6, 22.2.3.8 steps 5 - 7, 8 part 2, 9, 10\n *\n * Used by:\n *         - The String.prototype.slice routine.\n *         - The Array.prototype.copyWithin routine.\n *         - The TypedArray.prototype.copyWithin routine.\n *         - The TypedArray.prototype.slice routine.\n *         - The ArrayBuffer.prototype.slice routine.\n *         - The TypedArray.prototype.subarray routine.\n *         - The TypedArray.prototype.fill routine.\n *\n * @return ECMA_VALUE_EMPTY if successful\n *         conversion error otherwise\n */\necma_value_t\necma_builtin_helper_uint32_index_normalize (ecma_value_t arg, /**< index */\n                                            uint32_t length, /**< array's length */\n                                            uint32_t *number_p) /**< [out] uint32_t number */\n{\n  ecma_number_t to_int;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (arg, &to_int)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  *number_p = ((to_int < 0) ? (uint32_t) JERRY_MAX ((ecma_number_t) length + to_int, 0)\n                            : (uint32_t) JERRY_MIN (to_int, (ecma_number_t) length));\n\n  return ECMA_VALUE_EMPTY;\n} /* ecma_builtin_helper_uint32_index_normalize */\n\n/**\n * Helper function for concatenating an ecma_value_t to an Array.\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.4 steps 5.b - 5.c\n *\n * Used by:\n *         - The Array.prototype.concat routine.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_helper_array_concat_value (ecma_object_t *array_obj_p, /**< array */\n                                        ecma_length_t *length_p, /**< [in,out] array's length */\n                                        ecma_value_t value) /**< value to concat */\n{\n  /* 5.b */\n  ecma_value_t is_spreadable = ecma_op_is_concat_spreadable (value);\n\n  if (ECMA_IS_VALUE_ERROR (is_spreadable))\n  {\n    return is_spreadable;\n  }\n\n  bool spread_object = is_spreadable == ECMA_VALUE_TRUE;\n  /* ES11: 22.1.3.1.5.c.iv.3.b */\n  const uint32_t prop_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;\n\n  if (spread_object)\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (value);\n\n    ecma_length_t arg_len;\n    ecma_value_t error = ecma_op_object_get_length (obj_p, &arg_len);\n\n    if (ECMA_IS_VALUE_ERROR (error))\n    {\n      return error;\n    }\n\n    /* 4 . */\n    if ((ecma_number_t) (*length_p + arg_len) > ECMA_NUMBER_MAX_SAFE_INTEGER)\n    {\n      return ecma_raise_type_error (ECMA_ERR_INVALID_ARRAY_LENGTH);\n    }\n\n    /* 5.b.iii */\n    for (ecma_length_t array_index = 0; array_index < arg_len; array_index++)\n    {\n      /* 5.b.iii.2 */\n      ecma_value_t get_value = ecma_op_object_find_by_index (obj_p, array_index);\n\n      if (ECMA_IS_VALUE_ERROR (get_value))\n      {\n        return get_value;\n      }\n\n      if (!ecma_is_value_found (get_value))\n      {\n        continue;\n      }\n\n      /* 5.b.iii.3.b */\n      /* This will always be a simple value since 'is_throw' is false, so no need to free. */\n      ecma_value_t put_comp =\n        ecma_builtin_helper_def_prop_by_index (array_obj_p, *length_p + array_index, get_value, prop_flags);\n      ecma_free_value (get_value);\n\n      if (ECMA_IS_VALUE_ERROR (put_comp))\n      {\n        return put_comp;\n      }\n    }\n\n    *length_p += arg_len;\n    return ECMA_VALUE_EMPTY;\n  }\n\n  /* 5.c.i */\n  /* This will always be a simple value since 'is_throw' is false, so no need to free. */\n  ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p, (*length_p)++, value, prop_flags);\n\n  if (ECMA_IS_VALUE_ERROR (put_comp))\n  {\n    return put_comp;\n  }\n\n  return ECMA_VALUE_EMPTY;\n} /* ecma_builtin_helper_array_concat_value */\n\n/**\n * Helper function to normalizing a string index\n *\n * This function clamps the given index to the [0, length] range.\n * If the index is negative, 0 value is used.\n * If the index is greater than the length of the string, the normalized index will be the length of the string.\n * NaN is mapped to zero or length depending on the nan_to_zero parameter.\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.15\n *\n * Used by:\n *         - The String.prototype.substring routine.\n *         - The ecma_builtin_helper_string_prototype_object_index_of helper routine.\n *\n * @return lit_utf8_size_t - the normalized value of the index\n */\nlit_utf8_size_t\necma_builtin_helper_string_index_normalize (ecma_number_t index, /**< index */\n                                            lit_utf8_size_t length, /**< string's length */\n                                            bool nan_to_zero) /**< whether NaN is mapped to zero (t) or length (f) */\n{\n  uint32_t norm_index = 0;\n\n  if (ecma_number_is_nan (index))\n  {\n    if (!nan_to_zero)\n    {\n      norm_index = length;\n    }\n  }\n  else if (!ecma_number_is_negative (index))\n  {\n    if (ecma_number_is_infinity (index))\n    {\n      norm_index = length;\n    }\n    else\n    {\n      norm_index = ecma_number_to_uint32 (index);\n\n      if (norm_index > length)\n      {\n        norm_index = length;\n      }\n    }\n  }\n\n  return norm_index;\n} /* ecma_builtin_helper_string_index_normalize */\n\n/**\n * Helper function for finding lastindex of a search string\n *\n * This function clamps the given index to the [0, length] range.\n * If the index is negative, 0 value is used.\n * If the index is greater than the length of the string, the normalized index will be the length of the string.\n *\n * See also:\n *          ECMA-262 v6, 21.1.3.9\n *\n * Used by:\n *         - The ecma_builtin_helper_string_prototype_object_index_of helper routine.\n *         - The ecma_builtin_string_prototype_object_replace_match helper routine.\n *\n * @return uint32_t - whether there is a match for the search string\n */\nstatic uint32_t\necma_builtin_helper_string_find_last_index (ecma_string_t *original_str_p, /**< original string */\n                                            ecma_string_t *search_str_p, /**< search string */\n                                            uint32_t position) /**< start_position */\n{\n  if (ecma_string_is_empty (search_str_p))\n  {\n    return position;\n  }\n\n  uint32_t original_length = ecma_string_get_length (original_str_p);\n\n  ECMA_STRING_TO_UTF8_STRING (search_str_p, search_str_utf8_p, search_str_size);\n  ECMA_STRING_TO_UTF8_STRING (original_str_p, original_str_utf8_p, original_str_size);\n\n  uint32_t ret_value = UINT32_MAX;\n\n  if (original_str_size >= search_str_size)\n  {\n    const lit_utf8_byte_t *end_p = original_str_utf8_p + original_str_size;\n    const lit_utf8_byte_t *current_p = end_p;\n\n    for (ecma_number_t i = original_length; i > position; i--)\n    {\n      lit_utf8_decr (&current_p);\n    }\n\n    while (current_p + search_str_size > end_p)\n    {\n      lit_utf8_decr (&current_p);\n      position--;\n    }\n\n    while (true)\n    {\n      if (memcmp (current_p, search_str_utf8_p, search_str_size) == 0)\n      {\n        ret_value = position;\n        break;\n      }\n\n      if (position == 0)\n      {\n        break;\n      }\n\n      lit_utf8_decr (&current_p);\n      position--;\n    }\n  }\n  ECMA_FINALIZE_UTF8_STRING (original_str_utf8_p, original_str_size);\n  ECMA_FINALIZE_UTF8_STRING (search_str_utf8_p, search_str_size);\n\n  return ret_value;\n} /* ecma_builtin_helper_string_find_last_index */\n\n/**\n * Helper function for string indexOf, lastIndexOf, startsWith, includes, endsWith functions\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.7\n *          ECMA-262 v5, 15.5.4.8\n *          ECMA-262 v6, 21.1.3.6\n *          ECMA-262 v6, 21.1.3.7\n *          ECMA-262 v6, 21.1.3.18\n *\n * Used by:\n *         - The String.prototype.indexOf routine.\n *         - The String.prototype.lastIndexOf routine.\n *         - The String.prototype.startsWith routine.\n *         - The String.prototype.includes routine.\n *         - The String.prototype.endsWith routine.\n *\n * @return ecma_value_t - Returns index (last index) or a\n *                        boolean value\n */\necma_value_t\necma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_str_p, /**< this argument */\n                                                      ecma_value_t arg1, /**< routine's first argument */\n                                                      ecma_value_t arg2, /**< routine's second argument */\n                                                      ecma_string_index_of_mode_t mode) /**< routine's mode */\n{\n  /* 5 (indexOf) -- 6 (lastIndexOf) */\n  const lit_utf8_size_t original_len = ecma_string_get_length (original_str_p);\n\n  /* 4, 6 (startsWith, includes, endsWith) */\n  if (mode >= ECMA_STRING_STARTS_WITH)\n  {\n    ecma_value_t regexp = ecma_op_is_regexp (arg1);\n\n    if (ECMA_IS_VALUE_ERROR (regexp))\n    {\n      return regexp;\n    }\n\n    if (regexp == ECMA_VALUE_TRUE)\n    {\n      JERRY_ASSERT (ECMA_STRING_LAST_INDEX_OF < mode && mode <= ECMA_STRING_ENDS_WITH);\n      return ecma_raise_type_error (ECMA_ERR_SEARCH_STRING_CANNOT_BE_OF_TYPE_REGEXP);\n    }\n  }\n\n  /* 7, 8 */\n  ecma_string_t *search_str_p = ecma_op_to_string (arg1);\n\n  if (JERRY_UNLIKELY (search_str_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t ret_value;\n\n  /* 4 (indexOf, lastIndexOf), 9 (startsWith, includes), 10 (endsWith) */\n  ecma_number_t pos_num;\n\n  if (mode > ECMA_STRING_LAST_INDEX_OF)\n  {\n    ret_value = ecma_op_to_integer (arg2, &pos_num);\n  }\n  else\n  {\n    ret_value = ecma_op_to_number (arg2, &pos_num);\n  }\n\n  /* 10 (startsWith, includes), 11 (endsWith) */\n  if (ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    ecma_deref_ecma_string (search_str_p);\n    return ret_value;\n  }\n\n  bool use_first_index = mode != ECMA_STRING_LAST_INDEX_OF;\n\n  /* 4b, 6 (indexOf) - 4b, 5, 7 (lastIndexOf) */\n  lit_utf8_size_t start = ecma_builtin_helper_string_index_normalize (pos_num, original_len, use_first_index);\n\n  ecma_number_t ret_num = ECMA_NUMBER_MINUS_ONE;\n\n  ret_value = ECMA_VALUE_FALSE;\n\n  switch (mode)\n  {\n    case ECMA_STRING_STARTS_WITH:\n    {\n      if (start > original_len)\n      {\n        break;\n      }\n      /* 15, 16 (startsWith) */\n      uint32_t index = ecma_builtin_helper_string_find_index (original_str_p, search_str_p, start);\n      ret_value = ecma_make_boolean_value (index == start);\n      break;\n    }\n    case ECMA_STRING_INCLUDES:\n    {\n      if (ecma_builtin_helper_string_find_index (original_str_p, search_str_p, start) != UINT32_MAX)\n      {\n        ret_value = ECMA_VALUE_TRUE;\n      }\n      break;\n    }\n    case ECMA_STRING_ENDS_WITH:\n    {\n      if (start == 0)\n      {\n        start = original_len;\n      }\n\n      lit_utf8_size_t search_str_len = ecma_string_get_length (search_str_p);\n\n      if (search_str_len == 0)\n      {\n        ret_value = ECMA_VALUE_TRUE;\n        break;\n      }\n\n      int32_t start_ends_with = (int32_t) (start - search_str_len);\n\n      if (start_ends_with < 0)\n      {\n        break;\n      }\n      uint32_t index = ecma_builtin_helper_string_find_index (original_str_p, search_str_p, (uint32_t) start_ends_with);\n      ret_value = ecma_make_boolean_value (index == (uint32_t) start_ends_with);\n      break;\n    }\n    case ECMA_STRING_INDEX_OF:\n    {\n      /* 8 (indexOf) -- 9 (lastIndexOf) */\n      ecma_value_t find_index = ecma_builtin_helper_string_find_index (original_str_p, search_str_p, start);\n\n      if (find_index != UINT32_MAX)\n      {\n        ret_num = ((ecma_number_t) find_index);\n      }\n      ret_value = ecma_make_number_value (ret_num);\n      break;\n    }\n\n    case ECMA_STRING_LAST_INDEX_OF:\n    {\n      uint32_t index = ecma_builtin_helper_string_find_last_index (original_str_p, search_str_p, start);\n\n      if (index != UINT32_MAX)\n      {\n        ret_num = ((ecma_number_t) index);\n      }\n      ret_value = ecma_make_number_value (ret_num);\n      break;\n    }\n\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n\n  ecma_deref_ecma_string (search_str_p);\n\n  return ret_value;\n} /* ecma_builtin_helper_string_prototype_object_index_of */\n\n/**\n * Helper function for finding index of a search string\n *\n * This function clamps the given index to the [0, length] range.\n * If the index is negative, 0 value is used.\n * If the index is greater than the length of the string, the normalized index will be the length of the string.\n *\n * See also:\n *          ECMA-262 v6, 21.1.3.8\n *\n * Used by:\n *         - The ecma_builtin_helper_string_prototype_object_index_of helper routine.\n *         - The ecma_builtin_string_prototype_object_replace_match helper routine.\n *\n * @return uint32_t - whether there is a match for the search string\n */\nuint32_t\necma_builtin_helper_string_find_index (ecma_string_t *original_str_p, /**< index */\n                                       ecma_string_t *search_str_p, /**< string's length */\n                                       uint32_t start_pos) /**< start position */\n{\n  uint32_t match_found = UINT32_MAX;\n\n  if (ecma_string_is_empty (search_str_p))\n  {\n    return start_pos;\n  }\n\n  ECMA_STRING_TO_UTF8_STRING (search_str_p, search_str_utf8_p, search_str_size);\n  ECMA_STRING_TO_UTF8_STRING (original_str_p, original_str_utf8_p, original_str_size);\n\n  const lit_utf8_byte_t *str_current_p = original_str_utf8_p;\n\n  for (ecma_number_t i = 0; i < start_pos; i++)\n  {\n    lit_utf8_incr (&str_current_p);\n  }\n\n  const lit_utf8_byte_t *original_end_p = original_str_utf8_p + original_str_size;\n\n  while (!((size_t) (original_end_p - str_current_p) < search_str_size))\n  {\n    if (memcmp (str_current_p, search_str_utf8_p, search_str_size) == 0)\n    {\n      match_found = start_pos;\n      break;\n    }\n\n    lit_utf8_incr (&str_current_p);\n    start_pos++;\n  }\n\n  ECMA_FINALIZE_UTF8_STRING (original_str_utf8_p, original_str_size);\n  ECMA_FINALIZE_UTF8_STRING (search_str_utf8_p, search_str_size);\n\n  return match_found;\n} /* ecma_builtin_helper_string_find_index */\n\n/**\n * Helper function for using [[DefineOwnProperty]] specialized for indexed property names\n *\n * Note: this method falls back to the general ecma_builtin_helper_def_prop\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, /**< object */\n                                       ecma_length_t index, /**< property index */\n                                       ecma_value_t value, /**< value */\n                                       uint32_t opts) /**< any combination of ecma_property_flag_t bits */\n{\n  if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))\n  {\n    return ecma_builtin_helper_def_prop (obj_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), value, opts);\n  }\n\n  ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);\n  ecma_value_t ret_value = ecma_builtin_helper_def_prop (obj_p, index_str_p, value, opts);\n  ecma_deref_ecma_string (index_str_p);\n\n  return ret_value;\n} /* ecma_builtin_helper_def_prop_by_index */\n\n/**\n * Helper function for at() functions.\n *\n * See also:\n *          ECMA-262 Stage 3 Draft Relative Indexing Method proposal 3. 4. 5. 6.\n *\n * Used by:\n *         - The Array.prototype.at routine.\n *         - The String.prototype.at routine.\n *         - The TypedArray.prototype.at routine.\n *\n * @return ECMA_VALUE_ERROR - on conversion error\n *         ECMA_VALUE_UNDEFINED - if the requested index is not exist\n *         ECMA_VALUE_EMPTY - otherwise\n */\necma_value_t\necma_builtin_helper_calculate_index (ecma_value_t index, /**< relative index argument */\n                                     ecma_length_t length, /**< object's length */\n                                     ecma_length_t *out_index) /**< calculated index */\n{\n  JERRY_ASSERT (out_index != NULL);\n\n  ecma_number_t relative_index;\n  ecma_value_t conversion_result = ecma_op_to_integer (index, &relative_index);\n\n  /* 4. */\n  if (ECMA_IS_VALUE_ERROR (conversion_result))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 5. 6. */\n  ecma_number_t k;\n\n  if (relative_index >= 0)\n  {\n    k = relative_index;\n  }\n  else\n  {\n    k = ((ecma_number_t) length + relative_index);\n  }\n\n  /* 7. */\n  if (k < 0 || k >= ((ecma_number_t) length))\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  *out_index = (ecma_length_t) k;\n\n  return ECMA_VALUE_EMPTY;\n} /* ecma_builtin_helper_calculate_index */\n\n/**\n * Helper function for using [[DefineOwnProperty]].\n *\n * See also:\n *          ECMA-262 v5, 8.12.9\n *          ECMA-262 v5, 15.4.5.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_helper_def_prop (ecma_object_t *obj_p, /**< object */\n                              ecma_string_t *name_p, /**< name string */\n                              ecma_value_t value, /**< value */\n                              uint32_t opts) /**< any combination of ecma_property_descriptor_status_flags_t bits */\n{\n  ecma_property_descriptor_t prop_desc;\n\n  prop_desc.flags = (uint16_t) (ECMA_NAME_DATA_PROPERTY_DESCRIPTOR_BITS | opts);\n\n  prop_desc.value = value;\n\n  return ecma_op_object_define_own_property (obj_p, name_p, &prop_desc);\n} /* ecma_builtin_helper_def_prop */\n\n/**\n * GetSubstitution abstract operation\n *\n * See:\n *     ECMA-262 v6.0 21.1.3.14.1\n */\nvoid\necma_builtin_replace_substitute (ecma_replace_context_t *ctx_p) /**< replace context */\n{\n  JERRY_ASSERT (ctx_p->string_p != NULL);\n  JERRY_ASSERT (ctx_p->matched_p == NULL\n                || (ctx_p->matched_p >= ctx_p->string_p && ctx_p->matched_p <= ctx_p->string_p + ctx_p->string_size));\n\n  lit_utf8_size_t replace_size;\n  uint8_t replace_flags = ECMA_STRING_FLAG_IS_ASCII;\n  const lit_utf8_byte_t *replace_buf_p =\n    ecma_string_get_chars (ctx_p->replace_str_p, &replace_size, NULL, NULL, &replace_flags);\n\n  const lit_utf8_byte_t *const replace_end_p = replace_buf_p + replace_size;\n  const lit_utf8_byte_t *curr_p = replace_buf_p;\n  const lit_utf8_byte_t *last_inserted_end_p = replace_buf_p;\n\n  while (curr_p < replace_end_p)\n  {\n    if (*curr_p++ == LIT_CHAR_DOLLAR_SIGN)\n    {\n      ecma_stringbuilder_append_raw (&(ctx_p->builder),\n                                     last_inserted_end_p,\n                                     (lit_utf8_size_t) (curr_p - last_inserted_end_p - 1));\n      if (curr_p >= replace_end_p)\n      {\n        last_inserted_end_p = curr_p - 1;\n        break;\n      }\n\n      const lit_utf8_byte_t c = *curr_p++;\n\n      switch (c)\n      {\n        case LIT_CHAR_DOLLAR_SIGN:\n        {\n          ecma_stringbuilder_append_byte (&(ctx_p->builder), LIT_CHAR_DOLLAR_SIGN);\n          break;\n        }\n        case LIT_CHAR_AMPERSAND:\n        {\n          if (JERRY_UNLIKELY (ctx_p->matched_p == NULL))\n          {\n            JERRY_ASSERT (ctx_p->capture_count == 0);\n            JERRY_ASSERT (ctx_p->u.collection_p != NULL);\n            JERRY_ASSERT (ctx_p->u.collection_p->item_count > 0);\n            const ecma_value_t match_value = ctx_p->u.collection_p->buffer_p[0];\n\n            JERRY_ASSERT (ecma_is_value_string (match_value));\n            ecma_stringbuilder_append (&(ctx_p->builder), ecma_get_string_from_value (match_value));\n            break;\n          }\n\n          JERRY_ASSERT (ctx_p->matched_p != NULL);\n          ecma_stringbuilder_append_raw (&(ctx_p->builder), ctx_p->matched_p, ctx_p->matched_size);\n          break;\n        }\n        case LIT_CHAR_GRAVE_ACCENT:\n        {\n          ecma_stringbuilder_append_raw (&(ctx_p->builder), ctx_p->string_p, ctx_p->match_byte_pos);\n          break;\n        }\n        case LIT_CHAR_SINGLE_QUOTE:\n        {\n          if (JERRY_UNLIKELY (ctx_p->matched_p == NULL))\n          {\n            JERRY_ASSERT (ctx_p->capture_count == 0);\n            JERRY_ASSERT (ctx_p->u.collection_p != NULL);\n            JERRY_ASSERT (ctx_p->u.collection_p->item_count > 0);\n            const ecma_value_t match_value = ctx_p->u.collection_p->buffer_p[0];\n\n            JERRY_ASSERT (ecma_is_value_string (match_value));\n            const ecma_string_t *const matched_p = ecma_get_string_from_value (match_value);\n            const lit_utf8_size_t match_size = ecma_string_get_size (matched_p);\n            const lit_utf8_byte_t *const begin_p = ctx_p->string_p + ctx_p->match_byte_pos + match_size;\n\n            ecma_stringbuilder_append_raw (&(ctx_p->builder),\n                                           begin_p,\n                                           (lit_utf8_size_t) (ctx_p->string_p + ctx_p->string_size - begin_p));\n            break;\n          }\n\n          JERRY_ASSERT (ctx_p->matched_p != NULL);\n          ecma_stringbuilder_append_raw (&(ctx_p->builder),\n                                         ctx_p->matched_p + ctx_p->matched_size,\n                                         ctx_p->string_size - ctx_p->match_byte_pos - ctx_p->matched_size);\n          break;\n        }\n        default:\n        {\n          const lit_utf8_byte_t *const number_begin_p = curr_p - 1;\n\n          if (lit_char_is_decimal_digit (c))\n          {\n            uint32_t capture_count = ctx_p->capture_count;\n\n            if (capture_count == 0 && ctx_p->u.collection_p != NULL)\n            {\n              capture_count = ctx_p->u.collection_p->item_count;\n            }\n\n            uint8_t idx = (uint8_t) (c - LIT_CHAR_0);\n            if (curr_p < replace_end_p && lit_char_is_decimal_digit (*(curr_p)))\n            {\n              uint8_t two_digit_index = (uint8_t) (idx * 10 + (uint8_t) (*(curr_p) -LIT_CHAR_0));\n              if (two_digit_index < capture_count)\n              {\n                idx = two_digit_index;\n                curr_p++;\n              }\n            }\n\n            if (idx > 0 && idx < capture_count)\n            {\n              if (ctx_p->capture_count > 0)\n              {\n#if JERRY_BUILTIN_REGEXP\n                JERRY_ASSERT (ctx_p->u.captures_p != NULL);\n                const ecma_regexp_capture_t *const capture_p = ctx_p->u.captures_p + idx;\n\n                if (ECMA_RE_IS_CAPTURE_DEFINED (capture_p))\n                {\n                  ecma_stringbuilder_append_raw (&(ctx_p->builder),\n                                                 capture_p->begin_p,\n                                                 (lit_utf8_size_t) (capture_p->end_p - capture_p->begin_p));\n                }\n\n                break;\n#endif /* JERRY_BUILTIN_REGEXP */\n              }\n              else if (ctx_p->u.collection_p != NULL)\n              {\n                const ecma_value_t capture_value = ctx_p->u.collection_p->buffer_p[idx];\n                if (!ecma_is_value_undefined (capture_value))\n                {\n                  ecma_stringbuilder_append (&(ctx_p->builder), ecma_get_string_from_value (capture_value));\n                }\n\n                break;\n              }\n            }\n          }\n\n          ecma_stringbuilder_append_byte (&(ctx_p->builder), LIT_CHAR_DOLLAR_SIGN);\n          curr_p = number_begin_p;\n          break;\n        }\n      }\n\n      last_inserted_end_p = curr_p;\n    }\n  }\n\n  ecma_stringbuilder_append_raw (&(ctx_p->builder),\n                                 last_inserted_end_p,\n                                 (lit_utf8_size_t) (replace_end_p - last_inserted_end_p));\n\n  if (replace_flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n  {\n    jmem_heap_free_block ((void *) replace_buf_p, replace_size);\n  }\n} /* ecma_builtin_replace_substitute */\n\n/**\n * Helper function to determine if method is the builtin exec method\n *\n * @return true, if function is the builtin exec method\n *         false, otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p) /**< function object */\n{\n  return (ecma_get_object_type (&obj_p->object) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION\n          && obj_p->u.built_in.routine_id == ECMA_REGEXP_PROTOTYPE_ROUTINE_EXEC);\n} /* ecma_builtin_is_regexp_exec */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_BUILTIN_HELPERS_H\n#define ECMA_BUILTIN_HELPERS_H\n\n#include \"ecma-exceptions.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-regexp-object.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltinhelpers ECMA builtin helper operations\n * @{\n */\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  /** These routines must be in this order */\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_EXEC,\n#if JERRY_BUILTIN_ANNEXB\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_COMPILE,\n#endif /* JERRY_BUILTIN_ANNEXB */\n\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_TEST,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_TO_STRING,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_SOURCE,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_FLAGS,\n\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_IGNORE_CASE,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_MULTILINE,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_STICKY,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_UNICODE,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_DOT_ALL,\n\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_SEARCH,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_MATCH,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_REPLACE,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_SPLIT,\n  ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_MATCH_ALL,\n};\n\n/**\n * Mode of string index routine.\n */\ntypedef enum\n{\n  /** These routines must be in this order */\n  ECMA_STRING_LAST_INDEX_OF, /**< String.lastIndexOf: ECMA-262 v5, 15.5.4.8 */\n  ECMA_STRING_INDEX_OF, /**< String.indexOf: ECMA-262 v5, 15.5.4.7 */\n  ECMA_STRING_STARTS_WITH, /**< String.startsWith: ECMA-262 v6, 21.1.3.18 */\n  ECMA_STRING_INCLUDES, /**< String.includes: ECMA-262 v6, 21.1.3.7 */\n  ECMA_STRING_ENDS_WITH /**< String.includes: ECMA-262 v6, 21.1.3.6 */\n} ecma_string_index_of_mode_t;\n\necma_value_t ecma_builtin_helper_object_to_string (const ecma_value_t this_arg);\necma_string_t *ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, ecma_length_t index);\necma_value_t ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, ecma_length_t *length_p, ecma_value_t value);\necma_value_t ecma_builtin_helper_uint32_index_normalize (ecma_value_t arg, uint32_t length, uint32_t *number_p);\necma_value_t\necma_builtin_helper_array_index_normalize (ecma_value_t arg, ecma_length_t length, ecma_length_t *number_p);\necma_value_t ecma_builtin_helper_string_index_normalize (ecma_number_t index, uint32_t length, bool nan_to_zero);\necma_value_t ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_str_p,\n                                                                   ecma_value_t arg1,\n                                                                   ecma_value_t arg2,\n                                                                   ecma_string_index_of_mode_t mode);\nuint32_t\necma_builtin_helper_string_find_index (ecma_string_t *original_str_p, ecma_string_t *search_str_p, uint32_t start_pos);\necma_value_t\necma_builtin_helper_def_prop (ecma_object_t *obj_p, ecma_string_t *name_p, ecma_value_t value, uint32_t opts);\n\necma_value_t\necma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, ecma_length_t index, ecma_value_t value, uint32_t opts);\necma_value_t ecma_builtin_helper_calculate_index (ecma_value_t index, ecma_length_t length, ecma_length_t *out_index);\n\n/**\n * Context for replace substitutions\n */\ntypedef struct\n{\n  ecma_stringbuilder_t builder; /**< result string builder */\n  const lit_utf8_byte_t *string_p; /**< source string */\n  lit_utf8_size_t string_size; /**< source string size */\n  const lit_utf8_byte_t *matched_p; /**< matched string */\n  lit_utf8_size_t matched_size; /**< matcehd string size */\n  lit_utf8_size_t match_byte_pos; /**< byte position of the match in the source string */\n  uint16_t flags; /**< replace flags */\n\n  /**\n   * Capture results\n   */\n  union\n  {\n#if JERRY_BUILTIN_REGEXP\n    const ecma_regexp_capture_t *captures_p; /**< array of regexp capturing groups */\n#endif /* JERRY_BUILTIN_REGEXP */\n    const ecma_collection_t *collection_p; /**< collection of captured substrings */\n  } u;\n\n  uint32_t capture_count; /**< number of captures in the capturing group array */\n  ecma_string_t *replace_str_p; /**< replacement string */\n} ecma_replace_context_t;\n\nvoid ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p);\nbool ecma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p);\n\n#if JERRY_BUILTIN_DATE\n\n/**\n * Time range defines for helper functions.\n *\n * See also:\n *          ECMA-262 v5, 15.9.1.1, 15.9.1.10\n */\n\n/** Hours in a day. */\n#define ECMA_DATE_HOURS_PER_DAY (24)\n\n/** Minutes in an hour. */\n#define ECMA_DATE_MINUTES_PER_HOUR (60)\n\n/** Seconds in a minute. */\n#define ECMA_DATE_SECONDS_PER_MINUTE (60)\n\n/** Milliseconds in a second. */\n#define ECMA_DATE_MS_PER_SECOND (1000)\n\n/** ECMA_DATE_MS_PER_MINUTE == 60000 */\n#define ECMA_DATE_MS_PER_MINUTE (ECMA_DATE_MS_PER_SECOND * ECMA_DATE_SECONDS_PER_MINUTE)\n\n/** ECMA_DATE_MS_PER_HOUR == 3600000 */\n#define ECMA_DATE_MS_PER_HOUR (ECMA_DATE_MS_PER_MINUTE * ECMA_DATE_MINUTES_PER_HOUR)\n\n/** ECMA_DATE_MS_PER_DAY == 86400000 */\n#define ECMA_DATE_MS_PER_DAY ((ECMA_DATE_MS_PER_HOUR * ECMA_DATE_HOURS_PER_DAY))\n\n#define ECMA_DATE_DAYS_IN_YEAR (365)\n\n#define ECMA_DATE_DAYS_IN_LEAP_YEAR (366)\n\n#define ECMA_DATE_YEAR_LIMIT (275800)\n\n/**\n * This gives a range of 8,640,000,000,000,000 milliseconds\n * to either side of 01 January, 1970 UTC.\n */\n#define ECMA_DATE_MAX_VALUE 8.64e15\n\n/**\n * Timezone type.\n */\ntypedef enum\n{\n  ECMA_DATE_UTC, /**< date vaule is in UTC */\n  ECMA_DATE_LOCAL /**< date vaule is in local time */\n} ecma_date_timezone_t;\n\n/* ecma-builtin-helpers-date.c */\nextern const char day_names_p[7][3];\nextern const char month_names_p[12][3];\n\nint32_t ecma_date_day_from_time (ecma_number_t time);\nint32_t ecma_date_year_from_time (ecma_number_t time);\nint32_t ecma_date_month_from_time (ecma_number_t time);\nint32_t ecma_date_date_from_time (ecma_number_t time);\nint32_t ecma_date_week_day (ecma_number_t time);\nint32_t ecma_date_hour_from_time (ecma_number_t time);\nint32_t ecma_date_min_from_time (ecma_number_t time);\nint32_t ecma_date_sec_from_time (ecma_number_t time);\nint32_t ecma_date_ms_from_time (ecma_number_t time);\nint32_t ecma_date_time_in_day_from_time (ecma_number_t time);\n\nint32_t ecma_date_local_time_zone_adjustment (ecma_number_t time);\necma_number_t ecma_date_utc (ecma_number_t time);\necma_number_t ecma_date_make_time (ecma_number_t hour, ecma_number_t min, ecma_number_t sec, ecma_number_t ms);\necma_number_t ecma_date_make_day (ecma_number_t year, ecma_number_t month, ecma_number_t date);\necma_number_t ecma_date_make_date (ecma_number_t day, ecma_number_t time);\necma_number_t ecma_date_time_clip (ecma_number_t time);\n\necma_value_t ecma_date_value_to_string (ecma_number_t datetime_number);\necma_value_t ecma_date_value_to_utc_string (ecma_number_t datetime_number);\necma_value_t ecma_date_value_to_iso_string (ecma_number_t datetime_number);\necma_value_t ecma_date_value_to_date_string (ecma_number_t datetime_number);\necma_value_t ecma_date_value_to_time_string (ecma_number_t datetime_number);\n\n#endif /* JERRY_BUILTIN_DATE */\n\n#if JERRY_BUILTIN_JSON\n/* ecma-builtin-helper-json.c */\n\n/**\n * Occurrence stack item of JSON.stringify()\n */\ntypedef struct struct_ecma_json_occurrence_stack_item_t\n{\n  struct struct_ecma_json_occurrence_stack_item_t *next_p; /**< next stack item */\n  ecma_object_t *object_p; /**< current object */\n} ecma_json_occurrence_stack_item_t;\n\n/**\n * Context for JSON.stringify()\n */\ntypedef struct\n{\n  /** Collection for property keys. */\n  ecma_collection_t *property_list_p;\n\n  /** Collection for traversing objects. */\n  ecma_json_occurrence_stack_item_t *occurrence_stack_last_p;\n\n  /** The actual indentation text. */\n  ecma_stringbuilder_t indent_builder;\n\n  /** The indentation text. */\n  ecma_string_t *gap_str_p;\n\n  /** The replacer function. */\n  ecma_object_t *replacer_function_p;\n\n  /** Result string builder. */\n  ecma_stringbuilder_t result_builder;\n} ecma_json_stringify_context_t;\n\necma_value_t ecma_builtin_json_parse_buffer (const lit_utf8_byte_t *str_start_p, lit_utf8_size_t string_size);\necma_value_t ecma_builtin_json_stringify_no_opts (const ecma_value_t value);\nbool ecma_json_has_object_in_stack (ecma_json_occurrence_stack_item_t *stack_p, ecma_object_t *object_p);\n\necma_value_t ecma_builtin_helper_json_create_non_formatted_json (lit_utf8_byte_t left_bracket,\n                                                                 lit_utf8_byte_t right_bracket,\n                                                                 ecma_collection_t *partial_p);\n#endif /* JERRY_BUILTIN_JSON */\n\n/* ecma-builtin-helper-error.c */\n\necma_value_t ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type,\n                                                      const ecma_value_t *arguments_list_p,\n                                                      uint32_t arguments_list_len);\n\n/* ecma-builtin-helpers-sort.c */\n\n/**\n * Comparison callback function header for sorting helper routines.\n */\ntypedef ecma_value_t (*ecma_builtin_helper_sort_compare_fn_t) (ecma_value_t lhs, /**< left value */\n                                                               ecma_value_t rhs, /**< right value */\n                                                               ecma_value_t compare_func, /**< compare function */\n                                                               ecma_object_t *array_buffer_p /**< arrayBuffer */);\n\necma_value_t ecma_builtin_helper_array_merge_sort_helper (ecma_value_t *array_p,\n                                                          uint32_t length,\n                                                          ecma_value_t compare_func,\n                                                          const ecma_builtin_helper_sort_compare_fn_t sort_cb,\n                                                          ecma_object_t *array_buffer_p);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_BUILTIN_HELPERS_H */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef BUILTIN_UNDERSCORED_ID\n#error \"Please, define BUILTIN_UNDERSCORED_ID\"\n#endif /* !BUILTIN_UNDERSCORED_ID */\n\n#ifndef BUILTIN_INC_HEADER_NAME\n#error \"Please, define BUILTIN_INC_HEADER_NAME\"\n#endif /* !BUILTIN_INC_HEADER_NAME */\n\n#include \"ecma-objects.h\"\n\n#define PASTE__(x, y) x##y\n#define PASTE_(x, y)  PASTE__ (x, y)\n#define PASTE(x, y)   PASTE_ (x, y)\n\n#define PROPERTY_DESCRIPTOR_LIST_NAME PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _property_descriptor_list)\n#define DISPATCH_ROUTINE_ROUTINE_NAME PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _dispatch_routine)\n\n#ifndef BUILTIN_CUSTOM_DISPATCH\n\n#define ROUTINE_ARG(n)             , ecma_value_t arg##n\n#define ROUTINE_ARG_LIST_0         ecma_value_t this_arg\n#define ROUTINE_ARG_LIST_1         ROUTINE_ARG_LIST_0 ROUTINE_ARG (1)\n#define ROUTINE_ARG_LIST_2         ROUTINE_ARG_LIST_1 ROUTINE_ARG (2)\n#define ROUTINE_ARG_LIST_3         ROUTINE_ARG_LIST_2 ROUTINE_ARG (3)\n#define ROUTINE_ARG_LIST_NON_FIXED ROUTINE_ARG_LIST_0, const ecma_value_t *arguments_list_p, uint32_t arguments_list_len\n#define ROUTINE(name, c_function_name, args_number, length_prop_value) \\\n  static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number);\n#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \\\n  static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number);\n#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \\\n  static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number);\n#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \\\n  static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0);                             \\\n  static ecma_value_t c_setter_func_name (ROUTINE_ARG_LIST_1);\n#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \\\n  static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0);\n#include BUILTIN_INC_HEADER_NAME\n#undef ROUTINE_ARG_LIST_NON_FIXED\n#undef ROUTINE_ARG_LIST_3\n#undef ROUTINE_ARG_LIST_2\n#undef ROUTINE_ARG_LIST_1\n#undef ROUTINE_ARG_LIST_0\n#undef ROUTINE_ARG\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  PASTE (ECMA_ROUTINE_START_, BUILTIN_UNDERSCORED_ID) = 0,\n#define ROUTINE(name, c_function_name, args_number, length_prop_value) ECMA_ROUTINE_##name##c_function_name,\n#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \\\n  ECMA_ROUTINE_##name##c_function_name,\n#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \\\n  ECMA_ROUTINE_##name##c_function_name,\n#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \\\n  ECMA_ACCESSOR_##name##c_getter_func_name, ECMA_ACCESSOR_##name##c_setter_func_name,\n#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) ECMA_ACCESSOR_##name##c_getter_func_name,\n#include BUILTIN_INC_HEADER_NAME\n};\n\n#endif /* !BUILTIN_CUSTOM_DISPATCH */\n\n/**\n * Built-in property list of the built-in object.\n */\nconst ecma_builtin_property_descriptor_t PROPERTY_DESCRIPTOR_LIST_NAME[] = {\n#ifndef BUILTIN_CUSTOM_DISPATCH\n#define ROUTINE(name, c_function_name, args_number, length_prop_value) \\\n  { name,                                                              \\\n    ECMA_BUILTIN_PROPERTY_ROUTINE,                                     \\\n    ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE,                      \\\n    ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) },\n#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \\\n  { name,                                                                                \\\n    ECMA_BUILTIN_PROPERTY_ROUTINE,                                                       \\\n    ECMA_PROPERTY_BUILT_IN_CONFIGURABLE,                                                 \\\n    ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) },\n#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, prop_attributes) \\\n  { name,                                                                                          \\\n    ECMA_BUILTIN_PROPERTY_ROUTINE,                                                                 \\\n    (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN,                                               \\\n    ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) },\n#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \\\n  { name,                                                             \\\n    ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY,                         \\\n    (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN,                  \\\n    ECMA_ACCESSOR_##name##c_getter_func_name },\n#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \\\n  { name,                                                                                  \\\n    ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE,                                             \\\n    (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN,                                       \\\n    ECMA_ACCESSOR_READ_WRITE (ECMA_ACCESSOR_##name##c_getter_func_name, ECMA_ACCESSOR_##name##c_setter_func_name) },\n#else /* BUILTIN_CUSTOM_DISPATCH */\n#define ROUTINE(name, c_function_name, args_number, length_prop_value) \\\n  { name,                                                              \\\n    ECMA_BUILTIN_PROPERTY_ROUTINE,                                     \\\n    ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE,                      \\\n    ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) },\n#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \\\n  { name,                                                                                \\\n    ECMA_BUILTIN_PROPERTY_ROUTINE,                                                       \\\n    ECMA_PROPERTY_BUILT_IN_CONFIGURABLE,                                                 \\\n    ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) },\n#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, prop_attributes) \\\n  { name,                                                                                          \\\n    ECMA_BUILTIN_PROPERTY_ROUTINE,                                                                 \\\n    (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN,                                               \\\n    ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) },\n#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \\\n  { name,                                                             \\\n    ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY,                         \\\n    (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN,                  \\\n    c_getter_func_name },\n#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \\\n  { name,                                                                                  \\\n    ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE,                                             \\\n    (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN,                                       \\\n    ECMA_ACCESSOR_READ_WRITE (c_getter_func_name, c_setter_func_name) },\n#endif /* !BUILTIN_CUSTOM_DISPATCH */\n#define OBJECT_VALUE(name, obj_builtin_id, prop_attributes) \\\n  { name, ECMA_BUILTIN_PROPERTY_OBJECT, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, obj_builtin_id },\n#define SIMPLE_VALUE(name, simple_value, prop_attributes) \\\n  { name, ECMA_BUILTIN_PROPERTY_SIMPLE, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, simple_value },\n#define NUMBER_VALUE(name, number_value, prop_attributes) \\\n  { name, ECMA_BUILTIN_PROPERTY_NUMBER, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, number_value },\n#define STRING_VALUE(name, magic_string_id, prop_attributes) \\\n  { name, ECMA_BUILTIN_PROPERTY_STRING, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, magic_string_id },\n#define SYMBOL_VALUE(name, symbol) { name, ECMA_BUILTIN_PROPERTY_SYMBOL, ECMA_PROPERTY_BUILT_IN_FIXED, symbol },\n#define INTRINSIC_PROPERTY(name, magic_string_id, prop_attributes) \\\n  { name, ECMA_BUILTIN_PROPERTY_INTRINSIC_PROPERTY, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, magic_string_id },\n#define ACCESSOR_BUILTIN_FUNCTION(name, getter_builtin_id, setter_builtin_id, prop_attributes) \\\n  { name,                                                                                      \\\n    ECMA_BUILTIN_PROPERTY_ACCESSOR_BUILTIN_FUNCTION,                                           \\\n    (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN,                                           \\\n    ECMA_ACCESSOR_READ_WRITE (getter_builtin_id, setter_builtin_id) },\n#include BUILTIN_INC_HEADER_NAME\n  { LIT_MAGIC_STRING__COUNT, ECMA_BUILTIN_PROPERTY_END, 0, 0 }\n};\n\n#ifndef BUILTIN_CUSTOM_DISPATCH\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\nDISPATCH_ROUTINE_ROUTINE_NAME (uint8_t builtin_routine_id, /**< built-in wide routine\n                                                                identifier */\n                               ecma_value_t this_arg_value, /**< 'this' argument\n                                                                 value */\n                               const ecma_value_t arguments_list[], /**< list of arguments\n                                                                         passed to routine */\n                               uint32_t arguments_number) /**< length of\n                                                           *   arguments' list */\n{\n  /* the arguments may be unused for some built-ins */\n  JERRY_UNUSED (this_arg_value);\n  JERRY_UNUSED (arguments_list);\n  JERRY_UNUSED (arguments_number);\n\n  switch (builtin_routine_id)\n  {\n#define ROUTINE_ARG(n) (arguments_list[n - 1])\n#define ROUTINE_ARG_LIST_0\n#define ROUTINE_ARG_LIST_1         , ROUTINE_ARG (1)\n#define ROUTINE_ARG_LIST_2         ROUTINE_ARG_LIST_1, ROUTINE_ARG (2)\n#define ROUTINE_ARG_LIST_3         ROUTINE_ARG_LIST_2, ROUTINE_ARG (3)\n#define ROUTINE_ARG_LIST_NON_FIXED , arguments_list, arguments_number\n#define ROUTINE(name, c_function_name, args_number, length_prop_value)      \\\n  case ECMA_ROUTINE_##name##c_function_name:                                \\\n  {                                                                         \\\n    return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number); \\\n  }\n#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \\\n  case ECMA_ROUTINE_##name##c_function_name:                                             \\\n  {                                                                                      \\\n    return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number);              \\\n  }\n#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \\\n  case ECMA_ROUTINE_##name##c_function_name:                                             \\\n  {                                                                                      \\\n    return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number);              \\\n  }\n#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \\\n  case ECMA_ACCESSOR_##name##c_getter_func_name:                                           \\\n  {                                                                                        \\\n    return c_getter_func_name (this_arg_value);                                            \\\n  }                                                                                        \\\n  case ECMA_ACCESSOR_##name##c_setter_func_name:                                           \\\n  {                                                                                        \\\n    return c_setter_func_name (this_arg_value ROUTINE_ARG_LIST_1);                         \\\n  }\n#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \\\n  case ECMA_ACCESSOR_##name##c_getter_func_name:                      \\\n  {                                                                   \\\n    return c_getter_func_name (this_arg_value);                       \\\n  }\n#include BUILTIN_INC_HEADER_NAME\n#undef ROUTINE_ARG\n#undef ROUTINE_ARG_LIST_0\n#undef ROUTINE_ARG_LIST_1\n#undef ROUTINE_ARG_LIST_2\n#undef ROUTINE_ARG_LIST_3\n#undef ROUTINE_ARG_LIST_NON_FIXED\n\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* DISPATCH_ROUTINE_ROUTINE_NAME */\n\n#endif /* !BUILTIN_CUSTOM_DISPATCH */\n\n#undef BUILTIN_INC_HEADER_NAME\n#undef BUILTIN_CUSTOM_DISPATCH\n#undef BUILTIN_UNDERSCORED_ID\n#undef DISPATCH_ROUTINE_ROUTINE_NAME\n#undef ECMA_BUILTIN_PROPERTY_NAME_INDEX\n#undef PASTE__\n#undef PASTE_\n#undef PASTE\n#undef PROPERTY_DESCRIPTOR_LIST_NAME\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-array-object.h\"\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-container-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-string-object.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"lit-char-helpers.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_INTRINSIC_ROUTINE_START = 0,\n  ECMA_INTRINSIC_ARRAY_PROTOTYPE_VALUES,\n  ECMA_INTRINSIC_TYPEDARRAY_PROTOTYPE_VALUES,\n  ECMA_INTRINSIC_MAP_PROTOTYPE_ENTRIES,\n  ECMA_INTRINSIC_SET_PROTOTYPE_VALUES,\n  ECMA_INTRINSIC_ARRAY_TO_STRING,\n  ECMA_INTRINSIC_DATE_TO_UTC_STRING,\n  ECMA_INTRINSIC_PARSE_FLOAT,\n  ECMA_INTRINSIC_PARSE_INT,\n  ECMA_INTRINSIC_STRING_TRIM_START,\n  ECMA_INTRINSIC_STRING_TRIM_END,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-intrinsic.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  intrinsic\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup intrinsic ECMA Intrinsic object built-in\n * @{\n */\n\n/**\n * The %ArrayProto_values% intrinsic routine\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_intrinsic_array_prototype_values (ecma_value_t this_value) /**< this argument */\n{\n  ecma_value_t this_obj = ecma_op_to_object (this_value);\n\n  if (ECMA_IS_VALUE_ERROR (this_obj))\n  {\n    return this_obj;\n  }\n\n  ecma_object_t *this_obj_p = ecma_get_object_from_value (this_obj);\n\n  ecma_value_t ret_value = ecma_op_create_array_iterator (this_obj_p, ECMA_ITERATOR_VALUES);\n\n  ecma_deref_object (this_obj_p);\n\n  return ret_value;\n} /* ecma_builtin_intrinsic_array_prototype_values */\n\n/**\n * The Map.prototype entries and [@@iterator] routines\n *\n * See also:\n *          ECMA-262 v6, 23.1.3.4\n *          ECMA-262 v6, 23.1.3.12\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_intrinsic_map_prototype_entries (ecma_value_t this_value) /**< this value */\n{\n  ecma_extended_object_t *map_object_p = ecma_op_container_get_object (this_value, LIT_MAGIC_STRING_MAP_UL);\n\n  if (map_object_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  return ecma_op_container_create_iterator (this_value,\n                                            ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE,\n                                            ECMA_OBJECT_CLASS_MAP_ITERATOR,\n                                            ECMA_ITERATOR_ENTRIES);\n} /* ecma_builtin_intrinsic_map_prototype_entries */\n\n/**\n * The Set.prototype values, keys and [@@iterator] routines\n *\n * See also:\n *          ECMA-262 v6, 23.2.3.8\n *          ECMA-262 v6, 23.2.3.10\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_intrinsic_set_prototype_values (ecma_value_t this_value) /**< this value */\n{\n  ecma_extended_object_t *map_object_p = ecma_op_container_get_object (this_value, LIT_MAGIC_STRING_SET_UL);\n\n  if (map_object_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  return ecma_op_container_create_iterator (this_value,\n                                            ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE,\n                                            ECMA_OBJECT_CLASS_SET_ITERATOR,\n                                            ECMA_ITERATOR_VALUES);\n} /* ecma_builtin_intrinsic_set_prototype_values */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                         ecma_value_t this_arg, /**< 'this' argument value */\n                                         const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                 *   passed to routine */\n                                         uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n\n  switch (builtin_routine_id)\n  {\n#if JERRY_BUILTIN_ARRAY\n    case ECMA_INTRINSIC_ARRAY_PROTOTYPE_VALUES:\n    {\n      return ecma_builtin_intrinsic_array_prototype_values (this_arg);\n    }\n    case ECMA_INTRINSIC_ARRAY_TO_STRING:\n    {\n      ecma_value_t this_obj = ecma_op_to_object (this_arg);\n      if (ECMA_IS_VALUE_ERROR (this_obj))\n      {\n        return this_obj;\n      }\n\n      ecma_value_t result = ecma_array_object_to_string (this_obj);\n      ecma_deref_object (ecma_get_object_from_value (this_obj));\n\n      return result;\n    }\n#endif /* JERRY_BUILTIN_ARRAY */\n#if JERRY_BUILTIN_TYPEDARRAY\n    case ECMA_INTRINSIC_TYPEDARRAY_PROTOTYPE_VALUES:\n    {\n      if (!ecma_is_typedarray (this_arg))\n      {\n        return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_TYPED_ARRAY);\n      }\n\n      if (ecma_arraybuffer_is_detached (ecma_typedarray_get_arraybuffer (ecma_get_object_from_value (this_arg))))\n      {\n        return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n      }\n\n      return ecma_typedarray_iterators_helper (this_arg, ECMA_ITERATOR_VALUES);\n    }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_CONTAINER\n    case ECMA_INTRINSIC_SET_PROTOTYPE_VALUES:\n    {\n      return ecma_builtin_intrinsic_set_prototype_values (this_arg);\n    }\n    case ECMA_INTRINSIC_MAP_PROTOTYPE_ENTRIES:\n    {\n      return ecma_builtin_intrinsic_map_prototype_entries (this_arg);\n    }\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_DATE\n    case ECMA_INTRINSIC_DATE_TO_UTC_STRING:\n    {\n      if (!ecma_is_value_object (this_arg)\n          || !ecma_object_class_is (ecma_get_object_from_value (this_arg), ECMA_OBJECT_CLASS_DATE))\n      {\n        return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_DATE_OBJECT);\n      }\n\n      ecma_number_t *date_value_p = &((ecma_date_object_t *) ecma_get_object_from_value (this_arg))->date_value;\n\n      if (ecma_number_is_nan (*date_value_p))\n      {\n        return ecma_make_magic_string_value (LIT_MAGIC_STRING_INVALID_DATE_UL);\n      }\n\n      return ecma_date_value_to_utc_string (*date_value_p);\n    }\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_STRING\n    case ECMA_INTRINSIC_STRING_TRIM_START:\n    case ECMA_INTRINSIC_STRING_TRIM_END:\n    {\n      if (!ecma_op_require_object_coercible (this_arg))\n      {\n        return ECMA_VALUE_ERROR;\n      }\n\n      ecma_string_t *to_str_p = ecma_op_to_string (this_arg);\n      if (to_str_p == NULL)\n      {\n        return ECMA_VALUE_ERROR;\n      }\n\n      ECMA_STRING_TO_UTF8_STRING (to_str_p, start_p, input_start_size);\n\n      lit_utf8_size_t size;\n      const lit_utf8_byte_t *input_start_p = start_p;\n      const lit_utf8_byte_t *input_str_end_p = start_p + input_start_size;\n\n      ecma_string_t *ret_str_p;\n      if (builtin_routine_id == ECMA_INTRINSIC_STRING_TRIM_START)\n      {\n        const lit_utf8_byte_t *new_start_p = ecma_string_trim_front (input_start_p, input_str_end_p);\n        size = (lit_utf8_size_t) (input_str_end_p - new_start_p);\n        ret_str_p = ecma_new_ecma_string_from_utf8 (new_start_p, size);\n      }\n      else\n      {\n        const lit_utf8_byte_t *new_end_p = ecma_string_trim_back (input_start_p, input_str_end_p);\n        size = (lit_utf8_size_t) (new_end_p - input_start_p);\n        ret_str_p = ecma_new_ecma_string_from_utf8 (input_start_p, size);\n      }\n\n      ECMA_FINALIZE_UTF8_STRING (start_p, input_start_size);\n      ecma_value_t result = ecma_make_string_value (ret_str_p);\n      ecma_deref_ecma_string (to_str_p);\n      return result;\n    }\n#endif /* JERRY_BUILTIN_STRING */\n    default:\n    {\n      JERRY_ASSERT (builtin_routine_id == ECMA_INTRINSIC_PARSE_INT || builtin_routine_id == ECMA_INTRINSIC_PARSE_FLOAT);\n\n      ecma_string_t *str_p = ecma_op_to_string (arguments_list_p[0]);\n\n      if (JERRY_UNLIKELY (str_p == NULL))\n      {\n        return ECMA_VALUE_ERROR;\n      }\n\n      ecma_value_t result;\n      ECMA_STRING_TO_UTF8_STRING (str_p, string_buff, string_buff_size);\n\n      if (builtin_routine_id == ECMA_INTRINSIC_PARSE_INT)\n      {\n        result = ecma_number_parse_int (string_buff, string_buff_size, arguments_list_p[1]);\n      }\n      else\n      {\n        JERRY_ASSERT (builtin_routine_id == ECMA_INTRINSIC_PARSE_FLOAT);\n        result = ecma_number_parse_float (string_buff, string_buff_size);\n      }\n\n      ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size);\n      ecma_deref_ecma_string (str_p);\n      return result;\n    }\n  }\n} /* ecma_builtin_intrinsic_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Intrinsic built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES, ECMA_INTRINSIC_ARRAY_PROTOTYPE_VALUES, 0, 0)\nROUTINE (LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES, ECMA_INTRINSIC_TYPEDARRAY_PROTOTYPE_VALUES, 0, 0)\nROUTINE (LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES, ECMA_INTRINSIC_SET_PROTOTYPE_VALUES, 0, 0)\nROUTINE (LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES, ECMA_INTRINSIC_MAP_PROTOTYPE_ENTRIES, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TRIM_START, ECMA_INTRINSIC_STRING_TRIM_START, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TRIM_END, ECMA_INTRINSIC_STRING_TRIM_END, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_INTRINSIC_ARRAY_TO_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_UTC_STRING_UL, ECMA_INTRINSIC_DATE_TO_UTC_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_PARSE_FLOAT, ECMA_INTRINSIC_PARSE_FLOAT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_PARSE_INT, ECMA_INTRINSIC_PARSE_INT, 2, 2)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-iterator-object.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BUILTIN_ITERATOR_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_BUILTIN_ITERATOR_PROTOTYPE_OBJECT_ITERATOR,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-iterator-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  iterator_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup %iteratorprototype% ECMA %IteratorPrototype% object built-in\n * @{\n */\n\n/**\n * The %IteratorPrototype% object's '@@iterator' routine\n *\n * See also:\n *          ECMA-262 v6, 22.1.2.1\n *\n * Note:\n *     Returned value must be freed with ecma_free_value.\n *\n * @return the given this value\n */\nstatic ecma_value_t\necma_builtin_iterator_prototype_object_iterator (ecma_value_t this_val) /**< this argument */\n{\n  /* 1. */\n  return ecma_copy_value (this_val);\n} /* ecma_builtin_iterator_prototype_object_iterator */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide\n                                                                               *   routine identifier */\n                                                  ecma_value_t this_arg, /**< 'this' argument value */\n                                                  const ecma_value_t arguments_list_p[], /**<\n                                                                                          * list of arguments\n                                                                                          * passed to routine */\n                                                  uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (arguments_list_p, arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_BUILTIN_ITERATOR_PROTOTYPE_OBJECT_ITERATOR:\n    {\n      return ecma_builtin_iterator_prototype_object_iterator (this_arg);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_iterator_prototype_dispatch_routine */\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %IteratorPrototype% built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ECMA_BUILTIN_ITERATOR_PROTOTYPE_OBJECT_ITERATOR, 0, 0)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-json.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt-libc-includes.h\"\n#include \"jrt.h\"\n#include \"lit-char-helpers.h\"\n#include \"lit-globals.h\"\n\n#if JERRY_BUILTIN_JSON\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BUILTIN_JSON_ROUTINE_START = 0,\n  ECMA_BUILTIN_JSON_PARSE,\n  ECMA_BUILTIN_JSON_STRINGIFY,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-json.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  json\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/**\n * The number of expected hexidecimal characters in a hex escape sequence\n */\n#define ECMA_JSON_HEX_ESCAPE_SEQUENCE_LENGTH (4)\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup json ECMA JSON object built-in\n * @{\n */\n\n/**\n * JSON token type\n */\ntypedef enum\n{\n  TOKEN_INVALID, /**< error token */\n  TOKEN_END, /**< end of stream reached */\n  TOKEN_NUMBER, /**< JSON number */\n  TOKEN_STRING, /**< JSON string */\n  TOKEN_NULL, /**< JSON null primitive value */\n  TOKEN_TRUE, /**< JSON true primitive value */\n  TOKEN_FALSE, /**< JSON false primitive value */\n  TOKEN_LEFT_BRACE, /**< JSON left brace */\n  TOKEN_RIGHT_BRACE, /**< JSON right brace */\n  TOKEN_LEFT_SQUARE, /**< JSON left square bracket */\n  TOKEN_RIGHT_SQUARE, /**< JSON right square bracket */\n  TOKEN_COMMA, /**< JSON comma */\n  TOKEN_COLON /**< JSON colon */\n} ecma_json_token_type_t;\n\n/**\n * JSON token\n */\ntypedef struct\n{\n  ecma_json_token_type_t type; /**< type of the current token */\n  const lit_utf8_byte_t *current_p; /**< current position of the string processed by the parser */\n  const lit_utf8_byte_t *end_p; /**< end of the string processed by the parser */\n\n  /**\n   * Fields depending on type.\n   */\n  union\n  {\n    ecma_string_t *string_p; /**< when type is string_token it contains the string */\n    ecma_number_t number; /**< when type is number_token, it contains the value of the number */\n  } u;\n} ecma_json_token_t;\n\n/**\n * Parse and extract string token.\n */\nstatic void\necma_builtin_json_parse_string (ecma_json_token_t *token_p) /**< token argument */\n{\n  const lit_utf8_byte_t *current_p = token_p->current_p;\n  const lit_utf8_byte_t *end_p = token_p->end_p;\n\n  ecma_stringbuilder_t result_builder = ecma_stringbuilder_create ();\n  const lit_utf8_byte_t *unappended_p = current_p;\n\n  while (true)\n  {\n    if (current_p >= end_p || *current_p <= 0x1f)\n    {\n      goto invalid_string;\n    }\n\n    if (*current_p == LIT_CHAR_DOUBLE_QUOTE)\n    {\n      break;\n    }\n\n    if (*current_p >= LIT_UTF8_4_BYTE_MARKER)\n    {\n      ecma_stringbuilder_append_raw (&result_builder, unappended_p, (lit_utf8_size_t) (current_p - unappended_p));\n      JERRY_ASSERT (current_p + 4 <= end_p);\n\n      lit_code_point_t cp;\n      lit_utf8_size_t read_size = lit_read_code_point_from_utf8 (current_p, 4, &cp);\n      JERRY_ASSERT (read_size == 4);\n\n      ecma_stringbuilder_append_codepoint (&result_builder, cp);\n      current_p += 4;\n\n      unappended_p = current_p;\n      continue;\n    }\n\n    if (*current_p == LIT_CHAR_BACKSLASH)\n    {\n      ecma_stringbuilder_append_raw (&result_builder, unappended_p, (lit_utf8_size_t) (current_p - unappended_p));\n\n      current_p++;\n\n      /* If there is an escape sequence but there's no escapable character just return */\n      if (current_p >= end_p)\n      {\n        goto invalid_string;\n      }\n\n      const lit_utf8_byte_t c = *current_p;\n      switch (c)\n      {\n        case LIT_CHAR_DOUBLE_QUOTE:\n        case LIT_CHAR_SLASH:\n        case LIT_CHAR_BACKSLASH:\n        {\n          ecma_stringbuilder_append_byte (&result_builder, c);\n          current_p++;\n          break;\n        }\n        case LIT_CHAR_LOWERCASE_B:\n        {\n          ecma_stringbuilder_append_byte (&result_builder, LIT_CHAR_BS);\n          current_p++;\n          break;\n        }\n        case LIT_CHAR_LOWERCASE_F:\n        {\n          ecma_stringbuilder_append_byte (&result_builder, LIT_CHAR_FF);\n          current_p++;\n          break;\n        }\n        case LIT_CHAR_LOWERCASE_N:\n        {\n          ecma_stringbuilder_append_byte (&result_builder, LIT_CHAR_LF);\n          current_p++;\n          break;\n        }\n        case LIT_CHAR_LOWERCASE_R:\n        {\n          ecma_stringbuilder_append_byte (&result_builder, LIT_CHAR_CR);\n          current_p++;\n          break;\n        }\n        case LIT_CHAR_LOWERCASE_T:\n        {\n          ecma_stringbuilder_append_byte (&result_builder, LIT_CHAR_TAB);\n          current_p++;\n          break;\n        }\n        case LIT_CHAR_LOWERCASE_U:\n        {\n          uint32_t hex_value = lit_char_hex_lookup (current_p + 1, end_p, ECMA_JSON_HEX_ESCAPE_SEQUENCE_LENGTH);\n          if (hex_value == UINT32_MAX)\n          {\n            goto invalid_string;\n          }\n\n          ecma_stringbuilder_append_char (&result_builder, (ecma_char_t) hex_value);\n          current_p += ECMA_JSON_HEX_ESCAPE_SEQUENCE_LENGTH + 1;\n          break;\n        }\n        default:\n        {\n          goto invalid_string;\n        }\n      }\n\n      unappended_p = current_p;\n      continue;\n    }\n\n    current_p++;\n  }\n\n  ecma_stringbuilder_append_raw (&result_builder, unappended_p, (lit_utf8_size_t) (current_p - unappended_p));\n  token_p->u.string_p = ecma_stringbuilder_finalize (&result_builder);\n  token_p->current_p = current_p + 1;\n  token_p->type = TOKEN_STRING;\n  return;\n\ninvalid_string:\n  ecma_stringbuilder_destroy (&result_builder);\n} /* ecma_builtin_json_parse_string */\n\n/**\n * Parse and extract string token.\n */\nstatic void\necma_builtin_json_parse_number (ecma_json_token_t *token_p) /**< token argument */\n{\n  const lit_utf8_byte_t *current_p = token_p->current_p;\n  const lit_utf8_byte_t *end_p = token_p->end_p;\n  const lit_utf8_byte_t *start_p = current_p;\n\n  JERRY_ASSERT (current_p < end_p);\n\n  if (*current_p == LIT_CHAR_MINUS)\n  {\n    current_p++;\n  }\n\n  if (current_p >= end_p)\n  {\n    return;\n  }\n\n  if (*current_p == LIT_CHAR_0)\n  {\n    current_p++;\n\n    if (current_p < end_p && lit_char_is_decimal_digit (*current_p))\n    {\n      return;\n    }\n  }\n  else if (lit_char_is_decimal_digit (*current_p))\n  {\n    do\n    {\n      current_p++;\n    } while (current_p < end_p && lit_char_is_decimal_digit (*current_p));\n  }\n\n  if (current_p < end_p && *current_p == LIT_CHAR_DOT)\n  {\n    current_p++;\n\n    if (current_p >= end_p || !lit_char_is_decimal_digit (*current_p))\n    {\n      return;\n    }\n\n    do\n    {\n      current_p++;\n    } while (current_p < end_p && lit_char_is_decimal_digit (*current_p));\n  }\n\n  if (current_p < end_p && (*current_p == LIT_CHAR_LOWERCASE_E || *current_p == LIT_CHAR_UPPERCASE_E))\n  {\n    current_p++;\n\n    if (current_p < end_p && (*current_p == LIT_CHAR_PLUS || *current_p == LIT_CHAR_MINUS))\n    {\n      current_p++;\n    }\n\n    if (current_p >= end_p || !lit_char_is_decimal_digit (*current_p))\n    {\n      return;\n    }\n\n    do\n    {\n      current_p++;\n    } while (current_p < end_p && lit_char_is_decimal_digit (*current_p));\n  }\n\n  token_p->type = TOKEN_NUMBER;\n  token_p->u.number = ecma_utf8_string_to_number (start_p, (lit_utf8_size_t) (current_p - start_p), 0);\n\n  token_p->current_p = current_p;\n} /* ecma_builtin_json_parse_number */\n\n/**\n * Parse next token.\n *\n * The function fills the fields of the ecma_json_token_t\n * argument and advances the string pointer.\n */\nstatic void\necma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argument */\n                                    bool parse_string) /**< strings are allowed to parse */\n{\n  const lit_utf8_byte_t *current_p = token_p->current_p;\n  const lit_utf8_byte_t *end_p = token_p->end_p;\n  token_p->type = TOKEN_INVALID;\n\n  while (current_p < end_p\n         && (*current_p == LIT_CHAR_SP || *current_p == LIT_CHAR_CR || *current_p == LIT_CHAR_LF\n             || *current_p == LIT_CHAR_TAB))\n  {\n    current_p++;\n  }\n\n  if (current_p == end_p)\n  {\n    token_p->type = TOKEN_END;\n    return;\n  }\n\n  switch (*current_p)\n  {\n    case LIT_CHAR_LEFT_BRACE:\n    {\n      token_p->type = TOKEN_LEFT_BRACE;\n      token_p->current_p = current_p + 1;\n      return;\n    }\n    case LIT_CHAR_RIGHT_BRACE:\n    {\n      token_p->type = TOKEN_RIGHT_BRACE;\n      token_p->current_p = current_p + 1;\n      return;\n    }\n    case LIT_CHAR_LEFT_SQUARE:\n    {\n      token_p->type = TOKEN_LEFT_SQUARE;\n      token_p->current_p = current_p + 1;\n      return;\n    }\n    case LIT_CHAR_RIGHT_SQUARE:\n    {\n      token_p->type = TOKEN_RIGHT_SQUARE;\n      token_p->current_p = current_p + 1;\n      return;\n    }\n    case LIT_CHAR_COMMA:\n    {\n      token_p->type = TOKEN_COMMA;\n      token_p->current_p = current_p + 1;\n      return;\n    }\n    case LIT_CHAR_COLON:\n    {\n      token_p->type = TOKEN_COLON;\n      token_p->current_p = current_p + 1;\n      return;\n    }\n    case LIT_CHAR_DOUBLE_QUOTE:\n    {\n      if (parse_string)\n      {\n        token_p->current_p = current_p + 1;\n        ecma_builtin_json_parse_string (token_p);\n      }\n      return;\n    }\n    case LIT_CHAR_LOWERCASE_N:\n    {\n      lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_NULL);\n      if (current_p + size <= end_p)\n      {\n        if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_NULL), current_p, size))\n        {\n          token_p->type = TOKEN_NULL;\n          token_p->current_p = current_p + size;\n          return;\n        }\n      }\n      break;\n    }\n    case LIT_CHAR_LOWERCASE_T:\n    {\n      lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_TRUE);\n      if (current_p + size <= end_p)\n      {\n        if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_TRUE), current_p, size))\n        {\n          token_p->type = TOKEN_TRUE;\n          token_p->current_p = current_p + size;\n          return;\n        }\n      }\n      break;\n    }\n    case LIT_CHAR_LOWERCASE_F:\n    {\n      lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_FALSE);\n      if (current_p + size <= end_p)\n      {\n        if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_FALSE), current_p, size))\n        {\n          token_p->type = TOKEN_FALSE;\n          token_p->current_p = current_p + size;\n          return;\n        }\n      }\n      break;\n    }\n    default:\n    {\n      if (*current_p == LIT_CHAR_MINUS || lit_char_is_decimal_digit (*current_p))\n      {\n        token_p->current_p = current_p;\n        ecma_builtin_json_parse_number (token_p);\n        return;\n      }\n      break;\n    }\n  }\n} /* ecma_builtin_json_parse_next_token */\n\n/**\n * Utility for defining properties.\n *\n * It silently ignores all errors.\n */\nstatic void\necma_builtin_json_define_value_property (ecma_object_t *obj_p, /**< this object */\n                                         ecma_string_t *property_name_p, /**< property name */\n                                         ecma_value_t value) /**< value */\n{\n  ecma_value_t completion_value =\n    ecma_builtin_helper_def_prop (obj_p, property_name_p, value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n\n  JERRY_ASSERT (ecma_is_value_boolean (completion_value));\n} /* ecma_builtin_json_define_value_property */\n\n/**\n * Parse next value.\n *\n * The function fills the fields of the ecma_json_token_t\n * argument and advances the string pointer.\n *\n * @return ecma_value with the property value\n */\nstatic ecma_value_t\necma_builtin_json_parse_value (ecma_json_token_t *token_p) /**< token argument */\n{\n  switch (token_p->type)\n  {\n    case TOKEN_NUMBER:\n    {\n      return ecma_make_number_value (token_p->u.number);\n    }\n    case TOKEN_STRING:\n    {\n      return ecma_make_string_value (token_p->u.string_p);\n    }\n    case TOKEN_NULL:\n    {\n      return ECMA_VALUE_NULL;\n    }\n    case TOKEN_TRUE:\n    {\n      return ECMA_VALUE_TRUE;\n    }\n    case TOKEN_FALSE:\n    {\n      return ECMA_VALUE_FALSE;\n    }\n    case TOKEN_LEFT_BRACE:\n    {\n      ecma_object_t *object_p = ecma_op_create_object_object_noarg ();\n\n      ecma_builtin_json_parse_next_token (token_p, true);\n\n      if (token_p->type == TOKEN_RIGHT_BRACE)\n      {\n        return ecma_make_object_value (object_p);\n      }\n\n      while (true)\n      {\n        if (token_p->type != TOKEN_STRING)\n        {\n          break;\n        }\n\n        ecma_string_t *name_p = token_p->u.string_p;\n\n        ecma_builtin_json_parse_next_token (token_p, false);\n        if (token_p->type != TOKEN_COLON)\n        {\n          ecma_deref_ecma_string (name_p);\n          break;\n        }\n\n        ecma_builtin_json_parse_next_token (token_p, true);\n        ecma_value_t value = ecma_builtin_json_parse_value (token_p);\n\n        if (ecma_is_value_empty (value))\n        {\n          ecma_deref_ecma_string (name_p);\n          break;\n        }\n\n        ecma_builtin_json_define_value_property (object_p, name_p, value);\n        ecma_deref_ecma_string (name_p);\n        ecma_free_value (value);\n\n        ecma_builtin_json_parse_next_token (token_p, false);\n        if (token_p->type == TOKEN_RIGHT_BRACE)\n        {\n          return ecma_make_object_value (object_p);\n        }\n\n        if (token_p->type != TOKEN_COMMA)\n        {\n          break;\n        }\n\n        ecma_builtin_json_parse_next_token (token_p, true);\n      }\n\n      /*\n       * Parse error occurred.\n       */\n      ecma_deref_object (object_p);\n      return ECMA_VALUE_EMPTY;\n    }\n    case TOKEN_LEFT_SQUARE:\n    {\n      uint32_t length = 0;\n      ecma_object_t *array_p = ecma_op_new_array_object (0);\n\n      ecma_builtin_json_parse_next_token (token_p, true);\n\n      if (token_p->type == TOKEN_RIGHT_SQUARE)\n      {\n        return ecma_make_object_value (array_p);\n      }\n\n      while (true)\n      {\n        ecma_value_t value = ecma_builtin_json_parse_value (token_p);\n\n        if (ecma_is_value_empty (value))\n        {\n          JERRY_ASSERT (token_p->type != TOKEN_STRING);\n          break;\n        }\n\n        ecma_value_t completion;\n        completion = ecma_builtin_helper_def_prop_by_index (array_p,\n                                                            length,\n                                                            value,\n                                                            ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n        JERRY_ASSERT (ecma_is_value_true (completion));\n        ecma_free_value (value);\n\n        ecma_builtin_json_parse_next_token (token_p, false);\n\n        if (token_p->type == TOKEN_RIGHT_SQUARE)\n        {\n          return ecma_make_object_value (array_p);\n        }\n\n        if (token_p->type != TOKEN_COMMA)\n        {\n          JERRY_ASSERT (token_p->type != TOKEN_STRING);\n          break;\n        }\n\n        ecma_builtin_json_parse_next_token (token_p, true);\n        length++;\n      }\n\n      ecma_deref_object (array_p);\n      return ECMA_VALUE_EMPTY;\n    }\n    default:\n    {\n      return ECMA_VALUE_EMPTY;\n    }\n  }\n} /* ecma_builtin_json_parse_value */\n\nstatic ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p,\n                                                                    ecma_object_t *object_p,\n                                                                    ecma_string_t *prop_name);\n\n/**\n * Abstract operation InternalizeJSONProperty\n *\n * See also:\n *         ECMA-262 v5, 24.3.1.1\n *         ECMA-262 v11, 24.5.1.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_json_internalize_property (ecma_object_t *reviver_p, /**< reviver function */\n                                        ecma_object_t *holder_p, /**< holder object */\n                                        ecma_string_t *name_p) /**< property name */\n{\n  JERRY_ASSERT (reviver_p);\n  JERRY_ASSERT (holder_p);\n  JERRY_ASSERT (name_p);\n\n  ECMA_CHECK_STACK_USAGE ();\n\n  /* 1. */\n  ecma_value_t value = ecma_op_object_get (holder_p, name_p);\n\n  /* 2. */\n  if (ECMA_IS_VALUE_ERROR (value))\n  {\n    return value;\n  }\n\n  /* 3. */\n  if (ecma_is_value_object (value))\n  {\n    /* 3.a */\n    ecma_value_t is_array = ecma_is_value_array (value);\n\n    if (ECMA_IS_VALUE_ERROR (is_array))\n    {\n      ecma_free_value (value);\n      return is_array;\n    }\n\n    ecma_object_t *object_p = ecma_get_object_from_value (value);\n\n    /* 3.c */\n    if (ecma_is_value_true (is_array))\n    {\n      /* 3.c.ii */\n      ecma_length_t length;\n      ecma_value_t to_len = ecma_op_object_get_length (object_p, &length);\n\n      /* 3.c.iii */\n#if JERRY_BUILTIN_PROXY\n      if (ECMA_IS_VALUE_ERROR (to_len))\n      {\n        ecma_deref_object (object_p);\n        return to_len;\n      }\n#endif /* JERRY_BUILTIN_PROXY */\n      JERRY_ASSERT (ecma_is_value_empty (to_len));\n\n      /* 3.c.iv */\n      for (ecma_length_t i = 0; i < length; i++)\n      {\n        ecma_string_t *prop_index = ecma_new_ecma_string_from_length (i);\n        ecma_value_t result = ecma_builtin_json_internalize_process_property (reviver_p, object_p, prop_index);\n\n        ecma_deref_ecma_string (prop_index);\n\n        if (ECMA_IS_VALUE_ERROR (result))\n        {\n          ecma_deref_object (object_p);\n          return result;\n        }\n\n        JERRY_ASSERT (result == ECMA_VALUE_TRUE);\n      }\n    }\n    /* 3.d */\n    else\n    {\n      ecma_collection_t *props_p =\n        ecma_op_object_get_enumerable_property_names (object_p, ECMA_ENUMERABLE_PROPERTY_KEYS);\n\n      if (JERRY_UNLIKELY (props_p == NULL))\n      {\n        ecma_deref_object (object_p);\n        return ECMA_VALUE_ERROR;\n      }\n\n      ecma_value_t *buffer_p = props_p->buffer_p;\n\n      /* 3.d.iii */\n      for (uint32_t i = 0; i < props_p->item_count; i++)\n      {\n        ecma_string_t *property_name_p = ecma_get_string_from_value (buffer_p[i]);\n        ecma_value_t result = ecma_builtin_json_internalize_process_property (reviver_p, object_p, property_name_p);\n\n        if (ECMA_IS_VALUE_ERROR (result))\n        {\n          ecma_collection_free (props_p);\n          ecma_deref_object (object_p);\n          return result;\n        }\n\n        JERRY_ASSERT (result == ECMA_VALUE_TRUE);\n      }\n\n      ecma_collection_free (props_p);\n    }\n  }\n\n  ecma_value_t arguments_list[2];\n  arguments_list[0] = ecma_make_string_value (name_p);\n  arguments_list[1] = value;\n\n  /* 4. */\n  ecma_value_t ret_value = ecma_op_function_call (reviver_p, ecma_make_object_value (holder_p), arguments_list, 2);\n  ecma_free_value (value);\n  return ret_value;\n} /* ecma_builtin_json_internalize_property */\n\n/**\n * Part of the InternalizeJSONProperty abstract method.\n *\n * See also:\n *         ECMA-262 v5, 15.12.2\n *         ECMA-262 v11, 24.5.1.1 in step 2\n *\n * @return ECMA_VALUE_TRUE - if no error occurred.\n *         error if one of the operation failed.\n */\nstatic ecma_value_t\necma_builtin_json_internalize_process_property (ecma_object_t *reviver_p, /**< reviver function */\n                                                ecma_object_t *object_p, /**< holder object */\n                                                ecma_string_t *prop_name) /**< property name */\n{\n  /* ES11: 2.b.iii.1 / 2.c.ii.1 */\n  ecma_value_t new_element = ecma_builtin_json_internalize_property (reviver_p, object_p, prop_name);\n\n  if (ECMA_IS_VALUE_ERROR (new_element))\n  {\n    return new_element;\n  }\n\n  /* ES11: 2.b.iii.2 / 2.c.ii.2 */\n  if (ecma_is_value_undefined (new_element))\n  {\n    /* ES11: 2.b.iii.2.a / 2.c.ii.2.a */\n    ecma_value_t delete_val = ecma_op_object_delete (object_p, prop_name, false);\n\n    if (ECMA_IS_VALUE_ERROR (delete_val))\n    {\n      return delete_val;\n    }\n\n    JERRY_ASSERT (ecma_is_value_boolean (delete_val));\n  }\n  else\n  {\n    /* ES11: 2.b.iii.3.a / 2.c.ii.3.a */\n    ecma_value_t def_value =\n      ecma_builtin_helper_def_prop (object_p, prop_name, new_element, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n    ecma_free_value (new_element);\n\n    if (ECMA_IS_VALUE_ERROR (def_value))\n    {\n      return def_value;\n    }\n\n    JERRY_ASSERT (ecma_is_value_boolean (def_value));\n  }\n\n  return ECMA_VALUE_TRUE;\n} /* ecma_builtin_json_internalize_process_property */\n\n/**\n * Function to set a string token from the given arguments, fills its fields and advances the string pointer.\n *\n * @return ecma_value_t containing an object or an error massage\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_json_parse_buffer (const lit_utf8_byte_t *str_start_p, /**< String to parse */\n                                lit_utf8_size_t string_size) /**< size of the string */\n{\n  ecma_json_token_t token;\n  token.current_p = str_start_p;\n  token.end_p = str_start_p + string_size;\n\n  ecma_builtin_json_parse_next_token (&token, true);\n  ecma_value_t result = ecma_builtin_json_parse_value (&token);\n\n  if (!ecma_is_value_empty (result))\n  {\n    ecma_builtin_json_parse_next_token (&token, false);\n    if (token.type == TOKEN_END)\n    {\n      return result;\n    }\n\n    ecma_free_value (result);\n  }\n\n  return ecma_raise_syntax_error (ECMA_ERR_INVALID_JSON_FORMAT);\n} /* ecma_builtin_json_parse_buffer */\n\n/**\n * The JSON object's 'parse' routine\n *\n * See also:\n *          ECMA-262 v5, 15.12.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_json_parse (ecma_value_t arg1, /**< string argument */\n                         ecma_value_t arg2) /**< reviver argument */\n{\n  ecma_string_t *text_string_p = ecma_op_to_string (arg1);\n\n  if (JERRY_UNLIKELY (text_string_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ECMA_STRING_TO_UTF8_STRING (text_string_p, str_start_p, string_size);\n  ecma_value_t result = ecma_builtin_json_parse_buffer (str_start_p, string_size);\n  ECMA_FINALIZE_UTF8_STRING (str_start_p, string_size);\n  ecma_deref_ecma_string (text_string_p);\n\n  if (!ECMA_IS_VALUE_ERROR (result) && ecma_op_is_callable (arg2))\n  {\n    ecma_object_t *object_p = ecma_op_create_object_object_noarg ();\n\n    ecma_property_value_t *prop_value_p;\n    prop_value_p = ecma_create_named_data_property (object_p,\n                                                    ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY),\n                                                    ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                    NULL);\n\n    ecma_named_data_property_assign_value (object_p, prop_value_p, result);\n\n    ecma_free_value (result);\n    result = ecma_builtin_json_internalize_property (ecma_get_object_from_value (arg2),\n                                                     object_p,\n                                                     ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY));\n    ecma_deref_object (object_p);\n  }\n\n  return result;\n} /* ecma_builtin_json_parse */\n\n/**\n * Abstract operation 'QuoteJSONString' defined in 24.3.2.2\n */\nstatic void\necma_builtin_json_quote (ecma_stringbuilder_t *builder_p, /**< builder for the result */\n                         ecma_string_t *string_p) /**< string that should be quoted */\n{\n  ECMA_STRING_TO_UTF8_STRING (string_p, string_buff, string_buff_size);\n  const lit_utf8_byte_t *str_p = string_buff;\n  const lit_utf8_byte_t *regular_str_start_p = string_buff;\n  const lit_utf8_byte_t *str_end_p = str_p + string_buff_size;\n\n  ecma_stringbuilder_append_byte (builder_p, LIT_CHAR_DOUBLE_QUOTE);\n\n  while (str_p < str_end_p)\n  {\n    ecma_char_t c = lit_cesu8_read_next (&str_p);\n\n    bool should_escape = false;\n\n    if (lit_is_code_point_utf16_high_surrogate (c))\n    {\n      if (str_p < str_end_p)\n      {\n        const ecma_char_t next_ch = lit_cesu8_peek_next (str_p);\n        if (lit_is_code_point_utf16_low_surrogate (next_ch))\n        {\n          str_p += LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;\n          continue;\n        }\n        should_escape = true;\n      }\n      else\n      {\n        should_escape = true;\n      }\n    }\n    else if (lit_is_code_point_utf16_low_surrogate (c))\n    {\n      should_escape = true;\n    }\n\n    if (c == LIT_CHAR_BACKSLASH || c == LIT_CHAR_DOUBLE_QUOTE)\n    {\n      ecma_stringbuilder_append_raw (builder_p,\n                                     regular_str_start_p,\n                                     (lit_utf8_size_t) (str_p - regular_str_start_p - 1));\n      regular_str_start_p = str_p;\n      ecma_stringbuilder_append_byte (builder_p, LIT_CHAR_BACKSLASH);\n      ecma_stringbuilder_append_byte (builder_p, (lit_utf8_byte_t) c);\n    }\n    else if (c < LIT_CHAR_SP || should_escape)\n    {\n      /**\n       * In ES10 we should escape high or low surrogate characters,\n       * so we shouldn't append the unescaped character to the stringbuilder\n       */\n      uint8_t offset = should_escape ? LIT_UTF8_MAX_BYTES_IN_CODE_UNIT : 1;\n\n      ecma_stringbuilder_append_raw (builder_p,\n                                     regular_str_start_p,\n                                     (lit_utf8_size_t) (str_p - regular_str_start_p - offset));\n\n      regular_str_start_p = str_p;\n\n      switch (c)\n      {\n        case LIT_CHAR_BS:\n        {\n          ecma_stringbuilder_append_raw (builder_p, (lit_utf8_byte_t *) \"\\\\b\", 2);\n          break;\n        }\n        case LIT_CHAR_FF:\n        {\n          ecma_stringbuilder_append_raw (builder_p, (lit_utf8_byte_t *) \"\\\\f\", 2);\n          break;\n        }\n        case LIT_CHAR_LF:\n        {\n          ecma_stringbuilder_append_raw (builder_p, (lit_utf8_byte_t *) \"\\\\n\", 2);\n          break;\n        }\n        case LIT_CHAR_CR:\n        {\n          ecma_stringbuilder_append_raw (builder_p, (lit_utf8_byte_t *) \"\\\\r\", 2);\n          break;\n        }\n        case LIT_CHAR_TAB:\n        {\n          ecma_stringbuilder_append_raw (builder_p, (lit_utf8_byte_t *) \"\\\\t\", 2);\n          break;\n        }\n        default: /* Hexadecimal. */\n        {\n          lit_char_unicode_escape (builder_p, c);\n          break;\n        }\n      }\n    }\n  }\n\n  ecma_stringbuilder_append_raw (builder_p, regular_str_start_p, (lit_utf8_size_t) (str_end_p - regular_str_start_p));\n  ecma_stringbuilder_append_byte (builder_p, LIT_CHAR_DOUBLE_QUOTE);\n\n  ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size);\n} /* ecma_builtin_json_quote */\n\nstatic ecma_value_t ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,\n                                                          ecma_object_t *holder_p,\n                                                          ecma_string_t *key_p);\n\n/**\n * Abstract operation 'SerializeJSONObject' defined in 24.3.2.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_json_serialize_object (ecma_json_stringify_context_t *context_p, /**< context*/\n                                    ecma_object_t *obj_p) /**< the object*/\n{\n  /* 1. */\n  if (ecma_json_has_object_in_stack (context_p->occurrence_stack_last_p, obj_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_THE_STRUCTURE_IS_CYCLICAL);\n  }\n\n  /* 2. */\n  ecma_json_occurrence_stack_item_t stack_item;\n  stack_item.next_p = context_p->occurrence_stack_last_p;\n  stack_item.object_p = obj_p;\n  context_p->occurrence_stack_last_p = &stack_item;\n\n  /* 3. - 4.*/\n  const lit_utf8_size_t stepback_size = ecma_stringbuilder_get_size (&context_p->indent_builder);\n  ecma_stringbuilder_append (&context_p->indent_builder, context_p->gap_str_p);\n\n  const bool has_gap = !ecma_compare_ecma_string_to_magic_id (context_p->gap_str_p, LIT_MAGIC_STRING__EMPTY);\n  const lit_utf8_size_t separator_size = ecma_stringbuilder_get_size (&context_p->indent_builder);\n\n  ecma_collection_t *property_keys_p;\n  /* 5. */\n  if (context_p->property_list_p != NULL)\n  {\n    property_keys_p = context_p->property_list_p;\n  }\n  /* 6. */\n  else\n  {\n    property_keys_p = ecma_op_object_get_enumerable_property_names (obj_p, ECMA_ENUMERABLE_PROPERTY_KEYS);\n\n#if JERRY_BUILTIN_PROXY\n    if (property_keys_p == NULL)\n    {\n      return ECMA_VALUE_ERROR;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n  }\n\n  /* 8. */\n  ecma_value_t *buffer_p = property_keys_p->buffer_p;\n\n  ecma_stringbuilder_append_byte (&context_p->result_builder, LIT_CHAR_LEFT_BRACE);\n  const lit_utf8_size_t left_brace = ecma_stringbuilder_get_size (&context_p->result_builder);\n  lit_utf8_size_t last_prop = left_brace;\n  ecma_value_t result = ECMA_VALUE_EMPTY;\n\n  for (uint32_t i = 0; i < property_keys_p->item_count; i++)\n  {\n    if (has_gap)\n    {\n      ecma_stringbuilder_append_raw (&context_p->result_builder,\n                                     ecma_stringbuilder_get_data (&context_p->indent_builder),\n                                     separator_size);\n    }\n\n    ecma_string_t *key_p = ecma_get_string_from_value (buffer_p[i]);\n    ecma_builtin_json_quote (&context_p->result_builder, key_p);\n    ecma_stringbuilder_append_byte (&context_p->result_builder, LIT_CHAR_COLON);\n\n    /* 8.c.iii */\n    if (has_gap)\n    {\n      ecma_stringbuilder_append_byte (&context_p->result_builder, LIT_CHAR_SP);\n    }\n\n    result = ecma_builtin_json_serialize_property (context_p, obj_p, key_p);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup;\n    }\n\n    /* 8.b */\n    if (!ecma_is_value_undefined (result))\n    {\n      /* ecma_builtin_json_serialize_property already appended the result. */\n      JERRY_ASSERT (ecma_is_value_empty (result));\n\n      ecma_stringbuilder_append_byte (&context_p->result_builder, LIT_CHAR_COMMA);\n      last_prop = ecma_stringbuilder_get_size (&context_p->result_builder);\n    }\n    else\n    {\n      /* The property should not be appended, we must backtrack. */\n      ecma_stringbuilder_revert (&context_p->result_builder, last_prop);\n    }\n  }\n\n  if (last_prop != left_brace)\n  {\n    /* Remove the last comma. */\n    ecma_stringbuilder_revert (&context_p->result_builder, last_prop - 1);\n\n    if (has_gap)\n    {\n      /* We appended at least one element, and have a separator, so must append the stepback. */\n      ecma_stringbuilder_append_raw (&context_p->result_builder,\n                                     ecma_stringbuilder_get_data (&context_p->indent_builder),\n                                     stepback_size);\n    }\n  }\n\n  ecma_stringbuilder_append_byte (&context_p->result_builder, LIT_CHAR_RIGHT_BRACE);\n  result = ECMA_VALUE_EMPTY;\n\n  /* 11. */\n  context_p->occurrence_stack_last_p = stack_item.next_p;\n\n  /* 12. */\n  ecma_stringbuilder_revert (&context_p->indent_builder, stepback_size);\n\ncleanup:\n  if (context_p->property_list_p == NULL)\n  {\n    ecma_collection_free (property_keys_p);\n  }\n\n  return result;\n} /* ecma_builtin_json_serialize_object */\n\n/**\n * Abstract operation 'SerializeJSONArray' defined in 24.3.2.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_json_serialize_array (ecma_json_stringify_context_t *context_p, /**< context*/\n                                   ecma_object_t *obj_p) /**< the array object*/\n{\n#ifndef JERRY_NDEBUG\n  ecma_value_t obj_value = ecma_make_object_value (obj_p);\n  ecma_value_t is_array = ecma_is_value_array (obj_value);\n\n  JERRY_ASSERT (ecma_is_value_true (is_array));\n#endif /* !JERRY_NDEBUG */\n\n  /* 1. */\n  if (ecma_json_has_object_in_stack (context_p->occurrence_stack_last_p, obj_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_THE_STRUCTURE_IS_CYCLICAL);\n  }\n\n  /* 2. */\n  ecma_json_occurrence_stack_item_t stack_item;\n  stack_item.next_p = context_p->occurrence_stack_last_p;\n  stack_item.object_p = obj_p;\n  context_p->occurrence_stack_last_p = &stack_item;\n\n  /* 3. - 4.*/\n  const lit_utf8_size_t stepback_size = ecma_stringbuilder_get_size (&context_p->indent_builder);\n  ecma_stringbuilder_append (&context_p->indent_builder, context_p->gap_str_p);\n  const lit_utf8_size_t separator_size = ecma_stringbuilder_get_size (&context_p->indent_builder);\n\n  const bool has_gap = !ecma_compare_ecma_string_to_magic_id (context_p->gap_str_p, LIT_MAGIC_STRING__EMPTY);\n\n  /* 6. */\n  ecma_length_t array_length;\n  ecma_value_t length_value = ecma_op_object_get_length (obj_p, &array_length);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_IS_VALUE_ERROR (length_value))\n  {\n    return length_value;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n  JERRY_ASSERT (ecma_is_value_empty (length_value));\n\n  ecma_stringbuilder_append_byte (&context_p->result_builder, LIT_CHAR_LEFT_SQUARE);\n\n  const lit_utf8_size_t left_square = ecma_stringbuilder_get_size (&context_p->result_builder);\n  lit_utf8_size_t last_prop = left_square;\n\n  /* 8. - 9. */\n  for (ecma_length_t index = 0; index < array_length; index++)\n  {\n    /* 9.a */\n    ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);\n\n    if (has_gap)\n    {\n      ecma_stringbuilder_append_raw (&context_p->result_builder,\n                                     ecma_stringbuilder_get_data (&context_p->indent_builder),\n                                     separator_size);\n    }\n\n    ecma_value_t result = ecma_builtin_json_serialize_property (context_p, obj_p, index_str_p);\n    ecma_deref_ecma_string (index_str_p);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      return result;\n    }\n\n    if (ecma_is_value_undefined (result))\n    {\n      /* 9.c */\n      ecma_stringbuilder_append_magic (&context_p->result_builder, LIT_MAGIC_STRING_NULL);\n    }\n    else\n    {\n      JERRY_ASSERT (ecma_is_value_empty (result));\n    }\n\n    last_prop = ecma_stringbuilder_get_size (&context_p->result_builder);\n    ecma_stringbuilder_append_byte (&context_p->result_builder, LIT_CHAR_COMMA);\n  }\n\n  /* Remove the last comma. */\n  ecma_stringbuilder_revert (&context_p->result_builder, last_prop);\n\n  /* 11.b.iii */\n  if (last_prop != left_square && has_gap)\n  {\n    /* We appended at least one element, and have a separator, so must append the stepback. */\n    ecma_stringbuilder_append_raw (&context_p->result_builder,\n                                   ecma_stringbuilder_get_data (&context_p->indent_builder),\n                                   stepback_size);\n  }\n\n  ecma_stringbuilder_append_byte (&context_p->result_builder, LIT_CHAR_RIGHT_SQUARE);\n\n  /* 12. */\n  context_p->occurrence_stack_last_p = stack_item.next_p;\n\n  /* 13. */\n  ecma_stringbuilder_revert (&context_p->indent_builder, stepback_size);\n\n  return ECMA_VALUE_EMPTY;\n} /* ecma_builtin_json_serialize_array */\n\n/**\n * Abstract operation 'SerializeJSONProperty' defined in 24.3.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p, /**< context*/\n                                      ecma_object_t *holder_p, /**< the object*/\n                                      ecma_string_t *key_p) /**< property key*/\n{\n  /* 1. */\n  ecma_value_t value = ecma_op_object_get (holder_p, key_p);\n\n  /* 2. */\n  if (ECMA_IS_VALUE_ERROR (value))\n  {\n    return value;\n  }\n\n  /* 3. */\n  if (ecma_is_value_object (value) || ecma_is_value_bigint (value))\n  {\n    ecma_value_t to_object_value = ecma_op_to_object (value);\n\n    if (ECMA_IS_VALUE_ERROR (to_object_value))\n    {\n      ecma_free_value (value);\n      return to_object_value;\n    }\n\n    ecma_object_t *value_obj_p = ecma_get_object_from_value (to_object_value);\n    ecma_value_t to_json =\n      ecma_op_object_get_with_receiver (value_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_TO_JSON_UL), value);\n\n    ecma_deref_object (value_obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (to_json))\n    {\n      ecma_free_value (value);\n      return to_json;\n    }\n\n    /* 3.c */\n    if (ecma_op_is_callable (to_json))\n    {\n      ecma_value_t key_value = ecma_make_string_value (key_p);\n      ecma_value_t call_args[] = { key_value };\n      ecma_object_t *to_json_obj_p = ecma_get_object_from_value (to_json);\n\n      ecma_value_t result = ecma_op_function_call (to_json_obj_p, value, call_args, 1);\n      ecma_free_value (value);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        ecma_deref_object (to_json_obj_p);\n        return result;\n      }\n      value = result;\n    }\n    ecma_free_value (to_json);\n  }\n\n  /* 4. */\n  if (context_p->replacer_function_p)\n  {\n    ecma_value_t holder_value = ecma_make_object_value (holder_p);\n    ecma_value_t key_value = ecma_make_string_value (key_p);\n    ecma_value_t call_args[] = { key_value, value };\n\n    ecma_value_t result = ecma_op_function_call (context_p->replacer_function_p, holder_value, call_args, 2);\n    ecma_free_value (value);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      return result;\n    }\n\n    value = result;\n  }\n\n  /* 5. */\n  if (ecma_is_value_object (value))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (value);\n\n    if (ecma_get_object_base_type (obj_p) == ECMA_OBJECT_BASE_TYPE_CLASS)\n    {\n      switch (((ecma_extended_object_t *) obj_p)->u.cls.type)\n      {\n        /* 5.a */\n        case ECMA_OBJECT_CLASS_NUMBER:\n        {\n          ecma_number_t num;\n          value = ecma_op_to_number (value, &num);\n          ecma_deref_object (obj_p);\n\n          if (ECMA_IS_VALUE_ERROR (value))\n          {\n            return value;\n          }\n\n          value = ecma_make_number_value (num);\n          break;\n        }\n        /* 5.b */\n        case ECMA_OBJECT_CLASS_STRING:\n        {\n          ecma_string_t *str_p = ecma_op_to_string (value);\n          ecma_deref_object (obj_p);\n\n          if (JERRY_UNLIKELY (str_p == NULL))\n          {\n            return ECMA_VALUE_ERROR;\n          }\n\n          value = ecma_make_string_value (str_p);\n          break;\n        }\n        /* 5.c */\n        case ECMA_OBJECT_CLASS_BOOLEAN:\n        {\n          ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n          value = ext_object_p->u.cls.u3.value;\n          ecma_deref_object (obj_p);\n          break;\n        }\n#if JERRY_BUILTIN_BIGINT\n        /* 5.d */\n        case ECMA_OBJECT_CLASS_BIGINT:\n        {\n          ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n          value = ecma_copy_value (ext_object_p->u.cls.u3.value);\n          ecma_deref_object (obj_p);\n          break;\n        }\n#endif /* JERRY_BUILTIN_BIGINT */\n      }\n    }\n  }\n\n  /* 6. - 8. */\n  if (ecma_is_value_null (value))\n  {\n    ecma_stringbuilder_append_magic (&context_p->result_builder, LIT_MAGIC_STRING_NULL);\n    return ECMA_VALUE_EMPTY;\n  }\n\n  if (ecma_is_value_true (value))\n  {\n    ecma_stringbuilder_append_magic (&context_p->result_builder, LIT_MAGIC_STRING_TRUE);\n    return ECMA_VALUE_EMPTY;\n  }\n\n  if (ecma_is_value_false (value))\n  {\n    ecma_stringbuilder_append_magic (&context_p->result_builder, LIT_MAGIC_STRING_FALSE);\n    return ECMA_VALUE_EMPTY;\n  }\n\n  /* 9. */\n  if (ecma_is_value_string (value))\n  {\n    ecma_string_t *value_str_p = ecma_get_string_from_value (value);\n    /* Quote will append the result. */\n    ecma_builtin_json_quote (&context_p->result_builder, value_str_p);\n    ecma_deref_ecma_string (value_str_p);\n\n    return ECMA_VALUE_EMPTY;\n  }\n\n  /* 10. */\n  if (ecma_is_value_number (value))\n  {\n    ecma_number_t num_value = ecma_get_number_from_value (value);\n\n    /* 10.a */\n    if (!ecma_number_is_nan (num_value) && !ecma_number_is_infinity (num_value))\n    {\n      ecma_string_t *result_string_p = ecma_op_to_string (value);\n      JERRY_ASSERT (result_string_p != NULL);\n\n      ecma_stringbuilder_append (&context_p->result_builder, result_string_p);\n      ecma_deref_ecma_string (result_string_p);\n    }\n    else\n    {\n      /* 10.b */\n      ecma_stringbuilder_append_magic (&context_p->result_builder, LIT_MAGIC_STRING_NULL);\n    }\n\n    ecma_free_value (value);\n    return ECMA_VALUE_EMPTY;\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (ecma_is_value_bigint (value))\n  {\n    ecma_free_value (value);\n    return ecma_raise_type_error (ECMA_ERR_BIGINT_SERIALIZED);\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  /* 11. */\n  if (ecma_is_value_object (value) && !ecma_op_is_callable (value))\n  {\n    ecma_value_t is_array = ecma_is_value_array (value);\n\n#if JERRY_BUILTIN_BIGINT\n    if (ECMA_IS_VALUE_ERROR (is_array))\n    {\n      ecma_free_value (value);\n      return is_array;\n    }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n    ecma_object_t *obj_p = ecma_get_object_from_value (value);\n\n    ecma_value_t ret_value;\n    /* 10.a */\n    if (ecma_is_value_true (is_array))\n    {\n      ret_value = ecma_builtin_json_serialize_array (context_p, obj_p);\n    }\n    /* 10.b */\n    else\n    {\n      ret_value = ecma_builtin_json_serialize_object (context_p, obj_p);\n    }\n\n    ecma_deref_object (obj_p);\n    return ret_value;\n  }\n\n  /* 12. */\n  ecma_free_value (value);\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_builtin_json_serialize_property */\n\n/**\n * Helper function to stringify an object in JSON format representing an ecma_value.\n *\n *  @return ecma_value_t string created from an abject formating by a given context\n *          Returned value must be freed with ecma_free_value.\n *\n */\nstatic ecma_value_t\necma_builtin_json_str_helper (ecma_json_stringify_context_t *context_p, /**< context argument */\n                              const ecma_value_t arg1) /**< object argument */\n{\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n  ecma_object_t *obj_wrapper_p = ecma_op_create_object_object_noarg ();\n  ecma_string_t *empty_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n  ecma_value_t put_comp_val =\n    ecma_builtin_helper_def_prop (obj_wrapper_p, empty_str_p, arg1, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n\n  JERRY_ASSERT (ecma_is_value_true (put_comp_val));\n\n  context_p->result_builder = ecma_stringbuilder_create ();\n\n  if (!ecma_compare_ecma_string_to_magic_id (context_p->gap_str_p, LIT_MAGIC_STRING__EMPTY))\n  {\n    ecma_stringbuilder_append_byte (&context_p->indent_builder, LIT_CHAR_LF);\n  }\n\n  ret_value = ecma_builtin_json_serialize_property (context_p, obj_wrapper_p, empty_str_p);\n  ecma_deref_object (obj_wrapper_p);\n\n  if (ECMA_IS_VALUE_ERROR (ret_value) || ecma_is_value_undefined (ret_value))\n  {\n    ecma_stringbuilder_destroy (&context_p->result_builder);\n    return ret_value;\n  }\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&context_p->result_builder));\n} /* ecma_builtin_json_str_helper */\n\n/**\n * Function to create a JSON string from a JS value.\n *\n * Note:\n *      The returned value must be freed with ecma_free_value.\n *\n * @return - ecma_value_t containing a json string.\n *         - Error value in case of any errors.\n */\necma_value_t\necma_builtin_json_stringify_no_opts (const ecma_value_t value) /**< value to stringify */\n{\n  ecma_json_stringify_context_t context;\n  context.occurrence_stack_last_p = NULL;\n  context.indent_builder = ecma_stringbuilder_create ();\n  context.property_list_p = NULL;\n  context.replacer_function_p = NULL;\n  context.gap_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n\n  ecma_value_t ret_value = ecma_builtin_json_str_helper (&context, value);\n\n  ecma_deref_ecma_string (context.gap_str_p);\n  ecma_stringbuilder_destroy (&context.indent_builder);\n  return ret_value;\n} /* ecma_builtin_json_stringify_no_opts */\n\n/**\n * The JSON object's 'stringify' routine\n *\n * See also:\n *          ECMA-262 v5, 15.12.3\n *          ECMA-262 v11, 24.5.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_json_stringify (ecma_value_t arg1, /**< value */\n                             ecma_value_t arg2, /**< replacer */\n                             ecma_value_t arg3) /**< space */\n{\n  ecma_json_stringify_context_t context;\n  context.replacer_function_p = NULL;\n  context.property_list_p = NULL;\n\n  /* 4. */\n  if (ecma_is_value_object (arg2))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (arg2);\n\n    /* 4.a */\n    if (ecma_op_is_callable (arg2))\n    {\n      context.replacer_function_p = obj_p;\n    }\n    /* 4.b */\n    else\n    {\n      ecma_value_t is_array = ecma_is_value_array (arg2);\n\n      if (ECMA_IS_VALUE_ERROR (is_array))\n      {\n        return is_array;\n      }\n\n      if (ecma_is_value_true (is_array))\n      {\n        ecma_length_t array_length;\n        ecma_value_t to_len = ecma_op_object_get_length (obj_p, &array_length);\n\n#if JERRY_BUILTIN_PROXY\n        if (ECMA_IS_VALUE_ERROR (to_len))\n        {\n          return to_len;\n        }\n#endif /* JERRY_BUILTIN_PROXY */\n        JERRY_ASSERT (ecma_is_value_empty (to_len));\n\n        context.property_list_p = ecma_new_collection ();\n\n        uint32_t index = 0;\n\n        /* 4.b.iii.5 */\n        while (index < array_length)\n        {\n          ecma_value_t value = ecma_op_object_get_by_index (obj_p, index);\n\n          if (ECMA_IS_VALUE_ERROR (value))\n          {\n            ecma_collection_free (context.property_list_p);\n            return value;\n          }\n\n          /* 4.b.iii.5.c */\n          ecma_value_t item = ECMA_VALUE_UNDEFINED;\n\n          /* 4.b.iii.5.d */\n          if (ecma_is_value_string (value))\n          {\n            ecma_ref_ecma_string (ecma_get_string_from_value (value));\n            item = value;\n          }\n          /* 4.b.iii.5.e */\n          else if (ecma_is_value_number (value))\n          {\n            ecma_string_t *number_str_p = ecma_op_to_string (value);\n            JERRY_ASSERT (number_str_p != NULL);\n            item = ecma_make_string_value (number_str_p);\n          }\n          /* 4.b.iii.5.f */\n          else if (ecma_is_value_object (value))\n          {\n            ecma_object_t *value_obj_p = ecma_get_object_from_value (value);\n\n            if (ecma_get_object_base_type (value_obj_p) == ECMA_OBJECT_BASE_TYPE_CLASS)\n            {\n              uint8_t class_type = ((ecma_extended_object_t *) value_obj_p)->u.cls.type;\n\n              if (class_type == ECMA_OBJECT_CLASS_NUMBER || class_type == ECMA_OBJECT_CLASS_STRING)\n              {\n                ecma_string_t *str_p = ecma_op_to_string (value);\n\n                if (JERRY_UNLIKELY (str_p == NULL))\n                {\n                  ecma_collection_free (context.property_list_p);\n                  ecma_free_value (value);\n                  return ECMA_VALUE_ERROR;\n                }\n\n                item = ecma_make_string_value (str_p);\n              }\n            }\n          }\n\n          ecma_free_value (value);\n\n          /* 4.b.iii.5.g */\n          if (!ecma_is_value_undefined (item))\n          {\n            JERRY_ASSERT (ecma_is_value_string (item));\n            ecma_string_t *string_p = ecma_get_string_from_value (item);\n\n            if (!ecma_collection_has_string_value (context.property_list_p, string_p))\n            {\n              ecma_collection_push_back (context.property_list_p, item);\n            }\n            else\n            {\n              ecma_deref_ecma_string (string_p);\n            }\n          }\n\n          index++;\n        }\n      }\n    }\n  }\n\n  ecma_value_t space = ECMA_VALUE_EMPTY;\n\n  /* 5. */\n  if (ecma_is_value_object (arg3))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (arg3);\n\n    if (ecma_get_object_base_type (obj_p) == ECMA_OBJECT_BASE_TYPE_CLASS)\n    {\n      uint8_t class_type = ((ecma_extended_object_t *) obj_p)->u.cls.type;\n\n      /* 5.a */\n      if (class_type == ECMA_OBJECT_CLASS_NUMBER)\n      {\n        ecma_number_t num;\n        ecma_value_t value = ecma_op_to_number (arg3, &num);\n\n        if (ECMA_IS_VALUE_ERROR (value))\n        {\n          if (context.property_list_p != NULL)\n          {\n            ecma_collection_free (context.property_list_p);\n          }\n          return value;\n        }\n\n        space = ecma_make_number_value (num);\n      }\n      /* 5.b */\n      else if (class_type == ECMA_OBJECT_CLASS_STRING)\n      {\n        ecma_string_t *value_str_p = ecma_op_to_string (arg3);\n\n        if (JERRY_UNLIKELY (value_str_p == NULL))\n        {\n          if (context.property_list_p != NULL)\n          {\n            ecma_collection_free (context.property_list_p);\n          }\n          return ECMA_VALUE_ERROR;\n        }\n\n        space = ecma_make_string_value (value_str_p);\n      }\n    }\n  }\n\n  if (space == ECMA_VALUE_EMPTY)\n  {\n    space = ecma_copy_value (arg3);\n  }\n\n  /* 6. */\n  if (ecma_is_value_number (space))\n  {\n    /* 6.a */\n    ecma_number_t num_of_spaces;\n    ecma_op_to_integer (space, &num_of_spaces);\n\n    num_of_spaces = JERRY_MIN (10, num_of_spaces);\n\n    /* 6.b */\n    if (num_of_spaces < 1)\n    {\n      context.gap_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n    }\n    else\n    {\n      JMEM_DEFINE_LOCAL_ARRAY (space_buff, num_of_spaces, char);\n\n      memset (space_buff, LIT_CHAR_SP, (size_t) num_of_spaces);\n      context.gap_str_p =\n        ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff, (lit_utf8_size_t) num_of_spaces);\n\n      JMEM_FINALIZE_LOCAL_ARRAY (space_buff);\n    }\n  }\n  /* 7. */\n  else if (ecma_is_value_string (space))\n  {\n    ecma_string_t *space_str_p = ecma_get_string_from_value (space);\n    lit_utf8_size_t num_of_chars = ecma_string_get_length (space_str_p);\n\n    if (num_of_chars < 10)\n    {\n      ecma_ref_ecma_string (space_str_p);\n      context.gap_str_p = space_str_p;\n    }\n    else\n    {\n      context.gap_str_p = ecma_string_substr (space_str_p, 0, 10);\n    }\n  }\n  /* 8. */\n  else\n  {\n    context.gap_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  ecma_free_value (space);\n\n  /* 1., 2., 3. */\n  context.occurrence_stack_last_p = NULL;\n  context.indent_builder = ecma_stringbuilder_create ();\n\n  /* 9. */\n  ecma_value_t ret_value = ecma_builtin_json_str_helper (&context, arg1);\n\n  ecma_deref_ecma_string (context.gap_str_p);\n  ecma_stringbuilder_destroy (&context.indent_builder);\n\n  if (context.property_list_p != NULL)\n  {\n    ecma_collection_free (context.property_list_p);\n  }\n\n  return ret_value;\n} /* ecma_builtin_json_stringify */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_json_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                    ecma_value_t this_arg, /**< 'this' argument value */\n                                    const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                            *   passed to routine */\n                                    uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (this_arg, arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_BUILTIN_JSON_PARSE:\n    {\n      return ecma_builtin_json_parse (arguments_list_p[0], arguments_list_p[1]);\n    }\n    case ECMA_BUILTIN_JSON_STRINGIFY:\n    {\n      return ecma_builtin_json_stringify (arguments_list_p[0], arguments_list_p[1], arguments_list_p[2]);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_json_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_JSON */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * JSON built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_JSON\n\n/* ECMA-262 v6, 24.3.3 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_JSON_U, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_PARSE, ECMA_BUILTIN_JSON_PARSE, 2, 2)\nROUTINE (LIT_MAGIC_STRING_STRINGIFY, ECMA_BUILTIN_JSON_STRINGIFY, 3, 3)\n\n#endif /* JERRY_BUILTIN_JSON */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-container-object.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BUILTIN_MAP_ITERATOR_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_BUILTIN_MAP_ITERATOR_PROTOTYPE_ROUTINE_OBJECT_NEXT,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-map-iterator-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  map_iterator_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup %mapiteratorprototype% ECMA %MapIteratorPrototype% object built-in\n * @{\n */\n\n/**\n * The %MapIteratorPrototype% object's 'next' routine\n *\n * See also:\n *          ECMA-262 v6, 23.1.5.2.1\n *\n * Note:\n *     Returned value must be freed with ecma_free_value.\n *\n * @return iterator result object, if success\n *         error - otherwise\n */\nstatic ecma_value_t\necma_builtin_map_iterator_prototype_object_next (ecma_value_t this_val) /**< this argument */\n{\n  return ecma_op_container_iterator_next (this_val, ECMA_OBJECT_CLASS_MAP_ITERATOR);\n} /* ecma_builtin_map_iterator_prototype_object_next */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_map_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide\n                                                                                   *   routine identifier */\n                                                      ecma_value_t this_arg, /**< 'this' argument value */\n                                                      const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                              *   passed to routine */\n                                                      uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (arguments_list_p, arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_BUILTIN_MAP_ITERATOR_PROTOTYPE_ROUTINE_OBJECT_NEXT:\n    {\n      return ecma_builtin_map_iterator_prototype_object_next (this_arg);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_map_iterator_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %MapIteratorPrototype% built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MAP_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_NEXT, ECMA_BUILTIN_MAP_ITERATOR_PROTOTYPE_ROUTINE_OBJECT_NEXT, 0, 0)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-container-object.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-map-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  map_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup map ECMA Map object built-in\n * @{\n */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_map_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                             ecma_value_t this_arg, /**< 'this' argument value */\n                                             const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                     *   passed to routine */\n                                             uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n  return ecma_builtin_container_dispatch_routine (builtin_routine_id,\n                                                  this_arg,\n                                                  arguments_list_p,\n                                                  LIT_MAGIC_STRING_MAP_UL);\n} /* ecma_builtin_map_prototype_dispatch_routine */\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Map.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 23.1.3.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_MAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 23.1.3.13 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_CLEAR, ECMA_CONTAINER_ROUTINE_CLEAR, 0, 0)\nROUTINE (LIT_MAGIC_STRING_DELETE, ECMA_CONTAINER_ROUTINE_DELETE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_CONTAINER_ROUTINE_FOREACH, 2, 1)\nROUTINE (LIT_MAGIC_STRING_GET, ECMA_CONTAINER_ROUTINE_GET, 1, 1)\nROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SET, ECMA_CONTAINER_ROUTINE_SET, 2, 2)\nROUTINE (LIT_MAGIC_STRING_VALUES, ECMA_CONTAINER_ROUTINE_VALUES, 0, 0)\nROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_CONTAINER_ROUTINE_KEYS, 0, 0)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_ENTRIES,\n                    LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES,\n                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR,\n                    LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES,\n                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 23.1.3.10 */\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE, ECMA_CONTAINER_ROUTINE_SIZE_GETTER, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-map.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-container-object.h\"\n#include \"ecma-exceptions.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-map.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  map\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup map ECMA Map object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in Map object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_map_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_MAP_REQUIRES_NEW);\n} /* ecma_builtin_map_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Map object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_map_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                     uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_op_container_create (arguments_list_p,\n                                   arguments_list_len,\n                                   LIT_MAGIC_STRING_MAP_UL,\n                                   ECMA_BUILTIN_ID_MAP_PROTOTYPE);\n} /* ecma_builtin_map_dispatch_construct */\n\n/**\n * 23.1.2.2 get Map [ @@species ] accessor\n *\n * @return ecma_value\n *         returned value must be freed with ecma_free_value\n */\necma_value_t\necma_builtin_map_species_get (ecma_value_t this_value) /**< This Value */\n{\n  return ecma_copy_value (this_value);\n} /* ecma_builtin_map_species_get */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-map.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Map built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\n/* ECMA-262 v6, 23.1.2 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 23.1 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_MAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 23.1.2.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_MAP_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v6, 23.1.2.2 */\nACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_map_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-math.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <math.h>\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#include \"jrt-libc-includes.h\"\n#include \"jrt.h\"\n\n#if defined(_WIN32)\n#include <intrin.h>\n#endif /* defined(_WIN32) */\n\n#if JERRY_BUILTIN_MATH\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_MATH_OBJECT_ROUTINE_START = 0,\n\n  ECMA_MATH_OBJECT_ABS, /* ECMA-262 v5, 15.8.2.1 */\n  ECMA_MATH_OBJECT_ACOS, /* ECMA-262 v5, 15.8.2.2 */\n  ECMA_MATH_OBJECT_ASIN, /* ECMA-262 v5, 15.8.2.3 */\n  ECMA_MATH_OBJECT_ATAN, /* ECMA-262 v5, 15.8.2.4 */\n  ECMA_MATH_OBJECT_CEIL, /* ECMA-262 v5, 15.8.2.6 */\n  ECMA_MATH_OBJECT_COS, /* ECMA-262 v5, 15.8.2.7 */\n  ECMA_MATH_OBJECT_EXP, /* ECMA-262 v5, 15.8.2.8 */\n  ECMA_MATH_OBJECT_FLOOR, /* ECMA-262 v5, 15.8.2.9 */\n  ECMA_MATH_OBJECT_LOG, /* ECMA-262 v5, 15.8.2.10 */\n  ECMA_MATH_OBJECT_ROUND, /* ECMA-262 v5, 15.8.2.15 */\n  ECMA_MATH_OBJECT_SIN, /* ECMA-262 v5, 15.8.2.16 */\n  ECMA_MATH_OBJECT_SQRT, /* ECMA-262 v5, 15.8.2.17 */\n  ECMA_MATH_OBJECT_TAN, /* ECMA-262 v5, 15.8.2.18 */\n  ECMA_MATH_OBJECT_ACOSH, /* ECMA-262 v6, 20.2.2.3  */\n  ECMA_MATH_OBJECT_ASINH, /* ECMA-262 v6, 20.2.2.5  */\n  ECMA_MATH_OBJECT_ATANH, /* ECMA-262 v6, 20.2.2.7  */\n  ECMA_MATH_OBJECT_CBRT, /* ECMA-262 v6, 20.2.2.9  */\n  ECMA_MATH_OBJECT_CLZ32, /* ECMA-262 v6, 20.2.2.11  */\n  ECMA_MATH_OBJECT_COSH, /* ECMA-262 v6, 20.2.2.13  */\n  ECMA_MATH_OBJECT_EXPM1, /* ECMA-262 v6, 20.2.2.15  */\n  ECMA_MATH_OBJECT_FROUND, /* ECMA-262 v6, 20.2.2.17  */\n  ECMA_MATH_OBJECT_LOG1P, /* ECMA-262 v6, 20.2.2.21  */\n  ECMA_MATH_OBJECT_LOG10, /* ECMA-262 v6, 20.2.2.22  */\n  ECMA_MATH_OBJECT_LOG2, /* ECMA-262 v6, 20.2.2.23  */\n  ECMA_MATH_OBJECT_SIGN, /* ECMA-262 v6, 20.2.2.29 */\n  ECMA_MATH_OBJECT_SINH, /* ECMA-262 v6, 20.2.2.31  */\n  ECMA_MATH_OBJECT_TANH, /* ECMA-262 v6, 20.2.2.34  */\n  ECMA_MATH_OBJECT_TRUNC, /* ECMA-262 v6, 20.2.2.35  */\n  ECMA_MATH_OBJECT_ATAN2,\n  /* ECMA-262 v5, 15.8.2.5 */ /* first routine with 2 arguments */\n  ECMA_MATH_OBJECT_IMUL, /* ECMA-262 v6, 20.2.2.19  */\n  ECMA_MATH_OBJECT_POW,\n  /* ECMA-262 v5, 15.8.2.13 */ /* last routine with 1 or 2 arguments*/\n  ECMA_MATH_OBJECT_MAX, /* ECMA-262 v5, 15.8.2.11 */\n  ECMA_MATH_OBJECT_MIN, /* ECMA-262 v5, 15.8.2.12 */\n  ECMA_MATH_OBJECT_HYPOT, /* ECMA-262 v6, 20.2.2.18  */\n  ECMA_MATH_OBJECT_RANDOM, /* ECMA-262 v5, 15.8.2.14 */\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-math.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  math\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup object ECMA Object object built-in\n * @{\n */\n\n/**\n * The Math object's 'max' 'min' routines.\n *\n * See also:\n *          ECMA-262 v5, 15.8.2.11\n *          ECMA-262 v5, 15.8.2.12\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_math_object_max_min (bool is_max, /**< 'max' or 'min' operation */\n                                  const ecma_value_t *arg, /**< arguments list */\n                                  uint32_t args_number) /**< number of arguments */\n{\n  ecma_number_t result_num = ecma_number_make_infinity (is_max);\n\n  while (args_number > 0)\n  {\n    ecma_number_t arg_num;\n    ecma_value_t value = ecma_op_to_number (*arg, &arg_num);\n\n    if (ECMA_IS_VALUE_ERROR (value))\n    {\n      return value;\n    }\n\n    arg++;\n    args_number--;\n\n    if (ecma_number_is_nan (arg_num))\n    {\n      result_num = arg_num;\n    }\n\n    if (ecma_number_is_zero (arg_num) && ecma_number_is_zero (result_num))\n    {\n      bool is_negative = ecma_number_is_negative (arg_num);\n\n      if (is_max ? !is_negative : is_negative)\n      {\n        result_num = arg_num;\n      }\n    }\n    else\n    {\n      if (is_max ? (arg_num > result_num) : (arg_num < result_num))\n      {\n        result_num = arg_num;\n      }\n    }\n  }\n\n  return ecma_make_number_value (result_num);\n} /* ecma_builtin_math_object_max_min */\n\n/**\n * The Math object's 'hypot' routine\n *\n * See also:\n *          ECMA-262 v6, 20.2.2.18\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_math_object_hypot (const ecma_value_t *arg, /**< arguments list */\n                                uint32_t args_number) /**< number of arguments */\n{\n  if (args_number == 0)\n  {\n    return ecma_make_number_value (0.0);\n  }\n\n  ecma_number_t result_num = 0;\n  bool inf = false;\n\n  while (args_number > 0)\n  {\n    ecma_number_t arg_num;\n    ecma_value_t value = ecma_op_to_number (*arg, &arg_num);\n    if (ECMA_IS_VALUE_ERROR (value))\n    {\n      return value;\n    }\n\n    arg++;\n    args_number--;\n\n    if (ecma_number_is_nan (arg_num) && !inf)\n    {\n      result_num = arg_num;\n      continue;\n    }\n\n    if (ecma_number_is_infinity (arg_num))\n    {\n      inf = true;\n      result_num = ecma_number_make_infinity (false);\n      continue;\n    }\n\n    result_num += arg_num * arg_num;\n  }\n\n  return ecma_make_number_value (sqrt (result_num));\n} /* ecma_builtin_math_object_hypot */\n\n/**\n * The Math object's 'trunc' routine\n *\n * See also:\n *          ECMA-262 v6, 20.2.2.35\n *\n * @return ecma number\n */\nstatic ecma_number_t\necma_builtin_math_object_trunc (ecma_number_t arg)\n{\n  if (ecma_number_is_nan (arg) || ecma_number_is_infinity (arg) || ecma_number_is_zero (arg))\n  {\n    return arg;\n  }\n\n  if ((arg > 0) && (arg < 1))\n  {\n    return (ecma_number_t) 0.0;\n  }\n\n  if ((arg < 0) && (arg > -1))\n  {\n    return (ecma_number_t) -0.0;\n  }\n\n  return (ecma_number_t) arg - fmod (arg, 1);\n} /* ecma_builtin_math_object_trunc */\n\n/**\n * The Math object's 'sign' routine\n *\n * See also:\n *          ECMA-262 v6, 20.2.2.29\n *\n * @return ecma number\n */\nstatic ecma_number_t\necma_builtin_math_object_sign (ecma_number_t arg)\n{\n  if (ecma_number_is_nan (arg) || ecma_number_is_zero (arg))\n  {\n    return arg;\n  }\n\n  if (ecma_number_is_negative (arg))\n  {\n    return (ecma_number_t) -1.0;\n  }\n\n  return (ecma_number_t) 1.0;\n} /* ecma_builtin_math_object_sign */\n\n/**\n * The Math object's 'random' routine.\n *\n * See also:\n *          ECMA-262 v5, 15.8.2.14\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_math_object_random (void)\n{\n  const ecma_number_t rand_max = (ecma_number_t) RAND_MAX;\n  const ecma_number_t rand_max_min_1 = (ecma_number_t) (RAND_MAX - 1);\n\n  return ecma_make_number_value (((ecma_number_t) rand ()) / rand_max * rand_max_min_1 / rand_max);\n} /* ecma_builtin_math_object_random */\n\n/**\n * Dispatcher for the built-in's routines.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                    ecma_value_t this_arg, /**< 'this' argument value */\n                                    const ecma_value_t arguments_list[], /**< list of arguments\n                                                                          *   passed to routine */\n                                    uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (this_arg);\n\n  if (builtin_routine_id <= ECMA_MATH_OBJECT_POW)\n  {\n    ecma_number_t x = ecma_number_make_nan ();\n    ecma_number_t y = ecma_number_make_nan ();\n\n    if (arguments_number >= 1)\n    {\n      ecma_value_t value = ecma_op_to_number (arguments_list[0], &x);\n\n      if (ECMA_IS_VALUE_ERROR (value))\n      {\n        return value;\n      }\n    }\n\n    if (builtin_routine_id >= ECMA_MATH_OBJECT_ATAN2 && arguments_number >= 2)\n    {\n      if (ecma_is_value_number (arguments_list[1]))\n      {\n        y = ecma_get_number_from_value (arguments_list[1]);\n      }\n      else\n      {\n        ecma_value_t value = ecma_op_to_number (arguments_list[1], &y);\n\n        if (ECMA_IS_VALUE_ERROR (value))\n        {\n          return value;\n        }\n      }\n    }\n\n    switch (builtin_routine_id)\n    {\n      case ECMA_MATH_OBJECT_ABS:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (fabs (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_ACOS:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (acos (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_ASIN:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (asin (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_ATAN:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (atan (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_CEIL:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (ceil (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_COS:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (cos (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_EXP:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (exp (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_FLOOR:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (floor (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_LOG:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (log (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_TRUNC:\n      {\n        x = ecma_builtin_math_object_trunc (x);\n        break;\n      }\n      case ECMA_MATH_OBJECT_SIGN:\n      {\n        x = ecma_builtin_math_object_sign (x);\n        break;\n      }\n      case ECMA_MATH_OBJECT_ROUND:\n      {\n        if (ecma_number_is_nan (x) || ecma_number_is_zero (x) || ecma_number_is_infinity (x))\n        {\n          break;\n        }\n\n        ecma_number_t fraction = fmod (x, ECMA_NUMBER_ONE);\n\n        if (ecma_number_is_zero (fraction))\n        {\n          break;\n        }\n\n        if (ecma_number_is_negative (x))\n        {\n          if (x >= -ECMA_NUMBER_HALF)\n          {\n            x = -ECMA_NUMBER_ZERO;\n            break;\n          }\n\n          if (fraction < -ECMA_NUMBER_HALF)\n          {\n            x -= ECMA_NUMBER_HALF;\n          }\n        }\n        else if (fraction >= ECMA_NUMBER_HALF)\n        {\n          x += ECMA_NUMBER_HALF;\n        }\n\n        x = ecma_number_trunc (x);\n        break;\n      }\n      case ECMA_MATH_OBJECT_SIN:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (sin (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_SQRT:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (sqrt (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_TAN:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (tan (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_ATAN2:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (atan2 (x, y));\n        break;\n      }\n      case ECMA_MATH_OBJECT_POW:\n      {\n        x = ecma_number_pow (x, y);\n        break;\n      }\n      case ECMA_MATH_OBJECT_ACOSH:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (acosh (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_ASINH:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (asinh (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_ATANH:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (atanh (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_CBRT:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (cbrt (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_COSH:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (cosh (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_EXPM1:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (expm1 (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_LOG1P:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (log1p (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_LOG10:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (log10 (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_LOG2:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (log2 (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_SINH:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (sinh (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_TANH:\n      {\n        x = DOUBLE_TO_ECMA_NUMBER_T (tanh (x));\n        break;\n      }\n      case ECMA_MATH_OBJECT_CLZ32:\n      {\n        uint32_t n = ecma_number_to_uint32 (x);\n#if defined(__GNUC__) || defined(__clang__)\n        x = n ? __builtin_clz (n) : 32;\n#elif defined(_WIN32)\n        unsigned long ret;\n        x = _BitScanReverse (&ret, n) ? 31 - ret : 32;\n#else /* !(defined(__GNUC__) || defined(__clang__) || defined(_WIN32)) */\n        x = 32;\n        for (int i = 31; i >= 0; i--)\n        {\n          if (n >> i)\n          {\n            x = 31 - i;\n            break;\n          }\n        }\n#endif /* defined (__GNUC__) || defined (__clang__) */\n        break;\n      }\n      case ECMA_MATH_OBJECT_FROUND:\n      {\n        x = (float) x;\n        break;\n      }\n      case ECMA_MATH_OBJECT_IMUL:\n      {\n        x = (int32_t) (ecma_number_to_uint32 (x) * ecma_number_to_uint32 (y));\n        break;\n      }\n    }\n    return ecma_make_number_value (x);\n  } /* if (builtin_routine_id <= ECMA_MATH_OBJECT_POW) */\n\n  if (builtin_routine_id <= ECMA_MATH_OBJECT_MIN)\n  {\n    return ecma_builtin_math_object_max_min (builtin_routine_id == ECMA_MATH_OBJECT_MAX,\n                                             arguments_list,\n                                             arguments_number);\n  }\n\n  if (builtin_routine_id == ECMA_MATH_OBJECT_HYPOT)\n  {\n    return ecma_builtin_math_object_hypot (arguments_list, arguments_number);\n  }\n\n  JERRY_ASSERT (builtin_routine_id == ECMA_MATH_OBJECT_RANDOM);\n\n  return ecma_builtin_math_object_random ();\n} /* ecma_builtin_math_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_MATH */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-math.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Math built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_MATH\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\n/* ECMA-262 v5, 15.8.1.1 */\nNUMBER_VALUE (LIT_MAGIC_STRING_E_U, ECMA_BUILTIN_NUMBER_E, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.8.1.2 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LN10_U, ECMA_BUILTIN_NUMBER_LN10, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.8.1.3 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LN2_U, ECMA_BUILTIN_NUMBER_LN2, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.8.1.4 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LOG2E_U, ECMA_BUILTIN_NUMBER_LOG2E, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.8.1.5 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LOG10E_U, ECMA_BUILTIN_NUMBER_LOG10E, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.8.1.6 */\nNUMBER_VALUE (LIT_MAGIC_STRING_PI_U, ECMA_BUILTIN_NUMBER_PI, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.8.1.7 */\nNUMBER_VALUE (LIT_MAGIC_STRING_SQRT1_2_U, ECMA_BUILTIN_NUMBER_SQRT_1_2, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.8.1.8 */\nNUMBER_VALUE (LIT_MAGIC_STRING_SQRT2_U, ECMA_BUILTIN_NUMBER_SQRT2, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v6, 20.2.1.9 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MATH_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_ABS, ECMA_MATH_OBJECT_ABS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ACOS, ECMA_MATH_OBJECT_ACOS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ASIN, ECMA_MATH_OBJECT_ASIN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ATAN, ECMA_MATH_OBJECT_ATAN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ATAN2, ECMA_MATH_OBJECT_ATAN2, 2, 2)\nROUTINE (LIT_MAGIC_STRING_CEIL, ECMA_MATH_OBJECT_CEIL, 1, 1)\nROUTINE (LIT_MAGIC_STRING_COS, ECMA_MATH_OBJECT_COS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_EXP, ECMA_MATH_OBJECT_EXP, 1, 1)\nROUTINE (LIT_MAGIC_STRING_FLOOR, ECMA_MATH_OBJECT_FLOOR, 1, 1)\nROUTINE (LIT_MAGIC_STRING_LOG, ECMA_MATH_OBJECT_LOG, 1, 1)\nROUTINE (LIT_MAGIC_STRING_MAX, ECMA_MATH_OBJECT_MAX, NON_FIXED, 2)\nROUTINE (LIT_MAGIC_STRING_MIN, ECMA_MATH_OBJECT_MIN, NON_FIXED, 2)\nROUTINE (LIT_MAGIC_STRING_POW, ECMA_MATH_OBJECT_POW, 2, 2)\nROUTINE (LIT_MAGIC_STRING_RANDOM, ECMA_MATH_OBJECT_RANDOM, 0, 0)\nROUTINE (LIT_MAGIC_STRING_ROUND, ECMA_MATH_OBJECT_ROUND, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SIN, ECMA_MATH_OBJECT_SIN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SQRT, ECMA_MATH_OBJECT_SQRT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_TAN, ECMA_MATH_OBJECT_TAN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ACOSH, ECMA_MATH_OBJECT_ACOSH, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ASINH, ECMA_MATH_OBJECT_ASINH, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ATANH, ECMA_MATH_OBJECT_ATANH, 1, 1)\nROUTINE (LIT_MAGIC_STRING_CBRT, ECMA_MATH_OBJECT_CBRT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_CLZ32, ECMA_MATH_OBJECT_CLZ32, 1, 1)\nROUTINE (LIT_MAGIC_STRING_COSH, ECMA_MATH_OBJECT_COSH, 1, 1)\nROUTINE (LIT_MAGIC_STRING_EXPM1, ECMA_MATH_OBJECT_EXPM1, 1, 1)\nROUTINE (LIT_MAGIC_STRING_FROUND, ECMA_MATH_OBJECT_FROUND, 1, 1)\nROUTINE (LIT_MAGIC_STRING_HYPOT, ECMA_MATH_OBJECT_HYPOT, NON_FIXED, 2)\nROUTINE (LIT_MAGIC_STRING_IMUL, ECMA_MATH_OBJECT_IMUL, 2, 2)\nROUTINE (LIT_MAGIC_STRING_LOG1P, ECMA_MATH_OBJECT_LOG1P, 1, 1)\nROUTINE (LIT_MAGIC_STRING_LOG10, ECMA_MATH_OBJECT_LOG10, 1, 1)\nROUTINE (LIT_MAGIC_STRING_LOG2, ECMA_MATH_OBJECT_LOG2, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SIGN, ECMA_MATH_OBJECT_SIGN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SINH, ECMA_MATH_OBJECT_SINH, 1, 1)\nROUTINE (LIT_MAGIC_STRING_TANH, ECMA_MATH_OBJECT_TANH, 1, 1)\nROUTINE (LIT_MAGIC_STRING_TRUNC, ECMA_MATH_OBJECT_TRUNC, 1, 1)\n\n#endif /* JERRY_BUILTIN_MATH */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <math.h>\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jrt-libc-includes.h\"\n#include \"jrt.h\"\n#include \"lit-char-helpers.h\"\n\n#if JERRY_BUILTIN_NUMBER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_NUMBER_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_NUMBER_PROTOTYPE_VALUE_OF,\n  ECMA_NUMBER_PROTOTYPE_TO_STRING,\n  ECMA_NUMBER_PROTOTYPE_TO_LOCALE_STRING,\n  ECMA_NUMBER_PROTOTYPE_TO_FIXED,\n  ECMA_NUMBER_PROTOTYPE_TO_EXPONENTIAL,\n  ECMA_NUMBER_PROTOTYPE_TO_PRECISION,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-number-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  number_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup numberprototype ECMA Number.prototype object built-in\n * @{\n */\n\n/**\n * Helper for rounding numbers\n *\n * @return rounded number\n */\nstatic inline lit_utf8_size_t JERRY_ATTR_ALWAYS_INLINE\necma_builtin_number_prototype_helper_round (lit_utf8_byte_t *digits_p, /**< [in,out] number as a string in decimal\n                                                                        *   form */\n                                            lit_utf8_size_t num_digits, /**< length of the string representation */\n                                            int32_t round_num, /**< number of digits to keep */\n                                            int32_t *exponent_p, /**< [in, out] decimal exponent */\n                                            bool zero) /**< true if digits_p represents zero */\n{\n  if (round_num == 0 && *exponent_p == 0)\n  {\n    if (digits_p[0] >= 5)\n    {\n      digits_p[0] = '1';\n    }\n    else\n    {\n      digits_p[0] = '0';\n    }\n\n    return 1;\n  }\n\n  if (round_num < 1)\n  {\n    return 0;\n  }\n\n  if ((lit_utf8_size_t) round_num >= num_digits || zero)\n  {\n    return num_digits;\n  }\n\n  if (digits_p[round_num] >= '5')\n  {\n    digits_p[round_num] = '0';\n\n    int i = 1;\n\n    /* Handle carry number. */\n    for (; i <= round_num; i++)\n    {\n      if (++digits_p[round_num - i] <= '9')\n      {\n        break;\n      }\n      digits_p[round_num - i] = '0';\n    }\n\n    /* Prepend highest digit */\n    if (i > round_num)\n    {\n      memmove (digits_p + 1, digits_p, num_digits);\n      digits_p[0] = '1';\n      *exponent_p += 1;\n    }\n  }\n\n  return (lit_utf8_size_t) round_num;\n} /* ecma_builtin_number_prototype_helper_round */\n\n/**\n * Size of Number toString digit buffers.\n */\n#define NUMBER_TO_STRING_MAX_DIGIT_COUNT 64u\n\n/**\n * The Number.prototype object's 'toString' and 'toLocaleString' routines\n *\n * See also:\n *          ECMA-262 v5, 15.7.4.2\n *          ECMA-262 v5, 15.7.4.7\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, /**< this argument number */\n                                                const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                uint32_t arguments_list_len) /**< number of arguments */\n{\n  static const lit_utf8_byte_t digit_chars[36] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b',\n                                                   'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',\n                                                   'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };\n\n  uint32_t radix = 10;\n  if (arguments_list_len > 0 && !ecma_is_value_undefined (arguments_list_p[0]))\n  {\n    ecma_number_t arg_num;\n\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (arguments_list_p[0], &arg_num)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    radix = ecma_number_to_uint32 (arg_num);\n\n    if (radix < 2 || radix > 36)\n    {\n      return ecma_raise_range_error (ECMA_ERR_RADIX_IS_OUT_OF_RANGE);\n    }\n  }\n\n  if (ecma_number_is_nan (this_arg_number) || ecma_number_is_infinity (this_arg_number)\n      || ecma_number_is_zero (this_arg_number) || radix == 10)\n  {\n    ecma_string_t *ret_str_p = ecma_new_ecma_string_from_number (this_arg_number);\n    return ecma_make_string_value (ret_str_p);\n  }\n\n  uint8_t integer_digits[NUMBER_TO_STRING_MAX_DIGIT_COUNT];\n  uint8_t fraction_digits[NUMBER_TO_STRING_MAX_DIGIT_COUNT];\n  uint32_t integer_zeros = 0;\n  uint32_t fraction_zeros = 0;\n  bool is_number_negative = false;\n\n  if (ecma_number_is_negative (this_arg_number))\n  {\n    this_arg_number = -this_arg_number;\n    is_number_negative = true;\n  }\n\n  ecma_number_t integer_part = floor (this_arg_number);\n  ecma_number_t fraction_part = this_arg_number - integer_part;\n\n  uint8_t *integer_cursor_p = integer_digits + NUMBER_TO_STRING_MAX_DIGIT_COUNT;\n  uint8_t *fraction_cursor_p = fraction_digits;\n\n  if (fraction_part > 0.0)\n  {\n    uint8_t digit;\n    ecma_number_t precision = (ecma_number_get_next (this_arg_number) - this_arg_number) * 0.5f;\n    precision = JERRY_MAX (precision, ECMA_NUMBER_MIN_VALUE);\n\n    do\n    {\n      fraction_part *= radix;\n      precision *= radix;\n\n      digit = (uint8_t) floor (fraction_part);\n\n      if (digit == 0 && fraction_cursor_p == fraction_digits)\n      {\n        fraction_zeros++;\n        continue;\n      }\n\n      JERRY_ASSERT (fraction_cursor_p < fraction_digits + NUMBER_TO_STRING_MAX_DIGIT_COUNT);\n      *fraction_cursor_p++ = digit;\n      fraction_part -= (ecma_number_t) digit;\n    } while (fraction_part >= precision);\n\n    /* Round to even */\n    if (fraction_part > 0.5 || (fraction_part == 0.5 && (digit & 1) != 0))\n    {\n      /* Add carry and remove overflowing trailing digits */\n      while (true)\n      {\n        (*(--fraction_cursor_p))++;\n\n        if (*fraction_cursor_p < radix)\n        {\n          /* Re-adjust cursor to point after the last significant digit */\n          fraction_cursor_p++;\n          break;\n        }\n\n        if (fraction_cursor_p == fraction_digits)\n        {\n          /* Carry overflowed to integer part */\n          integer_part += 1;\n          break;\n        }\n      }\n    }\n\n    /* Convert fraction digits to characters. */\n    for (uint8_t *digit_p = fraction_digits; digit_p < fraction_cursor_p; digit_p++)\n    {\n      *digit_p = digit_chars[*digit_p];\n    }\n  }\n\n  while (ecma_number_biased_exp (ecma_number_to_binary (integer_part / radix))\n         > ECMA_NUMBER_EXPONENT_BIAS + ECMA_NUMBER_FRACTION_WIDTH)\n  {\n    integer_zeros++;\n    integer_part /= radix;\n  }\n\n  uint64_t integer_u64 = (uint64_t) integer_part;\n\n  do\n  {\n    uint64_t remainder = integer_u64 % radix;\n    *(--integer_cursor_p) = (uint8_t) digit_chars[remainder];\n\n    integer_u64 /= radix;\n  } while (integer_u64 > 0);\n\n  const uint32_t integer_digit_count =\n    (uint32_t) (integer_digits + NUMBER_TO_STRING_MAX_DIGIT_COUNT - integer_cursor_p);\n  JERRY_ASSERT (integer_digit_count > 0);\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  if (is_number_negative)\n  {\n    ecma_stringbuilder_append_byte (&builder, LIT_CHAR_MINUS);\n  }\n\n  ecma_stringbuilder_append_raw (&builder, integer_cursor_p, integer_digit_count);\n\n  while (integer_zeros--)\n  {\n    ecma_stringbuilder_append_byte (&builder, LIT_CHAR_0);\n  }\n\n  if (fraction_cursor_p != fraction_digits)\n  {\n    ecma_stringbuilder_append_byte (&builder, LIT_CHAR_DOT);\n\n    while (fraction_zeros--)\n    {\n      ecma_stringbuilder_append_byte (&builder, LIT_CHAR_0);\n    }\n\n    const uint32_t fraction_digit_count = (uint32_t) (fraction_cursor_p - fraction_digits);\n    JERRY_ASSERT (fraction_digit_count > 0);\n\n    ecma_stringbuilder_append_raw (&builder, fraction_digits, fraction_digit_count);\n  }\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_number_prototype_object_to_string */\n\n/**\n * The Number.prototype object's 'valueOf' routine\n *\n * See also:\n *          ECMA-262 v5, 15.7.4.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_number_prototype_object_value_of (ecma_value_t this_arg) /**< this argument */\n{\n  if (ecma_is_value_number (this_arg))\n  {\n    return this_arg;\n  }\n  else if (ecma_is_value_object (this_arg))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_NUMBER))\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      JERRY_ASSERT (ecma_is_value_number (ext_object_p->u.cls.u3.value));\n\n      return ext_object_p->u.cls.u3.value;\n    }\n  }\n\n  return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_NUMBER);\n} /* ecma_builtin_number_prototype_object_value_of */\n\n/**\n * Type of number routine\n */\ntypedef enum\n{\n  NUMBER_ROUTINE_TO_FIXED, /**< Number.prototype.toFixed: ECMA-262 v11, 20.1.3.3 */\n  NUMBER_ROUTINE_TO_EXPONENTIAL, /**< Number.prototype.toExponential: ECMA-262 v11, 20.1.3.2 */\n  NUMBER_ROUTINE_TO_PRECISION, /**< Number.prototype.toPrecision: ECMA-262 v11, 20.1.3.5 */\n  NUMBER_ROUTINE__COUNT, /**< count of the modes */\n} number_routine_mode_t;\n\n/**\n * Helper method to convert a number based on the given routine.\n */\nstatic ecma_value_t\necma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num, /**< this argument number */\n                                                        ecma_value_t arg, /**< routine's argument */\n                                                        number_routine_mode_t mode) /**< number routine mode */\n{\n  if (ecma_is_value_undefined (arg) && mode == NUMBER_ROUTINE_TO_PRECISION)\n  {\n    return ecma_builtin_number_prototype_object_to_string (this_num, NULL, 0);\n  }\n\n  ecma_number_t arg_num;\n  ecma_value_t to_integer = ecma_op_to_integer (arg, &arg_num);\n\n  if (ECMA_IS_VALUE_ERROR (to_integer))\n  {\n    return to_integer;\n  }\n\n  /* Argument boundary check for toFixed method */\n  if (mode == NUMBER_ROUTINE_TO_FIXED && (arg_num <= -1 || arg_num >= 101))\n  {\n    return ecma_raise_range_error (ECMA_ERR_FRACTION_DIGITS_OUT_OF_RANGE);\n  }\n\n  /* Handle NaN separately */\n  if (ecma_number_is_nan (this_num))\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING_NAN);\n  }\n\n  /* Get the parameters of the number */\n  lit_utf8_byte_t digits[ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER];\n  lit_utf8_size_t num_of_digits;\n  int32_t exponent;\n  int32_t arg_int = ecma_number_to_int32 (arg_num);\n  bool is_zero = ecma_number_is_zero (this_num);\n  bool is_negative = ecma_number_is_negative (this_num);\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  if (is_negative)\n  {\n    if (!is_zero)\n    {\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_MINUS);\n    }\n\n    this_num *= -1;\n  }\n\n  /* Handle zero separately */\n  if (is_zero)\n  {\n    if (mode == NUMBER_ROUTINE_TO_PRECISION)\n    {\n      arg_int--;\n    }\n\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_0);\n\n    if (arg_int > 0)\n    {\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_DOT);\n    }\n\n    for (int32_t i = 0; i < arg_int; i++)\n    {\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_0);\n    }\n\n    if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL)\n    {\n      ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) \"e+0\", 3);\n    }\n\n    return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n  }\n\n  /* Handle infinity separately */\n  if (ecma_number_is_infinity (this_num))\n  {\n    ecma_stringbuilder_append_magic (&builder, LIT_MAGIC_STRING_INFINITY_UL);\n    return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n  }\n\n  /* Argument boundary check for toExponential and toPrecision methods */\n  if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL && (arg_num <= -1 || arg_num >= 101))\n  {\n    ecma_stringbuilder_destroy (&builder);\n    return ecma_raise_range_error (ECMA_ERR_FRACTION_DIGITS_OUT_OF_RANGE);\n  }\n  else if (mode == NUMBER_ROUTINE_TO_PRECISION && (arg_num < 1 || arg_num > 100))\n  {\n    ecma_stringbuilder_destroy (&builder);\n    return ecma_raise_range_error (ECMA_ERR_PRECISION_DIGITS_MUST_BE_BETWEEN_IN_RANGE);\n  }\n\n  num_of_digits = ecma_number_to_decimal (this_num, digits, &exponent);\n\n  /* Handle undefined argument */\n  if (ecma_is_value_undefined (arg) && mode == NUMBER_ROUTINE_TO_EXPONENTIAL)\n  {\n    arg_int = (int32_t) num_of_digits - 1;\n  }\n\n  if (mode == NUMBER_ROUTINE_TO_FIXED && exponent > 21)\n  {\n    ecma_stringbuilder_destroy (&builder);\n\n    if (is_negative)\n    {\n      this_num *= -1;\n    }\n\n    return ecma_builtin_number_prototype_object_to_string (this_num, NULL, 0);\n  }\n\n  int32_t digits_to_keep = arg_int;\n\n  if (mode == NUMBER_ROUTINE_TO_FIXED)\n  {\n    digits_to_keep += exponent;\n  }\n  else if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL)\n  {\n    digits_to_keep += 1;\n  }\n\n  num_of_digits = ecma_builtin_number_prototype_helper_round (digits, num_of_digits, digits_to_keep, &exponent, false);\n\n  /* toExponent routine and toPrecision cases where the exponent > precision or exponent < -5 */\n  if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL\n      || (mode == NUMBER_ROUTINE_TO_PRECISION && (exponent < -5 || exponent > arg_int)))\n  {\n    /* Append first digit */\n    ecma_stringbuilder_append_byte (&builder, *digits);\n\n    if (mode == NUMBER_ROUTINE_TO_PRECISION)\n    {\n      arg_int--;\n    }\n\n    if (arg_int > 0)\n    {\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_DOT);\n    }\n\n    /* Append significant fraction digits */\n    ecma_stringbuilder_append_raw (&builder, digits + 1, num_of_digits - 1);\n\n    /* Append leading zeros */\n    for (int32_t i = (int32_t) (num_of_digits); i < arg_int + 1; i++)\n    {\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_0);\n    }\n\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_LOWERCASE_E);\n\n    if (exponent <= 0)\n    {\n      exponent = (-exponent) + 1;\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_MINUS);\n    }\n    else\n    {\n      exponent -= 1;\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_PLUS);\n    }\n\n    /* Append exponent part */\n    lit_utf8_size_t exp_size = ecma_uint32_to_utf8_string ((uint32_t) exponent, digits, 3);\n    ecma_stringbuilder_append_raw (&builder, digits, exp_size);\n\n    return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n  }\n\n  /* toFixed routine and toPrecision cases where the exponent <= precision and exponent >= -5 */\n  lit_utf8_size_t result_digits;\n\n  if (mode == NUMBER_ROUTINE_TO_FIXED)\n  {\n    result_digits = ((exponent > 0) ? (lit_utf8_size_t) (exponent + arg_int) : (lit_utf8_size_t) (arg_int + 1));\n  }\n  else\n  {\n    result_digits = ((exponent <= 0) ? (lit_utf8_size_t) (1 - exponent + arg_int) : (lit_utf8_size_t) arg_int);\n  }\n\n  /* Number of digits we copied from digits array */\n  lit_utf8_size_t copied_digits = 0;\n\n  if (exponent == 0 && digits_to_keep == 0)\n  {\n    ecma_stringbuilder_append_char (&builder, *digits);\n    return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n  }\n\n  if (exponent <= 0)\n  {\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_0);\n    result_digits--;\n\n    if (result_digits > 0)\n    {\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_DOT);\n\n      /* Append leading zeros to the fraction part */\n      for (int32_t i = 0; i < -exponent && result_digits > 0; i++)\n      {\n        ecma_stringbuilder_append_char (&builder, LIT_CHAR_0);\n        result_digits--;\n      }\n    }\n  }\n  else\n  {\n    /* Append significant digits of integer part */\n    copied_digits = JERRY_MIN (JERRY_MIN (num_of_digits, result_digits), (lit_utf8_size_t) exponent);\n    ecma_stringbuilder_append_raw (&builder, digits, copied_digits);\n\n    result_digits -= copied_digits;\n    num_of_digits -= copied_digits;\n    exponent -= (int32_t) copied_digits;\n\n    /* Append zeros before decimal point */\n    while (exponent > 0 && result_digits > 0)\n    {\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_0);\n      result_digits--;\n      exponent--;\n    }\n\n    if (result_digits > 0)\n    {\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_DOT);\n    }\n  }\n\n  if (result_digits > 0)\n  {\n    /* Append significant digits to the fraction part */\n    lit_utf8_size_t to_copy = JERRY_MIN (num_of_digits, result_digits);\n    ecma_stringbuilder_append_raw (&builder, digits + copied_digits, to_copy);\n    result_digits -= to_copy;\n\n    /* Append leading zeros */\n    while (result_digits > 0)\n    {\n      ecma_stringbuilder_append_char (&builder, LIT_CHAR_0);\n      result_digits--;\n    }\n  }\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_number_prototype_object_to_number_convert */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_number_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                                ecma_value_t this_arg, /**< 'this' argument value */\n                                                const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                        *   passed to routine */\n                                                uint32_t arguments_number) /**< length of arguments' list */\n{\n  ecma_value_t this_value = ecma_builtin_number_prototype_object_value_of (this_arg);\n\n  if (ECMA_IS_VALUE_ERROR (this_value))\n  {\n    return this_value;\n  }\n\n  if (builtin_routine_id == ECMA_NUMBER_PROTOTYPE_VALUE_OF)\n  {\n    return ecma_copy_value (this_value);\n  }\n\n  ecma_number_t this_arg_number = ecma_get_number_from_value (this_value);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_NUMBER_PROTOTYPE_TO_STRING:\n    {\n      return ecma_builtin_number_prototype_object_to_string (this_arg_number, arguments_list_p, arguments_number);\n    }\n    case ECMA_NUMBER_PROTOTYPE_TO_LOCALE_STRING:\n    {\n      return ecma_builtin_number_prototype_object_to_string (this_arg_number, NULL, 0);\n    }\n    case ECMA_NUMBER_PROTOTYPE_TO_FIXED:\n    case ECMA_NUMBER_PROTOTYPE_TO_EXPONENTIAL:\n    case ECMA_NUMBER_PROTOTYPE_TO_PRECISION:\n    {\n      const int option = NUMBER_ROUTINE_TO_FIXED + (builtin_routine_id - ECMA_NUMBER_PROTOTYPE_TO_FIXED);\n      return ecma_builtin_number_prototype_object_to_number_convert (this_arg_number,\n                                                                     arguments_list_p[0],\n                                                                     (number_routine_mode_t) option);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_number_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_NUMBER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Number.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_NUMBER\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.7.4.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_NUMBER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_NUMBER_PROTOTYPE_TO_STRING, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_NUMBER_PROTOTYPE_VALUE_OF, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_NUMBER_PROTOTYPE_TO_LOCALE_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_FIXED_UL, ECMA_NUMBER_PROTOTYPE_TO_FIXED, 1, 1)\nROUTINE (LIT_MAGIC_STRING_TO_EXPONENTIAL_UL, ECMA_NUMBER_PROTOTYPE_TO_EXPONENTIAL, 1, 1)\nROUTINE (LIT_MAGIC_STRING_TO_PRECISION_UL, ECMA_NUMBER_PROTOTYPE_TO_PRECISION, 1, 1)\n\n#endif /* JERRY_BUILTIN_NUMBER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-number.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <math.h>\n\n#include \"ecma-alloc.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-number-object.h\"\n#include \"ecma-objects.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_NUMBER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_NUMBER_OBJECT_ROUTINE_START = 0,\n  ECMA_NUMBER_OBJECT_ROUTINE_IS_FINITE,\n  ECMA_NUMBER_OBJECT_ROUTINE_IS_NAN,\n  ECMA_NUMBER_OBJECT_ROUTINE_IS_INTEGER,\n  ECMA_NUMBER_OBJECT_ROUTINE_IS_SAFE_INTEGER\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-number.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  number\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup number ECMA Number object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in Number object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_number_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                   uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  if (arguments_list_len == 0)\n  {\n    ret_value = ecma_make_integer_value (0);\n  }\n  else\n  {\n    ecma_number_t num;\n    ret_value = ecma_op_to_numeric (arguments_list_p[0], &num, ECMA_TO_NUMERIC_ALLOW_BIGINT);\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      return ret_value;\n    }\n\n#if JERRY_BUILTIN_BIGINT\n    if (ecma_is_value_bigint (ret_value))\n    {\n      ecma_value_t bigint = ret_value;\n      ret_value = ecma_bigint_to_number (bigint);\n      ecma_free_value (bigint);\n    }\n    else\n#endif /* JERRY_BUILTIN_BIGINT */\n    {\n      ret_value = ecma_make_number_value (num);\n    }\n  }\n\n  return ret_value;\n} /* ecma_builtin_number_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Number object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_number_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                        uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  if (arguments_list_len == 0)\n  {\n    return ecma_op_create_number_object (ecma_make_integer_value (0));\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  ecma_number_t num;\n  ecma_value_t value = ecma_op_to_numeric (arguments_list_p[0], &num, ECMA_TO_NUMERIC_ALLOW_BIGINT);\n\n  if (ECMA_IS_VALUE_ERROR (value))\n  {\n    return value;\n  }\n\n  if (ecma_is_value_bigint (value))\n  {\n    ecma_value_t bigint = value;\n    value = ecma_bigint_to_number (bigint);\n    ecma_free_value (bigint);\n  }\n  else\n  {\n    value = ecma_make_number_value (num);\n  }\n\n  ecma_value_t result = ecma_op_create_number_object (value);\n  ecma_free_value (value);\n  return result;\n#else /* !JERRY_BUILTIN_BIGINT */\n  return ecma_op_create_number_object (arguments_list_p[0]);\n#endif /* JERRY_BUILTIN_BIGINT */\n} /* ecma_builtin_number_dispatch_construct */\n\n/**\n * The Number object 'isInteger' and 'isSafeInteger' routine\n *\n * See also:\n *          ECMA-262 v6, 20.1.2.3\n *          ECMA-262 v6, 20.1.2.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_number_object_is_integer_helper (ecma_value_t arg, /**< routine's argument */\n                                              ecma_number_t num, /**< this number */\n                                              bool is_safe) /**< is the number safe */\n{\n  if (ecma_number_is_nan (num) || ecma_number_is_infinity (num))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_number_t int_num;\n\n  if (is_safe)\n  {\n    int_num = ecma_number_trunc (num);\n\n    if (fabs (int_num) > ECMA_NUMBER_MAX_SAFE_INTEGER)\n    {\n      return ECMA_VALUE_FALSE;\n    }\n  }\n  else\n  {\n    ecma_op_to_integer (arg, &int_num);\n  }\n\n  return (int_num == num) ? ECMA_VALUE_TRUE : ECMA_VALUE_FALSE;\n} /* ecma_builtin_number_object_is_integer_helper */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_number_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                      ecma_value_t this_arg, /**< 'this' argument value */\n                                      const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                              *   passed to routine */\n                                      uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (this_arg, arguments_number);\n\n  if (!ecma_is_value_number (arguments_list_p[0]))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_number_t num = ecma_get_number_from_value (arguments_list_p[0]);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_NUMBER_OBJECT_ROUTINE_IS_FINITE:\n    {\n      return ecma_make_boolean_value (!(ecma_number_is_nan (num) || ecma_number_is_infinity (num)));\n    }\n    case ECMA_NUMBER_OBJECT_ROUTINE_IS_NAN:\n    {\n      return ecma_make_boolean_value (ecma_number_is_nan (num));\n    }\n    case ECMA_NUMBER_OBJECT_ROUTINE_IS_INTEGER:\n    case ECMA_NUMBER_OBJECT_ROUTINE_IS_SAFE_INTEGER:\n    {\n      bool is_safe = (builtin_routine_id == ECMA_NUMBER_OBJECT_ROUTINE_IS_SAFE_INTEGER);\n      return ecma_builtin_number_object_is_integer_helper (arguments_list_p[0], num, is_safe);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_number_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_NUMBER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-number.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Number built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_NUMBER\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* ECMA-262 v5, 15.7.3.4 */\nNUMBER_VALUE (LIT_MAGIC_STRING_NAN, ECMA_BUILTIN_NUMBER_NAN, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.7.3.2 */\nNUMBER_VALUE (LIT_MAGIC_STRING_MAX_VALUE_U, ECMA_BUILTIN_NUMBER_MAX, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.7.3.3 */\nNUMBER_VALUE (LIT_MAGIC_STRING_MIN_VALUE_U, ECMA_BUILTIN_NUMBER_MIN, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.7.3.5 */\nNUMBER_VALUE (LIT_MAGIC_STRING_POSITIVE_INFINITY_U, ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v5, 15.7.3.6 */\nNUMBER_VALUE (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U, ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v6, 20.1.2.1 */\nNUMBER_VALUE (LIT_MAGIC_STRING_EPSILON_U, ECMA_BUILTIN_NUMBER_EPSILON, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v6, 20.1.2.6 */\nNUMBER_VALUE (LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U, ECMA_BUILTIN_NUMBER_MAX_SAFE_INTEGER, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v6, 20.1.2.8 */\nNUMBER_VALUE (LIT_MAGIC_STRING_MIN_SAFE_INTEGER_U, ECMA_BUILTIN_NUMBER_MIN_SAFE_INTEGER, ECMA_PROPERTY_FIXED)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_NUMBER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.7.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n#endif /* JERRY_BUILTIN_NUMBER */\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_IS_FINITE, ECMA_NUMBER_OBJECT_ROUTINE_IS_FINITE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_IS_NAN, ECMA_NUMBER_OBJECT_ROUTINE_IS_NAN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_IS_INTEGER, ECMA_NUMBER_OBJECT_ROUTINE_IS_INTEGER, 1, 1)\nROUTINE (LIT_MAGIC_STRING_IS_SAFE_INTEGER, ECMA_NUMBER_OBJECT_ROUTINE_IS_SAFE_INTEGER, 1, 1)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_PARSE_FLOAT, LIT_MAGIC_STRING_PARSE_FLOAT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_PARSE_INT, LIT_MAGIC_STRING_PARSE_INT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtin-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-proxy-object.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jrt.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  /* Note: these 6 routines must be in this order */\n  ECMA_OBJECT_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_OBJECT_PROTOTYPE_TO_STRING,\n  ECMA_OBJECT_PROTOTYPE_VALUE_OF,\n  ECMA_OBJECT_PROTOTYPE_TO_LOCALE_STRING,\n  ECMA_OBJECT_PROTOTYPE_GET_PROTO,\n  ECMA_OBJECT_PROTOTYPE_IS_PROTOTYPE_OF,\n  ECMA_OBJECT_PROTOTYPE_HAS_OWN_PROPERTY,\n  ECMA_OBJECT_PROTOTYPE_PROPERTY_IS_ENUMERABLE,\n  ECMA_OBJECT_PROTOTYPE_SET_PROTO,\n#if JERRY_BUILTIN_ANNEXB\n  ECMA_OBJECT_PROTOTYPE_DEFINE_GETTER,\n  ECMA_OBJECT_PROTOTYPE_DEFINE_SETTER,\n  ECMA_OBJECT_PROTOTYPE_LOOKUP_GETTER,\n  ECMA_OBJECT_PROTOTYPE_LOOKUP_SETTER,\n#endif /* JERRY_BUILTIN_ANNEXB */\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-object-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  object_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup objectprototype ECMA Object.prototype object built-in\n * @{\n */\n\n/**\n * The Object.prototype object's 'toString' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.4.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_prototype_object_to_string (ecma_value_t this_arg) /**< this argument */\n{\n  return ecma_builtin_helper_object_to_string (this_arg);\n} /* ecma_builtin_object_prototype_object_to_string */\n\n/**\n * The Object.prototype object's 'valueOf' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.4.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_prototype_object_value_of (ecma_value_t this_arg) /**< this argument */\n{\n  return ecma_op_to_object (this_arg);\n} /* ecma_builtin_object_prototype_object_value_of */\n\n/**\n * The Object.prototype object's 'toLocaleString' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_prototype_object_to_locale_string (ecma_value_t this_arg) /**< this argument */\n{\n  return ecma_op_invoke_by_magic_id (this_arg, LIT_MAGIC_STRING_TO_STRING_UL, &this_arg, 1);\n} /* ecma_builtin_object_prototype_object_to_locale_string */\n\n/**\n * The Object.prototype object's 'hasOwnProperty' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.4.5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_prototype_object_has_own_property (ecma_object_t *obj_p, /**< this argument */\n                                                       ecma_string_t *prop_name_p) /**< first argument */\n{\n  return ecma_op_object_has_own_property (obj_p, prop_name_p);\n} /* ecma_builtin_object_prototype_object_has_own_property */\n\n/**\n * The Object.prototype object's 'isPrototypeOf' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.4.6\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_prototype_object_is_prototype_of (ecma_object_t *obj_p, /**< this argument */\n                                                      ecma_value_t arg) /**< routine's first argument */\n{\n  /* 3. Compare prototype to object */\n  ecma_value_t v_obj_value = ecma_op_to_object (arg);\n\n  if (ECMA_IS_VALUE_ERROR (v_obj_value))\n  {\n    return v_obj_value;\n  }\n\n  ecma_object_t *v_obj_p = ecma_get_object_from_value (v_obj_value);\n\n  ecma_value_t ret_value = ecma_op_object_is_prototype_of (obj_p, v_obj_p);\n\n  ecma_deref_object (v_obj_p);\n\n  return ret_value;\n} /* ecma_builtin_object_prototype_object_is_prototype_of */\n\n/**\n * The Object.prototype object's 'propertyIsEnumerable' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.4.7\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_prototype_object_property_is_enumerable (ecma_object_t *obj_p, /**< this argument */\n                                                             ecma_string_t *prop_name_p) /**< first argument */\n{\n  ecma_property_descriptor_t prop_desc;\n  ecma_value_t status = ecma_op_object_get_own_property_descriptor (obj_p, prop_name_p, &prop_desc);\n\n  if (!ecma_is_value_true (status))\n  {\n    return status;\n  }\n\n  bool is_enumerable = (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE);\n\n  ecma_free_property_descriptor (&prop_desc);\n\n  return ecma_make_boolean_value (is_enumerable);\n} /* ecma_builtin_object_prototype_object_property_is_enumerable */\n\n#if JERRY_BUILTIN_ANNEXB\n/**\n * The Object.prototype object's '__defineGetter__' and '__defineSetter__' routine\n *\n * See also:\n *          ECMA-262 v11, B.2.2.2\n *          ECMA-262 v11, B.2.2.3\n *\n * @return ECMA_VALUE_ERROR - if the operation fails,\n *         ECMA_VALUE_UNDEFINED - otherwise\n */\nstatic ecma_value_t\necma_builtin_object_prototype_define_getter_setter (ecma_value_t this_arg, /**< this argument */\n                                                    ecma_value_t prop, /**< property */\n                                                    ecma_value_t accessor, /**< getter/setter function */\n                                                    bool define_getter) /**< true - defineGetter method\n                                                                             false - defineSetter method */\n{\n  /* 1. */\n  ecma_value_t to_obj = ecma_op_to_object (this_arg);\n\n  if (ECMA_IS_VALUE_ERROR (to_obj))\n  {\n    return to_obj;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (to_obj);\n\n  /* 2. */\n  if (!ecma_op_is_callable (accessor))\n  {\n    ecma_deref_object (obj_p);\n    return ecma_raise_type_error (ECMA_ERR_GETTER_IS_NOT_CALLABLE);\n  }\n\n  ecma_object_t *accessor_obj_p = ecma_get_object_from_value (accessor);\n\n  /* 3. */\n  ecma_property_descriptor_t desc = ecma_make_empty_property_descriptor ();\n  desc.flags |= (JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_ENUMERABLE_DEFINED\n                 | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_SHOULD_THROW);\n\n  if (define_getter)\n  {\n    desc.get_p = accessor_obj_p;\n    desc.flags |= JERRY_PROP_IS_GET_DEFINED;\n  }\n  else\n  {\n    desc.set_p = accessor_obj_p;\n    desc.flags |= JERRY_PROP_IS_SET_DEFINED;\n  }\n\n  /* 4. */\n  ecma_string_t *prop_name_p = ecma_op_to_property_key (prop);\n\n  if (JERRY_UNLIKELY (prop_name_p == NULL))\n  {\n    ecma_deref_object (obj_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 5. */\n  ecma_value_t define_prop = ecma_op_object_define_own_property (obj_p, prop_name_p, &desc);\n\n  ecma_deref_object (obj_p);\n  ecma_deref_ecma_string (prop_name_p);\n\n  if (ECMA_IS_VALUE_ERROR (define_prop))\n  {\n    return define_prop;\n  }\n\n  /* 6. */\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_builtin_object_prototype_define_getter_setter */\n\n/**\n * The Object.prototype object's '__lookupGetter__' and '__lookupSetter__' routine\n *\n * See also:\n *          ECMA-262 v11, B.2.2.4\n *          ECMA-262 v11, B.2.2.5\n *\n * @return ECMA_VALUE_ERROR - if the operation fails,\n *         ECMA_VALUE_UNDEFINED - if the property was not found\n *         Accessor property - otherwise\n */\nstatic ecma_value_t\necma_builtin_object_prototype_lookup_getter_setter (ecma_value_t this_arg, /**< this argument */\n                                                    ecma_value_t prop, /**< property */\n                                                    bool lookup_getter) /**< true - lookupGetter method\n                                                                             false - lookupSetter method */\n{\n  /* 1. */\n  ecma_value_t to_obj = ecma_op_to_object (this_arg);\n\n  if (ECMA_IS_VALUE_ERROR (to_obj))\n  {\n    return to_obj;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (to_obj);\n\n  /* 2. */\n  ecma_string_t *prop_name_p = ecma_op_to_property_key (prop);\n\n  if (JERRY_UNLIKELY (prop_name_p == NULL))\n  {\n    ecma_deref_object (obj_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t ret_value = ECMA_VALUE_UNDEFINED;\n\n  ecma_ref_object (obj_p);\n\n  /* 3. */\n  while (true)\n  {\n    /* 3.a */\n    ecma_property_descriptor_t desc;\n    ecma_value_t get_desc = ecma_op_object_get_own_property_descriptor (obj_p, prop_name_p, &desc);\n\n    if (ECMA_IS_VALUE_ERROR (get_desc))\n    {\n      ret_value = get_desc;\n      ecma_deref_object (obj_p);\n      break;\n    }\n\n    /* 3.b */\n    if (ecma_is_value_true (get_desc))\n    {\n      if ((desc.flags & JERRY_PROP_IS_SET_DEFINED) || (desc.flags & JERRY_PROP_IS_GET_DEFINED))\n      {\n        if (lookup_getter && desc.get_p != NULL)\n        {\n          ecma_ref_object (desc.get_p);\n          ret_value = ecma_make_object_value (desc.get_p);\n        }\n        else if (!lookup_getter && desc.set_p != NULL)\n        {\n          ecma_ref_object (desc.set_p);\n          ret_value = ecma_make_object_value (desc.set_p);\n        }\n      }\n\n      ecma_free_property_descriptor (&desc);\n      ecma_deref_object (obj_p);\n      break;\n    }\n\n    /* 3.c */\n    ecma_object_t *proto_p = ecma_op_object_get_prototype_of (obj_p);\n    ecma_deref_object (obj_p);\n\n    if (proto_p == NULL)\n    {\n      break;\n    }\n    else if (JERRY_UNLIKELY (proto_p == ECMA_OBJECT_POINTER_ERROR))\n    {\n      ret_value = ECMA_VALUE_ERROR;\n      break;\n    }\n\n    /* Advance up on prototype chain. */\n    obj_p = proto_p;\n  }\n\n  ecma_free_value (to_obj);\n  ecma_deref_ecma_string (prop_name_p);\n\n  return ret_value;\n} /* ecma_builtin_object_prototype_lookup_getter_setter */\n#endif /* JERRY_BUILTIN_ANNEXB */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_object_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine\n                                                                             *   identifier */\n                                                ecma_value_t this_arg, /**< 'this' argument value */\n                                                const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                        *   passed to routine */\n                                                uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n\n  /* no specialization */\n  if (builtin_routine_id <= ECMA_OBJECT_PROTOTYPE_VALUE_OF)\n  {\n    if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_TO_STRING)\n    {\n      return ecma_builtin_object_prototype_object_to_string (this_arg);\n    }\n\n    JERRY_ASSERT (builtin_routine_id <= ECMA_OBJECT_PROTOTYPE_VALUE_OF);\n\n    return ecma_builtin_object_prototype_object_value_of (this_arg);\n  }\n\n  if (builtin_routine_id <= ECMA_OBJECT_PROTOTYPE_IS_PROTOTYPE_OF)\n  {\n    if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_IS_PROTOTYPE_OF)\n    {\n      /* 15.2.4.6.1. */\n      if (!ecma_is_value_object (arguments_list_p[0]))\n      {\n        return ECMA_VALUE_FALSE;\n      }\n    }\n\n    if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_TO_LOCALE_STRING)\n    {\n      return ecma_builtin_object_prototype_object_to_locale_string (this_arg);\n    }\n\n    ecma_value_t to_object = ecma_op_to_object (this_arg);\n\n    if (ECMA_IS_VALUE_ERROR (to_object))\n    {\n      return to_object;\n    }\n\n    ecma_object_t *obj_p = ecma_get_object_from_value (to_object);\n\n    ecma_value_t ret_value;\n\n    if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_GET_PROTO)\n    {\n      ret_value = ecma_builtin_object_object_get_prototype_of (obj_p);\n    }\n    else\n    {\n      ret_value = ecma_builtin_object_prototype_object_is_prototype_of (obj_p, arguments_list_p[0]);\n    }\n\n    ecma_deref_object (obj_p);\n\n    return ret_value;\n  }\n\n  JERRY_ASSERT (builtin_routine_id >= ECMA_OBJECT_PROTOTYPE_HAS_OWN_PROPERTY);\n\n  if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_SET_PROTO)\n  {\n    return ecma_builtin_object_object_set_proto (this_arg, arguments_list_p[0]);\n  }\n#if JERRY_BUILTIN_ANNEXB\n  else if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_LOOKUP_GETTER)\n  {\n    return ecma_builtin_object_prototype_lookup_getter_setter (this_arg, arguments_list_p[0], true);\n  }\n  else if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_LOOKUP_SETTER)\n  {\n    return ecma_builtin_object_prototype_lookup_getter_setter (this_arg, arguments_list_p[0], false);\n  }\n  else if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_DEFINE_GETTER)\n  {\n    return ecma_builtin_object_prototype_define_getter_setter (this_arg,\n                                                               arguments_list_p[0],\n                                                               arguments_list_p[1],\n                                                               true);\n  }\n  else if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_DEFINE_SETTER)\n  {\n    return ecma_builtin_object_prototype_define_getter_setter (this_arg,\n                                                               arguments_list_p[0],\n                                                               arguments_list_p[1],\n                                                               false);\n  }\n#endif /* JERRY_BUILTIN_ANNEXB */\n\n  ecma_string_t *prop_name_p = ecma_op_to_property_key (arguments_list_p[0]);\n\n  if (prop_name_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t to_object = ecma_op_to_object (this_arg);\n\n  if (ECMA_IS_VALUE_ERROR (to_object))\n  {\n    ecma_deref_ecma_string (prop_name_p);\n    return to_object;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (to_object);\n\n  ecma_value_t ret_value;\n\n  if (builtin_routine_id == ECMA_OBJECT_PROTOTYPE_HAS_OWN_PROPERTY)\n  {\n    ret_value = ecma_builtin_object_prototype_object_has_own_property (obj_p, prop_name_p);\n  }\n  else\n  {\n    ret_value = ecma_builtin_object_prototype_object_property_is_enumerable (obj_p, prop_name_p);\n  }\n\n  ecma_deref_ecma_string (prop_name_p);\n  ecma_deref_object (obj_p);\n\n  return ret_value;\n} /* ecma_builtin_object_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Object.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.2.4.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_OBJECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nACCESSOR_READ_WRITE (LIT_MAGIC_STRING__PROTO__,\n                     ECMA_OBJECT_PROTOTYPE_GET_PROTO,\n                     ECMA_OBJECT_PROTOTYPE_SET_PROTO,\n                     ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_OBJECT_PROTOTYPE_TO_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_OBJECT_PROTOTYPE_VALUE_OF, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_OBJECT_PROTOTYPE_TO_LOCALE_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_HAS_OWN_PROPERTY_UL, ECMA_OBJECT_PROTOTYPE_HAS_OWN_PROPERTY, 1, 1)\nROUTINE (LIT_MAGIC_STRING_IS_PROTOTYPE_OF_UL, ECMA_OBJECT_PROTOTYPE_IS_PROTOTYPE_OF, 1, 1)\nROUTINE (LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL, ECMA_OBJECT_PROTOTYPE_PROPERTY_IS_ENUMERABLE, 1, 1)\n\n#if JERRY_BUILTIN_ANNEXB\nROUTINE (LIT_MAGIC_STRING_DEFINE_GETTER, ECMA_OBJECT_PROTOTYPE_DEFINE_GETTER, 2, 2)\nROUTINE (LIT_MAGIC_STRING_DEFINE_SETTER, ECMA_OBJECT_PROTOTYPE_DEFINE_SETTER, 2, 2)\nROUTINE (LIT_MAGIC_STRING_LOOKUP_GETTER, ECMA_OBJECT_PROTOTYPE_LOOKUP_GETTER, 1, 1)\nROUTINE (LIT_MAGIC_STRING_LOOKUP_SETTER, ECMA_OBJECT_PROTOTYPE_LOOKUP_SETTER, 1, 1)\n#endif /* JERRY_BUILTIN_ANNEXB*/\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-proxy-object.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_OBJECT_ROUTINE_START = 0,\n\n  ECMA_OBJECT_ROUTINE_CREATE,\n  ECMA_OBJECT_ROUTINE_IS,\n  ECMA_OBJECT_ROUTINE_SET_PROTOTYPE_OF,\n\n  /* These should be in this order. */\n  ECMA_OBJECT_ROUTINE_DEFINE_PROPERTY,\n  ECMA_OBJECT_ROUTINE_DEFINE_PROPERTIES,\n\n  /* These should be in this order. */\n  ECMA_OBJECT_ROUTINE_ASSIGN,\n  ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_DESCRIPTOR,\n  ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_DESCRIPTORS,\n  ECMA_OBJECT_ROUTINE_HAS_OWN,\n  ECMA_OBJECT_ROUTINE_GET_PROTOTYPE_OF,\n  ECMA_OBJECT_ROUTINE_FROM_ENTRIES,\n  ECMA_OBJECT_ROUTINE_KEYS,\n  ECMA_OBJECT_ROUTINE_VALUES,\n  ECMA_OBJECT_ROUTINE_ENTRIES,\n\n  /* These should be in this order. */\n  ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_NAMES,\n  ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_SYMBOLS,\n\n  /* These should be in this order. */\n  ECMA_OBJECT_ROUTINE_FREEZE,\n  ECMA_OBJECT_ROUTINE_PREVENT_EXTENSIONS,\n  ECMA_OBJECT_ROUTINE_SEAL,\n\n  /* These should be in this order. */\n  ECMA_OBJECT_ROUTINE_IS_EXTENSIBLE,\n  ECMA_OBJECT_ROUTINE_IS_FROZEN,\n  ECMA_OBJECT_ROUTINE_IS_SEALED,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-object.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  object\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup object ECMA Object object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in Object object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_object_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                   uint32_t arguments_list_len) /**< number of arguments */\n{\n  if (arguments_list_len == 0 || ecma_is_value_undefined (arguments_list_p[0])\n      || ecma_is_value_null (arguments_list_p[0]))\n  {\n    return ecma_make_object_value (ecma_op_create_object_object_noarg ());\n  }\n\n  return ecma_op_to_object (arguments_list_p[0]);\n} /* ecma_builtin_object_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Object object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_object_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                        uint32_t arguments_list_len) /**< number of arguments */\n{\n  if (JERRY_CONTEXT (current_new_target_p) != ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT))\n  {\n    ecma_object_t *prototype_obj_p =\n      ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n    if (JERRY_UNLIKELY (prototype_obj_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_object_t *object_p = ecma_create_object (prototype_obj_p, 0, ECMA_OBJECT_TYPE_GENERAL);\n    ecma_deref_object (prototype_obj_p);\n\n    return ecma_make_object_value (object_p);\n  }\n\n  return ecma_builtin_object_dispatch_call (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_object_dispatch_construct */\n\n/**\n * The Object object's 'getPrototypeOf' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.3.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_object_object_get_prototype_of (ecma_object_t *obj_p) /**< routine's argument */\n{\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    return ecma_proxy_object_get_prototype_of (obj_p);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  jmem_cpointer_t proto_cp = ecma_op_ordinary_object_get_prototype_of (obj_p);\n\n  if (proto_cp != JMEM_CP_NULL)\n  {\n    ecma_object_t *prototype_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, proto_cp);\n    ecma_ref_object (prototype_p);\n    return ecma_make_object_value (prototype_p);\n  }\n\n  return ECMA_VALUE_NULL;\n} /* ecma_builtin_object_object_get_prototype_of */\n\n/**\n * The Object object's 'setPrototypeOf' routine\n *\n * See also:\n *          ES2015 19.1.2.18\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_object_object_set_prototype_of (ecma_value_t arg1, /**< routine's first argument */\n                                             ecma_value_t arg2) /**< routine's second argument */\n{\n  /* 1., 2. */\n  if (!ecma_op_require_object_coercible (arg1))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 3. */\n  if (!ecma_is_value_object (arg2) && !ecma_is_value_null (arg2))\n  {\n    return ecma_raise_type_error (ECMA_ERR_PROTOTYPE_IS_NEITHER_OBJECT_NOR_NULL);\n  }\n\n  /* 4. */\n  if (!ecma_is_value_object (arg1))\n  {\n    return ecma_copy_value (arg1);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (arg1);\n  ecma_value_t status;\n\n  /* 5. */\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    status = ecma_proxy_object_set_prototype_of (obj_p, arg2);\n\n    if (ECMA_IS_VALUE_ERROR (status))\n    {\n      return status;\n    }\n  }\n  else\n  {\n#endif /* JERRY_BUILTIN_PROXY */\n    status = ecma_op_ordinary_object_set_prototype_of (obj_p, arg2);\n#if JERRY_BUILTIN_PROXY\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  if (ecma_is_value_false (status))\n  {\n    return ecma_raise_type_error (ECMA_ERR_SET_PROTOTYPE);\n  }\n\n  JERRY_ASSERT (ecma_is_value_true (status));\n  ecma_ref_object (obj_p);\n\n  return arg1;\n} /* ecma_builtin_object_object_set_prototype_of */\n\n/**\n * The Object object's set __proto__ routine\n *\n * See also:\n *          ECMA-262 v6, B.2.2.1.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_object_object_set_proto (ecma_value_t arg1, /**< routine's first argument */\n                                      ecma_value_t arg2) /**< routine's second argument */\n{\n  /* 1., 2. */\n  if (!ecma_op_require_object_coercible (arg1))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 3. */\n  if (!ecma_is_value_object (arg2) && !ecma_is_value_null (arg2))\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  /* 4. */\n  if (!ecma_is_value_object (arg1))\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (arg1);\n  ecma_value_t status;\n\n  /* 5. */\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    status = ecma_proxy_object_set_prototype_of (obj_p, arg2);\n\n    if (ECMA_IS_VALUE_ERROR (status))\n    {\n      return status;\n    }\n  }\n  else\n  {\n#endif /* JERRY_BUILTIN_PROXY */\n    status = ecma_op_ordinary_object_set_prototype_of (obj_p, arg2);\n#if JERRY_BUILTIN_PROXY\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  if (ecma_is_value_false (status))\n  {\n    return ecma_raise_type_error (ECMA_ERR_SET_PROTOTYPE);\n  }\n\n  JERRY_ASSERT (ecma_is_value_true (status));\n\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_builtin_object_object_set_proto */\n\n/**\n * SetIntegrityLevel operation\n *\n * See also:\n *          ECMA-262 v6, 7.3.14\n *\n * @return ECMA_VALUE_ERROR - if the operation raised an error\n *         ECMA_VALUE_{TRUE/FALSE} - depends on whether the integrity level has been set successfully\n */\nstatic ecma_value_t\necma_builtin_object_set_integrity_level (ecma_object_t *obj_p, /**< object */\n                                         bool is_seal) /**< true - set \"sealed\"\n                                                        *   false - set \"frozen\" */\n{\n  /* 3. */\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    ecma_value_t status = ecma_proxy_object_prevent_extensions (obj_p);\n\n    if (!ecma_is_value_true (status))\n    {\n      return status;\n    }\n  }\n  else\n#endif /* JERRY_BUILTIN_PROXY */\n  {\n    ecma_op_ordinary_object_prevent_extensions (obj_p);\n  }\n\n  /* 6. */\n  ecma_collection_t *props_p = ecma_op_object_own_property_keys (obj_p, JERRY_PROPERTY_FILTER_ALL);\n\n#if JERRY_BUILTIN_PROXY\n  if (props_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_value_t *buffer_p = props_p->buffer_p;\n\n  if (is_seal)\n  {\n    /* 8.a */\n    for (uint32_t i = 0; i < props_p->item_count; i++)\n    {\n      ecma_string_t *property_name_p = ecma_get_prop_name_from_value (buffer_p[i]);\n\n      ecma_property_descriptor_t prop_desc;\n      ecma_value_t status = ecma_op_object_get_own_property_descriptor (obj_p, property_name_p, &prop_desc);\n\n#if JERRY_BUILTIN_PROXY\n      if (ECMA_IS_VALUE_ERROR (status))\n      {\n        ecma_collection_free (props_p);\n        return ECMA_VALUE_ERROR;\n      }\n#endif /* JERRY_BUILTIN_PROXY */\n\n      if (ecma_is_value_false (status))\n      {\n        continue;\n      }\n\n      prop_desc.flags &= (uint16_t) ~JERRY_PROP_IS_CONFIGURABLE;\n      prop_desc.flags |= JERRY_PROP_SHOULD_THROW;\n\n      /* 8.a.i */\n      ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, property_name_p, &prop_desc);\n\n      ecma_free_property_descriptor (&prop_desc);\n\n      /* 8.a.ii */\n      if (ECMA_IS_VALUE_ERROR (define_own_prop_ret))\n      {\n        ecma_collection_free (props_p);\n        return define_own_prop_ret;\n      }\n\n      ecma_free_value (define_own_prop_ret);\n    }\n  }\n  else\n  {\n    /* 9.a */\n    for (uint32_t i = 0; i < props_p->item_count; i++)\n    {\n      ecma_string_t *property_name_p = ecma_get_prop_name_from_value (buffer_p[i]);\n\n      /* 9.1 */\n      ecma_property_descriptor_t prop_desc;\n      ecma_value_t status = ecma_op_object_get_own_property_descriptor (obj_p, property_name_p, &prop_desc);\n\n#if JERRY_BUILTIN_PROXY\n      if (ECMA_IS_VALUE_ERROR (status))\n      {\n        ecma_collection_free (props_p);\n        return ECMA_VALUE_ERROR;\n      }\n#endif /* JERRY_BUILTIN_PROXY */\n\n      if (ecma_is_value_false (status))\n      {\n        continue;\n      }\n\n      /* 9.2 */\n      if ((prop_desc.flags & (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE))\n          == (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE))\n      {\n        prop_desc.flags &= (uint16_t) ~JERRY_PROP_IS_WRITABLE;\n      }\n\n      prop_desc.flags &= (uint16_t) ~JERRY_PROP_IS_CONFIGURABLE;\n      prop_desc.flags |= JERRY_PROP_SHOULD_THROW;\n\n      /* 9.3 */\n      ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, property_name_p, &prop_desc);\n\n      ecma_free_property_descriptor (&prop_desc);\n\n      /* 9.4 */\n      if (ECMA_IS_VALUE_ERROR (define_own_prop_ret))\n      {\n        ecma_collection_free (props_p);\n        return define_own_prop_ret;\n      }\n\n      ecma_free_value (define_own_prop_ret);\n    }\n  }\n\n  ecma_collection_free (props_p);\n\n  return ECMA_VALUE_TRUE;\n} /* ecma_builtin_object_set_integrity_level */\n\n/**\n * The Object object's 'seal' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.3.8\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_object_seal (ecma_object_t *obj_p) /**< routine's argument */\n{\n  ecma_value_t status = ecma_builtin_object_set_integrity_level (obj_p, true);\n\n  if (ECMA_IS_VALUE_ERROR (status))\n  {\n    return status;\n  }\n\n#if JERRY_BUILTIN_PROXY\n  if (ecma_is_value_false (status))\n  {\n    return ecma_raise_type_error (ECMA_ERR_OBJECT_CANNOT_BE_SEALED);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  /* 4. */\n  ecma_ref_object (obj_p);\n  return ecma_make_object_value (obj_p);\n} /* ecma_builtin_object_object_seal */\n\n/**\n * The Object object's 'freeze' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.3.9\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_object_freeze (ecma_object_t *obj_p) /**< routine's argument */\n{\n  ecma_value_t status = ecma_builtin_object_set_integrity_level (obj_p, false);\n\n  if (ECMA_IS_VALUE_ERROR (status))\n  {\n    return status;\n  }\n\n#if JERRY_BUILTIN_PROXY\n  if (ecma_is_value_false (status))\n  {\n    return ecma_raise_type_error (ECMA_ERR_OBJECT_CANNOT_BE_FROZEN);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  /* 4. */\n  ecma_ref_object (obj_p);\n  return ecma_make_object_value (obj_p);\n} /* ecma_builtin_object_object_freeze */\n\n/**\n * The Object object's 'preventExtensions' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.3.10\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_object_object_prevent_extensions (ecma_object_t *obj_p) /**< routine's argument */\n{\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    ecma_value_t status = ecma_proxy_object_prevent_extensions (obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (status))\n    {\n      return status;\n    }\n\n    if (ecma_is_value_false (status))\n    {\n      return ecma_raise_type_error (ECMA_ERR_SET_EXTENSIBLE_PROPERTY);\n    }\n\n    JERRY_ASSERT (ecma_is_value_true (status));\n  }\n  else\n  {\n#endif /* JERRY_BUILTIN_PROXY */\n    ecma_op_ordinary_object_prevent_extensions (obj_p);\n#if JERRY_BUILTIN_PROXY\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n  ecma_ref_object (obj_p);\n\n  return ecma_make_object_value (obj_p);\n} /* ecma_builtin_object_object_prevent_extensions */\n\n/**\n * The Object object's 'isSealed' and 'isFrozen' routines\n *\n * See also:\n *         ECMA-262 v5, 15.2.3.11\n *         ECMA-262 v5, 15.2.3.12\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_test_integrity_level (ecma_object_t *obj_p, /**< routine's argument */\n                                          int mode) /**< routine mode */\n{\n  JERRY_ASSERT (mode == ECMA_OBJECT_ROUTINE_IS_FROZEN || mode == ECMA_OBJECT_ROUTINE_IS_SEALED);\n\n  /* 3. */\n  bool is_extensible;\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    ecma_value_t status = ecma_proxy_object_is_extensible (obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (status))\n    {\n      return status;\n    }\n\n    is_extensible = ecma_is_value_true (status);\n  }\n  else\n#endif /* JERRY_BUILTIN_PROXY */\n  {\n    is_extensible = ecma_op_ordinary_object_is_extensible (obj_p);\n  }\n\n  if (is_extensible)\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  /* the value can be updated in the loop below */\n  ecma_value_t ret_value = ECMA_VALUE_TRUE;\n\n  /* 2. */\n  ecma_collection_t *props_p = ecma_op_object_own_property_keys (obj_p, JERRY_PROPERTY_FILTER_ALL);\n\n#if JERRY_BUILTIN_PROXY\n  if (props_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_value_t *buffer_p = props_p->buffer_p;\n\n  for (uint32_t i = 0; i < props_p->item_count; i++)\n  {\n    ecma_string_t *property_name_p = ecma_get_prop_name_from_value (buffer_p[i]);\n\n    /* 2.a */\n    ecma_property_descriptor_t prop_desc;\n    ecma_value_t status = ecma_op_object_get_own_property_descriptor (obj_p, property_name_p, &prop_desc);\n\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_IS_VALUE_ERROR (status))\n    {\n      ret_value = status;\n      break;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    if (ecma_is_value_false (status))\n    {\n      continue;\n    }\n\n    bool is_writable_data = ((prop_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE))\n                             == (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE));\n    bool is_configurable = (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE);\n\n    ecma_free_property_descriptor (&prop_desc);\n\n    /* 2.b for isFrozen */\n    /* 2.b for isSealed, 2.c for isFrozen */\n    if ((mode == ECMA_OBJECT_ROUTINE_IS_FROZEN && is_writable_data) || is_configurable)\n    {\n      ret_value = ECMA_VALUE_FALSE;\n      break;\n    }\n  }\n\n  ecma_collection_free (props_p);\n\n  return ret_value;\n} /* ecma_builtin_object_test_integrity_level */\n\n/**\n * The Object object's 'isExtensible' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.3.13\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_object_object_is_extensible (ecma_object_t *obj_p) /**< routine's argument */\n{\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    return ecma_proxy_object_is_extensible (obj_p);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  return ecma_make_boolean_value (ecma_op_ordinary_object_is_extensible (obj_p));\n} /* ecma_builtin_object_object_is_extensible */\n\n/**\n * Common implementation of the Object object's 'keys', 'values', 'entries' routines\n *\n * See also:\n *          ECMA-262 v11, 19.1.2.17\n *          ECMA-262 v11, 19.1.2.22\n *          ECMA-262 v11, 19.1.2.5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_object_keys_values_helper (ecma_object_t *obj_p, /**< routine's first argument */\n                                               ecma_enumerable_property_names_options_t option) /**< listing option */\n{\n  /* 2. */\n  ecma_collection_t *props_p = ecma_op_object_get_enumerable_property_names (obj_p, option);\n\n  if (props_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 3. */\n  return ecma_op_new_array_object_from_collection (props_p, option != ECMA_ENUMERABLE_PROPERTY_KEYS);\n} /* ecma_builtin_object_object_keys_values_helper */\n\n/**\n * The Object object's 'getOwnPropertyDescriptor' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.3.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_object_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< routine's first argument */\n                                                        ecma_string_t *name_str_p) /**< routine's second argument */\n{\n  /* 3. */\n  ecma_property_descriptor_t prop_desc;\n\n  ecma_value_t status = ecma_op_object_get_own_property_descriptor (obj_p, name_str_p, &prop_desc);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_IS_VALUE_ERROR (status))\n  {\n    return status;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  if (ecma_is_value_true (status))\n  {\n    /* 4. */\n    ecma_object_t *desc_obj_p = ecma_op_from_property_descriptor (&prop_desc);\n\n    ecma_free_property_descriptor (&prop_desc);\n\n    return ecma_make_object_value (desc_obj_p);\n  }\n\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_builtin_object_object_get_own_property_descriptor */\n\n/**\n * The Object object's 'getOwnPropertyDescriptors' routine\n *\n * See also:\n *          ECMA-262 v11, 19.1.2.9\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_object_get_own_property_descriptors (ecma_object_t *obj_p) /**< routine's first argument */\n{\n  /* 2 */\n  ecma_collection_t *prop_names_p = ecma_op_object_own_property_keys (obj_p, JERRY_PROPERTY_FILTER_ALL);\n\n#if JERRY_BUILTIN_PROXY\n  if (prop_names_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_value_t *names_buffer_p = prop_names_p->buffer_p;\n\n  /* 3 */\n  ecma_object_t *object_prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n  ecma_object_t *descriptors_p = ecma_create_object (object_prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL);\n\n  /* 4 */\n  for (uint32_t i = 0; i < prop_names_p->item_count; i++)\n  {\n    ecma_string_t *property_name_p = ecma_get_prop_name_from_value (names_buffer_p[i]);\n\n    /* 4.a */\n    ecma_property_descriptor_t prop_desc;\n    ecma_value_t status = ecma_op_object_get_own_property_descriptor (obj_p, property_name_p, &prop_desc);\n\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_IS_VALUE_ERROR (status))\n    {\n      ecma_deref_object (descriptors_p);\n      ecma_collection_free (prop_names_p);\n\n      return status;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    if (ecma_is_value_true (status))\n    {\n      /* 4.b */\n      ecma_object_t *desc_obj_p = ecma_op_from_property_descriptor (&prop_desc);\n      /* 4.c */\n      ecma_property_value_t *value_p = ecma_create_named_data_property (descriptors_p,\n                                                                        property_name_p,\n                                                                        ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                                        NULL);\n      value_p->value = ecma_make_object_value (desc_obj_p);\n\n      ecma_deref_object (desc_obj_p);\n      ecma_free_property_descriptor (&prop_desc);\n    }\n  }\n\n  ecma_collection_free (prop_names_p);\n\n  return ecma_make_object_value (descriptors_p);\n} /* ecma_builtin_object_object_get_own_property_descriptors */\n\n/**\n * The Object object's 'defineProperties' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.3.7\n *          ECMA-262 v11, 19.1.2.3.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine's first argument */\n                                              ecma_value_t arg2) /**< routine's second argument */\n{\n  /* 2. */\n  ecma_value_t props = ecma_op_to_object (arg2);\n\n  if (ECMA_IS_VALUE_ERROR (props))\n  {\n    return props;\n  }\n\n  ecma_object_t *props_p = ecma_get_object_from_value (props);\n\n  /* 3. */\n  ecma_collection_t *prop_names_p = ecma_op_object_own_property_keys (props_p, JERRY_PROPERTY_FILTER_ALL);\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n\n#if JERRY_BUILTIN_PROXY\n  if (prop_names_p == NULL)\n  {\n    ecma_deref_object (props_p);\n    return ret_value;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_value_t *buffer_p = prop_names_p->buffer_p;\n\n  /* 4. */\n  JMEM_DEFINE_LOCAL_ARRAY (property_descriptors, prop_names_p->item_count, ecma_property_descriptor_t);\n  uint32_t property_descriptor_number = 0;\n  ecma_collection_t *enum_prop_names = ecma_new_collection ();\n\n  /* 5. */\n  for (uint32_t i = 0; i < prop_names_p->item_count; i++)\n  {\n    ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (buffer_p[i]);\n\n    ecma_property_descriptor_t prop_desc;\n    ecma_value_t get_desc = ecma_op_object_get_own_property_descriptor (props_p, prop_name_p, &prop_desc);\n\n    if (ECMA_IS_VALUE_ERROR (get_desc))\n    {\n      goto cleanup;\n    }\n\n    if (ecma_is_value_true (get_desc))\n    {\n      if (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE)\n      {\n        ecma_value_t desc_obj = ecma_op_object_get (props_p, prop_name_p);\n\n        if (ECMA_IS_VALUE_ERROR (desc_obj))\n        {\n          ecma_free_property_descriptor (&prop_desc);\n          goto cleanup;\n        }\n\n        ecma_value_t conv_result =\n          ecma_op_to_property_descriptor (desc_obj, &property_descriptors[property_descriptor_number]);\n\n        property_descriptors[property_descriptor_number].flags |= JERRY_PROP_SHOULD_THROW;\n\n        ecma_free_value (desc_obj);\n\n        if (ECMA_IS_VALUE_ERROR (conv_result))\n        {\n          ecma_free_property_descriptor (&prop_desc);\n          goto cleanup;\n        }\n\n        property_descriptor_number++;\n        ecma_free_value (conv_result);\n        ecma_ref_ecma_string (prop_name_p);\n        ecma_collection_push_back (enum_prop_names, buffer_p[i]);\n      }\n\n      ecma_free_property_descriptor (&prop_desc);\n    }\n  }\n\n  /* 6. */\n  for (uint32_t i = 0; i < enum_prop_names->item_count; i++)\n  {\n    ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (enum_prop_names->buffer_p[i]);\n\n    ecma_value_t define_own_prop_ret =\n      ecma_op_object_define_own_property (obj_p, prop_name_p, &property_descriptors[i]);\n    if (ECMA_IS_VALUE_ERROR (define_own_prop_ret))\n    {\n      goto cleanup;\n    }\n\n    ecma_free_value (define_own_prop_ret);\n  }\n\n  ecma_ref_object (obj_p);\n  ret_value = ecma_make_object_value (obj_p);\n\ncleanup:\n  /* Clean up. */\n  for (uint32_t index = 0; index < property_descriptor_number; index++)\n  {\n    ecma_free_property_descriptor (&property_descriptors[index]);\n  }\n\n  ecma_collection_free (enum_prop_names);\n\n  JMEM_FINALIZE_LOCAL_ARRAY (property_descriptors);\n\n  ecma_collection_free (prop_names_p);\n\n  ecma_deref_object (props_p);\n\n  return ret_value;\n} /* ecma_builtin_object_object_define_properties */\n\n/**\n * The Object object's 'create' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.3.5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_object_create (ecma_value_t arg1, /**< routine's first argument */\n                                   ecma_value_t arg2) /**< routine's second argument */\n{\n  /* 1. */\n  if (!ecma_is_value_object (arg1) && !ecma_is_value_null (arg1))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);\n  }\n\n  ecma_object_t *obj_p = NULL;\n\n  if (!ecma_is_value_null (arg1))\n  {\n    obj_p = ecma_get_object_from_value (arg1);\n  }\n  /* 2-3. */\n  ecma_object_t *result_obj_p = ecma_op_create_object_object_noarg_and_set_prototype (obj_p);\n\n  /* 4. */\n  if (!ecma_is_value_undefined (arg2))\n  {\n    ecma_value_t obj = ecma_builtin_object_object_define_properties (result_obj_p, arg2);\n\n    if (ECMA_IS_VALUE_ERROR (obj))\n    {\n      ecma_deref_object (result_obj_p);\n      return obj;\n    }\n\n    ecma_free_value (obj);\n  }\n\n  /* 5. */\n  return ecma_make_object_value (result_obj_p);\n} /* ecma_builtin_object_object_create */\n\n/**\n * The Object object's 'defineProperty' routine\n *\n * See also:\n *          ECMA-262 v5, 15.2.3.6\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_object_object_define_property (ecma_object_t *obj_p, /**< routine's first argument */\n                                            ecma_string_t *name_str_p, /**< routine's second argument */\n                                            ecma_value_t arg3) /**< routine's third argument */\n{\n  ecma_property_descriptor_t prop_desc;\n\n  ecma_value_t conv_result = ecma_op_to_property_descriptor (arg3, &prop_desc);\n\n  if (ECMA_IS_VALUE_ERROR (conv_result))\n  {\n    return conv_result;\n  }\n\n  prop_desc.flags |= JERRY_PROP_SHOULD_THROW;\n\n  ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, name_str_p, &prop_desc);\n\n  ecma_free_property_descriptor (&prop_desc);\n  ecma_free_value (conv_result);\n\n  if (ECMA_IS_VALUE_ERROR (define_own_prop_ret))\n  {\n    return define_own_prop_ret;\n  }\n\n  if (ecma_is_value_false (define_own_prop_ret))\n  {\n    return ecma_raise_type_error (ECMA_ERR_THE_REQUESTED_PROPERTY_UPDATE_CANNOT_BE_PERFORMED);\n  }\n\n  JERRY_ASSERT (ecma_is_value_true (define_own_prop_ret));\n\n  ecma_ref_object (obj_p);\n  ecma_free_value (define_own_prop_ret);\n\n  return ecma_make_object_value (obj_p);\n} /* ecma_builtin_object_object_define_property */\n\n/**\n * The Object object's 'assign' routine\n *\n * See also:\n *          ECMA-262 v6, 19.1.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_object_assign (ecma_object_t *target_p, /**< target object */\n                                   const ecma_value_t arguments_list_p[], /**< arguments list */\n                                   uint32_t arguments_list_len) /**< number of arguments */\n{\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  /* 4-5. */\n  for (uint32_t i = 0; i < arguments_list_len && ecma_is_value_empty (ret_value); i++)\n  {\n    ecma_value_t next_source = arguments_list_p[i];\n\n    /* 5.a */\n    if (ecma_is_value_undefined (next_source) || ecma_is_value_null (next_source))\n    {\n      continue;\n    }\n\n    /* 5.b.i */\n    ecma_value_t from_value = ecma_op_to_object (next_source);\n    /* null and undefied cases are handled above, so this must be a valid object */\n    JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (from_value));\n\n    ecma_object_t *from_obj_p = ecma_get_object_from_value (from_value);\n\n    /* 5.b.iii */\n    ecma_collection_t *props_p = ecma_op_object_own_property_keys (from_obj_p, JERRY_PROPERTY_FILTER_ALL);\n\n#if JERRY_BUILTIN_PROXY\n    if (props_p == NULL)\n    {\n      ecma_deref_object (from_obj_p);\n      return ECMA_VALUE_ERROR;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    ecma_value_t *buffer_p = props_p->buffer_p;\n\n    for (uint32_t j = 0; (j < props_p->item_count) && ecma_is_value_empty (ret_value); j++)\n    {\n      ecma_string_t *property_name_p = ecma_get_prop_name_from_value (buffer_p[j]);\n\n      /* 5.c.i-ii */\n      ecma_property_descriptor_t prop_desc;\n      ecma_value_t desc_status = ecma_op_object_get_own_property_descriptor (from_obj_p, property_name_p, &prop_desc);\n\n#if JERRY_BUILTIN_PROXY\n      if (ECMA_IS_VALUE_ERROR (desc_status))\n      {\n        ret_value = desc_status;\n        break;\n      }\n#endif /* JERRY_BUILTIN_PROXY */\n\n      if (ecma_is_value_false (desc_status))\n      {\n        continue;\n      }\n\n      /* 5.c.iii */\n      if (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE)\n      {\n        /* 5.c.iii.1 */\n        ecma_value_t prop_value = ecma_op_object_get (from_obj_p, property_name_p);\n\n        /* 5.c.iii.2 */\n        if (ECMA_IS_VALUE_ERROR (prop_value))\n        {\n          ret_value = prop_value;\n        }\n        else\n        {\n          /* 5.c.iii.3 */\n          ecma_value_t status = ecma_op_object_put (target_p, property_name_p, prop_value, true);\n\n          /* 5.c.iii.4 */\n          if (ECMA_IS_VALUE_ERROR (status))\n          {\n            ret_value = status;\n          }\n        }\n\n        ecma_free_value (prop_value);\n      }\n\n      ecma_free_property_descriptor (&prop_desc);\n    }\n\n    ecma_deref_object (from_obj_p);\n    ecma_collection_free (props_p);\n  }\n\n  /* 6. */\n  if (ecma_is_value_empty (ret_value))\n  {\n    ecma_ref_object (target_p);\n    return ecma_make_object_value (target_p);\n  }\n\n  return ret_value;\n} /* ecma_builtin_object_object_assign */\n\n/**\n * The Object object's 'is' routine\n *\n * See also:\n *          ECMA-262 v6, 19.1.2.10\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_object_is (ecma_value_t arg1, /**< routine's first argument */\n                               ecma_value_t arg2) /**< routine's second argument */\n{\n  return ecma_op_same_value (arg1, arg2) ? ECMA_VALUE_TRUE : ECMA_VALUE_FALSE;\n} /* ecma_builtin_object_object_is */\n\n/**\n * The Object object's 'fromEntries' routine\n *\n * See also:\n *          ECMA-262 v10, 19.1.2.7\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_object_from_entries (ecma_value_t iterator) /**< object's iterator */\n{\n  JERRY_ASSERT (ecma_op_require_object_coercible (iterator));\n  /* 2 */\n  ecma_object_t *object_prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n  ecma_object_t *obj_p = ecma_create_object (object_prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL);\n\n  /* 6.a */\n  ecma_value_t next_method;\n  ecma_value_t result = ecma_op_get_iterator (iterator, ECMA_VALUE_SYNC_ITERATOR, &next_method);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    ecma_deref_object (obj_p);\n    return result;\n  }\n\n  const ecma_value_t original_iterator = result;\n\n  /* 6.b */\n  while (true)\n  {\n    /* 6.a.i */\n    result = ecma_op_iterator_step (original_iterator, next_method);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_iterator;\n    }\n\n    /* 6.a.ii */\n    if (ecma_is_value_false (result))\n    {\n      break;\n    }\n\n    /* 6.a.iii */\n    const ecma_value_t next = result;\n    result = ecma_op_iterator_value (next);\n    ecma_free_value (next);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_iterator;\n    }\n\n    /* 6.a.iv */\n    if (!ecma_is_value_object (result))\n    {\n      ecma_free_value (result);\n      ecma_raise_type_error (ECMA_ERR_ITERATOR_VALUE_IS_NOT_AN_OBJECT);\n      result = ecma_op_iterator_close (original_iterator);\n      JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result));\n      goto cleanup_iterator;\n    }\n\n    /* 6.a.v-vi */\n    ecma_object_t *next_object_p = ecma_get_object_from_value (result);\n\n    result = ecma_op_object_get_by_index (next_object_p, 0);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      ecma_deref_object (next_object_p);\n      ecma_op_iterator_close (original_iterator);\n      goto cleanup_iterator;\n    }\n\n    const ecma_value_t key = result;\n\n    result = ecma_op_object_get_by_index (next_object_p, 1);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      ecma_deref_object (next_object_p);\n      ecma_free_value (key);\n      ecma_op_iterator_close (original_iterator);\n      goto cleanup_iterator;\n    }\n\n    /* 6.a.vii */\n    const ecma_value_t value = result;\n    ecma_string_t *property_key = ecma_op_to_property_key (key);\n\n    if (property_key == NULL)\n    {\n      ecma_deref_object (next_object_p);\n      ecma_free_value (key);\n      ecma_op_iterator_close (original_iterator);\n      result = ECMA_VALUE_ERROR;\n      goto cleanup_iterator;\n    }\n\n    ecma_property_t *property_p = ecma_find_named_property (obj_p, property_key);\n\n    if (property_p == NULL)\n    {\n      ecma_property_value_t *prop;\n      prop =\n        ecma_create_named_data_property (obj_p, property_key, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL);\n      prop->value = ecma_copy_value_if_not_object (value);\n    }\n    else\n    {\n      ecma_named_data_property_assign_value (obj_p, ECMA_PROPERTY_VALUE_PTR (property_p), value);\n    }\n\n    ecma_deref_ecma_string (property_key);\n    ecma_free_value (key);\n    ecma_free_value (value);\n    ecma_deref_object (next_object_p);\n  }\n\n  ecma_ref_object (obj_p);\n  result = ecma_make_object_value (obj_p);\n\ncleanup_iterator:\n  ecma_free_value (original_iterator);\n  ecma_free_value (next_method);\n  ecma_deref_object (obj_p);\n\n  return result;\n} /* ecma_builtin_object_from_entries */\n\n/**\n * GetOwnPropertyKeys abstract method\n *\n * See also:\n *          ECMA-262 v11, 19.1.2.11.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_op_object_get_own_property_keys (ecma_value_t this_arg, /**< this argument */\n                                      uint16_t type) /**< routine type */\n{\n  /* 1. */\n  ecma_value_t object = ecma_op_to_object (this_arg);\n\n  if (ECMA_IS_VALUE_ERROR (object))\n  {\n    return object;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (object);\n\n  /* 2. */\n  jerry_property_filter_t filter = JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS;\n\n  if (type == ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_SYMBOLS)\n  {\n    filter = (JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS | JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES);\n  }\n\n  ecma_collection_t *props_p = ecma_op_object_own_property_keys (obj_p, filter);\n\n  if (props_p == NULL)\n  {\n    ecma_deref_object (obj_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 3. */\n  ecma_collection_t *name_list_p = ecma_new_collection ();\n\n  /* 4. */\n  for (uint32_t i = 0; i < props_p->item_count; i++)\n  {\n    ecma_value_t prop_name = props_p->buffer_p[i];\n    ecma_string_t *name_p = ecma_get_prop_name_from_value (prop_name);\n\n    if ((ecma_prop_name_is_symbol (name_p) && type == ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_SYMBOLS)\n        || (ecma_is_value_string (prop_name) && type == ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_NAMES))\n    {\n      ecma_ref_ecma_string (name_p);\n      ecma_collection_push_back (name_list_p, prop_name);\n    }\n  }\n\n  ecma_value_t result_array = ecma_op_new_array_object_from_collection (name_list_p, false);\n\n  ecma_deref_object (obj_p);\n  ecma_collection_free (props_p);\n\n  return result_array;\n} /* ecma_op_object_get_own_property_keys */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                      ecma_value_t this_arg, /**< 'this' argument value */\n                                      const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                              *   passed to routine */\n                                      uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (this_arg, arguments_number);\n\n  ecma_value_t arg1 = arguments_list_p[0];\n  ecma_value_t arg2 = arguments_list_p[1];\n\n  /* No specialization for the arguments */\n  switch (builtin_routine_id)\n  {\n    case ECMA_OBJECT_ROUTINE_CREATE:\n    {\n      return ecma_builtin_object_object_create (arg1, arg2);\n    }\n    case ECMA_OBJECT_ROUTINE_SET_PROTOTYPE_OF:\n    {\n      return ecma_builtin_object_object_set_prototype_of (arg1, arg2);\n    }\n    case ECMA_OBJECT_ROUTINE_IS:\n    {\n      return ecma_builtin_object_object_is (arg1, arg2);\n    }\n    default:\n    {\n      break;\n    }\n  }\n\n  ecma_object_t *obj_p;\n\n  if (builtin_routine_id <= ECMA_OBJECT_ROUTINE_DEFINE_PROPERTIES)\n  {\n    if (!ecma_is_value_object (arg1))\n    {\n      return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);\n    }\n\n    obj_p = ecma_get_object_from_value (arg1);\n\n    if (builtin_routine_id == ECMA_OBJECT_ROUTINE_DEFINE_PROPERTY)\n    {\n      ecma_string_t *prop_name_p = ecma_op_to_property_key (arg2);\n\n      if (prop_name_p == NULL)\n      {\n        return ECMA_VALUE_ERROR;\n      }\n\n      ecma_value_t result = ecma_builtin_object_object_define_property (obj_p, prop_name_p, arguments_list_p[2]);\n\n      ecma_deref_ecma_string (prop_name_p);\n      return result;\n    }\n\n    JERRY_ASSERT (builtin_routine_id == ECMA_OBJECT_ROUTINE_DEFINE_PROPERTIES);\n    return ecma_builtin_object_object_define_properties (obj_p, arg2);\n  }\n  else if (builtin_routine_id <= ECMA_OBJECT_ROUTINE_ENTRIES)\n  {\n    ecma_value_t object = ecma_op_to_object (arg1);\n    if (ECMA_IS_VALUE_ERROR (object))\n    {\n      return object;\n    }\n\n    obj_p = ecma_get_object_from_value (object);\n\n    ecma_value_t result;\n    switch (builtin_routine_id)\n    {\n      case ECMA_OBJECT_ROUTINE_GET_PROTOTYPE_OF:\n      {\n        result = ecma_builtin_object_object_get_prototype_of (obj_p);\n        break;\n      }\n      case ECMA_OBJECT_ROUTINE_ASSIGN:\n      {\n        result = ecma_builtin_object_object_assign (obj_p, arguments_list_p + 1, arguments_number - 1);\n        break;\n      }\n      case ECMA_OBJECT_ROUTINE_ENTRIES:\n      case ECMA_OBJECT_ROUTINE_VALUES:\n      case ECMA_OBJECT_ROUTINE_KEYS:\n      {\n        JERRY_ASSERT (builtin_routine_id - ECMA_OBJECT_ROUTINE_KEYS < ECMA_ENUMERABLE_PROPERTY__COUNT);\n\n        const int option = builtin_routine_id - ECMA_OBJECT_ROUTINE_KEYS;\n        result =\n          ecma_builtin_object_object_keys_values_helper (obj_p, (ecma_enumerable_property_names_options_t) option);\n        break;\n      }\n      case ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_DESCRIPTOR:\n      {\n        ecma_string_t *prop_name_p = ecma_op_to_property_key (arg2);\n\n        if (prop_name_p == NULL)\n        {\n          result = ECMA_VALUE_ERROR;\n          break;\n        }\n\n        result = ecma_builtin_object_object_get_own_property_descriptor (obj_p, prop_name_p);\n        ecma_deref_ecma_string (prop_name_p);\n        break;\n      }\n      case ECMA_OBJECT_ROUTINE_HAS_OWN:\n      {\n        ecma_string_t *prop_name_p = ecma_op_to_property_key (arg2);\n\n        if (prop_name_p == NULL)\n        {\n          result = ECMA_VALUE_ERROR;\n          break;\n        }\n\n        result = ecma_op_object_has_own_property (obj_p, prop_name_p);\n        ecma_deref_ecma_string (prop_name_p);\n        break;\n      }\n      case ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_DESCRIPTORS:\n      {\n        result = ecma_builtin_object_object_get_own_property_descriptors (obj_p);\n        break;\n      }\n      case ECMA_OBJECT_ROUTINE_FROM_ENTRIES:\n      {\n        result = ecma_builtin_object_from_entries (arg1);\n        break;\n      }\n      default:\n      {\n        JERRY_UNREACHABLE ();\n      }\n    }\n\n    ecma_deref_object (obj_p);\n    return result;\n  }\n  else if (builtin_routine_id <= ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_SYMBOLS)\n  {\n    return ecma_op_object_get_own_property_keys (arg1, builtin_routine_id);\n  }\n  else if (builtin_routine_id <= ECMA_OBJECT_ROUTINE_SEAL)\n  {\n    if (!ecma_is_value_object (arg1))\n    {\n      return ecma_copy_value (arg1);\n    }\n\n    obj_p = ecma_get_object_from_value (arg1);\n    switch (builtin_routine_id)\n    {\n      case ECMA_OBJECT_ROUTINE_SEAL:\n      {\n        return ecma_builtin_object_object_seal (obj_p);\n      }\n      case ECMA_OBJECT_ROUTINE_FREEZE:\n      {\n        return ecma_builtin_object_object_freeze (obj_p);\n      }\n      case ECMA_OBJECT_ROUTINE_PREVENT_EXTENSIONS:\n      {\n        return ecma_builtin_object_object_prevent_extensions (obj_p);\n      }\n      default:\n      {\n        JERRY_UNREACHABLE ();\n      }\n    }\n  }\n  else\n  {\n    JERRY_ASSERT (builtin_routine_id <= ECMA_OBJECT_ROUTINE_IS_SEALED);\n\n    if (!ecma_is_value_object (arg1))\n    {\n      return ecma_make_boolean_value (builtin_routine_id != ECMA_OBJECT_ROUTINE_IS_EXTENSIBLE);\n    }\n\n    obj_p = ecma_get_object_from_value (arg1);\n    switch (builtin_routine_id)\n    {\n      case ECMA_OBJECT_ROUTINE_IS_SEALED:\n      case ECMA_OBJECT_ROUTINE_IS_FROZEN:\n      {\n        return ecma_builtin_object_test_integrity_level (obj_p, builtin_routine_id);\n      }\n      case ECMA_OBJECT_ROUTINE_IS_EXTENSIBLE:\n      {\n        return ecma_builtin_object_object_is_extensible (obj_p);\n      }\n      default:\n      {\n        JERRY_UNREACHABLE ();\n      }\n    }\n  }\n} /* ecma_builtin_object_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n#ifndef ECMA_BUILTIN_OBJECT_H\n#define ECMA_BUILTIN_OBJECT_H\n\n#include \"ecma-globals.h\"\n\necma_value_t ecma_builtin_object_object_get_prototype_of (ecma_object_t *obj_p);\n\necma_value_t ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1, ecma_value_t arg2);\n\necma_value_t ecma_builtin_object_object_set_proto (ecma_value_t arg1, ecma_value_t arg2);\n\necma_value_t ecma_builtin_object_object_prevent_extensions (ecma_object_t *obj_p);\n\necma_value_t ecma_builtin_object_object_is_extensible (ecma_object_t *obj_p);\n\necma_value_t ecma_builtin_object_object_get_own_property_descriptor (ecma_object_t *obj_p, ecma_string_t *name_str_p);\necma_value_t\necma_builtin_object_object_define_property (ecma_object_t *obj_p, ecma_string_t *name_str_p, ecma_value_t arg3);\n\n#endif /* !ECMA_BUILTIN_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-object.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Object built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.2.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, ECMA_PROPERTY_FIXED)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_OBJECT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_GET_PROTOTYPE_OF_UL, ECMA_OBJECT_ROUTINE_GET_PROTOTYPE_OF, 1, 1)\nROUTINE (LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL, ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_NAMES, 1, 1)\nROUTINE (LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL, ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_SYMBOLS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SEAL, ECMA_OBJECT_ROUTINE_SEAL, 1, 1)\nROUTINE (LIT_MAGIC_STRING_FREEZE, ECMA_OBJECT_ROUTINE_FREEZE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_PREVENT_EXTENSIONS_UL, ECMA_OBJECT_ROUTINE_PREVENT_EXTENSIONS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_IS_SEALED_UL, ECMA_OBJECT_ROUTINE_IS_SEALED, 1, 1)\nROUTINE (LIT_MAGIC_STRING_IS_FROZEN_UL, ECMA_OBJECT_ROUTINE_IS_FROZEN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_IS_EXTENSIBLE, ECMA_OBJECT_ROUTINE_IS_EXTENSIBLE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ENTRIES, ECMA_OBJECT_ROUTINE_ENTRIES, 1, 1)\nROUTINE (LIT_MAGIC_STRING_VALUES, ECMA_OBJECT_ROUTINE_VALUES, 1, 1)\nROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_OBJECT_ROUTINE_KEYS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL, ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_DESCRIPTOR, 2, 2)\nROUTINE (LIT_MAGIC_STRING_HAS_OWN_UL, ECMA_OBJECT_ROUTINE_HAS_OWN, 2, 2)\nROUTINE (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTORS_UL, ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_DESCRIPTORS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_OBJECT_FROM_ENTRIES, ECMA_OBJECT_ROUTINE_FROM_ENTRIES, 1, 1)\nROUTINE (LIT_MAGIC_STRING_CREATE, ECMA_OBJECT_ROUTINE_CREATE, 2, 2)\nROUTINE (LIT_MAGIC_STRING_DEFINE_PROPERTIES_UL, ECMA_OBJECT_ROUTINE_DEFINE_PROPERTIES, 2, 2)\nROUTINE (LIT_MAGIC_STRING_DEFINE_PROPERTY_UL, ECMA_OBJECT_ROUTINE_DEFINE_PROPERTY, 3, 3)\nROUTINE (LIT_MAGIC_STRING_SET_PROTOTYPE_OF_UL, ECMA_OBJECT_ROUTINE_SET_PROTOTYPE_OF, 2, 2)\nROUTINE (LIT_MAGIC_STRING_ASSIGN, ECMA_OBJECT_ROUTINE_ASSIGN, NON_FIXED, 2)\nROUTINE (LIT_MAGIC_STRING_IS, ECMA_OBJECT_ROUTINE_IS, 2, 2)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-globals.h\"\n#include \"ecma-promise-object.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_PROMISE_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_PROMISE_PROTOTYPE_ROUTINE_THEN,\n  ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH,\n  ECMA_PROMISE_PROTOTYPE_ROUTINE_FINALLY\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-promise-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  promise_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup promiseprototype ECMA Promise.prototype object built-in\n * @{\n */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_promise_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                                 ecma_value_t this_arg, /**< 'this' argument value */\n                                                 const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                         *   passed to routine */\n                                                 uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_PROMISE_PROTOTYPE_ROUTINE_THEN:\n    {\n      return ecma_promise_then (this_arg, arguments_list_p[0], arguments_list_p[1]);\n    }\n    case ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH:\n    {\n      ecma_value_t args[] = { ECMA_VALUE_UNDEFINED, arguments_list_p[0] };\n      return ecma_op_invoke_by_magic_id (this_arg, LIT_MAGIC_STRING_THEN, args, 2);\n    }\n    case ECMA_PROMISE_PROTOTYPE_ROUTINE_FINALLY:\n    {\n      return ecma_promise_finally (this_arg, arguments_list_p[0]);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_promise_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_PROMISE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 25.4.5.4 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_PROMISE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nROUTINE (LIT_MAGIC_STRING_THEN, ECMA_PROMISE_PROTOTYPE_ROUTINE_THEN, 2, 2)\nROUTINE (LIT_MAGIC_STRING_CATCH, ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH, 1, 1)\nROUTINE (LIT_MAGIC_STRING_FINALLY, ECMA_PROMISE_PROTOTYPE_ROUTINE_FINALLY, 1, 1)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-promise.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-handlers.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-number-object.h\"\n#include \"ecma-promise-object.h\"\n\n#include \"jcontext.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_PROMISE_ROUTINE_START = 0,\n  ECMA_PROMISE_ROUTINE_REJECT,\n  ECMA_PROMISE_ROUTINE_RESOLVE,\n  ECMA_PROMISE_ROUTINE_RACE,\n  ECMA_PROMISE_ROUTINE_ALL,\n  ECMA_PROMISE_ROUTINE_ALLSETTLED,\n  ECMA_PROMISE_ROUTINE_ANY,\n  ECMA_PROMISE_ROUTINE_SPECIES_GET\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-promise.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  promise\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup promise ECMA Promise object built-in\n * @{\n */\n\n/**\n * Runtime Semantics: PerformPromiseRace.\n *\n * See also:\n *         ES2020 25.6.4.4.1\n *\n * @return ecma value of the new promise.\n *         Returned value must be freed with ecma_free_value.\n */\nstatic inline ecma_value_t\necma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for race */\n                                   ecma_value_t next_method, /**< next method */\n                                   ecma_object_t *capability_obj_p, /**< PromiseCapability record */\n                                   ecma_value_t ctor, /**< Constructor value */\n                                   bool *done_p) /**< [out] iteratorRecord[[done]] */\n{\n  JERRY_ASSERT (ecma_is_value_object (iterator));\n  JERRY_ASSERT (ecma_object_class_is (capability_obj_p, ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));\n  JERRY_ASSERT (ecma_is_constructor (ctor));\n\n  ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;\n\n  ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor), LIT_MAGIC_STRING_RESOLVE);\n\n  if (ECMA_IS_VALUE_ERROR (resolve))\n  {\n    return resolve;\n  }\n\n  if (!ecma_op_is_callable (resolve))\n  {\n    ecma_free_value (resolve);\n    return ecma_raise_type_error (ECMA_ERR_RESOLVE_METHOD_MUST_BE_CALLABLE);\n  }\n\n  ecma_object_t *resolve_func_p = ecma_get_object_from_value (resolve);\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n\n  /* 5. */\n  while (true)\n  {\n    /* a. */\n    ecma_value_t next = ecma_op_iterator_step (iterator, next_method);\n    /* b, c. */\n    if (ECMA_IS_VALUE_ERROR (next))\n    {\n      goto done;\n    }\n\n    /* d. */\n    if (ecma_is_value_false (next))\n    {\n      /* ii. */\n      ret_value = ecma_copy_value (capability_p->header.u.cls.u3.promise);\n      goto done;\n    }\n\n    /* e. */\n    ecma_value_t next_val = ecma_op_iterator_value (next);\n    ecma_free_value (next);\n\n    /* f, g. */\n    if (ECMA_IS_VALUE_ERROR (next_val))\n    {\n      goto done;\n    }\n\n    /* h. */\n    ecma_value_t next_promise = ecma_op_function_call (resolve_func_p, ctor, &next_val, 1);\n    ecma_free_value (next_val);\n\n    if (ECMA_IS_VALUE_ERROR (next_promise))\n    {\n      goto exit;\n    }\n\n    /* i. */\n    ecma_value_t args[2] = { capability_p->resolve, capability_p->reject };\n    ecma_value_t result = ecma_op_invoke_by_magic_id (next_promise, LIT_MAGIC_STRING_THEN, args, 2);\n    ecma_free_value (next_promise);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto exit;\n    }\n\n    ecma_free_value (result);\n  }\n\ndone:\n  *done_p = true;\nexit:\n  ecma_deref_object (resolve_func_p);\n\n  return ret_value;\n} /* ecma_builtin_promise_perform_race */\n\n/**\n * Runtime Semantics: Perform Promise all, allSettled or any.\n *\n * See also:\n *         ES2020 25.6.4.1.1\n *\n * @return ecma value of the new promise.\n *         Returned value must be freed with ecma_free_value.\n */\nstatic inline ecma_value_t\necma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */\n                              ecma_value_t next_method, /**< next method */\n                              ecma_object_t *capability_obj_p, /**< PromiseCapability record */\n                              ecma_value_t ctor, /**< the caller of Promise.all */\n                              uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                              bool *done_p) /**< [out] iteratorRecord[[done]] */\n{\n  /* 1. - 2. */\n  JERRY_ASSERT (ecma_object_class_is (capability_obj_p, ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));\n  JERRY_ASSERT (ecma_is_constructor (ctor));\n\n  ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;\n\n  ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor), LIT_MAGIC_STRING_RESOLVE);\n\n  if (ECMA_IS_VALUE_ERROR (resolve))\n  {\n    return resolve;\n  }\n\n  if (!ecma_op_is_callable (resolve))\n  {\n    ecma_free_value (resolve);\n    return ecma_raise_type_error (ECMA_ERR_RESOLVE_METHOD_MUST_BE_CALLABLE);\n  }\n\n  ecma_object_t *resolve_func_p = ecma_get_object_from_value (resolve);\n\n  /* 3. */\n  ecma_object_t *values_array_obj_p = ecma_op_new_array_object (0);\n  ecma_value_t values_array = ecma_make_object_value (values_array_obj_p);\n  /* 4. */\n  ecma_value_t remaining = ecma_op_create_number_object (ecma_make_integer_value (1));\n  /* 5. */\n  uint32_t idx = 0;\n\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n\n  /* 6. */\n  while (true)\n  {\n    /* a. */\n    ecma_value_t next = ecma_op_iterator_step (iterator, next_method);\n    /* b. - c. */\n    if (ECMA_IS_VALUE_ERROR (next))\n    {\n      goto done;\n    }\n\n    /* d. */\n    if (ecma_is_value_false (next))\n    {\n      /* ii. - iii. */\n      if (ecma_promise_remaining_inc_or_dec (remaining, false) == 0)\n      {\n        if (builtin_routine_id == ECMA_PROMISE_ROUTINE_ANY)\n        {\n          ret_value = ecma_raise_aggregate_error (values_array, ECMA_VALUE_UNDEFINED);\n          goto done;\n        }\n\n        /* 2. */\n        ecma_value_t resolve_result = ecma_op_function_call (ecma_get_object_from_value (capability_p->resolve),\n                                                             ECMA_VALUE_UNDEFINED,\n                                                             &values_array,\n                                                             1);\n        /* 3. */\n        if (ECMA_IS_VALUE_ERROR (resolve_result))\n        {\n          goto done;\n        }\n\n        ecma_free_value (resolve_result);\n      }\n\n      /* iv. */\n      ret_value = ecma_copy_value (capability_p->header.u.cls.u3.promise);\n      goto done;\n    }\n\n    /* e. */\n    ecma_value_t next_value = ecma_op_iterator_value (next);\n    ecma_free_value (next);\n\n    /* f. - g. */\n    if (ECMA_IS_VALUE_ERROR (next_value))\n    {\n      goto done;\n    }\n\n    /* h. */\n    ecma_builtin_helper_def_prop_by_index (values_array_obj_p,\n                                           idx,\n                                           ECMA_VALUE_UNDEFINED,\n                                           ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n\n    /* i. */\n    ecma_value_t next_promise = ecma_op_function_call (resolve_func_p, ctor, &next_value, 1);\n    ecma_free_value (next_value);\n\n    /* j. */\n    if (ECMA_IS_VALUE_ERROR (next_promise))\n    {\n      goto exit;\n    }\n\n    if (JERRY_UNLIKELY (idx == UINT32_MAX - 1))\n    {\n      ecma_raise_range_error (ECMA_ERR_PROMISE_ALL_REMAINING_ELEMENTS_LIMIT_REACHED);\n      goto exit;\n    }\n\n    idx++;\n    ecma_value_t args[2];\n    ecma_object_t *executor_func_p = NULL;\n\n    if (builtin_routine_id != ECMA_PROMISE_ROUTINE_ANY)\n    {\n      /* k. */\n      executor_func_p =\n        ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER, sizeof (ecma_promise_all_executor_t));\n\n      ecma_promise_all_executor_t *executor_p = (ecma_promise_all_executor_t *) executor_func_p;\n\n      /* m. + t. */\n      executor_p->index = idx;\n\n      /* n. */\n      executor_p->values = values_array;\n\n      /* o. */\n      executor_p->capability = ecma_make_object_value (capability_obj_p);\n\n      /* p. */\n      executor_p->remaining_elements = remaining;\n\n      uint8_t executor_type = ECMA_PROMISE_ALL_RESOLVE << ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT;\n\n      if (builtin_routine_id == ECMA_PROMISE_ROUTINE_ALLSETTLED)\n      {\n        executor_type = ECMA_PROMISE_ALLSETTLED_RESOLVE << ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT;\n      }\n\n      executor_p->header.u.built_in.u2.routine_flags |= executor_type;\n\n      args[0] = ecma_make_object_value (executor_func_p);\n    }\n    else\n    {\n      args[0] = capability_p->resolve;\n    }\n\n    /* q. */\n    ecma_promise_remaining_inc_or_dec (remaining, true);\n    ecma_value_t result;\n\n    if (builtin_routine_id != ECMA_PROMISE_ROUTINE_ALL)\n    {\n      uint8_t executor_type = ECMA_PROMISE_ALLSETTLED_REJECT << ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT;\n\n      if (builtin_routine_id == ECMA_PROMISE_ROUTINE_ANY)\n      {\n        executor_type = ECMA_PROMISE_ANY_REJECT << ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT;\n      }\n\n      ecma_object_t *reject_func_p =\n        ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER, sizeof (ecma_promise_all_executor_t));\n\n      ecma_promise_all_executor_t *reject_p = (ecma_promise_all_executor_t *) reject_func_p;\n      reject_p->index = idx;\n      reject_p->values = values_array;\n      reject_p->capability = ecma_make_object_value (capability_obj_p);\n      reject_p->remaining_elements = remaining;\n      reject_p->header.u.built_in.u2.routine_flags |= executor_type;\n      args[1] = ecma_make_object_value (reject_func_p);\n      result = ecma_op_invoke_by_magic_id (next_promise, LIT_MAGIC_STRING_THEN, args, 2);\n      ecma_deref_object (reject_func_p);\n    }\n    else\n    {\n      args[1] = capability_p->reject;\n      result = ecma_op_invoke_by_magic_id (next_promise, LIT_MAGIC_STRING_THEN, args, 2);\n    }\n\n    ecma_free_value (next_promise);\n\n    if (builtin_routine_id != ECMA_PROMISE_ROUTINE_ANY)\n    {\n      ecma_deref_object (executor_func_p);\n    }\n\n    /* s. */\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto exit;\n    }\n\n    ecma_free_value (result);\n  }\n\ndone:\n  *done_p = true;\nexit:\n  ecma_free_value (remaining);\n  ecma_deref_object (values_array_obj_p);\n  ecma_deref_object (resolve_func_p);\n\n  return ret_value;\n} /* ecma_builtin_promise_perform */\n\n/**\n * The common function for Promise.race, Promise.all, Promise.any and Promise.allSettled.\n *\n * @return ecma value of the new promise.\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_promise_helper (ecma_value_t this_arg, /**< 'this' argument */\n                             ecma_value_t iterable, /**< the items to be resolved */\n                             uint8_t builtin_routine_id) /**< built-in wide routine identifier */\n{\n  ecma_object_t *capability_obj_p = ecma_promise_new_capability (this_arg, ECMA_VALUE_UNDEFINED);\n\n  if (JERRY_UNLIKELY (capability_obj_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t next_method;\n  ecma_value_t iterator = ecma_op_get_iterator (iterable, ECMA_VALUE_SYNC_ITERATOR, &next_method);\n  ecma_value_t ret = ECMA_VALUE_ERROR;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_op_if_abrupt_reject_promise (&iterator, capability_obj_p)))\n  {\n    ecma_free_value (next_method);\n    ecma_deref_object (capability_obj_p);\n    return iterator;\n  }\n\n  bool is_done = false;\n\n  if (builtin_routine_id == ECMA_PROMISE_ROUTINE_RACE)\n  {\n    ret = ecma_builtin_promise_perform_race (iterator, next_method, capability_obj_p, this_arg, &is_done);\n  }\n  else\n  {\n    ret =\n      ecma_builtin_promise_perform (iterator, next_method, capability_obj_p, this_arg, builtin_routine_id, &is_done);\n  }\n\n  if (ECMA_IS_VALUE_ERROR (ret))\n  {\n    if (!is_done)\n    {\n      ret = ecma_op_iterator_close (iterator);\n    }\n\n    ecma_op_if_abrupt_reject_promise (&ret, capability_obj_p);\n  }\n\n  ecma_free_value (iterator);\n  ecma_free_value (next_method);\n  ecma_deref_object (capability_obj_p);\n\n  return ret;\n} /* ecma_builtin_promise_helper */\n\n/**\n * Handle calling [[Call]] of built-in Promise object.\n *\n * ES2015 25.4.3 Promise is not intended to be called\n * as a function and will throw an exception when called\n * in that manner.\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_promise_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                    uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_PROMISE_REQUIRES_NEW);\n} /* ecma_builtin_promise_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Promise object.\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_promise_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                         uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  if (arguments_list_len == 0 || !ecma_op_is_callable (arguments_list_p[0]))\n  {\n    return ecma_raise_type_error (ECMA_ERR_FIRST_PARAMETER_MUST_BE_CALLABLE);\n  }\n\n  return ecma_op_create_promise_object (arguments_list_p[0],\n                                        ECMA_VALUE_UNDEFINED,\n                                        JERRY_CONTEXT (current_new_target_p));\n} /* ecma_builtin_promise_dispatch_construct */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_promise_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine\n                                                                    *   identifier */\n                                       ecma_value_t this_arg, /**< 'this' argument value */\n                                       const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                               *   passed to routine */\n                                       uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_PROMISE_ROUTINE_REJECT:\n    case ECMA_PROMISE_ROUTINE_RESOLVE:\n    {\n      bool is_resolve = (builtin_routine_id == ECMA_PROMISE_ROUTINE_RESOLVE);\n      return ecma_promise_reject_or_resolve (this_arg, arguments_list_p[0], is_resolve);\n    }\n    case ECMA_PROMISE_ROUTINE_RACE:\n    case ECMA_PROMISE_ROUTINE_ALL:\n    case ECMA_PROMISE_ROUTINE_ALLSETTLED:\n    case ECMA_PROMISE_ROUTINE_ANY:\n    {\n      return ecma_builtin_promise_helper (this_arg, arguments_list_p[0], builtin_routine_id);\n    }\n    case ECMA_PROMISE_ROUTINE_SPECIES_GET:\n    {\n      return ecma_copy_value (this_arg);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_promise_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-promise.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Promose built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_PROMISE_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_PROMISE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_REJECT, ECMA_PROMISE_ROUTINE_REJECT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_RESOLVE, ECMA_PROMISE_ROUTINE_RESOLVE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_RACE, ECMA_PROMISE_ROUTINE_RACE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ALL, ECMA_PROMISE_ROUTINE_ALL, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ALLSETTLED, ECMA_PROMISE_ROUTINE_ALLSETTLED, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ANY, ECMA_PROMISE_ROUTINE_ANY, 1, 1)\n\n/* ES2015 25.4.4.6 */\nACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ECMA_PROMISE_ROUTINE_SPECIES_GET, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-proxy.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-proxy-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_PROXY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BUILTIN_PROXY_OBJECT_ROUTINE_START = 0,\n  ECMA_BUILTIN_PROXY_OBJECT_REVOCABLE,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-proxy.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  proxy\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup proxy ECMA Proxy object built-in\n * @{\n */\n\n/**\n * The Proxy object's 'revocable' routine\n *\n * See also:\n *         ES2015 26.2.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_proxy_object_revocable (ecma_value_t target, /**< target argument */\n                                     ecma_value_t handler) /**< handler argument */\n{\n  ecma_object_t *rev_proxy_p = ecma_proxy_create_revocable (target, handler);\n\n  if (JERRY_UNLIKELY (rev_proxy_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  return ecma_make_object_value (rev_proxy_p);\n} /* ecma_builtin_proxy_object_revocable */\n\n/**\n * Handle calling [[Call]] of built-in Proxy object\n *\n * See also:\n *          ES2015 26.2.2\n *\n * @return raised error\n */\necma_value_t\necma_builtin_proxy_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                  uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  /* 1. */\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_PROXY_REQUIRES_NEW);\n} /* ecma_builtin_proxy_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in proxy object\n *\n * See also:\n *          ES2015 26.2.2\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         new proxy object - otherwise\n */\necma_value_t\necma_builtin_proxy_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                       uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  /* 2. */\n  ecma_object_t *proxy_p = ecma_proxy_create (arguments_list_len > 0 ? arguments_list_p[0] : ECMA_VALUE_UNDEFINED,\n                                              arguments_list_len > 1 ? arguments_list_p[1] : ECMA_VALUE_UNDEFINED,\n                                              0);\n\n  if (JERRY_UNLIKELY (proxy_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  return ecma_make_object_value (proxy_p);\n} /* ecma_builtin_proxy_dispatch_construct */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_proxy_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                     ecma_value_t this_arg, /**< 'this' argument value */\n                                     const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                             *   passed to routine */\n                                     uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (this_arg, arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_BUILTIN_PROXY_OBJECT_REVOCABLE:\n    {\n      return ecma_builtin_proxy_object_revocable (arguments_list_p[0], arguments_list_p[1]);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_proxy_dispatch_routine */\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_PROXY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-proxy.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Proxy object built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_PROXY\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 2, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_PROXY_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\n\nROUTINE (LIT_MAGIC_STRING_REVOCABLE, ECMA_BUILTIN_PROXY_OBJECT_REVOCABLE, 2, 2)\n\n#endif /* JERRY_BUILTIN_PROXY */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-rangeerror-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  range_error_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * RangeError.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.7.8 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_RANGE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.9 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_RANGE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.10 */\nSTRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-rangeerror.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  range_error\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup rangeerror ECMA RangeError object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in RangeError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_range_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                        uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_helper_error_dispatch_call (JERRY_ERROR_RANGE, arguments_list_p, arguments_list_len);\n} /* ecma_builtin_range_error_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in RangeError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_range_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                             uint32_t arguments_list_len) /**< number of arguments */\n{\n  ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),\n                                                                   ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE);\n\n  if (proto_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ecma_builtin_range_error_dispatch_call (arguments_list_p, arguments_list_len);\n\n  if (!ECMA_IS_VALUE_ERROR (result))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (result);\n    ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, proto_p);\n  }\n\n  ecma_deref_object (proto_p);\n\n  return result;\n} /* ecma_builtin_range_error_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * RangeError built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_RANGE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-referenceerror-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  reference_error_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * ReferenceError.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.7.8 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_REFERENCE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.9 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_REFERENCE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.10 */\nSTRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-referenceerror.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  reference_error\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup referenceerror ECMA ReferenceError object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in ReferenceError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_reference_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                            uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_helper_error_dispatch_call (JERRY_ERROR_REFERENCE, arguments_list_p, arguments_list_len);\n} /* ecma_builtin_reference_error_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in ReferenceError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_reference_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                 uint32_t arguments_list_len) /**< number of arguments */\n{\n  ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),\n                                                                   ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE);\n\n  if (proto_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ecma_builtin_reference_error_dispatch_call (arguments_list_p, arguments_list_len);\n\n  if (!ECMA_IS_VALUE_ERROR (result))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (result);\n    ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, proto_p);\n  }\n\n  ecma_deref_object (proto_p);\n\n  return result;\n} /* ecma_builtin_reference_error_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * ReferenceError built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_REFERENCE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-function-prototype.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtin-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-proxy-object.h\"\n\n#include \"jcontext.h\"\n\n#if JERRY_BUILTIN_REFLECT\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_REFLECT_OBJECT_ROUTINE_START = 0,\n  ECMA_REFLECT_OBJECT_GET, /* ECMA-262 v6, 26.1.6 */\n  ECMA_REFLECT_OBJECT_SET, /* ECMA-262 v6, 26.1.13 */\n  ECMA_REFLECT_OBJECT_HAS, /* ECMA-262 v6, 26.1.9 */\n  ECMA_REFLECT_OBJECT_DELETE_PROPERTY, /* ECMA-262 v6, 26.1.4 */\n  ECMA_REFLECT_OBJECT_CONSTRUCT, /* ECMA-262, 26.1.2 */\n  ECMA_REFLECT_OBJECT_OWN_KEYS, /* ECMA-262 v6, 26.1.11 */\n  ECMA_REFLECT_OBJECT_GET_PROTOTYPE_OF, /* ECMA-262 v6, 26.1.8 */\n  ECMA_REFLECT_OBJECT_SET_PROTOTYPE_OF, /* ECMA-262 v6, 26.1.14 */\n  ECMA_REFLECT_OBJECT_APPLY, /* ECMA-262 v6, 26.1.1 */\n  ECMA_REFLECT_OBJECT_DEFINE_PROPERTY, /* ECMA-262 v6, 26.1.3 */\n  ECMA_REFLECT_OBJECT_GET_OWN_PROPERTY_DESCRIPTOR, /* ECMA-262 v6, 26.1.7 */\n  ECMA_REFLECT_OBJECT_IS_EXTENSIBLE, /* ECMA-262 v6, 26.1.10 */\n  ECMA_REFLECT_OBJECT_PREVENT_EXTENSIONS, /* ECMA-262 v6, 26.1.12 */\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-reflect.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  reflect\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup object ECMA Reflect object built-in\n * @{\n */\n\n/**\n * Dispatcher for the built-in's routines.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                       ecma_value_t this_arg, /**< 'this' argument value */\n                                       const ecma_value_t arguments_list[], /**< list of arguments\n                                                                             *   passed to routine */\n                                       uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (this_arg);\n\n  if (builtin_routine_id < ECMA_REFLECT_OBJECT_CONSTRUCT)\n  {\n    /* 1. */\n    if (arguments_number == 0 || !ecma_is_value_object (arguments_list[0]))\n    {\n      return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);\n    }\n\n    /* 2. */\n    ecma_string_t *name_str_p = ecma_op_to_property_key (arguments_list[1]);\n\n    /* 3. */\n    if (name_str_p == NULL)\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_value_t ret_value;\n    ecma_object_t *target_p = ecma_get_object_from_value (arguments_list[0]);\n    switch (builtin_routine_id)\n    {\n      case ECMA_REFLECT_OBJECT_GET:\n      {\n        ecma_value_t receiver = arguments_list[0];\n\n        /* 4. */\n        if (arguments_number > 2)\n        {\n          receiver = arguments_list[2];\n        }\n\n        ret_value = ecma_op_object_get_with_receiver (target_p, name_str_p, receiver);\n        break;\n      }\n\n      case ECMA_REFLECT_OBJECT_HAS:\n      {\n        ret_value = ecma_op_object_has_property (target_p, name_str_p);\n        break;\n      }\n\n      case ECMA_REFLECT_OBJECT_DELETE_PROPERTY:\n      {\n        ret_value = ecma_op_object_delete (target_p, name_str_p, false);\n        break;\n      }\n\n      default:\n      {\n        JERRY_ASSERT (builtin_routine_id == ECMA_REFLECT_OBJECT_SET);\n\n        ecma_value_t receiver = arguments_list[0];\n\n        if (arguments_number > 3)\n        {\n          receiver = arguments_list[3];\n        }\n\n        ret_value = ecma_op_object_put_with_receiver (target_p, name_str_p, arguments_list[2], receiver, false);\n        break;\n      }\n    }\n\n    ecma_deref_ecma_string (name_str_p);\n    return ret_value;\n  }\n\n  if (builtin_routine_id == ECMA_REFLECT_OBJECT_OWN_KEYS)\n  {\n    /* 1. */\n    if (arguments_number == 0 || !ecma_is_value_object (arguments_list[0]))\n    {\n      return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);\n    }\n\n    ecma_object_t *target_p = ecma_get_object_from_value (arguments_list[0]);\n\n    /* 2. */\n    ecma_collection_t *prop_names = ecma_op_object_own_property_keys (target_p, JERRY_PROPERTY_FILTER_ALL);\n\n#if JERRY_BUILTIN_PROXY\n    if (prop_names == NULL)\n    {\n      return ECMA_VALUE_ERROR;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    /* 3. */\n    return ecma_op_new_array_object_from_collection (prop_names, false);\n  }\n\n  if (builtin_routine_id == ECMA_REFLECT_OBJECT_CONSTRUCT)\n  {\n    /* 1. */\n    if (arguments_number < 1 || !ecma_is_constructor (arguments_list[0]))\n    {\n      return ecma_raise_type_error (ECMA_ERR_TARGET_IS_NOT_A_CONSTRUCTOR);\n    }\n\n    ecma_object_t *target_p = ecma_get_object_from_value (arguments_list[0]);\n\n    /* 2. */\n    ecma_object_t *new_target_p = target_p;\n\n    if (arguments_number > 2)\n    {\n      /* 3. */\n      if (!ecma_is_constructor (arguments_list[2]))\n      {\n        return ecma_raise_type_error (ECMA_ERR_TARGET_IS_NOT_A_CONSTRUCTOR);\n      }\n\n      new_target_p = ecma_get_object_from_value (arguments_list[2]);\n    }\n\n    /* 4. */\n    if (arguments_number < 2)\n    {\n      return ecma_raise_type_error (ECMA_ERR_REFLECT_EXPECTS_AN_OBJECT_AS_SECOND_ARGUMENT);\n    }\n\n    ecma_collection_t *coll_p = ecma_op_create_list_from_array_like (arguments_list[1], false);\n\n    if (coll_p == NULL)\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_value_t ret_value = ecma_op_function_construct (target_p, new_target_p, coll_p->buffer_p, coll_p->item_count);\n\n    ecma_collection_free (coll_p);\n    return ret_value;\n  }\n\n  if (!ecma_is_value_object (arguments_list[0]))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);\n  }\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_REFLECT_OBJECT_GET_PROTOTYPE_OF:\n    {\n      return ecma_builtin_object_object_get_prototype_of (ecma_get_object_from_value (arguments_list[0]));\n    }\n    case ECMA_REFLECT_OBJECT_SET_PROTOTYPE_OF:\n    {\n      if (!ecma_is_value_object (arguments_list[1]) && !ecma_is_value_null (arguments_list[1]))\n      {\n        return ecma_raise_type_error (ECMA_ERR_PROTOTYPE_IS_NEITHER_OBJECT_NOR_NULL);\n      }\n\n      ecma_object_t *obj_p = ecma_get_object_from_value (arguments_list[0]);\n      ecma_value_t status;\n\n#if JERRY_BUILTIN_PROXY\n      if (ECMA_OBJECT_IS_PROXY (obj_p))\n      {\n        status = ecma_proxy_object_set_prototype_of (obj_p, arguments_list[1]);\n      }\n      else\n#endif /* JERRY_BUILTIN_PROXY */\n      {\n        status = ecma_op_ordinary_object_set_prototype_of (obj_p, arguments_list[1]);\n      }\n\n      return status;\n    }\n    case ECMA_REFLECT_OBJECT_APPLY:\n    {\n      if (!ecma_op_is_callable (arguments_list[0]))\n      {\n        return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_FUNCTION);\n      }\n\n      ecma_object_t *func_obj_p = ecma_get_object_from_value (arguments_list[0]);\n      return ecma_builtin_function_prototype_object_apply (func_obj_p, arguments_list[1], arguments_list[2]);\n    }\n    case ECMA_REFLECT_OBJECT_DEFINE_PROPERTY:\n    {\n      ecma_object_t *obj_p = ecma_get_object_from_value (arguments_list[0]);\n      ecma_string_t *name_str_p = ecma_op_to_property_key (arguments_list[1]);\n\n      if (name_str_p == NULL)\n      {\n        return ECMA_VALUE_ERROR;\n      }\n\n      ecma_property_descriptor_t prop_desc;\n      ecma_value_t conv_result = ecma_op_to_property_descriptor (arguments_list[2], &prop_desc);\n\n      if (ECMA_IS_VALUE_ERROR (conv_result))\n      {\n        ecma_deref_ecma_string (name_str_p);\n        return conv_result;\n      }\n\n      ecma_value_t result = ecma_op_object_define_own_property (obj_p, name_str_p, &prop_desc);\n\n      ecma_deref_ecma_string (name_str_p);\n      ecma_free_property_descriptor (&prop_desc);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        return result;\n      }\n\n      bool boolean_result = ecma_op_to_boolean (result);\n\n      return ecma_make_boolean_value (boolean_result);\n    }\n    case ECMA_REFLECT_OBJECT_GET_OWN_PROPERTY_DESCRIPTOR:\n    {\n      ecma_object_t *obj_p = ecma_get_object_from_value (arguments_list[0]);\n      ecma_string_t *name_str_p = ecma_op_to_property_key (arguments_list[1]);\n\n      if (name_str_p == NULL)\n      {\n        return ECMA_VALUE_ERROR;\n      }\n\n      ecma_value_t ret_val = ecma_builtin_object_object_get_own_property_descriptor (obj_p, name_str_p);\n      ecma_deref_ecma_string (name_str_p);\n      return ret_val;\n    }\n    case ECMA_REFLECT_OBJECT_IS_EXTENSIBLE:\n    {\n      ecma_object_t *obj_p = ecma_get_object_from_value (arguments_list[0]);\n      return ecma_builtin_object_object_is_extensible (obj_p);\n    }\n    default:\n    {\n      JERRY_ASSERT (builtin_routine_id == ECMA_REFLECT_OBJECT_PREVENT_EXTENSIONS);\n      ecma_object_t *obj_p = ecma_get_object_from_value (arguments_list[0]);\n\n#if JERRY_BUILTIN_PROXY\n      if (ECMA_OBJECT_IS_PROXY (obj_p))\n      {\n        return ecma_proxy_object_prevent_extensions (obj_p);\n      }\n#endif /* !JERRY_BUILTIN_PROXY */\n\n      ecma_op_ordinary_object_prevent_extensions (obj_p);\n\n      return ECMA_VALUE_TRUE;\n    }\n  }\n} /* ecma_builtin_reflect_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REFLECT */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-reflect.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_REFLECT\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_APPLY, ECMA_REFLECT_OBJECT_APPLY, 3, 3)\nROUTINE (LIT_MAGIC_STRING_DEFINE_PROPERTY_UL, ECMA_REFLECT_OBJECT_DEFINE_PROPERTY, 3, 3)\nROUTINE (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL, ECMA_REFLECT_OBJECT_GET_OWN_PROPERTY_DESCRIPTOR, 2, 2)\nROUTINE (LIT_MAGIC_STRING_GET, ECMA_REFLECT_OBJECT_GET, NON_FIXED, 2)\nROUTINE (LIT_MAGIC_STRING_SET, ECMA_REFLECT_OBJECT_SET, NON_FIXED, 3)\nROUTINE (LIT_MAGIC_STRING_HAS, ECMA_REFLECT_OBJECT_HAS, 2, 2)\nROUTINE (LIT_MAGIC_STRING_DELETE_PROPERTY_UL, ECMA_REFLECT_OBJECT_DELETE_PROPERTY, 2, 2)\nROUTINE (LIT_MAGIC_STRING_OWN_KEYS_UL, ECMA_REFLECT_OBJECT_OWN_KEYS, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_CONSTRUCT, ECMA_REFLECT_OBJECT_CONSTRUCT, NON_FIXED, 2)\nROUTINE (LIT_MAGIC_STRING_GET_PROTOTYPE_OF_UL, ECMA_REFLECT_OBJECT_GET_PROTOTYPE_OF, 1, 1)\nROUTINE (LIT_MAGIC_STRING_IS_EXTENSIBLE, ECMA_REFLECT_OBJECT_IS_EXTENSIBLE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_PREVENT_EXTENSIONS_UL, ECMA_REFLECT_OBJECT_PREVENT_EXTENSIONS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SET_PROTOTYPE_OF_UL, ECMA_REFLECT_OBJECT_SET_PROTOTYPE_OF, 2, 2)\n\n#endif /* JERRY_BUILTIN_REFLECT */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-regexp-object.h\"\n\n#include \"lit-char-helpers.h\"\n\n#if JERRY_BUILTIN_REGEXP\n#include \"ecma-regexp-object.h\"\n\n#include \"re-compiler.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-regexp-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  regexp_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup regexpprototype ECMA RegExp.prototype object built-in\n * @{\n */\n\n/**\n * Helper function to retrieve the flags associated with a RegExp object\n *\n * @return ECMA_VALUE_{TRUE,FALSE} depends on whether the given flag is present.\n */\nstatic ecma_value_t\necma_builtin_regexp_prototype_flags_helper (ecma_extended_object_t *re_obj_p, /**< this object */\n                                            uint16_t builtin_routine_id) /**< id of the flag */\n{\n  re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, re_obj_p->u.cls.u3.value);\n\n  uint16_t flags = bc_p->header.status_flags;\n\n  static const uint8_t re_flags[] = {\n    RE_FLAG_GLOBAL, RE_FLAG_IGNORE_CASE, RE_FLAG_MULTILINE, RE_FLAG_STICKY, RE_FLAG_UNICODE, RE_FLAG_DOTALL,\n  };\n\n  uint16_t offset = (uint16_t) (builtin_routine_id - ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL);\n  return ecma_make_boolean_value ((flags & re_flags[offset]) != 0);\n} /* ecma_builtin_regexp_prototype_flags_helper */\n\n/**\n * The RegExp.prototype object's 'flags' accessor property\n *\n * See also:\n *          ECMA-262 v6, 21.2.5.3\n *\n * @return ECMA_VALUE_ERROR - if 'this' is not a RegExp object\n *         string value     - otherwise\n *\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_regexp_prototype_get_flags (ecma_object_t *object_p) /**< this object */\n{\n  static const lit_magic_string_id_t flag_lit_ids[] = { LIT_MAGIC_STRING_GLOBAL,    LIT_MAGIC_STRING_IGNORECASE_UL,\n                                                        LIT_MAGIC_STRING_MULTILINE, LIT_MAGIC_STRING_DOTALL,\n                                                        LIT_MAGIC_STRING_UNICODE,   LIT_MAGIC_STRING_STICKY };\n\n  static const lit_utf8_byte_t flag_chars[] = { LIT_CHAR_LOWERCASE_G, LIT_CHAR_LOWERCASE_I, LIT_CHAR_LOWERCASE_M,\n                                                LIT_CHAR_LOWERCASE_S, LIT_CHAR_LOWERCASE_U, LIT_CHAR_LOWERCASE_Y };\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n  for (uint32_t i = 0; i < sizeof (flag_lit_ids) / sizeof (lit_magic_string_id_t); i++)\n  {\n    ecma_value_t result = ecma_op_object_get_by_magic_id (object_p, flag_lit_ids[i]);\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      ecma_stringbuilder_destroy (&builder);\n      return result;\n    }\n\n    if (ecma_op_to_boolean (result))\n    {\n      ecma_stringbuilder_append_byte (&builder, flag_chars[i]);\n    }\n\n    ecma_free_value (result);\n  }\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_regexp_prototype_get_flags */\n\n/**\n * The EscapeRegExpPattern method.\n *\n * See also:\n *          ECMA-262 v6, 21.2.3.2.4\n *\n * @return ecma_value_t\n */\nstatic ecma_value_t\necma_op_escape_regexp_pattern (ecma_string_t *pattern_str_p) /**< RegExp pattern */\n{\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  ECMA_STRING_TO_UTF8_STRING (pattern_str_p, pattern_start_p, pattern_start_size);\n\n  const lit_utf8_byte_t *pattern_str_curr_p = pattern_start_p;\n  const lit_utf8_byte_t *pattern_str_end_p = pattern_start_p + pattern_start_size;\n\n  while (pattern_str_curr_p < pattern_str_end_p)\n  {\n    ecma_char_t c = lit_cesu8_read_next (&pattern_str_curr_p);\n\n    switch (c)\n    {\n      case LIT_CHAR_SLASH:\n      {\n        ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) \"\\\\/\", 2);\n        break;\n      }\n      case LIT_CHAR_LF:\n      {\n        ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) \"\\\\n\", 2);\n        break;\n      }\n      case LIT_CHAR_CR:\n      {\n        ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) \"\\\\r\", 2);\n        break;\n      }\n      case LIT_CHAR_LS:\n      {\n        ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) \"\\\\u2028\", 6);\n        break;\n      }\n      case LIT_CHAR_PS:\n      {\n        ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) \"\\\\u2029\", 6);\n        break;\n      }\n      case LIT_CHAR_BACKSLASH:\n      {\n        JERRY_ASSERT (pattern_str_curr_p < pattern_str_end_p);\n        ecma_stringbuilder_append_char (&builder, LIT_CHAR_BACKSLASH);\n        ecma_stringbuilder_append_char (&builder, lit_cesu8_read_next (&pattern_str_curr_p));\n        break;\n      }\n      default:\n      {\n        ecma_stringbuilder_append_char (&builder, c);\n        break;\n      }\n    }\n  }\n\n  ECMA_FINALIZE_UTF8_STRING (pattern_start_p, pattern_start_size);\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_op_escape_regexp_pattern */\n\n/**\n * The RegExp.prototype object's 'source' accessor property\n *\n * See also:\n *          ECMA-262 v6, 21.2.5.10\n *\n * @return ECMA_VALUE_ERROR - if 'this' is not a RegExp object\n *         string value     - otherwise\n *\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_regexp_prototype_get_source (ecma_extended_object_t *re_obj_p) /**< this argument */\n{\n  re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, re_obj_p->u.cls.u3.value);\n\n  return ecma_op_escape_regexp_pattern (ecma_get_string_from_value (bc_p->source));\n} /* ecma_builtin_regexp_prototype_get_source */\n\n#if JERRY_BUILTIN_ANNEXB\n/**\n * The RegExp.prototype object's 'compile' routine\n *\n * See also:\n *          ECMA-262 v11, B.2.5.1\n *\n * @return undefined        - if compiled successfully\n *         error ecma value - otherwise\n *\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this */\n                                       ecma_value_t pattern_arg, /**< pattern or RegExp object */\n                                       ecma_value_t flags_arg) /**< flags */\n{\n  ecma_object_t *this_obj_p = ecma_get_object_from_value (this_arg);\n  ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) this_obj_p;\n  re_compiled_code_t *old_bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, re_obj_p->u.cls.u3.value);\n\n  ecma_value_t ret_value;\n\n  if (ecma_object_is_regexp_object (pattern_arg))\n  {\n    if (!ecma_is_value_undefined (flags_arg))\n    {\n      return ecma_raise_type_error (ECMA_ERR_INVALID_ARGUMENT);\n    }\n\n    ecma_extended_object_t *pattern_obj_p = (ecma_extended_object_t *) ecma_get_object_from_value (pattern_arg);\n    re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, pattern_obj_p->u.cls.u3.value);\n\n    ret_value = ecma_op_create_regexp_from_bytecode (this_obj_p, bc_p);\n  }\n  else\n  {\n    ret_value = ecma_op_create_regexp_from_pattern (this_obj_p, pattern_arg, flags_arg);\n  }\n\n  if (!ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    ecma_value_t status = ecma_builtin_helper_def_prop (this_obj_p,\n                                                        ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),\n                                                        ecma_make_uint32_value (0),\n                                                        ECMA_PROPERTY_FLAG_WRITABLE | JERRY_PROP_SHOULD_THROW);\n\n    ecma_bytecode_deref ((ecma_compiled_code_t *) old_bc_p);\n\n    if (ECMA_IS_VALUE_ERROR (status))\n    {\n      return status;\n    }\n\n    ecma_ref_object (this_obj_p);\n  }\n\n  return ret_value;\n} /* ecma_builtin_regexp_prototype_compile */\n\n#endif /* JERRY_BUILTIN_ANNEXB */\n\n/**\n * The RegExp.prototype object's 'exec' routine\n *\n * See also:\n *          ECMA-262 v5, 15.10.6.2\n *\n * @return array object containing the results - if the matched\n *         null                                - otherwise\n *\n *         May raise error, so returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_regexp_prototype_exec (ecma_value_t this_arg, /**< this argument */\n                                    ecma_value_t arg) /**< routine's argument */\n{\n  ecma_value_t obj_this = ecma_op_to_object (this_arg);\n  if (ECMA_IS_VALUE_ERROR (obj_this))\n  {\n    return obj_this;\n  }\n\n  ecma_string_t *input_str_p = ecma_op_to_string (arg);\n  if (JERRY_UNLIKELY (input_str_p == NULL))\n  {\n    ecma_free_value (obj_this);\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t ret_value = ecma_regexp_exec_helper (ecma_get_object_from_value (obj_this), input_str_p);\n\n  ecma_free_value (obj_this);\n  ecma_deref_ecma_string (input_str_p);\n\n  return ret_value;\n} /* ecma_builtin_regexp_prototype_exec */\n\n/**\n * The RegExp.prototype object's 'test' routine\n *\n * See also:\n *          ECMA-262 v5, 15.10.6.3\n *          ECMA-262 v6, 21.2.5.13\n *\n * @return true  - if match is not null\n *         false - otherwise\n *\n *         May raise error, so returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_regexp_prototype_test (ecma_value_t this_arg, /**< this argument */\n                                    ecma_value_t arg) /**< routine's argument */\n{\n  ecma_string_t *arg_str_p = ecma_op_to_string (arg);\n\n  if (JERRY_UNLIKELY (arg_str_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ecma_op_regexp_exec (this_arg, arg_str_p);\n\n  ecma_deref_ecma_string (arg_str_p);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  ecma_value_t ret_value = ecma_make_boolean_value (!ecma_is_value_null (result));\n  ecma_free_value (result);\n\n  return ret_value;\n} /* ecma_builtin_regexp_prototype_test */\n\n/**\n * The RegExp.prototype object's 'toString' routine\n *\n * See also:\n *          ECMA-262 v5, 15.10.6.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_regexp_prototype_to_string (ecma_object_t *object_p) /**< this object */\n{\n  ecma_value_t result = ecma_op_object_get_by_magic_id (object_p, LIT_MAGIC_STRING_SOURCE);\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  ecma_string_t *source_p = ecma_op_to_string (result);\n  ecma_free_value (result);\n\n  if (source_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  result = ecma_op_object_get_by_magic_id (object_p, LIT_MAGIC_STRING_FLAGS);\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    ecma_deref_ecma_string (source_p);\n    return result;\n  }\n\n  ecma_string_t *flags_p = ecma_op_to_string (result);\n  ecma_free_value (result);\n\n  if (flags_p == NULL)\n  {\n    ecma_deref_ecma_string (source_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n  ecma_stringbuilder_append_byte (&builder, LIT_CHAR_SLASH);\n  ecma_stringbuilder_append (&builder, source_p);\n  ecma_stringbuilder_append_byte (&builder, LIT_CHAR_SLASH);\n  ecma_stringbuilder_append (&builder, flags_p);\n\n  ecma_deref_ecma_string (source_p);\n  ecma_deref_ecma_string (flags_p);\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_regexp_prototype_to_string */\n\n/**\n * The RegExp.prototype object's 'matchAll' routine\n *\n * See also:\n *          ECMA-262 v11, 21.2.5.8\n *\n * @return ecma_value_t\n */\nstatic ecma_value_t\necma_builtin_regexp_prototype_match_all (ecma_object_t *regexp_obj_p, /**< this argument */\n                                         ecma_value_t string_arg) /**< source string */\n{\n  /* 3. */\n  ecma_string_t *str_p = ecma_op_to_string (string_arg);\n\n  if (JERRY_UNLIKELY (str_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 4. */\n  ecma_value_t constructor = ecma_op_species_constructor (regexp_obj_p, ECMA_BUILTIN_ID_REGEXP);\n\n  if (ECMA_IS_VALUE_ERROR (constructor))\n  {\n    ecma_deref_ecma_string (str_p);\n    return constructor;\n  }\n\n  /* 5. */\n  ecma_value_t get_flag = ecma_op_object_get_by_magic_id (regexp_obj_p, LIT_MAGIC_STRING_FLAGS);\n\n  if (ECMA_IS_VALUE_ERROR (get_flag))\n  {\n    ecma_deref_ecma_string (str_p);\n    ecma_free_value (constructor);\n    return get_flag;\n  }\n\n  ecma_string_t *flags = ecma_op_to_string (get_flag);\n\n  ecma_free_value (get_flag);\n\n  if (JERRY_UNLIKELY (flags == NULL))\n  {\n    ecma_deref_ecma_string (str_p);\n    ecma_free_value (constructor);\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 6. */\n  ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor);\n  ecma_value_t flags_value = ecma_make_string_value (flags);\n  ecma_value_t match_args[] = { ecma_make_object_value (regexp_obj_p), flags_value };\n  ecma_value_t matcher = ecma_op_function_construct (constructor_obj_p, constructor_obj_p, match_args, 2);\n\n  ecma_deref_object (constructor_obj_p);\n\n  if (ECMA_IS_VALUE_ERROR (matcher))\n  {\n    ecma_deref_ecma_string (str_p);\n    ecma_deref_ecma_string (flags);\n    return matcher;\n  }\n\n  /* 7. */\n  ecma_value_t get_last_index = ecma_op_object_get_by_magic_id (regexp_obj_p, LIT_MAGIC_STRING_LASTINDEX_UL);\n\n  if (ECMA_IS_VALUE_ERROR (get_last_index))\n  {\n    ecma_deref_ecma_string (str_p);\n    ecma_deref_ecma_string (flags);\n    ecma_free_value (matcher);\n    return get_last_index;\n  }\n\n  ecma_length_t last_index;\n  ecma_value_t to_len = ecma_op_to_length (get_last_index, &last_index);\n\n  ecma_free_value (get_last_index);\n\n  if (ECMA_IS_VALUE_ERROR (to_len))\n  {\n    ecma_deref_ecma_string (str_p);\n    ecma_deref_ecma_string (flags);\n    ecma_free_value (matcher);\n    return to_len;\n  }\n\n  /* 8. */\n  ecma_object_t *matcher_obj_p = ecma_get_object_from_value (matcher);\n  ecma_value_t last_index_value = ecma_make_length_value (last_index);\n  ecma_value_t set =\n    ecma_op_object_put (matcher_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), last_index_value, true);\n\n  ecma_free_value (last_index_value);\n\n  if (ECMA_IS_VALUE_ERROR (set))\n  {\n    ecma_deref_ecma_string (str_p);\n    ecma_deref_ecma_string (flags);\n    ecma_deref_object (matcher_obj_p);\n  }\n\n  uint16_t parsed_flag;\n  ecma_value_t flag_parse = ecma_regexp_parse_flags (flags, &parsed_flag);\n\n  ecma_deref_ecma_string (flags);\n\n  if (ECMA_IS_VALUE_ERROR (flag_parse))\n  {\n    ecma_deref_ecma_string (str_p);\n    ecma_deref_object (matcher_obj_p);\n    return flag_parse;\n  }\n\n  /* 13. */\n  ecma_object_t *result_obj;\n  ecma_object_t *proto_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_STRING_ITERATOR_PROTOTYPE);\n  result_obj = ecma_create_object (proto_p, sizeof (ecma_regexp_string_iterator_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) result_obj;\n  ext_obj_p->u.cls.type = ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR;\n  ext_obj_p->u.cls.u1.regexp_string_iterator_flags = (uint8_t) (parsed_flag & (RE_FLAG_GLOBAL | RE_FLAG_UNICODE));\n\n  ecma_regexp_string_iterator_t *regexp_string_iterator_obj = (ecma_regexp_string_iterator_t *) result_obj;\n\n  regexp_string_iterator_obj->iterating_regexp = matcher;\n  regexp_string_iterator_obj->iterated_string = ecma_make_string_value (str_p);\n\n  ecma_deref_object (matcher_obj_p);\n\n  return ecma_make_object_value (result_obj);\n} /* ecma_builtin_regexp_prototype_match_all */\n\n/**\n * Dispatcher of the Regexp built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                                ecma_value_t this_arg, /**< 'this' argument value */\n                                                const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                        *   passed to routine */\n                                                uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n\n  ecma_object_t *obj_p = NULL;\n\n  /* 1. && 2. */\n  if (ecma_is_value_object (this_arg))\n  {\n    obj_p = ecma_get_object_from_value (this_arg);\n\n    if (builtin_routine_id < ECMA_REGEXP_PROTOTYPE_ROUTINE_TEST\n        && !ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_REGEXP))\n    {\n      obj_p = NULL;\n    }\n  }\n\n  if (obj_p == NULL)\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  switch (builtin_routine_id)\n  {\n#if JERRY_BUILTIN_ANNEXB\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_COMPILE:\n    {\n      return ecma_builtin_regexp_prototype_compile (this_arg, arguments_list_p[0], arguments_list_p[1]);\n    }\n#endif /* JERRY_BUILTIN_ANNEXB */\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_TEST:\n    {\n      return ecma_builtin_regexp_prototype_test (this_arg, arguments_list_p[0]);\n    }\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_EXEC:\n    {\n      return ecma_builtin_regexp_prototype_exec (this_arg, arguments_list_p[0]);\n    }\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_TO_STRING:\n    {\n      return ecma_builtin_regexp_prototype_to_string (obj_p);\n    }\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_SEARCH:\n    {\n      return ecma_regexp_search_helper (this_arg, arguments_list_p[0]);\n    }\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_MATCH:\n    {\n      return ecma_regexp_match_helper (this_arg, arguments_list_p[0]);\n    }\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_MATCH_ALL:\n    {\n      return ecma_builtin_regexp_prototype_match_all (obj_p, arguments_list_p[0]);\n    }\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_REPLACE:\n    {\n      return ecma_regexp_replace_helper (this_arg, arguments_list_p[0], arguments_list_p[1]);\n    }\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_SPLIT:\n    {\n      return ecma_regexp_split_helper (this_arg, arguments_list_p[0], arguments_list_p[1]);\n    }\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_FLAGS:\n    {\n      return ecma_builtin_regexp_prototype_get_flags (obj_p);\n    }\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_SOURCE:\n    {\n      if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_REGEXP))\n      {\n        if (obj_p == ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE))\n        {\n          return ecma_make_magic_string_value (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP);\n        }\n\n        return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_REGEXP);\n      }\n\n      ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p;\n      return ecma_builtin_regexp_prototype_get_source (re_obj_p);\n    }\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL:\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_IGNORE_CASE:\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_MULTILINE:\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_STICKY:\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_UNICODE:\n    case ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_DOT_ALL:\n    {\n      if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_REGEXP))\n      {\n        if (obj_p == ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE))\n        {\n          return ECMA_VALUE_UNDEFINED;\n        }\n\n        return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_REGEXP);\n      }\n\n      ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p;\n      return ecma_builtin_regexp_prototype_flags_helper (re_obj_p, builtin_routine_id);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_regexp_prototype_dispatch_routine */\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * RegExp.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n/* ECMA-262 v5, 15.10.6.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_REGEXP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_FLAGS, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_FLAGS, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SOURCE, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_SOURCE, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_GLOBAL, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_IGNORECASE_UL,\n                    ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_IGNORE_CASE,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_DOTALL, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_DOT_ALL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_MULTILINE,\n                    ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_MULTILINE,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_UNICODE,\n                    ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_UNICODE,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_STICKY, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_STICKY, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nROUTINE (LIT_GLOBAL_SYMBOL_REPLACE, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_REPLACE, 2, 2)\nROUTINE (LIT_GLOBAL_SYMBOL_SEARCH, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_SEARCH, 1, 1)\nROUTINE (LIT_GLOBAL_SYMBOL_SPLIT, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_SPLIT, 2, 2)\nROUTINE (LIT_GLOBAL_SYMBOL_MATCH, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_MATCH, 1, 1)\nROUTINE (LIT_GLOBAL_SYMBOL_MATCH_ALL, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_MATCH_ALL, 1, 1)\n\n#if JERRY_BUILTIN_ANNEXB\nROUTINE (LIT_MAGIC_STRING_COMPILE, ECMA_REGEXP_PROTOTYPE_ROUTINE_COMPILE, 2, 2)\n#endif /* JERRY_BUILTIN_ANNEXB */\nROUTINE (LIT_MAGIC_STRING_EXEC, ECMA_REGEXP_PROTOTYPE_ROUTINE_EXEC, 1, 1)\nROUTINE (LIT_MAGIC_STRING_TEST, ECMA_REGEXP_PROTOTYPE_ROUTINE_TEST, 1, 1)\nROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_REGEXP_PROTOTYPE_ROUTINE_TO_STRING, 0, 0)\n\n#endif /* JERRY_BUILTIN_REGEXP */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-regexp-string-iterator-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  regexp_string_iterator_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup %regexpstringiteratorprototype% ECMA %ArrayIteratorPrototype% object built-in\n * @{\n */\n\n/**\n * The %RegExpStringIteratorPrototype% object's 'next' routine\n *\n * See also:\n *          ECMA-262 v11, 21.2.7.1.1\n *\n * Note:\n *     Returned value must be freed with ecma_free_value.\n *\n * @return iterator result object, if success\n *         error - otherwise\n */\nstatic ecma_value_t\necma_builtin_regexp_string_iterator_prototype_object_next (ecma_value_t this_val) /**< this argument */\n{\n  /* 2. */\n  if (!ecma_is_value_object (this_val))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (this_val);\n\n  /* 3. */\n  if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_ITERATOR);\n  }\n\n  ecma_regexp_string_iterator_t *regexp_string_iterator_obj = (ecma_regexp_string_iterator_t *) obj_p;\n\n  /* 4. */\n  if (ecma_is_value_empty (regexp_string_iterator_obj->iterated_string))\n  {\n    return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n  }\n\n  /* 5. */\n  ecma_value_t regexp = regexp_string_iterator_obj->iterating_regexp;\n\n  /* 6. */\n  ecma_value_t matcher_str_value = regexp_string_iterator_obj->iterated_string;\n  ecma_string_t *matcher_str_p = ecma_get_string_from_value (matcher_str_value);\n\n  /* 9. */\n  ecma_value_t match = ecma_op_regexp_exec (regexp, matcher_str_p);\n\n  if (ECMA_IS_VALUE_ERROR (match))\n  {\n    return match;\n  }\n\n  /* 10. */\n  if (ecma_is_value_null (match))\n  {\n    ecma_free_value (regexp_string_iterator_obj->iterated_string);\n    regexp_string_iterator_obj->iterated_string = ECMA_VALUE_EMPTY;\n    return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n  }\n\n  ecma_object_t *match_result_array_p = ecma_get_object_from_value (match);\n\n  ecma_value_t result = ECMA_VALUE_ERROR;\n\n  /* 11. */\n  if (regexp_string_iterator_obj->header.u.cls.u1.regexp_string_iterator_flags & RE_FLAG_GLOBAL)\n  {\n    ecma_value_t matched_str_value = ecma_op_object_get_by_index (match_result_array_p, 0);\n\n    if (ECMA_IS_VALUE_ERROR (matched_str_value))\n    {\n      goto free_variables;\n    }\n\n    ecma_string_t *matched_str_p = ecma_op_to_string (matched_str_value);\n\n    ecma_free_value (matched_str_value);\n\n    if (JERRY_UNLIKELY (matched_str_p == NULL))\n    {\n      goto free_variables;\n    }\n\n    if (ecma_string_is_empty (matched_str_p))\n    {\n      ecma_object_t *regexp_obj_p = ecma_get_object_from_value (regexp);\n\n      ecma_value_t get_last_index = ecma_op_object_get_by_magic_id (regexp_obj_p, LIT_MAGIC_STRING_LASTINDEX_UL);\n\n      if (ECMA_IS_VALUE_ERROR (get_last_index))\n      {\n        goto free_variables;\n      }\n\n      ecma_length_t this_index;\n      ecma_value_t to_len = ecma_op_to_length (get_last_index, &this_index);\n\n      ecma_free_value (get_last_index);\n\n      if (ECMA_IS_VALUE_ERROR (to_len))\n      {\n        goto free_variables;\n      }\n\n      uint8_t flags = regexp_string_iterator_obj->header.u.cls.u1.regexp_string_iterator_flags;\n      ecma_length_t next_index =\n        ecma_op_advance_string_index (matcher_str_p, this_index, (flags & RE_FLAG_UNICODE) != 0);\n\n      ecma_value_t next_index_value = ecma_make_length_value (next_index);\n      ecma_value_t set = ecma_op_object_put (regexp_obj_p,\n                                             ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),\n                                             next_index_value,\n                                             true);\n\n      ecma_free_value (next_index_value);\n\n      if (ECMA_IS_VALUE_ERROR (set))\n      {\n        goto free_variables;\n      }\n    }\n    else\n    {\n      ecma_deref_ecma_string (matched_str_p);\n    }\n  }\n  else\n  {\n    ecma_free_value (regexp_string_iterator_obj->iterated_string);\n    regexp_string_iterator_obj->iterated_string = ECMA_VALUE_EMPTY;\n  }\n\n  result = ecma_create_iter_result_object (match, ECMA_VALUE_FALSE);\n\nfree_variables:\n  ecma_deref_object (match_result_array_p);\n\n  return result;\n} /* ecma_builtin_regexp_string_iterator_prototype_object_next */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %RegExpStringIteratorPrototype% built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,\n              LIT_MAGIC_STRING_REGEXP_STRING_ITERATOR_UL,\n              ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_NEXT, ecma_builtin_regexp_string_iterator_prototype_object_next, 0, 0)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-regexp-object.h\"\n\n#include \"jcontext.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-regexp.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  regexp\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup regexp ECMA RegExp object built-in\n * @{\n */\n\nstatic ecma_value_t\necma_builtin_regexp_dispatch_helper (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                     uint32_t arguments_list_len) /**< number of arguments */\n{\n  ecma_value_t pattern_value = ECMA_VALUE_UNDEFINED;\n  ecma_value_t flags_value = ECMA_VALUE_UNDEFINED;\n  bool create_regexp_from_bc = false;\n  bool free_arguments = false;\n  ecma_object_t *new_target_p = JERRY_CONTEXT (current_new_target_p);\n\n  if (arguments_list_len > 0)\n  {\n    /* pattern string or RegExp object */\n    pattern_value = arguments_list_p[0];\n\n    if (arguments_list_len > 1)\n    {\n      flags_value = arguments_list_p[1];\n    }\n  }\n\n  ecma_value_t regexp_value = ecma_op_is_regexp (pattern_value);\n\n  if (ECMA_IS_VALUE_ERROR (regexp_value))\n  {\n    return regexp_value;\n  }\n\n  bool pattern_is_regexp = regexp_value == ECMA_VALUE_TRUE;\n  re_compiled_code_t *bc_p = NULL;\n\n  if (new_target_p == NULL)\n  {\n    new_target_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP);\n\n    if (pattern_is_regexp && ecma_is_value_undefined (flags_value))\n    {\n      ecma_object_t *pattern_obj_p = ecma_get_object_from_value (pattern_value);\n\n      ecma_value_t pattern_constructor = ecma_op_object_get_by_magic_id (pattern_obj_p, LIT_MAGIC_STRING_CONSTRUCTOR);\n\n      if (ECMA_IS_VALUE_ERROR (pattern_constructor))\n      {\n        return pattern_constructor;\n      }\n\n      bool is_same = ecma_op_same_value (ecma_make_object_value (new_target_p), pattern_constructor);\n      ecma_free_value (pattern_constructor);\n\n      if (is_same)\n      {\n        return ecma_copy_value (pattern_value);\n      }\n    }\n  }\n\n  if (ecma_object_is_regexp_object (pattern_value))\n  {\n    ecma_extended_object_t *pattern_obj_p = (ecma_extended_object_t *) ecma_get_object_from_value (pattern_value);\n    bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, pattern_obj_p->u.cls.u3.value);\n\n    create_regexp_from_bc = ecma_is_value_undefined (flags_value);\n\n    if (!create_regexp_from_bc)\n    {\n      pattern_value = bc_p->source;\n    }\n  }\n  else if (pattern_is_regexp)\n  {\n    ecma_object_t *pattern_obj_p = ecma_get_object_from_value (pattern_value);\n\n    pattern_value = ecma_op_object_get_by_magic_id (pattern_obj_p, LIT_MAGIC_STRING_SOURCE);\n\n    if (ECMA_IS_VALUE_ERROR (pattern_value))\n    {\n      return pattern_value;\n    }\n\n    if (ecma_is_value_undefined (flags_value))\n    {\n      flags_value = ecma_op_object_get_by_magic_id (pattern_obj_p, LIT_MAGIC_STRING_FLAGS);\n\n      if (ECMA_IS_VALUE_ERROR (flags_value))\n      {\n        ecma_free_value (pattern_value);\n        return flags_value;\n      }\n    }\n    else\n    {\n      flags_value = ecma_copy_value (flags_value);\n    }\n\n    free_arguments = true;\n  }\n\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n  ecma_object_t *new_target_obj_p = ecma_op_regexp_alloc (new_target_p);\n\n  if (JERRY_LIKELY (new_target_obj_p != NULL))\n  {\n    if (create_regexp_from_bc)\n    {\n      ret_value = ecma_op_create_regexp_from_bytecode (new_target_obj_p, bc_p);\n      JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (ret_value));\n    }\n    else\n    {\n      ret_value = ecma_op_create_regexp_from_pattern (new_target_obj_p, pattern_value, flags_value);\n\n      if (ECMA_IS_VALUE_ERROR (ret_value))\n      {\n        ecma_deref_object (new_target_obj_p);\n      }\n    }\n  }\n\n  if (free_arguments)\n  {\n    ecma_free_value (pattern_value);\n    ecma_free_value (flags_value);\n  }\n\n  return ret_value;\n} /* ecma_builtin_regexp_dispatch_helper */\n\n/**\n * Handle calling [[Call]] of built-in RegExp object\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_regexp_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                   uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_regexp_dispatch_helper (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_regexp_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in RegExp object\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_regexp_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                        uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_regexp_dispatch_helper (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_regexp_dispatch_construct */\n\n/**\n * 21.2.4.2 get RegExp [ @@species ] accessor\n *\n * @return ecma_value\n *         returned value must be freed with ecma_free_value\n */\necma_value_t\necma_builtin_regexp_species_get (ecma_value_t this_value) /**< This Value */\n{\n  return ecma_copy_value (this_value);\n} /* ecma_builtin_regexp_species_get */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-regexp.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * RegExp built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 2, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* ECMA-262 v5, 15.10.5.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_REGEXP_PROTOTYPE, ECMA_PROPERTY_FIXED)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_REGEXP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 21.2.4.2 */\nACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_regexp_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_REGEXP */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-container-object.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BUILTIN_SET_ITERATOR_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_BUILTIN_SET_ITERATOR_PROTOTYPE_OBJECT_NEXT,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-set-iterator-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  set_iterator_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup %setiteratorprototype% ECMA %SetIteratorPrototype% object built-in\n * @{\n */\n\n/**\n * The %SetIteratorPrototype% object's 'next' routine\n *\n * See also:\n *          ECMA-262 v6, 23.2.5.2.1\n *\n * Note:\n *     Returned value must be freed with ecma_free_value.\n *\n * @return iterator result object, if success\n *         error - otherwise\n */\nstatic ecma_value_t\necma_builtin_set_iterator_prototype_object_next (ecma_value_t this_val) /**< this argument */\n{\n  return ecma_op_container_iterator_next (this_val, ECMA_OBJECT_CLASS_SET_ITERATOR);\n} /* ecma_builtin_set_iterator_prototype_object_next */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_set_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide\n                                                                                   *routine identifier */\n                                                      ecma_value_t this_arg, /**< 'this' argument value */\n                                                      const ecma_value_t arguments_list[], /**< list of arguments\n                                                                                            *   passed to routine */\n                                                      uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (arguments_list, arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_BUILTIN_SET_ITERATOR_PROTOTYPE_OBJECT_NEXT:\n    {\n      return ecma_builtin_set_iterator_prototype_object_next (this_arg);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_set_iterator_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %SetIteratorPrototype% built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SET_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_NEXT, ECMA_BUILTIN_SET_ITERATOR_PROTOTYPE_OBJECT_NEXT, 0, 0)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-container-object.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-set-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  set_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup set ECMA Set object built-in\n * @{\n */\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_set_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                             ecma_value_t this_arg, /**< 'this' argument value */\n                                             const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                     *   passed to routine */\n                                             uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n  return ecma_builtin_container_dispatch_routine (builtin_routine_id,\n                                                  this_arg,\n                                                  arguments_list_p,\n                                                  LIT_MAGIC_STRING_SET_UL);\n} /* ecma_builtin_set_prototype_dispatch_routine */\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Set.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 23.2.3.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 23.1.3.13 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_CLEAR, ECMA_CONTAINER_ROUTINE_CLEAR, 0, 0)\nROUTINE (LIT_MAGIC_STRING_ADD, ECMA_CONTAINER_ROUTINE_ADD, 1, 1)\nROUTINE (LIT_MAGIC_STRING_DELETE, ECMA_CONTAINER_ROUTINE_DELETE, 1, 1)\nROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_CONTAINER_ROUTINE_FOREACH, 2, 1)\nROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_ENTRIES, ECMA_CONTAINER_ROUTINE_ENTRIES, 0, 0)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES,\n                    LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES,\n                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR,\n                    LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES,\n                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_KEYS,\n                    LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES,\n                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE, ECMA_CONTAINER_ROUTINE_SIZE_GETTER, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-set.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-container-object.h\"\n#include \"ecma-exceptions.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-set.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  set\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup set ECMA Set object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in Set object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_set_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_SET_REQUIRES_NEW);\n} /* ecma_builtin_set_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Map object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_set_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                     uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_op_container_create (arguments_list_p,\n                                   arguments_list_len,\n                                   LIT_MAGIC_STRING_SET_UL,\n                                   ECMA_BUILTIN_ID_SET_PROTOTYPE);\n} /* ecma_builtin_set_dispatch_construct */\n\n/**\n * 23.2.2.2 get Set [ @@species ] accessor\n *\n * @return ecma_value\n *         returned value must be freed with ecma_free_value\n */\necma_value_t\necma_builtin_set_species_get (ecma_value_t this_value) /**< This Value */\n{\n  return ecma_copy_value (this_value);\n} /* ecma_builtin_set_species_get */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-set.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Set built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\n/* ECMA-262 v6, 23.2.2 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 23.1 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 23.2.2.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SET_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v6, 23.2.2.2 */\nACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_set_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-shared-arraybuffer-object.h\"\n\n#include \"jrt-libc-includes.h\"\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-shared-arraybuffer-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  shared_arraybuffer_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup sharedarraybufferprototype ECMA SharedArrayBuffer.prototype object built-in\n * @{\n */\n\n/**\n * The SharedArrayBuffer.prototype.bytelength accessor\n *\n * See also:\n *          ES11, 24.2.4.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_shared_arraybuffer_prototype_bytelength_getter (ecma_value_t this_arg) /**< this argument */\n{\n  if (ecma_is_value_object (this_arg))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER))\n    {\n      uint32_t len = ecma_arraybuffer_get_length (object_p);\n\n      return ecma_make_uint32_value (len);\n    }\n  }\n\n  return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER);\n} /* ecma_builtin_shared_arraybuffer_prototype_bytelength_getter */\n\n/**\n * The SharedArrayBuffer.prototype object's 'slice' routine\n *\n * See also:\n *          ECMA-262 v11, 24.2.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_shared_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< this argument */\n                                                        const ecma_value_t *argument_list_p, /**< arguments list */\n                                                        uint32_t arguments_number) /**< number of arguments */\n{\n  if (!ecma_is_value_object (this_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n  /* 2. */\n  if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER_OBJECT);\n  }\n\n  return ecma_builtin_arraybuffer_slice (this_arg, argument_list_p, arguments_number);\n} /* ecma_builtin_shared_arraybuffer_prototype_object_slice */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * SharedArrayBuffer.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* Readonly accessor properties */\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,\n                    ecma_builtin_shared_arraybuffer_prototype_bytelength_getter,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v11, 24.2.4.4 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_SLICE, ecma_builtin_shared_arraybuffer_prototype_object_slice, NON_FIXED, 2)\n\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-dataview-object.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-shared-arraybuffer-object.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-shared-arraybuffer.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  shared_arraybuffer\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup sharedarraybuffer ECMA SharedArrayBuffer object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in SharedArrayBuffer object\n *\n * ES11 24.2.2 SharedArrayBuffer is not intended to be called as\n * a function and will throw an exception when called in\n * that manner.\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_shared_arraybuffer_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                               uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_SHAREDARRAYBUFFER_REQUIRES_NEW);\n} /* ecma_builtin_shared_arraybuffer_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in SharedArrayBuffer object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_shared_arraybuffer_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                    uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_op_create_shared_arraybuffer_object (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_shared_arraybuffer_dispatch_construct */\n\n/**\n * 24.2.3.2 get SharedArrayBuffer [ @@species ] accessor\n *\n * @return ecma_value\n *         returned value must be freed with ecma_free_value\n */\necma_value_t\necma_builtin_shared_arraybuffer_species_get (ecma_value_t this_value) /**< This Value */\n{\n  return ecma_copy_value (this_value);\n} /* ecma_builtin_shared_arraybuffer_species_get */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * SharedArrayBuffer built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\n\n/* ES11 24.1.3.3 */\nACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,\n                    ecma_builtin_shared_arraybuffer_species_get,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-iterator-object.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BUILTIN_STRING_ITERATOR_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_BUILTIN_STRING_ITERATOR_PROTOTYPE_OBJECT_NEXT,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-string-iterator-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  string_iterator_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup %stringiteratorprototype% ECMA %ArrayIteratorPrototype% object built-in\n * @{\n */\n\n/**\n * The %StringIteratorPrototype% object's 'next' routine\n *\n * See also:\n *          ECMA-262 v6, 22.1.5.2.1\n *\n * Note:\n *     Returned value must be freed with ecma_free_value.\n *\n * @return iterator result object, if success\n *         error - otherwise\n */\nstatic ecma_value_t\necma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**< this argument */\n{\n  /* 1 - 2. */\n  if (!ecma_is_value_object (this_val))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (this_val);\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n  /* 3. */\n  if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_STRING_ITERATOR))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_ITERATOR);\n  }\n\n  ecma_value_t iterated_value = ext_obj_p->u.cls.u3.iterated_value;\n\n  /* 4 - 5 */\n  if (ecma_is_value_empty (iterated_value))\n  {\n    return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n  }\n\n  JERRY_ASSERT (ecma_is_value_string (iterated_value));\n\n  ecma_string_t *string_p = ecma_get_string_from_value (iterated_value);\n\n  /* 6. */\n  lit_utf8_size_t position = ext_obj_p->u.cls.u2.iterator_index;\n\n  if (JERRY_UNLIKELY (position == ECMA_ITERATOR_INDEX_LIMIT))\n  {\n    /* After the ECMA_ITERATOR_INDEX_LIMIT limit is reached the [[%Iterator%NextIndex]]\n       property is stored as an internal property */\n    ecma_string_t *prop_name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_ITERATOR_NEXT_INDEX);\n    ecma_value_t position_value = ecma_op_object_get (obj_p, prop_name_p);\n\n    position = (lit_utf8_size_t) (ecma_get_number_from_value (position_value));\n    ecma_free_value (position_value);\n  }\n\n  /* 7. */\n  lit_utf8_size_t len = ecma_string_get_length (string_p);\n\n  /* 8. */\n  if (position >= len)\n  {\n    ecma_deref_ecma_string (string_p);\n    ext_obj_p->u.cls.u3.iterated_value = ECMA_VALUE_EMPTY;\n    return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n  }\n\n  /* 9. */\n  ecma_char_t first = ecma_string_get_char_at_pos (string_p, position);\n\n  ecma_string_t *result_str_p;\n  lit_utf8_size_t result_size = 1;\n\n  /* 10. */\n  if (first < LIT_UTF16_HIGH_SURROGATE_MIN || first > LIT_UTF16_HIGH_SURROGATE_MAX || (position + 1 == len))\n  {\n    result_str_p = ecma_new_ecma_string_from_code_unit (first);\n  }\n  /* 11. */\n  else\n  {\n    /* 11.a */\n    ecma_char_t second = ecma_string_get_char_at_pos (string_p, position + 1);\n\n    /* 11.b */\n    if (second < LIT_UTF16_LOW_SURROGATE_MIN || second > LIT_UTF16_LOW_SURROGATE_MAX)\n    {\n      result_str_p = ecma_new_ecma_string_from_code_unit (first);\n    }\n    /* 11.c */\n    else\n    {\n      result_str_p = ecma_new_ecma_string_from_code_units (first, second);\n      result_size = 2;\n    }\n  }\n\n  /* 13. */\n  if (position + result_size < ECMA_ITERATOR_INDEX_LIMIT)\n  {\n    ext_obj_p->u.cls.u2.iterator_index = (uint16_t) (position + result_size);\n  }\n  else\n  {\n    ext_obj_p->u.cls.u2.iterator_index = ECMA_ITERATOR_INDEX_LIMIT;\n\n    ecma_string_t *prop_name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_ITERATOR_NEXT_INDEX);\n    ecma_value_t put_result =\n      ecma_op_object_put (obj_p, prop_name_p, ecma_make_length_value (position + result_size), true);\n\n    JERRY_ASSERT (ecma_is_value_true (put_result));\n  }\n\n  /* 14. */\n  ecma_value_t result = ecma_create_iter_result_object (ecma_make_string_value (result_str_p), ECMA_VALUE_FALSE);\n  ecma_deref_ecma_string (result_str_p);\n\n  return result;\n} /* ecma_builtin_string_iterator_prototype_object_next */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_string_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide\n                                                                                      *   routine identifier */\n                                                         ecma_value_t this_arg, /**< 'this' argument value */\n                                                         const ecma_value_t arguments_list_p[], /**<\n                                                                                                 * list of arguments\n                                                                                                 * passed to routine */\n                                                         uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (arguments_list_p, arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_BUILTIN_STRING_ITERATOR_PROTOTYPE_OBJECT_NEXT:\n    {\n      return ecma_builtin_string_iterator_prototype_object_next (this_arg);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_string_iterator_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %StringIteratorPrototype% built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_STRING_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_NEXT, ECMA_BUILTIN_STRING_ITERATOR_PROTOTYPE_OBJECT_NEXT, 0, 0)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtin-regexp.inc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jcontext.h\"\n#include \"jrt-libc-includes.h\"\n#include \"jrt.h\"\n#include \"lit-char-helpers.h\"\n#include \"lit-strings.h\"\n\n#if JERRY_BUILTIN_REGEXP\n#include \"ecma-regexp-object.h\"\n#endif /* JERRY_BUILTIN_REGEXP */\n\n#if JERRY_BUILTIN_STRING\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_STRING_PROTOTYPE_ROUTINE_START = 0,\n  /* Note: These 4 routines MUST be in this order */\n  ECMA_STRING_PROTOTYPE_TO_STRING,\n  ECMA_STRING_PROTOTYPE_VALUE_OF,\n  ECMA_STRING_PROTOTYPE_CHAR_AT,\n  ECMA_STRING_PROTOTYPE_CHAR_CODE_AT,\n\n  ECMA_STRING_PROTOTYPE_CONCAT,\n  ECMA_STRING_PROTOTYPE_SLICE,\n  ECMA_STRING_PROTOTYPE_AT,\n\n  ECMA_STRING_PROTOTYPE_LOCALE_COMPARE,\n\n  ECMA_STRING_PROTOTYPE_MATCH,\n  ECMA_STRING_PROTOTYPE_REPLACE,\n  ECMA_STRING_PROTOTYPE_SEARCH,\n\n  ECMA_STRING_PROTOTYPE_SPLIT,\n  ECMA_STRING_PROTOTYPE_SUBSTRING,\n  ECMA_STRING_PROTOTYPE_TO_LOWER_CASE,\n  ECMA_STRING_PROTOTYPE_TO_LOCAL_LOWER_CASE,\n  ECMA_STRING_PROTOTYPE_TO_UPPER_CASE,\n  ECMA_STRING_PROTOTYPE_TO_LOCAL_UPPER_CASE,\n  ECMA_STRING_PROTOTYPE_TRIM,\n\n  ECMA_STRING_PROTOTYPE_SUBSTR,\n\n  ECMA_STRING_PROTOTYPE_REPEAT,\n  ECMA_STRING_PROTOTYPE_CODE_POINT_AT,\n  ECMA_STRING_PROTOTYPE_PAD_START,\n  ECMA_STRING_PROTOTYPE_PAD_END,\n  /* Note: These 5 routines MUST be in this order */\n  ECMA_STRING_PROTOTYPE_LAST_INDEX_OF,\n  ECMA_STRING_PROTOTYPE_INDEX_OF,\n  ECMA_STRING_PROTOTYPE_STARTS_WITH,\n  ECMA_STRING_PROTOTYPE_INCLUDES,\n  ECMA_STRING_PROTOTYPE_ENDS_WITH,\n\n  ECMA_STRING_PROTOTYPE_ITERATOR,\n  ECMA_STRING_PROTOTYPE_REPLACE_ALL,\n  ECMA_STRING_PROTOTYPE_MATCH_ALL,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-string-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  string_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup stringprototype ECMA String.prototype object built-in\n * @{\n */\n\n/**\n * The String.prototype object's 'toString' and 'valueOf' routines\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.2\n *          ECMA-262 v5, 15.5.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_to_string (ecma_value_t this_arg) /**< this argument */\n{\n  if (ecma_is_value_string (this_arg))\n  {\n    return ecma_copy_value (this_arg);\n  }\n\n  if (ecma_is_value_object (this_arg))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_STRING))\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      JERRY_ASSERT (ecma_is_value_string (ext_object_p->u.cls.u3.value));\n\n      return ecma_copy_value (ext_object_p->u.cls.u3.value);\n    }\n  }\n\n  return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_STRING_OBJECT);\n} /* ecma_builtin_string_prototype_object_to_string */\n\n/**\n * Helper function for the String.prototype object's 'charAt' and charCodeAt' routine\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_char_at_helper (ecma_value_t this_arg, /**< this argument */\n                                              ecma_value_t arg, /**< routine's argument */\n                                              bool charcode_mode) /**< routine mode */\n{\n  /* 3 */\n  ecma_number_t index_num;\n  ecma_value_t to_num_result = ecma_op_to_integer (arg, &index_num);\n\n  if (JERRY_UNLIKELY (!ecma_is_value_empty (to_num_result)))\n  {\n    return to_num_result;\n  }\n\n  /* 2 */\n  ecma_string_t *original_string_p = ecma_op_to_string (this_arg);\n  if (JERRY_UNLIKELY (original_string_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 4 */\n  const lit_utf8_size_t len = ecma_string_get_length (original_string_p);\n\n  /* 5 */\n  // When index_num is NaN, then the first two comparisons are false\n  if (index_num < 0 || index_num >= len || (ecma_number_is_nan (index_num) && len == 0))\n  {\n    ecma_deref_ecma_string (original_string_p);\n    return (charcode_mode ? ecma_make_nan_value () : ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY));\n  }\n\n  /* 6 */\n  /*\n   * String length is currently uint32_t, but index_num may be bigger,\n   * ToInteger performs floor, while ToUInt32 performs modulo 2^32,\n   * hence after the check 0 <= index_num < len we assume to_uint32 can be used.\n   * We assume to_uint32 (NaN) is 0.\n   */\n  JERRY_ASSERT (ecma_number_is_nan (index_num) || ecma_number_to_uint32 (index_num) == ecma_number_trunc (index_num));\n\n  ecma_char_t new_ecma_char = ecma_string_get_char_at_pos (original_string_p, ecma_number_to_uint32 (index_num));\n  ecma_deref_ecma_string (original_string_p);\n\n  return (charcode_mode ? ecma_make_uint32_value (new_ecma_char)\n                        : ecma_make_string_value (ecma_new_ecma_string_from_code_unit (new_ecma_char)));\n} /* ecma_builtin_string_prototype_char_at_helper */\n\n/**\n * The String.prototype object's 'concat' routine\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.6\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_concat (ecma_string_t *this_string_p, /**< this argument */\n                                             const ecma_value_t *argument_list_p, /**< arguments list */\n                                             uint32_t arguments_number) /**< number of arguments */\n{\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (this_string_p);\n\n  /* 5 */\n  for (uint32_t arg_index = 0; arg_index < arguments_number; ++arg_index)\n  {\n    /* 5a, b */\n    ecma_string_t *get_arg_string_p = ecma_op_to_string (argument_list_p[arg_index]);\n\n    if (JERRY_UNLIKELY (get_arg_string_p == NULL))\n    {\n      ecma_stringbuilder_destroy (&builder);\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_stringbuilder_append (&builder, get_arg_string_p);\n\n    ecma_deref_ecma_string (get_arg_string_p);\n  }\n\n  /* 6 */\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_string_prototype_object_concat */\n\n/**\n * The String.prototype object's 'localeCompare' routine\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.9\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_locale_compare (ecma_string_t *this_string_p, /**< this argument */\n                                                     ecma_value_t arg) /**< routine's argument */\n{\n  /* 3. */\n  ecma_string_t *arg_string_p = ecma_op_to_string (arg);\n\n  if (JERRY_UNLIKELY (arg_string_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_number_t result = ECMA_NUMBER_ZERO;\n\n  if (ecma_compare_ecma_strings_relational (this_string_p, arg_string_p))\n  {\n    result = ECMA_NUMBER_MINUS_ONE;\n  }\n  else if (!ecma_compare_ecma_strings (this_string_p, arg_string_p))\n  {\n    result = ECMA_NUMBER_ONE;\n  }\n  else\n  {\n    result = ECMA_NUMBER_ZERO;\n  }\n\n  ecma_deref_ecma_string (arg_string_p);\n\n  return ecma_make_number_value (result);\n} /* ecma_builtin_string_prototype_object_locale_compare */\n\n#if JERRY_BUILTIN_REGEXP\n/**\n * The String.prototype object's 'match' routine\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.10\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_match (ecma_value_t this_argument, /**< this argument */\n                                            ecma_value_t regexp_arg) /**< routine's argument */\n{\n  /* 3. */\n  if (!(ecma_is_value_undefined (regexp_arg) || ecma_is_value_null (regexp_arg)))\n  {\n    /* 3.a */\n    ecma_value_t matcher = ecma_op_get_method_by_symbol_id (regexp_arg, LIT_GLOBAL_SYMBOL_MATCH);\n\n    /* 3.b */\n    if (ECMA_IS_VALUE_ERROR (matcher))\n    {\n      return matcher;\n    }\n\n    /* 3.c */\n    if (!ecma_is_value_undefined (matcher))\n    {\n      /* 3.c.i */\n      ecma_object_t *matcher_method = ecma_get_object_from_value (matcher);\n      ecma_value_t result = ecma_op_function_call (matcher_method, regexp_arg, &this_argument, 1);\n      ecma_deref_object (matcher_method);\n      return result;\n    }\n  }\n\n  /* 4. */\n  ecma_string_t *this_str_p = ecma_op_to_string (this_argument);\n\n  /* 5. */\n  if (JERRY_UNLIKELY (this_str_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 6. */\n  ecma_object_t *regexp_obj_p = ecma_op_regexp_alloc (NULL);\n\n  if (JERRY_UNLIKELY (regexp_obj_p == NULL))\n  {\n    ecma_deref_ecma_string (this_str_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t new_regexp = ecma_op_create_regexp_from_pattern (regexp_obj_p, regexp_arg, ECMA_VALUE_UNDEFINED);\n\n  /* 7. */\n  if (ECMA_IS_VALUE_ERROR (new_regexp))\n  {\n    ecma_deref_object (regexp_obj_p);\n    ecma_deref_ecma_string (this_str_p);\n    return new_regexp;\n  }\n  ecma_value_t this_str_value = ecma_make_string_value (this_str_p);\n\n  /* 8. */\n  ecma_value_t ret_value = ecma_op_invoke_by_symbol_id (new_regexp, LIT_GLOBAL_SYMBOL_MATCH, &this_str_value, 1);\n\n  ecma_deref_ecma_string (this_str_p);\n  ecma_free_value (new_regexp);\n\n  return ret_value;\n} /* ecma_builtin_string_prototype_object_match */\n\n/**\n * The String.prototype object's 'matchAll' routine\n *\n * See also:\n *          ECMA-262 v11, 21.1.3.12\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_match_all (ecma_value_t this_argument, /**< this argument */\n                                                ecma_value_t regexp_arg) /**< routine's argument */\n{\n  /* 2. */\n  if (!ecma_is_value_null (regexp_arg) && !ecma_is_value_undefined (regexp_arg))\n  {\n    /* 2.a */\n    ecma_value_t is_regexp = ecma_op_is_regexp (regexp_arg);\n\n    if (ECMA_IS_VALUE_ERROR (is_regexp))\n    {\n      return is_regexp;\n    }\n\n    /* 2.b */\n    if (ecma_is_value_true (is_regexp))\n    {\n      /* 2.b.i */\n      ecma_object_t *regexp_obj_p = ecma_get_object_from_value (regexp_arg);\n      ecma_value_t get_flags = ecma_op_object_get_by_magic_id (regexp_obj_p, LIT_MAGIC_STRING_FLAGS);\n\n      if (ECMA_IS_VALUE_ERROR (get_flags))\n      {\n        return get_flags;\n      }\n\n      /* 2.b.ii */\n      if (!ecma_op_require_object_coercible (get_flags))\n      {\n        ecma_free_value (get_flags);\n        return ECMA_VALUE_ERROR;\n      }\n\n      /* 2.b.iii */\n      ecma_string_t *flags = ecma_op_to_string (get_flags);\n\n      ecma_free_value (get_flags);\n\n      if (JERRY_UNLIKELY (flags == NULL))\n      {\n        return ECMA_VALUE_ERROR;\n      }\n\n      uint16_t parsed_flag;\n      ecma_value_t flag_parse = ecma_regexp_parse_flags (flags, &parsed_flag);\n\n      ecma_deref_ecma_string (flags);\n\n      if (ECMA_IS_VALUE_ERROR (flag_parse))\n      {\n        return flag_parse;\n      }\n\n      if (!(parsed_flag & RE_FLAG_GLOBAL))\n      {\n        return ecma_raise_type_error (ECMA_ERR_REGEXP_ARGUMENT_SHOULD_HAVE_GLOBAL_FLAG);\n      }\n    }\n\n    /* 2.c */\n    ecma_value_t matcher = ecma_op_get_method_by_symbol_id (regexp_arg, LIT_GLOBAL_SYMBOL_MATCH_ALL);\n\n    if (ECMA_IS_VALUE_ERROR (matcher))\n    {\n      return matcher;\n    }\n\n    /* 2.d */\n    if (!ecma_is_value_undefined (matcher))\n    {\n      /* 2.d.i */\n      ecma_object_t *matcher_method = ecma_get_object_from_value (matcher);\n      ecma_value_t result = ecma_op_function_call (matcher_method, regexp_arg, &this_argument, 1);\n      ecma_deref_object (matcher_method);\n      return result;\n    }\n  }\n\n  /* 3. */\n  ecma_string_t *str_p = ecma_op_to_string (this_argument);\n\n  if (JERRY_UNLIKELY (str_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 4. */\n  ecma_object_t *new_regexp_obj_p = ecma_op_regexp_alloc (NULL);\n\n  if (JERRY_UNLIKELY (new_regexp_obj_p == NULL))\n  {\n    ecma_deref_ecma_string (str_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t new_regexp = ecma_op_create_regexp_from_pattern (new_regexp_obj_p, regexp_arg, ECMA_VALUE_UNDEFINED);\n\n  if (ECMA_IS_VALUE_ERROR (new_regexp))\n  {\n    ecma_deref_ecma_string (str_p);\n    ecma_deref_object (new_regexp_obj_p);\n    return new_regexp;\n  }\n\n  /* 5. */\n  ecma_value_t string_arg = ecma_make_string_value (str_p);\n  ecma_value_t ret_value = ecma_op_invoke_by_symbol_id (new_regexp, LIT_GLOBAL_SYMBOL_MATCH_ALL, &string_arg, 1);\n\n  ecma_deref_ecma_string (str_p);\n  ecma_free_value (new_regexp);\n\n  return ret_value;\n} /* ecma_builtin_string_prototype_object_match_all */\n\n/**\n * The String.prototype object's 'replace' and 'replaceAll' routine\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.11 (replace ES5)\n *          ECMA-262 v6, 21.1.3.14 (replace ES6)\n *          ECMA-262 v12, 21.1.3.18 (replaceAll)\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /**< this argument */\n                                                     ecma_value_t search_value, /**< routine's first argument */\n                                                     ecma_value_t replace_value, /**< routine's second argument */\n                                                     bool replace_all)\n{\n  if (!(ecma_is_value_undefined (search_value) || ecma_is_value_null (search_value)))\n  {\n    if (replace_all)\n    {\n      ecma_value_t is_regexp = ecma_op_is_regexp (search_value);\n\n      if (ECMA_IS_VALUE_ERROR (is_regexp))\n      {\n        return is_regexp;\n      }\n\n      if (ecma_is_value_true (is_regexp))\n      {\n        ecma_object_t *regexp_obj_p = ecma_get_object_from_value (search_value);\n        ecma_value_t get_flags = ecma_op_object_get_by_magic_id (regexp_obj_p, LIT_MAGIC_STRING_FLAGS);\n\n        if (ECMA_IS_VALUE_ERROR (get_flags))\n        {\n          return get_flags;\n        }\n\n        if (!ecma_op_require_object_coercible (get_flags))\n        {\n          ecma_free_value (get_flags);\n          return ECMA_VALUE_ERROR;\n        }\n\n        ecma_string_t *flags = ecma_op_to_string (get_flags);\n\n        ecma_free_value (get_flags);\n\n        if (JERRY_UNLIKELY (flags == NULL))\n        {\n          return ECMA_VALUE_ERROR;\n        }\n\n        bool have_global_flag = lit_find_char_in_string (flags, LIT_CHAR_LOWERCASE_G);\n\n        ecma_deref_ecma_string (flags);\n\n        if (!have_global_flag)\n        {\n          return ecma_raise_type_error (ECMA_ERR_REGEXP_ARGUMENT_SHOULD_HAVE_GLOBAL_FLAG);\n        }\n      }\n    }\n\n    ecma_object_t *obj_p = ecma_get_object_from_value (ecma_op_to_object (search_value));\n    ecma_value_t replace_symbol = ecma_op_object_get_by_symbol_id (obj_p, LIT_GLOBAL_SYMBOL_REPLACE);\n    ecma_deref_object (obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (replace_symbol))\n    {\n      return replace_symbol;\n    }\n\n    if (!ecma_is_value_undefined (replace_symbol) && !ecma_is_value_null (replace_symbol))\n    {\n      ecma_value_t arguments[] = { this_value, replace_value };\n      ecma_value_t replace_result = ecma_op_function_validated_call (replace_symbol, search_value, arguments, 2);\n      ecma_free_value (replace_symbol);\n\n      return replace_result;\n    }\n  }\n\n  ecma_string_t *input_str_p = ecma_op_to_string (this_value);\n\n  if (input_str_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ECMA_VALUE_ERROR;\n\n  ecma_string_t *search_str_p = ecma_op_to_string (search_value);\n  if (search_str_p == NULL)\n  {\n    ecma_deref_ecma_string (input_str_p);\n    return result;\n  }\n\n  ecma_replace_context_t replace_ctx;\n  replace_ctx.capture_count = 0;\n  replace_ctx.u.captures_p = NULL;\n\n  replace_ctx.replace_str_p = NULL;\n  if (!ecma_op_is_callable (replace_value))\n  {\n    replace_ctx.replace_str_p = ecma_op_to_string (replace_value);\n    if (replace_ctx.replace_str_p == NULL)\n    {\n      goto cleanup_search;\n    }\n  }\n\n  uint8_t input_flags = ECMA_STRING_FLAG_IS_ASCII;\n  replace_ctx.string_p = ecma_string_get_chars (input_str_p, &(replace_ctx.string_size), NULL, NULL, &input_flags);\n\n  lit_utf8_size_t search_size;\n  lit_utf8_size_t search_length;\n  uint8_t search_flags = ECMA_STRING_FLAG_IS_ASCII;\n  const lit_utf8_byte_t *search_buf_p =\n    ecma_string_get_chars (search_str_p, &search_size, &search_length, NULL, &search_flags);\n\n  ecma_string_t *result_string_p = NULL;\n\n  if (replace_ctx.string_size >= search_size)\n  {\n    replace_ctx.builder = ecma_stringbuilder_create ();\n    replace_ctx.matched_size = search_size;\n    const lit_utf8_byte_t *const input_end_p = replace_ctx.string_p + replace_ctx.string_size;\n    const lit_utf8_byte_t *const loop_end_p = input_end_p - search_size;\n    const lit_utf8_byte_t *last_match_end_p = replace_ctx.string_p;\n    const lit_utf8_byte_t *curr_p = replace_ctx.string_p;\n\n    lit_utf8_size_t pos = 0;\n    while (curr_p <= loop_end_p)\n    {\n      if (!memcmp (curr_p, search_buf_p, search_size))\n      {\n        const lit_utf8_size_t prefix_size = (lit_utf8_size_t) (curr_p - last_match_end_p);\n        ecma_stringbuilder_append_raw (&replace_ctx.builder, last_match_end_p, prefix_size);\n\n        last_match_end_p = curr_p + search_size;\n\n        if (replace_ctx.replace_str_p == NULL)\n        {\n          ecma_object_t *function_p = ecma_get_object_from_value (replace_value);\n\n          ecma_value_t args[] = { ecma_make_string_value (search_str_p),\n                                  ecma_make_uint32_value (pos),\n                                  ecma_make_string_value (input_str_p) };\n\n          result = ecma_op_function_call (function_p, ECMA_VALUE_UNDEFINED, args, 3);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            ecma_stringbuilder_destroy (&replace_ctx.builder);\n            goto cleanup_replace;\n          }\n\n          ecma_string_t *const result_str_p = ecma_op_to_string (result);\n          ecma_free_value (result);\n\n          if (result_str_p == NULL)\n          {\n            ecma_stringbuilder_destroy (&replace_ctx.builder);\n            result = ECMA_VALUE_ERROR;\n            goto cleanup_replace;\n          }\n\n          ecma_stringbuilder_append (&replace_ctx.builder, result_str_p);\n          ecma_deref_ecma_string (result_str_p);\n        }\n        else\n        {\n          replace_ctx.matched_p = curr_p;\n          replace_ctx.match_byte_pos = (lit_utf8_size_t) (curr_p - replace_ctx.string_p);\n\n          ecma_builtin_replace_substitute (&replace_ctx);\n        }\n\n        if (!replace_all || last_match_end_p == input_end_p)\n        {\n          break;\n        }\n\n        if (search_size != 0)\n        {\n          curr_p = last_match_end_p;\n          pos += search_length;\n          continue;\n        }\n      }\n\n      pos++;\n      lit_utf8_incr (&curr_p);\n    }\n\n    ecma_stringbuilder_append_raw (&replace_ctx.builder,\n                                   last_match_end_p,\n                                   (lit_utf8_size_t) (input_end_p - last_match_end_p));\n    result_string_p = ecma_stringbuilder_finalize (&replace_ctx.builder);\n  }\n\n  if (result_string_p == NULL)\n  {\n    ecma_ref_ecma_string (input_str_p);\n    result_string_p = input_str_p;\n  }\n\n  result = ecma_make_string_value (result_string_p);\n\ncleanup_replace:\n  if (input_flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n  {\n    jmem_heap_free_block ((void *) replace_ctx.string_p, replace_ctx.string_size);\n  }\n\n  if (search_flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n  {\n    jmem_heap_free_block ((void *) search_buf_p, search_size);\n  }\n\n  if (replace_ctx.replace_str_p != NULL)\n  {\n    ecma_deref_ecma_string (replace_ctx.replace_str_p);\n  }\n\ncleanup_search:\n  ecma_deref_ecma_string (search_str_p);\n  ecma_deref_ecma_string (input_str_p);\n\n  return result;\n} /* ecma_builtin_string_prototype_object_replace_helper */\n\n/**\n * The String.prototype object's 'search' routine\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.12\n *          ECMA-262 v6, 21.1.3.15\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_search (ecma_value_t this_value, /**< this argument */\n                                             ecma_value_t regexp_value) /**< routine's argument */\n{\n  if (!(ecma_is_value_undefined (regexp_value) || ecma_is_value_null (regexp_value)))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (ecma_op_to_object (regexp_value));\n    ecma_value_t search_symbol = ecma_op_object_get_by_symbol_id (obj_p, LIT_GLOBAL_SYMBOL_SEARCH);\n    ecma_deref_object (obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (search_symbol))\n    {\n      return search_symbol;\n    }\n\n    if (!ecma_is_value_undefined (search_symbol) && !ecma_is_value_null (search_symbol))\n    {\n      ecma_value_t search_result = ecma_op_function_validated_call (search_symbol, regexp_value, &this_value, 1);\n      ecma_free_value (search_symbol);\n      return search_result;\n    }\n  }\n\n  ecma_value_t result = ECMA_VALUE_ERROR;\n\n  ecma_string_t *string_p = ecma_op_to_string (this_value);\n  if (string_p == NULL)\n  {\n    return result;\n  }\n\n  ecma_string_t *pattern_p = ecma_regexp_read_pattern_str_helper (regexp_value);\n  if (pattern_p == NULL)\n  {\n    ecma_deref_ecma_string (string_p);\n    return result;\n  }\n\n  ecma_object_t *new_regexp_obj_p = ecma_op_regexp_alloc (NULL);\n\n  if (JERRY_UNLIKELY (new_regexp_obj_p == NULL))\n  {\n    ecma_deref_ecma_string (string_p);\n    ecma_deref_ecma_string (pattern_p);\n    return result;\n  }\n\n  ecma_value_t new_regexp =\n    ecma_op_create_regexp_from_pattern (new_regexp_obj_p, ecma_make_string_value (pattern_p), ECMA_VALUE_UNDEFINED);\n\n  ecma_deref_ecma_string (pattern_p);\n\n  if (ECMA_IS_VALUE_ERROR (new_regexp))\n  {\n    ecma_deref_ecma_string (string_p);\n    ecma_deref_object (new_regexp_obj_p);\n    return result;\n  }\n\n  ecma_object_t *regexp_obj_p = ecma_get_object_from_value (new_regexp);\n  ecma_value_t this_str_value = ecma_make_string_value (string_p);\n  result = ecma_op_invoke_by_symbol_id (new_regexp, LIT_GLOBAL_SYMBOL_SEARCH, &this_str_value, 1);\n  ecma_deref_object (regexp_obj_p);\n  ecma_deref_ecma_string (string_p);\n\n  return result;\n} /* ecma_builtin_string_prototype_object_search */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n\n/**\n * The String.prototype object's 'slice' routine\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.13\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_slice (ecma_string_t *get_string_val, /**< this argument */\n                                            ecma_value_t arg1, /**< routine's first argument */\n                                            ecma_value_t arg2) /**< routine's second argument */\n{\n  const lit_utf8_size_t len = ecma_string_get_length (get_string_val);\n\n  /* 4. 6. */\n  lit_utf8_size_t start = 0, end = len;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (arg1, len, &start)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 5. 7. */\n  if (ecma_is_value_undefined (arg2))\n  {\n    end = len;\n  }\n  else\n  {\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (arg2, len, &end)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  JERRY_ASSERT (start <= len && end <= len);\n\n  /* 8-9. */\n  ecma_string_t *new_str_p = ecma_string_substr (get_string_val, start, end);\n\n  return ecma_make_string_value (new_str_p);\n} /* ecma_builtin_string_prototype_object_slice */\n\n/**\n * The String.prototype object's 'at' routine\n *\n * See also:\n *          ECMA-262 Stage 3 Draft Relative Indexing Method proposal\n *          from: https://tc39.es/proposal-relative-indexing-method\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_at (ecma_string_t *string_val, /**< this argument */\n                                         const ecma_value_t index) /**< index argument */\n{\n  ecma_length_t len = (ecma_length_t) ecma_string_get_length (string_val);\n  ecma_length_t res_index;\n  ecma_value_t return_value = ecma_builtin_helper_calculate_index (index, len, &res_index);\n\n  if (return_value != ECMA_VALUE_EMPTY)\n  {\n    return return_value;\n  }\n\n  ecma_char_t character = ecma_string_get_char_at_pos (string_val, (lit_utf8_size_t) res_index);\n\n  return ecma_make_string_value (ecma_new_ecma_string_from_code_unit (character));\n} /* ecma_builtin_string_prototype_object_at */\n\n/**\n * The String.prototype object's 'split' routine\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.14\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_split (ecma_value_t this_value, /**< this argument */\n                                            ecma_value_t separator_value, /**< separator */\n                                            ecma_value_t limit_value) /**< limit */\n{\n  if (!(ecma_is_value_undefined (separator_value) || ecma_is_value_null (separator_value)))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (ecma_op_to_object (separator_value));\n    ecma_value_t split_symbol = ecma_op_object_get_by_symbol_id (obj_p, LIT_GLOBAL_SYMBOL_SPLIT);\n    ecma_deref_object (obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (split_symbol))\n    {\n      return split_symbol;\n    }\n\n    if (!ecma_is_value_undefined (split_symbol) && !ecma_is_value_null (split_symbol))\n    {\n      ecma_value_t arguments[] = { this_value, limit_value };\n      ecma_value_t split_result = ecma_op_function_validated_call (split_symbol, separator_value, arguments, 2);\n      ecma_free_value (split_symbol);\n\n      return split_result;\n    }\n  }\n\n  ecma_value_t result = ECMA_VALUE_ERROR;\n\n  /* 4. */\n  ecma_string_t *string_p = ecma_op_to_string (this_value);\n  if (string_p == NULL)\n  {\n    return result;\n  }\n\n  /* 8. */\n  uint32_t limit = UINT32_MAX - 1;\n\n  if (!ecma_is_value_undefined (limit_value))\n  {\n    /* ECMA-262 v11, 21.1.3.20 6 */\n    ecma_number_t num;\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (limit_value, &num)))\n    {\n      goto cleanup_string;\n    }\n    limit = ecma_number_to_uint32 (num);\n  }\n\n  /* 12. */\n  ecma_string_t *separator_p = ecma_op_to_string (separator_value);\n  if (separator_p == NULL)\n  {\n    goto cleanup_string;\n  }\n\n  /* 6. */\n  ecma_object_t *array_p = ecma_op_new_array_object (0);\n  result = ecma_make_object_value (array_p);\n\n  /* 14. */\n  if (limit == 0)\n  {\n    goto cleanup_separator;\n  }\n\n  /* 6. */\n  lit_utf8_size_t array_length = 0;\n\n  /* 15. */\n  if (ecma_is_value_undefined (separator_value))\n  {\n    ecma_value_t put_result = ecma_builtin_helper_def_prop_by_index (array_p,\n                                                                     array_length,\n                                                                     ecma_make_string_value (string_p),\n                                                                     ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n    JERRY_ASSERT (put_result == ECMA_VALUE_TRUE);\n    goto cleanup_separator;\n  }\n\n  /* 16. */\n  if (ecma_string_is_empty (string_p))\n  {\n    if (!ecma_string_is_empty (separator_p))\n    {\n      ecma_value_t put_result = ecma_builtin_helper_def_prop_by_index (array_p,\n                                                                       array_length,\n                                                                       ecma_make_string_value (string_p),\n                                                                       ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n      JERRY_ASSERT (put_result == ECMA_VALUE_TRUE);\n    }\n\n    goto cleanup_separator;\n  }\n\n  lit_utf8_size_t string_size;\n  uint8_t string_flags = ECMA_STRING_FLAG_IS_ASCII;\n  const lit_utf8_byte_t *string_buffer_p = ecma_string_get_chars (string_p, &string_size, NULL, NULL, &string_flags);\n  lit_utf8_size_t separator_size;\n  uint8_t separator_flags = ECMA_STRING_FLAG_IS_ASCII;\n  const lit_utf8_byte_t *separator_buffer_p =\n    ecma_string_get_chars (separator_p, &separator_size, NULL, NULL, &separator_flags);\n\n  const lit_utf8_byte_t *const string_end_p = string_buffer_p + string_size;\n  const lit_utf8_byte_t *const compare_end_p = JERRY_MIN (string_end_p - separator_size + 1, string_end_p);\n  const lit_utf8_byte_t *current_p = string_buffer_p;\n  const lit_utf8_byte_t *last_str_begin_p = string_buffer_p;\n\n  while (current_p < compare_end_p)\n  {\n    if (!memcmp (current_p, separator_buffer_p, separator_size) && (last_str_begin_p != current_p + separator_size))\n    {\n      ecma_string_t *substr_p =\n        ecma_new_ecma_string_from_utf8 (last_str_begin_p, (lit_utf8_size_t) (current_p - last_str_begin_p));\n      ecma_value_t put_result = ecma_builtin_helper_def_prop_by_index (array_p,\n                                                                       array_length++,\n                                                                       ecma_make_string_value (substr_p),\n                                                                       ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n      JERRY_ASSERT (put_result == ECMA_VALUE_TRUE);\n      ecma_deref_ecma_string (substr_p);\n\n      if (array_length >= limit)\n      {\n        goto cleanup_buffers;\n      }\n\n      current_p += separator_size;\n      last_str_begin_p = current_p;\n      continue;\n    }\n\n    lit_utf8_incr (&current_p);\n  }\n\n  ecma_string_t *end_substr_p =\n    ecma_new_ecma_string_from_utf8 (last_str_begin_p, (lit_utf8_size_t) (string_end_p - last_str_begin_p));\n  ecma_value_t put_result = ecma_builtin_helper_def_prop_by_index (array_p,\n                                                                   array_length,\n                                                                   ecma_make_string_value (end_substr_p),\n                                                                   ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n  JERRY_ASSERT (put_result == ECMA_VALUE_TRUE);\n  ecma_deref_ecma_string (end_substr_p);\n\ncleanup_buffers:\n  if (string_flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n  {\n    jmem_heap_free_block ((void *) string_buffer_p, string_size);\n  }\n\n  if (separator_flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n  {\n    jmem_heap_free_block ((void *) separator_buffer_p, separator_size);\n  }\n\ncleanup_separator:\n  ecma_deref_ecma_string (separator_p);\ncleanup_string:\n  ecma_deref_ecma_string (string_p);\n  return result;\n} /* ecma_builtin_string_prototype_object_split */\n\n/**\n * The String.prototype object's 'substring' routine\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.15\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_substring (ecma_string_t *original_string_p, /**< this argument */\n                                                ecma_value_t arg1, /**< routine's first argument */\n                                                ecma_value_t arg2) /**< routine's second argument */\n{\n  /* 3 */\n  const lit_utf8_size_t len = ecma_string_get_length (original_string_p);\n  lit_utf8_size_t start = 0, end = len;\n\n  /* 4 */\n  ecma_number_t start_num;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (arg1, &start_num)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 6 */\n  start = (uint32_t) JERRY_MIN (JERRY_MAX (start_num, 0), len);\n\n  /* 5 */\n  if (ecma_is_value_undefined (arg2))\n  {\n    end = len;\n  }\n  else\n  {\n    /* 5 part 2 */\n    ecma_number_t end_num;\n\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (arg2, &end_num)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n    /* 7 */\n    end = (uint32_t) JERRY_MIN (JERRY_MAX (end_num, 0), len);\n  }\n\n  JERRY_ASSERT (start <= len && end <= len);\n\n  /* 8 */\n  uint32_t from = start < end ? start : end;\n\n  /* 9 */\n  uint32_t to = start > end ? start : end;\n\n  /* 10 */\n  ecma_string_t *new_str_p = ecma_string_substr (original_string_p, from, to);\n  return ecma_make_string_value (new_str_p);\n} /* ecma_builtin_string_prototype_object_substring */\n\n/**\n * The common implementation of the String.prototype object's\n * 'toLowerCase', 'toLocaleLowerCase', 'toUpperCase', 'toLocalUpperCase' routines\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.16\n *          ECMA-262 v5, 15.5.4.17\n *          ECMA-262 v5, 15.5.4.18\n *          ECMA-262 v5, 15.5.4.19\n *\n * Helper function to convert a string to upper or lower case.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_conversion_helper (ecma_string_t *input_string_p, /**< this argument */\n                                                        bool lower_case) /**< convert to lower (true)\n                                                                          *   or upper (false) case */\n{\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  ECMA_STRING_TO_UTF8_STRING (input_string_p, input_start_p, input_start_size);\n\n  const lit_utf8_byte_t *input_curr_p = input_start_p;\n  const lit_utf8_byte_t *input_str_end_p = input_start_p + input_start_size;\n\n  while (input_curr_p < input_str_end_p)\n  {\n    lit_code_point_t cp = lit_cesu8_read_next (&input_curr_p);\n\n    if (lit_is_code_point_utf16_high_surrogate (cp) && input_curr_p < input_str_end_p)\n    {\n      const ecma_char_t next_ch = lit_cesu8_peek_next (input_curr_p);\n      if (lit_is_code_point_utf16_low_surrogate (next_ch))\n      {\n        cp = lit_convert_surrogate_pair_to_code_point ((ecma_char_t) cp, next_ch);\n        input_curr_p += LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;\n      }\n    }\n\n    if (lower_case)\n    {\n      lit_char_to_lower_case (cp, &builder);\n    }\n    else\n    {\n      lit_char_to_upper_case (cp, &builder);\n    }\n  }\n\n  ECMA_FINALIZE_UTF8_STRING (input_start_p, input_start_size);\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_string_prototype_object_conversion_helper */\n\n/**\n * The String.prototype object's 'trim' routine\n *\n * See also:\n *          ECMA-262 v5, 15.5.4.20\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_trim (ecma_string_t *original_string_p) /**< this argument */\n{\n  ecma_string_t *trimmed_string_p = ecma_string_trim (original_string_p);\n\n  return ecma_make_string_value (trimmed_string_p);\n} /* ecma_builtin_string_prototype_object_trim */\n\n/**\n * The String.prototype object's 'repeat' routine\n *\n * See also:\n *          ECMA-262 v6, 21.1.3.13\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_repeat (ecma_string_t *original_string_p, /**< this argument */\n                                             ecma_value_t repeat) /**< times to repeat */\n{\n  ecma_string_t *ret_string_p;\n\n  /* 4 */\n  ecma_number_t count_number;\n  ecma_value_t count_value = ecma_op_to_integer (repeat, &count_number);\n\n  /* 5 */\n  if (ECMA_IS_VALUE_ERROR (count_value))\n  {\n    return count_value;\n  }\n\n  int32_t repeat_count = ecma_number_to_int32 (count_number);\n\n  bool isNan = ecma_number_is_nan (count_number);\n\n  /* 6, 7 */\n  if (count_number < 0 || (!isNan && ecma_number_is_infinity (count_number)))\n  {\n    return ecma_raise_range_error (ECMA_ERR_INVALID_COUNT_VALUE);\n  }\n\n  lit_utf8_size_t size = ecma_string_get_size (original_string_p);\n\n  if (repeat_count == 0 || size == 0 || isNan)\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  if ((uint32_t) repeat_count >= (ECMA_STRING_SIZE_LIMIT / size))\n  {\n    return ecma_raise_range_error (ECMA_ERR_INVALID_STRING_);\n  }\n\n  lit_utf8_size_t total_size = size * (lit_utf8_size_t) repeat_count;\n\n  JMEM_DEFINE_LOCAL_ARRAY (str_buffer, total_size, lit_utf8_byte_t);\n\n  ecma_string_to_cesu8_bytes (original_string_p, str_buffer, size);\n  lit_utf8_byte_t *buffer_ptr = str_buffer + size;\n\n  for (int32_t n = 1; n < repeat_count; n++)\n  {\n    memcpy (buffer_ptr, str_buffer, size);\n    buffer_ptr += size;\n  }\n\n  ret_string_p = ecma_new_ecma_string_from_utf8 (str_buffer, (lit_utf8_size_t) (buffer_ptr - str_buffer));\n  JMEM_FINALIZE_LOCAL_ARRAY (str_buffer);\n\n  return ecma_make_string_value (ret_string_p);\n} /* ecma_builtin_string_prototype_object_repeat */\n\n/**\n * The String.prototype object's 'codePointAt' routine\n *\n * See also:\n *          ECMA-262 v6, 21.1.3.3\n *\n * @return lit_code_point_t\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_code_point_at (ecma_string_t *this_string_p, /**< this argument */\n                                                    ecma_value_t pos) /**< given position */\n{\n  ecma_number_t pos_num;\n  ecma_value_t error = ecma_op_to_integer (pos, &pos_num);\n\n  if (ECMA_IS_VALUE_ERROR (error))\n  {\n    return error;\n  }\n\n  lit_utf8_size_t length = ecma_string_get_length (this_string_p);\n\n  if (pos_num < 0 || pos_num >= length)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  uint32_t index = (uint32_t) pos_num;\n\n  ecma_char_t first = ecma_string_get_char_at_pos (this_string_p, index);\n\n  if (first < LIT_UTF16_HIGH_SURROGATE_MIN || first > LIT_UTF16_HIGH_SURROGATE_MAX || index + 1 == length)\n  {\n    return ecma_make_uint32_value (first);\n  }\n\n  ecma_char_t second = ecma_string_get_char_at_pos (this_string_p, index + 1);\n\n  if (second < LIT_UTF16_LOW_SURROGATE_MARKER || second > LIT_UTF16_LOW_SURROGATE_MAX)\n  {\n    return ecma_make_uint32_value (first);\n  }\n\n  return ecma_make_uint32_value (lit_convert_surrogate_pair_to_code_point (first, second));\n} /* ecma_builtin_string_prototype_object_code_point_at */\n\n#if JERRY_BUILTIN_ANNEXB\n\n/**\n * The String.prototype object's 'substr' routine\n *\n * See also:\n *          ECMA-262 v5, B.2.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_substr (ecma_string_t *this_string_p, /**< this argument */\n                                             ecma_value_t start, /**< routine's first argument */\n                                             ecma_value_t length) /**< routine's second argument */\n{\n  /* 2. */\n  ecma_number_t start_num;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (start, &start_num)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 3. */\n  ecma_number_t length_num = ecma_number_make_infinity (false);\n\n  if (!ecma_is_value_undefined (length))\n  {\n    ecma_number_t len;\n\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (length, &len)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    length_num = ecma_number_is_nan (len) ? 0 : len;\n  }\n\n  /* 4. */\n  lit_utf8_size_t this_len = ecma_string_get_length (this_string_p);\n\n  /* 5. */\n  uint32_t from = (uint32_t) ((start_num < 0) ? JERRY_MAX (this_len + start_num, 0) : start_num);\n\n  if (from > this_len)\n  {\n    from = this_len;\n  }\n\n  /* 6. */\n  ecma_number_t to_num = JERRY_MIN (JERRY_MAX (length_num, 0), this_len - from);\n\n  /* 7. */\n  uint32_t to = from + (uint32_t) to_num;\n\n  /* 8. */\n  ecma_string_t *new_str_p = ecma_string_substr (this_string_p, from, to);\n  return ecma_make_string_value (new_str_p);\n} /* ecma_builtin_string_prototype_object_substr */\n\n#endif /* JERRY_BUILTIN_ANNEXB */\n\n/**\n * The String.prototype object's @@iterator routine\n *\n * See also:\n *          ECMA-262 v6, 21.1.3.27\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_prototype_object_iterator (ecma_value_t to_string) /**< this argument */\n{\n  return ecma_op_create_iterator_object (ecma_copy_value (to_string),\n                                         ecma_builtin_get (ECMA_BUILTIN_ID_STRING_ITERATOR_PROTOTYPE),\n                                         ECMA_OBJECT_CLASS_STRING_ITERATOR,\n                                         ECMA_ITERATOR_VALUES);\n} /* ecma_builtin_string_prototype_object_iterator */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_string_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine\n                                                                             *   identifier */\n                                                ecma_value_t this_arg, /**< 'this' argument value */\n                                                const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                        *   passed to routine */\n                                                uint32_t arguments_number) /**< length of arguments' list */\n{\n  if (builtin_routine_id <= ECMA_STRING_PROTOTYPE_VALUE_OF)\n  {\n    return ecma_builtin_string_prototype_object_to_string (this_arg);\n  }\n\n  if (!ecma_op_require_object_coercible (this_arg))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t arg1 = arguments_list_p[0];\n  ecma_value_t arg2 = arguments_list_p[1];\n\n#if JERRY_BUILTIN_REGEXP\n  if (builtin_routine_id == ECMA_STRING_PROTOTYPE_MATCH)\n  {\n    return ecma_builtin_string_prototype_object_match (this_arg, arg1);\n  }\n\n  if (builtin_routine_id == ECMA_STRING_PROTOTYPE_MATCH_ALL)\n  {\n    return ecma_builtin_string_prototype_object_match_all (this_arg, arg1);\n  }\n#endif /* JERRY_BUILTIN_REGEXP */\n\n  if (builtin_routine_id <= ECMA_STRING_PROTOTYPE_CHAR_CODE_AT)\n  {\n    return ecma_builtin_string_prototype_char_at_helper (this_arg,\n                                                         arg1,\n                                                         builtin_routine_id == ECMA_STRING_PROTOTYPE_CHAR_CODE_AT);\n  }\n\n#if JERRY_BUILTIN_REGEXP\n  if (builtin_routine_id == ECMA_STRING_PROTOTYPE_REPLACE)\n  {\n    return ecma_builtin_string_prototype_object_replace_helper (this_arg, arg1, arg2, false);\n  }\n\n  else if (builtin_routine_id == ECMA_STRING_PROTOTYPE_REPLACE_ALL)\n  {\n    return ecma_builtin_string_prototype_object_replace_helper (this_arg, arg1, arg2, true);\n  }\n#endif /* JERRY_BUILTIN_REGEXP */\n\n  ecma_string_t *string_p = ecma_op_to_string (this_arg);\n\n  if (JERRY_UNLIKELY (string_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t to_string_val = ecma_make_string_value (string_p);\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_STRING_PROTOTYPE_CONCAT:\n    {\n      ret_value = ecma_builtin_string_prototype_object_concat (string_p, arguments_list_p, arguments_number);\n      break;\n    }\n    case ECMA_STRING_PROTOTYPE_SLICE:\n    {\n      ret_value = ecma_builtin_string_prototype_object_slice (string_p, arg1, arg2);\n      break;\n    }\n    case ECMA_STRING_PROTOTYPE_AT:\n    {\n      ret_value = ecma_builtin_string_prototype_object_at (string_p, arg1);\n      break;\n    }\n    case ECMA_STRING_PROTOTYPE_LAST_INDEX_OF:\n    case ECMA_STRING_PROTOTYPE_INDEX_OF:\n    case ECMA_STRING_PROTOTYPE_STARTS_WITH:\n    case ECMA_STRING_PROTOTYPE_INCLUDES:\n    case ECMA_STRING_PROTOTYPE_ENDS_WITH:\n    {\n      ecma_string_index_of_mode_t mode;\n      mode = (ecma_string_index_of_mode_t) (builtin_routine_id - ECMA_STRING_PROTOTYPE_LAST_INDEX_OF);\n      ret_value = ecma_builtin_helper_string_prototype_object_index_of (string_p, arg1, arg2, mode);\n      break;\n    }\n    case ECMA_STRING_PROTOTYPE_LOCALE_COMPARE:\n    {\n      ret_value = ecma_builtin_string_prototype_object_locale_compare (string_p, arg1);\n      break;\n    }\n#if JERRY_BUILTIN_REGEXP\n    case ECMA_STRING_PROTOTYPE_SEARCH:\n    {\n      ret_value = ecma_builtin_string_prototype_object_search (to_string_val, arg1);\n      break;\n    }\n#endif /* JERRY_BUILTIN_REGEXP */\n    case ECMA_STRING_PROTOTYPE_SPLIT:\n    {\n      ret_value = ecma_builtin_string_prototype_object_split (to_string_val, arg1, arg2);\n      break;\n    }\n    case ECMA_STRING_PROTOTYPE_SUBSTRING:\n    {\n      ret_value = ecma_builtin_string_prototype_object_substring (string_p, arg1, arg2);\n      break;\n    }\n    case ECMA_STRING_PROTOTYPE_TO_LOWER_CASE:\n    case ECMA_STRING_PROTOTYPE_TO_LOCAL_LOWER_CASE:\n    case ECMA_STRING_PROTOTYPE_TO_UPPER_CASE:\n    case ECMA_STRING_PROTOTYPE_TO_LOCAL_UPPER_CASE:\n    {\n      bool is_lower_case = builtin_routine_id <= ECMA_STRING_PROTOTYPE_TO_LOCAL_LOWER_CASE;\n      ret_value = ecma_builtin_string_prototype_object_conversion_helper (string_p, is_lower_case);\n      break;\n    }\n    case ECMA_STRING_PROTOTYPE_TRIM:\n    {\n      ret_value = ecma_builtin_string_prototype_object_trim (string_p);\n      break;\n    }\n#if JERRY_BUILTIN_ANNEXB\n    case ECMA_STRING_PROTOTYPE_SUBSTR:\n    {\n      ret_value = ecma_builtin_string_prototype_object_substr (string_p, arg1, arg2);\n      break;\n    }\n#endif /* JERRY_BUILTIN_ANNEXB */\n    case ECMA_STRING_PROTOTYPE_REPEAT:\n    {\n      ret_value = ecma_builtin_string_prototype_object_repeat (string_p, arg1);\n      break;\n    }\n    case ECMA_STRING_PROTOTYPE_CODE_POINT_AT:\n    {\n      ret_value = ecma_builtin_string_prototype_object_code_point_at (string_p, arg1);\n      break;\n    }\n    case ECMA_STRING_PROTOTYPE_ITERATOR:\n    {\n      ret_value = ecma_builtin_string_prototype_object_iterator (to_string_val);\n      break;\n    }\n    case ECMA_STRING_PROTOTYPE_PAD_END:\n    case ECMA_STRING_PROTOTYPE_PAD_START:\n    {\n      ret_value = ecma_string_pad (to_string_val, arg1, arg2, builtin_routine_id == ECMA_STRING_PROTOTYPE_PAD_START);\n      break;\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n\n  ecma_deref_ecma_string (string_p);\n\n  return ret_value;\n} /* ecma_builtin_string_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_STRING */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * String.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_STRING\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.5.4.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_STRING, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* Number properties:\n *  (property name, number value) */\n\n/* ECMA-262 v5, 15.5.4 (String.prototype is itself a String object whose value is an empty String), 15.5.5.1 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FIXED)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_STRING_PROTOTYPE_TO_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_STRING_PROTOTYPE_VALUE_OF, 0, 0)\nROUTINE (LIT_MAGIC_STRING_CONCAT, ECMA_STRING_PROTOTYPE_CONCAT, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_SLICE, ECMA_STRING_PROTOTYPE_SLICE, 2, 2)\nROUTINE (LIT_MAGIC_STRING_AT, ECMA_STRING_PROTOTYPE_AT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_INDEX_OF_UL, ECMA_STRING_PROTOTYPE_INDEX_OF, 2, 1)\nROUTINE (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, ECMA_STRING_PROTOTYPE_LAST_INDEX_OF, 2, 1)\nROUTINE (LIT_MAGIC_STRING_CHAR_AT_UL, ECMA_STRING_PROTOTYPE_CHAR_AT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_CHAR_CODE_AT_UL, ECMA_STRING_PROTOTYPE_CHAR_CODE_AT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_LOCALE_COMPARE_UL, ECMA_STRING_PROTOTYPE_LOCALE_COMPARE, 1, 1)\n\n#if JERRY_BUILTIN_REGEXP\nROUTINE (LIT_MAGIC_STRING_MATCH, ECMA_STRING_PROTOTYPE_MATCH, 1, 1)\nROUTINE (LIT_MAGIC_STRING_REPLACE, ECMA_STRING_PROTOTYPE_REPLACE, 2, 2)\nROUTINE (LIT_MAGIC_STRING_REPLACE_ALL, ECMA_STRING_PROTOTYPE_REPLACE_ALL, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SEARCH, ECMA_STRING_PROTOTYPE_SEARCH, 1, 1)\n#endif /* JERRY_BUILTIN_REGEXP */\n\nROUTINE (LIT_MAGIC_STRING_SPLIT, ECMA_STRING_PROTOTYPE_SPLIT, 2, 2)\nROUTINE (LIT_MAGIC_STRING_SUBSTRING, ECMA_STRING_PROTOTYPE_SUBSTRING, 2, 2)\nROUTINE (LIT_MAGIC_STRING_TO_LOWER_CASE_UL, ECMA_STRING_PROTOTYPE_TO_LOWER_CASE, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_LOCALE_LOWER_CASE_UL, ECMA_STRING_PROTOTYPE_TO_LOCAL_LOWER_CASE, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_UPPER_CASE_UL, ECMA_STRING_PROTOTYPE_TO_UPPER_CASE, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TO_LOCALE_UPPER_CASE_UL, ECMA_STRING_PROTOTYPE_TO_LOCAL_UPPER_CASE, 0, 0)\nROUTINE (LIT_MAGIC_STRING_TRIM, ECMA_STRING_PROTOTYPE_TRIM, 0, 0)\n\n#if JERRY_BUILTIN_ANNEXB\nROUTINE (LIT_MAGIC_STRING_SUBSTR, ECMA_STRING_PROTOTYPE_SUBSTR, 2, 2)\n#endif /* JERRY_BUILTIN_ANNEXB */\n\nROUTINE (LIT_MAGIC_STRING_REPEAT, ECMA_STRING_PROTOTYPE_REPEAT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_STARTS_WITH, ECMA_STRING_PROTOTYPE_STARTS_WITH, 2, 1)\nROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_STRING_PROTOTYPE_INCLUDES, 2, 1)\nROUTINE (LIT_MAGIC_STRING_ENDS_WITH, ECMA_STRING_PROTOTYPE_ENDS_WITH, 2, 1)\nROUTINE (LIT_MAGIC_STRING_CODE_POINT_AT, ECMA_STRING_PROTOTYPE_CODE_POINT_AT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_PAD_START, ECMA_STRING_PROTOTYPE_PAD_START, 2, 1)\nROUTINE (LIT_MAGIC_STRING_PAD_END, ECMA_STRING_PROTOTYPE_PAD_END, 2, 1)\nROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ECMA_STRING_PROTOTYPE_ITERATOR, 0, 0)\nROUTINE (LIT_MAGIC_STRING_MATCH_ALL, ECMA_STRING_PROTOTYPE_MATCH_ALL, 1, 1)\n\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_START, LIT_MAGIC_STRING_TRIM_START, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_LEFT, LIT_MAGIC_STRING_TRIM_START, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_END, LIT_MAGIC_STRING_TRIM_END, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_RIGHT, LIT_MAGIC_STRING_TRIM_END, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#endif /* JERRY_BUILTIN_STRING */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-string.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n#include \"ecma-symbol-object.h\"\n\n#include \"jrt.h\"\n#include \"lit-strings.h\"\n\n#if JERRY_BUILTIN_STRING\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BUILTIN_STRING_ROUTINE_START = 0,\n  ECMA_BUILTIN_STRING_OBJECT_FROM_CHAR_CODE,\n  ECMA_BUILTIN_STRING_OBJECT_FROM_CODE_POINT,\n  ECMA_BUILTIN_STRING_OBJECT_RAW,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-string.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  string\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup string ECMA String object built-in\n * @{\n */\n\n/**\n * The String object's 'fromCharCode' routine\n *\n * See also:\n *          ECMA-262 v5, 15.5.3.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_object_from_char_code (const ecma_value_t args[], /**< arguments list */\n                                           uint32_t args_number) /**< number of arguments */\n{\n  if (args_number == 0)\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  lit_utf8_size_t utf8_buf_size = args_number * LIT_CESU8_MAX_BYTES_IN_CODE_UNIT;\n  ecma_string_t *ret_string_p = NULL;\n  bool isError = false;\n\n  JMEM_DEFINE_LOCAL_ARRAY (utf8_buf_p, utf8_buf_size, lit_utf8_byte_t);\n\n  lit_utf8_size_t utf8_buf_used = 0;\n\n  for (uint32_t arg_index = 0; arg_index < args_number; arg_index++)\n  {\n    ecma_number_t arg_num;\n\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (args[arg_index], &arg_num)))\n    {\n      isError = true;\n      break;\n    }\n\n    uint32_t uint32_char_code = ecma_number_to_uint32 (arg_num);\n    ecma_char_t code_unit = (uint16_t) uint32_char_code;\n\n    JERRY_ASSERT (utf8_buf_used <= utf8_buf_size - LIT_UTF8_MAX_BYTES_IN_CODE_UNIT);\n    utf8_buf_used += lit_code_unit_to_utf8 (code_unit, utf8_buf_p + utf8_buf_used);\n    JERRY_ASSERT (utf8_buf_used <= utf8_buf_size);\n  }\n\n  if (!isError)\n  {\n    ret_string_p = ecma_new_ecma_string_from_utf8 (utf8_buf_p, utf8_buf_used);\n  }\n\n  JMEM_FINALIZE_LOCAL_ARRAY (utf8_buf_p);\n\n  return isError ? ECMA_VALUE_ERROR : ecma_make_string_value (ret_string_p);\n} /* ecma_builtin_string_object_from_char_code */\n\n/**\n * The String object's 'raw' routine\n *\n * See also:\n *          ECMA-262 v6, 21.1.2.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_object_raw (const ecma_value_t args[], /**< arguments list */\n                                uint32_t args_number) /**< number of arguments */\n{\n  /* 1 - 2. */\n  const ecma_value_t *substitutions;\n  uint32_t number_of_substitutions;\n\n  if (args_number > 1)\n  {\n    substitutions = args + 1;\n    number_of_substitutions = args_number - 1;\n  }\n  else\n  {\n    substitutions = NULL;\n    number_of_substitutions = 0;\n  }\n\n  /* 3. */\n  ecma_value_t template = args_number > 0 ? args[0] : ECMA_VALUE_UNDEFINED;\n\n  ecma_value_t cooked = ecma_op_to_object (template);\n\n  /* 4. */\n  if (ECMA_IS_VALUE_ERROR (cooked))\n  {\n    return cooked;\n  }\n\n  ecma_object_t *cooked_obj_p = ecma_get_object_from_value (cooked);\n\n  /* 5. */\n  ecma_value_t raw = ecma_op_object_get_by_magic_id (cooked_obj_p, LIT_MAGIC_STRING_RAW);\n\n  ecma_deref_object (cooked_obj_p);\n\n  if (ECMA_IS_VALUE_ERROR (raw))\n  {\n    return raw;\n  }\n\n  ecma_value_t raw_obj = ecma_op_to_object (raw);\n\n  /* 6. */\n  if (ECMA_IS_VALUE_ERROR (raw_obj))\n  {\n    ecma_free_value (raw);\n    return raw_obj;\n  }\n\n  ecma_object_t *raw_obj_p = ecma_get_object_from_value (raw_obj);\n\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n\n  /* 7 - 8. */\n  ecma_length_t literal_segments;\n  if (ECMA_IS_VALUE_ERROR (ecma_op_object_get_length (raw_obj_p, &literal_segments)))\n  {\n    goto cleanup;\n  }\n\n  /* 9. */\n  if (literal_segments == 0)\n  {\n    ret_value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n    goto cleanup;\n  }\n\n  /* 10. */\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  /* 11. */\n  ecma_length_t next_index = 0;\n\n  /* 12. */\n  while (true)\n  {\n    /* 12.a,b */\n    ecma_value_t next_seg = ecma_op_object_get_by_index (raw_obj_p, next_index);\n\n    if (ECMA_IS_VALUE_ERROR (next_seg))\n    {\n      goto builder_cleanup;\n    }\n\n    ecma_string_t *next_seg_srt_p = ecma_op_to_string (next_seg);\n\n    /* 12.c */\n    if (JERRY_UNLIKELY (next_seg_srt_p == NULL))\n    {\n      ecma_free_value (next_seg);\n      goto builder_cleanup;\n    }\n\n    /* 12.d */\n    ecma_stringbuilder_append (&builder, next_seg_srt_p);\n\n    ecma_deref_ecma_string (next_seg_srt_p);\n    ecma_free_value (next_seg);\n\n    /* 12.e */\n    if (next_index + 1 == literal_segments)\n    {\n      ret_value = ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n      goto cleanup;\n    }\n\n    /* 12.f-g */\n    if (next_index >= number_of_substitutions)\n    {\n      next_index++;\n      continue;\n    }\n\n    /* 12.h */\n    ecma_string_t *next_sub_p = ecma_op_to_string (substitutions[next_index]);\n\n    /* 12.i */\n    if (JERRY_UNLIKELY (next_sub_p == NULL))\n    {\n      goto builder_cleanup;\n    }\n\n    /* 12.j */\n    ecma_stringbuilder_append (&builder, next_sub_p);\n    ecma_deref_ecma_string (next_sub_p);\n\n    /* 12.k */\n    next_index++;\n  }\n\nbuilder_cleanup:\n  ecma_stringbuilder_destroy (&builder);\n\ncleanup:\n  ecma_deref_object (raw_obj_p);\n  ecma_free_value (raw);\n\n  return ret_value;\n} /* ecma_builtin_string_object_raw */\n\n/**\n * The String object's 'fromCodePoint' routine\n *\n * See also:\n *          ECMA-262 v6, 21.1.2.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_string_object_from_code_point (const ecma_value_t args[], /**< arguments list */\n                                            uint32_t args_number) /**< number of arguments */\n{\n  if (args_number == 0)\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  for (uint32_t index = 0; index < args_number; index++)\n  {\n    ecma_number_t to_number_num;\n    ecma_value_t to_number_value = ecma_op_to_number (args[index], &to_number_num);\n\n    if (ECMA_IS_VALUE_ERROR (to_number_value))\n    {\n      ecma_stringbuilder_destroy (&builder);\n      return to_number_value;\n    }\n\n    if (!ecma_op_is_integer (to_number_num))\n    {\n      ecma_stringbuilder_destroy (&builder);\n      return ecma_raise_range_error (ECMA_ERR_INVALID_CODE_POINT_ERROR);\n    }\n\n    ecma_free_value (to_number_value);\n\n    if (to_number_num < 0 || to_number_num > LIT_UNICODE_CODE_POINT_MAX)\n    {\n      ecma_stringbuilder_destroy (&builder);\n      return ecma_raise_range_error (ECMA_ERR_INVALID_CODE_POINT);\n    }\n\n    lit_code_point_t code_point = (lit_code_point_t) to_number_num;\n\n    ecma_char_t converted_cp[2];\n    uint8_t encoded_size = lit_utf16_encode_code_point (code_point, converted_cp);\n\n    for (uint8_t i = 0; i < encoded_size; i++)\n    {\n      ecma_stringbuilder_append_char (&builder, converted_cp[i]);\n    }\n  }\n\n  ecma_string_t *ret_str_p = ecma_stringbuilder_finalize (&builder);\n\n  return ecma_make_string_value (ret_str_p);\n} /* ecma_builtin_string_object_from_code_point */\n\n/**\n * Handle calling [[Call]] of built-in String object\n *\n * See also:\n *          ECMA-262 v6, 21.1.1.1\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_string_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                   uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  /* 1. */\n  if (arguments_list_len == 0)\n  {\n    ret_value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n  }\n  /* 2.a */\n  else if (ecma_is_value_symbol (arguments_list_p[0]))\n  {\n    ret_value = ecma_get_symbol_descriptive_string (arguments_list_p[0]);\n  }\n  /* 2.b */\n  else\n  {\n    ecma_string_t *str_p = ecma_op_to_string (arguments_list_p[0]);\n    if (JERRY_UNLIKELY (str_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    ret_value = ecma_make_string_value (str_p);\n  }\n\n  return ret_value;\n} /* ecma_builtin_string_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in String object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_string_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                        uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_op_create_string_object (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_string_dispatch_construct */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_string_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                      ecma_value_t this_arg, /**< 'this' argument value */\n                                      const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                              *   passed to routine */\n                                      uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (this_arg);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_BUILTIN_STRING_OBJECT_FROM_CHAR_CODE:\n    {\n      return ecma_builtin_string_object_from_char_code (arguments_list_p, arguments_number);\n    }\n    case ECMA_BUILTIN_STRING_OBJECT_FROM_CODE_POINT:\n    {\n      return ecma_builtin_string_object_from_code_point (arguments_list_p, arguments_number);\n    }\n    case ECMA_BUILTIN_STRING_OBJECT_RAW:\n    {\n      return ecma_builtin_string_object_raw (arguments_list_p, arguments_number);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_string_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_STRING */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-string.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * String built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_STRING\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.7.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_STRING_PROTOTYPE, ECMA_PROPERTY_FIXED)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_STRING_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_FROM_CHAR_CODE_UL, ECMA_BUILTIN_STRING_OBJECT_FROM_CHAR_CODE, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_FROM_CODE_POINT_UL, ECMA_BUILTIN_STRING_OBJECT_FROM_CODE_POINT, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_RAW, ECMA_BUILTIN_STRING_OBJECT_RAW, NON_FIXED, 1)\n\n#endif /* JERRY_BUILTIN_STRING */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-symbol-object.h\"\n\n#include \"jrt.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_SYMBOL_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_SYMBOL_PROTOTYPE_VALUE_OF, /**< ECMA-262 v11, 19.4.3.4 */\n  ECMA_SYMBOL_PROTOTYPE_TO_PRIMITIVE, /**< ECMA-262 v11, 19.4.3.5 */\n  ECMA_SYMBOL_PROTOTYPE_TO_STRING, /**< ECMA-262 v11, 19.4.3.3 */\n  ECMA_SYMBOL_PROTOTYPE_DESCRIPTION, /**< ECMA-262 v11, 19.4.3.2 */\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-symbol-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  symbol_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup symbolprototype ECMA Symbol prototype object built-in\n * @{\n */\n\n/**\n * Dispatcher of the Symbol built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_symbol_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                                ecma_value_t this_arg, /**< 'this' argument value */\n                                                const ecma_value_t arguments_list[], /**< list of arguments\n                                                                                      *   passed to routine */\n                                                uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (arguments_list, arguments_number);\n\n  ecma_value_t sym = ecma_symbol_this_value (this_arg);\n\n  if (ECMA_IS_VALUE_ERROR (sym))\n  {\n    return sym;\n  }\n\n  if (builtin_routine_id < ECMA_SYMBOL_PROTOTYPE_TO_STRING)\n  {\n    return ecma_copy_value (sym);\n  }\n\n  if (builtin_routine_id == ECMA_SYMBOL_PROTOTYPE_TO_STRING)\n  {\n    return ecma_get_symbol_descriptive_string (sym);\n  }\n\n  JERRY_ASSERT (builtin_routine_id == ECMA_SYMBOL_PROTOTYPE_DESCRIPTION);\n  ecma_string_t *symbol_p = ecma_get_symbol_from_value (sym);\n  ecma_value_t desc = ecma_get_symbol_description (symbol_p);\n  if (ecma_is_value_undefined (desc))\n  {\n    return desc;\n  }\n\n  ecma_string_t *desc_p = ecma_get_string_from_value (desc);\n  ecma_ref_ecma_string (desc_p);\n  return desc;\n} /* ecma_builtin_symbol_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Symbol prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SYMBOL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_SYMBOL_PROTOTYPE_TO_STRING, 0, 0)\nROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_SYMBOL_PROTOTYPE_VALUE_OF, 0, 0)\nROUTINE_CONFIGURABLE_ONLY (LIT_GLOBAL_SYMBOL_TO_PRIMITIVE, ECMA_SYMBOL_PROTOTYPE_TO_PRIMITIVE, 0, 1)\n\n/* ECMA-262 v6, 19.4.3.4 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SYMBOL_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262, v11, 19.4.3.2 */\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_DESCRIPTION, ECMA_SYMBOL_PROTOTYPE_DESCRIPTION, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-literal-storage.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-symbol-object.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-symbol.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  symbol\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup symbol ECMA Symbol object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in Symbol object.\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_symbol_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                   uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_op_create_symbol (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_symbol_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in Symbol object.\n *\n * Symbol constructor is not intended to be used\n * with the new operator or to be subclassed.\n *\n * See also:\n *          ECMA-262 v6, 19.4.1\n * @return ecma value\n */\necma_value_t\necma_builtin_symbol_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                        uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_SYMBOL_IS_NOT_A_CONSTRUCTOR);\n} /* ecma_builtin_symbol_dispatch_construct */\n\n/**\n * Helper function for Symbol object's 'for' and `keyFor`\n * routines common parts\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_symbol_for_helper (ecma_value_t value_to_find) /**< symbol or ecma-string */\n{\n  ecma_string_t *string_p;\n\n  bool is_for = ecma_is_value_string (value_to_find);\n\n  if (is_for)\n  {\n    string_p = ecma_get_string_from_value (value_to_find);\n  }\n  else\n  {\n    string_p = ecma_get_symbol_from_value (value_to_find);\n  }\n\n  jmem_cpointer_t symbol_list_cp = JERRY_CONTEXT (symbol_list_first_cp);\n  jmem_cpointer_t *empty_cpointer_p = NULL;\n\n  while (symbol_list_cp != JMEM_CP_NULL)\n  {\n    ecma_lit_storage_item_t *symbol_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, symbol_list_cp);\n\n    for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n    {\n      if (symbol_list_p->values[i] != JMEM_CP_NULL)\n      {\n        ecma_string_t *value_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, symbol_list_p->values[i]);\n\n        if (is_for)\n        {\n          ecma_value_t symbol_desc = ecma_get_symbol_description (value_p);\n\n          if (ecma_is_value_undefined (symbol_desc))\n          {\n            ecma_ref_ecma_string (value_p);\n            return ecma_make_symbol_value (value_p);\n          }\n\n          ecma_string_t *symbol_desc_p = ecma_get_string_from_value (symbol_desc);\n\n          if (ecma_compare_ecma_strings (symbol_desc_p, string_p))\n          {\n            /* The current symbol's descriptor matches with the value_to_find,\n               so the value is no longer needed. */\n            ecma_deref_ecma_string (string_p);\n            return ecma_copy_value (ecma_make_symbol_value (value_p));\n          }\n        }\n        else\n        {\n          if (string_p == value_p)\n          {\n            ecma_value_t symbol_desc = ecma_get_symbol_description (string_p);\n\n            if (ecma_is_value_undefined (symbol_desc))\n            {\n              return symbol_desc;\n            }\n\n            ecma_string_t *symbol_desc_p = ecma_get_string_from_value (symbol_desc);\n            ecma_ref_ecma_string (symbol_desc_p);\n            return symbol_desc;\n          }\n        }\n      }\n      else\n      {\n        if (empty_cpointer_p == NULL)\n        {\n          empty_cpointer_p = symbol_list_p->values + i;\n        }\n      }\n    }\n\n    symbol_list_cp = symbol_list_p->next_cp;\n  }\n\n  if (!is_for)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  /* There was no matching, sp a new symbol should be added the the global symbol list. The symbol creation requires\n     an extra reference to the descriptor string, but this reference has already been added. */\n  ecma_string_t *new_symbol_p = ecma_new_symbol_from_descriptor_string (value_to_find);\n\n  jmem_cpointer_t result;\n  JMEM_CP_SET_NON_NULL_POINTER (result, new_symbol_p);\n\n  if (empty_cpointer_p != NULL)\n  {\n    *empty_cpointer_p = result;\n    return ecma_copy_value (ecma_make_symbol_value (new_symbol_p));\n  }\n\n  ecma_lit_storage_item_t *new_item_p;\n  new_item_p = (ecma_lit_storage_item_t *) jmem_pools_alloc (sizeof (ecma_lit_storage_item_t));\n\n  new_item_p->values[0] = result;\n  for (int i = 1; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)\n  {\n    new_item_p->values[i] = JMEM_CP_NULL;\n  }\n\n  new_item_p->next_cp = JERRY_CONTEXT (symbol_list_first_cp);\n  JMEM_CP_SET_NON_NULL_POINTER (JERRY_CONTEXT (symbol_list_first_cp), new_item_p);\n\n  return ecma_copy_value (ecma_make_symbol_value (new_symbol_p));\n} /* ecma_builtin_symbol_for_helper */\n\n/**\n * The Symbol object's 'for' routine\n *\n * See also:\n *          ECMA-262 v6, 19.4.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_symbol_for (ecma_value_t this_arg, /**< this argument */\n                         ecma_value_t key) /**< key string */\n{\n  JERRY_UNUSED (this_arg);\n  ecma_string_t *string_desc_p = ecma_op_to_string (key);\n\n  /* 1. */\n  if (JERRY_UNLIKELY (string_desc_p == NULL))\n  {\n    /* 2. */\n    return ECMA_VALUE_ERROR;\n  }\n\n  return ecma_builtin_symbol_for_helper (ecma_make_string_value (string_desc_p));\n} /* ecma_builtin_symbol_for */\n\n/**\n * The Symbol object's 'keyFor' routine\n *\n * See also:\n *          ECMA-262 v6, 19.4.2.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_symbol_key_for (ecma_value_t this_arg, /**< this argument */\n                             ecma_value_t symbol) /**< symbol */\n{\n  JERRY_UNUSED (this_arg);\n\n  /* 1. */\n  if (!ecma_is_value_symbol (symbol))\n  {\n    return ecma_raise_type_error (ECMA_ERR_THE_GIVEN_ARGUMENT_IS_NOT_A_SYMBOL);\n  }\n\n  /* 2-4. */\n  return ecma_builtin_symbol_for_helper (symbol);\n} /* ecma_builtin_symbol_key_for */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-symbol.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Symbol built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\n/* ECMA-262 v6, 19.4.2 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SYMBOL_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 19.4.2.7 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n/* ECMA-262 v10, 19.4.2.1 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_ASYNC_ITERATOR, LIT_GLOBAL_SYMBOL_ASYNC_ITERATOR)\n\n/* ECMA-262 v6, 19.4.2.2 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_HAS_INSTANCE, LIT_GLOBAL_SYMBOL_HAS_INSTANCE)\n\n/* ECMA-262 v6, 19.4.2.3 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE, LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE)\n\n/* ECMA-262 v6, 19.4.2.4 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_ITERATOR, LIT_GLOBAL_SYMBOL_ITERATOR)\n\n/* ECMA-262 v6, 19.4.2.6 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_MATCH, LIT_GLOBAL_SYMBOL_MATCH)\n\n/* ECMA-262 v6, 19.4.2.8 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_REPLACE, LIT_GLOBAL_SYMBOL_REPLACE)\n\n/* ECMA-262 v6, 19.4.2.9 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_SEARCH, LIT_GLOBAL_SYMBOL_SEARCH)\n\n/* ECMA-262 v6, 19.4.2.10 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_SPECIES, LIT_GLOBAL_SYMBOL_SPECIES)\n\n/* ECMA-262 v6, 19.4.2.11 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_SPLIT, LIT_GLOBAL_SYMBOL_SPLIT)\n\n/* ECMA-262 v6, 19.4.2.12 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_TO_PRIMITIVE, LIT_GLOBAL_SYMBOL_TO_PRIMITIVE)\n\n/* ECMA-262 v6, 19.4.2.13 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_TO_STRING_TAG, LIT_GLOBAL_SYMBOL_TO_STRING_TAG)\n\n/* ECMA-262 v6, 19.4.2.14 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_UNSCOPABLES, LIT_GLOBAL_SYMBOL_UNSCOPABLES)\n\n/* ECMA-262 v11, 19.4.2.8 */\nSYMBOL_VALUE (LIT_MAGIC_STRING_MATCH_ALL, LIT_GLOBAL_SYMBOL_MATCH_ALL)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_FOR, ecma_builtin_symbol_for, 1, 1)\nROUTINE (LIT_MAGIC_STRING_KEY_FOR, ecma_builtin_symbol_key_for, 1, 1)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-syntaxerror-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  syntax_error_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * SyntaxError.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.7.8 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SYNTAX_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.9 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SYNTAX_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.10 */\nSTRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-syntaxerror.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  syntax_error\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup syntaxerror ECMA SyntaxError object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in SyntaxError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_syntax_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                         uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_helper_error_dispatch_call (JERRY_ERROR_SYNTAX, arguments_list_p, arguments_list_len);\n} /* ecma_builtin_syntax_error_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in SyntaxError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_syntax_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                              uint32_t arguments_list_len) /**< number of arguments */\n{\n  ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),\n                                                                   ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE);\n\n  if (proto_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ecma_builtin_syntax_error_dispatch_call (arguments_list_p, arguments_list_len);\n\n  if (!ECMA_IS_VALUE_ERROR (result))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (result);\n    ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, proto_p);\n  }\n\n  ecma_deref_object (proto_p);\n\n  return result;\n} /* ecma_builtin_syntax_error_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * SyntaxError built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SYNTAX_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jrt.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-type-error-thrower.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  type_error_thrower\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup type_error_thrower ECMA [[ThrowTypeError]] object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in [[ThrowTypeError]] object\n *\n * See also:\n *          ECMA-262 v5, 13.2.3\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_type_error_thrower_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                               uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CANNOT_ACCESS_CALLER_CALLE_ARGUMENTS);\n} /* ecma_builtin_type_error_thrower_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in [[ThrowTypeError]] object\n *\n * See also:\n *          ECMA-262 v5, 13.2.3\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_type_error_thrower_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                    uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_builtin_type_error_thrower_dispatch_call (arguments_list_p, arguments_list_len);\n} /* ecma_builtin_type_error_thrower_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * [[ThrowTypeError]] description\n *\n * See also: ECMA-262 v5, 13.2.3\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FIXED)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_FIXED)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-typeerror-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  type_error_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * TypeError.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.7.8 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_TYPE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.9 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_TYPE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.10 */\nSTRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-typeerror.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  type_error\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup typeerror ECMA TypeError object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in TypeError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_type_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                       uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_helper_error_dispatch_call (JERRY_ERROR_TYPE, arguments_list_p, arguments_list_len);\n} /* ecma_builtin_type_error_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in TypeError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_type_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                            uint32_t arguments_list_len) /**< number of arguments */\n{\n  ecma_object_t *proto_p =\n    ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE);\n\n  if (proto_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ecma_builtin_type_error_dispatch_call (arguments_list_p, arguments_list_len);\n\n  if (!ECMA_IS_VALUE_ERROR (result))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (result);\n    ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, proto_p);\n  }\n\n  ecma_deref_object (proto_p);\n\n  return result;\n} /* ecma_builtin_type_error_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * TypeError built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_TYPE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-urierror-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  uri_error_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * UriError.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.7.8 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_URI_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.9 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_URI_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v5, 15.11.7.10 */\nSTRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-urierror.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-urierror.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  uri_error\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup urierror ECMA UriError object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in UriError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_uri_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                      uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_builtin_helper_error_dispatch_call (JERRY_ERROR_URI, arguments_list_p, arguments_list_len);\n} /* ecma_builtin_uri_error_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in UriError object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_uri_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                           uint32_t arguments_list_len) /**< number of arguments */\n{\n  ecma_object_t *proto_p =\n    ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE);\n\n  if (proto_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ecma_builtin_uri_error_dispatch_call (arguments_list_p, arguments_list_len);\n\n  if (!ECMA_IS_VALUE_ERROR (result))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (result);\n    ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, proto_p);\n  }\n\n  ecma_deref_object (proto_p);\n\n  return result;\n} /* ecma_builtin_uri_error_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_ERRORS */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-urierror.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * UriError built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_ERRORS\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v5, 15.11.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_URI_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_ERRORS */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-container-object.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-weakmap-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  weakmap_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup weakmap ECMA WeakMap object built-in\n * @{\n */\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_weakmap_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */\n                                                 ecma_value_t this_arg, /**< 'this' argument value */\n                                                 const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                         *   passed to routine */\n                                                 uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n  return ecma_builtin_container_dispatch_routine (builtin_routine_id,\n                                                  this_arg,\n                                                  arguments_list_p,\n                                                  LIT_MAGIC_STRING_WEAKMAP_UL);\n} /* ecma_builtin_weakmap_prototype_dispatch_routine */\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * WeakMap.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 23.3.3.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_WEAKMAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 23.3.3.6 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_WEAKMAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_DELETE, ECMA_CONTAINER_ROUTINE_DELETE_WEAK, 1, 1)\nROUTINE (LIT_MAGIC_STRING_GET, ECMA_CONTAINER_ROUTINE_GET, 1, 1)\nROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SET, ECMA_CONTAINER_ROUTINE_SET, 2, 2)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-container-object.h\"\n#include \"ecma-exceptions.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-weakmap.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  weakmap\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup weakmap ECMA WeakMap object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in WeakMap object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_weakmap_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                    uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_WEAKMAP_REQUIRES_NEW);\n} /* ecma_builtin_weakmap_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in WeakMap object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_weakmap_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                         uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_op_container_create (arguments_list_p,\n                                   arguments_list_len,\n                                   LIT_MAGIC_STRING_WEAKMAP_UL,\n                                   ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE);\n} /* ecma_builtin_weakmap_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * WeakMap built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\n/* ECMA-262 v6, 23.3.2 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 23.1 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_WEAKMAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 23.3.2.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-container-object.h\"\n#include \"ecma-exceptions.h\"\n\n#if JERRY_BUILTIN_WEAKREF\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_BUILTIN_WEAKREF_PROTOTYPE_OBJECT_ROUTINE_START = 0,\n  ECMA_BUILTIN_WEAKREF_PROTOTYPE_OBJECT_DEREF\n};\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-weakref-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  weakref_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup weakref ECMA WeakRef object built-in\n * @{\n */\n\n/**\n * Deref checks weakRef target\n *\n * @return weakRef target\n *         error - otherwise\n */\nstatic ecma_value_t\necma_builtin_weakref_prototype_object_deref (ecma_value_t this_arg) /**< this argument */\n{\n  if (!ecma_is_value_object (this_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_TARGET_IS_NOT_OBJECT);\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n  ecma_extended_object_t *this_ext_obj = (ecma_extended_object_t *) object_p;\n\n  if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_WEAKREF))\n  {\n    return ecma_raise_type_error (ECMA_ERR_TARGET_IS_NOT_WEAKREF);\n  }\n\n  return ecma_copy_value (this_ext_obj->u.cls.u3.target);\n} /* ecma_builtin_weakref_prototype_object_deref */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_weakref_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in routine identifier */\n                                                 ecma_value_t this_arg, /**< 'this' argument value */\n                                                 const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                         *   passed to routine */\n                                                 uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED_2 (arguments_list_p, arguments_number);\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_BUILTIN_WEAKREF_PROTOTYPE_OBJECT_DEREF:\n    {\n      return ecma_builtin_weakref_prototype_object_deref (this_arg);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_weakref_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_WEAKREF */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * WeakSet.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_WEAKREF\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_WEAKREF, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_WEAKREF_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_DEREF, ECMA_BUILTIN_WEAKREF_PROTOTYPE_OBJECT_DEREF, 0, 0)\n\n#endif /* JERRY_BUILTIN_WEAKREF */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakref.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n\n#include \"jcontext.h\"\n\n#if JERRY_BUILTIN_WEAKREF\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-weakref.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  weakref\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup weakref ECMA WeakRef object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in WeakRef object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_weakref_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                    uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_WEAKREF_REQUIRES_NEW);\n} /* ecma_builtin_weakref_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in WeakRef object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_weakref_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                         uint32_t arguments_list_len) /**< number of arguments */\n{\n  if (arguments_list_len == 0 || !ecma_is_value_object (arguments_list_p[0]))\n  {\n    return ecma_raise_type_error (ECMA_ERR_WEAKREF_TARGET_MUST_BE_AN_OBJECT);\n  }\n\n  JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) != NULL);\n\n  ecma_object_t *proto_p =\n    ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE);\n\n  if (JERRY_UNLIKELY (proto_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n  ecma_deref_object (proto_p);\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n  ext_obj_p->u.cls.type = ECMA_OBJECT_CLASS_WEAKREF;\n  ext_obj_p->u.cls.u3.target = arguments_list_p[0];\n  ecma_op_object_set_weak (ecma_get_object_from_value (arguments_list_p[0]), object_p);\n\n  return ecma_make_object_value (object_p);\n} /* ecma_builtin_weakref_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_WEAKREF */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakref.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * WeakRef built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_WEAKREF\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_WEAKREF_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n#endif /* JERRY_BUILTIN_WEAKREF */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-container-object.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-weakset-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  weakset_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup weakset ECMA WeakSet object built-in\n * @{\n */\n\n/**\n * Dispatcher of the built-in's routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_weakset_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine\n                                                                              *   identifier */\n                                                 ecma_value_t this_arg, /**< 'this' argument value */\n                                                 const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                         *   passed to routine */\n                                                 uint32_t arguments_number) /**< length of arguments' list */\n{\n  JERRY_UNUSED (arguments_number);\n  return ecma_builtin_container_dispatch_routine (builtin_routine_id,\n                                                  this_arg,\n                                                  arguments_list_p,\n                                                  LIT_MAGIC_STRING_WEAKSET_UL);\n} /* ecma_builtin_weakset_prototype_dispatch_routine */\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * WeakSet.prototype built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 23.4.3.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_WEAKSET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ECMA-262 v6, 23.4.3.5 */\nSTRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_WEAKSET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_ADD, ECMA_CONTAINER_ROUTINE_ADD, 1, 1)\nROUTINE (LIT_MAGIC_STRING_DELETE, ECMA_CONTAINER_ROUTINE_DELETE_WEAK, 1, 1)\nROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-container-object.h\"\n#include \"ecma-exceptions.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-weakset.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  weakset\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup weakset ECMA WeakSet object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of built-in WeakSet object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_weakset_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                    uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_WEAKSET_REQUIRES_NEW);\n} /* ecma_builtin_weakset_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in WeakSet object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_weakset_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                         uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_op_container_create (arguments_list_p,\n                                   arguments_list_len,\n                                   LIT_MAGIC_STRING_WEAKSET_UL,\n                                   ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE);\n} /* ecma_builtin_weakset_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtin-weakset.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * WeakSet built-in description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n/* Number properties:\n *  (property name, number value, writable, enumerable, configurable) */\n\n/* ECMA-262 v6, 23.4.2 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 23.4 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_WEAKSET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Object properties:\n *  (property name, object pointer getter) */\n\n/* ECMA-262 v6, 23.4.2.1 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtins-internal.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_BUILTINS_INTERNAL_H\n#define ECMA_BUILTINS_INTERNAL_H\n\n#ifndef ECMA_BUILTINS_INTERNAL\n#error \"!ECMA_BUILTINS_INTERNAL\"\n#endif /* !ECMA_BUILTINS_INTERNAL */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-globals.h\"\n\n/**\n * Type of built-in properties.\n */\ntypedef enum\n{\n  ECMA_BUILTIN_PROPERTY_SIMPLE, /**< simple value property */\n  ECMA_BUILTIN_PROPERTY_NUMBER, /**< number value property */\n  ECMA_BUILTIN_PROPERTY_STRING, /**< string value property */\n  ECMA_BUILTIN_PROPERTY_SYMBOL, /**< symbol value property */\n  ECMA_BUILTIN_PROPERTY_INTRINSIC_PROPERTY, /**< intrinsic routine property */\n  ECMA_BUILTIN_PROPERTY_ACCESSOR_BUILTIN_FUNCTION, /**< full accessor property with builtin function object\n                                                        getter/setter pair */\n  ECMA_BUILTIN_PROPERTY_OBJECT, /**< builtin object property */\n  ECMA_BUILTIN_PROPERTY_ROUTINE, /**< routine property */\n  ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, /**< full accessor property */\n  ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, /**< read-only accessor property */\n  ECMA_BUILTIN_PROPERTY_END, /**< last property */\n} ecma_builtin_property_type_t;\n\n/**\n * Type of symbolic built-in number types (starting from 256).\n */\ntypedef enum\n{\n  ECMA_BUILTIN_NUMBER_MAX = 256, /**< value of ECMA_NUMBER_MAX_VALUE */\n  ECMA_BUILTIN_NUMBER_MIN, /**< value of ECMA_NUMBER_MIN_VALUE */\n  ECMA_BUILTIN_NUMBER_EPSILON, /**< value of ECMA_NUMBER_EPSILON */\n  ECMA_BUILTIN_NUMBER_MAX_SAFE_INTEGER, /**< value of ECMA_NUMBER_MAX_SAFE_INTEGER */\n  ECMA_BUILTIN_NUMBER_MIN_SAFE_INTEGER, /**< value of ECMA_NUMBER_MIN_SAFE_INTEGER */\n  ECMA_BUILTIN_NUMBER_E, /**< value of ECMA_NUMBER_E */\n  ECMA_BUILTIN_NUMBER_PI, /**< value of ECMA_NUMBER_PI */\n  ECMA_BUILTIN_NUMBER_LN10, /**< value of ECMA_NUMBER_LN10 */\n  ECMA_BUILTIN_NUMBER_LN2, /**< value of ECMA_NUMBER_LN2 */\n  ECMA_BUILTIN_NUMBER_LOG2E, /**< value of ECMA_NUMBER_LOG2E */\n  ECMA_BUILTIN_NUMBER_LOG10E, /**< value of ECMA_NUMBER_LOG10E */\n  ECMA_BUILTIN_NUMBER_SQRT2, /**< value of ECMA_NUMBER_SQRT2 */\n  ECMA_BUILTIN_NUMBER_SQRT_1_2, /**< value of ECMA_NUMBER_SQRT_1_2 */\n  ECMA_BUILTIN_NUMBER_NAN, /**< result of ecma_number_make_nan () */\n  ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, /**< result of ecma_number_make_infinity (false) */\n  ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY, /**< result of ecma_number_make_infinity (true) */\n} ecma_builtin_number_type_t;\n\n/**\n * Description of built-in properties.\n */\ntypedef struct\n{\n  uint16_t magic_string_id; /**< name of the property */\n  uint8_t type; /**< type of the property */\n  uint8_t attributes; /**< attributes of the property */\n  uint16_t value; /**< value of the property */\n} ecma_builtin_property_descriptor_t;\n\n#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name)  \\\n  extern const ecma_builtin_property_descriptor_t ecma_builtin_##lowercase_name##_property_descriptor_list[]; \\\n  ecma_value_t ecma_builtin_##lowercase_name##_dispatch_call (const ecma_value_t *, uint32_t);                \\\n  ecma_value_t ecma_builtin_##lowercase_name##_dispatch_construct (const ecma_value_t *, uint32_t);           \\\n  ecma_value_t ecma_builtin_##lowercase_name##_dispatch_routine (uint8_t builtin_routine_id,                  \\\n                                                                 ecma_value_t this_arg_value,                 \\\n                                                                 const ecma_value_t[],                        \\\n                                                                 uint32_t);\n#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name)          \\\n  extern const ecma_builtin_property_descriptor_t ecma_builtin_##lowercase_name##_property_descriptor_list[]; \\\n  ecma_value_t ecma_builtin_##lowercase_name##_dispatch_routine (uint8_t builtin_routine_id,                  \\\n                                                                 ecma_value_t this_arg_value,                 \\\n                                                                 const ecma_value_t[],                        \\\n                                                                 uint32_t);\n#include \"ecma-builtins.inc.h\"\n\n#undef BUILTIN_ROUTINE\n#undef BUILTIN\n\n#endif /* !ECMA_BUILTINS_INTERNAL_H */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtins.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt-bit-fields.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n */\n\nJERRY_STATIC_ASSERT (ECMA_BUILTIN_ID_GLOBAL == ECMA_BUILTIN_OBJECTS_COUNT,\n                     ecma_builtin_id_global_must_be_the_last_builtin_id);\n\n/**\n * Checks whether the built-in is an ecma_extended_built_in_object_t\n */\n#define ECMA_BUILTIN_IS_EXTENDED_BUILT_IN(object_type) \\\n  ((object_type) == ECMA_OBJECT_TYPE_BUILT_IN_CLASS || (object_type) == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY)\n\n/**\n * Helper definition for ecma_builtin_property_list_references.\n */\ntypedef const ecma_builtin_property_descriptor_t *ecma_builtin_property_list_reference_t;\n\n/**\n * Definition of built-in dispatch routine function pointer.\n */\ntypedef ecma_value_t (*ecma_builtin_dispatch_routine_t) (uint8_t builtin_routine_id,\n                                                         ecma_value_t this_arg,\n                                                         const ecma_value_t arguments_list[],\n                                                         uint32_t arguments_number);\n/**\n * Definition of built-in dispatch call function pointer.\n */\ntypedef ecma_value_t (*ecma_builtin_dispatch_call_t) (const ecma_value_t arguments_list[], uint32_t arguments_number);\n/**\n * Definition of a builtin descriptor which contains the builtin object's:\n * - prototype objects's id (13-bits)\n * - type (3-bits)\n *\n * Layout:\n *\n * |----------------------|---------------|\n *     prototype_id(12)      obj_type(4)\n */\ntypedef uint16_t ecma_builtin_descriptor_t;\n\n/**\n * Bitshift index for get the prototype object's id from a builtin descriptor\n */\n#define ECMA_BUILTIN_PROTOTYPE_ID_SHIFT 4\n\n/**\n * Bitmask for get the object's type from a builtin descriptor\n */\n#define ECMA_BUILTIN_OBJECT_TYPE_MASK ((1 << ECMA_BUILTIN_PROTOTYPE_ID_SHIFT) - 1)\n\n/**\n * Create a builtin descriptor value\n */\n#define ECMA_MAKE_BUILTIN_DESCRIPTOR(type, proto_id) (((proto_id) << ECMA_BUILTIN_PROTOTYPE_ID_SHIFT) | (type))\n\n/**\n * List of the built-in descriptors.\n */\nstatic const ecma_builtin_descriptor_t ecma_builtin_descriptors[] = {\n/** @cond doxygen_suppress */\n#define BUILTIN(a, b, c, d, e)\n#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \\\n  ECMA_MAKE_BUILTIN_DESCRIPTOR (object_type, object_prototype_builtin_id),\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN\n#undef BUILTIN_ROUTINE\n#define BUILTIN_ROUTINE(a, b, c, d, e)\n#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \\\n  ECMA_MAKE_BUILTIN_DESCRIPTOR (object_type, object_prototype_builtin_id),\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN\n#undef BUILTIN_ROUTINE\n  /** @endcond */\n};\n\n#ifndef JERRY_NDEBUG\n/** @cond doxygen_suppress */\nenum\n{\n  ECMA_BUILTIN_EXTENSIBLE_CHECK =\n#define BUILTIN(a, b, c, d, e)\n#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \\\n  (is_extensible != 0 || builtin_id == ECMA_BUILTIN_ID_TYPE_ERROR_THROWER) &&\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN\n#undef BUILTIN_ROUTINE\n#define BUILTIN_ROUTINE(a, b, c, d, e)\n#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \\\n  (is_extensible != 0 || builtin_id == ECMA_BUILTIN_ID_TYPE_ERROR_THROWER) &&\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN\n#undef BUILTIN_ROUTINE\n    true\n};\n/** @endcond */\n\n/**\n * All the builtin object must be extensible except the ThrowTypeError object.\n */\nJERRY_STATIC_ASSERT (ECMA_BUILTIN_EXTENSIBLE_CHECK == true,\n                     ecma_builtin_must_be_extensible_except_the_builtin_thorw_type_error_object);\n#endif /* !JERRY_NDEBUG */\n\n/**\n * List of the built-in routines.\n */\nstatic const ecma_builtin_dispatch_routine_t ecma_builtin_routines[] = {\n/** @cond doxygen_suppress */\n#define BUILTIN(a, b, c, d, e)\n#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \\\n  ecma_builtin_##lowercase_name##_dispatch_routine,\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN\n#undef BUILTIN_ROUTINE\n#define BUILTIN_ROUTINE(a, b, c, d, e)\n#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \\\n  ecma_builtin_##lowercase_name##_dispatch_routine,\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN\n#undef BUILTIN_ROUTINE\n  /** @endcond */\n};\n\n/**\n * List of the built-in call functions.\n */\nstatic const ecma_builtin_dispatch_call_t ecma_builtin_call_functions[] = {\n/** @cond doxygen_suppress */\n#define BUILTIN(a, b, c, d, e)\n#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \\\n  ecma_builtin_##lowercase_name##_dispatch_call,\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN_ROUTINE\n#undef BUILTIN\n  /** @endcond */\n};\n\n/**\n * List of the built-in construct functions.\n */\nstatic const ecma_builtin_dispatch_call_t ecma_builtin_construct_functions[] = {\n/** @cond doxygen_suppress */\n#define BUILTIN(a, b, c, d, e)\n#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \\\n  ecma_builtin_##lowercase_name##_dispatch_construct,\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN_ROUTINE\n#undef BUILTIN\n  /** @endcond */\n};\n\n/**\n * Property descriptor lists for all built-ins.\n */\nstatic const ecma_builtin_property_list_reference_t ecma_builtin_property_list_references[] = {\n/** @cond doxygen_suppress */\n#define BUILTIN(a, b, c, d, e)\n#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \\\n  ecma_builtin_##lowercase_name##_property_descriptor_list,\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN\n#undef BUILTIN_ROUTINE\n#define BUILTIN_ROUTINE(a, b, c, d, e)\n#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \\\n  ecma_builtin_##lowercase_name##_property_descriptor_list,\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN_ROUTINE\n#undef BUILTIN\n  /** @endcond */\n};\n\n/**\n * Get the number of properties of a built-in object.\n *\n * @return the number of properties\n */\nstatic size_t\necma_builtin_get_property_count (ecma_builtin_id_t builtin_id) /**< built-in ID */\n{\n  JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT);\n  const ecma_builtin_property_descriptor_t *property_list_p = ecma_builtin_property_list_references[builtin_id];\n\n  const ecma_builtin_property_descriptor_t *curr_property_p = property_list_p;\n\n  while (curr_property_p->magic_string_id != LIT_MAGIC_STRING__COUNT)\n  {\n    curr_property_p++;\n  }\n\n  return (size_t) (curr_property_p - property_list_p);\n} /* ecma_builtin_get_property_count */\n\n/**\n * Check if passed object is a global built-in.\n *\n * @return true  - if the object is a global built-in\n *         false - otherwise\n */\nbool\necma_builtin_is_global (ecma_object_t *object_p) /**< pointer to an object */\n{\n  return (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL\n          && ((ecma_extended_object_t *) object_p)->u.built_in.id == ECMA_BUILTIN_ID_GLOBAL);\n} /* ecma_builtin_is_global */\n\n/**\n * Get reference to the global object\n *\n * Note:\n *   Does not increase the reference counter.\n *\n * @return pointer to the global object\n */\nextern inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE\necma_builtin_get_global (void)\n{\n  JERRY_ASSERT (JERRY_CONTEXT (global_object_p) != NULL);\n\n  return (ecma_object_t *) JERRY_CONTEXT (global_object_p);\n} /* ecma_builtin_get_global */\n\n/**\n * Checks whether the given function is a built-in routine\n *\n * @return true - if the function object is a built-in routine\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_builtin_function_is_routine (ecma_object_t *func_obj_p) /**< function object */\n{\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n\n  ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p;\n  return (ext_func_obj_p->u.built_in.routine_id != 0);\n} /* ecma_builtin_function_is_routine */\n\n#if JERRY_BUILTIN_REALMS\n\n/**\n * Get reference to the realm provided by another built-in object\n *\n * Note:\n *   Does not increase the reference counter.\n *\n * @return pointer to the global object\n */\nstatic ecma_global_object_t *\necma_builtin_get_realm (ecma_object_t *builtin_object_p) /**< built-in object */\n{\n  ecma_object_type_t object_type = ecma_get_object_type (builtin_object_p);\n  ecma_value_t realm_value;\n\n  JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS\n                || object_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY || object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n\n  if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (object_type))\n  {\n    realm_value = ((ecma_extended_built_in_object_t *) builtin_object_p)->built_in.realm_value;\n  }\n  else\n  {\n    realm_value = ((ecma_extended_object_t *) builtin_object_p)->u.built_in.realm_value;\n  }\n\n  return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, realm_value);\n} /* ecma_builtin_get_realm */\n\n#endif /* JERRY_BUILTIN_REALMS */\n\n/**\n * Instantiate specified ECMA built-in object\n *\n * @return the newly instantiated built-in\n */\nstatic ecma_object_t *\necma_instantiate_builtin (ecma_global_object_t *global_object_p, /**< global object */\n                          ecma_builtin_id_t obj_builtin_id) /**< built-in id */\n{\n  jmem_cpointer_t *builtin_objects = global_object_p->builtin_objects;\n\n  JERRY_ASSERT (obj_builtin_id < ECMA_BUILTIN_OBJECTS_COUNT);\n  JERRY_ASSERT (builtin_objects[obj_builtin_id] == JMEM_CP_NULL);\n\n  ecma_builtin_descriptor_t builtin_desc = ecma_builtin_descriptors[obj_builtin_id];\n  ecma_builtin_id_t object_prototype_builtin_id = (ecma_builtin_id_t) (builtin_desc >> ECMA_BUILTIN_PROTOTYPE_ID_SHIFT);\n\n  ecma_object_t *prototype_obj_p;\n\n  if (JERRY_UNLIKELY (object_prototype_builtin_id == ECMA_BUILTIN_ID__COUNT))\n  {\n    prototype_obj_p = NULL;\n  }\n  else\n  {\n    if (builtin_objects[object_prototype_builtin_id] == JMEM_CP_NULL)\n    {\n      ecma_instantiate_builtin (global_object_p, object_prototype_builtin_id);\n    }\n    prototype_obj_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, builtin_objects[object_prototype_builtin_id]);\n    JERRY_ASSERT (prototype_obj_p != NULL);\n  }\n\n  ecma_object_type_t obj_type = (ecma_object_type_t) (builtin_desc & ECMA_BUILTIN_OBJECT_TYPE_MASK);\n\n  JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS\n                || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n\n  bool is_extended_built_in = ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (obj_type);\n\n  size_t ext_object_size =\n    (is_extended_built_in ? sizeof (ecma_extended_built_in_object_t) : sizeof (ecma_extended_object_t));\n\n  size_t property_count = ecma_builtin_get_property_count (obj_builtin_id);\n\n  if (property_count > ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE)\n  {\n    /* Only 64 extra properties supported at the moment.\n     * This can be extended to 256 later. */\n    JERRY_ASSERT (property_count <= (ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE + 64));\n\n    ext_object_size += sizeof (uint64_t);\n  }\n\n  ecma_object_t *obj_p = ecma_create_object (prototype_obj_p, ext_object_size, obj_type);\n\n  if (JERRY_UNLIKELY (obj_builtin_id == ECMA_BUILTIN_ID_TYPE_ERROR_THROWER))\n  {\n    ecma_op_ordinary_object_prevent_extensions (obj_p);\n  }\n  else\n  {\n    ecma_op_ordinary_object_set_extensible (obj_p);\n  }\n\n  /*\n   * [[Class]] property of built-in object is not stored explicitly.\n   *\n   * See also: ecma_object_get_class_name\n   */\n\n  ecma_built_in_props_t *built_in_props_p;\n\n  if (is_extended_built_in)\n  {\n    built_in_props_p = &((ecma_extended_built_in_object_t *) obj_p)->built_in;\n  }\n  else\n  {\n    built_in_props_p = &((ecma_extended_object_t *) obj_p)->u.built_in;\n  }\n\n  built_in_props_p->id = (uint8_t) obj_builtin_id;\n  built_in_props_p->routine_id = 0;\n  built_in_props_p->u.length_and_bitset_size = 0;\n  built_in_props_p->u2.instantiated_bitset[0] = 0;\n#if JERRY_BUILTIN_REALMS\n  ECMA_SET_INTERNAL_VALUE_POINTER (built_in_props_p->realm_value, global_object_p);\n#else /* !JERRY_BUILTIN_REALMS */\n  built_in_props_p->continue_instantiated_bitset[0] = 0;\n#endif /* JERRY_BUILTIN_REALMS */\n\n  if (property_count > ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE)\n  {\n    built_in_props_p->u.length_and_bitset_size = 1 << ECMA_BUILT_IN_BITSET_SHIFT;\n\n    uint32_t *instantiated_bitset_p = (uint32_t *) (built_in_props_p + 1);\n    instantiated_bitset_p[0] = 0;\n    instantiated_bitset_p[1] = 0;\n  }\n\n  /** Initializing [[PrimitiveValue]] properties of built-in prototype objects */\n  switch (obj_builtin_id)\n  {\n#if JERRY_BUILTIN_ARRAY\n    case ECMA_BUILTIN_ID_ARRAY_PROTOTYPE:\n    {\n      JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY);\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n\n      ext_object_p->u.array.length = 0;\n      ext_object_p->u.array.length_prop_and_hole_count = ECMA_PROPERTY_FLAG_WRITABLE | ECMA_PROPERTY_VIRTUAL;\n      break;\n    }\n#endif /* JERRY_BUILTIN_ARRAY */\n\n#if JERRY_BUILTIN_STRING\n    case ECMA_BUILTIN_ID_STRING_PROTOTYPE:\n    {\n      JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS);\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n\n      ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_STRING;\n      ext_object_p->u.cls.u3.value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n      break;\n    }\n#endif /* JERRY_BUILTIN_STRING */\n\n#if JERRY_BUILTIN_NUMBER\n    case ECMA_BUILTIN_ID_NUMBER_PROTOTYPE:\n    {\n      JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS);\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n\n      ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_NUMBER;\n      ext_object_p->u.cls.u3.value = ecma_make_integer_value (0);\n      break;\n    }\n#endif /* JERRY_BUILTIN_NUMBER */\n\n#if JERRY_BUILTIN_BOOLEAN\n    case ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE:\n    {\n      JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS);\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n\n      ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_BOOLEAN;\n      ext_object_p->u.cls.u3.value = ECMA_VALUE_FALSE;\n      break;\n    }\n#endif /* JERRY_BUILTIN_BOOLEAN */\n\n    default:\n    {\n      JERRY_ASSERT (obj_type != ECMA_OBJECT_TYPE_BUILT_IN_CLASS);\n      break;\n    }\n  }\n\n  ECMA_SET_NON_NULL_POINTER (builtin_objects[obj_builtin_id], obj_p);\n  ecma_deref_object (obj_p);\n  return obj_p;\n} /* ecma_instantiate_builtin */\n\n/**\n * Create a global object\n *\n * @return a new global object\n */\necma_global_object_t *\necma_builtin_create_global_object (void)\n{\n  ecma_builtin_descriptor_t builtin_desc = ecma_builtin_descriptors[ECMA_BUILTIN_ID_GLOBAL];\n  ecma_builtin_id_t prototype_builtin_id = (ecma_builtin_id_t) (builtin_desc >> ECMA_BUILTIN_PROTOTYPE_ID_SHIFT);\n  ecma_object_type_t obj_type = (ecma_object_type_t) (builtin_desc & ECMA_BUILTIN_OBJECT_TYPE_MASK);\n  size_t property_count = ecma_builtin_get_property_count (ECMA_BUILTIN_ID_GLOBAL);\n\n  JERRY_ASSERT (prototype_builtin_id != ECMA_BUILTIN_ID__COUNT);\n  JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL);\n\n  /* Whenever this assertion fails, the size of extra_instantiated_bitset in ecma_global_object_t\n   * must be increased and 32 must be added to these constants. Furthermore the new uint32 item\n   * must be set to zero. */\n#if JERRY_BUILTIN_REALMS\n  JERRY_ASSERT (property_count <= ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE + 64);\n#else /* !JERRY_BUILTIN_REALMS */\n  JERRY_ASSERT (property_count <= ECMA_BUILTIN_INSTANTIATED_BITSET_MIN_SIZE + 32);\n#endif /* JERRY_BUILTIN_REALMS */\n\n  ecma_object_t *object_p = ecma_create_object (NULL, sizeof (ecma_global_object_t), obj_type);\n\n  ecma_op_ordinary_object_set_extensible (object_p);\n\n  ecma_global_object_t *global_object_p = (ecma_global_object_t *) object_p;\n\n  global_object_p->extended_object.u.built_in.id = (uint8_t) ECMA_BUILTIN_ID_GLOBAL;\n  global_object_p->extended_object.u.built_in.routine_id = 0;\n  /* Bitset size is ignored by the gc. */\n  global_object_p->extended_object.u.built_in.u.length_and_bitset_size = 0;\n  global_object_p->extended_object.u.built_in.u2.instantiated_bitset[0] = 0;\n  global_object_p->extra_instantiated_bitset[0] = 0;\n#if JERRY_BUILTIN_REALMS\n  ECMA_SET_INTERNAL_VALUE_POINTER (global_object_p->extended_object.u.built_in.realm_value, global_object_p);\n  global_object_p->extra_realms_bitset = 0;\n  global_object_p->this_binding = ecma_make_object_value (object_p);\n#else /* !JERRY_BUILTIN_REALMS */\n  global_object_p->extended_object.u.built_in.continue_instantiated_bitset[0] = 0;\n#endif /* JERRY_BUILTIN_REALMS */\n\n  memset (global_object_p->builtin_objects, 0, (sizeof (jmem_cpointer_t) * ECMA_BUILTIN_OBJECTS_COUNT));\n\n  /* Temporary self reference for GC mark. */\n  ECMA_SET_NON_NULL_POINTER (global_object_p->global_env_cp, object_p);\n  global_object_p->global_scope_cp = global_object_p->global_env_cp;\n\n  ecma_object_t *global_lex_env_p = ecma_create_object_lex_env (NULL, object_p);\n\n  ECMA_SET_NON_NULL_POINTER (global_object_p->global_env_cp, global_lex_env_p);\n  global_object_p->global_scope_cp = global_object_p->global_env_cp;\n\n  ecma_deref_object (global_lex_env_p);\n\n  ecma_object_t *prototype_object_p;\n  prototype_object_p = ecma_instantiate_builtin (global_object_p, prototype_builtin_id);\n  JERRY_ASSERT (prototype_object_p != NULL);\n\n  ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, prototype_object_p);\n\n  return global_object_p;\n} /* ecma_builtin_create_global_object */\n\n/**\n * Get reference to specified built-in object\n *\n * Note:\n *   Does not increase the reference counter.\n *\n * @return pointer to the object's instance\n */\necma_object_t *\necma_builtin_get (ecma_builtin_id_t builtin_id) /**< id of built-in to check on */\n{\n  JERRY_ASSERT (builtin_id < ECMA_BUILTIN_OBJECTS_COUNT);\n\n  ecma_global_object_t *global_object_p = (ecma_global_object_t *) ecma_builtin_get_global ();\n  jmem_cpointer_t *builtin_p = global_object_p->builtin_objects + builtin_id;\n\n  if (JERRY_UNLIKELY (*builtin_p == JMEM_CP_NULL))\n  {\n    return ecma_instantiate_builtin (global_object_p, builtin_id);\n  }\n\n  return ECMA_GET_NON_NULL_POINTER (ecma_object_t, *builtin_p);\n} /* ecma_builtin_get */\n\n#if JERRY_BUILTIN_REALMS\n\n/**\n * Get reference to specified built-in object using the realm provided by another built-in object\n *\n * Note:\n *   Does not increase the reference counter.\n *\n * @return pointer to the object's instance\n */\necma_object_t *\necma_builtin_get_from_realm (ecma_global_object_t *global_object_p, /**< global object */\n                             ecma_builtin_id_t builtin_id) /**< id of built-in to check on */\n{\n  JERRY_ASSERT (builtin_id < ECMA_BUILTIN_OBJECTS_COUNT);\n\n  jmem_cpointer_t *builtin_p = global_object_p->builtin_objects + builtin_id;\n\n  if (JERRY_UNLIKELY (*builtin_p == JMEM_CP_NULL))\n  {\n    return ecma_instantiate_builtin (global_object_p, builtin_id);\n  }\n\n  return ECMA_GET_NON_NULL_POINTER (ecma_object_t, *builtin_p);\n} /* ecma_builtin_get_from_realm */\n\n#endif /* JERRY_BUILTIN_REALMS */\n\n/**\n * Get reference to specified built-in object using the realm provided by another built-in object\n *\n * Note:\n *   Does not increase the reference counter.\n *\n * @return pointer to the object's instance\n */\nstatic inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE\necma_builtin_get_from_builtin (ecma_object_t *builtin_object_p, /**< built-in object */\n                               ecma_builtin_id_t builtin_id) /**< id of built-in to check on */\n{\n  JERRY_ASSERT (builtin_id < ECMA_BUILTIN_OBJECTS_COUNT);\n\n#if JERRY_BUILTIN_REALMS\n  return ecma_builtin_get_from_realm (ecma_builtin_get_realm (builtin_object_p), builtin_id);\n#else /* !JERRY_BUILTIN_REALMS */\n  JERRY_UNUSED (builtin_object_p);\n  return ecma_builtin_get (builtin_id);\n#endif /* JERRY_BUILTIN_REALMS */\n} /* ecma_builtin_get_from_builtin */\n\n/**\n * Construct a Function object for specified built-in routine\n *\n * See also: ECMA-262 v5, 15\n *\n * @return pointer to constructed Function object\n */\nstatic ecma_object_t *\necma_builtin_make_function_object_for_routine (ecma_object_t *builtin_object_p, /**< builtin object */\n                                               uint8_t routine_id, /**< builtin-wide identifier of the built-in\n                                                                    *   object's routine property */\n                                               uint32_t routine_index, /**< property descriptor index of routine */\n                                               uint8_t flags) /**< see also: ecma_builtin_routine_flags */\n{\n  ecma_object_t *prototype_obj_p = ecma_builtin_get_from_builtin (builtin_object_p, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);\n\n  size_t ext_object_size = sizeof (ecma_extended_object_t);\n\n  ecma_object_t *func_obj_p = ecma_create_object (prototype_obj_p, ext_object_size, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n\n  JERRY_ASSERT (routine_id > 0);\n  JERRY_ASSERT (routine_index <= UINT8_MAX);\n\n  ecma_built_in_props_t *built_in_props_p;\n\n  if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (ecma_get_object_type (builtin_object_p)))\n  {\n    built_in_props_p = &((ecma_extended_built_in_object_t *) builtin_object_p)->built_in;\n  }\n  else\n  {\n    built_in_props_p = &((ecma_extended_object_t *) builtin_object_p)->u.built_in;\n  }\n\n  ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p;\n  ext_func_obj_p->u.built_in.id = built_in_props_p->id;\n  ext_func_obj_p->u.built_in.routine_id = routine_id;\n  ext_func_obj_p->u.built_in.u.routine_index = (uint8_t) routine_index;\n  ext_func_obj_p->u.built_in.u2.routine_flags = flags;\n\n#if JERRY_BUILTIN_REALMS\n  ext_func_obj_p->u.built_in.realm_value = built_in_props_p->realm_value;\n#endif /* JERRY_BUILTIN_REALMS */\n\n  return func_obj_p;\n} /* ecma_builtin_make_function_object_for_routine */\n\n/**\n * Construct a Function object for specified built-in accessor getter\n *\n * @return pointer to constructed accessor getter Function object\n */\nstatic ecma_object_t *\necma_builtin_make_function_object_for_getter_accessor (ecma_object_t *builtin_object_p, /**< builtin object */\n                                                       uint8_t routine_id, /**< builtin-wide id of the built-in\n                                                                            *   object's routine property */\n                                                       uint32_t routine_index) /**< property descriptor index\n                                                                                *   of routine */\n{\n  return ecma_builtin_make_function_object_for_routine (builtin_object_p,\n                                                        routine_id,\n                                                        routine_index,\n                                                        ECMA_BUILTIN_ROUTINE_GETTER);\n} /* ecma_builtin_make_function_object_for_getter_accessor */\n\n/**\n * Construct a Function object for specified built-in accessor setter\n *\n * @return pointer to constructed accessor getter Function object\n */\nstatic ecma_object_t *\necma_builtin_make_function_object_for_setter_accessor (ecma_object_t *builtin_object_p, /**< builtin object */\n                                                       uint8_t routine_id, /**< builtin-wide id of the built-in\n                                                                            *   object's routine property */\n                                                       uint32_t routine_index) /**< property descriptor index\n                                                                                *   of routine */\n{\n  return ecma_builtin_make_function_object_for_routine (builtin_object_p,\n                                                        routine_id,\n                                                        routine_index,\n                                                        ECMA_BUILTIN_ROUTINE_SETTER);\n} /* ecma_builtin_make_function_object_for_setter_accessor */\n\n/**\n * Create specification defined properties for built-in native handlers.\n *\n * @return pointer property, if one was instantiated,\n *         NULL - otherwise.\n */\nstatic ecma_property_t *\necma_builtin_native_handler_try_to_instantiate_property (ecma_object_t *object_p, /**< object */\n                                                         ecma_string_t *property_name_p) /**< property's name */\n{\n  JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n  ecma_property_t *prop_p = NULL;\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_NAME))\n  {\n    if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED) == 0)\n    {\n      ecma_property_value_t *value_p =\n        ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &prop_p);\n\n      value_p->value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n    }\n  }\n  else if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH))\n  {\n    if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED) == 0)\n    {\n      ecma_property_value_t *value_p =\n        ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &prop_p);\n\n      const uint8_t length = ecma_builtin_handler_get_length (ext_obj_p->u.built_in.routine_id);\n      value_p->value = ecma_make_integer_value (length);\n    }\n  }\n\n  return prop_p;\n} /* ecma_builtin_native_handler_try_to_instantiate_property */\n\n/**\n * Lazy instantiation of builtin routine property of builtin object\n *\n * If the property is not instantiated yet, instantiate the property and\n * return pointer to the instantiated property.\n *\n * @return pointer property, if one was instantiated,\n *         NULL - otherwise.\n */\necma_property_t *\necma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, /**< object */\n                                                  ecma_string_t *property_name_p) /**< property name */\n{\n  JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION\n                && ecma_builtin_function_is_routine (object_p));\n\n  ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;\n\n  if (JERRY_UNLIKELY (ext_func_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER))\n  {\n    return ecma_builtin_native_handler_try_to_instantiate_property (object_p, property_name_p);\n  }\n\n  if (ecma_string_is_length (property_name_p))\n  {\n    /*\n     * Lazy instantiation of 'length' property\n     */\n    ecma_property_t *len_prop_p;\n\n    uint8_t *bitset_p = &ext_func_p->u.built_in.u2.routine_flags;\n\n    if (*bitset_p & ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED)\n    {\n      /* length property was already instantiated */\n      return NULL;\n    }\n\n    /* We mark that the property was lazily instantiated,\n     * as it is configurable and so can be deleted (ECMA-262 v6, 19.2.4.1) */\n    ecma_property_value_t *len_prop_value_p =\n      ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &len_prop_p);\n\n    uint8_t length = 0;\n\n    if (ext_func_p->u.built_in.u2.routine_flags & ECMA_BUILTIN_ROUTINE_SETTER)\n    {\n      length = 1;\n    }\n    else if (!(ext_func_p->u.built_in.u2.routine_flags & ECMA_BUILTIN_ROUTINE_GETTER))\n    {\n      uint8_t routine_index = ext_func_p->u.built_in.u.routine_index;\n      const ecma_builtin_property_descriptor_t *property_list_p;\n\n      property_list_p = ecma_builtin_property_list_references[ext_func_p->u.built_in.id];\n\n      JERRY_ASSERT (property_list_p[routine_index].type == ECMA_BUILTIN_PROPERTY_ROUTINE);\n\n      length = ECMA_GET_ROUTINE_LENGTH (property_list_p[routine_index].value);\n    }\n\n    len_prop_value_p->value = ecma_make_integer_value (length);\n    return len_prop_p;\n  }\n\n  /*\n   * Lazy instantiation of 'name' property\n   */\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_NAME))\n  {\n    uint8_t *bitset_p = &ext_func_p->u.built_in.u2.routine_flags;\n\n    if (*bitset_p & ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED)\n    {\n      /* name property was already instantiated */\n      return NULL;\n    }\n\n    /* We mark that the property was lazily instantiated */\n    ecma_property_t *name_prop_p;\n    ecma_property_value_t *name_prop_value_p =\n      ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &name_prop_p);\n\n    uint8_t routine_index = ext_func_p->u.built_in.u.routine_index;\n    const ecma_builtin_property_descriptor_t *property_list_p;\n\n    property_list_p = ecma_builtin_property_list_references[ext_func_p->u.built_in.id];\n\n    JERRY_ASSERT (property_list_p[routine_index].type == ECMA_BUILTIN_PROPERTY_ROUTINE\n                  || property_list_p[routine_index].type == ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE\n                  || property_list_p[routine_index].type == ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY);\n\n    lit_magic_string_id_t name_id = property_list_p[routine_index].magic_string_id;\n    ecma_string_t *name_p;\n\n    if (JERRY_UNLIKELY (name_id > LIT_NON_INTERNAL_MAGIC_STRING__COUNT))\n    {\n      /* Note: Whenever new intrinsic routine is being added this mapping should be updated as well! */\n      if (JERRY_UNLIKELY (name_id == LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES)\n          || JERRY_UNLIKELY (name_id == LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES)\n          || JERRY_UNLIKELY (name_id == LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES))\n      {\n        name_p = ecma_get_magic_string (LIT_MAGIC_STRING_VALUES);\n      }\n      else if (JERRY_UNLIKELY (name_id == LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES))\n      {\n        name_p = ecma_get_magic_string (LIT_MAGIC_STRING_ENTRIES);\n      }\n      else\n      {\n        JERRY_ASSERT (LIT_IS_GLOBAL_SYMBOL (name_id));\n        name_p = ecma_op_get_global_symbol (name_id);\n      }\n    }\n    else\n    {\n      name_p = ecma_get_magic_string (name_id);\n    }\n\n    char *prefix_p = NULL;\n    lit_utf8_size_t prefix_size = 0;\n\n    if (*bitset_p & (ECMA_BUILTIN_ROUTINE_GETTER | ECMA_BUILTIN_ROUTINE_SETTER))\n    {\n      prefix_size = 4;\n      prefix_p = (*bitset_p & ECMA_BUILTIN_ROUTINE_GETTER) ? \"get \" : \"set \";\n    }\n\n    name_prop_value_p->value = ecma_op_function_form_name (name_p, prefix_p, prefix_size);\n\n    if (JERRY_UNLIKELY (name_id > LIT_NON_INTERNAL_MAGIC_STRING__COUNT))\n    {\n      ecma_deref_ecma_string (name_p);\n    }\n\n    return name_prop_p;\n  }\n\n  return NULL;\n} /* ecma_builtin_routine_try_to_instantiate_property */\n\n/**\n * If the property's name is one of built-in properties of the object\n * that is not instantiated yet, instantiate the property and\n * return pointer to the instantiated property.\n *\n * @return pointer property, if one was instantiated,\n *         NULL - otherwise.\n */\necma_property_t *\necma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object */\n                                          ecma_string_t *property_name_p) /**< property's name */\n{\n  lit_magic_string_id_t magic_string_id = ecma_get_string_magic (property_name_p);\n\n  if (JERRY_UNLIKELY (ecma_prop_name_is_symbol (property_name_p)) && property_name_p->u.hash & ECMA_SYMBOL_FLAG_GLOBAL)\n  {\n    magic_string_id = (property_name_p->u.hash >> ECMA_SYMBOL_FLAGS_SHIFT);\n  }\n\n  if (magic_string_id == LIT_MAGIC_STRING__COUNT)\n  {\n    return NULL;\n  }\n\n  ecma_built_in_props_t *built_in_props_p;\n  ecma_object_type_t object_type = ecma_get_object_type (object_p);\n\n  JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS\n                || object_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY\n                || (object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION && !ecma_builtin_function_is_routine (object_p)));\n\n  if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (object_type))\n  {\n    built_in_props_p = &((ecma_extended_built_in_object_t *) object_p)->built_in;\n  }\n  else\n  {\n    built_in_props_p = &((ecma_extended_object_t *) object_p)->u.built_in;\n  }\n\n  ecma_builtin_id_t builtin_id = (ecma_builtin_id_t) built_in_props_p->id;\n\n  JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT);\n\n  const ecma_builtin_property_descriptor_t *property_list_p = ecma_builtin_property_list_references[builtin_id];\n  const ecma_builtin_property_descriptor_t *curr_property_p = property_list_p;\n\n  while (curr_property_p->magic_string_id != magic_string_id)\n  {\n    if (curr_property_p->magic_string_id == LIT_MAGIC_STRING__COUNT)\n    {\n      return NULL;\n    }\n    curr_property_p++;\n  }\n\n  uint32_t index = (uint32_t) (curr_property_p - property_list_p);\n  uint8_t *bitset_p = built_in_props_p->u2.instantiated_bitset + (index >> 3);\n\n#if JERRY_BUILTIN_REALMS\n  if (index >= 8 * sizeof (uint8_t))\n  {\n    bitset_p += sizeof (ecma_value_t);\n  }\n#endif /* JERRY_BUILTIN_REALMS */\n\n  uint8_t bit_for_index = (uint8_t) (1u << (index & 0x7));\n\n  if (*bitset_p & bit_for_index)\n  {\n    /* This property was instantiated before. */\n    return NULL;\n  }\n\n  ecma_value_t value = ECMA_VALUE_EMPTY;\n  bool is_accessor = false;\n  ecma_object_t *getter_p = NULL;\n  ecma_object_t *setter_p = NULL;\n\n  switch (curr_property_p->type)\n  {\n    case ECMA_BUILTIN_PROPERTY_SIMPLE:\n    {\n      value = curr_property_p->value;\n\n#if JERRY_BUILTIN_GLOBAL_THIS\n      if (value == ECMA_VALUE_GLOBAL_THIS)\n      {\n        /* Only the global object has globalThis property. */\n        JERRY_ASSERT (ecma_builtin_is_global (object_p));\n        ecma_ref_object (object_p);\n        value = ecma_make_object_value (object_p);\n      }\n#endif /* JERRY_BUILTIN_GLOBAL_THIS */\n      break;\n    }\n    case ECMA_BUILTIN_PROPERTY_NUMBER:\n    {\n      ecma_number_t num = 0.0;\n\n      if (curr_property_p->value < ECMA_BUILTIN_NUMBER_MAX)\n      {\n        num = curr_property_p->value;\n      }\n      else if (curr_property_p->value < ECMA_BUILTIN_NUMBER_NAN)\n      {\n        static const ecma_number_t builtin_number_list[] = {\n          ECMA_NUMBER_MAX_VALUE,\n          ECMA_NUMBER_MIN_VALUE,\n          ECMA_NUMBER_EPSILON,\n          ECMA_NUMBER_MAX_SAFE_INTEGER,\n          ECMA_NUMBER_MIN_SAFE_INTEGER,\n          ECMA_NUMBER_E,\n          ECMA_NUMBER_PI,\n          ECMA_NUMBER_LN10,\n          ECMA_NUMBER_LN2,\n          ECMA_NUMBER_LOG2E,\n          ECMA_NUMBER_LOG10E,\n          ECMA_NUMBER_SQRT2,\n          ECMA_NUMBER_SQRT_1_2,\n        };\n\n        num = builtin_number_list[curr_property_p->value - ECMA_BUILTIN_NUMBER_MAX];\n      }\n      else\n      {\n        switch (curr_property_p->value)\n        {\n          case ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY:\n          {\n            num = ecma_number_make_infinity (false);\n            break;\n          }\n          case ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY:\n          {\n            num = ecma_number_make_infinity (true);\n            break;\n          }\n          default:\n          {\n            JERRY_ASSERT (curr_property_p->value == ECMA_BUILTIN_NUMBER_NAN);\n\n            num = ecma_number_make_nan ();\n            break;\n          }\n        }\n      }\n\n      value = ecma_make_number_value (num);\n      break;\n    }\n    case ECMA_BUILTIN_PROPERTY_STRING:\n    {\n      value = ecma_make_magic_string_value ((lit_magic_string_id_t) curr_property_p->value);\n      break;\n    }\n    case ECMA_BUILTIN_PROPERTY_SYMBOL:\n    {\n      lit_magic_string_id_t symbol_id = (lit_magic_string_id_t) curr_property_p->value;\n\n      value = ecma_make_symbol_value (ecma_op_get_global_symbol (symbol_id));\n      break;\n    }\n    case ECMA_BUILTIN_PROPERTY_INTRINSIC_PROPERTY:\n    {\n      ecma_object_t *intrinsic_object_p = ecma_builtin_get_from_builtin (object_p, ECMA_BUILTIN_ID_INTRINSIC_OBJECT);\n      value = ecma_op_object_get_by_magic_id (intrinsic_object_p, (lit_magic_string_id_t) curr_property_p->value);\n      break;\n    }\n    case ECMA_BUILTIN_PROPERTY_ACCESSOR_BUILTIN_FUNCTION:\n    {\n      is_accessor = true;\n      uint16_t getter_id = ECMA_ACCESSOR_READ_WRITE_GET_GETTER_ID (curr_property_p->value);\n      uint16_t setter_id = ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID (curr_property_p->value);\n      getter_p = ecma_builtin_get_from_builtin (object_p, getter_id);\n      setter_p = ecma_builtin_get_from_builtin (object_p, setter_id);\n      ecma_ref_object (getter_p);\n      ecma_ref_object (setter_p);\n      break;\n    }\n    case ECMA_BUILTIN_PROPERTY_OBJECT:\n    {\n      ecma_object_t *builtin_object_p;\n      builtin_object_p = ecma_builtin_get_from_builtin (object_p, (ecma_builtin_id_t) curr_property_p->value);\n      ecma_ref_object (builtin_object_p);\n      value = ecma_make_object_value (builtin_object_p);\n      break;\n    }\n    case ECMA_BUILTIN_PROPERTY_ROUTINE:\n    {\n      ecma_object_t *func_obj_p;\n      func_obj_p = ecma_builtin_make_function_object_for_routine (object_p,\n                                                                  ECMA_GET_ROUTINE_ID (curr_property_p->value),\n                                                                  index,\n                                                                  ECMA_BUILTIN_ROUTINE_NO_OPTS);\n      value = ecma_make_object_value (func_obj_p);\n      break;\n    }\n    case ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE:\n    {\n      is_accessor = true;\n      uint8_t getter_id = ECMA_ACCESSOR_READ_WRITE_GET_GETTER_ID (curr_property_p->value);\n      uint8_t setter_id = ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID (curr_property_p->value);\n      getter_p = ecma_builtin_make_function_object_for_getter_accessor (object_p, getter_id, index);\n      setter_p = ecma_builtin_make_function_object_for_setter_accessor (object_p, setter_id, index);\n      break;\n    }\n    default:\n    {\n      JERRY_ASSERT (curr_property_p->type == ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY);\n\n      is_accessor = true;\n      uint8_t getter_id = (uint8_t) curr_property_p->value;\n      getter_p = ecma_builtin_make_function_object_for_getter_accessor (object_p, getter_id, index);\n      break;\n    }\n  }\n\n  ecma_property_t *prop_p;\n\n  JERRY_ASSERT (curr_property_p->attributes & ECMA_PROPERTY_FLAG_BUILT_IN);\n\n  if (is_accessor)\n  {\n    ecma_create_named_accessor_property (object_p,\n                                         property_name_p,\n                                         getter_p,\n                                         setter_p,\n                                         curr_property_p->attributes,\n                                         &prop_p);\n\n    if (setter_p)\n    {\n      ecma_deref_object (setter_p);\n    }\n    if (getter_p)\n    {\n      ecma_deref_object (getter_p);\n    }\n  }\n  else\n  {\n    ecma_property_value_t *prop_value_p =\n      ecma_create_named_data_property (object_p, property_name_p, curr_property_p->attributes, &prop_p);\n    prop_value_p->value = value;\n\n    /* Reference count of objects must be decreased. */\n    ecma_deref_if_object (value);\n  }\n\n  return prop_p;\n} /* ecma_builtin_try_to_instantiate_property */\n\n/**\n * Delete configurable properties of native handlers.\n */\nstatic void\necma_builtin_native_handler_delete_built_in_property (ecma_object_t *object_p, /**< object */\n                                                      ecma_string_t *property_name_p) /**< property name */\n{\n  ecma_extended_object_t *extended_obj_p = (ecma_extended_object_t *) object_p;\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH))\n  {\n    JERRY_ASSERT (!(extended_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED));\n\n    extended_obj_p->u.built_in.u2.routine_flags |= ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED;\n    return;\n  }\n\n  JERRY_ASSERT (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_NAME));\n  JERRY_ASSERT (!(extended_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED));\n\n  extended_obj_p->u.built_in.u2.routine_flags |= ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED;\n} /* ecma_builtin_native_handler_delete_built_in_property */\n\n/**\n * Delete configurable properties of built-in routines.\n */\nvoid\necma_builtin_routine_delete_built_in_property (ecma_object_t *object_p, /**< object */\n                                               ecma_string_t *property_name_p) /**< property name */\n{\n  JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION\n                && ecma_builtin_function_is_routine (object_p));\n\n  ecma_extended_object_t *extended_obj_p = (ecma_extended_object_t *) object_p;\n\n  if (JERRY_UNLIKELY (extended_obj_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER))\n  {\n    ecma_builtin_native_handler_delete_built_in_property (object_p, property_name_p);\n    return;\n  }\n\n  uint8_t *bitset_p = &extended_obj_p->u.built_in.u2.routine_flags;\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH))\n  {\n    JERRY_ASSERT (!(*bitset_p & ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED));\n\n    *bitset_p |= ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED;\n    return;\n  }\n\n  JERRY_ASSERT (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_NAME));\n  JERRY_ASSERT (!(*bitset_p & ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED));\n\n  *bitset_p |= ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED;\n} /* ecma_builtin_routine_delete_built_in_property */\n\n/**\n * Delete configurable properties of built-ins.\n */\nvoid\necma_builtin_delete_built_in_property (ecma_object_t *object_p, /**< object */\n                                       ecma_string_t *property_name_p) /**< property name */\n{\n  lit_magic_string_id_t magic_string_id = ecma_get_string_magic (property_name_p);\n\n  if (JERRY_UNLIKELY (ecma_prop_name_is_symbol (property_name_p)))\n  {\n    if (property_name_p->u.hash & ECMA_SYMBOL_FLAG_GLOBAL)\n    {\n      magic_string_id = (property_name_p->u.hash >> ECMA_SYMBOL_FLAGS_SHIFT);\n    }\n  }\n\n  ecma_built_in_props_t *built_in_props_p;\n  ecma_object_type_t object_type = ecma_get_object_type (object_p);\n\n  JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS\n                || object_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY\n                || (object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION && !ecma_builtin_function_is_routine (object_p)));\n\n  if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (object_type))\n  {\n    built_in_props_p = &((ecma_extended_built_in_object_t *) object_p)->built_in;\n  }\n  else\n  {\n    built_in_props_p = &((ecma_extended_object_t *) object_p)->u.built_in;\n  }\n\n  ecma_builtin_id_t builtin_id = (ecma_builtin_id_t) built_in_props_p->id;\n\n  JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT);\n\n  const ecma_builtin_property_descriptor_t *property_list_p = ecma_builtin_property_list_references[builtin_id];\n  const ecma_builtin_property_descriptor_t *curr_property_p = property_list_p;\n\n  while (curr_property_p->magic_string_id != magic_string_id)\n  {\n    JERRY_ASSERT (curr_property_p->magic_string_id != LIT_MAGIC_STRING__COUNT);\n    curr_property_p++;\n  }\n\n  uint32_t index = (uint32_t) (curr_property_p - property_list_p);\n  uint8_t *bitset_p = built_in_props_p->u2.instantiated_bitset + (index >> 3);\n\n#if JERRY_BUILTIN_REALMS\n  if (index >= 8 * sizeof (uint8_t))\n  {\n    bitset_p += sizeof (ecma_value_t);\n  }\n#endif /* JERRY_BUILTIN_REALMS */\n\n  uint8_t bit_for_index = (uint8_t) (1u << (index & 0x7));\n  JERRY_ASSERT (!(*bitset_p & bit_for_index));\n\n  *bitset_p |= bit_for_index;\n} /* ecma_builtin_delete_built_in_property */\n\n/**\n * List names of an Built-in native handler object's lazy instantiated properties,\n * adding them to corresponding string collections\n */\nstatic void\necma_builtin_native_handler_list_lazy_property_names (ecma_object_t *object_p, /**< function object */\n                                                      ecma_collection_t *prop_names_p, /**< prop name collection */\n                                                      ecma_property_counter_t *prop_counter_p) /**< prop counter */\n{\n  JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n\n  if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED) == 0)\n  {\n    ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_NAME));\n    prop_counter_p->string_named_props++;\n  }\n\n  if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED) == 0)\n  {\n    ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));\n    prop_counter_p->string_named_props++;\n  }\n} /* ecma_builtin_native_handler_list_lazy_property_names */\n\n/**\n * List names of a built-in function's lazy instantiated properties\n *\n * See also:\n *          ecma_builtin_routine_try_to_instantiate_property\n */\nvoid\necma_builtin_routine_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in object */\n                                               ecma_collection_t *prop_names_p, /**< prop name collection */\n                                               ecma_property_counter_t *prop_counter_p, /**< property counters */\n                                               jerry_property_filter_t filter) /**< name filters */\n{\n  JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n  JERRY_ASSERT (ecma_builtin_function_is_routine (object_p));\n\n  if (filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS)\n  {\n    return;\n  }\n\n  ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;\n\n  if (JERRY_UNLIKELY (ext_func_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER))\n  {\n    ecma_builtin_native_handler_list_lazy_property_names (object_p, prop_names_p, prop_counter_p);\n    return;\n  }\n\n  if (!(ext_func_p->u.built_in.u2.routine_flags & ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED))\n  {\n    /* Unintialized 'length' property is non-enumerable (ECMA-262 v6, 19.2.4.1) */\n    ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));\n    prop_counter_p->string_named_props++;\n  }\n  if (!(ext_func_p->u.built_in.u2.routine_flags & ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED))\n  {\n    /* Unintialized 'name' property is non-enumerable (ECMA-262 v6, 19.2.4.2) */\n    ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_NAME));\n    prop_counter_p->string_named_props++;\n  }\n} /* ecma_builtin_routine_list_lazy_property_names */\n\n/**\n * List names of a built-in object's lazy instantiated properties\n *\n * See also:\n *          ecma_builtin_try_to_instantiate_property\n */\nvoid\necma_builtin_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in object */\n                                       ecma_collection_t *prop_names_p, /**< prop name collection */\n                                       ecma_property_counter_t *prop_counter_p, /**< property counters */\n                                       jerry_property_filter_t filter) /**< name filters */\n{\n  JERRY_ASSERT (ecma_get_object_type (object_p) != ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION\n                || !ecma_builtin_function_is_routine (object_p));\n\n  ecma_built_in_props_t *built_in_props_p;\n  ecma_object_type_t object_type = ecma_get_object_type (object_p);\n\n  if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (object_type))\n  {\n    built_in_props_p = &((ecma_extended_built_in_object_t *) object_p)->built_in;\n  }\n  else\n  {\n    built_in_props_p = &((ecma_extended_object_t *) object_p)->u.built_in;\n  }\n\n  ecma_builtin_id_t builtin_id = (ecma_builtin_id_t) built_in_props_p->id;\n\n  JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT);\n\n#if JERRY_BUILTIN_REALMS\n  uint8_t *bitset_p = built_in_props_p->u2.instantiated_bitset + 1 + sizeof (ecma_value_t);\n#else /* !JERRY_BUILTIN_REALMS */\n  uint8_t *bitset_p = built_in_props_p->u2.instantiated_bitset + 1;\n#endif /* JERRY_BUILTIN_REALMS */\n\n  uint8_t *symbol_bitset_p = bitset_p;\n  bool has_symbol = true;\n\n  if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS))\n  {\n    const ecma_builtin_property_descriptor_t *curr_property_p = ecma_builtin_property_list_references[builtin_id];\n    uint8_t bitset = built_in_props_p->u2.instantiated_bitset[0];\n    uint32_t index = 0;\n\n    has_symbol = false;\n\n    while (curr_property_p->magic_string_id != LIT_MAGIC_STRING__COUNT)\n    {\n      if (index == 8)\n      {\n        bitset = *bitset_p++;\n        index = 0;\n      }\n\n      uint32_t bit_for_index = (uint32_t) 1u << index;\n\n      if (!(bitset & bit_for_index))\n      {\n        if (JERRY_LIKELY (curr_property_p->magic_string_id < LIT_NON_INTERNAL_MAGIC_STRING__COUNT))\n        {\n          ecma_value_t name = ecma_make_magic_string_value ((lit_magic_string_id_t) curr_property_p->magic_string_id);\n          ecma_collection_push_back (prop_names_p, name);\n          prop_counter_p->string_named_props++;\n        }\n        else\n        {\n          JERRY_ASSERT (LIT_IS_GLOBAL_SYMBOL (curr_property_p->magic_string_id));\n          has_symbol = true;\n        }\n      }\n\n      curr_property_p++;\n      index++;\n    }\n  }\n\n  if (has_symbol && !(filter & JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS))\n  {\n    const ecma_builtin_property_descriptor_t *curr_property_p = ecma_builtin_property_list_references[builtin_id];\n    uint8_t bitset = built_in_props_p->u2.instantiated_bitset[0];\n    uint32_t index = 0;\n\n    while (curr_property_p->magic_string_id != LIT_MAGIC_STRING__COUNT)\n    {\n      if (index == 8)\n      {\n        bitset = *symbol_bitset_p++;\n        index = 0;\n      }\n\n      uint32_t bit_for_index = (uint32_t) 1u << index;\n\n      if (curr_property_p->magic_string_id > LIT_NON_INTERNAL_MAGIC_STRING__COUNT && !(bitset & bit_for_index))\n      {\n        ecma_string_t *name_p = ecma_op_get_global_symbol (curr_property_p->magic_string_id);\n        ecma_collection_push_back (prop_names_p, ecma_make_symbol_value (name_p));\n        prop_counter_p->symbol_named_props++;\n      }\n\n      curr_property_p++;\n      index++;\n    }\n  }\n} /* ecma_builtin_list_lazy_property_names */\n\n/**\n * Dispatcher of built-in routines\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_dispatch_routine (ecma_extended_object_t *func_obj_p, /**< builtin object */\n                               ecma_value_t this_arg_value, /**< 'this' argument value */\n                               const ecma_value_t *arguments_list_p, /**< list of arguments passed to routine */\n                               uint32_t arguments_list_len) /**< length of arguments' list */\n{\n  JERRY_ASSERT (ecma_builtin_function_is_routine ((ecma_object_t *) func_obj_p));\n\n  ecma_value_t padded_arguments_list_p[3] = { ECMA_VALUE_UNDEFINED, ECMA_VALUE_UNDEFINED, ECMA_VALUE_UNDEFINED };\n\n  if (arguments_list_len <= 2)\n  {\n    switch (arguments_list_len)\n    {\n      case 2:\n      {\n        padded_arguments_list_p[1] = arguments_list_p[1];\n        /* FALLTHRU */\n      }\n      case 1:\n      {\n        padded_arguments_list_p[0] = arguments_list_p[0];\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (arguments_list_len == 0);\n      }\n    }\n\n    arguments_list_p = padded_arguments_list_p;\n  }\n\n  return ecma_builtin_routines[func_obj_p->u.built_in.id](func_obj_p->u.built_in.routine_id,\n                                                          this_arg_value,\n                                                          arguments_list_p,\n                                                          arguments_list_len);\n} /* ecma_builtin_dispatch_routine */\n\n/**\n * Handle calling [[Call]] of built-in object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */\n                            ecma_value_t this_arg_value, /**< 'this' argument value */\n                            const ecma_value_t *arguments_list_p, /**< arguments list */\n                            uint32_t arguments_list_len) /**< arguments list length */\n{\n  JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n  if (ecma_builtin_function_is_routine (obj_p))\n  {\n    if (JERRY_UNLIKELY (ext_obj_p->u.built_in.id == ECMA_BUILTIN_ID_HANDLER))\n    {\n      ecma_builtin_handler_t handler = ecma_builtin_handler_get (ext_obj_p->u.built_in.routine_id);\n      return handler (obj_p, arguments_list_p, arguments_list_len);\n    }\n\n    return ecma_builtin_dispatch_routine (ext_obj_p, this_arg_value, arguments_list_p, arguments_list_len);\n  }\n\n  ecma_builtin_id_t builtin_object_id = ext_obj_p->u.built_in.id;\n  JERRY_ASSERT (builtin_object_id < sizeof (ecma_builtin_call_functions) / sizeof (ecma_builtin_dispatch_call_t));\n  return ecma_builtin_call_functions[builtin_object_id](arguments_list_p, arguments_list_len);\n} /* ecma_builtin_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in object\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */\n                                 const ecma_value_t *arguments_list_p, /**< arguments list */\n                                 uint32_t arguments_list_len) /**< arguments list length */\n{\n  JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n\n  if (ecma_builtin_function_is_routine (obj_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_BULTIN_ROUTINES_HAVE_NO_CONSTRUCTOR);\n  }\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n  ecma_builtin_id_t builtin_object_id = ext_obj_p->u.built_in.id;\n  JERRY_ASSERT (builtin_object_id < sizeof (ecma_builtin_construct_functions) / sizeof (ecma_builtin_dispatch_call_t));\n\n  return ecma_builtin_construct_functions[builtin_object_id](arguments_list_p, arguments_list_len);\n} /* ecma_builtin_dispatch_construct */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtins.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_BUILTINS_H\n#define ECMA_BUILTINS_H\n\n#include \"ecma-globals.h\"\n\n/**\n * A built-in object's identifier\n */\ntypedef enum\n{\n/** @cond doxygen_suppress */\n#define BUILTIN(a, b, c, d, e)\n#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) builtin_id,\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN\n#undef BUILTIN_ROUTINE\n#define BUILTIN_ROUTINE(a, b, c, d, e)\n#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) builtin_id,\n#include \"ecma-builtins.inc.h\"\n#undef BUILTIN\n#undef BUILTIN_ROUTINE\n  /** @endcond */\n  ECMA_BUILTIN_ID__COUNT /**< number of built-in objects */\n} ecma_builtin_id_t;\n\n/**\n * Special id for handlers (handlers are not regular built-ins, but\n * they use the same ecma_built_in_props_t structure as other built-ins)\n */\n#define ECMA_BUILTIN_ID_HANDLER ECMA_BUILTIN_ID__COUNT\n\n/**\n * Number of global symbols\n */\n#define ECMA_BUILTIN_GLOBAL_SYMBOL_COUNT (LIT_GLOBAL_SYMBOL__LAST - LIT_GLOBAL_SYMBOL__FIRST + 1)\n\n/**\n * Construct a routine value\n */\n#define ECMA_ROUTINE_VALUE(id, length) (((id) << 4) | length)\n\n/**\n * Get routine length\n */\n#define ECMA_GET_ROUTINE_LENGTH(value) ((uint8_t) ((value) &0xf))\n\n/**\n * Get routine ID\n */\n#define ECMA_GET_ROUTINE_ID(value) ((uint8_t) ((value) >> 4))\n\n/**\n * Construct a fully accessor value\n */\n#define ECMA_ACCESSOR_READ_WRITE(getter, setter) (((getter) << 8) | (setter))\n\n/**\n * Get accessor setter ID\n */\n#define ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID(value) ((uint8_t) ((value) &0xff))\n\n/**\n * Get accessor getter ID\n */\n#define ECMA_ACCESSOR_READ_WRITE_GET_GETTER_ID(value) ((uint8_t) ((value) >> 8))\n\n/**\n * Number ob built-in objects excluding global object\n */\n#define ECMA_BUILTIN_OBJECTS_COUNT (ECMA_BUILTIN_ID__COUNT - 1)\n\n/**\n * Description of built-in global ECMA-object.\n */\ntypedef struct\n{\n  ecma_extended_object_t extended_object; /**< extended object part */\n  uint32_t extra_instantiated_bitset[1]; /**< extra bit set for instantiated properties */\n#if JERRY_BUILTIN_REALMS\n  uint32_t extra_realms_bitset; /**< extra bit set for instantiated properties when realms is enabled */\n  ecma_value_t this_binding; /**< 'this' binding of this global object */\n#endif /* JERRY_BUILTIN_REALMS */\n  jmem_cpointer_t global_env_cp; /**< global lexical environment */\n  jmem_cpointer_t global_scope_cp; /**< global lexical scope */\n  jmem_cpointer_t builtin_objects[ECMA_BUILTIN_OBJECTS_COUNT]; /**< pointer to instances of built-in objects */\n} ecma_global_object_t;\n\n/* ecma-builtins.c */\n\necma_global_object_t *ecma_builtin_create_global_object (void);\n\necma_value_t ecma_builtin_dispatch_call (ecma_object_t *obj_p,\n                                         ecma_value_t this_arg_value,\n                                         const ecma_value_t *arguments_list_p,\n                                         uint32_t arguments_list_len);\necma_value_t ecma_builtin_dispatch_construct (ecma_object_t *obj_p,\n                                              const ecma_value_t *arguments_list_p,\n                                              uint32_t arguments_list_len);\necma_property_t *ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p,\n                                                                   ecma_string_t *property_name_p);\necma_property_t *ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p);\nvoid ecma_builtin_routine_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);\nvoid ecma_builtin_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);\nvoid ecma_builtin_routine_list_lazy_property_names (ecma_object_t *object_p,\n                                                    ecma_collection_t *prop_names_p,\n                                                    ecma_property_counter_t *prop_counter_p,\n                                                    jerry_property_filter_t filter);\nvoid ecma_builtin_list_lazy_property_names (ecma_object_t *object_p,\n                                            ecma_collection_t *prop_names_p,\n                                            ecma_property_counter_t *prop_counter_p,\n                                            jerry_property_filter_t filter);\nbool ecma_builtin_is_global (ecma_object_t *object_p);\necma_object_t *ecma_builtin_get (ecma_builtin_id_t builtin_id);\necma_object_t *ecma_builtin_get_global (void);\nbool ecma_builtin_function_is_routine (ecma_object_t *func_obj_p);\n\n#if JERRY_BUILTIN_REALMS\necma_object_t *ecma_builtin_get_from_realm (ecma_global_object_t *global_object_p, ecma_builtin_id_t builtin_id);\n#endif /* JERRY_BUILTIN_REALMS */\n\n#endif /* !ECMA_BUILTINS_H */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/ecma-builtins.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Description of built-in objects\n   in format (ECMA_BUILTIN_ID_id, object_type, prototype_id, is_extensible, is_static, underscored_id) */\n\n/* The Object.prototype object (15.2.4) */\nBUILTIN (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID__COUNT /* no prototype */,\n         true,\n         object_prototype)\n\n/* The Object object (15.2.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_OBJECT,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 object)\n\n#if JERRY_BUILTIN_ARRAY\n/* The Array.prototype object (15.4.4) */\nBUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_ARRAY,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         array_prototype)\n\n/* The Array object (15.4.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 array)\n#endif /* JERRY_BUILTIN_ARRAY */\n\n#if JERRY_BUILTIN_DATE\n/* The Date.prototype object (20.3.4) */\nBUILTIN (ECMA_BUILTIN_ID_DATE_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         date_prototype)\n#endif /* JERRY_BUILTIN_DATE */\n\n#if JERRY_BUILTIN_REGEXP\n/* The RegExp.prototype object (21.2.5) */\nBUILTIN (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         regexp_prototype)\n#endif /* JERRY_BUILTIN_REGEXP */\n\n#if JERRY_BUILTIN_STRING\n/* The String.prototype object (15.5.4) */\nBUILTIN (ECMA_BUILTIN_ID_STRING_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_CLASS,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         string_prototype)\n\n/* The String object (15.5.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_STRING,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 string)\n#endif /* JERRY_BUILTIN_STRING */\n\n#if JERRY_BUILTIN_BOOLEAN\n/* The Boolean.prototype object (15.6.4) */\nBUILTIN (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_CLASS,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         boolean_prototype)\n\n/* The Boolean object (15.6.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_BOOLEAN,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 boolean)\n#endif /* JERRY_BUILTIN_BOOLEAN */\n\n#if JERRY_BUILTIN_NUMBER\n/* The Number.prototype object (15.7.4) */\nBUILTIN (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_CLASS,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         number_prototype)\n\n/* The Number object (15.7.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_NUMBER,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 number)\n#endif /* JERRY_BUILTIN_NUMBER */\n\n/* The Function.prototype object (15.3.4) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n                 true,\n                 function_prototype)\n\n/* The Function object (15.3.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 function)\n\n#if JERRY_BUILTIN_MATH\n/* The Math object (15.8) */\nBUILTIN (ECMA_BUILTIN_ID_MATH, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, math)\n#endif /* JERRY_BUILTIN_MATH */\n\n#if JERRY_BUILTIN_REFLECT\n\n/* The Reflect object (26.1) */\nBUILTIN (ECMA_BUILTIN_ID_REFLECT, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, reflect)\n#endif /* JERRY_BUILTIN_REFLECT */\n\n#if JERRY_BUILTIN_JSON\n/* The JSON object (15.12) */\nBUILTIN (ECMA_BUILTIN_ID_JSON, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, json)\n#endif /* JERRY_BUILTIN_JSON */\n\n#if JERRY_BUILTIN_ATOMICS\n/* The Atomics object (24.4) */\nBUILTIN (ECMA_BUILTIN_ID_ATOMICS, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, atomics)\n#endif /* JERRY_BUILTIN_ATOMICS */\n\n#if JERRY_BUILTIN_DATE\n/* The Date object (15.9.3) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATE,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 date)\n#endif /* JERRY_BUILTIN_DATE */\n\n#if JERRY_BUILTIN_REGEXP\n/* The RegExp object (15.10) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_REGEXP,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 regexp)\n#endif /* JERRY_BUILTIN_REGEXP */\n\n#define ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID ECMA_BUILTIN_ID_ERROR\n\n/* The Error object (15.11.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_ERROR,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 error)\n\n/* The Error.prototype object (15.11.4) */\nBUILTIN (ECMA_BUILTIN_ID_ERROR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         error_prototype)\n\n#if JERRY_BUILTIN_ERRORS\n/* The EvalError.prototype object (15.11.6.1) */\nBUILTIN (ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ERROR_PROTOTYPE,\n         true,\n         eval_error_prototype)\n\n/* The EvalError object (15.11.6.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_EVAL_ERROR,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,\n                 true,\n                 eval_error)\n\n/* The RangeError.prototype object (15.11.6.2) */\nBUILTIN (ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ERROR_PROTOTYPE,\n         true,\n         range_error_prototype)\n\n/* The RangeError object (15.11.6.2) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_RANGE_ERROR,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,\n                 true,\n                 range_error)\n\n/* The ReferenceError.prototype object (15.11.6.3) */\nBUILTIN (ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ERROR_PROTOTYPE,\n         true,\n         reference_error_prototype)\n\n/* The ReferenceError object (15.11.6.3) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_REFERENCE_ERROR,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,\n                 true,\n                 reference_error)\n\n/* The SyntaxError.prototype object (15.11.6.4) */\nBUILTIN (ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ERROR_PROTOTYPE,\n         true,\n         syntax_error_prototype)\n\n/* The SyntaxError object (15.11.6.4) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_SYNTAX_ERROR,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,\n                 true,\n                 syntax_error)\n\n/* The TypeError.prototype object (15.11.6.5) */\nBUILTIN (ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ERROR_PROTOTYPE,\n         true,\n         type_error_prototype)\n\n/* The TypeError object (15.11.6.5) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,\n                 true,\n                 type_error)\n\n/* The AggregateError.prototype object (15.11.6.5) */\nBUILTIN (ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ERROR_PROTOTYPE,\n         true,\n         aggregate_error_prototype)\n\n/* The AggregateError object (15.11.6.5) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_AGGREGATE_ERROR,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,\n                 true,\n                 aggregate_error)\n\n/* The URIError.prototype object (15.11.6.6) */\nBUILTIN (ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ERROR_PROTOTYPE,\n         true,\n         uri_error_prototype)\n\n/* The URIError object (15.11.6.6) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_URI_ERROR,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_NATIVE_ERROR_PROTOTYPE_ID,\n                 true,\n                 uri_error)\n#endif /* JERRY_BUILTIN_ERRORS */\n\n/**< The [[ThrowTypeError]] object (13.2.3) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 false,\n                 type_error_thrower)\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/* The ArrayBuffer.prototype object (ES2015 24.1.4) */\nBUILTIN (ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         arraybuffer_prototype)\n\n/* The ArrayBuffer object (ES2015 24.1.2) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAYBUFFER,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 arraybuffer)\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n\n/* The SharedArrayBuffer.prototype object (ES2015 24.2.4) */\nBUILTIN (ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         shared_arraybuffer_prototype)\n\n/* The SharedArrayBuffer object (ES2015 24.2.2) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 shared_arraybuffer)\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n\n/* The %TypedArrayPrototype% object (ES2015 24.2.3) */\nBUILTIN (ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         typedarray_prototype)\n\n/* The %TypedArray% intrinsic object (ES2015 22.2.1)\n   Note: The routines must be in this order. */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPEDARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 typedarray)\n\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT8ARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_TYPEDARRAY,\n                 true,\n                 int8array)\n\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT8ARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_TYPEDARRAY,\n                 true,\n                 uint8array)\n\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_TYPEDARRAY,\n                 true,\n                 uint8clampedarray)\n\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT16ARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_TYPEDARRAY,\n                 true,\n                 int16array)\n\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT16ARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_TYPEDARRAY,\n                 true,\n                 uint16array)\n\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT32ARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_TYPEDARRAY,\n                 true,\n                 int32array)\n\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT32ARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_TYPEDARRAY,\n                 true,\n                 uint32array)\n\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT32ARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_TYPEDARRAY,\n                 true,\n                 float32array)\n\n#if JERRY_NUMBER_TYPE_FLOAT64\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT64ARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_TYPEDARRAY,\n                 true,\n                 float64array)\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n#if JERRY_BUILTIN_BIGINT\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGINT64ARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_TYPEDARRAY,\n                 true,\n                 bigint64array)\n\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGUINT64ARRAY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_TYPEDARRAY,\n                 true,\n                 biguint64array)\n#endif /* JERRY_BUILTIN_BIGINT */\n\nBUILTIN (ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         true,\n         int8array_prototype)\n\nBUILTIN (ECMA_BUILTIN_ID_UINT8ARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         true,\n         uint8array_prototype)\n\nBUILTIN (ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         true,\n         uint8clampedarray_prototype)\n\nBUILTIN (ECMA_BUILTIN_ID_INT16ARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         true,\n         int16array_prototype)\n\nBUILTIN (ECMA_BUILTIN_ID_UINT16ARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         true,\n         uint16array_prototype)\n\nBUILTIN (ECMA_BUILTIN_ID_INT32ARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         true,\n         int32array_prototype)\n\nBUILTIN (ECMA_BUILTIN_ID_UINT32ARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         true,\n         uint32array_prototype)\n\nBUILTIN (ECMA_BUILTIN_ID_FLOAT32ARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         true,\n         float32array_prototype)\n\n#if JERRY_NUMBER_TYPE_FLOAT64\nBUILTIN (ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         true,\n         float64array_prototype)\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n#if JERRY_BUILTIN_BIGINT\nBUILTIN (ECMA_BUILTIN_ID_BIGINT64ARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         true,\n         bigint64array_prototype)\n\nBUILTIN (ECMA_BUILTIN_ID_BIGUINT64ARRAY_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,\n         true,\n         biguint64array_prototype)\n#endif /* JERRY_BUILTIN_BIGINT */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\nBUILTIN (ECMA_BUILTIN_ID_PROMISE_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         promise_prototype)\n\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROMISE,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 promise)\n\n#if JERRY_BUILTIN_CONTAINER\n\n/* The Map prototype object (23.1.3) */\nBUILTIN (ECMA_BUILTIN_ID_MAP_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         map_prototype)\n\n/* The Map routine (ECMA-262 v6, 23.1.1.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_MAP, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, true, map)\n\n/* The Set prototype object (23.1.3) */\nBUILTIN (ECMA_BUILTIN_ID_SET_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         set_prototype)\n\n/* The Set routine (ECMA-262 v6, 23.1.1.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_SET, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, true, set)\n\n/* The WeakMap prototype object (23.1.3) */\nBUILTIN (ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         weakmap_prototype)\n\n/* The WeakMap routine (ECMA-262 v6, 23.1.1.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKMAP,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 weakmap)\n\n/* The WeakSet prototype object (23.1.3) */\nBUILTIN (ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         weakset_prototype)\n\n/* The WeakSet routine (ECMA-262 v6, 23.1.1.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKSET,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 weakset)\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#if JERRY_BUILTIN_WEAKREF\n\n/* The WeakRef prototype object */\nBUILTIN (ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         weakref_prototype)\n\n/* The WeakRef routine */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_WEAKREF,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 weakref)\n\n#endif /* JERRY_BUILTIN_WEAKREF */\n\n#if (JERRY_BUILTIN_PROXY)\n/* The Proxy routine (ECMA-262 v6, 26.2.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROXY,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 proxy)\n#endif /* JERRY_BUILTIN_PROXY */\n\n/* Intrinsic hidden builtin object  */\nBUILTIN (ECMA_BUILTIN_ID_INTRINSIC_OBJECT,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID__COUNT /* no prototype */,\n         true,\n         intrinsic)\n\n/* The Array.prototype[@@unscopables] object */\nBUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE_UNSCOPABLES,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID__COUNT /* no prototype */,\n         true,\n         array_prototype_unscopables)\n\n/* The Symbol prototype object (ECMA-262 v6, 19.4.2.7) */\nBUILTIN (ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         symbol_prototype)\n\n/* The Symbol routine (ECMA-262 v6, 19.4.2.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_SYMBOL,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 symbol)\n\n/* The %AsyncFunction% object (ECMA-262 v11, 25.7.2) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_ASYNC_FUNCTION,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION,\n                 true,\n                 async_function)\n\n/* The %AsyncFunctionPrototype% object (ECMA-262 v11, 25.7.3) */\nBUILTIN (ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n         true,\n         async_function_prototype)\n\n/* The %IteratorPrototype% object (ECMA-262 v6, 25.1.2) */\nBUILTIN (ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         iterator_prototype)\n\n/* The %ArrayIteratorPrototype% object (ECMA-262 v6, 22.1.5.2) */\nBUILTIN (ECMA_BUILTIN_ID_ARRAY_ITERATOR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE,\n         true,\n         array_iterator_prototype)\n\n/* The %StringIteratorPrototype% object (ECMA-262 v6, 22.1.5.2) */\nBUILTIN (ECMA_BUILTIN_ID_STRING_ITERATOR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE,\n         true,\n         string_iterator_prototype)\n\n/* The %RegExpStringIteratorPrototype% object (ECMA-262 v11, 21.2.7.1) */\nBUILTIN (ECMA_BUILTIN_ID_REGEXP_STRING_ITERATOR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE,\n         true,\n         regexp_string_iterator_prototype)\n\n/* The %AsyncIteratorPrototype% object (ECMA-262 v10, 25.1.3) */\nBUILTIN (ECMA_BUILTIN_ID_ASYNC_ITERATOR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         async_iterator_prototype)\n\n/* The %AsyncFromSyncIteratorPrototype% object (ECMA-262 v11, 25.1.4.2) */\nBUILTIN (ECMA_BUILTIN_ID_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ASYNC_ITERATOR_PROTOTYPE,\n         true,\n         async_from_sync_iterator_prototype)\n\n/* The %(GeneratorFunction)% object */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_GENERATOR_FUNCTION,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION,\n                 true,\n                 generator_function)\n\n/* The %(Generator)% object */\nBUILTIN (ECMA_BUILTIN_ID_GENERATOR,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n         true,\n         generator)\n\n/* The %(Generator).prototype% object */\nBUILTIN (ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE,\n         true,\n         generator_prototype)\n\n/* The %(AsyncGeneratorFunction)% object */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION,\n                 true,\n                 async_generator_function)\n\n/* The %(AsyncGenerator)% object */\nBUILTIN (ECMA_BUILTIN_ID_ASYNC_GENERATOR,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n         true,\n         async_generator)\n\n/* The %(AsyncGenerator).prototype% object */\nBUILTIN (ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ASYNC_ITERATOR_PROTOTYPE,\n         true,\n         async_generator_prototype)\n\n#if JERRY_BUILTIN_CONTAINER\n/* The %SetIteratorPrototype% object (ECMA-262 v6, 23.2.5.2) */\nBUILTIN (ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE,\n         true,\n         set_iterator_prototype)\n\n/* The %MapIteratorPrototype% object (ECMA-262 v6, 23.1.5.2) */\nBUILTIN (ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE,\n         true,\n         map_iterator_prototype)\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#if JERRY_BUILTIN_BIGINT\n/* The %BigInt.prototype% object */\nBUILTIN (ECMA_BUILTIN_ID_BIGINT_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         bigint_prototype)\n\n/* The %BigInt% object */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_BIGINT,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 bigint)\n#endif /* JERRY_BUILTIN_BIGINT */\n\n#if JERRY_BUILTIN_DATAVIEW\n/* The DataView prototype object (ECMA-262 v6, 24.2.3.1) */\nBUILTIN (ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,\n         true,\n         dataview_prototype)\n\n/* The DataView routine (ECMA-262 v6, 24.2.2.1) */\nBUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATAVIEW,\n                 ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,\n                 ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,\n                 true,\n                 dataview)\n#endif /* JERRY_BUILTIN_DATAVIEW */\n\n/* The Global object (15.1) */\nBUILTIN (ECMA_BUILTIN_ID_GLOBAL,\n         ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,\n         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, /* Implementation-dependent */\n         true,\n         global)\n\n#undef BUILTIN\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#if JERRY_BUILTIN_BIGINT\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-bigint64array-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  bigint64array_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup bigint64arrayprototype ECMA BigInt64Array.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * BigInt64Array prototype description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#if JERRY_BUILTIN_BIGINT\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 8\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_BIGINT64ARRAY\n#include \"ecma-builtin-typedarray-prototype-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_BIGINT */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#if JERRY_BUILTIN_BIGINT\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-bigint64array.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  bigint64array\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup bigint64array ECMA BigInt64Array object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of BigInt64Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_bigint64array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                          uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_BIGINT64_ARRAY_REQUIRES_NEW);\n} /* ecma_builtin_bigint64array_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of BigInt64Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_bigint64array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                               uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_BIGINT64_ARRAY);\n} /* ecma_builtin_bigint64array_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * BigInt64Array description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 8\n#define TYPEDARRAY_MAGIC_STRING_ID   LIT_MAGIC_STRING_BIGINT64_ARRAY_UL\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_BIGINT64ARRAY_PROTOTYPE\n#include \"ecma-builtin-typedarray-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#if JERRY_BUILTIN_BIGINT\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-biguint64array-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  biguint64array_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup biguint64arrayprototype ECMA BigUInt64Array.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * BigUInt64Array prototype description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#if JERRY_BUILTIN_BIGINT\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 8\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_BIGUINT64ARRAY\n#include \"ecma-builtin-typedarray-prototype-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_BIGINT */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#if JERRY_BUILTIN_BIGINT\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-biguint64array.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  biguint64array\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup biguint64array ECMA BigUInt64Array object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of BigUInt64Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_biguint64array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                           uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_BIG_UINT64_ARRAY_REQUIRES_NEW);\n} /* ecma_builtin_biguint64array_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of BigUInt64Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_biguint64array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_BIGUINT64_ARRAY);\n} /* ecma_builtin_biguint64array_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * BigUInt64Array description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#if JERRY_BUILTIN_BIGINT\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 8\n#define TYPEDARRAY_MAGIC_STRING_ID   LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_BIGUINT64ARRAY_PROTOTYPE\n#include \"ecma-builtin-typedarray-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_BIGINT */\n#endif /* JERRY_BUILTIN_TYPEDARRAY && JERRY_BUILTIN_BIGINT */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-float32array-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  float32array_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup float32arrayprototype ECMA Float32Array.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Float32Array prototype description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 4\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_FLOAT32ARRAY\n#include \"ecma-builtin-typedarray-prototype-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-float32array.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  float32array\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup float32array ECMA Float32Array object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of Float32Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_float32array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                         uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_FLOAT32_ARRAY_REQUIRES_NEW);\n} /* ecma_builtin_float32array_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of Float32Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_float32array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                              uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_FLOAT32_ARRAY);\n} /* ecma_builtin_float32array_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Float32Array description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 4\n#define TYPEDARRAY_MAGIC_STRING_ID   LIT_MAGIC_STRING_FLOAT32_ARRAY_UL\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_FLOAT32ARRAY_PROTOTYPE\n#include \"ecma-builtin-typedarray-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#if JERRY_NUMBER_TYPE_FLOAT64\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-float64array-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  float64array_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup float64arrayprototype ECMA Float64Array.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Float64Array prototype description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#if JERRY_NUMBER_TYPE_FLOAT64\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 8\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_FLOAT64ARRAY\n#include \"ecma-builtin-typedarray-prototype-template.inc.h\"\n\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#if JERRY_NUMBER_TYPE_FLOAT64\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-float64array.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  float64array\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup float64array ECMA Float64Array object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of Float64Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_float64array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                         uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_FLOAT64_ARRAY_REQUIRES_NEW);\n} /* ecma_builtin_float64array_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of Float64Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_float64array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                              uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_FLOAT64_ARRAY);\n} /* ecma_builtin_float64array_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Float64Array description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#if JERRY_NUMBER_TYPE_FLOAT64\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 8\n#define TYPEDARRAY_MAGIC_STRING_ID   LIT_MAGIC_STRING_FLOAT64_ARRAY_UL\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE\n#include \"ecma-builtin-typedarray-template.inc.h\"\n\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-int16array-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  int16array_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup int16arrayprototype ECMA Int16Array.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Int16Array prototype description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 2\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_INT16ARRAY\n#include \"ecma-builtin-typedarray-prototype-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-int16array.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  int16array\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup int64array ECMA Int16Array object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of Int16Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_int16array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                       uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_INT16_ARRAY_REQUIRES_NEW);\n} /* ecma_builtin_int16array_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of Int16Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_int16array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                            uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_INT16_ARRAY);\n} /* ecma_builtin_int16array_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Int16Array description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 2\n#define TYPEDARRAY_MAGIC_STRING_ID   LIT_MAGIC_STRING_INT16_ARRAY_UL\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_INT16ARRAY_PROTOTYPE\n#include \"ecma-builtin-typedarray-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-int32array-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  int32array_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup int32arrayprototype ECMA Int32Array.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Int32Array prototype description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 4\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_INT32ARRAY\n#include \"ecma-builtin-typedarray-prototype-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-int32array.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  int32array\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup int32array ECMA Int32Array object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of Int32Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_int32array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                       uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_INT32_ARRAY_REQUIRES_NEW);\n} /* ecma_builtin_int32array_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of Int32Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_int32array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                            uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_INT32_ARRAY);\n} /* ecma_builtin_int32array_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Int32Array description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 4\n#define TYPEDARRAY_MAGIC_STRING_ID   LIT_MAGIC_STRING_INT32_ARRAY_UL\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_INT32ARRAY_PROTOTYPE\n#include \"ecma-builtin-typedarray-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-int8array-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  int8array_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup int8arrayprototype ECMA Int8Array.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Int8Array prototype description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 1\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_INT8ARRAY\n#include \"ecma-builtin-typedarray-prototype-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-int8array.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  int8array\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup int8array ECMA Int8Array object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of Int8Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_int8array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                      uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_INT8_ARRAY_REQUIRES_NEW);\n} /* ecma_builtin_int8array_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of Int8Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_int8array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                           uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_INT8_ARRAY);\n} /* ecma_builtin_int8array_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Int8Array description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 1\n#define TYPEDARRAY_MAGIC_STRING_ID   LIT_MAGIC_STRING_INT8_ARRAY_UL\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE\n#include \"ecma-builtin-typedarray-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#include \"ecma-builtins.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jcontext.h\"\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * Common implementation of the [[Construct]] call of TypedArrays.\n *\n * @return ecma value of the new TypedArray object\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_typedarray_helper_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                           uint32_t arguments_list_len, /**< number of arguments */\n                                           ecma_typedarray_type_t typedarray_id) /**< id of the typedarray */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n  ecma_builtin_id_t proto_id = ecma_typedarray_helper_get_prototype_id (typedarray_id);\n  ecma_object_t *prototype_obj_p = NULL;\n  ecma_object_t *current_new_target_p = JERRY_CONTEXT (current_new_target_p);\n\n  if (current_new_target_p != NULL)\n  {\n    prototype_obj_p = ecma_op_get_prototype_from_constructor (current_new_target_p, proto_id);\n    if (prototype_obj_p == NULL)\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n  else\n  {\n    prototype_obj_p = ecma_builtin_get (proto_id);\n  }\n\n  ecma_value_t val = ecma_op_create_typedarray (arguments_list_p,\n                                                arguments_list_len,\n                                                prototype_obj_p,\n                                                ecma_typedarray_helper_get_shift_size (typedarray_id),\n                                                typedarray_id);\n\n  if (current_new_target_p != NULL)\n  {\n    ecma_deref_object (prototype_obj_p);\n  }\n\n  return val;\n} /* ecma_typedarray_helper_dispatch_construct */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_TYPEDARRAY_HELPERS_H\n#define ECMA_TYPEDARRAY_HELPERS_H\n#include \"ecma-globals.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltinhelpers ECMA builtin helper operations\n * @{\n */\n\necma_value_t ecma_typedarray_helper_dispatch_construct (const ecma_value_t *arguments_list_p,\n                                                        uint32_t arguments_list_len,\n                                                        ecma_typedarray_type_t typedarray_id);\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#endif /* !ECMA_TYPEDARRAY_HELPERS_H */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype-template.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#ifndef TYPEDARRAY_BYTES_PER_ELEMENT\n#error \"Please define TYPEDARRAY_BYTES_PER_ELEMENT\"\n#endif /* !TYPEDARRAY_BYTES_PER_ELEMENT */\n\n#ifndef TYPEDARRAY_BUILTIN_ID\n#error \"Please define TYPEDARRAY_BUILTIN_ID\"\n#endif /* !TYPEDARRAY_BUILTIN_ID */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* ES2015 22.2.3.4 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, TYPEDARRAY_BUILTIN_ID, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* ES2015 22.2.6.1 */\nNUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, TYPEDARRAY_BYTES_PER_ELEMENT, ECMA_PROPERTY_FIXED)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n\n#undef TYPEDARRAY_BUILTIN_ID\n#undef TYPEDARRAY_BYTES_PER_ELEMENT\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <math.h>\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-comparison.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-number-object.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jcontext.h\"\n#include \"jmem.h\"\n#include \"jrt-libc-includes.h\"\n#include \"jrt.h\"\n#include \"lit-char-helpers.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/**\n * This object has a custom dispatch function.\n */\n#define BUILTIN_CUSTOM_DISPATCH\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  /* These routines must be in this order */\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_START = 0,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_MAP,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_EVERY,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SOME,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FOR_EACH,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FILTER,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FIND,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FIND_INDEX,\n\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INDEX_OF,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_AT,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_LAST_INDEX_OF,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INCLUDES,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FILL,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SORT,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REVERSE,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_COPY_WITHIN,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SLICE,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SUBARRAY,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_LOCALE_STRING,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_JOIN,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_ENTRIES,\n\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_BUFFER_GETTER,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_BYTELENGTH_GETTER,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_BYTEOFFSET_GETTER,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_LENGTH_GETTER,\n\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SET,\n  ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_STRING_TAG_GETTER,\n};\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-typedarray-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  typedarray_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup typedarrayprototype ECMA %TypedArray%.prototype object built-in\n * @{\n */\n\n/**\n * Type of routine.\n */\ntypedef enum\n{\n  TYPEDARRAY_ROUTINE_EVERY, /**< routine: every ES2015, 22.2.3.7 */\n  TYPEDARRAY_ROUTINE_SOME, /**< routine: some ES2015, 22.2.3.9 */\n  TYPEDARRAY_ROUTINE_FOREACH, /**< routine: forEach ES2015, 15.4.4.18 */\n  TYPEDARRAY_ROUTINE__COUNT /**< count of the modes */\n} typedarray_routine_mode;\n\n/**\n * The common function for 'every', 'some' and 'forEach'\n * because they have a similar structure.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_exec_routine (ecma_value_t this_arg, /**< this argument */\n                                                ecma_typedarray_info_t *info_p, /**< object info */\n                                                ecma_value_t cb_func_val, /**< callback function */\n                                                ecma_value_t cb_this_arg, /**< 'this' of the callback function */\n                                                typedarray_routine_mode mode) /**< mode: which routine */\n{\n  JERRY_ASSERT (mode < TYPEDARRAY_ROUTINE__COUNT);\n\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (this_arg);\n  ecma_typedarray_info_t info = ecma_typedarray_get_info (typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (info.array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (info.array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  ecma_typedarray_getter_fn_t typedarray_getter_cb = ecma_get_typedarray_getter_fn (info_p->id);\n  ecma_object_t *func_object_p = ecma_get_object_from_value (cb_func_val);\n  uint8_t *buffer_p = ecma_arraybuffer_get_buffer (info_p->array_buffer_p) + info_p->offset;\n  uint32_t byte_pos = 0;\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  for (uint32_t index = 0; index < info_p->length && ecma_is_value_empty (ret_value); index++)\n  {\n    ecma_value_t current_index = ecma_make_uint32_value (index);\n    ecma_value_t element = typedarray_getter_cb (buffer_p + byte_pos);\n\n    ecma_value_t call_args[] = { element, current_index, this_arg };\n\n    ecma_value_t call_value = ecma_op_function_call (func_object_p, cb_this_arg, call_args, 3);\n\n    ecma_fast_free_value (current_index);\n    ecma_fast_free_value (element);\n\n    if (ECMA_IS_VALUE_ERROR (call_value))\n    {\n      return call_value;\n    }\n\n    if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n    {\n      ecma_free_value (call_value);\n      return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n    }\n\n    bool to_bool_result = ecma_op_to_boolean (call_value);\n    ecma_free_value (call_value);\n\n    if (mode == TYPEDARRAY_ROUTINE_EVERY)\n    {\n      if (!to_bool_result)\n      {\n        return ECMA_VALUE_FALSE;\n      }\n    }\n    else if (mode == TYPEDARRAY_ROUTINE_SOME && to_bool_result)\n    {\n      return ECMA_VALUE_TRUE;\n    }\n\n    byte_pos += info_p->element_size;\n  }\n\n  if (mode == TYPEDARRAY_ROUTINE_EVERY)\n  {\n    ret_value = ECMA_VALUE_TRUE;\n  }\n  else if (mode == TYPEDARRAY_ROUTINE_SOME)\n  {\n    ret_value = ECMA_VALUE_FALSE;\n  }\n  else\n  {\n    ret_value = ECMA_VALUE_UNDEFINED;\n  }\n\n  return ret_value;\n} /* ecma_builtin_typedarray_prototype_exec_routine */\n\n/**\n * The %TypedArray%.prototype object's 'map' routine\n *\n * See also:\n *          ES2015, 22.2.3.8\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_map (ecma_value_t this_arg, /**< this object */\n                                       ecma_typedarray_info_t *src_info_p, /**< object info */\n                                       ecma_value_t cb_func_val, /**< callback function */\n                                       ecma_value_t cb_this_arg) /**< this' of the callback function */\n{\n  ecma_object_t *func_object_p = ecma_get_object_from_value (cb_func_val);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (src_info_p->array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (src_info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  // TODO: 22.2.3.18, 7-8.\n  ecma_value_t len = ecma_make_number_value (src_info_p->length);\n  ecma_value_t new_typedarray = ecma_typedarray_species_create (this_arg, &len, 1);\n  ecma_free_value (len);\n\n  if (ECMA_IS_VALUE_ERROR (new_typedarray))\n  {\n    return new_typedarray;\n  }\n\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (new_typedarray);\n\n  uint8_t *src_buffer_p = ecma_typedarray_get_buffer (src_info_p);\n\n  ecma_typedarray_info_t target_info = ecma_typedarray_get_info (target_obj_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (target_info.array_buffer_p))\n  {\n    ecma_deref_object (target_obj_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (target_info.array_buffer_p))\n  {\n    ecma_deref_object (target_obj_p);\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  uint8_t *target_buffer_p = ecma_typedarray_get_buffer (&target_info);\n\n  ecma_typedarray_getter_fn_t src_typedarray_getter_cb = ecma_get_typedarray_getter_fn (src_info_p->id);\n  ecma_typedarray_setter_fn_t target_typedarray_setter_cb = ecma_get_typedarray_setter_fn (target_info.id);\n\n  for (uint32_t index = 0; index < src_info_p->length; index++)\n  {\n    ecma_value_t current_index = ecma_make_uint32_value (index);\n    ecma_value_t element = src_typedarray_getter_cb (src_buffer_p);\n    src_buffer_p += src_info_p->element_size;\n\n    ecma_value_t call_args[] = { element, current_index, this_arg };\n    ecma_value_t mapped_value = ecma_op_function_call (func_object_p, cb_this_arg, call_args, 3);\n\n    ecma_free_value (current_index);\n    ecma_free_value (element);\n\n    if (ECMA_IS_VALUE_ERROR (mapped_value))\n    {\n      ecma_free_value (new_typedarray);\n      return mapped_value;\n    }\n\n    if (ecma_arraybuffer_is_detached (src_info_p->array_buffer_p))\n    {\n      ecma_free_value (mapped_value);\n      ecma_free_value (new_typedarray);\n      return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n    }\n\n    ecma_value_t set_element = target_typedarray_setter_cb (target_buffer_p, mapped_value);\n    target_buffer_p += target_info.element_size;\n    ecma_free_value (mapped_value);\n\n    if (ECMA_IS_VALUE_ERROR (set_element))\n    {\n      ecma_free_value (new_typedarray);\n      return set_element;\n    }\n  }\n\n  return new_typedarray;\n} /* ecma_builtin_typedarray_prototype_map */\n\n/**\n * Reduce and reduceRight routines share a similar structure.\n * And we use 'is_right' to distinguish between them.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_reduce_with_direction (ecma_value_t this_arg, /**< this object */\n                                                         ecma_typedarray_info_t *info_p, /**< object info */\n                                                         const ecma_value_t arguments_list_p[], /**arg_list*/\n                                                         uint32_t arguments_number, /**< length of arguments' list*/\n                                                         bool is_right) /**< choose order, true is reduceRight */\n{\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  ecma_typedarray_getter_fn_t getter_cb = ecma_get_typedarray_getter_fn (info_p->id);\n  uint32_t byte_pos;\n\n  if (info_p->length == 0)\n  {\n    if (arguments_number < 2)\n    {\n      return ecma_raise_type_error (ECMA_ERR_INITIAL_VALUE_CANNOT_BE_UNDEFINED);\n    }\n\n    return ecma_copy_value (arguments_list_p[1]);\n  }\n\n  JERRY_ASSERT (info_p->length > 0);\n\n  ecma_value_t accumulator = ECMA_VALUE_UNDEFINED;\n  uint32_t index = is_right ? (info_p->length - 1) : 0;\n  uint8_t *buffer_p = ecma_arraybuffer_get_buffer (info_p->array_buffer_p) + info_p->offset;\n\n  if (ecma_is_value_undefined (arguments_list_p[1]))\n  {\n    byte_pos = index << info_p->shift;\n    accumulator = getter_cb (buffer_p + byte_pos);\n\n    if (is_right)\n    {\n      if (index == 0)\n      {\n        return accumulator;\n      }\n\n      index--;\n    }\n    else\n    {\n      index++;\n\n      if (index == info_p->length)\n      {\n        return accumulator;\n      }\n    }\n  }\n  else\n  {\n    accumulator = ecma_copy_value (arguments_list_p[1]);\n  }\n\n  ecma_object_t *func_object_p = ecma_get_object_from_value (arguments_list_p[0]);\n\n  while (true)\n  {\n    ecma_value_t current_index = ecma_make_uint32_value (index);\n    byte_pos = index << info_p->shift;\n    ecma_value_t get_value = getter_cb (buffer_p + byte_pos);\n\n    ecma_value_t call_args[] = { accumulator, get_value, current_index, this_arg };\n\n    JERRY_ASSERT (ecma_is_value_number (get_value) || ecma_is_value_bigint (get_value));\n\n    ecma_value_t call_value = ecma_op_function_call (func_object_p, ECMA_VALUE_UNDEFINED, call_args, 4);\n\n    ecma_fast_free_value (accumulator);\n    ecma_fast_free_value (get_value);\n    ecma_fast_free_value (current_index);\n\n    if (ECMA_IS_VALUE_ERROR (call_value))\n    {\n      return call_value;\n    }\n\n    if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n    {\n      ecma_free_value (call_value);\n      return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n    }\n\n    accumulator = call_value;\n\n    if (is_right)\n    {\n      if (index == 0)\n      {\n        break;\n      }\n\n      index--;\n    }\n    else\n    {\n      index++;\n\n      if (index == info_p->length)\n      {\n        break;\n      }\n    }\n  }\n\n  return accumulator;\n} /* ecma_builtin_typedarray_prototype_reduce_with_direction */\n\n/**\n * The %TypedArray%.prototype object's 'filter' routine\n *\n * See also:\n *          ES2015, 22.2.3.9\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_filter (ecma_value_t this_arg, /**< this object */\n                                          ecma_typedarray_info_t *info_p, /**< object info */\n                                          ecma_value_t cb_func_val, /**< callback function */\n                                          ecma_value_t cb_this_arg) /**< 'this' of the callback function */\n{\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  ecma_typedarray_getter_fn_t getter_cb = ecma_get_typedarray_getter_fn (info_p->id);\n\n  ecma_object_t *func_object_p = ecma_get_object_from_value (cb_func_val);\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n\n  // TODO: 22.2.3.9, 7-8.\n  if (info_p->length == 0)\n  {\n    return ecma_op_create_typedarray_with_type_and_length (info_p->id, 0);\n  }\n\n  ecma_collection_t *collected_p = ecma_new_collection ();\n  uint8_t *buffer_p = ecma_arraybuffer_get_buffer (info_p->array_buffer_p) + info_p->offset;\n\n  for (uint32_t index = 0; index < info_p->length; index++)\n  {\n    ecma_value_t current_index = ecma_make_uint32_value (index);\n    ecma_value_t get_value = getter_cb (buffer_p);\n\n    JERRY_ASSERT (ecma_is_value_number (get_value) || ecma_is_value_bigint (get_value));\n\n    ecma_value_t call_args[] = { get_value, current_index, this_arg };\n\n    ecma_value_t call_value = ecma_op_function_call (func_object_p, cb_this_arg, call_args, 3);\n\n    ecma_fast_free_value (current_index);\n\n    if (ECMA_IS_VALUE_ERROR (call_value))\n    {\n      ecma_fast_free_value (get_value);\n      goto cleanup;\n    }\n\n    if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n    {\n      ecma_free_value (call_value);\n      ecma_fast_free_value (get_value);\n      ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n      goto cleanup;\n    }\n\n    if (ecma_op_to_boolean (call_value))\n    {\n      ecma_collection_push_back (collected_p, get_value);\n    }\n    else\n    {\n      ecma_fast_free_value (get_value);\n    }\n\n    buffer_p += info_p->element_size;\n    ecma_fast_free_value (call_value);\n  }\n\n  ecma_value_t collected = ecma_make_number_value (collected_p->item_count);\n  ret_value = ecma_typedarray_species_create (this_arg, &collected, 1);\n  ecma_free_value (collected);\n\n  if (!ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    ecma_object_t *new_typedarray_p = ecma_get_object_from_value (ret_value);\n    ecma_typedarray_info_t target_info = ecma_typedarray_get_info (new_typedarray_p);\n\n    JERRY_ASSERT (target_info.offset == 0);\n\n    uint8_t *target_buffer_p = ecma_typedarray_get_buffer (&target_info);\n\n    ecma_typedarray_setter_fn_t target_typedarray_setter_cb = ecma_get_typedarray_setter_fn (target_info.id);\n\n    for (uint32_t idx = 0; idx < collected_p->item_count; idx++)\n    {\n      ecma_value_t set_element = target_typedarray_setter_cb (target_buffer_p, collected_p->buffer_p[idx]);\n\n      if (ECMA_IS_VALUE_ERROR (set_element))\n      {\n        ecma_deref_object (new_typedarray_p);\n        ret_value = ECMA_VALUE_ERROR;\n        goto cleanup;\n      }\n\n      target_buffer_p += target_info.element_size;\n    }\n  }\n\ncleanup:\n  ecma_collection_free (collected_p);\n\n  return ret_value;\n} /* ecma_builtin_typedarray_prototype_filter */\n\n/**\n * The %TypedArray%.prototype object's 'reverse' routine\n *\n * See also:\n *          ES2015, 22.2.3.21\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_reverse (ecma_value_t this_arg, /**< this argument */\n                                           ecma_typedarray_info_t *info_p) /**< object info */\n{\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  uint8_t *buffer_p = ecma_arraybuffer_get_buffer (info_p->array_buffer_p) + info_p->offset;\n  uint32_t middle = (info_p->length / 2) << info_p->shift;\n  uint32_t buffer_last = (info_p->length << info_p->shift) - info_p->element_size;\n\n  for (uint32_t lower = 0; lower < middle; lower += info_p->element_size)\n  {\n    uint32_t upper = buffer_last - lower;\n    uint8_t *lower_p = buffer_p + lower;\n    uint8_t *upper_p = buffer_p + upper;\n\n    uint8_t tmp[8];\n    memcpy (&tmp[0], lower_p, info_p->element_size);\n    memcpy (lower_p, upper_p, info_p->element_size);\n    memcpy (upper_p, &tmp[0], info_p->element_size);\n  }\n\n  return ecma_copy_value (this_arg);\n} /* ecma_builtin_typedarray_prototype_reverse */\n\n/**\n * The %TypedArray%.prototype object's 'set' routine for a typedArray source\n *\n * See also:\n *          ES2015, 22.2.3.22, 22.2.3.22.2\n *\n * @return ecma value of undefined if success, error otherwise.\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_op_typedarray_set_with_typedarray (ecma_value_t this_arg, /**< this argument */\n                                        ecma_value_t arr_val, /**< typedarray object */\n                                        ecma_value_t offset_val) /**< offset value */\n{\n  /* 6.~ 8. targetOffset */\n  ecma_number_t target_offset_num;\n  if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (offset_val, &target_offset_num)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (target_offset_num <= -1.0 || target_offset_num >= (ecma_number_t) UINT32_MAX + 0.5)\n  {\n    return ecma_raise_range_error (ECMA_ERR_INVALID_OFFSET);\n  }\n\n  ecma_object_t *target_typedarray_p = ecma_get_object_from_value (this_arg);\n  ecma_typedarray_info_t target_info = ecma_typedarray_get_info (target_typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (target_info.array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (target_info.array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  uint8_t *target_buffer_p = ecma_typedarray_get_buffer (&target_info);\n\n  ecma_object_t *src_typedarray_p = ecma_get_object_from_value (arr_val);\n  ecma_typedarray_info_t src_info = ecma_typedarray_get_info (src_typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (src_info.array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (src_info.array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  uint8_t *src_buffer_p = ecma_typedarray_get_buffer (&src_info);\n\n  uint32_t target_offset_uint32 = ecma_number_to_uint32 (target_offset_num);\n\n  if ((int64_t) src_info.length + target_offset_uint32 > target_info.length)\n  {\n    return ecma_raise_range_error (ECMA_ERR_INVALID_RANGE_OF_INDEX);\n  }\n\n  /* Fast path first. If the source and target arrays are the same we do not need to copy anything. */\n  if (this_arg == arr_val)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  /* 26. targetByteIndex */\n  target_buffer_p += target_offset_uint32 << target_info.shift;\n\n  /* 27. limit */\n  uint32_t limit = src_info.length << target_info.shift;\n\n  if (src_info.id == target_info.id)\n  {\n    memmove (target_buffer_p, src_buffer_p, limit);\n  }\n  else\n  {\n    uint8_t *target_limit_p = target_buffer_p + limit;\n    ecma_typedarray_getter_fn_t src_typedarray_getter_cb = ecma_get_typedarray_getter_fn (src_info.id);\n    ecma_typedarray_setter_fn_t target_typedarray_setter_cb = ecma_get_typedarray_setter_fn (target_info.id);\n\n    while (target_buffer_p < target_limit_p)\n    {\n      ecma_value_t element = src_typedarray_getter_cb (src_buffer_p);\n      ecma_value_t set_element = target_typedarray_setter_cb (target_buffer_p, element);\n      ecma_free_value (element);\n\n      if (ECMA_IS_VALUE_ERROR (set_element))\n      {\n        return set_element;\n      }\n\n      src_buffer_p += src_info.element_size;\n      target_buffer_p += target_info.element_size;\n    }\n  }\n\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_op_typedarray_set_with_typedarray */\n\n/**\n * The %TypedArray%.prototype object's 'set' routine\n *\n * See also:\n *          ES2015, 22.2.3.22, 22.2.3.22.1\n *\n * @return ecma value of undefined if success, error otherwise.\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_set (ecma_value_t this_arg, /**< this argument */\n                                       ecma_value_t arr_val, /**< array object */\n                                       ecma_value_t offset_val) /**< offset value */\n{\n  /* 1. */\n  if (ecma_is_typedarray (arr_val))\n  {\n    /* 22.2.3.22.2 */\n    return ecma_op_typedarray_set_with_typedarray (this_arg, arr_val, offset_val);\n  }\n\n  /* 6.~ 8. targetOffset */\n  ecma_number_t target_offset_num;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (offset_val, &target_offset_num)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (target_offset_num <= -1.0 || target_offset_num >= (ecma_number_t) UINT32_MAX + 0.5)\n  {\n    return ecma_raise_range_error (ECMA_ERR_INVALID_OFFSET);\n  }\n  uint32_t target_offset_uint32 = ecma_number_to_uint32 (target_offset_num);\n\n  /* 11. ~ 15. */\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (this_arg);\n  ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (target_info.array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (target_info.array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  uint8_t *target_buffer_p = ecma_typedarray_get_buffer (&target_info);\n\n  /* 16.~ 17. */\n  ecma_value_t source_obj = ecma_op_to_object (arr_val);\n\n  if (ECMA_IS_VALUE_ERROR (source_obj))\n  {\n    return source_obj;\n  }\n\n  /* 18.~ 19. */\n  ecma_object_t *source_obj_p = ecma_get_object_from_value (source_obj);\n\n  ecma_length_t source_length;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_op_object_get_length (source_obj_p, &source_length)))\n  {\n    ecma_deref_object (source_obj_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 20. if srcLength + targetOffset > targetLength, throw a RangeError */\n  if ((int64_t) source_length + target_offset_uint32 > target_info.length)\n  {\n    ecma_deref_object (source_obj_p);\n    return ecma_raise_range_error (ECMA_ERR_INVALID_RANGE_OF_INDEX);\n  }\n  JERRY_ASSERT (source_length <= UINT32_MAX);\n  uint32_t source_length_uint32 = (uint32_t) source_length;\n\n  /* 21.~ 25. */\n  target_buffer_p += target_offset_uint32 << target_info.shift;\n\n  ecma_typedarray_setter_fn_t target_typedarray_setter_cb = ecma_get_typedarray_setter_fn (target_info.id);\n  uint32_t k = 0;\n\n  while (k < source_length_uint32)\n  {\n    ecma_value_t elem = ecma_op_object_get_by_index (source_obj_p, k);\n\n    if (ECMA_IS_VALUE_ERROR (elem))\n    {\n      ecma_deref_object (source_obj_p);\n      return elem;\n    }\n\n    ecma_value_t value_to_set;\n\n#if JERRY_BUILTIN_BIGINT\n    if (ECMA_TYPEDARRAY_IS_BIGINT_TYPE (target_info.id))\n    {\n      value_to_set = ecma_bigint_to_bigint (elem, false);\n\n      if (ECMA_IS_VALUE_ERROR (value_to_set))\n      {\n        ecma_deref_object (source_obj_p);\n        ecma_free_value (elem);\n        return value_to_set;\n      }\n    }\n    else\n#endif /* JERRY_BUILTIN_BIGINT */\n    {\n      ecma_number_t elem_num;\n      if (ECMA_IS_VALUE_ERROR (ecma_op_to_numeric (elem, &elem_num, ECMA_TO_NUMERIC_NO_OPTS)))\n      {\n        ecma_free_value (elem);\n        ecma_deref_object (source_obj_p);\n        return ECMA_VALUE_ERROR;\n      }\n\n      value_to_set = ecma_make_number_value (elem_num);\n    }\n\n    ecma_free_value (elem);\n\n    if (ecma_arraybuffer_is_detached (target_info.array_buffer_p))\n    {\n      ecma_deref_object (source_obj_p);\n      ecma_free_value (value_to_set);\n      return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n    }\n\n    ecma_value_t set_element = target_typedarray_setter_cb (target_buffer_p, value_to_set);\n\n    ecma_free_value (value_to_set);\n\n    if (ECMA_IS_VALUE_ERROR (set_element))\n    {\n      ecma_deref_object (source_obj_p);\n      return set_element;\n    }\n\n    k++;\n    target_buffer_p += target_info.element_size;\n  }\n\n  ecma_deref_object (source_obj_p);\n\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_builtin_typedarray_prototype_set */\n\n/**\n * TypedArray.prototype's 'toString' single element operation routine based\n * on the Array.prototype's 'toString' single element operation routine\n *\n * See also:\n *          ECMA-262 v5.1, 15.4.4.2\n *\n * @return NULL - if the converison fails\n *         ecma_string_t * - otherwise\n */\nstatic ecma_string_t *\necma_op_typedarray_get_to_string_at_index (ecma_object_t *obj_p, /**< this object */\n                                           uint32_t index) /**< array index */\n{\n  ecma_value_t index_value = ecma_op_object_get_by_index (obj_p, index);\n\n  if (ECMA_IS_VALUE_ERROR (index_value))\n  {\n    return NULL;\n  }\n\n  if (ecma_is_value_undefined (index_value) || ecma_is_value_null (index_value))\n  {\n    ecma_free_value (index_value);\n    return ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  ecma_string_t *ret_str_p = ecma_op_to_string (index_value);\n\n  ecma_free_value (index_value);\n\n  return ret_str_p;\n} /* ecma_op_typedarray_get_to_string_at_index */\n\n/**\n * The TypedArray.prototype.toString's separator creation routine based on\n * the Array.prototype.toString's separator routine\n *\n * See also:\n *          ECMA-262 v5.1, 15.4.4.2 4th step\n *\n * @return NULL - if the conversion fails\n *         ecma_string_t * - otherwise\n */\nstatic ecma_string_t *\necma_op_typedarray_get_separator_string (ecma_value_t separator) /**< possible separator */\n{\n  if (ecma_is_value_undefined (separator))\n  {\n    return ecma_get_magic_string (LIT_MAGIC_STRING_COMMA_CHAR);\n  }\n\n  return ecma_op_to_string (separator);\n} /* ecma_op_typedarray_get_separator_string */\n\n/**\n * The TypedArray.prototype object's 'join' routine basen on\n * the Array.porottype object's 'join'\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_join (ecma_object_t *obj_p, /**< this object */\n                                        ecma_value_t separator_arg) /**< separator argument */\n{\n  ecma_typedarray_info_t info = ecma_typedarray_get_info (obj_p);\n\n  if (ecma_arraybuffer_is_detached (info.array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  /* 2. */\n  uint32_t length = ecma_typedarray_get_length (obj_p);\n  ecma_string_t *separator_string_p = ecma_op_typedarray_get_separator_string (separator_arg);\n\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n  if (JERRY_UNLIKELY (separator_string_p == NULL))\n  {\n    return ret_value;\n  }\n\n  /* 7-8. */\n  ecma_string_t *first_string_p = ecma_op_typedarray_get_to_string_at_index (obj_p, 0);\n\n  if (JERRY_UNLIKELY (first_string_p == NULL))\n  {\n    ecma_deref_ecma_string (separator_string_p);\n    return ret_value;\n  }\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (first_string_p);\n\n  ecma_deref_ecma_string (first_string_p);\n\n  /* 9-10. */\n  for (uint32_t k = 1; k < length; k++)\n  {\n    /* 10.a */\n    ecma_stringbuilder_append (&builder, separator_string_p);\n\n    /* 10.d */\n    ecma_string_t *next_string_p = ecma_op_typedarray_get_to_string_at_index (obj_p, k);\n\n    if (JERRY_UNLIKELY (next_string_p == NULL))\n    {\n      ecma_stringbuilder_destroy (&builder);\n      ecma_deref_ecma_string (separator_string_p);\n      return ret_value;\n    }\n\n    ecma_stringbuilder_append (&builder, next_string_p);\n\n    ecma_deref_ecma_string (next_string_p);\n  }\n\n  ecma_deref_ecma_string (separator_string_p);\n  ret_value = ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n\n  return ret_value;\n} /* ecma_builtin_typedarray_prototype_join */\n\n/**\n * The %TypedArray%.prototype object's 'subarray' routine.\n *\n * See also:\n *          ES2015, 22.2.3.26\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_subarray (ecma_value_t this_arg, /**< this object */\n                                            ecma_typedarray_info_t *info_p, /**< object info */\n                                            ecma_value_t begin, /**< begin */\n                                            ecma_value_t end) /**< end */\n{\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  /* 9. beginIndex, 12. endIndex */\n  uint32_t begin_index_uint32 = 0, end_index_uint32 = 0;\n\n  /* 7. relativeBegin */\n  if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (begin, info_p->length, &begin_index_uint32)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_is_value_undefined (end))\n  {\n    end_index_uint32 = (uint32_t) info_p->length;\n  }\n  else\n  {\n    /* 10. relativeEnd */\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (end, info_p->length, &end_index_uint32)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  /* 13. newLength */\n  uint32_t subarray_length = 0;\n\n  if (end_index_uint32 > begin_index_uint32)\n  {\n    subarray_length = end_index_uint32 - begin_index_uint32;\n  }\n\n  /* 17. beginByteOffset */\n  uint32_t begin_byte_offset = info_p->offset + (begin_index_uint32 << info_p->shift);\n\n  ecma_value_t arguments_p[3] = { ecma_make_object_value (info_p->array_buffer_p),\n                                  ecma_make_uint32_value (begin_byte_offset),\n                                  ecma_make_uint32_value (subarray_length) };\n\n  ret_value = ecma_typedarray_species_create (this_arg, arguments_p, 3);\n\n  ecma_free_value (arguments_p[1]);\n  ecma_free_value (arguments_p[2]);\n  return ret_value;\n} /* ecma_builtin_typedarray_prototype_subarray */\n\n/**\n * The %TypedArray%.prototype object's 'fill' routine.\n *\n * See also:\n *          ES2015, 22.2.3.8, 22.1.3.6\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_fill (ecma_value_t this_arg, /**< this object */\n                                        ecma_typedarray_info_t *info_p, /**< object info */\n                                        ecma_value_t value, /**< value */\n                                        ecma_value_t begin, /**< begin */\n                                        ecma_value_t end) /**< end */\n{\n  ecma_value_t value_to_set;\n\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (ECMA_TYPEDARRAY_IS_BIGINT_TYPE (info_p->id))\n  {\n    value_to_set = ecma_bigint_to_bigint (value, true);\n\n    if (ECMA_IS_VALUE_ERROR (value_to_set))\n    {\n      return value_to_set;\n    }\n  }\n  else\n#endif /* JERRY_BUILTIN_BIGINT */\n  {\n    ecma_number_t value_num;\n    ecma_value_t ret_value = ecma_op_to_numeric (value, &value_num, ECMA_TO_NUMERIC_NO_OPTS);\n\n    if (!ecma_is_value_empty (ret_value))\n    {\n      return ret_value;\n    }\n\n    value_to_set = ecma_make_number_value (value_num);\n  }\n\n  uint32_t begin_index_uint32 = 0, end_index_uint32 = 0;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (begin, info_p->length, &begin_index_uint32)))\n  {\n    ecma_free_value (value_to_set);\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_is_value_undefined (end))\n  {\n    end_index_uint32 = (uint32_t) info_p->length;\n  }\n  else\n  {\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (end, info_p->length, &end_index_uint32)))\n    {\n      ecma_free_value (value_to_set);\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  uint32_t subarray_length = 0;\n\n  if (end_index_uint32 > begin_index_uint32)\n  {\n    subarray_length = end_index_uint32 - begin_index_uint32;\n  }\n\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  uint8_t *buffer_p = ecma_typedarray_get_buffer (info_p);\n\n  buffer_p += begin_index_uint32 << info_p->shift;\n\n  uint8_t *limit_p = buffer_p + (subarray_length << info_p->shift);\n  ecma_typedarray_setter_fn_t typedarray_setter_cb = ecma_get_typedarray_setter_fn (info_p->id);\n\n  while (buffer_p < limit_p)\n  {\n    ecma_value_t set_element = typedarray_setter_cb (buffer_p, value_to_set);\n\n    if (ECMA_IS_VALUE_ERROR (set_element))\n    {\n      ecma_free_value (value_to_set);\n      return set_element;\n    }\n\n    buffer_p += info_p->element_size;\n  }\n\n  ecma_free_value (value_to_set);\n\n  return ecma_copy_value (this_arg);\n} /* ecma_builtin_typedarray_prototype_fill */\n\n/**\n * SortCompare abstract method\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.11\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_sort_compare_helper (ecma_value_t lhs, /**< left value */\n                                                       ecma_value_t rhs, /**< right value */\n                                                       ecma_value_t compare_func, /**< compare function */\n                                                       ecma_object_t *array_buffer_p) /**< array buffer */\n{\n  if (ecma_is_value_undefined (compare_func))\n  {\n    /* Default comparison when no comparefn is passed. */\n#if JERRY_BUILTIN_BIGINT\n    if (ecma_is_value_bigint (lhs) && ecma_is_value_bigint (rhs))\n    {\n      return ecma_make_number_value (ecma_bigint_compare_to_bigint (lhs, rhs));\n    }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n    ecma_number_t result = ECMA_NUMBER_ZERO;\n\n    double lhs_value = (double) ecma_get_number_from_value (lhs);\n    double rhs_value = (double) ecma_get_number_from_value (rhs);\n\n    if (ecma_number_is_nan (lhs_value))\n    {\n      // Keep NaNs at the end of the array.\n      result = ECMA_NUMBER_ONE;\n    }\n    else if (ecma_number_is_nan (rhs_value))\n    {\n      // Keep NaNs at the end of the array.\n      result = ECMA_NUMBER_MINUS_ONE;\n    }\n    else if (lhs_value < rhs_value)\n    {\n      result = ECMA_NUMBER_MINUS_ONE;\n    }\n    else if (lhs_value > rhs_value || (ecma_number_is_zero (rhs_value) && ecma_number_is_negative (rhs_value)))\n    {\n      result = ECMA_NUMBER_ONE;\n    }\n    else\n    {\n      result = ECMA_NUMBER_ZERO;\n    }\n\n    return ecma_make_number_value (result);\n  }\n\n  /*\n   * compare_func, if not undefined, will always contain a callable function object.\n   * We checked this previously, before this function was called.\n   */\n  JERRY_ASSERT (ecma_op_is_callable (compare_func));\n  ecma_object_t *comparefn_obj_p = ecma_get_object_from_value (compare_func);\n\n  ecma_value_t compare_args[] = { lhs, rhs };\n\n  ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p, ECMA_VALUE_UNDEFINED, compare_args, 2);\n\n  if (ECMA_IS_VALUE_ERROR (call_value) || ecma_is_value_number (call_value))\n  {\n    return call_value;\n  }\n\n  ecma_number_t ret_num;\n  ecma_value_t number_result = ecma_op_to_number (call_value, &ret_num);\n\n  ecma_free_value (call_value);\n\n  if (ECMA_IS_VALUE_ERROR (number_result))\n  {\n    return number_result;\n  }\n\n  if (ecma_arraybuffer_is_detached (array_buffer_p))\n  {\n    ecma_free_value (number_result);\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  // If the coerced value can't be represented as a Number, compare them as equals.\n  if (ecma_number_is_nan (ret_num))\n  {\n    return ecma_make_number_value (ECMA_NUMBER_ZERO);\n  }\n\n  return ecma_make_number_value (ret_num);\n} /* ecma_builtin_typedarray_prototype_sort_compare_helper */\n\n/**\n * The %TypedArray%.prototype object's 'sort' routine.\n *\n * See also:\n *          ES2015, 22.2.3.25, 22.1.3.24\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_sort (ecma_value_t this_arg, /**< this argument */\n                                        ecma_typedarray_info_t *info_p, /**< object info */\n                                        ecma_value_t compare_func) /**< comparator fn */\n{\n  JERRY_ASSERT (ecma_is_typedarray (this_arg));\n  JERRY_ASSERT (ecma_is_value_undefined (compare_func) || ecma_op_is_callable (compare_func));\n\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  if (!info_p->length)\n  {\n    return ecma_copy_value (this_arg);\n  }\n\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n  JMEM_DEFINE_LOCAL_ARRAY (values_buffer, info_p->length, ecma_value_t);\n\n  uint32_t buffer_index = 0;\n\n  ecma_typedarray_getter_fn_t typedarray_getter_cb = ecma_get_typedarray_getter_fn (info_p->id);\n  uint8_t *buffer_p = ecma_arraybuffer_get_buffer (info_p->array_buffer_p) + info_p->offset;\n  uint8_t *limit_p = buffer_p + (info_p->length << info_p->shift);\n\n  /* Copy unsorted array into a native c array. */\n  while (buffer_p < limit_p)\n  {\n    JERRY_ASSERT (buffer_index < info_p->length);\n    ecma_value_t element_value = typedarray_getter_cb (buffer_p);\n    values_buffer[buffer_index++] = element_value;\n    buffer_p += info_p->element_size;\n  }\n\n  JERRY_ASSERT (buffer_index == info_p->length);\n\n  const ecma_builtin_helper_sort_compare_fn_t sort_cb = &ecma_builtin_typedarray_prototype_sort_compare_helper;\n\n  ecma_value_t sort_value = ecma_builtin_helper_array_merge_sort_helper (values_buffer,\n                                                                         (uint32_t) (info_p->length),\n                                                                         compare_func,\n                                                                         sort_cb,\n                                                                         info_p->array_buffer_p);\n\n  if (ECMA_IS_VALUE_ERROR (sort_value))\n  {\n    ret_value = sort_value;\n    goto free_values;\n  }\n\n  JERRY_ASSERT (sort_value == ECMA_VALUE_EMPTY);\n\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  ecma_typedarray_setter_fn_t typedarray_setter_cb = ecma_get_typedarray_setter_fn (info_p->id);\n\n  buffer_p = limit_p - (info_p->length << info_p->shift);\n  buffer_index = 0;\n\n  /* Put sorted values from the native array back into the typedarray buffer. */\n  while (buffer_p < limit_p)\n  {\n    JERRY_ASSERT (buffer_index < info_p->length);\n    ecma_value_t element_value = values_buffer[buffer_index++];\n    ecma_value_t set_element = typedarray_setter_cb (buffer_p, element_value);\n\n    if (ECMA_IS_VALUE_ERROR (set_element))\n    {\n      ret_value = set_element;\n      goto free_values;\n    }\n\n    buffer_p += info_p->element_size;\n  }\n\n  JERRY_ASSERT (buffer_index == info_p->length);\n\n  ret_value = ecma_copy_value (this_arg);\n\nfree_values:\n  /* Free values that were copied to the local array. */\n  for (uint32_t index = 0; index < info_p->length; index++)\n  {\n    ecma_free_value (values_buffer[index]);\n  }\n\n  JMEM_FINALIZE_LOCAL_ARRAY (values_buffer);\n\n  return ret_value;\n} /* ecma_builtin_typedarray_prototype_sort */\n\n/**\n * The %TypedArray%.prototype object's 'find' and 'findIndex' routine helper\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_find_helper (ecma_value_t this_arg, /**< this argument */\n                                               ecma_typedarray_info_t *info_p, /**< object info */\n                                               ecma_value_t predicate, /**< callback function */\n                                               ecma_value_t predicate_this_arg, /**< this argument for\n                                                                                 *   invoke predicate */\n                                               bool is_find) /**< true - find routine\n                                                              *   false - findIndex routine */\n{\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  JERRY_ASSERT (ecma_is_value_object (predicate));\n  ecma_object_t *func_object_p = ecma_get_object_from_value (predicate);\n  uint8_t *buffer_p = ecma_arraybuffer_get_buffer (info_p->array_buffer_p) + info_p->offset;\n  uint8_t *limit_p = buffer_p + (info_p->length << info_p->shift);\n  ecma_typedarray_getter_fn_t typedarray_getter_cb = ecma_get_typedarray_getter_fn (info_p->id);\n  uint32_t buffer_index = 0;\n\n  while (buffer_p < limit_p)\n  {\n    JERRY_ASSERT (buffer_index < info_p->length);\n    ecma_value_t element_value = typedarray_getter_cb (buffer_p);\n    buffer_p += info_p->element_size;\n\n    ecma_value_t call_args[] = { element_value, ecma_make_uint32_value (buffer_index), this_arg };\n    ecma_value_t call_value = ecma_op_function_call (func_object_p, predicate_this_arg, call_args, 3);\n\n    if (ECMA_IS_VALUE_ERROR (call_value))\n    {\n      ecma_free_value (element_value);\n      return call_value;\n    }\n\n    if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n    {\n      ecma_free_value (element_value);\n      ecma_free_value (call_value);\n      return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n    }\n\n    bool call_result = ecma_op_to_boolean (call_value);\n    ecma_free_value (call_value);\n\n    if (call_result)\n    {\n      if (is_find)\n      {\n        return element_value;\n      }\n\n      ecma_free_value (element_value);\n      return ecma_make_uint32_value (buffer_index);\n    }\n\n    buffer_index++;\n    ecma_free_value (element_value);\n  }\n\n  return is_find ? ECMA_VALUE_UNDEFINED : ecma_make_integer_value (-1);\n} /* ecma_builtin_typedarray_prototype_find_helper */\n\n/**\n * The %TypedArray%.prototype object's 'at' routine\n *\n * See also:\n *          ECMA-262 Stage 3 Draft Relative Indexing Method proposal\n *          from: https://tc39.es/proposal-relative-indexing-method\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_at (ecma_typedarray_info_t *info_p, /**< object info */\n                                      const ecma_value_t index) /**< index argument */\n{\n  ecma_length_t len = info_p->length;\n  ecma_length_t res_index;\n  ecma_value_t return_value = ecma_builtin_helper_calculate_index (index, len, &res_index);\n\n  if (return_value != ECMA_VALUE_EMPTY)\n  {\n    return return_value;\n  }\n\n  if (res_index >= UINT32_MAX)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  return ecma_get_typedarray_element (info_p, (uint32_t) res_index);\n} /* ecma_builtin_typedarray_prototype_at */\n\n/**\n * The %TypedArray%.prototype object's 'indexOf' routine\n *\n * See also:\n *         ECMA-262 v6, 22.2.3.13\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_index_of (ecma_typedarray_info_t *info_p, /**< object info */\n                                            const ecma_value_t args[], /**< arguments list */\n                                            uint32_t args_number) /**< number of arguments */\n{\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  bool is_bigint = ECMA_TYPEDARRAY_IS_BIGINT_TYPE (info_p->id);\n#else /* !JERRY_BUILTIN_BIGINT */\n  bool is_bigint = false;\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  uint32_t from_index;\n\n  /* 5. */\n  if (args_number == 0 || (!ecma_is_value_number (args[0]) && !is_bigint) || info_p->length == 0)\n  {\n    return ecma_make_integer_value (-1);\n  }\n  if (args_number == 1)\n  {\n    from_index = 0;\n  }\n  else\n  {\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &from_index)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  uint8_t *buffer_p = ecma_typedarray_get_buffer (info_p);\n\n  uint8_t *limit_p = buffer_p + (info_p->length << info_p->shift);\n  ecma_typedarray_getter_fn_t getter_cb = ecma_get_typedarray_getter_fn (info_p->id);\n\n  buffer_p += from_index << info_p->shift;\n\n  /* 11. */\n  while (buffer_p < limit_p)\n  {\n    ecma_value_t element = getter_cb (buffer_p);\n\n    if (ecma_op_same_value_zero (args[0], element, true))\n    {\n      ecma_free_value (element);\n      return ecma_make_number_value (from_index);\n    }\n\n    ecma_free_value (element);\n    buffer_p += info_p->element_size;\n    from_index++;\n  }\n\n  /* 12. */\n  return ecma_make_integer_value (-1);\n} /* ecma_builtin_typedarray_prototype_index_of */\n\n/**\n * The %TypedArray%.prototype object's 'lastIndexOf' routine\n *\n * See also:\n *          ECMA-262 v6, 22.2.3.16\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_last_index_of (ecma_typedarray_info_t *info_p, /**< object info */\n                                                 const ecma_value_t args[], /**< arguments list */\n                                                 uint32_t args_number) /**< number of arguments */\n{\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  bool is_bigint = ECMA_TYPEDARRAY_IS_BIGINT_TYPE (info_p->id);\n#else /* !JERRY_BUILTIN_BIGINT */\n  bool is_bigint = false;\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  uint32_t from_index;\n\n  /* 5. */\n  if (args_number == 0 || (!ecma_is_value_number (args[0]) && !is_bigint) || info_p->length == 0)\n  {\n    return ecma_make_integer_value (-1);\n  }\n\n  if (args_number == 1)\n  {\n    from_index = info_p->length - 1;\n  }\n  else\n  {\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &from_index)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_number_t to_int;\n\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_integer (args[1], &to_int)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    if (info_p->length + to_int < 0)\n    {\n      return ecma_make_integer_value (-1);\n    }\n\n    from_index = JERRY_MIN (from_index, info_p->length - 1);\n  }\n\n  ecma_typedarray_getter_fn_t getter_cb = ecma_get_typedarray_getter_fn (info_p->id);\n  uint8_t *buffer_p = ecma_arraybuffer_get_buffer (info_p->array_buffer_p) + info_p->offset;\n  uint8_t *current_element_p = buffer_p + (from_index << info_p->shift);\n\n  /* 10. */\n  while (current_element_p >= buffer_p)\n  {\n    ecma_value_t element = getter_cb (current_element_p);\n\n    if (ecma_op_same_value_zero (args[0], element, true))\n    {\n      ecma_free_value (element);\n      return ecma_make_number_value ((ecma_number_t) from_index);\n    }\n\n    ecma_free_value (element);\n    current_element_p -= info_p->element_size;\n    from_index--;\n  }\n\n  /* 11. */\n  return ecma_make_integer_value (-1);\n} /* ecma_builtin_typedarray_prototype_last_index_of */\n\n/**\n * The %TypedArray%.prototype object's 'copyWithin' routine\n *\n * See also:\n *          ECMA-262 v6, 22.2.3.5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_copy_within (ecma_value_t this_arg, /**< this argument */\n                                               ecma_typedarray_info_t *info_p, /**< object info */\n                                               const ecma_value_t args[], /**< arguments list */\n                                               uint32_t args_number) /**< number of arguments */\n{\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  uint32_t relative_target = 0;\n  uint32_t relative_start = 0;\n  uint32_t relative_end = info_p->length;\n\n  if (args_number > 0)\n  {\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[0], info_p->length, &relative_target)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    if (args_number > 1)\n    {\n      if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &relative_start)))\n      {\n        return ECMA_VALUE_ERROR;\n      }\n\n      if (args_number > 2 && args[2] != ECMA_VALUE_UNDEFINED)\n      {\n        if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[2], info_p->length, &relative_end)))\n        {\n          return ECMA_VALUE_ERROR;\n        }\n      }\n    }\n  }\n\n  if (relative_target >= info_p->length || relative_start >= relative_end || relative_end == 0)\n  {\n    return ecma_copy_value (this_arg);\n  }\n\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  uint8_t *buffer_p = ecma_typedarray_get_buffer (info_p);\n\n  uint32_t distance = relative_end - relative_start;\n  uint32_t offset = info_p->length - relative_target;\n  uint32_t count = JERRY_MIN (distance, offset);\n\n  memmove (buffer_p + (relative_target << info_p->shift),\n           buffer_p + (relative_start << info_p->shift),\n           (size_t) (count << info_p->shift));\n\n  return ecma_copy_value (this_arg);\n} /* ecma_builtin_typedarray_prototype_copy_within */\n\n/**\n * The %TypedArray%.prototype object's 'slice' routine\n *\n * See also:\n *          ECMA-262 v6, 22.2.3.23\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_slice (ecma_value_t this_arg, /**< this argument */\n                                         ecma_typedarray_info_t *info_p, /**< object info */\n                                         const ecma_value_t args[], /**< arguments list */\n                                         uint32_t args_number) /**< number of arguments */\n{\n  uint32_t relative_start = 0;\n  uint32_t relative_end = info_p->length;\n\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  if (args_number > 0)\n  {\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[0], info_p->length, &relative_start)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    if (args_number > 1 && args[1] != ECMA_VALUE_UNDEFINED\n        && ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &relative_end)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  uint8_t *src_buffer_p = ecma_typedarray_get_buffer (info_p);\n\n  int32_t distance = (int32_t) (relative_end - relative_start);\n  uint32_t count = distance > 0 ? (uint32_t) distance : 0;\n\n  ecma_value_t len = ecma_make_number_value (count);\n  // TODO: 22.2.3.23, 12-13.\n  ecma_value_t new_typedarray = ecma_typedarray_species_create (this_arg, &len, 1);\n  ecma_free_value (len);\n\n  if (ECMA_IS_VALUE_ERROR (new_typedarray) || count == 0)\n  {\n    return new_typedarray;\n  }\n\n  ecma_object_t *new_typedarray_p = ecma_get_object_from_value (new_typedarray);\n  ecma_typedarray_info_t new_typedarray_info = ecma_typedarray_get_info (new_typedarray_p);\n\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    ecma_deref_object (new_typedarray_p);\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  uint8_t *dst_buffer_p = ecma_typedarray_get_buffer (&new_typedarray_info);\n\n  src_buffer_p += relative_start << info_p->shift;\n\n  if (info_p->id == new_typedarray_info.id)\n  {\n    // 22.2.3.23. Step 22. h-i.\n\n    if (JERRY_LIKELY (new_typedarray_info.offset == 0))\n    {\n      if (info_p->array_buffer_p == new_typedarray_info.array_buffer_p)\n      {\n        return new_typedarray;\n      }\n\n      memcpy (dst_buffer_p, src_buffer_p, count << info_p->shift);\n    }\n    else\n    {\n      uint32_t byte_shift = (uint32_t) (1 << info_p->shift);\n\n      while (count)\n      {\n        memmove (dst_buffer_p, src_buffer_p, byte_shift);\n\n        dst_buffer_p += byte_shift;\n        src_buffer_p += byte_shift;\n\n        count--;\n      }\n    }\n  }\n  else\n  {\n    // 22.2.3.23. Step 21. b.\n    ecma_typedarray_getter_fn_t src_typedarray_getter_cb = ecma_get_typedarray_getter_fn (info_p->id);\n    ecma_typedarray_setter_fn_t new_typedarray_setter_cb = ecma_get_typedarray_setter_fn (new_typedarray_info.id);\n\n    for (uint32_t idx = 0; idx < count; idx++)\n    {\n      ecma_value_t element = src_typedarray_getter_cb (src_buffer_p);\n      ecma_value_t set_element = new_typedarray_setter_cb (dst_buffer_p, element);\n      ecma_free_value (element);\n\n      if (ECMA_IS_VALUE_ERROR (set_element))\n      {\n        ecma_deref_object (new_typedarray_p);\n        return set_element;\n      }\n\n      src_buffer_p += info_p->element_size;\n      dst_buffer_p += new_typedarray_info.element_size;\n    }\n  }\n\n  return new_typedarray;\n} /* ecma_builtin_typedarray_prototype_slice */\n\n/**\n * The TypedArray.prototype's 'toLocaleString' single element operation routine.\n *\n * See also:\n *          ECMA-262 v6, 22.1.3.26 steps 7-10 and 12.b-e\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_to_locale_string_helper (ecma_typedarray_info_t *info_p, /**< object info */\n                                                           uint32_t index) /** array index */\n{\n  ecma_value_t element_value = ecma_get_typedarray_element (info_p, index);\n\n  if (ECMA_IS_VALUE_ERROR (element_value))\n  {\n    return element_value;\n  }\n\n  ecma_value_t call_value = ecma_op_invoke_by_magic_id (element_value, LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, NULL, 0);\n\n  ecma_free_value (element_value);\n\n  if (ECMA_IS_VALUE_ERROR (call_value))\n  {\n    return call_value;\n  }\n\n  ecma_string_t *str_p = ecma_op_to_string (call_value);\n\n  ecma_free_value (call_value);\n\n  if (JERRY_UNLIKELY (str_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  return ecma_make_string_value (str_p);\n} /* ecma_builtin_typedarray_prototype_to_locale_string_helper */\n\n/**\n * The %TypedArray%.prototype object's 'toLocaleString' routine\n *\n * See also:\n *          ECMA-262 v6, 22.2.3.27\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_to_locale_string (ecma_typedarray_info_t *info_p) /**< object info */\n{\n  if (info_p->length == 0)\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  ecma_value_t first_element = ecma_builtin_typedarray_prototype_to_locale_string_helper (info_p, 0);\n\n  if (ECMA_IS_VALUE_ERROR (first_element))\n  {\n    return first_element;\n  }\n\n  ecma_string_t *return_string_p = ecma_get_string_from_value (first_element);\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (return_string_p);\n  ecma_deref_ecma_string (return_string_p);\n\n  for (uint32_t k = 1; k < info_p->length; k++)\n  {\n    ecma_stringbuilder_append_byte (&builder, LIT_CHAR_COMMA);\n    ecma_value_t next_element = ecma_builtin_typedarray_prototype_to_locale_string_helper (info_p, k);\n\n    if (ECMA_IS_VALUE_ERROR (next_element))\n    {\n      ecma_stringbuilder_destroy (&builder);\n      return next_element;\n    }\n\n    ecma_string_t *next_element_p = ecma_get_string_from_value (next_element);\n    ecma_stringbuilder_append (&builder, next_element_p);\n    ecma_deref_ecma_string (next_element_p);\n  }\n\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_builtin_typedarray_prototype_to_locale_string */\n\n/**\n * The %TypedArray%.prototype object's 'includes' routine\n *\n * See also:\n *          ECMA-262 v11, 22.2.3.13.\n */\nstatic ecma_value_t\necma_builtin_typedarray_prototype_includes (ecma_typedarray_info_t *info_p, /**< object info */\n                                            const ecma_value_t args[], /**< arguments list */\n                                            uint32_t args_number) /**< number of arguments */\n{\n#if JERRY_BUILTIN_BIGINT\n  bool is_bigint = ECMA_TYPEDARRAY_IS_BIGINT_TYPE (info_p->id);\n#else /* !JERRRY_BUILTIN_BIGINT */\n  bool is_bigint = false;\n#endif /* JERRRY_BUILTIN_BIGINT */\n\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  if (args_number == 0 || (!ecma_is_value_number (args[0]) && !is_bigint) || info_p->length == 0)\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  uint32_t from_index = 0;\n\n  if (args_number > 1)\n  {\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &from_index)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  uint8_t *buffer_p = ecma_typedarray_get_buffer (info_p);\n\n  ecma_typedarray_getter_fn_t getter_cb = ecma_get_typedarray_getter_fn (info_p->id);\n  uint8_t *limit_p = buffer_p + (info_p->length << info_p->shift);\n\n  buffer_p += from_index << info_p->shift;\n\n  while (buffer_p < limit_p)\n  {\n    ecma_value_t element = getter_cb (buffer_p);\n\n    if (ecma_op_same_value_zero (args[0], element, false))\n    {\n      ecma_free_value (element);\n      return ECMA_VALUE_TRUE;\n    }\n\n    ecma_free_value (element);\n    buffer_p += info_p->element_size;\n  }\n\n  return ECMA_VALUE_FALSE;\n} /* ecma_builtin_typedarray_prototype_includes */\n\n/**\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide\n                                                                                 *   routine identifier */\n                                                    ecma_value_t this_arg, /**< 'this' argument value */\n                                                    const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                            *   passed to routine */\n                                                    uint32_t arguments_number) /**< length of arguments' list */\n{\n  if (!ecma_is_typedarray (this_arg))\n  {\n    if (builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_STRING_TAG_GETTER)\n    {\n      return ECMA_VALUE_UNDEFINED;\n    }\n\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_TYPED_ARRAY);\n  }\n\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (this_arg);\n  ecma_typedarray_info_t info = { 0 };\n\n  if (builtin_routine_id < ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_BUFFER_GETTER)\n  {\n    info = ecma_typedarray_get_info (typedarray_p);\n\n    if (builtin_routine_id != ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SUBARRAY\n        && ECMA_ARRAYBUFFER_LAZY_ALLOC (info.array_buffer_p))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  if (builtin_routine_id < ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INDEX_OF && !ecma_op_is_callable (arguments_list_p[0]))\n  {\n    return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);\n  }\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INCLUDES:\n    {\n      return ecma_builtin_typedarray_prototype_includes (&info, arguments_list_p, arguments_number);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_JOIN:\n    {\n      return ecma_builtin_typedarray_prototype_join (typedarray_p, arguments_list_p[0]);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_EVERY:\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SOME:\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FOR_EACH:\n    {\n      uint8_t offset = (uint8_t) (builtin_routine_id - ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_EVERY);\n\n      return ecma_builtin_typedarray_prototype_exec_routine (this_arg,\n                                                             &info,\n                                                             arguments_list_p[0],\n                                                             arguments_list_p[1],\n                                                             offset);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_MAP:\n    {\n      return ecma_builtin_typedarray_prototype_map (this_arg, &info, arguments_list_p[0], arguments_list_p[1]);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE:\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT:\n    {\n      bool is_reduce = builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT;\n      return ecma_builtin_typedarray_prototype_reduce_with_direction (this_arg,\n                                                                      &info,\n                                                                      arguments_list_p,\n                                                                      arguments_number,\n                                                                      is_reduce);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FILTER:\n    {\n      return ecma_builtin_typedarray_prototype_filter (this_arg, &info, arguments_list_p[0], arguments_list_p[1]);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REVERSE:\n    {\n      return ecma_builtin_typedarray_prototype_reverse (this_arg, &info);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SET:\n    {\n      return ecma_builtin_typedarray_prototype_set (this_arg, arguments_list_p[0], arguments_list_p[1]);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SUBARRAY:\n    {\n      return ecma_builtin_typedarray_prototype_subarray (this_arg, &info, arguments_list_p[0], arguments_list_p[1]);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FILL:\n    {\n      return ecma_builtin_typedarray_prototype_fill (this_arg,\n                                                     &info,\n                                                     arguments_list_p[0],\n                                                     arguments_list_p[1],\n                                                     arguments_list_p[2]);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SORT:\n    {\n      if (!ecma_is_value_undefined (arguments_list_p[0]) && !ecma_op_is_callable (arguments_list_p[0]))\n      {\n        return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);\n      }\n\n      return ecma_builtin_typedarray_prototype_sort (this_arg, &info, arguments_list_p[0]);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FIND:\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FIND_INDEX:\n    {\n      bool is_find = builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FIND;\n      return ecma_builtin_typedarray_prototype_find_helper (this_arg,\n                                                            &info,\n                                                            arguments_list_p[0],\n                                                            arguments_list_p[1],\n                                                            is_find);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_AT:\n    {\n      return ecma_builtin_typedarray_prototype_at (&info, arguments_list_p[0]);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INDEX_OF:\n    {\n      return ecma_builtin_typedarray_prototype_index_of (&info, arguments_list_p, arguments_number);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_LAST_INDEX_OF:\n    {\n      return ecma_builtin_typedarray_prototype_last_index_of (&info, arguments_list_p, arguments_number);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_COPY_WITHIN:\n    {\n      return ecma_builtin_typedarray_prototype_copy_within (this_arg, &info, arguments_list_p, arguments_number);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SLICE:\n    {\n      return ecma_builtin_typedarray_prototype_slice (this_arg, &info, arguments_list_p, arguments_number);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_LOCALE_STRING:\n    {\n      return ecma_builtin_typedarray_prototype_to_locale_string (&info);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS:\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_ENTRIES:\n    {\n      ecma_iterator_kind_t iter_id =\n        (builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS) ? ECMA_ITERATOR_KEYS : ECMA_ITERATOR_ENTRIES;\n\n      return ecma_typedarray_iterators_helper (this_arg, iter_id);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_BUFFER_GETTER:\n    {\n      ecma_object_t *buffer_p = ecma_typedarray_get_arraybuffer (typedarray_p);\n      ecma_ref_object (buffer_p);\n\n      return ecma_make_object_value (buffer_p);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_BYTELENGTH_GETTER:\n    {\n      ecma_object_t *buffer_p = ecma_typedarray_get_arraybuffer (typedarray_p);\n\n      if (ecma_arraybuffer_is_detached (buffer_p))\n      {\n        return ecma_make_uint32_value (0);\n      }\n\n      uint32_t length = ecma_typedarray_get_length (typedarray_p);\n      uint8_t shift = ecma_typedarray_get_element_size_shift (typedarray_p);\n      return ecma_make_uint32_value (length << shift);\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_BYTEOFFSET_GETTER:\n    {\n      return ecma_make_uint32_value (ecma_typedarray_get_offset (typedarray_p));\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_LENGTH_GETTER:\n    {\n      ecma_object_t *buffer_p = ecma_typedarray_get_arraybuffer (typedarray_p);\n\n      if (ecma_arraybuffer_is_detached (buffer_p))\n      {\n        return ecma_make_uint32_value (0);\n      }\n\n      return ecma_make_uint32_value (ecma_typedarray_get_length (typedarray_p));\n    }\n    case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_STRING_TAG_GETTER:\n    {\n      ecma_extended_object_t *object_p = (ecma_extended_object_t *) typedarray_p;\n      return ecma_make_magic_string_value (ecma_get_typedarray_magic_string_id (object_p->u.cls.u1.typedarray_type));\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_typedarray_prototype_dispatch_routine */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %TypedArrayPrototype% description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/* ES2015 22.2.3.4 */\nOBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_TYPEDARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n\n/* Readonly accessor properties */\n/* ES2015 22.2.3.1 */\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BUFFER,\n                    ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_BUFFER_GETTER,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n/* ES2015 22.2.3.2 */\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,\n                    ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_BYTELENGTH_GETTER,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n/* ES2015 22.2.3.3 */\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_OFFSET_UL,\n                    ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_BYTEOFFSET_GETTER,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ES2015 22.2.3.17 */\nACCESSOR_READ_ONLY (LIT_MAGIC_STRING_LENGTH,\n                    ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_LENGTH_GETTER,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ECMA-262 v6, 23.1.3.13 */\nACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,\n                    ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_STRING_TAG_GETTER,\n                    ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\nROUTINE (LIT_MAGIC_STRING_COPY_WITHIN, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_COPY_WITHIN, NON_FIXED, 2)\nROUTINE (LIT_MAGIC_STRING_ENTRIES, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_ENTRIES, 0, 0)\nROUTINE (LIT_MAGIC_STRING_EVERY, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_EVERY, 2, 1)\nROUTINE (LIT_MAGIC_STRING_FILL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FILL, 3, 1)\nROUTINE (LIT_MAGIC_STRING_FILTER, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FILTER, 2, 1)\nROUTINE (LIT_MAGIC_STRING_FIND, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FIND, 2, 1)\nROUTINE (LIT_MAGIC_STRING_FIND_INDEX, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FIND_INDEX, 2, 1)\nROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FOR_EACH, 2, 1)\nROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INCLUDES, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_AT, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_AT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_INDEX_OF_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INDEX_OF, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_JOIN, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_JOIN, 1, 1)\nROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS, 0, 0)\nROUTINE (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_LAST_INDEX_OF, NON_FIXED, 1)\nROUTINE (LIT_MAGIC_STRING_MAP, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_MAP, 2, 1)\nROUTINE (LIT_MAGIC_STRING_REDUCE, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE, 2, 1)\nROUTINE (LIT_MAGIC_STRING_REDUCE_RIGHT_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT, 2, 1)\nROUTINE (LIT_MAGIC_STRING_REVERSE, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REVERSE, 0, 0)\nROUTINE (LIT_MAGIC_STRING_SET, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SET, 2, 1)\nROUTINE (LIT_MAGIC_STRING_SLICE, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SLICE, NON_FIXED, 2)\nROUTINE (LIT_MAGIC_STRING_SOME, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SOME, 2, 1)\nROUTINE (LIT_MAGIC_STRING_SORT, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SORT, 1, 1)\nROUTINE (LIT_MAGIC_STRING_SUBARRAY, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SUBARRAY, 2, 2)\nROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_LOCALE_STRING, 0, 0)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES,\n                    LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES,\n                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\nINTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR,\n                    LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES,\n                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE)\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-template.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#ifndef TYPEDARRAY_BYTES_PER_ELEMENT\n#error \"Please define TYPEDARRAY_BYTES_PER_ELEMENT\"\n#endif /* !TYPEDARRAY_BYTES_PER_ELEMENT */\n\n#ifndef TYPEDARRAY_MAGIC_STRING_ID\n#error \"Please define TYPEDARRAY_MAGIC_STRING_ID\"\n#endif /* !TYPEDARRAY_MAGIC_STRING_ID */\n\n#ifndef TYPEDARRAY_BUILTIN_ID\n#error \"Please define TYPEDARRAY_BUILTIN_ID\"\n#endif /* !TYPEDARRAY_BUILTIN_ID */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n/* ES2015 22.2.5 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 3, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ES2015 22.2.5.1 */\nNUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, TYPEDARRAY_BYTES_PER_ELEMENT, ECMA_PROPERTY_FIXED)\n\n/* ES2015 22.2.5 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, TYPEDARRAY_MAGIC_STRING_ID, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ES2015 22.2.5.2 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, TYPEDARRAY_BUILTIN_ID, ECMA_PROPERTY_FIXED)\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n\n#undef TYPEDARRAY_BUILTIN_ID\n#undef TYPEDARRAY_MAGIC_STRING_ID\n#undef TYPEDARRAY_BYTES_PER_ELEMENT\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-typedarray.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  typedarray\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup typedarray ECMA %TypedArray% object built-in\n * @{\n */\n\n/**\n * The %TypedArray%.from routine\n *\n * See also:\n *         ES2015 22.2.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_from (ecma_value_t this_arg, /**< 'this' argument */\n                              const ecma_value_t *arguments_list_p, /**< arguments list */\n                              uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  if (!ecma_is_constructor (this_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_CONSTRUCTOR);\n  }\n\n  ecma_value_t source;\n  ecma_value_t map_fn = ECMA_VALUE_UNDEFINED;\n  ecma_value_t this_in_fn = ECMA_VALUE_UNDEFINED;\n\n  if (arguments_list_len == 0)\n  {\n    return ecma_raise_type_error (ECMA_ERR_NO_SOURCE_ARGUMENT);\n  }\n\n  source = arguments_list_p[0];\n\n  if (arguments_list_len > 1)\n  {\n    map_fn = arguments_list_p[1];\n\n    if (!ecma_op_is_callable (map_fn))\n    {\n      return ecma_raise_type_error (ECMA_ERR_THE_MAPFN_ARGUMENT_IS_NOT_CALLABLE);\n    }\n\n    if (arguments_list_len > 2)\n    {\n      this_in_fn = arguments_list_p[2];\n    }\n  }\n\n  return ecma_op_typedarray_from (this_arg, source, map_fn, this_in_fn);\n\n} /* ecma_builtin_typedarray_from */\n\n/**\n * The %TypedArray%.of routine\n *\n * See also:\n *         ES2015 22.2.2.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_builtin_typedarray_of (ecma_value_t this_arg, /**< 'this' argument */\n                            const ecma_value_t *arguments_list_p, /**< arguments list */\n                            uint32_t arguments_list_len) /**< number of arguments */\n{\n  if (!ecma_is_constructor (this_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_CONSTRUCTOR);\n  }\n\n  ecma_object_t *constructor_obj_p = ecma_get_object_from_value (this_arg);\n  ecma_value_t len_val = ecma_make_uint32_value (arguments_list_len);\n  ecma_value_t ret_val = ecma_typedarray_create (constructor_obj_p, &len_val, 1);\n  ecma_free_value (len_val);\n\n  if (ECMA_IS_VALUE_ERROR (ret_val))\n  {\n    return ret_val;\n  }\n\n  uint32_t k = 0;\n  ecma_object_t *ret_obj_p = ecma_get_object_from_value (ret_val);\n  ecma_typedarray_info_t info = ecma_typedarray_get_info (ret_obj_p);\n  ecma_typedarray_setter_fn_t setter_cb = ecma_get_typedarray_setter_fn (info.id);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (info.array_buffer_p))\n  {\n    ecma_deref_object (ret_obj_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (info.array_buffer_p))\n  {\n    ecma_deref_object (ret_obj_p);\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  lit_utf8_byte_t *buffer_p = ecma_typedarray_get_buffer (&info);\n\n  while (k < arguments_list_len)\n  {\n    ecma_value_t set_element = setter_cb (buffer_p, arguments_list_p[k]);\n\n    if (ECMA_IS_VALUE_ERROR (set_element))\n    {\n      ecma_deref_object (ret_obj_p);\n      return set_element;\n    }\n\n    k++;\n    buffer_p += info.element_size;\n  }\n\n  return ret_val;\n} /* ecma_builtin_typedarray_of */\n\n/**\n * Handle calling [[Call]] of built-in %TypedArray% object\n *\n * ES2015 22.2.1 If %TypedArray% is directly called or\n * called as part of a new expression an exception is thrown\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_typedarray_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                       uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_TYPEDARRAY_INTRINSTIC_DIRECTLY_CALLED);\n} /* ecma_builtin_typedarray_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of built-in %TypedArray% object\n *\n * ES2015 22.2.1 If %TypedArray% is directly called or\n * called as part of a new expression an exception is thrown\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_typedarray_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                            uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_TYPEDARRAY_INTRINSTIC_CALLED_BY_NEW_EXPRESSION);\n} /* ecma_builtin_typedarray_dispatch_construct */\n\n/**\n * 22.2.2.4 get %TypedArray% [ @@species ] accessor\n *\n * @return ecma_value\n *         returned value must be freed with ecma_free_value\n */\necma_value_t\necma_builtin_typedarray_species_get (ecma_value_t this_value) /**< This Value */\n{\n  return ecma_copy_value (this_value);\n} /* ecma_builtin_typedarray_species_get */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * %TypedArray% description\n */\n\n#include \"ecma-builtin-helpers-macro-defines.inc.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/* ES2015 22.2.2 */\n/* ES11 22.2.1.1 - value of length changed to 0 */\nNUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ES2015 22.2.2 */\nSTRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_TYPED_ARRAY_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n/* ES2015 22.2.2.3 */\nOBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, ECMA_PROPERTY_FIXED)\n\n/* Routine properties:\n *  (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */\n\n/* ES2015 22.2.2.1 */\nROUTINE (LIT_MAGIC_STRING_FROM, ecma_builtin_typedarray_from, NON_FIXED, 1)\n\n/* ES2015 22.2.2.2 */\nROUTINE (LIT_MAGIC_STRING_OF, ecma_builtin_typedarray_of, NON_FIXED, 0)\n\n/* ES2015 22.2.2.4 */\nACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_typedarray_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n#include \"ecma-builtin-helpers-macro-undefs.inc.h\"\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-uint16array-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  uint16array_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup uint16arrayprototype ECMA Uint16Array.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Uint16Array prototype description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 2\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_UINT16ARRAY\n#include \"ecma-builtin-typedarray-prototype-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-uint16array.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  uint16array\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup uint16array ECMA Uint16Array object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of Uint16Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_uint16array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                        uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_UINT16_ARRAY_REQUIRES_NEW);\n} /* ecma_builtin_uint16array_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of Uint16Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_uint16array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                             uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT16_ARRAY);\n} /* ecma_builtin_uint16array_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Uint16Array description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 2\n#define TYPEDARRAY_MAGIC_STRING_ID   LIT_MAGIC_STRING_UINT16_ARRAY_UL\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_UINT16ARRAY_PROTOTYPE\n#include \"ecma-builtin-typedarray-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-uint32array-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  uint32array_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup uint32arrayprototype ECMA Uint32Array.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Uint32Array prototype description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 4\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_UINT32ARRAY\n#include \"ecma-builtin-typedarray-prototype-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-uint32array.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  uint32array\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup uint32array ECMA Uint32Array object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of Uint32Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_uint32array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                        uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_UINT32_ARRAY_REQUIRES_NEW);\n} /* ecma_builtin_uint32array_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of Uint32Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_uint32array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                             uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT32_ARRAY);\n} /* ecma_builtin_uint32array_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Uint32Array description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 4\n#define TYPEDARRAY_MAGIC_STRING_ID   LIT_MAGIC_STRING_UINT32_ARRAY_UL\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_UINT32ARRAY_PROTOTYPE\n#include \"ecma-builtin-typedarray-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-uint8array-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  uint8array_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup uint8arrayprototype ECMA Uint8Array.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Uint8Array prototype description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 1\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_UINT8ARRAY\n#include \"ecma-builtin-typedarray-prototype-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-uint8array.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  uint8array\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup uint8array ECMA Uint8Array object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of Uint8Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_uint8array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                       uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_UINT8_ARRAY_REQUIRES_NEW);\n} /* ecma_builtin_uint8array_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of Uint8Array\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_uint8array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                            uint32_t arguments_list_len) /**< number of arguments */\n{\n  return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT8_ARRAY);\n} /* ecma_builtin_uint8array_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Uint8Array description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 1\n#define TYPEDARRAY_MAGIC_STRING_ID   LIT_MAGIC_STRING_UINT8_ARRAY_UL\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_UINT8ARRAY_PROTOTYPE\n#include \"ecma-builtin-typedarray-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-uint8clampedarray-prototype.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  uint8clampedarray_prototype\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup uint8clampedarrayprototype ECMA Uint8ClampedArray.prototype object built-in\n * @{\n */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Uint8ClampedArray prototype description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 1\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY\n#include \"ecma-builtin-typedarray-prototype-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jrt.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n#define BUILTIN_INC_HEADER_NAME \"ecma-builtin-uint8clampedarray.inc.h\"\n#define BUILTIN_UNDERSCORED_ID  uint8clampedarray\n#include \"ecma-builtin-internal-routines-template.inc.h\"\n#include \"ecma-builtin-typedarray-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabuiltins\n * @{\n *\n * \\addtogroup uint8clampedarray ECMA Uint8ClampedArray object built-in\n * @{\n */\n\n/**\n * Handle calling [[Call]] of Uint8ClampedArray\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_uint8clampedarray_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                              uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_UINT8_CLAMPED_ARRAY_REQUIRES_NEW);\n} /* ecma_builtin_uint8clampedarray_dispatch_call */\n\n/**\n * Handle calling [[Construct]] of Uint8ClampedArray\n *\n * @return ecma value\n */\necma_value_t\necma_builtin_uint8clampedarray_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                   uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT8_CLAMPED_ARRAY);\n} /* ecma_builtin_uint8clampedarray_dispatch_construct */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Uint8ClampedArray description\n */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n#define TYPEDARRAY_BYTES_PER_ELEMENT 1\n#define TYPEDARRAY_MAGIC_STRING_ID   LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL\n#define TYPEDARRAY_BUILTIN_ID        ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY_PROTOTYPE\n#include \"ecma-builtin-typedarray-template.inc.h\"\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-arguments-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-arguments-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#include \"jrt.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaargumentsobject ECMA arguments object related routines\n * @{\n */\n\n/**\n * Arguments object creation operation.\n *\n * See also: ECMA-262 v5, 10.6\n *\n * @return ecma value of arguments object\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_create_arguments_object (vm_frame_ctx_shared_args_t *shared_p, /**< shared context data */\n                                 ecma_object_t *lex_env_p) /**< lexical environment the Arguments\n                                                            *   object is created for */\n{\n  ecma_object_t *func_obj_p = shared_p->header.function_object_p;\n  const ecma_compiled_code_t *bytecode_data_p = shared_p->header.bytecode_header_p;\n  uint16_t formal_params_number;\n\n  if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    formal_params_number = ((cbc_uint16_arguments_t *) bytecode_data_p)->argument_end;\n  }\n  else\n  {\n    formal_params_number = ((cbc_uint8_arguments_t *) bytecode_data_p)->argument_end;\n  }\n\n  uint32_t object_size = sizeof (ecma_unmapped_arguments_t);\n  uint32_t saved_arg_count = JERRY_MAX (shared_p->arg_list_len, formal_params_number);\n\n  if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED)\n  {\n    object_size = sizeof (ecma_mapped_arguments_t);\n  }\n\n  ecma_object_t *obj_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE),\n                                             object_size + (saved_arg_count * sizeof (ecma_value_t)),\n                                             ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_unmapped_arguments_t *arguments_p = (ecma_unmapped_arguments_t *) obj_p;\n\n  arguments_p->header.u.cls.type = ECMA_OBJECT_CLASS_ARGUMENTS;\n  arguments_p->header.u.cls.u1.arguments_flags = ECMA_ARGUMENTS_OBJECT_NO_FLAGS;\n  arguments_p->header.u.cls.u2.formal_params_number = formal_params_number;\n  arguments_p->header.u.cls.u3.arguments_number = 0;\n  arguments_p->callee = ecma_make_object_value (func_obj_p);\n\n  ecma_value_t *argv_p = (ecma_value_t *) (((uint8_t *) obj_p) + object_size);\n\n  for (uint32_t i = 0; i < shared_p->arg_list_len; i++)\n  {\n    argv_p[i] = ecma_copy_value_if_not_object (shared_p->arg_list_p[i]);\n  }\n\n  for (uint32_t i = shared_p->arg_list_len; i < saved_arg_count; i++)\n  {\n    argv_p[i] = ECMA_VALUE_UNDEFINED;\n  }\n\n  arguments_p->header.u.cls.u3.arguments_number = shared_p->arg_list_len;\n\n  if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED)\n  {\n    ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) obj_p;\n\n    ECMA_SET_INTERNAL_VALUE_POINTER (mapped_arguments_p->lex_env, lex_env_p);\n    arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_MAPPED;\n\n#if JERRY_SNAPSHOT_EXEC\n    if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)\n    {\n      arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE;\n      mapped_arguments_p->u.byte_code_p = (ecma_compiled_code_t *) bytecode_data_p;\n    }\n    else\n#endif /* JERRY_SNAPSHOT_EXEC */\n    {\n      ECMA_SET_INTERNAL_VALUE_POINTER (mapped_arguments_p->u.byte_code, bytecode_data_p);\n    }\n\n    /* Static snapshots are not ref counted. */\n    if ((bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION) == 0)\n    {\n      ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p);\n    }\n\n    ecma_value_t *formal_parameter_start_p;\n    formal_parameter_start_p = ecma_compiled_code_resolve_arguments_start ((ecma_compiled_code_t *) bytecode_data_p);\n\n    for (uint32_t i = 0; i < formal_params_number; i++)\n    {\n      /* For legacy (non-strict) argument definition the trailing duplicated arguments cannot be lazy instantiated\n         E.g: function f (a,a,a,a) {} */\n      if (JERRY_UNLIKELY (ecma_is_value_empty (formal_parameter_start_p[i])))\n      {\n        ecma_property_value_t *prop_value_p;\n        ecma_string_t *prop_name_p = ecma_new_ecma_string_from_uint32 (i);\n\n        prop_value_p =\n          ecma_create_named_data_property (obj_p, prop_name_p, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL);\n\n        ecma_deref_ecma_string (prop_name_p);\n\n        prop_value_p->value = argv_p[i];\n        argv_p[i] = ECMA_VALUE_EMPTY;\n      }\n    }\n  }\n\n  return ecma_make_object_value (obj_p);\n} /* ecma_op_create_arguments_object */\n\n/**\n * [[DefineOwnProperty]] ecma Arguments object's operation\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *          ECMA-262 v5, 10.6\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_arguments_object_define_own_property (ecma_object_t *object_p, /**< the object */\n                                              ecma_string_t *property_name_p, /**< property name */\n                                              const ecma_property_descriptor_t *property_desc_p) /**< property\n                                                                                                  *   descriptor */\n{\n  /* 3. */\n  ecma_value_t ret_value = ecma_op_general_object_define_own_property (object_p, property_name_p, property_desc_p);\n\n  if (ECMA_IS_VALUE_ERROR (ret_value)\n      || !(((ecma_extended_object_t *) object_p)->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED))\n  {\n    return ret_value;\n  }\n\n  ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) object_p;\n  uint32_t index = ecma_string_get_array_index (property_name_p);\n\n  if (index >= mapped_arguments_p->unmapped.header.u.cls.u2.formal_params_number)\n  {\n    return ret_value;\n  }\n\n  ecma_value_t *argv_p = (ecma_value_t *) (mapped_arguments_p + 1);\n\n  if (ecma_is_value_empty (argv_p[index]) || argv_p[index] == ECMA_VALUE_ARGUMENT_NO_TRACK)\n  {\n    return ret_value;\n  }\n\n  if (property_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))\n  {\n    ecma_free_value_if_not_object (argv_p[index]);\n    argv_p[index] = ECMA_VALUE_ARGUMENT_NO_TRACK;\n    return ret_value;\n  }\n\n  if (property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n  {\n    ecma_string_t *name_p = ecma_op_arguments_object_get_formal_parameter (mapped_arguments_p, index);\n    ecma_object_t *lex_env_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env);\n\n    ecma_value_t completion = ecma_op_set_mutable_binding (lex_env_p, name_p, property_desc_p->value, true);\n\n    JERRY_ASSERT (ecma_is_value_empty (completion));\n  }\n\n  if ((property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED) && !(property_desc_p->flags & JERRY_PROP_IS_WRITABLE))\n  {\n    ecma_free_value_if_not_object (argv_p[index]);\n    argv_p[index] = ECMA_VALUE_ARGUMENT_NO_TRACK;\n  }\n\n  return ret_value;\n} /* ecma_op_arguments_object_define_own_property */\n\n/**\n * Try to lazy instantiate the given property of a mapped/unmapped arguments object\n *\n * @return pointer property, if one was instantiated,\n *         NULL - otherwise.\n */\necma_property_t *\necma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< object */\n                                                           ecma_string_t *property_name_p) /**< property's name */\n{\n  JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARGUMENTS));\n\n  ecma_unmapped_arguments_t *arguments_p = (ecma_unmapped_arguments_t *) object_p;\n  ecma_value_t *argv_p = (ecma_value_t *) (arguments_p + 1);\n  ecma_property_value_t *prop_value_p;\n  ecma_property_t *prop_p;\n  uint32_t arguments_number = arguments_p->header.u.cls.u3.arguments_number;\n  uint8_t flags = arguments_p->header.u.cls.u1.arguments_flags;\n\n  if (flags & ECMA_ARGUMENTS_OBJECT_MAPPED)\n  {\n    argv_p = (ecma_value_t *) (((ecma_mapped_arguments_t *) object_p) + 1);\n  }\n\n  uint32_t index = ecma_string_get_array_index (property_name_p);\n\n  if (index != ECMA_STRING_NOT_ARRAY_INDEX)\n  {\n    if (index >= arguments_number || ecma_is_value_empty (argv_p[index]))\n    {\n      return NULL;\n    }\n\n    JERRY_ASSERT (argv_p[index] != ECMA_VALUE_ARGUMENT_NO_TRACK);\n\n    prop_value_p = ecma_create_named_data_property (object_p,\n                                                    property_name_p,\n                                                    ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                    &prop_p);\n\n    /* Passing the reference */\n    prop_value_p->value = argv_p[index];\n\n    argv_p[index] = ECMA_VALUE_UNDEFINED;\n    return prop_p;\n  }\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH)\n      && !(flags & ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED))\n  {\n    prop_value_p = ecma_create_named_data_property (object_p,\n                                                    ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH),\n                                                    ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE,\n                                                    &prop_p);\n\n    prop_value_p->value = ecma_make_uint32_value (arguments_number);\n    return prop_p;\n  }\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLEE)\n      && !(flags & ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED))\n  {\n    if (flags & ECMA_ARGUMENTS_OBJECT_MAPPED)\n    {\n      prop_value_p = ecma_create_named_data_property (object_p,\n                                                      property_name_p,\n                                                      ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE,\n                                                      &prop_p);\n\n      prop_value_p->value = arguments_p->callee;\n    }\n    else\n    {\n      ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);\n\n      ecma_create_named_accessor_property (object_p,\n                                           ecma_get_magic_string (LIT_MAGIC_STRING_CALLEE),\n                                           thrower_p,\n                                           thrower_p,\n                                           ECMA_PROPERTY_BUILT_IN_FIXED,\n                                           &prop_p);\n    }\n    return prop_p;\n  }\n\n  if (ecma_op_compare_string_to_global_symbol (property_name_p, LIT_GLOBAL_SYMBOL_ITERATOR)\n      && !(flags & ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED))\n  {\n    prop_value_p = ecma_create_named_data_property (object_p,\n                                                    property_name_p,\n                                                    ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE,\n                                                    &prop_p);\n\n    prop_value_p->value = ecma_op_object_get_by_magic_id (ecma_builtin_get (ECMA_BUILTIN_ID_INTRINSIC_OBJECT),\n                                                          LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES);\n\n    JERRY_ASSERT (ecma_is_value_object (prop_value_p->value));\n    ecma_deref_object (ecma_get_object_from_value (prop_value_p->value));\n    return prop_p;\n  }\n\n  return NULL;\n} /* ecma_op_arguments_object_try_to_lazy_instantiate_property */\n\n/**\n * Delete configurable properties of arguments object\n */\nvoid\necma_op_arguments_delete_built_in_property (ecma_object_t *object_p, /**< the object */\n                                            ecma_string_t *property_name_p) /**< property name */\n{\n  ecma_unmapped_arguments_t *arguments_p = (ecma_unmapped_arguments_t *) object_p;\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH))\n  {\n    JERRY_ASSERT (!(arguments_p->header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED));\n\n    arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED;\n    return;\n  }\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLEE))\n  {\n    JERRY_ASSERT (!(arguments_p->header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED));\n    JERRY_ASSERT (arguments_p->header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED);\n\n    arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED;\n    return;\n  }\n\n  if (ecma_prop_name_is_symbol (property_name_p))\n  {\n    JERRY_ASSERT (!(arguments_p->header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED));\n    JERRY_ASSERT (ecma_op_compare_string_to_global_symbol (property_name_p, LIT_GLOBAL_SYMBOL_ITERATOR));\n\n    arguments_p->header.u.cls.u1.arguments_flags |= ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED;\n    return;\n  }\n\n  uint32_t index = ecma_string_get_array_index (property_name_p);\n\n  ecma_value_t *argv_p = (ecma_value_t *) (arguments_p + 1);\n\n  if (arguments_p->header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED)\n  {\n    argv_p = (ecma_value_t *) (((ecma_mapped_arguments_t *) object_p) + 1);\n  }\n\n  JERRY_ASSERT (argv_p[index] == ECMA_VALUE_UNDEFINED || argv_p[index] == ECMA_VALUE_ARGUMENT_NO_TRACK);\n\n  argv_p[index] = ECMA_VALUE_EMPTY;\n} /* ecma_op_arguments_delete_built_in_property */\n\n/**\n * List names of an arguments object's lazy instantiated properties\n */\nvoid\necma_op_arguments_object_list_lazy_property_names (ecma_object_t *obj_p, /**< arguments object */\n                                                   ecma_collection_t *prop_names_p, /**< prop name collection */\n                                                   ecma_property_counter_t *prop_counter_p, /**< property counters */\n                                                   jerry_property_filter_t filter) /**< property name filter options */\n{\n  JERRY_ASSERT (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARGUMENTS));\n\n  ecma_unmapped_arguments_t *arguments_p = (ecma_unmapped_arguments_t *) obj_p;\n\n  uint32_t arguments_number = arguments_p->header.u.cls.u3.arguments_number;\n  uint8_t flags = arguments_p->header.u.cls.u1.arguments_flags;\n\n  if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES))\n  {\n    ecma_value_t *argv_p = (ecma_value_t *) (arguments_p + 1);\n\n    if (flags & ECMA_ARGUMENTS_OBJECT_MAPPED)\n    {\n      argv_p = (ecma_value_t *) (((ecma_mapped_arguments_t *) obj_p) + 1);\n    }\n\n    for (uint32_t index = 0; index < arguments_number; index++)\n    {\n      if (!ecma_is_value_empty (argv_p[index]))\n      {\n        ecma_string_t *index_string_p = ecma_new_ecma_string_from_uint32 (index);\n        ecma_collection_push_back (prop_names_p, ecma_make_string_value (index_string_p));\n        prop_counter_p->array_index_named_props++;\n      }\n    }\n  }\n\n  if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS))\n  {\n    if (!(flags & ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED))\n    {\n      ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));\n      prop_counter_p->string_named_props++;\n    }\n\n    if (!(flags & ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED))\n    {\n      ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLEE));\n      prop_counter_p->string_named_props++;\n    }\n  }\n\n  if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS) && !(flags & ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED))\n  {\n    ecma_string_t *symbol_p = ecma_op_get_global_symbol (LIT_GLOBAL_SYMBOL_ITERATOR);\n    ecma_collection_push_back (prop_names_p, ecma_make_symbol_value (symbol_p));\n    prop_counter_p->symbol_named_props++;\n  }\n} /* ecma_op_arguments_object_list_lazy_property_names */\n\n/**\n * Get the formal parameter name corresponding to the given property index\n *\n * @return pointer to the formal parameter name\n */\necma_string_t *\necma_op_arguments_object_get_formal_parameter (ecma_mapped_arguments_t *mapped_arguments_p, /**< mapped arguments\n                                                                                             *   object */\n                                               uint32_t index) /**< formal parameter index */\n{\n  JERRY_ASSERT (mapped_arguments_p->unmapped.header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED);\n  JERRY_ASSERT (index < mapped_arguments_p->unmapped.header.u.cls.u2.formal_params_number);\n\n  ecma_compiled_code_t *byte_code_p;\n\n#if JERRY_SNAPSHOT_EXEC\n  if (mapped_arguments_p->unmapped.header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE)\n  {\n    byte_code_p = mapped_arguments_p->u.byte_code_p;\n  }\n  else\n#endif /* JERRY_SNAPSHOT_EXEC */\n  {\n    byte_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, mapped_arguments_p->u.byte_code);\n  }\n\n  ecma_value_t *formal_param_names_p = ecma_compiled_code_resolve_arguments_start (byte_code_p);\n\n  return ecma_get_string_from_value (formal_param_names_p[index]);\n} /* ecma_op_arguments_object_get_formal_parameter */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-arguments-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_ARGUMENTS_OBJECT_H\n#define ECMA_ARGUMENTS_OBJECT_H\n\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n#include \"vm-defines.h\"\n\necma_value_t ecma_op_create_arguments_object (vm_frame_ctx_shared_args_t *shared_p, ecma_object_t *lex_env_p);\n\necma_value_t ecma_op_arguments_object_define_own_property (ecma_object_t *object_p,\n                                                           ecma_string_t *property_name_p,\n                                                           const ecma_property_descriptor_t *property_desc_p);\n\necma_property_t *ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object_p,\n                                                                            ecma_string_t *property_name_p);\n\nvoid ecma_op_arguments_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);\n\nvoid ecma_op_arguments_object_list_lazy_property_names (ecma_object_t *obj_p,\n                                                        ecma_collection_t *prop_names_p,\n                                                        ecma_property_counter_t *prop_counter_p,\n                                                        jerry_property_filter_t filter);\n\necma_string_t *ecma_op_arguments_object_get_formal_parameter (ecma_mapped_arguments_t *mapped_arguments_p,\n                                                              uint32_t index);\n#endif /* !ECMA_ARGUMENTS_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-array-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-array-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-property-hashmap.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaarrayobject ECMA Array object related routines\n * @{\n */\n\n/**\n * Property name type flag for array indices.\n */\n#define ECMA_FAST_ARRAY_UINT_DIRECT_STRING_PROP_TYPE (ECMA_DIRECT_STRING_UINT << ECMA_PROPERTY_NAME_TYPE_SHIFT)\n\n/**\n * Allocate a new array object with the given length\n *\n * @return pointer to the constructed array object\n */\nstatic ecma_object_t *\necma_op_alloc_array_object (uint32_t length) /**< length of the new array */\n{\n#if JERRY_BUILTIN_ARRAY\n  ecma_object_t *array_prototype_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE);\n#else /* !JERRY_BUILTIN_ARRAY */\n  ecma_object_t *array_prototype_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n#endif /* JERRY_BUILTIN_ARRAY */\n\n  ecma_object_t *object_p =\n    ecma_create_object (array_prototype_object_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_ARRAY);\n\n  /*\n   * [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_ARRAY type.\n   *\n   * See also: ecma_object_get_class_name\n   */\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n  ext_obj_p->u.array.length = length;\n  ext_obj_p->u.array.length_prop_and_hole_count = ECMA_PROPERTY_FLAG_WRITABLE | ECMA_PROPERTY_VIRTUAL;\n\n  return object_p;\n} /* ecma_op_alloc_array_object */\n\n/**\n * Check whether the given object is fast-access mode array\n *\n * @return true - if the object is fast-access mode array\n *         false, otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_op_object_is_fast_array (ecma_object_t *object_p) /**< ecma-object */\n{\n  return (ecma_get_object_base_type (object_p) == ECMA_OBJECT_BASE_TYPE_ARRAY\n          && ecma_op_array_is_fast_array ((ecma_extended_object_t *) object_p));\n} /* ecma_op_object_is_fast_array */\n\n/**\n * Check whether the given array object is fast-access mode array\n *\n * @return true - if the array object is fast-access mode array\n *         false, otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_op_array_is_fast_array (ecma_extended_object_t *array_p) /**< ecma-array-object */\n{\n  JERRY_ASSERT (ecma_get_object_base_type ((ecma_object_t *) array_p) == ECMA_OBJECT_BASE_TYPE_ARRAY);\n\n  return array_p->u.array.length_prop_and_hole_count & ECMA_FAST_ARRAY_FLAG;\n} /* ecma_op_array_is_fast_array */\n\n/**\n * Allocate a new array object with the given length\n *\n * Note: The returned array can be normal of fast access mode\n *\n * @return pointer to the constructed array object\n */\necma_object_t *\necma_op_new_array_object (uint32_t length) /**< length of the new array */\n{\n  ecma_object_t *object_p = ecma_op_alloc_array_object (length);\n\n  const uint32_t aligned_length = ECMA_FAST_ARRAY_ALIGN_LENGTH (length);\n  ecma_value_t *values_p = NULL;\n\n  if (length > 0)\n  {\n    if (length >= ECMA_FAST_ARRAY_MAX_HOLE_COUNT)\n    {\n      return object_p;\n    }\n\n    values_p = (ecma_value_t *) jmem_heap_alloc_block_null_on_error (aligned_length * sizeof (ecma_value_t));\n\n    if (JERRY_UNLIKELY (values_p == NULL))\n    {\n      return object_p;\n    }\n  }\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n  ext_obj_p->u.array.length_prop_and_hole_count |= ECMA_FAST_ARRAY_FLAG;\n  ext_obj_p->u.array.length_prop_and_hole_count += length * ECMA_FAST_ARRAY_HOLE_ONE;\n\n  for (uint32_t i = 0; i < aligned_length; i++)\n  {\n    values_p[i] = ECMA_VALUE_ARRAY_HOLE;\n  }\n\n  JERRY_ASSERT (object_p->u1.property_list_cp == JMEM_CP_NULL);\n  ECMA_SET_POINTER (object_p->u1.property_list_cp, values_p);\n  return object_p;\n} /* ecma_op_new_array_object */\n\n/**\n * Allocate a new array object from the given length\n *\n * Note: The returned array can be normal of fast access mode\n *\n * @return NULL - if the given length is invalid\n *         pointer to the constructed array object - otherwise\n */\necma_object_t *\necma_op_new_array_object_from_length (ecma_length_t length) /**< length of the new array */\n{\n  if (length > UINT32_MAX)\n  {\n    ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH);\n    return NULL;\n  }\n\n  return ecma_op_new_array_object ((uint32_t) length);\n} /* ecma_op_new_array_object_from_length */\n\n/**\n * Allocate a new array object from the given buffer\n *\n * Note: The returned array can be normal of fast access mode\n *\n * @return ecma_value - constructed array object\n */\necma_value_t\necma_op_new_array_object_from_buffer (const ecma_value_t *args_p, /**< array element list */\n                                      uint32_t length) /**< number of array elements */\n{\n  if (length == 0)\n  {\n    return ecma_make_object_value (ecma_op_new_array_object (0));\n  }\n\n  ecma_object_t *object_p = ecma_op_alloc_array_object (length);\n  const uint32_t aligned_length = ECMA_FAST_ARRAY_ALIGN_LENGTH (length);\n  ecma_value_t *values_p;\n  values_p = (ecma_value_t *) jmem_heap_alloc_block_null_on_error (aligned_length * sizeof (ecma_value_t));\n\n  if (values_p != NULL)\n  {\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n    ext_obj_p->u.array.length_prop_and_hole_count |= ECMA_FAST_ARRAY_FLAG;\n    JERRY_ASSERT (object_p->u1.property_list_cp == JMEM_CP_NULL);\n\n    for (uint32_t i = 0; i < length; i++)\n    {\n      JERRY_ASSERT (!ecma_is_value_array_hole (args_p[i]));\n      values_p[i] = ecma_copy_value_if_not_object (args_p[i]);\n    }\n\n    for (uint32_t i = length; i < aligned_length; i++)\n    {\n      values_p[i] = ECMA_VALUE_ARRAY_HOLE;\n    }\n\n    ECMA_SET_POINTER (object_p->u1.property_list_cp, values_p);\n  }\n  else\n  {\n    for (uint32_t i = 0; i < length; i++)\n    {\n      JERRY_ASSERT (!ecma_is_value_array_hole (args_p[i]));\n\n      ecma_string_t *prop_name_p = ecma_new_ecma_string_from_uint32 (i);\n      ecma_property_value_t *prop_value_p;\n      prop_value_p =\n        ecma_create_named_data_property (object_p, prop_name_p, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL);\n      ecma_deref_ecma_string (prop_name_p);\n      prop_value_p->value = ecma_copy_value_if_not_object (args_p[i]);\n    }\n  }\n\n  return ecma_make_object_value (object_p);\n} /* ecma_op_new_array_object_from_buffer */\n\n/**\n * Allocate a new fast acces mode array object from the given collection\n *\n * Note: The given collection will be unavailable after and it's underlying buffer is reused\n *\n * @return ecma_value - constructed fast access mode array object\n */\necma_value_t\necma_op_new_array_object_from_collection (ecma_collection_t *collection_p, /**< collection to create array from */\n                                          bool unref_objects) /**< true - if the collection potentially\n                                                                          containts objects\n                                                                   false - otherwise */\n{\n  const uint32_t item_count = collection_p->item_count;\n\n  if (item_count == 0)\n  {\n    ecma_collection_destroy (collection_p);\n    return ecma_make_object_value (ecma_op_new_array_object (0));\n  }\n\n  ecma_object_t *object_p;\n  ecma_value_t *buffer_p = collection_p->buffer_p;\n  const uint32_t old_size = ECMA_COLLECTION_ALLOCATED_SIZE (collection_p->capacity);\n  const uint32_t aligned_length = ECMA_FAST_ARRAY_ALIGN_LENGTH (collection_p->item_count);\n\n  jmem_heap_free_block (collection_p, sizeof (ecma_collection_t));\n  buffer_p = jmem_heap_realloc_block (buffer_p, old_size, aligned_length * sizeof (ecma_value_t));\n  object_p = ecma_op_alloc_array_object (item_count);\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n  ext_obj_p->u.array.length_prop_and_hole_count |= ECMA_FAST_ARRAY_FLAG;\n  JERRY_ASSERT (object_p->u1.property_list_cp == JMEM_CP_NULL);\n  JERRY_ASSERT (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE);\n  ECMA_SET_POINTER (object_p->u1.property_list_cp, buffer_p);\n\n  if (JERRY_UNLIKELY (unref_objects))\n  {\n    for (uint32_t i = 0; i < item_count; i++)\n    {\n      /* Strong references from the collection are no longer needed\n         since GC will mark these object as a fast access mode array properties */\n      ecma_deref_if_object (buffer_p[i]);\n    }\n  }\n\n  for (uint32_t i = item_count; i < aligned_length; i++)\n  {\n    buffer_p[i] = ECMA_VALUE_ARRAY_HOLE;\n  }\n\n  return ecma_make_object_value (object_p);\n} /* ecma_op_new_array_object_from_collection */\n\n/**\n * Converts a fast access mode array back to a normal property list based array\n */\nvoid\necma_fast_array_convert_to_normal (ecma_object_t *object_p) /**< fast access mode array object */\n{\n  JERRY_ASSERT (ecma_op_object_is_fast_array (object_p));\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n\n  if (object_p->u1.property_list_cp == JMEM_CP_NULL)\n  {\n    ext_obj_p->u.array.length_prop_and_hole_count &= (uint32_t) ~ECMA_FAST_ARRAY_FLAG;\n    return;\n  }\n\n  uint32_t length = ext_obj_p->u.array.length;\n  const uint32_t aligned_length = ECMA_FAST_ARRAY_ALIGN_LENGTH (length);\n  ecma_value_t *values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n\n  ecma_ref_object (object_p);\n\n  ecma_property_pair_t *property_pair_p = NULL;\n  jmem_cpointer_t next_property_pair_cp = JMEM_CP_NULL;\n\n  uint32_t prop_index = 1;\n  int32_t index = (int32_t) (length - 1);\n\n  while (index >= 0)\n  {\n    if (ecma_is_value_array_hole (values_p[index]))\n    {\n      index--;\n      continue;\n    }\n\n    if (prop_index == 1)\n    {\n      property_pair_p = ecma_alloc_property_pair ();\n      property_pair_p->header.next_property_cp = next_property_pair_cp;\n      property_pair_p->names_cp[0] = LIT_INTERNAL_MAGIC_STRING_DELETED;\n      property_pair_p->header.types[0] = ECMA_PROPERTY_TYPE_DELETED;\n      ECMA_SET_NON_NULL_POINTER (next_property_pair_cp, property_pair_p);\n    }\n\n    JERRY_ASSERT (index <= ECMA_DIRECT_STRING_MAX_IMM);\n\n    property_pair_p->names_cp[prop_index] = (jmem_cpointer_t) index;\n    property_pair_p->header.types[prop_index] =\n      (ecma_property_t) (ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE\n                         | ECMA_FAST_ARRAY_UINT_DIRECT_STRING_PROP_TYPE);\n\n    property_pair_p->values[prop_index].value = values_p[index];\n\n    index--;\n    prop_index = !prop_index;\n  }\n\n  ext_obj_p->u.array.length_prop_and_hole_count &= (uint32_t) ~ECMA_FAST_ARRAY_FLAG;\n  jmem_heap_free_block (values_p, aligned_length * sizeof (ecma_value_t));\n  ECMA_SET_POINTER (object_p->u1.property_list_cp, property_pair_p);\n\n  ecma_deref_object (object_p);\n} /* ecma_fast_array_convert_to_normal */\n\n/**\n * [[Put]] operation for a fast access mode array\n *\n * @return false - If the property name is not array index, or the requested index to be set\n *                 would result too much array hole in the underlying buffer. The these cases\n *                 the array is converted back to normal property list based array.\n *         true - If the indexed property can be set with/without resizing the underlying buffer.\n */\nbool\necma_fast_array_set_property (ecma_object_t *object_p, /**< fast access mode array object */\n                              uint32_t index, /**< property name index */\n                              ecma_value_t value) /**< value to be set */\n{\n  JERRY_ASSERT (ecma_op_object_is_fast_array (object_p));\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n  uint32_t old_length = ext_obj_p->u.array.length;\n\n  ecma_value_t *values_p;\n\n  if (JERRY_LIKELY (index < old_length))\n  {\n    JERRY_ASSERT (object_p->u1.property_list_cp != JMEM_CP_NULL);\n\n    values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n\n    if (ecma_is_value_array_hole (values_p[index]))\n    {\n      ext_obj_p->u.array.length_prop_and_hole_count -= ECMA_FAST_ARRAY_HOLE_ONE;\n    }\n    else\n    {\n      ecma_free_value_if_not_object (values_p[index]);\n    }\n\n    values_p[index] = ecma_copy_value_if_not_object (value);\n\n    return true;\n  }\n\n  uint32_t old_holes = ext_obj_p->u.array.length_prop_and_hole_count;\n  uint32_t new_holes = index - old_length;\n\n  if (JERRY_UNLIKELY (new_holes > (ECMA_FAST_ARRAY_MAX_HOLE_COUNT - (old_holes >> ECMA_FAST_ARRAY_HOLE_SHIFT))))\n  {\n    ecma_fast_array_convert_to_normal (object_p);\n\n    return false;\n  }\n\n  uint32_t new_length = index + 1;\n\n  JERRY_ASSERT (new_length < UINT32_MAX);\n\n  const uint32_t aligned_length = ECMA_FAST_ARRAY_ALIGN_LENGTH (old_length);\n\n  if (JERRY_LIKELY (index < aligned_length))\n  {\n    JERRY_ASSERT (object_p->u1.property_list_cp != JMEM_CP_NULL);\n\n    values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n    /* This area is filled with ECMA_VALUE_ARRAY_HOLE, but not counted in u.array.length_prop_and_hole_count */\n    JERRY_ASSERT (ecma_is_value_array_hole (values_p[index]));\n    ext_obj_p->u.array.length_prop_and_hole_count += new_holes * ECMA_FAST_ARRAY_HOLE_ONE;\n    ext_obj_p->u.array.length = new_length;\n  }\n  else\n  {\n    values_p = ecma_fast_array_extend (object_p, new_length);\n    ext_obj_p->u.array.length_prop_and_hole_count -= ECMA_FAST_ARRAY_HOLE_ONE;\n  }\n\n  values_p[index] = ecma_copy_value_if_not_object (value);\n\n  return true;\n} /* ecma_fast_array_set_property */\n\n/**\n * Get the number of array holes in a fast access array object\n *\n * @return number of array holes in a fast access array object\n */\nextern inline uint32_t JERRY_ATTR_ALWAYS_INLINE\necma_fast_array_get_hole_count (ecma_object_t *obj_p) /**< fast access mode array object */\n{\n  JERRY_ASSERT (ecma_op_object_is_fast_array (obj_p));\n\n  return ((ecma_extended_object_t *) obj_p)->u.array.length_prop_and_hole_count >> ECMA_FAST_ARRAY_HOLE_SHIFT;\n} /* ecma_fast_array_get_hole_count */\n\n/**\n * Extend the underlying buffer of a fast mode access array for the given new length\n *\n * @return pointer to the extended underlying buffer\n */\necma_value_t *\necma_fast_array_extend (ecma_object_t *object_p, /**< fast access mode array object */\n                        uint32_t new_length) /**< new length of the fast access mode array */\n{\n  JERRY_ASSERT (ecma_op_object_is_fast_array (object_p));\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n  uint32_t old_length = ext_obj_p->u.array.length;\n\n  JERRY_ASSERT (old_length < new_length);\n\n  ecma_ref_object (object_p);\n\n  ecma_value_t *new_values_p;\n  const uint32_t old_length_aligned = ECMA_FAST_ARRAY_ALIGN_LENGTH (old_length);\n  const uint32_t new_length_aligned = ECMA_FAST_ARRAY_ALIGN_LENGTH (new_length);\n\n  if (object_p->u1.property_list_cp == JMEM_CP_NULL)\n  {\n    new_values_p = jmem_heap_alloc_block (new_length_aligned * sizeof (ecma_value_t));\n  }\n  else\n  {\n    ecma_value_t *values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n    new_values_p = (ecma_value_t *) jmem_heap_realloc_block (values_p,\n                                                             old_length_aligned * sizeof (ecma_value_t),\n                                                             new_length_aligned * sizeof (ecma_value_t));\n  }\n\n  for (uint32_t i = old_length; i < new_length_aligned; i++)\n  {\n    new_values_p[i] = ECMA_VALUE_ARRAY_HOLE;\n  }\n\n  ext_obj_p->u.array.length_prop_and_hole_count += (new_length - old_length) * ECMA_FAST_ARRAY_HOLE_ONE;\n  ext_obj_p->u.array.length = new_length;\n\n  ECMA_SET_NON_NULL_POINTER (object_p->u1.property_list_cp, new_values_p);\n\n  ecma_deref_object (object_p);\n  return new_values_p;\n} /* ecma_fast_array_extend */\n\n/**\n * Delete the array object's property referenced by its value pointer.\n *\n * Note: specified property must be owned by specified object.\n *\n * @return true, if the property is deleted\n *         false, otherwise\n */\nbool\necma_array_object_delete_property (ecma_object_t *object_p, /**< object */\n                                   ecma_string_t *property_name_p) /**< property name */\n{\n  JERRY_ASSERT (ecma_get_object_base_type (object_p) == ECMA_OBJECT_BASE_TYPE_ARRAY);\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n\n  if (!ecma_op_object_is_fast_array (object_p))\n  {\n    return false;\n  }\n\n  JERRY_ASSERT (object_p->u1.property_list_cp != JMEM_CP_NULL);\n\n  uint32_t index = ecma_string_get_array_index (property_name_p);\n\n  JERRY_ASSERT (index != ECMA_STRING_NOT_ARRAY_INDEX);\n  JERRY_ASSERT (index < ext_obj_p->u.array.length);\n\n  ecma_value_t *values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n\n  if (ecma_is_value_array_hole (values_p[index]))\n  {\n    return true;\n  }\n\n  ecma_free_value_if_not_object (values_p[index]);\n\n  values_p[index] = ECMA_VALUE_ARRAY_HOLE;\n  ext_obj_p->u.array.length_prop_and_hole_count += ECMA_FAST_ARRAY_HOLE_ONE;\n  return true;\n} /* ecma_array_object_delete_property */\n\n/**\n * Low level delete of fast access mode array items\n *\n * @return the updated value of new_length\n */\nuint32_t\necma_delete_fast_array_properties (ecma_object_t *object_p, /**< fast access mode array */\n                                   uint32_t new_length) /**< new length of the fast access mode array */\n{\n  JERRY_ASSERT (ecma_op_object_is_fast_array (object_p));\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n\n  ecma_ref_object (object_p);\n  ecma_value_t *values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n\n  uint32_t old_length = ext_obj_p->u.array.length;\n  const uint32_t old_aligned_length = ECMA_FAST_ARRAY_ALIGN_LENGTH (old_length);\n  JERRY_ASSERT (new_length < old_length);\n\n  for (uint32_t i = new_length; i < old_length; i++)\n  {\n    if (ecma_is_value_array_hole (values_p[i]))\n    {\n      ext_obj_p->u.array.length_prop_and_hole_count -= ECMA_FAST_ARRAY_HOLE_ONE;\n    }\n    else\n    {\n      ecma_free_value_if_not_object (values_p[i]);\n    }\n  }\n\n  jmem_cpointer_t new_property_list_cp;\n\n  if (new_length == 0)\n  {\n    jmem_heap_free_block (values_p, old_aligned_length * sizeof (ecma_value_t));\n    new_property_list_cp = JMEM_CP_NULL;\n  }\n  else\n  {\n    const uint32_t new_aligned_length = ECMA_FAST_ARRAY_ALIGN_LENGTH (new_length);\n\n    ecma_value_t *new_values_p;\n    new_values_p = (ecma_value_t *) jmem_heap_realloc_block (values_p,\n                                                             old_aligned_length * sizeof (ecma_value_t),\n                                                             new_aligned_length * sizeof (ecma_value_t));\n\n    for (uint32_t i = new_length; i < new_aligned_length; i++)\n    {\n      new_values_p[i] = ECMA_VALUE_ARRAY_HOLE;\n    }\n\n    ECMA_SET_NON_NULL_POINTER (new_property_list_cp, new_values_p);\n  }\n\n  ext_obj_p->u.array.length = new_length;\n  object_p->u1.property_list_cp = new_property_list_cp;\n\n  ecma_deref_object (object_p);\n\n  return new_length;\n} /* ecma_delete_fast_array_properties */\n\n/**\n * Update the length of a fast access mode array to a new length\n *\n * Note: if the new length would result too much array hole in the underlying arraybuffer\n *       the array is converted back to normal property list based array\n */\nstatic void\necma_fast_array_set_length (ecma_object_t *object_p, /**< fast access mode array object */\n                            uint32_t new_length) /**< new length of the fast access mode array object*/\n{\n  JERRY_ASSERT (ecma_op_object_is_fast_array (object_p));\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n  uint32_t old_length = ext_obj_p->u.array.length;\n\n  JERRY_ASSERT (new_length >= old_length);\n\n  if (new_length == old_length)\n  {\n    return;\n  }\n\n  uint32_t old_holes = ext_obj_p->u.array.length_prop_and_hole_count;\n  uint32_t new_holes = new_length - old_length;\n\n  if (JERRY_UNLIKELY (new_holes > (ECMA_FAST_ARRAY_MAX_HOLE_COUNT - (old_holes >> ECMA_FAST_ARRAY_HOLE_SHIFT))))\n  {\n    ecma_fast_array_convert_to_normal (object_p);\n  }\n  else\n  {\n    ecma_fast_array_extend (object_p, new_length);\n  }\n} /* ecma_fast_array_set_length */\n\n/**\n * Get collection of property names of a fast access mode array object\n *\n * Note: Since the fast array object only contains indexed, enumerable, writable, configurable properties\n *       we can return a collection of non-array hole array indices\n *\n * @return collection of strings - property names\n */\necma_collection_t *\necma_fast_array_object_own_property_keys (ecma_object_t *object_p, /**< fast access mode array object */\n                                          jerry_property_filter_t filter) /**< property name filter options */\n{\n  JERRY_ASSERT (ecma_op_object_is_fast_array (object_p));\n\n  ecma_collection_t *ret_p = ecma_new_collection ();\n\n  if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES))\n  {\n    ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n    uint32_t length = ext_obj_p->u.array.length;\n\n    if (length != 0)\n    {\n      ecma_value_t *values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n\n      for (uint32_t i = 0; i < length; i++)\n      {\n        if (ecma_is_value_array_hole (values_p[i]))\n        {\n          continue;\n        }\n\n        ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (i);\n\n        ecma_collection_push_back (ret_p, ecma_make_string_value (index_str_p));\n      }\n    }\n  }\n\n  if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS))\n  {\n    ecma_collection_push_back (ret_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));\n  }\n\n  return ret_p;\n} /* ecma_fast_array_object_own_property_keys */\n\n/**\n * Array object creation with custom prototype.\n *\n * See also: ECMA-262 v6, 9.4.2.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_object_t *\necma_op_array_species_create (ecma_object_t *original_array_p, /**< The object from whom the new array object\n                                                                *   is being created */\n                              ecma_length_t length) /**< length of the array */\n{\n  ecma_value_t constructor = ECMA_VALUE_UNDEFINED;\n  ecma_value_t original_array = ecma_make_object_value (original_array_p);\n\n  ecma_value_t is_array = ecma_is_value_array (original_array);\n\n  if (ECMA_IS_VALUE_ERROR (is_array))\n  {\n    return NULL;\n  }\n\n  if (ecma_is_value_true (is_array))\n  {\n    constructor = ecma_op_object_get_by_magic_id (original_array_p, LIT_MAGIC_STRING_CONSTRUCTOR);\n    if (ECMA_IS_VALUE_ERROR (constructor))\n    {\n      return NULL;\n    }\n\n#if JERRY_BUILTIN_REALMS\n    if (ecma_is_constructor (constructor))\n    {\n      ecma_object_t *constructor_p = ecma_get_object_from_value (constructor);\n      ecma_global_object_t *global_object_p = ecma_op_function_get_function_realm (constructor_p);\n\n      if ((ecma_object_t *) global_object_p != ecma_builtin_get_global ()\n          && constructor_p == ecma_builtin_get_from_realm (global_object_p, ECMA_BUILTIN_ID_ARRAY))\n      {\n        ecma_deref_object (constructor_p);\n        constructor = ECMA_VALUE_UNDEFINED;\n      }\n    }\n#endif /* JERRY_BUILTIN_REALMS */\n\n    if (ecma_is_value_object (constructor))\n    {\n      ecma_object_t *ctor_object_p = ecma_get_object_from_value (constructor);\n      constructor = ecma_op_object_get_by_symbol_id (ctor_object_p, LIT_GLOBAL_SYMBOL_SPECIES);\n      ecma_deref_object (ctor_object_p);\n\n      if (ECMA_IS_VALUE_ERROR (constructor))\n      {\n        return NULL;\n      }\n\n      if (ecma_is_value_null (constructor))\n      {\n        constructor = ECMA_VALUE_UNDEFINED;\n      }\n    }\n  }\n\n  if (ecma_is_value_undefined (constructor))\n  {\n    return ecma_op_new_array_object_from_length (length);\n  }\n\n  if (!ecma_is_constructor (constructor))\n  {\n    ecma_free_value (constructor);\n    ecma_raise_type_error (ECMA_ERR_INVALID_SPECIES_CONSTRUCTOR);\n    return NULL;\n  }\n\n  ecma_value_t len_val = ecma_make_length_value (length);\n  ecma_object_t *ctor_object_p = ecma_get_object_from_value (constructor);\n  ecma_value_t ret_val = ecma_op_function_construct (ctor_object_p, ctor_object_p, &len_val, 1);\n\n  ecma_deref_object (ctor_object_p);\n  ecma_free_value (len_val);\n\n  if (ECMA_IS_VALUE_ERROR (ret_val))\n  {\n    return NULL;\n  }\n\n  return ecma_get_object_from_value (ret_val);\n} /* ecma_op_array_species_create */\n\n/**\n * CreateArrayIterator Abstract Operation\n *\n * See also:\n *          ECMA-262 v6, 22.1.5.1\n *\n * Referenced by:\n *          ECMA-262 v6, 22.1.3.4\n *          ECMA-262 v6, 22.1.3.13\n *          ECMA-262 v6, 22.1.3.29\n *          ECMA-262 v6, 22.1.3.30\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return array iterator object\n */\necma_value_t\necma_op_create_array_iterator (ecma_object_t *obj_p, /**< array object */\n                               ecma_iterator_kind_t kind) /**< array iterator kind */\n{\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY_ITERATOR_PROTOTYPE);\n\n  return ecma_op_create_iterator_object (ecma_make_object_value (obj_p),\n                                         prototype_obj_p,\n                                         ECMA_OBJECT_CLASS_ARRAY_ITERATOR,\n                                         kind);\n} /* ecma_op_create_array_iterator */\n\n/**\n * Low level delete of array items from new_length to old_length\n *\n * Note: new_length must be less than old_length\n *\n * @return the updated value of new_length\n */\nstatic uint32_t\necma_delete_array_properties (ecma_object_t *object_p, /**< object */\n                              uint32_t new_length, /**< new length */\n                              uint32_t old_length) /**< old length */\n{\n  JERRY_ASSERT (new_length < old_length);\n  JERRY_ASSERT (ecma_get_object_base_type (object_p) == ECMA_OBJECT_BASE_TYPE_ARRAY);\n\n  if (ecma_op_object_is_fast_array (object_p))\n  {\n    return ecma_delete_fast_array_properties (object_p, new_length);\n  }\n\n  /* First the minimum value of new_length is updated. */\n  jmem_cpointer_t current_prop_cp = object_p->u1.property_list_cp;\n\n  if (current_prop_cp == JMEM_CP_NULL)\n  {\n    return new_length;\n  }\n\n  ecma_property_header_t *current_prop_p;\n\n#if JERRY_PROPERTY_HASHMAP\n  current_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, current_prop_cp);\n\n  if (current_prop_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n  {\n    current_prop_cp = current_prop_p->next_property_cp;\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n  while (current_prop_cp != JMEM_CP_NULL)\n  {\n    current_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, current_prop_cp);\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (current_prop_p));\n\n    ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) current_prop_p;\n\n    for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      if (current_prop_p->types[i] != ECMA_PROPERTY_TYPE_DELETED\n          && !ecma_is_property_configurable (current_prop_p->types[i]))\n      {\n        uint32_t index = ecma_string_get_property_index (current_prop_p->types[i], prop_pair_p->names_cp[i]);\n\n        if (index < old_length && index >= new_length)\n        {\n          JERRY_ASSERT (index != ECMA_STRING_NOT_ARRAY_INDEX);\n\n          new_length = index + 1;\n\n          if (new_length == old_length)\n          {\n            /* Early return. */\n            return new_length;\n          }\n        }\n      }\n    }\n\n    current_prop_cp = current_prop_p->next_property_cp;\n  }\n\n  /* Second all properties between new_length and old_length are deleted. */\n  current_prop_cp = object_p->u1.property_list_cp;\n  ecma_property_header_t *prev_prop_p = NULL;\n\n#if JERRY_PROPERTY_HASHMAP\n  JERRY_ASSERT (current_prop_cp != JMEM_CP_NULL);\n\n  ecma_property_hashmap_delete_status hashmap_status = ECMA_PROPERTY_HASHMAP_DELETE_NO_HASHMAP;\n  current_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, current_prop_cp);\n\n  if (current_prop_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n  {\n    prev_prop_p = current_prop_p;\n    current_prop_cp = current_prop_p->next_property_cp;\n    hashmap_status = ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP;\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n  while (current_prop_cp != JMEM_CP_NULL)\n  {\n    current_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, current_prop_cp);\n\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (current_prop_p));\n    ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) current_prop_p;\n\n    for (uint32_t i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      if (current_prop_p->types[i] != ECMA_PROPERTY_TYPE_DELETED\n          && ecma_is_property_configurable (current_prop_p->types[i]))\n      {\n        uint32_t index = ecma_string_get_property_index (current_prop_p->types[i], prop_pair_p->names_cp[i]);\n\n        if (index < old_length && index >= new_length)\n        {\n          JERRY_ASSERT (index != ECMA_STRING_NOT_ARRAY_INDEX);\n\n#if JERRY_PROPERTY_HASHMAP\n          if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP)\n          {\n            hashmap_status =\n              ecma_property_hashmap_delete (object_p, prop_pair_p->names_cp[i], current_prop_p->types + i);\n          }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n          ecma_gc_free_property (object_p, prop_pair_p, i);\n          current_prop_p->types[i] = ECMA_PROPERTY_TYPE_DELETED;\n          prop_pair_p->names_cp[i] = LIT_INTERNAL_MAGIC_STRING_DELETED;\n        }\n      }\n    }\n\n    if (current_prop_p->types[0] == ECMA_PROPERTY_TYPE_DELETED\n        && current_prop_p->types[1] == ECMA_PROPERTY_TYPE_DELETED)\n    {\n      if (prev_prop_p == NULL)\n      {\n        object_p->u1.property_list_cp = current_prop_p->next_property_cp;\n      }\n      else\n      {\n        prev_prop_p->next_property_cp = current_prop_p->next_property_cp;\n      }\n\n      jmem_cpointer_t next_prop_cp = current_prop_p->next_property_cp;\n      ecma_dealloc_property_pair ((ecma_property_pair_t *) current_prop_p);\n      current_prop_cp = next_prop_cp;\n    }\n    else\n    {\n      prev_prop_p = current_prop_p;\n      current_prop_cp = current_prop_p->next_property_cp;\n    }\n  }\n\n#if JERRY_PROPERTY_HASHMAP\n  if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP)\n  {\n    ecma_property_hashmap_free (object_p);\n    ecma_property_hashmap_create (object_p);\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n  return new_length;\n} /* ecma_delete_array_properties */\n\n/**\n * Update the length of an array to a new length\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_array_object_set_length (ecma_object_t *object_p, /**< the array object */\n                                 ecma_value_t new_value, /**< new length value */\n                                 uint16_t flags) /**< property descriptor flags */\n{\n  ecma_number_t new_len_num;\n  ecma_value_t completion = ecma_op_to_number (new_value, &new_len_num);\n\n  if (ECMA_IS_VALUE_ERROR (completion))\n  {\n    return completion;\n  }\n\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (completion));\n\n  if (ecma_is_value_object (new_value))\n  {\n    ecma_value_t compared_num_val = ecma_op_to_number (new_value, &new_len_num);\n\n    if (ECMA_IS_VALUE_ERROR (compared_num_val))\n    {\n      return compared_num_val;\n    }\n  }\n\n  uint32_t new_len_uint32 = ecma_number_to_uint32 (new_len_num);\n\n  if (((ecma_number_t) new_len_uint32) != new_len_num)\n  {\n    return ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH);\n  }\n\n  /* Only the writable and data properties can be modified. */\n  if (flags\n      & (JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))\n  {\n    return ecma_raise_property_redefinition (ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), flags);\n  }\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n  uint32_t old_len_uint32 = ext_object_p->u.array.length;\n\n  if (new_len_num == old_len_uint32)\n  {\n    /* Only the writable flag must be updated. */\n    if (flags & JERRY_PROP_IS_WRITABLE_DEFINED)\n    {\n      if (!(flags & JERRY_PROP_IS_WRITABLE))\n      {\n        if (ecma_op_array_is_fast_array (ext_object_p))\n        {\n          ecma_fast_array_convert_to_normal (object_p);\n        }\n\n        ext_object_p->u.array.length_prop_and_hole_count &= (uint32_t) ~ECMA_PROPERTY_FLAG_WRITABLE;\n      }\n      else if (!ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count))\n      {\n        return ecma_raise_property_redefinition (ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), flags);\n      }\n    }\n    return ECMA_VALUE_TRUE;\n  }\n  else if (!ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count))\n  {\n    return ecma_raise_property_redefinition (ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), flags);\n  }\n\n  uint32_t current_len_uint32 = new_len_uint32;\n\n  if (new_len_uint32 < old_len_uint32)\n  {\n    current_len_uint32 = ecma_delete_array_properties (object_p, new_len_uint32, old_len_uint32);\n  }\n  else if (ecma_op_object_is_fast_array (object_p))\n  {\n    ecma_fast_array_set_length (object_p, new_len_uint32);\n  }\n\n  ext_object_p->u.array.length = current_len_uint32;\n\n  if ((flags & JERRY_PROP_IS_WRITABLE_DEFINED) && !(flags & JERRY_PROP_IS_WRITABLE))\n  {\n    if (ecma_op_array_is_fast_array (ext_object_p))\n    {\n      ecma_fast_array_convert_to_normal (object_p);\n    }\n\n    ext_object_p->u.array.length_prop_and_hole_count &= (uint32_t) ~ECMA_PROPERTY_FLAG_WRITABLE;\n  }\n\n  if (current_len_uint32 == new_len_uint32)\n  {\n    return ECMA_VALUE_TRUE;\n  }\n\n  return ecma_raise_property_redefinition (ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), flags);\n} /* ecma_op_array_object_set_length */\n\n/**\n * Property descriptor bitset for fast array data properties.\n * If the property desciptor fields contains all the flags below\n * attempt to stay fast access array during [[DefineOwnProperty]] operation.\n */\n#define ECMA_FAST_ARRAY_DATA_PROP_FLAGS                                                               \\\n  (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE          \\\n   | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_WRITABLE_DEFINED \\\n   | JERRY_PROP_IS_WRITABLE)\n\n/**\n * [[DefineOwnProperty]] ecma array object's operation\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *          ECMA-262 v5, 15.4.5.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_array_object_define_own_property (ecma_object_t *object_p, /**< the array object */\n                                          ecma_string_t *property_name_p, /**< property name */\n                                          const ecma_property_descriptor_t *property_desc_p) /**< property descriptor */\n{\n  if (ecma_string_is_length (property_name_p))\n  {\n    JERRY_ASSERT ((property_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED)\n                  || !(property_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE));\n    JERRY_ASSERT ((property_desc_p->flags & JERRY_PROP_IS_ENUMERABLE_DEFINED)\n                  || !(property_desc_p->flags & JERRY_PROP_IS_ENUMERABLE));\n    JERRY_ASSERT ((property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED)\n                  || !(property_desc_p->flags & JERRY_PROP_IS_WRITABLE));\n\n    if (property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n    {\n      return ecma_op_array_object_set_length (object_p, property_desc_p->value, property_desc_p->flags);\n    }\n\n    ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n    ecma_value_t length_value = ecma_make_uint32_value (ext_object_p->u.array.length);\n\n    ecma_value_t result = ecma_op_array_object_set_length (object_p, length_value, property_desc_p->flags);\n\n    ecma_fast_free_value (length_value);\n    return result;\n  }\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n  if (ecma_op_object_is_fast_array (object_p))\n  {\n    if ((property_desc_p->flags & ECMA_FAST_ARRAY_DATA_PROP_FLAGS) == ECMA_FAST_ARRAY_DATA_PROP_FLAGS)\n    {\n      uint32_t index = ecma_string_get_array_index (property_name_p);\n\n      if (JERRY_UNLIKELY (index == ECMA_STRING_NOT_ARRAY_INDEX))\n      {\n        ecma_fast_array_convert_to_normal (object_p);\n      }\n      else if (ecma_fast_array_set_property (object_p, index, property_desc_p->value))\n      {\n        return ECMA_VALUE_TRUE;\n      }\n\n      JERRY_ASSERT (!ecma_op_array_is_fast_array (ext_object_p));\n    }\n    else\n    {\n      ecma_fast_array_convert_to_normal (object_p);\n    }\n  }\n\n  JERRY_ASSERT (!ecma_op_object_is_fast_array (object_p));\n  uint32_t index = ecma_string_get_array_index (property_name_p);\n\n  if (index == ECMA_STRING_NOT_ARRAY_INDEX)\n  {\n    return ecma_op_general_object_define_own_property (object_p, property_name_p, property_desc_p);\n  }\n\n  bool update_length = (index >= ext_object_p->u.array.length);\n\n  if (update_length && !ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count))\n  {\n    return ecma_raise_property_redefinition (property_name_p, property_desc_p->flags);\n  }\n\n  ecma_property_descriptor_t prop_desc;\n\n  prop_desc = *property_desc_p;\n  prop_desc.flags &= (uint16_t) ~JERRY_PROP_SHOULD_THROW;\n\n  ecma_value_t completition = ecma_op_general_object_define_own_property (object_p, property_name_p, &prop_desc);\n  JERRY_ASSERT (ecma_is_value_boolean (completition));\n\n  if (ecma_is_value_false (completition))\n  {\n    return ecma_raise_property_redefinition (property_name_p, property_desc_p->flags);\n  }\n\n  if (update_length)\n  {\n    ext_object_p->u.array.length = index + 1;\n  }\n\n  return ECMA_VALUE_TRUE;\n} /* ecma_op_array_object_define_own_property */\n\n/**\n * Get the length of the an array object\n *\n * @return the array length\n */\nextern inline uint32_t JERRY_ATTR_ALWAYS_INLINE\necma_array_get_length (ecma_object_t *array_p) /**< array object */\n{\n  JERRY_ASSERT (ecma_get_object_base_type (array_p) == ECMA_OBJECT_BASE_TYPE_ARRAY);\n\n  return ((ecma_extended_object_t *) array_p)->u.array.length;\n} /* ecma_array_get_length */\n\n/**\n * The Array.prototype and %TypedArray%.prototype objects' 'toString' routine.\n *\n * See also:\n *          ECMA-262 v5, 15.4.4.2\n *          ECMA-262 v6, 22.1.3.7\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_array_object_to_string (ecma_value_t this_arg) /**< this argument */\n{\n  JERRY_ASSERT (ecma_is_value_object (this_arg));\n\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);\n\n  /* 2. */\n  ecma_value_t join_value = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_JOIN);\n  if (ECMA_IS_VALUE_ERROR (join_value))\n  {\n    return join_value;\n  }\n\n  if (!ecma_op_is_callable (join_value))\n  {\n    /* 3. */\n    ret_value = ecma_builtin_helper_object_to_string (this_arg);\n  }\n  else\n  {\n    /* 4. */\n    ecma_object_t *join_func_obj_p = ecma_get_object_from_value (join_value);\n\n    ret_value = ecma_op_function_call (join_func_obj_p, this_arg, NULL, 0);\n  }\n\n  ecma_free_value (join_value);\n\n  return ret_value;\n} /* ecma_array_object_to_string */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-array-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_ARRAY_OBJECT_H\n#define ECMA_ARRAY_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaarrayobject ECMA Array object related routines\n * @{\n */\n\n/**\n * Attributes of fast access mode arrays:\n *\n * - The internal property is replaced with a buffer which directly stores the values\n * - Whenever any operation would change the following attributes of the array it should be converted back to normal\n *  - All properties must be enumerable configurable writable data properties\n *  - The prototype must be Array.prototype\n *  - [[Extensible]] internal property must be true\n *  - 'length' property of the array must be writable\n *\n * - The conversion is also required when a property is set if:\n *  - The property name is not an array index\n *  - The new hole count of the array would reach ECMA_FAST_ARRAY_MAX_NEW_HOLES_COUNT\n */\n\n/**\n * Maximum number of new array holes in a fast mode access array.\n * If the number of new holes exceeds this limit, the array is converted back\n * to normal property list based array.\n */\n#define ECMA_FAST_ARRAY_MAX_NEW_HOLES_COUNT 32\n\n/**\n * Bitshift index for fast array hole count representation\n */\n#define ECMA_FAST_ARRAY_HOLE_SHIFT 8\n\n/**\n * This number represents 1 array hole in underlying buffer of a fast acces mode array\n */\n#define ECMA_FAST_ARRAY_HOLE_ONE (1 << ECMA_FAST_ARRAY_HOLE_SHIFT)\n\n/**\n * Maximum number of array holes in a fast access mode array\n */\n#define ECMA_FAST_ARRAY_MAX_HOLE_COUNT (1 << 16)\n\necma_object_t *ecma_op_new_array_object (uint32_t length);\n\necma_object_t *ecma_op_new_array_object_from_length (ecma_length_t length);\n\necma_value_t ecma_op_new_array_object_from_buffer (const ecma_value_t *args_p, uint32_t length);\n\necma_value_t ecma_op_new_array_object_from_collection (ecma_collection_t *collection_p, bool unref_objects);\n\nbool ecma_op_object_is_fast_array (ecma_object_t *object_p);\n\nbool ecma_op_array_is_fast_array (ecma_extended_object_t *array_p);\n\nuint32_t ecma_fast_array_get_hole_count (ecma_object_t *obj_p);\n\necma_value_t *ecma_fast_array_extend (ecma_object_t *object_p, uint32_t new_lengt);\n\nbool ecma_fast_array_set_property (ecma_object_t *object_p, uint32_t index, ecma_value_t value);\n\nbool ecma_array_object_delete_property (ecma_object_t *object_p, ecma_string_t *property_name_p);\n\nuint32_t ecma_delete_fast_array_properties (ecma_object_t *object_p, uint32_t new_length);\n\necma_collection_t *ecma_fast_array_object_own_property_keys (ecma_object_t *object_p, jerry_property_filter_t filter);\n\nvoid ecma_fast_array_convert_to_normal (ecma_object_t *object_p);\n\necma_object_t *ecma_op_array_species_create (ecma_object_t *original_array_p, ecma_length_t length);\n\necma_value_t ecma_op_create_array_iterator (ecma_object_t *obj_p, ecma_iterator_kind_t kind);\n\necma_value_t ecma_op_array_object_set_length (ecma_object_t *object_p, ecma_value_t new_value, uint16_t flags);\n\necma_value_t ecma_op_array_object_define_own_property (ecma_object_t *object_p,\n                                                       ecma_string_t *property_name_p,\n                                                       const ecma_property_descriptor_t *property_desc_p);\n\nuint32_t ecma_array_get_length (ecma_object_t *array_p);\n\necma_value_t ecma_array_object_to_string (ecma_value_t this_arg);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_ARRAY_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-arraybuffer-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-arraybuffer-object.h\"\n\n#include \"ecma-bigint.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-shared-arraybuffer-object.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n#include \"opcodes.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaarraybufferobject ECMA ArrayBuffer object related routines\n * @{\n */\n\n/**\n * Creating ArrayBuffer objects with a buffer after the arraybuffer header\n *\n * @return new ArrayBuffer object\n */\necma_object_t *\necma_arraybuffer_create_object (uint8_t type, /**< type of the arraybuffer */\n                                uint32_t length) /**< length of the arraybuffer */\n{\n  ecma_builtin_id_t prototype_id;\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n  JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER || type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER);\n\n  prototype_id = (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER ? ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE\n                                                         : ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE);\n#else /* !JERRY_BUILTIN_SHAREDARRAYBUFFER */\n  JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER);\n\n  prototype_id = ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE;\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n\n  ecma_object_t *object_p = ecma_create_object (ecma_builtin_get (prototype_id),\n                                                sizeof (ecma_extended_object_t) + length,\n                                                ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.type = type;\n  ext_object_p->u.cls.u1.array_buffer_flags = ECMA_ARRAYBUFFER_ALLOCATED;\n  ext_object_p->u.cls.u3.length = length;\n\n  memset ((uint8_t *) (ext_object_p + 1), 0, length);\n  return object_p;\n} /* ecma_arraybuffer_create_object */\n\n/**\n * Creating ArrayBuffer objects with a pointer to its buffer\n *\n * @return new ArrayBuffer object\n */\necma_object_t *\necma_arraybuffer_create_object_with_buffer (uint8_t type, /**< type of the arraybuffer */\n                                            uint32_t length)\n{\n  ecma_builtin_id_t prototype_id;\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n  JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER || type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER);\n\n  prototype_id = (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER ? ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE\n                                                         : ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE);\n#else /* !JERRY_BUILTIN_SHAREDARRAYBUFFER */\n  JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER);\n\n  prototype_id = ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE;\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n\n  ecma_object_t *object_p =\n    ecma_create_object (ecma_builtin_get (prototype_id), sizeof (ecma_arraybuffer_pointer_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_arraybuffer_pointer_t *arraybuffer_pointer_p = (ecma_arraybuffer_pointer_t *) object_p;\n  arraybuffer_pointer_p->extended_object.u.cls.type = type;\n  arraybuffer_pointer_p->extended_object.u.cls.u1.array_buffer_flags = ECMA_ARRAYBUFFER_HAS_POINTER;\n  arraybuffer_pointer_p->extended_object.u.cls.u3.length = length;\n\n  arraybuffer_pointer_p->buffer_p = NULL;\n  arraybuffer_pointer_p->arraybuffer_user_p = NULL;\n\n  return object_p;\n} /* ecma_arraybuffer_create_object_with_buffer */\n\n/**\n * Creating ArrayBuffer objects based on the array length\n *\n * @return new ArrayBuffer object\n */\necma_object_t *\necma_arraybuffer_new_object (uint32_t length) /**< length of the arraybuffer */\n{\n  if (length > JERRY_CONTEXT (arraybuffer_compact_allocation_limit))\n  {\n    return ecma_arraybuffer_create_object_with_buffer (ECMA_OBJECT_CLASS_ARRAY_BUFFER, length);\n  }\n\n  return ecma_arraybuffer_create_object (ECMA_OBJECT_CLASS_ARRAY_BUFFER, length);\n} /* ecma_arraybuffer_new_object */\n\n/**\n * Allocate a backing store for an array buffer.\n *\n * @return buffer pointer on success,\n *         NULL otherwise\n */\necma_value_t\necma_arraybuffer_allocate_buffer (ecma_object_t *arraybuffer_p) /**< ArrayBuffer object */\n{\n  JERRY_ASSERT (!(ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_ALLOCATED));\n\n  ecma_extended_object_t *extended_object_p = (ecma_extended_object_t *) arraybuffer_p;\n\n  if (ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_DETACHED)\n  {\n    extended_object_p->u.cls.u1.array_buffer_flags |= ECMA_ARRAYBUFFER_ALLOCATED;\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  uint32_t arraybuffer_length = extended_object_p->u.cls.u3.length;\n  ecma_arraybuffer_pointer_t *arraybuffer_pointer_p = (ecma_arraybuffer_pointer_t *) arraybuffer_p;\n  jerry_arraybuffer_allocate_cb_t arraybuffer_allocate_callback = JERRY_CONTEXT (arraybuffer_allocate_callback);\n  uint8_t *buffer_p;\n\n  if (arraybuffer_allocate_callback != NULL)\n  {\n    jerry_arraybuffer_type_t type = JERRY_ARRAYBUFFER_TYPE_ARRAYBUFFER;\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n    if (extended_object_p->u.cls.type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER)\n    {\n      type = JERRY_ARRAYBUFFER_TYPE_SHARED_ARRAYBUFFER;\n    }\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n\n    buffer_p = arraybuffer_allocate_callback (type,\n                                              arraybuffer_length,\n                                              &arraybuffer_pointer_p->arraybuffer_user_p,\n                                              JERRY_CONTEXT (arraybuffer_allocate_callback_user_p));\n  }\n  else\n  {\n    buffer_p = (uint8_t *) jmem_heap_alloc_block_null_on_error (arraybuffer_length);\n  }\n\n  if (buffer_p == NULL)\n  {\n    return ecma_raise_range_error (ECMA_ERR_ALLOCATE_ARRAY_BUFFER);\n  }\n\n  arraybuffer_pointer_p->buffer_p = buffer_p;\n  extended_object_p->u.cls.u1.array_buffer_flags |= ECMA_ARRAYBUFFER_ALLOCATED;\n\n  memset (buffer_p, 0, arraybuffer_length);\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_arraybuffer_allocate_buffer */\n\n/**\n * Allocate a backing store for an array buffer, throws an error if the allocation fails.\n *\n * @return ECMA_VALUE_UNDEFINED on success,\n *         ECMA_VALUE_ERROR otherwise\n */\nextern inline ecma_value_t\necma_arraybuffer_allocate_buffer_throw (ecma_object_t *arraybuffer_p)\n{\n  JERRY_ASSERT (!(ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_ALLOCATED));\n\n  return ecma_arraybuffer_allocate_buffer (arraybuffer_p);\n} /* ecma_arraybuffer_allocate_buffer_throw */\n\n/**\n * Release the backing store allocated by an array buffer.\n */\nvoid\necma_arraybuffer_release_buffer (ecma_object_t *arraybuffer_p) /**< ArrayBuffer object */\n{\n  JERRY_ASSERT (ecma_object_class_is (arraybuffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)\n                || ecma_object_is_shared_arraybuffer (arraybuffer_p));\n\n  jerry_arraybuffer_free_cb_t free_callback = JERRY_CONTEXT (arraybuffer_free_callback);\n  ecma_arraybuffer_pointer_t *arraybuffer_pointer_p = (ecma_arraybuffer_pointer_t *) arraybuffer_p;\n\n  if (arraybuffer_pointer_p->buffer_p == NULL)\n  {\n    return;\n  }\n\n  uint32_t arraybuffer_length = arraybuffer_pointer_p->extended_object.u.cls.u3.length;\n\n  if (free_callback == NULL)\n  {\n    jmem_heap_free_block (arraybuffer_pointer_p->buffer_p, arraybuffer_length);\n    return;\n  }\n\n  jerry_arraybuffer_type_t type = JERRY_ARRAYBUFFER_TYPE_ARRAYBUFFER;\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n  if (arraybuffer_pointer_p->extended_object.u.cls.type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER)\n  {\n    type = JERRY_ARRAYBUFFER_TYPE_SHARED_ARRAYBUFFER;\n  }\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n\n  free_callback (type,\n                 arraybuffer_pointer_p->buffer_p,\n                 arraybuffer_length,\n                 arraybuffer_pointer_p->arraybuffer_user_p,\n                 JERRY_CONTEXT (arraybuffer_allocate_callback_user_p));\n} /* ecma_arraybuffer_release_buffer */\n\n/**\n * ArrayBuffer object creation operation.\n *\n * See also: ES2015 24.1.1.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_create_arraybuffer_object (const ecma_value_t *arguments_list_p, /**< list of arguments that\n                                                                          *   are passed to String constructor */\n                                   uint32_t arguments_list_len) /**< length of the arguments' list */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),\n                                                                   ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE);\n\n  if (proto_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_number_t length_num = 0;\n\n  if (arguments_list_len > 0)\n  {\n    if (ecma_is_value_number (arguments_list_p[0]))\n    {\n      length_num = ecma_get_number_from_value (arguments_list_p[0]);\n    }\n    else\n    {\n      ecma_value_t to_number_value = ecma_op_to_number (arguments_list_p[0], &length_num);\n\n      if (ECMA_IS_VALUE_ERROR (to_number_value))\n      {\n        ecma_deref_object (proto_p);\n        return to_number_value;\n      }\n    }\n\n    if (ecma_number_is_nan (length_num))\n    {\n      length_num = 0;\n    }\n\n    const uint32_t maximum_size_in_byte = UINT32_MAX - sizeof (ecma_extended_object_t) - JMEM_ALIGNMENT + 1;\n\n    if (length_num <= -1.0 || length_num > (ecma_number_t) maximum_size_in_byte + 0.5)\n    {\n      ecma_deref_object (proto_p);\n      return ecma_raise_range_error (ECMA_ERR_INVALID_ARRAYBUFFER_LENGTH);\n    }\n  }\n\n  uint32_t length_uint32 = ecma_number_to_uint32 (length_num);\n\n  ecma_object_t *array_buffer = ecma_arraybuffer_new_object (length_uint32);\n  ECMA_SET_NON_NULL_POINTER (array_buffer->u2.prototype_cp, proto_p);\n  ecma_deref_object (proto_p);\n\n  return ecma_make_object_value (array_buffer);\n} /* ecma_op_create_arraybuffer_object */\n\n/**\n * Helper function: check if the target is ArrayBuffer\n *\n *\n * See also: ES2015 24.1.1.4\n *\n * @return true - if value is an ArrayBuffer object\n *         false - otherwise\n */\nbool\necma_is_arraybuffer (ecma_value_t target) /**< the target value */\n{\n  return (ecma_is_value_object (target)\n          && ecma_object_class_is (ecma_get_object_from_value (target), ECMA_OBJECT_CLASS_ARRAY_BUFFER));\n} /* ecma_is_arraybuffer */\n\n/**\n * Helper function: return the length of the buffer inside the arraybuffer object\n *\n * @return uint32_t, the length of the arraybuffer\n */\nuint32_t JERRY_ATTR_PURE\necma_arraybuffer_get_length (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */\n{\n  JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)\n                || ecma_object_is_shared_arraybuffer (object_p));\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  return ecma_arraybuffer_is_detached (object_p) ? 0 : ext_object_p->u.cls.u3.length;\n} /* ecma_arraybuffer_get_length */\n\n/**\n * Helper function: return the pointer to the data buffer inside the arraybuffer object\n *\n * @return pointer to the data buffer\n */\nextern inline uint8_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_arraybuffer_get_buffer (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */\n{\n  JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)\n                || ecma_object_is_shared_arraybuffer (object_p));\n\n  if (!(ECMA_ARRAYBUFFER_GET_FLAGS (object_p) & ECMA_ARRAYBUFFER_HAS_POINTER))\n  {\n    return (uint8_t *) object_p + sizeof (ecma_extended_object_t);\n  }\n\n  ecma_arraybuffer_pointer_t *arraybuffer_pointer_p = (ecma_arraybuffer_pointer_t *) object_p;\n  return (uint8_t *) arraybuffer_pointer_p->buffer_p;\n} /* ecma_arraybuffer_get_buffer */\n\n/**\n * Helper function: check if the target ArrayBuffer is detached\n *\n * @return true - if value is an detached ArrayBuffer object\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\necma_arraybuffer_is_detached (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */\n{\n  JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)\n                || ecma_object_is_shared_arraybuffer (object_p));\n\n  return (ECMA_ARRAYBUFFER_GET_FLAGS (object_p) & ECMA_ARRAYBUFFER_DETACHED) != 0;\n} /* ecma_arraybuffer_is_detached */\n\n/**\n * ArrayBuffer object detaching operation\n *\n * See also: ES2015 24.1.1.3\n *\n * @return true - if detach operation is succeeded\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_arraybuffer_detach (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */\n{\n  JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER));\n\n  if (ECMA_ARRAYBUFFER_GET_FLAGS (object_p) & ECMA_ARRAYBUFFER_DETACHED)\n  {\n    return false;\n  }\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.u1.array_buffer_flags |= ECMA_ARRAYBUFFER_DETACHED;\n\n  if (!(ECMA_ARRAYBUFFER_GET_FLAGS (object_p) & ECMA_ARRAYBUFFER_ALLOCATED))\n  {\n    return true;\n  }\n\n  ext_object_p->u.cls.u1.array_buffer_flags &= (uint8_t) ~ECMA_ARRAYBUFFER_ALLOCATED;\n\n  if (!(ECMA_ARRAYBUFFER_GET_FLAGS (object_p) & ECMA_ARRAYBUFFER_HAS_POINTER))\n  {\n    return true;\n  }\n\n  ecma_arraybuffer_release_buffer (object_p);\n  return true;\n} /* ecma_arraybuffer_detach */\n\n/**\n * ArrayBuffer slice operation\n *\n * See also:\n *          ECMA-262 v11, 24.1.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_arraybuffer_slice (ecma_value_t this_arg, const ecma_value_t *argument_list_p, uint32_t arguments_number)\n{\n  ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n  /* 3-4. */\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (object_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (object_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  /* 5. */\n  uint32_t len = ecma_arraybuffer_get_length (object_p);\n\n  uint32_t start = 0;\n  uint32_t end = len;\n\n  if (arguments_number > 0)\n  {\n    /* 6-7. */\n    if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[0], len, &start)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    if (arguments_number > 1 && !ecma_is_value_undefined (argument_list_p[1]))\n    {\n      /* 8-9. */\n      if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[1], len, &end)))\n      {\n        return ECMA_VALUE_ERROR;\n      }\n    }\n  }\n\n  /* 10. */\n  uint32_t new_len = (end >= start) ? (end - start) : 0;\n\n  /* 11. */\n  ecma_builtin_id_t buffer_builtin_id = ECMA_BUILTIN_ID_ARRAYBUFFER;\n\n  if (ecma_is_shared_arraybuffer (this_arg))\n  {\n    buffer_builtin_id = ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER;\n  }\n\n  ecma_value_t ctor = ecma_op_species_constructor (object_p, buffer_builtin_id);\n\n  if (ECMA_IS_VALUE_ERROR (ctor))\n  {\n    return ctor;\n  }\n\n  /* 12. */\n  ecma_object_t *ctor_obj_p = ecma_get_object_from_value (ctor);\n  ecma_value_t new_len_value = ecma_make_uint32_value (new_len);\n\n  ecma_value_t new_arraybuffer = ecma_op_function_construct (ctor_obj_p, ctor_obj_p, &new_len_value, 1);\n\n  ecma_deref_object (ctor_obj_p);\n  ecma_free_value (new_len_value);\n\n  if (ECMA_IS_VALUE_ERROR (new_arraybuffer))\n  {\n    return new_arraybuffer;\n  }\n\n  ecma_object_t *new_arraybuffer_p = ecma_get_object_from_value (new_arraybuffer);\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  /* 13. */\n  if (!(ecma_object_class_is (new_arraybuffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)\n        || ecma_object_is_shared_arraybuffer (new_arraybuffer_p)))\n  {\n    ret_value = ecma_raise_type_error (ECMA_ERR_RETURN_VALUE_IS_NOT_AN_ARRAYBUFFER_OBJECT);\n    goto free_new_arraybuffer;\n  }\n\n  /* 14-15. */\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (new_arraybuffer_p))\n  {\n    ret_value = ECMA_VALUE_ERROR;\n    goto free_new_arraybuffer;\n  }\n\n  if (ecma_arraybuffer_is_detached (new_arraybuffer_p))\n  {\n    ret_value = ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n    goto free_new_arraybuffer;\n  }\n\n  /* 16. */\n  if (new_arraybuffer == this_arg)\n  {\n    ret_value = ecma_raise_type_error (ECMA_ERR_ARRAY_BUFFER_RETURNED_THIS_FROM_CONSTRUCTOR);\n    goto free_new_arraybuffer;\n  }\n\n  /* 17. */\n  if (ecma_arraybuffer_get_length (new_arraybuffer_p) < new_len)\n  {\n    ret_value = ecma_raise_type_error (ECMA_ERR_DERIVED_ARRAY_BUFFER_CTOR_BUFFER_TOO_SMALL);\n    goto free_new_arraybuffer;\n  }\n\n  /* 19. */\n  if (ecma_arraybuffer_is_detached (object_p))\n  {\n    ret_value = ECMA_VALUE_ERROR;\n    goto free_new_arraybuffer;\n  }\n\n  /* 20. */\n  lit_utf8_byte_t *old_buf = ecma_arraybuffer_get_buffer (object_p);\n\n  /* 21. */\n  lit_utf8_byte_t *new_buf = ecma_arraybuffer_get_buffer (new_arraybuffer_p);\n\n  /* 22. */\n  memcpy (new_buf, old_buf + start, new_len);\n\nfree_new_arraybuffer:\n  if (ret_value != ECMA_VALUE_EMPTY)\n  {\n    ecma_deref_object (new_arraybuffer_p);\n  }\n  else\n  {\n    /* 23. */\n    ret_value = ecma_make_object_value (new_arraybuffer_p);\n  }\n\n  return ret_value;\n} /* ecma_builtin_arraybuffer_slice */\n\n/**\n * Apply atomics operation on numbers.\n *\n * Note: ECMA_ATOMICS_COMPAREEXCHANGE is not handled here.\n *\n * @return ecma value\n */\nstatic ecma_value_t\necma_atomics_operation_on_number (ecma_value_t stored_value, /**< stored value */\n                                  ecma_value_t val, /**< value to operate with */\n                                  ecma_atomics_op_t op) /**< operation */\n{\n  ecma_number_t result = ecma_get_number_from_value (stored_value);\n\n  switch (op)\n  {\n    case ECMA_ATOMICS_ADD:\n    {\n      result += ecma_get_number_from_value (val);\n      break;\n    }\n    case ECMA_ATOMICS_EXCHANGE:\n    {\n      result = ecma_get_number_from_value (val);\n      break;\n    }\n    case ECMA_ATOMICS_SUBTRACT:\n    {\n      result -= ecma_get_number_from_value (val);\n      break;\n    }\n    default:\n    {\n      JERRY_STATIC_ASSERT (\n        (number_bitwise_logic_op) ECMA_ATOMICS_AND == NUMBER_BITWISE_LOGIC_AND,\n        logical_operations_must_be_on_the_same_index_in_ecma_atomics_op_t_and_number_bitwise_logic_op);\n      JERRY_STATIC_ASSERT (\n        (number_bitwise_logic_op) ECMA_ATOMICS_OR == NUMBER_BITWISE_LOGIC_OR,\n        logical_operations_must_be_on_the_same_index_in_ecma_atomics_op_t_and_number_bitwise_logic_op);\n      JERRY_STATIC_ASSERT (\n        (number_bitwise_logic_op) ECMA_ATOMICS_XOR == NUMBER_BITWISE_LOGIC_XOR,\n        logical_operations_must_be_on_the_same_index_in_ecma_atomics_op_t_and_number_bitwise_logic_op);\n\n      return do_number_bitwise_logic ((number_bitwise_logic_op) (op), stored_value, val);\n    }\n  }\n\n  return ecma_make_number_value (result);\n} /* ecma_atomics_operation_on_number */\n\n#if JERRY_BUILTIN_BIGINT\n/**\n * Apply atomics operation on numbers.\n *\n * Note: ECMA_ATOMICS_COMPAREEXCHANGE is not handled here.\n *\n * @return ecma value\n */\nstatic ecma_value_t\necma_atomics_operation_on_bigint (ecma_value_t stored_value, ecma_value_t val, ecma_atomics_op_t op)\n{\n  switch (op)\n  {\n    case ECMA_ATOMICS_ADD:\n    {\n      return ecma_bigint_add_sub (stored_value, val, true);\n    }\n    case ECMA_ATOMICS_AND:\n    {\n      return ecma_bigint_and (stored_value, val);\n    }\n    case ECMA_ATOMICS_EXCHANGE:\n    {\n      return ecma_copy_value (val);\n    }\n    case ECMA_ATOMICS_OR:\n    {\n      return ecma_bigint_or (stored_value, val);\n    }\n    case ECMA_ATOMICS_SUBTRACT:\n    {\n      return ecma_bigint_add_sub (stored_value, val, false);\n    }\n    default:\n    {\n      JERRY_ASSERT (op == ECMA_ATOMICS_XOR);\n\n      return ecma_bigint_xor (stored_value, val);\n    }\n  }\n} /* ecma_atomics_operation_on_bigint */\n#endif /* JERRY_BUILTIN_BIGINT */\n/**\n * ArrayBuffer get, modify, set value in buffer\n *\n * See also: ES12 25.1.2.13\n * @return ecma value\n */\necma_value_t\necma_arraybuffer_get_modify_set_value_in_buffer (\n  ecma_value_t buffer, /**< arrayBuffer */\n  uint32_t indexed_position, /**< position of the element in buffer */\n  ecma_value_t val, /**< parameter of op, number or bigint */\n  ecma_atomics_op_t op, /**< the atomics operation to execute */\n  ecma_typedarray_type_t element_type, /**< type of the elements stored in typedArray */\n  ecma_typedarray_getter_fn_t typedarray_getter_cb, /**< getter callback of typedArray */\n  ecma_typedarray_setter_fn_t typedarray_setter_cb) /**< setter callback of typedArray */\n{\n#if !JERRY_BUILTIN_BIGINT\n  JERRY_UNUSED (element_type);\n#endif /* !JERRY_BUILTIN_BIGINT */\n\n  /* 1. */\n  JERRY_ASSERT (!ecma_arraybuffer_is_detached (ecma_get_object_from_value (buffer)));\n\n  /* 3. */\n  JERRY_ASSERT (ecma_is_value_number (val) || ecma_is_value_bigint (val));\n\n  ecma_object_t *buffer_obj_p = ecma_get_object_from_value (buffer);\n  lit_utf8_byte_t *pos = ecma_arraybuffer_get_buffer (buffer_obj_p) + indexed_position;\n  ecma_value_t stored_value = typedarray_getter_cb (pos);\n  ecma_value_t op_result;\n\n#if JERRY_BUILTIN_BIGINT\n  if (ECMA_TYPEDARRAY_IS_BIGINT_TYPE (element_type))\n  {\n    op_result = ecma_atomics_operation_on_bigint (stored_value, val, op);\n  }\n  else\n#endif /* JERRY_BUILTIN_BIGINT */\n  {\n    op_result = ecma_atomics_operation_on_number (stored_value, val, op);\n  }\n\n  ecma_free_value (val);\n\n  if (ECMA_IS_VALUE_ERROR (op_result))\n  {\n    return op_result;\n  }\n\n  // TODO: Handle shared array buffers differently.\n  typedarray_setter_cb (pos, op_result);\n  ecma_free_value (op_result);\n\n  return stored_value;\n} /* ecma_arraybuffer_get_modify_set_value_in_buffer */\n\n/**\n * @}\n * @}\n */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-arraybuffer-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_ARRAYBUFFER_OBJECT_H\n#define ECMA_ARRAYBUFFER_OBJECT_H\n\n#include \"ecma-atomics-object.h\"\n#include \"ecma-globals.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaarraybufferobject ECMA ArrayBuffer object related routines\n * @{\n */\n\n/**\n * Get array buffer flags.\n */\n#define ECMA_ARRAYBUFFER_GET_FLAGS(arraybuffer_p) \\\n  (((ecma_extended_object_t *) (arraybuffer_p))->u.cls.u1.array_buffer_flags)\n\n/**\n * Check whether the backing store is allocated for an array buffer.\n */\n#define ECMA_ARRAYBUFFER_LAZY_ALLOC(arraybuffer_p)                                             \\\n  (JERRY_UNLIKELY (!(ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_ALLOCATED)) \\\n   && ecma_arraybuffer_allocate_buffer_throw (arraybuffer_p) == ECMA_VALUE_ERROR)\n\necma_value_t ecma_op_create_arraybuffer_object (const ecma_value_t *, uint32_t);\n\n/**\n * Helper functions for arraybuffer.\n */\necma_object_t *ecma_arraybuffer_create_object (uint8_t type, uint32_t length);\necma_object_t *ecma_arraybuffer_create_object_with_buffer (uint8_t type, uint32_t length);\necma_object_t *ecma_arraybuffer_new_object (uint32_t length);\necma_value_t ecma_arraybuffer_allocate_buffer (ecma_object_t *arraybuffer_p);\necma_value_t ecma_arraybuffer_allocate_buffer_throw (ecma_object_t *arraybuffer_p);\nvoid ecma_arraybuffer_release_buffer (ecma_object_t *arraybuffer_p);\nuint8_t *JERRY_ATTR_PURE ecma_arraybuffer_get_buffer (ecma_object_t *obj_p);\nuint32_t JERRY_ATTR_PURE ecma_arraybuffer_get_length (ecma_object_t *obj_p);\nbool JERRY_ATTR_PURE ecma_arraybuffer_is_detached (ecma_object_t *obj_p);\nbool ecma_arraybuffer_detach (ecma_object_t *obj_p);\nbool ecma_is_arraybuffer (ecma_value_t val);\necma_value_t\necma_builtin_arraybuffer_slice (ecma_value_t this_arg, const ecma_value_t *argument_list_p, uint32_t arguments_number);\necma_value_t ecma_arraybuffer_get_modify_set_value_in_buffer (ecma_value_t buffer,\n                                                              uint32_t indexed_position,\n                                                              ecma_value_t val,\n                                                              ecma_atomics_op_t op,\n                                                              ecma_typedarray_type_t element_type,\n                                                              ecma_typedarray_getter_fn_t typedarray_getter_cb,\n                                                              ecma_typedarray_setter_fn_t typedarray_setter_cb);\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#endif /* !ECMA_ARRAYBUFFER_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-async-generator-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-async-generator-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-errors.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-promise-object.h\"\n\n#include \"jcontext.h\"\n#include \"opcodes.h\"\n#include \"vm-stack.h\"\n#include \"vm.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaasyncgeneratorobject ECMA AsyncGenerator object related routines\n * @{\n */\n\n/**\n * Enqueue a task into the command queue of an async generator\n *\n * @return ecma Promise value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_async_generator_enqueue (vm_executable_object_t *async_generator_object_p, /**< async generator */\n                              ecma_async_generator_operation_type_t operation, /**< operation */\n                              ecma_value_t value) /**< value argument of operation */\n{\n  ecma_async_generator_task_t *task_p = jmem_heap_alloc_block (sizeof (ecma_async_generator_task_t));\n\n  ECMA_SET_INTERNAL_VALUE_ANY_POINTER (task_p->next, NULL);\n  task_p->operation_value = ecma_copy_value_if_not_object (value);\n  task_p->operation_type = (uint8_t) operation;\n\n  ecma_value_t result = ecma_op_create_promise_object (ECMA_VALUE_EMPTY, ECMA_VALUE_UNDEFINED, NULL);\n  task_p->promise = result;\n\n  ecma_value_t head = async_generator_object_p->extended_object.u.cls.u3.head;\n\n  if (ECMA_IS_INTERNAL_VALUE_NULL (head))\n  {\n    ECMA_SET_INTERNAL_VALUE_POINTER (async_generator_object_p->extended_object.u.cls.u3.head, task_p);\n\n    if (async_generator_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_ASYNC_GENERATOR_CALLED)\n    {\n      ecma_value_t executable_object = ecma_make_object_value ((ecma_object_t *) async_generator_object_p);\n      ecma_enqueue_promise_async_generator_job (executable_object);\n      return result;\n    }\n\n    async_generator_object_p->extended_object.u.cls.u2.executable_obj_flags |= ECMA_ASYNC_GENERATOR_CALLED;\n    ecma_async_generator_run (async_generator_object_p);\n    return result;\n  }\n\n  /* Append the new task at the end. */\n  ecma_async_generator_task_t *prev_task_p;\n  prev_task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t, head);\n\n  while (!ECMA_IS_INTERNAL_VALUE_NULL (prev_task_p->next))\n  {\n    prev_task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t, prev_task_p->next);\n  }\n\n  ECMA_SET_INTERNAL_VALUE_POINTER (prev_task_p->next, task_p);\n  return result;\n} /* ecma_async_generator_enqueue */\n\n/**\n * Call a function and await its return value\n *\n * @return ECMA_VALUE_UNDEFINED on success, error otherwise\n */\nstatic ecma_value_t\necma_async_yield_call (ecma_value_t function, /**< function (takes reference) */\n                       vm_executable_object_t *async_generator_object_p, /**< async generator */\n                       ecma_value_t argument) /**< argument passed to the function */\n{\n  ecma_value_t iterator = async_generator_object_p->iterator;\n  ecma_value_t result;\n\n  if (argument == ECMA_VALUE_EMPTY)\n  {\n    result = ecma_op_function_validated_call (function, iterator, NULL, 0);\n  }\n  else\n  {\n    result = ecma_op_function_validated_call (function, iterator, &argument, 1);\n  }\n\n  ecma_free_value (function);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  return ecma_promise_async_await ((ecma_extended_object_t *) async_generator_object_p, result);\n} /* ecma_async_yield_call */\n\n/**\n * Perform an exception throw and call the approprite handler\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< async generator */\n                        ecma_value_t value) /**< thrown value */\n{\n  ecma_object_t *obj_p = ecma_get_object_from_value (async_generator_object_p->iterator);\n  ecma_value_t result = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_THROW);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  if (result == ECMA_VALUE_UNDEFINED)\n  {\n    result = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_RETURN);\n\n    if (result == ECMA_VALUE_UNDEFINED)\n    {\n      return ecma_raise_type_error (ECMA_ERR_ITERATOR_THROW_IS_NOT_AVAILABLE);\n    }\n\n    result = ecma_async_yield_call (result, async_generator_object_p, ECMA_VALUE_EMPTY);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      return result;\n    }\n\n    ECMA_AWAIT_CHANGE_STATE (async_generator_object_p, YIELD_OPERATION, YIELD_CLOSE);\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  result = ecma_async_yield_call (result, async_generator_object_p, value);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  ECMA_AWAIT_CHANGE_STATE (async_generator_object_p, YIELD_OPERATION, YIELD_NEXT);\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_async_yield_throw */\n\n/**\n * Execute the next task in the command queue of the async generator\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_async_generator_run (vm_executable_object_t *async_generator_object_p) /**< async generator */\n{\n  JERRY_ASSERT (async_generator_object_p->extended_object.u.cls.type == ECMA_OBJECT_CLASS_ASYNC_GENERATOR);\n  JERRY_ASSERT (!ECMA_IS_INTERNAL_VALUE_NULL (async_generator_object_p->extended_object.u.cls.u3.head));\n\n  ecma_value_t head = async_generator_object_p->extended_object.u.cls.u3.head;\n  ecma_async_generator_task_t *task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t, head);\n  ecma_value_t result;\n\n  if (async_generator_object_p->extended_object.u.cls.u2.executable_obj_flags\n      & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)\n  {\n    switch (task_p->operation_type)\n    {\n      case ECMA_ASYNC_GENERATOR_DO_NEXT:\n      {\n        result = ecma_op_iterator_next (async_generator_object_p->iterator,\n                                        async_generator_object_p->frame_ctx.stack_top_p[-1],\n                                        task_p->operation_value);\n\n        if (ECMA_IS_VALUE_ERROR (result))\n        {\n          break;\n        }\n\n        result = ecma_promise_async_await ((ecma_extended_object_t *) async_generator_object_p, result);\n\n        if (ECMA_IS_VALUE_ERROR (result))\n        {\n          break;\n        }\n\n        ECMA_AWAIT_CHANGE_STATE (async_generator_object_p, YIELD_OPERATION, YIELD_NEXT);\n        break;\n      }\n      case ECMA_ASYNC_GENERATOR_DO_THROW:\n      {\n        result = ecma_async_yield_throw (async_generator_object_p, task_p->operation_value);\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (task_p->operation_type == ECMA_ASYNC_GENERATOR_DO_RETURN);\n\n        result = ecma_copy_value (task_p->operation_value);\n        result = ecma_promise_async_await ((ecma_extended_object_t *) async_generator_object_p, result);\n\n        if (ECMA_IS_VALUE_ERROR (result))\n        {\n          break;\n        }\n\n        ECMA_AWAIT_CHANGE_STATE (async_generator_object_p, YIELD_OPERATION, YIELD_RETURN);\n        break;\n      }\n    }\n\n    ecma_free_value_if_not_object (task_p->operation_value);\n    task_p->operation_value = ECMA_VALUE_UNDEFINED;\n\n    if (result == ECMA_VALUE_UNDEFINED)\n    {\n      return ECMA_VALUE_UNDEFINED;\n    }\n\n    JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result));\n\n    async_generator_object_p->extended_object.u.cls.u2.executable_obj_flags &= ECMA_AWAIT_CLEAR_MASK;\n    async_generator_object_p->iterator = ECMA_VALUE_UNDEFINED;\n    async_generator_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_throw;\n\n    JERRY_ASSERT (async_generator_object_p->frame_ctx.stack_top_p[-1] == ECMA_VALUE_UNDEFINED\n                  || ecma_is_value_object (async_generator_object_p->frame_ctx.stack_top_p[-1]));\n    async_generator_object_p->frame_ctx.stack_top_p--;\n\n    result = jcontext_take_exception ();\n  }\n  else\n  {\n    if (task_p->operation_type == ECMA_ASYNC_GENERATOR_DO_RETURN)\n    {\n      async_generator_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_return;\n    }\n    else if (task_p->operation_type == ECMA_ASYNC_GENERATOR_DO_THROW)\n    {\n      async_generator_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_throw;\n    }\n\n    result = task_p->operation_value;\n    ecma_ref_if_object (result);\n    task_p->operation_value = ECMA_VALUE_UNDEFINED;\n  }\n\n  result = opfunc_resume_executable_object (async_generator_object_p, result);\n\n  if (async_generator_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED)\n  {\n    JERRY_ASSERT (head == async_generator_object_p->extended_object.u.cls.u3.head);\n    ecma_async_generator_finalize (async_generator_object_p, result);\n    result = ECMA_VALUE_UNDEFINED;\n  }\n\n  return result;\n} /* ecma_async_generator_run */\n\n/**\n * Finalize the promises of an executable generator\n */\nvoid\necma_async_generator_finalize (vm_executable_object_t *async_generator_object_p, /**< async generator */\n                               ecma_value_t value) /**< final value (takes reference) */\n{\n  ecma_value_t next = async_generator_object_p->extended_object.u.cls.u3.head;\n  ecma_async_generator_task_t *task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t, next);\n\n  if (ECMA_IS_VALUE_ERROR (value))\n  {\n    value = jcontext_take_exception ();\n    ecma_reject_promise (task_p->promise, value);\n  }\n  else\n  {\n    ecma_value_t result = ecma_create_iter_result_object (value, ECMA_VALUE_TRUE);\n    ecma_fulfill_promise (task_p->promise, result);\n    ecma_free_value (result);\n  }\n\n  ecma_free_value (value);\n\n  next = task_p->next;\n  async_generator_object_p->extended_object.u.cls.u3.head = next;\n  jmem_heap_free_block (task_p, sizeof (ecma_async_generator_task_t));\n\n  while (!ECMA_IS_INTERNAL_VALUE_NULL (next))\n  {\n    task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t, next);\n\n    if (task_p->operation_type != ECMA_ASYNC_GENERATOR_DO_THROW)\n    {\n      value = ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n      ecma_fulfill_promise (task_p->promise, value);\n      ecma_free_value (value);\n    }\n    else\n    {\n      ecma_reject_promise (task_p->promise, task_p->operation_value);\n    }\n\n    ecma_free_value_if_not_object (task_p->operation_value);\n\n    next = task_p->next;\n    async_generator_object_p->extended_object.u.cls.u3.head = next;\n    jmem_heap_free_block (task_p, sizeof (ecma_async_generator_task_t));\n  }\n} /* ecma_async_generator_finalize */\n\n/**\n * Continue after an await operation is completed.\n *\n * @return an updated value for the value argument\n */\necma_value_t\necma_await_continue (vm_executable_object_t *executable_object_p, /**< executable object */\n                     ecma_value_t value) /**< job value (takes reference) */\n{\n  ecma_await_states_t state = (ecma_await_states_t) ECMA_AWAIT_GET_STATE (executable_object_p);\n\n  switch (state)\n  {\n    case ECMA_AWAIT_YIELD_NEXT:\n    case ECMA_AWAIT_YIELD_NEXT_RETURN:\n    {\n      if (!ecma_is_value_object (value))\n      {\n        ecma_free_value (value);\n        return ecma_raise_type_error (ECMA_ERR_VALUE_RECEIVED_BY_YIELD_IS_NOT_OBJECT);\n      }\n\n      ecma_object_t *result_obj_p = ecma_get_object_from_value (value);\n      ecma_value_t result = ecma_op_object_get_by_magic_id (result_obj_p, LIT_MAGIC_STRING_DONE);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        ecma_deref_object (result_obj_p);\n        return result;\n      }\n\n      bool done = ecma_op_to_boolean (result);\n      ecma_free_value (result);\n      result = ecma_op_object_get_by_magic_id (result_obj_p, LIT_MAGIC_STRING_VALUE);\n      ecma_deref_object (result_obj_p);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        return result;\n      }\n\n      if (!done)\n      {\n        ECMA_AWAIT_SET_STATE (executable_object_p, YIELD_NEXT_VALUE);\n        return ecma_promise_async_await ((ecma_extended_object_t *) executable_object_p, result);\n      }\n\n      ECMA_EXECUTABLE_OBJECT_RESUME_EXEC (executable_object_p);\n\n      if (state == ECMA_AWAIT_YIELD_NEXT_RETURN)\n      {\n        executable_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_return;\n      }\n      return result;\n    }\n    case ECMA_AWAIT_YIELD_RETURN:\n    {\n      ecma_object_t *obj_p = ecma_get_object_from_value (executable_object_p->iterator);\n      ecma_value_t result = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_RETURN);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        ecma_free_value (value);\n        return result;\n      }\n\n      if (result == ECMA_VALUE_UNDEFINED)\n      {\n        ECMA_EXECUTABLE_OBJECT_RESUME_EXEC (executable_object_p);\n        executable_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_return;\n        return value;\n      }\n\n      result = ecma_async_yield_call (result, executable_object_p, value);\n      ecma_free_value (value);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        return result;\n      }\n\n      JERRY_ASSERT (result == ECMA_VALUE_UNDEFINED);\n      ECMA_AWAIT_CHANGE_STATE (executable_object_p, YIELD_RETURN, YIELD_NEXT_RETURN);\n      return ECMA_VALUE_UNDEFINED;\n    }\n    case ECMA_AWAIT_YIELD_NEXT_VALUE:\n    {\n      ECMA_AWAIT_CHANGE_STATE (executable_object_p, YIELD_NEXT_VALUE, YIELD_OPERATION);\n      opfunc_async_generator_yield ((ecma_extended_object_t *) executable_object_p, value);\n      return ECMA_VALUE_UNDEFINED;\n    }\n    case ECMA_AWAIT_YIELD_OPERATION:\n    {\n      /* Currently this is always a throw exception case. */\n      ecma_value_t result = ecma_async_yield_throw (executable_object_p, value);\n      ecma_free_value (value);\n      return result;\n    }\n    case ECMA_AWAIT_YIELD_CLOSE:\n    {\n      ecma_error_msg_t msg = (ecma_is_value_object (value) ? ECMA_ERR_ITERATOR_THROW_IS_NOT_AVAILABLE\n                                                           : ECMA_ERR_VALUE_RECEIVED_BY_YIELD_IS_NOT_OBJECT);\n\n      ecma_free_value (value);\n      return ecma_raise_type_error (msg);\n    }\n    case ECMA_AWAIT_FOR_CLOSE:\n    {\n      bool is_value_object = ecma_is_value_object (value);\n      ecma_free_value (value);\n      ECMA_EXECUTABLE_OBJECT_RESUME_EXEC (executable_object_p);\n\n      if (!is_value_object\n          && VM_GET_CONTEXT_TYPE (executable_object_p->frame_ctx.stack_top_p[-1]) != VM_CONTEXT_FINALLY_THROW)\n      {\n        return ecma_raise_type_error (ECMA_ERR_ITERATOR_RETURN_RESULT_IS_NOT_OBJECT);\n      }\n      return ECMA_VALUE_EMPTY;\n    }\n    default:\n    {\n      JERRY_ASSERT (state == ECMA_AWAIT_FOR_NEXT);\n      JERRY_ASSERT (VM_GET_CONTEXT_TYPE (executable_object_p->frame_ctx.stack_top_p[-1]) == VM_CONTEXT_FOR_AWAIT_OF);\n      JERRY_ASSERT (!(executable_object_p->frame_ctx.stack_top_p[-1] & VM_CONTEXT_CLOSE_ITERATOR));\n\n      if (!ecma_is_value_object (value))\n      {\n        ecma_free_value (value);\n        return ecma_raise_type_error (ECMA_ERR_VALUE_RECEIVED_BY_FOR_ASYNC_OF_IS_NOT_OBJECT);\n      }\n\n      ecma_object_t *result_obj_p = ecma_get_object_from_value (value);\n      ecma_value_t result = ecma_op_object_get_by_magic_id (result_obj_p, LIT_MAGIC_STRING_DONE);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        ecma_deref_object (result_obj_p);\n        return result;\n      }\n\n      bool done = ecma_op_to_boolean (result);\n      ecma_free_value (result);\n\n      ecma_value_t *stack_top_p = executable_object_p->frame_ctx.stack_top_p;\n      JERRY_ASSERT (stack_top_p[-2] == ECMA_VALUE_UNDEFINED);\n      JERRY_ASSERT (ecma_is_value_object (stack_top_p[-3]));\n      JERRY_ASSERT (stack_top_p[-4] == ECMA_VALUE_UNDEFINED || ecma_is_value_object (stack_top_p[-4]));\n\n      if (!done)\n      {\n        result = ecma_op_object_get_by_magic_id (result_obj_p, LIT_MAGIC_STRING_VALUE);\n        ecma_deref_object (result_obj_p);\n\n        if (ECMA_IS_VALUE_ERROR (result))\n        {\n          return result;\n        }\n\n        /* It seems browsers call Await(result) here, although the standard does not\n         * requests to do so. The following code might follow browsers in the future. */\n        ecma_deref_if_object (result);\n        stack_top_p[-1] |= VM_CONTEXT_CLOSE_ITERATOR;\n        stack_top_p[-2] = result;\n        ECMA_EXECUTABLE_OBJECT_RESUME_EXEC (executable_object_p);\n        return ECMA_VALUE_EMPTY;\n      }\n\n      ecma_deref_object (result_obj_p);\n\n      /* This code jumps to the end regardless of the byte code which triggered this await. */\n      uint32_t context_end = VM_GET_CONTEXT_END (stack_top_p[-1]);\n      executable_object_p->frame_ctx.byte_code_p = executable_object_p->frame_ctx.byte_code_start_p + context_end;\n\n      VM_MINUS_EQUAL_U16 (executable_object_p->frame_ctx.context_depth, PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION);\n      stack_top_p -= PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION;\n      executable_object_p->frame_ctx.stack_top_p = stack_top_p;\n\n      ECMA_EXECUTABLE_OBJECT_RESUME_EXEC (executable_object_p);\n      return ECMA_VALUE_EMPTY;\n    }\n  }\n} /* ecma_await_continue */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-async-generator-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_ASYNC_GENERATOR_OBJECT_H\n#define ECMA_ASYNC_GENERATOR_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n#include \"vm-defines.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaasyncgeneratorobject ECMA AsyncGenerator object related routines\n * @{\n */\n\n/**\n * AsyncGenerator command types.\n */\ntypedef enum\n{\n  ECMA_ASYNC_GENERATOR_DO_NEXT, /**< async generator next operation */\n  ECMA_ASYNC_GENERATOR_DO_THROW, /**< async generator throw operation */\n  ECMA_ASYNC_GENERATOR_DO_RETURN, /**< async generator return operation */\n} ecma_async_generator_operation_type_t;\n\n/**\n * Get the state of an async yield iterator.\n */\n#define ECMA_AWAIT_GET_STATE(async_generator_object_p) \\\n  ((async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags >> ECMA_AWAIT_STATE_SHIFT)\n\n/**\n * Set the state of an async yield iterator.\n */\n#define ECMA_AWAIT_SET_STATE(async_generator_object_p, to)                                           \\\n  do                                                                                                 \\\n  {                                                                                                  \\\n    uint16_t extra_info = (async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags; \\\n    extra_info &= ((1 << ECMA_AWAIT_STATE_SHIFT) - 1);                                               \\\n    extra_info |= (ECMA_AWAIT_##to) << ECMA_AWAIT_STATE_SHIFT;                                       \\\n    (async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags = extra_info;          \\\n  } while (false)\n\n/**\n * Mask for clearing all ASYNC_AWAIT status bits\n */\n#define ECMA_AWAIT_CLEAR_MASK (((1 << ECMA_AWAIT_STATE_SHIFT) - 1) - ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)\n\n/**\n * Helper macro for ECMA_AWAIT_CHANGE_STATE.\n */\n#define ECMA_AWAIT_CS_HELPER(from, to) (((ECMA_AWAIT_##from) ^ (ECMA_AWAIT_##to)) << ECMA_AWAIT_STATE_SHIFT)\n\n/**\n * Change the state of an async yield iterator.\n */\n#define ECMA_AWAIT_CHANGE_STATE(async_generator_object_p, from, to) \\\n  ((async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags ^= ECMA_AWAIT_CS_HELPER (from, to))\n\necma_value_t ecma_async_generator_enqueue (vm_executable_object_t *async_generator_object_p,\n                                           ecma_async_generator_operation_type_t operation,\n                                           ecma_value_t value);\n\necma_value_t ecma_async_generator_run (vm_executable_object_t *async_generator_object_p);\nvoid ecma_async_generator_finalize (vm_executable_object_t *async_generator_object_p, ecma_value_t value);\n\necma_value_t ecma_await_continue (vm_executable_object_t *async_generator_object_p, ecma_value_t value);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_ASYNC_GENERATOR_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-atomics-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-atomics-object.h\"\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-shared-arraybuffer-object.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jcontext.h\"\n#include \"jmem.h\"\n\n#if JERRY_BUILTIN_ATOMICS\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaatomicsobject ECMA builtin Atomics helper functions\n * @{\n */\n\n/**\n * Atomics validate integer typedArray\n *\n * See also: ES12 25.4.1.1\n *\n * @return ecma value\n */\necma_value_t\necma_validate_integer_typedarray (ecma_value_t typedarray, /**< typedArray argument */\n                                  bool waitable) /**< waitable argument */\n{\n  /* 2. */\n  if (!ecma_is_typedarray (typedarray))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_TYPED_ARRAY);\n  }\n\n  /* 3-4. */\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (typedarray);\n  ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (target_info.array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 5-6. */\n  if (waitable)\n  {\n    if (!(target_info.id == ECMA_BIGINT64_ARRAY || target_info.id == ECMA_INT32_ARRAY))\n    {\n      return ecma_raise_type_error (ECMA_ERR_ARGUMENT_NOT_SUPPORTED);\n    }\n  }\n  else\n  {\n    if (target_info.id == ECMA_UINT8_CLAMPED_ARRAY || target_info.id == ECMA_FLOAT32_ARRAY\n        || target_info.id == ECMA_FLOAT64_ARRAY)\n    {\n      return ecma_raise_type_error (ECMA_ERR_ARGUMENT_NOT_SUPPORTED);\n    }\n  }\n\n  /* 7. */\n  JERRY_ASSERT (target_info.array_buffer_p != NULL);\n\n  /* 8-10. */\n  ecma_object_t *buffer = ecma_typedarray_get_arraybuffer (typedarray_p);\n\n  if (!ecma_object_class_is (buffer, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER)\n      && !ecma_object_class_is (buffer, ECMA_OBJECT_CLASS_ARRAY_BUFFER))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_NOT_ARRAY_BUFFER);\n  }\n\n  return ecma_make_object_value (buffer);\n} /* ecma_validate_integer_typedarray */\n\n/**\n * Atomics validate Atomic Access\n *\n * See also: ES11 24.4.1.2\n *\n * @return ecma value\n */\nuint32_t\necma_validate_atomic_access (ecma_value_t typedarray, /**< typedArray argument */\n                             ecma_value_t request_index) /**< request_index argument */\n{\n  /* 1. */\n  JERRY_ASSERT (ecma_is_value_object (typedarray)\n                && ecma_typedarray_get_arraybuffer (ecma_get_object_from_value (typedarray)) != NULL);\n\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (typedarray);\n\n  /* 2. */\n  ecma_number_t access_index;\n  if (ECMA_IS_VALUE_ERROR (ecma_op_to_index (request_index, &access_index)))\n  {\n    return ECMA_STRING_NOT_ARRAY_INDEX;\n  }\n\n  /* 3. */\n  ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (target_info.array_buffer_p))\n  {\n    return ECMA_STRING_NOT_ARRAY_INDEX;\n  }\n\n  /* 4. */\n  JERRY_ASSERT (access_index >= 0);\n\n  /* 5-6. */\n  if (JERRY_UNLIKELY (access_index >= target_info.length))\n  {\n    ecma_raise_range_error (ECMA_ERR_INVALID_LENGTH);\n    return ECMA_STRING_NOT_ARRAY_INDEX;\n  }\n\n  return (uint32_t) access_index;\n} /* ecma_validate_atomic_access */\n\n/**\n * Atomics read, modify, write\n *\n * See also: ES11 24.4.1.11\n *\n * @return ecma value\n */\necma_value_t\necma_atomic_read_modify_write (ecma_value_t typedarray, /**< typedArray argument */\n                               ecma_value_t index, /**< index argument */\n                               ecma_value_t value, /**< value argument */\n                               ecma_atomics_op_t op) /**< operation argument */\n{\n  /* 1. */\n  ecma_value_t buffer = ecma_validate_integer_typedarray (typedarray, false);\n\n  if (ECMA_IS_VALUE_ERROR (buffer))\n  {\n    return buffer;\n  }\n\n  /* 2. */\n  uint32_t idx = ecma_validate_atomic_access (typedarray, index);\n\n  if (idx == ECMA_STRING_NOT_ARRAY_INDEX)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 3. */\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (typedarray);\n  ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (target_info.array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_typedarray_type_t element_type = target_info.id;\n\n  /* 4-5. */\n  ecma_value_t val = ECMA_VALUE_ERROR;\n  ecma_number_t tmp;\n#if JERRY_BUILTIN_BIGINT\n  if (element_type == ECMA_BIGINT64_ARRAY || element_type == ECMA_BIGUINT64_ARRAY)\n  {\n    val = ecma_bigint_to_bigint (value, false);\n  }\n  else\n#endif /* JERRY_BUILTIN_BIGINT */\n    if (!ECMA_IS_VALUE_ERROR (ecma_op_to_integer (value, &tmp)))\n    {\n      val = ecma_make_number_value (tmp);\n    }\n\n  if (ECMA_IS_VALUE_ERROR (val))\n  {\n    return val;\n  }\n\n  /* 6. */\n  uint8_t element_size = target_info.element_size;\n\n  /* 8. */\n  uint32_t offset = target_info.offset;\n\n  /* 9. */\n  uint32_t indexed_position = idx * element_size + offset;\n\n  /* 10. */\n  return ecma_arraybuffer_get_modify_set_value_in_buffer (buffer,\n                                                          indexed_position,\n                                                          val,\n                                                          op,\n                                                          element_type,\n                                                          ecma_get_typedarray_getter_fn (element_type),\n                                                          ecma_get_typedarray_setter_fn (element_type));\n} /* ecma_atomic_read_modify_write */\n\n/**\n * Atomics load\n *\n * See also: ES12 25.4.7\n *\n * @return ecma value\n */\necma_value_t\necma_atomic_load (ecma_value_t typedarray, /**< typedArray argument */\n                  ecma_value_t index) /**< index argument */\n{\n  ecma_value_t buffer = ecma_validate_integer_typedarray (typedarray, false);\n\n  if (ECMA_IS_VALUE_ERROR (buffer))\n  {\n    return buffer;\n  }\n\n  if (ecma_arraybuffer_is_detached (ecma_get_object_from_value (buffer)))\n  {\n    ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  /* 2. */\n  uint32_t idx = ecma_validate_atomic_access (typedarray, index);\n\n  if (idx == ECMA_STRING_NOT_ARRAY_INDEX)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 3. */\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (typedarray);\n  ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (target_info.array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 4. */\n  uint8_t element_size = target_info.element_size;\n\n  /* 5. */\n  ecma_typedarray_type_t element_type = target_info.id;\n\n  /* 6. */\n  uint32_t offset = target_info.offset;\n\n  /* 7. */\n  uint32_t indexed_position = idx * element_size + offset;\n\n  ecma_typedarray_getter_fn_t typedarray_getter_cb = ecma_get_typedarray_getter_fn (element_type);\n  uint8_t *buffer_p = ecma_arraybuffer_get_buffer (ecma_get_object_from_value (buffer));\n\n  return typedarray_getter_cb (buffer_p + indexed_position);\n} /* ecma_atomic_load */\n\n/**\n * @}\n * @}\n */\n#endif /* JERRY_BUILTIN_ATOMICS */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-atomics-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_ATOMICS_OBJECT_H\n#define ECMA_ATOMICS_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n#if JERRY_BUILTIN_ATOMICS\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaatomicsobject ECMA builtin Atomics helper functions\n * @{\n */\n\n/**\n * Atomics flags.\n */\ntypedef enum\n{\n  ECMA_ATOMICS_AND, /**< Atomics and operation */\n  ECMA_ATOMICS_OR, /**< Atomics or operation */\n  ECMA_ATOMICS_XOR, /**< Atomics xor operation */\n  ECMA_ATOMICS_ADD, /**< Atomics add operation */\n  ECMA_ATOMICS_SUBTRACT, /**< Atomics subtract operation */\n  ECMA_ATOMICS_EXCHANGE, /**< Atomics exchange operation */\n  ECMA_ATOMICS_COMPARE_EXCHANGE /**< Atomics compare exchange operation */\n} ecma_atomics_op_t;\n\necma_value_t ecma_validate_integer_typedarray (ecma_value_t typedarray, bool waitable);\nuint32_t ecma_validate_atomic_access (ecma_value_t typedarray, ecma_value_t request_index);\necma_value_t\necma_atomic_read_modify_write (ecma_value_t typedarray, ecma_value_t index, ecma_value_t value, ecma_atomics_op_t op);\necma_value_t ecma_atomic_load (ecma_value_t typedarray, ecma_value_t index);\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_ATOMICS */\n\n#endif /* ECMA_ATOMICS_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-big-uint.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-big-uint.h\"\n\n#include \"ecma-helpers.h\"\n\n#include \"jmem.h\"\n#include \"lit-char-helpers.h\"\n\n#if JERRY_BUILTIN_BIGINT\n\nJERRY_STATIC_ASSERT (sizeof (ecma_bigint_two_digits_t) == 2 * sizeof (ecma_bigint_digit_t),\n                     ecma_big_int_two_digits_must_be_twice_as_long_as_ecma_big_int_digit);\n\nJERRY_STATIC_ASSERT ((1 << ECMA_BIGINT_DIGIT_SHIFT) == (8 * sizeof (ecma_bigint_digit_t)),\n                     ecma_bigint_digit_shift_is_incorrect);\n\nJERRY_STATIC_ASSERT ((ECMA_BIG_UINT_BITWISE_DECREASE_LEFT << 1) == ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT,\n                     ecma_big_uint_bitwise_left_and_right_sub_option_bits_must_follow_each_other);\n\n/**\n * Create a new BigInt value\n *\n * @return new BigInt value, NULL on error\n */\necma_extended_primitive_t *\necma_bigint_create (uint32_t size) /**< size of the new BigInt value */\n{\n  JERRY_ASSERT (size > 0);\n  JERRY_ASSERT ((size % sizeof (ecma_bigint_digit_t)) == 0);\n\n  if (JERRY_UNLIKELY (size > ECMA_BIGINT_MAX_SIZE))\n  {\n    return NULL;\n  }\n\n  ecma_extended_primitive_t *value_p;\n\n  size_t mem_size = ECMA_BIGINT_GET_BYTE_SIZE (size) + sizeof (ecma_extended_primitive_t);\n  value_p = (ecma_extended_primitive_t *) jmem_heap_alloc_block_null_on_error (mem_size);\n\n  if (JERRY_UNLIKELY (value_p == NULL))\n  {\n    return NULL;\n  }\n\n  value_p->refs_and_type = ECMA_EXTENDED_PRIMITIVE_REF_ONE | ECMA_TYPE_BIGINT;\n  value_p->u.bigint_sign_and_size = size;\n  return value_p;\n} /* ecma_bigint_create */\n\n/**\n * Extend a BigUInt value with a new data prefix value\n *\n * @return new BigUInt value, NULL on error\n */\necma_extended_primitive_t *\necma_big_uint_extend (ecma_extended_primitive_t *value_p, /**< BigUInt value */\n                      ecma_bigint_digit_t digit) /**< new digit */\n{\n  uint32_t old_size = ECMA_BIGINT_GET_SIZE (value_p);\n\n  if (ECMA_BIGINT_SIZE_IS_ODD (old_size))\n  {\n    value_p->u.bigint_sign_and_size += (uint32_t) sizeof (ecma_bigint_digit_t);\n    *ECMA_BIGINT_GET_DIGITS (value_p, old_size) = digit;\n    return value_p;\n  }\n\n  ecma_extended_primitive_t *result_p = ecma_bigint_create (old_size + (uint32_t) sizeof (ecma_bigint_digit_t));\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    ecma_deref_bigint (value_p);\n    return NULL;\n  }\n\n  memcpy (result_p + 1, value_p + 1, old_size);\n  ecma_deref_bigint (value_p);\n\n  *ECMA_BIGINT_GET_DIGITS (result_p, old_size) = digit;\n  return result_p;\n} /* ecma_big_uint_extend */\n\n/**\n * Count the number of leading zero bits of a digit\n *\n * return number of leading zero bits\n */\necma_bigint_digit_t\necma_big_uint_count_leading_zero (ecma_bigint_digit_t digit) /**< digit value */\n{\n  ecma_bigint_digit_t shift = 4 * sizeof (ecma_bigint_digit_t);\n  ecma_bigint_digit_t result = 8 * sizeof (ecma_bigint_digit_t);\n\n  do\n  {\n    ecma_bigint_digit_t value = digit >> shift;\n    if (value > 0)\n    {\n      digit = value;\n      result -= shift;\n    }\n    shift >>= 1;\n  } while (shift > 0);\n\n  return result - digit;\n} /* ecma_big_uint_count_leading_zero */\n\n/**\n * Helper function which discards the leading zero digits of a BigUInt value\n *\n * @return new BigUInt value, NULL on error\n */\nstatic ecma_extended_primitive_t *\necma_big_uint_normalize_result (ecma_extended_primitive_t *value_p, /**< BigUInt value */\n                                ecma_bigint_digit_t *last_digit_p) /**< points to the end of BigUInt */\n{\n  JERRY_ASSERT (last_digit_p[-1] == 0);\n\n  ecma_bigint_digit_t *first_digit_p = ECMA_BIGINT_GET_DIGITS (value_p, 0);\n\n  /* The following code is tricky. The value stored in first_digit_p[-1] is the size\n   * of the BigUInt value, and it cannot be zero. Hence the loop below will terminate. */\n  JERRY_ASSERT (first_digit_p[-1] != 0);\n\n  do\n  {\n    --last_digit_p;\n  } while (last_digit_p[-1] == 0);\n\n  JERRY_ASSERT (last_digit_p >= first_digit_p);\n\n  if (first_digit_p == last_digit_p)\n  {\n    ecma_deref_bigint (value_p);\n    return ECMA_BIGINT_POINTER_TO_ZERO;\n  }\n\n  uint32_t new_size = (uint32_t) ((uint8_t *) last_digit_p - (uint8_t *) first_digit_p);\n\n  if (ECMA_BIGINT_SIZE_IS_ODD (new_size)\n      && ((new_size + sizeof (ecma_bigint_digit_t)) == ECMA_BIGINT_GET_SIZE (value_p)))\n  {\n    value_p->u.bigint_sign_and_size -= (uint32_t) sizeof (ecma_bigint_digit_t);\n    return value_p;\n  }\n\n  ecma_extended_primitive_t *result_p = ecma_bigint_create (new_size);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    ecma_deref_bigint (value_p);\n    return NULL;\n  }\n\n  memcpy (ECMA_BIGINT_GET_DIGITS (result_p, 0), ECMA_BIGINT_GET_DIGITS (value_p, 0), new_size);\n  ecma_deref_bigint (value_p);\n\n  return result_p;\n} /* ecma_big_uint_normalize_result */\n\n/**\n * Helper function which increases the result by 1 and extends or shrinks the BigUInt when necessary\n *\n * @return new BigUInt value, NULL on error\n */\nstatic ecma_extended_primitive_t *\necma_big_uint_increase_result (ecma_extended_primitive_t *value_p) /**< BigUInt value */\n{\n  uint32_t size = ECMA_BIGINT_GET_SIZE (value_p);\n\n  JERRY_ASSERT (size > 0);\n\n  ecma_bigint_digit_t *first_digit_p = ECMA_BIGINT_GET_DIGITS (value_p, 0);\n  ecma_bigint_digit_t *last_digit_p = ECMA_BIGINT_GET_DIGITS (value_p, size);\n\n  while (*first_digit_p == ~((ecma_bigint_digit_t) 0))\n  {\n    *first_digit_p++ = 0;\n\n    if (first_digit_p == last_digit_p)\n    {\n      return ecma_big_uint_extend (value_p, 1);\n    }\n  }\n\n  (*first_digit_p)++;\n\n  if (last_digit_p[-1] != 0)\n  {\n    return value_p;\n  }\n\n  return ecma_big_uint_normalize_result (value_p, last_digit_p);\n} /* ecma_big_uint_increase_result */\n\n/**\n * Compare two BigUInt numbers\n *\n * return -1, if left value < right value, 0 if they are equal, and 1 otherwise\n */\nint\necma_big_uint_compare (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */\n                       ecma_extended_primitive_t *right_value_p) /**< right BigUInt value */\n{\n  uint32_t left_size = ECMA_BIGINT_GET_SIZE (left_value_p);\n  uint32_t right_size = ECMA_BIGINT_GET_SIZE (right_value_p);\n\n  JERRY_ASSERT (left_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) != 0);\n  JERRY_ASSERT (right_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (right_value_p, right_size) != 0);\n\n  if (left_size > right_size)\n  {\n    return 1;\n  }\n\n  if (left_size < right_size)\n  {\n    return -1;\n  }\n\n  ecma_bigint_digit_t *start_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);\n  ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, left_size);\n  ecma_bigint_digit_t *right_p = ECMA_BIGINT_GET_DIGITS (right_value_p, left_size);\n\n  do\n  {\n    ecma_bigint_digit_t left_value = *(--left_p);\n    ecma_bigint_digit_t right_value = *(--right_p);\n\n    if (left_value < right_value)\n    {\n      return -1;\n    }\n\n    if (left_value > right_value)\n    {\n      return 1;\n    }\n  } while (left_p > start_p);\n\n  return 0;\n} /* ecma_big_uint_compare */\n\n/**\n * In-place multiply and addition operation with digit\n *\n * return updated value on success, NULL if no memory is available\n */\necma_extended_primitive_t *\necma_big_uint_mul_digit (ecma_extended_primitive_t *value_p, /**< BigUInt value */\n                         ecma_bigint_digit_t mul, /**< multiply value */\n                         ecma_bigint_digit_t add) /**< addition value */\n{\n  JERRY_ASSERT (mul > 1);\n  JERRY_ASSERT (add < mul);\n\n  if (JERRY_UNLIKELY (value_p == NULL))\n  {\n    JERRY_ASSERT (add > 0);\n\n    value_p = ecma_bigint_create (sizeof (ecma_bigint_digit_t));\n\n    if (JERRY_UNLIKELY (value_p == NULL))\n    {\n      return NULL;\n    }\n\n    *ECMA_BIGINT_GET_DIGITS (value_p, 0) = add;\n    return value_p;\n  }\n\n  uint32_t size = ECMA_BIGINT_GET_SIZE (value_p);\n\n  JERRY_ASSERT (size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (value_p, size) != 0);\n\n  ecma_bigint_digit_t *current_p = ECMA_BIGINT_GET_DIGITS (value_p, 0);\n  ecma_bigint_digit_t *end_p = ECMA_BIGINT_GET_DIGITS (value_p, size);\n  ecma_bigint_digit_t carry = add;\n\n  do\n  {\n    ecma_bigint_two_digits_t multiply_result = ((ecma_bigint_two_digits_t) *current_p) * mul;\n    ecma_bigint_digit_t multiply_result_low, new_carry;\n\n    multiply_result_low = (ecma_bigint_digit_t) multiply_result;\n    new_carry = (ecma_bigint_digit_t) (multiply_result >> (8 * sizeof (ecma_bigint_digit_t)));\n\n    multiply_result_low += carry;\n    if (multiply_result_low < carry)\n    {\n      new_carry++;\n    }\n\n    *current_p++ = multiply_result_low;\n    carry = new_carry;\n  } while (current_p < end_p);\n\n  if (carry == 0)\n  {\n    return value_p;\n  }\n\n  return ecma_big_uint_extend (value_p, carry);\n} /* ecma_big_uint_mul_digit */\n\n/**\n * Convert a BigUInt to a human readable number\n *\n * return char sequence on success, NULL otherwise\n */\nlit_utf8_byte_t *\necma_big_uint_to_string (ecma_extended_primitive_t *value_p, /**< BigUInt value */\n                         uint32_t radix, /**< radix number between 2 and 36 */\n                         uint32_t *char_start_p, /**< [out] start offset of numbers */\n                         uint32_t *char_size_p) /**< [out] size of the output buffer */\n{\n  uint32_t size = ECMA_BIGINT_GET_SIZE (value_p);\n\n  JERRY_ASSERT (radix >= 2 && radix <= 36);\n  JERRY_ASSERT (size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (value_p, size) != 0);\n\n  uint32_t max_size = size * 8;\n\n  if (radix < 16)\n  {\n    if (radix >= 8)\n    {\n      /* Most frequent case. */\n      max_size = (max_size + 2) / 3;\n    }\n    else if (radix >= 4)\n    {\n      max_size = (max_size + 1) >> 1;\n    }\n  }\n  else if (radix < 32)\n  {\n    max_size = (max_size + 3) >> 2;\n  }\n  else\n  {\n    max_size = (max_size + 4) / 5;\n  }\n\n  /* This space can be used to store a sign. */\n  max_size += (uint32_t) (2 * sizeof (ecma_bigint_digit_t) - 1);\n  max_size &= ~(uint32_t) (sizeof (ecma_bigint_digit_t) - 1);\n  *char_size_p = max_size;\n\n  lit_utf8_byte_t *result_p = (lit_utf8_byte_t *) jmem_heap_alloc_block_null_on_error (max_size);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return NULL;\n  }\n\n  memcpy (result_p, value_p + 1, size);\n\n  ecma_bigint_digit_t *start_p = (ecma_bigint_digit_t *) (result_p + size);\n  ecma_bigint_digit_t *end_p = (ecma_bigint_digit_t *) result_p;\n  lit_utf8_byte_t *string_p = result_p + max_size;\n\n  do\n  {\n    ecma_bigint_digit_t *current_p = (ecma_bigint_digit_t *) start_p;\n    ecma_bigint_digit_t remainder = 0;\n\n    if (sizeof (uintptr_t) == sizeof (ecma_bigint_two_digits_t))\n    {\n      do\n      {\n        ecma_bigint_two_digits_t result = *(--current_p) | ECMA_BIGINT_HIGH_DIGIT (remainder);\n\n        *current_p = (ecma_bigint_digit_t) (result / radix);\n        remainder = (ecma_bigint_digit_t) (result % radix);\n      } while (current_p > end_p);\n    }\n    else\n    {\n      if (ECMA_BIGINT_SIZE_IS_ODD ((uintptr_t) current_p - (uintptr_t) end_p))\n      {\n        ecma_bigint_digit_t result = *(--current_p);\n        *current_p = result / radix;\n        remainder = result % radix;\n      }\n\n      while (current_p > end_p)\n      {\n        /* The following algorithm splits the 64 bit input into three numbers, extend\n         * them with remainder, divide them by radix, and updates the three bit ranges\n         * corresponding to the three numbers. */\n\n        const uint32_t extract_bits_low = 10;\n        const uint32_t extract_bits_low_mask = (uint32_t) ((1 << extract_bits_low) - 1);\n        const uint32_t extract_bits_high = (uint32_t) ((sizeof (ecma_bigint_digit_t) * 8) - extract_bits_low);\n        const uint32_t extract_bits_high_mask = (uint32_t) ((1 << extract_bits_high) - 1);\n\n        ecma_bigint_digit_t result_high = current_p[-1];\n        ecma_bigint_digit_t result_mid = (result_high & extract_bits_low_mask) << extract_bits_low;\n\n        result_high = (result_high >> extract_bits_low) | (remainder << extract_bits_high);\n        result_mid |= (result_high % radix) << (extract_bits_low * 2);\n        result_high = (result_high / radix) << extract_bits_low;\n\n        ecma_bigint_digit_t result_low = current_p[-2];\n        result_mid |= result_low >> extract_bits_high;\n        result_low = (result_low & extract_bits_high_mask) | ((result_mid % radix) << extract_bits_high);\n\n        result_mid = result_mid / radix;\n\n        current_p[-1] = result_high | (result_mid >> extract_bits_low);\n        current_p[-2] = (result_low / radix) | (result_mid << extract_bits_high);\n\n        remainder = result_low % radix;\n        current_p -= 2;\n      }\n    }\n\n    *(--string_p) =\n      (lit_utf8_byte_t) ((remainder < 10) ? (remainder + LIT_CHAR_0) : (remainder + (LIT_CHAR_LOWERCASE_A - 10)));\n    JERRY_ASSERT (string_p >= (lit_utf8_byte_t *) start_p);\n\n    if (start_p[-1] == 0)\n    {\n      start_p--;\n    }\n  } while (start_p > end_p);\n\n  *char_start_p = (uint32_t) (string_p - result_p);\n  return result_p;\n} /* ecma_big_uint_to_string */\n\n/**\n * Increase the value of a BigUInt value by 1\n *\n * return new BigUInt value, NULL on error\n */\necma_extended_primitive_t *\necma_big_uint_increase (ecma_extended_primitive_t *value_p) /**< BigUInt value */\n{\n  uint32_t size = ECMA_BIGINT_GET_SIZE (value_p);\n\n  JERRY_ASSERT (size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (value_p, size) != 0);\n\n  ecma_bigint_digit_t *digits_p = ECMA_BIGINT_GET_DIGITS (value_p, 0);\n  ecma_bigint_digit_t *digits_end_p = ECMA_BIGINT_GET_DIGITS (value_p, size);\n\n  if (JERRY_UNLIKELY (digits_p[0] == ~((ecma_bigint_digit_t) 0) && digits_end_p[-1] == ~((ecma_bigint_digit_t) 0)))\n  {\n    do\n    {\n      digits_p++;\n    } while (digits_p < digits_end_p && digits_p[0] == ~((ecma_bigint_digit_t) 0));\n\n    if (digits_p == digits_end_p)\n    {\n      ecma_extended_primitive_t *result_value_p;\n      result_value_p = ecma_bigint_create ((uint32_t) (size + sizeof (ecma_bigint_digit_t)));\n\n      if (JERRY_UNLIKELY (result_value_p == NULL))\n      {\n        return NULL;\n      }\n\n      memset (ECMA_BIGINT_GET_DIGITS (result_value_p, 0), 0, size);\n      *ECMA_BIGINT_GET_DIGITS (result_value_p, size) = 1;\n      return result_value_p;\n    }\n\n    digits_p = ECMA_BIGINT_GET_DIGITS (value_p, 0);\n  }\n\n  ecma_extended_primitive_t *result_value_p = ecma_bigint_create (size);\n\n  if (JERRY_UNLIKELY (result_value_p == NULL))\n  {\n    return NULL;\n  }\n\n  ecma_bigint_digit_t *result_p = ECMA_BIGINT_GET_DIGITS (result_value_p, 0);\n\n  while (digits_p[0] == ~((ecma_bigint_digit_t) 0))\n  {\n    digits_p++;\n    *result_p++ = 0;\n  }\n\n  *result_p++ = (*digits_p++) + 1;\n\n  if (digits_p < digits_end_p)\n  {\n    memcpy (result_p, digits_p, (size_t) ((uint8_t *) digits_end_p - (uint8_t *) digits_p));\n  }\n  return result_value_p;\n} /* ecma_big_uint_increase */\n\n/**\n * Decrease the value of a BigUInt value by 1\n *\n * return new BigUInt value, NULL on error\n */\necma_extended_primitive_t *\necma_big_uint_decrease (ecma_extended_primitive_t *value_p) /**< BigUInt value */\n{\n  uint32_t size = ECMA_BIGINT_GET_SIZE (value_p);\n\n  JERRY_ASSERT (size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (value_p, size) != 0);\n\n  ecma_bigint_digit_t *digits_p = ECMA_BIGINT_GET_DIGITS (value_p, 0);\n  ecma_bigint_digit_t *digits_end_p = ECMA_BIGINT_GET_DIGITS (value_p, size);\n\n  JERRY_ASSERT (size > sizeof (ecma_bigint_digit_t) || *digits_p > 1);\n\n  if (JERRY_UNLIKELY (digits_p[0] == 0 && digits_end_p[-1] == 1))\n  {\n    do\n    {\n      digits_p++;\n      JERRY_ASSERT (digits_p < digits_end_p);\n    } while (digits_p[0] == 0);\n\n    if (digits_p + 1 == digits_end_p)\n    {\n      size -= (uint32_t) sizeof (ecma_bigint_digit_t);\n      ecma_extended_primitive_t *result_value_p = ecma_bigint_create (size);\n\n      if (JERRY_UNLIKELY (result_value_p == NULL))\n      {\n        return NULL;\n      }\n\n      memset (ECMA_BIGINT_GET_DIGITS (result_value_p, 0), 0xff, size);\n      return result_value_p;\n    }\n\n    digits_p = ECMA_BIGINT_GET_DIGITS (value_p, 0);\n  }\n\n  ecma_extended_primitive_t *result_value_p = ecma_bigint_create (size);\n\n  if (JERRY_UNLIKELY (result_value_p == NULL))\n  {\n    return NULL;\n  }\n\n  ecma_bigint_digit_t *result_p = ECMA_BIGINT_GET_DIGITS (result_value_p, 0);\n\n  while (digits_p[0] == 0)\n  {\n    digits_p++;\n    *result_p++ = ~((ecma_bigint_digit_t) 0);\n  }\n\n  *result_p++ = (*digits_p++) - 1;\n\n  if (digits_p < digits_end_p)\n  {\n    memcpy (result_p, digits_p, (size_t) ((uint8_t *) digits_end_p - (uint8_t *) digits_p));\n  }\n  return result_value_p;\n} /* ecma_big_uint_decrease */\n\n/**\n * Add right BigUInt value to the left BigUInt value\n *\n * return new BigUInt value, NULL on error\n */\necma_extended_primitive_t *\necma_big_uint_add (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */\n                   ecma_extended_primitive_t *right_value_p) /**< right BigUInt value */\n{\n  uint32_t left_size = ECMA_BIGINT_GET_SIZE (left_value_p);\n  uint32_t right_size = ECMA_BIGINT_GET_SIZE (right_value_p);\n\n  JERRY_ASSERT (left_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) != 0);\n  JERRY_ASSERT (right_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (right_value_p, right_size) != 0);\n\n  if (left_size < right_size)\n  {\n    /* Swap values. */\n    ecma_extended_primitive_t *tmp_value_p = left_value_p;\n    left_value_p = right_value_p;\n    right_value_p = tmp_value_p;\n\n    uint32_t tmp_size = left_size;\n    left_size = right_size;\n    right_size = tmp_size;\n  }\n\n  ecma_extended_primitive_t *result_p = ecma_bigint_create (left_size);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return NULL;\n  }\n\n  ecma_bigint_digit_t *current_p = ECMA_BIGINT_GET_DIGITS (result_p, 0);\n  ecma_bigint_digit_t *end_p = ECMA_BIGINT_GET_DIGITS (result_p, right_size);\n  ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);\n  ecma_bigint_digit_t *right_p = ECMA_BIGINT_GET_DIGITS (right_value_p, 0);\n  ecma_bigint_digit_t carry = 0;\n\n  left_size -= right_size;\n\n  do\n  {\n    ecma_bigint_digit_t left = *left_p++;\n\n    if (carry == 0 || left != ~(ecma_bigint_digit_t) 0)\n    {\n      left += carry;\n      carry = 0;\n    }\n    else\n    {\n      left = 0;\n      carry = 1;\n    }\n\n    ecma_bigint_digit_t right = *right_p++;\n    left += right;\n\n    if (left < right)\n    {\n      JERRY_ASSERT (carry == 0);\n      carry = 1;\n    }\n\n    *current_p++ = left;\n  } while (current_p < end_p);\n\n  end_p = (ecma_bigint_digit_t *) (((uint8_t *) end_p) + left_size);\n\n  if (carry != 0)\n  {\n    while (true)\n    {\n      if (JERRY_UNLIKELY (current_p == end_p))\n      {\n        return ecma_big_uint_extend (result_p, 1);\n      }\n\n      ecma_bigint_digit_t value = *left_p++;\n\n      if (value != ~(ecma_bigint_digit_t) 0)\n      {\n        *current_p++ = value + 1;\n        break;\n      }\n\n      *current_p++ = 0;\n    }\n  }\n\n  if (current_p < end_p)\n  {\n    memcpy (current_p, left_p, (size_t) ((uint8_t *) end_p - (uint8_t *) current_p));\n  }\n\n  return result_p;\n} /* ecma_big_uint_add */\n\n/**\n * Substract right BigUInt value from the left BigUInt value\n *\n * return new BigUInt value, NULL on error\n */\necma_extended_primitive_t *\necma_big_uint_sub (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */\n                   ecma_extended_primitive_t *right_value_p) /**< right BigUInt value */\n{\n  uint32_t left_size = ECMA_BIGINT_GET_SIZE (left_value_p);\n  uint32_t right_size = ECMA_BIGINT_GET_SIZE (right_value_p);\n\n  JERRY_ASSERT (left_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) != 0);\n  JERRY_ASSERT (right_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (right_value_p, right_size) != 0);\n  JERRY_ASSERT (left_size >= right_size);\n\n  ecma_extended_primitive_t *result_p = ecma_bigint_create (left_size);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return NULL;\n  }\n\n  ecma_bigint_digit_t *current_p = ECMA_BIGINT_GET_DIGITS (result_p, 0);\n  ecma_bigint_digit_t *end_p = ECMA_BIGINT_GET_DIGITS (result_p, right_size);\n  ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);\n  ecma_bigint_digit_t *right_p = ECMA_BIGINT_GET_DIGITS (right_value_p, 0);\n  ecma_bigint_digit_t carry = 0;\n\n  left_size -= right_size;\n\n  do\n  {\n    ecma_bigint_digit_t left = *left_p++;\n    ecma_bigint_digit_t right = *right_p++;\n\n    if (carry == 0 || left != 0)\n    {\n      left -= carry;\n      carry = left < right;\n    }\n    else\n    {\n      left = ~(ecma_bigint_digit_t) 0;\n      carry = 1;\n    }\n\n    *current_p++ = left - right;\n  } while (current_p < end_p);\n\n  end_p = (ecma_bigint_digit_t *) (((uint8_t *) end_p) + left_size);\n\n  if (carry != 0)\n  {\n    while (true)\n    {\n      JERRY_ASSERT (current_p < end_p);\n\n      ecma_bigint_digit_t value = *left_p++;\n\n      if (value != 0)\n      {\n        *current_p++ = value - 1;\n        break;\n      }\n\n      *current_p++ = ~(ecma_bigint_digit_t) 0;\n    }\n  }\n\n  if (current_p < end_p)\n  {\n    memcpy (current_p, left_p, (size_t) ((uint8_t *) end_p - (uint8_t *) current_p));\n    return result_p;\n  }\n\n  if (current_p[-1] != 0)\n  {\n    return result_p;\n  }\n\n  return ecma_big_uint_normalize_result (result_p, current_p);\n} /* ecma_big_uint_sub */\n\n/**\n * Multiply two BigUInt values\n *\n * return new BigUInt value, NULL on error\n */\necma_extended_primitive_t *\necma_big_uint_mul (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */\n                   ecma_extended_primitive_t *right_value_p) /**< right BigUInt value */\n{\n  uint32_t left_size = ECMA_BIGINT_GET_SIZE (left_value_p);\n  uint32_t right_size = ECMA_BIGINT_GET_SIZE (right_value_p);\n\n  JERRY_ASSERT (left_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) != 0);\n  JERRY_ASSERT (right_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (right_value_p, right_size) != 0);\n\n  if (left_size < right_size)\n  {\n    /* Swap values. */\n    ecma_extended_primitive_t *tmp_value_p = left_value_p;\n    left_value_p = right_value_p;\n    right_value_p = tmp_value_p;\n\n    uint32_t tmp_size = left_size;\n    left_size = right_size;\n    right_size = tmp_size;\n  }\n\n  uint32_t result_size = left_size + right_size - (uint32_t) sizeof (ecma_bigint_digit_t);\n\n  ecma_extended_primitive_t *result_p = ecma_bigint_create (result_size);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return NULL;\n  }\n\n  memset (ECMA_BIGINT_GET_DIGITS (result_p, 0), 0, result_size);\n\n  /* Lower amount of space is allocated by default. This value provides extra space if needed. */\n  ecma_bigint_digit_t extra_space[1] = { 0 };\n\n  ecma_bigint_digit_t *right_p = ECMA_BIGINT_GET_DIGITS (right_value_p, 0);\n  ecma_bigint_digit_t *right_end_p = ECMA_BIGINT_GET_DIGITS (right_value_p, right_size);\n  ecma_bigint_digit_t *left_start_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);\n  ecma_bigint_digit_t *left_end_p = ECMA_BIGINT_GET_DIGITS (left_value_p, left_size);\n\n  ecma_bigint_digit_t *result_start_p = ECMA_BIGINT_GET_DIGITS (result_p, 0);\n  ecma_bigint_digit_t *result_end_p = ECMA_BIGINT_GET_DIGITS (result_p, result_size);\n\n  do\n  {\n    ecma_bigint_two_digits_t right = *right_p++;\n\n    if (right == 0)\n    {\n      result_start_p++;\n      continue;\n    }\n\n    ecma_bigint_digit_t *left_p = left_start_p;\n    ecma_bigint_digit_t *destination_p = result_start_p;\n    ecma_bigint_digit_t carry = 0;\n\n    do\n    {\n      JERRY_ASSERT (destination_p != (ecma_bigint_digit_t *) (extra_space + 1));\n\n      ecma_bigint_two_digits_t multiply_result;\n      ecma_bigint_digit_t multiply_result_low, new_carry;\n      ecma_bigint_digit_t value = *destination_p;\n\n      multiply_result = ((ecma_bigint_two_digits_t) (*left_p++)) * ((ecma_bigint_two_digits_t) right);\n      multiply_result_low = (ecma_bigint_digit_t) multiply_result;\n      value += multiply_result_low;\n      new_carry = (ecma_bigint_digit_t) (multiply_result >> (8 * sizeof (ecma_bigint_digit_t)));\n\n      /* The new_carry can never overflow because:\n       *   a) If left or right is less than 0xff..ff, new_carry will be less than or equal to\n       *      0xff...fd, and increasing it by maximum of two (carries) cannot overflow.\n       *   b) If left and right are both equal to 0xff..ff, multiply_result_low will be 1,\n       *      and computing value + carry + 1 can only increase new_carry at most once. */\n\n      if (value < multiply_result_low)\n      {\n        JERRY_ASSERT (new_carry < ~(ecma_bigint_digit_t) 0);\n        new_carry++;\n      }\n\n      value += carry;\n\n      if (value < carry)\n      {\n        JERRY_ASSERT (new_carry < ~(ecma_bigint_digit_t) 0);\n        new_carry++;\n      }\n\n      carry = new_carry;\n      *destination_p++ = value;\n\n      if (destination_p == result_end_p)\n      {\n        destination_p = (ecma_bigint_digit_t *) extra_space;\n      }\n    } while (left_p < left_end_p);\n\n    while (carry > 0)\n    {\n      JERRY_ASSERT (destination_p != (ecma_bigint_digit_t *) (extra_space + 1));\n\n      ecma_bigint_digit_t value = *destination_p;\n\n      value += carry;\n      carry = (value < carry);\n\n      *destination_p++ = value;\n\n      if (destination_p == result_end_p)\n      {\n        destination_p = (ecma_bigint_digit_t *) extra_space;\n      }\n    }\n\n    result_start_p++;\n  } while (right_p < right_end_p);\n\n  if (extra_space[0] == 0)\n  {\n    return result_p;\n  }\n\n  return ecma_big_uint_extend (result_p, extra_space[0]);\n} /* ecma_big_uint_mul */\n\n/**\n * Divide left BigUInt value with right digit value\n *\n * return new BigUInt value, NULL on error\n */\nstatic ecma_extended_primitive_t *\necma_big_uint_div_digit (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */\n                         ecma_bigint_digit_t divisor_digit, /**< divisor value */\n                         bool is_mod) /**< true if return with remainder */\n{\n  uint32_t left_size = ECMA_BIGINT_GET_SIZE (left_value_p);\n\n  JERRY_ASSERT (left_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) != 0);\n  JERRY_ASSERT (divisor_digit > 0);\n\n  ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, left_size - sizeof (ecma_bigint_digit_t));\n  ecma_bigint_digit_t *end_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);\n\n  ecma_bigint_digit_t last_digit = *left_p;\n  ecma_bigint_digit_t remainder = last_digit % divisor_digit;\n\n  last_digit = last_digit / divisor_digit;\n\n  ecma_extended_primitive_t *result_p = NULL;\n  ecma_bigint_digit_t *current_p = NULL;\n\n  if (!is_mod)\n  {\n    ecma_bigint_digit_t result_size = left_size;\n\n    if (last_digit == 0)\n    {\n      result_size -= (uint32_t) sizeof (ecma_bigint_digit_t);\n    }\n\n    result_p = ecma_bigint_create (result_size);\n\n    if (JERRY_UNLIKELY (result_p == NULL))\n    {\n      return NULL;\n    }\n\n    current_p = ECMA_BIGINT_GET_DIGITS (result_p, result_size);\n\n    if (last_digit != 0)\n    {\n      *(--current_p) = last_digit;\n    }\n  }\n\n  while (left_p > end_p)\n  {\n    const uint32_t shift = 1 << ECMA_BIGINT_DIGIT_SHIFT;\n\n    ecma_bigint_two_digits_t result = *(--left_p) | (((ecma_bigint_two_digits_t) remainder) << shift);\n\n    if (!is_mod)\n    {\n      *(--current_p) = (ecma_bigint_digit_t) (result / divisor_digit);\n    }\n\n    remainder = (ecma_bigint_digit_t) (result % divisor_digit);\n  }\n\n  if (!is_mod)\n  {\n    JERRY_ASSERT (current_p == ECMA_BIGINT_GET_DIGITS (result_p, 0));\n    return result_p;\n  }\n\n  if (remainder == 0)\n  {\n    return ECMA_BIGINT_POINTER_TO_ZERO;\n  }\n\n  result_p = ecma_bigint_create (sizeof (ecma_bigint_digit_t));\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return NULL;\n  }\n\n  *ECMA_BIGINT_GET_DIGITS (result_p, 0) = remainder;\n  return result_p;\n} /* ecma_big_uint_div_digit */\n\n/**\n * Shift left a BigUInt value by a digit value\n *\n * return newly allocated buffer, NULL on error\n */\nstatic ecma_bigint_digit_t *\necma_big_uint_div_shift_left (ecma_extended_primitive_t *value_p, /**< BigUInt value */\n                              ecma_bigint_digit_t shift_left, /**< left shift */\n                              bool extend) /**< extend the result with an extra digit */\n{\n  uint32_t size = ECMA_BIGINT_GET_SIZE (value_p);\n\n  JERRY_ASSERT (size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (value_p, size) != 0);\n\n  ecma_bigint_digit_t *source_p = ECMA_BIGINT_GET_DIGITS (value_p, 0);\n  ecma_bigint_digit_t *end_p = ECMA_BIGINT_GET_DIGITS (value_p, size);\n\n  if (extend)\n  {\n    size += (uint32_t) sizeof (ecma_bigint_digit_t);\n  }\n\n  ecma_bigint_digit_t *result_p = (ecma_bigint_digit_t *) jmem_heap_alloc_block_null_on_error (size);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return result_p;\n  }\n\n  if (shift_left == 0)\n  {\n    JERRY_ASSERT (extend);\n\n    size -= (uint32_t) sizeof (ecma_bigint_digit_t);\n    *(ecma_bigint_digit_t *) (((uint8_t *) result_p) + size) = 0;\n\n    memcpy (result_p, source_p, size);\n    return result_p;\n  }\n\n  ecma_bigint_digit_t *destination_p = result_p;\n  ecma_bigint_digit_t carry = 0;\n  uint32_t shift_right = (1 << ECMA_BIGINT_DIGIT_SHIFT) - shift_left;\n\n  do\n  {\n    ecma_bigint_digit_t value = *source_p++;\n\n    *destination_p++ = (value << shift_left) | carry;\n    carry = value >> shift_right;\n  } while (source_p < end_p);\n\n  if (extend)\n  {\n    *destination_p++ = carry;\n  }\n\n  return result_p;\n} /* ecma_big_uint_div_shift_left */\n\n/**\n * Divide left BigUInt value with right BigUInt value\n *\n * return new BigUInt value, NULL on error\n */\necma_extended_primitive_t *\necma_big_uint_div_mod (ecma_extended_primitive_t *dividend_value_p, /**< divider BigUInt value */\n                       ecma_extended_primitive_t *divisor_value_p, /**< divisor BigUInt value */\n                       bool is_mod) /**< true if return with remainder instead of quotient */\n{\n  /* This algorithm is based on Donald Knuth’s \"Algorithm D\" */\n  uint32_t divisor_size = ECMA_BIGINT_GET_SIZE (divisor_value_p);\n\n  JERRY_ASSERT (divisor_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (divisor_value_p, divisor_size) != 0);\n\n  /* The divisor must have at least two digits, so the single digit case is handled separately. */\n  if (divisor_size == sizeof (ecma_bigint_digit_t))\n  {\n    return ecma_big_uint_div_digit (dividend_value_p, *ECMA_BIGINT_GET_DIGITS (divisor_value_p, 0), is_mod);\n  }\n\n  /* D1. [Normalize] */\n  ecma_bigint_digit_t divisor_high = ECMA_BIGINT_GET_LAST_DIGIT (divisor_value_p, divisor_size);\n  ecma_bigint_digit_t shift_left = ecma_big_uint_count_leading_zero (divisor_high);\n  ecma_bigint_digit_t *buffer_p = ecma_big_uint_div_shift_left (dividend_value_p, shift_left, true);\n\n  if (JERRY_UNLIKELY (buffer_p == NULL))\n  {\n    return NULL;\n  }\n\n  uint32_t dividend_size = ECMA_BIGINT_GET_SIZE (dividend_value_p);\n  ecma_extended_primitive_t *result_p = NULL;\n  ecma_bigint_digit_t *divisor_p;\n\n  JERRY_ASSERT (dividend_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (dividend_value_p, dividend_size) != 0);\n  JERRY_ASSERT (dividend_size >= divisor_size);\n\n  if (shift_left > 0)\n  {\n    divisor_p = ecma_big_uint_div_shift_left (divisor_value_p, shift_left, false);\n\n    if (JERRY_UNLIKELY (divisor_p == NULL))\n    {\n      goto error;\n    }\n  }\n  else\n  {\n    divisor_p = ECMA_BIGINT_GET_DIGITS (divisor_value_p, 0);\n  }\n\n  ecma_bigint_digit_t *dividend_end_p = (ecma_bigint_digit_t *) (((uint8_t *) buffer_p) + dividend_size);\n  ecma_bigint_digit_t *dividend_p = (ecma_bigint_digit_t *) (((uint8_t *) dividend_end_p) - divisor_size);\n  ecma_bigint_digit_t *divisor_end_p = (ecma_bigint_digit_t *) (((uint8_t *) divisor_p) + divisor_size);\n  ecma_bigint_digit_t divisor_low = divisor_end_p[-2];\n\n  divisor_high = divisor_end_p[-1];\n  JERRY_ASSERT ((divisor_high & (((ecma_bigint_digit_t) 1) << (8 * sizeof (ecma_bigint_digit_t) - 1))) != 0);\n\n  do\n  {\n    /* D3. [Calculate Q′] */\n    ecma_bigint_digit_t result_div;\n\n    /* This do-while(false) statement allows local declarations and early exit. */\n    do\n    {\n      ecma_bigint_digit_t result_mod;\n\n      if (dividend_end_p[0] < divisor_high)\n      {\n        ecma_bigint_two_digits_t dividend = dividend_end_p[-1] | ECMA_BIGINT_HIGH_DIGIT (dividend_end_p[0]);\n        result_div = (ecma_bigint_digit_t) (dividend / divisor_high);\n        result_mod = (ecma_bigint_digit_t) (dividend % divisor_high);\n      }\n      else\n      {\n        JERRY_ASSERT (dividend_end_p[0] == divisor_high && dividend_end_p[-1] < divisor_high);\n\n        result_div = ~((ecma_bigint_digit_t) 0);\n        result_mod = dividend_end_p[-1] + divisor_high;\n\n        if (result_mod < divisor_high)\n        {\n          break;\n        }\n      }\n\n      ecma_bigint_two_digits_t low_digits = ((ecma_bigint_two_digits_t) result_div) * divisor_low;\n\n      while (low_digits > (ECMA_BIGINT_HIGH_DIGIT (result_mod) | divisor_low))\n      {\n        result_div--;\n        result_mod += divisor_high;\n\n        /* If result_mod becomes a two digit long number, the condition of the loop must be true,\n         * so the loop can be aborted. This loop stops after maximum of two iterations, since\n         * the highest bit of divisor_high is set. */\n        if (result_mod < divisor_high)\n        {\n          break;\n        }\n\n        /* Subtraction is faster than recomputing result_div * divisor_low. */\n        low_digits -= divisor_low;\n      }\n    } while (false);\n\n    /* D4. [Multiply and subtract] */\n    ecma_bigint_digit_t *destination_p = dividend_p;\n    ecma_bigint_digit_t *source_p = divisor_p;\n    ecma_bigint_digit_t carry = 0;\n\n    do\n    {\n      ecma_bigint_two_digits_t multiply_result = ((ecma_bigint_two_digits_t) (*source_p++)) * result_div;\n      ecma_bigint_digit_t multiply_result_low, new_carry;\n      ecma_bigint_digit_t value = *destination_p;\n\n      /* The new carry never overflows. See the comment in ecma_big_uint_mul. */\n      new_carry = (ecma_bigint_digit_t) (multiply_result >> (8 * sizeof (ecma_bigint_digit_t)));\n      multiply_result_low = (ecma_bigint_digit_t) multiply_result;\n\n      if (value < multiply_result_low)\n      {\n        new_carry++;\n      }\n\n      value -= multiply_result_low;\n\n      if (value < carry)\n      {\n        new_carry++;\n      }\n\n      *destination_p++ = value - carry;\n      carry = new_carry;\n    } while (source_p < divisor_end_p);\n\n    bool negative_result = *destination_p < carry;\n    *destination_p -= carry;\n\n    if (negative_result)\n    {\n      /* D6. [Add back] */\n      result_div--;\n\n      destination_p = dividend_p;\n      source_p = divisor_p;\n      carry = 0;\n\n      do\n      {\n        ecma_bigint_digit_t left = *destination_p;\n\n        if (carry == 0 || left != ~(ecma_bigint_digit_t) 0)\n        {\n          left += carry;\n          carry = 0;\n        }\n        else\n        {\n          left = 0;\n          carry = 1;\n        }\n\n        ecma_bigint_digit_t right = *source_p++;\n        left += right;\n\n        if (left < right)\n        {\n          JERRY_ASSERT (carry == 0);\n          carry = 1;\n        }\n\n        *destination_p++ = left;\n      } while (source_p < divisor_end_p);\n    }\n\n    *dividend_end_p = result_div;\n\n    dividend_p--;\n    dividend_end_p--;\n  } while (dividend_p >= buffer_p);\n\n  ecma_bigint_digit_t *source_p;\n  ecma_bigint_digit_t *source_end_p;\n\n  if (is_mod)\n  {\n    source_p = buffer_p;\n    source_end_p = dividend_end_p;\n\n    while (source_end_p > source_p && *source_end_p == 0)\n    {\n      source_end_p--;\n    }\n\n    if ((*source_end_p >> shift_left) != 0)\n    {\n      source_end_p++;\n      /* This is required to reset carry below. */\n      *source_end_p = 0;\n    }\n  }\n  else\n  {\n    source_p = dividend_end_p + 1;\n    source_end_p = (ecma_bigint_digit_t *) (((uint8_t *) buffer_p) + dividend_size);\n\n    if (*source_end_p != 0)\n    {\n      source_end_p++;\n    }\n  }\n\n  result_p = ECMA_BIGINT_POINTER_TO_ZERO;\n\n  if (source_p < source_end_p)\n  {\n    result_p = ecma_bigint_create ((uint32_t) ((uint8_t *) source_end_p - (uint8_t *) source_p));\n\n    if (result_p != NULL)\n    {\n      ecma_bigint_digit_t *destination_p = ECMA_BIGINT_GET_DIGITS (result_p, 0);\n\n      if (is_mod && shift_left > 0)\n      {\n        ecma_bigint_digit_t shift_right = shift_left;\n\n        shift_left = (ecma_bigint_digit_t) (8 * (sizeof (ecma_bigint_digit_t)) - shift_left);\n        destination_p += source_end_p - source_p;\n\n        ecma_bigint_digit_t carry = *source_end_p << shift_left;\n\n        do\n        {\n          ecma_bigint_digit_t value = *(--source_end_p);\n\n          *(--destination_p) = (value >> shift_right) | carry;\n          carry = value << shift_left;\n        } while (source_end_p > source_p);\n      }\n      else\n      {\n        memcpy (destination_p, source_p, (size_t) ((uint8_t *) source_end_p - (uint8_t *) source_p));\n      }\n    }\n  }\n\nerror:\n  jmem_heap_free_block (buffer_p, dividend_size + sizeof (ecma_bigint_digit_t));\n\n  if (shift_left > 0 && divisor_p != NULL)\n  {\n    jmem_heap_free_block (divisor_p, divisor_size);\n  }\n\n  return result_p;\n} /* ecma_big_uint_div_mod */\n\n/**\n * Shift left BigUInt values by an uint32 value\n *\n * return new BigUInt value, NULL on error\n */\necma_extended_primitive_t *\necma_big_uint_shift_left (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */\n                          uint32_t right_value) /**< shift value */\n{\n  JERRY_ASSERT (right_value > 0);\n\n  uint32_t left_size = ECMA_BIGINT_GET_SIZE (left_value_p);\n  JERRY_ASSERT (left_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) != 0);\n\n  uint32_t zero_size = (right_value >> ECMA_BIGINT_DIGIT_SHIFT) * (uint32_t) sizeof (ecma_bigint_digit_t);\n  uint32_t result_size = left_size + zero_size;\n\n  uint32_t shift_left = right_value & ((1 << ECMA_BIGINT_DIGIT_SHIFT) - 1);\n  uint32_t shift_right = (1 << ECMA_BIGINT_DIGIT_SHIFT) - shift_left;\n\n  if (shift_left > 0 && (ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) >> shift_right) != 0)\n  {\n    result_size += (uint32_t) sizeof (ecma_bigint_digit_t);\n  }\n\n  if (result_size > ECMA_BIGINT_MAX_SIZE)\n  {\n    return NULL;\n  }\n\n  ecma_extended_primitive_t *result_value_p = ecma_bigint_create (result_size);\n\n  if (JERRY_UNLIKELY (result_value_p == NULL))\n  {\n    return NULL;\n  }\n\n  ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);\n  ecma_bigint_digit_t *result_p = ECMA_BIGINT_GET_DIGITS (result_value_p, 0);\n\n  if (zero_size > 0)\n  {\n    memset (result_p, 0, zero_size);\n    result_p = (ecma_bigint_digit_t *) (((uint8_t *) result_p) + zero_size);\n  }\n\n  if (shift_left == 0)\n  {\n    /* Shift by full digits. */\n    memcpy (result_p, left_p, left_size);\n    return result_value_p;\n  }\n\n  ecma_bigint_digit_t *left_end_p = ECMA_BIGINT_GET_DIGITS (left_value_p, left_size);\n  ecma_bigint_digit_t carry = 0;\n\n  do\n  {\n    ecma_bigint_digit_t value = *left_p++;\n\n    *result_p++ = (value << shift_left) | carry;\n    carry = value >> shift_right;\n  } while (left_p < left_end_p);\n\n  if (carry > 0)\n  {\n    *result_p = carry;\n  }\n\n  return result_value_p;\n} /* ecma_big_uint_shift_left */\n\n/**\n * Shift right BigUInt values by an uint32 value\n *\n * @return new BigUInt value, NULL on error\n */\necma_extended_primitive_t *\necma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */\n                           uint32_t right_value, /**< shift value */\n                           bool increase_result) /**< increase result */\n{\n  JERRY_ASSERT (right_value > 0);\n\n  uint32_t left_size = ECMA_BIGINT_GET_SIZE (left_value_p);\n  JERRY_ASSERT (left_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) != 0);\n\n  uint32_t crop_size = (right_value >> ECMA_BIGINT_DIGIT_SHIFT) * (uint32_t) sizeof (ecma_bigint_digit_t);\n\n  uint32_t shift_right = right_value & ((1 << ECMA_BIGINT_DIGIT_SHIFT) - 1);\n  uint32_t shift_left = (1 << ECMA_BIGINT_DIGIT_SHIFT) - shift_right;\n  ecma_bigint_digit_t carry = 0;\n\n  if (shift_right > 0 && (ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) >> shift_right) == 0)\n  {\n    carry = ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) << shift_left;\n    left_size -= (uint32_t) sizeof (ecma_bigint_digit_t);\n  }\n\n  if (left_size <= crop_size)\n  {\n    if (JERRY_LIKELY (!increase_result))\n    {\n      return ECMA_BIGINT_POINTER_TO_ZERO;\n    }\n\n    ecma_extended_primitive_t *result_value_p = ecma_bigint_create (sizeof (ecma_bigint_digit_t));\n    if (result_value_p != NULL)\n    {\n      *ECMA_BIGINT_GET_DIGITS (result_value_p, 0) = 1;\n    }\n    return result_value_p;\n  }\n\n  if (JERRY_UNLIKELY (increase_result)\n      && (shift_right == 0 || (*ECMA_BIGINT_GET_DIGITS (left_value_p, crop_size) << shift_left) == 0))\n  {\n    ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);\n    ecma_bigint_digit_t *left_end_p = ECMA_BIGINT_GET_DIGITS (left_value_p, crop_size);\n\n    while (left_p < left_end_p)\n    {\n      if (*left_p != 0)\n      {\n        break;\n      }\n      left_p++;\n    }\n\n    if (left_p == left_end_p)\n    {\n      increase_result = false;\n    }\n  }\n\n  uint32_t size = left_size - crop_size;\n  ecma_extended_primitive_t *result_value_p = ecma_bigint_create (size);\n\n  if (JERRY_UNLIKELY (result_value_p == NULL))\n  {\n    return NULL;\n  }\n\n  if (shift_right == 0)\n  {\n    memcpy (ECMA_BIGINT_GET_DIGITS (result_value_p, 0), ECMA_BIGINT_GET_DIGITS (left_value_p, crop_size), size);\n\n    if (JERRY_LIKELY (!increase_result))\n    {\n      return result_value_p;\n    }\n    return ecma_big_uint_increase_result (result_value_p);\n  }\n\n  ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, left_size);\n  ecma_bigint_digit_t *result_p = ECMA_BIGINT_GET_DIGITS (result_value_p, size);\n  ecma_bigint_digit_t *end_p = ECMA_BIGINT_GET_DIGITS (result_value_p, 0);\n\n  do\n  {\n    ecma_bigint_digit_t value = *(--left_p);\n\n    *(--result_p) = (value >> shift_right) | carry;\n    carry = value << shift_left;\n  } while (result_p > end_p);\n\n  if (JERRY_LIKELY (!increase_result))\n  {\n    return result_value_p;\n  }\n  return ecma_big_uint_increase_result (result_value_p);\n} /* ecma_big_uint_shift_right */\n\n/**\n * Compute the left value raised to the power of right value\n *\n * return new BigUInt value, NULL on error\n */\necma_extended_primitive_t *\necma_big_uint_pow (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */\n                   uint32_t right_value) /**< power value */\n{\n  ecma_extended_primitive_t *result_p = ECMA_BIGINT_NUMBER_IS_ODD (right_value) ? left_value_p : NULL;\n  ecma_extended_primitive_t *square_p = left_value_p;\n\n  JERRY_ASSERT (right_value >= 2);\n\n  while (true)\n  {\n    ecma_extended_primitive_t *new_square_p = ecma_big_uint_mul (square_p, square_p);\n\n    if (JERRY_UNLIKELY (new_square_p == NULL))\n    {\n      if (result_p != NULL && result_p != left_value_p)\n      {\n        ecma_deref_bigint (result_p);\n      }\n      result_p = NULL;\n      break;\n    }\n\n    if (square_p != left_value_p)\n    {\n      ecma_deref_bigint (square_p);\n    }\n\n    square_p = new_square_p;\n    right_value >>= 1;\n\n    if (ECMA_BIGINT_NUMBER_IS_ODD (right_value))\n    {\n      if (result_p != NULL)\n      {\n        ecma_extended_primitive_t *new_result_p = ecma_big_uint_mul (square_p, result_p);\n\n        if (result_p != left_value_p)\n        {\n          ecma_deref_bigint (result_p);\n        }\n\n        result_p = new_result_p;\n      }\n      else\n      {\n        ecma_ref_extended_primitive (square_p);\n        result_p = square_p;\n      }\n\n      if (JERRY_UNLIKELY (result_p == NULL) || right_value == 1)\n      {\n        break;\n      }\n    }\n  }\n\n  if (square_p != left_value_p)\n  {\n    ecma_deref_bigint (square_p);\n  }\n\n  return result_p;\n} /* ecma_big_uint_pow */\n\n/**\n * Perform bitwise operations on two BigUInt numbers\n *\n * return new BigUInt value, NULL on error\n */\necma_extended_primitive_t *\necma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation type and options */\n                          ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */\n                          ecma_extended_primitive_t *right_value_p) /**< right BigUInt value */\n{\n  uint32_t left_size = ECMA_BIGINT_GET_SIZE (left_value_p);\n  uint32_t right_size = ECMA_BIGINT_GET_SIZE (right_value_p);\n\n  JERRY_ASSERT (left_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) != 0);\n  JERRY_ASSERT (right_size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (right_value_p, right_size) != 0);\n\n  uint32_t operation_type = ECMA_BIGINT_BITWISE_GET_OPERATION_TYPE (operation_and_options);\n\n  switch (operation_type)\n  {\n    case ECMA_BIG_UINT_BITWISE_AND:\n    {\n      if (left_size > right_size)\n      {\n        left_size = right_size;\n        break;\n      }\n      /* FALLTHRU */\n    }\n    case ECMA_BIG_UINT_BITWISE_AND_NOT:\n    {\n      if (right_size > left_size)\n      {\n        right_size = left_size;\n      }\n      break;\n    }\n    default:\n    {\n      JERRY_ASSERT (operation_type == ECMA_BIG_UINT_BITWISE_OR || operation_type == ECMA_BIG_UINT_BITWISE_XOR);\n\n      if (right_size <= left_size)\n      {\n        break;\n      }\n\n      /* Swap values. */\n      ecma_extended_primitive_t *tmp_value_p = left_value_p;\n      left_value_p = right_value_p;\n      right_value_p = tmp_value_p;\n\n      uint32_t tmp_size = left_size;\n      left_size = right_size;\n      right_size = tmp_size;\n\n      uint32_t decrease_opts = (operation_and_options & ECMA_BIG_UINT_BITWISE_DECREASE_BOTH);\n\n      /* When exactly one bit is set, invert both bits. */\n      if (decrease_opts >= ECMA_BIG_UINT_BITWISE_DECREASE_LEFT && decrease_opts <= ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT)\n      {\n        operation_and_options ^= ECMA_BIG_UINT_BITWISE_DECREASE_BOTH;\n      }\n      break;\n    }\n  }\n\n  ecma_extended_primitive_t *result_value_p = ecma_bigint_create (left_size);\n\n  if (JERRY_UNLIKELY (result_value_p == NULL))\n  {\n    return NULL;\n  }\n\n  ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);\n  ecma_bigint_digit_t *right_p = ECMA_BIGINT_GET_DIGITS (right_value_p, 0);\n  ecma_bigint_digit_t *result_p = ECMA_BIGINT_GET_DIGITS (result_value_p, 0);\n  ecma_bigint_digit_t *result_end_p = ECMA_BIGINT_GET_DIGITS (result_value_p, right_size);\n\n  if (!(operation_and_options & ECMA_BIG_UINT_BITWISE_DECREASE_BOTH))\n  {\n    JERRY_ASSERT (!(operation_and_options & ECMA_BIG_UINT_BITWISE_INCREASE_RESULT));\n\n    if (operation_type == ECMA_BIG_UINT_BITWISE_AND)\n    {\n      do\n      {\n        *result_p++ = *left_p++ & *right_p++;\n      } while (result_p < result_end_p);\n\n      if (result_p[-1] == 0)\n      {\n        return ecma_big_uint_normalize_result (result_value_p, result_p);\n      }\n      return result_value_p;\n    }\n\n    if (operation_type == ECMA_BIG_UINT_BITWISE_OR)\n    {\n      do\n      {\n        *result_p++ = *left_p++ | *right_p++;\n      } while (result_p < result_end_p);\n\n      if (left_size > right_size)\n      {\n        memcpy (result_p, left_p, left_size - right_size);\n      }\n      return result_value_p;\n    }\n\n    JERRY_ASSERT (operation_type == ECMA_BIG_UINT_BITWISE_XOR);\n\n    do\n    {\n      *result_p++ = *left_p++ ^ *right_p++;\n    } while (result_p < result_end_p);\n\n    if (left_size > right_size)\n    {\n      memcpy (result_p, left_p, left_size - right_size);\n      return result_value_p;\n    }\n\n    if (result_p[-1] == 0)\n    {\n      return ecma_big_uint_normalize_result (result_value_p, result_p);\n    }\n    return result_value_p;\n  }\n\n  uint32_t left_carry = 0, right_carry = 0;\n\n  if (operation_and_options & ECMA_BIG_UINT_BITWISE_DECREASE_LEFT)\n  {\n    left_carry = 1;\n  }\n\n  if (operation_and_options & ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT)\n  {\n    right_carry = 1;\n  }\n\n  do\n  {\n    ecma_bigint_digit_t left = (*left_p++) - left_carry;\n\n    if (left != ~((ecma_bigint_digit_t) 0))\n    {\n      left_carry = 0;\n    }\n\n    ecma_bigint_digit_t right = (*right_p++) - right_carry;\n\n    if (right != ~((ecma_bigint_digit_t) 0))\n    {\n      right_carry = 0;\n    }\n\n    switch (operation_type)\n    {\n      case ECMA_BIG_UINT_BITWISE_AND:\n      {\n        *result_p++ = left & right;\n        break;\n      }\n      case ECMA_BIG_UINT_BITWISE_OR:\n      {\n        *result_p++ = left | right;\n        break;\n      }\n      case ECMA_BIG_UINT_BITWISE_XOR:\n      {\n        *result_p++ = left ^ right;\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (operation_type == ECMA_BIG_UINT_BITWISE_AND_NOT);\n        *result_p++ = left & ~right;\n        break;\n      }\n    }\n  } while (result_p < result_end_p);\n\n  if (operation_type != ECMA_BIG_UINT_BITWISE_AND)\n  {\n    result_end_p = ECMA_BIGINT_GET_DIGITS (result_value_p, left_size);\n\n    if (left_carry > 0)\n    {\n      while (*left_p == 0)\n      {\n        *result_p++ = ~((ecma_bigint_digit_t) 0);\n        left_p++;\n\n        JERRY_ASSERT (result_p < result_end_p);\n      }\n\n      *result_p++ = *left_p++ - 1;\n    }\n\n    if (result_p < result_end_p)\n    {\n      memcpy (result_p, left_p, (size_t) ((uint8_t *) result_end_p - (uint8_t *) result_p));\n\n      if (operation_and_options & ECMA_BIG_UINT_BITWISE_INCREASE_RESULT)\n      {\n        return ecma_big_uint_increase_result (result_value_p);\n      }\n      return result_value_p;\n    }\n  }\n\n  if (operation_and_options & ECMA_BIG_UINT_BITWISE_INCREASE_RESULT)\n  {\n    return ecma_big_uint_increase_result (result_value_p);\n  }\n\n  if (result_p[-1] == 0)\n  {\n    return ecma_big_uint_normalize_result (result_value_p, result_p);\n  }\n  return result_value_p;\n} /* ecma_big_uint_bitwise_op */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-big-uint.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_BIG_UINT_H\n#define ECMA_BIG_UINT_H\n\n#include \"ecma-globals.h\"\n\n#if JERRY_BUILTIN_BIGINT\n\n/**\n * Limit of BigUInt memory allocation in JerryScript.\n */\n#define ECMA_BIGINT_MAX_SIZE 0x10000\n\n/**\n * Unsigned type which can hold two digits.\n */\ntypedef uint64_t ecma_bigint_two_digits_t;\n\n/**\n * Shift used by left/right shifting of a value.\n */\n#define ECMA_BIGINT_DIGIT_SHIFT 5\n\n/**\n * Return with the digits of a BigInt value.\n */\n#define ECMA_BIGINT_GET_DIGITS(value_p, offset) \\\n  ((ecma_bigint_digit_t *) (((uint8_t *) (value_p)) + sizeof (ecma_extended_primitive_t) + (offset)))\n\n/**\n * Return with the digits of a BigInt value.\n */\n#define ECMA_BIGINT_GET_LAST_DIGIT(value_p, size) *ECMA_BIGINT_GET_DIGITS (value_p, size - sizeof (ecma_bigint_digit_t))\n\n/**\n * Returns true if size is an odd number.\n */\n#define ECMA_BIGINT_SIZE_IS_ODD(size) (((size) & sizeof (ecma_bigint_digit_t)) != 0)\n\n/**\n * Returns a two digit value where the high digit is set to the passed digit.\n */\n#define ECMA_BIGINT_HIGH_DIGIT(digit) (((ecma_bigint_two_digits_t) digit) << (8 * sizeof (ecma_bigint_digit_t)))\n\n/**\n * Tells whether a number (usually a digit or uint32_t value) is an odd number.\n */\n#define ECMA_BIGINT_NUMBER_IS_ODD(number) ((number & 0x1) != 0)\n\n/**\n * Bitwise operation types.\n */\ntypedef enum\n{\n  ECMA_BIG_UINT_BITWISE_AND, /**< bitwise 'and' operation */\n  ECMA_BIG_UINT_BITWISE_OR, /**< bitwise 'or' operation */\n  ECMA_BIG_UINT_BITWISE_XOR, /**< bitwise 'xor' operation */\n  ECMA_BIG_UINT_BITWISE_AND_NOT, /**< bitwise 'and not' operation */\n} ecma_big_uint_bitwise_operation_types_t;\n\n/**\n * Returns with the type of the operation.\n */\n#define ECMA_BIGINT_BITWISE_GET_OPERATION_TYPE(operation_and_options) ((operation_and_options) &0xf)\n\n/**\n * Options for bitwise operations.\n */\ntypedef enum\n{\n  ECMA_BIG_UINT_BITWISE_DECREASE_LEFT = (1 << 4), /**< subtract 1 from left value */\n  ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT = (1 << 5), /**< subtract 1 from right value */\n  ECMA_BIG_UINT_BITWISE_INCREASE_RESULT = (1 << 6), /**< add 1 to the result */\n} ecma_big_uint_bitwise_options_t;\n\n/**\n * Subtract 1 from both left and right values.\n */\n#define ECMA_BIG_UINT_BITWISE_DECREASE_BOTH (ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT)\n\necma_extended_primitive_t *ecma_bigint_create (uint32_t size);\necma_extended_primitive_t *ecma_big_uint_extend (ecma_extended_primitive_t *value_p, ecma_bigint_digit_t digit);\n\necma_bigint_digit_t ecma_big_uint_count_leading_zero (ecma_bigint_digit_t digit);\n\nint ecma_big_uint_compare (ecma_extended_primitive_t *left_value_p, ecma_extended_primitive_t *right_value_p);\n\necma_extended_primitive_t *\necma_big_uint_mul_digit (ecma_extended_primitive_t *value_p, ecma_bigint_digit_t mul, ecma_bigint_digit_t add);\n\nuint8_t *ecma_big_uint_to_string (ecma_extended_primitive_t *value_p,\n                                  uint32_t radix,\n                                  uint32_t *char_start_p,\n                                  uint32_t *char_size_p);\n\necma_extended_primitive_t *ecma_big_uint_increase (ecma_extended_primitive_t *value_p);\necma_extended_primitive_t *ecma_big_uint_decrease (ecma_extended_primitive_t *value_p);\n\necma_extended_primitive_t *ecma_big_uint_add (ecma_extended_primitive_t *left_value_p,\n                                              ecma_extended_primitive_t *right_value_p);\necma_extended_primitive_t *ecma_big_uint_sub (ecma_extended_primitive_t *left_value_p,\n                                              ecma_extended_primitive_t *right_value_p);\necma_extended_primitive_t *ecma_big_uint_mul (ecma_extended_primitive_t *left_value_p,\n                                              ecma_extended_primitive_t *right_value_p);\necma_extended_primitive_t *ecma_big_uint_div_mod (ecma_extended_primitive_t *dividend_value_p,\n                                                  ecma_extended_primitive_t *divisor_value_p,\n                                                  bool is_mod);\n\necma_extended_primitive_t *ecma_big_uint_shift_left (ecma_extended_primitive_t *left_value_p, uint32_t right_value);\necma_extended_primitive_t *\necma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, uint32_t right_value, bool increase_result);\n\necma_extended_primitive_t *ecma_big_uint_pow (ecma_extended_primitive_t *left_value_p, uint32_t right_value);\n\necma_extended_primitive_t *ecma_big_uint_bitwise_op (uint32_t operation_and_options,\n                                                     ecma_extended_primitive_t *left_value_p,\n                                                     ecma_extended_primitive_t *right_value_p);\n\n#endif /* JERRY_BUILTIN_BIGINT */\n\n#endif /* ECMA_BIG_UINT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-bigint-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-bigint-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#if JERRY_BUILTIN_BIGINT\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabigintobject ECMA BigInt object related routines\n * @{\n */\n\n/**\n * BigInt object creation operation.\n *\n * See also: ECMA-262 v11, 7.1.18\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_create_bigint_object (ecma_value_t arg) /**< argument passed to the toObject operation */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (arg));\n\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_BIGINT_PROTOTYPE);\n\n  ecma_object_t *object_p =\n    ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_BIGINT;\n  ext_object_p->u.cls.u3.value = ecma_copy_value (arg);\n\n  return ecma_make_object_value (object_p);\n} /* ecma_op_create_bigint_object */\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-bigint-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_BIGINT_OBJECT_H\n#define ECMA_BIGINT_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n#if JERRY_BUILTIN_BIGINT\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabigintobject ECMA BigInt object related routines\n * @{\n */\n\necma_value_t ecma_op_create_bigint_object (ecma_value_t arg);\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n\n#endif /* !ECMA_BIGINT_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-bigint.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-bigint.h\"\n\n#include \"ecma-big-uint.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"lit-char-helpers.h\"\n\n#if JERRY_BUILTIN_BIGINT\n\n/**\n * Raise a not enough memory error\n *\n * @return ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_bigint_raise_memory_error (void)\n{\n  return ecma_raise_range_error (ECMA_ERR_ALLOCATE_BIGINT_VALUE);\n} /* ecma_bigint_raise_memory_error */\n\n/**\n * Create a single digit long BigInt value\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_bigint_create_from_digit (ecma_bigint_digit_t digit, /* single digit */\n                               bool sign) /* set ECMA_BIGINT_SIGN if true */\n{\n  JERRY_ASSERT (digit != 0);\n\n  ecma_extended_primitive_t *result_value_p = ecma_bigint_create (sizeof (ecma_bigint_digit_t));\n\n  if (JERRY_UNLIKELY (result_value_p == NULL))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  if (sign)\n  {\n    result_value_p->u.bigint_sign_and_size |= ECMA_BIGINT_SIGN;\n  }\n\n  *ECMA_BIGINT_GET_DIGITS (result_value_p, 0) = digit;\n  return ecma_make_extended_primitive_value (result_value_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_create_from_digit */\n\n/**\n * Parse a string and create a BigInt value\n *\n * @return ecma BigInt value or a special value allowed by the option flags\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_parse_string (const lit_utf8_byte_t *string_p, /**< string represenation of the BigInt */\n                          lit_utf8_size_t size, /**< string size */\n                          uint32_t options) /**< ecma_bigint_parse_string_options_t option bits */\n{\n  ecma_bigint_digit_t radix = 10;\n  uint32_t sign = (options & ECMA_BIGINT_PARSE_SET_NEGATIVE) ? ECMA_BIGINT_SIGN : 0;\n  bool allow_underscore = options & ECMA_BIGINT_PARSE_ALLOW_UNDERSCORE;\n\n  const lit_utf8_byte_t *string_end_p = string_p + size;\n  string_p = ecma_string_trim_front (string_p, string_p + size);\n  size = (lit_utf8_size_t) (string_end_p - string_p);\n\n  if (size >= 3 && string_p[0] == LIT_CHAR_0)\n  {\n    radix = lit_char_to_radix (string_p[1]);\n\n    if (radix != 10)\n    {\n      string_p += 2;\n      size -= 2;\n    }\n  }\n  else if (size >= 2)\n  {\n    if (string_p[0] == LIT_CHAR_PLUS)\n    {\n      size--;\n      string_p++;\n    }\n    else if (string_p[0] == LIT_CHAR_MINUS)\n    {\n      sign = ECMA_BIGINT_SIGN;\n      size--;\n      string_p++;\n    }\n  }\n  else if (size == 0)\n  {\n    return ECMA_BIGINT_ZERO;\n  }\n\n  while (string_p < string_end_p && (*string_p == LIT_CHAR_0 || (*string_p == LIT_CHAR_UNDERSCORE && allow_underscore)))\n  {\n    string_p++;\n  }\n\n  ecma_extended_primitive_t *result_p = NULL;\n\n  if (string_p == string_end_p)\n  {\n    return ECMA_BIGINT_ZERO;\n  }\n\n  do\n  {\n    ecma_bigint_digit_t digit = radix;\n\n    if (*string_p >= LIT_CHAR_0 && *string_p <= LIT_CHAR_9)\n    {\n      digit = (ecma_bigint_digit_t) (*string_p - LIT_CHAR_0);\n    }\n    else if (*string_p == LIT_CHAR_UNDERSCORE && allow_underscore)\n    {\n      continue;\n    }\n    else\n    {\n      lit_utf8_byte_t character = (lit_utf8_byte_t) LEXER_TO_ASCII_LOWERCASE (*string_p);\n\n      if (character >= LIT_CHAR_LOWERCASE_A && character <= LIT_CHAR_LOWERCASE_F)\n      {\n        digit = (ecma_bigint_digit_t) (character - (LIT_CHAR_LOWERCASE_A - 10));\n      }\n      else if (ecma_string_trim_front (string_p, string_end_p) == string_end_p)\n      {\n        string_p = string_end_p;\n        break;\n      }\n    }\n    if (digit >= radix)\n    {\n      if (result_p != NULL)\n      {\n        ecma_deref_bigint (result_p);\n      }\n\n      if (options & ECMA_BIGINT_PARSE_DISALLOW_SYNTAX_ERROR)\n      {\n        return ECMA_VALUE_FALSE;\n      }\n      return ecma_raise_syntax_error (ECMA_ERR_STRING_CANNOT_BE_CONVERTED_TO_BIGINT_VALUE);\n    }\n\n    result_p = ecma_big_uint_mul_digit (result_p, radix, digit);\n\n    if (JERRY_UNLIKELY (result_p == NULL))\n    {\n      break;\n    }\n  } while (++string_p < string_end_p);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    if (options & ECMA_BIGINT_PARSE_DISALLOW_MEMORY_ERROR)\n    {\n      return ECMA_VALUE_NULL;\n    }\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  result_p->u.bigint_sign_and_size |= sign;\n  return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_parse_string */\n\n/**\n * Parse a string value and create a BigInt value\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_parse_string_value (ecma_value_t string, /**< ecma string */\n                                uint32_t options) /**< ecma_bigint_parse_string_options_t option bits */\n{\n  JERRY_ASSERT (ecma_is_value_string (string));\n\n  ECMA_STRING_TO_UTF8_STRING (ecma_get_string_from_value (string), string_buffer_p, string_buffer_size);\n\n  ecma_value_t result = ecma_bigint_parse_string (string_buffer_p, string_buffer_size, options);\n  ECMA_FINALIZE_UTF8_STRING (string_buffer_p, string_buffer_size);\n\n  return result;\n} /* ecma_bigint_parse_string_value */\n\n/**\n * Create a string representation for a BigInt value\n *\n * @return ecma string or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_string_t *\necma_bigint_to_string (ecma_value_t value, /**< BigInt value */\n                       ecma_bigint_digit_t radix) /**< conversion radix */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (value));\n\n  if (value == ECMA_BIGINT_ZERO)\n  {\n    return ecma_new_ecma_string_from_code_unit (LIT_CHAR_0);\n  }\n\n  uint32_t char_start_p, char_size_p;\n  ecma_extended_primitive_t *bigint_p = ecma_get_extended_primitive_from_value (value);\n  lit_utf8_byte_t *string_buffer_p = ecma_big_uint_to_string (bigint_p, radix, &char_start_p, &char_size_p);\n\n  if (JERRY_UNLIKELY (string_buffer_p == NULL))\n  {\n    ecma_raise_range_error (ECMA_ERR_ALLOCATE_BIGINT_STRING);\n    return NULL;\n  }\n\n  JERRY_ASSERT (char_start_p > 0);\n\n  if (bigint_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)\n  {\n    string_buffer_p[--char_start_p] = LIT_CHAR_MINUS;\n  }\n\n  ecma_string_t *string_p;\n  string_p = ecma_new_ecma_string_from_ascii (string_buffer_p + char_start_p, char_size_p - char_start_p);\n\n  jmem_heap_free_block (string_buffer_p, char_size_p);\n  return string_p;\n} /* ecma_bigint_to_string */\n\n/**\n * Get the size of zero digits from the result of ecma_bigint_number_to_digits\n */\n#define ECMA_BIGINT_NUMBER_TO_DIGITS_GET_ZERO_SIZE(value) (((value) &0xffff) * (uint32_t) sizeof (ecma_bigint_digit_t))\n\n/**\n * Get the number of digits from the result of ecma_bigint_number_to_digits\n */\n#define ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS(value) ((value) >> 20)\n\n/**\n * Get the size of digits from the result of ecma_bigint_number_to_digits\n */\n#define ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS_SIZE(value) \\\n  (ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS (value) * (uint32_t) sizeof (ecma_bigint_digit_t))\n\n/**\n * Set number of digits in the result of ecma_bigint_number_to_digits\n */\n#define ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS(value) ((uint32_t) (value) << 20)\n\n/**\n * This flag is set when the number passed to ecma_bigint_number_to_digits has fraction part\n */\n#define ECMA_BIGINT_NUMBER_TO_DIGITS_HAS_FRACTION 0x10000\n\n/**\n * Convert a number to maximum of 3 digits and left shift\n *\n * @return packed value, ECMA_BIGINT_NUMBER_TO_DIGITS* macros can be used to decode it\n */\nstatic uint32_t\necma_bigint_number_to_digits (ecma_number_t number, /**< ecma number */\n                              ecma_bigint_digit_t *digits_p) /**< [out] BigInt digits */\n{\n  if (ecma_number_is_zero (number))\n  {\n    return ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (0);\n  }\n\n  ecma_binary_num_t binary = ecma_number_to_binary (number);\n  uint32_t biased_exp = ecma_number_biased_exp (binary);\n  uint64_t fraction = ecma_number_fraction (binary);\n\n  if (biased_exp < ((1 << (ECMA_NUMBER_BIASED_EXP_WIDTH - 1)) - 1))\n  {\n    /* Number is less than 1. */\n    return ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (0) | ECMA_BIGINT_NUMBER_TO_DIGITS_HAS_FRACTION;\n  }\n\n  biased_exp -= ((1 << (ECMA_NUMBER_BIASED_EXP_WIDTH - 1)) - 1);\n  fraction |= ((uint64_t) 1) << ECMA_NUMBER_FRACTION_WIDTH;\n\n  if (biased_exp <= ECMA_NUMBER_FRACTION_WIDTH)\n  {\n    uint32_t has_fraction = 0;\n\n    if (biased_exp < ECMA_NUMBER_FRACTION_WIDTH\n        && (fraction << (biased_exp + ((8 * sizeof (uint64_t)) - ECMA_NUMBER_FRACTION_WIDTH))) != 0)\n    {\n      has_fraction |= ECMA_BIGINT_NUMBER_TO_DIGITS_HAS_FRACTION;\n    }\n\n    fraction >>= ECMA_NUMBER_FRACTION_WIDTH - biased_exp;\n    digits_p[0] = (ecma_bigint_digit_t) fraction;\n\n#if JERRY_NUMBER_TYPE_FLOAT64\n    digits_p[1] = (ecma_bigint_digit_t) (fraction >> (8 * sizeof (ecma_bigint_digit_t)));\n    return ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (digits_p[1] == 0 ? 1 : 2) | has_fraction;\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n    return ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (1) | has_fraction;\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n  }\n\n  digits_p[0] = (ecma_bigint_digit_t) fraction;\n#if JERRY_NUMBER_TYPE_FLOAT64\n  digits_p[1] = (ecma_bigint_digit_t) (fraction >> (8 * sizeof (ecma_bigint_digit_t)));\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n  biased_exp -= ECMA_NUMBER_FRACTION_WIDTH;\n\n  uint32_t shift_left = biased_exp & ((8 * sizeof (ecma_bigint_digit_t)) - 1);\n  biased_exp = biased_exp >> ECMA_BIGINT_DIGIT_SHIFT;\n\n  if (shift_left == 0)\n  {\n#if JERRY_NUMBER_TYPE_FLOAT64\n    return biased_exp | ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (2);\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n    return biased_exp | ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (1);\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n  }\n\n  uint32_t shift_right = (1 << ECMA_BIGINT_DIGIT_SHIFT) - shift_left;\n\n#if JERRY_NUMBER_TYPE_FLOAT64\n  digits_p[2] = digits_p[1] >> shift_right;\n  digits_p[1] = (digits_p[1] << shift_left) | (digits_p[0] >> shift_right);\n  digits_p[0] <<= shift_left;\n\n  return biased_exp | ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (digits_p[2] == 0 ? 2 : 3);\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n  digits_p[1] = digits_p[0] >> shift_right;\n  digits_p[0] <<= shift_left;\n\n  return biased_exp | ECMA_BIGINT_NUMBER_TO_DIGITS_SET_DIGITS (digits_p[1] == 0 ? 1 : 2);\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n} /* ecma_bigint_number_to_digits */\n\n/**\n * Convert an ecma number to BigInt value\n *\n * See also:\n *          ECMA-262 v11, 20.2.1.1.1\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_bigint_number_to_bigint (ecma_number_t number) /**< ecma number */\n{\n  if (ecma_number_is_nan (number) || ecma_number_is_infinity (number))\n  {\n    return ecma_raise_range_error (ECMA_ERR_INFINITY_OR_NAN_CANNOT_BE_CONVERTED_TO_BIGINT);\n  }\n\n  ecma_bigint_digit_t digits[3];\n  uint32_t result = ecma_bigint_number_to_digits (number, digits);\n\n  JERRY_ASSERT (ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS (result) == 0\n                || digits[ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS (result) - 1] > 0);\n\n  if (result & ECMA_BIGINT_NUMBER_TO_DIGITS_HAS_FRACTION)\n  {\n    return ecma_raise_range_error (ECMA_ERR_ONLY_INTEGER_NUMBERS_CAN_BE_CONVERTED_TO_BIGINT);\n  }\n\n  uint32_t digits_size = ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS_SIZE (result);\n\n  if (digits_size == 0)\n  {\n    return ECMA_BIGINT_ZERO;\n  }\n\n  uint32_t zero_size = ECMA_BIGINT_NUMBER_TO_DIGITS_GET_ZERO_SIZE (result);\n\n  ecma_extended_primitive_t *result_p = ecma_bigint_create (digits_size + zero_size);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  uint8_t *data_p = (uint8_t *) ECMA_BIGINT_GET_DIGITS (result_p, 0);\n  memset (data_p, 0, zero_size);\n  memcpy (data_p + zero_size, digits, digits_size);\n\n  if (number < 0)\n  {\n    result_p->u.bigint_sign_and_size |= ECMA_BIGINT_SIGN;\n  }\n\n  return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_number_to_bigint */\n\n/**\n * Convert a value to BigInt value\n *\n * See also:\n *          ECMA-262 v11, 7.1.13\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_to_bigint (ecma_value_t value, /**< any value */\n                       bool allow_numbers) /**< converting ecma numbers is allowed */\n{\n  bool free_value = false;\n\n  if (ecma_is_value_object (value))\n  {\n    value = ecma_op_object_default_value (ecma_get_object_from_value (value), ECMA_PREFERRED_TYPE_NUMBER);\n    free_value = true;\n\n    if (ECMA_IS_VALUE_ERROR (value))\n    {\n      return value;\n    }\n  }\n\n  ecma_value_t result;\n\n  if (ecma_is_value_string (value))\n  {\n    result = ecma_bigint_parse_string_value (value, ECMA_BIGINT_PARSE_NO_OPTIONS);\n  }\n  else if (ecma_is_value_bigint (value))\n  {\n    result = value;\n\n    if (!free_value && value != ECMA_BIGINT_ZERO)\n    {\n      ecma_ref_extended_primitive (ecma_get_extended_primitive_from_value (value));\n    }\n    else\n    {\n      free_value = false;\n    }\n  }\n  else if (allow_numbers && ecma_is_value_number (value))\n  {\n    result = ecma_bigint_number_to_bigint (ecma_get_number_from_value (value));\n  }\n  else if (ecma_is_value_false (value))\n  {\n    result = ECMA_BIGINT_ZERO;\n  }\n  else if (ecma_is_value_true (value))\n  {\n    result = ecma_bigint_create_from_digit (1, false);\n  }\n  else\n  {\n    result = ecma_raise_type_error (ECMA_ERR_VALUE_CANNOT_BE_CONVERTED_TO_BIGINT);\n  }\n\n  if (free_value)\n  {\n    ecma_free_value (value);\n  }\n\n  return result;\n} /* ecma_bigint_to_bigint */\n\n/**\n * Convert a BigInt value to number value\n *\n * @return ecma number value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_to_number (ecma_value_t value) /**< BigInt value */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (value));\n\n  if (value == ECMA_BIGINT_ZERO)\n  {\n    return ecma_make_integer_value (0);\n  }\n\n  ecma_extended_primitive_t *value_p = ecma_get_extended_primitive_from_value (value);\n  uint32_t size = ECMA_BIGINT_GET_SIZE (value_p);\n  ecma_bigint_digit_t *digits_p = ECMA_BIGINT_GET_DIGITS (value_p, size);\n\n  if (size == sizeof (ecma_bigint_digit_t))\n  {\n    if (!(value_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))\n    {\n      if (digits_p[-1] <= ECMA_INTEGER_NUMBER_MAX)\n      {\n        return ecma_make_integer_value ((ecma_integer_value_t) digits_p[-1]);\n      }\n    }\n    else if (digits_p[-1] <= -ECMA_INTEGER_NUMBER_MIN)\n    {\n      return ecma_make_integer_value (-(ecma_integer_value_t) digits_p[-1]);\n    }\n  }\n\n  uint64_t fraction = 0;\n  ecma_bigint_digit_t shift_left;\n\n  if (digits_p[-1] == 1)\n  {\n    JERRY_ASSERT (size > sizeof (ecma_bigint_digit_t));\n\n    fraction = ((uint64_t) digits_p[-2]) << (8 * sizeof (ecma_bigint_digit_t));\n    shift_left = (uint32_t) (8 * sizeof (ecma_bigint_digit_t));\n\n    if (size >= 3 * sizeof (ecma_bigint_digit_t))\n    {\n      fraction |= (uint64_t) digits_p[-3];\n    }\n  }\n  else\n  {\n    shift_left = ecma_big_uint_count_leading_zero (digits_p[-1]) + 1;\n\n    fraction = ((uint64_t) digits_p[-1]) << (8 * sizeof (ecma_bigint_digit_t) + shift_left);\n\n    if (size >= 2 * sizeof (ecma_bigint_digit_t))\n    {\n      fraction |= ((uint64_t) digits_p[-2]) << shift_left;\n    }\n\n    if (size >= 3 * sizeof (ecma_bigint_digit_t))\n    {\n      fraction |= ((uint64_t) digits_p[-3]) >> (8 * sizeof (ecma_bigint_digit_t) - shift_left);\n    }\n  }\n\n  uint32_t biased_exp = (uint32_t) (((1 << (ECMA_NUMBER_BIASED_EXP_WIDTH - 1)) - 1) + (size * 8 - shift_left));\n\n  /* Rounding result. */\n  const uint64_t rounding_bit = (((uint64_t) 1) << (8 * sizeof (uint64_t) - ECMA_NUMBER_FRACTION_WIDTH - 1));\n  bool round_up = false;\n\n  if (fraction & rounding_bit)\n  {\n    round_up = true;\n\n    /* IEEE_754 roundTiesToEven mode: when rounding_bit is set, and all the remaining bits\n     * are zero, the number needs to be rounded down the bit before rounding_bit is zero. */\n    if ((fraction & ((rounding_bit << 2) - 1)) == rounding_bit)\n    {\n      round_up = false;\n\n      if ((size >= (3 * sizeof (ecma_bigint_digit_t)))\n          && (shift_left == (8 * sizeof (ecma_bigint_digit_t))\n              || (digits_p[-3] & ((((ecma_bigint_digit_t) 1) << shift_left) - 1)) == 0))\n      {\n        ecma_bigint_digit_t *digits_start_p = ECMA_BIGINT_GET_DIGITS (value_p, 0);\n\n        digits_p -= 3;\n\n        while (digits_p > digits_start_p)\n        {\n          if (digits_p[-1] != 0)\n          {\n            round_up = true;\n            break;\n          }\n          digits_p--;\n        }\n      }\n    }\n  }\n\n  if (round_up)\n  {\n    fraction += rounding_bit;\n    fraction >>= (8 * sizeof (uint64_t) - ECMA_NUMBER_FRACTION_WIDTH);\n\n    if (fraction == 0)\n    {\n      biased_exp++;\n    }\n  }\n  else\n  {\n    fraction >>= (8 * sizeof (uint64_t) - ECMA_NUMBER_FRACTION_WIDTH);\n  }\n\n  bool sign = (value_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN);\n  ecma_number_t result;\n\n  if (biased_exp < (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1)\n  {\n    result = ecma_number_create (sign, biased_exp, fraction);\n  }\n  else\n  {\n    result = ecma_number_make_infinity (sign);\n  }\n\n  return ecma_make_number_value (result);\n} /* ecma_bigint_to_number */\n\n/**\n * Returns with a BigInt if the value is BigInt,\n * or the value is object, and its default value is BigInt\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_get_bigint (ecma_value_t value, /**< any value */\n                        bool *free_result_p) /**< [out] result should be freed */\n{\n  *free_result_p = false;\n\n  if (ecma_is_value_bigint (value))\n  {\n    return value;\n  }\n\n  if (ecma_is_value_object (value))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (value);\n    ecma_value_t default_value = ecma_op_object_default_value (object_p, ECMA_PREFERRED_TYPE_NUMBER);\n\n    if (ECMA_IS_VALUE_ERROR (default_value))\n    {\n      return default_value;\n    }\n\n    if (ecma_is_value_bigint (default_value))\n    {\n      *free_result_p = (default_value != ECMA_BIGINT_ZERO);\n      return default_value;\n    }\n\n    ecma_free_value (default_value);\n  }\n\n  return ecma_raise_type_error (ECMA_ERR_CONVERT_BIGINT_TO_NUMBER);\n} /* ecma_bigint_get_bigint */\n\n/**\n * Create BigInt value from uint64 digits\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_create_from_digits (const uint64_t *digits_p, /**< BigInt digits */\n                                uint32_t size, /**< number of BigInt digits */\n                                bool sign) /**< sign bit, true if the result should be negative */\n{\n  const uint64_t *digits_end_p = digits_p + size;\n\n  while (digits_end_p > digits_p && digits_end_p[-1] == 0)\n  {\n    digits_end_p--;\n  }\n\n  if (digits_p == digits_end_p)\n  {\n    return ECMA_BIGINT_ZERO;\n  }\n\n  size = (uint32_t) (digits_end_p - digits_p);\n\n  if (size < ECMA_BIGINT_MAX_SIZE)\n  {\n    size *= (uint32_t) sizeof (uint64_t);\n  }\n\n  if ((digits_end_p[-1] >> (8 * sizeof (ecma_bigint_digit_t))) == 0)\n  {\n    size -= (uint32_t) sizeof (ecma_bigint_digit_t);\n  }\n\n  ecma_extended_primitive_t *result_value_p = ecma_bigint_create (size);\n\n  if (JERRY_UNLIKELY (result_value_p == NULL))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  if (sign)\n  {\n    result_value_p->u.bigint_sign_and_size |= ECMA_BIGINT_SIGN;\n  }\n\n  ecma_bigint_digit_t *result_p = ECMA_BIGINT_GET_DIGITS (result_value_p, 0);\n\n  while (digits_p < digits_end_p)\n  {\n    uint64_t digit = *digits_p++;\n\n    result_p[0] = (ecma_bigint_digit_t) digit;\n    result_p[1] = (ecma_bigint_digit_t) (digit >> (8 * sizeof (ecma_bigint_digit_t)));\n    result_p += 2;\n  }\n\n  return ecma_make_extended_primitive_value (result_value_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_create_from_digits */\n\n/**\n * Get the number of uint64 digits of a BigInt value\n *\n * @return number of uint64 digits\n */\nuint32_t\necma_bigint_get_size_in_digits (ecma_value_t value) /**< BigInt value */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (value));\n\n  if (value == ECMA_BIGINT_ZERO)\n  {\n    return 0;\n  }\n\n  ecma_extended_primitive_t *value_p = ecma_get_extended_primitive_from_value (value);\n  uint32_t size = ECMA_BIGINT_GET_SIZE (value_p);\n\n  return (size + (uint32_t) sizeof (ecma_bigint_digit_t)) / sizeof (uint64_t);\n} /* ecma_bigint_get_size_in_digits */\n\n/**\n * Get the uint64 digits of a BigInt value\n */\nvoid\necma_bigint_get_digits_and_sign (ecma_value_t value, /**< BigInt value */\n                                 uint64_t *digits_p, /**< [out] buffer for digits */\n                                 uint32_t size, /**< buffer size in digits */\n                                 bool *sign_p) /**< [out] sign of BigInt */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (value));\n\n  if (value == ECMA_BIGINT_ZERO)\n  {\n    if (sign_p != NULL)\n    {\n      *sign_p = false;\n    }\n    memset (digits_p, 0, size * sizeof (uint64_t));\n    return;\n  }\n\n  ecma_extended_primitive_t *value_p = ecma_get_extended_primitive_from_value (value);\n\n  if (sign_p != NULL)\n  {\n    *sign_p = (value_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN) != 0;\n  }\n\n  uint32_t bigint_size = ECMA_BIGINT_GET_SIZE (value_p);\n  uint32_t copy_size = bigint_size / sizeof (uint64_t);\n\n  if (copy_size > size)\n  {\n    copy_size = size;\n  }\n\n  const uint64_t *digits_end_p = digits_p + copy_size;\n  ecma_bigint_digit_t *source_p = ECMA_BIGINT_GET_DIGITS (value_p, 0);\n\n  while (digits_p < digits_end_p)\n  {\n    *digits_p++ = source_p[0] | (((uint64_t) source_p[1]) << (8 * sizeof (ecma_bigint_digit_t)));\n    source_p += 2;\n  }\n\n  size -= copy_size;\n\n  if (size == 0)\n  {\n    return;\n  }\n\n  if (ECMA_BIGINT_SIZE_IS_ODD (bigint_size))\n  {\n    *digits_p++ = source_p[0];\n    size--;\n  }\n\n  if (size > 0)\n  {\n    memset (digits_p, 0, size * sizeof (uint64_t));\n  }\n} /* ecma_bigint_get_digits_and_sign */\n\n/**\n * Compare two BigInt values\n *\n * @return true if they are the same, false otherwise\n */\nbool\necma_bigint_is_equal_to_bigint (ecma_value_t left_value, /**< left BigInt value */\n                                ecma_value_t right_value) /**< right BigInt value */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (left_value) && ecma_is_value_bigint (right_value));\n\n  if (left_value == ECMA_BIGINT_ZERO)\n  {\n    return right_value == ECMA_BIGINT_ZERO;\n  }\n  else if (right_value == ECMA_BIGINT_ZERO)\n  {\n    return false;\n  }\n\n  ecma_extended_primitive_t *left_p = ecma_get_extended_primitive_from_value (left_value);\n  ecma_extended_primitive_t *right_p = ecma_get_extended_primitive_from_value (right_value);\n\n  if (left_p->u.bigint_sign_and_size != right_p->u.bigint_sign_and_size)\n  {\n    return false;\n  }\n\n  uint32_t size = ECMA_BIGINT_GET_SIZE (left_p);\n  return memcmp (ECMA_BIGINT_GET_DIGITS (left_p, 0), ECMA_BIGINT_GET_DIGITS (right_p, 0), size) == 0;\n} /* ecma_bigint_is_equal_to_bigint */\n\n/**\n * Compare a BigInt value and a number\n *\n * @return true if they are the same, false otherwise\n */\nbool\necma_bigint_is_equal_to_number (ecma_value_t left_value, /**< left BigInt value */\n                                ecma_number_t right_value) /**< right number value */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (left_value));\n\n  if (ecma_number_is_nan (right_value) || ecma_number_is_infinity (right_value))\n  {\n    return false;\n  }\n\n  if (left_value == ECMA_BIGINT_ZERO)\n  {\n    return right_value == 0;\n  }\n\n  ecma_extended_primitive_t *left_value_p = ecma_get_extended_primitive_from_value (left_value);\n\n  /* Sign must be the same. */\n  if (left_value_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)\n  {\n    if (right_value > 0)\n    {\n      return false;\n    }\n  }\n  else if (right_value < 0)\n  {\n    return false;\n  }\n\n  ecma_bigint_digit_t digits[3];\n  uint32_t result = ecma_bigint_number_to_digits (right_value, digits);\n\n  JERRY_ASSERT (ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS (result) == 0\n                || digits[ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS (result) - 1] > 0);\n\n  if (result & ECMA_BIGINT_NUMBER_TO_DIGITS_HAS_FRACTION)\n  {\n    return false;\n  }\n\n  uint32_t digits_size = ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS_SIZE (result);\n  uint32_t zero_size = ECMA_BIGINT_NUMBER_TO_DIGITS_GET_ZERO_SIZE (result);\n\n  if (ECMA_BIGINT_GET_SIZE (left_value_p) != digits_size + zero_size)\n  {\n    return false;\n  }\n\n  ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);\n  ecma_bigint_digit_t *left_end_p = (ecma_bigint_digit_t *) (((uint8_t *) left_p) + zero_size);\n\n  /* Check value bits first. */\n  if (memcmp (left_end_p, digits, digits_size) != 0)\n  {\n    return false;\n  }\n\n  while (left_p < left_end_p)\n  {\n    if (*left_p++ != 0)\n    {\n      return false;\n    }\n  }\n\n  return true;\n} /* ecma_bigint_is_equal_to_number */\n\n/**\n * Convert 0 to 1, and 1 to -1. Useful for getting sign.\n */\n#define ECMA_BIGINT_TO_SIGN(value) (1 - (((int) (value)) << 1))\n\n/**\n * Convert 0 to -1, and 1 to 1. Useful for getting negated sign.\n */\n#define ECMA_BIGINT_TO_NEGATED_SIGN(value) (-1 + (((int) (value)) << 1))\n\n/**\n * Compare two BigInt values\n *\n * return -1, if left value < right value, 0 if they are equal, 1 otherwise\n */\nint\necma_bigint_compare_to_bigint (ecma_value_t left_value, /**< left BigInt value */\n                               ecma_value_t right_value) /**< right BigInt value */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (left_value) && ecma_is_value_bigint (right_value));\n\n  if (left_value == ECMA_BIGINT_ZERO)\n  {\n    if (right_value == ECMA_BIGINT_ZERO)\n    {\n      return 0;\n    }\n\n    ecma_extended_primitive_t *right_p = ecma_get_extended_primitive_from_value (right_value);\n    return ECMA_BIGINT_TO_NEGATED_SIGN (right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN);\n  }\n\n  ecma_extended_primitive_t *left_p = ecma_get_extended_primitive_from_value (left_value);\n  uint32_t left_sign = left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN;\n\n  if (right_value == ECMA_BIGINT_ZERO)\n  {\n    return ECMA_BIGINT_TO_SIGN (left_sign);\n  }\n\n  ecma_extended_primitive_t *right_p = ecma_get_extended_primitive_from_value (right_value);\n  uint32_t right_sign = right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN;\n\n  if ((left_sign ^ right_sign) != 0)\n  {\n    return ECMA_BIGINT_TO_SIGN (left_sign);\n  }\n\n  if (left_sign == 0)\n  {\n    return ecma_big_uint_compare (left_p, right_p);\n  }\n\n  return -ecma_big_uint_compare (left_p, right_p);\n} /* ecma_bigint_compare_to_bigint */\n\n/**\n * Compare a BigInt value and a number\n *\n * return -1, if left value < right value, 0 if they are equal, 1 otherwise\n */\nint\necma_bigint_compare_to_number (ecma_value_t left_value, /**< left BigInt value */\n                               ecma_number_t right_value) /**< right number value */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (left_value));\n  JERRY_ASSERT (!ecma_number_is_nan (right_value));\n\n  int right_invert_sign = ECMA_BIGINT_TO_SIGN (right_value > 0);\n\n  if (left_value == ECMA_BIGINT_ZERO)\n  {\n    if (right_value == 0)\n    {\n      return 0;\n    }\n\n    return right_invert_sign;\n  }\n\n  ecma_extended_primitive_t *left_value_p = ecma_get_extended_primitive_from_value (left_value);\n  int left_sign = ECMA_BIGINT_TO_SIGN (left_value_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN);\n\n  if (right_value == 0 || left_sign == right_invert_sign)\n  {\n    /* Second condition: a positive BigInt is always greater than any negative number, and the opposite is true. */\n    return left_sign;\n  }\n\n  if (ecma_number_is_infinity (right_value))\n  {\n    /* Infinity is always bigger than any BigInt number. */\n    return right_invert_sign;\n  }\n\n  ecma_bigint_digit_t digits[3];\n  uint32_t result = ecma_bigint_number_to_digits (right_value, digits);\n\n  JERRY_ASSERT (ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS (result) == 0\n                || digits[ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS (result) - 1] > 0);\n\n  uint32_t digits_size = ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS_SIZE (result);\n\n  if (digits_size == 0)\n  {\n    JERRY_ASSERT (result & ECMA_BIGINT_NUMBER_TO_DIGITS_HAS_FRACTION);\n    /* The number is between [-1 .. 1] exclusive. */\n    return left_sign;\n  }\n\n  uint32_t left_size = ECMA_BIGINT_GET_SIZE (left_value_p);\n  uint32_t right_size = digits_size + ECMA_BIGINT_NUMBER_TO_DIGITS_GET_ZERO_SIZE (result);\n\n  if (left_size != right_size)\n  {\n    return left_size > right_size ? left_sign : -left_sign;\n  }\n\n  ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, right_size);\n  ecma_bigint_digit_t *left_end_p = (ecma_bigint_digit_t *) (((uint8_t *) left_p) - digits_size);\n  ecma_bigint_digit_t *digits_p = (ecma_bigint_digit_t *) (((uint8_t *) digits) + digits_size);\n\n  do\n  {\n    ecma_bigint_digit_t left = *(--left_p);\n    ecma_bigint_digit_t right = *(--digits_p);\n\n    if (left != right)\n    {\n      return left > right ? left_sign : -left_sign;\n    }\n  } while (left_p > left_end_p);\n\n  left_end_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);\n\n  while (left_p > left_end_p)\n  {\n    if (*(--left_p) != 0)\n    {\n      return left_sign;\n    }\n  }\n\n  return (result & ECMA_BIGINT_NUMBER_TO_DIGITS_HAS_FRACTION) ? -left_sign : 0;\n} /* ecma_bigint_compare_to_number */\n\n#undef ECMA_BIGINT_TO_SIGN\n\n/**\n * Negate a non-zero BigInt value\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_negate (ecma_extended_primitive_t *value_p) /**< BigInt value */\n{\n  uint32_t size = ECMA_BIGINT_GET_SIZE (value_p);\n\n  JERRY_ASSERT (size > 0 && ECMA_BIGINT_GET_LAST_DIGIT (value_p, size) != 0);\n\n  ecma_extended_primitive_t *result_p = ecma_bigint_create (size);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  memcpy (result_p + 1, value_p + 1, size);\n  result_p->refs_and_type = ECMA_EXTENDED_PRIMITIVE_REF_ONE | ECMA_TYPE_BIGINT;\n  result_p->u.bigint_sign_and_size = value_p->u.bigint_sign_and_size ^ ECMA_BIGINT_SIGN;\n\n  return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_negate */\n\n/**\n * Invert all bits of a BigInt value\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_unary (ecma_value_t value, /**< BigInt value */\n                   ecma_bigint_unary_operation_type type) /**< type of unary operation */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (value));\n\n  if (value == ECMA_BIGINT_ZERO)\n  {\n    return ecma_bigint_create_from_digit (1, type != ECMA_BIGINT_UNARY_INCREASE);\n  }\n\n  ecma_extended_primitive_t *value_p = ecma_get_extended_primitive_from_value (value);\n\n  uint32_t sign = (type != ECMA_BIGINT_UNARY_DECREASE) ? ECMA_BIGINT_SIGN : 0;\n\n  if ((value_p->u.bigint_sign_and_size == (uint32_t) (sizeof (ecma_bigint_digit_t) | sign))\n      && *ECMA_BIGINT_GET_DIGITS (value_p, 0) == 1)\n  {\n    return ECMA_BIGINT_ZERO;\n  }\n\n  ecma_extended_primitive_t *result_p;\n\n  if ((value_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN) == (sign ^ ECMA_BIGINT_SIGN))\n  {\n    result_p = ecma_big_uint_increase (value_p);\n\n    if (type != ECMA_BIGINT_UNARY_INCREASE && result_p != NULL)\n    {\n      result_p->u.bigint_sign_and_size |= ECMA_BIGINT_SIGN;\n    }\n  }\n  else\n  {\n    result_p = ecma_big_uint_decrease (value_p);\n\n    if (type == ECMA_BIGINT_UNARY_INCREASE && result_p != NULL)\n    {\n      result_p->u.bigint_sign_and_size |= ECMA_BIGINT_SIGN;\n    }\n  }\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_unary */\n\n/**\n * Add/subtract right BigInt value to/from left BigInt value\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_add_sub (ecma_value_t left_value, /**< left BigInt value */\n                     ecma_value_t right_value, /**< right BigInt value */\n                     bool is_add) /**< true if add operation should be performed */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (left_value) && ecma_is_value_bigint (right_value));\n\n  if (right_value == ECMA_BIGINT_ZERO)\n  {\n    return ecma_copy_value (left_value);\n  }\n\n  ecma_extended_primitive_t *right_p = ecma_get_extended_primitive_from_value (right_value);\n\n  if (left_value == ECMA_BIGINT_ZERO)\n  {\n    if (!is_add)\n    {\n      return ecma_bigint_negate (right_p);\n    }\n\n    ecma_ref_extended_primitive (right_p);\n    return right_value;\n  }\n\n  ecma_extended_primitive_t *left_p = ecma_get_extended_primitive_from_value (left_value);\n  uint32_t sign = is_add ? 0 : ECMA_BIGINT_SIGN;\n\n  if (((left_p->u.bigint_sign_and_size ^ right_p->u.bigint_sign_and_size) & ECMA_BIGINT_SIGN) == sign)\n  {\n    ecma_extended_primitive_t *result_p = ecma_big_uint_add (left_p, right_p);\n\n    if (JERRY_UNLIKELY (result_p == NULL))\n    {\n      return ecma_bigint_raise_memory_error ();\n    }\n\n    result_p->u.bigint_sign_and_size |= left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN;\n    return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n  }\n\n  int compare_result = ecma_big_uint_compare (left_p, right_p);\n  ecma_extended_primitive_t *result_p;\n\n  if (compare_result == 0)\n  {\n    return ECMA_BIGINT_ZERO;\n  }\n\n  if (compare_result > 0)\n  {\n    sign = left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN;\n    result_p = ecma_big_uint_sub (left_p, right_p);\n  }\n  else\n  {\n    sign = right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN;\n\n    if (!is_add)\n    {\n      sign ^= ECMA_BIGINT_SIGN;\n    }\n\n    result_p = ecma_big_uint_sub (right_p, left_p);\n  }\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  result_p->u.bigint_sign_and_size |= sign;\n  return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_add_sub */\n\n/**\n * Multiply two BigInt values\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_mul (ecma_value_t left_value, /**< left BigInt value */\n                 ecma_value_t right_value) /**< right BigInt value */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (left_value) && ecma_is_value_bigint (right_value));\n\n  if (left_value == ECMA_BIGINT_ZERO || right_value == ECMA_BIGINT_ZERO)\n  {\n    return ECMA_BIGINT_ZERO;\n  }\n\n  ecma_extended_primitive_t *left_p = ecma_get_extended_primitive_from_value (left_value);\n  ecma_extended_primitive_t *right_p = ecma_get_extended_primitive_from_value (right_value);\n  uint32_t left_size = ECMA_BIGINT_GET_SIZE (left_p);\n  uint32_t right_size = ECMA_BIGINT_GET_SIZE (right_p);\n\n  if (left_size == sizeof (ecma_bigint_digit_t)\n      && ECMA_BIGINT_GET_LAST_DIGIT (left_p, sizeof (ecma_bigint_digit_t)) == 1)\n  {\n    if (left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)\n    {\n      return ecma_bigint_negate (right_p);\n    }\n\n    ecma_ref_extended_primitive (right_p);\n    return right_value;\n  }\n\n  if (right_size == sizeof (ecma_bigint_digit_t)\n      && ECMA_BIGINT_GET_LAST_DIGIT (right_p, sizeof (ecma_bigint_digit_t)) == 1)\n  {\n    if (right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)\n    {\n      return ecma_bigint_negate (left_p);\n    }\n\n    ecma_ref_extended_primitive (left_p);\n    return left_value;\n  }\n\n  ecma_extended_primitive_t *result_p = ecma_big_uint_mul (left_p, right_p);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  uint32_t sign = (left_p->u.bigint_sign_and_size ^ right_p->u.bigint_sign_and_size) & ECMA_BIGINT_SIGN;\n  result_p->u.bigint_sign_and_size |= sign;\n  return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_mul */\n\n/**\n * Divide two BigInt values\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_div_mod (ecma_value_t left_value, /**< left BigInt value */\n                     ecma_value_t right_value, /**< right BigInt value */\n                     bool is_mod) /**< true if return with remainder */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (left_value) && ecma_is_value_bigint (right_value));\n\n  if (right_value == ECMA_BIGINT_ZERO)\n  {\n    return ecma_raise_range_error (ECMA_ERR_BIGINT_ZERO_DIVISION);\n  }\n\n  if (left_value == ECMA_BIGINT_ZERO)\n  {\n    return left_value;\n  }\n\n  ecma_extended_primitive_t *left_p = ecma_get_extended_primitive_from_value (left_value);\n  ecma_extended_primitive_t *right_p = ecma_get_extended_primitive_from_value (right_value);\n\n  int compare_result = ecma_big_uint_compare (left_p, right_p);\n  ecma_extended_primitive_t *result_p;\n\n  if (compare_result < 0)\n  {\n    if (!is_mod)\n    {\n      return ECMA_BIGINT_ZERO;\n    }\n\n    ecma_ref_extended_primitive (left_p);\n    return left_value;\n  }\n  else if (compare_result == 0)\n  {\n    if (is_mod)\n    {\n      return ECMA_BIGINT_ZERO;\n    }\n\n    result_p = ecma_bigint_create (sizeof (ecma_bigint_digit_t));\n\n    if (result_p != NULL)\n    {\n      *ECMA_BIGINT_GET_DIGITS (result_p, 0) = 1;\n    }\n  }\n  else\n  {\n    result_p = ecma_big_uint_div_mod (left_p, right_p, is_mod);\n\n    if (result_p == ECMA_BIGINT_POINTER_TO_ZERO)\n    {\n      return ECMA_BIGINT_ZERO;\n    }\n  }\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  if (is_mod)\n  {\n    result_p->u.bigint_sign_and_size |= left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN;\n  }\n  else\n  {\n    uint32_t sign = (left_p->u.bigint_sign_and_size ^ right_p->u.bigint_sign_and_size) & ECMA_BIGINT_SIGN;\n    result_p->u.bigint_sign_and_size |= sign;\n  }\n\n  return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_div_mod */\n\n/**\n * Shift left BigInt value to left or right\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_shift (ecma_value_t left_value, /**< left BigInt value */\n                   ecma_value_t right_value, /**< right BigInt value */\n                   bool is_left) /**< true if left shift operation should be performed */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (left_value) && ecma_is_value_bigint (right_value));\n\n  if (left_value == ECMA_BIGINT_ZERO)\n  {\n    return ECMA_BIGINT_ZERO;\n  }\n\n  ecma_extended_primitive_t *left_p = ecma_get_extended_primitive_from_value (left_value);\n\n  if (right_value == ECMA_BIGINT_ZERO)\n  {\n    ecma_ref_extended_primitive (left_p);\n    return left_value;\n  }\n\n  ecma_extended_primitive_t *right_p = ecma_get_extended_primitive_from_value (right_value);\n\n  if (right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)\n  {\n    is_left = !is_left;\n  }\n\n  if (ECMA_BIGINT_GET_SIZE (right_p) > sizeof (ecma_bigint_digit_t))\n  {\n    if (is_left)\n    {\n      return ecma_bigint_raise_memory_error ();\n    }\n    else if (left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)\n    {\n      /* Shifting a negative value with a very big number to the right should be -1. */\n      return ecma_bigint_create_from_digit (1, true);\n    }\n\n    return ECMA_BIGINT_ZERO;\n  }\n\n  ecma_extended_primitive_t *result_p;\n  ecma_bigint_digit_t shift = ECMA_BIGINT_GET_LAST_DIGIT (right_p, sizeof (ecma_bigint_digit_t));\n  uint32_t left_sign = left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN;\n\n  if (is_left)\n  {\n    result_p = ecma_big_uint_shift_left (left_p, shift);\n  }\n  else\n  {\n    /* -x >> y == ~(x - 1) >> y == ~((x - 1) >> y) == -(((x - 1) >> y) + 1)\n     * When a non-zero bit is shifted out: (x - 1) >> y == x >> y, so the formula is -((x >> y) + 1)\n     * When only zero bits are shifted out: (((x - 1) >> y) + 1) == x >> y so the formula is: -(x >> y) */\n    result_p = ecma_big_uint_shift_right (left_p, shift, left_sign != 0);\n\n    if (result_p == ECMA_BIGINT_POINTER_TO_ZERO)\n    {\n      return ECMA_BIGINT_ZERO;\n    }\n  }\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  result_p->u.bigint_sign_and_size |= left_sign;\n  return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_shift */\n\n/**\n * Compute the left value raised to the power of right value\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_pow (ecma_value_t left_value, /**< left BigInt value */\n                 ecma_value_t right_value) /**< right BigInt value */\n{\n  JERRY_ASSERT (ecma_is_value_bigint (left_value) && ecma_is_value_bigint (right_value));\n\n  if (right_value == ECMA_BIGINT_ZERO)\n  {\n    return ecma_bigint_create_from_digit (1, false);\n  }\n\n  ecma_extended_primitive_t *right_p = ecma_get_extended_primitive_from_value (right_value);\n\n  if (right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)\n  {\n    return ecma_raise_range_error (ECMA_ERR_NEGATIVE_EXPONENT_IS_NOT_ALLOWED_FOR_BIGINTS);\n  }\n\n  if (left_value == ECMA_BIGINT_ZERO)\n  {\n    return ECMA_BIGINT_ZERO;\n  }\n\n  ecma_extended_primitive_t *left_p = ecma_get_extended_primitive_from_value (left_value);\n  ecma_bigint_digit_t base = 0;\n\n  if (ECMA_BIGINT_GET_SIZE (left_p) == sizeof (ecma_bigint_digit_t))\n  {\n    base = *ECMA_BIGINT_GET_DIGITS (left_p, 0);\n\n    JERRY_ASSERT (base != 0);\n\n    if (base == 1)\n    {\n      if (!(left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)\n          || ECMA_BIGINT_NUMBER_IS_ODD (*ECMA_BIGINT_GET_DIGITS (right_p, 0)))\n      {\n        ecma_ref_extended_primitive (left_p);\n        return left_value;\n      }\n\n      return ecma_bigint_create_from_digit (1, false);\n    }\n  }\n\n  if (JERRY_UNLIKELY (ECMA_BIGINT_GET_SIZE (right_p) > sizeof (ecma_bigint_digit_t)))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  ecma_bigint_digit_t power = *ECMA_BIGINT_GET_DIGITS (right_p, 0);\n\n  if (power == 1)\n  {\n    ecma_ref_extended_primitive (left_p);\n    return left_value;\n  }\n\n  ecma_extended_primitive_t *result_p;\n\n  if (base == 2)\n  {\n    result_p = ecma_big_uint_shift_left (left_p, power - 1);\n  }\n  else\n  {\n    result_p = ecma_big_uint_pow (left_p, power);\n  }\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  if ((left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN) && ECMA_BIGINT_NUMBER_IS_ODD (power))\n  {\n    result_p->u.bigint_sign_and_size |= ECMA_BIGINT_SIGN;\n  }\n\n  return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_pow */\n\n/**\n * Convert the result to an ecma value\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_bigint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation type and options */\n                        ecma_extended_primitive_t *left_value_p, /**< left BigInt value */\n                        ecma_extended_primitive_t *right_value_p) /**< right BigInt value */\n{\n  ecma_extended_primitive_t *result_p;\n  result_p = ecma_big_uint_bitwise_op (operation_and_options, left_value_p, right_value_p);\n\n  if (JERRY_UNLIKELY (result_p == NULL))\n  {\n    return ecma_bigint_raise_memory_error ();\n  }\n\n  if (result_p == ECMA_BIGINT_POINTER_TO_ZERO)\n  {\n    return ECMA_BIGINT_ZERO;\n  }\n\n  if (operation_and_options & ECMA_BIG_UINT_BITWISE_INCREASE_RESULT)\n  {\n    result_p->u.bigint_sign_and_size |= ECMA_BIGINT_SIGN;\n  }\n\n  return ecma_make_extended_primitive_value (result_p, ECMA_TYPE_BIGINT);\n} /* ecma_bigint_bitwise_op */\n\n/**\n * Perform bitwise 'and' operations on two BigUInt numbers\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_and (ecma_value_t left_value, /**< left BigInt value */\n                 ecma_value_t right_value) /**< right BigInt value */\n{\n  if (left_value == ECMA_BIGINT_ZERO || right_value == ECMA_BIGINT_ZERO)\n  {\n    return ECMA_BIGINT_ZERO;\n  }\n\n  ecma_extended_primitive_t *left_p = ecma_get_extended_primitive_from_value (left_value);\n  ecma_extended_primitive_t *right_p = ecma_get_extended_primitive_from_value (right_value);\n\n  if (!(left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))\n  {\n    if (!(right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))\n    {\n      return ecma_bigint_bitwise_op (ECMA_BIG_UINT_BITWISE_AND, left_p, right_p);\n    }\n\n    /* x & (-y) == x & ~(y-1) == x &~ (y-1) */\n    uint32_t operation_and_options = ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT;\n    return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);\n  }\n\n  if (!(right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))\n  {\n    /* (-x) & y == ~(x-1) & y == y &~ (x-1) */\n    uint32_t operation_and_options = ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT;\n    return ecma_bigint_bitwise_op (operation_and_options, right_p, left_p);\n  }\n\n  /* (-x) & (-y) == ~(x-1) & ~(y-1) == ~((x-1) | (y-1)) == -(((x-1) | (y-1)) + 1) */\n  uint32_t operation_and_options =\n    (ECMA_BIG_UINT_BITWISE_OR | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);\n  return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);\n} /* ecma_bigint_and */\n\n/**\n * Perform bitwise 'or' operations on two BigUInt numbers\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_or (ecma_value_t left_value, /**< left BigInt value */\n                ecma_value_t right_value) /**< right BigInt value */\n{\n  if (left_value == ECMA_BIGINT_ZERO)\n  {\n    return ecma_copy_value (right_value);\n  }\n\n  if (right_value == ECMA_BIGINT_ZERO)\n  {\n    return ecma_copy_value (left_value);\n  }\n\n  ecma_extended_primitive_t *left_p = ecma_get_extended_primitive_from_value (left_value);\n  ecma_extended_primitive_t *right_p = ecma_get_extended_primitive_from_value (right_value);\n\n  if (!(left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))\n  {\n    if (!(right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))\n    {\n      return ecma_bigint_bitwise_op (ECMA_BIG_UINT_BITWISE_OR, left_p, right_p);\n    }\n\n    /* x | (-y) == x | ~(y-1) == ~((y-1) &~ x) == -(((y-1) &~ x) + 1) */\n    uint32_t operation_and_options =\n      (ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);\n    return ecma_bigint_bitwise_op (operation_and_options, right_p, left_p);\n  }\n\n  if (!(right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))\n  {\n    /* (-x) | y == ~(x-1) | y == ~((x-1) &~ y) == -(((x-1) &~ y) + 1) */\n    uint32_t operation_and_options =\n      (ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);\n    return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);\n  }\n\n  /* (-x) | (-y) == ~(x-1) | ~(y-1) == ~((x-1) & (y-1)) = -(((x-1) & (y-1)) + 1) */\n  uint32_t operation_and_options =\n    (ECMA_BIG_UINT_BITWISE_AND | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);\n  return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);\n} /* ecma_bigint_or */\n\n/**\n * Perform bitwise 'xor' operations on two BigUInt numbers\n *\n * @return ecma BigInt value or ECMA_VALUE_ERROR\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_bigint_xor (ecma_value_t left_value, /**< left BigInt value */\n                 ecma_value_t right_value) /**< right BigInt value */\n{\n  if (left_value == ECMA_BIGINT_ZERO)\n  {\n    return ecma_copy_value (right_value);\n  }\n\n  if (right_value == ECMA_BIGINT_ZERO)\n  {\n    return ecma_copy_value (left_value);\n  }\n\n  ecma_extended_primitive_t *left_p = ecma_get_extended_primitive_from_value (left_value);\n  ecma_extended_primitive_t *right_p = ecma_get_extended_primitive_from_value (right_value);\n\n  if (!(left_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))\n  {\n    if (!(right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))\n    {\n      return ecma_bigint_bitwise_op (ECMA_BIG_UINT_BITWISE_XOR, left_p, right_p);\n    }\n\n    /* x ^ (-y) == x ^ ~(y-1) == ~(x ^ (y-1)) == -((x ^ (y-1)) + 1) */\n    uint32_t operation_and_options =\n      (ECMA_BIG_UINT_BITWISE_XOR | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);\n    return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);\n  }\n\n  if (!(right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))\n  {\n    /* (-x) | y == ~(x-1) ^ y == ~((x-1) ^ y) == -(((x-1) ^ y) + 1) */\n    uint32_t operation_and_options =\n      (ECMA_BIG_UINT_BITWISE_XOR | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);\n    return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);\n  }\n\n  /* (-x) ^ (-y) == ~(x-1) ^ ~(y-1) == (x-1) ^ (y-1) */\n  uint32_t operation_and_options = ECMA_BIG_UINT_BITWISE_XOR | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH;\n  return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);\n} /* ecma_bigint_xor */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-bigint.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_BIG_INT_H\n#define ECMA_BIG_INT_H\n\n#include \"ecma-globals.h\"\n\n#if JERRY_BUILTIN_BIGINT\n\n/**\n * Sign bit of a BigInt value. The number is negative, if this bit is set.\n */\n#define ECMA_BIGINT_SIGN 0x1\n\n/**\n * Flags for ecma_bigint_parse_string.\n */\ntypedef enum\n{\n  ECMA_BIGINT_PARSE_NO_OPTIONS = 0, /**< no options */\n  ECMA_BIGINT_PARSE_SET_NEGATIVE = (1 << 0), /**< return with a negative BigInt value */\n  ECMA_BIGINT_PARSE_DISALLOW_SYNTAX_ERROR = (1 << 1), /**< don't throw SyntaxError,\n                                                       *   return with ECMA_VALUE_FALSE */\n  ECMA_BIGINT_PARSE_DISALLOW_MEMORY_ERROR = (1 << 2), /**< don't throw out-of-memory error,\n                                                       *   return with ECMA_VALUE_NULL instead */\n  ECMA_BIGINT_PARSE_ALLOW_UNDERSCORE = (1 << 3), /** allow parse underscore characters */\n} ecma_bigint_parse_string_options_t;\n\n/**\n * Types for unary operations\n */\ntypedef enum\n{\n  ECMA_BIGINT_UNARY_BITWISE_NOT, /**< bitwise not operation */\n  ECMA_BIGINT_UNARY_INCREASE, /**< increase operation */\n  ECMA_BIGINT_UNARY_DECREASE, /**< decrease operation */\n} ecma_bigint_unary_operation_type;\n\necma_value_t ecma_bigint_parse_string (const lit_utf8_byte_t *string_p, lit_utf8_size_t size, uint32_t options);\necma_value_t ecma_bigint_parse_string_value (ecma_value_t string, uint32_t options);\necma_string_t *ecma_bigint_to_string (ecma_value_t value, ecma_bigint_digit_t radix);\necma_value_t ecma_bigint_to_bigint (ecma_value_t value, bool allow_numbers);\necma_value_t ecma_bigint_to_number (ecma_value_t value);\necma_value_t ecma_bigint_get_bigint (ecma_value_t value, bool *free_result_p);\necma_value_t ecma_bigint_create_from_digits (const uint64_t *digits_p, uint32_t size, bool sign);\nuint32_t ecma_bigint_get_size_in_digits (ecma_value_t value);\nvoid ecma_bigint_get_digits_and_sign (ecma_value_t value, uint64_t *digits_p, uint32_t size, bool *sign_p);\n\nbool ecma_bigint_is_equal_to_bigint (ecma_value_t left_value, ecma_value_t right_value);\nbool ecma_bigint_is_equal_to_number (ecma_value_t left_value, ecma_number_t right_value);\nint ecma_bigint_compare_to_bigint (ecma_value_t left_value, ecma_value_t right_value);\nint ecma_bigint_compare_to_number (ecma_value_t left_value, ecma_number_t right_value);\n\necma_value_t ecma_bigint_negate (ecma_extended_primitive_t *value_p);\necma_value_t ecma_bigint_unary (ecma_value_t value, ecma_bigint_unary_operation_type type);\necma_value_t ecma_bigint_add_sub (ecma_value_t left_value, ecma_value_t right_value, bool is_add);\necma_value_t ecma_bigint_mul (ecma_value_t left_value, ecma_value_t right_value);\necma_value_t ecma_bigint_div_mod (ecma_value_t left_value, ecma_value_t right_value, bool is_mod);\necma_value_t ecma_bigint_shift (ecma_value_t left_value, ecma_value_t right_value, bool is_left);\necma_value_t ecma_bigint_pow (ecma_value_t left_value, ecma_value_t right_value);\n\necma_value_t ecma_bigint_and (ecma_value_t left_value, ecma_value_t right_value);\necma_value_t ecma_bigint_or (ecma_value_t left_value, ecma_value_t right_value);\necma_value_t ecma_bigint_xor (ecma_value_t left_value, ecma_value_t right_value);\n\n#endif /* JERRY_BUILTIN_BIGINT */\n\n#endif /* ECMA_BIG_INT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-boolean-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-boolean-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabooleanobject ECMA Boolean object related routines\n * @{\n */\n\n/**\n * Boolean object creation operation.\n *\n * See also: ECMA-262 v5, 15.6.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boolean constructor */\n{\n  bool boolean_value = ecma_op_to_boolean (arg);\n  ecma_builtin_id_t proto_id;\n\n#if JERRY_BUILTIN_BOOLEAN\n  proto_id = ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE;\n#else /* JERRY_BUILTIN_BOOLEAN */\n  proto_id = ECMA_BUILTIN_ID_OBJECT_PROTOTYPE;\n#endif /* !(JERRY_BUILTIN_BOOLEAN */\n\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (proto_id);\n\n  ecma_object_t *new_target = JERRY_CONTEXT (current_new_target_p);\n  if (new_target)\n  {\n    prototype_obj_p = ecma_op_get_prototype_from_constructor (new_target, proto_id);\n\n    if (JERRY_UNLIKELY (prototype_obj_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  ecma_object_t *object_p =\n    ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_BOOLEAN;\n  ext_object_p->u.cls.u3.value = ecma_make_boolean_value (boolean_value);\n\n  if (new_target)\n  {\n    ecma_deref_object (prototype_obj_p);\n  }\n\n  return ecma_make_object_value (object_p);\n} /* ecma_op_create_boolean_object */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-boolean-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_BOOLEAN_OBJECT_H\n#define ECMA_BOOLEAN_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmabooleanobject ECMA Boolean object related routines\n * @{\n */\n\necma_value_t ecma_op_create_boolean_object (ecma_value_t arg);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_BOOLEAN_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-comparison.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-comparison.h\"\n\n#include \"ecma-bigint.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-objects.h\"\n\n#include \"jrt.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmacomparison ECMA comparison\n * @{\n */\n\n/**\n * ECMA abstract equality comparison routine.\n *\n * See also: ECMA-262 v5, 11.9.3\n *\n * Note:\n *      This function might raise an exception, so the\n *      returned value must be freed with ecma_free_value.\n *\n * @return true - if values are equal,\n *         false - otherwise\n *         error - in case of any problems\n */\necma_value_t\necma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */\n                                   ecma_value_t y) /**< second operand */\n{\n  if (x == y)\n  {\n    return ECMA_VALUE_TRUE;\n  }\n\n  if (ecma_are_values_integer_numbers (x, y))\n  {\n    /* Note: the (x == y) comparison captures the true case. */\n    return ECMA_VALUE_FALSE;\n  }\n\n  if (ecma_is_value_number (x))\n  {\n    if (ecma_is_value_number (y))\n    {\n      /* 1.c */\n      ecma_number_t x_num = ecma_get_number_from_value (x);\n      ecma_number_t y_num = ecma_get_number_from_value (y);\n\n      bool is_x_equal_to_y = (x_num == y_num);\n\n#ifndef JERRY_NDEBUG\n      bool is_x_equal_to_y_check;\n\n      if (ecma_number_is_nan (x_num) || ecma_number_is_nan (y_num))\n      {\n        is_x_equal_to_y_check = false;\n      }\n      else if (x_num == y_num || (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num)))\n      {\n        is_x_equal_to_y_check = true;\n      }\n      else\n      {\n        is_x_equal_to_y_check = false;\n      }\n\n      JERRY_ASSERT (is_x_equal_to_y == is_x_equal_to_y_check);\n#endif /* !JERRY_NDEBUG */\n\n      return ecma_make_boolean_value (is_x_equal_to_y);\n    }\n\n    /* Swap values. */\n    x ^= y;\n    y ^= x;\n    x ^= y;\n  }\n\n  if (ecma_is_value_string (x))\n  {\n    if (ecma_is_value_string (y))\n    {\n      /* 1., d. */\n      ecma_string_t *x_str_p = ecma_get_string_from_value (x);\n      ecma_string_t *y_str_p = ecma_get_string_from_value (y);\n\n      bool is_equal = ecma_compare_ecma_strings (x_str_p, y_str_p);\n\n      return ecma_make_boolean_value (is_equal);\n    }\n\n    if (ecma_is_value_number (y))\n    {\n      /* 4. */\n      ecma_number_t num;\n      ecma_value_t x_num_value = ecma_op_to_number (x, &num);\n\n      if (ECMA_IS_VALUE_ERROR (x_num_value))\n      {\n        return x_num_value;\n      }\n      ecma_value_t num_value = ecma_make_number_value (num);\n      ecma_value_t compare_result = ecma_op_abstract_equality_compare (num_value, y);\n\n      ecma_free_value (num_value);\n      return compare_result;\n    }\n\n    /* Swap values. */\n    x ^= y;\n    y ^= x;\n    x ^= y;\n  }\n\n  if (ecma_is_value_boolean (y))\n  {\n    if (ecma_is_value_boolean (x))\n    {\n      /* 1., e. */\n      /* Note: the (x == y) comparison captures the true case. */\n      return ECMA_VALUE_FALSE;\n    }\n\n    /* 7. */\n    return ecma_op_abstract_equality_compare (x, ecma_make_integer_value (ecma_is_value_true (y) ? 1 : 0));\n  }\n\n  if (ecma_is_value_boolean (x))\n  {\n    /* 6. */\n    return ecma_op_abstract_equality_compare (ecma_make_integer_value (ecma_is_value_true (x) ? 1 : 0), y);\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (JERRY_UNLIKELY (ecma_is_value_bigint (x)))\n  {\n    if (ecma_is_value_bigint (y))\n    {\n      return ecma_make_boolean_value (ecma_bigint_is_equal_to_bigint (x, y));\n    }\n\n    if (ecma_is_value_string (y))\n    {\n      ecma_value_t bigint = ecma_bigint_parse_string_value (y, ECMA_BIGINT_PARSE_DISALLOW_SYNTAX_ERROR);\n\n      if (ECMA_IS_VALUE_ERROR (bigint) || bigint == ECMA_VALUE_FALSE)\n      {\n        return bigint;\n      }\n\n      JERRY_ASSERT (ecma_is_value_bigint (bigint));\n\n      ecma_value_t result = ecma_make_boolean_value (ecma_bigint_is_equal_to_bigint (x, bigint));\n\n      ecma_free_value (bigint);\n      return result;\n    }\n\n    if (ecma_is_value_number (y))\n    {\n      return ecma_make_boolean_value (ecma_bigint_is_equal_to_number (x, ecma_get_number_from_value (y)));\n    }\n\n    /* Swap values. */\n    x ^= y;\n    y ^= x;\n    x ^= y;\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  if (ecma_is_value_undefined (x) || ecma_is_value_null (x))\n  {\n    /* 1. a., b. */\n    /* 2., 3. */\n    bool is_equal = ecma_is_value_undefined (y) || ecma_is_value_null (y);\n\n    return ecma_make_boolean_value (is_equal);\n  }\n\n  if (JERRY_UNLIKELY (ecma_is_value_symbol (x)))\n  {\n    if (!ecma_is_value_object (y))\n    {\n      return ECMA_VALUE_FALSE;\n    }\n\n    /* Swap values. */\n    x ^= y;\n    y ^= x;\n    x ^= y;\n  }\n\n  JERRY_ASSERT (ecma_is_value_object (x));\n\n  if (ecma_is_value_string (y) || ecma_is_value_symbol (y)\n#if JERRY_BUILTIN_BIGINT\n      || ecma_is_value_bigint (y)\n#endif /* JERRY_BUILTIN_BIGINT */\n      || ecma_is_value_number (y))\n  {\n    /* 9. */\n    ecma_object_t *obj_p = ecma_get_object_from_value (x);\n\n    ecma_value_t def_value = ecma_op_object_default_value (obj_p, ECMA_PREFERRED_TYPE_NO);\n\n    if (ECMA_IS_VALUE_ERROR (def_value))\n    {\n      return def_value;\n    }\n\n    ecma_value_t compare_result = ecma_op_abstract_equality_compare (def_value, y);\n\n    ecma_free_value (def_value);\n\n    return compare_result;\n  }\n\n  return ECMA_VALUE_FALSE;\n} /* ecma_op_abstract_equality_compare */\n\n/**\n * ECMA strict equality comparison routine.\n *\n * See also: ECMA-262 v5, 11.9.6\n *\n * @return true - if values are strict equal,\n *         false - otherwise\n */\nbool\necma_op_strict_equality_compare (ecma_value_t x, /**< first operand */\n                                 ecma_value_t y) /**< second operand */\n{\n  if (ecma_is_value_direct (x) || ecma_is_value_direct (y) || ecma_is_value_symbol (x) || ecma_is_value_symbol (y)\n      || ecma_is_value_object (x) || ecma_is_value_object (y))\n  {\n    JERRY_ASSERT (!ecma_is_value_direct (x) || ecma_is_value_undefined (x) || ecma_is_value_null (x)\n                  || ecma_is_value_boolean (x) || ecma_is_value_integer_number (x));\n\n    JERRY_ASSERT (!ecma_is_value_direct (y) || ecma_is_value_undefined (y) || ecma_is_value_null (y)\n                  || ecma_is_value_boolean (y) || ecma_is_value_integer_number (y));\n\n    if ((x != ecma_make_integer_value (0) || !ecma_is_value_float_number (y))\n        && (y != ecma_make_integer_value (0) || !ecma_is_value_float_number (x)))\n    {\n      return (x == y);\n    }\n\n    /* The +0 === -0 case handled below. */\n  }\n\n  JERRY_ASSERT (ecma_is_value_number (x) || ecma_is_value_string (x) || ecma_is_value_bigint (x));\n  JERRY_ASSERT (ecma_is_value_number (y) || ecma_is_value_string (y) || ecma_is_value_bigint (y));\n\n  if (ecma_is_value_string (x))\n  {\n    if (!ecma_is_value_string (y))\n    {\n      return false;\n    }\n\n    ecma_string_t *x_str_p = ecma_get_string_from_value (x);\n    ecma_string_t *y_str_p = ecma_get_string_from_value (y);\n\n    return ecma_compare_ecma_strings (x_str_p, y_str_p);\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (JERRY_UNLIKELY (ecma_is_value_bigint (x)))\n  {\n    if (!ecma_is_value_bigint (y))\n    {\n      return false;\n    }\n\n    return ecma_bigint_is_equal_to_bigint (x, y);\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  if (!ecma_is_value_number (y))\n  {\n    return false;\n  }\n\n  ecma_number_t x_num = ecma_get_number_from_value (x);\n  ecma_number_t y_num = ecma_get_number_from_value (y);\n\n  bool is_x_equal_to_y = (x_num == y_num);\n\n#ifndef JERRY_NDEBUG\n  bool is_x_equal_to_y_check;\n\n  if (ecma_number_is_nan (x_num) || ecma_number_is_nan (y_num))\n  {\n    is_x_equal_to_y_check = false;\n  }\n  else if (x_num == y_num || (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num)))\n  {\n    is_x_equal_to_y_check = true;\n  }\n  else\n  {\n    is_x_equal_to_y_check = false;\n  }\n\n  JERRY_ASSERT (is_x_equal_to_y == is_x_equal_to_y_check);\n#endif /* !JERRY_NDEBUG */\n\n  return is_x_equal_to_y;\n} /* ecma_op_strict_equality_compare */\n\n/**\n * ECMA abstract relational comparison routine.\n *\n * See also: ECMA-262 v5, 11.8.5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */\n                                     ecma_value_t y, /**< second operand */\n                                     bool left_first) /**< 'LeftFirst' flag */\n{\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  /* 1., 2. */\n  ecma_value_t prim_first_converted_value = ecma_op_to_primitive (x, ECMA_PREFERRED_TYPE_NUMBER);\n  if (ECMA_IS_VALUE_ERROR (prim_first_converted_value))\n  {\n    return prim_first_converted_value;\n  }\n\n  ecma_value_t prim_second_converted_value = ecma_op_to_primitive (y, ECMA_PREFERRED_TYPE_NUMBER);\n  if (ECMA_IS_VALUE_ERROR (prim_second_converted_value))\n  {\n    ecma_free_value (prim_first_converted_value);\n    return prim_second_converted_value;\n  }\n\n  ecma_value_t px = left_first ? prim_first_converted_value : prim_second_converted_value;\n  ecma_value_t py = left_first ? prim_second_converted_value : prim_first_converted_value;\n\n  const bool is_px_string = ecma_is_value_string (px);\n  const bool is_py_string = ecma_is_value_string (py);\n\n  if (!(is_px_string && is_py_string))\n  {\n#if JERRY_BUILTIN_BIGINT\n    if (JERRY_LIKELY (!ecma_is_value_bigint (px)) && JERRY_LIKELY (!ecma_is_value_bigint (py)))\n    {\n#endif /* JERRY_BUILTIN_BIGINT */\n      /* 3. */\n\n      /* a. */\n\n      ecma_number_t nx;\n      ecma_number_t ny;\n\n      if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (px, &nx)) || ECMA_IS_VALUE_ERROR (ecma_op_to_number (py, &ny)))\n      {\n        ret_value = ECMA_VALUE_ERROR;\n        goto end;\n      }\n\n      /* b. */\n      if (ecma_number_is_nan (nx) || ecma_number_is_nan (ny))\n      {\n        /* c., d. */\n        ret_value = ECMA_VALUE_UNDEFINED;\n      }\n      else\n      {\n        bool is_x_less_than_y = (nx < ny);\n\n#ifndef JERRY_NDEBUG\n        bool is_x_less_than_y_check;\n\n        if (nx == ny || (ecma_number_is_zero (nx) && ecma_number_is_zero (ny)))\n        {\n          /* e., f., g. */\n          is_x_less_than_y_check = false;\n        }\n        else if (ecma_number_is_infinity (nx) && !ecma_number_is_negative (nx))\n        {\n          /* h. */\n          is_x_less_than_y_check = false;\n        }\n        else if (ecma_number_is_infinity (ny) && !ecma_number_is_negative (ny))\n        {\n          /* i. */\n          is_x_less_than_y_check = true;\n        }\n        else if (ecma_number_is_infinity (ny) && ecma_number_is_negative (ny))\n        {\n          /* j. */\n          is_x_less_than_y_check = false;\n        }\n        else if (ecma_number_is_infinity (nx) && ecma_number_is_negative (nx))\n        {\n          /* k. */\n          is_x_less_than_y_check = true;\n        }\n        else\n        {\n          /* l. */\n          JERRY_ASSERT (!ecma_number_is_nan (nx) && !ecma_number_is_infinity (nx));\n          JERRY_ASSERT (!ecma_number_is_nan (ny) && !ecma_number_is_infinity (ny));\n          JERRY_ASSERT (!(ecma_number_is_zero (nx) && ecma_number_is_zero (ny)));\n\n          if (nx < ny)\n          {\n            is_x_less_than_y_check = true;\n          }\n          else\n          {\n            is_x_less_than_y_check = false;\n          }\n        }\n\n        JERRY_ASSERT (is_x_less_than_y_check == is_x_less_than_y);\n#endif /* !JERRY_NDEBUG */\n\n        ret_value = ecma_make_boolean_value (is_x_less_than_y);\n      }\n#if JERRY_BUILTIN_BIGINT\n    }\n    else\n    {\n      bool invert_result = false;\n      int compare_result = 0;\n\n      if (!ecma_is_value_bigint (px))\n      {\n        ecma_value_t tmp = px;\n        px = py;\n        py = tmp;\n        invert_result = true;\n      }\n\n      JERRY_ASSERT (ecma_is_value_bigint (px));\n\n      if (ecma_is_value_bigint (py))\n      {\n        compare_result = ecma_bigint_compare_to_bigint (px, py);\n      }\n      else if (ecma_is_value_string (py))\n      {\n        ret_value = ecma_bigint_parse_string_value (py, ECMA_BIGINT_PARSE_DISALLOW_SYNTAX_ERROR);\n\n        if (!ECMA_IS_VALUE_ERROR (ret_value))\n        {\n          if (ret_value == ECMA_VALUE_FALSE)\n          {\n            ret_value = ECMA_VALUE_UNDEFINED;\n          }\n          else\n          {\n            compare_result = ecma_bigint_compare_to_bigint (px, ret_value);\n            ecma_free_value (ret_value);\n            ret_value = ECMA_VALUE_EMPTY;\n          }\n        }\n      }\n      else\n      {\n        ecma_number_t ny;\n        if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (py, &ny)))\n        {\n          ret_value = ECMA_VALUE_ERROR;\n          goto end;\n        }\n\n        if (ecma_number_is_nan (ny))\n        {\n          ret_value = ECMA_VALUE_UNDEFINED;\n        }\n        else\n        {\n          compare_result = ecma_bigint_compare_to_number (px, ny);\n        }\n      }\n\n      if (ret_value == ECMA_VALUE_EMPTY)\n      {\n        if (invert_result)\n        {\n          compare_result = -compare_result;\n        }\n\n        ret_value = ecma_make_boolean_value (compare_result < 0);\n      }\n    }\n#endif /* JERRY_BUILTIN_BIGINT */\n  }\n  else\n  { /* 4. */\n    JERRY_ASSERT (is_px_string && is_py_string);\n\n    ecma_string_t *str_x_p = ecma_get_string_from_value (px);\n    ecma_string_t *str_y_p = ecma_get_string_from_value (py);\n\n    bool is_px_less = ecma_compare_ecma_strings_relational (str_x_p, str_y_p);\n\n    ret_value = ecma_make_boolean_value (is_px_less);\n  }\n\nend:\n  ecma_free_value (prim_second_converted_value);\n  ecma_free_value (prim_first_converted_value);\n\n  return ret_value;\n} /* ecma_op_abstract_relational_compare */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-comparison.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_COMPARISON_H\n#define ECMA_COMPARISON_H\n\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmacomparison ECMA comparison\n * @{\n */\n\necma_value_t ecma_op_abstract_equality_compare (ecma_value_t x, ecma_value_t y);\nbool ecma_op_strict_equality_compare (ecma_value_t x, ecma_value_t y);\necma_value_t ecma_op_abstract_relational_compare (ecma_value_t x, ecma_value_t y, bool left_first);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_COMPARISON_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-container-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n#include \"ecma-container-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-property-hashmap.h\"\n\n#include \"jcontext.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup \\addtogroup ecmamaphelpers ECMA builtin Map/Set helper functions\n * @{\n */\n\n/**\n * Create a new internal buffer.\n *\n * Note:\n *   The first element of the collection tracks the size of the buffer.\n *   ECMA_VALUE_EMPTY values are not calculated into the size.\n *\n * @return pointer to the internal buffer\n */\nstatic inline ecma_collection_t *\necma_op_create_internal_buffer (void)\n{\n  ecma_collection_t *collection_p = ecma_new_collection ();\n  ecma_collection_push_back (collection_p, (ecma_value_t) 0);\n\n  return collection_p;\n} /* ecma_op_create_internal_buffer */\n\n/**\n * Append values to the internal buffer.\n */\nstatic void\necma_op_internal_buffer_append (ecma_collection_t *container_p, /**< internal container pointer */\n                                ecma_value_t key_arg, /**< key argument */\n                                ecma_value_t value_arg, /**< value argument */\n                                lit_magic_string_id_t lit_id) /**< class id */\n{\n  JERRY_ASSERT (container_p != NULL);\n\n  if (lit_id == LIT_MAGIC_STRING_WEAKMAP_UL || lit_id == LIT_MAGIC_STRING_MAP_UL)\n  {\n    ecma_value_t values[] = { ecma_copy_value_if_not_object (key_arg), ecma_copy_value_if_not_object (value_arg) };\n    ecma_collection_append (container_p, values, 2);\n  }\n  else\n  {\n    ecma_collection_push_back (container_p, ecma_copy_value_if_not_object (key_arg));\n  }\n\n  ECMA_CONTAINER_SET_SIZE (container_p, ECMA_CONTAINER_GET_SIZE (container_p) + 1);\n} /* ecma_op_internal_buffer_append */\n\n/**\n * Update the value of a given entry.\n */\nstatic inline void\necma_op_internal_buffer_update (ecma_value_t *entry_p, /**< entry pointer */\n                                ecma_value_t value_arg, /**< value argument */\n                                lit_magic_string_id_t lit_id) /**< class id */\n{\n  JERRY_ASSERT (entry_p != NULL);\n\n  if (lit_id == LIT_MAGIC_STRING_WEAKMAP_UL || lit_id == LIT_MAGIC_STRING_MAP_UL)\n  {\n    ecma_free_value_if_not_object (((ecma_container_pair_t *) entry_p)->value);\n\n    ((ecma_container_pair_t *) entry_p)->value = ecma_copy_value_if_not_object (value_arg);\n  }\n} /* ecma_op_internal_buffer_update */\n\n/**\n * Delete element from the internal buffer.\n */\nstatic void\necma_op_internal_buffer_delete (ecma_collection_t *container_p, /**< internal container pointer */\n                                ecma_container_pair_t *entry_p, /**< entry pointer */\n                                lit_magic_string_id_t lit_id) /**< class id */\n{\n  JERRY_ASSERT (container_p != NULL);\n  JERRY_ASSERT (entry_p != NULL);\n\n  ecma_free_value_if_not_object (entry_p->key);\n  entry_p->key = ECMA_VALUE_EMPTY;\n\n  if (lit_id == LIT_MAGIC_STRING_WEAKMAP_UL || lit_id == LIT_MAGIC_STRING_MAP_UL)\n  {\n    ecma_free_value_if_not_object (entry_p->value);\n    entry_p->value = ECMA_VALUE_EMPTY;\n  }\n\n  ECMA_CONTAINER_SET_SIZE (container_p, ECMA_CONTAINER_GET_SIZE (container_p) - 1);\n} /* ecma_op_internal_buffer_delete */\n\n/**\n * Find an entry in the collection.\n *\n * @return pointer to the appropriate entry.\n */\nstatic ecma_value_t *\necma_op_internal_buffer_find (ecma_collection_t *container_p, /**< internal container pointer */\n                              ecma_value_t key_arg, /**< key argument */\n                              lit_magic_string_id_t lit_id) /**< class id */\n{\n  JERRY_ASSERT (container_p != NULL);\n\n  uint8_t entry_size = ecma_op_container_entry_size (lit_id);\n  uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);\n  ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);\n\n  for (uint32_t i = 0; i < entry_count; i += entry_size)\n  {\n    ecma_value_t *entry_p = start_p + i;\n\n    if (ecma_op_same_value_zero (*entry_p, key_arg, false))\n    {\n      return entry_p;\n    }\n  }\n\n  return NULL;\n} /* ecma_op_internal_buffer_find */\n\n/**\n * Get the value that belongs to the key.\n *\n * Note: in case of Set containers, the values are the same as the keys.\n *\n * @return ecma value\n */\nstatic ecma_value_t\necma_op_container_get_value (ecma_value_t *entry_p, /**< entry (key) pointer */\n                             lit_magic_string_id_t lit_id) /**< class id */\n{\n  JERRY_ASSERT (entry_p != NULL);\n\n  if (lit_id == LIT_MAGIC_STRING_WEAKMAP_UL || lit_id == LIT_MAGIC_STRING_MAP_UL)\n  {\n    return ((ecma_container_pair_t *) entry_p)->value;\n  }\n\n  return *entry_p;\n} /* ecma_op_container_get_value */\n\n/**\n * Get the size (in ecma_value_t) of the stored entries.\n *\n * @return size of the entries.\n */\nuint8_t\necma_op_container_entry_size (lit_magic_string_id_t lit_id) /**< class id */\n{\n  if (lit_id == LIT_MAGIC_STRING_WEAKMAP_UL || lit_id == LIT_MAGIC_STRING_MAP_UL)\n  {\n    return ECMA_CONTAINER_PAIR_SIZE;\n  }\n\n  return ECMA_CONTAINER_VALUE_SIZE;\n} /* ecma_op_container_entry_size */\n\n/**\n * Release the entries in the WeakSet container.\n */\nstatic void\necma_op_container_free_weakset_entries (ecma_object_t *object_p, /**< object pointer */\n                                        ecma_collection_t *container_p) /** internal buffer pointer */\n{\n  JERRY_ASSERT (object_p != NULL);\n  JERRY_ASSERT (container_p != NULL);\n\n  uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);\n  ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);\n\n  for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_VALUE_SIZE)\n  {\n    ecma_value_t *entry_p = start_p + i;\n\n    if (ecma_is_value_empty (*entry_p))\n    {\n      continue;\n    }\n\n    ecma_op_object_unref_weak (ecma_get_object_from_value (*entry_p), ecma_make_object_value (object_p));\n    ecma_op_container_remove_weak_entry (object_p, *entry_p);\n\n    *entry_p = ECMA_VALUE_EMPTY;\n  }\n} /* ecma_op_container_free_weakset_entries */\n\n/**\n * Release the entries in the WeakMap container.\n */\nstatic void\necma_op_container_free_weakmap_entries (ecma_object_t *object_p, /**< object pointer */\n                                        ecma_collection_t *container_p) /**< internal buffer pointer */\n{\n  JERRY_ASSERT (object_p != NULL);\n  JERRY_ASSERT (container_p != NULL);\n\n  uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);\n  ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);\n\n  for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_PAIR_SIZE)\n  {\n    ecma_container_pair_t *entry_p = (ecma_container_pair_t *) (start_p + i);\n\n    if (ecma_is_value_empty (entry_p->key))\n    {\n      continue;\n    }\n\n    ecma_op_object_unref_weak (ecma_get_object_from_value (entry_p->key), ecma_make_object_value (object_p));\n    ecma_op_container_remove_weak_entry (object_p, entry_p->key);\n\n    ecma_free_value_if_not_object (entry_p->value);\n\n    entry_p->key = ECMA_VALUE_EMPTY;\n    entry_p->value = ECMA_VALUE_EMPTY;\n  }\n} /* ecma_op_container_free_weakmap_entries */\n\n/**\n * Release the entries in the Set container.\n */\nstatic void\necma_op_container_free_set_entries (ecma_collection_t *container_p)\n{\n  JERRY_ASSERT (container_p != NULL);\n\n  uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);\n  ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);\n\n  for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_VALUE_SIZE)\n  {\n    ecma_value_t *entry_p = start_p + i;\n\n    if (ecma_is_value_empty (*entry_p))\n    {\n      continue;\n    }\n\n    ecma_free_value_if_not_object (*entry_p);\n    *entry_p = ECMA_VALUE_EMPTY;\n  }\n} /* ecma_op_container_free_set_entries */\n\n/**\n * Release the entries in the Map container.\n */\nstatic void\necma_op_container_free_map_entries (ecma_collection_t *container_p)\n{\n  JERRY_ASSERT (container_p != NULL);\n\n  uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);\n  ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);\n\n  for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_PAIR_SIZE)\n  {\n    ecma_container_pair_t *entry_p = (ecma_container_pair_t *) (start_p + i);\n\n    if (ecma_is_value_empty (entry_p->key))\n    {\n      continue;\n    }\n\n    ecma_free_value_if_not_object (entry_p->key);\n    ecma_free_value_if_not_object (entry_p->value);\n\n    entry_p->key = ECMA_VALUE_EMPTY;\n    entry_p->value = ECMA_VALUE_EMPTY;\n  }\n} /* ecma_op_container_free_map_entries */\n\n/**\n * Release the internal buffer and the stored entries.\n */\nvoid\necma_op_container_free_entries (ecma_object_t *object_p) /**< collection object pointer */\n{\n  JERRY_ASSERT (object_p != NULL);\n\n  ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n\n  switch (map_object_p->u.cls.u2.container_id)\n  {\n    case LIT_MAGIC_STRING_WEAKSET_UL:\n    {\n      ecma_op_container_free_weakset_entries (object_p, container_p);\n      break;\n    }\n    case LIT_MAGIC_STRING_WEAKMAP_UL:\n    {\n      ecma_op_container_free_weakmap_entries (object_p, container_p);\n      break;\n    }\n    case LIT_MAGIC_STRING_SET_UL:\n    {\n      ecma_op_container_free_set_entries (container_p);\n      break;\n    }\n    case LIT_MAGIC_STRING_MAP_UL:\n    {\n      ecma_op_container_free_map_entries (container_p);\n      break;\n    }\n    default:\n    {\n      break;\n    }\n  }\n\n  ECMA_CONTAINER_SET_SIZE (container_p, 0);\n} /* ecma_op_container_free_entries */\n\n/**\n * Handle calling [[Construct]] of built-in Map/Set like objects\n *\n * @return ecma value\n */\necma_value_t\necma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments list */\n                          uint32_t arguments_list_len, /**< number of arguments */\n                          lit_magic_string_id_t lit_id, /**< internal class id */\n                          ecma_builtin_id_t proto_id) /**< prototype builtin id */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n  JERRY_ASSERT (lit_id == LIT_MAGIC_STRING_MAP_UL || lit_id == LIT_MAGIC_STRING_SET_UL\n                || lit_id == LIT_MAGIC_STRING_WEAKMAP_UL || lit_id == LIT_MAGIC_STRING_WEAKSET_UL);\n  JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) != NULL);\n\n  ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), proto_id);\n\n  if (JERRY_UNLIKELY (proto_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_collection_t *container_p = ecma_op_create_internal_buffer ();\n  ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n  ecma_deref_object (proto_p);\n  ecma_extended_object_t *map_obj_p = (ecma_extended_object_t *) object_p;\n  map_obj_p->u.cls.type = ECMA_OBJECT_CLASS_CONTAINER;\n  map_obj_p->u.cls.u1.container_flags = ECMA_CONTAINER_FLAGS_EMPTY;\n  map_obj_p->u.cls.u2.container_id = (uint16_t) lit_id;\n\n  if (lit_id == LIT_MAGIC_STRING_WEAKMAP_UL || lit_id == LIT_MAGIC_STRING_WEAKSET_UL)\n  {\n    map_obj_p->u.cls.u1.container_flags |= ECMA_CONTAINER_FLAGS_WEAK;\n  }\n\n  ECMA_SET_INTERNAL_VALUE_POINTER (map_obj_p->u.cls.u3.value, container_p);\n\n  ecma_value_t set_value = ecma_make_object_value (object_p);\n  ecma_value_t result = set_value;\n\n  if (arguments_list_len == 0)\n  {\n    return result;\n  }\n\n  ecma_value_t iterable = arguments_list_p[0];\n\n  if (ecma_is_value_undefined (iterable) || ecma_is_value_null (iterable))\n  {\n    return result;\n  }\n\n  lit_magic_string_id_t adder_string_id;\n  if (lit_id == LIT_MAGIC_STRING_MAP_UL || lit_id == LIT_MAGIC_STRING_WEAKMAP_UL)\n  {\n    adder_string_id = LIT_MAGIC_STRING_SET;\n  }\n  else\n  {\n    adder_string_id = LIT_MAGIC_STRING_ADD;\n  }\n\n  result = ecma_op_object_get_by_magic_id (object_p, adder_string_id);\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    goto cleanup_object;\n  }\n\n  if (!ecma_op_is_callable (result))\n  {\n    ecma_free_value (result);\n    result = ecma_raise_type_error (ECMA_ERR_FUNCTION_ADD_ORSET_IS_NOT_CALLABLE);\n    goto cleanup_object;\n  }\n\n  ecma_object_t *adder_func_p = ecma_get_object_from_value (result);\n\n  ecma_value_t next_method;\n  result = ecma_op_get_iterator (iterable, ECMA_VALUE_SYNC_ITERATOR, &next_method);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    goto cleanup_adder;\n  }\n\n  const ecma_value_t iterator = result;\n\n  while (true)\n  {\n    result = ecma_op_iterator_step (iterator, next_method);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_iterator;\n    }\n\n    if (ecma_is_value_false (result))\n    {\n      break;\n    }\n\n    const ecma_value_t next = result;\n    result = ecma_op_iterator_value (next);\n    ecma_free_value (next);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_iterator;\n    }\n\n    if (lit_id == LIT_MAGIC_STRING_SET_UL || lit_id == LIT_MAGIC_STRING_WEAKSET_UL)\n    {\n      const ecma_value_t value = result;\n\n      ecma_value_t arguments[] = { value };\n      result = ecma_op_function_call (adder_func_p, set_value, arguments, 1);\n\n      ecma_free_value (value);\n    }\n    else\n    {\n      if (!ecma_is_value_object (result))\n      {\n        ecma_free_value (result);\n        ecma_raise_type_error (ECMA_ERR_ITERATOR_VALUE_IS_NOT_AN_OBJECT);\n        result = ecma_op_iterator_close (iterator);\n        JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result));\n        goto cleanup_iterator;\n      }\n\n      ecma_object_t *next_object_p = ecma_get_object_from_value (result);\n\n      result = ecma_op_object_get_by_index (next_object_p, 0);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        ecma_deref_object (next_object_p);\n        ecma_op_iterator_close (iterator);\n        goto cleanup_iterator;\n      }\n\n      const ecma_value_t key = result;\n\n      result = ecma_op_object_get_by_index (next_object_p, 1);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        ecma_deref_object (next_object_p);\n        ecma_free_value (key);\n        ecma_op_iterator_close (iterator);\n        goto cleanup_iterator;\n      }\n\n      const ecma_value_t value = result;\n      ecma_value_t arguments[] = { key, value };\n      result = ecma_op_function_call (adder_func_p, set_value, arguments, 2);\n\n      ecma_free_value (key);\n      ecma_free_value (value);\n      ecma_deref_object (next_object_p);\n    }\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      ecma_op_iterator_close (iterator);\n      goto cleanup_iterator;\n    }\n\n    ecma_free_value (result);\n  }\n\n  ecma_ref_object (object_p);\n  result = ecma_make_object_value (object_p);\n\ncleanup_iterator:\n  ecma_free_value (iterator);\n  ecma_free_value (next_method);\ncleanup_adder:\n  ecma_deref_object (adder_func_p);\ncleanup_object:\n  ecma_deref_object (object_p);\n\n  return result;\n} /* ecma_op_container_create */\n\n/**\n * Get Map/Set object pointer\n *\n * Note:\n *   If the function returns with NULL, the error object has\n *   already set, and the caller must return with ECMA_VALUE_ERROR\n *\n * @return pointer to the Map/Set if this_arg is a valid Map/Set object\n *         NULL otherwise\n */\necma_extended_object_t *\necma_op_container_get_object (ecma_value_t this_arg, /**< this argument */\n                              lit_magic_string_id_t lit_id) /**< internal class id */\n{\n  if (ecma_is_value_object (this_arg))\n  {\n    ecma_object_t *map_object_p = ecma_get_object_from_value (this_arg);\n\n    if (ecma_object_class_is (map_object_p, ECMA_OBJECT_CLASS_CONTAINER)\n        && ((ecma_extended_object_t *) map_object_p)->u.cls.u2.container_id == lit_id)\n    {\n      return (ecma_extended_object_t *) map_object_p;\n    }\n  }\n\n#if JERRY_ERROR_MESSAGES\n  ecma_raise_standard_error_with_format (JERRY_ERROR_TYPE,\n                                         \"Expected a % object\",\n                                         ecma_make_string_value (ecma_get_magic_string (lit_id)));\n#else /* !JERRY_ERROR_MESSAGES */\n  ecma_raise_type_error (ECMA_ERR_EMPTY);\n#endif /* JERRY_ERROR_MESSAGES */\n\n  return NULL;\n} /* ecma_op_container_get_object */\n\n/**\n * Returns with the size of the Map/Set object.\n *\n * @return size of the Map/Set object as ecma-value.\n */\necma_value_t\necma_op_container_size (ecma_extended_object_t *map_object_p) /**< internal class id */\n{\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n\n  return ecma_make_uint32_value (ECMA_CONTAINER_GET_SIZE (container_p));\n} /* ecma_op_container_size */\n\n/**\n * The generic Map/WeakMap prototype object's 'get' routine\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_container_get (ecma_extended_object_t *map_object_p, /**< map object */\n                       ecma_value_t key_arg, /**< key argument */\n                       lit_magic_string_id_t lit_id) /**< internal class id */\n{\n  if (lit_id == LIT_MAGIC_STRING_WEAKMAP_UL && !ecma_is_value_object (key_arg))\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n\n  if (ECMA_CONTAINER_GET_SIZE (container_p) == 0)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);\n\n  if (entry_p == NULL)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  return ecma_copy_value (((ecma_container_pair_t *) entry_p)->value);\n} /* ecma_op_container_get */\n\n/**\n * The generic Map/Set prototype object's 'has' routine\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_container_has (ecma_extended_object_t *map_object_p, /**< map object */\n                       ecma_value_t key_arg, /**< key argument */\n                       lit_magic_string_id_t lit_id) /**< internal class id */\n{\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n\n  if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0 && !ecma_is_value_object (key_arg))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  if (ECMA_CONTAINER_GET_SIZE (container_p) == 0)\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);\n\n  return ecma_make_boolean_value (entry_p != NULL);\n} /* ecma_op_container_has */\n\n/**\n * Helper method for the Map.prototype.set and Set.prototype.add methods to swap the sign of the given value if needed\n *\n * See also:\n *          ECMA-262 v6, 23.2.3.1 step 6\n *          ECMA-262 v6, 23.1.3.9 step 6\n *\n * @return ecma value\n */\nstatic ecma_value_t\necma_op_container_set_noramlize_zero (ecma_value_t this_arg) /*< this arg */\n{\n  if (ecma_is_value_number (this_arg))\n  {\n    ecma_number_t number_value = ecma_get_number_from_value (this_arg);\n\n    if (JERRY_UNLIKELY (ecma_number_is_zero (number_value) && ecma_number_is_negative (number_value)))\n    {\n      return ecma_make_integer_value (0);\n    }\n  }\n\n  return this_arg;\n} /* ecma_op_container_set_noramlize_zero */\n\n/**\n * The generic Map prototype object's 'set' and Set prototype object's 'add' routine\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */\n                       ecma_value_t key_arg, /**< key argument */\n                       ecma_value_t value_arg, /**< value argument */\n                       lit_magic_string_id_t lit_id) /**< internal class id */\n{\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n\n  if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0 && !ecma_is_value_object (key_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_KEY_MUST_BE_AN_OBJECT);\n  }\n\n  ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);\n\n  if (entry_p == NULL)\n  {\n    ecma_op_internal_buffer_append (container_p, ecma_op_container_set_noramlize_zero (key_arg), value_arg, lit_id);\n\n    if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0)\n    {\n      ecma_object_t *key_p = ecma_get_object_from_value (key_arg);\n      ecma_op_object_set_weak (key_p, (ecma_object_t *) map_object_p);\n    }\n  }\n  else\n  {\n    ecma_op_internal_buffer_update (entry_p, ecma_op_container_set_noramlize_zero (value_arg), lit_id);\n  }\n\n  ecma_ref_object ((ecma_object_t *) map_object_p);\n  return ecma_make_object_value ((ecma_object_t *) map_object_p);\n} /* ecma_op_container_set */\n\n/**\n * The generic Map/Set prototype object's 'forEach' routine\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_container_foreach (ecma_extended_object_t *map_object_p, /**< map object */\n                           ecma_value_t predicate, /**< callback function */\n                           ecma_value_t predicate_this_arg, /**< this argument for\n                                                             *   invoke predicate */\n                           lit_magic_string_id_t lit_id) /**< internal class id */\n{\n  if (!ecma_op_is_callable (predicate))\n  {\n    return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);\n  }\n\n  JERRY_ASSERT (ecma_is_value_object (predicate));\n  ecma_object_t *func_object_p = ecma_get_object_from_value (predicate);\n  ecma_value_t ret_value = ECMA_VALUE_UNDEFINED;\n\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n\n  uint8_t entry_size = ecma_op_container_entry_size (lit_id);\n\n  for (uint32_t i = 0; i < ECMA_CONTAINER_ENTRY_COUNT (container_p); i += entry_size)\n  {\n    ecma_value_t *entry_p = ECMA_CONTAINER_START (container_p) + i;\n\n    if (ecma_is_value_empty (*entry_p))\n    {\n      continue;\n    }\n\n    ecma_value_t key_arg = *entry_p;\n    ecma_value_t value_arg = ecma_op_container_get_value (entry_p, lit_id);\n\n    ecma_value_t this_arg = ecma_make_object_value ((ecma_object_t *) map_object_p);\n    ecma_value_t call_args[] = { value_arg, key_arg, this_arg };\n    ecma_value_t call_value = ecma_op_function_call (func_object_p, predicate_this_arg, call_args, 3);\n\n    if (ECMA_IS_VALUE_ERROR (call_value))\n    {\n      ret_value = call_value;\n      break;\n    }\n\n    ecma_free_value (call_value);\n  }\n\n  return ret_value;\n} /* ecma_op_container_foreach */\n\n/**\n * The Map/Set prototype object's 'clear' routine\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_container_clear (ecma_extended_object_t *map_object_p) /**< this argument */\n{\n  ecma_op_container_free_entries ((ecma_object_t *) map_object_p);\n\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_op_container_clear */\n\n/**\n * The generic Map/Set prototype object's 'delete' routine\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_container_delete (ecma_extended_object_t *map_object_p, /**< map object */\n                          ecma_value_t key_arg, /**< key argument */\n                          lit_magic_string_id_t lit_id) /**< internal class id */\n{\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n\n  ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);\n\n  if (entry_p == NULL)\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_op_internal_buffer_delete (container_p, (ecma_container_pair_t *) entry_p, lit_id);\n  return ECMA_VALUE_TRUE;\n} /* ecma_op_container_delete */\n\n/**\n * The generic WeakMap/WeakSet prototype object's 'delete' routine\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_container_delete_weak (ecma_extended_object_t *map_object_p, /**< map object */\n                               ecma_value_t key_arg, /**< key argument */\n                               lit_magic_string_id_t lit_id) /**< internal class id */\n{\n  if (!ecma_is_value_object (key_arg))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n\n  ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);\n\n  if (entry_p == NULL)\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_op_internal_buffer_delete (container_p, (ecma_container_pair_t *) entry_p, lit_id);\n\n  ecma_object_t *key_object_p = ecma_get_object_from_value (key_arg);\n  ecma_op_object_unref_weak (key_object_p, ecma_make_object_value ((ecma_object_t *) map_object_p));\n\n  return ECMA_VALUE_TRUE;\n} /* ecma_op_container_delete_weak */\n\n/**\n * Helper function to get the value from a weak container object\n *\n * @return value property\n */\necma_value_t\necma_op_container_find_weak_value (ecma_object_t *object_p, /**< internal container object */\n                                   ecma_value_t key_arg) /**< key */\n{\n  ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;\n\n  JERRY_ASSERT (map_object_p->u.cls.type == ECMA_OBJECT_CLASS_CONTAINER\n                && map_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKMAP_UL);\n\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n\n  ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, map_object_p->u.cls.u2.container_id);\n\n  JERRY_ASSERT (entry_p != NULL);\n\n  return entry_p[1];\n} /* ecma_op_container_find_weak_value */\n\n/**\n * Helper function to remove a key/value pair from a weak container object\n */\nvoid\necma_op_container_remove_weak_entry (ecma_object_t *object_p, /**< internal container object */\n                                     ecma_value_t key_arg) /**< key */\n{\n  ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;\n\n  JERRY_ASSERT (map_object_p->u.cls.type == ECMA_OBJECT_CLASS_CONTAINER\n                && (map_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKSET_UL\n                    || map_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKMAP_UL));\n\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n\n  ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, map_object_p->u.cls.u2.container_id);\n\n  JERRY_ASSERT (entry_p != NULL);\n\n  ecma_op_internal_buffer_delete (container_p, (ecma_container_pair_t *) entry_p, map_object_p->u.cls.u2.container_id);\n} /* ecma_op_container_remove_weak_entry */\n\n/**\n * The Create{Set, Map}Iterator Abstract operation\n *\n * See also:\n *          ECMA-262 v6, 23.1.5.1\n *          ECMA-262 v6, 23.2.5.1\n *\n * Note:\n *     Returned value must be freed with ecma_free_value.\n *\n * @return Map/Set iterator object, if success\n *         error - otherwise\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_container_create_iterator (ecma_value_t this_arg, /**< this argument */\n                                   ecma_builtin_id_t proto_id, /**< prototype builtin id */\n                                   ecma_object_class_type_t iterator_type, /**< iterator type */\n                                   ecma_iterator_kind_t kind) /**< iterator kind */\n{\n  return ecma_op_create_iterator_object (this_arg, ecma_builtin_get (proto_id), iterator_type, kind);\n} /* ecma_op_container_create_iterator */\n\n/**\n * Get the index of the iterator object.\n *\n * @return index of the iterator.\n */\nstatic uint32_t\necma_op_iterator_get_index (ecma_object_t *iter_obj_p) /**< iterator object pointer */\n{\n  uint32_t index = ((ecma_extended_object_t *) iter_obj_p)->u.cls.u2.iterator_index;\n\n  if (JERRY_UNLIKELY (index == ECMA_ITERATOR_INDEX_LIMIT))\n  {\n    ecma_string_t *prop_name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_ITERATOR_NEXT_INDEX);\n    ecma_property_t *property_p = ecma_find_named_property (iter_obj_p, prop_name_p);\n    ecma_property_value_t *value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n    return (uint32_t) (ecma_get_number_from_value (value_p->value));\n  }\n\n  return index;\n} /* ecma_op_iterator_get_index */\n\n/**\n * Set the index of the iterator object.\n */\nstatic void\necma_op_iterator_set_index (ecma_object_t *iter_obj_p, /**< iterator object pointer */\n                            uint32_t index) /* iterator index to set */\n{\n  if (JERRY_UNLIKELY (index >= ECMA_ITERATOR_INDEX_LIMIT))\n  {\n    /* After the ECMA_ITERATOR_INDEX_LIMIT limit is reached the [[%Iterator%NextIndex]]\n       property is stored as an internal property */\n    ecma_string_t *prop_name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_ITERATOR_NEXT_INDEX);\n    ecma_property_t *property_p = ecma_find_named_property (iter_obj_p, prop_name_p);\n    ecma_property_value_t *value_p;\n\n    if (property_p == NULL)\n    {\n      value_p = ecma_create_named_data_property (iter_obj_p, prop_name_p, ECMA_PROPERTY_FLAG_WRITABLE, &property_p);\n      value_p->value = ecma_make_uint32_value (index);\n    }\n    else\n    {\n      value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n      value_p->value = ecma_make_uint32_value (index);\n    }\n  }\n  else\n  {\n    ((ecma_extended_object_t *) iter_obj_p)->u.cls.u2.iterator_index = (uint16_t) index;\n  }\n} /* ecma_op_iterator_set_index */\n\n/**\n * The %{Set, Map}IteratorPrototype% object's 'next' routine\n *\n * See also:\n *          ECMA-262 v6, 23.1.5.2.1\n *          ECMA-262 v6, 23.2.5.2.1\n *\n * Note:\n *     Returned value must be freed with ecma_free_value.\n *\n * @return iterator result object, if success\n *         error - otherwise\n */\necma_value_t\necma_op_container_iterator_next (ecma_value_t this_val, /**< this argument */\n                                 ecma_object_class_type_t iterator_type) /**< type of the iterator */\n{\n  if (!ecma_is_value_object (this_val))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (this_val);\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n  if (!ecma_object_class_is (obj_p, iterator_type))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_ITERATOR);\n  }\n\n  ecma_value_t iterated_value = ext_obj_p->u.cls.u3.iterated_value;\n\n  if (ecma_is_value_empty (iterated_value))\n  {\n    return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n  }\n\n  ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) (ecma_get_object_from_value (iterated_value));\n  lit_magic_string_id_t lit_id = map_object_p->u.cls.u2.container_id;\n\n  ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);\n  uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);\n  uint32_t index = ecma_op_iterator_get_index (obj_p);\n\n  if (index == entry_count)\n  {\n    ext_obj_p->u.cls.u3.iterated_value = ECMA_VALUE_EMPTY;\n\n    return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n  }\n\n  uint8_t entry_size = ecma_op_container_entry_size (lit_id);\n  uint8_t iterator_kind = ext_obj_p->u.cls.u1.iterator_kind;\n  ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);\n  ecma_value_t ret_value = ECMA_VALUE_UNDEFINED;\n\n  for (uint32_t i = index; i < entry_count; i += entry_size)\n  {\n    ecma_value_t *entry_p = start_p + i;\n\n    if (ecma_is_value_empty (*entry_p))\n    {\n      if (i == (entry_count - entry_size))\n      {\n        ret_value = ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);\n        break;\n      }\n\n      continue;\n    }\n\n    ecma_op_iterator_set_index (obj_p, i + entry_size);\n\n    ecma_value_t key_arg = *entry_p;\n    ecma_value_t value_arg = ecma_op_container_get_value (entry_p, lit_id);\n\n    if (iterator_kind == ECMA_ITERATOR_KEYS)\n    {\n      ret_value = ecma_create_iter_result_object (key_arg, ECMA_VALUE_FALSE);\n    }\n    else if (iterator_kind == ECMA_ITERATOR_VALUES)\n    {\n      ret_value = ecma_create_iter_result_object (value_arg, ECMA_VALUE_FALSE);\n    }\n    else\n    {\n      JERRY_ASSERT (iterator_kind == ECMA_ITERATOR_ENTRIES);\n\n      ecma_value_t entry_array_value;\n      entry_array_value = ecma_create_array_from_iter_element (value_arg, key_arg);\n\n      ret_value = ecma_create_iter_result_object (entry_array_value, ECMA_VALUE_FALSE);\n      ecma_free_value (entry_array_value);\n    }\n\n    break;\n  }\n\n  return ret_value;\n} /* ecma_op_container_iterator_next */\n\n/**\n * Dispatcher of builtin container routines.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_builtin_container_dispatch_routine (uint16_t builtin_routine_id, /**< built-in wide routine\n                                                                       *   identifier */\n                                         ecma_value_t this_arg, /**< 'this' argument value */\n                                         const ecma_value_t arguments_list_p[], /**< list of arguments\n                                                                                 *   passed to routine */\n                                         lit_magic_string_id_t lit_id) /**< internal class id */\n{\n  ecma_extended_object_t *map_object_p = ecma_op_container_get_object (this_arg, lit_id);\n\n  if (map_object_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  switch (builtin_routine_id)\n  {\n    case ECMA_CONTAINER_ROUTINE_DELETE:\n    {\n      return ecma_op_container_delete (map_object_p, arguments_list_p[0], lit_id);\n    }\n    case ECMA_CONTAINER_ROUTINE_DELETE_WEAK:\n    {\n      return ecma_op_container_delete_weak (map_object_p, arguments_list_p[0], lit_id);\n    }\n    case ECMA_CONTAINER_ROUTINE_GET:\n    {\n      return ecma_op_container_get (map_object_p, arguments_list_p[0], lit_id);\n    }\n    case ECMA_CONTAINER_ROUTINE_SET:\n    {\n      return ecma_op_container_set (map_object_p, arguments_list_p[0], arguments_list_p[1], lit_id);\n    }\n    case ECMA_CONTAINER_ROUTINE_HAS:\n    {\n      return ecma_op_container_has (map_object_p, arguments_list_p[0], lit_id);\n    }\n    case ECMA_CONTAINER_ROUTINE_FOREACH:\n    {\n      return ecma_op_container_foreach (map_object_p, arguments_list_p[0], arguments_list_p[1], lit_id);\n    }\n    case ECMA_CONTAINER_ROUTINE_SIZE_GETTER:\n    {\n      return ecma_op_container_size (map_object_p);\n    }\n    case ECMA_CONTAINER_ROUTINE_ADD:\n    {\n      return ecma_op_container_set (map_object_p, arguments_list_p[0], arguments_list_p[0], lit_id);\n    }\n    case ECMA_CONTAINER_ROUTINE_CLEAR:\n    {\n      return ecma_op_container_clear (map_object_p);\n    }\n    case ECMA_CONTAINER_ROUTINE_KEYS:\n    case ECMA_CONTAINER_ROUTINE_VALUES:\n    case ECMA_CONTAINER_ROUTINE_ENTRIES:\n    {\n      ecma_builtin_id_t builtin_iterator_prototype = ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE;\n      ecma_object_class_type_t iterator_type = ECMA_OBJECT_CLASS_MAP_ITERATOR;\n\n      if (lit_id != LIT_MAGIC_STRING_MAP_UL)\n      {\n        builtin_iterator_prototype = ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE;\n        iterator_type = ECMA_OBJECT_CLASS_SET_ITERATOR;\n      }\n\n      ecma_iterator_kind_t kind = (ecma_iterator_kind_t) (builtin_routine_id - ECMA_CONTAINER_ROUTINE_KEYS);\n\n      return ecma_op_container_create_iterator (this_arg, builtin_iterator_prototype, iterator_type, kind);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_builtin_container_dispatch_routine */\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-container-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_CONTAINER_OBJECT_H\n#define ECMA_CONTAINER_OBJECT_H\n\n#include \"ecma-builtins.h\"\n#include \"ecma-globals.h\"\n\n#if JERRY_BUILTIN_CONTAINER\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmamaphelpers ECMA builtin map/set helper functions\n * @{\n */\n\n/**\n * List of built-in routine identifiers.\n */\nenum\n{\n  ECMA_CONTAINER_ROUTINE_START = 0,\n  ECMA_CONTAINER_ROUTINE_ADD,\n  ECMA_CONTAINER_ROUTINE_CLEAR,\n  ECMA_CONTAINER_ROUTINE_DELETE_WEAK,\n  ECMA_CONTAINER_ROUTINE_DELETE,\n  ECMA_CONTAINER_ROUTINE_FOREACH,\n  ECMA_CONTAINER_ROUTINE_HAS,\n  ECMA_CONTAINER_ROUTINE_SIZE_GETTER,\n  ECMA_CONTAINER_ROUTINE_GET,\n  ECMA_CONTAINER_ROUTINE_SET,\n  /* Note: These 3 routines MUST be in this order */\n  ECMA_CONTAINER_ROUTINE_KEYS,\n  ECMA_CONTAINER_ROUTINE_VALUES,\n  ECMA_CONTAINER_ROUTINE_ENTRIES\n};\n\nuint8_t ecma_op_container_entry_size (lit_magic_string_id_t lit_id);\necma_extended_object_t *ecma_op_container_get_object (ecma_value_t this_arg, lit_magic_string_id_t lit_id);\necma_value_t ecma_op_container_create (const ecma_value_t *arguments_list_p,\n                                       uint32_t arguments_list_len,\n                                       lit_magic_string_id_t lit_id,\n                                       ecma_builtin_id_t proto_id);\necma_value_t ecma_op_container_size (ecma_extended_object_t *map_object_p);\necma_value_t\necma_op_container_get (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, lit_magic_string_id_t lit_id);\necma_value_t ecma_op_container_foreach (ecma_extended_object_t *map_object_p,\n                                        ecma_value_t predicate,\n                                        ecma_value_t predicate_this_arg,\n                                        lit_magic_string_id_t lit_id);\necma_value_t\necma_op_container_has (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, lit_magic_string_id_t lit_id);\necma_value_t ecma_op_container_set (ecma_extended_object_t *map_object_p,\n                                    ecma_value_t key_arg,\n                                    ecma_value_t value_arg,\n                                    lit_magic_string_id_t lit_id);\necma_value_t ecma_op_container_clear (ecma_extended_object_t *map_object_p);\necma_value_t\necma_op_container_delete (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, lit_magic_string_id_t lit_id);\necma_value_t ecma_op_container_delete_weak (ecma_extended_object_t *map_object_p,\n                                            ecma_value_t key_arg,\n                                            lit_magic_string_id_t lit_id);\necma_value_t ecma_op_container_find_weak_value (ecma_object_t *object_p, ecma_value_t key_arg);\nvoid ecma_op_container_remove_weak_entry (ecma_object_t *object_p, ecma_value_t key_arg);\nvoid ecma_op_container_free_entries (ecma_object_t *object_p);\necma_value_t ecma_op_container_create_iterator (ecma_value_t this_arg,\n                                                ecma_builtin_id_t proto_id,\n                                                ecma_object_class_type_t iterator_type,\n                                                ecma_iterator_kind_t kind);\necma_value_t ecma_op_container_iterator_next (ecma_value_t this_val, ecma_object_class_type_t iterator_type);\necma_value_t ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_id,\n                                                      ecma_value_t this_arg,\n                                                      const ecma_value_t arguments_list_p[],\n                                                      lit_magic_string_id_t lit_id);\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n#endif /* !ECMA_CONTAINER_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-conversion.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Implementation of ECMA-defined conversion routines\n */\n\n#include \"ecma-conversion.h\"\n\n#include <math.h>\n\n#include \"ecma-alloc.h\"\n#include \"ecma-bigint-object.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-boolean-object.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-number-object.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-string-object.h\"\n#include \"ecma-symbol-object.h\"\n\n#include \"jrt-libc-includes.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaconversion ECMA conversion routines\n * @{\n */\n\n/**\n * RequireObjectCoercible operation.\n *\n * See also:\n *          ECMA-262 v11, 7.2.1\n *\n * @return true - if the value can be coerced to object without any exceptions\n *         false - otherwise\n */\nbool\necma_op_require_object_coercible (ecma_value_t value) /**< ecma value */\n{\n  ecma_check_value_type_is_spec_defined (value);\n\n  if (ecma_is_value_undefined (value) || ecma_is_value_null (value))\n  {\n    ecma_raise_type_error (ECMA_ERR_ARGUMENT_CANNOT_CONVERT_TO_OBJECT);\n    return false;\n  }\n\n  return true;\n} /* ecma_op_require_object_coercible */\n\n/**\n * SameValue operation.\n *\n * See also:\n *          ECMA-262 v5, 9.12\n *\n * @return true - if the value are same according to ECMA-defined SameValue algorithm,\n *         false - otherwise\n */\nbool\necma_op_same_value (ecma_value_t x, /**< ecma value */\n                    ecma_value_t y) /**< ecma value */\n{\n  if (x == y)\n  {\n    return true;\n  }\n\n  ecma_type_t type_of_x = ecma_get_value_type_field (x);\n\n  if (type_of_x != ecma_get_value_type_field (y) || type_of_x == ECMA_TYPE_DIRECT)\n  {\n    return false;\n  }\n\n  if (ecma_is_value_number (x))\n  {\n    ecma_number_t x_num = ecma_get_number_from_value (x);\n    ecma_number_t y_num = ecma_get_number_from_value (y);\n\n    bool is_x_nan = ecma_number_is_nan (x_num);\n    bool is_y_nan = ecma_number_is_nan (y_num);\n\n    if (is_x_nan || is_y_nan)\n    {\n      return is_x_nan && is_y_nan;\n    }\n\n    if (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num)\n        && ecma_number_is_negative (x_num) != ecma_number_is_negative (y_num))\n    {\n      return false;\n    }\n\n    return (x_num == y_num);\n  }\n\n  if (ecma_is_value_string (x))\n  {\n    ecma_string_t *x_str_p = ecma_get_string_from_value (x);\n    ecma_string_t *y_str_p = ecma_get_string_from_value (y);\n\n    return ecma_compare_ecma_strings (x_str_p, y_str_p);\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (ecma_is_value_bigint (x))\n  {\n    return (ecma_is_value_bigint (y) && ecma_bigint_compare_to_bigint (x, y) == 0);\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  JERRY_ASSERT (ecma_is_value_object (x) || ecma_is_value_symbol (x));\n\n  return false;\n} /* ecma_op_same_value */\n\n#if JERRY_BUILTIN_CONTAINER\n/**\n * SameValueZero operation.\n *\n * See also:\n *          ECMA-262 v6, 7.2.10\n *\n * @return true - if the value are same according to ECMA-defined SameValueZero algorithm,\n *         false - otherwise\n */\nbool\necma_op_same_value_zero (ecma_value_t x, /**< ecma value */\n                         ecma_value_t y, /**< ecma value */\n                         bool strict_equality) /**< strict equality */\n{\n  if (ecma_is_value_number (x) && ecma_is_value_number (y))\n  {\n    ecma_number_t x_num = ecma_get_number_from_value (x);\n    ecma_number_t y_num = ecma_get_number_from_value (y);\n\n    bool is_x_nan = ecma_number_is_nan (x_num);\n    bool is_y_nan = ecma_number_is_nan (y_num);\n\n    if (strict_equality && is_x_nan && is_y_nan)\n    {\n      return false;\n    }\n\n    if (is_x_nan || is_y_nan)\n    {\n      return (is_x_nan && is_y_nan);\n    }\n\n    if (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num)\n        && ecma_number_is_negative (x_num) != ecma_number_is_negative (y_num))\n    {\n      return true;\n    }\n\n    return (x_num == y_num);\n  }\n\n  return ecma_op_same_value (x, y);\n} /* ecma_op_same_value_zero */\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n/**\n * ToPrimitive operation.\n *\n * See also:\n *          ECMA-262 v5, 9.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_to_primitive (ecma_value_t value, /**< ecma value */\n                      ecma_preferred_type_hint_t preferred_type) /**< preferred type hint */\n{\n  ecma_check_value_type_is_spec_defined (value);\n\n  if (ecma_is_value_object (value))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (value);\n\n    return ecma_op_object_default_value (obj_p, preferred_type);\n  }\n  else\n  {\n    return ecma_copy_value (value);\n  }\n} /* ecma_op_to_primitive */\n\n/**\n * ToBoolean operation. Cannot throw an exception.\n *\n * See also:\n *          ECMA-262 v5, 9.2\n *\n * @return true - if the logical value is true\n *         false - otherwise\n */\nbool\necma_op_to_boolean (ecma_value_t value) /**< ecma value */\n{\n  ecma_check_value_type_is_spec_defined (value);\n\n  if (ecma_is_value_simple (value))\n  {\n    JERRY_ASSERT (ecma_is_value_boolean (value) || ecma_is_value_undefined (value) || ecma_is_value_null (value));\n\n    return ecma_is_value_true (value);\n  }\n\n  if (ecma_is_value_integer_number (value))\n  {\n    return (value != ecma_make_integer_value (0));\n  }\n\n  if (ecma_is_value_float_number (value))\n  {\n    ecma_number_t num = ecma_get_float_from_value (value);\n\n    return (!ecma_number_is_nan (num) && !ecma_number_is_zero (num));\n  }\n\n  if (ecma_is_value_string (value))\n  {\n    ecma_string_t *str_p = ecma_get_string_from_value (value);\n\n    return !ecma_string_is_empty (str_p);\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (ecma_is_value_bigint (value))\n  {\n    return value != ECMA_BIGINT_ZERO;\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  JERRY_ASSERT (ecma_is_value_object (value) || ecma_is_value_symbol (value));\n\n  return true;\n} /* ecma_op_to_boolean */\n\n/**\n * ToNumber operation.\n *\n * See also:\n *          ECMA-262 v5, 9.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_to_number (ecma_value_t value, /**< ecma value */\n                   ecma_number_t *number_p) /**< [out] ecma number */\n{\n  return ecma_op_to_numeric (value, number_p, ECMA_TO_NUMERIC_NO_OPTS);\n} /* ecma_op_to_number */\n\n/**\n * Helper to get the numeric value of an ecma value\n *\n * See also:\n *          ECMA-262 v11, 7.1.3\n *\n * @return ECMA_VALUE_EMPTY if converted to number, BigInt if\n *         converted to BigInt, and conversion error otherwise\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_to_numeric (ecma_value_t value, /**< ecma value */\n                    ecma_number_t *number_p, /**< [out] ecma number */\n                    ecma_to_numeric_options_t options) /**< option bits */\n{\n  JERRY_UNUSED (options);\n\n  if (ecma_is_value_integer_number (value))\n  {\n    *number_p = (ecma_number_t) ecma_get_integer_from_value (value);\n    return ECMA_VALUE_EMPTY;\n  }\n\n  if (ecma_is_value_float_number (value))\n  {\n    *number_p = ecma_get_float_from_value (value);\n    return ECMA_VALUE_EMPTY;\n  }\n\n  if (ecma_is_value_string (value))\n  {\n    ecma_string_t *str_p = ecma_get_string_from_value (value);\n    *number_p = ecma_string_to_number (str_p);\n    return ECMA_VALUE_EMPTY;\n  }\n\n  if (ecma_is_value_undefined (value))\n  {\n    *number_p = ecma_number_make_nan ();\n    return ECMA_VALUE_EMPTY;\n  }\n\n  if (ecma_is_value_null (value))\n  {\n    *number_p = 0;\n    return ECMA_VALUE_EMPTY;\n  }\n\n  if (ecma_is_value_true (value))\n  {\n    *number_p = 1;\n    return ECMA_VALUE_EMPTY;\n  }\n\n  if (ecma_is_value_false (value))\n  {\n    *number_p = 0;\n    return ECMA_VALUE_EMPTY;\n  }\n\n  if (ecma_is_value_symbol (value))\n  {\n    return ecma_raise_type_error (ECMA_ERR_CONVERT_SYMBOL_TO_NUMBER);\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (ecma_is_value_bigint (value))\n  {\n    if (options & ECMA_TO_NUMERIC_ALLOW_BIGINT)\n    {\n      return ecma_copy_value (value);\n    }\n    return ecma_raise_type_error (ECMA_ERR_CONVERT_BIGINT_TO_NUMBER);\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  JERRY_ASSERT (ecma_is_value_object (value));\n\n  ecma_object_t *object_p = ecma_get_object_from_value (value);\n\n  ecma_value_t def_value = ecma_op_object_default_value (object_p, ECMA_PREFERRED_TYPE_NUMBER);\n\n  if (ECMA_IS_VALUE_ERROR (def_value))\n  {\n    return def_value;\n  }\n\n  ecma_value_t ret_value = ecma_op_to_numeric (def_value, number_p, options);\n\n  ecma_fast_free_value (def_value);\n\n  return ret_value;\n} /* ecma_op_to_numeric */\n\n/**\n * ToString operation.\n *\n * See also:\n *          ECMA-262 v5, 9.8\n *\n * @return NULL - if the conversion fails\n *         pointer to the string descriptor - otherwise\n */\necma_string_t *\necma_op_to_string (ecma_value_t value) /**< ecma value */\n{\n  ecma_check_value_type_is_spec_defined (value);\n\n  if (ecma_is_value_string (value))\n  {\n    ecma_string_t *res_p = ecma_get_string_from_value (value);\n    ecma_ref_ecma_string (res_p);\n    return res_p;\n  }\n\n  if (ecma_is_value_integer_number (value))\n  {\n    ecma_integer_value_t num = ecma_get_integer_from_value (value);\n\n    if (num < 0)\n    {\n      return ecma_new_ecma_string_from_number ((ecma_number_t) num);\n    }\n    else\n    {\n      return ecma_new_ecma_string_from_uint32 ((uint32_t) num);\n    }\n  }\n\n  if (ecma_is_value_float_number (value))\n  {\n    ecma_number_t num = ecma_get_float_from_value (value);\n    return ecma_new_ecma_string_from_number (num);\n  }\n\n  if (ecma_is_value_undefined (value))\n  {\n    return ecma_get_magic_string (LIT_MAGIC_STRING_UNDEFINED);\n  }\n\n  if (ecma_is_value_null (value))\n  {\n    return ecma_get_magic_string (LIT_MAGIC_STRING_NULL);\n  }\n\n  if (ecma_is_value_true (value))\n  {\n    return ecma_get_magic_string (LIT_MAGIC_STRING_TRUE);\n  }\n\n  if (ecma_is_value_false (value))\n  {\n    return ecma_get_magic_string (LIT_MAGIC_STRING_FALSE);\n  }\n\n  if (ecma_is_value_symbol (value))\n  {\n    ecma_raise_type_error (ECMA_ERR_CONVERT_SYMBOL_TO_STRING);\n    return NULL;\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (ecma_is_value_bigint (value))\n  {\n    return ecma_bigint_to_string (value, 10);\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  JERRY_ASSERT (ecma_is_value_object (value));\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (value);\n\n  ecma_value_t def_value = ecma_op_object_default_value (obj_p, ECMA_PREFERRED_TYPE_STRING);\n\n  if (ECMA_IS_VALUE_ERROR (def_value))\n  {\n    return NULL;\n  }\n\n  ecma_string_t *ret_string_p = ecma_op_to_string (def_value);\n\n  ecma_free_value (def_value);\n\n  return ret_string_p;\n} /* ecma_op_to_string */\n\n/**\n * ToPropertyKey operation.\n *\n * See also:\n *   ECMA 262 v6, 7.1.14\n *   ECMA 262 v10, 7.1.14\n *   ECMA 262 v11, 7.1.19\n *\n * @return NULL - if the conversion fails\n *         ecma-string - otherwise\n */\necma_string_t *\necma_op_to_property_key (ecma_value_t value) /**< ecma value */\n{\n  /* Fast path for strings and symbols */\n  if (JERRY_LIKELY (ecma_is_value_prop_name (value)))\n  {\n    ecma_string_t *key_p = ecma_get_prop_name_from_value (value);\n    ecma_ref_ecma_string (key_p);\n    return key_p;\n  }\n\n  ecma_value_t key = ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_STRING);\n\n  if (ECMA_IS_VALUE_ERROR (key))\n  {\n    return NULL;\n  }\n\n  if (ecma_is_value_symbol (key))\n  {\n    ecma_string_t *symbol_p = ecma_get_symbol_from_value (key);\n    return symbol_p;\n  }\n\n  ecma_string_t *result = ecma_op_to_string (key);\n  ecma_free_value (key);\n\n  return result;\n} /* ecma_op_to_property_key */\n\n/**\n * ToObject operation.\n *\n * See also:\n *          ECMA-262 v5, 9.9\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_to_object (ecma_value_t value) /**< ecma value */\n{\n  ecma_check_value_type_is_spec_defined (value);\n  ecma_builtin_id_t proto_id = ECMA_BUILTIN_ID_OBJECT_PROTOTYPE;\n  uint8_t class_type;\n\n  if (ecma_is_value_number (value))\n  {\n#if JERRY_BUILTIN_NUMBER\n    proto_id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE;\n#endif /* JERRY_BUILTIN_NUMBER */\n    class_type = ECMA_OBJECT_CLASS_NUMBER;\n  }\n  else if (ecma_is_value_string (value))\n  {\n#if JERRY_BUILTIN_STRING\n    proto_id = ECMA_BUILTIN_ID_STRING_PROTOTYPE;\n#endif /* JERRY_BUILTIN_STRING */\n    class_type = ECMA_OBJECT_CLASS_STRING;\n  }\n  else if (ecma_is_value_object (value))\n  {\n    return ecma_copy_value (value);\n  }\n  else if (ecma_is_value_symbol (value))\n  {\n    proto_id = ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE;\n    class_type = ECMA_OBJECT_CLASS_SYMBOL;\n  }\n#if JERRY_BUILTIN_BIGINT\n  else if (ecma_is_value_bigint (value))\n  {\n    return ecma_op_create_bigint_object (value);\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n  else\n  {\n    if (ecma_is_value_undefined (value) || ecma_is_value_null (value))\n    {\n      return ecma_raise_type_error (ECMA_ERR_ARGUMENT_CANNOT_CONVERT_TO_OBJECT);\n    }\n    else\n    {\n      JERRY_ASSERT (ecma_is_value_boolean (value));\n#if JERRY_BUILTIN_BOOLEAN\n      proto_id = ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE;\n#endif /* JERRY_BUILTIN_BOOLEAN */\n      class_type = ECMA_OBJECT_CLASS_BOOLEAN;\n    }\n  }\n\n  ecma_object_t *object_p =\n    ecma_create_object (ecma_builtin_get (proto_id), sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.type = class_type;\n  ext_object_p->u.cls.u3.value = ecma_copy_value_if_not_object (value);\n\n  return ecma_make_object_value (object_p);\n} /* ecma_op_to_object */\n\n/**\n * FromPropertyDescriptor operation.\n *\n * See also:\n *          ECMA-262 v5, 8.10.4\n *\n * @return constructed object\n */\necma_object_t *\necma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_desc_p) /**< property descriptor */\n{\n  /* 2. */\n  ecma_object_t *obj_p = ecma_op_create_object_object_noarg ();\n\n  ecma_value_t completion;\n  ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();\n  {\n    prop_desc.flags = (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE\n                       | JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE\n                       | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE);\n  }\n\n  /* 3. */\n  if (src_prop_desc_p->flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED))\n  {\n    JERRY_ASSERT ((prop_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED))\n                  == (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED));\n\n    /* a. */\n    prop_desc.value = src_prop_desc_p->value;\n\n    completion = ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_VALUE), &prop_desc);\n    JERRY_ASSERT (ecma_is_value_true (completion));\n\n    /* b. */\n    prop_desc.value = ecma_make_boolean_value (src_prop_desc_p->flags & JERRY_PROP_IS_WRITABLE);\n\n    completion =\n      ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE), &prop_desc);\n    JERRY_ASSERT (ecma_is_value_true (completion));\n  }\n  else if (src_prop_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))\n  {\n    /* a. */\n    if (src_prop_desc_p->get_p == NULL)\n    {\n      prop_desc.value = ECMA_VALUE_UNDEFINED;\n    }\n    else\n    {\n      prop_desc.value = ecma_make_object_value (src_prop_desc_p->get_p);\n    }\n\n    completion = ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_GET), &prop_desc);\n    JERRY_ASSERT (ecma_is_value_true (completion));\n\n    /* b. */\n    if (src_prop_desc_p->set_p == NULL)\n    {\n      prop_desc.value = ECMA_VALUE_UNDEFINED;\n    }\n    else\n    {\n      prop_desc.value = ecma_make_object_value (src_prop_desc_p->set_p);\n    }\n\n    completion = ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_SET), &prop_desc);\n    JERRY_ASSERT (ecma_is_value_true (completion));\n  }\n\n  prop_desc.value = ecma_make_boolean_value (src_prop_desc_p->flags & JERRY_PROP_IS_ENUMERABLE);\n\n  completion =\n    ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE), &prop_desc);\n  JERRY_ASSERT (ecma_is_value_true (completion));\n\n  prop_desc.value = ecma_make_boolean_value (src_prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE);\n\n  completion =\n    ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE), &prop_desc);\n  JERRY_ASSERT (ecma_is_value_true (completion));\n\n  return obj_p;\n} /* ecma_op_from_property_descriptor */\n\n/**\n * ToPropertyDescriptor operation.\n *\n * See also:\n *          ECMA-262 v5, 8.10.5\n *\n * @return ECMA_VALUE_EMPTY if successful, ECMA_VALUE_ERROR otherwise\n */\necma_value_t\necma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */\n                                ecma_property_descriptor_t *out_prop_desc_p) /**< [out] filled property descriptor\n                                                                              *   if the operation is successful,\n                                                                              *   unmodified otherwise */\n{\n  /* 1. */\n  if (!ecma_is_value_object (obj_value))\n  {\n    return ecma_raise_type_error (ECMA_ERR_EXPECTED_AN_OBJECT);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (obj_value);\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n\n  /* 3. */\n  ecma_value_t enumerable_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE));\n\n  if (ECMA_IS_VALUE_ERROR (enumerable_prop_value))\n  {\n    return enumerable_prop_value;\n  }\n\n  /* 2. */\n  ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();\n\n  if (ecma_is_value_found (enumerable_prop_value))\n  {\n    uint32_t is_enumerable =\n      (ecma_op_to_boolean (enumerable_prop_value) ? JERRY_PROP_IS_ENUMERABLE : JERRY_PROP_NO_OPTS);\n\n    prop_desc.flags |= (uint16_t) (JERRY_PROP_IS_ENUMERABLE_DEFINED | is_enumerable);\n\n    ecma_free_value (enumerable_prop_value);\n  }\n\n  /* 4. */\n  ecma_value_t configurable_prop_value =\n    ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE));\n\n  if (ECMA_IS_VALUE_ERROR (configurable_prop_value))\n  {\n    goto free_desc;\n  }\n\n  if (ecma_is_value_found (configurable_prop_value))\n  {\n    uint32_t is_configurable =\n      (ecma_op_to_boolean (configurable_prop_value) ? JERRY_PROP_IS_CONFIGURABLE : JERRY_PROP_NO_OPTS);\n\n    prop_desc.flags |= (uint16_t) (JERRY_PROP_IS_CONFIGURABLE_DEFINED | is_configurable);\n\n    ecma_free_value (configurable_prop_value);\n  }\n\n  /* 5. */\n  ecma_value_t value_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_VALUE));\n\n  if (ECMA_IS_VALUE_ERROR (value_prop_value))\n  {\n    goto free_desc;\n  }\n\n  if (ecma_is_value_found (value_prop_value))\n  {\n    prop_desc.flags |= JERRY_PROP_IS_VALUE_DEFINED;\n    prop_desc.value = ecma_copy_value (value_prop_value);\n    ecma_free_value (value_prop_value);\n  }\n\n  /* 6. */\n  ecma_value_t writable_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE));\n\n  if (ECMA_IS_VALUE_ERROR (writable_prop_value))\n  {\n    goto free_desc;\n  }\n\n  if (ecma_is_value_found (writable_prop_value))\n  {\n    uint32_t is_writable = (ecma_op_to_boolean (writable_prop_value) ? JERRY_PROP_IS_WRITABLE : JERRY_PROP_NO_OPTS);\n\n    prop_desc.flags |= (uint16_t) (JERRY_PROP_IS_WRITABLE_DEFINED | is_writable);\n\n    ecma_free_value (writable_prop_value);\n  }\n\n  /* 7. */\n  ecma_value_t get_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_GET));\n\n  if (ECMA_IS_VALUE_ERROR (get_prop_value))\n  {\n    goto free_desc;\n  }\n\n  if (ecma_is_value_found (get_prop_value))\n  {\n    if (!ecma_op_is_callable (get_prop_value) && !ecma_is_value_undefined (get_prop_value))\n    {\n      ecma_free_value (get_prop_value);\n      ret_value = ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION);\n      goto free_desc;\n    }\n\n    prop_desc.flags |= JERRY_PROP_IS_GET_DEFINED;\n\n    if (ecma_is_value_undefined (get_prop_value))\n    {\n      prop_desc.get_p = NULL;\n    }\n    else\n    {\n      JERRY_ASSERT (ecma_is_value_object (get_prop_value));\n\n      ecma_object_t *get_p = ecma_get_object_from_value (get_prop_value);\n      ecma_ref_object (get_p);\n\n      prop_desc.get_p = get_p;\n    }\n\n    ecma_free_value (get_prop_value);\n  }\n\n  /* 8. */\n  ecma_value_t set_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_SET));\n\n  if (ECMA_IS_VALUE_ERROR (set_prop_value))\n  {\n    goto free_desc;\n  }\n\n  if (ecma_is_value_found (set_prop_value))\n  {\n    if (!ecma_op_is_callable (set_prop_value) && !ecma_is_value_undefined (set_prop_value))\n    {\n      ecma_free_value (set_prop_value);\n      ret_value = ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION);\n      goto free_desc;\n    }\n\n    prop_desc.flags |= JERRY_PROP_IS_SET_DEFINED;\n\n    if (ecma_is_value_undefined (set_prop_value))\n    {\n      prop_desc.set_p = NULL;\n    }\n    else\n    {\n      JERRY_ASSERT (ecma_is_value_object (set_prop_value));\n\n      ecma_object_t *set_p = ecma_get_object_from_value (set_prop_value);\n      ecma_ref_object (set_p);\n\n      prop_desc.set_p = set_p;\n    }\n\n    ecma_free_value (set_prop_value);\n  }\n\n  /* 9. */\n  if ((prop_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED))\n      && (prop_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)))\n  {\n    ret_value = ecma_raise_type_error (ECMA_ERR_ACCESSOR_WRITABLE);\n  }\n  else\n  {\n    *out_prop_desc_p = prop_desc;\n    ret_value = ECMA_VALUE_EMPTY;\n  }\n\nfree_desc:\n  if (ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    ecma_free_property_descriptor (&prop_desc);\n  }\n\n  return ret_value;\n} /* ecma_op_to_property_descriptor */\n\n/**\n * IsInteger operation.\n *\n * See also:\n *          ECMA-262 v5, 9.4\n *          ECMA-262 v6, 7.1.4\n *\n * @return true - if the argument is integer\n *              false - otherwise\n */\nbool\necma_op_is_integer (ecma_number_t num) /**< ecma number */\n{\n  if (ecma_number_is_nan (num) || ecma_number_is_infinity (num))\n  {\n    return false;\n  }\n\n  ecma_number_t floor_fabs = (ecma_number_t) floor (fabs (num));\n  ecma_number_t fabs_value = (ecma_number_t) fabs (num);\n\n  return (floor_fabs == fabs_value);\n} /* ecma_op_is_integer */\n\n/**\n * ToInteger operation.\n *\n * See also:\n *          ECMA-262 v5, 9.4\n *          ECMA-262 v6, 7.1.4\n *\n * @return ECMA_VALUE_EMPTY if successful\n *         conversion error otherwise\n */\necma_value_t\necma_op_to_integer (ecma_value_t value, /**< ecma value */\n                    ecma_number_t *number_p) /**< [out] ecma number */\n{\n  if (ECMA_IS_VALUE_ERROR (value))\n  {\n    return value;\n  }\n\n  /* 1 */\n  ecma_value_t to_number = ecma_op_to_number (value, number_p);\n\n  /* 2 */\n  if (ECMA_IS_VALUE_ERROR (to_number))\n  {\n    return to_number;\n  }\n\n  ecma_number_t number = *number_p;\n\n  /* 3 */\n  if (ecma_number_is_nan (number))\n  {\n    *number_p = ECMA_NUMBER_ZERO;\n    return ECMA_VALUE_EMPTY;\n  }\n\n  /* 4 */\n  if (ecma_number_is_zero (number) || ecma_number_is_infinity (number))\n  {\n    return ECMA_VALUE_EMPTY;\n  }\n\n  ecma_number_t floor_fabs = (ecma_number_t) floor (fabs (number));\n  /* 5 */\n  *number_p = ecma_number_is_negative (number) ? -floor_fabs : floor_fabs;\n  return ECMA_VALUE_EMPTY;\n} /* ecma_op_to_integer */\n\n/**\n * ToLength operation.\n *\n * See also:\n *          ECMA-262 v6, 7.1.15\n *\n * @return ECMA_VALUE_EMPTY if successful\n *         conversion error otherwise\n */\necma_value_t\necma_op_to_length (ecma_value_t value, /**< ecma value */\n                   ecma_length_t *length) /**< [out] ecma number */\n{\n  /* 1 */\n  if (ECMA_IS_VALUE_ERROR (value))\n  {\n    return value;\n  }\n\n  /* 2 */\n  ecma_number_t num;\n  ecma_value_t length_num = ecma_op_to_integer (value, &num);\n\n  /* 3 */\n  if (ECMA_IS_VALUE_ERROR (length_num))\n  {\n    return length_num;\n  }\n\n  /* 4 */\n  if (num <= 0.0f)\n  {\n    *length = 0;\n    return ECMA_VALUE_EMPTY;\n  }\n\n  /* 5 */\n  if (num >= ECMA_NUMBER_MAX_SAFE_INTEGER)\n  {\n    *length = (ecma_length_t) ECMA_NUMBER_MAX_SAFE_INTEGER;\n    return ECMA_VALUE_EMPTY;\n  }\n\n  /* 6 */\n  *length = (ecma_length_t) num;\n  return ECMA_VALUE_EMPTY;\n} /* ecma_op_to_length */\n\n/**\n * ToIndex operation.\n *\n * See also:\n *          ECMA-262 v11, 7.1.22\n *\n * @return ECMA_VALUE_EMPTY if successful\n *         conversion error otherwise\n */\necma_value_t\necma_op_to_index (ecma_value_t value, /**< ecma value */\n                  ecma_number_t *index) /**< [out] ecma number */\n{\n  /* 1. */\n  if (ecma_is_value_undefined (value))\n  {\n    *index = 0;\n    return ECMA_VALUE_EMPTY;\n  }\n\n  /* 2.a */\n  ecma_number_t integer_index;\n  ecma_value_t index_value = ecma_op_to_integer (value, &integer_index);\n\n  if (ECMA_IS_VALUE_ERROR (index_value))\n  {\n    return index_value;\n  }\n\n  /* 2.b - 2.d */\n  if (integer_index < 0.0f || integer_index > ECMA_NUMBER_MAX_SAFE_INTEGER)\n  {\n    return ecma_raise_range_error (ECMA_ERR_INVALID_OR_OUT_OF_RANGE_INDEX);\n  }\n\n  /* 3. */\n  *index = integer_index;\n  return ECMA_VALUE_EMPTY;\n} /* ecma_op_to_index */\n\n/**\n * CreateListFromArrayLike operation.\n * Different types are not handled yet.\n *\n * See also:\n *          ECMA-262 v6, 7.3.17\n *\n * @return ecma_collection_t if successful\n *         NULL otherwise\n */\necma_collection_t *\necma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */\n                                     bool prop_names_only) /**< true - accept only property names\n                                                                false - otherwise */\n{\n  /* 1. */\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (arr));\n\n  /* 3. */\n  if (!ecma_is_value_object (arr))\n  {\n    ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);\n    return NULL;\n  }\n  ecma_object_t *obj_p = ecma_get_object_from_value (arr);\n\n  /* 4. 5. */\n  ecma_length_t len;\n  if (ECMA_IS_VALUE_ERROR (ecma_op_object_get_length (obj_p, &len)))\n  {\n    return NULL;\n  }\n\n  /* 6. */\n  ecma_collection_t *list_ptr = ecma_new_collection ();\n\n  /* 7. 8. */\n  for (ecma_length_t idx = 0; idx < len; idx++)\n  {\n    ecma_value_t next = ecma_op_object_get_by_index (obj_p, idx);\n    if (ECMA_IS_VALUE_ERROR (next))\n    {\n      ecma_collection_free (list_ptr);\n      return NULL;\n    }\n\n    if (prop_names_only && !ecma_is_value_prop_name (next))\n    {\n      ecma_free_value (next);\n      ecma_collection_free (list_ptr);\n      ecma_raise_type_error (ECMA_ERR_PROPERTY_NAME_IS_NEITHER_SYMBOL_NOR_STRING);\n      return NULL;\n    }\n\n    ecma_collection_push_back (list_ptr, next);\n  }\n\n  /* 9. */\n  return list_ptr;\n} /* ecma_op_create_list_from_array_like */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-conversion.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_CONVERSION_H\n#define ECMA_CONVERSION_H\n\n#include \"ecma-builtins.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaconversion ECMA conversion routines\n * @{\n */\n\n/**\n * Second argument of 'ToPrimitive' operation that is a hint,\n * specifying the preferred type of conversion result.\n */\ntypedef enum\n{\n  ECMA_PREFERRED_TYPE_NO = 0, /**< no preferred type is specified */\n  ECMA_PREFERRED_TYPE_NUMBER, /**< Number */\n  ECMA_PREFERRED_TYPE_STRING /**< String */\n} ecma_preferred_type_hint_t;\n\n/**\n * Option bits for ecma_op_to_numeric.\n */\ntypedef enum\n{\n  ECMA_TO_NUMERIC_NO_OPTS = 0, /**< no options (same as toNumber operation) */\n  ECMA_TO_NUMERIC_ALLOW_BIGINT = (1 << 0), /**< allow BigInt values (ignored if BigInts are disabled) */\n} ecma_to_numeric_options_t;\n\nbool ecma_op_require_object_coercible (ecma_value_t value);\nbool ecma_op_same_value (ecma_value_t x, ecma_value_t y);\n#if JERRY_BUILTIN_CONTAINER\nbool ecma_op_same_value_zero (ecma_value_t x, ecma_value_t y, bool strict_equality);\n#endif /* JERRY_BUILTIN_CONTAINER */\necma_value_t ecma_op_to_primitive (ecma_value_t value, ecma_preferred_type_hint_t preferred_type);\nbool ecma_op_to_boolean (ecma_value_t value);\necma_value_t ecma_op_to_number (ecma_value_t value, ecma_number_t *number_p);\necma_value_t ecma_op_to_numeric (ecma_value_t value, ecma_number_t *number_p, ecma_to_numeric_options_t options);\necma_string_t *ecma_op_to_string (ecma_value_t value);\necma_string_t *ecma_op_to_property_key (ecma_value_t value);\necma_value_t ecma_op_to_object (ecma_value_t value);\nbool ecma_op_is_integer (ecma_number_t value);\necma_value_t ecma_op_to_integer (ecma_value_t value, ecma_number_t *number_p);\necma_value_t ecma_op_to_length (ecma_value_t value, ecma_length_t *length);\necma_value_t ecma_op_to_index (ecma_value_t value, ecma_number_t *index);\necma_collection_t *ecma_op_create_list_from_array_like (ecma_value_t arr, bool prop_names_only);\n\necma_object_t *ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_desc_p);\necma_value_t ecma_op_to_property_descriptor (ecma_value_t obj_value, ecma_property_descriptor_t *out_prop_desc_p);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_CONVERSION_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-dataview-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-dataview-object.h\"\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-shared-arraybuffer-object.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jcontext.h\"\n\n#if JERRY_BUILTIN_DATAVIEW\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmadataviewobject ECMA builtin DataView helper functions\n * @{\n */\n\n/**\n * Handle calling [[Construct]] of built-in DataView like objects\n *\n * See also:\n *          ECMA-262 v11, 24.3.2.1\n *\n * @return created DataView object as an ecma-value - if success\n *         raised error - otherwise\n */\necma_value_t\necma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments list */\n                         uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n  JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p));\n\n  ecma_value_t buffer = arguments_list_len > 0 ? arguments_list_p[0] : ECMA_VALUE_UNDEFINED;\n\n  /* 2. */\n  if (!ecma_is_value_object (buffer))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_BUFFER_NOT_OBJECT);\n  }\n\n  ecma_object_t *buffer_p = ecma_get_object_from_value (buffer);\n\n  if (!(ecma_object_class_is (buffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)\n        || ecma_object_is_shared_arraybuffer (buffer_p)))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_BUFFER_NOT_ARRAY_OR_SHARED_BUFFER);\n  }\n\n  /* 3. */\n  ecma_number_t offset = 0;\n\n  if (arguments_list_len > 1)\n  {\n    ecma_value_t offset_value = ecma_op_to_index (arguments_list_p[1], &offset);\n    if (ECMA_IS_VALUE_ERROR (offset_value))\n    {\n      return offset_value;\n    }\n  }\n\n  /* 4. */\n  if (ecma_arraybuffer_is_detached (buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  /* 5. */\n  ecma_number_t buffer_byte_length = ecma_arraybuffer_get_length (buffer_p);\n\n  /* 6. */\n  if (offset > buffer_byte_length)\n  {\n    return ecma_raise_range_error (ECMA_ERR_START_OFFSET_IS_OUTSIDE_THE_BOUNDS_OF_THE_BUFFER);\n  }\n\n  /* 7. */\n  uint32_t view_byte_length;\n  if (arguments_list_len > 2 && !ecma_is_value_undefined (arguments_list_p[2]))\n  {\n    /* 8.a */\n    ecma_number_t byte_length_to_index;\n    ecma_value_t byte_length_value = ecma_op_to_index (arguments_list_p[2], &byte_length_to_index);\n\n    if (ECMA_IS_VALUE_ERROR (byte_length_value))\n    {\n      return byte_length_value;\n    }\n\n    /* 8.b */\n    if (offset + byte_length_to_index > buffer_byte_length)\n    {\n      return ecma_raise_range_error (ECMA_ERR_START_OFFSET_IS_OUTSIDE_THE_BOUNDS_OF_THE_BUFFER);\n    }\n\n    JERRY_ASSERT (byte_length_to_index <= UINT32_MAX);\n    view_byte_length = (uint32_t) byte_length_to_index;\n  }\n  else\n  {\n    /* 7.a */\n    view_byte_length = (uint32_t) (buffer_byte_length - offset);\n  }\n\n  /* 9. */\n  ecma_object_t *prototype_obj_p =\n    ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE);\n  if (JERRY_UNLIKELY (prototype_obj_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 10. */\n  if (ecma_arraybuffer_is_detached (buffer_p))\n  {\n    ecma_deref_object (prototype_obj_p);\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  /* 9. */\n  /* It must happen after 10., because uninitialized object can't be destroyed properly. */\n  ecma_object_t *object_p =\n    ecma_create_object (prototype_obj_p, sizeof (ecma_dataview_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_deref_object (prototype_obj_p);\n\n  /* 11 - 14. */\n  ecma_dataview_object_t *dataview_obj_p = (ecma_dataview_object_t *) object_p;\n  dataview_obj_p->header.u.cls.type = ECMA_OBJECT_CLASS_DATAVIEW;\n  dataview_obj_p->header.u.cls.u3.length = view_byte_length;\n  dataview_obj_p->buffer_p = buffer_p;\n  dataview_obj_p->byte_offset = (uint32_t) offset;\n\n  return ecma_make_object_value (object_p);\n} /* ecma_op_dataview_create */\n\n/**\n * Get the DataView object pointer\n *\n * Note:\n *   If the function returns with NULL, the error object has\n *   already set, and the caller must return with ECMA_VALUE_ERROR\n *\n * @return pointer to the dataView if this_arg is a valid dataView object\n *         NULL otherwise\n */\necma_dataview_object_t *\necma_op_dataview_get_object (ecma_value_t this_arg) /**< this argument */\n{\n  if (ecma_is_value_object (this_arg))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_DATAVIEW))\n    {\n      return (ecma_dataview_object_t *) object_p;\n    }\n  }\n\n  ecma_raise_type_error (ECMA_ERR_EXPECTED_A_DATAVIEW_OBJECT);\n  return NULL;\n} /* ecma_op_dataview_get_object */\n\n/**\n * Helper union to specify the system's endiannes\n */\ntypedef union\n{\n  uint32_t number; /**< for write numeric data */\n  char data[sizeof (uint32_t)]; /**< for read numeric data */\n} ecma_dataview_endiannes_check_t;\n\n/**\n * Helper function to check the current system endiannes\n *\n * @return true - if the current system has little endian byteorder\n *         false - otherwise\n */\nstatic bool\necma_dataview_check_little_endian (void)\n{\n  ecma_dataview_endiannes_check_t checker;\n  checker.number = 0x01;\n\n  return checker.data[0] == 0x01;\n} /* ecma_dataview_check_little_endian */\n\n/**\n * Helper function for swap bytes if the system's endiannes\n * does not match with the requested endiannes.\n */\nstatic void\necma_dataview_swap_order (bool system_is_little_endian, /**< true - if the system has little endian byteorder\n                                                         *   false - otherwise */\n                          bool is_little_endian, /**< true - if little endian byteorder is requested\n                                                  *   false - otherwise */\n                          uint32_t element_size, /**< element size byte according to the Table 49.*/\n                          lit_utf8_byte_t *block_p) /**< data block */\n{\n  if (system_is_little_endian ^ is_little_endian)\n  {\n    for (uint32_t i = 0; i < element_size / 2; i++)\n    {\n      lit_utf8_byte_t tmp = block_p[i];\n      block_p[i] = block_p[element_size - i - 1];\n      block_p[element_size - i - 1] = tmp;\n    }\n  }\n} /* ecma_dataview_swap_order */\n\n/**\n * GetViewValue and SetViewValue abstact operation\n *\n * See also:\n *          ECMA-262 v11, 24.3.1.1\n *          ECMA-262 v11, 24.3.1.2\n *\n * @return ecma value\n */\necma_value_t\necma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'view' argument */\n                                     ecma_value_t request_index, /**< the operation's 'requestIndex' argument */\n                                     ecma_value_t is_little_endian_value, /**< the operation's\n                                                                           *   'isLittleEndian' argument */\n                                     ecma_value_t value_to_set, /**< the operation's 'value' argument */\n                                     ecma_typedarray_type_t id) /**< the operation's 'type' argument */\n{\n  /* 1 - 2. */\n  ecma_dataview_object_t *view_p = ecma_op_dataview_get_object (view);\n\n  if (JERRY_UNLIKELY (view_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_object_t *buffer_p = view_p->buffer_p;\n  JERRY_ASSERT (ecma_object_class_is (buffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)\n                || ecma_object_is_shared_arraybuffer (buffer_p));\n\n  /* 3. */\n  ecma_number_t get_index;\n  ecma_value_t number_index_value = ecma_op_to_index (request_index, &get_index);\n\n  if (ECMA_IS_VALUE_ERROR (number_index_value))\n  {\n    return number_index_value;\n  }\n\n  /* SetViewValue 4 - 5. */\n  if (!ecma_is_value_empty (value_to_set))\n  {\n#if JERRY_BUILTIN_BIGINT\n    if (ECMA_TYPEDARRAY_IS_BIGINT_TYPE (id))\n    {\n      value_to_set = ecma_bigint_to_bigint (value_to_set, true);\n\n      if (ECMA_IS_VALUE_ERROR (value_to_set))\n      {\n        return value_to_set;\n      }\n    }\n    else\n#endif /* JERRY_BUILTIN_BIGINT */\n    {\n      ecma_number_t value_to_set_number;\n      ecma_value_t value = ecma_op_to_number (value_to_set, &value_to_set_number);\n\n      if (ECMA_IS_VALUE_ERROR (value))\n      {\n        return value;\n      }\n\n      value_to_set = ecma_make_number_value (value_to_set_number);\n    }\n  }\n\n  /* GetViewValue 4., SetViewValue 6. */\n  bool is_little_endian = ecma_op_to_boolean (is_little_endian_value);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (buffer_p))\n  {\n    ecma_free_value (value_to_set);\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (buffer_p))\n  {\n    ecma_free_value (value_to_set);\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  /* GetViewValue 7., SetViewValue 9. */\n  uint32_t view_offset = view_p->byte_offset;\n\n  /* GetViewValue 8., SetViewValue 10. */\n  uint32_t view_size = view_p->header.u.cls.u3.length;\n\n  /* GetViewValue 9., SetViewValue 11. */\n  uint8_t element_size = (uint8_t) (1 << (ecma_typedarray_helper_get_shift_size (id)));\n\n  /* GetViewValue 10., SetViewValue 12. */\n  if (get_index + element_size > (ecma_number_t) view_size)\n  {\n    ecma_free_value (value_to_set);\n    return ecma_raise_range_error (ECMA_ERR_START_OFFSET_IS_OUTSIDE_THE_BOUNDS_OF_THE_BUFFER);\n  }\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (buffer_p))\n  {\n    ecma_free_value (value_to_set);\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (buffer_p))\n  {\n    ecma_free_value (value_to_set);\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  /* GetViewValue 11., SetViewValue 13. */\n  bool system_is_little_endian = ecma_dataview_check_little_endian ();\n\n  ecma_typedarray_info_t info;\n  info.id = id;\n  info.length = view_size;\n  info.shift = ecma_typedarray_helper_get_shift_size (id);\n  info.element_size = element_size;\n  info.offset = view_p->byte_offset;\n  info.array_buffer_p = buffer_p;\n\n  /* GetViewValue 12. */\n  uint8_t *block_p = ecma_arraybuffer_get_buffer (buffer_p) + (uint32_t) get_index + view_offset;\n\n  if (ecma_is_value_empty (value_to_set))\n  {\n    JERRY_VLA (lit_utf8_byte_t, swap_block_p, element_size);\n    memcpy (swap_block_p, block_p, element_size * sizeof (lit_utf8_byte_t));\n    ecma_dataview_swap_order (system_is_little_endian, is_little_endian, element_size, swap_block_p);\n\n    ecma_typedarray_getter_fn_t typedarray_getter_cb = ecma_get_typedarray_getter_fn (info.id);\n    return typedarray_getter_cb (swap_block_p);\n  }\n\n  if (!ecma_number_is_nan (get_index) && get_index <= 0)\n  {\n    get_index = 0;\n  }\n\n  /* SetViewValue 14. */\n  ecma_typedarray_setter_fn_t typedarray_setter_cb = ecma_get_typedarray_setter_fn (info.id);\n  ecma_value_t set_element = typedarray_setter_cb (block_p, value_to_set);\n\n  ecma_free_value (value_to_set);\n\n  if (ECMA_IS_VALUE_ERROR (set_element))\n  {\n    return set_element;\n  }\n\n  ecma_dataview_swap_order (system_is_little_endian, is_little_endian, element_size, block_p);\n\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_op_dataview_get_set_view_value */\n\n/**\n * Check if the value is dataview\n *\n * @return true - if value is a DataView object\n *         false - otherwise\n */\nbool\necma_is_dataview (ecma_value_t value) /**< the target need to be checked */\n{\n  if (!ecma_is_value_object (value))\n  {\n    return false;\n  }\n\n  return ecma_object_class_is (ecma_get_object_from_value (value), ECMA_OBJECT_CLASS_DATAVIEW);\n} /* ecma_is_dataview */\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_DATAVIEW */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-dataview-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_DATAVIEW_OBJECT_H\n#define ECMA_DATAVIEW_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n#if JERRY_BUILTIN_DATAVIEW\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmadataviewobject ECMA builtin DataView helper functions\n * @{\n */\n\necma_value_t ecma_op_dataview_create (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);\necma_dataview_object_t *ecma_op_dataview_get_object (ecma_value_t this_arg);\necma_value_t ecma_op_dataview_get_set_view_value (ecma_value_t view,\n                                                  ecma_value_t request_index,\n                                                  ecma_value_t little_endian,\n                                                  ecma_value_t value_to_set,\n                                                  ecma_typedarray_type_t id);\nbool ecma_is_dataview (ecma_value_t value);\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_DATAVIEW */\n\n#endif /* !ECMA_DATAVIEW_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-eval.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-eval.h\"\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-lex-env.h\"\n\n#include \"jcontext.h\"\n#include \"js-parser.h\"\n#include \"vm.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup eval eval\n * @{\n */\n\n/**\n * Perform 'eval' with code stored in ecma-string\n *\n * See also:\n *          ecma_op_eval_chars_buffer\n *          ECMA-262 v5, 15.1.2.1 (steps 2 to 8)\n *\n * @return ecma value\n */\necma_value_t\necma_op_eval (ecma_value_t source_code, /**< source code */\n              uint32_t parse_opts) /**< ecma_parse_opts_t option bits */\n{\n  JERRY_ASSERT (ecma_is_value_string (source_code));\n\n  if (ecma_is_value_magic_string (source_code, LIT_MAGIC_STRING__EMPTY))\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  return ecma_op_eval_chars_buffer ((void *) &source_code, parse_opts | ECMA_PARSE_HAS_SOURCE_VALUE);\n} /* ecma_op_eval */\n\n/**\n * Perform 'eval' with code stored in continuous character buffer\n *\n * See also:\n *          ecma_op_eval\n *          ECMA-262 v5, 15.1.2.1 (steps 2 to 8)\n *\n * @return ecma value\n */\necma_value_t\necma_op_eval_chars_buffer (void *source_p, /**< source code */\n                           uint32_t parse_opts) /**< ecma_parse_opts_t option bits */\n{\n#if JERRY_PARSER\n  JERRY_ASSERT (source_p != NULL);\n\n  uint32_t is_strict_call = ECMA_PARSE_STRICT_MODE | ECMA_PARSE_DIRECT_EVAL;\n\n  if ((parse_opts & is_strict_call) != is_strict_call)\n  {\n    parse_opts &= (uint32_t) ~ECMA_PARSE_STRICT_MODE;\n  }\n\n  parse_opts |= ECMA_PARSE_EVAL;\n\n  ECMA_CLEAR_LOCAL_PARSE_OPTS ();\n\n  ecma_compiled_code_t *bytecode_p = parser_parse_script (source_p, parse_opts, NULL);\n\n  if (JERRY_UNLIKELY (bytecode_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  return vm_run_eval (bytecode_p, parse_opts);\n#endif /* JERRY_PARSER */\n} /* ecma_op_eval_chars_buffer */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-eval.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_EVAL_H\n#define ECMA_EVAL_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup eval eval\n * @{\n */\n\necma_value_t ecma_op_eval (ecma_value_t source_code, uint32_t parse_opts);\n\necma_value_t ecma_op_eval_chars_buffer (void *source_p, uint32_t parse_opts);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_EVAL_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-exceptions.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-exceptions.h\"\n\n#include <stdarg.h>\n\n#include \"ecma-array-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-symbol-object.h\"\n\n#include \"jcontext.h\"\n#include \"jrt.h\"\n\n#if JERRY_LINE_INFO\n#include \"vm.h\"\n#endif /* JERRY_LINE_INFO */\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup exceptions Exceptions\n * @{\n */\n\n/**\n * Standard ecma-error object constructor.\n *\n * Note:\n *    message_string_p can be NULL.\n *\n * Note:\n *    calling with JERRY_ERROR_NONE does not make sense thus it will\n *    cause a fault in the system.\n *\n * @return pointer to ecma-object representing specified error\n *         with reference counter set to one.\n */\necma_object_t *\necma_new_standard_error (jerry_error_t error_type, /**< native error type */\n                         ecma_string_t *message_string_p) /**< message string */\n{\n#if JERRY_BUILTIN_ERRORS\n  ecma_builtin_id_t prototype_id = ECMA_BUILTIN_ID__COUNT;\n\n  switch (error_type)\n  {\n    case JERRY_ERROR_EVAL:\n    {\n      prototype_id = ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE;\n      break;\n    }\n\n    case JERRY_ERROR_RANGE:\n    {\n      prototype_id = ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE;\n      break;\n    }\n\n    case JERRY_ERROR_REFERENCE:\n    {\n      prototype_id = ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE;\n      break;\n    }\n\n    case JERRY_ERROR_TYPE:\n    {\n      prototype_id = ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE;\n      break;\n    }\n\n    case JERRY_ERROR_AGGREGATE:\n    {\n      prototype_id = ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE;\n      break;\n    }\n\n    case JERRY_ERROR_URI:\n    {\n      prototype_id = ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE;\n      break;\n    }\n\n    case JERRY_ERROR_SYNTAX:\n    {\n      prototype_id = ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE;\n      break;\n    }\n\n    default:\n    {\n      JERRY_ASSERT (error_type == JERRY_ERROR_COMMON);\n\n      prototype_id = ECMA_BUILTIN_ID_ERROR_PROTOTYPE;\n      break;\n    }\n  }\n#else /* !JERRY_BUILTIN_ERRORS */\n  JERRY_UNUSED (error_type);\n  ecma_builtin_id_t prototype_id = ECMA_BUILTIN_ID_ERROR_PROTOTYPE;\n#endif /* JERRY_BUILTIN_ERRORS */\n\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (prototype_id);\n\n  ecma_object_t *error_object_p =\n    ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *extended_object_p = (ecma_extended_object_t *) error_object_p;\n  extended_object_p->u.cls.type = ECMA_OBJECT_CLASS_ERROR;\n  extended_object_p->u.cls.u1.error_type = (uint8_t) error_type;\n\n  if (message_string_p != NULL)\n  {\n    ecma_property_value_t *prop_value_p;\n    prop_value_p = ecma_create_named_data_property (error_object_p,\n                                                    ecma_get_magic_string (LIT_MAGIC_STRING_MESSAGE),\n                                                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE,\n                                                    NULL);\n\n    ecma_ref_ecma_string (message_string_p);\n    prop_value_p->value = ecma_make_string_value (message_string_p);\n  }\n\n  /* Avoid calling the decorator function recursively. */\n  if (JERRY_CONTEXT (error_object_created_callback_p) != NULL\n      && !(JERRY_CONTEXT (status_flags) & ECMA_STATUS_ERROR_UPDATE))\n  {\n    JERRY_CONTEXT (status_flags) |= ECMA_STATUS_ERROR_UPDATE;\n    JERRY_CONTEXT (error_object_created_callback_p)\n    (ecma_make_object_value (error_object_p), JERRY_CONTEXT (error_object_created_callback_user_p));\n    JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_ERROR_UPDATE;\n  }\n  else\n  {\n#if JERRY_LINE_INFO\n    /* Default decorator when line info is enabled. */\n    ecma_string_t *stack_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_STACK);\n\n    ecma_property_value_t *prop_value_p =\n      ecma_create_named_data_property (error_object_p, stack_str_p, ECMA_PROPERTY_CONFIGURABLE_WRITABLE, NULL);\n    ecma_deref_ecma_string (stack_str_p);\n\n    ecma_value_t backtrace_value = vm_get_backtrace (0);\n\n    prop_value_p->value = backtrace_value;\n    ecma_deref_object (ecma_get_object_from_value (backtrace_value));\n#endif /* JERRY_LINE_INFO */\n  }\n\n  return error_object_p;\n} /* ecma_new_standard_error */\n\n/**\n * aggregate-error object constructor.\n *\n * @return newly constructed aggregate errors\n */\necma_value_t\necma_new_aggregate_error (ecma_value_t error_list_val, /**< errors list */\n                          ecma_value_t message_val) /**< message string */\n{\n  ecma_object_t *new_error_object_p;\n\n  if (!ecma_is_value_undefined (message_val))\n  {\n    ecma_string_t *message_string_p = ecma_op_to_string (message_val);\n\n    if (JERRY_UNLIKELY (message_string_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    new_error_object_p = ecma_new_standard_error (JERRY_ERROR_AGGREGATE, message_string_p);\n    ecma_deref_ecma_string (message_string_p);\n  }\n  else\n  {\n    new_error_object_p = ecma_new_standard_error (JERRY_ERROR_AGGREGATE, NULL);\n  }\n\n  ecma_value_t using_iterator = ecma_op_get_method_by_symbol_id (error_list_val, LIT_GLOBAL_SYMBOL_ITERATOR);\n\n  if (ECMA_IS_VALUE_ERROR (using_iterator))\n  {\n    ecma_deref_object (new_error_object_p);\n    return using_iterator;\n  }\n\n  if (!ecma_is_value_undefined (using_iterator))\n  {\n    ecma_value_t next_method;\n    ecma_value_t iterator = ecma_op_get_iterator (error_list_val, using_iterator, &next_method);\n    ecma_free_value (using_iterator);\n\n    if (ECMA_IS_VALUE_ERROR (iterator))\n    {\n      ecma_deref_object (new_error_object_p);\n      return iterator;\n    }\n\n    ecma_collection_t *error_list_p = ecma_new_collection ();\n    ecma_value_t result = ECMA_VALUE_ERROR;\n\n    while (true)\n    {\n      ecma_value_t next = ecma_op_iterator_step (iterator, next_method);\n\n      if (ECMA_IS_VALUE_ERROR (next))\n      {\n        break;\n      }\n\n      if (next == ECMA_VALUE_FALSE)\n      {\n        result = ECMA_VALUE_UNDEFINED;\n        break;\n      }\n\n      /* 8.e.iii */\n      ecma_value_t next_error = ecma_op_iterator_value (next);\n      ecma_free_value (next);\n\n      if (ECMA_IS_VALUE_ERROR (next_error))\n      {\n        break;\n      }\n\n      ecma_collection_push_back (error_list_p, next_error);\n    }\n\n    ecma_free_value (iterator);\n    ecma_free_value (next_method);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      ecma_collection_free (error_list_p);\n      ecma_deref_object (new_error_object_p);\n      return result;\n    }\n\n    JERRY_ASSERT (ecma_is_value_undefined (result));\n\n    ecma_value_t error_list_arr = ecma_op_new_array_object_from_collection (error_list_p, true);\n    ecma_property_value_t *prop_value_p;\n    prop_value_p = ecma_create_named_data_property (new_error_object_p,\n                                                    ecma_get_magic_string (LIT_MAGIC_STRING_ERRORS_UL),\n                                                    ECMA_PROPERTY_CONFIGURABLE_WRITABLE,\n                                                    NULL);\n    prop_value_p->value = error_list_arr;\n    ecma_free_value (error_list_arr);\n  }\n\n  return ecma_make_object_value (new_error_object_p);\n} /* ecma_new_aggregate_error */\n\n/**\n * Return the error type for an Error object.\n *\n * @return one of the jerry_error_t value\n *         if it is not an Error object then JERRY_ERROR_NONE will be returned\n */\njerry_error_t\necma_get_error_type (ecma_object_t *error_object_p) /**< possible error object */\n{\n  if (!ecma_object_class_is (error_object_p, ECMA_OBJECT_CLASS_ERROR))\n  {\n    return JERRY_ERROR_NONE;\n  }\n\n  return (jerry_error_t) ((ecma_extended_object_t *) error_object_p)->u.cls.u1.error_type;\n} /* ecma_get_error_type */\n\n/**\n * Raise a standard ecma-error with the given type and message.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_raise_standard_error (jerry_error_t error_type, /**< error type */\n                           ecma_error_msg_t msg) /**< error message */\n{\n  ecma_object_t *error_obj_p;\n  const lit_utf8_byte_t *str_p = (lit_utf8_byte_t *) ecma_get_error_msg (msg);\n\n  if (msg != ECMA_ERR_EMPTY)\n  {\n    ecma_string_t *error_msg_p = ecma_new_ecma_external_string_from_cesu8 (str_p, ecma_get_error_size (msg), NULL);\n    error_obj_p = ecma_new_standard_error (error_type, error_msg_p);\n    ecma_deref_ecma_string (error_msg_p);\n  }\n  else\n  {\n    error_obj_p = ecma_new_standard_error (error_type, NULL);\n  }\n\n  jcontext_raise_exception (ecma_make_object_value (error_obj_p));\n  return ECMA_VALUE_ERROR;\n} /* ecma_raise_standard_error */\n\n#if JERRY_ERROR_MESSAGES\n\n/**\n * Raise a standard ecma-error with the given format string and arguments.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_raise_standard_error_with_format (jerry_error_t error_type, /**< error type */\n                                       const char *format, /**< format string */\n                                       ...) /**< ecma-values */\n{\n  JERRY_ASSERT (format != NULL);\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n  const char *start_p = format;\n  const char *end_p = format;\n\n  va_list args;\n\n  va_start (args, format);\n\n  while (*end_p)\n  {\n    if (*end_p == '%')\n    {\n      /* Concat template string. */\n      if (end_p > start_p)\n      {\n        ecma_stringbuilder_append_raw (&builder, (lit_utf8_byte_t *) start_p, (lit_utf8_size_t) (end_p - start_p));\n      }\n\n      /* Convert an argument to string without side effects. */\n      ecma_string_t *arg_string_p;\n      const ecma_value_t arg_val = va_arg (args, ecma_value_t);\n\n      if (JERRY_UNLIKELY (ecma_is_value_object (arg_val)))\n      {\n        ecma_object_t *arg_object_p = ecma_get_object_from_value (arg_val);\n        lit_magic_string_id_t class_name = ecma_object_get_class_name (arg_object_p);\n        arg_string_p = ecma_get_magic_string (class_name);\n      }\n      else if (ecma_is_value_symbol (arg_val))\n      {\n        ecma_value_t symbol_desc_value = ecma_get_symbol_descriptive_string (arg_val);\n        arg_string_p = ecma_get_string_from_value (symbol_desc_value);\n      }\n      else\n      {\n        arg_string_p = ecma_op_to_string (arg_val);\n        JERRY_ASSERT (arg_string_p != NULL);\n      }\n\n      /* Concat argument. */\n      ecma_stringbuilder_append (&builder, arg_string_p);\n\n      ecma_deref_ecma_string (arg_string_p);\n\n      start_p = end_p + 1;\n    }\n\n    end_p++;\n  }\n\n  va_end (args);\n\n  /* Concat reset of template string. */\n  if (start_p < end_p)\n  {\n    ecma_stringbuilder_append_raw (&builder, (lit_utf8_byte_t *) start_p, (lit_utf8_size_t) (end_p - start_p));\n  }\n\n  ecma_string_t *builder_str_p = ecma_stringbuilder_finalize (&builder);\n\n  ecma_object_t *error_obj_p = ecma_new_standard_error (error_type, builder_str_p);\n\n  ecma_deref_ecma_string (builder_str_p);\n\n  jcontext_raise_exception (ecma_make_object_value (error_obj_p));\n  return ECMA_VALUE_ERROR;\n} /* ecma_raise_standard_error_with_format */\n\n#endif /* JERRY_ERROR_MESSAGES */\n\n/**\n * Raise a common error with the given message.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_raise_common_error (ecma_error_msg_t msg) /**< error message */\n{\n  return ecma_raise_standard_error (JERRY_ERROR_COMMON, msg);\n} /* ecma_raise_common_error */\n\n/**\n * Raise a RangeError with the given message.\n *\n * See also: ECMA-262 v5, 15.11.6.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_raise_range_error (ecma_error_msg_t msg) /**< error message */\n{\n  return ecma_raise_standard_error (JERRY_ERROR_RANGE, msg);\n} /* ecma_raise_range_error */\n\n/**\n * Raise a ReferenceError with the given message.\n *\n * See also: ECMA-262 v5, 15.11.6.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_raise_reference_error (ecma_error_msg_t msg) /**< error message */\n{\n  return ecma_raise_standard_error (JERRY_ERROR_REFERENCE, msg);\n} /* ecma_raise_reference_error */\n\n/**\n * Raise a SyntaxError with the given message.\n *\n * See also: ECMA-262 v5, 15.11.6.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_raise_syntax_error (ecma_error_msg_t msg) /**< error message */\n{\n  return ecma_raise_standard_error (JERRY_ERROR_SYNTAX, msg);\n} /* ecma_raise_syntax_error */\n\n/**\n * Raise a TypeError with the given message.\n *\n * See also: ECMA-262 v5, 15.11.6.5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_raise_type_error (ecma_error_msg_t msg) /**< error message */\n{\n  return ecma_raise_standard_error (JERRY_ERROR_TYPE, msg);\n} /* ecma_raise_type_error */\n\n/**\n * Raise a URIError with the given message.\n *\n * See also: ECMA-262 v5, 15.11.6.6\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_raise_uri_error (ecma_error_msg_t msg) /**< error message */\n{\n  return ecma_raise_standard_error (JERRY_ERROR_URI, msg);\n} /* ecma_raise_uri_error */\n\n#if (JERRY_STACK_LIMIT != 0)\n/**\n * Raise a RangeError with \"Maximum call stack size exceeded\" message.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_raise_maximum_callstack_error (void)\n{\n  return ecma_raise_range_error (ECMA_ERR_MAXIMUM_CALL_STACK_SIZE_EXCEEDED);\n} /* ecma_raise_maximum_callstack_error */\n#endif /* (JERRY_STACK_LIMIT != 0) */\n\n/**\n * Raise a AggregateError with the given errors and message.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_raise_aggregate_error (ecma_value_t error_list_val, /**< errors list */\n                            ecma_value_t message_val) /**< error message */\n{\n  ecma_value_t aggre_val = ecma_new_aggregate_error (error_list_val, message_val);\n  jcontext_raise_exception (aggre_val);\n\n  return ECMA_VALUE_ERROR;\n} /* ecma_raise_aggregate_error */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-exceptions.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_EXCEPTIONS_H\n#define ECMA_EXCEPTIONS_H\n\n#include \"ecma-globals.h\"\n\n#include \"jrt.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup exceptions Exceptions\n * @{\n */\n\njerry_error_t ecma_get_error_type (ecma_object_t *error_object_p);\necma_object_t *ecma_new_standard_error (jerry_error_t error_type, ecma_string_t *message_string_p);\n#if JERRY_ERROR_MESSAGES\necma_value_t ecma_raise_standard_error_with_format (jerry_error_t error_type, const char *msg_p, ...);\n#endif /* JERRY_ERROR_MESSAGES */\necma_value_t ecma_raise_standard_error (jerry_error_t error_type, ecma_error_msg_t msg);\necma_value_t ecma_raise_common_error (ecma_error_msg_t msg);\necma_value_t ecma_raise_range_error (ecma_error_msg_t msg);\necma_value_t ecma_raise_reference_error (ecma_error_msg_t msg);\necma_value_t ecma_raise_syntax_error (ecma_error_msg_t msg);\necma_value_t ecma_raise_type_error (ecma_error_msg_t msg);\necma_value_t ecma_raise_uri_error (ecma_error_msg_t msg);\n#if (JERRY_STACK_LIMIT != 0)\necma_value_t ecma_raise_maximum_callstack_error (void);\n#endif /* (JERRY_STACK_LIMIT != 0) */\necma_value_t ecma_new_aggregate_error (ecma_value_t error_list_val, ecma_value_t message_val);\necma_value_t ecma_raise_aggregate_error (ecma_value_t error_list_val, ecma_value_t message_val);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_EXCEPTIONS_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-function-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-function-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtin-handlers.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-errors.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-extended-info.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-promise-object.h\"\n#include \"ecma-proxy-object.h\"\n#include \"ecma-symbol-object.h\"\n\n#include \"jcontext.h\"\n#include \"lit-char-helpers.h\"\n#include \"opcodes.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmafunctionobject ECMA Function object related routines\n * @{\n */\n\n/**\n * SetFunctionName operation\n *\n * See also: ECMAScript v6, 9.2.1.1\n *\n * @return source name as ecma-string\n */\necma_value_t\necma_op_function_form_name (ecma_string_t *prop_name_p, /**< property name */\n                            char *prefix_p, /**< prefix */\n                            lit_utf8_size_t prefix_size) /**< prefix length */\n{\n  /* 4. */\n  if (ecma_prop_name_is_symbol (prop_name_p))\n  {\n    /* .a */\n    ecma_value_t string_desc = ecma_get_symbol_description (prop_name_p);\n\n    /* .b */\n    if (ecma_is_value_undefined (string_desc))\n    {\n      prop_name_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n    }\n    /* .c */\n    else\n    {\n      ecma_string_t *string_desc_p = ecma_get_string_from_value (string_desc);\n      ecma_stringbuilder_t builder = ecma_stringbuilder_create_raw ((lit_utf8_byte_t *) \"[\", 1);\n      ecma_stringbuilder_append (&builder, string_desc_p);\n      ecma_stringbuilder_append_byte (&builder, (lit_utf8_byte_t) LIT_CHAR_RIGHT_SQUARE);\n      prop_name_p = ecma_stringbuilder_finalize (&builder);\n    }\n  }\n  else\n  {\n    ecma_ref_ecma_string (prop_name_p);\n  }\n\n  /* 5. */\n  if (JERRY_UNLIKELY (prefix_p != NULL))\n  {\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create_raw ((lit_utf8_byte_t *) prefix_p, prefix_size);\n    ecma_stringbuilder_append (&builder, prop_name_p);\n    ecma_deref_ecma_string (prop_name_p);\n    prop_name_p = ecma_stringbuilder_finalize (&builder);\n  }\n\n  return ecma_make_string_value (prop_name_p);\n} /* ecma_op_function_form_name */\n\n#if JERRY_BUILTIN_PROXY\n/**\n * IsCallable operation for proxy object.\n *\n * @return true - if the given proxy object is callable;\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_op_proxy_object_is_callable (ecma_object_t *obj_p) /**< ecma object */\n{\n  JERRY_ASSERT (!ecma_is_lexical_environment (obj_p));\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n\n  return (obj_p->u2.prototype_cp & ECMA_PROXY_IS_CALLABLE) != 0;\n} /* ecma_op_proxy_object_is_callable */\n#endif /* JERRY_BUILTIN_PROXY */\n\n/**\n * IsCallable operation.\n *\n * See also: ECMA-262 v5, 9.11\n *\n * @return true - if the given object is callable;\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_op_object_is_callable (ecma_object_t *obj_p) /**< ecma object */\n{\n  JERRY_ASSERT (!ecma_is_lexical_environment (obj_p));\n\n  const ecma_object_type_t type = ecma_get_object_type (obj_p);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_TYPE_IS_PROXY (type))\n  {\n    return ecma_op_proxy_object_is_callable (obj_p);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  return type >= ECMA_OBJECT_TYPE_FUNCTION;\n} /* ecma_op_object_is_callable */\n\n/**\n * IsCallable operation.\n *\n * See also: ECMA-262 v5, 9.11\n *\n * @return true - if value is callable object;\n *         false - otherwise\n */\nbool\necma_op_is_callable (ecma_value_t value) /**< ecma value */\n{\n  return (ecma_is_value_object (value) && ecma_op_object_is_callable (ecma_get_object_from_value (value)));\n} /* ecma_op_is_callable */\n\n/**\n * Implement IsConstructor abstract operation.\n *\n *\n * @return ECMA_IS_VALID_CONSTRUCTOR - if object is a valid for constructor call\n *         ecma_error_msg_t id of error - otherwise\n */\necma_error_msg_t\necma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */\n{\n  JERRY_ASSERT (!ecma_is_lexical_environment (obj_p));\n\n  ecma_object_type_t type = ecma_get_object_type (obj_p);\n\n  if (JERRY_UNLIKELY (type < ECMA_OBJECT_TYPE_PROXY))\n  {\n    return ECMA_ERR_INVALID_TYPE_FOR_CONSTRUCTOR_CALL;\n  }\n\n  while (JERRY_UNLIKELY (type == ECMA_OBJECT_TYPE_BOUND_FUNCTION))\n  {\n    ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) obj_p;\n\n    obj_p =\n      ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);\n\n    type = ecma_get_object_type (obj_p);\n  }\n\n  if (JERRY_LIKELY (type == ECMA_OBJECT_TYPE_FUNCTION))\n  {\n    const ecma_compiled_code_t *byte_code_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) obj_p);\n\n    if (!CBC_FUNCTION_IS_CONSTRUCTABLE (byte_code_p->status_flags))\n    {\n#if JERRY_ERROR_MESSAGES\n      switch (CBC_FUNCTION_GET_TYPE (byte_code_p->status_flags))\n      {\n        case CBC_FUNCTION_SCRIPT:\n        {\n          return ECMA_ERR_SCRIPT_GLOBAL_FUNCTIONS_INVOKE_WITH_NEW;\n        }\n        case CBC_FUNCTION_GENERATOR:\n        {\n          return ECMA_ERR_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW;\n        }\n        case CBC_FUNCTION_ASYNC:\n        {\n          return ECMA_ERR_ASYNC_FUNCTIONS_INVOKE_WITH_NEW;\n        }\n        case CBC_FUNCTION_ASYNC_GENERATOR:\n        {\n          return ECMA_ERR_ASYNC_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW;\n        }\n        case CBC_FUNCTION_ACCESSOR:\n        {\n          return ECMA_ERR_ACCESSOR_FUNCTIONS_INVOKE_WITH_NEW;\n        }\n        case CBC_FUNCTION_METHOD:\n        {\n          return ECMA_ERR_METHODS_INVOKE_WITH_NEW;\n        }\n        case CBC_FUNCTION_ARROW:\n        {\n          return ECMA_ERR_ARROW_FUNCTIONS_INVOKE_WITH_NEW;\n        }\n        default:\n        {\n          JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (byte_code_p->status_flags) == CBC_FUNCTION_ASYNC_ARROW);\n          return ECMA_ERR_ASYNC_ARROW_FUNCTIONS_INVOKE_WITH_NEW;\n        }\n      }\n#else /* !JERRY_ERROR_MESSAGES */\n      return ECMA_ERR_EMPTY;\n#endif /* JERRY_ERROR_MESSAGES */\n    }\n\n    return ECMA_IS_VALID_CONSTRUCTOR;\n  }\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_TYPE_IS_PROXY (type))\n  {\n    if (!(obj_p->u2.prototype_cp & ECMA_PROXY_IS_CONSTRUCTABLE))\n    {\n      return ECMA_ERR_PROXY_TARGET_IS_NOT_A_CONSTRUCTOR;\n    }\n\n    return ECMA_IS_VALID_CONSTRUCTOR;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  JERRY_ASSERT (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION || type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION\n                || type == ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION);\n\n  if (type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION)\n  {\n    if (ecma_builtin_function_is_routine (obj_p))\n    {\n      return ECMA_ERR_BULTIN_ROUTINES_HAVE_NO_CONSTRUCTOR;\n    }\n\n    JERRY_ASSERT (((ecma_extended_object_t *) obj_p)->u.built_in.id != ECMA_BUILTIN_ID_HANDLER);\n  }\n\n  return ECMA_IS_VALID_CONSTRUCTOR;\n} /* ecma_object_check_constructor */\n\n/**\n * Implement IsConstructor abstract operation.\n *\n * @return ECMA_IS_VALID_CONSTRUCTOR - if the input value is a constructor.\n *         ecma_error_msg_t id of error - otherwise\n */\nextern inline ecma_error_msg_t JERRY_ATTR_ALWAYS_INLINE\necma_check_constructor (ecma_value_t value) /**< ecma object */\n{\n  if (!ecma_is_value_object (value))\n  {\n    return ECMA_ERR_INVALID_TYPE_FOR_CONSTRUCTOR_CALL;\n  }\n\n  return ecma_object_check_constructor (ecma_get_object_from_value (value));\n} /* ecma_check_constructor */\n\n/**\n * Checks whether the given object implements [[Construct]].\n *\n * @return true - if the given object is constructor;\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_object_is_constructor (ecma_object_t *obj_p) /**< ecma object */\n{\n  return ecma_object_check_constructor (obj_p) == ECMA_IS_VALID_CONSTRUCTOR;\n} /* ecma_object_is_constructor */\n\n/**\n * Checks whether the value is Object that implements [[Construct]].\n *\n * @return true - if value is constructor object;\n *         false - otherwise\n */\nbool\necma_is_constructor (ecma_value_t value) /**< ecma value */\n{\n  return (ecma_is_value_object (value) && ecma_object_is_constructor (ecma_get_object_from_value (value)));\n} /* ecma_is_constructor */\n\n/**\n * Helper method to count and convert the arguments for the Function/GeneratorFunction constructor call.\n *\n * See also:\n *          ECMA 262 v5.1 15.3.2.1 steps 5.a-d\n *          ECMA 262 v6 19.2.1.1.1 steps 8\n *\n * @return ecma value - concatenated arguments as a string.\n *         Returned value must be freed with ecma_free_value.\n */\nstatic ecma_string_t *\necma_op_create_dynamic_function_arguments_helper (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                                  uint32_t arguments_list_len) /**< number of arguments */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  if (arguments_list_len <= 1)\n  {\n    return ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  ecma_string_t *str_p = ecma_op_to_string (arguments_list_p[0]);\n\n  if (JERRY_UNLIKELY (str_p == NULL))\n  {\n    return str_p;\n  }\n\n  if (arguments_list_len == 2)\n  {\n    return str_p;\n  }\n\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (str_p);\n  ecma_deref_ecma_string (str_p);\n\n  for (uint32_t idx = 1; idx < arguments_list_len - 1; idx++)\n  {\n    str_p = ecma_op_to_string (arguments_list_p[idx]);\n\n    if (JERRY_UNLIKELY (str_p == NULL))\n    {\n      ecma_stringbuilder_destroy (&builder);\n      return str_p;\n    }\n\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_COMMA);\n    ecma_stringbuilder_append (&builder, str_p);\n    ecma_deref_ecma_string (str_p);\n  }\n\n  return ecma_stringbuilder_finalize (&builder);\n} /* ecma_op_create_dynamic_function_arguments_helper */\n\n/**\n * Function object creation operation.\n *\n * See also: ECMA-262 v5, 13.2\n *\n * @return pointer to newly created Function object\n */\nstatic ecma_object_t *\necma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */\n                                const ecma_compiled_code_t *bytecode_data_p, /**< byte-code array */\n                                ecma_builtin_id_t proto_id) /**< builtin id of the prototype object */\n{\n  JERRY_ASSERT (ecma_is_lexical_environment (scope_p));\n\n  /* 1., 4., 13. */\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (proto_id);\n\n  size_t function_object_size = sizeof (ecma_extended_object_t);\n\n#if JERRY_SNAPSHOT_EXEC\n  if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)\n  {\n    function_object_size = sizeof (ecma_static_function_t);\n  }\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n  ecma_object_t *func_p = ecma_create_object (prototype_obj_p, function_object_size, ECMA_OBJECT_TYPE_FUNCTION);\n\n  /* 2., 6., 7., 8. */\n  /*\n   * We don't setup [[Get]], [[Call]], [[Construct]], [[HasInstance]] for each function object.\n   * Instead we set the object's type to ECMA_OBJECT_TYPE_FUNCTION\n   * that defines which version of the routine should be used on demand.\n   */\n\n  /* 3. */\n  /*\n   * [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_FUNCTION type.\n   *\n   * See also: ecma_object_get_class_name\n   */\n\n  ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) func_p;\n\n  /* 9. */\n  ECMA_SET_NON_NULL_POINTER_TAG (ext_func_p->u.function.scope_cp, scope_p, 0);\n\n  /* 10., 11., 12. */\n\n#if JERRY_SNAPSHOT_EXEC\n  if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)\n  {\n    ext_func_p->u.function.bytecode_cp = JMEM_CP_NULL;\n    ((ecma_static_function_t *) func_p)->bytecode_p = bytecode_data_p;\n  }\n  else\n#endif /* JERRY_SNAPSHOT_EXEC */\n  {\n    ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_p->u.function.bytecode_cp, bytecode_data_p);\n    ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p);\n  }\n\n  /* 14., 15., 16., 17., 18. */\n  /*\n   * 'length' and 'prototype' properties are instantiated lazily\n   *\n   * See also: ecma_op_function_try_to_lazy_instantiate_property\n   */\n\n  return func_p;\n} /* ecma_op_create_function_object */\n\n/**\n * CreateDynamicFunction operation\n *\n * See also:\n *          ECMA-262 v5, 15.3.\n *          ECMA-262 v6, 19.2.1.1\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         constructed function object - otherwise\n */\necma_value_t\necma_op_create_dynamic_function (const ecma_value_t *arguments_list_p, /**< arguments list */\n                                 uint32_t arguments_list_len, /**< number of arguments */\n                                 ecma_parse_opts_t parse_opts) /**< parse options */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  ecma_string_t *arguments_str_p =\n    ecma_op_create_dynamic_function_arguments_helper (arguments_list_p, arguments_list_len);\n\n  if (JERRY_UNLIKELY (arguments_str_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_string_t *function_body_str_p;\n\n  if (arguments_list_len > 0)\n  {\n    function_body_str_p = ecma_op_to_string (arguments_list_p[arguments_list_len - 1]);\n\n    if (JERRY_UNLIKELY (function_body_str_p == NULL))\n    {\n      ecma_deref_ecma_string (arguments_str_p);\n      return ECMA_VALUE_ERROR;\n    }\n  }\n  else\n  {\n    /* Very unlikely code path, not optimized. */\n    function_body_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  ecma_value_t source[2];\n  source[0] = ecma_make_string_value (function_body_str_p);\n  source[1] = ecma_make_string_value (arguments_str_p);\n\n  parse_opts |= ECMA_PARSE_HAS_SOURCE_VALUE | ECMA_PARSE_HAS_ARGUMENT_LIST_VALUE;\n\n  ecma_compiled_code_t *bytecode_p = parser_parse_script ((void *) source, parse_opts, NULL);\n\n  ecma_deref_ecma_string (arguments_str_p);\n  ecma_deref_ecma_string (function_body_str_p);\n\n  if (JERRY_UNLIKELY (bytecode_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t *func_name_p;\n  func_name_p = ecma_compiled_code_resolve_function_name ((const ecma_compiled_code_t *) bytecode_p);\n  *func_name_p = ecma_make_magic_string_value (LIT_MAGIC_STRING_ANONYMOUS);\n\n  ecma_object_t *global_object_p = ecma_builtin_get_global ();\n\n#if JERRY_BUILTIN_REALMS\n  JERRY_ASSERT (global_object_p == (ecma_object_t *) ecma_op_function_get_realm (bytecode_p));\n#endif /* JERRY_BUILTIN_REALMS */\n\n  ecma_object_t *global_env_p = ecma_get_global_environment (global_object_p);\n  ecma_builtin_id_t fallback_proto = ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE;\n  ecma_object_t *new_target_p = JERRY_CONTEXT (current_new_target_p);\n  ecma_builtin_id_t fallback_ctor = ECMA_BUILTIN_ID_FUNCTION;\n\n  if (JERRY_UNLIKELY (parse_opts & (ECMA_PARSE_GENERATOR_FUNCTION | ECMA_PARSE_ASYNC_FUNCTION)))\n  {\n    fallback_proto = ECMA_BUILTIN_ID_ASYNC_GENERATOR;\n    fallback_ctor = ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION;\n\n    if (!(parse_opts & ECMA_PARSE_GENERATOR_FUNCTION))\n    {\n      fallback_proto = ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE;\n      fallback_ctor = ECMA_BUILTIN_ID_ASYNC_FUNCTION;\n    }\n    else if (!(parse_opts & ECMA_PARSE_ASYNC_FUNCTION))\n    {\n      fallback_proto = ECMA_BUILTIN_ID_GENERATOR;\n      fallback_ctor = ECMA_BUILTIN_ID_GENERATOR_FUNCTION;\n    }\n  }\n\n  if (new_target_p == NULL)\n  {\n    new_target_p = ecma_builtin_get (fallback_ctor);\n  }\n\n  ecma_object_t *proto = ecma_op_get_prototype_from_constructor (new_target_p, fallback_proto);\n\n  if (JERRY_UNLIKELY (proto == NULL))\n  {\n    ecma_bytecode_deref (bytecode_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_object_t *func_obj_p = ecma_op_create_function_object (global_env_p, bytecode_p, fallback_proto);\n\n  ECMA_SET_NON_NULL_POINTER (func_obj_p->u2.prototype_cp, proto);\n  ecma_deref_object (proto);\n\n  ecma_bytecode_deref (bytecode_p);\n  return ecma_make_object_value (func_obj_p);\n} /* ecma_op_create_dynamic_function */\n\n/**\n * Function object creation operation.\n *\n * See also: ECMA-262 v5, 13.2\n *\n * @return pointer to newly created Function object\n */\necma_object_t *\necma_op_create_simple_function_object (ecma_object_t *scope_p, /**< function's scope */\n                                       const ecma_compiled_code_t *bytecode_data_p) /**< byte-code array */\n{\n  return ecma_op_create_function_object (scope_p, bytecode_data_p, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);\n} /* ecma_op_create_simple_function_object */\n\n/**\n * Create a function object with the appropriate prototype.\n *\n * @return pointer to newly created Function object\n */\necma_object_t *\necma_op_create_any_function_object (ecma_object_t *scope_p, /**< function's scope */\n                                    const ecma_compiled_code_t *bytecode_data_p) /**< byte-code array */\n{\n  ecma_builtin_id_t proto_id;\n\n  switch (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags))\n  {\n    case CBC_FUNCTION_GENERATOR:\n    {\n      proto_id = ECMA_BUILTIN_ID_GENERATOR;\n      break;\n    }\n    case CBC_FUNCTION_ASYNC:\n    {\n      proto_id = ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE;\n      break;\n    }\n    case CBC_FUNCTION_ASYNC_GENERATOR:\n    {\n      proto_id = ECMA_BUILTIN_ID_ASYNC_GENERATOR;\n      break;\n    }\n    default:\n    {\n      proto_id = ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE;\n      break;\n    }\n  }\n\n  return ecma_op_create_function_object (scope_p, bytecode_data_p, proto_id);\n} /* ecma_op_create_any_function_object */\n\n/**\n * Arrow function object creation operation.\n *\n * See also: ES2015, 9.2.12\n *\n * @return pointer to newly created Function object\n */\necma_object_t *\necma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's scope */\n                                      const ecma_compiled_code_t *bytecode_data_p, /**< byte-code array */\n                                      ecma_value_t this_binding) /**< value of 'this' binding */\n{\n  ecma_object_t *prototype_obj_p;\n\n  if (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_ARROW)\n  {\n    prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);\n  }\n  else\n  {\n    JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_ASYNC_ARROW);\n    prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE);\n  }\n\n  size_t arrow_function_object_size = sizeof (ecma_arrow_function_t);\n\n#if JERRY_SNAPSHOT_EXEC\n  if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)\n  {\n    arrow_function_object_size = sizeof (ecma_static_arrow_function_t);\n  }\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n  ecma_object_t *func_p = ecma_create_object (prototype_obj_p, arrow_function_object_size, ECMA_OBJECT_TYPE_FUNCTION);\n\n  ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) func_p;\n\n  ECMA_SET_NON_NULL_POINTER_TAG (arrow_func_p->header.u.function.scope_cp, scope_p, 0);\n\n#if JERRY_SNAPSHOT_EXEC\n  if ((bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))\n  {\n    arrow_func_p->header.u.function.bytecode_cp = ECMA_NULL_POINTER;\n    ((ecma_static_arrow_function_t *) func_p)->bytecode_p = bytecode_data_p;\n  }\n  else\n  {\n#endif /* JERRY_SNAPSHOT_EXEC */\n    ECMA_SET_INTERNAL_VALUE_POINTER (arrow_func_p->header.u.function.bytecode_cp, bytecode_data_p);\n    ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_data_p);\n#if JERRY_SNAPSHOT_EXEC\n  }\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n  arrow_func_p->this_binding = ecma_copy_value_if_not_object (this_binding);\n  arrow_func_p->new_target = ECMA_VALUE_UNDEFINED;\n\n  if (JERRY_CONTEXT (current_new_target_p) != NULL)\n  {\n    arrow_func_p->new_target = ecma_make_object_value (JERRY_CONTEXT (current_new_target_p));\n  }\n  return func_p;\n} /* ecma_op_create_arrow_function_object */\n\n/**\n * External function object creation operation.\n *\n * Note:\n *      external function object is implementation-defined object type\n *      that represent functions implemented in native code, using Embedding API\n *\n * @return pointer to newly created external function object\n */\necma_object_t *\necma_op_create_external_function_object (ecma_native_handler_t handler_cb) /**< pointer to external native handler */\n{\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);\n\n  ecma_object_t *function_obj_p =\n    ecma_create_object (prototype_obj_p, sizeof (ecma_native_function_t), ECMA_OBJECT_TYPE_NATIVE_FUNCTION);\n\n  /*\n   * [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_NATIVE_FUNCTION type.\n   *\n   * See also: ecma_object_get_class_name\n   */\n\n  ecma_native_function_t *native_function_p = (ecma_native_function_t *) function_obj_p;\n#if JERRY_BUILTIN_REALMS\n  ECMA_SET_INTERNAL_VALUE_POINTER (native_function_p->realm_value, ecma_builtin_get_global ());\n#endif /* JERRY_BUILTIN_REALMS */\n  native_function_p->native_handler_cb = handler_cb;\n\n  return function_obj_p;\n} /* ecma_op_create_external_function_object */\n\n/**\n * Create built-in native handler object.\n *\n * @return pointer to newly created native handler object\n */\necma_object_t *\necma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */\n                               size_t object_size) /**< created object size */\n{\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);\n\n  ecma_object_t *function_obj_p = ecma_create_object (prototype_obj_p, object_size, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n\n  ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) function_obj_p;\n  ext_func_obj_p->u.built_in.id = ECMA_BUILTIN_ID_HANDLER;\n  ext_func_obj_p->u.built_in.routine_id = (uint8_t) id;\n  ext_func_obj_p->u.built_in.u2.routine_flags = ECMA_NATIVE_HANDLER_FLAGS_NONE;\n\n#if JERRY_BUILTIN_REALMS\n  ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_obj_p->u.built_in.realm_value, ecma_builtin_get_global ());\n#endif /* JERRY_BUILTIN_REALMS */\n\n  return function_obj_p;\n} /* ecma_op_create_native_handler */\n\n/**\n * Get compiled code of a function object.\n *\n * @return compiled code\n */\nextern inline const ecma_compiled_code_t *JERRY_ATTR_ALWAYS_INLINE\necma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< function pointer */\n{\n#if JERRY_SNAPSHOT_EXEC\n  if (JERRY_LIKELY (function_p->u.function.bytecode_cp != ECMA_NULL_POINTER))\n  {\n    return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t, function_p->u.function.bytecode_cp);\n  }\n\n  return ((ecma_static_function_t *) function_p)->bytecode_p;\n#else /* !JERRY_SNAPSHOT_EXEC */\n  return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t, function_p->u.function.bytecode_cp);\n#endif /* JERRY_SNAPSHOT_EXEC */\n} /* ecma_op_function_get_compiled_code */\n\n#if JERRY_BUILTIN_REALMS\n\n/**\n * Get realm from a byte code.\n *\n * Note:\n *   Does not increase the reference counter.\n *\n * @return pointer to realm (global) object\n */\nextern inline ecma_global_object_t *JERRY_ATTR_ALWAYS_INLINE\necma_op_function_get_realm (const ecma_compiled_code_t *bytecode_header_p) /**< byte code header */\n{\n#if JERRY_SNAPSHOT_EXEC\n  if (JERRY_UNLIKELY (bytecode_header_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))\n  {\n    return (ecma_global_object_t *) ecma_builtin_get_global ();\n  }\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n  ecma_value_t script_value = ((cbc_uint8_arguments_t *) bytecode_header_p)->script_value;\n  cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n\n  return (ecma_global_object_t *) script_p->realm_p;\n} /* ecma_op_function_get_realm */\n\n/**\n * Get realm from a function\n *\n * Note:\n *   Does not increase the reference counter.\n *\n * @return realm (global) object\n */\necma_global_object_t *\necma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function object */\n{\n  while (true)\n  {\n    ecma_object_type_t type = ecma_get_object_type (func_obj_p);\n\n    if (type == ECMA_OBJECT_TYPE_FUNCTION)\n    {\n      ecma_extended_object_t *ext_function_obj_p = (ecma_extended_object_t *) func_obj_p;\n      const ecma_compiled_code_t *bytecode_data_p = ecma_op_function_get_compiled_code (ext_function_obj_p);\n      return ecma_op_function_get_realm (bytecode_data_p);\n    }\n\n    if (type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION)\n    {\n      ecma_extended_object_t *ext_function_obj_p = (ecma_extended_object_t *) func_obj_p;\n      return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, ext_function_obj_p->u.built_in.realm_value);\n    }\n\n    if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION)\n    {\n      ecma_native_function_t *native_function_p = (ecma_native_function_t *) func_obj_p;\n      return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value);\n    }\n\n    if (type == ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION)\n    {\n      ecma_value_t script_value = ((ecma_extended_object_t *) func_obj_p)->u.constructor_function.script_value;\n      cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n\n      return (ecma_global_object_t *) script_p->realm_p;\n    }\n\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_OBJECT_IS_PROXY (func_obj_p))\n    {\n      ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) func_obj_p;\n      if (ecma_is_value_null (proxy_obj_p->handler))\n      {\n        ecma_raise_type_error (ECMA_ERR_PROTOTYPE_FROM_REVOKED_PROXY_IS_INVALID);\n        return NULL;\n      }\n      func_obj_p = ecma_get_object_from_value (proxy_obj_p->target);\n      continue;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    JERRY_ASSERT (type == ECMA_OBJECT_TYPE_BOUND_FUNCTION);\n    ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p;\n    func_obj_p =\n      ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);\n  }\n} /* ecma_op_function_get_function_realm */\n\n#endif /* JERRY_BUILTIN_REALMS */\n\n/**\n * 15.3.5.3 implementation of [[HasInstance]] for Function objects\n *\n * @return true/false - if arguments are valid\n *         error - otherwise\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object */\n                               ecma_value_t value) /**< argument 'V' */\n{\n  JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p));\n\n  if (!ecma_is_value_object (value))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  while (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION)\n  {\n    JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION);\n\n    /* 1. 3. */\n    ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p;\n\n    func_obj_p =\n      ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);\n  }\n\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION\n                || ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION\n                || ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION\n                || ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION\n                || ECMA_OBJECT_IS_PROXY (func_obj_p));\n\n  ecma_object_t *v_obj_p = ecma_get_object_from_value (value);\n\n  ecma_value_t prototype_obj_value = ecma_op_object_get_by_magic_id (func_obj_p, LIT_MAGIC_STRING_PROTOTYPE);\n\n  if (ECMA_IS_VALUE_ERROR (prototype_obj_value))\n  {\n    return prototype_obj_value;\n  }\n\n  if (!ecma_is_value_object (prototype_obj_value))\n  {\n    ecma_free_value (prototype_obj_value);\n    return ecma_raise_type_error (ECMA_ERR_OBJECT_EXPECTED);\n  }\n\n  ecma_object_t *prototype_obj_p = ecma_get_object_from_value (prototype_obj_value);\n  JERRY_ASSERT (prototype_obj_p != NULL);\n\n#if JERRY_BUILTIN_PROXY\n  ecma_value_t result = ECMA_VALUE_ERROR;\n#else /* !JERRY_BUILTIN_PROXY */\n  ecma_value_t result = ECMA_VALUE_FALSE;\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_ref_object (v_obj_p);\n\n  while (true)\n  {\n    ecma_object_t *current_proto_p = ecma_op_object_get_prototype_of (v_obj_p);\n    ecma_deref_object (v_obj_p);\n\n    if (current_proto_p == NULL)\n    {\n#if JERRY_BUILTIN_PROXY\n      result = ECMA_VALUE_FALSE;\n#endif /* JERRY_BUILTIN_PROXY */\n      break;\n    }\n    else if (current_proto_p == ECMA_OBJECT_POINTER_ERROR)\n    {\n      break;\n    }\n\n    if (current_proto_p == prototype_obj_p)\n    {\n      ecma_deref_object (current_proto_p);\n      result = ECMA_VALUE_TRUE;\n      break;\n    }\n\n    /* Advance up on prototype chain. */\n    v_obj_p = current_proto_p;\n  }\n\n  ecma_deref_object (prototype_obj_p);\n  return result;\n} /* ecma_op_function_has_instance */\n\n/**\n * GetSuperConstructor operation for class methods\n *\n * See also: ECMAScript v6, 12.3.5.2\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         super constructor - otherwise\n */\necma_value_t\necma_op_function_get_super_constructor (ecma_object_t *func_obj_p) /**< function object */\n{\n  ecma_object_t *super_ctor_p = ecma_op_object_get_prototype_of (func_obj_p);\n\n  if (JERRY_UNLIKELY (super_ctor_p == ECMA_OBJECT_POINTER_ERROR))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n  else if (super_ctor_p == NULL || !ecma_object_is_constructor (super_ctor_p))\n  {\n    if (super_ctor_p != NULL)\n    {\n      ecma_deref_object (super_ctor_p);\n    }\n    return ecma_raise_type_error (ECMA_ERR_SUPER_BINDING_MUST_BE_A_CONSTRUCTOR);\n  }\n\n  return ecma_make_object_value (super_ctor_p);\n} /* ecma_op_function_get_super_constructor */\n\n/**\n * Ordinary internal method: GetPrototypeFromConstructor (constructor, intrinsicDefaultProto)\n *\n * See also:\n *   - ECMAScript v6, 9.1.15\n *   - ECMAScript v10, 9.1.14\n *\n * @return NULL - if the operation fail (exception on the global context is raised)\n *         pointer to the prototype object - otherwise\n */\necma_object_t *\necma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, /**< constructor to get prototype from  */\n                                        ecma_builtin_id_t default_proto_id) /**< intrinsicDefaultProto */\n{\n  JERRY_ASSERT (ecma_op_object_is_callable (ctor_obj_p));\n  JERRY_ASSERT (default_proto_id < ECMA_BUILTIN_ID__COUNT);\n\n  ecma_value_t proto = ecma_op_object_get_by_magic_id (ctor_obj_p, LIT_MAGIC_STRING_PROTOTYPE);\n\n  if (ECMA_IS_VALUE_ERROR (proto))\n  {\n    return NULL;\n  }\n\n  ecma_object_t *proto_obj_p;\n\n  if (!ecma_is_value_object (proto))\n  {\n    ecma_free_value (proto);\n\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_OBJECT_IS_PROXY (ctor_obj_p))\n    {\n      ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) ctor_obj_p;\n      if (ecma_is_value_null (proxy_obj_p->handler))\n      {\n        ecma_raise_type_error (ECMA_ERR_PROTOTYPE_FROM_REVOKED_PROXY_IS_INVALID);\n        return NULL;\n      }\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n#if JERRY_BUILTIN_REALMS\n    proto_obj_p = ecma_builtin_get_from_realm (ecma_op_function_get_function_realm (ctor_obj_p), default_proto_id);\n#else /* !JERRY_BUILTIN_REALMS */\n    proto_obj_p = ecma_builtin_get (default_proto_id);\n#endif /* JERRY_BUILTIN_REALMS */\n    ecma_ref_object (proto_obj_p);\n  }\n  else\n  {\n    proto_obj_p = ecma_get_object_from_value (proto);\n  }\n\n  return proto_obj_p;\n} /* ecma_op_get_prototype_from_constructor */\n\n/**\n * Perform a JavaScript class function object method call.\n *\n * The input function object should be a JavaScript class constructor\n *\n * @return the result of the function call.\n */\nstatic ecma_value_t JERRY_ATTR_NOINLINE\necma_op_function_call_constructor (vm_frame_ctx_shared_args_t *shared_args_p, /**< shared data */\n                                   ecma_object_t *scope_p, /**< lexical environment to use */\n                                   ecma_value_t this_binding) /**< value of 'ThisBinding' */\n{\n  ECMA_CHECK_STACK_USAGE ();\n\n  shared_args_p->header.status_flags |= VM_FRAME_CTX_SHARED_NON_ARROW_FUNC;\n\n  ecma_value_t ret_value;\n\n  if (JERRY_CONTEXT (current_new_target_p) == NULL)\n  {\n    ret_value = ecma_raise_type_error (ECMA_ERR_CLASS_CONSTRUCTOR_REQUIRES_NEW);\n    goto exit;\n  }\n\n  ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) shared_args_p->header.function_object_p;\n  if (ECMA_GET_THIRD_BIT_FROM_POINTER_TAG (ext_func_p->u.function.scope_cp))\n  {\n    this_binding = ECMA_VALUE_UNINITIALIZED;\n  }\n\n  ecma_op_create_environment_record (scope_p, this_binding, shared_args_p->header.function_object_p);\n\n#if JERRY_BUILTIN_REALMS\n  ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);\n  JERRY_CONTEXT (global_object_p) = ecma_op_function_get_realm (shared_args_p->header.bytecode_header_p);\n#endif /* JERRY_BUILTIN_REALMS */\n\n  ret_value = vm_run (&shared_args_p->header, this_binding, scope_p);\n\n#if JERRY_BUILTIN_REALMS\n  JERRY_CONTEXT (global_object_p) = saved_global_object_p;\n#endif /* JERRY_BUILTIN_REALMS */\n\n  /* ECMAScript v6, 9.2.2.13 */\n  if (JERRY_UNLIKELY (this_binding == ECMA_VALUE_UNINITIALIZED))\n  {\n    if (!ECMA_IS_VALUE_ERROR (ret_value) && !ecma_is_value_object (ret_value))\n    {\n      if (!ecma_is_value_undefined (ret_value))\n      {\n        ecma_free_value (ret_value);\n        ret_value = ecma_raise_type_error (ECMA_ERR_DERIVED_CTOR_RETURN_NOR_OBJECT_OR_UNDEFINED);\n      }\n      else\n      {\n        ret_value = ecma_op_get_this_binding (scope_p);\n      }\n    }\n  }\n\nexit:\n  if (JERRY_UNLIKELY (shared_args_p->header.status_flags & VM_FRAME_CTX_SHARED_FREE_LOCAL_ENV))\n  {\n    ecma_deref_object (scope_p);\n  }\n\n  return ret_value;\n} /* ecma_op_function_call_constructor */\n\n/**\n * Perform a JavaScript function object method call.\n *\n * The input function object should be a pure JavaScript method\n *\n * @return the result of the function call.\n */\nstatic ecma_value_t\necma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */\n                              ecma_value_t this_binding, /**< 'this' argument's value */\n                              const ecma_value_t *arguments_list_p, /**< arguments list */\n                              uint32_t arguments_list_len) /**< length of arguments list */\n{\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION);\n\n  ECMA_CHECK_STACK_USAGE ();\n\n  vm_frame_ctx_shared_args_t shared_args;\n  shared_args.header.status_flags = VM_FRAME_CTX_SHARED_HAS_ARG_LIST;\n  shared_args.header.function_object_p = func_obj_p;\n  shared_args.arg_list_p = arguments_list_p;\n  shared_args.arg_list_len = arguments_list_len;\n\n  /* Entering Function Code (ECMA-262 v5, 10.4.3) */\n  ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) func_obj_p;\n\n  ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_func_p->u.function.scope_cp);\n\n  /* 8. */\n  const ecma_compiled_code_t *bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p);\n  uint16_t status_flags = bytecode_data_p->status_flags;\n\n  shared_args.header.bytecode_header_p = bytecode_data_p;\n\n#if JERRY_BUILTIN_REALMS\n  ecma_global_object_t *realm_p = ecma_op_function_get_realm (bytecode_data_p);\n#endif /* JERRY_BUILTIN_REALMS */\n\n  /* 5. */\n  if (!(status_flags & CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED))\n  {\n    shared_args.header.status_flags |= VM_FRAME_CTX_SHARED_FREE_LOCAL_ENV;\n    scope_p = ecma_create_decl_lex_env (scope_p);\n  }\n\n  /* 1. */\n  switch (CBC_FUNCTION_GET_TYPE (status_flags))\n  {\n    case CBC_FUNCTION_CONSTRUCTOR:\n    {\n      return ecma_op_function_call_constructor (&shared_args, scope_p, this_binding);\n    }\n    case CBC_FUNCTION_ARROW:\n    {\n      ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) func_obj_p;\n\n      if (ecma_is_value_undefined (arrow_func_p->new_target))\n      {\n        JERRY_CONTEXT (current_new_target_p) = NULL;\n      }\n      else\n      {\n        JERRY_CONTEXT (current_new_target_p) = ecma_get_object_from_value (arrow_func_p->new_target);\n      }\n\n      this_binding = arrow_func_p->this_binding;\n\n      if (JERRY_UNLIKELY (this_binding == ECMA_VALUE_UNINITIALIZED))\n      {\n        ecma_environment_record_t *env_record_p = ecma_op_get_environment_record (scope_p);\n        JERRY_ASSERT (env_record_p);\n        this_binding = env_record_p->this_binding;\n      }\n      break;\n    }\n    default:\n    {\n      shared_args.header.status_flags |= VM_FRAME_CTX_SHARED_NON_ARROW_FUNC;\n\n      if (status_flags & CBC_CODE_FLAGS_STRICT_MODE)\n      {\n        break;\n      }\n\n      if (ecma_is_value_undefined (this_binding) || ecma_is_value_null (this_binding))\n      {\n        /* 2. */\n#if JERRY_BUILTIN_REALMS\n        this_binding = realm_p->this_binding;\n#else /* !JERRY_BUILTIN_REALMS */\n        this_binding = ecma_make_object_value (ecma_builtin_get_global ());\n#endif /* JERRY_BUILTIN_REALMS */\n      }\n      else if (!ecma_is_value_object (this_binding))\n      {\n        /* 3., 4. */\n        this_binding = ecma_op_to_object (this_binding);\n        shared_args.header.status_flags |= VM_FRAME_CTX_SHARED_FREE_THIS;\n\n        JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (this_binding));\n      }\n      break;\n    }\n  }\n\n#if JERRY_BUILTIN_REALMS\n  ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);\n  JERRY_CONTEXT (global_object_p) = realm_p;\n#endif /* JERRY_BUILTIN_REALMS */\n\n  ecma_value_t ret_value = vm_run (&shared_args.header, this_binding, scope_p);\n\n#if JERRY_BUILTIN_REALMS\n  JERRY_CONTEXT (global_object_p) = saved_global_object_p;\n#endif /* JERRY_BUILTIN_REALMS */\n\n  if (JERRY_UNLIKELY (shared_args.header.status_flags & VM_FRAME_CTX_SHARED_FREE_LOCAL_ENV))\n  {\n    ecma_deref_object (scope_p);\n  }\n\n  if (JERRY_UNLIKELY (shared_args.header.status_flags & VM_FRAME_CTX_SHARED_FREE_THIS))\n  {\n    ecma_free_value (this_binding);\n  }\n\n  return ret_value;\n} /* ecma_op_function_call_simple */\n\n/**\n * Perform a built-in method call.\n *\n * @return the result of the function call.\n */\nstatic ecma_value_t JERRY_ATTR_NOINLINE\necma_op_function_call_native_built_in (ecma_object_t *func_obj_p, /**< Function object */\n                                       ecma_value_t this_arg_value, /**< 'this' argument's value */\n                                       const ecma_value_t *arguments_list_p, /**< arguments list */\n                                       uint32_t arguments_list_len) /**< length of arguments list */\n{\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n\n  ECMA_CHECK_STACK_USAGE ();\n\n#if JERRY_BUILTIN_REALMS\n  ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);\n\n  ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p;\n  JERRY_CONTEXT (global_object_p) =\n    ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, ext_func_obj_p->u.built_in.realm_value);\n#endif /* JERRY_BUILTIN_REALMS */\n\n  ecma_value_t ret_value =\n    ecma_builtin_dispatch_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);\n\n#if JERRY_BUILTIN_REALMS\n  JERRY_CONTEXT (global_object_p) = saved_global_object_p;\n#endif /* JERRY_BUILTIN_REALMS */\n  return ret_value;\n} /* ecma_op_function_call_native_built_in */\n\n/**\n * Perform a native C method call which was registered via the API.\n *\n * @return the result of the function call.\n */\nstatic ecma_value_t JERRY_ATTR_NOINLINE\necma_op_function_call_native (ecma_object_t *func_obj_p, /**< Function object */\n                              ecma_value_t this_arg_value, /**< 'this' argument's value */\n                              const ecma_value_t *arguments_list_p, /**< arguments list */\n                              uint32_t arguments_list_len) /**< length of arguments list */\n{\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);\n\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_native_function_t *native_function_p = (ecma_native_function_t *) func_obj_p;\n\n#if JERRY_BUILTIN_REALMS\n  ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);\n  JERRY_CONTEXT (global_object_p) =\n    ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value);\n#endif /* JERRY_BUILTIN_REALMS */\n\n  jerry_call_info_t call_info;\n  call_info.function = ecma_make_object_value (func_obj_p);\n  call_info.this_value = this_arg_value;\n\n  ecma_object_t *new_target_p = JERRY_CONTEXT (current_new_target_p);\n  call_info.new_target = (new_target_p == NULL) ? ECMA_VALUE_UNDEFINED : ecma_make_object_value (new_target_p);\n\n  JERRY_ASSERT (native_function_p->native_handler_cb != NULL);\n  ecma_value_t ret_value = native_function_p->native_handler_cb (&call_info, arguments_list_p, arguments_list_len);\n#if JERRY_BUILTIN_REALMS\n  JERRY_CONTEXT (global_object_p) = saved_global_object_p;\n#endif /* JERRY_BUILTIN_REALMS */\n\n  if (JERRY_UNLIKELY (ecma_is_value_exception (ret_value)))\n  {\n    ecma_throw_exception (ret_value);\n    return ECMA_VALUE_ERROR;\n  }\n\n#if JERRY_DEBUGGER\n  JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);\n#endif /* JERRY_DEBUGGER */\n  return ret_value;\n} /* ecma_op_function_call_native */\n\n/**\n * Append the bound arguments into the given collection\n *\n * Note:\n *       - The whole bound chain is resolved\n *       - The first element of the collection contains the bounded this value\n *\n * @return target function of the bound function\n */\nJERRY_ATTR_NOINLINE static ecma_object_t *\necma_op_bound_function_get_argument_list (ecma_object_t *func_obj_p, /**< bound bunction object */\n                                          ecma_collection_t *list_p) /**< list of arguments */\n{\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION);\n\n  ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p;\n\n  func_obj_p =\n    ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);\n\n  ecma_value_t args_len_or_this = bound_func_p->header.u.bound_function.args_len_or_this;\n\n  uint32_t args_length = 1;\n\n  if (ecma_is_value_integer_number (args_len_or_this))\n  {\n    args_length = (uint32_t) ecma_get_integer_from_value (args_len_or_this);\n  }\n\n  /* 5. */\n  if (args_length != 1)\n  {\n    const ecma_value_t *args_p = (const ecma_value_t *) (bound_func_p + 1);\n    list_p->buffer_p[0] = *args_p;\n\n    if (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION)\n    {\n      func_obj_p = ecma_op_bound_function_get_argument_list (func_obj_p, list_p);\n    }\n    ecma_collection_append (list_p, args_p + 1, args_length - 1);\n  }\n  else\n  {\n    list_p->buffer_p[0] = args_len_or_this;\n  }\n\n  return func_obj_p;\n} /* ecma_op_bound_function_get_argument_list */\n\n/**\n * [[Call]] internal method for bound function objects\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t JERRY_ATTR_NOINLINE\necma_op_function_call_bound (ecma_object_t *func_obj_p, /**< Function object */\n                             const ecma_value_t *arguments_list_p, /**< arguments list */\n                             uint32_t arguments_list_len) /**< length of arguments list */\n{\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION);\n\n  JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_DIRECT_EVAL;\n\n  ecma_collection_t *bound_arg_list_p = ecma_new_collection ();\n  ecma_collection_push_back (bound_arg_list_p, ECMA_VALUE_EMPTY);\n\n  ecma_object_t *target_obj_p = ecma_op_bound_function_get_argument_list (func_obj_p, bound_arg_list_p);\n\n  ecma_collection_append (bound_arg_list_p, arguments_list_p, arguments_list_len);\n\n  JERRY_ASSERT (!ecma_is_value_empty (bound_arg_list_p->buffer_p[0]));\n\n  ecma_value_t ret_value = ecma_op_function_call (target_obj_p,\n                                                  bound_arg_list_p->buffer_p[0],\n                                                  bound_arg_list_p->buffer_p + 1,\n                                                  (uint32_t) (bound_arg_list_p->item_count - 1));\n\n  ecma_collection_destroy (bound_arg_list_p);\n\n  return ret_value;\n} /* ecma_op_function_call_bound */\n\n/**\n * Invoke accessor getter function\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_invoke_getter (ecma_getter_setter_pointers_t *get_set_pair_p, /**< accessor pair */\n                       ecma_value_t this_value) /**< 'this' argument's value */\n{\n  if (get_set_pair_p->getter_cp == JMEM_CP_NULL)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  ecma_object_t *getter_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, get_set_pair_p->getter_cp);\n  ecma_ref_object (getter_p);\n\n  ecma_value_t result = ecma_op_function_call (getter_p, this_value, NULL, 0);\n  ecma_deref_object (getter_p);\n\n  return result;\n} /* ecma_op_invoke_getter */\n\n/**\n * Invoke accessor setter function\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_invoke_setter (ecma_getter_setter_pointers_t *get_set_pair_p, /**< accessor pair */\n                       ecma_value_t this_value, /**< 'this' argument's value */\n                       ecma_value_t value) /**< value to set */\n{\n  if (get_set_pair_p->setter_cp == JMEM_CP_NULL)\n  {\n    return ecma_raise_type_error (ECMA_ERR_PRIVATE_FIELD_WAS_DEFINED_WITHOUT_A_SETTER);\n  }\n\n  ecma_object_t *setter_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, get_set_pair_p->setter_cp);\n  ecma_ref_object (setter_p);\n\n  ecma_value_t result = ecma_op_function_call (setter_p, this_value, &value, 1);\n  ecma_deref_object (setter_p);\n\n  return result;\n} /* ecma_op_invoke_setter */\n\n/**\n * General [[Call]] implementation\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_function_validated_call (ecma_value_t callee, /**< callee */\n                                 ecma_value_t this_arg_value, /**< 'this' argument's value */\n                                 const ecma_value_t *arguments_list_p, /**< arguments list */\n                                 uint32_t arguments_list_len) /**< length of arguments list */\n{\n  if (!ecma_is_value_object (callee))\n  {\n    return ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION);\n  }\n\n  return ecma_op_function_call (ecma_get_object_from_value (callee),\n                                this_arg_value,\n                                arguments_list_p,\n                                arguments_list_len);\n} /* ecma_op_function_validated_call */\n\n/**\n * General [[Call]] implementation\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */\n                       ecma_value_t this_arg_value, /**< 'this' argument's value */\n                       const ecma_value_t *arguments_list_p, /**< arguments list */\n                       uint32_t arguments_list_len) /**< length of arguments list */\n{\n  JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p));\n\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target_p);\n\n  if (JERRY_UNLIKELY (!(JERRY_CONTEXT (status_flags) & ECMA_STATUS_DIRECT_EVAL)))\n  {\n    JERRY_CONTEXT (current_new_target_p) = NULL;\n  }\n\n  ecma_value_t result;\n\n  switch (ecma_get_object_type (func_obj_p))\n  {\n    case ECMA_OBJECT_TYPE_FUNCTION:\n    {\n      result = ecma_op_function_call_simple (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);\n      break;\n    }\n    case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n    {\n      result = ecma_op_function_call_native_built_in (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);\n      break;\n    }\n#if JERRY_BUILTIN_PROXY\n    case ECMA_OBJECT_TYPE_PROXY:\n    {\n      result = ecma_proxy_object_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);\n      break;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n    case ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION:\n    {\n      result = ecma_raise_type_error (ECMA_ERR_CLASS_CONSTRUCTOR_NEW);\n      break;\n    }\n    case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:\n    {\n      result = ecma_op_function_call_native (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);\n      break;\n    }\n    case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n    {\n      result = ecma_op_function_call_bound (func_obj_p, arguments_list_p, arguments_list_len);\n      break;\n    }\n    default:\n    {\n      result = ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION);\n      break;\n    }\n  }\n\n  JERRY_CONTEXT (current_new_target_p) = old_new_target_p;\n\n  return result;\n} /* ecma_op_function_call */\n\n/**\n * [[Construct]] internal method for ECMAScript function objects\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t\necma_op_function_construct_simple (ecma_object_t *func_obj_p, /**< Function object */\n                                   ecma_object_t *new_target_p, /**< new target */\n                                   const ecma_value_t *arguments_list_p, /**< arguments list */\n                                   uint32_t arguments_list_len) /**< length of arguments list */\n{\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION);\n\n  ecma_object_t *new_this_obj_p = NULL;\n  ecma_value_t this_arg;\n\n  ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p;\n\n  /* 5. */\n  if (!ECMA_GET_THIRD_BIT_FROM_POINTER_TAG (ext_func_obj_p->u.function.scope_cp))\n  {\n    /* 5.a */\n    ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (new_target_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n\n    /* 5.b */\n    if (JERRY_UNLIKELY (proto_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    new_this_obj_p = ecma_create_object (proto_p, 0, ECMA_OBJECT_TYPE_GENERAL);\n    ecma_deref_object (proto_p);\n    this_arg = ecma_make_object_value (new_this_obj_p);\n  }\n  else\n  {\n    this_arg = ECMA_VALUE_UNDEFINED;\n  }\n\n  /* 6. */\n  ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target_p);\n  JERRY_CONTEXT (current_new_target_p) = new_target_p;\n\n  ecma_value_t ret_value = ecma_op_function_call_simple (func_obj_p, this_arg, arguments_list_p, arguments_list_len);\n\n  JERRY_CONTEXT (current_new_target_p) = old_new_target_p;\n\n  /* 13.a */\n  if (ECMA_IS_VALUE_ERROR (ret_value) || ecma_is_value_object (ret_value))\n  {\n    if (new_this_obj_p != NULL)\n    {\n      ecma_deref_object (new_this_obj_p);\n    }\n\n    return ret_value;\n  }\n\n  /* 13.b */\n  ecma_free_value (ret_value);\n  return this_arg;\n} /* ecma_op_function_construct_simple */\n\n/**\n * [[Construct]] internal method for built-in function objects\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t\necma_op_function_construct_built_in (ecma_object_t *func_obj_p, /**< Function object */\n                                     ecma_object_t *new_target_p, /**< new target */\n                                     const ecma_value_t *arguments_list_p, /**< arguments list */\n                                     uint32_t arguments_list_len) /**< length of arguments list */\n{\n  JERRY_UNUSED (new_target_p);\n\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);\n\n#if JERRY_BUILTIN_REALMS\n  ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);\n  ecma_value_t realm_value = ((ecma_extended_object_t *) func_obj_p)->u.built_in.realm_value;\n  JERRY_CONTEXT (global_object_p) = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, realm_value);\n#endif /* JERRY_BUILTIN_REALMS */\n\n  ecma_object_t *old_new_target = JERRY_CONTEXT (current_new_target_p);\n  JERRY_CONTEXT (current_new_target_p) = new_target_p;\n\n  ecma_value_t ret_value = ecma_builtin_dispatch_construct (func_obj_p, arguments_list_p, arguments_list_len);\n\n  JERRY_CONTEXT (current_new_target_p) = old_new_target;\n\n#if JERRY_BUILTIN_REALMS\n  JERRY_CONTEXT (global_object_p) = saved_global_object_p;\n#endif /* JERRY_BUILTIN_REALMS */\n  return ret_value;\n} /* ecma_op_function_construct_built_in */\n\n/**\n * [[Construct]] internal method for bound function objects\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t JERRY_ATTR_NOINLINE\necma_op_function_construct_bound (ecma_object_t *func_obj_p, /**< Function object */\n                                  ecma_object_t *new_target_p, /**< new target */\n                                  const ecma_value_t *arguments_list_p, /**< arguments list */\n                                  uint32_t arguments_list_len) /**< length of arguments list */\n{\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION);\n\n  ecma_collection_t *bound_arg_list_p = ecma_new_collection ();\n  ecma_collection_push_back (bound_arg_list_p, ECMA_VALUE_EMPTY);\n\n  ecma_object_t *target_obj_p = ecma_op_bound_function_get_argument_list (func_obj_p, bound_arg_list_p);\n\n  ecma_collection_append (bound_arg_list_p, arguments_list_p, arguments_list_len);\n\n  if (func_obj_p == new_target_p)\n  {\n    new_target_p = target_obj_p;\n  }\n\n  ecma_value_t ret_value = ecma_op_function_construct (target_obj_p,\n                                                       new_target_p,\n                                                       bound_arg_list_p->buffer_p + 1,\n                                                       (uint32_t) (bound_arg_list_p->item_count - 1));\n\n  ecma_collection_destroy (bound_arg_list_p);\n\n  return ret_value;\n} /* ecma_op_function_construct_bound */\n\n/**\n * [[Construct]] internal method for class implicit constructor objects\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t\necma_op_function_construct_constructor (ecma_object_t *func_obj_p, /**< Function object */\n                                        ecma_object_t *new_target_p, /**< new target */\n                                        const ecma_value_t *arguments_list_p, /**< arguments list */\n                                        uint32_t arguments_list_len) /**< length of arguments list */\n{\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION);\n\n  ecma_extended_object_t *constructor_object_p = (ecma_extended_object_t *) func_obj_p;\n\n  if (!(constructor_object_p->u.constructor_function.flags & ECMA_CONSTRUCTOR_FUNCTION_HAS_HERITAGE))\n  {\n    ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (new_target_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n\n    if (JERRY_UNLIKELY (proto_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_object_t *new_this_object_p = ecma_create_object (proto_p, 0, ECMA_OBJECT_TYPE_GENERAL);\n    ecma_deref_object (proto_p);\n\n    jerry_value_t new_this_value = ecma_make_object_value (new_this_object_p);\n    jerry_value_t ret_value = opfunc_init_class_fields (func_obj_p, new_this_value);\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      ecma_deref_object (new_this_object_p);\n      return ret_value;\n    }\n\n    return new_this_value;\n  }\n\n  ecma_value_t super_ctor = ecma_op_function_get_super_constructor (func_obj_p);\n\n  if (ECMA_IS_VALUE_ERROR (super_ctor))\n  {\n    return super_ctor;\n  }\n\n  ecma_object_t *super_ctor_p = ecma_get_object_from_value (super_ctor);\n  ecma_value_t result = ecma_op_function_construct (super_ctor_p, new_target_p, arguments_list_p, arguments_list_len);\n  ecma_deref_object (super_ctor_p);\n\n  if (ecma_is_value_object (result))\n  {\n    ecma_value_t fields_value = opfunc_init_class_fields (func_obj_p, result);\n\n    if (ECMA_IS_VALUE_ERROR (fields_value))\n    {\n      ecma_free_value (result);\n      return fields_value;\n    }\n  }\n\n  return result;\n} /* ecma_op_function_construct_constructor */\n\n/**\n * [[Construct]] internal method for external function objects\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t\necma_op_function_construct_native (ecma_object_t *func_obj_p, /**< Function object */\n                                   ecma_object_t *new_target_p, /**< new target */\n                                   const ecma_value_t *arguments_list_p, /**< arguments list */\n                                   uint32_t arguments_list_len) /**< length of arguments list */\n{\n  JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);\n\n  ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (new_target_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n\n  if (JERRY_UNLIKELY (proto_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_object_t *new_this_obj_p = ecma_create_object (proto_p, 0, ECMA_OBJECT_TYPE_GENERAL);\n  ecma_value_t this_arg = ecma_make_object_value (new_this_obj_p);\n  ecma_deref_object (proto_p);\n\n  ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target_p);\n  JERRY_CONTEXT (current_new_target_p) = new_target_p;\n\n  ecma_value_t ret_value = ecma_op_function_call_native (func_obj_p, this_arg, arguments_list_p, arguments_list_len);\n\n  JERRY_CONTEXT (current_new_target_p) = old_new_target_p;\n\n  if (ECMA_IS_VALUE_ERROR (ret_value) || ecma_is_value_object (ret_value))\n  {\n    ecma_deref_object (new_this_obj_p);\n    return ret_value;\n  }\n\n  ecma_free_value (ret_value);\n\n  return this_arg;\n} /* ecma_op_function_construct_native */\n\n/**\n * General [[Construct]] implementation function objects\n *\n * See also: ECMAScript v6, 9.2.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */\n                            ecma_object_t *new_target_p, /**< new target */\n                            const ecma_value_t *arguments_list_p, /**< arguments list */\n                            uint32_t arguments_list_len) /**< length of arguments list */\n{\n  JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p));\n\n  ECMA_CHECK_STACK_USAGE ();\n\n  switch (ecma_get_object_type (func_obj_p))\n  {\n    case ECMA_OBJECT_TYPE_FUNCTION:\n    {\n      return ecma_op_function_construct_simple (func_obj_p, new_target_p, arguments_list_p, arguments_list_len);\n    }\n    case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n    {\n      return ecma_op_function_construct_built_in (func_obj_p, new_target_p, arguments_list_p, arguments_list_len);\n    }\n#if JERRY_BUILTIN_PROXY\n    case ECMA_OBJECT_TYPE_PROXY:\n    {\n      return ecma_proxy_object_construct (func_obj_p, new_target_p, arguments_list_p, arguments_list_len);\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n    case ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION:\n    {\n      return ecma_op_function_construct_constructor (func_obj_p, new_target_p, arguments_list_p, arguments_list_len);\n    }\n    case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n    {\n      return ecma_op_function_construct_bound (func_obj_p, new_target_p, arguments_list_p, arguments_list_len);\n    }\n    case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:\n    {\n      return ecma_op_function_construct_native (func_obj_p, new_target_p, arguments_list_p, arguments_list_len);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_op_function_construct */\n\n/**\n * Lazy instantiation of 'prototype' property for non-builtin and external functions\n *\n * @return pointer to newly instantiated property\n */\nstatic ecma_property_t *\necma_op_lazy_instantiate_prototype_object (ecma_object_t *object_p) /**< the function object */\n{\n  JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION\n                || ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);\n\n#if JERRY_BUILTIN_REALMS\n  ecma_global_object_t *global_object_p;\n\n  if (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION)\n  {\n    const ecma_compiled_code_t *bytecode_data_p;\n    bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);\n\n    global_object_p = ecma_op_function_get_realm (bytecode_data_p);\n  }\n  else\n  {\n    ecma_native_function_t *native_function_p = (ecma_native_function_t *) object_p;\n\n    global_object_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value);\n  }\n#endif /* JERRY_BUILTIN_REALMS */\n\n  /* ECMA-262 v5, 13.2, 16-18 */\n\n  ecma_object_t *proto_object_p = NULL;\n  bool init_constructor = true;\n\n  if (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION)\n  {\n    const ecma_compiled_code_t *byte_code_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);\n\n    if (!CBC_FUNCTION_HAS_PROTOTYPE (byte_code_p->status_flags))\n    {\n      return NULL;\n    }\n\n    if (CBC_FUNCTION_GET_TYPE (byte_code_p->status_flags) == CBC_FUNCTION_GENERATOR)\n    {\n      ecma_object_t *prototype_p;\n\n#if JERRY_BUILTIN_REALMS\n      prototype_p = ecma_builtin_get_from_realm (global_object_p, ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE);\n#else /* !JERRY_BUILTIN_REALMS */\n      prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE);\n#endif /* JERRY_BUILTIN_REALMS */\n\n      proto_object_p = ecma_create_object (prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL);\n      init_constructor = false;\n    }\n\n    if (CBC_FUNCTION_GET_TYPE (byte_code_p->status_flags) == CBC_FUNCTION_ASYNC_GENERATOR)\n    {\n      ecma_object_t *prototype_p;\n\n#if JERRY_BUILTIN_REALMS\n      prototype_p = ecma_builtin_get_from_realm (global_object_p, ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE);\n#else /* !JERRY_BUILTIN_REALMS */\n      prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE);\n#endif /* JERRY_BUILTIN_REALMS */\n\n      proto_object_p = ecma_create_object (prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL);\n      init_constructor = false;\n    }\n  }\n\n  if (proto_object_p == NULL)\n  {\n    ecma_object_t *prototype_p;\n\n#if JERRY_BUILTIN_REALMS\n    prototype_p = ecma_builtin_get_from_realm (global_object_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n#else /* !JERRY_BUILTIN_REALMS */\n    prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n#endif /* JERRY_BUILTIN_REALMS */\n\n    proto_object_p = ecma_op_create_object_object_noarg_and_set_prototype (prototype_p);\n  }\n\n  /* 17. */\n  if (init_constructor)\n  {\n    ecma_property_value_t *constructor_prop_value_p;\n    constructor_prop_value_p = ecma_create_named_data_property (proto_object_p,\n                                                                ecma_get_magic_string (LIT_MAGIC_STRING_CONSTRUCTOR),\n                                                                ECMA_PROPERTY_CONFIGURABLE_WRITABLE,\n                                                                NULL);\n\n    constructor_prop_value_p->value = ecma_make_object_value (object_p);\n  }\n\n  /* 18. */\n  ecma_property_t *prototype_prop_p;\n  ecma_property_value_t *prototype_prop_value_p;\n  prototype_prop_value_p = ecma_create_named_data_property (object_p,\n                                                            ecma_get_magic_string (LIT_MAGIC_STRING_PROTOTYPE),\n                                                            ECMA_PROPERTY_BUILT_IN_WRITABLE,\n                                                            &prototype_prop_p);\n\n  prototype_prop_value_p->value = ecma_make_object_value (proto_object_p);\n\n  ecma_deref_object (proto_object_p);\n\n  return prototype_prop_p;\n} /* ecma_op_lazy_instantiate_prototype_object */\n\n/**\n * Lazy instantiation of non-builtin ecma function object's properties\n *\n * Warning:\n *         Only non-configurable properties could be instantiated lazily in this function,\n *         as configurable properties could be deleted and it would be incorrect\n *         to reinstantiate them in the function in second time.\n *\n * @return pointer to newly instantiated property, if a property was instantiated,\n *         NULL - otherwise\n */\necma_property_t *\necma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< the function object */\n                                                   ecma_string_t *property_name_p) /**< property name */\n{\n  JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION);\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH))\n  {\n    ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;\n\n    if (ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (ext_func_p->u.function.scope_cp))\n    {\n      return NULL;\n    }\n\n    /* Initialize 'length' property */\n    const ecma_compiled_code_t *bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p);\n    uint32_t len;\n\n    if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n    {\n      cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_data_p;\n      len = args_p->argument_end;\n    }\n    else\n    {\n      cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_data_p;\n      len = args_p->argument_end;\n    }\n\n    if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_HAS_EXTENDED_INFO)\n    {\n      uint8_t *extended_info_p = ecma_compiled_code_resolve_extended_info (bytecode_data_p);\n\n      if (*extended_info_p & CBC_EXTENDED_CODE_FLAGS_HAS_ARGUMENT_LENGTH)\n      {\n        len = ecma_extended_info_decode_vlq (&extended_info_p);\n      }\n    }\n\n    ecma_property_t *value_prop_p;\n    ecma_property_value_t *value_p =\n      ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &value_prop_p);\n    value_p->value = ecma_make_uint32_value (len);\n    return value_prop_p;\n  }\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_NAME))\n  {\n    ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;\n\n    if (ECMA_GET_SECOND_BIT_FROM_POINTER_TAG (ext_func_p->u.function.scope_cp))\n    {\n      return NULL;\n    }\n\n    const ecma_compiled_code_t *bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p);\n\n    if (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_CONSTRUCTOR)\n    {\n      return NULL;\n    }\n\n    ecma_value_t value = *ecma_compiled_code_resolve_function_name (bytecode_data_p);\n    JERRY_ASSERT (ecma_is_value_string (value));\n\n    /* Initialize 'name' property */\n    ecma_property_t *value_prop_p;\n    ecma_property_value_t *value_p =\n      ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &value_prop_p);\n    value_p->value = ecma_copy_value (value);\n    return value_prop_p;\n  }\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_PROTOTYPE)\n      && ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_FUNCTION)\n  {\n    return ecma_op_lazy_instantiate_prototype_object (object_p);\n  }\n\n  const bool is_arguments = ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS);\n\n  if (is_arguments || ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER))\n  {\n    const ecma_compiled_code_t *bytecode_data_p;\n    bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);\n\n    if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)\n        && CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_NORMAL)\n    {\n      ecma_property_t *value_prop_p;\n      /* The property_name_p argument contains the name. */\n      ecma_property_value_t *value_p =\n        ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_FIXED, &value_prop_p);\n      value_p->value = is_arguments ? ECMA_VALUE_NULL : ECMA_VALUE_UNDEFINED;\n      return value_prop_p;\n    }\n  }\n\n  return NULL;\n} /* ecma_op_function_try_to_lazy_instantiate_property */\n\n/**\n * Create specification defined non-configurable properties for external functions.\n *\n * See also:\n *          ECMA-262 v5, 15.3.4.5\n *\n * @return pointer property, if one was instantiated,\n *         NULL - otherwise.\n */\necma_property_t *\necma_op_external_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< object */\n                                                            ecma_string_t *property_name_p) /**< property's name */\n{\n  JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_NATIVE_FUNCTION);\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_PROTOTYPE))\n  {\n    return ecma_op_lazy_instantiate_prototype_object (object_p);\n  }\n\n  return NULL;\n} /* ecma_op_external_function_try_to_lazy_instantiate_property */\n\n/**\n * Create specification defined non-configurable properties for bound functions.\n *\n * See also:\n *          ECMA-262 v5, 15.3.4.5\n *\n * @return pointer property, if one was instantiated,\n *         NULL - otherwise.\n */\necma_property_t *\necma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**< object */\n                                                         ecma_string_t *property_name_p) /**< property's name */\n{\n  JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_BOUND_FUNCTION);\n\n  if (ecma_string_is_length (property_name_p))\n  {\n    ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) object_p;\n    ecma_value_t args_len_or_this = bound_func_p->header.u.bound_function.args_len_or_this;\n    ecma_number_t length = 0;\n    ecma_integer_value_t args_length = 1;\n    uint8_t length_attributes;\n\n    if (ecma_is_value_integer_number (args_len_or_this))\n    {\n      args_length = ecma_get_integer_from_value (args_len_or_this);\n    }\n\n    if (ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (bound_func_p->header.u.bound_function.target_function))\n    {\n      return NULL;\n    }\n\n    length_attributes = ECMA_PROPERTY_BUILT_IN_CONFIGURABLE;\n    length = ecma_get_number_from_value (bound_func_p->target_length) - (args_length - 1);\n\n    if (length < 0)\n    {\n      length = 0;\n    }\n\n    ecma_property_t *len_prop_p;\n    ecma_property_value_t *len_prop_value_p =\n      ecma_create_named_data_property (object_p, property_name_p, length_attributes, &len_prop_p);\n\n    len_prop_value_p->value = ecma_make_number_value (length);\n    return len_prop_p;\n  }\n\n  return NULL;\n} /* ecma_op_bound_function_try_to_lazy_instantiate_property */\n\n/**\n * Delete configurable properties of functions.\n */\nvoid\necma_op_function_delete_built_in_property (ecma_object_t *object_p, /**< object */\n                                           ecma_string_t *property_name_p) /**< property name */\n{\n  ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;\n\n  if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH))\n  {\n    JERRY_ASSERT (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (ext_func_p->u.function.scope_cp));\n    ECMA_SET_FIRST_BIT_TO_POINTER_TAG (ext_func_p->u.function.scope_cp);\n    return;\n  }\n\n  JERRY_ASSERT (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_NAME));\n  JERRY_ASSERT (!ECMA_GET_SECOND_BIT_FROM_POINTER_TAG (ext_func_p->u.function.scope_cp));\n\n  ECMA_SET_SECOND_BIT_TO_POINTER_TAG (ext_func_p->u.function.scope_cp);\n} /* ecma_op_function_delete_built_in_property */\n\n/**\n * Delete configurable properties of bound functions.\n */\nvoid\necma_op_bound_function_delete_built_in_property (ecma_object_t *object_p, /**< object */\n                                                 ecma_string_t *property_name_p) /**< property name */\n{\n  JERRY_UNUSED (property_name_p);\n\n  ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) object_p;\n\n  JERRY_ASSERT (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_LENGTH));\n  JERRY_ASSERT (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (bound_func_p->header.u.bound_function.target_function));\n\n  ECMA_SET_FIRST_BIT_TO_POINTER_TAG (bound_func_p->header.u.bound_function.target_function);\n} /* ecma_op_bound_function_delete_built_in_property */\n\n/**\n * List names of a Function object's lazy instantiated properties,\n * adding them to corresponding string collections\n *\n * See also:\n *          ecma_op_function_try_to_lazy_instantiate_property\n */\nvoid\necma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functionobject */\n                                           ecma_collection_t *prop_names_p, /**< prop name collection */\n                                           ecma_property_counter_t *prop_counter_p, /**< property counters */\n                                           jerry_property_filter_t filter) /**< property name filter options */\n{\n  if (filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS)\n  {\n    return;\n  }\n\n  const ecma_compiled_code_t *bytecode_data_p;\n  bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);\n\n  ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;\n\n  if (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (ext_func_p->u.function.scope_cp))\n  {\n    /* Unintialized 'length' property is non-enumerable (ECMA-262 v6, 19.2.4.1) */\n    ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));\n    prop_counter_p->string_named_props++;\n  }\n\n  if (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR\n      && !ECMA_GET_SECOND_BIT_FROM_POINTER_TAG (ext_func_p->u.function.scope_cp))\n  {\n    /* Unintialized 'name' property is non-enumerable (ECMA-262 v6, 19.2.4.2) */\n    ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_NAME));\n    prop_counter_p->string_named_props++;\n  }\n\n  if (!CBC_FUNCTION_HAS_PROTOTYPE (bytecode_data_p->status_flags)\n      || (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_CONSTRUCTOR))\n  {\n    return;\n  }\n\n  if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE))\n  {\n    /* 'arguments' property is non-enumerable (ECMA-262 v5, 13.2.5) */\n    ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_ARGUMENTS));\n\n    /* 'caller' property is non-enumerable (ECMA-262 v5, 13.2.5) */\n    ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER));\n\n    prop_counter_p->string_named_props += 2;\n  }\n\n  /* 'prototype' property is non-enumerable (ECMA-262 v5, 13.2.18) */\n  ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_PROTOTYPE));\n  prop_counter_p->string_named_props++;\n} /* ecma_op_function_list_lazy_property_names */\n\n/**\n * List names of an External Function object's lazy instantiated properties,\n * adding them to corresponding string collections\n *\n * See also:\n *          ecma_op_external_function_try_to_lazy_instantiate_property\n */\nvoid\necma_op_external_function_list_lazy_property_names (ecma_object_t *object_p, /**< function object */\n                                                    ecma_collection_t *prop_names_p, /**< prop name collection */\n                                                    ecma_property_counter_t *prop_counter_p, /**< property counters */\n                                                    jerry_property_filter_t filter) /**< property name\n                                                                                     *   filter options */\n{\n  JERRY_UNUSED (object_p);\n\n  if (filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS)\n  {\n    return;\n  }\n\n  /* 'prototype' property is non-enumerable (ECMA-262 v5, 13.2.18) */\n  ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_PROTOTYPE));\n  prop_counter_p->string_named_props++;\n} /* ecma_op_external_function_list_lazy_property_names */\n\n/**\n * List names of a Bound Function object's lazy instantiated properties,\n * adding them to corresponding string collections\n *\n * See also:\n *          ecma_op_bound_function_try_to_lazy_instantiate_property\n */\nvoid\necma_op_bound_function_list_lazy_property_names (ecma_object_t *object_p, /**< bound function object*/\n                                                 ecma_collection_t *prop_names_p, /**< prop name collection */\n                                                 ecma_property_counter_t *prop_counter_p, /**< property counters */\n                                                 jerry_property_filter_t filter) /**< property name filter options */\n{\n  if (filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS)\n  {\n    return;\n  }\n\n  /* Unintialized 'length' property is non-enumerable (ECMA-262 v6, 19.2.4.1) */\n  ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) object_p;\n  if (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (bound_func_p->header.u.bound_function.target_function))\n  {\n    ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));\n    prop_counter_p->string_named_props++;\n  }\n\n  /* 'caller' property is non-enumerable (ECMA-262 v5, 13.2.5) */\n  ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER));\n\n  /* 'arguments' property is non-enumerable (ECMA-262 v5, 13.2.5) */\n  ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_ARGUMENTS));\n\n  prop_counter_p->string_named_props += 2;\n} /* ecma_op_bound_function_list_lazy_property_names */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-function-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_FUNCTION_OBJECT_H\n#define ECMA_FUNCTION_OBJECT_H\n\n#include \"ecma-builtin-handlers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-globals.h\"\n\n#include \"vm.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmafunctionobject ECMA Function object related routines\n * @{\n */\n\necma_value_t ecma_op_function_form_name (ecma_string_t *prop_name_p, char *prefix_p, lit_utf8_size_t prefix_size);\n\nbool ecma_op_is_callable (ecma_value_t value);\n#if JERRY_BUILTIN_PROXY\nbool ecma_op_proxy_object_is_callable (ecma_object_t *obj_p);\n#endif /* JERRY_BUILTIN_PROXY */\nbool ecma_op_object_is_callable (ecma_object_t *obj_p);\nbool ecma_is_constructor (ecma_value_t value);\nbool ecma_object_is_constructor (ecma_object_t *obj_p);\n\n/**\n * Special constant indicating that the value is a valid constructor\n *\n * Use after the ecma_*_check_constructor calls.\n */\n\necma_error_msg_t ecma_object_check_constructor (ecma_object_t *obj_p);\necma_error_msg_t ecma_check_constructor (ecma_value_t value);\n\necma_object_t *ecma_op_create_simple_function_object (ecma_object_t *scope_p,\n                                                      const ecma_compiled_code_t *bytecode_data_p);\n\necma_object_t *ecma_op_create_external_function_object (ecma_native_handler_t handler_cb);\n\nconst ecma_compiled_code_t *ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p);\n\n#if JERRY_BUILTIN_REALMS\necma_global_object_t *ecma_op_function_get_realm (const ecma_compiled_code_t *bytecode_header_p);\n\necma_global_object_t *ecma_op_function_get_function_realm (ecma_object_t *func_obj_p);\n#endif /* JERRY_BUILTIN_REALMS */\n\necma_value_t ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p,\n                                              uint32_t arguments_list_len,\n                                              ecma_parse_opts_t opts);\n\necma_value_t ecma_op_function_get_super_constructor (ecma_object_t *func_obj_p);\n\necma_object_t *ecma_op_create_any_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p);\n\necma_object_t *ecma_op_create_arrow_function_object (ecma_object_t *scope_p,\n                                                     const ecma_compiled_code_t *bytecode_data_p,\n                                                     ecma_value_t this_binding);\n\necma_object_t *ecma_op_create_native_handler (ecma_native_handler_id_t id, size_t object_size);\n\necma_object_t *ecma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, ecma_builtin_id_t default_proto_id);\n\necma_value_t ecma_op_function_has_instance (ecma_object_t *func_obj_p, ecma_value_t value);\n\necma_value_t ecma_op_invoke_getter (ecma_getter_setter_pointers_t *get_set_pair_p, ecma_value_t this_value);\n\necma_value_t\necma_op_invoke_setter (ecma_getter_setter_pointers_t *get_set_pair_p, ecma_value_t this_value, ecma_value_t value);\n\necma_value_t ecma_op_function_validated_call (ecma_value_t callee,\n                                              ecma_value_t this_arg_value,\n                                              const ecma_value_t *arguments_list_p,\n                                              uint32_t arguments_list_len);\n\necma_value_t ecma_op_function_call (ecma_object_t *func_obj_p,\n                                    ecma_value_t this_arg_value,\n                                    const ecma_value_t *arguments_list_p,\n                                    uint32_t arguments_list_len);\n\necma_value_t ecma_op_function_construct (ecma_object_t *func_obj_p,\n                                         ecma_object_t *new_target_p,\n                                         const ecma_value_t *arguments_list_p,\n                                         uint32_t arguments_list_len);\n\necma_property_t *ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p,\n                                                                    ecma_string_t *property_name_p);\n\necma_property_t *ecma_op_external_function_try_to_lazy_instantiate_property (ecma_object_t *object_p,\n                                                                             ecma_string_t *property_name_p);\n\necma_property_t *ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p,\n                                                                          ecma_string_t *property_name_p);\n\nvoid ecma_op_function_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);\n\nvoid ecma_op_bound_function_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);\n\nvoid ecma_op_function_list_lazy_property_names (ecma_object_t *object_p,\n                                                ecma_collection_t *prop_names_p,\n                                                ecma_property_counter_t *prop_counter_p,\n                                                jerry_property_filter_t filter);\n\nvoid ecma_op_external_function_list_lazy_property_names (ecma_object_t *object_p,\n                                                         ecma_collection_t *prop_names_p,\n                                                         ecma_property_counter_t *prop_counter_p,\n                                                         jerry_property_filter_t filter);\n\nvoid ecma_op_bound_function_list_lazy_property_names (ecma_object_t *object_p,\n                                                      ecma_collection_t *prop_names_p,\n                                                      ecma_property_counter_t *prop_counter_p,\n                                                      jerry_property_filter_t filter);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_FUNCTION_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-get-put-value.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Implementation of ECMA GetValue and PutValue\n */\n\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-reference.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup lexicalenvironment Lexical environment\n * @{\n */\n\n/**\n * GetValue operation part\n *\n * See also: ECMA-262 v5, 8.7.1, sections 3 and 5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environment */\n                                ecma_object_t **ref_base_lex_env_p, /**< [out] reference's base (lexical environment) */\n                                ecma_string_t *name_p) /**< variable name */\n{\n  JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));\n\n  while (true)\n  {\n    switch (ecma_get_lex_env_type (lex_env_p))\n    {\n      case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:\n      {\n        ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n        if (property_p != NULL)\n        {\n          *ref_base_lex_env_p = lex_env_p;\n          ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n          if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))\n          {\n            return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);\n          }\n\n          return ecma_fast_copy_value (property_value_p->value);\n        }\n        break;\n      }\n      case ECMA_LEXICAL_ENVIRONMENT_CLASS:\n      {\n#if JERRY_MODULE_SYSTEM\n        if (ECMA_LEX_ENV_CLASS_IS_MODULE (lex_env_p))\n        {\n          ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n          if (property_p != NULL)\n          {\n            *ref_base_lex_env_p = lex_env_p;\n            ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n            if (!(*property_p & ECMA_PROPERTY_FLAG_DATA))\n            {\n              property_value_p = ecma_get_property_value_from_named_reference (property_value_p);\n            }\n\n            if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))\n            {\n              return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);\n            }\n\n            return ecma_fast_copy_value (property_value_p->value);\n          }\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n\n        ecma_value_t result = ecma_op_object_bound_environment_resolve_reference_value (lex_env_p, name_p);\n\n        if (ecma_is_value_found (result))\n        {\n          /* Note: the result may contains ECMA_VALUE_ERROR */\n          *ref_base_lex_env_p = lex_env_p;\n          return result;\n        }\n\n        break;\n      }\n    }\n\n    if (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL)\n    {\n      break;\n    }\n\n    lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n  }\n\n  *ref_base_lex_env_p = NULL;\n#if JERRY_ERROR_MESSAGES\n  return ecma_raise_standard_error_with_format (JERRY_ERROR_REFERENCE,\n                                                \"% is not defined\",\n                                                ecma_make_string_value (name_p));\n#else /* JERRY_ERROR_MESSAGES */\n  return ecma_raise_reference_error (ECMA_ERR_EMPTY);\n#endif /* JERRY_ERROR_MESSAGES */\n\n} /* ecma_op_get_value_lex_env_base */\n\n/**\n * GetValue operation part (object base).\n *\n * See also: ECMA-262 v5, 8.7.1, section 4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_get_value_object_base (ecma_value_t base_value, /**< base value */\n                               ecma_string_t *property_name_p) /**< property name */\n{\n  ecma_object_t *obj_p;\n\n  if (JERRY_UNLIKELY (ecma_is_value_object (base_value)))\n  {\n    obj_p = ecma_get_object_from_value (base_value);\n  }\n  else\n  {\n    ecma_builtin_id_t id = ECMA_BUILTIN_ID_OBJECT_PROTOTYPE;\n\n    if (JERRY_LIKELY (ecma_is_value_string (base_value)))\n    {\n      ecma_string_t *string_p = ecma_get_string_from_value (base_value);\n\n      if (ecma_string_is_length (property_name_p))\n      {\n        return ecma_make_uint32_value (ecma_string_get_length (string_p));\n      }\n\n      uint32_t index = ecma_string_get_array_index (property_name_p);\n\n      if (index != ECMA_STRING_NOT_ARRAY_INDEX && index < ecma_string_get_length (string_p))\n      {\n        ecma_char_t char_at_idx = ecma_string_get_char_at_pos (string_p, index);\n        return ecma_make_string_value (ecma_new_ecma_string_from_code_unit (char_at_idx));\n      }\n\n#if JERRY_BUILTIN_STRING\n      id = ECMA_BUILTIN_ID_STRING_PROTOTYPE;\n#endif /* JERRY_BUILTIN_STRING */\n    }\n    else if (ecma_is_value_number (base_value))\n    {\n#if JERRY_BUILTIN_NUMBER\n      id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE;\n#endif /* JERRY_BUILTIN_NUMBER */\n    }\n    else if (ecma_is_value_symbol (base_value))\n    {\n      id = ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE;\n    }\n#if JERRY_BUILTIN_BIGINT\n    else if (ecma_is_value_bigint (base_value))\n    {\n      id = ECMA_BUILTIN_ID_BIGINT_PROTOTYPE;\n    }\n#endif /* JERRY_BUILTIN_BIGINT */\n    else\n    {\n      JERRY_ASSERT (ecma_is_value_boolean (base_value));\n#if JERRY_BUILTIN_BOOLEAN\n      id = ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE;\n#endif /* JERRY_BUILTIN_BOOLEAN */\n    }\n\n    obj_p = ecma_builtin_get (id);\n  }\n\n  return ecma_op_object_get_with_receiver (obj_p, property_name_p, base_value);\n} /* ecma_op_get_value_object_base */\n\n/**\n * PutValue operation part\n *\n * See also: ECMA-262 v5, 8.7.2, sections 3 and 5\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environment */\n                                ecma_string_t *name_p, /**< variable name */\n                                bool is_strict, /**< flag indicating strict mode */\n                                ecma_value_t value) /**< ECMA-value */\n{\n  JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));\n\n  while (true)\n  {\n    switch (ecma_get_lex_env_type (lex_env_p))\n    {\n      case ECMA_LEXICAL_ENVIRONMENT_CLASS:\n      {\n        if (!ECMA_LEX_ENV_CLASS_IS_MODULE (lex_env_p))\n        {\n          break;\n        }\n        /* FALLTHRU */\n      }\n      case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:\n      {\n        ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n        if (property_p != NULL)\n        {\n          ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n          JERRY_ASSERT (!(*property_p & ECMA_PROPERTY_FLAG_WRITABLE) || (*property_p & ECMA_PROPERTY_FLAG_DATA));\n\n          if ((*property_p & ECMA_PROPERTY_FLAG_WRITABLE) && property_value_p->value != ECMA_VALUE_UNINITIALIZED)\n          {\n            ecma_named_data_property_assign_value (lex_env_p, property_value_p, value);\n            return ECMA_VALUE_EMPTY;\n          }\n\n          return ecma_op_raise_set_binding_error (property_p, is_strict);\n        }\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n\n        ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);\n\n        ecma_value_t has_property = ecma_op_object_has_property (binding_obj_p, name_p);\n\n#if JERRY_BUILTIN_PROXY\n        if (ECMA_IS_VALUE_ERROR (has_property))\n        {\n          return has_property;\n        }\n#endif /* JERRY_BUILTIN_PROXY */\n\n        if (ecma_is_value_true (has_property))\n        {\n          ecma_value_t completion = ecma_op_object_put (binding_obj_p, name_p, value, is_strict);\n\n          if (ECMA_IS_VALUE_ERROR (completion))\n          {\n            return completion;\n          }\n\n          JERRY_ASSERT (ecma_is_value_boolean (completion));\n          return ECMA_VALUE_EMPTY;\n        }\n\n        break;\n      }\n    }\n\n    if (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL)\n    {\n      break;\n    }\n\n    lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n  }\n\n  JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n\n  if (is_strict)\n  {\n#if JERRY_ERROR_MESSAGES\n    return ecma_raise_standard_error_with_format (JERRY_ERROR_REFERENCE,\n                                                  \"% is not defined\",\n                                                  ecma_make_string_value (name_p));\n#else /* !JERRY_ERROR_MESSAGES */\n    return ecma_raise_reference_error (ECMA_ERR_EMPTY);\n#endif /* JERRY_ERROR_MESSAGES */\n  }\n\n  ecma_value_t completion = ecma_op_object_put (ecma_get_lex_env_binding_object (lex_env_p), name_p, value, false);\n\n  JERRY_ASSERT (ecma_is_value_boolean (completion));\n\n  return ECMA_VALUE_EMPTY;\n} /* ecma_op_put_value_lex_env_base */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-iterator-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-iterator-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaiteratorobject ECMA iterator object related routines\n * @{\n */\n\n/**\n * Implementation of 'CreateArrayFromList' specialized for iterators\n *\n * See also:\n *          ECMA-262 v6, 7.3.16.\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return new array object\n */\necma_value_t\necma_create_array_from_iter_element (ecma_value_t value, /**< value */\n                                     ecma_value_t index_value) /**< iterator index */\n{\n  /* 2. */\n  ecma_object_t *new_array_p = ecma_op_new_array_object (0);\n\n  /* 3-4. */\n  ecma_value_t completion;\n  completion =\n    ecma_builtin_helper_def_prop_by_index (new_array_p, 0, index_value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n\n  /* 4.b */\n  JERRY_ASSERT (ecma_is_value_true (completion));\n\n  completion =\n    ecma_builtin_helper_def_prop_by_index (new_array_p, 1, value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n  JERRY_ASSERT (ecma_is_value_true (completion));\n\n  /* 5. */\n  return ecma_make_object_value (new_array_p);\n} /* ecma_create_array_from_iter_element */\n\n/**\n * CreateIterResultObject operation\n *\n * See also:\n *          ECMA-262 v6, 7.4.7.\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator result object\n */\necma_value_t\necma_create_iter_result_object (ecma_value_t value, /**< value */\n                                ecma_value_t done) /**< ECMA_VALUE_{TRUE,FALSE} based\n                                                    *   on the iterator index */\n{\n  /* 1. */\n  JERRY_ASSERT (ecma_is_value_boolean (done));\n\n  /* 2. */\n  ecma_object_t *object_p =\n    ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL);\n\n  /* 3. */\n  ecma_property_value_t *prop_value_p;\n  prop_value_p = ecma_create_named_data_property (object_p,\n                                                  ecma_get_magic_string (LIT_MAGIC_STRING_VALUE),\n                                                  ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                  NULL);\n\n  prop_value_p->value = ecma_copy_value_if_not_object (value);\n\n  /* 4. */\n  prop_value_p = ecma_create_named_data_property (object_p,\n                                                  ecma_get_magic_string (LIT_MAGIC_STRING_DONE),\n                                                  ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                  NULL);\n  prop_value_p->value = done;\n\n  /* 5. */\n  return ecma_make_object_value (object_p);\n} /* ecma_create_iter_result_object */\n\n/**\n * General iterator object creation operation.\n *\n * See also: ECMA-262 v6, 21.1.5.1, 22.1.5.1, 23.1.5.1\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator object\n */\necma_value_t\necma_op_create_iterator_object (ecma_value_t iterated_value, /**< value from create iterator */\n                                ecma_object_t *prototype_obj_p, /**< prototype object */\n                                ecma_object_class_type_t iterator_type, /**< iterator type */\n                                ecma_iterator_kind_t kind) /**< iterator kind*/\n{\n  /* 1. */\n  JERRY_ASSERT (iterator_type == ECMA_OBJECT_CLASS_ARRAY_ITERATOR || iterator_type == ECMA_OBJECT_CLASS_SET_ITERATOR\n                || iterator_type == ECMA_OBJECT_CLASS_MAP_ITERATOR\n                || iterator_type == ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR\n                || iterator_type == ECMA_OBJECT_CLASS_STRING_ITERATOR);\n  JERRY_ASSERT (kind < ECMA_ITERATOR__COUNT);\n\n  /* 2. */\n  ecma_object_t *object_p =\n    ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;\n  ext_obj_p->u.cls.type = (uint8_t) iterator_type;\n\n  /* 3. */\n  ext_obj_p->u.cls.u3.iterated_value = iterated_value;\n  /* 4. */\n  ext_obj_p->u.cls.u2.iterator_index = 0;\n  /* 5. */\n  ext_obj_p->u.cls.u1.iterator_kind = (uint8_t) kind;\n\n  /* 6. */\n  return ecma_make_object_value (object_p);\n} /* ecma_op_create_iterator_object */\n\n/**\n * GetIterator operation\n *\n * See also: ECMA-262 v10, 7.4.1\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator object - if success\n *         raised error - otherwise\n */\necma_value_t\necma_op_get_iterator (ecma_value_t value, /**< value to get iterator from */\n                      ecma_value_t method, /**< provided method argument */\n                      ecma_value_t *next_method_p) /**< [out] next method */\n{\n  JERRY_ASSERT (next_method_p != NULL);\n  *next_method_p = ECMA_VALUE_UNDEFINED;\n\n  /* 1. */\n  if (ECMA_IS_VALUE_ERROR (value))\n  {\n    return value;\n  }\n\n  bool use_default_method = false;\n\n  /* 2. */\n  if (method == ECMA_VALUE_SYNC_ITERATOR)\n  {\n    /* 2.a */\n    use_default_method = true;\n    method = ecma_op_get_method_by_symbol_id (value, LIT_GLOBAL_SYMBOL_ITERATOR);\n\n    /* 2.b */\n    if (ECMA_IS_VALUE_ERROR (method))\n    {\n      return method;\n    }\n  }\n  /* 3.a */\n  else if (method == ECMA_VALUE_ASYNC_ITERATOR)\n  {\n    use_default_method = true;\n\n    /* 3.a.i */\n    method = ecma_op_get_method_by_symbol_id (value, LIT_GLOBAL_SYMBOL_ASYNC_ITERATOR);\n\n    if (ECMA_IS_VALUE_ERROR (method))\n    {\n      return method;\n    }\n\n    /* 3.a.ii */\n\n    if (ecma_is_value_undefined (method))\n    {\n      method = ecma_op_get_method_by_symbol_id (value, LIT_GLOBAL_SYMBOL_ITERATOR);\n\n      if (ECMA_IS_VALUE_ERROR (method))\n      {\n        return method;\n      }\n\n      ecma_value_t sync_next_method;\n      ecma_value_t sync_iterator = ecma_op_get_iterator (value, method, &sync_next_method);\n\n      if (ECMA_IS_VALUE_ERROR (sync_iterator))\n      {\n        ecma_free_value (method);\n        return sync_iterator;\n      }\n\n      ecma_value_t async_iterator =\n        ecma_op_create_async_from_sync_iterator (sync_iterator, sync_next_method, next_method_p);\n\n      ecma_free_value (method);\n      ecma_free_value (sync_iterator);\n      ecma_free_value (sync_next_method);\n\n      return async_iterator;\n    }\n  }\n\n  /* 3. */\n  ecma_value_t iterator = ecma_op_function_validated_call (method, value, NULL, 0);\n\n  if (use_default_method)\n  {\n    ecma_free_value (method);\n  }\n\n  /* 4. */\n  if (ECMA_IS_VALUE_ERROR (iterator))\n  {\n    return iterator;\n  }\n\n  /* 5. */\n  if (!ecma_is_value_object (iterator))\n  {\n    ecma_free_value (iterator);\n    return ecma_raise_type_error (ECMA_ERR_ITERATOR_IS_NOT_AN_OBJECT);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (iterator);\n  ecma_value_t next_method = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_NEXT);\n\n  if (ECMA_IS_VALUE_ERROR (next_method))\n  {\n    ecma_free_value (iterator);\n    return next_method;\n  }\n\n  if (ecma_op_is_callable (next_method))\n  {\n    *next_method_p = next_method;\n  }\n  else\n  {\n    ecma_free_value (next_method);\n  }\n\n  /* 6. */\n  return iterator;\n} /* ecma_op_get_iterator */\n\n/**\n * IteratorNext operation\n *\n * See also: ECMA-262 v10, 7.4.2\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator result object - if success\n *         raised error - otherwise\n */\necma_value_t\necma_op_iterator_next (ecma_value_t iterator, /**< iterator value */\n                       ecma_value_t next_method, /**< next method */\n                       ecma_value_t value) /**< the routines's value argument */\n{\n  JERRY_ASSERT (ecma_is_value_object (iterator));\n\n  /* 1 - 2. */\n  if (next_method == ECMA_VALUE_UNDEFINED)\n  {\n    return ecma_raise_type_error (ECMA_ERR_ITERATOR_NEXT_IS_NOT_CALLABLE);\n  }\n\n  ecma_object_t *next_method_obj_p = ecma_get_object_from_value (next_method);\n\n  bool has_value = !ecma_is_value_empty (value);\n\n  if (has_value)\n  {\n    return ecma_op_function_call (next_method_obj_p, iterator, &value, 1);\n  }\n\n  return ecma_op_function_call (next_method_obj_p, iterator, NULL, 0);\n} /* ecma_op_iterator_next */\n\n/**\n * IteratorReturn operation\n *\n * See also: ECMA-262 v6, 14.4.14 (last part)\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator result object - if success\n *         raised error - otherwise\n */\nstatic ecma_value_t\necma_op_iterator_return (ecma_value_t iterator, /**< iterator value */\n                         ecma_value_t value) /**< the routines's value argument */\n{\n  JERRY_ASSERT (ecma_is_value_object (iterator));\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (iterator);\n  ecma_value_t func_return = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_RETURN);\n\n  if (ECMA_IS_VALUE_ERROR (func_return))\n  {\n    return func_return;\n  }\n\n  if (func_return == ECMA_VALUE_UNDEFINED)\n  {\n    return ecma_create_iter_result_object (value, ECMA_VALUE_TRUE);\n  }\n\n  ecma_value_t result = ecma_op_function_validated_call (func_return, iterator, &value, 1);\n  ecma_free_value (func_return);\n\n  return result;\n} /* ecma_op_iterator_return */\n\n/**\n * IteratorThrow operation\n *\n * See also: ECMA-262 v6, 14.4.14 (last part)\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator result object - if success\n *         raised error - otherwise\n */\nstatic ecma_value_t\necma_op_iterator_throw (ecma_value_t iterator, /**< iterator value */\n                        ecma_value_t value) /**< the routines's value argument */\n{\n  JERRY_ASSERT (ecma_is_value_object (iterator));\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (iterator);\n  ecma_value_t func_throw = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_THROW);\n\n  if (ECMA_IS_VALUE_ERROR (func_throw))\n  {\n    return func_throw;\n  }\n\n  if (func_throw == ECMA_VALUE_UNDEFINED)\n  {\n    ecma_value_t result = ecma_op_iterator_close (iterator);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      return result;\n    }\n\n    ecma_free_value (result);\n    return ecma_raise_type_error (ECMA_ERR_ITERATOR_THROW_IS_NOT_AVAILABLE);\n  }\n\n  ecma_value_t result = ecma_op_function_validated_call (func_throw, iterator, &value, 1);\n  ecma_free_value (func_throw);\n\n  return result;\n} /* ecma_op_iterator_throw */\n\n/**\n * IteratorComplete operation\n *\n * See also: ECMA-262 v10, 7.4.3\n *\n * @return true/false - whether the iteration ended\n */\necma_value_t\necma_op_iterator_complete (ecma_value_t iter_result) /**< iterator value */\n{\n  /* 1. */\n  JERRY_ASSERT (ecma_is_value_object (iter_result));\n\n  /* 2. */\n  ecma_object_t *obj_p = ecma_get_object_from_value (iter_result);\n\n  ecma_value_t done = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_DONE);\n\n  if (ECMA_IS_VALUE_ERROR (done))\n  {\n    return done;\n  }\n\n  ecma_value_t res = ecma_make_boolean_value (ecma_op_to_boolean (done));\n  ecma_free_value (done);\n\n  return res;\n} /* ecma_op_iterator_complete */\n\n/**\n * IteratorValue operation\n *\n * See also: ECMA-262 v6, 7.4.4\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return value of the iterator result object\n */\necma_value_t\necma_op_iterator_value (ecma_value_t iter_result) /**< iterator value */\n{\n  /* 1. */\n  JERRY_ASSERT (ecma_is_value_object (iter_result));\n\n  /* 2. */\n  ecma_object_t *obj_p = ecma_get_object_from_value (iter_result);\n  return ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_VALUE);\n} /* ecma_op_iterator_value */\n\n/**\n * IteratorClose operation\n *\n * See also: ECMA-262 v6, 7.4.6\n *\n * @return ECMA_VALUE_EMPTY - if \"return\" is succesfully invoked,\n *                            and the operation is called with normal completion\n *         ECMA_VALUE_ERROR - otherwise\n */\necma_value_t\necma_op_iterator_close (ecma_value_t iterator) /**< iterator value */\n{\n  /* 1. */\n  JERRY_ASSERT (ecma_is_value_object (iterator));\n\n  /* 2. */\n  ecma_value_t completion = ECMA_VALUE_EMPTY;\n\n  if (jcontext_has_pending_exception ())\n  {\n    completion = jcontext_take_exception ();\n  }\n\n  /* 3. */\n  ecma_value_t return_method = ecma_op_get_method_by_magic_id (iterator, LIT_MAGIC_STRING_RETURN);\n\n  /* 4. */\n  if (ECMA_IS_VALUE_ERROR (return_method))\n  {\n    ecma_free_value (completion);\n    return return_method;\n  }\n\n  /* 5. */\n  if (ecma_is_value_undefined (return_method))\n  {\n    if (ecma_is_value_empty (completion))\n    {\n      return ECMA_VALUE_UNDEFINED;\n    }\n\n    jcontext_raise_exception (completion);\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 6. */\n  ecma_object_t *return_obj_p = ecma_get_object_from_value (return_method);\n  ecma_value_t inner_result = ecma_op_function_call (return_obj_p, iterator, NULL, 0);\n  ecma_deref_object (return_obj_p);\n\n  /* 7. */\n  if (!ecma_is_value_empty (completion))\n  {\n    if (ECMA_IS_VALUE_ERROR (inner_result))\n    {\n      jcontext_release_exception ();\n    }\n    else\n    {\n      ecma_free_value (inner_result);\n    }\n\n    jcontext_raise_exception (completion);\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* 8. */\n  if (ECMA_IS_VALUE_ERROR (inner_result))\n  {\n    ecma_free_value (completion);\n    return inner_result;\n  }\n\n  /* 9. */\n  bool is_object = ecma_is_value_object (inner_result);\n  ecma_free_value (inner_result);\n\n  if (!is_object)\n  {\n    ecma_free_value (completion);\n    return ecma_raise_type_error (ECMA_ERR_METHOD_RETURN_IS_NOT_CALLABLE);\n  }\n\n  /* 10. */\n  if (ecma_is_value_empty (completion))\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  jcontext_raise_exception (completion);\n  return ECMA_VALUE_ERROR;\n} /* ecma_op_iterator_close */\n\n/**\n * IteratorStep operation\n *\n * See also: ECMA-262 v6, 7.4.5\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator object or ECMA_VALUE_FALSE - if success\n *         raised error - otherwise\n */\necma_value_t\necma_op_iterator_step (ecma_value_t iterator, /**< iterator value */\n                       ecma_value_t next_method) /**< next method */\n{\n  /* 1. */\n  ecma_value_t result = ecma_op_iterator_next (iterator, next_method, ECMA_VALUE_EMPTY);\n\n  /* 2. */\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  if (!ecma_is_value_object (result))\n  {\n    ecma_free_value (result);\n    return ecma_raise_type_error (ECMA_ERR_ITERATOR_RESULT_IS_NOT_AN_OBJECT);\n  }\n\n  /* 3. */\n  ecma_object_t *obj_p = ecma_get_object_from_value (result);\n  ecma_value_t done = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_DONE);\n\n  /* 4. */\n  if (ECMA_IS_VALUE_ERROR (done))\n  {\n    ecma_free_value (result);\n    return done;\n  }\n\n  bool is_done = ecma_op_to_boolean (done);\n  ecma_free_value (done);\n\n  /* 5. */\n  if (is_done)\n  {\n    ecma_free_value (result);\n    return ECMA_VALUE_FALSE;\n  }\n\n  /* 6. */\n  return result;\n} /* ecma_op_iterator_step */\n\n/**\n * Perform a command specified by the command argument\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator object - if success\n *         raised error - otherwise\n */\necma_value_t\necma_op_iterator_do (ecma_iterator_command_type_t command, /**< command to be executed */\n                     ecma_value_t iterator, /**< iterator object */\n                     ecma_value_t next_method, /**< next method */\n                     ecma_value_t value, /**< the routines's value argument */\n                     bool *done_p) /**< it contains the logical value of the done property */\n{\n  ecma_value_t result;\n\n  if (command == ECMA_ITERATOR_NEXT)\n  {\n    result = ecma_op_iterator_next (iterator, next_method, value);\n  }\n  else if (command == ECMA_ITERATOR_THROW)\n  {\n    result = ecma_op_iterator_throw (iterator, value);\n  }\n  else\n  {\n    JERRY_ASSERT (command == ECMA_ITERATOR_RETURN);\n    result = ecma_op_iterator_return (iterator, value);\n  }\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  if (!ecma_is_value_object (result))\n  {\n    ecma_free_value (result);\n    return ecma_raise_type_error (ECMA_ERR_ITERATOR_RESULT_IS_NOT_AN_OBJECT);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (result);\n  ecma_value_t done = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_DONE);\n\n  if (ECMA_IS_VALUE_ERROR (done))\n  {\n    ecma_free_value (result);\n    return done;\n  }\n\n  *done_p = ecma_op_to_boolean (done);\n  ecma_free_value (done);\n\n  return result;\n} /* ecma_op_iterator_do */\n\n/**\n * CreateAsyncFromSyncIterator operation\n *\n * See also: ECMA-262 v10, 25.1.4.1\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return async from sync iterator object\n */\necma_value_t\necma_op_create_async_from_sync_iterator (ecma_value_t sync_iterator, /**< sync iterator */\n                                         ecma_value_t sync_next_method, /**< sync iterator next method */\n                                         ecma_value_t *async_next_method_p) /**< [out] async next method */\n{\n  JERRY_ASSERT (ecma_is_value_object (sync_iterator));\n  JERRY_ASSERT (ecma_is_value_object (sync_next_method) || ecma_is_value_undefined (sync_next_method));\n\n  /* 1. */\n  ecma_object_t *obj_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_ASYNC_FROM_SYNC_ITERATOR_PROTOTYPE),\n                                             sizeof (ecma_async_from_sync_iterator_object_t),\n                                             ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_async_from_sync_iterator_object_t *ext_obj_p = (ecma_async_from_sync_iterator_object_t *) obj_p;\n\n  /* 2. */\n  ext_obj_p->sync_next_method = sync_next_method;\n  ext_obj_p->header.u.cls.u3.sync_iterator = sync_iterator;\n  ext_obj_p->header.u.cls.type = ECMA_OBJECT_CLASS_ASYNC_FROM_SYNC_ITERATOR;\n\n  /* 3. */\n  *async_next_method_p = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_NEXT);\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (*async_next_method_p));\n\n  /* 4. */\n  return ecma_make_object_value (obj_p);\n} /* ecma_op_create_async_from_sync_iterator */\n\n/**\n * Async-from-Sync Iterator Value Unwrap Functions\n *\n * See also: ES11 25.1.4.2.4\n *\n * @return iterator result object\n */\necma_value_t\necma_async_from_sync_iterator_unwrap_cb (ecma_object_t *function_obj_p, /**< function object */\n                                         const ecma_value_t args_p[], /**< argument list */\n                                         const uint32_t args_count) /**< argument number */\n{\n  ecma_extended_object_t *unwrap_p = (ecma_extended_object_t *) function_obj_p;\n\n  /* 2. */\n  ecma_value_t arg = args_count > 0 ? args_p[0] : ECMA_VALUE_UNDEFINED;\n  ecma_value_t done =\n    ecma_make_boolean_value (unwrap_p->u.built_in.u2.routine_flags >> ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT);\n\n  return ecma_create_iter_result_object (arg, done);\n} /* ecma_async_from_sync_iterator_unwrap_cb */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-iterator-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_ITERATOR_OBJECT_H\n#define ECMA_ITERATOR_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaiteratorobject ECMA iterator object related routines\n * @{\n */\n\n/**\n * Generator resume execution flags.\n */\ntypedef enum\n{\n  ECMA_ITERATOR_NEXT, /**< generator should continue its execution */\n  ECMA_ITERATOR_THROW, /**< generator should perform a throw operation */\n  ECMA_ITERATOR_RETURN, /**< generator should perform a return operation */\n} ecma_iterator_command_type_t;\n\n/**\n * Maximum value of [[%Iterator%NextIndex]] until it can be stored\n * in an ecma pseudo array object structure element.\n */\n#define ECMA_ITERATOR_INDEX_LIMIT UINT16_MAX\n\necma_value_t ecma_op_create_iterator_object (ecma_value_t iterated_value,\n                                             ecma_object_t *prototype_obj_p,\n                                             ecma_object_class_type_t iterator_type,\n                                             ecma_iterator_kind_t kind);\n\necma_value_t ecma_create_iter_result_object (ecma_value_t value, ecma_value_t done);\n\necma_value_t ecma_create_array_from_iter_element (ecma_value_t value, ecma_value_t index_value);\n\necma_value_t ecma_op_get_iterator (ecma_value_t value, ecma_value_t method, ecma_value_t *next_method_p);\n\necma_value_t ecma_op_iterator_complete (ecma_value_t iter_result);\n\necma_value_t ecma_op_iterator_value (ecma_value_t iter_result);\n\necma_value_t ecma_op_iterator_next (ecma_value_t iterator, ecma_value_t next_method, ecma_value_t value);\n\necma_value_t ecma_op_iterator_close (ecma_value_t iterator);\n\necma_value_t ecma_op_iterator_step (ecma_value_t iterator, ecma_value_t next_method);\n\necma_value_t ecma_op_iterator_do (ecma_iterator_command_type_t command,\n                                  ecma_value_t iterator,\n                                  ecma_value_t next_method,\n                                  ecma_value_t value,\n                                  bool *done_p);\n\necma_value_t ecma_op_create_async_from_sync_iterator (ecma_value_t sync_iterator,\n                                                      ecma_value_t sync_next_method,\n                                                      ecma_value_t *async_next_method_p);\n\necma_value_t ecma_async_from_sync_iterator_unwrap_cb (ecma_object_t *function_obj_p,\n                                                      const ecma_value_t args_p[],\n                                                      const uint32_t args_count);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_ITERATOR_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-jobqueue.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-jobqueue.h\"\n\n#include \"ecma-async-generator-object.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-promise-object.h\"\n\n#include \"jcontext.h\"\n#include \"opcodes.h\"\n#include \"vm-stack.h\"\n\n/**\n * Mask for job queue type.\n */\n#define ECMA_JOB_QUEURE_TYPE_MASK ((uintptr_t) 0x07)\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmajobqueue ECMA Job Queue related routines\n * @{\n */\n\n/**\n * Description of the PromiseReactionJob\n */\ntypedef struct\n{\n  ecma_job_queue_item_t header; /**< job queue item header */\n  ecma_value_t capability; /**< capability object */\n  ecma_value_t handler; /**< handler function */\n  ecma_value_t argument; /**< argument for the reaction */\n} ecma_job_promise_reaction_t;\n\n/**\n * Description of the PromiseAsyncReactionJob\n */\ntypedef struct\n{\n  ecma_job_queue_item_t header; /**< job queue item header */\n  ecma_value_t executable_object; /**< executable object */\n  ecma_value_t argument; /**< argument for the reaction */\n} ecma_job_promise_async_reaction_t;\n\n/**\n * Description of the PromiseAsyncGeneratorJob\n */\ntypedef struct\n{\n  ecma_job_queue_item_t header; /**< job queue item header */\n  ecma_value_t executable_object; /**< executable object */\n} ecma_job_promise_async_generator_t;\n\n/**\n * Description of the PromiseResolveThenableJob\n */\ntypedef struct\n{\n  ecma_job_queue_item_t header; /**< job queue item header */\n  ecma_value_t promise; /**< promise to be resolved */\n  ecma_value_t thenable; /**< thenable object */\n  ecma_value_t then; /**< 'then' function */\n} ecma_job_promise_resolve_thenable_t;\n\n/**\n * Initialize the jobqueue.\n */\nvoid\necma_job_queue_init (void)\n{\n  JERRY_CONTEXT (job_queue_head_p) = NULL;\n  JERRY_CONTEXT (job_queue_tail_p) = NULL;\n} /* ecma_job_queue_init */\n\n/**\n * Get the type of the job.\n *\n * @return type of the job\n */\nstatic inline ecma_job_queue_item_type_t JERRY_ATTR_ALWAYS_INLINE\necma_job_queue_get_type (ecma_job_queue_item_t *job_p) /**< the job */\n{\n  return (ecma_job_queue_item_type_t) (job_p->next_and_type & ECMA_JOB_QUEURE_TYPE_MASK);\n} /* ecma_job_queue_get_type */\n\n/**\n * Get the next job of the job queue.\n *\n * @return next job\n */\nstatic inline ecma_job_queue_item_t *JERRY_ATTR_ALWAYS_INLINE\necma_job_queue_get_next (ecma_job_queue_item_t *job_p) /**< the job */\n{\n  return (ecma_job_queue_item_t *) (job_p->next_and_type & ~ECMA_JOB_QUEURE_TYPE_MASK);\n} /* ecma_job_queue_get_next */\n\n/**\n * Free the heap and the member of the PromiseReactionJob.\n */\nstatic void\necma_free_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< points to the PromiseReactionJob */\n{\n  JERRY_ASSERT (job_p != NULL);\n\n  ecma_free_value (job_p->capability);\n  ecma_free_value (job_p->handler);\n  ecma_free_value (job_p->argument);\n\n  jmem_heap_free_block (job_p, sizeof (ecma_job_promise_reaction_t));\n} /* ecma_free_promise_reaction_job */\n\n/**\n * Free the heap and the member of the PromiseAsyncReactionJob.\n */\nstatic void\necma_free_promise_async_reaction_job (ecma_job_promise_async_reaction_t *job_p) /**< points to the\n                                                                                 *   PromiseAsyncReactionJob */\n{\n  JERRY_ASSERT (job_p != NULL);\n\n  ecma_free_value (job_p->executable_object);\n  ecma_free_value (job_p->argument);\n\n  jmem_heap_free_block (job_p, sizeof (ecma_job_promise_async_reaction_t));\n} /* ecma_free_promise_async_reaction_job */\n\n/**\n * Free the heap and the member of the PromiseAsyncGeneratorJob.\n */\nstatic void\necma_free_promise_async_generator_job (ecma_job_promise_async_generator_t *job_p) /**< points to the\n                                                                                   *   PromiseAsyncReactionJob */\n{\n  JERRY_ASSERT (job_p != NULL);\n\n  ecma_free_value (job_p->executable_object);\n\n  jmem_heap_free_block (job_p, sizeof (ecma_job_promise_async_generator_t));\n} /* ecma_free_promise_async_generator_job */\n\n/**\n * Free the heap and the member of the PromiseResolveThenableJob.\n */\nstatic void\necma_free_promise_resolve_thenable_job (ecma_job_promise_resolve_thenable_t *job_p) /**< points to the\n                                                                                     *   PromiseResolveThenableJob */\n{\n  JERRY_ASSERT (job_p != NULL);\n\n  ecma_free_value (job_p->promise);\n  ecma_free_value (job_p->thenable);\n  ecma_free_value (job_p->then);\n\n  jmem_heap_free_block (job_p, sizeof (ecma_job_promise_resolve_thenable_t));\n} /* ecma_free_promise_resolve_thenable_job */\n\n/**\n * The processor for PromiseReactionJob.\n *\n * See also: ES2015 25.4.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t\necma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the job to be operated */\n{\n  /* 2. */\n  JERRY_ASSERT (\n    ecma_object_class_is (ecma_get_object_from_value (job_p->capability), ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));\n  ecma_promise_capabality_t *capability_p;\n  capability_p = (ecma_promise_capabality_t *) ecma_get_object_from_value (job_p->capability);\n\n#if JERRY_PROMISE_CALLBACK\n  if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_REACTION_JOB))\n  {\n    JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n    JERRY_CONTEXT (promise_callback)\n    (JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB,\n     capability_p->header.u.cls.u3.promise,\n     ECMA_VALUE_UNDEFINED,\n     JERRY_CONTEXT (promise_callback_user_p));\n  }\n#endif /* JERRY_PROMISE_CALLBACK */\n\n  /* 3. */\n  ecma_value_t handler = job_p->handler;\n\n  JERRY_ASSERT (ecma_is_value_boolean (handler) || ecma_op_is_callable (handler));\n\n  ecma_value_t handler_result;\n\n  if (ecma_is_value_boolean (handler))\n  {\n    /* 4-5. True indicates \"identity\" and false indicates \"thrower\" */\n    handler_result = ecma_copy_value (job_p->argument);\n  }\n  else\n  {\n    /* 6. */\n    handler_result =\n      ecma_op_function_call (ecma_get_object_from_value (handler), ECMA_VALUE_UNDEFINED, &(job_p->argument), 1);\n  }\n\n  ecma_value_t status;\n\n  if (ecma_is_value_false (handler) || ECMA_IS_VALUE_ERROR (handler_result))\n  {\n    if (ECMA_IS_VALUE_ERROR (handler_result))\n    {\n      handler_result = jcontext_take_exception ();\n    }\n\n    /* 7. */\n    status = ecma_op_function_call (ecma_get_object_from_value (capability_p->reject),\n                                    ECMA_VALUE_UNDEFINED,\n                                    &handler_result,\n                                    1);\n  }\n  else\n  {\n    /* 8. */\n    status = ecma_op_function_call (ecma_get_object_from_value (capability_p->resolve),\n                                    ECMA_VALUE_UNDEFINED,\n                                    &handler_result,\n                                    1);\n  }\n\n  ecma_free_value (handler_result);\n\n#if JERRY_PROMISE_CALLBACK\n  if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_REACTION_JOB))\n  {\n    JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n    JERRY_CONTEXT (promise_callback)\n    (JERRY_PROMISE_EVENT_AFTER_REACTION_JOB,\n     capability_p->header.u.cls.u3.promise,\n     ECMA_VALUE_UNDEFINED,\n     JERRY_CONTEXT (promise_callback_user_p));\n  }\n#endif /* JERRY_PROMISE_CALLBACK */\n\n  ecma_free_promise_reaction_job (job_p);\n\n  return status;\n} /* ecma_process_promise_reaction_job */\n\n/**\n * The processor for PromiseAsyncReactionJob.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t\necma_process_promise_async_reaction_job (ecma_job_promise_async_reaction_t *job_p) /**< the job to be operated */\n{\n#if JERRY_PROMISE_CALLBACK\n  if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ASYNC_REACTION_JOB))\n  {\n    jerry_promise_event_type_t type = JERRY_PROMISE_EVENT_ASYNC_BEFORE_RESOLVE;\n\n    if (ecma_job_queue_get_type (&job_p->header) == ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED)\n    {\n      type = JERRY_PROMISE_EVENT_ASYNC_BEFORE_REJECT;\n    }\n\n    JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n    JERRY_CONTEXT (promise_callback)\n    (type, job_p->executable_object, job_p->argument, JERRY_CONTEXT (promise_callback_user_p));\n  }\n#endif /* JERRY_PROMISE_CALLBACK */\n\n  ecma_object_t *object_p = ecma_get_object_from_value (job_p->executable_object);\n  vm_executable_object_t *executable_object_p = (vm_executable_object_t *) object_p;\n\n  if (ecma_job_queue_get_type (&job_p->header) == ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED)\n  {\n    if (!(executable_object_p->extended_object.u.cls.u2.executable_obj_flags\n          & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD))\n    {\n      executable_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_throw;\n    }\n    else if (ECMA_AWAIT_GET_STATE (executable_object_p) == ECMA_AWAIT_YIELD_RETURN)\n    {\n      /* Unlike other operations, return captures rejected promises as well. */\n      ECMA_AWAIT_CHANGE_STATE (executable_object_p, YIELD_RETURN, YIELD_OPERATION);\n    }\n    else\n    {\n      if (ECMA_AWAIT_GET_STATE (executable_object_p) <= ECMA_AWAIT_YIELD_END)\n      {\n        JERRY_ASSERT (ecma_is_value_object (executable_object_p->iterator));\n        executable_object_p->iterator = ECMA_VALUE_UNDEFINED;\n\n        JERRY_ASSERT (executable_object_p->frame_ctx.stack_top_p[-1] == ECMA_VALUE_UNDEFINED\n                      || ecma_is_value_object (executable_object_p->frame_ctx.stack_top_p[-1]));\n        executable_object_p->frame_ctx.stack_top_p--;\n      }\n      else if (ECMA_AWAIT_GET_STATE (executable_object_p) == ECMA_AWAIT_FOR_CLOSE\n               && VM_GET_CONTEXT_TYPE (executable_object_p->frame_ctx.stack_top_p[-1]) == VM_CONTEXT_FINALLY_THROW)\n      {\n        ecma_free_value (job_p->argument);\n        job_p->argument = ecma_copy_value (executable_object_p->frame_ctx.stack_top_p[-2]);\n      }\n\n      /* Exception: Abort iterators, clear all status. */\n      executable_object_p->extended_object.u.cls.u2.executable_obj_flags &= ECMA_AWAIT_CLEAR_MASK;\n      executable_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_throw;\n    }\n  }\n\n  ecma_value_t result;\n\n  if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)\n  {\n    job_p->argument = ecma_await_continue (executable_object_p, job_p->argument);\n\n    if (ECMA_IS_VALUE_ERROR (job_p->argument))\n    {\n      job_p->argument = jcontext_take_exception ();\n      executable_object_p->frame_ctx.byte_code_p = opfunc_resume_executable_object_with_throw;\n    }\n    else if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags\n             & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)\n    {\n      /* Continue iteration. */\n      JERRY_ASSERT (job_p->argument == ECMA_VALUE_UNDEFINED);\n      result = ECMA_VALUE_UNDEFINED;\n      goto free_job;\n    }\n\n    if (ECMA_AWAIT_GET_STATE (executable_object_p) <= ECMA_AWAIT_YIELD_END)\n    {\n      JERRY_ASSERT (ecma_is_value_object (executable_object_p->iterator));\n      executable_object_p->iterator = ECMA_VALUE_UNDEFINED;\n\n      JERRY_ASSERT (executable_object_p->frame_ctx.stack_top_p[-1] == ECMA_VALUE_UNDEFINED\n                    || ecma_is_value_object (executable_object_p->frame_ctx.stack_top_p[-1]));\n      executable_object_p->frame_ctx.stack_top_p--;\n    }\n\n    /* Clear all status. */\n    executable_object_p->extended_object.u.cls.u2.executable_obj_flags &= ECMA_AWAIT_CLEAR_MASK;\n  }\n\n  result = opfunc_resume_executable_object (executable_object_p, job_p->argument);\n  /* Argument reference has been taken by opfunc_resume_executable_object. */\n  job_p->argument = ECMA_VALUE_UNDEFINED;\n\n  const uint16_t expected_bits = (ECMA_EXECUTABLE_OBJECT_COMPLETED | ECMA_ASYNC_GENERATOR_CALLED);\n  if ((executable_object_p->extended_object.u.cls.u2.executable_obj_flags & expected_bits) == expected_bits)\n  {\n    ecma_async_generator_finalize (executable_object_p, result);\n    result = ECMA_VALUE_UNDEFINED;\n  }\n\nfree_job:\n\n#if JERRY_PROMISE_CALLBACK\n  if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ASYNC_REACTION_JOB))\n  {\n    jerry_promise_event_type_t type = JERRY_PROMISE_EVENT_ASYNC_AFTER_RESOLVE;\n\n    if (ecma_job_queue_get_type (&job_p->header) == ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED)\n    {\n      type = JERRY_PROMISE_EVENT_ASYNC_AFTER_REJECT;\n    }\n\n    JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n    JERRY_CONTEXT (promise_callback)\n    (type, job_p->executable_object, job_p->argument, JERRY_CONTEXT (promise_callback_user_p));\n  }\n#endif /* JERRY_PROMISE_CALLBACK */\n\n  ecma_free_promise_async_reaction_job (job_p);\n  return result;\n} /* ecma_process_promise_async_reaction_job */\n\n/**\n * The processor for PromiseAsyncGeneratorJob.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t\necma_process_promise_async_generator_job (ecma_job_promise_async_generator_t *job_p) /**< the job to be operated */\n{\n  ecma_object_t *object_p = ecma_get_object_from_value (job_p->executable_object);\n\n  ecma_value_t result = ecma_async_generator_run ((vm_executable_object_t *) object_p);\n\n  ecma_free_value (job_p->executable_object);\n  jmem_heap_free_block (job_p, sizeof (ecma_job_promise_async_generator_t));\n  return result;\n} /* ecma_process_promise_async_generator_job */\n\n/**\n * Process the PromiseResolveThenableJob.\n *\n * See also: ES2015 25.4.2.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t\necma_process_promise_resolve_thenable_job (ecma_job_promise_resolve_thenable_t *job_p) /**< the job to be operated */\n{\n  ecma_promise_object_t *promise_p = (ecma_promise_object_t *) ecma_get_object_from_value (job_p->promise);\n\n  promise_p->header.u.cls.u1.promise_flags &= (uint8_t) ~ECMA_PROMISE_ALREADY_RESOLVED;\n\n  ecma_value_t ret = ecma_promise_run_executor ((ecma_object_t *) promise_p, job_p->then, job_p->thenable);\n\n  if (ECMA_IS_VALUE_ERROR (ret))\n  {\n    ret = jcontext_take_exception ();\n    ecma_reject_promise_with_checks (job_p->promise, ret);\n    ecma_free_value (ret);\n    ret = ECMA_VALUE_UNDEFINED;\n  }\n\n  ecma_free_promise_resolve_thenable_job (job_p);\n\n  return ret;\n} /* ecma_process_promise_resolve_thenable_job */\n\n/**\n * Enqueue a Promise job into the jobqueue.\n */\nstatic void\necma_enqueue_job (ecma_job_queue_item_t *job_p) /**< the job */\n{\n  JERRY_ASSERT (job_p->next_and_type <= ECMA_JOB_QUEURE_TYPE_MASK);\n\n  if (JERRY_CONTEXT (job_queue_head_p) == NULL)\n  {\n    JERRY_CONTEXT (job_queue_head_p) = job_p;\n    JERRY_CONTEXT (job_queue_tail_p) = job_p;\n  }\n  else\n  {\n    JERRY_ASSERT ((JERRY_CONTEXT (job_queue_tail_p)->next_and_type & ~ECMA_JOB_QUEURE_TYPE_MASK) == 0);\n\n    JERRY_CONTEXT (job_queue_tail_p)->next_and_type |= (uintptr_t) job_p;\n    JERRY_CONTEXT (job_queue_tail_p) = job_p;\n  }\n} /* ecma_enqueue_job */\n\n/**\n * Enqueue a PromiseReactionJob into the job queue.\n */\nvoid\necma_enqueue_promise_reaction_job (ecma_value_t capability, /**< capability object */\n                                   ecma_value_t handler, /**< handler function */\n                                   ecma_value_t argument) /**< argument for the reaction */\n{\n  ecma_job_promise_reaction_t *job_p;\n  job_p = (ecma_job_promise_reaction_t *) jmem_heap_alloc_block (sizeof (ecma_job_promise_reaction_t));\n  job_p->header.next_and_type = ECMA_JOB_PROMISE_REACTION;\n  job_p->capability = ecma_copy_value (capability);\n  job_p->handler = ecma_copy_value (handler);\n  job_p->argument = ecma_copy_value (argument);\n\n  ecma_enqueue_job (&job_p->header);\n} /* ecma_enqueue_promise_reaction_job */\n\n/**\n * Enqueue a PromiseAsyncReactionJob into the job queue.\n */\nvoid\necma_enqueue_promise_async_reaction_job (ecma_value_t executable_object, /**< executable object */\n                                         ecma_value_t argument, /**< argument */\n                                         bool is_rejected) /**< is_fulfilled */\n{\n  ecma_job_promise_async_reaction_t *job_p;\n  job_p = (ecma_job_promise_async_reaction_t *) jmem_heap_alloc_block (sizeof (ecma_job_promise_async_reaction_t));\n  job_p->header.next_and_type =\n    (is_rejected ? ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED : ECMA_JOB_PROMISE_ASYNC_REACTION_FULFILLED);\n  job_p->executable_object = ecma_copy_value (executable_object);\n  job_p->argument = ecma_copy_value (argument);\n\n  ecma_enqueue_job (&job_p->header);\n} /* ecma_enqueue_promise_async_reaction_job */\n\n/**\n * Enqueue a PromiseAsyncGeneratorJob into the job queue.\n */\nvoid\necma_enqueue_promise_async_generator_job (ecma_value_t executable_object) /**< executable object */\n{\n  ecma_job_promise_async_generator_t *job_p;\n  job_p = (ecma_job_promise_async_generator_t *) jmem_heap_alloc_block (sizeof (ecma_job_promise_async_generator_t));\n  job_p->header.next_and_type = ECMA_JOB_PROMISE_ASYNC_GENERATOR;\n  job_p->executable_object = ecma_copy_value (executable_object);\n\n  ecma_enqueue_job (&job_p->header);\n} /* ecma_enqueue_promise_async_generator_job */\n\n/**\n * Enqueue a PromiseResolveThenableJob into the job queue.\n */\nvoid\necma_enqueue_promise_resolve_thenable_job (ecma_value_t promise, /**< promise to be resolved */\n                                           ecma_value_t thenable, /**< thenable object */\n                                           ecma_value_t then) /**< 'then' function */\n{\n  JERRY_ASSERT (ecma_is_promise (ecma_get_object_from_value (promise)));\n  JERRY_ASSERT (ecma_is_value_object (thenable));\n  JERRY_ASSERT (ecma_op_is_callable (then));\n\n  ecma_job_promise_resolve_thenable_t *job_p;\n  job_p = (ecma_job_promise_resolve_thenable_t *) jmem_heap_alloc_block (sizeof (ecma_job_promise_resolve_thenable_t));\n  job_p->header.next_and_type = ECMA_JOB_PROMISE_THENABLE;\n  job_p->promise = ecma_copy_value (promise);\n  job_p->thenable = ecma_copy_value (thenable);\n  job_p->then = ecma_copy_value (then);\n\n  ecma_enqueue_job (&job_p->header);\n} /* ecma_enqueue_promise_resolve_thenable_job */\n\n/**\n * Process enqueued Promise jobs until the first thrown error or until the\n * jobqueue becomes empty.\n *\n * @return result of the last processed job - if the jobqueue was non-empty,\n *         undefined - otherwise.\n */\necma_value_t\necma_process_all_enqueued_jobs (void)\n{\n  ecma_value_t ret = ECMA_VALUE_UNDEFINED;\n\n  while (JERRY_CONTEXT (job_queue_head_p) != NULL)\n  {\n    ecma_job_queue_item_t *job_p = JERRY_CONTEXT (job_queue_head_p);\n    JERRY_CONTEXT (job_queue_head_p) = ecma_job_queue_get_next (job_p);\n\n    ecma_fast_free_value (ret);\n\n    switch (ecma_job_queue_get_type (job_p))\n    {\n      case ECMA_JOB_PROMISE_REACTION:\n      {\n        ret = ecma_process_promise_reaction_job ((ecma_job_promise_reaction_t *) job_p);\n        break;\n      }\n      case ECMA_JOB_PROMISE_ASYNC_REACTION_FULFILLED:\n      case ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED:\n      {\n        ret = ecma_process_promise_async_reaction_job ((ecma_job_promise_async_reaction_t *) job_p);\n        break;\n      }\n      case ECMA_JOB_PROMISE_ASYNC_GENERATOR:\n      {\n        ret = ecma_process_promise_async_generator_job ((ecma_job_promise_async_generator_t *) job_p);\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (ecma_job_queue_get_type (job_p) == ECMA_JOB_PROMISE_THENABLE);\n\n        ret = ecma_process_promise_resolve_thenable_job ((ecma_job_promise_resolve_thenable_t *) job_p);\n        break;\n      }\n    }\n\n    if (ECMA_IS_VALUE_ERROR (ret))\n    {\n      return ret;\n    }\n  }\n\n  ecma_free_value (ret);\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_process_all_enqueued_jobs */\n\n/**\n * Release enqueued Promise jobs.\n */\nvoid\necma_free_all_enqueued_jobs (void)\n{\n  while (JERRY_CONTEXT (job_queue_head_p) != NULL)\n  {\n    ecma_job_queue_item_t *job_p = JERRY_CONTEXT (job_queue_head_p);\n    JERRY_CONTEXT (job_queue_head_p) = ecma_job_queue_get_next (job_p);\n\n    switch (ecma_job_queue_get_type (job_p))\n    {\n      case ECMA_JOB_PROMISE_REACTION:\n      {\n        ecma_free_promise_reaction_job ((ecma_job_promise_reaction_t *) job_p);\n        break;\n      }\n      case ECMA_JOB_PROMISE_ASYNC_REACTION_FULFILLED:\n      case ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED:\n      {\n        ecma_free_promise_async_reaction_job ((ecma_job_promise_async_reaction_t *) job_p);\n        break;\n      }\n      case ECMA_JOB_PROMISE_ASYNC_GENERATOR:\n      {\n        ecma_free_promise_async_generator_job ((ecma_job_promise_async_generator_t *) job_p);\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (ecma_job_queue_get_type (job_p) == ECMA_JOB_PROMISE_THENABLE);\n\n        ecma_free_promise_resolve_thenable_job ((ecma_job_promise_resolve_thenable_t *) job_p);\n        break;\n      }\n    }\n  }\n} /* ecma_free_all_enqueued_jobs */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-jobqueue.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_JOB_QUEUE_H\n#define ECMA_JOB_QUEUE_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmajobqueue ECMA Job Queue related routines\n * @{\n */\n\n/**\n * Job queue item types.\n */\ntypedef enum\n{\n  ECMA_JOB_PROMISE_REACTION, /**< promise reaction job */\n  ECMA_JOB_PROMISE_ASYNC_REACTION_FULFILLED, /**< fulfilled promise async reaction job */\n  ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED, /**< rejected promise async reaction job */\n  ECMA_JOB_PROMISE_ASYNC_GENERATOR, /**< continue async generator */\n  ECMA_JOB_PROMISE_THENABLE, /**< promise thenable job */\n} ecma_job_queue_item_type_t;\n\n/**\n * Description of the job queue item.\n */\ntypedef struct\n{\n  uintptr_t next_and_type; /**< next and type members of a queue item */\n} ecma_job_queue_item_t;\n\nvoid ecma_job_queue_init (void);\n\nvoid ecma_enqueue_promise_reaction_job (ecma_value_t capability, ecma_value_t handler, ecma_value_t argument);\nvoid ecma_enqueue_promise_async_reaction_job (ecma_value_t executable_object, ecma_value_t argument, bool is_rejected);\nvoid ecma_enqueue_promise_async_generator_job (ecma_value_t executable_object);\nvoid ecma_enqueue_promise_resolve_thenable_job (ecma_value_t promise, ecma_value_t thenable, ecma_value_t then);\nvoid ecma_free_all_enqueued_jobs (void);\n\necma_value_t ecma_process_all_enqueued_jobs (void);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_JOB_QUEUE_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-lex-env.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-lex-env.h\"\n\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-proxy-object.h\"\n\n#include \"jcontext.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup lexicalenvironment Lexical environment\n * @{\n *\n * \\addtogroup globallexicalenvironment Global lexical environment\n * @{\n */\n\n/**\n * Initialize Global environment\n */\nvoid\necma_init_global_environment (void)\n{\n  JERRY_CONTEXT (global_object_p) = ecma_builtin_create_global_object ();\n} /* ecma_init_global_environment */\n\n/**\n * Finalize Global environment\n */\nvoid\necma_finalize_global_environment (void)\n{\n  /* After this point the gc can free the global object, but the global_object_p pointer\n   * is not set to NULL because the global object might still be used before the free. */\n  ecma_deref_object ((ecma_object_t *) JERRY_CONTEXT (global_object_p));\n} /* ecma_finalize_global_environment */\n\n/**\n * Get reference to Global lexical environment\n * without increasing its reference count.\n *\n * @return pointer to the object's instance\n */\necma_object_t *\necma_get_global_environment (ecma_object_t *global_object_p) /**< global object */\n{\n  JERRY_ASSERT (global_object_p != NULL && ecma_builtin_is_global (global_object_p));\n  return ECMA_GET_NON_NULL_POINTER (ecma_object_t, ((ecma_global_object_t *) global_object_p)->global_env_cp);\n} /* ecma_get_global_environment */\n\n/**\n * Create the global lexical block on top of the global environment.\n */\nvoid\necma_create_global_lexical_block (ecma_object_t *global_object_p) /**< global object */\n{\n  JERRY_ASSERT (global_object_p != NULL && ecma_builtin_is_global (global_object_p));\n\n  ecma_global_object_t *real_global_object_p = (ecma_global_object_t *) global_object_p;\n\n  if (real_global_object_p->global_scope_cp == real_global_object_p->global_env_cp)\n  {\n    ecma_object_t *global_scope_p = ecma_create_decl_lex_env (ecma_get_global_environment (global_object_p));\n    global_scope_p->type_flags_refs |= ECMA_OBJECT_FLAG_BLOCK;\n    ECMA_SET_NON_NULL_POINTER (real_global_object_p->global_scope_cp, global_scope_p);\n    ecma_deref_object (global_scope_p);\n  }\n} /* ecma_create_global_lexical_block */\n\n/**\n * Raise the appropriate error when setting a binding is failed\n *\n * @return ECMA_VALUE_EMPTY or ECMA_VALUE_ERROR\n */\necma_value_t\necma_op_raise_set_binding_error (ecma_property_t *property_p, /**< property */\n                                 bool is_strict) /**< flag indicating strict mode */\n{\n  JERRY_UNUSED (property_p);\n\n  const ecma_property_t expected_bits = (ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_FLAG_ENUMERABLE);\n\n  if ((*property_p & expected_bits) == expected_bits)\n  {\n    ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n    if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))\n    {\n      return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);\n    }\n\n    JERRY_ASSERT (!ecma_is_property_writable (*property_p));\n\n    return ecma_raise_type_error (ECMA_ERR_CONSTANT_BINDINGS_CANNOT_BE_REASSIGNED);\n  }\n\n  if (is_strict)\n  {\n    return ecma_raise_type_error (ECMA_ERR_BINDING_CANNOT_SET);\n  }\n  return ECMA_VALUE_EMPTY;\n} /* ecma_op_raise_set_binding_error */\n\n/**\n * Get reference to Global lexical scope\n * without increasing its reference count.\n *\n * @return pointer to the object's instance\n */\necma_object_t *\necma_get_global_scope (ecma_object_t *global_object_p) /**< global object */\n{\n  JERRY_ASSERT (global_object_p != NULL && ecma_builtin_is_global (global_object_p));\n  return ECMA_GET_NON_NULL_POINTER (ecma_object_t, ((ecma_global_object_t *) global_object_p)->global_scope_cp);\n} /* ecma_get_global_scope */\n\n/**\n * @}\n */\n\n/**\n * HasBinding operation.\n *\n * See also: ECMA-262 v5, 10.2.1\n *\n * @return true / false\n */\necma_value_t\necma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */\n                     ecma_string_t *name_p) /**< argument N */\n{\n  JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));\n\n  ecma_lexical_environment_type_t lex_env_type = ecma_get_lex_env_type (lex_env_p);\n\n  switch (lex_env_type)\n  {\n    case ECMA_LEXICAL_ENVIRONMENT_CLASS:\n    {\n      if (!ECMA_LEX_ENV_CLASS_IS_MODULE (lex_env_p))\n      {\n        return ECMA_VALUE_FALSE;\n      }\n      /* FALLTHRU */\n    }\n    case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:\n    {\n      ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n      return ecma_make_boolean_value (property_p != NULL);\n    }\n    default:\n    {\n      JERRY_ASSERT (lex_env_type == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n\n      ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);\n\n      return ecma_op_object_has_property (binding_obj_p, name_p);\n    }\n  }\n} /* ecma_op_has_binding */\n\n/**\n * CreateMutableBinding operation.\n *\n * See also: ECMA-262 v5, 10.2.1\n *\n * @return ECMA_PROPERTY_POINTER_ERROR - if the operation raises error\n *         pointer to the created property - if the binding was created into a declerative environment\n *         NULL - otherwise\n */\necma_property_t *\necma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */\n                                ecma_string_t *name_p, /**< argument N */\n                                bool is_deletable) /**< argument D */\n{\n  JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));\n  JERRY_ASSERT (name_p != NULL);\n\n  if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n  {\n    uint8_t prop_attributes = ECMA_PROPERTY_FLAG_WRITABLE;\n\n    if (is_deletable)\n    {\n      prop_attributes = (uint8_t) (prop_attributes | ECMA_PROPERTY_FLAG_CONFIGURABLE);\n    }\n\n    ecma_property_t *prop_p;\n\n    ecma_create_named_data_property (lex_env_p, name_p, prop_attributes, &prop_p);\n    return prop_p;\n  }\n  else\n  {\n    JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n\n    ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);\n\n#if JERRY_BUILTIN_PROXY && JERRY_BUILTIN_REALMS\n    if (ECMA_OBJECT_IS_PROXY (binding_obj_p))\n    {\n      ecma_value_t result = ecma_proxy_object_is_extensible (binding_obj_p);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        return ECMA_PROPERTY_POINTER_ERROR;\n      }\n\n      if (result == ECMA_VALUE_FALSE)\n      {\n        return NULL;\n      }\n    }\n    else if (!ecma_op_ordinary_object_is_extensible (binding_obj_p))\n    {\n      return NULL;\n    }\n#else /* !JERRY_BUILTIN_PROXY || !JERRY_BUILTIN_REALMS */\n    if (!ecma_op_ordinary_object_is_extensible (binding_obj_p))\n    {\n      return NULL;\n    }\n#endif /* JERRY_BUILTIN_PROXY && JERRY_BUILTIN_REALMS */\n\n    const uint32_t flags = ECMA_PROPERTY_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;\n\n    ecma_value_t completion =\n      ecma_builtin_helper_def_prop (binding_obj_p,\n                                    name_p,\n                                    ECMA_VALUE_UNDEFINED,\n                                    is_deletable ? flags | ECMA_PROPERTY_FLAG_CONFIGURABLE : flags);\n\n    if (ECMA_IS_VALUE_ERROR (completion))\n    {\n      return ECMA_PROPERTY_POINTER_ERROR;\n    }\n    else\n    {\n      JERRY_ASSERT (ecma_is_value_boolean (completion));\n    }\n  }\n\n  return NULL;\n} /* ecma_op_create_mutable_binding */\n\n/**\n * SetMutableBinding operation.\n *\n * See also: ECMA-262 v5, 10.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */\n                             ecma_string_t *name_p, /**< argument N */\n                             ecma_value_t value, /**< argument V */\n                             bool is_strict) /**< argument S */\n{\n  JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));\n  JERRY_ASSERT (name_p != NULL);\n\n  switch (ecma_get_lex_env_type (lex_env_p))\n  {\n    case ECMA_LEXICAL_ENVIRONMENT_CLASS:\n    {\n      if (!ECMA_LEX_ENV_CLASS_IS_MODULE (lex_env_p))\n      {\n        return ECMA_VALUE_EMPTY;\n      }\n      /* FALLTHRU */\n    }\n    case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:\n    {\n      ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n      if (JERRY_UNLIKELY (property_p == NULL))\n      {\n        property_p = ecma_op_create_mutable_binding (lex_env_p, name_p, is_strict);\n        JERRY_ASSERT (property_p != ECMA_PROPERTY_POINTER_ERROR);\n      }\n\n      JERRY_ASSERT (property_p != NULL && ECMA_PROPERTY_IS_RAW_DATA (*property_p));\n      JERRY_ASSERT (!(*property_p & ECMA_PROPERTY_FLAG_WRITABLE) || (*property_p & ECMA_PROPERTY_FLAG_DATA));\n\n      if ((*property_p & ECMA_PROPERTY_FLAG_WRITABLE))\n      {\n        ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n        JERRY_ASSERT (property_value_p->value != ECMA_VALUE_UNINITIALIZED);\n\n        ecma_named_data_property_assign_value (lex_env_p, property_value_p, value);\n        return ECMA_VALUE_EMPTY;\n      }\n\n      return ecma_op_raise_set_binding_error (property_p, is_strict);\n    }\n    default:\n    {\n      JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n\n      ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);\n\n      ecma_value_t completion = ecma_op_object_put (binding_obj_p, name_p, value, is_strict);\n\n      if (ECMA_IS_VALUE_ERROR (completion))\n      {\n        return completion;\n      }\n\n      JERRY_ASSERT (ecma_is_value_boolean (completion));\n      return ECMA_VALUE_EMPTY;\n    }\n  }\n} /* ecma_op_set_mutable_binding */\n\n/**\n * GetBindingValue operation.\n *\n * See also: ECMA-262 v5, 10.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */\n                           ecma_string_t *name_p, /**< argument N */\n                           bool is_strict) /**< argument S */\n{\n  JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));\n  JERRY_ASSERT (name_p != NULL);\n\n  if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n  {\n    ecma_property_value_t *prop_value_p = ecma_get_named_data_property (lex_env_p, name_p);\n\n    return ecma_copy_value (prop_value_p->value);\n  }\n  else\n  {\n    JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n\n    ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);\n\n    ecma_value_t result = ecma_op_object_find (binding_obj_p, name_p);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      return result;\n    }\n\n    if (!ecma_is_value_found (result))\n    {\n      if (is_strict)\n      {\n        result = ecma_raise_reference_error (ECMA_ERR_BINDING_NOT_EXIST_OR_UNINITIALIZED);\n      }\n      else\n      {\n        result = ECMA_VALUE_UNDEFINED;\n      }\n    }\n\n    return result;\n  }\n} /* ecma_op_get_binding_value */\n\n/**\n * DeleteBinding operation.\n *\n * See also: ECMA-262 v5, 10.2.1\n *\n * @return ecma value\n *         Return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_{TRUE/FALSE} - depends on whether the binding can be deleted\n */\necma_value_t\necma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */\n                        ecma_string_t *name_p) /**< argument N */\n{\n  JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));\n  JERRY_ASSERT (name_p != NULL);\n\n  if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n  {\n    ecma_property_t *prop_p = ecma_find_named_property (lex_env_p, name_p);\n    ecma_value_t ret_val;\n\n    if (prop_p == NULL)\n    {\n      ret_val = ECMA_VALUE_TRUE;\n    }\n    else\n    {\n      JERRY_ASSERT (ECMA_PROPERTY_IS_RAW_DATA (*prop_p));\n\n      if (!ecma_is_property_configurable (*prop_p))\n      {\n        ret_val = ECMA_VALUE_FALSE;\n      }\n      else\n      {\n        ecma_delete_property (lex_env_p, ECMA_PROPERTY_VALUE_PTR (prop_p));\n\n        ret_val = ECMA_VALUE_TRUE;\n      }\n    }\n\n    return ret_val;\n  }\n  else\n  {\n    JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n\n    ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);\n\n    return ecma_op_object_delete (binding_obj_p, name_p, false);\n  }\n} /* ecma_op_delete_binding */\n\n/**\n * ImplicitThisValue operation.\n *\n * See also: ECMA-262 v5, 10.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_implicit_this_value (ecma_object_t *lex_env_p) /**< lexical environment */\n{\n  JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));\n\n  if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n  else\n  {\n    JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n\n    ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);\n    ecma_ref_object (binding_obj_p);\n\n    return ecma_make_object_value (binding_obj_p);\n  }\n} /* ecma_op_implicit_this_value */\n\n/**\n * CreateImmutableBinding operation.\n *\n * See also: ECMA-262 v5, 10.2.1\n */\nvoid\necma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */\n                                  ecma_string_t *name_p, /**< argument N */\n                                  ecma_value_t value) /**< argument V */\n{\n  JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));\n  JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);\n\n  /*\n   * Warning:\n   *         Whether immutable bindings are deletable seems not to be defined by ECMA v5.\n   */\n  ecma_property_value_t *prop_value_p = ecma_create_named_data_property (lex_env_p, name_p, ECMA_PROPERTY_FIXED, NULL);\n\n  prop_value_p->value = ecma_copy_value_if_not_object (value);\n} /* ecma_op_create_immutable_binding */\n\n/**\n * InitializeBinding operation.\n *\n * See also: ECMA-262 v6, 8.1.1.1.4\n */\nvoid\necma_op_initialize_binding (ecma_object_t *lex_env_p, /**< lexical environment */\n                            ecma_string_t *name_p, /**< argument N */\n                            ecma_value_t value) /**< argument V */\n{\n  JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));\n  JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);\n\n  ecma_property_t *prop_p = ecma_find_named_property (lex_env_p, name_p);\n  JERRY_ASSERT (prop_p != NULL && ECMA_PROPERTY_IS_RAW_DATA (*prop_p));\n\n  ecma_property_value_t *prop_value_p = ECMA_PROPERTY_VALUE_PTR (prop_p);\n  JERRY_ASSERT (prop_value_p->value == ECMA_VALUE_UNINITIALIZED);\n\n  prop_value_p->value = ecma_copy_value_if_not_object (value);\n} /* ecma_op_initialize_binding */\n\n/**\n * BindThisValue operation for an empty lexical environment\n *\n * See also: ECMA-262 v6, 8.1.1.3.1\n */\nvoid\necma_op_create_environment_record (ecma_object_t *lex_env_p, /**< lexical environment */\n                                   ecma_value_t this_binding, /**< this binding value */\n                                   ecma_object_t *func_obj_p) /**< function object */\n{\n  JERRY_ASSERT (lex_env_p != NULL);\n  JERRY_ASSERT (ecma_is_value_object (this_binding) || this_binding == ECMA_VALUE_UNINITIALIZED);\n\n  ecma_environment_record_t *environment_record_p;\n  environment_record_p = (ecma_environment_record_t *) jmem_heap_alloc_block (sizeof (ecma_environment_record_t));\n\n  environment_record_p->this_binding = this_binding;\n  environment_record_p->function_object = ecma_make_object_value (func_obj_p);\n\n  ecma_string_t *property_name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_ENVIRONMENT_RECORD);\n\n  ecma_property_t *property_p;\n  ecma_property_value_t *prop_value_p;\n  ECMA_CREATE_INTERNAL_PROPERTY (lex_env_p, property_name_p, property_p, prop_value_p);\n\n  ECMA_SET_INTERNAL_VALUE_POINTER (prop_value_p->value, environment_record_p);\n} /* ecma_op_create_environment_record */\n\n/**\n * GetThisEnvironment operation.\n *\n * See also: ECMA-262 v6, 8.3.2\n *\n * @return property pointer for the internal [[ThisBindingValue]] property\n */\necma_environment_record_t *\necma_op_get_environment_record (ecma_object_t *lex_env_p) /**< lexical environment */\n{\n  JERRY_ASSERT (lex_env_p != NULL);\n\n  ecma_string_t *property_name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_ENVIRONMENT_RECORD);\n  while (true)\n  {\n    if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n    {\n      ecma_property_t *property_p = ecma_find_named_property (lex_env_p, property_name_p);\n\n      if (property_p != NULL)\n      {\n        ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n        return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_environment_record_t, property_value_p->value);\n      }\n    }\n\n    if (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL)\n    {\n      break;\n    }\n\n    lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n  }\n\n  return NULL;\n} /* ecma_op_get_environment_record */\n\n/**\n * Get the environment record [[ThisBindingStatus]] internal property.\n *\n * See also: ECMA-262 v6, 8.1.1.3\n *\n * @return true - if the status is \"initialzed\"\n *         false - otherwise\n */\nbool\necma_op_this_binding_is_initialized (ecma_environment_record_t *environment_record_p) /**< environment record */\n{\n  JERRY_ASSERT (environment_record_p != NULL);\n\n  return environment_record_p->this_binding != ECMA_VALUE_UNINITIALIZED;\n} /* ecma_op_this_binding_is_initialized */\n\n/**\n * BindThisValue operation.\n *\n * See also: ECMA-262 v6, 8.1.1.3.1\n */\nvoid\necma_op_bind_this_value (ecma_environment_record_t *environment_record_p, /**< environment record */\n                         ecma_value_t this_binding) /**< this binding value */\n{\n  JERRY_ASSERT (environment_record_p != NULL);\n  JERRY_ASSERT (ecma_is_value_object (this_binding));\n  JERRY_ASSERT (!ecma_op_this_binding_is_initialized (environment_record_p));\n\n  environment_record_p->this_binding = this_binding;\n} /* ecma_op_bind_this_value */\n\n/**\n * GetThisBinding operation.\n *\n * See also: ECMA-262 v6, 8.1.1.3.4\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ecma-object - otherwise\n */\necma_value_t\necma_op_get_this_binding (ecma_object_t *lex_env_p) /**< lexical environment */\n{\n  JERRY_ASSERT (lex_env_p != NULL);\n\n  ecma_environment_record_t *environment_record_p = ecma_op_get_environment_record (lex_env_p);\n  JERRY_ASSERT (environment_record_p != NULL);\n\n  ecma_value_t this_value = environment_record_p->this_binding;\n\n  if (this_value == ECMA_VALUE_UNINITIALIZED)\n  {\n    return ecma_raise_reference_error (ECMA_ERR_CALL_SUPER_CONSTRUCTOR_DERIVED_CLASS_BEFORE_THIS);\n  }\n\n  ecma_ref_object (ecma_get_object_from_value (this_value));\n\n  return this_value;\n} /* ecma_op_get_this_binding */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-lex-env.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_LEX_ENV_H\n#define ECMA_LEX_ENV_H\n\n#include \"ecma-globals.h\"\n#include \"ecma-reference.h\"\n\n#include \"jrt.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup lexicalenvironment Lexical environment\n * @{\n *\n * \\addtogroup globallexicalenvironment Global lexical environment\n * @{\n */\n\nvoid ecma_init_global_environment (void);\nvoid ecma_finalize_global_environment (void);\necma_object_t *ecma_get_global_environment (ecma_object_t *global_object_p);\necma_object_t *ecma_get_global_scope (ecma_object_t *global_object_p);\nvoid ecma_create_global_lexical_block (ecma_object_t *global_object_p);\necma_value_t ecma_op_raise_set_binding_error (ecma_property_t *property_p, bool is_strict);\n\n#if JERRY_MODULE_SYSTEM\nvoid ecma_module_add_lex_env (ecma_object_t *lex_env_p);\nvoid ecma_module_finalize_lex_envs (void);\n#endif /* JERRY_MODULE_SYSTEM */\n\n/**\n * @}\n */\n\n/* ECMA-262 v5, 8.7.1 and 8.7.2 */\necma_value_t\necma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, ecma_object_t **ref_base_lex_env_p, ecma_string_t *name_p);\necma_value_t ecma_op_get_value_object_base (ecma_value_t base_value, ecma_string_t *property_name_p);\necma_value_t ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p,\n                                             ecma_string_t *var_name_string_p,\n                                             bool is_strict,\n                                             ecma_value_t value);\n\n/* ECMA-262 v5, Table 17. Abstract methods of Environment Records */\necma_value_t ecma_op_has_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p);\necma_property_t *ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, bool is_deletable);\necma_value_t\necma_op_set_mutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value, bool is_strict);\necma_value_t ecma_op_get_binding_value (ecma_object_t *lex_env_p, ecma_string_t *name_p, bool is_strict);\necma_value_t ecma_op_delete_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p);\necma_value_t ecma_op_implicit_this_value (ecma_object_t *lex_env_p);\n\n/* ECMA-262 v5, Table 18. Additional methods of Declarative Environment Records */\nvoid ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value);\n\nvoid ecma_op_initialize_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value);\n\nvoid ecma_op_create_environment_record (ecma_object_t *lex_env_p, ecma_value_t this_binding, ecma_object_t *func_obj_p);\necma_environment_record_t *ecma_op_get_environment_record (ecma_object_t *lex_env_p);\n\nbool ecma_op_this_binding_is_initialized (ecma_environment_record_t *environment_record_p);\nvoid ecma_op_bind_this_value (ecma_environment_record_t *environment_record_p, ecma_value_t this_binding);\necma_value_t ecma_op_get_this_binding (ecma_object_t *lex_env_p);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_LEX_ENV_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-number-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-number-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmanumberobject ECMA Number object related routines\n * @{\n */\n\n/**\n * Number object creation operation.\n *\n * See also: ECMA-262 v5, 15.7.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Number constructor */\n{\n  ecma_number_t num;\n  ecma_value_t conv_to_num_completion = ecma_op_to_number (arg, &num);\n\n  if (ECMA_IS_VALUE_ERROR (conv_to_num_completion))\n  {\n    return conv_to_num_completion;\n  }\n\n  conv_to_num_completion = ecma_make_number_value (num);\n  ecma_builtin_id_t proto_id;\n#if JERRY_BUILTIN_NUMBER\n  proto_id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE;\n#else /* JERRY_BUILTIN_NUMBER */\n  proto_id = ECMA_BUILTIN_ID_OBJECT_PROTOTYPE;\n#endif /* JERRY_BUILTIN_NUMBER */\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (proto_id);\n\n  ecma_object_t *new_target = JERRY_CONTEXT (current_new_target_p);\n  if (new_target)\n  {\n    prototype_obj_p = ecma_op_get_prototype_from_constructor (new_target, proto_id);\n    if (JERRY_UNLIKELY (prototype_obj_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  ecma_object_t *object_p =\n    ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_NUMBER;\n\n  /* Pass reference (no need to free conv_to_num_completion). */\n  ext_object_p->u.cls.u3.value = conv_to_num_completion;\n\n  if (new_target)\n  {\n    ecma_deref_object (prototype_obj_p);\n  }\n\n  return ecma_make_object_value (object_p);\n} /* ecma_op_create_number_object */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-number-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_NUMBER_OBJECT_H\n#define ECMA_NUMBER_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmanumberobject ECMA Number object related routines\n * @{\n */\n\necma_value_t ecma_op_create_number_object (ecma_value_t arg);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_NUMBER_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-objects-general.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-objects-general.h\"\n\n#include \"ecma-arguments-object.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-proxy-object.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaobjectsinternalops ECMA objects' operations\n * @{\n */\n\n/**\n * 'Object' object creation operation with no arguments.\n *\n * See also: ECMA-262 v5, 15.2.2.1\n *\n * @return pointer to newly created 'Object' object\n */\necma_object_t *\necma_op_create_object_object_noarg (void)\n{\n  ecma_object_t *object_prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n\n  /* 3., 4., 6., 7. */\n  return ecma_op_create_object_object_noarg_and_set_prototype (object_prototype_p);\n} /* ecma_op_create_object_object_noarg */\n\n/**\n * Object creation operation with no arguments.\n * It sets the given prototype to the newly created object.\n *\n * See also: ECMA-262 v5, 15.2.2.1, 15.2.3.5\n *\n * @return pointer to newly created object\n */\necma_object_t *\necma_op_create_object_object_noarg_and_set_prototype (ecma_object_t *object_prototype_p) /**< pointer to prototype of\n                                                                                              the object\n                                                                                              (can be NULL) */\n{\n  ecma_object_t *obj_p = ecma_create_object (object_prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL);\n\n  /*\n   * [[Class]] property of ECMA_OBJECT_TYPE_GENERAL type objects\n   * without ECMA_INTERNAL_PROPERTY_CLASS internal property\n   * is \"Object\".\n   *\n   * See also: ecma_object_get_class_name\n   */\n\n  return obj_p;\n} /* ecma_op_create_object_object_noarg_and_set_prototype */\n\n/**\n * [[Delete]] ecma general object's operation\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *          ECMA-262 v5, 8.12.7\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */\n                               ecma_string_t *property_name_p, /**< property name */\n                               bool is_throw) /**< flag that controls failure handling */\n{\n  JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));\n  JERRY_ASSERT (property_name_p != NULL);\n\n  /* 1. */\n  ecma_property_ref_t property_ref;\n\n  ecma_property_t property =\n    ecma_op_object_get_own_property (obj_p, property_name_p, &property_ref, ECMA_PROPERTY_GET_NO_OPTIONS);\n\n  /* 2. */\n  if (!ECMA_PROPERTY_IS_FOUND (property))\n  {\n    JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);\n    return ECMA_VALUE_TRUE;\n  }\n\n  /* 3. */\n  if (!ecma_is_property_configurable (property))\n  {\n    /* 4. */\n    if (is_throw)\n    {\n      return ecma_raise_type_error (ECMA_ERR_EXPECTED_A_CONFIGURABLE_PROPERTY);\n    }\n\n    /* 5. */\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_object_type_t type = ecma_get_object_type (obj_p);\n\n  if (type == ECMA_OBJECT_TYPE_ARRAY && ecma_array_object_delete_property (obj_p, property_name_p))\n  {\n    return ECMA_VALUE_TRUE;\n  }\n\n  /* a. */\n  ecma_delete_property (obj_p, property_ref.value_p);\n\n  if (property & ECMA_PROPERTY_FLAG_BUILT_IN)\n  {\n    switch (type)\n    {\n      case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n      {\n        if (ecma_builtin_function_is_routine (obj_p))\n        {\n          ecma_builtin_routine_delete_built_in_property (obj_p, property_name_p);\n          break;\n        }\n        /* FALLTHRU */\n      }\n      case ECMA_OBJECT_TYPE_BUILT_IN_GENERAL:\n      case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:\n      case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:\n      {\n        ecma_builtin_delete_built_in_property (obj_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_CLASS:\n      {\n        JERRY_ASSERT (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARGUMENTS));\n        ecma_op_arguments_delete_built_in_property (obj_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_FUNCTION:\n      {\n        ecma_op_function_delete_built_in_property (obj_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n      {\n        ecma_op_bound_function_delete_built_in_property (obj_p, property_name_p);\n        break;\n      }\n      default:\n      {\n        JERRY_UNREACHABLE ();\n        break;\n      }\n    }\n  }\n\n  /* b. */\n  return ECMA_VALUE_TRUE;\n} /* ecma_op_general_object_delete */\n\n/**\n * Property invocation order during [[DefaultValue]] operation with string hint\n */\nstatic const lit_magic_string_id_t to_primitive_string_hint_method_names[2] = {\n  LIT_MAGIC_STRING_TO_STRING_UL, /**< toString operation */\n  LIT_MAGIC_STRING_VALUE_OF_UL, /**< valueOf operation */\n};\n\n/**\n * Property invocation order during [[DefaultValue]] operation with non string hint\n */\nstatic const lit_magic_string_id_t to_primitive_non_string_hint_method_names[2] = {\n  LIT_MAGIC_STRING_VALUE_OF_UL, /**< valueOf operation */\n  LIT_MAGIC_STRING_TO_STRING_UL, /**< toString operation */\n};\n\n/**\n * Hints for the ecma general object's toPrimitve operation\n */\nstatic const lit_magic_string_id_t hints[3] = {\n  LIT_MAGIC_STRING_DEFAULT, /**< \"default\" hint */\n  LIT_MAGIC_STRING_NUMBER, /**< \"number\" hint */\n  LIT_MAGIC_STRING_STRING, /**< \"string\" hint */\n};\n\n/**\n * [[DefaultValue]] ecma general object's operation\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *          ECMA-262 v5, 8.12.8\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */\n                                      ecma_preferred_type_hint_t hint) /**< hint on preferred result type */\n{\n  JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));\n\n  ecma_value_t obj_value = ecma_make_object_value (obj_p);\n\n  ecma_value_t exotic_to_prim = ecma_op_get_method_by_symbol_id (obj_value, LIT_GLOBAL_SYMBOL_TO_PRIMITIVE);\n\n  if (ECMA_IS_VALUE_ERROR (exotic_to_prim))\n  {\n    return exotic_to_prim;\n  }\n\n  if (!ecma_is_value_undefined (exotic_to_prim))\n  {\n    ecma_object_t *call_func_p = ecma_get_object_from_value (exotic_to_prim);\n    ecma_value_t argument = ecma_make_magic_string_value (hints[hint]);\n\n    ecma_value_t result = ecma_op_function_call (call_func_p, obj_value, &argument, 1);\n\n    ecma_free_value (exotic_to_prim);\n\n    if (ECMA_IS_VALUE_ERROR (result) || !ecma_is_value_object (result))\n    {\n      return result;\n    }\n\n    ecma_free_value (result);\n\n    return ecma_raise_type_error (ECMA_ERR_RESULT_OF_DEFAULTVALUE_IS_INVALID);\n  }\n\n  ecma_free_value (exotic_to_prim);\n\n  if (hint == ECMA_PREFERRED_TYPE_NO)\n  {\n    hint = ECMA_PREFERRED_TYPE_NUMBER;\n  }\n\n  return ecma_op_general_object_ordinary_value (obj_p, hint);\n} /* ecma_op_general_object_default_value */\n\n/**\n * Ecma general object's OrdinaryToPrimitive operation\n *\n * See also:\n *          ECMA-262 v6 7.1.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_general_object_ordinary_value (ecma_object_t *obj_p, /**< the object */\n                                       ecma_preferred_type_hint_t hint) /**< hint on preferred result type */\n{\n  const lit_magic_string_id_t *function_name_ids_p =\n    (hint == ECMA_PREFERRED_TYPE_STRING ? to_primitive_string_hint_method_names\n                                        : to_primitive_non_string_hint_method_names);\n\n  for (uint32_t i = 0; i < 2; i++)\n  {\n    ecma_value_t function_value = ecma_op_object_get_by_magic_id (obj_p, function_name_ids_p[i]);\n\n    if (ECMA_IS_VALUE_ERROR (function_value))\n    {\n      return function_value;\n    }\n\n    ecma_value_t call_completion = ECMA_VALUE_EMPTY;\n\n    if (ecma_op_is_callable (function_value))\n    {\n      ecma_object_t *func_obj_p = ecma_get_object_from_value (function_value);\n\n      call_completion = ecma_op_function_call (func_obj_p, ecma_make_object_value (obj_p), NULL, 0);\n    }\n\n    ecma_free_value (function_value);\n\n    if (ECMA_IS_VALUE_ERROR (call_completion)\n        || (!ecma_is_value_empty (call_completion) && !ecma_is_value_object (call_completion)))\n    {\n      return call_completion;\n    }\n\n    ecma_free_value (call_completion);\n  }\n\n  return ecma_raise_type_error (ECMA_ERR_RESULT_OF_DEFAULTVALUE_IS_INVALID);\n} /* ecma_op_general_object_ordinary_value */\n\n/**\n * Special types for ecma_op_general_object_define_own_property.\n */\ntypedef enum\n{\n  ECMA_OP_OBJECT_DEFINE_GENERIC = 1, /**< generic property */\n  ECMA_OP_OBJECT_DEFINE_ACCESSOR = 0, /**< accessor property */\n  ECMA_OP_OBJECT_DEFINE_DATA = ECMA_PROPERTY_FLAG_DATA /**< data property */\n} ecma_op_object_define_own_property_type_t;\n\n/**\n * [[DefineOwnProperty]] ecma general object's operation\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *          ECMA-262 v5, 8.12.9\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the object */\n                                            ecma_string_t *property_name_p, /**< property name */\n                                            const ecma_property_descriptor_t *property_desc_p) /**< property\n                                                                                                *   descriptor */\n{\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (object_p))\n  {\n    return ecma_proxy_object_define_own_property (object_p, property_name_p, property_desc_p);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));\n  JERRY_ASSERT (!ecma_op_object_is_fast_array (object_p));\n  JERRY_ASSERT (property_name_p != NULL);\n\n  uint8_t property_desc_type = ECMA_OP_OBJECT_DEFINE_GENERIC;\n\n  if (property_desc_p->flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED))\n  {\n    /* A property descriptor cannot be both named data and named accessor. */\n    JERRY_ASSERT ((property_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))\n                  != (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED));\n    property_desc_type = ECMA_OP_OBJECT_DEFINE_DATA;\n  }\n  else if (property_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))\n  {\n    JERRY_ASSERT (!(property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED));\n    property_desc_type = ECMA_OP_OBJECT_DEFINE_ACCESSOR;\n  }\n\n  /* These three asserts ensures that a new property is created with the appropriate default flags.\n   * E.g. if JERRY_PROP_IS_CONFIGURABLE_DEFINED is false, the newly created property must be non-configurable. */\n  JERRY_ASSERT ((property_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED)\n                || !(property_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE));\n  JERRY_ASSERT ((property_desc_p->flags & JERRY_PROP_IS_ENUMERABLE_DEFINED)\n                || !(property_desc_p->flags & JERRY_PROP_IS_ENUMERABLE));\n  JERRY_ASSERT ((property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED)\n                || !(property_desc_p->flags & JERRY_PROP_IS_WRITABLE));\n\n  /* 1. */\n  ecma_extended_property_ref_t ext_property_ref = { .property_ref.value_p = NULL, .property_p = NULL };\n  ecma_property_t current_prop;\n\n  current_prop = ecma_op_object_get_own_property (object_p,\n                                                  property_name_p,\n                                                  &ext_property_ref.property_ref,\n                                                  ECMA_PROPERTY_GET_VALUE | ECMA_PROPERTY_GET_EXT_REFERENCE);\n\n  if (!ECMA_PROPERTY_IS_FOUND (current_prop))\n  {\n    JERRY_ASSERT (current_prop == ECMA_PROPERTY_TYPE_NOT_FOUND\n                  || current_prop == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);\n\n    /* 3. */\n    if (!ecma_op_ordinary_object_is_extensible (object_p))\n    {\n      /* 2. */\n      return ECMA_REJECT_WITH_FORMAT (property_desc_p->flags & JERRY_PROP_SHOULD_THROW,\n                                      \"Cannot define property '%', object is not extensible\",\n                                      ecma_make_prop_name_value (property_name_p));\n    }\n\n    /* 4. */\n    uint8_t prop_attributes = (uint8_t) (property_desc_p->flags & ECMA_PROPERTY_FLAGS_MASK);\n\n    if (property_desc_type != ECMA_OP_OBJECT_DEFINE_ACCESSOR)\n    {\n      /* a. */\n      JERRY_ASSERT (property_desc_type == ECMA_OP_OBJECT_DEFINE_GENERIC\n                    || property_desc_type == ECMA_OP_OBJECT_DEFINE_DATA);\n\n      ecma_property_value_t *new_prop_value_p =\n        ecma_create_named_data_property (object_p, property_name_p, prop_attributes, NULL);\n\n      JERRY_ASSERT ((property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n                    || ecma_is_value_undefined (property_desc_p->value));\n\n      new_prop_value_p->value = ecma_copy_value_if_not_object (property_desc_p->value);\n    }\n    else\n    {\n      /* b. */\n      ecma_create_named_accessor_property (object_p,\n                                           property_name_p,\n                                           property_desc_p->get_p,\n                                           property_desc_p->set_p,\n                                           prop_attributes,\n                                           NULL);\n    }\n\n    return ECMA_VALUE_TRUE;\n  }\n\n  /* 6. */\n  const bool is_current_configurable = ecma_is_property_configurable (current_prop);\n\n  /* 7. a., b. */\n  bool is_enumerable = (property_desc_p->flags & JERRY_PROP_IS_ENUMERABLE) != 0;\n  if (!is_current_configurable\n      && ((property_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE)\n          || ((property_desc_p->flags & JERRY_PROP_IS_ENUMERABLE_DEFINED)\n              && (is_enumerable != ecma_is_property_enumerable (current_prop)))))\n  {\n    if (ECMA_PROPERTY_IS_VIRTUAL (current_prop))\n    {\n      ecma_free_value (ext_property_ref.property_ref.virtual_value);\n    }\n\n    return ecma_raise_property_redefinition (property_name_p, property_desc_p->flags);\n  }\n\n  if (ECMA_PROPERTY_IS_VIRTUAL (current_prop))\n  {\n    bool writable_check_failed = (property_desc_p->flags & JERRY_PROP_IS_WRITABLE);\n\n#if JERRY_MODULE_SYSTEM\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_MODULE_NAMESPACE))\n    {\n      if (JERRY_UNLIKELY (ext_property_ref.property_ref.virtual_value == ECMA_VALUE_UNINITIALIZED))\n      {\n        return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);\n      }\n\n      if (property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED)\n      {\n        writable_check_failed = ((property_desc_p->flags ^ current_prop) & JERRY_PROP_IS_WRITABLE) != 0;\n      }\n    }\n    else\n    {\n      JERRY_ASSERT (!is_current_configurable && !ecma_is_property_writable (current_prop));\n    }\n#else /* !JERRY_MODULE_SYSTEM */\n    JERRY_ASSERT (!is_current_configurable && !ecma_is_property_writable (current_prop));\n#endif /* JERRY_MODULE_SYSTEM */\n\n    ecma_value_t result = ECMA_VALUE_TRUE;\n\n    if (property_desc_type == ECMA_OP_OBJECT_DEFINE_ACCESSOR || writable_check_failed\n        || ((property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n            && !ecma_op_same_value (property_desc_p->value, ext_property_ref.property_ref.virtual_value)))\n    {\n      result = ecma_raise_property_redefinition (property_name_p, property_desc_p->flags);\n    }\n\n    ecma_free_value (ext_property_ref.property_ref.virtual_value);\n    return result;\n  }\n\n  /* 8. */\n  if (property_desc_type == ECMA_OP_OBJECT_DEFINE_GENERIC)\n  {\n    /* No action required. */\n  }\n  else if (JERRY_LIKELY (property_desc_type == (current_prop & ECMA_PROPERTY_FLAG_DATA)))\n  {\n    /* If property is configurable, there is no need for checks. */\n    if (JERRY_UNLIKELY (!is_current_configurable))\n    {\n      if (property_desc_type == ECMA_OP_OBJECT_DEFINE_DATA)\n      {\n        /* 10. a. i. & ii. */\n        if (!ecma_is_property_writable (current_prop)\n            && ((property_desc_p->flags & JERRY_PROP_IS_WRITABLE)\n                || ((property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n                    && !ecma_op_same_value (property_desc_p->value, ext_property_ref.property_ref.value_p->value))))\n        {\n          return ecma_raise_property_redefinition (property_name_p, property_desc_p->flags);\n        }\n      }\n      else\n      {\n        /* 11. */\n\n        /* a. */\n        ecma_property_value_t *value_p = ext_property_ref.property_ref.value_p;\n\n        ecma_getter_setter_pointers_t *get_set_pair_p = ecma_get_named_accessor_property (value_p);\n        jmem_cpointer_t prop_desc_getter_cp, prop_desc_setter_cp;\n        ECMA_SET_POINTER (prop_desc_getter_cp, property_desc_p->get_p);\n        ECMA_SET_POINTER (prop_desc_setter_cp, property_desc_p->set_p);\n\n        if (((property_desc_p->flags & JERRY_PROP_IS_GET_DEFINED) && prop_desc_getter_cp != get_set_pair_p->getter_cp)\n            || ((property_desc_p->flags & JERRY_PROP_IS_SET_DEFINED)\n                && prop_desc_setter_cp != get_set_pair_p->setter_cp))\n        {\n          /* i., ii. */\n          return ecma_raise_property_redefinition (property_name_p, property_desc_p->flags);\n        }\n      }\n    }\n  }\n  else\n  {\n    /* 9. */\n    if (!is_current_configurable)\n    {\n      /* a. */\n      return ecma_raise_property_redefinition (property_name_p, property_desc_p->flags);\n    }\n\n    ecma_property_value_t *value_p = ext_property_ref.property_ref.value_p;\n\n    if (property_desc_type == ECMA_OP_OBJECT_DEFINE_ACCESSOR)\n    {\n      JERRY_ASSERT (current_prop & ECMA_PROPERTY_FLAG_DATA);\n      ecma_free_value_if_not_object (value_p->value);\n\n#if JERRY_CPOINTER_32_BIT\n      ecma_getter_setter_pointers_t *getter_setter_pair_p;\n      getter_setter_pair_p = jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));\n      getter_setter_pair_p->getter_cp = JMEM_CP_NULL;\n      getter_setter_pair_p->setter_cp = JMEM_CP_NULL;\n      ECMA_SET_NON_NULL_POINTER (value_p->getter_setter_pair_cp, getter_setter_pair_p);\n#else /* !JERRY_CPOINTER_32_BIT */\n      value_p->getter_setter_pair.getter_cp = JMEM_CP_NULL;\n      value_p->getter_setter_pair.setter_cp = JMEM_CP_NULL;\n#endif /* JERRY_CPOINTER_32_BIT */\n    }\n    else\n    {\n      JERRY_ASSERT (!(current_prop & ECMA_PROPERTY_FLAG_DATA));\n#if JERRY_CPOINTER_32_BIT\n      ecma_getter_setter_pointers_t *getter_setter_pair_p;\n      getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, value_p->getter_setter_pair_cp);\n      jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));\n#endif /* JERRY_CPOINTER_32_BIT */\n      value_p->value = ECMA_VALUE_UNDEFINED;\n    }\n\n    /* Update flags */\n    ecma_property_t prop_flags = *(ext_property_ref.property_p);\n    prop_flags = (ecma_property_t) (prop_flags & ~ECMA_PROPERTY_FLAG_WRITABLE);\n    prop_flags ^= ECMA_PROPERTY_FLAG_DATA;\n    *(ext_property_ref.property_p) = prop_flags;\n  }\n\n  /* 12. */\n  if (property_desc_type == ECMA_OP_OBJECT_DEFINE_DATA)\n  {\n    JERRY_ASSERT (ECMA_PROPERTY_IS_RAW_DATA (*ext_property_ref.property_p));\n\n    if (property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n    {\n      ecma_named_data_property_assign_value (object_p, ext_property_ref.property_ref.value_p, property_desc_p->value);\n    }\n\n    if (property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED)\n    {\n      ecma_set_property_writable_attr (ext_property_ref.property_p, (property_desc_p->flags & JERRY_PROP_IS_WRITABLE));\n    }\n  }\n  else if (property_desc_type == ECMA_OP_OBJECT_DEFINE_ACCESSOR)\n  {\n    JERRY_ASSERT (!(*ext_property_ref.property_p & ECMA_PROPERTY_FLAG_DATA));\n\n    if (property_desc_p->flags & JERRY_PROP_IS_GET_DEFINED)\n    {\n      ecma_set_named_accessor_property_getter (object_p, ext_property_ref.property_ref.value_p, property_desc_p->get_p);\n    }\n\n    if (property_desc_p->flags & JERRY_PROP_IS_SET_DEFINED)\n    {\n      ecma_set_named_accessor_property_setter (object_p, ext_property_ref.property_ref.value_p, property_desc_p->set_p);\n    }\n  }\n\n  if (property_desc_p->flags & JERRY_PROP_IS_ENUMERABLE_DEFINED)\n  {\n    ecma_set_property_enumerable_attr (ext_property_ref.property_p,\n                                       (property_desc_p->flags & JERRY_PROP_IS_ENUMERABLE));\n  }\n\n  if (property_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED)\n  {\n    ecma_set_property_configurable_attr (ext_property_ref.property_p,\n                                         (property_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE));\n  }\n\n  return ECMA_VALUE_TRUE;\n} /* ecma_op_general_object_define_own_property */\n\n/**\n * The IsCompatiblePropertyDescriptor method for Proxy object internal methods\n *\n * See also:\n *          ECMAScript v6, 9.1.6.2\n *\n * @return bool\n */\nbool\necma_op_is_compatible_property_descriptor (const ecma_property_descriptor_t *desc_p, /**< target descriptor */\n                                           const ecma_property_descriptor_t *current_p, /**< current descriptor */\n                                           bool is_extensible) /**< true - if target object is extensible\n                                                                    false - otherwise */\n{\n  JERRY_ASSERT (desc_p != NULL);\n\n  /* 2. */\n  if (current_p == NULL)\n  {\n    return is_extensible;\n  }\n\n  /* 3. */\n  if (desc_p->flags == 0)\n  {\n    return true;\n  }\n\n  /* 4. */\n  if ((current_p->flags & desc_p->flags) == desc_p->flags)\n  {\n    if ((current_p->flags & JERRY_PROP_IS_VALUE_DEFINED) && ecma_op_same_value (current_p->value, desc_p->value))\n    {\n      return true;\n    }\n\n    if ((current_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED) && current_p->get_p == desc_p->get_p\n         && current_p->set_p == desc_p->set_p))\n    {\n      return true;\n    }\n  }\n\n  /* 5. */\n  if (!(current_p->flags & JERRY_PROP_IS_CONFIGURABLE))\n  {\n    if (desc_p->flags & JERRY_PROP_IS_CONFIGURABLE)\n    {\n      return false;\n    }\n    if ((desc_p->flags & JERRY_PROP_IS_ENUMERABLE_DEFINED)\n        && ((current_p->flags & JERRY_PROP_IS_ENUMERABLE) != (desc_p->flags & JERRY_PROP_IS_ENUMERABLE)))\n    {\n      return false;\n    }\n  }\n\n  const uint32_t accessor_desc_flags = (JERRY_PROP_IS_SET_DEFINED | JERRY_PROP_IS_GET_DEFINED);\n  const uint32_t data_desc_flags = (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED);\n\n  bool desc_is_accessor = (desc_p->flags & accessor_desc_flags) != 0;\n  bool desc_is_data = (desc_p->flags & data_desc_flags) != 0;\n  bool current_is_data = (current_p->flags & data_desc_flags) != 0;\n\n  /* 6. */\n  if (!desc_is_accessor && !desc_is_data)\n  {\n    return true;\n  }\n\n  /* 7. */\n  if (current_is_data != desc_is_data)\n  {\n    return (current_p->flags & JERRY_PROP_IS_CONFIGURABLE) != 0;\n  }\n\n  /* 8. */\n  if (current_is_data)\n  {\n    if (!(current_p->flags & JERRY_PROP_IS_CONFIGURABLE))\n    {\n      if (!(current_p->flags & JERRY_PROP_IS_WRITABLE) && (desc_p->flags & JERRY_PROP_IS_WRITABLE))\n      {\n        return false;\n      }\n\n      if (!(current_p->flags & JERRY_PROP_IS_WRITABLE) && (desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n          && !ecma_op_same_value (desc_p->value, current_p->value))\n      {\n        return false;\n      }\n    }\n\n    return true;\n  }\n\n  JERRY_ASSERT ((current_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)) != 0);\n  JERRY_ASSERT ((desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)) != 0);\n\n  /* 9. */\n  if (!(current_p->flags & JERRY_PROP_IS_CONFIGURABLE))\n  {\n    if ((desc_p->flags & JERRY_PROP_IS_SET_DEFINED) && desc_p->set_p != current_p->set_p)\n    {\n      return false;\n    }\n\n    if ((desc_p->flags & JERRY_PROP_IS_GET_DEFINED) && desc_p->get_p != current_p->get_p)\n    {\n      return false;\n    }\n  }\n\n  return true;\n} /* ecma_op_is_compatible_property_descriptor */\n\n/**\n * CompletePropertyDescriptor method for proxy internal method\n *\n * See also:\n *          ECMA-262 v6, 6.2.4.5\n */\nvoid\necma_op_to_complete_property_descriptor (ecma_property_descriptor_t *desc_p) /**< target descriptor */\n{\n  /* 4. */\n  if (!(desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)))\n  {\n    /* a. */\n    desc_p->flags |= JERRY_PROP_IS_VALUE_DEFINED;\n  }\n  /* 5. */\n  else\n  {\n    desc_p->flags |= (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED);\n  }\n} /* ecma_op_to_complete_property_descriptor */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-objects-general.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_OBJECTS_GENERAL_H\n#define ECMA_OBJECTS_GENERAL_H\n\n#include \"ecma-conversion.h\"\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaobjectsinternalops ECMA objects' operations\n * @{\n */\n\necma_object_t *ecma_op_create_object_object_noarg (void);\necma_object_t *ecma_op_create_object_object_noarg_and_set_prototype (ecma_object_t *object_prototype_p);\n\necma_value_t ecma_op_general_object_delete (ecma_object_t *obj_p, ecma_string_t *property_name_p, bool is_throw);\necma_value_t ecma_op_general_object_default_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint);\necma_value_t ecma_op_general_object_ordinary_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint);\necma_value_t ecma_op_general_object_define_own_property (ecma_object_t *object_p,\n                                                         ecma_string_t *property_name_p,\n                                                         const ecma_property_descriptor_t *property_desc_p);\n\nvoid ecma_op_to_complete_property_descriptor (ecma_property_descriptor_t *desc_p);\n\nbool ecma_op_is_compatible_property_descriptor (const ecma_property_descriptor_t *desc_p,\n                                                const ecma_property_descriptor_t *current_p,\n                                                bool is_extensible);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_OBJECTS_GENERAL_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-objects.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-objects.h\"\n\n#include \"ecma-arguments-object.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-lcache.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-proxy-object.h\"\n#include \"ecma-string-object.h\"\n\n#include \"jcontext.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-typedarray-object.h\"\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaobjectsinternalops ECMA objects' operations\n * @{\n */\n\n/**\n * Hash bitmap size for ecma objects\n */\n#define ECMA_OBJECT_HASH_BITMAP_SIZE 256\n\n/**\n * Assert that specified object type value is valid\n *\n * @param type object's implementation-defined type\n */\n#ifndef JERRY_NDEBUG\n#define JERRY_ASSERT_OBJECT_TYPE_IS_VALID(type) JERRY_ASSERT (type < ECMA_OBJECT_TYPE__MAX);\n#else /* JERRY_NDEBUG */\n#define JERRY_ASSERT_OBJECT_TYPE_IS_VALID(type)\n#endif /* !JERRY_NDEBUG */\n\n/**\n * [[GetOwnProperty]] ecma object's operation\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *\n * @return pointer to a property - if it exists,\n *         NULL (i.e. ecma-undefined) - otherwise.\n */\necma_property_t\necma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */\n                                 ecma_string_t *property_name_p, /**< property name */\n                                 ecma_property_ref_t *property_ref_p, /**< property reference */\n                                 uint32_t options) /**< option bits */\n{\n  JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));\n#if JERRY_BUILTIN_PROXY\n  JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));\n#endif /* JERRY_BUILTIN_PROXY */\n  JERRY_ASSERT (property_name_p != NULL);\n  JERRY_ASSERT (options == ECMA_PROPERTY_GET_NO_OPTIONS || property_ref_p != NULL);\n\n  ecma_object_base_type_t base_type = ecma_get_object_base_type (object_p);\n\n  switch (base_type)\n  {\n    case ECMA_OBJECT_BASE_TYPE_CLASS:\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      switch (ext_object_p->u.cls.type)\n      {\n        case ECMA_OBJECT_CLASS_STRING:\n        {\n          if (ecma_string_is_length (property_name_p))\n          {\n            if (options & ECMA_PROPERTY_GET_VALUE)\n            {\n              ecma_value_t prim_value_p = ext_object_p->u.cls.u3.value;\n              ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);\n\n              lit_utf8_size_t length = ecma_string_get_length (prim_value_str_p);\n              property_ref_p->virtual_value = ecma_make_uint32_value (length);\n            }\n\n            return ECMA_PROPERTY_VIRTUAL;\n          }\n\n          uint32_t index = ecma_string_get_array_index (property_name_p);\n\n          if (index != ECMA_STRING_NOT_ARRAY_INDEX)\n          {\n            ecma_value_t prim_value_p = ext_object_p->u.cls.u3.value;\n            ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);\n\n            if (index < ecma_string_get_length (prim_value_str_p))\n            {\n              if (options & ECMA_PROPERTY_GET_VALUE)\n              {\n                ecma_char_t char_at_idx = ecma_string_get_char_at_pos (prim_value_str_p, index);\n                ecma_string_t *char_str_p = ecma_new_ecma_string_from_code_unit (char_at_idx);\n                property_ref_p->virtual_value = ecma_make_string_value (char_str_p);\n              }\n\n              return ECMA_PROPERTY_FLAG_ENUMERABLE | ECMA_PROPERTY_VIRTUAL;\n            }\n          }\n          break;\n        }\n#if JERRY_BUILTIN_TYPEDARRAY\n        /* ES2015 9.4.5.1 */\n        case ECMA_OBJECT_CLASS_TYPEDARRAY:\n        {\n          if (ecma_prop_name_is_symbol (property_name_p))\n          {\n            break;\n          }\n\n          uint32_t index = ecma_string_get_array_index (property_name_p);\n\n          if (index == ECMA_STRING_NOT_ARRAY_INDEX)\n          {\n            JERRY_ASSERT (index == UINT32_MAX);\n\n            if (!ecma_typedarray_is_element_index (property_name_p))\n            {\n              break;\n            }\n          }\n\n          ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);\n          ecma_value_t value = ecma_get_typedarray_element (&info, index);\n\n          if (ECMA_IS_VALUE_ERROR (value))\n          {\n            return ECMA_PROPERTY_TYPE_NOT_FOUND_AND_THROW;\n          }\n\n          if (JERRY_UNLIKELY (ecma_is_value_undefined (value)))\n          {\n            return ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP;\n          }\n\n          if (options & ECMA_PROPERTY_GET_VALUE)\n          {\n            property_ref_p->virtual_value = value;\n          }\n          else\n          {\n            ecma_fast_free_value (value);\n          }\n\n          return ECMA_PROPERTY_ENUMERABLE_WRITABLE | ECMA_PROPERTY_VIRTUAL;\n        }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_MODULE_SYSTEM\n        case ECMA_OBJECT_CLASS_MODULE_NAMESPACE:\n        {\n          if (JERRY_UNLIKELY (ecma_prop_name_is_symbol (property_name_p)))\n          {\n            if (!ecma_op_compare_string_to_global_symbol (property_name_p, LIT_GLOBAL_SYMBOL_TO_STRING_TAG))\n            {\n              return ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP;\n            }\n\n            /* ECMA-262 v11, 26.3.1 */\n            if (options & ECMA_PROPERTY_GET_VALUE)\n            {\n              property_ref_p->virtual_value = ecma_make_magic_string_value (LIT_MAGIC_STRING_MODULE_UL);\n            }\n\n            return ECMA_PROPERTY_VIRTUAL;\n          }\n\n          ecma_property_t *property_p = ecma_find_named_property (object_p, property_name_p);\n\n          if (property_p == NULL)\n          {\n            return ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP;\n          }\n\n          JERRY_ASSERT (ECMA_PROPERTY_IS_RAW (*property_p));\n\n          if (*property_p & ECMA_PROPERTY_FLAG_DATA)\n          {\n            if (options & ECMA_PROPERTY_GET_EXT_REFERENCE)\n            {\n              ((ecma_extended_property_ref_t *) property_ref_p)->property_p = property_p;\n            }\n\n            if (property_ref_p != NULL)\n            {\n              property_ref_p->value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n            }\n\n            return *property_p;\n          }\n\n          if (options & ECMA_PROPERTY_GET_VALUE)\n          {\n            ecma_property_value_t *prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n            prop_value_p = ecma_get_property_value_from_named_reference (prop_value_p);\n            property_ref_p->virtual_value = ecma_fast_copy_value (prop_value_p->value);\n          }\n\n          return ECMA_PROPERTY_ENUMERABLE_WRITABLE | ECMA_PROPERTY_VIRTUAL;\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n      }\n      break;\n    }\n    case ECMA_OBJECT_BASE_TYPE_ARRAY:\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      if (ecma_string_is_length (property_name_p))\n      {\n        if (options & ECMA_PROPERTY_GET_VALUE)\n        {\n          property_ref_p->virtual_value = ecma_make_uint32_value (ext_object_p->u.array.length);\n        }\n\n        uint32_t length_prop = ext_object_p->u.array.length_prop_and_hole_count;\n        return length_prop & (ECMA_PROPERTY_FLAG_WRITABLE | ECMA_PROPERTY_VIRTUAL);\n      }\n\n      if (ecma_op_array_is_fast_array (ext_object_p))\n      {\n        uint32_t index = ecma_string_get_array_index (property_name_p);\n\n        if (index != ECMA_STRING_NOT_ARRAY_INDEX)\n        {\n          if (JERRY_LIKELY (index < ext_object_p->u.array.length))\n          {\n            ecma_value_t *values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n\n            if (ecma_is_value_array_hole (values_p[index]))\n            {\n              return ECMA_PROPERTY_TYPE_NOT_FOUND;\n            }\n\n            if (options & ECMA_PROPERTY_GET_VALUE)\n            {\n              property_ref_p->virtual_value = ecma_fast_copy_value (values_p[index]);\n            }\n\n            return ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | ECMA_PROPERTY_VIRTUAL;\n          }\n        }\n\n        return ECMA_PROPERTY_TYPE_NOT_FOUND;\n      }\n\n      break;\n    }\n    default:\n    {\n      break;\n    }\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (object_p, property_name_p);\n  ecma_object_type_t type = ecma_get_object_type (object_p);\n\n  if (property_p == NULL)\n  {\n    switch (type)\n    {\n      case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n      {\n        if (ecma_builtin_function_is_routine (object_p))\n        {\n          property_p = ecma_builtin_routine_try_to_instantiate_property (object_p, property_name_p);\n          break;\n        }\n        /* FALLTHRU */\n      }\n      case ECMA_OBJECT_TYPE_BUILT_IN_GENERAL:\n      case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:\n      case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:\n      {\n        property_p = ecma_builtin_try_to_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_CLASS:\n      {\n        if (((ecma_extended_object_t *) object_p)->u.cls.type == ECMA_OBJECT_CLASS_ARGUMENTS)\n        {\n          property_p = ecma_op_arguments_object_try_to_lazy_instantiate_property (object_p, property_name_p);\n        }\n        break;\n      }\n      case ECMA_OBJECT_TYPE_FUNCTION:\n      {\n        /* Get prototype physical property. */\n        property_p = ecma_op_function_try_to_lazy_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:\n      {\n        property_p = ecma_op_external_function_try_to_lazy_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n      {\n        property_p = ecma_op_bound_function_try_to_lazy_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      default:\n      {\n        break;\n      }\n    }\n\n    if (property_p == NULL)\n    {\n      return ECMA_PROPERTY_TYPE_NOT_FOUND;\n    }\n  }\n  else if (type == ECMA_OBJECT_TYPE_CLASS\n           && ((ecma_extended_object_t *) object_p)->u.cls.type == ECMA_OBJECT_CLASS_ARGUMENTS\n           && (((ecma_extended_object_t *) object_p)->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED))\n  {\n    ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n    uint32_t index = ecma_string_get_array_index (property_name_p);\n\n    if (index < ext_object_p->u.cls.u2.formal_params_number)\n    {\n      ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;\n\n      ecma_value_t *argv_p = (ecma_value_t *) (mapped_arguments_p + 1);\n\n      if (!ecma_is_value_empty (argv_p[index]) && argv_p[index] != ECMA_VALUE_ARGUMENT_NO_TRACK)\n      {\n#if JERRY_LCACHE\n        /* Mapped arguments initialized properties MUST not be lcached */\n        if (ecma_is_property_lcached (property_p))\n        {\n          jmem_cpointer_t prop_name_cp;\n\n          if (JERRY_UNLIKELY (ECMA_IS_DIRECT_STRING (property_name_p)))\n          {\n            prop_name_cp = (jmem_cpointer_t) ECMA_GET_DIRECT_STRING_VALUE (property_name_p);\n          }\n          else\n          {\n            ECMA_SET_NON_NULL_POINTER (prop_name_cp, property_name_p);\n          }\n          ecma_lcache_invalidate (object_p, prop_name_cp, property_p);\n        }\n#endif /* JERRY_LCACHE */\n        ecma_string_t *name_p = ecma_op_arguments_object_get_formal_parameter (mapped_arguments_p, index);\n        ecma_object_t *lex_env_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env);\n\n        ecma_value_t binding_value = ecma_op_get_binding_value (lex_env_p, name_p, true);\n\n        ecma_named_data_property_assign_value (object_p, ECMA_PROPERTY_VALUE_PTR (property_p), binding_value);\n        ecma_free_value (binding_value);\n      }\n    }\n  }\n\n  if (options & ECMA_PROPERTY_GET_EXT_REFERENCE)\n  {\n    ((ecma_extended_property_ref_t *) property_ref_p)->property_p = property_p;\n  }\n\n  if (property_ref_p != NULL)\n  {\n    property_ref_p->value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n  }\n\n  return *property_p;\n} /* ecma_op_object_get_own_property */\n\n/**\n * Generic [[HasProperty]] operation\n *\n * See also:\n *          ECMAScript v6, 9.1.7.1\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_{TRUE_FALSE} - whether the property is found\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_object_has_property (ecma_object_t *object_p, /**< the object */\n                             ecma_string_t *property_name_p) /**< property name */\n{\n  while (true)\n  {\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_OBJECT_IS_PROXY (object_p))\n    {\n      return ecma_proxy_object_has (object_p, property_name_p);\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    /* 2 - 3. */\n    ecma_property_t property =\n      ecma_op_object_get_own_property (object_p, property_name_p, NULL, ECMA_PROPERTY_GET_NO_OPTIONS);\n\n    if (property != ECMA_PROPERTY_TYPE_NOT_FOUND)\n    {\n#if JERRY_BUILTIN_TYPEDARRAY\n      if (JERRY_UNLIKELY (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_THROW))\n      {\n        return ECMA_VALUE_ERROR;\n      }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n      JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP || ECMA_PROPERTY_IS_FOUND (property));\n\n      return ecma_make_boolean_value (property != ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);\n    }\n\n    jmem_cpointer_t proto_cp = ecma_op_ordinary_object_get_prototype_of (object_p);\n\n    /* 7. */\n    if (proto_cp == JMEM_CP_NULL)\n    {\n      return ECMA_VALUE_FALSE;\n    }\n\n    object_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, proto_cp);\n  }\n} /* ecma_op_object_has_property */\n\n/**\n * Search the value corresponding to a property name\n *\n * Note: search includes prototypes\n *\n * @return ecma value if property is found\n *         ECMA_VALUE_NOT_FOUND if property is not found\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_object_find_own (ecma_value_t base_value, /**< base value */\n                         ecma_object_t *object_p, /**< target object */\n                         ecma_string_t *property_name_p) /**< property name */\n{\n  JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));\n  JERRY_ASSERT (property_name_p != NULL);\n  JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));\n\n  ecma_object_base_type_t base_type = ecma_get_object_base_type (object_p);\n\n  switch (base_type)\n  {\n    case ECMA_OBJECT_BASE_TYPE_CLASS:\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      switch (ext_object_p->u.cls.type)\n      {\n        case ECMA_OBJECT_CLASS_STRING:\n        {\n          if (ecma_string_is_length (property_name_p))\n          {\n            ecma_value_t prim_value_p = ext_object_p->u.cls.u3.value;\n\n            ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);\n            lit_utf8_size_t length = ecma_string_get_length (prim_value_str_p);\n\n            return ecma_make_uint32_value (length);\n          }\n\n          uint32_t index = ecma_string_get_array_index (property_name_p);\n\n          if (index != ECMA_STRING_NOT_ARRAY_INDEX)\n          {\n            ecma_value_t prim_value_p = ext_object_p->u.cls.u3.value;\n\n            ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);\n\n            if (index < ecma_string_get_length (prim_value_str_p))\n            {\n              ecma_char_t char_at_idx = ecma_string_get_char_at_pos (prim_value_str_p, index);\n              return ecma_make_string_value (ecma_new_ecma_string_from_code_unit (char_at_idx));\n            }\n          }\n          break;\n        }\n        case ECMA_OBJECT_CLASS_ARGUMENTS:\n        {\n          if (!(ext_object_p->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED))\n          {\n            break;\n          }\n\n          uint32_t index = ecma_string_get_array_index (property_name_p);\n\n          if (index < ext_object_p->u.cls.u2.formal_params_number)\n          {\n            ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;\n\n            ecma_value_t *argv_p = (ecma_value_t *) (mapped_arguments_p + 1);\n\n            if (!ecma_is_value_empty (argv_p[index]) && argv_p[index] != ECMA_VALUE_ARGUMENT_NO_TRACK)\n            {\n              ecma_string_t *name_p = ecma_op_arguments_object_get_formal_parameter (mapped_arguments_p, index);\n              ecma_object_t *lex_env_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env);\n\n              return ecma_op_get_binding_value (lex_env_p, name_p, true);\n            }\n          }\n          break;\n        }\n#if JERRY_BUILTIN_TYPEDARRAY\n        /* ES2015 9.4.5.4 */\n        case ECMA_OBJECT_CLASS_TYPEDARRAY:\n        {\n          if (ecma_prop_name_is_symbol (property_name_p))\n          {\n            break;\n          }\n\n          uint32_t index = ecma_string_get_array_index (property_name_p);\n\n          if (index == ECMA_STRING_NOT_ARRAY_INDEX)\n          {\n            JERRY_ASSERT (index == UINT32_MAX);\n\n            if (!ecma_typedarray_is_element_index (property_name_p))\n            {\n              break;\n            }\n          }\n\n          ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);\n          return ecma_get_typedarray_element (&info, index);\n        }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_MODULE_SYSTEM\n        case ECMA_OBJECT_CLASS_MODULE_NAMESPACE:\n        {\n          if (JERRY_UNLIKELY (ecma_prop_name_is_symbol (property_name_p)))\n          {\n            /* ECMA-262 v11, 26.3.1 */\n            if (ecma_op_compare_string_to_global_symbol (property_name_p, LIT_GLOBAL_SYMBOL_TO_STRING_TAG))\n            {\n              return ecma_make_magic_string_value (LIT_MAGIC_STRING_MODULE_UL);\n            }\n\n            return ECMA_VALUE_NOT_FOUND;\n          }\n\n          ecma_property_t *property_p = ecma_find_named_property (object_p, property_name_p);\n\n          if (property_p == NULL)\n          {\n            return ECMA_VALUE_NOT_FOUND;\n          }\n\n          JERRY_ASSERT (ECMA_PROPERTY_IS_RAW (*property_p));\n\n          ecma_property_value_t *prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n          if (!(*property_p & ECMA_PROPERTY_FLAG_DATA))\n          {\n            prop_value_p = ecma_get_property_value_from_named_reference (prop_value_p);\n\n            if (JERRY_UNLIKELY (prop_value_p->value == ECMA_VALUE_UNINITIALIZED))\n            {\n              return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);\n            }\n          }\n\n          return ecma_fast_copy_value (prop_value_p->value);\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n      }\n      break;\n    }\n    case ECMA_OBJECT_BASE_TYPE_ARRAY:\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      if (ecma_string_is_length (property_name_p))\n      {\n        return ecma_make_uint32_value (ext_object_p->u.array.length);\n      }\n\n      if (JERRY_LIKELY (ecma_op_array_is_fast_array (ext_object_p)))\n      {\n        uint32_t index = ecma_string_get_array_index (property_name_p);\n\n        if (JERRY_LIKELY (index != ECMA_STRING_NOT_ARRAY_INDEX))\n        {\n          if (JERRY_LIKELY (index < ext_object_p->u.array.length))\n          {\n            ecma_value_t *values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n\n            return (ecma_is_value_array_hole (values_p[index]) ? ECMA_VALUE_NOT_FOUND\n                                                               : ecma_fast_copy_value (values_p[index]));\n          }\n        }\n        return ECMA_VALUE_NOT_FOUND;\n      }\n\n      break;\n    }\n    default:\n    {\n      break;\n    }\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (object_p, property_name_p);\n\n  if (property_p == NULL)\n  {\n    switch (ecma_get_object_type (object_p))\n    {\n      case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n      {\n        if (ecma_builtin_function_is_routine (object_p))\n        {\n          property_p = ecma_builtin_routine_try_to_instantiate_property (object_p, property_name_p);\n          break;\n        }\n        /* FALLTHRU */\n      }\n      case ECMA_OBJECT_TYPE_BUILT_IN_GENERAL:\n      case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:\n      case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:\n      {\n        property_p = ecma_builtin_try_to_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_CLASS:\n      {\n        if (((ecma_extended_object_t *) object_p)->u.cls.type == ECMA_OBJECT_CLASS_ARGUMENTS)\n        {\n          property_p = ecma_op_arguments_object_try_to_lazy_instantiate_property (object_p, property_name_p);\n        }\n        break;\n      }\n      case ECMA_OBJECT_TYPE_FUNCTION:\n      {\n        /* Get prototype physical property. */\n        property_p = ecma_op_function_try_to_lazy_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:\n      {\n        property_p = ecma_op_external_function_try_to_lazy_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n      {\n        property_p = ecma_op_bound_function_try_to_lazy_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      default:\n      {\n        break;\n      }\n    }\n\n    if (property_p == NULL)\n    {\n      return ECMA_VALUE_NOT_FOUND;\n    }\n  }\n\n  JERRY_ASSERT (ECMA_PROPERTY_IS_RAW (*property_p));\n\n  ecma_property_value_t *prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n  if (*property_p & ECMA_PROPERTY_FLAG_DATA)\n  {\n    return ecma_fast_copy_value (prop_value_p->value);\n  }\n\n  return ecma_op_invoke_getter (ecma_get_named_accessor_property (prop_value_p), base_value);\n} /* ecma_op_object_find_own */\n\n/**\n * Search the value corresponding to a property index\n *\n * Note: this method falls back to the general ecma_op_object_find\n *\n * @return ecma value if property is found\n *         ECMA_VALUE_NOT_FOUND if property is not found\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_object_find_by_index (ecma_object_t *object_p, /**< the object */\n                              ecma_length_t index) /**< property index */\n{\n  if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))\n  {\n    return ecma_op_object_find (object_p, ECMA_CREATE_DIRECT_UINT32_STRING (index));\n  }\n\n  ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);\n  ecma_value_t ret_value = ecma_op_object_find (object_p, index_str_p);\n  ecma_deref_ecma_string (index_str_p);\n\n  return ret_value;\n} /* ecma_op_object_find_by_index */\n\n/**\n * Search the value corresponding to a property name\n *\n * Note: search includes prototypes\n *\n * @return ecma value if property is found\n *         ECMA_VALUE_NOT_FOUND if property is not found\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_object_find (ecma_object_t *object_p, /**< the object */\n                     ecma_string_t *property_name_p) /**< property name */\n{\n  ecma_value_t base_value = ecma_make_object_value (object_p);\n\n  while (true)\n  {\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_OBJECT_IS_PROXY (object_p))\n    {\n      return ecma_proxy_object_find (object_p, property_name_p);\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    ecma_value_t value = ecma_op_object_find_own (base_value, object_p, property_name_p);\n\n    if (ecma_is_value_found (value))\n    {\n      return value;\n    }\n\n    if (object_p->u2.prototype_cp == JMEM_CP_NULL)\n    {\n      break;\n    }\n\n    object_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, object_p->u2.prototype_cp);\n  }\n\n  return ECMA_VALUE_NOT_FOUND;\n} /* ecma_op_object_find */\n\n/**\n * [[Get]] operation of ecma object\n *\n * This function returns the value of a named property, or undefined\n * if the property is not found in the prototype chain. If the property\n * is an accessor, it calls the \"get\" callback function and returns\n * with its result (including error throws).\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_object_get (ecma_object_t *object_p, /**< the object */\n                    ecma_string_t *property_name_p) /**< property name */\n{\n  return ecma_op_object_get_with_receiver (object_p, property_name_p, ecma_make_object_value (object_p));\n} /* ecma_op_object_get */\n\n/**\n * [[Get]] operation of ecma object with the specified receiver\n *\n * This function returns the value of a named property, or undefined\n * if the property is not found in the prototype chain. If the property\n * is an accessor, it calls the \"get\" callback function and returns\n * with its result (including error throws).\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_object_get_with_receiver (ecma_object_t *object_p, /**< the object */\n                                  ecma_string_t *property_name_p, /**< property name */\n                                  ecma_value_t receiver) /**< receiver to invoke getter function */\n{\n  while (true)\n  {\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_OBJECT_IS_PROXY (object_p))\n    {\n      return ecma_proxy_object_get (object_p, property_name_p, receiver);\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    ecma_value_t value = ecma_op_object_find_own (receiver, object_p, property_name_p);\n\n    if (ecma_is_value_found (value))\n    {\n      return value;\n    }\n\n    jmem_cpointer_t proto_cp = ecma_op_ordinary_object_get_prototype_of (object_p);\n\n    if (proto_cp == JMEM_CP_NULL)\n    {\n      break;\n    }\n\n    object_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, proto_cp);\n  }\n\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_op_object_get_with_receiver */\n\n/**\n * [[Get]] operation of ecma object specified for property index\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_object_get_by_index (ecma_object_t *object_p, /**< the object */\n                             ecma_length_t index) /**< property index */\n{\n  if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))\n  {\n    return ecma_op_object_get (object_p, ECMA_CREATE_DIRECT_UINT32_STRING (index));\n  }\n\n  ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);\n  ecma_value_t ret_value = ecma_op_object_get (object_p, index_str_p);\n  ecma_deref_ecma_string (index_str_p);\n\n  return ret_value;\n} /* ecma_op_object_get_by_index */\n\n/**\n * Perform ToLength(O.[[Get]](\"length\")) operation\n *\n * The property is converted to uint32 during the operation\n *\n * @return ECMA_VALUE_ERROR - if there was any error during the operation\n *         ECMA_VALUE_EMPTY - otherwise\n */\necma_value_t\necma_op_object_get_length (ecma_object_t *object_p, /**< the object */\n                           ecma_length_t *length_p) /**< [out] length value converted to uint32 */\n{\n  if (JERRY_LIKELY (ecma_get_object_base_type (object_p) == ECMA_OBJECT_BASE_TYPE_ARRAY))\n  {\n    *length_p = (ecma_length_t) ecma_array_get_length (object_p);\n    return ECMA_VALUE_EMPTY;\n  }\n\n  ecma_value_t len_value = ecma_op_object_get_by_magic_id (object_p, LIT_MAGIC_STRING_LENGTH);\n  ecma_value_t len_number = ecma_op_to_length (len_value, length_p);\n  ecma_free_value (len_value);\n\n  JERRY_ASSERT (ECMA_IS_VALUE_ERROR (len_number) || ecma_is_value_empty (len_number));\n\n  return len_number;\n} /* ecma_op_object_get_length */\n\n/**\n * [[Get]] operation of ecma object where the property name is a magic string\n *\n * This function returns the value of a named property, or undefined\n * if the property is not found in the prototype chain. If the property\n * is an accessor, it calls the \"get\" callback function and returns\n * with its result (including error throws).\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_object_get_by_magic_id (ecma_object_t *object_p, /**< the object */\n                                lit_magic_string_id_t property_id) /**< property magic string id */\n{\n  return ecma_op_object_get (object_p, ecma_get_magic_string (property_id));\n} /* ecma_op_object_get_by_magic_id */\n\n/**\n * Descriptor string for each global symbol\n */\nstatic const uint16_t ecma_global_symbol_descriptions[] = {\n  LIT_MAGIC_STRING_ASYNC_ITERATOR, LIT_MAGIC_STRING_HAS_INSTANCE,  LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE,\n  LIT_MAGIC_STRING_ITERATOR,       LIT_MAGIC_STRING_MATCH,         LIT_MAGIC_STRING_REPLACE,\n  LIT_MAGIC_STRING_SEARCH,         LIT_MAGIC_STRING_SPECIES,       LIT_MAGIC_STRING_SPLIT,\n  LIT_MAGIC_STRING_TO_PRIMITIVE,   LIT_MAGIC_STRING_TO_STRING_TAG, LIT_MAGIC_STRING_UNSCOPABLES,\n  LIT_MAGIC_STRING_MATCH_ALL,\n};\n\nJERRY_STATIC_ASSERT (sizeof (ecma_global_symbol_descriptions) / sizeof (uint16_t) == ECMA_BUILTIN_GLOBAL_SYMBOL_COUNT,\n                     ecma_global_symbol_descriptions_must_have_global_symbol_count_elements);\n\n/**\n * [[Get]] a well-known symbol by the given property id\n *\n * @return pointer to the requested well-known symbol\n */\necma_string_t *\necma_op_get_global_symbol (lit_magic_string_id_t property_id) /**< property symbol id */\n{\n  JERRY_ASSERT (LIT_IS_GLOBAL_SYMBOL (property_id));\n\n  uint32_t symbol_index = (uint32_t) property_id - (uint32_t) LIT_GLOBAL_SYMBOL__FIRST;\n  jmem_cpointer_t symbol_cp = JERRY_CONTEXT (global_symbols_cp)[symbol_index];\n\n  if (symbol_cp != JMEM_CP_NULL)\n  {\n    ecma_string_t *symbol_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, symbol_cp);\n    ecma_ref_ecma_string (symbol_p);\n    return symbol_p;\n  }\n\n  ecma_string_t *symbol_dot_p = ecma_get_magic_string (LIT_MAGIC_STRING_SYMBOL_DOT_UL);\n  uint16_t description = ecma_global_symbol_descriptions[symbol_index];\n  ecma_string_t *name_p = ecma_get_magic_string ((lit_magic_string_id_t) description);\n  ecma_string_t *descriptor_p = ecma_concat_ecma_strings (symbol_dot_p, name_p);\n\n  ecma_string_t *symbol_p = ecma_new_symbol_from_descriptor_string (ecma_make_string_value (descriptor_p));\n  symbol_p->u.hash = (uint16_t) ((property_id << ECMA_SYMBOL_FLAGS_SHIFT) | ECMA_SYMBOL_FLAG_GLOBAL);\n\n  ECMA_SET_NON_NULL_POINTER (JERRY_CONTEXT (global_symbols_cp)[symbol_index], symbol_p);\n\n  ecma_ref_ecma_string (symbol_p);\n  return symbol_p;\n} /* ecma_op_get_global_symbol */\n\n/**\n * Checks whether the string equals to the global symbol.\n *\n * @return true - if the string equals to the global symbol\n *         false - otherwise\n */\nbool\necma_op_compare_string_to_global_symbol (ecma_string_t *string_p, /**< string to compare */\n                                         lit_magic_string_id_t property_id) /**< property symbol id */\n{\n  JERRY_ASSERT (LIT_IS_GLOBAL_SYMBOL (property_id));\n\n  uint32_t symbol_index = (uint32_t) property_id - (uint32_t) LIT_GLOBAL_SYMBOL__FIRST;\n  jmem_cpointer_t symbol_cp = JERRY_CONTEXT (global_symbols_cp)[symbol_index];\n\n  return (symbol_cp != JMEM_CP_NULL && string_p == ECMA_GET_NON_NULL_POINTER (ecma_string_t, symbol_cp));\n} /* ecma_op_compare_string_to_global_symbol */\n\n/**\n * [[Get]] operation of ecma object where the property is a well-known symbol\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_object_get_by_symbol_id (ecma_object_t *object_p, /**< the object */\n                                 lit_magic_string_id_t property_id) /**< property symbol id */\n{\n  ecma_string_t *symbol_p = ecma_op_get_global_symbol (property_id);\n  ecma_value_t ret_value = ecma_op_object_get (object_p, symbol_p);\n  ecma_deref_ecma_string (symbol_p);\n\n  return ret_value;\n} /* ecma_op_object_get_by_symbol_id */\n\n/**\n * GetMethod operation\n *\n * See also: ECMA-262 v6, 7.3.9\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator function object - if success\n *         raised error - otherwise\n */\nstatic ecma_value_t\necma_op_get_method (ecma_value_t value, /**< ecma value */\n                    ecma_string_t *prop_name_p) /**< property name */\n{\n  /* 2. */\n  ecma_value_t obj_value = ecma_op_to_object (value);\n\n  if (ECMA_IS_VALUE_ERROR (obj_value))\n  {\n    return obj_value;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (obj_value);\n  ecma_value_t func;\n\n  func = ecma_op_object_get (obj_p, prop_name_p);\n  ecma_deref_object (obj_p);\n\n  /* 3. */\n  if (ECMA_IS_VALUE_ERROR (func))\n  {\n    return func;\n  }\n\n  /* 4. */\n  if (ecma_is_value_undefined (func) || ecma_is_value_null (func))\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  /* 5. */\n  if (!ecma_op_is_callable (func))\n  {\n    ecma_free_value (func);\n    return ecma_raise_type_error (ECMA_ERR_ITERATOR_IS_NOT_CALLABLE);\n  }\n\n  /* 6. */\n  return func;\n} /* ecma_op_get_method */\n\n/**\n * GetMethod operation when the property is a well-known symbol\n *\n * See also: ECMA-262 v6, 7.3.9\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator function object - if success\n *         raised error - otherwise\n */\necma_value_t\necma_op_get_method_by_symbol_id (ecma_value_t value, /**< ecma value */\n                                 lit_magic_string_id_t symbol_id) /**< property symbol id */\n{\n  ecma_string_t *prop_name_p = ecma_op_get_global_symbol (symbol_id);\n  ecma_value_t ret_value = ecma_op_get_method (value, prop_name_p);\n  ecma_deref_ecma_string (prop_name_p);\n\n  return ret_value;\n} /* ecma_op_get_method_by_symbol_id */\n\n/**\n * GetMethod operation when the property is a magic string\n *\n * See also: ECMA-262 v6, 7.3.9\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator function object - if success\n *         raised error - otherwise\n */\necma_value_t\necma_op_get_method_by_magic_id (ecma_value_t value, /**< ecma value */\n                                lit_magic_string_id_t magic_id) /**< property magic id */\n{\n  return ecma_op_get_method (value, ecma_get_magic_string (magic_id));\n} /* ecma_op_get_method_by_magic_id */\n\n/**\n * [[Put]] ecma general object's operation specialized for property index\n *\n * Note: This function falls back to the general ecma_op_object_put\n *\n * @return ecma value\n *         The returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_object_put_by_index (ecma_object_t *object_p, /**< the object */\n                             ecma_length_t index, /**< property index */\n                             ecma_value_t value, /**< ecma value */\n                             bool is_throw) /**< flag that controls failure handling */\n{\n  if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))\n  {\n    return ecma_op_object_put (object_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), value, is_throw);\n  }\n\n  ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);\n  ecma_value_t ret_value = ecma_op_object_put (object_p, index_str_p, value, is_throw);\n  ecma_deref_ecma_string (index_str_p);\n\n  return ret_value;\n} /* ecma_op_object_put_by_index */\n\n/**\n * [[Put]] ecma general object's operation\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *          ECMA-262 v5, 8.12.5\n *          Also incorporates [[CanPut]] ECMA-262 v5, 8.12.4\n *\n * @return ecma value\n *         The returned value must be freed with ecma_free_value.\n *\n *         Returns with ECMA_VALUE_TRUE if the operation is\n *         successful. Otherwise it returns with an error object\n *         or ECMA_VALUE_FALSE.\n *\n *         Note: even if is_throw is false, the setter can throw an\n *         error, and this function returns with that error.\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_object_put (ecma_object_t *object_p, /**< the object */\n                    ecma_string_t *property_name_p, /**< property name */\n                    ecma_value_t value, /**< ecma value */\n                    bool is_throw) /**< flag that controls failure handling */\n{\n  return ecma_op_object_put_with_receiver (object_p,\n                                           property_name_p,\n                                           value,\n                                           ecma_make_object_value (object_p),\n                                           is_throw);\n} /* ecma_op_object_put */\n\n/**\n * [[Set]] ( P, V, Receiver) operation part for ordinary objects\n *\n * See also: ECMAScript v6, 9.19.9\n *\n * @return ecma value\n *         The returned value must be freed with ecma_free_value.\n */\nstatic ecma_value_t\necma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */\n                                   ecma_string_t *property_name_p, /**< property name */\n                                   ecma_value_t value, /**< value to set */\n                                   bool is_throw) /**< flag that controls failure handling */\n{\n  /* 5.b */\n  if (!ecma_is_value_object (receiver))\n  {\n    return ECMA_REJECT (is_throw, ECMA_ERR_RECEIVER_MUST_BE_AN_OBJECT);\n  }\n\n  ecma_object_t *receiver_obj_p = ecma_get_object_from_value (receiver);\n\n  ecma_property_descriptor_t prop_desc;\n  /* 5.c */\n  ecma_value_t status = ecma_op_object_get_own_property_descriptor (receiver_obj_p, property_name_p, &prop_desc);\n\n  /* 5.d */\n  if (ECMA_IS_VALUE_ERROR (status))\n  {\n    return status;\n  }\n\n  /* 5.e */\n  if (ecma_is_value_true (status))\n  {\n    ecma_value_t result;\n\n    /* 5.e.i - 5.e.ii */\n    if (prop_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)\n        || !(prop_desc.flags & JERRY_PROP_IS_WRITABLE))\n    {\n      result = ecma_raise_property_redefinition (property_name_p, prop_desc.flags);\n    }\n    else\n    {\n      /* 5.e.iii */\n      JERRY_ASSERT (prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED);\n      ecma_free_value (prop_desc.value);\n      prop_desc.value = ecma_copy_value (value);\n\n      /* 5.e.iv */\n      result = ecma_op_object_define_own_property (receiver_obj_p, property_name_p, &prop_desc);\n\n      if (JERRY_UNLIKELY (ecma_is_value_false (result)))\n      {\n        result = ECMA_REJECT (is_throw, ECMA_ERR_PROXY_TRAP_RETURNED_FALSISH);\n      }\n    }\n\n    ecma_free_property_descriptor (&prop_desc);\n\n    return result;\n  }\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (receiver_obj_p))\n  {\n    ecma_property_descriptor_t desc;\n    /* Based on: ES6 9.1.9 [[Set]] 4.d.i. / ES11 9.1.9.2 OrdinarySetWithOwnDescriptor 2.c.i. */\n    desc.flags = (JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE\n                  | JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_WRITABLE_DEFINED\n                  | JERRY_PROP_IS_VALUE_DEFINED);\n    desc.value = value;\n    ecma_value_t ret_value = ecma_proxy_object_define_own_property (receiver_obj_p, property_name_p, &desc);\n\n    if (JERRY_UNLIKELY (ecma_is_value_false (ret_value)))\n    {\n      ret_value = ECMA_REJECT (is_throw, ECMA_ERR_PROXY_TRAP_RETURNED_FALSISH);\n    }\n\n    return ret_value;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  if (JERRY_UNLIKELY (ecma_op_object_is_fast_array (receiver_obj_p)))\n  {\n    ecma_fast_array_convert_to_normal (receiver_obj_p);\n  }\n\n  /* 5.f.i */\n  ecma_property_value_t *new_prop_value_p;\n  new_prop_value_p = ecma_create_named_data_property (receiver_obj_p,\n                                                      property_name_p,\n                                                      ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                      NULL);\n  JERRY_ASSERT (ecma_is_value_undefined (new_prop_value_p->value));\n  new_prop_value_p->value = ecma_copy_value_if_not_object (value);\n\n  return ECMA_VALUE_TRUE;\n} /* ecma_op_object_put_apply_receiver */\n\n/**\n * [[Put]] ecma general object's operation with given receiver\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *          ECMA-262 v5, 8.12.5\n *          ECMA-262 v6, 9.1.9\n *          Also incorporates [[CanPut]] ECMA-262 v5, 8.12.4\n *\n * @return ecma value\n *         The returned value must be freed with ecma_free_value.\n *\n *         Returns with ECMA_VALUE_TRUE if the operation is\n *         successful. Otherwise it returns with an error object\n *         or ECMA_VALUE_FALSE.\n *\n *         Note: even if is_throw is false, the setter can throw an\n *         error, and this function returns with that error.\n */\necma_value_t\necma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */\n                                  ecma_string_t *property_name_p, /**< property name */\n                                  ecma_value_t value, /**< ecma value */\n                                  ecma_value_t receiver, /**< receiver */\n                                  bool is_throw) /**< flag that controls failure handling */\n{\n  JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));\n  JERRY_ASSERT (property_name_p != NULL);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (object_p))\n  {\n    return ecma_proxy_object_set (object_p, property_name_p, value, receiver, is_throw);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_object_base_type_t base_type = ecma_get_object_base_type (object_p);\n\n  switch (base_type)\n  {\n    case ECMA_OBJECT_BASE_TYPE_CLASS:\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      switch (ext_object_p->u.cls.type)\n      {\n        case ECMA_OBJECT_CLASS_ARGUMENTS:\n        {\n          if (!(ext_object_p->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED))\n          {\n            break;\n          }\n\n          uint32_t index = ecma_string_get_array_index (property_name_p);\n\n          if (index < ext_object_p->u.cls.u2.formal_params_number)\n          {\n            ecma_mapped_arguments_t *mapped_arguments_p = (ecma_mapped_arguments_t *) ext_object_p;\n\n            ecma_value_t *argv_p = (ecma_value_t *) (mapped_arguments_p + 1);\n\n            if (!ecma_is_value_empty (argv_p[index]) && argv_p[index] != ECMA_VALUE_ARGUMENT_NO_TRACK)\n            {\n              ecma_string_t *name_p = ecma_op_arguments_object_get_formal_parameter (mapped_arguments_p, index);\n              ecma_object_t *lex_env_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env);\n              ecma_op_set_mutable_binding (lex_env_p, name_p, value, true);\n              return ECMA_VALUE_TRUE;\n            }\n          }\n          break;\n        }\n#if JERRY_BUILTIN_TYPEDARRAY\n        /* ES2015 9.4.5.5 */\n        case ECMA_OBJECT_CLASS_TYPEDARRAY:\n        {\n          if (ecma_prop_name_is_symbol (property_name_p))\n          {\n            break;\n          }\n\n          uint32_t index = ecma_string_get_array_index (property_name_p);\n\n          if (index == ECMA_STRING_NOT_ARRAY_INDEX)\n          {\n            JERRY_ASSERT (index == UINT32_MAX);\n\n            if (!ecma_typedarray_is_element_index (property_name_p))\n            {\n              break;\n            }\n          }\n\n          ecma_typedarray_info_t info = ecma_typedarray_get_info (object_p);\n          return ecma_set_typedarray_element (&info, value, index);\n        }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_MODULE_SYSTEM\n        case ECMA_OBJECT_CLASS_MODULE_NAMESPACE:\n        {\n          return ecma_raise_readonly_assignment (property_name_p, is_throw);\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n      }\n      break;\n    }\n    case ECMA_OBJECT_BASE_TYPE_ARRAY:\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n      if (ecma_string_is_length (property_name_p))\n      {\n        if (ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count))\n        {\n          return ecma_op_array_object_set_length (object_p, value, 0);\n        }\n\n        return ecma_raise_readonly_assignment (property_name_p, is_throw);\n      }\n\n      if (JERRY_LIKELY (ecma_op_array_is_fast_array (ext_object_p)))\n      {\n        uint32_t index = ecma_string_get_array_index (property_name_p);\n\n        if (JERRY_UNLIKELY (index == ECMA_STRING_NOT_ARRAY_INDEX))\n        {\n          ecma_fast_array_convert_to_normal (object_p);\n        }\n        else if (ecma_fast_array_set_property (object_p, index, value))\n        {\n          return ECMA_VALUE_TRUE;\n        }\n      }\n\n      JERRY_ASSERT (!ecma_op_object_is_fast_array (object_p));\n      break;\n    }\n    default:\n    {\n      break;\n    }\n  }\n\n  ecma_property_t *property_p = ecma_find_named_property (object_p, property_name_p);\n\n  if (property_p == NULL)\n  {\n    switch (ecma_get_object_type (object_p))\n    {\n      case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n      {\n        if (ecma_builtin_function_is_routine (object_p))\n        {\n          property_p = ecma_builtin_routine_try_to_instantiate_property (object_p, property_name_p);\n          break;\n        }\n        /* FALLTHRU */\n      }\n      case ECMA_OBJECT_TYPE_BUILT_IN_GENERAL:\n      case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:\n      case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:\n      {\n        property_p = ecma_builtin_try_to_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_CLASS:\n      {\n        ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n        switch (ext_object_p->u.cls.type)\n        {\n          case ECMA_OBJECT_CLASS_STRING:\n          {\n            uint32_t index = ecma_string_get_array_index (property_name_p);\n\n            if (index != ECMA_STRING_NOT_ARRAY_INDEX)\n            {\n              ecma_value_t prim_value_p = ext_object_p->u.cls.u3.value;\n              ecma_string_t *prim_value_str_p = ecma_get_string_from_value (prim_value_p);\n\n              if (index < ecma_string_get_length (prim_value_str_p))\n              {\n                return ecma_raise_readonly_assignment (property_name_p, is_throw);\n              }\n            }\n            break;\n          }\n          case ECMA_OBJECT_CLASS_ARGUMENTS:\n          {\n            property_p = ecma_op_arguments_object_try_to_lazy_instantiate_property (object_p, property_name_p);\n            break;\n          }\n        }\n        break;\n      }\n      case ECMA_OBJECT_TYPE_FUNCTION:\n      {\n        if (ecma_string_is_length (property_name_p))\n        {\n          /* Uninitialized 'length' property is non-writable (ECMA-262 v6, 19.2.4.1) */\n          if (!ECMA_GET_FIRST_BIT_FROM_POINTER_TAG (((ecma_extended_object_t *) object_p)->u.function.scope_cp))\n          {\n            return ecma_raise_readonly_assignment (property_name_p, is_throw);\n          }\n        }\n\n        /* Get prototype physical property. */\n        property_p = ecma_op_function_try_to_lazy_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:\n      {\n        property_p = ecma_op_external_function_try_to_lazy_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n      {\n        property_p = ecma_op_bound_function_try_to_lazy_instantiate_property (object_p, property_name_p);\n        break;\n      }\n      default:\n      {\n        break;\n      }\n    }\n  }\n\n  ecma_getter_setter_pointers_t *get_set_pair_p = NULL;\n  jmem_cpointer_t setter_cp = JMEM_CP_NULL;\n\n  if (property_p != NULL)\n  {\n    JERRY_ASSERT (ECMA_PROPERTY_IS_RAW (*property_p));\n\n    if (*property_p & ECMA_PROPERTY_FLAG_DATA)\n    {\n      if (ecma_is_property_writable (*property_p))\n      {\n        if (ecma_make_object_value (object_p) != receiver)\n        {\n          return ecma_op_object_put_apply_receiver (receiver, property_name_p, value, is_throw);\n        }\n\n        /* There is no need for special casing arrays here because changing the\n         * value of an existing property never changes the length of an array. */\n        ecma_named_data_property_assign_value (object_p, ECMA_PROPERTY_VALUE_PTR (property_p), value);\n        return ECMA_VALUE_TRUE;\n      }\n    }\n    else\n    {\n      get_set_pair_p = ecma_get_named_accessor_property (ECMA_PROPERTY_VALUE_PTR (property_p));\n      setter_cp = get_set_pair_p->setter_cp;\n    }\n  }\n  else\n  {\n    bool create_new_property = true;\n\n    jmem_cpointer_t obj_cp;\n    ECMA_SET_NON_NULL_POINTER (obj_cp, object_p);\n    ecma_object_t *proto_p = object_p;\n\n    while (true)\n    {\n      obj_cp = ecma_op_ordinary_object_get_prototype_of (proto_p);\n\n      if (obj_cp == JMEM_CP_NULL)\n      {\n        break;\n      }\n\n      ecma_property_ref_t property_ref = { NULL };\n      proto_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, obj_cp);\n\n#if JERRY_BUILTIN_PROXY\n      if (ECMA_OBJECT_IS_PROXY (proto_p))\n      {\n        return ecma_op_object_put_with_receiver (proto_p, property_name_p, value, receiver, is_throw);\n      }\n#endif /* JERRY_BUILTIN_PROXY */\n\n      ecma_property_t inherited_property =\n        ecma_op_object_get_own_property (proto_p, property_name_p, &property_ref, ECMA_PROPERTY_GET_NO_OPTIONS);\n\n      if (ECMA_PROPERTY_IS_FOUND (inherited_property))\n      {\n        JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (inherited_property));\n\n        if (!(inherited_property & ECMA_PROPERTY_FLAG_DATA))\n        {\n          get_set_pair_p = ecma_get_named_accessor_property (property_ref.value_p);\n          setter_cp = get_set_pair_p->setter_cp;\n          create_new_property = false;\n          break;\n        }\n\n        create_new_property = ecma_is_property_writable (inherited_property);\n        break;\n      }\n\n      JERRY_ASSERT (inherited_property == ECMA_PROPERTY_TYPE_NOT_FOUND\n                    || inherited_property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);\n    }\n\n#if JERRY_BUILTIN_PROXY\n    if (create_new_property && ecma_is_value_object (receiver)\n        && ECMA_OBJECT_IS_PROXY (ecma_get_object_from_value (receiver)))\n    {\n      return ecma_op_object_put_apply_receiver (receiver, property_name_p, value, is_throw);\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    if (create_new_property && ecma_op_ordinary_object_is_extensible (object_p))\n    {\n      const ecma_object_base_type_t obj_base_type = ecma_get_object_base_type (object_p);\n\n      if (obj_base_type == ECMA_OBJECT_BASE_TYPE_CLASS)\n      {\n        ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n        if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_ARGUMENTS\n            && ext_object_p->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED)\n        {\n          const uint32_t flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;\n          return ecma_builtin_helper_def_prop (object_p, property_name_p, value, flags);\n        }\n      }\n\n      uint32_t index = ecma_string_get_array_index (property_name_p);\n\n      if (obj_base_type == ECMA_OBJECT_BASE_TYPE_ARRAY && index != ECMA_STRING_NOT_ARRAY_INDEX)\n      {\n        ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n        if (index < UINT32_MAX && index >= ext_object_p->u.array.length)\n        {\n          if (!ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count))\n          {\n            return ecma_raise_readonly_assignment (property_name_p, is_throw);\n          }\n\n          ext_object_p->u.array.length = index + 1;\n        }\n      }\n\n      return ecma_op_object_put_apply_receiver (receiver, property_name_p, value, is_throw);\n\n      ecma_property_value_t *new_prop_value_p;\n      new_prop_value_p = ecma_create_named_data_property (object_p,\n                                                          property_name_p,\n                                                          ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                          NULL);\n\n      JERRY_ASSERT (ecma_is_value_undefined (new_prop_value_p->value));\n      new_prop_value_p->value = ecma_copy_value_if_not_object (value);\n      return ECMA_VALUE_TRUE;\n    }\n  }\n\n  if (setter_cp == JMEM_CP_NULL)\n  {\n    return ecma_raise_readonly_assignment (property_name_p, is_throw);\n  }\n\n  ecma_value_t ret_value = ecma_op_invoke_setter (get_set_pair_p, receiver, value);\n\n  if (!ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    ecma_fast_free_value (ret_value);\n    ret_value = ECMA_VALUE_TRUE;\n  }\n\n  return ret_value;\n} /* ecma_op_object_put_with_receiver */\n\n/**\n * [[Delete]] ecma object's operation specialized for property index\n *\n * Note:\n *      This method falls back to the general ecma_op_object_delete\n *\n * @return true - if deleted successfully\n *         false - or type error otherwise (based in 'is_throw')\n */\necma_value_t\necma_op_object_delete_by_index (ecma_object_t *obj_p, /**< the object */\n                                ecma_length_t index, /**< property index */\n                                bool is_throw) /**< flag that controls failure handling */\n{\n  if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))\n  {\n    return ecma_op_object_delete (obj_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), is_throw);\n    ;\n  }\n\n  ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);\n  ecma_value_t ret_value = ecma_op_object_delete (obj_p, index_str_p, is_throw);\n  ecma_deref_ecma_string (index_str_p);\n\n  return ret_value;\n} /* ecma_op_object_delete_by_index */\n\n/**\n * [[Delete]] ecma object's operation\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *\n * Note:\n *      returned value must be freed with ecma_free_value\n *\n * @return true - if deleted successfully\n *         false - or type error otherwise (based in 'is_throw')\n */\necma_value_t\necma_op_object_delete (ecma_object_t *obj_p, /**< the object */\n                       ecma_string_t *property_name_p, /**< property name */\n                       bool is_strict) /**< flag that controls failure handling */\n{\n  JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));\n  JERRY_ASSERT (property_name_p != NULL);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    return ecma_proxy_object_delete_property (obj_p, property_name_p, is_strict);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p));\n\n  return ecma_op_general_object_delete (obj_p, property_name_p, is_strict);\n} /* ecma_op_object_delete */\n\n/**\n * [[DefaultValue]] ecma object's operation\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_object_default_value (ecma_object_t *obj_p, /**< the object */\n                              ecma_preferred_type_hint_t hint) /**< hint on preferred result type */\n{\n  JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));\n\n  JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p));\n\n  /*\n   * typedef ecma_property_t * (*default_value_ptr_t) (ecma_object_t *, ecma_string_t *);\n   * static const default_value_ptr_t default_value [ECMA_OBJECT_TYPE__COUNT] =\n   * {\n   *   [ECMA_OBJECT_TYPE_GENERAL]           = &ecma_op_general_object_default_value,\n   *   [ECMA_OBJECT_TYPE_CLASS]             = &ecma_op_general_object_default_value,\n   *   [ECMA_OBJECT_TYPE_FUNCTION]          = &ecma_op_general_object_default_value,\n   *   [ECMA_OBJECT_TYPE_NATIVE_FUNCTION]   = &ecma_op_general_object_default_value,\n   *   [ECMA_OBJECT_TYPE_ARRAY]             = &ecma_op_general_object_default_value,\n   *   [ECMA_OBJECT_TYPE_BOUND_FUNCTION]    = &ecma_op_general_object_default_value,\n   *   [ECMA_OBJECT_TYPE_PSEUDO_ARRAY]      = &ecma_op_general_object_default_value\n   * };\n   *\n   * return default_value[type] (obj_p, property_name_p);\n   */\n\n  return ecma_op_general_object_default_value (obj_p, hint);\n} /* ecma_op_object_default_value */\n\n/**\n * [[DefineOwnProperty]] ecma object's operation\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */\n                                    ecma_string_t *property_name_p, /**< property name */\n                                    const ecma_property_descriptor_t *property_desc_p) /**< property\n                                                                                        *   descriptor */\n{\n  JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));\n  JERRY_ASSERT (property_name_p != NULL);\n\n  const ecma_object_type_t type = ecma_get_object_type (obj_p);\n\n  switch (type)\n  {\n    case ECMA_OBJECT_TYPE_CLASS:\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n\n      switch (ext_object_p->u.cls.type)\n      {\n        case ECMA_OBJECT_CLASS_ARGUMENTS:\n        {\n          return ecma_op_arguments_object_define_own_property (obj_p, property_name_p, property_desc_p);\n        }\n#if JERRY_BUILTIN_TYPEDARRAY\n        /* ES2015 9.4.5.1 */\n        case ECMA_OBJECT_CLASS_TYPEDARRAY:\n        {\n          return ecma_op_typedarray_define_own_property (obj_p, property_name_p, property_desc_p);\n        }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n      }\n      break;\n    }\n    case ECMA_OBJECT_TYPE_ARRAY:\n    case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:\n    {\n      return ecma_op_array_object_define_own_property (obj_p, property_name_p, property_desc_p);\n    }\n#if JERRY_BUILTIN_PROXY\n    case ECMA_OBJECT_TYPE_PROXY:\n    {\n      return ecma_proxy_object_define_own_property (obj_p, property_name_p, property_desc_p);\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n    default:\n    {\n      break;\n    }\n  }\n\n  return ecma_op_general_object_define_own_property (obj_p, property_name_p, property_desc_p);\n} /* ecma_op_object_define_own_property */\n\n/**\n * Get property descriptor from specified property\n *\n * depending on the property type the following fields are set:\n *   - for named data properties: { [Value], [Writable], [Enumerable], [Configurable] };\n *   - for named accessor properties: { [Get] - if defined,\n *                                      [Set] - if defined,\n *                                      [Enumerable], [Configurable]\n *                                    }.\n *\n * The output property descriptor will always be initialized to an empty descriptor.\n *\n * @return ECMA_VALUE_ERROR - if the Proxy.[[GetOwnProperty]] operation raises error\n *         ECMA_VALUE_{TRUE, FALSE} - if property found or not\n */\necma_value_t\necma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the object */\n                                            ecma_string_t *property_name_p, /**< property name */\n                                            ecma_property_descriptor_t *prop_desc_p) /**< property descriptor */\n{\n  *prop_desc_p = ecma_make_empty_property_descriptor ();\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (object_p))\n  {\n    return ecma_proxy_object_get_own_property_descriptor (object_p, property_name_p, prop_desc_p);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_property_ref_t property_ref;\n  property_ref.virtual_value = ECMA_VALUE_EMPTY;\n  ecma_property_t property =\n    ecma_op_object_get_own_property (object_p, property_name_p, &property_ref, ECMA_PROPERTY_GET_VALUE);\n\n  if (!ECMA_PROPERTY_IS_FOUND (property))\n  {\n#if JERRY_BUILTIN_TYPEDARRAY\n    if (JERRY_UNLIKELY (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_THROW))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n    JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);\n\n    return ECMA_VALUE_FALSE;\n  }\n\n  uint32_t flags = ecma_is_property_enumerable (property) ? JERRY_PROP_IS_ENUMERABLE : JERRY_PROP_NO_OPTS;\n  flags |= ecma_is_property_configurable (property) ? JERRY_PROP_IS_CONFIGURABLE : JERRY_PROP_NO_OPTS;\n\n  prop_desc_p->flags = (uint16_t) (JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE_DEFINED | flags);\n\n  if (property & ECMA_PROPERTY_FLAG_DATA)\n  {\n    if (!ECMA_PROPERTY_IS_VIRTUAL (property))\n    {\n      prop_desc_p->value = ecma_copy_value (property_ref.value_p->value);\n    }\n    else\n    {\n#if JERRY_MODULE_SYSTEM\n      if (JERRY_UNLIKELY (property_ref.virtual_value == ECMA_VALUE_UNINITIALIZED))\n      {\n        return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);\n      }\n#endif /* JERRY_MODULE_SYSTEM */\n      prop_desc_p->value = property_ref.virtual_value;\n    }\n\n    prop_desc_p->flags |=\n      (uint16_t) (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED\n                  | (ecma_is_property_writable (property) ? JERRY_PROP_IS_WRITABLE : JERRY_PROP_NO_OPTS));\n  }\n  else\n  {\n    ecma_getter_setter_pointers_t *get_set_pair_p = ecma_get_named_accessor_property (property_ref.value_p);\n    prop_desc_p->flags |= (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED);\n\n    if (get_set_pair_p->getter_cp == JMEM_CP_NULL)\n    {\n      prop_desc_p->get_p = NULL;\n    }\n    else\n    {\n      prop_desc_p->get_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, get_set_pair_p->getter_cp);\n      ecma_ref_object (prop_desc_p->get_p);\n    }\n\n    if (get_set_pair_p->setter_cp == JMEM_CP_NULL)\n    {\n      prop_desc_p->set_p = NULL;\n    }\n    else\n    {\n      prop_desc_p->set_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, get_set_pair_p->setter_cp);\n      ecma_ref_object (prop_desc_p->set_p);\n    }\n  }\n\n  return ECMA_VALUE_TRUE;\n} /* ecma_op_object_get_own_property_descriptor */\n\n#if JERRY_BUILTIN_PROXY\n/**\n * Get property descriptor from a target value for a specified property.\n *\n * For more details see ecma_op_object_get_own_property_descriptor\n *\n * @return ECMA_VALUE_ERROR - if the Proxy.[[GetOwnProperty]] operation raises error\n *         ECMA_VALUE_{TRUE, FALSE} - if property found or not\n */\necma_value_t\necma_op_get_own_property_descriptor (ecma_value_t target, /**< target value */\n                                     ecma_string_t *property_name_p, /**< property name */\n                                     ecma_property_descriptor_t *prop_desc_p) /**< property descriptor */\n{\n  if (!ecma_is_value_object (target))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  return ecma_op_object_get_own_property_descriptor (ecma_get_object_from_value (target), property_name_p, prop_desc_p);\n} /* ecma_op_get_own_property_descriptor */\n#endif /* JERRY_BUILTIN_PROXY */\n\n/**\n * [[HasInstance]] ecma object's operation\n *\n * See also:\n *          ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 9\n *\n * @return ecma value containing a boolean value or an error\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_object_has_instance (ecma_object_t *obj_p, /**< the object */\n                             ecma_value_t value) /**< argument 'V' */\n{\n  JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));\n\n  JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p));\n\n  if (ecma_op_object_is_callable (obj_p))\n  {\n    return ecma_op_function_has_instance (obj_p, value);\n  }\n\n  return ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION_OBJECT);\n} /* ecma_op_object_has_instance */\n\n/**\n * General [[GetPrototypeOf]] abstract operation\n *\n * Note: returned valid object must be freed.\n *\n * @return ecma_object_t * - prototype of the input object.\n *         ECMA_OBJECT_POINTER_ERROR - error reported during Proxy resolve.\n *         NULL - the input object does not have a prototype.\n */\necma_object_t *\necma_op_object_get_prototype_of (ecma_object_t *obj_p) /**< input object */\n{\n  JERRY_ASSERT (obj_p != NULL);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    ecma_value_t proto = ecma_proxy_object_get_prototype_of (obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (proto))\n    {\n      return ECMA_OBJECT_POINTER_ERROR;\n    }\n    if (ecma_is_value_null (proto))\n    {\n      return NULL;\n    }\n\n    JERRY_ASSERT (ecma_is_value_object (proto));\n\n    return ecma_get_object_from_value (proto);\n  }\n  else\n#endif /* JERRY_BUILTIN_PROXY */\n  {\n    jmem_cpointer_t proto_cp = ecma_op_ordinary_object_get_prototype_of (obj_p);\n\n    if (proto_cp == JMEM_CP_NULL)\n    {\n      return NULL;\n    }\n\n    ecma_object_t *proto_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, proto_cp);\n    ecma_ref_object (proto_p);\n\n    return proto_p;\n  }\n} /* ecma_op_object_get_prototype_of */\n\n/**\n * Object's isPrototypeOf operation\n *\n * See also:\n *          ECMA-262 v5, 15.2.4.6; 3\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_TRUE - if the target object is prototype of the base object\n *         ECMA_VALUE_FALSE - if the target object is not prototype of the base object\n */\necma_value_t\necma_op_object_is_prototype_of (ecma_object_t *base_p, /**< base object */\n                                ecma_object_t *target_p) /**< target object */\n{\n  ecma_ref_object (target_p);\n\n  do\n  {\n    ecma_object_t *proto_p = ecma_op_object_get_prototype_of (target_p);\n    ecma_deref_object (target_p);\n\n    if (proto_p == NULL)\n    {\n      return ECMA_VALUE_FALSE;\n    }\n    else if (proto_p == ECMA_OBJECT_POINTER_ERROR)\n    {\n      return ECMA_VALUE_ERROR;\n    }\n    else if (proto_p == base_p)\n    {\n      ecma_deref_object (proto_p);\n      return ECMA_VALUE_TRUE;\n    }\n\n    /* Advance up on prototype chain. */\n    target_p = proto_p;\n  } while (true);\n} /* ecma_op_object_is_prototype_of */\n\n/**\n * Object's EnumerableOwnPropertyNames operation\n *\n * See also:\n *          ECMA-262 v11, 7.3.23\n *\n * @return NULL - if operation fails\n *         collection of property names / values / name-value pairs - otherwise\n */\necma_collection_t *\necma_op_object_get_enumerable_property_names (ecma_object_t *obj_p, /**< routine's first argument */\n                                              ecma_enumerable_property_names_options_t option) /**< listing option */\n{\n  /* 2. */\n  ecma_collection_t *prop_names_p = ecma_op_object_own_property_keys (obj_p, JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS);\n\n#if JERRY_BUILTIN_PROXY\n  if (JERRY_UNLIKELY (prop_names_p == NULL))\n  {\n    return prop_names_p;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_value_t *names_buffer_p = prop_names_p->buffer_p;\n  /* 3. */\n  ecma_collection_t *properties_p = ecma_new_collection ();\n\n  /* 4. */\n  for (uint32_t i = 0; i < prop_names_p->item_count; i++)\n  {\n    /* 4.a */\n    if (ecma_is_value_string (names_buffer_p[i]))\n    {\n      ecma_string_t *key_p = ecma_get_string_from_value (names_buffer_p[i]);\n\n      /* 4.a.i */\n      ecma_property_descriptor_t prop_desc;\n      ecma_value_t status = ecma_op_object_get_own_property_descriptor (obj_p, key_p, &prop_desc);\n\n      if (ECMA_IS_VALUE_ERROR (status))\n      {\n        ecma_collection_free (prop_names_p);\n        ecma_collection_free (properties_p);\n\n        return NULL;\n      }\n\n      const bool is_enumerable = (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE) != 0;\n      ecma_free_property_descriptor (&prop_desc);\n      /* 4.a.ii */\n      if (is_enumerable)\n      {\n        /* 4.a.ii.1 */\n        if (option == ECMA_ENUMERABLE_PROPERTY_KEYS)\n        {\n          ecma_collection_push_back (properties_p, ecma_copy_value (names_buffer_p[i]));\n        }\n        else\n        {\n          /* 4.a.ii.2.a */\n          ecma_value_t value = ecma_op_object_get (obj_p, key_p);\n\n          if (ECMA_IS_VALUE_ERROR (value))\n          {\n            ecma_collection_free (prop_names_p);\n            ecma_collection_free (properties_p);\n\n            return NULL;\n          }\n\n          /* 4.a.ii.2.b */\n          if (option == ECMA_ENUMERABLE_PROPERTY_VALUES)\n          {\n            ecma_collection_push_back (properties_p, value);\n          }\n          else\n          {\n            /* 4.a.ii.2.c.i */\n            JERRY_ASSERT (option == ECMA_ENUMERABLE_PROPERTY_ENTRIES);\n\n            /* 4.a.ii.2.c.ii */\n            ecma_object_t *entry_p = ecma_op_new_array_object (2);\n\n            ecma_builtin_helper_def_prop_by_index (entry_p,\n                                                   0,\n                                                   names_buffer_p[i],\n                                                   ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n            ecma_builtin_helper_def_prop_by_index (entry_p, 1, value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n            ecma_free_value (value);\n\n            /* 4.a.ii.2.c.iii */\n            ecma_collection_push_back (properties_p, ecma_make_object_value (entry_p));\n          }\n        }\n      }\n    }\n  }\n\n  ecma_collection_free (prop_names_p);\n\n  return properties_p;\n} /* ecma_op_object_get_enumerable_property_names */\n\n/**\n * Helper method for getting lazy instantiated properties for [[OwnPropertyKeys]]\n */\nstatic void\necma_object_list_lazy_property_names (ecma_object_t *obj_p, /**< object */\n                                      ecma_collection_t *prop_names_p, /**< prop name collection */\n                                      ecma_property_counter_t *prop_counter_p, /**< property counters */\n                                      jerry_property_filter_t filter) /**< property name filter options */\n{\n  switch (ecma_get_object_type (obj_p))\n  {\n    case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n    {\n      if (ecma_builtin_function_is_routine (obj_p))\n      {\n        ecma_builtin_routine_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p, filter);\n        break;\n      }\n      /* FALLTHRU */\n    }\n    case ECMA_OBJECT_TYPE_BUILT_IN_GENERAL:\n    case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:\n    case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:\n    {\n      ecma_builtin_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p, filter);\n      break;\n    }\n    case ECMA_OBJECT_TYPE_CLASS:\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n\n      switch (ext_object_p->u.cls.type)\n      {\n        case ECMA_OBJECT_CLASS_STRING:\n        {\n          ecma_op_string_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p, filter);\n          break;\n        }\n        case ECMA_OBJECT_CLASS_ARGUMENTS:\n        {\n          ecma_op_arguments_object_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p, filter);\n          break;\n        }\n#if JERRY_BUILTIN_TYPEDARRAY\n        /* ES2015 9.4.5.1 */\n        case ECMA_OBJECT_CLASS_TYPEDARRAY:\n        {\n          ecma_op_typedarray_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p, filter);\n          break;\n        }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n      }\n      break;\n    }\n    case ECMA_OBJECT_TYPE_FUNCTION:\n    {\n      ecma_op_function_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p, filter);\n      break;\n    }\n    case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:\n    {\n      ecma_op_external_function_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p, filter);\n      break;\n    }\n    case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n    {\n      ecma_op_bound_function_list_lazy_property_names (obj_p, prop_names_p, prop_counter_p, filter);\n      break;\n    }\n    case ECMA_OBJECT_TYPE_ARRAY:\n    {\n      if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS))\n      {\n        ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));\n        prop_counter_p->string_named_props++;\n      }\n      break;\n    }\n    default:\n    {\n      JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_GENERAL\n                    || ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION);\n      break;\n    }\n  }\n} /* ecma_object_list_lazy_property_names */\n\n/**\n * Helper routine for heapsort algorithm.\n */\nstatic void\necma_op_object_heap_sort_shift_down (ecma_value_t *buffer_p, /**< array of items */\n                                     uint32_t item_count, /**< number of items */\n                                     uint32_t item_index) /**< index of updated item */\n{\n  while (true)\n  {\n    uint32_t highest_index = item_index;\n    uint32_t current_index = (item_index << 1) + 1;\n\n    if (current_index >= item_count)\n    {\n      return;\n    }\n\n    uint32_t value = ecma_string_get_array_index (ecma_get_string_from_value (buffer_p[highest_index]));\n    uint32_t left_value = ecma_string_get_array_index (ecma_get_string_from_value (buffer_p[current_index]));\n\n    if (value < left_value)\n    {\n      highest_index = current_index;\n      value = left_value;\n    }\n\n    current_index++;\n\n    if (current_index < item_count\n        && value < ecma_string_get_array_index (ecma_get_string_from_value (buffer_p[current_index])))\n    {\n      highest_index = current_index;\n    }\n\n    if (highest_index == item_index)\n    {\n      return;\n    }\n\n    ecma_value_t tmp = buffer_p[highest_index];\n    buffer_p[highest_index] = buffer_p[item_index];\n    buffer_p[item_index] = tmp;\n\n    item_index = highest_index;\n  }\n} /* ecma_op_object_heap_sort_shift_down */\n\n/**\n * Object's [[OwnPropertyKeys]] internal method\n *\n * Order of names in the collection:\n *  - integer indices in ascending order\n *  - other indices in creation order (for built-ins: the order of the properties are listed in specification).\n *\n * Note:\n *      Implementation of the routine assumes that new properties are appended to beginning of corresponding object's\n *      property list, and the list is not reordered (in other words, properties are stored in order that is reversed\n *      to the properties' addition order).\n *\n * @return NULL - if the Proxy.[[OwnPropertyKeys]] operation raises error\n *         collection of property names - otherwise\n */\necma_collection_t *\necma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */\n                                  jerry_property_filter_t filter) /**< name filters */\n{\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (obj_p))\n  {\n    return ecma_proxy_object_own_property_keys (obj_p);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    return ecma_fast_array_object_own_property_keys (obj_p, filter);\n  }\n\n  ecma_collection_t *prop_names_p = ecma_new_collection ();\n  ecma_property_counter_t prop_counter = { 0, 0, 0 };\n\n  ecma_object_list_lazy_property_names (obj_p, prop_names_p, &prop_counter, filter);\n\n  jmem_cpointer_t prop_iter_cp = obj_p->u1.property_list_cp;\n\n#if JERRY_PROPERTY_HASHMAP\n  if (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n\n    if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n    {\n      prop_iter_cp = prop_iter_p->next_property_cp;\n    }\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n  jmem_cpointer_t counter_prop_iter_cp = prop_iter_cp;\n\n  uint32_t array_index_named_props = 0;\n  uint32_t string_named_props = 0;\n  uint32_t symbol_named_props = 0;\n\n  while (counter_prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, counter_prop_iter_cp);\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n    for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      ecma_property_t *property_p = prop_iter_p->types + i;\n\n      if (!ECMA_PROPERTY_IS_RAW (*property_p) || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN))\n      {\n        continue;\n      }\n\n      ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n      if (ECMA_PROPERTY_GET_NAME_TYPE (*property_p) == ECMA_DIRECT_STRING_MAGIC\n          && prop_pair_p->names_cp[i] >= LIT_NON_INTERNAL_MAGIC_STRING__COUNT\n          && prop_pair_p->names_cp[i] < LIT_MAGIC_STRING__COUNT)\n      {\n        continue;\n      }\n\n      ecma_string_t *name_p = ecma_string_from_property_name (*property_p, prop_pair_p->names_cp[i]);\n\n      if (ecma_string_get_array_index (name_p) != ECMA_STRING_NOT_ARRAY_INDEX)\n      {\n        array_index_named_props++;\n      }\n      else if (ecma_prop_name_is_symbol (name_p))\n      {\n        if (!(name_p->u.hash & ECMA_SYMBOL_FLAG_PRIVATE_KEY))\n        {\n          symbol_named_props++;\n        }\n      }\n      else\n      {\n        string_named_props++;\n      }\n\n      ecma_deref_ecma_string (name_p);\n    }\n\n    counter_prop_iter_cp = prop_iter_p->next_property_cp;\n  }\n\n  if (filter & JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES)\n  {\n    JERRY_ASSERT (prop_counter.array_index_named_props == 0);\n    array_index_named_props = 0;\n  }\n\n  if (filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS)\n  {\n    JERRY_ASSERT (prop_counter.string_named_props == 0);\n    string_named_props = 0;\n  }\n\n  if (filter & JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS)\n  {\n    JERRY_ASSERT (prop_counter.symbol_named_props == 0);\n    symbol_named_props = 0;\n  }\n\n  uint32_t total = array_index_named_props + string_named_props + symbol_named_props;\n\n  if (total == 0)\n  {\n    return prop_names_p;\n  }\n\n  ecma_collection_reserve (prop_names_p, total);\n  prop_names_p->item_count += total;\n\n  ecma_value_t *buffer_p = prop_names_p->buffer_p;\n  ecma_value_t *array_index_current_p = buffer_p + array_index_named_props + prop_counter.array_index_named_props;\n  ecma_value_t *string_current_p = array_index_current_p + string_named_props + prop_counter.string_named_props;\n\n  ecma_value_t *symbol_current_p = string_current_p + symbol_named_props + prop_counter.symbol_named_props;\n\n  if (prop_counter.symbol_named_props > 0 && (array_index_named_props + string_named_props) > 0)\n  {\n    memmove ((void *) string_current_p,\n             (void *) (buffer_p + prop_counter.array_index_named_props + prop_counter.string_named_props),\n             prop_counter.symbol_named_props * sizeof (ecma_value_t));\n  }\n\n  if (prop_counter.string_named_props > 0 && array_index_named_props > 0)\n  {\n    memmove ((void *) array_index_current_p,\n             (void *) (buffer_p + prop_counter.array_index_named_props),\n             prop_counter.string_named_props * sizeof (ecma_value_t));\n  }\n\n  while (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n    for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)\n    {\n      ecma_property_t *property_p = prop_iter_p->types + i;\n\n      if (!ECMA_PROPERTY_IS_RAW (*property_p) || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN))\n      {\n        continue;\n      }\n\n      ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n      if (ECMA_PROPERTY_GET_NAME_TYPE (*property_p) == ECMA_DIRECT_STRING_MAGIC\n          && prop_pair_p->names_cp[i] >= LIT_NON_INTERNAL_MAGIC_STRING__COUNT\n          && prop_pair_p->names_cp[i] < LIT_MAGIC_STRING__COUNT)\n      {\n        continue;\n      }\n\n      ecma_string_t *name_p = ecma_string_from_property_name (*property_p, prop_pair_p->names_cp[i]);\n\n      if (ecma_string_get_array_index (name_p) != ECMA_STRING_NOT_ARRAY_INDEX)\n      {\n        if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES))\n        {\n          *(--array_index_current_p) = ecma_make_string_value (name_p);\n          continue;\n        }\n      }\n      else if (ecma_prop_name_is_symbol (name_p))\n      {\n        if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS) && !(name_p->u.hash & ECMA_SYMBOL_FLAG_PRIVATE_KEY))\n        {\n          *(--symbol_current_p) = ecma_make_symbol_value (name_p);\n          continue;\n        }\n      }\n      else\n      {\n        if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS))\n        {\n          *(--string_current_p) = ecma_make_string_value (name_p);\n          continue;\n        }\n      }\n\n      ecma_deref_ecma_string (name_p);\n    }\n\n    prop_iter_cp = prop_iter_p->next_property_cp;\n  }\n\n  if (array_index_named_props > 1 || (array_index_named_props == 1 && prop_counter.array_index_named_props > 0))\n  {\n    uint32_t prev_value = 0;\n    ecma_value_t *array_index_p = buffer_p + prop_counter.array_index_named_props;\n    ecma_value_t *array_index_end_p = array_index_p + array_index_named_props;\n\n    if (prop_counter.array_index_named_props > 0)\n    {\n      prev_value = ecma_string_get_array_index (ecma_get_string_from_value (array_index_p[-1]));\n    }\n\n    do\n    {\n      uint32_t value = ecma_string_get_array_index (ecma_get_string_from_value (*array_index_p++));\n\n      if (value < prev_value)\n      {\n        uint32_t array_props = prop_counter.array_index_named_props + array_index_named_props;\n        uint32_t i = (array_props >> 1) - 1;\n\n        do\n        {\n          ecma_op_object_heap_sort_shift_down (buffer_p, array_props, i);\n        } while (i-- > 0);\n\n        i = array_props - 1;\n\n        do\n        {\n          ecma_value_t tmp = buffer_p[i];\n          buffer_p[i] = buffer_p[0];\n          buffer_p[0] = tmp;\n\n          ecma_op_object_heap_sort_shift_down (buffer_p, i, 0);\n        } while (--i > 0);\n\n        break;\n      }\n\n      prev_value = value;\n    } while (array_index_p < array_index_end_p);\n  }\n\n  return prop_names_p;\n} /* ecma_op_object_own_property_keys */\n\n/**\n * EnumerateObjectProperties abstract method\n *\n * See also:\n *          ECMA-262 v11, 13.7.5.15\n *\n * @return NULL - if the Proxy.[[OwnPropertyKeys]] operation raises error\n *         collection of enumerable property names - otherwise\n */\necma_collection_t *\necma_op_object_enumerate (ecma_object_t *obj_p) /**< object */\n{\n  ecma_collection_t *visited_names_p = ecma_new_collection ();\n  ecma_collection_t *return_names_p = ecma_new_collection ();\n\n  ecma_ref_object (obj_p);\n\n  while (true)\n  {\n    ecma_collection_t *keys = ecma_op_object_own_property_keys (obj_p, JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS);\n\n    if (JERRY_UNLIKELY (keys == NULL))\n    {\n      ecma_collection_free (return_names_p);\n      ecma_collection_free (visited_names_p);\n      ecma_deref_object (obj_p);\n      return keys;\n    }\n\n    for (uint32_t i = 0; i < keys->item_count; i++)\n    {\n      ecma_value_t prop_name = keys->buffer_p[i];\n      ecma_string_t *name_p = ecma_get_prop_name_from_value (prop_name);\n\n      if (ecma_prop_name_is_symbol (name_p))\n      {\n        continue;\n      }\n\n      ecma_property_descriptor_t prop_desc;\n      ecma_value_t get_desc = ecma_op_object_get_own_property_descriptor (obj_p, name_p, &prop_desc);\n\n      if (ECMA_IS_VALUE_ERROR (get_desc))\n      {\n        ecma_collection_free (keys);\n        ecma_collection_free (return_names_p);\n        ecma_collection_free (visited_names_p);\n        ecma_deref_object (obj_p);\n        return NULL;\n      }\n\n      if (ecma_is_value_true (get_desc))\n      {\n        bool is_enumerable = (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE) != 0;\n        ecma_free_property_descriptor (&prop_desc);\n\n        if (ecma_collection_has_string_value (visited_names_p, name_p)\n            || ecma_collection_has_string_value (return_names_p, name_p))\n        {\n          continue;\n        }\n\n        ecma_ref_ecma_string (name_p);\n\n        if (is_enumerable)\n        {\n          ecma_collection_push_back (return_names_p, prop_name);\n        }\n        else\n        {\n          ecma_collection_push_back (visited_names_p, prop_name);\n        }\n      }\n    }\n\n    ecma_collection_free (keys);\n\n    /* Query the prototype. */\n    ecma_object_t *proto_p = ecma_op_object_get_prototype_of (obj_p);\n    ecma_deref_object (obj_p);\n\n    if (proto_p == NULL)\n    {\n      break;\n    }\n    else if (JERRY_UNLIKELY (proto_p == ECMA_OBJECT_POINTER_ERROR))\n    {\n      ecma_collection_free (return_names_p);\n      ecma_collection_free (visited_names_p);\n      return NULL;\n    }\n\n    /* Advance up on prototype chain. */\n    obj_p = proto_p;\n  }\n\n  ecma_collection_free (visited_names_p);\n\n  return return_names_p;\n} /* ecma_op_object_enumerate */\n\n#ifndef JERRY_NDEBUG\n\n/**\n * Check if passed object is the instance of specified built-in.\n *\n * @return true  - if the object is instance of the specified built-in\n *         false - otherwise\n */\nstatic bool\necma_builtin_is (ecma_object_t *object_p, /**< pointer to an object */\n                 ecma_builtin_id_t builtin_id) /**< id of built-in to check on */\n{\n  JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));\n  JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT);\n\n  ecma_object_type_t type = ecma_get_object_type (object_p);\n\n  switch (type)\n  {\n    case ECMA_OBJECT_TYPE_BUILT_IN_GENERAL:\n    case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n    {\n      ecma_extended_object_t *built_in_object_p = (ecma_extended_object_t *) object_p;\n\n      return (built_in_object_p->u.built_in.id == builtin_id && built_in_object_p->u.built_in.routine_id == 0);\n    }\n    case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:\n    case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:\n    {\n      ecma_extended_built_in_object_t *extended_built_in_object_p = (ecma_extended_built_in_object_t *) object_p;\n\n      return (extended_built_in_object_p->built_in.id == builtin_id\n              && extended_built_in_object_p->built_in.routine_id == 0);\n    }\n    default:\n    {\n      return false;\n    }\n  }\n} /* ecma_builtin_is */\n\n#endif /* !JERRY_NDEBUG */\n\n/**\n * The function is used in the assert of ecma_object_get_class_name\n *\n * @return true  - if class name is an object\n *         false - otherwise\n */\nstatic inline bool\necma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */\n{\n#ifndef JERRY_NDEBUG\n  return (ecma_builtin_is_global (obj_p)\n#if JERRY_BUILTIN_TYPEDARRAY\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE)\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE)\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_UINT8ARRAY_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_INT16ARRAY_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_UINT16ARRAY_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_INT32ARRAY_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_UINT32ARRAY_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_FLOAT32ARRAY_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY_PROTOTYPE)\n#if JERRY_NUMBER_TYPE_FLOAT64\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE)\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#if JERRY_BUILTIN_BIGINT\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_BIGINT_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_BIGINT64ARRAY_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_BIGUINT64ARRAY_PROTOTYPE)\n#endif /* JERRY_BUILTIN_BIGINT */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ARRAY_PROTOTYPE_UNSCOPABLES)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ARRAY_ITERATOR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_STRING_ITERATOR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_REGEXP_STRING_ITERATOR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ERROR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_DATE_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_REGEXP_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_PROMISE_PROTOTYPE)\n#if JERRY_BUILTIN_CONTAINER\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_MAP_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SET_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE)\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE)\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_WEAKREF\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE)\n#endif /* JERRY_BUILTIN_WEAKREF */\n#if JERRY_BUILTIN_DATAVIEW\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE)\n#endif /* JERRY_BUILTIN_DATAVIEW */\n          || ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE));\n#else /* JERRY_NDEBUG */\n  JERRY_UNUSED (obj_p);\n  return true;\n#endif /* !JERRY_NDEBUG */\n} /* ecma_object_check_class_name_is_object */\n\n/**\n * Used by ecma_object_get_class_name to get the magic string id of class objects\n */\nstatic const uint16_t ecma_class_object_magic_string_id[] = {\n  /* These objects require custom property resolving. */\n  LIT_MAGIC_STRING_STRING_UL, /**< magic string id of ECMA_OBJECT_CLASS_STRING */\n  LIT_MAGIC_STRING_ARGUMENTS_UL, /**< magic string id of ECMA_OBJECT_CLASS_ARGUMENTS */\n#if JERRY_BUILTIN_TYPEDARRAY\n  LIT_MAGIC_STRING__EMPTY, /**< ECMA_OBJECT_CLASS_TYPEDARRAY needs special resolver */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_MODULE_SYSTEM\n  LIT_MAGIC_STRING_MODULE_UL, /**< magic string id of ECMA_OBJECT_CLASS_MODULE_NAMESPACE */\n#endif /* JERRY_MODULE_SYSTEM */\n\n  /* These objects are marked by Garbage Collector. */\n  LIT_MAGIC_STRING_GENERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_GENERATOR */\n  LIT_MAGIC_STRING_ASYNC_GENERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_ASYNC_GENERATOR */\n  LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_ARRAY_ITERATOR */\n  LIT_MAGIC_STRING_SET_ITERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_SET_ITERATOR */\n  LIT_MAGIC_STRING_MAP_ITERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_MAP_ITERATOR */\n#if JERRY_BUILTIN_REGEXP\n  LIT_MAGIC_STRING_REGEXP_STRING_ITERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR */\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_MODULE_SYSTEM\n  LIT_MAGIC_STRING_MODULE_UL, /**< magic string id of ECMA_OBJECT_CLASS_MODULE */\n#endif /* JERRY_MODULE_SYSTEM */\n  LIT_MAGIC_STRING_PROMISE_UL, /**< magic string id of ECMA_OBJECT_CLASS_PROMISE */\n  LIT_MAGIC_STRING_OBJECT_UL, /**< magic string id of ECMA_OBJECT_CLASS_PROMISE_CAPABILITY */\n  LIT_MAGIC_STRING_OBJECT_UL, /**< magic string id of ECMA_OBJECT_CLASS_ASYNC_FROM_SYNC_ITERATOR */\n#if JERRY_BUILTIN_DATAVIEW\n  LIT_MAGIC_STRING_DATAVIEW_UL, /**< magic string id of ECMA_OBJECT_CLASS_DATAVIEW */\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_CONTAINER\n  LIT_MAGIC_STRING__EMPTY, /**< magic string id of ECMA_OBJECT_CLASS_CONTAINER needs special resolver */\n#endif /* JERRY_BUILTIN_CONTAINER */\n\n  /* Normal objects. */\n  LIT_MAGIC_STRING_BOOLEAN_UL, /**< magic string id of ECMA_OBJECT_CLASS_BOOLEAN */\n  LIT_MAGIC_STRING_NUMBER_UL, /**< magic string id of ECMA_OBJECT_CLASS_NUMBER */\n  LIT_MAGIC_STRING_ERROR_UL, /**< magic string id of ECMA_OBJECT_CLASS_ERROR */\n  LIT_MAGIC_STRING_OBJECT_UL, /**< magic string id of ECMA_OBJECT_CLASS_INTERNAL_OBJECT */\n#if JERRY_PARSER\n  LIT_MAGIC_STRING_SCRIPT_UL, /**< magic string id of ECMA_OBJECT_CLASS_SCRIPT */\n#endif /* JERRY_PARSER */\n#if JERRY_BUILTIN_DATE\n  LIT_MAGIC_STRING_DATE_UL, /**< magic string id of ECMA_OBJECT_CLASS_DATE */\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_REGEXP\n  LIT_MAGIC_STRING_REGEXP_UL, /**< magic string id of ECMA_OBJECT_CLASS_REGEXP */\n#endif /* JERRY_BUILTIN_REGEXP */\n  LIT_MAGIC_STRING_SYMBOL_UL, /**< magic string id of ECMA_OBJECT_CLASS_SYMBOL */\n  LIT_MAGIC_STRING_STRING_ITERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_STRING_ITERATOR */\n#if JERRY_BUILTIN_TYPEDARRAY\n  LIT_MAGIC_STRING_ARRAY_BUFFER_UL, /**< magic string id of ECMA_OBJECT_CLASS_ARRAY_BUFFER */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n  LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, /**< magic string id of ECMA_OBJECT_CLASS_SHAREDARRAY_BUFFER */\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n#if JERRY_BUILTIN_BIGINT\n  LIT_MAGIC_STRING_BIGINT_UL, /**< magic string id of ECMA_OBJECT_CLASS_BIGINT */\n#endif /* JERRY_BUILTIN_BIGINT */\n#if JERRY_BUILTIN_WEAKREF\n  LIT_MAGIC_STRING_WEAKREF_UL, /**< magic string id of ECMA_OBJECT_CLASS_WEAKREF */\n#endif /* JERRY_BUILTIN_WEAKREF */\n};\n\nJERRY_STATIC_ASSERT (sizeof (ecma_class_object_magic_string_id) == ECMA_OBJECT_CLASS__MAX * sizeof (uint16_t),\n                     ecma_class_object_magic_string_id_must_have_object_class_max_elements);\n\n/**\n * Get [[Class]] string of specified object\n *\n * @return class name magic string\n */\nlit_magic_string_id_t\necma_object_get_class_name (ecma_object_t *obj_p) /**< object */\n{\n  ecma_object_type_t type = ecma_get_object_type (obj_p);\n\n  switch (type)\n  {\n    case ECMA_OBJECT_TYPE_ARRAY:\n    case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:\n    {\n      return LIT_MAGIC_STRING_ARRAY_UL;\n    }\n    case ECMA_OBJECT_TYPE_CLASS:\n    case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:\n    {\n      ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n\n      switch (ext_object_p->u.cls.type)\n      {\n#if JERRY_BUILTIN_TYPEDARRAY\n        case ECMA_OBJECT_CLASS_TYPEDARRAY:\n        {\n          return ecma_get_typedarray_magic_string_id (ext_object_p->u.cls.u1.typedarray_type);\n        }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_CONTAINER\n        case ECMA_OBJECT_CLASS_CONTAINER:\n        {\n          return (lit_magic_string_id_t) ext_object_p->u.cls.u2.container_id;\n        }\n#endif /* JERRY_BUILTIN_CONTAINER */\n        default:\n        {\n          break;\n        }\n      }\n\n      JERRY_ASSERT (ext_object_p->u.cls.type < ECMA_OBJECT_CLASS__MAX);\n      JERRY_ASSERT (ecma_class_object_magic_string_id[ext_object_p->u.cls.type] != LIT_MAGIC_STRING__EMPTY);\n\n      return (lit_magic_string_id_t) ecma_class_object_magic_string_id[ext_object_p->u.cls.type];\n    }\n    case ECMA_OBJECT_TYPE_FUNCTION:\n    case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:\n    case ECMA_OBJECT_TYPE_BOUND_FUNCTION:\n    case ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION:\n    case ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION:\n    {\n      return LIT_MAGIC_STRING_FUNCTION_UL;\n    }\n#if JERRY_BUILTIN_PROXY\n    case ECMA_OBJECT_TYPE_PROXY:\n    {\n      ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n      if (!ecma_is_value_null (proxy_obj_p->target) && ecma_is_value_object (proxy_obj_p->target))\n      {\n        ecma_object_t *target_obj_p = ecma_get_object_from_value (proxy_obj_p->target);\n        return ecma_object_get_class_name (target_obj_p);\n      }\n      return LIT_MAGIC_STRING_OBJECT_UL;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n    case ECMA_OBJECT_TYPE_BUILT_IN_GENERAL:\n    {\n      ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n\n      switch (ext_obj_p->u.built_in.id)\n      {\n#if JERRY_BUILTIN_MATH\n        case ECMA_BUILTIN_ID_MATH:\n        {\n          return LIT_MAGIC_STRING_MATH_UL;\n        }\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_REFLECT\n        case ECMA_BUILTIN_ID_REFLECT:\n        {\n          return LIT_MAGIC_STRING_REFLECT_UL;\n        }\n#endif /* JERRY_BUILTIN_REFLECT */\n        case ECMA_BUILTIN_ID_GENERATOR:\n        {\n          return LIT_MAGIC_STRING_GENERATOR_UL;\n        }\n        case ECMA_BUILTIN_ID_ASYNC_GENERATOR:\n        {\n          return LIT_MAGIC_STRING_ASYNC_GENERATOR_UL;\n        }\n#if JERRY_BUILTIN_JSON\n        case ECMA_BUILTIN_ID_JSON:\n        {\n          return LIT_MAGIC_STRING_JSON_U;\n        }\n#endif /* JERRY_BUILTIN_JSON */\n#if JERRY_BUILTIN_ATOMICS\n        case ECMA_BUILTIN_ID_ATOMICS:\n        {\n          return LIT_MAGIC_STRING_ATOMICS_U;\n        }\n#endif /* JERRY_BUILTIN_ATOMICS */\n        default:\n        {\n          break;\n        }\n      }\n\n      JERRY_ASSERT (ecma_object_check_class_name_is_object (obj_p));\n      return LIT_MAGIC_STRING_OBJECT_UL;\n    }\n    default:\n    {\n      JERRY_ASSERT (type == ECMA_OBJECT_TYPE_GENERAL || type == ECMA_OBJECT_TYPE_PROXY);\n\n      return LIT_MAGIC_STRING_OBJECT_UL;\n    }\n  }\n} /* ecma_object_get_class_name */\n\n#if JERRY_BUILTIN_REGEXP\n/**\n * Checks if the given argument has [[RegExpMatcher]] internal slot\n *\n * @return true - if the given argument is a regexp\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_object_is_regexp_object (ecma_value_t arg) /**< argument */\n{\n  return (ecma_is_value_object (arg)\n          && ecma_object_class_is (ecma_get_object_from_value (arg), ECMA_OBJECT_CLASS_REGEXP));\n} /* ecma_object_is_regexp_object */\n#endif /* JERRY_BUILTIN_REGEXP */\n\n/**\n * Object's IsConcatSpreadable operation, used for Array.prototype.concat\n * It checks the argument's [Symbol.isConcatSpreadable] property value\n *\n * See also:\n *          ECMA-262 v6, 22.1.3.1.1;\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_TRUE - if the argument is concatSpreadable\n *         ECMA_VALUE_FALSE - otherwise\n */\necma_value_t\necma_op_is_concat_spreadable (ecma_value_t arg) /**< argument */\n{\n  if (!ecma_is_value_object (arg))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_value_t spreadable =\n    ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg), LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE);\n\n  if (ECMA_IS_VALUE_ERROR (spreadable))\n  {\n    return spreadable;\n  }\n\n  if (!ecma_is_value_undefined (spreadable))\n  {\n    const bool to_bool = ecma_op_to_boolean (spreadable);\n    ecma_free_value (spreadable);\n    return ecma_make_boolean_value (to_bool);\n  }\n\n  return ecma_is_value_array (arg);\n} /* ecma_op_is_concat_spreadable */\n\n/**\n * IsRegExp operation\n *\n * See also:\n *          ECMA-262 v6, 22.1.3.1.1;\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_TRUE - if the argument is regexp\n *         ECMA_VALUE_FALSE - otherwise\n */\necma_value_t\necma_op_is_regexp (ecma_value_t arg) /**< argument */\n{\n  if (!ecma_is_value_object (arg))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_value_t is_regexp = ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg), LIT_GLOBAL_SYMBOL_MATCH);\n\n  if (ECMA_IS_VALUE_ERROR (is_regexp))\n  {\n    return is_regexp;\n  }\n\n  if (!ecma_is_value_undefined (is_regexp))\n  {\n    const bool to_bool = ecma_op_to_boolean (is_regexp);\n    ecma_free_value (is_regexp);\n    return ecma_make_boolean_value (to_bool);\n  }\n\n  return ecma_make_boolean_value (ecma_object_is_regexp_object (arg));\n} /* ecma_op_is_regexp */\n\n/**\n * SpeciesConstructor operation\n * See also:\n *          ECMA-262 v6, 7.3.20;\n *\n * @return ecma_value\n *         returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_species_constructor (ecma_object_t *this_value, /**< This Value */\n                             ecma_builtin_id_t default_constructor_id) /**< Builtin ID of default constructor */\n{\n  ecma_object_t *default_constructor_p = ecma_builtin_get (default_constructor_id);\n  ecma_value_t constructor = ecma_op_object_get_by_magic_id (this_value, LIT_MAGIC_STRING_CONSTRUCTOR);\n  if (ECMA_IS_VALUE_ERROR (constructor))\n  {\n    return constructor;\n  }\n\n  if (ecma_is_value_undefined (constructor))\n  {\n    ecma_ref_object (default_constructor_p);\n    return ecma_make_object_value (default_constructor_p);\n  }\n\n  if (!ecma_is_value_object (constructor))\n  {\n    ecma_free_value (constructor);\n    return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_NOT_AN_OBJECT);\n  }\n\n  ecma_object_t *ctor_object_p = ecma_get_object_from_value (constructor);\n  ecma_value_t species = ecma_op_object_get_by_symbol_id (ctor_object_p, LIT_GLOBAL_SYMBOL_SPECIES);\n  ecma_deref_object (ctor_object_p);\n\n  if (ECMA_IS_VALUE_ERROR (species))\n  {\n    return species;\n  }\n\n  if (ecma_is_value_undefined (species) || ecma_is_value_null (species))\n  {\n    ecma_ref_object (default_constructor_p);\n    return ecma_make_object_value (default_constructor_p);\n  }\n\n  if (!ecma_is_constructor (species))\n  {\n    ecma_free_value (species);\n    return ecma_raise_type_error (ECMA_ERR_SPECIES_MUST_BE_A_CONSTRUCTOR);\n  }\n\n  return species;\n} /* ecma_op_species_constructor */\n\n/**\n * 7.3.18 Abstract operation Invoke when property name is a magic string\n *\n * @return ecma_value result of the invoked function or raised error\n *         note: returned value must be freed with ecma_free_value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_invoke_by_symbol_id (ecma_value_t object, /**< Object value */\n                             lit_magic_string_id_t symbol_id, /**< Symbol ID */\n                             ecma_value_t *args_p, /**< Argument list */\n                             uint32_t args_len) /**< Argument list length */\n{\n  ecma_string_t *symbol_p = ecma_op_get_global_symbol (symbol_id);\n  ecma_value_t ret_value = ecma_op_invoke (object, symbol_p, args_p, args_len);\n  ecma_deref_ecma_string (symbol_p);\n\n  return ret_value;\n} /* ecma_op_invoke_by_symbol_id */\n\n/**\n * 7.3.18 Abstract operation Invoke when property name is a magic string\n *\n * @return ecma_value result of the invoked function or raised error\n *         note: returned value must be freed with ecma_free_value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_invoke_by_magic_id (ecma_value_t object, /**< Object value */\n                            lit_magic_string_id_t magic_string_id, /**< Magic string ID */\n                            ecma_value_t *args_p, /**< Argument list */\n                            uint32_t args_len) /**< Argument list length */\n{\n  return ecma_op_invoke (object, ecma_get_magic_string (magic_string_id), args_p, args_len);\n} /* ecma_op_invoke_by_magic_id */\n\n/**\n * 7.3.18 Abstract operation Invoke\n *\n * @return ecma_value result of the invoked function or raised error\n *         note: returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_invoke (ecma_value_t object, /**< Object value */\n                ecma_string_t *property_name_p, /**< Property name */\n                ecma_value_t *args_p, /**< Argument list */\n                uint32_t args_len) /**< Argument list length */\n{\n  /* 3. */\n  ecma_value_t object_value = ecma_op_to_object (object);\n  if (ECMA_IS_VALUE_ERROR (object_value))\n  {\n    return object_value;\n  }\n\n  ecma_object_t *object_p = ecma_get_object_from_value (object_value);\n\n  ecma_value_t func = ecma_op_object_get_with_receiver (object_p, property_name_p, object);\n\n  if (ECMA_IS_VALUE_ERROR (func))\n  {\n    ecma_deref_object (object_p);\n    return func;\n  }\n\n  /* 4. */\n  ecma_value_t call_result = ecma_op_function_validated_call (func, object, args_p, args_len);\n  ecma_free_value (func);\n\n  ecma_deref_object (object_p);\n\n  return call_result;\n} /* ecma_op_invoke */\n\n/**\n * Ordinary object [[GetPrototypeOf]] operation\n *\n * See also:\n *          ECMAScript v6, 9.1.1\n *\n * @return the value of the [[Prototype]] internal slot of the given object.\n */\nextern inline jmem_cpointer_t JERRY_ATTR_ALWAYS_INLINE\necma_op_ordinary_object_get_prototype_of (ecma_object_t *obj_p) /**< object */\n{\n  JERRY_ASSERT (!ecma_is_lexical_environment (obj_p));\n  JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (obj_p));\n\n  return obj_p->u2.prototype_cp;\n} /* ecma_op_ordinary_object_get_prototype_of */\n\n/**\n * Ordinary object [[SetPrototypeOf]] operation\n *\n * See also:\n *          ECMAScript v6, 9.1.2\n *\n * @return ECMA_VALUE_FALSE - if the operation fails\n *         ECMA_VALUE_TRUE - otherwise\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_ordinary_object_set_prototype_of (ecma_object_t *obj_p, /**< base object */\n                                          ecma_value_t proto) /**< prototype object */\n{\n  JERRY_ASSERT (!ecma_is_lexical_environment (obj_p));\n  JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (obj_p));\n\n  /* 1. */\n  JERRY_ASSERT (ecma_is_value_object (proto) || ecma_is_value_null (proto));\n\n  /* 3. */\n  ecma_object_t *current_proto_p = ECMA_GET_POINTER (ecma_object_t, ecma_op_ordinary_object_get_prototype_of (obj_p));\n  ecma_object_t *new_proto_p = ecma_is_value_null (proto) ? NULL : ecma_get_object_from_value (proto);\n\n  /* 4. */\n  if (new_proto_p == current_proto_p)\n  {\n    return ECMA_VALUE_TRUE;\n  }\n\n  /* 2 - 5. */\n  if (!ecma_op_ordinary_object_is_extensible (obj_p))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  /**\n   * When the prototype of a fast array changes, it is required to convert the\n   * array to a \"normal\" array. This ensures that all [[Get]]/[[Set]]/etc.\n   * calls works as expected.\n   */\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_fast_array_convert_to_normal (obj_p);\n  }\n\n  /* 6. */\n  ecma_object_t *iter_p = new_proto_p;\n\n  /* 7 - 8. */\n  while (true)\n  {\n    /* 8.a */\n    if (iter_p == NULL)\n    {\n      break;\n    }\n\n    /* 8.b */\n    if (obj_p == iter_p)\n    {\n      return ECMA_VALUE_FALSE;\n    }\n\n    /* 8.c.i */\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_OBJECT_IS_PROXY (iter_p))\n    {\n      /**\n       * Prevent setting 'Object.prototype.__proto__'\n       * to avoid circular referencing in the prototype chain.\n       */\n      if (obj_p == ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE))\n      {\n        return ECMA_VALUE_FALSE;\n      }\n\n      break;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    /* 8.c.ii */\n    iter_p = ECMA_GET_POINTER (ecma_object_t, ecma_op_ordinary_object_get_prototype_of (iter_p));\n  }\n\n  /* 9. */\n  ECMA_SET_POINTER (obj_p->u2.prototype_cp, new_proto_p);\n\n  /* 10. */\n  return ECMA_VALUE_TRUE;\n} /* ecma_op_ordinary_object_set_prototype_of */\n\n/**\n * [[IsExtensible]] operation for Ordinary object.\n *\n * See also:\n *          ECMAScript v6, 9.1.2\n *\n * @return true  - if object is extensible\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_PURE\necma_op_ordinary_object_is_extensible (ecma_object_t *object_p) /**< object */\n{\n  JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));\n\n  bool is_extensible = (object_p->type_flags_refs & ECMA_OBJECT_FLAG_EXTENSIBLE) != 0;\n\n  JERRY_ASSERT (!ecma_op_object_is_fast_array (object_p) || is_extensible);\n\n  return is_extensible;\n} /* ecma_op_ordinary_object_is_extensible */\n\n/**\n * Set value of [[Extensible]] object's internal property.\n */\nvoid JERRY_ATTR_NOINLINE\necma_op_ordinary_object_prevent_extensions (ecma_object_t *object_p) /**< object */\n{\n  JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));\n\n  if (JERRY_UNLIKELY (ecma_op_object_is_fast_array (object_p)))\n  {\n    ecma_fast_array_convert_to_normal (object_p);\n  }\n\n  object_p->type_flags_refs &= (ecma_object_descriptor_t) ~ECMA_OBJECT_FLAG_EXTENSIBLE;\n} /* ecma_op_ordinary_object_prevent_extensions */\n\n/**\n * Checks whether an object (excluding prototypes) has a named property\n *\n * @return true - if property is found\n *         false - otherwise\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_op_ordinary_object_has_own_property (ecma_object_t *object_p, /**< the object */\n                                          ecma_string_t *property_name_p) /**< property name */\n{\n  JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));\n\n  ecma_property_t property =\n    ecma_op_object_get_own_property (object_p, property_name_p, NULL, ECMA_PROPERTY_GET_NO_OPTIONS);\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  if (JERRY_UNLIKELY (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_THROW))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n  JERRY_ASSERT (ECMA_PROPERTY_IS_FOUND (property) || property == ECMA_PROPERTY_TYPE_NOT_FOUND\n                || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);\n\n  return ecma_make_boolean_value (ECMA_PROPERTY_IS_FOUND (property));\n} /* ecma_op_ordinary_object_has_own_property */\n\n/**\n * Checks whether an object (excluding prototypes) has a named property. Handles proxy objects too.\n *\n * @return true - if property is found\n *         false - otherwise\n */\necma_value_t\necma_op_object_has_own_property (ecma_object_t *object_p, /**< the object */\n                                 ecma_string_t *property_name_p) /**< property name */\n{\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (object_p))\n  {\n    ecma_property_descriptor_t prop_desc;\n\n    ecma_value_t status = ecma_proxy_object_get_own_property_descriptor (object_p, property_name_p, &prop_desc);\n\n    if (ecma_is_value_true (status))\n    {\n      ecma_free_property_descriptor (&prop_desc);\n    }\n\n    return status;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  return ecma_op_ordinary_object_has_own_property (object_p, property_name_p);\n} /* ecma_op_object_has_own_property */\n\n#if JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER\n\n/**\n * Set a weak reference from a container or WeakRefObject to a key object\n */\nvoid\necma_op_object_set_weak (ecma_object_t *object_p, /**< key object */\n                         ecma_object_t *target_p) /**< target object */\n{\n  if (JERRY_UNLIKELY (ecma_op_object_is_fast_array (object_p)))\n  {\n    ecma_fast_array_convert_to_normal (object_p);\n  }\n\n  ecma_string_t *weak_refs_string_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_WEAK_REFS);\n  ecma_property_t *property_p = ecma_find_named_property (object_p, weak_refs_string_p);\n  ecma_collection_t *refs_p;\n\n  if (property_p == NULL)\n  {\n    refs_p = ecma_new_collection ();\n\n    ecma_property_value_t *value_p;\n    ECMA_CREATE_INTERNAL_PROPERTY (object_p, weak_refs_string_p, property_p, value_p);\n    ECMA_SET_INTERNAL_VALUE_POINTER (value_p->value, refs_p);\n  }\n  else\n  {\n    refs_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, (ECMA_PROPERTY_VALUE_PTR (property_p)->value));\n  }\n\n  const ecma_value_t target_value = ecma_make_object_value ((ecma_object_t *) target_p);\n  for (uint32_t i = 0; i < refs_p->item_count; i++)\n  {\n    if (ecma_is_value_empty (refs_p->buffer_p[i]))\n    {\n      refs_p->buffer_p[i] = target_value;\n      return;\n    }\n  }\n\n  ecma_collection_push_back (refs_p, target_value);\n} /* ecma_op_object_set_weak */\n\n/**\n * Helper function to remove a weak reference to an object.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\nvoid\necma_op_object_unref_weak (ecma_object_t *object_p, /**< this argument */\n                           ecma_value_t ref_holder) /**< key argument */\n{\n  ecma_string_t *weak_refs_string_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_WEAK_REFS);\n\n  ecma_property_t *property_p = ecma_find_named_property (object_p, weak_refs_string_p);\n  JERRY_ASSERT (property_p != NULL);\n\n  ecma_collection_t *refs_p =\n    ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, ECMA_PROPERTY_VALUE_PTR (property_p)->value);\n  ecma_value_t *buffer_p = refs_p->buffer_p;\n\n  while (true)\n  {\n    if (*buffer_p == ref_holder)\n    {\n      *buffer_p = ECMA_VALUE_EMPTY;\n      return;\n    }\n    JERRY_ASSERT (buffer_p < refs_p->buffer_p + refs_p->item_count);\n    buffer_p++;\n  }\n} /* ecma_op_object_unref_weak */\n\n#endif /* JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER */\n/**\n * Raise property redefinition error\n *\n * @return ECMA_VALUE_FALSE - if JERRY_PROP_SHOULD_THROW is not set\n *         raised TypeError - otherwise\n */\necma_value_t\necma_raise_property_redefinition (ecma_string_t *property_name_p, /**< property name */\n                                  uint16_t flags) /**< property descriptor flags */\n{\n  JERRY_UNUSED (property_name_p);\n\n  return ECMA_REJECT_WITH_FORMAT (flags & JERRY_PROP_SHOULD_THROW,\n                                  \"Cannot redefine property: %\",\n                                  ecma_make_prop_name_value (property_name_p));\n} /* ecma_raise_property_redefinition */\n\n/**\n * Raise readonly assignment error\n *\n * @return ECMA_VALUE_FALSE - if is_throw is true\n *         raised TypeError - otherwise\n */\necma_value_t\necma_raise_readonly_assignment (ecma_string_t *property_name_p, /**< property name */\n                                bool is_throw) /**< is throw flag */\n{\n  JERRY_UNUSED (property_name_p);\n\n  return ECMA_REJECT_WITH_FORMAT (is_throw,\n                                  \"Cannot assign to read only property '%'\",\n                                  ecma_make_prop_name_value (property_name_p));\n} /* ecma_raise_readonly_assignment */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-objects.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_OBJECTS_H\n#define ECMA_OBJECTS_H\n\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaobjectsinternalops ECMA objects' operations\n * @{\n */\n\n#if JERRY_ERROR_MESSAGES\n/**\n * Reject with TypeError depending on 'is_throw' with the given format\n */\n#define ECMA_REJECT_WITH_FORMAT(is_throw, msg, ...) \\\n  ((is_throw) ? ecma_raise_standard_error_with_format (JERRY_ERROR_TYPE, (msg), __VA_ARGS__) : ECMA_VALUE_FALSE)\n\n/**\n * Reject with TypeError depending on 'is_throw' with the given message\n */\n#define ECMA_REJECT(is_throw, msg) ((is_throw) ? ecma_raise_type_error (msg) : ECMA_VALUE_FALSE)\n#else /* !JERRY_ERROR_MESSAGES */\n/**\n * Reject with TypeError depending on is_throw flags wit the given format\n */\n#define ECMA_REJECT_WITH_FORMAT(is_throw, msg, ...) ECMA_REJECT ((is_throw), (msg))\n\n/**\n * Reject with TypeError depending on is_throw flags wit the given message\n */\n#define ECMA_REJECT(is_throw, msg)                  ((is_throw) ? ecma_raise_type_error (ECMA_ERR_EMPTY) : ECMA_VALUE_FALSE)\n#endif /* JERRY_ERROR_MESSAGES */\n\necma_value_t ecma_raise_property_redefinition (ecma_string_t *property_name_p, uint16_t flags);\necma_value_t ecma_raise_readonly_assignment (ecma_string_t *property_name_p, bool is_throw);\n\necma_property_t ecma_op_object_get_own_property (ecma_object_t *object_p,\n                                                 ecma_string_t *property_name_p,\n                                                 ecma_property_ref_t *property_ref_p,\n                                                 uint32_t options);\necma_value_t ecma_op_ordinary_object_has_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p);\necma_value_t ecma_op_object_has_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p);\necma_value_t ecma_op_object_has_property (ecma_object_t *object_p, ecma_string_t *property_name_p);\necma_value_t ecma_op_object_find_own (ecma_value_t base_value, ecma_object_t *object_p, ecma_string_t *property_name_p);\necma_value_t ecma_op_object_find (ecma_object_t *object_p, ecma_string_t *property_name_p);\necma_value_t ecma_op_object_find_by_index (ecma_object_t *object_p, ecma_length_t index);\necma_value_t ecma_op_object_get (ecma_object_t *object_p, ecma_string_t *property_name_p);\necma_value_t\necma_op_object_get_with_receiver (ecma_object_t *object_p, ecma_string_t *property_name_p, ecma_value_t receiver);\necma_value_t ecma_op_object_get_length (ecma_object_t *object_p, ecma_length_t *length_p);\necma_value_t ecma_op_object_get_by_index (ecma_object_t *object_p, ecma_length_t index);\necma_value_t ecma_op_object_get_by_magic_id (ecma_object_t *object_p, lit_magic_string_id_t property_id);\necma_string_t *ecma_op_get_global_symbol (lit_magic_string_id_t property_id);\nbool ecma_op_compare_string_to_global_symbol (ecma_string_t *string_p, lit_magic_string_id_t property_id);\necma_value_t ecma_op_object_get_by_symbol_id (ecma_object_t *object_p, lit_magic_string_id_t property_id);\necma_value_t ecma_op_get_method_by_symbol_id (ecma_value_t value, lit_magic_string_id_t symbol_id);\necma_value_t ecma_op_get_method_by_magic_id (ecma_value_t value, lit_magic_string_id_t magic_id);\necma_value_t ecma_op_object_put_with_receiver (ecma_object_t *object_p,\n                                               ecma_string_t *property_name_p,\n                                               ecma_value_t value,\n                                               ecma_value_t receiver,\n                                               bool is_throw);\necma_value_t\necma_op_object_put (ecma_object_t *object_p, ecma_string_t *property_name_p, ecma_value_t value, bool is_throw);\necma_value_t ecma_op_object_put_with_receiver (ecma_object_t *object_p,\n                                               ecma_string_t *property_name_p,\n                                               ecma_value_t value,\n                                               ecma_value_t receiver,\n                                               bool is_throw);\necma_value_t\necma_op_object_put_by_index (ecma_object_t *object_p, ecma_length_t index, ecma_value_t value, bool is_throw);\necma_value_t ecma_op_object_delete (ecma_object_t *obj_p, ecma_string_t *property_name_p, bool is_throw);\necma_value_t ecma_op_object_delete_by_index (ecma_object_t *obj_p, ecma_length_t index, bool is_throw);\necma_value_t ecma_op_object_default_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint);\necma_value_t ecma_op_object_define_own_property (ecma_object_t *obj_p,\n                                                 ecma_string_t *property_name_p,\n                                                 const ecma_property_descriptor_t *property_desc_p);\necma_value_t ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p,\n                                                         ecma_string_t *property_name_p,\n                                                         ecma_property_descriptor_t *prop_desc_p);\necma_value_t ecma_op_object_has_instance (ecma_object_t *obj_p, ecma_value_t value);\necma_object_t *ecma_op_object_get_prototype_of (ecma_object_t *obj_p);\n\necma_value_t ecma_op_object_is_prototype_of (ecma_object_t *base_p, ecma_object_t *target_p);\necma_collection_t *ecma_op_object_get_enumerable_property_names (ecma_object_t *obj_p,\n                                                                 ecma_enumerable_property_names_options_t option);\necma_collection_t *ecma_op_object_own_property_keys (ecma_object_t *obj_p, jerry_property_filter_t filter);\necma_collection_t *ecma_op_object_enumerate (ecma_object_t *obj_p);\n\nlit_magic_string_id_t ecma_object_get_class_name (ecma_object_t *obj_p);\n#if JERRY_BUILTIN_REGEXP\nbool ecma_object_is_regexp_object (ecma_value_t arg);\n#endif /* JERRY_BUILTIN_REGEXP */\necma_value_t ecma_op_is_concat_spreadable (ecma_value_t arg);\necma_value_t ecma_op_is_regexp (ecma_value_t arg);\necma_value_t ecma_op_species_constructor (ecma_object_t *this_value, ecma_builtin_id_t default_constructor_id);\necma_value_t ecma_op_invoke_by_symbol_id (ecma_value_t object,\n                                          lit_magic_string_id_t magic_string_id,\n                                          ecma_value_t *args_p,\n                                          uint32_t args_len);\n#if JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER\nvoid ecma_op_object_set_weak (ecma_object_t *object_p, ecma_object_t *target_p);\nvoid ecma_op_object_unref_weak (ecma_object_t *object_p, ecma_value_t ref_holder);\n#endif /* JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER */\necma_value_t\necma_op_invoke (ecma_value_t object, ecma_string_t *property_name_p, ecma_value_t *args_p, uint32_t args_len);\necma_value_t ecma_op_invoke_by_magic_id (ecma_value_t object,\n                                         lit_magic_string_id_t magic_string_id,\n                                         ecma_value_t *args_p,\n                                         uint32_t args_len);\n\njmem_cpointer_t ecma_op_ordinary_object_get_prototype_of (ecma_object_t *obj_p);\necma_value_t ecma_op_ordinary_object_set_prototype_of (ecma_object_t *base_p, ecma_value_t proto);\nbool JERRY_ATTR_PURE ecma_op_ordinary_object_is_extensible (ecma_object_t *object_p);\nvoid ecma_op_ordinary_object_prevent_extensions (ecma_object_t *object_p);\n\n#if JERRY_BUILTIN_PROXY\necma_value_t ecma_op_get_own_property_descriptor (ecma_value_t target,\n                                                  ecma_string_t *property_name_p,\n                                                  ecma_property_descriptor_t *prop_desc_p);\n#endif /* JERRY_BUILTIN_PROXY */\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_OBJECTS_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-promise-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-promise-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-boolean-object.h\"\n#include \"ecma-builtin-handlers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-jobqueue.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmapromiseobject ECMA Promise object related routines\n * @{\n */\n\n/**\n * Check if an object is promise.\n *\n * @return true - if the object is a promise.\n *         false - otherwise.\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_is_promise (ecma_object_t *obj_p) /**< points to object */\n{\n  return ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_PROMISE);\n} /* ecma_is_promise */\n\n/**\n * Get the result of the promise.\n *\n * @return ecma value of the promise result.\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_promise_get_result (ecma_object_t *obj_p) /**< points to promise object */\n{\n  JERRY_ASSERT (ecma_is_promise (obj_p));\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n\n  return ecma_copy_value (ext_object_p->u.cls.u3.value);\n} /* ecma_promise_get_result */\n\n/**\n * Set the PromiseResult of promise.\n */\nstatic inline void JERRY_ATTR_ALWAYS_INLINE\necma_promise_set_result (ecma_object_t *obj_p, /**< points to promise object */\n                         ecma_value_t result) /**< the result value */\n{\n  JERRY_ASSERT (ecma_is_promise (obj_p));\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n\n  JERRY_ASSERT (ext_object_p->u.cls.u3.value == ECMA_VALUE_UNDEFINED);\n\n  ext_object_p->u.cls.u3.value = result;\n} /* ecma_promise_set_result */\n\n/**\n * Get the PromiseState of promise.\n *\n * @return the state's enum value\n */\nuint8_t\necma_promise_get_flags (ecma_object_t *obj_p) /**< points to promise object */\n{\n  JERRY_ASSERT (ecma_is_promise (obj_p));\n\n  return ((ecma_extended_object_t *) obj_p)->u.cls.u1.promise_flags;\n} /* ecma_promise_get_flags */\n\n/**\n * Set the PromiseState of promise.\n */\nstatic inline void JERRY_ATTR_ALWAYS_INLINE\necma_promise_set_state (ecma_object_t *obj_p, /**< points to promise object */\n                        bool is_fulfilled) /**< new flags */\n{\n  JERRY_ASSERT (ecma_is_promise (obj_p));\n  JERRY_ASSERT (ecma_promise_get_flags (obj_p) & ECMA_PROMISE_IS_PENDING);\n\n  uint8_t flags_to_invert =\n    (is_fulfilled ? (ECMA_PROMISE_IS_PENDING | ECMA_PROMISE_IS_FULFILLED) : ECMA_PROMISE_IS_PENDING);\n\n  ((ecma_extended_object_t *) obj_p)->u.cls.u1.promise_flags ^= flags_to_invert;\n} /* ecma_promise_set_state */\n\n/**\n * Take a collection of Reactions and enqueue a new PromiseReactionJob for each Reaction.\n *\n * See also: ES2015 25.4.1.8\n */\nstatic void\necma_promise_trigger_reactions (ecma_collection_t *reactions, /**< lists of reactions */\n                                ecma_value_t value, /**< value for resolve or reject */\n                                bool is_reject) /**< true if promise is rejected, false otherwise */\n{\n  ecma_value_t *buffer_p = reactions->buffer_p;\n  ecma_value_t *buffer_end_p = buffer_p + reactions->item_count;\n\n  while (buffer_p < buffer_end_p)\n  {\n    ecma_value_t object_with_tag = *buffer_p++;\n    ecma_object_t *object_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, object_with_tag);\n    ecma_value_t object = ecma_make_object_value (object_p);\n\n    if (JMEM_CP_GET_THIRD_BIT_FROM_POINTER_TAG (object_with_tag))\n    {\n      ecma_enqueue_promise_async_reaction_job (object, value, is_reject);\n      continue;\n    }\n\n    if (!is_reject)\n    {\n      ecma_value_t handler = ECMA_VALUE_TRUE;\n\n      if (JMEM_CP_GET_FIRST_BIT_FROM_POINTER_TAG (object_with_tag))\n      {\n        handler = *buffer_p++;\n      }\n\n      ecma_enqueue_promise_reaction_job (object, handler, value);\n    }\n    else if (JMEM_CP_GET_FIRST_BIT_FROM_POINTER_TAG (object_with_tag))\n    {\n      buffer_p++;\n    }\n\n    if (is_reject)\n    {\n      ecma_value_t handler = ECMA_VALUE_FALSE;\n\n      if (JMEM_CP_GET_SECOND_BIT_FROM_POINTER_TAG (object_with_tag))\n      {\n        handler = *buffer_p++;\n      }\n\n      ecma_enqueue_promise_reaction_job (object, handler, value);\n    }\n    else if (JMEM_CP_GET_SECOND_BIT_FROM_POINTER_TAG (object_with_tag))\n    {\n      buffer_p++;\n    }\n  }\n} /* ecma_promise_trigger_reactions */\n\n/**\n * Checks whether a resolver is called before.\n *\n * @return true if it was called before, false otherwise\n */\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\necma_is_resolver_already_called (ecma_object_t *promise_obj_p) /**< promise */\n{\n  return (ecma_promise_get_flags (promise_obj_p) & ECMA_PROMISE_ALREADY_RESOLVED) != 0;\n} /* ecma_is_resolver_already_called */\n\n/**\n * Reject a Promise with a reason.\n *\n * See also: ES2015 25.4.1.7\n */\nvoid\necma_reject_promise (ecma_value_t promise, /**< promise */\n                     ecma_value_t reason) /**< reason for reject */\n{\n  ecma_object_t *obj_p = ecma_get_object_from_value (promise);\n\n  JERRY_ASSERT (ecma_promise_get_flags (obj_p) & ECMA_PROMISE_IS_PENDING);\n\n#if JERRY_PROMISE_CALLBACK\n  if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_REJECT))\n  {\n    JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n    JERRY_CONTEXT (promise_callback)\n    (JERRY_PROMISE_EVENT_REJECT, promise, reason, JERRY_CONTEXT (promise_callback_user_p));\n  }\n#endif /* JERRY_PROMISE_CALLBACK */\n\n  ecma_promise_set_state (obj_p, false);\n  ecma_promise_set_result (obj_p, ecma_copy_value_if_not_object (reason));\n  ecma_promise_object_t *promise_p = (ecma_promise_object_t *) obj_p;\n\n  /* GC can be triggered by ecma_new_collection so freeing the collection\n     first and creating a new one might cause a heap after use event. */\n  ecma_collection_t *reactions = promise_p->reactions;\n\n  /* Fulfill reactions will never be triggered. */\n  ecma_promise_trigger_reactions (reactions, reason, true);\n\n#if JERRY_PROMISE_CALLBACK\n  if (reactions->item_count == 0)\n  {\n    ((ecma_extended_object_t *) obj_p)->u.cls.u1.promise_flags |= ECMA_PROMISE_UNHANDLED_REJECT;\n\n    if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))\n    {\n      JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n      JERRY_CONTEXT (promise_callback)\n      (JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER, promise, reason, JERRY_CONTEXT (promise_callback_user_p));\n    }\n  }\n#endif /* JERRY_PROMISE_CALLBACK */\n\n  promise_p->reactions = ecma_new_collection ();\n\n  ecma_collection_destroy (reactions);\n} /* ecma_reject_promise */\n\n/**\n * Fulfill a Promise with a value.\n *\n * See also: ES2015 25.4.1.4\n */\nvoid\necma_fulfill_promise (ecma_value_t promise, /**< promise */\n                      ecma_value_t value) /**< fulfilled value */\n{\n  ecma_object_t *obj_p = ecma_get_object_from_value (promise);\n\n  JERRY_ASSERT (ecma_promise_get_flags (obj_p) & ECMA_PROMISE_IS_PENDING);\n\n  if (promise == value)\n  {\n    ecma_raise_type_error (ECMA_ERR_PROMISE_RESOLVE_ITSELF);\n    ecma_value_t exception = jcontext_take_exception ();\n    ecma_reject_promise (promise, exception);\n    ecma_free_value (exception);\n    return;\n  }\n\n  if (ecma_is_value_object (value))\n  {\n    ecma_value_t then = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (value), LIT_MAGIC_STRING_THEN);\n\n    if (ECMA_IS_VALUE_ERROR (then))\n    {\n      then = jcontext_take_exception ();\n      ecma_reject_promise (promise, then);\n      ecma_free_value (then);\n      return;\n    }\n\n    if (ecma_op_is_callable (then))\n    {\n      ecma_enqueue_promise_resolve_thenable_job (promise, value, then);\n      ecma_free_value (then);\n      return;\n    }\n\n    ecma_free_value (then);\n  }\n\n#if JERRY_PROMISE_CALLBACK\n  if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_RESOLVE))\n  {\n    JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n    JERRY_CONTEXT (promise_callback)\n    (JERRY_PROMISE_EVENT_RESOLVE, promise, value, JERRY_CONTEXT (promise_callback_user_p));\n  }\n#endif /* JERRY_PROMISE_CALLBACK */\n\n  ecma_promise_set_state (obj_p, true);\n  ecma_promise_set_result (obj_p, ecma_copy_value_if_not_object (value));\n  ecma_promise_object_t *promise_p = (ecma_promise_object_t *) obj_p;\n\n  /* GC can be triggered by ecma_new_collection so freeing the collection\n     first and creating a new one might cause a heap after use event. */\n  ecma_collection_t *reactions = promise_p->reactions;\n\n  /* Reject reactions will never be triggered. */\n  ecma_promise_trigger_reactions (reactions, value, false);\n\n  promise_p->reactions = ecma_new_collection ();\n\n  ecma_collection_destroy (reactions);\n} /* ecma_fulfill_promise */\n\n/**\n * Reject a Promise with a reason. Sanity checks are performed before the reject.\n *\n * See also: ES2015 25.4.1.3.1\n *\n * @return ecma value of undefined.\n */\necma_value_t\necma_reject_promise_with_checks (ecma_value_t promise, /**< promise */\n                                 ecma_value_t reason) /**< reason for reject */\n{\n  /* 1. */\n  ecma_object_t *promise_obj_p = ecma_get_object_from_value (promise);\n  JERRY_ASSERT (ecma_is_promise (promise_obj_p));\n\n  /* 3., 4. */\n  if (JERRY_UNLIKELY (ecma_is_resolver_already_called (promise_obj_p)))\n  {\n#if JERRY_PROMISE_CALLBACK\n    if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))\n    {\n      JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n      JERRY_CONTEXT (promise_callback)\n      (JERRY_PROMISE_EVENT_REJECT_FULFILLED, promise, reason, JERRY_CONTEXT (promise_callback_user_p));\n    }\n#endif /* JERRY_PROMISE_CALLBACK */\n\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  /* 5. */\n  ((ecma_extended_object_t *) promise_obj_p)->u.cls.u1.promise_flags |= ECMA_PROMISE_ALREADY_RESOLVED;\n\n  /* 6. */\n  ecma_reject_promise (promise, reason);\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_reject_promise_with_checks */\n\n/**\n * Fulfill a Promise with a value. Sanity checks are performed before the resolve.\n *\n * See also: ES2015 25.4.1.3.2\n *\n * @return ecma value of undefined.\n */\necma_value_t\necma_fulfill_promise_with_checks (ecma_value_t promise, /**< promise */\n                                  ecma_value_t value) /**< fulfilled value */\n{\n  /* 1. */\n  ecma_object_t *promise_obj_p = ecma_get_object_from_value (promise);\n  JERRY_ASSERT (ecma_is_promise (promise_obj_p));\n\n  /* 3., 4. */\n  if (JERRY_UNLIKELY (ecma_is_resolver_already_called (promise_obj_p)))\n  {\n#if JERRY_PROMISE_CALLBACK\n    if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))\n    {\n      JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n      JERRY_CONTEXT (promise_callback)\n      (JERRY_PROMISE_EVENT_RESOLVE_FULFILLED, promise, value, JERRY_CONTEXT (promise_callback_user_p));\n    }\n#endif /* JERRY_PROMISE_CALLBACK */\n\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  /* 5. */\n  ((ecma_extended_object_t *) promise_obj_p)->u.cls.u1.promise_flags |= ECMA_PROMISE_ALREADY_RESOLVED;\n\n  ecma_fulfill_promise (promise, value);\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_fulfill_promise_with_checks */\n\n/**\n * Native handler for Promise Reject Function.\n *\n * @return ecma value of undefined.\n */\necma_value_t\necma_promise_reject_handler (ecma_object_t *function_obj_p, /**< function object */\n                             const ecma_value_t args_p[], /**< argument list */\n                             const uint32_t args_count) /**< argument number */\n{\n  ecma_promise_resolver_t *function_p = (ecma_promise_resolver_t *) function_obj_p;\n\n  ecma_value_t reject_value = (args_count == 0) ? ECMA_VALUE_UNDEFINED : args_p[0];\n  return ecma_reject_promise_with_checks (function_p->promise, reject_value);\n} /* ecma_promise_reject_handler */\n\n/**\n * Native handler for Promise Resolve Function.\n *\n * @return ecma value of undefined.\n */\necma_value_t\necma_promise_resolve_handler (ecma_object_t *function_obj_p, /**< function object */\n                              const ecma_value_t args_p[], /**< argument list */\n                              const uint32_t args_count) /**< argument number */\n{\n  ecma_promise_resolver_t *function_p = (ecma_promise_resolver_t *) function_obj_p;\n\n  ecma_value_t fulfilled_value = (args_count == 0) ? ECMA_VALUE_UNDEFINED : args_p[0];\n  return ecma_fulfill_promise_with_checks (function_p->promise, fulfilled_value);\n} /* ecma_promise_resolve_handler */\n\n/**\n * Helper function for PromiseCreateResolvingFunctions.\n *\n * See also: ES2015 25.4.1.3 2. - 7.\n *\n * @return pointer to the resolving function\n */\nstatic ecma_object_t *\necma_promise_create_resolving_function (ecma_object_t *promise_p, /**< Promise Object */\n                                        ecma_native_handler_id_t id) /**< Callback handler */\n{\n  ecma_object_t *func_obj_p = ecma_op_create_native_handler (id, sizeof (ecma_promise_resolver_t));\n\n  ecma_promise_resolver_t *resolver_p = (ecma_promise_resolver_t *) func_obj_p;\n  resolver_p->promise = ecma_make_object_value (promise_p);\n\n  return func_obj_p;\n} /* ecma_promise_create_resolving_function */\n\n/**\n * Helper function for running an executor.\n *\n * @return ecma value of the executor callable\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_promise_run_executor (ecma_object_t *promise_p, /**< Promise Object */\n                           ecma_value_t executor, /**< executor function */\n                           ecma_value_t this_value) /**< this value */\n{\n  ecma_object_t *resolve_func_p, *reject_func_p;\n  resolve_func_p = ecma_promise_create_resolving_function (promise_p, ECMA_NATIVE_HANDLER_PROMISE_RESOLVE);\n  reject_func_p = ecma_promise_create_resolving_function (promise_p, ECMA_NATIVE_HANDLER_PROMISE_REJECT);\n\n  ecma_value_t argv[] = { ecma_make_object_value (resolve_func_p), ecma_make_object_value (reject_func_p) };\n  ecma_value_t result = ecma_op_function_call (ecma_get_object_from_value (executor), this_value, argv, 2);\n  ecma_deref_object (resolve_func_p);\n  ecma_deref_object (reject_func_p);\n\n  return result;\n} /* ecma_promise_run_executor */\n\n/**\n * Create a promise object.\n *\n * See also: ES2015 25.4.3.1\n *\n * @return ecma value of the new promise object\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_create_promise_object (ecma_value_t executor, /**< the executor function or ECMA_VALUE_EMPTY */\n                               ecma_value_t parent, /**< parent promise if available */\n                               ecma_object_t *new_target_p) /**< new.target value */\n{\n  JERRY_UNUSED (parent);\n\n  if (new_target_p == NULL)\n  {\n    new_target_p = ecma_builtin_get (ECMA_BUILTIN_ID_PROMISE);\n  }\n\n  /* 3. */\n  ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (new_target_p, ECMA_BUILTIN_ID_PROMISE_PROTOTYPE);\n\n  if (JERRY_UNLIKELY (proto_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  /* Calling ecma_new_collection might trigger a GC call, so this\n   * allocation is performed before the object is constructed. */\n  ecma_collection_t *reactions = ecma_new_collection ();\n\n  ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_promise_object_t), ECMA_OBJECT_TYPE_CLASS);\n  ecma_deref_object (proto_p);\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_PROMISE;\n  /* 5 */\n  ext_object_p->u.cls.u1.promise_flags = ECMA_PROMISE_IS_PENDING;\n  ext_object_p->u.cls.u3.value = ECMA_VALUE_UNDEFINED;\n\n  /* 6-8. */\n  ecma_promise_object_t *promise_object_p = (ecma_promise_object_t *) object_p;\n  promise_object_p->reactions = reactions;\n\n#if JERRY_PROMISE_CALLBACK\n  if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_CREATE))\n  {\n    JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n    JERRY_CONTEXT (promise_callback)\n    (JERRY_PROMISE_EVENT_CREATE, ecma_make_object_value (object_p), parent, JERRY_CONTEXT (promise_callback_user_p));\n  }\n#endif /* JERRY_PROMISE_CALLBACK */\n\n  /* 9. */\n  ecma_value_t completion = ECMA_VALUE_UNDEFINED;\n\n  if (executor != ECMA_VALUE_EMPTY)\n  {\n    JERRY_ASSERT (ecma_op_is_callable (executor));\n\n    completion = ecma_promise_run_executor (object_p, executor, ECMA_VALUE_UNDEFINED);\n  }\n\n  ecma_value_t status = ECMA_VALUE_EMPTY;\n\n  if (ECMA_IS_VALUE_ERROR (completion))\n  {\n    /* 10.a. */\n    completion = jcontext_take_exception ();\n    ecma_reject_promise_with_checks (ecma_make_object_value (object_p), completion);\n  }\n\n  ecma_free_value (completion);\n\n  /* 10.b. */\n  if (ECMA_IS_VALUE_ERROR (status))\n  {\n    ecma_deref_object (object_p);\n    return status;\n  }\n\n  /* 11. */\n  ecma_free_value (status);\n  return ecma_make_object_value (object_p);\n} /* ecma_op_create_promise_object */\n\n/**\n * Helper function for increase or decrease the remaining count.\n *\n * @return the current remaining count after increase or decrease.\n */\nuint32_t\necma_promise_remaining_inc_or_dec (ecma_value_t remaining, /**< the remaining count */\n                                   bool is_inc) /**< whether to increase the count */\n{\n  JERRY_ASSERT (ecma_is_value_object (remaining));\n\n  ecma_object_t *remaining_p = ecma_get_object_from_value (remaining);\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) remaining_p;\n\n  JERRY_ASSERT (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_NUMBER);\n\n  JERRY_ASSERT (ecma_is_value_integer_number (ext_object_p->u.cls.u3.value));\n\n  uint32_t current = (uint32_t) ecma_get_integer_from_value (ext_object_p->u.cls.u3.value);\n\n  if (is_inc)\n  {\n    current++;\n  }\n  else\n  {\n    current--;\n  }\n  ext_object_p->u.cls.u3.value = ecma_make_uint32_value (current);\n\n  return current;\n} /* ecma_promise_remaining_inc_or_dec */\n\n/**\n * Native handler for Promise.all and Promise.allSettled Resolve Element Function.\n *\n * See also:\n *         ES2015 25.4.4.1.2\n *\n * @return ecma value of undefined.\n */\necma_value_t\necma_promise_all_or_all_settled_handler_cb (ecma_object_t *function_obj_p, /**< function object */\n                                            const ecma_value_t args_p[], /**< argument list */\n                                            const uint32_t args_count) /**< argument number */\n{\n  ecma_value_t arg = args_count > 0 ? args_p[0] : ECMA_VALUE_UNDEFINED;\n\n  ecma_promise_all_executor_t *executor_p = (ecma_promise_all_executor_t *) function_obj_p;\n  uint8_t promise_type = executor_p->header.u.built_in.u2.routine_flags;\n\n  promise_type = (uint8_t) (promise_type >> ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT);\n\n  /* 1 - 2. */\n  if (executor_p->index == 0)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  if (promise_type == ECMA_PROMISE_ALL_RESOLVE || promise_type == ECMA_PROMISE_ANY_REJECT)\n  {\n    /* 8. */\n    ecma_op_object_put_by_index (ecma_get_object_from_value (executor_p->values),\n                                 (uint32_t) (executor_p->index - 1),\n                                 arg,\n                                 false);\n  }\n  else\n  {\n    lit_magic_string_id_t status_property_val = LIT_MAGIC_STRING_REJECTED;\n    lit_magic_string_id_t data_propery_name = LIT_MAGIC_STRING_REASON;\n\n    if (promise_type == ECMA_PROMISE_ALLSETTLED_RESOLVE)\n    {\n      status_property_val = LIT_MAGIC_STRING_FULFILLED;\n      data_propery_name = LIT_MAGIC_STRING_VALUE;\n    }\n\n    ecma_object_t *obj_p =\n      ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL);\n    ecma_property_value_t *prop_value_p;\n    prop_value_p = ecma_create_named_data_property (obj_p,\n                                                    ecma_get_magic_string (LIT_MAGIC_STRING_STATUS),\n                                                    ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                    NULL);\n\n    prop_value_p->value = ecma_make_magic_string_value (status_property_val);\n\n    prop_value_p = ecma_create_named_data_property (obj_p,\n                                                    ecma_get_magic_string (data_propery_name),\n                                                    ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                    NULL);\n    prop_value_p->value = ecma_copy_value_if_not_object (arg);\n\n    ecma_value_t obj_val = ecma_make_object_value (obj_p);\n    /* 12. */\n    ecma_op_object_put_by_index (ecma_get_object_from_value (executor_p->values),\n                                 (uint32_t) (executor_p->index - 1),\n                                 obj_val,\n                                 false);\n    ecma_deref_object (obj_p);\n  }\n  /* 3. */\n  executor_p->index = 0;\n\n  /* 9-10. */\n  ecma_value_t ret = ECMA_VALUE_UNDEFINED;\n  if (ecma_promise_remaining_inc_or_dec (executor_p->remaining_elements, false) == 0)\n  {\n    ecma_value_t capability = executor_p->capability;\n    ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) ecma_get_object_from_value (capability);\n    if (promise_type == ECMA_PROMISE_ANY_REJECT)\n    {\n      ecma_value_t error_val = ecma_new_aggregate_error (executor_p->values, ECMA_VALUE_UNDEFINED);\n      ret =\n        ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), ECMA_VALUE_UNDEFINED, &error_val, 1);\n      ecma_free_value (error_val);\n    }\n    else\n    {\n      ret = ecma_op_function_call (ecma_get_object_from_value (capability_p->resolve),\n                                   ECMA_VALUE_UNDEFINED,\n                                   &executor_p->values,\n                                   1);\n    }\n  }\n\n  return ret;\n} /* ecma_promise_all_or_all_settled_handler_cb */\n\n/**\n * GetCapabilitiesExecutor Functions\n *\n * Checks and sets a promiseCapability's resolve and reject properties.\n *\n * See also: ES11 25.6.1.5.1\n *\n * @return ECMA_VALUE_UNDEFINED or TypeError\n *         returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_get_capabilities_executor_cb (ecma_object_t *function_obj_p, /**< function object */\n                                      const ecma_value_t args_p[], /**< argument list */\n                                      const uint32_t args_count) /**< argument number */\n{\n  /* 1. */\n  ecma_promise_capability_executor_t *executor_p = (ecma_promise_capability_executor_t *) function_obj_p;\n\n  /* 2-3. */\n  ecma_object_t *capability_obj_p = ecma_get_object_from_value (executor_p->capability);\n  JERRY_ASSERT (ecma_object_class_is (capability_obj_p, ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));\n  ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;\n\n  /* 4. */\n  if (!ecma_is_value_undefined (capability_p->resolve))\n  {\n    return ecma_raise_type_error (ECMA_ERR_RESOLVE_MUST_BE_UNDEFINED);\n  }\n\n  /* 5. */\n  if (!ecma_is_value_undefined (capability_p->reject))\n  {\n    return ecma_raise_type_error (ECMA_ERR_REJECT_MUST_BE_UNDEFINED);\n  }\n\n  /* 6. */\n  capability_p->resolve = (args_count > 0) ? args_p[0] : ECMA_VALUE_UNDEFINED;\n  /* 7. */\n  capability_p->reject = (args_count > 1) ? args_p[1] : ECMA_VALUE_UNDEFINED;\n\n  /* 8. */\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_op_get_capabilities_executor_cb */\n\n/**\n * Create a new PromiseCapability.\n *\n * See also: ES11 25.6.1.5\n *\n * @return NULL - if the operation raises error\n *         new PromiseCapability object - otherwise\n */\necma_object_t *\necma_promise_new_capability (ecma_value_t constructor, /**< constructor function */\n                             ecma_value_t parent) /**< parent promise if available */\n{\n  /* 1. */\n  if (!ecma_is_constructor (constructor))\n  {\n    ecma_raise_type_error (ECMA_ERR_INVALID_CAPABILITY);\n    return NULL;\n  }\n\n  ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor);\n\n  /* 3. */\n  ecma_object_t *capability_obj_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE),\n                                                        sizeof (ecma_promise_capabality_t),\n                                                        ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;\n  capability_p->header.u.cls.type = ECMA_OBJECT_CLASS_PROMISE_CAPABILITY;\n  capability_p->header.u.cls.u3.promise = ECMA_VALUE_UNDEFINED;\n  capability_p->resolve = ECMA_VALUE_UNDEFINED;\n  capability_p->reject = ECMA_VALUE_UNDEFINED;\n\n  /* 4-5. */\n  ecma_object_t *executor_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_CAPABILITY_EXECUTOR,\n                                                             sizeof (ecma_promise_capability_executor_t));\n\n  /* 6. */\n  ecma_promise_capability_executor_t *executor_func_p = (ecma_promise_capability_executor_t *) executor_p;\n  executor_func_p->capability = ecma_make_object_value (capability_obj_p);\n\n  /* 7. */\n  ecma_value_t executor = ecma_make_object_value (executor_p);\n  ecma_value_t promise;\n\n  if (constructor_obj_p == ecma_builtin_get (ECMA_BUILTIN_ID_PROMISE))\n  {\n    promise = ecma_op_create_promise_object (executor, parent, constructor_obj_p);\n  }\n  else\n  {\n    promise = ecma_op_function_construct (constructor_obj_p, constructor_obj_p, &executor, 1);\n  }\n\n  ecma_deref_object (executor_p);\n\n  if (ECMA_IS_VALUE_ERROR (promise))\n  {\n    ecma_deref_object (capability_obj_p);\n    return NULL;\n  }\n\n  /* 8. */\n  if (!ecma_op_is_callable (capability_p->resolve))\n  {\n    ecma_free_value (promise);\n    ecma_deref_object (capability_obj_p);\n    ecma_raise_type_error (ECMA_ERR_PARAMETER_RESOLVE_MUST_BE_CALLABLE);\n    return NULL;\n  }\n\n  /* 9. */\n  if (!ecma_op_is_callable (capability_p->reject))\n  {\n    ecma_free_value (promise);\n    ecma_deref_object (capability_obj_p);\n    ecma_raise_type_error (ECMA_ERR_PARAMETER_REJECT_MUST_BE_CALLABLE);\n    return NULL;\n  }\n\n  /* 10. */\n  capability_p->header.u.cls.u3.promise = promise;\n\n  ecma_free_value (promise);\n\n  /* 11. */\n  return capability_obj_p;\n} /* ecma_promise_new_capability */\n\n/**\n * The common function for 'reject' and 'resolve'.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_promise_reject_or_resolve (ecma_value_t this_arg, /**< \"this\" argument */\n                                ecma_value_t value, /**< rejected or resolved value */\n                                bool is_resolve) /**< the operation is resolve */\n{\n  if (!ecma_is_value_object (this_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  if (is_resolve && ecma_is_value_object (value) && ecma_is_promise (ecma_get_object_from_value (value)))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (value);\n    ecma_value_t constructor = ecma_op_object_get_by_magic_id (object_p, LIT_MAGIC_STRING_CONSTRUCTOR);\n\n    if (ECMA_IS_VALUE_ERROR (constructor))\n    {\n      return constructor;\n    }\n\n    /* The this_arg must be an object. */\n    bool is_same_value = (constructor == this_arg);\n    ecma_free_value (constructor);\n\n    if (is_same_value)\n    {\n      return ecma_copy_value (value);\n    }\n  }\n\n  ecma_object_t *capability_obj_p = ecma_promise_new_capability (this_arg, ECMA_VALUE_UNDEFINED);\n\n  if (JERRY_UNLIKELY (capability_obj_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;\n\n  ecma_value_t func = is_resolve ? capability_p->resolve : capability_p->reject;\n\n  ecma_value_t call_ret = ecma_op_function_call (ecma_get_object_from_value (func), ECMA_VALUE_UNDEFINED, &value, 1);\n\n  if (ECMA_IS_VALUE_ERROR (call_ret))\n  {\n    ecma_deref_object (capability_obj_p);\n    return call_ret;\n  }\n\n  ecma_free_value (call_ret);\n\n  ecma_value_t promise = ecma_copy_value (capability_p->header.u.cls.u3.promise);\n  ecma_deref_object (capability_obj_p);\n\n  return promise;\n} /* ecma_promise_reject_or_resolve */\n\n/**\n * The common function for ecma_builtin_promise_prototype_then\n * and ecma_builtin_promise_prototype_catch.\n *\n * @return ecma value of a new promise object.\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_promise_then (ecma_value_t promise, /**< the promise which call 'then' */\n                   ecma_value_t on_fulfilled, /**< on_fulfilled function */\n                   ecma_value_t on_rejected) /**< on_rejected function */\n{\n  if (!ecma_is_value_object (promise))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_object_t *obj = ecma_get_object_from_value (promise);\n\n  if (!ecma_is_promise (obj))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_PROMISE);\n  }\n\n  ecma_value_t species = ecma_op_species_constructor (obj, ECMA_BUILTIN_ID_PROMISE);\n  if (ECMA_IS_VALUE_ERROR (species))\n  {\n    return species;\n  }\n\n  ecma_object_t *result_capability_obj_p = ecma_promise_new_capability (species, promise);\n  ecma_free_value (species);\n\n  if (JERRY_UNLIKELY (result_capability_obj_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t ret = ecma_promise_perform_then (promise, on_fulfilled, on_rejected, result_capability_obj_p);\n  ecma_deref_object (result_capability_obj_p);\n\n  return ret;\n} /* ecma_promise_then */\n\n/**\n * Definition of valueThunk function\n *\n * See also:\n *         ES2020 25.6.5.3.1 step 8.\n *\n * @return ecma value\n */\necma_value_t\necma_value_thunk_helper_cb (ecma_object_t *function_obj_p, /**< function object */\n                            const ecma_value_t args_p[], /**< argument list */\n                            const uint32_t args_count) /**< argument number */\n{\n  JERRY_UNUSED_2 (args_p, args_count);\n\n  ecma_promise_value_thunk_t *value_thunk_obj_p = (ecma_promise_value_thunk_t *) function_obj_p;\n\n  return ecma_copy_value (value_thunk_obj_p->value);\n} /* ecma_value_thunk_helper_cb */\n\n/**\n * Definition of thrower function\n *\n * See also:\n *         ES2020 25.6.5.3.2 step 8.\n *\n * @return ecma value\n */\necma_value_t\necma_value_thunk_thrower_cb (ecma_object_t *function_obj_p, /**< function object */\n                             const ecma_value_t args_p[], /**< argument list */\n                             const uint32_t args_count) /**< argument number */\n{\n  JERRY_UNUSED_2 (args_p, args_count);\n\n  ecma_promise_value_thunk_t *value_thunk_obj_p = (ecma_promise_value_thunk_t *) function_obj_p;\n\n  jcontext_raise_exception (ecma_copy_value (value_thunk_obj_p->value));\n\n  return ECMA_VALUE_ERROR;\n} /* ecma_value_thunk_thrower_cb */\n\n/**\n * Helper function for Then Finally and Catch Finally common parts\n *\n * See also:\n *         ES2020 25.6.5.3.1\n *         ES2020 25.6.5.3.2\n *\n * @return ecma value\n */\nstatic ecma_value_t\necma_promise_then_catch_finally_helper (ecma_object_t *function_obj_p, /**< function object */\n                                        ecma_native_handler_id_t id, /**< handler id */\n                                        ecma_value_t arg) /**< callback function argument */\n{\n  /* 2. */\n  ecma_promise_finally_function_t *finally_func_obj = (ecma_promise_finally_function_t *) function_obj_p;\n\n  /* 3. */\n  JERRY_ASSERT (ecma_op_is_callable (finally_func_obj->on_finally));\n\n  /* 4. */\n  ecma_value_t result =\n    ecma_op_function_call (ecma_get_object_from_value (finally_func_obj->on_finally), ECMA_VALUE_UNDEFINED, NULL, 0);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  /* 6. */\n  JERRY_ASSERT (ecma_is_constructor (finally_func_obj->constructor));\n\n  /* 7. */\n  ecma_value_t promise = ecma_promise_reject_or_resolve (finally_func_obj->constructor, result, true);\n\n  ecma_free_value (result);\n\n  if (ECMA_IS_VALUE_ERROR (promise))\n  {\n    return promise;\n  }\n\n  /* 8. */\n  ecma_object_t *value_thunk_func_p;\n  value_thunk_func_p = ecma_op_create_native_handler (id, sizeof (ecma_promise_value_thunk_t));\n\n  ecma_promise_value_thunk_t *value_thunk_func_obj = (ecma_promise_value_thunk_t *) value_thunk_func_p;\n  value_thunk_func_obj->value = ecma_copy_value_if_not_object (arg);\n\n  /* 9. */\n  ecma_value_t value_thunk = ecma_make_object_value (value_thunk_func_p);\n  ecma_value_t ret_value = ecma_op_invoke_by_magic_id (promise, LIT_MAGIC_STRING_THEN, &value_thunk, 1);\n\n  ecma_free_value (promise);\n  ecma_deref_object (value_thunk_func_p);\n\n  return ret_value;\n} /* ecma_promise_then_catch_finally_helper */\n\n/**\n * Definition of Then Finally Function\n *\n * See also:\n *         ES2020 25.6.5.3.1\n *\n * @return ecma value\n */\necma_value_t\necma_promise_then_finally_cb (ecma_object_t *function_obj_p, /**< function object */\n                              const ecma_value_t args_p[], /**< argument list */\n                              const uint32_t args_count) /**< argument number */\n{\n  JERRY_UNUSED (args_count);\n  JERRY_ASSERT (args_count > 0);\n\n  return ecma_promise_then_catch_finally_helper (function_obj_p, ECMA_NATIVE_HANDLER_VALUE_THUNK, args_p[0]);\n} /* ecma_promise_then_finally_cb */\n\n/**\n * Definition of Catch Finally Function\n *\n * See also:\n *         ES2020 25.6.5.3.2\n *\n * @return ecma value\n */\necma_value_t\necma_promise_catch_finally_cb (ecma_object_t *function_obj_p, /**< function object */\n                               const ecma_value_t args_p[], /**< argument list */\n                               const uint32_t args_count) /**< argument number */\n{\n  JERRY_UNUSED (args_count);\n  JERRY_ASSERT (args_count > 0);\n\n  return ecma_promise_then_catch_finally_helper (function_obj_p, ECMA_NATIVE_HANDLER_VALUE_THROWER, args_p[0]);\n} /* ecma_promise_catch_finally_cb */\n\n/**\n * The common function for ecma_builtin_promise_prototype_finally\n *\n * @return ecma value of a new promise object.\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_promise_finally (ecma_value_t promise, /**< the promise which call 'finally' */\n                      ecma_value_t on_finally) /**< on_finally function */\n{\n  /* 2. */\n  if (!ecma_is_value_object (promise))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_object_t *obj = ecma_get_object_from_value (promise);\n\n  /* 3. */\n  ecma_value_t species = ecma_op_species_constructor (obj, ECMA_BUILTIN_ID_PROMISE);\n\n  if (ECMA_IS_VALUE_ERROR (species))\n  {\n    return species;\n  }\n\n  /* 4. */\n  JERRY_ASSERT (ecma_is_constructor (species));\n\n  /* 5. */\n  if (!ecma_op_is_callable (on_finally))\n  {\n    ecma_free_value (species);\n    ecma_value_t invoke_args[2] = { on_finally, on_finally };\n    return ecma_op_invoke_by_magic_id (promise, LIT_MAGIC_STRING_THEN, invoke_args, 2);\n  }\n\n  /* 6.a-b */\n  ecma_object_t *then_finally_obj_p;\n  then_finally_obj_p =\n    ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY, sizeof (ecma_promise_finally_function_t));\n\n  /* 6.c-d */\n  ecma_promise_finally_function_t *then_finally_func_obj_p = (ecma_promise_finally_function_t *) then_finally_obj_p;\n  then_finally_func_obj_p->constructor = species;\n  then_finally_func_obj_p->on_finally = on_finally;\n\n  /* 6.e-f */\n  ecma_object_t *catch_finally_obj_p;\n  catch_finally_obj_p =\n    ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY, sizeof (ecma_promise_finally_function_t));\n\n  /* 6.g-h */\n  ecma_promise_finally_function_t *catch_finally_func_obj = (ecma_promise_finally_function_t *) catch_finally_obj_p;\n  catch_finally_func_obj->constructor = species;\n  catch_finally_func_obj->on_finally = on_finally;\n\n  ecma_deref_object (ecma_get_object_from_value (species));\n\n  /* 7. */\n  ecma_value_t invoke_args[2] = { ecma_make_object_value (then_finally_obj_p),\n                                  ecma_make_object_value (catch_finally_obj_p) };\n\n  ecma_value_t ret_value = ecma_op_invoke_by_magic_id (promise, LIT_MAGIC_STRING_THEN, invoke_args, 2);\n\n  ecma_deref_object (then_finally_obj_p);\n  ecma_deref_object (catch_finally_obj_p);\n\n  return ret_value;\n} /* ecma_promise_finally */\n\n/**\n * Resume the execution of an async function after the promise is resolved\n */\nvoid\necma_promise_async_then (ecma_value_t promise, /**< promise object */\n                         ecma_value_t executable_object) /**< executable object of the async function */\n{\n#if JERRY_PROMISE_CALLBACK\n  if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ASYNC_MAIN))\n  {\n    JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n    JERRY_CONTEXT (promise_callback)\n    (JERRY_PROMISE_EVENT_ASYNC_AWAIT, executable_object, promise, JERRY_CONTEXT (promise_callback_user_p));\n  }\n#endif /* JERRY_PROMISE_CALLBACK */\n\n  ecma_object_t *promise_obj_p = ecma_get_object_from_value (promise);\n  uint16_t flags = ecma_promise_get_flags (promise_obj_p);\n\n  if (flags & ECMA_PROMISE_IS_PENDING)\n  {\n    ecma_value_t executable_object_with_tag;\n    ECMA_SET_NON_NULL_POINTER_TAG (executable_object_with_tag, ecma_get_object_from_value (executable_object), 0);\n    ECMA_SET_THIRD_BIT_TO_POINTER_TAG (executable_object_with_tag);\n\n    ecma_collection_push_back (((ecma_promise_object_t *) promise_obj_p)->reactions, executable_object_with_tag);\n    return;\n  }\n\n  ecma_value_t value = ecma_promise_get_result (promise_obj_p);\n  ecma_enqueue_promise_async_reaction_job (executable_object, value, !(flags & ECMA_PROMISE_IS_FULFILLED));\n  ecma_free_value (value);\n\n#if JERRY_PROMISE_CALLBACK\n  if (ecma_promise_get_flags (promise_obj_p) & ECMA_PROMISE_UNHANDLED_REJECT)\n  {\n    ((ecma_extended_object_t *) promise_obj_p)->u.cls.u1.promise_flags &= (uint8_t) ~ECMA_PROMISE_UNHANDLED_REJECT;\n\n    if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))\n    {\n      JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n      JERRY_CONTEXT (promise_callback)\n      (JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED, promise, ECMA_VALUE_UNDEFINED, JERRY_CONTEXT (promise_callback_user_p));\n    }\n  }\n#endif /* JERRY_PROMISE_CALLBACK */\n} /* ecma_promise_async_then */\n\n/**\n * Resolves the value and resume the execution of an async function after the resolve is completed\n *\n * @return ECMA_VALUE_UNDEFINED if not error is occurred, an error otherwise\n */\necma_value_t\necma_promise_async_await (ecma_extended_object_t *async_generator_object_p, /**< async generator function */\n                          ecma_value_t value) /**< value to be resolved (takes the reference) */\n{\n  ecma_value_t promise = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_PROMISE));\n  ecma_value_t result = ecma_promise_reject_or_resolve (promise, value, true);\n\n  ecma_free_value (value);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  ecma_promise_async_then (result, ecma_make_object_value ((ecma_object_t *) async_generator_object_p));\n  ecma_free_value (result);\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_promise_async_await */\n\n/**\n * Reject the promise if the value is error.\n *\n * See also:\n *         ES2015 25.4.1.1.1\n *\n * @return ecma value of the new promise.\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_if_abrupt_reject_promise (ecma_value_t *value_p, /**< [in - out] completion value */\n                                  ecma_object_t *capability_obj_p) /**< capability */\n{\n  JERRY_ASSERT (ecma_object_class_is (capability_obj_p, ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));\n\n  if (!ECMA_IS_VALUE_ERROR (*value_p))\n  {\n    return ECMA_VALUE_EMPTY;\n  }\n\n  ecma_value_t reason = jcontext_take_exception ();\n\n  ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;\n  ecma_value_t call_ret =\n    ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), ECMA_VALUE_UNDEFINED, &reason, 1);\n  ecma_free_value (reason);\n\n  if (ECMA_IS_VALUE_ERROR (call_ret))\n  {\n    *value_p = call_ret;\n    return call_ret;\n  }\n\n  ecma_free_value (call_ret);\n  *value_p = ecma_copy_value (capability_p->header.u.cls.u3.promise);\n\n  return ECMA_VALUE_EMPTY;\n} /* ecma_op_if_abrupt_reject_promise */\n\n/**\n * It performs the \"then\" operation on promiFulfilled\n * and onRejected as its settlement actions.\n *\n * See also: 25.4.5.3.1\n *\n * @return ecma value of the new promise object\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_promise_perform_then (ecma_value_t promise, /**< the promise which call 'then' */\n                           ecma_value_t on_fulfilled, /**< on_fulfilled function */\n                           ecma_value_t on_rejected, /**< on_rejected function */\n                           ecma_object_t *result_capability_obj_p) /**< promise capability */\n{\n  JERRY_ASSERT (ecma_object_class_is (result_capability_obj_p, ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));\n\n  ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) result_capability_obj_p;\n\n  /* 3. boolean true indicates \"indentity\" */\n  if (!ecma_op_is_callable (on_fulfilled))\n  {\n    on_fulfilled = ECMA_VALUE_TRUE;\n  }\n\n  /* 4. boolean false indicates \"thrower\" */\n  if (!ecma_op_is_callable (on_rejected))\n  {\n    on_rejected = ECMA_VALUE_FALSE;\n  }\n\n  ecma_object_t *promise_obj_p = ecma_get_object_from_value (promise);\n  ecma_promise_object_t *promise_p = (ecma_promise_object_t *) promise_obj_p;\n\n  uint16_t flags = ecma_promise_get_flags (promise_obj_p);\n\n  if (flags & ECMA_PROMISE_IS_PENDING)\n  {\n    /* 7. */\n    /* [ capability, (on_fulfilled), (on_rejected) ] */\n    ecma_value_t reaction_values[3];\n    ecma_value_t *reactions_p = reaction_values + 1;\n\n    uint8_t tag = 0;\n\n    if (on_fulfilled != ECMA_VALUE_TRUE)\n    {\n      tag |= JMEM_FIRST_TAG_BIT_MASK;\n      *reactions_p++ = on_fulfilled;\n    }\n\n    if (on_rejected != ECMA_VALUE_FALSE)\n    {\n      tag |= JMEM_SECOND_TAG_BIT_MASK;\n      *reactions_p++ = on_rejected;\n    }\n\n    ECMA_SET_NON_NULL_POINTER_TAG (reaction_values[0], result_capability_obj_p, tag);\n\n    uint32_t value_count = (uint32_t) (reactions_p - reaction_values);\n    ecma_collection_append (promise_p->reactions, reaction_values, value_count);\n  }\n  else if (flags & ECMA_PROMISE_IS_FULFILLED)\n  {\n    /* 8. */\n    ecma_value_t value = ecma_promise_get_result (promise_obj_p);\n    ecma_enqueue_promise_reaction_job (ecma_make_object_value (result_capability_obj_p), on_fulfilled, value);\n    ecma_free_value (value);\n  }\n  else\n  {\n    /* 9. */\n    ecma_value_t reason = ecma_promise_get_result (promise_obj_p);\n    ecma_enqueue_promise_reaction_job (ecma_make_object_value (result_capability_obj_p), on_rejected, reason);\n    ecma_free_value (reason);\n\n#if JERRY_PROMISE_CALLBACK\n    if (ecma_promise_get_flags (promise_obj_p) & ECMA_PROMISE_UNHANDLED_REJECT)\n    {\n      promise_p->header.u.cls.u1.promise_flags &= (uint8_t) ~ECMA_PROMISE_UNHANDLED_REJECT;\n\n      if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))\n      {\n        JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);\n        JERRY_CONTEXT (promise_callback)\n        (JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED,\n         promise,\n         ECMA_VALUE_UNDEFINED,\n         JERRY_CONTEXT (promise_callback_user_p));\n      }\n    }\n#endif /* JERRY_PROMISE_CALLBACK */\n  }\n\n  /* 10. */\n  return ecma_copy_value (capability_p->header.u.cls.u3.promise);\n} /* ecma_promise_perform_then */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-promise-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_PROMISE_OBJECT_H\n#define ECMA_PROMISE_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaarraybufferobject ECMA ArrayBuffer object related routines\n * @{\n */\n\n/**\n * The PromiseState of promise object.\n */\ntypedef enum\n{\n  ECMA_PROMISE_IS_PENDING = (1 << 0), /**< pending state */\n  ECMA_PROMISE_IS_FULFILLED = (1 << 1), /**< fulfilled state */\n  ECMA_PROMISE_ALREADY_RESOLVED = (1 << 2), /**< already resolved */\n#if JERRY_PROMISE_CALLBACK\n  ECMA_PROMISE_UNHANDLED_REJECT = (1 << 3), /**< a Promise is rejected without a catch handler,\n                                             *   related to ES11: 25.6.6 [[PromiseIsHandled]] */\n#endif /* JERRY_PROMISE_CALLBACK */\n} ecma_promise_flags_t;\n\n/**\n * Description of a promise resolving function.\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< extended object part */\n  ecma_value_t promise; /**< [[Promise]] internal slot */\n} ecma_promise_resolver_t;\n\n/**\n * Description of the promise object.\n * It need more space than normal object to store builtin properties.\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< extended object part */\n  ecma_collection_t *reactions; /**< list of promise reactions */\n} ecma_promise_object_t;\n\n/**\n * Description of the finally function object\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< extended object part */\n  ecma_value_t constructor; /**< [[Constructor]] internal slot */\n  ecma_value_t on_finally; /**< [[OnFinally]] internal slot */\n} ecma_promise_finally_function_t;\n\n/**\n * Description of the thunk function object\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< extended object part */\n  ecma_value_t value; /**< value thunk */\n} ecma_promise_value_thunk_t;\n\n/* The Promise reaction is a compressed structure, where each item can\n * be a sequence of up to three ecma object values as seen below:\n *\n * [ Capability ][ Optional fullfilled callback ][ Optional rejected callback ]\n * [ Async function callback ]\n *\n * The first member is an object, which lower bits specify the type of the reaction:\n *   bit 2 is not set: callback reactions\n *     The first two objects specify the resolve/reject functions of the promise\n *     returned by the `then` operation which can be used to chain event handlers.\n *\n *     bit 0: has a fullfilled callback\n *     bit 1: has a rejected callback\n *\n *   bit 2 is set: async function callback\n */\n\nbool ecma_is_promise (ecma_object_t *obj_p);\necma_value_t ecma_op_create_promise_object (ecma_value_t executor, ecma_value_t parent, ecma_object_t *new_target_p);\nuint8_t ecma_promise_get_flags (ecma_object_t *promise_p);\necma_value_t ecma_promise_get_result (ecma_object_t *promise_p);\nvoid ecma_reject_promise (ecma_value_t promise, ecma_value_t reason);\nvoid ecma_fulfill_promise (ecma_value_t promise, ecma_value_t value);\necma_value_t ecma_reject_promise_with_checks (ecma_value_t promise, ecma_value_t reason);\necma_value_t ecma_fulfill_promise_with_checks (ecma_value_t promise, ecma_value_t value);\necma_object_t *ecma_promise_new_capability (ecma_value_t constructor, ecma_value_t parent);\necma_value_t ecma_promise_reject_or_resolve (ecma_value_t this_arg, ecma_value_t value, bool is_resolve);\necma_value_t ecma_promise_then (ecma_value_t promise, ecma_value_t on_fulfilled, ecma_value_t on_rejected);\n\necma_value_t\necma_value_thunk_helper_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count);\necma_value_t\necma_value_thunk_thrower_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count);\necma_value_t\necma_promise_then_finally_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count);\necma_value_t\necma_promise_catch_finally_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count);\necma_value_t\necma_promise_reject_handler (ecma_object_t *function_obj_p, const ecma_value_t argv[], const uint32_t args_count);\necma_value_t\necma_promise_resolve_handler (ecma_object_t *function_obj_p, const ecma_value_t argv[], const uint32_t args_count);\necma_value_t ecma_promise_all_or_all_settled_handler_cb (ecma_object_t *function_obj_p,\n                                                         const ecma_value_t args_p[],\n                                                         const uint32_t args_count);\necma_value_t ecma_op_get_capabilities_executor_cb (ecma_object_t *function_obj_p,\n                                                   const ecma_value_t args_p[],\n                                                   const uint32_t args_count);\n\necma_value_t ecma_promise_finally (ecma_value_t promise, ecma_value_t on_finally);\nvoid ecma_promise_async_then (ecma_value_t promise, ecma_value_t executable_object);\necma_value_t ecma_promise_async_await (ecma_extended_object_t *async_generator_object_p, ecma_value_t value);\necma_value_t ecma_promise_run_executor (ecma_object_t *promise_p, ecma_value_t executor, ecma_value_t this_value);\necma_value_t ecma_op_if_abrupt_reject_promise (ecma_value_t *value_p, ecma_object_t *capability_obj_p);\n\nuint32_t ecma_promise_remaining_inc_or_dec (ecma_value_t remaining, bool is_inc);\n\necma_value_t ecma_promise_perform_then (ecma_value_t promise,\n                                        ecma_value_t on_fulfilled,\n                                        ecma_value_t on_rejected,\n                                        ecma_object_t *result_capability_obj_p);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_PROMISE_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-proxy-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-proxy-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-handlers.h\"\n#include \"ecma-builtin-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaproxyobject ECMA Proxy object related routines\n * @{\n */\n\n#if JERRY_BUILTIN_PROXY\n/**\n * ProxyCreate operation for create a new proxy object\n *\n * See also:\n *         ES2015 9.5.15\n *         ES11+: 9.5.14 ProxyCreate\n *\n * @return created Proxy object as an ecma-value - if success\n *         raised error - otherwise\n */\necma_object_t *\necma_proxy_create (ecma_value_t target, /**< proxy target */\n                   ecma_value_t handler, /**< proxy handler */\n                   uint32_t options) /**< ecma_proxy_flag_types_t option bits */\n{\n  /* ES2015: 1, 3. */\n  /* ES11+: 1 - 2. */\n  if (!ecma_is_value_object (target) || !ecma_is_value_object (handler))\n  {\n    ecma_raise_type_error (ECMA_ERR_CANNOT_CREATE_PROXY);\n    return NULL;\n  }\n\n  /* ES2015: 5 - 6. */\n  /* ES11+: 3 - 4. */\n  /* A Proxy does not have [[Prototype]] value as per standard */\n  ecma_object_t *obj_p = ecma_create_object (NULL, sizeof (ecma_proxy_object_t), ECMA_OBJECT_TYPE_PROXY);\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  obj_p->u2.prototype_cp = (jmem_cpointer_t) options;\n\n  /* ES2015: 7. */\n  /* ES11+: 5. */\n  if (ecma_op_is_callable (target))\n  {\n    obj_p->u2.prototype_cp |= ECMA_PROXY_IS_CALLABLE;\n\n    /* ES2015: 7.b. */\n    /* ES11+: 5.b. */\n    if (ecma_is_constructor (target))\n    {\n      obj_p->u2.prototype_cp |= ECMA_PROXY_IS_CONSTRUCTABLE;\n    }\n  }\n\n  /* ES2015: 8. */\n  /* ES11+: 6. */\n  proxy_obj_p->target = target;\n\n  /* ES2015: 9. */\n  /* ES11+: 7. */\n  proxy_obj_p->handler = handler;\n\n  /* ES2015: 10. */\n  /* ES11+: 8 */\n  return obj_p;\n} /* ecma_proxy_create */\n\n/**\n * Definition of Proxy Revocation Function\n *\n * See also:\n *         ES2015 26.2.2.1.1\n *\n * @return ECMA_VALUE_UNDEFINED\n */\necma_value_t\necma_proxy_revoke_cb (ecma_object_t *function_obj_p, /**< function object */\n                      const ecma_value_t args_p[], /**< argument list */\n                      const uint32_t args_count) /**< argument number */\n{\n  JERRY_UNUSED_2 (args_p, args_count);\n\n  /* 1. */\n  ecma_revocable_proxy_object_t *rev_proxy_p = (ecma_revocable_proxy_object_t *) function_obj_p;\n\n  /* 2. */\n  if (ecma_is_value_null (rev_proxy_p->proxy))\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  /* 4. */\n  ecma_proxy_object_t *proxy_p = (ecma_proxy_object_t *) ecma_get_object_from_value (rev_proxy_p->proxy);\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY ((ecma_object_t *) proxy_p));\n\n  /* 3. */\n  rev_proxy_p->proxy = ECMA_VALUE_NULL;\n\n  /* 5. */\n  proxy_p->target = ECMA_VALUE_NULL;\n\n  /* 6. */\n  proxy_p->handler = ECMA_VALUE_NULL;\n\n  /* 7. */\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_proxy_revoke_cb */\n\n/**\n * Proxy.revocable operation for create a new revocable proxy object\n *\n * See also:\n *         ES2015 26.2.2.1\n *\n * @return NULL - if the operation fails\n *         pointer to the newly created revocable proxy object - otherwise\n */\necma_object_t *\necma_proxy_create_revocable (ecma_value_t target, /**< target argument */\n                             ecma_value_t handler) /**< handler argument */\n{\n  /* 1. */\n  ecma_object_t *proxy_p = ecma_proxy_create (target, handler, 0);\n\n  /* 2. */\n  if (proxy_p == NULL)\n  {\n    return proxy_p;\n  }\n\n  ecma_value_t proxy_value = ecma_make_object_value (proxy_p);\n\n  /* 3. */\n  ecma_object_t *func_obj_p;\n  func_obj_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROXY_REVOKE, sizeof (ecma_revocable_proxy_object_t));\n\n  /* 4. */\n  ecma_revocable_proxy_object_t *rev_proxy_p = (ecma_revocable_proxy_object_t *) func_obj_p;\n  rev_proxy_p->proxy = proxy_value;\n\n  ecma_property_value_t *prop_value_p;\n  ecma_value_t revoker = ecma_make_object_value (func_obj_p);\n\n  /* 5. */\n  ecma_object_t *obj_p =\n    ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL);\n\n  /* 6. */\n  prop_value_p = ecma_create_named_data_property (obj_p,\n                                                  ecma_get_magic_string (LIT_MAGIC_STRING_PROXY),\n                                                  ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                  NULL);\n  prop_value_p->value = proxy_value;\n\n  /* 7. */\n  prop_value_p = ecma_create_named_data_property (obj_p,\n                                                  ecma_get_magic_string (LIT_MAGIC_STRING_REVOKE),\n                                                  ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                  NULL);\n  prop_value_p->value = revoker;\n\n  ecma_deref_object (proxy_p);\n  ecma_deref_object (func_obj_p);\n\n  /* 8. */\n  return obj_p;\n} /* ecma_proxy_create_revocable */\n\n/**\n * Internal find property operation for Proxy object\n *\n * Note: Returned value must be freed with ecma_free_value.\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_NOT_FOUND - if the property is not found\n *         value of the property - otherwise\n */\necma_value_t\necma_proxy_object_find (ecma_object_t *obj_p, /**< proxy object */\n                        ecma_string_t *prop_name_p) /**< property name */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n\n  ecma_value_t has_result = ecma_proxy_object_has (obj_p, prop_name_p);\n\n  if (ECMA_IS_VALUE_ERROR (has_result))\n  {\n    return has_result;\n  }\n\n  if (ecma_is_value_false (has_result))\n  {\n    return ECMA_VALUE_NOT_FOUND;\n  }\n\n  return ecma_proxy_object_get (obj_p, prop_name_p, ecma_make_object_value (obj_p));\n} /* ecma_proxy_object_find */\n\n/**\n * Helper method for validate the proxy object\n *\n * @return proxy trap - if the validation is successful\n *         ECMA_VALUE_ERROR - otherwise\n */\nstatic ecma_value_t\necma_validate_proxy_object (ecma_value_t handler, /**< proxy handler */\n                            lit_magic_string_id_t magic_id) /**< routine magic id */\n{\n  if (ecma_is_value_null (handler))\n  {\n    return ecma_raise_type_error (ECMA_ERR_HANDLER_CANNOT_BE_NULL);\n  }\n\n  JERRY_ASSERT (ecma_is_value_object (handler));\n\n  return ecma_op_get_method_by_magic_id (handler, magic_id);\n} /* ecma_validate_proxy_object */\n\n/* Interal operations */\n\n/**\n * The Proxy object [[GetPrototypeOf]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.1\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_NULL or valid object (prototype) otherwise\n */\necma_value_t\necma_proxy_object_get_prototype_of (ecma_object_t *obj_p) /**< proxy object */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 1. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 2-5. */\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_GET_PROTOTYPE_OF_UL);\n\n  /* 6. */\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  ecma_value_t target = proxy_obj_p->target;\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n\n  /* 7. */\n  if (ecma_is_value_undefined (trap))\n  {\n    ecma_value_t result = ecma_builtin_object_object_get_prototype_of (target_obj_p);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n\n  /* 8. */\n  ecma_value_t handler_proto = ecma_op_function_call (func_obj_p, handler, &target, 1);\n\n  ecma_deref_object (func_obj_p);\n\n  /* 9. */\n  if (ECMA_IS_VALUE_ERROR (handler_proto))\n  {\n    return handler_proto;\n  }\n\n  /* 10. */\n  if (!ecma_is_value_object (handler_proto) && !ecma_is_value_null (handler_proto))\n  {\n    ecma_free_value (handler_proto);\n\n    return ecma_raise_type_error (ECMA_ERR_TRAP_RETURNED_NEITHER_OBJECT_NOR_NULL);\n  }\n\n  if (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)\n  {\n    return handler_proto;\n  }\n\n  /* 11. */\n  ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);\n\n  /* 12. */\n  if (ECMA_IS_VALUE_ERROR (extensible_target))\n  {\n    ecma_free_value (handler_proto);\n\n    return extensible_target;\n  }\n\n  /* 13. */\n  if (ecma_is_value_true (extensible_target))\n  {\n    return handler_proto;\n  }\n\n  /* 14. */\n  ecma_value_t target_proto = ecma_builtin_object_object_get_prototype_of (target_obj_p);\n\n  /* 15. */\n  if (ECMA_IS_VALUE_ERROR (target_proto))\n  {\n    return target_proto;\n  }\n\n  ecma_value_t ret_value = handler_proto;\n\n  /* 16. */\n  if (handler_proto != target_proto)\n  {\n    ecma_free_value (handler_proto);\n\n    ret_value = ecma_raise_type_error (ECMA_ERR_TARGET_NOT_EXTENSIBLE_NOT_RETURNED_ITS_PROTOTYPE);\n  }\n\n  ecma_free_value (target_proto);\n\n  /* 17. */\n  return ret_value;\n} /* ecma_proxy_object_get_prototype_of */\n\n/**\n * The Proxy object [[SetPrototypeOf]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.2\n *          ECMAScript v11: 9.5.2\n *\n * Note: Returned value is always a simple value so freeing it is unnecessary.\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_{TRUE/FALSE} - depends on whether the new prototype can be set for the given object\n */\necma_value_t\necma_proxy_object_set_prototype_of (ecma_object_t *obj_p, /**< proxy object */\n                                    ecma_value_t proto) /**< new prototype object */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n  ECMA_CHECK_STACK_USAGE ();\n\n  /* 1. */\n  JERRY_ASSERT (ecma_is_value_object (proto) || ecma_is_value_null (proto));\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 2. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 3-6. */\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_SET_PROTOTYPE_OF_UL);\n\n  /* 7.*/\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  ecma_value_t target = proxy_obj_p->target;\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n\n  /* 8. */\n  if (ecma_is_value_undefined (trap))\n  {\n    if (ECMA_OBJECT_IS_PROXY (target_obj_p))\n    {\n      ecma_value_t result = ecma_proxy_object_set_prototype_of (target_obj_p, proto);\n      JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n      return result;\n    }\n\n    ecma_value_t result = ecma_op_ordinary_object_set_prototype_of (target_obj_p, proto);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n  ecma_value_t args[] = { target, proto };\n\n  /* 9. */\n  ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 2);\n\n  ecma_deref_object (func_obj_p);\n\n  /* 10. */\n  if (ECMA_IS_VALUE_ERROR (trap_result))\n  {\n    return trap_result;\n  }\n\n  bool boolean_trap_result = ecma_op_to_boolean (trap_result);\n\n  ecma_free_value (trap_result);\n\n  /* ES11: 9 */\n  if (!boolean_trap_result)\n  {\n    return ecma_make_boolean_value (false);\n  }\n\n  if (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)\n  {\n    return ecma_make_boolean_value (boolean_trap_result);\n  }\n\n  /* 11. */\n  ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);\n\n  /* 12. */\n  if (ECMA_IS_VALUE_ERROR (extensible_target))\n  {\n    return extensible_target;\n  }\n\n  /* 13. */\n  if (ecma_is_value_true (extensible_target))\n  {\n    return ecma_make_boolean_value (boolean_trap_result);\n  }\n\n  /* 14. */\n  ecma_value_t target_proto = ecma_builtin_object_object_get_prototype_of (target_obj_p);\n\n  /* 15. */\n  if (ECMA_IS_VALUE_ERROR (target_proto))\n  {\n    return target_proto;\n  }\n\n  ecma_value_t ret_value = ecma_make_boolean_value (boolean_trap_result);\n\n  /* 16. */\n  if (boolean_trap_result && (target_proto != proto))\n  {\n    ret_value = ecma_raise_type_error (ECMA_ERR_TARGET_NOT_EXTENSIBLE_DIFFERENT_PROTOTYPE_RETURNED);\n  }\n\n  ecma_free_value (target_proto);\n\n  /* 17. */\n  return ret_value;\n} /* ecma_proxy_object_set_prototype_of */\n\n/**\n * The Proxy object [[isExtensible]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.3\n *\n * Note: Returned value is always a simple value so freeing it is unnecessary.\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_{TRUE/FALSE} - depends on whether the object is extensible\n */\necma_value_t\necma_proxy_object_is_extensible (ecma_object_t *obj_p) /**< proxy object */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 1. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 2-5. */\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_IS_EXTENSIBLE);\n\n  /* 6. */\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  ecma_value_t target = proxy_obj_p->target;\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n\n  /* 7. */\n  if (ecma_is_value_undefined (trap))\n  {\n    ecma_value_t result = ecma_builtin_object_object_is_extensible (target_obj_p);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n\n  /* 8. */\n  ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, &target, 1);\n\n  ecma_deref_object (func_obj_p);\n\n  /* 9. */\n  if (ECMA_IS_VALUE_ERROR (trap_result))\n  {\n    return trap_result;\n  }\n\n  bool boolean_trap_result = ecma_op_to_boolean (trap_result);\n\n  ecma_free_value (trap_result);\n\n  if (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)\n  {\n    return ecma_make_boolean_value (boolean_trap_result);\n  }\n\n  bool target_result;\n\n  /* 10. */\n  if (ECMA_OBJECT_IS_PROXY (target_obj_p))\n  {\n    ecma_value_t proxy_is_ext = ecma_proxy_object_is_extensible (target_obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (proxy_is_ext))\n    {\n      return proxy_is_ext;\n    }\n\n    target_result = ecma_is_value_true (proxy_is_ext);\n  }\n  else\n  {\n    target_result = ecma_op_ordinary_object_is_extensible (target_obj_p);\n  }\n\n  /* 12. */\n  if (boolean_trap_result != target_result)\n  {\n    return ecma_raise_type_error (ECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_EXTENSIBILITY);\n  }\n\n  return ecma_make_boolean_value (boolean_trap_result);\n} /* ecma_proxy_object_is_extensible */\n\n/**\n * The Proxy object [[PreventExtensions]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.4\n *\n * Note: Returned value is always a simple value so freeing it is unnecessary.\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_{TRUE/FALSE} - depends on whether the object can be set as inextensible\n */\necma_value_t\necma_proxy_object_prevent_extensions (ecma_object_t *obj_p) /**< proxy object */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 1. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 2-5. */\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_PREVENT_EXTENSIONS_UL);\n\n  /* 6. */\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  ecma_value_t target = proxy_obj_p->target;\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n\n  /* 7. */\n  if (ecma_is_value_undefined (trap))\n  {\n    ecma_value_t ret_value = ecma_builtin_object_object_prevent_extensions (target_obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      return ret_value;\n    }\n\n    ecma_deref_object (target_obj_p);\n\n    return ECMA_VALUE_TRUE;\n  }\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n\n  /* 8. */\n  ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, &target, 1);\n\n  ecma_deref_object (func_obj_p);\n\n  /* 9. */\n  if (ECMA_IS_VALUE_ERROR (trap_result))\n  {\n    return trap_result;\n  }\n\n  bool boolean_trap_result = ecma_op_to_boolean (trap_result);\n\n  ecma_free_value (trap_result);\n\n  /* 10. */\n  if (boolean_trap_result && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))\n  {\n    ecma_value_t target_is_ext = ecma_builtin_object_object_is_extensible (target_obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (target_is_ext))\n    {\n      return target_is_ext;\n    }\n\n    if (ecma_is_value_true (target_is_ext))\n    {\n      return ecma_raise_type_error (ECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_INEXTENSIBILITY);\n    }\n  }\n\n  /* 11. */\n  return ecma_make_boolean_value (boolean_trap_result);\n} /* ecma_proxy_object_prevent_extensions */\n\n/**\n * The Proxy object [[GetOwnProperty]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.5\n *\n * Note: - Returned value is always a simple value so freeing it is unnecessary.\n *       - If the operation does not fail, freeing the filled property descriptor is the caller's responsibility\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_{TRUE_FALSE} - depends on whether object has property with the given name\n */\necma_value_t\necma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy object */\n                                               ecma_string_t *prop_name_p, /**< property name */\n                                               ecma_property_descriptor_t *prop_desc_p) /**< [out] property\n                                                                                         *   descriptor */\n{\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 2. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 3-6. */\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL);\n\n  ecma_value_t target = proxy_obj_p->target;\n\n  /* 7. */\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n\n  /* 8. */\n  if (ecma_is_value_undefined (trap))\n  {\n    ecma_value_t result = ecma_op_object_get_own_property_descriptor (target_obj_p, prop_name_p, prop_desc_p);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n  ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p);\n  ecma_value_t args[] = { target, prop_value };\n\n  /* 9. */\n  ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 2);\n  ecma_deref_object (func_obj_p);\n\n  /* 10. */\n  if (ECMA_IS_VALUE_ERROR (trap_result))\n  {\n    return trap_result;\n  }\n\n  /* 11. */\n  if (!ecma_is_value_object (trap_result) && !ecma_is_value_undefined (trap_result))\n  {\n    ecma_free_value (trap_result);\n    return ecma_raise_type_error (ECMA_ERR_TRAP_IS_NEITHER_AN_OBJECT_NOR_UNDEFINED);\n  }\n\n  if (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)\n  {\n    if (ecma_is_value_undefined (trap_result))\n    {\n      return ECMA_VALUE_FALSE;\n    }\n\n    ecma_value_t result_val = ecma_op_to_property_descriptor (trap_result, prop_desc_p);\n    ecma_free_value (trap_result);\n\n    if (ECMA_IS_VALUE_ERROR (result_val))\n    {\n      return result_val;\n    }\n\n    ecma_op_to_complete_property_descriptor (prop_desc_p);\n    return ECMA_VALUE_TRUE;\n  }\n\n  /* 12. */\n  ecma_property_descriptor_t target_desc;\n  ecma_value_t target_status = ecma_op_object_get_own_property_descriptor (target_obj_p, prop_name_p, &target_desc);\n\n  /* 13. */\n  if (ECMA_IS_VALUE_ERROR (target_status))\n  {\n    ecma_free_value (trap_result);\n    return target_status;\n  }\n\n  /* 14. */\n  if (ecma_is_value_undefined (trap_result))\n  {\n    /* .a */\n    if (ecma_is_value_false (target_status))\n    {\n      return ECMA_VALUE_FALSE;\n    }\n    /* .b */\n    if (!(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE))\n    {\n      ecma_free_property_descriptor (&target_desc);\n      return ecma_raise_type_error (ECMA_ERR_GIVEN_PROPERTY_IS_A_NON_CONFIGURABLE);\n    }\n\n    /* .c */\n    ecma_free_property_descriptor (&target_desc);\n    ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);\n\n    /* .d */\n    if (ECMA_IS_VALUE_ERROR (extensible_target))\n    {\n      return extensible_target;\n    }\n\n    /* .e */\n    JERRY_ASSERT (ecma_is_value_boolean (extensible_target));\n\n    /* .f */\n    if (ecma_is_value_false (extensible_target))\n    {\n      return ecma_raise_type_error (ECMA_ERR_TARGET_NOT_EXTENSIBLE);\n    }\n\n    /* .g */\n    return ECMA_VALUE_FALSE;\n  }\n\n  /* 15. */\n  ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);\n\n  /* 16. */\n  if (ECMA_IS_VALUE_ERROR (extensible_target))\n  {\n    if (ecma_is_value_true (target_status))\n    {\n      ecma_free_property_descriptor (&target_desc);\n    }\n    ecma_free_value (trap_result);\n    return extensible_target;\n  }\n\n  /* 17, 19 */\n  ecma_value_t result_val = ecma_op_to_property_descriptor (trap_result, prop_desc_p);\n\n  ecma_op_to_complete_property_descriptor (prop_desc_p);\n  ecma_free_value (trap_result);\n\n  /* 18. */\n  if (ECMA_IS_VALUE_ERROR (result_val))\n  {\n    if (ecma_is_value_true (target_status))\n    {\n      ecma_free_property_descriptor (&target_desc);\n    }\n    return result_val;\n  }\n\n  /* 20. */\n  bool is_extensible = ecma_is_value_true (extensible_target);\n\n  bool is_valid = ecma_op_is_compatible_property_descriptor (prop_desc_p,\n                                                             (ecma_is_value_true (target_status) ? &target_desc : NULL),\n                                                             is_extensible);\n\n  bool target_has_desc = ecma_is_value_true (target_status);\n  bool target_is_writable = (target_desc.flags & JERRY_PROP_IS_WRITABLE);\n  bool target_is_configurable = false;\n\n  if (target_has_desc)\n  {\n    target_is_configurable = ((target_desc.flags & JERRY_PROP_IS_CONFIGURABLE) != 0);\n    ecma_free_property_descriptor (&target_desc);\n  }\n\n  /* 21. */\n  if (!is_valid)\n  {\n    ecma_free_property_descriptor (prop_desc_p);\n    return ecma_raise_type_error (ECMA_ERR_THE_TWO_DESCRIPTORS_ARE_INCOMPATIBLE);\n  }\n\n  /* 22. */\n  else if (!(prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE))\n  {\n    const uint16_t mask = (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE);\n\n    if (!target_has_desc || target_is_configurable\n        || ((prop_desc_p->flags & mask) == JERRY_PROP_IS_WRITABLE_DEFINED && target_is_writable))\n    {\n      ecma_free_property_descriptor (prop_desc_p);\n      return ecma_raise_type_error (ECMA_ERR_THE_TWO_DESCRIPTORS_ARE_INCOMPATIBLE);\n    }\n  }\n  return ECMA_VALUE_TRUE;\n} /* ecma_proxy_object_get_own_property_descriptor */\n\n/**\n * The Proxy object [[DefineOwnProperty]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.6\n *\n * Note: Returned value is always a simple value so freeing it is unnecessary.\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_{TRUE_FALSE} - depends on whether the property can be defined for the given object\n */\necma_value_t\necma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object */\n                                       ecma_string_t *prop_name_p, /**< property name */\n                                       const ecma_property_descriptor_t *prop_desc_p) /**< property descriptor */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 2. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 3-6. */\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_DEFINE_PROPERTY_UL);\n\n  /* 7. */\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  ecma_value_t target = proxy_obj_p->target;\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n\n  /* 8. */\n  if (ecma_is_value_undefined (trap))\n  {\n    ecma_value_t result = ecma_op_object_define_own_property (target_obj_p, prop_name_p, prop_desc_p);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  /* 9. */\n  ecma_object_t *desc_obj = ecma_op_from_property_descriptor (prop_desc_p);\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n  ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p);\n  ecma_value_t desc_obj_value = ecma_make_object_value (desc_obj);\n  ecma_value_t args[] = { target, prop_value, desc_obj_value };\n\n  /* 10. */\n  ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 3);\n\n  ecma_deref_object (func_obj_p);\n  ecma_deref_object (desc_obj);\n\n  /* 11. */\n  if (ECMA_IS_VALUE_ERROR (trap_result))\n  {\n    return trap_result;\n  }\n\n  bool boolean_trap_result = ecma_op_to_boolean (trap_result);\n\n  ecma_free_value (trap_result);\n\n  /* 12. */\n  if (!boolean_trap_result)\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  if (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)\n  {\n    return ECMA_VALUE_TRUE;\n  }\n\n  /* 13. */\n  ecma_property_descriptor_t target_desc;\n\n  ecma_value_t status = ecma_op_object_get_own_property_descriptor (target_obj_p, prop_name_p, &target_desc);\n\n  /* 14. */\n  if (ECMA_IS_VALUE_ERROR (status))\n  {\n    return status;\n  }\n\n  bool target_prop_found = ecma_is_value_true (status);\n\n  /* 15. */\n  ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);\n\n  bool is_target_ext = ecma_is_value_true (extensible_target);\n\n  /* 16. */\n  if (ECMA_IS_VALUE_ERROR (extensible_target))\n  {\n    if (target_prop_found)\n    {\n      ecma_free_property_descriptor (&target_desc);\n    }\n\n    return extensible_target;\n  }\n\n  /* 17. */\n  bool setting_config_false =\n    ((prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED) && !(prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE));\n\n  /* 19. */\n  if (!target_prop_found)\n  {\n    if (!is_target_ext)\n    {\n      return ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_ADDING_PROPERTY_NON_EXTENSIBLE_TARGET);\n    }\n\n    if (setting_config_false)\n    {\n      return ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_DEFINING_NON_EXISTENT_PROPERTY);\n    }\n  }\n  /* 20. */\n  else\n  {\n    ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n    if (!ecma_op_is_compatible_property_descriptor (prop_desc_p, &target_desc, is_target_ext))\n    {\n      ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_ADD_PROPERTY_INCOMPATIBLE_OTHER_PROP);\n    }\n    else if (setting_config_false && (target_desc.flags & JERRY_PROP_IS_CONFIGURABLE))\n    {\n      ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_DEFINING_NON_EXISTENT_PROPERTY);\n    }\n    /* ES11: 16.c */\n    else if ((target_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED)) != 0\n             && (prop_desc_p->flags & (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE))\n                  == JERRY_PROP_IS_WRITABLE_DEFINED\n             && (target_desc.flags & (JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_CONFIGURABLE)) == JERRY_PROP_IS_WRITABLE)\n\n    {\n      ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_DEFINING_NON_EXISTENT_PROPERTY);\n    }\n\n    ecma_free_property_descriptor (&target_desc);\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      return ret_value;\n    }\n  }\n\n  return ECMA_VALUE_TRUE;\n} /* ecma_proxy_object_define_own_property */\n\n/**\n * The Proxy object [[HasProperty]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.7\n *\n * Note: Returned value is always a simple value so freeing it is unnecessary.\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_{TRUE_FALSE} - depends on whether the property is found\n */\necma_value_t\necma_proxy_object_has (ecma_object_t *obj_p, /**< proxy object */\n                       ecma_string_t *prop_name_p) /**< property name */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 2. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 3-6. */\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_HAS);\n\n  /* 7. */\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  ecma_value_t target = proxy_obj_p->target;\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n\n  /* 8. */\n  if (ecma_is_value_undefined (trap))\n  {\n    ecma_value_t result = ecma_op_object_has_property (target_obj_p, prop_name_p);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n  ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p);\n  ecma_value_t args[] = { target, prop_value };\n\n  /* 9. */\n  ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 2);\n\n  ecma_deref_object (func_obj_p);\n\n  /* 10. */\n  if (ECMA_IS_VALUE_ERROR (trap_result))\n  {\n    return trap_result;\n  }\n\n  bool boolean_trap_result = ecma_op_to_boolean (trap_result);\n\n  ecma_free_value (trap_result);\n\n  /* 11. */\n  if (!boolean_trap_result && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))\n  {\n    ecma_property_descriptor_t target_desc;\n\n    ecma_value_t status = ecma_op_object_get_own_property_descriptor (target_obj_p, prop_name_p, &target_desc);\n\n    if (ECMA_IS_VALUE_ERROR (status))\n    {\n      return status;\n    }\n\n    if (ecma_is_value_true (status))\n    {\n      bool prop_is_configurable = target_desc.flags & JERRY_PROP_IS_CONFIGURABLE;\n\n      ecma_free_property_descriptor (&target_desc);\n\n      if (!prop_is_configurable)\n      {\n        return ecma_raise_type_error (ECMA_ERR_TRAP_FALSISH_PROPERTY_NON_CONFIGURABLE);\n      }\n\n      ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);\n\n      if (ECMA_IS_VALUE_ERROR (extensible_target))\n      {\n        return extensible_target;\n      }\n\n      if (ecma_is_value_false (extensible_target))\n      {\n        return ecma_raise_type_error (ECMA_ERR_TRAP_FALSISH_PROPERTY_TARGET_NOT_EXTENSIBLE);\n      }\n    }\n  }\n\n  /* 12. */\n  return ecma_make_boolean_value (boolean_trap_result);\n} /* ecma_proxy_object_has */\n\n/**\n * The Proxy object [[Get]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.8\n *\n * Note: Returned value is always a simple value so freeing it is unnecessary.\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         value of the given nameddata property or the result of the getter function call - otherwise\n */\necma_value_t\necma_proxy_object_get (ecma_object_t *obj_p, /**< proxy object */\n                       ecma_string_t *prop_name_p, /**< property name */\n                       ecma_value_t receiver) /**< receiver to invoke getter function */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 2. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 3-6. */\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_GET);\n\n  /* 7. */\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  /* 8. */\n  if (ecma_is_value_undefined (trap))\n  {\n    ecma_object_t *target_obj_p = ecma_get_object_from_value (proxy_obj_p->target);\n    ecma_value_t result = ecma_op_object_get_with_receiver (target_obj_p, prop_name_p, receiver);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n  ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p);\n  ecma_value_t args[] = { proxy_obj_p->target, prop_value, receiver };\n\n  /* 9. */\n  ecma_ref_object (obj_p);\n  ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 3);\n  ecma_deref_object (obj_p);\n\n  ecma_deref_object (func_obj_p);\n\n  /* 10. */\n  if (ECMA_IS_VALUE_ERROR (trap_result) || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))\n  {\n    return trap_result;\n  }\n\n  /* 11. */\n  ecma_property_descriptor_t target_desc;\n  ecma_value_t status = ecma_op_get_own_property_descriptor (proxy_obj_p->target, prop_name_p, &target_desc);\n\n  /* 12. */\n  if (ECMA_IS_VALUE_ERROR (status))\n  {\n    ecma_free_value (trap_result);\n    return status;\n  }\n\n  /* 13. */\n  if (ecma_is_value_true (status))\n  {\n    ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n    if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)\n        && !(target_desc.flags & JERRY_PROP_IS_WRITABLE) && !ecma_op_same_value (trap_result, target_desc.value))\n    {\n      ret_value = ecma_raise_type_error (ECMA_ERR_INCORRECT_RETURN_PROXY_GET_TRAP);\n    }\n    else if (!(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)\n             && (target_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))\n             && target_desc.get_p == NULL && !ecma_is_value_undefined (trap_result))\n    {\n      ret_value = ecma_raise_type_error (ECMA_ERR_PROXY_PROPERTY_NOT_CONFIGURABLE_NOT_HAVE_GETTER);\n    }\n\n    ecma_free_property_descriptor (&target_desc);\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      ecma_free_value (trap_result);\n\n      return ret_value;\n    }\n  }\n\n  /* 14. */\n  return trap_result;\n} /* ecma_proxy_object_get */\n\n/**\n * The Proxy object [[Set]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.9\n *\n * Note: Returned value is always a simple value so freeing it is unnecessary.\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_{TRUE/FALSE} - depends on whether the propety can be set to the given object\n */\necma_value_t\necma_proxy_object_set (ecma_object_t *obj_p, /**< proxy object */\n                       ecma_string_t *prop_name_p, /**< property name */\n                       ecma_value_t value, /**< value to set */\n                       ecma_value_t receiver, /**< receiver to invoke setter function */\n                       bool is_strict) /**< indicate strict mode */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 2. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 3-6. */\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_SET);\n\n  /* 7. */\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  ecma_value_t target = proxy_obj_p->target;\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n\n  /* 8. */\n  if (ecma_is_value_undefined (trap))\n  {\n    ecma_value_t result = ecma_op_object_put_with_receiver (target_obj_p, prop_name_p, value, receiver, is_strict);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n  ecma_value_t prop_name_value = ecma_make_prop_name_value (prop_name_p);\n  ecma_value_t args[] = { target, prop_name_value, value, receiver };\n\n  /* 9. */\n  ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 4);\n\n  ecma_deref_object (func_obj_p);\n\n  /* 10. */\n  if (ECMA_IS_VALUE_ERROR (trap_result))\n  {\n    return trap_result;\n  }\n\n  bool boolean_trap_result = ecma_op_to_boolean (trap_result);\n\n  ecma_free_value (trap_result);\n\n  /* 11. */\n  if (!boolean_trap_result)\n  {\n    if (is_strict)\n    {\n      return ecma_raise_type_error (ECMA_ERR_PROXY_TRAP_RETURNED_FALSISH);\n    }\n\n    return ECMA_VALUE_FALSE;\n  }\n\n  if (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)\n  {\n    return ECMA_VALUE_TRUE;\n  }\n\n  /* 12. */\n  ecma_property_descriptor_t target_desc;\n\n  ecma_value_t status = ecma_op_object_get_own_property_descriptor (target_obj_p, prop_name_p, &target_desc);\n\n  /* 13. */\n  if (ECMA_IS_VALUE_ERROR (status))\n  {\n    return status;\n  }\n\n  /* 14. */\n  if (ecma_is_value_true (status))\n  {\n    ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n    if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)\n        && !(target_desc.flags & JERRY_PROP_IS_WRITABLE) && !ecma_op_same_value (value, target_desc.value))\n    {\n      ret_value = ecma_raise_type_error (ECMA_ERR_INCORRECT_RETURN_PROXY_SET_TRAP);\n    }\n    else if (!(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)\n             && (target_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))\n             && target_desc.set_p == NULL)\n    {\n      ret_value = ecma_raise_type_error (ECMA_ERR_TARGET_PROPERTY_CONFIGURE_ACCESSOR_WITHOUT_SETTER);\n    }\n\n    ecma_free_property_descriptor (&target_desc);\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      return ret_value;\n    }\n  }\n\n  /* 15. */\n  return ECMA_VALUE_TRUE;\n} /* ecma_proxy_object_set */\n\n/**\n * The Proxy object [[Delete]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.10\n *\n * Note: Returned value is always a simple value so freeing it is unnecessary.\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_{TRUE/FALSE} - depends on whether the propety can be deleted\n */\necma_value_t\necma_proxy_object_delete_property (ecma_object_t *obj_p, /**< proxy object */\n                                   ecma_string_t *prop_name_p, /**< property name */\n                                   bool is_strict) /**< delete in strict mode? */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 2. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 3-6.*/\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_DELETE_PROPERTY_UL);\n\n  /* 7. */\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  ecma_value_t target = proxy_obj_p->target;\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n\n  /* 8. */\n  if (ecma_is_value_undefined (trap))\n  {\n    ecma_value_t result = ecma_op_object_delete (target_obj_p, prop_name_p, is_strict);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n  ecma_value_t prop_name_value = ecma_make_prop_name_value (prop_name_p);\n  ecma_value_t args[] = { target, prop_name_value };\n\n  /* 9. */\n  ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 2);\n\n  ecma_deref_object (func_obj_p);\n\n  /* 10. */\n  if (ECMA_IS_VALUE_ERROR (trap_result))\n  {\n    return trap_result;\n  }\n\n  bool boolean_trap_result = ecma_op_to_boolean (trap_result);\n\n  ecma_free_value (trap_result);\n\n  /* 11. */\n  if (!boolean_trap_result)\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  if (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)\n  {\n    return ECMA_VALUE_TRUE;\n  }\n\n  /* 12. */\n  ecma_property_descriptor_t target_desc;\n\n  ecma_value_t status = ecma_op_object_get_own_property_descriptor (target_obj_p, prop_name_p, &target_desc);\n\n  /* 13. */\n  if (ECMA_IS_VALUE_ERROR (status))\n  {\n    return status;\n  }\n\n  /* 14. */\n  if (ecma_is_value_false (status))\n  {\n    return ECMA_VALUE_TRUE;\n  }\n\n  ecma_value_t ret_value = ECMA_VALUE_TRUE;\n\n  /* 15. */\n  if (!(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE))\n  {\n    ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_PROPERTY_NON_CONFIGURABLE);\n  }\n  /* ES11: 13-14 */\n  ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);\n\n  if (!ecma_is_value_true (extensible_target))\n  {\n    ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_TARGET_NOT_EXTENSIBLE);\n  }\n\n  ecma_free_property_descriptor (&target_desc);\n\n  /* 16. */\n  return ret_value;\n} /* ecma_proxy_object_delete_property */\n\n/**\n * Helper method for the Proxy object [[OwnPropertyKeys]] operation\n *\n * See also:\n *          ECMAScript v6, 9.5.12 steps 21. 23.\n *\n * @return ECMA_VALUE_ERROR - if a target key is not in the unchecked_result_keys collection\n *         ECMA_VALUE_EMPTY - otherwise\n */\nstatic ecma_value_t\necma_proxy_object_own_property_keys_helper (ecma_collection_t *target_collection, /**< target keys */\n                                            ecma_collection_t *unchecked_result_keys, /**< unchecked keys */\n                                            uint32_t *counter) /**< unchecked property counter */\n{\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  for (uint32_t i = 0; i < target_collection->item_count; i++)\n  {\n    ecma_string_t *current_prop_name = ecma_get_prop_name_from_value (target_collection->buffer_p[i]);\n\n    ret_value = ECMA_VALUE_ERROR;\n\n    for (uint32_t j = 0; j < unchecked_result_keys->item_count; j++)\n    {\n      if (ecma_is_value_empty (unchecked_result_keys->buffer_p[j]))\n      {\n        continue;\n      }\n\n      ecma_string_t *unchecked_prop_name = ecma_get_prop_name_from_value (unchecked_result_keys->buffer_p[j]);\n\n      if (ecma_compare_ecma_strings (current_prop_name, unchecked_prop_name))\n      {\n        ecma_deref_ecma_string (unchecked_prop_name);\n        ret_value = ECMA_VALUE_EMPTY;\n        unchecked_result_keys->buffer_p[j] = ECMA_VALUE_EMPTY;\n        (*counter)++;\n      }\n    }\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      break;\n    }\n  }\n\n  return ret_value;\n} /* ecma_proxy_object_own_property_keys_helper */\n\n/**\n * Helper method for checking the invariants in the Proxy object [[OwnPropertyKeys]] operation\n *\n * See also:\n *          ECMAScript v6, 9.5.12 steps 20-25.\n *\n * @return true - if none of the invariants got violated\n *         false - otherwise\n */\nstatic bool\necma_proxy_check_invariants_for_own_prop_keys (ecma_collection_t *trap_result,\n                                               ecma_collection_t *target_non_configurable_keys,\n                                               ecma_collection_t *target_configurable_keys,\n                                               ecma_value_t extensible_target)\n{\n  /* 20. */\n  ecma_collection_t *unchecked_result_keys = ecma_new_collection ();\n\n  ecma_collection_append (unchecked_result_keys, trap_result->buffer_p, trap_result->item_count);\n\n  for (uint32_t i = 0; i < unchecked_result_keys->item_count; i++)\n  {\n    ecma_string_t *unchecked_prop_name = ecma_get_prop_name_from_value (unchecked_result_keys->buffer_p[i]);\n    ecma_ref_ecma_string (unchecked_prop_name);\n  }\n\n  bool check_ok = false;\n  uint32_t unchecked_prop_name_counter = 0;\n\n  /* 21. */\n  if (ECMA_IS_VALUE_ERROR (ecma_proxy_object_own_property_keys_helper (target_non_configurable_keys,\n                                                                       unchecked_result_keys,\n                                                                       &unchecked_prop_name_counter)))\n  {\n    ecma_raise_type_error (ECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_NON_CONFIGURABLE_KEYS);\n  }\n  /* 22. */\n  else if (ecma_is_value_true (extensible_target))\n  {\n    check_ok = true;\n  }\n  /* 23. */\n  else if (ECMA_IS_VALUE_ERROR (ecma_proxy_object_own_property_keys_helper (target_configurable_keys,\n                                                                            unchecked_result_keys,\n                                                                            &unchecked_prop_name_counter)))\n  {\n    ecma_raise_type_error (ECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_CONFIGURABLE_KEYS);\n  }\n  /* 24. */\n  else if (unchecked_result_keys->item_count != unchecked_prop_name_counter)\n  {\n    ecma_raise_type_error (ECMA_ERR_TRAP_EXTRA_KEYS_FOR_A_NON_EXTENSIBLE_TARGET);\n  }\n  /* 25. */\n  else\n  {\n    check_ok = true;\n  }\n\n  ecma_collection_free (unchecked_result_keys);\n\n  return check_ok;\n} /* ecma_proxy_check_invariants_for_own_prop_keys */\n\n/**\n * The Proxy object [[OwnPropertyKeys]] internal routine\n *\n * See also:\n *          ECMAScript v11, 9.5.11\n *\n * Note: If the returned collection is not NULL, it must be freed with\n *       ecma_collection_free if it is no longer needed\n *\n * @return NULL - if the operation fails\n *         pointer to a newly allocated list of property names - otherwise\n */\necma_collection_t *\necma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n  ECMA_CHECK_STACK_USAGE_RETURN (NULL);\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 1. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 2-5. */\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_OWN_KEYS_UL);\n\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return NULL;\n  }\n\n  ecma_value_t target = proxy_obj_p->target;\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n\n  /* 6. */\n  if (ecma_is_value_undefined (trap))\n  {\n    ecma_collection_t *result = ecma_op_object_own_property_keys (target_obj_p, JERRY_PROPERTY_FILTER_ALL);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n\n  /* 7. */\n  ecma_value_t trap_result_array = ecma_op_function_call (func_obj_p, handler, &target, 1);\n\n  ecma_deref_object (func_obj_p);\n\n  if (ECMA_IS_VALUE_ERROR (trap_result_array))\n  {\n    return NULL;\n  }\n\n  /* 8. */\n  ecma_collection_t *trap_result = ecma_op_create_list_from_array_like (trap_result_array, true);\n\n  ecma_free_value (trap_result_array);\n\n  if (trap_result == NULL || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))\n  {\n    return trap_result;\n  }\n\n  /* 9. */\n  if (ecma_collection_check_duplicated_entries (trap_result))\n  {\n    ecma_collection_free (trap_result);\n    ecma_raise_type_error (ECMA_ERR_TRAP_WITH_DUPLICATED_ENTRIES);\n    return NULL;\n  }\n\n  /* 10. */\n  ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);\n\n  if (ECMA_IS_VALUE_ERROR (extensible_target))\n  {\n    ecma_collection_free (trap_result);\n    return NULL;\n  }\n\n  /* 11. */\n  ecma_collection_t *target_keys = ecma_op_object_own_property_keys (target_obj_p, JERRY_PROPERTY_FILTER_ALL);\n\n  if (target_keys == NULL)\n  {\n    ecma_collection_free (trap_result);\n    return target_keys;\n  }\n\n  /* 14. */\n  ecma_collection_t *target_configurable_keys = ecma_new_collection ();\n\n  /* 15. */\n  ecma_collection_t *target_non_configurable_keys = ecma_new_collection ();\n\n  ecma_collection_t *ret_value = NULL;\n\n  /* 16. */\n  for (uint32_t i = 0; i < target_keys->item_count; i++)\n  {\n    ecma_property_descriptor_t target_desc;\n\n    ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (target_keys->buffer_p[i]);\n\n    ecma_value_t status = ecma_op_object_get_own_property_descriptor (target_obj_p, prop_name_p, &target_desc);\n\n    if (ECMA_IS_VALUE_ERROR (status))\n    {\n      ecma_collection_free (trap_result);\n      goto free_target_collections;\n    }\n\n    ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p);\n\n    if (ecma_is_value_true (status) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE))\n    {\n      ecma_collection_push_back (target_non_configurable_keys, prop_value);\n    }\n    else\n    {\n      ecma_collection_push_back (target_configurable_keys, prop_value);\n    }\n\n    if (ecma_is_value_true (status))\n    {\n      ecma_free_property_descriptor (&target_desc);\n    }\n  }\n\n  /* 17. */\n  if (ecma_is_value_true (extensible_target) && target_non_configurable_keys->item_count == 0)\n  {\n    ret_value = trap_result;\n  }\n  /* 18-22. */\n  else if (ecma_proxy_check_invariants_for_own_prop_keys (trap_result,\n                                                          target_non_configurable_keys,\n                                                          target_configurable_keys,\n                                                          extensible_target))\n  {\n    ret_value = trap_result;\n  }\n  else\n  {\n    JERRY_ASSERT (ret_value == NULL);\n    ecma_collection_free (trap_result);\n  }\n\nfree_target_collections:\n  ecma_collection_destroy (target_keys);\n  ecma_collection_free (target_configurable_keys);\n  ecma_collection_free (target_non_configurable_keys);\n\n  /* 23. */\n  return ret_value;\n} /* ecma_proxy_object_own_property_keys */\n\n/**\n * The Proxy object [[Call]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.13\n *\n * Note: Returned value must be freed with ecma_free_value.\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         result of the function call - otherwise\n */\necma_value_t\necma_proxy_object_call (ecma_object_t *obj_p, /**< proxy object */\n                        ecma_value_t this_argument, /**< this argument to invoke the function */\n                        const ecma_value_t *args_p, /**< argument list */\n                        uint32_t argc) /**< number of arguments */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n\n  if (!ecma_op_proxy_object_is_callable (obj_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION);\n  }\n\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 1. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 2-5.*/\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_APPLY);\n\n  /* 6. */\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  ecma_value_t target = proxy_obj_p->target;\n\n  /* 7. */\n  if (ecma_is_value_undefined (trap))\n  {\n    ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n    ecma_value_t result = ecma_op_function_call (target_obj_p, this_argument, args_p, argc);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  /* 8. */\n  ecma_value_t args_array = ecma_op_new_array_object_from_buffer (args_p, argc);\n  ecma_value_t value_array[] = { target, this_argument, args_array };\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n  /* 9. */\n  ecma_value_t ret_value = ecma_op_function_call (func_obj_p, handler, value_array, 3);\n  ecma_deref_object (func_obj_p);\n  ecma_free_object (args_array);\n\n  return ret_value;\n} /* ecma_proxy_object_call */\n\n/**\n * The Proxy object [[Construct]] internal routine\n *\n * See also:\n *          ECMAScript v6, 9.5.14\n *\n * Note: Returned value must be freed with ecma_free_value.\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         result of the construct call - otherwise\n */\necma_value_t\necma_proxy_object_construct (ecma_object_t *obj_p, /**< proxy object */\n                             ecma_object_t *new_target_p, /**< new target */\n                             const ecma_value_t *args_p, /**< argument list */\n                             uint32_t argc) /**< number of arguments */\n{\n  JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));\n  ECMA_CHECK_STACK_USAGE ();\n\n  ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;\n\n  /* 1. */\n  ecma_value_t handler = proxy_obj_p->handler;\n\n  /* 2-5. */\n  ecma_value_t trap = ecma_validate_proxy_object (handler, LIT_MAGIC_STRING_CONSTRUCT);\n\n  /* 6. */\n  if (ECMA_IS_VALUE_ERROR (trap))\n  {\n    return trap;\n  }\n\n  ecma_value_t target = proxy_obj_p->target;\n  ecma_object_t *target_obj_p = ecma_get_object_from_value (target);\n\n  /* 7. */\n  if (ecma_is_value_undefined (trap))\n  {\n    JERRY_ASSERT (ecma_object_is_constructor (target_obj_p));\n\n    ecma_value_t result = ecma_op_function_construct (target_obj_p, new_target_p, args_p, argc);\n    JERRY_BLOCK_TAIL_CALL_OPTIMIZATION ();\n    return result;\n  }\n\n  /* 8. */\n  ecma_value_t args_array = ecma_op_new_array_object_from_buffer (args_p, argc);\n\n  ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);\n  ecma_value_t new_target_value = ecma_make_object_value (new_target_p);\n  ecma_value_t function_call_args[] = { target, args_array, new_target_value };\n\n  /* 9. */\n  ecma_value_t new_obj = ecma_op_function_call (func_obj_p, handler, function_call_args, 3);\n\n  ecma_free_object (args_array);\n  ecma_deref_object (func_obj_p);\n\n  /* 10 .*/\n  if (ECMA_IS_VALUE_ERROR (new_obj))\n  {\n    return new_obj;\n  }\n\n  /* 11. */\n  if (!ecma_is_value_object (new_obj))\n  {\n    ecma_free_value (new_obj);\n\n    return ecma_raise_type_error (ECMA_ERR_TRAP_MUST_RETURN_WITH_AN_OBJECT);\n  }\n\n  /* 12. */\n  return new_obj;\n} /* ecma_proxy_object_construct */\n\n#endif /* JERRY_BUILTIN_PROXY */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-proxy-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_PROXY_OBJECT_H\n#define ECMA_PROXY_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaproxyobject ECMA Proxy object related routines\n * @{\n */\n\n#if JERRY_BUILTIN_PROXY\n\necma_object_t *ecma_proxy_create (ecma_value_t target, ecma_value_t handler, uint32_t options);\n\necma_object_t *ecma_proxy_create_revocable (ecma_value_t target, ecma_value_t handler);\n\necma_value_t\necma_proxy_revoke_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count);\n\necma_value_t ecma_proxy_object_find (ecma_object_t *obj_p, ecma_string_t *prop_name_p);\n\n/* Interal operations */\n\necma_value_t ecma_proxy_object_get_prototype_of (ecma_object_t *obj_p);\n\necma_value_t ecma_proxy_object_set_prototype_of (ecma_object_t *obj_p, ecma_value_t proto);\n\necma_value_t ecma_proxy_object_is_extensible (ecma_object_t *obj_p);\n\necma_value_t ecma_proxy_object_prevent_extensions (ecma_object_t *obj_p);\n\necma_value_t ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p,\n                                                            ecma_string_t *prop_name_p,\n                                                            ecma_property_descriptor_t *prop_desc_p);\n\necma_value_t ecma_proxy_object_define_own_property (ecma_object_t *obj_p,\n                                                    ecma_string_t *prop_name_p,\n                                                    const ecma_property_descriptor_t *prop_desc_p);\n\necma_value_t ecma_proxy_object_has (ecma_object_t *obj_p, ecma_string_t *prop_name_p);\n\necma_value_t ecma_proxy_object_get (ecma_object_t *obj_p, ecma_string_t *prop_name_p, ecma_value_t receiver);\n\necma_value_t ecma_proxy_object_set (ecma_object_t *obj_p,\n                                    ecma_string_t *prop_name_p,\n                                    ecma_value_t name,\n                                    ecma_value_t receiver,\n                                    bool is_strict);\n\necma_value_t ecma_proxy_object_delete_property (ecma_object_t *obj_p, ecma_string_t *prop_name_p, bool is_strict);\n\necma_collection_t *ecma_proxy_object_own_property_keys (ecma_object_t *obj_p);\n\necma_value_t\necma_proxy_object_call (ecma_object_t *obj_p, ecma_value_t this_argument, const ecma_value_t *args_p, uint32_t argc);\n\necma_value_t ecma_proxy_object_construct (ecma_object_t *obj_p,\n                                          ecma_object_t *new_target_p,\n                                          const ecma_value_t *args_p,\n                                          uint32_t argc);\n\n#endif /* JERRY_BUILTIN_PROXY */\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_PROXY_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-reference.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-reference.h\"\n\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-lcache.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-proxy-object.h\"\n\n#include \"jrt.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup references ECMA-Reference\n * @{\n */\n\n/**\n * Resolve syntactic reference.\n *\n * @return ECMA_OBJECT_POINTER_ERROR - if the operation fails\n *         pointer to lexical environment - if the reference's base is resolved successfully,\n *         NULL - otherwise.\n */\necma_object_t *\necma_op_resolve_reference_base (ecma_object_t *lex_env_p, /**< starting lexical environment */\n                                ecma_string_t *name_p) /**< identifier's name */\n{\n  JERRY_ASSERT (lex_env_p != NULL);\n\n  while (true)\n  {\n    ecma_value_t has_binding = ecma_op_has_binding (lex_env_p, name_p);\n\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_IS_VALUE_ERROR (has_binding))\n    {\n      return ECMA_OBJECT_POINTER_ERROR;\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n\n    if (ecma_is_value_true (has_binding))\n    {\n      return lex_env_p;\n    }\n\n    if (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL)\n    {\n      return NULL;\n    }\n\n    lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n  }\n} /* ecma_op_resolve_reference_base */\n\n/**\n * Check if the passed lexical environment is a global lexical environment\n *\n * @return true  - if the lexical environment is a global lexical environment\n *         false - otherwise\n */\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\necma_op_is_global_environment (ecma_object_t *lex_env_p) /**< lexical environment */\n{\n  JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n#if JERRY_BUILTIN_REALMS\n  JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL\n                || (ecma_make_object_value (ecma_get_lex_env_binding_object (lex_env_p))\n                    == ((ecma_global_object_t *) ecma_builtin_get_global ())->this_binding));\n#else /* !JERRY_BUILTIN_REALMS */\n  JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL\n                || ecma_get_lex_env_binding_object (lex_env_p) == ecma_builtin_get_global ());\n#endif /* JERRY_BUILTIN_REALMS */\n\n  return lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL;\n} /* ecma_op_is_global_environment */\n\n/**\n * Perform GetThisEnvironment and GetSuperBase operations\n *\n * See also: ECMAScript v6, 8.1.1.3.5\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_UNDEFINED - if the home object is null\n *         value of the [[HomeObject]].[[Prototype]] internal slot - otherwise\n */\necma_value_t\necma_op_resolve_super_base (ecma_object_t *lex_env_p) /**< starting lexical environment */\n{\n  while (true)\n  {\n    JERRY_ASSERT (lex_env_p != NULL);\n\n    if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_CLASS\n        && !ECMA_LEX_ENV_CLASS_IS_MODULE (lex_env_p))\n    {\n      ecma_object_t *home_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u1.home_object_cp);\n\n#if JERRY_BUILTIN_PROXY\n      if (ECMA_OBJECT_IS_PROXY (home_p))\n      {\n        return ecma_proxy_object_get_prototype_of (home_p);\n      }\n#endif /* JERRY_BUILTIN_PROXY */\n\n      jmem_cpointer_t proto_cp = ecma_op_ordinary_object_get_prototype_of (home_p);\n\n      if (proto_cp == JMEM_CP_NULL)\n      {\n        return ECMA_VALUE_NULL;\n      }\n\n      ecma_object_t *proto_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, proto_cp);\n      ecma_ref_object (proto_p);\n\n      return ecma_make_object_value (proto_p);\n    }\n\n    if (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL)\n    {\n      break;\n    }\n\n    lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n  }\n\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_op_resolve_super_base */\n\n/**\n * Helper method for HasBindig operation\n *\n * See also:\n *         ECMA-262 v6, 8.1.1.2.1 steps 7-9;\n *\n * @return ECMA_VALUE_TRUE - if the property is unscopable\n *         ECMA_VALUE_FALSE - if a the property is not unscopable\n *         ECMA_VALUE_ERROR - otherwise\n */\nstatic ecma_value_t\necma_op_is_prop_unscopable (ecma_object_t *binding_obj_p, /**< binding object */\n                            ecma_string_t *prop_name_p) /**< property's name */\n{\n  ecma_value_t unscopables = ecma_op_object_get_by_symbol_id (binding_obj_p, LIT_GLOBAL_SYMBOL_UNSCOPABLES);\n\n  if (ECMA_IS_VALUE_ERROR (unscopables))\n  {\n    return unscopables;\n  }\n\n  if (ecma_is_value_object (unscopables))\n  {\n    ecma_object_t *unscopables_obj_p = ecma_get_object_from_value (unscopables);\n    ecma_value_t get_unscopables_value = ecma_op_object_get (unscopables_obj_p, prop_name_p);\n    ecma_deref_object (unscopables_obj_p);\n\n    if (ECMA_IS_VALUE_ERROR (get_unscopables_value))\n    {\n      return get_unscopables_value;\n    }\n\n    bool is_blocked = ecma_op_to_boolean (get_unscopables_value);\n\n    ecma_free_value (get_unscopables_value);\n\n    return ecma_make_boolean_value (is_blocked);\n  }\n\n  ecma_free_value (unscopables);\n\n  return ECMA_VALUE_FALSE;\n} /* ecma_op_is_prop_unscopable */\n\n/**\n * Helper method for HasBindig operation\n *\n * See also:\n *         ECMA-262 v6, 8.1.1.2.1 steps 7-9;\n *\n * @return ECMA_VALUE_TRUE - if the property is unscopable\n *         ECMA_VALUE_FALSE - if a the property is not unscopable\n *         ECMA_VALUE_ERROR - otherwise\n */\n\n/**\n * Resolve value corresponding to the given object environment reference.\n *\n * Note: the steps are already include the HasBindig operation steps\n *\n *  See also:\n *         ECMA-262 v6, 8.1.1.2.1\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_NOT_FOUND - if the binding not exists or blocked via @@unscopables\n *         result of the binding - otherwise\n */\necma_value_t\necma_op_object_bound_environment_resolve_reference_value (ecma_object_t *lex_env_p, /**< lexical environment */\n                                                          ecma_string_t *name_p) /**< variable name */\n{\n  ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);\n  ecma_value_t found_binding;\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (binding_obj_p))\n  {\n    found_binding = ecma_proxy_object_has (binding_obj_p, name_p);\n\n    if (!ecma_is_value_true (found_binding))\n    {\n      return ECMA_IS_VALUE_ERROR (found_binding) ? found_binding : ECMA_VALUE_NOT_FOUND;\n    }\n  }\n  else\n  {\n#endif /* JERRY_BUILTIN_PROXY */\n    found_binding = ecma_op_object_find (binding_obj_p, name_p);\n\n    if (ECMA_IS_VALUE_ERROR (found_binding) || !ecma_is_value_found (found_binding))\n    {\n      return found_binding;\n    }\n\n    if (JERRY_LIKELY (ecma_op_is_global_environment (lex_env_p)))\n    {\n      return found_binding;\n    }\n#if JERRY_BUILTIN_PROXY\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_value_t blocked = ecma_op_is_prop_unscopable (binding_obj_p, name_p);\n\n  if (ecma_is_value_false (blocked))\n  {\n#if JERRY_BUILTIN_PROXY\n    if (ECMA_OBJECT_IS_PROXY (binding_obj_p))\n    {\n      return ecma_proxy_object_get (binding_obj_p, name_p, ecma_make_object_value (binding_obj_p));\n    }\n#endif /* JERRY_BUILTIN_PROXY */\n    return found_binding;\n  }\n\n#if JERRY_BUILTIN_PROXY\n  if (!ECMA_OBJECT_IS_PROXY (binding_obj_p))\n  {\n    ecma_free_value (found_binding);\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  return ECMA_IS_VALUE_ERROR (blocked) ? blocked : ECMA_VALUE_NOT_FOUND;\n} /* ecma_op_object_bound_environment_resolve_reference_value */\n\n/**\n * Resolve value corresponding to reference.\n *\n * @return value of the reference\n */\necma_value_t\necma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical environment */\n                                 ecma_string_t *name_p) /**< identifier's name */\n{\n  JERRY_ASSERT (lex_env_p != NULL);\n\n  while (true)\n  {\n    switch (ecma_get_lex_env_type (lex_env_p))\n    {\n      case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:\n      {\n        ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n        if (property_p == NULL)\n        {\n          break;\n        }\n\n        ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n        if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))\n        {\n          return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);\n        }\n\n        return ecma_fast_copy_value (property_value_p->value);\n      }\n      case ECMA_LEXICAL_ENVIRONMENT_CLASS:\n      {\n#if JERRY_MODULE_SYSTEM\n        if (ECMA_LEX_ENV_CLASS_IS_MODULE (lex_env_p))\n        {\n          ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n          if (property_p == NULL)\n          {\n            break;\n          }\n\n          ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n          if (!(*property_p & ECMA_PROPERTY_FLAG_DATA))\n          {\n            property_value_p = ecma_get_property_value_from_named_reference (property_value_p);\n          }\n\n          if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))\n          {\n            return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);\n          }\n\n          return ecma_fast_copy_value (property_value_p->value);\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);\n\n        if (ecma_op_is_global_environment (lex_env_p))\n        {\n#if JERRY_LCACHE\n          ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);\n          ecma_property_t *property_p = ecma_lcache_lookup (binding_obj_p, name_p);\n\n          if (property_p != NULL)\n          {\n            JERRY_ASSERT (ECMA_PROPERTY_IS_RAW (*property_p));\n\n            ecma_property_value_t *prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n            if (*property_p & ECMA_PROPERTY_FLAG_DATA)\n            {\n              return ecma_fast_copy_value (prop_value_p->value);\n            }\n\n            return ecma_op_invoke_getter (ecma_get_named_accessor_property (prop_value_p),\n                                          ecma_make_object_value (binding_obj_p));\n          }\n#endif /* JERRY_LCACHE */\n        }\n\n        ecma_value_t result = ecma_op_object_bound_environment_resolve_reference_value (lex_env_p, name_p);\n\n        if (ecma_is_value_found (result))\n        {\n          /* Note: the result may contains ECMA_VALUE_ERROR */\n          return result;\n        }\n        break;\n      }\n    }\n\n    if (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL)\n    {\n      break;\n    }\n\n    lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n  }\n\n#if JERRY_ERROR_MESSAGES\n  ecma_value_t name_val = ecma_make_string_value (name_p);\n  ecma_value_t error_value =\n    ecma_raise_standard_error_with_format (JERRY_ERROR_REFERENCE, \"% is not defined\", name_val);\n#else /* JERRY_ERROR_MESSAGES */\n  ecma_value_t error_value = ecma_raise_reference_error (ECMA_ERR_EMPTY);\n#endif /* !JERRY_ERROR_MESSAGES */\n  return error_value;\n} /* ecma_op_resolve_reference_value */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-reference.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_REFERENCE_H\n#define ECMA_REFERENCE_H\n\n#include \"ecma-globals.h\"\n\n#include \"jrt.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup references ECMA-Reference\n * @{\n */\n\necma_object_t *ecma_op_resolve_reference_base (ecma_object_t *lex_env_p, ecma_string_t *name_p);\necma_value_t ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, ecma_string_t *name_p);\necma_value_t ecma_op_object_bound_environment_resolve_reference_value (ecma_object_t *lex_env_p, ecma_string_t *name_p);\necma_value_t ecma_op_resolve_super_base (ecma_object_t *lex_env_p);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_REFERENCE_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-regexp-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-regexp-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n#include \"jrt-libc-includes.h\"\n#include \"lit-char-helpers.h\"\n#include \"re-compiler.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n#define ECMA_BUILTINS_INTERNAL\n#include \"ecma-builtins-internal.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaregexpobject ECMA RegExp object related routines\n * @{\n */\n\n/**\n * Index of the global capturing group\n */\n#define RE_GLOBAL_CAPTURE 0\n\n/**\n * Parse RegExp flags (global, ignoreCase, multiline)\n *\n * See also: ECMA-262 v5, 15.10.4.1\n *\n * @return empty ecma value - if parsed successfully\n *         error ecma value - otherwise\n *\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_regexp_parse_flags (ecma_string_t *flags_str_p, /**< Input string with flags */\n                         uint16_t *flags_p) /**< [out] parsed flag bits */\n{\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n  uint16_t result_flags = RE_FLAG_EMPTY;\n\n  ECMA_STRING_TO_UTF8_STRING (flags_str_p, flags_start_p, flags_start_size);\n\n  const lit_utf8_byte_t *flags_str_curr_p = flags_start_p;\n  const lit_utf8_byte_t *flags_str_end_p = flags_start_p + flags_start_size;\n\n  while (flags_str_curr_p < flags_str_end_p)\n  {\n    ecma_regexp_flags_t flag;\n    switch (*flags_str_curr_p++)\n    {\n      case 'g':\n      {\n        flag = RE_FLAG_GLOBAL;\n        break;\n      }\n      case 'i':\n      {\n        flag = RE_FLAG_IGNORE_CASE;\n        break;\n      }\n      case 'm':\n      {\n        flag = RE_FLAG_MULTILINE;\n        break;\n      }\n      case 'y':\n      {\n        flag = RE_FLAG_STICKY;\n        break;\n      }\n      case 'u':\n      {\n        flag = RE_FLAG_UNICODE;\n        break;\n      }\n      case 's':\n      {\n        flag = RE_FLAG_DOTALL;\n        break;\n      }\n      default:\n      {\n        flag = RE_FLAG_EMPTY;\n        break;\n      }\n    }\n\n    if (flag == RE_FLAG_EMPTY || (result_flags & flag) != 0)\n    {\n      ret_value = ecma_raise_syntax_error (ECMA_ERR_INVALID_REGEXP_FLAGS);\n      break;\n    }\n\n    result_flags = (uint16_t) (result_flags | flag);\n  }\n\n  ECMA_FINALIZE_UTF8_STRING (flags_start_p, flags_start_size);\n\n  *flags_p = result_flags;\n  return ret_value;\n} /* ecma_regexp_parse_flags */\n\n/**\n * RegExpAlloc method\n *\n * See also: ECMA-262 v5, 15.10.4.1\n *           ECMA-262 v6, 21.2.3.2.1\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return ecma_object_t\n */\necma_object_t *\necma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer */\n{\n  if (ctr_obj_p == NULL)\n  {\n    ctr_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP);\n  }\n\n  ecma_object_t *proto_obj_p = ecma_op_get_prototype_from_constructor (ctr_obj_p, ECMA_BUILTIN_ID_REGEXP_PROTOTYPE);\n\n  if (JERRY_UNLIKELY (proto_obj_p == NULL))\n  {\n    return proto_obj_p;\n  }\n\n  ecma_object_t *new_object_p =\n    ecma_create_object (proto_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_deref_object (proto_obj_p);\n\n  ecma_extended_object_t *regexp_obj_p = (ecma_extended_object_t *) new_object_p;\n\n  /* Class id will be initialized after the bytecode is compiled. */\n  regexp_obj_p->u.cls.type = ECMA_OBJECT_CLASS__MAX;\n\n  ecma_value_t status = ecma_builtin_helper_def_prop (new_object_p,\n                                                      ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),\n                                                      ecma_make_uint32_value (0),\n                                                      ECMA_PROPERTY_FLAG_WRITABLE | JERRY_PROP_SHOULD_THROW);\n\n  JERRY_ASSERT (ecma_is_value_true (status));\n\n  return new_object_p;\n} /* ecma_op_regexp_alloc */\n\n/**\n * Helper method for initializing an aready existing RegExp object.\n */\nstatic inline void JERRY_ATTR_ALWAYS_INLINE\necma_op_regexp_initialize (ecma_object_t *regexp_obj_p, /**< RegExp object */\n                           const re_compiled_code_t *bc_p) /**< bytecode */\n{\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) regexp_obj_p;\n  ext_obj_p->u.cls.type = ECMA_OBJECT_CLASS_REGEXP;\n  ECMA_SET_INTERNAL_VALUE_POINTER (ext_obj_p->u.cls.u3.value, bc_p);\n} /* ecma_op_regexp_initialize */\n\n/**\n * Method for creating a RegExp object from pattern.\n *\n * Note:\n *      Allocation have to happen before invoking this function using ecma_op_regexp_alloc.\n *\n * @return ecma_value_t\n */\necma_value_t\necma_op_create_regexp_from_pattern (ecma_object_t *regexp_obj_p, /**< RegExp object */\n                                    ecma_value_t pattern_value, /**< pattern */\n                                    ecma_value_t flags_value) /**< flags */\n{\n  ecma_string_t *pattern_str_p = ecma_regexp_read_pattern_str_helper (pattern_value);\n  uint16_t flags = 0;\n\n  if (JERRY_UNLIKELY (pattern_str_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (!ecma_is_value_undefined (flags_value))\n  {\n    ecma_string_t *flags_str_p = ecma_op_to_string (flags_value);\n\n    if (JERRY_UNLIKELY (flags_str_p == NULL))\n    {\n      ecma_deref_ecma_string (pattern_str_p);\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_value_t parse_flags_value = ecma_regexp_parse_flags (flags_str_p, &flags);\n    ecma_deref_ecma_string (flags_str_p);\n\n    if (ECMA_IS_VALUE_ERROR (parse_flags_value))\n    {\n      ecma_deref_ecma_string (pattern_str_p);\n      return parse_flags_value;\n    }\n\n    JERRY_ASSERT (ecma_is_value_empty (parse_flags_value));\n  }\n\n  re_compiled_code_t *bc_p = re_compile_bytecode (pattern_str_p, flags);\n\n  if (JERRY_UNLIKELY (bc_p == NULL))\n  {\n    ecma_deref_ecma_string (pattern_str_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_op_regexp_initialize (regexp_obj_p, bc_p);\n  ecma_deref_ecma_string (pattern_str_p);\n\n  return ecma_make_object_value (regexp_obj_p);\n} /* ecma_op_create_regexp_from_pattern */\n\n/**\n * Method for creating a RegExp object from bytecode.\n *\n * Note:\n *      Allocation have to happen before invoking this function using ecma_op_regexp_alloc.\n *\n * @return ecma_value_t\n */\necma_value_t\necma_op_create_regexp_from_bytecode (ecma_object_t *regexp_obj_p, /**< RegExp object */\n                                     re_compiled_code_t *bc_p) /**< bytecode */\n{\n  ecma_bytecode_ref ((ecma_compiled_code_t *) bc_p);\n\n  ecma_op_regexp_initialize (regexp_obj_p, bc_p);\n\n  return ecma_make_object_value (regexp_obj_p);\n} /* ecma_op_create_regexp_from_bytecode */\n\n/**\n * Method for creating a RegExp object from pattern with already parsed flags.\n *\n * Note:\n *      Allocation have to happen before invoking this function using ecma_op_regexp_alloc.\n *\n * @return ecma_value_t\n */\necma_value_t\necma_op_create_regexp_with_flags (ecma_object_t *regexp_obj_p, /**< RegExp object */\n                                  ecma_value_t pattern_value, /**< pattern */\n                                  uint16_t flags) /**< flags */\n{\n  ecma_string_t *pattern_str_p = ecma_regexp_read_pattern_str_helper (pattern_value);\n\n  if (JERRY_UNLIKELY (pattern_str_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  re_compiled_code_t *bc_p = re_compile_bytecode (pattern_str_p, flags);\n  ecma_deref_ecma_string (pattern_str_p);\n\n  if (JERRY_UNLIKELY (bc_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_op_regexp_initialize (regexp_obj_p, bc_p);\n\n  return ecma_make_object_value (regexp_obj_p);\n} /* ecma_op_create_regexp_with_flags */\n\n/**\n * Canonicalize a character\n *\n * @return ecma_char_t canonicalized character\n */\nlit_code_point_t\necma_regexp_canonicalize_char (lit_code_point_t ch, /**< character */\n                               bool unicode) /**< unicode */\n{\n  if (unicode)\n  {\n    /* In unicode mode the mappings contained in the CaseFolding.txt file should be used to canonicalize the character.\n     * These mappings generally correspond to the lowercase variant of the character, however there are some\n     * differences. In some cases the uppercase variant is used, in others the lowercase of the uppercase character is\n     * used, and there are also cases where the character has no case folding mapping even though it has upper/lower\n     * variants. Since lowercasing is the most common this is used as the default behaviour, and characters with\n     * differing behaviours are encoded in lookup tables. */\n\n    if (lit_char_fold_to_upper (ch))\n    {\n      ch = lit_char_to_upper_case (ch, NULL);\n      JERRY_ASSERT (ch != LIT_MULTIPLE_CU);\n    }\n\n    if (lit_char_fold_to_lower (ch))\n    {\n      ch = lit_char_to_lower_case (ch, NULL);\n      JERRY_ASSERT (ch != LIT_MULTIPLE_CU);\n    }\n\n    return ch;\n  }\n\n  JERRY_UNUSED (unicode);\n  lit_code_point_t cu = lit_char_to_upper_case (ch, NULL);\n\n  if (ch <= LIT_UTF8_1_BYTE_CODE_POINT_MAX || (cu > LIT_UTF8_1_BYTE_CODE_POINT_MAX && cu != LIT_MULTIPLE_CU))\n  {\n    return cu;\n  }\n\n  return ch;\n} /* ecma_regexp_canonicalize_char */\n\n/**\n * RegExp Canonicalize abstract operation\n *\n * See also: ECMA-262 v5, 15.10.2.8\n *\n * @return ecma_char_t canonicalized character\n */\nstatic inline lit_code_point_t JERRY_ATTR_ALWAYS_INLINE\necma_regexp_canonicalize (lit_code_point_t ch, /**< character */\n                          uint16_t flags) /**< flags */\n{\n  if (flags & RE_FLAG_IGNORE_CASE)\n  {\n    return ecma_regexp_canonicalize_char (ch, flags & RE_FLAG_UNICODE);\n  }\n\n  return ch;\n} /* ecma_regexp_canonicalize */\n\n/**\n * Check if a code point is matched by a class escape.\n *\n * @return true, if code point matches escape\n *         false, otherwise\n */\nstatic bool\necma_regexp_check_class_escape (lit_code_point_t cp, /**< char */\n                                ecma_class_escape_t escape) /**< escape */\n{\n  switch (escape)\n  {\n    case RE_ESCAPE_DIGIT:\n    {\n      return (cp >= LIT_CHAR_0 && cp <= LIT_CHAR_9);\n    }\n    case RE_ESCAPE_NOT_DIGIT:\n    {\n      return (cp < LIT_CHAR_0 || cp > LIT_CHAR_9);\n    }\n    case RE_ESCAPE_WORD_CHAR:\n    {\n      return lit_char_is_word_char (cp);\n    }\n    case RE_ESCAPE_NOT_WORD_CHAR:\n    {\n      return !lit_char_is_word_char (cp);\n    }\n    case RE_ESCAPE_WHITESPACE:\n    {\n      return lit_char_is_white_space ((ecma_char_t) cp);\n    }\n    case RE_ESCAPE_NOT_WHITESPACE:\n    {\n      return !lit_char_is_white_space ((ecma_char_t) cp);\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n} /* ecma_regexp_check_class_escape */\n\n/**\n * Helper function to get current code point or code unit depending on execution mode,\n * and advance the string pointer.\n *\n * @return lit_code_point_t current code point\n */\nstatic lit_code_point_t\necma_regexp_advance (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */\n                     const lit_utf8_byte_t **str_p) /**< reference to string pointer */\n{\n  JERRY_ASSERT (str_p != NULL);\n  lit_code_point_t cp = lit_cesu8_read_next (str_p);\n\n  if (JERRY_UNLIKELY (re_ctx_p->flags & RE_FLAG_UNICODE) && lit_is_code_point_utf16_high_surrogate ((ecma_char_t) cp)\n      && *str_p < re_ctx_p->input_end_p)\n  {\n    const ecma_char_t next_ch = lit_cesu8_peek_next (*str_p);\n    if (lit_is_code_point_utf16_low_surrogate (next_ch))\n    {\n      cp = lit_convert_surrogate_pair_to_code_point ((ecma_char_t) cp, next_ch);\n      *str_p += LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;\n    }\n  }\n\n  return ecma_regexp_canonicalize (cp, re_ctx_p->flags);\n} /* ecma_regexp_advance */\n\n/**\n * Helper function to get current full unicode code point and advance the string pointer.\n *\n * @return lit_code_point_t current code point\n */\nlit_code_point_t\necma_regexp_unicode_advance (const lit_utf8_byte_t **str_p, /**< reference to string pointer */\n                             const lit_utf8_byte_t *end_p) /**< string end pointer */\n{\n  JERRY_ASSERT (str_p != NULL);\n  const lit_utf8_byte_t *current_p = *str_p;\n\n  lit_code_point_t ch = lit_cesu8_read_next (&current_p);\n  if (lit_is_code_point_utf16_high_surrogate ((ecma_char_t) ch) && current_p < end_p)\n  {\n    const ecma_char_t next_ch = lit_cesu8_peek_next (current_p);\n    if (lit_is_code_point_utf16_low_surrogate (next_ch))\n    {\n      ch = lit_convert_surrogate_pair_to_code_point ((ecma_char_t) ch, next_ch);\n      current_p += LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;\n    }\n  }\n\n  *str_p = current_p;\n  return ch;\n} /* ecma_regexp_unicode_advance */\n\n/**\n * Helper function to revert the string pointer to the previous code point.\n *\n * @return pointer to previous code point\n */\nstatic JERRY_ATTR_NOINLINE const lit_utf8_byte_t *\necma_regexp_step_back (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */\n                       const lit_utf8_byte_t *str_p) /**< reference to string pointer */\n{\n  JERRY_ASSERT (str_p != NULL);\n\n  lit_code_point_t ch = lit_cesu8_read_prev (&str_p);\n  if (JERRY_UNLIKELY (re_ctx_p->flags & RE_FLAG_UNICODE) && lit_is_code_point_utf16_low_surrogate (ch)\n      && lit_is_code_point_utf16_high_surrogate (lit_cesu8_peek_prev (str_p)))\n  {\n    str_p -= LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;\n  }\n\n  return str_p;\n} /* ecma_regexp_step_back */\n\n/**\n * Check if the current poisition is on a word boundary.\n *\n * @return true, if on a word boundary\n *         false - otherwise\n */\nstatic bool\necma_regexp_is_word_boundary (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */\n                              const lit_utf8_byte_t *str_p) /**< string pointer */\n{\n  lit_code_point_t left_cp;\n  lit_code_point_t right_cp;\n\n  if (JERRY_UNLIKELY (str_p <= re_ctx_p->input_start_p))\n  {\n    left_cp = LIT_INVALID_CP;\n  }\n  else if (JERRY_UNLIKELY ((re_ctx_p->flags & (RE_FLAG_UNICODE | RE_FLAG_IGNORE_CASE))\n                           == (RE_FLAG_UNICODE | RE_FLAG_IGNORE_CASE)))\n  {\n    const lit_utf8_byte_t *prev_p = ecma_regexp_step_back (re_ctx_p, str_p);\n    left_cp = ecma_regexp_advance (re_ctx_p, &prev_p);\n    JERRY_ASSERT (prev_p == str_p);\n  }\n  else\n  {\n    left_cp = str_p[-1];\n  }\n\n  if (JERRY_UNLIKELY (str_p >= re_ctx_p->input_end_p))\n  {\n    right_cp = LIT_INVALID_CP;\n  }\n  else if (JERRY_UNLIKELY ((re_ctx_p->flags & (RE_FLAG_UNICODE | RE_FLAG_IGNORE_CASE))\n                           == (RE_FLAG_UNICODE | RE_FLAG_IGNORE_CASE)))\n  {\n    right_cp = ecma_regexp_advance (re_ctx_p, &str_p);\n  }\n  else\n  {\n    right_cp = str_p[0];\n  }\n\n  return lit_char_is_word_char (left_cp) != lit_char_is_word_char (right_cp);\n} /* ecma_regexp_is_word_boundary */\n\n/**\n * Recursive function for executing RegExp bytecode.\n *\n * See also:\n *          ECMA-262 v5, 15.10.2.1\n *\n * @return pointer to the end of the currently matched substring\n *         NULL, if pattern did not match\n */\nstatic const lit_utf8_byte_t *\necma_regexp_run (ecma_regexp_ctx_t *re_ctx_p, /**< RegExp matcher context */\n                 const uint8_t *bc_p, /**< pointer to the current RegExp bytecode */\n                 const lit_utf8_byte_t *str_curr_p) /**< input string pointer */\n{\n#if (JERRY_STACK_LIMIT != 0)\n  if (JERRY_UNLIKELY (ecma_get_current_stack_usage () > CONFIG_MEM_STACK_LIMIT))\n  {\n    return ECMA_RE_OUT_OF_STACK;\n  }\n#endif /* JERRY_STACK_LIMIT != 0 */\n\n  const lit_utf8_byte_t *str_start_p = str_curr_p;\n  const uint8_t *next_alternative_p = NULL;\n\n  while (true)\n  {\n    const re_opcode_t op = re_get_opcode (&bc_p);\n\n    switch (op)\n    {\n      case RE_OP_EOF:\n      {\n        re_ctx_p->captures_p[RE_GLOBAL_CAPTURE].end_p = str_curr_p;\n        /* FALLTHRU */\n      }\n      case RE_OP_ASSERT_END:\n      case RE_OP_ITERATOR_END:\n      {\n        return str_curr_p;\n      }\n      case RE_OP_ALTERNATIVE_START:\n      {\n        const uint32_t offset = re_get_value (&bc_p);\n        next_alternative_p = bc_p + offset;\n        continue;\n      }\n      case RE_OP_ALTERNATIVE_NEXT:\n      {\n        while (true)\n        {\n          const uint32_t offset = re_get_value (&bc_p);\n          bc_p += offset;\n\n          if (*bc_p != RE_OP_ALTERNATIVE_NEXT)\n          {\n            break;\n          }\n\n          bc_p++;\n        }\n\n        continue;\n      }\n      case RE_OP_NO_ALTERNATIVE:\n      {\n        return NULL;\n      }\n      case RE_OP_CAPTURING_GROUP_START:\n      {\n        const uint32_t group_idx = re_get_value (&bc_p);\n        ecma_regexp_capture_t *const group_p = re_ctx_p->captures_p + group_idx;\n        group_p->subcapture_count = re_get_value (&bc_p);\n\n        const lit_utf8_byte_t *const saved_begin_p = group_p->begin_p;\n        const lit_utf8_byte_t *const saved_end_p = group_p->end_p;\n        const uint32_t saved_iterator = group_p->iterator;\n\n        const uint32_t qmin = re_get_value (&bc_p);\n        group_p->end_p = NULL;\n\n        /* If zero iterations are allowed, then execute the end opcode which will handle further iterations,\n         * otherwise run the 1st iteration immediately by executing group bytecode. */\n        if (qmin == 0)\n        {\n          group_p->iterator = 0;\n          group_p->begin_p = NULL;\n          const uint32_t end_offset = re_get_value (&bc_p);\n          group_p->bc_p = bc_p;\n\n          bc_p += end_offset;\n        }\n        else\n        {\n          group_p->iterator = 1;\n          group_p->begin_p = str_curr_p;\n          group_p->bc_p = bc_p;\n        }\n\n        const lit_utf8_byte_t *matched_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n        group_p->iterator = saved_iterator;\n\n        if (matched_p == NULL)\n        {\n          group_p->begin_p = saved_begin_p;\n          group_p->end_p = saved_end_p;\n          goto fail;\n        }\n\n        return matched_p;\n      }\n      case RE_OP_NON_CAPTURING_GROUP_START:\n      {\n        const uint32_t group_idx = re_get_value (&bc_p);\n        ecma_regexp_non_capture_t *const group_p = re_ctx_p->non_captures_p + group_idx;\n\n        group_p->subcapture_start = re_get_value (&bc_p);\n        group_p->subcapture_count = re_get_value (&bc_p);\n\n        const lit_utf8_byte_t *const saved_begin_p = group_p->begin_p;\n        const uint32_t saved_iterator = group_p->iterator;\n        const uint32_t qmin = re_get_value (&bc_p);\n\n        /* If zero iterations are allowed, then execute the end opcode which will handle further iterations,\n         * otherwise run the 1st iteration immediately by executing group bytecode. */\n        if (qmin == 0)\n        {\n          group_p->iterator = 0;\n          group_p->begin_p = NULL;\n          const uint32_t end_offset = re_get_value (&bc_p);\n          group_p->bc_p = bc_p;\n\n          bc_p += end_offset;\n        }\n        else\n        {\n          group_p->iterator = 1;\n          group_p->begin_p = str_curr_p;\n          group_p->bc_p = bc_p;\n        }\n\n        const lit_utf8_byte_t *matched_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n        group_p->iterator = saved_iterator;\n\n        if (matched_p == NULL)\n        {\n          group_p->begin_p = saved_begin_p;\n          goto fail;\n        }\n\n        return matched_p;\n      }\n      case RE_OP_GREEDY_CAPTURING_GROUP_END:\n      {\n        const uint32_t group_idx = re_get_value (&bc_p);\n        ecma_regexp_capture_t *const group_p = re_ctx_p->captures_p + group_idx;\n        const uint32_t qmin = re_get_value (&bc_p);\n\n        if (group_p->iterator < qmin)\n        {\n          /* No need to save begin_p since we don't have to backtrack beyond the minimum iteration count, but we have\n           * to clear nested capturing groups. */\n          group_p->begin_p = str_curr_p;\n          for (uint32_t i = 1; i < group_p->subcapture_count; ++i)\n          {\n            group_p[i].begin_p = NULL;\n          }\n\n          group_p->iterator++;\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, group_p->bc_p, str_curr_p);\n\n          if (matched_p != NULL)\n          {\n            return matched_p;\n          }\n\n          group_p->iterator--;\n          goto fail;\n        }\n\n        /* Empty matches are not allowed after reaching the minimum number of iterations. */\n        if (JERRY_UNLIKELY (group_p->begin_p >= str_curr_p) && (group_p->iterator > qmin))\n        {\n          goto fail;\n        }\n\n        const uint32_t qmax = re_get_value (&bc_p) - RE_QMAX_OFFSET;\n        if (JERRY_UNLIKELY (group_p->iterator >= qmax))\n        {\n          /* Reached maximum number of iterations, try to match tail bytecode. */\n          group_p->end_p = str_curr_p;\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n          if (matched_p != NULL)\n          {\n            return matched_p;\n          }\n\n          goto fail;\n        }\n\n        {\n          /* Save and clear all nested capturing groups, and try to iterate. */\n          JERRY_VLA (const lit_utf8_byte_t *, saved_captures_p, group_p->subcapture_count);\n          for (uint32_t i = 0; i < group_p->subcapture_count; ++i)\n          {\n            saved_captures_p[i] = group_p[i].begin_p;\n            group_p[i].begin_p = NULL;\n          }\n\n          group_p->iterator++;\n          group_p->begin_p = str_curr_p;\n\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, group_p->bc_p, str_curr_p);\n\n          if (matched_p != NULL)\n          {\n            return matched_p;\n          }\n\n          /* Failed to iterate again, backtrack to current match, and try to run tail bytecode. */\n          for (uint32_t i = 0; i < group_p->subcapture_count; ++i)\n          {\n            group_p[i].begin_p = saved_captures_p[i];\n          }\n\n          group_p->iterator--;\n          group_p->end_p = str_curr_p;\n        }\n\n        const lit_utf8_byte_t *const tail_match_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n        if (tail_match_p != NULL)\n        {\n          return tail_match_p;\n        }\n\n        goto fail;\n      }\n      case RE_OP_GREEDY_NON_CAPTURING_GROUP_END:\n      {\n        const uint32_t group_idx = re_get_value (&bc_p);\n        ecma_regexp_non_capture_t *const group_p = re_ctx_p->non_captures_p + group_idx;\n        const uint32_t qmin = re_get_value (&bc_p);\n\n        if (group_p->iterator < qmin)\n        {\n          /* No need to save begin_p but we have to clear nested capturing groups. */\n          group_p->begin_p = str_curr_p;\n\n          ecma_regexp_capture_t *const capture_p = re_ctx_p->captures_p + group_p->subcapture_start;\n          for (uint32_t i = 0; i < group_p->subcapture_count; ++i)\n          {\n            capture_p[i].begin_p = NULL;\n          }\n\n          group_p->iterator++;\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, group_p->bc_p, str_curr_p);\n\n          if (matched_p != NULL)\n          {\n            return matched_p;\n          }\n\n          group_p->iterator--;\n          goto fail;\n        }\n\n        /* Empty matches are not allowed after reaching the minimum number of iterations. */\n        if (JERRY_UNLIKELY (group_p->begin_p >= str_curr_p) && (group_p->iterator > qmin))\n        {\n          goto fail;\n        }\n\n        const uint32_t qmax = re_get_value (&bc_p) - RE_QMAX_OFFSET;\n        if (JERRY_UNLIKELY (group_p->iterator >= qmax))\n        {\n          /* Reached maximum number of iterations, try to match tail bytecode. */\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n          if (matched_p != NULL)\n          {\n            return matched_p;\n          }\n\n          goto fail;\n        }\n\n        {\n          /* Save and clear all nested capturing groups, and try to iterate. */\n          JERRY_VLA (const lit_utf8_byte_t *, saved_captures_p, group_p->subcapture_count);\n          for (uint32_t i = 0; i < group_p->subcapture_count; ++i)\n          {\n            ecma_regexp_capture_t *const capture_p = re_ctx_p->captures_p + group_p->subcapture_start + i;\n            saved_captures_p[i] = capture_p->begin_p;\n            capture_p->begin_p = NULL;\n          }\n\n          group_p->iterator++;\n          const lit_utf8_byte_t *const saved_begin_p = group_p->begin_p;\n          group_p->begin_p = str_curr_p;\n\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, group_p->bc_p, str_curr_p);\n\n          if (matched_p != NULL)\n          {\n            return matched_p;\n          }\n\n          /* Failed to iterate again, backtrack to current match, and try to run tail bytecode. */\n          for (uint32_t i = 0; i < group_p->subcapture_count; ++i)\n          {\n            ecma_regexp_capture_t *const capture_p = re_ctx_p->captures_p + group_p->subcapture_start + i;\n            capture_p->begin_p = saved_captures_p[i];\n          }\n\n          group_p->iterator--;\n          group_p->begin_p = saved_begin_p;\n        }\n\n        const lit_utf8_byte_t *const tail_match_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n        if (tail_match_p != NULL)\n        {\n          return tail_match_p;\n        }\n\n        goto fail;\n      }\n      case RE_OP_LAZY_CAPTURING_GROUP_END:\n      {\n        const uint32_t group_idx = re_get_value (&bc_p);\n        ecma_regexp_capture_t *const group_p = re_ctx_p->captures_p + group_idx;\n        const uint32_t qmin = re_get_value (&bc_p);\n\n        if (group_p->iterator < qmin)\n        {\n          /* No need to save begin_p but we have to clear nested capturing groups. */\n          group_p->begin_p = str_curr_p;\n          for (uint32_t i = 1; i < group_p->subcapture_count; ++i)\n          {\n            group_p[i].begin_p = NULL;\n          }\n\n          group_p->iterator++;\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, group_p->bc_p, str_curr_p);\n\n          if (matched_p != NULL)\n          {\n            return matched_p;\n          }\n\n          group_p->iterator--;\n          goto fail;\n        }\n\n        /* Empty matches are not allowed after reaching the minimum number of iterations. */\n        if (JERRY_UNLIKELY (group_p->begin_p >= str_curr_p) && (group_p->iterator > qmin))\n        {\n          goto fail;\n        }\n\n        const uint32_t qmax = re_get_value (&bc_p) - RE_QMAX_OFFSET;\n        group_p->end_p = str_curr_p;\n\n        /* Try to match tail bytecode. */\n        const lit_utf8_byte_t *const tail_match_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n        if (tail_match_p != NULL)\n        {\n          return tail_match_p;\n        }\n\n        if (JERRY_UNLIKELY (group_p->iterator >= qmax))\n        {\n          /* Reached maximum number of iterations and tail bytecode did not match. */\n          goto fail;\n        }\n\n        {\n          /* Save and clear all nested capturing groups, and try to iterate. */\n          JERRY_VLA (const lit_utf8_byte_t *, saved_captures_p, group_p->subcapture_count);\n          for (uint32_t i = 0; i < group_p->subcapture_count; ++i)\n          {\n            saved_captures_p[i] = group_p[i].begin_p;\n            group_p[i].begin_p = NULL;\n          }\n\n          group_p->iterator++;\n          group_p->begin_p = str_curr_p;\n\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, group_p->bc_p, str_curr_p);\n\n          if (matched_p != NULL)\n          {\n            return matched_p;\n          }\n\n          /* Backtrack to current match. */\n          for (uint32_t i = 0; i < group_p->subcapture_count; ++i)\n          {\n            group_p[i].begin_p = saved_captures_p[i];\n          }\n\n          group_p->iterator--;\n        }\n\n        goto fail;\n      }\n      case RE_OP_LAZY_NON_CAPTURING_GROUP_END:\n      {\n        const uint32_t group_idx = re_get_value (&bc_p);\n        ecma_regexp_non_capture_t *const group_p = re_ctx_p->non_captures_p + group_idx;\n        const uint32_t qmin = re_get_value (&bc_p);\n\n        if (group_p->iterator < qmin)\n        {\n          /* Clear nested captures. */\n          ecma_regexp_capture_t *const capture_p = re_ctx_p->captures_p + group_p->subcapture_start;\n          for (uint32_t i = 0; i < group_p->subcapture_count; ++i)\n          {\n            capture_p[i].begin_p = NULL;\n          }\n\n          group_p->iterator++;\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, group_p->bc_p, str_curr_p);\n\n          if (matched_p != NULL)\n          {\n            return matched_p;\n          }\n\n          group_p->iterator--;\n          goto fail;\n        }\n\n        /* Empty matches are not allowed after reaching the minimum number of iterations. */\n        if (JERRY_UNLIKELY (group_p->begin_p >= str_curr_p) && (group_p->iterator > qmin))\n        {\n          goto fail;\n        }\n\n        const uint32_t qmax = re_get_value (&bc_p) - RE_QMAX_OFFSET;\n\n        /* Try to match tail bytecode. */\n        const lit_utf8_byte_t *const tail_match_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n        if (tail_match_p != NULL)\n        {\n          return tail_match_p;\n        }\n\n        if (JERRY_UNLIKELY (group_p->iterator >= qmax))\n        {\n          /* Reached maximum number of iterations and tail bytecode did not match. */\n          goto fail;\n        }\n\n        {\n          /* Save and clear all nested capturing groups, and try to iterate. */\n          JERRY_VLA (const lit_utf8_byte_t *, saved_captures_p, group_p->subcapture_count);\n          for (uint32_t i = 0; i < group_p->subcapture_count; ++i)\n          {\n            ecma_regexp_capture_t *const capture_p = re_ctx_p->captures_p + group_p->subcapture_start + i;\n            saved_captures_p[i] = capture_p->begin_p;\n            capture_p->begin_p = NULL;\n          }\n\n          group_p->iterator++;\n          const lit_utf8_byte_t *const saved_begin_p = group_p->begin_p;\n          group_p->begin_p = str_curr_p;\n\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, group_p->bc_p, str_curr_p);\n\n          if (matched_p != NULL)\n          {\n            return matched_p;\n          }\n\n          /* Backtrack to current match. */\n          for (uint32_t i = 0; i < group_p->subcapture_count; ++i)\n          {\n            ecma_regexp_capture_t *const capture_p = re_ctx_p->captures_p + group_p->subcapture_start + i;\n            capture_p->begin_p = saved_captures_p[i];\n          }\n\n          group_p->iterator--;\n          group_p->begin_p = saved_begin_p;\n        }\n\n        goto fail;\n      }\n      case RE_OP_GREEDY_ITERATOR:\n      {\n        const uint32_t qmin = re_get_value (&bc_p);\n        const uint32_t qmax = re_get_value (&bc_p) - RE_QMAX_OFFSET;\n        const uint32_t end_offset = re_get_value (&bc_p);\n\n        uint32_t iterator = 0;\n        while (iterator < qmin)\n        {\n          str_curr_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n          if (str_curr_p == NULL)\n          {\n            goto fail;\n          }\n\n          if (ECMA_RE_STACK_LIMIT_REACHED (str_curr_p))\n          {\n            return str_curr_p;\n          }\n\n          iterator++;\n        }\n\n        while (iterator < qmax)\n        {\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n          if (matched_p == NULL)\n          {\n            break;\n          }\n\n          if (ECMA_RE_STACK_LIMIT_REACHED (str_curr_p))\n          {\n            return str_curr_p;\n          }\n\n          str_curr_p = matched_p;\n          iterator++;\n        }\n\n        const uint8_t *const tail_bc_p = bc_p + end_offset;\n        while (true)\n        {\n          const lit_utf8_byte_t *const tail_match_p = ecma_regexp_run (re_ctx_p, tail_bc_p, str_curr_p);\n\n          if (tail_match_p != NULL)\n          {\n            return tail_match_p;\n          }\n\n          if (JERRY_UNLIKELY (iterator <= qmin))\n          {\n            goto fail;\n          }\n\n          iterator--;\n          JERRY_ASSERT (str_curr_p > re_ctx_p->input_start_p);\n          str_curr_p = ecma_regexp_step_back (re_ctx_p, str_curr_p);\n        }\n\n        JERRY_UNREACHABLE ();\n      }\n      case RE_OP_LAZY_ITERATOR:\n      {\n        const uint32_t qmin = re_get_value (&bc_p);\n        const uint32_t qmax = re_get_value (&bc_p) - RE_QMAX_OFFSET;\n        const uint32_t end_offset = re_get_value (&bc_p);\n\n        uint32_t iterator = 0;\n        while (iterator < qmin)\n        {\n          str_curr_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n          if (str_curr_p == NULL)\n          {\n            goto fail;\n          }\n\n          if (ECMA_RE_STACK_LIMIT_REACHED (str_curr_p))\n          {\n            return str_curr_p;\n          }\n\n          iterator++;\n        }\n\n        const uint8_t *const tail_bc_p = bc_p + end_offset;\n        while (true)\n        {\n          const lit_utf8_byte_t *const tail_match_p = ecma_regexp_run (re_ctx_p, tail_bc_p, str_curr_p);\n\n          if (tail_match_p != NULL)\n          {\n            return tail_match_p;\n          }\n\n          if (JERRY_UNLIKELY (iterator >= qmax))\n          {\n            goto fail;\n          }\n\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n          if (matched_p == NULL)\n          {\n            goto fail;\n          }\n\n          if (ECMA_RE_STACK_LIMIT_REACHED (matched_p))\n          {\n            return matched_p;\n          }\n\n          iterator++;\n          str_curr_p = matched_p;\n        }\n\n        JERRY_UNREACHABLE ();\n      }\n      case RE_OP_BACKREFERENCE:\n      {\n        const uint32_t backref_idx = re_get_value (&bc_p);\n        JERRY_ASSERT (backref_idx >= 1 && backref_idx < re_ctx_p->captures_count);\n        const ecma_regexp_capture_t *capture_p = re_ctx_p->captures_p + backref_idx;\n\n        if (!ECMA_RE_IS_CAPTURE_DEFINED (capture_p) || capture_p->end_p <= capture_p->begin_p)\n        {\n          /* Undefined or zero length captures always match. */\n          continue;\n        }\n\n        const lit_utf8_size_t capture_size = (lit_utf8_size_t) (capture_p->end_p - capture_p->begin_p);\n\n        if (str_curr_p + capture_size > re_ctx_p->input_end_p || memcmp (str_curr_p, capture_p->begin_p, capture_size))\n        {\n          goto fail;\n        }\n\n        str_curr_p += capture_size;\n        continue;\n      }\n      case RE_OP_ASSERT_LINE_START:\n      {\n        if (str_curr_p <= re_ctx_p->input_start_p)\n        {\n          continue;\n        }\n\n        if (!(re_ctx_p->flags & RE_FLAG_MULTILINE) || !lit_char_is_line_terminator (lit_cesu8_peek_prev (str_curr_p)))\n        {\n          goto fail;\n        }\n\n        continue;\n      }\n      case RE_OP_ASSERT_LINE_END:\n      {\n        if (str_curr_p >= re_ctx_p->input_end_p)\n        {\n          continue;\n        }\n\n        if (!(re_ctx_p->flags & RE_FLAG_MULTILINE) || !lit_char_is_line_terminator (lit_cesu8_peek_next (str_curr_p)))\n        {\n          goto fail;\n        }\n\n        continue;\n      }\n      case RE_OP_ASSERT_WORD_BOUNDARY:\n      {\n        if (!ecma_regexp_is_word_boundary (re_ctx_p, str_curr_p))\n        {\n          goto fail;\n        }\n\n        continue;\n      }\n      case RE_OP_ASSERT_NOT_WORD_BOUNDARY:\n      {\n        if (ecma_regexp_is_word_boundary (re_ctx_p, str_curr_p))\n        {\n          goto fail;\n        }\n\n        continue;\n      }\n      case RE_OP_ASSERT_LOOKAHEAD_POS:\n      {\n        const uint8_t qmin = re_get_byte (&bc_p);\n        const uint32_t capture_start = re_get_value (&bc_p);\n        const uint32_t capture_count = re_get_value (&bc_p);\n        const uint32_t end_offset = re_get_value (&bc_p);\n\n        /* If qmin is zero, the assertion implicitly matches. */\n        if (qmin == 0)\n        {\n          bc_p += end_offset;\n          continue;\n        }\n\n        /* Capture end pointers might get clobbered and need to be restored after a tail match fail. */\n        JERRY_VLA (const lit_utf8_byte_t *, saved_captures_p, capture_count);\n        for (uint32_t i = 0; i < capture_count; ++i)\n        {\n          ecma_regexp_capture_t *const capture_p = re_ctx_p->captures_p + capture_start + i;\n          saved_captures_p[i] = capture_p->end_p;\n        }\n\n        /* The first iteration will decide whether the assertion matches depending on whether\n         * the iteration matched or not. */\n        const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n        if (ECMA_RE_STACK_LIMIT_REACHED (matched_p))\n        {\n          return matched_p;\n        }\n\n        if (matched_p == NULL)\n        {\n          goto fail;\n        }\n\n        const lit_utf8_byte_t *tail_match_p = ecma_regexp_run (re_ctx_p, bc_p + end_offset, str_curr_p);\n\n        if (tail_match_p == NULL)\n        {\n          for (uint32_t i = 0; i < capture_count; ++i)\n          {\n            ecma_regexp_capture_t *const capture_p = re_ctx_p->captures_p + capture_start + i;\n            capture_p->begin_p = NULL;\n            capture_p->end_p = saved_captures_p[i];\n          }\n\n          goto fail;\n        }\n\n        return tail_match_p;\n      }\n      case RE_OP_ASSERT_LOOKAHEAD_NEG:\n      {\n        const uint8_t qmin = re_get_byte (&bc_p);\n        uint32_t capture_idx = re_get_value (&bc_p);\n        const uint32_t capture_count = re_get_value (&bc_p);\n        const uint32_t end_offset = re_get_value (&bc_p);\n\n        /* If qmin is zero, the assertion implicitly matches. */\n        if (qmin > 0)\n        {\n          /* The first iteration will decide whether the assertion matches depending on whether\n           * the iteration matched or not. */\n          const lit_utf8_byte_t *const matched_p = ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n\n          if (ECMA_RE_STACK_LIMIT_REACHED (matched_p))\n          {\n            return matched_p;\n          }\n\n          if (matched_p != NULL)\n          {\n            /* Nested capturing groups inside a negative lookahead can never capture, so we clear their results. */\n            const uint32_t capture_end = capture_idx + capture_count;\n            while (capture_idx < capture_end)\n            {\n              re_ctx_p->captures_p[capture_idx++].begin_p = NULL;\n            }\n\n            goto fail;\n          }\n        }\n\n        bc_p += end_offset;\n        continue;\n      }\n      case RE_OP_CLASS_ESCAPE:\n      {\n        if (str_curr_p >= re_ctx_p->input_end_p)\n        {\n          goto fail;\n        }\n\n        const lit_code_point_t cp = ecma_regexp_advance (re_ctx_p, &str_curr_p);\n\n        const ecma_class_escape_t escape = (ecma_class_escape_t) re_get_byte (&bc_p);\n        if (!ecma_regexp_check_class_escape (cp, escape))\n        {\n          goto fail;\n        }\n\n        continue;\n      }\n      case RE_OP_CHAR_CLASS:\n      {\n        if (str_curr_p >= re_ctx_p->input_end_p)\n        {\n          goto fail;\n        }\n\n        uint8_t flags = re_get_byte (&bc_p);\n        uint32_t char_count = (flags & RE_CLASS_HAS_CHARS) ? re_get_value (&bc_p) : 0;\n        uint32_t range_count = (flags & RE_CLASS_HAS_RANGES) ? re_get_value (&bc_p) : 0;\n\n        const lit_code_point_t cp = ecma_regexp_advance (re_ctx_p, &str_curr_p);\n\n        uint8_t escape_count = flags & RE_CLASS_ESCAPE_COUNT_MASK;\n        while (escape_count > 0)\n        {\n          escape_count--;\n          const ecma_class_escape_t escape = re_get_byte (&bc_p);\n          if (ecma_regexp_check_class_escape (cp, escape))\n          {\n            goto class_found;\n          }\n        }\n\n        while (char_count > 0)\n        {\n          char_count--;\n          const lit_code_point_t curr = re_get_char (&bc_p, re_ctx_p->flags & RE_FLAG_UNICODE);\n          if (cp == curr)\n          {\n            goto class_found;\n          }\n        }\n\n        while (range_count > 0)\n        {\n          range_count--;\n          const lit_code_point_t begin = re_get_char (&bc_p, re_ctx_p->flags & RE_FLAG_UNICODE);\n\n          if (cp < begin)\n          {\n            bc_p += re_ctx_p->char_size;\n            continue;\n          }\n\n          const lit_code_point_t end = re_get_char (&bc_p, re_ctx_p->flags & RE_FLAG_UNICODE);\n          if (cp <= end)\n          {\n            goto class_found;\n          }\n        }\n\n        /* Not found */\n        if (flags & RE_CLASS_INVERT)\n        {\n          continue;\n        }\n\n        goto fail;\n\nclass_found:\n        if (flags & RE_CLASS_INVERT)\n        {\n          goto fail;\n        }\n\n        const uint32_t chars_size = char_count * re_ctx_p->char_size;\n        const uint32_t ranges_size = range_count * re_ctx_p->char_size * 2;\n        bc_p = bc_p + escape_count + chars_size + ranges_size;\n        continue;\n      }\n      case RE_OP_UNICODE_PERIOD:\n      {\n        if (str_curr_p >= re_ctx_p->input_end_p)\n        {\n          goto fail;\n        }\n\n        const lit_code_point_t cp = ecma_regexp_unicode_advance (&str_curr_p, re_ctx_p->input_end_p);\n\n        if (!(re_ctx_p->flags & RE_FLAG_DOTALL)\n            && JERRY_UNLIKELY (cp <= LIT_UTF16_CODE_UNIT_MAX && lit_char_is_line_terminator ((ecma_char_t) cp)))\n        {\n          goto fail;\n        }\n\n        continue;\n      }\n      case RE_OP_PERIOD:\n      {\n        if (str_curr_p >= re_ctx_p->input_end_p)\n        {\n          goto fail;\n        }\n\n        const ecma_char_t ch = lit_cesu8_read_next (&str_curr_p);\n\n        if (!(re_ctx_p->flags & RE_FLAG_DOTALL) && lit_char_is_line_terminator (ch))\n        {\n          goto fail;\n        }\n\n        continue;\n      }\n      case RE_OP_CHAR:\n      {\n        if (str_curr_p >= re_ctx_p->input_end_p)\n        {\n          goto fail;\n        }\n\n        const lit_code_point_t ch1 = re_get_char (&bc_p, re_ctx_p->flags & RE_FLAG_UNICODE);\n        const lit_code_point_t ch2 = ecma_regexp_advance (re_ctx_p, &str_curr_p);\n\n        if (ch1 != ch2)\n        {\n          goto fail;\n        }\n\n        continue;\n      }\n      default:\n      {\n        JERRY_ASSERT (op == RE_OP_BYTE);\n\n        if (str_curr_p >= re_ctx_p->input_end_p || *bc_p++ != *str_curr_p++)\n        {\n          goto fail;\n        }\n\n        continue;\n      }\n    }\n\n    JERRY_UNREACHABLE ();\nfail:\n    bc_p = next_alternative_p;\n\n    if (bc_p == NULL || *bc_p++ != RE_OP_ALTERNATIVE_NEXT)\n    {\n      /* None of the alternatives matched. */\n      return NULL;\n    }\n\n    /* Get the end of the new alternative and continue execution. */\n    str_curr_p = str_start_p;\n    const uint32_t offset = re_get_value (&bc_p);\n    next_alternative_p = bc_p + offset;\n  }\n} /* ecma_regexp_run */\n\n/**\n * Match a RegExp at a specific position in the input string.\n *\n * @return pointer to the end of the matched sub-string\n *         NULL, if pattern did not match\n */\nstatic const lit_utf8_byte_t *\necma_regexp_match (ecma_regexp_ctx_t *re_ctx_p, /**< RegExp matcher context */\n                   const uint8_t *bc_p, /**< pointer to the current RegExp bytecode */\n                   const lit_utf8_byte_t *str_curr_p) /**< input string pointer */\n{\n  re_ctx_p->captures_p[RE_GLOBAL_CAPTURE].begin_p = str_curr_p;\n\n  for (uint32_t i = 1; i < re_ctx_p->captures_count; ++i)\n  {\n    re_ctx_p->captures_p[i].begin_p = NULL;\n  }\n\n  return ecma_regexp_run (re_ctx_p, bc_p, str_curr_p);\n} /* ecma_regexp_match */\n\n/*\n * Helper function to get the result of a capture\n *\n * @return string value, if capture is defined\n *         undefined, otherwise\n */\necma_value_t\necma_regexp_get_capture_value (const ecma_regexp_capture_t *const capture_p) /**< capture */\n{\n  if (ECMA_RE_IS_CAPTURE_DEFINED (capture_p))\n  {\n    JERRY_ASSERT (capture_p->end_p >= capture_p->begin_p);\n    const lit_utf8_size_t capture_size = (lit_utf8_size_t) (capture_p->end_p - capture_p->begin_p);\n    ecma_string_t *const capture_str_p = ecma_new_ecma_string_from_utf8 (capture_p->begin_p, capture_size);\n    return ecma_make_string_value (capture_str_p);\n  }\n\n  return ECMA_VALUE_UNDEFINED;\n} /* ecma_regexp_get_capture_value */\n\n/**\n * Helper function to create a result array from the captures in a regexp context\n *\n * @return ecma value containing the created array object\n */\nstatic ecma_value_t\necma_regexp_create_result_object (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */\n                                  ecma_string_t *input_string_p, /**< input ecma string */\n                                  uint32_t index) /**< match index */\n{\n  ecma_object_t *result_p = ecma_op_new_array_object (0);\n\n  for (uint32_t i = 0; i < re_ctx_p->captures_count; i++)\n  {\n    ecma_value_t capture_value = ecma_regexp_get_capture_value (re_ctx_p->captures_p + i);\n    ecma_builtin_helper_def_prop_by_index (result_p, i, capture_value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n    ecma_free_value (capture_value);\n  }\n\n  ecma_builtin_helper_def_prop (result_p,\n                                ecma_get_magic_string (LIT_MAGIC_STRING_INDEX),\n                                ecma_make_uint32_value (index),\n                                ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n\n  ecma_builtin_helper_def_prop (result_p,\n                                ecma_get_magic_string (LIT_MAGIC_STRING_INPUT),\n                                ecma_make_string_value (input_string_p),\n                                ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n\n  return ecma_make_object_value (result_p);\n} /* ecma_regexp_create_result_object */\n\n/**\n * Helper function to initialize a regexp match context\n */\nstatic void\necma_regexp_initialize_context (ecma_regexp_ctx_t *ctx_p, /**< regexp context */\n                                const re_compiled_code_t *bc_p, /**< regexp bytecode */\n                                const lit_utf8_byte_t *input_start_p, /**< pointer to input string */\n                                const lit_utf8_byte_t *input_end_p) /**< pointer to end of input string */\n{\n  JERRY_ASSERT (ctx_p != NULL);\n  JERRY_ASSERT (bc_p != NULL);\n  JERRY_ASSERT (input_start_p != NULL);\n  JERRY_ASSERT (input_end_p >= input_start_p);\n\n  ctx_p->flags = bc_p->header.status_flags;\n  ctx_p->char_size = (ctx_p->flags & RE_FLAG_UNICODE) ? sizeof (lit_code_point_t) : sizeof (ecma_char_t);\n\n  ctx_p->input_start_p = input_start_p;\n  ctx_p->input_end_p = input_end_p;\n\n  ctx_p->captures_count = bc_p->captures_count;\n  ctx_p->non_captures_count = bc_p->non_captures_count;\n\n  ctx_p->captures_p = jmem_heap_alloc_block (ctx_p->captures_count * sizeof (ecma_regexp_capture_t));\n\n  if (ctx_p->non_captures_count > 0)\n  {\n    ctx_p->non_captures_p = jmem_heap_alloc_block (ctx_p->non_captures_count * sizeof (ecma_regexp_non_capture_t));\n  }\n} /* ecma_regexp_initialize_context */\n\n/**\n * Helper function to clean up a regexp context\n */\nstatic void\necma_regexp_cleanup_context (ecma_regexp_ctx_t *ctx_p) /**< regexp context */\n{\n  JERRY_ASSERT (ctx_p != NULL);\n  jmem_heap_free_block (ctx_p->captures_p, ctx_p->captures_count * sizeof (ecma_regexp_capture_t));\n\n  if (ctx_p->non_captures_count > 0)\n  {\n    jmem_heap_free_block (ctx_p->non_captures_p, ctx_p->non_captures_count * sizeof (ecma_regexp_non_capture_t));\n  }\n} /* ecma_regexp_cleanup_context */\n\n/**\n * RegExp helper function to start the recursive matching algorithm\n * and create the result Array object\n *\n * See also:\n *          ECMA-262 v5, 15.10.6.2\n *          ECMA-262 v11, 21.2.5.2.2\n *\n * @return array object - if matched\n *         null         - otherwise\n *\n *         May raise error.\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */\n                         ecma_string_t *input_string_p) /**< input string */\n{\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  /* 1. */\n  JERRY_ASSERT (ecma_object_is_regexp_object (ecma_make_object_value (regexp_object_p)));\n\n  /* 9. */\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) regexp_object_p;\n  re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, ext_object_p->u.cls.u3.value);\n\n  /* 3. */\n  lit_utf8_size_t input_size;\n  lit_utf8_size_t input_length;\n  uint8_t input_flags = ECMA_STRING_FLAG_IS_ASCII;\n  const lit_utf8_byte_t *input_buffer_p =\n    ecma_string_get_chars (input_string_p, &input_size, &input_length, NULL, &input_flags);\n\n  const lit_utf8_byte_t *input_curr_p = input_buffer_p;\n  const lit_utf8_byte_t *input_end_p = input_buffer_p + input_size;\n\n  ecma_regexp_ctx_t re_ctx;\n  ecma_regexp_initialize_context (&re_ctx, bc_p, input_buffer_p, input_end_p);\n\n  /* 4. */\n  ecma_length_t index = 0;\n  ecma_value_t lastindex_value = ecma_op_object_get_by_magic_id (regexp_object_p, LIT_MAGIC_STRING_LASTINDEX_UL);\n\n  ret_value = ecma_op_to_length (lastindex_value, &index);\n  ecma_free_value (lastindex_value);\n\n  if (ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    goto cleanup_context;\n  }\n\n  if (re_ctx.flags & (RE_FLAG_GLOBAL | RE_FLAG_STICKY))\n  {\n    /* 12.a */\n    if (index > input_length)\n    {\n      goto fail_put_lastindex;\n    }\n\n    if (index > 0)\n    {\n      if (input_flags & ECMA_STRING_FLAG_IS_ASCII)\n      {\n        input_curr_p += index;\n      }\n      else\n      {\n        for (uint32_t i = 0; i < index; i++)\n        {\n          lit_utf8_incr (&input_curr_p);\n        }\n      }\n    }\n  }\n  /* 8. */\n  else\n  {\n    index = 0;\n  }\n\n  /* 9. */\n  uint8_t *bc_start_p = (uint8_t *) (bc_p + 1);\n\n  /* 11. */\n  const lit_utf8_byte_t *matched_p = NULL;\n\n  /* 12. */\n  JERRY_ASSERT (index <= input_length);\n  while (true)\n  {\n    matched_p = ecma_regexp_match (&re_ctx, bc_start_p, input_curr_p);\n\n    if (matched_p != NULL)\n    {\n      goto match_found;\n    }\n\n    /* 12.c.i */\n    if (re_ctx.flags & RE_FLAG_STICKY)\n    {\n      goto fail_put_lastindex;\n    }\n\n    /* 12.a */\n    if (input_curr_p >= input_end_p)\n    {\n      if (re_ctx.flags & RE_FLAG_GLOBAL)\n      {\n        goto fail_put_lastindex;\n      }\n\n      goto match_failed;\n    }\n\n    JERRY_ASSERT (input_curr_p < input_end_p);\n\n    /* 12.c.ii */\n    index++;\n\n    if (re_ctx.flags & RE_FLAG_UNICODE)\n    {\n      const lit_code_point_t cp = ecma_regexp_unicode_advance (&input_curr_p, input_end_p);\n\n      if (cp > LIT_UTF16_CODE_UNIT_MAX)\n      {\n        index++;\n      }\n\n      continue;\n    }\n\n    lit_utf8_incr (&input_curr_p);\n  }\n\n  JERRY_UNREACHABLE ();\n\nfail_put_lastindex:\n  /* We should only get here if the regexp is global or sticky */\n  JERRY_ASSERT ((re_ctx.flags & (RE_FLAG_GLOBAL | RE_FLAG_STICKY)) != 0);\n\n  ret_value = ecma_op_object_put (regexp_object_p,\n                                  ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),\n                                  ecma_make_integer_value (0),\n                                  true);\n\n  if (ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    goto cleanup_context;\n  }\n\n  JERRY_ASSERT (ecma_is_value_boolean (ret_value));\n\nmatch_failed:\n  /* 12.a.ii */\n  ret_value = ECMA_VALUE_NULL;\n  goto cleanup_context;\n\nmatch_found:\n  JERRY_ASSERT (matched_p != NULL);\n\n  if (ECMA_RE_STACK_LIMIT_REACHED (matched_p))\n  {\n    ret_value = ecma_raise_range_error (ECMA_ERR_STACK_LIMIT_EXCEEDED);\n    goto cleanup_context;\n  }\n\n  JERRY_ASSERT (index <= input_length);\n\n  /* 15. */\n  if (re_ctx.flags & (RE_FLAG_GLOBAL | RE_FLAG_STICKY))\n  {\n    /* 13-14. */\n    lit_utf8_size_t match_length;\n    const lit_utf8_byte_t *match_begin_p = re_ctx.captures_p[0].begin_p;\n    const lit_utf8_byte_t *match_end_p = re_ctx.captures_p[0].end_p;\n\n    if (input_flags & ECMA_STRING_FLAG_IS_ASCII)\n    {\n      match_length = (lit_utf8_size_t) (match_end_p - match_begin_p);\n    }\n    else\n    {\n      match_length = lit_utf8_string_length (match_begin_p, (lit_utf8_size_t) (match_end_p - match_begin_p));\n    }\n\n    ret_value = ecma_op_object_put (regexp_object_p,\n                                    ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),\n                                    ecma_make_uint32_value ((uint32_t) index + match_length),\n                                    true);\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      goto cleanup_context;\n    }\n\n    JERRY_ASSERT (ecma_is_value_boolean (ret_value));\n  }\n\n  /* 16-27. */\n  ret_value = ecma_regexp_create_result_object (&re_ctx, input_string_p, (uint32_t) index);\n\ncleanup_context:\n  ecma_regexp_cleanup_context (&re_ctx);\n\n  if (input_flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n  {\n    jmem_heap_free_block ((void *) input_buffer_p, input_size);\n  }\n\n  return ret_value;\n} /* ecma_regexp_exec_helper */\n\n/**\n * Helper function for converting a RegExp pattern parameter to string.\n *\n * See also:\n *         RegExp.compile\n *         RegExp dispatch call\n *\n * @return empty value if success, error value otherwise\n *         Returned value must be freed with ecma_free_value.\n */\necma_string_t *\necma_regexp_read_pattern_str_helper (ecma_value_t pattern_arg) /**< the RegExp pattern */\n{\n  if (!ecma_is_value_undefined (pattern_arg))\n  {\n    ecma_string_t *pattern_string_p = ecma_op_to_string (pattern_arg);\n    if (JERRY_UNLIKELY (pattern_string_p == NULL) || !ecma_string_is_empty (pattern_string_p))\n    {\n      return pattern_string_p;\n    }\n  }\n\n  return ecma_get_magic_string (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP);\n} /* ecma_regexp_read_pattern_str_helper */\n\n/**\n * Helper function for RegExp based string searches\n *\n * See also:\n *          ECMA-262 v6, 21.2.5.9\n *\n * @return index of the match\n */\necma_value_t\necma_regexp_search_helper (ecma_value_t regexp_arg, /**< regexp argument */\n                           ecma_value_t string_arg) /**< string argument */\n{\n  /* 2. */\n  if (!ecma_is_value_object (regexp_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_value_t result = ECMA_VALUE_ERROR;\n\n  /* 3. */\n  ecma_string_t *const string_p = ecma_op_to_string (string_arg);\n  if (string_p == NULL)\n  {\n    return result;\n  }\n\n  ecma_object_t *const regexp_object_p = ecma_get_object_from_value (regexp_arg);\n\n  /* 4. */\n  ecma_string_t *const last_index_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL);\n  const ecma_value_t prev_last_index = ecma_op_object_get (regexp_object_p, last_index_str_p);\n  if (ECMA_IS_VALUE_ERROR (prev_last_index))\n  {\n    goto cleanup_string;\n  }\n\n  /* 5. */\n  if (prev_last_index != ecma_make_uint32_value (0))\n  {\n    const ecma_value_t status =\n      ecma_op_object_put (regexp_object_p, last_index_str_p, ecma_make_uint32_value (0), true);\n\n    if (ECMA_IS_VALUE_ERROR (status))\n    {\n      goto cleanup_prev_last_index;\n    }\n\n    JERRY_ASSERT (ecma_is_value_boolean (status));\n  }\n\n  /* 6. */\n  const ecma_value_t match = ecma_op_regexp_exec (regexp_arg, string_p);\n  if (ECMA_IS_VALUE_ERROR (match))\n  {\n    goto cleanup_prev_last_index;\n  }\n\n  /* 7. */\n  const ecma_value_t current_last_index = ecma_op_object_get (regexp_object_p, last_index_str_p);\n  if (ECMA_IS_VALUE_ERROR (current_last_index))\n  {\n    ecma_free_value (match);\n    goto cleanup_prev_last_index;\n  }\n\n  const bool same_value = ecma_op_same_value (prev_last_index, current_last_index);\n\n  ecma_free_value (current_last_index);\n\n  /* 8. */\n  if (!same_value)\n  {\n    result = ecma_op_object_put (regexp_object_p, last_index_str_p, prev_last_index, true);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      ecma_free_value (match);\n      goto cleanup_prev_last_index;\n    }\n\n    JERRY_ASSERT (ecma_is_value_boolean (result));\n  }\n\n  /* 9-10. */\n  if (ecma_is_value_null (match))\n  {\n    result = ecma_make_int32_value (-1);\n  }\n  else\n  {\n    ecma_object_t *const match_p = ecma_get_object_from_value (match);\n    result = ecma_op_object_get_by_magic_id (match_p, LIT_MAGIC_STRING_INDEX);\n    ecma_deref_object (match_p);\n  }\n\ncleanup_prev_last_index:\n  ecma_free_value (prev_last_index);\n\ncleanup_string:\n  ecma_deref_ecma_string (string_p);\n  return result;\n} /* ecma_regexp_search_helper */\n\n/**\n * Helper function for RegExp based string split operation\n *\n * See also:\n *          ECMA-262 v6, 21.2.5.11\n *\n * @return array of split and captured strings\n */\necma_value_t\necma_regexp_split_helper (ecma_value_t this_arg, /**< this value */\n                          ecma_value_t string_arg, /**< string value */\n                          ecma_value_t limit_arg) /**< limit value */\n{\n  /* 2. */\n  if (!ecma_is_value_object (this_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_value_t result = ECMA_VALUE_ERROR;\n\n  /* 3-4. */\n  ecma_string_t *const string_p = ecma_op_to_string (string_arg);\n  if (string_p == NULL)\n  {\n    return result;\n  }\n\n  /* 5-6. */\n  ecma_object_t *const regexp_obj_p = ecma_get_object_from_value (this_arg);\n  ecma_value_t constructor = ecma_op_species_constructor (regexp_obj_p, ECMA_BUILTIN_ID_REGEXP);\n  if (ECMA_IS_VALUE_ERROR (constructor))\n  {\n    goto cleanup_string;\n  }\n\n  ecma_object_t *const constructor_obj_p = ecma_get_object_from_value (constructor);\n\n  /* 7-8. */\n  ecma_value_t flags = ecma_op_object_get_by_magic_id (regexp_obj_p, LIT_MAGIC_STRING_FLAGS);\n  if (ECMA_IS_VALUE_ERROR (flags))\n  {\n    ecma_deref_object (constructor_obj_p);\n    goto cleanup_string;\n  }\n\n  ecma_string_t *flags_str_p = ecma_op_to_string (flags);\n  ecma_free_value (flags);\n\n  if (JERRY_UNLIKELY (flags_str_p == NULL))\n  {\n    ecma_deref_object (constructor_obj_p);\n    goto cleanup_string;\n  }\n\n  lit_utf8_size_t flags_size;\n  uint8_t flags_str_flags = ECMA_STRING_FLAG_IS_ASCII;\n  const lit_utf8_byte_t *flags_buffer_p =\n    ecma_string_get_chars (flags_str_p, &flags_size, NULL, NULL, &flags_str_flags);\n\n  bool unicode = false;\n  bool sticky = false;\n\n  /* 9-11. */\n  const lit_utf8_byte_t *const flags_end_p = flags_buffer_p + flags_size;\n  for (const lit_utf8_byte_t *current_p = flags_buffer_p; current_p < flags_end_p; ++current_p)\n  {\n    switch (*current_p)\n    {\n      case LIT_CHAR_LOWERCASE_U:\n      {\n        unicode = true;\n        break;\n      }\n      case LIT_CHAR_LOWERCASE_Y:\n      {\n        sticky = true;\n        break;\n      }\n    }\n  }\n\n  if (flags_str_flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n  {\n    jmem_heap_free_block ((void *) flags_buffer_p, flags_size);\n  }\n\n  /* 12. */\n  if (!sticky)\n  {\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (flags_str_p);\n    ecma_stringbuilder_append_byte (&builder, LIT_CHAR_LOWERCASE_Y);\n\n    ecma_deref_ecma_string (flags_str_p);\n    flags_str_p = ecma_stringbuilder_finalize (&builder);\n  }\n\n  /* 13-14. */\n  ecma_value_t arguments[] = { this_arg, ecma_make_string_value (flags_str_p) };\n  ecma_value_t splitter = ecma_op_function_construct (constructor_obj_p, constructor_obj_p, arguments, 2);\n\n  ecma_deref_ecma_string (flags_str_p);\n  ecma_deref_object (constructor_obj_p);\n\n  if (ECMA_IS_VALUE_ERROR (splitter))\n  {\n    goto cleanup_string;\n  }\n\n  ecma_object_t *const splitter_obj_p = ecma_get_object_from_value (splitter);\n\n  /* 17. */\n  uint32_t limit = UINT32_MAX - 1;\n  if (!ecma_is_value_undefined (limit_arg))\n  {\n    /* ECMA-262 v11, 21.2.5.13 13 */\n    ecma_number_t num;\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (limit_arg, &num)))\n    {\n      goto cleanup_splitter;\n    }\n    limit = ecma_number_to_uint32 (num);\n  }\n\n  /* 15. */\n  ecma_object_t *const array_p = ecma_op_new_array_object (0);\n  ecma_value_t array = ecma_make_object_value (array_p);\n\n  /* 21. */\n  if (limit == 0)\n  {\n    result = array;\n    goto cleanup_splitter;\n  }\n\n  const lit_utf8_size_t string_length = ecma_string_get_length (string_p);\n\n  uint32_t array_length = 0;\n\n  /* 22. */\n  if (string_length == 0)\n  {\n    const ecma_value_t match = ecma_op_regexp_exec (splitter, string_p);\n\n    if (ECMA_IS_VALUE_ERROR (match))\n    {\n      goto cleanup_array;\n    }\n\n    if (ecma_is_value_null (match))\n    {\n      result = ecma_builtin_helper_def_prop_by_index (array_p,\n                                                      array_length,\n                                                      ecma_make_string_value (string_p),\n                                                      ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n      JERRY_ASSERT (ecma_is_value_true (result));\n    }\n\n    ecma_free_value (match);\n    result = array;\n    goto cleanup_splitter;\n  }\n\n  /* 23. */\n  ecma_length_t current_index = 0;\n  ecma_length_t previous_index = 0;\n\n  ecma_string_t *const lastindex_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL);\n\n  /* 24. */\n  while (current_index < string_length)\n  {\n    /* 24.a-b. */\n    ecma_value_t index_value = ecma_make_length_value (current_index);\n    result = ecma_op_object_put (splitter_obj_p, lastindex_str_p, index_value, true);\n\n    ecma_free_value (index_value);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_array;\n    }\n\n    JERRY_ASSERT (ecma_is_value_true (result));\n\n    /* 24.c-d. */\n    result = ecma_op_regexp_exec (splitter, string_p);\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_array;\n    }\n\n    /* 24.e. */\n    if (ecma_is_value_null (result))\n    {\n      current_index = ecma_op_advance_string_index (string_p, current_index, unicode);\n      continue;\n    }\n\n    ecma_object_t *const match_array_p = ecma_get_object_from_value (result);\n\n    /* 24.f.i. */\n    result = ecma_op_object_get (splitter_obj_p, lastindex_str_p);\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      ecma_deref_object (match_array_p);\n      goto cleanup_array;\n    }\n\n    ecma_length_t end_index;\n    const ecma_value_t length_value = ecma_op_to_length (result, &end_index);\n    ecma_free_value (result);\n\n    if (ECMA_IS_VALUE_ERROR (length_value))\n    {\n      result = ECMA_VALUE_ERROR;\n      ecma_deref_object (match_array_p);\n      goto cleanup_array;\n    }\n\n    /* ECMA-262 v11, 21.2.5.11 19.d.ii */\n    if (end_index > string_length)\n    {\n      end_index = string_length;\n    }\n\n    /* 24.f.iii. */\n    if (previous_index == end_index)\n    {\n      ecma_deref_object (match_array_p);\n      current_index = ecma_op_advance_string_index (string_p, current_index, unicode);\n      continue;\n    }\n\n    /* 24.f.iv.1-4. */\n    JERRY_ASSERT (previous_index <= string_length && current_index <= string_length);\n    ecma_string_t *const split_str_p =\n      ecma_string_substr (string_p, (lit_utf8_size_t) previous_index, (lit_utf8_size_t) current_index);\n\n    result = ecma_builtin_helper_def_prop_by_index (array_p,\n                                                    array_length++,\n                                                    ecma_make_string_value (split_str_p),\n                                                    ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n    JERRY_ASSERT (ecma_is_value_true (result));\n    ecma_deref_ecma_string (split_str_p);\n\n    /* 24.f.iv.5. */\n    if (array_length == limit)\n    {\n      ecma_deref_object (match_array_p);\n      result = array;\n      goto cleanup_splitter;\n    }\n\n    /* 24.f.iv.6. */\n    previous_index = end_index;\n\n    /* 24.f.iv.7-8. */\n    ecma_length_t match_length;\n    result = ecma_op_object_get_length (match_array_p, &match_length);\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      ecma_deref_object (match_array_p);\n      goto cleanup_array;\n    }\n\n    /* 24.f.iv.9. */\n    match_length = (match_length > 0) ? match_length - 1 : match_length;\n\n    ecma_length_t match_index = 1;\n    while (match_index <= match_length)\n    {\n      /* 24.f.iv.11.a-b. */\n      result = ecma_op_object_get_by_index (match_array_p, match_index++);\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        ecma_deref_object (match_array_p);\n        goto cleanup_array;\n      }\n\n      const ecma_value_t capture = result;\n\n      /* 24.f.iv.11.c. */\n      result = ecma_builtin_helper_def_prop_by_index (array_p,\n                                                      array_length++,\n                                                      capture,\n                                                      ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n      JERRY_ASSERT (ecma_is_value_true (result));\n\n      ecma_free_value (capture);\n\n      if (array_length == limit)\n      {\n        ecma_deref_object (match_array_p);\n        result = array;\n        goto cleanup_splitter;\n      }\n    }\n\n    /* 24.f.iv.12. */\n    JERRY_ASSERT (end_index <= UINT32_MAX);\n    current_index = (uint32_t) end_index;\n\n    ecma_deref_object (match_array_p);\n  }\n\n  JERRY_ASSERT (previous_index <= string_length);\n  ecma_string_t *const end_str_p = ecma_string_substr (string_p, (lit_utf8_size_t) previous_index, string_length);\n  result = ecma_builtin_helper_def_prop_by_index (array_p,\n                                                  array_length++,\n                                                  ecma_make_string_value (end_str_p),\n                                                  ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n  JERRY_ASSERT (ecma_is_value_true (result));\n  ecma_deref_ecma_string (end_str_p);\n\n  result = array;\n  goto cleanup_splitter;\n\ncleanup_array:\n  ecma_deref_object (array_p);\ncleanup_splitter:\n  ecma_deref_object (splitter_obj_p);\ncleanup_string:\n  ecma_deref_ecma_string (string_p);\n\n  return result;\n} /* ecma_regexp_split_helper */\n\n/**\n * Fast path for RegExp based replace operation\n *\n * This method assumes the following:\n *   - The RegExp object is a built-in RegExp\n *   - The 'exec' method of the RegExp object is the built-in 'exec' method\n *   - The 'lastIndex' property is writable\n *\n * The standard would normally require us to first execute the regexp and collect the results,\n * and after that iterate over the collected results and replace them.\n * The assumptions above guarantee that during the matching phase there will be no exceptions thrown,\n * which means we can do the match/replace in a single loop, without collecting the results.\n *\n * @return string value if successful\n *         thrown value otherwise\n */\nstatic ecma_value_t\necma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace context */\n                                 ecma_extended_object_t *re_obj_p, /**< regexp object */\n                                 ecma_string_t *string_p, /**< source string */\n                                 ecma_value_t replace_arg) /**< replace argument */\n{\n  const re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, re_obj_p->u.cls.u3.value);\n  ecma_bytecode_ref ((ecma_compiled_code_t *) bc_p);\n\n  JERRY_ASSERT (bc_p != NULL);\n\n  uint8_t string_flags = ECMA_STRING_FLAG_IS_ASCII;\n  lit_utf8_size_t string_length;\n  ctx_p->string_p = ecma_string_get_chars (string_p, &(ctx_p->string_size), &string_length, NULL, &string_flags);\n\n  const lit_utf8_byte_t *const string_end_p = ctx_p->string_p + ctx_p->string_size;\n  const uint8_t *const bc_start_p = (const uint8_t *) (bc_p + 1);\n  const lit_utf8_byte_t *matched_p = NULL;\n  const lit_utf8_byte_t *current_p = ctx_p->string_p;\n  const lit_utf8_byte_t *last_append_p = current_p;\n  ecma_length_t index;\n\n  ecma_regexp_ctx_t re_ctx;\n  ecma_regexp_initialize_context (&re_ctx, bc_p, ctx_p->string_p, string_end_p);\n\n  /* lastIndex must be accessed to remain consistent with the standard, even though we may not need the value. */\n  ecma_value_t lastindex_value =\n    ecma_op_object_get_by_magic_id ((ecma_object_t *) re_obj_p, LIT_MAGIC_STRING_LASTINDEX_UL);\n  ecma_value_t result = ecma_op_to_length (lastindex_value, &index);\n  ecma_free_value (lastindex_value);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    goto cleanup_context;\n  }\n\n  /* Only non-global sticky matches use the lastIndex value, otherwise the starting index is 0. */\n  if (JERRY_UNLIKELY ((ctx_p->flags & RE_FLAG_GLOBAL) == 0 && (re_ctx.flags & RE_FLAG_STICKY) != 0))\n  {\n    if (index > string_length)\n    {\n      result = ecma_op_object_put ((ecma_object_t *) re_obj_p,\n                                   ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),\n                                   ecma_make_uint32_value (0),\n                                   true);\n\n      if (!ECMA_IS_VALUE_ERROR (result))\n      {\n        JERRY_ASSERT (ecma_is_value_true (result));\n        ecma_ref_ecma_string (string_p);\n        result = ecma_make_string_value (string_p);\n      }\n\n      goto cleanup_context;\n    }\n\n    if (string_flags & ECMA_STRING_FLAG_IS_ASCII)\n    {\n      current_p += index;\n    }\n    else\n    {\n      ecma_length_t counter = index;\n      while (counter--)\n      {\n        lit_utf8_incr (&current_p);\n      }\n    }\n  }\n  else\n  {\n    index = 0;\n  }\n\n  ctx_p->builder = ecma_stringbuilder_create ();\n  ctx_p->capture_count = re_ctx.captures_count;\n  ctx_p->u.captures_p = re_ctx.captures_p;\n\n  while (true)\n  {\n    matched_p = ecma_regexp_match (&re_ctx, bc_start_p, current_p);\n\n    if (matched_p != NULL)\n    {\n      if (ECMA_RE_STACK_LIMIT_REACHED (matched_p))\n      {\n        result = ecma_raise_range_error (ECMA_ERR_STACK_LIMIT_EXCEEDED);\n        goto cleanup_builder;\n      }\n\n      const lit_utf8_size_t remaining_size = (lit_utf8_size_t) (current_p - last_append_p);\n      ecma_stringbuilder_append_raw (&(ctx_p->builder), last_append_p, remaining_size);\n\n      if (ctx_p->replace_str_p != NULL)\n      {\n        ctx_p->matched_p = current_p;\n        const ecma_regexp_capture_t *const global_capture_p = re_ctx.captures_p;\n        ctx_p->matched_size = (lit_utf8_size_t) (global_capture_p->end_p - global_capture_p->begin_p);\n        ctx_p->match_byte_pos = (lit_utf8_size_t) (current_p - re_ctx.input_start_p);\n\n        ecma_builtin_replace_substitute (ctx_p);\n      }\n      else\n      {\n        ecma_collection_t *arguments_p = ecma_new_collection ();\n\n        for (uint32_t i = 0; i < re_ctx.captures_count; i++)\n        {\n          ecma_value_t capture = ecma_regexp_get_capture_value (re_ctx.captures_p + i);\n          ecma_collection_push_back (arguments_p, capture);\n        }\n\n        ecma_collection_push_back (arguments_p, ecma_make_length_value (index));\n        ecma_ref_ecma_string (string_p);\n        ecma_collection_push_back (arguments_p, ecma_make_string_value (string_p));\n        ecma_object_t *function_p = ecma_get_object_from_value (replace_arg);\n\n        result =\n          ecma_op_function_call (function_p, ECMA_VALUE_UNDEFINED, arguments_p->buffer_p, arguments_p->item_count);\n\n        ecma_collection_free (arguments_p);\n\n        if (ECMA_IS_VALUE_ERROR (result))\n        {\n          goto cleanup_builder;\n        }\n\n        /* 16.m.v */\n        ecma_string_t *const replace_result_p = ecma_op_to_string (result);\n        ecma_free_value (result);\n\n        if (replace_result_p == NULL)\n        {\n          result = ECMA_VALUE_ERROR;\n          goto cleanup_builder;\n        }\n\n        ecma_stringbuilder_append (&(ctx_p->builder), replace_result_p);\n        ecma_deref_ecma_string (replace_result_p);\n      }\n\n      const ecma_regexp_capture_t *global_capture_p = re_ctx.captures_p;\n      last_append_p = global_capture_p->end_p;\n\n      const lit_utf8_size_t matched_size = (lit_utf8_size_t) (global_capture_p->end_p - global_capture_p->begin_p);\n\n      const bool is_ascii = (string_flags & ECMA_STRING_FLAG_IS_ASCII) != 0;\n      index += is_ascii ? matched_size : lit_utf8_string_length (current_p, matched_size);\n\n      if (!(ctx_p->flags & RE_FLAG_GLOBAL))\n      {\n        if (JERRY_UNLIKELY ((re_ctx.flags & RE_FLAG_STICKY) != 0))\n        {\n          ecma_value_t index_value = ecma_make_length_value (index);\n          result = ecma_op_object_put ((ecma_object_t *) re_obj_p,\n                                       ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),\n                                       index_value,\n                                       true);\n\n          ecma_free_value (index_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto cleanup_builder;\n          }\n        }\n\n        break;\n      }\n\n      if (matched_size > 0)\n      {\n        current_p = last_append_p;\n        continue;\n      }\n    }\n    else if (JERRY_UNLIKELY ((re_ctx.flags & RE_FLAG_STICKY) != 0))\n    {\n      result = ecma_op_object_put ((ecma_object_t *) re_obj_p,\n                                   ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),\n                                   ecma_make_uint32_value (0),\n                                   true);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        goto cleanup_builder;\n      }\n\n      break;\n    }\n\n    if (current_p >= string_end_p)\n    {\n      break;\n    }\n\n    if ((ctx_p->flags & RE_FLAG_UNICODE) != 0)\n    {\n      index++;\n      const lit_code_point_t cp = ecma_regexp_unicode_advance (&current_p, string_end_p);\n\n      if (cp > LIT_UTF16_CODE_UNIT_MAX)\n      {\n        index++;\n      }\n\n      continue;\n    }\n\n    index++;\n    lit_utf8_incr (&current_p);\n  }\n\n  const lit_utf8_size_t trailing_size = (lit_utf8_size_t) (string_end_p - last_append_p);\n  ecma_stringbuilder_append_raw (&(ctx_p->builder), last_append_p, trailing_size);\n\n  result = ecma_make_string_value (ecma_stringbuilder_finalize (&(ctx_p->builder)));\n  goto cleanup_context;\n\ncleanup_builder:\n  ecma_stringbuilder_destroy (&(ctx_p->builder));\n\ncleanup_context:\n  ecma_regexp_cleanup_context (&re_ctx);\n  ecma_bytecode_deref ((ecma_compiled_code_t *) bc_p);\n\n  if (string_flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n  {\n    jmem_heap_free_block ((void *) ctx_p->string_p, ctx_p->string_size);\n  }\n\n  return result;\n} /* ecma_regexp_replace_helper_fast */\n\n/**\n * Helper function for RegExp based replacing\n *\n * See also:\n *          String.prototype.replace\n *          RegExp.prototype[@@replace]\n *\n * @return result string of the replacement, if successful\n *         error value, otherwise\n */\necma_value_t\necma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */\n                            ecma_value_t string_arg, /**< source string */\n                            ecma_value_t replace_arg) /**< replace string */\n{\n  /* 2. */\n  if (!ecma_is_value_object (this_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_object_t *this_obj_p = ecma_get_object_from_value (this_arg);\n\n  ecma_replace_context_t replace_ctx;\n  replace_ctx.flags = RE_FLAG_EMPTY;\n\n  /* 3. */\n  ecma_string_t *string_p = ecma_op_to_string (string_arg);\n  if (string_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ECMA_VALUE_ERROR;\n\n  /* 6. */\n  replace_ctx.replace_str_p = NULL;\n  if (!ecma_op_is_callable (replace_arg))\n  {\n    replace_ctx.replace_str_p = ecma_op_to_string (replace_arg);\n\n    if (replace_ctx.replace_str_p == NULL)\n    {\n      goto cleanup_string;\n    }\n  }\n\n  /* 8 */\n  result = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_GLOBAL);\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    goto cleanup_replace;\n  }\n\n  if (ecma_op_to_boolean (result))\n  {\n    replace_ctx.flags |= RE_FLAG_GLOBAL;\n  }\n\n  ecma_free_value (result);\n\n  const lit_utf8_size_t string_length = ecma_string_get_length (string_p);\n\n  /* 10. */\n  if (replace_ctx.flags & RE_FLAG_GLOBAL)\n  {\n    result = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_UNICODE);\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_replace;\n    }\n\n    if (ecma_op_to_boolean (result))\n    {\n      replace_ctx.flags |= RE_FLAG_UNICODE;\n    }\n\n    ecma_free_value (result);\n\n    result = ecma_op_object_put (this_obj_p,\n                                 ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),\n                                 ecma_make_uint32_value (0),\n                                 true);\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_replace;\n    }\n\n    JERRY_ASSERT (ecma_is_value_boolean (result));\n  }\n\n  result = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_EXEC);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    goto cleanup_replace;\n  }\n\n  /* Check for fast path. */\n  if (ecma_op_is_callable (result))\n  {\n    ecma_extended_object_t *function_p = (ecma_extended_object_t *) ecma_get_object_from_value (result);\n    if (ecma_object_class_is (this_obj_p, ECMA_OBJECT_CLASS_REGEXP) && ecma_builtin_is_regexp_exec (function_p))\n    {\n      ecma_deref_object ((ecma_object_t *) function_p);\n\n      result =\n        ecma_regexp_replace_helper_fast (&replace_ctx, (ecma_extended_object_t *) this_obj_p, string_p, replace_arg);\n\n      goto cleanup_replace;\n    }\n  }\n\n  ecma_collection_t *results_p = ecma_new_collection ();\n\n  while (true)\n  {\n    /* 13.a */\n    if (ecma_op_is_callable (result))\n    {\n      ecma_object_t *const function_p = ecma_get_object_from_value (result);\n\n      ecma_value_t arguments[] = { ecma_make_string_value (string_p) };\n      result = ecma_op_function_call (function_p, this_arg, arguments, 1);\n\n      ecma_deref_object (function_p);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        goto cleanup_results;\n      }\n\n      if (!ecma_is_value_object (result) && !ecma_is_value_null (result))\n      {\n        ecma_free_value (result);\n        result = ecma_raise_type_error (ECMA_ERR_RETURN_VALUE_OF_EXEC_MUST_BE_AN_OBJECT_OR_NULL);\n        goto cleanup_results;\n      }\n    }\n    else\n    {\n      ecma_free_value (result);\n\n      if (!ecma_object_class_is (this_obj_p, ECMA_OBJECT_CLASS_REGEXP))\n      {\n        result = ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP_OBJECT);\n        goto cleanup_results;\n      }\n\n      result = ecma_regexp_exec_helper (this_obj_p, string_p);\n    }\n\n    /* 13.c */\n    if (ecma_is_value_null (result))\n    {\n      break;\n    }\n\n    /* 13.d.i */\n    ecma_collection_push_back (results_p, result);\n\n    if ((replace_ctx.flags & RE_FLAG_GLOBAL) == 0)\n    {\n      break;\n    }\n\n    /* 13.d.iii.1 */\n    result = ecma_op_object_get_by_index (ecma_get_object_from_value (result), 0);\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_results;\n    }\n\n    ecma_string_t *match_str_p = ecma_op_to_string (result);\n    ecma_free_value (result);\n\n    if (match_str_p == NULL)\n    {\n      result = ECMA_VALUE_ERROR;\n      goto cleanup_results;\n    }\n\n    const bool is_empty = ecma_string_is_empty (match_str_p);\n    ecma_deref_ecma_string (match_str_p);\n\n    /* 13.d.iii.3 */\n    if (is_empty)\n    {\n      result = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_LASTINDEX_UL);\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        goto cleanup_results;\n      }\n\n      ecma_value_t last_index = result;\n\n      ecma_length_t index;\n      result = ecma_op_to_length (last_index, &index);\n      ecma_free_value (last_index);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        goto cleanup_results;\n      }\n\n      index = ecma_op_advance_string_index (string_p, index, (replace_ctx.flags & RE_FLAG_UNICODE) != 0);\n      last_index = ecma_make_length_value (index);\n\n      /* 10.d.iii.3.c */\n      result = ecma_op_object_put (this_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), last_index, true);\n\n      ecma_free_value (last_index);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        goto cleanup_results;\n      }\n\n      JERRY_ASSERT (ecma_is_value_boolean (result));\n    }\n\n    result = ecma_op_object_get_by_magic_id (this_obj_p, LIT_MAGIC_STRING_EXEC);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_results;\n    }\n  }\n\n  uint8_t string_flags = ECMA_STRING_FLAG_IS_ASCII;\n  replace_ctx.string_p = ecma_string_get_chars (string_p, &(replace_ctx.string_size), NULL, NULL, &string_flags);\n\n  /* 14. */\n  replace_ctx.builder = ecma_stringbuilder_create ();\n  replace_ctx.matched_p = NULL;\n  replace_ctx.capture_count = 0;\n  lit_utf8_size_t index = 0;\n\n  /* 15. */\n  const lit_utf8_byte_t *source_position_p = replace_ctx.string_p;\n  const lit_utf8_byte_t *const string_end_p = replace_ctx.string_p + replace_ctx.string_size;\n\n  /* 16. */\n  for (ecma_value_t *current_p = results_p->buffer_p; current_p < results_p->buffer_p + results_p->item_count;\n       current_p++)\n  {\n    /* 16.a */\n    ecma_object_t *current_object_p = ecma_get_object_from_value (*current_p);\n\n    ecma_length_t capture_count;\n    result = ecma_op_object_get_length (current_object_p, &capture_count);\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_builder;\n    }\n\n    /* 16.c */\n    capture_count = (capture_count > 0) ? capture_count - 1 : capture_count;\n\n    /* 16.d */\n    result = ecma_op_object_get_by_index (current_object_p, 0);\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      goto cleanup_builder;\n    }\n\n    ecma_string_t *matched_str_p = ecma_op_to_string (result);\n    ecma_free_value (result);\n\n    /* 16.e */\n    if (matched_str_p == NULL)\n    {\n      result = ECMA_VALUE_ERROR;\n      goto cleanup_builder;\n    }\n\n    /* 16.g */\n    result = ecma_op_object_get_by_magic_id (current_object_p, LIT_MAGIC_STRING_INDEX);\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      ecma_deref_ecma_string (matched_str_p);\n      goto cleanup_builder;\n    }\n\n    const ecma_value_t index_value = result;\n\n    ecma_number_t position_num;\n    result = ecma_op_to_integer (index_value, &position_num);\n    ecma_free_value (index_value);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      ecma_deref_ecma_string (matched_str_p);\n      goto cleanup_builder;\n    }\n\n    /* 16.i */\n    lit_utf8_size_t position = JERRY_MIN ((lit_utf8_size_t) JERRY_MAX (position_num, 0.0f), string_length);\n\n    /* 16.k */\n    ecma_collection_t *arguments_p = ecma_new_collection ();\n    ecma_collection_push_back (arguments_p, ecma_make_string_value (matched_str_p));\n\n    /* 16.j, l */\n    ecma_length_t n = 1;\n    while (n <= capture_count)\n    {\n      result = ecma_op_object_get_by_index (current_object_p, n);\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        ecma_collection_free (arguments_p);\n        goto cleanup_builder;\n      }\n\n      /* 16.l.iii */\n      if (!ecma_is_value_undefined (result))\n      {\n        ecma_string_t *capture_str_p = ecma_op_to_string (result);\n        ecma_free_value (result);\n\n        if (capture_str_p == NULL)\n        {\n          ecma_collection_free (arguments_p);\n          result = ECMA_VALUE_ERROR;\n          goto cleanup_builder;\n        }\n\n        result = ecma_make_string_value (capture_str_p);\n      }\n\n      /* 16.l.iv */\n      ecma_collection_push_back (arguments_p, result);\n      n++;\n    }\n\n    const bool should_replace = (position >= index);\n    /* 16.p */\n    if (should_replace)\n    {\n      const lit_utf8_byte_t *match_position_p;\n      const lit_utf8_size_t matched_str_size = ecma_string_get_size (matched_str_p);\n      const lit_utf8_size_t matched_str_length = ecma_string_get_length (matched_str_p);\n\n      if (string_flags & ECMA_STRING_FLAG_IS_ASCII)\n      {\n        match_position_p = replace_ctx.string_p + position;\n      }\n      else\n      {\n        match_position_p = source_position_p;\n        lit_utf8_size_t distance = position - index;\n        while (distance--)\n        {\n          lit_utf8_incr (&match_position_p);\n        }\n      }\n\n      ecma_stringbuilder_append_raw (&replace_ctx.builder,\n                                     source_position_p,\n                                     (lit_utf8_size_t) (match_position_p - source_position_p));\n      replace_ctx.match_byte_pos = (lit_utf8_size_t) (match_position_p - replace_ctx.string_p);\n\n      if ((string_flags & ECMA_STRING_FLAG_IS_ASCII) && matched_str_size == matched_str_length)\n      {\n        source_position_p = JERRY_MIN (match_position_p + matched_str_size, string_end_p);\n      }\n      else\n      {\n        lit_utf8_size_t code_unit_count = matched_str_length;\n\n        while (code_unit_count-- > 0 && JERRY_LIKELY (match_position_p < string_end_p))\n        {\n          lit_utf8_incr (&match_position_p);\n        }\n\n        source_position_p = match_position_p;\n      }\n\n      index = JERRY_MIN (position + matched_str_length, string_length);\n    }\n\n    /* 16.m */\n    if (replace_ctx.replace_str_p == NULL)\n    {\n      /* 16.m.i-ii.\n       * arguments_p already contains <<Matched, cap1, cap2, ..., capN>> */\n\n      /* 16.m.iii */\n      ecma_collection_push_back (arguments_p, ecma_make_uint32_value (position));\n      ecma_ref_ecma_string (string_p);\n      ecma_collection_push_back (arguments_p, ecma_make_string_value (string_p));\n\n      result = ecma_op_function_call (ecma_get_object_from_value (replace_arg),\n                                      ECMA_VALUE_UNDEFINED,\n                                      arguments_p->buffer_p,\n                                      arguments_p->item_count);\n\n      ecma_collection_free (arguments_p);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        goto cleanup_builder;\n      }\n\n      /* 16.m.v */\n      ecma_string_t *const replace_result_p = ecma_op_to_string (result);\n      ecma_free_value (result);\n\n      if (replace_result_p == NULL)\n      {\n        result = ECMA_VALUE_ERROR;\n        goto cleanup_builder;\n      }\n\n      /* 16.m/p */\n      if (should_replace)\n      {\n        ecma_stringbuilder_append (&replace_ctx.builder, replace_result_p);\n      }\n\n      ecma_deref_ecma_string (replace_result_p);\n    }\n    else\n    {\n      /* 16.n/p */\n      if (should_replace)\n      {\n        replace_ctx.u.collection_p = arguments_p;\n        ecma_builtin_replace_substitute (&replace_ctx);\n      }\n\n      ecma_collection_free (arguments_p);\n    }\n  }\n\n  /* 18. */\n  JERRY_ASSERT (index <= string_length);\n  ecma_stringbuilder_append_raw (&(replace_ctx.builder),\n                                 source_position_p,\n                                 (lit_utf8_size_t) (string_end_p - source_position_p));\n\n  result = ecma_make_string_value (ecma_stringbuilder_finalize (&replace_ctx.builder));\n  goto cleanup_chars;\n\ncleanup_builder:\n  ecma_stringbuilder_destroy (&replace_ctx.builder);\n\ncleanup_chars:\n  if (string_flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n  {\n    jmem_heap_free_block ((void *) replace_ctx.string_p, replace_ctx.string_size);\n  }\n\ncleanup_results:\n  ecma_collection_free (results_p);\n\ncleanup_replace:\n  if (replace_ctx.replace_str_p != NULL)\n  {\n    ecma_deref_ecma_string (replace_ctx.replace_str_p);\n  }\n\ncleanup_string:\n  ecma_deref_ecma_string (string_p);\n\n  return result;\n} /* ecma_regexp_replace_helper */\n\n/**\n * Helper function for RegExp based matching\n *\n * See also:\n *          String.prototype.match\n *          RegExp.prototype[@@match]\n *\n * @return ecma_value_t\n */\necma_value_t\necma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */\n                          ecma_value_t string_arg) /**< source string */\n{\n  if (!ecma_is_value_object (this_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);\n  }\n\n  ecma_string_t *str_p = ecma_op_to_string (string_arg);\n\n  if (JERRY_UNLIKELY (str_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);\n\n  ecma_value_t global_value = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_GLOBAL);\n\n  if (ECMA_IS_VALUE_ERROR (global_value))\n  {\n    ecma_deref_ecma_string (str_p);\n    return global_value;\n  }\n\n  bool global = ecma_op_to_boolean (global_value);\n\n  ecma_free_value (global_value);\n\n  if (!global)\n  {\n    ecma_value_t result = ecma_op_regexp_exec (this_arg, str_p);\n    ecma_deref_ecma_string (str_p);\n    return result;\n  }\n\n  ecma_value_t full_unicode_value = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_UNICODE);\n\n  if (ECMA_IS_VALUE_ERROR (full_unicode_value))\n  {\n    ecma_deref_ecma_string (str_p);\n    return full_unicode_value;\n  }\n\n  bool full_unicode = ecma_op_to_boolean (full_unicode_value);\n\n  ecma_free_value (full_unicode_value);\n\n  ecma_value_t set_status =\n    ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), ecma_make_uint32_value (0), true);\n\n  if (ECMA_IS_VALUE_ERROR (set_status))\n  {\n    ecma_deref_ecma_string (str_p);\n    return set_status;\n  }\n\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n  ecma_object_t *result_array_p = ecma_op_new_array_object (0);\n  uint32_t n = 0;\n\n  while (true)\n  {\n    ecma_value_t result_value = ecma_op_regexp_exec (this_arg, str_p);\n\n    if (ECMA_IS_VALUE_ERROR (result_value))\n    {\n      goto result_cleanup;\n    }\n\n    if (ecma_is_value_null (result_value))\n    {\n      if (n == 0)\n      {\n        ret_value = ECMA_VALUE_NULL;\n        goto result_cleanup;\n      }\n\n      ecma_deref_ecma_string (str_p);\n      return ecma_make_object_value (result_array_p);\n    }\n\n    ecma_object_t *result_value_p = ecma_get_object_from_value (result_value);\n    ecma_value_t match_value = ecma_op_object_get_by_index (result_value_p, 0);\n\n    ecma_deref_object (result_value_p);\n\n    if (ECMA_IS_VALUE_ERROR (match_value))\n    {\n      goto result_cleanup;\n    }\n\n    ecma_string_t *match_str_p = ecma_op_to_string (match_value);\n    ecma_free_value (match_value);\n\n    if (JERRY_UNLIKELY (match_str_p == NULL))\n    {\n      goto result_cleanup;\n    }\n\n    ecma_value_t new_prop = ecma_builtin_helper_def_prop_by_index (result_array_p,\n                                                                   n,\n                                                                   ecma_make_string_value (match_str_p),\n                                                                   ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n\n    JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (new_prop));\n\n    const bool is_match_empty = ecma_string_is_empty (match_str_p);\n    ecma_deref_ecma_string (match_str_p);\n\n    if (is_match_empty)\n    {\n      ecma_value_t last_index = ecma_op_object_get_by_magic_id (obj_p, LIT_MAGIC_STRING_LASTINDEX_UL);\n\n      if (ECMA_IS_VALUE_ERROR (last_index))\n      {\n        goto result_cleanup;\n      }\n\n      ecma_length_t index;\n      ecma_value_t length_value = ecma_op_to_length (last_index, &index);\n\n      ecma_free_value (last_index);\n\n      if (ECMA_IS_VALUE_ERROR (length_value))\n      {\n        goto result_cleanup;\n      }\n\n      index = ecma_op_advance_string_index (str_p, index, full_unicode);\n\n      last_index = ecma_make_length_value (index);\n      ecma_value_t next_set_status =\n        ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), last_index, true);\n\n      ecma_free_value (last_index);\n\n      if (ECMA_IS_VALUE_ERROR (next_set_status))\n      {\n        goto result_cleanup;\n      }\n    }\n\n    n++;\n  }\n\nresult_cleanup:\n  ecma_deref_ecma_string (str_p);\n  ecma_deref_object (result_array_p);\n  return ret_value;\n} /* ecma_regexp_match_helper */\n\n/**\n * RegExpExec operation\n *\n * See also:\n *          ECMA-262 v6.0, 21.2.5.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_op_regexp_exec (ecma_value_t this_arg, /**< this argument */\n                     ecma_string_t *str_p) /**< input string */\n{\n  ecma_object_t *arg_obj_p = ecma_get_object_from_value (this_arg);\n\n  ecma_value_t exec = ecma_op_object_get_by_magic_id (arg_obj_p, LIT_MAGIC_STRING_EXEC);\n\n  if (ECMA_IS_VALUE_ERROR (exec))\n  {\n    return exec;\n  }\n\n  if (ecma_op_is_callable (exec))\n  {\n    ecma_object_t *function_p = ecma_get_object_from_value (exec);\n    ecma_value_t arguments[] = { ecma_make_string_value (str_p) };\n\n    ecma_value_t result = ecma_op_function_call (function_p, this_arg, arguments, 1);\n\n    ecma_deref_object (function_p);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      return result;\n    }\n\n    if (!ecma_is_value_object (result) && !ecma_is_value_null (result))\n    {\n      ecma_free_value (result);\n      return ecma_raise_type_error (ECMA_ERR_RETURN_VALUE_OF_EXEC_MUST_BE_AN_OBJECT_OR_NULL);\n    }\n\n    return result;\n  }\n  else\n  {\n    ecma_free_value (exec);\n  }\n\n  if (!ecma_object_is_regexp_object (this_arg))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP);\n  }\n\n  return ecma_regexp_exec_helper (arg_obj_p, str_p);\n} /* ecma_op_regexp_exec */\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-regexp-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_REGEXP_OBJECT_H\n#define ECMA_REGEXP_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n#include \"re-compiler.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmaregexpobject ECMA RegExp object related routines\n * @{\n */\n\n/**\n * RegExp flags\n * Note:\n *      This enum has to be kept in sync with jerry_regexp_flags_t.\n */\ntypedef enum\n{\n  RE_FLAG_EMPTY = 0u, /* Empty RegExp flags */\n  RE_FLAG_GLOBAL = (1u << 1), /**< ECMA-262 v5, 15.10.7.2 */\n  RE_FLAG_IGNORE_CASE = (1u << 2), /**< ECMA-262 v5, 15.10.7.3 */\n  RE_FLAG_MULTILINE = (1u << 3), /**< ECMA-262 v5, 15.10.7.4 */\n  RE_FLAG_STICKY = (1u << 4), /**< ECMA-262 v6, 21.2.5.12 */\n  RE_FLAG_UNICODE = (1u << 5), /**< ECMA-262 v6, 21.2.5.15 */\n  RE_FLAG_DOTALL = (1u << 6) /**< ECMA-262 v9, 21.2.5.3 */\n\n  /* Bits from bit 13 is reserved for function types (see CBC_FUNCTION_TYPE_SHIFT). */\n} ecma_regexp_flags_t;\n\n/**\n * Class escapes\n */\ntypedef enum\n{\n  RE_ESCAPE__START, /**< escapes start */\n  RE_ESCAPE_DIGIT = RE_ESCAPE__START, /**< digit */\n  RE_ESCAPE_NOT_DIGIT, /**< not digit */\n  RE_ESCAPE_WORD_CHAR, /**< word char */\n  RE_ESCAPE_NOT_WORD_CHAR, /**< not word char */\n  RE_ESCAPE_WHITESPACE, /**< whitespace */\n  RE_ESCAPE_NOT_WHITESPACE, /**< not whitespace */\n  RE_ESCAPE__COUNT, /**< escape count */\n} ecma_class_escape_t;\n\n/**\n * Character class flags escape count mask size.\n */\n#define RE_CLASS_ESCAPE_COUNT_MASK_SIZE (3u)\n\n/**\n * Character class flags escape count mask.\n */\n#define RE_CLASS_ESCAPE_COUNT_MASK ((1 << RE_CLASS_ESCAPE_COUNT_MASK_SIZE) - 1u)\n\n/**\n * Character class flags that are present in the upper bits of the class flags byte, while the 3 least significant bits\n * hold a value that contains the number of class escapes present in the character class.\n */\ntypedef enum\n{\n  RE_CLASS_HAS_CHARS = (1 << 5), /**< contains individual characters */\n  RE_CLASS_HAS_RANGES = (1 << 6), /**< contains character ranges */\n  RE_CLASS_INVERT = (1 << 7), /**< inverted */\n} ecma_char_class_flags_t;\n\n/**\n * Structure for matching capturing groups and storing their result\n */\ntypedef struct\n{\n  const lit_utf8_byte_t *begin_p; /**< capture start pointer */\n  const lit_utf8_byte_t *end_p; /**< capture end pointer */\n  const uint8_t *bc_p; /**< group bytecode pointer */\n  uint32_t iterator; /**< iteration counter */\n  uint32_t subcapture_count; /**< number of nested capturing groups */\n} ecma_regexp_capture_t;\n\n/**\n * Structure for matching non-capturing groups\n */\ntypedef struct\n{\n  const lit_utf8_byte_t *begin_p; /**< substring start pointer */\n  const uint8_t *bc_p; /**< group bytecode pointer */\n  uint32_t iterator; /**< iteration counter */\n  uint32_t subcapture_start; /**< first nested capturing group index */\n  uint32_t subcapture_count; /**< number of nested capturing groups */\n} ecma_regexp_non_capture_t;\n\n/**\n * Check if an ecma_regexp_capture_t contains a defined capture\n */\n#define ECMA_RE_IS_CAPTURE_DEFINED(c) ((c)->begin_p != NULL)\n\necma_value_t ecma_regexp_get_capture_value (const ecma_regexp_capture_t *const capture_p);\n\n#if (JERRY_STACK_LIMIT != 0)\n/**\n * Value used ase result when stack limit is reached\n */\n#define ECMA_RE_OUT_OF_STACK ((const lit_utf8_byte_t *) UINTPTR_MAX)\n\n/**\n * Checks if the stack limit has been reached during regexp matching\n */\n#define ECMA_RE_STACK_LIMIT_REACHED(p) (JERRY_UNLIKELY (p == ECMA_RE_OUT_OF_STACK))\n#else /* JERRY_STACK_LIMIT == 0 */\n#define ECMA_RE_STACK_LIMIT_REACHED(p) (false)\n#endif /* JERRY_STACK_LIMIT != 0 */\n\n/**\n * Offset applied to qmax when encoded into the bytecode.\n *\n * It's common for qmax to be Infinity, which is represented a UINT32_MAX. By applying the offset we are able to store\n * it in a single byte az zero.\n */\n#define RE_QMAX_OFFSET 1\n\n/**\n * RegExp executor context\n */\ntypedef struct\n{\n  const lit_utf8_byte_t *input_start_p; /**< start of input string */\n  const lit_utf8_byte_t *input_end_p; /**< end of input string */\n  uint32_t captures_count; /**< number of capture groups */\n  uint32_t non_captures_count; /**< number of non-capture groups */\n  ecma_regexp_capture_t *captures_p; /**< capturing groups */\n  ecma_regexp_non_capture_t *non_captures_p; /**< non-capturing groups */\n  uint16_t flags; /**< RegExp flags */\n  uint8_t char_size; /**< size of encoded characters */\n} ecma_regexp_ctx_t;\n\n/**\n * RegExpStringIterator object internal slots\n *\n * See also:\n *          ECMA-262 v11, 21.2.7.2\n */\ntypedef struct\n{\n  ecma_extended_object_t header; /**< extended object part */\n  ecma_value_t iterating_regexp; /**< [[IteratingRegExp]] internal slot */\n  ecma_value_t iterated_string; /**< [[IteratedString]] internal slot */\n} ecma_regexp_string_iterator_t;\n\nlit_code_point_t ecma_regexp_unicode_advance (const lit_utf8_byte_t **str_p, const lit_utf8_byte_t *end_p);\necma_object_t *ecma_op_regexp_alloc (ecma_object_t *new_target_obj_p);\necma_value_t ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, ecma_string_t *input_string_p);\necma_string_t *ecma_regexp_read_pattern_str_helper (ecma_value_t pattern_arg);\nlit_code_point_t ecma_regexp_canonicalize_char (lit_code_point_t ch, bool unicode);\necma_value_t ecma_regexp_parse_flags (ecma_string_t *flags_str_p, uint16_t *flags_p);\nvoid ecma_regexp_create_and_initialize_props (ecma_object_t *re_object_p, ecma_string_t *source_p, uint16_t flags);\necma_value_t ecma_regexp_replace_helper (ecma_value_t this_arg, ecma_value_t string_arg, ecma_value_t replace_arg);\necma_value_t ecma_regexp_search_helper (ecma_value_t regexp_arg, ecma_value_t string_arg);\necma_value_t ecma_regexp_split_helper (ecma_value_t this_arg, ecma_value_t string_arg, ecma_value_t limit_arg);\necma_value_t ecma_regexp_match_helper (ecma_value_t this_arg, ecma_value_t string_arg);\n\necma_value_t ecma_op_regexp_exec (ecma_value_t this_arg, ecma_string_t *str_p);\n\necma_value_t ecma_op_create_regexp_from_bytecode (ecma_object_t *regexp_obj_p, re_compiled_code_t *bc_p);\necma_value_t\necma_op_create_regexp_from_pattern (ecma_object_t *regexp_obj_p, ecma_value_t pattern_value, ecma_value_t flags_value);\necma_value_t ecma_op_create_regexp_with_flags (ecma_object_t *regexp_obj_p, ecma_value_t pattern_value, uint16_t flags);\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n#endif /* !ECMA_REGEXP_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-shared-arraybuffer-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-shared-arraybuffer-object.h\"\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-typedarray-object.h\"\n\n#include \"jcontext.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmasharedarraybufferobject ECMA SharedArrayBuffer object related routines\n * @{\n */\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n\n/**\n * Creating SharedArrayBuffer objects based on the array length\n *\n * @return new SharedArrayBuffer object\n */\necma_object_t *\necma_shared_arraybuffer_new_object (uint32_t length) /**< length of the SharedArrayBuffer */\n{\n  if (length > 0)\n  {\n    return ecma_arraybuffer_create_object_with_buffer (ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER, length);\n  }\n\n  return ecma_arraybuffer_create_object (ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER, length);\n} /* ecma_shared_arraybuffer_new_object */\n\n/**\n * SharedArrayBuffer object creation operation.\n *\n * See also: ES11 24.1.1.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_create_shared_arraybuffer_object (const ecma_value_t *arguments_list_p, /**< list of arguments that\n                                                                                 *   are passed to String constructor */\n                                          uint32_t arguments_list_len) /**< length of the arguments' list */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),\n                                                                   ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE);\n\n  if (proto_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_number_t length_num = 0;\n\n  if (arguments_list_len > 0)\n  {\n    if (ecma_is_value_number (arguments_list_p[0]))\n    {\n      length_num = ecma_get_number_from_value (arguments_list_p[0]);\n    }\n    else\n    {\n      ecma_value_t to_number_value = ecma_op_to_number (arguments_list_p[0], &length_num);\n\n      if (ECMA_IS_VALUE_ERROR (to_number_value))\n      {\n        ecma_deref_object (proto_p);\n        return to_number_value;\n      }\n    }\n\n    if (ecma_number_is_nan (length_num))\n    {\n      length_num = 0;\n    }\n\n    const uint32_t maximum_size_in_byte = UINT32_MAX - sizeof (ecma_extended_object_t) - JMEM_ALIGNMENT + 1;\n\n    if (length_num <= -1.0 || length_num > (ecma_number_t) maximum_size_in_byte + 0.5)\n    {\n      ecma_deref_object (proto_p);\n      return ecma_raise_range_error (ECMA_ERR_INVALID_SHARED_ARRAYBUFFER_LENGTH);\n    }\n  }\n\n  uint32_t length_uint32 = ecma_number_to_uint32 (length_num);\n  ecma_object_t *shared_array_buffer = ecma_shared_arraybuffer_new_object (length_uint32);\n  ECMA_SET_NON_NULL_POINTER (shared_array_buffer->u2.prototype_cp, proto_p);\n  ecma_deref_object (proto_p);\n\n  return ecma_make_object_value (shared_array_buffer);\n} /* ecma_op_create_shared_arraybuffer_object */\n\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n\n/**\n * Helper function: check if the target is SharedArrayBuffer\n *\n * See also: ES11 24.1.1.4\n *\n * @return true - if value is a SharedArrayBuffer object\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_is_shared_arraybuffer (ecma_value_t target) /**< the target value */\n{\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n  return (ecma_is_value_object (target)\n          && ecma_object_class_is (ecma_get_object_from_value (target), ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER));\n#else /* !JERRY_BUILTIN_SHAREDARRAYBUFFER */\n  JERRY_UNUSED (target);\n  return false;\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n} /* ecma_is_shared_arraybuffer */\n\n/**\n * Helper function: check if the target is SharedArrayBuffer Object\n *\n * @return true - if value is a SharedArrayBuffer object\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\necma_object_is_shared_arraybuffer (ecma_object_t *object_p) /**< the target object */\n{\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n  return ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER);\n#else /* !JERRY_BUILTIN_SHAREDARRAYBUFFER */\n  JERRY_UNUSED (object_p);\n  return false;\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n} /* ecma_object_is_shared_arraybuffer */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-shared-arraybuffer-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_SHARED_ARRAYBUFFER_OBJECT_H\n#define ECMA_SHARED_ARRAYBUFFER_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmasharedarraybufferobject ECMA SharedArrayBuffer object related routines\n * @{\n */\n\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\n\necma_value_t ecma_op_create_shared_arraybuffer_object (const ecma_value_t *, uint32_t);\n\n/**\n * Helper functions for SharedArrayBuffer.\n */\necma_object_t *ecma_shared_arraybuffer_new_object (uint32_t lengh);\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\nbool ecma_is_shared_arraybuffer (ecma_value_t val);\nbool ecma_object_is_shared_arraybuffer (ecma_object_t *val);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_SHARED_ARRAYBUFFER_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-string-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-string-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#include \"jcontext.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmastringobject ECMA String object related routines\n * @{\n */\n\n/**\n * String object creation operation.\n *\n * See also: ECMA-262 v5, 15.5.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of arguments that\n                                                                         are passed to String constructor */\n                              uint32_t arguments_list_len) /**< length of the arguments' list */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  ecma_value_t prim_value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n\n  if (arguments_list_len > 0)\n  {\n    ecma_string_t *str_p = ecma_op_to_string (arguments_list_p[0]);\n\n    if (JERRY_UNLIKELY (str_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    prim_value = ecma_make_string_value (str_p);\n  }\n\n  ecma_builtin_id_t proto_id;\n#if JERRY_BUILTIN_STRING\n  proto_id = ECMA_BUILTIN_ID_STRING_PROTOTYPE;\n#else /* !JERRY_BUILTIN_STRING */\n  proto_id = ECMA_BUILTIN_ID_OBJECT_PROTOTYPE;\n#endif /* JERRY_BUILTIN_STRING */\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (proto_id);\n\n  ecma_object_t *new_target = JERRY_CONTEXT (current_new_target_p);\n  if (new_target)\n  {\n    prototype_obj_p = ecma_op_get_prototype_from_constructor (new_target, proto_id);\n    if (JERRY_UNLIKELY (prototype_obj_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n  }\n\n  ecma_object_t *object_p =\n    ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_STRING;\n  ext_object_p->u.cls.u3.value = prim_value;\n\n  if (new_target)\n  {\n    ecma_deref_object (prototype_obj_p);\n  }\n\n  return ecma_make_object_value (object_p);\n} /* ecma_op_create_string_object */\n\n/**\n * List names of a String object's lazy instantiated properties\n */\nvoid\necma_op_string_list_lazy_property_names (ecma_object_t *obj_p, /**< a String object */\n                                         ecma_collection_t *prop_names_p, /**< prop name collection */\n                                         ecma_property_counter_t *prop_counter_p, /**< property counters */\n                                         jerry_property_filter_t filter) /**< property name filter options */\n{\n  JERRY_ASSERT (ecma_get_object_base_type (obj_p) == ECMA_OBJECT_BASE_TYPE_CLASS);\n\n  if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES))\n  {\n    ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n    JERRY_ASSERT (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_STRING);\n\n    ecma_string_t *prim_value_str_p = ecma_get_string_from_value (ext_object_p->u.cls.u3.value);\n\n    lit_utf8_size_t length = ecma_string_get_length (prim_value_str_p);\n\n    for (lit_utf8_size_t i = 0; i < length; i++)\n    {\n      ecma_string_t *name_p = ecma_new_ecma_string_from_uint32 (i);\n\n      /* the properties are enumerable (ECMA-262 v5, 15.5.5.2.9) */\n      ecma_collection_push_back (prop_names_p, ecma_make_string_value (name_p));\n    }\n\n    prop_counter_p->array_index_named_props += length;\n  }\n\n  if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS))\n  {\n    ecma_collection_push_back (prop_names_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_LENGTH));\n    prop_counter_p->string_named_props++;\n  }\n} /* ecma_op_string_list_lazy_property_names */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-string-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_STRING_OBJECT_H\n#define ECMA_STRING_OBJECT_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmastringobject ECMA String object related routines\n * @{\n */\n\necma_value_t ecma_op_create_string_object (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);\n\nvoid ecma_op_string_list_lazy_property_names (ecma_object_t *obj_p,\n                                              ecma_collection_t *prop_names_p,\n                                              ecma_property_counter_t *prop_counter_p,\n                                              jerry_property_filter_t filter);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_STRING_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-symbol-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-symbol-object.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n\n#include \"lit-char-helpers.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmasymbolobject ECMA Symbol object related routines\n * @{\n */\n\n/**\n * Symbol creation operation.\n *\n * See also: ECMA-262 v6, 6.1.5.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_create_symbol (const ecma_value_t *arguments_list_p, /**< list of arguments */\n                       uint32_t arguments_list_len) /**< length of the arguments' list */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  ecma_value_t string_desc;\n\n  /* 1-3. */\n  if (arguments_list_len == 0 || ecma_is_value_undefined (arguments_list_p[0]))\n  {\n    string_desc = ECMA_VALUE_UNDEFINED;\n  }\n  else\n  {\n    ecma_string_t *str_p = ecma_op_to_string (arguments_list_p[0]);\n\n    /* 4. */\n    if (JERRY_UNLIKELY (str_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    string_desc = ecma_make_string_value (str_p);\n  }\n\n  /* 5. */\n  return ecma_make_symbol_value (ecma_new_symbol_from_descriptor_string (string_desc));\n} /* ecma_op_create_symbol */\n\n/**\n * Symbol object creation operation.\n *\n * See also: ECMA-262 v6, 19.4.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_create_symbol_object (const ecma_value_t value) /**< symbol value */\n{\n  JERRY_ASSERT (ecma_is_value_symbol (value));\n\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE);\n  ecma_object_t *object_p =\n    ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_SYMBOL;\n  ext_object_p->u.cls.u3.value = ecma_copy_value (value);\n\n  return ecma_make_object_value (object_p);\n} /* ecma_op_create_symbol_object */\n\n/**\n * Get the symbol descriptor ecma-string from an ecma-symbol\n *\n * @return pointer to ecma-string descriptor\n */\necma_value_t\necma_get_symbol_description (ecma_string_t *symbol_p) /**< ecma-symbol */\n{\n  JERRY_ASSERT (symbol_p != NULL);\n  JERRY_ASSERT (ecma_prop_name_is_symbol (symbol_p));\n\n  return ((ecma_extended_string_t *) symbol_p)->u.symbol_descriptor;\n} /* ecma_get_symbol_description */\n\n/**\n * Get the descriptive string of the Symbol.\n *\n * See also: ECMA-262 v6, 19.4.3.2.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_get_symbol_descriptive_string (ecma_value_t symbol_value) /**< symbol to stringify */\n{\n  /* 1. */\n  JERRY_ASSERT (ecma_is_value_symbol (symbol_value));\n\n  /* 2 - 3. */\n  ecma_string_t *symbol_p = ecma_get_symbol_from_value (symbol_value);\n  ecma_value_t string_desc = ecma_get_symbol_description (symbol_p);\n  ecma_stringbuilder_t builder = ecma_stringbuilder_create_raw ((lit_utf8_byte_t *) (\"Symbol(\"), 7);\n\n  if (!ecma_is_value_undefined (string_desc))\n  {\n    ecma_string_t *string_desc_p = ecma_get_string_from_value (string_desc);\n    ecma_stringbuilder_append (&builder, string_desc_p);\n  }\n\n  ecma_stringbuilder_append_byte (&builder, LIT_CHAR_RIGHT_PAREN);\n  return ecma_make_string_value (ecma_stringbuilder_finalize (&builder));\n} /* ecma_get_symbol_descriptive_string */\n\n/**\n * thisSymbolValue abstract operation\n *\n * See also:\n *          ECMA-262 v11, 19.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value.\n */\necma_value_t\necma_symbol_this_value (ecma_value_t this_arg) /**< this argument value */\n{\n  /* 1. */\n  if (ecma_is_value_symbol (this_arg))\n  {\n    return this_arg;\n  }\n\n  /* 2. */\n  if (ecma_is_value_object (this_arg))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (this_arg);\n\n    if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SYMBOL))\n    {\n      return ((ecma_extended_object_t *) object_p)->u.cls.u3.value;\n    }\n  }\n\n  /* 3. */\n  return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_SYMBOL);\n} /* ecma_symbol_this_value */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-symbol-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_SYMBOL_H\n#define ECMA_SYMBOL_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmasymbolobject ECMA Symbol object related routines\n * @{\n */\n\necma_value_t ecma_op_create_symbol (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);\n\necma_value_t ecma_op_create_symbol_object (const ecma_value_t value);\n\nbool ecma_prop_name_is_symbol (ecma_string_t *string_p);\n\necma_value_t ecma_get_symbol_description (ecma_string_t *symbol_p);\n\necma_value_t ecma_symbol_this_value (ecma_value_t this_arg);\n\necma_value_t ecma_get_symbol_descriptive_string (ecma_value_t symbol_value);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !ECMA_SYMBOL_H */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-typedarray-object.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-typedarray-object.h\"\n\n#include <math.h>\n\n#include \"ecma-arraybuffer-object.h\"\n#include \"ecma-big-uint.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-shared-arraybuffer-object.h\"\n\n#include \"jcontext.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmatypedarrayobject ECMA TypedArray object related routines\n * @{\n */\n\n/**\n * Read and copy a number from a given buffer to a value.\n **/\n#define ECMA_TYPEDARRAY_GET_ELEMENT(src_p, num, type)                      \\\n  do                                                                       \\\n  {                                                                        \\\n    if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \\\n    {                                                                      \\\n      num = *(type *) ((void *) src_p);                                    \\\n    }                                                                      \\\n    else                                                                   \\\n    {                                                                      \\\n      memcpy (&num, (void *) src_p, sizeof (type));                        \\\n    }                                                                      \\\n  } while (0)\n\n/**\n * Copy a number from a value to the given buffer\n **/\n#define ECMA_TYPEDARRAY_SET_ELEMENT(src_p, num, type)                      \\\n  do                                                                       \\\n  {                                                                        \\\n    if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \\\n    {                                                                      \\\n      *(type *) ((void *) src_p) = num;                                    \\\n    }                                                                      \\\n    else                                                                   \\\n    {                                                                      \\\n      memcpy ((void *) src_p, &num, sizeof (type));                        \\\n    }                                                                      \\\n  } while (0)\n\n/**\n * Read an int8_t value from the given arraybuffer\n */\nstatic ecma_value_t\necma_typedarray_get_int8_element (lit_utf8_byte_t *src) /**< the location in the internal arraybuffer */\n{\n  int8_t num = (int8_t) *src;\n  return ecma_make_integer_value (num);\n} /* ecma_typedarray_get_int8_element */\n\n/**\n * Read an uint8_t value from the given arraybuffer\n */\nstatic ecma_value_t\necma_typedarray_get_uint8_element (lit_utf8_byte_t *src) /**< the location in the internal arraybuffer */\n{\n  uint8_t num = (uint8_t) *src;\n  return ecma_make_integer_value (num);\n} /* ecma_typedarray_get_uint8_element */\n\n/**\n * Read an int16_t value from the given arraybuffer\n */\nstatic ecma_value_t\necma_typedarray_get_int16_element (lit_utf8_byte_t *src) /**< the location in the internal arraybuffer */\n{\n  int16_t num;\n  ECMA_TYPEDARRAY_GET_ELEMENT (src, num, int16_t);\n  return ecma_make_integer_value (num);\n} /* ecma_typedarray_get_int16_element */\n\n/**\n * Read an uint16_t value from the given arraybuffer\n */\nstatic ecma_value_t\necma_typedarray_get_uint16_element (lit_utf8_byte_t *src) /**< the location in the internal arraybuffer */\n{\n  uint16_t num;\n  ECMA_TYPEDARRAY_GET_ELEMENT (src, num, uint16_t);\n  return ecma_make_integer_value (num);\n} /* ecma_typedarray_get_uint16_element */\n\n/**\n * Read an int32_t value from the given arraybuffer\n */\nstatic ecma_value_t\necma_typedarray_get_int32_element (lit_utf8_byte_t *src) /**< the location in the internal arraybuffer */\n{\n  int32_t num;\n  ECMA_TYPEDARRAY_GET_ELEMENT (src, num, int32_t);\n  return ecma_make_number_value (num);\n} /* ecma_typedarray_get_int32_element */\n\n/**\n * Read an uint32_t value from the given arraybuffer\n */\nstatic ecma_value_t\necma_typedarray_get_uint32_element (lit_utf8_byte_t *src) /**< the location in the internal arraybuffer */\n{\n  uint32_t num;\n  ECMA_TYPEDARRAY_GET_ELEMENT (src, num, uint32_t);\n  return ecma_make_number_value (num);\n} /* ecma_typedarray_get_uint32_element */\n\n/**\n * Read a float value from the given arraybuffer\n */\nstatic ecma_value_t\necma_typedarray_get_float_element (lit_utf8_byte_t *src) /**< the location in the internal arraybuffer */\n{\n  float num;\n  ECMA_TYPEDARRAY_GET_ELEMENT (src, num, float);\n  return ecma_make_number_value (num);\n} /* ecma_typedarray_get_float_element */\n\n/**\n * Read a double value from the given arraybuffer\n */\nstatic ecma_value_t\necma_typedarray_get_double_element (lit_utf8_byte_t *src) /**< the location in the internal arraybuffer */\n{\n  double num;\n  ECMA_TYPEDARRAY_GET_ELEMENT (src, num, double);\n  return ecma_make_number_value (num);\n} /* ecma_typedarray_get_double_element */\n\n#if JERRY_BUILTIN_BIGINT\n/**\n * Read a bigint64 value from the given arraybuffer\n */\nstatic ecma_value_t\necma_typedarray_get_bigint64_element (lit_utf8_byte_t *src) /**< the location in the internal arraybuffer */\n{\n  uint64_t num;\n  ECMA_TYPEDARRAY_GET_ELEMENT (src, num, uint64_t);\n  bool sign = (num >> 63) != 0;\n\n  if (sign)\n  {\n    num = (uint64_t) (-(int64_t) num);\n  }\n\n  return ecma_bigint_create_from_digits (&num, 1, sign);\n} /* ecma_typedarray_get_bigint64_element */\n\n/**\n * Read a biguint64 value from the given arraybuffer\n */\nstatic ecma_value_t\necma_typedarray_get_biguint64_element (lit_utf8_byte_t *src) /**< the location in the internal arraybuffer */\n{\n  uint64_t num;\n  ECMA_TYPEDARRAY_GET_ELEMENT (src, num, uint64_t);\n  return ecma_bigint_create_from_digits (&num, 1, false);\n} /* ecma_typedarray_get_biguint64_element */\n#endif /* JERRY_BUILTIN_BIGINT */\n\n/**\n * Normalize the given ecma_number_t to an uint32_t value\n */\nuint32_t\necma_typedarray_setter_number_to_uint32 (ecma_number_t value) /**< the number value to normalize */\n{\n  uint32_t uint32_value = 0;\n\n  if (!ecma_number_is_nan (value) && !ecma_number_is_infinity (value))\n  {\n    bool is_negative = false;\n\n    if (value < 0)\n    {\n      is_negative = true;\n      value = -value;\n    }\n\n    if (value > ((ecma_number_t) 0xffffffff))\n    {\n      value = (ecma_number_t) (fmod (value, (ecma_number_t) 0x100000000));\n    }\n\n    uint32_value = (uint32_t) value;\n\n    if (is_negative)\n    {\n      uint32_value = (uint32_t) (-(int32_t) uint32_value);\n    }\n  }\n\n  return uint32_value;\n} /* ecma_typedarray_setter_number_to_uint32 */\n\n/**\n * Write an int8_t value into the given arraybuffer\n *\n * @return ECMA_VALUE_ERROR - if the ToNumber operation fails\n *         ECMA_VALUE_TRUE - otherwise\n */\nstatic ecma_value_t\necma_typedarray_set_int8_element (lit_utf8_byte_t *dst_p, /**< the location in the internal arraybuffer */\n                                  ecma_value_t value) /**< the number value to set */\n{\n  ecma_number_t result_num;\n  ecma_value_t to_num = ecma_op_to_numeric (value, &result_num, ECMA_TO_NUMERIC_NO_OPTS);\n\n  if (ECMA_IS_VALUE_ERROR (to_num))\n  {\n    return to_num;\n  }\n\n  int8_t num = (int8_t) ecma_typedarray_setter_number_to_uint32 (result_num);\n  *dst_p = (lit_utf8_byte_t) num;\n  return ECMA_VALUE_TRUE;\n} /* ecma_typedarray_set_int8_element */\n\n/**\n * Write an uint8_t value into the given arraybuffer\n *\n * @return ECMA_VALUE_ERROR - if the ToNumber operation fails\n *         ECMA_VALUE_TRUE - otherwise\n */\nstatic ecma_value_t\necma_typedarray_set_uint8_element (lit_utf8_byte_t *dst_p, /**< the location in the internal arraybuffer */\n                                   ecma_value_t value) /**< the number value to set */\n{\n  ecma_number_t result_num;\n  ecma_value_t to_num = ecma_op_to_numeric (value, &result_num, ECMA_TO_NUMERIC_NO_OPTS);\n\n  if (ECMA_IS_VALUE_ERROR (to_num))\n  {\n    return to_num;\n  }\n\n  uint8_t num = (uint8_t) ecma_typedarray_setter_number_to_uint32 (result_num);\n  *dst_p = (lit_utf8_byte_t) num;\n  return ECMA_VALUE_TRUE;\n} /* ecma_typedarray_set_uint8_element */\n\n/**\n * Write an uint8_t clamped value into the given arraybuffer\n *\n * @return ECMA_VALUE_ERROR - if the ToNumber operation fails\n *         ECMA_VALUE_TRUE - otherwise\n */\nstatic ecma_value_t\necma_typedarray_set_uint8_clamped_element (lit_utf8_byte_t *dst_p, /**< the location in the internal arraybuffer */\n                                           ecma_value_t value) /**< the number value to set */\n{\n  ecma_number_t result_num;\n  ecma_value_t to_num = ecma_op_to_numeric (value, &result_num, ECMA_TO_NUMERIC_NO_OPTS);\n\n  if (ECMA_IS_VALUE_ERROR (to_num))\n  {\n    return to_num;\n  }\n\n  uint8_t clamped;\n\n  if (result_num > 255)\n  {\n    clamped = 255;\n  }\n  else if (result_num <= 0)\n  {\n    clamped = 0;\n  }\n  else\n  {\n    clamped = (uint8_t) result_num;\n\n    if (clamped + 0.5 < result_num || (clamped + 0.5 == result_num && (clamped % 2) == 1))\n    {\n      clamped++;\n    }\n  }\n\n  *dst_p = (lit_utf8_byte_t) clamped;\n  return ECMA_VALUE_TRUE;\n} /* ecma_typedarray_set_uint8_clamped_element */\n\n/**\n * Write an int16_t value into the given arraybuffer\n *\n * @return ECMA_VALUE_ERROR - if the ToNumber operation fails\n *         ECMA_VALUE_TRUE - otherwise\n */\nstatic ecma_value_t\necma_typedarray_set_int16_element (lit_utf8_byte_t *dst_p, /**< the location in the internal arraybuffer */\n                                   ecma_value_t value) /**< the number value to set */\n{\n  ecma_number_t resut_num;\n  ecma_value_t to_num = ecma_op_to_numeric (value, &resut_num, ECMA_TO_NUMERIC_NO_OPTS);\n\n  if (ECMA_IS_VALUE_ERROR (to_num))\n  {\n    return to_num;\n  }\n\n  int16_t num = (int16_t) ecma_typedarray_setter_number_to_uint32 (resut_num);\n  ECMA_TYPEDARRAY_SET_ELEMENT (dst_p, num, int16_t);\n  return ECMA_VALUE_TRUE;\n} /* ecma_typedarray_set_int16_element */\n\n/**\n * Write an uint8_t value into the given arraybuffer\n *\n * @return ECMA_VALUE_ERROR - if the ToNumber operation fails\n *         ECMA_VALUE_TRUE - otherwise\n */\nstatic ecma_value_t\necma_typedarray_set_uint16_element (lit_utf8_byte_t *dst_p, /**< the location in the internal arraybuffer */\n                                    ecma_value_t value) /**< the number value to set */\n{\n  ecma_number_t resut_num;\n  ecma_value_t to_num = ecma_op_to_numeric (value, &resut_num, ECMA_TO_NUMERIC_NO_OPTS);\n\n  if (ECMA_IS_VALUE_ERROR (to_num))\n  {\n    return to_num;\n  }\n\n  uint16_t num = (uint16_t) ecma_typedarray_setter_number_to_uint32 (resut_num);\n  ECMA_TYPEDARRAY_SET_ELEMENT (dst_p, num, uint16_t);\n  return ECMA_VALUE_TRUE;\n} /* ecma_typedarray_set_uint16_element */\n\n/**\n * Write an int32_t value into the given arraybuffer\n *\n * @return ECMA_VALUE_ERROR - if the ToNumber operation fails\n *         ECMA_VALUE_TRUE - otherwise\n */\nstatic ecma_value_t\necma_typedarray_set_int32_element (lit_utf8_byte_t *dst_p, /**< the location in the internal arraybuffer */\n                                   ecma_value_t value) /**< the number value to set */\n{\n  ecma_number_t resut_num;\n  ecma_value_t to_num = ecma_op_to_numeric (value, &resut_num, ECMA_TO_NUMERIC_NO_OPTS);\n\n  if (ECMA_IS_VALUE_ERROR (to_num))\n  {\n    return to_num;\n  }\n\n  int32_t num = (int32_t) ecma_typedarray_setter_number_to_uint32 (resut_num);\n  ECMA_TYPEDARRAY_SET_ELEMENT (dst_p, num, int32_t);\n  return ECMA_VALUE_TRUE;\n} /* ecma_typedarray_set_int32_element */\n\n/**\n * Write an uint32_t value into the given arraybuffer\n *\n * @return ECMA_VALUE_ERROR - if the ToNumber operation fails\n *         ECMA_VALUE_TRUE - otherwise\n */\nstatic ecma_value_t\necma_typedarray_set_uint32_element (lit_utf8_byte_t *dst_p, /**< the location in the internal arraybuffer */\n                                    ecma_value_t value) /**< the number value to set */\n{\n  ecma_number_t resut_num;\n  ecma_value_t to_num = ecma_op_to_numeric (value, &resut_num, ECMA_TO_NUMERIC_NO_OPTS);\n\n  if (ECMA_IS_VALUE_ERROR (to_num))\n  {\n    return to_num;\n  }\n\n  uint32_t num = (uint32_t) ecma_typedarray_setter_number_to_uint32 (resut_num);\n  ECMA_TYPEDARRAY_SET_ELEMENT (dst_p, num, uint32_t);\n  return ECMA_VALUE_TRUE;\n} /* ecma_typedarray_set_uint32_element */\n\n/**\n * Write a float value into the given arraybuffer\n *\n * @return ECMA_VALUE_ERROR - if the ToNumber operation fails\n *         ECMA_VALUE_TRUE - otherwise\n */\nstatic ecma_value_t\necma_typedarray_set_float_element (lit_utf8_byte_t *dst_p, /**< the location in the internal arraybuffer */\n                                   ecma_value_t value) /**< the number value to set */\n{\n  ecma_number_t result_num;\n  ecma_value_t to_num = ecma_op_to_numeric (value, &result_num, ECMA_TO_NUMERIC_NO_OPTS);\n\n  if (ECMA_IS_VALUE_ERROR (to_num))\n  {\n    return to_num;\n  }\n\n  float num = (float) result_num;\n  ECMA_TYPEDARRAY_SET_ELEMENT (dst_p, num, float);\n  return ECMA_VALUE_TRUE;\n} /* ecma_typedarray_set_float_element */\n\n#if JERRY_NUMBER_TYPE_FLOAT64\n/**\n * Write a double value into the given arraybuffer\n *\n * @return ECMA_VALUE_ERROR - if the ToNumber operation fails\n *         ECMA_VALUE_TRUE - otherwise\n */\nstatic ecma_value_t\necma_typedarray_set_double_element (lit_utf8_byte_t *dst_p, /**< the location in the internal arraybuffer */\n                                    ecma_value_t value) /**< the number value to set */\n{\n  ecma_number_t result_num;\n  ecma_value_t to_num = ecma_op_to_numeric (value, &result_num, ECMA_TO_NUMERIC_NO_OPTS);\n\n  if (ECMA_IS_VALUE_ERROR (to_num))\n  {\n    return to_num;\n  }\n\n  double num = (double) result_num;\n  ECMA_TYPEDARRAY_SET_ELEMENT (dst_p, num, double);\n  return ECMA_VALUE_TRUE;\n} /* ecma_typedarray_set_double_element */\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n#if JERRY_BUILTIN_BIGINT\n/**\n * Write a bigint64/biguint64 value into the given arraybuffer\n *\n * @return ECMA_VALUE_ERROR - if the ToBigInt operation fails\n *         ECMA_VALUE_TRUE - otherwise\n */\nstatic ecma_value_t\necma_typedarray_set_bigint_element (lit_utf8_byte_t *dst_p, /**< the location in the internal arraybuffer */\n                                    ecma_value_t value) /**< the bigint value to set */\n{\n  ecma_value_t bigint = ecma_bigint_to_bigint (value, false);\n\n  if (ECMA_IS_VALUE_ERROR (bigint))\n  {\n    return bigint;\n  }\n\n  uint64_t num;\n  bool sign;\n  ecma_bigint_get_digits_and_sign (bigint, &num, 1, &sign);\n\n  if (sign)\n  {\n    num = (uint64_t) (-(int64_t) num);\n  }\n\n  ECMA_TYPEDARRAY_SET_ELEMENT (dst_p, num, uint64_t);\n\n  ecma_free_value (bigint);\n\n  return ECMA_VALUE_TRUE;\n} /* ecma_typedarray_set_bigint_element */\n#endif /* JERRY_BUILTIN_BIGINT */\n\n/**\n * Builtin id of the first %TypedArray% builtin routine intrinsic object\n */\n#define ECMA_FIRST_TYPEDARRAY_BUILTIN_ROUTINE_ID ECMA_BUILTIN_ID_INT8ARRAY\n\n#if JERRY_BUILTIN_BIGINT\n/**\n * Builtin id of the last %TypedArray% builtin routine intrinsic object\n */\n#define ECMA_LAST_TYPEDARRAY_BUILTIN_ROUTINE_ID ECMA_BUILTIN_ID_BIGUINT64ARRAY\n#elif !JERRY_BUILTIN_BIGINT && JERRY_NUMBER_TYPE_FLOAT64\n/**\n * Builtin id of the last %TypedArray% builtin routine intrinsic object\n */\n#define ECMA_LAST_TYPEDARRAY_BUILTIN_ROUTINE_ID ECMA_BUILTIN_ID_FLOAT64ARRAY\n#else /* !JERRY_NUMBER_TYPE_FLOAT64 */\n/**\n * Builtin id of the last %TypedArray% builtin routine intrinsic object\n */\n#define ECMA_LAST_TYPEDARRAY_BUILTIN_ROUTINE_ID ECMA_BUILTIN_ID_FLOAT32ARRAY\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n\n/**\n * Builtin id of the first %TypedArray% builtin prototype intrinsic object\n */\n#define ECMA_FIRST_TYPEDARRAY_BUILTIN_PROTOTYPE_ID ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE\n\n/**\n * List of typedarray getters based on their builtin id\n */\nstatic const ecma_typedarray_getter_fn_t ecma_typedarray_getters[] = {\n  ecma_typedarray_get_int8_element, /**< Int8Array */\n  ecma_typedarray_get_uint8_element, /**< Uint8Array */\n  ecma_typedarray_get_uint8_element, /**< Uint8ClampedArray */\n  ecma_typedarray_get_int16_element, /**< Int16Array */\n  ecma_typedarray_get_uint16_element, /**< Int32Array */\n  ecma_typedarray_get_int32_element, /**< Uint32Array */\n  ecma_typedarray_get_uint32_element, /**< Uint32Array */\n  ecma_typedarray_get_float_element, /**< Float32Array */\n#if JERRY_NUMBER_TYPE_FLOAT64\n  ecma_typedarray_get_double_element, /**< Float64Array */\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#if JERRY_BUILTIN_BIGINT\n  ecma_typedarray_get_bigint64_element, /**< BigInt64Array*/\n  ecma_typedarray_get_biguint64_element, /**< BigUint64Array */\n#endif /* JERRY_BUILTIN_BIGINT */\n};\n\n/**\n * List of typedarray setters based on their builtin id\n */\nstatic const ecma_typedarray_setter_fn_t ecma_typedarray_setters[] = {\n  ecma_typedarray_set_int8_element, /**< Int8Array */\n  ecma_typedarray_set_uint8_element, /**< Uint8Array */\n  ecma_typedarray_set_uint8_clamped_element, /**< Uint8ClampedArray */\n  ecma_typedarray_set_int16_element, /**< Int16Array */\n  ecma_typedarray_set_uint16_element, /**< Int32Array */\n  ecma_typedarray_set_int32_element, /**< Uint32Array */\n  ecma_typedarray_set_uint32_element, /**< Uint32Array */\n  ecma_typedarray_set_float_element, /**< Float32Array */\n#if JERRY_NUMBER_TYPE_FLOAT64\n  ecma_typedarray_set_double_element, /**< Float64Array */\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#if JERRY_BUILTIN_BIGINT\n  ecma_typedarray_set_bigint_element, /**< BigInt64Array */\n  ecma_typedarray_set_bigint_element, /**< BigUInt64Array */\n#endif /* JERRY_BUILTIN_BIGINT */\n};\n\n/**\n * List of typedarray element shift sizes based on their builtin id\n */\nstatic const uint8_t ecma_typedarray_element_shift_sizes[] = {\n  0, /**< Int8Array */\n  0, /**< Uint8Array */\n  0, /**< Uint8ClampedArray */\n  1, /**< Int16Array */\n  1, /**< Uint16Array */\n  2, /**< Int32Array */\n  2, /**< Uint32Array */\n  2, /**< Float32Array */\n#if JERRY_NUMBER_TYPE_FLOAT64\n  3, /**< Float64Array */\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#if JERRY_BUILTIN_BIGINT\n  3, /**< BigInt64Array */\n  3, /**< BigUInt64Array */\n#endif /* JERRY_BUILTIN_BIGINT */\n};\n\n/**\n * List of typedarray class magic strings based on their builtin id\n */\nstatic const uint16_t ecma_typedarray_magic_string_list[] = {\n  (uint16_t) LIT_MAGIC_STRING_INT8_ARRAY_UL, /**< Int8Array */\n  (uint16_t) LIT_MAGIC_STRING_UINT8_ARRAY_UL, /**< Uint8Array */\n  (uint16_t) LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL, /**< Uint8ClampedArray */\n  (uint16_t) LIT_MAGIC_STRING_INT16_ARRAY_UL, /**< Int16Array */\n  (uint16_t) LIT_MAGIC_STRING_UINT16_ARRAY_UL, /**< Uint16Array */\n  (uint16_t) LIT_MAGIC_STRING_INT32_ARRAY_UL, /**< Int32Array */\n  (uint16_t) LIT_MAGIC_STRING_UINT32_ARRAY_UL, /**< Uint32Array */\n  (uint16_t) LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, /**< Float32Array */\n#if JERRY_NUMBER_TYPE_FLOAT64\n  (uint16_t) LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, /**< Float64Array */\n#endif /* JERRY_NUMBER_TYPE_FLOAT64 */\n#if JERRY_BUILTIN_BIGINT\n  (uint16_t) LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, /**< BigInt64Array */\n  (uint16_t) LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, /**< BigUInt64Array */\n#endif /* JERRY_BUILTIN_BIGINT */\n};\n\n/**\n * Get the magic string id of a typedarray\n *\n * @return magic string\n */\nextern inline lit_magic_string_id_t JERRY_ATTR_ALWAYS_INLINE\necma_get_typedarray_magic_string_id (ecma_typedarray_type_t typedarray_id)\n{\n  return (lit_magic_string_id_t) ecma_typedarray_magic_string_list[typedarray_id];\n} /* ecma_get_typedarray_magic_string_id */\n\n/**\n * Get typedarray's getter function callback\n *\n * @return ecma_typedarray_getter_fn_t: the getter function for the given builtin TypedArray id\n */\nextern inline ecma_typedarray_getter_fn_t JERRY_ATTR_ALWAYS_INLINE\necma_get_typedarray_getter_fn (ecma_typedarray_type_t typedarray_id) /**< typedarray id */\n{\n  return ecma_typedarray_getters[typedarray_id];\n} /* ecma_get_typedarray_getter_fn */\n\n/**\n * Get element from a TypedArray\n *\n * @return the value of the element\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_get_typedarray_element (ecma_typedarray_info_t *info_p, /**< typedarray info */\n                             uint32_t index) /**< element index */\n{\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (info_p->array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p) || index >= info_p->length)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  uint8_t *buffer_p = ecma_typedarray_get_buffer (info_p);\n\n  return ecma_typedarray_getters[info_p->id](buffer_p + (index << info_p->shift));\n} /* ecma_get_typedarray_element */\n\n/**\n * Get typedarray's setter function callback\n *\n * @return ecma_typedarray_setter_fn_t: the setter function for the given builtin TypedArray id\n */\nextern inline ecma_typedarray_setter_fn_t JERRY_ATTR_ALWAYS_INLINE\necma_get_typedarray_setter_fn (ecma_typedarray_type_t typedarray_id) /**< typedarray id */\n{\n  return ecma_typedarray_setters[typedarray_id];\n} /* ecma_get_typedarray_setter_fn */\n\n/**\n * set typedarray's element value\n */\nextern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE\necma_set_typedarray_element (ecma_typedarray_info_t *info_p, /**< typedarray info */\n                             ecma_value_t value, /**< value to be set */\n                             uint32_t index) /**< element index */\n{\n  ecma_value_t to_num;\n#if JERRY_BUILTIN_BIGINT\n  if (ECMA_TYPEDARRAY_IS_BIGINT_TYPE (info_p->id))\n  {\n    to_num = ecma_bigint_to_bigint (value, false);\n\n    if (ECMA_IS_VALUE_ERROR (to_num))\n    {\n      return to_num;\n    }\n  }\n  else\n#endif /* JERRY_BUILTIN_BIGINT */\n  {\n    ecma_number_t result_num;\n    to_num = ecma_op_to_numeric (value, &result_num, ECMA_TO_NUMERIC_NO_OPTS);\n\n    if (ECMA_IS_VALUE_ERROR (to_num))\n    {\n      return to_num;\n    }\n  }\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (info_p->array_buffer_p))\n  {\n    ecma_free_value (to_num);\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (info_p->array_buffer_p) || index >= info_p->length)\n  {\n    ecma_free_value (to_num);\n    return ECMA_VALUE_FALSE;\n  }\n\n  uint8_t *buffer_p = ecma_typedarray_get_buffer (info_p);\n\n  ecma_free_value (to_num);\n\n  return ecma_typedarray_setters[info_p->id](buffer_p + (index << info_p->shift), value);\n} /* ecma_set_typedarray_element */\n\n/**\n * Get the element shift size of a TypedArray type.\n *\n * @return uint8_t\n */\nextern inline uint8_t JERRY_ATTR_ALWAYS_INLINE\necma_typedarray_helper_get_shift_size (ecma_typedarray_type_t typedarray_id)\n{\n  return ecma_typedarray_element_shift_sizes[typedarray_id];\n} /* ecma_typedarray_helper_get_shift_size */\n\n/**\n * Check if the builtin is a TypedArray type.\n *\n * @return bool: - true if based on the given id it is a TypedArray\n *               - false if based on the given id it is not a TypedArray\n */\nbool\necma_typedarray_helper_is_typedarray (ecma_builtin_id_t builtin_id) /**< the builtin id of a type **/\n{\n  return ((builtin_id >= ECMA_FIRST_TYPEDARRAY_BUILTIN_ROUTINE_ID)\n          && (builtin_id <= ECMA_LAST_TYPEDARRAY_BUILTIN_ROUTINE_ID));\n} /* ecma_typedarray_helper_is_typedarray */\n\n/**\n * Get the prototype ID of a TypedArray type.\n *\n * @return ecma_builtin_id_t\n */\necma_builtin_id_t\necma_typedarray_helper_get_prototype_id (ecma_typedarray_type_t typedarray_id) /**< the id of the typedarray **/\n{\n  return (ecma_builtin_id_t) (ECMA_FIRST_TYPEDARRAY_BUILTIN_PROTOTYPE_ID + typedarray_id);\n} /* ecma_typedarray_helper_get_prototype_id */\n\n/**\n * Get the constructor ID of a TypedArray type.\n *\n * @return ecma_builtin_id_t\n */\necma_builtin_id_t\necma_typedarray_helper_get_constructor_id (ecma_typedarray_type_t typedarray_id) /**< the id of the typedarray **/\n{\n  return (ecma_builtin_id_t) (ECMA_FIRST_TYPEDARRAY_BUILTIN_ROUTINE_ID + typedarray_id);\n} /* ecma_typedarray_helper_get_constructor_id */\n\n/**\n * Get the built-in TypedArray type of the given object.\n *\n * @return ecma_typedarray_type_t\n */\necma_typedarray_type_t\necma_get_typedarray_id (ecma_object_t *obj_p) /**< typedarray object **/\n{\n  JERRY_ASSERT (ecma_object_is_typedarray (obj_p));\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) obj_p;\n\n  return (ecma_typedarray_type_t) ext_object_p->u.cls.u1.typedarray_type;\n} /* ecma_get_typedarray_id */\n\n/**\n * Get the built-in TypedArray type of the given object.\n *\n * @return ecma_typedarray_type_t\n */\necma_typedarray_type_t\necma_typedarray_helper_builtin_to_typedarray_id (ecma_builtin_id_t builtin_id)\n{\n  JERRY_ASSERT (ecma_typedarray_helper_is_typedarray (builtin_id));\n\n  return (ecma_typedarray_type_t) (builtin_id - ECMA_FIRST_TYPEDARRAY_BUILTIN_ROUTINE_ID);\n} /* ecma_typedarray_helper_builtin_to_typedarray_id */\n\n/**\n * Create a TypedArray object by given array_length\n *\n * See also: ES2015 22.2.1.2.1\n *\n * @return ecma value of the new typedarray object\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_typedarray_create_object_with_length (uint32_t array_length, /**< length of the typedarray */\n                                           ecma_object_t *src_buffer_p, /**< source buffer */\n                                           ecma_object_t *proto_p, /**< prototype object */\n                                           uint8_t element_size_shift, /**< the size shift of the element length */\n                                           ecma_typedarray_type_t typedarray_id) /**< id of the typedarray */\n{\n  uint32_t byte_length = UINT32_MAX;\n\n  if (array_length <= (UINT32_MAX >> element_size_shift))\n  {\n    byte_length = array_length << element_size_shift;\n  }\n\n  if (byte_length > UINT32_MAX - sizeof (ecma_extended_object_t) - JMEM_ALIGNMENT + 1)\n  {\n#if JERRY_ERROR_MESSAGES\n    ecma_value_t array_length_value = ecma_make_number_value (array_length);\n\n    ecma_value_t result =\n      ecma_raise_standard_error_with_format (JERRY_ERROR_RANGE, \"Invalid typed array length: %\", array_length_value);\n    ecma_free_value (array_length_value);\n    return result;\n#else /* !JERRY_ERROR_MESSAGES */\n    return ecma_raise_range_error (ECMA_ERR_EMPTY);\n#endif /* JERRY_ERROR_MESSAGES */\n  }\n\n  ecma_object_t *new_arraybuffer_p = NULL;\n  if (src_buffer_p == NULL)\n  {\n    new_arraybuffer_p = ecma_arraybuffer_new_object (byte_length);\n  }\n  else\n  {\n    ecma_value_t ctor_proto = ecma_op_species_constructor (src_buffer_p, ECMA_BUILTIN_ID_ARRAYBUFFER);\n\n    if (ECMA_IS_VALUE_ERROR (ctor_proto))\n    {\n      return ctor_proto;\n    }\n\n    ecma_object_t *ctor_proto_p = ecma_get_object_from_value (ctor_proto);\n\n    ecma_object_t *prototype_p =\n      ecma_op_get_prototype_from_constructor (ctor_proto_p, ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE);\n\n    ecma_deref_object (ctor_proto_p);\n\n    if (JERRY_UNLIKELY (prototype_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    new_arraybuffer_p = ecma_arraybuffer_new_object (byte_length);\n\n    ECMA_SET_NON_NULL_POINTER (new_arraybuffer_p->u2.prototype_cp, prototype_p);\n\n    ecma_deref_object (prototype_p);\n\n    if (ecma_arraybuffer_is_detached (src_buffer_p))\n    {\n      ecma_deref_object (new_arraybuffer_p);\n      return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n    }\n  }\n\n  ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_TYPEDARRAY;\n  ext_object_p->u.cls.u1.typedarray_type = (uint8_t) typedarray_id;\n  ext_object_p->u.cls.u2.typedarray_flags = 0;\n  ext_object_p->u.cls.u3.arraybuffer = ecma_make_object_value (new_arraybuffer_p);\n\n  ecma_deref_object (new_arraybuffer_p);\n\n  return ecma_make_object_value (object_p);\n} /* ecma_typedarray_create_object_with_length */\n\n/**\n * Create a TypedArray object by given another TypedArray object\n *\n * See also: ES2015 22.2.1.3\n *\n * @return ecma value of the new typedarray object\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t\necma_typedarray_create_object_with_typedarray (ecma_object_t *typedarray_p, /**< a typedarray object */\n                                               ecma_object_t *proto_p, /**< prototype object */\n                                               uint8_t element_size_shift, /**< the size shift of the element length */\n                                               ecma_typedarray_type_t typedarray_id) /**< id of the typedarray */\n{\n  uint32_t array_length = ecma_typedarray_get_length (typedarray_p);\n  ecma_object_t *src_arraybuffer_p = ecma_typedarray_get_arraybuffer (typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (src_arraybuffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (src_arraybuffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  ecma_value_t new_typedarray = ecma_typedarray_create_object_with_length (array_length,\n                                                                           src_arraybuffer_p,\n                                                                           proto_p,\n                                                                           element_size_shift,\n                                                                           typedarray_id);\n\n  if (ECMA_IS_VALUE_ERROR (new_typedarray))\n  {\n    return new_typedarray;\n  }\n\n  ecma_object_t *new_typedarray_p = ecma_get_object_from_value (new_typedarray);\n  ecma_object_t *dst_arraybuffer_p = ecma_typedarray_get_arraybuffer (new_typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (dst_arraybuffer_p))\n  {\n    ecma_deref_object (new_typedarray_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (dst_arraybuffer_p))\n  {\n    ecma_deref_object (new_typedarray_p);\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  lit_utf8_byte_t *src_buf_p = ecma_arraybuffer_get_buffer (src_arraybuffer_p);\n  lit_utf8_byte_t *dst_buf_p = ecma_arraybuffer_get_buffer (dst_arraybuffer_p);\n\n  src_buf_p += ecma_typedarray_get_offset (typedarray_p);\n\n  ecma_typedarray_type_t src_id = ecma_get_typedarray_id (typedarray_p);\n\n  if (src_id == typedarray_id)\n  {\n    memcpy (dst_buf_p, src_buf_p, array_length << element_size_shift);\n  }\n  else\n  {\n#if JERRY_BUILTIN_BIGINT\n    if ((ECMA_TYPEDARRAY_IS_BIGINT_TYPE (src_id) ^ ECMA_TYPEDARRAY_IS_BIGINT_TYPE (typedarray_id)) == 1)\n    {\n      ecma_deref_object (new_typedarray_p);\n      return ecma_raise_type_error (ECMA_ERR_INCOMPATIBLE_TYPEDARRAY_TYPES);\n    }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n    uint32_t src_element_size = 1u << ecma_typedarray_get_element_size_shift (typedarray_p);\n    uint32_t dst_element_size = 1u << element_size_shift;\n    ecma_typedarray_getter_fn_t src_typedarray_getter_cb = ecma_get_typedarray_getter_fn (src_id);\n    ecma_typedarray_setter_fn_t target_typedarray_setter_cb = ecma_get_typedarray_setter_fn (typedarray_id);\n\n    for (uint32_t i = 0; i < array_length; i++)\n    {\n      /* Convert values from source to destination format. */\n      ecma_value_t tmp = src_typedarray_getter_cb (src_buf_p);\n      ecma_value_t set_element = target_typedarray_setter_cb (dst_buf_p, tmp);\n\n      ecma_free_value (tmp);\n\n      if (ECMA_IS_VALUE_ERROR (set_element))\n      {\n        ecma_deref_object (new_typedarray_p);\n        return set_element;\n      }\n\n      src_buf_p += src_element_size;\n      dst_buf_p += dst_element_size;\n    }\n  }\n\n  return new_typedarray;\n} /* ecma_typedarray_create_object_with_typedarray */\n\n/**\n * Helper method for ecma_op_typedarray_from\n *\n * @return ECMA_VALUE_TRUE - if setting the given value to the new typedarray was successful\n *         ECMA_VALUE_ERROR - otherwise\n */\nstatic ecma_value_t\necma_op_typedarray_from_helper (ecma_value_t this_val, /**< this_arg for the above from function */\n                                ecma_value_t current_value, /**< given value to set */\n                                uint32_t index, /**< currrent index */\n                                ecma_object_t *func_object_p, /**< map function object */\n                                uint8_t *buffer_p, /**< target buffer */\n                                ecma_typedarray_setter_fn_t setter_cb) /**< setter callback function */\n{\n  ecma_value_t mapped_value = current_value;\n\n  if (func_object_p != NULL)\n  {\n    /* 17.d 17.f */\n    ecma_value_t current_index = ecma_make_uint32_value (index);\n    ecma_value_t call_args[] = { current_value, current_index };\n\n    ecma_value_t cb_value = ecma_op_function_call (func_object_p, this_val, call_args, 2);\n\n    ecma_free_value (current_value);\n    ecma_free_value (current_index);\n\n    if (ECMA_IS_VALUE_ERROR (cb_value))\n    {\n      return cb_value;\n    }\n\n    mapped_value = cb_value;\n  }\n\n  ecma_value_t set_element = setter_cb (buffer_p, mapped_value);\n  ecma_free_value (mapped_value);\n\n  if (ECMA_IS_VALUE_ERROR (set_element))\n  {\n    return set_element;\n  }\n\n  return ECMA_VALUE_TRUE;\n} /* ecma_op_typedarray_from_helper */\n\n/**\n * Create a TypedArray object by transforming from an array-like object or iterable object\n *\n * See also: ES11 22.2.4.4\n *\n * @return ecma value of the new typedarray object\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_typedarray_create_object_with_object (ecma_value_t items_val, /**< the source array-like object */\n                                           ecma_object_t *proto_p, /**< prototype object */\n                                           uint8_t element_size_shift, /**< the size shift of the element length */\n                                           ecma_typedarray_type_t typedarray_id) /**< id of the typedarray */\n{\n  /* 5 */\n  ecma_value_t using_iterator = ecma_op_get_method_by_symbol_id (items_val, LIT_GLOBAL_SYMBOL_ITERATOR);\n\n  if (ECMA_IS_VALUE_ERROR (using_iterator))\n  {\n    return using_iterator;\n  }\n\n  /* 6 */\n  if (!ecma_is_value_undefined (using_iterator))\n  {\n    /* 6.a */\n    ecma_value_t next_method;\n    ecma_value_t iterator = ecma_op_get_iterator (items_val, using_iterator, &next_method);\n    ecma_free_value (using_iterator);\n\n    if (ECMA_IS_VALUE_ERROR (iterator))\n    {\n      return iterator;\n    }\n\n    ecma_collection_t *values_p = ecma_new_collection ();\n    ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n    while (true)\n    {\n      ecma_value_t next = ecma_op_iterator_step (iterator, next_method);\n\n      if (ECMA_IS_VALUE_ERROR (next))\n      {\n        ret_value = next;\n        break;\n      }\n\n      if (next == ECMA_VALUE_FALSE)\n      {\n        break;\n      }\n\n      ecma_value_t next_value = ecma_op_iterator_value (next);\n      ecma_free_value (next);\n\n      if (ECMA_IS_VALUE_ERROR (next_value))\n      {\n        ret_value = next_value;\n        break;\n      }\n\n      ecma_collection_push_back (values_p, next_value);\n    }\n\n    ecma_free_value (iterator);\n    ecma_free_value (next_method);\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      ecma_collection_free (values_p);\n      return ret_value;\n    }\n\n    /* 8.c */\n    ecma_value_t new_typedarray = ecma_typedarray_create_object_with_length (values_p->item_count,\n                                                                             NULL,\n                                                                             proto_p,\n                                                                             element_size_shift,\n                                                                             typedarray_id);\n\n    if (ECMA_IS_VALUE_ERROR (new_typedarray))\n    {\n      ecma_collection_free (values_p);\n      return new_typedarray;\n    }\n\n    ecma_object_t *new_typedarray_p = ecma_get_object_from_value (new_typedarray);\n    ecma_typedarray_info_t info = ecma_typedarray_get_info (new_typedarray_p);\n    ecma_value_t *next_value_p = values_p->buffer_p;\n\n    ret_value = ECMA_VALUE_ERROR;\n\n    if (ECMA_ARRAYBUFFER_LAZY_ALLOC (info.array_buffer_p))\n    {\n      goto free_collection;\n    }\n\n    if (ecma_arraybuffer_is_detached (info.array_buffer_p))\n    {\n      ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n      goto free_collection;\n    }\n\n    uint8_t *buffer_p = ecma_typedarray_get_buffer (&info);\n\n    ecma_typedarray_setter_fn_t setter_cb = ecma_get_typedarray_setter_fn (info.id);\n    uint8_t *limit_p = buffer_p + (values_p->item_count << info.shift);\n\n    ret_value = ecma_make_object_value (new_typedarray_p);\n\n    /* 8.e */\n    while (buffer_p < limit_p)\n    {\n      ecma_value_t value = *next_value_p++;\n      ecma_value_t set_value = setter_cb (buffer_p, value);\n      ecma_free_value (value);\n\n      if (ECMA_IS_VALUE_ERROR (set_value))\n      {\n        ret_value = set_value;\n        break;\n      }\n\n      buffer_p += info.element_size;\n    }\n\nfree_collection:\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      ecma_value_t *last_value_p = values_p->buffer_p + values_p->item_count;\n\n      while (next_value_p < last_value_p)\n      {\n        ecma_free_value (*next_value_p++);\n      }\n\n      ecma_deref_object (new_typedarray_p);\n    }\n\n    ecma_collection_destroy (values_p);\n    return ret_value;\n  }\n\n  /* 8 */\n  ecma_value_t arraylike_object_val = ecma_op_to_object (items_val);\n\n  if (ECMA_IS_VALUE_ERROR (arraylike_object_val))\n  {\n    return arraylike_object_val;\n  }\n\n  ecma_object_t *arraylike_object_p = ecma_get_object_from_value (arraylike_object_val);\n\n  /* 9 */\n  ecma_length_t length_index;\n  ecma_value_t len_value = ecma_op_object_get_length (arraylike_object_p, &length_index);\n\n  if (ECMA_IS_VALUE_ERROR (len_value))\n  {\n    ecma_deref_object (arraylike_object_p);\n    return len_value;\n  }\n\n  if (length_index >= UINT32_MAX)\n  {\n    ecma_deref_object (arraylike_object_p);\n    return ecma_raise_range_error (ECMA_ERR_INVALID_TYPEDARRAY_LENGTH);\n  }\n\n  uint32_t len = (uint32_t) length_index;\n\n  /* 10 */\n  ecma_value_t new_typedarray =\n    ecma_typedarray_create_object_with_length (len, NULL, proto_p, element_size_shift, typedarray_id);\n\n  if (ECMA_IS_VALUE_ERROR (new_typedarray))\n  {\n    ecma_deref_object (arraylike_object_p);\n    return new_typedarray;\n  }\n\n  ecma_object_t *new_typedarray_p = ecma_get_object_from_value (new_typedarray);\n  ecma_typedarray_info_t info = ecma_typedarray_get_info (new_typedarray_p);\n\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (info.array_buffer_p))\n  {\n    goto free_object;\n  }\n\n  if (ecma_arraybuffer_is_detached (info.array_buffer_p))\n  {\n    ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n    goto free_object;\n  }\n\n  uint8_t *buffer_p = ecma_typedarray_get_buffer (&info);\n\n  ecma_typedarray_setter_fn_t setter_cb = ecma_get_typedarray_setter_fn (info.id);\n\n  ret_value = ecma_make_object_value (new_typedarray_p);\n\n  /* 12 */\n  for (uint32_t index = 0; index < len; index++)\n  {\n    ecma_value_t value = ecma_op_object_find_by_index (arraylike_object_p, index);\n\n    if (ECMA_IS_VALUE_ERROR (value))\n    {\n      ret_value = value;\n      break;\n    }\n\n    if (!ecma_is_value_found (value))\n    {\n      value = ECMA_VALUE_UNDEFINED;\n    }\n\n    ecma_value_t set_value = setter_cb (buffer_p, value);\n    ecma_free_value (value);\n\n    if (ECMA_IS_VALUE_ERROR (set_value))\n    {\n      ret_value = set_value;\n      break;\n    }\n\n    buffer_p += info.element_size;\n  }\n\nfree_object:\n  ecma_deref_object (arraylike_object_p);\n\n  if (ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    ecma_deref_object (new_typedarray_p);\n  }\n\n  return ret_value;\n} /* ecma_typedarray_create_object_with_object */\n\n/**\n * Create a TypedArray object by transforming from an array-like object or iterable object\n *\n * See also: ES11 22.2.2.1\n *\n * @return ecma value of the new typedarray object\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_typedarray_from (ecma_value_t this_val, /**< this value */\n                         ecma_value_t source_val, /**< source value */\n                         ecma_value_t map_fn_val, /**< mapped function value */\n                         ecma_value_t this_arg) /**< this argument */\n{\n  JERRY_UNUSED (this_arg);\n  /* 3 */\n  JERRY_ASSERT (ecma_op_is_callable (map_fn_val) || ecma_is_value_undefined (map_fn_val));\n\n  /* 4 */\n  ecma_object_t *func_object_p = NULL;\n\n  if (!ecma_is_value_undefined (map_fn_val))\n  {\n    func_object_p = ecma_get_object_from_value (map_fn_val);\n  }\n\n  /* 5 */\n  ecma_value_t using_iterator = ecma_op_get_method_by_symbol_id (source_val, LIT_GLOBAL_SYMBOL_ITERATOR);\n\n  if (ECMA_IS_VALUE_ERROR (using_iterator))\n  {\n    return using_iterator;\n  }\n\n  /* 6 */\n  if (!ecma_is_value_undefined (using_iterator))\n  {\n    /* 6.a */\n    ecma_value_t next_method;\n    ecma_value_t iterator = ecma_op_get_iterator (source_val, using_iterator, &next_method);\n    ecma_free_value (using_iterator);\n\n    /* 6.b */\n    if (ECMA_IS_VALUE_ERROR (iterator))\n    {\n      return iterator;\n    }\n\n    /* 6.c */\n    ecma_collection_t *values_p = ecma_new_collection ();\n    ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n    /* 6.e */\n    while (true)\n    {\n      ecma_value_t next = ecma_op_iterator_step (iterator, next_method);\n\n      if (ECMA_IS_VALUE_ERROR (next))\n      {\n        ret_value = next;\n        break;\n      }\n\n      if (next == ECMA_VALUE_FALSE)\n      {\n        break;\n      }\n\n      ecma_value_t next_value = ecma_op_iterator_value (next);\n      ecma_free_value (next);\n\n      if (ECMA_IS_VALUE_ERROR (next_value))\n      {\n        ret_value = next_value;\n        break;\n      }\n\n      ecma_collection_push_back (values_p, next_value);\n    }\n\n    ecma_free_value (iterator);\n    ecma_free_value (next_method);\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      ecma_collection_free (values_p);\n      return ret_value;\n    }\n\n    /* 6.c */\n    ecma_object_t *constructor_obj_p = ecma_get_object_from_value (this_val);\n    ecma_value_t len_val = ecma_make_uint32_value (values_p->item_count);\n    ecma_value_t new_typedarray = ecma_typedarray_create (constructor_obj_p, &len_val, 1);\n    ecma_free_value (len_val);\n\n    if (ECMA_IS_VALUE_ERROR (new_typedarray))\n    {\n      ecma_collection_free (values_p);\n      return new_typedarray;\n    }\n\n    ecma_object_t *new_typedarray_p = ecma_get_object_from_value (new_typedarray);\n    ecma_typedarray_info_t info = ecma_typedarray_get_info (new_typedarray_p);\n    ecma_typedarray_setter_fn_t setter_cb = ecma_get_typedarray_setter_fn (info.id);\n    ecma_value_t *next_value_p = values_p->buffer_p;\n\n    ret_value = ECMA_VALUE_ERROR;\n\n    if (ECMA_ARRAYBUFFER_LAZY_ALLOC (info.array_buffer_p))\n    {\n      goto free_collection;\n    }\n\n    if (ecma_arraybuffer_is_detached (info.array_buffer_p))\n    {\n      ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n      goto free_collection;\n    }\n\n    uint8_t *buffer_p = ecma_typedarray_get_buffer (&info);\n\n    ret_value = ecma_make_object_value (new_typedarray_p);\n\n    /* 6.e */\n    for (uint32_t index = 0; index < values_p->item_count; index++)\n    {\n      ecma_value_t set_value =\n        ecma_op_typedarray_from_helper (this_arg, *next_value_p++, index, func_object_p, buffer_p, setter_cb);\n\n      if (ECMA_IS_VALUE_ERROR (set_value))\n      {\n        ret_value = set_value;\n        break;\n      }\n\n      buffer_p += info.element_size;\n    }\n\nfree_collection:\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      ecma_value_t *last_value_p = values_p->buffer_p + values_p->item_count;\n\n      while (next_value_p < last_value_p)\n      {\n        ecma_free_value (*next_value_p++);\n      }\n\n      ecma_deref_object (new_typedarray_p);\n    }\n\n    ecma_collection_destroy (values_p);\n    return ret_value;\n  }\n\n  /* 8 */\n  ecma_value_t arraylike_object_val = ecma_op_to_object (source_val);\n\n  if (ECMA_IS_VALUE_ERROR (arraylike_object_val))\n  {\n    return arraylike_object_val;\n  }\n\n  ecma_object_t *arraylike_object_p = ecma_get_object_from_value (arraylike_object_val);\n\n  /* 9 */\n  ecma_length_t length_index;\n  ecma_value_t len_value = ecma_op_object_get_length (arraylike_object_p, &length_index);\n\n  if (ECMA_IS_VALUE_ERROR (len_value))\n  {\n    ecma_deref_object (arraylike_object_p);\n    return len_value;\n  }\n\n  if (length_index >= UINT32_MAX)\n  {\n    ecma_deref_object (arraylike_object_p);\n    return ecma_raise_range_error (ECMA_ERR_INVALID_TYPEDARRAY_LENGTH);\n  }\n\n  uint32_t len = (uint32_t) length_index;\n\n  /* 10 */\n  ecma_object_t *constructor_obj_p = ecma_get_object_from_value (this_val);\n  ecma_value_t len_val = ecma_make_uint32_value (len);\n  ecma_value_t new_typedarray = ecma_typedarray_create (constructor_obj_p, &len_val, 1);\n  ecma_free_value (len_val);\n\n  if (ECMA_IS_VALUE_ERROR (new_typedarray))\n  {\n    ecma_deref_object (arraylike_object_p);\n    return new_typedarray;\n  }\n\n  ecma_object_t *new_typedarray_p = ecma_get_object_from_value (new_typedarray);\n  ecma_typedarray_info_t info = ecma_typedarray_get_info (new_typedarray_p);\n\n  ecma_value_t ret_value = ECMA_VALUE_ERROR;\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (info.array_buffer_p))\n  {\n    goto free_object;\n  }\n\n  if (ecma_arraybuffer_is_detached (info.array_buffer_p))\n  {\n    ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n    goto free_object;\n  }\n\n  uint8_t *buffer_p = ecma_typedarray_get_buffer (&info);\n\n  ecma_typedarray_setter_fn_t setter_cb = ecma_get_typedarray_setter_fn (info.id);\n\n  ret_value = ecma_make_object_value (new_typedarray_p);\n\n  /* 12 */\n  for (uint32_t index = 0; index < len; index++)\n  {\n    ecma_value_t value = ecma_op_object_find_by_index (arraylike_object_p, index);\n\n    if (ECMA_IS_VALUE_ERROR (value))\n    {\n      ret_value = value;\n      break;\n    }\n\n    if (!ecma_is_value_found (value))\n    {\n      value = ECMA_VALUE_UNDEFINED;\n    }\n\n    ecma_value_t set_value =\n      ecma_op_typedarray_from_helper (this_arg, value, index, func_object_p, buffer_p, setter_cb);\n\n    if (ECMA_IS_VALUE_ERROR (set_value))\n    {\n      ret_value = set_value;\n      break;\n    }\n\n    buffer_p += info.element_size;\n  }\n\nfree_object:\n  ecma_deref_object (arraylike_object_p);\n\n  if (ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    ecma_deref_object (new_typedarray_p);\n  }\n\n  return ret_value;\n} /* ecma_op_typedarray_from */\n\n/**\n * Get the arraybuffer of the typedarray object\n *\n * @return the pointer to the internal arraybuffer\n */\nextern inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE\necma_typedarray_get_arraybuffer (ecma_object_t *typedarray_p) /**< the pointer to the typedarray object */\n{\n  JERRY_ASSERT (ecma_object_is_typedarray (typedarray_p));\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) typedarray_p;\n\n  return ecma_get_object_from_value (ext_object_p->u.cls.u3.arraybuffer);\n} /* ecma_typedarray_get_arraybuffer */\n\n/**\n * Get the element size shift in the typedarray object\n *\n * @return the size shift of the element, size is 1 << shift\n */\nuint8_t\necma_typedarray_get_element_size_shift (ecma_object_t *typedarray_p) /**< the pointer to the typedarray object */\n{\n  JERRY_ASSERT (ecma_object_is_typedarray (typedarray_p));\n\n  return ecma_typedarray_helper_get_shift_size (ecma_get_typedarray_id (typedarray_p));\n} /* ecma_typedarray_get_element_size_shift */\n\n/**\n * Get the array length of the typedarray object\n *\n * @return the array length\n */\nuint32_t\necma_typedarray_get_length (ecma_object_t *typedarray_p) /**< the pointer to the typedarray object */\n{\n  JERRY_ASSERT (ecma_object_is_typedarray (typedarray_p));\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) typedarray_p;\n\n  if (!(ext_object_p->u.cls.u2.typedarray_flags & ECMA_TYPEDARRAY_IS_EXTENDED))\n  {\n    ecma_object_t *arraybuffer_p = ecma_get_object_from_value (ext_object_p->u.cls.u3.arraybuffer);\n    ecma_extended_object_t *arraybuffer_object_p = (ecma_extended_object_t *) arraybuffer_p;\n    uint32_t buffer_length = arraybuffer_object_p->u.cls.u3.length;\n    uint8_t shift = ecma_typedarray_get_element_size_shift (typedarray_p);\n\n    return buffer_length >> shift;\n  }\n\n  ecma_object_t *arraybuffer_p = ecma_typedarray_get_arraybuffer (typedarray_p);\n\n  if (ecma_arraybuffer_is_detached (arraybuffer_p))\n  {\n    return 0;\n  }\n\n  ecma_extended_typedarray_object_t *info_p = (ecma_extended_typedarray_object_t *) ext_object_p;\n\n  return info_p->array_length;\n} /* ecma_typedarray_get_length */\n\n/**\n * Get the offset of the internal arraybuffer\n *\n * @return the offset\n */\nuint32_t\necma_typedarray_get_offset (ecma_object_t *typedarray_p) /**< the pointer to the typedarray object */\n{\n  JERRY_ASSERT (ecma_object_is_typedarray (typedarray_p));\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) typedarray_p;\n\n  if (!(ext_object_p->u.cls.u2.typedarray_flags & ECMA_TYPEDARRAY_IS_EXTENDED))\n  {\n    return 0;\n  }\n\n  ecma_object_t *arraybuffer_p = ecma_typedarray_get_arraybuffer (typedarray_p);\n\n  if (ecma_arraybuffer_is_detached (arraybuffer_p))\n  {\n    return 0;\n  }\n\n  ecma_extended_typedarray_object_t *info_p = (ecma_extended_typedarray_object_t *) ext_object_p;\n\n  return info_p->byte_offset;\n} /* ecma_typedarray_get_offset */\n\n/**\n * Utility function: return the pointer of the data buffer referenced by the typedarray info\n *\n * @return pointer to the data buffer if successfull,\n *         NULL otherwise\n */\nextern inline uint8_t *\necma_typedarray_get_buffer (ecma_typedarray_info_t *info_p) /**< typedarray info */\n{\n  return ecma_arraybuffer_get_buffer (info_p->array_buffer_p) + info_p->offset;\n} /* ecma_typedarray_get_buffer */\n\n/**\n * Create a new typedarray object.\n *\n * The struct of the typedarray object\n *   ecma_object_t\n *   extend_part\n *   typedarray_info\n *\n * @return ecma value of the new typedarray object\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\necma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg list passed to typedarray construct */\n                           uint32_t arguments_list_len, /**< the length of the arguments_list_p */\n                           ecma_object_t *proto_p, /**< prototype object */\n                           uint8_t element_size_shift, /**< the size shift of the element length */\n                           ecma_typedarray_type_t typedarray_id) /**< id of the typedarray */\n{\n  JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);\n\n  if (arguments_list_len == 0)\n  {\n    /* 22.2.1.1 */\n    return ecma_typedarray_create_object_with_length (0, NULL, proto_p, element_size_shift, typedarray_id);\n  }\n\n  if (!ecma_is_value_object (arguments_list_p[0]))\n  {\n    ecma_number_t num = 0;\n\n    if (!ecma_is_value_undefined (arguments_list_p[0])\n        && ECMA_IS_VALUE_ERROR (ecma_op_to_index (arguments_list_p[0], &num)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    JERRY_ASSERT (num >= 0 && num <= ECMA_NUMBER_MAX_SAFE_INTEGER);\n\n    if (num > UINT32_MAX)\n    {\n#if JERRY_ERROR_MESSAGES\n      return ecma_raise_standard_error_with_format (JERRY_ERROR_RANGE,\n                                                    \"Invalid typed array length: %\",\n                                                    arguments_list_p[0]);\n#else /* !JERRY_ERROR_MESSAGES */\n      return ecma_raise_range_error (ECMA_ERR_EMPTY);\n#endif /* JERRY_ERROR_MESSAGES */\n    }\n\n    return ecma_typedarray_create_object_with_length ((uint32_t) num, NULL, proto_p, element_size_shift, typedarray_id);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (arguments_list_p[0]);\n\n  if (ecma_object_is_typedarray (obj_p))\n  {\n    /* 22.2.1.3 */\n    ecma_object_t *typedarray_p = obj_p;\n    return ecma_typedarray_create_object_with_typedarray (typedarray_p, proto_p, element_size_shift, typedarray_id);\n  }\n\n  if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER) && !ecma_object_is_shared_arraybuffer (obj_p))\n  {\n    /* 22.2.1.4 */\n    return ecma_typedarray_create_object_with_object (arguments_list_p[0], proto_p, element_size_shift, typedarray_id);\n  }\n\n  /* 22.2.1.5 */\n  ecma_object_t *arraybuffer_p = obj_p;\n  ecma_value_t byte_offset_value = ((arguments_list_len > 1) ? arguments_list_p[1] : ECMA_VALUE_UNDEFINED);\n\n  ecma_value_t length_value = ((arguments_list_len > 2) ? arguments_list_p[2] : ECMA_VALUE_UNDEFINED);\n\n  ecma_number_t offset;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_op_to_index (byte_offset_value, &offset)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_number_is_negative (offset) || fmod (offset, (1 << element_size_shift)) != 0)\n  {\n    /* ES2015 22.2.1.5: 9 - 10. */\n    if (ecma_number_is_zero (offset))\n    {\n      offset = 0;\n    }\n    else\n    {\n      return ecma_raise_range_error (ECMA_ERR_INVALID_OFFSET);\n    }\n  }\n\n  ecma_number_t new_length = 0;\n\n  if (ECMA_IS_VALUE_ERROR (ecma_op_to_index (length_value, &new_length)))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (arraybuffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  if (offset > UINT32_MAX)\n  {\n    return ecma_raise_range_error (ECMA_ERR_INVALID_LENGTH);\n  }\n\n  uint32_t byte_offset = (uint32_t) offset;\n\n  uint32_t buf_byte_length = ecma_arraybuffer_get_length (arraybuffer_p);\n  uint32_t new_byte_length = 0;\n\n  if (ecma_is_value_undefined (length_value))\n  {\n    if ((buf_byte_length % (uint32_t) (1 << element_size_shift) != 0) || (buf_byte_length < byte_offset))\n    {\n      return ecma_raise_range_error (ECMA_ERR_INVALID_LENGTH);\n    }\n\n    new_byte_length = (uint32_t) (buf_byte_length - byte_offset);\n  }\n  else\n  {\n    if (new_length > (UINT32_MAX >> element_size_shift))\n    {\n      return ecma_raise_range_error (ECMA_ERR_MAXIMUM_TYPEDARRAY_SIZE_IS_REACHED);\n    }\n\n    new_byte_length = (uint32_t) new_length << element_size_shift;\n\n    if (byte_offset > buf_byte_length || new_byte_length > (buf_byte_length - byte_offset))\n    {\n      return ecma_raise_range_error (ECMA_ERR_INVALID_LENGTH);\n    }\n  }\n\n  bool needs_ext_typedarray_obj = (byte_offset != 0 || new_byte_length != buf_byte_length);\n\n  size_t object_size =\n    (needs_ext_typedarray_obj ? sizeof (ecma_extended_typedarray_object_t) : sizeof (ecma_extended_object_t));\n\n  ecma_object_t *object_p = ecma_create_object (proto_p, object_size, ECMA_OBJECT_TYPE_CLASS);\n\n  ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n  ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_TYPEDARRAY;\n  ext_object_p->u.cls.u1.typedarray_type = (uint8_t) typedarray_id;\n  ext_object_p->u.cls.u2.typedarray_flags = 0;\n  ext_object_p->u.cls.u3.arraybuffer = ecma_make_object_value (arraybuffer_p);\n\n  if (needs_ext_typedarray_obj)\n  {\n    ext_object_p->u.cls.u2.typedarray_flags |= ECMA_TYPEDARRAY_IS_EXTENDED;\n\n    ecma_extended_typedarray_object_t *typedarray_info_p = (ecma_extended_typedarray_object_t *) object_p;\n    typedarray_info_p->array_length = new_byte_length >> element_size_shift;\n    typedarray_info_p->byte_offset = byte_offset;\n  }\n\n  return ecma_make_object_value (object_p);\n} /* ecma_op_create_typedarray */\n\n/**\n * Helper function for typedArray.prototype object's {'keys', 'values', 'entries', '@@iterator'}\n * routines common parts.\n *\n * See also:\n *          ECMA-262 v6, 22.2.3.15\n *          ECMA-262 v6, 22.2.3.29\n *          ECMA-262 v6, 22.2.3.6\n *          ECMA-262 v6, 22.1.3.30\n *\n * Note:\n *      Returned value must be freed with ecma_free_value.\n *\n * @return iterator result object, if success\n *         error - otherwise\n */\necma_value_t\necma_typedarray_iterators_helper (ecma_value_t this_arg, /**< this argument */\n                                  ecma_iterator_kind_t kind) /**< iterator kind */\n{\n  JERRY_ASSERT (ecma_is_typedarray (this_arg));\n\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (this_arg);\n  ecma_typedarray_info_t info = ecma_typedarray_get_info (typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (info.array_buffer_p))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (info.array_buffer_p))\n  {\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY_ITERATOR_PROTOTYPE);\n\n  return ecma_op_create_iterator_object (this_arg, prototype_obj_p, ECMA_OBJECT_CLASS_ARRAY_ITERATOR, kind);\n} /* ecma_typedarray_iterators_helper */\n\n/**\n * Check if the object is typedarray\n *\n * @return true - if object is a TypedArray object\n *         false - otherwise\n */\nbool\necma_object_is_typedarray (ecma_object_t *obj_p) /**< the target object need to be checked */\n{\n  JERRY_ASSERT (!ecma_is_lexical_environment (obj_p));\n\n  return ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_TYPEDARRAY);\n} /* ecma_object_is_typedarray */\n\n/**\n * Check if the value is typedarray\n *\n * @return true - if value is a TypedArray object\n *         false - otherwise\n */\nbool\necma_is_typedarray (ecma_value_t value) /**< the target need to be checked */\n{\n  if (!ecma_is_value_object (value))\n  {\n    return false;\n  }\n\n  return ecma_object_is_typedarray (ecma_get_object_from_value (value));\n} /* ecma_is_typedarray */\n\n/**\n * Checks whether the property name is a valid element index\n *\n * @return true, if valid\n *         false, otherwise\n */\nbool\necma_typedarray_is_element_index (ecma_string_t *property_name_p) /**< property name */\n{\n  ecma_number_t num = ecma_string_to_number (property_name_p);\n\n  if (num == 0)\n  {\n    return true;\n  }\n\n  ecma_string_t *num_to_str = ecma_new_ecma_string_from_number (num);\n  bool is_same = ecma_compare_ecma_strings (property_name_p, num_to_str);\n  ecma_deref_ecma_string (num_to_str);\n  return is_same;\n} /* ecma_typedarray_is_element_index */\n\n/**\n * List names of a TypedArray object's integer indexed properties\n */\nvoid\necma_op_typedarray_list_lazy_property_names (ecma_object_t *obj_p, /**< a TypedArray object */\n                                             ecma_collection_t *prop_names_p, /**< prop name collection */\n                                             ecma_property_counter_t *prop_counter_p, /**< property counters */\n                                             jerry_property_filter_t filter) /**< property name filter options */\n{\n  JERRY_ASSERT (ecma_object_is_typedarray (obj_p));\n\n  if (filter & JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES)\n  {\n    return;\n  }\n\n  uint32_t array_length = ecma_typedarray_get_length (obj_p);\n\n  for (uint32_t i = 0; i < array_length; i++)\n  {\n    ecma_string_t *name_p = ecma_new_ecma_string_from_uint32 (i);\n    ecma_collection_push_back (prop_names_p, ecma_make_string_value (name_p));\n  }\n\n  prop_counter_p->array_index_named_props += array_length;\n} /* ecma_op_typedarray_list_lazy_property_names */\n\n/**\n * [[DefineOwnProperty]] operation for TypedArray objects\n *\n * See also: ES2015 9.4.5.3\n *\n * @return ECMA_VALUE_TRUE - if the property is successfully defined\n *         ECMA_VALUE_FALSE - if is JERRY_PROP_SHOULD_THROW is not set\n *         raised TypeError - otherwise\n */\necma_value_t\necma_op_typedarray_define_own_property (ecma_object_t *obj_p, /**< TypedArray object */\n                                        ecma_string_t *property_name_p, /**< property name */\n                                        const ecma_property_descriptor_t *property_desc_p) /**< property descriptor */\n{\n  JERRY_ASSERT (ecma_object_is_typedarray (obj_p));\n\n  if (JERRY_UNLIKELY (ecma_prop_name_is_symbol (property_name_p)))\n  {\n    return ecma_op_general_object_define_own_property (obj_p, property_name_p, property_desc_p);\n  }\n\n  uint32_t index = ecma_string_get_array_index (property_name_p);\n\n  if (index == ECMA_STRING_NOT_ARRAY_INDEX && !ecma_typedarray_is_element_index (property_name_p))\n  {\n    return ecma_op_general_object_define_own_property (obj_p, property_name_p, property_desc_p);\n  }\n\n  if ((property_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))\n      || ((property_desc_p->flags & (JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE))\n          == (JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE))\n      || ((property_desc_p->flags & JERRY_PROP_IS_ENUMERABLE_DEFINED)\n          && !(property_desc_p->flags & JERRY_PROP_IS_ENUMERABLE))\n      || ((property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED)\n          && !(property_desc_p->flags & JERRY_PROP_IS_WRITABLE)))\n  {\n    return ecma_raise_property_redefinition (property_name_p, property_desc_p->flags);\n  }\n\n  ecma_typedarray_info_t info = ecma_typedarray_get_info (obj_p);\n\n  if (index >= info.length || ecma_arraybuffer_is_detached (info.array_buffer_p))\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  if (property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)\n  {\n    ecma_value_t set_element = ecma_set_typedarray_element (&info, property_desc_p->value, index);\n\n    if (ECMA_IS_VALUE_ERROR (set_element))\n    {\n      return set_element;\n    }\n  }\n\n  return ECMA_VALUE_TRUE;\n} /* ecma_op_typedarray_define_own_property */\n\n/**\n * Specify the creation of a new TypedArray\n * object using a constructor function.\n *\n * See also: ES11 22.2.4.6\n *\n * Used by:\n *        - ecma_typedarray_species_create\n *\n * @return ecma_value_t function object from created from constructor_p argument\n */\n\necma_value_t\necma_typedarray_create (ecma_object_t *constructor_p, /**< constructor function */\n                        ecma_value_t *arguments_list_p, /**< argument list */\n                        uint32_t arguments_list_len) /**< length of argument list */\n{\n  ecma_value_t ret_val =\n    ecma_op_function_construct (constructor_p, constructor_p, arguments_list_p, arguments_list_len);\n  if (ECMA_IS_VALUE_ERROR (ret_val))\n  {\n    return ret_val;\n  }\n\n  if (!ecma_is_typedarray (ret_val))\n  {\n    ecma_free_value (ret_val);\n    return ecma_raise_type_error (ECMA_ERR_CONSTRUCTED_OBJECT_IS_NOT_TYPEDARRAY);\n  }\n\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (ret_val);\n  ecma_typedarray_info_t info = ecma_typedarray_get_info (typedarray_p);\n\n  if (ECMA_ARRAYBUFFER_LAZY_ALLOC (info.array_buffer_p))\n  {\n    ecma_deref_object (typedarray_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_arraybuffer_is_detached (info.array_buffer_p))\n  {\n    ecma_deref_object (typedarray_p);\n    return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);\n  }\n\n  if ((arguments_list_len == 1) && (ecma_is_value_number (arguments_list_p[0])))\n  {\n    ecma_number_t num = ecma_get_number_from_value (arguments_list_p[0]);\n\n    if (info.length < num)\n    {\n      ecma_free_value (ret_val);\n      return ecma_raise_type_error (ECMA_ERR_TYPEDARRAY_SMALLER_THAN_FILTER_CALL_RESULT);\n    }\n  }\n  return ret_val;\n} /* ecma_typedarray_create */\n\n/* Specify the creation of a new TypedArray object\n * using a constructor function that is derived from this_arg.\n *\n * See also: ES11 22.2.4.7\n *\n * @return ecma value of the new typedarray object, constructed by default or species constructor\n */\necma_value_t\necma_typedarray_species_create (ecma_value_t this_arg, /**< this argument */\n                                ecma_value_t *arguments_list_p, /**< the arg list passed to typedarray construct */\n                                uint32_t arguments_list_len) /**< length of the the arg list */\n{\n  ecma_object_t *typedarray_p = ecma_get_object_from_value (this_arg);\n  ecma_typedarray_info_t info = ecma_typedarray_get_info (typedarray_p);\n\n  JERRY_ASSERT (ecma_is_typedarray (this_arg));\n\n  ecma_builtin_id_t default_constructor = ecma_typedarray_helper_get_constructor_id (info.id);\n\n  ecma_value_t constructor = ecma_op_species_constructor (typedarray_p, default_constructor);\n\n  if (ECMA_IS_VALUE_ERROR (constructor))\n  {\n    return constructor;\n  }\n\n  ecma_object_t *constructor_proto_p = ecma_get_object_from_value (constructor);\n\n  ecma_value_t result = ecma_typedarray_create (constructor_proto_p, arguments_list_p, arguments_list_len);\n  ecma_deref_object (constructor_proto_p);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  ecma_object_t *result_p = ecma_get_object_from_value (result);\n  ecma_typedarray_info_t result_info = ecma_typedarray_get_info (result_p);\n  /*\n   * Check result_info.id to to be either bigint type if info.id is one\n   * or be neither of them is info.id is none of them as well.\n   */\n  if (ECMA_TYPEDARRAY_IS_BIGINT_TYPE (info.id) ^ ECMA_TYPEDARRAY_IS_BIGINT_TYPE (result_info.id))\n  {\n    ecma_free_value (result);\n    return ecma_raise_type_error (ECMA_ERR_CONTENTTYPE_RETURNED_TYPEDARRAY_NOT_MATCH_SOURCE);\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  return result;\n} /* ecma_typedarray_species_create */\n\n/**\n * Create a typedarray object based on the \"type\" and arraylength\n * The \"type\" is same with arg1\n *\n * @return ecma_value_t\n */\necma_value_t\necma_op_create_typedarray_with_type_and_length (ecma_typedarray_type_t typedarray_id, /** TypedArray id  */\n                                                uint32_t array_length) /**< length of the typedarray */\n{\n  // TODO: assert validate typedarray_id\n  ecma_object_t *proto_p = ecma_builtin_get (ecma_typedarray_helper_get_prototype_id (typedarray_id));\n  uint8_t element_size_shift = ecma_typedarray_helper_get_shift_size (typedarray_id);\n\n  ecma_value_t new_obj =\n    ecma_typedarray_create_object_with_length (array_length, NULL, proto_p, element_size_shift, typedarray_id);\n\n  return new_obj;\n} /* ecma_op_create_typedarray_with_type_and_length */\n\n/**\n * Method for getting the additional typedArray informations.\n */\necma_typedarray_info_t\necma_typedarray_get_info (ecma_object_t *typedarray_p)\n{\n  ecma_typedarray_info_t info;\n\n  info.id = ecma_get_typedarray_id (typedarray_p);\n  info.length = ecma_typedarray_get_length (typedarray_p);\n  info.shift = ecma_typedarray_get_element_size_shift (typedarray_p);\n  info.element_size = (uint8_t) (1 << info.shift);\n  info.offset = ecma_typedarray_get_offset (typedarray_p);\n  info.array_buffer_p = ecma_typedarray_get_arraybuffer (typedarray_p);\n\n  return info;\n} /* ecma_typedarray_get_info */\n\n/**\n * @}\n * @}\n */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n"
  },
  {
    "path": "jerry-core/ecma/operations/ecma-typedarray-object.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_TYPEDARRAY_OBJECT_H\n#define ECMA_TYPEDARRAY_OBJECT_H\n\n#include \"ecma-builtins.h\"\n#include \"ecma-globals.h\"\n\n#if JERRY_BUILTIN_TYPEDARRAY\n\n/** \\addtogroup ecma ECMA\n * @{\n *\n * \\addtogroup ecmatypedarrayobject ECMA TypedArray object related routines\n * @{\n */\n\nuint32_t ecma_typedarray_setter_number_to_uint32 (ecma_number_t value);\nuint8_t ecma_typedarray_helper_get_shift_size (ecma_typedarray_type_t typedarray_id);\nlit_magic_string_id_t ecma_get_typedarray_magic_string_id (ecma_typedarray_type_t typedarray_id);\necma_typedarray_getter_fn_t ecma_get_typedarray_getter_fn (ecma_typedarray_type_t typedarray_id);\necma_typedarray_setter_fn_t ecma_get_typedarray_setter_fn (ecma_typedarray_type_t typedarray_id);\necma_value_t ecma_get_typedarray_element (ecma_typedarray_info_t *info_p, uint32_t index);\necma_value_t ecma_set_typedarray_element (ecma_typedarray_info_t *info_p, ecma_value_t value, uint32_t index);\nbool ecma_typedarray_helper_is_typedarray (ecma_builtin_id_t builtin_id);\necma_typedarray_type_t ecma_get_typedarray_id (ecma_object_t *obj_p);\necma_builtin_id_t ecma_typedarray_helper_get_prototype_id (ecma_typedarray_type_t typedarray_id);\necma_builtin_id_t ecma_typedarray_helper_get_constructor_id (ecma_typedarray_type_t typedarray_id);\necma_typedarray_type_t ecma_typedarray_helper_builtin_to_typedarray_id (ecma_builtin_id_t builtin_id);\n\necma_value_t\necma_op_typedarray_from (ecma_value_t this_val, ecma_value_t source_val, ecma_value_t mapfn_val, ecma_value_t this_arg);\nuint32_t ecma_typedarray_get_length (ecma_object_t *typedarray_p);\nuint32_t ecma_typedarray_get_offset (ecma_object_t *typedarray_p);\nuint8_t *ecma_typedarray_get_buffer (ecma_typedarray_info_t *info_p);\nuint8_t ecma_typedarray_get_element_size_shift (ecma_object_t *typedarray_p);\necma_object_t *ecma_typedarray_get_arraybuffer (ecma_object_t *typedarray_p);\necma_value_t ecma_op_create_typedarray (const ecma_value_t *arguments_list_p,\n                                        uint32_t arguments_list_len,\n                                        ecma_object_t *proto_p,\n                                        uint8_t element_size_shift,\n                                        ecma_typedarray_type_t typedarray_id);\necma_value_t ecma_typedarray_iterators_helper (ecma_value_t this_arg, ecma_iterator_kind_t kind);\n\nbool ecma_object_is_typedarray (ecma_object_t *obj_p);\nbool ecma_is_typedarray (ecma_value_t target);\nbool ecma_typedarray_is_element_index (ecma_string_t *property_name_p);\nvoid ecma_op_typedarray_list_lazy_property_names (ecma_object_t *obj_p,\n                                                  ecma_collection_t *prop_names_p,\n                                                  ecma_property_counter_t *prop_counter_p,\n                                                  jerry_property_filter_t filter);\necma_value_t ecma_op_typedarray_define_own_property (ecma_object_t *obj_p,\n                                                     ecma_string_t *property_name_p,\n                                                     const ecma_property_descriptor_t *property_desc_p);\necma_value_t ecma_op_create_typedarray_with_type_and_length (ecma_typedarray_type_t typedarray_id,\n                                                             uint32_t array_length);\necma_typedarray_info_t ecma_typedarray_get_info (ecma_object_t *typedarray_p);\necma_value_t ecma_typedarray_create_object_with_length (uint32_t array_length,\n                                                        ecma_object_t *src_arraybuffer_p,\n                                                        ecma_object_t *proto_p,\n                                                        uint8_t element_size_shift,\n                                                        ecma_typedarray_type_t typedarray_id);\necma_value_t ecma_typedarray_create_object_with_object (ecma_value_t items_val,\n                                                        ecma_object_t *proto_p,\n                                                        uint8_t element_size_shift,\n                                                        ecma_typedarray_type_t typedarray_id);\necma_value_t\necma_typedarray_create (ecma_object_t *constructor_p, ecma_value_t *arguments_list_p, uint32_t arguments_list_len);\necma_value_t ecma_typedarray_species_create (ecma_value_t this_arg, ecma_value_t *length, uint32_t arguments_list_len);\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#endif /* !ECMA_TYPEDARRAY_OBJECT_H */\n"
  },
  {
    "path": "jerry-core/include/jerryscript-compiler.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYSCRIPT_COMPILER_H\n#define JERRYSCRIPT_COMPILER_H\n\n#ifdef __cplusplus\n#define JERRY_C_API_BEGIN extern \"C\" {\n#define JERRY_C_API_END   }\n#else /* !__cplusplus */\n#define JERRY_C_API_BEGIN\n#define JERRY_C_API_END\n#endif /* __cplusplus */\n\nJERRY_C_API_BEGIN\n\n/** \\addtogroup jerry-compiler Jerry compiler compatibility components\n * @{\n */\n\n/*\n * Compiler-specific macros relevant for Win32.\n */\n#ifdef _WIN32\n/**\n * Both MINGW/MSVC do not support for declare a function a weak symbol.\n */\n#define JERRY_ATTR_WEAK\n#endif /* _WIN32 */\n\n#ifdef __GNUC__\n\n/*\n * Compiler-specific macros relevant for GCC.\n */\n#define JERRY_ATTR_ALIGNED(ALIGNMENT) __attribute__ ((aligned (ALIGNMENT)))\n#define JERRY_ATTR_ALWAYS_INLINE      __attribute__ ((always_inline))\n#define JERRY_ATTR_CONST              __attribute__ ((const))\n#define JERRY_ATTR_DEPRECATED         __attribute__ ((deprecated))\n#define JERRY_ATTR_FORMAT(...)        __attribute__ ((format (__VA_ARGS__)))\n#define JERRY_ATTR_HOT                __attribute__ ((hot))\n#define JERRY_ATTR_NOINLINE           __attribute__ ((noinline))\n#define JERRY_ATTR_NORETURN           __attribute__ ((noreturn))\n#define JERRY_ATTR_PURE               __attribute__ ((pure))\n#define JERRY_ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))\n\n#ifndef JERRY_ATTR_WEAK\n#define JERRY_ATTR_WEAK __attribute__ ((weak))\n#endif /* !JERRY_ATTR_WEAK*/\n\n#ifndef JERRY_LIKELY\n#define JERRY_LIKELY(x) __builtin_expect (!!(x), 1)\n#endif /* !JERRY_LIKELY */\n\n#ifndef JERRY_UNLIKELY\n#define JERRY_UNLIKELY(x) __builtin_expect (!!(x), 0)\n#endif /* !JERRY_UNLIKELY */\n\n#endif /* __GNUC__ */\n\n#ifdef _MSC_VER\n\n/*\n * Compiler-specific macros relevant for Microsoft Visual C/C++ Compiler.\n */\n#define JERRY_ATTR_DEPRECATED __declspec (deprecated)\n#define JERRY_ATTR_NOINLINE   __declspec (noinline)\n#define JERRY_ATTR_NORETURN   __declspec (noreturn)\n\n/*\n * Microsoft Visual C/C++ Compiler doesn't support for VLA, using _alloca\n * instead.\n */\nvoid *__cdecl _alloca (size_t _Size);\n#define JERRY_VLA(type, name, size) type *name = (type *) (_alloca (sizeof (type) * (size)))\n\n#endif /* _MSC_VER */\n\n/*\n * Default empty definitions for all compiler-specific macros. Define any of\n * these in a guarded block above (e.g., as for GCC) to fine tune compilation\n * for your own compiler. */\n\n/**\n * Function attribute to align function to given number of bytes.\n */\n#ifndef JERRY_ATTR_ALIGNED\n#define JERRY_ATTR_ALIGNED(ALIGNMENT)\n#endif /* !JERRY_ATTR_ALIGNED */\n\n/**\n * Function attribute to inline function to all call sites.\n */\n#ifndef JERRY_ATTR_ALWAYS_INLINE\n#define JERRY_ATTR_ALWAYS_INLINE\n#endif /* !JERRY_ATTR_ALWAYS_INLINE */\n\n/**\n * Function attribute to declare that function has no effect except the return\n * value and it only depends on parameters.\n */\n#ifndef JERRY_ATTR_CONST\n#define JERRY_ATTR_CONST\n#endif /* !JERRY_ATTR_CONST */\n\n/**\n * Function attribute to trigger warning if deprecated function is called.\n */\n#ifndef JERRY_ATTR_DEPRECATED\n#define JERRY_ATTR_DEPRECATED\n#endif /* !JERRY_ATTR_DEPRECATED */\n\n/**\n * Function attribute to declare that function is variadic and takes a format\n * string and some arguments as parameters.\n */\n#ifndef JERRY_ATTR_FORMAT\n#define JERRY_ATTR_FORMAT(...)\n#endif /* !JERRY_ATTR_FORMAT */\n\n/**\n * Function attribute to predict that function is a hot spot, and therefore\n * should be optimized aggressively.\n */\n#ifndef JERRY_ATTR_HOT\n#define JERRY_ATTR_HOT\n#endif /* !JERRY_ATTR_HOT */\n\n/**\n * Function attribute not to inline function ever.\n */\n#ifndef JERRY_ATTR_NOINLINE\n#define JERRY_ATTR_NOINLINE\n#endif /* !JERRY_ATTR_NOINLINE */\n\n/**\n * Function attribute to declare that function never returns.\n */\n#ifndef JERRY_ATTR_NORETURN\n#define JERRY_ATTR_NORETURN\n#endif /* !JERRY_ATTR_NORETURN */\n\n/**\n * Function attribute to declare that function has no effect except the return\n * value and it only depends on parameters and global variables.\n */\n#ifndef JERRY_ATTR_PURE\n#define JERRY_ATTR_PURE\n#endif /* !JERRY_ATTR_PURE */\n\n/**\n * Function attribute to trigger warning if function's caller doesn't use (e.g.,\n * check) the return value.\n */\n#ifndef JERRY_ATTR_WARN_UNUSED_RESULT\n#define JERRY_ATTR_WARN_UNUSED_RESULT\n#endif /* !JERRY_ATTR_WARN_UNUSED_RESULT */\n\n/**\n * Function attribute to declare a function a weak symbol\n */\n#ifndef JERRY_ATTR_WEAK\n#define JERRY_ATTR_WEAK\n#endif /* !JERRY_ATTR_WEAK */\n\n/**\n * Helper to predict that a condition is likely.\n */\n#ifndef JERRY_LIKELY\n#define JERRY_LIKELY(x) (x)\n#endif /* !JERRY_LIKELY */\n\n/**\n * Helper to predict that a condition is unlikely.\n */\n#ifndef JERRY_UNLIKELY\n#define JERRY_UNLIKELY(x) (x)\n#endif /* !JERRY_UNLIKELY */\n\n/**\n * Helper to declare (or mimic) a C99 variable-length array.\n */\n#ifndef JERRY_VLA\n#define JERRY_VLA(type, name, size) type name[size]\n#endif /* !JERRY_VLA */\n\n/**\n * @}\n */\n\nJERRY_C_API_END\n\n#endif /* !JERRYSCRIPT_COMPILER_H */\n"
  },
  {
    "path": "jerry-core/include/jerryscript-core.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYSCRIPT_CORE_H\n#define JERRYSCRIPT_CORE_H\n\n#include \"jerryscript-types.h\"\n\nJERRY_C_API_BEGIN\n\n/**\n * @defgroup jerry-api JerryScript public API\n * @{\n */\n\n/**\n * @defgroup jerry-api-general General functions\n * @{\n */\n\n/**\n * @defgroup jerry-api-general-conext Context management\n * @{\n */\nvoid jerry_init (jerry_init_flag_t flags);\nvoid jerry_cleanup (void);\n\nvoid *jerry_context_data (const jerry_context_data_manager_t *manager_p);\n\njerry_value_t jerry_current_realm (void);\njerry_value_t jerry_set_realm (jerry_value_t realm);\n/**\n * jerry-api-general-conext @}\n */\n\n/**\n * @defgroup jerry-api-general-heap Heap management\n * @{\n */\nvoid *jerry_heap_alloc (jerry_size_t size);\nvoid jerry_heap_free (void *mem_p, jerry_size_t size);\n\nbool jerry_heap_stats (jerry_heap_stats_t *out_stats_p);\nvoid jerry_heap_gc (jerry_gc_mode_t mode);\n\nbool jerry_foreach_live_object (jerry_foreach_live_object_cb_t callback, void *user_data);\nbool jerry_foreach_live_object_with_info (const jerry_object_native_info_t *native_info_p,\n                                          jerry_foreach_live_object_with_info_cb_t callback,\n                                          void *user_data_p);\n/**\n * jerry-api-general-heap @}\n */\n\n/**\n * @defgroup jerry-api-general-misc Miscellaneous\n * @{\n */\n\nvoid JERRY_ATTR_FORMAT (printf, 2, 3) jerry_log (jerry_log_level_t level, const char *format_p, ...);\nvoid jerry_log_set_level (jerry_log_level_t level);\nbool jerry_validate_string (const jerry_char_t *buffer_p, jerry_size_t buffer_size, jerry_encoding_t encoding);\nbool JERRY_ATTR_CONST jerry_feature_enabled (const jerry_feature_t feature);\nvoid jerry_register_magic_strings (const jerry_char_t *const *ext_strings_p,\n                                   uint32_t count,\n                                   const jerry_length_t *str_lengths_p);\n/**\n * jerry-api-general-misc @}\n */\n\n/**\n * jerry-api-general @}\n */\n\n/**\n * @defgroup jerry-api-code Scripts and Executables\n * @{\n */\n\n/**\n * @defgroup jerry-api-code-parse Parsing\n * @{\n */\njerry_value_t jerry_parse (const jerry_char_t *source_p, size_t source_size, const jerry_parse_options_t *options_p);\njerry_value_t jerry_parse_value (const jerry_value_t source, const jerry_parse_options_t *options_p);\n/**\n * jerry-api-code-parse @}\n */\n\n/**\n * @defgroup jerry-api-code-exec Execution\n * @{\n */\njerry_value_t jerry_eval (const jerry_char_t *source_p, size_t source_size, uint32_t flags);\njerry_value_t jerry_run (const jerry_value_t script);\njerry_value_t jerry_run_jobs (void);\n/**\n * jerry-api-code-exec @}\n */\n\n/**\n * @defgroup jerry-api-code-sourceinfo Source information\n * @{\n */\njerry_value_t jerry_source_name (const jerry_value_t value);\njerry_value_t jerry_source_user_value (const jerry_value_t value);\njerry_source_info_t *jerry_source_info (const jerry_value_t value);\nvoid jerry_source_info_free (jerry_source_info_t *source_info_p);\n/**\n * jerry-api-code-sourceinfo @}\n */\n\n/**\n * @defgroup jerry-api-code-cb Callbacks\n * @{\n */\nvoid jerry_halt_handler (uint32_t interval, jerry_halt_cb_t callback, void *user_p);\n/**\n * jerry-api-code-cb @}\n */\n\n/**\n * jerry-api-code @}\n */\n\n/**\n * @defgroup jerry-api-backtrace Backtraces\n * @{\n */\n\n/**\n * @defgroup jerry-api-backtrace-capture Capturing\n * @{\n */\njerry_value_t jerry_backtrace (uint32_t max_depth);\nvoid jerry_backtrace_capture (jerry_backtrace_cb_t callback, void *user_p);\n/**\n * jerry-api-backtrace-capture @}\n */\n\n/**\n * @defgroup jerry-api-backtrace-frame Frames\n * @{\n */\njerry_frame_type_t jerry_frame_type (const jerry_frame_t *frame_p);\nconst jerry_value_t *jerry_frame_callee (jerry_frame_t *frame_p);\nconst jerry_value_t *jerry_frame_this (jerry_frame_t *frame_p);\nconst jerry_frame_location_t *jerry_frame_location (jerry_frame_t *frame_p);\nbool jerry_frame_is_strict (jerry_frame_t *frame_p);\n/**\n * jerry-api-backtrace-frame @}\n */\n\n/**\n * jerry-api-backtrace @}\n */\n\n/**\n * @defgroup jerry-api-value Values\n * @{\n */\n\n/* Reference management */\njerry_value_t JERRY_ATTR_WARN_UNUSED_RESULT jerry_value_copy (const jerry_value_t value);\nvoid jerry_value_free (jerry_value_t value);\n\n/**\n * @defgroup jerry-api-value-checks Type inspection\n * @{\n */\njerry_type_t jerry_value_type (const jerry_value_t value);\nbool jerry_value_is_exception (const jerry_value_t value);\nbool jerry_value_is_abort (const jerry_value_t value);\n\nbool jerry_value_is_undefined (const jerry_value_t value);\nbool jerry_value_is_null (const jerry_value_t value);\nbool jerry_value_is_boolean (const jerry_value_t value);\nbool jerry_value_is_true (const jerry_value_t value);\nbool jerry_value_is_false (const jerry_value_t value);\n\nbool jerry_value_is_number (const jerry_value_t value);\nbool jerry_value_is_bigint (const jerry_value_t value);\n\nbool jerry_value_is_string (const jerry_value_t value);\nbool jerry_value_is_symbol (const jerry_value_t value);\n\nbool jerry_value_is_object (const jerry_value_t value);\nbool jerry_value_is_array (const jerry_value_t value);\nbool jerry_value_is_promise (const jerry_value_t value);\nbool jerry_value_is_proxy (const jerry_value_t value);\nbool jerry_value_is_arraybuffer (const jerry_value_t value);\nbool jerry_value_is_shared_arraybuffer (const jerry_value_t value);\nbool jerry_value_is_dataview (const jerry_value_t value);\nbool jerry_value_is_typedarray (const jerry_value_t value);\n\nbool jerry_value_is_constructor (const jerry_value_t value);\nbool jerry_value_is_function (const jerry_value_t value);\nbool jerry_value_is_async_function (const jerry_value_t value);\n\nbool jerry_value_is_error (const jerry_value_t value);\n/**\n * jerry-api-value-checks @}\n */\n\n/**\n * @defgroup jerry-api-value-coerce Coercion\n * @{\n */\nbool jerry_value_to_boolean (const jerry_value_t value);\njerry_value_t jerry_value_to_number (const jerry_value_t value);\njerry_value_t jerry_value_to_object (const jerry_value_t value);\njerry_value_t jerry_value_to_primitive (const jerry_value_t value);\njerry_value_t jerry_value_to_string (const jerry_value_t value);\njerry_value_t jerry_value_to_bigint (const jerry_value_t value);\n\ndouble jerry_value_as_number (const jerry_value_t value);\ndouble jerry_value_as_integer (const jerry_value_t value);\nint32_t jerry_value_as_int32 (const jerry_value_t value);\nuint32_t jerry_value_as_uint32 (const jerry_value_t value);\n/**\n * jerry-api-value-coerce @}\n */\n\n/**\n * @defgroup jerry-api-value-op Operations\n * @{\n */\njerry_value_t jerry_binary_op (jerry_binary_op_t operation, const jerry_value_t lhs, const jerry_value_t rhs);\n\n/**\n * jerry-api-value-op @}\n */\n\n/**\n * jerry-api-value @}\n */\n\n/**\n * @defgroup jerry-api-exception Exceptions\n * @{\n */\n\n/**\n * @defgroup jerry-api-exception-ctor Constructors\n * @{\n */\njerry_value_t jerry_throw (jerry_error_t type, const jerry_value_t message);\njerry_value_t jerry_throw_sz (jerry_error_t type, const char *message_p);\njerry_value_t jerry_throw_value (jerry_value_t value, bool take_ownership);\njerry_value_t jerry_throw_abort (jerry_value_t value, bool take_ownership);\n/**\n * jerry-api-exception-ctor @}\n */\n\n/**\n * @defgroup jerry-api-exception-op Operations\n * @{\n */\nvoid jerry_exception_allow_capture (jerry_value_t value, bool allow_capture);\n/**\n * jerry-api-exception-op @}\n */\n\n/**\n * @defgroup jerry-api-exception-get Getters\n * @{\n */\njerry_value_t jerry_exception_value (jerry_value_t value, bool free_exception);\nbool jerry_exception_is_captured (const jerry_value_t value);\n/**\n * jerry-api-exception-get @}\n */\n\n/**\n * @defgroup jerry-api-exception-cb Callbacks\n * @{\n */\nvoid jerry_on_throw (jerry_throw_cb_t callback, void *user_p);\n/**\n * jerry-api-exception-cb @}\n */\n\n/**\n * jerry-api-error @}\n */\n\n/**\n * @defgroup jerry-api-primitives Primitive types\n * @{\n */\n\n/**\n * @defgroup jerry-api-undefined Undefined\n * @{\n */\n\n/**\n * @defgroup jerry-api-undefined-ctor Constructors\n * @{\n */\n\njerry_value_t JERRY_ATTR_CONST jerry_undefined (void);\n\n/**\n * jerry-api-undefined-ctor @}\n */\n\n/**\n * jerry-api-undefined @}\n */\n\n/**\n * @defgroup jerry-api-null Null\n * @{\n */\n\n/**\n * @defgroup jerry-api-null-ctor Constructors\n * @{\n */\n\njerry_value_t JERRY_ATTR_CONST jerry_null (void);\n\n/**\n * jerry-api-null-ctor @}\n */\n\n/**\n * jerry-api-null @}\n */\n\n/**\n * @defgroup jerry-api-boolean Boolean\n * @{\n */\n\n/**\n * @defgroup jerry-api-boolean-ctor Constructors\n * @{\n */\n\njerry_value_t JERRY_ATTR_CONST jerry_boolean (bool value);\n\n/**\n * jerry-api-boolean-ctor @}\n */\n\n/**\n * jerry-api-boolean @}\n */\n\n/**\n * @defgroup jerry-api-number Number\n * @{\n */\n\n/**\n * @defgroup jerry-api-number-ctor Number\n * @{\n */\n\njerry_value_t jerry_number (double value);\njerry_value_t jerry_infinity (bool sign);\njerry_value_t jerry_nan (void);\n\n/**\n * jerry-api-number-ctor @}\n */\n\n/**\n * jerry-api-number @}\n */\n\n/**\n * @defgroup jerry-api-bigint BigInt\n * @{\n */\n\n/**\n * @defgroup jerry-api-bigint-ctor Constructors\n * @{\n */\njerry_value_t jerry_bigint (const uint64_t *digits_p, uint32_t digit_count, bool sign);\n/**\n * jerry-api-bigint-ctor @}\n */\n\n/**\n * @defgroup jerry-api-bigint-get Getters\n * @{\n */\nuint32_t jerry_bigint_digit_count (const jerry_value_t value);\n/**\n * jerry-api-bigint-get @}\n */\n\n/**\n * @defgroup jerry-api-bigint-op Operations\n * @{\n */\nvoid jerry_bigint_to_digits (const jerry_value_t value, uint64_t *digits_p, uint32_t digit_count, bool *sign_p);\n/**\n * jerry-api-bigint-get @}\n */\n\n/**\n * jerry-api-bigint @}\n */\n\n/**\n * @defgroup jerry-api-string String\n * @{\n */\n\n/**\n * @defgroup jerry-api-string-ctor Constructors\n * @{\n */\njerry_value_t jerry_string (const jerry_char_t *buffer_p, jerry_size_t buffer_size, jerry_encoding_t encoding);\njerry_value_t jerry_string_sz (const char *str_p);\njerry_value_t jerry_string_external (const jerry_char_t *buffer_p, jerry_size_t buffer_size, void *user_p);\njerry_value_t jerry_string_external_sz (const char *str_p, void *user_p);\n/**\n * jerry-api-string-cotr @}\n */\n\n/**\n * @defgroup jerry-api-string-get Getters\n * @{\n */\njerry_size_t jerry_string_size (const jerry_value_t value, jerry_encoding_t encoding);\njerry_length_t jerry_string_length (const jerry_value_t value);\nvoid *jerry_string_user_ptr (const jerry_value_t value, bool *is_external);\n/**\n * jerry-api-string-get @}\n */\n\n/**\n * @defgroup jerry-api-string-op Operations\n * @{\n */\njerry_value_t jerry_string_substr (const jerry_value_t value, jerry_length_t start, jerry_length_t end);\njerry_size_t jerry_string_to_buffer (const jerry_value_t value,\n                                     jerry_encoding_t encoding,\n                                     jerry_char_t *buffer_p,\n                                     jerry_size_t buffer_size);\nvoid jerry_string_iterate (const jerry_value_t value,\n                           jerry_encoding_t encoding,\n                           jerry_string_iterate_cb_t callback,\n                           void *user_p);\n/**\n * jerry-api-string-op @}\n */\n\n/**\n * @defgroup jerry-api-string-cb Callbacks\n * @{\n */\nvoid jerry_string_external_on_free (jerry_external_string_free_cb_t callback);\n/**\n * jerry-api-string-cb @}\n */\n\n/**\n * jerry-api-string @}\n */\n\n/**\n * @defgroup jerry-api-symbol Symbol\n * @{\n */\n\n/**\n * @defgroup jerry-api-symbol-ctor Constructors\n * @{\n */\njerry_value_t jerry_symbol (jerry_well_known_symbol_t symbol);\njerry_value_t jerry_symbol_with_description (const jerry_value_t value);\n/**\n * jerry-api-symbol-ctor @}\n */\n\n/**\n * @defgroup jerry-api-symbol-get Getters\n * @{\n */\njerry_value_t jerry_symbol_description (const jerry_value_t symbol);\njerry_value_t jerry_symbol_descriptive_string (const jerry_value_t symbol);\n/**\n * jerry-api-symbol-get @}\n */\n\n/**\n * jerry-api-symbol @}\n */\n\n/**\n * jerry-api-primitives @}\n */\n\n/**\n * @defgroup jerry-api-objects Objects\n * @{\n */\n\n/**\n * @defgroup jerry-api-object-ctor Constructors\n * @{\n */\njerry_value_t jerry_object (void);\n/**\n * jerry-api-object-ctor @}\n */\n\n/**\n * @defgroup jerry-api-object-get Getters\n * @{\n */\n\njerry_object_type_t jerry_object_type (const jerry_value_t object);\njerry_value_t jerry_object_proto (const jerry_value_t object);\njerry_value_t jerry_object_keys (const jerry_value_t object);\njerry_value_t jerry_object_property_names (const jerry_value_t object, jerry_property_filter_t filter);\n\n/**\n * jerry-api-object-get @}\n */\n\n/**\n * @defgroup jerry-api-object-op Operations\n * @{\n */\n\njerry_value_t jerry_object_set_proto (jerry_value_t object, const jerry_value_t proto);\nbool jerry_object_foreach (const jerry_value_t object, jerry_object_property_foreach_cb_t foreach_p, void *user_data_p);\n\n/**\n * @defgroup jerry-api-object-op-set Set\n * @{\n */\njerry_value_t jerry_object_set (jerry_value_t object, const jerry_value_t key, const jerry_value_t value);\njerry_value_t jerry_object_set_sz (jerry_value_t object, const char *key_p, const jerry_value_t value);\njerry_value_t jerry_object_set_index (jerry_value_t object, uint32_t index, const jerry_value_t value);\njerry_value_t jerry_object_define_own_prop (jerry_value_t object,\n                                            const jerry_value_t key,\n                                            const jerry_property_descriptor_t *prop_desc_p);\nbool jerry_object_set_internal (jerry_value_t object, const jerry_value_t key, const jerry_value_t value);\nvoid jerry_object_set_native_ptr (jerry_value_t object,\n                                  const jerry_object_native_info_t *native_info_p,\n                                  void *native_pointer_p);\n/**\n * jerry-api-object-op-set @}\n */\n\n/**\n * @defgroup jerry-api-object-op-has Has\n * @{\n */\njerry_value_t jerry_object_has (const jerry_value_t object, const jerry_value_t key);\njerry_value_t jerry_object_has_sz (const jerry_value_t object, const char *key_p);\njerry_value_t jerry_object_has_own (const jerry_value_t object, const jerry_value_t key);\nbool jerry_object_has_internal (const jerry_value_t object, const jerry_value_t key);\nbool jerry_object_has_native_ptr (const jerry_value_t object, const jerry_object_native_info_t *native_info_p);\n/**\n * jerry-api-object-op-has @}\n */\n\n/**\n * @defgroup jerry-api-object-op-get Get\n * @{\n */\njerry_value_t jerry_object_get (const jerry_value_t object, const jerry_value_t key);\njerry_value_t jerry_object_get_sz (const jerry_value_t object, const char *key_p);\njerry_value_t jerry_object_get_index (const jerry_value_t object, uint32_t index);\njerry_value_t jerry_object_get_own_prop (const jerry_value_t object,\n                                         const jerry_value_t key,\n                                         jerry_property_descriptor_t *prop_desc_p);\njerry_value_t jerry_object_get_internal (const jerry_value_t object, const jerry_value_t key);\nvoid *jerry_object_get_native_ptr (const jerry_value_t object, const jerry_object_native_info_t *native_info_p);\n\njerry_value_t jerry_object_find_own (const jerry_value_t object,\n                                     const jerry_value_t key,\n                                     const jerry_value_t receiver,\n                                     bool *found_p);\n/**\n * jerry-api-object-op-get @}\n */\n\n/**\n * @defgroup jerry-api-object-op-del Delete\n * @{\n */\njerry_value_t jerry_object_delete (jerry_value_t object, const jerry_value_t key);\njerry_value_t jerry_object_delete_sz (const jerry_value_t object, const char *key_p);\njerry_value_t jerry_object_delete_index (jerry_value_t object, uint32_t index);\nbool jerry_object_delete_internal (jerry_value_t object, const jerry_value_t key);\nbool jerry_object_delete_native_ptr (jerry_value_t object, const jerry_object_native_info_t *native_info_p);\n/**\n * jerry-api-object-op-del @}\n */\n\n/**\n * jerry-api-object-op @}\n */\n\n/**\n * @defgroup jerry-api-object-prop-desc Property descriptors\n * @{\n */\n\n/**\n * @defgroup jerry-api-object-prop-desc-ctor Constructors\n * @{\n */\njerry_property_descriptor_t jerry_property_descriptor (void);\njerry_value_t jerry_property_descriptor_from_object (const jerry_value_t obj_value,\n                                                     jerry_property_descriptor_t *out_prop_desc_p);\n/**\n * jerry-api-object-prop-desc-ctor @}\n */\n\n/**\n * @defgroup jerry-api-object-prop-desc-op Operations\n * @{\n */\nvoid jerry_property_descriptor_free (jerry_property_descriptor_t *prop_desc_p);\njerry_value_t jerry_property_descriptor_to_object (const jerry_property_descriptor_t *src_prop_desc_p);\n/**\n * jerry-api-object-prop-desc-op @}\n */\n\n/**\n * jerry-api-object-prop-desc @}\n */\n\n/**\n * @defgroup jerry-api-object-native-ptr Native pointers\n * @{\n */\n\n/**\n * @defgroup jerry-api-object-native-ptr-op Operations\n * @{\n */\nvoid jerry_native_ptr_init (void *native_pointer_p, const jerry_object_native_info_t *native_info_p);\nvoid jerry_native_ptr_free (void *native_pointer_p, const jerry_object_native_info_t *native_info_p);\nvoid jerry_native_ptr_set (jerry_value_t *reference_p, const jerry_value_t value);\n/**\n * jerry-api-object-native-ptr-op @}\n */\n\n/**\n * jerry-api-object-native-ptr @}\n */\n\n/**\n * @defgroup jerry-api-array Array\n * @{\n */\n\n/**\n * @defgroup jerry-api-array-ctor Constructors\n * @{\n */\njerry_value_t jerry_array (jerry_length_t length);\n/**\n * jerry-api-array-ctor @}\n */\n\n/**\n * @defgroup jerry-api-array-get Getters\n * @{\n */\njerry_length_t jerry_array_length (const jerry_value_t value);\n/**\n * jerry-api-array-get @}\n */\n\n/**\n * jerry-api-array @}\n */\n\n/**\n * @defgroup jerry-api-arraybuffer ArrayBuffer\n * @{\n */\n\n/**\n * @defgroup jerry-api-arraybuffer-ctor Constructors\n * @{\n */\njerry_value_t jerry_arraybuffer (const jerry_length_t size);\njerry_value_t jerry_arraybuffer_external (uint8_t *buffer_p, jerry_length_t size, void *user_p);\n/**\n * jerry-api-arraybuffer-ctor @}\n */\n\n/**\n * @defgroup jerry-api-arraybuffer-get Getters\n * @{\n */\njerry_size_t jerry_arraybuffer_size (const jerry_value_t value);\nuint8_t *jerry_arraybuffer_data (const jerry_value_t value);\nbool jerry_arraybuffer_is_detachable (const jerry_value_t value);\nbool jerry_arraybuffer_has_buffer (const jerry_value_t value);\n/**\n * jerry-api-arraybuffer-get @}\n */\n\n/**\n * @defgroup jerry-api-arraybuffer-op Operations\n * @{\n */\njerry_size_t\njerry_arraybuffer_read (const jerry_value_t value, jerry_size_t offset, uint8_t *buffer_p, jerry_size_t buffer_size);\njerry_size_t\njerry_arraybuffer_write (jerry_value_t value, jerry_size_t offset, const uint8_t *buffer_p, jerry_size_t buffer_size);\njerry_value_t jerry_arraybuffer_detach (jerry_value_t value);\nvoid jerry_arraybuffer_heap_allocation_limit (jerry_size_t limit);\n/**\n * jerry-api-arraybuffer-op @}\n */\n\n/**\n * @defgroup jerry-api-arraybuffer-cb Callbacks\n * @{\n */\nvoid jerry_arraybuffer_allocator (jerry_arraybuffer_allocate_cb_t allocate_callback,\n                                  jerry_arraybuffer_free_cb_t free_callback,\n                                  void *user_p);\n/**\n * jerry-api-arraybuffer-cb @}\n */\n\n/**\n * jerry-api-arraybuffer @}\n */\n\n/**\n * @defgroup jerry-api-sharedarraybuffer SharedArrayBuffer\n * @{\n */\n\n/**\n * @defgroup jerry-api-sharedarraybuffer-ctor Constructors\n * @{\n */\njerry_value_t jerry_shared_arraybuffer (jerry_size_t size);\njerry_value_t jerry_shared_arraybuffer_external (uint8_t *buffer_p, jerry_size_t buffer_size, void *user_p);\n/**\n * jerry-api-sharedarraybuffer-ctor @}\n */\n\n/**\n * jerry-api-sharedarraybuffer @}\n */\n\n/**\n * @defgroup jerry-api-dataview DataView\n * @{\n */\n\n/**\n * @defgroup jerry-api-dataview-ctor Constructors\n * @{\n */\njerry_value_t jerry_dataview (const jerry_value_t value, jerry_size_t byte_offset, jerry_size_t byte_length);\n/**\n * jerry-api-dataview-ctr @}\n */\n\n/**\n * @defgroup jerry-api-dataview-get Getters\n * @{\n */\njerry_value_t\njerry_dataview_buffer (const jerry_value_t dataview, jerry_size_t *byte_offset, jerry_size_t *byte_length);\n/**\n * jerry-api-dataview-get @}\n */\n\n/**\n * jerry-api-dataview @}\n */\n\n/**\n * @defgroup jerry-api-typedarray TypedArray\n * @{\n */\n\n/**\n * @defgroup jerry-api-typedarray-ctor Constructors\n * @{\n */\njerry_value_t jerry_typedarray (jerry_typedarray_type_t type, jerry_length_t length);\njerry_value_t jerry_typedarray_with_buffer (jerry_typedarray_type_t type, const jerry_value_t arraybuffer);\njerry_value_t jerry_typedarray_with_buffer_span (jerry_typedarray_type_t type,\n                                                 const jerry_value_t arraybuffer,\n                                                 jerry_size_t byte_offset,\n                                                 jerry_size_t byte_length);\n/**\n * jerry-api-typedarray-ctor @}\n */\n\n/**\n * @defgroup jerry-api-typedarray-get Getters\n * @{\n */\njerry_typedarray_type_t jerry_typedarray_type (const jerry_value_t value);\njerry_length_t jerry_typedarray_length (const jerry_value_t value);\njerry_value_t jerry_typedarray_buffer (const jerry_value_t value, jerry_size_t *byte_offset, jerry_size_t *byte_length);\n/**\n * jerry-api-typedarray-get @}\n */\n\n/**\n * jerry-api-typedarray @}\n */\n\n/**\n * @defgroup jerry-api-iterator Iterator\n * @{\n */\n\n/**\n * @defgroup jerry-api-iterator-get Getters\n * @{\n */\njerry_iterator_type_t jerry_iterator_type (const jerry_value_t value);\n/**\n * jerry-api-iterator-get @}\n */\n\n/**\n * jerry-api-iterator @}\n */\n\n/**\n * @defgroup jerry-api-function Function\n * @{\n */\n\n/**\n * @defgroup jerry-api-function-ctor Constructors\n * @{\n */\njerry_value_t jerry_function_external (jerry_external_handler_t handler);\n/**\n * jerry-api-function-ctor @}\n */\n\n/**\n * @defgroup jerry-api-function-get Getters\n * @{\n */\njerry_function_type_t jerry_function_type (const jerry_value_t value);\nbool jerry_function_is_dynamic (const jerry_value_t value);\n/**\n * jerry-api-function-get @}\n */\n\n/**\n * @defgroup jerry-api-function-op Operations\n * @{\n */\njerry_value_t jerry_call (const jerry_value_t function,\n                          const jerry_value_t this_value,\n                          const jerry_value_t *args_p,\n                          jerry_size_t args_count);\njerry_value_t jerry_construct (const jerry_value_t function, const jerry_value_t *args_p, jerry_size_t args_count);\n/**\n * jerry-api-function-op @}\n */\n\n/**\n * jerry-api-function @}\n */\n\n/**\n * @defgroup jerry-api-proxy Proxy\n * @{\n */\n\n/**\n * @defgroup jerry-api-proxy-ctor Constructors\n * @{\n */\njerry_value_t jerry_proxy (const jerry_value_t target, const jerry_value_t handler);\njerry_value_t jerry_proxy_custom (const jerry_value_t target, const jerry_value_t handler, uint32_t flags);\n/**\n * jerry-api-function-proxy-ctor @}\n */\n\n/**\n * @defgroup jerry-api-proxy-get Getters\n * @{\n */\njerry_value_t jerry_proxy_target (const jerry_value_t value);\njerry_value_t jerry_proxy_handler (const jerry_value_t value);\n/**\n * jerry-api-function-proxy-get @}\n */\n\n/**\n * jerry-api-proxy @}\n */\n\n/**\n * @defgroup jerry-api-promise Promise\n * @{\n */\n\n/**\n * @defgroup jerry-api-promise-ctor Constructors\n * @{\n */\njerry_value_t jerry_promise (void);\n/**\n * jerry-api-promise-ctor @}\n */\n\n/**\n * @defgroup jerry-api-promise-get Getters\n * @{\n */\njerry_value_t jerry_promise_result (const jerry_value_t promise);\njerry_promise_state_t jerry_promise_state (const jerry_value_t promise);\n/**\n * jerry-api-promise-get @}\n */\n\n/**\n * @defgroup jerry-api-promise-op Operations\n * @{\n */\njerry_value_t jerry_promise_resolve (jerry_value_t promise, const jerry_value_t argument);\njerry_value_t jerry_promise_reject (jerry_value_t promise, const jerry_value_t argument);\n/**\n * jerry-api-promise-op @}\n */\n\n/**\n * @defgroup jerry-api-promise-cb Callbacks\n * @{\n */\nvoid jerry_promise_on_event (jerry_promise_event_filter_t filters, jerry_promise_event_cb_t callback, void *user_p);\n/**\n * jerry-api-promise-cb @}\n */\n\n/**\n * jerry-api-promise @}\n */\n\n/**\n * @defgroup jerry-api-container Map, Set, WeakMap, WeakSet\n * @{\n */\n\n/**\n * @defgroup jerry-api-container-ctor Constructors\n * @{\n */\njerry_value_t jerry_container (jerry_container_type_t container_type,\n                               const jerry_value_t *arguments_p,\n                               jerry_length_t argument_count);\n/**\n * jerry-api-promise-ctor @}\n */\n\n/**\n * @defgroup jerry-api-container-get Getters\n * @{\n */\njerry_container_type_t jerry_container_type (const jerry_value_t value);\n/**\n * jerry-api-container-get @}\n */\n\n/**\n * @defgroup jerry-api-container-op Operations\n * @{\n */\njerry_value_t jerry_container_to_array (const jerry_value_t value, bool *is_key_value_p);\njerry_value_t jerry_container_op (jerry_container_op_t operation,\n                                  jerry_value_t container,\n                                  const jerry_value_t *arguments,\n                                  uint32_t argument_count);\n/**\n * jerry-api-container-op @}\n */\n\n/**\n * jerry-api-container @}\n */\n\n/**\n * @defgroup jerry-api-regexp RegExp\n * @{\n */\n\n/**\n * @defgroup jerry-api-regexp-ctor Constructors\n * @{\n */\njerry_value_t jerry_regexp (const jerry_value_t pattern, uint16_t flags);\njerry_value_t jerry_regexp_sz (const char *pattern_p, uint16_t flags);\n/**\n * jerry-api-regexp-ctor @}\n */\n\n/**\n * jerry-api-regexp @}\n */\n\n/**\n * @defgroup jerry-api-error Error\n * @{\n */\n\n/**\n * @defgroup jerry-api-error-ctor Constructors\n * @{\n */\njerry_value_t jerry_error (jerry_error_t type, const jerry_value_t message);\njerry_value_t jerry_error_sz (jerry_error_t type, const char *message_p);\n/**\n * jerry-api-error-ctor @}\n */\n\n/**\n * @defgroup jerry-api-error-get Getters\n * @{\n */\njerry_error_t jerry_error_type (jerry_value_t value);\n/**\n * jerry-api-error-get @}\n */\n\n/**\n * @defgroup jerry-api-error-cb Callbacks\n * @{\n */\nvoid jerry_error_on_created (jerry_error_object_created_cb_t callback, void *user_p);\n/**\n * jerry-api-error-cb @}\n */\n\n/**\n * jerry-api-error @}\n */\n\n/**\n * jerry-api-objects @}\n */\n\n/**\n * @defgroup jerry-api-json JSON\n * @{\n */\n\n/**\n * @defgroup jerry-api-json-op Operations\n * @{\n */\njerry_value_t jerry_json_parse (const jerry_char_t *string_p, jerry_size_t string_size);\njerry_value_t jerry_json_stringify (const jerry_value_t object);\n/**\n * jerry-api-json-op @}\n */\n\n/**\n * jerry-api-json @}\n */\n\n/**\n * @defgroup jerry-api-module Modules\n * @{\n */\n\n/**\n * @defgroup jerry-api-module-get Getters\n * @{\n */\njerry_module_state_t jerry_module_state (const jerry_value_t module);\nsize_t jerry_module_request_count (const jerry_value_t module);\njerry_value_t jerry_module_request (const jerry_value_t module, size_t request_index);\njerry_value_t jerry_module_namespace (const jerry_value_t module);\n/**\n * jerry-api-module-get @}\n */\n\n/**\n * @defgroup jerry-api-module-op Operations\n * @{\n */\n\n/**\n * Resolve and parse a module file\n *\n * @param specifier: module request specifier string.\n * @param referrer: parent module.\n * @param user_p: user specified pointer.\n *\n * @return module object if resolving is successful, error otherwise.\n */\njerry_value_t jerry_module_resolve (const jerry_value_t specifier, const jerry_value_t referrer, void *user_p);\n\njerry_value_t jerry_module_link (const jerry_value_t module, jerry_module_resolve_cb_t callback, void *user_p);\njerry_value_t jerry_module_evaluate (const jerry_value_t module);\n\n/**\n * Release known modules in the current context. If realm parameter is supplied, cleans up modules native to that realm\n * only. This function should be called by the user application when the module database in the current context is no\n * longer needed.\n *\n * @param realm: release only those modules which realm value is equal to this argument.\n */\nvoid jerry_module_cleanup (const jerry_value_t realm);\n\n/**\n * jerry-api-module-op @}\n */\n\n/**\n * @defgroup jerry-api-module-native Native modules\n * @{\n */\njerry_value_t jerry_native_module (jerry_native_module_evaluate_cb_t callback,\n                                   const jerry_value_t *const exports_p,\n                                   size_t export_count);\njerry_value_t jerry_native_module_get (const jerry_value_t native_module, const jerry_value_t export_name);\njerry_value_t\njerry_native_module_set (jerry_value_t native_module, const jerry_value_t export_name, const jerry_value_t value);\n/**\n * jerry-api-module-native @}\n */\n\n/**\n * @defgroup jerry-api-module-cb Callbacks\n * @{\n */\nvoid jerry_module_on_state_changed (jerry_module_state_changed_cb_t callback, void *user_p);\nvoid jerry_module_on_import_meta (jerry_module_import_meta_cb_t callback, void *user_p);\nvoid jerry_module_on_import (jerry_module_import_cb_t callback, void *user_p);\n/**\n * jerry-api-module-cb @}\n */\n\n/**\n * jerry-api-module @}\n */\n\n/**\n * @defgroup jerry-api-realm Realms\n * @{\n */\n\n/**\n * @defgroup jerry-api-realm-ctor Constructors\n * @{\n */\njerry_value_t jerry_realm (void);\n/**\n * jerry-api-realm-ctor @}\n */\n\n/**\n * @defgroup jerry-api-realm-get Getters\n * @{\n */\njerry_value_t jerry_realm_this (jerry_value_t realm);\n/**\n * jerry-api-realm-ctor @}\n */\n\n/**\n * @defgroup jerry-api-realm-op Operation\n * @{\n */\njerry_value_t jerry_realm_set_this (jerry_value_t realm, jerry_value_t this_value);\n/**\n * jerry-api-realm-op @}\n */\n\n/**\n * jerry-api-realm @}\n */\n\n/**\n * jerry-api @}\n */\n\nJERRY_C_API_END\n\n#endif /* !JERRYSCRIPT_CORE_H */\n\n/* vim: set fdm=marker fmr=@{,@}: */\n"
  },
  {
    "path": "jerry-core/include/jerryscript-debugger-transport.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYSCRIPT_DEBUGGER_TRANSPORT_H\n#define JERRYSCRIPT_DEBUGGER_TRANSPORT_H\n\n#include <stdbool.h>\n#include <stddef.h>\n#include <stdint.h>\n\n#include \"jerryscript-compiler.h\"\n\nJERRY_C_API_BEGIN\n\n/** \\addtogroup jerry-debugger-transport Jerry engine debugger interface - transport control\n * @{\n */\n\n/**\n * Maximum number of bytes transmitted or received.\n */\n#define JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE 128\n\n/**\n * Receive message context.\n */\ntypedef struct\n{\n  uint8_t *buffer_p; /**< buffer for storing the received data */\n  size_t received_length; /**< number of currently received bytes */\n  uint8_t *message_p; /**< start of the received message */\n  size_t message_length; /**< length of the received message */\n  size_t message_total_length; /**< total length for datagram protocols,\n                                *   0 for stream protocols */\n} jerry_debugger_transport_receive_context_t;\n\n/**\n * Forward definition of jerry_debugger_transport_header_t.\n */\nstruct jerry_debugger_transport_interface_t;\n\n/**\n * Close connection callback.\n */\ntypedef void (*jerry_debugger_transport_close_t) (struct jerry_debugger_transport_interface_t *header_p);\n\n/**\n * Send data callback.\n */\ntypedef bool (*jerry_debugger_transport_send_t) (struct jerry_debugger_transport_interface_t *header_p,\n                                                 uint8_t *message_p,\n                                                 size_t message_length);\n\n/**\n * Receive data callback.\n */\ntypedef bool (*jerry_debugger_transport_receive_t) (struct jerry_debugger_transport_interface_t *header_p,\n                                                    jerry_debugger_transport_receive_context_t *context_p);\n\n/**\n * Transport layer header.\n */\ntypedef struct jerry_debugger_transport_interface_t\n{\n  /* The following fields must be filled before calling jerry_debugger_transport_add(). */\n  jerry_debugger_transport_close_t close; /**< close connection callback */\n  jerry_debugger_transport_send_t send; /**< send data callback */\n  jerry_debugger_transport_receive_t receive; /**< receive data callback */\n\n  /* The following fields are filled by jerry_debugger_transport_add(). */\n  struct jerry_debugger_transport_interface_t *next_p; /**< next transport layer */\n} jerry_debugger_transport_header_t;\n\nvoid jerry_debugger_transport_add (jerry_debugger_transport_header_t *header_p,\n                                   size_t send_message_header_size,\n                                   size_t max_send_message_size,\n                                   size_t receive_message_header_size,\n                                   size_t max_receive_message_size);\nvoid jerry_debugger_transport_start (void);\n\nbool jerry_debugger_transport_is_connected (void);\nvoid jerry_debugger_transport_close (void);\n\nbool jerry_debugger_transport_send (const uint8_t *message_p, size_t message_length);\nbool jerry_debugger_transport_receive (jerry_debugger_transport_receive_context_t *context_p);\nvoid jerry_debugger_transport_receive_completed (jerry_debugger_transport_receive_context_t *context_p);\n\nvoid jerry_debugger_transport_sleep (void);\n\n/**\n * @}\n */\n\nJERRY_C_API_END\n\n#endif /* !JERRYSCRIPT_DEBUGGER_TRANSPORT_H */\n"
  },
  {
    "path": "jerry-core/include/jerryscript-debugger.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYSCRIPT_DEBUGGER_H\n#define JERRYSCRIPT_DEBUGGER_H\n\n#include \"jerryscript-types.h\"\n\nJERRY_C_API_BEGIN\n\n/** \\addtogroup jerry-debugger Jerry engine interface - Debugger feature\n * @{\n */\n\n/**\n * JerryScript debugger protocol version.\n */\n#define JERRY_DEBUGGER_VERSION (9)\n\n/**\n * Types for the client source wait and run method.\n */\ntypedef enum\n{\n  JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED = 0, /**< source is not received */\n  JERRY_DEBUGGER_SOURCE_RECEIVED = 1, /**< a source has been received */\n  JERRY_DEBUGGER_SOURCE_END = 2, /**< the end of the sources signal received */\n  JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED, /**< the context reset request has been received */\n} jerry_debugger_wait_for_source_status_t;\n\n/**\n * Callback for jerry_debugger_wait_and_run_client_source\n *\n * The callback receives the source name, source code and a user pointer.\n *\n * @return this value is passed back by jerry_debugger_wait_and_run_client_source\n */\ntypedef jerry_value_t (*jerry_debugger_wait_for_source_callback_t) (const jerry_char_t *source_name_p,\n                                                                    size_t source_name_size,\n                                                                    const jerry_char_t *source_p,\n                                                                    size_t source_size,\n                                                                    void *user_p);\n\n/**\n * Engine debugger functions.\n */\nbool jerry_debugger_is_connected (void);\nvoid jerry_debugger_stop (void);\nvoid jerry_debugger_continue (void);\nvoid jerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint);\njerry_debugger_wait_for_source_status_t\njerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t callback_p,\n                                       void *user_p,\n                                       jerry_value_t *return_value);\nvoid jerry_debugger_send_output (const jerry_char_t *buffer, jerry_size_t str_size);\n\n/**\n * @}\n */\n\nJERRY_C_API_END\n\n#endif /* !JERRYSCRIPT_DEBUGGER_H */\n"
  },
  {
    "path": "jerry-core/include/jerryscript-port.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYSCRIPT_PORT_H\n#define JERRYSCRIPT_PORT_H\n\n#include \"jerryscript-types.h\"\n\nJERRY_C_API_BEGIN\n\n/**\n * @defgroup jerry-port JerryScript Port API\n * @{\n */\n\n/**\n * @defgroup jerry-port-process Process management API\n *\n * It is questionable whether a library should be able to terminate an\n * application. However, as of now, we only have the concept of completion\n * code around jerry_parse and jerry_run. Most of the other API functions\n * have no way of signaling an error. So, we keep the termination approach\n * with this port function.\n *\n * @{\n */\n\n/**\n * Error codes that can be passed by the engine when calling jerry_port_fatal\n */\ntypedef enum\n{\n  JERRY_FATAL_OUT_OF_MEMORY = 10, /**< Out of memory */\n  JERRY_FATAL_REF_COUNT_LIMIT = 12, /**< Reference count limit reached */\n  JERRY_FATAL_DISABLED_BYTE_CODE = 13, /**< Executed disabled instruction */\n  JERRY_FATAL_UNTERMINATED_GC_LOOPS = 14, /**< Garbage collection loop limit reached */\n  JERRY_FATAL_FAILED_ASSERTION = 120 /**< Assertion failed */\n} jerry_fatal_code_t;\n\n/**\n * Init the program\n */\nvoid jerry_port_init (void);\n\n/**\n * Signal the port that the process experienced a fatal failure from which it cannot\n * recover.\n *\n * A libc-based port may implement this with exit() or abort(), or both.\n *\n * @param code: the cause of the error.\n */\nvoid JERRY_ATTR_NORETURN jerry_port_fatal (jerry_fatal_code_t code);\n\n/**\n * Make the process sleep for a given time.\n *\n * This port function can be called by jerry-core when JERRY_DEBUGGER is enabled.\n * Otherwise this function is not used.\n *\n * @param sleep_time: milliseconds to sleep.\n */\nvoid jerry_port_sleep (uint32_t sleep_time);\n\n/**\n * jerry-port-process @}\n */\n\n/**\n * @defgroup jerry-port-context External Context API\n * @{\n */\n\n/**\n * Allocate a new context for the engine.\n *\n * This port function is called by jerry_init when JERRY_EXTERNAL_CONTEXT is enabled. Otherwise this function is not\n * used.\n *\n * The engine will pass the size required for the context structure. An implementation must make sure to\n * allocate at least this amount.\n *\n * Excess allocated space will be used as the engine heap when JerryScript is configured to use it's internal allocator,\n * this can be used to control the internal heap size.\n *\n * NOTE: The allocated memory must be pointer-aligned, otherwise the behavior is undefined.\n *\n * @param context_size: the size of the internal context structure\n *\n * @return total size of the allocated buffer\n */\nsize_t jerry_port_context_alloc (size_t context_size);\n\n/**\n * Get the currently active context of the engine.\n *\n * This port function is called by jerry-core when JERRY_EXTERNAL_CONTEXT is enabled.\n * Otherwise this function is not used.\n *\n * @return the pointer to the currently used engine context.\n */\nstruct jerry_context_t *jerry_port_context_get (void);\n\n/**\n * Free the currently used context.\n *\n * This port function is called by jerry_cleanup when JERRY_EXTERNAL_CONTEXT is enabled.\n * Otherwise this function is not used.\n */\nvoid jerry_port_context_free (void);\n\n/**\n * jerry-port-context @}\n */\n\n/**\n * @defgroup jerry-port-io I/O API\n * @{\n */\n\n/**\n * Display or log a debug/error message.\n *\n * The message is passed as a zero-terminated string. Messages may be logged in parts, which\n * will result in multiple calls to this functions. The implementation should consider\n * this before appending or prepending strings to the argument.\n *\n * This function is called with messages coming from the jerry engine as\n * the result of some abnormal operation or describing its internal operations\n * (e.g., data structure dumps or tracing info).\n *\n * The implementation can decide whether error and debug messages are logged to\n * the console, or saved to a database or to a file.\n *\n * @param message_p: the message to log.\n */\nvoid jerry_port_log (const char *message_p);\n\n/**\n * Print a buffer to standard output\n *\n * This port function is never called from jerry-core directly, it is only used by jerry-ext components to print\n * information.\n *\n * @param buffer_p: input buffer\n * @param buffer_size: data size\n */\nvoid jerry_port_print_buffer (const jerry_char_t *buffer_p, jerry_size_t buffer_size);\n\n/**\n * Read a line from standard input.\n *\n * The implementation should allocate storage necessary for the string. The result string should include the ending line\n * terminator character(s) and should be zero terminated.\n *\n * An implementation may return NULL to signal that the end of input is reached, or an error occured.\n *\n * When a non-NULL value is returned, the caller will pass the returned value to `jerry_port_line_free` when the line is\n * no longer needed. This can be used to finalize dynamically allocated buffers if necessary.\n *\n * This port function is never called from jerry-core directly, it is only used by some jerry-ext components that\n * require user input.\n *\n * @param out_size_p: size of the input string in bytes, excluding terminating zero byte\n *\n * @return pointer to the buffer storing the string,\n *         or NULL if end of input\n */\njerry_char_t *jerry_port_line_read (jerry_size_t *out_size_p);\n\n/**\n * Free a line buffer allocated by jerry_port_line_read\n *\n * @param buffer_p: buffer returned by jerry_port_line_read\n */\nvoid jerry_port_line_free (jerry_char_t *buffer_p);\n\n/**\n * jerry-port-io @}\n */\n\n/**\n * @defgroup jerry-port-fd Filesystem API\n * @{\n */\n\n/**\n * Canonicalize a file path.\n *\n * If possible, the implementation should resolve symbolic links and other directory references found in the input path,\n * and create a fully canonicalized file path as the result.\n *\n * The function may return with NULL in case an error is encountered, in which case the calling operation will not\n * proceed.\n *\n * The implementation should allocate storage for the result path as necessary. Non-NULL return values will be passed\n * to `jerry_port_path_free` when the result is no longer needed by the caller, which can be used to finalize\n * dynamically allocated buffers.\n *\n * NOTE: The implementation must not return directly with the input, as the input buffer is released after the call.\n *\n * @param path_p: zero-terminated string containing the input path\n * @param path_size: size of the input path string in bytes, excluding terminating zero\n *\n * @return buffer with the normalized path if the operation is successful,\n *         NULL otherwise\n */\njerry_char_t *jerry_port_path_normalize (const jerry_char_t *path_p, jerry_size_t path_size);\n\n/**\n * Free a path buffer returned by jerry_port_path_normalize.\n *\n * @param path_p: the path buffer to free\n */\nvoid jerry_port_path_free (jerry_char_t *path_p);\n\n/**\n * Get the offset of the basename component in the input path.\n *\n * The implementation should return the offset of the first character after the last path separator found in the path.\n * This is used by the caller to split the path into a directory name and a file name.\n *\n * @param path_p: input zero-terminated path string\n *\n * @return offset of the basename component in the input path\n */\njerry_size_t jerry_port_path_base (const jerry_char_t *path_p);\n\n/**\n * Open a source file and read its contents into a buffer.\n *\n * When the source file is no longer needed by the caller, the returned pointer will be passed to\n * `jerry_port_source_free`, which can be used to finalize the buffer.\n *\n * @param file_name_p: Path that points to the source file in the filesystem.\n * @param out_size_p: The opened file's size in bytes.\n *\n * @return pointer to the buffer which contains the content of the file.\n */\njerry_char_t *jerry_port_source_read (const char *file_name_p, jerry_size_t *out_size_p);\n\n/**\n * Free a source file buffer.\n *\n * @param buffer_p: buffer returned by jerry_port_source_read\n */\nvoid jerry_port_source_free (jerry_char_t *buffer_p);\n\n/**\n * jerry-port-fs @}\n */\n\n/**\n * @defgroup jerry-port-date Date API\n * @{\n */\n\n/**\n * Get local time zone adjustment in milliseconds for the given input time.\n *\n * The argument is a time value representing milliseconds since unix epoch.\n *\n * Ideally, this function should satisfy the stipulations applied to LocalTZA\n * in section 21.4.1.7 of the ECMAScript version 12.0, as if called with isUTC true.\n *\n * This port function can be called by jerry-core when JERRY_BUILTIN_DATE is enabled.\n * Otherwise this function is not used.\n *\n * @param unix_ms: time value in milliseconds since unix epoch\n *\n * @return local time offset in milliseconds applied to UTC for the given time value\n */\nint32_t jerry_port_local_tza (double unix_ms);\n\n/**\n * Get the current system time in UTC.\n *\n * This port function is called by jerry-core when JERRY_BUILTIN_DATE is enabled.\n * It can also be used in the implementing application to initialize the random number generator.\n *\n * @return milliseconds since Unix epoch\n */\ndouble jerry_port_current_time (void);\n\n/**\n * jerry-port-date @}\n */\n\n/**\n * jerry-port @}\n */\n\nJERRY_C_API_END\n\n#endif /* !JERRYSCRIPT_PORT_H */\n\n/* vim: set fdm=marker fmr=@{,@}: */\n"
  },
  {
    "path": "jerry-core/include/jerryscript-snapshot.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYSCRIPT_SNAPSHOT_H\n#define JERRYSCRIPT_SNAPSHOT_H\n\n#include \"jerryscript-types.h\"\n\nJERRY_C_API_BEGIN\n\n/** \\addtogroup jerry-snapshot Jerry engine interface - Snapshot feature\n * @{\n */\n\n/**\n * Jerry snapshot format version.\n */\n#define JERRY_SNAPSHOT_VERSION (70u)\n\n/**\n * Flags for jerry_generate_snapshot and jerry_generate_function_snapshot.\n */\ntypedef enum\n{\n  JERRY_SNAPSHOT_SAVE_STATIC = (1u << 0), /**< static snapshot */\n} jerry_generate_snapshot_opts_t;\n\n/**\n * Flags for jerry_exec_snapshot.\n */\ntypedef enum\n{\n  JERRY_SNAPSHOT_EXEC_COPY_DATA = (1u << 0), /**< copy snashot data */\n  JERRY_SNAPSHOT_EXEC_ALLOW_STATIC = (1u << 1), /**< static snapshots allowed */\n  JERRY_SNAPSHOT_EXEC_LOAD_AS_FUNCTION = (1u << 2), /**< load snapshot as function instead of executing it */\n  JERRY_SNAPSHOT_EXEC_HAS_SOURCE_NAME = (1u << 3), /**< source_name field is valid\n                                                    *   in jerry_exec_snapshot_option_values_t */\n  JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE = (1u << 4), /**< user_value field is valid\n                                                   *   in jerry_exec_snapshot_option_values_t */\n} jerry_exec_snapshot_opts_t;\n\n/**\n * Various configuration options for jerry_exec_snapshot.\n */\ntypedef struct\n{\n  jerry_value_t source_name; /**< source name string (usually a file name)\n                              *   if JERRY_SNAPSHOT_EXEC_HAS_SOURCE_NAME is set in exec_snapshot_opts\n                              *   Note: non-string values are ignored */\n  jerry_value_t user_value; /**< user value assigned to all functions created by this script including\n                             *   eval calls executed by the script if JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE\n                             *   is set in exec_snapshot_opts */\n} jerry_exec_snapshot_option_values_t;\n\n/**\n * Snapshot functions.\n */\njerry_value_t jerry_generate_snapshot (jerry_value_t compiled_code,\n                                       uint32_t generate_snapshot_opts,\n                                       uint32_t *buffer_p,\n                                       size_t buffer_size);\n\njerry_value_t jerry_exec_snapshot (const uint32_t *snapshot_p,\n                                   size_t snapshot_size,\n                                   size_t func_index,\n                                   uint32_t exec_snapshot_opts,\n                                   const jerry_exec_snapshot_option_values_t *options_values_p);\n\nsize_t jerry_merge_snapshots (const uint32_t **inp_buffers_p,\n                              size_t *inp_buffer_sizes_p,\n                              size_t number_of_snapshots,\n                              uint32_t *out_buffer_p,\n                              size_t out_buffer_size,\n                              const char **error_p);\nsize_t jerry_get_literals_from_snapshot (const uint32_t *snapshot_p,\n                                         size_t snapshot_size,\n                                         jerry_char_t *lit_buf_p,\n                                         size_t lit_buf_size,\n                                         bool is_c_format);\n/**\n * @}\n */\n\nJERRY_C_API_END\n\n#endif /* !JERRYSCRIPT_SNAPSHOT_H */\n"
  },
  {
    "path": "jerry-core/include/jerryscript-types.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYSCRIPT_TYPES_H\n#define JERRYSCRIPT_TYPES_H\n\n#include <stdbool.h>\n#include <stddef.h>\n#include <stdint.h>\n\n#include \"jerryscript-compiler.h\"\n\nJERRY_C_API_BEGIN\n\n/**\n * @defgroup jerry-api-types JerryScript public API types\n * @{\n */\n\n/**\n * JerryScript init flags.\n */\ntypedef enum\n{\n  JERRY_INIT_EMPTY = (0u), /**< empty flag set */\n  JERRY_INIT_SHOW_OPCODES = (1u << 0), /**< dump byte-code to log after parse */\n  JERRY_INIT_SHOW_REGEXP_OPCODES = (1u << 1), /**< dump regexp byte-code to log after compilation */\n  JERRY_INIT_MEM_STATS = (1u << 2), /**< dump memory statistics */\n} jerry_init_flag_t;\n\n/**\n * Jerry log levels. The levels are ordered by severity,\n * with the most serious levels listed first.\n */\ntypedef enum\n{\n  JERRY_LOG_LEVEL_ERROR = 0u, /**< the engine will terminate after the message is printed */\n  JERRY_LOG_LEVEL_WARNING = 1u, /**< a request is aborted, but the engine continues its operation */\n  JERRY_LOG_LEVEL_DEBUG = 2u, /**< debug messages from the engine, low volume */\n  JERRY_LOG_LEVEL_TRACE = 3u /**< detailed info about engine internals, potentially high volume */\n} jerry_log_level_t;\n\n/**\n * JerryScript API Error object types.\n */\ntypedef enum\n{\n  JERRY_ERROR_NONE = 0, /**< No Error */\n\n  JERRY_ERROR_COMMON, /**< Error */\n  JERRY_ERROR_EVAL, /**< EvalError */\n  JERRY_ERROR_RANGE, /**< RangeError */\n  JERRY_ERROR_REFERENCE, /**< ReferenceError */\n  JERRY_ERROR_SYNTAX, /**< SyntaxError */\n  JERRY_ERROR_TYPE, /**< TypeError */\n  JERRY_ERROR_URI, /**< URIError */\n  JERRY_ERROR_AGGREGATE /**< AggregateError */\n} jerry_error_t;\n\n/**\n * JerryScript feature types.\n */\ntypedef enum\n{\n  JERRY_FEATURE_CPOINTER_32_BIT, /**< 32 bit compressed pointers */\n  JERRY_FEATURE_ERROR_MESSAGES, /**< error messages */\n  JERRY_FEATURE_JS_PARSER, /**< js-parser */\n  JERRY_FEATURE_HEAP_STATS, /**< memory statistics */\n  JERRY_FEATURE_PARSER_DUMP, /**< parser byte-code dumps */\n  JERRY_FEATURE_REGEXP_DUMP, /**< regexp byte-code dumps */\n  JERRY_FEATURE_SNAPSHOT_SAVE, /**< saving snapshot files */\n  JERRY_FEATURE_SNAPSHOT_EXEC, /**< executing snapshot files */\n  JERRY_FEATURE_DEBUGGER, /**< debugging */\n  JERRY_FEATURE_VM_EXEC_STOP, /**< stopping ECMAScript execution */\n  JERRY_FEATURE_VM_THROW, /**< capturing ECMAScript throws */\n  JERRY_FEATURE_JSON, /**< JSON support */\n  JERRY_FEATURE_TYPEDARRAY, /**< Typedarray support */\n  JERRY_FEATURE_DATE, /**< Date support */\n  JERRY_FEATURE_REGEXP, /**< Regexp support */\n  JERRY_FEATURE_LINE_INFO, /**< line info available */\n  JERRY_FEATURE_LOGGING, /**< logging */\n  JERRY_FEATURE_SYMBOL, /**< symbol support */\n  JERRY_FEATURE_DATAVIEW, /**< DataView support */\n  JERRY_FEATURE_PROXY, /**< Proxy support */\n  JERRY_FEATURE_MAP, /**< Map support */\n  JERRY_FEATURE_SET, /**< Set support */\n  JERRY_FEATURE_WEAKMAP, /**< WeakMap support */\n  JERRY_FEATURE_WEAKSET, /**< WeakSet support */\n  JERRY_FEATURE_BIGINT, /**< BigInt support */\n  JERRY_FEATURE_REALM, /**< realm support */\n  JERRY_FEATURE_GLOBAL_THIS, /**< GlobalThisValue support */\n  JERRY_FEATURE_PROMISE_CALLBACK, /**< Promise callback support */\n  JERRY_FEATURE_MODULE, /**< Module support */\n  JERRY_FEATURE_WEAKREF, /**< WeakRef support */\n  JERRY_FEATURE_FUNCTION_TO_STRING, /**< function toString support */\n  JERRY_FEATURE__COUNT /**< number of features. NOTE: must be at the end of the list */\n} jerry_feature_t;\n\n/**\n * GC operational modes.\n */\ntypedef enum\n{\n  JERRY_GC_PRESSURE_LOW, /**< free unused objects, but keep memory\n                          *   allocated for performance improvements\n                          *   such as property hash tables for large objects */\n  JERRY_GC_PRESSURE_HIGH /**< free as much memory as possible */\n} jerry_gc_mode_t;\n\n/**\n * Jerry regexp flags.\n */\ntypedef enum\n{\n  JERRY_REGEXP_FLAG_GLOBAL = (1u << 1), /**< Globally scan string */\n  JERRY_REGEXP_FLAG_IGNORE_CASE = (1u << 2), /**< Ignore case */\n  JERRY_REGEXP_FLAG_MULTILINE = (1u << 3), /**< Multiline string scan */\n  JERRY_REGEXP_FLAG_STICKY = (1u << 4), /**< ECMAScript v11, 21.2.5.14 */\n  JERRY_REGEXP_FLAG_UNICODE = (1u << 5), /**< ECMAScript v11, 21.2.5.17 */\n  JERRY_REGEXP_FLAG_DOTALL = (1u << 6) /**< ECMAScript v11, 21.2.5.3 */\n} jerry_regexp_flags_t;\n\n/**\n * Character type of JerryScript.\n */\ntypedef uint8_t jerry_char_t;\n\n/**\n * Size type of JerryScript.\n */\ntypedef uint32_t jerry_size_t;\n\n/**\n * Length type of JerryScript.\n */\ntypedef uint32_t jerry_length_t;\n\n/**\n * Description of a JerryScript value.\n */\ntypedef uint32_t jerry_value_t;\n\n/**\n * Option bits for jerry_parse_options_t.\n */\ntypedef enum\n{\n  JERRY_PARSE_NO_OPTS = 0, /**< no options passed */\n  JERRY_PARSE_STRICT_MODE = (1 << 0), /**< enable strict mode */\n  JERRY_PARSE_MODULE = (1 << 1), /**< parse source as an ECMAScript module */\n  JERRY_PARSE_HAS_ARGUMENT_LIST = (1 << 2), /**< argument_list field is valid,\n                                             * this also means that function parsing will be done */\n  JERRY_PARSE_HAS_SOURCE_NAME = (1 << 3), /**< source_name field is valid */\n  JERRY_PARSE_HAS_START = (1 << 4), /**< start_line and start_column fields are valid */\n  JERRY_PARSE_HAS_USER_VALUE = (1 << 5), /**< user_value field is valid */\n} jerry_parse_option_enable_feature_t;\n\n/**\n * Various configuration options for parsing functions such as jerry_parse or jerry_parse_function.\n */\ntypedef struct\n{\n  uint32_t options; /**< combination of jerry_parse_option_enable_feature_t values */\n  jerry_value_t argument_list; /**< function argument list if JERRY_PARSE_HAS_ARGUMENT_LIST is set in options\n                                *   Note: must be string value */\n  jerry_value_t source_name; /**< source name string (usually a file name)\n                              *   if JERRY_PARSE_HAS_SOURCE_NAME is set in options\n                              *   Note: must be string value */\n  uint32_t start_line; /**< start line of the source code if JERRY_PARSE_HAS_START is set in options */\n  uint32_t start_column; /**< start column of the source code if JERRY_PARSE_HAS_START is set in options */\n  jerry_value_t user_value; /**< user value assigned to all functions created by this script including eval\n                             *   calls executed by the script if JERRY_PARSE_HAS_USER_VALUE is set in options */\n} jerry_parse_options_t;\n\n/**\n * Description of ECMA property descriptor.\n */\ntypedef enum\n{\n  JERRY_PROP_NO_OPTS = (0), /**< empty property descriptor */\n  JERRY_PROP_IS_CONFIGURABLE = (1 << 0), /**< [[Configurable]] */\n  JERRY_PROP_IS_ENUMERABLE = (1 << 1), /**< [[Enumerable]] */\n  JERRY_PROP_IS_WRITABLE = (1 << 2), /**< [[Writable]] */\n\n  JERRY_PROP_IS_CONFIGURABLE_DEFINED = (1 << 3), /**< is [[Configurable]] defined? */\n  JERRY_PROP_IS_ENUMERABLE_DEFINED = (1 << 4), /**< is [[Enumerable]] defined? */\n  JERRY_PROP_IS_WRITABLE_DEFINED = (1 << 5), /**< is [[Writable]] defined? */\n\n  JERRY_PROP_IS_VALUE_DEFINED = (1 << 6), /**< is [[Value]] defined? */\n  JERRY_PROP_IS_GET_DEFINED = (1 << 7), /**< is [[Get]] defined? */\n  JERRY_PROP_IS_SET_DEFINED = (1 << 8), /**< is [[Set]] defined? */\n\n  JERRY_PROP_SHOULD_THROW = (1 << 9), /**< should throw on error, instead of returning with false */\n} jerry_property_descriptor_flags_t;\n\n/**\n * Description of ECMA property descriptor.\n */\ntypedef struct\n{\n  uint16_t flags; /**< any combination of jerry_property_descriptor_flags_t bits */\n  jerry_value_t value; /**< [[Value]] */\n  jerry_value_t getter; /**< [[Get]] */\n  jerry_value_t setter; /**< [[Set]] */\n} jerry_property_descriptor_t;\n\n/**\n * JerryScript object property filter options.\n */\ntypedef enum\n{\n  JERRY_PROPERTY_FILTER_ALL = 0, /**< List all property keys independently\n                                  *   from key type or property value attributes\n                                  *   (equivalent to Reflect.ownKeys call)  */\n  JERRY_PROPERTY_FILTER_TRAVERSE_PROTOTYPE_CHAIN = (1 << 0), /**< Include keys from the objects's\n                                                              *   prototype chain as well */\n  JERRY_PROPERTY_FILTER_EXCLUDE_NON_CONFIGURABLE = (1 << 1), /**< Exclude property key if\n                                                              *   the property is non-configurable */\n  JERRY_PROPERTY_FILTER_EXCLUDE_NON_ENUMERABLE = (1 << 2), /**< Exclude property key if\n                                                            *   the property is non-enumerable */\n  JERRY_PROPERTY_FILTER_EXCLUDE_NON_WRITABLE = (1 << 3), /**< Exclude property key if\n                                                          *   the property is non-writable */\n  JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS = (1 << 4), /**< Exclude property key if it is a string */\n  JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS = (1 << 5), /**< Exclude property key if it is a symbol */\n  JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES = (1 << 6), /**< Exclude property key if it is an integer index */\n  JERRY_PROPERTY_FILTER_INTEGER_INDICES_AS_NUMBER = (1 << 7), /**< By default integer index property keys are\n                                                               *   converted to string. Enabling this flags keeps\n                                                               *   integer index property keys as numbers. */\n} jerry_property_filter_t;\n\n/**\n * String encoding.\n */\ntypedef enum\n{\n  JERRY_ENCODING_CESU8, /**< cesu-8 encoding */\n  JERRY_ENCODING_UTF8, /**< utf-8 encoding */\n} jerry_encoding_t;\n\n/**\n * Description of JerryScript heap memory stats.\n * It is for memory profiling.\n */\ntypedef struct\n{\n  size_t version; /**< the version of the stats struct */\n  size_t size; /**< heap total size */\n  size_t allocated_bytes; /**< currently allocated bytes */\n  size_t peak_allocated_bytes; /**< peak allocated bytes */\n  size_t reserved[4]; /**< padding for future extensions */\n} jerry_heap_stats_t;\n\n/**\n * Call related information passed to jerry_external_handler_t.\n */\ntypedef struct jerry_call_info_t\n{\n  jerry_value_t function; /**< invoked function object */\n  jerry_value_t this_value; /**< this value passed to the function  */\n  jerry_value_t new_target; /**< current new target value, undefined for non-constructor calls */\n} jerry_call_info_t;\n\n/**\n * Type of an external function handler.\n */\ntypedef jerry_value_t (*jerry_external_handler_t) (const jerry_call_info_t *call_info_p,\n                                                   const jerry_value_t args_p[],\n                                                   const jerry_length_t args_count);\n\n/**\n * Native free callback of generic value types.\n */\ntypedef void (*jerry_value_free_cb_t) (void *native_p);\n\n/**\n * Forward definition of jerry_object_native_info_t.\n */\nstruct jerry_object_native_info_t;\n\n/**\n * Native free callback of an object.\n */\ntypedef void (*jerry_object_native_free_cb_t) (void *native_p, struct jerry_object_native_info_t *info_p);\n\n/**\n * Free callback for external strings.\n */\ntypedef void (*jerry_external_string_free_cb_t) (jerry_char_t *string_p, jerry_size_t string_size, void *user_p);\n\n/**\n * Decorator callback for Error objects. The decorator can create\n * or update any properties of the newly created Error object.\n */\ntypedef void (*jerry_error_object_created_cb_t) (const jerry_value_t error_object, void *user_p);\n\n/**\n * Callback which tells whether the ECMAScript execution should be stopped.\n *\n * As long as the function returns with undefined the execution continues.\n * When a non-undefined value is returned the execution stops and the value\n * is thrown by the engine as an exception.\n *\n * Note: if the function returns with a non-undefined value it\n *       must return with the same value for future calls.\n *\n * @param user_data_p: optional user data pointer\n */\ntypedef jerry_value_t (*jerry_halt_cb_t) (void *user_data_p);\n\n/**\n * Callback function which is called when an exception is thrown in an ECMAScript code.\n * The callback should not change the exception_value. The callback is not called again\n * until the value is caught.\n *\n * Note: the engine considers exceptions thrown by external functions as never caught.\n *\n * @param exception_value: the thrown exception\n * @param user_data_p: optional user data pointer\n */\ntypedef void (*jerry_throw_cb_t) (const jerry_value_t exception_value, void *user_data_p);\n\n/**\n * Function type applied to each unit of encoding when iterating over a string.\n *\n * @param value:  encoded byte value\n * @param user_data_p: optional user data pointer\n */\ntypedef void (*jerry_string_iterate_cb_t) (uint32_t value, void *user_data_p);\n\n/**\n * Function type applied for each data property of an object.\n */\ntypedef bool (*jerry_object_property_foreach_cb_t) (const jerry_value_t property_name,\n                                                    const jerry_value_t property_value,\n                                                    void *user_data_p);\n\n/**\n * Function type applied for each object in the engine.\n */\ntypedef bool (*jerry_foreach_live_object_cb_t) (const jerry_value_t object, void *user_data_p);\n\n/**\n * Function type applied for each matching object in the engine.\n */\ntypedef bool (*jerry_foreach_live_object_with_info_cb_t) (const jerry_value_t object,\n                                                          void *object_data_p,\n                                                          void *user_data_p);\n\n/**\n * User context item manager\n */\ntypedef struct\n{\n  /**\n   * Callback responsible for initializing a context item, or NULL to zero out the memory. This is called lazily, the\n   * first time jerry_context_data () is called with this manager.\n   *\n   * @param [in] data The buffer that JerryScript allocated for the manager. The buffer is zeroed out. The size is\n   * determined by the bytes_needed field. The buffer is kept alive until jerry_cleanup () is called.\n   */\n  void (*init_cb) (void *data);\n\n  /**\n   * Callback responsible for deinitializing a context item, or NULL. This is called as part of jerry_cleanup (),\n   * right *before* the VM has been cleaned up. This is a good place to release strong references to jerry_value_t's\n   * that the manager may be holding.\n   * Note: because the VM has not been fully cleaned up yet, jerry_object_native_info_t free_cb's can still get called\n   * *after* all deinit_cb's have been run. See finalize_cb for a callback that is guaranteed to run *after* all\n   * free_cb's have been run.\n   *\n   * @param [in] data The buffer that JerryScript allocated for the manager.\n   */\n  void (*deinit_cb) (void *data);\n\n  /**\n   * Callback responsible for finalizing a context item, or NULL. This is called as part of jerry_cleanup (),\n   * right *after* the VM has been cleaned up and destroyed and jerry_... APIs cannot be called any more. At this point,\n   * all values in the VM have been cleaned up. This is a good place to clean up native state that can only be cleaned\n   * up at the very end when there are no more VM values around that may need to access that state.\n   *\n   * @param [in] data The buffer that JerryScript allocated for the manager. After returning from this callback,\n   * the data pointer may no longer be used.\n   */\n  void (*finalize_cb) (void *data);\n\n  /**\n   * Number of bytes to allocate for this manager. This is the size of the buffer that JerryScript will allocate on\n   * behalf of the manager. The pointer to this buffer is passed into init_cb, deinit_cb and finalize_cb. It is also\n   * returned from the jerry_context_data () API.\n   */\n  size_t bytes_needed;\n} jerry_context_data_manager_t;\n\n/**\n * Function type for allocating buffer for JerryScript context.\n */\ntypedef void *(*jerry_context_alloc_cb_t) (size_t size, void *cb_data_p);\n\n/**\n * Type information of a native pointer.\n */\ntypedef struct jerry_object_native_info_t\n{\n  jerry_object_native_free_cb_t free_cb; /**< the free callback of the native pointer */\n  uint16_t number_of_references; /**< the number of value references which are marked by the garbage collector */\n  uint16_t offset_of_references; /**< byte offset indicating the start offset of value\n                                  *   references in the user allocated buffer */\n} jerry_object_native_info_t;\n\n/**\n * An opaque declaration of the JerryScript context structure.\n */\ntypedef struct jerry_context_t jerry_context_t;\n\n/**\n * Enum that contains the supported binary operation types\n */\ntypedef enum\n{\n  JERRY_BIN_OP_EQUAL = 0u, /**< equal comparison (==) */\n  JERRY_BIN_OP_STRICT_EQUAL, /**< strict equal comparison (===) */\n  JERRY_BIN_OP_LESS, /**< less relation (<) */\n  JERRY_BIN_OP_LESS_EQUAL, /**< less or equal relation (<=) */\n  JERRY_BIN_OP_GREATER, /**< greater relation (>) */\n  JERRY_BIN_OP_GREATER_EQUAL, /**< greater or equal relation (>=)*/\n  JERRY_BIN_OP_INSTANCEOF, /**< instanceof operation */\n  JERRY_BIN_OP_ADD, /**< addition operator (+) */\n  JERRY_BIN_OP_SUB, /**< subtraction operator (-) */\n  JERRY_BIN_OP_MUL, /**< multiplication operator (*) */\n  JERRY_BIN_OP_DIV, /**< division operator (/) */\n  JERRY_BIN_OP_REM, /**< remainder operator (%) */\n} jerry_binary_op_t;\n\n/**\n * Backtrace related types.\n */\n\n/**\n * List of backtrace frame types returned by jerry_frame_type.\n */\ntypedef enum\n{\n  JERRY_BACKTRACE_FRAME_JS, /**< indicates that the frame is created for a JavaScript function/method */\n} jerry_frame_type_t;\n\n/**\n * Location info retrieved by jerry_frame_location.\n */\ntypedef struct\n{\n  jerry_value_t source_name; /**< source name */\n  jerry_size_t line; /**< line index */\n  jerry_size_t column; /**< column index */\n} jerry_frame_location_t;\n\n/*\n * Internal data structure for jerry_frame_t definition.\n */\nstruct jerry_frame_internal_t;\n\n/**\n * Backtrace frame data passed to the jerry_backtrace_cb_t handler.\n */\ntypedef struct jerry_frame_internal_t jerry_frame_t;\n\n/**\n * Callback function which is called by jerry_backtrace for each stack frame.\n */\ntypedef bool (*jerry_backtrace_cb_t) (jerry_frame_t *frame_p, void *user_p);\n\n/**\n * Detailed value type related types.\n */\n\n/**\n * JerryScript API value type information.\n */\ntypedef enum\n{\n  JERRY_TYPE_NONE = 0u, /**< no type information */\n  JERRY_TYPE_UNDEFINED, /**< undefined type */\n  JERRY_TYPE_NULL, /**< null type */\n  JERRY_TYPE_BOOLEAN, /**< boolean type */\n  JERRY_TYPE_NUMBER, /**< number type */\n  JERRY_TYPE_STRING, /**< string type */\n  JERRY_TYPE_OBJECT, /**< object type */\n  JERRY_TYPE_FUNCTION, /**< function type */\n  JERRY_TYPE_EXCEPTION, /**< exception/abort type */\n  JERRY_TYPE_SYMBOL, /**< symbol type */\n  JERRY_TYPE_BIGINT, /**< bigint type */\n} jerry_type_t;\n\n/**\n * JerryScript object type information.\n */\ntypedef enum\n{\n  JERRY_OBJECT_TYPE_NONE = 0u, /**< Non object type */\n  JERRY_OBJECT_TYPE_GENERIC, /**< Generic JavaScript object without any internal property */\n  JERRY_OBJECT_TYPE_MODULE_NAMESPACE, /**< Namespace object */\n  JERRY_OBJECT_TYPE_ARRAY, /**< Array object */\n  JERRY_OBJECT_TYPE_PROXY, /**< Proxy object */\n  JERRY_OBJECT_TYPE_SCRIPT, /**< Script object (see jerry_parse) */\n  JERRY_OBJECT_TYPE_MODULE, /**< Module object (see jerry_parse) */\n  JERRY_OBJECT_TYPE_PROMISE, /**< Promise object */\n  JERRY_OBJECT_TYPE_DATAVIEW, /**< Dataview object */\n  JERRY_OBJECT_TYPE_FUNCTION, /**< Function object (see jerry_function_type) */\n  JERRY_OBJECT_TYPE_TYPEDARRAY, /**< %TypedArray% object (see jerry_typedarray_type) */\n  JERRY_OBJECT_TYPE_ITERATOR, /**< Iterator object (see jerry_iterator_type) */\n  JERRY_OBJECT_TYPE_CONTAINER, /**< Container object (see jerry_container_get_type) */\n  JERRY_OBJECT_TYPE_ERROR, /**< Error object */\n  JERRY_OBJECT_TYPE_ARRAYBUFFER, /**< Array buffer object */\n  JERRY_OBJECT_TYPE_SHARED_ARRAY_BUFFER, /**< Shared Array Buffer object */\n\n  JERRY_OBJECT_TYPE_ARGUMENTS, /**< Arguments object */\n  JERRY_OBJECT_TYPE_BOOLEAN, /**< Boolean object */\n  JERRY_OBJECT_TYPE_DATE, /**< Date object */\n  JERRY_OBJECT_TYPE_NUMBER, /**< Number object */\n  JERRY_OBJECT_TYPE_REGEXP, /**< RegExp object */\n  JERRY_OBJECT_TYPE_STRING, /**< String object */\n  JERRY_OBJECT_TYPE_SYMBOL, /**< Symbol object */\n  JERRY_OBJECT_TYPE_GENERATOR, /**< Generator object */\n  JERRY_OBJECT_TYPE_BIGINT, /**< BigInt object */\n  JERRY_OBJECT_TYPE_WEAKREF, /**< WeakRef object */\n} jerry_object_type_t;\n\n/**\n * JerryScript function object type information.\n */\ntypedef enum\n{\n  JERRY_FUNCTION_TYPE_NONE = 0u, /**< Non function type */\n  JERRY_FUNCTION_TYPE_GENERIC, /**< Generic JavaScript function */\n  JERRY_FUNCTION_TYPE_ACCESSOR, /**< Accessor function */\n  JERRY_FUNCTION_TYPE_BOUND, /**< Bound function */\n  JERRY_FUNCTION_TYPE_ARROW, /**< Arrow function */\n  JERRY_FUNCTION_TYPE_GENERATOR, /**< Generator function */\n} jerry_function_type_t;\n\n/**\n * JerryScript iterator object type information.\n */\ntypedef enum\n{\n  JERRY_ITERATOR_TYPE_NONE = 0u, /**< Non iterator type */\n  JERRY_ITERATOR_TYPE_ARRAY, /**< Array iterator */\n  JERRY_ITERATOR_TYPE_STRING, /**< String iterator */\n  JERRY_ITERATOR_TYPE_MAP, /**< Map iterator */\n  JERRY_ITERATOR_TYPE_SET, /**< Set iterator */\n} jerry_iterator_type_t;\n\n/**\n * Module related types.\n */\n\n/**\n * An enum representing the current status of a module\n */\ntypedef enum\n{\n  JERRY_MODULE_STATE_INVALID = 0, /**< return value for jerry_module_state when its argument is not a module */\n  JERRY_MODULE_STATE_UNLINKED = 1, /**< module is currently unlinked */\n  JERRY_MODULE_STATE_LINKING = 2, /**< module is currently being linked */\n  JERRY_MODULE_STATE_LINKED = 3, /**< module has been linked (its dependencies has been resolved) */\n  JERRY_MODULE_STATE_EVALUATING = 4, /**< module is currently being evaluated */\n  JERRY_MODULE_STATE_EVALUATED = 5, /**< module has been evaluated (its source code has been executed) */\n  JERRY_MODULE_STATE_ERROR = 6, /**< an error has been encountered before the evaluated state is reached */\n} jerry_module_state_t;\n\n/**\n * Callback which is called by jerry_module_link to get the referenced module.\n */\ntypedef jerry_value_t (*jerry_module_resolve_cb_t) (const jerry_value_t specifier,\n                                                    const jerry_value_t referrer,\n                                                    void *user_p);\n\n/**\n * Callback which is called when an import is resolved dynamically to get the referenced module.\n */\ntypedef jerry_value_t (*jerry_module_import_cb_t) (const jerry_value_t specifier,\n                                                   const jerry_value_t user_value,\n                                                   void *user_p);\n\n/**\n * Callback which is called after the module enters into linked, evaluated or error state.\n */\ntypedef void (*jerry_module_state_changed_cb_t) (jerry_module_state_t new_state,\n                                                 const jerry_value_t module,\n                                                 const jerry_value_t value,\n                                                 void *user_p);\n\n/**\n * Callback which is called when an import.meta expression of a module is evaluated the first time.\n */\ntypedef void (*jerry_module_import_meta_cb_t) (const jerry_value_t module,\n                                               const jerry_value_t meta_object,\n                                               void *user_p);\n\n/**\n * Callback which is called by jerry_module_evaluate to evaluate the native module.\n */\ntypedef jerry_value_t (*jerry_native_module_evaluate_cb_t) (const jerry_value_t native_module);\n\n/**\n * Proxy related types.\n */\n\n/**\n * JerryScript special Proxy object options.\n */\ntypedef enum\n{\n  JERRY_PROXY_SKIP_RESULT_VALIDATION = (1u << 0), /**< skip result validation for [[GetPrototypeOf]],\n                                                   *   [[SetPrototypeOf]], [[IsExtensible]],\n                                                   *   [[PreventExtensions]], [[GetOwnProperty]],\n                                                   *   [[DefineOwnProperty]], [[HasProperty]], [[Get]],\n                                                   *   [[Set]], [[Delete]] and [[OwnPropertyKeys]] */\n} jerry_proxy_custom_behavior_t;\n\n/**\n * Promise related types.\n */\n\n/**\n * Enum values representing various Promise states.\n */\ntypedef enum\n{\n  JERRY_PROMISE_STATE_NONE = 0u, /**< Invalid/Unknown state (possibly called on a non-promise object). */\n  JERRY_PROMISE_STATE_PENDING, /**< Promise is in \"Pending\" state. */\n  JERRY_PROMISE_STATE_FULFILLED, /**< Promise is in \"Fulfilled\" state. */\n  JERRY_PROMISE_STATE_REJECTED, /**< Promise is in \"Rejected\" state. */\n} jerry_promise_state_t;\n\n/**\n * Event types for jerry_promise_event_cb_t callback function.\n * The description of the 'object' and 'value' arguments are provided for each type.\n */\ntypedef enum\n{\n  JERRY_PROMISE_EVENT_CREATE = 0u, /**< a new Promise object is created\n                                    *   object: the new Promise object\n                                    *   value: parent Promise for `then` chains, undefined otherwise */\n  JERRY_PROMISE_EVENT_RESOLVE, /**< called when a Promise is about to be resolved\n                                *   object: the Promise object\n                                *   value: value for resolving */\n  JERRY_PROMISE_EVENT_REJECT, /**< called when a Promise is about to be rejected\n                               *   object: the Promise object\n                               *   value: value for rejecting */\n  JERRY_PROMISE_EVENT_RESOLVE_FULFILLED, /**< called when a resolve is called on a fulfilled Promise\n                                          *   object: the Promise object\n                                          *   value: value for resolving */\n  JERRY_PROMISE_EVENT_REJECT_FULFILLED, /**< called when a reject is called on a fulfilled Promise\n                                         *  object: the Promise object\n                                         *  value: value for rejecting */\n  JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER, /**< called when a Promise is rejected without a handler\n                                               *   object: the Promise object\n                                               *   value: value for rejecting */\n  JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED, /**< called when a catch handler is added to a rejected\n                                            *   Promise which did not have a catch handler before\n                                            *   object: the Promise object\n                                            *   value: undefined */\n  JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB, /**< called before executing a Promise reaction job\n                                            *   object: the Promise object\n                                            *   value: undefined */\n  JERRY_PROMISE_EVENT_AFTER_REACTION_JOB, /**< called after a Promise reaction job is completed\n                                           *   object: the Promise object\n                                           *   value: undefined */\n  JERRY_PROMISE_EVENT_ASYNC_AWAIT, /**< called when an async function awaits the result of a Promise object\n                                    *   object: internal object representing the execution status\n                                    *   value: the Promise object */\n  JERRY_PROMISE_EVENT_ASYNC_BEFORE_RESOLVE, /**< called when an async function is continued with resolve\n                                             *   object: internal object representing the execution status\n                                             *   value: value for resolving */\n  JERRY_PROMISE_EVENT_ASYNC_BEFORE_REJECT, /**< called when an async function is continued with reject\n                                            *   object: internal object representing the execution status\n                                            *   value: value for rejecting */\n  JERRY_PROMISE_EVENT_ASYNC_AFTER_RESOLVE, /**< called when an async function resolve is completed\n                                            *   object: internal object representing the execution status\n                                            *   value: value for resolving */\n  JERRY_PROMISE_EVENT_ASYNC_AFTER_REJECT, /**< called when an async function reject is completed\n                                           *   object: internal object representing the execution status\n                                           *   value: value for rejecting */\n} jerry_promise_event_type_t;\n\n/**\n * Filter types for jerry_promise_on_event callback function.\n * The callback is only called for those events which are enabled by the filters.\n */\ntypedef enum\n{\n  JERRY_PROMISE_EVENT_FILTER_DISABLE = 0, /**< disable reporting of all events */\n  JERRY_PROMISE_EVENT_FILTER_CREATE = (1 << 0), /**< enables the following event:\n                                                 *   JERRY_PROMISE_EVENT_CREATE */\n  JERRY_PROMISE_EVENT_FILTER_RESOLVE = (1 << 1), /**< enables the following event:\n                                                  *   JERRY_PROMISE_EVENT_RESOLVE */\n  JERRY_PROMISE_EVENT_FILTER_REJECT = (1 << 2), /**< enables the following event:\n                                                 *   JERRY_PROMISE_EVENT_REJECT */\n  JERRY_PROMISE_EVENT_FILTER_ERROR = (1 << 3), /**< enables the following events:\n                                                *   JERRY_PROMISE_EVENT_RESOLVE_FULFILLED\n                                                *   JERRY_PROMISE_EVENT_REJECT_FULFILLED\n                                                *   JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER\n                                                *   JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED */\n  JERRY_PROMISE_EVENT_FILTER_REACTION_JOB = (1 << 4), /**< enables the following events:\n                                                       *   JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB\n                                                       *   JERRY_PROMISE_EVENT_AFTER_REACTION_JOB */\n  JERRY_PROMISE_EVENT_FILTER_ASYNC_MAIN = (1 << 5), /**< enables the following event:\n                                                     *   JERRY_PROMISE_EVENT_ASYNC_AWAIT */\n  JERRY_PROMISE_EVENT_FILTER_ASYNC_REACTION_JOB = (1 << 6), /**< enables the following events:\n                                                             *   JERRY_PROMISE_EVENT_ASYNC_BEFORE_RESOLVE\n                                                             *   JERRY_PROMISE_EVENT_ASYNC_BEFORE_REJECT\n                                                             *   JERRY_PROMISE_EVENT_ASYNC_AFTER_RESOLVE\n                                                             *   JERRY_PROMISE_EVENT_ASYNC_AFTER_REJECT */\n} jerry_promise_event_filter_t;\n\n/**\n * Notification callback for tracking Promise and async function operations.\n */\ntypedef void (*jerry_promise_event_cb_t) (jerry_promise_event_type_t event_type,\n                                          const jerry_value_t object,\n                                          const jerry_value_t value,\n                                          void *user_p);\n\n/**\n * Symbol related types.\n */\n\n/**\n * List of well-known symbols.\n */\ntypedef enum\n{\n  JERRY_SYMBOL_ASYNC_ITERATOR, /**< @@asyncIterator well-known symbol */\n  JERRY_SYMBOL_HAS_INSTANCE, /**< @@hasInstance well-known symbol */\n  JERRY_SYMBOL_IS_CONCAT_SPREADABLE, /**< @@isConcatSpreadable well-known symbol */\n  JERRY_SYMBOL_ITERATOR, /**< @@iterator well-known symbol */\n  JERRY_SYMBOL_MATCH, /**< @@match well-known symbol */\n  JERRY_SYMBOL_REPLACE, /**< @@replace well-known symbol */\n  JERRY_SYMBOL_SEARCH, /**< @@search well-known symbol */\n  JERRY_SYMBOL_SPECIES, /**< @@species well-known symbol */\n  JERRY_SYMBOL_SPLIT, /**< @@split well-known symbol */\n  JERRY_SYMBOL_TO_PRIMITIVE, /**< @@toPrimitive well-known symbol */\n  JERRY_SYMBOL_TO_STRING_TAG, /**< @@toStringTag well-known symbol */\n  JERRY_SYMBOL_UNSCOPABLES, /**< @@unscopables well-known symbol */\n  JERRY_SYMBOL_MATCH_ALL, /**< @@matchAll well-known symbol */\n} jerry_well_known_symbol_t;\n\n/**\n * TypedArray related types.\n */\n\n/**\n * TypedArray types.\n */\ntypedef enum\n{\n  JERRY_TYPEDARRAY_INVALID = 0,\n  JERRY_TYPEDARRAY_UINT8,\n  JERRY_TYPEDARRAY_UINT8CLAMPED,\n  JERRY_TYPEDARRAY_INT8,\n  JERRY_TYPEDARRAY_UINT16,\n  JERRY_TYPEDARRAY_INT16,\n  JERRY_TYPEDARRAY_UINT32,\n  JERRY_TYPEDARRAY_INT32,\n  JERRY_TYPEDARRAY_FLOAT32,\n  JERRY_TYPEDARRAY_FLOAT64,\n  JERRY_TYPEDARRAY_BIGINT64,\n  JERRY_TYPEDARRAY_BIGUINT64,\n} jerry_typedarray_type_t;\n\n/**\n * Container types.\n */\ntypedef enum\n{\n  JERRY_CONTAINER_TYPE_INVALID = 0, /**< Invalid container */\n  JERRY_CONTAINER_TYPE_MAP, /**< Map type */\n  JERRY_CONTAINER_TYPE_SET, /**< Set type */\n  JERRY_CONTAINER_TYPE_WEAKMAP, /**< WeakMap type */\n  JERRY_CONTAINER_TYPE_WEAKSET, /**< WeakSet type */\n} jerry_container_type_t;\n\n/**\n * Container operations\n */\ntypedef enum\n{\n  JERRY_CONTAINER_OP_ADD, /**< Set/WeakSet add operation */\n  JERRY_CONTAINER_OP_GET, /**< Map/WeakMap get operation */\n  JERRY_CONTAINER_OP_SET, /**< Map/WeakMap set operation */\n  JERRY_CONTAINER_OP_HAS, /**< Set/WeakSet/Map/WeakMap has operation */\n  JERRY_CONTAINER_OP_DELETE, /**< Set/WeakSet/Map/WeakMap delete operation */\n  JERRY_CONTAINER_OP_SIZE, /**< Set/WeakSet/Map/WeakMap size operation */\n  JERRY_CONTAINER_OP_CLEAR, /**< Set/Map clear operation */\n} jerry_container_op_t;\n\n/**\n * Miscellaneous types.\n */\n\n/**\n * Enabled fields of jerry_source_info_t.\n */\ntypedef enum\n{\n  JERRY_SOURCE_INFO_HAS_SOURCE_CODE = (1 << 0), /**< source_code field is valid */\n  JERRY_SOURCE_INFO_HAS_FUNCTION_ARGUMENTS = (1 << 1), /**< function_arguments field is valid */\n  JERRY_SOURCE_INFO_HAS_SOURCE_RANGE = (1 << 2), /**< both source_range_start and source_range_length\n                                                  *   fields are valid */\n} jerry_source_info_enabled_fields_t;\n\n/**\n * Source related information of a script/module/function.\n */\ntypedef struct\n{\n  uint32_t enabled_fields; /**< combination of jerry_source_info_enabled_fields_t values */\n  jerry_value_t source_code; /**< script source code or function body */\n  jerry_value_t function_arguments; /**< function arguments */\n  uint32_t source_range_start; /**< start position of the function in the source code */\n  uint32_t source_range_length; /**< source length of the function in the source code */\n} jerry_source_info_t;\n\n/**\n * Array buffer types.\n */\n\n/**\n * Type of an array buffer.\n */\ntypedef enum\n{\n  JERRY_ARRAYBUFFER_TYPE_ARRAYBUFFER, /**< the object is an array buffer object */\n  JERRY_ARRAYBUFFER_TYPE_SHARED_ARRAYBUFFER, /**< the object is a shared array buffer object */\n} jerry_arraybuffer_type_t;\n\n/**\n * Callback for allocating the backing store of array buffer or shared array buffer objects.\n */\ntypedef uint8_t *(*jerry_arraybuffer_allocate_cb_t) (jerry_arraybuffer_type_t buffer_type,\n                                                     uint32_t buffer_size,\n                                                     void **arraybuffer_user_p,\n                                                     void *user_p);\n\n/**\n * Callback for freeing the backing store of array buffer or shared array buffer objects.\n */\ntypedef void (*jerry_arraybuffer_free_cb_t) (jerry_arraybuffer_type_t buffer_type,\n                                             uint8_t *buffer_p,\n                                             uint32_t buffer_size,\n                                             void *arraybuffer_user_p,\n                                             void *user_p);\n\n/**\n * Helper to expand string literal to [string pointer, string size] argument pair.\n */\n#define JERRY_ZSTR_ARG(str) ((const jerry_char_t *) (str)), ((jerry_size_t) (sizeof (str) - 1))\n\n/**\n * @}\n */\n\nJERRY_C_API_END\n\n#endif /* !JERRYSCRIPT_TYPES_H */\n"
  },
  {
    "path": "jerry-core/include/jerryscript.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYSCRIPT_H\n#define JERRYSCRIPT_H\n\n/**\n * Major version of JerryScript API.\n */\n#define JERRY_API_MAJOR_VERSION 3\n\n/**\n * Minor version of JerryScript API.\n */\n#define JERRY_API_MINOR_VERSION 0\n\n/**\n * Patch version of JerryScript API.\n */\n#define JERRY_API_PATCH_VERSION 0\n\n#include \"jerryscript-core.h\"\n#include \"jerryscript-debugger.h\"\n#include \"jerryscript-snapshot.h\"\n\n#endif /* !JERRYSCRIPT_H */\n"
  },
  {
    "path": "jerry-core/jcontext/jcontext.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jcontext.h\"\n\n/** \\addtogroup context Context\n * @{\n */\n\n/**\n * Check the existence of the ECMA_STATUS_EXCEPTION flag.\n *\n * @return true - if the flag is set\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\njcontext_has_pending_exception (void)\n{\n  return JERRY_CONTEXT (status_flags) & ECMA_STATUS_EXCEPTION;\n} /* jcontext_has_pending_exception */\n\n/**\n * Check the existence of the ECMA_STATUS_ABORT flag.\n *\n * @return true - if the flag is set\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\njcontext_has_pending_abort (void)\n{\n  return JERRY_CONTEXT (status_flags) & ECMA_STATUS_ABORT;\n} /* jcontext_has_pending_abort */\n\n/**\n * Set the abort flag for the context.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\njcontext_set_abort_flag (bool is_abort) /**< true - if the abort flag should be set\n                                         *   false - if the abort flag should be removed */\n{\n  JERRY_ASSERT (jcontext_has_pending_exception ());\n\n  if (is_abort)\n  {\n    JERRY_CONTEXT (status_flags) |= ECMA_STATUS_ABORT;\n  }\n  else\n  {\n    JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_ABORT;\n  }\n} /* jcontext_set_abort_flag */\n\n/**\n * Set the exception flag for the context.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\njcontext_set_exception_flag (bool is_exception) /**< true - if the exception flag should be set\n                                                 *   false - if the exception flag should be removed */\n{\n  if (is_exception)\n  {\n    JERRY_CONTEXT (status_flags) |= ECMA_STATUS_EXCEPTION;\n  }\n  else\n  {\n    JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_EXCEPTION;\n  }\n} /* jcontext_set_exception_flag */\n\n/**\n * Raise exception from the given error value.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\njcontext_raise_exception (ecma_value_t error) /**< error to raise */\n{\n  JERRY_ASSERT (!jcontext_has_pending_exception ());\n  JERRY_ASSERT (!jcontext_has_pending_abort ());\n\n  JERRY_CONTEXT (error_value) = error;\n  jcontext_set_exception_flag (true);\n} /* jcontext_raise_exception */\n\n/**\n * Release the current exception/abort of the context.\n */\nvoid\njcontext_release_exception (void)\n{\n  JERRY_ASSERT (jcontext_has_pending_exception ());\n\n  ecma_free_value (jcontext_take_exception ());\n} /* jcontext_release_exception */\n\n/**\n * Take the current exception/abort of context.\n *\n * @return current exception as an ecma-value\n */\necma_value_t\njcontext_take_exception (void)\n{\n  JERRY_ASSERT (jcontext_has_pending_exception ());\n\n  JERRY_CONTEXT (status_flags) &= (uint32_t) ~(ECMA_STATUS_EXCEPTION\n#if JERRY_VM_THROW\n                                               | ECMA_STATUS_ERROR_THROWN\n#endif /* JERRY_VM_THROW */\n                                               | ECMA_STATUS_ABORT);\n  return JERRY_CONTEXT (error_value);\n} /* jcontext_take_exception */\n\n#if !JERRY_EXTERNAL_CONTEXT\n\n/**\n * Global context.\n */\njerry_context_t jerry_global_context;\n\n#if !JERRY_SYSTEM_ALLOCATOR\n\n/**\n * Check size of heap is corresponding to configuration\n */\nJERRY_STATIC_ASSERT (sizeof (jmem_heap_t) <= JMEM_HEAP_SIZE,\n                     size_of_mem_heap_must_be_less_than_or_equal_to_JMEM_HEAP_SIZE);\n\n/**\n * Global heap.\n */\njmem_heap_t jerry_global_heap JERRY_ATTR_ALIGNED (JMEM_ALIGNMENT) JERRY_ATTR_GLOBAL_HEAP;\n\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n\n#endif /* !JERRY_EXTERNAL_CONTEXT */\n\n/**\n * @}\n */\n"
  },
  {
    "path": "jerry-core/jcontext/jcontext.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Engine context for JerryScript\n */\n#ifndef JCONTEXT_H\n#define JCONTEXT_H\n\n#include \"jerryscript-debugger-transport.h\"\n\n#include \"ecma-builtins.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-jobqueue.h\"\n\n#include \"debugger.h\"\n#include \"jmem.h\"\n#include \"js-parser-internal.h\"\n#include \"re-bytecode.h\"\n#include \"vm-defines.h\"\n\n/** \\addtogroup context Context\n * @{\n */\n\n/**\n * Advanced allocator configurations.\n */\n/**\n * Maximum global heap size in bytes\n */\n#define CONFIG_MEM_HEAP_SIZE (JERRY_GLOBAL_HEAP_SIZE * 1024)\n\n/**\n * Maximum stack usage size in bytes\n */\n#define CONFIG_MEM_STACK_LIMIT (JERRY_STACK_LIMIT * 1024)\n\n/**\n * Max heap usage limit\n */\n#define CONFIG_MAX_GC_LIMIT 8192\n\n/**\n * Allowed heap usage limit until next garbage collection\n *\n * Whenever the total allocated memory size reaches the current heap limit, garbage collection will be triggered\n * to try and reduce clutter from unreachable objects. If the allocated memory can't be reduced below the limit,\n * then the current limit will be incremented by CONFIG_MEM_HEAP_LIMIT.\n */\n#if defined(JERRY_GC_LIMIT) && (JERRY_GC_LIMIT != 0)\n#define CONFIG_GC_LIMIT JERRY_GC_LIMIT\n#else /* !(defined(JERRY_GC_LIMIT) && (JERRY_GC_LIMIT != 0)) */\n#define CONFIG_GC_LIMIT (JERRY_MIN (CONFIG_MEM_HEAP_SIZE / 32, CONFIG_MAX_GC_LIMIT))\n#endif /* defined(JERRY_GC_LIMIT) && (JERRY_GC_LIMIT != 0) */\n\n/**\n * Amount of newly allocated objects since the last GC run, represented as a fraction of all allocated objects,\n * which when reached will trigger garbage collection to run with a low pressure setting.\n *\n * The fraction is calculated as:\n *                1.0 / CONFIG_ECMA_GC_NEW_OBJECTS_FRACTION\n */\n#define CONFIG_ECMA_GC_NEW_OBJECTS_FRACTION (16)\n\n#if !JERRY_SYSTEM_ALLOCATOR\n/**\n * Heap structure\n *\n * Memory blocks returned by the allocator must not start from the\n * beginning of the heap area because offset 0 is reserved for\n * JMEM_CP_NULL. This special constant is used in several places,\n * e.g. it marks the end of the property chain list, so it cannot\n * be eliminated from the project. Although the allocator cannot\n * use the first 8 bytes of the heap, nothing prevents to use it\n * for other purposes. Currently the free region start is stored\n * there.\n */\ntypedef struct jmem_heap_t jmem_heap_t;\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n\n/**\n * User context item\n */\ntypedef struct jerry_context_data_header\n{\n  struct jerry_context_data_header *next_p; /**< pointer to next context item */\n  const jerry_context_data_manager_t *manager_p; /**< manager responsible for deleting this item */\n} jerry_context_data_header_t;\n\n#define JERRY_CONTEXT_DATA_HEADER_USER_DATA(item_p) ((uint8_t *) (item_p + 1))\n\n/**\n * JerryScript context\n *\n * The purpose of this header is storing\n * all global variables for Jerry\n */\nstruct jerry_context_t\n{\n  /* The value of external context members must be preserved across initializations and cleanups. */\n#if JERRY_EXTERNAL_CONTEXT\n#if !JERRY_SYSTEM_ALLOCATOR\n  jmem_heap_t *heap_p; /**< point to the heap aligned to JMEM_ALIGNMENT. */\n  uint32_t heap_size; /**< size of the heap */\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n#endif /* JERRY_EXTERNAL_CONTEXT */\n\n  ecma_global_object_t *global_object_p; /**< current global object */\n  jmem_heap_free_t *jmem_heap_list_skip_p; /**< improves deallocation performance */\n  jmem_pools_chunk_t *jmem_free_8_byte_chunk_p; /**< list of free eight byte pool chunks */\n#if JERRY_BUILTIN_REGEXP\n  re_compiled_code_t *re_cache[RE_CACHE_SIZE]; /**< regex cache */\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_CPOINTER_32_BIT\n  jmem_pools_chunk_t *jmem_free_16_byte_chunk_p; /**< list of free sixteen byte pool chunks */\n#endif /* JERRY_CPOINTER_32_BIT */\n  const lit_utf8_byte_t *const *lit_magic_string_ex_array; /**< array of external magic strings */\n  const lit_utf8_size_t *lit_magic_string_ex_sizes; /**< external magic string lengths */\n  jmem_cpointer_t ecma_gc_objects_cp; /**< List of currently alive objects. */\n  jmem_cpointer_t string_list_first_cp; /**< first item of the literal string list */\n  jmem_cpointer_t symbol_list_first_cp; /**< first item of the global symbol list */\n  jmem_cpointer_t number_list_first_cp; /**< first item of the literal number list */\n#if JERRY_BUILTIN_BIGINT\n  jmem_cpointer_t bigint_list_first_cp; /**< first item of the literal bigint list */\n#endif /* JERRY_BUILTIN_BIGINT */\n  jmem_cpointer_t global_symbols_cp[ECMA_BUILTIN_GLOBAL_SYMBOL_COUNT]; /**< global symbols */\n\n#if JERRY_MODULE_SYSTEM\n  ecma_module_t *module_current_p; /**< current module context */\n  jerry_module_state_changed_cb_t module_state_changed_callback_p; /**< callback which is called after the\n                                                                    *   state of a module is changed */\n  void *module_state_changed_callback_user_p; /**< user pointer for module_state_changed_callback_p */\n  jerry_module_import_meta_cb_t module_import_meta_callback_p; /**< callback which is called when an\n                                                                *   import.meta expression of a module\n                                                                *   is evaluated the first time */\n  void *module_import_meta_callback_user_p; /**< user pointer for module_import_meta_callback_p */\n  jerry_module_import_cb_t module_import_callback_p; /**< callback for dynamic module import */\n  void *module_import_callback_user_p; /**< user pointer for module_import_callback_p */\n#endif /* JERRY_MODULE_SYSTEM */\n\n  vm_frame_ctx_t *vm_top_context_p; /**< top (current) interpreter context */\n  jerry_context_data_header_t *context_data_p; /**< linked list of user-provided context-specific pointers */\n  jerry_external_string_free_cb_t external_string_free_callback_p; /**< free callback for external strings */\n  void *error_object_created_callback_user_p; /**< user pointer for error_object_update_callback_p */\n  jerry_error_object_created_cb_t error_object_created_callback_p; /**< decorator callback for Error objects */\n  size_t ecma_gc_objects_number; /**< number of currently allocated objects */\n  size_t ecma_gc_new_objects; /**< number of newly allocated objects since last GC session */\n  size_t jmem_heap_allocated_size; /**< size of allocated regions */\n  size_t jmem_heap_limit; /**< current limit of heap usage, that is upon being reached,\n                           *   causes call of \"try give memory back\" callbacks */\n  ecma_value_t error_value; /**< currently thrown error value */\n  uint32_t lit_magic_string_ex_count; /**< external magic strings count */\n  uint32_t jerry_init_flags; /**< run-time configuration flags */\n  uint32_t status_flags; /**< run-time flags (the top 8 bits are used for passing class parsing options) */\n\n#if (JERRY_GC_MARK_LIMIT != 0)\n  uint32_t ecma_gc_mark_recursion_limit; /**< GC mark recursion limit */\n#endif /* (JERRY_GC_MARK_LIMIT != 0) */\n\n#if JERRY_PROPERTY_HASHMAP\n  uint8_t ecma_prop_hashmap_alloc_state; /**< property hashmap allocation state: 0-4,\n                                          *   if !0 property hashmap allocation is disabled */\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n#if JERRY_BUILTIN_REGEXP\n  uint8_t re_cache_idx; /**< evicted item index when regex cache is full (round-robin) */\n#endif /* JERRY_BUILTIN_REGEXP */\n  ecma_job_queue_item_t *job_queue_head_p; /**< points to the head item of the job queue */\n  ecma_job_queue_item_t *job_queue_tail_p; /**< points to the tail item of the job queue */\n#if JERRY_PROMISE_CALLBACK\n  uint32_t promise_callback_filters; /**< reported event types for promise callback */\n  void *promise_callback_user_p; /**< user pointer for promise callback */\n  jerry_promise_event_cb_t promise_callback; /**< user function for tracking Promise object operations */\n#endif /* JERRY_PROMISE_CALLBACK */\n\n#if JERRY_BUILTIN_TYPEDARRAY\n  uint32_t arraybuffer_compact_allocation_limit; /**< maximum size of compact allocation */\n  jerry_arraybuffer_allocate_cb_t arraybuffer_allocate_callback; /**< callback for allocating\n                                                                  *   arraybuffer memory */\n  jerry_arraybuffer_free_cb_t arraybuffer_free_callback; /**< callback for freeing arraybuffer memory */\n  void *arraybuffer_allocate_callback_user_p; /**< user pointer passed to arraybuffer_allocate_callback\n                                               *   and arraybuffer_free_callback functions */\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n\n#if JERRY_VM_HALT\n  uint32_t vm_exec_stop_frequency; /**< reset value for vm_exec_stop_counter */\n  uint32_t vm_exec_stop_counter; /**< down counter for reducing the calls of vm_exec_stop_cb */\n  void *vm_exec_stop_user_p; /**< user pointer for vm_exec_stop_cb */\n  ecma_vm_exec_stop_callback_t vm_exec_stop_cb; /**< user function which returns whether the\n                                                 *   ECMAScript execution should be stopped */\n#endif /* JERRY_VM_HALT */\n\n#if JERRY_VM_THROW\n  void *vm_throw_callback_user_p; /**< user pointer for vm_throw_callback_p */\n  jerry_throw_cb_t vm_throw_callback_p; /**< callback for capturing throws */\n#endif /* JERRY_VM_THROW */\n\n#if (JERRY_STACK_LIMIT != 0)\n  uintptr_t stack_base; /**< stack base marker */\n#endif /* (JERRY_STACK_LIMIT != 0) */\n\n#if JERRY_DEBUGGER\n  uint8_t debugger_send_buffer[JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE]; /**< buffer for sending messages */\n  uint8_t debugger_receive_buffer[JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE]; /**< buffer for receiving messages */\n  jerry_debugger_transport_header_t *debugger_transport_header_p; /**< head of transport protocol chain */\n  uint8_t *debugger_send_buffer_payload_p; /**< start where the outgoing message can be written */\n  vm_frame_ctx_t *debugger_stop_context; /**< stop only if the current context is equal to this context */\n  const uint8_t *debugger_exception_byte_code_p; /**< Location of the currently executed byte code if an\n                                                  *   error occours while the vm_loop is suspended */\n  jmem_cpointer_t debugger_byte_code_free_head; /**< head of byte code free linked list */\n  jmem_cpointer_t debugger_byte_code_free_tail; /**< tail of byte code free linked list */\n  uint32_t debugger_flags; /**< debugger flags */\n  uint16_t debugger_received_length; /**< length of currently received bytes */\n  uint16_t debugger_eval_chain_index; /**< eval chain index */\n  uint8_t debugger_message_delay; /**< call receive message when reaches zero */\n  uint8_t debugger_max_send_size; /**< maximum amount of data that can be sent */\n  uint8_t debugger_max_receive_size; /**< maximum amount of data that can be received */\n#endif /* JERRY_DEBUGGER */\n\n#if JERRY_MEM_STATS\n  jmem_heap_stats_t jmem_heap_stats; /**< heap's memory usage statistics */\n#endif /* JERRY_MEM_STATS */\n\n  /* This must be at the end of the context for performance reasons */\n#if JERRY_LCACHE\n  /** hash table for caching the last access of properties */\n  ecma_lcache_hash_entry_t lcache[ECMA_LCACHE_HASH_ROWS_COUNT][ECMA_LCACHE_HASH_ROW_LENGTH];\n#endif /* JERRY_LCACHE */\n\n  /**\n   * Allowed values and it's meaning:\n   * * NULL (0x0): the current \"new.target\" is undefined, that is the execution is inside a normal method.\n   * * Any other valid function object pointer: the current \"new.target\" is valid and it is constructor call.\n   */\n  ecma_object_t *current_new_target_p;\n};\n\n#if JERRY_EXTERNAL_CONTEXT\n\n/*\n * This part is for JerryScript which uses external context.\n */\n\n#define JERRY_CONTEXT_STRUCT (*jerry_port_context_get ())\n#define JERRY_CONTEXT(field) (jerry_port_context_get ()->field)\n\n#if !JERRY_SYSTEM_ALLOCATOR\n\n#define JMEM_HEAP_SIZE (JERRY_CONTEXT (heap_size))\n\n#define JMEM_HEAP_AREA_SIZE (JMEM_HEAP_SIZE - JMEM_ALIGNMENT)\n\nstruct jmem_heap_t\n{\n  jmem_heap_free_t first; /**< first node in free region list */\n  uint8_t area[]; /**< heap area */\n};\n\n#define JERRY_HEAP_CONTEXT(field) (JERRY_CONTEXT (heap_p)->field)\n\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n\n#else /* !JERRY_EXTERNAL_CONTEXT */\n\n/*\n * This part is for JerryScript which uses default context.\n */\n\n/**\n * Global context.\n */\nextern jerry_context_t jerry_global_context;\n\n/**\n * Config-independent name for context.\n */\n#define JERRY_CONTEXT_STRUCT (jerry_global_context)\n\n/**\n * Provides a reference to a field in the current context.\n */\n#define JERRY_CONTEXT(field) (jerry_global_context.field)\n\n#if !JERRY_SYSTEM_ALLOCATOR\n\n/**\n * Size of heap\n */\n#define JMEM_HEAP_SIZE            ((size_t) (CONFIG_MEM_HEAP_SIZE))\n\n/**\n * Calculate heap area size, leaving space for a pointer to the free list\n */\n#define JMEM_HEAP_AREA_SIZE       (JMEM_HEAP_SIZE - JMEM_ALIGNMENT)\n\nstruct jmem_heap_t\n{\n  jmem_heap_free_t first; /**< first node in free region list */\n  uint8_t area[JMEM_HEAP_AREA_SIZE]; /**< heap area */\n};\n\n/**\n * Global heap.\n */\nextern jmem_heap_t jerry_global_heap;\n\n/**\n * Provides a reference to a field of the heap.\n */\n#define JERRY_HEAP_CONTEXT(field) (jerry_global_heap.field)\n\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n\n#endif /* JERRY_EXTERNAL_CONTEXT */\n\nvoid jcontext_set_exception_flag (bool is_exception);\n\nvoid jcontext_set_abort_flag (bool is_abort);\n\nbool jcontext_has_pending_exception (void);\n\nbool jcontext_has_pending_abort (void);\n\nvoid jcontext_raise_exception (ecma_value_t error);\n\nvoid jcontext_release_exception (void);\n\necma_value_t jcontext_take_exception (void);\n\n/**\n * @}\n */\n\n#endif /* !JCONTEXT_H */\n"
  },
  {
    "path": "jerry-core/jmem/jmem-allocator-internal.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JMEM_ALLOCATOR_INTERNAL_H\n#define JMEM_ALLOCATOR_INTERNAL_H\n\n#ifndef JMEM_ALLOCATOR_INTERNAL\n#error \"The header is for internal routines of memory allocator component. Please, don't use the routines directly.\"\n#endif /* !JMEM_ALLOCATOR_INTERNAL */\n\n/** \\addtogroup mem Memory allocation\n * @{\n */\n\n/**\n * @{\n * Valgrind-related options and headers\n */\n#if JERRY_VALGRIND\n#include \"memcheck.h\"\n\n#define JMEM_VALGRIND_NOACCESS_SPACE(p, s)   VALGRIND_MAKE_MEM_NOACCESS ((p), (s))\n#define JMEM_VALGRIND_UNDEFINED_SPACE(p, s)  VALGRIND_MAKE_MEM_UNDEFINED ((p), (s))\n#define JMEM_VALGRIND_DEFINED_SPACE(p, s)    VALGRIND_MAKE_MEM_DEFINED ((p), (s))\n#define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s) VALGRIND_MALLOCLIKE_BLOCK ((p), (s), 0, 0)\n#define JMEM_VALGRIND_RESIZE_SPACE(p, o, n)  VALGRIND_RESIZEINPLACE_BLOCK ((p), (o), (n), 0)\n#define JMEM_VALGRIND_FREELIKE_SPACE(p)      VALGRIND_FREELIKE_BLOCK ((p), 0)\n#else /* !JERRY_VALGRIND */\n#define JMEM_VALGRIND_NOACCESS_SPACE(p, s)\n#define JMEM_VALGRIND_UNDEFINED_SPACE(p, s)\n#define JMEM_VALGRIND_DEFINED_SPACE(p, s)\n#define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s)\n#define JMEM_VALGRIND_RESIZE_SPACE(p, o, n)\n#define JMEM_VALGRIND_FREELIKE_SPACE(p)\n#endif /* JERRY_VALGRIND */\n/** @} */\n\nvoid jmem_heap_init (void);\nvoid jmem_heap_finalize (void);\nbool jmem_is_heap_pointer (const void *pointer);\nvoid *jmem_heap_alloc_block_internal (const size_t size);\nvoid jmem_heap_free_block_internal (void *ptr, const size_t size);\n\n/**\n * \\addtogroup poolman Memory pool manager\n * @{\n */\n\nvoid jmem_pools_finalize (void);\n\n/**\n * @}\n * @}\n */\n\n/**\n * @{\n * Jerry mem-stat definitions\n */\n#if JERRY_MEM_STATS\nvoid jmem_heap_stat_init (void);\nvoid jmem_heap_stat_alloc (size_t num);\nvoid jmem_heap_stat_free (size_t num);\n\n#define JMEM_HEAP_STAT_INIT()    jmem_heap_stat_init ()\n#define JMEM_HEAP_STAT_ALLOC(v1) jmem_heap_stat_alloc (v1)\n#define JMEM_HEAP_STAT_FREE(v1)  jmem_heap_stat_free (v1)\n#else /* !JERRY_MEM_STATS */\n#define JMEM_HEAP_STAT_INIT()\n#define JMEM_HEAP_STAT_ALLOC(v1) JERRY_UNUSED (v1)\n#define JMEM_HEAP_STAT_FREE(v1)  JERRY_UNUSED (v1)\n#endif /* JERRY_MEM_STATS */\n\n/** @} */\n\n#endif /* !JMEM_ALLOCATOR_INTERNAL_H */\n"
  },
  {
    "path": "jerry-core/jmem/jmem-allocator.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Allocator implementation\n */\n#include \"ecma-globals.h\"\n\n#include \"jcontext.h\"\n#include \"jmem.h\"\n#include \"jrt-libc-includes.h\"\n\n#define JMEM_ALLOCATOR_INTERNAL\n#include \"jmem-allocator-internal.h\"\n\n#if JERRY_MEM_STATS\n/**\n * Register byte code allocation.\n */\nvoid\njmem_stats_allocate_byte_code_bytes (size_t byte_code_size)\n{\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  heap_stats->byte_code_bytes += byte_code_size;\n\n  if (heap_stats->byte_code_bytes >= heap_stats->peak_byte_code_bytes)\n  {\n    heap_stats->peak_byte_code_bytes = heap_stats->byte_code_bytes;\n  }\n} /* jmem_stats_allocate_byte_code_bytes */\n\n/**\n * Register byte code free.\n */\nvoid\njmem_stats_free_byte_code_bytes (size_t byte_code_size)\n{\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  JERRY_ASSERT (heap_stats->byte_code_bytes >= byte_code_size);\n\n  heap_stats->byte_code_bytes -= byte_code_size;\n} /* jmem_stats_free_byte_code_bytes */\n\n/**\n * Register string allocation.\n */\nvoid\njmem_stats_allocate_string_bytes (size_t string_size)\n{\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  heap_stats->string_bytes += string_size;\n\n  if (heap_stats->string_bytes >= heap_stats->peak_string_bytes)\n  {\n    heap_stats->peak_string_bytes = heap_stats->string_bytes;\n  }\n} /* jmem_stats_allocate_string_bytes */\n\n/**\n * Register string free.\n */\nvoid\njmem_stats_free_string_bytes (size_t string_size)\n{\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  JERRY_ASSERT (heap_stats->string_bytes >= string_size);\n\n  heap_stats->string_bytes -= string_size;\n} /* jmem_stats_free_string_bytes */\n\n/**\n * Register object allocation.\n */\nvoid\njmem_stats_allocate_object_bytes (size_t object_size)\n{\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  heap_stats->object_bytes += object_size;\n\n  if (heap_stats->object_bytes >= heap_stats->peak_object_bytes)\n  {\n    heap_stats->peak_object_bytes = heap_stats->object_bytes;\n  }\n} /* jmem_stats_allocate_object_bytes */\n\n/**\n * Register object free.\n */\nvoid\njmem_stats_free_object_bytes (size_t object_size)\n{\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  JERRY_ASSERT (heap_stats->object_bytes >= object_size);\n\n  heap_stats->object_bytes -= object_size;\n} /* jmem_stats_free_object_bytes */\n\n/**\n * Register property allocation.\n */\nvoid\njmem_stats_allocate_property_bytes (size_t property_size)\n{\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  heap_stats->property_bytes += property_size;\n\n  if (heap_stats->property_bytes >= heap_stats->peak_property_bytes)\n  {\n    heap_stats->peak_property_bytes = heap_stats->property_bytes;\n  }\n} /* jmem_stats_allocate_property_bytes */\n\n/**\n * Register property free.\n */\nvoid\njmem_stats_free_property_bytes (size_t property_size)\n{\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  JERRY_ASSERT (heap_stats->property_bytes >= property_size);\n\n  heap_stats->property_bytes -= property_size;\n} /* jmem_stats_free_property_bytes */\n\n#endif /* JERRY_MEM_STATS */\n\n/**\n * Initialize memory allocators.\n */\nvoid\njmem_init (void)\n{\n  jmem_heap_init ();\n} /* jmem_init */\n\n/**\n * Finalize memory allocators.\n */\nvoid\njmem_finalize (void)\n{\n  jmem_pools_finalize ();\n\n#if JERRY_MEM_STATS\n  if (JERRY_CONTEXT (jerry_init_flags) & JERRY_INIT_MEM_STATS)\n  {\n    jmem_heap_stats_print ();\n  }\n#endif /* JERRY_MEM_STATS */\n\n  jmem_heap_finalize ();\n} /* jmem_finalize */\n\n/**\n * Compress pointer\n *\n * @return packed pointer\n */\nextern inline jmem_cpointer_t JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\njmem_compress_pointer (const void *pointer_p) /**< pointer to compress */\n{\n  JERRY_ASSERT (pointer_p != NULL);\n  JERRY_ASSERT (jmem_is_heap_pointer (pointer_p));\n\n  uintptr_t uint_ptr = (uintptr_t) pointer_p;\n\n  JERRY_ASSERT (uint_ptr % JMEM_ALIGNMENT == 0);\n\n#if defined(ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT\n  JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);\n#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */\n  const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);\n\n  uint_ptr -= heap_start;\n  uint_ptr >>= JMEM_ALIGNMENT_LOG;\n\n#if JERRY_CPOINTER_32_BIT\n  JERRY_ASSERT (uint_ptr <= UINT32_MAX);\n#else /* !JERRY_CPOINTER_32_BIT */\n  JERRY_ASSERT (uint_ptr <= UINT16_MAX);\n#endif /* JERRY_CPOINTER_32_BIT */\n  JERRY_ASSERT (uint_ptr != JMEM_CP_NULL);\n#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && JERRY_CPOINTER_32_BIT */\n\n  return (jmem_cpointer_t) uint_ptr;\n} /* jmem_compress_pointer */\n\n/**\n * Decompress pointer\n *\n * @return unpacked pointer\n */\nextern inline void *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE\njmem_decompress_pointer (uintptr_t compressed_pointer) /**< pointer to decompress */\n{\n  JERRY_ASSERT (compressed_pointer != JMEM_CP_NULL);\n\n  uintptr_t uint_ptr = compressed_pointer;\n\n  JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);\n\n#if defined(ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT\n  JERRY_ASSERT (uint_ptr % JMEM_ALIGNMENT == 0);\n#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */\n  const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);\n\n  uint_ptr <<= JMEM_ALIGNMENT_LOG;\n  uint_ptr += heap_start;\n\n  JERRY_ASSERT (jmem_is_heap_pointer ((void *) uint_ptr));\n#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY && JERRY_CPOINTER_32_BIT */\n\n  return (void *) uint_ptr;\n} /* jmem_decompress_pointer */\n"
  },
  {
    "path": "jerry-core/jmem/jmem-heap.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Heap implementation\n */\n\n#include \"ecma-gc.h\"\n\n#include \"jcontext.h\"\n#include \"jmem.h\"\n#include \"jrt-bit-fields.h\"\n#include \"jrt-libc-includes.h\"\n\n#define JMEM_ALLOCATOR_INTERNAL\n#include \"jmem-allocator-internal.h\"\n\n/** \\addtogroup mem Memory allocation\n * @{\n *\n * \\addtogroup heap Heap\n * @{\n */\n\n#if !JERRY_SYSTEM_ALLOCATOR\n/**\n * End of list marker.\n */\n#define JMEM_HEAP_END_OF_LIST ((uint32_t) 0xffffffff)\n\n/**\n * @{\n */\n#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY\n/* In this case we simply store the pointer, since it fits anyway. */\n#define JMEM_HEAP_GET_OFFSET_FROM_ADDR(p) ((uint32_t) (p))\n#define JMEM_HEAP_GET_ADDR_FROM_OFFSET(u) ((jmem_heap_free_t *) (u))\n#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */\n/**\n * Get heap offset from address\n */\n#define JMEM_HEAP_GET_OFFSET_FROM_ADDR(p) ((uint32_t) ((uint8_t *) (p) -JERRY_HEAP_CONTEXT (area)))\n\n/**\n * Get heap address from offset\n */\n#define JMEM_HEAP_GET_ADDR_FROM_OFFSET(u) ((jmem_heap_free_t *) (JERRY_HEAP_CONTEXT (area) + (u)))\n#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */\n/**\n * @}\n */\n\n/**\n * Get end of region\n *\n * @return pointer to the end of the region\n */\nstatic inline jmem_heap_free_t *JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_PURE\njmem_heap_get_region_end (jmem_heap_free_t *curr_p) /**< current region */\n{\n  return (jmem_heap_free_t *) ((uint8_t *) curr_p + curr_p->size);\n} /* jmem_heap_get_region_end */\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n\n/**\n * Startup initialization of heap\n */\nvoid\njmem_heap_init (void)\n{\n#if !JERRY_SYSTEM_ALLOCATOR\n#if !JERRY_CPOINTER_32_BIT\n  /* the maximum heap size for 16bit compressed pointers should be 512K */\n  JERRY_ASSERT (((UINT16_MAX + 1) << JMEM_ALIGNMENT_LOG) >= JMEM_HEAP_SIZE);\n#endif /* !JERRY_CPOINTER_32_BIT */\n  JERRY_ASSERT ((uintptr_t) JERRY_HEAP_CONTEXT (area) % JMEM_ALIGNMENT == 0);\n\n  JERRY_CONTEXT (jmem_heap_limit) = CONFIG_GC_LIMIT;\n\n  jmem_heap_free_t *const region_p = (jmem_heap_free_t *) JERRY_HEAP_CONTEXT (area);\n\n  region_p->size = JMEM_HEAP_AREA_SIZE;\n  region_p->next_offset = JMEM_HEAP_END_OF_LIST;\n\n  JERRY_HEAP_CONTEXT (first).size = 0;\n  JERRY_HEAP_CONTEXT (first).next_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (region_p);\n\n  JERRY_CONTEXT (jmem_heap_list_skip_p) = &JERRY_HEAP_CONTEXT (first);\n\n  JMEM_VALGRIND_NOACCESS_SPACE (&JERRY_HEAP_CONTEXT (first), sizeof (jmem_heap_free_t));\n  JMEM_VALGRIND_NOACCESS_SPACE (JERRY_HEAP_CONTEXT (area), JMEM_HEAP_AREA_SIZE);\n\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n  JMEM_HEAP_STAT_INIT ();\n} /* jmem_heap_init */\n\n/**\n * Finalize heap\n */\nvoid\njmem_heap_finalize (void)\n{\n  JERRY_ASSERT (JERRY_CONTEXT (jmem_heap_allocated_size) == 0);\n#if !JERRY_SYSTEM_ALLOCATOR\n  JMEM_VALGRIND_NOACCESS_SPACE (&JERRY_HEAP_CONTEXT (first), JMEM_HEAP_SIZE);\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n} /* jmem_heap_finalize */\n\n/**\n * Allocation of memory region.\n *\n * See also:\n *          jmem_heap_alloc_block\n *\n * @return pointer to allocated memory block - if allocation is successful,\n *         NULL - if there is not enough memory.\n */\nstatic void *JERRY_ATTR_HOT\njmem_heap_alloc (const size_t size) /**< size of requested block */\n{\n#if !JERRY_SYSTEM_ALLOCATOR\n  /* Align size. */\n  const size_t required_size = ((size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT) * JMEM_ALIGNMENT;\n  jmem_heap_free_t *data_space_p = NULL;\n\n  JMEM_VALGRIND_DEFINED_SPACE (&JERRY_HEAP_CONTEXT (first), sizeof (jmem_heap_free_t));\n\n  /* Fast path for 8 byte chunks, first region is guaranteed to be sufficient. */\n  if (required_size == JMEM_ALIGNMENT && JERRY_LIKELY (JERRY_HEAP_CONTEXT (first).next_offset != JMEM_HEAP_END_OF_LIST))\n  {\n    data_space_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (JERRY_HEAP_CONTEXT (first).next_offset);\n    JERRY_ASSERT (jmem_is_heap_pointer (data_space_p));\n\n    JMEM_VALGRIND_DEFINED_SPACE (data_space_p, sizeof (jmem_heap_free_t));\n    JERRY_CONTEXT (jmem_heap_allocated_size) += JMEM_ALIGNMENT;\n\n    if (JERRY_CONTEXT (jmem_heap_allocated_size) >= JERRY_CONTEXT (jmem_heap_limit))\n    {\n      JERRY_CONTEXT (jmem_heap_limit) += CONFIG_GC_LIMIT;\n    }\n\n    if (data_space_p->size == JMEM_ALIGNMENT)\n    {\n      JERRY_HEAP_CONTEXT (first).next_offset = data_space_p->next_offset;\n    }\n    else\n    {\n      JERRY_ASSERT (data_space_p->size > JMEM_ALIGNMENT);\n\n      jmem_heap_free_t *remaining_p;\n      remaining_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (JERRY_HEAP_CONTEXT (first).next_offset) + 1;\n\n      JMEM_VALGRIND_DEFINED_SPACE (remaining_p, sizeof (jmem_heap_free_t));\n      remaining_p->size = data_space_p->size - JMEM_ALIGNMENT;\n      remaining_p->next_offset = data_space_p->next_offset;\n      JMEM_VALGRIND_NOACCESS_SPACE (remaining_p, sizeof (jmem_heap_free_t));\n\n      JERRY_HEAP_CONTEXT (first).next_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (remaining_p);\n    }\n\n    JMEM_VALGRIND_NOACCESS_SPACE (data_space_p, sizeof (jmem_heap_free_t));\n\n    if (JERRY_UNLIKELY (data_space_p == JERRY_CONTEXT (jmem_heap_list_skip_p)))\n    {\n      JERRY_CONTEXT (jmem_heap_list_skip_p) = JMEM_HEAP_GET_ADDR_FROM_OFFSET (JERRY_HEAP_CONTEXT (first).next_offset);\n    }\n  }\n  /* Slow path for larger regions. */\n  else\n  {\n    uint32_t current_offset = JERRY_HEAP_CONTEXT (first).next_offset;\n    jmem_heap_free_t *prev_p = &JERRY_HEAP_CONTEXT (first);\n\n    while (JERRY_LIKELY (current_offset != JMEM_HEAP_END_OF_LIST))\n    {\n      jmem_heap_free_t *current_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (current_offset);\n      JERRY_ASSERT (jmem_is_heap_pointer (current_p));\n      JMEM_VALGRIND_DEFINED_SPACE (current_p, sizeof (jmem_heap_free_t));\n\n      const uint32_t next_offset = current_p->next_offset;\n      JERRY_ASSERT (next_offset == JMEM_HEAP_END_OF_LIST\n                    || jmem_is_heap_pointer (JMEM_HEAP_GET_ADDR_FROM_OFFSET (next_offset)));\n\n      if (current_p->size >= required_size)\n      {\n        /* Region is sufficiently big, store address. */\n        data_space_p = current_p;\n\n        /* Region was larger than necessary. */\n        if (current_p->size > required_size)\n        {\n          /* Get address of remaining space. */\n          jmem_heap_free_t *const remaining_p = (jmem_heap_free_t *) ((uint8_t *) current_p + required_size);\n\n          /* Update metadata. */\n          JMEM_VALGRIND_DEFINED_SPACE (remaining_p, sizeof (jmem_heap_free_t));\n          remaining_p->size = current_p->size - (uint32_t) required_size;\n          remaining_p->next_offset = next_offset;\n          JMEM_VALGRIND_NOACCESS_SPACE (remaining_p, sizeof (jmem_heap_free_t));\n\n          /* Update list. */\n          JMEM_VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));\n          prev_p->next_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (remaining_p);\n          JMEM_VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t));\n        }\n        /* Block is an exact fit. */\n        else\n        {\n          /* Remove the region from the list. */\n          JMEM_VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));\n          prev_p->next_offset = next_offset;\n          JMEM_VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t));\n        }\n\n        JERRY_CONTEXT (jmem_heap_list_skip_p) = prev_p;\n\n        /* Found enough space. */\n        JERRY_CONTEXT (jmem_heap_allocated_size) += required_size;\n\n        while (JERRY_CONTEXT (jmem_heap_allocated_size) >= JERRY_CONTEXT (jmem_heap_limit))\n        {\n          JERRY_CONTEXT (jmem_heap_limit) += CONFIG_GC_LIMIT;\n        }\n\n        break;\n      }\n\n      JMEM_VALGRIND_NOACCESS_SPACE (current_p, sizeof (jmem_heap_free_t));\n      /* Next in list. */\n      prev_p = current_p;\n      current_offset = next_offset;\n    }\n  }\n\n  JMEM_VALGRIND_NOACCESS_SPACE (&JERRY_HEAP_CONTEXT (first), sizeof (jmem_heap_free_t));\n\n  JERRY_ASSERT ((uintptr_t) data_space_p % JMEM_ALIGNMENT == 0);\n  JMEM_VALGRIND_MALLOCLIKE_SPACE (data_space_p, size);\n\n  return (void *) data_space_p;\n#else /* JERRY_SYSTEM_ALLOCATOR */\n  JERRY_CONTEXT (jmem_heap_allocated_size) += size;\n\n  while (JERRY_CONTEXT (jmem_heap_allocated_size) >= JERRY_CONTEXT (jmem_heap_limit))\n  {\n    JERRY_CONTEXT (jmem_heap_limit) += CONFIG_GC_LIMIT;\n  }\n\n  return malloc (size);\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n} /* jmem_heap_alloc */\n\n/**\n * Allocation of memory block, reclaiming memory if the request cannot be fulfilled.\n *\n * Note:\n *    Each failed allocation attempt tries to reclaim memory with an increasing pressure,\n *    up to 'max_pressure', or until a sufficient memory block is found. When JMEM_PRESSURE_FULL\n *    is reached, the engine is terminated with JERRY_FATAL_OUT_OF_MEMORY. The `max_pressure` argument\n *    can be used to limit the maximum pressure, and prevent the engine from terminating.\n *\n * @return NULL, if the required memory size is 0 or not enough memory\n *         pointer to the allocated memory block, if allocation is successful\n */\nstatic void *\njmem_heap_gc_and_alloc_block (const size_t size, /**< required memory size */\n                              jmem_pressure_t max_pressure) /**< pressure limit */\n{\n  if (JERRY_UNLIKELY (size == 0))\n  {\n    return NULL;\n  }\n\n  jmem_pressure_t pressure = JMEM_PRESSURE_NONE;\n\n#if !JERRY_MEM_GC_BEFORE_EACH_ALLOC\n  if (JERRY_CONTEXT (jmem_heap_allocated_size) + size >= JERRY_CONTEXT (jmem_heap_limit))\n  {\n    pressure = JMEM_PRESSURE_LOW;\n    ecma_free_unused_memory (pressure);\n  }\n#else /* !JERRY_MEM_GC_BEFORE_EACH_ALLOC */\n  ecma_gc_run ();\n#endif /* JERRY_MEM_GC_BEFORE_EACH_ALLOC */\n\n  void *data_space_p = jmem_heap_alloc (size);\n\n  while (JERRY_UNLIKELY (data_space_p == NULL) && JERRY_LIKELY (pressure < max_pressure))\n  {\n    pressure++;\n    ecma_free_unused_memory (pressure);\n    data_space_p = jmem_heap_alloc (size);\n  }\n\n  return data_space_p;\n} /* jmem_heap_gc_and_alloc_block */\n\n/**\n * Internal method for allocating a memory block.\n *\n * @return NULL, if the required memory size is 0 or not enough memory, or\n *         pointer to the allocated memory block, if allocation is successful\n */\nextern inline void *JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE\njmem_heap_alloc_block_internal (const size_t size) /**< required memory size */\n{\n  return jmem_heap_gc_and_alloc_block (size, JMEM_PRESSURE_FULL);\n} /* jmem_heap_alloc_block_internal */\n\n/**\n * Allocation of memory block, reclaiming unused memory if there is not enough.\n *\n * Note:\n *      If a sufficiently sized block can't be found, the engine will be terminated with JERRY_FATAL_OUT_OF_MEMORY.\n *\n * @return NULL, if the required memory is 0\n *         pointer to allocated memory block, otherwise\n */\nextern inline void *JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE\njmem_heap_alloc_block (const size_t size) /**< required memory size */\n{\n  void *block_p = jmem_heap_gc_and_alloc_block (size, JMEM_PRESSURE_FULL);\n  JMEM_HEAP_STAT_ALLOC (size);\n  return block_p;\n} /* jmem_heap_alloc_block */\n\n/**\n * Allocation of memory block, reclaiming unused memory if there is not enough.\n *\n * Note:\n *      If a sufficiently sized block can't be found, NULL will be returned.\n *\n * @return NULL, if the required memory size is 0\n *         also NULL, if the allocation has failed\n *         pointer to the allocated memory block, otherwise\n */\nextern inline void *JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE\njmem_heap_alloc_block_null_on_error (const size_t size) /**< required memory size */\n{\n  void *block_p = jmem_heap_gc_and_alloc_block (size, JMEM_PRESSURE_HIGH);\n\n#if JERRY_MEM_STATS\n  if (block_p != NULL)\n  {\n    JMEM_HEAP_STAT_ALLOC (size);\n  }\n#endif /* JERRY_MEM_STATS */\n\n  return block_p;\n} /* jmem_heap_alloc_block_null_on_error */\n\n#if !JERRY_SYSTEM_ALLOCATOR\n/**\n * Finds the block in the free block list which preceeds the argument block\n *\n * @return pointer to the preceeding block\n */\nstatic jmem_heap_free_t *\njmem_heap_find_prev (const jmem_heap_free_t *const block_p) /**< which memory block's predecessor we're looking for */\n{\n  const jmem_heap_free_t *prev_p;\n\n  if (block_p > JERRY_CONTEXT (jmem_heap_list_skip_p))\n  {\n    prev_p = JERRY_CONTEXT (jmem_heap_list_skip_p);\n  }\n  else\n  {\n    prev_p = &JERRY_HEAP_CONTEXT (first);\n  }\n\n  JERRY_ASSERT (jmem_is_heap_pointer (block_p));\n  const uint32_t block_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (block_p);\n\n  JMEM_VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));\n  /* Find position of region in the list. */\n  while (prev_p->next_offset < block_offset)\n  {\n    const jmem_heap_free_t *const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);\n    JERRY_ASSERT (jmem_is_heap_pointer (next_p));\n\n    JMEM_VALGRIND_DEFINED_SPACE (next_p, sizeof (jmem_heap_free_t));\n    JMEM_VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t));\n    prev_p = next_p;\n  }\n\n  JMEM_VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t));\n  return (jmem_heap_free_t *) prev_p;\n} /* jmem_heap_find_prev */\n\n/**\n * Inserts the block into the free chain after a specified block.\n *\n * Note:\n *     'jmem_heap_find_prev' can and should be used to find the previous free block\n */\nstatic void\njmem_heap_insert_block (jmem_heap_free_t *block_p, /**< block to insert */\n                        jmem_heap_free_t *prev_p, /**< the free block after which to insert 'block_p' */\n                        const size_t size) /**< size of the inserted block */\n{\n  JERRY_ASSERT ((uintptr_t) block_p % JMEM_ALIGNMENT == 0);\n  JERRY_ASSERT (size % JMEM_ALIGNMENT == 0);\n\n  JMEM_VALGRIND_NOACCESS_SPACE (block_p, size);\n\n  JMEM_VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));\n  jmem_heap_free_t *next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);\n  JMEM_VALGRIND_DEFINED_SPACE (block_p, sizeof (jmem_heap_free_t));\n  JMEM_VALGRIND_DEFINED_SPACE (next_p, sizeof (jmem_heap_free_t));\n\n  const uint32_t block_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (block_p);\n\n  /* Update prev. */\n  if (jmem_heap_get_region_end (prev_p) == block_p)\n  {\n    /* Can be merged. */\n    prev_p->size += (uint32_t) size;\n    JMEM_VALGRIND_NOACCESS_SPACE (block_p, sizeof (jmem_heap_free_t));\n    block_p = prev_p;\n  }\n  else\n  {\n    block_p->size = (uint32_t) size;\n    prev_p->next_offset = block_offset;\n  }\n\n  /* Update next. */\n  if (jmem_heap_get_region_end (block_p) == next_p)\n  {\n    /* Can be merged. */\n    block_p->size += next_p->size;\n    block_p->next_offset = next_p->next_offset;\n  }\n  else\n  {\n    block_p->next_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (next_p);\n  }\n\n  JERRY_CONTEXT (jmem_heap_list_skip_p) = prev_p;\n\n  JMEM_VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t));\n  JMEM_VALGRIND_NOACCESS_SPACE (block_p, sizeof (jmem_heap_free_t));\n  JMEM_VALGRIND_NOACCESS_SPACE (next_p, sizeof (jmem_heap_free_t));\n} /* jmem_heap_insert_block */\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n\n/**\n * Internal method for freeing a memory block.\n */\nvoid JERRY_ATTR_HOT\njmem_heap_free_block_internal (void *ptr, /**< pointer to beginning of data space of the block */\n                               const size_t size /**< size of allocated region */)\n{\n  JERRY_ASSERT (size > 0);\n  JERRY_ASSERT (JERRY_CONTEXT (jmem_heap_limit) >= JERRY_CONTEXT (jmem_heap_allocated_size));\n  JERRY_ASSERT (JERRY_CONTEXT (jmem_heap_allocated_size) > 0);\n\n#if !JERRY_SYSTEM_ALLOCATOR\n  /* checking that ptr points to the heap */\n  JERRY_ASSERT (jmem_is_heap_pointer (ptr));\n  JERRY_ASSERT ((uintptr_t) ptr % JMEM_ALIGNMENT == 0);\n\n  const size_t aligned_size = (size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT * JMEM_ALIGNMENT;\n\n  jmem_heap_free_t *const block_p = (jmem_heap_free_t *) ptr;\n  jmem_heap_free_t *const prev_p = jmem_heap_find_prev (block_p);\n  jmem_heap_insert_block (block_p, prev_p, aligned_size);\n\n  JERRY_CONTEXT (jmem_heap_allocated_size) -= aligned_size;\n\n  JMEM_VALGRIND_FREELIKE_SPACE (ptr);\n#else /* JERRY_SYSTEM_ALLOCATOR */\n  JERRY_CONTEXT (jmem_heap_allocated_size) -= size;\n  free (ptr);\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n  while (JERRY_CONTEXT (jmem_heap_allocated_size) + CONFIG_GC_LIMIT <= JERRY_CONTEXT (jmem_heap_limit))\n  {\n    JERRY_CONTEXT (jmem_heap_limit) -= CONFIG_GC_LIMIT;\n  }\n\n  JERRY_ASSERT (JERRY_CONTEXT (jmem_heap_limit) >= JERRY_CONTEXT (jmem_heap_allocated_size));\n} /* jmem_heap_free_block_internal */\n\n/**\n * Reallocates the memory region pointed to by 'ptr', changing the size of the allocated region.\n *\n * @return pointer to the reallocated region\n */\nvoid *JERRY_ATTR_HOT\njmem_heap_realloc_block (void *ptr, /**< memory region to reallocate */\n                         const size_t old_size, /**< current size of the region */\n                         const size_t new_size) /**< desired new size */\n{\n#if !JERRY_SYSTEM_ALLOCATOR\n  JERRY_ASSERT (jmem_is_heap_pointer (ptr));\n  JERRY_ASSERT ((uintptr_t) ptr % JMEM_ALIGNMENT == 0);\n  JERRY_ASSERT (old_size != 0);\n  JERRY_ASSERT (new_size != 0);\n\n  jmem_heap_free_t *const block_p = (jmem_heap_free_t *) ptr;\n  const size_t aligned_new_size = (new_size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT * JMEM_ALIGNMENT;\n  const size_t aligned_old_size = (old_size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT * JMEM_ALIGNMENT;\n\n  if (aligned_old_size == aligned_new_size)\n  {\n    JMEM_VALGRIND_RESIZE_SPACE (block_p, old_size, new_size);\n    JMEM_HEAP_STAT_FREE (old_size);\n    JMEM_HEAP_STAT_ALLOC (new_size);\n    return block_p;\n  }\n\n  if (aligned_new_size < aligned_old_size)\n  {\n    JMEM_VALGRIND_RESIZE_SPACE (block_p, old_size, new_size);\n    JMEM_HEAP_STAT_FREE (old_size);\n    JMEM_HEAP_STAT_ALLOC (new_size);\n    jmem_heap_insert_block ((jmem_heap_free_t *) ((uint8_t *) block_p + aligned_new_size),\n                            jmem_heap_find_prev (block_p),\n                            aligned_old_size - aligned_new_size);\n\n    JERRY_CONTEXT (jmem_heap_allocated_size) -= (aligned_old_size - aligned_new_size);\n    while (JERRY_CONTEXT (jmem_heap_allocated_size) + CONFIG_GC_LIMIT <= JERRY_CONTEXT (jmem_heap_limit))\n    {\n      JERRY_CONTEXT (jmem_heap_limit) -= CONFIG_GC_LIMIT;\n    }\n\n    return block_p;\n  }\n\n  void *ret_block_p = NULL;\n  const size_t required_size = aligned_new_size - aligned_old_size;\n\n#if !JERRY_MEM_GC_BEFORE_EACH_ALLOC\n  if (JERRY_CONTEXT (jmem_heap_allocated_size) + required_size >= JERRY_CONTEXT (jmem_heap_limit))\n  {\n    ecma_free_unused_memory (JMEM_PRESSURE_LOW);\n  }\n#else /* !JERRY_MEM_GC_BEFORE_EACH_ALLOC */\n  ecma_gc_run ();\n#endif /* JERRY_MEM_GC_BEFORE_EACH_ALLOC */\n\n  jmem_heap_free_t *prev_p = jmem_heap_find_prev (block_p);\n  JMEM_VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));\n  jmem_heap_free_t *const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);\n\n  /* Check if block can be extended at the end */\n  if (((jmem_heap_free_t *) ((uint8_t *) block_p + aligned_old_size)) == next_p)\n  {\n    JMEM_VALGRIND_DEFINED_SPACE (next_p, sizeof (jmem_heap_free_t));\n\n    if (required_size <= next_p->size)\n    {\n      /* Block can be extended, update the list. */\n      if (required_size == next_p->size)\n      {\n        prev_p->next_offset = next_p->next_offset;\n      }\n      else\n      {\n        jmem_heap_free_t *const new_next_p = (jmem_heap_free_t *) ((uint8_t *) next_p + required_size);\n        JMEM_VALGRIND_DEFINED_SPACE (new_next_p, sizeof (jmem_heap_free_t));\n        new_next_p->next_offset = next_p->next_offset;\n        new_next_p->size = (uint32_t) (next_p->size - required_size);\n        JMEM_VALGRIND_NOACCESS_SPACE (new_next_p, sizeof (jmem_heap_free_t));\n        prev_p->next_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (new_next_p);\n      }\n\n      /* next_p will be marked as undefined space. */\n      JMEM_VALGRIND_RESIZE_SPACE (block_p, old_size, new_size);\n      ret_block_p = block_p;\n    }\n    else\n    {\n      JMEM_VALGRIND_NOACCESS_SPACE (next_p, sizeof (jmem_heap_free_t));\n    }\n\n    JMEM_VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t));\n  }\n  /*\n   * Check if block can be extended at the front.\n   * This is less optimal because we need to copy the data, but still better than allocting a new block.\n   */\n  else if (jmem_heap_get_region_end (prev_p) == block_p)\n  {\n    if (required_size <= prev_p->size)\n    {\n      if (required_size == prev_p->size)\n      {\n        JMEM_VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t));\n        prev_p = jmem_heap_find_prev (prev_p);\n        JMEM_VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));\n        prev_p->next_offset = JMEM_HEAP_GET_OFFSET_FROM_ADDR (next_p);\n      }\n      else\n      {\n        prev_p->size = (uint32_t) (prev_p->size - required_size);\n      }\n\n      JMEM_VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t));\n\n      ret_block_p = (uint8_t *) block_p - required_size;\n\n      /* Mark the the new block as undefined so that we are able to write to it. */\n      JMEM_VALGRIND_UNDEFINED_SPACE (ret_block_p, old_size);\n      /* The blocks are likely to overlap, so mark the old block as defined memory again. */\n      JMEM_VALGRIND_DEFINED_SPACE (block_p, old_size);\n      memmove (ret_block_p, block_p, old_size);\n\n      JMEM_VALGRIND_FREELIKE_SPACE (block_p);\n      JMEM_VALGRIND_MALLOCLIKE_SPACE (ret_block_p, new_size);\n      JMEM_VALGRIND_DEFINED_SPACE (ret_block_p, old_size);\n    }\n    else\n    {\n      JMEM_VALGRIND_NOACCESS_SPACE (prev_p, sizeof (jmem_heap_free_t));\n    }\n  }\n\n  if (ret_block_p != NULL)\n  {\n    /* Managed to extend the block. Update memory usage and the skip pointer. */\n    JERRY_CONTEXT (jmem_heap_list_skip_p) = prev_p;\n    JERRY_CONTEXT (jmem_heap_allocated_size) += required_size;\n\n    while (JERRY_CONTEXT (jmem_heap_allocated_size) >= JERRY_CONTEXT (jmem_heap_limit))\n    {\n      JERRY_CONTEXT (jmem_heap_limit) += CONFIG_GC_LIMIT;\n    }\n  }\n  else\n  {\n    /* Could not extend block. Allocate new region and copy the data. */\n    /* jmem_heap_alloc_block_internal will adjust the allocated_size, but insert_block will not,\n       so we reduce it here first, so that the limit calculation remains consistent. */\n    JERRY_CONTEXT (jmem_heap_allocated_size) -= aligned_old_size;\n    ret_block_p = jmem_heap_alloc_block_internal (new_size);\n\n    /* jmem_heap_alloc_block_internal may trigger garbage collection, which can create new free blocks\n     * in the heap structure, so we need to look up the previous block again. */\n    prev_p = jmem_heap_find_prev (block_p);\n\n    memcpy (ret_block_p, block_p, old_size);\n    jmem_heap_insert_block (block_p, prev_p, aligned_old_size);\n    /* jmem_heap_alloc_block_internal will call JMEM_VALGRIND_MALLOCLIKE_SPACE */\n    JMEM_VALGRIND_FREELIKE_SPACE (block_p);\n  }\n\n  JMEM_HEAP_STAT_FREE (old_size);\n  JMEM_HEAP_STAT_ALLOC (new_size);\n  return ret_block_p;\n#else /* JERRY_SYSTEM_ALLOCATOR */\n  const size_t required_size = new_size - old_size;\n\n#if !JERRY_MEM_GC_BEFORE_EACH_ALLOC\n  if (JERRY_CONTEXT (jmem_heap_allocated_size) + required_size >= JERRY_CONTEXT (jmem_heap_limit))\n  {\n    ecma_free_unused_memory (JMEM_PRESSURE_LOW);\n  }\n#else /* !JERRY_MEM_GC_BEFORE_EACH_ALLOC */\n  ecma_gc_run ();\n#endif /* JERRY_MEM_GC_BEFORE_EACH_ALLOC */\n\n  JERRY_CONTEXT (jmem_heap_allocated_size) += required_size;\n\n  while (JERRY_CONTEXT (jmem_heap_allocated_size) >= JERRY_CONTEXT (jmem_heap_limit))\n  {\n    JERRY_CONTEXT (jmem_heap_limit) += CONFIG_GC_LIMIT;\n  }\n\n  while (JERRY_CONTEXT (jmem_heap_allocated_size) + CONFIG_GC_LIMIT <= JERRY_CONTEXT (jmem_heap_limit))\n  {\n    JERRY_CONTEXT (jmem_heap_limit) -= CONFIG_GC_LIMIT;\n  }\n\n  JMEM_HEAP_STAT_FREE (old_size);\n  JMEM_HEAP_STAT_ALLOC (new_size);\n  return realloc (ptr, new_size);\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n} /* jmem_heap_realloc_block */\n\n/**\n * Free memory block\n */\nextern inline void JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE\njmem_heap_free_block (void *ptr, /**< pointer to beginning of data space of the block */\n                      const size_t size) /**< size of allocated region */\n{\n  jmem_heap_free_block_internal (ptr, size);\n  JMEM_HEAP_STAT_FREE (size);\n  return;\n} /* jmem_heap_free_block */\n\n#ifndef JERRY_NDEBUG\n/**\n * Check whether the pointer points to the heap\n *\n * Note:\n *      the routine should be used only for assertion checks\n *\n * @return true - if pointer points to the heap,\n *         false - otherwise\n */\nbool\njmem_is_heap_pointer (const void *pointer) /**< pointer */\n{\n#if !JERRY_SYSTEM_ALLOCATOR\n  return ((uint8_t *) pointer >= JERRY_HEAP_CONTEXT (area)\n          && (uint8_t *) pointer <= (JERRY_HEAP_CONTEXT (area) + JMEM_HEAP_AREA_SIZE));\n#else /* JERRY_SYSTEM_ALLOCATOR */\n  JERRY_UNUSED (pointer);\n  return true;\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n} /* jmem_is_heap_pointer */\n#endif /* !JERRY_NDEBUG */\n\n#if JERRY_MEM_STATS\n/**\n * Get heap memory usage statistics\n */\nvoid\njmem_heap_get_stats (jmem_heap_stats_t *out_heap_stats_p) /**< [out] heap stats */\n{\n  JERRY_ASSERT (out_heap_stats_p != NULL);\n\n  *out_heap_stats_p = JERRY_CONTEXT (jmem_heap_stats);\n} /* jmem_heap_get_stats */\n\n/**\n * Print heap memory usage statistics\n */\nvoid\njmem_heap_stats_print (void)\n{\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  JERRY_DEBUG_MSG (\"Heap stats:\\n\");\n#if !JERRY_SYSTEM_ALLOCATOR\n  JERRY_DEBUG_MSG (\"  Heap size = %u bytes\\n\", (unsigned) heap_stats->size);\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n  JERRY_DEBUG_MSG (\"  Allocated = %u bytes\\n\", (unsigned) heap_stats->allocated_bytes);\n  JERRY_DEBUG_MSG (\"  Peak allocated = %u bytes\\n\", (unsigned) heap_stats->peak_allocated_bytes);\n  JERRY_DEBUG_MSG (\"  Waste = %u bytes\\n\", (unsigned) heap_stats->waste_bytes);\n  JERRY_DEBUG_MSG (\"  Peak waste = %u bytes\\n\", (unsigned) heap_stats->peak_waste_bytes);\n  JERRY_DEBUG_MSG (\"  Allocated byte code data = %u bytes\\n\", (unsigned) heap_stats->byte_code_bytes);\n  JERRY_DEBUG_MSG (\"  Peak allocated byte code data = %u bytes\\n\", (unsigned) heap_stats->peak_byte_code_bytes);\n  JERRY_DEBUG_MSG (\"  Allocated string data = %u bytes\\n\", (unsigned) heap_stats->string_bytes);\n  JERRY_DEBUG_MSG (\"  Peak allocated string data = %u bytes\\n\", (unsigned) heap_stats->peak_string_bytes);\n  JERRY_DEBUG_MSG (\"  Allocated object data = %u bytes\\n\", (unsigned) heap_stats->object_bytes);\n  JERRY_DEBUG_MSG (\"  Peak allocated object data = %u bytes\\n\", (unsigned) heap_stats->peak_object_bytes);\n  JERRY_DEBUG_MSG (\"  Allocated property data = %u bytes\\n\", (unsigned) heap_stats->property_bytes);\n  JERRY_DEBUG_MSG (\"  Peak allocated property data = %u bytes\\n\", (unsigned) heap_stats->peak_property_bytes);\n} /* jmem_heap_stats_print */\n\n/**\n * Initalize heap memory usage statistics account structure\n */\nvoid\njmem_heap_stat_init (void)\n{\n#if !JERRY_SYSTEM_ALLOCATOR\n  JERRY_CONTEXT (jmem_heap_stats).size = JMEM_HEAP_AREA_SIZE;\n#endif /* !JERRY_SYSTEM_ALLOCATOR */\n} /* jmem_heap_stat_init */\n\n/**\n * Account allocation\n */\nvoid\njmem_heap_stat_alloc (size_t size) /**< Size of allocated block */\n{\n  const size_t aligned_size = (size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT * JMEM_ALIGNMENT;\n  const size_t waste_bytes = aligned_size - size;\n\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  heap_stats->allocated_bytes += aligned_size;\n  heap_stats->waste_bytes += waste_bytes;\n\n  if (heap_stats->allocated_bytes > heap_stats->peak_allocated_bytes)\n  {\n    heap_stats->peak_allocated_bytes = heap_stats->allocated_bytes;\n  }\n\n  if (heap_stats->waste_bytes > heap_stats->peak_waste_bytes)\n  {\n    heap_stats->peak_waste_bytes = heap_stats->waste_bytes;\n  }\n} /* jmem_heap_stat_alloc */\n\n/**\n * Account freeing\n */\nvoid\njmem_heap_stat_free (size_t size) /**< Size of freed block */\n{\n  const size_t aligned_size = (size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT * JMEM_ALIGNMENT;\n  const size_t waste_bytes = aligned_size - size;\n\n  jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);\n\n  heap_stats->allocated_bytes -= aligned_size;\n  heap_stats->waste_bytes -= waste_bytes;\n} /* jmem_heap_stat_free */\n\n#endif /* JERRY_MEM_STATS */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/jmem/jmem-poolman.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Memory pool manager implementation\n */\n\n#include \"jcontext.h\"\n#include \"jmem.h\"\n#include \"jrt-libc-includes.h\"\n\n#define JMEM_ALLOCATOR_INTERNAL\n#include \"jmem-allocator-internal.h\"\n\n#if JERRY_MEM_GC_BEFORE_EACH_ALLOC\n#include \"ecma-gc.h\"\n#endif /* JERRY_MEM_GC_BEFORE_EACH_ALLOC */\n\n/** \\addtogroup mem Memory allocation\n * @{\n *\n * \\addtogroup poolman Memory pool manager\n * @{\n */\n\n/**\n * Finalize pool manager\n */\nvoid\njmem_pools_finalize (void)\n{\n  jmem_pools_collect_empty ();\n\n  JERRY_ASSERT (JERRY_CONTEXT (jmem_free_8_byte_chunk_p) == NULL);\n#if JERRY_CPOINTER_32_BIT\n  JERRY_ASSERT (JERRY_CONTEXT (jmem_free_16_byte_chunk_p) == NULL);\n#endif /* JERRY_CPOINTER_32_BIT */\n} /* jmem_pools_finalize */\n\n/**\n * Allocate a chunk of specified size\n *\n * @return pointer to allocated chunk, if allocation was successful,\n *         or NULL - if not enough memory.\n */\nextern inline void *JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE\njmem_pools_alloc (size_t size) /**< size of the chunk */\n{\n#if JERRY_MEM_GC_BEFORE_EACH_ALLOC\n  ecma_gc_run ();\n#endif /* JERRY_MEM_GC_BEFORE_EACH_ALLOC */\n\n#if JERRY_CPOINTER_32_BIT\n  if (size <= 8)\n  {\n#else /* !JERRY_CPOINTER_32_BIT */\n  JERRY_ASSERT (size <= 8);\n#endif /* JERRY_CPOINTER_32_BIT */\n\n    if (JERRY_CONTEXT (jmem_free_8_byte_chunk_p) != NULL)\n    {\n      const jmem_pools_chunk_t *const chunk_p = JERRY_CONTEXT (jmem_free_8_byte_chunk_p);\n\n      JMEM_VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));\n      JERRY_CONTEXT (jmem_free_8_byte_chunk_p) = chunk_p->next_p;\n      JMEM_VALGRIND_UNDEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));\n\n      JMEM_HEAP_STAT_ALLOC (8);\n      return (void *) chunk_p;\n    }\n    else\n    {\n      void *chunk_p = jmem_heap_alloc_block_internal (8);\n      JMEM_HEAP_STAT_ALLOC (8);\n      return chunk_p;\n    }\n\n#if JERRY_CPOINTER_32_BIT\n  }\n\n  JERRY_ASSERT (size <= 16);\n\n  if (JERRY_CONTEXT (jmem_free_16_byte_chunk_p) != NULL)\n  {\n    const jmem_pools_chunk_t *const chunk_p = JERRY_CONTEXT (jmem_free_16_byte_chunk_p);\n\n    JMEM_VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));\n    JERRY_CONTEXT (jmem_free_16_byte_chunk_p) = chunk_p->next_p;\n    JMEM_VALGRIND_UNDEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));\n\n    JMEM_HEAP_STAT_ALLOC (16);\n    return (void *) chunk_p;\n  }\n  else\n  {\n    void *chunk_p = jmem_heap_alloc_block_internal (16);\n    JMEM_HEAP_STAT_ALLOC (16);\n    return chunk_p;\n  }\n#endif /* JERRY_CPOINTER_32_BIT */\n} /* jmem_pools_alloc */\n\n/**\n * Free the chunk\n */\nextern inline void JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE\njmem_pools_free (void *chunk_p, /**< pointer to the chunk */\n                 size_t size) /**< size of the chunk */\n{\n  JERRY_ASSERT (chunk_p != NULL);\n  JMEM_HEAP_STAT_FREE (size);\n\n  jmem_pools_chunk_t *const chunk_to_free_p = (jmem_pools_chunk_t *) chunk_p;\n\n  JMEM_VALGRIND_DEFINED_SPACE (chunk_to_free_p, size);\n\n#if JERRY_CPOINTER_32_BIT\n  if (size <= 8)\n  {\n#else /* !JERRY_CPOINTER_32_BIT */\n  JERRY_ASSERT (size <= 8);\n#endif /* JERRY_CPOINTER_32_BIT */\n\n    chunk_to_free_p->next_p = JERRY_CONTEXT (jmem_free_8_byte_chunk_p);\n    JERRY_CONTEXT (jmem_free_8_byte_chunk_p) = chunk_to_free_p;\n\n#if JERRY_CPOINTER_32_BIT\n  }\n  else\n  {\n    JERRY_ASSERT (size <= 16);\n\n    chunk_to_free_p->next_p = JERRY_CONTEXT (jmem_free_16_byte_chunk_p);\n    JERRY_CONTEXT (jmem_free_16_byte_chunk_p) = chunk_to_free_p;\n  }\n#endif /* JERRY_CPOINTER_32_BIT */\n\n  JMEM_VALGRIND_NOACCESS_SPACE (chunk_to_free_p, size);\n} /* jmem_pools_free */\n\n/**\n *  Collect empty pool chunks\n */\nvoid\njmem_pools_collect_empty (void)\n{\n  jmem_pools_chunk_t *chunk_p = JERRY_CONTEXT (jmem_free_8_byte_chunk_p);\n  JERRY_CONTEXT (jmem_free_8_byte_chunk_p) = NULL;\n\n  while (chunk_p)\n  {\n    JMEM_VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));\n    jmem_pools_chunk_t *const next_p = chunk_p->next_p;\n    JMEM_VALGRIND_NOACCESS_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));\n\n    jmem_heap_free_block_internal (chunk_p, 8);\n    chunk_p = next_p;\n  }\n\n#if JERRY_CPOINTER_32_BIT\n  chunk_p = JERRY_CONTEXT (jmem_free_16_byte_chunk_p);\n  JERRY_CONTEXT (jmem_free_16_byte_chunk_p) = NULL;\n\n  while (chunk_p)\n  {\n    JMEM_VALGRIND_DEFINED_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));\n    jmem_pools_chunk_t *const next_p = chunk_p->next_p;\n    JMEM_VALGRIND_NOACCESS_SPACE (chunk_p, sizeof (jmem_pools_chunk_t));\n\n    jmem_heap_free_block_internal (chunk_p, 16);\n    chunk_p = next_p;\n  }\n#endif /* JERRY_CPOINTER_32_BIT */\n} /* jmem_pools_collect_empty */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/jmem/jmem.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JMEM_H\n#define JMEM_H\n\n#include \"jrt.h\"\n\n/** \\addtogroup mem Memory allocation\n * @{\n *\n * \\addtogroup heap Heap\n * @{\n */\n\n/**\n * Logarithm of required alignment for allocated units/blocks\n */\n#define JMEM_ALIGNMENT_LOG 3\n\n/**\n * Representation of NULL value for compressed pointers\n */\n#define JMEM_CP_NULL ((jmem_cpointer_t) 0)\n\n/**\n * Required alignment for allocated units/blocks\n */\n#define JMEM_ALIGNMENT (1u << JMEM_ALIGNMENT_LOG)\n\n/**\n * Pointer value can be directly stored without compression\n */\n#if UINTPTR_MAX <= UINT32_MAX\n#define JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY\n#endif /* UINTPTR_MAX <= UINT32_MAX */\n\n/**\n * Mask for tag part in jmem_cpointer_tag_t\n */\n#define JMEM_TAG_MASK 0x7u\n\n/**\n * Shift for tag part in jmem_cpointer_tag_t\n */\n#if defined(JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT\n#define JMEM_TAG_SHIFT 0\n#else /* !JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */\n#define JMEM_TAG_SHIFT 3\n#endif /* JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY && JERRY_CPOINTER_32_BIT */\n\n/**\n * Bit mask for tag part in jmem_cpointer_tag_t\n */\nenum\n{\n  JMEM_FIRST_TAG_BIT_MASK = (1u << 0), /**< first tag bit mask **/\n  JMEM_SECOND_TAG_BIT_MASK = (1u << 1), /**< second tag bit mask **/\n  JMEM_THIRD_TAG_BIT_MASK = (1u << 2), /**< third tag bit mask **/\n};\n\n/**\n * Compressed pointer representations\n *\n * 16 bit representation:\n *   The jmem_cpointer_t is defined as uint16_t\n *   and it can contain any sixteen bit value.\n *\n * 32 bit representation:\n *   The jmem_cpointer_t is defined as uint32_t.\n *   The lower JMEM_ALIGNMENT_LOG bits must be zero.\n *   The other bits can have any value.\n *\n * The 16 bit representation always encodes an offset from\n * a heap base. The 32 bit representation currently encodes\n * raw 32 bit JMEM_ALIGNMENT aligned pointers on 32 bit systems.\n * This can be extended to encode a 32 bit offset from a heap\n * base on 64 bit systems in the future. There are no plans\n * to support more than 4G address space for JerryScript.\n */\n\n/**\n * Compressed pointer\n */\n#if JERRY_CPOINTER_32_BIT\ntypedef uint32_t jmem_cpointer_t;\n#else /* !JERRY_CPOINTER_32_BIT */\ntypedef uint16_t jmem_cpointer_t;\n#endif /* JERRY_CPOINTER_32_BIT */\n\n/**\n * Compressed pointer with tag value\n */\ntypedef uint32_t jmem_cpointer_tag_t;\n\n/**\n * Memory usage pressure for reclaiming unused memory.\n *\n * Each failed allocation will try to reclaim memory with increasing pressure,\n * until enough memory is freed to fulfill the allocation request.\n *\n * If not enough memory is freed and JMEM_PRESSURE_FULL is reached,\n * then the engine is shut down with JERRY_FATAL_OUT_OF_MEMORY.\n */\ntypedef enum\n{\n  JMEM_PRESSURE_NONE, /**< no memory pressure */\n  JMEM_PRESSURE_LOW, /**< low memory pressure */\n  JMEM_PRESSURE_HIGH, /**< high memory pressure */\n  JMEM_PRESSURE_FULL, /**< memory full */\n} jmem_pressure_t;\n\n/**\n * Node for free chunk list\n */\ntypedef struct jmem_pools_chunk_t\n{\n  struct jmem_pools_chunk_t *next_p; /**< pointer to next pool chunk */\n} jmem_pools_chunk_t;\n\n/**\n *  Free region node\n */\ntypedef struct\n{\n  uint32_t next_offset; /**< Offset of next region in list */\n  uint32_t size; /**< Size of region */\n} jmem_heap_free_t;\n\nvoid jmem_init (void);\nvoid jmem_finalize (void);\n\nvoid *jmem_heap_alloc_block (const size_t size);\nvoid *jmem_heap_alloc_block_null_on_error (const size_t size);\nvoid *jmem_heap_realloc_block (void *ptr, const size_t old_size, const size_t new_size);\nvoid jmem_heap_free_block (void *ptr, const size_t size);\n\n#if JERRY_MEM_STATS\n/**\n * Heap memory usage statistics\n */\ntypedef struct\n{\n  size_t size; /**< heap total size */\n\n  size_t allocated_bytes; /**< currently allocated bytes */\n  size_t peak_allocated_bytes; /**< peak allocated bytes */\n\n  size_t waste_bytes; /**< bytes waste due to blocks filled partially */\n  size_t peak_waste_bytes; /**< peak wasted bytes */\n\n  size_t byte_code_bytes; /**< allocated memory for byte code */\n  size_t peak_byte_code_bytes; /**< peak allocated memory for byte code */\n\n  size_t string_bytes; /**< allocated memory for strings */\n  size_t peak_string_bytes; /**< peak allocated memory for strings */\n\n  size_t object_bytes; /**< allocated memory for objects */\n  size_t peak_object_bytes; /**< peak allocated memory for objects */\n\n  size_t property_bytes; /**< allocated memory for properties */\n  size_t peak_property_bytes; /**< peak allocated memory for properties */\n} jmem_heap_stats_t;\n\nvoid jmem_stats_allocate_byte_code_bytes (size_t property_size);\nvoid jmem_stats_free_byte_code_bytes (size_t property_size);\nvoid jmem_stats_allocate_string_bytes (size_t string_size);\nvoid jmem_stats_free_string_bytes (size_t string_size);\nvoid jmem_stats_allocate_object_bytes (size_t object_size);\nvoid jmem_stats_free_object_bytes (size_t string_size);\nvoid jmem_stats_allocate_property_bytes (size_t property_size);\nvoid jmem_stats_free_property_bytes (size_t property_size);\n\nvoid jmem_heap_get_stats (jmem_heap_stats_t *);\nvoid jmem_heap_stats_reset_peak (void);\nvoid jmem_heap_stats_print (void);\n#endif /* JERRY_MEM_STATS */\n\njmem_cpointer_t JERRY_ATTR_PURE jmem_compress_pointer (const void *pointer_p);\nvoid *JERRY_ATTR_PURE jmem_decompress_pointer (uintptr_t compressed_pointer);\n\n/**\n * Define a local array variable and allocate memory for the array on the heap.\n *\n * If requested number of elements is zero, assign NULL to the variable.\n *\n * Warning:\n *         if there is not enough memory on the heap, shutdown engine with JERRY_FATAL_OUT_OF_MEMORY.\n */\n#define JMEM_DEFINE_LOCAL_ARRAY(var_name, number, type)           \\\n  {                                                               \\\n    size_t var_name##___size = (size_t) (number) * sizeof (type); \\\n    type *var_name = (type *) (jmem_heap_alloc_block (var_name##___size));\n\n/**\n * Free the previously defined local array variable, freeing corresponding block on the heap,\n * if it was allocated (i.e. if the array's size was non-zero).\n */\n#define JMEM_FINALIZE_LOCAL_ARRAY(var_name)             \\\n  if (var_name != NULL)                                 \\\n  {                                                     \\\n    JERRY_ASSERT (var_name##___size != 0);              \\\n                                                        \\\n    jmem_heap_free_block (var_name, var_name##___size); \\\n  }                                                     \\\n  else                                                  \\\n  {                                                     \\\n    JERRY_ASSERT (var_name##___size == 0);              \\\n  }                                                     \\\n  }\n\n/**\n * Get value of pointer from specified non-null compressed pointer value\n */\n#define JMEM_CP_GET_NON_NULL_POINTER(type, cp_value) ((type *) (jmem_decompress_pointer (cp_value)))\n\n/**\n * Get value of pointer from specified compressed pointer value\n */\n#define JMEM_CP_GET_POINTER(type, cp_value) \\\n  (((JERRY_UNLIKELY ((cp_value) == JMEM_CP_NULL)) ? NULL : JMEM_CP_GET_NON_NULL_POINTER (type, cp_value)))\n\n/**\n * Set value of non-null compressed pointer so that it will correspond\n * to specified non_compressed_pointer\n */\n#define JMEM_CP_SET_NON_NULL_POINTER(cp_value, non_compressed_pointer) \\\n  (cp_value) = jmem_compress_pointer (non_compressed_pointer)\n\n/**\n * Set value of compressed pointer so that it will correspond\n * to specified non_compressed_pointer\n */\n#define JMEM_CP_SET_POINTER(cp_value, non_compressed_pointer) \\\n  do                                                          \\\n  {                                                           \\\n    void *ptr_value = (void *) non_compressed_pointer;        \\\n                                                              \\\n    if (JERRY_UNLIKELY ((ptr_value) == NULL))                 \\\n    {                                                         \\\n      (cp_value) = JMEM_CP_NULL;                              \\\n    }                                                         \\\n    else                                                      \\\n    {                                                         \\\n      JMEM_CP_SET_NON_NULL_POINTER (cp_value, ptr_value);     \\\n    }                                                         \\\n  } while (false);\n\n/**\n * Set value of pointer-tag value so that it will correspond\n * to specified non_compressed_pointer along with tag\n */\n#define JMEM_CP_SET_NON_NULL_POINTER_TAG(cp_value, pointer, tag)                   \\\n  do                                                                               \\\n  {                                                                                \\\n    JERRY_ASSERT ((uintptr_t) tag < (uintptr_t) (JMEM_ALIGNMENT));                 \\\n    jmem_cpointer_tag_t compressed_ptr = jmem_compress_pointer (pointer);          \\\n    (cp_value) = (jmem_cpointer_tag_t) ((compressed_ptr << JMEM_TAG_SHIFT) | tag); \\\n  } while (false);\n\n/**\n * Extract value of pointer from specified pointer-tag value\n */\n#define JMEM_CP_GET_NON_NULL_POINTER_FROM_POINTER_TAG(type, cp_value) \\\n  ((type *) (jmem_decompress_pointer ((cp_value & ~JMEM_TAG_MASK) >> JMEM_TAG_SHIFT)))\n\n/**\n * Extract tag bits from pointer-tag value\n */\n#define JMEM_CP_GET_POINTER_TAG_BITS(cp_value) \\\n  (cp_value & (JMEM_FIRST_TAG_BIT_MASK | JMEM_SECOND_TAG_BIT_MASK | JMEM_THIRD_TAG_BIT_MASK))\n\n/**\n * Get value of each tag from specified pointer-tag value\n */\n#define JMEM_CP_GET_FIRST_BIT_FROM_POINTER_TAG(cp_value)      \\\n  (cp_value & JMEM_FIRST_TAG_BIT_MASK) /**< get first tag bit \\\n                                        **/\n#define JMEM_CP_GET_SECOND_BIT_FROM_POINTER_TAG(cp_value) \\\n  (cp_value & JMEM_SECOND_TAG_BIT_MASK) /**< get second tag bit **/\n#define JMEM_CP_GET_THIRD_BIT_FROM_POINTER_TAG(cp_value)      \\\n  (cp_value & JMEM_THIRD_TAG_BIT_MASK) /**< get third tag bit \\\n                                        **/\n\n/**\n * Set value of each tag to specified pointer-tag value\n */\n#define JMEM_CP_SET_FIRST_BIT_TO_POINTER_TAG(cp_value) \\\n  (cp_value) = (cp_value | JMEM_FIRST_TAG_BIT_MASK) /**< set first tag bit **/\n#define JMEM_CP_SET_SECOND_BIT_TO_POINTER_TAG(cp_value) \\\n  (cp_value) = (cp_value | JMEM_SECOND_TAG_BIT_MASK) /**< set second tag bit **/\n#define JMEM_CP_SET_THIRD_BIT_TO_POINTER_TAG(cp_value) \\\n  (cp_value) = (cp_value | JMEM_THIRD_TAG_BIT_MASK) /**< set third tag bit **/\n\n/**\n * @}\n * \\addtogroup poolman Memory pool manager\n * @{\n */\n\nvoid *jmem_pools_alloc (size_t size);\nvoid jmem_pools_free (void *chunk_p, size_t size);\nvoid jmem_pools_collect_empty (void);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !JMEM_H */\n"
  },
  {
    "path": "jerry-core/jrt/jrt-bit-fields.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JRT_BIT_FIELDS_H\n#define JRT_BIT_FIELDS_H\n\n/**\n * Extract a bit-field.\n *\n * @param type type of container\n * @param container container to extract bit-field from\n * @param lsb least significant bit of the value to be extracted\n * @param width width of the bit-field to be extracted\n * @return bit-field's value\n */\n#define JRT_EXTRACT_BIT_FIELD(type, container, lsb, width) (((container) >> lsb) & ((((type) 1) << (width)) - 1))\n\n/**\n * Set a bit-field.\n *\n * @param type type of container\n * @param container container to insert bit-field to\n * @param new_bit_field_value value of bit-field to insert\n * @param lsb least significant bit of the value to be inserted\n * @param width width of the bit-field to be inserted\n * @return bit-field's value\n */\n#define JRT_SET_BIT_FIELD_VALUE(type, container, new_bit_field_value, lsb, width) \\\n  (((container) & ~(((((type) 1) << (width)) - 1) << (lsb))) | (((type) new_bit_field_value) << (lsb)))\n\n#endif /* !JRT_BIT_FIELDS_H */\n"
  },
  {
    "path": "jerry-core/jrt/jrt-fatals.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Implementation of exit with specified status code.\n */\n\n#include \"jrt-libc-includes.h\"\n#include \"jrt.h\"\n\n/*\n * Exit with specified status code.\n *\n * If !JERRY_NDEBUG and code != 0, print status code with description\n * and call assertion fail handler.\n */\nvoid JERRY_ATTR_NORETURN\njerry_fatal (jerry_fatal_code_t code) /**< status code */\n{\n#ifndef JERRY_NDEBUG\n  switch (code)\n  {\n    case JERRY_FATAL_OUT_OF_MEMORY:\n    {\n      JERRY_ERROR_MSG (\"Error: JERRY_FATAL_OUT_OF_MEMORY\\n\");\n      break;\n    }\n    case JERRY_FATAL_REF_COUNT_LIMIT:\n    {\n      JERRY_ERROR_MSG (\"Error: JERRY_FATAL_REF_COUNT_LIMIT\\n\");\n      break;\n    }\n    case JERRY_FATAL_UNTERMINATED_GC_LOOPS:\n    {\n      JERRY_ERROR_MSG (\"Error: JERRY_FATAL_UNTERMINATED_GC_LOOPS\\n\");\n      break;\n    }\n    case JERRY_FATAL_DISABLED_BYTE_CODE:\n    {\n      JERRY_ERROR_MSG (\"Error: JERRY_FATAL_DISABLED_BYTE_CODE\\n\");\n      break;\n    }\n    case JERRY_FATAL_FAILED_ASSERTION:\n    {\n      JERRY_ERROR_MSG (\"Error: JERRY_FATAL_FAILED_ASSERTION\\n\");\n      break;\n    }\n  }\n#endif /* !JERRY_NDEBUG */\n\n  jerry_port_fatal (code);\n\n  /* to make compiler happy for some RTOS: 'control reaches end of non-void function' */\n  while (true)\n  {\n  }\n} /* jerry_fatal */\n\n#ifndef JERRY_NDEBUG\n/**\n * Handle failed assertion\n */\nvoid JERRY_ATTR_NORETURN\njerry_assert_fail (const char *assertion, /**< assertion condition string */\n                   const char *file, /**< file name */\n                   const char *function, /**< function name */\n                   const uint32_t line) /**< line */\n{\n  JERRY_ERROR_MSG (\"ICE: Assertion '%s' failed at %s(%s):%u.\\n\", assertion, file, function, line);\n\n  jerry_fatal (JERRY_FATAL_FAILED_ASSERTION);\n} /* jerry_assert_fail */\n\n/**\n * Handle execution of control path that should be unreachable\n */\nvoid JERRY_ATTR_NORETURN\njerry_unreachable (const char *file, /**< file name */\n                   const char *function, /**< function name */\n                   const uint32_t line) /**< line */\n{\n  JERRY_ERROR_MSG (\"ICE: Unreachable control path at %s(%s):%u was executed.\\n\", file, function, line);\n\n  jerry_fatal (JERRY_FATAL_FAILED_ASSERTION);\n} /* jerry_unreachable */\n#endif /* !JERRY_NDEBUG */\n"
  },
  {
    "path": "jerry-core/jrt/jrt-libc-includes.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JRT_LIBC_INCLUDES_H\n#define JRT_LIBC_INCLUDES_H\n\n#include <ctype.h>\n#include <setjmp.h>\n#include <stdarg.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#endif /* !JRT_LIBC_INCLUDES_H */\n"
  },
  {
    "path": "jerry-core/jrt/jrt-logging.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jrt.h\"\n\nstatic jerry_log_level_t jerry_log_level = JERRY_LOG_LEVEL_ERROR;\n\n/**\n * Get current log level\n *\n * @return log level\n */\njerry_log_level_t\njerry_jrt_get_log_level (void)\n{\n  return jerry_log_level;\n} /* jerry_jrt_get_log_level */\n\n/**\n * Set log level\n *\n * @param level: new log level\n */\nvoid\njerry_jrt_set_log_level (jerry_log_level_t level)\n{\n  jerry_log_level = level;\n} /* jerry_jrt_set_log_level */\n"
  },
  {
    "path": "jerry-core/jrt/jrt-types.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JRT_TYPES_H\n#define JRT_TYPES_H\n\n#include <float.h>\n#include <stdbool.h>\n#include <stddef.h>\n#include <stdint.h>\n\n#endif /* !JRT_TYPES_H */\n"
  },
  {
    "path": "jerry-core/jrt/jrt.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JRT_H\n#define JRT_H\n\n#include <stdio.h>\n#include <string.h>\n\n#include \"jerryscript-core.h\"\n#include \"jerryscript-port.h\"\n\n#include \"config.h\"\n#include \"jrt-types.h\"\n\n/*\n * Constants\n */\n#define JERRY_BITSINBYTE 8\n\n/*\n * Make sure unused parameters, variables, or expressions trigger no compiler warning.\n */\n#define JERRY_UNUSED(x) ((void) (x))\n\n#define JERRY_UNUSED_1(_1)                             JERRY_UNUSED (_1)\n#define JERRY_UNUSED_2(_1, _2)                         JERRY_UNUSED (_1), JERRY_UNUSED_1 (_2)\n#define JERRY_UNUSED_3(_1, _2, _3)                     JERRY_UNUSED (_1), JERRY_UNUSED_2 (_2, _3)\n#define JERRY_UNUSED_4(_1, _2, _3, _4)                 JERRY_UNUSED (_1), JERRY_UNUSED_3 (_2, _3, _4)\n#define JERRY_UNUSED_5(_1, _2, _3, _4, _5)             JERRY_UNUSED (_1), JERRY_UNUSED_4 (_2, _3, _4, _5)\n#define JERRY_UNUSED_6(_1, _2, _3, _4, _5, _6)         JERRY_UNUSED (_1), JERRY_UNUSED_5 (_2, _3, _4, _5, _6)\n#define JERRY_UNUSED_7(_1, _2, _3, _4, _5, _6, _7)     JERRY_UNUSED (_1), JERRY_UNUSED_6 (_2, _3, _4, _5, _6, _7)\n#define JERRY_UNUSED_8(_1, _2, _3, _4, _5, _6, _7, _8) JERRY_UNUSED (_1), JERRY_UNUSED_7 (_2, _3, _4, _5, _6, _7, _8)\n\n#define JERRY_VA_ARGS_NUM_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N\n#define JERRY_VA_ARGS_NUM(...)                                         JERRY_VA_ARGS_NUM_IMPL (__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0)\n\n#define JERRY_UNUSED_ALL_IMPL_(nargs) JERRY_UNUSED_##nargs\n#define JERRY_UNUSED_ALL_IMPL(nargs)  JERRY_UNUSED_ALL_IMPL_ (nargs)\n#define JERRY_UNUSED_ALL(...)         JERRY_UNUSED_ALL_IMPL (JERRY_VA_ARGS_NUM (__VA_ARGS__)) (__VA_ARGS__)\n\n/*\n * Asserts\n *\n * Warning:\n *         Don't use JERRY_STATIC_ASSERT in headers, because\n *         __LINE__ may be the same for asserts in a header\n *         and in an implementation file.\n */\n#define JERRY_STATIC_ASSERT_GLUE_(a, b, c) a##b##_##c\n#define JERRY_STATIC_ASSERT_GLUE(a, b, c)  JERRY_STATIC_ASSERT_GLUE_ (a, b, c)\n#define JERRY_STATIC_ASSERT(x, msg)                                                  \\\n  enum                                                                               \\\n  {                                                                                  \\\n    JERRY_STATIC_ASSERT_GLUE (static_assertion_failed_, __LINE__, msg) = 1 / (!!(x)) \\\n  }\n\n#ifndef JERRY_NDEBUG\nvoid JERRY_ATTR_NORETURN jerry_assert_fail (const char *assertion,\n                                            const char *file,\n                                            const char *function,\n                                            const uint32_t line);\nvoid JERRY_ATTR_NORETURN jerry_unreachable (const char *file, const char *function, const uint32_t line);\n\n#define JERRY_ASSERT(x)                                     \\\n  do                                                        \\\n  {                                                         \\\n    if (JERRY_UNLIKELY (!(x)))                              \\\n    {                                                       \\\n      jerry_assert_fail (#x, __FILE__, __func__, __LINE__); \\\n    }                                                       \\\n  } while (0)\n\n#define JERRY_UNREACHABLE()                           \\\n  do                                                  \\\n  {                                                   \\\n    jerry_unreachable (__FILE__, __func__, __LINE__); \\\n  } while (0)\n#else /* JERRY_NDEBUG */\n#define JERRY_ASSERT(x) \\\n  do                    \\\n  {                     \\\n    if (false)          \\\n    {                   \\\n      JERRY_UNUSED (x); \\\n    }                   \\\n  } while (0)\n\n#ifdef __GNUC__\n#define JERRY_UNREACHABLE() __builtin_unreachable ()\n#endif /* __GNUC__ */\n\n#ifdef _MSC_VER\n#define JERRY_UNREACHABLE() _assume (0)\n#endif /* _MSC_VER */\n\n#ifndef JERRY_UNREACHABLE\n#define JERRY_UNREACHABLE()\n#endif /* !JERRY_UNREACHABLE */\n\n#endif /* !JERRY_NDEBUG */\n\n/**\n * Exit on fatal error\n */\nvoid JERRY_ATTR_NORETURN jerry_fatal (jerry_fatal_code_t code);\n\njerry_log_level_t jerry_jrt_get_log_level (void);\nvoid jerry_jrt_set_log_level (jerry_log_level_t level);\n\n/*\n * Logging\n */\n#if JERRY_LOGGING\n#define JERRY_ERROR_MSG(...)   jerry_log (JERRY_LOG_LEVEL_ERROR, __VA_ARGS__)\n#define JERRY_WARNING_MSG(...) jerry_log (JERRY_LOG_LEVEL_WARNING, __VA_ARGS__)\n#define JERRY_DEBUG_MSG(...)   jerry_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__)\n#define JERRY_TRACE_MSG(...)   jerry_log (JERRY_LOG_LEVEL_TRACE, __VA_ARGS__)\n#else /* !JERRY_LOGGING */\n#define JERRY_ERROR_MSG(...)          \\\n  do                                  \\\n  {                                   \\\n    if (false)                        \\\n    {                                 \\\n      JERRY_UNUSED_ALL (__VA_ARGS__); \\\n    }                                 \\\n  } while (0)\n#define JERRY_WARNING_MSG(...)        \\\n  do                                  \\\n  {                                   \\\n    if (false)                        \\\n    {                                 \\\n      JERRY_UNUSED_ALL (__VA_ARGS__); \\\n    }                                 \\\n  } while (0)\n#define JERRY_DEBUG_MSG(...)          \\\n  do                                  \\\n  {                                   \\\n    if (false)                        \\\n    {                                 \\\n      JERRY_UNUSED_ALL (__VA_ARGS__); \\\n    }                                 \\\n  } while (0)\n#define JERRY_TRACE_MSG(...)          \\\n  do                                  \\\n  {                                   \\\n    if (false)                        \\\n    {                                 \\\n      JERRY_UNUSED_ALL (__VA_ARGS__); \\\n    }                                 \\\n  } while (0)\n#endif /* JERRY_LOGGING */\n\n/**\n * Size of struct member\n */\n#define JERRY_SIZE_OF_STRUCT_MEMBER(struct_name, member_name) sizeof (((struct_name *) NULL)->member_name)\n\n/**\n * Aligns @a value to @a alignment. @a must be the power of 2.\n *\n * Returns minimum positive value, that divides @a alignment and is more than or equal to @a value\n */\n#define JERRY_ALIGNUP(value, alignment) (((value) + ((alignment) -1)) & ~((alignment) -1))\n\n/**\n * Align value down\n */\n#define JERRY_ALIGNDOWN(value, alignment) ((value) & ~((alignment) -1))\n\n/*\n * min, max\n */\n#define JERRY_MIN(v1, v2) (((v1) < (v2)) ? (v1) : (v2))\n#define JERRY_MAX(v1, v2) (((v1) < (v2)) ? (v2) : (v1))\n\n/**\n * Calculate the index of the first non-zero bit of a 32 bit integer value\n */\n#define JERRY__LOG2_1(n) (((n) >= 2) ? 1 : 0)\n#define JERRY__LOG2_2(n) (((n) >= 1 << 2) ? (2 + JERRY__LOG2_1 ((n) >> 2)) : JERRY__LOG2_1 (n))\n#define JERRY__LOG2_4(n) (((n) >= 1 << 4) ? (4 + JERRY__LOG2_2 ((n) >> 4)) : JERRY__LOG2_2 (n))\n#define JERRY__LOG2_8(n) (((n) >= 1 << 8) ? (8 + JERRY__LOG2_4 ((n) >> 8)) : JERRY__LOG2_4 (n))\n#define JERRY_LOG2(n)    (((n) >= 1 << 16) ? (16 + JERRY__LOG2_8 ((n) >> 16)) : JERRY__LOG2_8 (n))\n\n/**\n * JERRY_BLOCK_TAIL_CALL_OPTIMIZATION\n *\n * Adapted from abseil ( https://github.com/abseil/ )\n *\n * Instructs the compiler to avoid optimizing tail-call recursion. This macro is\n * useful when you wish to preserve the existing function order within a stack\n * trace for logging, debugging, or profiling purposes.\n *\n * Example:\n *\n *   int f() {\n *     int result = g();\n *     JERRY_BLOCK_TAIL_CALL_OPTIMIZATION();\n *     return result;\n *   }\n *\n * This macro is intentionally here as jerryscript-compiler.h is a public header and\n * it does not make sense to expose this macro to the public.\n */\n#if defined(__clang__) || defined(__GNUC__)\n/* Clang/GCC will not tail call given inline volatile assembly. */\n#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__ (\"\")\n#else /* !defined(__clang__) && !defined(__GNUC__) */\n/* On GCC 10.x this version also works. */\n#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION()                 \\\n  do                                                         \\\n  {                                                          \\\n    JERRY_CONTEXT (status_flags) |= ECMA_STATUS_API_ENABLED; \\\n  } while (0)\n#endif /* defined(__clang__) || defined (__GNUC__) */\n\n#endif /* !JRT_H */\n"
  },
  {
    "path": "jerry-core/libjerry-core.pc.in",
    "content": "prefix=@CMAKE_INSTALL_PREFIX@\nlibdir=${prefix}/lib\nincludedir=${prefix}/include\n\nName: libjerry-core\nDescription: JerryScript: lightweight JavaScript engine (core engine library)\nURL: https://github.com/jerryscript-project/jerryscript\nVersion: @JERRY_VERSION@\nRequires.private: @JERRY_CORE_PKGCONFIG_REQUIRES@ # NOTE: libjerry-port is not added as a required package\nLibs: -L${libdir} -ljerry-core\nLibs.private: @JERRY_CORE_PKGCONFIG_LIBS@\nCflags: -I${includedir} @JERRY_CORE_PKGCONFIG_CFLAGS@\n"
  },
  {
    "path": "jerry-core/lit/lit-char-helpers.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"lit-char-helpers.h\"\n\n#include \"ecma-helpers.h\"\n\n#include \"config.h\"\n#include \"lit-strings.h\"\n#include \"lit-unicode-ranges-sup.inc.h\"\n#include \"lit-unicode-ranges.inc.h\"\n\n#if JERRY_UNICODE_CASE_CONVERSION\n#include \"lit-unicode-conversions-sup.inc.h\"\n#include \"lit-unicode-conversions.inc.h\"\n#include \"lit-unicode-folding.inc.h\"\n#endif /* JERRY_UNICODE_CASE_CONVERSION */\n\n#define NUM_OF_ELEMENTS(array) (sizeof (array) / sizeof ((array)[0]))\n\n/**\n * Binary search algorithm that searches the a\n * character in the given char array.\n *\n * @return true - if the character is in the given array\n *         false - otherwise\n */\n#define LIT_SEARCH_CHAR_IN_ARRAY_FN(function_name, char_type, array_type)   \\\n  static bool function_name (char_type c, /**< code unit */                 \\\n                             const array_type *array, /**< array */         \\\n                             int size_of_array) /**< length of the array */ \\\n  {                                                                         \\\n    int bottom = 0;                                                         \\\n    int top = size_of_array - 1;                                            \\\n                                                                            \\\n    while (bottom <= top)                                                   \\\n    {                                                                       \\\n      int middle = (bottom + top) / 2;                                      \\\n      char_type current = array[middle];                                    \\\n                                                                            \\\n      if (current == c)                                                     \\\n      {                                                                     \\\n        return true;                                                        \\\n      }                                                                     \\\n                                                                            \\\n      if (c < current)                                                      \\\n      {                                                                     \\\n        top = middle - 1;                                                   \\\n      }                                                                     \\\n      else                                                                  \\\n      {                                                                     \\\n        bottom = middle + 1;                                                \\\n      }                                                                     \\\n    }                                                                       \\\n                                                                            \\\n    return false;                                                           \\\n  } /* __function_name */\n\nLIT_SEARCH_CHAR_IN_ARRAY_FN (lit_search_char_in_array, ecma_char_t, uint16_t)\n\nLIT_SEARCH_CHAR_IN_ARRAY_FN (lit_search_codepoint_in_array, lit_code_point_t, uint32_t)\n\n/**\n * Binary search algorithm that searches a character in the given intervals.\n * Intervals specifed by two arrays. The first one contains the starting points\n * of the intervals, the second one contains the length of them.\n *\n * @return true - if the the character is included (inclusively) in one of the intervals in the given array\n *         false - otherwise\n */\n#define LIT_SEARCH_CHAR_IN_INTERVAL_ARRAY_FN(function_name, char_type, array_type, interval_type)  \\\n  static bool function_name (char_type c, /**< code unit */                                        \\\n                             const array_type *array_sp, /**< array of interval starting points */ \\\n                             const interval_type *lengths, /**< array of interval lengths */       \\\n                             int size_of_array) /**< length of the array */                        \\\n  {                                                                                                \\\n    int bottom = 0;                                                                                \\\n    int top = size_of_array - 1;                                                                   \\\n                                                                                                   \\\n    while (bottom <= top)                                                                          \\\n    {                                                                                              \\\n      int middle = (bottom + top) / 2;                                                             \\\n      char_type current_sp = array_sp[middle];                                                     \\\n                                                                                                   \\\n      if (current_sp <= c && c <= current_sp + lengths[middle])                                    \\\n      {                                                                                            \\\n        return true;                                                                               \\\n      }                                                                                            \\\n                                                                                                   \\\n      if (c > current_sp)                                                                          \\\n      {                                                                                            \\\n        bottom = middle + 1;                                                                       \\\n      }                                                                                            \\\n      else                                                                                         \\\n      {                                                                                            \\\n        top = middle - 1;                                                                          \\\n      }                                                                                            \\\n    }                                                                                              \\\n                                                                                                   \\\n    return false;                                                                                  \\\n  } /* function_name */\n\nLIT_SEARCH_CHAR_IN_INTERVAL_ARRAY_FN (lit_search_char_in_interval_array, ecma_char_t, uint16_t, uint8_t)\n\nLIT_SEARCH_CHAR_IN_INTERVAL_ARRAY_FN (lit_search_codepoint_in_interval_array, lit_code_point_t, uint32_t, uint16_t)\n\n/**\n * Check if specified character is one of the Whitespace characters including those that fall into\n * \"Space, Separator\" (\"Zs\") Unicode character category or one of the Line Terminator characters.\n *\n * @return true - if the character is one of characters, listed in ECMA-262 v5, Table 2,\n *         false - otherwise\n */\nbool\nlit_char_is_white_space (lit_code_point_t c) /**< code point */\n{\n  if (c <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)\n  {\n    return (c == LIT_CHAR_SP || (c >= LIT_CHAR_TAB && c <= LIT_CHAR_CR));\n  }\n\n  if (c == LIT_CHAR_BOM || c == LIT_CHAR_LS || c == LIT_CHAR_PS)\n  {\n    return true;\n  }\n\n  return (c <= LIT_UTF16_CODE_UNIT_MAX\n          && ((c >= lit_unicode_white_space_interval_starts[0]\n               && c <= lit_unicode_white_space_interval_starts[0] + lit_unicode_white_space_interval_lengths[0])\n              || lit_search_char_in_array ((ecma_char_t) c,\n                                           lit_unicode_white_space_chars,\n                                           NUM_OF_ELEMENTS (lit_unicode_white_space_chars))));\n} /* lit_char_is_white_space */\n\n/**\n * Check if specified character is one of LineTerminator characters\n *\n * @return true - if the character is one of characters, listed in ECMA-262 v5, Table 3,\n *         false - otherwise\n */\nbool\nlit_char_is_line_terminator (ecma_char_t c) /**< code unit */\n{\n  return (c == LIT_CHAR_LF || c == LIT_CHAR_CR || c == LIT_CHAR_LS || c == LIT_CHAR_PS);\n} /* lit_char_is_line_terminator */\n\n/**\n * Check if specified character is a Unicode ID_Start\n *\n * See also:\n *          ECMA-262 v1, 11.6: UnicodeIDStart\n *\n * @return true - if the codepoint has Unicode property \"ID_Start\"\n *         false - otherwise\n */\nstatic bool\nlit_char_is_unicode_id_start (lit_code_point_t code_point) /**< code unit */\n{\n  if (JERRY_UNLIKELY (code_point >= LIT_UTF8_4_BYTE_CODE_POINT_MIN))\n  {\n    return (lit_search_codepoint_in_interval_array (code_point,\n                                                    lit_unicode_id_start_interval_starts_sup,\n                                                    lit_unicode_id_start_interval_lengths_sup,\n                                                    NUM_OF_ELEMENTS (lit_unicode_id_start_interval_starts_sup))\n            || lit_search_codepoint_in_array (code_point,\n                                              lit_unicode_id_start_chars_sup,\n                                              NUM_OF_ELEMENTS (lit_unicode_id_start_chars_sup)));\n  }\n  ecma_char_t c = (ecma_char_t) code_point;\n\n  return (lit_search_char_in_interval_array (c,\n                                             lit_unicode_id_start_interval_starts,\n                                             lit_unicode_id_start_interval_lengths,\n                                             NUM_OF_ELEMENTS (lit_unicode_id_start_interval_starts))\n          || lit_search_char_in_array (c, lit_unicode_id_start_chars, NUM_OF_ELEMENTS (lit_unicode_id_start_chars)));\n} /* lit_char_is_unicode_id_start */\n\n/**\n * Check if specified character is a Unicode ID_Continue\n *\n * See also:\n *          ECMA-262 v1, 11.6: UnicodeIDContinue\n *\n * @return true - if the codepoint has Unicode property \"ID_Continue\"\n *         false - otherwise\n */\nstatic bool\nlit_char_is_unicode_id_continue (lit_code_point_t code_point) /**< code unit */\n{\n  /* Each ID_Start codepoint is ID_Continue as well. */\n  if (lit_char_is_unicode_id_start (code_point))\n  {\n    return true;\n  }\n\n  if (JERRY_UNLIKELY (code_point >= LIT_UTF8_4_BYTE_CODE_POINT_MIN))\n  {\n    return (lit_search_codepoint_in_interval_array (code_point,\n                                                    lit_unicode_id_continue_interval_starts_sup,\n                                                    lit_unicode_id_continue_interval_lengths_sup,\n                                                    NUM_OF_ELEMENTS (lit_unicode_id_continue_interval_starts_sup))\n            || lit_search_codepoint_in_array (code_point,\n                                              lit_unicode_id_continue_chars_sup,\n                                              NUM_OF_ELEMENTS (lit_unicode_id_continue_chars_sup)));\n  }\n  ecma_char_t c = (ecma_char_t) code_point;\n\n  return (\n    lit_search_char_in_interval_array (c,\n                                       lit_unicode_id_continue_interval_starts,\n                                       lit_unicode_id_continue_interval_lengths,\n                                       NUM_OF_ELEMENTS (lit_unicode_id_continue_interval_starts))\n    || lit_search_char_in_array (c, lit_unicode_id_continue_chars, NUM_OF_ELEMENTS (lit_unicode_id_continue_chars)));\n} /* lit_char_is_unicode_id_continue */\n\n/**\n * Checks whether the character is a valid identifier start.\n *\n * @return true if it is.\n */\nbool\nlit_code_point_is_identifier_start (lit_code_point_t code_point) /**< code point */\n{\n  /* Fast path for ASCII-defined letters. */\n  if (code_point <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)\n  {\n    return ((LEXER_TO_ASCII_LOWERCASE (code_point) >= LIT_CHAR_LOWERCASE_A\n             && LEXER_TO_ASCII_LOWERCASE (code_point) <= LIT_CHAR_LOWERCASE_Z)\n            || code_point == LIT_CHAR_DOLLAR_SIGN || code_point == LIT_CHAR_UNDERSCORE);\n  }\n\n  return lit_char_is_unicode_id_start (code_point);\n} /* lit_code_point_is_identifier_start */\n\n/**\n * Checks whether the character is a valid identifier part.\n *\n * @return true if it is.\n */\nbool\nlit_code_point_is_identifier_part (lit_code_point_t code_point) /**< code point */\n{\n  /* Fast path for ASCII-defined letters. */\n  if (code_point <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)\n  {\n    return ((LEXER_TO_ASCII_LOWERCASE (code_point) >= LIT_CHAR_LOWERCASE_A\n             && LEXER_TO_ASCII_LOWERCASE (code_point) <= LIT_CHAR_LOWERCASE_Z)\n            || (code_point >= LIT_CHAR_0 && code_point <= LIT_CHAR_9) || code_point == LIT_CHAR_DOLLAR_SIGN\n            || code_point == LIT_CHAR_UNDERSCORE);\n  }\n\n  return lit_char_is_unicode_id_continue (code_point);\n} /* lit_code_point_is_identifier_part */\n\n/**\n * Check if specified character is one of OctalDigit characters (ECMA-262 v5, B.1.2)\n *\n * @return true / false\n */\nbool\nlit_char_is_octal_digit (ecma_char_t c) /**< code unit */\n{\n  return (c >= LIT_CHAR_ASCII_OCTAL_DIGITS_BEGIN && c <= LIT_CHAR_ASCII_OCTAL_DIGITS_END);\n} /* lit_char_is_octal_digit */\n\n/**\n * Check if specified character is one of DecimalDigit characters (ECMA-262 v5, 7.8.3)\n *\n * @return true / false\n */\nbool\nlit_char_is_decimal_digit (ecma_char_t c) /**< code unit */\n{\n  return (c >= LIT_CHAR_ASCII_DIGITS_BEGIN && c <= LIT_CHAR_ASCII_DIGITS_END);\n} /* lit_char_is_decimal_digit */\n\n/**\n * Check if specified character is one of HexDigit characters (ECMA-262 v5, 7.8.3)\n *\n * @return true / false\n */\nbool\nlit_char_is_hex_digit (ecma_char_t c) /**< code unit */\n{\n  return ((c >= LIT_CHAR_ASCII_DIGITS_BEGIN && c <= LIT_CHAR_ASCII_DIGITS_END)\n          || (LEXER_TO_ASCII_LOWERCASE (c) >= LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_BEGIN\n              && LEXER_TO_ASCII_LOWERCASE (c) <= LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_END));\n} /* lit_char_is_hex_digit */\n\n/**\n * Check if specified character is one of BinaryDigits characters (ECMA-262 v6, 11.8.3)\n *\n * @return true / false\n */\nbool\nlit_char_is_binary_digit (ecma_char_t c) /** code unit */\n{\n  return (c == LIT_CHAR_0 || c == LIT_CHAR_1);\n} /* lit_char_is_binary_digit */\n\n/**\n * @return radix value\n */\nuint8_t\nlit_char_to_radix (lit_utf8_byte_t c) /** code unit */\n{\n  switch (LEXER_TO_ASCII_LOWERCASE (c))\n  {\n    case LIT_CHAR_LOWERCASE_X:\n    {\n      return 16;\n    }\n    case LIT_CHAR_LOWERCASE_O:\n    {\n      return 8;\n    }\n    case LIT_CHAR_LOWERCASE_B:\n    {\n      return 2;\n    }\n    default:\n    {\n      return 10;\n    }\n  }\n} /* lit_char_to_radix */\n\n/**\n * UnicodeEscape abstract method\n *\n * See also: ECMA-262 v10, 24.5.2.3\n */\nvoid\nlit_char_unicode_escape (ecma_stringbuilder_t *builder_p, /**< stringbuilder to append */\n                         ecma_char_t c) /**< code unit to convert */\n{\n  ecma_stringbuilder_append_raw (builder_p, (lit_utf8_byte_t *) \"\\\\u\", 2);\n\n  for (int8_t i = 3; i >= 0; i--)\n  {\n    int32_t result_char = (c >> (i * 4)) & 0xF;\n    ecma_stringbuilder_append_byte (\n      builder_p,\n      (lit_utf8_byte_t) (result_char + (result_char <= 9 ? LIT_CHAR_0 : (LIT_CHAR_LOWERCASE_A - 10))));\n  }\n} /* lit_char_unicode_escape */\n\n/**\n * Convert a HexDigit character to its numeric value, as defined in ECMA-262 v5, 7.8.3\n *\n * @return digit value, corresponding to the hex char\n */\nuint32_t\nlit_char_hex_to_int (ecma_char_t c) /**< code unit, corresponding to\n                                     *    one of HexDigit characters */\n{\n  JERRY_ASSERT (lit_char_is_hex_digit (c));\n\n  if (c >= LIT_CHAR_ASCII_DIGITS_BEGIN && c <= LIT_CHAR_ASCII_DIGITS_END)\n  {\n    return (uint32_t) (c - LIT_CHAR_ASCII_DIGITS_BEGIN);\n  }\n\n  const uint32_t hex_offset = 10 - (LIT_CHAR_LOWERCASE_A % 32);\n  return (c % 32) + hex_offset;\n} /* lit_char_hex_to_int */\n\n/**\n * Converts a character to UTF8 bytes.\n *\n * @return length of the UTF8 representation.\n */\nsize_t\nlit_code_point_to_cesu8_bytes (uint8_t *dst_p, /**< destination buffer */\n                               lit_code_point_t code_point) /**< code point */\n{\n  if (code_point < LIT_UTF8_2_BYTE_CODE_POINT_MIN)\n  {\n    /* 00000000 0xxxxxxx -> 0xxxxxxx */\n    dst_p[0] = (uint8_t) code_point;\n    return 1;\n  }\n\n  if (code_point < LIT_UTF8_3_BYTE_CODE_POINT_MIN)\n  {\n    /* 00000yyy yyxxxxxx -> 110yyyyy 10xxxxxx */\n    dst_p[0] = (uint8_t) (LIT_UTF8_2_BYTE_MARKER | ((code_point >> 6) & LIT_UTF8_LAST_5_BITS_MASK));\n    dst_p[1] = (uint8_t) (LIT_UTF8_EXTRA_BYTE_MARKER | (code_point & LIT_UTF8_LAST_6_BITS_MASK));\n    return 2;\n  }\n\n  if (code_point < LIT_UTF8_4_BYTE_CODE_POINT_MIN)\n  {\n    /* zzzzyyyy yyxxxxxx -> 1110zzzz 10yyyyyy 10xxxxxx */\n    dst_p[0] = (uint8_t) (LIT_UTF8_3_BYTE_MARKER | ((code_point >> 12) & LIT_UTF8_LAST_4_BITS_MASK));\n    dst_p[1] = (uint8_t) (LIT_UTF8_EXTRA_BYTE_MARKER | ((code_point >> 6) & LIT_UTF8_LAST_6_BITS_MASK));\n    dst_p[2] = (uint8_t) (LIT_UTF8_EXTRA_BYTE_MARKER | (code_point & LIT_UTF8_LAST_6_BITS_MASK));\n    return 3;\n  }\n\n  JERRY_ASSERT (code_point <= LIT_UNICODE_CODE_POINT_MAX);\n\n  code_point -= LIT_UTF8_4_BYTE_CODE_POINT_MIN;\n\n  dst_p[0] = (uint8_t) (LIT_UTF8_3_BYTE_MARKER | 0xd);\n  dst_p[1] = (uint8_t) (LIT_UTF8_EXTRA_BYTE_MARKER | 0x20 | ((code_point >> 16) & LIT_UTF8_LAST_4_BITS_MASK));\n  dst_p[2] = (uint8_t) (LIT_UTF8_EXTRA_BYTE_MARKER | ((code_point >> 10) & LIT_UTF8_LAST_6_BITS_MASK));\n\n  dst_p[3] = (uint8_t) (LIT_UTF8_3_BYTE_MARKER | 0xd);\n  dst_p[4] = (uint8_t) (LIT_UTF8_EXTRA_BYTE_MARKER | 0x30 | ((code_point >> 6) & LIT_UTF8_LAST_4_BITS_MASK));\n  dst_p[5] = (uint8_t) (LIT_UTF8_EXTRA_BYTE_MARKER | (code_point & LIT_UTF8_LAST_6_BITS_MASK));\n\n  return 3 * 2;\n} /* lit_code_point_to_cesu8_bytes */\n\n/**\n * Returns the length of the UTF8 representation of a character.\n *\n * @return length of the UTF8 representation.\n */\nsize_t\nlit_code_point_get_cesu8_length (lit_code_point_t code_point) /**< code point */\n{\n  if (code_point < LIT_UTF8_2_BYTE_CODE_POINT_MIN)\n  {\n    /* 00000000 0xxxxxxx */\n    return 1;\n  }\n\n  if (code_point < LIT_UTF8_3_BYTE_CODE_POINT_MIN)\n  {\n    /* 00000yyy yyxxxxxx */\n    return 2;\n  }\n\n  if (code_point < LIT_UTF8_4_BYTE_CODE_POINT_MIN)\n  {\n    /* zzzzyyyy yyxxxxxx */\n    return 3;\n  }\n\n  /* high + low surrogate */\n  return 2 * 3;\n} /* lit_code_point_get_cesu8_length */\n\n/**\n * Convert a four byte long utf8 character to two three byte long cesu8 characters\n */\nvoid\nlit_four_byte_utf8_char_to_cesu8 (uint8_t *dst_p, /**< destination buffer */\n                                  const uint8_t *source_p) /**< source buffer */\n{\n  lit_code_point_t code_point = ((((uint32_t) source_p[0]) & LIT_UTF8_LAST_3_BITS_MASK) << 18);\n  code_point |= ((((uint32_t) source_p[1]) & LIT_UTF8_LAST_6_BITS_MASK) << 12);\n  code_point |= ((((uint32_t) source_p[2]) & LIT_UTF8_LAST_6_BITS_MASK) << 6);\n  code_point |= (((uint32_t) source_p[3]) & LIT_UTF8_LAST_6_BITS_MASK);\n\n  lit_code_point_to_cesu8_bytes (dst_p, code_point);\n} /* lit_four_byte_utf8_char_to_cesu8 */\n\n/**\n * Lookup hex digits in a buffer\n *\n * @return UINT32_MAX - if next 'lookup' number of characters do not form a valid hex number\n *         value of hex number, otherwise\n */\nuint32_t\nlit_char_hex_lookup (const lit_utf8_byte_t *buf_p, /**< buffer */\n                     const lit_utf8_byte_t *const buf_end_p, /**< buffer end */\n                     uint32_t lookup) /**< size of lookup */\n{\n  JERRY_ASSERT (lookup <= 4);\n\n  if (JERRY_UNLIKELY (buf_p + lookup > buf_end_p))\n  {\n    return UINT32_MAX;\n  }\n\n  uint32_t value = 0;\n\n  while (lookup--)\n  {\n    lit_utf8_byte_t ch = *buf_p++;\n    if (!lit_char_is_hex_digit (ch))\n    {\n      return UINT32_MAX;\n    }\n\n    value <<= 4;\n    value += lit_char_hex_to_int (ch);\n  }\n\n  JERRY_ASSERT (value <= LIT_UTF16_CODE_UNIT_MAX);\n  return value;\n} /* lit_char_hex_lookup */\n\n/**\n * Parse a decimal number with the value clamped to UINT32_MAX.\n *\n * @returns uint32_t number\n */\nuint32_t\nlit_parse_decimal (const lit_utf8_byte_t **buffer_p, /**< [in/out] character buffer */\n                   const lit_utf8_byte_t *buffer_end_p) /**< buffer end */\n{\n  const lit_utf8_byte_t *current_p = *buffer_p;\n  JERRY_ASSERT (lit_char_is_decimal_digit (*current_p));\n\n  uint32_t value = (uint32_t) (*current_p++ - LIT_CHAR_0);\n\n  while (current_p < buffer_end_p && lit_char_is_decimal_digit (*current_p))\n  {\n    const uint32_t digit = (uint32_t) (*current_p++ - LIT_CHAR_0);\n    uint32_t new_value = value * 10 + digit;\n\n    if (JERRY_UNLIKELY (value > UINT32_MAX / 10) || JERRY_UNLIKELY (new_value < value))\n    {\n      value = UINT32_MAX;\n      continue;\n    }\n\n    value = new_value;\n  }\n\n  *buffer_p = current_p;\n  return value;\n} /* lit_parse_decimal */\n\n/**\n * Check if specified character is a word character (part of IsWordChar abstract operation)\n *\n * See also: ECMA-262 v5, 15.10.2.6 (IsWordChar)\n *\n * @return true - if the character is a word character\n *         false - otherwise\n */\nbool\nlit_char_is_word_char (lit_code_point_t c) /**< code point */\n{\n  return ((c >= LIT_CHAR_ASCII_LOWERCASE_LETTERS_BEGIN && c <= LIT_CHAR_ASCII_LOWERCASE_LETTERS_END)\n          || (c >= LIT_CHAR_ASCII_UPPERCASE_LETTERS_BEGIN && c <= LIT_CHAR_ASCII_UPPERCASE_LETTERS_END)\n          || (c >= LIT_CHAR_ASCII_DIGITS_BEGIN && c <= LIT_CHAR_ASCII_DIGITS_END) || c == LIT_CHAR_UNDERSCORE);\n} /* lit_char_is_word_char */\n\n#if JERRY_UNICODE_CASE_CONVERSION\n\n/**\n * Check if the specified character is in one of those tables which contain bidirectional conversions.\n *\n * @return codepoint of the converted character if it is found the the tables\n *         LIT_INVALID_CP - otherwise.\n */\nstatic lit_code_point_t\nlit_search_in_bidirectional_conversion_tables (lit_code_point_t cp, /**< code point */\n                                               bool is_lowercase) /**< is lowercase conversion */\n{\n  /* 1, Check if the specified character is part of the lit_unicode_character_case_ranges_{sup} table. */\n  int number_of_case_ranges;\n  bool is_supplementary = cp > LIT_UTF16_CODE_UNIT_MAX;\n\n  if (is_supplementary)\n  {\n    number_of_case_ranges = NUM_OF_ELEMENTS (lit_unicode_character_case_ranges_sup);\n  }\n  else\n  {\n    number_of_case_ranges = NUM_OF_ELEMENTS (lit_unicode_character_case_ranges);\n  }\n\n  int conv_counter = 0;\n\n  for (int i = 0; i < number_of_case_ranges; i++)\n  {\n    if (i % 2 == 0 && i > 0)\n    {\n      conv_counter++;\n    }\n\n    size_t range_length;\n    lit_code_point_t start_point;\n\n    if (is_supplementary)\n    {\n      range_length = lit_unicode_character_case_range_lengths_sup[conv_counter];\n      start_point = lit_unicode_character_case_ranges_sup[i];\n    }\n    else\n    {\n      range_length = lit_unicode_character_case_range_lengths[conv_counter];\n      start_point = lit_unicode_character_case_ranges[i];\n    }\n\n    if (start_point > cp || cp >= start_point + range_length)\n    {\n      continue;\n    }\n\n    uint32_t char_dist = (uint32_t) cp - start_point;\n    int offset;\n    if (i % 2 == 0)\n    {\n      if (!is_lowercase)\n      {\n        return cp;\n      }\n\n      offset = i + 1;\n    }\n    else\n    {\n      if (is_lowercase)\n      {\n        return cp;\n      }\n\n      offset = i - 1;\n    }\n\n    if (is_supplementary)\n    {\n      start_point = lit_unicode_character_case_ranges_sup[offset];\n    }\n    else\n    {\n      start_point = lit_unicode_character_case_ranges[offset];\n    }\n\n    return (lit_code_point_t) (start_point + char_dist);\n  }\n\n  /* Note: After this point based on the latest unicode standard(13.0.0.6) no conversion characters are\n     defined for supplementary planes */\n  if (is_supplementary)\n  {\n    return cp;\n  }\n\n  /* 2, Check if the specified character is part of the character_pair_ranges table. */\n  int bottom = 0;\n  int top = NUM_OF_ELEMENTS (lit_unicode_character_pair_ranges) - 1;\n\n  while (bottom <= top)\n  {\n    int middle = (bottom + top) / 2;\n    lit_code_point_t current_sp = lit_unicode_character_pair_ranges[middle];\n\n    if (current_sp <= cp && cp < current_sp + lit_unicode_character_pair_range_lengths[middle])\n    {\n      uint32_t char_dist = (uint32_t) (cp - current_sp);\n\n      if ((cp - current_sp) % 2 == 0)\n      {\n        return is_lowercase ? (lit_code_point_t) (current_sp + char_dist + 1) : cp;\n      }\n\n      return is_lowercase ? cp : (lit_code_point_t) (current_sp + char_dist - 1);\n    }\n\n    if (cp > current_sp)\n    {\n      bottom = middle + 1;\n    }\n    else\n    {\n      top = middle - 1;\n    }\n  }\n\n  /* 3, Check if the specified character is part of the character_pairs table. */\n  int number_of_character_pairs = NUM_OF_ELEMENTS (lit_unicode_character_pairs);\n\n  for (int i = 0; i < number_of_character_pairs; i++)\n  {\n    if (cp != lit_unicode_character_pairs[i])\n    {\n      continue;\n    }\n\n    if (i % 2 == 0)\n    {\n      return is_lowercase ? lit_unicode_character_pairs[i + 1] : cp;\n    }\n\n    return is_lowercase ? cp : lit_unicode_character_pairs[i - 1];\n  }\n\n  return LIT_INVALID_CP;\n} /* lit_search_in_bidirectional_conversion_tables */\n\n/**\n * Check if the specified character is in the given conversion table.\n *\n * @return LIT_MULTIPLE_CU if the converted character consist more than a single code unit\n *         converted code point - otherwise\n */\nstatic lit_code_point_t\nlit_search_in_conversion_table (ecma_char_t character, /**< code unit */\n                                ecma_stringbuilder_t *builder_p, /**< string builder */\n                                const ecma_char_t *array, /**< array */\n                                const uint8_t *counters) /**< case_values counter */\n{\n  int end_point = 0;\n\n  for (int i = 0; i < 3; i++)\n  {\n    int start_point = end_point;\n    int size_of_case_value = i + 1;\n    end_point += counters[i] * (size_of_case_value + 1);\n\n    int bottom = start_point;\n    int top = end_point - size_of_case_value;\n\n    while (bottom <= top)\n    {\n      int middle = (bottom + top) / 2;\n\n      middle -= ((middle - bottom) % (size_of_case_value + 1));\n\n      ecma_char_t current = array[middle];\n\n      if (current == character)\n      {\n        if (builder_p != NULL)\n        {\n          ecma_stringbuilder_append_char (builder_p, array[middle + 1]);\n\n          if (size_of_case_value > 1)\n          {\n            ecma_stringbuilder_append_char (builder_p, array[middle + 2]);\n          }\n          if (size_of_case_value > 2)\n          {\n            ecma_stringbuilder_append_char (builder_p, array[middle + 3]);\n          }\n        }\n\n        return size_of_case_value == 1 ? array[middle + 1] : LIT_MULTIPLE_CU;\n      }\n\n      if (character < current)\n      {\n        top = middle - (size_of_case_value + 1);\n      }\n      else\n      {\n        bottom = middle + (size_of_case_value + 1);\n      }\n    }\n  }\n\n  if (builder_p != NULL)\n  {\n    ecma_stringbuilder_append_char (builder_p, character);\n  }\n\n  return (lit_code_point_t) character;\n} /* lit_search_in_conversion_table */\n#endif /* JERRY_UNICODE_CASE_CONVERSION */\n\n/**\n * Append the converted lowercase codeunit sequence of an a given codepoint into the stringbuilder if it is present.\n *\n * @return LIT_MULTIPLE_CU if the converted codepoint consist more than a single code unit\n *         converted code point - otherwise\n */\nlit_code_point_t\nlit_char_to_lower_case (lit_code_point_t cp, /**< code point */\n                        ecma_stringbuilder_t *builder_p) /**< string builder */\n{\n  if (cp <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)\n  {\n    if (cp >= LIT_CHAR_UPPERCASE_A && cp <= LIT_CHAR_UPPERCASE_Z)\n    {\n      cp = (lit_utf8_byte_t) (cp + (LIT_CHAR_LOWERCASE_A - LIT_CHAR_UPPERCASE_A));\n    }\n\n    if (builder_p != NULL)\n    {\n      ecma_stringbuilder_append_byte (builder_p, (lit_utf8_byte_t) cp);\n    }\n\n    return cp;\n  }\n\n#if JERRY_UNICODE_CASE_CONVERSION\n  lit_code_point_t lowercase_cp = lit_search_in_bidirectional_conversion_tables (cp, true);\n\n  if (lowercase_cp != LIT_INVALID_CP)\n  {\n    if (builder_p != NULL)\n    {\n      ecma_stringbuilder_append_codepoint (builder_p, lowercase_cp);\n    }\n\n    return lowercase_cp;\n  }\n\n  JERRY_ASSERT (cp < LIT_UTF8_4_BYTE_CODE_POINT_MIN);\n\n  int num_of_lowercase_ranges = NUM_OF_ELEMENTS (lit_unicode_lower_case_ranges);\n\n  for (int i = 0, j = 0; i < num_of_lowercase_ranges; i += 2, j++)\n  {\n    JERRY_ASSERT (lit_unicode_lower_case_range_lengths[j] > 0);\n    uint32_t range_length = (uint32_t) (lit_unicode_lower_case_range_lengths[j] - 1);\n    lit_code_point_t start_point = lit_unicode_lower_case_ranges[i];\n\n    if (start_point <= cp && cp <= start_point + range_length)\n    {\n      lowercase_cp = lit_unicode_lower_case_ranges[i + 1] + (cp - start_point);\n      if (builder_p != NULL)\n      {\n        ecma_stringbuilder_append_codepoint (builder_p, lowercase_cp);\n      }\n\n      return lowercase_cp;\n    }\n  }\n\n  return lit_search_in_conversion_table ((ecma_char_t) cp,\n                                         builder_p,\n                                         lit_unicode_lower_case_conversions,\n                                         lit_unicode_lower_case_conversion_counters);\n#else /* !JERRY_UNICODE_CASE_CONVERSION */\n  if (builder_p != NULL)\n  {\n    ecma_stringbuilder_append_codepoint (builder_p, cp);\n  }\n\n  return cp;\n#endif /* JERRY_UNICODE_CASE_CONVERSION */\n} /* lit_char_to_lower_case */\n\n/**\n * Append the converted uppercase codeunit sequence of an a given codepoint into the stringbuilder if it is present.\n *\n * @return LIT_MULTIPLE_CU if the converted codepoint consist more than a single code unit\n *         converted code point - otherwise\n */\nlit_code_point_t\nlit_char_to_upper_case (lit_code_point_t cp, /**< code point */\n                        ecma_stringbuilder_t *builder_p) /**< string builder */\n{\n  if (cp <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)\n  {\n    if (cp >= LIT_CHAR_LOWERCASE_A && cp <= LIT_CHAR_LOWERCASE_Z)\n    {\n      cp = (lit_utf8_byte_t) (cp - (LIT_CHAR_LOWERCASE_A - LIT_CHAR_UPPERCASE_A));\n    }\n\n    if (builder_p != NULL)\n    {\n      ecma_stringbuilder_append_byte (builder_p, (lit_utf8_byte_t) cp);\n    }\n\n    return cp;\n  }\n\n#if JERRY_UNICODE_CASE_CONVERSION\n  lit_code_point_t uppercase_cp = lit_search_in_bidirectional_conversion_tables (cp, false);\n\n  if (uppercase_cp != LIT_INVALID_CP)\n  {\n    if (builder_p != NULL)\n    {\n      ecma_stringbuilder_append_codepoint (builder_p, uppercase_cp);\n    }\n\n    return uppercase_cp;\n  }\n\n  int num_of_upper_case_special_ranges = NUM_OF_ELEMENTS (lit_unicode_upper_case_special_ranges);\n\n  for (int i = 0, j = 0; i < num_of_upper_case_special_ranges; i += 3, j++)\n  {\n    uint32_t range_length = lit_unicode_upper_case_special_range_lengths[j];\n    ecma_char_t start_point = lit_unicode_upper_case_special_ranges[i];\n\n    if (start_point <= cp && cp <= start_point + range_length)\n    {\n      if (builder_p != NULL)\n      {\n        uppercase_cp = lit_unicode_upper_case_special_ranges[i + 1] + (cp - start_point);\n        ecma_stringbuilder_append_codepoint (builder_p, uppercase_cp);\n        ecma_stringbuilder_append_codepoint (builder_p, lit_unicode_upper_case_special_ranges[i + 2]);\n      }\n\n      return LIT_MULTIPLE_CU;\n    }\n  }\n\n  return lit_search_in_conversion_table ((ecma_char_t) cp,\n                                         builder_p,\n                                         lit_unicode_upper_case_conversions,\n                                         lit_unicode_upper_case_conversion_counters);\n#else /* !JERRY_UNICODE_CASE_CONVERSION */\n  if (builder_p != NULL)\n  {\n    ecma_stringbuilder_append_codepoint (builder_p, cp);\n  }\n\n  return cp;\n#endif /* JERRY_UNICODE_CASE_CONVERSION */\n} /* lit_char_to_upper_case */\n\n/*\n * Look up whether the character should be folded to the lowercase variant.\n *\n * @return true, if character should be lowercased\n *         false, otherwise\n */\nbool\nlit_char_fold_to_lower (lit_code_point_t cp) /**< code point */\n{\n#if JERRY_UNICODE_CASE_CONVERSION\n  return (cp <= LIT_UTF8_1_BYTE_CODE_POINT_MAX || cp > LIT_UTF16_CODE_UNIT_MAX\n          || (!lit_search_char_in_interval_array ((ecma_char_t) cp,\n                                                  lit_unicode_folding_skip_to_lower_interval_starts,\n                                                  lit_unicode_folding_skip_to_lower_interval_lengths,\n                                                  NUM_OF_ELEMENTS (lit_unicode_folding_skip_to_lower_interval_starts))\n              && !lit_search_char_in_array ((ecma_char_t) cp,\n                                            lit_unicode_folding_skip_to_lower_chars,\n                                            NUM_OF_ELEMENTS (lit_unicode_folding_skip_to_lower_chars))));\n#else /* !JERRY_UNICODE_CASE_CONVERSION */\n  return true;\n#endif /* JERRY_UNICODE_CASE_CONVERSION */\n} /* lit_char_fold_to_lower */\n\n/*\n * Look up whether the character should be folded to the uppercase variant.\n *\n * @return true, if character should be uppercased\n *         false, otherwise\n */\nbool\nlit_char_fold_to_upper (lit_code_point_t cp) /**< code point */\n{\n#if JERRY_UNICODE_CASE_CONVERSION\n  return (cp > LIT_UTF8_1_BYTE_CODE_POINT_MAX && cp <= LIT_UTF16_CODE_UNIT_MAX\n          && (lit_search_char_in_interval_array ((ecma_char_t) cp,\n                                                 lit_unicode_folding_to_upper_interval_starts,\n                                                 lit_unicode_folding_to_upper_interval_lengths,\n                                                 NUM_OF_ELEMENTS (lit_unicode_folding_to_upper_interval_starts))\n              || lit_search_char_in_array ((ecma_char_t) cp,\n                                           lit_unicode_folding_to_upper_chars,\n                                           NUM_OF_ELEMENTS (lit_unicode_folding_to_upper_chars))));\n#else /* !JERRY_UNICODE_CASE_CONVERSION */\n  return false;\n#endif /* JERRY_UNICODE_CASE_CONVERSION */\n} /* lit_char_fold_to_upper */\n\n/**\n * Helper method to find a specific character in a string\n *\n * Used by:\n *         ecma_builtin_string_prototype_object_replace_helper\n *\n * @return true - if the given character is in the string\n *         false - otherwise\n */\nbool\nlit_find_char_in_string (ecma_string_t *str_p, /**< source string */\n                         lit_utf8_byte_t c) /**< character to find*/\n{\n  ECMA_STRING_TO_UTF8_STRING (str_p, start_p, start_size);\n\n  const lit_utf8_byte_t *str_curr_p = start_p;\n  const lit_utf8_byte_t *str_end_p = start_p + start_size;\n  bool have_char = false;\n\n  while (str_curr_p < str_end_p)\n  {\n    if (*str_curr_p++ == c)\n    {\n      have_char = true;\n      break;\n    }\n  }\n\n  ECMA_FINALIZE_UTF8_STRING (start_p, start_size);\n\n  return have_char;\n} /* lit_find_char_in_string */\n"
  },
  {
    "path": "jerry-core/lit/lit-char-helpers.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef LIT_CHAR_HELPERS_H\n#define LIT_CHAR_HELPERS_H\n\n#include \"ecma-globals.h\"\n\n#include \"lit-globals.h\"\n\n/**\n * Invalid character code point\n */\n#define LIT_INVALID_CP 0xFFFFFFFF\n\n/**\n * Result of lit_char_to_lower_case/lit_char_to_upper_case consist more than of a single code unit\n */\n#define LIT_MULTIPLE_CU 0xFFFFFFFE\n\n/*\n * Format control characters (ECMA-262 v5, Table 1)\n */\n#define LIT_CHAR_ZWNJ ((ecma_char_t) 0x200C) /* zero width non-joiner */\n#define LIT_CHAR_ZWJ  ((ecma_char_t) 0x200D) /* zero width joiner */\n#define LIT_CHAR_BOM  ((ecma_char_t) 0xFEFF) /* byte order mark */\n\n/*\n * Whitespace characters (ECMA-262 v5, Table 2)\n */\n#define LIT_CHAR_TAB  ((ecma_char_t) 0x0009) /* tab */\n#define LIT_CHAR_VTAB ((ecma_char_t) 0x000B) /* vertical tab */\n#define LIT_CHAR_FF   ((ecma_char_t) 0x000C) /* form feed */\n#define LIT_CHAR_SP   ((ecma_char_t) 0x0020) /* space */\n#define LIT_CHAR_NBSP ((ecma_char_t) 0x00A0) /* no-break space */\n#define LIT_CHAR_MVS  ((ecma_char_t) 0x180E) /* mongolian vowel separator */\n/* LIT_CHAR_BOM is defined above */\n\nbool lit_char_is_white_space (lit_code_point_t c);\n\n/*\n * Line terminator characters (ECMA-262 v5, Table 3)\n */\n#define LIT_CHAR_LF ((ecma_char_t) 0x000A) /* line feed */\n#define LIT_CHAR_CR ((ecma_char_t) 0x000D) /* carriage return */\n#define LIT_CHAR_LS ((ecma_char_t) 0x2028) /* line separator */\n#define LIT_CHAR_PS ((ecma_char_t) 0x2029) /* paragraph separator */\n\nbool lit_char_is_line_terminator (ecma_char_t c);\n\n/*\n * String Single Character Escape Sequences (ECMA-262 v5, Table 4)\n */\n#define LIT_CHAR_BS ((ecma_char_t) 0x0008) /* backspace */\n/* LIT_CHAR_TAB is defined above */\n/* LIT_CHAR_LF is defined above */\n/* LIT_CHAR_VTAB is defined above */\n/* LIT_CHAR_FF is defined above */\n/* LIT_CHAR_CR is defined above */\n#define LIT_CHAR_DOUBLE_QUOTE ((ecma_char_t) '\"') /* double quote */\n#define LIT_CHAR_SINGLE_QUOTE ((ecma_char_t) '\\'') /* single quote */\n#define LIT_CHAR_BACKSLASH    ((ecma_char_t) '\\\\') /* reverse solidus (backslash) */\n\n/*\n * Comment characters (ECMA-262 v5, 7.4)\n */\n#define LIT_CHAR_SLASH    ((ecma_char_t) '/') /* solidus */\n#define LIT_CHAR_ASTERISK ((ecma_char_t) '*') /* asterisk */\n\n/*\n * Identifier name characters (ECMA-262 v5, 7.6)\n */\n#define LIT_CHAR_DOLLAR_SIGN ((ecma_char_t) '$') /* dollar sign */\n#define LIT_CHAR_UNDERSCORE  ((ecma_char_t) '_') /* low line (underscore) */\n/* LIT_CHAR_BACKSLASH defined above */\n\nbool lit_code_point_is_identifier_start (lit_code_point_t code_point);\nbool lit_code_point_is_identifier_part (lit_code_point_t code_point);\n\n/*\n * Punctuator characters (ECMA-262 v5, 7.7)\n */\n#define LIT_CHAR_LEFT_BRACE   ((ecma_char_t) '{') /* left curly bracket */\n#define LIT_CHAR_RIGHT_BRACE  ((ecma_char_t) '}') /* right curly bracket */\n#define LIT_CHAR_LEFT_PAREN   ((ecma_char_t) '(') /* left parenthesis */\n#define LIT_CHAR_RIGHT_PAREN  ((ecma_char_t) ')') /* right parenthesis */\n#define LIT_CHAR_LEFT_SQUARE  ((ecma_char_t) '[') /* left square bracket */\n#define LIT_CHAR_RIGHT_SQUARE ((ecma_char_t) ']') /* right square bracket */\n#define LIT_CHAR_DOT          ((ecma_char_t) '.') /* dot */\n#define LIT_CHAR_SEMICOLON    ((ecma_char_t) ';') /* semicolon */\n#define LIT_CHAR_COMMA        ((ecma_char_t) ',') /* comma */\n#define LIT_CHAR_LESS_THAN    ((ecma_char_t) '<') /* less-than sign */\n#define LIT_CHAR_GREATER_THAN ((ecma_char_t) '>') /* greater-than sign */\n#define LIT_CHAR_EQUALS       ((ecma_char_t) '=') /* equals sign */\n#define LIT_CHAR_PLUS         ((ecma_char_t) '+') /* plus sign */\n#define LIT_CHAR_MINUS        ((ecma_char_t) '-') /* hyphen-minus */\n/* LIT_CHAR_ASTERISK is defined above */\n#define LIT_CHAR_PERCENT     ((ecma_char_t) '%') /* percent sign */\n#define LIT_CHAR_AMPERSAND   ((ecma_char_t) '&') /* ampersand */\n#define LIT_CHAR_VLINE       ((ecma_char_t) '|') /* vertical line */\n#define LIT_CHAR_CIRCUMFLEX  ((ecma_char_t) '^') /* circumflex accent */\n#define LIT_CHAR_EXCLAMATION ((ecma_char_t) '!') /* exclamation mark */\n#define LIT_CHAR_TILDE       ((ecma_char_t) '~') /* tilde */\n#define LIT_CHAR_QUESTION    ((ecma_char_t) '?') /* question mark */\n#define LIT_CHAR_COLON       ((ecma_char_t) ':') /* colon */\n#define LIT_CHAR_HASHMARK    ((ecma_char_t) '#') /* hashmark */\n\n/*\n * Special characters for String.prototype.replace.\n */\n#define LIT_CHAR_GRAVE_ACCENT ((ecma_char_t) '`') /* grave accent */\n\n/**\n * Uppercase ASCII letters\n */\n#define LIT_CHAR_UPPERCASE_A ((ecma_char_t) 'A')\n#define LIT_CHAR_UPPERCASE_B ((ecma_char_t) 'B')\n#define LIT_CHAR_UPPERCASE_C ((ecma_char_t) 'C')\n#define LIT_CHAR_UPPERCASE_D ((ecma_char_t) 'D')\n#define LIT_CHAR_UPPERCASE_E ((ecma_char_t) 'E')\n#define LIT_CHAR_UPPERCASE_F ((ecma_char_t) 'F')\n#define LIT_CHAR_UPPERCASE_G ((ecma_char_t) 'G')\n#define LIT_CHAR_UPPERCASE_H ((ecma_char_t) 'H')\n#define LIT_CHAR_UPPERCASE_I ((ecma_char_t) 'I')\n#define LIT_CHAR_UPPERCASE_J ((ecma_char_t) 'J')\n#define LIT_CHAR_UPPERCASE_K ((ecma_char_t) 'K')\n#define LIT_CHAR_UPPERCASE_L ((ecma_char_t) 'L')\n#define LIT_CHAR_UPPERCASE_M ((ecma_char_t) 'M')\n#define LIT_CHAR_UPPERCASE_N ((ecma_char_t) 'N')\n#define LIT_CHAR_UPPERCASE_O ((ecma_char_t) 'O')\n#define LIT_CHAR_UPPERCASE_P ((ecma_char_t) 'P')\n#define LIT_CHAR_UPPERCASE_Q ((ecma_char_t) 'Q')\n#define LIT_CHAR_UPPERCASE_R ((ecma_char_t) 'R')\n#define LIT_CHAR_UPPERCASE_S ((ecma_char_t) 'S')\n#define LIT_CHAR_UPPERCASE_T ((ecma_char_t) 'T')\n#define LIT_CHAR_UPPERCASE_U ((ecma_char_t) 'U')\n#define LIT_CHAR_UPPERCASE_V ((ecma_char_t) 'V')\n#define LIT_CHAR_UPPERCASE_W ((ecma_char_t) 'W')\n#define LIT_CHAR_UPPERCASE_X ((ecma_char_t) 'X')\n#define LIT_CHAR_UPPERCASE_Y ((ecma_char_t) 'Y')\n#define LIT_CHAR_UPPERCASE_Z ((ecma_char_t) 'Z')\n\n/**\n * Lowercase ASCII letters\n */\n#define LIT_CHAR_LOWERCASE_A ((ecma_char_t) 'a')\n#define LIT_CHAR_LOWERCASE_B ((ecma_char_t) 'b')\n#define LIT_CHAR_LOWERCASE_C ((ecma_char_t) 'c')\n#define LIT_CHAR_LOWERCASE_D ((ecma_char_t) 'd')\n#define LIT_CHAR_LOWERCASE_E ((ecma_char_t) 'e')\n#define LIT_CHAR_LOWERCASE_F ((ecma_char_t) 'f')\n#define LIT_CHAR_LOWERCASE_G ((ecma_char_t) 'g')\n#define LIT_CHAR_LOWERCASE_H ((ecma_char_t) 'h')\n#define LIT_CHAR_LOWERCASE_I ((ecma_char_t) 'i')\n#define LIT_CHAR_LOWERCASE_J ((ecma_char_t) 'j')\n#define LIT_CHAR_LOWERCASE_K ((ecma_char_t) 'k')\n#define LIT_CHAR_LOWERCASE_L ((ecma_char_t) 'l')\n#define LIT_CHAR_LOWERCASE_M ((ecma_char_t) 'm')\n#define LIT_CHAR_LOWERCASE_N ((ecma_char_t) 'n')\n#define LIT_CHAR_LOWERCASE_O ((ecma_char_t) 'o')\n#define LIT_CHAR_LOWERCASE_P ((ecma_char_t) 'p')\n#define LIT_CHAR_LOWERCASE_Q ((ecma_char_t) 'q')\n#define LIT_CHAR_LOWERCASE_R ((ecma_char_t) 'r')\n#define LIT_CHAR_LOWERCASE_S ((ecma_char_t) 's')\n#define LIT_CHAR_LOWERCASE_T ((ecma_char_t) 't')\n#define LIT_CHAR_LOWERCASE_U ((ecma_char_t) 'u')\n#define LIT_CHAR_LOWERCASE_V ((ecma_char_t) 'v')\n#define LIT_CHAR_LOWERCASE_W ((ecma_char_t) 'w')\n#define LIT_CHAR_LOWERCASE_X ((ecma_char_t) 'x')\n#define LIT_CHAR_LOWERCASE_Y ((ecma_char_t) 'y')\n#define LIT_CHAR_LOWERCASE_Z ((ecma_char_t) 'z')\n\n/**\n * ASCII decimal digits\n */\n#define LIT_CHAR_0 ((ecma_char_t) '0')\n#define LIT_CHAR_1 ((ecma_char_t) '1')\n#define LIT_CHAR_2 ((ecma_char_t) '2')\n#define LIT_CHAR_3 ((ecma_char_t) '3')\n#define LIT_CHAR_4 ((ecma_char_t) '4')\n#define LIT_CHAR_5 ((ecma_char_t) '5')\n#define LIT_CHAR_6 ((ecma_char_t) '6')\n#define LIT_CHAR_7 ((ecma_char_t) '7')\n#define LIT_CHAR_8 ((ecma_char_t) '8')\n#define LIT_CHAR_9 ((ecma_char_t) '9')\n\n/**\n * ASCII character ranges\n */\n#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_BEGIN LIT_CHAR_UPPERCASE_A /* uppercase letters range */\n#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_END   LIT_CHAR_UPPERCASE_Z\n\n#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_BEGIN LIT_CHAR_LOWERCASE_A /* lowercase letters range */\n#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_END   LIT_CHAR_LOWERCASE_Z\n\n#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_HEX_BEGIN \\\n  LIT_CHAR_UPPERCASE_A /* uppercase letters for    \\\n                        * hexadecimal digits range */\n#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_HEX_END LIT_CHAR_UPPERCASE_F\n\n#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_BEGIN \\\n  LIT_CHAR_LOWERCASE_A /* lowercase letters for    \\\n                        * hexadecimal digits range */\n#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_END LIT_CHAR_LOWERCASE_F\n\n#define LIT_CHAR_ASCII_OCTAL_DIGITS_BEGIN LIT_CHAR_0 /* octal digits range */\n#define LIT_CHAR_ASCII_OCTAL_DIGITS_END   LIT_CHAR_7\n\n#define LIT_CHAR_ASCII_DIGITS_BEGIN LIT_CHAR_0 /* decimal digits range */\n#define LIT_CHAR_ASCII_DIGITS_END   LIT_CHAR_9\n\n#define LEXER_TO_ASCII_LOWERCASE(character) ((character) | LIT_CHAR_SP)\n\nbool lit_char_is_octal_digit (ecma_char_t c);\nbool lit_char_is_decimal_digit (ecma_char_t c);\nbool lit_char_is_hex_digit (ecma_char_t c);\nbool lit_char_is_binary_digit (ecma_char_t c);\nuint8_t lit_char_to_radix (lit_utf8_byte_t c);\nvoid lit_char_unicode_escape (ecma_stringbuilder_t *builder_p, ecma_char_t c);\nuint32_t lit_char_hex_to_int (ecma_char_t c);\nsize_t lit_code_point_to_cesu8_bytes (uint8_t *dst_p, lit_code_point_t code_point);\nsize_t lit_code_point_get_cesu8_length (lit_code_point_t code_point);\nvoid lit_four_byte_utf8_char_to_cesu8 (uint8_t *dst_p, const uint8_t *source_p);\nuint32_t lit_char_hex_lookup (const lit_utf8_byte_t *buf_p, const lit_utf8_byte_t *const buf_end_p, uint32_t lookup);\nuint32_t lit_parse_decimal (const lit_utf8_byte_t **buffer_p, const lit_utf8_byte_t *const buffer_end_p);\nbool lit_find_char_in_string (ecma_string_t *str_p, lit_utf8_byte_t c);\n\n/**\n * Null character\n */\n#define LIT_CHAR_NULL ((ecma_char_t) '\\0')\n\n/*\n * Part of IsWordChar abstract operation (ECMA-262 v5, 15.10.2.6, step 3)\n */\nbool lit_char_is_word_char (lit_code_point_t c);\n\n/*\n * Utility functions for uppercasing / lowercasing\n */\n\nlit_code_point_t lit_char_to_lower_case (lit_code_point_t cp, ecma_stringbuilder_t *builder_p);\nlit_code_point_t lit_char_to_upper_case (lit_code_point_t cp, ecma_stringbuilder_t *builder_p);\n\nbool lit_char_fold_to_lower (lit_code_point_t cp);\nbool lit_char_fold_to_upper (lit_code_point_t cp);\n\n#endif /* !LIT_CHAR_HELPERS_H */\n"
  },
  {
    "path": "jerry-core/lit/lit-globals.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef LIT_GLOBALS_H\n#define LIT_GLOBALS_H\n\n#include \"jrt.h\"\n\n/**\n * ECMAScript standard defines terms \"code unit\" and \"character\" as 16-bit unsigned value\n * used to represent 16-bit unit of text, this is the same as code unit in UTF-16 (See ECMA-262 5.1 Chapter 6).\n *\n * The term \"code point\" or \"Unicode character\" is used to refer a single Unicode scalar value (may be longer\n * than 16 bits: 0x0 - 0x10FFFFF). One code point could be represented with one ore two 16-bit code units.\n *\n * According to the standard all strings and source text are assumed to be a sequence of code units.\n * Length of a string equals to number of code units in the string, which is not the same as number of Unicode\n * characters in a string.\n *\n * Internally JerryScript engine uses UTF-8 representation of strings to reduce memory overhead. Unicode character\n * occupies from one to four bytes in UTF-8 representation.\n *\n * Unicode scalar value   | Bytes in UTF-8             | Bytes in UTF-16\n *                        | (internal representation)  |\n * ----------------------------------------------------------------------\n *  0x0     - 0x7F        |  1 byte                    |  2 bytes\n *  0x80    - 0x7FF       |  2 bytes                   |  2 bytes\n *  0x800   - 0xFFFF      |  3 bytes                   |  2 bytes\n *  0x10000 - 0x10FFFF    |  4 bytes                   |  4 bytes\n *\n * Scalar values from 0xD800 to 0xDFFF are permanently reserved by Unicode standard to encode high and low\n * surrogates in UTF-16 (Code points 0x10000 - 0x10FFFF are encoded via pair of surrogates in UTF-16).\n * Despite that the official Unicode standard says that no UTF forms can encode these code points, we allow\n * them to be encoded inside strings. The reason for that is compatibility with ECMA standard.\n *\n * For example, assume a string which consists one Unicode character: 0x1D700 (Mathematical Italic Small Epsilon).\n * It has the following representation in UTF-16: 0xD835 0xDF00.\n *\n * ECMA standard allows extracting a substring from this string:\n * > var str = String.fromCharCode (0xD835, 0xDF00); // Create a string containing one character: 0x1D700\n * > str.length; // 2\n * > var str1 = str.substring (0, 1);\n * > str1.length; // 1\n * > str1.charCodeAt (0); // 55349 (this equals to 0xD835)\n *\n * Internally original string would be represented in UTF-8 as the following byte sequence: 0xF0 0x9D 0x9C 0x80.\n * After substring extraction high surrogate 0xD835 should be encoded via UTF-8: 0xED 0xA0 0xB5.\n *\n * Pair of low and high surrogates encoded separately should never occur in internal string representation,\n * it should be encoded as any code point and occupy 4 bytes. So, when constructing a string from two surrogates,\n * it should be processed gracefully;\n * > var str1 = String.fromCharCode (0xD835); // 0xED 0xA0 0xB5 - internal representation\n * > var str2 = String.fromCharCode (0xDF00); // 0xED 0xBC 0x80 - internal representation\n * > var str = str1 + str2; // 0xF0 0x9D 0x9C 0x80 - internal representation,\n *                          // !!! not 0xED 0xA0 0xB5 0xED 0xBC 0x80\n */\n\n/**\n * Description of an ecma-character, which represents 16-bit code unit,\n * which is equal to UTF-16 character (see Chapter 6 from ECMA-262 5.1)\n */\ntypedef uint16_t ecma_char_t;\n\n/**\n * Max bytes needed to represent a code unit (utf-16 char) via utf-8 encoding\n */\n#define LIT_UTF8_MAX_BYTES_IN_CODE_UNIT (3)\n\n/**\n * Max bytes needed to represent a code point (Unicode character) via utf-8 encoding\n */\n#define LIT_UTF8_MAX_BYTES_IN_CODE_POINT (4)\n\n/**\n * Max bytes needed to represent a code unit (utf-16 char) via cesu-8 encoding\n */\n#define LIT_CESU8_MAX_BYTES_IN_CODE_UNIT (3)\n\n/**\n * Max bytes needed to represent a code point (Unicode character) via cesu-8 encoding\n */\n#define LIT_CESU8_MAX_BYTES_IN_CODE_POINT (6)\n\n/**\n * A byte of utf-8 string\n */\ntypedef uint8_t lit_utf8_byte_t;\n\n/**\n * Size of a utf-8 string in bytes\n */\ntypedef uint32_t lit_utf8_size_t;\n\n/**\n * Size of a magic string in bytes\n */\ntypedef uint8_t lit_magic_size_t;\n\n/**\n * Unicode code point\n */\ntypedef uint32_t lit_code_point_t;\n\n/**\n * ECMA string hash\n */\ntypedef uint32_t lit_string_hash_t;\n\n#endif /* !LIT_GLOBALS_H */\n"
  },
  {
    "path": "jerry-core/lit/lit-magic-strings.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"lit-magic-strings.h\"\n\n#include \"jcontext.h\"\n#include \"lit-strings.h\"\n\n/**\n * Maximum number of external magic strings that can be registered.\n */\n#define LIT_EXTERNAL_MAGIC_STRING_LIMIT (UINT32_MAX / 2)\n\n/**\n * Get number of external magic strings\n *\n * @return number of the strings, if there were registered,\n *         zero - otherwise.\n */\nextern inline uint32_t JERRY_ATTR_ALWAYS_INLINE\nlit_get_magic_string_ex_count (void)\n{\n  return JERRY_CONTEXT (lit_magic_string_ex_count);\n} /* lit_get_magic_string_ex_count */\n\n/**\n * Get specified magic string as zero-terminated string\n *\n * @return pointer to zero-terminated magic string\n */\nconst lit_utf8_byte_t *\nlit_get_magic_string_utf8 (uint32_t id) /**< magic string id */\n{\n  static const lit_utf8_byte_t *const lit_magic_strings[] JERRY_ATTR_CONST_DATA = {\n/** @cond doxygen_suppress */\n#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id)\n#define LIT_MAGIC_STRING_DEF(id, utf8_string) (const lit_utf8_byte_t *) utf8_string,\n#include \"lit-magic-strings.inc.h\"\n#undef LIT_MAGIC_STRING_DEF\n#undef LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE\n    /** @endcond */\n  };\n\n  JERRY_ASSERT (id < LIT_NON_INTERNAL_MAGIC_STRING__COUNT);\n\n  return lit_magic_strings[id];\n} /* lit_get_magic_string_utf8 */\n\n/**\n * Get size of specified magic string\n *\n * @return size in bytes\n */\nlit_utf8_size_t\nlit_get_magic_string_size (uint32_t id) /**< magic string id */\n{\n  static const lit_magic_size_t lit_magic_string_sizes[] JERRY_ATTR_CONST_DATA = {\n/** @cond doxygen_suppress */\n#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id)\n#define LIT_MAGIC_STRING_DEF(id, utf8_string) sizeof (utf8_string) - 1,\n#include \"lit-magic-strings.inc.h\"\n#undef LIT_MAGIC_STRING_DEF\n#undef LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE\n    /** @endcond */\n  };\n\n  JERRY_ASSERT (id < LIT_NON_INTERNAL_MAGIC_STRING__COUNT);\n\n  return lit_magic_string_sizes[id];\n} /* lit_get_magic_string_size */\n\n/**\n * Get the block start element with the given size from\n * the list of ECMA and implementation-defined magic string constants\n *\n * @return magic string id\n */\nstatic lit_magic_string_id_t\nlit_get_magic_string_size_block_start (lit_utf8_size_t size) /**< magic string size */\n{\n  static const lit_magic_string_id_t lit_magic_string_size_block_starts[] JERRY_ATTR_CONST_DATA = {\n/** @cond doxygen_suppress */\n#define LIT_MAGIC_STRING_DEF(id, utf8_string)\n#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id) id,\n#include \"lit-magic-strings.inc.h\"\n    LIT_NON_INTERNAL_MAGIC_STRING__COUNT\n#undef LIT_MAGIC_STRING_DEF\n#undef LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE\n    /** @endcond */\n  };\n\n  JERRY_ASSERT (size <= (sizeof (lit_magic_string_size_block_starts) / sizeof (lit_magic_string_id_t)));\n\n  return lit_magic_string_size_block_starts[size];\n} /* lit_get_magic_string_size_block_start */\n\n/**\n * Get specified magic string as zero-terminated string from external table\n *\n * @return pointer to zero-terminated magic string\n */\nconst lit_utf8_byte_t *\nlit_get_magic_string_ex_utf8 (uint32_t id) /**< extern magic string id */\n{\n  JERRY_ASSERT (JERRY_CONTEXT (lit_magic_string_ex_array) && id < JERRY_CONTEXT (lit_magic_string_ex_count));\n\n  return JERRY_CONTEXT (lit_magic_string_ex_array)[id];\n} /* lit_get_magic_string_ex_utf8 */\n\n/**\n * Get size of specified external magic string\n *\n * @return size in bytes\n */\nlit_utf8_size_t\nlit_get_magic_string_ex_size (uint32_t id) /**< external magic string id */\n{\n  return JERRY_CONTEXT (lit_magic_string_ex_sizes)[id];\n} /* lit_get_magic_string_ex_size */\n\n/**\n * Register external magic strings\n */\nvoid\nlit_magic_strings_ex_set (const lit_utf8_byte_t *const *ex_str_items, /**< character arrays, representing\n                                                                       *   external magic strings' contents */\n                          uint32_t count, /**< number of the strings */\n                          const lit_utf8_size_t *ex_str_sizes) /**< sizes of the strings */\n{\n  JERRY_ASSERT (ex_str_items != NULL);\n  JERRY_ASSERT (count > 0);\n  JERRY_ASSERT (ex_str_sizes != NULL);\n\n  JERRY_ASSERT (JERRY_CONTEXT (lit_magic_string_ex_array) == NULL);\n  JERRY_ASSERT (JERRY_CONTEXT (lit_magic_string_ex_count) == 0);\n  JERRY_ASSERT (JERRY_CONTEXT (lit_magic_string_ex_sizes) == NULL);\n\n  /* Limit the number of external magic strings */\n  if (count > LIT_EXTERNAL_MAGIC_STRING_LIMIT)\n  {\n    count = LIT_EXTERNAL_MAGIC_STRING_LIMIT;\n  }\n\n  /* Set external magic strings information */\n  JERRY_CONTEXT (lit_magic_string_ex_array) = ex_str_items;\n  JERRY_CONTEXT (lit_magic_string_ex_count) = count;\n  JERRY_CONTEXT (lit_magic_string_ex_sizes) = ex_str_sizes;\n\n#ifndef JERRY_NDEBUG\n  for (lit_magic_string_ex_id_t id = (lit_magic_string_ex_id_t) 0; id < JERRY_CONTEXT (lit_magic_string_ex_count);\n       id = (lit_magic_string_ex_id_t) (id + 1))\n  {\n    lit_utf8_size_t string_size = JERRY_CONTEXT (lit_magic_string_ex_sizes)[id];\n\n    /**\n     * Check whether the strings are sorted by size and lexicographically,\n     * e.g., \"Bb\" < \"aa\" < \"aaa\" < \"xyz0\".\n     */\n    if (id > 0)\n    {\n      const lit_magic_string_ex_id_t prev_id = id - 1;\n      const lit_utf8_size_t prev_string_size = lit_get_magic_string_ex_size (prev_id);\n      JERRY_ASSERT (lit_is_valid_cesu8_string (lit_get_magic_string_ex_utf8 (id), string_size));\n      JERRY_ASSERT (prev_string_size <= string_size);\n\n      if (prev_string_size == string_size)\n      {\n        const lit_utf8_byte_t *prev_ex_string_p = lit_get_magic_string_ex_utf8 (prev_id);\n        const lit_utf8_byte_t *curr_ex_string_p = lit_get_magic_string_ex_utf8 (id);\n        JERRY_ASSERT (memcmp (prev_ex_string_p, curr_ex_string_p, string_size) < 0);\n      }\n    }\n  }\n#endif /* !JERRY_NDEBUG */\n} /* lit_magic_strings_ex_set */\n\n/**\n * Returns the magic string id of the argument string if it is available.\n *\n * @return id - if magic string id is found,\n *         LIT_MAGIC_STRING__COUNT - otherwise.\n */\nlit_magic_string_id_t\nlit_is_utf8_string_magic (const lit_utf8_byte_t *string_p, /**< utf-8 string */\n                          lit_utf8_size_t string_size) /**< string size in bytes */\n{\n  if (string_size > lit_get_magic_string_size (LIT_NON_INTERNAL_MAGIC_STRING__COUNT - 1))\n  {\n    return LIT_MAGIC_STRING__COUNT;\n  }\n\n  /**< The string must be in this id range. */\n  lit_utf8_size_t first = lit_get_magic_string_size_block_start (string_size);\n  lit_utf8_size_t last = lit_get_magic_string_size_block_start (string_size + 1);\n\n  while (first < last)\n  {\n    lit_utf8_size_t middle = ((first + last) / 2); /**< mid point of search */\n    int compare = memcmp (lit_get_magic_string_utf8 ((lit_magic_string_id_t) middle), string_p, string_size);\n\n    if (compare == 0)\n    {\n      return (lit_magic_string_id_t) middle;\n    }\n    else if (compare > 0)\n    {\n      last = middle;\n    }\n    else\n    {\n      first = middle + 1;\n    }\n  }\n\n  return LIT_MAGIC_STRING__COUNT;\n} /* lit_is_utf8_string_magic */\n\n/**\n * Returns the magic string id of the argument string pair if it is available.\n *\n * @return id - if magic string id is found,\n *         LIT_MAGIC_STRING__COUNT - otherwise.\n */\nlit_magic_string_id_t\nlit_is_utf8_string_pair_magic (const lit_utf8_byte_t *string1_p, /**< first utf-8 string */\n                               lit_utf8_size_t string1_size, /**< first string size in bytes */\n                               const lit_utf8_byte_t *string2_p, /**< second utf-8 string */\n                               lit_utf8_size_t string2_size) /**< second string size in bytes */\n{\n  lit_utf8_size_t total_string_size = string1_size + string2_size;\n\n  if (total_string_size > lit_get_magic_string_size (LIT_NON_INTERNAL_MAGIC_STRING__COUNT - 1))\n  {\n    return LIT_MAGIC_STRING__COUNT;\n  }\n\n  /**< The string must be in this id range. */\n  lit_utf8_size_t first = lit_get_magic_string_size_block_start (total_string_size);\n  lit_utf8_size_t last = lit_get_magic_string_size_block_start (total_string_size + 1);\n\n  while (first < last)\n  {\n    lit_utf8_size_t middle = ((first + last) / 2); /**< mid point of search */\n    const lit_utf8_byte_t *middle_string_p = lit_get_magic_string_utf8 ((lit_magic_string_id_t) middle);\n\n    int compare = memcmp (middle_string_p, string1_p, string1_size);\n\n    if (compare == 0)\n    {\n      compare = memcmp (middle_string_p + string1_size, string2_p, string2_size);\n    }\n\n    if (compare == 0)\n    {\n      return (lit_magic_string_id_t) middle;\n    }\n    else if (compare > 0)\n    {\n      last = middle;\n    }\n    else\n    {\n      first = middle + 1;\n    }\n  }\n\n  return LIT_MAGIC_STRING__COUNT;\n} /* lit_is_utf8_string_pair_magic */\n\n/**\n * Returns the ex magic string id of the argument string if it is available.\n *\n * @return id - if magic string id is found,\n *         lit_get_magic_string_ex_count () - otherwise.\n */\nlit_magic_string_ex_id_t\nlit_is_ex_utf8_string_magic (const lit_utf8_byte_t *string_p, /**< utf-8 string */\n                             lit_utf8_size_t string_size) /**< string size in bytes */\n{\n  const uint32_t magic_string_ex_count = lit_get_magic_string_ex_count ();\n\n  if (magic_string_ex_count == 0 || string_size > lit_get_magic_string_ex_size (magic_string_ex_count - 1))\n  {\n    return (lit_magic_string_ex_id_t) magic_string_ex_count;\n  }\n\n  lit_magic_string_ex_id_t first = 0;\n  lit_magic_string_ex_id_t last = (lit_magic_string_ex_id_t) magic_string_ex_count;\n\n  while (first < last)\n  {\n    const lit_magic_string_ex_id_t middle = (first + last) / 2;\n    const lit_utf8_byte_t *ext_string_p = lit_get_magic_string_ex_utf8 (middle);\n    const lit_utf8_size_t ext_string_size = lit_get_magic_string_ex_size (middle);\n\n    if (string_size == ext_string_size)\n    {\n      const int string_compare = memcmp (ext_string_p, string_p, string_size);\n\n      if (string_compare == 0)\n      {\n        return middle;\n      }\n      else if (string_compare < 0)\n      {\n        first = middle + 1;\n      }\n      else\n      {\n        last = middle;\n      }\n    }\n    else if (string_size > ext_string_size)\n    {\n      first = middle + 1;\n    }\n    else\n    {\n      last = middle;\n    }\n  }\n\n  return (lit_magic_string_ex_id_t) magic_string_ex_count;\n} /* lit_is_ex_utf8_string_magic */\n\n/**\n * Returns the ex magic string id of the argument string pair if it is available.\n *\n * @return id - if magic string id is found,\n *         lit_get_magic_string_ex_count () - otherwise.\n */\nlit_magic_string_ex_id_t\nlit_is_ex_utf8_string_pair_magic (const lit_utf8_byte_t *string1_p, /**< first utf-8 string */\n                                  lit_utf8_size_t string1_size, /**< first string size in bytes */\n                                  const lit_utf8_byte_t *string2_p, /**< second utf-8 string */\n                                  lit_utf8_size_t string2_size) /**< second string size in bytes */\n{\n  const uint32_t magic_string_ex_count = lit_get_magic_string_ex_count ();\n  const lit_utf8_size_t total_string_size = string1_size + string2_size;\n\n  if (magic_string_ex_count == 0 || total_string_size > lit_get_magic_string_ex_size (magic_string_ex_count - 1))\n  {\n    return (lit_magic_string_ex_id_t) magic_string_ex_count;\n  }\n\n  lit_magic_string_ex_id_t first = 0;\n  lit_magic_string_ex_id_t last = (lit_magic_string_ex_id_t) magic_string_ex_count;\n\n  while (first < last)\n  {\n    const lit_magic_string_ex_id_t middle = (first + last) / 2;\n    const lit_utf8_byte_t *ext_string_p = lit_get_magic_string_ex_utf8 (middle);\n    const lit_utf8_size_t ext_string_size = lit_get_magic_string_ex_size (middle);\n\n    if (total_string_size == ext_string_size)\n    {\n      int string_compare = memcmp (ext_string_p, string1_p, string1_size);\n\n      if (string_compare == 0)\n      {\n        string_compare = memcmp (ext_string_p + string1_size, string2_p, string2_size);\n      }\n\n      if (string_compare == 0)\n      {\n        return middle;\n      }\n      else if (string_compare < 0)\n      {\n        first = middle + 1;\n      }\n      else\n      {\n        last = middle;\n      }\n    }\n    else if (total_string_size > ext_string_size)\n    {\n      first = middle + 1;\n    }\n    else\n    {\n      last = middle;\n    }\n  }\n\n  return (lit_magic_string_ex_id_t) magic_string_ex_count;\n} /* lit_is_ex_utf8_string_pair_magic */\n\n/**\n * Copy magic string to buffer\n *\n * Warning:\n *         the routine requires that buffer size is enough\n *\n * @return pointer to the byte next to the last copied in the buffer\n */\nlit_utf8_byte_t *\nlit_copy_magic_string_to_buffer (lit_magic_string_id_t id, /**< magic string id */\n                                 lit_utf8_byte_t *buffer_p, /**< destination buffer */\n                                 lit_utf8_size_t buffer_size) /**< size of buffer */\n{\n  const lit_utf8_byte_t *magic_string_bytes_p = lit_get_magic_string_utf8 (id);\n  lit_utf8_size_t magic_string_bytes_count = lit_get_magic_string_size (id);\n\n  const lit_utf8_byte_t *str_iter_p = magic_string_bytes_p;\n  lit_utf8_byte_t *buf_iter_p = buffer_p;\n  lit_utf8_size_t bytes_copied = 0;\n\n  while (magic_string_bytes_count--)\n  {\n    bytes_copied++;\n    JERRY_ASSERT (bytes_copied <= buffer_size);\n\n    *buf_iter_p++ = *str_iter_p++;\n  }\n\n  return buf_iter_p;\n} /* lit_copy_magic_string_to_buffer */\n"
  },
  {
    "path": "jerry-core/lit/lit-magic-strings.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef LIT_MAGIC_STRINGS_H\n#define LIT_MAGIC_STRINGS_H\n\n#include \"lit-globals.h\"\n\n/**\n * Identifiers of ECMA and implementation-defined magic string constants\n */\ntypedef enum\n{\n/** @cond doxygen_suppress */\n#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id)\n#define LIT_MAGIC_STRING_DEF(id, ascii_zt_string) id,\n#include \"lit-magic-strings.inc.h\"\n#undef LIT_MAGIC_STRING_DEF\n#undef LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE\n  /** @endcond */\n  LIT_NON_INTERNAL_MAGIC_STRING__COUNT, /**< number of non-internal magic strings */\n  LIT_INTERNAL_MAGIC_API_INTERNAL = LIT_NON_INTERNAL_MAGIC_STRING__COUNT, /**< Used to add non-visible JS properties\n                                                                           *   from the public API */\n  LIT_INTERNAL_MAGIC_STRING_ITERATOR_NEXT_INDEX, /**< [[%Iterator%NextIndex]] property */\n  LIT_INTERNAL_MAGIC_STRING_MAP_KEY, /**< Property key used when an object is a key in a map object */\n  LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES, /**< %ArrayProto_values% intrinsic routine */\n  LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES, /**< %TypedArray%.prototype values and [@@iterator] routine */\n  LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES, /**< Set.prototype values, keys and [@@iterator] routines */\n  LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES, /**< Map.prototype entries and [@@iterator] routines */\n  /* List of well known symbols */\n  LIT_GLOBAL_SYMBOL_ASYNC_ITERATOR, /**< @@asyncIterator well known symbol */\n  LIT_GLOBAL_SYMBOL__FIRST = LIT_GLOBAL_SYMBOL_ASYNC_ITERATOR, /**< first global symbol */\n  LIT_GLOBAL_SYMBOL_HAS_INSTANCE, /**< @@hasInstance well known symbol */\n  LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE, /**< @@isConcatSpreadable well known symbol */\n  LIT_GLOBAL_SYMBOL_ITERATOR, /**< @@iterator well known symbol */\n  LIT_GLOBAL_SYMBOL_MATCH, /**< @@match well known symbol */\n  LIT_GLOBAL_SYMBOL_REPLACE, /**< @@replace well known symbol */\n  LIT_GLOBAL_SYMBOL_SEARCH, /**< @@search well known symbol */\n  LIT_GLOBAL_SYMBOL_SPECIES, /**< @@species well known symbol */\n  LIT_GLOBAL_SYMBOL_SPLIT, /**< @@split well known symbol */\n  LIT_GLOBAL_SYMBOL_TO_PRIMITIVE, /**< @@toPrimitive well known symbol */\n  LIT_GLOBAL_SYMBOL_TO_STRING_TAG, /**< @@toStringTag well known symbol */\n  LIT_GLOBAL_SYMBOL_UNSCOPABLES, /**< @@unscopables well known symbol */\n  LIT_GLOBAL_SYMBOL_MATCH_ALL, /**< @@matchAll well known symbol */\n  LIT_GLOBAL_SYMBOL__LAST = LIT_GLOBAL_SYMBOL_MATCH_ALL, /**< last global symbol */\n\n  LIT_INTERNAL_MAGIC_STRING_DELETED, /**< special value for deleted properties */\n  LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_INIT, /**< function which initializes properties */\n\n  LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER, /**< native pointer info associated with an object */\n  LIT_INTERNAL_MAGIC_STRING_FIRST_DATA = LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER, /**< first index of special\n                                                                                    *   data properties */\n  LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER_WITH_REFERENCES, /**< native pointer info associated with an object\n                                                             *   which contains references to other values */\n  LIT_INTERNAL_MAGIC_STRING_ENVIRONMENT_RECORD, /**< dynamic environment record needed by class constructors */\n  LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_COMPUTED, /**< computed class field name list */\n  LIT_INTERNAL_MAGIC_STRING_CLASS_PRIVATE_ELEMENTS, /**< internal collection for storing private elements */\n  LIT_INTERNAL_MAGIC_STRING_CONTAINER_WEAK_REFS, /**< Weak references to the current container object */\n  LIT_INTERNAL_MAGIC_STRING_WEAK_REFS, /**< Weak references to the current object */\n  LIT_MAGIC_STRING__COUNT /**< number of magic strings */\n} lit_magic_string_id_t;\n\n/**\n * Properties that are need to be ignored for opfunc_set_class_attributes\n */\n#define LIT_INTERNAL_MAGIC_STRING_IGNORED(id) \\\n  ((id) >= LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_COMPUTED && (id) <= LIT_INTERNAL_MAGIC_STRING_CLASS_PRIVATE_ELEMENTS)\n\n/**\n * Checks whether the given id corresponds to a global symbol\n */\n#define LIT_IS_GLOBAL_SYMBOL(id) ((id) >= LIT_GLOBAL_SYMBOL__FIRST && (id) <= LIT_GLOBAL_SYMBOL__LAST)\n\n/**\n * Identifiers of implementation-defined external magic string constants\n */\ntypedef uint32_t lit_magic_string_ex_id_t;\n\nuint32_t lit_get_magic_string_ex_count (void);\n\nconst lit_utf8_byte_t *lit_get_magic_string_utf8 (uint32_t id);\nlit_utf8_size_t lit_get_magic_string_size (uint32_t id);\n\nconst lit_utf8_byte_t *lit_get_magic_string_ex_utf8 (uint32_t id);\nlit_utf8_size_t lit_get_magic_string_ex_size (uint32_t id);\n\nvoid lit_magic_strings_ex_set (const lit_utf8_byte_t *const *ex_str_items,\n                               uint32_t count,\n                               const lit_utf8_size_t *ex_str_sizes);\n\nlit_magic_string_id_t lit_is_utf8_string_magic (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);\nlit_magic_string_id_t lit_is_utf8_string_pair_magic (const lit_utf8_byte_t *string1_p,\n                                                     lit_utf8_size_t string1_size,\n                                                     const lit_utf8_byte_t *string2_p,\n                                                     lit_utf8_size_t string2_size);\n\nlit_magic_string_ex_id_t lit_is_ex_utf8_string_magic (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);\nlit_magic_string_ex_id_t lit_is_ex_utf8_string_pair_magic (const lit_utf8_byte_t *string1_p,\n                                                           lit_utf8_size_t string1_size,\n                                                           const lit_utf8_byte_t *string2_p,\n                                                           lit_utf8_size_t string2_size);\n\nlit_utf8_byte_t *\nlit_copy_magic_string_to_buffer (lit_magic_string_id_t id, lit_utf8_byte_t *buffer_p, lit_utf8_size_t buffer_size);\n\n#endif /* !LIT_MAGIC_STRINGS_H */\n"
  },
  {
    "path": "jerry-core/lit/lit-magic-strings.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file is automatically generated by the gen-strings.py script\n * from lit-magic-strings.ini. Do not edit! */\n\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING__EMPTY, \"\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPACE_CHAR, \" \")\n#if JERRY_MODULE_SYSTEM\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASTERIX_CHAR, \"*\")\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COMMA_CHAR, \",\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_E_U, \"E\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LEFT_SQUARE_CHAR, \"[\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RIGHT_SQUARE_CHAR, \"]\")\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PI_U, \"PI\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_AT, \"at\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS, \"is\")\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OF, \"of\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_OR, \"or\")\n#endif /* JERRY_BUILTIN_ATOMICS */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LN2_U, \"LN2\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAP_UL, \"Map\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NAN, \"NaN\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UL, \"Set\")\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UTC_U, \"UTC\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ABS, \"abs\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_ATOMICS || JERRY_BUILTIN_CONTAINER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ADD, \"add\")\n#endif /* JERRY_BUILTIN_ATOMICS \\\n|| JERRY_BUILTIN_CONTAINER */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ALL, \"all\")\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_AND, \"and\")\n#endif /* JERRY_BUILTIN_ATOMICS */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ANY, \"any\")\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COS, \"cos\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EXP, \"exp\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FOR, \"for\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET, \"get\")\n#if JERRY_BUILTIN_CONTAINER || JERRY_BUILTIN_PROXY || JERRY_BUILTIN_REFLECT\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HAS, \"has\")\n#endif /* JERRY_BUILTIN_CONTAINER \\\n|| JERRY_BUILTIN_PROXY            \\\n|| JERRY_BUILTIN_REFLECT */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG, \"log\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAP, \"map\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAX, \"max\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MIN, \"min\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NOW, \"now\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_ARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_POP, \"pop\")\n#endif /* JERRY_BUILTIN_ARRAY */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_POW, \"pow\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RAW, \"raw\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET, \"set\")\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SIN, \"sin\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_SUB, \"sub\")\n#endif /* JERRY_BUILTIN_ATOMICS */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TAN, \"tan\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_XOR, \"xor\")\n#endif /* JERRY_BUILTIN_ATOMICS */\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP, \"(?:)\")\n#endif /* JERRY_BUILTIN_REGEXP */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DATE_UL, \"Date\")\n#if JERRY_BUILTIN_JSON\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_JSON_U, \"JSON\")\n#endif /* JERRY_BUILTIN_JSON */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LN10_U, \"LN10\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MATH_UL, \"Math\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NULL_UL, \"Null\")\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ACOS, \"acos\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASIN, \"asin\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATAN, \"atan\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BIND, \"bind\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CALL, \"call\")\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CBRT, \"cbrt\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CEIL, \"ceil\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COSH, \"cosh\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DONE, \"done\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EVAL, \"eval\")\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EXEC, \"exec\")\n#endif /* JERRY_BUILTIN_REGEXP */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FILL, \"fill\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FIND, \"find\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLAT, \"flat\")\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FROM, \"from\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IMUL, \"imul\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_JOIN, \"join\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_KEYS, \"keys\")\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_LOAD, \"load\")\n#endif /* JERRY_BUILTIN_ATOMICS */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG2, \"log2\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NAME, \"name\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NEXT, \"next\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NULL, \"null\")\n#if JERRY_BUILTIN_ARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PUSH, \"push\")\n#endif /* JERRY_BUILTIN_ARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RACE, \"race\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SEAL, \"seal\")\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SIGN, \"sign\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SINH, \"sinh\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_CONTAINER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SIZE, \"size\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SOME, \"some\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SORT, \"sort\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SQRT, \"sqrt\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TANH, \"tanh\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TEST, \"test\")\n#endif /* JERRY_BUILTIN_REGEXP */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_THEN, \"then\")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRIM, \"trim\")\n#endif /* JERRY_BUILTIN_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRUE, \"true\")\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_WAIT, \"wait\")\n#endif /* JERRY_BUILTIN_ATOMICS */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARRAY_UL, \"Array\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ERROR_UL, \"Error\")\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG2E_U, \"LOG2E\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_PROXY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROXY_UL, \"Proxy\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SQRT2_U, \"SQRT2\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ACOSH, \"acosh\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_APPLY, \"apply\")\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASINH, \"asinh\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATAN2, \"atan2\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATANH, \"atanh\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CATCH, \"catch\")\n#if JERRY_BUILTIN_CONTAINER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CLEAR, \"clear\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CLZ32, \"clz32\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_WEAKREF\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEREF, \"deref\")\n#endif /* JERRY_BUILTIN_WEAKREF */\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EVERY, \"every\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EXPM1, \"expm1\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FALSE, \"false\")\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLAGS, \"flags\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLOOR, \"floor\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HYPOT, \"hypot\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INDEX, \"index\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INPUT, \"input\")\n#endif /* JERRY_BUILTIN_REGEXP */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_NAN, \"isNaN\")\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG10, \"log10\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG1P, \"log1p\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MATCH, \"match\")\n#if JERRY_BUILTIN_DATE || JERRY_BUILTIN_JSON\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PARSE, \"parse\")\n#endif /* JERRY_BUILTIN_DATE \\\n|| JERRY_BUILTIN_JSON */\n#if JERRY_BUILTIN_PROXY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROXY, \"proxy\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ROUND, \"round\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_ARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SHIFT, \"shift\")\n#endif /* JERRY_BUILTIN_ARRAY */\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_SHAREDARRAYBUFFER || JERRY_BUILTIN_STRING || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SLICE, \"slice\")\n#endif /* JERRY_BUILTIN_ARRAY      \\\n|| JERRY_BUILTIN_SHAREDARRAYBUFFER \\\n|| JERRY_BUILTIN_STRING            \\\n|| JERRY_BUILTIN_TYPEDARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPLIT, \"split\")\n#if JERRY_LINE_INFO\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STACK, \"stack\")\n#endif /* JERRY_LINE_INFO */\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_STORE, \"store\")\n#endif /* JERRY_BUILTIN_ATOMICS */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_THROW, \"throw\")\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRUNC, \"trunc\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_VALUE, \"value\")\n#if JERRY_PARSER && JERRY_SOURCE_NAME\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SOURCE_NAME_EVAL, \"<eval>\")\n#endif /* JERRY_PARSER && JERRY_SOURCE_NAME */\n#if JERRY_BUILTIN_BIGINT\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BIGINT_UL, \"BigInt\")\n#endif /* JERRY_BUILTIN_BIGINT */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG10E_U, \"LOG10E\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_MODULE_SYSTEM\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MODULE_UL, \"Module\")\n#endif /* JERRY_MODULE_SYSTEM */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NUMBER_UL, \"Number\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OBJECT_UL, \"Object\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REGEXP_UL, \"RegExp\")\n#if JERRY_PARSER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SCRIPT_UL, \"Script\")\n#endif /* JERRY_PARSER */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRING_UL, \"String\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL_UL, \"Symbol\")\n#if JERRY_BUILTIN_BIGINT\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_AS_INT_N, \"asIntN\")\n#endif /* JERRY_BUILTIN_BIGINT */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASSIGN, \"assign\")\n#if JERRY_BUILTIN_BIGINT\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BIGINT, \"bigint\")\n#endif /* JERRY_BUILTIN_BIGINT */\n#if JERRY_BUILTIN_DATAVIEW || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BUFFER, \"buffer\")\n#endif /* JERRY_BUILTIN_DATAVIEW \\\n|| JERRY_BUILTIN_TYPEDARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CALLEE, \"callee\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CALLER, \"caller\")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CHAR_AT_UL, \"charAt\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CONCAT, \"concat\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CREATE, \"create\")\n#if JERRY_BUILTIN_CONTAINER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DELETE, \"delete\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DOTALL, \"dotAll\")\n#endif /* JERRY_BUILTIN_REGEXP */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ERRORS_UL, \"errors\")\n#if JERRY_BUILTIN_ANNEXB\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ESCAPE, \"escape\")\n#endif /* JERRY_BUILTIN_ANNEXB */\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FILTER, \"filter\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_TYPEDARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FREEZE, \"freeze\")\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FROUND, \"fround\")\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_DAY_UL, \"getDay\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GLOBAL, \"global\")\n#endif /* JERRY_BUILTIN_REGEXP */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HAS_OWN_UL, \"hasOwn\")\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_VIEW_UL, \"isView\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_KEY_FOR, \"keyFor\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LENGTH, \"length\")\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_NOTIFY, \"notify\")\n#endif /* JERRY_BUILTIN_ATOMICS */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NUMBER, \"number\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OBJECT, \"object\")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PAD_END, \"padEnd\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RANDOM, \"random\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REASON, \"reason\")\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REDUCE, \"reduce\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_TYPEDARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REJECT, \"reject\")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REPEAT, \"repeat\")\n#endif /* JERRY_BUILTIN_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RETURN, \"return\")\n#if JERRY_BUILTIN_PROXY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REVOKE, \"revoke\")\n#endif /* JERRY_BUILTIN_PROXY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SEARCH, \"search\")\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SOURCE, \"source\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_ARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPLICE, \"splice\")\n#endif /* JERRY_BUILTIN_ARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STATUS, \"status\")\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STICKY, \"sticky\")\n#endif /* JERRY_BUILTIN_REGEXP */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRING, \"string\")\n#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SUBSTR, \"substr\")\n#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL, \"symbol\")\n#if JERRY_BUILTIN_DATE || JERRY_BUILTIN_JSON\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_JSON_UL, \"toJSON\")\n#endif /* JERRY_BUILTIN_DATE \\\n|| JERRY_BUILTIN_JSON */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_VALUES, \"values\")\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_U, \"Atomics\")\n#endif /* JERRY_BUILTIN_ATOMICS */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BOOLEAN_UL, \"Boolean\")\n#if JERRY_BUILTIN_NUMBER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EPSILON_U, \"EPSILON\")\n#endif /* JERRY_BUILTIN_NUMBER */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROMISE_UL, \"Promise\")\n#if JERRY_BUILTIN_REFLECT\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REFLECT_UL, \"Reflect\")\n#endif /* JERRY_BUILTIN_REFLECT */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SQRT1_2_U, \"SQRT1_2\")\n#endif /* JERRY_BUILTIN_MATH */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL_DOT_UL, \"Symbol.\")\n#if JERRY_BUILTIN_CONTAINER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WEAKMAP_UL, \"WeakMap\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_WEAKREF\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WEAKREF_UL, \"WeakRef\")\n#endif /* JERRY_BUILTIN_WEAKREF */\n#if JERRY_BUILTIN_CONTAINER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WEAKSET_UL, \"WeakSet\")\n#endif /* JERRY_BUILTIN_CONTAINER */\n#if JERRY_BUILTIN_BIGINT\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_AS_U_INT_N, \"asUintN\")\n#endif /* JERRY_BUILTIN_BIGINT */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BOOLEAN, \"boolean\")\n#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COMPILE, \"compile\")\n#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_REGEXP */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFAULT, \"default\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENTRIES, \"entries\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FINALLY, \"finally\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLATMAP, \"flatMap\")\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_CONTAINER || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FOR_EACH_UL, \"forEach\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_CONTAINER    \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_DATE_UL, \"getDate\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_INT8_UL, \"getInt8\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_TIME_UL, \"getTime\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_YEAR_UL, \"getYear\")\n#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_STRING || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INDEX_OF_UL, \"indexOf\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_STRING       \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_ARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_ARRAY_UL, \"isArray\")\n#endif /* JERRY_BUILTIN_ARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MESSAGE, \"message\")\n#if JERRY_BUILTIN_PROXY || JERRY_BUILTIN_REFLECT\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OWN_KEYS_UL, \"ownKeys\")\n#endif /* JERRY_BUILTIN_PROXY \\\n|| JERRY_BUILTIN_REFLECT */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REPLACE, \"replace\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RESOLVE, \"resolve\")\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REVERSE, \"reverse\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_DATE_UL, \"setDate\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_INT8_UL, \"setInt8\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_TIME_UL, \"setTime\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_YEAR_UL, \"setYear\")\n#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPECIES, \"species\")\n#if JERRY_BUILTIN_NUMBER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_FIXED_UL, \"toFixed\")\n#endif /* JERRY_BUILTIN_NUMBER */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRIM_END, \"trimEnd\")\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNICODE, \"unicode\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_ARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNSHIFT, \"unshift\")\n#endif /* JERRY_BUILTIN_ARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_VALUE_OF_UL, \"valueOf\")\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DATAVIEW_UL, \"DataView\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_UL, \"Function\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INFINITY_UL, \"Infinity\")\n#if JERRY_BUILTIN_ERRORS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_URI_ERROR_UL, \"URIError\")\n#endif /* JERRY_BUILTIN_ERRORS */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OBJECT_TO_STRING_UL, \"[object \")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENDS_WITH, \"endsWith\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_EXCHANGE, \"exchange\")\n#endif /* JERRY_BUILTIN_ATOMICS */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION, \"function\")\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_HOURS_UL, \"getHours\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_INT16_UL, \"getInt16\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_INT32_UL, \"getInt32\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_MONTH_UL, \"getMonth\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UINT8_UL, \"getUint8\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INCLUDES, \"includes\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_FINITE, \"isFinite\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_FROZEN_UL, \"isFrozen\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_SEALED_UL, \"isSealed\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ITERATOR, \"iterator\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MATCH_ALL, \"matchAll\")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PAD_START, \"padStart\")\n#endif /* JERRY_BUILTIN_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PARSE_INT, \"parseInt\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REJECTED, \"rejected\")\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_HOURS_UL, \"setHours\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_INT16_UL, \"setInt16\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_INT32_UL, \"setInt32\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_MONTH_UL, \"setMonth\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UINT8_UL, \"setUint8\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SUBARRAY, \"subarray\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_STRING_UL, \"toString\")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRIM_LEFT, \"trimLeft\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_ANNEXB\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNESCAPE, \"unescape\")\n#endif /* JERRY_BUILTIN_ANNEXB */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WRITABLE, \"writable\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NEGATIVE_INFINITY_UL, \"-Infinity\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARGUMENTS_UL, \"Arguments\")\n#if JERRY_BUILTIN_ERRORS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EVAL_ERROR_UL, \"EvalError\")\n#endif /* JERRY_BUILTIN_ERRORS */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GENERATOR_UL, \"Generator\")\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INT8_ARRAY_UL, \"Int8Array\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_NUMBER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAX_VALUE_U, \"MAX_VALUE\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MIN_VALUE_U, \"MIN_VALUE\")\n#endif /* JERRY_BUILTIN_NUMBER */\n#if JERRY_BUILTIN_ERRORS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TYPE_ERROR_UL, \"TypeError\")\n#endif /* JERRY_BUILTIN_ERRORS */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNDEFINED_UL, \"Undefined\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING__PROTO__, \"__proto__\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ANONYMOUS, \"anonymous\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARGUMENTS, \"arguments\")\n#if JERRY_BUILTIN_PROXY || JERRY_BUILTIN_REFLECT\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CONSTRUCT, \"construct\")\n#endif /* JERRY_BUILTIN_PROXY \\\n|| JERRY_BUILTIN_REFLECT */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DECODE_URI, \"decodeURI\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENCODE_URI, \"encodeURI\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FIND_INDEX, \"findIndex\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FULFILLED, \"fulfilled\")\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_DAY_UL, \"getUTCDay\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UINT16_UL, \"getUint16\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UINT32_UL, \"getUint32\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_INTEGER, \"isInteger\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LASTINDEX_UL, \"lastIndex\")\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MULTILINE, \"multiline\")\n#endif /* JERRY_BUILTIN_REGEXP */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROTOTYPE, \"prototype\")\n#if JERRY_BUILTIN_PROXY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REVOCABLE, \"revocable\")\n#endif /* JERRY_BUILTIN_PROXY */\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UINT16_UL, \"setUint16\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UINT32_UL, \"setUint32\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_JSON\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRINGIFY, \"stringify\")\n#endif /* JERRY_BUILTIN_JSON */\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SUBSTRING, \"substring\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRIM_RIGHT, \"trimRight\")\n#endif /* JERRY_BUILTIN_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRIM_START, \"trimStart\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNDEFINED, \"undefined\")\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INT16_ARRAY_UL, \"Int16Array\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INT32_ARRAY_UL, \"Int32Array\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_ERRORS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RANGE_ERROR_UL, \"RangeError\")\n#endif /* JERRY_BUILTIN_ERRORS */\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TYPED_ARRAY_UL, \"TypedArray\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UINT8_ARRAY_UL, \"Uint8Array\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ALLSETTLED, \"allSettled\")\n#if JERRY_BUILTIN_DATAVIEW || JERRY_BUILTIN_SHAREDARRAYBUFFER || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BYTE_LENGTH_UL, \"byteLength\")\n#endif /* JERRY_BUILTIN_DATAVIEW   \\\n|| JERRY_BUILTIN_SHAREDARRAYBUFFER \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_DATAVIEW || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BYTE_OFFSET_UL, \"byteOffset\")\n#endif /* JERRY_BUILTIN_DATAVIEW \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CHAR_CODE_AT_UL, \"charCodeAt\")\n#endif /* JERRY_BUILTIN_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COPY_WITHIN, \"copyWithin\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENUMERABLE, \"enumerable\")\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_FLOAT_32_UL, \"getFloat32\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_DATAVIEW && JERRY_NUMBER_TYPE_FLOAT64\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_FLOAT_64_UL, \"getFloat64\")\n#endif /* JERRY_BUILTIN_DATAVIEW && JERRY_NUMBER_TYPE_FLOAT64 */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_MINUTES_UL, \"getMinutes\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_SECONDS_UL, \"getSeconds\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_DATE_UL, \"getUTCDate\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_GLOBAL_THIS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GLOBAL_THIS_UL, \"globalThis\")\n#endif /* JERRY_BUILTIN_GLOBAL_THIS */\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IGNORECASE_UL, \"ignoreCase\")\n#endif /* JERRY_BUILTIN_REGEXP */\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_ISLOCKFREE, \"isLockFree\")\n#endif /* JERRY_BUILTIN_ATOMICS */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PARSE_FLOAT, \"parseFloat\")\n#if JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REPLACE_ALL, \"replaceAll\")\n#endif /* JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_FLOAT_32_UL, \"setFloat32\")\n#endif /* JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_DATAVIEW && JERRY_NUMBER_TYPE_FLOAT64\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_FLOAT_64_UL, \"setFloat64\")\n#endif /* JERRY_BUILTIN_DATAVIEW && JERRY_NUMBER_TYPE_FLOAT64 */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_MINUTES_UL, \"setMinutes\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_SECONDS_UL, \"setSeconds\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_DATE_UL, \"setUTCDate\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STARTS_WITH, \"startsWith\")\n#endif /* JERRY_BUILTIN_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SOURCE_NAME_ANON, \"<anonymous>\")\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARRAY_BUFFER_UL, \"ArrayBuffer\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_ERRORS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYNTAX_ERROR_UL, \"SyntaxError\")\n#endif /* JERRY_BUILTIN_ERRORS */\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UINT16_ARRAY_UL, \"Uint16Array\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UINT32_ARRAY_UL, \"Uint32Array\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CODE_POINT_AT, \"codePointAt\")\n#endif /* JERRY_BUILTIN_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CONSTRUCTOR, \"constructor\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DESCRIPTION, \"description\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OBJECT_FROM_ENTRIES, \"fromEntries\")\n#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_BIGINT64, \"getBigInt64\")\n#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_FULL_YEAR_UL, \"getFullYear\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_HOURS_UL, \"getUTCHours\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_MONTH_UL, \"getUTCMonth\")\n#endif /* JERRY_BUILTIN_DATE */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HAS_INSTANCE, \"hasInstance\")\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_STRING || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, \"lastIndexOf\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_STRING       \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REDUCE_RIGHT_UL, \"reduceRight\")\n#endif /* JERRY_BUILTIN_ARRAY \\\n|| JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_BIGINT64, \"setBigInt64\")\n#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_FULL_YEAR_UL, \"setFullYear\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_HOURS_UL, \"setUTCHours\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_MONTH_UL, \"setUTCMonth\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_GMT_STRING_UL, \"toGMTString\")\n#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_ISO_STRING_UL, \"toISOString\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOWER_CASE_UL, \"toLowerCase\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_NUMBER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_PRECISION_UL, \"toPrecision\")\n#endif /* JERRY_BUILTIN_NUMBER */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_PRIMITIVE, \"toPrimitive\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_STRING_TAG, \"toStringTag\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_UTC_STRING_UL, \"toUTCString\")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_UPPER_CASE_UL, \"toUpperCase\")\n#endif /* JERRY_BUILTIN_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNSCOPABLES, \"unscopables\")\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, \"Float32Array\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_TYPEDARRAY && JERRY_NUMBER_TYPE_FLOAT64\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, \"Float64Array\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY && JERRY_NUMBER_TYPE_FLOAT64 */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INVALID_DATE_UL, \"Invalid Date\")\n#endif /* JERRY_BUILTIN_DATE */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAP_ITERATOR_UL, \"Map Iterator\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_ITERATOR_UL, \"Set Iterator\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CONFIGURABLE, \"configurable\")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FROM_CHAR_CODE_UL, \"fromCharCode\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_BIGUINT64, \"getBigUint64\")\n#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_EXTENSIBLE, \"isExtensible\")\n#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_BIGUINT64, \"setBigUint64\")\n#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_DATE_STRING_UL, \"toDateString\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_TIME_STRING_UL, \"toTimeString\")\n#endif /* JERRY_BUILTIN_DATE */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, \"AsyncFunction\")\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, \"BigInt64Array\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASYNC_ITERATOR, \"asyncIterator\")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FROM_CODE_POINT_UL, \"fromCodePoint\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_MINUTES_UL, \"getUTCMinutes\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_SECONDS_UL, \"getUTCSeconds\")\n#endif /* JERRY_BUILTIN_DATE */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_PROTOTYPE_OF_UL, \"isPrototypeOf\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_SAFE_INTEGER, \"isSafeInteger\")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOCALE_COMPARE_UL, \"localeCompare\")\n#endif /* JERRY_BUILTIN_STRING */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_MINUTES_UL, \"setUTCMinutes\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_SECONDS_UL, \"setUTCSeconds\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_NUMBER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_EXPONENTIAL_UL, \"toExponential\")\n#endif /* JERRY_BUILTIN_NUMBER */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, \"AggregateError\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, \"Array Iterator\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASYNC_GENERATOR_UL, \"AsyncGenerator\")\n#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, \"BigUint64Array\")\n#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_ERRORS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REFERENCE_ERROR_UL, \"ReferenceError\")\n#endif /* JERRY_BUILTIN_ERRORS */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFINE_PROPERTY_UL, \"defineProperty\")\n#if JERRY_BUILTIN_PROXY || JERRY_BUILTIN_REFLECT\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DELETE_PROPERTY_UL, \"deleteProperty\")\n#endif /* JERRY_BUILTIN_PROXY \\\n|| JERRY_BUILTIN_REFLECT */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_PROTOTYPE_OF_UL, \"getPrototypeOf\")\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_FULL_YEAR_UL, \"getUTCFullYear\")\n#endif /* JERRY_BUILTIN_DATE */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HAS_OWN_PROPERTY_UL, \"hasOwnProperty\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_PROTOTYPE_OF_UL, \"setPrototypeOf\")\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_FULL_YEAR_UL, \"setUTCFullYear\")\n#endif /* JERRY_BUILTIN_DATE */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, \"toLocaleString\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRING_ITERATOR_UL, \"String Iterator\")\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_COMPAREEXCHANGE, \"compareExchange\")\n#endif /* JERRY_BUILTIN_ATOMICS */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_MILLISECONDS_UL, \"getMilliseconds\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_MILLISECONDS_UL, \"setMilliseconds\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_BUILTIN_NUMBER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U, \"MAX_SAFE_INTEGER\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MIN_SAFE_INTEGER_U, \"MIN_SAFE_INTEGER\")\n#endif /* JERRY_BUILTIN_NUMBER */\n#if JERRY_BUILTIN_ANNEXB\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFINE_GETTER, \"__defineGetter__\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFINE_SETTER, \"__defineSetter__\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOOKUP_GETTER, \"__lookupGetter__\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOOKUP_SETTER, \"__lookupSetter__\")\n#endif /* JERRY_BUILTIN_ANNEXB */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFINE_PROPERTIES_UL, \"defineProperties\")\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, \"BYTES_PER_ELEMENT\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, \"GeneratorFunction\")\n#if JERRY_BUILTIN_NUMBER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U, \"NEGATIVE_INFINITY\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_POSITIVE_INFINITY_U, \"POSITIVE_INFINITY\")\n#endif /* JERRY_BUILTIN_NUMBER */\n#if JERRY_BUILTIN_SHAREDARRAYBUFFER\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, \"SharedArrayBuffer\")\n#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL, \"Uint8ClampedArray\")\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_TIMEZONE_OFFSET_UL, \"getTimezoneOffset\")\n#endif /* JERRY_BUILTIN_DATE */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PREVENT_EXTENSIONS_UL, \"preventExtensions\")\n#if JERRY_BUILTIN_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_LOWER_CASE_UL, \"toLocaleLowerCase\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_UPPER_CASE_UL, \"toLocaleUpperCase\")\n#endif /* JERRY_BUILTIN_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DECODE_URI_COMPONENT, \"decodeURIComponent\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENCODE_URI_COMPONENT, \"encodeURIComponent\")\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_MILLISECONDS_UL, \"getUTCMilliseconds\")\n#endif /* JERRY_BUILTIN_DATE */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE, \"isConcatSpreadable\")\n#if JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_MILLISECONDS_UL, \"setUTCMilliseconds\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_DATE_STRING_UL, \"toLocaleDateString\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_TIME_STRING_UL, \"toLocaleTimeString\")\n#endif /* JERRY_BUILTIN_DATE */\n#if JERRY_FUNCTION_TO_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON, \"function anonymous(\")\n#endif /* JERRY_FUNCTION_TO_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL, \"getOwnPropertyNames\")\n#if JERRY_FUNCTION_TO_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_GENERATOR, \"function* anonymous(\")\n#endif /* JERRY_FUNCTION_TO_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL, \"propertyIsEnumerable\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL, \"getOwnPropertySymbols\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL, \"AsyncGeneratorFunction\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REGEXP_STRING_ITERATOR_UL, \"RegExp String Iterator\")\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL, \"getOwnPropertyDescriptor\")\n#if JERRY_FUNCTION_TO_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC, \"async function anonymous(\")\n#endif /* JERRY_FUNCTION_TO_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTORS_UL, \"getOwnPropertyDescriptors\")\n#if JERRY_FUNCTION_TO_STRING\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC_GENERATOR, \"async function* anonymous(\")\n#endif /* JERRY_FUNCTION_TO_STRING */\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE, \"function () { [native code] }\")\n#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)\nLIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA, \"function () { /* ecmascript */ }\")\n#endif /* JERRY_SNAPSHOT_EXEC \\\n|| !(JERRY_FUNCTION_TO_STRING) */\n\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (0, LIT_MAGIC_STRING__EMPTY)\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_SPACE_CHAR)\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_PI_U)\n#else /* !(JERRY_BUILTIN_MATH) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_AT)\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (3, LIT_MAGIC_STRING_LN2_U)\n#else /* !(JERRY_BUILTIN_MATH) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (3, LIT_MAGIC_STRING_MAP_UL)\n#endif /* JERRY_BUILTIN_MATH */\n#if JERRY_BUILTIN_REGEXP\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP)\n#else /* !(JERRY_BUILTIN_REGEXP) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_DATE_UL)\n#endif /* JERRY_BUILTIN_REGEXP */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (5, LIT_MAGIC_STRING_ARRAY_UL)\n#if JERRY_PARSER && JERRY_SOURCE_NAME\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (6, LIT_MAGIC_STRING_SOURCE_NAME_EVAL)\n#elif JERRY_BUILTIN_BIGINT\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (6, LIT_MAGIC_STRING_BIGINT_UL)\n#elif JERRY_BUILTIN_MATH\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (6, LIT_MAGIC_STRING_LOG10E_U)\n#elif JERRY_MODULE_SYSTEM\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (6, LIT_MAGIC_STRING_MODULE_UL)\n#else /* !(JERRY_MODULE_SYSTEM) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (6, LIT_MAGIC_STRING_NUMBER_UL)\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_BUILTIN_ATOMICS\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (7, LIT_MAGIC_STRING_ATOMICS_U)\n#else /* !(JERRY_BUILTIN_ATOMICS) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (7, LIT_MAGIC_STRING_BOOLEAN_UL)\n#endif /* JERRY_BUILTIN_ATOMICS */\n#if JERRY_BUILTIN_DATAVIEW\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (8, LIT_MAGIC_STRING_DATAVIEW_UL)\n#else /* !(JERRY_BUILTIN_DATAVIEW) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (8, LIT_MAGIC_STRING_FUNCTION_UL)\n#endif /* JERRY_BUILTIN_DATAVIEW */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (9, LIT_MAGIC_STRING_NEGATIVE_INFINITY_UL)\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_INT16_ARRAY_UL)\n#elif JERRY_BUILTIN_ERRORS\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_RANGE_ERROR_UL)\n#elif JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_TYPED_ARRAY_UL)\n#else /* !(JERRY_BUILTIN_TYPEDARRAY) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_ALLSETTLED)\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (11, LIT_MAGIC_STRING_SOURCE_NAME_ANON)\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_FLOAT32_ARRAY_UL)\n#elif JERRY_BUILTIN_TYPEDARRAY && JERRY_NUMBER_TYPE_FLOAT64\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_FLOAT64_ARRAY_UL)\n#elif JERRY_BUILTIN_DATE\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_INVALID_DATE_UL)\n#else /* !(JERRY_BUILTIN_DATE) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_MAP_ITERATOR_UL)\n#endif /* JERRY_BUILTIN_DATE */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (13, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL)\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (14, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL)\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (15, LIT_MAGIC_STRING_STRING_ITERATOR_UL)\n#if JERRY_BUILTIN_NUMBER\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (16, LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U)\n#elif JERRY_BUILTIN_ANNEXB\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (16, LIT_MAGIC_STRING_DEFINE_GETTER)\n#else /* !(JERRY_BUILTIN_ANNEXB) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (16, LIT_MAGIC_STRING_DEFINE_PROPERTIES_UL)\n#endif /* JERRY_BUILTIN_ANNEXB */\n#if JERRY_BUILTIN_TYPEDARRAY\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U)\n#else /* !(JERRY_BUILTIN_TYPEDARRAY) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL)\n#endif /* JERRY_BUILTIN_TYPEDARRAY */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (18, LIT_MAGIC_STRING_DECODE_URI_COMPONENT)\n#if JERRY_FUNCTION_TO_STRING\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (19, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON)\n#else /* !(JERRY_FUNCTION_TO_STRING) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (19, LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL)\n#endif /* JERRY_FUNCTION_TO_STRING */\n#if JERRY_FUNCTION_TO_STRING\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (20, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_GENERATOR)\n#else /* !(JERRY_FUNCTION_TO_STRING) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (20, LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL)\n#endif /* JERRY_FUNCTION_TO_STRING */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (21, LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL)\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (22, LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL)\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (23, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL)\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (24, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL)\n#if JERRY_FUNCTION_TO_STRING\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (25, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC)\n#else /* !(JERRY_FUNCTION_TO_STRING) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (25, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTORS_UL)\n#endif /* JERRY_FUNCTION_TO_STRING */\n#if JERRY_FUNCTION_TO_STRING\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (26, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC_GENERATOR)\n#else /* !(JERRY_FUNCTION_TO_STRING) */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (26, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)\n#endif /* JERRY_FUNCTION_TO_STRING */\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (27, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (28, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (29, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)\n#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (30, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)\n#endif /* JERRY_SNAPSHOT_EXEC \\\n|| !(JERRY_FUNCTION_TO_STRING) */\n#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (31, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)\n#endif /* JERRY_SNAPSHOT_EXEC \\\n|| !(JERRY_FUNCTION_TO_STRING) */\n#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)\nLIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (32, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)\n#endif /* JERRY_SNAPSHOT_EXEC \\\n|| !(JERRY_FUNCTION_TO_STRING) */\n"
  },
  {
    "path": "jerry-core/lit/lit-magic-strings.ini",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# List of ECMA magic strings\n#\n# These strings must be ascii strings. The NULL character cannot be part of\n# magic strings, because it must be the terminator character of all magic\n# strings.\n#\n# If the list is modified, tools/gen-strings.py must be executed!\n\n[LIT_MAGIC_STRINGS]\n\nLIT_MAGIC_STRING__EMPTY = \"\"\nLIT_MAGIC_STRING_ASTERIX_CHAR = \"*\"\nLIT_MAGIC_STRING_SPACE_CHAR = \" \"\nLIT_MAGIC_STRING_COMMA_CHAR = \",\"\nLIT_MAGIC_STRING_E_U = \"E\"\nLIT_MAGIC_STRING_LEFT_SQUARE_CHAR = \"[\"\nLIT_MAGIC_STRING_RIGHT_SQUARE_CHAR = \"]\"\nLIT_MAGIC_STRING_PI_U = \"PI\"\nLIT_MAGIC_STRING_AT = \"at\"\nLIT_MAGIC_STRING_IS = \"is\"\nLIT_MAGIC_STRING_OF = \"of\"\nLIT_MAGIC_STRING_ATOMICS_OR = \"or\"\nLIT_MAGIC_STRING_LN2_U = \"LN2\"\nLIT_MAGIC_STRING_MAP_UL = \"Map\"\nLIT_MAGIC_STRING_NAN = \"NaN\"\nLIT_MAGIC_STRING_SET_UL = \"Set\"\nLIT_MAGIC_STRING_UTC_U = \"UTC\"\nLIT_MAGIC_STRING_ABS = \"abs\"\nLIT_MAGIC_STRING_ADD = \"add\"\nLIT_MAGIC_STRING_ATOMICS_AND = \"and\"\nLIT_MAGIC_STRING_ATOMICS_SUB = \"sub\"\nLIT_MAGIC_STRING_ALL = \"all\"\nLIT_MAGIC_STRING_ANY = \"any\"\nLIT_MAGIC_STRING_COS = \"cos\"\nLIT_MAGIC_STRING_EXP = \"exp\"\nLIT_MAGIC_STRING_FOR = \"for\"\nLIT_MAGIC_STRING_GET = \"get\"\nLIT_MAGIC_STRING_HAS = \"has\"\nLIT_MAGIC_STRING_LOG = \"log\"\nLIT_MAGIC_STRING_MAP = \"map\"\nLIT_MAGIC_STRING_MAX = \"max\"\nLIT_MAGIC_STRING_MIN = \"min\"\nLIT_MAGIC_STRING_NOW = \"now\"\nLIT_MAGIC_STRING_POP = \"pop\"\nLIT_MAGIC_STRING_POW = \"pow\"\nLIT_MAGIC_STRING_RAW = \"raw\"\nLIT_MAGIC_STRING_SET = \"set\"\nLIT_MAGIC_STRING_SIN = \"sin\"\nLIT_MAGIC_STRING_TAN = \"tan\"\nLIT_MAGIC_STRING_ATOMICS_XOR = \"xor\"\nLIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP = \"(?:)\"\nLIT_MAGIC_STRING_DATE_UL = \"Date\"\nLIT_MAGIC_STRING_JSON_U = \"JSON\"\nLIT_MAGIC_STRING_LN10_U = \"LN10\"\nLIT_MAGIC_STRING_ATOMICS_LOAD = \"load\"\nLIT_MAGIC_STRING_MATH_UL = \"Math\"\nLIT_MAGIC_STRING_NULL_UL = \"Null\"\nLIT_MAGIC_STRING_ACOS = \"acos\"\nLIT_MAGIC_STRING_ASIN = \"asin\"\nLIT_MAGIC_STRING_ATAN = \"atan\"\nLIT_MAGIC_STRING_BIND = \"bind\"\nLIT_MAGIC_STRING_CALL = \"call\"\nLIT_MAGIC_STRING_CBRT = \"cbrt\"\nLIT_MAGIC_STRING_CEIL = \"ceil\"\nLIT_MAGIC_STRING_COSH = \"cosh\"\nLIT_MAGIC_STRING_DONE = \"done\"\nLIT_MAGIC_STRING_EVAL = \"eval\"\nLIT_MAGIC_STRING_EXEC = \"exec\"\nLIT_MAGIC_STRING_FILL = \"fill\"\nLIT_MAGIC_STRING_FIND = \"find\"\nLIT_MAGIC_STRING_FLAT = \"flat\"\nLIT_MAGIC_STRING_FROM = \"from\"\nLIT_MAGIC_STRING_IMUL = \"imul\"\nLIT_MAGIC_STRING_JOIN = \"join\"\nLIT_MAGIC_STRING_KEYS = \"keys\"\nLIT_MAGIC_STRING_LOG2 = \"log2\"\nLIT_MAGIC_STRING_NAME = \"name\"\nLIT_MAGIC_STRING_NULL = \"null\"\nLIT_MAGIC_STRING_NEXT = \"next\"\nLIT_MAGIC_STRING_PUSH = \"push\"\nLIT_MAGIC_STRING_RACE = \"race\"\nLIT_MAGIC_STRING_SEAL = \"seal\"\nLIT_MAGIC_STRING_SIGN = \"sign\"\nLIT_MAGIC_STRING_SIZE = \"size\"\nLIT_MAGIC_STRING_SINH = \"sinh\"\nLIT_MAGIC_STRING_SOME = \"some\"\nLIT_MAGIC_STRING_SORT = \"sort\"\nLIT_MAGIC_STRING_SQRT = \"sqrt\"\nLIT_MAGIC_STRING_TANH = \"tanh\"\nLIT_MAGIC_STRING_TEST = \"test\"\nLIT_MAGIC_STRING_THEN = \"then\"\nLIT_MAGIC_STRING_TRIM = \"trim\"\nLIT_MAGIC_STRING_TRUE = \"true\"\nLIT_MAGIC_STRING_ATOMICS_WAIT = \"wait\"\nLIT_MAGIC_STRING_ARRAY_UL = \"Array\"\nLIT_MAGIC_STRING_ERROR_UL = \"Error\"\nLIT_MAGIC_STRING_PROXY_UL = \"Proxy\"\nLIT_MAGIC_STRING_LOG2E_U = \"LOG2E\"\nLIT_MAGIC_STRING_SQRT2_U = \"SQRT2\"\nLIT_MAGIC_STRING_ACOSH = \"acosh\"\nLIT_MAGIC_STRING_APPLY = \"apply\"\nLIT_MAGIC_STRING_ASINH = \"asinh\"\nLIT_MAGIC_STRING_ATAN2 = \"atan2\"\nLIT_MAGIC_STRING_ATANH = \"atanh\"\nLIT_MAGIC_STRING_CATCH = \"catch\"\nLIT_MAGIC_STRING_CLEAR = \"clear\"\nLIT_MAGIC_STRING_CLZ32 = \"clz32\"\nLIT_MAGIC_STRING_DEREF = \"deref\"\nLIT_MAGIC_STRING_EVERY = \"every\"\nLIT_MAGIC_STRING_EXPM1 = \"expm1\"\nLIT_MAGIC_STRING_FALSE = \"false\"\nLIT_MAGIC_STRING_FLAGS = \"flags\"\nLIT_MAGIC_STRING_FLOOR = \"floor\"\nLIT_MAGIC_STRING_HYPOT = \"hypot\"\nLIT_MAGIC_STRING_INDEX = \"index\"\nLIT_MAGIC_STRING_INPUT = \"input\"\nLIT_MAGIC_STRING_IS_NAN = \"isNaN\"\nLIT_MAGIC_STRING_LOG1P = \"log1p\"\nLIT_MAGIC_STRING_LOG10 = \"log10\"\nLIT_MAGIC_STRING_MATCH = \"match\"\nLIT_MAGIC_STRING_PARSE = \"parse\"\nLIT_MAGIC_STRING_PROXY = \"proxy\"\nLIT_MAGIC_STRING_ROUND = \"round\"\nLIT_MAGIC_STRING_SHIFT = \"shift\"\nLIT_MAGIC_STRING_SLICE = \"slice\"\nLIT_MAGIC_STRING_SPLIT = \"split\"\nLIT_MAGIC_STRING_STACK = \"stack\"\nLIT_MAGIC_STRING_ATOMICS_STORE = \"store\"\nLIT_MAGIC_STRING_THROW = \"throw\"\nLIT_MAGIC_STRING_TRUNC = \"trunc\"\nLIT_MAGIC_STRING_VALUE = \"value\"\nLIT_MAGIC_STRING_SOURCE_NAME_EVAL = \"<eval>\"\nLIT_MAGIC_STRING_AS_INT_N = \"asIntN\"\nLIT_MAGIC_STRING_AS_U_INT_N = \"asUintN\"\nLIT_MAGIC_STRING_BIGINT_UL = \"BigInt\"\nLIT_MAGIC_STRING_ERRORS_UL = \"errors\"\nLIT_MAGIC_STRING_HAS_OWN_UL = \"hasOwn\"\nLIT_MAGIC_STRING_LOG10E_U = \"LOG10E\"\nLIT_MAGIC_STRING_MODULE_UL = \"Module\"\nLIT_MAGIC_STRING_NUMBER_UL = \"Number\"\nLIT_MAGIC_STRING_OBJECT_UL = \"Object\"\nLIT_MAGIC_STRING_REGEXP_UL = \"RegExp\"\nLIT_MAGIC_STRING_SCRIPT_UL = \"Script\"\nLIT_MAGIC_STRING_STRING_UL = \"String\"\nLIT_MAGIC_STRING_SYMBOL_UL = \"Symbol\"\nLIT_MAGIC_STRING_ASSIGN = \"assign\"\nLIT_MAGIC_STRING_BIGINT = \"bigint\"\nLIT_MAGIC_STRING_BUFFER = \"buffer\"\nLIT_MAGIC_STRING_CALLEE = \"callee\"\nLIT_MAGIC_STRING_CALLER = \"caller\"\nLIT_MAGIC_STRING_CHAR_AT_UL = \"charAt\"\nLIT_MAGIC_STRING_CONCAT = \"concat\"\nLIT_MAGIC_STRING_CREATE = \"create\"\nLIT_MAGIC_STRING_DELETE = \"delete\"\nLIT_MAGIC_STRING_ESCAPE = \"escape\"\nLIT_MAGIC_STRING_FILTER = \"filter\"\nLIT_MAGIC_STRING_FREEZE = \"freeze\"\nLIT_MAGIC_STRING_FROUND = \"fround\"\nLIT_MAGIC_STRING_GET_DAY_UL = \"getDay\"\nLIT_MAGIC_STRING_GLOBAL = \"global\"\nLIT_MAGIC_STRING_IS_VIEW_UL = \"isView\"\nLIT_MAGIC_STRING_KEY_FOR = \"keyFor\"\nLIT_MAGIC_STRING_LENGTH = \"length\"\nLIT_MAGIC_STRING_ATOMICS_NOTIFY = \"notify\"\nLIT_MAGIC_STRING_NUMBER = \"number\"\nLIT_MAGIC_STRING_OBJECT = \"object\"\nLIT_MAGIC_STRING_PAD_END = \"padEnd\"\nLIT_MAGIC_STRING_RANDOM = \"random\"\nLIT_MAGIC_STRING_REDUCE = \"reduce\"\nLIT_MAGIC_STRING_REJECT = \"reject\"\nLIT_MAGIC_STRING_REPEAT = \"repeat\"\nLIT_MAGIC_STRING_REVOKE = \"revoke\"\nLIT_MAGIC_STRING_RETURN = \"return\"\nLIT_MAGIC_STRING_SEARCH = \"search\"\nLIT_MAGIC_STRING_SOURCE = \"source\"\nLIT_MAGIC_STRING_SPLICE = \"splice\"\nLIT_MAGIC_STRING_STATUS = \"status\"\nLIT_MAGIC_STRING_STRING = \"string\"\nLIT_MAGIC_STRING_STICKY = \"sticky\"\nLIT_MAGIC_STRING_SYMBOL = \"symbol\"\nLIT_MAGIC_STRING_SUBSTR = \"substr\"\nLIT_MAGIC_STRING_ENTRIES = \"entries\"\nLIT_MAGIC_STRING_TO_JSON_UL = \"toJSON\"\nLIT_MAGIC_STRING_VALUES = \"values\"\nLIT_MAGIC_STRING_ATOMICS_U = \"Atomics\"\nLIT_MAGIC_STRING_BOOLEAN_UL = \"Boolean\"\nLIT_MAGIC_STRING_FINALLY = \"finally\"\nLIT_MAGIC_STRING_PROMISE_UL = \"Promise\"\nLIT_MAGIC_STRING_REFLECT_UL = \"Reflect\"\nLIT_MAGIC_STRING_SYMBOL_DOT_UL = \"Symbol.\"\nLIT_MAGIC_STRING_SQRT1_2_U = \"SQRT1_2\"\nLIT_MAGIC_STRING_BOOLEAN = \"boolean\"\nLIT_MAGIC_STRING_COMPILE = \"compile\"\nLIT_MAGIC_STRING_DEFAULT = \"default\"\nLIT_MAGIC_STRING_DOTALL = \"dotAll\"\nLIT_MAGIC_STRING_REASON = \"reason\"\nLIT_MAGIC_STRING_FLATMAP = \"flatMap\"\nLIT_MAGIC_STRING_FOR_EACH_UL = \"forEach\"\nLIT_MAGIC_STRING_GET_DATE_UL = \"getDate\"\nLIT_MAGIC_STRING_GET_INT8_UL = \"getInt8\"\nLIT_MAGIC_STRING_GET_TIME_UL = \"getTime\"\nLIT_MAGIC_STRING_GET_YEAR_UL = \"getYear\"\nLIT_MAGIC_STRING_INDEX_OF_UL = \"indexOf\"\nLIT_MAGIC_STRING_IS_ARRAY_UL = \"isArray\"\nLIT_MAGIC_STRING_MESSAGE = \"message\"\nLIT_MAGIC_STRING_OWN_KEYS_UL = \"ownKeys\"\nLIT_MAGIC_STRING_PAD_START = \"padStart\"\nLIT_MAGIC_STRING_REPLACE = \"replace\"\nLIT_MAGIC_STRING_RESOLVE = \"resolve\"\nLIT_MAGIC_STRING_REVERSE = \"reverse\"\nLIT_MAGIC_STRING_SET_DATE_UL = \"setDate\"\nLIT_MAGIC_STRING_SET_TIME_UL = \"setTime\"\nLIT_MAGIC_STRING_SET_INT8_UL = \"setInt8\"\nLIT_MAGIC_STRING_SET_YEAR_UL = \"setYear\"\nLIT_MAGIC_STRING_SPECIES = \"species\"\nLIT_MAGIC_STRING_TO_FIXED_UL = \"toFixed\"\nLIT_MAGIC_STRING_TRIM_END = \"trimEnd\"\nLIT_MAGIC_STRING_UNICODE = \"unicode\"\nLIT_MAGIC_STRING_UNSHIFT = \"unshift\"\nLIT_MAGIC_STRING_VALUE_OF_UL = \"valueOf\"\nLIT_MAGIC_STRING_WEAKMAP_UL = \"WeakMap\"\nLIT_MAGIC_STRING_WEAKREF_UL = \"WeakRef\"\nLIT_MAGIC_STRING_WEAKSET_UL = \"WeakSet\"\nLIT_MAGIC_STRING_EPSILON_U = \"EPSILON\"\nLIT_MAGIC_STRING_DATAVIEW_UL = \"DataView\"\nLIT_MAGIC_STRING_FUNCTION_UL = \"Function\"\nLIT_MAGIC_STRING_INFINITY_UL = \"Infinity\"\nLIT_MAGIC_STRING_MATCH_ALL = \"matchAll\"\nLIT_MAGIC_STRING_URI_ERROR_UL = \"URIError\"\nLIT_MAGIC_STRING_ENDS_WITH = \"endsWith\"\nLIT_MAGIC_STRING_ATOMICS_EXCHANGE = \"exchange\"\nLIT_MAGIC_STRING_FUNCTION = \"function\"\nLIT_MAGIC_STRING_GET_HOURS_UL = \"getHours\"\nLIT_MAGIC_STRING_GET_INT16_UL = \"getInt16\"\nLIT_MAGIC_STRING_GET_INT32_UL = \"getInt32\"\nLIT_MAGIC_STRING_GET_MONTH_UL = \"getMonth\"\nLIT_MAGIC_STRING_GET_UINT8_UL = \"getUint8\"\nLIT_MAGIC_STRING_INCLUDES = \"includes\"\nLIT_MAGIC_STRING_IS_FINITE = \"isFinite\"\nLIT_MAGIC_STRING_IS_FROZEN_UL = \"isFrozen\"\nLIT_MAGIC_STRING_IS_SEALED_UL = \"isSealed\"\nLIT_MAGIC_STRING_ITERATOR = \"iterator\"\nLIT_MAGIC_STRING_PARSE_INT = \"parseInt\"\nLIT_MAGIC_STRING_REJECTED = \"rejected\"\nLIT_MAGIC_STRING_SET_HOURS_UL = \"setHours\"\nLIT_MAGIC_STRING_SET_INT16_UL = \"setInt16\"\nLIT_MAGIC_STRING_SET_INT32_UL = \"setInt32\"\nLIT_MAGIC_STRING_SET_MONTH_UL = \"setMonth\"\nLIT_MAGIC_STRING_SET_UINT8_UL = \"setUint8\"\nLIT_MAGIC_STRING_SUBARRAY = \"subarray\"\nLIT_MAGIC_STRING_TO_STRING_UL = \"toString\"\nLIT_MAGIC_STRING_TRIM_LEFT = \"trimLeft\"\nLIT_MAGIC_STRING_UNESCAPE = \"unescape\"\nLIT_MAGIC_STRING_WRITABLE = \"writable\"\nLIT_MAGIC_STRING_OBJECT_TO_STRING_UL = \"[object \"\nLIT_MAGIC_STRING_NEGATIVE_INFINITY_UL = \"-Infinity\"\nLIT_MAGIC_STRING_ARGUMENTS_UL = \"Arguments\"\nLIT_MAGIC_STRING_ANONYMOUS = \"anonymous\"\nLIT_MAGIC_STRING_CONSTRUCT = \"construct\"\nLIT_MAGIC_STRING_EVAL_ERROR_UL = \"EvalError\"\nLIT_MAGIC_STRING_ALLSETTLED = \"allSettled\"\nLIT_MAGIC_STRING_INT8_ARRAY_UL = \"Int8Array\"\nLIT_MAGIC_STRING_IS_INTEGER = \"isInteger\"\nLIT_MAGIC_STRING_MAX_VALUE_U = \"MAX_VALUE\"\nLIT_MAGIC_STRING_MIN_VALUE_U = \"MIN_VALUE\"\nLIT_MAGIC_STRING_TYPE_ERROR_UL = \"TypeError\"\nLIT_MAGIC_STRING_UNDEFINED_UL = \"Undefined\"\nLIT_MAGIC_STRING__PROTO__ = \"__proto__\"\nLIT_MAGIC_STRING_ARGUMENTS = \"arguments\"\nLIT_MAGIC_STRING_DECODE_URI = \"decodeURI\"\nLIT_MAGIC_STRING_ENCODE_URI = \"encodeURI\"\nLIT_MAGIC_STRING_FIND_INDEX = \"findIndex\"\nLIT_MAGIC_STRING_FULFILLED = \"fulfilled\"\nLIT_MAGIC_STRING_GENERATOR_UL = \"Generator\"\nLIT_MAGIC_STRING_GET_UTC_DAY_UL = \"getUTCDay\"\nLIT_MAGIC_STRING_GET_UINT16_UL = \"getUint16\"\nLIT_MAGIC_STRING_GET_UINT32_UL = \"getUint32\"\nLIT_MAGIC_STRING_ATOMICS_ISLOCKFREE = \"isLockFree\"\nLIT_MAGIC_STRING_LASTINDEX_UL = \"lastIndex\"\nLIT_MAGIC_STRING_MULTILINE = \"multiline\"\nLIT_MAGIC_STRING_PROTOTYPE = \"prototype\"\nLIT_MAGIC_STRING_REVOCABLE = \"revocable\"\nLIT_MAGIC_STRING_STRINGIFY = \"stringify\"\nLIT_MAGIC_STRING_SET_UINT16_UL = \"setUint16\"\nLIT_MAGIC_STRING_SET_UINT32_UL = \"setUint32\"\nLIT_MAGIC_STRING_SUBSTRING = \"substring\"\nLIT_MAGIC_STRING_TRIM_RIGHT = \"trimRight\"\nLIT_MAGIC_STRING_TRIM_START = \"trimStart\"\nLIT_MAGIC_STRING_UNDEFINED = \"undefined\"\nLIT_MAGIC_STRING_INT16_ARRAY_UL = \"Int16Array\"\nLIT_MAGIC_STRING_INT32_ARRAY_UL = \"Int32Array\"\nLIT_MAGIC_STRING_RANGE_ERROR_UL = \"RangeError\"\nLIT_MAGIC_STRING_TYPED_ARRAY_UL = \"TypedArray\"\nLIT_MAGIC_STRING_UINT8_ARRAY_UL = \"Uint8Array\"\nLIT_MAGIC_STRING_BYTE_LENGTH_UL = \"byteLength\"\nLIT_MAGIC_STRING_BYTE_OFFSET_UL = \"byteOffset\"\nLIT_MAGIC_STRING_CHAR_CODE_AT_UL = \"charCodeAt\"\nLIT_MAGIC_STRING_COPY_WITHIN = \"copyWithin\"\nLIT_MAGIC_STRING_ENUMERABLE = \"enumerable\"\nLIT_MAGIC_STRING_GET_FLOAT_32_UL = \"getFloat32\"\nLIT_MAGIC_STRING_GET_FLOAT_64_UL = \"getFloat64\"\nLIT_MAGIC_STRING_GET_MINUTES_UL = \"getMinutes\"\nLIT_MAGIC_STRING_GET_SECONDS_UL = \"getSeconds\"\nLIT_MAGIC_STRING_GET_UTC_DATE_UL = \"getUTCDate\"\nLIT_MAGIC_STRING_GLOBAL_THIS_UL = \"globalThis\"\nLIT_MAGIC_STRING_IGNORECASE_UL = \"ignoreCase\"\nLIT_MAGIC_STRING_PARSE_FLOAT = \"parseFloat\"\nLIT_MAGIC_STRING_REPLACE_ALL = \"replaceAll\"\nLIT_MAGIC_STRING_SET_FLOAT_32_UL = \"setFloat32\"\nLIT_MAGIC_STRING_SET_FLOAT_64_UL = \"setFloat64\"\nLIT_MAGIC_STRING_SET_MINUTES_UL = \"setMinutes\"\nLIT_MAGIC_STRING_SET_SECONDS_UL = \"setSeconds\"\nLIT_MAGIC_STRING_SET_UTC_DATE_UL = \"setUTCDate\"\nLIT_MAGIC_STRING_STARTS_WITH = \"startsWith\"\nLIT_MAGIC_STRING_SOURCE_NAME_ANON = \"<anonymous>\"\nLIT_MAGIC_STRING_ARRAY_BUFFER_UL = \"ArrayBuffer\"\nLIT_MAGIC_STRING_DESCRIPTION = \"description\"\nLIT_MAGIC_STRING_SYNTAX_ERROR_UL = \"SyntaxError\"\nLIT_MAGIC_STRING_UINT16_ARRAY_UL = \"Uint16Array\"\nLIT_MAGIC_STRING_UINT32_ARRAY_UL = \"Uint32Array\"\nLIT_MAGIC_STRING_CONSTRUCTOR = \"constructor\"\nLIT_MAGIC_STRING_CODE_POINT_AT = \"codePointAt\"\nLIT_MAGIC_STRING_OBJECT_FROM_ENTRIES = \"fromEntries\"\nLIT_MAGIC_STRING_GET_BIGINT64 = \"getBigInt64\"\nLIT_MAGIC_STRING_GET_FULL_YEAR_UL = \"getFullYear\"\nLIT_MAGIC_STRING_GET_UTC_HOURS_UL = \"getUTCHours\"\nLIT_MAGIC_STRING_GET_UTC_MONTH_UL = \"getUTCMonth\"\nLIT_MAGIC_STRING_HAS_INSTANCE = \"hasInstance\"\nLIT_MAGIC_STRING_LAST_INDEX_OF_UL = \"lastIndexOf\"\nLIT_MAGIC_STRING_REDUCE_RIGHT_UL = \"reduceRight\"\nLIT_MAGIC_STRING_SET_BIGINT64 = \"setBigInt64\"\nLIT_MAGIC_STRING_SET_FULL_YEAR_UL = \"setFullYear\"\nLIT_MAGIC_STRING_SET_UTC_HOURS_UL = \"setUTCHours\"\nLIT_MAGIC_STRING_SET_UTC_MONTH_UL = \"setUTCMonth\"\nLIT_MAGIC_STRING_TO_GMT_STRING_UL = \"toGMTString\"\nLIT_MAGIC_STRING_TO_ISO_STRING_UL = \"toISOString\"\nLIT_MAGIC_STRING_TO_LOWER_CASE_UL = \"toLowerCase\"\nLIT_MAGIC_STRING_TO_PRECISION_UL = \"toPrecision\"\nLIT_MAGIC_STRING_TO_PRIMITIVE = \"toPrimitive\"\nLIT_MAGIC_STRING_TO_STRING_TAG = \"toStringTag\"\nLIT_MAGIC_STRING_TO_UTC_STRING_UL = \"toUTCString\"\nLIT_MAGIC_STRING_TO_UPPER_CASE_UL = \"toUpperCase\"\nLIT_MAGIC_STRING_UNSCOPABLES = \"unscopables\"\nLIT_MAGIC_STRING_FLOAT32_ARRAY_UL = \"Float32Array\"\nLIT_MAGIC_STRING_FLOAT64_ARRAY_UL = \"Float64Array\"\nLIT_MAGIC_STRING_INVALID_DATE_UL = \"Invalid Date\"\nLIT_MAGIC_STRING_SET_ITERATOR_UL = \"Set Iterator\"\nLIT_MAGIC_STRING_MAP_ITERATOR_UL = \"Map Iterator\"\nLIT_MAGIC_STRING_CONFIGURABLE = \"configurable\"\nLIT_MAGIC_STRING_FROM_CHAR_CODE_UL = \"fromCharCode\"\nLIT_MAGIC_STRING_FROM_CODE_POINT_UL = \"fromCodePoint\"\nLIT_MAGIC_STRING_GET_BIGUINT64 = \"getBigUint64\"\nLIT_MAGIC_STRING_IS_EXTENSIBLE = \"isExtensible\"\nLIT_MAGIC_STRING_SET_BIGUINT64 = \"setBigUint64\"\nLIT_MAGIC_STRING_TO_DATE_STRING_UL = \"toDateString\"\nLIT_MAGIC_STRING_TO_TIME_STRING_UL = \"toTimeString\"\nLIT_MAGIC_STRING_ASYNC_FUNCTION_UL = \"AsyncFunction\"\nLIT_MAGIC_STRING_BIGINT64_ARRAY_UL = \"BigInt64Array\"\nLIT_MAGIC_STRING_ASYNC_ITERATOR = \"asyncIterator\"\nLIT_MAGIC_STRING_GET_UTC_MINUTES_UL = \"getUTCMinutes\"\nLIT_MAGIC_STRING_GET_UTC_SECONDS_UL = \"getUTCSeconds\"\nLIT_MAGIC_STRING_IS_PROTOTYPE_OF_UL = \"isPrototypeOf\"\nLIT_MAGIC_STRING_IS_SAFE_INTEGER = \"isSafeInteger\"\nLIT_MAGIC_STRING_LOCALE_COMPARE_UL = \"localeCompare\"\nLIT_MAGIC_STRING_SET_UTC_MINUTES_UL = \"setUTCMinutes\"\nLIT_MAGIC_STRING_SET_UTC_SECONDS_UL = \"setUTCSeconds\"\nLIT_MAGIC_STRING_TO_EXPONENTIAL_UL = \"toExponential\"\nLIT_MAGIC_STRING_AGGREGATE_ERROR_UL = \"AggregateError\"\nLIT_MAGIC_STRING_ARRAY_ITERATOR_UL = \"Array Iterator\"\nLIT_MAGIC_STRING_ASYNC_GENERATOR_UL = \"AsyncGenerator\"\nLIT_MAGIC_STRING_BIGUINT64_ARRAY_UL = \"BigUint64Array\"\nLIT_MAGIC_STRING_REFERENCE_ERROR_UL = \"ReferenceError\"\nLIT_MAGIC_STRING_DEFINE_PROPERTY_UL = \"defineProperty\"\nLIT_MAGIC_STRING_DELETE_PROPERTY_UL = \"deleteProperty\"\nLIT_MAGIC_STRING_GET_PROTOTYPE_OF_UL = \"getPrototypeOf\"\nLIT_MAGIC_STRING_GET_UTC_FULL_YEAR_UL = \"getUTCFullYear\"\nLIT_MAGIC_STRING_HAS_OWN_PROPERTY_UL = \"hasOwnProperty\"\nLIT_MAGIC_STRING_SET_PROTOTYPE_OF_UL = \"setPrototypeOf\"\nLIT_MAGIC_STRING_SET_UTC_FULL_YEAR_UL = \"setUTCFullYear\"\nLIT_MAGIC_STRING_TO_LOCALE_STRING_UL = \"toLocaleString\"\nLIT_MAGIC_STRING_STRING_ITERATOR_UL = \"String Iterator\"\nLIT_MAGIC_STRING_ATOMICS_COMPAREEXCHANGE = \"compareExchange\"\nLIT_MAGIC_STRING_GET_MILLISECONDS_UL = \"getMilliseconds\"\nLIT_MAGIC_STRING_SET_MILLISECONDS_UL = \"setMilliseconds\"\nLIT_MAGIC_STRING_DEFINE_PROPERTIES_UL = \"defineProperties\"\nLIT_MAGIC_STRING_MAX_SAFE_INTEGER_U = \"MAX_SAFE_INTEGER\"\nLIT_MAGIC_STRING_MIN_SAFE_INTEGER_U = \"MIN_SAFE_INTEGER\"\nLIT_MAGIC_STRING_DEFINE_GETTER = \"__defineGetter__\"\nLIT_MAGIC_STRING_DEFINE_SETTER = \"__defineSetter__\"\nLIT_MAGIC_STRING_LOOKUP_GETTER = \"__lookupGetter__\"\nLIT_MAGIC_STRING_LOOKUP_SETTER = \"__lookupSetter__\"\nLIT_MAGIC_STRING_BYTES_PER_ELEMENT_U = \"BYTES_PER_ELEMENT\"\nLIT_MAGIC_STRING_NEGATIVE_INFINITY_U = \"NEGATIVE_INFINITY\"\nLIT_MAGIC_STRING_POSITIVE_INFINITY_U = \"POSITIVE_INFINITY\"\nLIT_MAGIC_STRING_GENERATOR_FUNCTION_UL = \"GeneratorFunction\"\nLIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL = \"SharedArrayBuffer\"\nLIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL = \"Uint8ClampedArray\"\nLIT_MAGIC_STRING_GET_TIMEZONE_OFFSET_UL = \"getTimezoneOffset\"\nLIT_MAGIC_STRING_PREVENT_EXTENSIONS_UL = \"preventExtensions\"\nLIT_MAGIC_STRING_TO_LOCALE_LOWER_CASE_UL = \"toLocaleLowerCase\"\nLIT_MAGIC_STRING_TO_LOCALE_UPPER_CASE_UL = \"toLocaleUpperCase\"\nLIT_MAGIC_STRING_DECODE_URI_COMPONENT = \"decodeURIComponent\"\nLIT_MAGIC_STRING_ENCODE_URI_COMPONENT = \"encodeURIComponent\"\nLIT_MAGIC_STRING_GET_UTC_MILLISECONDS_UL = \"getUTCMilliseconds\"\nLIT_MAGIC_STRING_IS_CONCAT_SPREADABLE = \"isConcatSpreadable\"\nLIT_MAGIC_STRING_SET_UTC_MILLISECONDS_UL = \"setUTCMilliseconds\"\nLIT_MAGIC_STRING_TO_LOCALE_DATE_STRING_UL = \"toLocaleDateString\"\nLIT_MAGIC_STRING_TO_LOCALE_TIME_STRING_UL = \"toLocaleTimeString\"\nLIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL = \"getOwnPropertyNames\"\nLIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON = \"function anonymous(\"\nLIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_GENERATOR = \"function* anonymous(\"\nLIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL = \"propertyIsEnumerable\"\nLIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL = \"getOwnPropertySymbols\"\nLIT_MAGIC_STRING_REGEXP_STRING_ITERATOR_UL = \"RegExp String Iterator\"\nLIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL = \"AsyncGeneratorFunction\"\nLIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL = \"getOwnPropertyDescriptor\"\nLIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC = \"async function anonymous(\"\nLIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTORS_UL = \"getOwnPropertyDescriptors\"\nLIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC_GENERATOR = \"async function* anonymous(\"\nLIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE = \"function () { [native code] }\"\nLIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA = \"function () { /* ecmascript */ }\"\n"
  },
  {
    "path": "jerry-core/lit/lit-strings.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"lit-strings.h\"\n\n#include \"jrt-libc-includes.h\"\n\n#define LIT_UTF8_SURROGATE_MARKER     0xed /**< utf8 surrogate marker */\n#define LIT_UTF8_HIGH_SURROGATE_MIN   0xa0 /**< utf8 high surrogate minimum */\n#define LIT_UTF8_HIGH_SURROGATE_MAX   0xaf /**< utf8 high surrogate maximum */\n#define LIT_UTF8_LOW_SURROGATE_MIN    0xb0 /**< utf8 low surrogate minimum */\n#define LIT_UTF8_LOW_SURROGATE_MAX    0xbf /**< utf8 low surrogate maximum */\n#define LIT_UTF8_1_BYTE_MAX           0xf4 /**< utf8 one byte max */\n#define LIT_UTF8_2_BYTE_MAX           0x8f /**< utf8 two byte max */\n#define LIT_UTF8_VALID_TWO_BYTE_START 0xc2 /**< utf8 two byte start */\n\n/**\n * Validate utf-8 string\n *\n * NOTE:\n *   Isolated surrogates are allowed.\n *\n * @return true if utf-8 string is well-formed\n *         false otherwise\n */\nbool\nlit_is_valid_utf8_string (const lit_utf8_byte_t *utf8_buf_p, /**< utf-8 string */\n                          lit_utf8_size_t buf_size, /**< string size */\n                          bool is_strict) /**< true if surrogate pairs are not allowed */\n{\n  const unsigned char *end = buf_size + utf8_buf_p;\n\n  const unsigned char *idx = (const unsigned char *) utf8_buf_p;\n\n  while (idx < end)\n  {\n    const uint8_t first_byte = *idx++;\n\n    if (first_byte < LIT_UTF8_EXTRA_BYTE_MARKER)\n    {\n      continue;\n    }\n\n    if (first_byte < LIT_UTF8_VALID_TWO_BYTE_START || idx >= end)\n    {\n      return false;\n    }\n\n    const uint8_t second_byte = *idx++;\n\n    if ((second_byte & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER)\n    {\n      return false;\n    }\n\n    if (first_byte < LIT_UTF8_3_BYTE_MARKER)\n    {\n      continue;\n    }\n\n    if (idx >= end || (*idx++ & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER)\n    {\n      return false;\n    }\n\n    if (first_byte < LIT_UTF8_4_BYTE_MARKER)\n    {\n      if (first_byte == LIT_UTF8_3_BYTE_MARKER && (second_byte & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_EXTRA_BYTE_MARKER)\n      {\n        return false;\n      }\n\n      if (is_strict && first_byte == LIT_UTF8_SURROGATE_MARKER && second_byte >= LIT_UTF8_HIGH_SURROGATE_MIN\n          && second_byte <= LIT_UTF8_HIGH_SURROGATE_MAX && idx + 3 <= end && idx[0] == LIT_UTF8_SURROGATE_MARKER\n          && idx[1] >= LIT_UTF8_LOW_SURROGATE_MIN && idx[1] <= LIT_UTF8_LOW_SURROGATE_MAX)\n      {\n        return false;\n      }\n      continue;\n    }\n\n    if (idx >= end || first_byte > LIT_UTF8_1_BYTE_MAX\n        || (first_byte == LIT_UTF8_4_BYTE_MARKER && second_byte <= LIT_UTF8_EXTRA_BYTE_MARKER)\n        || (first_byte == LIT_UTF8_1_BYTE_MAX && second_byte > LIT_UTF8_2_BYTE_MAX)\n        || (*idx++ & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER)\n    {\n      return false;\n    }\n  }\n\n  return true;\n} /* lit_is_valid_utf8_string */\n\n/**\n * Validate cesu-8 string\n *\n * @return true if cesu-8 string is well-formed\n *         false otherwise\n */\nbool\nlit_is_valid_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, /**< cesu-8 string */\n                           lit_utf8_size_t buf_size) /**< string size */\n{\n  lit_utf8_size_t idx = 0;\n\n  while (idx < buf_size)\n  {\n    lit_utf8_byte_t c = cesu8_buf_p[idx++];\n    if ((c & LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER)\n    {\n      continue;\n    }\n\n    lit_code_point_t code_point = 0;\n    lit_code_point_t min_code_point = 0;\n    lit_utf8_size_t extra_bytes_count;\n    if ((c & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER)\n    {\n      extra_bytes_count = 1;\n      min_code_point = LIT_UTF8_2_BYTE_CODE_POINT_MIN;\n      code_point = ((uint32_t) (c & LIT_UTF8_LAST_5_BITS_MASK));\n    }\n    else if ((c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER)\n    {\n      extra_bytes_count = 2;\n      min_code_point = LIT_UTF8_3_BYTE_CODE_POINT_MIN;\n      code_point = ((uint32_t) (c & LIT_UTF8_LAST_4_BITS_MASK));\n    }\n    else\n    {\n      return false;\n    }\n\n    if (idx + extra_bytes_count > buf_size)\n    {\n      /* cesu-8 string breaks in the middle */\n      return false;\n    }\n\n    for (lit_utf8_size_t offset = 0; offset < extra_bytes_count; ++offset)\n    {\n      c = cesu8_buf_p[idx + offset];\n      if ((c & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER)\n      {\n        /* invalid continuation byte */\n        return false;\n      }\n      code_point <<= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n      code_point |= (c & LIT_UTF8_LAST_6_BITS_MASK);\n    }\n\n    if (code_point < min_code_point)\n    {\n      /* cesu-8 string doesn't encode valid unicode code point */\n      return false;\n    }\n\n    idx += extra_bytes_count;\n  }\n\n  return true;\n} /* lit_is_valid_cesu8_string */\n\n/**\n * Check if the code point is UTF-16 low surrogate\n *\n * @return true / false\n */\nbool\nlit_is_code_point_utf16_low_surrogate (lit_code_point_t code_point) /**< code point */\n{\n  return LIT_UTF16_LOW_SURROGATE_MIN <= code_point && code_point <= LIT_UTF16_LOW_SURROGATE_MAX;\n} /* lit_is_code_point_utf16_low_surrogate */\n\n/**\n * Check if the code point is UTF-16 high surrogate\n *\n * @return true / false\n */\nbool\nlit_is_code_point_utf16_high_surrogate (lit_code_point_t code_point) /**< code point */\n{\n  return LIT_UTF16_HIGH_SURROGATE_MIN <= code_point && code_point <= LIT_UTF16_HIGH_SURROGATE_MAX;\n} /* lit_is_code_point_utf16_high_surrogate */\n\n/**\n * Represents code point (>0xFFFF) as surrogate pair and returns its lower part\n *\n * @return lower code_unit of the surrogate pair\n */\nstatic ecma_char_t\nconvert_code_point_to_low_surrogate (lit_code_point_t code_point) /**< code point, should be > 0xFFFF */\n{\n  JERRY_ASSERT (code_point > LIT_UTF16_CODE_UNIT_MAX);\n\n  ecma_char_t code_unit_bits;\n  code_unit_bits = (ecma_char_t) (code_point & LIT_UTF16_LAST_10_BITS_MASK);\n\n  return (ecma_char_t) (LIT_UTF16_LOW_SURROGATE_MARKER | code_unit_bits);\n} /* convert_code_point_to_low_surrogate */\n\n/**\n * Represents code point (>0xFFFF) as surrogate pair and returns its higher part\n *\n * @return higher code_unit of the surrogate pair\n */\nstatic ecma_char_t\nconvert_code_point_to_high_surrogate (lit_code_point_t code_point) /**< code point, should be > 0xFFFF */\n{\n  JERRY_ASSERT (code_point > LIT_UTF16_CODE_UNIT_MAX);\n  JERRY_ASSERT (code_point <= LIT_UNICODE_CODE_POINT_MAX);\n\n  ecma_char_t code_unit_bits;\n  code_unit_bits = (ecma_char_t) ((code_point - LIT_UTF16_FIRST_SURROGATE_CODE_POINT) >> LIT_UTF16_BITS_IN_SURROGATE);\n\n  return (LIT_UTF16_HIGH_SURROGATE_MARKER | code_unit_bits);\n} /* convert_code_point_to_high_surrogate */\n\n/**\n * UTF16 Encoding method for a code point\n *\n * See also:\n *          ECMA-262 v6, 10.1.1\n *\n * @return uint8_t, the number of returning code points\n */\nuint8_t\nlit_utf16_encode_code_point (lit_code_point_t cp, /**< the code point we encode */\n                             ecma_char_t *cu_p) /**< result of the encoding */\n{\n  if (cp <= LIT_UTF16_CODE_UNIT_MAX)\n  {\n    cu_p[0] = (ecma_char_t) cp;\n    return 1;\n  }\n\n  cu_p[0] = convert_code_point_to_high_surrogate (cp);\n  cu_p[1] = convert_code_point_to_low_surrogate (cp);\n  return 2;\n} /* lit_utf16_encode_code_point */\n\n/**\n * Calculate size of a zero-terminated utf-8 string\n *\n * NOTE:\n *   - string cannot be NULL\n *   - string should not contain zero characters in the middle\n *\n * @return size of a string\n */\nlit_utf8_size_t\nlit_zt_utf8_string_size (const lit_utf8_byte_t *utf8_str_p) /**< zero-terminated utf-8 string */\n{\n  JERRY_ASSERT (utf8_str_p != NULL);\n  return (lit_utf8_size_t) strlen ((const char *) utf8_str_p);\n} /* lit_zt_utf8_string_size */\n\n/**\n * Calculate length of a cesu-8 encoded string\n *\n * @return UTF-16 code units count\n */\nlit_utf8_size_t\nlit_utf8_string_length (const lit_utf8_byte_t *utf8_buf_p, /**< utf-8 string */\n                        lit_utf8_size_t utf8_buf_size) /**< string size */\n{\n  lit_utf8_size_t length = 0;\n  lit_utf8_size_t size = 0;\n\n  while (size < utf8_buf_size)\n  {\n    size += lit_get_unicode_char_size_by_utf8_first_byte (*(utf8_buf_p + size));\n    length++;\n  }\n\n  JERRY_ASSERT (size == utf8_buf_size);\n\n  return length;\n} /* lit_utf8_string_length */\n\n/**\n * Calculate the required size of an utf-8 encoded string from cesu-8 encoded string\n *\n * @return size of an utf-8 encoded string\n */\nlit_utf8_size_t\nlit_get_utf8_size_of_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, /**< cesu-8 string */\n                                   lit_utf8_size_t cesu8_buf_size) /**< string size */\n{\n  lit_utf8_size_t offset = 0;\n  lit_utf8_size_t utf8_buf_size = cesu8_buf_size;\n  ecma_char_t prev_ch = 0;\n\n  while (offset < cesu8_buf_size)\n  {\n    ecma_char_t ch;\n    offset += lit_read_code_unit_from_cesu8 (cesu8_buf_p + offset, &ch);\n\n    if (lit_is_code_point_utf16_low_surrogate (ch) && lit_is_code_point_utf16_high_surrogate (prev_ch))\n    {\n      utf8_buf_size -= 2;\n    }\n\n    prev_ch = ch;\n  }\n\n  JERRY_ASSERT (offset == cesu8_buf_size);\n\n  return utf8_buf_size;\n} /* lit_get_utf8_size_of_cesu8_string */\n\n/**\n * Calculate length of an utf-8 encoded string from cesu-8 encoded string\n *\n * @return length of an utf-8 encoded string\n */\nlit_utf8_size_t\nlit_get_utf8_length_of_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, /**< cesu-8 string */\n                                     lit_utf8_size_t cesu8_buf_size) /**< string size */\n{\n  lit_utf8_size_t offset = 0;\n  lit_utf8_size_t utf8_length = 0;\n  ecma_char_t prev_ch = 0;\n\n  while (offset < cesu8_buf_size)\n  {\n    ecma_char_t ch;\n    offset += lit_read_code_unit_from_cesu8 (cesu8_buf_p + offset, &ch);\n\n    if (!lit_is_code_point_utf16_low_surrogate (ch) || !lit_is_code_point_utf16_high_surrogate (prev_ch))\n    {\n      utf8_length++;\n    }\n\n    prev_ch = ch;\n  }\n\n  JERRY_ASSERT (offset == cesu8_buf_size);\n\n  return utf8_length;\n} /* lit_get_utf8_length_of_cesu8_string */\n\n/**\n * Decodes a unicode code point from non-empty utf-8-encoded buffer\n *\n * @return number of bytes occupied by code point in the string\n */\nlit_utf8_size_t\nlit_read_code_point_from_utf8 (const lit_utf8_byte_t *buf_p, /**< buffer with characters */\n                               lit_utf8_size_t buf_size, /**< size of the buffer in bytes */\n                               lit_code_point_t *code_point) /**< [out] code point */\n{\n  JERRY_ASSERT (buf_p && buf_size);\n\n  lit_utf8_byte_t c = buf_p[0];\n  if ((c & LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER)\n  {\n    *code_point = (lit_code_point_t) (c & LIT_UTF8_LAST_7_BITS_MASK);\n    return 1;\n  }\n\n  lit_code_point_t ret = LIT_UNICODE_CODE_POINT_NULL;\n  lit_utf8_size_t bytes_count = 0;\n  if ((c & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER)\n  {\n    bytes_count = 2;\n    ret = ((lit_code_point_t) (c & LIT_UTF8_LAST_5_BITS_MASK));\n  }\n  else if ((c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER)\n  {\n    bytes_count = 3;\n    ret = ((lit_code_point_t) (c & LIT_UTF8_LAST_4_BITS_MASK));\n  }\n  else\n  {\n    JERRY_ASSERT ((c & LIT_UTF8_4_BYTE_MASK) == LIT_UTF8_4_BYTE_MARKER);\n    bytes_count = 4;\n    ret = ((lit_code_point_t) (c & LIT_UTF8_LAST_3_BITS_MASK));\n  }\n\n  JERRY_ASSERT (buf_size >= bytes_count);\n\n  for (uint32_t i = 1; i < bytes_count; ++i)\n  {\n    ret <<= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n    ret |= (buf_p[i] & LIT_UTF8_LAST_6_BITS_MASK);\n  }\n\n  *code_point = ret;\n  return bytes_count;\n} /* lit_read_code_point_from_utf8 */\n\n/**\n * Decodes a unicode code unit from non-empty cesu-8-encoded buffer\n *\n * @return number of bytes occupied by code point in the string\n */\nlit_utf8_size_t\nlit_read_code_unit_from_cesu8 (const lit_utf8_byte_t *buf_p, /**< buffer with characters */\n                               ecma_char_t *code_unit) /**< [out] code unit */\n{\n  JERRY_ASSERT (buf_p);\n\n  lit_utf8_byte_t c = buf_p[0];\n  if ((c & LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER)\n  {\n    *code_unit = (ecma_char_t) (c & LIT_UTF8_LAST_7_BITS_MASK);\n    return 1;\n  }\n\n  lit_code_point_t ret = LIT_UNICODE_CODE_POINT_NULL;\n  lit_utf8_size_t bytes_count;\n\n  if ((c & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER)\n  {\n    bytes_count = 2;\n    ret = ((lit_code_point_t) (c & LIT_UTF8_LAST_5_BITS_MASK));\n  }\n  else\n  {\n    JERRY_ASSERT ((c & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER);\n    bytes_count = 3;\n    ret = ((lit_code_point_t) (c & LIT_UTF8_LAST_4_BITS_MASK));\n  }\n\n  for (uint32_t i = 1; i < bytes_count; ++i)\n  {\n    ret <<= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n    ret |= (buf_p[i] & LIT_UTF8_LAST_6_BITS_MASK);\n  }\n\n  JERRY_ASSERT (ret <= LIT_UTF16_CODE_UNIT_MAX);\n  *code_unit = (ecma_char_t) ret;\n  return bytes_count;\n} /* lit_read_code_unit_from_cesu8 */\n\n/**\n * Decodes a unicode code point from non-empty cesu-8-encoded buffer\n *\n * @return number of bytes occupied by code point in the string\n */\nlit_utf8_size_t\nlit_read_code_point_from_cesu8 (const lit_utf8_byte_t *buf_p, /**< buffer with characters */\n                                const lit_utf8_byte_t *buf_end_p, /**< buffer end */\n                                lit_code_point_t *code_point) /**< [out] code point */\n{\n  ecma_char_t code_unit;\n  lit_utf8_size_t size = lit_read_code_unit_from_cesu8 (buf_p, &code_unit);\n\n  JERRY_ASSERT (buf_p + size <= buf_end_p);\n\n  if (lit_is_code_point_utf16_high_surrogate (code_unit))\n  {\n    buf_p += size;\n\n    if (buf_p < buf_end_p)\n    {\n      ecma_char_t next_code_unit;\n      lit_utf8_size_t next_size = lit_read_code_unit_from_cesu8 (buf_p, &next_code_unit);\n\n      if (lit_is_code_point_utf16_low_surrogate (next_code_unit))\n      {\n        JERRY_ASSERT (buf_p + next_size <= buf_end_p);\n\n        *code_point = lit_convert_surrogate_pair_to_code_point (code_unit, next_code_unit);\n        return size + next_size;\n      }\n    }\n  }\n\n  *code_point = code_unit;\n  return size;\n} /* lit_read_code_point_from_cesu8 */\n\n/**\n * Decodes a unicode code unit from non-empty cesu-8-encoded buffer\n *\n * @return number of bytes occupied by code point in the string\n */\nlit_utf8_size_t\nlit_read_prev_code_unit_from_utf8 (const lit_utf8_byte_t *buf_p, /**< buffer with characters */\n                                   ecma_char_t *code_point) /**< [out] code point */\n{\n  JERRY_ASSERT (buf_p);\n\n  lit_utf8_decr (&buf_p);\n  return lit_read_code_unit_from_cesu8 (buf_p, code_point);\n} /* lit_read_prev_code_unit_from_utf8 */\n\n/**\n * Decodes a unicode code unit from non-empty cesu-8-encoded buffer\n *\n * @return next code unit\n */\necma_char_t\nlit_cesu8_read_next (const lit_utf8_byte_t **buf_p) /**< [in,out] buffer with characters */\n{\n  JERRY_ASSERT (*buf_p);\n  ecma_char_t ch;\n\n  *buf_p += lit_read_code_unit_from_cesu8 (*buf_p, &ch);\n\n  return ch;\n} /* lit_cesu8_read_next */\n\n/**\n * Decodes a unicode code unit from non-empty cesu-8-encoded buffer\n *\n * @return previous code unit\n */\necma_char_t\nlit_cesu8_read_prev (const lit_utf8_byte_t **buf_p) /**< [in,out] buffer with characters */\n{\n  JERRY_ASSERT (*buf_p);\n  ecma_char_t ch;\n\n  lit_utf8_decr (buf_p);\n  lit_read_code_unit_from_cesu8 (*buf_p, &ch);\n\n  return ch;\n} /* lit_cesu8_read_prev */\n\n/**\n * Decodes a unicode code unit from non-empty cesu-8-encoded buffer\n *\n * @return next code unit\n */\necma_char_t JERRY_ATTR_NOINLINE\nlit_cesu8_peek_next (const lit_utf8_byte_t *buf_p) /**< [in,out] buffer with characters */\n{\n  JERRY_ASSERT (buf_p != NULL);\n  ecma_char_t ch;\n\n  lit_read_code_unit_from_cesu8 (buf_p, &ch);\n\n  return ch;\n} /* lit_cesu8_peek_next */\n\n/**\n * Decodes a unicode code unit from non-empty cesu-8-encoded buffer\n *\n * @return previous code unit\n */\necma_char_t JERRY_ATTR_NOINLINE\nlit_cesu8_peek_prev (const lit_utf8_byte_t *buf_p) /**< [in,out] buffer with characters */\n{\n  JERRY_ASSERT (buf_p != NULL);\n  ecma_char_t ch;\n\n  lit_read_prev_code_unit_from_utf8 (buf_p, &ch);\n\n  return ch;\n} /* lit_cesu8_peek_prev */\n\n/**\n * Increase cesu-8 encoded string pointer by one code unit.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nlit_utf8_incr (const lit_utf8_byte_t **buf_p) /**< [in,out] buffer with characters */\n{\n  JERRY_ASSERT (*buf_p);\n\n  *buf_p += lit_get_unicode_char_size_by_utf8_first_byte (**buf_p);\n} /* lit_utf8_incr */\n\n/**\n * Decrease cesu-8 encoded string pointer by one code unit.\n */\nvoid\nlit_utf8_decr (const lit_utf8_byte_t **buf_p) /**< [in,out] buffer with characters */\n{\n  JERRY_ASSERT (*buf_p);\n  const lit_utf8_byte_t *current_p = *buf_p;\n\n  do\n  {\n    current_p--;\n  } while ((*current_p & LIT_UTF8_EXTRA_BYTE_MASK) == LIT_UTF8_EXTRA_BYTE_MARKER);\n\n  *buf_p = current_p;\n} /* lit_utf8_decr */\n\n/**\n * Calc hash using the specified hash_basis.\n *\n * NOTE:\n *   This is implementation of FNV-1a hash function, which is released into public domain.\n *   Constants used, are carefully picked primes by the authors.\n *   More info: http://www.isthe.com/chongo/tech/comp/fnv/\n *\n * @return ecma-string's hash\n */\nextern inline lit_string_hash_t JERRY_ATTR_ALWAYS_INLINE\nlit_utf8_string_hash_combine (lit_string_hash_t hash_basis, /**< hash to be combined with */\n                              const lit_utf8_byte_t *utf8_buf_p, /**< characters buffer */\n                              lit_utf8_size_t utf8_buf_size) /**< number of characters in the buffer */\n{\n  JERRY_ASSERT (utf8_buf_p != NULL || utf8_buf_size == 0);\n\n  uint32_t hash = hash_basis;\n\n  for (uint32_t i = 0; i < utf8_buf_size; i++)\n  {\n    /* 16777619 is 32 bit FNV_prime = 2^24 + 2^8 + 0x93 = 16777619 */\n    hash = (hash ^ utf8_buf_p[i]) * 16777619;\n  }\n\n  return (lit_string_hash_t) hash;\n} /* lit_utf8_string_hash_combine */\n\n/**\n * Calculate hash from the buffer.\n *\n * @return ecma-string's hash\n */\nextern inline lit_string_hash_t JERRY_ATTR_ALWAYS_INLINE\nlit_utf8_string_calc_hash (const lit_utf8_byte_t *utf8_buf_p, /**< characters buffer */\n                           lit_utf8_size_t utf8_buf_size) /**< number of characters in the buffer */\n{\n  JERRY_ASSERT (utf8_buf_p != NULL || utf8_buf_size == 0);\n\n  /* 32 bit offset_basis for FNV = 2166136261 */\n  return lit_utf8_string_hash_combine ((lit_string_hash_t) 2166136261, utf8_buf_p, utf8_buf_size);\n} /* lit_utf8_string_calc_hash */\n\n/**\n * Return code unit at the specified position in string\n *\n * NOTE:\n *   code_unit_offset should be less then string's length\n *\n * @return code unit value\n */\necma_char_t\nlit_utf8_string_code_unit_at (const lit_utf8_byte_t *utf8_buf_p, /**< utf-8 string */\n                              lit_utf8_size_t utf8_buf_size, /**< string size in bytes */\n                              lit_utf8_size_t code_unit_offset) /**< ofset of a code_unit */\n{\n  lit_utf8_byte_t *current_p = (lit_utf8_byte_t *) utf8_buf_p;\n  ecma_char_t code_unit;\n\n  do\n  {\n    JERRY_ASSERT (current_p < utf8_buf_p + utf8_buf_size);\n    current_p += lit_read_code_unit_from_cesu8 (current_p, &code_unit);\n  } while (code_unit_offset--);\n\n  return code_unit;\n} /* lit_utf8_string_code_unit_at */\n\n/**\n * Get CESU-8 encoded size of character\n *\n * @return number of bytes occupied in CESU-8\n */\nextern inline lit_utf8_size_t JERRY_ATTR_ALWAYS_INLINE\nlit_get_unicode_char_size_by_utf8_first_byte (const lit_utf8_byte_t first_byte) /**< buffer with characters */\n{\n  if ((first_byte & LIT_UTF8_1_BYTE_MASK) == LIT_UTF8_1_BYTE_MARKER)\n  {\n    return 1;\n  }\n  else if ((first_byte & LIT_UTF8_2_BYTE_MASK) == LIT_UTF8_2_BYTE_MARKER)\n  {\n    return 2;\n  }\n  else\n  {\n    JERRY_ASSERT ((first_byte & LIT_UTF8_3_BYTE_MASK) == LIT_UTF8_3_BYTE_MARKER);\n    return 3;\n  }\n} /* lit_get_unicode_char_size_by_utf8_first_byte */\n\n/**\n * Convert code unit to cesu-8 representation\n *\n * @return byte count required to represent the code unit\n */\nlit_utf8_size_t\nlit_code_unit_to_utf8 (ecma_char_t code_unit, /**< code unit */\n                       lit_utf8_byte_t *buf_p) /**< buffer where to store the result and its size\n                                                *   should be at least LIT_UTF8_MAX_BYTES_IN_CODE_UNIT */\n{\n  if (code_unit <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)\n  {\n    buf_p[0] = (lit_utf8_byte_t) code_unit;\n    return 1;\n  }\n  else if (code_unit <= LIT_UTF8_2_BYTE_CODE_POINT_MAX)\n  {\n    uint32_t code_unit_bits = code_unit;\n    lit_utf8_byte_t second_byte_bits = (lit_utf8_byte_t) (code_unit_bits & LIT_UTF8_LAST_6_BITS_MASK);\n    code_unit_bits >>= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n\n    lit_utf8_byte_t first_byte_bits = (lit_utf8_byte_t) (code_unit_bits & LIT_UTF8_LAST_5_BITS_MASK);\n    JERRY_ASSERT (first_byte_bits == code_unit_bits);\n\n    buf_p[0] = LIT_UTF8_2_BYTE_MARKER | first_byte_bits;\n    buf_p[1] = LIT_UTF8_EXTRA_BYTE_MARKER | second_byte_bits;\n    return 2;\n  }\n  else\n  {\n    uint32_t code_unit_bits = code_unit;\n    lit_utf8_byte_t third_byte_bits = (lit_utf8_byte_t) (code_unit_bits & LIT_UTF8_LAST_6_BITS_MASK);\n    code_unit_bits >>= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n\n    lit_utf8_byte_t second_byte_bits = (lit_utf8_byte_t) (code_unit_bits & LIT_UTF8_LAST_6_BITS_MASK);\n    code_unit_bits >>= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n\n    lit_utf8_byte_t first_byte_bits = (lit_utf8_byte_t) (code_unit_bits & LIT_UTF8_LAST_4_BITS_MASK);\n    JERRY_ASSERT (first_byte_bits == code_unit_bits);\n\n    buf_p[0] = LIT_UTF8_3_BYTE_MARKER | first_byte_bits;\n    buf_p[1] = LIT_UTF8_EXTRA_BYTE_MARKER | second_byte_bits;\n    buf_p[2] = LIT_UTF8_EXTRA_BYTE_MARKER | third_byte_bits;\n    return 3;\n  }\n} /* lit_code_unit_to_utf8 */\n\n/**\n * Convert code point to cesu-8 representation\n *\n * @return byte count required to represent the code point\n */\nlit_utf8_size_t\nlit_code_point_to_cesu8 (lit_code_point_t code_point, /**< code point */\n                         lit_utf8_byte_t *buf) /**< buffer where to store the result,\n                                                *   its size should be at least 6 bytes */\n{\n  if (code_point <= LIT_UTF16_CODE_UNIT_MAX)\n  {\n    return lit_code_unit_to_utf8 ((ecma_char_t) code_point, buf);\n  }\n  else\n  {\n    lit_utf8_size_t offset = lit_code_unit_to_utf8 (convert_code_point_to_high_surrogate (code_point), buf);\n    offset += lit_code_unit_to_utf8 (convert_code_point_to_low_surrogate (code_point), buf + offset);\n    return offset;\n  }\n} /* lit_code_point_to_cesu8 */\n\n/**\n * Convert code point to utf-8 representation\n *\n * @return byte count required to represent the code point\n */\nlit_utf8_size_t\nlit_code_point_to_utf8 (lit_code_point_t code_point, /**< code point */\n                        lit_utf8_byte_t *buf) /**< buffer where to store the result,\n                                               *   its size should be at least 4 bytes */\n{\n  if (code_point <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)\n  {\n    buf[0] = (lit_utf8_byte_t) code_point;\n    return 1;\n  }\n  else if (code_point <= LIT_UTF8_2_BYTE_CODE_POINT_MAX)\n  {\n    uint32_t code_point_bits = code_point;\n    lit_utf8_byte_t second_byte_bits = (lit_utf8_byte_t) (code_point_bits & LIT_UTF8_LAST_6_BITS_MASK);\n    code_point_bits >>= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n\n    lit_utf8_byte_t first_byte_bits = (lit_utf8_byte_t) (code_point_bits & LIT_UTF8_LAST_5_BITS_MASK);\n    JERRY_ASSERT (first_byte_bits == code_point_bits);\n\n    buf[0] = LIT_UTF8_2_BYTE_MARKER | first_byte_bits;\n    buf[1] = LIT_UTF8_EXTRA_BYTE_MARKER | second_byte_bits;\n    return 2;\n  }\n  else if (code_point <= LIT_UTF8_3_BYTE_CODE_POINT_MAX)\n  {\n    uint32_t code_point_bits = code_point;\n    lit_utf8_byte_t third_byte_bits = (lit_utf8_byte_t) (code_point_bits & LIT_UTF8_LAST_6_BITS_MASK);\n    code_point_bits >>= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n\n    lit_utf8_byte_t second_byte_bits = (lit_utf8_byte_t) (code_point_bits & LIT_UTF8_LAST_6_BITS_MASK);\n    code_point_bits >>= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n\n    lit_utf8_byte_t first_byte_bits = (lit_utf8_byte_t) (code_point_bits & LIT_UTF8_LAST_4_BITS_MASK);\n    JERRY_ASSERT (first_byte_bits == code_point_bits);\n\n    buf[0] = LIT_UTF8_3_BYTE_MARKER | first_byte_bits;\n    buf[1] = LIT_UTF8_EXTRA_BYTE_MARKER | second_byte_bits;\n    buf[2] = LIT_UTF8_EXTRA_BYTE_MARKER | third_byte_bits;\n    return 3;\n  }\n  else\n  {\n    JERRY_ASSERT (code_point <= LIT_UTF8_4_BYTE_CODE_POINT_MAX);\n\n    uint32_t code_point_bits = code_point;\n    lit_utf8_byte_t fourth_byte_bits = (lit_utf8_byte_t) (code_point_bits & LIT_UTF8_LAST_6_BITS_MASK);\n    code_point_bits >>= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n\n    lit_utf8_byte_t third_byte_bits = (lit_utf8_byte_t) (code_point_bits & LIT_UTF8_LAST_6_BITS_MASK);\n    code_point_bits >>= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n\n    lit_utf8_byte_t second_byte_bits = (lit_utf8_byte_t) (code_point_bits & LIT_UTF8_LAST_6_BITS_MASK);\n    code_point_bits >>= LIT_UTF8_BITS_IN_EXTRA_BYTES;\n\n    lit_utf8_byte_t first_byte_bits = (lit_utf8_byte_t) (code_point_bits & LIT_UTF8_LAST_3_BITS_MASK);\n    JERRY_ASSERT (first_byte_bits == code_point_bits);\n\n    buf[0] = LIT_UTF8_4_BYTE_MARKER | first_byte_bits;\n    buf[1] = LIT_UTF8_EXTRA_BYTE_MARKER | second_byte_bits;\n    buf[2] = LIT_UTF8_EXTRA_BYTE_MARKER | third_byte_bits;\n    buf[3] = LIT_UTF8_EXTRA_BYTE_MARKER | fourth_byte_bits;\n    return 4;\n  }\n} /* lit_code_point_to_utf8 */\n\n/**\n * Convert cesu-8 string to an utf-8 string and put it into the buffer.\n * String will be truncated to fit the buffer.\n *\n * @return number of bytes copied to the buffer.\n */\nlit_utf8_size_t\nlit_convert_cesu8_string_to_utf8_string (const lit_utf8_byte_t *cesu8_string_p, /**< cesu-8 string */\n                                         lit_utf8_size_t cesu8_size, /**< size of cesu-8 string */\n                                         lit_utf8_byte_t *utf8_string_p, /**< destination utf-8 buffer pointer\n                                                                          * (can be NULL if buffer_size == 0) */\n                                         lit_utf8_size_t utf8_size) /**< size of utf-8 buffer */\n{\n  const lit_utf8_byte_t *cesu8_cursor_p = cesu8_string_p;\n  const lit_utf8_byte_t *cesu8_end_p = cesu8_string_p + cesu8_size;\n\n  lit_utf8_byte_t *utf8_cursor_p = utf8_string_p;\n  lit_utf8_byte_t *utf8_end_p = utf8_string_p + utf8_size;\n\n  while (cesu8_cursor_p < cesu8_end_p)\n  {\n    lit_code_point_t cp;\n    lit_utf8_size_t read_size = lit_read_code_point_from_cesu8 (cesu8_cursor_p, cesu8_end_p, &cp);\n    lit_utf8_size_t encoded_size = (cp >= LIT_UTF16_FIRST_SURROGATE_CODE_POINT) ? 4 : read_size;\n\n    if (utf8_cursor_p + encoded_size > utf8_end_p)\n    {\n      break;\n    }\n\n    if (cp >= LIT_UTF16_FIRST_SURROGATE_CODE_POINT)\n    {\n      lit_code_point_to_utf8 (cp, utf8_cursor_p);\n    }\n    else\n    {\n      memcpy (utf8_cursor_p, cesu8_cursor_p, encoded_size);\n    }\n\n    utf8_cursor_p += encoded_size;\n    cesu8_cursor_p += read_size;\n  }\n\n  JERRY_ASSERT (cesu8_cursor_p <= cesu8_end_p);\n  JERRY_ASSERT (utf8_cursor_p <= utf8_end_p);\n\n  return (lit_utf8_byte_t) (utf8_cursor_p - utf8_string_p);\n} /* lit_convert_cesu8_string_to_utf8_string */\n\n/**\n * Convert surrogate pair to code point\n *\n * @return code point\n */\nlit_code_point_t\nlit_convert_surrogate_pair_to_code_point (ecma_char_t high_surrogate, /**< high surrogate code point */\n                                          ecma_char_t low_surrogate) /**< low surrogate code point */\n{\n  JERRY_ASSERT (lit_is_code_point_utf16_high_surrogate (high_surrogate));\n  JERRY_ASSERT (lit_is_code_point_utf16_low_surrogate (low_surrogate));\n\n  lit_code_point_t code_point;\n  code_point = (uint16_t) (high_surrogate - LIT_UTF16_HIGH_SURROGATE_MIN);\n  code_point <<= LIT_UTF16_BITS_IN_SURROGATE;\n\n  code_point += LIT_UTF16_FIRST_SURROGATE_CODE_POINT;\n\n  code_point |= (uint16_t) (low_surrogate - LIT_UTF16_LOW_SURROGATE_MIN);\n  return code_point;\n} /* lit_convert_surrogate_pair_to_code_point */\n\n/**\n * Relational compare of cesu-8 strings\n *\n * First string is less than second string if:\n *  - strings are not equal;\n *  - first string is prefix of second or is lexicographically less than second.\n *\n * @return true - if first string is less than second string,\n *         false - otherwise\n */\nbool\nlit_compare_utf8_strings_relational (const lit_utf8_byte_t *string1_p, /**< utf-8 string */\n                                     lit_utf8_size_t string1_size, /**< string size */\n                                     const lit_utf8_byte_t *string2_p, /**< utf-8 string */\n                                     lit_utf8_size_t string2_size) /**< string size */\n{\n  lit_utf8_byte_t *string1_pos = (lit_utf8_byte_t *) string1_p;\n  lit_utf8_byte_t *string2_pos = (lit_utf8_byte_t *) string2_p;\n  const lit_utf8_byte_t *string1_end_p = string1_p + string1_size;\n  const lit_utf8_byte_t *string2_end_p = string2_p + string2_size;\n\n  while (string1_pos < string1_end_p && string2_pos < string2_end_p)\n  {\n    ecma_char_t ch1, ch2;\n    string1_pos += lit_read_code_unit_from_cesu8 (string1_pos, &ch1);\n    string2_pos += lit_read_code_unit_from_cesu8 (string2_pos, &ch2);\n\n    if (ch1 < ch2)\n    {\n      return true;\n    }\n    else if (ch1 > ch2)\n    {\n      return false;\n    }\n  }\n\n  return (string1_pos >= string1_end_p && string2_pos < string2_end_p);\n} /* lit_compare_utf8_strings_relational */\n"
  },
  {
    "path": "jerry-core/lit/lit-strings.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef LIT_STRINGS_H\n#define LIT_STRINGS_H\n\n#include \"jrt.h\"\n#include \"lit-globals.h\"\n\n/**\n * Null character (used in few cases as utf-8 string end marker)\n */\n#define LIT_BYTE_NULL (0)\n\n/**\n * For the formal definition of Unicode transformation formats (UTF) see Section 3.9, Unicode Encoding Forms in The\n * Unicode Standard (http://www.unicode.org/versions/Unicode3.0.0/ch03.pdf#G7404).\n */\n#define LIT_UNICODE_CODE_POINT_NULL (0x0)\n#define LIT_UNICODE_CODE_POINT_MAX  (0x10FFFF)\n\n#define LIT_UTF16_CODE_UNIT_MAX              (0xFFFF)\n#define LIT_UTF16_FIRST_SURROGATE_CODE_POINT (0x10000)\n#define LIT_UTF16_LOW_SURROGATE_MARKER       (0xDC00)\n#define LIT_UTF16_HIGH_SURROGATE_MARKER      (0xD800)\n#define LIT_UTF16_HIGH_SURROGATE_MIN         (0xD800)\n#define LIT_UTF16_HIGH_SURROGATE_MAX         (0xDBFF)\n#define LIT_UTF16_LOW_SURROGATE_MIN          (0xDC00)\n#define LIT_UTF16_LOW_SURROGATE_MAX          (0xDFFF)\n#define LIT_UTF16_BITS_IN_SURROGATE          (10)\n#define LIT_UTF16_LAST_10_BITS_MASK          (0x3FF)\n\n#define LIT_UTF8_1_BYTE_MARKER     (0x00)\n#define LIT_UTF8_2_BYTE_MARKER     (0xC0)\n#define LIT_UTF8_3_BYTE_MARKER     (0xE0)\n#define LIT_UTF8_4_BYTE_MARKER     (0xF0)\n#define LIT_UTF8_EXTRA_BYTE_MARKER (0x80)\n\n#define LIT_UTF8_1_BYTE_MASK     (0x80)\n#define LIT_UTF8_2_BYTE_MASK     (0xE0)\n#define LIT_UTF8_3_BYTE_MASK     (0xF0)\n#define LIT_UTF8_4_BYTE_MASK     (0xF8)\n#define LIT_UTF8_EXTRA_BYTE_MASK (0xC0)\n\n#define LIT_UTF8_LAST_7_BITS_MASK (0x7F)\n#define LIT_UTF8_LAST_6_BITS_MASK (0x3F)\n#define LIT_UTF8_LAST_5_BITS_MASK (0x1F)\n#define LIT_UTF8_LAST_4_BITS_MASK (0x0F)\n#define LIT_UTF8_LAST_3_BITS_MASK (0x07)\n#define LIT_UTF8_LAST_2_BITS_MASK (0x03)\n#define LIT_UTF8_LAST_1_BIT_MASK  (0x01)\n\n#define LIT_UTF8_BITS_IN_EXTRA_BYTES (6)\n\n#define LIT_UTF8_1_BYTE_CODE_POINT_MAX (0x7F)\n#define LIT_UTF8_2_BYTE_CODE_POINT_MIN (0x80)\n#define LIT_UTF8_2_BYTE_CODE_POINT_MAX (0x7FF)\n#define LIT_UTF8_3_BYTE_CODE_POINT_MIN (0x800)\n#define LIT_UTF8_3_BYTE_CODE_POINT_MAX (LIT_UTF16_CODE_UNIT_MAX)\n#define LIT_UTF8_4_BYTE_CODE_POINT_MIN (0x10000)\n#define LIT_UTF8_4_BYTE_CODE_POINT_MAX (LIT_UNICODE_CODE_POINT_MAX)\n\n/**\n * Differnce between byte count needed to represent code point greater than 0xFFFF\n * in common UTF-8 (4 bytes required) and CESU-8 (6 bytes required)\n */\n#define LIT_UTF8_CESU8_SURROGATE_SIZE_DIF (2 * LIT_UTF8_MAX_BYTES_IN_CODE_UNIT - LIT_UTF8_MAX_BYTES_IN_CODE_POINT)\n\n/**\n * Byte values >= LIT_UTF8_FIRST_BYTE_MAX are not allowed in internal strings\n */\n#define LIT_UTF8_FIRST_BYTE_MAX (0xF8)\n\n/* validation */\nbool lit_is_valid_utf8_string (const lit_utf8_byte_t *utf8_buf_p, lit_utf8_size_t buf_size, bool strict);\nbool lit_is_valid_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, lit_utf8_size_t buf_size);\n\n/* checks */\nbool lit_is_code_point_utf16_low_surrogate (lit_code_point_t code_point);\nbool lit_is_code_point_utf16_high_surrogate (lit_code_point_t code_point);\n\n/* size */\nlit_utf8_size_t lit_zt_utf8_string_size (const lit_utf8_byte_t *utf8_str_p);\nlit_utf8_size_t lit_get_utf8_size_of_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, lit_utf8_size_t cesu8_buf_size);\n\n/* length */\nlit_utf8_size_t lit_utf8_string_length (const lit_utf8_byte_t *utf8_buf_p, lit_utf8_size_t utf8_buf_size);\nlit_utf8_size_t lit_get_utf8_length_of_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p,\n                                                     lit_utf8_size_t cesu8_buf_size);\n\n/* hash */\nlit_string_hash_t lit_utf8_string_calc_hash (const lit_utf8_byte_t *utf8_buf_p, lit_utf8_size_t utf8_buf_size);\nlit_string_hash_t lit_utf8_string_hash_combine (lit_string_hash_t hash_basis,\n                                                const lit_utf8_byte_t *utf8_buf_p,\n                                                lit_utf8_size_t utf8_buf_size);\n\n/* code unit access */\necma_char_t lit_utf8_string_code_unit_at (const lit_utf8_byte_t *utf8_buf_p,\n                                          lit_utf8_size_t utf8_buf_size,\n                                          lit_utf8_size_t code_unit_offset);\nlit_utf8_size_t lit_get_unicode_char_size_by_utf8_first_byte (const lit_utf8_byte_t first_byte);\n\n/* conversion */\nlit_utf8_size_t lit_code_unit_to_utf8 (ecma_char_t code_unit, lit_utf8_byte_t *buf_p);\nlit_utf8_size_t lit_code_point_to_utf8 (lit_code_point_t code_point, lit_utf8_byte_t *buf);\nlit_utf8_size_t lit_code_point_to_cesu8 (lit_code_point_t code_point, lit_utf8_byte_t *buf);\nlit_utf8_size_t lit_convert_cesu8_string_to_utf8_string (const lit_utf8_byte_t *cesu8_string_p,\n                                                         lit_utf8_size_t cesu8_size,\n                                                         lit_utf8_byte_t *utf8_string_p,\n                                                         lit_utf8_size_t utf8_size);\nlit_code_point_t lit_convert_surrogate_pair_to_code_point (ecma_char_t high_surrogate, ecma_char_t low_surrogate);\n\nbool lit_compare_utf8_strings_relational (const lit_utf8_byte_t *string1_p,\n                                          lit_utf8_size_t string1_size,\n                                          const lit_utf8_byte_t *string2_p,\n                                          lit_utf8_size_t string2_size);\n\nuint8_t lit_utf16_encode_code_point (lit_code_point_t cp, ecma_char_t *cu_p);\n\n/* read code point from buffer */\nlit_utf8_size_t\nlit_read_code_point_from_utf8 (const lit_utf8_byte_t *buf_p, lit_utf8_size_t buf_size, lit_code_point_t *code_point);\n\nlit_utf8_size_t lit_read_code_unit_from_cesu8 (const lit_utf8_byte_t *buf_p, ecma_char_t *code_unit);\nlit_utf8_size_t lit_read_code_point_from_cesu8 (const lit_utf8_byte_t *buf_p,\n                                                const lit_utf8_byte_t *buf_end_p,\n                                                lit_code_point_t *code_point);\n\nlit_utf8_size_t lit_read_prev_code_unit_from_utf8 (const lit_utf8_byte_t *buf_p, ecma_char_t *code_point);\n\necma_char_t lit_cesu8_read_next (const lit_utf8_byte_t **buf_p);\necma_char_t lit_cesu8_read_prev (const lit_utf8_byte_t **buf_p);\necma_char_t lit_cesu8_peek_next (const lit_utf8_byte_t *buf_p);\necma_char_t lit_cesu8_peek_prev (const lit_utf8_byte_t *buf_p);\nvoid lit_utf8_incr (const lit_utf8_byte_t **buf_p);\nvoid lit_utf8_decr (const lit_utf8_byte_t **buf_p);\n\n#endif /* !LIT_STRINGS_H */\n"
  },
  {
    "path": "jerry-core/lit/lit-unicode-conversions-sup.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file is automatically generated by the gen-unicode.py script\n * from UnicodeData.txt and SpecialCasing.txt files. Do not edit! */\n\n/* Contains start points of character case ranges (these are bidirectional conversions). */\nstatic const uint32_t lit_unicode_character_case_ranges_sup[] JERRY_ATTR_CONST_DATA = {\n  0x010400, 0x010428, 0x0104b0, 0x0104d8, 0x010c80, 0x010cc0, 0x0118a0, 0x0118c0, 0x016e40, 0x016e60, 0x01e900, 0x01e922\n};\n\n/* Interval lengths of start points in `character_case_ranges` table. */\nstatic const uint16_t lit_unicode_character_case_range_lengths_sup[] JERRY_ATTR_CONST_DATA = { 0x000028, 0x000024,\n                                                                                               0x000033, 0x000020,\n                                                                                               0x000020, 0x000022 };\n"
  },
  {
    "path": "jerry-core/lit/lit-unicode-conversions.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file is automatically generated by the gen-unicode.py script\n * from UnicodeData.txt and SpecialCasing.txt files. Do not edit! */\n\n/* Contains start points of character case ranges (these are bidirectional conversions). */\nstatic const uint16_t lit_unicode_character_case_ranges[] JERRY_ATTR_CONST_DATA = {\n  0x00c0, 0x00e0, 0x00d8, 0x00f8, 0x0189, 0x0256, 0x01b1, 0x028a, 0x0388, 0x03ad, 0x038e, 0x03cd, 0x0391,\n  0x03b1, 0x03a3, 0x03c3, 0x03fd, 0x037b, 0x0400, 0x0450, 0x0410, 0x0430, 0x0531, 0x0561, 0x10a0, 0x2d00,\n  0x13a0, 0xab70, 0x13f0, 0x13f8, 0x1c90, 0x10d0, 0x1cbd, 0x10fd, 0x1f08, 0x1f00, 0x1f18, 0x1f10, 0x1f28,\n  0x1f20, 0x1f38, 0x1f30, 0x1f48, 0x1f40, 0x1f68, 0x1f60, 0x1fb8, 0x1fb0, 0x1fba, 0x1f70, 0x1fc8, 0x1f72,\n  0x1fd8, 0x1fd0, 0x1fda, 0x1f76, 0x1fe8, 0x1fe0, 0x1fea, 0x1f7a, 0x1ff8, 0x1f78, 0x1ffa, 0x1f7c, 0x2160,\n  0x2170, 0x24b6, 0x24d0, 0x2c00, 0x2c30, 0x2c7e, 0x023f, 0xff21, 0xff41\n};\n\n/* Interval lengths of start points in `character_case_ranges` table. */\nstatic const uint8_t lit_unicode_character_case_range_lengths[] JERRY_ATTR_CONST_DATA = {\n  0x0017, 0x0007, 0x0002, 0x0002, 0x0003, 0x0002, 0x0011, 0x0009, 0x0003, 0x0010, 0x0020, 0x0026, 0x0026,\n  0x0050, 0x0006, 0x002b, 0x0003, 0x0008, 0x0006, 0x0008, 0x0008, 0x0006, 0x0008, 0x0002, 0x0002, 0x0004,\n  0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0010, 0x001a, 0x002f, 0x0002, 0x001a\n};\n\n/* Contains the start points of bidirectional conversion ranges. */\nstatic const uint16_t lit_unicode_character_pair_ranges[] JERRY_ATTR_CONST_DATA = {\n  0x0100, 0x0132, 0x0139, 0x014a, 0x0179, 0x0182, 0x0187, 0x018b, 0x0191, 0x0198, 0x01a0, 0x01a7,\n  0x01ac, 0x01af, 0x01b3, 0x01b8, 0x01bc, 0x01cd, 0x01de, 0x01f4, 0x01f8, 0x0222, 0x023b, 0x0241,\n  0x0246, 0x0370, 0x0376, 0x03d8, 0x03f7, 0x03fa, 0x0460, 0x048a, 0x04c1, 0x04d0, 0x1e00, 0x1ea0,\n  0x2183, 0x2c60, 0x2c67, 0x2c72, 0x2c75, 0x2c80, 0x2ceb, 0x2cf2, 0xa640, 0xa680, 0xa722, 0xa732,\n  0xa779, 0xa77e, 0xa78b, 0xa790, 0xa796, 0xa7b4, 0xa7c2, 0xa7c7, 0xa7f5\n};\n\n/* Interval lengths of start points in `character_pair_ranges` table. */\nstatic const uint8_t lit_unicode_character_pair_range_lengths[] JERRY_ATTR_CONST_DATA = {\n  0x0030, 0x0006, 0x0010, 0x002e, 0x0006, 0x0004, 0x0002, 0x0002, 0x0002, 0x0002, 0x0006, 0x0002,\n  0x0002, 0x0002, 0x0004, 0x0002, 0x0002, 0x0010, 0x0012, 0x0002, 0x0028, 0x0012, 0x0002, 0x0002,\n  0x000a, 0x0004, 0x0002, 0x0018, 0x0002, 0x0002, 0x0022, 0x0036, 0x000e, 0x0060, 0x0096, 0x0060,\n  0x0002, 0x0002, 0x0006, 0x0002, 0x0002, 0x0064, 0x0004, 0x0002, 0x002e, 0x001c, 0x000e, 0x003e,\n  0x0004, 0x000a, 0x0002, 0x0004, 0x0014, 0x000c, 0x0002, 0x0004, 0x0002\n};\n\n/* Contains lower/upper case bidirectional conversion pairs. */\nstatic const uint16_t lit_unicode_character_pairs[] JERRY_ATTR_CONST_DATA = {\n  0x0178, 0x00ff, 0x0181, 0x0253, 0x0186, 0x0254, 0x018e, 0x01dd, 0x018f, 0x0259, 0x0190, 0x025b, 0x0193,\n  0x0260, 0x0194, 0x0263, 0x0196, 0x0269, 0x0197, 0x0268, 0x019c, 0x026f, 0x019d, 0x0272, 0x019f, 0x0275,\n  0x01a6, 0x0280, 0x01a9, 0x0283, 0x01ae, 0x0288, 0x01b7, 0x0292, 0x01c4, 0x01c6, 0x01c7, 0x01c9, 0x01ca,\n  0x01cc, 0x01f1, 0x01f3, 0x01f6, 0x0195, 0x01f7, 0x01bf, 0x0220, 0x019e, 0x023a, 0x2c65, 0x023d, 0x019a,\n  0x023e, 0x2c66, 0x0243, 0x0180, 0x0244, 0x0289, 0x0245, 0x028c, 0x037f, 0x03f3, 0x0386, 0x03ac, 0x038c,\n  0x03cc, 0x03cf, 0x03d7, 0x03f9, 0x03f2, 0x04c0, 0x04cf, 0x10c7, 0x2d27, 0x10cd, 0x2d2d, 0x1f59, 0x1f51,\n  0x1f5b, 0x1f53, 0x1f5d, 0x1f55, 0x1f5f, 0x1f57, 0x1fec, 0x1fe5, 0x2132, 0x214e, 0x2c62, 0x026b, 0x2c63,\n  0x1d7d, 0x2c64, 0x027d, 0x2c6d, 0x0251, 0x2c6e, 0x0271, 0x2c6f, 0x0250, 0x2c70, 0x0252, 0xa77d, 0x1d79,\n  0xa78d, 0x0265, 0xa7aa, 0x0266, 0xa7ab, 0x025c, 0xa7ac, 0x0261, 0xa7ad, 0x026c, 0xa7ae, 0x026a, 0xa7b0,\n  0x029e, 0xa7b1, 0x0287, 0xa7b2, 0x029d, 0xa7b3, 0xab53, 0xa7c4, 0xa794, 0xa7c5, 0x0282, 0xa7c6, 0x1d8e\n};\n\n/* Contains start points of one-to-two uppercase ranges where the second character\n * is always the same.\n */\nstatic const uint16_t lit_unicode_upper_case_special_ranges[] JERRY_ATTR_CONST_DATA = {\n  0x1f80, 0x1f08, 0x0399, 0x1f88, 0x1f08, 0x0399, 0x1f90, 0x1f28, 0x0399,\n  0x1f98, 0x1f28, 0x0399, 0x1fa0, 0x1f68, 0x0399, 0x1fa8, 0x1f68, 0x0399\n};\n\n/* Interval lengths for start points in `upper_case_special_ranges` table. */\nstatic const uint8_t lit_unicode_upper_case_special_range_lengths[] JERRY_ATTR_CONST_DATA = { 0x0007, 0x0007, 0x0007,\n                                                                                              0x0007, 0x0007, 0x0007 };\n\n/* Contains start points of lowercase ranges. */\nstatic const uint16_t lit_unicode_lower_case_ranges[] JERRY_ATTR_CONST_DATA = { 0x1f88, 0x1f80, 0x1f98,\n                                                                                0x1f90, 0x1fa8, 0x1fa0 };\n\n/* Interval lengths for start points in `lower_case_ranges` table. */\nstatic const uint8_t lit_unicode_lower_case_range_lengths[] JERRY_ATTR_CONST_DATA = { 0x0008, 0x0008, 0x0008 };\n\n/* The remaining lowercase conversions. The lowercase variant can be one-to-three character long. */\nstatic const uint16_t lit_unicode_lower_case_conversions[] JERRY_ATTR_CONST_DATA = {\n  0x01c5, 0x01c6, 0x01c8, 0x01c9, 0x01cb, 0x01cc, 0x01f2, 0x01f3, 0x03f4, 0x03b8, 0x1e9e, 0x00df, 0x1fbc, 0x1fb3,\n  0x1fcc, 0x1fc3, 0x1ffc, 0x1ff3, 0x2126, 0x03c9, 0x212a, 0x006b, 0x212b, 0x00e5, 0x0130, 0x0069, 0x0307\n};\n\n/* Number of one-to-one, one-to-two, and one-to-three lowercase conversions. */\nstatic const uint8_t lit_unicode_lower_case_conversion_counters[] JERRY_ATTR_CONST_DATA = { 0x000c, 0x0001, 0x0000 };\n\n/* The remaining uppercase conversions. The uppercase variant can be one-to-three character long. */\nstatic const uint16_t lit_unicode_upper_case_conversions[] JERRY_ATTR_CONST_DATA = {\n  0x00b5, 0x039c, 0x0131, 0x0049, 0x017f, 0x0053, 0x01c5, 0x01c4, 0x01c8, 0x01c7, 0x01cb, 0x01ca, 0x01f2, 0x01f1,\n  0x0345, 0x0399, 0x03c2, 0x03a3, 0x03d0, 0x0392, 0x03d1, 0x0398, 0x03d5, 0x03a6, 0x03d6, 0x03a0, 0x03f0, 0x039a,\n  0x03f1, 0x03a1, 0x03f5, 0x0395, 0x1c80, 0x0412, 0x1c81, 0x0414, 0x1c82, 0x041e, 0x1c83, 0x0421, 0x1c84, 0x0422,\n  0x1c85, 0x0422, 0x1c86, 0x042a, 0x1c87, 0x0462, 0x1c88, 0xa64a, 0x1e9b, 0x1e60, 0x1fbe, 0x0399, 0x00df, 0x0053,\n  0x0053, 0x0149, 0x02bc, 0x004e, 0x01f0, 0x004a, 0x030c, 0x0587, 0x0535, 0x0552, 0x1e96, 0x0048, 0x0331, 0x1e97,\n  0x0054, 0x0308, 0x1e98, 0x0057, 0x030a, 0x1e99, 0x0059, 0x030a, 0x1e9a, 0x0041, 0x02be, 0x1f50, 0x03a5, 0x0313,\n  0x1f87, 0x1f0f, 0x0399, 0x1f8f, 0x1f0f, 0x0399, 0x1f97, 0x1f2f, 0x0399, 0x1f9f, 0x1f2f, 0x0399, 0x1fa7, 0x1f6f,\n  0x0399, 0x1faf, 0x1f6f, 0x0399, 0x1fb2, 0x1fba, 0x0399, 0x1fb3, 0x0391, 0x0399, 0x1fb4, 0x0386, 0x0399, 0x1fb6,\n  0x0391, 0x0342, 0x1fbc, 0x0391, 0x0399, 0x1fc2, 0x1fca, 0x0399, 0x1fc3, 0x0397, 0x0399, 0x1fc4, 0x0389, 0x0399,\n  0x1fc6, 0x0397, 0x0342, 0x1fcc, 0x0397, 0x0399, 0x1fd6, 0x0399, 0x0342, 0x1fe4, 0x03a1, 0x0313, 0x1fe6, 0x03a5,\n  0x0342, 0x1ff2, 0x1ffa, 0x0399, 0x1ff3, 0x03a9, 0x0399, 0x1ff4, 0x038f, 0x0399, 0x1ff6, 0x03a9, 0x0342, 0x1ffc,\n  0x03a9, 0x0399, 0xfb00, 0x0046, 0x0046, 0xfb01, 0x0046, 0x0049, 0xfb02, 0x0046, 0x004c, 0xfb05, 0x0053, 0x0054,\n  0xfb06, 0x0053, 0x0054, 0xfb13, 0x0544, 0x0546, 0xfb14, 0x0544, 0x0535, 0xfb15, 0x0544, 0x053b, 0xfb16, 0x054e,\n  0x0546, 0xfb17, 0x0544, 0x053d, 0x0390, 0x0399, 0x0308, 0x0301, 0x03b0, 0x03a5, 0x0308, 0x0301, 0x1f52, 0x03a5,\n  0x0313, 0x0300, 0x1f54, 0x03a5, 0x0313, 0x0301, 0x1f56, 0x03a5, 0x0313, 0x0342, 0x1fb7, 0x0391, 0x0342, 0x0399,\n  0x1fc7, 0x0397, 0x0342, 0x0399, 0x1fd2, 0x0399, 0x0308, 0x0300, 0x1fd3, 0x0399, 0x0308, 0x0301, 0x1fd7, 0x0399,\n  0x0308, 0x0342, 0x1fe2, 0x03a5, 0x0308, 0x0300, 0x1fe3, 0x03a5, 0x0308, 0x0301, 0x1fe7, 0x03a5, 0x0308, 0x0342,\n  0x1ff7, 0x03a9, 0x0342, 0x0399, 0xfb03, 0x0046, 0x0046, 0x0049, 0xfb04, 0x0046, 0x0046, 0x004c\n};\n\n/* Number of one-to-one, one-to-two, and one-to-three uppercase conversions. */\nstatic const uint8_t lit_unicode_upper_case_conversion_counters[] JERRY_ATTR_CONST_DATA = { 0x001b, 0x002c, 0x0010 };\n"
  },
  {
    "path": "jerry-core/lit/lit-unicode-folding.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file is automatically generated by the gen-unicode.py script\n * from the CaseFolding.txt file. Do not edit! */\n\n/**\n * Character interval starting points for folding_skip_to_lower.\n */\nstatic const uint16_t lit_unicode_folding_skip_to_lower_interval_starts[] JERRY_ATTR_CONST_DATA = { 0x13a0,\n                                                                                                    0x13f8,\n                                                                                                    0xab70 };\n\n/**\n * Character interval lengths for folding_skip_to_lower.\n */\nstatic const uint8_t lit_unicode_folding_skip_to_lower_interval_lengths[] JERRY_ATTR_CONST_DATA = { 0x0055,\n                                                                                                    0x0005,\n                                                                                                    0x004f };\n\n/**\n * Non-interval characters for folding_skip_to_lower.\n */\nstatic const uint16_t lit_unicode_folding_skip_to_lower_chars[] JERRY_ATTR_CONST_DATA = { 0x0130 };\n\n/**\n * Character interval starting points for folding_to_upper.\n */\nstatic const uint16_t lit_unicode_folding_to_upper_interval_starts[] JERRY_ATTR_CONST_DATA = { 0x03d0, 0x03d5, 0x03f0,\n                                                                                               0x13f8, 0x1c80, 0xab70 };\n\n/**\n * Character interval lengths for folding_to_upper.\n */\nstatic const uint8_t lit_unicode_folding_to_upper_interval_lengths[] JERRY_ATTR_CONST_DATA = { 0x0001, 0x0001, 0x0001,\n                                                                                               0x0005, 0x0008, 0x004f };\n\n/**\n * Non-interval characters for folding_to_upper.\n */\nstatic const uint16_t lit_unicode_folding_to_upper_chars[] JERRY_ATTR_CONST_DATA = { 0x00b5, 0x017f, 0x0345, 0x03c2,\n                                                                                     0x03f5, 0x1e9b, 0x1fbe };\n"
  },
  {
    "path": "jerry-core/lit/lit-unicode-ranges-sup.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file is automatically generated by the gen-unicode.py script\n * from DerivedCoreProperties.txt. Do not edit! */\n\n/**\n * Character interval starting points for ID_Start.\n */\nstatic const uint32_t lit_unicode_id_start_interval_starts_sup[] JERRY_ATTR_CONST_DATA = {\n  0x010000, 0x01000d, 0x010028, 0x01003c, 0x01003f, 0x010050, 0x010080, 0x010140, 0x010280, 0x0102a0, 0x010300,\n  0x01032d, 0x010350, 0x010380, 0x0103a0, 0x0103c8, 0x0103d1, 0x010400, 0x0104b0, 0x0104d8, 0x010500, 0x010530,\n  0x010600, 0x010740, 0x010760, 0x010800, 0x01080a, 0x010837, 0x01083f, 0x010860, 0x010880, 0x0108e0, 0x0108f4,\n  0x010900, 0x010920, 0x010980, 0x0109be, 0x010a10, 0x010a15, 0x010a19, 0x010a60, 0x010a80, 0x010ac0, 0x010ac9,\n  0x010b00, 0x010b40, 0x010b60, 0x010b80, 0x010c00, 0x010c80, 0x010cc0, 0x010d00, 0x010e80, 0x010eb0, 0x010f00,\n  0x010f30, 0x010fb0, 0x010fe0, 0x011003, 0x011083, 0x0110d0, 0x011103, 0x011150, 0x011183, 0x0111c1, 0x011200,\n  0x011213, 0x011280, 0x01128a, 0x01128f, 0x01129f, 0x0112b0, 0x011305, 0x01130f, 0x011313, 0x01132a, 0x011332,\n  0x011335, 0x01135d, 0x011400, 0x011447, 0x01145f, 0x011480, 0x0114c4, 0x011580, 0x0115d8, 0x011600, 0x011680,\n  0x011700, 0x011800, 0x0118a0, 0x0118ff, 0x01190c, 0x011915, 0x011918, 0x0119a0, 0x0119aa, 0x011a0b, 0x011a5c,\n  0x011ac0, 0x011c00, 0x011c0a, 0x011c72, 0x011d00, 0x011d08, 0x011d0b, 0x011d60, 0x011d67, 0x011d6a, 0x011ee0,\n  0x012000, 0x012400, 0x012480, 0x013000, 0x014400, 0x016800, 0x016a40, 0x016ad0, 0x016b00, 0x016b40, 0x016b63,\n  0x016b7d, 0x016e40, 0x016f00, 0x016f93, 0x016fe0, 0x017000, 0x018800, 0x018d00, 0x01b000, 0x01b150, 0x01b164,\n  0x01b170, 0x01bc00, 0x01bc70, 0x01bc80, 0x01bc90, 0x01d400, 0x01d456, 0x01d49e, 0x01d4a5, 0x01d4a9, 0x01d4ae,\n  0x01d4bd, 0x01d4c5, 0x01d507, 0x01d50d, 0x01d516, 0x01d51e, 0x01d53b, 0x01d540, 0x01d54a, 0x01d552, 0x01d6a8,\n  0x01d6c2, 0x01d6dc, 0x01d6fc, 0x01d716, 0x01d736, 0x01d750, 0x01d770, 0x01d78a, 0x01d7aa, 0x01d7c4, 0x01e100,\n  0x01e137, 0x01e2c0, 0x01e800, 0x01e900, 0x01ee00, 0x01ee05, 0x01ee21, 0x01ee29, 0x01ee34, 0x01ee4d, 0x01ee51,\n  0x01ee61, 0x01ee67, 0x01ee6c, 0x01ee74, 0x01ee79, 0x01ee80, 0x01ee8b, 0x01eea1, 0x01eea5, 0x01eeab, 0x020000,\n  0x02a700, 0x02b740, 0x02b820, 0x02ceb0, 0x02f800, 0x030000\n};\n\n/**\n * Character interval lengths for ID_Start.\n */\nstatic const uint16_t lit_unicode_id_start_interval_lengths_sup[] JERRY_ATTR_CONST_DATA = {\n  0x00000b, 0x000019, 0x000012, 0x000001, 0x00000e, 0x00000d, 0x00007a, 0x000034, 0x00001c, 0x000030, 0x00001f,\n  0x00001d, 0x000025, 0x00001d, 0x000023, 0x000007, 0x000004, 0x00009d, 0x000023, 0x000023, 0x000027, 0x000033,\n  0x000136, 0x000015, 0x000007, 0x000005, 0x00002b, 0x000001, 0x000016, 0x000016, 0x00001e, 0x000012, 0x000001,\n  0x000015, 0x000019, 0x000037, 0x000001, 0x000003, 0x000002, 0x00001c, 0x00001c, 0x00001c, 0x000007, 0x00001b,\n  0x000035, 0x000015, 0x000012, 0x000011, 0x000048, 0x000032, 0x000032, 0x000023, 0x000029, 0x000001, 0x00001c,\n  0x000015, 0x000014, 0x000016, 0x000034, 0x00002c, 0x000018, 0x000023, 0x000022, 0x00002f, 0x000003, 0x000011,\n  0x000018, 0x000006, 0x000003, 0x00000e, 0x000009, 0x00002e, 0x000007, 0x000001, 0x000015, 0x000006, 0x000001,\n  0x000004, 0x000004, 0x000034, 0x000003, 0x000002, 0x00002f, 0x000001, 0x00002e, 0x000003, 0x00002f, 0x00002a,\n  0x00001a, 0x00002b, 0x00003f, 0x000007, 0x000007, 0x000001, 0x000017, 0x000007, 0x000026, 0x000027, 0x00002d,\n  0x000038, 0x000008, 0x000024, 0x00001d, 0x000006, 0x000001, 0x000025, 0x000005, 0x000001, 0x00001f, 0x000012,\n  0x000399, 0x00006e, 0x0000c3, 0x00042e, 0x000246, 0x000238, 0x00001e, 0x00001d, 0x00002f, 0x000003, 0x000014,\n  0x000012, 0x00003f, 0x00004a, 0x00000c, 0x000001, 0x0017f7, 0x0004d5, 0x000008, 0x00011e, 0x000002, 0x000003,\n  0x00018b, 0x00006a, 0x00000c, 0x000008, 0x000009, 0x000054, 0x000046, 0x000001, 0x000001, 0x000003, 0x00000b,\n  0x000006, 0x000040, 0x000003, 0x000007, 0x000006, 0x00001b, 0x000003, 0x000004, 0x000006, 0x000153, 0x000018,\n  0x000018, 0x00001e, 0x000018, 0x00001e, 0x000018, 0x00001e, 0x000018, 0x00001e, 0x000018, 0x000007, 0x00002c,\n  0x000006, 0x00002b, 0x0000c4, 0x000043, 0x000003, 0x00001a, 0x000001, 0x000009, 0x000003, 0x000002, 0x000001,\n  0x000001, 0x000003, 0x000006, 0x000003, 0x000003, 0x000009, 0x000010, 0x000002, 0x000004, 0x000010, 0x00a6dd,\n  0x001034, 0x0000dd, 0x001681, 0x001d30, 0x00021d, 0x00134a\n};\n\n/**\n * Non-interval characters for ID_Start.\n */\nstatic const uint32_t lit_unicode_id_start_chars_sup[] JERRY_ATTR_CONST_DATA = {\n  0x010808, 0x01083c, 0x010a00, 0x010f27, 0x011144, 0x011147, 0x011176, 0x0111da, 0x0111dc, 0x011288, 0x01133d,\n  0x011350, 0x0114c7, 0x011644, 0x0116b8, 0x011909, 0x01193f, 0x011941, 0x0119e1, 0x0119e3, 0x011a00, 0x011a3a,\n  0x011a50, 0x011a9d, 0x011c40, 0x011d46, 0x011d98, 0x011fb0, 0x016f50, 0x016fe3, 0x01d4a2, 0x01d4bb, 0x01d546,\n  0x01e14e, 0x01e94b, 0x01ee24, 0x01ee27, 0x01ee39, 0x01ee3b, 0x01ee42, 0x01ee47, 0x01ee49, 0x01ee4b, 0x01ee54,\n  0x01ee57, 0x01ee59, 0x01ee5b, 0x01ee5d, 0x01ee5f, 0x01ee64, 0x01ee7e\n};\n\n/**\n * Character interval starting points for ID_Continue.\n */\nstatic const uint32_t lit_unicode_id_continue_interval_starts_sup[] JERRY_ATTR_CONST_DATA = {\n  0x010376, 0x0104a0, 0x010a01, 0x010a05, 0x010a0c, 0x010a38, 0x010ae5, 0x010d24, 0x010d30, 0x010eab, 0x010f46,\n  0x011000, 0x011038, 0x011066, 0x01107f, 0x0110b0, 0x0110f0, 0x011100, 0x011127, 0x011136, 0x011145, 0x011180,\n  0x0111b3, 0x0111c9, 0x0111ce, 0x01122c, 0x0112df, 0x0112f0, 0x011300, 0x01133b, 0x01133e, 0x011347, 0x01134b,\n  0x011362, 0x011366, 0x011370, 0x011435, 0x011450, 0x0114b0, 0x0114d0, 0x0115af, 0x0115b8, 0x0115dc, 0x011630,\n  0x011650, 0x0116ab, 0x0116c0, 0x01171d, 0x011730, 0x01182c, 0x0118e0, 0x011930, 0x011937, 0x01193b, 0x011942,\n  0x011950, 0x0119d1, 0x0119da, 0x011a01, 0x011a33, 0x011a3b, 0x011a51, 0x011a8a, 0x011c2f, 0x011c38, 0x011c50,\n  0x011c92, 0x011ca9, 0x011d31, 0x011d3c, 0x011d3f, 0x011d50, 0x011d8a, 0x011d90, 0x011d93, 0x011da0, 0x011ef3,\n  0x016a60, 0x016af0, 0x016b30, 0x016b50, 0x016f51, 0x016f8f, 0x016ff0, 0x01bc9d, 0x01d165, 0x01d16d, 0x01d17b,\n  0x01d185, 0x01d1aa, 0x01d242, 0x01d7ce, 0x01da00, 0x01da3b, 0x01da9b, 0x01daa1, 0x01e000, 0x01e008, 0x01e01b,\n  0x01e023, 0x01e026, 0x01e130, 0x01e140, 0x01e2ec, 0x01e8d0, 0x01e944, 0x01e950, 0x01fbf0, 0x0e0100\n};\n\n/**\n * Character interval lengths for ID_Continue.\n */\nstatic const uint16_t lit_unicode_id_continue_interval_lengths_sup[] JERRY_ATTR_CONST_DATA = {\n  0x000004, 0x000009, 0x000002, 0x000001, 0x000003, 0x000002, 0x000001, 0x000003, 0x000009, 0x000001, 0x00000a,\n  0x000002, 0x00000e, 0x000009, 0x000003, 0x00000a, 0x000009, 0x000002, 0x00000d, 0x000009, 0x000001, 0x000002,\n  0x00000d, 0x000003, 0x00000b, 0x00000b, 0x00000b, 0x000009, 0x000003, 0x000001, 0x000006, 0x000001, 0x000002,\n  0x000001, 0x000006, 0x000004, 0x000011, 0x000009, 0x000013, 0x000009, 0x000006, 0x000008, 0x000001, 0x000010,\n  0x000009, 0x00000c, 0x000009, 0x00000e, 0x000009, 0x00000e, 0x000009, 0x000005, 0x000001, 0x000003, 0x000001,\n  0x000009, 0x000006, 0x000006, 0x000009, 0x000006, 0x000003, 0x00000a, 0x00000f, 0x000007, 0x000007, 0x000009,\n  0x000015, 0x00000d, 0x000005, 0x000001, 0x000006, 0x000009, 0x000004, 0x000001, 0x000004, 0x000009, 0x000003,\n  0x000009, 0x000004, 0x000006, 0x000009, 0x000036, 0x000003, 0x000001, 0x000001, 0x000004, 0x000005, 0x000007,\n  0x000006, 0x000003, 0x000002, 0x000031, 0x000036, 0x000031, 0x000004, 0x00000e, 0x000006, 0x000010, 0x000006,\n  0x000001, 0x000004, 0x000006, 0x000009, 0x00000d, 0x000006, 0x000006, 0x000009, 0x000009, 0x0000ef\n};\n\n/**\n * Non-interval characters for ID_Continue.\n */\nstatic const uint32_t lit_unicode_id_continue_chars_sup[] JERRY_ATTR_CONST_DATA = {\n  0x0101fd, 0x0102e0, 0x010a3f, 0x011173, 0x01123e, 0x011357, 0x01145e, 0x011940,\n  0x0119e4, 0x011a47, 0x011d3a, 0x011d47, 0x016f4f, 0x016fe4, 0x01da75, 0x01da84\n};\n"
  },
  {
    "path": "jerry-core/lit/lit-unicode-ranges.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file is automatically generated by the gen-unicode.py script\n * from DerivedCoreProperties.txt. Do not edit! */\n\n/**\n * Character interval starting points for ID_Start.\n */\nstatic const uint16_t lit_unicode_id_start_interval_starts[] JERRY_ATTR_CONST_DATA = {\n  0x00c0, 0x00d8, 0x00f8, 0x01f8, 0x02c6, 0x02e0, 0x0370, 0x0376, 0x037a, 0x0388, 0x038e, 0x03a3, 0x03f7, 0x048a,\n  0x0531, 0x0560, 0x05d0, 0x05ef, 0x0620, 0x066e, 0x0671, 0x06e5, 0x06ee, 0x06fa, 0x0712, 0x074d, 0x07ca, 0x07f4,\n  0x0800, 0x0840, 0x0860, 0x08a0, 0x08b6, 0x0904, 0x0958, 0x0971, 0x0985, 0x098f, 0x0993, 0x09aa, 0x09b6, 0x09dc,\n  0x09df, 0x09f0, 0x0a05, 0x0a0f, 0x0a13, 0x0a2a, 0x0a32, 0x0a35, 0x0a38, 0x0a59, 0x0a72, 0x0a85, 0x0a8f, 0x0a93,\n  0x0aaa, 0x0ab2, 0x0ab5, 0x0ae0, 0x0b05, 0x0b0f, 0x0b13, 0x0b2a, 0x0b32, 0x0b35, 0x0b5c, 0x0b5f, 0x0b85, 0x0b8e,\n  0x0b92, 0x0b99, 0x0b9e, 0x0ba3, 0x0ba8, 0x0bae, 0x0c05, 0x0c0e, 0x0c12, 0x0c2a, 0x0c58, 0x0c60, 0x0c85, 0x0c8e,\n  0x0c92, 0x0caa, 0x0cb5, 0x0ce0, 0x0cf1, 0x0d04, 0x0d0e, 0x0d12, 0x0d54, 0x0d5f, 0x0d7a, 0x0d85, 0x0d9a, 0x0db3,\n  0x0dc0, 0x0e01, 0x0e32, 0x0e40, 0x0e81, 0x0e86, 0x0e8c, 0x0ea7, 0x0eb2, 0x0ec0, 0x0edc, 0x0f40, 0x0f49, 0x0f88,\n  0x1000, 0x1050, 0x105a, 0x1065, 0x106e, 0x1075, 0x10a0, 0x10d0, 0x10fc, 0x11fc, 0x124a, 0x1250, 0x125a, 0x1260,\n  0x128a, 0x1290, 0x12b2, 0x12b8, 0x12c2, 0x12c8, 0x12d8, 0x1312, 0x1318, 0x1380, 0x13a0, 0x13f8, 0x1401, 0x1501,\n  0x1601, 0x166f, 0x1681, 0x16a0, 0x16ee, 0x1700, 0x170e, 0x1720, 0x1740, 0x1760, 0x176e, 0x1780, 0x1820, 0x1880,\n  0x18b0, 0x1900, 0x1950, 0x1970, 0x1980, 0x19b0, 0x1a00, 0x1a20, 0x1b05, 0x1b45, 0x1b83, 0x1bae, 0x1bba, 0x1c00,\n  0x1c4d, 0x1c5a, 0x1c80, 0x1c90, 0x1cbd, 0x1ce9, 0x1cee, 0x1cf5, 0x1d00, 0x1e00, 0x1f00, 0x1f18, 0x1f20, 0x1f48,\n  0x1f50, 0x1f5f, 0x1f80, 0x1fb6, 0x1fc2, 0x1fc6, 0x1fd0, 0x1fd6, 0x1fe0, 0x1ff2, 0x1ff6, 0x2090, 0x210a, 0x2118,\n  0x212a, 0x213c, 0x2145, 0x2160, 0x2c00, 0x2c30, 0x2c60, 0x2ceb, 0x2cf2, 0x2d00, 0x2d30, 0x2d80, 0x2da0, 0x2da8,\n  0x2db0, 0x2db8, 0x2dc0, 0x2dc8, 0x2dd0, 0x2dd8, 0x3005, 0x3021, 0x3031, 0x3038, 0x3041, 0x309b, 0x30a1, 0x30fc,\n  0x3105, 0x3131, 0x31a0, 0x31f0, 0x3400, 0x3500, 0x3600, 0x3700, 0x3800, 0x3900, 0x3a00, 0x3b00, 0x3c00, 0x3d00,\n  0x3e00, 0x3f00, 0x4000, 0x4100, 0x4200, 0x4300, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, 0x4900, 0x4a00, 0x4b00,\n  0x4c00, 0x4d00, 0x4e00, 0x4f00, 0x5000, 0x5100, 0x5200, 0x5300, 0x5400, 0x5500, 0x5600, 0x5700, 0x5800, 0x5900,\n  0x5a00, 0x5b00, 0x5c00, 0x5d00, 0x5e00, 0x5f00, 0x6000, 0x6100, 0x6200, 0x6300, 0x6400, 0x6500, 0x6600, 0x6700,\n  0x6800, 0x6900, 0x6a00, 0x6b00, 0x6c00, 0x6d00, 0x6e00, 0x6f00, 0x7000, 0x7100, 0x7200, 0x7300, 0x7400, 0x7500,\n  0x7600, 0x7700, 0x7800, 0x7900, 0x7a00, 0x7b00, 0x7c00, 0x7d00, 0x7e00, 0x7f00, 0x8000, 0x8100, 0x8200, 0x8300,\n  0x8400, 0x8500, 0x8600, 0x8700, 0x8800, 0x8900, 0x8a00, 0x8b00, 0x8c00, 0x8d00, 0x8e00, 0x8f00, 0x9000, 0x9100,\n  0x9200, 0x9300, 0x9400, 0x9500, 0x9600, 0x9700, 0x9800, 0x9900, 0x9a00, 0x9b00, 0x9c00, 0x9d00, 0x9e00, 0x9f00,\n  0xa000, 0xa100, 0xa200, 0xa300, 0xa400, 0xa4d0, 0xa500, 0xa600, 0xa610, 0xa62a, 0xa640, 0xa67f, 0xa6a0, 0xa717,\n  0xa722, 0xa78b, 0xa7c2, 0xa7f5, 0xa803, 0xa807, 0xa80c, 0xa840, 0xa882, 0xa8f2, 0xa8fd, 0xa90a, 0xa930, 0xa960,\n  0xa984, 0xa9e0, 0xa9e6, 0xa9fa, 0xaa00, 0xaa40, 0xaa44, 0xaa60, 0xaa7e, 0xaab5, 0xaab9, 0xaadb, 0xaae0, 0xaaf2,\n  0xab01, 0xab09, 0xab11, 0xab20, 0xab28, 0xab30, 0xab5c, 0xab70, 0xac00, 0xad00, 0xae00, 0xaf00, 0xb000, 0xb100,\n  0xb200, 0xb300, 0xb400, 0xb500, 0xb600, 0xb700, 0xb800, 0xb900, 0xba00, 0xbb00, 0xbc00, 0xbd00, 0xbe00, 0xbf00,\n  0xc000, 0xc100, 0xc200, 0xc300, 0xc400, 0xc500, 0xc600, 0xc700, 0xc800, 0xc900, 0xca00, 0xcb00, 0xcc00, 0xcd00,\n  0xce00, 0xcf00, 0xd000, 0xd100, 0xd200, 0xd300, 0xd400, 0xd500, 0xd600, 0xd700, 0xd7b0, 0xd7cb, 0xf900, 0xfa00,\n  0xfa70, 0xfb00, 0xfb13, 0xfb1f, 0xfb2a, 0xfb38, 0xfb40, 0xfb43, 0xfb46, 0xfbd3, 0xfcd3, 0xfd50, 0xfd92, 0xfdf0,\n  0xfe70, 0xfe76, 0xff21, 0xff41, 0xff66, 0xffc2, 0xffca, 0xffd2, 0xffda\n};\n\n/**\n * Character interval lengths for ID_Start.\n */\nstatic const uint8_t lit_unicode_id_start_interval_lengths[] JERRY_ATTR_CONST_DATA = {\n  0x0016, 0x001e, 0x00ff, 0x00c9, 0x000b, 0x0004, 0x0004, 0x0001, 0x0003, 0x0002, 0x0013, 0x0052, 0x008a, 0x00a5,\n  0x0025, 0x0028, 0x001a, 0x0003, 0x002a, 0x0001, 0x0062, 0x0001, 0x0001, 0x0002, 0x001d, 0x0058, 0x0020, 0x0001,\n  0x0015, 0x0018, 0x000a, 0x0014, 0x0011, 0x0035, 0x0009, 0x000f, 0x0007, 0x0001, 0x0015, 0x0006, 0x0003, 0x0001,\n  0x0002, 0x0001, 0x0005, 0x0001, 0x0015, 0x0006, 0x0001, 0x0001, 0x0001, 0x0003, 0x0002, 0x0008, 0x0002, 0x0015,\n  0x0006, 0x0001, 0x0004, 0x0001, 0x0007, 0x0001, 0x0015, 0x0006, 0x0001, 0x0004, 0x0001, 0x0002, 0x0005, 0x0002,\n  0x0003, 0x0001, 0x0001, 0x0001, 0x0002, 0x000b, 0x0007, 0x0002, 0x0016, 0x000f, 0x0002, 0x0001, 0x0007, 0x0002,\n  0x0016, 0x0009, 0x0004, 0x0001, 0x0001, 0x0008, 0x0002, 0x0028, 0x0002, 0x0002, 0x0005, 0x0011, 0x0017, 0x0008,\n  0x0006, 0x002f, 0x0001, 0x0006, 0x0001, 0x0004, 0x0017, 0x0009, 0x0001, 0x0004, 0x0003, 0x0007, 0x0023, 0x0004,\n  0x002a, 0x0005, 0x0003, 0x0001, 0x0002, 0x000c, 0x0025, 0x002a, 0x00ff, 0x004c, 0x0003, 0x0006, 0x0003, 0x0028,\n  0x0003, 0x0020, 0x0003, 0x0006, 0x0003, 0x000e, 0x0038, 0x0003, 0x0042, 0x000f, 0x0055, 0x0005, 0x00ff, 0x00ff,\n  0x006b, 0x0010, 0x0019, 0x004a, 0x000a, 0x000c, 0x0003, 0x0011, 0x0011, 0x000c, 0x0002, 0x0033, 0x0058, 0x0028,\n  0x0045, 0x001e, 0x001d, 0x0004, 0x002b, 0x0019, 0x0016, 0x0034, 0x002e, 0x0006, 0x001d, 0x0001, 0x002b, 0x0023,\n  0x0002, 0x0023, 0x0008, 0x002a, 0x0002, 0x0003, 0x0005, 0x0001, 0x00bf, 0x00ff, 0x0015, 0x0005, 0x0025, 0x0005,\n  0x0007, 0x001e, 0x0034, 0x0006, 0x0002, 0x0006, 0x0003, 0x0005, 0x000c, 0x0002, 0x0006, 0x000c, 0x0009, 0x0005,\n  0x000f, 0x0003, 0x0004, 0x0028, 0x002e, 0x002e, 0x0084, 0x0003, 0x0001, 0x0025, 0x0037, 0x0016, 0x0006, 0x0006,\n  0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0002, 0x0008, 0x0004, 0x0004, 0x0055, 0x0004, 0x0059, 0x0003,\n  0x002a, 0x005d, 0x001f, 0x000f, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,\n  0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,\n  0x00ff, 0x00bf, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,\n  0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,\n  0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,\n  0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,\n  0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,\n  0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00fc,\n  0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x008c, 0x002d, 0x00ff, 0x000c, 0x000f, 0x0001, 0x002e, 0x001e, 0x004f, 0x0008,\n  0x0066, 0x0034, 0x0008, 0x000c, 0x0002, 0x0003, 0x0016, 0x0033, 0x0031, 0x0005, 0x0001, 0x001b, 0x0016, 0x001c,\n  0x002e, 0x0004, 0x0009, 0x0004, 0x0028, 0x0002, 0x0007, 0x0016, 0x0031, 0x0001, 0x0004, 0x0002, 0x000a, 0x0002,\n  0x0005, 0x0005, 0x0005, 0x0006, 0x0006, 0x002a, 0x000d, 0x0072, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,\n  0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,\n  0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,\n  0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00a3, 0x0016, 0x0030, 0x00ff, 0x006d,\n  0x0069, 0x0006, 0x0004, 0x0009, 0x000c, 0x0004, 0x0001, 0x0001, 0x006b, 0x00ff, 0x006a, 0x003f, 0x0035, 0x000b,\n  0x0004, 0x0086, 0x0019, 0x0019, 0x0058, 0x0005, 0x0005, 0x0005, 0x0002\n};\n\n/**\n * Non-interval characters for ID_Start.\n */\nstatic const uint16_t lit_unicode_id_start_chars[] JERRY_ATTR_CONST_DATA = {\n  0x00aa, 0x00b5, 0x00ba, 0x02ec, 0x02ee, 0x037f, 0x0386, 0x038c, 0x0559, 0x06d5, 0x06ff, 0x0710, 0x07b1, 0x07fa,\n  0x081a, 0x0824, 0x0828, 0x093d, 0x0950, 0x09b2, 0x09bd, 0x09ce, 0x09fc, 0x0a5e, 0x0abd, 0x0ad0, 0x0af9, 0x0b3d,\n  0x0b71, 0x0b83, 0x0b9c, 0x0bd0, 0x0c3d, 0x0c80, 0x0cbd, 0x0cde, 0x0d3d, 0x0d4e, 0x0dbd, 0x0e84, 0x0ea5, 0x0ebd,\n  0x0ec6, 0x0f00, 0x103f, 0x1061, 0x108e, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1cfa,\n  0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f, 0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2d27,\n  0x2d2d, 0x2d6f, 0xa8fb, 0xa9cf, 0xaa7a, 0xaab1, 0xaac0, 0xaac2, 0xfb1d, 0xfb3e\n};\n\n/**\n * Character interval starting points for ID_Continue.\n */\nstatic const uint16_t lit_unicode_id_continue_interval_starts[] JERRY_ATTR_CONST_DATA = {\n  0x0300, 0x0483, 0x0591, 0x05c1, 0x05c4, 0x0610, 0x064b, 0x06d6, 0x06df, 0x06e7, 0x06ea, 0x06f0, 0x0730, 0x07a6,\n  0x07c0, 0x07eb, 0x0816, 0x081b, 0x0825, 0x0829, 0x0859, 0x08d3, 0x08e3, 0x093a, 0x093e, 0x0951, 0x0962, 0x0966,\n  0x0981, 0x09be, 0x09c7, 0x09cb, 0x09e2, 0x09e6, 0x0a01, 0x0a3e, 0x0a47, 0x0a4b, 0x0a66, 0x0a81, 0x0abe, 0x0ac7,\n  0x0acb, 0x0ae2, 0x0ae6, 0x0afa, 0x0b01, 0x0b3e, 0x0b47, 0x0b4b, 0x0b55, 0x0b62, 0x0b66, 0x0bbe, 0x0bc6, 0x0bca,\n  0x0be6, 0x0c00, 0x0c3e, 0x0c46, 0x0c4a, 0x0c55, 0x0c62, 0x0c66, 0x0c81, 0x0cbe, 0x0cc6, 0x0cca, 0x0cd5, 0x0ce2,\n  0x0ce6, 0x0d00, 0x0d3b, 0x0d3e, 0x0d46, 0x0d4a, 0x0d62, 0x0d66, 0x0d81, 0x0dcf, 0x0dd8, 0x0de6, 0x0df2, 0x0e34,\n  0x0e47, 0x0e50, 0x0eb4, 0x0ec8, 0x0ed0, 0x0f18, 0x0f20, 0x0f3e, 0x0f71, 0x0f86, 0x0f8d, 0x0f99, 0x102b, 0x1040,\n  0x1056, 0x105e, 0x1062, 0x1067, 0x1071, 0x1082, 0x108f, 0x135d, 0x1369, 0x1712, 0x1732, 0x1752, 0x1772, 0x17b4,\n  0x17e0, 0x180b, 0x1810, 0x1920, 0x1930, 0x1946, 0x19d0, 0x1a17, 0x1a55, 0x1a60, 0x1a7f, 0x1a90, 0x1ab0, 0x1abf,\n  0x1b00, 0x1b34, 0x1b50, 0x1b6b, 0x1b80, 0x1ba1, 0x1bb0, 0x1be6, 0x1c24, 0x1c40, 0x1c50, 0x1cd0, 0x1cd4, 0x1cf7,\n  0x1dc0, 0x1dfb, 0x200c, 0x203f, 0x20d0, 0x20e5, 0x2cef, 0x2de0, 0x302a, 0x3099, 0xa620, 0xa674, 0xa69e, 0xa6f0,\n  0xa823, 0xa880, 0xa8b4, 0xa8d0, 0xa8e0, 0xa8ff, 0xa926, 0xa947, 0xa980, 0xa9b3, 0xa9d0, 0xa9f0, 0xaa29, 0xaa4c,\n  0xaa50, 0xaa7b, 0xaab2, 0xaab7, 0xaabe, 0xaaeb, 0xaaf5, 0xabe3, 0xabec, 0xabf0, 0xfe00, 0xfe20, 0xfe33, 0xfe4d,\n  0xff10\n};\n\n/**\n * Character interval lengths for ID_Continue.\n */\nstatic const uint8_t lit_unicode_id_continue_interval_lengths[] JERRY_ATTR_CONST_DATA = {\n  0x006f, 0x0004, 0x002c, 0x0001, 0x0001, 0x000a, 0x001e, 0x0006, 0x0005, 0x0001, 0x0003, 0x0009, 0x001a, 0x000a,\n  0x0009, 0x0008, 0x0003, 0x0008, 0x0002, 0x0004, 0x0002, 0x000e, 0x0020, 0x0002, 0x0011, 0x0006, 0x0001, 0x0009,\n  0x0002, 0x0006, 0x0001, 0x0002, 0x0001, 0x0009, 0x0002, 0x0004, 0x0001, 0x0002, 0x000b, 0x0002, 0x0007, 0x0002,\n  0x0002, 0x0001, 0x0009, 0x0005, 0x0002, 0x0006, 0x0001, 0x0002, 0x0002, 0x0001, 0x0009, 0x0004, 0x0002, 0x0003,\n  0x0009, 0x0004, 0x0006, 0x0002, 0x0003, 0x0001, 0x0001, 0x0009, 0x0002, 0x0006, 0x0002, 0x0003, 0x0001, 0x0001,\n  0x0009, 0x0003, 0x0001, 0x0006, 0x0002, 0x0003, 0x0001, 0x0009, 0x0002, 0x0005, 0x0007, 0x0009, 0x0001, 0x0006,\n  0x0007, 0x0009, 0x0008, 0x0005, 0x0009, 0x0001, 0x0009, 0x0001, 0x0013, 0x0001, 0x000a, 0x0023, 0x0013, 0x0009,\n  0x0003, 0x0002, 0x0002, 0x0006, 0x0003, 0x000b, 0x000e, 0x0002, 0x0008, 0x0002, 0x0002, 0x0001, 0x0001, 0x001f,\n  0x0009, 0x0002, 0x0009, 0x000b, 0x000b, 0x0009, 0x000a, 0x0004, 0x0009, 0x001c, 0x000a, 0x0009, 0x000d, 0x0001,\n  0x0004, 0x0010, 0x0009, 0x0008, 0x0002, 0x000c, 0x0009, 0x000d, 0x0013, 0x0009, 0x0009, 0x0002, 0x0014, 0x0002,\n  0x0039, 0x0004, 0x0001, 0x0001, 0x000c, 0x000b, 0x0002, 0x001f, 0x0005, 0x0001, 0x0009, 0x0009, 0x0001, 0x0001,\n  0x0004, 0x0001, 0x0011, 0x0009, 0x0011, 0x000a, 0x0007, 0x000c, 0x0003, 0x000d, 0x0009, 0x0009, 0x000d, 0x0001,\n  0x0009, 0x0002, 0x0002, 0x0001, 0x0001, 0x0004, 0x0001, 0x0007, 0x0001, 0x0009, 0x000f, 0x000f, 0x0001, 0x0002,\n  0x0009\n};\n\n/**\n * Non-interval characters for ID_Continue.\n */\nstatic const uint16_t lit_unicode_id_continue_chars[] JERRY_ATTR_CONST_DATA = {\n  0x00b7, 0x0387, 0x05bf, 0x05c7, 0x0670, 0x0711, 0x07fd, 0x09bc, 0x09d7, 0x09fe, 0x0a3c, 0x0a51,\n  0x0a75, 0x0abc, 0x0b3c, 0x0b82, 0x0bd7, 0x0cbc, 0x0d57, 0x0dca, 0x0dd6, 0x0e31, 0x0eb1, 0x0f35,\n  0x0f37, 0x0f39, 0x0fc6, 0x17dd, 0x18a9, 0x1ced, 0x1cf4, 0x2054, 0x20e1, 0x2d7f, 0xa66f, 0xa802,\n  0xa806, 0xa80b, 0xa82c, 0xa9e5, 0xaa43, 0xaab0, 0xaac1, 0xfb1e, 0xff3f\n};\n\n/**\n * Character interval starting points for White_Space.\n */\nstatic const uint16_t lit_unicode_white_space_interval_starts[] JERRY_ATTR_CONST_DATA = { 0x2000 };\n\n/**\n * Character interval lengths for White_Space.\n */\nstatic const uint8_t lit_unicode_white_space_interval_lengths[] JERRY_ATTR_CONST_DATA = { 0x000a };\n\n/**\n * Non-interval characters for White_Space.\n */\nstatic const uint16_t lit_unicode_white_space_chars[] JERRY_ATTR_CONST_DATA = { 0x00a0,\n                                                                                0x1680,\n                                                                                0x202f,\n                                                                                0x205f,\n                                                                                0x3000 };\n"
  },
  {
    "path": "jerry-core/parser/js/byte-code.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"js-parser-internal.h\"\n\n/* These two checks only checks the compiler, they have no effect on the code. */\nJERRY_STATIC_ASSERT (sizeof (cbc_uint8_arguments_t) == 16, sizeof_cbc_uint8_arguments_t_must_be_16_byte_long);\n\nJERRY_STATIC_ASSERT (sizeof (cbc_uint16_arguments_t) == 24, sizeof_cbc_uint16_arguments_t_must_be_24_byte_long);\n\nJERRY_STATIC_ASSERT (offsetof (cbc_uint8_arguments_t, script_value) == offsetof (cbc_uint16_arguments_t, script_value),\n                     script_value_in_cbc_uint8_arguments_and_cbc_uint16_arguments_must_be_in_the_same_offset);\n\n/**\n * The reason of these two static asserts to notify the developer to increase the JERRY_SNAPSHOT_VERSION\n * whenever new bytecodes are introduced or existing ones have been deleted.\n */\nJERRY_STATIC_ASSERT (CBC_END == 238, number_of_cbc_opcodes_changed);\nJERRY_STATIC_ASSERT (CBC_EXT_END == 170, number_of_cbc_ext_opcodes_changed);\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_bytecode Bytecode\n * @{\n */\n\n#if JERRY_PARSER || JERRY_PARSER_DUMP_BYTE_CODE\n\n/**\n * Compact bytecode definition\n */\n#define CBC_OPCODE(arg1, arg2, arg3, arg4) ((arg2) | (((arg3) + CBC_STACK_ADJUST_BASE) << CBC_STACK_ADJUST_SHIFT)),\n\n/**\n * Flags of the opcodes.\n */\nconst uint8_t cbc_flags[] JERRY_ATTR_CONST_DATA = { CBC_OPCODE_LIST };\n\n/**\n * Flags of the extended opcodes.\n */\nconst uint8_t cbc_ext_flags[] = { CBC_EXT_OPCODE_LIST };\n\n#undef CBC_OPCODE\n\n#endif /* JERRY_PARSER || JERRY_PARSER_DUMP_BYTE_CODE */\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n\n#define CBC_OPCODE(arg1, arg2, arg3, arg4) #arg1,\n\n/**\n * Names of the opcodes.\n */\nconst char* const cbc_names[] = { CBC_OPCODE_LIST };\n\n/**\n * Names of the extended opcodes.\n */\nconst char* const cbc_ext_names[] = { CBC_EXT_OPCODE_LIST };\n\n#undef CBC_OPCODE\n\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/parser/js/byte-code.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef BYTE_CODE_H\n#define BYTE_CODE_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_bytecode Bytecode\n * @{\n */\n\n/**\n * Compact byte code (CBC) is a byte code representation\n * of EcmaScript which is designed for low memory\n * environments. Most opcodes are only one or sometimes\n * two byte long so the CBC provides a small binary size.\n *\n * The execution engine of CBC is a stack machine, where\n * the maximum stack size is known in advance for each\n * function.\n */\n\n/**\n * Byte code flags. Only the lower 5 bit can be used\n * since the stack change is encoded in the upper\n * three bits for each instruction between -4 and 3\n * (except for call / construct opcodes).\n */\n#define CBC_STACK_ADJUST_BASE         4\n#define CBC_STACK_ADJUST_SHIFT        5\n#define CBC_STACK_ADJUST_VALUE(value) (((value) >> CBC_STACK_ADJUST_SHIFT) - CBC_STACK_ADJUST_BASE)\n\n#define CBC_NO_FLAG          0x00u\n#define CBC_HAS_LITERAL_ARG  0x01u\n#define CBC_HAS_LITERAL_ARG2 0x02u\n#define CBC_HAS_BYTE_ARG     0x04u\n#define CBC_HAS_BRANCH_ARG   0x08u\n\n/* These flags are shared */\n#define CBC_FORWARD_BRANCH_ARG 0x10u\n#define CBC_POP_STACK_BYTE_ARG 0x10u\n\n#define CBC_ARG_TYPES (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2 | CBC_HAS_BYTE_ARG | CBC_HAS_BRANCH_ARG)\n\n#define CBC_HAS_POP_STACK_BYTE_ARG (CBC_HAS_BYTE_ARG | CBC_POP_STACK_BYTE_ARG)\n\n/**\n * CBC_NO_RESULT_OPERATION for ext opcodes\n */\n#define CBC_EXT_NO_RESULT_OPERATION(opcode)                \\\n  ((opcode) >= PARSER_TO_EXT_OPCODE (CBC_EXT_ASSIGN_SUPER) \\\n   && (opcode) <= PARSER_TO_EXT_OPCODE (CBC_EXT_SPREAD_CALL_PROP_BLOCK))\n\n/* Debug macro. */\n#define CBC_ARGS_EQ(op, types) ((cbc_flags[op] & CBC_ARG_TYPES) == (types))\n\n/* Debug macro. */\n#define CBC_SAME_ARGS(op1, op2)                                                                          \\\n  (CBC_EXT_NO_RESULT_OPERATION (op1) ? ((cbc_ext_flags[PARSER_GET_EXT_OPCODE (op1)] & CBC_ARG_TYPES)     \\\n                                        == (cbc_ext_flags[PARSER_GET_EXT_OPCODE (op2)] & CBC_ARG_TYPES)) \\\n                                     : ((cbc_flags[op1] & CBC_ARG_TYPES) == (cbc_flags[op2] & CBC_ARG_TYPES)))\n\n#define CBC_UNARY_OPERATION(name, group)                                                 \\\n  CBC_OPCODE (name, CBC_NO_FLAG, 0, (VM_OC_##group) | VM_OC_GET_STACK | VM_OC_PUT_STACK) \\\n  CBC_OPCODE (name##_LITERAL, CBC_HAS_LITERAL_ARG, 1, (VM_OC_##group) | VM_OC_GET_LITERAL | VM_OC_PUT_STACK)\n\n#define CBC_BINARY_OPERATION(name, group)                                                       \\\n  CBC_OPCODE (name, CBC_NO_FLAG, -1, (VM_OC_##group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \\\n  CBC_OPCODE (name##_RIGHT_LITERAL,                                                             \\\n              CBC_HAS_LITERAL_ARG,                                                              \\\n              0,                                                                                \\\n              (VM_OC_##group) | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK)                      \\\n  CBC_OPCODE (name##_TWO_LITERALS,                                                              \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                       \\\n              1,                                                                                \\\n              (VM_OC_##group) | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK)\n\n#define CBC_UNARY_LVALUE_OPERATION(name, group)                                                            \\\n  CBC_OPCODE (name, CBC_NO_FLAG, -2, (VM_OC_PROP_##group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE)   \\\n  CBC_OPCODE (name##_PUSH_RESULT,                                                                          \\\n              CBC_NO_FLAG,                                                                                 \\\n              -1,                                                                                          \\\n              (VM_OC_PROP_##group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK)        \\\n  CBC_OPCODE (name##_BLOCK,                                                                                \\\n              CBC_NO_FLAG,                                                                                 \\\n              -2,                                                                                          \\\n              (VM_OC_PROP_##group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK)        \\\n  CBC_OPCODE (name##_IDENT, CBC_HAS_LITERAL_ARG, 0, (VM_OC_##group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT) \\\n  CBC_OPCODE (name##_IDENT_PUSH_RESULT,                                                                    \\\n              CBC_HAS_LITERAL_ARG,                                                                         \\\n              1,                                                                                           \\\n              (VM_OC_##group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_STACK)                     \\\n  CBC_OPCODE (name##_IDENT_BLOCK,                                                                          \\\n              CBC_HAS_LITERAL_ARG,                                                                         \\\n              0,                                                                                           \\\n              (VM_OC_##group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK)\n\n#define CBC_UNARY_LVALUE_WITH_IDENT 3\n\n#define CBC_BINARY_WITH_LITERAL      1\n#define CBC_BINARY_WITH_TWO_LITERALS 2\n\n/**\n * Several opcodes (mostly call and assignment opcodes) have\n * two forms: one which does not push a return value onto\n * the stack, and another which does. The reason is that\n * the return value of these opcodes are often not used\n * and the first form provides smaller byte code.\n *\n * The following rules must be kept by the code generator:\n *  - only the opcode without return value can be emitted\n *    by the code generator\n *  - the first form can be converted to the second form\n *    by adding 1 to the opcode\n *  - after the conversion the opcode must be immediately\n *    flushed, so no further changes are possible\n *\n * Hence CBC_NO_RESULT_OPERATION (context_p->last_cbc_opcode)\n * cannot be true for an opcode which has a result\n */\n#define CBC_NO_RESULT_OPERATION(opcode) \\\n  (((opcode) >= CBC_PRE_INCR && (opcode) < CBC_END) || CBC_EXT_NO_RESULT_OPERATION ((opcode)))\n\n/**\n * Branch instructions are organized in group of 8 opcodes.\n *  - 1st opcode: unused, can be used for other purpose\n *  - 2nd opcode: forward branch with 1 byte offset\n *  - 3rd opcode: forward branch with 2 byte offset\n *  - 4th opcode: forward branch with 3 byte offset\n *  - 5th opcode: unused, can be used for other purpose\n *  - 6th opcode: backward branch with 1 byte offset\n *  - 7th opcode: backward branch with 2 byte offset\n *  - 8th opcode: backward branch with 3 byte offset\n *\n * Reasons:\n *  The branch_opcode & 0x3 tells the length in bytes of the offset\n *  If branch offset & 0x4 == 0, it is a forward branch. Otherwise\n *  it is backward.\n *\n * The offset bytes are encoded in higher to lower order.\n */\n\n#define CBC_FORWARD_BRANCH(name, stack, vm_oc)                                                          \\\n  CBC_OPCODE (name, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH)     \\\n  CBC_OPCODE (name##_2, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH) \\\n  CBC_OPCODE (name##_3, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH)\n\n#define CBC_BACKWARD_BRANCH(name, stack, vm_oc)                                                        \\\n  CBC_OPCODE (name, CBC_HAS_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH)     \\\n  CBC_OPCODE (name##_2, CBC_HAS_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH) \\\n  CBC_OPCODE (name##_3, CBC_HAS_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH)\n\n#define CBC_BRANCH_OFFSET_LENGTH(opcode) ((opcode) &0x3)\n\n#define CBC_BRANCH_IS_BACKWARD(flags) (!((flags) &CBC_FORWARD_BRANCH_ARG))\n\n#define CBC_BRANCH_IS_FORWARD(flags) ((flags) &CBC_FORWARD_BRANCH_ARG)\n\n/* Stack consumption of opcodes with context. */\n\n/* PARSER_TRY_CONTEXT_STACK_ALLOCATION must be <= 3 */\n#define PARSER_TRY_CONTEXT_STACK_ALLOCATION 1\n/* PARSER_FINALLY_CONTEXT_STACK_ALLOCATION must be <= 3 */\n#define PARSER_FINALLY_CONTEXT_STACK_ALLOCATION 2\n/* PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION must be <= 4 */\n#define PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION 4\n/* PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION must be <= 4 */\n#define PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION 4\n/* PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION must be <= 4 */\n#define PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION 4\n/* PARSER_WITH_CONTEXT_STACK_ALLOCATION must be <= 4 */\n#define PARSER_WITH_CONTEXT_STACK_ALLOCATION 1\n/* PARSER_BLOCK_CONTEXT_STACK_ALLOCATION must be <= 3 */\n#define PARSER_BLOCK_CONTEXT_STACK_ALLOCATION 1\n/* PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION must be <= 3 */\n#define PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION 3\n/* PARSER_OBJECT_INITIALIZER_CONTEXT_STACK_ALLOCATION must be <= 2 */\n#define PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION 1\n/* PARSER_OBJECT_INITIALIZER_CONTEXT_STACK_ALLOCATION must be <= 2 */\n#define PARSER_OBJ_INIT_REST_CONTEXT_STACK_ALLOCATION 2\n\n/**\n * Extra stack consumption for finally context.\n */\n#define PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION \\\n  (PARSER_FINALLY_CONTEXT_STACK_ALLOCATION - PARSER_TRY_CONTEXT_STACK_ALLOCATION)\n\n#define PARSER_STATIC_PRIVATE_TO_PRIVATE_OFFSET (CBC_EXT_COLLECT_PRIVATE_STATIC_FIELD - CBC_EXT_COLLECT_PRIVATE_FIELD)\n\n/**\n * Opcode definitions.\n */\n#define CBC_OPCODE_LIST                                                                                             \\\n  /* Branch opcodes first. Some other opcodes are mixed. */                                                         \\\n  CBC_OPCODE (CBC_EXT_OPCODE, CBC_NO_FLAG, 0, VM_OC_NONE)                                                           \\\n  CBC_FORWARD_BRANCH (CBC_JUMP_FORWARD, 0, VM_OC_JUMP)                                                              \\\n  CBC_OPCODE (CBC_POP, CBC_NO_FLAG, -1, VM_OC_POP)                                                                  \\\n  CBC_BACKWARD_BRANCH (CBC_JUMP_BACKWARD, 0, VM_OC_JUMP)                                                            \\\n  CBC_OPCODE (CBC_POP_BLOCK, CBC_NO_FLAG, -1, VM_OC_POP_BLOCK | VM_OC_PUT_BLOCK)                                    \\\n  CBC_FORWARD_BRANCH (CBC_BRANCH_IF_TRUE_FORWARD, -1, VM_OC_BRANCH_IF_TRUE)                                         \\\n  CBC_OPCODE (CBC_THROW, CBC_NO_FLAG, -1, VM_OC_THROW | VM_OC_GET_STACK)                                            \\\n  CBC_BACKWARD_BRANCH (CBC_BRANCH_IF_TRUE_BACKWARD, -1, VM_OC_BRANCH_IF_TRUE)                                       \\\n  CBC_OPCODE (CBC_CONTEXT_END, CBC_NO_FLAG, 0, VM_OC_CONTEXT_END)                                                   \\\n  CBC_FORWARD_BRANCH (CBC_BRANCH_IF_FALSE_FORWARD, -1, VM_OC_BRANCH_IF_FALSE)                                       \\\n  CBC_OPCODE (CBC_CREATE_OBJECT, CBC_NO_FLAG, 1, VM_OC_PUSH_OBJECT | VM_OC_PUT_STACK)                               \\\n  CBC_BACKWARD_BRANCH (CBC_BRANCH_IF_FALSE_BACKWARD, -1, VM_OC_BRANCH_IF_FALSE)                                     \\\n  CBC_OPCODE (CBC_SET_PROPERTY,                                                                                     \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              -1,                                                                                                   \\\n              VM_OC_SET_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_LITERAL)                                 \\\n  CBC_FORWARD_BRANCH (CBC_JUMP_FORWARD_EXIT_CONTEXT, 0, VM_OC_JUMP_AND_EXIT_CONTEXT)                                \\\n  CBC_OPCODE (CBC_CREATE_ARRAY, CBC_NO_FLAG, 1, VM_OC_PUSH_ARRAY | VM_OC_PUT_STACK)                                 \\\n  CBC_FORWARD_BRANCH (CBC_BRANCH_IF_LOGICAL_TRUE, -1, VM_OC_BRANCH_IF_LOGICAL_TRUE)                                 \\\n  CBC_OPCODE (CBC_ARRAY_APPEND, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_APPEND_ARRAY)                                  \\\n  CBC_FORWARD_BRANCH (CBC_BRANCH_IF_LOGICAL_FALSE, -1, VM_OC_BRANCH_IF_LOGICAL_FALSE)                               \\\n  CBC_OPCODE (CBC_PUSH_ELISION, CBC_NO_FLAG, 1, VM_OC_PUSH_ELISON | VM_OC_PUT_STACK)                                \\\n  CBC_FORWARD_BRANCH (CBC_BRANCH_IF_STRICT_EQUAL, -1, VM_OC_BRANCH_IF_STRICT_EQUAL)                                 \\\n  CBC_OPCODE (CBC_PUSH_NULL, CBC_NO_FLAG, 1, VM_OC_PUSH_NULL | VM_OC_PUT_STACK)                                     \\\n  CBC_FORWARD_BRANCH (CBC_BLOCK_CREATE_CONTEXT, PARSER_BLOCK_CONTEXT_STACK_ALLOCATION, VM_OC_BLOCK_CREATE_CONTEXT)  \\\n                                                                                                                    \\\n  /* Basic opcodes. Note: These 4 opcodes must me in this order */                                                  \\\n  CBC_OPCODE (CBC_PUSH_LITERAL, CBC_HAS_LITERAL_ARG, 1, VM_OC_PUSH | VM_OC_GET_LITERAL)                             \\\n  CBC_OPCODE (CBC_PUSH_TWO_LITERALS,                                                                                \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                           \\\n              2,                                                                                                    \\\n              VM_OC_PUSH_TWO | VM_OC_GET_LITERAL_LITERAL)                                                           \\\n  CBC_OPCODE (CBC_PUSH_THIS_LITERAL, CBC_HAS_LITERAL_ARG, 2, VM_OC_PUSH_TWO | VM_OC_GET_THIS_LITERAL)               \\\n  CBC_OPCODE (CBC_PUSH_THREE_LITERALS, CBC_HAS_LITERAL_ARG2, 3, VM_OC_PUSH_THREE | VM_OC_GET_LITERAL_LITERAL)       \\\n  CBC_OPCODE (CBC_PUSH_UNDEFINED, CBC_NO_FLAG, 1, VM_OC_PUSH_UNDEFINED | VM_OC_PUT_STACK)                           \\\n  CBC_OPCODE (CBC_PUSH_TRUE, CBC_NO_FLAG, 1, VM_OC_PUSH_TRUE | VM_OC_PUT_STACK)                                     \\\n  CBC_OPCODE (CBC_PUSH_FALSE, CBC_NO_FLAG, 1, VM_OC_PUSH_FALSE | VM_OC_PUT_STACK)                                   \\\n  CBC_OPCODE (CBC_PUSH_THIS, CBC_NO_FLAG, 1, VM_OC_PUSH_THIS | VM_OC_PUT_STACK)                                     \\\n  CBC_OPCODE (CBC_PUSH_NUMBER_0, CBC_NO_FLAG, 1, VM_OC_PUSH_0 | VM_OC_PUT_STACK)                                    \\\n  CBC_OPCODE (CBC_PUSH_NUMBER_POS_BYTE, CBC_HAS_BYTE_ARG, 1, VM_OC_PUSH_POS_BYTE | VM_OC_PUT_STACK)                 \\\n  CBC_OPCODE (CBC_PUSH_NUMBER_NEG_BYTE, CBC_HAS_BYTE_ARG, 1, VM_OC_PUSH_NEG_BYTE | VM_OC_PUT_STACK)                 \\\n  CBC_OPCODE (CBC_PUSH_LITERAL_PUSH_NUMBER_0, CBC_HAS_LITERAL_ARG, 2, VM_OC_PUSH_LIT_0 | VM_OC_GET_LITERAL)         \\\n  CBC_OPCODE (CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE,                                                                \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_BYTE_ARG,                                                               \\\n              2,                                                                                                    \\\n              VM_OC_PUSH_LIT_POS_BYTE | VM_OC_GET_LITERAL)                                                          \\\n  CBC_OPCODE (CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE,                                                                \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_BYTE_ARG,                                                               \\\n              2,                                                                                                    \\\n              VM_OC_PUSH_LIT_NEG_BYTE | VM_OC_GET_LITERAL)                                                          \\\n  /* Note: These 4 opcodes must me in this order */                                                                 \\\n  CBC_OPCODE (CBC_PUSH_PROP, CBC_NO_FLAG, -1, VM_OC_PROP_GET | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK)             \\\n  CBC_OPCODE (CBC_PUSH_PROP_LITERAL,                                                                                \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              0,                                                                                                    \\\n              VM_OC_PROP_GET | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK)                                           \\\n  CBC_OPCODE (CBC_PUSH_PROP_LITERAL_LITERAL,                                                                        \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                           \\\n              1,                                                                                                    \\\n              VM_OC_PROP_GET | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK)                                         \\\n  CBC_OPCODE (CBC_PUSH_PROP_THIS_LITERAL,                                                                           \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              1,                                                                                                    \\\n              VM_OC_PROP_GET | VM_OC_GET_THIS_LITERAL | VM_OC_PUT_STACK)                                            \\\n  CBC_OPCODE (CBC_PUSH_IDENT_REFERENCE, CBC_HAS_LITERAL_ARG, 3, VM_OC_IDENT_REFERENCE | VM_OC_PUT_STACK)            \\\n  /* Note: These 4 opcodes must me in this order */                                                                 \\\n  CBC_OPCODE (CBC_PUSH_PROP_REFERENCE, CBC_NO_FLAG, 1, VM_OC_PROP_REFERENCE | VM_OC_PUT_STACK)                      \\\n  CBC_OPCODE (CBC_PUSH_PROP_LITERAL_REFERENCE,                                                                      \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              2,                                                                                                    \\\n              VM_OC_PROP_REFERENCE | VM_OC_GET_LITERAL | VM_OC_PUT_STACK)                                           \\\n  CBC_OPCODE (CBC_PUSH_PROP_LITERAL_LITERAL_REFERENCE,                                                              \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                           \\\n              3,                                                                                                    \\\n              VM_OC_PROP_REFERENCE | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK)                                   \\\n  CBC_OPCODE (CBC_PUSH_PROP_THIS_LITERAL_REFERENCE,                                                                 \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              3,                                                                                                    \\\n              VM_OC_PROP_REFERENCE | VM_OC_GET_THIS_LITERAL | VM_OC_PUT_STACK)                                      \\\n  CBC_OPCODE (CBC_NEW, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_NEW | VM_OC_PUT_STACK)                                  \\\n  CBC_OPCODE (CBC_NEW0, CBC_NO_FLAG, 0, VM_OC_NEW | VM_OC_PUT_STACK)                                                \\\n  CBC_OPCODE (CBC_NEW1, CBC_NO_FLAG, -1, VM_OC_NEW | VM_OC_PUT_STACK)                                               \\\n  CBC_OPCODE (CBC_EVAL, CBC_NO_FLAG, 0, VM_OC_EVAL)                                                                 \\\n  CBC_OPCODE (CBC_CHECK_VAR, CBC_HAS_LITERAL_ARG, 0, VM_OC_CHECK_VAR)                                               \\\n  CBC_OPCODE (CBC_CHECK_LET, CBC_HAS_LITERAL_ARG, 0, VM_OC_CHECK_LET)                                               \\\n  CBC_OPCODE (CBC_CREATE_VAR, CBC_HAS_LITERAL_ARG, 0, VM_OC_CREATE_BINDING)                                         \\\n  CBC_OPCODE (CBC_CREATE_LET, CBC_HAS_LITERAL_ARG, 0, VM_OC_CREATE_BINDING)                                         \\\n  CBC_OPCODE (CBC_CREATE_CONST, CBC_HAS_LITERAL_ARG, 0, VM_OC_CREATE_BINDING)                                       \\\n  CBC_OPCODE (CBC_CREATE_LOCAL, CBC_HAS_LITERAL_ARG, 0, VM_OC_CREATE_BINDING)                                       \\\n  CBC_OPCODE (CBC_INIT_ARG_OR_CATCH, CBC_HAS_LITERAL_ARG, -1, VM_OC_INIT_BINDING)                                   \\\n  CBC_OPCODE (CBC_INIT_LET, CBC_HAS_LITERAL_ARG, -1, VM_OC_INIT_BINDING)                                            \\\n  CBC_OPCODE (CBC_INIT_CONST, CBC_HAS_LITERAL_ARG, -1, VM_OC_INIT_BINDING)                                          \\\n  CBC_OPCODE (CBC_INIT_ARG_OR_FUNC, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, VM_OC_INIT_ARG_OR_FUNC)          \\\n  CBC_OPCODE (CBC_CREATE_VAR_EVAL, CBC_HAS_LITERAL_ARG, 0, VM_OC_VAR_EVAL)                                          \\\n  CBC_OPCODE (CBC_CREATE_VAR_FUNC_EVAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, VM_OC_VAR_EVAL)              \\\n  CBC_OPCODE (CBC_SET_VAR_FUNC,                                                                                     \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                           \\\n              0,                                                                                                    \\\n              VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT)                                                   \\\n  CBC_OPCODE (CBC_SET_BYTECODE_PTR, CBC_NO_FLAG, 0, VM_OC_SET_BYTECODE_PTR)                                         \\\n  CBC_OPCODE (CBC_RETURN, CBC_NO_FLAG, -1, VM_OC_RETURN | VM_OC_GET_STACK)                                          \\\n  CBC_OPCODE (CBC_RETURN_FUNCTION_END, CBC_NO_FLAG, 0, VM_OC_RETURN_FUNCTION_END)                                   \\\n  CBC_OPCODE (CBC_RETURN_WITH_LITERAL, CBC_HAS_LITERAL_ARG, 0, VM_OC_RETURN | VM_OC_GET_LITERAL)                    \\\n  CBC_OPCODE (CBC_SET_LITERAL_PROPERTY,                                                                             \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                           \\\n              0,                                                                                                    \\\n              VM_OC_SET_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL)                               \\\n  CBC_OPCODE (CBC_COPY_TO_GLOBAL,                                                                                   \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                           \\\n              0,                                                                                                    \\\n              VM_OC_COPY_TO_GLOBAL | VM_OC_GET_LITERAL)                                                             \\\n  CBC_OPCODE (CBC_BREAKPOINT_ENABLED, CBC_NO_FLAG, 0, VM_OC_BREAKPOINT_ENABLED)                                     \\\n  CBC_OPCODE (CBC_BREAKPOINT_DISABLED, CBC_NO_FLAG, 0, VM_OC_BREAKPOINT_DISABLED)                                   \\\n                                                                                                                    \\\n  /* Unary opcodes. */                                                                                              \\\n  CBC_UNARY_OPERATION (CBC_PLUS, PLUS)                                                                              \\\n  CBC_UNARY_OPERATION (CBC_NEGATE, MINUS)                                                                           \\\n  CBC_UNARY_OPERATION (CBC_LOGICAL_NOT, NOT)                                                                        \\\n  CBC_UNARY_OPERATION (CBC_BIT_NOT, BIT_NOT)                                                                        \\\n  CBC_UNARY_OPERATION (CBC_VOID, VOID)                                                                              \\\n  CBC_OPCODE (CBC_TYPEOF, CBC_NO_FLAG, 0, VM_OC_TYPEOF | VM_OC_GET_STACK | VM_OC_PUT_STACK)                         \\\n  CBC_OPCODE (CBC_TYPEOF_IDENT, CBC_HAS_LITERAL_ARG, 1, VM_OC_TYPEOF_IDENT | VM_OC_PUT_STACK)                       \\\n                                                                                                                    \\\n  /* Binary opcodes. */                                                                                             \\\n  CBC_BINARY_OPERATION (CBC_BIT_OR, BIT_OR)                                                                         \\\n  CBC_BINARY_OPERATION (CBC_BIT_XOR, BIT_XOR)                                                                       \\\n  CBC_BINARY_OPERATION (CBC_BIT_AND, BIT_AND)                                                                       \\\n  CBC_BINARY_OPERATION (CBC_EQUAL, EQUAL)                                                                           \\\n  CBC_BINARY_OPERATION (CBC_NOT_EQUAL, NOT_EQUAL)                                                                   \\\n  CBC_BINARY_OPERATION (CBC_STRICT_EQUAL, STRICT_EQUAL)                                                             \\\n  CBC_BINARY_OPERATION (CBC_STRICT_NOT_EQUAL, STRICT_NOT_EQUAL)                                                     \\\n  CBC_BINARY_OPERATION (CBC_LESS, LESS)                                                                             \\\n  CBC_BINARY_OPERATION (CBC_GREATER, GREATER)                                                                       \\\n  CBC_BINARY_OPERATION (CBC_LESS_EQUAL, LESS_EQUAL)                                                                 \\\n  CBC_BINARY_OPERATION (CBC_GREATER_EQUAL, GREATER_EQUAL)                                                           \\\n  CBC_BINARY_OPERATION (CBC_IN, IN)                                                                                 \\\n  CBC_BINARY_OPERATION (CBC_INSTANCEOF, INSTANCEOF)                                                                 \\\n  CBC_BINARY_OPERATION (CBC_LEFT_SHIFT, LEFT_SHIFT)                                                                 \\\n  CBC_BINARY_OPERATION (CBC_RIGHT_SHIFT, RIGHT_SHIFT)                                                               \\\n  CBC_BINARY_OPERATION (CBC_UNS_RIGHT_SHIFT, UNS_RIGHT_SHIFT)                                                       \\\n  CBC_BINARY_OPERATION (CBC_ADD, ADD)                                                                               \\\n  CBC_BINARY_OPERATION (CBC_SUBTRACT, SUB)                                                                          \\\n  CBC_BINARY_OPERATION (CBC_MULTIPLY, MUL)                                                                          \\\n  CBC_BINARY_OPERATION (CBC_DIVIDE, DIV)                                                                            \\\n  CBC_BINARY_OPERATION (CBC_MODULO, MOD)                                                                            \\\n  CBC_BINARY_OPERATION (CBC_EXPONENTIATION, EXP)                                                                    \\\n                                                                                                                    \\\n  /* Unary lvalue opcodes. */                                                                                       \\\n  CBC_OPCODE (CBC_DELETE_PUSH_RESULT, CBC_NO_FLAG, -1, VM_OC_PROP_DELETE | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \\\n  CBC_OPCODE (CBC_DELETE_IDENT_PUSH_RESULT, CBC_HAS_LITERAL_ARG, 1, VM_OC_DELETE | VM_OC_PUT_STACK)                 \\\n  CBC_UNARY_LVALUE_OPERATION (CBC_PRE_INCR, PRE_INCR)                                                               \\\n  CBC_UNARY_LVALUE_OPERATION (CBC_PRE_DECR, PRE_DECR)                                                               \\\n  CBC_UNARY_LVALUE_OPERATION (CBC_POST_INCR, POST_INCR)                                                             \\\n  CBC_UNARY_LVALUE_OPERATION (CBC_POST_DECR, POST_DECR)                                                             \\\n                                                                                                                    \\\n  /* Call opcodes. */                                                                                               \\\n  CBC_OPCODE (CBC_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_CALL)                                                 \\\n  CBC_OPCODE (CBC_CALL_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_CALL | VM_OC_PUT_STACK)                    \\\n  CBC_OPCODE (CBC_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_CALL | VM_OC_PUT_BLOCK)                         \\\n  CBC_OPCODE (CBC_CALL_PROP, CBC_HAS_POP_STACK_BYTE_ARG, -3, VM_OC_CALL)                                            \\\n  CBC_OPCODE (CBC_CALL_PROP_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, -2, VM_OC_CALL | VM_OC_PUT_STACK)              \\\n  CBC_OPCODE (CBC_CALL_PROP_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -3, VM_OC_CALL | VM_OC_PUT_BLOCK)                    \\\n  CBC_OPCODE (CBC_CALL0, CBC_NO_FLAG, -1, VM_OC_CALL)                                                               \\\n  CBC_OPCODE (CBC_CALL0_PUSH_RESULT, CBC_NO_FLAG, 0, VM_OC_CALL | VM_OC_PUT_STACK)                                  \\\n  CBC_OPCODE (CBC_CALL0_BLOCK, CBC_NO_FLAG, -1, VM_OC_CALL | VM_OC_PUT_BLOCK)                                       \\\n  CBC_OPCODE (CBC_CALL0_PROP, CBC_NO_FLAG, -3, VM_OC_CALL)                                                          \\\n  CBC_OPCODE (CBC_CALL0_PROP_PUSH_RESULT, CBC_NO_FLAG, -2, VM_OC_CALL | VM_OC_PUT_STACK)                            \\\n  CBC_OPCODE (CBC_CALL0_PROP_BLOCK, CBC_NO_FLAG, -3, VM_OC_CALL | VM_OC_PUT_BLOCK)                                  \\\n  CBC_OPCODE (CBC_CALL1, CBC_NO_FLAG, -2, VM_OC_CALL)                                                               \\\n  CBC_OPCODE (CBC_CALL1_PUSH_RESULT, CBC_NO_FLAG, -1, VM_OC_CALL | VM_OC_PUT_STACK)                                 \\\n  CBC_OPCODE (CBC_CALL1_BLOCK, CBC_NO_FLAG, -2, VM_OC_CALL | VM_OC_PUT_BLOCK)                                       \\\n  CBC_OPCODE (CBC_CALL1_PROP, CBC_NO_FLAG, -4, VM_OC_CALL)                                                          \\\n  CBC_OPCODE (CBC_CALL1_PROP_PUSH_RESULT, CBC_NO_FLAG, -3, VM_OC_CALL | VM_OC_PUT_STACK)                            \\\n  CBC_OPCODE (CBC_CALL1_PROP_BLOCK, CBC_NO_FLAG, -4, VM_OC_CALL | VM_OC_PUT_BLOCK)                                  \\\n  CBC_OPCODE (CBC_CALL2, CBC_NO_FLAG, -3, VM_OC_CALL)                                                               \\\n  CBC_OPCODE (CBC_CALL2_PUSH_RESULT, CBC_NO_FLAG, -2, VM_OC_CALL | VM_OC_PUT_STACK)                                 \\\n  CBC_OPCODE (CBC_CALL2_BLOCK, CBC_NO_FLAG, -3, VM_OC_CALL | VM_OC_PUT_BLOCK)                                       \\\n  CBC_OPCODE (CBC_CALL2_PROP, CBC_NO_FLAG, -4, VM_OC_CALL)                                                          \\\n  CBC_OPCODE (CBC_CALL2_PROP_PUSH_RESULT, CBC_NO_FLAG, -3, VM_OC_CALL | VM_OC_PUT_STACK)                            \\\n  CBC_OPCODE (CBC_CALL2_PROP_BLOCK, CBC_NO_FLAG, -4, VM_OC_CALL | VM_OC_PUT_BLOCK)                                  \\\n                                                                                                                    \\\n  /* Binary assignment opcodes. */                                                                                  \\\n  CBC_OPCODE (CBC_ASSIGN, CBC_NO_FLAG, -3, VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE)                    \\\n  CBC_OPCODE (CBC_ASSIGN_PUSH_RESULT,                                                                               \\\n              CBC_NO_FLAG,                                                                                          \\\n              -2,                                                                                                   \\\n              VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK)                               \\\n  CBC_OPCODE (CBC_ASSIGN_BLOCK,                                                                                     \\\n              CBC_NO_FLAG,                                                                                          \\\n              -3,                                                                                                   \\\n              VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK)                               \\\n  CBC_OPCODE (CBC_ASSIGN_SET_IDENT, CBC_HAS_LITERAL_ARG, -1, VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT)      \\\n  CBC_OPCODE (CBC_ASSIGN_SET_IDENT_PUSH_RESULT,                                                                     \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              0,                                                                                                    \\\n              VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT | VM_OC_PUT_STACK)                                   \\\n  CBC_OPCODE (CBC_ASSIGN_SET_IDENT_BLOCK,                                                                           \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              -1,                                                                                                   \\\n              VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK)                                   \\\n  CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT,                                                                         \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                           \\\n              0,                                                                                                    \\\n              VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT)                                                   \\\n  CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT_PUSH_RESULT,                                                             \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                           \\\n              1,                                                                                                    \\\n              VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_STACK)                                 \\\n  CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT_BLOCK,                                                                   \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                           \\\n              0,                                                                                                    \\\n              VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK)                                 \\\n  CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL,                                                                              \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              -2,                                                                                                   \\\n              VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE)                                          \\\n  CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL_PUSH_RESULT,                                                                  \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              -1,                                                                                                   \\\n              VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK)                        \\\n  CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL_BLOCK,                                                                        \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              -2,                                                                                                   \\\n              VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK)                        \\\n  CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL,                                                                         \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              -1,                                                                                                   \\\n              VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE)                                     \\\n  CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL_PUSH_RESULT,                                                             \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              0,                                                                                                    \\\n              VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK)                   \\\n  CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL_BLOCK,                                                                   \\\n              CBC_HAS_LITERAL_ARG,                                                                                  \\\n              -1,                                                                                                   \\\n              VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK)                   \\\n  CBC_OPCODE (CBC_MOV_IDENT, CBC_HAS_LITERAL_ARG, -1, VM_OC_MOV_IDENT | VM_OC_GET_STACK | VM_OC_PUT_IDENT)          \\\n  CBC_OPCODE (CBC_ASSIGN_LET_CONST, CBC_HAS_LITERAL_ARG, -1, VM_OC_ASSIGN_LET_CONST | VM_OC_GET_STACK)              \\\n  CBC_OPCODE (CBC_ASSIGN_LET_CONST_LITERAL,                                                                         \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                           \\\n              0,                                                                                                    \\\n              VM_OC_ASSIGN_LET_CONST | VM_OC_GET_LITERAL)                                                           \\\n                                                                                                                    \\\n  /* Last opcode (not a real opcode). */                                                                            \\\n  CBC_OPCODE (CBC_END, CBC_NO_FLAG, 0, VM_OC_NONE)\n\n/* All EXT branches are statement block end\n * marks, so they are always forward branches. */\n\n#define CBC_EXT_OPCODE_LIST                                                                                            \\\n  /* Branch opcodes first. Some other opcodes are mixed. */                                                            \\\n  CBC_OPCODE (CBC_EXT_NOP, CBC_NO_FLAG, 0, VM_OC_NONE)                                                                 \\\n  CBC_FORWARD_BRANCH (CBC_EXT_WITH_CREATE_CONTEXT, -1 + PARSER_WITH_CONTEXT_STACK_ALLOCATION, VM_OC_WITH)              \\\n  CBC_OPCODE (CBC_EXT_FOR_IN_GET_NEXT, CBC_NO_FLAG, 1, VM_OC_FOR_IN_GET_NEXT | VM_OC_PUT_STACK)                        \\\n  CBC_FORWARD_BRANCH (CBC_EXT_FOR_IN_INIT, -1 + PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION, VM_OC_FOR_IN_INIT)             \\\n  CBC_OPCODE (CBC_EXT_SET_GETTER,                                                                                      \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              0,                                                                                                       \\\n              VM_OC_SET_GETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL)                                    \\\n  CBC_BACKWARD_BRANCH (CBC_EXT_BRANCH_IF_FOR_IN_HAS_NEXT, 0, VM_OC_FOR_IN_HAS_NEXT)                                    \\\n  CBC_OPCODE (CBC_EXT_FOR_OF_GET_NEXT, CBC_NO_FLAG, 1, VM_OC_FOR_OF_GET_NEXT | VM_OC_PUT_STACK)                        \\\n  CBC_FORWARD_BRANCH (CBC_EXT_FOR_OF_INIT, -1 + PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION, VM_OC_FOR_OF_INIT)             \\\n  CBC_OPCODE (CBC_EXT_PUSH_NAMED_FUNC_EXPRESSION,                                                                      \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              1,                                                                                                       \\\n              VM_OC_PUSH_NAMED_FUNC_EXPR | VM_OC_GET_LITERAL_LITERAL)                                                  \\\n  CBC_BACKWARD_BRANCH (CBC_EXT_BRANCH_IF_FOR_OF_HAS_NEXT, 0, VM_OC_FOR_OF_HAS_NEXT)                                    \\\n  CBC_OPCODE (CBC_EXT_CLONE_CONTEXT, CBC_NO_FLAG, 0, VM_OC_CLONE_CONTEXT)                                              \\\n  CBC_FORWARD_BRANCH (CBC_EXT_FOR_AWAIT_OF_INIT,                                                                       \\\n                      -1 + PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION,                                               \\\n                      VM_OC_FOR_AWAIT_OF_INIT)                                                                         \\\n  CBC_OPCODE (CBC_EXT_CLONE_FULL_CONTEXT, CBC_NO_FLAG, 0, VM_OC_CLONE_CONTEXT)                                         \\\n  CBC_BACKWARD_BRANCH (CBC_EXT_BRANCH_IF_FOR_AWAIT_OF_HAS_NEXT, 0, VM_OC_FOR_AWAIT_OF_HAS_NEXT)                        \\\n  CBC_OPCODE (CBC_EXT_SET_SETTER,                                                                                      \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              0,                                                                                                       \\\n              VM_OC_SET_SETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL)                                    \\\n  CBC_FORWARD_BRANCH (CBC_EXT_TRY_CREATE_CONTEXT, PARSER_TRY_CONTEXT_STACK_ALLOCATION, VM_OC_TRY)                      \\\n  CBC_OPCODE (CBC_EXT_TRY_CREATE_ENV, CBC_NO_FLAG, 0, VM_OC_BLOCK_CREATE_CONTEXT)                                      \\\n  CBC_FORWARD_BRANCH (CBC_EXT_CATCH, 1, VM_OC_CATCH)                                                                   \\\n  CBC_OPCODE (CBC_EXT_RESOLVE_BASE, CBC_NO_FLAG, 0, VM_OC_RESOLVE_BASE_FOR_CALL)                                       \\\n  CBC_FORWARD_BRANCH (CBC_EXT_FINALLY, PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION, VM_OC_FINALLY)                   \\\n  CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_PROP, CBC_NO_FLAG, 0, VM_OC_INITIALIZER_PUSH_PROP)                              \\\n  CBC_FORWARD_BRANCH (CBC_EXT_DEFAULT_INITIALIZER, -1, VM_OC_DEFAULT_INITIALIZER)                                      \\\n  CBC_OPCODE (CBC_EXT_ERROR, CBC_NO_FLAG, 0, VM_OC_ERROR)                                                              \\\n  CBC_FORWARD_BRANCH (CBC_EXT_BRANCH_IF_NULLISH, -1, VM_OC_BRANCH_IF_NULLISH)                                          \\\n  CBC_OPCODE (CBC_EXT_POP_REFERENCE, CBC_NO_FLAG, -2, VM_OC_POP_REFERENCE)                                             \\\n  CBC_FORWARD_BRANCH (CBC_EXT_BRANCH_OPTIONAL_CHAIN, 0, VM_OC_BRANCH_OPTIONAL_CHAIN)                                   \\\n  /* Basic opcodes. */                                                                                                 \\\n  CBC_OPCODE (CBC_EXT_CREATE_ARGUMENTS, CBC_HAS_LITERAL_ARG, 0, VM_OC_CREATE_ARGUMENTS)                                \\\n  CBC_OPCODE (CBC_EXT_CREATE_VAR_EVAL, CBC_HAS_LITERAL_ARG, 0, VM_OC_EXT_VAR_EVAL)                                     \\\n  CBC_OPCODE (CBC_EXT_CREATE_VAR_FUNC_EVAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, VM_OC_EXT_VAR_EVAL)         \\\n  CBC_OPCODE (CBC_EXT_COPY_FROM_ARG, CBC_HAS_LITERAL_ARG, 0, VM_OC_COPY_FROM_ARG)                                      \\\n  CBC_OPCODE (CBC_EXT_PUSH_REST_OBJECT, CBC_NO_FLAG, 1, VM_OC_PUSH_REST_OBJECT)                                        \\\n  CBC_OPCODE (CBC_EXT_MODULE_IMPORT, CBC_NO_FLAG, 0, VM_OC_MODULE_IMPORT)                                              \\\n  CBC_OPCODE (CBC_EXT_MODULE_IMPORT_META, CBC_NO_FLAG, 1, VM_OC_MODULE_IMPORT_META)                                    \\\n  CBC_OPCODE (CBC_EXT_STRING_CONCAT, CBC_NO_FLAG, -1, VM_OC_STRING_CONCAT | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK)   \\\n  CBC_OPCODE (CBC_EXT_STRING_CONCAT_RIGHT_LITERAL,                                                                     \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              0,                                                                                                       \\\n              VM_OC_STRING_CONCAT | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK)                                         \\\n  CBC_OPCODE (CBC_EXT_STRING_CONCAT_TWO_LITERALS,                                                                      \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              1,                                                                                                       \\\n              VM_OC_STRING_CONCAT | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK)                                       \\\n  CBC_OPCODE (CBC_EXT_GET_TAGGED_TEMPLATE_LITERAL, CBC_HAS_BYTE_ARG, 1, VM_OC_GET_TEMPLATE_OBJECT | VM_OC_PUT_STACK)   \\\n  CBC_OPCODE (CBC_EXT_THROW_REFERENCE_ERROR, CBC_NO_FLAG, 1, VM_OC_THROW_REFERENCE_ERROR)                              \\\n  CBC_OPCODE (CBC_EXT_THROW_ASSIGN_CONST_ERROR, CBC_NO_FLAG, 0, VM_OC_THROW_CONST_ERROR)                               \\\n  CBC_OPCODE (CBC_EXT_REQUIRE_OBJECT_COERCIBLE, CBC_NO_FLAG, 0, VM_OC_REQUIRE_OBJECT_COERCIBLE)                        \\\n  CBC_OPCODE (CBC_EXT_COPY_DATA_PROPERTIES, CBC_NO_FLAG, -1, VM_OC_COPY_DATA_PROPERTIES)                               \\\n  CBC_OPCODE (CBC_EXT_SET_FUNCTION_NAME, CBC_HAS_LITERAL_ARG, 0, VM_OC_SET_FUNCTION_NAME | VM_OC_GET_LITERAL)          \\\n  CBC_OPCODE (CBC_EXT_SET_CLASS_NAME, CBC_HAS_LITERAL_ARG, 0, VM_OC_SET_FUNCTION_NAME)                                 \\\n  CBC_OPCODE (CBC_EXT_SET_COMPUTED_FUNCTION_NAME, CBC_NO_FLAG, 0, VM_OC_SET_FUNCTION_NAME)                             \\\n  CBC_OPCODE (CBC_EXT_SET_COMPUTED_GETTER_NAME, CBC_NO_FLAG, 0, VM_OC_SET_FUNCTION_NAME)                               \\\n  CBC_OPCODE (CBC_EXT_SET_COMPUTED_SETTER_NAME, CBC_NO_FLAG, 0, VM_OC_SET_FUNCTION_NAME)                               \\\n                                                                                                                       \\\n  /* Computed / class property related opcodes. */                                                                     \\\n  CBC_OPCODE (CBC_EXT_SET_COMPUTED_PROPERTY,                                                                           \\\n              CBC_NO_FLAG,                                                                                             \\\n              -2,                                                                                                      \\\n              VM_OC_SET_COMPUTED_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_STACK)                             \\\n  CBC_OPCODE (CBC_EXT_SET_COMPUTED_PROPERTY_LITERAL,                                                                   \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              -1,                                                                                                      \\\n              VM_OC_SET_COMPUTED_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_LITERAL)                           \\\n  CBC_OPCODE (CBC_EXT_SET_COMPUTED_GETTER,                                                                             \\\n              CBC_NO_FLAG,                                                                                             \\\n              -2,                                                                                                      \\\n              VM_OC_SET_GETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_STACK)                                        \\\n  CBC_OPCODE (CBC_EXT_SET_COMPUTED_SETTER,                                                                             \\\n              CBC_NO_FLAG,                                                                                             \\\n              -2,                                                                                                      \\\n              VM_OC_SET_SETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_STACK)                                        \\\n  CBC_OPCODE (CBC_EXT_SET_STATIC_PROPERTY, CBC_HAS_LITERAL_ARG, -1, VM_OC_SET_PROPERTY | VM_OC_GET_STACK_LITERAL)      \\\n  CBC_OPCODE (CBC_EXT_SET_STATIC_PROPERTY_LITERAL,                                                                     \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              0,                                                                                                       \\\n              VM_OC_SET_PROPERTY | VM_OC_GET_LITERAL_LITERAL)                                                          \\\n  CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_PROPERTY,                                                                    \\\n              CBC_NO_FLAG,                                                                                             \\\n              -2,                                                                                                      \\\n              VM_OC_SET_COMPUTED_PROPERTY | VM_OC_GET_STACK_STACK)                                                     \\\n  CBC_OPCODE (CBC_EXT_SET_STATIC_GETTER,                                                                               \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              0,                                                                                                       \\\n              VM_OC_SET_GETTER | VM_OC_GET_LITERAL_LITERAL)                                                            \\\n  CBC_OPCODE (CBC_EXT_SET_STATIC_SETTER,                                                                               \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              0,                                                                                                       \\\n              VM_OC_SET_SETTER | VM_OC_GET_LITERAL_LITERAL)                                                            \\\n  CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_GETTER, CBC_NO_FLAG, -2, VM_OC_SET_GETTER | VM_OC_GET_STACK_STACK)           \\\n  CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_SETTER, CBC_NO_FLAG, -2, VM_OC_SET_SETTER | VM_OC_GET_STACK_STACK)           \\\n  CBC_OPCODE (CBC_EXT_SET__PROTO__, CBC_NO_FLAG, -1, VM_OC_SET__PROTO__ | VM_OC_GET_STACK)                             \\\n  CBC_OPCODE (CBC_EXT_PUSH_STATIC_FIELD_FUNC,                                                                          \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              1,                                                                                                       \\\n              VM_OC_PUSH_STATIC_FIELD_FUNC | VM_OC_GET_LITERAL)                                                        \\\n  CBC_OPCODE (CBC_EXT_PUSH_STATIC_COMPUTED_FIELD_FUNC,                                                                 \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              0,                                                                                                       \\\n              VM_OC_PUSH_STATIC_FIELD_FUNC | VM_OC_GET_LITERAL)                                                        \\\n  CBC_OPCODE (CBC_EXT_ADD_COMPUTED_FIELD, CBC_NO_FLAG, -1, VM_OC_ADD_COMPUTED_FIELD | VM_OC_GET_STACK)                 \\\n  CBC_OPCODE (CBC_EXT_ADD_STATIC_COMPUTED_FIELD, CBC_NO_FLAG, -1, VM_OC_ADD_COMPUTED_FIELD | VM_OC_GET_STACK)          \\\n  CBC_OPCODE (CBC_EXT_CLASS_CALL_STATIC_BLOCK,                                                                         \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              0,                                                                                                       \\\n              VM_OC_CLASS_CALL_STATIC_BLOCK | VM_OC_GET_LITERAL)                                                       \\\n  /* Class private property related opcodes */                                                                         \\\n  CBC_OPCODE (CBC_EXT_PUSH_PRIVATE_PROP_LITERAL_REFERENCE,                                                             \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              2,                                                                                                       \\\n              VM_OC_PRIVATE_PROP_REFERENCE | VM_OC_GET_LITERAL | VM_OC_PUT_STACK)                                      \\\n  CBC_OPCODE (CBC_EXT_PUSH_PRIVATE_PROP_LITERAL,                                                                       \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              0,                                                                                                       \\\n              VM_OC_PRIVATE_PROP_GET | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK)                                      \\\n  CBC_OPCODE (CBC_EXT_PUSH_PRIVATE_PROP_LITERAL_IN,                                                                    \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              0,                                                                                                       \\\n              VM_OC_PRIVATE_IN | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK)                                            \\\n  CBC_OPCODE (CBC_EXT_PRIVATE_FIELD_ADD, CBC_HAS_LITERAL_ARG, -1, VM_OC_PRIVATE_FIELD_ADD | VM_OC_GET_STACK_LITERAL)   \\\n  /* These 8 opcodes must be in this order  */                                                                         \\\n  CBC_OPCODE (CBC_EXT_COLLECT_PRIVATE_FIELD,                                                                           \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              0,                                                                                                       \\\n              VM_OC_COLLECT_PRIVATE_PROPERTY | VM_OC_GET_LITERAL)                                                      \\\n  CBC_OPCODE (CBC_EXT_COLLECT_PRIVATE_METHOD,                                                                          \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              0,                                                                                                       \\\n              VM_OC_COLLECT_PRIVATE_PROPERTY | VM_OC_GET_LITERAL_LITERAL)                                              \\\n  CBC_OPCODE (CBC_EXT_COLLECT_PRIVATE_GETTER,                                                                          \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              0,                                                                                                       \\\n              VM_OC_COLLECT_PRIVATE_PROPERTY | VM_OC_GET_LITERAL_LITERAL)                                              \\\n  CBC_OPCODE (CBC_EXT_COLLECT_PRIVATE_SETTER,                                                                          \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              0,                                                                                                       \\\n              VM_OC_COLLECT_PRIVATE_PROPERTY | VM_OC_GET_LITERAL_LITERAL)                                              \\\n  CBC_OPCODE (CBC_EXT_COLLECT_PRIVATE_STATIC_FIELD,                                                                    \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              0,                                                                                                       \\\n              VM_OC_COLLECT_PRIVATE_PROPERTY | VM_OC_GET_LITERAL)                                                      \\\n  CBC_OPCODE (CBC_EXT_COLLECT_PRIVATE_STATIC_METHOD,                                                                   \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              0,                                                                                                       \\\n              VM_OC_COLLECT_PRIVATE_PROPERTY | VM_OC_GET_LITERAL_LITERAL)                                              \\\n  CBC_OPCODE (CBC_EXT_COLLECT_PRIVATE_STATIC_GETTER,                                                                   \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              0,                                                                                                       \\\n              VM_OC_COLLECT_PRIVATE_PROPERTY | VM_OC_GET_LITERAL_LITERAL)                                              \\\n  CBC_OPCODE (CBC_EXT_COLLECT_PRIVATE_STATIC_SETTER,                                                                   \\\n              CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2,                                                              \\\n              0,                                                                                                       \\\n              VM_OC_COLLECT_PRIVATE_PROPERTY | VM_OC_GET_LITERAL_LITERAL)                                              \\\n  /* Class related opcodes. */                                                                                         \\\n  CBC_OPCODE (CBC_EXT_PUSH_NAMED_CLASS_ENV, CBC_HAS_LITERAL_ARG, 1, VM_OC_PUSH_CLASS_ENVIRONMENT)                      \\\n  CBC_OPCODE (CBC_EXT_DEFINE_FIELD, CBC_HAS_LITERAL_ARG, -1, VM_OC_DEFINE_FIELD | VM_OC_GET_STACK_LITERAL)             \\\n  CBC_OPCODE (CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR, CBC_NO_FLAG, 1, VM_OC_PUSH_IMPLICIT_CTOR | VM_OC_PUT_STACK)           \\\n  CBC_OPCODE (CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR_HERITAGE, CBC_NO_FLAG, 1, VM_OC_PUSH_IMPLICIT_CTOR | VM_OC_PUT_STACK)  \\\n  CBC_OPCODE (CBC_EXT_INIT_CLASS, CBC_NO_FLAG, 0, VM_OC_INIT_CLASS | VM_OC_PUT_STACK)                                  \\\n  CBC_OPCODE (CBC_EXT_FINALIZE_NAMED_CLASS, CBC_HAS_LITERAL_ARG, -2, VM_OC_FINALIZE_CLASS)                             \\\n  CBC_OPCODE (CBC_EXT_FINALIZE_ANONYMOUS_CLASS, CBC_NO_FLAG, -2, VM_OC_FINALIZE_CLASS)                                 \\\n  CBC_OPCODE (CBC_EXT_SET_FIELD_INIT, CBC_HAS_LITERAL_ARG, 0, VM_OC_SET_FIELD_INIT | VM_OC_GET_LITERAL)                \\\n  CBC_OPCODE (CBC_EXT_RUN_FIELD_INIT, CBC_NO_FLAG, 0, VM_OC_RUN_FIELD_INIT)                                            \\\n  CBC_OPCODE (CBC_EXT_RUN_STATIC_FIELD_INIT, CBC_NO_FLAG, -1, VM_OC_RUN_STATIC_FIELD_INIT)                             \\\n  CBC_OPCODE (CBC_EXT_SET_NEXT_COMPUTED_FIELD_ANONYMOUS_FUNC,                                                          \\\n              CBC_NO_FLAG,                                                                                             \\\n              -1,                                                                                                      \\\n              VM_OC_SET_NEXT_COMPUTED_FIELD | VM_OC_PUT_REFERENCE)                                                     \\\n  CBC_OPCODE (CBC_EXT_SET_NEXT_COMPUTED_FIELD, CBC_NO_FLAG, -1, VM_OC_SET_NEXT_COMPUTED_FIELD | VM_OC_PUT_REFERENCE)   \\\n  CBC_OPCODE (CBC_EXT_PUSH_SUPER, CBC_NO_FLAG, 1, VM_OC_NONE)                                                          \\\n  CBC_OPCODE (CBC_EXT_PUSH_SUPER_CONSTRUCTOR, CBC_NO_FLAG, 1, VM_OC_PUSH_SUPER_CONSTRUCTOR)                            \\\n  CBC_OPCODE (CBC_EXT_PUSH_SUPER_PROP, CBC_NO_FLAG, 0, VM_OC_SUPER_REFERENCE | VM_OC_GET_STACK)                        \\\n  CBC_OPCODE (CBC_EXT_SUPER_PROP_REFERENCE, CBC_NO_FLAG, 2, VM_OC_SUPER_REFERENCE | VM_OC_GET_STACK)                   \\\n  CBC_OPCODE (CBC_EXT_PUSH_SUPER_PROP_LITERAL, CBC_HAS_LITERAL_ARG, 1, VM_OC_SUPER_REFERENCE | VM_OC_GET_LITERAL)      \\\n  CBC_OPCODE (CBC_EXT_SUPER_PROP_LITERAL_REFERENCE, CBC_HAS_LITERAL_ARG, 3, VM_OC_SUPER_REFERENCE | VM_OC_GET_LITERAL) \\\n  CBC_OPCODE (CBC_EXT_SUPER_PROP_ASSIGNMENT_REFERENCE, CBC_NO_FLAG, 1, VM_OC_SUPER_REFERENCE | VM_OC_GET_STACK)        \\\n  CBC_OPCODE (CBC_EXT_SUPER_PROP_LITERAL_ASSIGNMENT_REFERENCE,                                                         \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              2,                                                                                                       \\\n              VM_OC_SUPER_REFERENCE | VM_OC_GET_LITERAL)                                                               \\\n  CBC_OPCODE (CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT, CBC_NO_FLAG, 0, VM_OC_SET_HOME_OBJECT)                           \\\n  CBC_OPCODE (CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT_COMPUTED, CBC_NO_FLAG, 0, VM_OC_SET_HOME_OBJECT)                  \\\n  CBC_OPCODE (CBC_EXT_PUSH_OBJECT_SUPER_ENVIRONMENT, CBC_NO_FLAG, 1, VM_OC_OBJECT_LITERAL_HOME_ENV)                    \\\n  CBC_OPCODE (CBC_EXT_POP_OBJECT_SUPER_ENVIRONMENT, CBC_NO_FLAG, -1, VM_OC_OBJECT_LITERAL_HOME_ENV)                    \\\n  CBC_OPCODE (CBC_EXT_RESOLVE_LEXICAL_THIS, CBC_NO_FLAG, 1, VM_OC_RESOLVE_LEXICAL_THIS | VM_OC_PUT_STACK)              \\\n  CBC_OPCODE (CBC_EXT_LOCAL_EVAL, CBC_HAS_BYTE_ARG, 0, VM_OC_LOCAL_EVAL)                                               \\\n  CBC_OPCODE (CBC_EXT_ASSIGN_SUPER, CBC_NO_FLAG, -3, VM_OC_ASSIGN_SUPER)                                               \\\n  CBC_OPCODE (CBC_EXT_ASSIGN_SUPER_PUSH_RESULT, CBC_NO_FLAG, -2, VM_OC_ASSIGN_SUPER | VM_OC_PUT_STACK)                 \\\n  CBC_OPCODE (CBC_EXT_ASSIGN_SUPER_BLOCK, CBC_NO_FLAG, -3, VM_OC_ASSIGN_SUPER | VM_OC_PUT_BLOCK)                       \\\n  CBC_OPCODE (CBC_EXT_ASSIGN_PRIVATE, CBC_NO_FLAG, -3, VM_OC_ASSIGN_PRIVATE)                                           \\\n  CBC_OPCODE (CBC_EXT_ASSIGN_PRIVATE_PUSH_RESULT, CBC_NO_FLAG, -2, VM_OC_ASSIGN_PRIVATE | VM_OC_PUT_STACK)             \\\n  CBC_OPCODE (CBC_EXT_ASSIGN_PRIVATE_BLOCK, CBC_NO_FLAG, -3, VM_OC_ASSIGN_PRIVATE | VM_OC_PUT_BLOCK)                   \\\n  CBC_OPCODE (CBC_EXT_SUPER_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SUPER_CALL)                                    \\\n  CBC_OPCODE (CBC_EXT_SUPER_CALL_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_SUPER_CALL | VM_OC_PUT_STACK)       \\\n  CBC_OPCODE (CBC_EXT_SUPER_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SUPER_CALL | VM_OC_PUT_BLOCK)            \\\n  CBC_OPCODE (CBC_EXT_SPREAD_SUPER_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SUPER_CALL)                             \\\n  CBC_OPCODE (CBC_EXT_SPREAD_SUPER_CALL_PUSH_RESULT,                                                                   \\\n              CBC_HAS_POP_STACK_BYTE_ARG,                                                                              \\\n              0,                                                                                                       \\\n              VM_OC_SUPER_CALL | VM_OC_PUT_STACK)                                                                      \\\n  CBC_OPCODE (CBC_EXT_SPREAD_SUPER_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SUPER_CALL | VM_OC_PUT_BLOCK)     \\\n                                                                                                                       \\\n  /* Spread / rest operation related opcodes. */                                                                       \\\n  CBC_OPCODE (CBC_EXT_SPREAD_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SPREAD_ARGUMENTS)                             \\\n  CBC_OPCODE (CBC_EXT_SPREAD_CALL_PUSH_RESULT,                                                                         \\\n              CBC_HAS_POP_STACK_BYTE_ARG,                                                                              \\\n              0,                                                                                                       \\\n              VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_STACK)                                                                \\\n  CBC_OPCODE (CBC_EXT_SPREAD_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_BLOCK)     \\\n  CBC_OPCODE (CBC_EXT_SPREAD_CALL_PROP, CBC_HAS_POP_STACK_BYTE_ARG, -3, VM_OC_SPREAD_ARGUMENTS)                        \\\n  CBC_OPCODE (CBC_EXT_SPREAD_CALL_PROP_PUSH_RESULT,                                                                    \\\n              CBC_HAS_POP_STACK_BYTE_ARG,                                                                              \\\n              -2,                                                                                                      \\\n              VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_STACK)                                                                \\\n  CBC_OPCODE (CBC_EXT_SPREAD_CALL_PROP_BLOCK,                                                                          \\\n              CBC_HAS_POP_STACK_BYTE_ARG,                                                                              \\\n              -3,                                                                                                      \\\n              VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_BLOCK)                                                                \\\n  CBC_OPCODE (CBC_EXT_PUSH_SPREAD_ELEMENT, CBC_NO_FLAG, 1, VM_OC_PUSH_SPREAD_ELEMENT)                                  \\\n  CBC_OPCODE (CBC_EXT_SPREAD_ARRAY_APPEND, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_APPEND_ARRAY)                          \\\n  CBC_OPCODE (CBC_EXT_REST_INITIALIZER, CBC_NO_FLAG, 1, VM_OC_REST_INITIALIZER)                                        \\\n  CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_PROP_LITERAL,                                                                   \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              1,                                                                                                       \\\n              VM_OC_INITIALIZER_PUSH_PROP | VM_OC_GET_LITERAL)                                                         \\\n  CBC_OPCODE (CBC_EXT_SPREAD_NEW, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_STACK)             \\\n                                                                                                                       \\\n  /* Iterator related opcodes. */                                                                                      \\\n  CBC_OPCODE (CBC_EXT_ITERATOR_CONTEXT_CREATE,                                                                         \\\n              CBC_NO_FLAG,                                                                                             \\\n              PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION,                                                                \\\n              VM_OC_ITERATOR_CONTEXT_CREATE)                                                                           \\\n  CBC_OPCODE (CBC_EXT_ITERATOR_CONTEXT_END,                                                                            \\\n              CBC_NO_FLAG,                                                                                             \\\n              -PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION,                                                               \\\n              VM_OC_ITERATOR_CONTEXT_END)                                                                              \\\n  CBC_OPCODE (CBC_EXT_ITERATOR_STEP, CBC_NO_FLAG, 1, VM_OC_ITERATOR_STEP)                                              \\\n                                                                                                                       \\\n  /* Object initializer related opcodes. */                                                                            \\\n  CBC_OPCODE (CBC_EXT_OBJ_INIT_CONTEXT_CREATE,                                                                         \\\n              CBC_NO_FLAG,                                                                                             \\\n              PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION,                                                                \\\n              VM_OC_OBJ_INIT_CONTEXT_CREATE)                                                                           \\\n  CBC_OPCODE (CBC_EXT_OBJ_INIT_REST_CONTEXT_CREATE,                                                                    \\\n              CBC_NO_FLAG,                                                                                             \\\n              PARSER_OBJ_INIT_REST_CONTEXT_STACK_ALLOCATION,                                                           \\\n              VM_OC_OBJ_INIT_CONTEXT_CREATE)                                                                           \\\n  CBC_OPCODE (CBC_EXT_OBJ_INIT_PUSH_REST, CBC_NO_FLAG, 1, VM_OC_OBJ_INIT_PUSH_REST)                                    \\\n  CBC_OPCODE (CBC_EXT_OBJ_INIT_CONTEXT_END,                                                                            \\\n              CBC_NO_FLAG,                                                                                             \\\n              -PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION,                                                               \\\n              VM_OC_OBJ_INIT_CONTEXT_END)                                                                              \\\n  CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_NAME, CBC_NO_FLAG, 0, VM_OC_INITIALIZER_PUSH_NAME | VM_OC_GET_STACK)            \\\n  CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_NAME_LITERAL,                                                                   \\\n              CBC_HAS_LITERAL_ARG,                                                                                     \\\n              1,                                                                                                       \\\n              VM_OC_INITIALIZER_PUSH_NAME | VM_OC_GET_LITERAL)                                                         \\\n                                                                                                                       \\\n  /* Executable object related opcodes. */                                                                             \\\n  CBC_OPCODE (CBC_EXT_CREATE_GENERATOR, CBC_NO_FLAG, 1, VM_OC_CREATE_GENERATOR)                                        \\\n  CBC_OPCODE (CBC_EXT_YIELD, CBC_NO_FLAG, 0, VM_OC_YIELD)                                                              \\\n  CBC_OPCODE (CBC_EXT_YIELD_ITERATOR, CBC_NO_FLAG, 0, VM_OC_YIELD)                                                     \\\n  CBC_OPCODE (CBC_EXT_ASYNC_YIELD, CBC_NO_FLAG, 0, VM_OC_ASYNC_YIELD)                                                  \\\n  CBC_OPCODE (CBC_EXT_ASYNC_YIELD_ITERATOR, CBC_NO_FLAG, 0, VM_OC_ASYNC_YIELD_ITERATOR)                                \\\n  CBC_OPCODE (CBC_EXT_AWAIT, CBC_NO_FLAG, 0, VM_OC_AWAIT)                                                              \\\n  CBC_OPCODE (CBC_EXT_GENERATOR_AWAIT, CBC_NO_FLAG, 0, VM_OC_GENERATOR_AWAIT)                                          \\\n  CBC_OPCODE (CBC_EXT_ASYNC_EXIT, CBC_NO_FLAG, 0, VM_OC_ASYNC_EXIT)                                                    \\\n  CBC_OPCODE (CBC_EXT_RETURN, CBC_NO_FLAG, -1, VM_OC_EXT_RETURN | VM_OC_GET_STACK)                                     \\\n  CBC_OPCODE (CBC_EXT_RETURN_UNDEFINED, CBC_NO_FLAG, 0, VM_OC_EXT_RETURN)                                              \\\n  CBC_OPCODE (CBC_EXT_PUSH_NEW_TARGET, CBC_NO_FLAG, 1, VM_OC_PUSH_NEW_TARGET | VM_OC_PUT_STACK)                        \\\n                                                                                                                       \\\n  /* Last opcode (not a real opcode). */                                                                               \\\n  CBC_OPCODE (CBC_EXT_END, CBC_NO_FLAG, 0, VM_OC_NONE)\n\n#define CBC_MAXIMUM_BYTE_VALUE  255\n#define CBC_MAXIMUM_SMALL_VALUE 510\n#define CBC_MAXIMUM_FULL_VALUE  32767\n\n#define CBC_PUSH_NUMBER_BYTE_RANGE_END 256\n\n#define CBC_HIGHEST_BIT_MASK     0x80\n#define CBC_LOWER_SEVEN_BIT_MASK 0x7f\n\n/**\n * Literal encoding limit when full literal encoding mode is enabled\n */\n#define CBC_FULL_LITERAL_ENCODING_LIMIT 128\n\n/**\n * Literal encoding delta when full literal encoding mode is enabled\n */\n#define CBC_FULL_LITERAL_ENCODING_DELTA 0x8000\n\n/**\n * Literal encoding limit when full literal encoding mode is disabled\n */\n#define CBC_SMALL_LITERAL_ENCODING_LIMIT 255\n\n/**\n * Literal encoding delta when full literal encoding mode is disabled\n */\n#define CBC_SMALL_LITERAL_ENCODING_DELTA 0xfe01\n\n/**\n * Literal indicies belong to one of the following groups:\n *\n * 0 <= index < argument_end                    : arguments\n * argument_end <= index < register_end         : registers\n * register_end <= index < ident_end            : identifiers\n * ident_end <= index < const_literal_end       : constant literals\n * const_literal_end <= index < literal_end     : template literals\n */\n\n/**\n * Compiled byte code arguments.\n */\ntypedef struct\n{\n  ecma_compiled_code_t header; /**< compiled code header */\n  uint8_t stack_limit; /**< maximum number of values stored on the stack */\n  uint8_t argument_end; /**< number of arguments expected by the function */\n  ecma_value_t script_value; /**< script value */\n  uint8_t register_end; /**< end position of the register group */\n  uint8_t ident_end; /**< end position of the identifier group */\n  uint8_t const_literal_end; /**< end position of the const literal group */\n  uint8_t literal_end; /**< end position of the literal group */\n} cbc_uint8_arguments_t;\n\n/**\n * Compiled byte code arguments.\n */\ntypedef struct\n{\n  ecma_compiled_code_t header; /**< compiled code header */\n  uint16_t stack_limit; /**< maximum number of values stored on the stack */\n  ecma_value_t script_value; /**< script value */\n  uint16_t argument_end; /**< number of arguments expected by the function */\n  uint16_t register_end; /**< end position of the register group */\n  uint16_t ident_end; /**< end position of the identifier group */\n  uint16_t const_literal_end; /**< end position of the const literal group */\n  uint16_t literal_end; /**< end position of the literal group */\n  uint16_t padding; /**< an unused value */\n} cbc_uint16_arguments_t;\n\n/**\n * Compact byte code status flags.\n */\ntypedef enum\n{\n  CBC_CODE_FLAGS_FULL_LITERAL_ENCODING = (1u << 0), /**< full literal encoding mode is enabled */\n  CBC_CODE_FLAGS_UINT16_ARGUMENTS = (1u << 1), /**< compiled code data is cbc_uint16_arguments_t */\n  CBC_CODE_FLAGS_STRICT_MODE = (1u << 2), /**< strict mode is enabled */\n  CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED = (1u << 3), /**< mapped arguments object must be constructed */\n  CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED = (1u << 4), /**< no need to create a lexical environment */\n  CBC_CODE_FLAGS_HAS_EXTENDED_INFO = (1u << 5), /**< this function has extended info block */\n  CBC_CODE_FLAGS_HAS_TAGGED_LITERALS = (1u << 6), /**< this function has tagged template literal list */\n  CBC_CODE_FLAGS_HAS_LINE_INFO = (1u << 7), /**< this function has line info block */\n  CBC_CODE_FLAGS_STATIC_FUNCTION = (1u << 8), /**< this function is a static snapshot function */\n  CBC_CODE_FLAGS_DEBUGGER_IGNORE = (1u << 9), /**< this function should be ignored by debugger */\n  CBC_CODE_FLAGS_LEXICAL_BLOCK_NEEDED = (1u << 10), /**< compiled code needs a lexical block */\n\n  /* Bits from bit 12 is reserved for function types (see CBC_FUNCTION_TYPE_SHIFT).\n   * Note: the last bits are used for type flags because < and >= operators can be used to\n           check a range of types without decoding the actual type. */\n} cbc_code_flags_t;\n\n/**\n * Optional byte code fields. These fields are stored in a reversed\n * order from the end of the byte code data.\n *\n * Value fields:\n *   - when CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED is set:\n *     argument_end number of argument names encoded as strings\n *   - when function type is not CBC_FUNCTION_CONSTRUCTOR:\n *     function name encoded as string\n *   - when CBC_CODE_FLAGS_HAS_TAGGED_LITERALS is set:\n *     pointer to the tagged template collection encoded as value\n *\n * Byte fields when CBC_CODE_FLAGS_HAS_EXTENDED_INFO is set:\n *   - always available:\n *     a byte which contains a combination of CBC_EXTENDED_CODE_FLAGS bits\n *   - when CBC_EXTENDED_CODE_FLAGS_HAS_ARGUMENT_LENGTH is set:\n *     a vlq encoded default value for function length\n *   - when CBC_EXTENDED_CODE_FLAGS_HAS_SOURCE_CODE_RANGE is set:\n *     a pair of vlq encoded values, representing the start and size of the range\n */\n\n/**\n * Compact byte code function types.\n */\ntypedef enum\n{\n  /* The first type must be regular expression (see CBC_IS_FUNCTION) */\n  CBC_REGULAR_EXPRESSION, /**< regular expression literal */\n  CBC_FUNCTION_NORMAL, /**< function without special properties */\n  CBC_FUNCTION_CONSTRUCTOR, /**< constructor function */\n\n  /* The following functions cannot be constructed (see CBC_FUNCTION_IS_CONSTRUCTABLE) */\n  CBC_FUNCTION_SCRIPT, /**< script (global) function */\n  CBC_FUNCTION_GENERATOR, /**< generator function */\n  CBC_FUNCTION_ASYNC_GENERATOR, /**< async generator function */\n\n  /* The following functions has no prototype (see CBC_FUNCTION_HAS_PROTOTYPE) */\n  CBC_FUNCTION_ACCESSOR, /**< property accessor function */\n  CBC_FUNCTION_ASYNC, /**< async function */\n  CBC_FUNCTION_METHOD, /**< method */\n\n  /* The following functions are arrow function (see CBC_FUNCTION_IS_ARROW) */\n  CBC_FUNCTION_ARROW, /**< arrow function */\n  CBC_FUNCTION_ASYNC_ARROW, /**< arrow function */\n} cbc_code_function_types_t;\n\n/**\n * Shift for getting / setting the function type of a byte code.\n */\n#define CBC_FUNCTION_TYPE_SHIFT 12\n\n/**\n * Compute function type bits in code flags.\n */\n#define CBC_FUNCTION_TO_TYPE_BITS(name) ((name) << CBC_FUNCTION_TYPE_SHIFT)\n\n/**\n * Get function type from code flags.\n */\n#define CBC_FUNCTION_GET_TYPE(flags) ((uint16_t) ((flags) >> CBC_FUNCTION_TYPE_SHIFT))\n\n/**\n * Checks whether the byte code is a function or a regular expression.\n */\n#define CBC_IS_FUNCTION(flags) ((flags) >= (CBC_FUNCTION_NORMAL << CBC_FUNCTION_TYPE_SHIFT))\n\n/**\n * Checks whether the function can be constructed with new operator.\n */\n#define CBC_FUNCTION_IS_CONSTRUCTABLE(flags) ((flags) < (CBC_FUNCTION_GENERATOR << CBC_FUNCTION_TYPE_SHIFT))\n\n/**\n * Checks whether the function has prototype property.\n */\n#define CBC_FUNCTION_HAS_PROTOTYPE(flags) ((flags) < (CBC_FUNCTION_ACCESSOR << CBC_FUNCTION_TYPE_SHIFT))\n\n/**\n * Checks whether the function is an arrow function.\n */\n#define CBC_FUNCTION_IS_ARROW(flags) ((flags) >= (CBC_FUNCTION_ARROW << CBC_FUNCTION_TYPE_SHIFT))\n\n/**\n * Compact byte code extended status flags.\n */\ntypedef enum\n{\n  CBC_EXTENDED_CODE_FLAGS_HAS_ARGUMENT_LENGTH = (1u << 0), /**< has argument length */\n  CBC_EXTENDED_CODE_FLAGS_HAS_SOURCE_CODE_RANGE = (1u << 1), /**< has source code range (start, end) */\n  CBC_EXTENDED_CODE_FLAGS_SOURCE_CODE_IN_ARGUMENTS = (1u << 2), /**< source code range is inside\n                                                                 *   the function arguments */\n} cbc_extended_code_flags_t;\n\n/**\n * Shared script data.\n */\ntypedef enum\n{\n  CBC_SCRIPT_HAS_USER_VALUE = (1 << 0), /**< script has user value */\n  CBC_SCRIPT_USER_VALUE_IS_OBJECT = (1 << 1), /**< user value is object */\n  CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS = (1 << 2), /**< script is a function with arguments source code */\n  CBC_SCRIPT_HAS_IMPORT_META = (1 << 3), /**< script is a module with import.meta object */\n  CBC_SCRIPT_IS_EVAL_CODE = (1 << 4), /**< script is compiled by eval like (eval, new Function, etc.) expression */\n} cbc_script_type;\n\n/**\n * Value for increasing or decreasing the script reference counter.\n */\n#define CBC_SCRIPT_REF_ONE 0x20\n\n/**\n * Maximum value of script reference counter.\n */\n#define CBC_SCRIPT_REF_MAX (UINT32_MAX - CBC_SCRIPT_REF_ONE + 1)\n\n/**\n * Sets the type of a script using the user_value.\n */\n#define CBC_SCRIPT_SET_TYPE(script_p, user_value, ref_count)          \\\n  do                                                                  \\\n  {                                                                   \\\n    (script_p)->refs_and_type = (ref_count);                          \\\n    if ((user_value) != ECMA_VALUE_EMPTY)                             \\\n    {                                                                 \\\n      (script_p)->refs_and_type |= CBC_SCRIPT_HAS_USER_VALUE;         \\\n      if (ecma_is_value_object (user_value))                          \\\n      {                                                               \\\n        (script_p)->refs_and_type |= CBC_SCRIPT_USER_VALUE_IS_OBJECT; \\\n      }                                                               \\\n    }                                                                 \\\n  } while (false)\n\n/**\n * Shared script data.\n */\ntypedef struct\n{\n#if JERRY_BUILTIN_REALMS\n  ecma_object_t *realm_p; /**< realm object */\n#endif /* JERRY_BUILTIN_REALMS */\n  uint32_t refs_and_type; /**< reference counter and type of the function */\n#if JERRY_SOURCE_NAME\n  ecma_value_t source_name; /**< source name */\n#endif /* JERRY_SOURCE_NAME */\n#if JERRY_FUNCTION_TO_STRING\n  ecma_value_t source_code; /**< source code */\n#endif /* JERRY_FUNCTION_TO_STRING */\n} cbc_script_t;\n\n/**\n * Get the array of optional values assigned to a script.\n *\n * First value: user value\n * Second value: function arguments value\n */\n#define CBC_SCRIPT_GET_OPTIONAL_VALUES(script_p) ((ecma_value_t *) ((script_p) + 1))\n\n/**\n * Get user value.\n */\n#define CBC_SCRIPT_GET_USER_VALUE(script_p) (CBC_SCRIPT_GET_OPTIONAL_VALUES (script_p)[0])\n\n/**\n * Get function arguments.\n */\n#define CBC_SCRIPT_GET_FUNCTION_ARGUMENTS(script_p, type) \\\n  (CBC_SCRIPT_GET_OPTIONAL_VALUES (script_p)[((type) &CBC_SCRIPT_HAS_USER_VALUE) ? 1 : 0])\n\n/**\n * Get import.meta object.\n */\n#define CBC_SCRIPT_GET_IMPORT_META(script_p, type) \\\n  (CBC_SCRIPT_GET_OPTIONAL_VALUES (script_p)[((type) &CBC_SCRIPT_HAS_USER_VALUE) ? 1 : 0])\n\n#define CBC_OPCODE(arg1, arg2, arg3, arg4) arg1,\n\n/**\n * Opcode list.\n */\ntypedef enum\n{\n  CBC_OPCODE_LIST /**< list of opcodes */\n} cbc_opcode_t;\n\n/**\n * Extended opcode list.\n */\ntypedef enum\n{\n  CBC_EXT_OPCODE_LIST /**< list extended opcodes */\n} cbc_ext_opcode_t;\n\n#undef CBC_OPCODE\n\n/**\n * Opcode flags.\n */\nextern const uint8_t cbc_flags[];\nextern const uint8_t cbc_ext_flags[];\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n\n/**\n * Opcode names for debugging.\n */\nextern const char *const cbc_names[];\nextern const char *const cbc_ext_names[];\n\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* !BYTE_CODE_H */\n"
  },
  {
    "path": "jerry-core/parser/js/common.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"common.h\"\n\n#include \"ecma-big-uint.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-extended-info.h\"\n#include \"ecma-helpers.h\"\n\n#include \"js-parser-internal.h\"\n#include \"lit-char-helpers.h\"\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_utils Utility\n * @{\n */\n\n#if JERRY_PARSER\n\n/**\n * Free literal.\n */\nvoid\nutil_free_literal (lexer_literal_t *literal_p) /**< literal */\n{\n  if (literal_p->type == LEXER_IDENT_LITERAL || literal_p->type == LEXER_STRING_LITERAL)\n  {\n    if (!(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))\n    {\n      jmem_heap_free_block ((void *) literal_p->u.char_p, literal_p->prop.length);\n    }\n  }\n  else if ((literal_p->type == LEXER_FUNCTION_LITERAL) || (literal_p->type == LEXER_REGEXP_LITERAL))\n  {\n    ecma_bytecode_deref (literal_p->u.bytecode_p);\n  }\n} /* util_free_literal */\n\n#endif /* JERRY_PARSER */\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n\n/**\n * Debug utility to print a character sequence.\n */\nstatic void\nutil_print_chars (const uint8_t *char_p, /**< character pointer */\n                  size_t size) /**< size */\n{\n  while (size > 0)\n  {\n    JERRY_DEBUG_MSG (\"%c\", *char_p++);\n    size--;\n  }\n} /* util_print_chars */\n\n/**\n * Debug utility to print a number.\n */\nstatic void\nutil_print_number (ecma_number_t num_p) /**< number to print */\n{\n  lit_utf8_byte_t str_buf[ECMA_MAX_CHARS_IN_STRINGIFIED_NUMBER];\n  lit_utf8_size_t str_size = ecma_number_to_utf8_string (num_p, str_buf, sizeof (str_buf));\n  str_buf[str_size] = 0;\n  JERRY_DEBUG_MSG (\"%s\", str_buf);\n} /* util_print_number */\n\n#if JERRY_BUILTIN_BIGINT\n\n/**\n * Debug utility to print a bigint.\n */\nstatic void\nutil_print_bigint (ecma_value_t bigint) /**< bigint to print */\n{\n  if (bigint == ECMA_BIGINT_ZERO)\n  {\n    JERRY_DEBUG_MSG (\"0\");\n    return;\n  }\n\n  ecma_extended_primitive_t *bigint_p = ecma_get_extended_primitive_from_value (bigint);\n  uint32_t char_start_p, char_size_p;\n  lit_utf8_byte_t *string_buffer_p = ecma_big_uint_to_string (bigint_p, 10, &char_start_p, &char_size_p);\n\n  if (JERRY_UNLIKELY (string_buffer_p == NULL))\n  {\n    JERRY_DEBUG_MSG (\"<out-of-memory>\");\n    return;\n  }\n\n  JERRY_ASSERT (char_start_p > 0);\n\n  if (bigint_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)\n  {\n    string_buffer_p[--char_start_p] = LIT_CHAR_MINUS;\n  }\n\n  util_print_chars (string_buffer_p + char_start_p, char_size_p - char_start_p);\n  jmem_heap_free_block (string_buffer_p, char_size_p);\n} /* util_print_bigint */\n\n#endif /* JERRY_BUILTIN_BIGINT */\n\n/**\n * Print literal\n */\nvoid\nutil_print_literal (lexer_literal_t *literal_p) /**< literal */\n{\n  switch (literal_p->type)\n  {\n    case LEXER_IDENT_LITERAL:\n    {\n      JERRY_DEBUG_MSG (\"ident(\");\n      util_print_chars (literal_p->u.char_p, literal_p->prop.length);\n      break;\n    }\n    case LEXER_FUNCTION_LITERAL:\n    {\n      JERRY_DEBUG_MSG (\"function\");\n      return;\n    }\n    case LEXER_STRING_LITERAL:\n    {\n      JERRY_DEBUG_MSG (\"string(\");\n      util_print_chars (literal_p->u.char_p, literal_p->prop.length);\n      break;\n    }\n    case LEXER_NUMBER_LITERAL:\n    {\n#if JERRY_BUILTIN_BIGINT\n      if (ecma_is_value_bigint (literal_p->u.value))\n      {\n        JERRY_DEBUG_MSG (\"bigint(\");\n        util_print_bigint (literal_p->u.value);\n        break;\n      }\n#endif /* JERRY_BUILTIN_BIGINT */\n      JERRY_DEBUG_MSG (\"number(\");\n      util_print_number (ecma_get_number_from_value (literal_p->u.value));\n      break;\n    }\n    case LEXER_REGEXP_LITERAL:\n    {\n      JERRY_DEBUG_MSG (\"regexp\");\n      return;\n    }\n    default:\n    {\n      JERRY_DEBUG_MSG (\"unknown\");\n      return;\n    }\n  }\n\n  JERRY_DEBUG_MSG (\")\");\n} /* util_print_literal */\n\n/**\n * Print literal.\n */\nstatic void\nutil_print_literal_value (ecma_compiled_code_t *compiled_code_p, /**< compiled code */\n                          uint16_t literal_index) /**< literal index */\n{\n  uint16_t argument_end;\n  uint16_t register_end;\n  uint16_t ident_end;\n  uint16_t const_literal_end;\n  ecma_value_t *literal_start_p;\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) compiled_code_p;\n    argument_end = args_p->argument_end;\n    register_end = args_p->register_end;\n    ident_end = args_p->ident_end;\n    const_literal_end = args_p->const_literal_end;\n    literal_start_p = (ecma_value_t *) (args_p + 1);\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) compiled_code_p;\n    argument_end = args_p->argument_end;\n    register_end = args_p->register_end;\n    ident_end = args_p->ident_end;\n    const_literal_end = args_p->const_literal_end;\n    literal_start_p = (ecma_value_t *) (args_p + 1);\n  }\n\n  if (literal_index < argument_end)\n  {\n    JERRY_DEBUG_MSG (\" arg:%d\", literal_index);\n    return;\n  }\n\n  if (literal_index < register_end)\n  {\n    JERRY_DEBUG_MSG (\" reg:%d\", literal_index);\n    return;\n  }\n\n  if (literal_index >= const_literal_end)\n  {\n    JERRY_DEBUG_MSG (\" lit:%d\", literal_index);\n    return;\n  }\n\n  if (literal_index < ident_end)\n  {\n    JERRY_DEBUG_MSG (\" ident:%d->\", literal_index);\n  }\n  else\n  {\n    JERRY_DEBUG_MSG (\" const:%d->\", literal_index);\n  }\n\n  ecma_value_t value = literal_start_p[literal_index - register_end];\n\n  if (ecma_is_value_number (value))\n  {\n    JERRY_DEBUG_MSG (\"number(\");\n    util_print_number (ecma_get_number_from_value (value));\n  }\n#if JERRY_BUILTIN_BIGINT\n  else if (ecma_is_value_bigint (value))\n  {\n    JERRY_DEBUG_MSG (\"bigint(\");\n    util_print_bigint (value);\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n  else\n  {\n    ecma_string_t *literal_p = ecma_get_string_from_value (value);\n\n    JERRY_DEBUG_MSG (\"string(\");\n\n    ECMA_STRING_TO_UTF8_STRING (literal_p, chars_p, literal_size);\n    util_print_chars (chars_p, literal_size);\n    ECMA_FINALIZE_UTF8_STRING (chars_p, literal_size);\n  }\n\n  JERRY_DEBUG_MSG (\")\");\n} /* util_print_literal_value */\n\n#define PARSER_READ_IDENTIFIER_INDEX(name)                               \\\n  name = *byte_code_p++;                                                 \\\n  if (name >= encoding_limit)                                            \\\n  {                                                                      \\\n    name = (uint16_t) (((name << 8) | byte_code_p[0]) - encoding_delta); \\\n    byte_code_p++;                                                       \\\n  }\n\n/**\n * Print byte code.\n */\nvoid\nutil_print_cbc (ecma_compiled_code_t *compiled_code_p) /**< compiled code */\n{\n  uint8_t flags;\n  uint8_t *byte_code_start_p;\n  uint8_t *byte_code_end_p;\n  uint8_t *byte_code_p;\n  uint16_t encoding_limit;\n  uint16_t encoding_delta;\n  uint16_t stack_limit;\n  uint16_t argument_end;\n  uint16_t register_end;\n  uint16_t ident_end;\n  uint16_t const_literal_end;\n  uint16_t literal_end;\n  size_t size = ((size_t) compiled_code_p->size) << JMEM_ALIGNMENT_LOG;\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args = (cbc_uint16_arguments_t *) compiled_code_p;\n    stack_limit = args->stack_limit;\n    argument_end = args->argument_end;\n    register_end = args->register_end;\n    ident_end = args->ident_end;\n    const_literal_end = args->const_literal_end;\n    literal_end = args->literal_end;\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args = (cbc_uint8_arguments_t *) compiled_code_p;\n    stack_limit = args->stack_limit;\n    argument_end = args->argument_end;\n    register_end = args->register_end;\n    ident_end = args->ident_end;\n    const_literal_end = args->const_literal_end;\n    literal_end = args->literal_end;\n  }\n\n  JERRY_DEBUG_MSG (\"\\nByte code dump:\\n\\n  Maximum stack depth: %d\\n  Flags: [\", (int) (stack_limit + register_end));\n\n  if (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_FULL_LITERAL_ENCODING))\n  {\n    JERRY_DEBUG_MSG (\"small_lit_enc\");\n    encoding_limit = CBC_SMALL_LITERAL_ENCODING_LIMIT;\n    encoding_delta = CBC_SMALL_LITERAL_ENCODING_DELTA;\n  }\n  else\n  {\n    JERRY_DEBUG_MSG (\"full_lit_enc\");\n    encoding_limit = CBC_FULL_LITERAL_ENCODING_LIMIT;\n    encoding_delta = CBC_FULL_LITERAL_ENCODING_DELTA;\n  }\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    JERRY_DEBUG_MSG (\",uint16_arguments\");\n  }\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)\n  {\n    JERRY_DEBUG_MSG (\",strict_mode\");\n  }\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED)\n  {\n    JERRY_DEBUG_MSG (\",mapped_arguments_needed\");\n    size -= argument_end * sizeof (ecma_value_t);\n  }\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED)\n  {\n    JERRY_DEBUG_MSG (\",no_lexical_env\");\n  }\n\n  switch (CBC_FUNCTION_GET_TYPE (compiled_code_p->status_flags))\n  {\n    case CBC_FUNCTION_CONSTRUCTOR:\n    {\n      JERRY_DEBUG_MSG (\",constructor\");\n      break;\n    }\n    case CBC_FUNCTION_GENERATOR:\n    {\n      JERRY_DEBUG_MSG (\",generator\");\n      break;\n    }\n    case CBC_FUNCTION_ASYNC:\n    {\n      JERRY_DEBUG_MSG (\",async\");\n      break;\n    }\n    case CBC_FUNCTION_ASYNC_GENERATOR:\n    {\n      JERRY_DEBUG_MSG (\",async_generator\");\n      break;\n    }\n    case CBC_FUNCTION_ACCESSOR:\n    {\n      JERRY_DEBUG_MSG (\",accessor\");\n      break;\n    }\n    case CBC_FUNCTION_ARROW:\n    {\n      JERRY_DEBUG_MSG (\",arrow\");\n      break;\n    }\n    case CBC_FUNCTION_ASYNC_ARROW:\n    {\n      JERRY_DEBUG_MSG (\",async_arrow\");\n      break;\n    }\n  }\n\n  JERRY_DEBUG_MSG (\"]\\n\");\n\n  JERRY_DEBUG_MSG (\"  Argument range end: %d\\n\", (int) argument_end);\n  JERRY_DEBUG_MSG (\"  Register range end: %d\\n\", (int) register_end);\n  JERRY_DEBUG_MSG (\"  Identifier range end: %d\\n\", (int) ident_end);\n  JERRY_DEBUG_MSG (\"  Const literal range end: %d\\n\", (int) const_literal_end);\n  JERRY_DEBUG_MSG (\"  Literal range end: %d\\n\\n\", (int) literal_end);\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_HAS_EXTENDED_INFO)\n  {\n    uint8_t *extended_info_p = ecma_compiled_code_resolve_extended_info (compiled_code_p);\n    uint8_t *extended_info_start_p = extended_info_p + sizeof (uint8_t);\n    uint8_t extended_info = *extended_info_p;\n\n    if (extended_info & CBC_EXTENDED_CODE_FLAGS_HAS_ARGUMENT_LENGTH)\n    {\n      uint32_t argument_length = ecma_extended_info_decode_vlq (&extended_info_p);\n      JERRY_DEBUG_MSG (\"  [Extended] Argument length: %d\\n\", (int) argument_length);\n    }\n\n    if (extended_info & CBC_EXTENDED_CODE_FLAGS_HAS_SOURCE_CODE_RANGE)\n    {\n      uint32_t range_start = ecma_extended_info_decode_vlq (&extended_info_p);\n      uint32_t range_end = ecma_extended_info_decode_vlq (&extended_info_p) + range_start;\n      JERRY_DEBUG_MSG (\"  [Extended] Source code range: %d - %d\\n\", (int) range_start, (int) range_end);\n    }\n\n    JERRY_DEBUG_MSG (\"\\n\");\n\n    size -= (size_t) (extended_info_start_p - extended_info_p);\n  }\n\n  byte_code_start_p = (uint8_t *) compiled_code_p;\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    byte_code_start_p += sizeof (cbc_uint16_arguments_t);\n  }\n  else\n  {\n    byte_code_start_p += sizeof (cbc_uint8_arguments_t);\n  }\n\n  byte_code_start_p += (unsigned int) (literal_end - register_end) * sizeof (ecma_value_t);\n\n  if (CBC_FUNCTION_GET_TYPE (compiled_code_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)\n  {\n    size -= sizeof (ecma_value_t);\n  }\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)\n  {\n    size -= sizeof (ecma_value_t);\n  }\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO)\n  {\n    size -= sizeof (ecma_value_t);\n  }\n\n  byte_code_end_p = ((uint8_t *) compiled_code_p) + size;\n  byte_code_p = byte_code_start_p;\n\n  while (byte_code_p < byte_code_end_p)\n  {\n    cbc_opcode_t opcode = (cbc_opcode_t) *byte_code_p;\n    cbc_ext_opcode_t ext_opcode = CBC_EXT_NOP;\n    size_t cbc_offset = (size_t) (byte_code_p - byte_code_start_p);\n\n    if (opcode != CBC_EXT_OPCODE)\n    {\n      flags = cbc_flags[opcode];\n      JERRY_DEBUG_MSG (\" %3d : %s\", (int) cbc_offset, cbc_names[opcode]);\n      byte_code_p++;\n    }\n    else\n    {\n      if (byte_code_p + 1 >= byte_code_end_p)\n      {\n        break;\n      }\n\n      ext_opcode = (cbc_ext_opcode_t) byte_code_p[1];\n\n      if (ext_opcode == CBC_EXT_NOP)\n      {\n        break;\n      }\n\n      flags = cbc_ext_flags[ext_opcode];\n      JERRY_DEBUG_MSG (\" %3d : %s\", (int) cbc_offset, cbc_ext_names[ext_opcode]);\n      byte_code_p += 2;\n    }\n\n    if (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))\n    {\n      uint16_t literal_index;\n\n      PARSER_READ_IDENTIFIER_INDEX (literal_index);\n      util_print_literal_value (compiled_code_p, literal_index);\n    }\n\n    if (flags & CBC_HAS_LITERAL_ARG2)\n    {\n      uint16_t literal_index;\n\n      PARSER_READ_IDENTIFIER_INDEX (literal_index);\n      util_print_literal_value (compiled_code_p, literal_index);\n\n      if (!(flags & CBC_HAS_LITERAL_ARG))\n      {\n        PARSER_READ_IDENTIFIER_INDEX (literal_index);\n        util_print_literal_value (compiled_code_p, literal_index);\n      }\n    }\n\n    if (flags & CBC_HAS_BYTE_ARG)\n    {\n      if (opcode == CBC_PUSH_NUMBER_POS_BYTE || opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE)\n      {\n        JERRY_DEBUG_MSG (\" number:%d\", (int) *byte_code_p + 1);\n      }\n      else if (opcode == CBC_PUSH_NUMBER_NEG_BYTE || opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)\n      {\n        JERRY_DEBUG_MSG (\" number:%d\", -((int) *byte_code_p + 1));\n      }\n      else\n      {\n        JERRY_DEBUG_MSG (\" byte_arg:%d\", *byte_code_p);\n      }\n      byte_code_p++;\n    }\n\n    if (flags & CBC_HAS_BRANCH_ARG)\n    {\n      size_t branch_offset_length =\n        (opcode != CBC_EXT_OPCODE ? CBC_BRANCH_OFFSET_LENGTH (opcode) : CBC_BRANCH_OFFSET_LENGTH (ext_opcode));\n      size_t offset = 0;\n\n      do\n      {\n        offset = (offset << 8) | *byte_code_p++;\n      } while (--branch_offset_length > 0);\n\n      JERRY_DEBUG_MSG (\" offset:%d(->%d)\",\n                       (int) offset,\n                       (int) (cbc_offset + (CBC_BRANCH_IS_FORWARD (flags) ? offset : -offset)));\n    }\n\n    JERRY_DEBUG_MSG (\"\\n\");\n  }\n} /* util_print_cbc */\n\n#undef PARSER_READ_IDENTIFIER_INDEX\n\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/parser/js/common.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef COMMON_H\n#define COMMON_H\n\n#include <inttypes.h>\n#include <setjmp.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_utils Utility\n * @{\n */\n\n#include \"ecma-globals.h\"\n#include \"ecma-regexp-object.h\"\n\n#include \"config.h\"\n#include \"jmem.h\"\n\n/* Immediate management. */\n\n/**\n * Literal types.\n *\n * The LEXER_UNUSED_LITERAL type is internal and\n * used for various purposes.\n */\ntypedef enum\n{\n  /* The LEXER_IS_IDENT_OR_STRING macro must be updated if the order is changed. */\n  LEXER_IDENT_LITERAL = 0, /**< identifier literal */\n  LEXER_STRING_LITERAL = 1, /**< string literal */\n  LEXER_NUMBER_LITERAL = 2, /**< number literal */\n  LEXER_FUNCTION_LITERAL = 3, /**< function literal */\n  LEXER_REGEXP_LITERAL = 4, /**< regexp literal */\n  LEXER_UNUSED_LITERAL = 5, /**< unused literal, can only be\n                                 used by the byte code generator. */\n  LEXER_NEW_IDENT_LITERAL = 6, /**< new local variable, can only be\n                                    used by the byte code generator. */\n} lexer_literal_type_t;\n\n/**\n * Checks whether the literal type is identifier or string.\n */\n#define LEXER_IS_IDENT_OR_STRING(literal_type) ((literal_type) <= LEXER_STRING_LITERAL)\n\n/**\n * Flag bits for status_flags member of lexer_literal_t.\n */\ntypedef enum\n{\n  LEXER_FLAG_USED = (1 << 0), /**< this local identifier needs to be stored in the constant pool */\n  LEXER_FLAG_FUNCTION_ARGUMENT = (1 << 1), /**< this local identifier is a function argument */\n  LEXER_FLAG_SOURCE_PTR = (1 << 2), /**< the literal is directly referenced in the source code\n                                     *   (no need to allocate memory) */\n  LEXER_FLAG_LATE_INIT = (1 << 3), /**< initialize this variable after the byte code is freed */\n  LEXER_FLAG_ASCII = (1 << 4), /**< the literal contains only ascii characters */\n  LEXER_FLAG_GLOBAL = (1 << 5), /**< this local identifier is not a let or const declaration */\n} lexer_literal_status_flags_t;\n\n/**\n * Type of property length.\n */\n#if JERRY_CPOINTER_32_BIT\ntypedef uint32_t prop_length_t;\n#else /* !JERRY_CPOINTER_32_BIT */\ntypedef uint16_t prop_length_t;\n#endif /* JERRY_CPOINTER_32_BIT */\n\n/**\n * Literal data.\n */\ntypedef struct\n{\n  union\n  {\n    ecma_value_t value; /**< literal value (not processed by the parser) */\n    const uint8_t *char_p; /**< character value */\n    ecma_compiled_code_t *bytecode_p; /**< compiled function or regexp pointer */\n    uint32_t source_data; /**< encoded source literal */\n  } u;\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  struct\n#else /* !JERRY_PARSER_DUMP_BYTE_CODE */\n  union\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n  {\n    prop_length_t length; /**< length of ident / string literal */\n    uint16_t index; /**< real index during post processing */\n  } prop;\n\n  uint8_t type; /**< type of the literal */\n  uint8_t status_flags; /**< status flags */\n} lexer_literal_t;\n\nvoid util_free_literal (lexer_literal_t *literal_p);\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\nvoid util_print_literal (lexer_literal_t *);\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n/**\n * Source code line counter type.\n */\ntypedef uint32_t parser_line_counter_t;\n\n/**\n * Source code as character data.\n */\ntypedef struct\n{\n  const uint8_t *source_p; /**< valid UTF-8 source code */\n  size_t source_size; /**< size of the source code */\n} parser_source_char_t;\n\n/* TRY/CATCH block */\n\n#define PARSER_TRY_CONTEXT(context_name) jmp_buf context_name\n\n#define PARSER_THROW(context_name) longjmp (context_name, 1);\n\n#define PARSER_TRY(context_name) \\\n  {                              \\\n    if (!setjmp (context_name))  \\\n    {\n#define PARSER_CATCH \\\n  }                  \\\n  else               \\\n  {\n#define PARSER_TRY_END \\\n  }                    \\\n  }\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* !COMMON_H */\n"
  },
  {
    "path": "jerry-core/parser/js/js-lexer.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-literal-storage.h\"\n\n#include \"jcontext.h\"\n#include \"js-parser-internal.h\"\n#include \"lit-char-helpers.h\"\n\n#if JERRY_PARSER\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_lexer Lexer\n * @{\n */\n\nJERRY_STATIC_ASSERT (LEXER_NUMBER_BINARY > LEXER_NUMBER_OCTAL,\n                     lexer_number_binary_must_be_greater_than_lexer_number_octal);\n\n/**\n * Check whether the UTF-8 intermediate is an octet or not\n */\n#define IS_UTF8_INTERMEDIATE_OCTET(byte) (((byte) &LIT_UTF8_EXTRA_BYTE_MASK) == LIT_UTF8_2_BYTE_CODE_POINT_MIN)\n\n/**\n * Align column to the next tab position.\n *\n * @return aligned position\n */\nstatic parser_line_counter_t\nalign_column_to_tab (parser_line_counter_t column) /**< current column */\n{\n  /* Tab aligns to zero column start position. */\n  return (parser_line_counter_t) (((column + (8u - 1u)) & ~ECMA_STRING_CONTAINER_MASK) + 1u);\n} /* align_column_to_tab */\n\n/**\n * Parse hexadecimal character sequence\n *\n * @return character value or UINT32_MAX on error\n */\nstatic lit_code_point_t\nlexer_hex_to_code_point (const uint8_t *source_p, /**< current source position */\n                         parser_line_counter_t length) /**< source length */\n{\n  lit_code_point_t result = 0;\n\n  do\n  {\n    uint32_t byte = *source_p++;\n\n    result <<= 4;\n\n    if (byte >= LIT_CHAR_0 && byte <= LIT_CHAR_9)\n    {\n      result += byte - LIT_CHAR_0;\n    }\n    else\n    {\n      byte = LEXER_TO_ASCII_LOWERCASE (byte);\n      if (byte >= LIT_CHAR_LOWERCASE_A && byte <= LIT_CHAR_LOWERCASE_F)\n      {\n        result += byte - (LIT_CHAR_LOWERCASE_A - 10);\n      }\n      else\n      {\n        return UINT32_MAX;\n      }\n    }\n  } while (--length > 0);\n\n  return result;\n} /* lexer_hex_to_code_point */\n\n/**\n * Parse hexadecimal character sequence enclosed in braces\n *\n * @return character value or UINT32_MAX on error\n */\nstatic lit_code_point_t\nlexer_hex_in_braces_to_code_point (const uint8_t *source_p, /**< current source position */\n                                   const uint8_t *source_end_p, /**< source end */\n                                   uint32_t *length_p) /**< [out] length of the sequence */\n{\n  lit_code_point_t result = 0;\n  /* Four is the size of \\u{} sequence. */\n  uint32_t length = 4;\n\n  JERRY_ASSERT (source_p[-1] == LIT_CHAR_LEFT_BRACE);\n  JERRY_ASSERT (source_p < source_end_p);\n\n  do\n  {\n    uint32_t byte = *source_p++;\n\n    result <<= 4;\n\n    if (byte >= LIT_CHAR_0 && byte <= LIT_CHAR_9)\n    {\n      result += byte - LIT_CHAR_0;\n    }\n    else\n    {\n      byte = LEXER_TO_ASCII_LOWERCASE (byte);\n      if (byte >= LIT_CHAR_LOWERCASE_A && byte <= LIT_CHAR_LOWERCASE_F)\n      {\n        result += byte - (LIT_CHAR_LOWERCASE_A - 10);\n      }\n      else\n      {\n        return UINT32_MAX;\n      }\n    }\n\n    if (result >= (LIT_UNICODE_CODE_POINT_MAX + 1) || source_p >= source_end_p)\n    {\n      return UINT32_MAX;\n    }\n    length++;\n  } while (*source_p != LIT_CHAR_RIGHT_BRACE);\n\n  *length_p = length;\n  return result;\n} /* lexer_hex_in_braces_to_code_point */\n\n/**\n * Parse hexadecimal character sequence\n *\n * @return character value\n */\nstatic lit_code_point_t\nlexer_unchecked_hex_to_character (const uint8_t **source_p) /**< [in, out] current source position */\n{\n  lit_code_point_t result = 0;\n  const uint8_t *char_p = *source_p;\n  uint32_t length = (char_p[-1] == LIT_CHAR_LOWERCASE_U) ? 4 : 2;\n\n  if (char_p[0] == LIT_CHAR_LEFT_BRACE)\n  {\n    length = 0;\n    char_p++;\n  }\n\n  while (true)\n  {\n    uint32_t byte = *char_p++;\n\n    result <<= 4;\n\n    if (byte >= LIT_CHAR_0 && byte <= LIT_CHAR_9)\n    {\n      result += byte - LIT_CHAR_0;\n    }\n    else\n    {\n      JERRY_ASSERT ((byte >= LIT_CHAR_LOWERCASE_A && byte <= LIT_CHAR_LOWERCASE_F)\n                    || (byte >= LIT_CHAR_UPPERCASE_A && byte <= LIT_CHAR_UPPERCASE_F));\n\n      result += LEXER_TO_ASCII_LOWERCASE (byte) - (LIT_CHAR_LOWERCASE_A - 10);\n    }\n\n    JERRY_ASSERT (result <= LIT_UNICODE_CODE_POINT_MAX);\n\n    if (length == 0)\n    {\n      if (*char_p != LIT_CHAR_RIGHT_BRACE)\n      {\n        continue;\n      }\n\n      *source_p = char_p + 1;\n      return result;\n    }\n\n    if (--length == 0)\n    {\n      *source_p = char_p;\n      return result;\n    }\n  }\n} /* lexer_unchecked_hex_to_character */\n\n/**\n * Skip space mode\n */\ntypedef enum\n{\n  LEXER_SKIP_SPACES, /**< skip spaces mode */\n  LEXER_SKIP_SINGLE_LINE_COMMENT, /**< parse single line comment */\n  LEXER_SKIP_MULTI_LINE_COMMENT, /**< parse multi line comment */\n} skip_mode_t;\n\n/**\n * Skip spaces.\n */\nstatic void\nlexer_skip_spaces (parser_context_t *context_p) /**< context */\n{\n  skip_mode_t mode = LEXER_SKIP_SPACES;\n  const uint8_t *source_end_p = context_p->source_end_p;\n\n  if (context_p->token.flags & LEXER_NO_SKIP_SPACES)\n  {\n    context_p->token.flags &= (uint8_t) ~LEXER_NO_SKIP_SPACES;\n    return;\n  }\n\n  context_p->token.flags = 0;\n\n  while (true)\n  {\n    if (context_p->source_p >= source_end_p)\n    {\n      if (mode == LEXER_SKIP_MULTI_LINE_COMMENT)\n      {\n        parser_raise_error (context_p, PARSER_ERR_UNTERMINATED_MULTILINE_COMMENT);\n      }\n      return;\n    }\n\n    switch (context_p->source_p[0])\n    {\n      case LIT_CHAR_CR:\n      {\n        if (context_p->source_p + 1 < source_end_p && context_p->source_p[1] == LIT_CHAR_LF)\n        {\n          context_p->source_p++;\n        }\n        /* FALLTHRU */\n      }\n\n      case LIT_CHAR_LF:\n      {\n        context_p->line++;\n        context_p->column = 0;\n        context_p->token.flags = LEXER_WAS_NEWLINE;\n\n        if (mode == LEXER_SKIP_SINGLE_LINE_COMMENT)\n        {\n          mode = LEXER_SKIP_SPACES;\n        }\n        /* FALLTHRU */\n      }\n\n      case LIT_CHAR_VTAB:\n      case LIT_CHAR_FF:\n      case LIT_CHAR_SP:\n      {\n        context_p->source_p++;\n        context_p->column++;\n        continue;\n      }\n\n      case LIT_CHAR_TAB:\n      {\n        context_p->column = align_column_to_tab (context_p->column);\n        context_p->source_p++;\n        continue;\n      }\n\n      case LIT_CHAR_SLASH:\n      {\n        if (mode == LEXER_SKIP_SPACES && context_p->source_p + 1 < source_end_p)\n        {\n          if (context_p->source_p[1] == LIT_CHAR_SLASH)\n          {\n            mode = LEXER_SKIP_SINGLE_LINE_COMMENT;\n          }\n          else if (context_p->source_p[1] == LIT_CHAR_ASTERISK)\n          {\n            mode = LEXER_SKIP_MULTI_LINE_COMMENT;\n            context_p->token.line = context_p->line;\n            context_p->token.column = context_p->column;\n          }\n\n          if (mode != LEXER_SKIP_SPACES)\n          {\n            context_p->source_p += 2;\n            PARSER_PLUS_EQUAL_LC (context_p->column, 2);\n            continue;\n          }\n        }\n        break;\n      }\n\n      case LIT_CHAR_ASTERISK:\n      {\n        if (mode == LEXER_SKIP_MULTI_LINE_COMMENT && context_p->source_p + 1 < source_end_p\n            && context_p->source_p[1] == LIT_CHAR_SLASH)\n        {\n          mode = LEXER_SKIP_SPACES;\n          context_p->source_p += 2;\n          PARSER_PLUS_EQUAL_LC (context_p->column, 2);\n          continue;\n        }\n        break;\n      }\n\n      case 0xc2:\n      {\n        if (context_p->source_p + 1 < source_end_p && context_p->source_p[1] == 0xa0)\n        {\n          /* Codepoint \\u00A0 */\n          context_p->source_p += 2;\n          context_p->column++;\n          continue;\n        }\n        break;\n      }\n\n      case LEXER_NEWLINE_LS_PS_BYTE_1:\n      {\n        JERRY_ASSERT (context_p->source_p + 2 < source_end_p);\n        if (LEXER_NEWLINE_LS_PS_BYTE_23 (context_p->source_p))\n        {\n          /* Codepoint \\u2028 and \\u2029 */\n          context_p->source_p += 3;\n          context_p->line++;\n          context_p->column = 1;\n          context_p->token.flags = LEXER_WAS_NEWLINE;\n\n          if (mode == LEXER_SKIP_SINGLE_LINE_COMMENT)\n          {\n            mode = LEXER_SKIP_SPACES;\n          }\n          continue;\n        }\n        break;\n      }\n\n      case 0xef:\n      {\n        if (context_p->source_p + 2 < source_end_p && context_p->source_p[1] == 0xbb && context_p->source_p[2] == 0xbf)\n        {\n          /* Codepoint \\uFEFF */\n          context_p->source_p += 3;\n          context_p->column++;\n          continue;\n        }\n        break;\n      }\n\n      default:\n      {\n        break;\n      }\n    }\n\n    if (mode == LEXER_SKIP_SPACES)\n    {\n      return;\n    }\n\n    context_p->source_p++;\n\n    if (context_p->source_p < source_end_p && !IS_UTF8_INTERMEDIATE_OCTET (context_p->source_p[0]))\n    {\n      context_p->column++;\n    }\n  }\n} /* lexer_skip_spaces */\n\n/**\n * Checks the next token start character.\n *\n * @return LIT_INVALID_CP - if there is no more characters to read\n *         next byte - otherwise\n */\nlit_code_point_t\nlexer_peek_next_character (parser_context_t *context_p) /**< context */\n{\n  if (!(context_p->token.flags & LEXER_NO_SKIP_SPACES))\n  {\n    lexer_skip_spaces (context_p);\n    context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);\n  }\n\n  if (context_p->source_p < context_p->source_end_p)\n  {\n    return context_p->source_p[0];\n  }\n\n  return LIT_INVALID_CP;\n} /* lexer_check_next_character */\n\n/**\n * Skip all the continuous empty statements.\n */\nvoid\nlexer_skip_empty_statements (parser_context_t *context_p) /**< context */\n{\n  lexer_skip_spaces (context_p);\n\n  while (context_p->source_p < context_p->source_end_p && *context_p->source_p == LIT_CHAR_SEMICOLON)\n  {\n    lexer_consume_next_character (context_p);\n    lexer_skip_spaces (context_p);\n  }\n\n  context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);\n} /* lexer_skip_empty_statements */\n\n/**\n * Checks whether the keyword has escape sequences.\n */\n#define LEXER_CHECK_INVALID_KEYWORD(ident_start_p, buffer_p) \\\n  (JERRY_UNLIKELY ((ident_start_p) == (buffer_p))            \\\n   && !(context_p->global_status_flags & ECMA_PARSE_INTERNAL_PRE_SCANNING))\n\n/**\n * Keyword data.\n */\ntypedef struct\n{\n  const uint8_t *keyword_p; /**< keyword string */\n  lexer_token_type_t type; /**< keyword token type */\n} keyword_string_t;\n\n/**\n * @{\n * Keyword defines\n */\n#define LEXER_KEYWORD(name, type)    \\\n  {                                  \\\n    (const uint8_t *) (name), (type) \\\n  }\n#define LEXER_KEYWORD_LIST_LENGTH(name) (const uint8_t) (sizeof ((name)) / sizeof ((name)[0]))\n/** @} */\n\n/**\n * Length of the shortest keyword.\n */\n#define LEXER_KEYWORD_MIN_LENGTH 2\n\n/**\n * Length of the longest keyword.\n */\n#define LEXER_KEYWORD_MAX_LENGTH 10\n\n/**\n * Keywords with 2 characters.\n */\nstatic const keyword_string_t keywords_with_length_2[] = {\n  LEXER_KEYWORD (\"do\", LEXER_KEYW_DO),\n  LEXER_KEYWORD (\"if\", LEXER_KEYW_IF),\n  LEXER_KEYWORD (\"in\", LEXER_KEYW_IN),\n};\n\n/**\n * Keywords with 3 characters.\n */\nstatic const keyword_string_t keywords_with_length_3[] = {\n  LEXER_KEYWORD (\"for\", LEXER_KEYW_FOR), LEXER_KEYWORD (\"let\", LEXER_KEYW_LET), LEXER_KEYWORD (\"new\", LEXER_KEYW_NEW),\n  LEXER_KEYWORD (\"try\", LEXER_KEYW_TRY), LEXER_KEYWORD (\"var\", LEXER_KEYW_VAR),\n};\n\n/**\n * Keywords with 4 characters.\n */\nstatic const keyword_string_t keywords_with_length_4[] = {\n  LEXER_KEYWORD (\"case\", LEXER_KEYW_CASE), LEXER_KEYWORD (\"else\", LEXER_KEYW_ELSE),\n  LEXER_KEYWORD (\"enum\", LEXER_KEYW_ENUM), LEXER_KEYWORD (\"eval\", LEXER_KEYW_EVAL),\n#if JERRY_MODULE_SYSTEM\n  LEXER_KEYWORD (\"meta\", LEXER_KEYW_META),\n#endif /* JERRY_MODULE_SYSTEM */\n  LEXER_KEYWORD (\"null\", LEXER_LIT_NULL),  LEXER_KEYWORD (\"this\", LEXER_KEYW_THIS),\n  LEXER_KEYWORD (\"true\", LEXER_LIT_TRUE),  LEXER_KEYWORD (\"void\", LEXER_KEYW_VOID),\n  LEXER_KEYWORD (\"with\", LEXER_KEYW_WITH),\n};\n\n/**\n * Keywords with 5 characters.\n */\nstatic const keyword_string_t keywords_with_length_5[] = {\n  LEXER_KEYWORD (\"async\", LEXER_KEYW_ASYNC), LEXER_KEYWORD (\"await\", LEXER_KEYW_AWAIT),\n  LEXER_KEYWORD (\"break\", LEXER_KEYW_BREAK), LEXER_KEYWORD (\"catch\", LEXER_KEYW_CATCH),\n  LEXER_KEYWORD (\"class\", LEXER_KEYW_CLASS), LEXER_KEYWORD (\"const\", LEXER_KEYW_CONST),\n  LEXER_KEYWORD (\"false\", LEXER_LIT_FALSE),  LEXER_KEYWORD (\"super\", LEXER_KEYW_SUPER),\n  LEXER_KEYWORD (\"throw\", LEXER_KEYW_THROW), LEXER_KEYWORD (\"while\", LEXER_KEYW_WHILE),\n  LEXER_KEYWORD (\"yield\", LEXER_KEYW_YIELD),\n};\n\n/**\n * Keywords with 6 characters.\n */\nstatic const keyword_string_t keywords_with_length_6[] = {\n  LEXER_KEYWORD (\"delete\", LEXER_KEYW_DELETE), LEXER_KEYWORD (\"export\", LEXER_KEYW_EXPORT),\n  LEXER_KEYWORD (\"import\", LEXER_KEYW_IMPORT), LEXER_KEYWORD (\"public\", LEXER_KEYW_PUBLIC),\n  LEXER_KEYWORD (\"return\", LEXER_KEYW_RETURN), LEXER_KEYWORD (\"static\", LEXER_KEYW_STATIC),\n  LEXER_KEYWORD (\"switch\", LEXER_KEYW_SWITCH), LEXER_KEYWORD (\"typeof\", LEXER_KEYW_TYPEOF),\n};\n\n/**\n * Keywords with 7 characters.\n */\nstatic const keyword_string_t keywords_with_length_7[] = {\n  LEXER_KEYWORD (\"default\", LEXER_KEYW_DEFAULT), LEXER_KEYWORD (\"extends\", LEXER_KEYW_EXTENDS),\n  LEXER_KEYWORD (\"finally\", LEXER_KEYW_FINALLY), LEXER_KEYWORD (\"package\", LEXER_KEYW_PACKAGE),\n  LEXER_KEYWORD (\"private\", LEXER_KEYW_PRIVATE),\n};\n\n/**\n * Keywords with 8 characters.\n */\nstatic const keyword_string_t keywords_with_length_8[] = {\n  LEXER_KEYWORD (\"continue\", LEXER_KEYW_CONTINUE),\n  LEXER_KEYWORD (\"debugger\", LEXER_KEYW_DEBUGGER),\n  LEXER_KEYWORD (\"function\", LEXER_KEYW_FUNCTION),\n};\n\n/**\n * Keywords with 9 characters.\n */\nstatic const keyword_string_t keywords_with_length_9[] = {\n  LEXER_KEYWORD (\"arguments\", LEXER_KEYW_ARGUMENTS),\n  LEXER_KEYWORD (\"interface\", LEXER_KEYW_INTERFACE),\n  LEXER_KEYWORD (\"protected\", LEXER_KEYW_PROTECTED),\n};\n\n/**\n * Keywords with 10 characters.\n */\nstatic const keyword_string_t keywords_with_length_10[] = {\n  LEXER_KEYWORD (\"implements\", LEXER_KEYW_IMPLEMENTS),\n  LEXER_KEYWORD (\"instanceof\", LEXER_KEYW_INSTANCEOF),\n};\n\n/**\n * List of the keyword groups.\n */\nstatic const keyword_string_t *const keyword_strings_list[] = { keywords_with_length_2, keywords_with_length_3,\n                                                                keywords_with_length_4, keywords_with_length_5,\n                                                                keywords_with_length_6, keywords_with_length_7,\n                                                                keywords_with_length_8, keywords_with_length_9,\n                                                                keywords_with_length_10 };\n\nJERRY_STATIC_ASSERT (sizeof (keyword_strings_list) / sizeof (const keyword_string_t *)\n                       == (LEXER_KEYWORD_MAX_LENGTH - LEXER_KEYWORD_MIN_LENGTH) + 1,\n                     keyword_strings_list_size_must_equal_to_keyword_max_length_difference);\n\n/**\n * List of the keyword groups length.\n */\nstatic const uint8_t keyword_lengths_list[] = {\n  LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_2), LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_3),\n  LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_4), LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_5),\n  LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_6), LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_7),\n  LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_8), LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_9),\n  LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_10)\n};\n\n#undef LEXER_KEYWORD\n#undef LEXER_KEYWORD_LIST_LENGTH\n\nJERRY_STATIC_ASSERT (LEXER_FIRST_NON_RESERVED_KEYWORD < LEXER_FIRST_FUTURE_STRICT_RESERVED_WORD,\n                     lexer_first_non_reserved_keyword_must_be_before_lexer_first_future_strict_reserved_word);\n\n/**\n * Parse identifier.\n *\n * @return true, if an identifier is parsed, false otherwise\n */\nstatic bool\nlexer_parse_identifier (parser_context_t *context_p, /**< context */\n                        lexer_parse_options_t options) /**< check keywords */\n{\n  /* Only very few identifiers contains \\u escape sequences. */\n  const uint8_t *source_p = context_p->source_p;\n  /* Note: newline or tab cannot be part of an identifier. */\n  parser_line_counter_t column = context_p->column;\n  const uint8_t *source_end_p = context_p->source_end_p;\n  size_t length = 0;\n  lexer_lit_location_flags_t status_flags = LEXER_LIT_LOCATION_IS_ASCII;\n\n  do\n  {\n    if (*source_p == LIT_CHAR_BACKSLASH)\n    {\n      /* After a backslash an identifier must start. */\n      lit_code_point_t code_point = UINT32_MAX;\n      uint32_t escape_length = 6;\n\n      if (options & (LEXER_PARSE_CHECK_START_AND_RETURN | LEXER_PARSE_CHECK_PART_AND_RETURN))\n      {\n        return true;\n      }\n\n      status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE;\n\n      if (source_p + 5 <= source_end_p && source_p[1] == LIT_CHAR_LOWERCASE_U)\n      {\n        if (source_p[2] == LIT_CHAR_LEFT_BRACE)\n        {\n          code_point = lexer_hex_in_braces_to_code_point (source_p + 3, source_end_p, &escape_length);\n        }\n        else if (source_p + 6 <= source_end_p)\n        {\n          code_point = lexer_hex_to_code_point (source_p + 2, 4);\n        }\n      }\n\n      if (code_point == UINT32_MAX)\n      {\n        context_p->source_p = source_p;\n        context_p->token.column = column;\n        parser_raise_error (context_p, PARSER_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE);\n      }\n\n      if (length == 0)\n      {\n        if (!lit_code_point_is_identifier_start (code_point))\n        {\n          parser_raise_error (context_p, PARSER_ERR_INVALID_IDENTIFIER_START);\n        }\n      }\n      else\n      {\n        if (!lit_code_point_is_identifier_part (code_point))\n        {\n          parser_raise_error (context_p, PARSER_ERR_INVALID_IDENTIFIER_PART);\n        }\n      }\n\n      length += lit_code_point_get_cesu8_length (code_point);\n      source_p += escape_length;\n      PARSER_PLUS_EQUAL_LC (column, escape_length);\n      continue;\n    }\n\n    lit_code_point_t code_point = *source_p;\n    lit_utf8_size_t utf8_length = 1, decoded_length = 1, char_count = 1;\n\n    if (JERRY_UNLIKELY (code_point >= LIT_UTF8_2_BYTE_MARKER))\n    {\n      status_flags &= (uint32_t) ~LEXER_LIT_LOCATION_IS_ASCII;\n\n      utf8_length = lit_read_code_point_from_utf8 (source_p, (lit_utf8_size_t) (source_end_p - source_p), &code_point);\n      decoded_length = utf8_length;\n\n      /* Only ES2015+ supports code points outside of the basic plane which can be part of an identifier. */\n      if ((code_point >= LIT_UTF16_HIGH_SURROGATE_MIN && code_point <= LIT_UTF16_HIGH_SURROGATE_MAX)\n          && source_p + 3 < source_end_p)\n      {\n        lit_code_point_t low_surrogate;\n        lit_read_code_point_from_utf8 (source_p + 3, (lit_utf8_size_t) (source_end_p - (source_p + 3)), &low_surrogate);\n\n        if (low_surrogate >= LIT_UTF16_LOW_SURROGATE_MIN && low_surrogate <= LIT_UTF16_LOW_SURROGATE_MAX)\n        {\n          code_point = lit_convert_surrogate_pair_to_code_point ((ecma_char_t) code_point, (ecma_char_t) low_surrogate);\n          utf8_length = 2 * 3;\n          decoded_length = 2 * 3;\n          char_count = 2;\n        }\n      }\n      else if (source_p[0] >= LIT_UTF8_4_BYTE_MARKER)\n      {\n        decoded_length = 2 * 3;\n        status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE;\n#if JERRY_FUNCTION_TO_STRING\n        context_p->global_status_flags |= ECMA_PARSE_INTERNAL_HAS_4_BYTE_MARKER;\n#endif /* JERRY_FUNCTION_TO_STRING */\n      }\n    }\n\n    if (length == 0)\n    {\n      if (JERRY_UNLIKELY (options & (LEXER_PARSE_CHECK_START_AND_RETURN | LEXER_PARSE_CHECK_PART_AND_RETURN)))\n      {\n        if (options & LEXER_PARSE_CHECK_START_AND_RETURN)\n        {\n          return lit_code_point_is_identifier_start (code_point);\n        }\n        else\n        {\n          return lit_code_point_is_identifier_part (code_point);\n        }\n      }\n\n      if (!lit_code_point_is_identifier_start (code_point))\n      {\n        return false;\n      }\n    }\n    else if (!lit_code_point_is_identifier_part (code_point))\n    {\n      break;\n    }\n\n    source_p += utf8_length;\n    length += decoded_length;\n    PARSER_PLUS_EQUAL_LC (column, char_count);\n  } while (source_p < source_end_p);\n\n  JERRY_ASSERT (length > 0);\n\n  context_p->token.type = LEXER_LITERAL;\n  context_p->token.lit_location.type = LEXER_IDENT_LITERAL;\n  context_p->token.lit_location.status_flags = (uint8_t) status_flags;\n\n  context_p->token.column = context_p->column;\n  context_p->token.lit_location.char_p = context_p->source_p;\n  context_p->token.lit_location.length = (prop_length_t) length;\n\n  if (JERRY_UNLIKELY (length > PARSER_MAXIMUM_IDENT_LENGTH))\n  {\n    parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_TOO_LONG);\n  }\n\n  /* Check keywords. */\n  if ((options & LEXER_PARSE_CHECK_KEYWORDS)\n      && (length >= LEXER_KEYWORD_MIN_LENGTH && length <= LEXER_KEYWORD_MAX_LENGTH))\n  {\n    const uint8_t *ident_start_p = context_p->source_p;\n    uint8_t buffer_p[LEXER_KEYWORD_MAX_LENGTH];\n\n    if (JERRY_UNLIKELY (context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))\n    {\n      lexer_convert_ident_to_cesu8 (buffer_p, ident_start_p, (prop_length_t) length);\n      ident_start_p = buffer_p;\n    }\n\n    const keyword_string_t *keyword_list_p = keyword_strings_list[length - LEXER_KEYWORD_MIN_LENGTH];\n\n    int start = 0;\n    int end = keyword_lengths_list[length - LEXER_KEYWORD_MIN_LENGTH];\n    int middle = end / 2;\n\n    do\n    {\n      const keyword_string_t *keyword_p = keyword_list_p + middle;\n      int compare_result = ident_start_p[0] - keyword_p->keyword_p[0];\n\n      if (compare_result == 0)\n      {\n        compare_result = memcmp (ident_start_p, keyword_p->keyword_p, length);\n\n        if (compare_result == 0)\n        {\n          context_p->token.keyword_type = (uint8_t) keyword_p->type;\n\n          if (JERRY_LIKELY (keyword_p->type < LEXER_FIRST_NON_RESERVED_KEYWORD))\n          {\n            if (JERRY_UNLIKELY (keyword_p->type == LEXER_KEYW_AWAIT))\n            {\n              if (!(context_p->status_flags & (PARSER_IS_ASYNC_FUNCTION | PARSER_IS_CLASS_STATIC_BLOCK))\n                  && !(context_p->global_status_flags & ECMA_PARSE_MODULE))\n              {\n                break;\n              }\n\n              if (context_p->status_flags & PARSER_DISALLOW_AWAIT_YIELD)\n              {\n                if (LEXER_CHECK_INVALID_KEYWORD (ident_start_p, buffer_p))\n                {\n                  parser_raise_error (context_p, PARSER_ERR_INVALID_KEYWORD);\n                }\n                parser_raise_error (context_p, PARSER_ERR_AWAIT_NOT_ALLOWED);\n              }\n\n              context_p->token.type = (uint8_t) LEXER_KEYW_AWAIT;\n              break;\n            }\n\n            if (LEXER_CHECK_INVALID_KEYWORD (ident_start_p, buffer_p))\n            {\n              /* Escape sequences are not allowed in a keyword. */\n              parser_raise_error (context_p, PARSER_ERR_INVALID_KEYWORD);\n            }\n\n            context_p->token.type = (uint8_t) keyword_p->type;\n            break;\n          }\n\n          if (keyword_p->type == LEXER_KEYW_LET && (context_p->status_flags & PARSER_IS_STRICT))\n          {\n            if (LEXER_CHECK_INVALID_KEYWORD (ident_start_p, buffer_p))\n            {\n              parser_raise_error (context_p, PARSER_ERR_INVALID_KEYWORD);\n            }\n\n            context_p->token.type = (uint8_t) LEXER_KEYW_LET;\n            break;\n          }\n\n          if (keyword_p->type == LEXER_KEYW_YIELD && (context_p->status_flags & PARSER_IS_GENERATOR_FUNCTION))\n          {\n            if (context_p->status_flags & PARSER_DISALLOW_AWAIT_YIELD)\n            {\n              if (LEXER_CHECK_INVALID_KEYWORD (ident_start_p, buffer_p))\n              {\n                parser_raise_error (context_p, PARSER_ERR_INVALID_KEYWORD);\n              }\n              parser_raise_error (context_p, PARSER_ERR_YIELD_NOT_ALLOWED);\n            }\n\n            context_p->token.type = (uint8_t) LEXER_KEYW_YIELD;\n            break;\n          }\n\n          if (keyword_p->type == LEXER_KEYW_ARGUMENTS && (context_p->status_flags & PARSER_INSIDE_CLASS_FIELD))\n          {\n            parser_raise_error (context_p, PARSER_ERR_ARGUMENTS_IN_CLASS_FIELD);\n          }\n\n          if (keyword_p->type >= LEXER_FIRST_FUTURE_STRICT_RESERVED_WORD && (context_p->status_flags & PARSER_IS_STRICT)\n              && !(options & LEXER_PARSE_NO_STRICT_IDENT_ERROR))\n          {\n            parser_raise_error (context_p, PARSER_ERR_STRICT_IDENT_NOT_ALLOWED);\n          }\n          break;\n        }\n      }\n\n      if (compare_result > 0)\n      {\n        start = middle + 1;\n      }\n      else\n      {\n        JERRY_ASSERT (compare_result < 0);\n        end = middle;\n      }\n\n      middle = (start + end) / 2;\n    } while (start < end);\n  }\n\n  context_p->source_p = source_p;\n  context_p->column = column;\n  return true;\n} /* lexer_parse_identifier */\n\n#undef LEXER_CHECK_INVALID_KEYWORD\n\n/**\n * Parse string.\n */\nvoid\nlexer_parse_string (parser_context_t *context_p, /**< context */\n                    lexer_string_options_t opts) /**< options */\n{\n  int32_t raw_length_adjust = 0;\n\n  uint8_t str_end_character = context_p->source_p[0];\n  const uint8_t *source_p = context_p->source_p + 1;\n  const uint8_t *string_start_p = source_p;\n  const uint8_t *source_end_p = context_p->source_end_p;\n  parser_line_counter_t line = context_p->line;\n  parser_line_counter_t column = (parser_line_counter_t) (context_p->column + 1);\n  parser_line_counter_t original_line = line;\n  parser_line_counter_t original_column = column;\n  size_t length = 0;\n  lexer_lit_location_flags_t status_flags = LEXER_LIT_LOCATION_IS_ASCII;\n\n  if (str_end_character == LIT_CHAR_RIGHT_BRACE)\n  {\n    str_end_character = LIT_CHAR_GRAVE_ACCENT;\n  }\n\n  while (true)\n  {\n    if (source_p >= source_end_p)\n    {\n      context_p->token.line = original_line;\n      context_p->token.column = (parser_line_counter_t) (original_column - 1);\n      parser_raise_error (context_p, PARSER_ERR_UNTERMINATED_STRING);\n    }\n\n    if (*source_p == str_end_character)\n    {\n      break;\n    }\n\n    if (*source_p == LIT_CHAR_BACKSLASH)\n    {\n      source_p++;\n      column++;\n      if (source_p >= source_end_p)\n      {\n        /* Will throw an unterminated string error. */\n        continue;\n      }\n\n      status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE;\n\n      /* Newline is ignored. */\n      if (*source_p == LIT_CHAR_CR)\n      {\n        source_p++;\n        if (source_p < source_end_p && *source_p == LIT_CHAR_LF)\n        {\n          raw_length_adjust--;\n          source_p++;\n        }\n\n        line++;\n        column = 1;\n        continue;\n      }\n      else if (*source_p == LIT_CHAR_LF)\n      {\n        source_p++;\n        line++;\n        column = 1;\n        continue;\n      }\n      else if (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p))\n      {\n        source_p += 3;\n        line++;\n        column = 1;\n        continue;\n      }\n\n      if (opts & LEXER_STRING_RAW)\n      {\n        if ((*source_p == LIT_CHAR_GRAVE_ACCENT) || (*source_p == LIT_CHAR_BACKSLASH))\n        {\n          source_p++;\n          column++;\n          length++;\n        }\n        continue;\n      }\n\n      if (*source_p == LIT_CHAR_0 && source_p + 1 < source_end_p\n          && (*(source_p + 1) < LIT_CHAR_0 || *(source_p + 1) > LIT_CHAR_9))\n      {\n        source_p++;\n        column++;\n        length++;\n        continue;\n      }\n\n      /* Except \\x, \\u, and octal numbers, everything is\n       * converted to a character which has the same byte length. */\n      if (*source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_3)\n      {\n        if (str_end_character == LIT_CHAR_GRAVE_ACCENT)\n        {\n          parser_raise_error (context_p, PARSER_ERR_TEMPLATE_STR_OCTAL_ESCAPE);\n        }\n\n        if (context_p->status_flags & PARSER_IS_STRICT)\n        {\n          parser_raise_error (context_p, PARSER_ERR_OCTAL_ESCAPE_NOT_ALLOWED);\n        }\n\n        source_p++;\n        column++;\n\n        if (source_p < source_end_p && *source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_7)\n        {\n          source_p++;\n          column++;\n\n          if (source_p < source_end_p && *source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_7)\n          {\n            /* Numbers >= 0x200 (0x80) requires\n             * two bytes for encoding in UTF-8. */\n            if (source_p[-2] >= LIT_CHAR_2)\n            {\n              length++;\n            }\n\n            source_p++;\n            column++;\n          }\n        }\n\n        length++;\n        continue;\n      }\n\n      if (*source_p >= LIT_CHAR_4 && *source_p <= LIT_CHAR_7)\n      {\n        if (context_p->status_flags & PARSER_IS_STRICT)\n        {\n          parser_raise_error (context_p, PARSER_ERR_OCTAL_ESCAPE_NOT_ALLOWED);\n        }\n\n        source_p++;\n        column++;\n\n        if (source_p < source_end_p && *source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_7)\n        {\n          source_p++;\n          column++;\n        }\n\n        /* The maximum number is 0x4d so the UTF-8\n         * representation is always one byte. */\n        length++;\n        continue;\n      }\n\n      if (*source_p == LIT_CHAR_LOWERCASE_X || *source_p == LIT_CHAR_LOWERCASE_U)\n      {\n        uint32_t escape_length = (*source_p == LIT_CHAR_LOWERCASE_X) ? 3 : 5;\n        lit_code_point_t code_point = UINT32_MAX;\n\n        if (source_p + 4 <= source_end_p && source_p[0] == LIT_CHAR_LOWERCASE_U && source_p[1] == LIT_CHAR_LEFT_BRACE)\n        {\n          code_point = lexer_hex_in_braces_to_code_point (source_p + 2, source_end_p, &escape_length);\n          escape_length--;\n        }\n        else\n        {\n          if (source_p + escape_length <= source_end_p)\n          {\n            code_point = lexer_hex_to_code_point (source_p + 1, escape_length - 1);\n          }\n        }\n\n        if (code_point == UINT32_MAX)\n        {\n          context_p->token.line = line;\n          context_p->token.column = (parser_line_counter_t) (column - 1);\n          parser_raise_error (context_p, PARSER_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE);\n        }\n\n        length += lit_code_point_get_cesu8_length (code_point);\n\n        source_p += escape_length;\n        PARSER_PLUS_EQUAL_LC (column, escape_length);\n        continue;\n      }\n    }\n    else if (str_end_character == LIT_CHAR_GRAVE_ACCENT && source_p[0] == LIT_CHAR_DOLLAR_SIGN\n             && source_p + 1 < source_end_p && source_p[1] == LIT_CHAR_LEFT_BRACE)\n    {\n      raw_length_adjust--;\n      source_p++;\n      break;\n    }\n\n    if (*source_p >= LIT_UTF8_4_BYTE_MARKER)\n    {\n      /* Processing 4 byte unicode sequence (even if it is\n       * after a backslash). Always converted to two 3 byte\n       * long sequence. */\n      length += 2 * 3;\n      status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE;\n      source_p += 4;\n      raw_length_adjust += 2;\n      column++;\n#if JERRY_FUNCTION_TO_STRING\n      context_p->global_status_flags |= ECMA_PARSE_INTERNAL_HAS_4_BYTE_MARKER;\n#endif /* JERRY_FUNCTION_TO_STRING */\n      continue;\n    }\n    else if (*source_p == LIT_CHAR_TAB)\n    {\n      column = align_column_to_tab (column);\n      /* Subtract -1 because column is increased below. */\n      column--;\n    }\n    else if (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p))\n    {\n      source_p += 3;\n      length += 3;\n      line++;\n      column = 1;\n      continue;\n    }\n    else if (str_end_character == LIT_CHAR_GRAVE_ACCENT)\n    {\n      /* Newline (without backslash) is part of the string.\n         Note: ECMAScript v6, 11.8.6.1 <CR> or <CR><LF> are both normalized to <LF> */\n      if (*source_p == LIT_CHAR_CR)\n      {\n        status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE;\n        source_p++;\n        length++;\n        if (source_p < source_end_p && *source_p == LIT_CHAR_LF)\n        {\n          source_p++;\n          raw_length_adjust--;\n        }\n        line++;\n        column = 1;\n        continue;\n      }\n      else if (*source_p == LIT_CHAR_LF)\n      {\n        source_p++;\n        length++;\n        line++;\n        column = 1;\n        continue;\n      }\n    }\n    else if (*source_p == LIT_CHAR_CR || *source_p == LIT_CHAR_LF)\n    {\n      context_p->token.line = line;\n      context_p->token.column = column;\n      parser_raise_error (context_p, PARSER_ERR_NEWLINE_NOT_ALLOWED);\n    }\n\n    source_p++;\n    column++;\n    length++;\n\n    while (source_p < source_end_p && IS_UTF8_INTERMEDIATE_OCTET (*source_p))\n    {\n      source_p++;\n      length++;\n    }\n  }\n\n  if (opts & LEXER_STRING_RAW)\n  {\n    length = (size_t) ((source_p - string_start_p) + raw_length_adjust);\n  }\n\n  if (length > PARSER_MAXIMUM_STRING_LENGTH)\n  {\n    parser_raise_error (context_p, PARSER_ERR_STRING_TOO_LONG);\n  }\n\n  context_p->token.type = ((str_end_character != LIT_CHAR_GRAVE_ACCENT) ? LEXER_LITERAL : LEXER_TEMPLATE_LITERAL);\n\n  /* Fill literal data. */\n  context_p->token.lit_location.char_p = string_start_p;\n  context_p->token.lit_location.length = (prop_length_t) length;\n  context_p->token.lit_location.type = LEXER_STRING_LITERAL;\n  context_p->token.lit_location.status_flags = (uint8_t) status_flags;\n\n  context_p->source_p = source_p + 1;\n  context_p->line = line;\n  context_p->column = (parser_line_counter_t) (column + 1);\n} /* lexer_parse_string */\n\n/**\n * Check number\n */\nstatic void\nlexer_check_numbers (parser_context_t *context_p, /**< context */\n                     const uint8_t **source_p, /**< source_pointer */\n                     const uint8_t *source_end_p, /**< end of the source */\n                     const ecma_char_t digit_max, /**< maximum of the number range */\n                     const bool is_legacy) /**< is legacy octal number  */\n{\n  while (true)\n  {\n    while (*source_p < source_end_p && *source_p[0] >= LIT_CHAR_0 && *source_p[0] <= digit_max)\n    {\n      *source_p += 1;\n    }\n    if (*source_p != source_end_p && *source_p[0] == LIT_CHAR_UNDERSCORE)\n    {\n      *source_p += 1;\n      if (is_legacy || *source_p == source_end_p || *source_p[0] == LIT_CHAR_UNDERSCORE || *source_p[0] > digit_max\n          || *source_p[0] < LIT_CHAR_0)\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);\n      }\n      continue;\n    }\n\n    break;\n  }\n} /* lexer_check_numbers */\n\n/**\n * Parse number.\n */\nstatic void\nlexer_parse_number (parser_context_t *context_p) /**< context */\n{\n  const uint8_t *source_p = context_p->source_p;\n  const uint8_t *source_end_p = context_p->source_end_p;\n  bool can_be_float = false;\n#if JERRY_BUILTIN_BIGINT\n  bool can_be_bigint = true;\n#endif /* JERRY_BUILTIN_BIGINT */\n  size_t length;\n\n  context_p->token.type = LEXER_LITERAL;\n  context_p->token.extra_value = LEXER_NUMBER_DECIMAL;\n  context_p->token.lit_location.char_p = source_p;\n  context_p->token.lit_location.type = LEXER_NUMBER_LITERAL;\n  context_p->token.lit_location.status_flags = LEXER_LIT_LOCATION_IS_ASCII;\n\n  if (source_p[0] == LIT_CHAR_0 && source_p + 1 < source_end_p)\n  {\n    if (source_p[1] == LIT_CHAR_UNDERSCORE)\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);\n    }\n\n    if (LEXER_TO_ASCII_LOWERCASE (source_p[1]) == LIT_CHAR_LOWERCASE_X)\n    {\n      context_p->token.extra_value = LEXER_NUMBER_HEXADECIMAL;\n      source_p += 2;\n\n      if (source_p >= source_end_p || !lit_char_is_hex_digit (source_p[0]))\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_HEX_DIGIT);\n      }\n\n      do\n      {\n        source_p++;\n        if (source_p < source_end_p && source_p[0] == LIT_CHAR_UNDERSCORE)\n        {\n          source_p++;\n          if (source_p == source_end_p || !lit_char_is_hex_digit (source_p[0]))\n          {\n            parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);\n          }\n        }\n      } while (source_p < source_end_p && lit_char_is_hex_digit (source_p[0]));\n    }\n    else if (LEXER_TO_ASCII_LOWERCASE (source_p[1]) == LIT_CHAR_LOWERCASE_O)\n    {\n      context_p->token.extra_value = LEXER_NUMBER_OCTAL;\n      source_p += 2;\n\n      if (source_p >= source_end_p || !lit_char_is_octal_digit (source_p[0]))\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_OCTAL_DIGIT);\n      }\n\n      lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_7, false);\n    }\n    else if (source_p[1] >= LIT_CHAR_0 && source_p[1] <= LIT_CHAR_9)\n    {\n      context_p->token.extra_value = LEXER_NUMBER_OCTAL;\n#if JERRY_BUILTIN_BIGINT\n      can_be_bigint = false;\n#endif /* JERRY_BUILTIN_BIGINT */\n\n      if (context_p->status_flags & PARSER_IS_STRICT)\n      {\n        parser_raise_error (context_p, PARSER_ERR_OCTAL_NUMBER_NOT_ALLOWED);\n      }\n\n      lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_7, true);\n\n      if (source_p < source_end_p && source_p[0] >= LIT_CHAR_8 && source_p[0] <= LIT_CHAR_9)\n      {\n        lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_9, true);\n        context_p->token.extra_value = LEXER_NUMBER_DECIMAL;\n      }\n    }\n\n    else if (LEXER_TO_ASCII_LOWERCASE (source_p[1]) == LIT_CHAR_LOWERCASE_B)\n    {\n      context_p->token.extra_value = LEXER_NUMBER_BINARY;\n      source_p += 2;\n\n      if (source_p >= source_end_p || !lit_char_is_binary_digit (source_p[0]))\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_BIN_DIGIT);\n      }\n\n      do\n      {\n        source_p++;\n        if (source_p < source_end_p && source_p[0] == LIT_CHAR_UNDERSCORE)\n        {\n          source_p++;\n          if (source_p == source_end_p || source_p[0] > LIT_CHAR_9 || source_p[0] < LIT_CHAR_0)\n          {\n            parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);\n          }\n        }\n      } while (source_p < source_end_p && lit_char_is_binary_digit (source_p[0]));\n    }\n    else\n    {\n      can_be_float = true;\n      source_p++;\n    }\n  }\n  else\n  {\n    lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_9, false);\n    can_be_float = true;\n  }\n\n  if (can_be_float)\n  {\n    if (source_p < source_end_p && source_p[0] == LIT_CHAR_DOT)\n    {\n      source_p++;\n#if JERRY_BUILTIN_BIGINT\n      can_be_bigint = false;\n#endif /* JERRY_BUILTIN_BIGINT */\n\n      if (source_p < source_end_p && source_p[0] == LIT_CHAR_UNDERSCORE)\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);\n      }\n\n      lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_9, false);\n    }\n\n    if (source_p < source_end_p && LEXER_TO_ASCII_LOWERCASE (source_p[0]) == LIT_CHAR_LOWERCASE_E)\n    {\n      source_p++;\n#if JERRY_BUILTIN_BIGINT\n      can_be_bigint = false;\n#endif /* JERRY_BUILTIN_BIGINT */\n\n      if (source_p < source_end_p && (source_p[0] == LIT_CHAR_PLUS || source_p[0] == LIT_CHAR_MINUS))\n      {\n        source_p++;\n      }\n\n      if (source_p >= source_end_p || source_p[0] < LIT_CHAR_0 || source_p[0] > LIT_CHAR_9)\n      {\n        parser_raise_error (context_p, PARSER_ERR_MISSING_EXPONENT);\n      }\n\n      lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_9, false);\n    }\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (source_p < source_end_p && source_p[0] == LIT_CHAR_LOWERCASE_N)\n  {\n    if (!can_be_bigint)\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_BIGINT);\n    }\n    context_p->token.extra_value = LEXER_NUMBER_BIGINT;\n    source_p++;\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  length = (size_t) (source_p - context_p->source_p);\n  if (length > PARSER_MAXIMUM_STRING_LENGTH)\n  {\n    parser_raise_error (context_p, PARSER_ERR_NUMBER_TOO_LONG);\n  }\n\n  context_p->token.lit_location.length = (prop_length_t) length;\n  PARSER_PLUS_EQUAL_LC (context_p->column, length);\n  context_p->source_p = source_p;\n\n  if (source_p < source_end_p && lexer_parse_identifier (context_p, LEXER_PARSE_CHECK_START_AND_RETURN))\n  {\n    parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_AFTER_NUMBER);\n  }\n} /* lexer_parse_number */\n\n/**\n * One character long token (e.g. comma).\n *\n * @param char1 character\n * @param type1 type\n */\n#define LEXER_TYPE_A_TOKEN(char1, type1) \\\n  case (uint8_t) (char1):                \\\n  {                                      \\\n    context_p->token.type = (type1);     \\\n    length = 1;                          \\\n    break;                               \\\n  }\n\n/**\n * Token pair, where the first token is prefix of the second (e.g. % and %=).\n *\n * @param char1 first character\n * @param type1 type of the first character\n * @param char2 second character\n * @param type2 type of the second character\n */\n#define LEXER_TYPE_B_TOKEN(char1, type1, char2, type2)              \\\n  case (uint8_t) (char1):                                           \\\n  {                                                                 \\\n    if (length >= 2 && context_p->source_p[1] == (uint8_t) (char2)) \\\n    {                                                               \\\n      context_p->token.type = (type2);                              \\\n      length = 2;                                                   \\\n      break;                                                        \\\n    }                                                               \\\n                                                                    \\\n    context_p->token.type = (type1);                                \\\n    length = 1;                                                     \\\n    break;                                                          \\\n  }\n\n/**\n * Three tokens, where the first is the prefix of the other two (e.g. &, &&, &=).\n *\n * @param char1 first character\n * @param type1 type of the first character\n * @param char2 second character\n * @param type2 type of the second character\n * @param char3 third character\n * @param type3 type of the third character\n */\n#define LEXER_TYPE_C_TOKEN(char1, type1, char2, type2, char3, type3) \\\n  case (uint8_t) (char1):                                            \\\n  {                                                                  \\\n    if (length >= 2)                                                 \\\n    {                                                                \\\n      if (context_p->source_p[1] == (uint8_t) (char2))               \\\n      {                                                              \\\n        context_p->token.type = (type2);                             \\\n        length = 2;                                                  \\\n        break;                                                       \\\n      }                                                              \\\n                                                                     \\\n      if (context_p->source_p[1] == (uint8_t) (char3))               \\\n      {                                                              \\\n        context_p->token.type = (type3);                             \\\n        length = 2;                                                  \\\n        break;                                                       \\\n      }                                                              \\\n    }                                                                \\\n                                                                     \\\n    context_p->token.type = (type1);                                 \\\n    length = 1;                                                      \\\n    break;                                                           \\\n  }\n\n/**\n * Four tokens, where the first is the prefix of the other three\n * and the second is prefix of the fourth (e.g. &, &&, &=, &&= ).\n *\n * @param char1 first character\n * @param type1 type of the first character\n * @param char2 second character\n * @param type2 type of the second character\n * @param char3 third character\n * @param type3 type of the third character\n * @param char4 fourth character\n * @param type4 type of the fourth character\n */\n#define LEXER_TYPE_D_TOKEN(char1, type1, char2, type2, char3, type3, char4, type4) \\\n  case (uint8_t) (char1):                                                          \\\n  {                                                                                \\\n    if (length >= 2)                                                               \\\n    {                                                                              \\\n      if (context_p->source_p[1] == (uint8_t) (char2))                             \\\n      {                                                                            \\\n        context_p->token.type = (type2);                                           \\\n        length = 2;                                                                \\\n        break;                                                                     \\\n      }                                                                            \\\n                                                                                   \\\n      if (context_p->source_p[1] == (uint8_t) (char3))                             \\\n      {                                                                            \\\n        if (length >= 3 && context_p->source_p[2] == (uint8_t) (char4))            \\\n        {                                                                          \\\n          context_p->token.type = (type4);                                         \\\n          length = 3;                                                              \\\n          break;                                                                   \\\n        }                                                                          \\\n        context_p->token.type = (type3);                                           \\\n        length = 2;                                                                \\\n        break;                                                                     \\\n      }                                                                            \\\n    }                                                                              \\\n                                                                                   \\\n    context_p->token.type = (type1);                                               \\\n    length = 1;                                                                    \\\n    break;                                                                         \\\n  }\n\n/**\n * Get next token.\n */\nvoid\nlexer_next_token (parser_context_t *context_p) /**< context */\n{\n  size_t length;\n\n#if JERRY_FUNCTION_TO_STRING\n  /* Needed by arrow functions with expression body */\n  context_p->function_end_p = context_p->source_p;\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n  lexer_skip_spaces (context_p);\n\n  context_p->token.keyword_type = LEXER_EOS;\n  context_p->token.line = context_p->line;\n  context_p->token.column = context_p->column;\n\n  length = (size_t) (context_p->source_end_p - context_p->source_p);\n  if (length == 0)\n  {\n    context_p->token.type = LEXER_EOS;\n    return;\n  }\n\n  if (lexer_parse_identifier (context_p, LEXER_PARSE_CHECK_KEYWORDS))\n  {\n    return;\n  }\n\n  if (context_p->source_p[0] >= LIT_CHAR_0 && context_p->source_p[0] <= LIT_CHAR_9)\n  {\n    lexer_parse_number (context_p);\n    return;\n  }\n\n  switch (context_p->source_p[0])\n  {\n    LEXER_TYPE_A_TOKEN (LIT_CHAR_LEFT_BRACE, LEXER_LEFT_BRACE);\n    LEXER_TYPE_A_TOKEN (LIT_CHAR_LEFT_PAREN, LEXER_LEFT_PAREN);\n    LEXER_TYPE_A_TOKEN (LIT_CHAR_LEFT_SQUARE, LEXER_LEFT_SQUARE);\n    LEXER_TYPE_A_TOKEN (LIT_CHAR_RIGHT_BRACE, LEXER_RIGHT_BRACE);\n    LEXER_TYPE_A_TOKEN (LIT_CHAR_RIGHT_PAREN, LEXER_RIGHT_PAREN);\n    LEXER_TYPE_A_TOKEN (LIT_CHAR_RIGHT_SQUARE, LEXER_RIGHT_SQUARE);\n    LEXER_TYPE_A_TOKEN (LIT_CHAR_SEMICOLON, LEXER_SEMICOLON);\n    LEXER_TYPE_A_TOKEN (LIT_CHAR_COMMA, LEXER_COMMA);\n    LEXER_TYPE_A_TOKEN (LIT_CHAR_HASHMARK, LEXER_HASHMARK);\n\n    case (uint8_t) LIT_CHAR_DOT:\n    {\n      if (length >= 2 && (context_p->source_p[1] >= LIT_CHAR_0 && context_p->source_p[1] <= LIT_CHAR_9))\n      {\n        lexer_parse_number (context_p);\n        return;\n      }\n\n      if (length >= 3 && context_p->source_p[1] == LIT_CHAR_DOT && context_p->source_p[2] == LIT_CHAR_DOT)\n      {\n        context_p->token.type = LEXER_THREE_DOTS;\n        length = 3;\n        break;\n      }\n\n      context_p->token.type = LEXER_DOT;\n      length = 1;\n      break;\n    }\n\n    case (uint8_t) LIT_CHAR_LESS_THAN:\n    {\n      if (length >= 2)\n      {\n        if (context_p->source_p[1] == (uint8_t) LIT_CHAR_EQUALS)\n        {\n          context_p->token.type = LEXER_LESS_EQUAL;\n          length = 2;\n          break;\n        }\n\n        if (context_p->source_p[1] == (uint8_t) LIT_CHAR_LESS_THAN)\n        {\n          if (length >= 3 && context_p->source_p[2] == (uint8_t) LIT_CHAR_EQUALS)\n          {\n            context_p->token.type = LEXER_ASSIGN_LEFT_SHIFT;\n            length = 3;\n            break;\n          }\n\n          context_p->token.type = LEXER_LEFT_SHIFT;\n          length = 2;\n          break;\n        }\n      }\n\n      context_p->token.type = LEXER_LESS;\n      length = 1;\n      break;\n    }\n\n    case (uint8_t) LIT_CHAR_GREATER_THAN:\n    {\n      if (length >= 2)\n      {\n        if (context_p->source_p[1] == (uint8_t) LIT_CHAR_EQUALS)\n        {\n          context_p->token.type = LEXER_GREATER_EQUAL;\n          length = 2;\n          break;\n        }\n\n        if (context_p->source_p[1] == (uint8_t) LIT_CHAR_GREATER_THAN)\n        {\n          if (length >= 3)\n          {\n            if (context_p->source_p[2] == (uint8_t) LIT_CHAR_EQUALS)\n            {\n              context_p->token.type = LEXER_ASSIGN_RIGHT_SHIFT;\n              length = 3;\n              break;\n            }\n\n            if (context_p->source_p[2] == (uint8_t) LIT_CHAR_GREATER_THAN)\n            {\n              if (length >= 4 && context_p->source_p[3] == (uint8_t) LIT_CHAR_EQUALS)\n              {\n                context_p->token.type = LEXER_ASSIGN_UNS_RIGHT_SHIFT;\n                length = 4;\n                break;\n              }\n\n              context_p->token.type = LEXER_UNS_RIGHT_SHIFT;\n              length = 3;\n              break;\n            }\n          }\n\n          context_p->token.type = LEXER_RIGHT_SHIFT;\n          length = 2;\n          break;\n        }\n      }\n\n      context_p->token.type = LEXER_GREATER;\n      length = 1;\n      break;\n    }\n\n    case (uint8_t) LIT_CHAR_EQUALS:\n    {\n      if (length >= 2)\n      {\n        if (context_p->source_p[1] == (uint8_t) LIT_CHAR_EQUALS)\n        {\n          if (length >= 3 && context_p->source_p[2] == (uint8_t) LIT_CHAR_EQUALS)\n          {\n            context_p->token.type = LEXER_STRICT_EQUAL;\n            length = 3;\n            break;\n          }\n\n          context_p->token.type = LEXER_EQUAL;\n          length = 2;\n          break;\n        }\n\n        if (context_p->source_p[1] == (uint8_t) LIT_CHAR_GREATER_THAN)\n        {\n          context_p->token.type = LEXER_ARROW;\n          length = 2;\n          break;\n        }\n      }\n\n      context_p->token.type = LEXER_ASSIGN;\n      length = 1;\n      break;\n    }\n\n    case (uint8_t) LIT_CHAR_EXCLAMATION:\n    {\n      if (length >= 2 && context_p->source_p[1] == (uint8_t) LIT_CHAR_EQUALS)\n      {\n        if (length >= 3 && context_p->source_p[2] == (uint8_t) LIT_CHAR_EQUALS)\n        {\n          context_p->token.type = LEXER_STRICT_NOT_EQUAL;\n          length = 3;\n          break;\n        }\n\n        context_p->token.type = LEXER_NOT_EQUAL;\n        length = 2;\n        break;\n      }\n\n      context_p->token.type = LEXER_LOGICAL_NOT;\n      length = 1;\n      break;\n    }\n\n      LEXER_TYPE_C_TOKEN (LIT_CHAR_PLUS, LEXER_ADD, LIT_CHAR_EQUALS, LEXER_ASSIGN_ADD, LIT_CHAR_PLUS, LEXER_INCREASE)\n      LEXER_TYPE_C_TOKEN (LIT_CHAR_MINUS,\n                          LEXER_SUBTRACT,\n                          LIT_CHAR_EQUALS,\n                          LEXER_ASSIGN_SUBTRACT,\n                          LIT_CHAR_MINUS,\n                          LEXER_DECREASE)\n\n    case (uint8_t) LIT_CHAR_ASTERISK:\n    {\n      if (length >= 2)\n      {\n        if (context_p->source_p[1] == (uint8_t) LIT_CHAR_EQUALS)\n        {\n          context_p->token.type = LEXER_ASSIGN_MULTIPLY;\n          length = 2;\n          break;\n        }\n\n        if (context_p->source_p[1] == (uint8_t) LIT_CHAR_ASTERISK)\n        {\n          if (length >= 3 && context_p->source_p[2] == (uint8_t) LIT_CHAR_EQUALS)\n          {\n            context_p->token.type = LEXER_ASSIGN_EXPONENTIATION;\n            length = 3;\n            break;\n          }\n\n          context_p->token.type = LEXER_EXPONENTIATION;\n          length = 2;\n          break;\n        }\n      }\n\n      context_p->token.type = LEXER_MULTIPLY;\n      length = 1;\n      break;\n    }\n\n      LEXER_TYPE_B_TOKEN (LIT_CHAR_SLASH, LEXER_DIVIDE, LIT_CHAR_EQUALS, LEXER_ASSIGN_DIVIDE)\n      LEXER_TYPE_B_TOKEN (LIT_CHAR_PERCENT, LEXER_MODULO, LIT_CHAR_EQUALS, LEXER_ASSIGN_MODULO)\n\n      LEXER_TYPE_D_TOKEN (LIT_CHAR_AMPERSAND,\n                          LEXER_BIT_AND,\n                          LIT_CHAR_EQUALS,\n                          LEXER_ASSIGN_BIT_AND,\n                          LIT_CHAR_AMPERSAND,\n                          LEXER_LOGICAL_AND,\n                          LIT_CHAR_EQUALS,\n                          LEXER_ASSIGN_LOGICAL_AND)\n      LEXER_TYPE_D_TOKEN (LIT_CHAR_VLINE,\n                          LEXER_BIT_OR,\n                          LIT_CHAR_EQUALS,\n                          LEXER_ASSIGN_BIT_OR,\n                          LIT_CHAR_VLINE,\n                          LEXER_LOGICAL_OR,\n                          LIT_CHAR_EQUALS,\n                          LEXER_ASSIGN_LOGICAL_OR)\n\n      LEXER_TYPE_B_TOKEN (LIT_CHAR_CIRCUMFLEX, LEXER_BIT_XOR, LIT_CHAR_EQUALS, LEXER_ASSIGN_BIT_XOR)\n\n      LEXER_TYPE_A_TOKEN (LIT_CHAR_TILDE, LEXER_BIT_NOT);\n    case (uint8_t) (LIT_CHAR_QUESTION):\n    {\n      if (length >= 2)\n      {\n        if (context_p->source_p[1] == (uint8_t) LIT_CHAR_QUESTION)\n        {\n          if (length >= 3 && context_p->source_p[2] == (uint8_t) LIT_CHAR_EQUALS)\n          {\n            context_p->token.type = LEXER_ASSIGN_NULLISH_COALESCING;\n            length = 3;\n            break;\n          }\n          context_p->token.type = LEXER_NULLISH_COALESCING;\n          length = 2;\n          break;\n        }\n        if (context_p->source_p[1] == (uint8_t) LIT_CHAR_DOT\n            && (length < 3 || !lit_char_is_decimal_digit (context_p->source_p[2])))\n        {\n          context_p->token.type = LEXER_QUESTION_MARK_DOT;\n          length = 2;\n          break;\n        }\n      }\n\n      context_p->token.type = LEXER_QUESTION_MARK;\n      length = 1;\n      break;\n    }\n\n      LEXER_TYPE_A_TOKEN (LIT_CHAR_COLON, LEXER_COLON);\n\n    case LIT_CHAR_SINGLE_QUOTE:\n    case LIT_CHAR_DOUBLE_QUOTE:\n    case LIT_CHAR_GRAVE_ACCENT:\n    {\n      lexer_parse_string (context_p, LEXER_STRING_NO_OPTS);\n      return;\n    }\n\n    default:\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_CHARACTER);\n    }\n  }\n\n  context_p->source_p += length;\n  PARSER_PLUS_EQUAL_LC (context_p->column, length);\n} /* lexer_next_token */\n\n#undef LEXER_TYPE_A_TOKEN\n#undef LEXER_TYPE_B_TOKEN\n#undef LEXER_TYPE_C_TOKEN\n#undef LEXER_TYPE_D_TOKEN\n\n/**\n * Checks whether the next token starts with the specified character.\n *\n * @return true - if the next is the specified character\n *         false - otherwise\n */\nbool\nlexer_check_next_character (parser_context_t *context_p, /**< context */\n                            lit_utf8_byte_t character) /**< specified character */\n{\n  if (!(context_p->token.flags & LEXER_NO_SKIP_SPACES))\n  {\n    lexer_skip_spaces (context_p);\n    context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);\n  }\n\n  return (context_p->source_p < context_p->source_end_p && context_p->source_p[0] == (uint8_t) character);\n} /* lexer_check_next_character */\n\n/**\n * Checks whether the next token starts with either specified characters.\n *\n * @return true - if the next is the specified character\n *         false - otherwise\n */\nbool\nlexer_check_next_characters (parser_context_t *context_p, /**< context */\n                             lit_utf8_byte_t character1, /**< first alternative character */\n                             lit_utf8_byte_t character2) /**< second alternative character */\n{\n  if (!(context_p->token.flags & LEXER_NO_SKIP_SPACES))\n  {\n    lexer_skip_spaces (context_p);\n    context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);\n  }\n\n  return (context_p->source_p < context_p->source_end_p\n          && (context_p->source_p[0] == (uint8_t) character1 || context_p->source_p[0] == (uint8_t) character2));\n} /* lexer_check_next_characters */\n\n/**\n * Consumes the next character. The character cannot be a white space.\n *\n * @return consumed character\n */\nextern inline uint8_t JERRY_ATTR_ALWAYS_INLINE\nlexer_consume_next_character (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->source_p < context_p->source_end_p);\n\n  context_p->token.flags &= (uint8_t) ~LEXER_NO_SKIP_SPACES;\n\n  PARSER_PLUS_EQUAL_LC (context_p->column, 1);\n  return *context_p->source_p++;\n} /* lexer_consume_next_character */\n\n/**\n * Checks whether the next character can be the start of a post primary expression\n *\n * Note:\n *     the result is not precise, but this inprecise result\n *     has no side effects for negating number literals\n *\n * @return true if the next character can be the start of a post primary expression\n */\nbool\nlexer_check_post_primary_exp (parser_context_t *context_p) /**< context */\n{\n  if (!(context_p->token.flags & LEXER_NO_SKIP_SPACES))\n  {\n    lexer_skip_spaces (context_p);\n    context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);\n  }\n\n  if (context_p->source_p >= context_p->source_end_p)\n  {\n    return false;\n  }\n\n  switch (context_p->source_p[0])\n  {\n    case LIT_CHAR_DOT:\n    case LIT_CHAR_LEFT_PAREN:\n    case LIT_CHAR_LEFT_SQUARE:\n    case LIT_CHAR_GRAVE_ACCENT:\n    {\n      return true;\n    }\n    case LIT_CHAR_PLUS:\n    case LIT_CHAR_MINUS:\n    {\n      return (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->source_p + 1 < context_p->source_end_p\n              && context_p->source_p[1] == context_p->source_p[0]);\n    }\n    case LIT_CHAR_ASTERISK:\n    {\n      return (context_p->source_p + 1 < context_p->source_end_p\n              && context_p->source_p[1] == (uint8_t) LIT_CHAR_ASTERISK);\n    }\n  }\n\n  return false;\n} /* lexer_check_post_primary_exp */\n\n/**\n * Checks whether the next token is a type used for detecting arrow functions.\n *\n * @return true if the next token is an arrow token\n */\nbool\nlexer_check_arrow (parser_context_t *context_p) /**< context */\n{\n  if (!(context_p->token.flags & LEXER_NO_SKIP_SPACES))\n  {\n    lexer_skip_spaces (context_p);\n    context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);\n  }\n\n  return (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->source_p + 2 <= context_p->source_end_p\n          && context_p->source_p[0] == (uint8_t) LIT_CHAR_EQUALS\n          && context_p->source_p[1] == (uint8_t) LIT_CHAR_GREATER_THAN);\n} /* lexer_check_arrow */\n\n/**\n * Checks whether the next token is a comma or equal sign.\n *\n * @return true if the next token is a comma or equal sign\n */\nbool\nlexer_check_arrow_param (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.flags & LEXER_NO_SKIP_SPACES);\n\n  if (context_p->source_p >= context_p->source_end_p)\n  {\n    return false;\n  }\n\n  if (context_p->source_p[0] == LIT_CHAR_COMMA)\n  {\n    return true;\n  }\n\n  if (context_p->source_p[0] != LIT_CHAR_EQUALS)\n  {\n    return false;\n  }\n\n  return (context_p->source_p + 1 >= context_p->source_end_p || context_p->source_p[1] != LIT_CHAR_EQUALS);\n} /* lexer_check_arrow_param */\n\n/**\n * Checks whether the yield expression has no argument.\n *\n * @return true if it has no argument\n */\nbool\nlexer_check_yield_no_arg (parser_context_t *context_p) /**< context */\n{\n  if (context_p->token.flags & LEXER_WAS_NEWLINE)\n  {\n    return true;\n  }\n\n  switch (context_p->token.type)\n  {\n    case LEXER_RIGHT_BRACE:\n    case LEXER_RIGHT_PAREN:\n    case LEXER_RIGHT_SQUARE:\n    case LEXER_COMMA:\n    case LEXER_COLON:\n    case LEXER_SEMICOLON:\n    case LEXER_EOS:\n    {\n      return true;\n    }\n    default:\n    {\n      return false;\n    }\n  }\n} /* lexer_check_yield_no_arg */\n\n/**\n * Checks whether the next token is a multiply and consumes it.\n *\n * @return true if the next token is a multiply\n */\nbool\nlexer_consume_generator (parser_context_t *context_p) /**< context */\n{\n  if (!(context_p->token.flags & LEXER_NO_SKIP_SPACES))\n  {\n    lexer_skip_spaces (context_p);\n    context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);\n  }\n\n  if (context_p->source_p >= context_p->source_end_p || context_p->source_p[0] != LIT_CHAR_ASTERISK\n      || (context_p->source_p + 1 < context_p->source_end_p\n          && (context_p->source_p[1] == LIT_CHAR_EQUALS || context_p->source_p[1] == LIT_CHAR_ASTERISK)))\n  {\n    return false;\n  }\n\n  lexer_consume_next_character (context_p);\n  context_p->token.type = LEXER_MULTIPLY;\n  return true;\n} /* lexer_consume_generator */\n\n/**\n * Checks whether the next token is an equal sign and consumes it.\n *\n * @return true if the next token is an equal sign\n */\nbool\nlexer_consume_assign (parser_context_t *context_p) /**< context */\n{\n  if (!(context_p->token.flags & LEXER_NO_SKIP_SPACES))\n  {\n    lexer_skip_spaces (context_p);\n    context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);\n  }\n\n  if (context_p->source_p >= context_p->source_end_p || context_p->source_p[0] != LIT_CHAR_EQUALS\n      || (context_p->source_p + 1 < context_p->source_end_p\n          && (context_p->source_p[1] == LIT_CHAR_EQUALS || context_p->source_p[1] == LIT_CHAR_GREATER_THAN)))\n  {\n    return false;\n  }\n\n  lexer_consume_next_character (context_p);\n  context_p->token.type = LEXER_ASSIGN;\n  return true;\n} /* lexer_consume_assign */\n\n/**\n * Update await / yield keywords after an arrow function with expression.\n */\nvoid\nlexer_update_await_yield (parser_context_t *context_p, /**< context */\n                          uint32_t status_flags) /**< parser status flags after restore */\n{\n  if (!(status_flags & PARSER_IS_STRICT))\n  {\n    if (status_flags & PARSER_IS_GENERATOR_FUNCTION)\n    {\n      if (context_p->token.type == LEXER_LITERAL && context_p->token.keyword_type == LEXER_KEYW_YIELD)\n      {\n        context_p->token.type = LEXER_KEYW_YIELD;\n      }\n    }\n    else\n    {\n      if (context_p->token.type == LEXER_KEYW_YIELD)\n      {\n        JERRY_ASSERT (context_p->token.keyword_type == LEXER_KEYW_YIELD);\n        context_p->token.type = LEXER_LITERAL;\n      }\n    }\n  }\n\n  if (!(context_p->global_status_flags & ECMA_PARSE_MODULE))\n  {\n    if (status_flags & PARSER_IS_ASYNC_FUNCTION)\n    {\n      if (context_p->token.type == LEXER_LITERAL && context_p->token.keyword_type == LEXER_KEYW_AWAIT)\n      {\n        context_p->token.type = LEXER_KEYW_AWAIT;\n      }\n    }\n    else\n    {\n      if (context_p->token.type == LEXER_KEYW_AWAIT)\n      {\n        JERRY_ASSERT (context_p->token.keyword_type == LEXER_KEYW_AWAIT);\n        context_p->token.type = LEXER_LITERAL;\n      }\n    }\n  }\n} /* lexer_update_await_yield */\n\n/**\n * Read next token without skipping whitespaces and checking keywords\n *\n * @return true if the next literal is private identifier, false otherwise\n */\nbool\nlexer_scan_private_identifier (parser_context_t *context_p) /**< context */\n{\n  context_p->token.keyword_type = LEXER_EOS;\n  context_p->token.line = context_p->line;\n  context_p->token.column = context_p->column;\n\n  return (context_p->source_p < context_p->source_end_p && lexer_parse_identifier (context_p, LEXER_PARSE_NO_OPTS));\n} /* lexer_scan_private_identifier */\n\n/**\n * Convert an ident with escapes to a utf8 string.\n */\nvoid\nlexer_convert_ident_to_cesu8 (uint8_t *destination_p, /**< destination string */\n                              const uint8_t *source_p, /**< source string */\n                              prop_length_t length) /**< length of destination string */\n{\n  const uint8_t *destination_end_p = destination_p + length;\n\n  JERRY_ASSERT (length <= PARSER_MAXIMUM_IDENT_LENGTH);\n\n  do\n  {\n    if (*source_p == LIT_CHAR_BACKSLASH)\n    {\n      source_p += 2;\n      destination_p += lit_code_point_to_cesu8_bytes (destination_p, lexer_unchecked_hex_to_character (&source_p));\n      continue;\n    }\n\n    if (*source_p >= LIT_UTF8_4_BYTE_MARKER)\n    {\n      lit_four_byte_utf8_char_to_cesu8 (destination_p, source_p);\n\n      destination_p += 6;\n      source_p += 4;\n      continue;\n    }\n\n    *destination_p++ = *source_p++;\n  } while (destination_p < destination_end_p);\n} /* lexer_convert_ident_to_cesu8 */\n\n/**\n * Convert literal to character sequence\n */\nconst uint8_t *\nlexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */\n                                const lexer_lit_location_t *literal_p, /**< literal location */\n                                uint8_t *local_byte_array_p, /**< local byte array to store chars */\n                                lexer_string_options_t opts) /**< options */\n{\n  JERRY_ASSERT (context_p->u.allocated_buffer_p == NULL);\n\n  if (!(literal_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))\n  {\n    return literal_p->char_p;\n  }\n\n  uint8_t *destination_start_p;\n  if (literal_p->length > LEXER_MAX_LITERAL_LOCAL_BUFFER_SIZE)\n  {\n    context_p->u.allocated_buffer_p = (uint8_t *) parser_malloc_local (context_p, literal_p->length);\n    context_p->allocated_buffer_size = literal_p->length;\n    destination_start_p = context_p->u.allocated_buffer_p;\n  }\n  else\n  {\n    destination_start_p = local_byte_array_p;\n  }\n\n  if (literal_p->type == LEXER_IDENT_LITERAL)\n  {\n    lexer_convert_ident_to_cesu8 (destination_start_p, literal_p->char_p, literal_p->length);\n    return destination_start_p;\n  }\n\n  const uint8_t *source_p = literal_p->char_p;\n  uint8_t *destination_p = destination_start_p;\n\n  uint8_t str_end_character = source_p[-1];\n\n  if (str_end_character == LIT_CHAR_RIGHT_BRACE)\n  {\n    str_end_character = LIT_CHAR_GRAVE_ACCENT;\n  }\n\n  bool is_raw = (opts & LEXER_STRING_RAW) != 0;\n\n  while (true)\n  {\n    if (*source_p == str_end_character)\n    {\n      break;\n    }\n\n    if (*source_p == LIT_CHAR_BACKSLASH && !is_raw)\n    {\n      uint8_t conv_character;\n\n      source_p++;\n      JERRY_ASSERT (source_p < context_p->source_end_p);\n\n      /* Newline is ignored. */\n      if (*source_p == LIT_CHAR_CR)\n      {\n        source_p++;\n        JERRY_ASSERT (source_p < context_p->source_end_p);\n\n        if (*source_p == LIT_CHAR_LF)\n        {\n          source_p++;\n        }\n        continue;\n      }\n      else if (*source_p == LIT_CHAR_LF)\n      {\n        source_p++;\n        continue;\n      }\n      else if (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p))\n      {\n        source_p += 3;\n        continue;\n      }\n\n      if (*source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_3)\n      {\n        lit_code_point_t octal_number = (uint32_t) (*source_p - LIT_CHAR_0);\n\n        source_p++;\n        JERRY_ASSERT (source_p < context_p->source_end_p);\n\n        if (*source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_7)\n        {\n          octal_number = octal_number * 8 + (uint32_t) (*source_p - LIT_CHAR_0);\n          source_p++;\n          JERRY_ASSERT (source_p < context_p->source_end_p);\n\n          if (*source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_7)\n          {\n            octal_number = octal_number * 8 + (uint32_t) (*source_p - LIT_CHAR_0);\n            source_p++;\n            JERRY_ASSERT (source_p < context_p->source_end_p);\n          }\n        }\n\n        destination_p += lit_code_point_to_cesu8_bytes (destination_p, octal_number);\n        continue;\n      }\n\n      if (*source_p >= LIT_CHAR_4 && *source_p <= LIT_CHAR_7)\n      {\n        uint32_t octal_number = (uint32_t) (*source_p - LIT_CHAR_0);\n\n        source_p++;\n        JERRY_ASSERT (source_p < context_p->source_end_p);\n\n        if (*source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_7)\n        {\n          octal_number = octal_number * 8 + (uint32_t) (*source_p - LIT_CHAR_0);\n          source_p++;\n          JERRY_ASSERT (source_p < context_p->source_end_p);\n        }\n\n        *destination_p++ = (uint8_t) octal_number;\n        continue;\n      }\n\n      if (*source_p == LIT_CHAR_LOWERCASE_X || *source_p == LIT_CHAR_LOWERCASE_U)\n      {\n        source_p++;\n        destination_p += lit_code_point_to_cesu8_bytes (destination_p, lexer_unchecked_hex_to_character (&source_p));\n        continue;\n      }\n\n      conv_character = *source_p;\n      switch (*source_p)\n      {\n        case LIT_CHAR_LOWERCASE_B:\n        {\n          conv_character = 0x08;\n          break;\n        }\n        case LIT_CHAR_LOWERCASE_T:\n        {\n          conv_character = 0x09;\n          break;\n        }\n        case LIT_CHAR_LOWERCASE_N:\n        {\n          conv_character = 0x0a;\n          break;\n        }\n        case LIT_CHAR_LOWERCASE_V:\n        {\n          conv_character = 0x0b;\n          break;\n        }\n        case LIT_CHAR_LOWERCASE_F:\n        {\n          conv_character = 0x0c;\n          break;\n        }\n        case LIT_CHAR_LOWERCASE_R:\n        {\n          conv_character = 0x0d;\n          break;\n        }\n      }\n\n      if (conv_character != *source_p)\n      {\n        *destination_p++ = conv_character;\n        source_p++;\n        continue;\n      }\n    }\n    else if (str_end_character == LIT_CHAR_GRAVE_ACCENT)\n    {\n      if (source_p[0] == LIT_CHAR_DOLLAR_SIGN && source_p[1] == LIT_CHAR_LEFT_BRACE)\n      {\n        source_p++;\n        JERRY_ASSERT (source_p < context_p->source_end_p);\n        break;\n      }\n      if (*source_p == LIT_CHAR_CR)\n      {\n        *destination_p++ = LIT_CHAR_LF;\n        source_p++;\n        if (*source_p != str_end_character && *source_p == LIT_CHAR_LF)\n        {\n          source_p++;\n        }\n        continue;\n      }\n      if ((*source_p == LIT_CHAR_BACKSLASH) && is_raw)\n      {\n        JERRY_ASSERT (source_p + 1 < context_p->source_end_p);\n        if ((*(source_p + 1) == LIT_CHAR_GRAVE_ACCENT) || (*(source_p + 1) == LIT_CHAR_BACKSLASH))\n        {\n          *destination_p++ = *source_p++;\n          *destination_p++ = *source_p++;\n          continue;\n        }\n      }\n    }\n\n    if (*source_p >= LIT_UTF8_4_BYTE_MARKER)\n    {\n      /* Processing 4 byte unicode sequence (even if it is\n       * after a backslash). Always converted to two 3 byte\n       * long sequence. */\n      lit_four_byte_utf8_char_to_cesu8 (destination_p, source_p);\n\n      destination_p += 6;\n      source_p += 4;\n      continue;\n    }\n\n    *destination_p++ = *source_p++;\n\n    /* There is no need to check the source_end_p\n     * since the string is terminated by a quotation mark. */\n    while (IS_UTF8_INTERMEDIATE_OCTET (*source_p))\n    {\n      *destination_p++ = *source_p++;\n    }\n  }\n\n  JERRY_ASSERT (destination_p == destination_start_p + literal_p->length);\n\n  return destination_start_p;\n} /* lexer_convert_literal_to_chars */\n\n/**\n * Construct an unused literal.\n *\n * @return a newly allocated literal\n */\nlexer_literal_t *\nlexer_construct_unused_literal (parser_context_t *context_p) /**< context */\n{\n  lexer_literal_t *literal_p;\n\n  if (context_p->literal_count >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n  {\n    parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n  }\n\n  literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n  literal_p->type = LEXER_UNUSED_LITERAL;\n  literal_p->status_flags = 0;\n  return literal_p;\n} /* lexer_construct_unused_literal */\n\n/**\n * Construct a literal object from an identifier.\n */\nvoid\nlexer_construct_literal_object (parser_context_t *context_p, /**< context */\n                                const lexer_lit_location_t *lit_location_p, /**< literal location */\n                                uint8_t literal_type) /**< final literal type */\n{\n  uint8_t local_byte_array[LEXER_MAX_LITERAL_LOCAL_BUFFER_SIZE];\n\n  const uint8_t *char_p =\n    lexer_convert_literal_to_chars (context_p, lit_location_p, local_byte_array, LEXER_STRING_NO_OPTS);\n\n  size_t length = lit_location_p->length;\n  parser_list_iterator_t literal_iterator;\n  lexer_literal_t *literal_p;\n  uint32_t literal_index = 0;\n  bool search_scope_stack = (literal_type == LEXER_IDENT_LITERAL);\n\n  if (JERRY_UNLIKELY (literal_type == LEXER_NEW_IDENT_LITERAL))\n  {\n    literal_type = LEXER_IDENT_LITERAL;\n  }\n\n  JERRY_ASSERT (literal_type == LEXER_IDENT_LITERAL || literal_type == LEXER_STRING_LITERAL);\n\n  JERRY_ASSERT (literal_type != LEXER_IDENT_LITERAL || length <= PARSER_MAXIMUM_IDENT_LENGTH);\n  JERRY_ASSERT (literal_type != LEXER_STRING_LITERAL || length <= PARSER_MAXIMUM_STRING_LENGTH);\n\n  parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n  while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n  {\n    if (literal_p->type == literal_type && literal_p->prop.length == length\n        && memcmp (literal_p->u.char_p, char_p, length) == 0)\n    {\n      context_p->lit_object.literal_p = literal_p;\n      context_p->lit_object.index = (uint16_t) literal_index;\n\n      parser_free_allocated_buffer (context_p);\n\n      if (search_scope_stack)\n      {\n        parser_scope_stack_t *scope_stack_start_p = context_p->scope_stack_p;\n        parser_scope_stack_t *scope_stack_p = scope_stack_start_p + context_p->scope_stack_top;\n\n        while (scope_stack_p > scope_stack_start_p)\n        {\n          scope_stack_p--;\n\n          if (scope_stack_p->map_from == literal_index)\n          {\n            JERRY_ASSERT (scanner_decode_map_to (scope_stack_p) >= PARSER_REGISTER_START\n                          || (literal_p->status_flags & LEXER_FLAG_USED));\n            context_p->lit_object.index = scanner_decode_map_to (scope_stack_p);\n            return;\n          }\n        }\n\n        literal_p->status_flags |= LEXER_FLAG_USED;\n      }\n      return;\n    }\n\n    literal_index++;\n  }\n\n  JERRY_ASSERT (literal_index == context_p->literal_count);\n\n  if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n  {\n    parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n  }\n\n  literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n  literal_p->prop.length = (prop_length_t) length;\n  literal_p->type = literal_type;\n\n  uint8_t status_flags = LEXER_FLAG_SOURCE_PTR;\n\n  if (length > 0 && char_p == local_byte_array)\n  {\n    literal_p->u.char_p = (uint8_t *) jmem_heap_alloc_block (length);\n    memcpy ((uint8_t *) literal_p->u.char_p, char_p, length);\n    status_flags = 0;\n  }\n  else\n  {\n    literal_p->u.char_p = char_p;\n\n    /* Buffer is taken over when a new literal is constructed. */\n    if (context_p->u.allocated_buffer_p != NULL)\n    {\n      JERRY_ASSERT (char_p == context_p->u.allocated_buffer_p);\n\n      context_p->u.allocated_buffer_p = NULL;\n      status_flags = 0;\n    }\n  }\n\n  if (search_scope_stack)\n  {\n    status_flags |= LEXER_FLAG_USED;\n  }\n\n  if (lit_location_p->status_flags & LEXER_LIT_LOCATION_IS_ASCII)\n  {\n    literal_p->status_flags |= LEXER_FLAG_ASCII;\n  }\n\n  literal_p->status_flags = status_flags;\n\n  context_p->lit_object.literal_p = literal_p;\n  context_p->lit_object.index = (uint16_t) literal_index;\n  context_p->literal_count++;\n\n  JERRY_ASSERT (context_p->u.allocated_buffer_p == NULL);\n} /* lexer_construct_literal_object */\n\n/**\n * Construct a number object.\n *\n * @return true if number is small number\n */\nbool\nlexer_construct_number_object (parser_context_t *context_p, /**< context */\n                               bool is_expr, /**< expression is parsed */\n                               bool is_negative_number) /**< sign is negative */\n{\n  parser_list_iterator_t literal_iterator;\n  lexer_literal_t *literal_p;\n  ecma_value_t lit_value;\n  uint32_t literal_index = 0;\n  prop_length_t length = context_p->token.lit_location.length;\n\n#if JERRY_BUILTIN_BIGINT\n  if (JERRY_LIKELY (context_p->token.extra_value != LEXER_NUMBER_BIGINT))\n  {\n#endif /* JERRY_BUILTIN_BIGINT */\n    ecma_number_t num;\n    uint32_t options = ECMA_CONVERSION_ALLOW_UNDERSCORE;\n\n    if (context_p->token.extra_value == LEXER_NUMBER_OCTAL)\n    {\n      num = ecma_utf8_string_to_number_by_radix (context_p->token.lit_location.char_p, length, 8, options);\n    }\n    else\n    {\n      num = ecma_utf8_string_to_number (context_p->token.lit_location.char_p, length, options);\n    }\n\n    if (is_expr)\n    {\n      int32_t int_num = (int32_t) num;\n\n      if (int_num == num && int_num <= CBC_PUSH_NUMBER_BYTE_RANGE_END && (int_num != 0 || !is_negative_number))\n      {\n        context_p->lit_object.index = (uint16_t) int_num;\n        return true;\n      }\n    }\n\n    if (is_negative_number)\n    {\n      num = -num;\n    }\n\n    lit_value = ecma_find_or_create_literal_number (num);\n#if JERRY_BUILTIN_BIGINT\n  }\n  else\n  {\n    uint32_t options = (ECMA_BIGINT_PARSE_DISALLOW_SYNTAX_ERROR | ECMA_BIGINT_PARSE_DISALLOW_MEMORY_ERROR\n                        | ECMA_BIGINT_PARSE_ALLOW_UNDERSCORE);\n\n    if (is_negative_number)\n    {\n      options |= ECMA_BIGINT_PARSE_SET_NEGATIVE;\n    }\n\n    JERRY_ASSERT (length >= 2);\n    lit_value =\n      ecma_bigint_parse_string (context_p->token.lit_location.char_p, (lit_utf8_size_t) (length - 1), options);\n\n    JERRY_ASSERT (lit_value != ECMA_VALUE_FALSE && !ECMA_IS_VALUE_ERROR (lit_value));\n\n    if (lit_value == ECMA_VALUE_NULL)\n    {\n      parser_raise_error (context_p, PARSER_ERR_OUT_OF_MEMORY);\n    }\n\n    lit_value = ecma_find_or_create_literal_bigint (lit_value);\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n  while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n  {\n    if (literal_p->type == LEXER_NUMBER_LITERAL && literal_p->u.value == lit_value)\n    {\n      context_p->lit_object.literal_p = literal_p;\n      context_p->lit_object.index = (uint16_t) literal_index;\n      return false;\n    }\n\n    literal_index++;\n  }\n\n  JERRY_ASSERT (literal_index == context_p->literal_count);\n\n  if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n  {\n    parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n  }\n\n  literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n  literal_p->u.value = lit_value;\n  literal_p->prop.length = 0; /* Unused. */\n  literal_p->type = LEXER_NUMBER_LITERAL;\n  literal_p->status_flags = 0;\n\n  context_p->lit_object.literal_p = literal_p;\n  context_p->lit_object.index = (uint16_t) literal_index;\n\n  context_p->literal_count++;\n  return false;\n} /* lexer_construct_number_object */\n\n/**\n * Convert a push number opcode to push literal opcode\n */\nvoid\nlexer_convert_push_number_to_push_literal (parser_context_t *context_p) /**< context */\n{\n  ecma_integer_value_t value;\n  bool two_literals = context_p->last_cbc_opcode >= CBC_PUSH_LITERAL_PUSH_NUMBER_0;\n\n  if (context_p->last_cbc_opcode == CBC_PUSH_NUMBER_0 || context_p->last_cbc_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_0)\n  {\n    value = 0;\n  }\n  else if (context_p->last_cbc_opcode == CBC_PUSH_NUMBER_POS_BYTE\n           || context_p->last_cbc_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE)\n  {\n    value = ((ecma_integer_value_t) context_p->last_cbc.value) + 1;\n  }\n  else\n  {\n    JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_NUMBER_NEG_BYTE\n                  || context_p->last_cbc_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE);\n    value = -((ecma_integer_value_t) context_p->last_cbc.value) - 1;\n  }\n\n  ecma_value_t lit_value = ecma_make_integer_value (value);\n\n  parser_list_iterator_t literal_iterator;\n  parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n  context_p->last_cbc_opcode = two_literals ? CBC_PUSH_TWO_LITERALS : CBC_PUSH_LITERAL;\n\n  uint32_t literal_index = 0;\n  lexer_literal_t *literal_p;\n\n  while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n  {\n    if (literal_p->type == LEXER_NUMBER_LITERAL && literal_p->u.value == lit_value)\n    {\n      if (two_literals)\n      {\n        context_p->last_cbc.value = (uint16_t) literal_index;\n      }\n      else\n      {\n        context_p->last_cbc.literal_index = (uint16_t) literal_index;\n      }\n      return;\n    }\n\n    literal_index++;\n  }\n\n  JERRY_ASSERT (literal_index == context_p->literal_count);\n\n  if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n  {\n    parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n  }\n\n  literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n  literal_p->u.value = lit_value;\n  literal_p->prop.length = 0; /* Unused. */\n  literal_p->type = LEXER_NUMBER_LITERAL;\n  literal_p->status_flags = 0;\n\n  context_p->literal_count++;\n\n  if (two_literals)\n  {\n    context_p->last_cbc.value = (uint16_t) literal_index;\n  }\n  else\n  {\n    context_p->last_cbc.literal_index = (uint16_t) literal_index;\n  }\n} /* lexer_convert_push_number_to_push_literal */\n\n/**\n * Construct a function literal object.\n *\n * @return function object literal index\n */\nuint16_t\nlexer_construct_function_object (parser_context_t *context_p, /**< context */\n                                 uint32_t extra_status_flags) /**< extra status flags */\n{\n#if (JERRY_STACK_LIMIT != 0)\n  if (JERRY_UNLIKELY (ecma_get_current_stack_usage () > CONFIG_MEM_STACK_LIMIT))\n  {\n    parser_raise_error (context_p, PARSER_ERR_STACK_OVERFLOW);\n  }\n#endif /* JERRY_STACK_LIMIT != 0 */\n  ecma_compiled_code_t *compiled_code_p;\n  lexer_literal_t *literal_p;\n  uint16_t result_index;\n\n  if (context_p->status_flags & PARSER_INSIDE_WITH)\n  {\n    extra_status_flags |= PARSER_INSIDE_WITH;\n  }\n\n  literal_p = lexer_construct_unused_literal (context_p);\n  result_index = context_p->literal_count;\n  context_p->literal_count++;\n\n  parser_flush_cbc (context_p);\n\n  if (JERRY_LIKELY (!(extra_status_flags & PARSER_IS_ARROW_FUNCTION)))\n  {\n    compiled_code_p = parser_parse_function (context_p, extra_status_flags);\n  }\n  else\n  {\n    compiled_code_p = parser_parse_arrow_function (context_p, extra_status_flags);\n  }\n\n  literal_p->u.bytecode_p = compiled_code_p;\n  literal_p->type = LEXER_FUNCTION_LITERAL;\n\n  return result_index;\n} /* lexer_construct_function_object */\n\n/**\n * Construct a class static block function literal object.\n *\n * @return function object literal index\n */\nuint16_t\nlexer_construct_class_static_block_function (parser_context_t *context_p) /**< context */\n{\n  ecma_compiled_code_t *compiled_code_p;\n  lexer_literal_t *literal_p;\n  uint16_t result_index;\n\n  literal_p = lexer_construct_unused_literal (context_p);\n  result_index = context_p->literal_count;\n  context_p->literal_count++;\n\n  parser_flush_cbc (context_p);\n  compiled_code_p = parser_parse_class_static_block (context_p);\n\n  literal_p->u.bytecode_p = compiled_code_p;\n  literal_p->type = LEXER_FUNCTION_LITERAL;\n\n  return result_index;\n} /* lexer_construct_class_static_block_function */\n\n/**\n * Construct a regular expression object.\n *\n * Note: In ESNEXT the constructed literal's type can be LEXER_STRING_LITERAL which represents\n * invalid pattern. In this case the lit_object's index contains the thrown error message literal.\n * Otherwise a new literal is appended to the end of the literal pool.\n */\nvoid\nlexer_construct_regexp_object (parser_context_t *context_p, /**< context */\n                               bool parse_only) /**< parse only */\n{\n#if JERRY_BUILTIN_REGEXP\n  const uint8_t *source_p = context_p->source_p;\n  const uint8_t *regex_start_p = context_p->source_p;\n  const uint8_t *regex_end_p = regex_start_p;\n  const uint8_t *source_end_p = context_p->source_end_p;\n  parser_line_counter_t column = context_p->column;\n  bool in_class = false;\n  uint16_t current_flags;\n  lit_utf8_size_t length;\n\n  JERRY_ASSERT (context_p->token.type == LEXER_DIVIDE || context_p->token.type == LEXER_ASSIGN_DIVIDE);\n\n  if (context_p->token.type == LEXER_ASSIGN_DIVIDE)\n  {\n    regex_start_p--;\n  }\n\n  while (true)\n  {\n    if (source_p >= source_end_p)\n    {\n      parser_raise_error (context_p, PARSER_ERR_UNTERMINATED_REGEXP);\n    }\n\n    if (!in_class && source_p[0] == LIT_CHAR_SLASH)\n    {\n      regex_end_p = source_p;\n      source_p++;\n      column++;\n      break;\n    }\n\n    switch (source_p[0])\n    {\n      case LIT_CHAR_CR:\n      case LIT_CHAR_LF:\n      case LEXER_NEWLINE_LS_PS_BYTE_1:\n      {\n        if (source_p[0] != LEXER_NEWLINE_LS_PS_BYTE_1 || LEXER_NEWLINE_LS_PS_BYTE_23 (source_p))\n        {\n          parser_raise_error (context_p, PARSER_ERR_NEWLINE_NOT_ALLOWED);\n        }\n        break;\n      }\n      case LIT_CHAR_TAB:\n      {\n        column = align_column_to_tab (column);\n        /* Subtract -1 because column is increased below. */\n        column--;\n        break;\n      }\n      case LIT_CHAR_LEFT_SQUARE:\n      {\n        in_class = true;\n        break;\n      }\n      case LIT_CHAR_RIGHT_SQUARE:\n      {\n        in_class = false;\n        break;\n      }\n      case LIT_CHAR_BACKSLASH:\n      {\n        if (source_p + 1 >= source_end_p)\n        {\n          parser_raise_error (context_p, PARSER_ERR_UNTERMINATED_REGEXP);\n        }\n\n        if (source_p[1] >= 0x20 && source_p[1] <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)\n        {\n          source_p++;\n          column++;\n        }\n      }\n    }\n\n    source_p++;\n    column++;\n\n    while (source_p < source_end_p && IS_UTF8_INTERMEDIATE_OCTET (source_p[0]))\n    {\n      source_p++;\n    }\n  }\n\n  current_flags = 0;\n  while (source_p < source_end_p)\n  {\n    uint32_t flag = 0;\n\n    if (source_p[0] == LIT_CHAR_LOWERCASE_G)\n    {\n      flag = RE_FLAG_GLOBAL;\n    }\n    else if (source_p[0] == LIT_CHAR_LOWERCASE_I)\n    {\n      flag = RE_FLAG_IGNORE_CASE;\n    }\n    else if (source_p[0] == LIT_CHAR_LOWERCASE_M)\n    {\n      flag = RE_FLAG_MULTILINE;\n    }\n    else if (source_p[0] == LIT_CHAR_LOWERCASE_U)\n    {\n      flag = RE_FLAG_UNICODE;\n    }\n    else if (source_p[0] == LIT_CHAR_LOWERCASE_Y)\n    {\n      flag = RE_FLAG_STICKY;\n    }\n    else if (source_p[0] == LIT_CHAR_LOWERCASE_S)\n    {\n      flag = RE_FLAG_DOTALL;\n    }\n\n    if (flag == 0)\n    {\n      break;\n    }\n\n    if (current_flags & flag)\n    {\n      parser_raise_error (context_p, PARSER_ERR_DUPLICATED_REGEXP_FLAG);\n    }\n\n    current_flags = (uint16_t) (current_flags | flag);\n    source_p++;\n    column++;\n  }\n\n  context_p->source_p = source_p;\n  context_p->column = column;\n\n  if (source_p < source_end_p && lexer_parse_identifier (context_p, LEXER_PARSE_CHECK_PART_AND_RETURN))\n  {\n    parser_raise_error (context_p, PARSER_ERR_UNKNOWN_REGEXP_FLAG);\n  }\n\n  length = (lit_utf8_size_t) (regex_end_p - regex_start_p);\n  if (length > PARSER_MAXIMUM_STRING_LENGTH)\n  {\n    parser_raise_error (context_p, PARSER_ERR_REGEXP_TOO_LONG);\n  }\n\n  context_p->column = column;\n  context_p->source_p = source_p;\n\n  if (parse_only)\n  {\n    return;\n  }\n\n  if (context_p->literal_count >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n  {\n    parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n  }\n\n  /* Compile the RegExp literal and store the RegExp bytecode pointer */\n  ecma_string_t *pattern_str_p = NULL;\n\n  if (lit_is_valid_cesu8_string (regex_start_p, length))\n  {\n    pattern_str_p = ecma_new_ecma_string_from_utf8 (regex_start_p, length);\n  }\n  else\n  {\n    JERRY_ASSERT (lit_is_valid_utf8_string (regex_start_p, length, false));\n    pattern_str_p = ecma_new_ecma_string_from_utf8_converted_to_cesu8 (regex_start_p, length);\n  }\n\n  re_compiled_code_t *re_bytecode_p = re_compile_bytecode (pattern_str_p, current_flags);\n  ecma_deref_ecma_string (pattern_str_p);\n\n  if (JERRY_UNLIKELY (re_bytecode_p == NULL))\n  {\n    parser_raise_error (context_p, PARSER_ERR_INVALID_REGEXP);\n  }\n\n  lexer_literal_t *literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n  literal_p->u.bytecode_p = (ecma_compiled_code_t *) re_bytecode_p;\n  literal_p->type = LEXER_REGEXP_LITERAL;\n  literal_p->prop.length = (prop_length_t) length;\n  literal_p->status_flags = 0;\n\n  context_p->token.type = LEXER_LITERAL;\n  context_p->token.lit_location.type = LEXER_REGEXP_LITERAL;\n\n  context_p->lit_object.literal_p = literal_p;\n  context_p->lit_object.index = context_p->literal_count++;\n#else /* !JERRY_BUILTIN_REGEXP */\n  JERRY_UNUSED (parse_only);\n  parser_raise_error (context_p, PARSER_ERR_UNSUPPORTED_REGEXP);\n#endif /* JERRY_BUILTIN_REGEXP */\n} /* lexer_construct_regexp_object */\n\n/**\n * Next token must be an identifier.\n */\nvoid\nlexer_expect_identifier (parser_context_t *context_p, /**< context */\n                         uint8_t literal_type) /**< literal type */\n{\n  JERRY_ASSERT (literal_type == LEXER_STRING_LITERAL || literal_type == LEXER_IDENT_LITERAL\n                || literal_type == LEXER_NEW_IDENT_LITERAL);\n\n  lexer_skip_spaces (context_p);\n  context_p->token.keyword_type = LEXER_EOS;\n  context_p->token.line = context_p->line;\n  context_p->token.column = context_p->column;\n\n  if (context_p->source_p < context_p->source_end_p\n      && lexer_parse_identifier (\n        context_p,\n        (literal_type != LEXER_STRING_LITERAL ? LEXER_PARSE_CHECK_KEYWORDS : LEXER_PARSE_NO_OPTS)))\n  {\n    if (context_p->token.type == LEXER_LITERAL)\n    {\n      JERRY_ASSERT (context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n      lexer_construct_literal_object (context_p, &context_p->token.lit_location, literal_type);\n\n      if (literal_type != LEXER_STRING_LITERAL && (context_p->status_flags & PARSER_IS_STRICT))\n      {\n        if (context_p->token.keyword_type == LEXER_KEYW_EVAL)\n        {\n          parser_raise_error (context_p, PARSER_ERR_EVAL_NOT_ALLOWED);\n        }\n        else if (context_p->token.keyword_type == LEXER_KEYW_ARGUMENTS)\n        {\n          parser_raise_error (context_p, PARSER_ERR_ARGUMENTS_NOT_ALLOWED);\n        }\n      }\n      return;\n    }\n  }\n#if JERRY_MODULE_SYSTEM\n  else if (context_p->status_flags & PARSER_MODULE_DEFAULT_CLASS_OR_FUNC)\n  {\n    /* When parsing default exports for modules, it is not required by functions or classes to have identifiers.\n     * In this case we use a synthetic name for them. */\n    context_p->token.type = LEXER_LITERAL;\n    context_p->token.lit_location = lexer_default_literal;\n    lexer_construct_literal_object (context_p, &context_p->token.lit_location, literal_type);\n    context_p->status_flags &= (uint32_t) ~(PARSER_MODULE_DEFAULT_CLASS_OR_FUNC);\n    return;\n  }\n#endif /* JERRY_MODULE_SYSTEM */\n  if (context_p->token.type == LEXER_KEYW_YIELD)\n  {\n    parser_raise_error (context_p, PARSER_ERR_YIELD_NOT_ALLOWED);\n  }\n  if (context_p->token.type == LEXER_KEYW_AWAIT)\n  {\n    parser_raise_error (context_p, PARSER_ERR_AWAIT_NOT_ALLOWED);\n  }\n  parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n} /* lexer_expect_identifier */\n\n/**\n * Next token must be an identifier.\n */\nvoid\nlexer_expect_object_literal_id (parser_context_t *context_p, /**< context */\n                                uint32_t ident_opts) /**< lexer_obj_ident_opts_t option bits */\n{\n  lexer_skip_spaces (context_p);\n\n  if (context_p->source_p >= context_p->source_end_p)\n  {\n    parser_raise_error (context_p, PARSER_ERR_PROPERTY_IDENTIFIER_EXPECTED);\n  }\n\n  context_p->token.keyword_type = LEXER_EOS;\n  context_p->token.line = context_p->line;\n  context_p->token.column = context_p->column;\n  bool create_literal_object = false;\n\n  JERRY_ASSERT ((ident_opts & LEXER_OBJ_IDENT_CLASS_IDENTIFIER) || !(ident_opts & LEXER_OBJ_IDENT_CLASS_NO_STATIC));\n\n#if JERRY_FUNCTION_TO_STRING\n  if (ident_opts & LEXER_OBJ_IDENT_SET_FUNCTION_START)\n  {\n    context_p->function_start_p = context_p->source_p;\n  }\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n  if (lexer_parse_identifier (context_p, LEXER_PARSE_NO_OPTS))\n  {\n    if (!(ident_opts & (LEXER_OBJ_IDENT_ONLY_IDENTIFIERS | LEXER_OBJ_IDENT_OBJECT_PATTERN)))\n    {\n      lexer_skip_spaces (context_p);\n      context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);\n\n      if (context_p->source_p < context_p->source_end_p && context_p->source_p[0] != LIT_CHAR_COMMA\n          && context_p->source_p[0] != LIT_CHAR_RIGHT_BRACE && context_p->source_p[0] != LIT_CHAR_LEFT_PAREN\n          && context_p->source_p[0] != LIT_CHAR_SEMICOLON && context_p->source_p[0] != LIT_CHAR_EQUALS\n          && context_p->source_p[0] != LIT_CHAR_COLON)\n      {\n        if (lexer_compare_literal_to_string (context_p, \"get\", 3))\n        {\n          context_p->token.type = LEXER_PROPERTY_GETTER;\n          return;\n        }\n\n        if (lexer_compare_literal_to_string (context_p, \"set\", 3))\n        {\n          context_p->token.type = LEXER_PROPERTY_SETTER;\n          return;\n        }\n\n        if (lexer_compare_literal_to_string (context_p, \"async\", 5))\n        {\n          context_p->token.type = LEXER_KEYW_ASYNC;\n          return;\n        }\n\n        if (ident_opts & LEXER_OBJ_IDENT_CLASS_NO_STATIC)\n        {\n          if (lexer_compare_literal_to_string (context_p, \"static\", 6))\n          {\n            context_p->token.type = LEXER_KEYW_STATIC;\n          }\n          return;\n        }\n      }\n    }\n\n    create_literal_object = true;\n  }\n  else if (ident_opts & LEXER_OBJ_IDENT_CLASS_PRIVATE)\n  {\n    parser_raise_error (context_p, PARSER_ERR_INVALID_CHARACTER);\n  }\n  else\n  {\n    switch (context_p->source_p[0])\n    {\n      case LIT_CHAR_DOUBLE_QUOTE:\n      case LIT_CHAR_SINGLE_QUOTE:\n      {\n        lexer_parse_string (context_p, LEXER_STRING_NO_OPTS);\n        create_literal_object = true;\n        break;\n      }\n      case LIT_CHAR_LEFT_SQUARE:\n      {\n#if JERRY_FUNCTION_TO_STRING\n        const uint8_t *function_start_p = context_p->function_start_p;\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n        lexer_consume_next_character (context_p);\n\n        lexer_next_token (context_p);\n        parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n\n        if (context_p->token.type != LEXER_RIGHT_SQUARE)\n        {\n          parser_raise_error (context_p, PARSER_ERR_RIGHT_SQUARE_EXPECTED);\n        }\n\n#if JERRY_FUNCTION_TO_STRING\n        context_p->function_start_p = function_start_p;\n#endif /* JERRY_FUNCTION_TO_STRING */\n        return;\n      }\n      case LIT_CHAR_ASTERISK:\n      {\n        if (ident_opts & (LEXER_OBJ_IDENT_ONLY_IDENTIFIERS | LEXER_OBJ_IDENT_OBJECT_PATTERN))\n        {\n          break;\n        }\n\n        context_p->token.type = LEXER_MULTIPLY;\n        lexer_consume_next_character (context_p);\n        return;\n      }\n      case LIT_CHAR_HASHMARK:\n      {\n        if (ident_opts & LEXER_OBJ_IDENT_CLASS_IDENTIFIER)\n        {\n          context_p->token.type = LEXER_HASHMARK;\n          return;\n        }\n\n        break;\n      }\n      case LIT_CHAR_LEFT_BRACE:\n      {\n        const uint32_t static_block_flags =\n          (LEXER_OBJ_IDENT_CLASS_NO_STATIC | LEXER_OBJ_IDENT_CLASS_PRIVATE | LEXER_OBJ_IDENT_CLASS_IDENTIFIER);\n\n        if ((ident_opts & static_block_flags) == LEXER_OBJ_IDENT_CLASS_IDENTIFIER)\n        {\n          context_p->token.type = LEXER_LEFT_BRACE;\n          lexer_consume_next_character (context_p);\n          return;\n        }\n\n        break;\n      }\n      case LIT_CHAR_RIGHT_BRACE:\n      {\n        if (ident_opts & LEXER_OBJ_IDENT_ONLY_IDENTIFIERS)\n        {\n          break;\n        }\n\n        context_p->token.type = LEXER_RIGHT_BRACE;\n        lexer_consume_next_character (context_p);\n        return;\n      }\n      case LIT_CHAR_DOT:\n      {\n        if (!(context_p->source_p + 1 >= context_p->source_end_p || lit_char_is_decimal_digit (context_p->source_p[1])))\n        {\n          if ((ident_opts & ((uint32_t) ~(LEXER_OBJ_IDENT_OBJECT_PATTERN | LEXER_OBJ_IDENT_SET_FUNCTION_START)))\n              || context_p->source_p + 2 >= context_p->source_end_p || context_p->source_p[1] != LIT_CHAR_DOT\n              || context_p->source_p[2] != LIT_CHAR_DOT)\n          {\n            break;\n          }\n\n          context_p->token.type = LEXER_THREE_DOTS;\n          context_p->token.flags &= (uint8_t) ~LEXER_NO_SKIP_SPACES;\n          PARSER_PLUS_EQUAL_LC (context_p->column, 3);\n          context_p->source_p += 3;\n          return;\n        }\n        /* FALLTHRU */\n      }\n      default:\n      {\n        const uint8_t *char_p = context_p->source_p;\n\n        if (char_p[0] == LIT_CHAR_DOT)\n        {\n          char_p++;\n        }\n\n        if (char_p < context_p->source_end_p && char_p[0] >= LIT_CHAR_0 && char_p[0] <= LIT_CHAR_9)\n        {\n          lexer_parse_number (context_p);\n\n          if (!(ident_opts & LEXER_OBJ_IDENT_CLASS_IDENTIFIER))\n          {\n            lexer_construct_number_object (context_p, false, false);\n          }\n          return;\n        }\n        break;\n      }\n    }\n  }\n\n  if (create_literal_object)\n  {\n    if (ident_opts & LEXER_OBJ_IDENT_CLASS_IDENTIFIER)\n    {\n      return;\n    }\n\n    if (ident_opts & LEXER_OBJ_IDENT_CLASS_PRIVATE)\n    {\n      parser_resolve_private_identifier (context_p);\n      return;\n    }\n\n    lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_STRING_LITERAL);\n    return;\n  }\n\n  parser_raise_error (context_p, PARSER_ERR_PROPERTY_IDENTIFIER_EXPECTED);\n} /* lexer_expect_object_literal_id */\n\n/**\n * Read next token without checking keywords\n *\n * @return true if the next literal is identifier, false otherwise\n */\nbool\nlexer_scan_identifier (parser_context_t *context_p, /**< context */\n                       lexer_parse_options_t opts) /**< identifier parse options */\n{\n  lexer_skip_spaces (context_p);\n  context_p->token.keyword_type = LEXER_EOS;\n  context_p->token.line = context_p->line;\n  context_p->token.column = context_p->column;\n\n  if (context_p->source_p < context_p->source_end_p && lexer_parse_identifier (context_p, opts))\n  {\n    return true;\n  }\n\n  context_p->token.flags |= LEXER_NO_SKIP_SPACES;\n  lexer_next_token (context_p);\n  return false;\n} /* lexer_scan_identifier */\n\n/**\n * Check whether the identifier is a modifier in a property definition.\n */\nvoid\nlexer_check_property_modifier (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (!(context_p->token.flags & LEXER_NO_SKIP_SPACES));\n  JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n  lexer_skip_spaces (context_p);\n  context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);\n\n  if (context_p->source_p >= context_p->source_end_p || context_p->source_p[0] == LIT_CHAR_COMMA\n      || context_p->source_p[0] == LIT_CHAR_RIGHT_BRACE || context_p->source_p[0] == LIT_CHAR_LEFT_PAREN\n      || context_p->source_p[0] == LIT_CHAR_EQUALS || context_p->source_p[0] == LIT_CHAR_COLON)\n  {\n    return;\n  }\n\n  if (lexer_compare_literal_to_string (context_p, \"get\", 3))\n  {\n    context_p->token.type = LEXER_PROPERTY_GETTER;\n    return;\n  }\n\n  if (lexer_compare_literal_to_string (context_p, \"set\", 3))\n  {\n    context_p->token.type = LEXER_PROPERTY_SETTER;\n    return;\n  }\n\n  if (lexer_compare_literal_to_string (context_p, \"async\", 5))\n  {\n    context_p->token.type = LEXER_KEYW_ASYNC;\n    return;\n  }\n} /* lexer_check_property_modifier */\n\n/**\n * Compares two identifiers.\n *\n * Note:\n *   Escape sequences are allowed in the left identifier, but not in the right\n *\n * @return true if the two identifiers are the same\n */\nstatic bool\nlexer_compare_identifier_to_chars (const uint8_t *left_p, /**< left identifier */\n                                   const uint8_t *right_p, /**< right identifier string */\n                                   size_t size) /**< byte size of the two identifiers */\n{\n  uint8_t utf8_buf[6];\n\n  do\n  {\n    if (*left_p == *right_p)\n    {\n      left_p++;\n      right_p++;\n      size--;\n      continue;\n    }\n\n    size_t escape_size;\n\n    if (*left_p == LIT_CHAR_BACKSLASH)\n    {\n      left_p += 2;\n      lit_code_point_t code_point = lexer_unchecked_hex_to_character (&left_p);\n\n      escape_size = lit_code_point_to_cesu8_bytes (utf8_buf, code_point);\n    }\n    else if (*left_p >= LIT_UTF8_4_BYTE_MARKER)\n    {\n      lit_four_byte_utf8_char_to_cesu8 (utf8_buf, left_p);\n      escape_size = 3 * 2;\n      left_p += 4;\n    }\n    else\n    {\n      return false;\n    }\n\n    size -= escape_size;\n\n    uint8_t *utf8_p = utf8_buf;\n    do\n    {\n      if (*right_p++ != *utf8_p++)\n      {\n        return false;\n      }\n    } while (--escape_size > 0);\n  } while (size > 0);\n\n  return true;\n} /* lexer_compare_identifier_to_chars */\n\n/**\n * Compares an identifier to a string.\n *\n * Note:\n *   Escape sequences are allowed in the left identifier, but not in the right\n *\n * @return true if the identifier equals to string\n */\nbool\nlexer_compare_identifier_to_string (const lexer_lit_location_t *left_p, /**< left literal */\n                                    const uint8_t *right_p, /**< right identifier string */\n                                    size_t size) /**< byte size of the right identifier */\n{\n  if (left_p->length != size)\n  {\n    return false;\n  }\n\n  if (!(left_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))\n  {\n    return memcmp (left_p->char_p, right_p, size) == 0;\n  }\n\n  return lexer_compare_identifier_to_chars (left_p->char_p, right_p, size);\n} /* lexer_compare_identifier_to_string */\n\n/**\n * Compares two identifiers.\n *\n * Note:\n *   Escape sequences are allowed in both identifiers\n *\n * @return true if the two identifiers are the same\n */\nbool\nlexer_compare_identifiers (parser_context_t *context_p, /**< context */\n                           const lexer_lit_location_t *left_p, /**< left literal */\n                           const lexer_lit_location_t *right_p) /**< right literal */\n{\n  prop_length_t length = left_p->length;\n\n  if (length != right_p->length)\n  {\n    return false;\n  }\n\n  if (!(left_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))\n  {\n    return lexer_compare_identifier_to_chars (right_p->char_p, left_p->char_p, length);\n  }\n\n  if (!(right_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))\n  {\n    return lexer_compare_identifier_to_chars (left_p->char_p, right_p->char_p, length);\n  }\n\n  if (length <= 64)\n  {\n    uint8_t buf_p[64];\n    lexer_convert_ident_to_cesu8 (buf_p, left_p->char_p, length);\n    return lexer_compare_identifier_to_chars (right_p->char_p, buf_p, length);\n  }\n\n  uint8_t *dynamic_buf_p = parser_malloc (context_p, length);\n\n  lexer_convert_ident_to_cesu8 (dynamic_buf_p, left_p->char_p, length);\n  bool result = lexer_compare_identifier_to_chars (right_p->char_p, dynamic_buf_p, length);\n  parser_free (dynamic_buf_p, length);\n\n  return result;\n} /* lexer_compare_identifiers */\n\n/**\n * Compares the current identifier in the context to the parameter identifier\n *\n * Note:\n *   Escape sequences are allowed.\n *\n * @return true if the input identifiers are the same\n */\nbool\nlexer_current_is_literal (parser_context_t *context_p, /**< context */\n                          const lexer_lit_location_t *right_ident_p) /**< identifier */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n  lexer_lit_location_t *left_ident_p = &context_p->token.lit_location;\n\n  JERRY_ASSERT (left_ident_p->length > 0 && right_ident_p->length > 0);\n\n  if (left_ident_p->length != right_ident_p->length)\n  {\n    return false;\n  }\n\n  if (!((left_ident_p->status_flags | right_ident_p->status_flags) & LEXER_LIT_LOCATION_HAS_ESCAPE))\n  {\n    return memcmp (left_ident_p->char_p, right_ident_p->char_p, left_ident_p->length) == 0;\n  }\n\n  return lexer_compare_identifiers (context_p, left_ident_p, right_ident_p);\n} /* lexer_current_is_literal */\n\n/**\n * Compares the current string token to \"use strict\".\n *\n * Note:\n *   Escape sequences are not allowed.\n *\n * @return true if \"use strict\" is found, false otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\nlexer_string_is_use_strict (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL);\n\n  return (context_p->token.lit_location.length == 10\n          && !(context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)\n          && memcmp (context_p->token.lit_location.char_p, \"use strict\", 10) == 0);\n} /* lexer_string_is_use_strict */\n\n/**\n * Checks whether the string before the current token is a directive or a string literal.\n *\n * @return true if the string is a directive, false otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\nlexer_string_is_directive (parser_context_t *context_p) /**< context */\n{\n  return (context_p->token.type == LEXER_SEMICOLON || context_p->token.type == LEXER_RIGHT_BRACE\n          || context_p->token.type == LEXER_EOS\n          || ((context_p->token.flags & LEXER_WAS_NEWLINE) && !LEXER_IS_BINARY_OP_TOKEN (context_p->token.type)\n              && context_p->token.type != LEXER_LEFT_PAREN && context_p->token.type != LEXER_LEFT_SQUARE\n              && context_p->token.type != LEXER_DOT));\n} /* lexer_string_is_directive */\n\n/**\n * Compares the current token to an expected identifier.\n *\n * Note:\n *   Escape sequences are not allowed.\n *\n * @return true if they are the same, false otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\nlexer_token_is_identifier (parser_context_t *context_p, /**< context */\n                           const char *identifier_p, /**< identifier */\n                           size_t identifier_length) /**< identifier length */\n{\n  /* Checking has_escape is unnecessary because memcmp will fail if escape sequences are present. */\n  return (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL\n          && context_p->token.lit_location.length == identifier_length\n          && memcmp (context_p->token.lit_location.char_p, identifier_p, identifier_length) == 0);\n} /* lexer_token_is_identifier */\n\n/**\n * Compares the current identifier token to \"let\".\n *\n * Note:\n *   Escape sequences are not allowed.\n *\n * @return true if \"let\" is found, false otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\nlexer_token_is_let (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LITERAL);\n\n  return (context_p->token.keyword_type == LEXER_KEYW_LET\n          && !(context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE));\n} /* lexer_token_is_let */\n\n/**\n * Compares the current identifier token to \"async\".\n *\n * Note:\n *   Escape sequences are not allowed.\n *\n * @return true if \"async\" is found, false otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\nlexer_token_is_async (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LITERAL || context_p->token.type == LEXER_TEMPLATE_LITERAL);\n\n  return (context_p->token.keyword_type == LEXER_KEYW_ASYNC\n          && !(context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE));\n} /* lexer_token_is_async */\n\n/**\n * Compares the current identifier or string to an expected string.\n *\n * Note:\n *   Escape sequences are not allowed.\n *\n * @return true if they are the same, false otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\nlexer_compare_literal_to_string (parser_context_t *context_p, /**< context */\n                                 const char *string_p, /**< string */\n                                 size_t string_length) /**< string length */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LITERAL\n                && (context_p->token.lit_location.type == LEXER_IDENT_LITERAL\n                    || context_p->token.lit_location.type == LEXER_STRING_LITERAL));\n\n  /* Checking has_escape is unnecessary because memcmp will fail if escape sequences are present. */\n  return (context_p->token.lit_location.length == string_length\n          && memcmp (context_p->token.lit_location.char_p, string_p, string_length) == 0);\n} /* lexer_compare_literal_to_string */\n\n/**\n * Initialize line info to its default value\n */\nvoid\nlexer_init_line_info (parser_context_t *context_p) /**< context */\n{\n  context_p->line = 1;\n  context_p->column = 1;\n\n  const jerry_parse_options_t *options_p = context_p->options_p;\n\n  if (options_p != NULL && (options_p->options & JERRY_PARSE_HAS_START))\n  {\n    if (options_p->start_line > 0)\n    {\n      context_p->line = options_p->start_line;\n    }\n\n    if (options_p->start_column > 0)\n    {\n      context_p->column = options_p->start_column;\n    }\n  }\n} /* lexer_init_line_info */\n\n/**\n * Convert binary lvalue token to binary token\n * e.g. += -> +\n *      ^= -> ^\n *\n * @return binary token\n */\nuint8_t\nlexer_convert_binary_lvalue_token_to_binary (uint8_t token) /**< binary lvalue token */\n{\n  JERRY_ASSERT (LEXER_IS_BINARY_LVALUE_OP_TOKEN (token));\n  JERRY_ASSERT (token != LEXER_ASSIGN);\n\n  if (token <= LEXER_ASSIGN_EXPONENTIATION)\n  {\n    return (uint8_t) (LEXER_ADD + (token - LEXER_ASSIGN_ADD));\n  }\n\n  if (token <= LEXER_ASSIGN_UNS_RIGHT_SHIFT)\n  {\n    return (uint8_t) (LEXER_LEFT_SHIFT + (token - LEXER_ASSIGN_LEFT_SHIFT));\n  }\n\n  switch (token)\n  {\n    case LEXER_ASSIGN_BIT_AND:\n    {\n      return LEXER_BIT_AND;\n    }\n    case LEXER_ASSIGN_BIT_OR:\n    {\n      return LEXER_BIT_OR;\n    }\n    default:\n    {\n      JERRY_ASSERT (token == LEXER_ASSIGN_BIT_XOR);\n      return LEXER_BIT_XOR;\n    }\n  }\n} /* lexer_convert_binary_lvalue_token_to_binary */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_PARSER */\n"
  },
  {
    "path": "jerry-core/parser/js/js-lexer.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JS_LEXER_H\n#define JS_LEXER_H\n\n#include \"ecma-globals.h\"\n\n#include \"common.h\"\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_lexer Lexer\n * @{\n */\n\n/**\n * Flags for lexer_parse_identifier.\n */\ntypedef enum\n{\n  LEXER_PARSE_NO_OPTS = 0, /**< no options */\n  LEXER_PARSE_CHECK_KEYWORDS = (1 << 0), /**< check keywords */\n  LEXER_PARSE_NO_STRICT_IDENT_ERROR = (1 << 1), /**< do not throw exception for strict mode keywords */\n  LEXER_PARSE_CHECK_START_AND_RETURN = (1 << 2), /**< check identifier start and return */\n  LEXER_PARSE_CHECK_PART_AND_RETURN = (1 << 3), /**< check identifier part and return */\n} lexer_parse_options_t;\n\n/**\n * Lexer token types.\n */\ntypedef enum\n{\n  LEXER_EOS, /**< end of source */\n\n  /* Primary expressions */\n  LEXER_LITERAL, /**< literal token */\n  LEXER_KEYW_THIS, /**< this */\n  LEXER_LIT_TRUE, /**< true (not a keyword!) */\n  LEXER_LIT_FALSE, /**< false (not a keyword!) */\n  LEXER_LIT_NULL, /**< null (not a keyword!) */\n  LEXER_TEMPLATE_LITERAL, /**< multi segment template literal */\n  LEXER_THREE_DOTS, /**< ... (rest or spread operator) */\n\n/* Unary operators\n * IMPORTANT: update CBC_UNARY_OP_TOKEN_TO_OPCODE and\n *            CBC_UNARY_LVALUE_OP_TOKEN_TO_OPCODE after changes. */\n#define LEXER_IS_UNARY_OP_TOKEN(token_type)        ((token_type) >= LEXER_PLUS && (token_type) <= LEXER_DECREASE)\n#define LEXER_IS_UNARY_LVALUE_OP_TOKEN(token_type) ((token_type) >= LEXER_KEYW_DELETE && (token_type) <= LEXER_DECREASE)\n\n  LEXER_PLUS, /**< \"+\" */\n  LEXER_NEGATE, /**< \"-\" */\n  LEXER_LOGICAL_NOT, /**< \"!\" */\n  LEXER_BIT_NOT, /**< \"~\" */\n  LEXER_KEYW_VOID, /**< void */\n  LEXER_KEYW_TYPEOF, /**< typeof */\n  LEXER_KEYW_AWAIT, /**< await */\n  LEXER_KEYW_DELETE, /**< delete */\n  LEXER_INCREASE, /**< \"++\" */\n  LEXER_DECREASE, /**< \"--\" */\n\n/* Binary operators\n * IMPORTANT: update CBC_BINARY_OP_TOKEN_TO_OPCODE,\n *            CBC_BINARY_LVALUE_OP_TOKEN_TO_OPCODE and\n *            parser_binary_precedence_table after changes. */\n/**\n * Index of first binary operation opcode.\n */\n#define LEXER_FIRST_BINARY_OP LEXER_ASSIGN\n\n/**\n * Index of last binary operation opcode.\n */\n#define LEXER_LAST_BINARY_OP LEXER_EXPONENTIATION\n\n/**\n * Checks whether the token is a binary operation token.\n */\n#define LEXER_IS_BINARY_OP_TOKEN(token_type) \\\n  ((token_type) >= LEXER_FIRST_BINARY_OP && (token_type) <= LEXER_LAST_BINARY_OP)\n/**\n * Checks whether the token is an lvalue (assignment) operation token.\n */\n#define LEXER_IS_BINARY_LVALUE_OP_TOKEN(token_type) \\\n  ((token_type) >= LEXER_ASSIGN && (token_type) <= LEXER_ASSIGN_BIT_XOR)\n/**\n * Checks whether the token is a non-lvalue (assignment) operation token.\n */\n#define LEXER_IS_BINARY_NON_LVALUE_OP_TOKEN(token_type) \\\n  ((token_type) >= LEXER_QUESTION_MARK && (token_type) <= LEXER_LAST_BINARY_OP)\n\n  LEXER_ASSIGN, /**< \"=\" (prec: 3) */\n  LEXER_ASSIGN_ADD, /**< \"+=\" (prec: 3) */\n  LEXER_ASSIGN_SUBTRACT, /**< \"-=\" (prec: 3) */\n  LEXER_ASSIGN_MULTIPLY, /**< \"*=\" (prec: 3) */\n  LEXER_ASSIGN_DIVIDE, /**< \"/=\" (prec: 3) */\n  LEXER_ASSIGN_MODULO, /**< \"%=\" (prec: 3) */\n  LEXER_ASSIGN_EXPONENTIATION, /**< \"**=\" (prec: 3) */\n  LEXER_ASSIGN_NULLISH_COALESCING, /**< \"??=\" (prec: 3) */\n  LEXER_ASSIGN_LOGICAL_OR, /**< \"||=\" (prec: 3) */\n  LEXER_ASSIGN_LOGICAL_AND, /**< \"&&=\" (prec: 3) */\n  LEXER_ASSIGN_LEFT_SHIFT, /**< \"<<=\" (prec: 3) */\n  LEXER_ASSIGN_RIGHT_SHIFT, /**< \">>=\" (prec: 3) */\n  LEXER_ASSIGN_UNS_RIGHT_SHIFT, /**< \">>>=\" (prec: 3) */\n  LEXER_ASSIGN_BIT_AND, /**< \"&=\" (prec: 3) */\n  LEXER_ASSIGN_BIT_OR, /**< \"|=\" (prec: 3) */\n  LEXER_ASSIGN_BIT_XOR, /**< \"^=\" (prec: 3) */\n  LEXER_QUESTION_MARK, /**< \"?\" (prec: 4) */\n  LEXER_NULLISH_COALESCING, /**< \"??\" (prec: 5) */\n  LEXER_LOGICAL_OR, /**< \"||\" (prec: 6) */\n  LEXER_LOGICAL_AND, /**< \"&&\" (prec: 7) */\n  LEXER_BIT_OR, /**< \"|\" (prec: 8) */\n  LEXER_BIT_XOR, /**< \"^\" (prec: 9) */\n  LEXER_BIT_AND, /**< \"&\" (prec: 10) */\n  LEXER_EQUAL, /**< \"==\" (prec: 11) */\n  LEXER_NOT_EQUAL, /**< \"!=\" (prec: 11) */\n  LEXER_STRICT_EQUAL, /**< \"===\" (prec: 11) */\n  LEXER_STRICT_NOT_EQUAL, /**< \"!==\" (prec: 11) */\n  LEXER_LESS, /**< \"<\" (prec: 12) */\n  LEXER_GREATER, /**< \">\" (prec: 12) */\n  LEXER_LESS_EQUAL, /**< \"<=\" (prec: 12) */\n  LEXER_GREATER_EQUAL, /**< \">=\" (prec: 12) */\n  LEXER_KEYW_IN, /**< in (prec: 12) */\n  LEXER_KEYW_INSTANCEOF, /**< instanceof (prec: 12) */\n  LEXER_LEFT_SHIFT, /**< \"<<\" (prec: 13) */\n  LEXER_RIGHT_SHIFT, /**< \">>\" (prec: 13) */\n  LEXER_UNS_RIGHT_SHIFT, /**< \">>>\" (prec: 13) */\n  LEXER_ADD, /**< \"+\" (prec: 14) */\n  LEXER_SUBTRACT, /**< \"-\" (prec: 14) */\n  LEXER_MULTIPLY, /**< \"*\" (prec: 15) */\n  LEXER_DIVIDE, /**< \"/\" (prec: 15) */\n  LEXER_MODULO, /**< \"%\" (prec: 15) */\n  LEXER_EXPONENTIATION, /**< \"**\" (prec: 16) */\n  LEXER_LEFT_BRACE, /**< \"{\" */\n  LEXER_LEFT_PAREN, /**< \"(\" */\n  LEXER_LEFT_SQUARE, /**< \"[\" */\n  LEXER_RIGHT_BRACE, /**< \"}\" */\n  LEXER_RIGHT_PAREN, /**< \")\" */\n  LEXER_RIGHT_SQUARE, /**< \"]\" */\n  LEXER_DOT, /**< \".\" */\n  LEXER_QUESTION_MARK_DOT, /**< \"?.\" */\n  LEXER_SEMICOLON, /**< \";\" */\n  LEXER_COLON, /**< \":\" */\n  LEXER_COMMA, /**< \",\" */\n  LEXER_ARROW, /**< \"=>\" */\n  LEXER_HASHMARK, /**< \"#\" */\n\n  LEXER_KEYW_BREAK, /**< break */\n  LEXER_KEYW_DO, /**< do */\n  LEXER_KEYW_CASE, /**< case  */\n  LEXER_KEYW_ELSE, /**< else */\n  LEXER_KEYW_NEW, /**< new */\n  LEXER_KEYW_VAR, /**< var */\n  LEXER_KEYW_CATCH, /**< catch */\n  LEXER_KEYW_FINALLY, /**< finally */\n  LEXER_KEYW_RETURN, /**< return */\n  LEXER_KEYW_CONTINUE, /**< continue */\n  LEXER_KEYW_FOR, /**< for */\n  LEXER_KEYW_SWITCH, /**< switch */\n  LEXER_KEYW_WHILE, /**< while */\n  LEXER_KEYW_DEBUGGER, /**< debugger */\n  LEXER_KEYW_FUNCTION, /**< function */\n  LEXER_KEYW_WITH, /**< with */\n  LEXER_KEYW_DEFAULT, /**< default */\n  LEXER_KEYW_IF, /**< if */\n  LEXER_KEYW_THROW, /**< throw */\n  LEXER_KEYW_TRY, /**< try */\n\n  LEXER_KEYW_CLASS, /**< class */\n  LEXER_KEYW_EXTENDS, /**< extends */\n  LEXER_KEYW_SUPER, /**< super */\n  LEXER_KEYW_CONST, /**< const */\n  LEXER_KEYW_EXPORT, /**< export */\n  LEXER_KEYW_IMPORT, /**< import */\n  LEXER_KEYW_ENUM, /**< enum */\n\n#define LEXER_FIRST_NON_RESERVED_KEYWORD LEXER_EXPRESSION_START\n\n  /* These are virtual tokens. */\n  LEXER_EXPRESSION_START, /**< expression start */\n  LEXER_PROPERTY_GETTER, /**< property getter function */\n  LEXER_PROPERTY_SETTER, /**< property setter function */\n  LEXER_COMMA_SEP_LIST, /**< comma separated bracketed expression list */\n  LEXER_ASSIGN_GROUP_EXPR, /**< indetifier for the assignment is located in a group expression */\n  LEXER_ASSIGN_CONST, /**< a const binding is reassigned */\n  LEXER_INVALID_PATTERN, /**< special value for invalid destructuring pattern */\n  LEXER_PRIVATE_PRIMARY_EXPR, /**< private field in primary expession position */\n  LEXER_ASSIGN_REFERENCE, /**< special value for reference assignment */\n\n  /* Keywords which are not keyword tokens. */\n  LEXER_KEYW_ASYNC, /**< async */\n#if JERRY_MODULE_SYSTEM\n  LEXER_KEYW_META, /**< meta */\n#endif /* JERRY_MODULE_SYSTEM */\n\n/* Keywords which cannot be assigned in strict mode. */\n#define LEXER_FIRST_NON_STRICT_ARGUMENTS LEXER_KEYW_EVAL\n  LEXER_KEYW_EVAL, /**< eval */\n  LEXER_KEYW_ARGUMENTS, /**< arguments */\n\n/* Future strict reserved words: these keywords\n * must form a group after non-reserved keywords. */\n#define LEXER_FIRST_FUTURE_STRICT_RESERVED_WORD LEXER_KEYW_IMPLEMENTS\n  LEXER_KEYW_IMPLEMENTS, /**< implements */\n  LEXER_KEYW_PRIVATE, /**< private */\n  LEXER_KEYW_PUBLIC, /**< public */\n  LEXER_KEYW_INTERFACE, /**< interface */\n  LEXER_KEYW_PACKAGE, /**< package */\n  LEXER_KEYW_PROTECTED, /**< protected */\n\n  /* Context dependent future strict reserved words:\n   * See also: ECMA-262 v6, 11.6.2.1 */\n  LEXER_KEYW_LET, /**< let */\n  LEXER_KEYW_YIELD, /**< yield */\n  LEXER_KEYW_STATIC, /**< static */\n} lexer_token_type_t;\n\n#define LEXER_NEWLINE_LS_PS_BYTE_1 0xe2\n#define LEXER_NEWLINE_LS_PS_BYTE_23(source) \\\n  ((source)[1] == LIT_UTF8_2_BYTE_CODE_POINT_MIN && ((source)[2] | 0x1) == 0xa9)\n\n#define LEXER_IS_LEFT_BRACKET(type) \\\n  ((type) == LEXER_LEFT_BRACE || (type) == LEXER_LEFT_PAREN || (type) == LEXER_LEFT_SQUARE)\n\n#define LEXER_IS_RIGHT_BRACKET(type) \\\n  ((type) == LEXER_RIGHT_BRACE || (type) == LEXER_RIGHT_PAREN || (type) == LEXER_RIGHT_SQUARE)\n\n#define LEXER_UNARY_OP_TOKEN_TO_OPCODE(token_type) ((((token_type) -LEXER_PLUS) * 2) + CBC_PLUS)\n\n#define LEXER_UNARY_LVALUE_OP_TOKEN_TO_OPCODE(token_type) ((((token_type) -LEXER_INCREASE) * 6) + CBC_PRE_INCR)\n\n#define LEXER_BINARY_OP_TOKEN_TO_OPCODE(token_type) ((uint16_t) ((((token_type) -LEXER_BIT_OR) * 3) + CBC_BIT_OR))\n\n#define LEXER_BINARY_LVALUE_OP_TOKEN_TO_OPCODE(token_type) \\\n  ((cbc_opcode_t) ((((token_type) -LEXER_ASSIGN_ADD) * 2) + CBC_ASSIGN_ADD))\n\n/**\n * Maximum local buffer size for identifiers which contains escape sequences.\n */\n#define LEXER_MAX_LITERAL_LOCAL_BUFFER_SIZE 48\n\n/**\n * Lexer newline flags.\n */\ntypedef enum\n{\n  LEXER_WAS_NEWLINE = (1u << 0), /**< newline was seen */\n  LEXER_NO_SKIP_SPACES = (1u << 1) /**< ignore skip spaces */\n} lexer_newline_flags_t;\n\n/**\n * Lexer object identifier parse options.\n */\ntypedef enum\n{\n  LEXER_OBJ_IDENT_NO_OPTS = 0, /**< no options */\n  LEXER_OBJ_IDENT_ONLY_IDENTIFIERS = (1u << 0), /**< only identifiers are accepted */\n  LEXER_OBJ_IDENT_CLASS_IDENTIFIER = (1u << 1), /**< expect identifier inside a class body */\n  LEXER_OBJ_IDENT_CLASS_NO_STATIC = (1u << 2), /**< static keyword was not present before the identifier */\n  LEXER_OBJ_IDENT_OBJECT_PATTERN = (1u << 3), /**< parse \"get\"/\"set\" as string literal in object pattern */\n  LEXER_OBJ_IDENT_CLASS_PRIVATE = (1u << 4), /**< static keyword was not present before the identifier */\n#if JERRY_FUNCTION_TO_STRING\n  LEXER_OBJ_IDENT_SET_FUNCTION_START = (1u << 5), /**< set function start */\n#else /* !JERRY_FUNCTION_TO_STRING */\n  LEXER_OBJ_IDENT_SET_FUNCTION_START = 0, /**< set function start (disabled) */\n#endif /* JERRY_FUNCTION_TO_STRING */\n} lexer_obj_ident_opts_t;\n\n/**\n * Lexer string options.\n */\ntypedef enum\n{\n  LEXER_STRING_NO_OPTS = (1u << 0), /**< no options */\n  LEXER_STRING_RAW = (1u << 1), /**< raw string ECMAScript v6, 11.8.6.1: TVR */\n} lexer_string_options_t;\n\n/**\n * Lexer number types.\n */\ntypedef enum\n{\n  LEXER_NUMBER_DECIMAL, /**< decimal number */\n  LEXER_NUMBER_HEXADECIMAL, /**< hexadecimal number */\n  LEXER_NUMBER_OCTAL, /**< octal number */\n  LEXER_NUMBER_BINARY, /**< binary number */\n#if JERRY_BUILTIN_BIGINT\n  LEXER_NUMBER_BIGINT, /**< bigint number */\n#endif /* JERRY_BUILTIN_BIGINT */\n} lexer_number_type_t;\n\n/**\n * Lexer literal flags.\n **/\ntypedef enum\n{\n  LEXER_LIT_LOCATION_NO_OPTS = 0, /**< no options */\n  LEXER_LIT_LOCATION_HAS_ESCAPE = (1 << 0), /**< binding has escape */\n  LEXER_LIT_LOCATION_IS_ASCII = (1 << 1), /**< all characters are ascii characters */\n} lexer_lit_location_flags_t;\n\n/**\n * Lexer character (string / identifier) literal data.\n */\ntypedef struct\n{\n  const uint8_t *char_p; /**< start of identifier or string token */\n  prop_length_t length; /**< length or index of a literal */\n  uint8_t type; /**< type of the current literal */\n  uint8_t status_flags; /**< any combination of lexer_lit_location_flags_t status bits */\n} lexer_lit_location_t;\n\n/**\n * Lexer token.\n */\ntypedef struct\n{\n  uint8_t type; /**< token type */\n  uint8_t keyword_type; /**< keyword type for identifiers */\n  uint8_t extra_value; /**< helper value for different purposes */\n  uint8_t flags; /**< flag bits for the current token */\n  parser_line_counter_t line; /**< token start line */\n  parser_line_counter_t column; /**< token start column */\n  lexer_lit_location_t lit_location; /**< extra data for character literals */\n} lexer_token_t;\n\n/**\n * Literal data set by lexer_construct_literal_object.\n */\ntypedef struct\n{\n  lexer_literal_t *literal_p; /**< pointer to the literal object */\n  uint16_t index; /**< literal index */\n} lexer_lit_object_t;\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* !JS_LEXER_H */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser-expr.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"js-parser-internal.h\"\n\n#if JERRY_PARSER\n#include \"ecma-helpers.h\"\n\n#include \"jcontext.h\"\n#include \"js-parser-tagged-template-literal.h\"\n#include \"lit-char-helpers.h\"\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_expr Expression parser\n * @{\n */\n\n/**\n * Maximum precedence for right-to-left binary operation evaluation.\n */\n#define PARSER_RIGHT_TO_LEFT_ORDER_MAX_PRECEDENCE 7\n\n/**\n * Precedence for ternary operation.\n */\n#define PARSER_RIGHT_TO_LEFT_ORDER_TERNARY_PRECEDENCE 4\n\n/**\n * Precedence for exponentiation operation.\n */\n#define PARSER_RIGHT_TO_LEFT_ORDER_EXPONENTIATION 16\n\n/**\n * Value of grouping level increase and decrease.\n */\n#define PARSER_GROUPING_LEVEL_INCREASE 2\n\n/**\n * Precedence of the binary tokens.\n *\n * See also:\n *    lexer_token_type_t\n */\nstatic const uint8_t parser_binary_precedence_table[] = {\n  3, /**< \"=\" */\n  3, /**< \"+=\" */\n  3, /**< \"-=\" */\n  3, /**< \"*=\" */\n  3, /**< \"/=\" */\n  3, /**< \"=\" */\n  3, /**< \"<<=\" */\n  3, /**< \">>=\" */\n  3, /**< \">>>=\" */\n  3, /**< \"&=\" */\n  3, /**< \"|=\" */\n  3, /**< \"^=\" */\n  3, /**< \"**=\" */\n  3, /**< \"??=\" */\n  3, /**< \"||=\" */\n  3, /**< \"&&=\" */\n  4, /**< \"?\"*/\n  5, /**< \"??\" */\n  6, /**< \"||\" */\n  7, /**< \"&&\" */\n  8, /**< \"|\" */\n  9, /**< \"^\" */\n  10, /**< \"&\" */\n  11, /**< \"==\" */\n  11, /**< \"!=\" */\n  11, /**< \"===\" */\n  11, /**< \"!==\" */\n  12, /**< \"<\" */\n  12, /**< \">\" */\n  12, /**< \"<=\" */\n  12, /**< \">=\" */\n  12, /**< in */\n  12, /**< instanceof */\n  13, /**< \"<<\" */\n  13, /**< \">>\" */\n  13, /**< \">>>\" */\n  14, /**< \"+\" */\n  14, /**< \"-\" */\n  15, /**< \"*\" */\n  15, /**< \"/\" */\n  15, /**< \"%\" */\n  16, /**< \"**\" */\n};\n\nJERRY_STATIC_ASSERT (sizeof (parser_binary_precedence_table) == 42,\n                     parser_binary_precedence_table_should_have_39_values_in_es2015);\n\n/**\n * Call reference status flags\n */\ntypedef enum\n{\n  PARSER_CALL_REFERENCE_NONE = 0, /**< no options are present */\n  PARSER_CALL_REFERENCE_DIRECT_EVAL = (1 << 0), /**< direct eval call */\n  PARSER_CALL_REFERENCE_SPREAD = (1 << 1), /**< spread call */\n} parser_call_reference_flags_t;\n\n/**\n * Call reference\n */\ntypedef struct\n{\n  size_t call_arguments; /**< number of call arguments */\n  uint16_t status_flags; /**< any combination of parser_call_reference_flags_t */\n  uint16_t opcode; /**< call opcode */\n} parser_call_reference_t;\n\nstatic void parser_parse_postfix_expresion (parser_context_t *context_p, size_t *grouping_level_p);\nstatic parser_call_reference_t parser_form_call_reference (parser_context_t *context_p);\nstatic bool parser_process_group_expression (parser_context_t *context_p, size_t *grouping_level_p);\n\n/**\n * Generate byte code for operators with lvalue.\n */\nstatic inline void\nparser_push_result (parser_context_t *context_p) /**< context */\n{\n  if (CBC_NO_RESULT_OPERATION (context_p->last_cbc_opcode))\n  {\n    JERRY_ASSERT (CBC_SAME_ARGS (context_p->last_cbc_opcode, context_p->last_cbc_opcode + 1));\n\n    if ((context_p->last_cbc_opcode == CBC_POST_INCR || context_p->last_cbc_opcode == CBC_POST_DECR)\n        && context_p->stack_depth >= context_p->stack_limit)\n    {\n      /* Stack limit is increased for CBC_POST_INCR_PUSH_RESULT\n       * and CBC_POST_DECR_PUSH_RESULT opcodes. Needed by vm.c. */\n      JERRY_ASSERT (context_p->stack_depth == context_p->stack_limit);\n\n      context_p->stack_limit++;\n\n      if (context_p->stack_limit > PARSER_MAXIMUM_STACK_LIMIT)\n      {\n        parser_raise_error (context_p, PARSER_ERR_STACK_LIMIT_REACHED);\n      }\n    }\n\n    context_p->last_cbc_opcode++;\n    parser_flush_cbc (context_p);\n  }\n} /* parser_push_result */\n\n/**\n * Check for invalid assignment for \"eval\" and \"arguments\"\n */\nstatic void\nparser_check_invalid_assign (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL);\n\n  if (JERRY_UNLIKELY (context_p->status_flags & PARSER_IS_STRICT))\n  {\n    if (context_p->last_cbc.literal_keyword_type == LEXER_KEYW_EVAL)\n    {\n      parser_raise_error (context_p, PARSER_ERR_EVAL_CANNOT_ASSIGNED);\n    }\n    else if (context_p->last_cbc.literal_keyword_type == LEXER_KEYW_ARGUMENTS)\n    {\n      parser_raise_error (context_p, PARSER_ERR_ARGUMENTS_CANNOT_ASSIGNED);\n    }\n  }\n} /* parser_check_invalid_assign */\n\n/**\n * Check and throw an error if the \"new.target\" is invalid as a left-hand side expression.\n */\nstatic void\nparser_check_invalid_new_target (parser_context_t *context_p, /**< parser context */\n                                 cbc_opcode_t opcode) /**< current opcode under parsing */\n{\n  /* new.target is an invalid left-hand side target */\n  if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_NEW_TARGET))\n  {\n    /* Make sure that the call side is a post/pre increment or an assignment expression.\n     * There should be no other ways the \"new.target\" expression should be here. */\n    JERRY_ASSERT (\n      (opcode >= CBC_PRE_INCR && opcode <= CBC_POST_DECR)\n      || (opcode == CBC_ASSIGN\n          && (context_p->token.type == LEXER_ASSIGN || LEXER_IS_BINARY_LVALUE_OP_TOKEN (context_p->token.type))));\n\n    parser_raise_error (context_p, PARSER_ERR_NEW_TARGET_NOT_ALLOWED);\n  }\n} /* parser_check_invalid_new_target */\n\n/**\n * Emit identifier reference\n */\nstatic void\nparser_emit_ident_reference (parser_context_t *context_p, /**< context */\n                             uint16_t opcode) /* opcode */\n{\n  if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n  {\n    context_p->last_cbc_opcode = opcode;\n    return;\n  }\n\n  uint16_t literal_index;\n\n  if (context_p->last_cbc_opcode == CBC_PUSH_TWO_LITERALS)\n  {\n    context_p->last_cbc_opcode = CBC_PUSH_LITERAL;\n    literal_index = context_p->last_cbc.value;\n  }\n  else if (context_p->last_cbc_opcode == CBC_PUSH_THIS_LITERAL)\n  {\n    context_p->last_cbc_opcode = CBC_PUSH_THIS;\n    literal_index = context_p->last_cbc.literal_index;\n  }\n  else\n  {\n    JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_THREE_LITERALS);\n    context_p->last_cbc_opcode = CBC_PUSH_TWO_LITERALS;\n    literal_index = context_p->last_cbc.third_literal_index;\n  }\n\n  parser_emit_cbc_literal (context_p, opcode, literal_index);\n} /* parser_emit_ident_reference */\n\n/**\n * Generate byte code for operators with lvalue.\n */\nstatic void\nparser_emit_unary_lvalue_opcode (parser_context_t *context_p, /**< context */\n                                 cbc_opcode_t opcode) /**< opcode */\n{\n  if (PARSER_IS_PUSH_LITERALS_WITH_THIS (context_p->last_cbc_opcode)\n      && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL)\n  {\n    parser_check_invalid_assign (context_p);\n\n    uint16_t unary_opcode;\n\n    if (opcode == CBC_DELETE_PUSH_RESULT)\n    {\n      if (JERRY_UNLIKELY (context_p->status_flags & PARSER_IS_STRICT))\n      {\n        parser_raise_error (context_p, PARSER_ERR_DELETE_IDENT_NOT_ALLOWED);\n      }\n\n      unary_opcode = CBC_DELETE_IDENT_PUSH_RESULT;\n    }\n    else\n    {\n      JERRY_ASSERT (CBC_SAME_ARGS (CBC_PUSH_LITERAL, opcode + CBC_UNARY_LVALUE_WITH_IDENT));\n      unary_opcode = (uint16_t) (opcode + CBC_UNARY_LVALUE_WITH_IDENT);\n    }\n\n    parser_emit_ident_reference (context_p, unary_opcode);\n\n    if (unary_opcode != CBC_DELETE_IDENT_PUSH_RESULT\n        && scanner_literal_is_const_reg (context_p, context_p->last_cbc.literal_index))\n    {\n      /* The current value must be read, but it cannot be changed. */\n      context_p->last_cbc_opcode = CBC_PUSH_LITERAL;\n      parser_emit_cbc_ext (context_p, CBC_EXT_THROW_ASSIGN_CONST_ERROR);\n    }\n    return;\n  }\n\n  if (context_p->last_cbc_opcode == CBC_PUSH_PROP)\n  {\n    JERRY_ASSERT (CBC_SAME_ARGS (CBC_PUSH_PROP, opcode));\n    context_p->last_cbc_opcode = (uint16_t) opcode;\n    return;\n  }\n\n  if (PARSER_IS_PUSH_PROP_LITERAL (context_p->last_cbc_opcode))\n  {\n    context_p->last_cbc_opcode = PARSER_PUSH_PROP_LITERAL_TO_PUSH_LITERAL (context_p->last_cbc_opcode);\n  }\n  else\n  {\n    /* Invalid LeftHandSide expression. */\n    if (opcode == CBC_DELETE_PUSH_RESULT)\n    {\n      if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_PRIVATE_PROP_LITERAL))\n      {\n        parser_raise_error (context_p, PARSER_ERR_DELETE_PRIVATE_FIELD);\n      }\n\n      if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_PROP_LITERAL)\n          || context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_PROP))\n      {\n        parser_emit_cbc_ext (context_p, CBC_EXT_THROW_REFERENCE_ERROR);\n        parser_emit_cbc (context_p, CBC_POP);\n        return;\n      }\n\n      parser_emit_cbc (context_p, CBC_POP);\n      parser_emit_cbc (context_p, CBC_PUSH_TRUE);\n      return;\n    }\n\n    parser_check_invalid_new_target (context_p, opcode);\n    if (opcode == CBC_PRE_INCR || opcode == CBC_PRE_DECR)\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_LHS_PREFIX_OP);\n    }\n    else\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_LHS_POSTFIX_OP);\n    }\n  }\n\n  parser_emit_cbc (context_p, (uint16_t) opcode);\n} /* parser_emit_unary_lvalue_opcode */\n\n/**\n * Parse array literal.\n */\nstatic void\nparser_parse_array_literal (parser_context_t *context_p) /**< context */\n{\n  uint32_t pushed_items = 0;\n  uint16_t opcode = (uint16_t) CBC_ARRAY_APPEND;\n\n  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_SQUARE);\n\n  parser_emit_cbc (context_p, CBC_CREATE_ARRAY);\n  lexer_next_token (context_p);\n\n  while (true)\n  {\n    if (context_p->token.type == LEXER_RIGHT_SQUARE)\n    {\n      if (pushed_items > 0)\n      {\n        parser_emit_cbc_call (context_p, opcode, pushed_items);\n      }\n      return;\n    }\n\n    pushed_items++;\n\n    if (context_p->token.type == LEXER_COMMA)\n    {\n      parser_emit_cbc (context_p, CBC_PUSH_ELISION);\n      lexer_next_token (context_p);\n    }\n    else\n    {\n      if (context_p->token.type == LEXER_THREE_DOTS)\n      {\n        opcode = (uint16_t) (PARSER_TO_EXT_OPCODE (CBC_EXT_SPREAD_ARRAY_APPEND));\n        pushed_items++;\n        lexer_next_token (context_p);\n        parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_SPREAD_ELEMENT);\n      }\n\n      parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n\n      if (context_p->last_cbc_opcode == CBC_PUSH_THIS)\n      {\n        parser_flush_cbc (context_p);\n      }\n\n      if (context_p->token.type == LEXER_COMMA)\n      {\n        lexer_next_token (context_p);\n      }\n      else if (context_p->token.type != LEXER_RIGHT_SQUARE)\n      {\n        parser_raise_error (context_p, PARSER_ERR_ARRAY_ITEM_SEPARATOR_EXPECTED);\n      }\n    }\n\n    if (pushed_items >= 64)\n    {\n      parser_emit_cbc_call (context_p, opcode, pushed_items);\n      opcode = (uint16_t) CBC_ARRAY_APPEND;\n      pushed_items = 0;\n    }\n  }\n} /* parser_parse_array_literal */\n\n/** Forward definition of parse array initializer. */\nstatic void parser_parse_array_initializer (parser_context_t *context_p, parser_pattern_flags_t flags);\n\n/** Forward definition of parse object initializer. */\nstatic void parser_parse_object_initializer (parser_context_t *context_p, parser_pattern_flags_t flags);\n\n/**\n * Class literal parsing options.\n */\ntypedef enum\n{\n  PARSER_CLASS_LITERAL_NO_OPTS = 0, /**< no options are provided */\n  PARSER_CLASS_LITERAL_CTOR_PRESENT = (1 << 0), /**< class constructor is present */\n  PARSER_CLASS_LITERAL_HERTIAGE_PRESENT = (1 << 1), /**< class heritage is present */\n} parser_class_literal_opts_t;\n\n/**\n * Checks whether the current string or identifier literal is constructor\n *\n * @return true, if constructor and false otherwise\n */\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\nparser_is_constructor_literal (parser_context_t *context_p) /**< context */\n{\n  return (LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type)\n          && lexer_compare_literal_to_string (context_p, \"constructor\", 11));\n} /* parser_is_constructor_literal */\n\n/**\n * Checks if current private field is already declared\n */\nstatic void\nparser_check_duplicated_private_field (parser_context_t *context_p, /**< context */\n                                       uint8_t opts) /**< options */\n{\n  if (context_p->token.type != LEXER_LITERAL)\n  {\n    parser_raise_error (context_p, PARSER_ERR_EXPRESSION_EXPECTED);\n  }\n  JERRY_ASSERT (context_p->private_context_p);\n  scanner_class_private_member_t *iter = context_p->private_context_p->members_p;\n\n  bool search_for_property = (opts & SCANNER_PRIVATE_FIELD_PROPERTY);\n\n  while (iter != NULL)\n  {\n    if (lexer_compare_identifiers (context_p, &context_p->token.lit_location, &iter->loc) && (iter->u8_arg & opts))\n    {\n      if (iter->u8_arg & SCANNER_PRIVATE_FIELD_SEEN)\n      {\n        parser_raise_error (context_p, PARSER_ERR_DUPLICATED_PRIVATE_FIELD);\n      }\n\n      iter->u8_arg |= SCANNER_PRIVATE_FIELD_SEEN;\n\n      if (!search_for_property)\n      {\n        break;\n      }\n    }\n\n    iter = iter->prev_p;\n  }\n} /* parser_check_duplicated_private_field */\n\n/**\n * Parse class literal.\n *\n * @return true - if the class has static fields, false - otherwise\n */\nstatic bool\nparser_parse_class_body (parser_context_t *context_p, /**< context */\n                         parser_class_literal_opts_t opts, /**< class literal parsing options */\n                         uint16_t class_name_index) /**< class literal index */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_BRACE);\n\n  lexer_literal_t *ctor_literal_p = NULL;\n  lexer_literal_t *static_fields_literal_p = NULL;\n\n  if (opts & PARSER_CLASS_LITERAL_CTOR_PRESENT)\n  {\n    ctor_literal_p = lexer_construct_unused_literal (context_p);\n    parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, (uint16_t) (context_p->literal_count++));\n  }\n  else if (opts & PARSER_CLASS_LITERAL_HERTIAGE_PRESENT)\n  {\n    parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR_HERITAGE);\n  }\n  else\n  {\n    parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR);\n  }\n\n  if (class_name_index != PARSER_INVALID_LITERAL_INDEX)\n  {\n    parser_emit_cbc_ext_literal (context_p, CBC_EXT_SET_CLASS_NAME, class_name_index);\n  }\n\n  parser_emit_cbc_ext (context_p, CBC_EXT_INIT_CLASS);\n\n  bool is_static = false;\n  bool is_private = false;\n  size_t fields_size = 0;\n  uint32_t computed_field_count = 0;\n\n  while (true)\n  {\n    if (!is_static)\n    {\n      lexer_skip_empty_statements (context_p);\n    }\n\n    uint32_t flags = (LEXER_OBJ_IDENT_CLASS_IDENTIFIER | LEXER_OBJ_IDENT_SET_FUNCTION_START);\n\n    if (!is_static)\n    {\n      flags |= LEXER_OBJ_IDENT_CLASS_NO_STATIC;\n    }\n\n    if (is_private)\n    {\n      flags |= LEXER_OBJ_IDENT_CLASS_PRIVATE;\n    }\n\n    lexer_expect_object_literal_id (context_p, flags);\n\n    if (context_p->token.type == LEXER_RIGHT_BRACE)\n    {\n      JERRY_ASSERT (!is_static);\n      break;\n    }\n\n    if (context_p->token.type == LEXER_HASHMARK)\n    {\n      is_private = true;\n      lexer_next_token (context_p);\n      context_p->token.flags |= LEXER_NO_SKIP_SPACES;\n      continue;\n    }\n\n    if (context_p->token.type == LEXER_KEYW_STATIC)\n    {\n      JERRY_ASSERT (!is_static);\n      is_static = true;\n      continue;\n    }\n\n    bool is_constructor_literal = false;\n\n    if (context_p->token.type == LEXER_LITERAL)\n    {\n      is_constructor_literal = parser_is_constructor_literal (context_p);\n\n      if (is_private)\n      {\n        if (is_constructor_literal && lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))\n        {\n          parser_raise_error (context_p, PARSER_ERR_CLASS_PRIVATE_CONSTRUCTOR);\n        }\n\n        parser_check_duplicated_private_field (context_p, SCANNER_PRIVATE_FIELD_PROPERTY_GETTER_SETTER);\n      }\n    }\n\n    if (!is_static && is_constructor_literal)\n    {\n      JERRY_ASSERT (!is_static);\n      JERRY_ASSERT (opts & PARSER_CLASS_LITERAL_CTOR_PRESENT);\n      JERRY_ASSERT (ctor_literal_p != NULL);\n\n      if (ctor_literal_p->type == LEXER_FUNCTION_LITERAL)\n      {\n        /* 14.5.1 */\n        parser_raise_error (context_p, PARSER_ERR_MULTIPLE_CLASS_CONSTRUCTORS);\n      }\n\n      uint32_t constructor_status_flags =\n        (PARSER_FUNCTION_CLOSURE | PARSER_ALLOW_SUPER | PARSER_CLASS_CONSTRUCTOR | PARSER_LEXICAL_ENV_NEEDED);\n\n      if (opts & PARSER_CLASS_LITERAL_HERTIAGE_PRESENT)\n      {\n        constructor_status_flags |= PARSER_ALLOW_SUPER_CALL;\n      }\n\n      if (context_p->status_flags & PARSER_INSIDE_WITH)\n      {\n        constructor_status_flags |= PARSER_INSIDE_WITH;\n      }\n\n      parser_flush_cbc (context_p);\n      ecma_compiled_code_t *compiled_code_p = parser_parse_function (context_p, constructor_status_flags);\n      ctor_literal_p->u.bytecode_p = compiled_code_p;\n      ctor_literal_p->type = LEXER_FUNCTION_LITERAL;\n      continue;\n    }\n\n    bool is_computed = false;\n\n    if (context_p->token.type == LEXER_PROPERTY_GETTER || context_p->token.type == LEXER_PROPERTY_SETTER)\n    {\n      uint16_t literal_index, function_literal_index;\n      bool is_getter = (context_p->token.type == LEXER_PROPERTY_GETTER);\n\n      uint32_t accessor_status_flags = PARSER_FUNCTION_CLOSURE | PARSER_ALLOW_SUPER;\n      accessor_status_flags |= (is_getter ? PARSER_IS_PROPERTY_GETTER : PARSER_IS_PROPERTY_SETTER);\n\n      uint8_t ident_opts = LEXER_OBJ_IDENT_ONLY_IDENTIFIERS;\n\n      if (lexer_check_next_character (context_p, LIT_CHAR_HASHMARK))\n      {\n        lexer_next_token (context_p);\n        context_p->token.flags |= LEXER_NO_SKIP_SPACES;\n        ident_opts |= LEXER_OBJ_IDENT_CLASS_PRIVATE;\n        is_private = true;\n      }\n\n      lexer_expect_object_literal_id (context_p, ident_opts);\n\n      if (is_private)\n      {\n        parser_check_duplicated_private_field (context_p,\n                                               is_getter ? SCANNER_PRIVATE_FIELD_GETTER : SCANNER_PRIVATE_FIELD_SETTER);\n      }\n\n      literal_index = context_p->lit_object.index;\n\n      if (context_p->token.type == LEXER_RIGHT_SQUARE)\n      {\n        is_computed = true;\n      }\n      else if (is_static && !is_private)\n      {\n        if (LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type)\n            && lexer_compare_identifier_to_string (&context_p->token.lit_location, (uint8_t *) \"prototype\", 9))\n        {\n          parser_raise_error (context_p, PARSER_ERR_CLASS_STATIC_PROTOTYPE);\n        }\n      }\n      else if (parser_is_constructor_literal (context_p))\n      {\n        JERRY_ASSERT (!is_static || is_private);\n        parser_raise_error (context_p, PARSER_ERR_CLASS_CONSTRUCTOR_AS_ACCESSOR);\n      }\n\n      function_literal_index = lexer_construct_function_object (context_p, accessor_status_flags);\n\n      parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, literal_index);\n\n      JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);\n\n      cbc_ext_opcode_t opcode;\n\n      if (is_computed)\n      {\n        context_p->last_cbc.literal_index = function_literal_index;\n\n        if (is_getter)\n        {\n          opcode = is_static ? CBC_EXT_SET_STATIC_COMPUTED_GETTER : CBC_EXT_SET_COMPUTED_GETTER;\n        }\n        else\n        {\n          opcode = is_static ? CBC_EXT_SET_STATIC_COMPUTED_SETTER : CBC_EXT_SET_COMPUTED_SETTER;\n        }\n      }\n      else\n      {\n        context_p->last_cbc.value = function_literal_index;\n\n        if (is_getter)\n        {\n          opcode = is_static ? (is_private ? CBC_EXT_COLLECT_PRIVATE_STATIC_GETTER : CBC_EXT_SET_STATIC_GETTER)\n                             : (is_private ? CBC_EXT_COLLECT_PRIVATE_GETTER : CBC_EXT_SET_GETTER);\n        }\n        else\n        {\n          opcode = is_static ? (is_private ? CBC_EXT_COLLECT_PRIVATE_STATIC_SETTER : CBC_EXT_SET_STATIC_SETTER)\n                             : (is_private ? CBC_EXT_COLLECT_PRIVATE_SETTER : CBC_EXT_SET_SETTER);\n        }\n      }\n\n      if (is_computed)\n      {\n        parser_emit_cbc_ext (context_p,\n                             is_getter ? CBC_EXT_SET_COMPUTED_GETTER_NAME : CBC_EXT_SET_COMPUTED_SETTER_NAME);\n        parser_emit_cbc_ext (context_p, opcode);\n      }\n      else\n      {\n        if (is_private)\n        {\n          accessor_status_flags |= PARSER_PRIVATE_FUNCTION_NAME;\n        }\n        parser_set_function_name (context_p, function_literal_index, literal_index, accessor_status_flags);\n        context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (opcode);\n      }\n\n      is_static = false;\n      is_private = false;\n      continue;\n    }\n\n    uint32_t status_flags = PARSER_FUNCTION_CLOSURE | PARSER_ALLOW_SUPER;\n\n    if (context_p->token.type == LEXER_KEYW_ASYNC)\n    {\n      status_flags |= PARSER_IS_ASYNC_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD;\n\n      uint8_t ident_opts = LEXER_OBJ_IDENT_ONLY_IDENTIFIERS;\n\n      if (lexer_check_next_character (context_p, LIT_CHAR_HASHMARK))\n      {\n        lexer_next_token (context_p);\n        context_p->token.flags |= LEXER_NO_SKIP_SPACES;\n        ident_opts |= LEXER_OBJ_IDENT_CLASS_PRIVATE;\n        is_private = true;\n      }\n\n      if (is_private || !lexer_consume_generator (context_p))\n      {\n        lexer_expect_object_literal_id (context_p, ident_opts);\n      }\n\n      if (is_private && context_p->token.type == LEXER_LITERAL)\n      {\n        if (parser_is_constructor_literal (context_p))\n        {\n          parser_raise_error (context_p, PARSER_ERR_CLASS_PRIVATE_CONSTRUCTOR);\n        }\n\n        parser_check_duplicated_private_field (context_p, SCANNER_PRIVATE_FIELD_PROPERTY_GETTER_SETTER);\n      }\n    }\n\n    if (context_p->token.type == LEXER_MULTIPLY)\n    {\n      uint8_t ident_opts = LEXER_OBJ_IDENT_ONLY_IDENTIFIERS;\n\n      if (lexer_check_next_character (context_p, LIT_CHAR_HASHMARK))\n      {\n        lexer_next_token (context_p);\n        context_p->token.flags |= LEXER_NO_SKIP_SPACES;\n        ident_opts |= LEXER_OBJ_IDENT_CLASS_PRIVATE;\n        is_private = true;\n      }\n\n      lexer_expect_object_literal_id (context_p, ident_opts);\n\n      status_flags |= PARSER_IS_GENERATOR_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD;\n\n      if (is_private && context_p->token.type == LEXER_LITERAL)\n      {\n        if (parser_is_constructor_literal (context_p))\n        {\n          parser_raise_error (context_p, PARSER_ERR_CLASS_PRIVATE_CONSTRUCTOR);\n        }\n\n        parser_check_duplicated_private_field (context_p, SCANNER_PRIVATE_FIELD_PROPERTY_GETTER_SETTER);\n      }\n    }\n\n    bool is_static_block = context_p->token.type == LEXER_LEFT_BRACE;\n\n    if (context_p->token.type == LEXER_RIGHT_SQUARE)\n    {\n      is_computed = true;\n    }\n    else if (!is_static_block && LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type))\n    {\n      if (is_static && !is_private)\n      {\n        if (lexer_compare_identifier_to_string (&context_p->token.lit_location, (uint8_t *) \"prototype\", 9))\n        {\n          parser_raise_error (context_p, PARSER_ERR_CLASS_STATIC_PROTOTYPE);\n        }\n      }\n      else if ((status_flags & (PARSER_IS_ASYNC_FUNCTION | PARSER_IS_GENERATOR_FUNCTION))\n               && lexer_compare_literal_to_string (context_p, \"constructor\", 11))\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_CLASS_CONSTRUCTOR);\n      }\n    }\n\n    if (!(status_flags & (PARSER_IS_ASYNC_FUNCTION | PARSER_IS_GENERATOR_FUNCTION)))\n    {\n      if (is_static_block || !lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))\n      {\n        /* Class field. */\n        if (fields_size == 0)\n        {\n          parser_stack_push_uint8 (context_p, PARSER_CLASS_FIELD_END);\n        }\n\n        scanner_range_t range;\n        uint8_t class_field_type = is_static ? PARSER_CLASS_FIELD_STATIC : 0;\n\n        if (!is_computed)\n        {\n          if (is_private)\n          {\n            lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_STRING_LITERAL);\n            uint8_t field_opcode = is_static ? CBC_EXT_COLLECT_PRIVATE_STATIC_FIELD : CBC_EXT_COLLECT_PRIVATE_FIELD;\n            parser_emit_cbc_ext_literal_from_token (context_p, field_opcode);\n          }\n\n          if (is_static && !is_static_block && parser_is_constructor_literal (context_p))\n          {\n            parser_raise_error (context_p, PARSER_ERR_ARGUMENT_LIST_EXPECTED);\n          }\n\n          range.start_location.source_p = context_p->token.lit_location.char_p;\n          range.start_location.line = context_p->token.line;\n          range.start_location.column = context_p->token.column;\n          class_field_type |= PARSER_CLASS_FIELD_NORMAL;\n\n          if (context_p->token.lit_location.type == LEXER_STRING_LITERAL)\n          {\n            range.start_location.source_p--;\n          }\n        }\n        else\n        {\n          if (++computed_field_count > ECMA_INTEGER_NUMBER_MAX)\n          {\n            parser_raise_error (context_p, PARSER_ERR_TOO_MANY_CLASS_FIELDS);\n          }\n\n          if (is_static && static_fields_literal_p == NULL)\n          {\n            static_fields_literal_p = lexer_construct_unused_literal (context_p);\n            parser_emit_cbc_ext_literal (context_p,\n                                         CBC_EXT_PUSH_STATIC_COMPUTED_FIELD_FUNC,\n                                         (uint16_t) (context_p->literal_count++));\n          }\n          else\n          {\n            parser_emit_cbc_ext (context_p,\n                                 (is_static ? CBC_EXT_ADD_STATIC_COMPUTED_FIELD : CBC_EXT_ADD_COMPUTED_FIELD));\n          }\n        }\n\n        if (is_static_block)\n        {\n          class_field_type |= PARSER_CLASS_FIELD_STATIC_BLOCK;\n\n          if (context_p->next_scanner_info_p->type != SCANNER_TYPE_CLASS_STATIC_BLOCK_END)\n          {\n            parser_flush_cbc (context_p);\n            parser_parse_class_static_block (context_p);\n          }\n\n          JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_CLASS_STATIC_BLOCK_END);\n\n          scanner_set_location (context_p, &((scanner_location_info_t *) context_p->next_scanner_info_p)->location);\n          scanner_release_next (context_p, sizeof (scanner_location_info_t));\n          JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);\n          range.start_location.source_p = context_p->next_scanner_info_p->source_p - 1;\n\n          scanner_seek (context_p);\n\n          parser_stack_push (context_p, &range.start_location, sizeof (scanner_location_t));\n          fields_size += sizeof (scanner_location_t);\n\n          lexer_consume_next_character (context_p);\n        }\n        else if (lexer_consume_assign (context_p))\n        {\n          class_field_type |= PARSER_CLASS_FIELD_INITIALIZED;\n\n          if (context_p->next_scanner_info_p->source_p != context_p->source_p)\n          {\n            lexer_next_token (context_p);\n            parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n            parser_raise_error (context_p, PARSER_ERR_SEMICOLON_EXPECTED);\n          }\n\n          if (is_computed)\n          {\n            scanner_get_location (&range.start_location, context_p);\n          }\n\n          JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_CLASS_FIELD_INITIALIZER_END);\n          range.source_end_p = ((scanner_location_info_t *) context_p->next_scanner_info_p)->location.source_p;\n\n          scanner_set_location (context_p, &((scanner_location_info_t *) context_p->next_scanner_info_p)->location);\n          scanner_release_next (context_p, sizeof (scanner_location_info_t));\n          scanner_seek (context_p);\n\n          parser_stack_push (context_p, &range, sizeof (scanner_range_t));\n          fields_size += sizeof (scanner_range_t);\n        }\n        else\n        {\n          if (!(context_p->token.flags & LEXER_WAS_NEWLINE)\n              && !lexer_check_next_characters (context_p, LIT_CHAR_SEMICOLON, LIT_CHAR_RIGHT_BRACE))\n          {\n            lexer_next_token (context_p);\n            parser_raise_error (context_p, PARSER_ERR_SEMICOLON_EXPECTED);\n          }\n\n          if (!is_computed)\n          {\n            parser_stack_push (context_p, &range.start_location, sizeof (scanner_location_t));\n            fields_size += sizeof (scanner_location_t);\n          }\n        }\n\n        parser_stack_push_uint8 (context_p, class_field_type);\n        fields_size++;\n        is_static = false;\n        is_private = false;\n        continue;\n      }\n\n      if (!is_computed)\n      {\n        if (context_p->token.lit_location.type != LEXER_NUMBER_LITERAL)\n        {\n          JERRY_ASSERT (context_p->token.lit_location.type == LEXER_IDENT_LITERAL\n                        || context_p->token.lit_location.type == LEXER_STRING_LITERAL);\n          if (is_private)\n          {\n            parser_resolve_private_identifier (context_p);\n          }\n          else\n          {\n            lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_STRING_LITERAL);\n          }\n        }\n        else\n        {\n          lexer_construct_number_object (context_p, false, false);\n        }\n      }\n    }\n\n    uint16_t literal_index = context_p->lit_object.index;\n    uint16_t function_literal_index = lexer_construct_function_object (context_p, status_flags | PARSER_IS_METHOD);\n\n    parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, function_literal_index);\n\n    if (is_computed)\n    {\n      parser_emit_cbc_ext (context_p, CBC_EXT_SET_COMPUTED_FUNCTION_NAME);\n      parser_emit_cbc_ext (context_p, is_static ? CBC_EXT_SET_STATIC_COMPUTED_PROPERTY : CBC_EXT_SET_COMPUTED_PROPERTY);\n      is_static = false;\n      continue;\n    }\n\n    uint32_t function_name_status_flags = 0;\n\n    if (is_private)\n    {\n      function_name_status_flags = PARSER_PRIVATE_FUNCTION_NAME;\n    }\n\n    parser_set_function_name (context_p, function_literal_index, literal_index, function_name_status_flags);\n\n    JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);\n\n    context_p->last_cbc.value = literal_index;\n\n    if (is_static)\n    {\n      context_p->last_cbc_opcode = (is_private ? PARSER_TO_EXT_OPCODE (CBC_EXT_COLLECT_PRIVATE_STATIC_METHOD)\n                                               : PARSER_TO_EXT_OPCODE (CBC_EXT_SET_STATIC_PROPERTY_LITERAL));\n      is_static = false;\n    }\n    else if (is_private)\n    {\n      context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_COLLECT_PRIVATE_METHOD);\n    }\n    else\n    {\n      context_p->last_cbc_opcode = CBC_SET_LITERAL_PROPERTY;\n    }\n\n    is_private = false;\n  }\n\n  if (fields_size == 0)\n  {\n    return false;\n  }\n\n  parser_reverse_class_fields (context_p, fields_size);\n\n  /* Since PARSER_IS_ARROW_FUNCTION and PARSER_CLASS_CONSTRUCTOR bits cannot\n   * be set at the same time, this bit combination triggers class field parsing. */\n\n  if (!(context_p->stack_top_uint8 & PARSER_CLASS_FIELD_STATIC))\n  {\n    lexer_literal_t *literal_p = lexer_construct_unused_literal (context_p);\n\n    uint16_t function_literal_index = (uint16_t) (context_p->literal_count++);\n    parser_emit_cbc_ext_literal (context_p, CBC_EXT_SET_FIELD_INIT, function_literal_index);\n    parser_flush_cbc (context_p);\n\n    literal_p->u.bytecode_p = parser_parse_class_fields (context_p);\n    literal_p->type = LEXER_FUNCTION_LITERAL;\n  }\n\n  bool has_static_field = false;\n\n  if (context_p->stack_top_uint8 & PARSER_CLASS_FIELD_STATIC)\n  {\n    if (static_fields_literal_p == NULL)\n    {\n      static_fields_literal_p = lexer_construct_unused_literal (context_p);\n      uint16_t function_literal_index = (uint16_t) (context_p->literal_count++);\n      parser_emit_cbc_ext_literal (context_p, CBC_EXT_PUSH_STATIC_FIELD_FUNC, function_literal_index);\n    }\n\n    parser_flush_cbc (context_p);\n    static_fields_literal_p->u.bytecode_p = parser_parse_class_fields (context_p);\n    static_fields_literal_p->type = LEXER_FUNCTION_LITERAL;\n\n    has_static_field = true;\n  }\n\n  parser_stack_pop_uint8 (context_p);\n  return has_static_field;\n} /* parser_parse_class_body */\n\n/**\n * Parse class statement or expression.\n */\nvoid\nparser_parse_class (parser_context_t *context_p, /**< context */\n                    bool is_statement) /**< true - if class is parsed as a statement\n                                        *   false - otherwise (as an expression) */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_KEYW_CLASS);\n\n  uint16_t class_ident_index = PARSER_INVALID_LITERAL_INDEX;\n  uint16_t class_name_index = PARSER_INVALID_LITERAL_INDEX;\n  parser_class_literal_opts_t opts = PARSER_CLASS_LITERAL_NO_OPTS;\n  scanner_info_t *scanner_info_p = context_p->next_scanner_info_p;\n\n  scanner_class_info_t *class_info_p = (scanner_class_info_t *) scanner_info_p;\n  parser_private_context_t private_ctx;\n\n  if (scanner_info_p->source_p == context_p->source_p)\n  {\n    JERRY_ASSERT (scanner_info_p->type == SCANNER_TYPE_CLASS_CONSTRUCTOR);\n    parser_save_private_context (context_p, &private_ctx, class_info_p);\n\n    if (scanner_info_p->u8_arg & SCANNER_CONSTRUCTOR_EXPLICIT)\n    {\n      opts |= PARSER_CLASS_LITERAL_CTOR_PRESENT;\n    }\n\n    scanner_release_next (context_p, sizeof (scanner_class_info_t));\n  }\n\n  if (is_statement)\n  {\n    /* Class statement must contain an identifier. */\n    lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL);\n    JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n    if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n    {\n      JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED);\n      parser_raise_error (context_p, PARSER_ERR_VARIABLE_REDECLARED);\n    }\n    class_ident_index = context_p->lit_object.index;\n\n    lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_NEW_IDENT_LITERAL);\n    context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_USED;\n    class_name_index = context_p->lit_object.index;\n\n#if JERRY_MODULE_SYSTEM\n    parser_module_append_export_name (context_p);\n    context_p->status_flags &= (uint32_t) ~PARSER_MODULE_STORE_IDENT;\n#endif /* JERRY_MODULE_SYSTEM */\n\n    lexer_next_token (context_p);\n  }\n  else\n  {\n    lexer_next_token (context_p);\n\n    /* Class expression may contain an identifier. */\n    if (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n    {\n      lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_NEW_IDENT_LITERAL);\n      context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_USED;\n      class_name_index = context_p->lit_object.index;\n      lexer_next_token (context_p);\n    }\n  }\n\n  if (class_name_index != PARSER_INVALID_LITERAL_INDEX)\n  {\n    if (JERRY_UNLIKELY (context_p->scope_stack_top >= context_p->scope_stack_size))\n    {\n      JERRY_ASSERT (context_p->scope_stack_size == PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK);\n      parser_raise_error (context_p, PARSER_ERR_SCOPE_STACK_LIMIT_REACHED);\n    }\n\n    parser_scope_stack_t *scope_stack_p = context_p->scope_stack_p + context_p->scope_stack_top;\n\n    PARSER_PLUS_EQUAL_U16 (context_p->scope_stack_top, 1);\n    scope_stack_p->map_from = class_name_index;\n    scope_stack_p->map_to = 0;\n\n    parser_emit_cbc_ext_literal (context_p, CBC_EXT_PUSH_NAMED_CLASS_ENV, class_name_index);\n  }\n  else\n  {\n    parser_emit_cbc (context_p, CBC_PUSH_UNDEFINED);\n  }\n\n  bool is_strict = (context_p->status_flags & PARSER_IS_STRICT) != 0;\n\n  /* 14.5. A ClassBody is always strict code. */\n  context_p->status_flags |= PARSER_IS_STRICT;\n\n  if (context_p->token.type == LEXER_KEYW_EXTENDS)\n  {\n    lexer_next_token (context_p);\n    parser_parse_expression (context_p, PARSE_EXPR | PARSE_EXPR_LEFT_HAND_SIDE);\n    opts |= PARSER_CLASS_LITERAL_HERTIAGE_PRESENT;\n  }\n  else\n  {\n    /* Elisions represents that the classHeritage is not present */\n    parser_emit_cbc (context_p, CBC_PUSH_ELISION);\n  }\n\n  if (context_p->token.type != LEXER_LEFT_BRACE)\n  {\n    parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_EXPECTED);\n  }\n\n  context_p->private_context_p->opts |= SCANNER_PRIVATE_FIELD_ACTIVE;\n\n  /* ClassDeclaration is parsed. Continue with class body. */\n  bool has_static_field = parser_parse_class_body (context_p, opts, class_name_index);\n\n  if (class_name_index != PARSER_INVALID_LITERAL_INDEX)\n  {\n    parser_emit_cbc_ext_literal (context_p, CBC_EXT_FINALIZE_NAMED_CLASS, class_name_index);\n    PARSER_MINUS_EQUAL_U16 (context_p->scope_stack_top, 1);\n  }\n  else\n  {\n    parser_emit_cbc_ext (context_p, CBC_EXT_FINALIZE_ANONYMOUS_CLASS);\n  }\n\n  if (has_static_field)\n  {\n    parser_emit_cbc_ext (context_p, CBC_EXT_RUN_STATIC_FIELD_INIT);\n  }\n\n  if (is_statement)\n  {\n    cbc_opcode_t opcode = CBC_MOV_IDENT;\n\n    if (class_ident_index < PARSER_REGISTER_START)\n    {\n      opcode = (scanner_literal_is_created (context_p, class_ident_index) ? CBC_ASSIGN_LET_CONST : CBC_INIT_LET);\n    }\n\n    parser_emit_cbc_literal (context_p, (uint16_t) opcode, class_ident_index);\n    parser_flush_cbc (context_p);\n  }\n\n  if (!is_strict)\n  {\n    /* Restore flag */\n    context_p->status_flags &= (uint32_t) ~PARSER_IS_STRICT;\n  }\n  context_p->status_flags &= (uint32_t) ~PARSER_ALLOW_SUPER;\n\n  parser_restore_private_context (context_p, &private_ctx);\n\n  lexer_next_token (context_p);\n} /* parser_parse_class */\n\n/**\n * Parse object initializer method definition.\n *\n * See also: ES2015 14.3\n */\nstatic void\nparser_parse_object_method (parser_context_t *context_p) /**< context */\n{\n  context_p->source_p--;\n  context_p->column--;\n  uint16_t function_literal_index =\n    lexer_construct_function_object (context_p, (PARSER_FUNCTION_CLOSURE | PARSER_ALLOW_SUPER | PARSER_IS_METHOD));\n\n  parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, function_literal_index);\n\n  context_p->last_cbc.literal_type = LEXER_FUNCTION_LITERAL;\n\n  lexer_next_token (context_p);\n} /* parser_parse_object_method */\n\n/**\n * Reparse the current literal as a common identifier.\n */\nstatic void\nparser_reparse_as_common_identifier (parser_context_t *context_p, /**< context */\n                                     parser_line_counter_t start_line, /**< start line */\n                                     parser_line_counter_t start_column) /**< start column */\n{\n  /* context_p->token.lit_location.char_p is showing the character after the string start,\n     so it is not suitable for reparsing as identifier.\n     e.g.: { 'foo' } */\n  if (context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n  {\n    parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n  }\n\n  context_p->source_p = context_p->token.lit_location.char_p;\n  context_p->line = start_line;\n  context_p->column = start_column;\n\n  lexer_next_token (context_p);\n\n  if (context_p->token.type != LEXER_LITERAL)\n  {\n    parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n  }\n\n  JERRY_ASSERT (context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n  lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_IDENT_LITERAL);\n\n} /* parser_reparse_as_common_identifier */\n\n/**\n * Parse object literal.\n */\nstatic void\nparser_parse_object_literal (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_BRACE);\n\n  parser_emit_cbc (context_p, CBC_CREATE_OBJECT);\n\n  bool proto_seen = false;\n  bool has_super_env = false;\n\n  if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n  {\n    JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS);\n\n    if (context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_OBJECT_HAS_SUPER)\n    {\n      parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_OBJECT_SUPER_ENVIRONMENT);\n      has_super_env = true;\n    }\n\n    scanner_release_next (context_p, sizeof (scanner_info_t));\n  }\n\n  while (true)\n  {\n    lexer_expect_object_literal_id (context_p, LEXER_OBJ_IDENT_SET_FUNCTION_START);\n\n    switch (context_p->token.type)\n    {\n      case LEXER_RIGHT_BRACE:\n      {\n        break;\n      }\n      case LEXER_PROPERTY_GETTER:\n      case LEXER_PROPERTY_SETTER:\n      {\n        uint32_t status_flags;\n        cbc_ext_opcode_t opcode;\n        bool is_getter = context_p->token.type == LEXER_PROPERTY_GETTER;\n\n        if (is_getter)\n        {\n          status_flags = PARSER_FUNCTION_CLOSURE | PARSER_IS_PROPERTY_GETTER;\n          opcode = CBC_EXT_SET_GETTER;\n        }\n        else\n        {\n          status_flags = PARSER_FUNCTION_CLOSURE | PARSER_IS_PROPERTY_SETTER;\n          opcode = CBC_EXT_SET_SETTER;\n        }\n\n        status_flags |= PARSER_ALLOW_SUPER;\n\n        lexer_expect_object_literal_id (context_p, LEXER_OBJ_IDENT_ONLY_IDENTIFIERS);\n\n        /* This assignment is a nop for computed getters/setters. */\n        uint16_t literal_index = context_p->lit_object.index;\n\n        bool is_computed = context_p->token.type == LEXER_RIGHT_SQUARE;\n\n        if (is_computed)\n        {\n          opcode = ((opcode == CBC_EXT_SET_GETTER) ? CBC_EXT_SET_COMPUTED_GETTER : CBC_EXT_SET_COMPUTED_SETTER);\n        }\n\n        uint16_t function_literal_index = lexer_construct_function_object (context_p, status_flags);\n\n        if (opcode >= CBC_EXT_SET_COMPUTED_GETTER)\n        {\n          literal_index = function_literal_index;\n        }\n\n        parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, literal_index);\n\n        JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);\n\n        if (is_computed)\n        {\n          parser_emit_cbc_ext (context_p,\n                               is_getter ? CBC_EXT_SET_COMPUTED_GETTER_NAME : CBC_EXT_SET_COMPUTED_SETTER_NAME);\n\n          if (has_super_env)\n          {\n            parser_emit_cbc_ext (context_p, CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT_COMPUTED);\n          }\n          parser_emit_cbc_ext (context_p, opcode);\n          lexer_next_token (context_p);\n          break;\n        }\n\n        parser_set_function_name (context_p, function_literal_index, literal_index, status_flags);\n\n        if (has_super_env)\n        {\n          context_p->last_cbc_opcode = CBC_PUSH_TWO_LITERALS;\n          context_p->last_cbc.value = function_literal_index;\n          parser_emit_cbc_ext (context_p, CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT_COMPUTED);\n          parser_emit_cbc_ext (context_p, is_getter ? CBC_EXT_SET_COMPUTED_GETTER : CBC_EXT_SET_COMPUTED_SETTER);\n        }\n        else\n        {\n          context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (opcode);\n          context_p->last_cbc.value = function_literal_index;\n        }\n\n        lexer_next_token (context_p);\n        break;\n      }\n      case LEXER_RIGHT_SQUARE:\n      {\n        lexer_next_token (context_p);\n\n        if (context_p->token.type == LEXER_LEFT_PAREN)\n        {\n          parser_parse_object_method (context_p);\n          JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);\n\n          if (parser_check_anonymous_function_declaration (context_p) < PARSER_NAMED_FUNCTION)\n          {\n            parser_emit_cbc_ext (context_p, CBC_EXT_SET_COMPUTED_FUNCTION_NAME);\n            if (has_super_env)\n            {\n              parser_emit_cbc_ext (context_p, CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT_COMPUTED);\n            }\n            parser_emit_cbc_ext (context_p, CBC_EXT_SET_COMPUTED_PROPERTY);\n          }\n          else\n          {\n            context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_SET_COMPUTED_PROPERTY_LITERAL);\n          }\n\n          break;\n        }\n\n        if (context_p->token.type != LEXER_COLON)\n        {\n          parser_raise_error (context_p, PARSER_ERR_COLON_EXPECTED);\n        }\n\n        lexer_next_token (context_p);\n        parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n\n        if (parser_check_anonymous_function_declaration (context_p) < PARSER_NAMED_FUNCTION)\n        {\n          parser_emit_cbc_ext (context_p, CBC_EXT_SET_COMPUTED_FUNCTION_NAME);\n        }\n\n        if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n        {\n          context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_SET_COMPUTED_PROPERTY_LITERAL);\n        }\n        else\n        {\n          parser_emit_cbc_ext (context_p, CBC_EXT_SET_COMPUTED_PROPERTY);\n        }\n        break;\n      }\n      case LEXER_THREE_DOTS:\n      {\n        lexer_next_token (context_p);\n        parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n        parser_emit_cbc_ext (context_p, CBC_EXT_COPY_DATA_PROPERTIES);\n        break;\n      }\n      case LEXER_KEYW_ASYNC:\n      case LEXER_MULTIPLY:\n      {\n        uint32_t status_flags = PARSER_FUNCTION_CLOSURE;\n\n        if (context_p->token.type == LEXER_KEYW_ASYNC)\n        {\n          status_flags |= PARSER_IS_ASYNC_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD;\n          lexer_consume_generator (context_p);\n        }\n\n        if (context_p->token.type == LEXER_MULTIPLY)\n        {\n          status_flags |= PARSER_IS_GENERATOR_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD;\n        }\n\n        if (has_super_env)\n        {\n          status_flags |= PARSER_ALLOW_SUPER;\n        }\n\n        lexer_expect_object_literal_id (context_p, LEXER_OBJ_IDENT_ONLY_IDENTIFIERS);\n\n        uint16_t opcode = CBC_SET_LITERAL_PROPERTY;\n        /* This assignment is a nop for CBC_EXT_SET_COMPUTED_PROPERTY_LITERAL. */\n        uint16_t literal_index = context_p->lit_object.index;\n        bool is_computed = context_p->token.type == LEXER_RIGHT_SQUARE;\n\n        if (is_computed)\n        {\n          opcode = CBC_EXT_SET_COMPUTED_PROPERTY;\n        }\n\n        uint16_t function_literal_index = lexer_construct_function_object (context_p, status_flags);\n\n        parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, function_literal_index);\n\n        JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);\n\n        if (is_computed)\n        {\n          parser_emit_cbc_ext (context_p, CBC_EXT_SET_COMPUTED_FUNCTION_NAME);\n          if (has_super_env)\n          {\n            parser_emit_cbc_ext (context_p, CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT_COMPUTED);\n          }\n          parser_emit_cbc_ext (context_p, opcode);\n          lexer_next_token (context_p);\n          break;\n        }\n\n        parser_set_function_name (context_p, function_literal_index, literal_index, status_flags);\n\n        if (has_super_env)\n        {\n          parser_emit_cbc_ext (context_p, CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT);\n          parser_emit_cbc_literal (context_p, CBC_SET_PROPERTY, literal_index);\n        }\n        else\n        {\n          context_p->last_cbc_opcode = opcode;\n          context_p->last_cbc.value = literal_index;\n        }\n\n        lexer_next_token (context_p);\n        break;\n      }\n      default:\n      {\n        const lexer_lit_location_t *literal_p = (const lexer_lit_location_t *) context_p->lit_object.literal_p;\n        bool is_proto = ((context_p->token.lit_location.type == LEXER_IDENT_LITERAL\n                          || context_p->token.lit_location.type == LEXER_STRING_LITERAL)\n                         && lexer_compare_identifier_to_string (literal_p, (uint8_t *) \"__proto__\", 9)\n                         && lexer_check_next_character (context_p, LIT_CHAR_COLON));\n        if (is_proto)\n        {\n          if (proto_seen)\n          {\n            parser_raise_error (context_p, PARSER_ERR_DUPLICATED_PROTO);\n          }\n\n          proto_seen = true;\n        }\n\n        uint16_t literal_index = context_p->lit_object.index;\n        parser_line_counter_t start_line = context_p->token.line;\n        parser_line_counter_t start_column = context_p->token.column;\n\n        lexer_next_token (context_p);\n\n        if (context_p->token.type == LEXER_LEFT_PAREN && !is_proto)\n        {\n          parser_parse_object_method (context_p);\n\n          JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);\n          parser_set_function_name (context_p, context_p->last_cbc.literal_index, literal_index, 0);\n\n          if (has_super_env)\n          {\n            parser_emit_cbc_ext (context_p, CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT);\n            parser_emit_cbc_literal (context_p, CBC_SET_PROPERTY, literal_index);\n            break;\n          }\n\n          context_p->last_cbc_opcode = CBC_SET_LITERAL_PROPERTY;\n          context_p->last_cbc.value = literal_index;\n          break;\n        }\n\n        if ((context_p->token.type == LEXER_RIGHT_BRACE || context_p->token.type == LEXER_COMMA) && !is_proto)\n        {\n          parser_reparse_as_common_identifier (context_p, start_line, start_column);\n          parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);\n\n          context_p->last_cbc_opcode = CBC_SET_LITERAL_PROPERTY;\n          context_p->last_cbc.value = literal_index;\n\n          lexer_next_token (context_p);\n          break;\n        }\n\n        if (context_p->token.type != LEXER_COLON)\n        {\n          parser_raise_error (context_p, PARSER_ERR_COLON_EXPECTED);\n        }\n\n        lexer_next_token (context_p);\n        parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n\n        if (is_proto)\n        {\n          parser_emit_cbc_ext (context_p, CBC_EXT_SET__PROTO__);\n          break;\n        }\n\n        if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n        {\n          if (context_p->last_cbc.literal_type == LEXER_FUNCTION_LITERAL)\n          {\n            parser_set_function_name (context_p, context_p->last_cbc.literal_index, literal_index, 0);\n          }\n          context_p->last_cbc_opcode = CBC_SET_LITERAL_PROPERTY;\n          context_p->last_cbc.value = literal_index;\n        }\n        else\n        {\n          if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_FINALIZE_ANONYMOUS_CLASS))\n          {\n            uint16_t name_index = scanner_save_literal (context_p, literal_index);\n            parser_emit_cbc_ext_literal (context_p, CBC_EXT_SET_CLASS_NAME, name_index);\n          }\n\n          parser_emit_cbc_literal (context_p, CBC_SET_PROPERTY, literal_index);\n        }\n\n        break;\n      }\n    }\n\n    if (context_p->token.type == LEXER_RIGHT_BRACE)\n    {\n      break;\n    }\n    else if (context_p->token.type != LEXER_COMMA)\n    {\n      parser_raise_error (context_p, PARSER_ERR_OBJECT_ITEM_SEPARATOR_EXPECTED);\n    }\n  }\n\n  if (has_super_env)\n  {\n    parser_emit_cbc_ext (context_p, CBC_EXT_POP_OBJECT_SUPER_ENVIRONMENT);\n  }\n} /* parser_parse_object_literal */\n\n/**\n * Parse function literal.\n */\nstatic void\nparser_parse_function_expression (parser_context_t *context_p, /**< context */\n                                  uint32_t status_flags) /**< function status flags */\n{\n  int literals = 0;\n  uint16_t literal1 = 0;\n  uint16_t literal2 = 0;\n  uint16_t function_literal_index;\n  int32_t function_name_index = -1;\n\n  if (status_flags & PARSER_IS_FUNC_EXPRESSION)\n  {\n#if JERRY_DEBUGGER\n    parser_line_counter_t debugger_line = context_p->token.line;\n    parser_line_counter_t debugger_column = context_p->token.column;\n#endif /* JERRY_DEBUGGER */\n    uint32_t parent_status_flags = context_p->status_flags;\n\n    context_p->status_flags &=\n      (uint32_t) ~(PARSER_IS_ASYNC_FUNCTION | PARSER_IS_GENERATOR_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD);\n\n    if (status_flags & PARSER_IS_ASYNC_FUNCTION)\n    {\n      /* The name of the function cannot be await. */\n      context_p->status_flags |= PARSER_IS_ASYNC_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD;\n    }\n\n    if (lexer_consume_generator (context_p))\n    {\n      /* The name of the function cannot be yield. */\n      context_p->status_flags |= PARSER_IS_GENERATOR_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD;\n      status_flags |= PARSER_IS_GENERATOR_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD;\n    }\n\n    if (!lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))\n    {\n      /* The `await` keyword is interpreted as an IdentifierReference within function expressions */\n      context_p->status_flags &= (uint32_t) ~PARSER_IS_CLASS_STATIC_BLOCK;\n\n      lexer_next_token (context_p);\n\n      context_p->status_flags |= parent_status_flags & PARSER_IS_CLASS_STATIC_BLOCK;\n\n      if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n      {\n        parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n      }\n\n      parser_flush_cbc (context_p);\n\n      lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_STRING_LITERAL);\n\n#if JERRY_DEBUGGER\n      if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n      {\n        jerry_debugger_send_string (JERRY_DEBUGGER_FUNCTION_NAME,\n                                    JERRY_DEBUGGER_NO_SUBTYPE,\n                                    context_p->lit_object.literal_p->u.char_p,\n                                    context_p->lit_object.literal_p->prop.length);\n\n        /* Reset token position for the function. */\n        context_p->token.line = debugger_line;\n        context_p->token.column = debugger_column;\n      }\n#endif /* JERRY_DEBUGGER */\n      if (context_p->token.keyword_type >= LEXER_FIRST_NON_STRICT_ARGUMENTS)\n      {\n        status_flags |= PARSER_HAS_NON_STRICT_ARG;\n      }\n\n      function_name_index = context_p->lit_object.index;\n    }\n\n    context_p->status_flags = parent_status_flags;\n  }\n\n  if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n  {\n    literals = 1;\n    literal1 = context_p->last_cbc.literal_index;\n    context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n  }\n  else if (context_p->last_cbc_opcode == CBC_PUSH_TWO_LITERALS)\n  {\n    literals = 2;\n    literal1 = context_p->last_cbc.literal_index;\n    literal2 = context_p->last_cbc.value;\n    context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n  }\n\n  function_literal_index = lexer_construct_function_object (context_p, status_flags);\n\n  JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);\n\n  if (function_name_index != -1)\n  {\n    parser_set_function_name (context_p, function_literal_index, (uint16_t) function_name_index, 0);\n  }\n\n  if (literals == 1)\n  {\n    context_p->last_cbc_opcode = CBC_PUSH_TWO_LITERALS;\n    context_p->last_cbc.literal_index = literal1;\n    context_p->last_cbc.value = function_literal_index;\n  }\n  else if (literals == 2)\n  {\n    context_p->last_cbc_opcode = CBC_PUSH_THREE_LITERALS;\n    context_p->last_cbc.literal_index = literal1;\n    context_p->last_cbc.value = literal2;\n    context_p->last_cbc.third_literal_index = function_literal_index;\n  }\n  else\n  {\n    parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, function_literal_index);\n\n    if (function_name_index != -1)\n    {\n      context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_NAMED_FUNC_EXPRESSION);\n      context_p->last_cbc.value = (uint16_t) function_name_index;\n    }\n  }\n\n  context_p->last_cbc.literal_type = LEXER_FUNCTION_LITERAL;\n  context_p->last_cbc.literal_keyword_type = LEXER_EOS;\n} /* parser_parse_function_expression */\n\n/**\n * Parse template literal.\n */\nstatic void\nparser_parse_template_literal (parser_context_t *context_p) /**< context */\n{\n  bool is_empty_head = true;\n\n  if (context_p->token.lit_location.length > 0)\n  {\n    is_empty_head = false;\n\n    lexer_construct_literal_object (context_p, &context_p->token.lit_location, context_p->token.lit_location.type);\n\n    parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);\n  }\n\n  lexer_next_token (context_p);\n  parser_parse_expression (context_p, PARSE_EXPR);\n\n  if (context_p->token.type != LEXER_RIGHT_BRACE)\n  {\n    parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_EXPECTED);\n  }\n\n  if (!is_empty_head)\n  {\n    if (context_p->last_cbc_opcode == CBC_PUSH_TWO_LITERALS)\n    {\n      context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_STRING_CONCAT_TWO_LITERALS);\n    }\n    else if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n    {\n      context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_STRING_CONCAT_RIGHT_LITERAL);\n    }\n    else\n    {\n      parser_emit_cbc_ext (context_p, CBC_EXT_STRING_CONCAT);\n    }\n  }\n\n  context_p->source_p--;\n  context_p->column--;\n  lexer_parse_string (context_p, LEXER_STRING_NO_OPTS);\n\n  if (is_empty_head || context_p->token.lit_location.length > 0)\n  {\n    lexer_construct_literal_object (context_p, &context_p->token.lit_location, context_p->token.lit_location.type);\n\n    if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n    {\n      context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_STRING_CONCAT_TWO_LITERALS);\n      context_p->last_cbc.value = context_p->lit_object.index;\n      context_p->last_cbc.literal_type = context_p->token.lit_location.type;\n      context_p->last_cbc.literal_keyword_type = context_p->token.keyword_type;\n    }\n    else\n    {\n      parser_emit_cbc_ext_literal_from_token (context_p, CBC_EXT_STRING_CONCAT_RIGHT_LITERAL);\n    }\n  }\n\n  while (context_p->source_p[-1] != LIT_CHAR_GRAVE_ACCENT)\n  {\n    lexer_next_token (context_p);\n\n    parser_parse_expression (context_p, PARSE_EXPR);\n\n    if (context_p->token.type != LEXER_RIGHT_BRACE)\n    {\n      parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_EXPECTED);\n    }\n\n    if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n    {\n      context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_STRING_CONCAT_RIGHT_LITERAL);\n    }\n    else\n    {\n      parser_emit_cbc_ext (context_p, CBC_EXT_STRING_CONCAT);\n    }\n\n    context_p->source_p--;\n    context_p->column--;\n    lexer_parse_string (context_p, LEXER_STRING_NO_OPTS);\n\n    if (context_p->token.lit_location.length > 0)\n    {\n      lexer_construct_literal_object (context_p, &context_p->token.lit_location, context_p->token.lit_location.type);\n\n      parser_emit_cbc_ext_literal_from_token (context_p, CBC_EXT_STRING_CONCAT_RIGHT_LITERAL);\n    }\n  }\n} /* parser_parse_template_literal */\n\n/**\n * Parse tagged template literal.\n */\nstatic size_t\nparser_parse_tagged_template_literal (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_TEMPLATE_LITERAL);\n\n  uint32_t call_arguments = 0;\n  ecma_collection_t *collection_p;\n\n  if (context_p->tagged_template_literal_cp == JMEM_CP_NULL)\n  {\n    collection_p = ecma_new_collection ();\n    ECMA_SET_INTERNAL_VALUE_POINTER (context_p->tagged_template_literal_cp, collection_p);\n  }\n  else\n  {\n    collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, context_p->tagged_template_literal_cp);\n    if (collection_p->item_count > CBC_MAXIMUM_BYTE_VALUE)\n    {\n      parser_raise_error (context_p, PARSER_ERR_ARGUMENT_LIMIT_REACHED);\n    }\n  }\n\n  const uint32_t tagged_id = collection_p->item_count;\n  uint32_t prop_idx = 0;\n  ecma_object_t *raw_strings_p;\n  ecma_object_t *template_obj_p = parser_new_tagged_template_literal (&raw_strings_p);\n  ecma_collection_push_back (collection_p, ecma_make_object_value (template_obj_p));\n\n  parser_tagged_template_literal_append_strings (context_p, template_obj_p, raw_strings_p, prop_idx++);\n\n  call_arguments++;\n  parser_emit_cbc_ext_call (context_p, CBC_EXT_GET_TAGGED_TEMPLATE_LITERAL, tagged_id);\n\n  while (context_p->source_p[-1] != LIT_CHAR_GRAVE_ACCENT)\n  {\n    JERRY_ASSERT (context_p->source_p[-1] == LIT_CHAR_LEFT_BRACE);\n    lexer_next_token (context_p);\n\n    if (++call_arguments > CBC_MAXIMUM_BYTE_VALUE)\n    {\n      parser_raise_error (context_p, PARSER_ERR_ARGUMENT_LIMIT_REACHED);\n    }\n\n    parser_parse_expression (context_p, PARSE_EXPR);\n\n    if (context_p->token.type != LEXER_RIGHT_BRACE)\n    {\n      parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_EXPECTED);\n    }\n\n    context_p->source_p--;\n    context_p->column--;\n    lexer_parse_string (context_p, LEXER_STRING_NO_OPTS);\n\n    parser_tagged_template_literal_append_strings (context_p, template_obj_p, raw_strings_p, prop_idx++);\n  }\n\n  parser_tagged_template_literal_finalize (template_obj_p, raw_strings_p);\n\n  return call_arguments;\n} /* parser_parse_tagged_template_literal */\n\n/**\n * Checks wheteher the current expression can be an assignment expression.\n *\n * @return true if the current expression can be an assignment expression, false otherwise\n */\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\nparser_is_assignment_expr (parser_context_t *context_p)\n{\n  return (context_p->stack_top_uint8 == LEXER_EXPRESSION_START || context_p->stack_top_uint8 == LEXER_LEFT_PAREN\n          || context_p->stack_top_uint8 == LEXER_COMMA_SEP_LIST\n          || LEXER_IS_BINARY_LVALUE_OP_TOKEN (context_p->stack_top_uint8));\n} /* parser_is_assignment_expr */\n\n/**\n * Throws an error if the current expression is not an assignment expression.\n */\nstatic inline void JERRY_ATTR_ALWAYS_INLINE\nparser_check_assignment_expr (parser_context_t *context_p)\n{\n  if (!parser_is_assignment_expr (context_p))\n  {\n    parser_raise_error (context_p, PARSER_ERR_ASSIGNMENT_EXPECTED);\n  }\n} /* parser_check_assignment_expr */\n\n/**\n * Checks whether the next token is a valid continuation token after an AssignmentExpression.\n */\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\nparser_abort_parsing_after_assignment_expression (parser_context_t *context_p)\n{\n  return (context_p->token.type != LEXER_RIGHT_PAREN && context_p->token.type != LEXER_COMMA);\n} /* parser_abort_parsing_after_assignment_expression */\n\n/**\n * Parse and record unary operators, and parse the primary literal.\n *\n * @return true if parsing should be aborted, true otherwise\n */\nstatic bool\nparser_parse_unary_expression (parser_context_t *context_p, /**< context */\n                               size_t *grouping_level_p) /**< grouping level */\n{\n  bool new_was_seen = false;\n\n  /* Collect unary operators. */\n  while (true)\n  {\n    /* Convert plus and minus binary operators to unary operators. */\n    switch (context_p->token.type)\n    {\n      case LEXER_ADD:\n      {\n        context_p->token.type = LEXER_PLUS;\n        break;\n      }\n      case LEXER_SUBTRACT:\n      {\n        context_p->token.type = LEXER_NEGATE;\n        break;\n      }\n      case LEXER_KEYW_AWAIT:\n      {\n#if JERRY_MODULE_SYSTEM\n        if ((context_p->global_status_flags & ECMA_PARSE_MODULE)\n            && !(context_p->status_flags & PARSER_IS_ASYNC_FUNCTION))\n        {\n          parser_raise_error (context_p, PARSER_ERR_AWAIT_NOT_ALLOWED);\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n\n        if (JERRY_UNLIKELY (context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))\n        {\n          parser_raise_error (context_p, PARSER_ERR_INVALID_KEYWORD);\n        }\n        break;\n      }\n    }\n\n    /* Bracketed expressions are primary expressions. At this\n     * point their left paren is pushed onto the stack and\n     * they are processed when their closing paren is reached. */\n    if (context_p->token.type == LEXER_LEFT_PAREN)\n    {\n      if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n      {\n        JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);\n        break;\n      }\n      (*grouping_level_p) += PARSER_GROUPING_LEVEL_INCREASE;\n      new_was_seen = false;\n    }\n    else if (context_p->token.type == LEXER_KEYW_NEW)\n    {\n      /* After 'new' unary operators are not allowed. */\n      new_was_seen = true;\n\n      /* Check if \"new.target\" is written here. */\n      if (scanner_try_scan_new_target (context_p))\n      {\n        if (!(context_p->status_flags & PARSER_ALLOW_NEW_TARGET))\n        {\n          parser_raise_error (context_p, PARSER_ERR_NEW_TARGET_NOT_ALLOWED);\n        }\n\n        parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_NEW_TARGET);\n        lexer_next_token (context_p);\n        /* Found \"new.target\" return here */\n        return false;\n      }\n    }\n    else if (new_was_seen || (*grouping_level_p == PARSE_EXPR_LEFT_HAND_SIDE)\n             || !LEXER_IS_UNARY_OP_TOKEN (context_p->token.type))\n    {\n      break;\n    }\n\n    parser_stack_push_uint8 (context_p, context_p->token.type);\n    lexer_next_token (context_p);\n  }\n\n  /* Parse primary expression. */\n  switch (context_p->token.type)\n  {\n    case LEXER_HASHMARK:\n    {\n      if (!lexer_scan_private_identifier (context_p))\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_CHARACTER);\n      }\n\n      parser_resolve_private_identifier (context_p);\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type != LEXER_KEYW_IN)\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_CHARACTER);\n      }\n\n      parser_stack_push_uint16 (context_p, context_p->lit_object.index);\n      parser_stack_push_uint8 (context_p, LEXER_PRIVATE_PRIMARY_EXPR);\n      return false;\n    }\n    case LEXER_TEMPLATE_LITERAL:\n    {\n      if (context_p->source_p[-1] != LIT_CHAR_GRAVE_ACCENT)\n      {\n        parser_parse_template_literal (context_p);\n        break;\n      }\n\n      /* The string is a normal string literal. */\n      /* FALLTHRU */\n    }\n    case LEXER_LITERAL:\n    {\n      if (JERRY_UNLIKELY (context_p->next_scanner_info_p->source_p == context_p->source_p))\n      {\n        JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);\n\n#if JERRY_FUNCTION_TO_STRING\n        context_p->function_start_p = context_p->token.lit_location.char_p;\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n        uint32_t arrow_status_flags =\n          (PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION\n           | (context_p->status_flags & (PARSER_INSIDE_CLASS_FIELD | PARSER_IS_CLASS_STATIC_BLOCK)));\n\n        if (context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_ASYNC)\n        {\n          JERRY_ASSERT (lexer_token_is_async (context_p));\n          JERRY_ASSERT (!(context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_STATEMENT));\n\n          uint32_t saved_status_flags = context_p->status_flags;\n\n          context_p->status_flags |= PARSER_IS_ASYNC_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD;\n          lexer_next_token (context_p);\n          context_p->status_flags = saved_status_flags;\n\n          if (context_p->token.type == LEXER_KEYW_FUNCTION)\n          {\n            uint32_t status_flags = (PARSER_FUNCTION_CLOSURE | PARSER_IS_FUNC_EXPRESSION | PARSER_IS_ASYNC_FUNCTION\n                                     | PARSER_DISALLOW_AWAIT_YIELD);\n            parser_parse_function_expression (context_p, status_flags);\n            break;\n          }\n\n          arrow_status_flags =\n            (PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION | PARSER_IS_ASYNC_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD);\n        }\n\n        parser_check_assignment_expr (context_p);\n        parser_parse_function_expression (context_p, arrow_status_flags);\n        return parser_abort_parsing_after_assignment_expression (context_p);\n      }\n\n      uint8_t type = context_p->token.lit_location.type;\n\n      if (type == LEXER_IDENT_LITERAL || type == LEXER_STRING_LITERAL)\n      {\n        lexer_construct_literal_object (context_p, &context_p->token.lit_location, context_p->token.lit_location.type);\n      }\n      else if (type == LEXER_NUMBER_LITERAL)\n      {\n        bool is_negative_number = false;\n\n        if ((context_p->stack_top_uint8 == LEXER_PLUS || context_p->stack_top_uint8 == LEXER_NEGATE)\n            && !lexer_check_post_primary_exp (context_p))\n        {\n          do\n          {\n            if (context_p->stack_top_uint8 == LEXER_NEGATE)\n            {\n              is_negative_number = !is_negative_number;\n            }\n#if JERRY_BUILTIN_BIGINT\n            else if (JERRY_LIKELY (context_p->token.extra_value == LEXER_NUMBER_BIGINT))\n            {\n              break;\n            }\n#endif /* JERRY_BUILTIN_BIGINT */\n            parser_stack_pop_uint8 (context_p);\n          } while (context_p->stack_top_uint8 == LEXER_PLUS || context_p->stack_top_uint8 == LEXER_NEGATE);\n        }\n\n        if (lexer_construct_number_object (context_p, true, is_negative_number))\n        {\n          JERRY_ASSERT (context_p->lit_object.index <= CBC_PUSH_NUMBER_BYTE_RANGE_END);\n\n          parser_emit_cbc_push_number (context_p, is_negative_number);\n          break;\n        }\n      }\n\n      cbc_opcode_t opcode = CBC_PUSH_LITERAL;\n\n      if (context_p->token.keyword_type != LEXER_KEYW_EVAL)\n      {\n        if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n        {\n          context_p->last_cbc_opcode = CBC_PUSH_TWO_LITERALS;\n          context_p->last_cbc.value = context_p->lit_object.index;\n          context_p->last_cbc.literal_type = context_p->token.lit_location.type;\n          context_p->last_cbc.literal_keyword_type = context_p->token.keyword_type;\n          break;\n        }\n\n        if (context_p->last_cbc_opcode == CBC_PUSH_TWO_LITERALS)\n        {\n          context_p->last_cbc_opcode = CBC_PUSH_THREE_LITERALS;\n          context_p->last_cbc.third_literal_index = context_p->lit_object.index;\n          context_p->last_cbc.literal_type = context_p->token.lit_location.type;\n          context_p->last_cbc.literal_keyword_type = context_p->token.keyword_type;\n          break;\n        }\n\n        if (context_p->last_cbc_opcode == CBC_PUSH_THIS)\n        {\n          context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n          opcode = CBC_PUSH_THIS_LITERAL;\n        }\n      }\n\n      parser_emit_cbc_literal_from_token (context_p, (uint16_t) opcode);\n      break;\n    }\n    case LEXER_KEYW_FUNCTION:\n    {\n#if JERRY_FUNCTION_TO_STRING\n      context_p->function_start_p = context_p->token.lit_location.char_p;\n#endif /* JERRY_FUNCTION_TO_STRING */\n      parser_parse_function_expression (context_p, PARSER_FUNCTION_CLOSURE | PARSER_IS_FUNC_EXPRESSION);\n      break;\n    }\n    case LEXER_LEFT_BRACE:\n    {\n      if (context_p->next_scanner_info_p->source_p == context_p->source_p\n          && context_p->next_scanner_info_p->type == SCANNER_TYPE_INITIALIZER)\n      {\n        if (parser_is_assignment_expr (context_p))\n        {\n          uint32_t flags = PARSER_PATTERN_NO_OPTS;\n\n          if (context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_OBJECT_HAS_REST)\n          {\n            flags |= PARSER_PATTERN_HAS_REST_ELEMENT;\n          }\n\n          parser_parse_object_initializer (context_p, flags);\n          return parser_abort_parsing_after_assignment_expression (context_p);\n        }\n\n        scanner_release_next (context_p, sizeof (scanner_location_info_t));\n      }\n\n      parser_parse_object_literal (context_p);\n      break;\n    }\n    case LEXER_LEFT_SQUARE:\n    {\n      if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n      {\n        if (context_p->next_scanner_info_p->type == SCANNER_TYPE_INITIALIZER)\n        {\n          if (parser_is_assignment_expr (context_p))\n          {\n            parser_parse_array_initializer (context_p, PARSER_PATTERN_NO_OPTS);\n            return parser_abort_parsing_after_assignment_expression (context_p);\n          }\n\n          scanner_release_next (context_p, sizeof (scanner_location_info_t));\n        }\n        else\n        {\n          JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS\n                        && context_p->next_scanner_info_p->u8_arg == SCANNER_LITERAL_NO_DESTRUCTURING);\n\n          scanner_release_next (context_p, sizeof (scanner_info_t));\n        }\n      }\n\n      parser_parse_array_literal (context_p);\n      break;\n    }\n    case LEXER_DIVIDE:\n    case LEXER_ASSIGN_DIVIDE:\n    {\n      lexer_construct_regexp_object (context_p, false);\n      uint16_t literal_index = (uint16_t) (context_p->literal_count - 1);\n\n      if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n      {\n        context_p->last_cbc_opcode = CBC_PUSH_TWO_LITERALS;\n        context_p->last_cbc.value = literal_index;\n      }\n      else if (context_p->last_cbc_opcode == CBC_PUSH_TWO_LITERALS)\n      {\n        context_p->last_cbc_opcode = CBC_PUSH_THREE_LITERALS;\n        context_p->last_cbc.third_literal_index = literal_index;\n      }\n      else\n      {\n        parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, literal_index);\n      }\n\n      context_p->last_cbc.literal_type = LEXER_REGEXP_LITERAL;\n      context_p->last_cbc.literal_keyword_type = LEXER_EOS;\n      break;\n    }\n    case LEXER_KEYW_THIS:\n    {\n      if (context_p->status_flags & PARSER_ALLOW_SUPER_CALL)\n      {\n        parser_emit_cbc_ext (context_p, CBC_EXT_RESOLVE_LEXICAL_THIS);\n      }\n      else\n      {\n        parser_emit_cbc (context_p, CBC_PUSH_THIS);\n      }\n\n      break;\n    }\n    case LEXER_LIT_TRUE:\n    {\n      parser_emit_cbc (context_p, CBC_PUSH_TRUE);\n      break;\n    }\n    case LEXER_LIT_FALSE:\n    {\n      parser_emit_cbc (context_p, CBC_PUSH_FALSE);\n      break;\n    }\n    case LEXER_LIT_NULL:\n    {\n      parser_emit_cbc (context_p, CBC_PUSH_NULL);\n      break;\n    }\n    case LEXER_KEYW_CLASS:\n    {\n      parser_parse_class (context_p, false);\n      return false;\n    }\n    case LEXER_KEYW_SUPER:\n    {\n      if (context_p->status_flags & PARSER_ALLOW_SUPER)\n      {\n        if (lexer_check_next_characters (context_p, LIT_CHAR_DOT, LIT_CHAR_LEFT_SQUARE))\n        {\n          parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_SUPER);\n          break;\n        }\n\n        if (lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN)\n            && (context_p->status_flags & PARSER_ALLOW_SUPER_CALL))\n        {\n          parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_SUPER_CONSTRUCTOR);\n          break;\n        }\n      }\n\n      parser_raise_error (context_p, PARSER_ERR_UNEXPECTED_SUPER_KEYWORD);\n    }\n    case LEXER_LEFT_PAREN:\n    {\n      JERRY_ASSERT (context_p->next_scanner_info_p->source_p == context_p->source_p\n                    && context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);\n\n      parser_check_assignment_expr (context_p);\n\n#if JERRY_FUNCTION_TO_STRING\n      context_p->function_start_p = context_p->source_p - 1;\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n      uint32_t arrow_status_flags =\n        (PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION\n         | (context_p->status_flags & (PARSER_INSIDE_CLASS_FIELD | PARSER_IS_CLASS_STATIC_BLOCK)));\n      parser_parse_function_expression (context_p, arrow_status_flags);\n      return parser_abort_parsing_after_assignment_expression (context_p);\n    }\n    case LEXER_KEYW_YIELD:\n    {\n      JERRY_ASSERT ((context_p->status_flags & PARSER_IS_GENERATOR_FUNCTION)\n                    && !(context_p->status_flags & PARSER_DISALLOW_AWAIT_YIELD));\n\n      if (context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_KEYWORD);\n      }\n\n      parser_check_assignment_expr (context_p);\n      lexer_next_token (context_p);\n\n      cbc_ext_opcode_t opcode =\n        ((context_p->status_flags & PARSER_IS_ASYNC_FUNCTION) ? CBC_EXT_ASYNC_YIELD : CBC_EXT_YIELD);\n      if (!lexer_check_yield_no_arg (context_p))\n      {\n        if (context_p->token.type == LEXER_MULTIPLY)\n        {\n          lexer_next_token (context_p);\n          opcode = ((context_p->status_flags & PARSER_IS_ASYNC_FUNCTION) ? CBC_EXT_ASYNC_YIELD_ITERATOR\n                                                                         : CBC_EXT_YIELD_ITERATOR);\n        }\n\n        parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n      }\n      else\n      {\n        parser_emit_cbc (context_p, CBC_PUSH_UNDEFINED);\n      }\n\n      parser_emit_cbc_ext (context_p, opcode);\n\n      return (context_p->token.type != LEXER_RIGHT_PAREN && context_p->token.type != LEXER_COMMA);\n    }\n#if JERRY_MODULE_SYSTEM\n    case LEXER_KEYW_IMPORT:\n    {\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_DOT)\n      {\n        lexer_next_token (context_p);\n\n        if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL\n            || context_p->token.keyword_type != LEXER_KEYW_META\n            || (context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))\n        {\n          parser_raise_error (context_p, PARSER_ERR_META_EXPECTED);\n        }\n\n        if (!(context_p->global_status_flags & ECMA_PARSE_MODULE))\n        {\n          parser_raise_error (context_p, PARSER_ERR_IMPORT_META_REQUIRE_MODULE);\n        }\n\n        JERRY_ASSERT (context_p->global_status_flags & ECMA_PARSE_INTERNAL_HAS_IMPORT_META);\n\n        parser_emit_cbc_ext (context_p, CBC_EXT_MODULE_IMPORT_META);\n        break;\n      }\n\n      if (context_p->token.type != LEXER_LEFT_PAREN)\n      {\n        parser_raise_error (context_p, PARSER_ERR_LEFT_PAREN_EXPECTED);\n      }\n\n      if (new_was_seen)\n      {\n        parser_raise_error (context_p, PARSER_ERR_IMPORT_AFTER_NEW);\n      }\n\n      lexer_next_token (context_p);\n      parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n\n      if (context_p->token.type != LEXER_RIGHT_PAREN)\n      {\n        parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);\n      }\n\n      parser_emit_cbc_ext (context_p, CBC_EXT_MODULE_IMPORT);\n      break;\n    }\n#endif /* JERRY_MODULE_SYSTEM */\n    default:\n    {\n      bool is_left_hand_side = (*grouping_level_p == PARSE_EXPR_LEFT_HAND_SIDE);\n      parser_raise_error (context_p,\n                          (is_left_hand_side ? PARSER_ERR_LEFT_HAND_SIDE_EXP_EXPECTED : PARSER_ERR_UNEXPECTED_END));\n      break;\n    }\n  }\n  lexer_next_token (context_p);\n  return false;\n} /* parser_parse_unary_expression */\n\n/**\n * Parse expr.#property\n */\nstatic void\nparser_parse_private_property_access (parser_context_t *context_p) /**< context */\n{\n  lexer_next_token (context_p);\n\n  if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER))\n  {\n    parser_raise_error (context_p, PARSER_ERR_UNEXPECTED_PRIVATE_FIELD);\n  }\n\n  if (!lexer_scan_private_identifier (context_p))\n  {\n    parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n  }\n\n  parser_resolve_private_identifier (context_p);\n\n  parser_emit_cbc_ext_literal (context_p, CBC_EXT_PUSH_PRIVATE_PROP_LITERAL, context_p->lit_object.index);\n  lexer_next_token (context_p);\n} /* parser_parse_private_property_access */\n\n/**\n * Parse expr.property\n */\nstatic void\nparser_parse_property_access (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_DOT || context_p->token.type == LEXER_QUESTION_MARK_DOT);\n\n  parser_push_result (context_p);\n\n  if (lexer_check_next_character (context_p, LIT_CHAR_HASHMARK))\n  {\n    parser_parse_private_property_access (context_p);\n    return;\n  }\n\n  lexer_expect_identifier (context_p, LEXER_STRING_LITERAL);\n\n  JERRY_ASSERT (context_p->token.type == LEXER_LITERAL\n                && context_p->lit_object.literal_p->type == LEXER_STRING_LITERAL);\n  context_p->token.lit_location.type = LEXER_STRING_LITERAL;\n\n  switch (context_p->last_cbc_opcode)\n  {\n    case CBC_PUSH_LITERAL:\n    {\n      JERRY_ASSERT (CBC_ARGS_EQ (CBC_PUSH_PROP_LITERAL_LITERAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2));\n      context_p->last_cbc_opcode = CBC_PUSH_PROP_LITERAL_LITERAL;\n      context_p->last_cbc.value = context_p->lit_object.index;\n      break;\n    }\n    case CBC_PUSH_THIS:\n    {\n      context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n      parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_PROP_THIS_LITERAL);\n      break;\n    }\n    case PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER):\n    {\n      context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_PROP_LITERAL);\n      context_p->last_cbc.literal_index = context_p->lit_object.index;\n      break;\n    }\n    default:\n    {\n      parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_PROP_LITERAL);\n      break;\n    }\n  }\n\n  lexer_next_token (context_p);\n} /* parser_parse_property_access */\n\n/**\n * Parse an expression enclosed with [] brackets ('[expr]')\n */\nstatic void\nparser_parse_square_bracketed_expression (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_SQUARE);\n\n  lexer_next_token (context_p);\n  parser_parse_expression (context_p, PARSE_EXPR);\n\n  if (context_p->token.type != LEXER_RIGHT_SQUARE)\n  {\n    parser_raise_error (context_p, PARSER_ERR_RIGHT_SQUARE_EXPECTED);\n  }\n  lexer_next_token (context_p);\n} /* parser_parser_square_bracketed_expression */\n\n/**\n * Parse super[expr]\n */\nstatic void\nparser_parse_super_element_access_expression (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER));\n  context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n\n  parser_parse_square_bracketed_expression (context_p);\n\n  parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_SUPER_PROP);\n} /* parser_parse_super_element_access_expression */\n\n/**\n * Parse expr[property]\n */\nstatic void\nparser_parse_element_access (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_SQUARE);\n\n  parser_push_result (context_p);\n\n  if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER))\n  {\n    parser_parse_super_element_access_expression (context_p);\n    return;\n  }\n\n  parser_parse_square_bracketed_expression (context_p);\n\n  if (PARSER_IS_MUTABLE_PUSH_LITERAL (context_p->last_cbc_opcode))\n  {\n    context_p->last_cbc_opcode = PARSER_PUSH_LITERAL_TO_PUSH_PROP_LITERAL (context_p->last_cbc_opcode);\n  }\n  else\n  {\n    parser_emit_cbc (context_p, CBC_PUSH_PROP);\n  }\n} /* parser_parse_element_access */\n\n/**\n * Form reference base for a call instruction\n */\nstatic parser_call_reference_t\nparser_form_call_reference (parser_context_t *context_p) /**< context */\n{\n  parser_push_result (context_p);\n\n  parser_call_reference_t desc;\n  desc.status_flags = PARSER_CALL_REFERENCE_NONE;\n  desc.opcode = CBC_CALL;\n  desc.call_arguments = 0;\n\n  if (context_p->stack_top_uint8 == LEXER_KEYW_NEW)\n  {\n    if (context_p->token.type == LEXER_LEFT_PAREN)\n    {\n      parser_stack_pop_uint8 (context_p);\n      desc.opcode = CBC_NEW;\n    }\n\n    return desc;\n  }\n\n  switch (context_p->last_cbc_opcode)\n  {\n    case CBC_PUSH_LITERAL:\n    {\n      if (context_p->last_cbc.literal_keyword_type == LEXER_KEYW_EVAL\n          && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL)\n      {\n        desc.status_flags |= PARSER_CALL_REFERENCE_DIRECT_EVAL;\n      }\n      /* FALLTHRU */\n    }\n    case CBC_PUSH_TWO_LITERALS:\n    case CBC_PUSH_THIS_LITERAL:\n    case CBC_PUSH_THREE_LITERALS:\n    {\n      JERRY_ASSERT (PARSER_IS_PUSH_LITERALS_WITH_THIS (context_p->last_cbc_opcode));\n\n      if (JERRY_UNLIKELY (context_p->status_flags & PARSER_INSIDE_WITH)\n          && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL)\n      {\n        parser_emit_ident_reference (context_p, CBC_PUSH_IDENT_REFERENCE);\n        parser_emit_cbc_ext (context_p, CBC_EXT_RESOLVE_BASE);\n        break;\n      }\n\n      return desc;\n    }\n    case CBC_PUSH_PROP:\n    case CBC_PUSH_PROP_LITERAL:\n    case CBC_PUSH_PROP_LITERAL_LITERAL:\n    case CBC_PUSH_PROP_THIS_LITERAL:\n    {\n      JERRY_ASSERT (PARSER_IS_PUSH_PROP (context_p->last_cbc_opcode));\n      context_p->last_cbc_opcode = PARSER_PUSH_PROP_TO_PUSH_PROP_REFERENCE (context_p->last_cbc_opcode);\n      break;\n    }\n    case PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_CONSTRUCTOR):\n    {\n      desc.opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_SUPER_CALL);\n      return desc;\n    }\n    case PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_PROP_LITERAL):\n    {\n      context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_SUPER_PROP_LITERAL_REFERENCE);\n      break;\n    }\n    case PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_PROP):\n    {\n      context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_SUPER_PROP_REFERENCE);\n      break;\n    }\n    case PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_PRIVATE_PROP_LITERAL):\n    {\n      context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_PRIVATE_PROP_LITERAL_REFERENCE);\n      break;\n    }\n    default:\n    {\n      return desc;\n    }\n  }\n\n  desc.opcode = CBC_CALL_PROP;\n  return desc;\n} /* parser_form_call_reference */\n\n/**\n * Expect the closing left parenthesis of a call expression\n */\nstatic inline void\nparser_expect_arguments_list_end (parser_context_t *context_p) /**< context */\n{\n  if (context_p->token.type != LEXER_RIGHT_PAREN)\n  {\n    parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);\n  }\n} /* parser_expect_arguments_list_end */\n\n/**\n * Parse arguments list of a call expression\n */\nstatic void\nparser_process_call_arguments (parser_context_t *context_p, /**< context */\n                               parser_call_reference_t *call_ref_p) /**< call reference */\n{\n  if (context_p->token.type == LEXER_TEMPLATE_LITERAL)\n  {\n    call_ref_p->call_arguments = (uint16_t) parser_parse_tagged_template_literal (context_p);\n    return;\n  }\n\n  uint32_t call_arguments = 0;\n\n  lexer_next_token (context_p);\n\n  while (context_p->token.type != LEXER_RIGHT_PAREN)\n  {\n    if (++call_arguments > CBC_MAXIMUM_BYTE_VALUE)\n    {\n      parser_raise_error (context_p, PARSER_ERR_ARGUMENT_LIMIT_REACHED);\n    }\n\n    if (context_p->token.type == LEXER_THREE_DOTS)\n    {\n      call_ref_p->status_flags |= PARSER_CALL_REFERENCE_SPREAD;\n      call_arguments++;\n      parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_SPREAD_ELEMENT);\n      lexer_next_token (context_p);\n    }\n\n    parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n\n    if (context_p->token.type == LEXER_COMMA)\n    {\n      lexer_next_token (context_p);\n      continue;\n    }\n\n    parser_expect_arguments_list_end (context_p);\n    break;\n  }\n\n  JERRY_ASSERT (context_p->token.type == LEXER_RIGHT_PAREN);\n  call_ref_p->call_arguments = call_arguments;\n} /* parser_process_call_arguments */\n\n/**\n * Save local options flags for direct eval\n */\nstatic void\nparser_prepare_direct_eval_call (parser_context_t *context_p) /**< context */\n{\n  context_p->status_flags |= PARSER_LEXICAL_ENV_NEEDED;\n\n  uint16_t eval_flags = PARSER_SAVE_STATUS_FLAGS (context_p->status_flags);\n  const uint32_t required_flags = PARSER_IS_FUNCTION | PARSER_LEXICAL_BLOCK_NEEDED;\n\n  if (context_p->status_flags & PARSER_FUNCTION_IS_PARSING_ARGS)\n  {\n    context_p->status_flags |= PARSER_LEXICAL_BLOCK_NEEDED;\n  }\n  else if (((context_p->status_flags & (required_flags | PARSER_IS_STRICT)) == required_flags)\n           || ((context_p->global_status_flags & ECMA_PARSE_FUNCTION_CONTEXT)\n               && !(context_p->status_flags & PARSER_IS_FUNCTION)))\n  {\n    eval_flags |= PARSER_GET_EVAL_FLAG (ECMA_PARSE_FUNCTION_CONTEXT);\n  }\n\n  if (eval_flags != 0)\n  {\n    parser_emit_cbc_ext_call (context_p, CBC_EXT_LOCAL_EVAL, eval_flags);\n  }\n  else\n  {\n    parser_emit_cbc (context_p, CBC_EVAL);\n  }\n} /* parser_prepare_direct_eval_call */\n\n/**\n * Emit bytecode for spread call\n */\nstatic void\nparser_emit_spread_call (parser_context_t *context_p, /**< context */\n                         parser_call_reference_t *call_ref_p) /**< call reference */\n{\n  uint16_t call_opcode;\n\n  switch (call_ref_p->opcode)\n  {\n    case CBC_CALL:\n    {\n      call_opcode = CBC_EXT_SPREAD_CALL;\n      break;\n    }\n    case CBC_CALL_PROP:\n    {\n      call_opcode = CBC_EXT_SPREAD_CALL_PROP;\n      break;\n    }\n    case CBC_NEW:\n    {\n      call_opcode = CBC_EXT_SPREAD_NEW;\n      break;\n    }\n    case PARSER_TO_EXT_OPCODE (CBC_EXT_SUPER_CALL):\n    {\n      call_opcode = CBC_EXT_SPREAD_SUPER_CALL;\n      break;\n    }\n    default:\n    {\n      JERRY_UNREACHABLE ();\n    }\n  }\n\n  parser_emit_cbc_ext_call (context_p, call_opcode, call_ref_p->call_arguments);\n} /* parser_emit_spread_call */\n\n/**\n * Emit call opcode with 0 or 1 argument\n */\nstatic void\nparser_emit_call_01 (parser_context_t *context_p, /**< context */\n                     parser_call_reference_t *call_ref_p) /**< call reference */\n{\n  JERRY_ASSERT (call_ref_p->call_arguments <= 1);\n\n  switch (call_ref_p->opcode)\n  {\n    case CBC_CALL:\n    {\n      parser_emit_cbc (context_p, (uint16_t) (CBC_CALL0 + (call_ref_p->call_arguments * 6)));\n      break;\n    }\n    case CBC_CALL_PROP:\n    {\n      parser_emit_cbc (context_p, (uint16_t) (CBC_CALL0_PROP + (call_ref_p->call_arguments * 6)));\n      break;\n    }\n    case CBC_NEW:\n    {\n      parser_emit_cbc (context_p, (uint16_t) (CBC_NEW0 + call_ref_p->call_arguments));\n      break;\n    }\n    default:\n    {\n      parser_emit_cbc_call (context_p, call_ref_p->opcode, call_ref_p->call_arguments);\n      break;\n    }\n  }\n} /* parser_emit_call_01 */\n\n/**\n * Emit call opcode with 2 arguments\n */\nstatic void\nparser_emit_call_2 (parser_context_t *context_p, /**< context */\n                    parser_call_reference_t *call_ref_p) /**< call reference */\n{\n  JERRY_ASSERT (call_ref_p->call_arguments == 2);\n\n  switch (call_ref_p->opcode)\n  {\n    case CBC_CALL:\n    {\n      parser_emit_cbc (context_p, CBC_CALL2);\n      break;\n    }\n    case CBC_CALL_PROP:\n    {\n      parser_flush_cbc (context_p);\n      /* Manually adjusting stack usage. */\n      JERRY_ASSERT (context_p->stack_depth > 0);\n      context_p->stack_depth--;\n      parser_emit_cbc (context_p, CBC_CALL2_PROP);\n      break;\n    }\n    default:\n    {\n      parser_emit_cbc_call (context_p, call_ref_p->opcode, call_ref_p->call_arguments);\n      break;\n    }\n  }\n} /* parser_emit_call_2 */\n\n/**\n * Parse expr(arguments) or expr`template literal`\n */\nstatic void\nparser_parse_call_expression (parser_context_t *context_p, /**< context */\n                              parser_call_reference_t *call_ref_p) /**< call reference */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_PAREN || context_p->token.type == LEXER_TEMPLATE_LITERAL);\n\n  parser_process_call_arguments (context_p, call_ref_p);\n\n  lexer_next_token (context_p);\n\n  if (call_ref_p->status_flags & PARSER_CALL_REFERENCE_DIRECT_EVAL)\n  {\n    parser_prepare_direct_eval_call (context_p);\n  }\n\n  if (call_ref_p->status_flags & PARSER_CALL_REFERENCE_SPREAD)\n  {\n    parser_emit_spread_call (context_p, call_ref_p);\n    return;\n  }\n\n  if (call_ref_p->call_arguments <= 1)\n  {\n    parser_emit_call_01 (context_p, call_ref_p);\n  }\n  else if (call_ref_p->call_arguments == 2)\n  {\n    parser_emit_call_2 (context_p, call_ref_p);\n  }\n  else\n  {\n    parser_emit_cbc_call (context_p, call_ref_p->opcode, call_ref_p->call_arguments);\n  }\n} /* parser_parse_call_expression */\n\n/**\n * Process 'expr?.'\n */\nstatic void\nparser_parse_optional_chain (parser_context_t *context_p, /**< context */\n                             size_t *grouping_level_p) /**< grouping level */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_QUESTION_MARK_DOT);\n\n  parser_push_result (context_p);\n\n  parser_branch_t branch;\n\n  switch (lexer_peek_next_character (context_p))\n  {\n    case LIT_CHAR_GRAVE_ACCENT:\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_TAGGED_TEMPLATE_OPTIONAL_CHAIN);\n      break;\n    }\n    case LIT_CHAR_LEFT_PAREN:\n    {\n      lexer_next_token (context_p);\n      parser_call_reference_t call_ref = parser_form_call_reference (context_p);\n\n      parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_BRANCH_OPTIONAL_CHAIN, &branch);\n\n      if (call_ref.opcode == CBC_CALL_PROP)\n      {\n        parser_emit_cbc_ext (context_p, CBC_EXT_POP_REFERENCE);\n        parser_flush_cbc (context_p);\n        JERRY_ASSERT (context_p->stack_limit - context_p->stack_depth >= 2);\n        PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, 2);\n      }\n\n      parser_parse_call_expression (context_p, &call_ref);\n      break;\n    }\n    case LIT_CHAR_LEFT_SQUARE:\n    {\n      parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_BRANCH_OPTIONAL_CHAIN, &branch);\n\n      lexer_next_token (context_p);\n      parser_parse_square_bracketed_expression (context_p);\n      parser_emit_cbc (context_p, CBC_PUSH_PROP);\n      break;\n    }\n    default:\n    {\n      parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_BRANCH_OPTIONAL_CHAIN, &branch);\n      parser_parse_property_access (context_p);\n      break;\n    }\n  }\n\n  while (true)\n  {\n    switch (context_p->token.type)\n    {\n      case LEXER_TEMPLATE_LITERAL:\n      case LEXER_INCREASE:\n      case LEXER_DECREASE:\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_TAGGED_TEMPLATE_OPTIONAL_CHAIN);\n        break;\n      }\n      case LEXER_DOT:\n      case LEXER_LEFT_PAREN:\n      case LEXER_LEFT_SQUARE:\n      case LEXER_QUESTION_MARK_DOT:\n      {\n        size_t grouping_level = *grouping_level_p | PARSE_EXPR_LEFT_HAND_SIDE;\n        parser_parse_postfix_expresion (context_p, &grouping_level);\n        break;\n      }\n      case LEXER_RIGHT_PAREN:\n      {\n        if (parser_process_group_expression (context_p, grouping_level_p))\n        {\n          continue;\n        }\n        break;\n      }\n      default:\n      {\n        break;\n      }\n    }\n\n    break;\n  }\n  parser_push_result (context_p);\n\n  parser_set_branch_to_current_position (context_p, &branch);\n\n  if (LEXER_IS_BINARY_LVALUE_OP_TOKEN (context_p->token.type))\n  {\n    parser_raise_error (context_p, PARSER_ERR_INVALID_LHS_ASSIGNMENT);\n  }\n} /* parser_parse_optional_chain */\n\n/**\n * Process 'new expr'\n */\nstatic void\nparser_process_new_expression (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->stack_top_uint8 == LEXER_KEYW_NEW);\n\n  parser_push_result (context_p);\n  parser_emit_cbc (context_p, CBC_NEW0);\n  parser_stack_pop_uint8 (context_p);\n} /* parser_process_new_expression */\n\n/**\n * Process postfix unary lvalue operators (++, --)\n */\nstatic void\nparser_parse_postfix_lvalue (parser_context_t *context_p, /**< context */\n                             size_t grouping_level) /**< grouping level */\n{\n  if ((context_p->token.flags & LEXER_WAS_NEWLINE) || grouping_level == PARSE_EXPR_LEFT_HAND_SIDE)\n  {\n    return;\n  }\n\n  switch (context_p->token.type)\n  {\n    case LEXER_INCREASE:\n    {\n      parser_push_result (context_p);\n      parser_emit_unary_lvalue_opcode (context_p, CBC_POST_INCR);\n      break;\n    }\n    case LEXER_DECREASE:\n    {\n      parser_push_result (context_p);\n      parser_emit_unary_lvalue_opcode (context_p, CBC_POST_DECR);\n      break;\n    }\n    default:\n    {\n      return;\n    }\n  }\n\n  lexer_next_token (context_p);\n} /* parser_parse_postfix_lvalue */\n\n/**\n * Emit bytecode for prefix unary tokes\n */\nstatic void\nparser_process_prefix_unary_opcodes (parser_context_t *context_p) /**< context */\n{\n  uint8_t last_unary_token = LEXER_INCREASE;\n\n  /* Generate byte code for the unary operators. */\n  while (true)\n  {\n    uint8_t token = context_p->stack_top_uint8;\n    if (!LEXER_IS_UNARY_OP_TOKEN (token))\n    {\n      if (context_p->token.type == LEXER_EXPONENTIATION && last_unary_token != LEXER_INCREASE\n          && last_unary_token != LEXER_DECREASE)\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_EXPONENTIATION);\n      }\n\n      break;\n    }\n\n    last_unary_token = token;\n    parser_push_result (context_p);\n    parser_stack_pop_uint8 (context_p);\n\n    if (LEXER_IS_UNARY_LVALUE_OP_TOKEN (token))\n    {\n      if (token == LEXER_KEYW_DELETE)\n      {\n        token = CBC_DELETE_PUSH_RESULT;\n      }\n      else\n      {\n        token = (uint8_t) (LEXER_UNARY_LVALUE_OP_TOKEN_TO_OPCODE (token));\n      }\n      parser_emit_unary_lvalue_opcode (context_p, (cbc_opcode_t) token);\n    }\n    else if (JERRY_UNLIKELY (token == LEXER_KEYW_AWAIT))\n    {\n      cbc_ext_opcode_t opcode =\n        ((context_p->status_flags & PARSER_IS_GENERATOR_FUNCTION) ? CBC_EXT_GENERATOR_AWAIT : CBC_EXT_AWAIT);\n      parser_emit_cbc_ext (context_p, opcode);\n    }\n    else\n    {\n      token = (uint8_t) (LEXER_UNARY_OP_TOKEN_TO_OPCODE (token));\n\n      if (token == CBC_TYPEOF)\n      {\n        if (PARSER_IS_PUSH_LITERALS_WITH_THIS (context_p->last_cbc_opcode)\n            && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL)\n        {\n          parser_emit_ident_reference (context_p, CBC_TYPEOF_IDENT);\n        }\n        else\n        {\n          parser_emit_cbc (context_p, token);\n        }\n      }\n      else\n      {\n        if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n        {\n          /* It is not worth to combine with push multiple literals\n           * since the byte code size will not decrease. */\n          JERRY_ASSERT (CBC_SAME_ARGS (context_p->last_cbc_opcode, token + 1));\n          context_p->last_cbc_opcode = (uint16_t) (token + 1);\n        }\n        else\n        {\n          parser_emit_cbc (context_p, token);\n        }\n      }\n    }\n  }\n} /* parser_process_prefix_unary_opcodes */\n\n/**\n * Parse the postfix part of the expression\n */\nstatic void\nparser_parse_postfix_expresion (parser_context_t *context_p, /**< context */\n                                size_t *grouping_level_p) /**< grouping level */\n{\n  /* Parse postfix part of a primary expression. */\n  while (true)\n  {\n    /* Since break would only break the switch, we use\n     * continue to continue this loop. Without continue,\n     * the code abandons the loop. */\n    switch (context_p->token.type)\n    {\n      case LEXER_DOT:\n      {\n        parser_parse_property_access (context_p);\n        continue;\n      }\n      case LEXER_LEFT_SQUARE:\n      {\n        parser_parse_element_access (context_p);\n        continue;\n      }\n      case LEXER_QUESTION_MARK_DOT:\n      {\n        parser_parse_optional_chain (context_p, grouping_level_p);\n        continue;\n      }\n      case LEXER_TEMPLATE_LITERAL:\n      case LEXER_LEFT_PAREN:\n      {\n        parser_call_reference_t call_ref = parser_form_call_reference (context_p);\n        parser_parse_call_expression (context_p, &call_ref);\n        continue;\n      }\n      default:\n      {\n        if (context_p->stack_top_uint8 == LEXER_KEYW_NEW)\n        {\n          parser_process_new_expression (context_p);\n          continue;\n        }\n\n        parser_parse_postfix_lvalue (context_p, *grouping_level_p);\n        break;\n      }\n    }\n    break;\n  }\n} /* parser_parse_postfix_expresion */\n\n/**\n * Append a binary '=' token.\n *\n * @return - pushed assignment opcode onto the parser stack\n */\nstatic void\nparser_append_binary_single_assignment_token (parser_context_t *context_p, /**< context */\n                                              uint32_t pattern_flags) /**< pattern flags */\n{\n  JERRY_UNUSED (pattern_flags);\n\n  /* Unlike other tokens, the whole byte code is saved for binary\n   * assignment, since it has multiple forms depending on the\n   * previous instruction. */\n\n  uint8_t assign_opcode = CBC_ASSIGN;\n\n  if (PARSER_IS_PUSH_LITERALS_WITH_THIS (context_p->last_cbc_opcode)\n      && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL)\n  {\n    parser_check_invalid_assign (context_p);\n\n    uint16_t literal_index;\n\n    switch (context_p->last_cbc_opcode)\n    {\n      case CBC_PUSH_LITERAL:\n      {\n        literal_index = context_p->last_cbc.literal_index;\n        context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n        break;\n      }\n      case CBC_PUSH_TWO_LITERALS:\n      {\n        literal_index = context_p->last_cbc.value;\n        context_p->last_cbc_opcode = CBC_PUSH_LITERAL;\n        break;\n      }\n      case CBC_PUSH_THIS_LITERAL:\n      {\n        literal_index = context_p->last_cbc.literal_index;\n        context_p->last_cbc_opcode = CBC_PUSH_THIS;\n        parser_flush_cbc (context_p);\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_THREE_LITERALS);\n        literal_index = context_p->last_cbc.third_literal_index;\n        context_p->last_cbc_opcode = CBC_PUSH_TWO_LITERALS;\n        break;\n      }\n    }\n\n    assign_opcode = CBC_ASSIGN_SET_IDENT;\n\n    if (!(pattern_flags & (PARSER_PATTERN_LET | PARSER_PATTERN_CONST | PARSER_PATTERN_LOCAL)))\n    {\n      if (scanner_literal_is_const_reg (context_p, literal_index))\n      {\n        parser_stack_push_uint8 (context_p, LEXER_ASSIGN_CONST);\n      }\n    }\n    else if (literal_index < PARSER_REGISTER_START)\n    {\n      assign_opcode = CBC_INIT_LET;\n\n      if (scanner_literal_is_created (context_p, literal_index))\n      {\n        assign_opcode = CBC_ASSIGN_LET_CONST;\n      }\n      else if (pattern_flags & PARSER_PATTERN_CONST)\n      {\n        assign_opcode = CBC_INIT_CONST;\n      }\n      else if (pattern_flags & PARSER_PATTERN_LOCAL)\n      {\n        assign_opcode = CBC_INIT_ARG_OR_CATCH;\n      }\n    }\n\n    parser_stack_push_uint16 (context_p, literal_index);\n    JERRY_ASSERT (CBC_SAME_ARGS (CBC_PUSH_LITERAL, assign_opcode));\n  }\n  else if (context_p->last_cbc_opcode == CBC_PUSH_PROP)\n  {\n    JERRY_ASSERT (CBC_SAME_ARGS (CBC_PUSH_PROP, CBC_ASSIGN));\n    context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n  }\n  else if (context_p->last_cbc_opcode == CBC_PUSH_PROP_LITERAL)\n  {\n    if (context_p->last_cbc.literal_type != LEXER_IDENT_LITERAL)\n    {\n      JERRY_ASSERT (CBC_SAME_ARGS (CBC_PUSH_PROP_LITERAL, CBC_ASSIGN_PROP_LITERAL));\n      parser_stack_push_uint16 (context_p, context_p->last_cbc.literal_index);\n      assign_opcode = CBC_ASSIGN_PROP_LITERAL;\n      context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n    }\n    else\n    {\n      context_p->last_cbc_opcode = CBC_PUSH_LITERAL;\n    }\n  }\n  else if (context_p->last_cbc_opcode == CBC_PUSH_PROP_LITERAL_LITERAL)\n  {\n    JERRY_ASSERT (CBC_SAME_ARGS (CBC_PUSH_PROP_LITERAL_LITERAL, CBC_PUSH_TWO_LITERALS));\n    context_p->last_cbc_opcode = CBC_PUSH_TWO_LITERALS;\n  }\n  else if (context_p->last_cbc_opcode == CBC_PUSH_PROP_THIS_LITERAL)\n  {\n    if (context_p->last_cbc.literal_type != LEXER_IDENT_LITERAL)\n    {\n      JERRY_ASSERT (CBC_SAME_ARGS (CBC_PUSH_PROP_THIS_LITERAL, CBC_ASSIGN_PROP_THIS_LITERAL));\n      parser_stack_push_uint16 (context_p, context_p->last_cbc.literal_index);\n      assign_opcode = CBC_ASSIGN_PROP_THIS_LITERAL;\n      context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n    }\n    else\n    {\n      context_p->last_cbc_opcode = CBC_PUSH_THIS_LITERAL;\n    }\n  }\n  else if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_PROP_LITERAL))\n  {\n    context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_SUPER_PROP_LITERAL_ASSIGNMENT_REFERENCE);\n    parser_stack_push_uint8 (context_p, CBC_EXT_ASSIGN_SUPER);\n    assign_opcode = CBC_EXT_OPCODE;\n  }\n  else if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_PROP))\n  {\n    context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_SUPER_PROP_ASSIGNMENT_REFERENCE);\n    parser_stack_push_uint8 (context_p, CBC_EXT_ASSIGN_SUPER);\n    assign_opcode = CBC_EXT_OPCODE;\n  }\n  else if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_PRIVATE_PROP_LITERAL))\n  {\n    context_p->last_cbc_opcode = CBC_PUSH_LITERAL;\n    parser_stack_push_uint8 (context_p, CBC_EXT_ASSIGN_PRIVATE);\n    assign_opcode = CBC_EXT_OPCODE;\n  }\n  else\n  {\n    /* Invalid LeftHandSide expression. */ // 3820, 3815\n    parser_check_invalid_new_target (context_p, CBC_ASSIGN);\n    parser_raise_error (context_p, PARSER_ERR_INVALID_LHS_ASSIGNMENT);\n  }\n\n  parser_stack_push_uint8 (context_p, assign_opcode);\n  parser_stack_push_uint8 (context_p, LEXER_ASSIGN);\n} /* parser_append_binary_single_assignment_token */\n\n/**\n * Check for invalid chain of logical operators\n */\nstatic void\nparser_check_invalid_logical_op (parser_context_t *context_p, /**< context */\n                                 uint8_t invalid_token1, /**< token id of first invalid token */\n                                 uint8_t invalid_token2) /**< token id of second invalid token */\n{\n  parser_stack_iterator_t iterator;\n  parser_stack_iterator_init (context_p, &iterator);\n\n  while (true)\n  {\n    uint8_t token = parser_stack_iterator_read_uint8 (&iterator);\n\n    if (!LEXER_IS_BINARY_NON_LVALUE_OP_TOKEN (token))\n    {\n      return;\n    }\n\n    if (token == invalid_token1 || token == invalid_token2)\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_NULLISH_COALESCING);\n    }\n\n    /* If a logical operator is found, and there is no SyntaxError, the scan can be terminated\n     * since there was no SyntaxError when the logical operator was pushed onto the stack. */\n    if (token == LEXER_LOGICAL_OR || token == LEXER_LOGICAL_AND || token == LEXER_NULLISH_COALESCING)\n    {\n      return;\n    }\n\n    parser_stack_iterator_skip (&iterator, sizeof (uint8_t));\n  }\n} /* parser_check_invalid_logical_op */\n\n/**\n * Append a binary lvalue token.\n */\nstatic void\nparser_append_binary_lvalue_token (parser_context_t *context_p, /**< context */\n                                   bool is_logical_assignment) /**< true - if form logical assignment\n                                                                * reference false - otherwise */\n{\n  if (PARSER_IS_PUSH_LITERALS_WITH_THIS (context_p->last_cbc_opcode)\n      && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL)\n  {\n    parser_check_invalid_assign (context_p);\n\n    parser_emit_ident_reference (context_p, CBC_PUSH_IDENT_REFERENCE);\n\n    if (!is_logical_assignment && scanner_literal_is_const_reg (context_p, context_p->last_cbc.literal_index))\n    {\n      parser_stack_push_uint8 (context_p, LEXER_ASSIGN_CONST);\n    }\n  }\n  else if (PARSER_IS_PUSH_PROP (context_p->last_cbc_opcode))\n  {\n    context_p->last_cbc_opcode = PARSER_PUSH_PROP_TO_PUSH_PROP_REFERENCE (context_p->last_cbc_opcode);\n  }\n  else\n  {\n    /* Invalid LeftHandSide expression. */\n    parser_check_invalid_new_target (context_p, CBC_ASSIGN);\n    parser_raise_error (context_p, PARSER_ERR_INVALID_LHS_ASSIGNMENT);\n    parser_emit_cbc (context_p, CBC_PUSH_PROP_REFERENCE);\n  }\n\n  if (!is_logical_assignment)\n  {\n    parser_stack_push_uint8 (context_p, (uint8_t) context_p->token.type);\n  }\n} /* parser_append_binary_lvalue_token */\n\n/**\n * Append a logical token.\n */\nstatic void\nparser_append_logical_token (parser_context_t *context_p, /**< context */\n                             uint16_t opcode) /**< opcode */\n{\n  if (opcode != PARSER_TO_EXT_OPCODE (CBC_EXT_BRANCH_IF_NULLISH))\n  {\n    parser_check_invalid_logical_op (context_p, LEXER_NULLISH_COALESCING, LEXER_NULLISH_COALESCING);\n  }\n\n  parser_branch_t branch;\n  parser_emit_cbc_forward_branch (context_p, opcode, &branch);\n  parser_stack_push (context_p, &branch, sizeof (parser_branch_t));\n  parser_stack_push_uint8 (context_p, (uint8_t) context_p->token.type);\n} /* parser_append_logical_token */\n\n/**\n * Append a logical token.\n */\nstatic void\nparser_append_logical_assignment_token (parser_context_t *context_p, /**< context */\n                                        uint16_t opcode) /**< opcode */\n{\n  uint16_t last_cbc_opcode = context_p->last_cbc_opcode;\n  parser_append_binary_single_assignment_token (context_p, 0);\n  parser_stack_change_last_uint8 (context_p, LEXER_ASSIGN_REFERENCE);\n  context_p->last_cbc_opcode = last_cbc_opcode;\n\n  parser_append_binary_lvalue_token (context_p, true);\n  parser_append_logical_token (context_p, opcode);\n} /* parser_append_logical_assignment_token */\n\n/**\n * Append a binary token.\n */\nstatic void\nparser_append_binary_token (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (LEXER_IS_BINARY_OP_TOKEN (context_p->token.type));\n  parser_push_result (context_p);\n\n  switch (context_p->token.type)\n  {\n    case LEXER_ASSIGN:\n    {\n      parser_append_binary_single_assignment_token (context_p, 0);\n      break;\n    }\n    /* Binary lvalue-opcodes */\n    case LEXER_ASSIGN_ADD:\n    case LEXER_ASSIGN_SUBTRACT:\n    case LEXER_ASSIGN_MULTIPLY:\n    case LEXER_ASSIGN_DIVIDE:\n    case LEXER_ASSIGN_MODULO:\n    case LEXER_ASSIGN_EXPONENTIATION:\n    case LEXER_ASSIGN_LEFT_SHIFT:\n    case LEXER_ASSIGN_RIGHT_SHIFT:\n    case LEXER_ASSIGN_UNS_RIGHT_SHIFT:\n    case LEXER_ASSIGN_BIT_AND:\n    case LEXER_ASSIGN_BIT_OR:\n    case LEXER_ASSIGN_BIT_XOR:\n    {\n      parser_append_binary_lvalue_token (context_p, false);\n      break;\n    }\n    case LEXER_ASSIGN_NULLISH_COALESCING:\n    {\n      parser_append_logical_assignment_token (context_p, PARSER_TO_EXT_OPCODE (CBC_EXT_BRANCH_IF_NULLISH));\n      break;\n    }\n    case LEXER_ASSIGN_LOGICAL_OR:\n    {\n      parser_append_logical_assignment_token (context_p, CBC_BRANCH_IF_LOGICAL_TRUE);\n      break;\n    }\n    case LEXER_ASSIGN_LOGICAL_AND:\n    {\n      parser_append_logical_assignment_token (context_p, CBC_BRANCH_IF_LOGICAL_FALSE);\n      break;\n    }\n    case LEXER_NULLISH_COALESCING:\n    {\n      parser_append_logical_token (context_p, PARSER_TO_EXT_OPCODE (CBC_EXT_BRANCH_IF_NULLISH));\n      break;\n    }\n    case LEXER_LOGICAL_OR:\n    {\n      parser_append_logical_token (context_p, CBC_BRANCH_IF_LOGICAL_TRUE);\n      break;\n    }\n    case LEXER_LOGICAL_AND:\n    {\n      parser_append_logical_token (context_p, CBC_BRANCH_IF_LOGICAL_FALSE);\n      break;\n    }\n    default:\n    {\n      parser_stack_push_uint8 (context_p, (uint8_t) context_p->token.type);\n      break;\n    }\n  }\n} /* parser_append_binary_token */\n\n/**\n * Emit opcode for binary assignment token.\n */\nstatic void\nparser_process_binary_assignment_token (parser_context_t *context_p, /**< context */\n                                        uint8_t token) /**< token */\n{\n  uint16_t index = PARSER_INVALID_LITERAL_INDEX;\n  uint16_t opcode = context_p->stack_top_uint8;\n\n  if (JERRY_UNLIKELY (opcode == CBC_EXT_OPCODE))\n  {\n    parser_stack_pop_uint8 (context_p);\n    JERRY_ASSERT (context_p->stack_top_uint8 == CBC_EXT_ASSIGN_SUPER\n                  || context_p->stack_top_uint8 == CBC_EXT_ASSIGN_PRIVATE);\n    opcode = PARSER_TO_EXT_OPCODE (context_p->stack_top_uint8);\n    parser_stack_pop_uint8 (context_p);\n  }\n  else\n  {\n    parser_stack_pop_uint8 (context_p);\n\n    if (cbc_flags[opcode] & CBC_HAS_LITERAL_ARG)\n    {\n      JERRY_ASSERT (opcode == CBC_ASSIGN_SET_IDENT || opcode == CBC_ASSIGN_PROP_LITERAL\n                    || opcode == CBC_ASSIGN_PROP_THIS_LITERAL || opcode == CBC_ASSIGN_LET_CONST\n                    || opcode == CBC_INIT_ARG_OR_CATCH || opcode == CBC_INIT_LET || opcode == CBC_INIT_CONST);\n\n      index = parser_stack_pop_uint16 (context_p);\n    }\n  }\n\n  bool group_expr_assingment = false;\n\n  if (JERRY_UNLIKELY (context_p->stack_top_uint8 == LEXER_ASSIGN_CONST))\n  {\n    parser_stack_pop_uint8 (context_p);\n    parser_emit_cbc_ext (context_p, CBC_EXT_THROW_ASSIGN_CONST_ERROR);\n  }\n\n  if (JERRY_UNLIKELY (context_p->stack_top_uint8 == LEXER_ASSIGN_GROUP_EXPR))\n  {\n    group_expr_assingment = true;\n    parser_stack_pop_uint8 (context_p);\n  }\n\n  if (index == PARSER_INVALID_LITERAL_INDEX)\n  {\n    if (JERRY_UNLIKELY (token == LEXER_ASSIGN_REFERENCE))\n    {\n      opcode = CBC_ASSIGN_PUSH_RESULT;\n    }\n\n    parser_emit_cbc (context_p, opcode);\n    return;\n  }\n\n  if (!group_expr_assingment)\n  {\n    uint16_t function_literal_index = parser_check_anonymous_function_declaration (context_p);\n\n    if (function_literal_index == PARSER_ANONYMOUS_CLASS)\n    {\n      uint16_t name_index = scanner_save_literal (context_p, index);\n      parser_emit_cbc_ext_literal (context_p, CBC_EXT_SET_CLASS_NAME, name_index);\n    }\n    else if (function_literal_index < PARSER_NAMED_FUNCTION)\n    {\n      parser_set_function_name (context_p, function_literal_index, (uint16_t) index, 0);\n    }\n  }\n\n  if (JERRY_UNLIKELY (token == LEXER_ASSIGN_REFERENCE))\n  {\n    parser_emit_cbc (context_p, CBC_ASSIGN_PUSH_RESULT);\n    return;\n  }\n\n  if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL && opcode == CBC_ASSIGN_SET_IDENT)\n  {\n    JERRY_ASSERT (CBC_ARGS_EQ (CBC_ASSIGN_LITERAL_SET_IDENT, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2));\n\n    context_p->last_cbc.value = index;\n    context_p->last_cbc_opcode = CBC_ASSIGN_LITERAL_SET_IDENT;\n    return;\n  }\n\n  parser_emit_cbc_literal (context_p, (uint16_t) opcode, index);\n\n  if (opcode == CBC_ASSIGN_PROP_THIS_LITERAL && (context_p->stack_depth >= context_p->stack_limit))\n  {\n    /* Stack limit is increased for VM_OC_ASSIGN_PROP_THIS. Needed by vm.c. */\n    JERRY_ASSERT (context_p->stack_depth == context_p->stack_limit);\n\n    context_p->stack_limit++;\n\n    if (context_p->stack_limit > PARSER_MAXIMUM_STACK_LIMIT)\n    {\n      parser_raise_error (context_p, PARSER_ERR_STACK_LIMIT_REACHED);\n    }\n  }\n} /* parser_process_binary_opcodes */\n\n/**\n * Emit opcode for logical tokens.\n */\nstatic void\nparser_process_logical_token (parser_context_t *context_p) /**< context */\n{\n  parser_branch_t branch;\n  parser_stack_pop (context_p, &branch, sizeof (parser_branch_t));\n  parser_set_branch_to_current_position (context_p, &branch);\n} /* parser_process_logical_token */\n\n/**\n * Emit opcode for logical assignment tokens.\n */\nstatic void\nparser_process_logical_assignment_token (parser_context_t *context_p) /**< context */\n{\n  parser_branch_t condition_branch;\n  parser_stack_pop (context_p, &condition_branch, sizeof (parser_branch_t));\n\n  uint8_t token = context_p->stack_top_uint8;\n  JERRY_ASSERT (token == LEXER_ASSIGN_REFERENCE);\n  parser_stack_pop_uint8 (context_p);\n  parser_process_binary_assignment_token (context_p, token);\n\n  parser_branch_t prop_reference_branch;\n  parser_emit_cbc_forward_branch (context_p, CBC_JUMP_FORWARD, &prop_reference_branch);\n\n  parser_set_branch_to_current_position (context_p, &condition_branch);\n  parser_emit_cbc_ext (context_p, CBC_EXT_POP_REFERENCE);\n\n  JERRY_ASSERT (context_p->stack_limit - context_p->stack_depth >= 2);\n  PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, 2);\n\n  parser_set_branch_to_current_position (context_p, &prop_reference_branch);\n} /* parser_process_logical_assignment_token */\n\n/**\n * Emit opcode for binary tokens.\n */\nstatic void\nparser_process_binary_token (parser_context_t *context_p, /**< context */\n                             uint8_t token) /**< token */\n{\n  uint16_t opcode = LEXER_BINARY_OP_TOKEN_TO_OPCODE (token);\n\n  if (PARSER_IS_PUSH_NUMBER (context_p->last_cbc_opcode))\n  {\n    lexer_convert_push_number_to_push_literal (context_p);\n  }\n\n  if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n  {\n    JERRY_ASSERT (CBC_SAME_ARGS (context_p->last_cbc_opcode, opcode + CBC_BINARY_WITH_LITERAL));\n    context_p->last_cbc_opcode = (uint16_t) (opcode + CBC_BINARY_WITH_LITERAL);\n    return;\n  }\n\n  if (context_p->last_cbc_opcode == CBC_PUSH_TWO_LITERALS)\n  {\n    JERRY_ASSERT (CBC_ARGS_EQ (opcode + CBC_BINARY_WITH_TWO_LITERALS, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2));\n    context_p->last_cbc_opcode = (uint16_t) (opcode + CBC_BINARY_WITH_TWO_LITERALS);\n    return;\n  }\n\n  parser_emit_cbc (context_p, opcode);\n} /* parser_process_binary_token */\n\n/**\n * Emit opcode for binary lvalue tokens.\n */\nstatic void\nparser_process_binary_lvalue_token (parser_context_t *context_p, /**< context */\n                                    uint8_t token) /**< token */\n{\n  parser_stack_push_uint8 (context_p, CBC_ASSIGN);\n  parser_stack_push_uint8 (context_p, LEXER_ASSIGN);\n  parser_stack_push_uint8 (context_p, lexer_convert_binary_lvalue_token_to_binary (token));\n} /* parser_process_binary_lvalue_token */\n\n/**\n * Emit opcode for binary computations.\n */\nstatic void\nparser_process_binary_opcodes (parser_context_t *context_p, /**< context */\n                               uint8_t min_prec_treshold) /**< minimal precedence of tokens */\n{\n  while (true)\n  {\n    uint8_t token = context_p->stack_top_uint8;\n\n    /* For left-to-right operators (all binary operators except assignment\n     * and logical operators), the byte code is flushed if the precedence\n     * of the next operator is less or equal than the current operator. For\n     * assignment and logical operators, we add 1 to the min precendence to\n     * force right-to-left evaluation order. */\n\n    if (!LEXER_IS_BINARY_OP_TOKEN (token)\n        || parser_binary_precedence_table[token - LEXER_FIRST_BINARY_OP] < min_prec_treshold)\n    {\n      return;\n    }\n\n    parser_push_result (context_p);\n    parser_stack_pop_uint8 (context_p);\n\n    switch (token)\n    {\n      case LEXER_ASSIGN:\n      {\n        parser_process_binary_assignment_token (context_p, token);\n        continue;\n      }\n        /* Binary lvalue-opcodes */\n      case LEXER_ASSIGN_ADD:\n      case LEXER_ASSIGN_SUBTRACT:\n      case LEXER_ASSIGN_MULTIPLY:\n      case LEXER_ASSIGN_DIVIDE:\n      case LEXER_ASSIGN_MODULO:\n      case LEXER_ASSIGN_EXPONENTIATION:\n      case LEXER_ASSIGN_LEFT_SHIFT:\n      case LEXER_ASSIGN_RIGHT_SHIFT:\n      case LEXER_ASSIGN_UNS_RIGHT_SHIFT:\n      case LEXER_ASSIGN_BIT_AND:\n      case LEXER_ASSIGN_BIT_OR:\n      case LEXER_ASSIGN_BIT_XOR:\n      {\n        parser_process_binary_lvalue_token (context_p, token);\n        continue;\n      }\n      case LEXER_ASSIGN_NULLISH_COALESCING:\n      case LEXER_ASSIGN_LOGICAL_OR:\n      case LEXER_ASSIGN_LOGICAL_AND:\n      {\n        parser_process_logical_assignment_token (context_p);\n        continue;\n      }\n      case LEXER_NULLISH_COALESCING:\n      case LEXER_LOGICAL_OR:\n      case LEXER_LOGICAL_AND:\n      {\n        parser_process_logical_token (context_p);\n        continue;\n      }\n      case LEXER_KEYW_IN:\n      {\n        if (context_p->stack_top_uint8 == LEXER_PRIVATE_PRIMARY_EXPR)\n        {\n          parser_stack_pop_uint8 (context_p);\n          uint16_t lit_id = parser_stack_pop_uint16 (context_p);\n          parser_emit_cbc_ext_literal (context_p, CBC_EXT_PUSH_PRIVATE_PROP_LITERAL_IN, lit_id);\n          continue;\n        }\n\n        /* FALLTHRU */\n      }\n      default:\n      {\n        parser_process_binary_token (context_p, token);\n        continue;\n      }\n    }\n  }\n} /* parser_process_binary_opcodes */\n\n/**\n * End position marker of a pattern.\n */\ntypedef struct\n{\n  scanner_location_t location; /**< end position of the pattern */\n  lexer_token_t token; /**< token at the end position */\n} parser_pattern_end_marker_t;\n\n/**\n * Literal index should not be emitted while processing rhs target value\n */\n#define PARSER_PATTERN_RHS_NO_LIT PARSER_INVALID_LITERAL_INDEX\n\n/**\n * Process the target of an initializer pattern.\n */\nstatic parser_pattern_end_marker_t\nparser_pattern_get_target (parser_context_t *context_p, /**< context */\n                           parser_pattern_flags_t flags) /**< flags */\n{\n  parser_pattern_end_marker_t end_marker;\n  scanner_location_t location;\n  location.column = 0;\n  location.line = 0;\n  location.source_p = NULL;\n  end_marker.location = location;\n  end_marker.token.type = LEXER_INVALID_PATTERN;\n  parser_branch_t skip_init;\n\n  if (flags & PARSER_PATTERN_TARGET_DEFAULT)\n  {\n    JERRY_ASSERT (flags & PARSER_PATTERN_TARGET_ON_STACK);\n\n    parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_DEFAULT_INITIALIZER, &skip_init);\n  }\n\n  if ((flags & (PARSER_PATTERN_TARGET_ON_STACK | PARSER_PATTERN_TARGET_DEFAULT)) != PARSER_PATTERN_TARGET_ON_STACK)\n  {\n    scanner_location_t start_location;\n\n    if (context_p->next_scanner_info_p->source_p != context_p->source_p\n        || context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED || (flags & PARSER_PATTERN_REST_ELEMENT))\n    {\n      /* Found invalid pattern, push null value to fake the rhs target. */\n      parser_emit_cbc (context_p, CBC_PUSH_NULL);\n    }\n    else\n    {\n      JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_INITIALIZER);\n      scanner_get_location (&start_location, context_p);\n\n      scanner_set_location (context_p, &((scanner_location_info_t *) context_p->next_scanner_info_p)->location);\n      scanner_release_next (context_p, sizeof (scanner_location_info_t));\n      scanner_seek (context_p);\n      lexer_next_token (context_p);\n\n      parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n      scanner_get_location (&(end_marker.location), context_p);\n      end_marker.token = context_p->token;\n\n      scanner_set_location (context_p, &start_location);\n      scanner_seek (context_p);\n      parser_flush_cbc (context_p);\n    }\n  }\n\n  if (flags & PARSER_PATTERN_TARGET_DEFAULT)\n  {\n    parser_set_branch_to_current_position (context_p, &skip_init);\n  }\n\n  return end_marker;\n} /* parser_pattern_get_target */\n\n/**\n * Finalize an assignment/binding pattern.\n */\nstatic void\nparser_pattern_finalize (parser_context_t *context_p, /**< context */\n                         parser_pattern_flags_t flags, /**< flags */\n                         parser_pattern_end_marker_t *end_marker_p) /**< pattern end position  */\n{\n  if ((flags & (PARSER_PATTERN_TARGET_ON_STACK | PARSER_PATTERN_TARGET_DEFAULT)) != PARSER_PATTERN_TARGET_ON_STACK)\n  {\n    if (end_marker_p->token.type == LEXER_INVALID_PATTERN)\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_DESTRUCTURING_PATTERN);\n    }\n\n    scanner_set_location (context_p, &(end_marker_p->location));\n    context_p->token = end_marker_p->token;\n  }\n  else\n  {\n    JERRY_ASSERT (!(flags & PARSER_PATTERN_TARGET_DEFAULT));\n    lexer_next_token (context_p);\n  }\n\n  if ((flags & (PARSER_PATTERN_BINDING | PARSER_PATTERN_NESTED_PATTERN)) == PARSER_PATTERN_BINDING)\n  {\n    /* Pop the result of the expression. */\n    parser_emit_cbc (context_p, CBC_POP);\n  }\n\n  parser_flush_cbc (context_p);\n} /* parser_pattern_finalize */\n\n/**\n * Emit right-hand-side target value.\n */\nstatic void\nparser_pattern_emit_rhs (parser_context_t *context_p, /**< context */\n                         uint16_t rhs_opcode, /**< opcode to process the rhs value */\n                         uint16_t literal_index) /**< literal index for object pattern */\n{\n  if (literal_index != PARSER_PATTERN_RHS_NO_LIT)\n  {\n    parser_emit_cbc_ext_literal (context_p, rhs_opcode, literal_index);\n  }\n  else\n  {\n    parser_emit_cbc_ext (context_p, rhs_opcode);\n  }\n} /* parser_pattern_emit_rhs */\n\n/**\n * Form an assignment from a pattern.\n */\nstatic void\nparser_pattern_form_assignment (parser_context_t *context_p, /**< context */\n                                parser_pattern_flags_t flags, /**< flags */\n                                uint16_t rhs_opcode, /**< opcode to process the rhs value */\n                                uint16_t literal_index, /**< literal index for object pattern */\n                                parser_line_counter_t ident_line_counter) /**< identifier line counter */\n{\n  JERRY_UNUSED (ident_line_counter);\n\n  uint16_t name_index = PARSER_INVALID_LITERAL_INDEX;\n\n  if ((flags & PARSER_PATTERN_BINDING)\n      || (context_p->last_cbc_opcode == CBC_PUSH_LITERAL && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL))\n  {\n    name_index = context_p->lit_object.index;\n  }\n\n  parser_stack_push_uint8 (context_p, LEXER_EXPRESSION_START);\n  parser_append_binary_single_assignment_token (context_p, flags);\n  parser_pattern_emit_rhs (context_p, rhs_opcode, literal_index);\n\n  if (context_p->token.type == LEXER_ASSIGN && !(flags & PARSER_PATTERN_REST_ELEMENT))\n  {\n    parser_branch_t skip_init;\n    lexer_next_token (context_p);\n    parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_DEFAULT_INITIALIZER, &skip_init);\n\n    parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n\n    if (name_index != PARSER_INVALID_LITERAL_INDEX)\n    {\n      uint16_t function_literal_index = parser_check_anonymous_function_declaration (context_p);\n\n      if (function_literal_index == PARSER_ANONYMOUS_CLASS)\n      {\n        name_index = scanner_save_literal (context_p, name_index);\n        parser_emit_cbc_ext_literal (context_p, CBC_EXT_SET_CLASS_NAME, name_index);\n      }\n      else if (function_literal_index < PARSER_NAMED_FUNCTION)\n      {\n        parser_set_function_name (context_p, function_literal_index, name_index, 0);\n      }\n    }\n    parser_set_branch_to_current_position (context_p, &skip_init);\n  }\n\n  parser_process_binary_opcodes (context_p, 0);\n\n  JERRY_ASSERT (context_p->stack_top_uint8 == LEXER_EXPRESSION_START);\n  parser_stack_pop_uint8 (context_p);\n\n#if JERRY_DEBUGGER\n  if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n      && ident_line_counter != context_p->last_breakpoint_line)\n  {\n    parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);\n    parser_flush_cbc (context_p);\n\n    parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, ident_line_counter);\n\n    context_p->last_breakpoint_line = ident_line_counter;\n  }\n#endif /* JERRY_DEBUGGER */\n} /* parser_pattern_form_assignment */\n\n/**\n * Parse pattern inside a pattern.\n */\nstatic void\nparser_pattern_process_nested_pattern (parser_context_t *context_p, /**< context */\n                                       parser_pattern_flags_t flags, /**< flags */\n                                       uint16_t rhs_opcode, /**< opcode to process the rhs value */\n                                       uint16_t literal_index) /**< literal index for object pattern */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_BRACE || context_p->token.type == LEXER_LEFT_SQUARE);\n\n  parser_pattern_flags_t options = (PARSER_PATTERN_NESTED_PATTERN | PARSER_PATTERN_TARGET_ON_STACK\n                                    | (flags\n                                       & (PARSER_PATTERN_BINDING | PARSER_PATTERN_LET | PARSER_PATTERN_CONST\n                                          | PARSER_PATTERN_LOCAL | PARSER_PATTERN_ARGUMENTS)));\n\n  JERRY_ASSERT (context_p->next_scanner_info_p->source_p != context_p->source_p\n                || context_p->next_scanner_info_p->type == SCANNER_TYPE_INITIALIZER\n                || context_p->next_scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS);\n\n  if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n  {\n    if (context_p->next_scanner_info_p->type == SCANNER_TYPE_INITIALIZER)\n    {\n      if (context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_OBJECT_HAS_REST)\n      {\n        options |= PARSER_PATTERN_HAS_REST_ELEMENT;\n      }\n\n      if (!(flags & PARSER_PATTERN_REST_ELEMENT))\n      {\n        options |= PARSER_PATTERN_TARGET_DEFAULT;\n      }\n      else\n      {\n        scanner_release_next (context_p, sizeof (scanner_location_info_t));\n      }\n    }\n    else\n    {\n      if (context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_OBJECT_HAS_REST)\n      {\n        options |= PARSER_PATTERN_HAS_REST_ELEMENT;\n      }\n      scanner_release_next (context_p, sizeof (scanner_info_t));\n    }\n  }\n\n  parser_pattern_emit_rhs (context_p, rhs_opcode, literal_index);\n\n  if (context_p->token.type == LEXER_LEFT_BRACE)\n  {\n    parser_parse_object_initializer (context_p, options);\n  }\n  else\n  {\n    parser_parse_array_initializer (context_p, options);\n  }\n\n  parser_emit_cbc (context_p, CBC_POP);\n} /* parser_pattern_process_nested_pattern */\n\n/**\n * Process the current {Binding, Assignment}Property\n *\n * @return true, if a nested pattern is processed, false otherwise\n */\nstatic bool\nparser_pattern_process_assignment (parser_context_t *context_p, /**< context */\n                                   parser_pattern_flags_t flags, /**< flags */\n                                   uint16_t rhs_opcode, /**< opcode to process the rhs value */\n                                   uint16_t literal_index, /**< literal index for object pattern */\n                                   lexer_token_type_t end_type) /**< end type token */\n{\n  if ((context_p->token.type == LEXER_LEFT_BRACE || context_p->token.type == LEXER_LEFT_SQUARE)\n      && (context_p->next_scanner_info_p->source_p != context_p->source_p\n          || !(context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_NO_DESTRUCTURING)))\n  {\n    parser_pattern_process_nested_pattern (context_p, flags, rhs_opcode, literal_index);\n    return true;\n  }\n\n  parser_line_counter_t ident_line_counter = context_p->token.line;\n#if JERRY_LINE_INFO\n  parser_line_counter_t ident_column_counter = context_p->token.column;\n#endif /* JERRY_LINE_INFO */\n\n  if (flags & PARSER_PATTERN_BINDING)\n  {\n    if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n    {\n      parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n    }\n\n    lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_IDENT_LITERAL);\n\n    if (flags & (PARSER_PATTERN_LET | PARSER_PATTERN_CONST) && context_p->token.keyword_type == LEXER_KEYW_LET)\n    {\n      parser_raise_error (context_p, PARSER_ERR_LEXICAL_LET_BINDING);\n    }\n\n    if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n    {\n      JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED);\n      parser_raise_error (context_p, PARSER_ERR_VARIABLE_REDECLARED);\n    }\n\n    if (flags & PARSER_PATTERN_ARGUMENTS)\n    {\n      if (context_p->lit_object.literal_p->status_flags & LEXER_FLAG_FUNCTION_ARGUMENT)\n      {\n        parser_raise_error (context_p, PARSER_ERR_VARIABLE_REDECLARED);\n      }\n      context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_FUNCTION_ARGUMENT;\n    }\n#if JERRY_MODULE_SYSTEM\n    parser_module_append_export_name (context_p);\n#endif /* JERRY_MODULE_SYSTEM */\n\n    parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);\n    lexer_next_token (context_p);\n\n    if (context_p->token.type != end_type && context_p->token.type != LEXER_ASSIGN\n        && context_p->token.type != LEXER_COMMA)\n    {\n      parser_raise_error (context_p, PARSER_ERR_ILLEGAL_PROPERTY_IN_DECLARATION);\n    }\n  }\n  else\n  {\n    parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA | PARSE_EXPR_LEFT_HAND_SIDE);\n\n    if (!PARSER_IS_PUSH_LITERAL (context_p->last_cbc_opcode) && !PARSER_IS_PUSH_PROP (context_p->last_cbc_opcode))\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_DESTRUCTURING_PATTERN);\n    }\n  }\n\n  parser_pattern_form_assignment (context_p, flags, rhs_opcode, literal_index, ident_line_counter);\n#if JERRY_LINE_INFO\n  parser_line_info_append (context_p, ident_line_counter, ident_column_counter);\n#endif /* JERRY_LINE_INFO */\n  return false;\n} /* parser_pattern_process_assignment */\n\n/**\n * Parse array initializer.\n */\nstatic void\nparser_parse_array_initializer (parser_context_t *context_p, /**< context */\n                                parser_pattern_flags_t flags) /**< flags */\n{\n  parser_pattern_end_marker_t end_pos = parser_pattern_get_target (context_p, flags);\n\n  lexer_next_token (context_p);\n  parser_emit_cbc_ext (context_p, CBC_EXT_ITERATOR_CONTEXT_CREATE);\n\n  while (context_p->token.type != LEXER_RIGHT_SQUARE)\n  {\n    uint16_t rhs_opcode = CBC_EXT_ITERATOR_STEP;\n\n    if (context_p->token.type == LEXER_COMMA)\n    {\n      parser_emit_cbc_ext (context_p, rhs_opcode);\n      parser_emit_cbc (context_p, CBC_POP);\n      lexer_next_token (context_p);\n      continue;\n    }\n\n    parser_pattern_flags_t options = flags;\n\n    if (context_p->token.type == LEXER_THREE_DOTS)\n    {\n      lexer_next_token (context_p);\n      rhs_opcode = CBC_EXT_REST_INITIALIZER;\n      options |= PARSER_PATTERN_REST_ELEMENT;\n    }\n\n    parser_pattern_process_assignment (context_p, options, rhs_opcode, PARSER_PATTERN_RHS_NO_LIT, LEXER_RIGHT_SQUARE);\n\n    if (context_p->token.type == LEXER_COMMA && rhs_opcode != CBC_EXT_REST_INITIALIZER)\n    {\n      lexer_next_token (context_p);\n    }\n    else if (context_p->token.type != LEXER_RIGHT_SQUARE)\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_DESTRUCTURING_PATTERN);\n    }\n  }\n\n  /* close the iterator */\n  parser_emit_cbc_ext (context_p, CBC_EXT_ITERATOR_CONTEXT_END);\n\n  parser_pattern_finalize (context_p, flags, &end_pos);\n} /* parser_parse_array_initializer */\n\n/**\n * Parse object initializer.\n */\nstatic void\nparser_parse_object_initializer (parser_context_t *context_p, /**< context */\n                                 parser_pattern_flags_t flags) /**< flags */\n{\n  parser_pattern_end_marker_t end_pos = parser_pattern_get_target (context_p, flags);\n\n  /* 12.14.5.2:  ObjectAssignmentPattern : { } */\n  if (lexer_check_next_character (context_p, LIT_CHAR_RIGHT_BRACE))\n  {\n    parser_emit_cbc_ext (context_p, CBC_EXT_REQUIRE_OBJECT_COERCIBLE);\n    lexer_consume_next_character (context_p);\n    parser_pattern_finalize (context_p, flags, &end_pos);\n    return;\n  }\n\n#ifndef JERRY_NDEBUG\n  bool rest_found = false;\n#endif /* !defined(JERRY_NDEBUG) */\n\n  cbc_ext_opcode_t context_opcode = CBC_EXT_OBJ_INIT_CONTEXT_CREATE;\n\n  if (flags & PARSER_PATTERN_HAS_REST_ELEMENT)\n  {\n    context_opcode = CBC_EXT_OBJ_INIT_REST_CONTEXT_CREATE;\n  }\n\n  parser_emit_cbc_ext (context_p, context_opcode);\n\n  while (true)\n  {\n    lexer_expect_object_literal_id (context_p, LEXER_OBJ_IDENT_OBJECT_PATTERN);\n\n    uint16_t prop_index = context_p->lit_object.index;\n    parser_line_counter_t start_line = context_p->token.line;\n    parser_line_counter_t start_column = context_p->token.column;\n    uint16_t push_prop_opcode = CBC_EXT_INITIALIZER_PUSH_PROP_LITERAL;\n\n    if (context_p->token.type == LEXER_RIGHT_BRACE)\n    {\n      break;\n    }\n\n    if (context_p->token.type == LEXER_THREE_DOTS)\n    {\n      lexer_next_token (context_p);\n\n      flags |= PARSER_PATTERN_REST_ELEMENT;\n\n      if (parser_pattern_process_assignment (context_p,\n                                             flags,\n                                             CBC_EXT_OBJ_INIT_PUSH_REST,\n                                             PARSER_PATTERN_RHS_NO_LIT,\n                                             LEXER_RIGHT_BRACE))\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_LHS_ASSIGNMENT);\n      }\n\n      if (context_p->token.type != LEXER_RIGHT_BRACE)\n      {\n        parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_EXPECTED);\n      }\n\n#ifndef JERRY_NDEBUG\n      rest_found = true;\n#endif /* !defined(JERRY_NDEBUG) */\n      break;\n    }\n\n    if (context_p->token.type == LEXER_RIGHT_SQUARE)\n    {\n      prop_index = PARSER_PATTERN_RHS_NO_LIT;\n      push_prop_opcode =\n        ((flags & PARSER_PATTERN_HAS_REST_ELEMENT) ? CBC_EXT_INITIALIZER_PUSH_NAME : CBC_EXT_INITIALIZER_PUSH_PROP);\n    }\n    else if (flags & PARSER_PATTERN_HAS_REST_ELEMENT)\n    {\n      push_prop_opcode = CBC_EXT_INITIALIZER_PUSH_NAME_LITERAL;\n    }\n\n    if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n    {\n      JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED);\n      parser_raise_error (context_p, PARSER_ERR_VARIABLE_REDECLARED);\n    }\n\n    lexer_next_token (context_p);\n\n    if (context_p->token.type == LEXER_COLON)\n    {\n      lexer_next_token (context_p);\n      parser_pattern_process_assignment (context_p, flags, push_prop_opcode, prop_index, LEXER_RIGHT_BRACE);\n    }\n    else\n    {\n      if (push_prop_opcode == CBC_EXT_INITIALIZER_PUSH_NAME || push_prop_opcode == CBC_EXT_INITIALIZER_PUSH_PROP)\n      {\n        parser_raise_error (context_p, PARSER_ERR_COLON_EXPECTED);\n      }\n\n      if (context_p->token.type != LEXER_RIGHT_BRACE && context_p->token.type != LEXER_ASSIGN\n          && context_p->token.type != LEXER_COMMA)\n      {\n        parser_raise_error (context_p, PARSER_ERR_OBJECT_ITEM_SEPARATOR_EXPECTED);\n      }\n\n      parser_reparse_as_common_identifier (context_p, start_line, start_column);\n\n      if (flags & PARSER_PATTERN_ARGUMENTS)\n      {\n        if (context_p->lit_object.literal_p->status_flags & LEXER_FLAG_FUNCTION_ARGUMENT)\n        {\n          parser_raise_error (context_p, PARSER_ERR_VARIABLE_REDECLARED);\n        }\n        context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_FUNCTION_ARGUMENT;\n      }\n\n#if JERRY_MODULE_SYSTEM\n      parser_module_append_export_name (context_p);\n#endif /* JERRY_MODULE_SYSTEM */\n\n      parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);\n\n      lexer_next_token (context_p);\n      JERRY_ASSERT (context_p->token.type == LEXER_RIGHT_BRACE || context_p->token.type == LEXER_ASSIGN\n                    || context_p->token.type == LEXER_COMMA);\n\n      parser_pattern_form_assignment (context_p, flags, push_prop_opcode, prop_index, start_line);\n#if JERRY_LINE_INFO\n      parser_line_info_append (context_p, start_line, start_column);\n#endif /* JERRY_LINE_INFO */\n    }\n\n    if (context_p->token.type == LEXER_RIGHT_BRACE)\n    {\n      break;\n    }\n    else if (context_p->token.type != LEXER_COMMA)\n    {\n      parser_raise_error (context_p, PARSER_ERR_OBJECT_ITEM_SEPARATOR_EXPECTED);\n    }\n  }\n\n  if (flags & PARSER_PATTERN_HAS_REST_ELEMENT)\n  {\n    PARSER_MINUS_EQUAL_U16 (context_p->stack_depth,\n                            (PARSER_OBJ_INIT_REST_CONTEXT_STACK_ALLOCATION - PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION));\n  }\n\n  parser_emit_cbc_ext (context_p, CBC_EXT_OBJ_INIT_CONTEXT_END);\n\n  parser_pattern_finalize (context_p, flags, &end_pos);\n\n#ifndef JERRY_NDEBUG\n  /* Checked at the end because there might be syntax errors before. */\n  JERRY_ASSERT (!!(flags & PARSER_PATTERN_HAS_REST_ELEMENT) == rest_found);\n#endif /* !defined(JERRY_NDEBUG) */\n} /* parser_parse_object_initializer */\n\n/**\n * Parse an initializer.\n */\nvoid\nparser_parse_initializer (parser_context_t *context_p, /**< context */\n                          parser_pattern_flags_t flags) /**< flags */\n{\n  if (context_p->token.type == LEXER_LEFT_BRACE)\n  {\n    parser_parse_object_initializer (context_p, flags);\n  }\n  else\n  {\n    JERRY_ASSERT (context_p->token.type == LEXER_LEFT_SQUARE);\n    parser_parse_array_initializer (context_p, flags);\n  }\n} /* parser_parse_initializer */\n\n/**\n * Parse an initializer using the next character.\n */\nvoid\nparser_parse_initializer_by_next_char (parser_context_t *context_p, /**< context */\n                                       parser_pattern_flags_t flags) /**< flags */\n{\n  JERRY_ASSERT (lexer_check_next_characters (context_p, LIT_CHAR_LEFT_SQUARE, LIT_CHAR_LEFT_BRACE));\n\n  if (lexer_consume_next_character (context_p) == LIT_CHAR_LEFT_BRACE)\n  {\n    if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n    {\n      JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_INITIALIZER\n                    || context_p->next_scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS);\n\n      if (context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_OBJECT_HAS_REST)\n      {\n        flags |= PARSER_PATTERN_HAS_REST_ELEMENT;\n      }\n\n      if (context_p->next_scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS)\n      {\n        scanner_release_next (context_p, sizeof (scanner_info_t));\n      }\n    }\n\n    parser_parse_object_initializer (context_p, flags);\n  }\n  else\n  {\n    parser_parse_array_initializer (context_p, flags);\n  }\n} /* parser_parse_initializer_by_next_char */\n\n/**\n * Process ternary expression.\n */\nstatic void\nparser_process_ternary_expression (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_QUESTION_MARK);\n\n  cbc_opcode_t opcode = CBC_BRANCH_IF_FALSE_FORWARD;\n  parser_branch_t cond_branch;\n  parser_branch_t uncond_branch;\n\n  parser_push_result (context_p);\n\n  if (context_p->last_cbc_opcode == CBC_LOGICAL_NOT)\n  {\n    context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n    opcode = CBC_BRANCH_IF_TRUE_FORWARD;\n  }\n\n  parser_emit_cbc_forward_branch (context_p, (uint16_t) opcode, &cond_branch);\n\n  lexer_next_token (context_p);\n  parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n  parser_emit_cbc_forward_branch (context_p, CBC_JUMP_FORWARD, &uncond_branch);\n  parser_set_branch_to_current_position (context_p, &cond_branch);\n\n  /* Although byte code is constructed for two branches,\n   * only one of them will be executed. To reflect this\n   * the stack is manually adjusted. */\n  JERRY_ASSERT (context_p->stack_depth > 0);\n  context_p->stack_depth--;\n\n  if (context_p->token.type != LEXER_COLON)\n  {\n    parser_raise_error (context_p, PARSER_ERR_COLON_FOR_CONDITIONAL_EXPECTED);\n  }\n\n  lexer_next_token (context_p);\n\n  parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n  parser_set_branch_to_current_position (context_p, &uncond_branch);\n\n  /* Last opcode rewrite is not allowed because\n   * the result may come from the first branch. */\n  parser_flush_cbc (context_p);\n\n  parser_process_binary_opcodes (context_p, 0);\n} /* parser_process_ternary_expression */\n\n/**\n * Process expression sequence.\n */\nstatic void\nparser_process_expression_sequence (parser_context_t *context_p) /**< context */\n{\n  if (!CBC_NO_RESULT_OPERATION (context_p->last_cbc_opcode))\n  {\n    parser_emit_cbc (context_p, CBC_POP);\n  }\n\n  if (context_p->stack_top_uint8 == LEXER_LEFT_PAREN)\n  {\n    parser_mem_page_t *page_p = context_p->stack.first_p;\n\n    JERRY_ASSERT (page_p != NULL);\n\n    page_p->bytes[context_p->stack.last_position - 1] = LEXER_COMMA_SEP_LIST;\n    context_p->stack_top_uint8 = LEXER_COMMA_SEP_LIST;\n  }\n\n  lexer_next_token (context_p);\n} /* parser_process_expression_sequence */\n\n/**\n * Process group expression.\n */\nstatic bool\nparser_process_group_expression (parser_context_t *context_p, /**< context */\n                                 size_t *grouping_level_p) /**< grouping level */\n{\n  if (context_p->token.type != LEXER_RIGHT_PAREN\n      || (context_p->stack_top_uint8 != LEXER_LEFT_PAREN && context_p->stack_top_uint8 != LEXER_COMMA_SEP_LIST))\n  {\n    return false;\n  }\n\n  JERRY_ASSERT (*grouping_level_p >= PARSER_GROUPING_LEVEL_INCREASE);\n  (*grouping_level_p) -= PARSER_GROUPING_LEVEL_INCREASE;\n\n  uint8_t token = context_p->stack_top_uint8;\n\n  if (token == LEXER_COMMA_SEP_LIST)\n  {\n    parser_push_result (context_p);\n    parser_flush_cbc (context_p);\n  }\n\n  parser_stack_pop_uint8 (context_p);\n  lexer_next_token (context_p);\n\n  /* Lookahead for anonymous function declaration after '=' token when the assignment base is LHS expression\n     with a single indentifier in it. e.g.: (a) = function () {} */\n  if (JERRY_UNLIKELY (context_p->token.type == LEXER_ASSIGN\n                      && PARSER_IS_PUSH_LITERALS_WITH_THIS (context_p->last_cbc_opcode)\n                      && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL\n                      && parser_is_assignment_expr (context_p) && *grouping_level_p != PARSE_EXPR_LEFT_HAND_SIDE))\n  {\n    parser_stack_push_uint8 (context_p, LEXER_ASSIGN_GROUP_EXPR);\n  }\n  return true;\n} /* parser_process_group_expression */\n\n/**\n * Parse block expression.\n */\nvoid\nparser_parse_block_expression (parser_context_t *context_p, /**< context */\n                               int options) /**< option flags */\n{\n  parser_parse_expression (context_p, options | PARSE_EXPR_NO_PUSH_RESULT);\n\n  if (CBC_NO_RESULT_OPERATION (context_p->last_cbc_opcode))\n  {\n    JERRY_ASSERT (CBC_SAME_ARGS (context_p->last_cbc_opcode, context_p->last_cbc_opcode + 2));\n    PARSER_PLUS_EQUAL_U16 (context_p->last_cbc_opcode, 2);\n    parser_flush_cbc (context_p);\n  }\n  else\n  {\n    parser_emit_cbc (context_p, CBC_POP_BLOCK);\n  }\n} /* parser_parse_block_expression */\n\n/**\n * Parse expression statement.\n */\nvoid\nparser_parse_expression_statement (parser_context_t *context_p, /**< context */\n                                   int options) /**< option flags */\n{\n  parser_parse_expression (context_p, options | PARSE_EXPR_NO_PUSH_RESULT);\n\n  if (!CBC_NO_RESULT_OPERATION (context_p->last_cbc_opcode))\n  {\n    parser_emit_cbc (context_p, CBC_POP);\n  }\n} /* parser_parse_expression_statement */\n\nJERRY_STATIC_ASSERT (PARSE_EXPR_LEFT_HAND_SIDE == 0x1, value_of_parse_expr_left_hand_side_must_be_1);\n\n/**\n * Parse expression.\n */\nvoid\nparser_parse_expression (parser_context_t *context_p, /**< context */\n                         int options) /**< option flags */\n{\n  size_t grouping_level = (options & PARSE_EXPR_LEFT_HAND_SIDE);\n\n  parser_stack_push_uint8 (context_p, LEXER_EXPRESSION_START);\n\n  if (options & PARSE_EXPR_HAS_LITERAL)\n  {\n    JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);\n    goto process_unary_expression;\n  }\n\n  while (true)\n  {\n    if (parser_parse_unary_expression (context_p, &grouping_level))\n    {\n      parser_process_binary_opcodes (context_p, 0);\n      break;\n    }\n\n    while (true)\n    {\nprocess_unary_expression:\n      parser_parse_postfix_expresion (context_p, &grouping_level);\n      parser_process_prefix_unary_opcodes (context_p);\n\n      if (JERRY_LIKELY (grouping_level != PARSE_EXPR_LEFT_HAND_SIDE))\n      {\n        uint8_t min_prec_treshold = 0;\n\n        if (LEXER_IS_BINARY_OP_TOKEN (context_p->token.type))\n        {\n          if (JERRY_UNLIKELY (context_p->token.type == LEXER_NULLISH_COALESCING))\n          {\n            parser_check_invalid_logical_op (context_p, LEXER_LOGICAL_OR, LEXER_LOGICAL_AND);\n          }\n\n          min_prec_treshold = parser_binary_precedence_table[context_p->token.type - LEXER_FIRST_BINARY_OP];\n\n          /* Check for BINARY_LVALUE tokens + LEXER_LOGICAL_OR + LEXER_LOGICAL_AND + LEXER_EXPONENTIATION */\n          if ((min_prec_treshold == PARSER_RIGHT_TO_LEFT_ORDER_EXPONENTIATION)\n              || (min_prec_treshold <= PARSER_RIGHT_TO_LEFT_ORDER_MAX_PRECEDENCE\n                  && min_prec_treshold != PARSER_RIGHT_TO_LEFT_ORDER_TERNARY_PRECEDENCE))\n          {\n            /* Right-to-left evaluation order. */\n            min_prec_treshold++;\n          }\n        }\n\n        parser_process_binary_opcodes (context_p, min_prec_treshold);\n      }\n      if (context_p->token.type == LEXER_RIGHT_PAREN\n          && (context_p->stack_top_uint8 == LEXER_LEFT_PAREN || context_p->stack_top_uint8 == LEXER_COMMA_SEP_LIST))\n      {\n        parser_process_group_expression (context_p, &grouping_level);\n        continue;\n      }\n\n      break;\n    }\n\n    if (grouping_level == PARSE_EXPR_LEFT_HAND_SIDE)\n    {\n      break;\n    }\n\n    if (JERRY_UNLIKELY (context_p->token.type == LEXER_QUESTION_MARK))\n    {\n      parser_process_ternary_expression (context_p);\n\n      if (context_p->token.type == LEXER_RIGHT_PAREN)\n      {\n        goto process_unary_expression;\n      }\n    }\n    else if (LEXER_IS_BINARY_OP_TOKEN (context_p->token.type))\n    {\n      parser_append_binary_token (context_p);\n      lexer_next_token (context_p);\n      continue;\n    }\n\n    if (JERRY_UNLIKELY (context_p->token.type == LEXER_COMMA)\n        && (!(options & PARSE_EXPR_NO_COMMA) || grouping_level >= PARSER_GROUPING_LEVEL_INCREASE))\n    {\n      parser_process_expression_sequence (context_p);\n      continue;\n    }\n\n    break;\n  }\n\n  if (grouping_level >= PARSER_GROUPING_LEVEL_INCREASE)\n  {\n    parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);\n  }\n\n  JERRY_ASSERT (context_p->stack_top_uint8 == LEXER_EXPRESSION_START);\n  parser_stack_pop_uint8 (context_p);\n\n  if (!(options & PARSE_EXPR_NO_PUSH_RESULT))\n  {\n    parser_push_result (context_p);\n  }\n} /* parser_parse_expression */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_PARSER */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser-internal.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JS_PARSER_INTERNAL_H\n#define JS_PARSER_INTERNAL_H\n\n#include \"ecma-module.h\"\n\n#include \"byte-code.h\"\n#include \"common.h\"\n#include \"debugger.h\"\n#include \"js-lexer.h\"\n#include \"js-parser-limits.h\"\n#include \"js-parser.h\"\n#include \"js-scanner.h\"\n#include \"parser-errors.h\"\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_internals Internals\n * @{\n */\n\n/**\n * General parser flags.\n */\ntypedef enum\n{\n  PARSER_IS_STRICT = (1u << 0), /**< strict mode code */\n  PARSER_IS_FUNCTION = (1u << 1), /**< function body is parsed */\n  PARSER_IS_CLOSURE = (1u << 2), /**< function body is encapsulated in {} block */\n  PARSER_IS_FUNC_EXPRESSION = (1u << 3), /**< a function expression is parsed */\n  PARSER_IS_PROPERTY_GETTER = (1u << 4), /**< a property getter function is parsed */\n  PARSER_IS_PROPERTY_SETTER = (1u << 5), /**< a property setter function is parsed */\n  PARSER_HAS_NON_STRICT_ARG = (1u << 6), /**< the function has arguments which\n                                          *   are not supported in strict mode */\n  PARSER_ARGUMENTS_NEEDED = (1u << 7), /**< arguments object must be created */\n  PARSER_LEXICAL_ENV_NEEDED = (1u << 8), /**< lexical environment object must be created */\n  PARSER_INSIDE_WITH = (1u << 9), /**< code block is inside a with statement */\n  PARSER_NO_END_LABEL = (1u << 10), /**< return instruction must be inserted\n                                     *   after the last byte code */\n  PARSER_DEBUGGER_BREAKPOINT_APPENDED = (1u << 11), /**< pending (unsent) breakpoint\n                                                     *   info is available */\n  PARSER_LEXICAL_BLOCK_NEEDED = (1u << 12), /**< global script: needs a lexical environment for let and const\n                                             *   function: needs a lexical environment for arguments */\n  PARSER_IS_ARROW_FUNCTION = (1u << 13), /**< an arrow function is parsed */\n  PARSER_IS_GENERATOR_FUNCTION = (1u << 14), /**< a generator function is parsed */\n  PARSER_IS_ASYNC_FUNCTION = (1u << 15), /**< an async function is parsed */\n  PARSER_DISALLOW_AWAIT_YIELD = (1u << 16), /**< throw SyntaxError for await / yield keywords */\n  PARSER_FUNCTION_HAS_COMPLEX_ARGUMENT = (1u << 17), /**< function has complex (ES2015+) argument definition */\n  PARSER_FUNCTION_HAS_REST_PARAM = (1u << 18), /**< function has rest parameter */\n  PARSER_CLASS_CONSTRUCTOR = (1u << 19), /**< a class constructor is parsed\n                                          *   Note: PARSER_ALLOW_SUPER must be present */\n  /* These five status flags must be in this order. See PARSER_SAVED_FLAGS_OFFSET. */\n  PARSER_ALLOW_SUPER = (1u << 20), /**< allow super property access */\n  PARSER_ALLOW_SUPER_CALL = (1u << 21), /**< allow super constructor call\n                                         *   Note: PARSER_CLASS_CONSTRUCTOR must be present */\n  PARSER_FUNCTION_IS_PARSING_ARGS = (1u << 22), /**< set when parsing function arguments */\n  PARSER_INSIDE_CLASS_FIELD = (1u << 23), /**< a class field is being parsed */\n  PARSER_ALLOW_NEW_TARGET = (1u << 24), /**< allow new.target parsing in the current context */\n  PARSER_IS_METHOD = (1u << 25), /**< method is parsed */\n  PARSER_IS_CLASS_STATIC_BLOCK = (1u << 26), /**< a class static block is parsed */\n  PARSER_PRIVATE_FUNCTION_NAME = PARSER_IS_FUNC_EXPRESSION, /**< represents private method for\n                                                             *   parser_set_function_name*/\n#if JERRY_MODULE_SYSTEM\n  PARSER_MODULE_DEFAULT_CLASS_OR_FUNC = (1u << 27), /**< parsing a function or class default export */\n  PARSER_MODULE_STORE_IDENT = (1u << 28), /**< store identifier of the current export statement */\n#endif /* JERRY_MODULE_SYSTEM */\n  PARSER_HAS_LATE_LIT_INIT = (1u << 30), /**< there are identifier or string literals which construction\n                                          *   is postponed after the local parser data is freed */\n#ifndef JERRY_NDEBUG\n  PARSER_SCANNING_SUCCESSFUL = PARSER_HAS_LATE_LIT_INIT, /**< scanning process was successful */\n#endif /* !JERRY_NDEBUG */\n} parser_general_flags_t;\n\n/**\n * Expression parsing flags.\n */\ntypedef enum\n{\n  PARSE_EXPR = 0, /**< parse an expression without any special flags */\n  PARSE_EXPR_LEFT_HAND_SIDE = (1u << 0), /**< parse a left-hand-side expression */\n  PARSE_EXPR_NO_PUSH_RESULT = (1u << 1), /**< do not push the result of the expression onto the stack */\n  PARSE_EXPR_NO_COMMA = (1u << 2), /**< do not parse comma operator */\n  PARSE_EXPR_HAS_LITERAL = (1u << 3), /**< a primary literal is provided by a\n                                       *   CBC_PUSH_LITERAL instruction  */\n} parser_expression_flags_t;\n\n/**\n * Pattern parsing flags.\n */\ntypedef enum\n{\n  PARSER_PATTERN_NO_OPTS = 0, /**< parse the expression after '=' */\n  PARSER_PATTERN_BINDING = (1u << 0), /**< parse BindingPattern */\n  PARSER_PATTERN_TARGET_ON_STACK = (1u << 1), /**< assignment target is the topmost element on the stack */\n  PARSER_PATTERN_TARGET_DEFAULT = (1u << 2), /**< perform default value comparison for assignment target */\n  PARSER_PATTERN_NESTED_PATTERN = (1u << 3), /**< parse pattern inside a pattern */\n  PARSER_PATTERN_LET = (1u << 4), /**< pattern is a let declaration */\n  PARSER_PATTERN_CONST = (1u << 5), /**< pattern is a const declaration */\n  PARSER_PATTERN_LOCAL = (1u << 6), /**< pattern is a local (catch parameter) declaration */\n  PARSER_PATTERN_REST_ELEMENT = (1u << 7), /**< parse rest array / object element */\n  PARSER_PATTERN_HAS_REST_ELEMENT = (1u << 8), /**< object literal rest element will be present */\n  PARSER_PATTERN_ARGUMENTS = (1u << 9), /**< parse arguments binding */\n} parser_pattern_flags_t;\n\n/**\n * Check type for scanner_is_context_needed function.\n */\ntypedef enum\n{\n  PARSER_CHECK_BLOCK_CONTEXT, /**< check block context */\n  PARSER_CHECK_GLOBAL_CONTEXT, /**< check global context */\n  PARSER_CHECK_FUNCTION_CONTEXT, /**< check function context */\n} parser_check_context_type_t;\n\n/**\n * Class field bits.\n */\ntypedef enum\n{\n  PARSER_CLASS_FIELD_END = (1u << 0), /**< last class field */\n  PARSER_CLASS_FIELD_NORMAL = (1u << 1), /**< normal (non-computed) class field */\n  PARSER_CLASS_FIELD_INITIALIZED = (1u << 2), /**< class field is initialized */\n  PARSER_CLASS_FIELD_STATIC = (1u << 3), /**< static class field */\n  PARSER_CLASS_FIELD_STATIC_BLOCK = (1u << 4), /**< static class field */\n} parser_class_field_type_t;\n\n/**\n * Mask for strict mode code\n */\n#define PARSER_STRICT_MODE_MASK 0x1\n\n/**\n * Shorthand for function closure definition\n */\n#define PARSER_FUNCTION_CLOSURE (PARSER_IS_FUNCTION | PARSER_IS_CLOSURE)\n\n#if PARSER_MAXIMUM_CODE_SIZE <= UINT16_MAX\n/**\n * Maximum number of bytes for branch target.\n */\n#define PARSER_MAX_BRANCH_LENGTH 2\n#else /* PARSER_MAXIMUM_CODE_SIZE > UINT16_MAX */\n/**\n * Maximum number of bytes for branch target.\n */\n#define PARSER_MAX_BRANCH_LENGTH 3\n#endif /* PARSER_MAXIMUM_CODE_SIZE <= UINT16_MAX */\n\n/**\n * Offset of PARSER_ALLOW_SUPER\n */\n#define PARSER_SAVED_FLAGS_OFFSET JERRY_LOG2 (PARSER_ALLOW_SUPER)\n\n/**\n * Mask of saved flags\n */\n#define PARSER_SAVED_FLAGS_MASK \\\n  ((1 << (JERRY_LOG2 (PARSER_ALLOW_NEW_TARGET) - JERRY_LOG2 (PARSER_ALLOW_SUPER) + 1)) - 1)\n\n/**\n * Get class option bits from parser_general_flags_t\n */\n#define PARSER_SAVE_STATUS_FLAGS(opts) ((uint16_t) (((opts) >> PARSER_SAVED_FLAGS_OFFSET) & PARSER_SAVED_FLAGS_MASK))\n\n/**\n * Mask for get class option bits from ecma_parse_opts_t\n */\n#define PARSER_RESTORE_STATUS_FLAGS_MASK (((ECMA_PARSE_ALLOW_NEW_TARGET << 1) - 1) - (ECMA_PARSE_ALLOW_SUPER - 1))\n\n/**\n * Shift for get class option bits from ecma_parse_opts_t\n */\n#define PARSER_RESTORE_STATUS_FLAGS_SHIFT (JERRY_LOG2 (PARSER_ALLOW_SUPER) - JERRY_LOG2 (ECMA_PARSE_ALLOW_SUPER))\n\n/**\n * Get class option bits from ecma_parse_opts_t\n */\n#define PARSER_RESTORE_STATUS_FLAGS(opts) \\\n  (((opts) &PARSER_RESTORE_STATUS_FLAGS_MASK) << PARSER_RESTORE_STATUS_FLAGS_SHIFT)\n\n/**\n * All flags that affect exotic arguments object creation.\n */\n#define PARSER_ARGUMENTS_RELATED_FLAGS \\\n  (PARSER_ARGUMENTS_NEEDED | PARSER_FUNCTION_HAS_COMPLEX_ARGUMENT | PARSER_IS_STRICT)\n\n/**\n * Get the corresponding eval flag for a ecma_parse_opts_t flag\n */\n#define PARSER_GET_EVAL_FLAG(type) ((type) >> JERRY_LOG2 (ECMA_PARSE_ALLOW_SUPER))\n\n/**\n * Check non-generator async functions\n */\n#define PARSER_IS_NORMAL_ASYNC_FUNCTION(status_flags) \\\n  (((status_flags) & (PARSER_IS_GENERATOR_FUNCTION | PARSER_IS_ASYNC_FUNCTION)) == PARSER_IS_ASYNC_FUNCTION)\n\n/* Checks whether unmapped arguments are needed. */\n#define PARSER_NEEDS_MAPPED_ARGUMENTS(status_flags) \\\n  (((status_flags) &PARSER_ARGUMENTS_RELATED_FLAGS) == PARSER_ARGUMENTS_NEEDED)\n\n/* The maximum of PARSER_CBC_STREAM_PAGE_SIZE is 127. */\n#define PARSER_CBC_STREAM_PAGE_SIZE ((uint32_t) (64 - sizeof (void *)))\n\n/* Defines the size of the max page. */\n#define PARSER_STACK_PAGE_SIZE ((uint32_t) (((sizeof (void *) > 4) ? 128 : 64) - sizeof (void *)))\n\n/* Avoid compiler warnings for += operations. */\n#define PARSER_PLUS_EQUAL_U16(base, value)  (base) = (uint16_t) ((base) + (value))\n#define PARSER_MINUS_EQUAL_U16(base, value) (base) = (uint16_t) ((base) - (value))\n#define PARSER_PLUS_EQUAL_LC(base, value)   (base) = (parser_line_counter_t) ((base) + (value))\n\n/**\n * Argument for a compact-byte code.\n */\ntypedef struct\n{\n  uint16_t literal_index; /**< literal index argument */\n  uint16_t value; /**< other argument (second literal or byte). */\n  uint16_t third_literal_index; /**< literal index argument */\n  uint8_t literal_type; /**< last literal type */\n  uint8_t literal_keyword_type; /**< last literal keyword type */\n} cbc_argument_t;\n\n/* Useful parser macros. */\n\n#define PARSER_CBC_UNAVAILABLE CBC_EXT_OPCODE\n\n#define PARSER_TO_EXT_OPCODE(opcode)   ((uint16_t) ((opcode) + 256))\n#define PARSER_GET_EXT_OPCODE(opcode)  ((opcode) -256)\n#define PARSER_IS_BASIC_OPCODE(opcode) ((opcode) < 256)\n#define PARSER_IS_PUSH_LITERAL(opcode) \\\n  ((opcode) == CBC_PUSH_LITERAL || (opcode) == CBC_PUSH_TWO_LITERALS || (opcode) == CBC_PUSH_THREE_LITERALS)\n#define PARSER_IS_PUSH_NUMBER(opcode) \\\n  ((opcode) >= CBC_PUSH_NUMBER_0 && (opcode) <= CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)\n\n#define PARSER_IS_MUTABLE_PUSH_LITERAL(opcode) ((opcode) >= CBC_PUSH_LITERAL && (opcode) <= CBC_PUSH_THIS_LITERAL)\n\n#define PARSER_IS_PUSH_LITERALS_WITH_THIS(opcode) ((opcode) >= CBC_PUSH_LITERAL && (opcode) <= CBC_PUSH_THREE_LITERALS)\n\n#define PARSER_IS_PUSH_PROP(opcode) ((opcode) >= CBC_PUSH_PROP && (opcode) <= CBC_PUSH_PROP_THIS_LITERAL)\n\n#define PARSER_IS_PUSH_PROP_LITERAL(opcode) \\\n  ((opcode) >= CBC_PUSH_PROP_LITERAL && (opcode) <= CBC_PUSH_PROP_THIS_LITERAL)\n\n#define PARSER_PUSH_LITERAL_TO_PUSH_PROP_LITERAL(opcode) \\\n  (uint16_t) ((opcode) + (CBC_PUSH_PROP_LITERAL - CBC_PUSH_LITERAL))\n\n#define PARSER_PUSH_PROP_LITERAL_TO_PUSH_LITERAL(opcode) \\\n  (uint16_t) ((opcode) - (CBC_PUSH_PROP_LITERAL - CBC_PUSH_LITERAL))\n\n#define PARSER_PUSH_PROP_TO_PUSH_PROP_REFERENCE(opcode) \\\n  (uint16_t) ((opcode) + (CBC_PUSH_PROP_REFERENCE - CBC_PUSH_PROP))\n\n#define PARSER_PUSH_PROP_REFERENCE_TO_PUSH_PROP(opcode) \\\n  (uint16_t) ((opcode) - (CBC_PUSH_PROP_REFERENCE - CBC_PUSH_PROP))\n\n#define PARSER_GET_LITERAL(literal_index) \\\n  ((lexer_literal_t *) parser_list_get (&context_p->literal_pool, (literal_index)))\n\n#define PARSER_TO_BINARY_OPERATION_WITH_RESULT(opcode) \\\n  (PARSER_TO_EXT_OPCODE (opcode) - CBC_ASSIGN_ADD + CBC_EXT_ASSIGN_ADD_PUSH_RESULT)\n\n#define PARSER_TO_BINARY_OPERATION_WITH_BLOCK(opcode) \\\n  ((uint16_t) (PARSER_TO_EXT_OPCODE (opcode) - CBC_ASSIGN_ADD + CBC_EXT_ASSIGN_ADD_BLOCK))\n\n#define PARSER_GET_FLAGS(op) (PARSER_IS_BASIC_OPCODE (op) ? cbc_flags[(op)] : cbc_ext_flags[PARSER_GET_EXT_OPCODE (op)])\n\n#define PARSER_OPCODE_IS_RETURN(op) \\\n  ((op) == CBC_RETURN || (op) == CBC_RETURN_FUNCTION_END || (op) == CBC_RETURN_WITH_LITERAL)\n\n#define PARSER_ARGS_EQ(op, types) ((PARSER_GET_FLAGS (op) & CBC_ARG_TYPES) == (types))\n\n/**\n * All data allocated by the parser is\n * stored in parser_data_pages in the memory.\n */\ntypedef struct parser_mem_page_t\n{\n  struct parser_mem_page_t *next_p; /**< next page */\n  uint8_t bytes[]; /**< memory bytes, C99 flexible array member */\n} parser_mem_page_t;\n\n/**\n * Structure for managing parser memory.\n */\ntypedef struct\n{\n  parser_mem_page_t *first_p; /**< first allocated page */\n  parser_mem_page_t *last_p; /**< last allocated page */\n  uint32_t last_position; /**< position of the last allocated byte */\n} parser_mem_data_t;\n\n/**\n * Parser memory list.\n */\ntypedef struct\n{\n  parser_mem_data_t data; /**< storage space */\n  uint32_t page_size; /**< size of each page */\n  uint32_t item_size; /**< size of each item */\n  uint32_t item_count; /**< number of items on each page */\n} parser_list_t;\n\n/**\n * Iterator for parser memory list.\n */\ntypedef struct\n{\n  parser_list_t *list_p; /**< parser list */\n  parser_mem_page_t *current_p; /**< currently processed page */\n  size_t current_position; /**< current position on the page */\n} parser_list_iterator_t;\n\n/**\n * Parser memory stack.\n */\ntypedef struct\n{\n  parser_mem_data_t data; /**< storage space */\n  parser_mem_page_t *free_page_p; /**< space for fast allocation */\n} parser_stack_t;\n\n/**\n * Iterator for parser memory stack.\n */\ntypedef struct\n{\n  parser_mem_page_t *current_p; /**< currently processed page */\n  size_t current_position; /**< current position on the page */\n} parser_stack_iterator_t;\n\n/**\n * Branch type.\n */\ntypedef struct\n{\n  parser_mem_page_t *page_p; /**< branch location page */\n  uint32_t offset; /**< branch location offset */\n} parser_branch_t;\n\n/**\n * Branch chain type.\n */\ntypedef struct parser_branch_node_t\n{\n  struct parser_branch_node_t *next_p; /**< next linked list node */\n  parser_branch_t branch; /**< branch */\n} parser_branch_node_t;\n\n/**\n * Items of scope stack.\n */\ntypedef struct\n{\n  uint16_t map_from; /**< original literal index */\n  uint16_t map_to; /**< encoded register or literal index and flags */\n} parser_scope_stack_t;\n\n/**\n * This item represents a function literal in the scope stack.\n *\n * When map_from == PARSER_SCOPE_STACK_FUNC:\n *   map_to represents the literal reserved for a function literal\n *   Note: the name of the function is the previous value in the scope stack\n *   Note: map_to is not encoded in this case\n */\n#define PARSER_SCOPE_STACK_FUNC 0xffff\n\n/**\n * Mask for decoding the register index of map_to\n */\n#define PARSER_SCOPE_STACK_REGISTER_MASK 0x3fff\n\n/**\n * Function statements with the name specified\n * in map_from should not be copied to global scope.\n */\n#define PARSER_SCOPE_STACK_NO_FUNCTION_COPY 0x8000\n\n/**\n * The scope stack item represents a const binding stored in register\n */\n#define PARSER_SCOPE_STACK_IS_CONST_REG 0x4000\n\n/**\n * The scope stack item represents a binding which has already created with ECMA_VALUE_UNINITIALIZED\n */\n#define PARSER_SCOPE_STACK_IS_LOCAL_CREATED (PARSER_SCOPE_STACK_IS_CONST_REG)\n\n/**\n * Starting literal index for registers.\n */\n#define PARSER_REGISTER_START 0x8000\n\n/**\n * Invalid literal index\n */\n#define PARSER_INVALID_LITERAL_INDEX UINT16_MAX\n\n/**\n * Lastly emitted opcode is not a function literal\n */\n#define PARSER_NOT_FUNCTION_LITERAL PARSER_INVALID_LITERAL_INDEX\n\n/**\n * Lastly emitted opcode is not a named function literal\n */\n#define PARSER_NAMED_FUNCTION (uint16_t) (PARSER_NOT_FUNCTION_LITERAL - 1)\n\n/**\n * Lastly emitted opcode is not an anonymous class literal\n */\n#define PARSER_ANONYMOUS_CLASS (uint16_t) (PARSER_NAMED_FUNCTION - 1)\n\n/* Forward definitions for js-scanner-internal.h. */\nstruct scanner_context_t;\ntypedef struct scanner_context_t scanner_context_t;\n\n#if JERRY_DEBUGGER\n/**\n * Extra information for each breakpoint.\n */\ntypedef struct\n{\n  uint32_t value; /**< line or offset of the breakpoint */\n} parser_breakpoint_info_t;\n\n/**\n * Maximum number of breakpoint info.\n */\n#define PARSER_MAX_BREAKPOINT_INFO_COUNT (JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE / sizeof (parser_breakpoint_info_t))\n\n#endif /* JERRY_DEBUGGER */\n\n#if JERRY_LINE_INFO\n\ntypedef struct\n{\n  parser_mem_page_t *last_page_p; /**< last page of line info data */\n  uint32_t byte_code_position; /**< last byte code position */\n  parser_line_counter_t line; /**< last line */\n  parser_line_counter_t column; /**< last column */\n} parser_line_info_data_t;\n\n#endif /* JERRY_LINE_INFO */\n\n/**\n * List of private field contexts\n */\ntypedef struct parser_private_context_t\n{\n  scanner_class_private_member_t *members_p; /**< current private field context members */\n  struct parser_private_context_t *prev_p; /**< previous private field context */\n  uint8_t opts; /**< options */\n} parser_private_context_t;\n\n/**\n * Those members of a context which needs\n * to be saved when a sub-function is parsed.\n */\ntypedef struct parser_saved_context_t\n{\n  /* Parser members. */\n  uint32_t status_flags; /**< parsing options */\n  uint16_t stack_depth; /**< current stack depth */\n  uint16_t stack_limit; /**< maximum stack depth */\n  struct parser_saved_context_t *prev_context_p; /**< last saved context */\n  parser_stack_iterator_t last_statement; /**< last statement position */\n\n  /* Literal types */\n  uint16_t argument_count; /**< number of function arguments */\n  uint16_t argument_length; /**< length property of arguments */\n  uint16_t register_count; /**< number of registers */\n  uint16_t literal_count; /**< number of literals */\n\n  /* Memory storage members. */\n  parser_mem_data_t byte_code; /**< byte code buffer */\n  uint32_t byte_code_size; /**< byte code size for branches */\n  parser_mem_data_t literal_pool_data; /**< literal list */\n  parser_scope_stack_t *scope_stack_p; /**< scope stack */\n  uint16_t scope_stack_size; /**< size of scope stack */\n  uint16_t scope_stack_top; /**< preserved top of scope stack */\n  uint16_t scope_stack_reg_top; /**< preserved top register of scope stack */\n  uint16_t scope_stack_global_end; /**< end of global declarations of a function */\n  ecma_value_t tagged_template_literal_cp; /**< compessed pointer to the tagged template literal collection */\n#ifndef JERRY_NDEBUG\n  uint16_t context_stack_depth; /**< current context stack depth */\n#endif /* !JERRY_NDEBUG */\n\n#if JERRY_LINE_INFO\n  parser_line_info_data_t *line_info_p; /**< line info data */\n#endif /* JERRY_LINE_INFO */\n\n#if JERRY_FUNCTION_TO_STRING\n  const uint8_t *function_start_p; /**< start position of the current function */\n#endif /* JERRY_FUNCTION_TO_STRING */\n} parser_saved_context_t;\n\n/**\n * Shared parser context.\n */\ntypedef struct\n{\n  PARSER_TRY_CONTEXT (try_buffer); /**< try_buffer */\n  parser_error_msg_t error; /**< error code */\n  /** Union for rarely used members. */\n  union\n  {\n    void *allocated_buffer_p; /**< dinamically allocated buffer\n                               *   which needs to be freed on error */\n    scanner_context_t *scanner_context_p; /**< scanner context for the pre-scanner */\n  } u;\n  uint32_t allocated_buffer_size; /**< size of the dinamically allocated buffer */\n\n  /* Parser members. */\n  uint32_t status_flags; /**< status flags */\n  uint32_t global_status_flags; /**< global status flags */\n  uint16_t stack_depth; /**< current stack depth */\n  uint16_t stack_limit; /**< maximum stack depth */\n  const jerry_parse_options_t *options_p; /**< parse options */\n  parser_saved_context_t *last_context_p; /**< last saved context */\n  parser_stack_iterator_t last_statement; /**< last statement position */\n  cbc_script_t *script_p; /**< current script */\n  const uint8_t *source_start_p; /**< source start */\n  lit_utf8_size_t source_size; /**< source size */\n  const uint8_t *arguments_start_p; /**< function argument list start */\n  lit_utf8_size_t arguments_size; /**< function argument list size */\n  ecma_value_t script_value; /**< current script as value */\n  ecma_value_t argument_list; /**< current argument list as value */\n  ecma_value_t user_value; /**< current user value */\n\n#if JERRY_MODULE_SYSTEM\n  ecma_module_names_t *module_names_p; /**< import / export names that is being processed */\n  lexer_literal_t *module_identifier_lit_p; /**< the literal for the identifier of the current element */\n#endif /* JERRY_MODULE_SYSTEM */\n\n  /* Lexer members. */\n  lexer_token_t token; /**< current token */\n  lexer_lit_object_t lit_object; /**< current literal object */\n  const uint8_t *source_p; /**< next source byte */\n  const uint8_t *source_end_p; /**< last source byte */\n  parser_line_counter_t line; /**< current line */\n  parser_line_counter_t column; /**< current column */\n\n  /* Scanner members. */\n  scanner_info_t *next_scanner_info_p; /**< next scanner info block */\n  scanner_info_t *active_scanner_info_p; /**< currently active scanner info block */\n  scanner_info_t *skipped_scanner_info_p; /**< next scanner info block */\n  scanner_info_t *skipped_scanner_info_end_p; /**< currently active scanner info block */\n\n  /* Compact byte code members. */\n  cbc_argument_t last_cbc; /**< argument of the last cbc */\n  uint16_t last_cbc_opcode; /**< opcode of the last cbc */\n\n  /* Literal types */\n  uint16_t argument_count; /**< number of function arguments */\n  uint16_t argument_length; /**< length property of arguments */\n  uint16_t register_count; /**< number of registers */\n  uint16_t literal_count; /**< number of literals */\n\n  /* Memory storage members. */\n  parser_mem_data_t byte_code; /**< byte code buffer */\n  uint32_t byte_code_size; /**< current byte code size for branches */\n  parser_list_t literal_pool; /**< literal list */\n  parser_mem_data_t stack; /**< storage space */\n  parser_scope_stack_t *scope_stack_p; /**< scope stack */\n  parser_mem_page_t *free_page_p; /**< space for fast allocation */\n  uint16_t scope_stack_size; /**< size of scope stack */\n  uint16_t scope_stack_top; /**< current top of scope stack */\n  uint16_t scope_stack_reg_top; /**< current top register of scope stack */\n  uint16_t scope_stack_global_end; /**< end of global declarations of a function */\n  ecma_value_t tagged_template_literal_cp; /**< compessed pointer to the tagged template literal collection */\n  parser_private_context_t *private_context_p; /**< private context */\n  uint8_t stack_top_uint8; /**< top byte stored on the stack */\n\n#ifndef JERRY_NDEBUG\n  /* Variables for debugging / logging. */\n  uint16_t context_stack_depth; /**< current context stack depth */\n#endif /* !JERRY_NDEBUG */\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  int is_show_opcodes; /**< show opcodes */\n  uint32_t total_byte_code_size; /**< total byte code size */\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n#if JERRY_DEBUGGER\n  parser_breakpoint_info_t breakpoint_info[PARSER_MAX_BREAKPOINT_INFO_COUNT]; /**< breakpoint info list */\n  uint16_t breakpoint_info_count; /**< current breakpoint index */\n  parser_line_counter_t last_breakpoint_line; /**< last line where breakpoint has been inserted */\n#endif /* JERRY_DEBUGGER */\n\n#if JERRY_LINE_INFO\n  parser_line_info_data_t *line_info_p; /**< line info data */\n#endif /* JERRY_LINE_INFO */\n\n#if JERRY_FUNCTION_TO_STRING\n  const uint8_t *function_start_p; /**< start position of the function which will be parsed */\n  const uint8_t *function_end_p; /**< end position of the current function */\n#endif /* JERRY_FUNCTION_TO_STRING */\n} parser_context_t;\n\n/**\n * @}\n * @}\n * @}\n *\n * \\addtogroup mem Memory allocation\n * @{\n *\n * \\addtogroup mem_parser Parser memory manager\n * @{\n */\n\n/* Memory management.\n * Note: throws an error if unsuccessful. */\nvoid *parser_malloc (parser_context_t *context_p, size_t size);\nvoid parser_free (void *ptr, size_t size);\nvoid *parser_malloc_local (parser_context_t *context_p, size_t size);\nvoid parser_free_local (void *ptr, size_t size);\nvoid parser_free_allocated_buffer (parser_context_t *context_p);\n\n/* Parser byte stream. */\n\nvoid parser_cbc_stream_init (parser_mem_data_t *data_p);\nvoid parser_cbc_stream_free (parser_mem_data_t *data_p);\nvoid parser_cbc_stream_alloc_page (parser_context_t *context_p, parser_mem_data_t *data_p);\n\n/* Parser list. Ensures pointer alignment. */\n\nvoid parser_list_init (parser_list_t *list_p, uint32_t item_size, uint32_t item_count);\nvoid parser_list_free (parser_list_t *list_p);\nvoid parser_list_reset (parser_list_t *list_p);\nvoid *parser_list_append (parser_context_t *context_p, parser_list_t *list_p);\nvoid *parser_list_get (parser_list_t *list_p, size_t index);\nvoid parser_list_iterator_init (parser_list_t *list_p, parser_list_iterator_t *iterator_p);\nvoid *parser_list_iterator_next (parser_list_iterator_t *iterator_p);\n\n/* Parser stack. Optimized for pushing bytes.\n * Pop functions never throws error. */\n\nvoid parser_stack_init (parser_context_t *context_p);\nvoid parser_stack_free (parser_context_t *context_p);\nvoid parser_stack_push_uint8 (parser_context_t *context_p, uint8_t uint8_value);\nvoid parser_stack_pop_uint8 (parser_context_t *context_p);\nvoid parser_stack_change_last_uint8 (parser_context_t *context_p, uint8_t new_value);\nuint8_t *parser_stack_get_prev_uint8 (parser_context_t *context_p);\nvoid parser_stack_push_uint16 (parser_context_t *context_p, uint16_t uint16_value);\nuint16_t parser_stack_pop_uint16 (parser_context_t *context_p);\nvoid parser_stack_push (parser_context_t *context_p, const void *data_p, uint32_t length);\nvoid parser_stack_pop (parser_context_t *context_p, void *data_p, uint32_t length);\nvoid parser_stack_iterator_init (parser_context_t *context_p, parser_stack_iterator_t *iterator);\nuint8_t parser_stack_iterator_read_uint8 (parser_stack_iterator_t *iterator);\nvoid parser_stack_iterator_skip (parser_stack_iterator_t *iterator, size_t length);\nvoid parser_stack_iterator_read (parser_stack_iterator_t *iterator, void *data_p, size_t length);\nvoid parser_stack_iterator_write (parser_stack_iterator_t *iterator, const void *data_p, size_t length);\n\n/**\n * @}\n * @}\n *\n * \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_utils Utility\n * @{\n */\n\n/* Compact byte code emitting functions. */\n\nvoid parser_flush_cbc (parser_context_t *context_p);\nvoid parser_emit_cbc (parser_context_t *context_p, uint16_t opcode);\nvoid parser_emit_cbc_literal (parser_context_t *context_p, uint16_t opcode, uint16_t literal_index);\nvoid\nparser_emit_cbc_literal_value (parser_context_t *context_p, uint16_t opcode, uint16_t literal_index, uint16_t value);\nvoid parser_emit_cbc_literal_from_token (parser_context_t *context_p, uint16_t opcode);\nvoid parser_emit_cbc_call (parser_context_t *context_p, uint16_t opcode, size_t call_arguments);\nvoid parser_emit_cbc_push_number (parser_context_t *context_p, bool is_negative_number);\nvoid parser_emit_cbc_forward_branch (parser_context_t *context_p, uint16_t opcode, parser_branch_t *branch_p);\nparser_branch_node_t *\nparser_emit_cbc_forward_branch_item (parser_context_t *context_p, uint16_t opcode, parser_branch_node_t *next_p);\nvoid parser_emit_cbc_backward_branch (parser_context_t *context_p, uint16_t opcode, uint32_t offset);\necma_string_t *parser_new_ecma_string_from_literal (lexer_literal_t *literal_p);\nvoid parser_set_branch_to_current_position (parser_context_t *context_p, parser_branch_t *branch_p);\nvoid parser_set_breaks_to_current_position (parser_context_t *context_p, parser_branch_node_t *current_p);\nvoid parser_set_continues_to_current_position (parser_context_t *context_p, parser_branch_node_t *current_p);\nvoid parser_reverse_class_fields (parser_context_t *context_p, size_t fields_size);\n\n/* Convenience macros. */\n#define parser_emit_cbc_ext(context_p, opcode) parser_emit_cbc ((context_p), PARSER_TO_EXT_OPCODE (opcode))\n#define parser_emit_cbc_ext_literal(context_p, opcode, literal_index) \\\n  parser_emit_cbc_literal ((context_p), PARSER_TO_EXT_OPCODE (opcode), (literal_index))\n#define parser_emit_cbc_ext_literal_from_token(context_p, opcode) \\\n  parser_emit_cbc_literal_from_token ((context_p), PARSER_TO_EXT_OPCODE (opcode))\n#define parser_emit_cbc_ext_call(context_p, opcode, call_arguments) \\\n  parser_emit_cbc_call ((context_p), PARSER_TO_EXT_OPCODE (opcode), (call_arguments))\n#define parser_emit_cbc_ext_call(context_p, opcode, call_arguments) \\\n  parser_emit_cbc_call ((context_p), PARSER_TO_EXT_OPCODE (opcode), (call_arguments))\n#define parser_emit_cbc_ext_forward_branch(context_p, opcode, branch_p) \\\n  parser_emit_cbc_forward_branch ((context_p), PARSER_TO_EXT_OPCODE (opcode), (branch_p))\n#define parser_emit_cbc_ext_backward_branch(context_p, opcode, offset) \\\n  parser_emit_cbc_backward_branch ((context_p), PARSER_TO_EXT_OPCODE (opcode), (offset))\n\n/**\n * @}\n *\n * \\addtogroup jsparser_lexer Lexer\n * @{\n */\n\n/* Lexer functions */\n\nvoid lexer_next_token (parser_context_t *context_p);\nbool lexer_check_next_character (parser_context_t *context_p, lit_utf8_byte_t character);\nbool lexer_check_next_characters (parser_context_t *context_p, lit_utf8_byte_t character1, lit_utf8_byte_t character2);\nuint8_t lexer_consume_next_character (parser_context_t *context_p);\nbool lexer_check_post_primary_exp (parser_context_t *context_p);\nlit_code_point_t lexer_peek_next_character (parser_context_t *context_p);\nvoid lexer_skip_empty_statements (parser_context_t *context_p);\nbool lexer_check_arrow (parser_context_t *context_p);\nbool lexer_check_arrow_param (parser_context_t *context_p);\nbool lexer_check_yield_no_arg (parser_context_t *context_p);\nbool lexer_consume_generator (parser_context_t *context_p);\nbool lexer_consume_assign (parser_context_t *context_p);\nvoid lexer_update_await_yield (parser_context_t *context_p, uint32_t status_flags);\nbool lexer_scan_private_identifier (parser_context_t *context_p);\nvoid lexer_parse_string (parser_context_t *context_p, lexer_string_options_t opts);\nvoid lexer_expect_identifier (parser_context_t *context_p, uint8_t literal_type);\nbool lexer_scan_identifier (parser_context_t *context_p, lexer_parse_options_t opts);\nvoid lexer_check_property_modifier (parser_context_t *context_p);\nvoid lexer_convert_ident_to_cesu8 (uint8_t *destination_p, const uint8_t *source_p, prop_length_t length);\n\nconst uint8_t *lexer_convert_literal_to_chars (parser_context_t *context_p,\n                                               const lexer_lit_location_t *literal_p,\n                                               uint8_t *local_byte_array_p,\n                                               lexer_string_options_t opts);\nvoid lexer_expect_object_literal_id (parser_context_t *context_p, uint32_t ident_opts);\nlexer_literal_t *lexer_construct_unused_literal (parser_context_t *context_p);\nvoid lexer_construct_literal_object (parser_context_t *context_p,\n                                     const lexer_lit_location_t *lit_location_p,\n                                     uint8_t literal_type);\nbool lexer_construct_number_object (parser_context_t *context_p, bool is_expr, bool is_negative_number);\nvoid lexer_convert_push_number_to_push_literal (parser_context_t *context_p);\nuint16_t lexer_construct_function_object (parser_context_t *context_p, uint32_t extra_status_flags);\nuint16_t lexer_construct_class_static_block_function (parser_context_t *context_p);\nvoid lexer_construct_regexp_object (parser_context_t *context_p, bool parse_only);\nbool lexer_compare_identifier_to_string (const lexer_lit_location_t *left_p, const uint8_t *right_p, size_t size);\nbool lexer_compare_identifiers (parser_context_t *context_p,\n                                const lexer_lit_location_t *left_p,\n                                const lexer_lit_location_t *right_p);\nbool lexer_current_is_literal (parser_context_t *context_p, const lexer_lit_location_t *right_ident_p);\nbool lexer_string_is_use_strict (parser_context_t *context_p);\nbool lexer_string_is_directive (parser_context_t *context_p);\nbool lexer_token_is_identifier (parser_context_t *context_p, const char *identifier_p, size_t identifier_length);\nbool lexer_token_is_let (parser_context_t *context_p);\nbool lexer_token_is_async (parser_context_t *context_p);\nbool lexer_compare_literal_to_string (parser_context_t *context_p, const char *string_p, size_t string_length);\nvoid lexer_init_line_info (parser_context_t *context_p);\nuint8_t lexer_convert_binary_lvalue_token_to_binary (uint8_t token);\n\n/**\n * @}\n *\n * \\addtogroup jsparser_expr Expression parser\n * @{\n */\n\n/* Parser functions. */\n\nvoid parser_parse_block_expression (parser_context_t *context_p, int options);\nvoid parser_parse_expression_statement (parser_context_t *context_p, int options);\nvoid parser_parse_expression (parser_context_t *context_p, int options);\nvoid parser_resolve_private_identifier (parser_context_t *context_p);\nvoid parser_save_private_context (parser_context_t *context_p,\n                                  parser_private_context_t *private_ctx_p,\n                                  scanner_class_info_t *class_info_p);\nvoid parser_restore_private_context (parser_context_t *context_p, parser_private_context_t *private_ctx_p);\nvoid parser_parse_class (parser_context_t *context_p, bool is_statement);\nvoid parser_parse_initializer (parser_context_t *context_p, parser_pattern_flags_t flags);\nvoid parser_parse_initializer_by_next_char (parser_context_t *context_p, parser_pattern_flags_t flags);\n/**\n * @}\n *\n * \\addtogroup jsparser_scanner Scanner\n * @{\n */\n\nvoid scanner_release_next (parser_context_t *context_p, size_t size);\nvoid scanner_set_active (parser_context_t *context_p);\nvoid scanner_revert_active (parser_context_t *context_p);\nvoid scanner_release_active (parser_context_t *context_p, size_t size);\nvoid scanner_release_switch_cases (scanner_case_info_t *case_p);\nvoid scanner_release_private_fields (scanner_class_private_member_t *member_p);\nvoid scanner_seek (parser_context_t *context_p);\nvoid scanner_reverse_info_list (parser_context_t *context_p);\nvoid scanner_cleanup (parser_context_t *context_p);\n\nbool scanner_is_context_needed (parser_context_t *context_p, parser_check_context_type_t check_type);\nbool scanner_try_scan_new_target (parser_context_t *context_p);\nvoid scanner_check_variables (parser_context_t *context_p);\nvoid scanner_create_variables (parser_context_t *context_p, uint32_t option_flags);\n\nvoid scanner_get_location (scanner_location_t *location_p, parser_context_t *context_p);\nvoid scanner_set_location (parser_context_t *context_p, scanner_location_t *location_p);\nuint16_t scanner_decode_map_to (parser_scope_stack_t *stack_item_p);\nuint16_t scanner_save_literal (parser_context_t *context_p, uint16_t ident_index);\nbool scanner_literal_is_const_reg (parser_context_t *context_p, uint16_t literal_index);\nbool scanner_literal_is_created (parser_context_t *context_p, uint16_t literal_index);\nbool scanner_literal_exists (parser_context_t *context_p, uint16_t literal_index);\n\nvoid scanner_scan_all (parser_context_t *context_p);\n\n/**\n * @}\n *\n * \\addtogroup jsparser_stmt Statement parser\n * @{\n */\n\nvoid parser_parse_statements (parser_context_t *context_p);\nvoid parser_free_jumps (parser_stack_iterator_t iterator);\n\n#if JERRY_MODULE_SYSTEM\n/**\n * @}\n *\n * \\addtogroup jsparser_stmt Module statement parser\n * @{\n */\n\nextern const lexer_lit_location_t lexer_default_literal;\nvoid parser_module_check_request_place (parser_context_t *context_p);\nvoid parser_module_context_init (parser_context_t *context_p);\nvoid parser_module_append_names (parser_context_t *context_p, ecma_module_names_t **module_names_p);\nvoid parser_module_handle_module_specifier (parser_context_t *context_p, ecma_module_node_t **node_list_p);\nvoid parser_module_handle_requests (parser_context_t *context_p);\nvoid parser_module_parse_export_clause (parser_context_t *context_p);\nvoid parser_module_parse_import_clause (parser_context_t *context_p);\nvoid parser_module_set_default (parser_context_t *context_p);\nbool parser_module_check_duplicate_import (parser_context_t *context_p, ecma_string_t *local_name_p);\nbool parser_module_check_duplicate_export (parser_context_t *context_p, ecma_string_t *export_name_p);\nvoid parser_module_append_export_name (parser_context_t *context_p);\nvoid\nparser_module_add_names_to_node (parser_context_t *context_p, ecma_string_t *imex_name_p, ecma_string_t *local_name_p);\n\n#endif /* JERRY_MODULE_SYSTEM */\n\n/*\n * @}\n *\n * \\addtogroup jsparser_line_info_create Create line info data\n * @{\n */\n\n#if JERRY_LINE_INFO\nvoid parser_line_info_free (parser_line_info_data_t *line_info_p);\nvoid parser_line_info_append (parser_context_t *context_p, parser_line_counter_t line, parser_line_counter_t column);\nuint8_t *parser_line_info_generate (parser_context_t *context_p);\n#endif /* JERRY_LINE_INFO */\n\n/**\n * @}\n *\n * \\addtogroup jsparser_parser Parser\n * @{\n */\n\necma_compiled_code_t *parser_parse_function (parser_context_t *context_p, uint32_t status_flags);\necma_compiled_code_t *parser_parse_class_static_block (parser_context_t *context_p);\necma_compiled_code_t *parser_parse_arrow_function (parser_context_t *context_p, uint32_t status_flags);\necma_compiled_code_t *parser_parse_class_fields (parser_context_t *context_p);\nvoid parser_set_function_name (parser_context_t *context_p,\n                               uint16_t function_literal_index,\n                               uint16_t name_index,\n                               uint32_t status_flags);\nvoid parser_compiled_code_set_function_name (parser_context_t *context_p,\n                                             ecma_compiled_code_t *bytecode_p,\n                                             uint16_t name_index,\n                                             uint32_t status_flags);\nuint16_t parser_check_anonymous_function_declaration (parser_context_t *context_p);\n\n/* Error management. */\n\nvoid parser_raise_error (parser_context_t *context_p, parser_error_msg_t error);\n\n/* Debug functions. */\n\n#if JERRY_DEBUGGER\n\nvoid parser_append_breakpoint_info (parser_context_t *context_p, jerry_debugger_header_type_t type, uint32_t value);\n\n#endif /* JERRY_DEBUGGER */\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\nvoid util_print_cbc (ecma_compiled_code_t *compiled_code_p);\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* !JS_PARSER_INTERNAL_H */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser-limits.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JS_PARSER_LIMITS_H\n#define JS_PARSER_LIMITS_H\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_internals Internals\n * @{\n */\n\n/**\n * Maximum identifier length accepted by the parser.\n * Limit: LEXER_MAX_STRING_LENGTH.\n */\n#ifndef PARSER_MAXIMUM_IDENT_LENGTH\n#define PARSER_MAXIMUM_IDENT_LENGTH 255\n#endif /* !PARSER_MAXIMUM_IDENT_LENGTH */\n\n/**\n * Maximum string limit.\n * Limit: 2147483647 / 65535.\n */\n#if JERRY_CPOINTER_32_BIT\n#define PARSER_MAXIMUM_STRING_LIMIT 2147483647\n#else /* !JERRY_CPOINTER_32_BIT */\n#define PARSER_MAXIMUM_STRING_LIMIT 65535\n#endif /* JERRY_CPOINTER_32_BIT */\n\n/**\n * Maximum string length.\n * Limit: PARSER_MAXIMUM_STRING_LIMIT.\n */\n#ifndef PARSER_MAXIMUM_STRING_LENGTH\n#define PARSER_MAXIMUM_STRING_LENGTH PARSER_MAXIMUM_STRING_LIMIT\n#endif /* !PARSER_MAXIMUM_STRING_LENGTH */\n\n/**\n * Maximum number of registers.\n * Limit: min: 256, max: min(PARSER_MAXIMUM_NUMBER_OF_LITERALS / 2, 16383)\n */\n#ifndef PARSER_MAXIMUM_NUMBER_OF_REGISTERS\n#define PARSER_MAXIMUM_NUMBER_OF_REGISTERS 256\n#endif /* !PARSER_MAXIMUM_NUMBER_OF_REGISTERS */\n\n/**\n * Maximum number of literals.\n * Limit: 32767 - PARSER_MAXIMUM_NUMBER_OF_REGISTERS. Recommended: 32767 - PARSER_MAXIMUM_NUMBER_OF_REGISTERS.\n */\n#ifndef PARSER_MAXIMUM_NUMBER_OF_LITERALS\n#define PARSER_MAXIMUM_NUMBER_OF_LITERALS (32767 - PARSER_MAXIMUM_NUMBER_OF_REGISTERS)\n#endif /* !PARSER_MAXIMUM_NUMBER_OF_LITERALS */\n\n/**\n * Maximum depth of scope stack.\n * Limit: 32767. Recommended: 32767\n */\n#ifndef PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK\n#define PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK 32767\n#endif /* !PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK */\n\n/**\n * Maximum code size.\n * Limit: 16777215. Recommended: 65535, 16777215.\n */\n#ifndef PARSER_MAXIMUM_CODE_SIZE\n#define PARSER_MAXIMUM_CODE_SIZE (65535 << (JMEM_ALIGNMENT_LOG))\n#endif /* !PARSER_MAXIMUM_CODE_SIZE */\n\n/**\n * Maximum number of values pushed onto the stack by a function.\n * Limit: 65500. Recommended: 1024.\n */\n#ifndef PARSER_MAXIMUM_STACK_LIMIT\n#define PARSER_MAXIMUM_STACK_LIMIT 1024\n\n#endif /* !PARSER_MAXIMUM_STACK_LIMIT */\n\n/* Checks. */\n\n#if (PARSER_MAXIMUM_STRING_LENGTH < 1) || (PARSER_MAXIMUM_STRING_LENGTH > PARSER_MAXIMUM_STRING_LIMIT)\n#error \"Maximum string length is not within range.\"\n#endif /* (PARSER_MAXIMUM_STRING_LENGTH < 1) || (PARSER_MAXIMUM_STRING_LENGTH > PARSER_MAXIMUM_STRING_LIMIT) */\n\n#if (PARSER_MAXIMUM_IDENT_LENGTH < 1) || (PARSER_MAXIMUM_IDENT_LENGTH > PARSER_MAXIMUM_STRING_LENGTH)\n#error \"Maximum identifier length is not within range.\"\n#endif /* (PARSER_MAXIMUM_IDENT_LENGTH < 1) || (PARSER_MAXIMUM_IDENT_LENGTH > PARSER_MAXIMUM_STRING_LENGTH) */\n\n#if ((PARSER_MAXIMUM_NUMBER_OF_LITERALS < 1) \\\n     || (PARSER_MAXIMUM_NUMBER_OF_LITERALS + PARSER_MAXIMUM_NUMBER_OF_REGISTERS > 32767))\n#error \"Maximum number of literals is not within range.\"\n#endif /* ((PARSER_MAXIMUM_NUMBER_OF_LITERALS < 1) \\\n           || (PARSER_MAXIMUM_NUMBER_OF_LITERALS > 32767)) */\n\n#if (PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK < 1) || (PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK > 32767)\n#error \"Maximum depth of scope stack is not within range.\"\n#endif /* (PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK < 1) || (PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK > 32767) */\n\n#if ((PARSER_MAXIMUM_NUMBER_OF_REGISTERS * 2) > PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n#error \"Maximum number of registers is not within range.\"\n#endif /* ((PARSER_MAXIMUM_NUMBER_OF_REGISTERS * 2) > PARSER_MAXIMUM_NUMBER_OF_LITERALS) */\n\n#if (PARSER_MAXIMUM_CODE_SIZE < 4096) || (PARSER_MAXIMUM_CODE_SIZE > 16777215)\n#error \"Maximum code size is not within range.\"\n#endif /* (PARSER_MAXIMUM_CODE_SIZE < 4096) || (PARSER_MAXIMUM_CODE_SIZE > 16777215) */\n\n#if (PARSER_MAXIMUM_STACK_LIMIT < 16) || (PARSER_MAXIMUM_STACK_LIMIT > 65500)\n#error \"Maximum function stack usage is not within range.\"\n#endif /* (PARSER_MAXIMUM_STACK_LIMIT < 16) || (PARSER_MAXIMUM_STACK_LIMIT > 65500) */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* !JS_PARSER_LIMITS_H */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser-line-info-create.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-line-info.h\"\n\n#include \"js-parser-internal.h\"\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_line_info_create Create line info data\n * @{\n */\n\n#if JERRY_PARSER\n\n#if JERRY_LINE_INFO\n\n/*\n * The line-info data structure uses two number encodings:\n *\n * Vlq (variable length quantity):\n *    Each byte has 7 bit data and the highest bit is set for continuation.\n *    The format is big endian.\n *\n * Small:\n *    One byte can encode signed values between 127 and -126.\n *    Two byte can encode signed values between 319 and -318.\n *    Large values are encoded with vlq with a prefix byte.\n *\n * The line-info data structure is a sequence of chunks:\n *\n *  +------+--------------+------------+----------------+\n *  | Line | StreamLength | StreamData | [ByteCodeSize] |\n *  +------+--------------+------------+----------------+\n *\n *  Line [Vlq encoding]:\n *      Specifies the start line of this chunk, relative to its previous value.\n *      The starting column is always ECMA_LINE_INFO_COLUMN_DEFAULT\n *\n *  StreamLength [uint8_t]:\n *      Length of the StreamData in bytes minus ECMA_LINE_INFO_STREAM_SIZE_MIN.\n *      The 0 value represents the last chunk, which size is not specified\n *      (Can be less than ECMA_LINE_INFO_STREAM_SIZE_MIN).\n *\n *  StreamData [sequence of bytes]:\n *      Sequence of the following items:\n *\n *      +-----------+--------+--------+\n *      | EndOffset | [Line] | Column |\n *      +-----------+--------+--------+\n *\n *      EndOffset [Small encoding]:\n *          Specifies the EndOffset in the byte code, relative to the previous EndOffset.\n *          The range of byte codes corresponding to the line/column position of this item\n *          is between the EndOffset of the previous item (inclusive) and the EndOffset\n *          of this item (exclusive). The last end offset of a stream is always 0, which\n *          represents an unterminated range.\n *\n *      Line [Small encoding] [Optional]:\n *          If bit 1 of end offset is set, this specifies the line position of this item,\n *          relative to the previous line position, and the column position is set to\n *          ECMA_LINE_INFO_COLUMN_DEFAULT.\n *\n *      Column [Small encoding]:\n *          Specifies the current column position relative to the previous column position.\n *\n *  ByteCodeSize [Vlq encoding] [Optional]:\n *      If StreamLength is not 0, this specifies the byte code size of the whole range.\n *      This value can be used to skip the byte codes which line info is stored\n *      in this chunk. This information is not available for the last chunk.\n */\n\n/**\n * Maximum number of bytes requires to encode a number.\n */\n#define PARSER_LINE_INFO_BUFFER_MAX_SIZE 6\n\n/**\n * Stream generation ends after this size is reached,\n * since there might be not enough place for the next item.\n */\n#define PARSER_LINE_INFO_STREAM_SIZE_LIMIT \\\n  (ECMA_LINE_INFO_STREAM_SIZE_MIN + UINT8_MAX - ((2 * PARSER_LINE_INFO_BUFFER_MAX_SIZE) + 1))\n\n/**\n * Page size of line info pages excluding the first one.\n */\n#define PARSER_LINE_INFO_PAGE_SIZE (sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE)\n\n/**\n * Page size of the first line info page.\n */\n#define PARSER_LINE_INFO_FIRST_PAGE_SIZE (sizeof (parser_line_info_data_t) + PARSER_LINE_INFO_PAGE_SIZE)\n\n/**\n * Get memory data of the first page.\n */\n#define PARSER_LINE_INFO_GET_FIRST_PAGE(line_info_p) (((parser_mem_page_t *) ((line_info_p) + 1)))\n\n/**\n * Free line info temporary data collected during parsing.\n */\nvoid\nparser_line_info_free (parser_line_info_data_t *line_info_p)\n{\n  if (line_info_p == NULL)\n  {\n    return;\n  }\n\n  parser_mem_page_t *current_page_p = PARSER_LINE_INFO_GET_FIRST_PAGE (line_info_p)->next_p;\n  parser_free (line_info_p, PARSER_LINE_INFO_FIRST_PAGE_SIZE);\n\n  while (current_page_p != NULL)\n  {\n    parser_mem_page_t *next_p = current_page_p->next_p;\n\n    parser_free (current_page_p, PARSER_LINE_INFO_PAGE_SIZE);\n    current_page_p = next_p;\n  }\n} /* parser_line_info_free */\n\n/**\n * Encodes an uint32_t number into a buffer. Numbers expected to be larger values.\n *\n * @return the number of bytes written to the buffer\n */\nstatic uint32_t\nparser_line_info_encode_vlq (uint8_t *buffer_p, /**< target buffer */\n                             uint32_t value) /**< encoded value */\n{\n  if (value <= ECMA_LINE_INFO_VLQ_MASK)\n  {\n    *buffer_p = (uint8_t) value;\n    return 1;\n  }\n\n  uint32_t length = 0;\n  uint32_t current_value = value;\n\n  do\n  {\n    current_value >>= ECMA_LINE_INFO_VLQ_SHIFT;\n    length++;\n  } while (current_value > 0);\n\n  buffer_p += length;\n\n  do\n  {\n    *(--buffer_p) = (uint8_t) (value | ECMA_LINE_INFO_VLQ_CONTINUE);\n    value >>= ECMA_LINE_INFO_VLQ_SHIFT;\n  } while (value > 0);\n\n  buffer_p[length - 1] &= ECMA_LINE_INFO_VLQ_MASK;\n  return length;\n} /* parser_line_info_encode_vlq */\n\n/**\n * Encodes an uint32_t number into a buffer. Numbers expected to be smaller values.\n *\n * @return the number of bytes written to the buffer\n */\nstatic uint32_t\nparser_line_info_encode_small (uint8_t *buffer_p, /**< target buffer */\n                               uint32_t value) /**< encoded value */\n{\n  if (JERRY_LIKELY (value < ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN))\n  {\n    buffer_p[0] = (uint8_t) value;\n    return 1;\n  }\n\n  if (JERRY_LIKELY (value < ECMA_LINE_INFO_ENCODE_VLQ_MIN))\n  {\n    buffer_p[0] = ECMA_LINE_INFO_ENCODE_TWO_BYTE;\n    buffer_p[1] = (uint8_t) (value - ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN);\n    return 2;\n  }\n\n  *buffer_p++ = ECMA_LINE_INFO_ENCODE_VLQ;\n  return parser_line_info_encode_vlq (buffer_p, value - ECMA_LINE_INFO_ENCODE_VLQ_MIN) + 1;\n} /* parser_line_info_encode_small */\n\n/**\n * Encodes the difference between two values.\n *\n * @return encoded difference\n */\nstatic inline uint32_t JERRY_ATTR_ALWAYS_INLINE\nparser_line_info_difference_get (uint32_t current_value, /**< current value */\n                                 uint32_t prev_value) /**< previous value */\n{\n  uint32_t result = current_value - prev_value - 1;\n\n  if (result <= (UINT32_MAX >> 1))\n  {\n    return (result << 1) | ECMA_LINE_INFO_INCREASE;\n  }\n\n  return ((UINT32_MAX - result) << 1) | ECMA_LINE_INFO_DECREASE;\n} /* parser_line_info_difference_get */\n\n/**\n * Appends a value at the end of the line info stream.\n */\nstatic void\nparser_line_info_append_number (parser_context_t *context_p, /**< context */\n                                uint32_t value) /**< value to be encoded */\n{\n  parser_line_info_data_t *line_info_p = context_p->line_info_p;\n  uint8_t buffer[PARSER_LINE_INFO_BUFFER_MAX_SIZE];\n\n  JERRY_ASSERT (line_info_p != NULL);\n\n  uint32_t length = parser_line_info_encode_vlq (buffer, value);\n  uint8_t offset = line_info_p->last_page_p->bytes[0];\n\n  if (offset + length <= PARSER_STACK_PAGE_SIZE)\n  {\n    memcpy (line_info_p->last_page_p->bytes + offset, buffer, length);\n\n    line_info_p->last_page_p->bytes[0] = (uint8_t) (length + offset);\n    return;\n  }\n\n  parser_mem_page_t *new_page_p;\n  new_page_p = (parser_mem_page_t *) parser_malloc (context_p, PARSER_LINE_INFO_PAGE_SIZE);\n\n  new_page_p->next_p = NULL;\n\n  line_info_p->last_page_p->next_p = new_page_p;\n  line_info_p->last_page_p = new_page_p;\n\n  new_page_p->bytes[0] = (uint8_t) (length + 1);\n  memcpy (new_page_p->bytes + 1, buffer, length);\n} /* parser_line_info_append_number */\n\n/**\n * Updates the current line information data.\n */\nvoid\nparser_line_info_append (parser_context_t *context_p, /**< context */\n                         parser_line_counter_t line, /**< line */\n                         parser_line_counter_t column) /**< column */\n{\n  parser_line_info_data_t *line_info_p = context_p->line_info_p;\n  uint32_t value;\n\n  if (line_info_p != NULL)\n  {\n    if (line_info_p->byte_code_position == context_p->byte_code_size\n        || (line_info_p->line == line && line_info_p->column == column))\n    {\n      return;\n    }\n\n    /* Sets ECMA_LINE_INFO_HAS_LINE bit. */\n    value = (uint32_t) (line != line_info_p->line);\n  }\n  else\n  {\n    line_info_p = (parser_line_info_data_t *) parser_malloc (context_p, PARSER_LINE_INFO_FIRST_PAGE_SIZE);\n    context_p->line_info_p = line_info_p;\n\n    parser_mem_page_t *page_p = PARSER_LINE_INFO_GET_FIRST_PAGE (line_info_p);\n    page_p->next_p = NULL;\n    page_p->bytes[0] = 1;\n\n    line_info_p->last_page_p = page_p;\n    line_info_p->byte_code_position = 0;\n    line_info_p->line = 1;\n    line_info_p->column = 1;\n\n    /* Sets ECMA_LINE_INFO_HAS_LINE bit. */\n    value = (uint32_t) (line != 1);\n  }\n\n  value |= ((context_p->byte_code_size - line_info_p->byte_code_position) << 1);\n\n  parser_line_info_append_number (context_p, value);\n  line_info_p->byte_code_position = context_p->byte_code_size;\n\n  if (value & ECMA_LINE_INFO_HAS_LINE)\n  {\n    value = parser_line_info_difference_get (line, line_info_p->line);\n    parser_line_info_append_number (context_p, value);\n    line_info_p->line = line;\n  }\n\n  value = parser_line_info_difference_get (column, line_info_p->column);\n  parser_line_info_append_number (context_p, value);\n  line_info_p->column = column;\n} /* parser_line_info_append */\n\n/**\n * Line info iterator structure\n */\ntypedef struct\n{\n  parser_mem_page_t *current_page_p; /**< current page */\n  uint32_t offset; /**< current offset */\n} parser_line_info_iterator_t;\n\n/**\n * Decodes the next value from the iterator stream\n */\nstatic uint32_t\nparser_line_info_iterator_get (parser_line_info_iterator_t *iterator_p) /**< iterator */\n{\n  uint8_t *source_p = iterator_p->current_page_p->bytes + iterator_p->offset;\n  uint32_t result = ecma_line_info_decode_vlq (&source_p);\n\n  iterator_p->offset = (uint32_t) (source_p - iterator_p->current_page_p->bytes);\n\n  JERRY_ASSERT (iterator_p->offset <= iterator_p->current_page_p->bytes[0]);\n\n  if (iterator_p->offset < iterator_p->current_page_p->bytes[0])\n  {\n    return result;\n  }\n\n  iterator_p->current_page_p = iterator_p->current_page_p->next_p;\n  iterator_p->offset = 1;\n  return result;\n} /* parser_line_info_iterator_get */\n\n/**\n * Generate line info data\n *\n * @return generated line info data\n */\nuint8_t *\nparser_line_info_generate (parser_context_t *context_p) /**< context */\n{\n  parser_line_info_iterator_t iterator;\n  uint8_t *line_info_p = NULL;\n  uint8_t *dst_p = NULL;\n  uint32_t total_length = 0;\n  uint32_t total_length_size = 0;\n\n  while (true)\n  {\n    /* The following code runs twice: first the size of the data,\n     * is computed and the data is generated during the second run.\n     * Note: line_info_p is NULL during the first run. */\n    parser_mem_page_t *iterator_byte_code_page_p = context_p->byte_code.first_p;\n    uint32_t iterator_byte_code_page_offset = 0;\n    uint32_t iterator_byte_code_base = 0;\n    uint32_t iterator_last_byte_code_offset = UINT32_MAX;\n    uint32_t iterator_prev_line = 0;\n    uint32_t iterator_prev_column = 0;\n    uint32_t iterator_line = 1;\n    uint32_t iterator_column = 1;\n    uint8_t block_buffer[PARSER_LINE_INFO_BUFFER_MAX_SIZE];\n    uint8_t line_column_buffer[PARSER_LINE_INFO_BUFFER_MAX_SIZE * 2];\n    uint8_t *block_size_p = NULL;\n    uint32_t block_byte_code_offset = 0;\n    uint32_t block_prev_line = 1;\n    uint32_t stream_byte_code_offset = 0;\n    uint32_t stream_current_line = 1;\n    uint32_t stream_current_column = ECMA_LINE_INFO_COLUMN_DEFAULT;\n    uint32_t stream_prev_line = 1;\n    uint32_t stream_prev_column = ECMA_LINE_INFO_COLUMN_DEFAULT;\n    uint32_t stream_size = 0;\n    uint32_t stream_value_count = 0;\n    uint32_t value;\n\n    iterator.current_page_p = PARSER_LINE_INFO_GET_FIRST_PAGE (context_p->line_info_p);\n    iterator.offset = 1;\n\n    do\n    {\n      /* Decode line information generated during parsing. */\n      value = parser_line_info_iterator_get (&iterator);\n      iterator_byte_code_page_offset += (value >> 1);\n\n      if (value & 0x1)\n      {\n        value = parser_line_info_iterator_get (&iterator);\n        JERRY_ASSERT (value != ((0 << 1) | ECMA_LINE_INFO_DECREASE));\n        iterator_line = ecma_line_info_difference_update (iterator_line, value);\n      }\n\n      value = parser_line_info_iterator_get (&iterator);\n      iterator_column = ecma_line_info_difference_update (iterator_column, value);\n\n      while (iterator_byte_code_page_offset >= PARSER_CBC_STREAM_PAGE_SIZE)\n      {\n        uint8_t relative_offset = iterator_byte_code_page_p->bytes[PARSER_CBC_STREAM_PAGE_SIZE - 1];\n        iterator_byte_code_base += relative_offset & CBC_LOWER_SEVEN_BIT_MASK;\n        iterator_byte_code_page_offset -= PARSER_CBC_STREAM_PAGE_SIZE;\n        iterator_byte_code_page_p = iterator_byte_code_page_p->next_p;\n      }\n\n      uint32_t iterator_byte_code_offset = iterator_byte_code_base;\n\n      if (iterator_byte_code_page_offset > 0)\n      {\n        uint8_t relative_offset = iterator_byte_code_page_p->bytes[iterator_byte_code_page_offset - 1];\n        iterator_byte_code_offset += relative_offset & CBC_LOWER_SEVEN_BIT_MASK;\n      }\n\n      /* Skip those line/column pairs which byte code was discarded during post processing\n       * or does not change line/column (this is possible when multiple skips occures). */\n      if (iterator_byte_code_offset == iterator_last_byte_code_offset\n          || (iterator_line == iterator_prev_line && iterator_column == iterator_prev_column))\n      {\n        continue;\n      }\n\n      iterator_prev_line = iterator_line;\n      iterator_prev_column = iterator_column;\n      iterator_last_byte_code_offset = iterator_byte_code_offset;\n\n      if (block_size_p != NULL)\n      {\n        /* Sets ECMA_LINE_INFO_HAS_LINE bit. */\n        value = (((iterator_byte_code_offset - stream_byte_code_offset) << 1)\n                 | (uint32_t) (stream_prev_line != stream_current_line));\n\n        uint32_t line_column_size = 0;\n        uint32_t offset_size = parser_line_info_encode_small (block_buffer, value);\n        stream_byte_code_offset = iterator_byte_code_offset;\n\n        if (value & ECMA_LINE_INFO_HAS_LINE)\n        {\n          value = parser_line_info_difference_get (stream_current_line, stream_prev_line);\n          line_column_size = parser_line_info_encode_small (line_column_buffer, value);\n          stream_prev_line = stream_current_line;\n          stream_prev_column = ECMA_LINE_INFO_COLUMN_DEFAULT;\n        }\n\n        value = parser_line_info_difference_get (stream_current_column, stream_prev_column);\n        line_column_size += parser_line_info_encode_small (line_column_buffer + line_column_size, value);\n\n        stream_prev_column = stream_current_column;\n        stream_current_line = iterator_line;\n        stream_current_column = iterator_column;\n\n        stream_value_count++;\n\n        if (stream_value_count < ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX\n            && (stream_size + offset_size + line_column_size <= PARSER_LINE_INFO_STREAM_SIZE_LIMIT))\n        {\n          stream_size += offset_size + line_column_size;\n\n          if (line_info_p != NULL)\n          {\n            memcpy (dst_p, block_buffer, offset_size);\n            dst_p += offset_size;\n            memcpy (dst_p, line_column_buffer, line_column_size);\n            dst_p += line_column_size;\n          }\n          continue;\n        }\n\n        /* Finalize the current chunk. The size of EndOffset is always 1. */\n        stream_size += 1 + line_column_size;\n\n        JERRY_ASSERT (stream_size > ECMA_LINE_INFO_STREAM_SIZE_MIN\n                      && (stream_size - ECMA_LINE_INFO_STREAM_SIZE_MIN) <= UINT8_MAX);\n\n        if (line_info_p != NULL)\n        {\n          *block_size_p = (uint8_t) (stream_size - ECMA_LINE_INFO_STREAM_SIZE_MIN);\n          /* Set EndOffset to 0 and copy the has_line bit. */\n          *dst_p++ = (uint8_t) (block_buffer[0] & ECMA_LINE_INFO_HAS_LINE);\n          memcpy (dst_p, line_column_buffer, line_column_size);\n          dst_p += line_column_size;\n        }\n        else\n        {\n          total_length += stream_size;\n          dst_p = block_buffer;\n        }\n\n        uint32_t byte_code_diff = iterator_last_byte_code_offset - block_byte_code_offset;\n        dst_p += parser_line_info_encode_vlq (dst_p, byte_code_diff);\n        block_byte_code_offset = iterator_last_byte_code_offset;\n\n        if (line_info_p == NULL)\n        {\n          total_length += (uint32_t) (dst_p - block_buffer);\n        }\n      }\n\n      /* Start a new chunk. */\n      if (line_info_p == NULL)\n      {\n        dst_p = block_buffer;\n      }\n\n      value = parser_line_info_difference_get (iterator_line, block_prev_line);\n\n      dst_p += parser_line_info_encode_vlq (dst_p, value);\n      block_size_p = dst_p;\n      dst_p++;\n\n      if (line_info_p == NULL)\n      {\n        total_length += (uint32_t) (dst_p - block_buffer);\n      }\n\n      block_prev_line = iterator_line;\n      stream_current_line = iterator_line;\n      stream_current_column = iterator_column;\n      stream_prev_line = iterator_line;\n      stream_prev_column = ECMA_LINE_INFO_COLUMN_DEFAULT;\n      stream_size = 0;\n      stream_value_count = 0;\n    } while (iterator.current_page_p != NULL);\n\n    value = (stream_prev_line != stream_current_line);\n\n    /* Finalize the last stream */\n    if (line_info_p == NULL)\n    {\n      dst_p = line_column_buffer;\n      total_length += stream_size + 1;\n    }\n    else\n    {\n      *block_size_p = 0;\n      /* Small encoded value of has_line bit. */\n      *dst_p++ = (uint8_t) value;\n    }\n\n    if (value)\n    {\n      value = parser_line_info_difference_get (stream_current_line, stream_prev_line);\n      dst_p += parser_line_info_encode_small (dst_p, value);\n      stream_prev_column = ECMA_LINE_INFO_COLUMN_DEFAULT;\n    }\n\n    value = parser_line_info_difference_get (stream_current_column, stream_prev_column);\n    dst_p += parser_line_info_encode_small (dst_p, value);\n\n    if (line_info_p == NULL)\n    {\n      total_length += (uint32_t) (dst_p - line_column_buffer);\n    }\n\n    if (line_info_p != NULL)\n    {\n      break;\n    }\n\n    total_length_size = parser_line_info_encode_vlq (block_buffer, total_length);\n\n    /* TODO: Support allocation fail. */\n    line_info_p = (uint8_t *) jmem_heap_alloc_block (total_length + total_length_size);\n    dst_p = line_info_p + parser_line_info_encode_vlq (line_info_p, total_length);\n  }\n\n  JERRY_ASSERT (line_info_p + total_length_size + total_length == dst_p);\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    ecma_line_info_dump (line_info_p);\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  return line_info_p;\n} /* parser_line_info_generate */\n\n#endif /* JERRY_LINE_INFO */\n\n#endif /* JERRY_PARSER */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser-mem.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"js-parser-internal.h\"\n\n#if JERRY_PARSER\n\n/** \\addtogroup mem Memory allocation\n * @{\n *\n * \\addtogroup mem_parser Parser memory manager\n * @{\n */\n\n/**********************************************************************/\n/* Memory allocation                                                  */\n/**********************************************************************/\n\n/**\n * Allocate memory.\n *\n * @return allocated memory.\n */\nvoid *\nparser_malloc (parser_context_t *context_p, /**< context */\n               size_t size) /**< size of the memory block */\n{\n  void *result;\n\n  JERRY_ASSERT (size > 0);\n  result = jmem_heap_alloc_block_null_on_error (size);\n\n  if (result == NULL)\n  {\n    parser_raise_error (context_p, PARSER_ERR_OUT_OF_MEMORY);\n  }\n  return result;\n} /* parser_malloc */\n\n/**\n * Free memory allocated by parser_malloc.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nparser_free (void *ptr, /**< pointer to free */\n             size_t size) /**< size of the memory block */\n{\n  jmem_heap_free_block (ptr, size);\n} /* parser_free */\n\n/**\n * Allocate local memory for short term use.\n *\n * @return allocated memory.\n */\nvoid *\nparser_malloc_local (parser_context_t *context_p, /**< context */\n                     size_t size) /**< size of the memory */\n{\n  void *result;\n\n  JERRY_ASSERT (size > 0);\n  result = jmem_heap_alloc_block (size);\n  if (result == 0)\n  {\n    parser_raise_error (context_p, PARSER_ERR_OUT_OF_MEMORY);\n  }\n  return result;\n} /* parser_malloc_local */\n\n/**\n * Free memory allocated by parser_malloc_local.\n */\nvoid\nparser_free_local (void *ptr, /**< pointer to free */\n                   size_t size) /**< size of the memory */\n{\n  jmem_heap_free_block (ptr, size);\n} /* parser_free_local */\n\n/**\n * Free the dynamically allocated buffer stored in the context\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nparser_free_allocated_buffer (parser_context_t *context_p) /**< context */\n{\n  if (context_p->u.allocated_buffer_p != NULL)\n  {\n    parser_free_local (context_p->u.allocated_buffer_p, context_p->allocated_buffer_size);\n    context_p->u.allocated_buffer_p = NULL;\n  }\n} /* parser_free_allocated_buffer */\n\n/**********************************************************************/\n/* Parser data management functions                                   */\n/**********************************************************************/\n\n/**\n * Initialize parse data.\n */\nstatic void\nparser_data_init (parser_mem_data_t *data_p, /**< memory manager */\n                  uint32_t page_size) /**< size of each page */\n{\n  data_p->first_p = NULL;\n  data_p->last_p = NULL;\n  data_p->last_position = page_size;\n} /* parser_data_init */\n\n/**\n * Free parse data.\n */\nstatic void\nparser_data_free (parser_mem_data_t *data_p, /**< memory manager */\n                  uint32_t page_size) /**< size of each page */\n{\n  parser_mem_page_t *page_p = data_p->first_p;\n\n  while (page_p != NULL)\n  {\n    parser_mem_page_t *next_p = page_p->next_p;\n\n    parser_free (page_p, page_size);\n    page_p = next_p;\n  }\n} /* parser_data_free */\n\n/**********************************************************************/\n/* Parser byte stream management functions                            */\n/**********************************************************************/\n\n/**\n * Initialize byte stream.\n */\nvoid\nparser_cbc_stream_init (parser_mem_data_t *data_p) /**< memory manager */\n{\n  parser_data_init (data_p, PARSER_CBC_STREAM_PAGE_SIZE);\n} /* parser_cbc_stream_init */\n\n/**\n * Free byte stream.\n */\nvoid\nparser_cbc_stream_free (parser_mem_data_t *data_p) /**< memory manager */\n{\n  parser_data_free (data_p, sizeof (parser_mem_page_t *) + PARSER_CBC_STREAM_PAGE_SIZE);\n} /* parser_cbc_stream_free */\n\n/**\n * Appends a byte at the end of the byte stream.\n */\nvoid\nparser_cbc_stream_alloc_page (parser_context_t *context_p, /**< context */\n                              parser_mem_data_t *data_p) /**< memory manager */\n{\n  size_t size = sizeof (parser_mem_page_t *) + PARSER_CBC_STREAM_PAGE_SIZE;\n  parser_mem_page_t *page_p = (parser_mem_page_t *) parser_malloc (context_p, size);\n\n  page_p->next_p = NULL;\n  data_p->last_position = 0;\n\n  if (data_p->last_p != NULL)\n  {\n    data_p->last_p->next_p = page_p;\n  }\n  else\n  {\n    data_p->first_p = page_p;\n  }\n  data_p->last_p = page_p;\n} /* parser_cbc_stream_alloc_page */\n\n/**********************************************************************/\n/* Parser list management functions                                   */\n/**********************************************************************/\n\n/**\n * Initialize parser list.\n */\nvoid\nparser_list_init (parser_list_t *list_p, /**< parser list */\n                  uint32_t item_size, /**< size for each page */\n                  uint32_t item_count) /**< number of items on each page */\n{\n  /* Align to pointer size. */\n  item_size = (uint32_t) (((item_size) + sizeof (void *) - 1) & ~(sizeof (void *) - 1));\n  parser_data_init (&list_p->data, item_size * item_count);\n  list_p->page_size = item_size * item_count;\n  list_p->item_size = item_size;\n  list_p->item_count = item_count;\n} /* parser_list_init */\n\n/**\n * Free parser list.\n */\nvoid\nparser_list_free (parser_list_t *list_p) /**< parser list */\n{\n  parser_data_free (&list_p->data, (uint32_t) (sizeof (parser_mem_page_t *) + list_p->page_size));\n} /* parser_list_free */\n\n/**\n * Reset parser list.\n */\nvoid\nparser_list_reset (parser_list_t *list_p) /**< parser list */\n{\n  parser_data_init (&list_p->data, list_p->page_size);\n} /* parser_list_reset */\n\n/**\n * Allocate space for the next item.\n *\n * @return pointer to the appended item.\n */\nvoid *\nparser_list_append (parser_context_t *context_p, /**< context */\n                    parser_list_t *list_p) /**< parser list */\n{\n  parser_mem_page_t *page_p = list_p->data.last_p;\n  void *result;\n\n  if (list_p->data.last_position + list_p->item_size > list_p->page_size)\n  {\n    size_t size = sizeof (parser_mem_page_t *) + list_p->page_size;\n\n    page_p = (parser_mem_page_t *) parser_malloc (context_p, size);\n\n    page_p->next_p = NULL;\n    list_p->data.last_position = 0;\n\n    if (list_p->data.last_p != NULL)\n    {\n      list_p->data.last_p->next_p = page_p;\n    }\n    else\n    {\n      list_p->data.first_p = page_p;\n    }\n    list_p->data.last_p = page_p;\n  }\n\n  result = page_p->bytes + list_p->data.last_position;\n  list_p->data.last_position += list_p->item_size;\n  return result;\n} /* parser_list_append */\n\n/**\n * Return the nth item of the list.\n *\n * @return pointer to the item.\n */\nvoid *\nparser_list_get (parser_list_t *list_p, /**< parser list */\n                 size_t index) /**< item index */\n{\n  size_t item_count = list_p->item_count;\n  parser_mem_page_t *page_p = list_p->data.first_p;\n\n  while (index >= item_count)\n  {\n    JERRY_ASSERT (page_p != NULL);\n    page_p = page_p->next_p;\n    index -= item_count;\n  }\n\n  JERRY_ASSERT (page_p != NULL);\n  JERRY_ASSERT (page_p != list_p->data.last_p || (index * list_p->item_size < list_p->data.last_position));\n  return page_p->bytes + (index * list_p->item_size);\n} /* parser_list_get */\n\n/**\n * Initialize a parser list iterator.\n */\nvoid\nparser_list_iterator_init (parser_list_t *list_p, /**< parser list */\n                           parser_list_iterator_t *iterator_p) /**< iterator */\n{\n  iterator_p->list_p = list_p;\n  iterator_p->current_p = list_p->data.first_p;\n  iterator_p->current_position = 0;\n} /* parser_list_iterator_init */\n\n/**\n * Next iterator step.\n *\n * @return the address of the current item, or NULL at the end.\n */\nvoid *\nparser_list_iterator_next (parser_list_iterator_t *iterator_p) /**< iterator */\n{\n  void *result;\n\n  if (iterator_p->current_p == NULL)\n  {\n    return NULL;\n  }\n\n  result = iterator_p->current_p->bytes + iterator_p->current_position;\n  iterator_p->current_position += iterator_p->list_p->item_size;\n\n  if (iterator_p->current_p->next_p == NULL)\n  {\n    if (iterator_p->current_position >= iterator_p->list_p->data.last_position)\n    {\n      iterator_p->current_p = NULL;\n      iterator_p->current_position = 0;\n    }\n  }\n  else if (iterator_p->current_position >= iterator_p->list_p->page_size)\n  {\n    iterator_p->current_p = iterator_p->current_p->next_p;\n    iterator_p->current_position = 0;\n  }\n  return result;\n} /* parser_list_iterator_next */\n\n/**********************************************************************/\n/* Parser stack management functions                                  */\n/**********************************************************************/\n\n/* Stack is a reversed storage. */\n\n/**\n * Initialize parser stack.\n */\nvoid\nparser_stack_init (parser_context_t *context_p) /**< context */\n{\n  parser_data_init (&context_p->stack, PARSER_STACK_PAGE_SIZE);\n  context_p->free_page_p = NULL;\n} /* parser_stack_init */\n\n/**\n * Free parser stack.\n */\nvoid\nparser_stack_free (parser_context_t *context_p) /**< context */\n{\n  parser_data_free (&context_p->stack, sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);\n\n  if (context_p->free_page_p != NULL)\n  {\n    parser_free (context_p->free_page_p, sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);\n  }\n} /* parser_stack_free */\n\n/**\n * Pushes an uint8_t value onto the stack.\n */\nvoid\nparser_stack_push_uint8 (parser_context_t *context_p, /**< context */\n                         uint8_t uint8_value) /**< value pushed onto the stack */\n{\n  parser_mem_page_t *page_p = context_p->stack.first_p;\n\n  /* This assert might trigger false positive valgrind errors, when\n   * parser_stack_push() pushes not fully initialized structures.\n   * More precisely when the last byte of the structure is uninitialized. */\n  JERRY_ASSERT (page_p == NULL || context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);\n\n  if (context_p->stack.last_position >= PARSER_STACK_PAGE_SIZE)\n  {\n    if (context_p->free_page_p != NULL)\n    {\n      page_p = context_p->free_page_p;\n      context_p->free_page_p = NULL;\n    }\n    else\n    {\n      size_t size = sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE;\n      page_p = (parser_mem_page_t *) parser_malloc (context_p, size);\n    }\n\n    page_p->next_p = context_p->stack.first_p;\n    context_p->stack.last_position = 0;\n    context_p->stack.first_p = page_p;\n  }\n\n  page_p->bytes[context_p->stack.last_position++] = uint8_value;\n  context_p->stack_top_uint8 = uint8_value;\n} /* parser_stack_push_uint8 */\n\n/**\n * Pops the last uint8_t value from the stack.\n */\nvoid\nparser_stack_pop_uint8 (parser_context_t *context_p) /**< context */\n{\n  parser_mem_page_t *page_p = context_p->stack.first_p;\n\n  JERRY_ASSERT (page_p != NULL && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);\n\n  context_p->stack.last_position--;\n\n  if (context_p->stack.last_position == 0)\n  {\n    context_p->stack.first_p = page_p->next_p;\n    context_p->stack.last_position = PARSER_STACK_PAGE_SIZE;\n\n    if (context_p->free_page_p == NULL)\n    {\n      context_p->free_page_p = page_p;\n    }\n    else\n    {\n      parser_free (page_p, sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);\n    }\n\n    page_p = context_p->stack.first_p;\n\n    JERRY_ASSERT (page_p != NULL);\n  }\n\n  context_p->stack_top_uint8 = page_p->bytes[context_p->stack.last_position - 1];\n} /* parser_stack_pop_uint8 */\n\n/**\n * Change last byte of the stack.\n */\nvoid\nparser_stack_change_last_uint8 (parser_context_t *context_p, /**< context */\n                                uint8_t new_value) /**< new value */\n{\n  parser_mem_page_t *page_p = context_p->stack.first_p;\n\n  JERRY_ASSERT (page_p != NULL && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);\n\n  page_p->bytes[context_p->stack.last_position - 1] = new_value;\n  context_p->stack_top_uint8 = new_value;\n} /* parser_stack_change_last_uint8 */\n\n/**\n * Get the uint8 value before the top of the stack.\n *\n * Pointer to the uint8 value\n */\nuint8_t *\nparser_stack_get_prev_uint8 (parser_context_t *context_p) /**< context */\n{\n  parser_mem_page_t *page_p = context_p->stack.first_p;\n\n  JERRY_ASSERT (page_p != NULL && (context_p->stack.last_position >= 2 || page_p->next_p != NULL));\n\n  if (context_p->stack.last_position >= 2)\n  {\n    return page_p->bytes + (context_p->stack.last_position - 2);\n  }\n\n  return page_p->next_p->bytes + (PARSER_STACK_PAGE_SIZE - 1);\n} /* parser_stack_get_prev_uint8 */\n\n/**\n * Pushes an uint16_t value onto the stack.\n */\nvoid\nparser_stack_push_uint16 (parser_context_t *context_p, /**< context */\n                          uint16_t uint16_value) /**< value pushed onto the stack */\n{\n  if (context_p->stack.last_position + 2 <= PARSER_STACK_PAGE_SIZE)\n  {\n    parser_mem_page_t *page_p = context_p->stack.first_p;\n\n    JERRY_ASSERT (page_p != NULL && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);\n\n    page_p->bytes[context_p->stack.last_position++] = (uint8_t) (uint16_value >> 8);\n    page_p->bytes[context_p->stack.last_position++] = (uint8_t) uint16_value;\n    context_p->stack_top_uint8 = (uint8_t) uint16_value;\n  }\n  else\n  {\n    parser_stack_push_uint8 (context_p, (uint8_t) (uint16_value >> 8));\n    parser_stack_push_uint8 (context_p, (uint8_t) uint16_value);\n  }\n} /* parser_stack_push_uint16 */\n\n/**\n * Pops the last uint16_t value from the stack.\n *\n * @return the value popped from the stack.\n */\nuint16_t\nparser_stack_pop_uint16 (parser_context_t *context_p) /**< context */\n{\n  uint32_t value = context_p->stack_top_uint8;\n\n  if (context_p->stack.last_position >= 3)\n  {\n    parser_mem_page_t *page_p = context_p->stack.first_p;\n\n    JERRY_ASSERT (page_p != NULL && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);\n\n    value |= ((uint32_t) page_p->bytes[context_p->stack.last_position - 2]) << 8;\n    context_p->stack_top_uint8 = page_p->bytes[context_p->stack.last_position - 3];\n    context_p->stack.last_position -= 2;\n  }\n  else\n  {\n    parser_stack_pop_uint8 (context_p);\n    value |= ((uint32_t) context_p->stack_top_uint8) << 8;\n    parser_stack_pop_uint8 (context_p);\n  }\n  return (uint16_t) value;\n} /* parser_stack_pop_uint16 */\n\n/**\n * Pushes a data onto the stack.\n */\nvoid\nparser_stack_push (parser_context_t *context_p, /**< context */\n                   const void *data_p, /**< data pushed onto the stack */\n                   uint32_t length) /**< length of the data */\n{\n  uint32_t fragment_length = PARSER_STACK_PAGE_SIZE - context_p->stack.last_position;\n  const uint8_t *bytes_p = (const uint8_t *) data_p;\n  parser_mem_page_t *page_p;\n\n  JERRY_ASSERT (length < PARSER_STACK_PAGE_SIZE && length > 0);\n\n  context_p->stack_top_uint8 = bytes_p[length - 1];\n\n  if (fragment_length > 0)\n  {\n    /* Fill the remaining bytes. */\n    if (fragment_length > length)\n    {\n      fragment_length = length;\n    }\n\n    memcpy (context_p->stack.first_p->bytes + context_p->stack.last_position, bytes_p, fragment_length);\n\n    if (fragment_length == length)\n    {\n      context_p->stack.last_position += length;\n      return;\n    }\n\n    bytes_p += fragment_length;\n    length -= fragment_length;\n  }\n\n  if (context_p->free_page_p != NULL)\n  {\n    page_p = context_p->free_page_p;\n    context_p->free_page_p = NULL;\n  }\n  else\n  {\n    size_t size = sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE;\n\n    page_p = (parser_mem_page_t *) parser_malloc (context_p, size);\n  }\n\n  page_p->next_p = context_p->stack.first_p;\n\n  context_p->stack.first_p = page_p;\n\n  memcpy (page_p->bytes, bytes_p, length);\n  context_p->stack.last_position = length;\n} /* parser_stack_push */\n\n/**\n * Pop bytes from the top of the stack.\n */\nvoid\nparser_stack_pop (parser_context_t *context_p, /**< context */\n                  void *data_p, /**< destination buffer, can be NULL */\n                  uint32_t length) /**< length of the data */\n{\n  uint8_t *bytes_p = (uint8_t *) data_p;\n  parser_mem_page_t *page_p = context_p->stack.first_p;\n\n  JERRY_ASSERT (length < PARSER_STACK_PAGE_SIZE && length > 0);\n\n  if (context_p->stack.last_position > length)\n  {\n    context_p->stack.last_position -= length;\n    context_p->stack_top_uint8 = page_p->bytes[context_p->stack.last_position - 1];\n\n    if (bytes_p != NULL)\n    {\n      memcpy (bytes_p, context_p->stack.first_p->bytes + context_p->stack.last_position, length);\n    }\n    return;\n  }\n\n  JERRY_ASSERT (page_p->next_p != NULL);\n\n  length -= context_p->stack.last_position;\n\n  if (bytes_p != NULL)\n  {\n    memcpy (bytes_p + length, page_p->bytes, context_p->stack.last_position);\n  }\n\n  context_p->stack.first_p = page_p->next_p;\n  context_p->stack.last_position = PARSER_STACK_PAGE_SIZE - length;\n  context_p->stack_top_uint8 = page_p->next_p->bytes[context_p->stack.last_position - 1];\n\n  if (bytes_p != NULL && length > 0)\n  {\n    memcpy (bytes_p, page_p->next_p->bytes + context_p->stack.last_position, length);\n  }\n\n  JERRY_ASSERT (context_p->stack.last_position > 0);\n\n  if (context_p->free_page_p == NULL)\n  {\n    context_p->free_page_p = page_p;\n  }\n  else\n  {\n    parser_free (page_p, sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);\n  }\n} /* parser_stack_pop */\n\n/**\n * Initialize stack iterator.\n */\nextern inline void\nparser_stack_iterator_init (parser_context_t *context_p, /**< context */\n                            parser_stack_iterator_t *iterator) /**< iterator */\n{\n  iterator->current_p = context_p->stack.first_p;\n  iterator->current_position = context_p->stack.last_position;\n} /* parser_stack_iterator_init */\n\n/**\n * Read the next byte from the stack.\n *\n * @return byte\n */\nextern inline uint8_t\nparser_stack_iterator_read_uint8 (parser_stack_iterator_t *iterator) /**< iterator */\n{\n  JERRY_ASSERT (iterator->current_position > 0 && iterator->current_position <= PARSER_STACK_PAGE_SIZE);\n  return iterator->current_p->bytes[iterator->current_position - 1];\n} /* parser_stack_iterator_read_uint8 */\n\n/**\n * Skip the next n bytes of the stack.\n */\nvoid\nparser_stack_iterator_skip (parser_stack_iterator_t *iterator, /**< iterator */\n                            size_t length) /**< number of skipped bytes */\n{\n  JERRY_ASSERT (length < PARSER_STACK_PAGE_SIZE && length > 0);\n\n  if (length < iterator->current_position)\n  {\n    iterator->current_position -= length;\n  }\n  else\n  {\n    iterator->current_position = PARSER_STACK_PAGE_SIZE - (length - iterator->current_position);\n    iterator->current_p = iterator->current_p->next_p;\n  }\n} /* parser_stack_iterator_skip */\n\n/**\n * Read bytes from the stack.\n */\nvoid\nparser_stack_iterator_read (parser_stack_iterator_t *iterator, /**< iterator */\n                            void *data_p, /**< destination buffer */\n                            size_t length) /**< length of the data */\n{\n  uint8_t *bytes_p = (uint8_t *) data_p;\n\n  JERRY_ASSERT (length < PARSER_STACK_PAGE_SIZE && length > 0);\n\n  if (length <= iterator->current_position)\n  {\n    memcpy (bytes_p, iterator->current_p->bytes + iterator->current_position - length, length);\n  }\n  else\n  {\n    JERRY_ASSERT (iterator->current_p->next_p != NULL);\n\n    length -= iterator->current_position;\n    memcpy (bytes_p + length, iterator->current_p->bytes, iterator->current_position);\n    memcpy (bytes_p, iterator->current_p->next_p->bytes + PARSER_STACK_PAGE_SIZE - length, length);\n  }\n} /* parser_stack_iterator_read */\n\n/**\n * Write bytes onto the stack.\n */\nvoid\nparser_stack_iterator_write (parser_stack_iterator_t *iterator, /**< iterator */\n                             const void *data_p, /**< destination buffer */\n                             size_t length) /**< length of the data */\n{\n  const uint8_t *bytes_p = (const uint8_t *) data_p;\n\n  JERRY_ASSERT (length < PARSER_STACK_PAGE_SIZE && length > 0);\n\n  if (length <= iterator->current_position)\n  {\n    memcpy (iterator->current_p->bytes + iterator->current_position - length, bytes_p, length);\n  }\n  else\n  {\n    JERRY_ASSERT (iterator->current_p->next_p != NULL);\n\n    length -= iterator->current_position;\n    memcpy (iterator->current_p->bytes, bytes_p + length, iterator->current_position);\n    memcpy (iterator->current_p->next_p->bytes + PARSER_STACK_PAGE_SIZE - length, bytes_p, length);\n  }\n} /* parser_stack_iterator_write */\n\n/**\n * @}\n * @}\n */\n\n#endif /* JERRY_PARSER */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser-module.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"js-parser-internal.h\"\n\n#if JERRY_MODULE_SYSTEM\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-module.h\"\n\n#include \"jcontext.h\"\n\n/**\n * Description of \"*default*\" literal string.\n */\nconst lexer_lit_location_t lexer_default_literal = { (const uint8_t *) \"*default*\",\n                                                     9,\n                                                     LEXER_IDENT_LITERAL,\n                                                     LEXER_LIT_LOCATION_IS_ASCII };\n\n/**\n * Check for duplicated imported binding names.\n *\n * @return true - if the given name is a duplicate\n *         false - otherwise\n */\nbool\nparser_module_check_duplicate_import (parser_context_t *context_p, /**< parser context */\n                                      ecma_string_t *local_name_p) /**< newly imported name */\n{\n  ecma_module_names_t *module_names_p = context_p->module_names_p;\n\n  while (module_names_p != NULL)\n  {\n    if (ecma_compare_ecma_strings (module_names_p->local_name_p, local_name_p))\n    {\n      return true;\n    }\n\n    module_names_p = module_names_p->next_p;\n  }\n\n  ecma_module_node_t *module_node_p = JERRY_CONTEXT (module_current_p)->imports_p;\n\n  while (module_node_p != NULL)\n  {\n    module_names_p = module_node_p->module_names_p;\n\n    while (module_names_p != NULL)\n    {\n      if (ecma_compare_ecma_strings (module_names_p->local_name_p, local_name_p))\n      {\n        return true;\n      }\n\n      module_names_p = module_names_p->next_p;\n    }\n\n    module_node_p = module_node_p->next_p;\n  }\n\n  return false;\n} /* parser_module_check_duplicate_import */\n\n/**\n * Append an identifier to the exported bindings.\n */\nvoid\nparser_module_append_export_name (parser_context_t *context_p) /**< parser context */\n{\n  if (!(context_p->status_flags & PARSER_MODULE_STORE_IDENT))\n  {\n    return;\n  }\n\n  context_p->module_identifier_lit_p = context_p->lit_object.literal_p;\n  ecma_string_t *name_p = parser_new_ecma_string_from_literal (context_p->lit_object.literal_p);\n\n  if (parser_module_check_duplicate_export (context_p, name_p))\n  {\n    ecma_deref_ecma_string (name_p);\n    parser_raise_error (context_p, PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER);\n  }\n\n  parser_module_add_names_to_node (context_p, name_p, name_p);\n  ecma_deref_ecma_string (name_p);\n} /* parser_module_append_export_name */\n\n/**\n * Check for duplicated exported bindings.\n * @return - true - if the exported name is a duplicate\n *           false - otherwise\n */\nbool\nparser_module_check_duplicate_export (parser_context_t *context_p, /**< parser context */\n                                      ecma_string_t *export_name_p) /**< exported identifier */\n{\n  /* We have to check in the currently constructed node, as well as all of the already added nodes. */\n  ecma_module_names_t *current_names_p = context_p->module_names_p;\n\n  while (current_names_p != NULL)\n  {\n    if (ecma_compare_ecma_strings (current_names_p->imex_name_p, export_name_p))\n    {\n      return true;\n    }\n    current_names_p = current_names_p->next_p;\n  }\n\n  ecma_module_names_t *name_p = JERRY_CONTEXT (module_current_p)->local_exports_p;\n\n  while (name_p != NULL)\n  {\n    if (ecma_compare_ecma_strings (name_p->imex_name_p, export_name_p))\n    {\n      return true;\n    }\n\n    name_p = name_p->next_p;\n  }\n\n  ecma_module_node_t *export_node_p = JERRY_CONTEXT (module_current_p)->indirect_exports_p;\n\n  while (export_node_p != NULL)\n  {\n    name_p = export_node_p->module_names_p;\n\n    while (name_p != NULL)\n    {\n      if (ecma_compare_ecma_strings (name_p->imex_name_p, export_name_p))\n      {\n        return true;\n      }\n\n      name_p = name_p->next_p;\n    }\n\n    export_node_p = export_node_p->next_p;\n  }\n\n  /* Star exports don't have any names associated with them, so no need to check those. */\n  return false;\n} /* parser_module_check_duplicate_export */\n\n/**\n * Add module names to current module node.\n */\nvoid\nparser_module_add_names_to_node (parser_context_t *context_p, /**< parser context */\n                                 ecma_string_t *imex_name_p, /**< import/export name */\n                                 ecma_string_t *local_name_p) /**< local name */\n{\n  ecma_module_names_t *new_name_p = (ecma_module_names_t *) parser_malloc (context_p, sizeof (ecma_module_names_t));\n\n  new_name_p->next_p = context_p->module_names_p;\n  context_p->module_names_p = new_name_p;\n\n  JERRY_ASSERT (imex_name_p != NULL);\n  ecma_ref_ecma_string (imex_name_p);\n  new_name_p->imex_name_p = imex_name_p;\n\n  JERRY_ASSERT (local_name_p != NULL);\n  ecma_ref_ecma_string (local_name_p);\n  new_name_p->local_name_p = local_name_p;\n} /* parser_module_add_names_to_node */\n\n/**\n * Parse an ExportClause.\n */\nvoid\nparser_module_parse_export_clause (parser_context_t *context_p) /**< parser context */\n{\n  bool has_module_specifier = false;\n\n  if (context_p->source_p == context_p->next_scanner_info_p->source_p)\n  {\n    has_module_specifier = true;\n    JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_EXPORT_MODULE_SPECIFIER);\n    scanner_release_next (context_p, sizeof (scanner_info_t));\n  }\n\n  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_BRACE);\n  lexer_next_token (context_p);\n\n  while (true)\n  {\n    if (context_p->token.type == LEXER_RIGHT_BRACE)\n    {\n      lexer_next_token (context_p);\n      break;\n    }\n\n    /* 15.2.3.1 The referenced binding cannot be a reserved word. */\n    if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL\n        || context_p->token.keyword_type >= LEXER_FIRST_FUTURE_STRICT_RESERVED_WORD)\n    {\n      parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n    }\n\n    ecma_string_t *export_name_p = NULL;\n    ecma_string_t *local_name_p = NULL;\n\n    lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_NEW_IDENT_LITERAL);\n\n    if (!has_module_specifier && !scanner_literal_exists (context_p, context_p->lit_object.index))\n    {\n      parser_raise_error (context_p, PARSER_ERR_EXPORT_NOT_DEFINED);\n    }\n\n    uint16_t local_name_index = context_p->lit_object.index;\n    uint16_t export_name_index = PARSER_MAXIMUM_NUMBER_OF_LITERALS;\n\n    lexer_next_token (context_p);\n    if (lexer_token_is_identifier (context_p, \"as\", 2))\n    {\n      lexer_next_token (context_p);\n\n      if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n      {\n        parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n      }\n\n      lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_NEW_IDENT_LITERAL);\n\n      export_name_index = context_p->lit_object.index;\n\n      lexer_next_token (context_p);\n    }\n\n    local_name_p = parser_new_ecma_string_from_literal (PARSER_GET_LITERAL (local_name_index));\n\n    if (export_name_index != PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n    {\n      export_name_p = parser_new_ecma_string_from_literal (PARSER_GET_LITERAL (export_name_index));\n    }\n    else\n    {\n      export_name_p = local_name_p;\n      ecma_ref_ecma_string (local_name_p);\n    }\n\n    if (parser_module_check_duplicate_export (context_p, export_name_p))\n    {\n      ecma_deref_ecma_string (local_name_p);\n      ecma_deref_ecma_string (export_name_p);\n      parser_raise_error (context_p, PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER);\n    }\n\n    parser_module_add_names_to_node (context_p, export_name_p, local_name_p);\n    ecma_deref_ecma_string (local_name_p);\n    ecma_deref_ecma_string (export_name_p);\n\n    if (context_p->token.type != LEXER_COMMA && context_p->token.type != LEXER_RIGHT_BRACE)\n    {\n      parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_COMMA_EXPECTED);\n    }\n    else if (context_p->token.type == LEXER_COMMA)\n    {\n      lexer_next_token (context_p);\n    }\n\n    if (lexer_token_is_identifier (context_p, \"from\", 4))\n    {\n      parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_EXPECTED);\n    }\n  }\n} /* parser_module_parse_export_clause */\n\n/**\n * Parse an ImportClause\n */\nvoid\nparser_module_parse_import_clause (parser_context_t *context_p) /**< parser context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_BRACE);\n  lexer_next_token (context_p);\n\n  while (true)\n  {\n    if (context_p->token.type == LEXER_RIGHT_BRACE)\n    {\n      lexer_next_token (context_p);\n      break;\n    }\n\n    if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n    {\n      parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n    }\n\n    if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n    {\n      JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED);\n      parser_raise_error (context_p, PARSER_ERR_VARIABLE_REDECLARED);\n    }\n\n    ecma_string_t *import_name_p = NULL;\n    ecma_string_t *local_name_p = NULL;\n\n    lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_NEW_IDENT_LITERAL);\n\n    uint16_t import_name_index = context_p->lit_object.index;\n    uint16_t local_name_index = PARSER_MAXIMUM_NUMBER_OF_LITERALS;\n\n    lexer_next_token (context_p);\n    if (lexer_token_is_identifier (context_p, \"as\", 2))\n    {\n      lexer_next_token (context_p);\n\n      if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n      {\n        parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n      }\n\n      if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n      {\n        JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED);\n        parser_raise_error (context_p, PARSER_ERR_VARIABLE_REDECLARED);\n      }\n\n      lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_NEW_IDENT_LITERAL);\n\n      local_name_index = context_p->lit_object.index;\n\n      lexer_next_token (context_p);\n    }\n\n    import_name_p = parser_new_ecma_string_from_literal (PARSER_GET_LITERAL (import_name_index));\n\n    if (local_name_index != PARSER_MAXIMUM_NUMBER_OF_LITERALS)\n    {\n      local_name_p = parser_new_ecma_string_from_literal (PARSER_GET_LITERAL (local_name_index));\n    }\n    else\n    {\n      local_name_p = import_name_p;\n      ecma_ref_ecma_string (local_name_p);\n    }\n\n    if (parser_module_check_duplicate_import (context_p, local_name_p))\n    {\n      ecma_deref_ecma_string (local_name_p);\n      ecma_deref_ecma_string (import_name_p);\n      parser_raise_error (context_p, PARSER_ERR_DUPLICATED_IMPORT_BINDING);\n    }\n\n    parser_module_add_names_to_node (context_p, import_name_p, local_name_p);\n    ecma_deref_ecma_string (local_name_p);\n    ecma_deref_ecma_string (import_name_p);\n\n    if (context_p->token.type != LEXER_COMMA && (context_p->token.type != LEXER_RIGHT_BRACE))\n    {\n      parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_COMMA_EXPECTED);\n    }\n    else if (context_p->token.type == LEXER_COMMA)\n    {\n      lexer_next_token (context_p);\n    }\n\n    if (lexer_token_is_identifier (context_p, \"from\", 4))\n    {\n      parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_EXPECTED);\n    }\n  }\n} /* parser_module_parse_import_clause */\n\n/**\n * Raises parser error if the import or export statement is not in the global scope.\n */\nvoid\nparser_module_check_request_place (parser_context_t *context_p) /**< parser context */\n{\n  if (context_p->last_context_p != NULL || context_p->stack_top_uint8 != 0\n      || (context_p->status_flags & PARSER_IS_FUNCTION) || (context_p->global_status_flags & ECMA_PARSE_EVAL)\n      || (context_p->global_status_flags & ECMA_PARSE_MODULE) == 0)\n  {\n    parser_raise_error (context_p, PARSER_ERR_MODULE_UNEXPECTED);\n  }\n} /* parser_module_check_request_place */\n\n/**\n * Append names to the names list.\n */\nvoid\nparser_module_append_names (parser_context_t *context_p, /**< parser context */\n                            ecma_module_names_t **module_names_p) /**< target names */\n{\n  ecma_module_names_t *last_name_p = context_p->module_names_p;\n\n  if (last_name_p == NULL)\n  {\n    return;\n  }\n\n  if (*module_names_p != NULL)\n  {\n    while (last_name_p->next_p != NULL)\n    {\n      last_name_p = last_name_p->next_p;\n    }\n\n    last_name_p->next_p = *module_names_p;\n  }\n\n  *module_names_p = context_p->module_names_p;\n  context_p->module_names_p = NULL;\n} /* parser_module_append_names */\n\n/**\n * Handle module specifier at the end of the import / export statement.\n */\nvoid\nparser_module_handle_module_specifier (parser_context_t *context_p, /**< parser context */\n                                       ecma_module_node_t **node_list_p) /**< target node list */\n{\n  if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_STRING_LITERAL\n      || context_p->token.lit_location.length == 0)\n  {\n    parser_raise_error (context_p, PARSER_ERR_STRING_EXPECTED);\n  }\n\n  lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_STRING_LITERAL);\n\n  lexer_literal_t *path_p = context_p->lit_object.literal_p;\n\n  lexer_next_token (context_p);\n\n  /* The lexer_next_token may throw an error, so the path is constructed after its call. */\n  ecma_string_t *path_string_p = parser_new_ecma_string_from_literal (path_p);\n\n  ecma_module_node_t *node_p = JERRY_CONTEXT (module_current_p)->imports_p;\n  ecma_module_node_t *last_node_p = NULL;\n\n  /* Check if we have an import node with the same module request. */\n\n  while (node_p != NULL)\n  {\n    if (ecma_compare_ecma_strings (ecma_get_string_from_value (node_p->u.path_or_module), path_string_p))\n    {\n      ecma_deref_ecma_string (path_string_p);\n      break;\n    }\n\n    last_node_p = node_p;\n    node_p = node_p->next_p;\n  }\n\n  if (node_p == NULL)\n  {\n    node_p = (ecma_module_node_t *) jmem_heap_alloc_block_null_on_error (sizeof (ecma_module_node_t));\n\n    if (node_p == NULL)\n    {\n      ecma_deref_ecma_string (path_string_p);\n      parser_raise_error (context_p, PARSER_ERR_OUT_OF_MEMORY);\n    }\n\n    if (last_node_p == NULL)\n    {\n      JERRY_CONTEXT (module_current_p)->imports_p = node_p;\n    }\n    else\n    {\n      last_node_p->next_p = node_p;\n    }\n\n    node_p->next_p = NULL;\n    node_p->module_names_p = NULL;\n    node_p->u.path_or_module = ecma_make_string_value (path_string_p);\n  }\n\n  /* Append to imports. */\n  if (node_list_p == NULL)\n  {\n    parser_module_append_names (context_p, &node_p->module_names_p);\n    return;\n  }\n\n  ecma_value_t *module_object_p = &node_p->u.path_or_module;\n\n  node_p = *node_list_p;\n  last_node_p = NULL;\n\n  while (node_p != NULL)\n  {\n    if (node_p->u.module_object_p == module_object_p)\n    {\n      parser_module_append_names (context_p, &node_p->module_names_p);\n      return;\n    }\n\n    last_node_p = node_p;\n    node_p = node_p->next_p;\n  }\n\n  node_p = (ecma_module_node_t *) parser_malloc (context_p, sizeof (ecma_module_node_t));\n\n  if (last_node_p == NULL)\n  {\n    *node_list_p = node_p;\n  }\n  else\n  {\n    last_node_p->next_p = node_p;\n  }\n\n  node_p->next_p = NULL;\n  node_p->module_names_p = context_p->module_names_p;\n  node_p->u.module_object_p = module_object_p;\n\n  context_p->module_names_p = NULL;\n} /* parser_module_handle_module_specifier */\n\n#endif /* JERRY_MODULE_SYSTEM */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser-statm.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"js-parser-internal.h\"\n\n#if JERRY_PARSER\n#include \"ecma-helpers.h\"\n\n#include \"jcontext.h\"\n#include \"lit-char-helpers.h\"\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_stmt Statement parser\n * @{\n */\n\n/**\n * Parser statement types.\n *\n * When a new statement is added, the following\n * arrays must be updated as well:\n *  - statement_lengths[]\n *  - parser_statement_flags[]\n */\ntypedef enum\n{\n  PARSER_STATEMENT_START,\n  PARSER_STATEMENT_BLOCK,\n  PARSER_STATEMENT_BLOCK_SCOPE,\n  PARSER_STATEMENT_PRIVATE_SCOPE,\n  PARSER_STATEMENT_BLOCK_CONTEXT,\n  PARSER_STATEMENT_PRIVATE_CONTEXT,\n  PARSER_STATEMENT_LABEL,\n  PARSER_STATEMENT_IF,\n  PARSER_STATEMENT_ELSE,\n  PARSER_STATEMENT_SWITCH,\n  PARSER_STATEMENT_SWITCH_NO_DEFAULT,\n  PARSER_STATEMENT_DO_WHILE,\n  PARSER_STATEMENT_WHILE,\n  PARSER_STATEMENT_FOR,\n  PARSER_STATEMENT_FOR_IN,\n  PARSER_STATEMENT_FOR_OF,\n  PARSER_STATEMENT_FOR_AWAIT_OF,\n  PARSER_STATEMENT_WITH,\n  PARSER_STATEMENT_TRY,\n} parser_statement_type_t;\n\n/**\n * Parser statement type flags.\n */\ntypedef enum\n{\n  PARSER_STATM_NO_OPTS = 0, /**< no options */\n  PARSER_STATM_SINGLE_STATM = (1 << 0), /**< statment can form single statement context */\n  PARSER_STATM_HAS_BLOCK = (1 << 1), /**< statement always has a code block */\n  PARSER_STATM_BREAK_TARGET = (1 << 2), /**< break target statement */\n  PARSER_STATM_CONTINUE_TARGET = (1 << 3), /**< continue target statement */\n  PARSER_STATM_CONTEXT_BREAK = (1 << 4), /**< uses another instruction form when crosses their borders */\n} parser_statement_flags_t;\n\n/**\n * Parser statement attributes.\n * Note: the order of the attributes must be keep in sync with parser_statement_type_t\n */\nstatic const uint8_t parser_statement_flags[] = {\n  /* PARSER_STATEMENT_START */\n  PARSER_STATM_HAS_BLOCK,\n  /* PARSER_STATEMENT_BLOCK, */\n  PARSER_STATM_HAS_BLOCK,\n  /* PARSER_STATEMENT_BLOCK_SCOPE, */\n  PARSER_STATM_HAS_BLOCK,\n  /* PARSER_STATEMENT_PRIVATE_SCOPE, */\n  PARSER_STATM_NO_OPTS,\n  /* PARSER_STATEMENT_BLOCK_CONTEXT, */\n  PARSER_STATM_HAS_BLOCK | PARSER_STATM_CONTEXT_BREAK,\n  /* PARSER_STATEMENT_PRIVATE_CONTEXT, */\n  PARSER_STATM_CONTEXT_BREAK,\n  /* PARSER_STATEMENT_LABEL */\n  PARSER_STATM_SINGLE_STATM,\n  /* PARSER_STATEMENT_IF */\n  PARSER_STATM_SINGLE_STATM,\n  /* PARSER_STATEMENT_ELSE */\n  PARSER_STATM_SINGLE_STATM,\n  /* PARSER_STATEMENT_SWITCH */\n  PARSER_STATM_HAS_BLOCK | PARSER_STATM_BREAK_TARGET,\n  /* PARSER_STATEMENT_SWITCH_NO_DEFAULT */\n  PARSER_STATM_HAS_BLOCK | PARSER_STATM_BREAK_TARGET,\n  /* PARSER_STATEMENT_DO_WHILE */\n  PARSER_STATM_BREAK_TARGET | PARSER_STATM_CONTINUE_TARGET | PARSER_STATM_SINGLE_STATM,\n  /* PARSER_STATEMENT_WHILE */\n  PARSER_STATM_BREAK_TARGET | PARSER_STATM_CONTINUE_TARGET | PARSER_STATM_SINGLE_STATM,\n  /* PARSER_STATEMENT_FOR */\n  PARSER_STATM_BREAK_TARGET | PARSER_STATM_CONTINUE_TARGET | PARSER_STATM_SINGLE_STATM,\n  /* PARSER_STATEMENT_FOR_IN */\n  PARSER_STATM_BREAK_TARGET | PARSER_STATM_CONTINUE_TARGET | PARSER_STATM_SINGLE_STATM | PARSER_STATM_CONTEXT_BREAK,\n  /* PARSER_STATEMENT_FOR_OF */\n  PARSER_STATM_BREAK_TARGET | PARSER_STATM_CONTINUE_TARGET | PARSER_STATM_SINGLE_STATM | PARSER_STATM_CONTEXT_BREAK,\n  /* PARSER_STATEMENT_FOR_AWAIT_OF */\n  PARSER_STATM_BREAK_TARGET | PARSER_STATM_CONTINUE_TARGET | PARSER_STATM_SINGLE_STATM | PARSER_STATM_CONTEXT_BREAK,\n  /* PARSER_STATEMENT_WITH */\n  PARSER_STATM_CONTEXT_BREAK | PARSER_STATM_SINGLE_STATM,\n  /* PARSER_STATEMENT_TRY */\n  PARSER_STATM_HAS_BLOCK | PARSER_STATM_CONTEXT_BREAK\n};\n\n/**\n * Block statement.\n */\ntypedef struct\n{\n  uint16_t scope_stack_top; /**< preserved top of scope stack */\n  uint16_t scope_stack_reg_top; /**< preserved top register of scope stack */\n} parser_block_statement_t;\n\n/**\n * Context of block statement.\n */\ntypedef struct\n{\n  parser_branch_t branch; /**< branch to the end */\n} parser_block_context_t;\n\n/**\n * Loop statement.\n */\ntypedef struct\n{\n  parser_branch_node_t *branch_list_p; /**< list of breaks and continues targeting this statement */\n} parser_loop_statement_t;\n\n/**\n * Label statement.\n */\ntypedef struct\n{\n  lexer_lit_location_t label_ident; /**< name of the label */\n  parser_branch_node_t *break_list_p; /**< list of breaks targeting this label */\n} parser_label_statement_t;\n\n/**\n * If/else statement.\n */\ntypedef struct\n{\n  parser_branch_t branch; /**< branch to the end */\n} parser_if_else_statement_t;\n\n/**\n * Switch statement.\n */\ntypedef struct\n{\n  parser_branch_t default_branch; /**< branch to the default case */\n  parser_branch_node_t *branch_list_p; /**< branches of case statements */\n} parser_switch_statement_t;\n\n/**\n * Do-while statement.\n */\ntypedef struct\n{\n  uint32_t start_offset; /**< start byte code offset */\n} parser_do_while_statement_t;\n\n/**\n * While statement.\n */\ntypedef struct\n{\n  parser_branch_t branch; /**< branch to the end */\n  scanner_location_t condition_location; /**< condition part */\n  uint32_t start_offset; /**< start byte code offset */\n} parser_while_statement_t;\n\n/**\n * For statement.\n */\ntypedef struct\n{\n  parser_branch_t branch; /**< branch to the end */\n  scanner_location_t condition_location; /**< condition part */\n  scanner_location_t expression_location; /**< expression part */\n  uint32_t start_offset; /**< start byte code offset */\n} parser_for_statement_t;\n\n/**\n * For-in statement.\n */\ntypedef struct\n{\n  parser_branch_t branch; /**< branch to the end */\n  uint32_t start_offset; /**< start byte code offset */\n} parser_for_in_of_statement_t;\n\n/**\n * With statement.\n */\ntypedef struct\n{\n  parser_branch_t branch; /**< branch to the end */\n} parser_with_statement_t;\n\n/**\n * Lexer token types.\n */\ntypedef enum\n{\n  parser_try_block, /**< try block */\n  parser_catch_block, /**< catch block */\n  parser_finally_block, /**< finally block */\n} parser_try_block_type_t;\n\n/**\n * Try statement.\n */\ntypedef struct\n{\n  parser_try_block_type_t type; /**< current block type */\n  uint16_t scope_stack_top; /**< current top of scope stack */\n  uint16_t scope_stack_reg_top; /**< current top register of scope stack */\n  parser_branch_t branch; /**< branch to the end of the current block */\n} parser_try_statement_t;\n\n/**\n * Returns the data consumed by a statement. It can be used\n * to skip undesired frames on the stack during frame search.\n *\n * @return size consumed by a statement.\n */\nstatic inline size_t\nparser_statement_length (uint8_t type) /**< type of statement */\n{\n  static const uint8_t statement_lengths[] = {\n    /* PARSER_STATEMENT_BLOCK */\n    1,\n    /* PARSER_STATEMENT_BLOCK_SCOPE */\n    (uint8_t) (sizeof (parser_block_statement_t) + 1),\n    /* PARSER_STATEMENT_PRIVATE_SCOPE */\n    (uint8_t) (sizeof (parser_block_statement_t) + 1),\n    /* PARSER_STATEMENT_BLOCK_CONTEXT */\n    (uint8_t) (sizeof (parser_block_statement_t) + sizeof (parser_block_context_t) + 1),\n    /* PARSER_STATEMENT_PRIVATE_CONTEXT */\n    (uint8_t) (sizeof (parser_block_statement_t) + sizeof (parser_block_context_t) + 1),\n    /* PARSER_STATEMENT_LABEL */\n    (uint8_t) (sizeof (parser_label_statement_t) + 1),\n    /* PARSER_STATEMENT_IF */\n    (uint8_t) (sizeof (parser_if_else_statement_t) + 1),\n    /* PARSER_STATEMENT_ELSE */\n    (uint8_t) (sizeof (parser_if_else_statement_t) + 1),\n    /* PARSER_STATEMENT_SWITCH */\n    (uint8_t) (sizeof (parser_switch_statement_t) + sizeof (parser_loop_statement_t) + 1),\n    /* PARSER_STATEMENT_SWITCH_NO_DEFAULT */\n    (uint8_t) (sizeof (parser_switch_statement_t) + sizeof (parser_loop_statement_t) + 1),\n    /* PARSER_STATEMENT_DO_WHILE */\n    (uint8_t) (sizeof (parser_do_while_statement_t) + sizeof (parser_loop_statement_t) + 1),\n    /* PARSER_STATEMENT_WHILE */\n    (uint8_t) (sizeof (parser_while_statement_t) + sizeof (parser_loop_statement_t) + 1),\n    /* PARSER_STATEMENT_FOR */\n    (uint8_t) (sizeof (parser_for_statement_t) + sizeof (parser_loop_statement_t) + 1),\n    /* PARSER_STATEMENT_FOR_IN */\n    (uint8_t) (sizeof (parser_for_in_of_statement_t) + sizeof (parser_loop_statement_t) + 1),\n    /* PARSER_STATEMENT_FOR_OF */\n    (uint8_t) (sizeof (parser_for_in_of_statement_t) + sizeof (parser_loop_statement_t) + 1),\n    /* PARSER_STATEMENT_FOR_AWAIT_OF */\n    (uint8_t) (sizeof (parser_for_in_of_statement_t) + sizeof (parser_loop_statement_t) + 1),\n    /* PARSER_STATEMENT_WITH */\n    (uint8_t) (sizeof (parser_with_statement_t) + 1 + 1),\n    /* PARSER_STATEMENT_TRY */\n    (uint8_t) (sizeof (parser_try_statement_t) + 1),\n  };\n\n  JERRY_ASSERT (type >= PARSER_STATEMENT_BLOCK && type <= PARSER_STATEMENT_TRY);\n\n  return statement_lengths[type - PARSER_STATEMENT_BLOCK];\n} /* parser_statement_length */\n/**\n * Parse expression enclosed in parens.\n */\nstatic inline void\nparser_parse_enclosed_expr (parser_context_t *context_p) /**< context */\n{\n  lexer_next_token (context_p);\n\n  if (context_p->token.type != LEXER_LEFT_PAREN)\n  {\n    parser_raise_error (context_p, PARSER_ERR_LEFT_PAREN_EXPECTED);\n  }\n\n  lexer_next_token (context_p);\n  parser_parse_expression (context_p, PARSE_EXPR);\n\n  if (context_p->token.type != LEXER_RIGHT_PAREN)\n  {\n    parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);\n  }\n  lexer_next_token (context_p);\n} /* parser_parse_enclosed_expr */\n\n/**\n * Create a block context.\n *\n * @return true - when a context is created, false - otherwise\n */\nstatic bool\nparser_push_block_context (parser_context_t *context_p, /**< context */\n                           bool is_private) /**< is private (bound to a statement) context */\n{\n  JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_BLOCK);\n\n  parser_block_statement_t block_statement;\n  block_statement.scope_stack_top = context_p->scope_stack_top;\n  block_statement.scope_stack_reg_top = context_p->scope_stack_reg_top;\n\n  bool is_context_needed = false;\n\n  if (scanner_is_context_needed (context_p, PARSER_CHECK_BLOCK_CONTEXT))\n  {\n    parser_block_context_t block_context;\n\n#ifndef JERRY_NDEBUG\n    PARSER_PLUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_BLOCK_CONTEXT_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n\n    parser_emit_cbc_forward_branch (context_p, CBC_BLOCK_CREATE_CONTEXT, &block_context.branch);\n    parser_stack_push (context_p, &block_context, sizeof (parser_block_context_t));\n    is_context_needed = true;\n  }\n\n  scanner_create_variables (context_p, SCANNER_CREATE_VARS_NO_OPTS);\n  parser_stack_push (context_p, &block_statement, sizeof (parser_block_statement_t));\n\n  uint8_t statement_type;\n\n  if (is_private)\n  {\n    statement_type = (is_context_needed ? PARSER_STATEMENT_PRIVATE_CONTEXT : PARSER_STATEMENT_PRIVATE_SCOPE);\n  }\n  else\n  {\n    statement_type = (is_context_needed ? PARSER_STATEMENT_BLOCK_CONTEXT : PARSER_STATEMENT_BLOCK_SCOPE);\n  }\n\n  parser_stack_push_uint8 (context_p, statement_type);\n\n  return is_context_needed;\n} /* parser_push_block_context */\n\n/**\n * Pop block context.\n */\nstatic void\nparser_pop_block_context (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->stack_top_uint8 == PARSER_STATEMENT_BLOCK_SCOPE\n                || context_p->stack_top_uint8 == PARSER_STATEMENT_PRIVATE_SCOPE\n                || context_p->stack_top_uint8 == PARSER_STATEMENT_BLOCK_CONTEXT\n                || context_p->stack_top_uint8 == PARSER_STATEMENT_PRIVATE_CONTEXT);\n\n  uint8_t type = context_p->stack_top_uint8;\n\n  parser_block_statement_t block_statement;\n\n  parser_stack_pop_uint8 (context_p);\n  parser_stack_pop (context_p, &block_statement, sizeof (parser_block_statement_t));\n\n  context_p->scope_stack_top = block_statement.scope_stack_top;\n  context_p->scope_stack_reg_top = block_statement.scope_stack_reg_top;\n\n  if (type == PARSER_STATEMENT_BLOCK_CONTEXT || type == PARSER_STATEMENT_PRIVATE_CONTEXT)\n  {\n    PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, PARSER_BLOCK_CONTEXT_STACK_ALLOCATION);\n#ifndef JERRY_NDEBUG\n    PARSER_MINUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_BLOCK_CONTEXT_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n\n    parser_block_context_t block_context;\n    parser_stack_pop (context_p, &block_context, sizeof (parser_block_context_t));\n\n    parser_emit_cbc (context_p, CBC_CONTEXT_END);\n    parser_set_branch_to_current_position (context_p, &block_context.branch);\n  }\n\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n} /* parser_pop_block_context */\n\n/**\n * Validate lexical context for a declaration.\n */\nstatic void\nparser_validate_lexical_context (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_KEYW_LET || context_p->token.type == LEXER_KEYW_CONST\n                || context_p->token.type == LEXER_KEYW_CLASS);\n\n  if (parser_statement_flags[context_p->stack_top_uint8] & PARSER_STATM_SINGLE_STATM)\n  {\n    parser_raise_error (context_p, PARSER_ERR_LEXICAL_SINGLE_STATEMENT);\n  }\n} /* parser_validate_lexical_context */\n\n/**\n * Parse var statement.\n */\nstatic void\nparser_parse_var_statement (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_KEYW_VAR || context_p->token.type == LEXER_KEYW_LET\n                || context_p->token.type == LEXER_KEYW_CONST);\n\n  uint8_t declaration_type = context_p->token.type;\n\n  if (declaration_type != LEXER_KEYW_VAR)\n  {\n    parser_validate_lexical_context (context_p);\n  }\n\n  while (true)\n  {\n    if (lexer_check_next_characters (context_p, LIT_CHAR_LEFT_SQUARE, LIT_CHAR_LEFT_BRACE))\n    {\n      parser_pattern_flags_t flags = PARSER_PATTERN_BINDING;\n\n      if (declaration_type == LEXER_KEYW_LET)\n      {\n        flags |= PARSER_PATTERN_LET;\n      }\n      else if (declaration_type == LEXER_KEYW_CONST)\n      {\n        flags |= PARSER_PATTERN_CONST;\n      }\n\n      parser_parse_initializer_by_next_char (context_p, flags);\n    }\n    else\n    {\n      lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL);\n      JERRY_ASSERT (context_p->token.type == LEXER_LITERAL\n                    && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n#if JERRY_DEBUGGER || JERRY_LINE_INFO\n      parser_line_counter_t ident_line_counter = context_p->token.line;\n#endif /* JERRY_DEBUGGER || JERRY_LINE_INFO */\n#if JERRY_LINE_INFO\n      parser_line_counter_t ident_column_counter = context_p->token.column;\n#endif /* JERRY_LINE_INFO */\n\n#if JERRY_MODULE_SYSTEM\n      parser_module_append_export_name (context_p);\n#endif /* JERRY_MODULE_SYSTEM */\n\n      if (declaration_type != LEXER_KEYW_VAR && context_p->token.keyword_type == LEXER_KEYW_LET)\n      {\n        parser_raise_error (context_p, PARSER_ERR_LEXICAL_LET_BINDING);\n      }\n\n      if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n      {\n        JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED);\n        parser_raise_error (context_p, PARSER_ERR_VARIABLE_REDECLARED);\n      }\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_ASSIGN)\n      {\n#if JERRY_DEBUGGER\n        if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n            && ident_line_counter != context_p->last_breakpoint_line)\n        {\n          parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);\n          parser_flush_cbc (context_p);\n\n          parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, ident_line_counter);\n\n          context_p->last_breakpoint_line = ident_line_counter;\n        }\n#endif /* JERRY_DEBUGGER */\n\n#if JERRY_LINE_INFO\n        parser_line_info_append (context_p, ident_line_counter, ident_column_counter);\n#endif /* JERRY_LINE_INFO */\n\n        uint16_t index = context_p->lit_object.index;\n\n        lexer_next_token (context_p);\n        parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n\n        cbc_opcode_t opcode = CBC_ASSIGN_SET_IDENT;\n\n        uint16_t function_literal_index = parser_check_anonymous_function_declaration (context_p);\n\n        if (function_literal_index == PARSER_ANONYMOUS_CLASS)\n        {\n          uint16_t name_index = scanner_save_literal (context_p, index);\n          parser_emit_cbc_ext_literal (context_p, CBC_EXT_SET_CLASS_NAME, name_index);\n        }\n        else if (function_literal_index < PARSER_NAMED_FUNCTION)\n        {\n          parser_set_function_name (context_p, function_literal_index, index, 0);\n        }\n\n        if (declaration_type != LEXER_KEYW_VAR && (index < PARSER_REGISTER_START))\n        {\n          opcode = CBC_INIT_LET;\n\n          if (scanner_literal_is_created (context_p, index))\n          {\n            opcode = CBC_ASSIGN_LET_CONST;\n          }\n          else if (declaration_type == LEXER_KEYW_CONST)\n          {\n            opcode = CBC_INIT_CONST;\n          }\n        }\n\n        parser_emit_cbc_literal (context_p, (uint16_t) opcode, index);\n      }\n      else if (declaration_type == LEXER_KEYW_LET)\n      {\n        parser_emit_cbc (context_p, CBC_PUSH_UNDEFINED);\n\n        uint16_t index = context_p->lit_object.index;\n        cbc_opcode_t opcode = CBC_MOV_IDENT;\n\n        if (index < PARSER_REGISTER_START)\n        {\n          opcode = (scanner_literal_is_created (context_p, index) ? CBC_ASSIGN_LET_CONST : CBC_INIT_LET);\n        }\n\n        parser_emit_cbc_literal (context_p, (uint16_t) opcode, index);\n      }\n      else if (declaration_type == LEXER_KEYW_CONST)\n      {\n        parser_raise_error (context_p, PARSER_ERR_MISSING_ASSIGN_AFTER_CONST);\n      }\n    }\n\n    if (context_p->token.type != LEXER_COMMA)\n    {\n      break;\n    }\n  }\n\n#if JERRY_MODULE_SYSTEM\n  context_p->status_flags &= (uint32_t) ~(PARSER_MODULE_STORE_IDENT);\n#endif /* JERRY_MODULE_SYSTEM */\n} /* parser_parse_var_statement */\n\n/**\n * Parse function statement.\n */\nstatic void\nparser_parse_function_statement (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_KEYW_FUNCTION);\n\n  bool is_single_statement = (parser_statement_flags[context_p->stack_top_uint8] & PARSER_STATM_SINGLE_STATM) != 0;\n\n  if (JERRY_UNLIKELY (is_single_statement))\n  {\n    if (context_p->status_flags & PARSER_IS_STRICT)\n    {\n      parser_raise_error (context_p, PARSER_ERR_LEXICAL_SINGLE_STATEMENT);\n    }\n\n    if (context_p->stack_top_uint8 == PARSER_STATEMENT_IF || context_p->stack_top_uint8 == PARSER_STATEMENT_ELSE)\n    {\n      /* There must be a parser error later if this check fails. */\n      if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n      {\n        parser_push_block_context (context_p, true);\n      }\n    }\n    else if (context_p->stack_top_uint8 == PARSER_STATEMENT_LABEL)\n    {\n      parser_stack_iterator_t iterator;\n      parser_stack_iterator_init (context_p, &iterator);\n      parser_stack_iterator_skip (&iterator, sizeof (parser_label_statement_t) + 1);\n\n      while (true)\n      {\n        uint8_t type = parser_stack_iterator_read_uint8 (&iterator);\n\n        if (type == PARSER_STATEMENT_LABEL)\n        {\n          parser_stack_iterator_skip (&iterator, sizeof (parser_label_statement_t) + 1);\n          continue;\n        }\n\n        if (parser_statement_flags[type] & PARSER_STATM_HAS_BLOCK)\n        {\n          break;\n        }\n\n        parser_raise_error (context_p, PARSER_ERR_LABELLED_FUNC_NOT_IN_BLOCK);\n      }\n    }\n    else\n    {\n      parser_raise_error (context_p, PARSER_ERR_LEXICAL_SINGLE_STATEMENT);\n    }\n  }\n#if JERRY_FUNCTION_TO_STRING\n  if (!(context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_ASYNC))\n  {\n    context_p->function_start_p = context_p->token.lit_location.char_p;\n  }\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n#if JERRY_DEBUGGER\n  parser_line_counter_t debugger_line = context_p->token.line;\n  parser_line_counter_t debugger_column = context_p->token.column;\n#endif /* JERRY_DEBUGGER */\n\n  bool is_generator_function = false;\n\n  if (lexer_consume_generator (context_p))\n  {\n    if (is_single_statement)\n    {\n      parser_raise_error (context_p, PARSER_ERR_GENERATOR_IN_SINGLE_STATEMENT_POS);\n    }\n    is_generator_function = true;\n  }\n\n  lexer_expect_identifier (context_p, LEXER_NEW_IDENT_LITERAL);\n  JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n  if (context_p->next_scanner_info_p->source_p == context_p->source_p\n      && context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED)\n  {\n    parser_raise_error (context_p, PARSER_ERR_VARIABLE_REDECLARED);\n  }\n\n  uint16_t function_name_index = context_p->lit_object.index;\n\n#if JERRY_MODULE_SYSTEM\n  parser_module_append_export_name (context_p);\n  context_p->status_flags &= (uint32_t) ~(PARSER_MODULE_STORE_IDENT);\n#endif /* JERRY_MODULE_SYSTEM */\n\n  uint32_t status_flags = PARSER_FUNCTION_CLOSURE;\n\n  if (context_p->token.keyword_type >= LEXER_FIRST_NON_STRICT_ARGUMENTS)\n  {\n    status_flags |= PARSER_HAS_NON_STRICT_ARG;\n  }\n\n  if (is_generator_function)\n  {\n    status_flags |= PARSER_IS_GENERATOR_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD;\n  }\n\n  if (context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_ASYNC)\n  {\n    status_flags |= PARSER_IS_ASYNC_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD;\n  }\n\n#if JERRY_DEBUGGER\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    lexer_literal_t *name_p = context_p->lit_object.literal_p;\n    jerry_debugger_send_string (JERRY_DEBUGGER_FUNCTION_NAME,\n                                JERRY_DEBUGGER_NO_SUBTYPE,\n                                name_p->u.char_p,\n                                name_p->prop.length);\n\n    /* Reset token position for the function. */\n    context_p->token.line = debugger_line;\n    context_p->token.column = debugger_column;\n  }\n#endif /* JERRY_DEBUGGER */\n\n  JERRY_ASSERT (context_p->scope_stack_top >= 2);\n  parser_scope_stack_t *scope_stack_p = context_p->scope_stack_p + context_p->scope_stack_top - 2;\n\n  uint16_t literal_index = context_p->lit_object.index;\n\n  while (literal_index != scope_stack_p->map_from)\n  {\n    scope_stack_p--;\n\n    JERRY_ASSERT (scope_stack_p >= context_p->scope_stack_p);\n  }\n\n  JERRY_ASSERT (scope_stack_p[1].map_from == PARSER_SCOPE_STACK_FUNC);\n\n  if (!(context_p->status_flags & PARSER_IS_STRICT)\n      && (scope_stack_p >= context_p->scope_stack_p + context_p->scope_stack_global_end))\n  {\n    bool copy_value = true;\n\n    parser_scope_stack_t *stack_p = context_p->scope_stack_p;\n\n    while (stack_p < scope_stack_p)\n    {\n      if (literal_index == stack_p->map_from && (stack_p->map_to & PARSER_SCOPE_STACK_NO_FUNCTION_COPY))\n      {\n        copy_value = false;\n        break;\n      }\n      stack_p++;\n    }\n\n    if (copy_value)\n    {\n      stack_p = context_p->scope_stack_p;\n\n      while (stack_p < scope_stack_p)\n      {\n        if (literal_index == stack_p->map_from)\n        {\n          JERRY_ASSERT (!(stack_p->map_to & PARSER_SCOPE_STACK_NO_FUNCTION_COPY));\n\n          uint16_t map_to = scanner_decode_map_to (stack_p);\n          uint16_t opcode = ((map_to >= PARSER_REGISTER_START) ? CBC_ASSIGN_LITERAL_SET_IDENT : CBC_COPY_TO_GLOBAL);\n\n          parser_emit_cbc_literal_value (context_p, opcode, scanner_decode_map_to (scope_stack_p), map_to);\n          break;\n        }\n        stack_p++;\n      }\n\n      parser_flush_cbc (context_p);\n    }\n\n    if (JERRY_UNLIKELY (context_p->stack_top_uint8 == PARSER_STATEMENT_PRIVATE_SCOPE\n                        || context_p->stack_top_uint8 == PARSER_STATEMENT_PRIVATE_CONTEXT))\n    {\n      parser_pop_block_context (context_p);\n    }\n  }\n\n  lexer_literal_t *literal_p = PARSER_GET_LITERAL ((size_t) scope_stack_p[1].map_to);\n\n  JERRY_ASSERT ((literal_p->type == LEXER_UNUSED_LITERAL || literal_p->type == LEXER_FUNCTION_LITERAL)\n                && literal_p->status_flags == 0);\n\n  ecma_compiled_code_t *compiled_code_p = parser_parse_function (context_p, status_flags);\n\n  if (literal_p->type == LEXER_FUNCTION_LITERAL)\n  {\n    ecma_bytecode_deref (literal_p->u.bytecode_p);\n  }\n\n  literal_p->u.bytecode_p = compiled_code_p;\n  literal_p->type = LEXER_FUNCTION_LITERAL;\n\n  parser_compiled_code_set_function_name (context_p, compiled_code_p, function_name_index, 0);\n  lexer_next_token (context_p);\n} /* parser_parse_function_statement */\n\n/**\n * Parse if statement (starting part).\n */\nstatic void\nparser_parse_if_statement_start (parser_context_t *context_p) /**< context */\n{\n  parser_if_else_statement_t if_statement;\n\n  parser_parse_enclosed_expr (context_p);\n\n  parser_emit_cbc_forward_branch (context_p, CBC_BRANCH_IF_FALSE_FORWARD, &if_statement.branch);\n\n  parser_stack_push (context_p, &if_statement, sizeof (parser_if_else_statement_t));\n  parser_stack_push_uint8 (context_p, PARSER_STATEMENT_IF);\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n} /* parser_parse_if_statement_start */\n\n/**\n * Parse if statement (ending part).\n *\n * @return true  - if parsing an 'else' statement\n *         false - otherwise\n */\nstatic bool\nparser_parse_if_statement_end (parser_context_t *context_p) /**< context */\n{\n  parser_if_else_statement_t if_statement;\n  parser_if_else_statement_t else_statement;\n  parser_stack_iterator_t iterator;\n\n  JERRY_ASSERT (context_p->stack_top_uint8 == PARSER_STATEMENT_IF);\n\n  if (context_p->token.type != LEXER_KEYW_ELSE)\n  {\n    parser_stack_pop_uint8 (context_p);\n    parser_stack_pop (context_p, &if_statement, sizeof (parser_if_else_statement_t));\n    parser_stack_iterator_init (context_p, &context_p->last_statement);\n\n    parser_set_branch_to_current_position (context_p, &if_statement.branch);\n\n    return false;\n  }\n\n  parser_stack_change_last_uint8 (context_p, PARSER_STATEMENT_ELSE);\n  parser_stack_iterator_init (context_p, &iterator);\n  parser_stack_iterator_skip (&iterator, 1);\n  parser_stack_iterator_read (&iterator, &if_statement, sizeof (parser_if_else_statement_t));\n\n  parser_emit_cbc_forward_branch (context_p, CBC_JUMP_FORWARD, &else_statement.branch);\n\n  parser_set_branch_to_current_position (context_p, &if_statement.branch);\n\n  parser_stack_iterator_write (&iterator, &else_statement, sizeof (parser_if_else_statement_t));\n\n  lexer_next_token (context_p);\n  return true;\n} /* parser_parse_if_statement_end */\n\n/**\n * Parse with statement (starting part).\n */\nstatic void\nparser_parse_with_statement_start (parser_context_t *context_p) /**< context */\n{\n  parser_with_statement_t with_statement;\n\n  if (context_p->status_flags & PARSER_IS_STRICT)\n  {\n    parser_raise_error (context_p, PARSER_ERR_WITH_NOT_ALLOWED);\n  }\n\n  parser_parse_enclosed_expr (context_p);\n\n#ifndef JERRY_NDEBUG\n  PARSER_PLUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_WITH_CONTEXT_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n\n  uint8_t inside_with = (context_p->status_flags & PARSER_INSIDE_WITH) != 0;\n\n  context_p->status_flags |= PARSER_INSIDE_WITH;\n  parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_WITH_CREATE_CONTEXT, &with_statement.branch);\n\n  parser_stack_push (context_p, &with_statement, sizeof (parser_with_statement_t));\n  parser_stack_push_uint8 (context_p, inside_with);\n  parser_stack_push_uint8 (context_p, PARSER_STATEMENT_WITH);\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n} /* parser_parse_with_statement_start */\n\n/**\n * Parse with statement (ending part).\n */\nstatic void\nparser_parse_with_statement_end (parser_context_t *context_p) /**< context */\n{\n  parser_with_statement_t with_statement;\n\n  JERRY_ASSERT (context_p->status_flags & PARSER_INSIDE_WITH);\n\n  parser_stack_pop_uint8 (context_p);\n\n  if (!context_p->stack_top_uint8)\n  {\n    context_p->status_flags &= (uint32_t) ~PARSER_INSIDE_WITH;\n  }\n\n  parser_stack_pop_uint8 (context_p);\n  parser_stack_pop (context_p, &with_statement, sizeof (parser_with_statement_t));\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n\n  parser_flush_cbc (context_p);\n  PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, PARSER_WITH_CONTEXT_STACK_ALLOCATION);\n#ifndef JERRY_NDEBUG\n  PARSER_MINUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_WITH_CONTEXT_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n\n  parser_emit_cbc (context_p, CBC_CONTEXT_END);\n  parser_set_branch_to_current_position (context_p, &with_statement.branch);\n} /* parser_parse_with_statement_end */\n\n/**\n * Parse do-while statement (ending part).\n */\nstatic void\nparser_parse_do_while_statement_end (parser_context_t *context_p) /**< context */\n{\n  parser_loop_statement_t loop;\n\n  JERRY_ASSERT (context_p->stack_top_uint8 == PARSER_STATEMENT_DO_WHILE);\n\n  if (context_p->token.type != LEXER_KEYW_WHILE)\n  {\n    parser_raise_error (context_p, PARSER_ERR_WHILE_EXPECTED);\n  }\n\n  parser_stack_iterator_t iterator;\n  parser_stack_iterator_init (context_p, &iterator);\n\n  parser_stack_iterator_skip (&iterator, 1);\n  parser_stack_iterator_read (&iterator, &loop, sizeof (parser_loop_statement_t));\n\n  parser_set_continues_to_current_position (context_p, loop.branch_list_p);\n\n  JERRY_ASSERT (context_p->next_scanner_info_p->source_p != context_p->source_p);\n\n  parser_parse_enclosed_expr (context_p);\n\n  if (context_p->last_cbc_opcode != CBC_PUSH_FALSE)\n  {\n    cbc_opcode_t opcode = CBC_BRANCH_IF_TRUE_BACKWARD;\n    if (context_p->last_cbc_opcode == CBC_LOGICAL_NOT)\n    {\n      context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n      opcode = CBC_BRANCH_IF_FALSE_BACKWARD;\n    }\n    else if (context_p->last_cbc_opcode == CBC_PUSH_TRUE)\n    {\n      context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n      opcode = CBC_JUMP_BACKWARD;\n    }\n\n    parser_do_while_statement_t do_while_statement;\n    parser_stack_iterator_skip (&iterator, sizeof (parser_loop_statement_t));\n    parser_stack_iterator_read (&iterator, &do_while_statement, sizeof (parser_do_while_statement_t));\n\n    parser_emit_cbc_backward_branch (context_p, (uint16_t) opcode, do_while_statement.start_offset);\n  }\n  else\n  {\n    context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n  }\n\n  parser_stack_pop (context_p, NULL, 1 + sizeof (parser_loop_statement_t) + sizeof (parser_do_while_statement_t));\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n\n  parser_set_breaks_to_current_position (context_p, loop.branch_list_p);\n} /* parser_parse_do_while_statement_end */\n\n/**\n * Parse while statement (starting part).\n */\nstatic void\nparser_parse_while_statement_start (parser_context_t *context_p) /**< context */\n{\n  parser_while_statement_t while_statement;\n  parser_loop_statement_t loop;\n\n  JERRY_ASSERT (context_p->token.type == LEXER_KEYW_WHILE);\n  lexer_next_token (context_p);\n\n  if (context_p->token.type != LEXER_LEFT_PAREN)\n  {\n    parser_raise_error (context_p, PARSER_ERR_LEFT_PAREN_EXPECTED);\n  }\n\n  JERRY_ASSERT (context_p->next_scanner_info_p->source_p != context_p->source_p\n                || context_p->next_scanner_info_p->type == SCANNER_TYPE_WHILE);\n\n  if (context_p->next_scanner_info_p->source_p != context_p->source_p)\n  {\n    /* The prescanner couldn't find the end of the while condition. */\n    lexer_next_token (context_p);\n    parser_parse_expression (context_p, PARSE_EXPR);\n\n    JERRY_ASSERT (context_p->token.type != LEXER_RIGHT_PAREN);\n    parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);\n  }\n\n  parser_emit_cbc_forward_branch (context_p, CBC_JUMP_FORWARD, &while_statement.branch);\n\n  JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);\n\n  while_statement.start_offset = context_p->byte_code_size;\n  scanner_get_location (&while_statement.condition_location, context_p);\n\n  scanner_set_location (context_p, &((scanner_location_info_t *) context_p->next_scanner_info_p)->location);\n  scanner_release_next (context_p, sizeof (scanner_location_info_t));\n  scanner_seek (context_p);\n  lexer_next_token (context_p);\n\n  loop.branch_list_p = NULL;\n\n  parser_stack_push (context_p, &while_statement, sizeof (parser_while_statement_t));\n  parser_stack_push (context_p, &loop, sizeof (parser_loop_statement_t));\n  parser_stack_push_uint8 (context_p, PARSER_STATEMENT_WHILE);\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n} /* parser_parse_while_statement_start */\n\n/**\n * Parse while statement (ending part).\n */\nstatic void JERRY_ATTR_NOINLINE\nparser_parse_while_statement_end (parser_context_t *context_p) /**< context */\n{\n  parser_while_statement_t while_statement;\n  parser_loop_statement_t loop;\n  lexer_token_t current_token;\n  scanner_location_t location;\n  cbc_opcode_t opcode;\n\n  JERRY_ASSERT (context_p->stack_top_uint8 == PARSER_STATEMENT_WHILE);\n\n  parser_stack_iterator_t iterator;\n  parser_stack_iterator_init (context_p, &iterator);\n\n  parser_stack_iterator_skip (&iterator, 1);\n  parser_stack_iterator_read (&iterator, &loop, sizeof (parser_loop_statement_t));\n  parser_stack_iterator_skip (&iterator, sizeof (parser_loop_statement_t));\n  parser_stack_iterator_read (&iterator, &while_statement, sizeof (parser_while_statement_t));\n\n  scanner_get_location (&location, context_p);\n  current_token = context_p->token;\n\n  parser_set_branch_to_current_position (context_p, &while_statement.branch);\n  parser_set_continues_to_current_position (context_p, loop.branch_list_p);\n\n  scanner_set_location (context_p, &while_statement.condition_location);\n  scanner_seek (context_p);\n  lexer_next_token (context_p);\n\n  parser_parse_expression (context_p, PARSE_EXPR);\n  if (context_p->token.type != LEXER_RIGHT_PAREN)\n  {\n    parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);\n  }\n\n  opcode = CBC_BRANCH_IF_TRUE_BACKWARD;\n  if (context_p->last_cbc_opcode == CBC_LOGICAL_NOT)\n  {\n    context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n    opcode = CBC_BRANCH_IF_FALSE_BACKWARD;\n  }\n  else if (context_p->last_cbc_opcode == CBC_PUSH_TRUE)\n  {\n    context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n    opcode = CBC_JUMP_BACKWARD;\n  }\n\n  parser_stack_pop (context_p, NULL, 1 + sizeof (parser_loop_statement_t) + sizeof (parser_while_statement_t));\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n\n  parser_emit_cbc_backward_branch (context_p, (uint16_t) opcode, while_statement.start_offset);\n  parser_set_breaks_to_current_position (context_p, loop.branch_list_p);\n\n  /* Calling scanner_seek is unnecessary because all\n   * info blocks inside the while statement should be processed. */\n  scanner_set_location (context_p, &location);\n  context_p->token = current_token;\n} /* parser_parse_while_statement_end */\n\n/**\n * Check whether the opcode is a valid LeftHandSide expression\n * and convert it back to an assignment.\n *\n * @return the compatible assignment opcode\n */\nstatic uint16_t\nparser_check_left_hand_side_expression (parser_context_t *context_p, /**< context */\n                                        uint16_t opcode) /**< opcode to check */\n{\n  if (opcode == CBC_PUSH_LITERAL && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL)\n  {\n    context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n    return CBC_ASSIGN_SET_IDENT;\n  }\n  else if (opcode == CBC_PUSH_PROP)\n  {\n    context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n    return CBC_ASSIGN;\n  }\n  else if (opcode == CBC_PUSH_PROP_LITERAL)\n  {\n    context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n    return CBC_ASSIGN_PROP_LITERAL;\n  }\n  else if (opcode == CBC_PUSH_PROP_LITERAL_LITERAL)\n  {\n    context_p->last_cbc_opcode = CBC_PUSH_TWO_LITERALS;\n    return CBC_ASSIGN;\n  }\n  else if (opcode == CBC_PUSH_PROP_THIS_LITERAL)\n  {\n    context_p->last_cbc_opcode = CBC_PUSH_THIS_LITERAL;\n    return CBC_ASSIGN;\n  }\n  else\n  {\n    /* Invalid LeftHandSide expression. */\n    parser_raise_error (context_p, PARSER_ERR_INVALID_LHS_FOR_LOOP);\n    return CBC_ASSIGN;\n  }\n\n  return opcode;\n} /* parser_check_left_hand_side_expression */\n\n/**\n * Parse for statement (starting part).\n */\nstatic void\nparser_parse_for_statement_start (parser_context_t *context_p) /**< context */\n{\n  parser_loop_statement_t loop;\n\n  JERRY_ASSERT (context_p->token.type == LEXER_KEYW_FOR);\n  lexer_next_token (context_p);\n  bool is_for_await = false;\n\n  if (context_p->token.type == LEXER_KEYW_AWAIT)\n  {\n    if (JERRY_UNLIKELY (context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_KEYWORD);\n    }\n    lexer_next_token (context_p);\n    is_for_await = true;\n  }\n\n  if (context_p->token.type != LEXER_LEFT_PAREN)\n  {\n    if (context_p->token.type == LEXER_LITERAL && context_p->token.keyword_type == LEXER_KEYW_AWAIT\n        && !(context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))\n    {\n      parser_raise_error (context_p, PARSER_ERR_FOR_AWAIT_NO_ASYNC);\n    }\n\n    parser_raise_error (context_p, PARSER_ERR_LEFT_PAREN_EXPECTED);\n  }\n\n  if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n  {\n    parser_for_in_of_statement_t for_in_of_statement;\n    scanner_location_t start_location, end_location;\n\n    JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_FOR_IN\n                  || context_p->next_scanner_info_p->type == SCANNER_TYPE_FOR_OF);\n\n    bool is_for_in = (context_p->next_scanner_info_p->type == SCANNER_TYPE_FOR_IN);\n    end_location = ((scanner_location_info_t *) context_p->next_scanner_info_p)->location;\n\n    scanner_release_next (context_p, sizeof (scanner_location_info_t));\n\n    scanner_get_location (&start_location, context_p);\n    lexer_next_token (context_p);\n\n    uint8_t token_type = LEXER_EOS;\n    bool has_context = false;\n\n    if (context_p->token.type == LEXER_KEYW_VAR || context_p->token.type == LEXER_KEYW_LET\n        || context_p->token.type == LEXER_KEYW_CONST)\n    {\n      token_type = context_p->token.type;\n      has_context = context_p->next_scanner_info_p->source_p == context_p->source_p;\n      JERRY_ASSERT (!has_context || context_p->next_scanner_info_p->type == SCANNER_TYPE_BLOCK);\n      scanner_get_location (&start_location, context_p);\n\n      /* TODO: remove this after the pre-scanner supports strict mode detection. */\n      if (context_p->next_scanner_info_p->source_p == context_p->source_p\n          && context_p->next_scanner_info_p->type == SCANNER_TYPE_LET_EXPRESSION)\n      {\n        scanner_release_next (context_p, sizeof (scanner_info_t));\n      }\n    }\n    else if (context_p->token.type == LEXER_LITERAL && lexer_token_is_let (context_p))\n    {\n      if (context_p->next_scanner_info_p->source_p == context_p->source_p\n          && context_p->next_scanner_info_p->type == SCANNER_TYPE_LET_EXPRESSION)\n      {\n        scanner_release_next (context_p, sizeof (scanner_info_t));\n      }\n      else\n      {\n        token_type = LEXER_KEYW_LET;\n        has_context = (context_p->next_scanner_info_p->source_p == context_p->source_p);\n        scanner_get_location (&start_location, context_p);\n      }\n    }\n\n    if (has_context)\n    {\n      has_context = parser_push_block_context (context_p, true);\n    }\n\n    scanner_set_location (context_p, &end_location);\n\n    /* The length of both 'in' and 'of' is two. */\n    const uint8_t *source_end_p = context_p->source_p - 2;\n\n    scanner_seek (context_p);\n\n    if (is_for_in && is_for_await)\n    {\n      context_p->token.line = context_p->line;\n      context_p->token.column = context_p->column - 2;\n      parser_raise_error (context_p, PARSER_ERR_FOR_AWAIT_NO_OF);\n    }\n\n    lexer_next_token (context_p);\n    int options = is_for_in ? PARSE_EXPR : PARSE_EXPR_NO_COMMA;\n    parser_parse_expression (context_p, options);\n\n    if (context_p->token.type != LEXER_RIGHT_PAREN)\n    {\n      parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);\n    }\n\n#ifndef JERRY_NDEBUG\n    PARSER_PLUS_EQUAL_U16 (context_p->context_stack_depth,\n                           is_for_in ? PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION : PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n\n    cbc_ext_opcode_t init_opcode = CBC_EXT_FOR_IN_INIT;\n\n    if (!is_for_in)\n    {\n      init_opcode = is_for_await ? CBC_EXT_FOR_AWAIT_OF_INIT : CBC_EXT_FOR_OF_INIT;\n    }\n\n    parser_emit_cbc_ext_forward_branch (context_p, init_opcode, &for_in_of_statement.branch);\n\n    JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);\n    for_in_of_statement.start_offset = context_p->byte_code_size;\n\n    if (has_context)\n    {\n      parser_emit_cbc_ext (context_p, CBC_EXT_CLONE_CONTEXT);\n    }\n\n    /* The expression parser must not read the 'in' or 'of' tokens. */\n    scanner_get_location (&end_location, context_p);\n    scanner_set_location (context_p, &start_location);\n\n    const uint8_t *original_source_end_p = context_p->source_end_p;\n    context_p->source_end_p = source_end_p;\n    scanner_seek (context_p);\n\n    if (token_type == LEXER_EOS)\n    {\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_LEFT_SQUARE || context_p->token.type == LEXER_LEFT_BRACE)\n      {\n        token_type = context_p->token.type;\n      }\n    }\n\n    switch (token_type)\n    {\n      case LEXER_KEYW_LET:\n      case LEXER_KEYW_CONST:\n      case LEXER_KEYW_VAR:\n      {\n        if (lexer_check_next_characters (context_p, LIT_CHAR_LEFT_SQUARE, LIT_CHAR_LEFT_BRACE))\n        {\n          parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT : CBC_EXT_FOR_OF_GET_NEXT);\n\n          parser_pattern_flags_t flags = (PARSER_PATTERN_BINDING | PARSER_PATTERN_TARGET_ON_STACK);\n\n          if (context_p->next_scanner_info_p->source_p == (context_p->source_p + 1))\n          {\n            if (context_p->next_scanner_info_p->type == SCANNER_TYPE_INITIALIZER)\n            {\n              scanner_release_next (context_p, sizeof (scanner_location_info_t));\n            }\n            else\n            {\n              JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS);\n              if (context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_OBJECT_HAS_REST)\n              {\n                flags |= PARSER_PATTERN_HAS_REST_ELEMENT;\n              }\n\n              scanner_release_next (context_p, sizeof (scanner_info_t));\n            }\n          }\n\n          if (token_type == LEXER_KEYW_LET)\n          {\n            flags |= PARSER_PATTERN_LET;\n          }\n          else if (token_type == LEXER_KEYW_CONST)\n          {\n            flags |= PARSER_PATTERN_CONST;\n          }\n\n          parser_parse_initializer_by_next_char (context_p, flags);\n          break;\n        }\n\n        lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL);\n\n        if (context_p->token.keyword_type == LEXER_KEYW_LET && token_type != LEXER_KEYW_VAR)\n        {\n          parser_raise_error (context_p, PARSER_ERR_LEXICAL_LET_BINDING);\n        }\n\n        JERRY_ASSERT (context_p->token.type == LEXER_LITERAL\n                      && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n        uint16_t literal_index = context_p->lit_object.index;\n        lexer_next_token (context_p);\n\n        if (context_p->token.type == LEXER_ASSIGN)\n        {\n          if ((context_p->status_flags & PARSER_IS_STRICT) || !is_for_in)\n          {\n            parser_raise_error (context_p, PARSER_ERR_FOR_IN_OF_DECLARATION);\n          }\n          parser_branch_t branch;\n\n          /* Initialiser is never executed. */\n          parser_emit_cbc_forward_branch (context_p, CBC_JUMP_FORWARD, &branch);\n          lexer_next_token (context_p);\n          parser_parse_expression_statement (context_p, PARSE_EXPR_NO_COMMA);\n          parser_set_branch_to_current_position (context_p, &branch);\n        }\n\n        parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT : CBC_EXT_FOR_OF_GET_NEXT);\n#ifndef JERRY_NDEBUG\n        if (literal_index < PARSER_REGISTER_START && has_context\n            && !scanner_literal_is_created (context_p, literal_index))\n        {\n          context_p->global_status_flags |= ECMA_PARSE_INTERNAL_FOR_IN_OFF_CONTEXT_ERROR;\n        }\n#endif /* !JERRY_NDEBUG */\n\n        uint16_t opcode = (has_context ? CBC_ASSIGN_LET_CONST : CBC_ASSIGN_SET_IDENT);\n        parser_emit_cbc_literal (context_p, opcode, literal_index);\n        break;\n      }\n      case LEXER_LEFT_BRACE:\n      case LEXER_LEFT_SQUARE:\n      {\n        if (context_p->next_scanner_info_p->source_p == context_p->source_p\n            && context_p->next_scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS\n            && (context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_DESTRUCTURING_FOR))\n        {\n          parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT : CBC_EXT_FOR_OF_GET_NEXT);\n\n          uint32_t flags = PARSER_PATTERN_TARGET_ON_STACK;\n\n          if (context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_OBJECT_HAS_REST)\n          {\n            flags |= PARSER_PATTERN_HAS_REST_ELEMENT;\n          }\n\n          scanner_release_next (context_p, sizeof (scanner_info_t));\n          parser_parse_initializer (context_p, flags);\n          /* Pop the value returned by GET_NEXT. */\n          parser_emit_cbc (context_p, CBC_POP);\n          break;\n        }\n        /* FALLTHRU */\n      }\n      default:\n      {\n        uint16_t opcode;\n\n        parser_parse_expression (context_p, PARSE_EXPR_LEFT_HAND_SIDE);\n\n        opcode = context_p->last_cbc_opcode;\n\n        /* The CBC_EXT_FOR_IN_CREATE_CONTEXT flushed the opcode combiner. */\n        JERRY_ASSERT (opcode != CBC_PUSH_TWO_LITERALS && opcode != CBC_PUSH_THREE_LITERALS);\n\n        opcode = parser_check_left_hand_side_expression (context_p, opcode);\n\n        parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT : CBC_EXT_FOR_OF_GET_NEXT);\n        parser_flush_cbc (context_p);\n\n        context_p->last_cbc_opcode = opcode;\n        break;\n      }\n    }\n\n    if (context_p->token.type != LEXER_EOS)\n    {\n      parser_raise_error (context_p, is_for_in ? PARSER_ERR_IN_EXPECTED : PARSER_ERR_OF_EXPECTED);\n    }\n\n    parser_flush_cbc (context_p);\n    scanner_set_location (context_p, &end_location);\n    context_p->source_end_p = original_source_end_p;\n    lexer_next_token (context_p);\n\n    loop.branch_list_p = NULL;\n\n    parser_stack_push (context_p, &for_in_of_statement, sizeof (parser_for_in_of_statement_t));\n    parser_stack_push (context_p, &loop, sizeof (parser_loop_statement_t));\n\n    uint8_t for_type = PARSER_STATEMENT_FOR_IN;\n\n    if (!is_for_in)\n    {\n      for_type = is_for_await ? PARSER_STATEMENT_FOR_AWAIT_OF : PARSER_STATEMENT_FOR_OF;\n    }\n\n    parser_stack_push_uint8 (context_p, for_type);\n    parser_stack_iterator_init (context_p, &context_p->last_statement);\n    return;\n  }\n\n  lexer_next_token (context_p);\n\n  if (context_p->token.type != LEXER_SEMICOLON)\n  {\n    const uint8_t *source_p = context_p->source_p;\n\n    switch (context_p->token.type)\n    {\n      case LEXER_LITERAL:\n      {\n        if (!lexer_token_is_let (context_p))\n        {\n          parser_parse_expression_statement (context_p, PARSE_EXPR);\n          break;\n        }\n\n        /* FALLTHRU */\n      }\n      case LEXER_KEYW_LET:\n      {\n        if (context_p->next_scanner_info_p->source_p == context_p->source_p\n            && context_p->next_scanner_info_p->type != SCANNER_TYPE_BLOCK)\n        {\n          if (context_p->next_scanner_info_p->type == SCANNER_TYPE_LET_EXPRESSION)\n          {\n            scanner_release_next (context_p, sizeof (scanner_info_t));\n          }\n\n          parser_parse_expression_statement (context_p, PARSE_EXPR);\n          break;\n        }\n\n        context_p->token.type = LEXER_KEYW_LET;\n\n        /* FALLTHRU */\n      }\n      case LEXER_KEYW_CONST:\n      {\n        if (context_p->next_scanner_info_p->source_p == source_p)\n        {\n          parser_push_block_context (context_p, true);\n        }\n        /* FALLTHRU */\n      }\n      case LEXER_KEYW_VAR:\n      {\n        parser_parse_var_statement (context_p);\n        break;\n      }\n      default:\n      {\n        parser_parse_expression_statement (context_p, PARSE_EXPR);\n        break;\n      }\n    }\n\n    if (context_p->token.type != LEXER_SEMICOLON)\n    {\n      parser_raise_error (context_p, PARSER_ERR_SEMICOLON_EXPECTED);\n    }\n  }\n\n  if (is_for_await)\n  {\n    parser_raise_error (context_p, PARSER_ERR_FOR_AWAIT_NO_OF);\n  }\n\n  JERRY_ASSERT (context_p->next_scanner_info_p->source_p != context_p->source_p\n                || context_p->next_scanner_info_p->type == SCANNER_TYPE_FOR);\n\n  if (context_p->next_scanner_info_p->source_p != context_p->source_p\n      || ((scanner_for_info_t *) context_p->next_scanner_info_p)->end_location.source_p == NULL)\n  {\n    if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n    {\n      /* Even though the scanning is failed, there might be valid statements\n       * inside the for statement which depend on scanner info blocks. */\n      scanner_release_next (context_p, sizeof (scanner_for_info_t));\n    }\n\n    /* The prescanner couldn't find the second semicolon or the closing paranthesis. */\n    lexer_next_token (context_p);\n    parser_parse_expression (context_p, PARSE_EXPR);\n\n    if (context_p->token.type != LEXER_SEMICOLON)\n    {\n      parser_raise_error (context_p, PARSER_ERR_SEMICOLON_EXPECTED);\n    }\n\n    lexer_next_token (context_p);\n    parser_parse_expression_statement (context_p, PARSE_EXPR);\n\n    JERRY_ASSERT (context_p->token.type != LEXER_RIGHT_PAREN);\n    parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);\n  }\n\n  parser_for_statement_t for_statement;\n  scanner_for_info_t *for_info_p = (scanner_for_info_t *) context_p->next_scanner_info_p;\n\n  parser_emit_cbc_forward_branch (context_p, CBC_JUMP_FORWARD, &for_statement.branch);\n\n  JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);\n\n  for_statement.start_offset = context_p->byte_code_size;\n  scanner_get_location (&for_statement.condition_location, context_p);\n  for_statement.expression_location = for_info_p->expression_location;\n\n  scanner_set_location (context_p, &for_info_p->end_location);\n  scanner_release_next (context_p, sizeof (scanner_for_info_t));\n  scanner_seek (context_p);\n  lexer_next_token (context_p);\n\n  loop.branch_list_p = NULL;\n\n  parser_stack_push (context_p, &for_statement, sizeof (parser_for_statement_t));\n  parser_stack_push (context_p, &loop, sizeof (parser_loop_statement_t));\n  parser_stack_push_uint8 (context_p, PARSER_STATEMENT_FOR);\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n} /* parser_parse_for_statement_start */\n\n/**\n * Parse for statement (ending part).\n */\nstatic void JERRY_ATTR_NOINLINE\nparser_parse_for_statement_end (parser_context_t *context_p) /**< context */\n{\n  parser_for_statement_t for_statement;\n  parser_loop_statement_t loop;\n  lexer_token_t current_token;\n  scanner_location_t location;\n  cbc_opcode_t opcode;\n\n  JERRY_ASSERT (context_p->stack_top_uint8 == PARSER_STATEMENT_FOR);\n\n  parser_stack_iterator_t iterator;\n  parser_stack_iterator_init (context_p, &iterator);\n\n  parser_stack_iterator_skip (&iterator, 1);\n  parser_stack_iterator_read (&iterator, &loop, sizeof (parser_loop_statement_t));\n  parser_stack_iterator_skip (&iterator, sizeof (parser_loop_statement_t));\n  parser_stack_iterator_read (&iterator, &for_statement, sizeof (parser_for_statement_t));\n\n  bool has_block_context = false;\n  uint8_t next_statement_type;\n\n  parser_stack_iterator_skip (&iterator, sizeof (parser_for_statement_t));\n  parser_stack_iterator_read (&iterator, &next_statement_type, 1);\n\n  if (next_statement_type == PARSER_STATEMENT_PRIVATE_CONTEXT)\n  {\n    has_block_context = true;\n  }\n\n  scanner_get_location (&location, context_p);\n  current_token = context_p->token;\n\n  scanner_set_location (context_p, &for_statement.expression_location);\n  scanner_seek (context_p);\n  lexer_next_token (context_p);\n\n  parser_set_continues_to_current_position (context_p, loop.branch_list_p);\n\n  if (has_block_context)\n  {\n    parser_emit_cbc_ext (context_p, CBC_EXT_CLONE_FULL_CONTEXT);\n  }\n\n  if (context_p->token.type != LEXER_RIGHT_PAREN)\n  {\n    parser_parse_expression_statement (context_p, PARSE_EXPR);\n\n    if (context_p->token.type != LEXER_RIGHT_PAREN)\n    {\n      parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);\n    }\n  }\n\n  parser_set_branch_to_current_position (context_p, &for_statement.branch);\n\n  scanner_set_location (context_p, &for_statement.condition_location);\n  scanner_seek (context_p);\n  lexer_next_token (context_p);\n\n  if (context_p->token.type != LEXER_SEMICOLON)\n  {\n    parser_parse_expression (context_p, PARSE_EXPR);\n\n    if (context_p->token.type != LEXER_SEMICOLON)\n    {\n      parser_raise_error (context_p, PARSER_ERR_SEMICOLON_EXPECTED);\n    }\n\n    opcode = CBC_BRANCH_IF_TRUE_BACKWARD;\n    if (context_p->last_cbc_opcode == CBC_LOGICAL_NOT)\n    {\n      context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n      opcode = CBC_BRANCH_IF_FALSE_BACKWARD;\n    }\n    else if (context_p->last_cbc_opcode == CBC_PUSH_TRUE)\n    {\n      context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n      opcode = CBC_JUMP_BACKWARD;\n    }\n  }\n  else\n  {\n    opcode = CBC_JUMP_BACKWARD;\n  }\n\n  parser_stack_pop (context_p, NULL, 1 + sizeof (parser_loop_statement_t) + sizeof (parser_for_statement_t));\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n\n  parser_emit_cbc_backward_branch (context_p, (uint16_t) opcode, for_statement.start_offset);\n  parser_set_breaks_to_current_position (context_p, loop.branch_list_p);\n\n  if (context_p->stack_top_uint8 == PARSER_STATEMENT_PRIVATE_SCOPE\n      || context_p->stack_top_uint8 == PARSER_STATEMENT_PRIVATE_CONTEXT)\n  {\n    parser_pop_block_context (context_p);\n  }\n\n  /* Calling scanner_seek is unnecessary because all\n   * info blocks inside the for statement should be processed. */\n  scanner_set_location (context_p, &location);\n  context_p->token = current_token;\n} /* parser_parse_for_statement_end */\n\n/**\n * Parse switch statement (starting part).\n */\nstatic void JERRY_ATTR_NOINLINE\nparser_parse_switch_statement_start (parser_context_t *context_p) /**< context */\n{\n  parser_switch_statement_t switch_statement;\n  parser_loop_statement_t loop;\n  parser_stack_iterator_t iterator;\n  scanner_location_t start_location;\n  bool switch_case_was_found;\n  bool default_case_was_found;\n  parser_branch_node_t *case_branches_p = NULL;\n\n  JERRY_ASSERT (context_p->token.type == LEXER_KEYW_SWITCH);\n\n  parser_parse_enclosed_expr (context_p);\n\n  if (context_p->token.type != LEXER_LEFT_BRACE)\n  {\n    parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_EXPECTED);\n  }\n\n  if (context_p->next_scanner_info_p->source_p == context_p->source_p - 1)\n  {\n    parser_push_block_context (context_p, true);\n  }\n\n  JERRY_ASSERT (context_p->next_scanner_info_p->source_p == context_p->source_p\n                && context_p->next_scanner_info_p->type == SCANNER_TYPE_SWITCH);\n\n  scanner_case_info_t *case_info_p = ((scanner_switch_info_t *) context_p->next_scanner_info_p)->case_p;\n  scanner_set_active (context_p);\n\n  if (case_info_p == NULL)\n  {\n    lexer_next_token (context_p);\n\n    if (context_p->token.type == LEXER_RIGHT_BRACE)\n    {\n      scanner_release_active (context_p, sizeof (scanner_switch_info_t));\n\n      parser_emit_cbc (context_p, CBC_POP);\n      parser_flush_cbc (context_p);\n\n      parser_stack_push_uint8 (context_p, PARSER_STATEMENT_BLOCK);\n      parser_stack_iterator_init (context_p, &context_p->last_statement);\n      return;\n    }\n\n    parser_raise_error (context_p, PARSER_ERR_INVALID_SWITCH);\n  }\n\n  scanner_get_location (&start_location, context_p);\n\n  /* The reason of using an iterator is error management. If an error\n   * occures, parser_free_jumps() free all data. However, the branches\n   * created by parser_emit_cbc_forward_branch_item() would not be freed.\n   * To free these branches, the current switch data is always stored\n   * on the stack. If any change happens, this data is updated. Updates\n   * are done using the iterator. */\n\n  switch_statement.branch_list_p = NULL;\n  loop.branch_list_p = NULL;\n\n  parser_stack_push (context_p, &switch_statement, sizeof (parser_switch_statement_t));\n  parser_stack_iterator_init (context_p, &iterator);\n  parser_stack_push (context_p, &loop, sizeof (parser_loop_statement_t));\n  parser_stack_push_uint8 (context_p, PARSER_STATEMENT_SWITCH);\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n\n  switch_case_was_found = false;\n  default_case_was_found = false;\n\n  do\n  {\n    scanner_set_location (context_p, &case_info_p->location);\n    scanner_seek (context_p);\n    case_info_p = case_info_p->next_p;\n\n    /* The last letter of case and default is 'e' and 't' respectively.  */\n    JERRY_ASSERT (context_p->source_p[-1] == LIT_CHAR_LOWERCASE_E || context_p->source_p[-1] == LIT_CHAR_LOWERCASE_T);\n\n    bool is_default = context_p->source_p[-1] == LIT_CHAR_LOWERCASE_T;\n    lexer_next_token (context_p);\n\n    if (is_default)\n    {\n      if (default_case_was_found)\n      {\n        parser_raise_error (context_p, PARSER_ERR_MULTIPLE_DEFAULTS_NOT_ALLOWED);\n      }\n\n      if (context_p->token.type != LEXER_COLON)\n      {\n        parser_raise_error (context_p, PARSER_ERR_COLON_EXPECTED);\n      }\n\n      default_case_was_found = true;\n      continue;\n    }\n\n    switch_case_was_found = true;\n\n#if JERRY_LINE_INFO\n    parser_line_info_append (context_p, context_p->token.line, context_p->token.column);\n#endif /* JERRY_LINE_INFO */\n\n    parser_parse_expression (context_p, PARSE_EXPR);\n\n    if (context_p->token.type != LEXER_COLON)\n    {\n      parser_raise_error (context_p, PARSER_ERR_COLON_EXPECTED);\n    }\n\n    uint16_t opcode = CBC_BRANCH_IF_STRICT_EQUAL;\n\n    if (case_info_p == NULL\n        || (case_info_p->next_p == NULL && case_info_p->location.source_p[-1] == LIT_CHAR_LOWERCASE_T))\n    {\n      /* There are no more 'case' statements in the switch. */\n      parser_emit_cbc (context_p, CBC_STRICT_EQUAL);\n      opcode = CBC_BRANCH_IF_TRUE_FORWARD;\n    }\n\n    parser_branch_node_t *new_case_p = parser_emit_cbc_forward_branch_item (context_p, opcode, NULL);\n\n    if (case_branches_p == NULL)\n    {\n      switch_statement.branch_list_p = new_case_p;\n      parser_stack_iterator_write (&iterator, &switch_statement, sizeof (parser_switch_statement_t));\n    }\n    else\n    {\n      case_branches_p->next_p = new_case_p;\n    }\n\n    case_branches_p = new_case_p;\n  } while (case_info_p != NULL);\n\n  JERRY_ASSERT (switch_case_was_found || default_case_was_found);\n\n  if (!switch_case_was_found)\n  {\n    /* There was no case statement, so the expression result\n     * of the switch must be popped from the stack */\n    parser_emit_cbc (context_p, CBC_POP);\n  }\n\n  parser_emit_cbc_forward_branch (context_p, CBC_JUMP_FORWARD, &switch_statement.default_branch);\n  parser_stack_iterator_write (&iterator, &switch_statement, sizeof (parser_switch_statement_t));\n\n  if (!default_case_was_found)\n  {\n    parser_stack_change_last_uint8 (context_p, PARSER_STATEMENT_SWITCH_NO_DEFAULT);\n  }\n\n  scanner_release_switch_cases (((scanner_switch_info_t *) context_p->active_scanner_info_p)->case_p);\n  scanner_release_active (context_p, sizeof (scanner_switch_info_t));\n\n  scanner_set_location (context_p, &start_location);\n  scanner_seek (context_p);\n  lexer_next_token (context_p);\n} /* parser_parse_switch_statement_start */\n\n/**\n * Parse try statement (ending part).\n */\nstatic void\nparser_parse_try_statement_end (parser_context_t *context_p) /**< context */\n{\n  parser_try_statement_t try_statement;\n  parser_stack_iterator_t iterator;\n\n  JERRY_ASSERT (context_p->stack_top_uint8 == PARSER_STATEMENT_TRY);\n\n  parser_stack_iterator_init (context_p, &iterator);\n  parser_stack_iterator_skip (&iterator, 1);\n  parser_stack_iterator_read (&iterator, &try_statement, sizeof (parser_try_statement_t));\n\n  context_p->scope_stack_top = try_statement.scope_stack_top;\n  context_p->scope_stack_reg_top = try_statement.scope_stack_reg_top;\n\n  lexer_next_token (context_p);\n\n  if (try_statement.type == parser_finally_block)\n  {\n    parser_flush_cbc (context_p);\n    PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, PARSER_FINALLY_CONTEXT_STACK_ALLOCATION);\n#ifndef JERRY_NDEBUG\n    PARSER_MINUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_FINALLY_CONTEXT_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n\n    parser_emit_cbc (context_p, CBC_CONTEXT_END);\n    parser_set_branch_to_current_position (context_p, &try_statement.branch);\n  }\n  else\n  {\n    parser_set_branch_to_current_position (context_p, &try_statement.branch);\n\n    if (try_statement.type == parser_catch_block)\n    {\n      if (context_p->token.type != LEXER_KEYW_FINALLY)\n      {\n        parser_flush_cbc (context_p);\n        PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);\n#ifndef JERRY_NDEBUG\n        PARSER_MINUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n\n        parser_emit_cbc (context_p, CBC_CONTEXT_END);\n        parser_flush_cbc (context_p);\n\n        try_statement.type = parser_finally_block;\n      }\n    }\n    else\n    {\n      JERRY_ASSERT (try_statement.type == parser_try_block);\n\n      if (context_p->token.type != LEXER_KEYW_CATCH && context_p->token.type != LEXER_KEYW_FINALLY)\n      {\n        parser_raise_error (context_p, PARSER_ERR_CATCH_FINALLY_EXPECTED);\n      }\n    }\n  }\n\n  if (try_statement.type == parser_finally_block)\n  {\n    parser_stack_pop (context_p, NULL, (uint32_t) (sizeof (parser_try_statement_t) + 1));\n    parser_stack_iterator_init (context_p, &context_p->last_statement);\n    return;\n  }\n\n  if (context_p->token.type == LEXER_KEYW_CATCH)\n  {\n    lexer_next_token (context_p);\n\n    try_statement.type = parser_catch_block;\n    parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_CATCH, &try_statement.branch);\n\n    try_statement.scope_stack_top = context_p->scope_stack_top;\n    try_statement.scope_stack_reg_top = context_p->scope_stack_reg_top;\n\n#ifndef JERRY_NDEBUG\n    bool block_found = false;\n#endif /* !JERRY_NDEBUG */\n\n    if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n    {\n      JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_BLOCK);\n#ifndef JERRY_NDEBUG\n      block_found = true;\n#endif /* !JERRY_NDEBUG */\n\n      if (scanner_is_context_needed (context_p, PARSER_CHECK_BLOCK_CONTEXT))\n      {\n        parser_emit_cbc_ext (context_p, CBC_EXT_TRY_CREATE_ENV);\n      }\n\n      scanner_create_variables (context_p, SCANNER_CREATE_VARS_NO_OPTS);\n    }\n\n    if (context_p->token.type == LEXER_LEFT_PAREN)\n    {\n      if (lexer_check_next_characters (context_p, LIT_CHAR_LEFT_SQUARE, LIT_CHAR_LEFT_BRACE))\n      {\n        parser_pattern_flags_t flags = (PARSER_PATTERN_BINDING | PARSER_PATTERN_TARGET_ON_STACK | PARSER_PATTERN_LET);\n\n        parser_parse_initializer_by_next_char (context_p, flags);\n      }\n      else\n      {\n        lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL);\n        JERRY_ASSERT (context_p->token.type == LEXER_LITERAL\n                      && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n        uint16_t literal_index = context_p->lit_object.index;\n        parser_emit_cbc_literal (context_p,\n                                 (literal_index >= PARSER_REGISTER_START) ? CBC_ASSIGN_SET_IDENT : CBC_ASSIGN_LET_CONST,\n                                 literal_index);\n\n        lexer_next_token (context_p);\n\n#ifndef JERRY_NDEBUG\n        JERRY_ASSERT (block_found);\n#endif /* !JERRY_NDEBUG */\n      }\n\n      if (context_p->token.type != LEXER_RIGHT_PAREN)\n      {\n        parser_raise_error (context_p, PARSER_ERR_RIGHT_PAREN_EXPECTED);\n      }\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type != LEXER_LEFT_BRACE)\n      {\n        parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_EXPECTED);\n      }\n    }\n    else if (context_p->token.type == LEXER_LEFT_BRACE)\n    {\n      parser_emit_cbc (context_p, CBC_POP);\n    }\n    else\n    {\n      parser_raise_error (context_p, PARSER_ERR_LEFT_PAREN_EXPECTED);\n    }\n\n    parser_flush_cbc (context_p);\n  }\n  else\n  {\n    JERRY_ASSERT (context_p->token.type == LEXER_KEYW_FINALLY);\n\n    lexer_next_token (context_p);\n\n    if (context_p->token.type != LEXER_LEFT_BRACE)\n    {\n      parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_EXPECTED);\n    }\n\n#ifndef JERRY_NDEBUG\n    PARSER_PLUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n\n    try_statement.type = parser_finally_block;\n    parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_FINALLY, &try_statement.branch);\n\n    if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n    {\n      JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_BLOCK);\n\n      if (scanner_is_context_needed (context_p, PARSER_CHECK_BLOCK_CONTEXT))\n      {\n        parser_emit_cbc_ext (context_p, CBC_EXT_TRY_CREATE_ENV);\n      }\n\n      scanner_create_variables (context_p, SCANNER_CREATE_VARS_NO_OPTS);\n    }\n  }\n\n  lexer_next_token (context_p);\n  parser_stack_iterator_write (&iterator, &try_statement, sizeof (parser_try_statement_t));\n} /* parser_parse_try_statement_end */\n\n/**\n * Parse default statement.\n */\nstatic void\nparser_parse_default_statement (parser_context_t *context_p) /**< context */\n{\n  parser_stack_iterator_t iterator;\n  parser_switch_statement_t switch_statement;\n\n  if (context_p->stack_top_uint8 != PARSER_STATEMENT_SWITCH\n      && context_p->stack_top_uint8 != PARSER_STATEMENT_SWITCH_NO_DEFAULT)\n  {\n    parser_raise_error (context_p, PARSER_ERR_DEFAULT_NOT_IN_SWITCH);\n  }\n\n  lexer_next_token (context_p);\n  /* Already checked in parser_parse_switch_statement_start. */\n  JERRY_ASSERT (context_p->token.type == LEXER_COLON);\n  lexer_next_token (context_p);\n\n  parser_stack_iterator_init (context_p, &iterator);\n  parser_stack_iterator_skip (&iterator, 1 + sizeof (parser_loop_statement_t));\n  parser_stack_iterator_read (&iterator, &switch_statement, sizeof (parser_switch_statement_t));\n\n  parser_set_branch_to_current_position (context_p, &switch_statement.default_branch);\n} /* parser_parse_default_statement */\n\n/**\n * Parse case statement.\n */\nstatic void\nparser_parse_case_statement (parser_context_t *context_p) /**< context */\n{\n  parser_stack_iterator_t iterator;\n  parser_switch_statement_t switch_statement;\n  parser_branch_node_t *branch_p;\n\n  if (context_p->stack_top_uint8 != PARSER_STATEMENT_SWITCH\n      && context_p->stack_top_uint8 != PARSER_STATEMENT_SWITCH_NO_DEFAULT)\n  {\n    parser_raise_error (context_p, PARSER_ERR_CASE_NOT_IN_SWITCH);\n  }\n\n  if (context_p->next_scanner_info_p->source_p != context_p->source_p)\n  {\n    lexer_next_token (context_p);\n\n    parser_parse_expression (context_p, PARSE_EXPR);\n\n    JERRY_ASSERT (context_p->token.type != LEXER_COLON);\n    parser_raise_error (context_p, PARSER_ERR_COLON_EXPECTED);\n  }\n\n  JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_CASE);\n\n  scanner_set_location (context_p, &((scanner_location_info_t *) context_p->next_scanner_info_p)->location);\n  scanner_release_next (context_p, sizeof (scanner_location_info_t));\n  scanner_seek (context_p);\n  lexer_next_token (context_p);\n\n  parser_stack_iterator_init (context_p, &iterator);\n  parser_stack_iterator_skip (&iterator, 1 + sizeof (parser_loop_statement_t));\n  parser_stack_iterator_read (&iterator, &switch_statement, sizeof (parser_switch_statement_t));\n\n  /* Free memory after the case statement is found. */\n\n  branch_p = switch_statement.branch_list_p;\n  JERRY_ASSERT (branch_p != NULL);\n  switch_statement.branch_list_p = branch_p->next_p;\n  parser_stack_iterator_write (&iterator, &switch_statement, sizeof (parser_switch_statement_t));\n\n  parser_set_branch_to_current_position (context_p, &branch_p->branch);\n  parser_free (branch_p, sizeof (parser_branch_node_t));\n} /* parser_parse_case_statement */\n\n/**\n * Parse break statement.\n */\nstatic void\nparser_parse_break_statement (parser_context_t *context_p) /**< context */\n{\n  parser_stack_iterator_t iterator;\n  cbc_opcode_t opcode = CBC_JUMP_FORWARD;\n\n  lexer_next_token (context_p);\n  parser_stack_iterator_init (context_p, &iterator);\n\n  if (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->token.type == LEXER_LITERAL\n      && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n  {\n    /* The label with the same name is searched on the stack. */\n    while (true)\n    {\n      uint8_t type = parser_stack_iterator_read_uint8 (&iterator);\n      if (type == PARSER_STATEMENT_START)\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_BREAK_LABEL);\n      }\n\n      if (parser_statement_flags[type] & PARSER_STATM_CONTEXT_BREAK)\n      {\n        opcode = CBC_JUMP_FORWARD_EXIT_CONTEXT;\n      }\n\n      if (type == PARSER_STATEMENT_LABEL)\n      {\n        parser_label_statement_t label_statement;\n\n        parser_stack_iterator_skip (&iterator, 1);\n        parser_stack_iterator_read (&iterator, &label_statement, sizeof (parser_label_statement_t));\n\n        if (lexer_current_is_literal (context_p, &label_statement.label_ident))\n        {\n          label_statement.break_list_p =\n            parser_emit_cbc_forward_branch_item (context_p, (uint16_t) opcode, label_statement.break_list_p);\n          parser_stack_iterator_write (&iterator, &label_statement, sizeof (parser_label_statement_t));\n          lexer_next_token (context_p);\n          return;\n        }\n        parser_stack_iterator_skip (&iterator, sizeof (parser_label_statement_t));\n      }\n      else\n      {\n        parser_stack_iterator_skip (&iterator, parser_statement_length (type));\n      }\n    }\n  }\n\n  /* The first switch or loop statement is searched. */\n  while (true)\n  {\n    uint8_t type = parser_stack_iterator_read_uint8 (&iterator);\n    if (type == PARSER_STATEMENT_START)\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_BREAK);\n    }\n\n    if (parser_statement_flags[type] & PARSER_STATM_CONTEXT_BREAK)\n    {\n      opcode = CBC_JUMP_FORWARD_EXIT_CONTEXT;\n    }\n\n    if (parser_statement_flags[type] & PARSER_STATM_BREAK_TARGET)\n    {\n      parser_loop_statement_t loop;\n\n      parser_stack_iterator_skip (&iterator, 1);\n      parser_stack_iterator_read (&iterator, &loop, sizeof (parser_loop_statement_t));\n      loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p, (uint16_t) opcode, loop.branch_list_p);\n      parser_stack_iterator_write (&iterator, &loop, sizeof (parser_loop_statement_t));\n      return;\n    }\n\n    parser_stack_iterator_skip (&iterator, parser_statement_length (type));\n  }\n} /* parser_parse_break_statement */\n\n/**\n * Parse continue statement.\n */\nstatic void\nparser_parse_continue_statement (parser_context_t *context_p) /**< context */\n{\n  parser_stack_iterator_t iterator;\n  cbc_opcode_t opcode = CBC_JUMP_FORWARD;\n\n  lexer_next_token (context_p);\n  parser_stack_iterator_init (context_p, &iterator);\n\n  if (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->token.type == LEXER_LITERAL\n      && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n  {\n    parser_stack_iterator_t loop_iterator;\n\n    loop_iterator.current_p = NULL;\n\n    /* The label with the same name is searched on the stack. */\n    while (true)\n    {\n      uint8_t type = parser_stack_iterator_read_uint8 (&iterator);\n\n      if (type == PARSER_STATEMENT_START)\n      {\n        parser_raise_error (context_p, PARSER_ERR_INVALID_CONTINUE_LABEL);\n      }\n\n      /* Only those labels are checked, whose are label of a loop. */\n      if (loop_iterator.current_p != NULL && type == PARSER_STATEMENT_LABEL)\n      {\n        parser_label_statement_t label_statement;\n\n        parser_stack_iterator_skip (&iterator, 1);\n        parser_stack_iterator_read (&iterator, &label_statement, sizeof (parser_label_statement_t));\n\n        if (lexer_current_is_literal (context_p, &label_statement.label_ident))\n        {\n          parser_loop_statement_t loop;\n\n          parser_stack_iterator_skip (&loop_iterator, 1);\n          parser_stack_iterator_read (&loop_iterator, &loop, sizeof (parser_loop_statement_t));\n          loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p, (uint16_t) opcode, loop.branch_list_p);\n          loop.branch_list_p->branch.offset |= CBC_HIGHEST_BIT_MASK;\n          parser_stack_iterator_write (&loop_iterator, &loop, sizeof (parser_loop_statement_t));\n          lexer_next_token (context_p);\n          return;\n        }\n        parser_stack_iterator_skip (&iterator, sizeof (parser_label_statement_t));\n        continue;\n      }\n\n      if (parser_statement_flags[type] & PARSER_STATM_CONTEXT_BREAK)\n      {\n        opcode = CBC_JUMP_FORWARD_EXIT_CONTEXT;\n      }\n\n      const bool is_private_scope =\n        (type == PARSER_STATEMENT_PRIVATE_SCOPE || type == PARSER_STATEMENT_PRIVATE_CONTEXT);\n\n      if (parser_statement_flags[type] & PARSER_STATM_CONTINUE_TARGET)\n      {\n        loop_iterator = iterator;\n      }\n      else if (!is_private_scope)\n      {\n        loop_iterator.current_p = NULL;\n      }\n\n      parser_stack_iterator_skip (&iterator, parser_statement_length (type));\n    }\n  }\n\n  /* The first loop statement is searched. */\n  while (true)\n  {\n    uint8_t type = parser_stack_iterator_read_uint8 (&iterator);\n    if (type == PARSER_STATEMENT_START)\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_CONTINUE);\n    }\n\n    if (parser_statement_flags[type] & PARSER_STATM_CONTINUE_TARGET)\n    {\n      parser_loop_statement_t loop;\n\n      parser_stack_iterator_skip (&iterator, 1);\n      parser_stack_iterator_read (&iterator, &loop, sizeof (parser_loop_statement_t));\n      loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p, (uint16_t) opcode, loop.branch_list_p);\n      loop.branch_list_p->branch.offset |= CBC_HIGHEST_BIT_MASK;\n      parser_stack_iterator_write (&iterator, &loop, sizeof (parser_loop_statement_t));\n      return;\n    }\n\n    if (parser_statement_flags[type] & PARSER_STATM_CONTEXT_BREAK)\n    {\n      opcode = CBC_JUMP_FORWARD_EXIT_CONTEXT;\n    }\n\n    parser_stack_iterator_skip (&iterator, parser_statement_length (type));\n  }\n} /* parser_parse_continue_statement */\n\n#if JERRY_MODULE_SYSTEM\n/**\n * Parse import statement.\n * Note: See 15.2.2\n */\nstatic void\nparser_parse_import_statement (parser_context_t *context_p) /**< parser context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_KEYW_IMPORT);\n  JERRY_ASSERT (context_p->module_names_p == NULL);\n\n  if (lexer_check_next_characters (context_p, LIT_CHAR_LEFT_PAREN, LIT_CHAR_DOT))\n  {\n    if (context_p->status_flags & PARSER_IS_FUNCTION)\n    {\n      parser_parse_expression_statement (context_p, PARSE_EXPR);\n      return;\n    }\n\n    parser_parse_block_expression (context_p, PARSE_EXPR);\n    return;\n  }\n\n  parser_module_check_request_place (context_p);\n  lexer_next_token (context_p);\n\n  /* Check for a ModuleSpecifier*/\n  if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_STRING_LITERAL)\n  {\n    if (!(context_p->token.type == LEXER_LEFT_BRACE || context_p->token.type == LEXER_MULTIPLY\n          || (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)))\n    {\n      parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_MULTIPLY_LITERAL_EXPECTED);\n    }\n\n    if (context_p->token.type == LEXER_LITERAL)\n    {\n      /* Handle ImportedDefaultBinding */\n      lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_IDENT_LITERAL);\n\n      ecma_string_t *local_name_p = parser_new_ecma_string_from_literal (context_p->lit_object.literal_p);\n\n      if (parser_module_check_duplicate_import (context_p, local_name_p))\n      {\n        ecma_deref_ecma_string (local_name_p);\n        parser_raise_error (context_p, PARSER_ERR_DUPLICATED_IMPORT_BINDING);\n      }\n\n      ecma_string_t *import_name_p = ecma_get_magic_string (LIT_MAGIC_STRING_DEFAULT);\n      parser_module_add_names_to_node (context_p, import_name_p, local_name_p);\n\n      ecma_deref_ecma_string (local_name_p);\n      ecma_deref_ecma_string (import_name_p);\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_COMMA)\n      {\n        lexer_next_token (context_p);\n        if (context_p->token.type != LEXER_MULTIPLY && context_p->token.type != LEXER_LEFT_BRACE)\n        {\n          parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_MULTIPLY_EXPECTED);\n        }\n      }\n      else if (!lexer_token_is_identifier (context_p, \"from\", 4))\n      {\n        parser_raise_error (context_p, PARSER_ERR_FROM_COMMA_EXPECTED);\n      }\n    }\n\n    if (context_p->token.type == LEXER_MULTIPLY)\n    {\n      /* NameSpaceImport */\n      lexer_next_token (context_p);\n      if (!lexer_token_is_identifier (context_p, \"as\", 2))\n      {\n        parser_raise_error (context_p, PARSER_ERR_AS_EXPECTED);\n      }\n\n      lexer_next_token (context_p);\n      if (context_p->token.type != LEXER_LITERAL)\n      {\n        parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n      }\n\n      lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_IDENT_LITERAL);\n\n      ecma_string_t *local_name_p = parser_new_ecma_string_from_literal (context_p->lit_object.literal_p);\n\n      if (parser_module_check_duplicate_import (context_p, local_name_p))\n      {\n        ecma_deref_ecma_string (local_name_p);\n        parser_raise_error (context_p, PARSER_ERR_DUPLICATED_IMPORT_BINDING);\n      }\n\n      ecma_string_t *import_name_p = ecma_get_magic_string (LIT_MAGIC_STRING_ASTERIX_CHAR);\n\n      parser_module_add_names_to_node (context_p, import_name_p, local_name_p);\n      ecma_deref_ecma_string (local_name_p);\n      ecma_deref_ecma_string (import_name_p);\n\n      lexer_next_token (context_p);\n    }\n    else if (context_p->token.type == LEXER_LEFT_BRACE)\n    {\n      /* Handle NamedImports */\n      parser_module_parse_import_clause (context_p);\n    }\n\n    if (!lexer_token_is_identifier (context_p, \"from\", 4))\n    {\n      parser_raise_error (context_p, PARSER_ERR_FROM_EXPECTED);\n    }\n    lexer_next_token (context_p);\n  }\n\n  parser_module_handle_module_specifier (context_p, NULL);\n} /* parser_parse_import_statement */\n\n/**\n * Parse export statement.\n *\n * @return true - if function of class statement was found\n *         false - otherwise\n */\nstatic bool\nparser_parse_export_statement (parser_context_t *context_p) /**< context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_KEYW_EXPORT);\n  JERRY_ASSERT (context_p->module_names_p == NULL);\n\n  parser_module_check_request_place (context_p);\n\n  bool consume_last_statement = false;\n\n  lexer_next_token (context_p);\n  switch (context_p->token.type)\n  {\n    case LEXER_KEYW_DEFAULT:\n    {\n      scanner_location_t location;\n      scanner_get_location (&location, context_p);\n\n      context_p->status_flags |= PARSER_MODULE_STORE_IDENT;\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_LITERAL && lexer_token_is_async (context_p)\n          && context_p->next_scanner_info_p->source_p == context_p->source_p\n          && context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION)\n      {\n#if JERRY_FUNCTION_TO_STRING\n        context_p->function_start_p = context_p->token.lit_location.char_p;\n#endif /* JERRY_FUNCTION_TO_STRING */\n        lexer_next_token (context_p);\n      }\n\n      if (context_p->token.type == LEXER_KEYW_CLASS)\n      {\n        context_p->status_flags |= PARSER_MODULE_DEFAULT_CLASS_OR_FUNC;\n        parser_parse_class (context_p, true);\n        consume_last_statement = true;\n      }\n      else if (context_p->token.type == LEXER_KEYW_FUNCTION)\n      {\n        context_p->status_flags |= PARSER_MODULE_DEFAULT_CLASS_OR_FUNC;\n        parser_parse_function_statement (context_p);\n        consume_last_statement = true;\n      }\n      else\n      {\n        /* Assignment expression */\n        scanner_set_location (context_p, &location);\n\n        /* 15.2.3.5 Use the synthetic name '*default*' as the identifier. */\n        lexer_construct_literal_object (context_p, &lexer_default_literal, lexer_default_literal.type);\n\n        context_p->token.lit_location.type = LEXER_IDENT_LITERAL;\n        parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);\n\n        /* Do not overwrite this identifier. */\n        context_p->status_flags &= (uint32_t) ~PARSER_MODULE_STORE_IDENT;\n        context_p->module_identifier_lit_p = context_p->lit_object.literal_p;\n\n        /* Fake an assignment to the default identifier */\n        context_p->token.type = LEXER_ASSIGN;\n\n        parser_parse_expression_statement (context_p, PARSE_EXPR_NO_COMMA | PARSE_EXPR_HAS_LITERAL);\n      }\n\n      ecma_string_t *name_p = parser_new_ecma_string_from_literal (context_p->module_identifier_lit_p);\n\n      ecma_string_t *export_name_p = ecma_get_magic_string (LIT_MAGIC_STRING_DEFAULT);\n\n      if (parser_module_check_duplicate_export (context_p, export_name_p))\n      {\n        ecma_deref_ecma_string (name_p);\n        ecma_deref_ecma_string (export_name_p);\n        parser_raise_error (context_p, PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER);\n      }\n\n      parser_module_add_names_to_node (context_p, export_name_p, name_p);\n      ecma_deref_ecma_string (name_p);\n      ecma_deref_ecma_string (export_name_p);\n      break;\n    }\n    case LEXER_MULTIPLY:\n    {\n      lexer_next_token (context_p);\n\n      ecma_module_node_t **target_node_list_p = &(JERRY_CONTEXT (module_current_p)->star_exports_p);\n\n      if (lexer_token_is_identifier (context_p, \"as\", 2))\n      {\n        target_node_list_p = &(JERRY_CONTEXT (module_current_p)->indirect_exports_p);\n\n        lexer_next_token (context_p);\n\n        if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n        {\n          parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n        }\n\n        lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_NEW_IDENT_LITERAL);\n\n        lexer_literal_t *literal_p = PARSER_GET_LITERAL (context_p->lit_object.index);\n        ecma_string_t *export_name_p = parser_new_ecma_string_from_literal (literal_p);\n\n        if (parser_module_check_duplicate_export (context_p, export_name_p))\n        {\n          ecma_deref_ecma_string (export_name_p);\n          parser_raise_error (context_p, PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER);\n        }\n\n        ecma_string_t *local_name_p = ecma_get_magic_string (LIT_MAGIC_STRING_ASTERIX_CHAR);\n        parser_module_add_names_to_node (context_p, export_name_p, local_name_p);\n        ecma_deref_ecma_string (export_name_p);\n\n        lexer_next_token (context_p);\n      }\n\n      if (!lexer_token_is_identifier (context_p, \"from\", 4))\n      {\n        parser_raise_error (context_p, PARSER_ERR_FROM_EXPECTED);\n      }\n\n      lexer_next_token (context_p);\n      parser_module_handle_module_specifier (context_p, target_node_list_p);\n      return false;\n    }\n    case LEXER_KEYW_VAR:\n    case LEXER_KEYW_LET:\n    case LEXER_KEYW_CONST:\n    {\n      context_p->status_flags |= PARSER_MODULE_STORE_IDENT;\n      parser_parse_var_statement (context_p);\n      break;\n    }\n    case LEXER_KEYW_CLASS:\n    {\n      context_p->status_flags |= PARSER_MODULE_STORE_IDENT;\n      parser_parse_class (context_p, true);\n      consume_last_statement = true;\n      break;\n    }\n    case LEXER_KEYW_FUNCTION:\n    {\n      context_p->status_flags |= PARSER_MODULE_STORE_IDENT;\n      parser_parse_function_statement (context_p);\n      consume_last_statement = true;\n      break;\n    }\n    case LEXER_LEFT_BRACE:\n    {\n      parser_module_parse_export_clause (context_p);\n\n      if (lexer_token_is_identifier (context_p, \"from\", 4))\n      {\n        lexer_next_token (context_p);\n        parser_module_handle_module_specifier (context_p, &(JERRY_CONTEXT (module_current_p)->indirect_exports_p));\n        return false;\n      }\n      break;\n    }\n    default:\n    {\n      parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_MULTIPLY_LITERAL_EXPECTED);\n      break;\n    }\n  }\n\n  context_p->status_flags &= (uint32_t) ~(PARSER_MODULE_DEFAULT_CLASS_OR_FUNC | PARSER_MODULE_STORE_IDENT);\n  parser_module_append_names (context_p, &(JERRY_CONTEXT (module_current_p)->local_exports_p));\n\n  return consume_last_statement;\n} /* parser_parse_export_statement */\n#endif /* JERRY_MODULE_SYSTEM */\n\n/**\n * Parse label statement.\n */\nstatic void\nparser_parse_label (parser_context_t *context_p) /**< context */\n{\n  parser_stack_iterator_t iterator;\n  parser_label_statement_t label_statement;\n\n  parser_stack_iterator_init (context_p, &iterator);\n\n  while (true)\n  {\n    uint8_t type = parser_stack_iterator_read_uint8 (&iterator);\n    if (type == PARSER_STATEMENT_START)\n    {\n      break;\n    }\n\n    if (type == PARSER_STATEMENT_LABEL)\n    {\n      parser_stack_iterator_skip (&iterator, 1);\n      parser_stack_iterator_read (&iterator, &label_statement, sizeof (parser_label_statement_t));\n      parser_stack_iterator_skip (&iterator, sizeof (parser_label_statement_t));\n\n      if (lexer_current_is_literal (context_p, &label_statement.label_ident))\n      {\n        parser_raise_error (context_p, PARSER_ERR_DUPLICATED_LABEL);\n      }\n    }\n    else\n    {\n      parser_stack_iterator_skip (&iterator, parser_statement_length (type));\n    }\n  }\n\n  label_statement.label_ident = context_p->token.lit_location;\n  label_statement.break_list_p = NULL;\n  parser_stack_push (context_p, &label_statement, sizeof (parser_label_statement_t));\n  parser_stack_push_uint8 (context_p, PARSER_STATEMENT_LABEL);\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n} /* parser_parse_label */\n\n/**\n * Strict mode types for statement parsing.\n */\ntypedef enum\n{\n  PARSER_USE_STRICT_NOT_FOUND = 0, /**< 'use strict' directive is not found */\n  PARSER_USE_STRICT_FOUND = 1, /**< 'use strict' directive is found but strict mode has already been enabled */\n  PARSER_USE_STRICT_SET = 2, /**< strict mode is enabled after 'use strict' directive is found */\n} parser_strict_mode_type_t;\n\n/**\n * Parse statements.\n */\nvoid\nparser_parse_statements (parser_context_t *context_p) /**< context */\n{\n  /* Statement parsing cannot be nested. */\n  JERRY_ASSERT (context_p->last_statement.current_p == NULL);\n  parser_stack_push_uint8 (context_p, PARSER_STATEMENT_START);\n  parser_stack_iterator_init (context_p, &context_p->last_statement);\n\n#if JERRY_DEBUGGER\n  /* Set lexical enviroment for the debugger. */\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    context_p->status_flags |= PARSER_LEXICAL_ENV_NEEDED;\n    context_p->last_breakpoint_line = 0;\n  }\n#endif /* JERRY_DEBUGGER */\n\n  while (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL)\n  {\n    lexer_lit_location_t lit_location;\n    parser_strict_mode_type_t strict_mode = PARSER_USE_STRICT_NOT_FOUND;\n\n    JERRY_ASSERT (context_p->stack_depth <= 1);\n#ifndef JERRY_NDEBUG\n    JERRY_ASSERT (context_p->context_stack_depth == context_p->stack_depth);\n#endif /* !JERRY_NDEBUG */\n\n    if (lexer_string_is_use_strict (context_p))\n    {\n      strict_mode = PARSER_USE_STRICT_FOUND;\n\n      if (!(context_p->status_flags & PARSER_IS_STRICT))\n      {\n        /* The next token should be parsed in strict mode. */\n        context_p->status_flags |= PARSER_IS_STRICT;\n        strict_mode = PARSER_USE_STRICT_SET;\n      }\n    }\n\n    lit_location = context_p->token.lit_location;\n    lexer_next_token (context_p);\n\n    if (!lexer_string_is_directive (context_p))\n    {\n      /* The string is part of an expression statement. */\n      if (strict_mode == PARSER_USE_STRICT_SET)\n      {\n        context_p->status_flags &= (uint32_t) ~PARSER_IS_STRICT;\n      }\n\n#if JERRY_DEBUGGER\n      if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n      {\n        JERRY_ASSERT (context_p->last_breakpoint_line == 0);\n\n        parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);\n        parser_flush_cbc (context_p);\n\n        parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, context_p->token.line);\n\n        context_p->last_breakpoint_line = context_p->token.line;\n      }\n#endif /* JERRY_DEBUGGER */\n#if JERRY_LINE_INFO\n      parser_line_info_append (context_p, context_p->token.line, context_p->token.column);\n#endif /* JERRY_LINE_INFO */\n\n      lexer_construct_literal_object (context_p, &lit_location, LEXER_STRING_LITERAL);\n      parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);\n      /* The extra_value is used for saving the token. */\n      context_p->token.extra_value = context_p->token.type;\n      context_p->token.type = LEXER_EXPRESSION_START;\n      break;\n    }\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n    if (strict_mode == PARSER_USE_STRICT_SET && context_p->is_show_opcodes)\n    {\n      JERRY_DEBUG_MSG (\"  Note: switch to strict mode\\n\\n\");\n    }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n    if (strict_mode != PARSER_USE_STRICT_NOT_FOUND && (context_p->status_flags & PARSER_FUNCTION_HAS_COMPLEX_ARGUMENT))\n    {\n      parser_raise_error (context_p, PARSER_ERR_USE_STRICT_NOT_ALLOWED);\n    }\n\n    if (context_p->token.type == LEXER_SEMICOLON)\n    {\n      lexer_next_token (context_p);\n    }\n\n    /* The last directive prologue can be the result of the script. */\n    if (!(context_p->status_flags & PARSER_IS_FUNCTION)\n        && (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_STRING_LITERAL))\n    {\n      lexer_construct_literal_object (context_p, &lit_location, LEXER_STRING_LITERAL);\n      parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);\n      parser_emit_cbc (context_p, CBC_POP_BLOCK);\n      parser_flush_cbc (context_p);\n      break;\n    }\n  }\n\n  if (context_p->status_flags & PARSER_IS_STRICT && context_p->status_flags & PARSER_HAS_NON_STRICT_ARG)\n  {\n    parser_raise_error (context_p, PARSER_ERR_NON_STRICT_ARG_DEFINITION);\n  }\n\n  while (context_p->token.type != LEXER_EOS || context_p->stack_top_uint8 != PARSER_STATEMENT_START)\n  {\n#ifndef JERRY_NDEBUG\n    JERRY_ASSERT (context_p->stack_depth == context_p->context_stack_depth);\n#endif /* !JERRY_NDEBUG */\n\n    JERRY_ASSERT (context_p->stack_top_uint8 != PARSER_STATEMENT_PRIVATE_SCOPE\n                  && context_p->stack_top_uint8 != PARSER_STATEMENT_PRIVATE_CONTEXT);\n\n#if JERRY_DEBUGGER\n    if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED\n        && context_p->token.line != context_p->last_breakpoint_line && context_p->token.type != LEXER_SEMICOLON\n        && context_p->token.type != LEXER_LEFT_BRACE && context_p->token.type != LEXER_RIGHT_BRACE\n        && context_p->token.type != LEXER_KEYW_VAR && context_p->token.type != LEXER_KEYW_LET\n        && context_p->token.type != LEXER_KEYW_CONST && context_p->token.type != LEXER_KEYW_FUNCTION\n        && context_p->token.type != LEXER_KEYW_CASE && context_p->token.type != LEXER_KEYW_DEFAULT)\n    {\n      parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);\n      parser_flush_cbc (context_p);\n\n      parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, context_p->token.line);\n\n      context_p->last_breakpoint_line = context_p->token.line;\n    }\n#endif /* JERRY_DEBUGGER */\n\n#if JERRY_LINE_INFO\n    if (context_p->token.type != LEXER_SEMICOLON && context_p->token.type != LEXER_LEFT_BRACE\n        && context_p->token.type != LEXER_RIGHT_BRACE && context_p->token.type != LEXER_KEYW_VAR\n        && context_p->token.type != LEXER_KEYW_LET && context_p->token.type != LEXER_KEYW_CONST\n        && context_p->token.type != LEXER_KEYW_FUNCTION && context_p->token.type != LEXER_KEYW_CASE\n        && context_p->token.type != LEXER_KEYW_DEFAULT)\n    {\n      parser_line_info_append (context_p, context_p->token.line, context_p->token.column);\n    }\n#endif /* JERRY_LINE_INFO */\n\n    switch (context_p->token.type)\n    {\n      case LEXER_SEMICOLON:\n      {\n        break;\n      }\n\n      case LEXER_RIGHT_BRACE:\n      {\n        if (parser_statement_flags[context_p->stack_top_uint8] & PARSER_STATM_SINGLE_STATM)\n        {\n          parser_raise_error (context_p, PARSER_ERR_STATEMENT_EXPECTED);\n        }\n        break;\n      }\n\n      case LEXER_LEFT_BRACE:\n      {\n        if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n        {\n          parser_push_block_context (context_p, false);\n        }\n        else\n        {\n          parser_stack_push_uint8 (context_p, PARSER_STATEMENT_BLOCK);\n        }\n\n        parser_stack_iterator_init (context_p, &context_p->last_statement);\n        lexer_next_token (context_p);\n        continue;\n      }\n\n      case LEXER_KEYW_VAR:\n      case LEXER_KEYW_LET:\n      case LEXER_KEYW_CONST:\n      {\n        parser_parse_var_statement (context_p);\n        break;\n      }\n      case LEXER_KEYW_CLASS:\n      {\n        parser_validate_lexical_context (context_p);\n        parser_parse_class (context_p, true);\n        goto consume_last_statement;\n      }\n#if JERRY_MODULE_SYSTEM\n      case LEXER_KEYW_IMPORT:\n      {\n        parser_parse_import_statement (context_p);\n        break;\n      }\n\n      case LEXER_KEYW_EXPORT:\n      {\n        if (parser_parse_export_statement (context_p))\n        {\n          goto consume_last_statement;\n        }\n        break;\n      }\n#endif /* JERRY_MODULE_SYSTEM */\n\n      case LEXER_KEYW_FUNCTION:\n      {\n        parser_parse_function_statement (context_p);\n        goto consume_last_statement;\n      }\n\n      case LEXER_KEYW_IF:\n      {\n        parser_parse_if_statement_start (context_p);\n        continue;\n      }\n\n      case LEXER_KEYW_SWITCH:\n      {\n        parser_parse_switch_statement_start (context_p);\n        continue;\n      }\n\n      case LEXER_KEYW_DO:\n      {\n        parser_do_while_statement_t do_while_statement;\n        parser_loop_statement_t loop;\n\n        JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);\n\n        do_while_statement.start_offset = context_p->byte_code_size;\n        loop.branch_list_p = NULL;\n\n        parser_stack_push (context_p, &do_while_statement, sizeof (parser_do_while_statement_t));\n        parser_stack_push (context_p, &loop, sizeof (parser_loop_statement_t));\n        parser_stack_push_uint8 (context_p, PARSER_STATEMENT_DO_WHILE);\n        parser_stack_iterator_init (context_p, &context_p->last_statement);\n        lexer_next_token (context_p);\n        continue;\n      }\n\n      case LEXER_KEYW_WHILE:\n      {\n        parser_parse_while_statement_start (context_p);\n        continue;\n      }\n\n      case LEXER_KEYW_FOR:\n      {\n        parser_parse_for_statement_start (context_p);\n        continue;\n      }\n\n      case LEXER_KEYW_WITH:\n      {\n        parser_parse_with_statement_start (context_p);\n        continue;\n      }\n\n      case LEXER_KEYW_TRY:\n      {\n        parser_try_statement_t try_statement;\n\n        lexer_next_token (context_p);\n\n        if (context_p->token.type != LEXER_LEFT_BRACE)\n        {\n          parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_EXPECTED);\n        }\n\n#ifndef JERRY_NDEBUG\n        PARSER_PLUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n\n        try_statement.type = parser_try_block;\n        parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_TRY_CREATE_CONTEXT, &try_statement.branch);\n\n        try_statement.scope_stack_top = context_p->scope_stack_top;\n        try_statement.scope_stack_reg_top = context_p->scope_stack_reg_top;\n\n        if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n        {\n          JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_BLOCK);\n\n          if (scanner_is_context_needed (context_p, PARSER_CHECK_BLOCK_CONTEXT))\n          {\n            parser_emit_cbc_ext (context_p, CBC_EXT_TRY_CREATE_ENV);\n          }\n\n          scanner_create_variables (context_p, SCANNER_CREATE_VARS_NO_OPTS);\n        }\n\n        parser_stack_push (context_p, &try_statement, sizeof (parser_try_statement_t));\n        parser_stack_push_uint8 (context_p, PARSER_STATEMENT_TRY);\n        parser_stack_iterator_init (context_p, &context_p->last_statement);\n        lexer_next_token (context_p);\n        continue;\n      }\n\n      case LEXER_KEYW_DEFAULT:\n      {\n        parser_parse_default_statement (context_p);\n        continue;\n      }\n\n      case LEXER_KEYW_CASE:\n      {\n        parser_parse_case_statement (context_p);\n        continue;\n      }\n\n      case LEXER_KEYW_BREAK:\n      {\n        parser_parse_break_statement (context_p);\n        break;\n      }\n\n      case LEXER_KEYW_CONTINUE:\n      {\n        parser_parse_continue_statement (context_p);\n        break;\n      }\n\n      case LEXER_KEYW_THROW:\n      {\n        lexer_next_token (context_p);\n        if (context_p->token.flags & LEXER_WAS_NEWLINE)\n        {\n          parser_raise_error (context_p, PARSER_ERR_EXPRESSION_EXPECTED);\n        }\n        parser_parse_expression (context_p, PARSE_EXPR);\n        parser_emit_cbc (context_p, CBC_THROW);\n        break;\n      }\n\n      case LEXER_KEYW_RETURN:\n      {\n        if (!(context_p->status_flags & PARSER_IS_FUNCTION))\n        {\n          parser_raise_error (context_p, PARSER_ERR_INVALID_RETURN);\n        }\n        if (context_p->status_flags & PARSER_IS_CLASS_STATIC_BLOCK)\n        {\n          parser_raise_error (context_p, PARSER_ERR_INVALID_RETURN);\n        }\n\n        lexer_next_token (context_p);\n\n        if ((context_p->token.flags & LEXER_WAS_NEWLINE) || context_p->token.type == LEXER_SEMICOLON\n            || context_p->token.type == LEXER_EOS || context_p->token.type == LEXER_RIGHT_BRACE)\n        {\n          if (context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)\n          {\n            parser_emit_cbc_ext (context_p, CBC_EXT_RETURN_UNDEFINED);\n            break;\n          }\n\n          parser_emit_cbc (context_p, CBC_RETURN_FUNCTION_END);\n          break;\n        }\n\n        parser_parse_expression (context_p, PARSE_EXPR);\n\n        if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n        {\n          context_p->last_cbc_opcode = CBC_RETURN_WITH_LITERAL;\n          break;\n        }\n\n        parser_emit_cbc (context_p, CBC_RETURN);\n        break;\n      }\n\n      case LEXER_KEYW_DEBUGGER:\n      {\n#if JERRY_DEBUGGER\n        /* This breakpoint location is not reported to the\n         * debugger, so it is impossible to disable it. */\n        if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n        {\n          parser_emit_cbc (context_p, CBC_BREAKPOINT_ENABLED);\n        }\n#endif /* JERRY_DEBUGGER */\n        lexer_next_token (context_p);\n        break;\n      }\n\n      case LEXER_LITERAL:\n      {\n        if (context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n        {\n          if (JERRY_UNLIKELY (lexer_check_next_character (context_p, LIT_CHAR_COLON)))\n          {\n            parser_parse_label (context_p);\n            lexer_consume_next_character (context_p);\n            lexer_next_token (context_p);\n            continue;\n          }\n\n          if (JERRY_UNLIKELY (lexer_token_is_let (context_p)))\n          {\n            if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n            {\n              if (context_p->next_scanner_info_p->type == SCANNER_TYPE_LET_EXPRESSION)\n              {\n                scanner_release_next (context_p, sizeof (scanner_info_t));\n              }\n\n              if (context_p->status_flags & PARSER_IS_FUNCTION)\n              {\n                parser_parse_expression_statement (context_p, PARSE_EXPR);\n                break;\n              }\n\n              parser_parse_block_expression (context_p, PARSE_EXPR);\n              break;\n            }\n\n            context_p->token.type = LEXER_KEYW_LET;\n            parser_parse_var_statement (context_p);\n            break;\n          }\n\n          if (JERRY_UNLIKELY (lexer_token_is_async (context_p))\n              && context_p->next_scanner_info_p->source_p == context_p->source_p)\n          {\n            bool is_statement = true;\n\n            if (context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION)\n            {\n              is_statement = (context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_STATEMENT) != 0;\n\n              JERRY_ASSERT (!is_statement || (context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_ASYNC));\n            }\n            else\n            {\n              JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_ASYNC_FUNCTION);\n\n              scanner_release_next (context_p, sizeof (scanner_info_t));\n            }\n\n            if (is_statement)\n            {\n              if (parser_statement_flags[context_p->stack_top_uint8] & PARSER_STATM_SINGLE_STATM)\n              {\n                parser_raise_error (context_p, PARSER_ERR_LEXICAL_SINGLE_STATEMENT);\n              }\n\n#if JERRY_FUNCTION_TO_STRING\n              context_p->function_start_p = context_p->token.lit_location.char_p;\n#endif /* JERRY_FUNCTION_TO_STRING */\n              lexer_next_token (context_p);\n              JERRY_ASSERT (context_p->token.type == LEXER_KEYW_FUNCTION);\n              continue;\n            }\n          }\n        }\n        /* FALLTHRU */\n      }\n\n      default:\n      {\n        int options = PARSE_EXPR;\n\n        if (context_p->token.type == LEXER_EXPRESSION_START)\n        {\n          /* Restore the token type form the extra_value. */\n          context_p->token.type = context_p->token.extra_value;\n          options |= PARSE_EXPR_HAS_LITERAL;\n        }\n\n        if (context_p->status_flags & PARSER_IS_FUNCTION)\n        {\n          parser_parse_expression_statement (context_p, options);\n        }\n        else\n        {\n          parser_parse_block_expression (context_p, options);\n        }\n\n        break;\n      }\n    }\n\n    parser_flush_cbc (context_p);\n\n    if (context_p->token.type == LEXER_RIGHT_BRACE)\n    {\n      if (context_p->stack_top_uint8 == PARSER_STATEMENT_BLOCK)\n      {\n        parser_stack_pop_uint8 (context_p);\n        parser_stack_iterator_init (context_p, &context_p->last_statement);\n        lexer_next_token (context_p);\n      }\n      else if (context_p->stack_top_uint8 == PARSER_STATEMENT_BLOCK_SCOPE\n               || context_p->stack_top_uint8 == PARSER_STATEMENT_BLOCK_CONTEXT)\n      {\n        parser_pop_block_context (context_p);\n        lexer_next_token (context_p);\n      }\n      else if (context_p->stack_top_uint8 == PARSER_STATEMENT_SWITCH\n               || context_p->stack_top_uint8 == PARSER_STATEMENT_SWITCH_NO_DEFAULT)\n      {\n        int has_default = (context_p->stack_top_uint8 == PARSER_STATEMENT_SWITCH);\n        parser_loop_statement_t loop;\n        parser_switch_statement_t switch_statement;\n\n        parser_stack_pop_uint8 (context_p);\n        parser_stack_pop (context_p, &loop, sizeof (parser_loop_statement_t));\n        parser_stack_pop (context_p, &switch_statement, sizeof (parser_switch_statement_t));\n        parser_stack_iterator_init (context_p, &context_p->last_statement);\n\n        JERRY_ASSERT (switch_statement.branch_list_p == NULL);\n\n        if (!has_default)\n        {\n          parser_set_branch_to_current_position (context_p, &switch_statement.default_branch);\n        }\n\n        parser_set_breaks_to_current_position (context_p, loop.branch_list_p);\n        lexer_next_token (context_p);\n\n        if (context_p->stack_top_uint8 == PARSER_STATEMENT_PRIVATE_SCOPE\n            || context_p->stack_top_uint8 == PARSER_STATEMENT_PRIVATE_CONTEXT)\n        {\n          parser_pop_block_context (context_p);\n        }\n      }\n      else if (context_p->stack_top_uint8 == PARSER_STATEMENT_TRY)\n      {\n        parser_parse_try_statement_end (context_p);\n      }\n      else if (context_p->stack_top_uint8 == PARSER_STATEMENT_START)\n      {\n        if (context_p->status_flags & PARSER_IS_CLOSURE)\n        {\n#if JERRY_LINE_INFO\n          if (context_p->line_info_p == NULL)\n          {\n            parser_line_info_append (context_p, context_p->token.line, context_p->token.column);\n          }\n#endif /* JERRY_LINE_INFO */\n\n#if JERRY_FUNCTION_TO_STRING\n          context_p->function_end_p = context_p->source_p;\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n          parser_stack_pop_uint8 (context_p);\n          context_p->last_statement.current_p = NULL;\n          /* There is no lexer_next_token here, since the\n           * next token belongs to the parent context. */\n          return;\n        }\n        parser_raise_error (context_p, PARSER_ERR_INVALID_RIGHT_SQUARE);\n      }\n    }\n    else if (context_p->token.type == LEXER_SEMICOLON)\n    {\n      lexer_next_token (context_p);\n    }\n    else if (context_p->token.type != LEXER_EOS && !(context_p->token.flags & LEXER_WAS_NEWLINE))\n    {\n      parser_raise_error (context_p, PARSER_ERR_SEMICOLON_EXPECTED);\n    }\n\nconsume_last_statement:\n    while (true)\n    {\n      switch (context_p->stack_top_uint8)\n      {\n        case PARSER_STATEMENT_LABEL:\n        {\n          parser_label_statement_t label;\n\n          parser_stack_pop_uint8 (context_p);\n          parser_stack_pop (context_p, &label, sizeof (parser_label_statement_t));\n          parser_stack_iterator_init (context_p, &context_p->last_statement);\n\n          parser_set_breaks_to_current_position (context_p, label.break_list_p);\n          continue;\n        }\n\n        case PARSER_STATEMENT_IF:\n        {\n          if (parser_parse_if_statement_end (context_p))\n          {\n            break;\n          }\n          continue;\n        }\n\n        case PARSER_STATEMENT_ELSE:\n        {\n          parser_if_else_statement_t else_statement;\n\n          parser_stack_pop_uint8 (context_p);\n          parser_stack_pop (context_p, &else_statement, sizeof (parser_if_else_statement_t));\n          parser_stack_iterator_init (context_p, &context_p->last_statement);\n\n          parser_set_branch_to_current_position (context_p, &else_statement.branch);\n          continue;\n        }\n\n        case PARSER_STATEMENT_DO_WHILE:\n        {\n          parser_parse_do_while_statement_end (context_p);\n          if (context_p->token.type == LEXER_SEMICOLON)\n          {\n            lexer_next_token (context_p);\n          }\n          continue;\n        }\n\n        case PARSER_STATEMENT_WHILE:\n        {\n          parser_parse_while_statement_end (context_p);\n          continue;\n        }\n\n        case PARSER_STATEMENT_FOR:\n        {\n          parser_parse_for_statement_end (context_p);\n          continue;\n        }\n\n        case PARSER_STATEMENT_FOR_IN:\n        case PARSER_STATEMENT_FOR_OF:\n        case PARSER_STATEMENT_FOR_AWAIT_OF:\n        {\n          parser_for_in_of_statement_t for_in_of_statement;\n          parser_loop_statement_t loop;\n\n          uint8_t for_type = context_p->stack_top_uint8;\n\n          parser_stack_pop_uint8 (context_p);\n          parser_stack_pop (context_p, &loop, sizeof (parser_loop_statement_t));\n          parser_stack_pop (context_p, &for_in_of_statement, sizeof (parser_for_in_of_statement_t));\n          parser_stack_iterator_init (context_p, &context_p->last_statement);\n\n          parser_set_continues_to_current_position (context_p, loop.branch_list_p);\n\n          parser_flush_cbc (context_p);\n\n          uint16_t stack_allocation = PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION;\n          if (for_type != PARSER_STATEMENT_FOR_IN)\n          {\n            stack_allocation = (for_type == PARSER_STATEMENT_FOR_OF ? PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION\n                                                                    : PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION);\n          }\n\n          PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, stack_allocation);\n#ifndef JERRY_NDEBUG\n          PARSER_MINUS_EQUAL_U16 (context_p->context_stack_depth, stack_allocation);\n#endif /* !JERRY_NDEBUG */\n\n          cbc_ext_opcode_t opcode = CBC_EXT_BRANCH_IF_FOR_IN_HAS_NEXT;\n\n          if (for_type != PARSER_STATEMENT_FOR_IN)\n          {\n            opcode = (for_type == PARSER_STATEMENT_FOR_OF ? CBC_EXT_BRANCH_IF_FOR_OF_HAS_NEXT\n                                                          : CBC_EXT_BRANCH_IF_FOR_AWAIT_OF_HAS_NEXT);\n          }\n\n          parser_emit_cbc_ext_backward_branch (context_p, opcode, for_in_of_statement.start_offset);\n\n          parser_set_breaks_to_current_position (context_p, loop.branch_list_p);\n          parser_set_branch_to_current_position (context_p, &for_in_of_statement.branch);\n\n          if (context_p->stack_top_uint8 == PARSER_STATEMENT_PRIVATE_SCOPE\n              || context_p->stack_top_uint8 == PARSER_STATEMENT_PRIVATE_CONTEXT)\n          {\n            parser_pop_block_context (context_p);\n          }\n\n          continue;\n        }\n\n        case PARSER_STATEMENT_WITH:\n        {\n          parser_parse_with_statement_end (context_p);\n          continue;\n        }\n\n        default:\n        {\n          break;\n        }\n      }\n      break;\n    }\n  }\n\n  parser_stack_pop_uint8 (context_p);\n  context_p->last_statement.current_p = NULL;\n\n  if (context_p->status_flags & PARSER_IS_CLOSURE)\n  {\n    parser_raise_error (context_p, PARSER_ERR_STATEMENT_EXPECTED);\n  }\n\n#if JERRY_LINE_INFO\n  if (context_p->line_info_p == NULL)\n  {\n    parser_line_info_append (context_p, context_p->token.line, context_p->token.column);\n  }\n#endif /* JERRY_LINE_INFO */\n} /* parser_parse_statements */\n\n/**\n * Free jumps stored on the stack if a parse error is occurred.\n */\nvoid JERRY_ATTR_NOINLINE\nparser_free_jumps (parser_stack_iterator_t iterator) /**< iterator position */\n{\n  while (true)\n  {\n    uint8_t type = parser_stack_iterator_read_uint8 (&iterator);\n    parser_branch_node_t *branch_list_p = NULL;\n\n    switch (type)\n    {\n      case PARSER_STATEMENT_START:\n      {\n        return;\n      }\n\n      case PARSER_STATEMENT_LABEL:\n      {\n        parser_label_statement_t label;\n\n        parser_stack_iterator_skip (&iterator, 1);\n        parser_stack_iterator_read (&iterator, &label, sizeof (parser_label_statement_t));\n        parser_stack_iterator_skip (&iterator, sizeof (parser_label_statement_t));\n        branch_list_p = label.break_list_p;\n        break;\n      }\n\n      case PARSER_STATEMENT_SWITCH:\n      case PARSER_STATEMENT_SWITCH_NO_DEFAULT:\n      {\n        parser_switch_statement_t switch_statement;\n        parser_loop_statement_t loop;\n\n        parser_stack_iterator_skip (&iterator, 1);\n        parser_stack_iterator_read (&iterator, &loop, sizeof (parser_loop_statement_t));\n        parser_stack_iterator_skip (&iterator, sizeof (parser_loop_statement_t));\n        parser_stack_iterator_read (&iterator, &switch_statement, sizeof (parser_switch_statement_t));\n        parser_stack_iterator_skip (&iterator, sizeof (parser_switch_statement_t));\n\n        branch_list_p = switch_statement.branch_list_p;\n        while (branch_list_p != NULL)\n        {\n          parser_branch_node_t *next_p = branch_list_p->next_p;\n          parser_free (branch_list_p, sizeof (parser_branch_node_t));\n          branch_list_p = next_p;\n        }\n        branch_list_p = loop.branch_list_p;\n        break;\n      }\n\n      case PARSER_STATEMENT_DO_WHILE:\n      case PARSER_STATEMENT_WHILE:\n      case PARSER_STATEMENT_FOR:\n      case PARSER_STATEMENT_FOR_IN:\n      case PARSER_STATEMENT_FOR_OF:\n      {\n        parser_loop_statement_t loop;\n\n        parser_stack_iterator_skip (&iterator, 1);\n        parser_stack_iterator_read (&iterator, &loop, sizeof (parser_loop_statement_t));\n        parser_stack_iterator_skip (&iterator, parser_statement_length (type) - 1);\n        branch_list_p = loop.branch_list_p;\n        break;\n      }\n\n      default:\n      {\n        parser_stack_iterator_skip (&iterator, parser_statement_length (type));\n        continue;\n      }\n    }\n\n    while (branch_list_p != NULL)\n    {\n      parser_branch_node_t *next_p = branch_list_p->next_p;\n      parser_free (branch_list_p, sizeof (parser_branch_node_t));\n      branch_list_p = next_p;\n    }\n  }\n} /* parser_free_jumps */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_PARSER */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser-tagged-template-literal.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"js-parser-tagged-template-literal.h\"\n\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"js-lexer.h\"\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_tagged_template_literal Tagged template literal\n * @{\n */\n\n/**\n * Append the cooked and raw string to the corresponding array\n */\nvoid\nparser_tagged_template_literal_append_strings (parser_context_t *context_p, /**< parser context */\n                                               ecma_object_t *template_obj_p, /**< template object */\n                                               ecma_object_t *raw_strings_p, /**< raw strings object */\n                                               uint32_t prop_idx) /**< property index to set the values */\n{\n  lexer_lit_location_t *lit_loc_p = &context_p->token.lit_location;\n\n  if (lit_loc_p->length == 0 && !(lit_loc_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))\n  {\n    ecma_builtin_helper_def_prop_by_index (template_obj_p,\n                                           prop_idx,\n                                           ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY),\n                                           ECMA_PROPERTY_FLAG_ENUMERABLE);\n\n    ecma_builtin_helper_def_prop_by_index (raw_strings_p,\n                                           prop_idx,\n                                           ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY),\n                                           ECMA_PROPERTY_FLAG_ENUMERABLE);\n    return;\n  }\n\n  uint8_t local_byte_array[LEXER_MAX_LITERAL_LOCAL_BUFFER_SIZE];\n  const uint8_t *source_p =\n    lexer_convert_literal_to_chars (context_p, &context_p->token.lit_location, local_byte_array, LEXER_STRING_NO_OPTS);\n\n  ecma_string_t *raw_str_p;\n  ecma_string_t *cooked_str_p =\n    ((lit_loc_p->status_flags & LEXER_FLAG_ASCII) ? ecma_new_ecma_string_from_ascii (source_p, lit_loc_p->length)\n                                                  : ecma_new_ecma_string_from_utf8 (source_p, lit_loc_p->length));\n\n  parser_free_allocated_buffer (context_p);\n\n  if (lit_loc_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)\n  {\n    context_p->source_p = context_p->token.lit_location.char_p - 1;\n    lexer_parse_string (context_p, LEXER_STRING_RAW);\n    source_p =\n      lexer_convert_literal_to_chars (context_p, &context_p->token.lit_location, local_byte_array, LEXER_STRING_RAW);\n\n    raw_str_p =\n      ((lit_loc_p->status_flags & LEXER_FLAG_ASCII) ? ecma_new_ecma_string_from_ascii (source_p, lit_loc_p->length)\n                                                    : ecma_new_ecma_string_from_utf8 (source_p, lit_loc_p->length));\n\n    parser_free_allocated_buffer (context_p);\n  }\n  else\n  {\n    ecma_ref_ecma_string (cooked_str_p);\n    raw_str_p = cooked_str_p;\n  }\n\n  ecma_builtin_helper_def_prop_by_index (template_obj_p,\n                                         prop_idx,\n                                         ecma_make_string_value (cooked_str_p),\n                                         ECMA_PROPERTY_FLAG_ENUMERABLE);\n\n  ecma_builtin_helper_def_prop_by_index (raw_strings_p,\n                                         prop_idx,\n                                         ecma_make_string_value (raw_str_p),\n                                         ECMA_PROPERTY_FLAG_ENUMERABLE);\n\n  ecma_deref_ecma_string (cooked_str_p);\n  ecma_deref_ecma_string (raw_str_p);\n} /* parser_tagged_template_literal_append_strings */\n\n/**\n * Create new tagged template literal object\n *\n * @return pointer to the allocated object\n */\necma_object_t *\nparser_new_tagged_template_literal (ecma_object_t **raw_strings_p) /**< [out] raw strings object */\n{\n  ecma_object_t *template_obj_p = ecma_op_new_array_object (0);\n  *raw_strings_p = ecma_op_new_array_object (0);\n\n  ecma_extended_object_t *template_ext_obj_p = (ecma_extended_object_t *) template_obj_p;\n  ecma_extended_object_t *raw_ext_obj_p = (ecma_extended_object_t *) *raw_strings_p;\n\n  const uint8_t flags = ECMA_PROPERTY_VIRTUAL | ECMA_PROPERTY_FLAG_WRITABLE | ECMA_FAST_ARRAY_FLAG;\n  JERRY_ASSERT (template_ext_obj_p->u.array.length_prop_and_hole_count == flags);\n  JERRY_ASSERT (raw_ext_obj_p->u.array.length_prop_and_hole_count == flags);\n\n  template_ext_obj_p->u.array.length_prop_and_hole_count = flags | ECMA_ARRAY_TEMPLATE_LITERAL;\n  raw_ext_obj_p->u.array.length_prop_and_hole_count = flags | ECMA_ARRAY_TEMPLATE_LITERAL;\n\n  ecma_builtin_helper_def_prop (template_obj_p,\n                                ecma_get_magic_string (LIT_MAGIC_STRING_RAW),\n                                ecma_make_object_value (*raw_strings_p),\n                                ECMA_PROPERTY_FIXED);\n\n  return template_obj_p;\n} /* parser_new_tagged_template_literal */\n\n/**\n * Set integrity level of the given template array object to \"frozen\"\n */\nstatic void\nparser_tagged_template_literal_freeze_array (ecma_object_t *obj_p /**< template object */)\n{\n  JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_ARRAY);\n  ecma_op_ordinary_object_prevent_extensions (obj_p);\n  ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;\n  ext_obj_p->u.array.length_prop_and_hole_count &= (uint32_t) ~ECMA_PROPERTY_FLAG_WRITABLE;\n} /* parser_tagged_template_literal_freeze_array */\n\n/**\n * Finalize the tagged template object\n */\nvoid\nparser_tagged_template_literal_finalize (ecma_object_t *template_obj_p, /**< template object */\n                                         ecma_object_t *raw_strings_p) /**< raw strings object */\n{\n  parser_tagged_template_literal_freeze_array (template_obj_p);\n  parser_tagged_template_literal_freeze_array (raw_strings_p);\n} /* parser_tagged_template_literal_finalize */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser-tagged-template-literal.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef ECMA_TAGGED_TEMPLATE_LITERAL_H\n#define ECMA_TAGGED_TEMPLATE_LITERAL_H\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_tagged_template_literal Tagged template literal\n * @{\n */\n\n#include \"ecma-globals.h\"\n\n#include \"common.h\"\n#include \"js-parser-internal.h\"\n\necma_object_t *parser_new_tagged_template_literal (ecma_object_t **raw_strings_p);\n\nvoid parser_tagged_template_literal_append_strings (parser_context_t *context_p,\n                                                    ecma_object_t *template_obj_p,\n                                                    ecma_object_t *raw_strings_p,\n                                                    uint32_t prop_index);\n\nvoid parser_tagged_template_literal_finalize (ecma_object_t *template_obj_p, ecma_object_t *raw_strings_p);\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* ECMA_TAGGED_TEMPLATE_LITERAL_H */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser-util.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-helpers.h\"\n\n#include \"js-parser-internal.h\"\n\n#if JERRY_PARSER\n\n#if JERRY_LINE_INFO\n#include \"jcontext.h\"\n#endif /* JERRY_LINE_INFO */\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_utils Utility\n * @{\n */\n\n/**********************************************************************/\n/* Emitting byte codes                                                */\n/**********************************************************************/\n\n/**\n * Append two bytes to the cbc stream.\n */\nstatic void\nparser_emit_two_bytes (parser_context_t *context_p, /**< context */\n                       uint8_t first_byte, /**< first byte */\n                       uint8_t second_byte) /**< second byte */\n{\n  uint32_t last_position = context_p->byte_code.last_position;\n\n  if (last_position + 2 <= PARSER_CBC_STREAM_PAGE_SIZE)\n  {\n    parser_mem_page_t *page_p = context_p->byte_code.last_p;\n\n    page_p->bytes[last_position] = first_byte;\n    page_p->bytes[last_position + 1] = second_byte;\n    context_p->byte_code.last_position = last_position + 2;\n  }\n  else if (last_position >= PARSER_CBC_STREAM_PAGE_SIZE)\n  {\n    parser_mem_page_t *page_p;\n\n    parser_cbc_stream_alloc_page (context_p, &context_p->byte_code);\n    page_p = context_p->byte_code.last_p;\n    page_p->bytes[0] = first_byte;\n    page_p->bytes[1] = second_byte;\n    context_p->byte_code.last_position = 2;\n  }\n  else\n  {\n    context_p->byte_code.last_p->bytes[PARSER_CBC_STREAM_PAGE_SIZE - 1] = first_byte;\n    parser_cbc_stream_alloc_page (context_p, &context_p->byte_code);\n    context_p->byte_code.last_p->bytes[0] = second_byte;\n    context_p->byte_code.last_position = 1;\n  }\n} /* parser_emit_two_bytes */\n\n/**\n * Append byte to the end of the current byte code stream.\n *\n * @param context_p parser context\n * @param byte byte\n */\n#define PARSER_APPEND_TO_BYTE_CODE(context_p, byte)                        \\\n  if ((context_p)->byte_code.last_position >= PARSER_CBC_STREAM_PAGE_SIZE) \\\n  {                                                                        \\\n    parser_cbc_stream_alloc_page ((context_p), &(context_p)->byte_code);   \\\n  }                                                                        \\\n  (context_p)->byte_code.last_p->bytes[(context_p)->byte_code.last_position++] = (uint8_t) (byte)\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n\n/**\n * Print literal corresponding to the current index\n */\nstatic void\nparser_print_literal (parser_context_t *context_p, /**< context */\n                      uint16_t literal_index) /**< index of literal */\n{\n  parser_scope_stack_t *scope_stack_p = context_p->scope_stack_p;\n  parser_scope_stack_t *scope_stack_end_p = scope_stack_p + context_p->scope_stack_top;\n  bool in_scope_literal = false;\n\n  while (scope_stack_p < scope_stack_end_p)\n  {\n    scope_stack_end_p--;\n\n    if (scope_stack_end_p->map_from == PARSER_SCOPE_STACK_FUNC)\n    {\n      if (literal_index == scope_stack_end_p->map_to)\n      {\n        in_scope_literal = true;\n        break;\n      }\n    }\n    else if (literal_index == scanner_decode_map_to (scope_stack_end_p))\n    {\n      in_scope_literal = true;\n      break;\n    }\n  }\n\n  if (literal_index < PARSER_REGISTER_START)\n  {\n    JERRY_DEBUG_MSG (in_scope_literal ? \" IDX:%d->\" : \" idx:%d->\", literal_index);\n    lexer_literal_t *literal_p = PARSER_GET_LITERAL (literal_index);\n    util_print_literal (literal_p);\n    return;\n  }\n\n  if (!in_scope_literal)\n  {\n    JERRY_DEBUG_MSG (\" reg:%d\", (int) (literal_index - PARSER_REGISTER_START));\n    return;\n  }\n\n  JERRY_DEBUG_MSG (\" REG:%d->\", (int) (literal_index - PARSER_REGISTER_START));\n\n  lexer_literal_t *literal_p = PARSER_GET_LITERAL (scope_stack_end_p->map_from);\n  util_print_literal (literal_p);\n} /* parser_print_literal */\n\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n/**\n * Append the current byte code to the stream\n */\nvoid\nparser_flush_cbc (parser_context_t *context_p) /**< context */\n{\n  uint8_t flags;\n  uint16_t last_opcode = context_p->last_cbc_opcode;\n\n  if (last_opcode == PARSER_CBC_UNAVAILABLE)\n  {\n    return;\n  }\n\n  context_p->status_flags |= PARSER_NO_END_LABEL;\n\n  if (PARSER_IS_BASIC_OPCODE (last_opcode))\n  {\n    cbc_opcode_t opcode = (cbc_opcode_t) last_opcode;\n\n    JERRY_ASSERT (opcode < CBC_END);\n    flags = cbc_flags[opcode];\n\n    PARSER_APPEND_TO_BYTE_CODE (context_p, opcode);\n    context_p->byte_code_size++;\n  }\n  else\n  {\n    cbc_ext_opcode_t opcode = (cbc_ext_opcode_t) PARSER_GET_EXT_OPCODE (last_opcode);\n\n    JERRY_ASSERT (opcode < CBC_EXT_END);\n    flags = cbc_ext_flags[opcode];\n    parser_emit_two_bytes (context_p, CBC_EXT_OPCODE, (uint8_t) opcode);\n    context_p->byte_code_size += 2;\n  }\n\n  JERRY_ASSERT ((flags >> CBC_STACK_ADJUST_SHIFT) >= CBC_STACK_ADJUST_BASE\n                || (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);\n  PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));\n\n  if (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))\n  {\n    uint16_t literal_index = context_p->last_cbc.literal_index;\n\n    parser_emit_two_bytes (context_p, (uint8_t) (literal_index & 0xff), (uint8_t) (literal_index >> 8));\n    context_p->byte_code_size += 2;\n  }\n\n  if (flags & CBC_HAS_LITERAL_ARG2)\n  {\n    uint16_t literal_index = context_p->last_cbc.value;\n\n    parser_emit_two_bytes (context_p, (uint8_t) (literal_index & 0xff), (uint8_t) (literal_index >> 8));\n    context_p->byte_code_size += 2;\n\n    if (!(flags & CBC_HAS_LITERAL_ARG))\n    {\n      literal_index = context_p->last_cbc.third_literal_index;\n\n      parser_emit_two_bytes (context_p, (uint8_t) (literal_index & 0xff), (uint8_t) (literal_index >> 8));\n      context_p->byte_code_size += 2;\n    }\n  }\n\n  if (flags & CBC_HAS_BYTE_ARG)\n  {\n    uint8_t byte_argument = (uint8_t) context_p->last_cbc.value;\n\n    JERRY_ASSERT (context_p->last_cbc.value <= CBC_MAXIMUM_BYTE_VALUE);\n\n    if (flags & CBC_POP_STACK_BYTE_ARG)\n    {\n      JERRY_ASSERT (context_p->stack_depth >= byte_argument);\n      PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, byte_argument);\n    }\n\n    PARSER_APPEND_TO_BYTE_CODE (context_p, byte_argument);\n    context_p->byte_code_size++;\n  }\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"  [%3d] %s\",\n                     (int) context_p->stack_depth,\n                     PARSER_IS_BASIC_OPCODE (last_opcode) ? cbc_names[last_opcode]\n                                                          : cbc_ext_names[PARSER_GET_EXT_OPCODE (last_opcode)]);\n\n    if (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))\n    {\n      parser_print_literal (context_p, context_p->last_cbc.literal_index);\n    }\n\n    if (flags & CBC_HAS_LITERAL_ARG2)\n    {\n      parser_print_literal (context_p, context_p->last_cbc.value);\n\n      if (!(flags & CBC_HAS_LITERAL_ARG))\n      {\n        parser_print_literal (context_p, context_p->last_cbc.third_literal_index);\n      }\n    }\n\n    if (flags & CBC_HAS_BYTE_ARG)\n    {\n      if (last_opcode == CBC_PUSH_NUMBER_POS_BYTE || last_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE)\n      {\n        JERRY_DEBUG_MSG (\" number:%d\", (int) context_p->last_cbc.value + 1);\n      }\n      else if (last_opcode == CBC_PUSH_NUMBER_NEG_BYTE || last_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)\n      {\n        JERRY_DEBUG_MSG (\" number:%d\", -((int) context_p->last_cbc.value + 1));\n      }\n      else\n      {\n        JERRY_DEBUG_MSG (\" byte_arg:%d\", (int) context_p->last_cbc.value);\n      }\n    }\n\n    JERRY_DEBUG_MSG (\"\\n\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  if (context_p->stack_depth > context_p->stack_limit)\n  {\n    context_p->stack_limit = context_p->stack_depth;\n    if (context_p->stack_limit > PARSER_MAXIMUM_STACK_LIMIT)\n    {\n      parser_raise_error (context_p, PARSER_ERR_STACK_LIMIT_REACHED);\n    }\n  }\n\n  context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n} /* parser_flush_cbc */\n\n/**\n * Append a byte code\n */\nvoid\nparser_emit_cbc (parser_context_t *context_p, /**< context */\n                 uint16_t opcode) /**< opcode */\n{\n  JERRY_ASSERT (PARSER_ARGS_EQ (opcode, 0));\n\n  if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)\n  {\n    parser_flush_cbc (context_p);\n  }\n\n  context_p->last_cbc_opcode = opcode;\n} /* parser_emit_cbc */\n\n/**\n * Append a byte code with a literal argument\n */\nvoid\nparser_emit_cbc_literal (parser_context_t *context_p, /**< context */\n                         uint16_t opcode, /**< opcode */\n                         uint16_t literal_index) /**< literal index */\n{\n  JERRY_ASSERT (PARSER_ARGS_EQ (opcode, CBC_HAS_LITERAL_ARG));\n\n  if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)\n  {\n    parser_flush_cbc (context_p);\n  }\n\n  context_p->last_cbc_opcode = opcode;\n  context_p->last_cbc.literal_index = literal_index;\n  context_p->last_cbc.literal_type = LEXER_UNUSED_LITERAL;\n  context_p->last_cbc.literal_keyword_type = LEXER_EOS;\n} /* parser_emit_cbc_literal */\n\n/**\n * Append a byte code with a literal and value argument\n */\nvoid\nparser_emit_cbc_literal_value (parser_context_t *context_p, /**< context */\n                               uint16_t opcode, /**< opcode */\n                               uint16_t literal_index, /**< literal index */\n                               uint16_t value) /**< value */\n{\n  JERRY_ASSERT (PARSER_ARGS_EQ (opcode, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2));\n\n  if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)\n  {\n    parser_flush_cbc (context_p);\n  }\n\n  context_p->last_cbc_opcode = opcode;\n  context_p->last_cbc.literal_index = literal_index;\n  context_p->last_cbc.literal_type = LEXER_UNUSED_LITERAL;\n  context_p->last_cbc.literal_keyword_type = LEXER_EOS;\n  context_p->last_cbc.value = value;\n} /* parser_emit_cbc_literal_value */\n\n/**\n * Append a byte code with the current literal argument\n */\nvoid\nparser_emit_cbc_literal_from_token (parser_context_t *context_p, /**< context */\n                                    uint16_t opcode) /**< opcode */\n{\n  JERRY_ASSERT (PARSER_ARGS_EQ (opcode, CBC_HAS_LITERAL_ARG));\n\n  if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)\n  {\n    parser_flush_cbc (context_p);\n  }\n\n  context_p->last_cbc_opcode = opcode;\n  context_p->last_cbc.literal_index = context_p->lit_object.index;\n  context_p->last_cbc.literal_type = context_p->token.lit_location.type;\n  context_p->last_cbc.literal_keyword_type = context_p->token.keyword_type;\n} /* parser_emit_cbc_literal_from_token */\n\n/**\n * Append a byte code with a call argument\n */\nvoid\nparser_emit_cbc_call (parser_context_t *context_p, /**< context */\n                      uint16_t opcode, /**< opcode */\n                      size_t call_arguments) /**< number of arguments */\n{\n  JERRY_ASSERT (PARSER_ARGS_EQ (opcode, CBC_HAS_BYTE_ARG));\n  JERRY_ASSERT (call_arguments <= CBC_MAXIMUM_BYTE_VALUE);\n\n  if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)\n  {\n    parser_flush_cbc (context_p);\n  }\n\n  context_p->last_cbc_opcode = opcode;\n  context_p->last_cbc.value = (uint16_t) call_arguments;\n} /* parser_emit_cbc_call */\n\n/**\n * Append a push number 1/2 byte code\n */\nvoid\nparser_emit_cbc_push_number (parser_context_t *context_p, /**< context */\n                             bool is_negative_number) /**< sign is negative */\n{\n  uint16_t value = context_p->lit_object.index;\n  uint16_t lit_value = PARSER_INVALID_LITERAL_INDEX;\n\n  if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)\n  {\n    if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n    {\n      lit_value = context_p->last_cbc.literal_index;\n    }\n    else\n    {\n      if (context_p->last_cbc_opcode == CBC_PUSH_TWO_LITERALS)\n      {\n        context_p->last_cbc_opcode = CBC_PUSH_LITERAL;\n        lit_value = context_p->last_cbc.value;\n      }\n      else if (context_p->last_cbc_opcode == CBC_PUSH_THREE_LITERALS)\n      {\n        context_p->last_cbc_opcode = CBC_PUSH_TWO_LITERALS;\n        lit_value = context_p->last_cbc.third_literal_index;\n      }\n\n      parser_flush_cbc (context_p);\n    }\n  }\n\n  if (value == 0)\n  {\n    if (lit_value == PARSER_INVALID_LITERAL_INDEX)\n    {\n      context_p->last_cbc_opcode = CBC_PUSH_NUMBER_0;\n      return;\n    }\n\n    context_p->last_cbc_opcode = CBC_PUSH_LITERAL_PUSH_NUMBER_0;\n    context_p->last_cbc.literal_index = lit_value;\n    return;\n  }\n\n  uint16_t opcode;\n\n  if (lit_value == PARSER_INVALID_LITERAL_INDEX)\n  {\n    opcode = (is_negative_number ? CBC_PUSH_NUMBER_NEG_BYTE : CBC_PUSH_NUMBER_POS_BYTE);\n\n    JERRY_ASSERT (CBC_STACK_ADJUST_VALUE (PARSER_GET_FLAGS (opcode)) == 1);\n  }\n  else\n  {\n    opcode = (is_negative_number ? CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE : CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE);\n    JERRY_ASSERT (CBC_STACK_ADJUST_VALUE (PARSER_GET_FLAGS (opcode)) == 2);\n\n    context_p->last_cbc.literal_index = lit_value;\n  }\n\n  JERRY_ASSERT (value > 0 && value <= CBC_PUSH_NUMBER_BYTE_RANGE_END);\n\n  context_p->last_cbc_opcode = opcode;\n  context_p->last_cbc.value = (uint16_t) (value - 1);\n} /* parser_emit_cbc_push_number */\n\n/**\n * Append a byte code with a branch argument\n */\nvoid\nparser_emit_cbc_forward_branch (parser_context_t *context_p, /**< context */\n                                uint16_t opcode, /**< opcode */\n                                parser_branch_t *branch_p) /**< branch result */\n{\n  uint8_t flags;\n  uint32_t extra_byte_code_increase;\n\n  if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)\n  {\n    parser_flush_cbc (context_p);\n  }\n\n  context_p->status_flags |= PARSER_NO_END_LABEL;\n\n  if (PARSER_IS_BASIC_OPCODE (opcode))\n  {\n    JERRY_ASSERT (opcode < CBC_END);\n    flags = cbc_flags[opcode];\n    extra_byte_code_increase = 0;\n  }\n  else\n  {\n    PARSER_APPEND_TO_BYTE_CODE (context_p, CBC_EXT_OPCODE);\n    opcode = (uint16_t) PARSER_GET_EXT_OPCODE (opcode);\n\n    JERRY_ASSERT (opcode < CBC_EXT_END);\n    flags = cbc_ext_flags[opcode];\n    extra_byte_code_increase = 1;\n  }\n\n  JERRY_ASSERT (flags & CBC_HAS_BRANCH_ARG);\n  JERRY_ASSERT (CBC_BRANCH_IS_FORWARD (flags));\n  JERRY_ASSERT (CBC_BRANCH_OFFSET_LENGTH (opcode) == 1);\n\n  /* Branch opcodes never push anything onto the stack. */\n  JERRY_ASSERT ((flags >> CBC_STACK_ADJUST_SHIFT) >= CBC_STACK_ADJUST_BASE\n                || (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);\n  PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"  [%3d] %s\\n\",\n                     (int) context_p->stack_depth,\n                     extra_byte_code_increase == 0 ? cbc_names[opcode] : cbc_ext_names[opcode]);\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  PARSER_PLUS_EQUAL_U16 (opcode, PARSER_MAX_BRANCH_LENGTH - 1);\n\n  parser_emit_two_bytes (context_p, (uint8_t) opcode, 0);\n  branch_p->page_p = context_p->byte_code.last_p;\n  branch_p->offset = (context_p->byte_code.last_position - 1) | (context_p->byte_code_size << 8);\n\n  context_p->byte_code_size += extra_byte_code_increase;\n\n#if PARSER_MAXIMUM_CODE_SIZE <= UINT16_MAX\n  PARSER_APPEND_TO_BYTE_CODE (context_p, 0);\n#else /* PARSER_MAXIMUM_CODE_SIZE > UINT16_MAX */\n  parser_emit_two_bytes (context_p, 0, 0);\n#endif /* PARSER_MAXIMUM_CODE_SIZE <= UINT16_MAX */\n\n  context_p->byte_code_size += PARSER_MAX_BRANCH_LENGTH + 1;\n\n  if (context_p->stack_depth > context_p->stack_limit)\n  {\n    context_p->stack_limit = context_p->stack_depth;\n    if (context_p->stack_limit > PARSER_MAXIMUM_STACK_LIMIT)\n    {\n      parser_raise_error (context_p, PARSER_ERR_STACK_LIMIT_REACHED);\n    }\n  }\n} /* parser_emit_cbc_forward_branch */\n\n/**\n * Append a branch byte code and create an item.\n *\n * @return newly created parser branch node\n */\nparser_branch_node_t *\nparser_emit_cbc_forward_branch_item (parser_context_t *context_p, /**< context */\n                                     uint16_t opcode, /**< opcode */\n                                     parser_branch_node_t *next_p) /**< next branch */\n{\n  parser_branch_t branch;\n  parser_branch_node_t *new_item;\n\n  /* Since byte code insertion may throw an out-of-memory error,\n   * the branch is constructed locally, and copied later. */\n  parser_emit_cbc_forward_branch (context_p, opcode, &branch);\n\n  new_item = (parser_branch_node_t *) parser_malloc (context_p, sizeof (parser_branch_node_t));\n  new_item->branch = branch;\n  new_item->next_p = next_p;\n  return new_item;\n} /* parser_emit_cbc_forward_branch_item */\n\n/**\n * Append a byte code with a branch argument\n */\nvoid\nparser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */\n                                 uint16_t opcode, /**< opcode */\n                                 uint32_t offset) /**< destination offset */\n{\n  uint8_t flags;\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  const char *name;\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)\n  {\n    parser_flush_cbc (context_p);\n  }\n\n  context_p->status_flags |= PARSER_NO_END_LABEL;\n  offset = context_p->byte_code_size - offset;\n\n  if (PARSER_IS_BASIC_OPCODE (opcode))\n  {\n    JERRY_ASSERT (opcode < CBC_END);\n    flags = cbc_flags[opcode];\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n    name = cbc_names[opcode];\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n  }\n  else\n  {\n    PARSER_APPEND_TO_BYTE_CODE (context_p, CBC_EXT_OPCODE);\n    opcode = (uint16_t) PARSER_GET_EXT_OPCODE (opcode);\n\n    JERRY_ASSERT (opcode < CBC_EXT_END);\n    flags = cbc_ext_flags[opcode];\n    context_p->byte_code_size++;\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n    name = cbc_ext_names[opcode];\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n  }\n\n  JERRY_ASSERT (flags & CBC_HAS_BRANCH_ARG);\n  JERRY_ASSERT (CBC_BRANCH_IS_BACKWARD (flags));\n  JERRY_ASSERT (CBC_BRANCH_OFFSET_LENGTH (opcode) == 1);\n  JERRY_ASSERT (offset <= context_p->byte_code_size);\n\n  /* Branch opcodes never push anything onto the stack. */\n  JERRY_ASSERT ((flags >> CBC_STACK_ADJUST_SHIFT) >= CBC_STACK_ADJUST_BASE\n                || (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);\n  PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"  [%3d] %s\\n\", (int) context_p->stack_depth, name);\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  context_p->byte_code_size += 2;\n#if PARSER_MAXIMUM_CODE_SIZE > UINT16_MAX\n  if (offset > UINT16_MAX)\n  {\n    opcode++;\n    context_p->byte_code_size++;\n  }\n#endif /* PARSER_MAXIMUM_CODE_SIZE > UINT16_MAX */\n\n  if (offset > UINT8_MAX)\n  {\n    opcode++;\n    context_p->byte_code_size++;\n  }\n\n  PARSER_APPEND_TO_BYTE_CODE (context_p, (uint8_t) opcode);\n\n#if PARSER_MAXIMUM_CODE_SIZE > UINT16_MAX\n  if (offset > UINT16_MAX)\n  {\n    PARSER_APPEND_TO_BYTE_CODE (context_p, offset >> 16);\n  }\n#endif /* PARSER_MAXIMUM_CODE_SIZE > UINT16_MAX */\n\n  if (offset > UINT8_MAX)\n  {\n    PARSER_APPEND_TO_BYTE_CODE (context_p, (offset >> 8) & 0xff);\n  }\n\n  PARSER_APPEND_TO_BYTE_CODE (context_p, offset & 0xff);\n} /* parser_emit_cbc_backward_branch */\n\n#undef PARSER_CHECK_LAST_POSITION\n#undef PARSER_APPEND_TO_BYTE_CODE\n\n/**\n * Helper function for parser.\n *\n * @return a new string based on encode.\n */\necma_string_t *\nparser_new_ecma_string_from_literal (lexer_literal_t *literal_p) /**< literal */\n{\n  JERRY_ASSERT (literal_p != NULL);\n\n  ecma_string_t *new_string = NULL;\n\n  if (literal_p->status_flags & LEXER_FLAG_ASCII)\n  {\n    new_string = ecma_new_ecma_string_from_ascii (literal_p->u.char_p, literal_p->prop.length);\n  }\n  else\n  {\n    new_string = ecma_new_ecma_string_from_utf8 (literal_p->u.char_p, literal_p->prop.length);\n  }\n\n  return new_string;\n} /* parser_new_ecma_string_from_literal */\n\n/**\n * Set a branch to the current byte code position\n */\nvoid\nparser_set_branch_to_current_position (parser_context_t *context_p, /**< context */\n                                       parser_branch_t *branch_p) /**< branch result */\n{\n  uint32_t delta;\n  size_t offset;\n  parser_mem_page_t *page_p = branch_p->page_p;\n\n  if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)\n  {\n    parser_flush_cbc (context_p);\n  }\n\n  context_p->status_flags &= (uint32_t) ~PARSER_NO_END_LABEL;\n\n  JERRY_ASSERT (context_p->byte_code_size > (branch_p->offset >> 8));\n\n  delta = context_p->byte_code_size - (branch_p->offset >> 8);\n  offset = (branch_p->offset & CBC_LOWER_SEVEN_BIT_MASK);\n\n  JERRY_ASSERT (delta <= PARSER_MAXIMUM_CODE_SIZE);\n\n#if PARSER_MAXIMUM_CODE_SIZE <= UINT16_MAX\n  page_p->bytes[offset++] = (uint8_t) (delta >> 8);\n  if (offset >= PARSER_CBC_STREAM_PAGE_SIZE)\n  {\n    page_p = page_p->next_p;\n    offset = 0;\n  }\n#else /* PARSER_MAXIMUM_CODE_SIZE > UINT16_MAX */\n  page_p->bytes[offset++] = (uint8_t) (delta >> 16);\n  if (offset >= PARSER_CBC_STREAM_PAGE_SIZE)\n  {\n    page_p = page_p->next_p;\n    offset = 0;\n  }\n  page_p->bytes[offset++] = (uint8_t) ((delta >> 8) & 0xff);\n  if (offset >= PARSER_CBC_STREAM_PAGE_SIZE)\n  {\n    page_p = page_p->next_p;\n    offset = 0;\n  }\n#endif /* PARSER_MAXIMUM_CODE_SIZE <= UINT16_MAX */\n  page_p->bytes[offset] = delta & 0xff;\n} /* parser_set_branch_to_current_position */\n\n/**\n * Set breaks to the current byte code position\n */\nvoid\nparser_set_breaks_to_current_position (parser_context_t *context_p, /**< context */\n                                       parser_branch_node_t *current_p) /**< branch list */\n{\n  while (current_p != NULL)\n  {\n    parser_branch_node_t *next_p = current_p->next_p;\n\n    if (!(current_p->branch.offset & CBC_HIGHEST_BIT_MASK))\n    {\n      parser_set_branch_to_current_position (context_p, &current_p->branch);\n    }\n    parser_free (current_p, sizeof (parser_branch_node_t));\n    current_p = next_p;\n  }\n} /* parser_set_breaks_to_current_position */\n\n/**\n * Set continues to the current byte code position\n */\nvoid\nparser_set_continues_to_current_position (parser_context_t *context_p, /**< context */\n                                          parser_branch_node_t *current_p) /**< branch list */\n{\n  while (current_p != NULL)\n  {\n    if (current_p->branch.offset & CBC_HIGHEST_BIT_MASK)\n    {\n      parser_set_branch_to_current_position (context_p, &current_p->branch);\n    }\n    current_p = current_p->next_p;\n  }\n} /* parser_set_continues_to_current_position */\n\n/**\n * Return the size of internal record corresponding to a class field\n *\n * @return internal record size\n */\nstatic size_t\nparser_get_class_field_info_size (uint8_t class_field_type) /**< class field type */\n{\n  if (class_field_type & PARSER_CLASS_FIELD_INITIALIZED)\n  {\n    return sizeof (scanner_range_t) + 1;\n  }\n\n  if (class_field_type & PARSER_CLASS_FIELD_NORMAL)\n  {\n    return sizeof (scanner_location_t) + 1;\n  }\n\n  return 1;\n} /* parser_get_class_field_info_size */\n\n/**\n * Reverse the field list of a class\n */\nvoid\nparser_reverse_class_fields (parser_context_t *context_p, /**< context */\n                             size_t fields_size) /**< size of consumed memory */\n{\n  uint8_t *data_p = (uint8_t *) parser_malloc (context_p, fields_size);\n  uint8_t *data_end_p = data_p + fields_size;\n  uint8_t *current_p = data_p;\n  bool has_fields = false;\n  parser_stack_iterator_t iterator;\n\n  JERRY_ASSERT (!(context_p->stack_top_uint8 & PARSER_CLASS_FIELD_END));\n\n  parser_stack_iterator_init (context_p, &iterator);\n\n  do\n  {\n    uint8_t class_field_type = parser_stack_iterator_read_uint8 (&iterator);\n    size_t info_size = parser_get_class_field_info_size (class_field_type);\n\n    parser_stack_iterator_read (&iterator, current_p, info_size);\n    parser_stack_iterator_skip (&iterator, info_size);\n    current_p += info_size;\n\n    if (!(class_field_type & PARSER_CLASS_FIELD_STATIC))\n    {\n      has_fields = true;\n      context_p->stack_top_uint8 = class_field_type;\n    }\n  } while (current_p < data_end_p);\n\n  parser_stack_iterator_init (context_p, &iterator);\n  current_p = data_end_p;\n\n  bool has_static_fields = false;\n\n  if (has_fields)\n  {\n    do\n    {\n      uint8_t class_field_type = current_p[-1];\n\n      size_t info_size = parser_get_class_field_info_size (class_field_type);\n\n      if (!(class_field_type & PARSER_CLASS_FIELD_STATIC))\n      {\n        current_p -= info_size;\n        parser_stack_iterator_write (&iterator, current_p, info_size);\n        parser_stack_iterator_skip (&iterator, info_size);\n        continue;\n      }\n\n      if (!has_static_fields)\n      {\n        has_static_fields = true;\n        current_p[-1] |= PARSER_CLASS_FIELD_END;\n      }\n      current_p -= info_size;\n    } while (current_p > data_p);\n  }\n  else\n  {\n    /* All class fields are static. */\n    has_static_fields = true;\n    JERRY_ASSERT (data_end_p[-1] & PARSER_CLASS_FIELD_STATIC);\n    context_p->stack_top_uint8 = data_end_p[-1];\n  }\n\n  if (has_static_fields)\n  {\n    current_p = data_end_p;\n\n    do\n    {\n      uint8_t class_field_type = current_p[-1];\n\n      size_t info_size = parser_get_class_field_info_size (class_field_type);\n      current_p -= info_size;\n\n      if (class_field_type & PARSER_CLASS_FIELD_STATIC)\n      {\n        parser_stack_iterator_write (&iterator, current_p, info_size);\n        parser_stack_iterator_skip (&iterator, info_size);\n      }\n    } while (current_p > data_p);\n  }\n\n  parser_free (data_p, fields_size);\n} /* parser_reverse_class_fields */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_PARSER */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-exceptions.h\"\n#include \"ecma-extended-info.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-literal-storage.h\"\n#include \"ecma-module.h\"\n\n#include \"debugger.h\"\n#include \"jcontext.h\"\n#include \"js-parser-internal.h\"\n#include \"lit-char-helpers.h\"\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_parser Parser\n * @{\n */\n\n#if JERRY_PARSER\n\nJERRY_STATIC_ASSERT ((int) ECMA_PARSE_STRICT_MODE == (int) PARSER_IS_STRICT,\n                     ecma_parse_strict_mode_must_be_equal_to_parser_is_strict);\n\nJERRY_STATIC_ASSERT (PARSER_SAVE_STATUS_FLAGS (PARSER_ALLOW_SUPER) == 0x1, incorrect_saving_of_ecma_parse_allow_super);\nJERRY_STATIC_ASSERT (PARSER_RESTORE_STATUS_FLAGS (ECMA_PARSE_ALLOW_SUPER) == PARSER_ALLOW_SUPER,\n                     incorrect_restoring_of_ecma_parse_allow_super);\n\nJERRY_STATIC_ASSERT (PARSER_RESTORE_STATUS_FLAGS (ECMA_PARSE_FUNCTION_CONTEXT) == 0,\n                     ecma_parse_function_context_must_not_be_transformed);\n\n/**\n * Compute real literal indicies.\n *\n * @return length of the prefix opcodes\n */\nstatic void\nparser_compute_indicies (parser_context_t *context_p, /**< context */\n                         uint16_t *ident_end, /**< end of the identifier group */\n                         uint16_t *const_literal_end) /**< end of the const literal group */\n{\n  parser_list_iterator_t literal_iterator;\n  lexer_literal_t *literal_p;\n\n  uint16_t ident_count = 0;\n  uint16_t const_literal_count = 0;\n\n  uint16_t ident_index;\n  uint16_t const_literal_index;\n  uint16_t literal_index;\n\n  /* First phase: count the number of items in each group. */\n  parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n  while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)))\n  {\n    switch (literal_p->type)\n    {\n      case LEXER_IDENT_LITERAL:\n      {\n        if (literal_p->status_flags & LEXER_FLAG_USED)\n        {\n          ident_count++;\n          break;\n        }\n        else if (!(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))\n        {\n          jmem_heap_free_block ((void *) literal_p->u.char_p, literal_p->prop.length);\n          /* This literal should not be freed even if an error is encountered later. */\n          literal_p->status_flags |= LEXER_FLAG_SOURCE_PTR;\n        }\n        continue;\n      }\n      case LEXER_STRING_LITERAL:\n      {\n        const_literal_count++;\n        break;\n      }\n      case LEXER_NUMBER_LITERAL:\n      {\n        const_literal_count++;\n        continue;\n      }\n      case LEXER_FUNCTION_LITERAL:\n      case LEXER_REGEXP_LITERAL:\n      {\n        continue;\n      }\n      default:\n      {\n        JERRY_ASSERT (literal_p->type == LEXER_UNUSED_LITERAL);\n        continue;\n      }\n    }\n\n    const uint8_t *char_p = literal_p->u.char_p;\n    uint32_t status_flags = context_p->status_flags;\n\n    if ((literal_p->status_flags & LEXER_FLAG_SOURCE_PTR) && literal_p->prop.length < 0xfff)\n    {\n      size_t bytes_to_end = (size_t) (context_p->source_end_p - char_p);\n\n      if (bytes_to_end < 0xfffff)\n      {\n        literal_p->u.source_data = ((uint32_t) bytes_to_end) | (((uint32_t) literal_p->prop.length) << 20);\n        literal_p->status_flags |= LEXER_FLAG_LATE_INIT;\n        status_flags |= PARSER_HAS_LATE_LIT_INIT;\n        context_p->status_flags = status_flags;\n        char_p = NULL;\n      }\n    }\n\n    if (char_p != NULL)\n    {\n      literal_p->u.value = ecma_find_or_create_literal_string (char_p,\n                                                               literal_p->prop.length,\n                                                               (literal_p->status_flags & LEXER_FLAG_ASCII) != 0);\n\n      if (!(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))\n      {\n        jmem_heap_free_block ((void *) char_p, literal_p->prop.length);\n        /* This literal should not be freed even if an error is encountered later. */\n        literal_p->status_flags |= LEXER_FLAG_SOURCE_PTR;\n      }\n    }\n  }\n\n  ident_index = context_p->register_count;\n  const_literal_index = (uint16_t) (ident_index + ident_count);\n  literal_index = (uint16_t) (const_literal_index + const_literal_count);\n\n  /* Second phase: Assign an index to each literal. */\n  parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n  while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)))\n  {\n    switch (literal_p->type)\n    {\n      case LEXER_IDENT_LITERAL:\n      {\n        if (literal_p->status_flags & LEXER_FLAG_USED)\n        {\n          literal_p->prop.index = ident_index;\n          ident_index++;\n        }\n        break;\n      }\n      case LEXER_STRING_LITERAL:\n      case LEXER_NUMBER_LITERAL:\n      {\n        JERRY_ASSERT ((literal_p->status_flags & ~(LEXER_FLAG_SOURCE_PTR | LEXER_FLAG_LATE_INIT)) == 0);\n        literal_p->prop.index = const_literal_index;\n        const_literal_index++;\n        break;\n      }\n      case LEXER_FUNCTION_LITERAL:\n      case LEXER_REGEXP_LITERAL:\n      {\n        JERRY_ASSERT (literal_p->status_flags == 0);\n\n        literal_p->prop.index = literal_index;\n        literal_index++;\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (literal_p->type == LEXER_UNUSED_LITERAL\n                      && literal_p->status_flags == LEXER_FLAG_FUNCTION_ARGUMENT);\n        break;\n      }\n    }\n  }\n\n  JERRY_ASSERT (ident_index == context_p->register_count + ident_count);\n  JERRY_ASSERT (const_literal_index == ident_index + const_literal_count);\n  JERRY_ASSERT (literal_index <= context_p->register_count + context_p->literal_count);\n\n  context_p->literal_count = literal_index;\n\n  *ident_end = ident_index;\n  *const_literal_end = const_literal_index;\n} /* parser_compute_indicies */\n\n/**\n * Initialize literal pool.\n */\nstatic void\nparser_init_literal_pool (parser_context_t *context_p, /**< context */\n                          ecma_value_t *literal_pool_p) /**< start of literal pool */\n{\n  parser_list_iterator_t literal_iterator;\n  lexer_literal_t *literal_p;\n\n  parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n\n  while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)))\n  {\n    switch (literal_p->type)\n    {\n      case LEXER_IDENT_LITERAL:\n      {\n        if (!(literal_p->status_flags & LEXER_FLAG_USED))\n        {\n          break;\n        }\n        /* FALLTHRU */\n      }\n      case LEXER_STRING_LITERAL:\n      {\n        ecma_value_t lit_value = literal_p->u.value;\n\n        JERRY_ASSERT (literal_p->prop.index >= context_p->register_count);\n        literal_pool_p[literal_p->prop.index] = lit_value;\n        break;\n      }\n      case LEXER_NUMBER_LITERAL:\n      {\n        JERRY_ASSERT (literal_p->prop.index >= context_p->register_count);\n\n        literal_pool_p[literal_p->prop.index] = literal_p->u.value;\n        break;\n      }\n      case LEXER_FUNCTION_LITERAL:\n      case LEXER_REGEXP_LITERAL:\n      {\n        JERRY_ASSERT (literal_p->prop.index >= context_p->register_count);\n\n        ECMA_SET_INTERNAL_VALUE_POINTER (literal_pool_p[literal_p->prop.index], literal_p->u.bytecode_p);\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (literal_p->type == LEXER_UNUSED_LITERAL);\n        break;\n      }\n    }\n  }\n} /* parser_init_literal_pool */\n\n/*\n * During byte code post processing certain bytes are not\n * copied into the final byte code buffer. For example, if\n * one byte is enough for encoding a literal index, the\n * second byte is not copied. However, when a byte is skipped,\n * the offsets of those branches which crosses (jumps over)\n * that byte code should also be decreased by one. Instead\n * of finding these jumps every time when a byte is skipped,\n * all branch offset updates are computed in one step.\n *\n * Branch offset mapping example:\n *\n * Let's assume that each parser_mem_page of the byte_code\n * buffer is 8 bytes long and only 4 bytes are kept for a\n * given page:\n *\n * +---+---+---+---+---+---+---+---+\n * | X | 1 | 2 | 3 | X | 4 | X | X |\n * +---+---+---+---+---+---+---+---+\n *\n * X marks those bytes which are removed. The resulting\n * offset mapping is the following:\n *\n * +---+---+---+---+---+---+---+---+\n * | 0 | 1 | 2 | 3 | 3 | 4 | 4 | 4 |\n * +---+---+---+---+---+---+---+---+\n *\n * Each X is simply replaced by the index of the previous\n * index starting from zero. This shows the number of\n * copied bytes before a given byte including the byte\n * itself. The last byte always shows the number of bytes\n * copied from this page.\n *\n * This mapping allows recomputing all branch targets,\n * since mapping[to] - mapping[from] is the new argument\n * for forward branches. As for backward branches, the\n * equation is reversed to mapping[from] - mapping[to].\n *\n * The mapping is relative to one page, so distance\n * computation affecting multiple pages requires a loop.\n * We should also note that only argument bytes can\n * be skipped, so removed bytes cannot be targeted by\n * branches. Valid branches always target instruction\n * starts only.\n */\n\n/**\n * Recompute the argument of a forward branch.\n *\n * @return the new distance\n */\nstatic size_t\nparser_update_forward_branch (parser_mem_page_t *page_p, /**< current page */\n                              size_t full_distance, /**< full distance */\n                              uint8_t bytes_copied_before_jump) /**< bytes copied before jump */\n{\n  size_t new_distance = 0;\n\n  while (full_distance > PARSER_CBC_STREAM_PAGE_SIZE)\n  {\n    new_distance += page_p->bytes[PARSER_CBC_STREAM_PAGE_SIZE - 1] & CBC_LOWER_SEVEN_BIT_MASK;\n    full_distance -= PARSER_CBC_STREAM_PAGE_SIZE;\n    page_p = page_p->next_p;\n  }\n\n  new_distance += page_p->bytes[full_distance - 1] & CBC_LOWER_SEVEN_BIT_MASK;\n  return new_distance - bytes_copied_before_jump;\n} /* parser_update_forward_branch */\n\n/**\n * Recompute the argument of a backward branch.\n *\n * @return the new distance\n */\nstatic size_t\nparser_update_backward_branch (parser_mem_page_t *page_p, /**< current page */\n                               size_t full_distance, /**< full distance */\n                               uint8_t bytes_copied_before_jump) /**< bytes copied before jump */\n{\n  size_t new_distance = bytes_copied_before_jump;\n\n  while (full_distance >= PARSER_CBC_STREAM_PAGE_SIZE)\n  {\n    JERRY_ASSERT (page_p != NULL);\n    new_distance += page_p->bytes[PARSER_CBC_STREAM_PAGE_SIZE - 1] & CBC_LOWER_SEVEN_BIT_MASK;\n    full_distance -= PARSER_CBC_STREAM_PAGE_SIZE;\n    page_p = page_p->next_p;\n  }\n\n  if (full_distance > 0)\n  {\n    size_t offset = PARSER_CBC_STREAM_PAGE_SIZE - full_distance;\n\n    JERRY_ASSERT (page_p != NULL);\n\n    new_distance += page_p->bytes[PARSER_CBC_STREAM_PAGE_SIZE - 1] & CBC_LOWER_SEVEN_BIT_MASK;\n    new_distance -= page_p->bytes[offset - 1] & CBC_LOWER_SEVEN_BIT_MASK;\n  }\n\n  return new_distance;\n} /* parser_update_backward_branch */\n\n/**\n * Update targets of all branches in one step.\n */\nstatic void\nparse_update_branches (parser_context_t *context_p, /**< context */\n                       uint8_t *byte_code_p) /**< byte code */\n{\n  parser_mem_page_t *page_p = context_p->byte_code.first_p;\n  parser_mem_page_t *prev_page_p = NULL;\n  parser_mem_page_t *last_page_p = context_p->byte_code.last_p;\n  size_t last_position = context_p->byte_code.last_position;\n  size_t offset = 0;\n  size_t bytes_copied = 0;\n\n  if (last_position >= PARSER_CBC_STREAM_PAGE_SIZE)\n  {\n    last_page_p = NULL;\n    last_position = 0;\n  }\n\n  while (page_p != last_page_p || offset < last_position)\n  {\n    /* Branch instructions are marked to improve search speed. */\n    if (page_p->bytes[offset] & CBC_HIGHEST_BIT_MASK)\n    {\n      uint8_t *bytes_p = byte_code_p + bytes_copied;\n      uint8_t flags;\n      uint8_t bytes_copied_before_jump = 0;\n      size_t branch_argument_length;\n      size_t target_distance;\n      size_t length;\n\n      if (offset > 0)\n      {\n        bytes_copied_before_jump = page_p->bytes[offset - 1] & CBC_LOWER_SEVEN_BIT_MASK;\n      }\n      bytes_p += bytes_copied_before_jump;\n\n      if (*bytes_p == CBC_EXT_OPCODE)\n      {\n        bytes_p++;\n        flags = cbc_ext_flags[*bytes_p];\n      }\n      else\n      {\n        flags = cbc_flags[*bytes_p];\n      }\n\n      JERRY_ASSERT (flags & CBC_HAS_BRANCH_ARG);\n      branch_argument_length = CBC_BRANCH_OFFSET_LENGTH (*bytes_p);\n      bytes_p++;\n\n      /* Decoding target. */\n      length = branch_argument_length;\n      target_distance = 0;\n      do\n      {\n        target_distance = (target_distance << 8) | *bytes_p;\n        bytes_p++;\n      } while (--length > 0);\n\n      if (CBC_BRANCH_IS_FORWARD (flags))\n      {\n        /* Branch target was not set. */\n        JERRY_ASSERT (target_distance > 0);\n\n        target_distance = parser_update_forward_branch (page_p, offset + target_distance, bytes_copied_before_jump);\n      }\n      else\n      {\n        if (target_distance < offset)\n        {\n          uint8_t bytes_copied_before_target = page_p->bytes[offset - target_distance - 1];\n          bytes_copied_before_target = bytes_copied_before_target & CBC_LOWER_SEVEN_BIT_MASK;\n\n          target_distance = (size_t) (bytes_copied_before_jump - bytes_copied_before_target);\n        }\n        else if (target_distance == offset)\n        {\n          target_distance = bytes_copied_before_jump;\n        }\n        else\n        {\n          target_distance =\n            parser_update_backward_branch (prev_page_p, target_distance - offset, bytes_copied_before_jump);\n        }\n      }\n\n      /* Encoding target again. */\n      do\n      {\n        bytes_p--;\n        *bytes_p = (uint8_t) (target_distance & 0xff);\n        target_distance >>= 8;\n      } while (--branch_argument_length > 0);\n    }\n\n    offset++;\n    if (offset >= PARSER_CBC_STREAM_PAGE_SIZE)\n    {\n      parser_mem_page_t *next_p = page_p->next_p;\n\n      /* We reverse the pages before the current page. */\n      page_p->next_p = prev_page_p;\n      prev_page_p = page_p;\n\n      bytes_copied += page_p->bytes[PARSER_CBC_STREAM_PAGE_SIZE - 1] & CBC_LOWER_SEVEN_BIT_MASK;\n      page_p = next_p;\n      offset = 0;\n    }\n  }\n\n  /* After this point the pages of the byte code stream are\n   * not used anymore. However, they needs to be freed during\n   * cleanup, so the first and last pointers of the stream\n   * descriptor are reversed as well. */\n  if (last_page_p != NULL)\n  {\n    JERRY_ASSERT (last_page_p == context_p->byte_code.last_p);\n    last_page_p->next_p = prev_page_p;\n  }\n  else\n  {\n    last_page_p = context_p->byte_code.last_p;\n  }\n\n  context_p->byte_code.last_p = context_p->byte_code.first_p;\n  context_p->byte_code.first_p = last_page_p;\n} /* parse_update_branches */\n\n#if JERRY_DEBUGGER\n\n/**\n * Send current breakpoint list.\n */\nstatic void\nparser_send_breakpoints (parser_context_t *context_p, /**< context */\n                         jerry_debugger_header_type_t type) /**< message type */\n{\n  JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n  JERRY_ASSERT (context_p->breakpoint_info_count > 0);\n\n  jerry_debugger_send_data (type,\n                            context_p->breakpoint_info,\n                            context_p->breakpoint_info_count * sizeof (parser_breakpoint_info_t));\n\n  context_p->breakpoint_info_count = 0;\n} /* parser_send_breakpoints */\n\n/**\n * Append a breakpoint info.\n */\nvoid\nparser_append_breakpoint_info (parser_context_t *context_p, /**< context */\n                               jerry_debugger_header_type_t type, /**< message type */\n                               uint32_t value) /**< line or offset of the breakpoint */\n{\n  JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n\n  context_p->status_flags |= PARSER_DEBUGGER_BREAKPOINT_APPENDED;\n\n  if (context_p->breakpoint_info_count >= JERRY_DEBUGGER_SEND_MAX (parser_breakpoint_info_t))\n  {\n    parser_send_breakpoints (context_p, type);\n  }\n\n  context_p->breakpoint_info[context_p->breakpoint_info_count].value = value;\n  context_p->breakpoint_info_count = (uint16_t) (context_p->breakpoint_info_count + 1);\n} /* parser_append_breakpoint_info */\n\n#endif /* JERRY_DEBUGGER */\n\n/**\n * Forward iterator: move to the next byte code\n *\n * @param page_p page\n * @param offset offset\n */\n#define PARSER_NEXT_BYTE(page_p, offset)           \\\n  do                                               \\\n  {                                                \\\n    if (++(offset) >= PARSER_CBC_STREAM_PAGE_SIZE) \\\n    {                                              \\\n      offset = 0;                                  \\\n      page_p = page_p->next_p;                     \\\n    }                                              \\\n  } while (0)\n\n/**\n * Forward iterator: move to the next byte code. Also updates the offset of the previous byte code.\n *\n * @param page_p page\n * @param offset offset\n * @param real_offset real offset\n */\n#define PARSER_NEXT_BYTE_UPDATE(page_p, offset, real_offset) \\\n  do                                                         \\\n  {                                                          \\\n    page_p->bytes[offset] = real_offset;                     \\\n    if (++(offset) >= PARSER_CBC_STREAM_PAGE_SIZE)           \\\n    {                                                        \\\n      offset = 0;                                            \\\n      real_offset = 0;                                       \\\n      page_p = page_p->next_p;                               \\\n    }                                                        \\\n  } while (0)\n\n/**\n * Post processing main function.\n *\n * @return compiled code\n */\nstatic ecma_compiled_code_t *\nparser_post_processing (parser_context_t *context_p) /**< context */\n{\n  uint16_t literal_one_byte_limit;\n  uint16_t ident_end;\n  uint16_t const_literal_end;\n  parser_mem_page_t *page_p;\n  parser_mem_page_t *last_page_p;\n  size_t last_position;\n  size_t offset;\n  size_t length;\n  size_t literal_length;\n  size_t total_size;\n  uint8_t real_offset;\n  uint8_t *byte_code_p;\n  bool needs_uint16_arguments;\n  cbc_opcode_t last_opcode = CBC_EXT_OPCODE;\n  ecma_compiled_code_t *compiled_code_p;\n  ecma_value_t *literal_pool_p;\n  uint8_t *dst_p;\n\n  if ((context_p->status_flags & (PARSER_IS_FUNCTION | PARSER_LEXICAL_BLOCK_NEEDED))\n      == (PARSER_IS_FUNCTION | PARSER_LEXICAL_BLOCK_NEEDED))\n  {\n    PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, PARSER_BLOCK_CONTEXT_STACK_ALLOCATION);\n#ifndef JERRY_NDEBUG\n    PARSER_MINUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_BLOCK_CONTEXT_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n\n    context_p->status_flags &= (uint32_t) ~PARSER_LEXICAL_BLOCK_NEEDED;\n\n    parser_emit_cbc (context_p, CBC_CONTEXT_END);\n\n    parser_branch_t branch;\n    parser_stack_pop (context_p, &branch, sizeof (parser_branch_t));\n    parser_set_branch_to_current_position (context_p, &branch);\n\n    JERRY_ASSERT (!(context_p->status_flags & PARSER_NO_END_LABEL));\n  }\n\n  if (PARSER_IS_NORMAL_ASYNC_FUNCTION (context_p->status_flags))\n  {\n    PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);\n#ifndef JERRY_NDEBUG\n    PARSER_MINUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n\n    if (context_p->stack_limit < PARSER_FINALLY_CONTEXT_STACK_ALLOCATION)\n    {\n      context_p->stack_limit = PARSER_FINALLY_CONTEXT_STACK_ALLOCATION;\n    }\n\n    parser_branch_t branch;\n\n    parser_stack_pop (context_p, &branch, sizeof (parser_branch_t));\n    parser_set_branch_to_current_position (context_p, &branch);\n\n    JERRY_ASSERT (!(context_p->status_flags & PARSER_NO_END_LABEL));\n  }\n\n#if JERRY_LINE_INFO\n  JERRY_ASSERT (context_p->line_info_p != NULL);\n#endif /* JERRY_LINE_INFO */\n\n  JERRY_ASSERT (context_p->stack_depth == 0);\n#ifndef JERRY_NDEBUG\n  JERRY_ASSERT (context_p->context_stack_depth == 0);\n#endif /* !JERRY_NDEBUG */\n\n  if ((size_t) context_p->stack_limit + (size_t) context_p->register_count > PARSER_MAXIMUM_STACK_LIMIT)\n  {\n    parser_raise_error (context_p, PARSER_ERR_STACK_LIMIT_REACHED);\n  }\n\n  if (JERRY_UNLIKELY (context_p->script_p->refs_and_type >= CBC_SCRIPT_REF_MAX))\n  {\n    /* This is probably never happens in practice. */\n    jerry_fatal (JERRY_FATAL_REF_COUNT_LIMIT);\n  }\n\n  context_p->script_p->refs_and_type += CBC_SCRIPT_REF_ONE;\n\n  JERRY_ASSERT (context_p->literal_count <= PARSER_MAXIMUM_NUMBER_OF_LITERALS);\n\n#if JERRY_DEBUGGER\n  if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n      && !(context_p->status_flags & PARSER_DEBUGGER_BREAKPOINT_APPENDED))\n  {\n    /* Always provide at least one breakpoint. */\n    parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);\n    parser_flush_cbc (context_p);\n\n    parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, context_p->token.line);\n\n    context_p->last_breakpoint_line = context_p->token.line;\n  }\n\n  if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) && context_p->breakpoint_info_count > 0)\n  {\n    parser_send_breakpoints (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST);\n    JERRY_ASSERT (context_p->breakpoint_info_count == 0);\n  }\n#endif /* JERRY_DEBUGGER */\n\n  parser_compute_indicies (context_p, &ident_end, &const_literal_end);\n\n  if (context_p->literal_count <= CBC_MAXIMUM_SMALL_VALUE)\n  {\n    literal_one_byte_limit = CBC_MAXIMUM_BYTE_VALUE - 1;\n  }\n  else\n  {\n    literal_one_byte_limit = CBC_LOWER_SEVEN_BIT_MASK;\n  }\n\n  last_page_p = context_p->byte_code.last_p;\n  last_position = context_p->byte_code.last_position;\n\n  if (last_position >= PARSER_CBC_STREAM_PAGE_SIZE)\n  {\n    last_page_p = NULL;\n    last_position = 0;\n  }\n\n  page_p = context_p->byte_code.first_p;\n  offset = 0;\n  length = 0;\n\n  while (page_p != last_page_p || offset < last_position)\n  {\n    uint8_t *opcode_p;\n    uint8_t flags;\n    size_t branch_offset_length;\n\n    opcode_p = page_p->bytes + offset;\n    last_opcode = (cbc_opcode_t) (*opcode_p);\n    PARSER_NEXT_BYTE (page_p, offset);\n    branch_offset_length = CBC_BRANCH_OFFSET_LENGTH (last_opcode);\n    flags = cbc_flags[last_opcode];\n    length++;\n\n    switch (last_opcode)\n    {\n      case CBC_EXT_OPCODE:\n      {\n        cbc_ext_opcode_t ext_opcode;\n\n        ext_opcode = (cbc_ext_opcode_t) page_p->bytes[offset];\n        branch_offset_length = CBC_BRANCH_OFFSET_LENGTH (ext_opcode);\n        flags = cbc_ext_flags[ext_opcode];\n        PARSER_NEXT_BYTE (page_p, offset);\n        length++;\n        break;\n      }\n      case CBC_POST_DECR:\n      {\n        *opcode_p = CBC_PRE_DECR;\n        break;\n      }\n      case CBC_POST_INCR:\n      {\n        *opcode_p = CBC_PRE_INCR;\n        break;\n      }\n      case CBC_POST_DECR_IDENT:\n      {\n        *opcode_p = CBC_PRE_DECR_IDENT;\n        break;\n      }\n      case CBC_POST_INCR_IDENT:\n      {\n        *opcode_p = CBC_PRE_INCR_IDENT;\n        break;\n      }\n      default:\n      {\n        break;\n      }\n    }\n\n    while (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))\n    {\n      uint8_t *first_byte = page_p->bytes + offset;\n      uint32_t literal_index = *first_byte;\n\n      PARSER_NEXT_BYTE (page_p, offset);\n      length++;\n\n      literal_index |= ((uint32_t) page_p->bytes[offset]) << 8;\n\n      if (literal_index >= PARSER_REGISTER_START)\n      {\n        literal_index -= PARSER_REGISTER_START;\n      }\n      else\n      {\n        literal_index = (PARSER_GET_LITERAL (literal_index))->prop.index;\n      }\n\n      if (literal_index <= literal_one_byte_limit)\n      {\n        *first_byte = (uint8_t) literal_index;\n      }\n      else\n      {\n        if (context_p->literal_count <= CBC_MAXIMUM_SMALL_VALUE)\n        {\n          JERRY_ASSERT (literal_index <= CBC_MAXIMUM_SMALL_VALUE);\n          *first_byte = CBC_MAXIMUM_BYTE_VALUE;\n          page_p->bytes[offset] = (uint8_t) (literal_index - CBC_MAXIMUM_BYTE_VALUE);\n          length++;\n        }\n        else\n        {\n          JERRY_ASSERT (literal_index <= CBC_MAXIMUM_FULL_VALUE);\n          *first_byte = (uint8_t) ((literal_index >> 8) | CBC_HIGHEST_BIT_MASK);\n          page_p->bytes[offset] = (uint8_t) (literal_index & 0xff);\n          length++;\n        }\n      }\n      PARSER_NEXT_BYTE (page_p, offset);\n\n      if (flags & CBC_HAS_LITERAL_ARG2)\n      {\n        if (flags & CBC_HAS_LITERAL_ARG)\n        {\n          flags = CBC_HAS_LITERAL_ARG;\n        }\n        else\n        {\n          flags = CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2;\n        }\n      }\n      else\n      {\n        break;\n      }\n    }\n\n    if (flags & CBC_HAS_BYTE_ARG)\n    {\n      /* This argument will be copied without modification. */\n      PARSER_NEXT_BYTE (page_p, offset);\n      length++;\n    }\n\n    if (flags & CBC_HAS_BRANCH_ARG)\n    {\n      bool prefix_zero = true;\n\n      /* The leading zeroes are dropped from the stream.\n       * Although dropping these zeroes for backward\n       * branches are unnecessary, we use the same\n       * code path for simplicity. */\n      JERRY_ASSERT (branch_offset_length > 0 && branch_offset_length <= 3);\n\n      while (--branch_offset_length > 0)\n      {\n        uint8_t byte = page_p->bytes[offset];\n        if (byte > 0 || !prefix_zero)\n        {\n          prefix_zero = false;\n          length++;\n        }\n        else\n        {\n          JERRY_ASSERT (CBC_BRANCH_IS_FORWARD (flags));\n        }\n        PARSER_NEXT_BYTE (page_p, offset);\n      }\n\n      if (last_opcode == (cbc_opcode_t) (CBC_JUMP_FORWARD + PARSER_MAX_BRANCH_LENGTH - 1) && prefix_zero\n          && page_p->bytes[offset] == PARSER_MAX_BRANCH_LENGTH + 1)\n      {\n        /* Uncoditional jumps which jump right after the instruction\n         * are effectively NOPs. These jumps are removed from the\n         * stream. The 1 byte long CBC_JUMP_FORWARD form marks these\n         * instructions, since this form is constructed during post\n         * processing and cannot be emitted directly. */\n        *opcode_p = CBC_JUMP_FORWARD;\n        length--;\n      }\n      else\n      {\n        /* Other last bytes are always copied. */\n        length++;\n      }\n\n      PARSER_NEXT_BYTE (page_p, offset);\n    }\n  }\n\n  if (!(context_p->status_flags & PARSER_NO_END_LABEL) || !(PARSER_OPCODE_IS_RETURN (last_opcode)))\n  {\n    context_p->status_flags &= (uint32_t) ~PARSER_NO_END_LABEL;\n\n    if (PARSER_IS_NORMAL_ASYNC_FUNCTION (context_p->status_flags))\n    {\n      length++;\n    }\n\n    length++;\n  }\n\n  needs_uint16_arguments = false;\n  total_size = sizeof (cbc_uint8_arguments_t);\n\n  if (context_p->stack_limit > CBC_MAXIMUM_BYTE_VALUE || context_p->register_count > CBC_MAXIMUM_BYTE_VALUE\n      || context_p->literal_count > CBC_MAXIMUM_BYTE_VALUE)\n  {\n    needs_uint16_arguments = true;\n    total_size = sizeof (cbc_uint16_arguments_t);\n  }\n\n  literal_length = (size_t) (context_p->literal_count - context_p->register_count) * sizeof (ecma_value_t);\n\n  total_size += literal_length + length;\n\n  if (PARSER_NEEDS_MAPPED_ARGUMENTS (context_p->status_flags))\n  {\n    total_size += context_p->argument_count * sizeof (ecma_value_t);\n  }\n\n  /* function.name */\n  if (!(context_p->status_flags & PARSER_CLASS_CONSTRUCTOR))\n  {\n    total_size += sizeof (ecma_value_t);\n  }\n\n  if (context_p->tagged_template_literal_cp != JMEM_CP_NULL)\n  {\n    total_size += sizeof (ecma_value_t);\n  }\n\n#if JERRY_LINE_INFO\n  total_size += sizeof (ecma_value_t);\n#endif /* JERRY_LINE_INFO */\n  uint8_t extended_info = 0;\n\n  if (context_p->argument_length != UINT16_MAX)\n  {\n    extended_info |= CBC_EXTENDED_CODE_FLAGS_HAS_ARGUMENT_LENGTH;\n    total_size += ecma_extended_info_get_encoded_length (context_p->argument_length);\n  }\n#if JERRY_FUNCTION_TO_STRING\n  if (context_p->last_context_p != NULL)\n  {\n    extended_info |= CBC_EXTENDED_CODE_FLAGS_HAS_SOURCE_CODE_RANGE;\n\n    const uint8_t *start_p = context_p->source_start_p;\n    const uint8_t *function_start_p = context_p->last_context_p->function_start_p;\n\n    if (function_start_p < start_p || function_start_p >= start_p + context_p->source_size)\n    {\n      JERRY_ASSERT (context_p->arguments_start_p != NULL && function_start_p >= context_p->arguments_start_p\n                    && function_start_p < context_p->arguments_start_p + context_p->arguments_size);\n\n      start_p = context_p->arguments_start_p;\n      extended_info |= CBC_EXTENDED_CODE_FLAGS_SOURCE_CODE_IN_ARGUMENTS;\n    }\n\n    total_size += ecma_extended_info_get_encoded_length ((uint32_t) (function_start_p - start_p));\n    total_size += ecma_extended_info_get_encoded_length ((uint32_t) (context_p->function_end_p - function_start_p));\n  }\n#endif /* JERRY_FUNCTION_TO_STRING */\n  if (extended_info != 0)\n  {\n    total_size += sizeof (uint8_t);\n  }\n\n  total_size = JERRY_ALIGNUP (total_size, JMEM_ALIGNMENT);\n  compiled_code_p = (ecma_compiled_code_t *) parser_malloc (context_p, total_size);\n\n#if JERRY_SNAPSHOT_SAVE || JERRY_PARSER_DUMP_BYTE_CODE\n  // Avoid getting junk bytes\n  memset (compiled_code_p, 0, total_size);\n#endif /* JERRY_SNAPSHOT_SAVE || JERRY_PARSER_DUMP_BYTE_CODE */\n\n#if JERRY_MEM_STATS\n  jmem_stats_allocate_byte_code_bytes (total_size);\n#endif /* JERRY_MEM_STATS */\n\n  byte_code_p = (uint8_t *) compiled_code_p;\n  compiled_code_p->size = (uint16_t) (total_size >> JMEM_ALIGNMENT_LOG);\n  compiled_code_p->refs = 1;\n  compiled_code_p->status_flags = 0;\n\n  if (context_p->status_flags & PARSER_FUNCTION_HAS_REST_PARAM)\n  {\n    JERRY_ASSERT (context_p->argument_count > 0);\n    context_p->argument_count--;\n  }\n\n  if (needs_uint16_arguments)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) compiled_code_p;\n\n    args_p->stack_limit = context_p->stack_limit;\n    args_p->script_value = context_p->script_value;\n    args_p->argument_end = context_p->argument_count;\n    args_p->register_end = context_p->register_count;\n    args_p->ident_end = ident_end;\n    args_p->const_literal_end = const_literal_end;\n    args_p->literal_end = context_p->literal_count;\n\n    compiled_code_p->status_flags |= CBC_CODE_FLAGS_UINT16_ARGUMENTS;\n    byte_code_p += sizeof (cbc_uint16_arguments_t);\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) compiled_code_p;\n\n    args_p->stack_limit = (uint8_t) context_p->stack_limit;\n    args_p->argument_end = (uint8_t) context_p->argument_count;\n    args_p->script_value = context_p->script_value;\n    args_p->register_end = (uint8_t) context_p->register_count;\n    args_p->ident_end = (uint8_t) ident_end;\n    args_p->const_literal_end = (uint8_t) const_literal_end;\n    args_p->literal_end = (uint8_t) context_p->literal_count;\n\n    byte_code_p += sizeof (cbc_uint8_arguments_t);\n  }\n\n  uint16_t encoding_limit;\n  uint16_t encoding_delta;\n\n  if (context_p->literal_count > CBC_MAXIMUM_SMALL_VALUE)\n  {\n    compiled_code_p->status_flags |= CBC_CODE_FLAGS_FULL_LITERAL_ENCODING;\n    encoding_limit = CBC_FULL_LITERAL_ENCODING_LIMIT;\n    encoding_delta = CBC_FULL_LITERAL_ENCODING_DELTA;\n  }\n  else\n  {\n    encoding_limit = CBC_SMALL_LITERAL_ENCODING_LIMIT;\n    encoding_delta = CBC_SMALL_LITERAL_ENCODING_DELTA;\n  }\n\n  if (context_p->status_flags & PARSER_IS_STRICT)\n  {\n    compiled_code_p->status_flags |= CBC_CODE_FLAGS_STRICT_MODE;\n  }\n\n  if ((context_p->status_flags & PARSER_ARGUMENTS_NEEDED) && PARSER_NEEDS_MAPPED_ARGUMENTS (context_p->status_flags))\n  {\n    compiled_code_p->status_flags |= CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED;\n  }\n\n  if (!(context_p->status_flags & PARSER_LEXICAL_ENV_NEEDED))\n  {\n    compiled_code_p->status_flags |= CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED;\n  }\n\n  uint16_t function_type = CBC_FUNCTION_TO_TYPE_BITS (CBC_FUNCTION_NORMAL);\n\n  if (context_p->status_flags & (PARSER_IS_PROPERTY_GETTER | PARSER_IS_PROPERTY_SETTER))\n  {\n    function_type = CBC_FUNCTION_TO_TYPE_BITS (CBC_FUNCTION_ACCESSOR);\n  }\n  else if (!(context_p->status_flags & PARSER_IS_FUNCTION))\n  {\n    function_type = CBC_FUNCTION_TO_TYPE_BITS (CBC_FUNCTION_SCRIPT);\n  }\n  else if (context_p->status_flags & PARSER_IS_ARROW_FUNCTION)\n  {\n    if (context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)\n    {\n      function_type = CBC_FUNCTION_TO_TYPE_BITS (CBC_FUNCTION_ASYNC_ARROW);\n    }\n    else\n    {\n      function_type = CBC_FUNCTION_TO_TYPE_BITS (CBC_FUNCTION_ARROW);\n    }\n  }\n  else if (context_p->status_flags & PARSER_IS_GENERATOR_FUNCTION)\n  {\n    if (context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)\n    {\n      function_type = CBC_FUNCTION_TO_TYPE_BITS (CBC_FUNCTION_ASYNC_GENERATOR);\n    }\n    else\n    {\n      function_type = CBC_FUNCTION_TO_TYPE_BITS (CBC_FUNCTION_GENERATOR);\n    }\n  }\n  else if (context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)\n  {\n    function_type = CBC_FUNCTION_TO_TYPE_BITS (CBC_FUNCTION_ASYNC);\n  }\n  else if (context_p->status_flags & PARSER_CLASS_CONSTRUCTOR)\n  {\n    function_type = CBC_FUNCTION_TO_TYPE_BITS (CBC_FUNCTION_CONSTRUCTOR);\n  }\n  else if (context_p->status_flags & PARSER_IS_METHOD)\n  {\n    function_type = CBC_FUNCTION_TO_TYPE_BITS (CBC_FUNCTION_METHOD);\n  }\n\n  if (context_p->status_flags & PARSER_LEXICAL_BLOCK_NEEDED)\n  {\n    JERRY_ASSERT (!(context_p->status_flags & PARSER_IS_FUNCTION));\n    compiled_code_p->status_flags |= CBC_CODE_FLAGS_LEXICAL_BLOCK_NEEDED;\n  }\n\n  compiled_code_p->status_flags |= function_type;\n\n#if JERRY_LINE_INFO\n  compiled_code_p->status_flags |= CBC_CODE_FLAGS_HAS_LINE_INFO;\n#endif /* JERRY_LINE_INFO */\n\n  literal_pool_p = ((ecma_value_t *) byte_code_p) - context_p->register_count;\n  byte_code_p += literal_length;\n  dst_p = byte_code_p;\n\n  parser_init_literal_pool (context_p, literal_pool_p);\n\n  page_p = context_p->byte_code.first_p;\n  offset = 0;\n  real_offset = 0;\n  uint8_t last_register_index =\n    (uint8_t) JERRY_MIN (context_p->register_count, (PARSER_MAXIMUM_NUMBER_OF_REGISTERS - 1));\n\n  while (page_p != last_page_p || offset < last_position)\n  {\n    uint8_t flags;\n    uint8_t *opcode_p;\n    uint8_t *branch_mark_p;\n    cbc_opcode_t opcode;\n    size_t branch_offset_length;\n\n    opcode_p = dst_p;\n    branch_mark_p = page_p->bytes + offset;\n    opcode = (cbc_opcode_t) (*branch_mark_p);\n    branch_offset_length = CBC_BRANCH_OFFSET_LENGTH (opcode);\n\n    if (opcode == CBC_JUMP_FORWARD)\n    {\n      /* These opcodes are deleted from the stream. */\n      size_t counter = PARSER_MAX_BRANCH_LENGTH + 1;\n\n      do\n      {\n        PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);\n      } while (--counter > 0);\n\n      continue;\n    }\n\n    /* Storing the opcode */\n    *dst_p++ = (uint8_t) opcode;\n    real_offset++;\n    PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);\n    flags = cbc_flags[opcode];\n\n#if JERRY_DEBUGGER\n    if (opcode == CBC_BREAKPOINT_DISABLED)\n    {\n      uint32_t bp_offset = (uint32_t) (((uint8_t *) dst_p) - ((uint8_t *) compiled_code_p) - 1);\n      parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST, bp_offset);\n    }\n#endif /* JERRY_DEBUGGER */\n\n    if (opcode == CBC_EXT_OPCODE)\n    {\n      cbc_ext_opcode_t ext_opcode;\n\n      ext_opcode = (cbc_ext_opcode_t) page_p->bytes[offset];\n      flags = cbc_ext_flags[ext_opcode];\n      branch_offset_length = CBC_BRANCH_OFFSET_LENGTH (ext_opcode);\n\n      /* Storing the extended opcode */\n      *dst_p++ = (uint8_t) ext_opcode;\n      opcode_p++;\n      real_offset++;\n      PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);\n    }\n\n    /* Only literal and call arguments can be combined. */\n    JERRY_ASSERT (!(flags & CBC_HAS_BRANCH_ARG) || !(flags & (CBC_HAS_BYTE_ARG | CBC_HAS_LITERAL_ARG)));\n\n    while (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))\n    {\n      uint16_t first_byte = page_p->bytes[offset];\n\n      uint8_t *opcode_pos_p = dst_p - 1;\n      *dst_p++ = (uint8_t) first_byte;\n      real_offset++;\n      PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);\n\n      if (first_byte > literal_one_byte_limit)\n      {\n        *dst_p++ = page_p->bytes[offset];\n\n        if (first_byte >= encoding_limit)\n        {\n          first_byte = (uint16_t) (((first_byte << 8) | dst_p[-1]) - encoding_delta);\n        }\n        real_offset++;\n      }\n      PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);\n\n      if (flags & CBC_HAS_LITERAL_ARG2)\n      {\n        if (flags & CBC_HAS_LITERAL_ARG)\n        {\n          flags = CBC_HAS_LITERAL_ARG;\n        }\n        else\n        {\n          flags = CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2;\n        }\n      }\n      else\n      {\n        if (opcode == CBC_ASSIGN_SET_IDENT && JERRY_LIKELY (first_byte < last_register_index))\n        {\n          *opcode_pos_p = CBC_MOV_IDENT;\n        }\n\n        break;\n      }\n    }\n\n    if (flags & CBC_HAS_BYTE_ARG)\n    {\n      /* This argument will be copied without modification. */\n      *dst_p++ = page_p->bytes[offset];\n      real_offset++;\n      PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);\n      continue;\n    }\n\n    if (flags & CBC_HAS_BRANCH_ARG)\n    {\n      *branch_mark_p |= CBC_HIGHEST_BIT_MASK;\n      bool prefix_zero = true;\n\n      /* The leading zeroes are dropped from the stream. */\n      JERRY_ASSERT (branch_offset_length > 0 && branch_offset_length <= 3);\n\n      while (--branch_offset_length > 0)\n      {\n        uint8_t byte = page_p->bytes[offset];\n        if (byte > 0 || !prefix_zero)\n        {\n          prefix_zero = false;\n          *dst_p++ = page_p->bytes[offset];\n          real_offset++;\n        }\n        else\n        {\n          /* When a leading zero is dropped, the branch\n           * offset length must be decreased as well. */\n          (*opcode_p)--;\n        }\n        PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);\n      }\n\n      *dst_p++ = page_p->bytes[offset];\n      real_offset++;\n      PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);\n      continue;\n    }\n  }\n\n#if JERRY_DEBUGGER\n  if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) && context_p->breakpoint_info_count > 0)\n  {\n    parser_send_breakpoints (context_p, JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST);\n    JERRY_ASSERT (context_p->breakpoint_info_count == 0);\n  }\n#endif /* JERRY_DEBUGGER */\n\n  if (!(context_p->status_flags & PARSER_NO_END_LABEL))\n  {\n    *dst_p++ = CBC_RETURN_FUNCTION_END;\n\n    if (PARSER_IS_NORMAL_ASYNC_FUNCTION (context_p->status_flags))\n    {\n      dst_p[-1] = CBC_EXT_OPCODE;\n      dst_p[0] = CBC_EXT_ASYNC_EXIT;\n      dst_p++;\n    }\n  }\n  JERRY_ASSERT (dst_p == byte_code_p + length);\n\n#if JERRY_LINE_INFO\n  uint8_t *line_info_p = parser_line_info_generate (context_p);\n#endif /* JERRY_LINE_INFO */\n\n  parse_update_branches (context_p, byte_code_p);\n\n  parser_cbc_stream_free (&context_p->byte_code);\n\n  if (context_p->status_flags & PARSER_HAS_LATE_LIT_INIT)\n  {\n    parser_list_iterator_t literal_iterator;\n    lexer_literal_t *literal_p;\n    uint16_t register_count = context_p->register_count;\n\n    parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n    while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)))\n    {\n      if ((literal_p->status_flags & LEXER_FLAG_LATE_INIT) && literal_p->prop.index >= register_count)\n      {\n        uint32_t source_data = literal_p->u.source_data;\n        const uint8_t *char_p = context_p->source_end_p - (source_data & 0xfffff);\n        ecma_value_t lit_value = ecma_find_or_create_literal_string (char_p,\n                                                                     source_data >> 20,\n                                                                     (literal_p->status_flags & LEXER_FLAG_ASCII) != 0);\n        literal_pool_p[literal_p->prop.index] = lit_value;\n      }\n    }\n  }\n\n  ecma_value_t *base_p = (ecma_value_t *) (((uint8_t *) compiled_code_p) + total_size);\n\n  if (PARSER_NEEDS_MAPPED_ARGUMENTS (context_p->status_flags))\n  {\n    parser_list_iterator_t literal_iterator;\n    uint16_t argument_count = 0;\n    uint16_t register_count = context_p->register_count;\n    base_p -= context_p->argument_count;\n\n    parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);\n    while (argument_count < context_p->argument_count)\n    {\n      lexer_literal_t *literal_p;\n      literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator);\n\n      JERRY_ASSERT (literal_p != NULL);\n\n      if (!(literal_p->status_flags & LEXER_FLAG_FUNCTION_ARGUMENT))\n      {\n        continue;\n      }\n\n      /* All arguments must be moved to initialized registers. */\n      if (literal_p->type == LEXER_UNUSED_LITERAL)\n      {\n        base_p[argument_count] = ECMA_VALUE_EMPTY;\n        argument_count++;\n        continue;\n      }\n\n      JERRY_ASSERT (literal_p->type == LEXER_IDENT_LITERAL);\n\n      JERRY_ASSERT (literal_p->prop.index >= register_count);\n\n      base_p[argument_count] = literal_pool_p[literal_p->prop.index];\n      argument_count++;\n    }\n  }\n\n  if (!(context_p->status_flags & PARSER_CLASS_CONSTRUCTOR))\n  {\n    *(--base_p) = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);\n  }\n\n  if (context_p->tagged_template_literal_cp != JMEM_CP_NULL)\n  {\n    compiled_code_p->status_flags |= CBC_CODE_FLAGS_HAS_TAGGED_LITERALS;\n    *(--base_p) = (ecma_value_t) context_p->tagged_template_literal_cp;\n  }\n\n#if JERRY_LINE_INFO\n  ECMA_SET_INTERNAL_VALUE_POINTER (base_p[-1], line_info_p);\n#endif /* JERRY_LINE_INFO */\n\n  if (extended_info != 0)\n  {\n#if JERRY_LINE_INFO\n    base_p--;\n#endif /* JERRY_LINE_INFO */\n\n    uint8_t *extended_info_p = ((uint8_t *) base_p) - 1;\n\n    compiled_code_p->status_flags |= CBC_CODE_FLAGS_HAS_EXTENDED_INFO;\n    *extended_info_p = extended_info;\n\n    if (context_p->argument_length != UINT16_MAX)\n    {\n      ecma_extended_info_encode_vlq (&extended_info_p, context_p->argument_length);\n    }\n\n#if JERRY_FUNCTION_TO_STRING\n    if (context_p->last_context_p != NULL)\n    {\n      const uint8_t *start_p = context_p->source_start_p;\n\n      if (extended_info & CBC_EXTENDED_CODE_FLAGS_SOURCE_CODE_IN_ARGUMENTS)\n      {\n        start_p = context_p->arguments_start_p;\n      }\n\n      const uint8_t *function_start_p = context_p->last_context_p->function_start_p;\n\n      ecma_extended_info_encode_vlq (&extended_info_p, (uint32_t) (function_start_p - start_p));\n      ecma_extended_info_encode_vlq (&extended_info_p, (uint32_t) (context_p->function_end_p - function_start_p));\n    }\n#endif /* JERRY_FUNCTION_TO_STRING */\n  }\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    util_print_cbc (compiled_code_p);\n    JERRY_DEBUG_MSG (\"\\nByte code size: %d bytes\\n\", (int) length);\n    context_p->total_byte_code_size += (uint32_t) length;\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n#if JERRY_DEBUGGER\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    jerry_debugger_send_function_cp (JERRY_DEBUGGER_BYTE_CODE_CP, compiled_code_p);\n  }\n#endif /* JERRY_DEBUGGER */\n\n  return compiled_code_p;\n} /* parser_post_processing */\n\n#undef PARSER_NEXT_BYTE\n#undef PARSER_NEXT_BYTE_UPDATE\n\n/**\n * Resolve private identifier in direct eval context\n */\nstatic bool\nparser_resolve_private_identifier_eval (parser_context_t *context_p) /**< context */\n{\n  ecma_string_t *search_key_p;\n  uint8_t *destination_p = (uint8_t *) parser_malloc (context_p, context_p->token.lit_location.length);\n\n  lexer_convert_ident_to_cesu8 (destination_p,\n                                context_p->token.lit_location.char_p,\n                                context_p->token.lit_location.length);\n\n  search_key_p = ecma_new_ecma_string_from_utf8 (destination_p, context_p->token.lit_location.length);\n\n  parser_free (destination_p, context_p->token.lit_location.length);\n\n  ecma_object_t *lex_env_p = JERRY_CONTEXT (vm_top_context_p)->lex_env_p;\n\n  while (true)\n  {\n    JERRY_ASSERT (lex_env_p != NULL);\n\n    if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_CLASS\n        && (lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_LEXICAL_ENV_HAS_DATA) != 0\n        && !ECMA_LEX_ENV_CLASS_IS_MODULE (lex_env_p))\n    {\n      ecma_object_t *class_object_p = ((ecma_lexical_environment_class_t *) lex_env_p)->object_p;\n\n      ecma_string_t *internal_string_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_CLASS_PRIVATE_ELEMENTS);\n      ecma_property_t *prop_p = ecma_find_named_property (class_object_p, internal_string_p);\n\n      if (prop_p != NULL)\n      {\n        ecma_value_t *collection_p =\n          ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, ECMA_PROPERTY_VALUE_PTR (prop_p)->value);\n        ecma_value_t *current_p = collection_p + 1;\n        ecma_value_t *end_p = ecma_compact_collection_end (collection_p);\n\n        while (current_p < end_p)\n        {\n          current_p++; /* skip kind */\n          ecma_string_t *private_key_p = ecma_get_prop_name_from_value (*current_p++);\n          current_p++; /* skip value */\n\n          JERRY_ASSERT (ecma_prop_name_is_symbol (private_key_p));\n\n          ecma_string_t *private_key_desc_p =\n            ecma_get_string_from_value (((ecma_extended_string_t *) private_key_p)->u.symbol_descriptor);\n\n          if (ecma_compare_ecma_strings (private_key_desc_p, search_key_p))\n          {\n            ecma_deref_ecma_string (search_key_p);\n            lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_STRING_LITERAL);\n            return true;\n          }\n        }\n      }\n    }\n\n    if (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL)\n    {\n      break;\n    }\n\n    lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n  }\n\n  ecma_deref_ecma_string (search_key_p);\n  return false;\n} /* parser_resolve_private_identifier_eval */\n\n/**\n * Resolve private identifier\n */\nvoid\nparser_resolve_private_identifier (parser_context_t *context_p) /**< context */\n{\n  if ((context_p->global_status_flags & ECMA_PARSE_DIRECT_EVAL) && parser_resolve_private_identifier_eval (context_p))\n  {\n    return;\n  }\n\n  parser_private_context_t *context_iter_p = context_p->private_context_p;\n\n  while (context_iter_p)\n  {\n    if (context_iter_p == NULL || !(context_iter_p->opts & SCANNER_PRIVATE_FIELD_ACTIVE))\n    {\n      parser_raise_error (context_p, PARSER_ERR_UNDECLARED_PRIVATE_FIELD);\n    }\n\n    if (!(context_iter_p->opts & SCANNER_SUCCESSFUL_CLASS_SCAN))\n    {\n      lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_STRING_LITERAL);\n      return;\n    }\n\n    parser_private_context_t *private_context_p = context_iter_p;\n\n    if (private_context_p == NULL)\n    {\n      parser_raise_error (context_p, PARSER_ERR_UNDECLARED_PRIVATE_FIELD);\n    }\n\n    scanner_class_private_member_t *ident_iter = private_context_p->members_p;\n\n    while (ident_iter)\n    {\n      if (lexer_compare_identifiers (context_p, &context_p->token.lit_location, &ident_iter->loc))\n      {\n        lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_STRING_LITERAL);\n        return;\n      }\n\n      ident_iter = ident_iter->prev_p;\n    }\n\n    context_iter_p = context_iter_p->prev_p;\n  }\n\n  parser_raise_error (context_p, PARSER_ERR_UNDECLARED_PRIVATE_FIELD);\n} /* parser_resolve_private_identifier */\n\n/**\n * Save private field context\n */\nvoid\nparser_save_private_context (parser_context_t *context_p, /**< context */\n                             parser_private_context_t *private_ctx_p, /**< private context */\n                             scanner_class_info_t *class_info_p) /**< class scanner info */\n{\n  private_ctx_p->prev_p = context_p->private_context_p;\n  context_p->private_context_p = private_ctx_p;\n\n  context_p->private_context_p->members_p = class_info_p->members;\n  context_p->private_context_p->opts = class_info_p->info.u8_arg;\n  class_info_p->members = NULL;\n} /* parser_save_private_context */\n\n/**\n * Release contexts private fields\n */\nstatic void\nparser_free_private_fields (parser_context_t *context_p) /**< context */\n{\n  parser_private_context_t *iter = context_p->private_context_p;\n\n  while (iter != NULL)\n  {\n    parser_private_context_t *prev_p = iter->prev_p;\n    scanner_release_private_fields (iter->members_p);\n    iter = prev_p;\n  }\n} /* parser_free_private_fields */\n\n/**\n * Restore contexts private fields\n */\nvoid\nparser_restore_private_context (parser_context_t *context_p, /**< context */\n                                parser_private_context_t *private_ctx_p) /**< private context */\n{\n  scanner_release_private_fields (context_p->private_context_p->members_p);\n  context_p->private_context_p = private_ctx_p->prev_p;\n} /* parser_restore_private_context */\n\n/**\n * Free identifiers and literals.\n */\nstatic void\nparser_free_literals (parser_list_t *literal_pool_p) /**< literals */\n{\n  parser_list_iterator_t literal_iterator;\n  lexer_literal_t *literal_p;\n\n  parser_list_iterator_init (literal_pool_p, &literal_iterator);\n  while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n  {\n    util_free_literal (literal_p);\n  }\n\n  parser_list_free (literal_pool_p);\n} /* parser_free_literals */\n\n/**\n * Parse function arguments\n */\nstatic void\nparser_parse_function_arguments (parser_context_t *context_p, /**< context */\n                                 lexer_token_type_t end_type) /**< expected end type */\n{\n  JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);\n\n  JERRY_ASSERT (context_p->status_flags & PARSER_IS_FUNCTION);\n  JERRY_ASSERT (!(context_p->status_flags & PARSER_LEXICAL_BLOCK_NEEDED));\n\n  bool has_duplicated_arg_names = false;\n\n  if (PARSER_IS_NORMAL_ASYNC_FUNCTION (context_p->status_flags))\n  {\n    parser_branch_t branch;\n    parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_TRY_CREATE_CONTEXT, &branch);\n    parser_stack_push (context_p, &branch, sizeof (parser_branch_t));\n\n#ifndef JERRY_NDEBUG\n    context_p->context_stack_depth = PARSER_TRY_CONTEXT_STACK_ALLOCATION;\n#endif /* !JERRY_NDEBUG */\n  }\n\n  if (context_p->token.type == end_type)\n  {\n    context_p->status_flags &= (uint32_t) ~PARSER_DISALLOW_AWAIT_YIELD;\n\n    if (context_p->status_flags & PARSER_IS_GENERATOR_FUNCTION)\n    {\n      scanner_create_variables (context_p, SCANNER_CREATE_VARS_IS_FUNCTION_ARGS);\n      parser_emit_cbc_ext (context_p, CBC_EXT_CREATE_GENERATOR);\n      parser_emit_cbc (context_p, CBC_POP);\n      scanner_create_variables (context_p, SCANNER_CREATE_VARS_IS_FUNCTION_BODY);\n      return;\n    }\n\n    scanner_create_variables (context_p, SCANNER_CREATE_VARS_NO_OPTS);\n    return;\n  }\n\n  bool has_complex_argument = (context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_HAS_COMPLEX_ARGUMENT) != 0;\n  bool is_strict = (context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_IS_STRICT) != 0;\n\n  scanner_create_variables (context_p, SCANNER_CREATE_VARS_IS_FUNCTION_ARGS);\n  scanner_set_active (context_p);\n\n  context_p->status_flags |= PARSER_FUNCTION_IS_PARSING_ARGS;\n\n  while (true)\n  {\n    if (context_p->token.type == LEXER_THREE_DOTS)\n    {\n      if (context_p->status_flags & PARSER_IS_PROPERTY_SETTER)\n      {\n        parser_raise_error (context_p, PARSER_ERR_SETTER_REST_PARAMETER);\n      }\n      lexer_next_token (context_p);\n\n      if (has_duplicated_arg_names)\n      {\n        parser_raise_error (context_p, PARSER_ERR_DUPLICATED_ARGUMENT_NAMES);\n      }\n\n      context_p->status_flags |= PARSER_FUNCTION_HAS_REST_PARAM | PARSER_FUNCTION_HAS_COMPLEX_ARGUMENT;\n    }\n\n    if (context_p->token.type == LEXER_LEFT_SQUARE || context_p->token.type == LEXER_LEFT_BRACE)\n    {\n      if (has_duplicated_arg_names)\n      {\n        parser_raise_error (context_p, PARSER_ERR_DUPLICATED_ARGUMENT_NAMES);\n      }\n\n      context_p->status_flags |= PARSER_FUNCTION_HAS_COMPLEX_ARGUMENT;\n\n      if (!(context_p->status_flags & PARSER_FUNCTION_HAS_REST_PARAM))\n      {\n        parser_emit_cbc_literal (context_p,\n                                 CBC_PUSH_LITERAL,\n                                 (uint16_t) (PARSER_REGISTER_START + context_p->argument_count));\n      }\n      else\n      {\n        parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_REST_OBJECT);\n      }\n\n      uint32_t flags =\n        (PARSER_PATTERN_BINDING | PARSER_PATTERN_TARGET_ON_STACK | PARSER_PATTERN_LOCAL | PARSER_PATTERN_ARGUMENTS);\n\n      if (context_p->next_scanner_info_p->source_p == context_p->source_p)\n      {\n        if (context_p->next_scanner_info_p->type == SCANNER_TYPE_INITIALIZER)\n        {\n          if (context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_OBJECT_HAS_REST)\n          {\n            flags |= PARSER_PATTERN_HAS_REST_ELEMENT;\n          }\n\n          if (context_p->status_flags & PARSER_FUNCTION_HAS_REST_PARAM)\n          {\n            parser_raise_error (context_p, PARSER_ERR_REST_PARAMETER_DEFAULT_INITIALIZER);\n          }\n\n          if (context_p->argument_length == UINT16_MAX)\n          {\n            context_p->argument_length = context_p->argument_count;\n          }\n\n          flags |= PARSER_PATTERN_TARGET_DEFAULT;\n        }\n        else if (context_p->next_scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS)\n        {\n          if (context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_OBJECT_HAS_REST)\n          {\n            flags |= PARSER_PATTERN_HAS_REST_ELEMENT;\n          }\n          scanner_release_next (context_p, sizeof (scanner_info_t));\n        }\n        else\n        {\n          parser_raise_error (context_p, PARSER_ERR_INVALID_DESTRUCTURING_PATTERN);\n        }\n      }\n\n      parser_parse_initializer (context_p, flags);\n\n      context_p->argument_count++;\n      if (context_p->argument_count >= PARSER_MAXIMUM_NUMBER_OF_REGISTERS)\n      {\n        parser_raise_error (context_p, PARSER_ERR_ARGUMENT_LIMIT_REACHED);\n      }\n\n      if (context_p->token.type != LEXER_COMMA)\n      {\n        if (context_p->token.type != end_type)\n        {\n          parser_error_msg_t error =\n            ((end_type == LEXER_RIGHT_PAREN) ? PARSER_ERR_RIGHT_PAREN_EXPECTED : PARSER_ERR_IDENTIFIER_EXPECTED);\n\n          parser_raise_error (context_p, error);\n        }\n        break;\n      }\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == end_type)\n      {\n        break;\n      }\n      continue;\n    }\n\n    if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n    {\n      parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);\n    }\n\n    lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_IDENT_LITERAL);\n\n    if (context_p->token.keyword_type >= LEXER_FIRST_NON_STRICT_ARGUMENTS)\n    {\n      context_p->status_flags |= PARSER_HAS_NON_STRICT_ARG;\n    }\n\n    if (JERRY_UNLIKELY (context_p->lit_object.literal_p->status_flags & LEXER_FLAG_FUNCTION_ARGUMENT))\n    {\n      if ((context_p->status_flags & PARSER_FUNCTION_HAS_COMPLEX_ARGUMENT)\n          || (context_p->status_flags & PARSER_IS_ARROW_FUNCTION))\n      {\n        parser_raise_error (context_p, PARSER_ERR_DUPLICATED_ARGUMENT_NAMES);\n      }\n      has_duplicated_arg_names = true;\n\n      context_p->status_flags |= PARSER_HAS_NON_STRICT_ARG;\n    }\n    else\n    {\n      context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_FUNCTION_ARGUMENT;\n    }\n\n    lexer_next_token (context_p);\n\n    uint16_t literal_index = context_p->lit_object.index;\n\n    if (context_p->token.type == LEXER_ASSIGN)\n    {\n      JERRY_ASSERT (has_complex_argument);\n\n      if (context_p->status_flags & PARSER_FUNCTION_HAS_REST_PARAM)\n      {\n        parser_raise_error (context_p, PARSER_ERR_REST_PARAMETER_DEFAULT_INITIALIZER);\n      }\n\n      if (context_p->argument_length == UINT16_MAX)\n      {\n        context_p->argument_length = context_p->argument_count;\n      }\n\n      parser_branch_t skip_init;\n\n      if (has_duplicated_arg_names)\n      {\n        parser_raise_error (context_p, PARSER_ERR_DUPLICATED_ARGUMENT_NAMES);\n      }\n\n      context_p->status_flags |= PARSER_FUNCTION_HAS_COMPLEX_ARGUMENT;\n\n      /* LEXER_ASSIGN does not overwrite lit_object. */\n      parser_emit_cbc_literal (context_p,\n                               CBC_PUSH_LITERAL,\n                               (uint16_t) (PARSER_REGISTER_START + context_p->argument_count));\n      parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_DEFAULT_INITIALIZER, &skip_init);\n\n      lexer_next_token (context_p);\n      parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n\n      parser_set_branch_to_current_position (context_p, &skip_init);\n\n      uint16_t opcode = CBC_ASSIGN_LET_CONST;\n\n      if (literal_index >= PARSER_REGISTER_START)\n      {\n        opcode = CBC_MOV_IDENT;\n      }\n      else if (!scanner_literal_is_created (context_p, literal_index))\n      {\n        opcode = CBC_INIT_ARG_OR_CATCH;\n      }\n\n      parser_emit_cbc_literal (context_p, opcode, literal_index);\n    }\n    else if (context_p->status_flags & PARSER_FUNCTION_HAS_REST_PARAM)\n    {\n      parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_REST_OBJECT);\n\n      uint16_t opcode = CBC_MOV_IDENT;\n\n      if (literal_index < PARSER_REGISTER_START)\n      {\n        opcode = CBC_INIT_ARG_OR_CATCH;\n\n        if (scanner_literal_is_created (context_p, literal_index))\n        {\n          opcode = CBC_ASSIGN_LET_CONST;\n        }\n      }\n\n      parser_emit_cbc_literal (context_p, opcode, literal_index);\n    }\n    else if (has_complex_argument && literal_index < PARSER_REGISTER_START)\n    {\n      uint16_t opcode = CBC_INIT_ARG_OR_FUNC;\n\n      if (scanner_literal_is_created (context_p, literal_index))\n      {\n        opcode = CBC_ASSIGN_LET_CONST_LITERAL;\n      }\n\n      parser_emit_cbc_literal_value (context_p,\n                                     opcode,\n                                     (uint16_t) (PARSER_REGISTER_START + context_p->argument_count),\n                                     literal_index);\n    }\n\n    context_p->argument_count++;\n    if (context_p->argument_count >= PARSER_MAXIMUM_NUMBER_OF_REGISTERS)\n    {\n      parser_raise_error (context_p, PARSER_ERR_ARGUMENT_LIMIT_REACHED);\n    }\n\n    if (context_p->token.type != LEXER_COMMA)\n    {\n      if (context_p->token.type != end_type)\n      {\n        parser_error_msg_t error =\n          ((end_type == LEXER_RIGHT_PAREN) ? PARSER_ERR_RIGHT_PAREN_EXPECTED : PARSER_ERR_IDENTIFIER_EXPECTED);\n\n        parser_raise_error (context_p, error);\n      }\n      break;\n    }\n\n    if (context_p->status_flags & PARSER_FUNCTION_HAS_REST_PARAM)\n    {\n      parser_raise_error (context_p, PARSER_ERR_FORMAL_PARAM_AFTER_REST_PARAMETER);\n    }\n\n    lexer_next_token (context_p);\n\n    if (context_p->token.type == end_type)\n    {\n      break;\n    }\n  }\n\n  scanner_revert_active (context_p);\n\n  JERRY_ASSERT (has_complex_argument || !(context_p->status_flags & PARSER_FUNCTION_HAS_COMPLEX_ARGUMENT));\n\n  if (context_p->status_flags & PARSER_IS_GENERATOR_FUNCTION)\n  {\n    parser_emit_cbc_ext (context_p, CBC_EXT_CREATE_GENERATOR);\n    parser_emit_cbc (context_p, CBC_POP);\n  }\n\n  if (context_p->status_flags & PARSER_LEXICAL_BLOCK_NEEDED)\n  {\n    if ((context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_LEXICAL_ENV_NEEDED)\n        || scanner_is_context_needed (context_p, PARSER_CHECK_FUNCTION_CONTEXT))\n    {\n      context_p->status_flags |= PARSER_LEXICAL_ENV_NEEDED;\n\n      parser_branch_t branch;\n      parser_emit_cbc_forward_branch (context_p, CBC_BLOCK_CREATE_CONTEXT, &branch);\n      parser_stack_push (context_p, &branch, sizeof (parser_branch_t));\n\n#ifndef JERRY_NDEBUG\n      PARSER_PLUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_BLOCK_CONTEXT_STACK_ALLOCATION);\n#endif /* !JERRY_NDEBUG */\n    }\n    else\n    {\n      context_p->status_flags &= (uint32_t) ~PARSER_LEXICAL_BLOCK_NEEDED;\n    }\n  }\n\n  context_p->status_flags &= (uint32_t) ~(PARSER_DISALLOW_AWAIT_YIELD | PARSER_FUNCTION_IS_PARSING_ARGS);\n  scanner_create_variables (context_p, SCANNER_CREATE_VARS_IS_FUNCTION_BODY);\n\n  if (is_strict)\n  {\n    context_p->status_flags |= PARSER_IS_STRICT;\n  }\n} /* parser_parse_function_arguments */\n\n#ifndef JERRY_NDEBUG\nJERRY_STATIC_ASSERT (PARSER_SCANNING_SUCCESSFUL == PARSER_HAS_LATE_LIT_INIT,\n                     parser_scanning_successful_should_share_the_bit_position_with_parser_has_late_lit_init);\n#endif /* !JERRY_NDEBUG */\n\n/**\n * Parser script size\n */\nstatic size_t\nparser_script_size (parser_context_t *context_p) /**< context */\n{\n  size_t script_size = sizeof (cbc_script_t);\n\n  if (context_p->user_value != ECMA_VALUE_EMPTY)\n  {\n    script_size += sizeof (ecma_value_t);\n  }\n\n#if JERRY_FUNCTION_TO_STRING\n  if (context_p->argument_list != ECMA_VALUE_EMPTY)\n  {\n    script_size += sizeof (ecma_value_t);\n  }\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n#if JERRY_MODULE_SYSTEM\n  if (context_p->global_status_flags & ECMA_PARSE_INTERNAL_HAS_IMPORT_META)\n  {\n    script_size += sizeof (ecma_value_t);\n  }\n#endif /* JERRY_MODULE_SYSTEM */\n  return script_size;\n} /* parser_script_size */\n\n#if JERRY_SOURCE_NAME\n/**\n * Parser resource name\n */\nstatic ecma_value_t\nparser_source_name (parser_context_t *context_p) /**< context */\n{\n  if (context_p->options_p != NULL && (context_p->options_p->options & JERRY_PARSE_HAS_SOURCE_NAME))\n  {\n    JERRY_ASSERT (ecma_is_value_string (context_p->options_p->source_name));\n\n    ecma_ref_ecma_string (ecma_get_string_from_value (context_p->options_p->source_name));\n    return context_p->options_p->source_name;\n  }\n\n  if (context_p->global_status_flags & ECMA_PARSE_EVAL)\n  {\n    return ecma_make_magic_string_value (LIT_MAGIC_STRING_SOURCE_NAME_EVAL);\n  }\n\n  return ecma_make_magic_string_value (LIT_MAGIC_STRING_SOURCE_NAME_ANON);\n} /* parser_source_name */\n#endif /* JERRY_SOURCE_NAME */\n\n/**\n * Parse and compile EcmaScript source code\n *\n * Note: source must be a valid UTF-8 string\n *\n * @return compiled code\n */\nstatic ecma_compiled_code_t *\nparser_parse_source (void *source_p, /**< source code */\n                     uint32_t parse_opts, /**< ecma_parse_opts_t option bits */\n                     const jerry_parse_options_t *options_p) /**< additional configuration options */\n{\n  parser_context_t context;\n  ecma_compiled_code_t *compiled_code_p;\n\n  context.error = PARSER_ERR_NO_ERROR;\n  context.status_flags = parse_opts & PARSER_STRICT_MODE_MASK;\n  context.global_status_flags = parse_opts;\n\n  context.status_flags |= PARSER_RESTORE_STATUS_FLAGS (parse_opts);\n  context.tagged_template_literal_cp = JMEM_CP_NULL;\n\n  context.stack_depth = 0;\n  context.stack_limit = 0;\n  context.options_p = options_p;\n  context.script_p = NULL;\n  context.arguments_start_p = NULL;\n  context.arguments_size = 0;\n#if JERRY_MODULE_SYSTEM\n  if (context.global_status_flags & ECMA_PARSE_MODULE)\n  {\n    context.status_flags |= PARSER_IS_STRICT;\n  }\n\n  context.module_names_p = NULL;\n#endif /* JERRY_MODULE_SYSTEM */\n\n  context.argument_list = ECMA_VALUE_EMPTY;\n\n  if (context.options_p != NULL && (context.options_p->options & JERRY_PARSE_HAS_ARGUMENT_LIST))\n  {\n    context.argument_list = context.options_p->argument_list;\n  }\n  else if (context.global_status_flags & ECMA_PARSE_HAS_ARGUMENT_LIST_VALUE)\n  {\n    JERRY_ASSERT (context.global_status_flags & ECMA_PARSE_HAS_SOURCE_VALUE);\n    context.argument_list = ((ecma_value_t *) source_p)[1];\n  }\n\n  if (context.argument_list != ECMA_VALUE_EMPTY)\n  {\n    JERRY_ASSERT (ecma_is_value_string (context.argument_list));\n\n    context.status_flags |= PARSER_IS_FUNCTION;\n\n    if (parse_opts & ECMA_PARSE_GENERATOR_FUNCTION)\n    {\n      context.status_flags |= PARSER_IS_GENERATOR_FUNCTION;\n    }\n    if (parse_opts & ECMA_PARSE_ASYNC_FUNCTION)\n    {\n      context.status_flags |= PARSER_IS_ASYNC_FUNCTION;\n    }\n\n    ecma_string_t *string_p = ecma_get_string_from_value (context.argument_list);\n    uint8_t flags = ECMA_STRING_FLAG_EMPTY;\n\n    context.arguments_start_p = ecma_string_get_chars (string_p, &context.arguments_size, NULL, NULL, &flags);\n\n    if (flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n    {\n      context.global_status_flags |= ECMA_PARSE_INTERNAL_FREE_ARG_LIST;\n    }\n  }\n\n  if (!(context.global_status_flags & ECMA_PARSE_HAS_SOURCE_VALUE))\n  {\n    context.source_start_p = ((parser_source_char_t *) source_p)->source_p;\n    context.source_size = (lit_utf8_size_t) ((parser_source_char_t *) source_p)->source_size;\n  }\n  else\n  {\n    ecma_value_t source = ((ecma_value_t *) source_p)[0];\n\n    JERRY_ASSERT (ecma_is_value_string (source));\n\n    ecma_string_t *string_p = ecma_get_string_from_value (source);\n    uint8_t flags = ECMA_STRING_FLAG_EMPTY;\n\n    context.source_start_p = ecma_string_get_chars (string_p, &context.source_size, NULL, NULL, &flags);\n\n    if (flags & ECMA_STRING_FLAG_MUST_BE_FREED)\n    {\n      context.global_status_flags |= ECMA_PARSE_INTERNAL_FREE_SOURCE;\n    }\n  }\n\n#if JERRY_DEBUGGER\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    jerry_debugger_send_string (JERRY_DEBUGGER_SOURCE_CODE,\n                                JERRY_DEBUGGER_NO_SUBTYPE,\n                                context.source_start_p,\n                                context.source_size);\n  }\n#endif /* JERRY_DEBUGGER */\n\n  context.user_value = ECMA_VALUE_EMPTY;\n\n  if ((context.global_status_flags & ECMA_PARSE_EVAL) && JERRY_CONTEXT (vm_top_context_p) != NULL)\n  {\n    const ecma_compiled_code_t *bytecode_header_p = JERRY_CONTEXT (vm_top_context_p)->shared_p->bytecode_header_p;\n\n#if JERRY_SNAPSHOT_EXEC\n    if (JERRY_LIKELY (!(bytecode_header_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)))\n    {\n#endif /* JERRY_SNAPSHOT_EXEC */\n      ecma_value_t parent_script_value = ((cbc_uint8_arguments_t *) bytecode_header_p)->script_value;\n      ;\n      cbc_script_t *parent_script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, parent_script_value);\n\n      if (parent_script_p->refs_and_type & CBC_SCRIPT_HAS_USER_VALUE)\n      {\n        context.user_value = CBC_SCRIPT_GET_USER_VALUE (parent_script_p);\n      }\n#if JERRY_SNAPSHOT_EXEC\n    }\n#endif /* JERRY_SNAPSHOT_EXEC */\n  }\n  else if (context.options_p != NULL && (context.options_p->options & JERRY_PARSE_HAS_USER_VALUE))\n  {\n    context.user_value = context.options_p->user_value;\n  }\n\n  context.last_context_p = NULL;\n  context.last_statement.current_p = NULL;\n  context.token.flags = 0;\n  lexer_init_line_info (&context);\n\n  scanner_info_t scanner_info_end;\n  scanner_info_end.next_p = NULL;\n  scanner_info_end.source_p = NULL;\n  scanner_info_end.type = SCANNER_TYPE_END;\n  context.next_scanner_info_p = &scanner_info_end;\n  context.active_scanner_info_p = NULL;\n  context.skipped_scanner_info_p = NULL;\n  context.skipped_scanner_info_end_p = NULL;\n\n  context.last_cbc_opcode = PARSER_CBC_UNAVAILABLE;\n\n  context.argument_count = 0;\n  context.argument_length = UINT16_MAX;\n  context.register_count = 0;\n  context.literal_count = 0;\n\n  parser_cbc_stream_init (&context.byte_code);\n  context.byte_code_size = 0;\n  parser_list_init (&context.literal_pool,\n                    sizeof (lexer_literal_t),\n                    (uint32_t) ((128 - sizeof (void *)) / sizeof (lexer_literal_t)));\n  context.scope_stack_p = NULL;\n  context.scope_stack_size = 0;\n  context.scope_stack_top = 0;\n  context.scope_stack_reg_top = 0;\n  context.scope_stack_global_end = 0;\n  context.tagged_template_literal_cp = JMEM_CP_NULL;\n  context.private_context_p = NULL;\n\n#ifndef JERRY_NDEBUG\n  context.context_stack_depth = 0;\n#endif /* !JERRY_NDEBUG */\n\n#if JERRY_LINE_INFO\n  context.line_info_p = NULL;\n#endif /* JERRY_LINE_INFO */\n\n#if JERRY_FUNCTION_TO_STRING\n  context.function_start_p = NULL;\n  context.function_end_p = NULL;\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  context.is_show_opcodes = (JERRY_CONTEXT (jerry_init_flags) & JERRY_INIT_SHOW_OPCODES);\n  context.total_byte_code_size = 0;\n\n  if (context.is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"\\n--- %s parsing start ---\\n\\n\", (context.arguments_start_p == NULL) ? \"Script\" : \"Function\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  scanner_scan_all (&context);\n\n  if (JERRY_UNLIKELY (context.error != PARSER_ERR_NO_ERROR))\n  {\n    JERRY_ASSERT (context.error == PARSER_ERR_OUT_OF_MEMORY);\n\n    /* It is unlikely that memory can be allocated in an out-of-memory\n     * situation. However, a simple value can still be thrown. */\n    jcontext_raise_exception (ECMA_VALUE_NULL);\n    return NULL;\n  }\n\n  if (context.arguments_start_p == NULL)\n  {\n    context.source_p = context.source_start_p;\n    context.source_end_p = context.source_start_p + context.source_size;\n  }\n  else\n  {\n    context.source_p = context.arguments_start_p;\n    context.source_end_p = context.arguments_start_p + context.arguments_size;\n  }\n\n  context.u.allocated_buffer_p = NULL;\n  context.token.flags = 0;\n  lexer_init_line_info (&context);\n\n  parser_stack_init (&context);\n\n#if JERRY_DEBUGGER\n  context.breakpoint_info_count = 0;\n#endif /* JERRY_DEBUGGER */\n\n  JERRY_ASSERT (context.next_scanner_info_p->source_p == context.source_p);\n  JERRY_ASSERT (context.next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);\n\n  if (context.next_scanner_info_p->u8_arg & SCANNER_FUNCTION_IS_STRICT)\n  {\n    context.status_flags |= PARSER_IS_STRICT;\n  }\n\n  PARSER_TRY (context.try_buffer)\n  {\n    context.script_p = parser_malloc (&context, parser_script_size (&context));\n\n    CBC_SCRIPT_SET_TYPE (context.script_p, context.user_value, CBC_SCRIPT_REF_ONE);\n\n    if (context.global_status_flags & (ECMA_PARSE_EVAL | ECMA_PARSE_HAS_ARGUMENT_LIST_VALUE))\n    {\n      context.script_p->refs_and_type |= CBC_SCRIPT_IS_EVAL_CODE;\n    }\n\n#if JERRY_BUILTIN_REALMS\n    context.script_p->realm_p = (ecma_object_t *) JERRY_CONTEXT (global_object_p);\n#endif /* JERRY_BUILTIN_REALMS */\n\n#if JERRY_SOURCE_NAME\n    context.script_p->source_name = parser_source_name (&context);\n#endif /* JERRY_SOURCE_NAME */\n\n    ECMA_SET_INTERNAL_VALUE_POINTER (context.script_value, context.script_p);\n\n    /* Pushing a dummy value ensures the stack is never empty.\n     * This simplifies the stack management routines. */\n    parser_stack_push_uint8 (&context, CBC_MAXIMUM_BYTE_VALUE);\n    /* The next token must always be present to make decisions\n     * in the parser. Therefore when a token is consumed, the\n     * lexer_next_token() must be immediately called. */\n    lexer_next_token (&context);\n\n    if (context.arguments_start_p != NULL)\n    {\n      parser_parse_function_arguments (&context, LEXER_EOS);\n\n      JERRY_ASSERT (context.next_scanner_info_p->type == SCANNER_TYPE_END_ARGUMENTS);\n      scanner_release_next (&context, sizeof (scanner_info_t));\n\n      context.source_p = context.source_start_p;\n      context.source_end_p = context.source_start_p + context.source_size;\n      lexer_init_line_info (&context);\n\n      lexer_next_token (&context);\n    }\n#if JERRY_MODULE_SYSTEM\n    else if (parse_opts & ECMA_PARSE_MODULE)\n    {\n      parser_branch_t branch;\n      parser_emit_cbc_forward_branch (&context, CBC_JUMP_FORWARD, &branch);\n\n      scanner_create_variables (&context, SCANNER_CREATE_VARS_IS_MODULE);\n      parser_emit_cbc (&context, CBC_RETURN_FUNCTION_END);\n\n      parser_set_branch_to_current_position (&context, &branch);\n    }\n#endif /* JERRY_MODULE_SYSTEM */\n    else\n    {\n      JERRY_ASSERT (context.next_scanner_info_p->source_p == context.source_start_p\n                    && context.next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);\n\n      if (scanner_is_context_needed (&context, PARSER_CHECK_GLOBAL_CONTEXT))\n      {\n        context.status_flags |= PARSER_LEXICAL_BLOCK_NEEDED;\n      }\n\n      if (!(parse_opts & ECMA_PARSE_EVAL))\n      {\n        scanner_check_variables (&context);\n      }\n\n      scanner_create_variables (&context, SCANNER_CREATE_VARS_IS_SCRIPT);\n    }\n\n    parser_parse_statements (&context);\n\n    JERRY_ASSERT (context.last_statement.current_p == NULL);\n\n    JERRY_ASSERT (context.last_cbc_opcode == PARSER_CBC_UNAVAILABLE);\n    JERRY_ASSERT (context.u.allocated_buffer_p == NULL);\n\n#ifndef JERRY_NDEBUG\n    JERRY_ASSERT (context.status_flags & PARSER_SCANNING_SUCCESSFUL);\n    JERRY_ASSERT (!(context.global_status_flags & ECMA_PARSE_INTERNAL_FOR_IN_OFF_CONTEXT_ERROR));\n    context.status_flags &= (uint32_t) ~PARSER_SCANNING_SUCCESSFUL;\n#endif /* !JERRY_NDEBUG */\n\n    JERRY_ASSERT (!(context.status_flags & PARSER_HAS_LATE_LIT_INIT));\n\n    compiled_code_p = parser_post_processing (&context);\n    parser_list_free (&context.literal_pool);\n\n    /* When parsing is successful, only the dummy value can be remained on the stack. */\n    JERRY_ASSERT (context.stack_top_uint8 == CBC_MAXIMUM_BYTE_VALUE && context.stack.last_position == 1\n                  && context.stack.first_p != NULL && context.stack.first_p->next_p == NULL\n                  && context.stack.last_p == NULL);\n\n    JERRY_ASSERT (context.arguments_start_p != NULL || !(context.status_flags & PARSER_ARGUMENTS_NEEDED));\n\n    context.script_p->refs_and_type -= CBC_SCRIPT_REF_ONE;\n\n    if (context.user_value != ECMA_VALUE_EMPTY)\n    {\n      CBC_SCRIPT_GET_USER_VALUE (context.script_p) = ecma_copy_value_if_not_object (context.user_value);\n    }\n\n#if JERRY_MODULE_SYSTEM\n    if (context.global_status_flags & ECMA_PARSE_INTERNAL_HAS_IMPORT_META)\n    {\n      int idx = (context.user_value != ECMA_VALUE_EMPTY) ? 1 : 0;\n      ecma_value_t module = ecma_make_object_value ((ecma_object_t *) JERRY_CONTEXT (module_current_p));\n\n      CBC_SCRIPT_GET_OPTIONAL_VALUES (context.script_p)[idx] = module;\n      context.script_p->refs_and_type |= CBC_SCRIPT_HAS_IMPORT_META;\n    }\n#endif /* JERRY_MODULE_SYSTEM */\n\n#if JERRY_FUNCTION_TO_STRING\n    if (!(context.global_status_flags & ECMA_PARSE_HAS_SOURCE_VALUE))\n    {\n      ecma_string_t *string_p;\n\n      if (context.global_status_flags & ECMA_PARSE_INTERNAL_HAS_4_BYTE_MARKER)\n      {\n        string_p = ecma_new_ecma_string_from_utf8_converted_to_cesu8 (context.source_start_p, context.source_size);\n      }\n      else\n      {\n        string_p = ecma_new_ecma_string_from_utf8 (context.source_start_p, context.source_size);\n      }\n\n      context.script_p->source_code = ecma_make_string_value (string_p);\n    }\n    else\n    {\n      ecma_value_t source = ((ecma_value_t *) source_p)[0];\n\n      ecma_ref_ecma_string (ecma_get_string_from_value (source));\n      context.script_p->source_code = source;\n    }\n\n    if (context.argument_list != ECMA_VALUE_EMPTY)\n    {\n      int idx = (context.user_value != ECMA_VALUE_EMPTY) ? 1 : 0;\n\n      CBC_SCRIPT_GET_OPTIONAL_VALUES (context.script_p)[idx] = context.argument_list;\n\n      ecma_ref_ecma_string (ecma_get_string_from_value (context.argument_list));\n      context.script_p->refs_and_type |= CBC_SCRIPT_HAS_FUNCTION_ARGUMENTS;\n    }\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n    if (context.is_show_opcodes)\n    {\n      JERRY_DEBUG_MSG (\"\\n%s parsing successfully completed. Total byte code size: %d bytes\\n\",\n                       (context.arguments_start_p == NULL) ? \"Script\" : \"Function\",\n                       (int) context.total_byte_code_size);\n    }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n  }\n  PARSER_CATCH\n  {\n    if (context.last_statement.current_p != NULL)\n    {\n      parser_free_jumps (context.last_statement);\n    }\n\n    parser_free_allocated_buffer (&context);\n\n    scanner_cleanup (&context);\n\n#if JERRY_MODULE_SYSTEM\n    if (context.module_names_p != NULL)\n    {\n      ecma_module_release_module_names (context.module_names_p);\n    }\n#endif /* JERRY_MODULE_SYSTEM */\n\n    compiled_code_p = NULL;\n    parser_free_literals (&context.literal_pool);\n    parser_cbc_stream_free (&context.byte_code);\n\n#if JERRY_SOURCE_NAME\n    ecma_deref_ecma_string (ecma_get_string_from_value (context.script_p->source_name));\n#endif /* JERRY_SOURCE_NAME */\n\n    if (context.script_p != NULL)\n    {\n      JERRY_ASSERT (context.script_p->refs_and_type >= CBC_SCRIPT_REF_ONE);\n      jmem_heap_free_block (context.script_p, parser_script_size (&context));\n    }\n  }\n  PARSER_TRY_END\n\n  if (context.scope_stack_p != NULL)\n  {\n    parser_free (context.scope_stack_p, context.scope_stack_size * sizeof (parser_scope_stack_t));\n  }\n\n#if JERRY_LINE_INFO\n  parser_line_info_free (context.line_info_p);\n#endif /* JERRY_LINE_INFO */\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context.is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"\\n--- %s parsing end ---\\n\\n\", (context.arguments_start_p == NULL) ? \"Script\" : \"Function\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  parser_stack_free (&context);\n\n  if (context.global_status_flags & ECMA_PARSE_INTERNAL_FREE_SOURCE)\n  {\n    jmem_heap_free_block ((void *) context.source_start_p, context.source_size);\n  }\n\n  if (context.global_status_flags & ECMA_PARSE_INTERNAL_FREE_ARG_LIST)\n  {\n    jmem_heap_free_block ((void *) context.arguments_start_p, context.arguments_size);\n  }\n\n  if (compiled_code_p != NULL)\n  {\n    return compiled_code_p;\n  }\n\n#if JERRY_DEBUGGER\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    jerry_debugger_send_type (JERRY_DEBUGGER_PARSE_ERROR);\n  }\n#endif /* JERRY_DEBUGGER */\n\n  if (context.error == PARSER_ERR_OUT_OF_MEMORY)\n  {\n    /* It is unlikely that memory can be allocated in an out-of-memory\n     * situation. However, a simple value can still be thrown. */\n    jcontext_raise_exception (ECMA_VALUE_NULL);\n    return NULL;\n  }\n#if (JERRY_STACK_LIMIT != 0)\n  if (context.error == PARSER_ERR_STACK_OVERFLOW)\n  {\n    ecma_raise_standard_error (JERRY_ERROR_RANGE, ECMA_ERR_MAXIMUM_CALL_STACK_SIZE_EXCEEDED);\n    return NULL;\n  }\n#endif /* JERRY_STACK_LIMIT != 0 */\n\n#if JERRY_ERROR_MESSAGES\n  ecma_string_t *err_str_p;\n\n  if (context.error == PARSER_ERR_INVALID_REGEXP)\n  {\n    ecma_value_t error = jcontext_take_exception ();\n    ecma_property_t *prop_p =\n      ecma_find_named_property (ecma_get_object_from_value (error), ecma_get_magic_string (LIT_MAGIC_STRING_MESSAGE));\n    ecma_free_value (error);\n    JERRY_ASSERT (prop_p);\n    err_str_p = ecma_get_string_from_value (ECMA_PROPERTY_VALUE_PTR (prop_p)->value);\n    ecma_ref_ecma_string (err_str_p);\n  }\n  else\n  {\n    err_str_p = ecma_new_ecma_external_string_from_cesu8 (parser_get_error_utf8 (context.error),\n                                                          parser_get_error_size (context.error),\n                                                          NULL);\n  }\n  ecma_value_t err_str_val = ecma_make_string_value (err_str_p);\n  ecma_value_t line_str_val = ecma_make_uint32_value (context.token.line);\n  ecma_value_t col_str_val = ecma_make_uint32_value (context.token.column);\n  ecma_value_t source_name = parser_source_name (&context);\n\n  ecma_raise_standard_error_with_format (JERRY_ERROR_SYNTAX,\n                                         \"% [%:%:%]\",\n                                         err_str_val,\n                                         source_name,\n                                         line_str_val,\n                                         col_str_val);\n\n  ecma_free_value (source_name);\n  ecma_free_value (col_str_val);\n  ecma_free_value (line_str_val);\n  ecma_deref_ecma_string (err_str_p);\n#else /* !JERRY_ERROR_MESSAGES */\n  if (context.error == PARSER_ERR_INVALID_REGEXP)\n  {\n    jcontext_release_exception ();\n  }\n\n  ecma_raise_syntax_error (ECMA_ERR_EMPTY);\n#endif /* JERRY_ERROR_MESSAGES */\n\n  return NULL;\n} /* parser_parse_source */\n\n/**\n * Save parser context before function parsing.\n */\nstatic void\nparser_save_context (parser_context_t *context_p, /**< context */\n                     parser_saved_context_t *saved_context_p) /**< target for saving the context */\n{\n  JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);\n\n#if JERRY_DEBUGGER\n  if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) && context_p->breakpoint_info_count > 0)\n  {\n    parser_send_breakpoints (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST);\n    context_p->breakpoint_info_count = 0;\n  }\n#endif /* JERRY_DEBUGGER */\n\n  if (context_p->status_flags & PARSER_FUNCTION_IS_PARSING_ARGS)\n  {\n    context_p->status_flags |= PARSER_LEXICAL_BLOCK_NEEDED;\n  }\n\n  /* Save private part of the context. */\n\n  saved_context_p->status_flags = context_p->status_flags;\n  saved_context_p->stack_depth = context_p->stack_depth;\n  saved_context_p->stack_limit = context_p->stack_limit;\n  saved_context_p->prev_context_p = context_p->last_context_p;\n  saved_context_p->last_statement = context_p->last_statement;\n\n  saved_context_p->argument_count = context_p->argument_count;\n  saved_context_p->argument_length = context_p->argument_length;\n  saved_context_p->register_count = context_p->register_count;\n  saved_context_p->literal_count = context_p->literal_count;\n\n  saved_context_p->byte_code = context_p->byte_code;\n  saved_context_p->byte_code_size = context_p->byte_code_size;\n  saved_context_p->literal_pool_data = context_p->literal_pool.data;\n  saved_context_p->scope_stack_p = context_p->scope_stack_p;\n  saved_context_p->scope_stack_size = context_p->scope_stack_size;\n  saved_context_p->scope_stack_top = context_p->scope_stack_top;\n  saved_context_p->scope_stack_reg_top = context_p->scope_stack_reg_top;\n  saved_context_p->scope_stack_global_end = context_p->scope_stack_global_end;\n  saved_context_p->tagged_template_literal_cp = context_p->tagged_template_literal_cp;\n\n#ifndef JERRY_NDEBUG\n  saved_context_p->context_stack_depth = context_p->context_stack_depth;\n#endif /* !JERRY_NDEBUG */\n\n#if JERRY_LINE_INFO\n  saved_context_p->line_info_p = context_p->line_info_p;\n#endif /* JERRY_LINE_INFO */\n\n#if JERRY_FUNCTION_TO_STRING\n  saved_context_p->function_start_p = context_p->function_start_p;\n#endif /* JERRY_FUNCTION_TO_STRING */\n\n  /* Reset private part of the context. */\n\n  context_p->status_flags &= PARSER_IS_STRICT;\n  context_p->stack_depth = 0;\n  context_p->stack_limit = 0;\n  context_p->last_context_p = saved_context_p;\n  context_p->last_statement.current_p = NULL;\n\n  context_p->argument_count = 0;\n  context_p->argument_length = UINT16_MAX;\n  context_p->register_count = 0;\n  context_p->literal_count = 0;\n\n  parser_cbc_stream_init (&context_p->byte_code);\n  context_p->byte_code_size = 0;\n  parser_list_reset (&context_p->literal_pool);\n  context_p->scope_stack_p = NULL;\n  context_p->scope_stack_size = 0;\n  context_p->scope_stack_top = 0;\n  context_p->scope_stack_reg_top = 0;\n  context_p->scope_stack_global_end = 0;\n  context_p->tagged_template_literal_cp = JMEM_CP_NULL;\n\n#ifndef JERRY_NDEBUG\n  context_p->context_stack_depth = 0;\n#endif /* !JERRY_NDEBUG */\n\n#if JERRY_LINE_INFO\n  context_p->line_info_p = NULL;\n#endif /* JERRY_LINE_INFO */\n} /* parser_save_context */\n\n/**\n * Restore parser context after function parsing.\n */\nstatic void\nparser_restore_context (parser_context_t *context_p, /**< context */\n                        parser_saved_context_t *saved_context_p) /**< target for saving the context */\n{\n  parser_list_free (&context_p->literal_pool);\n\n  if (context_p->scope_stack_p != NULL)\n  {\n    parser_free (context_p->scope_stack_p, context_p->scope_stack_size * sizeof (parser_scope_stack_t));\n  }\n\n#if JERRY_LINE_INFO\n  parser_line_info_free (context_p->line_info_p);\n#endif /* JERRY_LINE_INFO */\n\n  /* Restore private part of the context. */\n\n  JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);\n\n  context_p->status_flags = saved_context_p->status_flags;\n  context_p->stack_depth = saved_context_p->stack_depth;\n  context_p->stack_limit = saved_context_p->stack_limit;\n  context_p->last_context_p = saved_context_p->prev_context_p;\n  context_p->last_statement = saved_context_p->last_statement;\n\n  context_p->argument_count = saved_context_p->argument_count;\n  context_p->argument_length = saved_context_p->argument_length;\n  context_p->register_count = saved_context_p->register_count;\n  context_p->literal_count = saved_context_p->literal_count;\n\n  context_p->byte_code = saved_context_p->byte_code;\n  context_p->byte_code_size = saved_context_p->byte_code_size;\n  context_p->literal_pool.data = saved_context_p->literal_pool_data;\n  context_p->scope_stack_p = saved_context_p->scope_stack_p;\n  context_p->scope_stack_size = saved_context_p->scope_stack_size;\n  context_p->scope_stack_top = saved_context_p->scope_stack_top;\n  context_p->scope_stack_reg_top = saved_context_p->scope_stack_reg_top;\n  context_p->scope_stack_global_end = saved_context_p->scope_stack_global_end;\n  context_p->tagged_template_literal_cp = saved_context_p->tagged_template_literal_cp;\n\n#ifndef JERRY_NDEBUG\n  context_p->context_stack_depth = saved_context_p->context_stack_depth;\n#endif /* !JERRY_NDEBUG */\n\n#if JERRY_LINE_INFO\n  context_p->line_info_p = saved_context_p->line_info_p;\n#endif /* JERRY_LINE_INFO */\n} /* parser_restore_context */\n\n/**\n * Parse function code\n *\n * @return compiled code\n */\necma_compiled_code_t *\nparser_parse_function (parser_context_t *context_p, /**< context */\n                       uint32_t status_flags) /**< extra status flags */\n{\n  parser_saved_context_t saved_context;\n  ecma_compiled_code_t *compiled_code_p;\n\n  JERRY_ASSERT (status_flags & PARSER_IS_FUNCTION);\n  parser_save_context (context_p, &saved_context);\n  context_p->status_flags |= status_flags;\n  context_p->status_flags |= PARSER_ALLOW_NEW_TARGET;\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"\\n--- %s parsing start ---\\n\\n\",\n                     (context_p->status_flags & PARSER_CLASS_CONSTRUCTOR) ? \"Class constructor\" : \"Function\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n#if JERRY_DEBUGGER\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    jerry_debugger_send_parse_function (context_p->token.line, context_p->token.column);\n  }\n#endif /* JERRY_DEBUGGER */\n\n  lexer_next_token (context_p);\n\n  if (context_p->token.type != LEXER_LEFT_PAREN)\n  {\n    parser_raise_error (context_p, PARSER_ERR_ARGUMENT_LIST_EXPECTED);\n  }\n\n  lexer_next_token (context_p);\n\n  parser_parse_function_arguments (context_p, LEXER_RIGHT_PAREN);\n  lexer_next_token (context_p);\n\n  if ((context_p->status_flags & PARSER_IS_PROPERTY_GETTER) && context_p->argument_count != 0)\n  {\n    parser_raise_error (context_p, PARSER_ERR_NO_ARGUMENTS_EXPECTED);\n  }\n\n  if ((context_p->status_flags & PARSER_IS_PROPERTY_SETTER) && context_p->argument_count != 1)\n  {\n    parser_raise_error (context_p, PARSER_ERR_ONE_ARGUMENT_EXPECTED);\n  }\n\n  if ((context_p->status_flags & (PARSER_CLASS_CONSTRUCTOR | PARSER_ALLOW_SUPER_CALL)) == PARSER_CLASS_CONSTRUCTOR)\n  {\n    parser_emit_cbc_ext (context_p, CBC_EXT_RUN_FIELD_INIT);\n    parser_flush_cbc (context_p);\n  }\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes && (context_p->status_flags & PARSER_HAS_NON_STRICT_ARG))\n  {\n    JERRY_DEBUG_MSG (\"  Note: legacy (non-strict) argument definition\\n\\n\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  if (context_p->token.type != LEXER_LEFT_BRACE)\n  {\n    parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_EXPECTED);\n  }\n\n  lexer_next_token (context_p);\n  parser_parse_statements (context_p);\n  compiled_code_p = parser_post_processing (context_p);\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"\\n--- %s parsing end ---\\n\\n\",\n                     (context_p->status_flags & PARSER_CLASS_CONSTRUCTOR) ? \"Class constructor\" : \"Function\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  parser_restore_context (context_p, &saved_context);\n\n  return compiled_code_p;\n} /* parser_parse_function */\n\n/**\n * Parse static class block code\n *\n * @return compiled code\n */\necma_compiled_code_t *\nparser_parse_class_static_block (parser_context_t *context_p) /**< context */\n{\n  parser_saved_context_t saved_context;\n  ecma_compiled_code_t *compiled_code_p;\n\n  parser_save_context (context_p, &saved_context);\n  context_p->status_flags |= (PARSER_IS_CLASS_STATIC_BLOCK | PARSER_FUNCTION_CLOSURE | PARSER_ALLOW_SUPER\n                              | PARSER_INSIDE_CLASS_FIELD | PARSER_ALLOW_NEW_TARGET | PARSER_DISALLOW_AWAIT_YIELD);\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"\\n--- Static class block parsing start ---\\n\\n\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  scanner_create_variables (context_p, SCANNER_CREATE_VARS_NO_OPTS);\n  lexer_next_token (context_p);\n\n  parser_parse_statements (context_p);\n  compiled_code_p = parser_post_processing (context_p);\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"\\n--- Static class block parsing end ---\\n\\n\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  parser_restore_context (context_p, &saved_context);\n\n  return compiled_code_p;\n} /* parser_parse_class_static_block */\n\n/**\n * Parse arrow function code\n *\n * @return compiled code\n */\necma_compiled_code_t *\nparser_parse_arrow_function (parser_context_t *context_p, /**< context */\n                             uint32_t status_flags) /**< extra status flags */\n{\n  parser_saved_context_t saved_context;\n  ecma_compiled_code_t *compiled_code_p;\n\n  JERRY_ASSERT (status_flags & PARSER_IS_FUNCTION);\n  JERRY_ASSERT (status_flags & PARSER_IS_ARROW_FUNCTION);\n  parser_save_context (context_p, &saved_context);\n  context_p->status_flags |= status_flags;\n  context_p->status_flags |=\n    saved_context.status_flags & (PARSER_ALLOW_NEW_TARGET | PARSER_ALLOW_SUPER | PARSER_ALLOW_SUPER_CALL);\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"\\n--- Arrow function parsing start ---\\n\\n\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n#if JERRY_DEBUGGER\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    jerry_debugger_send_parse_function (context_p->token.line, context_p->token.column);\n  }\n#endif /* JERRY_DEBUGGER */\n\n  /* The `await` keyword is disallowed in the IdentifierReference position */\n  if (status_flags & PARSER_IS_CLASS_STATIC_BLOCK)\n  {\n    context_p->status_flags |= PARSER_DISALLOW_AWAIT_YIELD;\n  }\n\n  if (context_p->token.type == LEXER_LEFT_PAREN)\n  {\n    lexer_next_token (context_p);\n    parser_parse_function_arguments (context_p, LEXER_RIGHT_PAREN);\n    lexer_next_token (context_p);\n  }\n  else\n  {\n    parser_parse_function_arguments (context_p, LEXER_ARROW);\n  }\n\n  /* The `await` keyword is interpreted as an identifier within the body of arrow functions */\n  if (status_flags & PARSER_IS_CLASS_STATIC_BLOCK)\n  {\n    context_p->status_flags &= (uint32_t) ~(PARSER_DISALLOW_AWAIT_YIELD | PARSER_IS_CLASS_STATIC_BLOCK);\n  }\n\n  JERRY_ASSERT (context_p->token.type == LEXER_ARROW);\n\n  lexer_next_token (context_p);\n  bool next_token_needed = false;\n\n  if (context_p->token.type == LEXER_LEFT_BRACE)\n  {\n    lexer_next_token (context_p);\n\n    context_p->status_flags |= PARSER_IS_CLOSURE;\n    parser_parse_statements (context_p);\n\n    /* Unlike normal function, arrow functions consume their close brace. */\n    JERRY_ASSERT (context_p->token.type == LEXER_RIGHT_BRACE);\n    next_token_needed = true;\n  }\n  else\n  {\n    if (context_p->status_flags & PARSER_IS_STRICT && context_p->status_flags & PARSER_HAS_NON_STRICT_ARG)\n    {\n      parser_raise_error (context_p, PARSER_ERR_NON_STRICT_ARG_DEFINITION);\n    }\n\n#if JERRY_LINE_INFO\n    parser_line_info_append (context_p, context_p->token.line, context_p->token.column);\n#endif /* JERRY_LINE_INFO */\n\n    parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n\n    if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n    {\n      context_p->last_cbc_opcode = CBC_RETURN_WITH_LITERAL;\n    }\n    else\n    {\n      parser_emit_cbc (context_p, CBC_RETURN);\n    }\n    parser_flush_cbc (context_p);\n\n    lexer_update_await_yield (context_p, saved_context.status_flags);\n  }\n\n  compiled_code_p = parser_post_processing (context_p);\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"\\n--- Arrow function parsing end ---\\n\\n\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  parser_restore_context (context_p, &saved_context);\n\n  if (next_token_needed)\n  {\n    lexer_next_token (context_p);\n  }\n\n  return compiled_code_p;\n} /* parser_parse_arrow_function */\n\n/**\n * Parse class fields\n *\n * @return compiled code\n */\necma_compiled_code_t *\nparser_parse_class_fields (parser_context_t *context_p) /**< context */\n{\n  parser_saved_context_t saved_context;\n  ecma_compiled_code_t *compiled_code_p;\n\n  uint32_t extra_status_flags = context_p->status_flags & PARSER_INSIDE_WITH;\n\n  parser_save_context (context_p, &saved_context);\n  context_p->status_flags |= (PARSER_IS_FUNCTION | PARSER_ALLOW_SUPER | PARSER_INSIDE_CLASS_FIELD\n                              | PARSER_ALLOW_NEW_TARGET | extra_status_flags);\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"\\n--- Class fields parsing start ---\\n\\n\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n#if JERRY_DEBUGGER\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    jerry_debugger_send_parse_function (context_p->token.line, context_p->token.column);\n  }\n#endif /* JERRY_DEBUGGER */\n\n  const uint8_t *source_end_p = context_p->source_end_p;\n  bool first_computed_class_field = true;\n  scanner_location_t end_location;\n  scanner_get_location (&end_location, context_p);\n\n  do\n  {\n    uint8_t class_field_type = context_p->stack_top_uint8;\n    parser_stack_pop_uint8 (context_p);\n\n    scanner_range_t range = { 0 };\n\n    if (class_field_type & PARSER_CLASS_FIELD_INITIALIZED)\n    {\n      parser_stack_pop (context_p, &range, sizeof (scanner_range_t));\n    }\n    else if (class_field_type & PARSER_CLASS_FIELD_NORMAL)\n    {\n      parser_stack_pop (context_p, &range.start_location, sizeof (scanner_location_t));\n    }\n\n    uint16_t literal_index = 0;\n    bool is_private = false;\n\n    if (class_field_type & PARSER_CLASS_FIELD_NORMAL)\n    {\n      scanner_set_location (context_p, &range.start_location);\n\n      if (class_field_type & PARSER_CLASS_FIELD_STATIC_BLOCK)\n      {\n        scanner_seek (context_p);\n        JERRY_ASSERT (context_p->source_p[1] == LIT_CHAR_LEFT_BRACE);\n        context_p->source_p += 2;\n        context_p->source_end_p = source_end_p;\n\n        uint16_t func_index = lexer_construct_class_static_block_function (context_p);\n\n        parser_emit_cbc_ext_literal (context_p, CBC_EXT_CLASS_CALL_STATIC_BLOCK, func_index);\n        continue;\n      }\n\n      uint32_t ident_opts = LEXER_OBJ_IDENT_ONLY_IDENTIFIERS;\n      is_private = context_p->source_p[-1] == LIT_CHAR_HASHMARK;\n\n      if (is_private)\n      {\n        ident_opts |= LEXER_OBJ_IDENT_CLASS_PRIVATE;\n      }\n\n      context_p->source_end_p = source_end_p;\n      scanner_seek (context_p);\n\n      lexer_expect_object_literal_id (context_p, ident_opts);\n\n      literal_index = context_p->lit_object.index;\n\n      if (class_field_type & PARSER_CLASS_FIELD_INITIALIZED)\n      {\n        lexer_next_token (context_p);\n        JERRY_ASSERT (context_p->token.type == LEXER_ASSIGN);\n      }\n    }\n    else if (first_computed_class_field)\n    {\n      parser_emit_cbc (context_p, CBC_PUSH_NUMBER_0);\n      first_computed_class_field = false;\n    }\n\n    if (class_field_type & PARSER_CLASS_FIELD_INITIALIZED)\n    {\n      if (!(class_field_type & PARSER_CLASS_FIELD_NORMAL))\n      {\n        scanner_set_location (context_p, &range.start_location);\n        scanner_seek (context_p);\n      }\n\n      context_p->source_end_p = range.source_end_p;\n      lexer_next_token (context_p);\n\n#if JERRY_LINE_INFO\n      parser_line_info_append (context_p, context_p->token.line, context_p->token.column);\n#endif /* JERRY_LINE_INFO */\n\n      parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);\n\n      if (context_p->token.type != LEXER_EOS)\n      {\n        parser_raise_error (context_p, PARSER_ERR_SEMICOLON_EXPECTED);\n      }\n    }\n    else\n    {\n      parser_emit_cbc (context_p, CBC_PUSH_UNDEFINED);\n    }\n\n    if (class_field_type & PARSER_CLASS_FIELD_NORMAL)\n    {\n      uint16_t function_literal_index = parser_check_anonymous_function_declaration (context_p);\n\n      if (function_literal_index == PARSER_ANONYMOUS_CLASS)\n      {\n        parser_emit_cbc_ext_literal (context_p, CBC_EXT_SET_CLASS_NAME, literal_index);\n      }\n      else if (function_literal_index < PARSER_NAMED_FUNCTION)\n      {\n        uint32_t function_name_status_flags = is_private ? PARSER_PRIVATE_FUNCTION_NAME : 0;\n        parser_set_function_name (context_p, function_literal_index, literal_index, function_name_status_flags);\n      }\n\n      if (is_private)\n      {\n        parser_emit_cbc_ext_literal (context_p, CBC_EXT_PRIVATE_FIELD_ADD, literal_index);\n      }\n      else\n      {\n        parser_emit_cbc_ext_literal (context_p, CBC_EXT_DEFINE_FIELD, literal_index);\n      }\n\n      /* Prepare stack slot for assignment property reference base. Needed by vm.c */\n      if (context_p->stack_limit == context_p->stack_depth)\n      {\n        context_p->stack_limit++;\n        JERRY_ASSERT (context_p->stack_limit <= PARSER_MAXIMUM_STACK_LIMIT);\n      }\n    }\n    else\n    {\n      uint16_t function_literal_index = parser_check_anonymous_function_declaration (context_p);\n      uint16_t opcode = CBC_EXT_SET_NEXT_COMPUTED_FIELD;\n\n      if (function_literal_index < PARSER_NAMED_FUNCTION || function_literal_index == PARSER_ANONYMOUS_CLASS)\n      {\n        opcode = CBC_EXT_SET_NEXT_COMPUTED_FIELD_ANONYMOUS_FUNC;\n      }\n\n      parser_flush_cbc (context_p);\n\n      /* The next opcode pushes two more temporary values onto the stack */\n      if (context_p->stack_depth + 1 > context_p->stack_limit)\n      {\n        context_p->stack_limit = (uint16_t) (context_p->stack_depth + 1);\n        if (context_p->stack_limit > PARSER_MAXIMUM_STACK_LIMIT)\n        {\n          parser_raise_error (context_p, PARSER_ERR_STACK_LIMIT_REACHED);\n        }\n      }\n\n      parser_emit_cbc_ext (context_p, opcode);\n    }\n  } while (!(context_p->stack_top_uint8 & PARSER_CLASS_FIELD_END));\n\n  if (!first_computed_class_field)\n  {\n    parser_emit_cbc (context_p, CBC_POP);\n  }\n\n  parser_flush_cbc (context_p);\n  context_p->source_end_p = source_end_p;\n  scanner_set_location (context_p, &end_location);\n\n#if JERRY_LINE_INFO\n  if (context_p->line_info_p == NULL)\n  {\n    parser_line_info_append (context_p, context_p->token.line, context_p->token.column);\n  }\n#endif /* JERRY_LINE_INFO */\n\n  compiled_code_p = parser_post_processing (context_p);\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"\\n--- Class fields parsing end ---\\n\\n\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  parser_restore_context (context_p, &saved_context);\n\n  return compiled_code_p;\n} /* parser_parse_class_fields */\n\n/**\n * Check whether the last emitted cbc opcode was an anonymous function declaration\n *\n * @return PARSER_NOT_FUNCTION_LITERAL - if the last opcode is not a function literal\n *         PARSER_NAMED_FUNCTION - if the last opcode is not a named function declataion\n *         PARSER_ANONYMOUS_CLASS - if the last opcode is an anonymous class declaration\n *         literal index of the anonymous function literal - otherwise\n */\nuint16_t\nparser_check_anonymous_function_declaration (parser_context_t *context_p) /**< context */\n{\n  if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_FINALIZE_ANONYMOUS_CLASS))\n  {\n    return PARSER_ANONYMOUS_CLASS;\n  }\n\n  if (context_p->last_cbc.literal_type != LEXER_FUNCTION_LITERAL)\n  {\n    return PARSER_NOT_FUNCTION_LITERAL;\n  }\n\n  uint16_t literal_index = PARSER_NOT_FUNCTION_LITERAL;\n\n  if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)\n  {\n    literal_index = context_p->last_cbc.literal_index;\n  }\n  else if (context_p->last_cbc_opcode == CBC_PUSH_TWO_LITERALS)\n  {\n    literal_index = context_p->last_cbc.value;\n  }\n  else if (context_p->last_cbc_opcode == CBC_PUSH_THREE_LITERALS)\n  {\n    literal_index = context_p->last_cbc.third_literal_index;\n  }\n  else\n  {\n    return PARSER_NOT_FUNCTION_LITERAL;\n  }\n\n  const ecma_compiled_code_t *bytecode_p;\n  bytecode_p = (const ecma_compiled_code_t *) (PARSER_GET_LITERAL (literal_index)->u.bytecode_p);\n  bool is_anon =\n    ecma_is_value_magic_string (*ecma_compiled_code_resolve_function_name (bytecode_p), LIT_MAGIC_STRING__EMPTY);\n\n  return (is_anon ? literal_index : PARSER_NAMED_FUNCTION);\n} /* parser_check_anonymous_function_declaration */\n\n/**\n * Set the function name of the function literal corresponds to the given function literal index\n * to the given character buffer of literal corresponds to the given name index.\n */\nvoid\nparser_set_function_name (parser_context_t *context_p, /**< context */\n                          uint16_t function_literal_index, /**< function literal index */\n                          uint16_t name_index, /**< function name literal index */\n                          uint32_t status_flags) /**< status flags */\n{\n  ecma_compiled_code_t *bytecode_p;\n  bytecode_p = (ecma_compiled_code_t *) (PARSER_GET_LITERAL (function_literal_index)->u.bytecode_p);\n\n  parser_compiled_code_set_function_name (context_p, bytecode_p, name_index, status_flags);\n} /* parser_set_function_name */\n\n/**\n * Prepend the given prefix into the current function name literal\n *\n * @return pointer to the newly allocated buffer\n */\nstatic uint8_t *\nparser_add_function_name_prefix (parser_context_t *context_p, /**< context */\n                                 const char *prefix_p, /**< prefix */\n                                 uint32_t prefix_size, /**< prefix's length */\n                                 uint32_t *name_length_p, /**< [out] function name's size */\n                                 lexer_literal_t *name_lit_p) /**< function name literal */\n{\n  *name_length_p += prefix_size;\n  uint8_t *name_buffer_p = (uint8_t *) parser_malloc (context_p, *name_length_p * sizeof (uint8_t));\n  memcpy (name_buffer_p, prefix_p, prefix_size);\n  memcpy (name_buffer_p + prefix_size, name_lit_p->u.char_p, name_lit_p->prop.length);\n\n  return name_buffer_p;\n} /* parser_add_function_name_prefix */\n\n/**\n * Set the function name of the given compiled code\n * to the given character buffer of literal corresponds to the given name index.\n */\nvoid\nparser_compiled_code_set_function_name (parser_context_t *context_p, /**< context */\n                                        ecma_compiled_code_t *bytecode_p, /**< function literal index */\n                                        uint16_t name_index, /**< function name literal index */\n                                        uint32_t status_flags) /**< status flags */\n{\n  ecma_value_t *func_name_start_p;\n  func_name_start_p = ecma_compiled_code_resolve_function_name ((const ecma_compiled_code_t *) bytecode_p);\n\n  if (JERRY_UNLIKELY (!ecma_is_value_magic_string (*func_name_start_p, LIT_MAGIC_STRING__EMPTY)))\n  {\n    return;\n  }\n\n  parser_scope_stack_t *scope_stack_start_p = context_p->scope_stack_p;\n  parser_scope_stack_t *scope_stack_p = scope_stack_start_p + context_p->scope_stack_top;\n\n  while (scope_stack_p > scope_stack_start_p)\n  {\n    scope_stack_p--;\n\n    if (scope_stack_p->map_from != PARSER_SCOPE_STACK_FUNC && scanner_decode_map_to (scope_stack_p) == name_index)\n    {\n      name_index = scope_stack_p->map_from;\n      break;\n    }\n  }\n\n  lexer_literal_t *name_lit_p = (lexer_literal_t *) PARSER_GET_LITERAL (name_index);\n\n  if (name_lit_p->type != LEXER_IDENT_LITERAL && name_lit_p->type != LEXER_STRING_LITERAL)\n  {\n    return;\n  }\n\n  uint8_t *name_buffer_p = (uint8_t *) name_lit_p->u.char_p;\n  uint32_t name_length = name_lit_p->prop.length;\n\n  if (status_flags & PARSER_PRIVATE_FUNCTION_NAME)\n  {\n    name_buffer_p = parser_add_function_name_prefix (context_p, \"#\", 1, &name_length, name_lit_p);\n  }\n  else if (status_flags & (PARSER_IS_PROPERTY_GETTER | PARSER_IS_PROPERTY_SETTER))\n  {\n    name_buffer_p = parser_add_function_name_prefix (context_p,\n                                                     (status_flags & PARSER_IS_PROPERTY_GETTER) ? \"get \" : \"set \",\n                                                     4,\n                                                     &name_length,\n                                                     name_lit_p);\n  }\n\n  *func_name_start_p =\n    ecma_find_or_create_literal_string (name_buffer_p, name_length, (status_flags & LEXER_FLAG_ASCII) != 0);\n\n  if (name_buffer_p != name_lit_p->u.char_p)\n  {\n    parser_free (name_buffer_p, name_length);\n  }\n} /* parser_compiled_code_set_function_name */\n\n/**\n * Raise a parse error.\n */\nvoid\nparser_raise_error (parser_context_t *context_p, /**< context */\n                    parser_error_msg_t error) /**< error code */\n{\n  /* Must be compatible with the scanner because\n   * the lexer might throws errors during prescanning. */\n  parser_saved_context_t *saved_context_p = context_p->last_context_p;\n\n  while (saved_context_p != NULL)\n  {\n    parser_cbc_stream_free (&saved_context_p->byte_code);\n\n    /* First the current literal pool is freed, and then it is replaced\n     * by the literal pool coming from the saved context. Since literals\n     * are not used anymore, this is a valid replacement. The last pool\n     * is freed by parser_parse_source. */\n\n    parser_free_literals (&context_p->literal_pool);\n    context_p->literal_pool.data = saved_context_p->literal_pool_data;\n\n    if (context_p->scope_stack_p != NULL)\n    {\n      parser_free (context_p->scope_stack_p, context_p->scope_stack_size * sizeof (parser_scope_stack_t));\n    }\n    context_p->scope_stack_p = saved_context_p->scope_stack_p;\n    context_p->scope_stack_size = saved_context_p->scope_stack_size;\n\n    if (saved_context_p->last_statement.current_p != NULL)\n    {\n      parser_free_jumps (saved_context_p->last_statement);\n    }\n\n    if (saved_context_p->tagged_template_literal_cp != JMEM_CP_NULL)\n    {\n      ecma_collection_t *collection =\n        ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, saved_context_p->tagged_template_literal_cp);\n      ecma_collection_free_template_literal (collection);\n    }\n\n#if JERRY_LINE_INFO\n    parser_line_info_free (saved_context_p->line_info_p);\n#endif /* JERRY_LINE_INFO */\n\n    saved_context_p = saved_context_p->prev_context_p;\n  }\n\n  parser_free_private_fields (context_p);\n\n  if (context_p->tagged_template_literal_cp != JMEM_CP_NULL)\n  {\n    ecma_collection_t *collection =\n      ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, context_p->tagged_template_literal_cp);\n    ecma_collection_free_template_literal (collection);\n  }\n\n  context_p->error = error;\n  PARSER_THROW (context_p->try_buffer);\n  /* Should never been reached. */\n  JERRY_ASSERT (0);\n} /* parser_raise_error */\n\n#endif /* JERRY_PARSER */\n\n/**\n * Parse EcmaScript source code\n *\n * Note:\n *      if arg_list_p is not NULL, a function body is parsed\n *      returned value must be freed with ecma_free_value\n *\n * @return pointer to compiled byte code - if success\n *         NULL - otherwise\n */\necma_compiled_code_t *\nparser_parse_script (void *source_p, /**< source code */\n                     uint32_t parse_opts, /**< ecma_parse_opts_t option bits */\n                     const jerry_parse_options_t *options_p) /**< additional configuration options */\n{\n#if JERRY_PARSER\n  ecma_compiled_code_t *bytecode_p = parser_parse_source (source_p, parse_opts, options_p);\n\n  if (JERRY_UNLIKELY (bytecode_p == NULL))\n  {\n    /* Exception has already thrown. */\n    return NULL;\n  }\n\n#if JERRY_DEBUGGER\n  if ((JERRY_CONTEXT (debugger_flags) & (JERRY_DEBUGGER_CONNECTED | JERRY_DEBUGGER_PARSER_WAIT))\n      == (JERRY_DEBUGGER_CONNECTED | JERRY_DEBUGGER_PARSER_WAIT))\n  {\n    JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_PARSER_WAIT_MODE);\n    jerry_debugger_send_type (JERRY_DEBUGGER_WAITING_AFTER_PARSE);\n\n    while (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_PARSER_WAIT_MODE)\n    {\n      jerry_debugger_receive (NULL);\n\n      if (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED))\n      {\n        break;\n      }\n\n      jerry_debugger_transport_sleep ();\n    }\n  }\n#endif /* JERRY_DEBUGGER */\n\n  return bytecode_p;\n#else /* !JERRY_PARSER */\n  JERRY_UNUSED (arg_list_p);\n  JERRY_UNUSED (arg_list_size);\n  JERRY_UNUSED (source_p);\n  JERRY_UNUSED (source_size);\n  JERRY_UNUSED (parse_opts);\n  JERRY_UNUSED (source_name);\n\n  ecma_raise_syntax_error (ECMA_ERR_PARSER_NOT_SUPPORTED);\n  return NULL;\n#endif /* JERRY_PARSER */\n} /* parser_parse_script */\n\n/**\n * @}\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/parser/js/js-parser.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JS_PARSER_H\n#define JS_PARSER_H\n\n#include \"ecma-globals.h\"\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_parser Parser\n * @{\n */\n\n/* Note: source must be a valid UTF-8 string */\necma_compiled_code_t *parser_parse_script (void *source_p, uint32_t parse_opts, const jerry_parse_options_t *options_p);\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* !JS_PARSER_H */\n"
  },
  {
    "path": "jerry-core/parser/js/js-scanner-internal.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JS_SCANNER_INTERNAL_H\n#define JS_SCANNER_INTERNAL_H\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_scanner Scanner\n * @{\n */\n\n/**\n * Scan mode types.\n */\ntypedef enum\n{\n  SCAN_MODE_PRIMARY_EXPRESSION, /**< scanning primary expression */\n  SCAN_MODE_PRIMARY_EXPRESSION_AFTER_NEW, /**< scanning primary expression after new */\n  SCAN_MODE_POST_PRIMARY_EXPRESSION, /**< scanning post primary expression */\n  SCAN_MODE_PRIMARY_EXPRESSION_END, /**< scanning primary expression end */\n  SCAN_MODE_STATEMENT, /**< scanning statement */\n  SCAN_MODE_STATEMENT_OR_TERMINATOR, /**< scanning statement or statement end */\n  SCAN_MODE_STATEMENT_END, /**< scanning statement end */\n  SCAN_MODE_VAR_STATEMENT, /**< scanning var statement */\n  SCAN_MODE_PROPERTY_NAME, /**< scanning property name */\n  SCAN_MODE_FUNCTION_ARGUMENTS, /**< scanning function arguments */\n  SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS, /**< continue scanning function arguments */\n  SCAN_MODE_BINDING, /**< array or object binding */\n  SCAN_MODE_CLASS_DECLARATION, /**< scanning class declaration */\n  SCAN_MODE_CLASS_BODY, /**< scanning class body */\n  SCAN_MODE_CLASS_BODY_NO_SCAN, /**< scanning class body without calling lexer_scan_identifier */\n} scan_modes_t;\n\n/**\n * Scan stack mode types.\n */\ntypedef enum\n{\n  SCAN_STACK_SCRIPT, /**< script */\n  SCAN_STACK_SCRIPT_FUNCTION, /**< script is a function body */\n  SCAN_STACK_BLOCK_STATEMENT, /**< block statement group */\n  SCAN_STACK_FUNCTION_STATEMENT, /**< function statement */\n  SCAN_STACK_FUNCTION_EXPRESSION, /**< function expression */\n  SCAN_STACK_FUNCTION_PROPERTY, /**< function expression in an object literal */\n  SCAN_STACK_FUNCTION_ARROW, /**< arrow function expression */\n  SCAN_STACK_SWITCH_BLOCK, /**< block part of \"switch\" statement */\n  SCAN_STACK_IF_STATEMENT, /**< statement part of \"if\" statements */\n  SCAN_STACK_WITH_STATEMENT, /**< statement part of \"with\" statements */\n  SCAN_STACK_WITH_EXPRESSION, /**< expression part of \"with\" statements */\n  SCAN_STACK_DO_STATEMENT, /**< statement part of \"do\" statements */\n  SCAN_STACK_DO_EXPRESSION, /**< expression part of \"do\" statements */\n  SCAN_STACK_WHILE_EXPRESSION, /**< expression part of \"while\" iterator */\n  SCAN_STACK_PAREN_EXPRESSION, /**< expression in brackets */\n  SCAN_STACK_STATEMENT_WITH_EXPR, /**< statement which starts with expression enclosed in brackets */\n  SCAN_STACK_BINDING_INIT, /**< post processing after a single initializer */\n  SCAN_STACK_BINDING_LIST_INIT, /**< post processing after an initializer list */\n  SCAN_STACK_LET, /**< let statement */\n  SCAN_STACK_CONST, /**< const statement */\n  /* The SCANNER_IS_FOR_START macro needs to be updated when the following constants are reordered. */\n  SCAN_STACK_VAR, /**< var statement */\n  SCAN_STACK_FOR_VAR_START, /**< start of \"for\" iterator with var statement */\n  SCAN_STACK_FOR_LET_START, /**< start of \"for\" iterator with let statement */\n  SCAN_STACK_FOR_CONST_START, /**< start of \"for\" iterator with const statement */\n  SCAN_STACK_FOR_START, /**< start of \"for\" iterator */\n  SCAN_STACK_FOR_CONDITION, /**< condition part of \"for\" iterator */\n  SCAN_STACK_FOR_EXPRESSION, /**< expression part of \"for\" iterator */\n  SCAN_STACK_SWITCH_EXPRESSION, /**< expression part of \"switch\" statement */\n  SCAN_STACK_CASE_STATEMENT, /**< case statement inside a switch statement */\n  SCAN_STACK_COLON_EXPRESSION, /**< expression between a question mark and colon */\n  SCAN_STACK_TRY_STATEMENT, /**< try statement */\n  SCAN_STACK_CATCH_STATEMENT, /**< catch statement */\n  SCAN_STACK_ARRAY_LITERAL, /**< array literal or destructuring assignment or binding */\n  SCAN_STACK_OBJECT_LITERAL, /**< object literal group */\n  SCAN_STACK_PROPERTY_ACCESSOR, /**< property accessor in square brackets */\n  /* These four must be in this order. */\n  SCAN_STACK_COMPUTED_PROPERTY, /**< computed property name */\n  SCAN_STACK_COMPUTED_GENERATOR, /**< computed generator function */\n  SCAN_STACK_COMPUTED_ASYNC, /**< computed async function */\n  SCAN_STACK_COMPUTED_ASYNC_GENERATOR, /**< computed async function */\n  SCAN_STACK_TEMPLATE_STRING, /**< template string */\n  SCAN_STACK_TAGGED_TEMPLATE_LITERAL, /**< tagged template literal */\n  SCAN_STACK_PRIVATE_BLOCK_EARLY, /**< private block for single statements (force early declarations) */\n  SCAN_STACK_PRIVATE_BLOCK, /**< private block for single statements */\n  SCAN_STACK_ARROW_ARGUMENTS, /**< might be arguments of an arrow function */\n  SCAN_STACK_ARROW_EXPRESSION, /**< expression body of an arrow function */\n  SCAN_STACK_EXPLICIT_CLASS_CONSTRUCTOR, /**< explicit class constructor */\n  SCAN_STACK_IMPLICIT_CLASS_CONSTRUCTOR, /**< implicit class constructor */\n  SCAN_STACK_CLASS_STATEMENT, /**< class statement */\n  SCAN_STACK_CLASS_EXPRESSION, /**< class expression */\n  SCAN_STACK_CLASS_EXTENDS, /**< class extends expression */\n  SCAN_STACK_CLASS_FIELD_INITIALIZER, /**< class field initializer */\n  SCAN_STACK_FUNCTION_PARAMETERS, /**< function parameter initializer */\n  SCAN_STACK_FOR_START_PATTERN, /**< possible assignment pattern for \"for\" iterator */\n  SCAN_STACK_USE_ASYNC, /**< an \"async\" identifier is used */\n  SCAN_STACK_CLASS_STATIC_BLOCK, /**< class static block */\n#if JERRY_MODULE_SYSTEM\n  SCAN_STACK_EXPORT_DEFAULT, /**< scan primary expression after export default */\n#endif /* JERRY_MODULE_SYSTEM */\n} scan_stack_modes_t;\n\n/**\n * Scanner context flag types.\n */\ntypedef enum\n{\n  SCANNER_CONTEXT_NO_FLAGS = 0, /**< no flags are set */\n  SCANNER_CONTEXT_THROW_ERR_ASYNC_FUNCTION = (1 << 0), /**< throw async function error */\n#if JERRY_DEBUGGER\n  SCANNER_CONTEXT_DEBUGGER_ENABLED = (1 << 1), /**< debugger is enabled */\n#endif /* JERRY_DEBUGGER */\n  SCANNER_CONTEXT_RESTORE_INSIDE_CLASS_FIELD_FLAG =\n    (1 << 2), /**< restore the PARSER_INSIDE_CLASS_FIELD flag of the main context */\n} scanner_context_flags_t;\n\n/**\n * Checks whether the stack top is a for statement start.\n */\n#define SCANNER_IS_FOR_START(stack_top) ((stack_top) >= SCAN_STACK_FOR_VAR_START && (stack_top) <= SCAN_STACK_FOR_START)\n\n/**\n * Generic descriptor which stores only the start position.\n */\ntypedef struct\n{\n  const uint8_t *source_p; /**< start source byte */\n} scanner_source_start_t;\n\n/**\n * Descriptor for storing a binding literal on stack.\n */\ntypedef struct\n{\n  lexer_lit_location_t *literal_p; /**< binding literal */\n} scanner_binding_literal_t;\n\n/**\n * Flags for type member of lexer_lit_location_t structure in the literal pool.\n */\ntypedef enum\n{\n  SCANNER_LITERAL_IS_ARG = (1 << 0), /**< literal is argument */\n  SCANNER_LITERAL_IS_VAR = (1 << 1), /**< literal is var */\n  /** literal is a destructured argument binding of a possible arrow function */\n  SCANNER_LITERAL_IS_ARROW_DESTRUCTURED_ARG = SCANNER_LITERAL_IS_VAR,\n  SCANNER_LITERAL_IS_FUNC = (1 << 2), /**< literal is function */\n  SCANNER_LITERAL_NO_REG = (1 << 3), /**< literal cannot be stored in a register */\n  SCANNER_LITERAL_IS_LET = (1 << 4), /**< literal is let */\n  /** literal is a function declared in this block (prevents declaring let/const with the same name) */\n  SCANNER_LITERAL_IS_FUNC_DECLARATION = SCANNER_LITERAL_IS_LET,\n  SCANNER_LITERAL_IS_CONST = (1 << 5), /**< literal is const */\n  /** literal is a destructured argument binding */\n  SCANNER_LITERAL_IS_DESTRUCTURED_ARG = SCANNER_LITERAL_IS_CONST,\n  SCANNER_LITERAL_IS_USED = (1 << 6), /**< literal is used */\n  SCANNER_LITERAL_EARLY_CREATE = (1 << 7), /**< binding should be created early with ECMA_VALUE_UNINITIALIZED */\n} scanner_literal_type_flags_t;\n\n/*\n * Known combinations:\n *\n *  SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_FUNC_DECLARATION :\n *         function declared in this block\n *  SCANNER_LITERAL_IS_LOCAL :\n *         module import on global scope, catch block variable otherwise\n *  SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_FUNC :\n *         a function argument which is reassigned to a function later\n *  SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_DESTRUCTURED_ARG :\n *         destructured binding argument\n *  SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_DESTRUCTURED_ARG | SCANNER_LITERAL_IS_FUNC :\n *         destructured binding argument which is reassigned to a function later\n */\n\n/**\n * Literal is a local declration (let, const, catch variable, etc.)\n */\n#define SCANNER_LITERAL_IS_LOCAL (SCANNER_LITERAL_IS_LET | SCANNER_LITERAL_IS_CONST)\n\n/**\n * Literal is a local function declaration\n */\n#define SCANNER_LITERAL_IS_LOCAL_FUNC (SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_FUNC_DECLARATION)\n\n/**\n * For statement descriptor.\n */\ntypedef struct\n{\n  /** shared fields of for statements */\n  union\n  {\n    const uint8_t *source_p; /**< start source byte */\n    scanner_for_info_t *for_info_p; /**< for info */\n  } u;\n} scanner_for_statement_t;\n\n/**\n * Switch statement descriptor.\n */\ntypedef struct\n{\n  scanner_case_info_t **last_case_p; /**< last case info */\n} scanner_switch_statement_t;\n\n/**\n * Types of scanner destructuring bindings.\n */\ntypedef enum\n{\n  /* Update SCANNER_NEEDS_BINDING_LIST after changing these values. */\n  SCANNER_BINDING_NONE, /**< not a destructuring binding expression */\n  SCANNER_BINDING_VAR, /**< destructuring var binding */\n  SCANNER_BINDING_LET, /**< destructuring let binding */\n  SCANNER_BINDING_CATCH, /**< destructuring catch binding */\n  SCANNER_BINDING_CONST, /**< destructuring const binding */\n  SCANNER_BINDING_ARG, /**< destructuring arg binding */\n  SCANNER_BINDING_ARROW_ARG, /**< possible destructuring arg binding of an arrow function */\n} scanner_binding_type_t;\n\n/**\n * Check whether a binding list is needed for the binding pattern.\n */\n#define SCANNER_NEEDS_BINDING_LIST(type) ((type) >= SCANNER_BINDING_LET)\n\n/**\n * Scanner binding items for destructuring binding patterns.\n */\ntypedef struct scanner_binding_item_t\n{\n  struct scanner_binding_item_t *next_p; /**< next binding in the list */\n  lexer_lit_location_t *literal_p; /**< binding literal */\n} scanner_binding_item_t;\n\n/**\n * Scanner binding lists for destructuring binding patterns.\n */\ntypedef struct scanner_binding_list_t\n{\n  struct scanner_binding_list_t *prev_p; /**< prev list */\n  scanner_binding_item_t *items_p; /**< list of bindings */\n  bool is_nested; /**< is nested binding declaration */\n} scanner_binding_list_t;\n\n/**\n * Flags for scanner_literal_pool_t structure.\n */\ntypedef enum\n{\n  SCANNER_LITERAL_POOL_FUNCTION = (1 << 0), /**< literal pool represents a function */\n  SCANNER_LITERAL_POOL_CLASS_NAME = (1 << 1), /**< literal pool which contains a class name */\n  SCANNER_LITERAL_POOL_CLASS_FIELD = (1 << 2), /**< literal pool is created for a class field initializer */\n  SCANNER_LITERAL_POOL_IS_STRICT = (1 << 3), /**< literal pool represents a strict mode code block */\n  SCANNER_LITERAL_POOL_CAN_EVAL = (1 << 4), /**< prepare for executing eval in this block */\n  SCANNER_LITERAL_POOL_NO_ARGUMENTS = (1 << 5), /**< arguments object must not be constructed,\n                                                 *   or arguments cannot be stored in registers if\n                                                 *   SCANNER_LITERAL_POOL_ARGUMENTS_IN_ARGS is set */\n  SCANNER_LITERAL_POOL_ARGUMENTS_IN_ARGS = (1 << 6), /**< arguments is referenced in function args */\n  SCANNER_LITERAL_POOL_HAS_COMPLEX_ARGUMENT = (1 << 7), /**< function has complex (ES2015+) argument definition */\n  SCANNER_LITERAL_POOL_IN_WITH = (1 << 8), /**< literal pool is in a with statement */\n  SCANNER_LITERAL_POOL_ARROW = (1 << 9), /**< arrow function */\n  SCANNER_LITERAL_POOL_GENERATOR = (1 << 10), /**< generator function */\n  SCANNER_LITERAL_POOL_ASYNC = (1 << 11), /**< async function */\n  SCANNER_LITERAL_POOL_FUNCTION_STATEMENT = (1 << 12), /**< function statement */\n  SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE = (1 << 13), /**< function body contains super reference */\n#if JERRY_MODULE_SYSTEM\n  SCANNER_LITERAL_POOL_IN_EXPORT = (1 << 14), /**< the declared variables are exported by the module system */\n#endif /* JERRY_MODULE_SYSTEM */\n} scanner_literal_pool_flags_t;\n\n/**\n * Define a function where no arguments are allowed.\n */\n#define SCANNER_LITERAL_POOL_ARROW_FLAGS \\\n  (SCANNER_LITERAL_POOL_FUNCTION | SCANNER_LITERAL_POOL_NO_ARGUMENTS | SCANNER_LITERAL_POOL_ARROW)\n\n/**\n * This flag represents that the bracketed expression might be an async arrow function.\n * The SCANNER_LITERAL_POOL_ARROW flag is reused for this purpose.\n */\n#define SCANNER_LITERAL_POOL_MAY_ASYNC_ARROW SCANNER_LITERAL_POOL_ARROW\n\n/**\n * Getting the generator and async properties of literal pool status flags.\n */\n#define SCANNER_FROM_LITERAL_POOL_TO_COMPUTED(status_flags) \\\n  ((uint8_t) ((((status_flags) >> 10) & 0x3) + SCAN_STACK_COMPUTED_PROPERTY))\n\n/**\n * Setting the generator and async properties of literal pool status flags.\n */\n#define SCANNER_FROM_COMPUTED_TO_LITERAL_POOL(mode) (((mode) -SCAN_STACK_COMPUTED_PROPERTY) << 10)\n\n/**\n * Literal pool which may contains function argument identifiers\n */\n#define SCANNER_LITERAL_POOL_MAY_HAVE_ARGUMENTS(status_flags) \\\n  (!((status_flags) & (SCANNER_LITERAL_POOL_CLASS_NAME | SCANNER_LITERAL_POOL_CLASS_FIELD)))\n\n/**\n * Local literal pool.\n */\ntypedef struct scanner_literal_pool_t\n{\n  struct scanner_literal_pool_t *prev_p; /**< previous literal pool */\n  const uint8_t *source_p; /**< source position where the final data needs to be inserted */\n  parser_list_t literal_pool; /**< list of literal */\n  uint16_t status_flags; /**< combination of scanner_literal_pool_flags_t flags */\n  uint16_t no_declarations; /**< size of scope stack required during parsing */\n} scanner_literal_pool_t;\n\n/**\n * Scanner context.\n */\nstruct scanner_context_t\n{\n  uint32_t context_status_flags; /**< original status flags of the context */\n  uint8_t mode; /**< scanner mode */\n  uint8_t binding_type; /**< current destructuring binding type */\n  uint16_t status_flags; /**< scanner status flags */\n  scanner_binding_list_t *active_binding_list_p; /**< currently active binding list */\n  scanner_literal_pool_t *active_literal_pool_p; /**< currently active literal pool */\n  scanner_switch_statement_t active_switch_statement; /**< currently active switch statement */\n  scanner_info_t *end_arguments_p; /**< position of end arguments */\n  const uint8_t *async_source_p; /**< source position for async functions */\n};\n\n/* Scanner utils. */\n\nvoid scanner_raise_error (parser_context_t *context_p);\nvoid scanner_raise_redeclaration_error (parser_context_t *context_p);\n\nvoid *scanner_malloc (parser_context_t *context_p, size_t size);\nvoid scanner_free (void *ptr, size_t size);\n\nsize_t scanner_get_stream_size (scanner_info_t *info_p, size_t size);\nscanner_info_t *scanner_insert_info (parser_context_t *context_p, const uint8_t *source_p, size_t size);\nscanner_info_t *scanner_insert_info_before (parser_context_t *context_p,\n                                            const uint8_t *source_p,\n                                            scanner_info_t *start_info_p,\n                                            size_t size);\nscanner_literal_pool_t *\nscanner_push_literal_pool (parser_context_t *context_p, scanner_context_t *scanner_context_p, uint16_t status_flags);\nvoid scanner_pop_literal_pool (parser_context_t *context_p, scanner_context_t *scanner_context_p);\nvoid scanner_filter_arguments (parser_context_t *context_p, scanner_context_t *scanner_context_p);\nlexer_lit_location_t *scanner_add_custom_literal (parser_context_t *context_p,\n                                                  scanner_literal_pool_t *literal_pool_p,\n                                                  const lexer_lit_location_t *literal_location_p);\nlexer_lit_location_t *scanner_add_literal (parser_context_t *context_p, scanner_context_t *scanner_context_p);\nvoid scanner_add_reference (parser_context_t *context_p, scanner_context_t *scanner_context_p);\nlexer_lit_location_t *scanner_append_argument (parser_context_t *context_p, scanner_context_t *scanner_context_p);\nvoid scanner_add_private_identifier (parser_context_t *context_p, scanner_private_field_flags_t opts);\nvoid scanner_detect_invalid_var (parser_context_t *context_p,\n                                 scanner_context_t *scanner_context_p,\n                                 lexer_lit_location_t *var_literal_p);\nvoid scanner_detect_invalid_let (parser_context_t *context_p, lexer_lit_location_t *let_literal_p);\nvoid scanner_detect_eval_call (parser_context_t *context_p, scanner_context_t *scanner_context_p);\n\nlexer_lit_location_t *\nscanner_push_class_declaration (parser_context_t *context_p, scanner_context_t *scanner_context_p, uint8_t stack_mode);\nvoid scanner_push_class_field_initializer (parser_context_t *context_p, scanner_context_t *scanner_context_p);\nvoid scanner_push_destructuring_pattern (parser_context_t *context_p,\n                                         scanner_context_t *scanner_context_p,\n                                         uint8_t binding_type,\n                                         bool is_nested);\nvoid scanner_pop_binding_list (scanner_context_t *scanner_context_p);\nvoid scanner_append_hole (parser_context_t *context_p, scanner_context_t *scanner_context_p);\n\n/* Scanner operations. */\n\nvoid scanner_add_async_literal (parser_context_t *context_p, scanner_context_t *scanner_context_p);\nvoid scanner_check_arrow (parser_context_t *context_p, scanner_context_t *scanner_context_p);\nvoid\nscanner_scan_simple_arrow (parser_context_t *context_p, scanner_context_t *scanner_context_p, const uint8_t *source_p);\nvoid scanner_check_arrow_arg (parser_context_t *context_p, scanner_context_t *scanner_context_p);\nbool scanner_check_async_function (parser_context_t *context_p, scanner_context_t *scanner_context_p);\nvoid scanner_check_function_after_if (parser_context_t *context_p, scanner_context_t *scanner_context_p);\n#if JERRY_MODULE_SYSTEM\nvoid scanner_check_import_meta (parser_context_t *context_p);\n#endif /* JERRY_MODULE_SYSTEM */\nvoid scanner_scan_bracket (parser_context_t *context_p, scanner_context_t *scanner_context_p);\nvoid scanner_check_directives (parser_context_t *context_p, scanner_context_t *scanner_context_p);\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* !JS_SCANNER_INTERNAL_H */\n"
  },
  {
    "path": "jerry-core/parser/js/js-scanner-ops.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"js-parser-internal.h\"\n#include \"js-scanner-internal.h\"\n#include \"lit-char-helpers.h\"\n\n#if JERRY_PARSER\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_scanner Scanner\n * @{\n */\n\n/**\n * Add the \"async\" literal to the literal pool.\n */\nvoid\nscanner_add_async_literal (parser_context_t *context_p, /**< context */\n                           scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  lexer_lit_location_t async_literal;\n\n  JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_USE_ASYNC);\n\n  parser_stack_pop_uint8 (context_p);\n  parser_stack_pop (context_p, &async_literal, sizeof (lexer_lit_location_t));\n\n  lexer_lit_location_t *lit_location_p =\n    scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p, &async_literal);\n\n  lit_location_p->type |= SCANNER_LITERAL_IS_USED;\n\n  if (scanner_context_p->active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_WITH)\n  {\n    lit_location_p->type |= SCANNER_LITERAL_NO_REG;\n  }\n} /* scanner_add_async_literal */\n\n/**\n * Init scanning the body of an arrow function.\n */\nstatic void\nscanner_check_arrow_body (parser_context_t *context_p, /**< context */\n                          scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  lexer_next_token (context_p);\n\n  scanner_context_p->active_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_ARROW;\n\n  if (context_p->token.type != LEXER_LEFT_BRACE)\n  {\n    scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n    parser_stack_push_uint8 (context_p, SCAN_STACK_ARROW_EXPRESSION);\n    return;\n  }\n\n  lexer_next_token (context_p);\n  parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_ARROW);\n  scanner_check_directives (context_p, scanner_context_p);\n} /* scanner_check_arrow_body */\n\n/**\n * Process arrow function with argument list.\n */\nvoid\nscanner_check_arrow (parser_context_t *context_p, /**< context */\n                     scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  parser_stack_pop_uint8 (context_p);\n\n  lexer_next_token (context_p);\n\n  if (context_p->token.type != LEXER_ARROW || (context_p->token.flags & LEXER_WAS_NEWLINE))\n  {\n    if (context_p->stack_top_uint8 == SCAN_STACK_USE_ASYNC)\n    {\n      scanner_add_async_literal (context_p, scanner_context_p);\n    }\n\n    scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n    scanner_pop_literal_pool (context_p, scanner_context_p);\n    return;\n  }\n\n  if (context_p->stack_top_uint8 == SCAN_STACK_USE_ASYNC)\n  {\n    parser_stack_pop (context_p, NULL, sizeof (lexer_lit_location_t) + 1);\n  }\n\n  scanner_literal_pool_t *literal_pool_p = scanner_context_p->active_literal_pool_p;\n  uint16_t status_flags = literal_pool_p->status_flags;\n\n  bool is_async_arrow = (status_flags & SCANNER_LITERAL_POOL_MAY_ASYNC_ARROW) != 0;\n\n  status_flags |= SCANNER_LITERAL_POOL_ARROW_FLAGS;\n  status_flags &=\n    (uint16_t) ~(SCANNER_LITERAL_POOL_IN_WITH | SCANNER_LITERAL_POOL_GENERATOR | SCANNER_LITERAL_POOL_ASYNC);\n\n  context_p->status_flags &= (uint32_t) ~(PARSER_IS_GENERATOR_FUNCTION | PARSER_IS_ASYNC_FUNCTION);\n\n  if (is_async_arrow)\n  {\n    status_flags |= SCANNER_LITERAL_POOL_ASYNC;\n    context_p->status_flags |= PARSER_IS_ASYNC_FUNCTION;\n  }\n\n  literal_pool_p->status_flags = status_flags;\n\n  scanner_filter_arguments (context_p, scanner_context_p);\n  scanner_check_arrow_body (context_p, scanner_context_p);\n} /* scanner_check_arrow */\n\n/**\n * Process arrow function with a single argument.\n */\nvoid\nscanner_scan_simple_arrow (parser_context_t *context_p, /**< context */\n                           scanner_context_t *scanner_context_p, /**< scanner context */\n                           const uint8_t *source_p) /**< identifier end position */\n{\n  uint16_t status_flags = SCANNER_LITERAL_POOL_ARROW_FLAGS;\n\n  context_p->status_flags &= (uint32_t) ~(PARSER_IS_GENERATOR_FUNCTION | PARSER_IS_ASYNC_FUNCTION);\n\n  if (scanner_context_p->async_source_p != NULL)\n  {\n    JERRY_ASSERT (scanner_context_p->async_source_p == source_p);\n\n    status_flags |= SCANNER_LITERAL_POOL_ASYNC;\n    context_p->status_flags |= PARSER_IS_ASYNC_FUNCTION;\n  }\n\n  scanner_literal_pool_t *literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, status_flags);\n  literal_pool_p->source_p = source_p;\n\n  lexer_lit_location_t *location_p = scanner_add_literal (context_p, scanner_context_p);\n  location_p->type |= SCANNER_LITERAL_IS_ARG;\n\n  /* Skip the => token, which size is two. */\n  context_p->source_p += 2;\n  PARSER_PLUS_EQUAL_LC (context_p->column, 2);\n  context_p->token.flags = (uint8_t) (context_p->token.flags & ~LEXER_NO_SKIP_SPACES);\n\n  scanner_check_arrow_body (context_p, scanner_context_p);\n} /* scanner_scan_simple_arrow */\n\n/**\n * Process the next argument of a might-be arrow function.\n */\nvoid\nscanner_check_arrow_arg (parser_context_t *context_p, /**< context */\n                         scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_ARROW_ARGUMENTS);\n\n  const uint8_t *source_p = context_p->source_p;\n  bool process_arrow = false;\n\n  scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n  if (context_p->token.type == LEXER_THREE_DOTS)\n  {\n    lexer_next_token (context_p);\n  }\n\n  switch (context_p->token.type)\n  {\n    case LEXER_RIGHT_PAREN:\n    {\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n      return;\n    }\n    case LEXER_LITERAL:\n    {\n      if (context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n      {\n        break;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n\n      if (lexer_check_arrow (context_p))\n      {\n        process_arrow = true;\n        break;\n      }\n\n      lexer_lit_location_t *argument_literal_p = scanner_append_argument (context_p, scanner_context_p);\n\n      scanner_detect_eval_call (context_p, scanner_context_p);\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_COMMA || context_p->token.type == LEXER_RIGHT_PAREN)\n      {\n        return;\n      }\n\n      if (context_p->token.type != LEXER_ASSIGN)\n      {\n        break;\n      }\n\n      if (argument_literal_p->type & SCANNER_LITERAL_IS_USED)\n      {\n        JERRY_ASSERT (argument_literal_p->type & SCANNER_LITERAL_EARLY_CREATE);\n        return;\n      }\n\n      scanner_binding_literal_t binding_literal;\n      binding_literal.literal_p = argument_literal_p;\n\n      parser_stack_push (context_p, &binding_literal, sizeof (scanner_binding_literal_t));\n      parser_stack_push_uint8 (context_p, SCAN_STACK_BINDING_INIT);\n      return;\n    }\n    case LEXER_LEFT_SQUARE:\n    case LEXER_LEFT_BRACE:\n    {\n      scanner_append_hole (context_p, scanner_context_p);\n      scanner_push_destructuring_pattern (context_p, scanner_context_p, SCANNER_BINDING_ARROW_ARG, false);\n\n      if (context_p->token.type == LEXER_LEFT_BRACE)\n      {\n        parser_stack_push_uint8 (context_p, 0);\n        parser_stack_push_uint8 (context_p, SCAN_STACK_OBJECT_LITERAL);\n        scanner_context_p->mode = SCAN_MODE_PROPERTY_NAME;\n        return;\n      }\n\n      parser_stack_push_uint8 (context_p, SCAN_STACK_ARRAY_LITERAL);\n      scanner_context_p->mode = SCAN_MODE_BINDING;\n      lexer_next_token (context_p);\n      return;\n    }\n  }\n\n  scanner_pop_literal_pool (context_p, scanner_context_p);\n  parser_stack_pop_uint8 (context_p);\n\n  if (context_p->stack_top_uint8 == SCAN_STACK_USE_ASYNC)\n  {\n    scanner_add_async_literal (context_p, scanner_context_p);\n  }\n\n  parser_stack_push_uint8 (context_p, SCAN_STACK_PAREN_EXPRESSION);\n\n  if (process_arrow)\n  {\n    scanner_scan_simple_arrow (context_p, scanner_context_p, source_p);\n  }\n} /* scanner_check_arrow_arg */\n\n/**\n * Detect async functions.\n *\n * @return true, if async is followed by a function keyword, false otherwise\n */\nbool\nscanner_check_async_function (parser_context_t *context_p, /**< context */\n                              scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  JERRY_ASSERT (lexer_token_is_async (context_p));\n  JERRY_ASSERT (scanner_context_p->mode == SCAN_MODE_PRIMARY_EXPRESSION\n                || scanner_context_p->mode == SCAN_MODE_PRIMARY_EXPRESSION_AFTER_NEW);\n  JERRY_ASSERT (scanner_context_p->async_source_p != NULL);\n\n  lexer_lit_location_t async_literal = context_p->token.lit_location;\n\n  lexer_next_token (context_p);\n\n  if (!(context_p->token.flags & LEXER_WAS_NEWLINE))\n  {\n    if (context_p->token.type == LEXER_KEYW_FUNCTION)\n    {\n      return true;\n    }\n\n    if (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n    {\n      if (!lexer_check_arrow (context_p))\n      {\n        scanner_raise_error (context_p);\n      }\n\n      scanner_scan_simple_arrow (context_p, scanner_context_p, scanner_context_p->async_source_p);\n      scanner_context_p->async_source_p = NULL;\n      return false;\n    }\n\n    if (context_p->token.type == LEXER_LEFT_PAREN)\n    {\n      parser_stack_push (context_p, &async_literal, sizeof (lexer_lit_location_t));\n      parser_stack_push_uint8 (context_p, SCAN_STACK_USE_ASYNC);\n      return false;\n    }\n  }\n\n  lexer_lit_location_t *lit_location_p =\n    scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p, &async_literal);\n  lit_location_p->type |= SCANNER_LITERAL_IS_USED;\n\n  if (scanner_context_p->active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_WITH)\n  {\n    lit_location_p->type |= SCANNER_LITERAL_NO_REG;\n  }\n\n  scanner_context_p->async_source_p = NULL;\n  scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n  return false;\n} /* scanner_check_async_function */\n\n/**\n * Check whether the statement of an if/else construct is a function statement.\n */\nvoid\nscanner_check_function_after_if (parser_context_t *context_p, /**< context */\n                                 scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  lexer_next_token (context_p);\n  scanner_context_p->mode = SCAN_MODE_STATEMENT;\n\n  if (JERRY_UNLIKELY (context_p->token.type == LEXER_KEYW_FUNCTION))\n  {\n    scanner_literal_pool_t *literal_pool_p;\n    literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, 0);\n\n    literal_pool_p->source_p = context_p->source_p;\n    parser_stack_push_uint8 (context_p, SCAN_STACK_PRIVATE_BLOCK);\n  }\n} /* scanner_check_function_after_if */\n\n#if JERRY_MODULE_SYSTEM\n\n/**\n * Check whether the next token is meta.\n */\nvoid\nscanner_check_import_meta (parser_context_t *context_p) /**< context */\n{\n  lexer_next_token (context_p);\n\n  if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL\n      || context_p->token.keyword_type != LEXER_KEYW_META\n      || (context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))\n  {\n    scanner_raise_error (context_p);\n  }\n\n  lexer_next_token (context_p);\n\n  context_p->global_status_flags |= ECMA_PARSE_INTERNAL_HAS_IMPORT_META;\n} /* scanner_check_import_meta */\n\n#endif /* JERRY_MODULE_SYSTEM */\n\n/**\n * Arrow types for scanner_scan_bracket() function.\n */\ntypedef enum\n{\n  SCANNER_SCAN_BRACKET_NO_ARROW, /**< not an arrow function */\n  SCANNER_SCAN_BRACKET_SIMPLE_ARROW, /**< simple arrow function */\n  SCANNER_SCAN_BRACKET_ARROW_WITH_ONE_ARG, /**< arrow function with one argument */\n} scanner_scan_bracket_arrow_type_t;\n\n/**\n * Scan bracketed expressions.\n */\nvoid\nscanner_scan_bracket (parser_context_t *context_p, /**< context */\n                      scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  size_t depth = 0;\n  const uint8_t *arrow_source_p;\n  const uint8_t *async_source_p = NULL;\n  scanner_scan_bracket_arrow_type_t arrow_type = SCANNER_SCAN_BRACKET_NO_ARROW;\n\n  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_PAREN);\n\n  do\n  {\n    arrow_source_p = context_p->source_p;\n    depth++;\n    lexer_next_token (context_p);\n  } while (context_p->token.type == LEXER_LEFT_PAREN);\n\n  scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n  switch (context_p->token.type)\n  {\n    case LEXER_LITERAL:\n    {\n      if (context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n      {\n        arrow_source_p = NULL;\n        break;\n      }\n\n      const uint8_t *source_p = context_p->source_p;\n\n      if (lexer_check_arrow (context_p))\n      {\n        arrow_source_p = source_p;\n        arrow_type = SCANNER_SCAN_BRACKET_SIMPLE_ARROW;\n        break;\n      }\n\n      size_t total_depth = depth;\n\n      while (depth > 0 && lexer_check_next_character (context_p, LIT_CHAR_RIGHT_PAREN))\n      {\n        lexer_consume_next_character (context_p);\n        depth--;\n      }\n\n      if (context_p->token.keyword_type == LEXER_KEYW_EVAL\n          && lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))\n      {\n        /* A function call cannot be an eval function. */\n        arrow_source_p = NULL;\n        const uint16_t flags = (uint16_t) (SCANNER_LITERAL_POOL_CAN_EVAL | SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE);\n\n        scanner_context_p->active_literal_pool_p->status_flags |= flags;\n        break;\n      }\n\n      if (total_depth == depth)\n      {\n        if (lexer_check_arrow_param (context_p))\n        {\n          JERRY_ASSERT (depth > 0);\n          depth--;\n          break;\n        }\n\n        if (JERRY_UNLIKELY (lexer_token_is_async (context_p)))\n        {\n          async_source_p = source_p;\n        }\n      }\n\n      if (depth == total_depth - 1 && lexer_check_arrow (context_p))\n      {\n        arrow_type = SCANNER_SCAN_BRACKET_ARROW_WITH_ONE_ARG;\n        break;\n      }\n\n      if (context_p->stack_top_uint8 == SCAN_STACK_USE_ASYNC)\n      {\n        scanner_add_async_literal (context_p, scanner_context_p);\n      }\n\n      arrow_source_p = NULL;\n      break;\n    }\n    case LEXER_THREE_DOTS:\n    case LEXER_LEFT_SQUARE:\n    case LEXER_LEFT_BRACE:\n    case LEXER_RIGHT_PAREN:\n    {\n      JERRY_ASSERT (depth > 0);\n      depth--;\n      break;\n    }\n    default:\n    {\n      arrow_source_p = NULL;\n      break;\n    }\n  }\n\n  if (JERRY_UNLIKELY (scanner_context_p->async_source_p != NULL) && (arrow_source_p == NULL || depth > 0))\n  {\n    scanner_context_p->async_source_p = NULL;\n  }\n\n  while (depth > 0)\n  {\n    parser_stack_push_uint8 (context_p, SCAN_STACK_PAREN_EXPRESSION);\n    depth--;\n  }\n\n  if (arrow_source_p != NULL)\n  {\n    JERRY_ASSERT (async_source_p == NULL);\n\n    if (arrow_type == SCANNER_SCAN_BRACKET_SIMPLE_ARROW)\n    {\n      scanner_scan_simple_arrow (context_p, scanner_context_p, arrow_source_p);\n      return;\n    }\n\n    parser_stack_push_uint8 (context_p, SCAN_STACK_ARROW_ARGUMENTS);\n\n    uint16_t status_flags = 0;\n\n    if (JERRY_UNLIKELY (scanner_context_p->async_source_p != NULL))\n    {\n      status_flags |= SCANNER_LITERAL_POOL_MAY_ASYNC_ARROW;\n      arrow_source_p = scanner_context_p->async_source_p;\n      scanner_context_p->async_source_p = NULL;\n    }\n\n    scanner_literal_pool_t *literal_pool_p;\n    literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, status_flags);\n    literal_pool_p->source_p = arrow_source_p;\n\n    if (arrow_type == SCANNER_SCAN_BRACKET_ARROW_WITH_ONE_ARG)\n    {\n      scanner_append_argument (context_p, scanner_context_p);\n      scanner_detect_eval_call (context_p, scanner_context_p);\n\n      context_p->token.type = LEXER_RIGHT_PAREN;\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n    }\n    else if (context_p->token.type == LEXER_RIGHT_PAREN)\n    {\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n    }\n    else\n    {\n      scanner_check_arrow_arg (context_p, scanner_context_p);\n    }\n  }\n  else if (JERRY_UNLIKELY (async_source_p != NULL))\n  {\n    scanner_context_p->async_source_p = async_source_p;\n    scanner_check_async_function (context_p, scanner_context_p);\n  }\n} /* scanner_scan_bracket */\n\n/**\n * Check directives before a source block.\n */\nvoid\nscanner_check_directives (parser_context_t *context_p, /**< context */\n                          scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  scanner_context_p->mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;\n\n  while (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL)\n  {\n    bool is_use_strict = false;\n\n    if (lexer_string_is_use_strict (context_p) && !(context_p->status_flags & PARSER_IS_STRICT))\n    {\n      is_use_strict = true;\n      context_p->status_flags |= PARSER_IS_STRICT;\n    }\n\n    lexer_next_token (context_p);\n\n    if (!lexer_string_is_directive (context_p))\n    {\n      if (is_use_strict)\n      {\n        context_p->status_flags &= (uint32_t) ~PARSER_IS_STRICT;\n      }\n\n      /* The string is part of an expression statement. */\n      scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n      break;\n    }\n\n    if (is_use_strict)\n    {\n      scanner_context_p->active_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_IS_STRICT;\n    }\n\n    if (context_p->token.type == LEXER_SEMICOLON)\n    {\n      lexer_next_token (context_p);\n    }\n  }\n} /* scanner_check_directives */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_PARSER */\n"
  },
  {
    "path": "jerry-core/parser/js/js-scanner-util.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-helpers.h\"\n#include \"ecma-lex-env.h\"\n\n#include \"jcontext.h\"\n#include \"js-parser-internal.h\"\n#include \"js-scanner-internal.h\"\n#include \"lit-char-helpers.h\"\n\n#if JERRY_PARSER\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_scanner Scanner\n * @{\n */\n\nJERRY_STATIC_ASSERT (PARSER_MAXIMUM_NUMBER_OF_LITERALS + PARSER_MAXIMUM_NUMBER_OF_REGISTERS < PARSER_REGISTER_START,\n                     maximum_number_of_literals_plus_registers_must_be_less_than_register_start);\n\nJERRY_STATIC_ASSERT ((SCANNER_LITERAL_IS_ARROW_DESTRUCTURED_ARG & SCANNER_LITERAL_IS_LOCAL) == 0,\n                     is_arrow_arg_binding_flag_must_not_use_local_flags);\n\nJERRY_STATIC_ASSERT ((SCANNER_LITERAL_IS_LET & SCANNER_LITERAL_IS_LOCAL) != 0, is_let_flag_must_use_local_flags);\n\nJERRY_STATIC_ASSERT ((SCANNER_LITERAL_IS_CONST & SCANNER_LITERAL_IS_LOCAL) != 0, is_const_flag_must_use_local_flags);\n\nJERRY_STATIC_ASSERT ((SCANNER_LITERAL_IS_FUNC_DECLARATION & SCANNER_LITERAL_IS_LOCAL) != 0,\n                     is_func_declaration_flag_must_use_local_flags);\n\nJERRY_STATIC_ASSERT ((SCANNER_LITERAL_IS_DESTRUCTURED_ARG & SCANNER_LITERAL_IS_LOCAL) != 0,\n                     is_arg_binding_flag_must_use_local_flags);\n\nJERRY_STATIC_ASSERT (SCANNER_LITERAL_IS_FUNC_DECLARATION != SCANNER_LITERAL_IS_DESTRUCTURED_ARG,\n                     is_func_declaration_must_be_different_from_is_arg_binding);\n\nJERRY_STATIC_ASSERT (PARSER_SCOPE_STACK_IS_CONST_REG == PARSER_SCOPE_STACK_IS_LOCAL_CREATED,\n                     scope_stack_is_const_reg_and_scope_stack_is_local_created_must_be_the_same);\n\n/**\n * Raise a scanner error.\n */\nvoid\nscanner_raise_error (parser_context_t *context_p /**< context */)\n{\n  PARSER_THROW (context_p->try_buffer);\n  /* Should never been reached. */\n  JERRY_ASSERT (0);\n} /* scanner_raise_error */\n\n/**\n * Raise a variable redeclaration error.\n */\nvoid\nscanner_raise_redeclaration_error (parser_context_t *context_p) /**< context */\n{\n  scanner_info_t *info_p = scanner_insert_info (context_p, context_p->source_p, sizeof (scanner_info_t));\n  info_p->type = SCANNER_TYPE_ERR_REDECLARED;\n\n  scanner_raise_error (context_p);\n} /* scanner_raise_redeclaration_error */\n\n/**\n * Allocate memory for scanner.\n *\n * @return allocated memory\n */\nvoid *\nscanner_malloc (parser_context_t *context_p, /**< context */\n                size_t size) /**< size of the memory block */\n{\n  void *result;\n\n  JERRY_ASSERT (size > 0);\n  result = jmem_heap_alloc_block_null_on_error (size);\n\n  if (result == NULL)\n  {\n    scanner_cleanup (context_p);\n\n    /* This is the only error which specify its reason. */\n    context_p->error = PARSER_ERR_OUT_OF_MEMORY;\n    PARSER_THROW (context_p->try_buffer);\n  }\n  return result;\n} /* scanner_malloc */\n\n/**\n * Free memory allocated by scanner_malloc.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nscanner_free (void *ptr, /**< pointer to free */\n              size_t size) /**< size of the memory block */\n{\n  jmem_heap_free_block (ptr, size);\n} /* scanner_free */\n\n/**\n * Count the size of a stream after an info block.\n *\n * @return the size in bytes\n */\nsize_t\nscanner_get_stream_size (scanner_info_t *info_p, /**< scanner info block */\n                         size_t size) /**< size excluding the stream */\n{\n  const uint8_t *data_p = ((const uint8_t *) info_p) + size;\n  const uint8_t *data_p_start = data_p;\n\n  while (data_p[0] != SCANNER_STREAM_TYPE_END)\n  {\n    switch (data_p[0] & SCANNER_STREAM_TYPE_MASK)\n    {\n      case SCANNER_STREAM_TYPE_VAR:\n      case SCANNER_STREAM_TYPE_LET:\n      case SCANNER_STREAM_TYPE_CONST:\n      case SCANNER_STREAM_TYPE_LOCAL:\n#if JERRY_MODULE_SYSTEM\n      case SCANNER_STREAM_TYPE_IMPORT:\n#endif /* JERRY_MODULE_SYSTEM */\n      case SCANNER_STREAM_TYPE_ARG:\n      case SCANNER_STREAM_TYPE_ARG_VAR:\n      case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG:\n      case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR:\n      case SCANNER_STREAM_TYPE_ARG_FUNC:\n      case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC:\n      case SCANNER_STREAM_TYPE_FUNC:\n      {\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT ((data_p[0] & SCANNER_STREAM_TYPE_MASK) == SCANNER_STREAM_TYPE_HOLE\n                      || SCANNER_STREAM_TYPE_IS_ARGUMENTS (data_p[0] & SCANNER_STREAM_TYPE_MASK));\n        data_p++;\n        continue;\n      }\n    }\n\n    data_p += 3;\n\n    if (data_p[-3] & SCANNER_STREAM_UINT16_DIFF)\n    {\n      data_p++;\n    }\n    else if (data_p[-1] == 0)\n    {\n      data_p += sizeof (const uint8_t *);\n    }\n  }\n\n  return size + 1 + (size_t) (data_p - data_p_start);\n} /* scanner_get_stream_size */\n\n/**\n * Insert a scanner info block into the scanner info chain.\n *\n * @return newly allocated scanner info\n */\nscanner_info_t *\nscanner_insert_info (parser_context_t *context_p, /**< context */\n                     const uint8_t *source_p, /**< triggering position */\n                     size_t size) /**< size of the memory block */\n{\n  scanner_info_t *new_scanner_info_p = (scanner_info_t *) scanner_malloc (context_p, size);\n  scanner_info_t *scanner_info_p = context_p->next_scanner_info_p;\n  scanner_info_t *prev_scanner_info_p = NULL;\n\n  JERRY_ASSERT (scanner_info_p != NULL);\n  JERRY_ASSERT (source_p != NULL);\n\n  new_scanner_info_p->source_p = source_p;\n\n  while (source_p < scanner_info_p->source_p)\n  {\n    prev_scanner_info_p = scanner_info_p;\n    scanner_info_p = scanner_info_p->next_p;\n\n    JERRY_ASSERT (scanner_info_p != NULL);\n  }\n\n  /* Multiple scanner info blocks cannot be assigned to the same position. */\n  JERRY_ASSERT (source_p != scanner_info_p->source_p);\n\n  new_scanner_info_p->next_p = scanner_info_p;\n\n  if (JERRY_LIKELY (prev_scanner_info_p == NULL))\n  {\n    context_p->next_scanner_info_p = new_scanner_info_p;\n  }\n  else\n  {\n    prev_scanner_info_p->next_p = new_scanner_info_p;\n  }\n\n  return new_scanner_info_p;\n} /* scanner_insert_info */\n\n/**\n * Insert a scanner info block into the scanner info chain before a given info block.\n *\n * @return newly allocated scanner info\n */\nscanner_info_t *\nscanner_insert_info_before (parser_context_t *context_p, /**< context */\n                            const uint8_t *source_p, /**< triggering position */\n                            scanner_info_t *start_info_p, /**< first info position */\n                            size_t size) /**< size of the memory block */\n{\n  JERRY_ASSERT (start_info_p != NULL);\n\n  scanner_info_t *new_scanner_info_p = (scanner_info_t *) scanner_malloc (context_p, size);\n  scanner_info_t *scanner_info_p = start_info_p->next_p;\n  scanner_info_t *prev_scanner_info_p = start_info_p;\n\n  new_scanner_info_p->source_p = source_p;\n\n  while (source_p < scanner_info_p->source_p)\n  {\n    prev_scanner_info_p = scanner_info_p;\n    scanner_info_p = scanner_info_p->next_p;\n\n    JERRY_ASSERT (scanner_info_p != NULL);\n  }\n\n  /* Multiple scanner info blocks cannot be assigned to the same position. */\n  JERRY_ASSERT (source_p != scanner_info_p->source_p);\n\n  new_scanner_info_p->next_p = scanner_info_p;\n\n  prev_scanner_info_p->next_p = new_scanner_info_p;\n  return new_scanner_info_p;\n} /* scanner_insert_info_before */\n\n/**\n * Release the next scanner info.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nscanner_release_next (parser_context_t *context_p, /**< context */\n                      size_t size) /**< size of the memory block */\n{\n  scanner_info_t *next_p = context_p->next_scanner_info_p->next_p;\n\n  jmem_heap_free_block (context_p->next_scanner_info_p, size);\n  context_p->next_scanner_info_p = next_p;\n} /* scanner_release_next */\n\n/**\n * Set the active scanner info to the next scanner info.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nscanner_set_active (parser_context_t *context_p) /**< context */\n{\n  scanner_info_t *scanner_info_p = context_p->next_scanner_info_p;\n\n  context_p->next_scanner_info_p = scanner_info_p->next_p;\n  scanner_info_p->next_p = context_p->active_scanner_info_p;\n  context_p->active_scanner_info_p = scanner_info_p;\n} /* scanner_set_active */\n\n/**\n * Set the next scanner info to the active scanner info.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nscanner_revert_active (parser_context_t *context_p) /**< context */\n{\n  scanner_info_t *scanner_info_p = context_p->active_scanner_info_p;\n\n  context_p->active_scanner_info_p = scanner_info_p->next_p;\n  scanner_info_p->next_p = context_p->next_scanner_info_p;\n  context_p->next_scanner_info_p = scanner_info_p;\n} /* scanner_revert_active */\n\n/**\n * Release the active scanner info.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nscanner_release_active (parser_context_t *context_p, /**< context */\n                        size_t size) /**< size of the memory block */\n{\n  scanner_info_t *next_p = context_p->active_scanner_info_p->next_p;\n\n  jmem_heap_free_block (context_p->active_scanner_info_p, size);\n  context_p->active_scanner_info_p = next_p;\n} /* scanner_release_active */\n\n/**\n * Release switch cases.\n */\nvoid\nscanner_release_switch_cases (scanner_case_info_t *case_p) /**< case list */\n{\n  while (case_p != NULL)\n  {\n    scanner_case_info_t *next_p = case_p->next_p;\n\n    jmem_heap_free_block (case_p, sizeof (scanner_case_info_t));\n    case_p = next_p;\n  }\n} /* scanner_release_switch_cases */\n\n/**\n * Release private fields.\n */\nvoid\nscanner_release_private_fields (scanner_class_private_member_t *member_p) /**< private member list */\n{\n  while (member_p != NULL)\n  {\n    scanner_class_private_member_t *prev_p = member_p->prev_p;\n\n    jmem_heap_free_block (member_p, sizeof (scanner_class_private_member_t));\n    member_p = prev_p;\n  }\n} /* scanner_release_private_fields */\n\n/**\n * Seek to correct position in the scanner info list.\n */\nvoid\nscanner_seek (parser_context_t *context_p) /**< context */\n{\n  const uint8_t *source_p = context_p->source_p;\n  scanner_info_t *prev_p;\n\n  if (context_p->skipped_scanner_info_p != NULL)\n  {\n    JERRY_ASSERT (context_p->skipped_scanner_info_p->source_p != NULL);\n\n    context_p->skipped_scanner_info_end_p->next_p = context_p->next_scanner_info_p;\n\n    if (context_p->skipped_scanner_info_end_p->source_p <= source_p)\n    {\n      prev_p = context_p->skipped_scanner_info_end_p;\n    }\n    else\n    {\n      prev_p = context_p->skipped_scanner_info_p;\n\n      if (prev_p->source_p > source_p)\n      {\n        context_p->next_scanner_info_p = prev_p;\n        context_p->skipped_scanner_info_p = NULL;\n        return;\n      }\n\n      context_p->skipped_scanner_info_p = prev_p;\n    }\n  }\n  else\n  {\n    prev_p = context_p->next_scanner_info_p;\n\n    if (prev_p->source_p == NULL || prev_p->source_p > source_p)\n    {\n      return;\n    }\n\n    context_p->skipped_scanner_info_p = prev_p;\n  }\n\n  while (prev_p->next_p->source_p != NULL && prev_p->next_p->source_p <= source_p)\n  {\n    prev_p = prev_p->next_p;\n  }\n\n  context_p->skipped_scanner_info_end_p = prev_p;\n  context_p->next_scanner_info_p = prev_p->next_p;\n} /* scanner_seek */\n\n/**\n * Checks whether a literal is equal to \"arguments\".\n */\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\nscanner_literal_is_arguments (lexer_lit_location_t *literal_p) /**< literal */\n{\n  return lexer_compare_identifier_to_string (literal_p, (const uint8_t *) \"arguments\", 9);\n} /* scanner_literal_is_arguments */\n\n/**\n * Find if there is a duplicated argument in the given context\n *\n * @return true - if there are duplicates, false - otherwise\n */\nstatic bool\nscanner_find_duplicated_arg (parser_context_t *context_p, lexer_lit_location_t *lit_loc_p)\n{\n  if (!(context_p->status_flags & PARSER_FUNCTION_IS_PARSING_ARGS))\n  {\n    return false;\n  }\n\n  if (scanner_literal_is_arguments (lit_loc_p))\n  {\n    return true;\n  }\n\n  uint16_t register_end, encoding_limit, encoding_delta;\n  ecma_value_t *literal_p;\n  ecma_value_t *literal_start_p;\n\n  const ecma_compiled_code_t *bytecode_header_p = JERRY_CONTEXT (vm_top_context_p)->shared_p->bytecode_header_p;\n\n  if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_header_p;\n\n    register_end = args_p->register_end;\n\n    literal_p = (ecma_value_t *) (args_p + 1);\n    literal_p -= register_end;\n    literal_start_p = literal_p;\n    literal_p += args_p->literal_end;\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_header_p;\n\n    register_end = args_p->register_end;\n\n    literal_p = (ecma_value_t *) (args_p + 1);\n    literal_p -= register_end;\n    literal_start_p = literal_p;\n    literal_p += args_p->literal_end;\n  }\n\n  if (!(bytecode_header_p->status_flags & CBC_CODE_FLAGS_FULL_LITERAL_ENCODING))\n  {\n    encoding_limit = CBC_SMALL_LITERAL_ENCODING_LIMIT;\n    encoding_delta = CBC_SMALL_LITERAL_ENCODING_DELTA;\n  }\n  else\n  {\n    encoding_limit = CBC_FULL_LITERAL_ENCODING_LIMIT;\n    encoding_delta = CBC_FULL_LITERAL_ENCODING_DELTA;\n  }\n\n  uint8_t *byte_code_p = (uint8_t *) literal_p;\n\n  bool found_duplicate = false;\n\n  while (*byte_code_p == CBC_CREATE_LOCAL)\n  {\n    byte_code_p++;\n    uint16_t literal_index = *byte_code_p++;\n\n    if (literal_index >= encoding_limit)\n    {\n      literal_index = (uint16_t) (((literal_index << 8) | *byte_code_p++) - encoding_delta);\n    }\n\n    ecma_string_t *arg_string = ecma_get_string_from_value (literal_start_p[literal_index]);\n    uint8_t *destination_p = (uint8_t *) parser_malloc (context_p, lit_loc_p->length);\n    lexer_convert_ident_to_cesu8 (destination_p, lit_loc_p->char_p, lit_loc_p->length);\n    ecma_string_t *search_key_p = ecma_new_ecma_string_from_utf8 (destination_p, lit_loc_p->length);\n    scanner_free (destination_p, lit_loc_p->length);\n\n    found_duplicate = ecma_compare_ecma_strings (arg_string, search_key_p);\n    ecma_deref_ecma_string (search_key_p);\n\n    if (found_duplicate)\n    {\n      break;\n    }\n  }\n\n  return found_duplicate;\n} /* scanner_find_duplicated_arg */\n\n/**\n * Find any let/const declaration of a given literal.\n *\n * @return true - if the literal is found, false - otherwise\n */\nstatic bool\nscanner_scope_find_lexical_declaration (parser_context_t *context_p, /**< context */\n                                        lexer_lit_location_t *literal_p) /**< literal */\n{\n  ecma_string_t *name_p;\n  uint32_t flags = context_p->global_status_flags;\n\n  if (!(flags & ECMA_PARSE_EVAL) || (!(flags & ECMA_PARSE_DIRECT_EVAL) && (context_p->status_flags & PARSER_IS_STRICT)))\n  {\n    return false;\n  }\n\n  if (JERRY_LIKELY (!(literal_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)))\n  {\n    name_p = ecma_new_ecma_string_from_utf8 (literal_p->char_p, literal_p->length);\n  }\n  else\n  {\n    uint8_t *destination_p = (uint8_t *) scanner_malloc (context_p, literal_p->length);\n\n    lexer_convert_ident_to_cesu8 (destination_p, literal_p->char_p, literal_p->length);\n\n    name_p = ecma_new_ecma_string_from_utf8 (destination_p, literal_p->length);\n\n    scanner_free (destination_p, literal_p->length);\n  }\n\n  ecma_object_t *lex_env_p;\n\n  if (flags & ECMA_PARSE_DIRECT_EVAL)\n  {\n    lex_env_p = JERRY_CONTEXT (vm_top_context_p)->lex_env_p;\n\n    while (lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK)\n    {\n      if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n      {\n        ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n        if (property_p != NULL && ecma_is_property_enumerable (*property_p))\n        {\n          ecma_deref_ecma_string (name_p);\n          return true;\n        }\n      }\n\n      JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);\n      lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n    }\n  }\n  else\n  {\n    lex_env_p = ecma_get_global_scope (ecma_builtin_get_global ());\n  }\n\n  if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n  {\n    ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n    if (property_p != NULL\n        && (ecma_is_property_enumerable (*property_p) || scanner_find_duplicated_arg (context_p, literal_p)))\n    {\n      ecma_deref_ecma_string (name_p);\n      return true;\n    }\n  }\n\n  ecma_deref_ecma_string (name_p);\n  return false;\n} /* scanner_scope_find_lexical_declaration */\n\n/**\n * Push a new literal pool.\n *\n * @return the newly created literal pool\n */\nscanner_literal_pool_t *\nscanner_push_literal_pool (parser_context_t *context_p, /**< context */\n                           scanner_context_t *scanner_context_p, /**< scanner context */\n                           uint16_t status_flags) /**< combination of scanner_literal_pool_flags_t flags */\n{\n  scanner_literal_pool_t *prev_literal_pool_p = scanner_context_p->active_literal_pool_p;\n  scanner_literal_pool_t *literal_pool_p;\n\n  literal_pool_p = (scanner_literal_pool_t *) scanner_malloc (context_p, sizeof (scanner_literal_pool_t));\n\n  if (!(status_flags & SCANNER_LITERAL_POOL_FUNCTION))\n  {\n    JERRY_ASSERT (prev_literal_pool_p != NULL);\n    status_flags |= SCANNER_LITERAL_POOL_NO_ARGUMENTS;\n\n    const uint16_t copied_flags =\n      (SCANNER_LITERAL_POOL_IN_WITH | SCANNER_LITERAL_POOL_GENERATOR | SCANNER_LITERAL_POOL_ASYNC);\n\n    status_flags |= (uint16_t) (prev_literal_pool_p->status_flags & copied_flags);\n  }\n  else\n  {\n    context_p->status_flags &= (uint32_t) ~(PARSER_IS_GENERATOR_FUNCTION | PARSER_IS_ASYNC_FUNCTION);\n\n    if (status_flags & SCANNER_LITERAL_POOL_GENERATOR)\n    {\n      context_p->status_flags |= PARSER_IS_GENERATOR_FUNCTION;\n    }\n\n    if (status_flags & SCANNER_LITERAL_POOL_ASYNC)\n    {\n      context_p->status_flags |= PARSER_IS_ASYNC_FUNCTION;\n    }\n  }\n\n  if (prev_literal_pool_p != NULL)\n  {\n    const uint16_t copied_flags = SCANNER_LITERAL_POOL_IS_STRICT;\n    status_flags |= (uint16_t) (prev_literal_pool_p->status_flags & copied_flags);\n\n    /* The logical value of these flags must be the same. */\n    JERRY_ASSERT (!(status_flags & SCANNER_LITERAL_POOL_IS_STRICT) == !(context_p->status_flags & PARSER_IS_STRICT));\n  }\n\n  parser_list_init (&literal_pool_p->literal_pool,\n                    sizeof (lexer_lit_location_t),\n                    (uint32_t) ((128 - sizeof (void *)) / sizeof (lexer_lit_location_t)));\n  literal_pool_p->source_p = NULL;\n  literal_pool_p->status_flags = status_flags;\n  literal_pool_p->no_declarations = 0;\n\n  literal_pool_p->prev_p = prev_literal_pool_p;\n  scanner_context_p->active_literal_pool_p = literal_pool_p;\n\n  return literal_pool_p;\n} /* scanner_push_literal_pool */\n\nJERRY_STATIC_ASSERT (PARSER_MAXIMUM_IDENT_LENGTH <= UINT8_MAX, maximum_ident_length_must_fit_in_a_byte);\n\n/**\n * Current status of arguments.\n */\ntypedef enum\n{\n  SCANNER_ARGUMENTS_NOT_PRESENT, /**< arguments object must not be created */\n  SCANNER_ARGUMENTS_MAY_PRESENT, /**< arguments object can be created */\n  SCANNER_ARGUMENTS_MAY_PRESENT_IN_EVAL, /**< arguments object must be present unless otherwise declared */\n  SCANNER_ARGUMENTS_PRESENT, /**< arguments object must be created */\n  SCANNER_ARGUMENTS_PRESENT_NO_REG, /**< arguments object must be created and cannot be stored in registers */\n} scanner_arguments_type_t;\n\n/**\n * Pop the last literal pool from the end.\n */\nvoid\nscanner_pop_literal_pool (parser_context_t *context_p, /**< context */\n                          scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  scanner_literal_pool_t *literal_pool_p = scanner_context_p->active_literal_pool_p;\n  scanner_literal_pool_t *prev_literal_pool_p = literal_pool_p->prev_p;\n\n  const uint32_t arrow_super_flags = (SCANNER_LITERAL_POOL_ARROW | SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE);\n  if ((literal_pool_p->status_flags & arrow_super_flags) == arrow_super_flags)\n  {\n    prev_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE;\n  }\n\n  if (JERRY_UNLIKELY (literal_pool_p->source_p == NULL))\n  {\n    JERRY_ASSERT (literal_pool_p->status_flags & SCANNER_LITERAL_POOL_FUNCTION);\n    JERRY_ASSERT (literal_pool_p->literal_pool.data.first_p == NULL\n                  && literal_pool_p->literal_pool.data.last_p == NULL);\n\n    scanner_context_p->active_literal_pool_p = literal_pool_p->prev_p;\n    scanner_free (literal_pool_p, sizeof (scanner_literal_pool_t));\n    return;\n  }\n\n  uint16_t status_flags = literal_pool_p->status_flags;\n  scanner_arguments_type_t arguments_type = SCANNER_ARGUMENTS_MAY_PRESENT;\n\n  if (status_flags & SCANNER_LITERAL_POOL_NO_ARGUMENTS)\n  {\n    arguments_type = SCANNER_ARGUMENTS_NOT_PRESENT;\n  }\n  else if (status_flags & SCANNER_LITERAL_POOL_CAN_EVAL)\n  {\n    arguments_type = SCANNER_ARGUMENTS_MAY_PRESENT_IN_EVAL;\n  }\n\n  if (status_flags & SCANNER_LITERAL_POOL_ARGUMENTS_IN_ARGS)\n  {\n    arguments_type = SCANNER_ARGUMENTS_PRESENT;\n\n    if (status_flags & (SCANNER_LITERAL_POOL_NO_ARGUMENTS | SCANNER_LITERAL_POOL_CAN_EVAL))\n    {\n      arguments_type = SCANNER_ARGUMENTS_PRESENT_NO_REG;\n      status_flags &= (uint16_t) ~SCANNER_LITERAL_POOL_NO_ARGUMENTS;\n    }\n  }\n\n  uint8_t can_eval_types = 0;\n\n  if (prev_literal_pool_p == NULL && !(context_p->global_status_flags & ECMA_PARSE_DIRECT_EVAL))\n  {\n    can_eval_types |= SCANNER_LITERAL_IS_FUNC;\n  }\n\n  if ((status_flags & SCANNER_LITERAL_POOL_CAN_EVAL) && prev_literal_pool_p != NULL)\n  {\n    prev_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_CAN_EVAL;\n  }\n\n#if JERRY_DEBUGGER\n  if (scanner_context_p->status_flags & SCANNER_CONTEXT_DEBUGGER_ENABLED)\n  {\n    /* When debugger is enabled, identifiers are not stored in registers. However,\n     * this does not affect 'eval' detection, so 'arguments' object is not created. */\n    status_flags |= SCANNER_LITERAL_POOL_CAN_EVAL;\n  }\n#endif /* JERRY_DEBUGGER */\n\n  parser_list_iterator_t literal_iterator;\n  lexer_lit_location_t *literal_p;\n  int32_t no_declarations = literal_pool_p->no_declarations;\n\n  parser_list_iterator_init (&literal_pool_p->literal_pool, &literal_iterator);\n\n  uint8_t arguments_stream_type = SCANNER_STREAM_TYPE_ARGUMENTS;\n  const uint8_t *prev_source_p = literal_pool_p->source_p - 1;\n  lexer_lit_location_t *last_argument_p = NULL;\n  size_t compressed_size = 1;\n\n  while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n  {\n    uint8_t type = literal_p->type;\n\n    if (JERRY_UNLIKELY (no_declarations > PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK))\n    {\n      continue;\n    }\n\n    if (!(status_flags & SCANNER_LITERAL_POOL_NO_ARGUMENTS) && scanner_literal_is_arguments (literal_p))\n    {\n      JERRY_ASSERT (arguments_type != SCANNER_ARGUMENTS_NOT_PRESENT);\n      status_flags |= SCANNER_LITERAL_POOL_NO_ARGUMENTS;\n\n      if (type & SCANNER_LITERAL_IS_ARG)\n      {\n        JERRY_ASSERT (arguments_type != SCANNER_ARGUMENTS_PRESENT\n                      && arguments_type != SCANNER_ARGUMENTS_PRESENT_NO_REG);\n        arguments_type = SCANNER_ARGUMENTS_NOT_PRESENT;\n        last_argument_p = literal_p;\n      }\n      else if (type & SCANNER_LITERAL_IS_LOCAL)\n      {\n        if (arguments_type == SCANNER_ARGUMENTS_MAY_PRESENT || arguments_type == SCANNER_ARGUMENTS_MAY_PRESENT_IN_EVAL)\n        {\n          arguments_type = SCANNER_ARGUMENTS_NOT_PRESENT;\n        }\n        else\n        {\n          if (arguments_type == SCANNER_ARGUMENTS_PRESENT_NO_REG)\n          {\n            type |= SCANNER_LITERAL_NO_REG;\n          }\n          else if (type & (SCANNER_LITERAL_NO_REG | SCANNER_LITERAL_EARLY_CREATE))\n          {\n            arguments_type = SCANNER_ARGUMENTS_PRESENT_NO_REG;\n          }\n\n          if ((type & SCANNER_LITERAL_IS_LOCAL_FUNC) == SCANNER_LITERAL_IS_LOCAL_FUNC)\n          {\n            type |= SCANNER_LITERAL_IS_ARG;\n            literal_p->type = type;\n            no_declarations--;\n            arguments_stream_type = SCANNER_STREAM_TYPE_ARGUMENTS_FUNC;\n          }\n          else\n          {\n            arguments_stream_type |= SCANNER_STREAM_LOCAL_ARGUMENTS;\n          }\n        }\n      }\n      else\n      {\n        if ((type & SCANNER_LITERAL_IS_VAR)\n            && (arguments_type == SCANNER_ARGUMENTS_PRESENT || arguments_type == SCANNER_ARGUMENTS_PRESENT_NO_REG))\n        {\n          if (arguments_type == SCANNER_ARGUMENTS_PRESENT_NO_REG)\n          {\n            type |= SCANNER_LITERAL_NO_REG;\n          }\n          else if (type & (SCANNER_LITERAL_NO_REG | SCANNER_LITERAL_EARLY_CREATE))\n          {\n            arguments_type = SCANNER_ARGUMENTS_PRESENT_NO_REG;\n          }\n\n          type |= SCANNER_LITERAL_IS_ARG;\n          literal_p->type = type;\n          no_declarations--;\n        }\n\n        if ((type & SCANNER_LITERAL_NO_REG) || arguments_type == SCANNER_ARGUMENTS_MAY_PRESENT_IN_EVAL)\n        {\n          arguments_type = SCANNER_ARGUMENTS_PRESENT_NO_REG;\n        }\n        else if (arguments_type == SCANNER_ARGUMENTS_MAY_PRESENT)\n        {\n          arguments_type = SCANNER_ARGUMENTS_PRESENT;\n        }\n\n        /* The SCANNER_LITERAL_IS_ARG may be set above. */\n        if (!(type & SCANNER_LITERAL_IS_ARG))\n        {\n          literal_p->type = 0;\n          continue;\n        }\n      }\n    }\n    else if (type & SCANNER_LITERAL_IS_ARG)\n    {\n      last_argument_p = literal_p;\n    }\n\n    if ((status_flags & SCANNER_LITERAL_POOL_FUNCTION)\n        && (type & SCANNER_LITERAL_IS_LOCAL_FUNC) == SCANNER_LITERAL_IS_FUNC)\n    {\n      if (prev_literal_pool_p == NULL && scanner_scope_find_lexical_declaration (context_p, literal_p))\n      {\n        literal_p->type = 0;\n        continue;\n      }\n\n      if (!(type & SCANNER_LITERAL_IS_ARG))\n      {\n        type |= SCANNER_LITERAL_IS_VAR;\n      }\n\n      type &= (uint8_t) ~SCANNER_LITERAL_IS_FUNC;\n      literal_p->type = type;\n    }\n\n    if ((type & SCANNER_LITERAL_IS_LOCAL)\n        || ((type & (SCANNER_LITERAL_IS_VAR | SCANNER_LITERAL_IS_ARG))\n            && (status_flags & SCANNER_LITERAL_POOL_FUNCTION)))\n    {\n      JERRY_ASSERT ((status_flags & SCANNER_LITERAL_POOL_FUNCTION) || !(literal_p->type & SCANNER_LITERAL_IS_ARG));\n\n      if (literal_p->length == 0)\n      {\n        compressed_size += 1;\n        continue;\n      }\n\n      no_declarations++;\n\n      if ((status_flags & SCANNER_LITERAL_POOL_CAN_EVAL) || (type & can_eval_types))\n      {\n        type |= SCANNER_LITERAL_NO_REG;\n        literal_p->type = type;\n      }\n\n      if (type & SCANNER_LITERAL_IS_FUNC)\n      {\n        no_declarations++;\n\n        if ((type & (SCANNER_LITERAL_IS_CONST | SCANNER_LITERAL_IS_ARG)) == SCANNER_LITERAL_IS_CONST)\n        {\n          JERRY_ASSERT (type & SCANNER_LITERAL_IS_LET);\n\n          /* Catch parameters cannot be functions. */\n          literal_p->type = (uint8_t) (type & ~SCANNER_LITERAL_IS_FUNC);\n          no_declarations--;\n        }\n      }\n\n      intptr_t diff = (intptr_t) (literal_p->char_p - prev_source_p);\n\n      if (diff >= 1 && diff <= (intptr_t) UINT8_MAX)\n      {\n        compressed_size += 2 + 1;\n      }\n      else if (diff >= -(intptr_t) UINT8_MAX && diff <= (intptr_t) UINT16_MAX)\n      {\n        compressed_size += 2 + 2;\n      }\n      else\n      {\n        compressed_size += 2 + 1 + sizeof (const uint8_t *);\n      }\n\n      prev_source_p = literal_p->char_p + literal_p->length;\n\n      if ((status_flags & SCANNER_LITERAL_POOL_FUNCTION)\n          || ((type & SCANNER_LITERAL_IS_FUNC) && (status_flags & SCANNER_LITERAL_POOL_IS_STRICT))\n          || !(type & (SCANNER_LITERAL_IS_VAR | SCANNER_LITERAL_IS_FUNC)))\n      {\n        continue;\n      }\n    }\n\n    if (prev_literal_pool_p != NULL && literal_p->length > 0)\n    {\n      /* Propagate literal to upper level. */\n      lexer_lit_location_t *literal_location_p = scanner_add_custom_literal (context_p, prev_literal_pool_p, literal_p);\n      uint8_t extended_type = literal_location_p->type;\n\n      if ((status_flags & (SCANNER_LITERAL_POOL_FUNCTION | SCANNER_LITERAL_POOL_CLASS_FIELD))\n          || (type & SCANNER_LITERAL_NO_REG))\n      {\n        extended_type |= SCANNER_LITERAL_NO_REG;\n      }\n\n      extended_type |= SCANNER_LITERAL_IS_USED;\n\n      if (status_flags & SCANNER_LITERAL_POOL_FUNCTION_STATEMENT)\n      {\n        extended_type |= SCANNER_LITERAL_EARLY_CREATE;\n      }\n\n      const uint8_t mask = (SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_LOCAL);\n\n      if ((type & SCANNER_LITERAL_IS_ARG) || (literal_location_p->type & mask) == SCANNER_LITERAL_IS_LET\n          || (literal_location_p->type & mask) == SCANNER_LITERAL_IS_CONST)\n      {\n        /* Clears the SCANNER_LITERAL_IS_VAR and SCANNER_LITERAL_IS_FUNC flags\n         * for speculative arrow parameters and local (non-var) functions. */\n        type = 0;\n      }\n\n      type = (uint8_t) (type & (SCANNER_LITERAL_IS_VAR | SCANNER_LITERAL_IS_FUNC));\n      JERRY_ASSERT (type == 0 || !(status_flags & SCANNER_LITERAL_POOL_FUNCTION));\n\n      literal_location_p->type = (uint8_t) (extended_type | type);\n    }\n  }\n\n  if ((status_flags & SCANNER_LITERAL_POOL_FUNCTION) || (compressed_size > 1))\n  {\n    if (arguments_type == SCANNER_ARGUMENTS_MAY_PRESENT)\n    {\n      arguments_type = SCANNER_ARGUMENTS_NOT_PRESENT;\n    }\n    else if (arguments_type == SCANNER_ARGUMENTS_MAY_PRESENT_IN_EVAL)\n    {\n      arguments_type = SCANNER_ARGUMENTS_PRESENT_NO_REG;\n    }\n\n    if (arguments_type != SCANNER_ARGUMENTS_NOT_PRESENT)\n    {\n      compressed_size++;\n    }\n\n    compressed_size += sizeof (scanner_info_t);\n\n    scanner_info_t *info_p;\n\n    if (prev_literal_pool_p != NULL || scanner_context_p->end_arguments_p == NULL)\n    {\n      info_p = scanner_insert_info (context_p, literal_pool_p->source_p, compressed_size);\n    }\n    else\n    {\n      scanner_info_t *start_info_p = scanner_context_p->end_arguments_p;\n      info_p = scanner_insert_info_before (context_p, literal_pool_p->source_p, start_info_p, compressed_size);\n    }\n\n    if (no_declarations > PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK)\n    {\n      no_declarations = PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK;\n    }\n\n    uint8_t *data_p = (uint8_t *) (info_p + 1);\n    bool mapped_arguments = false;\n\n    if (status_flags & SCANNER_LITERAL_POOL_FUNCTION)\n    {\n      info_p->type = SCANNER_TYPE_FUNCTION;\n\n      uint8_t u8_arg = 0;\n\n      if (arguments_type != SCANNER_ARGUMENTS_NOT_PRESENT)\n      {\n        u8_arg |= SCANNER_FUNCTION_ARGUMENTS_NEEDED;\n\n        if (no_declarations < PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK)\n        {\n          no_declarations++;\n        }\n\n        if (!(status_flags & (SCANNER_LITERAL_POOL_IS_STRICT | SCANNER_LITERAL_POOL_HAS_COMPLEX_ARGUMENT)))\n        {\n          mapped_arguments = true;\n        }\n\n        if (arguments_type == SCANNER_ARGUMENTS_PRESENT_NO_REG)\n        {\n          arguments_stream_type |= SCANNER_STREAM_NO_REG;\n        }\n\n        if (last_argument_p == NULL)\n        {\n          *data_p++ = arguments_stream_type;\n        }\n      }\n      else\n      {\n        last_argument_p = NULL;\n      }\n\n      if (status_flags & (SCANNER_LITERAL_POOL_HAS_COMPLEX_ARGUMENT | SCANNER_LITERAL_POOL_ARROW))\n      {\n        u8_arg |= SCANNER_FUNCTION_HAS_COMPLEX_ARGUMENT;\n      }\n\n      if (status_flags & SCANNER_LITERAL_POOL_ASYNC)\n      {\n        u8_arg |= SCANNER_FUNCTION_ASYNC;\n\n        if (status_flags & SCANNER_LITERAL_POOL_FUNCTION_STATEMENT)\n        {\n          u8_arg |= SCANNER_FUNCTION_STATEMENT;\n        }\n      }\n\n      if (status_flags & SCANNER_LITERAL_POOL_CAN_EVAL)\n      {\n        u8_arg |= SCANNER_FUNCTION_LEXICAL_ENV_NEEDED;\n      }\n\n      if (status_flags & SCANNER_LITERAL_POOL_IS_STRICT)\n      {\n        u8_arg |= SCANNER_FUNCTION_IS_STRICT;\n      }\n\n      info_p->u8_arg = u8_arg;\n      info_p->u16_arg = (uint16_t) no_declarations;\n    }\n    else\n    {\n      info_p->type = SCANNER_TYPE_BLOCK;\n\n      JERRY_ASSERT (prev_literal_pool_p != NULL);\n    }\n\n    parser_list_iterator_init (&literal_pool_p->literal_pool, &literal_iterator);\n    prev_source_p = literal_pool_p->source_p - 1;\n    no_declarations = literal_pool_p->no_declarations;\n\n    while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n    {\n      if (JERRY_UNLIKELY (no_declarations > PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK)\n          || (!(literal_p->type & SCANNER_LITERAL_IS_LOCAL)\n              && (!(literal_p->type & (SCANNER_LITERAL_IS_VAR | SCANNER_LITERAL_IS_ARG))\n                  || !(status_flags & SCANNER_LITERAL_POOL_FUNCTION))))\n      {\n        continue;\n      }\n\n      if (literal_p->length == 0)\n      {\n        *data_p++ = SCANNER_STREAM_TYPE_HOLE;\n\n        if (literal_p == last_argument_p)\n        {\n          *data_p++ = arguments_stream_type;\n        }\n        continue;\n      }\n\n      no_declarations++;\n\n      uint8_t type = SCANNER_STREAM_TYPE_VAR;\n\n      if (literal_p->type & SCANNER_LITERAL_IS_FUNC)\n      {\n        no_declarations++;\n        type = SCANNER_STREAM_TYPE_FUNC;\n\n        if (literal_p->type & SCANNER_LITERAL_IS_ARG)\n        {\n          type = SCANNER_STREAM_TYPE_ARG_FUNC;\n\n          if (literal_p->type & SCANNER_LITERAL_IS_DESTRUCTURED_ARG)\n          {\n            type = SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC;\n          }\n        }\n      }\n      else if (literal_p->type & SCANNER_LITERAL_IS_ARG)\n      {\n        type = SCANNER_STREAM_TYPE_ARG;\n\n        if (literal_p->type & SCANNER_LITERAL_IS_DESTRUCTURED_ARG)\n        {\n          type = SCANNER_STREAM_TYPE_DESTRUCTURED_ARG;\n        }\n\n        if (literal_p->type & SCANNER_LITERAL_IS_VAR)\n        {\n          type = (uint8_t) (type + 1);\n\n          JERRY_ASSERT (type == SCANNER_STREAM_TYPE_ARG_VAR || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR);\n        }\n      }\n      else if (literal_p->type & SCANNER_LITERAL_IS_LET)\n      {\n        if (!(literal_p->type & SCANNER_LITERAL_IS_CONST))\n        {\n          type = SCANNER_STREAM_TYPE_LET;\n\n          if ((status_flags & SCANNER_LITERAL_POOL_CAN_EVAL) && (literal_p->type & SCANNER_LITERAL_NO_REG))\n          {\n            literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;\n          }\n        }\n#if JERRY_MODULE_SYSTEM\n        else if (prev_literal_pool_p == NULL)\n        {\n          type = SCANNER_STREAM_TYPE_IMPORT;\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n        else\n        {\n          type = SCANNER_STREAM_TYPE_LOCAL;\n        }\n      }\n      else if (literal_p->type & SCANNER_LITERAL_IS_CONST)\n      {\n        type = SCANNER_STREAM_TYPE_CONST;\n\n        if ((status_flags & SCANNER_LITERAL_POOL_CAN_EVAL) && (literal_p->type & SCANNER_LITERAL_NO_REG))\n        {\n          literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;\n        }\n      }\n\n      if (literal_p->type & SCANNER_LITERAL_EARLY_CREATE)\n      {\n        type |= SCANNER_STREAM_NO_REG | SCANNER_STREAM_EARLY_CREATE;\n      }\n\n      if (literal_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)\n      {\n        type |= SCANNER_STREAM_HAS_ESCAPE;\n      }\n\n      if ((literal_p->type & SCANNER_LITERAL_NO_REG)\n          || (mapped_arguments && (literal_p->type & SCANNER_LITERAL_IS_ARG)))\n      {\n        type |= SCANNER_STREAM_NO_REG;\n      }\n\n      data_p[0] = type;\n      data_p[1] = (uint8_t) literal_p->length;\n      data_p += 3;\n\n      intptr_t diff = (intptr_t) (literal_p->char_p - prev_source_p);\n\n      if (diff >= 1 && diff <= (intptr_t) UINT8_MAX)\n      {\n        data_p[-1] = (uint8_t) diff;\n      }\n      else if (diff >= -(intptr_t) UINT8_MAX && diff <= (intptr_t) UINT16_MAX)\n      {\n        if (diff < 0)\n        {\n          diff = -diff;\n        }\n\n        data_p[-3] |= SCANNER_STREAM_UINT16_DIFF;\n        data_p[-1] = (uint8_t) diff;\n        data_p[0] = (uint8_t) (diff >> 8);\n        data_p += 1;\n      }\n      else\n      {\n        data_p[-1] = 0;\n        memcpy (data_p, &literal_p->char_p, sizeof (uintptr_t));\n        data_p += sizeof (uintptr_t);\n      }\n\n      if (literal_p == last_argument_p)\n      {\n        *data_p++ = arguments_stream_type;\n      }\n\n      prev_source_p = literal_p->char_p + literal_p->length;\n    }\n\n    data_p[0] = SCANNER_STREAM_TYPE_END;\n\n    JERRY_ASSERT (((uint8_t *) info_p) + compressed_size == data_p + 1);\n  }\n\n  if (!(status_flags & SCANNER_LITERAL_POOL_FUNCTION)\n      && (int32_t) prev_literal_pool_p->no_declarations < no_declarations)\n  {\n    prev_literal_pool_p->no_declarations = (uint16_t) no_declarations;\n  }\n\n  if ((status_flags & SCANNER_LITERAL_POOL_FUNCTION) && prev_literal_pool_p != NULL)\n  {\n    if (prev_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IS_STRICT)\n    {\n      context_p->status_flags |= PARSER_IS_STRICT;\n    }\n    else\n    {\n      context_p->status_flags &= (uint32_t) ~PARSER_IS_STRICT;\n    }\n\n    if (prev_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_GENERATOR)\n    {\n      context_p->status_flags |= PARSER_IS_GENERATOR_FUNCTION;\n    }\n    else\n    {\n      context_p->status_flags &= (uint32_t) ~PARSER_IS_GENERATOR_FUNCTION;\n    }\n\n    if (prev_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_ASYNC)\n    {\n      context_p->status_flags |= PARSER_IS_ASYNC_FUNCTION;\n    }\n    else\n    {\n      context_p->status_flags &= (uint32_t) ~PARSER_IS_ASYNC_FUNCTION;\n    }\n  }\n\n  scanner_context_p->active_literal_pool_p = literal_pool_p->prev_p;\n\n  parser_list_free (&literal_pool_p->literal_pool);\n  scanner_free (literal_pool_p, sizeof (scanner_literal_pool_t));\n} /* scanner_pop_literal_pool */\n\n/**\n * Filter out the arguments from a literal pool.\n */\nvoid\nscanner_filter_arguments (parser_context_t *context_p, /**< context */\n                          scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  /* Fast case: check whether all literals are arguments. */\n  scanner_literal_pool_t *literal_pool_p = scanner_context_p->active_literal_pool_p;\n  scanner_literal_pool_t *prev_literal_pool_p = literal_pool_p->prev_p;\n  parser_list_iterator_t literal_iterator;\n  lexer_lit_location_t *literal_p;\n  bool can_eval = (literal_pool_p->status_flags & SCANNER_LITERAL_POOL_CAN_EVAL) != 0;\n  bool has_arguments = (literal_pool_p->status_flags & SCANNER_LITERAL_POOL_NO_ARGUMENTS) == 0;\n\n  JERRY_ASSERT (SCANNER_LITERAL_POOL_MAY_HAVE_ARGUMENTS (literal_pool_p->status_flags));\n\n  if (JERRY_UNLIKELY (can_eval))\n  {\n    if (prev_literal_pool_p != NULL)\n    {\n      prev_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_CAN_EVAL;\n    }\n\n    literal_pool_p->status_flags &= (uint16_t) ~SCANNER_LITERAL_POOL_CAN_EVAL;\n  }\n  else\n  {\n    parser_list_iterator_init (&literal_pool_p->literal_pool, &literal_iterator);\n\n    while (true)\n    {\n      literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator);\n\n      if (literal_p == NULL)\n      {\n        return;\n      }\n\n      if (can_eval || (literal_p->type & SCANNER_LITERAL_EARLY_CREATE))\n      {\n        literal_p->type |= SCANNER_LITERAL_NO_REG | SCANNER_LITERAL_EARLY_CREATE;\n      }\n\n      uint8_t type = literal_p->type;\n      const uint8_t mask =\n        (SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_DESTRUCTURED_ARG | SCANNER_LITERAL_IS_ARROW_DESTRUCTURED_ARG);\n\n      if ((type & mask) != SCANNER_LITERAL_IS_ARG)\n      {\n        break;\n      }\n    }\n  }\n\n  /* Destructured args are placed after the other arguments because of register assignments. */\n  bool has_destructured_arg = false;\n  scanner_literal_pool_t *new_literal_pool_p;\n\n  new_literal_pool_p = (scanner_literal_pool_t *) scanner_malloc (context_p, sizeof (scanner_literal_pool_t));\n\n  new_literal_pool_p->prev_p = literal_pool_p;\n  scanner_context_p->active_literal_pool_p = new_literal_pool_p;\n\n  *new_literal_pool_p = *literal_pool_p;\n  parser_list_init (&new_literal_pool_p->literal_pool,\n                    sizeof (lexer_lit_location_t),\n                    (uint32_t) ((128 - sizeof (void *)) / sizeof (lexer_lit_location_t)));\n\n  parser_list_iterator_init (&literal_pool_p->literal_pool, &literal_iterator);\n\n  while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n  {\n    uint8_t type = literal_p->type;\n\n    if (type & SCANNER_LITERAL_IS_ARG)\n    {\n      if (can_eval || (literal_p->type & SCANNER_LITERAL_EARLY_CREATE))\n      {\n        type |= SCANNER_LITERAL_NO_REG | SCANNER_LITERAL_EARLY_CREATE;\n        literal_p->type = type;\n      }\n\n      if (has_arguments && scanner_literal_is_arguments (literal_p))\n      {\n        has_arguments = false;\n      }\n\n      if (type & (SCANNER_LITERAL_IS_DESTRUCTURED_ARG | SCANNER_LITERAL_IS_ARROW_DESTRUCTURED_ARG))\n      {\n        has_destructured_arg = true;\n\n        if (type & SCANNER_LITERAL_IS_DESTRUCTURED_ARG)\n        {\n          continue;\n        }\n\n        type &= (uint8_t) ~SCANNER_LITERAL_IS_ARROW_DESTRUCTURED_ARG;\n        type |= SCANNER_LITERAL_IS_DESTRUCTURED_ARG;\n\n        literal_p->type = type;\n        continue;\n      }\n\n      lexer_lit_location_t *new_literal_p;\n      new_literal_p = (lexer_lit_location_t *) parser_list_append (context_p, &new_literal_pool_p->literal_pool);\n      *new_literal_p = *literal_p;\n    }\n    else if (has_arguments && scanner_literal_is_arguments (literal_p))\n    {\n      /* Arguments object is directly referenced from the function arguments */\n      new_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_ARGUMENTS_IN_ARGS;\n\n      if (type & SCANNER_LITERAL_NO_REG)\n      {\n        new_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_NO_ARGUMENTS;\n      }\n    }\n    else if (prev_literal_pool_p != NULL)\n    {\n      /* Propagate literal to upper level. */\n      lexer_lit_location_t *literal_location_p = scanner_add_custom_literal (context_p, prev_literal_pool_p, literal_p);\n      type |= SCANNER_LITERAL_NO_REG | SCANNER_LITERAL_IS_USED;\n      literal_location_p->type |= type;\n    }\n  }\n\n  if (has_destructured_arg)\n  {\n    parser_list_iterator_init (&literal_pool_p->literal_pool, &literal_iterator);\n\n    while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n    {\n      const uint8_t expected_flags = SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_DESTRUCTURED_ARG;\n\n      if ((literal_p->type & expected_flags) == expected_flags)\n      {\n        lexer_lit_location_t *new_literal_p;\n        new_literal_p = (lexer_lit_location_t *) parser_list_append (context_p, &new_literal_pool_p->literal_pool);\n        *new_literal_p = *literal_p;\n      }\n    }\n  }\n\n  if (has_arguments)\n  {\n    /* Force the lexically stored arguments object creation */\n    new_literal_pool_p->status_flags |= (SCANNER_LITERAL_POOL_ARGUMENTS_IN_ARGS | SCANNER_LITERAL_POOL_NO_ARGUMENTS);\n  }\n\n  new_literal_pool_p->prev_p = prev_literal_pool_p;\n\n  parser_list_free (&literal_pool_p->literal_pool);\n  scanner_free (literal_pool_p, sizeof (scanner_literal_pool_t));\n} /* scanner_filter_arguments */\n\n/**\n * Add any literal to the specified literal pool.\n *\n * @return pointer to the literal\n */\nlexer_lit_location_t *\nscanner_add_custom_literal (parser_context_t *context_p, /**< context */\n                            scanner_literal_pool_t *literal_pool_p, /**< literal pool */\n                            const lexer_lit_location_t *literal_location_p) /**< literal */\n{\n  while (true)\n  {\n    parser_list_iterator_t literal_iterator;\n    parser_list_iterator_init (&literal_pool_p->literal_pool, &literal_iterator);\n    lexer_lit_location_t *literal_p;\n\n    const uint8_t *char_p = literal_location_p->char_p;\n    prop_length_t length = literal_location_p->length;\n\n    if (JERRY_LIKELY (!(literal_location_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)))\n    {\n      while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n      {\n        if (literal_p->length == length)\n        {\n          if (JERRY_LIKELY (!(literal_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)))\n          {\n            if (memcmp (literal_p->char_p, char_p, length) == 0)\n            {\n              return literal_p;\n            }\n          }\n          else if (lexer_compare_identifier_to_string (literal_p, char_p, length))\n          {\n            /* The non-escaped version is preferred. */\n            literal_p->char_p = char_p;\n            literal_p->status_flags = LEXER_LIT_LOCATION_NO_OPTS;\n            return literal_p;\n          }\n        }\n      }\n    }\n    else\n    {\n      while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n      {\n        if (lexer_compare_identifiers (context_p, literal_p, literal_location_p))\n        {\n          return literal_p;\n        }\n      }\n    }\n\n    if (JERRY_UNLIKELY (literal_pool_p->status_flags & SCANNER_LITERAL_POOL_CLASS_NAME))\n    {\n      literal_pool_p = literal_pool_p->prev_p;\n      continue;\n    }\n\n    literal_p = (lexer_lit_location_t *) parser_list_append (context_p, &literal_pool_p->literal_pool);\n    *literal_p = *literal_location_p;\n\n    literal_p->type = 0;\n\n    return literal_p;\n  }\n} /* scanner_add_custom_literal */\n\n/**\n * Add the current literal token to the current literal pool.\n *\n * @return pointer to the literal\n */\nextern inline lexer_lit_location_t *JERRY_ATTR_ALWAYS_INLINE\nscanner_add_literal (parser_context_t *context_p, /**< context */\n                     scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  return scanner_add_custom_literal (context_p,\n                                     scanner_context_p->active_literal_pool_p,\n                                     &context_p->token.lit_location);\n} /* scanner_add_literal */\n\n/**\n * Add the current literal token to the current literal pool and\n * set SCANNER_LITERAL_NO_REG if it is inside a with statement.\n *\n * @return pointer to the literal\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nscanner_add_reference (parser_context_t *context_p, /**< context */\n                       scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  lexer_lit_location_t *lit_location_p =\n    scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p, &context_p->token.lit_location);\n  lit_location_p->type |= SCANNER_LITERAL_IS_USED;\n\n  if (scanner_context_p->active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_WITH)\n  {\n    lit_location_p->type |= SCANNER_LITERAL_NO_REG;\n  }\n\n  scanner_detect_eval_call (context_p, scanner_context_p);\n} /* scanner_add_reference */\n\n/**\n * Append an argument to the literal pool. If the argument is already present, make it a \"hole\".\n *\n * @return newly created literal\n */\nlexer_lit_location_t *\nscanner_append_argument (parser_context_t *context_p, /**< context */\n                         scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  scanner_literal_pool_t *literal_pool_p = scanner_context_p->active_literal_pool_p;\n  parser_list_iterator_t literal_iterator;\n  parser_list_iterator_init (&literal_pool_p->literal_pool, &literal_iterator);\n  lexer_lit_location_t *literal_location_p = &context_p->token.lit_location;\n  lexer_lit_location_t *literal_p;\n\n  const uint8_t *char_p = literal_location_p->char_p;\n  prop_length_t length = literal_location_p->length;\n\n  JERRY_ASSERT (SCANNER_LITERAL_POOL_MAY_HAVE_ARGUMENTS (literal_pool_p->status_flags));\n\n  if (JERRY_LIKELY (!(context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)))\n  {\n    while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n    {\n      if (literal_p->length == length)\n      {\n        if (JERRY_LIKELY (!(literal_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)))\n        {\n          if (memcmp (literal_p->char_p, char_p, length) == 0)\n          {\n            break;\n          }\n        }\n        else if (lexer_compare_identifier_to_string (literal_p, char_p, length))\n        {\n          break;\n        }\n      }\n    }\n  }\n  else\n  {\n    while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n    {\n      if (lexer_compare_identifiers (context_p, literal_p, literal_location_p))\n      {\n        break;\n      }\n    }\n  }\n\n  uint8_t literal_type = SCANNER_LITERAL_IS_ARG;\n\n  if (literal_p != NULL)\n  {\n    literal_p->length = 0;\n\n    if (literal_p->type & SCANNER_LITERAL_IS_USED)\n    {\n      literal_type = SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_EARLY_CREATE;\n    }\n  }\n\n  literal_p = (lexer_lit_location_t *) parser_list_append (context_p, &literal_pool_p->literal_pool);\n\n  *literal_p = context_p->token.lit_location;\n  literal_p->type = literal_type;\n\n  return literal_p;\n} /* scanner_append_argument */\n\n/**\n * Add private identifiers to private ident pool\n */\nvoid\nscanner_add_private_identifier (parser_context_t *context_p, /**< context  */\n                                scanner_private_field_flags_t opts) /**< options */\n{\n  scan_stack_modes_t stack_top = (scan_stack_modes_t) context_p->stack_top_uint8;\n  parser_stack_pop_uint8 (context_p);\n  scanner_class_info_t *class_info_p;\n  parser_stack_pop (context_p, &class_info_p, sizeof (scanner_class_info_t *));\n\n  scanner_class_private_member_t *iter = class_info_p->members;\n\n  scanner_private_field_flags_t search_flag =\n    ((opts & SCANNER_PRIVATE_FIELD_PROPERTY) ? SCANNER_PRIVATE_FIELD_PROPERTY_GETTER_SETTER\n                                             : (opts & SCANNER_PRIVATE_FIELD_GETTER_SETTER));\n\n  while (iter != NULL)\n  {\n    if (lexer_compare_identifiers (context_p, &context_p->token.lit_location, &iter->loc)\n        && (iter->u8_arg & search_flag))\n    {\n      scanner_raise_error (context_p);\n    }\n\n    iter = iter->prev_p;\n  }\n\n  scanner_class_private_member_t *p_member;\n  p_member = (scanner_class_private_member_t *) scanner_malloc (context_p, sizeof (scanner_class_private_member_t));\n  p_member->loc = context_p->token.lit_location;\n  p_member->u8_arg = (uint8_t) opts;\n  p_member->prev_p = class_info_p->members;\n  class_info_p->members = p_member;\n\n  parser_stack_push (context_p, &class_info_p, sizeof (scanner_class_info_t *));\n  parser_stack_push_uint8 (context_p, (uint8_t) stack_top);\n} /* scanner_add_private_identifier */\n\n/**\n * Check whether an eval call is performed and update the status flags accordingly.\n */\nvoid\nscanner_detect_eval_call (parser_context_t *context_p, /**< context */\n                          scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  if (context_p->token.keyword_type == LEXER_KEYW_EVAL && lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))\n  {\n    scanner_context_p->active_literal_pool_p->status_flags |=\n      (SCANNER_LITERAL_POOL_CAN_EVAL | SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE);\n  }\n} /* scanner_detect_eval_call */\n\n/**\n * Throws an error for invalid var statements.\n */\nvoid\nscanner_detect_invalid_var (parser_context_t *context_p, /**< context */\n                            scanner_context_t *scanner_context_p, /**< scanner context */\n                            lexer_lit_location_t *var_literal_p) /**< var literal */\n{\n  if (var_literal_p->type & SCANNER_LITERAL_IS_LOCAL\n      && !(var_literal_p->type & (SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_ARG))\n      && (var_literal_p->type & SCANNER_LITERAL_IS_LOCAL) != SCANNER_LITERAL_IS_LOCAL)\n  {\n    scanner_raise_redeclaration_error (context_p);\n  }\n\n  scanner_literal_pool_t *literal_pool_p = scanner_context_p->active_literal_pool_p;\n\n  if (!(literal_pool_p->status_flags & SCANNER_LITERAL_POOL_FUNCTION)\n      && ((var_literal_p->type & SCANNER_LITERAL_IS_LOCAL_FUNC) == SCANNER_LITERAL_IS_LOCAL_FUNC))\n  {\n    scanner_raise_redeclaration_error (context_p);\n  }\n\n  const uint8_t *char_p = var_literal_p->char_p;\n  prop_length_t length = var_literal_p->length;\n\n  while (!(literal_pool_p->status_flags & SCANNER_LITERAL_POOL_FUNCTION))\n  {\n    literal_pool_p = literal_pool_p->prev_p;\n\n    parser_list_iterator_t literal_iterator;\n    parser_list_iterator_init (&literal_pool_p->literal_pool, &literal_iterator);\n    lexer_lit_location_t *literal_p;\n\n    if (JERRY_LIKELY (!(context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)))\n    {\n      while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n      {\n        if ((literal_p->type & SCANNER_LITERAL_IS_LOCAL) && !(literal_p->type & SCANNER_LITERAL_IS_ARG)\n            && !((literal_p->type & SCANNER_LITERAL_IS_FUNC)\n                 && (literal_pool_p->status_flags & SCANNER_LITERAL_POOL_FUNCTION))\n            && (literal_p->type & SCANNER_LITERAL_IS_LOCAL) != SCANNER_LITERAL_IS_LOCAL && literal_p->length == length)\n        {\n          if (JERRY_LIKELY (!(literal_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)))\n          {\n            if (memcmp (literal_p->char_p, char_p, length) == 0)\n            {\n              scanner_raise_redeclaration_error (context_p);\n              return;\n            }\n          }\n          else if (lexer_compare_identifier_to_string (literal_p, char_p, length))\n          {\n            scanner_raise_redeclaration_error (context_p);\n            return;\n          }\n        }\n      }\n    }\n    else\n    {\n      while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n      {\n        if ((literal_p->type & SCANNER_LITERAL_IS_LOCAL) && !(literal_p->type & SCANNER_LITERAL_IS_ARG)\n            && !((literal_p->type & SCANNER_LITERAL_IS_FUNC)\n                 && (literal_pool_p->status_flags & SCANNER_LITERAL_POOL_FUNCTION))\n            && (literal_p->type & SCANNER_LITERAL_IS_LOCAL) != SCANNER_LITERAL_IS_LOCAL\n            && lexer_compare_identifiers (context_p, literal_p, var_literal_p))\n        {\n          scanner_raise_redeclaration_error (context_p);\n          return;\n        }\n      }\n    }\n  }\n\n  if (scanner_scope_find_lexical_declaration (context_p, var_literal_p))\n  {\n    scanner_raise_redeclaration_error (context_p);\n  }\n} /* scanner_detect_invalid_var */\n\n/**\n * Throws an error for invalid let statements.\n */\nvoid\nscanner_detect_invalid_let (parser_context_t *context_p, /**< context */\n                            lexer_lit_location_t *let_literal_p) /**< let literal */\n{\n  if (let_literal_p->type & (SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_VAR | SCANNER_LITERAL_IS_LOCAL))\n  {\n    scanner_raise_redeclaration_error (context_p);\n  }\n\n  if (let_literal_p->type & SCANNER_LITERAL_IS_FUNC)\n  {\n    let_literal_p->type &= (uint8_t) ~SCANNER_LITERAL_IS_FUNC;\n  }\n} /* scanner_detect_invalid_let */\n\n/**\n * Push the values required for class declaration parsing.\n *\n * @return literal reference created for class statements, NULL otherwise\n */\nlexer_lit_location_t *\nscanner_push_class_declaration (parser_context_t *context_p, /**< context */\n                                scanner_context_t *scanner_context_p, /* scanner context */\n                                uint8_t stack_mode) /**< stack mode */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_KEYW_CLASS);\n\n  const uint8_t *source_p = context_p->source_p;\n  lexer_lit_location_t *literal_p = NULL;\n\n#if JERRY_MODULE_SYSTEM\n  bool is_export_default = context_p->stack_top_uint8 == SCAN_STACK_EXPORT_DEFAULT;\n  JERRY_ASSERT (!is_export_default || stack_mode == SCAN_STACK_CLASS_EXPRESSION);\n#endif /* JERRY_MODULE_SYSTEM */\n\n  parser_stack_push_uint8 (context_p, stack_mode);\n  lexer_next_token (context_p);\n\n  bool class_has_name =\n    (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n  if (class_has_name)\n  {\n    literal_p = scanner_add_literal (context_p, scanner_context_p);\n    scanner_context_p->active_literal_pool_p->no_declarations++;\n\n#if JERRY_MODULE_SYSTEM\n    if (is_export_default)\n    {\n      scanner_detect_invalid_let (context_p, literal_p);\n\n      if (literal_p->type & SCANNER_LITERAL_IS_USED)\n      {\n        literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;\n      }\n\n      literal_p->type |= SCANNER_LITERAL_IS_LET | SCANNER_LITERAL_NO_REG;\n    }\n#endif /* JERRY_MODULE_SYSTEM */\n  }\n\n  scanner_literal_pool_t *literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, 0);\n\n  if (class_has_name)\n  {\n    scanner_add_literal (context_p, scanner_context_p);\n    scanner_context_p->active_literal_pool_p->no_declarations++;\n  }\n#if JERRY_MODULE_SYSTEM\n  else if (is_export_default)\n  {\n    lexer_lit_location_t *name_literal_p;\n    name_literal_p =\n      scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p->prev_p, &lexer_default_literal);\n\n    name_literal_p->type |= SCANNER_LITERAL_IS_LET | SCANNER_LITERAL_NO_REG;\n    scanner_context_p->active_literal_pool_p->no_declarations++;\n  }\n#endif /* JERRY_MODULE_SYSTEM */\n\n  literal_pool_p->source_p = source_p;\n  literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_CLASS_NAME;\n\n  const uint8_t *class_source_p = scanner_context_p->active_literal_pool_p->source_p;\n  scanner_class_info_t *class_info_p =\n    (scanner_class_info_t *) scanner_insert_info (context_p, class_source_p, sizeof (scanner_class_info_t));\n\n  class_info_p->info.type = SCANNER_TYPE_CLASS_CONSTRUCTOR;\n  class_info_p->members = NULL;\n  class_info_p->info.u8_arg = SCANNER_CONSTRUCTOR_IMPLICIT;\n\n  parser_stack_push (context_p, &class_info_p, sizeof (scanner_class_info_t *));\n  parser_stack_push_uint8 (context_p, SCAN_STACK_IMPLICIT_CLASS_CONSTRUCTOR);\n  scanner_context_p->mode = SCAN_MODE_CLASS_DECLARATION;\n\n  return literal_p;\n} /* scanner_push_class_declaration */\n\n/**\n * Push the start of a class field initializer.\n */\nvoid\nscanner_push_class_field_initializer (parser_context_t *context_p, /**< context */\n                                      scanner_context_t *scanner_context_p) /* scanner context */\n{\n  scanner_source_start_t source_start;\n  source_start.source_p = context_p->source_p;\n\n  parser_stack_push (context_p, &source_start, sizeof (scanner_source_start_t));\n  parser_stack_push_uint8 (context_p, SCAN_STACK_CLASS_FIELD_INITIALIZER);\n\n  scanner_literal_pool_t *literal_pool_p;\n  literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, SCANNER_LITERAL_POOL_CLASS_FIELD);\n  literal_pool_p->source_p = context_p->source_p;\n\n  scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n} /* scanner_push_class_field_initializer */\n\n/**\n * Push the values required for destructuring assignment or binding parsing.\n */\nvoid\nscanner_push_destructuring_pattern (parser_context_t *context_p, /**< context */\n                                    scanner_context_t *scanner_context_p, /**< scanner context */\n                                    uint8_t binding_type, /**< type of destructuring binding pattern */\n                                    bool is_nested) /**< nested declaration */\n{\n  JERRY_ASSERT (binding_type != SCANNER_BINDING_NONE || !is_nested);\n\n  scanner_source_start_t source_start;\n  source_start.source_p = context_p->source_p;\n\n  parser_stack_push (context_p, &source_start, sizeof (scanner_source_start_t));\n  parser_stack_push_uint8 (context_p, scanner_context_p->binding_type);\n  scanner_context_p->binding_type = binding_type;\n\n  if (SCANNER_NEEDS_BINDING_LIST (binding_type))\n  {\n    scanner_binding_list_t *binding_list_p;\n    binding_list_p = (scanner_binding_list_t *) scanner_malloc (context_p, sizeof (scanner_binding_list_t));\n\n    binding_list_p->prev_p = scanner_context_p->active_binding_list_p;\n    binding_list_p->items_p = NULL;\n    binding_list_p->is_nested = is_nested;\n\n    scanner_context_p->active_binding_list_p = binding_list_p;\n  }\n} /* scanner_push_destructuring_pattern */\n\n/**\n * Pop binding list.\n */\nvoid\nscanner_pop_binding_list (scanner_context_t *scanner_context_p) /**< scanner context */\n{\n  scanner_binding_list_t *binding_list_p = scanner_context_p->active_binding_list_p;\n  JERRY_ASSERT (binding_list_p != NULL);\n\n  scanner_binding_item_t *item_p = binding_list_p->items_p;\n  scanner_binding_list_t *prev_binding_list_p = binding_list_p->prev_p;\n  bool is_nested = binding_list_p->is_nested;\n\n  scanner_free (binding_list_p, sizeof (scanner_binding_list_t));\n  scanner_context_p->active_binding_list_p = prev_binding_list_p;\n\n  if (!is_nested)\n  {\n    while (item_p != NULL)\n    {\n      scanner_binding_item_t *next_p = item_p->next_p;\n\n      JERRY_ASSERT (item_p->literal_p->type & (SCANNER_LITERAL_IS_LOCAL | SCANNER_LITERAL_IS_ARG));\n\n      scanner_free (item_p, sizeof (scanner_binding_item_t));\n      item_p = next_p;\n    }\n    return;\n  }\n\n  JERRY_ASSERT (prev_binding_list_p != NULL);\n\n  while (item_p != NULL)\n  {\n    scanner_binding_item_t *next_p = item_p->next_p;\n\n    item_p->next_p = prev_binding_list_p->items_p;\n    prev_binding_list_p->items_p = item_p;\n\n    item_p = next_p;\n  }\n} /* scanner_pop_binding_list */\n\n/**\n * Append a hole into the literal pool.\n */\nvoid\nscanner_append_hole (parser_context_t *context_p, scanner_context_t *scanner_context_p)\n{\n  scanner_literal_pool_t *literal_pool_p = scanner_context_p->active_literal_pool_p;\n\n  lexer_lit_location_t *literal_p;\n  literal_p = (lexer_lit_location_t *) parser_list_append (context_p, &literal_pool_p->literal_pool);\n\n  literal_p->char_p = NULL;\n  literal_p->length = 0;\n  literal_p->type = SCANNER_LITERAL_IS_ARG;\n  literal_p->status_flags = LEXER_LIT_LOCATION_NO_OPTS;\n} /* scanner_append_hole */\n\n/**\n * Reverse the scanner info chain after the scanning is completed.\n */\nvoid\nscanner_reverse_info_list (parser_context_t *context_p) /**< context */\n{\n  scanner_info_t *scanner_info_p = context_p->next_scanner_info_p;\n  scanner_info_t *last_scanner_info_p = NULL;\n\n  if (scanner_info_p->type == SCANNER_TYPE_END)\n  {\n    return;\n  }\n\n  do\n  {\n    scanner_info_t *next_scanner_info_p = scanner_info_p->next_p;\n    scanner_info_p->next_p = last_scanner_info_p;\n\n    last_scanner_info_p = scanner_info_p;\n    scanner_info_p = next_scanner_info_p;\n  } while (scanner_info_p->type != SCANNER_TYPE_END);\n\n  context_p->next_scanner_info_p->next_p = scanner_info_p;\n  context_p->next_scanner_info_p = last_scanner_info_p;\n} /* scanner_reverse_info_list */\n\n/**\n * Release unused scanner info blocks.\n * This should happen only if an error is occurred.\n */\nvoid\nscanner_cleanup (parser_context_t *context_p) /**< context */\n{\n  if (context_p->skipped_scanner_info_p != NULL)\n  {\n    context_p->skipped_scanner_info_end_p->next_p = context_p->next_scanner_info_p;\n    context_p->next_scanner_info_p = context_p->skipped_scanner_info_p;\n    context_p->skipped_scanner_info_p = NULL;\n  }\n\n  scanner_info_t *scanner_info_p = context_p->next_scanner_info_p;\n\n  while (scanner_info_p != NULL)\n  {\n    scanner_info_t *next_scanner_info_p = scanner_info_p->next_p;\n\n    size_t size = sizeof (scanner_info_t);\n\n    switch (scanner_info_p->type)\n    {\n      case SCANNER_TYPE_END:\n      {\n        scanner_info_p = context_p->active_scanner_info_p;\n        continue;\n      }\n      case SCANNER_TYPE_FUNCTION:\n      case SCANNER_TYPE_BLOCK:\n      {\n        size = scanner_get_stream_size (scanner_info_p, sizeof (scanner_info_t));\n        break;\n      }\n      case SCANNER_TYPE_WHILE:\n      case SCANNER_TYPE_FOR_IN:\n      case SCANNER_TYPE_FOR_OF:\n      case SCANNER_TYPE_CASE:\n      case SCANNER_TYPE_INITIALIZER:\n      case SCANNER_TYPE_CLASS_FIELD_INITIALIZER_END:\n      case SCANNER_TYPE_CLASS_STATIC_BLOCK_END:\n      {\n        size = sizeof (scanner_location_info_t);\n        break;\n      }\n      case SCANNER_TYPE_FOR:\n      {\n        size = sizeof (scanner_for_info_t);\n        break;\n      }\n      case SCANNER_TYPE_SWITCH:\n      {\n        scanner_release_switch_cases (((scanner_switch_info_t *) scanner_info_p)->case_p);\n        size = sizeof (scanner_switch_info_t);\n        break;\n      }\n      case SCANNER_TYPE_CLASS_CONSTRUCTOR:\n      {\n        scanner_release_private_fields (((scanner_class_info_t *) scanner_info_p)->members);\n        size = sizeof (scanner_class_info_t);\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (\n          scanner_info_p->type == SCANNER_TYPE_END_ARGUMENTS || scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS\n          || scanner_info_p->type == SCANNER_TYPE_LET_EXPRESSION || scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED\n          || scanner_info_p->type == SCANNER_TYPE_ERR_ASYNC_FUNCTION\n          || scanner_info_p->type == SCANNER_TYPE_EXPORT_MODULE_SPECIFIER);\n        break;\n      }\n    }\n\n    scanner_free (scanner_info_p, size);\n    scanner_info_p = next_scanner_info_p;\n  }\n\n  context_p->next_scanner_info_p = NULL;\n  context_p->active_scanner_info_p = NULL;\n} /* scanner_cleanup */\n\n/**\n * Checks whether a context needs to be created for a block.\n *\n * @return true - if context is needed,\n *         false - otherwise\n */\nbool\nscanner_is_context_needed (parser_context_t *context_p, /**< context */\n                           parser_check_context_type_t check_type) /**< context type */\n{\n  scanner_info_t *info_p = context_p->next_scanner_info_p;\n  const uint8_t *data_p = (const uint8_t *) (info_p + 1);\n\n  JERRY_UNUSED (check_type);\n\n  JERRY_ASSERT ((check_type == PARSER_CHECK_BLOCK_CONTEXT ? info_p->type == SCANNER_TYPE_BLOCK\n                                                          : info_p->type == SCANNER_TYPE_FUNCTION));\n\n  uint32_t scope_stack_reg_top =\n    (check_type != PARSER_CHECK_GLOBAL_CONTEXT ? context_p->scope_stack_reg_top : 1); /* block result */\n\n  while (data_p[0] != SCANNER_STREAM_TYPE_END)\n  {\n    uint8_t data = data_p[0];\n    uint32_t type = data & SCANNER_STREAM_TYPE_MASK;\n\n    if (JERRY_UNLIKELY (check_type == PARSER_CHECK_FUNCTION_CONTEXT))\n    {\n      if (JERRY_UNLIKELY (type == SCANNER_STREAM_TYPE_HOLE))\n      {\n        data_p++;\n        continue;\n      }\n\n      if (JERRY_UNLIKELY (SCANNER_STREAM_TYPE_IS_ARGUMENTS (type)))\n      {\n        if ((data & SCANNER_STREAM_NO_REG) || scope_stack_reg_top >= PARSER_MAXIMUM_NUMBER_OF_REGISTERS)\n        {\n          return true;\n        }\n\n        scope_stack_reg_top++;\n        data_p++;\n        continue;\n      }\n    }\n\n#ifndef JERRY_NDEBUG\n    if (check_type == PARSER_CHECK_BLOCK_CONTEXT)\n    {\n      JERRY_ASSERT (type == SCANNER_STREAM_TYPE_VAR || type == SCANNER_STREAM_TYPE_LET\n                    || type == SCANNER_STREAM_TYPE_CONST || type == SCANNER_STREAM_TYPE_LOCAL\n                    || type == SCANNER_STREAM_TYPE_FUNC);\n    }\n    else if (check_type == PARSER_CHECK_GLOBAL_CONTEXT)\n    {\n#if JERRY_MODULE_SYSTEM\n      const bool is_import = (type == SCANNER_STREAM_TYPE_IMPORT);\n#else /* !JERRY_MODULE_SYSTEM */\n      const bool is_import = true;\n#endif /* JERRY_MODULE_SYSTEM */\n\n      /* FIXME: a private declarative lexical environment should always be present\n       * for modules. Remove SCANNER_STREAM_TYPE_IMPORT after it is implemented. */\n      JERRY_ASSERT (type == SCANNER_STREAM_TYPE_VAR || type == SCANNER_STREAM_TYPE_LET\n                    || type == SCANNER_STREAM_TYPE_CONST || type == SCANNER_STREAM_TYPE_FUNC || is_import);\n\n      /* Only let/const can be stored in registers */\n      JERRY_ASSERT ((data & SCANNER_STREAM_NO_REG)\n                    || (type == SCANNER_STREAM_TYPE_FUNC && (context_p->global_status_flags & ECMA_PARSE_DIRECT_EVAL))\n                    || type == SCANNER_STREAM_TYPE_LET || type == SCANNER_STREAM_TYPE_CONST);\n    }\n    else\n    {\n      JERRY_ASSERT (check_type == PARSER_CHECK_FUNCTION_CONTEXT);\n\n      JERRY_ASSERT (type == SCANNER_STREAM_TYPE_VAR || type == SCANNER_STREAM_TYPE_LET\n                    || type == SCANNER_STREAM_TYPE_CONST || type == SCANNER_STREAM_TYPE_LOCAL\n                    || type == SCANNER_STREAM_TYPE_ARG || type == SCANNER_STREAM_TYPE_ARG_VAR\n                    || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR\n                    || type == SCANNER_STREAM_TYPE_ARG_FUNC || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC\n                    || type == SCANNER_STREAM_TYPE_FUNC);\n    }\n#endif /* !JERRY_NDEBUG */\n    if (!(data & SCANNER_STREAM_UINT16_DIFF))\n    {\n      if (data_p[2] != 0)\n      {\n        data_p += 2 + 1;\n      }\n      else\n      {\n        data_p += 2 + 1 + sizeof (const uint8_t *);\n      }\n    }\n    else\n    {\n      data_p += 2 + 2;\n    }\n\n#if JERRY_MODULE_SYSTEM\n    const bool is_import = (type == SCANNER_STREAM_TYPE_IMPORT);\n#else /* !JERRY_MODULE_SYSTEM */\n    const bool is_import = false;\n#endif /* JERRY_MODULE_SYSTEM */\n\n    if (JERRY_UNLIKELY (check_type == PARSER_CHECK_GLOBAL_CONTEXT)\n        && (type == SCANNER_STREAM_TYPE_VAR\n            || (type == SCANNER_STREAM_TYPE_FUNC && !(context_p->global_status_flags & ECMA_PARSE_EVAL)) || is_import))\n    {\n      continue;\n    }\n\n    if (JERRY_UNLIKELY (check_type == PARSER_CHECK_FUNCTION_CONTEXT))\n    {\n      if (SCANNER_STREAM_TYPE_IS_ARG_FUNC (type) || type == SCANNER_STREAM_TYPE_ARG_VAR\n          || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR)\n      {\n        /* The return value is true, if the variable is stored in the lexical environment\n         * or all registers have already been used for function arguments. This can be\n         * inprecise in the latter case, but this is a very rare corner case. A more\n         * sophisticated check would require to decode the literal. */\n        if ((data & SCANNER_STREAM_NO_REG) || scope_stack_reg_top >= PARSER_MAXIMUM_NUMBER_OF_REGISTERS)\n        {\n          return true;\n        }\n        continue;\n      }\n\n      if (SCANNER_STREAM_TYPE_IS_ARG (type))\n      {\n        continue;\n      }\n    }\n\n    if ((data & SCANNER_STREAM_NO_REG) || scope_stack_reg_top >= PARSER_MAXIMUM_NUMBER_OF_REGISTERS)\n    {\n      return true;\n    }\n\n    scope_stack_reg_top++;\n  }\n\n  return false;\n} /* scanner_is_context_needed */\n\n/**\n * Try to scan/parse the \".target\" part in the \"new.target\" expression.\n *\n * Upon exiting with \"true\" the current token will point to the \"target\"\n * literal.\n *\n * If the \"target\" literal is not after the \"new.\" then a scanner/parser\n * error will be raised.\n *\n * @returns true if the \".target\" part was found\n *          false if there is no \".\" after the new.\n */\nbool\nscanner_try_scan_new_target (parser_context_t *context_p) /**< parser/scanner context */\n{\n  JERRY_ASSERT (context_p->token.type == LEXER_KEYW_NEW);\n\n  if (lexer_check_next_character (context_p, LIT_CHAR_DOT))\n  {\n    lexer_next_token (context_p);\n    if (context_p->token.type != LEXER_DOT)\n    {\n      parser_raise_error (context_p, PARSER_ERR_INVALID_CHARACTER);\n    }\n\n    lexer_next_token (context_p);\n    if (!lexer_token_is_identifier (context_p, \"target\", 6))\n    {\n      parser_raise_error (context_p, PARSER_ERR_NEW_TARGET_EXPECTED);\n    }\n\n    return true;\n  }\n  return false;\n} /* scanner_try_scan_new_target */\n\n/**\n * Description of \"arguments\" literal string.\n */\nconst lexer_lit_location_t lexer_arguments_literal = { (const uint8_t *) \"arguments\",\n                                                       9,\n                                                       LEXER_IDENT_LITERAL,\n                                                       LEXER_LIT_LOCATION_IS_ASCII };\n\n/**\n * Create an unused literal.\n */\nstatic void\nscanner_create_unused_literal (parser_context_t *context_p, /**< context */\n                               uint8_t status_flags) /**< initial status flags */\n{\n  if (JERRY_UNLIKELY (context_p->literal_count >= PARSER_MAXIMUM_NUMBER_OF_LITERALS))\n  {\n    parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);\n  }\n\n  lexer_literal_t *literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);\n\n  literal_p->type = LEXER_UNUSED_LITERAL;\n  literal_p->status_flags = status_flags;\n\n  context_p->literal_count++;\n} /* scanner_create_unused_literal */\n\n/**\n * Emit checks for redeclared bindings in the global lexical scope.\n */\nvoid\nscanner_check_variables (parser_context_t *context_p) /**< context */\n{\n  scanner_info_t *info_p = context_p->next_scanner_info_p;\n  const uint8_t *next_data_p = (const uint8_t *) (info_p + 1);\n  lexer_lit_location_t literal;\n\n  JERRY_ASSERT (info_p->type == SCANNER_TYPE_FUNCTION);\n\n  literal.char_p = info_p->source_p - 1;\n\n  while (next_data_p[0] != SCANNER_STREAM_TYPE_END)\n  {\n    uint32_t type = next_data_p[0] & SCANNER_STREAM_TYPE_MASK;\n    const uint8_t *data_p = next_data_p;\n\n    JERRY_ASSERT (type != SCANNER_STREAM_TYPE_HOLE && !SCANNER_STREAM_TYPE_IS_ARG (type)\n                  && !SCANNER_STREAM_TYPE_IS_ARG_FUNC (type));\n    JERRY_ASSERT (data_p[0] & SCANNER_STREAM_NO_REG);\n\n    if (!(data_p[0] & SCANNER_STREAM_UINT16_DIFF))\n    {\n      if (data_p[2] != 0)\n      {\n        literal.char_p += data_p[2];\n        next_data_p += 2 + 1;\n      }\n      else\n      {\n        memcpy (&literal.char_p, data_p + 2 + 1, sizeof (uintptr_t));\n        next_data_p += 2 + 1 + sizeof (uintptr_t);\n      }\n    }\n    else\n    {\n      int32_t diff = ((int32_t) data_p[2]) | ((int32_t) data_p[3]) << 8;\n\n      if (diff <= (intptr_t) UINT8_MAX)\n      {\n        diff = -diff;\n      }\n\n      literal.char_p += diff;\n      next_data_p += 2 + 2;\n    }\n\n    literal.length = data_p[1];\n    literal.type = LEXER_IDENT_LITERAL;\n    literal.status_flags =\n      ((data_p[0] & SCANNER_STREAM_HAS_ESCAPE) ? LEXER_LIT_LOCATION_HAS_ESCAPE : LEXER_LIT_LOCATION_NO_OPTS);\n\n    lexer_construct_literal_object (context_p, &literal, LEXER_NEW_IDENT_LITERAL);\n    literal.char_p += data_p[1];\n\n#if JERRY_MODULE_SYSTEM\n    if (type == SCANNER_STREAM_TYPE_IMPORT)\n    {\n      continue;\n    }\n#endif /* JERRY_MODULE_SYSTEM */\n\n    context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_USED;\n\n    uint16_t opcode;\n    if (type == SCANNER_STREAM_TYPE_VAR || type == SCANNER_STREAM_TYPE_FUNC)\n    {\n      opcode = CBC_CHECK_VAR;\n    }\n    else\n    {\n      opcode = CBC_CHECK_LET;\n    }\n\n    parser_emit_cbc_literal (context_p, opcode, context_p->lit_object.index);\n  }\n\n  parser_flush_cbc (context_p);\n} /* scanner_check_variables */\n\n/**\n * Create and/or initialize var/let/const/function/etc. variables.\n */\nvoid\nscanner_create_variables (parser_context_t *context_p, /**< context */\n                          uint32_t option_flags) /**< combination of scanner_create_variables_flags_t bits */\n{\n  scanner_info_t *info_p = context_p->next_scanner_info_p;\n  const uint8_t *next_data_p = (const uint8_t *) (info_p + 1);\n  uint8_t info_type = info_p->type;\n  uint8_t info_u8_arg = info_p->u8_arg;\n  lexer_lit_location_t literal;\n  parser_scope_stack_t *scope_stack_p;\n  parser_scope_stack_t *scope_stack_end_p;\n\n  JERRY_ASSERT (info_type == SCANNER_TYPE_FUNCTION || info_type == SCANNER_TYPE_BLOCK);\n  JERRY_ASSERT (!(option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_ARGS)\n                || !(option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_BODY));\n  JERRY_ASSERT (info_type == SCANNER_TYPE_FUNCTION\n                || !(option_flags & (SCANNER_CREATE_VARS_IS_FUNCTION_ARGS | SCANNER_CREATE_VARS_IS_FUNCTION_BODY)));\n\n  uint32_t scope_stack_reg_top = context_p->scope_stack_reg_top;\n\n  if (info_type == SCANNER_TYPE_FUNCTION && !(option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_BODY))\n  {\n    JERRY_ASSERT (context_p->scope_stack_p == NULL);\n\n    size_t stack_size = info_p->u16_arg * sizeof (parser_scope_stack_t);\n    context_p->scope_stack_size = info_p->u16_arg;\n\n    scope_stack_p = NULL;\n\n    if (stack_size > 0)\n    {\n      scope_stack_p = (parser_scope_stack_t *) parser_malloc (context_p, stack_size);\n    }\n\n    context_p->scope_stack_p = scope_stack_p;\n    scope_stack_end_p = scope_stack_p + context_p->scope_stack_size;\n\n    if (option_flags & (SCANNER_CREATE_VARS_IS_SCRIPT | SCANNER_CREATE_VARS_IS_MODULE))\n    {\n      scope_stack_reg_top++; /* block result */\n    }\n  }\n  else\n  {\n    JERRY_ASSERT (context_p->scope_stack_p != NULL || context_p->scope_stack_size == 0);\n\n    scope_stack_p = context_p->scope_stack_p;\n    scope_stack_end_p = scope_stack_p + context_p->scope_stack_size;\n    scope_stack_p += context_p->scope_stack_top;\n  }\n\n  literal.char_p = info_p->source_p - 1;\n\n  while (next_data_p[0] != SCANNER_STREAM_TYPE_END)\n  {\n    uint32_t type = next_data_p[0] & SCANNER_STREAM_TYPE_MASK;\n    const uint8_t *data_p = next_data_p;\n\n    JERRY_ASSERT ((option_flags & (SCANNER_CREATE_VARS_IS_FUNCTION_BODY | SCANNER_CREATE_VARS_IS_FUNCTION_ARGS))\n                  || (type != SCANNER_STREAM_TYPE_HOLE && !SCANNER_STREAM_TYPE_IS_ARG (type)\n                      && !SCANNER_STREAM_TYPE_IS_ARG_FUNC (type)));\n\n#if JERRY_MODULE_SYSTEM\n    JERRY_ASSERT (type != SCANNER_STREAM_TYPE_IMPORT || (data_p[0] & SCANNER_STREAM_NO_REG));\n#endif /* JERRY_MODULE_SYSTEM */\n\n    if (JERRY_UNLIKELY (type == SCANNER_STREAM_TYPE_HOLE))\n    {\n      JERRY_ASSERT (info_type == SCANNER_TYPE_FUNCTION);\n      next_data_p++;\n\n      if (option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_BODY)\n      {\n        continue;\n      }\n\n      uint8_t mask = SCANNER_FUNCTION_ARGUMENTS_NEEDED | SCANNER_FUNCTION_HAS_COMPLEX_ARGUMENT;\n\n      if (!(context_p->status_flags & PARSER_IS_STRICT) && (info_u8_arg & mask) == SCANNER_FUNCTION_ARGUMENTS_NEEDED)\n      {\n        scanner_create_unused_literal (context_p, LEXER_FLAG_FUNCTION_ARGUMENT);\n      }\n\n      if (scope_stack_reg_top < PARSER_MAXIMUM_NUMBER_OF_REGISTERS)\n      {\n        scope_stack_reg_top++;\n      }\n      continue;\n    }\n\n    if (JERRY_UNLIKELY (SCANNER_STREAM_TYPE_IS_ARGUMENTS (type)))\n    {\n      JERRY_ASSERT (info_type == SCANNER_TYPE_FUNCTION);\n      next_data_p++;\n\n      if (option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_BODY)\n      {\n        continue;\n      }\n\n      context_p->status_flags |= PARSER_ARGUMENTS_NEEDED;\n\n      if (JERRY_UNLIKELY (scope_stack_p >= scope_stack_end_p))\n      {\n        JERRY_ASSERT (context_p->scope_stack_size == PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK);\n        parser_raise_error (context_p, PARSER_ERR_SCOPE_STACK_LIMIT_REACHED);\n      }\n\n      lexer_construct_literal_object (context_p, &lexer_arguments_literal, LEXER_NEW_IDENT_LITERAL);\n      scope_stack_p->map_from = context_p->lit_object.index;\n\n      uint16_t map_to;\n\n      if (!(data_p[0] & SCANNER_STREAM_NO_REG) && scope_stack_reg_top < PARSER_MAXIMUM_NUMBER_OF_REGISTERS)\n      {\n        map_to = (uint16_t) (PARSER_REGISTER_START + scope_stack_reg_top);\n\n        scope_stack_p->map_to = (uint16_t) (scope_stack_reg_top + 1);\n        scope_stack_reg_top++;\n      }\n      else\n      {\n        context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_USED;\n        map_to = context_p->lit_object.index;\n\n        context_p->status_flags |= PARSER_LEXICAL_ENV_NEEDED;\n\n        if (data_p[0] & SCANNER_STREAM_LOCAL_ARGUMENTS)\n        {\n          context_p->status_flags |= PARSER_LEXICAL_BLOCK_NEEDED;\n        }\n\n        scope_stack_p->map_to = 0;\n      }\n\n      scope_stack_p++;\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n      context_p->scope_stack_top = (uint16_t) (scope_stack_p - context_p->scope_stack_p);\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n      parser_emit_cbc_ext_literal (context_p, CBC_EXT_CREATE_ARGUMENTS, map_to);\n\n      if (type == SCANNER_STREAM_TYPE_ARGUMENTS_FUNC)\n      {\n        if (JERRY_UNLIKELY (scope_stack_p >= scope_stack_end_p))\n        {\n          JERRY_ASSERT (context_p->scope_stack_size == PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK);\n          parser_raise_error (context_p, PARSER_ERR_SCOPE_STACK_LIMIT_REACHED);\n        }\n\n        scope_stack_p->map_from = PARSER_SCOPE_STACK_FUNC;\n        scope_stack_p->map_to = context_p->literal_count;\n        scope_stack_p++;\n\n        scanner_create_unused_literal (context_p, 0);\n      }\n\n      if (option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_ARGS)\n      {\n        break;\n      }\n      continue;\n    }\n\n    JERRY_ASSERT (context_p->scope_stack_size != 0);\n\n    if (!(data_p[0] & SCANNER_STREAM_UINT16_DIFF))\n    {\n      if (data_p[2] != 0)\n      {\n        literal.char_p += data_p[2];\n        next_data_p += 2 + 1;\n      }\n      else\n      {\n        memcpy (&literal.char_p, data_p + 2 + 1, sizeof (uintptr_t));\n        next_data_p += 2 + 1 + sizeof (uintptr_t);\n      }\n    }\n    else\n    {\n      int32_t diff = ((int32_t) data_p[2]) | ((int32_t) data_p[3]) << 8;\n\n      if (diff <= (intptr_t) UINT8_MAX)\n      {\n        diff = -diff;\n      }\n\n      literal.char_p += diff;\n      next_data_p += 2 + 2;\n    }\n\n    if (SCANNER_STREAM_TYPE_IS_ARG (type))\n    {\n      if (option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_BODY)\n      {\n        if ((context_p->status_flags & PARSER_LEXICAL_BLOCK_NEEDED)\n            && (type == SCANNER_STREAM_TYPE_ARG_VAR || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR))\n        {\n          literal.length = data_p[1];\n          literal.type = LEXER_IDENT_LITERAL;\n          literal.status_flags =\n            ((data_p[0] & SCANNER_STREAM_HAS_ESCAPE) ? LEXER_LIT_LOCATION_HAS_ESCAPE : LEXER_LIT_LOCATION_NO_OPTS);\n\n          /* Literal must be exists. */\n          lexer_construct_literal_object (context_p, &literal, LEXER_IDENT_LITERAL);\n\n          if (context_p->lit_object.index < PARSER_REGISTER_START)\n          {\n            parser_emit_cbc_ext_literal_from_token (context_p, CBC_EXT_COPY_FROM_ARG);\n          }\n        }\n\n        literal.char_p += data_p[1];\n        continue;\n      }\n    }\n    else if ((option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_ARGS) && !SCANNER_STREAM_TYPE_IS_ARG_FUNC (type))\n    {\n      /* Function arguments must come first. */\n      break;\n    }\n\n    literal.length = data_p[1];\n    literal.type = LEXER_IDENT_LITERAL;\n    literal.status_flags =\n      ((data_p[0] & SCANNER_STREAM_HAS_ESCAPE) ? LEXER_LIT_LOCATION_HAS_ESCAPE : LEXER_LIT_LOCATION_NO_OPTS);\n\n    lexer_construct_literal_object (context_p, &literal, LEXER_NEW_IDENT_LITERAL);\n    literal.char_p += data_p[1];\n\n    if (SCANNER_STREAM_TYPE_IS_ARG_FUNC (type) && (option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_BODY))\n    {\n      JERRY_ASSERT (scope_stack_p >= context_p->scope_stack_p + 2);\n      JERRY_ASSERT (context_p->status_flags & PARSER_IS_FUNCTION);\n      JERRY_ASSERT (!(context_p->status_flags & PARSER_FUNCTION_IS_PARSING_ARGS));\n\n      parser_scope_stack_t *function_map_p = scope_stack_p - 2;\n      uint16_t literal_index = context_p->lit_object.index;\n\n      while (literal_index != function_map_p->map_from)\n      {\n        function_map_p--;\n\n        JERRY_ASSERT (function_map_p >= context_p->scope_stack_p);\n      }\n\n      JERRY_ASSERT (function_map_p[1].map_from == PARSER_SCOPE_STACK_FUNC);\n\n      cbc_opcode_t opcode = CBC_SET_VAR_FUNC;\n\n      if (JERRY_UNLIKELY (context_p->status_flags & PARSER_LEXICAL_BLOCK_NEEDED)\n          && (function_map_p[0].map_to & PARSER_SCOPE_STACK_REGISTER_MASK) == 0)\n      {\n        opcode = CBC_INIT_ARG_OR_FUNC;\n      }\n\n      parser_emit_cbc_literal_value (context_p,\n                                     (uint16_t) opcode,\n                                     function_map_p[1].map_to,\n                                     scanner_decode_map_to (function_map_p));\n      continue;\n    }\n\n    if (JERRY_UNLIKELY (scope_stack_p >= scope_stack_end_p))\n    {\n      JERRY_ASSERT (context_p->scope_stack_size == PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK);\n      parser_raise_error (context_p, PARSER_ERR_SCOPE_STACK_LIMIT_REACHED);\n    }\n\n    scope_stack_p->map_from = context_p->lit_object.index;\n\n    if (info_type == SCANNER_TYPE_FUNCTION)\n    {\n      if (type != SCANNER_STREAM_TYPE_LET\n#if JERRY_MODULE_SYSTEM\n          && type != SCANNER_STREAM_TYPE_IMPORT\n#endif /* JERRY_MODULE_SYSTEM */\n          && type != SCANNER_STREAM_TYPE_CONST)\n      {\n        context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_GLOBAL;\n      }\n    }\n\n    uint16_t map_to;\n    uint16_t func_init_opcode = CBC_INIT_ARG_OR_FUNC;\n\n    if (!(data_p[0] & SCANNER_STREAM_NO_REG) && scope_stack_reg_top < PARSER_MAXIMUM_NUMBER_OF_REGISTERS)\n    {\n      map_to = (uint16_t) (PARSER_REGISTER_START + scope_stack_reg_top);\n      scope_stack_p->map_to = (uint16_t) (scope_stack_reg_top + 1);\n      scope_stack_reg_top++;\n\n      switch (type)\n      {\n        case SCANNER_STREAM_TYPE_CONST:\n        {\n          scope_stack_p->map_to |= PARSER_SCOPE_STACK_IS_CONST_REG;\n          /* FALLTHRU */\n        }\n        case SCANNER_STREAM_TYPE_LET:\n        case SCANNER_STREAM_TYPE_ARG:\n        case SCANNER_STREAM_TYPE_ARG_VAR:\n        case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG:\n        case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR:\n        case SCANNER_STREAM_TYPE_ARG_FUNC:\n        case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC:\n        {\n          scope_stack_p->map_to |= PARSER_SCOPE_STACK_NO_FUNCTION_COPY;\n          break;\n        }\n      }\n\n      func_init_opcode = CBC_SET_VAR_FUNC;\n    }\n    else\n    {\n      context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_USED;\n      map_to = context_p->lit_object.index;\n\n      uint16_t scope_stack_map_to = 0;\n\n      if (info_type == SCANNER_TYPE_FUNCTION)\n      {\n        context_p->status_flags |= PARSER_LEXICAL_ENV_NEEDED;\n      }\n\n      switch (type)\n      {\n        case SCANNER_STREAM_TYPE_LET:\n        case SCANNER_STREAM_TYPE_CONST:\n        case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG:\n        case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR:\n        case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC:\n        {\n          scope_stack_map_to |= PARSER_SCOPE_STACK_NO_FUNCTION_COPY;\n\n          if (!(data_p[0] & SCANNER_STREAM_EARLY_CREATE))\n          {\n            break;\n          }\n          scope_stack_map_to |= PARSER_SCOPE_STACK_IS_LOCAL_CREATED;\n          /* FALLTHRU */\n        }\n        case SCANNER_STREAM_TYPE_LOCAL:\n        case SCANNER_STREAM_TYPE_VAR:\n        {\n#if JERRY_PARSER_DUMP_BYTE_CODE\n          context_p->scope_stack_top = (uint16_t) (scope_stack_p - context_p->scope_stack_p);\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n          uint16_t opcode;\n\n          switch (type)\n          {\n            case SCANNER_STREAM_TYPE_LET:\n            {\n              opcode = CBC_CREATE_LET;\n              break;\n            }\n            case SCANNER_STREAM_TYPE_CONST:\n            {\n              opcode = CBC_CREATE_CONST;\n              break;\n            }\n            case SCANNER_STREAM_TYPE_VAR:\n            {\n              opcode = CBC_CREATE_VAR;\n\n              if (option_flags & SCANNER_CREATE_VARS_IS_SCRIPT)\n              {\n                opcode = CBC_CREATE_VAR_EVAL;\n\n                if ((context_p->global_status_flags & ECMA_PARSE_FUNCTION_CONTEXT)\n                    && !(context_p->status_flags & PARSER_IS_STRICT))\n                {\n                  opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_CREATE_VAR_EVAL);\n                }\n              }\n              break;\n            }\n            default:\n            {\n              JERRY_ASSERT (type == SCANNER_STREAM_TYPE_LOCAL || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG\n                            || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR\n                            || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC);\n\n              opcode = CBC_CREATE_LOCAL;\n              break;\n            }\n          }\n\n          parser_emit_cbc_literal (context_p, opcode, map_to);\n          break;\n        }\n        case SCANNER_STREAM_TYPE_ARG:\n        case SCANNER_STREAM_TYPE_ARG_VAR:\n        case SCANNER_STREAM_TYPE_ARG_FUNC:\n        {\n#if JERRY_PARSER_DUMP_BYTE_CODE\n          context_p->scope_stack_top = (uint16_t) (scope_stack_p - context_p->scope_stack_p);\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n          scope_stack_map_to |= PARSER_SCOPE_STACK_NO_FUNCTION_COPY;\n\n          /* Argument initializers of functions with simple arguments (e.g. function f(a,b,a) {}) are\n           * generated here. The other initializers are handled by parser_parse_function_arguments(). */\n          if (!(info_u8_arg & SCANNER_FUNCTION_HAS_COMPLEX_ARGUMENT))\n          {\n            parser_emit_cbc_literal_value (context_p,\n                                           CBC_INIT_ARG_OR_FUNC,\n                                           (uint16_t) (PARSER_REGISTER_START + scope_stack_reg_top),\n                                           map_to);\n          }\n          else if (data_p[0] & SCANNER_STREAM_EARLY_CREATE)\n          {\n            parser_emit_cbc_literal (context_p, CBC_CREATE_LOCAL, map_to);\n            scope_stack_map_to |= PARSER_SCOPE_STACK_IS_LOCAL_CREATED;\n          }\n\n          if (scope_stack_reg_top < PARSER_MAXIMUM_NUMBER_OF_REGISTERS)\n          {\n            scope_stack_reg_top++;\n          }\n          break;\n        }\n      }\n\n      scope_stack_p->map_to = scope_stack_map_to;\n    }\n\n    scope_stack_p++;\n\n    if (!SCANNER_STREAM_TYPE_IS_FUNCTION (type))\n    {\n      continue;\n    }\n\n    if (JERRY_UNLIKELY (scope_stack_p >= scope_stack_end_p))\n    {\n      JERRY_ASSERT (context_p->scope_stack_size == PARSER_MAXIMUM_DEPTH_OF_SCOPE_STACK);\n      parser_raise_error (context_p, PARSER_ERR_SCOPE_STACK_LIMIT_REACHED);\n    }\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n    context_p->scope_stack_top = (uint16_t) (scope_stack_p - context_p->scope_stack_p);\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n    if (!SCANNER_STREAM_TYPE_IS_ARG_FUNC (type))\n    {\n      if (func_init_opcode == CBC_INIT_ARG_OR_FUNC && (option_flags & SCANNER_CREATE_VARS_IS_SCRIPT))\n      {\n        literal.char_p -= data_p[1];\n\n        if (!scanner_scope_find_lexical_declaration (context_p, &literal))\n        {\n          func_init_opcode = CBC_CREATE_VAR_FUNC_EVAL;\n\n          if (context_p->global_status_flags & ECMA_PARSE_FUNCTION_CONTEXT)\n          {\n            func_init_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_CREATE_VAR_FUNC_EVAL);\n          }\n        }\n        literal.char_p += data_p[1];\n      }\n\n      parser_emit_cbc_literal_value (context_p, func_init_opcode, context_p->literal_count, map_to);\n    }\n\n    scope_stack_p->map_from = PARSER_SCOPE_STACK_FUNC;\n    scope_stack_p->map_to = context_p->literal_count;\n    scope_stack_p++;\n\n    scanner_create_unused_literal (context_p, 0);\n  }\n\n  context_p->scope_stack_top = (uint16_t) (scope_stack_p - context_p->scope_stack_p);\n  context_p->scope_stack_reg_top = (uint16_t) scope_stack_reg_top;\n\n  if (info_type == SCANNER_TYPE_FUNCTION)\n  {\n    context_p->scope_stack_global_end = context_p->scope_stack_top;\n  }\n\n  if (context_p->register_count < scope_stack_reg_top)\n  {\n    context_p->register_count = (uint16_t) scope_stack_reg_top;\n  }\n\n  if (!(option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_ARGS))\n  {\n    scanner_release_next (context_p, (size_t) (next_data_p + 1 - ((const uint8_t *) info_p)));\n  }\n  parser_flush_cbc (context_p);\n} /* scanner_create_variables */\n\n/**\n * Get location from context.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nscanner_get_location (scanner_location_t *location_p, /**< location */\n                      parser_context_t *context_p) /**< context */\n{\n  location_p->source_p = context_p->source_p;\n  location_p->line = context_p->line;\n  location_p->column = context_p->column;\n} /* scanner_get_location */\n\n/**\n * Set context location.\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nscanner_set_location (parser_context_t *context_p, /**< context */\n                      scanner_location_t *location_p) /**< location */\n{\n  context_p->source_p = location_p->source_p;\n  context_p->line = location_p->line;\n  context_p->column = location_p->column;\n} /* scanner_set_location */\n\n/**\n * Get the real map_to value.\n */\nextern inline uint16_t JERRY_ATTR_ALWAYS_INLINE\nscanner_decode_map_to (parser_scope_stack_t *stack_item_p) /**< scope stack item */\n{\n  JERRY_ASSERT (stack_item_p->map_from != PARSER_SCOPE_STACK_FUNC);\n\n  uint16_t value = (stack_item_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK);\n  return (value == 0) ? stack_item_p->map_from : (uint16_t) (value + (PARSER_REGISTER_START - 1));\n} /* scanner_decode_map_to */\n\n/**\n * Find the given literal index in the scope stack\n * and save it the constant literal pool if the literal is register stored\n *\n * @return given literal index - if literal corresponds to this index is not register stored\n *         literal index on which literal index has been mapped - otherwise\n */\nuint16_t\nscanner_save_literal (parser_context_t *context_p, /**< context */\n                      uint16_t literal_index) /**< literal index */\n{\n  if (literal_index >= PARSER_REGISTER_START)\n  {\n    literal_index = (uint16_t) (literal_index - (PARSER_REGISTER_START - 1));\n\n    parser_scope_stack_t *scope_stack_p = context_p->scope_stack_p + context_p->scope_stack_top;\n\n    do\n    {\n      /* Registers must be found in the scope stack. */\n      JERRY_ASSERT (scope_stack_p > context_p->scope_stack_p);\n      scope_stack_p--;\n    } while (scope_stack_p->map_from == PARSER_SCOPE_STACK_FUNC\n             || literal_index != (scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK));\n\n    literal_index = scope_stack_p->map_from;\n    PARSER_GET_LITERAL (literal_index)->status_flags |= LEXER_FLAG_USED;\n  }\n\n  return literal_index;\n} /* scanner_save_literal */\n\n/**\n * Checks whether the literal is a const in the current scope.\n *\n * @return true if the literal is a const, false otherwise\n */\nbool\nscanner_literal_is_const_reg (parser_context_t *context_p, /**< context */\n                              uint16_t literal_index) /**< literal index */\n{\n  if (literal_index < PARSER_REGISTER_START)\n  {\n    /* Re-assignment of non-register const bindings are detected elsewhere. */\n    return false;\n  }\n\n  parser_scope_stack_t *scope_stack_p = context_p->scope_stack_p + context_p->scope_stack_top;\n\n  literal_index = (uint16_t) (literal_index - (PARSER_REGISTER_START - 1));\n\n  do\n  {\n    /* Registers must be found in the scope stack. */\n    JERRY_ASSERT (scope_stack_p > context_p->scope_stack_p);\n    scope_stack_p--;\n  } while (scope_stack_p->map_from == PARSER_SCOPE_STACK_FUNC\n           || literal_index != (scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK));\n\n  return (scope_stack_p->map_to & PARSER_SCOPE_STACK_IS_CONST_REG) != 0;\n} /* scanner_literal_is_const_reg */\n\n/**\n * Checks whether the literal is created before.\n *\n * @return true if the literal is created before, false otherwise\n */\nbool\nscanner_literal_is_created (parser_context_t *context_p, /**< context */\n                            uint16_t literal_index) /**< literal index */\n{\n  JERRY_ASSERT (literal_index < PARSER_REGISTER_START);\n\n  parser_scope_stack_t *scope_stack_p = context_p->scope_stack_p + context_p->scope_stack_top;\n\n  do\n  {\n    /* These literals must be found in the scope stack. */\n    JERRY_ASSERT (scope_stack_p > context_p->scope_stack_p);\n    scope_stack_p--;\n  } while (literal_index != scope_stack_p->map_from);\n\n  JERRY_ASSERT ((scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK) == 0);\n\n  return (scope_stack_p->map_to & PARSER_SCOPE_STACK_IS_LOCAL_CREATED) != 0;\n} /* scanner_literal_is_created */\n\n/**\n * Checks whether the literal exists.\n *\n * @return true if the literal exists, false otherwise\n */\nbool\nscanner_literal_exists (parser_context_t *context_p, /**< context */\n                        uint16_t literal_index) /**< literal index */\n{\n  JERRY_ASSERT (literal_index < PARSER_REGISTER_START);\n\n  parser_scope_stack_t *scope_stack_p = context_p->scope_stack_p + context_p->scope_stack_top;\n\n  while (scope_stack_p-- > context_p->scope_stack_p)\n  {\n    if (scope_stack_p->map_from != PARSER_SCOPE_STACK_FUNC && scanner_decode_map_to (scope_stack_p) == literal_index)\n    {\n      return true;\n    }\n  }\n\n  return false;\n} /* scanner_literal_exists */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_PARSER */\n"
  },
  {
    "path": "jerry-core/parser/js/js-scanner.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jcontext.h\"\n#include \"js-parser-internal.h\"\n#include \"js-scanner-internal.h\"\n#include \"lit-char-helpers.h\"\n\n#if JERRY_PARSER\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_scanner Scanner\n * @{\n */\n\n/**\n * Scan return types.\n */\ntypedef enum\n{\n  SCAN_NEXT_TOKEN, /**< get next token after return */\n  SCAN_KEEP_TOKEN, /**< keep the current token after return */\n} scan_return_types_t;\n\n/**\n * Checks whether token type is \"of\".\n */\n#define SCANNER_IDENTIFIER_IS_OF() (lexer_token_is_identifier (context_p, \"of\", 2))\n\nJERRY_STATIC_ASSERT (SCANNER_FROM_LITERAL_POOL_TO_COMPUTED (SCANNER_LITERAL_POOL_GENERATOR)\n                       == SCAN_STACK_COMPUTED_GENERATOR,\n                     scanner_invalid_conversion_from_literal_pool_generator_to_computed_generator);\nJERRY_STATIC_ASSERT (SCANNER_FROM_LITERAL_POOL_TO_COMPUTED (SCANNER_LITERAL_POOL_ASYNC) == SCAN_STACK_COMPUTED_ASYNC,\n                     scanner_invalid_conversion_from_literal_pool_async_to_computed_async);\n\nJERRY_STATIC_ASSERT (SCANNER_FROM_COMPUTED_TO_LITERAL_POOL (SCAN_STACK_COMPUTED_GENERATOR)\n                       == SCANNER_LITERAL_POOL_GENERATOR,\n                     scanner_invalid_conversion_from_computed_generator_to_literal_pool_generator);\nJERRY_STATIC_ASSERT (SCANNER_FROM_COMPUTED_TO_LITERAL_POOL (SCAN_STACK_COMPUTED_ASYNC) == SCANNER_LITERAL_POOL_ASYNC,\n                     scanner_invalid_conversion_from_computed_async_to_literal_pool_async);\n\n/**\n * Change scanner mode from primary expression to post primary expression.\n *\n * @return SCAN_NEXT_TOKEN to read the next token, or SCAN_KEEP_TOKEN to do nothing\n */\nstatic scan_return_types_t\nscanner_primary_to_post_primary_expression (parser_context_t *context_p, /**< context */\n                                            scanner_context_t *scanner_context_p) /* scanner context */\n{\n  scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n\n  if (JERRY_UNLIKELY (context_p->stack_top_uint8 == SCAN_STACK_CLASS_FIELD_INITIALIZER\n                      && (context_p->status_flags & PARSER_IS_STRICT)))\n  {\n    lexer_scan_identifier (context_p, LEXER_PARSE_CHECK_KEYWORDS | LEXER_PARSE_NO_STRICT_IDENT_ERROR);\n\n    if (context_p->token.type == LEXER_LITERAL && lexer_compare_literal_to_string (context_p, \"static\", 6))\n    {\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n    }\n\n    return SCAN_KEEP_TOKEN;\n  }\n\n  return SCAN_NEXT_TOKEN;\n} /* scanner_primary_to_post_primary_expression */\n\n/**\n * Scan primary expression.\n *\n * @return SCAN_NEXT_TOKEN to read the next token, or SCAN_KEEP_TOKEN to do nothing\n */\nstatic scan_return_types_t\nscanner_scan_primary_expression (parser_context_t *context_p, /**< context */\n                                 scanner_context_t *scanner_context_p, /* scanner context */\n                                 lexer_token_type_t type, /**< current token type */\n                                 scan_stack_modes_t stack_top) /**< current stack top */\n{\n  switch (type)\n  {\n    case LEXER_KEYW_NEW:\n    {\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_AFTER_NEW;\n\n      if (scanner_try_scan_new_target (context_p))\n      {\n        return scanner_primary_to_post_primary_expression (context_p, scanner_context_p);\n      }\n\n      break;\n    }\n    case LEXER_DIVIDE:\n    case LEXER_ASSIGN_DIVIDE:\n    {\n      lexer_construct_regexp_object (context_p, true);\n      return scanner_primary_to_post_primary_expression (context_p, scanner_context_p);\n    }\n    case LEXER_KEYW_FUNCTION:\n    {\n      uint16_t status_flags = SCANNER_LITERAL_POOL_FUNCTION;\n#if JERRY_MODULE_SYSTEM\n      bool is_export_default = stack_top == SCAN_STACK_EXPORT_DEFAULT;\n#endif /* JERRY_MODULE_SYSTEM */\n\n      if (scanner_context_p->async_source_p != NULL)\n      {\n        status_flags |= SCANNER_LITERAL_POOL_ASYNC;\n      }\n\n      if (lexer_consume_generator (context_p))\n      {\n        status_flags |= SCANNER_LITERAL_POOL_GENERATOR;\n      }\n\n      scanner_push_literal_pool (context_p, scanner_context_p, status_flags);\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n      {\n#if JERRY_MODULE_SYSTEM\n        if (is_export_default)\n        {\n          lexer_lit_location_t *location_p;\n          location_p = scanner_add_custom_literal (context_p,\n                                                   scanner_context_p->active_literal_pool_p->prev_p,\n                                                   &context_p->token.lit_location);\n\n          scanner_detect_invalid_let (context_p, location_p);\n          location_p->type |= SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_LET;\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n        lexer_next_token (context_p);\n      }\n#if JERRY_MODULE_SYSTEM\n      else if (is_export_default)\n      {\n        lexer_lit_location_t *location_p;\n        location_p = scanner_add_custom_literal (context_p,\n                                                 scanner_context_p->active_literal_pool_p->prev_p,\n                                                 &lexer_default_literal);\n        location_p->type |= SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_LET;\n      }\n#endif /* JERRY_MODULE_SYSTEM */\n\n      parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_EXPRESSION);\n      scanner_context_p->mode = SCAN_MODE_FUNCTION_ARGUMENTS;\n      return SCAN_KEEP_TOKEN;\n    }\n    case LEXER_LEFT_PAREN:\n    {\n      scanner_scan_bracket (context_p, scanner_context_p);\n      return SCAN_KEEP_TOKEN;\n    }\n    case LEXER_LEFT_SQUARE:\n    {\n      scanner_push_destructuring_pattern (context_p, scanner_context_p, SCANNER_BINDING_NONE, false);\n\n      parser_stack_push_uint8 (context_p, SCAN_STACK_ARRAY_LITERAL);\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n      break;\n    }\n    case LEXER_LEFT_BRACE:\n    {\n      scanner_push_destructuring_pattern (context_p, scanner_context_p, SCANNER_BINDING_NONE, false);\n      parser_stack_push_uint8 (context_p, 0);\n\n      parser_stack_push_uint8 (context_p, SCAN_STACK_OBJECT_LITERAL);\n      scanner_context_p->mode = SCAN_MODE_PROPERTY_NAME;\n      return SCAN_KEEP_TOKEN;\n    }\n    case LEXER_HASHMARK:\n    {\n      if (!lexer_scan_private_identifier (context_p))\n      {\n        scanner_raise_error (context_p);\n      }\n\n      return SCAN_KEEP_TOKEN;\n    }\n    case LEXER_TEMPLATE_LITERAL:\n    {\n      if (context_p->source_p[-1] != LIT_CHAR_GRAVE_ACCENT)\n      {\n        parser_stack_push_uint8 (context_p, SCAN_STACK_TEMPLATE_STRING);\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n        break;\n      }\n\n      /* The string is a normal string literal. */\n      /* FALLTHRU */\n    }\n    case LEXER_LITERAL:\n    {\n      const uint8_t *source_p = context_p->source_p;\n\n      if (context_p->token.lit_location.type == LEXER_IDENT_LITERAL && lexer_check_arrow (context_p))\n      {\n        scanner_scan_simple_arrow (context_p, scanner_context_p, source_p);\n        return SCAN_KEEP_TOKEN;\n      }\n\n      if (JERRY_UNLIKELY (lexer_token_is_async (context_p)))\n      {\n        scanner_context_p->async_source_p = source_p;\n        scanner_check_async_function (context_p, scanner_context_p);\n        return SCAN_KEEP_TOKEN;\n      }\n\n      if (context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n      {\n#if JERRY_MODULE_SYSTEM\n        if (stack_top == SCAN_STACK_EXPORT_DEFAULT)\n        {\n          lexer_lit_location_t *location_p = scanner_add_literal (context_p, scanner_context_p);\n          location_p->type |= (SCANNER_LITERAL_IS_USED | SCANNER_LITERAL_IS_VAR);\n          scanner_detect_eval_call (context_p, scanner_context_p);\n          return scanner_primary_to_post_primary_expression (context_p, scanner_context_p);\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n\n        scanner_add_reference (context_p, scanner_context_p);\n      }\n      /* FALLTHRU */\n    }\n    case LEXER_KEYW_THIS:\n    case LEXER_LIT_TRUE:\n    case LEXER_LIT_FALSE:\n    case LEXER_LIT_NULL:\n    {\n      return scanner_primary_to_post_primary_expression (context_p, scanner_context_p);\n    }\n    case LEXER_KEYW_SUPER:\n    {\n      scanner_context_p->active_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE;\n      return scanner_primary_to_post_primary_expression (context_p, scanner_context_p);\n    }\n    case LEXER_KEYW_CLASS:\n    {\n      scanner_push_class_declaration (context_p, scanner_context_p, SCAN_STACK_CLASS_EXPRESSION);\n\n      if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n      {\n        return SCAN_KEEP_TOKEN;\n      }\n      break;\n    }\n    case LEXER_RIGHT_SQUARE:\n    {\n      if (stack_top != SCAN_STACK_ARRAY_LITERAL)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n      return SCAN_KEEP_TOKEN;\n    }\n    case LEXER_THREE_DOTS:\n    {\n      /* Elision or spread arguments */\n      if (stack_top != SCAN_STACK_PAREN_EXPRESSION && stack_top != SCAN_STACK_ARRAY_LITERAL)\n      {\n        scanner_raise_error (context_p);\n      }\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n      break;\n    }\n    case LEXER_COMMA:\n    {\n      if (stack_top != SCAN_STACK_ARRAY_LITERAL)\n      {\n        scanner_raise_error (context_p);\n      }\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n      if (scanner_context_p->binding_type != SCANNER_BINDING_NONE)\n      {\n        scanner_context_p->mode = SCAN_MODE_BINDING;\n      }\n\n      break;\n    }\n    case LEXER_KEYW_YIELD:\n    {\n      lexer_next_token (context_p);\n\n      if (lexer_check_yield_no_arg (context_p))\n      {\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n      }\n\n      if (context_p->token.type == LEXER_MULTIPLY)\n      {\n        return SCAN_NEXT_TOKEN;\n      }\n      return SCAN_KEEP_TOKEN;\n    }\n#if JERRY_MODULE_SYSTEM\n    case LEXER_KEYW_IMPORT:\n    {\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_DOT)\n      {\n        scanner_check_import_meta (context_p);\n      }\n      else if (context_p->token.type != LEXER_LEFT_PAREN)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n      return SCAN_KEEP_TOKEN;\n    }\n#endif /* JERRY_MODULE_SYSTEM */\n    case LEXER_RIGHT_PAREN:\n    {\n      if (stack_top == SCAN_STACK_PAREN_EXPRESSION)\n      {\n        parser_stack_pop_uint8 (context_p);\n\n        if (context_p->stack_top_uint8 == SCAN_STACK_USE_ASYNC)\n        {\n          scanner_add_async_literal (context_p, scanner_context_p);\n        }\n\n        return scanner_primary_to_post_primary_expression (context_p, scanner_context_p);\n      }\n      /* FALLTHRU */\n    }\n    default:\n    {\n      scanner_raise_error (context_p);\n    }\n  }\n  return SCAN_NEXT_TOKEN;\n} /* scanner_scan_primary_expression */\n\n/**\n * Consume the ?. token\n *\n * @return token type to continue the post primary expression parsing\n */\nstatic lexer_token_type_t\nscanner_consume_optional_chain (parser_context_t *context_p) /**< context */\n{\n  switch (lexer_peek_next_character (context_p))\n  {\n    case LIT_CHAR_LEFT_PAREN:\n    case LIT_CHAR_LEFT_SQUARE:\n    {\n      lexer_next_token (context_p);\n      return context_p->token.type;\n    }\n    default:\n    {\n      return LEXER_DOT;\n    }\n  }\n} /* scanner_consume_optional_chain */\n\n/**\n * Scan the tokens after the primary expression.\n *\n * @return true for break, false for fall through\n */\nstatic bool\nscanner_scan_post_primary_expression (parser_context_t *context_p, /**< context */\n                                      scanner_context_t *scanner_context_p, /**< scanner context */\n                                      lexer_token_type_t type, /**< current token type */\n                                      scan_stack_modes_t stack_top) /**< current stack top */\n{\n  while (true)\n  {\n    switch (type)\n    {\n      case LEXER_QUESTION_MARK_DOT:\n      {\n        type = scanner_consume_optional_chain (context_p);\n        continue;\n      }\n      case LEXER_DOT:\n      {\n        lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS);\n        if (context_p->token.type == LEXER_HASHMARK)\n        {\n          context_p->token.flags |= LEXER_NO_SKIP_SPACES;\n          lexer_next_token (context_p);\n        }\n\n        if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        return true;\n      }\n      case LEXER_LEFT_PAREN:\n      {\n        parser_stack_push_uint8 (context_p, SCAN_STACK_PAREN_EXPRESSION);\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n        return true;\n      }\n      case LEXER_TEMPLATE_LITERAL:\n      {\n        if (JERRY_UNLIKELY (context_p->source_p[-1] != LIT_CHAR_GRAVE_ACCENT))\n        {\n          scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n          parser_stack_push_uint8 (context_p, SCAN_STACK_TAGGED_TEMPLATE_LITERAL);\n        }\n        return true;\n      }\n      case LEXER_LEFT_SQUARE:\n      {\n        parser_stack_push_uint8 (context_p, SCAN_STACK_PROPERTY_ACCESSOR);\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n        return true;\n      }\n      case LEXER_INCREASE:\n      case LEXER_DECREASE:\n      {\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n\n        if (context_p->token.flags & LEXER_WAS_NEWLINE)\n        {\n          return false;\n        }\n\n        lexer_next_token (context_p);\n        type = (lexer_token_type_t) context_p->token.type;\n\n        if (type != LEXER_QUESTION_MARK)\n        {\n          break;\n        }\n        /* FALLTHRU */\n      }\n      case LEXER_QUESTION_MARK:\n      {\n        parser_stack_push_uint8 (context_p, SCAN_STACK_COLON_EXPRESSION);\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n        return true;\n      }\n      default:\n      {\n        break;\n      }\n    }\n\n    break;\n  }\n\n  if (LEXER_IS_BINARY_OP_TOKEN (type) && (type != LEXER_KEYW_IN || !SCANNER_IS_FOR_START (stack_top)))\n  {\n    scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n    return true;\n  }\n\n  return false;\n} /* scanner_scan_post_primary_expression */\n\n/**\n * Scan the tokens after the primary expression.\n *\n * @return SCAN_NEXT_TOKEN to read the next token, or SCAN_KEEP_TOKEN to do nothing\n */\nstatic scan_return_types_t\nscanner_scan_primary_expression_end (parser_context_t *context_p, /**< context */\n                                     scanner_context_t *scanner_context_p, /**< scanner context */\n                                     lexer_token_type_t type, /**< current token type */\n                                     scan_stack_modes_t stack_top) /**< current stack top */\n{\n  if (type == LEXER_COMMA)\n  {\n    switch (stack_top)\n    {\n      case SCAN_STACK_VAR:\n      case SCAN_STACK_LET:\n      case SCAN_STACK_CONST:\n      case SCAN_STACK_FOR_VAR_START:\n      case SCAN_STACK_FOR_LET_START:\n      case SCAN_STACK_FOR_CONST_START:\n      {\n        scanner_context_p->mode = SCAN_MODE_VAR_STATEMENT;\n        return SCAN_NEXT_TOKEN;\n      }\n      case SCAN_STACK_COLON_EXPRESSION:\n      {\n        scanner_raise_error (context_p);\n        break;\n      }\n      case SCAN_STACK_BINDING_INIT:\n      case SCAN_STACK_BINDING_LIST_INIT:\n      {\n        break;\n      }\n      case SCAN_STACK_ARROW_ARGUMENTS:\n      {\n        lexer_next_token (context_p);\n        scanner_check_arrow_arg (context_p, scanner_context_p);\n        return SCAN_KEEP_TOKEN;\n      }\n      case SCAN_STACK_ARROW_EXPRESSION:\n      {\n        break;\n      }\n      case SCAN_STACK_CLASS_FIELD_INITIALIZER:\n      {\n        scanner_raise_error (context_p);\n        break;\n      }\n      case SCAN_STACK_FUNCTION_PARAMETERS:\n      {\n        scanner_context_p->mode = SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS;\n        parser_stack_pop_uint8 (context_p);\n        return SCAN_NEXT_TOKEN;\n      }\n      case SCAN_STACK_ARRAY_LITERAL:\n      {\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n        if (scanner_context_p->binding_type != SCANNER_BINDING_NONE)\n        {\n          scanner_context_p->mode = SCAN_MODE_BINDING;\n        }\n\n        return SCAN_NEXT_TOKEN;\n      }\n      case SCAN_STACK_OBJECT_LITERAL:\n      {\n        scanner_context_p->mode = SCAN_MODE_PROPERTY_NAME;\n        return SCAN_KEEP_TOKEN;\n      }\n      default:\n      {\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n        return SCAN_NEXT_TOKEN;\n      }\n    }\n  }\n\n  switch (stack_top)\n  {\n    case SCAN_STACK_WITH_EXPRESSION:\n    {\n      if (type != LEXER_RIGHT_PAREN)\n      {\n        break;\n      }\n\n      parser_stack_pop_uint8 (context_p);\n\n      uint16_t status_flags = scanner_context_p->active_literal_pool_p->status_flags;\n      parser_stack_push_uint8 (context_p, (status_flags & SCANNER_LITERAL_POOL_IN_WITH) ? 1 : 0);\n      parser_stack_push_uint8 (context_p, SCAN_STACK_WITH_STATEMENT);\n      status_flags |= SCANNER_LITERAL_POOL_IN_WITH;\n      scanner_context_p->active_literal_pool_p->status_flags = status_flags;\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT;\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_DO_EXPRESSION:\n    {\n      if (type != LEXER_RIGHT_PAREN)\n      {\n        break;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_END;\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_WHILE_EXPRESSION:\n    {\n      if (type != LEXER_RIGHT_PAREN)\n      {\n        break;\n      }\n\n      scanner_source_start_t source_start;\n\n      parser_stack_pop_uint8 (context_p);\n      parser_stack_pop (context_p, &source_start, sizeof (scanner_source_start_t));\n\n      scanner_location_info_t *location_info_p;\n      location_info_p = (scanner_location_info_t *) scanner_insert_info (context_p,\n                                                                         source_start.source_p,\n                                                                         sizeof (scanner_location_info_t));\n      location_info_p->info.type = SCANNER_TYPE_WHILE;\n\n      scanner_get_location (&location_info_p->location, context_p);\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT;\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_PAREN_EXPRESSION:\n    {\n      if (type != LEXER_RIGHT_PAREN)\n      {\n        break;\n      }\n\n      parser_stack_pop_uint8 (context_p);\n\n      if (context_p->stack_top_uint8 == SCAN_STACK_USE_ASYNC)\n      {\n        scanner_add_async_literal (context_p, scanner_context_p);\n      }\n\n      scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_STATEMENT_WITH_EXPR:\n    {\n      if (type != LEXER_RIGHT_PAREN)\n      {\n        break;\n      }\n\n      parser_stack_pop_uint8 (context_p);\n\n      if (context_p->stack_top_uint8 == SCAN_STACK_IF_STATEMENT)\n      {\n        scanner_check_function_after_if (context_p, scanner_context_p);\n        return SCAN_KEEP_TOKEN;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT;\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_BINDING_LIST_INIT:\n    {\n      parser_stack_pop_uint8 (context_p);\n\n      JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_ARRAY_LITERAL\n                    || context_p->stack_top_uint8 == SCAN_STACK_OBJECT_LITERAL\n                    || context_p->stack_top_uint8 == SCAN_STACK_LET || context_p->stack_top_uint8 == SCAN_STACK_CONST\n                    || context_p->stack_top_uint8 == SCAN_STACK_FOR_LET_START\n                    || context_p->stack_top_uint8 == SCAN_STACK_FOR_CONST_START\n                    || context_p->stack_top_uint8 == SCAN_STACK_FUNCTION_PARAMETERS\n                    || context_p->stack_top_uint8 == SCAN_STACK_ARROW_ARGUMENTS);\n\n      scanner_binding_item_t *item_p = scanner_context_p->active_binding_list_p->items_p;\n\n      while (item_p != NULL)\n      {\n        if (item_p->literal_p->type & SCANNER_LITERAL_IS_USED)\n        {\n          item_p->literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;\n        }\n        item_p = item_p->next_p;\n      }\n\n      scanner_pop_binding_list (scanner_context_p);\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n      return SCAN_KEEP_TOKEN;\n    }\n    case SCAN_STACK_BINDING_INIT:\n    {\n      scanner_binding_literal_t binding_literal;\n\n      parser_stack_pop_uint8 (context_p);\n      parser_stack_pop (context_p, &binding_literal, sizeof (scanner_binding_literal_t));\n\n      JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_ARRAY_LITERAL\n                    || context_p->stack_top_uint8 == SCAN_STACK_OBJECT_LITERAL\n                    || context_p->stack_top_uint8 == SCAN_STACK_LET || context_p->stack_top_uint8 == SCAN_STACK_CONST\n                    || context_p->stack_top_uint8 == SCAN_STACK_FOR_LET_START\n                    || context_p->stack_top_uint8 == SCAN_STACK_FOR_CONST_START\n                    || context_p->stack_top_uint8 == SCAN_STACK_FUNCTION_PARAMETERS\n                    || context_p->stack_top_uint8 == SCAN_STACK_ARROW_ARGUMENTS);\n\n      JERRY_ASSERT (SCANNER_NEEDS_BINDING_LIST (scanner_context_p->binding_type)\n                    || (stack_top != SCAN_STACK_ARRAY_LITERAL && stack_top != SCAN_STACK_OBJECT_LITERAL));\n\n      if (binding_literal.literal_p->type & SCANNER_LITERAL_IS_USED)\n      {\n        binding_literal.literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n      return SCAN_KEEP_TOKEN;\n    }\n    case SCAN_STACK_VAR:\n    case SCAN_STACK_LET:\n    case SCAN_STACK_CONST:\n    {\n#if JERRY_MODULE_SYSTEM\n      scanner_context_p->active_literal_pool_p->status_flags &= (uint16_t) ~SCANNER_LITERAL_POOL_IN_EXPORT;\n#endif /* JERRY_MODULE_SYSTEM */\n\n      parser_stack_pop_uint8 (context_p);\n      return SCAN_KEEP_TOKEN;\n    }\n    case SCAN_STACK_FOR_VAR_START:\n    case SCAN_STACK_FOR_LET_START:\n    case SCAN_STACK_FOR_CONST_START:\n    case SCAN_STACK_FOR_START:\n    {\n      if (type == LEXER_KEYW_IN || SCANNER_IDENTIFIER_IS_OF ())\n      {\n        scanner_for_statement_t for_statement;\n\n        parser_stack_pop_uint8 (context_p);\n        parser_stack_pop (context_p, &for_statement, sizeof (scanner_for_statement_t));\n\n        scanner_location_info_t *location_info;\n        location_info = (scanner_location_info_t *) scanner_insert_info (context_p,\n                                                                         for_statement.u.source_p,\n                                                                         sizeof (scanner_location_info_t));\n        location_info->info.type = (type == LEXER_KEYW_IN) ? SCANNER_TYPE_FOR_IN : SCANNER_TYPE_FOR_OF;\n\n        if (stack_top == SCAN_STACK_FOR_LET_START || stack_top == SCAN_STACK_FOR_CONST_START)\n        {\n          parser_stack_push_uint8 (context_p, SCAN_STACK_PRIVATE_BLOCK_EARLY);\n        }\n        scanner_get_location (&location_info->location, context_p);\n\n        parser_stack_push_uint8 (context_p, SCAN_STACK_STATEMENT_WITH_EXPR);\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n        return SCAN_NEXT_TOKEN;\n      }\n\n      if (type != LEXER_SEMICOLON)\n      {\n        break;\n      }\n\n      scanner_for_statement_t for_statement;\n\n      parser_stack_pop_uint8 (context_p);\n      parser_stack_pop (context_p, NULL, sizeof (scanner_for_statement_t));\n\n      if (stack_top == SCAN_STACK_FOR_LET_START || stack_top == SCAN_STACK_FOR_CONST_START)\n      {\n        parser_stack_push_uint8 (context_p, SCAN_STACK_PRIVATE_BLOCK);\n      }\n\n      for_statement.u.source_p = context_p->source_p;\n      parser_stack_push (context_p, &for_statement, sizeof (scanner_for_statement_t));\n      parser_stack_push_uint8 (context_p, SCAN_STACK_FOR_CONDITION);\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type != LEXER_SEMICOLON)\n      {\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n        return SCAN_KEEP_TOKEN;\n      }\n\n      type = LEXER_SEMICOLON;\n      /* FALLTHRU */\n    }\n    case SCAN_STACK_FOR_CONDITION:\n    {\n      if (type != LEXER_SEMICOLON)\n      {\n        break;\n      }\n\n      scanner_for_statement_t for_statement;\n\n      parser_stack_pop_uint8 (context_p);\n      parser_stack_pop (context_p, &for_statement, sizeof (scanner_for_statement_t));\n\n      scanner_for_info_t *for_info_p;\n      for_info_p =\n        (scanner_for_info_t *) scanner_insert_info (context_p, for_statement.u.source_p, sizeof (scanner_for_info_t));\n      for_info_p->info.type = SCANNER_TYPE_FOR;\n\n      scanner_get_location (&for_info_p->expression_location, context_p);\n      for_info_p->end_location.source_p = NULL;\n\n      for_statement.u.for_info_p = for_info_p;\n\n      parser_stack_push (context_p, &for_statement, sizeof (scanner_for_statement_t));\n      parser_stack_push_uint8 (context_p, SCAN_STACK_FOR_EXPRESSION);\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type != LEXER_RIGHT_PAREN)\n      {\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n        return SCAN_KEEP_TOKEN;\n      }\n\n      type = LEXER_RIGHT_PAREN;\n      /* FALLTHRU */\n    }\n    case SCAN_STACK_FOR_EXPRESSION:\n    {\n      if (type != LEXER_RIGHT_PAREN)\n      {\n        break;\n      }\n\n      scanner_for_statement_t for_statement;\n\n      parser_stack_pop_uint8 (context_p);\n      parser_stack_pop (context_p, &for_statement, sizeof (scanner_for_statement_t));\n\n      scanner_get_location (&for_statement.u.for_info_p->end_location, context_p);\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT;\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_SWITCH_EXPRESSION:\n    {\n      if (type != LEXER_RIGHT_PAREN)\n      {\n        break;\n      }\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type != LEXER_LEFT_BRACE)\n      {\n        break;\n      }\n\n      scanner_literal_pool_t *literal_pool_p;\n      literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, 0);\n      literal_pool_p->source_p = context_p->source_p - 1;\n\n      parser_stack_pop_uint8 (context_p);\n\n      scanner_switch_statement_t switch_statement = scanner_context_p->active_switch_statement;\n      parser_stack_push (context_p, &switch_statement, sizeof (scanner_switch_statement_t));\n      parser_stack_push_uint8 (context_p, SCAN_STACK_SWITCH_BLOCK);\n\n      scanner_switch_info_t *switch_info_p;\n      switch_info_p =\n        (scanner_switch_info_t *) scanner_insert_info (context_p, context_p->source_p, sizeof (scanner_switch_info_t));\n      switch_info_p->info.type = SCANNER_TYPE_SWITCH;\n      switch_info_p->case_p = NULL;\n      scanner_context_p->active_switch_statement.last_case_p = &switch_info_p->case_p;\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type != LEXER_RIGHT_BRACE && context_p->token.type != LEXER_KEYW_CASE\n          && context_p->token.type != LEXER_KEYW_DEFAULT)\n      {\n        break;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;\n      return SCAN_KEEP_TOKEN;\n    }\n    case SCAN_STACK_CASE_STATEMENT:\n    {\n      if (type != LEXER_COLON)\n      {\n        break;\n      }\n\n      scanner_source_start_t source_start;\n\n      parser_stack_pop_uint8 (context_p);\n      parser_stack_pop (context_p, &source_start, sizeof (scanner_source_start_t));\n\n      scanner_location_info_t *location_info_p;\n      location_info_p = (scanner_location_info_t *) scanner_insert_info (context_p,\n                                                                         source_start.source_p,\n                                                                         sizeof (scanner_location_info_t));\n      location_info_p->info.type = SCANNER_TYPE_CASE;\n\n      scanner_get_location (&location_info_p->location, context_p);\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_COLON_EXPRESSION:\n    {\n      if (type != LEXER_COLON)\n      {\n        break;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n      parser_stack_pop_uint8 (context_p);\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_ARRAY_LITERAL:\n    case SCAN_STACK_OBJECT_LITERAL:\n    {\n      if ((stack_top == SCAN_STACK_ARRAY_LITERAL && type != LEXER_RIGHT_SQUARE)\n          || (stack_top == SCAN_STACK_OBJECT_LITERAL && type != LEXER_RIGHT_BRACE))\n      {\n        break;\n      }\n\n      scanner_source_start_t source_start;\n      uint8_t binding_type = scanner_context_p->binding_type;\n      uint8_t object_literal_flags = 0;\n\n      parser_stack_pop_uint8 (context_p);\n\n      if (stack_top == SCAN_STACK_OBJECT_LITERAL)\n      {\n        object_literal_flags = context_p->stack_top_uint8;\n        parser_stack_pop_uint8 (context_p);\n      }\n\n      scanner_context_p->binding_type = context_p->stack_top_uint8;\n      parser_stack_pop_uint8 (context_p);\n      parser_stack_pop (context_p, &source_start, sizeof (scanner_source_start_t));\n\n      lexer_next_token (context_p);\n\n      stack_top = (scan_stack_modes_t) context_p->stack_top_uint8;\n\n      if (binding_type == SCANNER_BINDING_CATCH && stack_top == SCAN_STACK_CATCH_STATEMENT)\n      {\n        scanner_pop_binding_list (scanner_context_p);\n\n        if (object_literal_flags != 0)\n        {\n          scanner_info_t *info_p = scanner_insert_info (context_p, source_start.source_p, sizeof (scanner_info_t));\n          info_p->type = SCANNER_TYPE_LITERAL_FLAGS;\n          info_p->u8_arg = object_literal_flags;\n        }\n\n        if (context_p->token.type != LEXER_RIGHT_PAREN)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        lexer_next_token (context_p);\n\n        if (context_p->token.type != LEXER_LEFT_BRACE)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        scanner_context_p->mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;\n        return SCAN_NEXT_TOKEN;\n      }\n\n      if (stack_top == SCAN_STACK_FOR_START_PATTERN)\n      {\n        JERRY_ASSERT (binding_type == SCANNER_BINDING_NONE);\n\n        parser_stack_change_last_uint8 (context_p, SCAN_STACK_FOR_START);\n\n        if (context_p->token.type == LEXER_KEYW_IN || SCANNER_IDENTIFIER_IS_OF ())\n        {\n          scanner_info_t *info_p = scanner_insert_info (context_p, source_start.source_p, sizeof (scanner_info_t));\n          info_p->type = SCANNER_TYPE_LITERAL_FLAGS;\n          info_p->u8_arg = object_literal_flags | SCANNER_LITERAL_DESTRUCTURING_FOR;\n          return SCAN_KEEP_TOKEN;\n        }\n      }\n\n      if (context_p->token.type != LEXER_ASSIGN)\n      {\n        if (SCANNER_NEEDS_BINDING_LIST (binding_type))\n        {\n          scanner_pop_binding_list (scanner_context_p);\n        }\n\n        if ((stack_top == SCAN_STACK_ARRAY_LITERAL || stack_top == SCAN_STACK_OBJECT_LITERAL)\n            && (binding_type == SCANNER_BINDING_NONE || binding_type == SCANNER_BINDING_ARROW_ARG)\n            && context_p->token.type != LEXER_EOS && context_p->token.type != LEXER_COMMA\n            && context_p->token.type != LEXER_RIGHT_BRACE && context_p->token.type != LEXER_RIGHT_SQUARE)\n        {\n          object_literal_flags |= SCANNER_LITERAL_NO_DESTRUCTURING;\n        }\n\n        if (object_literal_flags != 0)\n        {\n          scanner_info_t *info_p = scanner_insert_info (context_p, source_start.source_p, sizeof (scanner_info_t));\n          info_p->type = SCANNER_TYPE_LITERAL_FLAGS;\n          info_p->u8_arg = object_literal_flags;\n        }\n\n        scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n        return SCAN_KEEP_TOKEN;\n      }\n\n      scanner_location_info_t *location_info_p;\n      location_info_p = (scanner_location_info_t *) scanner_insert_info (context_p,\n                                                                         source_start.source_p,\n                                                                         sizeof (scanner_location_info_t));\n      location_info_p->info.type = SCANNER_TYPE_INITIALIZER;\n      location_info_p->info.u8_arg = object_literal_flags;\n      scanner_get_location (&location_info_p->location, context_p);\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n      if (SCANNER_NEEDS_BINDING_LIST (binding_type))\n      {\n        scanner_binding_item_t *item_p = scanner_context_p->active_binding_list_p->items_p;\n\n        while (item_p != NULL)\n        {\n          item_p->literal_p->type &= (uint8_t) ~SCANNER_LITERAL_IS_USED;\n          item_p = item_p->next_p;\n        }\n\n        parser_stack_push_uint8 (context_p, SCAN_STACK_BINDING_LIST_INIT);\n      }\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_PROPERTY_ACCESSOR:\n    {\n      if (type != LEXER_RIGHT_SQUARE)\n      {\n        break;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n      parser_stack_pop_uint8 (context_p);\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_COMPUTED_PROPERTY:\n    {\n      if (type != LEXER_RIGHT_SQUARE)\n      {\n        break;\n      }\n\n      lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS);\n\n      parser_stack_pop_uint8 (context_p);\n      stack_top = (scan_stack_modes_t) context_p->stack_top_uint8;\n\n      if (stack_top == SCAN_STACK_FUNCTION_PROPERTY)\n      {\n        scanner_push_literal_pool (context_p, scanner_context_p, SCANNER_LITERAL_POOL_FUNCTION);\n        scanner_context_p->mode = SCAN_MODE_FUNCTION_ARGUMENTS;\n        return SCAN_KEEP_TOKEN;\n      }\n\n      if (stack_top == SCAN_STACK_EXPLICIT_CLASS_CONSTRUCTOR || stack_top == SCAN_STACK_IMPLICIT_CLASS_CONSTRUCTOR)\n      {\n        JERRY_ASSERT (scanner_context_p->active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_CLASS_NAME);\n\n        if (context_p->token.type == LEXER_LEFT_PAREN)\n        {\n          scanner_push_literal_pool (context_p, scanner_context_p, SCANNER_LITERAL_POOL_FUNCTION);\n\n          parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PROPERTY);\n          scanner_context_p->mode = SCAN_MODE_FUNCTION_ARGUMENTS;\n          return SCAN_KEEP_TOKEN;\n        }\n\n        if (context_p->token.type == LEXER_ASSIGN)\n        {\n          scanner_push_class_field_initializer (context_p, scanner_context_p);\n          return SCAN_NEXT_TOKEN;\n        }\n\n        scanner_context_p->mode =\n          (context_p->token.type != LEXER_SEMICOLON ? SCAN_MODE_CLASS_BODY_NO_SCAN : SCAN_MODE_CLASS_BODY);\n        return SCAN_KEEP_TOKEN;\n      }\n\n      JERRY_ASSERT (stack_top == SCAN_STACK_OBJECT_LITERAL);\n\n      if (context_p->token.type == LEXER_LEFT_PAREN)\n      {\n        scanner_push_literal_pool (context_p, scanner_context_p, SCANNER_LITERAL_POOL_FUNCTION);\n\n        parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PROPERTY);\n        scanner_context_p->mode = SCAN_MODE_FUNCTION_ARGUMENTS;\n        return SCAN_KEEP_TOKEN;\n      }\n\n      if (context_p->token.type != LEXER_COLON)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n      if (scanner_context_p->binding_type != SCANNER_BINDING_NONE)\n      {\n        scanner_context_p->mode = SCAN_MODE_BINDING;\n      }\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_COMPUTED_GENERATOR:\n    case SCAN_STACK_COMPUTED_ASYNC:\n    case SCAN_STACK_COMPUTED_ASYNC_GENERATOR:\n    {\n      if (type != LEXER_RIGHT_SQUARE)\n      {\n        break;\n      }\n\n      lexer_next_token (context_p);\n      parser_stack_pop_uint8 (context_p);\n\n      JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_OBJECT_LITERAL\n                    || context_p->stack_top_uint8 == SCAN_STACK_FUNCTION_PROPERTY);\n\n      uint16_t status_flags = (uint16_t) (SCANNER_LITERAL_POOL_FUNCTION | SCANNER_LITERAL_POOL_GENERATOR\n                                          | SCANNER_FROM_COMPUTED_TO_LITERAL_POOL (stack_top));\n\n      scanner_push_literal_pool (context_p, scanner_context_p, status_flags);\n\n      scanner_context_p->mode = SCAN_MODE_FUNCTION_ARGUMENTS;\n      return SCAN_KEEP_TOKEN;\n    }\n    case SCAN_STACK_TEMPLATE_STRING:\n    case SCAN_STACK_TAGGED_TEMPLATE_LITERAL:\n    {\n      if (type != LEXER_RIGHT_BRACE)\n      {\n        break;\n      }\n\n      context_p->source_p--;\n      context_p->column--;\n      lexer_parse_string (context_p, LEXER_STRING_NO_OPTS);\n\n      if (context_p->source_p[-1] != LIT_CHAR_GRAVE_ACCENT)\n      {\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n      }\n      else\n      {\n        parser_stack_pop_uint8 (context_p);\n        scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n      }\n      return SCAN_NEXT_TOKEN;\n    }\n    case SCAN_STACK_ARROW_ARGUMENTS:\n    {\n      if (type != LEXER_RIGHT_PAREN)\n      {\n        break;\n      }\n\n      scanner_check_arrow (context_p, scanner_context_p);\n      return SCAN_KEEP_TOKEN;\n    }\n    case SCAN_STACK_ARROW_EXPRESSION:\n    {\n      scanner_pop_literal_pool (context_p, scanner_context_p);\n      parser_stack_pop_uint8 (context_p);\n      lexer_update_await_yield (context_p, context_p->status_flags);\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n      return SCAN_KEEP_TOKEN;\n    }\n    case SCAN_STACK_CLASS_EXTENDS:\n    {\n      if (type != LEXER_LEFT_BRACE)\n      {\n        break;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_CLASS_BODY;\n      parser_stack_pop_uint8 (context_p);\n\n      return SCAN_KEEP_TOKEN;\n    }\n    case SCAN_STACK_CLASS_FIELD_INITIALIZER:\n    {\n      scanner_source_start_t source_start;\n      const uint8_t *source_p = NULL;\n\n      parser_stack_pop_uint8 (context_p);\n      parser_stack_pop (context_p, &source_start, sizeof (scanner_source_start_t));\n      scanner_pop_literal_pool (context_p, scanner_context_p);\n      scanner_context_p->mode = SCAN_MODE_CLASS_BODY_NO_SCAN;\n\n      switch (type)\n      {\n        case LEXER_SEMICOLON:\n        {\n          source_p = context_p->source_p - 1;\n          scanner_context_p->mode = SCAN_MODE_CLASS_BODY;\n          break;\n        }\n        case LEXER_RIGHT_BRACE:\n        {\n          source_p = context_p->source_p - 1;\n          break;\n        }\n        default:\n        {\n          if (!(context_p->token.flags & LEXER_WAS_NEWLINE))\n          {\n            break;\n          }\n\n          if (type == LEXER_LEFT_SQUARE)\n          {\n            source_p = context_p->source_p - 1;\n            break;\n          }\n\n          if (type == LEXER_LITERAL)\n          {\n            if (context_p->token.lit_location.type == LEXER_IDENT_LITERAL\n                || context_p->token.lit_location.type == LEXER_NUMBER_LITERAL)\n            {\n              source_p = context_p->token.lit_location.char_p;\n            }\n            else if (context_p->token.lit_location.type == LEXER_STRING_LITERAL)\n            {\n              source_p = context_p->token.lit_location.char_p - 1;\n            }\n            break;\n          }\n\n          if (type == context_p->token.keyword_type && type != LEXER_EOS)\n          {\n            /* Convert keyword to literal. */\n            source_p = context_p->token.lit_location.char_p;\n            context_p->token.type = LEXER_LITERAL;\n          }\n          break;\n        }\n      }\n\n      if (JERRY_UNLIKELY (source_p == NULL))\n      {\n        scanner_raise_error (context_p);\n      }\n\n      scanner_location_info_t *location_info_p;\n      location_info_p = (scanner_location_info_t *) scanner_insert_info (context_p,\n                                                                         source_start.source_p,\n                                                                         sizeof (scanner_location_info_t));\n      location_info_p->info.type = SCANNER_TYPE_CLASS_FIELD_INITIALIZER_END;\n      location_info_p->location.source_p = source_p;\n      location_info_p->location.line = context_p->token.line;\n      location_info_p->location.column = context_p->token.column;\n      return SCAN_KEEP_TOKEN;\n    }\n    case SCAN_STACK_FUNCTION_PARAMETERS:\n    {\n      parser_stack_pop_uint8 (context_p);\n\n      if (type != LEXER_RIGHT_PAREN && (type != LEXER_EOS || context_p->stack_top_uint8 != SCAN_STACK_SCRIPT_FUNCTION))\n      {\n        break;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS;\n      return SCAN_KEEP_TOKEN;\n    }\n    default:\n    {\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_END;\n      return SCAN_KEEP_TOKEN;\n    }\n  }\n\n  scanner_raise_error (context_p);\n  return SCAN_NEXT_TOKEN;\n} /* scanner_scan_primary_expression_end */\n\n/**\n * Scan statements.\n *\n * @return SCAN_NEXT_TOKEN to read the next token, or SCAN_KEEP_TOKEN to do nothing\n */\nstatic scan_return_types_t\nscanner_scan_statement (parser_context_t *context_p, /**< context */\n                        scanner_context_t *scanner_context_p, /**< scanner context */\n                        lexer_token_type_t type, /**< current token type */\n                        scan_stack_modes_t stack_top) /**< current stack top */\n{\n  switch (type)\n  {\n    case LEXER_SEMICOLON:\n    {\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_END;\n      return SCAN_KEEP_TOKEN;\n    }\n    case LEXER_LEFT_BRACE:\n    {\n      scanner_literal_pool_t *literal_pool_p;\n      literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, 0);\n      literal_pool_p->source_p = context_p->source_p;\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;\n      parser_stack_push_uint8 (context_p, SCAN_STACK_BLOCK_STATEMENT);\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_DO:\n    {\n      scanner_context_p->mode = SCAN_MODE_STATEMENT;\n      parser_stack_push_uint8 (context_p, SCAN_STACK_DO_STATEMENT);\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_TRY:\n    {\n      lexer_next_token (context_p);\n\n      if (context_p->token.type != LEXER_LEFT_BRACE)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      scanner_literal_pool_t *literal_pool_p;\n      literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, 0);\n      literal_pool_p->source_p = context_p->source_p;\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;\n      parser_stack_push_uint8 (context_p, SCAN_STACK_TRY_STATEMENT);\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_DEBUGGER:\n    {\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_END;\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_IF:\n    case LEXER_KEYW_WITH:\n    case LEXER_KEYW_SWITCH:\n    {\n      lexer_next_token (context_p);\n      if (context_p->token.type != LEXER_LEFT_PAREN)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      uint8_t mode = SCAN_STACK_STATEMENT_WITH_EXPR;\n\n      if (type == LEXER_KEYW_IF)\n      {\n        parser_stack_push_uint8 (context_p, SCAN_STACK_IF_STATEMENT);\n      }\n      else if (type == LEXER_KEYW_WITH)\n      {\n        mode = SCAN_STACK_WITH_EXPRESSION;\n      }\n      else if (type == LEXER_KEYW_SWITCH)\n      {\n        mode = SCAN_STACK_SWITCH_EXPRESSION;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n      parser_stack_push_uint8 (context_p, mode);\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_WHILE:\n    {\n      lexer_next_token (context_p);\n\n      if (context_p->token.type != LEXER_LEFT_PAREN)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n      scanner_source_start_t source_start;\n      source_start.source_p = context_p->source_p;\n\n      parser_stack_push (context_p, &source_start, sizeof (scanner_source_start_t));\n      parser_stack_push_uint8 (context_p, SCAN_STACK_WHILE_EXPRESSION);\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_FOR:\n    {\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_KEYW_AWAIT)\n      {\n        lexer_next_token (context_p);\n      }\n\n      if (context_p->token.type != LEXER_LEFT_PAREN)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      scanner_for_statement_t for_statement;\n      for_statement.u.source_p = context_p->source_p;\n      uint8_t stack_mode = SCAN_STACK_FOR_START;\n      scan_return_types_t return_type = SCAN_KEEP_TOKEN;\n\n      lexer_next_token (context_p);\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n      const uint8_t *source_p = context_p->source_p;\n\n      switch (context_p->token.type)\n      {\n        case LEXER_SEMICOLON:\n        {\n          scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n          break;\n        }\n        case LEXER_KEYW_VAR:\n        {\n          scanner_context_p->mode = SCAN_MODE_VAR_STATEMENT;\n          stack_mode = SCAN_STACK_FOR_VAR_START;\n          return_type = SCAN_NEXT_TOKEN;\n          break;\n        }\n        case LEXER_LEFT_BRACE:\n        case LEXER_LEFT_SQUARE:\n        {\n          stack_mode = SCAN_STACK_FOR_START_PATTERN;\n          break;\n        }\n        case LEXER_LITERAL:\n        {\n          if (!lexer_token_is_let (context_p))\n          {\n            break;\n          }\n\n          parser_line_counter_t line = context_p->line;\n          parser_line_counter_t column = context_p->column;\n\n          if (lexer_check_arrow (context_p))\n          {\n            context_p->source_p = source_p;\n            context_p->line = line;\n            context_p->column = column;\n            context_p->token.flags &= (uint8_t) ~LEXER_NO_SKIP_SPACES;\n            break;\n          }\n\n          lexer_next_token (context_p);\n\n          type = (lexer_token_type_t) context_p->token.type;\n\n          if (type != LEXER_LEFT_SQUARE && type != LEXER_LEFT_BRACE\n              && (type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL))\n          {\n            scanner_info_t *info_p = scanner_insert_info (context_p, source_p, sizeof (scanner_info_t));\n            info_p->type = SCANNER_TYPE_LET_EXPRESSION;\n\n            scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n            break;\n          }\n\n          scanner_context_p->mode = SCAN_MODE_VAR_STATEMENT;\n          /* FALLTHRU */\n        }\n        case LEXER_KEYW_LET:\n        case LEXER_KEYW_CONST:\n        {\n          scanner_literal_pool_t *literal_pool_p;\n          literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, 0);\n          literal_pool_p->source_p = source_p;\n\n          if (scanner_context_p->mode == SCAN_MODE_PRIMARY_EXPRESSION)\n          {\n            scanner_context_p->mode = SCAN_MODE_VAR_STATEMENT;\n            return_type = SCAN_NEXT_TOKEN;\n          }\n\n          stack_mode =\n            ((context_p->token.type == LEXER_KEYW_CONST) ? SCAN_STACK_FOR_CONST_START : SCAN_STACK_FOR_LET_START);\n          break;\n        }\n      }\n\n      parser_stack_push (context_p, &for_statement, sizeof (scanner_for_statement_t));\n      parser_stack_push_uint8 (context_p, stack_mode);\n      return return_type;\n    }\n    case LEXER_KEYW_VAR:\n    {\n      scanner_context_p->mode = SCAN_MODE_VAR_STATEMENT;\n      parser_stack_push_uint8 (context_p, SCAN_STACK_VAR);\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_LET:\n    {\n      scanner_context_p->mode = SCAN_MODE_VAR_STATEMENT;\n      parser_stack_push_uint8 (context_p, SCAN_STACK_LET);\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_CONST:\n    {\n      scanner_context_p->mode = SCAN_MODE_VAR_STATEMENT;\n      parser_stack_push_uint8 (context_p, SCAN_STACK_CONST);\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_THROW:\n    {\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_RETURN:\n    {\n      lexer_next_token (context_p);\n\n      if (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->token.type != LEXER_SEMICOLON\n          && context_p->token.type != LEXER_EOS && context_p->token.type != LEXER_RIGHT_BRACE)\n      {\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n        return SCAN_KEEP_TOKEN;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_END;\n      return SCAN_KEEP_TOKEN;\n    }\n    case LEXER_KEYW_BREAK:\n    case LEXER_KEYW_CONTINUE:\n    {\n      lexer_next_token (context_p);\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_END;\n\n      if (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->token.type == LEXER_LITERAL\n          && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n      {\n        return SCAN_NEXT_TOKEN;\n      }\n      return SCAN_KEEP_TOKEN;\n    }\n    case LEXER_KEYW_CASE:\n    case LEXER_KEYW_DEFAULT:\n    {\n      if (stack_top != SCAN_STACK_SWITCH_BLOCK)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      scanner_case_info_t *case_info_p;\n      case_info_p = (scanner_case_info_t *) scanner_malloc (context_p, sizeof (scanner_case_info_t));\n\n      *(scanner_context_p->active_switch_statement.last_case_p) = case_info_p;\n      scanner_context_p->active_switch_statement.last_case_p = &case_info_p->next_p;\n\n      case_info_p->next_p = NULL;\n      scanner_get_location (&case_info_p->location, context_p);\n\n      if (type == LEXER_KEYW_DEFAULT)\n      {\n        lexer_next_token (context_p);\n\n        if (context_p->token.type != LEXER_COLON)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        scanner_context_p->mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;\n        return SCAN_NEXT_TOKEN;\n      }\n\n      scanner_source_start_t source_start;\n      source_start.source_p = context_p->source_p;\n\n      parser_stack_push (context_p, &source_start, sizeof (scanner_source_start_t));\n      parser_stack_push_uint8 (context_p, SCAN_STACK_CASE_STATEMENT);\n\n      scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_FUNCTION:\n    {\n      if (context_p->status_flags & PARSER_INSIDE_CLASS_FIELD)\n      {\n        scanner_context_p->status_flags |= SCANNER_CONTEXT_RESTORE_INSIDE_CLASS_FIELD_FLAG;\n        context_p->status_flags &= (uint32_t) ~(PARSER_INSIDE_CLASS_FIELD);\n      }\n      uint16_t status_flags = SCANNER_LITERAL_POOL_FUNCTION | SCANNER_LITERAL_POOL_FUNCTION_STATEMENT;\n\n      if (scanner_context_p->async_source_p != NULL)\n      {\n        scanner_context_p->status_flags |= SCANNER_CONTEXT_THROW_ERR_ASYNC_FUNCTION;\n        status_flags |= SCANNER_LITERAL_POOL_ASYNC;\n      }\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_MULTIPLY)\n      {\n        status_flags |= SCANNER_LITERAL_POOL_GENERATOR;\n        lexer_next_token (context_p);\n      }\n\n      if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      lexer_lit_location_t *literal_p = scanner_add_literal (context_p, scanner_context_p);\n\n      const uint8_t mask = (SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_FUNC | SCANNER_LITERAL_IS_LOCAL);\n\n      if ((literal_p->type & SCANNER_LITERAL_IS_LOCAL)\n          && (literal_p->type & mask) != (SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_DESTRUCTURED_ARG)\n          && (literal_p->type & mask) != SCANNER_LITERAL_IS_LOCAL_FUNC)\n      {\n        scanner_raise_redeclaration_error (context_p);\n      }\n\n      scanner_literal_pool_t *literal_pool_p = scanner_context_p->active_literal_pool_p;\n\n      if (!(literal_pool_p->status_flags & SCANNER_LITERAL_POOL_FUNCTION)\n          && (literal_p->type & (SCANNER_LITERAL_IS_VAR)))\n      {\n        scanner_raise_redeclaration_error (context_p);\n      }\n\n      literal_p->type |= SCANNER_LITERAL_IS_LOCAL_FUNC;\n\n      scanner_context_p->status_flags &= (uint16_t) ~SCANNER_CONTEXT_THROW_ERR_ASYNC_FUNCTION;\n\n      scanner_push_literal_pool (context_p, scanner_context_p, status_flags);\n\n      scanner_context_p->mode = SCAN_MODE_FUNCTION_ARGUMENTS;\n      parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_STATEMENT);\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_CLASS:\n    {\n      lexer_lit_location_t *literal_p;\n      literal_p = scanner_push_class_declaration (context_p, scanner_context_p, SCAN_STACK_CLASS_STATEMENT);\n\n      if (literal_p == NULL)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      scanner_detect_invalid_let (context_p, literal_p);\n      literal_p->type |= SCANNER_LITERAL_IS_LET;\n\n      if (literal_p->type & SCANNER_LITERAL_IS_USED)\n      {\n        literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;\n      }\n\n#if JERRY_MODULE_SYSTEM\n      if (scanner_context_p->active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_EXPORT)\n      {\n        literal_p->type |= SCANNER_LITERAL_NO_REG;\n        scanner_context_p->active_literal_pool_p->status_flags &= (uint16_t) ~SCANNER_LITERAL_POOL_IN_EXPORT;\n      }\n#endif /* JERRY_MODULE_SYSTEM */\n\n      return SCAN_NEXT_TOKEN;\n    }\n#if JERRY_MODULE_SYSTEM\n    case LEXER_KEYW_IMPORT:\n    {\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_DOT)\n      {\n        scanner_check_import_meta (context_p);\n        scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n        return SCAN_KEEP_TOKEN;\n      }\n\n      if (context_p->token.type == LEXER_LEFT_PAREN)\n      {\n        scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n        return SCAN_KEEP_TOKEN;\n      }\n\n      if (stack_top != SCAN_STACK_SCRIPT)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_END;\n\n      if (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL)\n      {\n        return SCAN_NEXT_TOKEN;\n      }\n\n      bool parse_imports = true;\n\n      if (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n      {\n        lexer_lit_location_t *literal_p = scanner_add_literal (context_p, scanner_context_p);\n\n        scanner_detect_invalid_let (context_p, literal_p);\n        literal_p->type |= SCANNER_LITERAL_IS_LOCAL | SCANNER_LITERAL_NO_REG;\n\n        lexer_next_token (context_p);\n\n        if (context_p->token.type == LEXER_COMMA)\n        {\n          lexer_next_token (context_p);\n        }\n        else\n        {\n          parse_imports = false;\n        }\n      }\n\n      if (parse_imports)\n      {\n        if (context_p->token.type == LEXER_MULTIPLY)\n        {\n          lexer_next_token (context_p);\n          if (!lexer_token_is_identifier (context_p, \"as\", 2))\n          {\n            scanner_raise_error (context_p);\n          }\n\n          lexer_next_token (context_p);\n\n          if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          lexer_lit_location_t *literal_p = scanner_add_literal (context_p, scanner_context_p);\n\n          scanner_detect_invalid_let (context_p, literal_p);\n          literal_p->type |= SCANNER_LITERAL_IS_LOCAL | SCANNER_LITERAL_NO_REG;\n\n          lexer_next_token (context_p);\n        }\n        else if (context_p->token.type == LEXER_LEFT_BRACE)\n        {\n          lexer_next_token (context_p);\n\n          while (context_p->token.type != LEXER_RIGHT_BRACE)\n          {\n            if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n            {\n              scanner_raise_error (context_p);\n            }\n\n            const uint8_t *source_p = context_p->source_p;\n\n            if (lexer_check_next_character (context_p, LIT_CHAR_LOWERCASE_A))\n            {\n              lexer_next_token (context_p);\n\n              if (!lexer_token_is_identifier (context_p, \"as\", 2))\n              {\n                scanner_raise_error (context_p);\n              }\n\n              lexer_next_token (context_p);\n\n              if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n              {\n                scanner_raise_error (context_p);\n              }\n\n              source_p = context_p->source_p;\n            }\n\n            lexer_lit_location_t *literal_p = scanner_add_literal (context_p, scanner_context_p);\n\n            if (literal_p->type & (SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_VAR | SCANNER_LITERAL_IS_LOCAL))\n            {\n              context_p->source_p = source_p;\n              scanner_raise_redeclaration_error (context_p);\n            }\n\n            if (literal_p->type & SCANNER_LITERAL_IS_FUNC)\n            {\n              literal_p->type &= (uint8_t) ~SCANNER_LITERAL_IS_FUNC;\n            }\n\n            literal_p->type |= SCANNER_LITERAL_IS_LOCAL | SCANNER_LITERAL_NO_REG;\n\n            lexer_next_token (context_p);\n\n            if (context_p->token.type != LEXER_RIGHT_BRACE)\n            {\n              if (context_p->token.type != LEXER_COMMA)\n              {\n                scanner_raise_error (context_p);\n              }\n\n              lexer_next_token (context_p);\n            }\n          }\n\n          lexer_next_token (context_p);\n        }\n        else\n        {\n          scanner_raise_error (context_p);\n        }\n      }\n\n      if (!lexer_token_is_identifier (context_p, \"from\", 4))\n      {\n        scanner_raise_error (context_p);\n      }\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type != LEXER_STRING_LITERAL)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      return SCAN_NEXT_TOKEN;\n    }\n    case LEXER_KEYW_EXPORT:\n    {\n      if (stack_top != SCAN_STACK_SCRIPT)\n      {\n        scanner_raise_error (context_p);\n      }\n\n      lexer_next_token (context_p);\n\n      if (context_p->token.type == LEXER_KEYW_DEFAULT)\n      {\n        lexer_next_token (context_p);\n        parser_stack_push_uint8 (context_p, SCAN_STACK_EXPORT_DEFAULT);\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n        return SCAN_KEEP_TOKEN;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT_END;\n\n      if (context_p->token.type == LEXER_MULTIPLY)\n      {\n        lexer_next_token (context_p);\n\n        if (lexer_token_is_identifier (context_p, \"as\", 2))\n        {\n          lexer_next_token (context_p);\n\n          if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          lexer_next_token (context_p);\n        }\n\n        if (!lexer_token_is_identifier (context_p, \"from\", 4))\n        {\n          scanner_raise_error (context_p);\n        }\n\n        lexer_next_token (context_p);\n\n        if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        return SCAN_NEXT_TOKEN;\n      }\n\n      scanner_source_start_t source_start;\n      source_start.source_p = context_p->source_p;\n\n      if (context_p->token.type == LEXER_LEFT_BRACE)\n      {\n        lexer_next_token (context_p);\n\n        while (context_p->token.type != LEXER_RIGHT_BRACE)\n        {\n          if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          lexer_next_token (context_p);\n\n          if (lexer_token_is_identifier (context_p, \"as\", 2))\n          {\n            lexer_next_token (context_p);\n\n            if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n            {\n              scanner_raise_error (context_p);\n            }\n\n            lexer_next_token (context_p);\n          }\n\n          if (context_p->token.type != LEXER_RIGHT_BRACE)\n          {\n            if (context_p->token.type != LEXER_COMMA)\n            {\n              scanner_raise_error (context_p);\n            }\n\n            lexer_next_token (context_p);\n          }\n        }\n\n        lexer_next_token (context_p);\n\n        if (!lexer_token_is_identifier (context_p, \"from\", 4))\n        {\n          return SCAN_KEEP_TOKEN;\n        }\n\n        scanner_info_t *info_p = scanner_insert_info (context_p, source_start.source_p, sizeof (scanner_info_t));\n        info_p->type = SCANNER_TYPE_EXPORT_MODULE_SPECIFIER;\n\n        lexer_next_token (context_p);\n\n        if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        return SCAN_NEXT_TOKEN;\n      }\n\n      switch (context_p->token.type)\n      {\n        case LEXER_KEYW_CLASS:\n        case LEXER_KEYW_LET:\n        case LEXER_KEYW_CONST:\n        case LEXER_KEYW_VAR:\n        {\n          scanner_context_p->active_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_IN_EXPORT;\n          break;\n        }\n      }\n\n      scanner_context_p->mode = SCAN_MODE_STATEMENT;\n      return SCAN_KEEP_TOKEN;\n    }\n#endif /* JERRY_MODULE_SYSTEM */\n    default:\n    {\n      break;\n    }\n  }\n\n  scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n  if (type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)\n  {\n    if (JERRY_UNLIKELY (lexer_check_next_character (context_p, LIT_CHAR_COLON)))\n    {\n      lexer_consume_next_character (context_p);\n      scanner_context_p->mode = SCAN_MODE_STATEMENT;\n      return SCAN_NEXT_TOKEN;\n    }\n\n    JERRY_ASSERT (context_p->token.flags & LEXER_NO_SKIP_SPACES);\n\n    /* The colon needs to be checked first because the parser also checks\n     * it first, and this check skips the spaces which affects source_p. */\n    if (JERRY_UNLIKELY (lexer_check_arrow (context_p)))\n    {\n      scanner_scan_simple_arrow (context_p, scanner_context_p, context_p->source_p);\n      return SCAN_KEEP_TOKEN;\n    }\n\n    if (JERRY_UNLIKELY (lexer_token_is_let (context_p)))\n    {\n      lexer_lit_location_t let_literal = context_p->token.lit_location;\n      const uint8_t *source_p = context_p->source_p;\n\n      lexer_next_token (context_p);\n\n      type = (lexer_token_type_t) context_p->token.type;\n\n      if (type == LEXER_LEFT_SQUARE || type == LEXER_LEFT_BRACE\n          || (type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL))\n      {\n        scanner_context_p->mode = SCAN_MODE_VAR_STATEMENT;\n        parser_stack_push_uint8 (context_p, SCAN_STACK_LET);\n        return SCAN_KEEP_TOKEN;\n      }\n\n      scanner_info_t *info_p = scanner_insert_info (context_p, source_p, sizeof (scanner_info_t));\n      info_p->type = SCANNER_TYPE_LET_EXPRESSION;\n\n      lexer_lit_location_t *lit_location_p =\n        scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p, &let_literal);\n      lit_location_p->type |= SCANNER_LITERAL_IS_USED;\n\n      if (scanner_context_p->active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_WITH)\n      {\n        lit_location_p->type |= SCANNER_LITERAL_NO_REG;\n      }\n\n      scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n      return SCAN_KEEP_TOKEN;\n    }\n\n    if (JERRY_UNLIKELY (lexer_token_is_async (context_p)))\n    {\n      scanner_context_p->async_source_p = context_p->source_p;\n\n      if (scanner_check_async_function (context_p, scanner_context_p))\n      {\n        scanner_context_p->mode = SCAN_MODE_STATEMENT;\n      }\n      return SCAN_KEEP_TOKEN;\n    }\n\n    scanner_add_reference (context_p, scanner_context_p);\n\n    scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n    return SCAN_NEXT_TOKEN;\n  }\n\n  return SCAN_KEEP_TOKEN;\n} /* scanner_scan_statement */\n\n/**\n * Scan statement terminator.\n *\n * @return SCAN_NEXT_TOKEN to read the next token, or SCAN_KEEP_TOKEN to do nothing\n */\nstatic scan_return_types_t\nscanner_scan_statement_end (parser_context_t *context_p, /**< context */\n                            scanner_context_t *scanner_context_p, /**< scanner context */\n                            lexer_token_type_t type) /**< current token type */\n{\n  bool terminator_found = false;\n\n  if (type == LEXER_SEMICOLON)\n  {\n    lexer_next_token (context_p);\n    terminator_found = true;\n  }\n\n  while (true)\n  {\n    type = (lexer_token_type_t) context_p->token.type;\n\n    switch (context_p->stack_top_uint8)\n    {\n      case SCAN_STACK_SCRIPT:\n      case SCAN_STACK_SCRIPT_FUNCTION:\n      {\n        if (type == LEXER_EOS)\n        {\n          return SCAN_NEXT_TOKEN;\n        }\n        break;\n      }\n      case SCAN_STACK_BLOCK_STATEMENT:\n      case SCAN_STACK_CLASS_STATEMENT:\n      case SCAN_STACK_FUNCTION_STATEMENT:\n      {\n        if (type != LEXER_RIGHT_BRACE)\n        {\n          break;\n        }\n\n        if (scanner_context_p->status_flags & SCANNER_CONTEXT_RESTORE_INSIDE_CLASS_FIELD_FLAG)\n        {\n          context_p->status_flags |= PARSER_INSIDE_CLASS_FIELD;\n          scanner_context_p->status_flags &= (uint16_t) ~(SCANNER_CONTEXT_RESTORE_INSIDE_CLASS_FIELD_FLAG);\n        }\n\n        if (context_p->stack_top_uint8 != SCAN_STACK_CLASS_STATEMENT)\n        {\n          scanner_pop_literal_pool (context_p, scanner_context_p);\n        }\n\n        terminator_found = true;\n        parser_stack_pop_uint8 (context_p);\n#if JERRY_MODULE_SYSTEM\n        scanner_context_p->active_literal_pool_p->status_flags &= (uint16_t) ~SCANNER_LITERAL_POOL_IN_EXPORT;\n#endif /* JERRY_MODULE_SYSTEM */\n        lexer_next_token (context_p);\n        continue;\n      }\n      case SCAN_STACK_FUNCTION_EXPRESSION:\n      case SCAN_STACK_FUNCTION_ARROW:\n      {\n        if (type != LEXER_RIGHT_BRACE)\n        {\n          break;\n        }\n\n        scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n\n        if (context_p->stack_top_uint8 == SCAN_STACK_FUNCTION_ARROW)\n        {\n          scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n        }\n\n        scanner_pop_literal_pool (context_p, scanner_context_p);\n        parser_stack_pop_uint8 (context_p);\n\n#if JERRY_MODULE_SYSTEM\n        if (context_p->stack_top_uint8 == SCAN_STACK_EXPORT_DEFAULT)\n        {\n          terminator_found = true;\n          parser_stack_pop_uint8 (context_p);\n          lexer_next_token (context_p);\n          continue;\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n        return SCAN_NEXT_TOKEN;\n      }\n      case SCAN_STACK_FUNCTION_PROPERTY:\n      {\n        if (type != LEXER_RIGHT_BRACE)\n        {\n          break;\n        }\n\n        bool has_super_reference =\n          (scanner_context_p->active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE) != 0;\n\n        scanner_pop_literal_pool (context_p, scanner_context_p);\n        parser_stack_pop_uint8 (context_p);\n\n        if (context_p->stack_top_uint8 == SCAN_STACK_EXPLICIT_CLASS_CONSTRUCTOR\n            || context_p->stack_top_uint8 == SCAN_STACK_IMPLICIT_CLASS_CONSTRUCTOR)\n        {\n          scanner_context_p->mode = SCAN_MODE_CLASS_BODY;\n          return SCAN_KEEP_TOKEN;\n        }\n\n        if (has_super_reference && context_p->stack_top_uint8 == SCAN_STACK_OBJECT_LITERAL)\n        {\n          *parser_stack_get_prev_uint8 (context_p) |= SCANNER_LITERAL_OBJECT_HAS_SUPER;\n        }\n\n        lexer_next_token (context_p);\n\n        if (context_p->token.type == LEXER_RIGHT_BRACE)\n        {\n          scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n          return SCAN_KEEP_TOKEN;\n        }\n\n        if (context_p->token.type != LEXER_COMMA)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        scanner_context_p->mode = SCAN_MODE_PROPERTY_NAME;\n        return SCAN_KEEP_TOKEN;\n      }\n      case SCAN_STACK_SWITCH_BLOCK:\n      {\n        if (type != LEXER_RIGHT_BRACE)\n        {\n          break;\n        }\n\n        scanner_switch_statement_t switch_statement;\n\n        parser_stack_pop_uint8 (context_p);\n        parser_stack_pop (context_p, &switch_statement, sizeof (scanner_switch_statement_t));\n\n        scanner_context_p->active_switch_statement = switch_statement;\n\n        scanner_pop_literal_pool (context_p, scanner_context_p);\n\n        terminator_found = true;\n        lexer_next_token (context_p);\n        continue;\n      }\n      case SCAN_STACK_IF_STATEMENT:\n      {\n        parser_stack_pop_uint8 (context_p);\n\n        if (type == LEXER_KEYW_ELSE && (terminator_found || (context_p->token.flags & LEXER_WAS_NEWLINE)))\n        {\n          scanner_check_function_after_if (context_p, scanner_context_p);\n          return SCAN_KEEP_TOKEN;\n        }\n\n        continue;\n      }\n      case SCAN_STACK_WITH_STATEMENT:\n      {\n        scanner_literal_pool_t *literal_pool_p = scanner_context_p->active_literal_pool_p;\n\n        JERRY_ASSERT (literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_WITH);\n\n        parser_stack_pop_uint8 (context_p);\n\n        if (context_p->stack_top_uint8 == 0)\n        {\n          literal_pool_p->status_flags &= (uint16_t) ~SCANNER_LITERAL_POOL_IN_WITH;\n        }\n\n        parser_stack_pop_uint8 (context_p);\n        continue;\n      }\n      case SCAN_STACK_DO_STATEMENT:\n      {\n        parser_stack_pop_uint8 (context_p);\n\n        if (type != LEXER_KEYW_WHILE || (!terminator_found && !(context_p->token.flags & LEXER_WAS_NEWLINE)))\n        {\n          scanner_raise_error (context_p);\n        }\n\n        lexer_next_token (context_p);\n        if (context_p->token.type != LEXER_LEFT_PAREN)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        parser_stack_push_uint8 (context_p, SCAN_STACK_DO_EXPRESSION);\n        scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;\n        return SCAN_NEXT_TOKEN;\n      }\n      case SCAN_STACK_DO_EXPRESSION:\n      {\n        parser_stack_pop_uint8 (context_p);\n        terminator_found = true;\n        continue;\n      }\n      case SCAN_STACK_CLASS_STATIC_BLOCK:\n      {\n        if (type != LEXER_RIGHT_BRACE)\n        {\n          break;\n        }\n\n        scanner_pop_literal_pool (context_p, scanner_context_p);\n        scanner_source_start_t start_range;\n        parser_stack_pop_uint8 (context_p);\n        parser_stack_pop (context_p, &start_range, sizeof (scanner_source_start_t));\n\n        scanner_context_p->mode = SCAN_MODE_CLASS_BODY_NO_SCAN;\n\n        scanner_location_info_t *location_info_p;\n        location_info_p = (scanner_location_info_t *) scanner_insert_info (context_p,\n                                                                           start_range.source_p,\n                                                                           sizeof (scanner_location_info_t));\n\n        location_info_p->info.type = SCANNER_TYPE_CLASS_STATIC_BLOCK_END;\n        location_info_p->location.source_p = context_p->source_p;\n        location_info_p->location.line = context_p->token.line;\n        location_info_p->location.column = context_p->token.column;\n\n        lexer_scan_identifier (context_p, LEXER_PARSE_CHECK_KEYWORDS | LEXER_PARSE_NO_STRICT_IDENT_ERROR);\n        return SCAN_KEEP_TOKEN;\n      }\n      case SCAN_STACK_PRIVATE_BLOCK_EARLY:\n      {\n        parser_list_iterator_t literal_iterator;\n        lexer_lit_location_t *literal_p;\n\n        parser_list_iterator_init (&scanner_context_p->active_literal_pool_p->literal_pool, &literal_iterator);\n\n        while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)\n        {\n          if ((literal_p->type & (SCANNER_LITERAL_IS_LET | SCANNER_LITERAL_IS_CONST))\n              && (literal_p->type & SCANNER_LITERAL_IS_USED))\n          {\n            literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;\n          }\n        }\n        /* FALLTHRU */\n      }\n      case SCAN_STACK_PRIVATE_BLOCK:\n      {\n        parser_stack_pop_uint8 (context_p);\n        scanner_pop_literal_pool (context_p, scanner_context_p);\n        continue;\n      }\n#if JERRY_MODULE_SYSTEM\n      case SCAN_STACK_EXPORT_DEFAULT:\n      {\n        parser_stack_pop_uint8 (context_p);\n        lexer_lit_location_t *location_p =\n          scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p, &lexer_default_literal);\n        location_p->type |= SCANNER_LITERAL_IS_VAR;\n        continue;\n      }\n#endif /* JERRY_MODULE_SYSTEM */\n      default:\n      {\n        JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_TRY_STATEMENT\n                      || context_p->stack_top_uint8 == SCAN_STACK_CATCH_STATEMENT);\n\n        if (type != LEXER_RIGHT_BRACE)\n        {\n          break;\n        }\n\n        uint8_t stack_top = context_p->stack_top_uint8;\n        parser_stack_pop_uint8 (context_p);\n        lexer_next_token (context_p);\n\n        scanner_pop_literal_pool (context_p, scanner_context_p);\n\n        /* A finally statement is optional after a try or catch statement. */\n        if (context_p->token.type == LEXER_KEYW_FINALLY)\n        {\n          lexer_next_token (context_p);\n\n          if (context_p->token.type != LEXER_LEFT_BRACE)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          scanner_literal_pool_t *literal_pool_p;\n          literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, 0);\n          literal_pool_p->source_p = context_p->source_p;\n\n          parser_stack_push_uint8 (context_p, SCAN_STACK_BLOCK_STATEMENT);\n          scanner_context_p->mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;\n          return SCAN_NEXT_TOKEN;\n        }\n\n        if (stack_top == SCAN_STACK_CATCH_STATEMENT)\n        {\n          terminator_found = true;\n          continue;\n        }\n\n        /* A catch statement must be present after a try statement unless a finally is provided. */\n        if (context_p->token.type != LEXER_KEYW_CATCH)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        lexer_next_token (context_p);\n\n        scanner_literal_pool_t *literal_pool_p;\n        literal_pool_p = scanner_push_literal_pool (context_p, scanner_context_p, 0);\n        literal_pool_p->source_p = context_p->source_p;\n        parser_stack_push_uint8 (context_p, SCAN_STACK_CATCH_STATEMENT);\n\n        if (context_p->token.type == LEXER_LEFT_BRACE)\n        {\n          scanner_context_p->mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;\n          return SCAN_NEXT_TOKEN;\n        }\n\n        if (context_p->token.type != LEXER_LEFT_PAREN)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        lexer_next_token (context_p);\n\n        if (context_p->token.type == LEXER_LEFT_SQUARE || context_p->token.type == LEXER_LEFT_BRACE)\n        {\n          scanner_push_destructuring_pattern (context_p, scanner_context_p, SCANNER_BINDING_CATCH, false);\n\n          if (context_p->token.type == LEXER_LEFT_SQUARE)\n          {\n            parser_stack_push_uint8 (context_p, SCAN_STACK_ARRAY_LITERAL);\n            scanner_context_p->mode = SCAN_MODE_BINDING;\n            return SCAN_NEXT_TOKEN;\n          }\n\n          parser_stack_push_uint8 (context_p, 0);\n          parser_stack_push_uint8 (context_p, SCAN_STACK_OBJECT_LITERAL);\n          scanner_context_p->mode = SCAN_MODE_PROPERTY_NAME;\n          return SCAN_KEEP_TOKEN;\n        }\n\n        if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        lexer_lit_location_t *lit_location_p = scanner_add_literal (context_p, scanner_context_p);\n        lit_location_p->type |= SCANNER_LITERAL_IS_LOCAL;\n\n        lexer_next_token (context_p);\n\n        if (context_p->token.type != LEXER_RIGHT_PAREN)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        lexer_next_token (context_p);\n\n        if (context_p->token.type != LEXER_LEFT_BRACE)\n        {\n          scanner_raise_error (context_p);\n        }\n\n        scanner_context_p->mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;\n        return SCAN_NEXT_TOKEN;\n      }\n    }\n\n    if (!terminator_found && !(context_p->token.flags & LEXER_WAS_NEWLINE))\n    {\n      scanner_raise_error (context_p);\n    }\n\n    scanner_context_p->mode = SCAN_MODE_STATEMENT;\n    return SCAN_KEEP_TOKEN;\n  }\n} /* scanner_scan_statement_end */\n\n/**\n * Scan the whole source code.\n */\nvoid JERRY_ATTR_NOINLINE\nscanner_scan_all (parser_context_t *context_p) /**< context */\n{\n  scanner_context_t scanner_context;\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    JERRY_DEBUG_MSG (\"\\n--- Scanning start ---\\n\\n\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  scanner_context.context_status_flags = context_p->status_flags;\n  scanner_context.status_flags = SCANNER_CONTEXT_NO_FLAGS;\n#if JERRY_DEBUGGER\n  if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n  {\n    scanner_context.status_flags |= SCANNER_CONTEXT_DEBUGGER_ENABLED;\n  }\n#endif /* JERRY_DEBUGGER */\n  scanner_context.binding_type = SCANNER_BINDING_NONE;\n  scanner_context.active_binding_list_p = NULL;\n  scanner_context.active_literal_pool_p = NULL;\n  scanner_context.active_switch_statement.last_case_p = NULL;\n  scanner_context.end_arguments_p = NULL;\n  scanner_context.async_source_p = NULL;\n\n  /* This assignment must be here because of Apple compilers. */\n  context_p->u.scanner_context_p = &scanner_context;\n  context_p->global_status_flags |= ECMA_PARSE_INTERNAL_PRE_SCANNING;\n\n  parser_stack_init (context_p);\n\n  PARSER_TRY (context_p->try_buffer)\n  {\n    if (context_p->arguments_start_p == NULL)\n    {\n      context_p->source_p = context_p->source_start_p;\n      context_p->source_end_p = context_p->source_start_p + context_p->source_size;\n\n      uint16_t status_flags =\n        (SCANNER_LITERAL_POOL_FUNCTION | SCANNER_LITERAL_POOL_NO_ARGUMENTS | SCANNER_LITERAL_POOL_CAN_EVAL);\n\n      if (context_p->status_flags & PARSER_IS_STRICT)\n      {\n        status_flags |= SCANNER_LITERAL_POOL_IS_STRICT;\n      }\n\n      scanner_literal_pool_t *literal_pool_p = scanner_push_literal_pool (context_p, &scanner_context, status_flags);\n      literal_pool_p->source_p = context_p->source_start_p;\n\n      parser_stack_push_uint8 (context_p, SCAN_STACK_SCRIPT);\n\n      lexer_next_token (context_p);\n      scanner_check_directives (context_p, &scanner_context);\n    }\n    else\n    {\n      context_p->source_p = context_p->arguments_start_p;\n      context_p->source_end_p = context_p->arguments_start_p + context_p->arguments_size;\n\n      uint16_t status_flags = SCANNER_LITERAL_POOL_FUNCTION;\n\n      if (context_p->status_flags & PARSER_IS_STRICT)\n      {\n        status_flags |= SCANNER_LITERAL_POOL_IS_STRICT;\n      }\n\n      if (context_p->status_flags & PARSER_IS_GENERATOR_FUNCTION)\n      {\n        status_flags |= SCANNER_LITERAL_POOL_GENERATOR;\n      }\n      if (context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)\n      {\n        status_flags |= SCANNER_LITERAL_POOL_ASYNC;\n      }\n\n      scanner_push_literal_pool (context_p, &scanner_context, status_flags);\n      scanner_context.mode = SCAN_MODE_FUNCTION_ARGUMENTS;\n      parser_stack_push_uint8 (context_p, SCAN_STACK_SCRIPT_FUNCTION);\n\n      /* Faking the first token. */\n      context_p->token.type = LEXER_LEFT_PAREN;\n    }\n\n    while (true)\n    {\n      lexer_token_type_t type = (lexer_token_type_t) context_p->token.type;\n      scan_stack_modes_t stack_top = (scan_stack_modes_t) context_p->stack_top_uint8;\n\n      switch (scanner_context.mode)\n      {\n        case SCAN_MODE_PRIMARY_EXPRESSION:\n        {\n          if (type == LEXER_ADD || type == LEXER_SUBTRACT || LEXER_IS_UNARY_OP_TOKEN (type))\n          {\n            break;\n          }\n          /* FALLTHRU */\n        }\n        case SCAN_MODE_PRIMARY_EXPRESSION_AFTER_NEW:\n        {\n          if (scanner_scan_primary_expression (context_p, &scanner_context, type, stack_top) != SCAN_NEXT_TOKEN)\n          {\n            continue;\n          }\n          break;\n        }\n        case SCAN_MODE_CLASS_DECLARATION:\n        {\n          if (context_p->token.type == LEXER_KEYW_EXTENDS)\n          {\n            parser_stack_push_uint8 (context_p, SCAN_STACK_CLASS_EXTENDS);\n            scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;\n            break;\n          }\n          else if (context_p->token.type != LEXER_LEFT_BRACE)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          scanner_context.mode = SCAN_MODE_CLASS_BODY;\n          /* FALLTHRU */\n        }\n        case SCAN_MODE_CLASS_BODY:\n        {\n          lexer_skip_empty_statements (context_p);\n          lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS);\n          /* FALLTHRU */\n        }\n        case SCAN_MODE_CLASS_BODY_NO_SCAN:\n        {\n          JERRY_ASSERT (stack_top == SCAN_STACK_IMPLICIT_CLASS_CONSTRUCTOR\n                        || stack_top == SCAN_STACK_EXPLICIT_CLASS_CONSTRUCTOR);\n          JERRY_ASSERT (scanner_context.active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_CLASS_NAME);\n\n          if (context_p->token.type == LEXER_RIGHT_BRACE)\n          {\n            parser_stack_pop_uint8 (context_p);\n\n            scanner_class_info_t *private_members_p;\n            parser_stack_pop (context_p, &private_members_p, sizeof (scanner_class_info_t *));\n\n            private_members_p->info.u8_arg |= SCANNER_SUCCESSFUL_CLASS_SCAN;\n\n            scanner_pop_literal_pool (context_p, &scanner_context);\n\n            JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_CLASS_STATEMENT\n                          || context_p->stack_top_uint8 == SCAN_STACK_CLASS_EXPRESSION);\n\n            if (context_p->stack_top_uint8 == SCAN_STACK_CLASS_STATEMENT)\n            {\n              /* The token is kept to disallow consuming a semicolon after it. */\n              scanner_context.mode = SCAN_MODE_STATEMENT_END;\n              continue;\n            }\n\n            scanner_context.mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n            parser_stack_pop_uint8 (context_p);\n\n#if JERRY_MODULE_SYSTEM\n            if (context_p->stack_top_uint8 == SCAN_STACK_EXPORT_DEFAULT)\n            {\n              /* The token is kept to disallow consuming a semicolon after it. */\n              parser_stack_change_last_uint8 (context_p, SCAN_STACK_CLASS_STATEMENT);\n              scanner_context.mode = SCAN_MODE_STATEMENT_END;\n              continue;\n            }\n#endif /* JERRY_MODULE_SYSTEM */\n            break;\n          }\n\n          bool is_private = false;\n          scanner_private_field_flags_t private_field_flags = SCANNER_PRIVATE_FIELD_PROPERTY;\n\n          if (context_p->token.type == LEXER_HASHMARK)\n          {\n            is_private = true;\n            context_p->token.flags |= LEXER_NO_SKIP_SPACES;\n            lexer_next_token (context_p);\n          }\n\n          bool identifier_found = false;\n\n          if (context_p->token.type == LEXER_LITERAL && LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type)\n              && lexer_compare_literal_to_string (context_p, \"constructor\", 11)\n              && stack_top == SCAN_STACK_IMPLICIT_CLASS_CONSTRUCTOR)\n          {\n            parser_stack_pop_uint8 (context_p);\n            scanner_class_info_t *private_members_p;\n            parser_stack_pop (context_p, &private_members_p, sizeof (scanner_class_info_t *));\n            private_members_p->info.u8_arg = SCANNER_CONSTRUCTOR_EXPLICIT;\n            parser_stack_push (context_p, &private_members_p, sizeof (scanner_class_info_t *));\n            parser_stack_push_uint8 (context_p, SCAN_STACK_EXPLICIT_CLASS_CONSTRUCTOR);\n          }\n          else if (lexer_token_is_identifier (context_p, \"static\", 6))\n          {\n            scanner_source_start_t static_start;\n            static_start.source_p = context_p->source_p - 1;\n\n            lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS);\n            identifier_found = true;\n            private_field_flags |= SCANNER_PRIVATE_FIELD_STATIC;\n\n            if (!is_private && context_p->token.type == LEXER_LEFT_BRACE)\n            {\n              parser_stack_push (context_p, &static_start, sizeof (scanner_source_start_t));\n              parser_stack_push_uint8 (context_p, SCAN_STACK_CLASS_STATIC_BLOCK);\n\n              scanner_literal_pool_t *literal_pool_p =\n                scanner_push_literal_pool (context_p, &scanner_context, SCANNER_LITERAL_POOL_FUNCTION);\n              literal_pool_p->source_p = context_p->source_p - 1;\n\n              lexer_next_token (context_p);\n\n              scanner_context.mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;\n\n              continue;\n            }\n          }\n\n          scanner_context.mode = SCAN_MODE_FUNCTION_ARGUMENTS;\n\n          uint16_t literal_pool_flags = SCANNER_LITERAL_POOL_FUNCTION;\n\n          private_field_flags |= lexer_token_is_identifier (context_p, \"get\", 3) ? SCANNER_PRIVATE_FIELD_GETTER : 0;\n          private_field_flags |= lexer_token_is_identifier (context_p, \"set\", 3) ? SCANNER_PRIVATE_FIELD_SETTER : 0;\n\n          if (private_field_flags & SCANNER_PRIVATE_FIELD_GETTER_SETTER)\n          {\n            private_field_flags &= ~(uint32_t) SCANNER_PRIVATE_FIELD_PROPERTY;\n\n            lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS);\n            identifier_found = true;\n\n            if (context_p->token.type == LEXER_LEFT_PAREN)\n            {\n              if (is_private)\n              {\n                private_field_flags |= SCANNER_PRIVATE_FIELD_METHOD;\n                scanner_add_private_identifier (context_p, private_field_flags);\n              }\n\n              parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PROPERTY);\n              scanner_push_literal_pool (context_p, &scanner_context, SCANNER_LITERAL_POOL_FUNCTION);\n              continue;\n            }\n          }\n          else if (lexer_token_is_identifier (context_p, \"async\", 5))\n          {\n            lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS);\n            identifier_found = true;\n\n            if (!(context_p->token.flags & LEXER_WAS_NEWLINE))\n            {\n              if (context_p->token.type == LEXER_LEFT_PAREN)\n              {\n                if (is_private)\n                {\n                  private_field_flags |= SCANNER_PRIVATE_FIELD_METHOD;\n                  scanner_add_private_identifier (context_p, private_field_flags);\n                }\n\n                parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PROPERTY);\n                scanner_push_literal_pool (context_p, &scanner_context, SCANNER_LITERAL_POOL_FUNCTION);\n                continue;\n              }\n\n              literal_pool_flags |= SCANNER_LITERAL_POOL_ASYNC;\n\n              if (context_p->token.type == LEXER_MULTIPLY)\n              {\n                lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS);\n                literal_pool_flags |= SCANNER_LITERAL_POOL_GENERATOR;\n              }\n            }\n          }\n          else if (context_p->token.type == LEXER_MULTIPLY)\n          {\n            if (is_private)\n            {\n              scanner_raise_error (context_p);\n            }\n\n            lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS);\n            literal_pool_flags |= SCANNER_LITERAL_POOL_GENERATOR;\n          }\n\n          if (context_p->token.type == LEXER_LEFT_SQUARE)\n          {\n            if (is_private)\n            {\n              scanner_raise_error (context_p);\n            }\n\n            if (literal_pool_flags != SCANNER_LITERAL_POOL_FUNCTION)\n            {\n              parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PROPERTY);\n            }\n\n            parser_stack_push_uint8 (context_p, SCANNER_FROM_LITERAL_POOL_TO_COMPUTED (literal_pool_flags));\n            scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;\n            break;\n          }\n\n          if (context_p->token.type == LEXER_HASHMARK)\n          {\n            if (is_private)\n            {\n              scanner_raise_error (context_p);\n            }\n\n            is_private = true;\n            context_p->token.flags |= LEXER_NO_SKIP_SPACES;\n            lexer_next_token (context_p);\n          }\n\n          if (is_private)\n          {\n            if (lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))\n            {\n              private_field_flags |= SCANNER_PRIVATE_FIELD_METHOD;\n            }\n\n            scanner_add_private_identifier (context_p, private_field_flags);\n          }\n\n          if (context_p->token.type == LEXER_LITERAL)\n          {\n            lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS);\n            identifier_found = true;\n          }\n\n          if (context_p->token.type == LEXER_SEMICOLON)\n          {\n            scanner_context.mode = SCAN_MODE_CLASS_BODY;\n            continue;\n          }\n\n          if (!identifier_found)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          if (context_p->token.type == LEXER_LEFT_PAREN)\n          {\n            if (literal_pool_flags & SCANNER_LITERAL_POOL_GENERATOR)\n            {\n              context_p->status_flags |= PARSER_IS_GENERATOR_FUNCTION;\n            }\n\n            parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PROPERTY);\n            scanner_push_literal_pool (context_p, &scanner_context, literal_pool_flags);\n            continue;\n          }\n\n          if (literal_pool_flags & SCANNER_LITERAL_POOL_GENERATOR)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          if (context_p->token.type == LEXER_ASSIGN)\n          {\n            scanner_push_class_field_initializer (context_p, &scanner_context);\n            break;\n          }\n\n          if (context_p->token.type != LEXER_RIGHT_BRACE && !(context_p->token.flags & LEXER_WAS_NEWLINE))\n          {\n            scanner_raise_error (context_p);\n          }\n\n          scanner_context.mode = SCAN_MODE_CLASS_BODY_NO_SCAN;\n          continue;\n        }\n        case SCAN_MODE_POST_PRIMARY_EXPRESSION:\n        {\n          if (scanner_scan_post_primary_expression (context_p, &scanner_context, type, stack_top))\n          {\n            break;\n          }\n          type = (lexer_token_type_t) context_p->token.type;\n          /* FALLTHRU */\n        }\n        case SCAN_MODE_PRIMARY_EXPRESSION_END:\n        {\n          if (scanner_scan_primary_expression_end (context_p, &scanner_context, type, stack_top) != SCAN_NEXT_TOKEN)\n          {\n            continue;\n          }\n          break;\n        }\n        case SCAN_MODE_STATEMENT_OR_TERMINATOR:\n        {\n          if (type == LEXER_RIGHT_BRACE || type == LEXER_EOS)\n          {\n            scanner_context.mode = SCAN_MODE_STATEMENT_END;\n            continue;\n          }\n          /* FALLTHRU */\n        }\n        case SCAN_MODE_STATEMENT:\n        {\n          if (scanner_scan_statement (context_p, &scanner_context, type, stack_top) != SCAN_NEXT_TOKEN)\n          {\n            continue;\n          }\n          break;\n        }\n        case SCAN_MODE_STATEMENT_END:\n        {\n          if (scanner_scan_statement_end (context_p, &scanner_context, type) != SCAN_NEXT_TOKEN)\n          {\n            continue;\n          }\n\n          if (context_p->token.type == LEXER_EOS)\n          {\n            goto scan_completed;\n          }\n\n          break;\n        }\n        case SCAN_MODE_VAR_STATEMENT:\n        {\n          if (type == LEXER_LEFT_SQUARE || type == LEXER_LEFT_BRACE)\n          {\n            uint8_t binding_type = SCANNER_BINDING_VAR;\n\n            if (stack_top == SCAN_STACK_LET || stack_top == SCAN_STACK_FOR_LET_START)\n            {\n              binding_type = SCANNER_BINDING_LET;\n            }\n            else if (stack_top == SCAN_STACK_CONST || stack_top == SCAN_STACK_FOR_CONST_START)\n            {\n              binding_type = SCANNER_BINDING_CONST;\n            }\n\n            scanner_push_destructuring_pattern (context_p, &scanner_context, binding_type, false);\n\n            if (type == LEXER_LEFT_SQUARE)\n            {\n              parser_stack_push_uint8 (context_p, SCAN_STACK_ARRAY_LITERAL);\n              scanner_context.mode = SCAN_MODE_BINDING;\n              break;\n            }\n\n            parser_stack_push_uint8 (context_p, 0);\n            parser_stack_push_uint8 (context_p, SCAN_STACK_OBJECT_LITERAL);\n            scanner_context.mode = SCAN_MODE_PROPERTY_NAME;\n            continue;\n          }\n\n          if (type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          lexer_lit_location_t *literal_p = scanner_add_literal (context_p, &scanner_context);\n\n          if (stack_top != SCAN_STACK_VAR && stack_top != SCAN_STACK_FOR_VAR_START)\n          {\n            scanner_detect_invalid_let (context_p, literal_p);\n\n            if (stack_top == SCAN_STACK_LET || stack_top == SCAN_STACK_FOR_LET_START)\n            {\n              literal_p->type |= SCANNER_LITERAL_IS_LET;\n            }\n            else\n            {\n              JERRY_ASSERT (stack_top == SCAN_STACK_CONST || stack_top == SCAN_STACK_FOR_CONST_START);\n              literal_p->type |= SCANNER_LITERAL_IS_CONST;\n            }\n\n            lexer_next_token (context_p);\n\n            if (literal_p->type & SCANNER_LITERAL_IS_USED)\n            {\n              literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;\n            }\n            else if (context_p->token.type == LEXER_ASSIGN)\n            {\n              scanner_binding_literal_t binding_literal;\n              binding_literal.literal_p = literal_p;\n\n              parser_stack_push (context_p, &binding_literal, sizeof (scanner_binding_literal_t));\n              parser_stack_push_uint8 (context_p, SCAN_STACK_BINDING_INIT);\n            }\n          }\n          else\n          {\n            if (!(literal_p->type & SCANNER_LITERAL_IS_VAR))\n            {\n              scanner_detect_invalid_var (context_p, &scanner_context, literal_p);\n              literal_p->type |= SCANNER_LITERAL_IS_VAR;\n\n              if (scanner_context.active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_WITH)\n              {\n                literal_p->type |= SCANNER_LITERAL_NO_REG;\n              }\n            }\n\n            lexer_next_token (context_p);\n          }\n\n#if JERRY_MODULE_SYSTEM\n          if (scanner_context.active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_EXPORT)\n          {\n            literal_p->type |= SCANNER_LITERAL_NO_REG;\n          }\n#endif /* JERRY_MODULE_SYSTEM */\n\n          switch (context_p->token.type)\n          {\n            case LEXER_ASSIGN:\n            {\n              scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;\n              /* FALLTHRU */\n            }\n            case LEXER_COMMA:\n            {\n              lexer_next_token (context_p);\n              continue;\n            }\n          }\n\n          if (SCANNER_IS_FOR_START (stack_top))\n          {\n#if JERRY_MODULE_SYSTEM\n            JERRY_ASSERT (!(scanner_context.active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_EXPORT));\n#endif /* JERRY_MODULE_SYSTEM */\n\n            if (context_p->token.type != LEXER_SEMICOLON && context_p->token.type != LEXER_KEYW_IN\n                && !SCANNER_IDENTIFIER_IS_OF ())\n            {\n              scanner_raise_error (context_p);\n            }\n\n            scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n            continue;\n          }\n\n          JERRY_ASSERT (stack_top == SCAN_STACK_VAR || stack_top == SCAN_STACK_LET || stack_top == SCAN_STACK_CONST);\n\n#if JERRY_MODULE_SYSTEM\n          scanner_context.active_literal_pool_p->status_flags &= (uint16_t) ~SCANNER_LITERAL_POOL_IN_EXPORT;\n#endif /* JERRY_MODULE_SYSTEM */\n\n          scanner_context.mode = SCAN_MODE_STATEMENT_END;\n          parser_stack_pop_uint8 (context_p);\n          continue;\n        }\n        case SCAN_MODE_FUNCTION_ARGUMENTS:\n        {\n          JERRY_ASSERT (stack_top == SCAN_STACK_SCRIPT_FUNCTION || stack_top == SCAN_STACK_FUNCTION_STATEMENT\n                        || stack_top == SCAN_STACK_FUNCTION_EXPRESSION || stack_top == SCAN_STACK_FUNCTION_PROPERTY);\n\n          scanner_literal_pool_t *literal_pool_p = scanner_context.active_literal_pool_p;\n\n          JERRY_ASSERT (literal_pool_p != NULL && (literal_pool_p->status_flags & SCANNER_LITERAL_POOL_FUNCTION));\n\n          literal_pool_p->source_p = context_p->source_p;\n\n          if (JERRY_UNLIKELY (scanner_context.async_source_p != NULL))\n          {\n            literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_ASYNC;\n            literal_pool_p->source_p = scanner_context.async_source_p;\n            scanner_context.async_source_p = NULL;\n          }\n\n          if (type != LEXER_LEFT_PAREN)\n          {\n            scanner_raise_error (context_p);\n          }\n          lexer_next_token (context_p);\n\n          /* FALLTHRU */\n        }\n        case SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS:\n        {\n          if (context_p->token.type != LEXER_RIGHT_PAREN && context_p->token.type != LEXER_EOS)\n          {\n            lexer_lit_location_t *argument_literal_p;\n\n            do\n            {\n              if (context_p->token.type == LEXER_THREE_DOTS)\n              {\n                scanner_context.active_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_HAS_COMPLEX_ARGUMENT;\n                lexer_next_token (context_p);\n              }\n\n              if (context_p->token.type == LEXER_LEFT_SQUARE || context_p->token.type == LEXER_LEFT_BRACE)\n              {\n                argument_literal_p = NULL;\n                break;\n              }\n\n              if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n              {\n                scanner_raise_error (context_p);\n              }\n\n              argument_literal_p = scanner_append_argument (context_p, &scanner_context);\n              lexer_next_token (context_p);\n\n              if (context_p->token.type != LEXER_COMMA)\n              {\n                break;\n              }\n\n              lexer_next_token (context_p);\n            } while (context_p->token.type != LEXER_RIGHT_PAREN && context_p->token.type != LEXER_EOS);\n\n            if (argument_literal_p == NULL)\n            {\n              scanner_context.active_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_HAS_COMPLEX_ARGUMENT;\n\n              parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PARAMETERS);\n              scanner_append_hole (context_p, &scanner_context);\n              scanner_push_destructuring_pattern (context_p, &scanner_context, SCANNER_BINDING_ARG, false);\n\n              if (context_p->token.type == LEXER_LEFT_SQUARE)\n              {\n                parser_stack_push_uint8 (context_p, SCAN_STACK_ARRAY_LITERAL);\n                scanner_context.mode = SCAN_MODE_BINDING;\n                break;\n              }\n\n              parser_stack_push_uint8 (context_p, 0);\n              parser_stack_push_uint8 (context_p, SCAN_STACK_OBJECT_LITERAL);\n              scanner_context.mode = SCAN_MODE_PROPERTY_NAME;\n              continue;\n            }\n\n            if (context_p->token.type == LEXER_ASSIGN)\n            {\n              scanner_context.active_literal_pool_p->status_flags |= SCANNER_LITERAL_POOL_HAS_COMPLEX_ARGUMENT;\n\n              parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PARAMETERS);\n              scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n              if (argument_literal_p->type & SCANNER_LITERAL_IS_USED)\n              {\n                JERRY_ASSERT (argument_literal_p->type & SCANNER_LITERAL_EARLY_CREATE);\n                break;\n              }\n\n              scanner_binding_literal_t binding_literal;\n              binding_literal.literal_p = argument_literal_p;\n\n              parser_stack_push (context_p, &binding_literal, sizeof (scanner_binding_literal_t));\n              parser_stack_push_uint8 (context_p, SCAN_STACK_BINDING_INIT);\n              break;\n            }\n          }\n\n          if (context_p->token.type == LEXER_EOS && stack_top == SCAN_STACK_SCRIPT_FUNCTION)\n          {\n            /* End of argument parsing. */\n            scanner_info_t *scanner_info_p = (scanner_info_t *) scanner_malloc (context_p, sizeof (scanner_info_t));\n            scanner_info_p->next_p = context_p->next_scanner_info_p;\n            scanner_info_p->source_p = NULL;\n            scanner_info_p->type = SCANNER_TYPE_END_ARGUMENTS;\n            scanner_context.end_arguments_p = scanner_info_p;\n\n            context_p->next_scanner_info_p = scanner_info_p;\n            context_p->source_p = context_p->source_start_p;\n            context_p->source_end_p = context_p->source_start_p + context_p->source_size;\n            lexer_init_line_info (context_p);\n\n            scanner_filter_arguments (context_p, &scanner_context);\n            lexer_next_token (context_p);\n            scanner_check_directives (context_p, &scanner_context);\n            continue;\n          }\n\n          if (context_p->token.type != LEXER_RIGHT_PAREN)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          lexer_next_token (context_p);\n\n          if (context_p->token.type != LEXER_LEFT_BRACE)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          scanner_filter_arguments (context_p, &scanner_context);\n          lexer_next_token (context_p);\n          scanner_check_directives (context_p, &scanner_context);\n          continue;\n        }\n        case SCAN_MODE_PROPERTY_NAME:\n        {\n          JERRY_ASSERT (stack_top == SCAN_STACK_OBJECT_LITERAL);\n\n          if (lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS))\n          {\n            lexer_check_property_modifier (context_p);\n          }\n\n          if (context_p->token.type == LEXER_LEFT_SQUARE)\n          {\n            parser_stack_push_uint8 (context_p, SCAN_STACK_COMPUTED_PROPERTY);\n            scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;\n            break;\n          }\n\n          if (context_p->token.type == LEXER_THREE_DOTS)\n          {\n            *parser_stack_get_prev_uint8 (context_p) |= SCANNER_LITERAL_OBJECT_HAS_REST;\n            scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n            if (scanner_context.binding_type != SCANNER_BINDING_NONE)\n            {\n              scanner_context.mode = SCAN_MODE_BINDING;\n            }\n            break;\n          }\n\n          if (context_p->token.type == LEXER_RIGHT_BRACE)\n          {\n            scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n            continue;\n          }\n\n          if (context_p->token.type == LEXER_PROPERTY_GETTER || context_p->token.type == LEXER_KEYW_ASYNC\n              || context_p->token.type == LEXER_MULTIPLY || context_p->token.type == LEXER_PROPERTY_SETTER)\n          {\n            uint16_t literal_pool_flags = SCANNER_LITERAL_POOL_FUNCTION;\n\n            if (context_p->token.type == LEXER_MULTIPLY)\n            {\n              literal_pool_flags |= SCANNER_LITERAL_POOL_GENERATOR;\n            }\n            else if (context_p->token.type == LEXER_KEYW_ASYNC)\n            {\n              literal_pool_flags |= SCANNER_LITERAL_POOL_ASYNC;\n\n              if (lexer_consume_generator (context_p))\n              {\n                literal_pool_flags |= SCANNER_LITERAL_POOL_GENERATOR;\n              }\n            }\n\n            parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PROPERTY);\n            lexer_scan_identifier (context_p, LEXER_PARSE_NO_OPTS);\n\n            if (context_p->token.type == LEXER_LEFT_SQUARE)\n            {\n              parser_stack_push_uint8 (context_p, SCANNER_FROM_LITERAL_POOL_TO_COMPUTED (literal_pool_flags));\n              scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;\n              break;\n            }\n\n            if (context_p->token.type != LEXER_LITERAL)\n            {\n              scanner_raise_error (context_p);\n            }\n\n            scanner_push_literal_pool (context_p, &scanner_context, literal_pool_flags);\n            scanner_context.mode = SCAN_MODE_FUNCTION_ARGUMENTS;\n            break;\n          }\n\n          if (context_p->token.type != LEXER_LITERAL)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          parser_line_counter_t start_line = context_p->token.line;\n          parser_line_counter_t start_column = context_p->token.column;\n          bool is_ident = (context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n          lexer_next_token (context_p);\n\n          if (context_p->token.type == LEXER_LEFT_PAREN)\n          {\n            scanner_push_literal_pool (context_p, &scanner_context, SCANNER_LITERAL_POOL_FUNCTION);\n\n            parser_stack_push_uint8 (context_p, SCAN_STACK_FUNCTION_PROPERTY);\n            scanner_context.mode = SCAN_MODE_FUNCTION_ARGUMENTS;\n            continue;\n          }\n\n          if (is_ident\n              && (context_p->token.type == LEXER_COMMA || context_p->token.type == LEXER_RIGHT_BRACE\n                  || context_p->token.type == LEXER_ASSIGN))\n          {\n            context_p->source_p = context_p->token.lit_location.char_p;\n            context_p->line = start_line;\n            context_p->column = start_column;\n\n            lexer_next_token (context_p);\n\n            JERRY_ASSERT (context_p->token.type != LEXER_LITERAL\n                          || context_p->token.lit_location.type == LEXER_IDENT_LITERAL);\n\n            if (context_p->token.type != LEXER_LITERAL)\n            {\n              scanner_raise_error (context_p);\n            }\n\n            if (scanner_context.binding_type != SCANNER_BINDING_NONE)\n            {\n              scanner_context.mode = SCAN_MODE_BINDING;\n              continue;\n            }\n\n            scanner_add_reference (context_p, &scanner_context);\n\n            lexer_next_token (context_p);\n\n            if (context_p->token.type == LEXER_ASSIGN)\n            {\n              scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;\n              break;\n            }\n\n            scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION_END;\n            continue;\n          }\n\n          if (context_p->token.type != LEXER_COLON)\n          {\n            scanner_raise_error (context_p);\n          }\n\n          scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;\n\n          if (scanner_context.binding_type != SCANNER_BINDING_NONE)\n          {\n            scanner_context.mode = SCAN_MODE_BINDING;\n          }\n          break;\n        }\n        case SCAN_MODE_BINDING:\n        {\n          JERRY_ASSERT (scanner_context.binding_type == SCANNER_BINDING_VAR\n                        || scanner_context.binding_type == SCANNER_BINDING_LET\n                        || scanner_context.binding_type == SCANNER_BINDING_CATCH\n                        || scanner_context.binding_type == SCANNER_BINDING_CONST\n                        || scanner_context.binding_type == SCANNER_BINDING_ARG\n                        || scanner_context.binding_type == SCANNER_BINDING_ARROW_ARG);\n\n          if (type == LEXER_THREE_DOTS)\n          {\n            lexer_next_token (context_p);\n            type = (lexer_token_type_t) context_p->token.type;\n          }\n\n          if (type == LEXER_LEFT_SQUARE || type == LEXER_LEFT_BRACE)\n          {\n            scanner_push_destructuring_pattern (context_p, &scanner_context, scanner_context.binding_type, true);\n\n            if (type == LEXER_LEFT_SQUARE)\n            {\n              parser_stack_push_uint8 (context_p, SCAN_STACK_ARRAY_LITERAL);\n              break;\n            }\n\n            parser_stack_push_uint8 (context_p, 0);\n            parser_stack_push_uint8 (context_p, SCAN_STACK_OBJECT_LITERAL);\n            scanner_context.mode = SCAN_MODE_PROPERTY_NAME;\n            continue;\n          }\n\n          if (type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)\n          {\n            scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;\n            continue;\n          }\n\n          lexer_lit_location_t *literal_p = scanner_add_literal (context_p, &scanner_context);\n\n          scanner_context.mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;\n\n          if (scanner_context.binding_type == SCANNER_BINDING_VAR)\n          {\n            if (!(literal_p->type & SCANNER_LITERAL_IS_VAR))\n            {\n              scanner_detect_invalid_var (context_p, &scanner_context, literal_p);\n              literal_p->type |= SCANNER_LITERAL_IS_VAR;\n\n              if (scanner_context.active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_WITH)\n              {\n                literal_p->type |= SCANNER_LITERAL_NO_REG;\n              }\n            }\n            break;\n          }\n\n          if (scanner_context.binding_type == SCANNER_BINDING_ARROW_ARG)\n          {\n            literal_p->type |= SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_ARROW_DESTRUCTURED_ARG;\n\n            if (literal_p->type & SCANNER_LITERAL_IS_USED)\n            {\n              literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;\n              break;\n            }\n          }\n          else\n          {\n            scanner_detect_invalid_let (context_p, literal_p);\n\n            if (scanner_context.binding_type <= SCANNER_BINDING_CATCH)\n            {\n              JERRY_ASSERT ((scanner_context.binding_type == SCANNER_BINDING_LET)\n                            || (scanner_context.binding_type == SCANNER_BINDING_CATCH));\n\n              literal_p->type |= SCANNER_LITERAL_IS_LET;\n            }\n            else\n            {\n              literal_p->type |= SCANNER_LITERAL_IS_CONST;\n\n              if (scanner_context.binding_type == SCANNER_BINDING_ARG)\n              {\n                literal_p->type |= SCANNER_LITERAL_IS_ARG;\n\n                if (literal_p->type & SCANNER_LITERAL_IS_USED)\n                {\n                  literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;\n                  break;\n                }\n              }\n            }\n\n            if (literal_p->type & SCANNER_LITERAL_IS_USED)\n            {\n              literal_p->type |= SCANNER_LITERAL_EARLY_CREATE;\n              break;\n            }\n          }\n\n          scanner_binding_item_t *binding_item_p;\n          binding_item_p = (scanner_binding_item_t *) scanner_malloc (context_p, sizeof (scanner_binding_item_t));\n\n          binding_item_p->next_p = scanner_context.active_binding_list_p->items_p;\n          binding_item_p->literal_p = literal_p;\n\n          scanner_context.active_binding_list_p->items_p = binding_item_p;\n\n          lexer_next_token (context_p);\n          if (context_p->token.type != LEXER_ASSIGN)\n          {\n            continue;\n          }\n\n          scanner_binding_literal_t binding_literal;\n          binding_literal.literal_p = literal_p;\n\n          parser_stack_push (context_p, &binding_literal, sizeof (scanner_binding_literal_t));\n          parser_stack_push_uint8 (context_p, SCAN_STACK_BINDING_INIT);\n\n          scanner_context.mode = SCAN_MODE_PRIMARY_EXPRESSION;\n          break;\n        }\n      }\n\n      lexer_next_token (context_p);\n    }\n\nscan_completed:\n    if (context_p->stack_top_uint8 != SCAN_STACK_SCRIPT && context_p->stack_top_uint8 != SCAN_STACK_SCRIPT_FUNCTION)\n    {\n      scanner_raise_error (context_p);\n    }\n\n    scanner_pop_literal_pool (context_p, &scanner_context);\n\n    JERRY_ASSERT (scanner_context.active_binding_list_p == NULL);\n    JERRY_ASSERT (scanner_context.active_literal_pool_p == NULL);\n\n#ifndef JERRY_NDEBUG\n    scanner_context.context_status_flags |= PARSER_SCANNING_SUCCESSFUL;\n#endif /* !JERRY_NDEBUG */\n  }\n  PARSER_CATCH\n  {\n    while (scanner_context.active_binding_list_p != NULL)\n    {\n      scanner_pop_binding_list (&scanner_context);\n    }\n\n    if (JERRY_UNLIKELY (context_p->error != PARSER_ERR_OUT_OF_MEMORY))\n    {\n      /* Ignore the errors thrown by the lexer. */\n      context_p->error = PARSER_ERR_NO_ERROR;\n\n      /* The following code may allocate memory, so it is enclosed in a try/catch. */\n      PARSER_TRY (context_p->try_buffer)\n      {\n        if (scanner_context.status_flags & SCANNER_CONTEXT_THROW_ERR_ASYNC_FUNCTION)\n        {\n          JERRY_ASSERT (scanner_context.async_source_p != NULL);\n\n          scanner_info_t *info_p;\n          info_p = scanner_insert_info (context_p, scanner_context.async_source_p, sizeof (scanner_info_t));\n          info_p->type = SCANNER_TYPE_ERR_ASYNC_FUNCTION;\n        }\n\n        while (scanner_context.active_literal_pool_p != NULL)\n        {\n          scanner_pop_literal_pool (context_p, &scanner_context);\n        }\n      }\n      PARSER_CATCH\n      {\n        JERRY_ASSERT (context_p->error == PARSER_ERR_OUT_OF_MEMORY);\n      }\n      PARSER_TRY_END\n    }\n\n    JERRY_ASSERT (context_p->error == PARSER_ERR_NO_ERROR || context_p->error == PARSER_ERR_OUT_OF_MEMORY);\n\n    if (context_p->error == PARSER_ERR_OUT_OF_MEMORY)\n    {\n      while (scanner_context.active_literal_pool_p != NULL)\n      {\n        scanner_literal_pool_t *literal_pool_p = scanner_context.active_literal_pool_p;\n\n        scanner_context.active_literal_pool_p = literal_pool_p->prev_p;\n\n        parser_list_free (&literal_pool_p->literal_pool);\n        scanner_free (literal_pool_p, sizeof (scanner_literal_pool_t));\n      }\n\n      parser_stack_free (context_p);\n      return;\n    }\n  }\n  PARSER_TRY_END\n\n  context_p->status_flags = scanner_context.context_status_flags;\n  context_p->global_status_flags &= (uint32_t) ~ECMA_PARSE_INTERNAL_PRE_SCANNING;\n  scanner_reverse_info_list (context_p);\n\n#if JERRY_PARSER_DUMP_BYTE_CODE\n  if (context_p->is_show_opcodes)\n  {\n    scanner_info_t *info_p = context_p->next_scanner_info_p;\n    const uint8_t *source_start_p =\n      (context_p->arguments_start_p == NULL ? context_p->source_start_p : context_p->arguments_start_p);\n\n    while (info_p->type != SCANNER_TYPE_END)\n    {\n      const char *name_p = NULL;\n      bool print_location = false;\n\n      switch (info_p->type)\n      {\n        case SCANNER_TYPE_END_ARGUMENTS:\n        {\n          JERRY_DEBUG_MSG (\"  END_ARGUMENTS\\n\");\n          source_start_p = context_p->source_start_p;\n          break;\n        }\n        case SCANNER_TYPE_FUNCTION:\n        case SCANNER_TYPE_BLOCK:\n        {\n          const uint8_t *prev_source_p = info_p->source_p - 1;\n          const uint8_t *data_p;\n\n          if (info_p->type == SCANNER_TYPE_FUNCTION)\n          {\n            data_p = (const uint8_t *) (info_p + 1);\n\n            JERRY_DEBUG_MSG (\"  FUNCTION: flags: 0x%x declarations: %d\", (int) info_p->u8_arg, (int) info_p->u16_arg);\n          }\n          else\n          {\n            data_p = (const uint8_t *) (info_p + 1);\n\n            JERRY_DEBUG_MSG (\"  BLOCK:\");\n          }\n\n          JERRY_DEBUG_MSG (\" source:%d\\n\", (int) (info_p->source_p - source_start_p));\n\n          while (data_p[0] != SCANNER_STREAM_TYPE_END)\n          {\n            switch (data_p[0] & SCANNER_STREAM_TYPE_MASK)\n            {\n              case SCANNER_STREAM_TYPE_HOLE:\n              {\n                JERRY_DEBUG_MSG (\"    HOLE\\n\");\n                data_p++;\n                continue;\n              }\n              case SCANNER_STREAM_TYPE_ARGUMENTS:\n              {\n                JERRY_DEBUG_MSG (\"    ARGUMENTS%s%s\\n\",\n                                 (data_p[0] & SCANNER_STREAM_NO_REG) ? \" *\" : \"\",\n                                 (data_p[0] & SCANNER_STREAM_LOCAL_ARGUMENTS) ? \" L\" : \"\");\n                data_p++;\n                continue;\n              }\n              case SCANNER_STREAM_TYPE_ARGUMENTS_FUNC:\n              {\n                JERRY_DEBUG_MSG (\"    ARGUMENTS_FUNC%s%s\\n\",\n                                 (data_p[0] & SCANNER_STREAM_NO_REG) ? \" *\" : \"\",\n                                 (data_p[0] & SCANNER_STREAM_LOCAL_ARGUMENTS) ? \" L\" : \"\");\n                data_p++;\n                continue;\n              }\n              case SCANNER_STREAM_TYPE_VAR:\n              {\n                JERRY_DEBUG_MSG (\"    VAR \");\n                break;\n              }\n              case SCANNER_STREAM_TYPE_LET:\n              {\n                JERRY_DEBUG_MSG (\"    LET \");\n                break;\n              }\n              case SCANNER_STREAM_TYPE_CONST:\n              {\n                JERRY_DEBUG_MSG (\"    CONST \");\n                break;\n              }\n              case SCANNER_STREAM_TYPE_LOCAL:\n              {\n                JERRY_DEBUG_MSG (\"    LOCAL \");\n                break;\n              }\n#if JERRY_MODULE_SYSTEM\n              case SCANNER_STREAM_TYPE_IMPORT:\n              {\n                JERRY_DEBUG_MSG (\"    IMPORT \");\n                break;\n              }\n#endif /* JERRY_MODULE_SYSTEM */\n              case SCANNER_STREAM_TYPE_ARG:\n              {\n                JERRY_DEBUG_MSG (\"    ARG \");\n                break;\n              }\n              case SCANNER_STREAM_TYPE_ARG_VAR:\n              {\n                JERRY_DEBUG_MSG (\"    ARG_VAR \");\n                break;\n              }\n              case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG:\n              {\n                JERRY_DEBUG_MSG (\"    DESTRUCTURED_ARG \");\n                break;\n              }\n              case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR:\n              {\n                JERRY_DEBUG_MSG (\"    DESTRUCTURED_ARG_VAR \");\n                break;\n              }\n              case SCANNER_STREAM_TYPE_ARG_FUNC:\n              {\n                JERRY_DEBUG_MSG (\"    ARG_FUNC \");\n                break;\n              }\n              case SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC:\n              {\n                JERRY_DEBUG_MSG (\"    DESTRUCTURED_ARG_FUNC \");\n                break;\n              }\n              case SCANNER_STREAM_TYPE_FUNC:\n              {\n                JERRY_DEBUG_MSG (\"    FUNC \");\n                break;\n              }\n              default:\n              {\n                JERRY_UNREACHABLE ();\n                data_p++;\n                continue;\n              }\n            }\n\n            size_t length;\n\n            if (!(data_p[0] & SCANNER_STREAM_UINT16_DIFF))\n            {\n              if (data_p[2] != 0)\n              {\n                prev_source_p += data_p[2];\n                length = 2 + 1;\n              }\n              else\n              {\n                memcpy (&prev_source_p, data_p + 2 + 1, sizeof (uintptr_t));\n                length = 2 + 1 + sizeof (uintptr_t);\n              }\n            }\n            else\n            {\n              int32_t diff = ((int32_t) data_p[2]) | ((int32_t) data_p[3]) << 8;\n\n              if (diff <= UINT8_MAX)\n              {\n                diff = -diff;\n              }\n\n              prev_source_p += diff;\n              length = 2 + 2;\n            }\n\n            if (data_p[0] & SCANNER_STREAM_EARLY_CREATE)\n            {\n              JERRY_ASSERT (data_p[0] & SCANNER_STREAM_NO_REG);\n              JERRY_DEBUG_MSG (\"*\");\n            }\n\n            if (data_p[0] & SCANNER_STREAM_NO_REG)\n            {\n              JERRY_DEBUG_MSG (\"* \");\n            }\n\n            JERRY_DEBUG_MSG (\"'%.*s'\\n\", data_p[1], (char *) prev_source_p);\n            prev_source_p += data_p[1];\n            data_p += length;\n          }\n          break;\n        }\n        case SCANNER_TYPE_WHILE:\n        {\n          name_p = \"WHILE\";\n          print_location = true;\n          break;\n        }\n        case SCANNER_TYPE_FOR:\n        {\n          scanner_for_info_t *for_info_p = (scanner_for_info_t *) info_p;\n          JERRY_DEBUG_MSG (\"  FOR: source:%d expression:%d[%d:%d] end:%d[%d:%d]\\n\",\n                           (int) (for_info_p->info.source_p - source_start_p),\n                           (int) (for_info_p->expression_location.source_p - source_start_p),\n                           (int) for_info_p->expression_location.line,\n                           (int) for_info_p->expression_location.column,\n                           (int) (for_info_p->end_location.source_p - source_start_p),\n                           (int) for_info_p->end_location.line,\n                           (int) for_info_p->end_location.column);\n          break;\n        }\n        case SCANNER_TYPE_FOR_IN:\n        {\n          name_p = \"FOR-IN\";\n          print_location = true;\n          break;\n        }\n        case SCANNER_TYPE_FOR_OF:\n        {\n          name_p = \"FOR-OF\";\n          print_location = true;\n          break;\n        }\n        case SCANNER_TYPE_SWITCH:\n        {\n          JERRY_DEBUG_MSG (\"  SWITCH: source:%d\\n\", (int) (info_p->source_p - source_start_p));\n\n          scanner_case_info_t *current_case_p = ((scanner_switch_info_t *) info_p)->case_p;\n\n          while (current_case_p != NULL)\n          {\n            JERRY_DEBUG_MSG (\"    CASE: location:%d[%d:%d]\\n\",\n                             (int) (current_case_p->location.source_p - source_start_p),\n                             (int) current_case_p->location.line,\n                             (int) current_case_p->location.column);\n\n            current_case_p = current_case_p->next_p;\n          }\n          break;\n        }\n        case SCANNER_TYPE_CASE:\n        {\n          name_p = \"CASE\";\n          print_location = true;\n          break;\n        }\n        case SCANNER_TYPE_INITIALIZER:\n        {\n          scanner_location_info_t *location_info_p = (scanner_location_info_t *) info_p;\n          JERRY_DEBUG_MSG (\"  INITIALIZER: flags: 0x%x source:%d location:%d[%d:%d]\\n\",\n                           (int) info_p->u8_arg,\n                           (int) (location_info_p->info.source_p - source_start_p),\n                           (int) (location_info_p->location.source_p - source_start_p),\n                           (int) location_info_p->location.line,\n                           (int) location_info_p->location.column);\n          break;\n        }\n        case SCANNER_TYPE_CLASS_CONSTRUCTOR:\n        {\n          JERRY_DEBUG_MSG (\"  CLASS: source:%d\\n\", (int) (info_p->source_p - source_start_p));\n          print_location = false;\n          break;\n        }\n        case SCANNER_TYPE_CLASS_STATIC_BLOCK_END:\n        {\n          name_p = \"SCANNER_TYPE_CLASS_STATIC_BLOCK_END\";\n          print_location = true;\n          break;\n        }\n        case SCANNER_TYPE_CLASS_FIELD_INITIALIZER_END:\n        {\n          name_p = \"SCANNER_TYPE_CLASS_FIELD_INITIALIZER_END\";\n          print_location = true;\n          break;\n        }\n        case SCANNER_TYPE_LET_EXPRESSION:\n        {\n          JERRY_DEBUG_MSG (\"  LET_EXPRESSION: source:%d\\n\", (int) (info_p->source_p - source_start_p));\n          break;\n        }\n        case SCANNER_TYPE_ERR_REDECLARED:\n        {\n          JERRY_DEBUG_MSG (\"  JERRY_FATAL_REDECLARED: source:%d\\n\", (int) (info_p->source_p - source_start_p));\n          break;\n        }\n        case SCANNER_TYPE_ERR_ASYNC_FUNCTION:\n        {\n          JERRY_DEBUG_MSG (\"  JERRY_FATAL_ASYNC_FUNCTION: source:%d\\n\", (int) (info_p->source_p - source_start_p));\n          break;\n        }\n        case SCANNER_TYPE_LITERAL_FLAGS:\n        {\n          JERRY_DEBUG_MSG (\"  SCANNER_TYPE_LITERAL_FLAGS: flags: 0x%x source:%d\\n\",\n                           (int) info_p->u8_arg,\n                           (int) (info_p->source_p - source_start_p));\n          print_location = false;\n          break;\n        }\n        case SCANNER_TYPE_EXPORT_MODULE_SPECIFIER:\n        {\n          JERRY_DEBUG_MSG (\"  EXPORT_WITH_MODULE_SPECIFIER: source:%d\\n\", (int) (info_p->source_p - source_start_p));\n          print_location = false;\n          break;\n        }\n      }\n\n      if (print_location)\n      {\n        scanner_location_info_t *location_info_p = (scanner_location_info_t *) info_p;\n        JERRY_DEBUG_MSG (\"  %s: source:%d location:%d[%d:%d]\\n\",\n                         name_p,\n                         (int) (location_info_p->info.source_p - source_start_p),\n                         (int) (location_info_p->location.source_p - source_start_p),\n                         (int) location_info_p->location.line,\n                         (int) location_info_p->location.column);\n      }\n\n      info_p = info_p->next_p;\n    }\n\n    JERRY_DEBUG_MSG (\"\\n--- Scanning end ---\\n\\n\");\n  }\n#endif /* JERRY_PARSER_DUMP_BYTE_CODE */\n\n  parser_stack_free (context_p);\n} /* scanner_scan_all */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_PARSER */\n"
  },
  {
    "path": "jerry-core/parser/js/js-scanner.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JS_SCANNER_H\n#define JS_SCANNER_H\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup jsparser JavaScript\n * @{\n *\n * \\addtogroup jsparser_scanner Scanner\n * @{\n */\n\n/**\n * Allowed types for scanner_info_t structures.\n */\ntypedef enum\n{\n  SCANNER_TYPE_END, /**< mark the last info block */\n  SCANNER_TYPE_END_ARGUMENTS, /**< mark the end of function arguments\n                               *   (only present if a function script is parsed) */\n  SCANNER_TYPE_FUNCTION, /**< declarations in a function */\n  SCANNER_TYPE_BLOCK, /**< declarations in a code block (usually enclosed in {}) */\n  SCANNER_TYPE_WHILE, /**< while statement */\n  SCANNER_TYPE_FOR, /**< for statement */\n  SCANNER_TYPE_FOR_IN, /**< for-in statement */\n  SCANNER_TYPE_FOR_OF, /**< for-of statement */\n  SCANNER_TYPE_SWITCH, /**< switch statement */\n  SCANNER_TYPE_CASE, /**< case statement */\n  SCANNER_TYPE_INITIALIZER, /**< destructuring binding or assignment pattern with initializer */\n  SCANNER_TYPE_LITERAL_FLAGS, /**< object or array literal with non-zero flags (stored in u8_arg) */\n  SCANNER_TYPE_CLASS_CONSTRUCTOR, /**< class constructor */\n  SCANNER_TYPE_CLASS_FIELD_INITIALIZER_END, /**< class field initializer end */\n  SCANNER_TYPE_CLASS_STATIC_BLOCK_END, /**< class static block end */\n  SCANNER_TYPE_LET_EXPRESSION, /**< let expression */\n  SCANNER_TYPE_ERR_REDECLARED, /**< syntax error: a variable is redeclared */\n  SCANNER_TYPE_ERR_ASYNC_FUNCTION, /**< an invalid async function follows */\n  SCANNER_TYPE_EXPORT_MODULE_SPECIFIER, /**< export with module specifier */\n} scanner_info_type_t;\n\n/**\n * Source code location which can be used to change the position of parsing.\n */\ntypedef struct\n{\n  const uint8_t *source_p; /**< next source byte */\n  parser_line_counter_t line; /**< token start line */\n  parser_line_counter_t column; /**< token start column */\n} scanner_location_t;\n\n/**\n * Source code range with its start and end position.\n */\ntypedef struct\n{\n  const uint8_t *source_end_p; /**< end position */\n  scanner_location_t start_location; /**< start location */\n} scanner_range_t;\n\n/**\n * Scanner info blocks which provides information for the parser.\n */\ntypedef struct scanner_info_t\n{\n  struct scanner_info_t *next_p; /**< next info structure */\n  const uint8_t *source_p; /**< triggering position of this scanner info */\n  uint8_t type; /**< type of the scanner info */\n  uint8_t u8_arg; /**< custom 8-bit value */\n  uint16_t u16_arg; /**< custom 16-bit value */\n} scanner_info_t;\n\n/**\n * Scanner info for class private field\n */\ntypedef struct scanner_class_private_member_t\n{\n  lexer_lit_location_t loc; /**< loc */\n  uint8_t u8_arg; /**< custom 8-bit value */\n  struct scanner_class_private_member_t *prev_p; /**< prev private field */\n} scanner_class_private_member_t;\n\n/**\n * Scanner info extended with class private fields.\n */\ntypedef struct\n{\n  scanner_info_t info; /**< header */\n  scanner_class_private_member_t *members; /**< first private field */\n} scanner_class_info_t;\n\n/**\n * Scanner info extended with a location.\n */\ntypedef struct\n{\n  scanner_info_t info; /**< header */\n  scanner_location_t location; /**< location */\n} scanner_location_info_t;\n\n/**\n * Scanner info for \"for\" statements.\n */\ntypedef struct\n{\n  scanner_info_t info; /**< header */\n  scanner_location_t expression_location; /**< location of expression start */\n  scanner_location_t end_location; /**< location of expression end */\n} scanner_for_info_t;\n\n/**\n * Case statement list for scanner_switch_info_t structure.\n */\ntypedef struct scanner_case_info_t\n{\n  struct scanner_case_info_t *next_p; /**< next case statement info */\n  scanner_location_t location; /**< location of case statement */\n} scanner_case_info_t;\n\n/**\n * Scanner info for \"switch\" statements.\n */\ntypedef struct\n{\n  scanner_info_t info; /**< header */\n  scanner_case_info_t *case_p; /**< list of switch cases */\n} scanner_switch_info_t;\n\n/*\n * Description of compressed streams.\n *\n * The stream is a sequence of commands which encoded as bytes. The first byte\n * contains the type of the command (see scanner_function_compressed_stream_types_t).\n *\n * The variable declaration commands has two arguments:\n *   - The first represents the length of the declared identifier\n *   - The second contains the relative distance from the end of the previous declaration\n *     Usually the distance is between 1 and 255, and represented as a single byte\n *     Distances between -256 and 65535 are encoded as two bytes\n *     Larger distances are encoded as pointers\n */\n\n/**\n * Constants for compressed streams.\n */\ntypedef enum\n{\n  SCANNER_STREAM_UINT16_DIFF = (1 << 7), /**< relative distance is between -256 and 65535 */\n  SCANNER_STREAM_HAS_ESCAPE = (1 << 6), /**< binding has escape */\n  SCANNER_STREAM_NO_REG = (1 << 5), /**< binding cannot be stored in register */\n  SCANNER_STREAM_EARLY_CREATE = (1 << 4), /**< binding must be created with ECMA_VALUE_UNINITIALIZED */\n  SCANNER_STREAM_LOCAL_ARGUMENTS = SCANNER_STREAM_EARLY_CREATE, /**< arguments is redeclared\n                                                                 *   as let/const binding later */\n  /* Update SCANNER_STREAM_TYPE_MASK macro if more bits are added. */\n} scanner_compressed_stream_flags_t;\n\n/**\n * Types for compressed streams.\n */\ntypedef enum\n{\n  SCANNER_STREAM_TYPE_END, /**< end of scanner data */\n  SCANNER_STREAM_TYPE_HOLE, /**< no name is assigned to this argument */\n  SCANNER_STREAM_TYPE_ARGUMENTS, /**< arguments object should be created */\n  SCANNER_STREAM_TYPE_ARGUMENTS_FUNC, /**< arguments object should be created which\n                                       *   is later initialized with a function */\n  SCANNER_STREAM_TYPE_VAR, /**< var declaration */\n  SCANNER_STREAM_TYPE_LET, /**< let declaration */\n  SCANNER_STREAM_TYPE_CONST, /**< const declaration */\n  SCANNER_STREAM_TYPE_LOCAL, /**< local declaration (e.g. catch block) */\n#if JERRY_MODULE_SYSTEM\n  SCANNER_STREAM_TYPE_IMPORT, /**< module import */\n#endif /* JERRY_MODULE_SYSTEM */\n  /* The next four types must be in this order (see SCANNER_STREAM_TYPE_IS_ARG). */\n  SCANNER_STREAM_TYPE_ARG, /**< argument declaration */\n  SCANNER_STREAM_TYPE_ARG_VAR, /**< argument declaration which is later copied\n                                *   into a variable declared by var statement */\n  SCANNER_STREAM_TYPE_DESTRUCTURED_ARG, /**< destructuring argument declaration */\n  SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR, /**< destructuring argument declaration which is later\n                                             *   copied into a variable declared by var statement */\n  /* Function types should be at the end. See the SCANNER_STREAM_TYPE_IS_FUNCTION macro. */\n  SCANNER_STREAM_TYPE_ARG_FUNC, /**< argument declaration which\n                                 *   is later initialized with a function */\n  SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC, /**< destructuring argument declaration which\n                                              *   is later initialized with a function */\n  SCANNER_STREAM_TYPE_FUNC, /**< function declaration */\n} scanner_compressed_stream_types_t;\n\n/**\n * Mask for decoding the type from the compressed stream.\n */\n#define SCANNER_STREAM_TYPE_MASK 0xf\n\n/**\n * Checks whether the decoded type represents a function declaration.\n */\n#define SCANNER_STREAM_TYPE_IS_FUNCTION(type) ((type) >= SCANNER_STREAM_TYPE_ARG_FUNC)\n\n/**\n * Checks whether the decoded type represents a function argument.\n */\n#define SCANNER_STREAM_TYPE_IS_ARG(type) \\\n  ((type) >= SCANNER_STREAM_TYPE_ARG && (type) <= SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR)\n\n/**\n * Checks whether the decoded type represents both a function argument and a function declaration.\n */\n#define SCANNER_STREAM_TYPE_IS_ARG_FUNC(type) \\\n  ((type) == SCANNER_STREAM_TYPE_ARG_FUNC || (type) == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC)\n\n/**\n * Checks whether the decoded type represents an arguments declaration\n */\n#define SCANNER_STREAM_TYPE_IS_ARGUMENTS(type) \\\n  ((type) == SCANNER_STREAM_TYPE_ARGUMENTS || (type) == SCANNER_STREAM_TYPE_ARGUMENTS_FUNC)\n\n/**\n * Constants for u8_arg flags in scanner_function_info_t.\n */\ntypedef enum\n{\n  SCANNER_FUNCTION_ARGUMENTS_NEEDED = (1 << 0), /**< arguments object needs to be created */\n  SCANNER_FUNCTION_HAS_COMPLEX_ARGUMENT = (1 << 1), /**< function has complex (ES2015+) argument definition */\n  SCANNER_FUNCTION_LEXICAL_ENV_NEEDED = (1 << 2), /**< lexical environment is needed for the function body */\n  SCANNER_FUNCTION_STATEMENT = (1 << 3), /**< function is function statement (not arrow expression)\n                                          *   this flag must be combined with the type of function (e.g. async) */\n  SCANNER_FUNCTION_ASYNC = (1 << 4), /**< function is async function */\n  SCANNER_FUNCTION_IS_STRICT = (1 << 5), /**< function is strict */\n} scanner_function_flags_t;\n\n/**\n * Constants for u8_arg flags in scanner_class_info_t.\n */\ntypedef enum\n{\n  SCANNER_CONSTRUCTOR_IMPLICIT = 0, /**< implicit constructor */\n  SCANNER_CONSTRUCTOR_EXPLICIT = (1 << 0), /**< explicit constructor */\n  SCANNER_SUCCESSFUL_CLASS_SCAN = (1 << 1), /**< class scan was successful */\n  SCANNER_PRIVATE_FIELD_ACTIVE = (1 << 2), /**< private field is active */\n} scanner_constuctor_flags_t;\n\n/**\n * Constants for u8_arg flags in scanner_class_private_member_t.\n */\ntypedef enum\n{\n  SCANNER_PRIVATE_FIELD_PROPERTY = (1 << 0), /**< private field initializer */\n  SCANNER_PRIVATE_FIELD_METHOD = (1 << 1), /**< private field method */\n  SCANNER_PRIVATE_FIELD_STATIC = (1 << 2), /**< static private property */\n  SCANNER_PRIVATE_FIELD_GETTER = (1 << 3), /**< private field getter */\n  SCANNER_PRIVATE_FIELD_SETTER = (1 << 4), /**< private field setter */\n  SCANNER_PRIVATE_FIELD_SEEN = (1 << 5), /**< private field has already been seen */\n  SCANNER_PRIVATE_FIELD_IGNORED = SCANNER_PRIVATE_FIELD_METHOD | SCANNER_PRIVATE_FIELD_STATIC,\n  SCANNER_PRIVATE_FIELD_GETTER_SETTER = (SCANNER_PRIVATE_FIELD_GETTER | SCANNER_PRIVATE_FIELD_SETTER),\n  SCANNER_PRIVATE_FIELD_PROPERTY_GETTER_SETTER = (SCANNER_PRIVATE_FIELD_PROPERTY | SCANNER_PRIVATE_FIELD_GETTER_SETTER),\n} scanner_private_field_flags_t;\n\n/**\n * Object or array literal constants for u8_arg flags in scanner_info_t.\n */\ntypedef enum\n{\n  /* These flags affects both array and object literals */\n  SCANNER_LITERAL_DESTRUCTURING_FOR = (1 << 0), /**< for loop with destructuring pattern */\n  SCANNER_LITERAL_NO_DESTRUCTURING = (1 << 1), /**< this literal cannot be a destructuring pattern */\n  /* These flags affects only object literals */\n  SCANNER_LITERAL_OBJECT_HAS_SUPER = (1 << 2), /**< super keyword is used in the object literal */\n  SCANNER_LITERAL_OBJECT_HAS_REST = (1 << 3), /**< the object literal has a member prefixed with three dots */\n} scanner_literal_flags_t;\n\n/**\n * Option bits for scanner_create_variables function.\n */\ntypedef enum\n{\n  SCANNER_CREATE_VARS_NO_OPTS = 0, /**< no options */\n  SCANNER_CREATE_VARS_IS_SCRIPT = (1 << 0), /**< create variables for script or direct eval */\n  SCANNER_CREATE_VARS_IS_MODULE = (1 << 1), /**< create variables for module */\n  SCANNER_CREATE_VARS_IS_FUNCTION_ARGS = (1 << 2), /**< create variables for function arguments */\n  SCANNER_CREATE_VARS_IS_FUNCTION_BODY = (1 << 3), /**< create variables for function body */\n} scanner_create_variables_flags_t;\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* !JS_SCANNER_H */\n"
  },
  {
    "path": "jerry-core/parser/js/parser-error-messages.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file is automatically generated by the gen-strings.py script\n * from parser-error-messages.ini. Do not edit! */\n\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_DUPLICATED_LABEL, \"Duplicated label\")\nPARSER_ERROR_DEF (PARSER_ERR_LEFT_PAREN_EXPECTED, \"Expected '(' token\")\nPARSER_ERROR_DEF (PARSER_ERR_RIGHT_PAREN_EXPECTED, \"Expected ')' token\")\nPARSER_ERROR_DEF (PARSER_ERR_COLON_EXPECTED, \"Expected ':' token\")\nPARSER_ERROR_DEF (PARSER_ERR_SEMICOLON_EXPECTED, \"Expected ';' token\")\nPARSER_ERROR_DEF (PARSER_ERR_RIGHT_SQUARE_EXPECTED, \"Expected ']' token\")\nPARSER_ERROR_DEF (PARSER_ERR_LEFT_BRACE_EXPECTED, \"Expected '{' token\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM || JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_RIGHT_BRACE_EXPECTED, \"Expected '}' token\")\n#endif /* JERRY_MODULE_SYSTEM \\\n|| JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_NUMBER_TOO_LONG, \"Number is too long\")\n#endif /* JERRY_PARSER */\n#if JERRY_BUILTIN_REGEXP && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_REGEXP_TOO_LONG, \"Regexp is too long\")\n#endif /* JERRY_BUILTIN_REGEXP && JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_STATEMENT_EXPECTED, \"Statement expected\")\nPARSER_ERROR_DEF (PARSER_ERR_STRING_TOO_LONG, \"String is too long\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_AS_EXPECTED, \"Expected 'as' token\")\n#endif /* JERRY_MODULE_SYSTEM && JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_IN_EXPECTED, \"Expected 'in' token\")\nPARSER_ERROR_DEF (PARSER_ERR_OF_EXPECTED, \"Expected 'of' token\")\nPARSER_ERROR_DEF (PARSER_ERR_EXPRESSION_EXPECTED, \"Expression expected\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM || JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_IDENTIFIER_EXPECTED, \"Identifier expected\")\n#endif /* JERRY_MODULE_SYSTEM \\\n|| JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_OCTAL_DIGIT, \"Invalid octal digit\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_SWITCH, \"Invalid switch body\")\n#endif /* JERRY_PARSER */\n#if JERRY_BUILTIN_REGEXP && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_UNKNOWN_REGEXP_FLAG, \"Unknown regexp flag\")\n#endif /* JERRY_BUILTIN_REGEXP && JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_BIN_DIGIT, \"Invalid binary digit\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_RIGHT_SQUARE, \"Unexpected '}' token\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_FROM_EXPECTED, \"Expected 'from' token\")\n#endif /* JERRY_MODULE_SYSTEM && JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_MISSING_EXPONENT, \"Missing exponent part\")\n#endif /* JERRY_PARSER */\n#if JERRY_BUILTIN_REGEXP && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_DUPLICATED_REGEXP_FLAG, \"Duplicated regexp flag\")\n#endif /* JERRY_BUILTIN_REGEXP && JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_ARGUMENT_LIST_EXPECTED, \"Expected argument list\")\nPARSER_ERROR_DEF (PARSER_ERR_IDENTIFIER_TOO_LONG, \"Identifier is too long\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_META_EXPECTED, \"Expected 'meta' keyword\")\n#endif /* JERRY_MODULE_SYSTEM && JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_UNEXPECTED_END, \"Unexpected end of input\")\nPARSER_ERROR_DEF (PARSER_ERR_UNEXPECTED_PRIVATE_FIELD, \"Unexpected private field\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_LEFT_BRACE_MULTIPLY_EXPECTED, \"Expected '{' or '*' token\")\n#endif /* JERRY_MODULE_SYSTEM && JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM\nPARSER_ERROR_DEF (PARSER_ERR_RIGHT_BRACE_COMMA_EXPECTED, \"Expected '}' or ',' token\")\nPARSER_ERROR_DEF (PARSER_ERR_STRING_EXPECTED, \"Expected a string literal\")\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_HEX_DIGIT, \"Invalid hexadecimal digit\")\n#endif /* JERRY_PARSER */\n#if JERRY_BUILTIN_REGEXP && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_UNTERMINATED_REGEXP, \"Unterminated regexp literal\")\n#endif /* JERRY_BUILTIN_REGEXP && JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_UNTERMINATED_STRING, \"Unterminated string literal\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_FROM_COMMA_EXPECTED, \"Expected 'from' or ',' token\")\n#endif /* JERRY_MODULE_SYSTEM && JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM\nPARSER_ERROR_DEF (PARSER_ERR_EXPORT_NOT_DEFINED, \"Export not defined in module\")\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_MODULE_SYSTEM || JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_VARIABLE_REDECLARED, \"Local variable is redeclared\")\n#endif /* JERRY_MODULE_SYSTEM \\\n|| JERRY_PARSER */\n#if JERRY_BUILTIN_BIGINT && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_BIGINT, \"Number is not a valid BigInt\")\n#endif /* JERRY_BUILTIN_BIGINT && JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_PROPERTY_IDENTIFIER_EXPECTED, \"Property identifier expected\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM\nPARSER_ERROR_DEF (PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER, \"Duplicate exported identifier\")\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_NEW_TARGET_EXPECTED, \"Expected new.target expression\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_CHARACTER, \"Invalid (unexpected) character\")\nPARSER_ERROR_DEF (PARSER_ERR_NON_STRICT_ARG_DEFINITION, \"Non-strict argument definition\")\nPARSER_ERROR_DEF (PARSER_ERR_UNTERMINATED_MULTILINE_COMMENT, \"Unterminated multiline comment\")\nPARSER_ERROR_DEF (PARSER_ERR_CATCH_FINALLY_EXPECTED, \"Catch or finally block expected\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE, \"Invalid unicode escape sequence\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM\nPARSER_ERROR_DEF (PARSER_ERR_DUPLICATED_IMPORT_BINDING, \"Duplicated imported binding name\")\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_WHILE_EXPECTED, \"While expected for do-while loop\")\nPARSER_ERROR_DEF (PARSER_ERR_DELETE_PRIVATE_FIELD, \"Private fields can not be deleted\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_LHS_FOR_LOOP, \"Invalid left-hand-side in for-loop\")\nPARSER_ERROR_DEF (PARSER_ERR_LEFT_HAND_SIDE_EXP_EXPECTED, \"Left-hand-side expression expected\")\nPARSER_ERROR_DEF (PARSER_ERR_LITERAL_LIMIT_REACHED, \"Maximum number of literals reached\")\nPARSER_ERROR_DEF (PARSER_ERR_STACK_LIMIT_REACHED, \"Maximum function stack size reached\")\nPARSER_ERROR_DEF (PARSER_ERR_AWAIT_NOT_ALLOWED, \"Await expression is not allowed here\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_LEFT_BRACE_MULTIPLY_LITERAL_EXPECTED, \"Expected '{' or '*' or literal token\")\n#endif /* JERRY_MODULE_SYSTEM && JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_LHS_ASSIGNMENT, \"Invalid left-hand side in assignment\")\nPARSER_ERROR_DEF (PARSER_ERR_SCOPE_STACK_LIMIT_REACHED, \"Maximum depth of scope stack reached\")\nPARSER_ERROR_DEF (PARSER_ERR_UNEXPECTED_SUPER_KEYWORD, \"Super is not allowed to be used here\")\nPARSER_ERROR_DEF (PARSER_ERR_YIELD_NOT_ALLOWED, \"Yield expression is not allowed here\")\nPARSER_ERROR_DEF (PARSER_ERR_MULTIPLE_CLASS_CONSTRUCTORS, \"Multiple constructors are not allowed\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM\nPARSER_ERROR_DEF (PARSER_ERR_MODULE_UNEXPECTED, \"Unexpected import or export statement\")\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_IDENTIFIER_AFTER_NUMBER, \"Identifier cannot start after a number\")\nPARSER_ERROR_DEF (PARSER_ERR_MULTIPLE_DEFAULTS_NOT_ALLOWED, \"Multiple default cases are not allowed\")\nPARSER_ERROR_DEF (PARSER_ERR_ARRAY_ITEM_SEPARATOR_EXPECTED, \"Expected ',' or ']' after an array item\")\nPARSER_ERROR_DEF (PARSER_ERR_ILLEGAL_PROPERTY_IN_DECLARATION, \"Illegal property in declaration context\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_DESTRUCTURING_PATTERN, \"Invalid destructuring assignment target\")\nPARSER_ERROR_DEF (PARSER_ERR_DUPLICATED_PRIVATE_FIELD, \"Private field has already been declared\")\nPARSER_ERROR_DEF (PARSER_ERR_NO_ARGUMENTS_EXPECTED, \"Property getters must have no arguments\")\nPARSER_ERROR_DEF (PARSER_ERR_ONE_ARGUMENT_EXPECTED, \"Property setters must have one argument\")\nPARSER_ERROR_DEF (PARSER_ERR_CASE_NOT_IN_SWITCH, \"Case statement must be in a switch block\")\nPARSER_ERROR_DEF (PARSER_ERR_CLASS_CONSTRUCTOR_AS_ACCESSOR, \"Class constructor may not be an accessor\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_CONTINUE, \"Continue statement must be inside a loop\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_IMPORT_META_REQUIRE_MODULE, \"Cannot use 'import.meta' outside a module\")\n#endif /* JERRY_MODULE_SYSTEM && JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_IDENTIFIER_PART, \"Character cannot be part of an identifier\")\nPARSER_ERROR_DEF (PARSER_ERR_EVAL_CANNOT_ASSIGNED, \"Eval cannot be assigned to in strict mode\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_TAGGED_TEMPLATE_OPTIONAL_CHAIN, \"Invalid tagged template on optional chain\")\nPARSER_ERROR_DEF (PARSER_ERR_WITH_NOT_ALLOWED, \"With statement not allowed in strict mode\")\nPARSER_ERROR_DEF (PARSER_ERR_NEW_TARGET_NOT_ALLOWED, \"new.target expression is not allowed here\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_IDENTIFIER_START, \"Character cannot be start of an identifier\")\nPARSER_ERROR_DEF (PARSER_ERR_STRICT_IDENT_NOT_ALLOWED, \"Identifier name is reserved in strict mode\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_NULLISH_COALESCING, \"Cannot chain nullish with logical AND or OR\")\nPARSER_ERROR_DEF (PARSER_ERR_DEFAULT_NOT_IN_SWITCH, \"Default statement must be in a switch block\")\n#endif /* JERRY_PARSER */\n#if JERRY_MODULE_SYSTEM && JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_IMPORT_AFTER_NEW, \"Module import call is not allowed after new\")\n#endif /* JERRY_MODULE_SYSTEM && JERRY_PARSER */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_TOO_MANY_CLASS_FIELDS, \"Too many computed class fields are declared\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_KEYWORD, \"Escape sequences are not allowed in keywords\")\nPARSER_ERROR_DEF (PARSER_ERR_ARGUMENT_LIMIT_REACHED, \"Maximum number of function arguments reached\")\nPARSER_ERROR_DEF (PARSER_ERR_NEWLINE_NOT_ALLOWED, \"Newline is not allowed in strings or regexps\")\nPARSER_ERROR_DEF (PARSER_ERR_OCTAL_NUMBER_NOT_ALLOWED, \"Octal numbers are not allowed in strict mode\")\nPARSER_ERROR_DEF (PARSER_ERR_CLASS_PRIVATE_CONSTRUCTOR, \"Class constructor may not be a private method\")\nPARSER_ERROR_DEF (PARSER_ERR_FOR_AWAIT_NO_OF, \"only 'of' form is allowed for for-await loops\")\nPARSER_ERROR_DEF (PARSER_ERR_ARGUMENTS_CANNOT_ASSIGNED, \"Arguments cannot be assigned to in strict mode\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_BREAK, \"Break statement must be inside a loop or switch\")\nPARSER_ERROR_DEF (PARSER_ERR_OBJECT_ITEM_SEPARATOR_EXPECTED, \"Expected ',' or '}' after a property definition\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_BREAK_LABEL, \"Labeled statement targeted by a break not found\")\n#endif /* JERRY_PARSER */\n#if JERRY_PARSER && !(JERRY_BUILTIN_REGEXP)\nPARSER_ERROR_DEF (PARSER_ERR_UNSUPPORTED_REGEXP, \"Regexp is not supported in the selected profile\")\n#endif /* JERRY_PARSER && !(JERRY_BUILTIN_REGEXP) */\n#if JERRY_PARSER\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_RETURN, \"Return statement must be inside a function body\")\nPARSER_ERROR_DEF (PARSER_ERR_COLON_FOR_CONDITIONAL_EXPECTED, \"Expected ':' token for ?: conditional expression\")\nPARSER_ERROR_DEF (PARSER_ERR_FORMAL_PARAM_AFTER_REST_PARAMETER, \"Rest parameter must be the last formal parameter\")\nPARSER_ERROR_DEF (PARSER_ERR_DELETE_IDENT_NOT_ALLOWED, \"Deleting identifier is not allowed in strict mode\")\nPARSER_ERROR_DEF (PARSER_ERR_LABELLED_FUNC_NOT_IN_BLOCK, \"Labelled functions are only allowed inside blocks\")\nPARSER_ERROR_DEF (PARSER_ERR_REST_PARAMETER_DEFAULT_INITIALIZER, \"Rest parameter may not have a default initializer\")\nPARSER_ERROR_DEF (PARSER_ERR_EVAL_NOT_ALLOWED, \"Eval is not allowed to be used here in strict mode\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_CONTINUE_LABEL, \"Labeled statement targeted by a continue not found\")\nPARSER_ERROR_DEF (PARSER_ERR_LEXICAL_LET_BINDING, \"Let binding cannot appear in let/const declarations\")\nPARSER_ERROR_DEF (PARSER_ERR_UNDECLARED_PRIVATE_FIELD, \"Private field must be declared in an enclosing class\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_LHS_PREFIX_OP, \"Invalid left-hand side expression in prefix operation\")\nPARSER_ERROR_DEF (PARSER_ERR_OCTAL_ESCAPE_NOT_ALLOWED, \"Octal escape sequences are not allowed in strict mode\")\nPARSER_ERROR_DEF (PARSER_ERR_SETTER_REST_PARAMETER, \"Setter function argument must not be a rest parameter\")\nPARSER_ERROR_DEF (PARSER_ERR_ARGUMENTS_IN_CLASS_FIELD, \"In class field declarations 'arguments' is not allowed\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_LHS_POSTFIX_OP, \"Invalid left-hand side expression in postfix operation\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER, \"Invalid use of underscore character in number literals\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_EXPONENTIATION, \"Left operand of ** operator cannot be unary expression\")\nPARSER_ERROR_DEF (PARSER_ERR_MISSING_ASSIGN_AFTER_CONST, \"Value assignment is expected after a const declaration\")\nPARSER_ERROR_DEF (PARSER_ERR_ARGUMENTS_NOT_ALLOWED, \"Arguments is not allowed to be used here in strict mode\")\nPARSER_ERROR_DEF (PARSER_ERR_DUPLICATED_ARGUMENT_NAMES, \"Duplicated function argument names are not allowed here\")\nPARSER_ERROR_DEF (PARSER_ERR_CLASS_STATIC_PROTOTYPE, \"Classes may not have a static property called 'prototype'\")\nPARSER_ERROR_DEF (PARSER_ERR_INVALID_CLASS_CONSTRUCTOR, \"Class constructor may not be a generator or async function\")\nPARSER_ERROR_DEF (PARSER_ERR_TEMPLATE_STR_OCTAL_ESCAPE, \"Octal escape sequences are not allowed in template strings\")\nPARSER_ERROR_DEF (PARSER_ERR_DUPLICATED_PROTO, \"Duplicate __proto__ fields are not allowed in object literals\")\nPARSER_ERROR_DEF (PARSER_ERR_GENERATOR_IN_SINGLE_STATEMENT_POS,\n                  \"Generator function cannot appear in a single-statement context\")\nPARSER_ERROR_DEF (PARSER_ERR_LEXICAL_SINGLE_STATEMENT,\n                  \"Lexical declaration cannot appear in a single-statement context\")\nPARSER_ERROR_DEF (PARSER_ERR_FOR_IN_OF_DECLARATION, \"for in-of loop variable declaration may not have an initializer\")\nPARSER_ERROR_DEF (PARSER_ERR_FOR_AWAIT_NO_ASYNC, \"for-await-of is only allowed inside async functions and generators\")\nPARSER_ERROR_DEF (PARSER_ERR_USE_STRICT_NOT_ALLOWED,\n                  \"The 'use strict' directive is not allowed for functions with non-simple arguments\")\nPARSER_ERROR_DEF (PARSER_ERR_ASSIGNMENT_EXPECTED,\n                  \"Unexpected arrow function or yield expression (parentheses around the expression may help)\")\n#endif /* JERRY_PARSER */\n"
  },
  {
    "path": "jerry-core/parser/js/parser-error-messages.ini",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n[PARSER_ERR_MSG]\n\nPARSER_ERR_ARGUMENTS_CANNOT_ASSIGNED = \"Arguments cannot be assigned to in strict mode\"\nPARSER_ERR_ARGUMENTS_IN_CLASS_FIELD = \"In class field declarations 'arguments' is not allowed\"\nPARSER_ERR_ARGUMENTS_NOT_ALLOWED = \"Arguments is not allowed to be used here in strict mode\"\nPARSER_ERR_ARGUMENT_LIMIT_REACHED = \"Maximum number of function arguments reached\"\nPARSER_ERR_ARGUMENT_LIST_EXPECTED = \"Expected argument list\"\nPARSER_ERR_ARRAY_ITEM_SEPARATOR_EXPECTED = \"Expected ',' or ']' after an array item\"\nPARSER_ERR_ASSIGNMENT_EXPECTED = \"Unexpected arrow function or yield expression (parentheses around the expression may help)\"\nPARSER_ERR_AS_EXPECTED = \"Expected 'as' token\"\nPARSER_ERR_AWAIT_NOT_ALLOWED = \"Await expression is not allowed here\"\nPARSER_ERR_CASE_NOT_IN_SWITCH = \"Case statement must be in a switch block\"\nPARSER_ERR_CATCH_FINALLY_EXPECTED = \"Catch or finally block expected\"\nPARSER_ERR_CLASS_CONSTRUCTOR_AS_ACCESSOR = \"Class constructor may not be an accessor\"\nPARSER_ERR_CLASS_STATIC_PROTOTYPE = \"Classes may not have a static property called 'prototype'\"\nPARSER_ERR_COLON_EXPECTED = \"Expected ':' token\"\nPARSER_ERR_COLON_FOR_CONDITIONAL_EXPECTED = \"Expected ':' token for ?: conditional expression\"\nPARSER_ERR_DEFAULT_NOT_IN_SWITCH = \"Default statement must be in a switch block\"\nPARSER_ERR_DELETE_IDENT_NOT_ALLOWED = \"Deleting identifier is not allowed in strict mode\"\nPARSER_ERR_DUPLICATED_ARGUMENT_NAMES = \"Duplicated function argument names are not allowed here\"\nPARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER = \"Duplicate exported identifier\"\nPARSER_ERR_DUPLICATED_IMPORT_BINDING = \"Duplicated imported binding name\"\nPARSER_ERR_DUPLICATED_LABEL = \"Duplicated label\"\nPARSER_ERR_DUPLICATED_PROTO = \"Duplicate __proto__ fields are not allowed in object literals\"\nPARSER_ERR_DUPLICATED_REGEXP_FLAG = \"Duplicated regexp flag\"\nPARSER_ERR_EVAL_CANNOT_ASSIGNED = \"Eval cannot be assigned to in strict mode\"\nPARSER_ERR_EVAL_NOT_ALLOWED = \"Eval is not allowed to be used here in strict mode\"\nPARSER_ERR_EXPORT_NOT_DEFINED = \"Export not defined in module\"\nPARSER_ERR_EXPRESSION_EXPECTED = \"Expression expected\"\nPARSER_ERR_FORMAL_PARAM_AFTER_REST_PARAMETER = \"Rest parameter must be the last formal parameter\"\nPARSER_ERR_FOR_AWAIT_NO_ASYNC = \"for-await-of is only allowed inside async functions and generators\"\nPARSER_ERR_FOR_AWAIT_NO_OF = \"only 'of' form is allowed for for-await loops\"\nPARSER_ERR_FOR_IN_OF_DECLARATION = \"for in-of loop variable declaration may not have an initializer\"\nPARSER_ERR_FROM_COMMA_EXPECTED = \"Expected 'from' or ',' token\"\nPARSER_ERR_FROM_EXPECTED = \"Expected 'from' token\"\nPARSER_ERR_GENERATOR_IN_SINGLE_STATEMENT_POS = \"Generator function cannot appear in a single-statement context\"\nPARSER_ERR_IDENTIFIER_AFTER_NUMBER = \"Identifier cannot start after a number\"\nPARSER_ERR_IDENTIFIER_EXPECTED = \"Identifier expected\"\nPARSER_ERR_IDENTIFIER_TOO_LONG = \"Identifier is too long\"\nPARSER_ERR_ILLEGAL_PROPERTY_IN_DECLARATION = \"Illegal property in declaration context\"\nPARSER_ERR_IMPORT_AFTER_NEW = \"Module import call is not allowed after new\"\nPARSER_ERR_IMPORT_META_REQUIRE_MODULE = \"Cannot use 'import.meta' outside a module\"\nPARSER_ERR_INVALID_BIGINT = \"Number is not a valid BigInt\"\nPARSER_ERR_INVALID_BIN_DIGIT = \"Invalid binary digit\"\nPARSER_ERR_INVALID_BREAK = \"Break statement must be inside a loop or switch\"\nPARSER_ERR_INVALID_BREAK_LABEL = \"Labeled statement targeted by a break not found\"\nPARSER_ERR_INVALID_CHARACTER = \"Invalid (unexpected) character\"\nPARSER_ERR_INVALID_CLASS_CONSTRUCTOR = \"Class constructor may not be a generator or async function\"\nPARSER_ERR_INVALID_CONTINUE = \"Continue statement must be inside a loop\"\nPARSER_ERR_INVALID_CONTINUE_LABEL = \"Labeled statement targeted by a continue not found\"\nPARSER_ERR_INVALID_DESTRUCTURING_PATTERN = \"Invalid destructuring assignment target\"\nPARSER_ERR_INVALID_EXPONENTIATION = \"Left operand of ** operator cannot be unary expression\"\nPARSER_ERR_INVALID_HEX_DIGIT = \"Invalid hexadecimal digit\"\nPARSER_ERR_INVALID_IDENTIFIER_PART = \"Character cannot be part of an identifier\"\nPARSER_ERR_INVALID_IDENTIFIER_START = \"Character cannot be start of an identifier\"\nPARSER_ERR_INVALID_KEYWORD = \"Escape sequences are not allowed in keywords\"\nPARSER_ERR_INVALID_LHS_ASSIGNMENT = \"Invalid left-hand side in assignment\"\nPARSER_ERR_INVALID_LHS_FOR_LOOP = \"Invalid left-hand-side in for-loop\"\nPARSER_ERR_INVALID_LHS_POSTFIX_OP = \"Invalid left-hand side expression in postfix operation\"\nPARSER_ERR_INVALID_LHS_PREFIX_OP = \"Invalid left-hand side expression in prefix operation\"\nPARSER_ERR_INVALID_NULLISH_COALESCING = \"Cannot chain nullish with logical AND or OR\"\nPARSER_ERR_INVALID_OCTAL_DIGIT = \"Invalid octal digit\"\nPARSER_ERR_INVALID_RETURN = \"Return statement must be inside a function body\"\nPARSER_ERR_INVALID_RIGHT_SQUARE = \"Unexpected '}' token\"\nPARSER_ERR_INVALID_SWITCH = \"Invalid switch body\"\nPARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER = \"Invalid use of underscore character in number literals\"\nPARSER_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE = \"Invalid unicode escape sequence\"\nPARSER_ERR_IN_EXPECTED = \"Expected 'in' token\"\nPARSER_ERR_LABELLED_FUNC_NOT_IN_BLOCK = \"Labelled functions are only allowed inside blocks\"\nPARSER_ERR_LEFT_BRACE_EXPECTED = \"Expected '{' token\"\nPARSER_ERR_LEFT_BRACE_MULTIPLY_EXPECTED = \"Expected '{' or '*' token\"\nPARSER_ERR_LEFT_BRACE_MULTIPLY_LITERAL_EXPECTED = \"Expected '{' or '*' or literal token\"\nPARSER_ERR_LEFT_HAND_SIDE_EXP_EXPECTED = \"Left-hand-side expression expected\"\nPARSER_ERR_LEFT_PAREN_EXPECTED = \"Expected '(' token\"\nPARSER_ERR_LEXICAL_LET_BINDING = \"Let binding cannot appear in let/const declarations\"\nPARSER_ERR_LEXICAL_SINGLE_STATEMENT = \"Lexical declaration cannot appear in a single-statement context\"\nPARSER_ERR_LITERAL_LIMIT_REACHED = \"Maximum number of literals reached\"\nPARSER_ERR_META_EXPECTED = \"Expected 'meta' keyword\"\nPARSER_ERR_MISSING_ASSIGN_AFTER_CONST = \"Value assignment is expected after a const declaration\"\nPARSER_ERR_MISSING_EXPONENT = \"Missing exponent part\"\nPARSER_ERR_MODULE_UNEXPECTED = \"Unexpected import or export statement\"\nPARSER_ERR_MULTIPLE_CLASS_CONSTRUCTORS = \"Multiple constructors are not allowed\"\nPARSER_ERR_MULTIPLE_DEFAULTS_NOT_ALLOWED = \"Multiple default cases are not allowed\"\nPARSER_ERR_NEWLINE_NOT_ALLOWED = \"Newline is not allowed in strings or regexps\"\nPARSER_ERR_NEW_TARGET_EXPECTED = \"Expected new.target expression\"\nPARSER_ERR_NEW_TARGET_NOT_ALLOWED = \"new.target expression is not allowed here\"\nPARSER_ERR_NON_STRICT_ARG_DEFINITION = \"Non-strict argument definition\"\nPARSER_ERR_NO_ARGUMENTS_EXPECTED = \"Property getters must have no arguments\"\nPARSER_ERR_NUMBER_TOO_LONG = \"Number is too long\"\nPARSER_ERR_OBJECT_ITEM_SEPARATOR_EXPECTED = \"Expected ',' or '}' after a property definition\"\nPARSER_ERR_OCTAL_ESCAPE_NOT_ALLOWED = \"Octal escape sequences are not allowed in strict mode\"\nPARSER_ERR_OCTAL_NUMBER_NOT_ALLOWED = \"Octal numbers are not allowed in strict mode\"\nPARSER_ERR_OF_EXPECTED = \"Expected 'of' token\"\nPARSER_ERR_ONE_ARGUMENT_EXPECTED = \"Property setters must have one argument\"\nPARSER_ERR_PROPERTY_IDENTIFIER_EXPECTED = \"Property identifier expected\"\nPARSER_ERR_REGEXP_TOO_LONG = \"Regexp is too long\"\nPARSER_ERR_REST_PARAMETER_DEFAULT_INITIALIZER = \"Rest parameter may not have a default initializer\"\nPARSER_ERR_RIGHT_BRACE_COMMA_EXPECTED = \"Expected '}' or ',' token\"\nPARSER_ERR_RIGHT_BRACE_EXPECTED = \"Expected '}' token\"\nPARSER_ERR_RIGHT_PAREN_EXPECTED = \"Expected ')' token\"\nPARSER_ERR_RIGHT_SQUARE_EXPECTED = \"Expected ']' token\"\nPARSER_ERR_SCOPE_STACK_LIMIT_REACHED = \"Maximum depth of scope stack reached\"\nPARSER_ERR_SEMICOLON_EXPECTED = \"Expected ';' token\"\nPARSER_ERR_SETTER_REST_PARAMETER = \"Setter function argument must not be a rest parameter\"\nPARSER_ERR_STACK_LIMIT_REACHED = \"Maximum function stack size reached\"\nPARSER_ERR_STATEMENT_EXPECTED = \"Statement expected\"\nPARSER_ERR_STRICT_IDENT_NOT_ALLOWED = \"Identifier name is reserved in strict mode\"\nPARSER_ERR_STRING_EXPECTED = \"Expected a string literal\"\nPARSER_ERR_STRING_TOO_LONG = \"String is too long\"\nPARSER_ERR_TEMPLATE_STR_OCTAL_ESCAPE = \"Octal escape sequences are not allowed in template strings\"\nPARSER_ERR_TOO_MANY_CLASS_FIELDS = \"Too many computed class fields are declared\"\nPARSER_ERR_UNEXPECTED_END = \"Unexpected end of input\"\nPARSER_ERR_UNEXPECTED_SUPER_KEYWORD = \"Super is not allowed to be used here\"\nPARSER_ERR_UNKNOWN_REGEXP_FLAG = \"Unknown regexp flag\"\nPARSER_ERR_UNSUPPORTED_REGEXP = \"Regexp is not supported in the selected profile\"\nPARSER_ERR_UNTERMINATED_MULTILINE_COMMENT = \"Unterminated multiline comment\"\nPARSER_ERR_UNTERMINATED_REGEXP = \"Unterminated regexp literal\"\nPARSER_ERR_UNTERMINATED_STRING = \"Unterminated string literal\"\nPARSER_ERR_USE_STRICT_NOT_ALLOWED = \"The 'use strict' directive is not allowed for functions with non-simple arguments\"\nPARSER_ERR_VARIABLE_REDECLARED = \"Local variable is redeclared\"\nPARSER_ERR_WHILE_EXPECTED = \"While expected for do-while loop\"\nPARSER_ERR_WITH_NOT_ALLOWED = \"With statement not allowed in strict mode\"\nPARSER_ERR_YIELD_NOT_ALLOWED = \"Yield expression is not allowed here\"\nPARSER_ERR_DUPLICATED_PRIVATE_FIELD = \"Private field has already been declared\"\nPARSER_ERR_UNDECLARED_PRIVATE_FIELD = \"Private field must be declared in an enclosing class\"\nPARSER_ERR_DELETE_PRIVATE_FIELD = \"Private fields can not be deleted\"\nPARSER_ERR_UNEXPECTED_PRIVATE_FIELD = \"Unexpected private field\"\nPARSER_ERR_CLASS_PRIVATE_CONSTRUCTOR = \"Class constructor may not be a private method\"\nPARSER_ERR_INVALID_TAGGED_TEMPLATE_OPTIONAL_CHAIN = \"Invalid tagged template on optional chain\"\n"
  },
  {
    "path": "jerry-core/parser/js/parser-errors.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"parser-errors.h\"\n\n#if JERRY_ERROR_MESSAGES\n/**\n * Struct to store parser error message with its size.\n */\ntypedef struct\n{\n  lit_utf8_byte_t *text; /* Text of parser error message. */\n  uint8_t size; /* Size of parser error message. */\n} parser_error_message_t;\n\n/* Error message texts with size. */\nstatic parser_error_message_t parser_error_messages[] JERRY_ATTR_CONST_DATA = {\n  { (lit_utf8_byte_t *) \"\", 0 }, /* PARSER_ERR_EMPTY */\n/** @cond doxygen_suppress */\n#define PARSER_ERROR_DEF(id, utf8_string) { (lit_utf8_byte_t *) utf8_string, sizeof (utf8_string) - 1 },\n#include \"parser-error-messages.inc.h\"\n#undef PARSER_ERROR_DEF\n  /** @endcond */\n};\n#endif /* JERRY_ERROR_MESSAGES */\n\n/**\n * Get specified parser error as zero-terminated string\n *\n * @return pointer to zero-terminated parser error\n */\nconst lit_utf8_byte_t *\nparser_get_error_utf8 (uint32_t id) /**< parser error id */\n{\n  JERRY_ASSERT (id < PARSER_ERR_OUT_OF_MEMORY);\n\n#if JERRY_ERROR_MESSAGES\n  return parser_error_messages[id].text;\n#else /* !JERRY_ERROR_MESSAGES */\n  return NULL;\n#endif /* JERRY_ERROR_MESSAGES */\n} /* parser_get_error_utf8 */\n\n/**\n * Get size of specified parser error\n *\n * @return size in bytes\n */\nlit_utf8_size_t\nparser_get_error_size (uint32_t id) /**< parser error id */\n{\n  JERRY_ASSERT (id < PARSER_ERR_OUT_OF_MEMORY);\n\n#if JERRY_ERROR_MESSAGES\n  return parser_error_messages[id].size;\n#else /* !JERRY_ERROR_MESSAGES */\n  return 0;\n#endif /* JERRY_ERROR_MESSAGES */\n} /* parser_get_error_size */\n"
  },
  {
    "path": "jerry-core/parser/js/parser-errors.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef PARSER_ERRORS_H\n#define PARSER_ERRORS_H\n\n#include \"lit-globals.h\"\n\ntypedef enum\n{\n  PARSER_ERR_EMPTY,\n/** @cond doxygen_suppress */\n#if JERRY_ERROR_MESSAGES\n#define PARSER_ERROR_DEF(id, ascii_zt_string) id,\n#else /* !JERRY_ERROR_MESSAGES */\n#define PARSER_ERROR_DEF(id, ascii_zt_string) id = PARSER_ERR_EMPTY,\n#endif /* JERRY_ERROR_MESSAGES */\n#include \"parser-error-messages.inc.h\"\n#undef PARSER_ERROR_DEF\n  /** @endcond */\n  PARSER_ERR_OUT_OF_MEMORY,\n  PARSER_ERR_INVALID_REGEXP,\n#if (JERRY_STACK_LIMIT != 0)\n  PARSER_ERR_STACK_OVERFLOW,\n#endif /* JERRY_STACK_LIMIT != 0 */\n  PARSER_ERR_NO_ERROR,\n} parser_error_msg_t;\n\nconst lit_utf8_byte_t* parser_get_error_utf8 (uint32_t id);\nlit_utf8_size_t parser_get_error_size (uint32_t id);\n\n#endif /* !PARSER_ERRORS_H */\n"
  },
  {
    "path": "jerry-core/parser/regexp/re-bytecode.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"re-bytecode.h\"\n\n#include \"ecma-globals.h\"\n#include \"ecma-regexp-object.h\"\n\n#include \"lit-strings.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup regexparser Regular expression\n * @{\n *\n * \\addtogroup regexparser_bytecode Bytecode\n * @{\n */\n\nvoid\nre_initialize_regexp_bytecode (re_compiler_ctx_t *re_ctx_p) /**< RegExp bytecode context */\n{\n  const size_t initial_size = sizeof (re_compiled_code_t);\n  re_ctx_p->bytecode_start_p = jmem_heap_alloc_block (initial_size);\n  re_ctx_p->bytecode_size = initial_size;\n} /* re_initialize_regexp_bytecode */\n\nextern inline uint32_t JERRY_ATTR_ALWAYS_INLINE\nre_bytecode_size (re_compiler_ctx_t *re_ctx_p) /**< RegExp bytecode context */\n{\n  return (uint32_t) re_ctx_p->bytecode_size;\n} /* re_bytecode_size */\n\n/**\n * Append a new bytecode to the and of the bytecode container\n */\nstatic uint8_t *\nre_bytecode_reserve (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */\n                     const size_t size) /**< size */\n{\n  const size_t old_size = re_ctx_p->bytecode_size;\n  const size_t new_size = old_size + size;\n  re_ctx_p->bytecode_start_p = jmem_heap_realloc_block (re_ctx_p->bytecode_start_p, old_size, new_size);\n  re_ctx_p->bytecode_size = new_size;\n  return re_ctx_p->bytecode_start_p + old_size;\n} /* re_bytecode_reserve */\n\n/**\n * Insert a new bytecode to the bytecode container\n */\nstatic uint8_t *\nre_bytecode_insert (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */\n                    const size_t offset, /**< distance from the start of the container */\n                    const size_t size) /**< size */\n{\n  const size_t tail_size = re_ctx_p->bytecode_size - offset;\n  re_bytecode_reserve (re_ctx_p, size);\n\n  uint8_t *dest_p = re_ctx_p->bytecode_start_p + offset;\n  memmove (dest_p + size, dest_p, tail_size);\n\n  return dest_p;\n} /* re_bytecode_insert */\n\n/**\n * Append a byte\n */\nvoid\nre_append_byte (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */\n                const uint8_t byte) /**< byte value */\n{\n  uint8_t *dest_p = re_bytecode_reserve (re_ctx_p, sizeof (uint8_t));\n  *dest_p = byte;\n} /* re_append_byte */\n\n/**\n * Insert a byte value\n */\nvoid\nre_insert_byte (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */\n                const uint32_t offset, /**< distance from the start of the container */\n                const uint8_t byte) /**< byte value */\n{\n  uint8_t *dest_p = re_bytecode_insert (re_ctx_p, offset, sizeof (uint8_t));\n  *dest_p = byte;\n} /* re_insert_byte */\n\n/**\n * Get a single byte and icnrease bytecode position.\n */\nextern inline uint8_t JERRY_ATTR_ALWAYS_INLINE\nre_get_byte (const uint8_t **bc_p) /**< pointer to bytecode start */\n{\n  return *((*bc_p)++);\n} /* re_get_byte */\n\n/**\n * Append a RegExp opcode\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nre_append_opcode (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */\n                  const re_opcode_t opcode) /**< input opcode */\n{\n  re_append_byte (re_ctx_p, (uint8_t) opcode);\n} /* re_append_opcode */\n\n/**\n * Insert a RegExp opcode\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nre_insert_opcode (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */\n                  const uint32_t offset, /**< distance from the start of the container */\n                  const re_opcode_t opcode) /**< input opcode */\n{\n  re_insert_byte (re_ctx_p, offset, (uint8_t) opcode);\n} /* re_insert_opcode */\n\n/**\n * Get a RegExp opcode and increase the bytecode position\n *\n * @return current RegExp opcode\n */\nextern inline re_opcode_t JERRY_ATTR_ALWAYS_INLINE\nre_get_opcode (const uint8_t **bc_p) /**< pointer to bytecode start */\n{\n  return (re_opcode_t) re_get_byte (bc_p);\n} /* re_get_opcode */\n\n/**\n * Encode 2 byte unsigned integer into the bytecode\n */\nstatic void\nre_encode_u16 (uint8_t *dest_p, /**< destination */\n               const uint16_t value) /**< value */\n{\n  *dest_p++ = (uint8_t) ((value >> 8) & 0xFF);\n  *dest_p = (uint8_t) (value & 0xFF);\n} /* re_encode_u16 */\n\n/**\n * Encode 4 byte unsigned integer into the bytecode\n */\nstatic void\nre_encode_u32 (uint8_t *dest_p, /**< destination */\n               const uint32_t value) /**< value */\n{\n  *dest_p++ = (uint8_t) ((value >> 24) & 0xFF);\n  *dest_p++ = (uint8_t) ((value >> 16) & 0xFF);\n  *dest_p++ = (uint8_t) ((value >> 8) & 0xFF);\n  *dest_p = (uint8_t) (value & 0xFF);\n} /* re_encode_u32 */\n\n/**\n * Decode 2 byte unsigned integer from bytecode\n *\n * @return uint16_t value\n */\nstatic uint16_t\nre_decode_u16 (const uint8_t *src_p) /**< source */\n{\n  uint16_t value = (uint16_t) (((uint16_t) *src_p++) << 8);\n  value = (uint16_t) (value + *src_p++);\n  return value;\n} /* re_decode_u16 */\n\n/**\n * Decode 4 byte unsigned integer from bytecode\n *\n * @return uint32_t value\n */\nstatic uint32_t JERRY_ATTR_NOINLINE\nre_decode_u32 (const uint8_t *src_p) /**< source */\n{\n  uint32_t value = (uint32_t) (((uint32_t) *src_p++) << 24);\n  value += (uint32_t) (((uint32_t) *src_p++) << 16);\n  value += (uint32_t) (((uint32_t) *src_p++) << 8);\n  value += (uint32_t) (*src_p++);\n  return value;\n} /* re_decode_u32 */\n\n/**\n * Get the encoded size of an uint32_t value.\n *\n * @return encoded value size\n */\nstatic inline size_t JERRY_ATTR_ALWAYS_INLINE\nre_get_encoded_value_size (uint32_t value) /**< value */\n{\n  if (JERRY_LIKELY (value <= RE_VALUE_1BYTE_MAX))\n  {\n    return 1;\n  }\n\n  return 5;\n} /* re_get_encoded_value_size */\n\n/*\n * Encode a value to the specified position in the bytecode.\n */\nstatic void\nre_encode_value (uint8_t *dest_p, /**< position in bytecode */\n                 const uint32_t value) /**< value */\n{\n  if (JERRY_LIKELY (value <= RE_VALUE_1BYTE_MAX))\n  {\n    *dest_p = (uint8_t) value;\n    return;\n  }\n\n  *dest_p++ = (uint8_t) (RE_VALUE_4BYTE_MARKER);\n  re_encode_u32 (dest_p, value);\n} /* re_encode_value */\n\n/**\n * Append a value to the end of the bytecode.\n */\nvoid\nre_append_value (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */\n                 const uint32_t value) /**< value */\n{\n  const size_t size = re_get_encoded_value_size (value);\n  uint8_t *dest_p = re_bytecode_reserve (re_ctx_p, size);\n  re_encode_value (dest_p, value);\n} /* re_append_value */\n\n/**\n * Insert a value into the bytecode at a specific offset.\n */\nvoid\nre_insert_value (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */\n                 const uint32_t offset, /**< bytecode offset */\n                 const uint32_t value) /**< value */\n{\n  const size_t size = re_get_encoded_value_size (value);\n  uint8_t *dest_p = re_bytecode_insert (re_ctx_p, offset, size);\n  re_encode_value (dest_p, value);\n} /* re_insert_value */\n\n/**\n * Read an encoded value from the bytecode.\n *\n * @return decoded value\n */\nextern inline uint32_t JERRY_ATTR_ALWAYS_INLINE\nre_get_value (const uint8_t **bc_p) /** refence to bytecode pointer */\n{\n  uint32_t value = *(*bc_p)++;\n  if (JERRY_LIKELY (value <= RE_VALUE_1BYTE_MAX))\n  {\n    return value;\n  }\n\n  value = re_decode_u32 (*bc_p);\n  *bc_p += sizeof (uint32_t);\n  return value;\n} /* re_get_value */\n\n/**\n * Append a character to the RegExp bytecode\n */\nvoid\nre_append_char (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */\n                const lit_code_point_t cp) /**< code point */\n{\n  const size_t size = (re_ctx_p->flags & RE_FLAG_UNICODE) ? sizeof (lit_code_point_t) : sizeof (ecma_char_t);\n  uint8_t *dest_p = re_bytecode_reserve (re_ctx_p, size);\n\n  if (re_ctx_p->flags & RE_FLAG_UNICODE)\n  {\n    re_encode_u32 (dest_p, cp);\n    return;\n  }\n\n  JERRY_ASSERT (cp <= LIT_UTF16_CODE_UNIT_MAX);\n  re_encode_u16 (dest_p, (ecma_char_t) cp);\n} /* re_append_char */\n\n/**\n * Append a character to the RegExp bytecode\n */\nvoid\nre_insert_char (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */\n                const uint32_t offset, /**< bytecode offset */\n                const lit_code_point_t cp) /**< code point*/\n{\n  const size_t size = (re_ctx_p->flags & RE_FLAG_UNICODE) ? sizeof (lit_code_point_t) : sizeof (ecma_char_t);\n\n  uint8_t *dest_p = re_bytecode_insert (re_ctx_p, offset, size);\n\n  if (re_ctx_p->flags & RE_FLAG_UNICODE)\n  {\n    re_encode_u32 (dest_p, cp);\n    return;\n  }\n\n  JERRY_ASSERT (cp <= LIT_UTF16_CODE_UNIT_MAX);\n  re_encode_u16 (dest_p, (ecma_char_t) cp);\n} /* re_insert_char */\n\n/**\n * Decode a character from the bytecode.\n *\n * @return decoded character\n */\nextern inline lit_code_point_t JERRY_ATTR_ALWAYS_INLINE\nre_get_char (const uint8_t **bc_p, /**< reference to bytecode pointer */\n             bool unicode) /**< full unicode mode */\n{\n  lit_code_point_t cp;\n\n  if (unicode)\n  {\n    cp = re_decode_u32 (*bc_p);\n    *bc_p += sizeof (lit_code_point_t);\n  }\n  else\n  {\n    cp = re_decode_u16 (*bc_p);\n    *bc_p += sizeof (ecma_char_t);\n  }\n\n  return cp;\n} /* re_get_char */\n\n#if JERRY_REGEXP_DUMP_BYTE_CODE\nstatic uint32_t\nre_get_bytecode_offset (const uint8_t *start_p, /**< bytecode start pointer */\n                        const uint8_t *current_p) /**< current bytecode pointer */\n{\n  return (uint32_t) ((uintptr_t) current_p - (uintptr_t) start_p);\n} /* re_get_bytecode_offset */\n\n/**\n * RegExp bytecode dumper\n */\nvoid\nre_dump_bytecode (re_compiler_ctx_t *re_ctx_p) /**< RegExp bytecode context */\n{\n  static const char escape_chars[] = { 'd', 'D', 'w', 'W', 's', 'S' };\n\n  re_compiled_code_t *compiled_code_p = (re_compiled_code_t *) re_ctx_p->bytecode_start_p;\n  JERRY_DEBUG_MSG (\"Flags: 0x%x \", compiled_code_p->header.status_flags);\n  JERRY_DEBUG_MSG (\"Capturing groups: %d \", compiled_code_p->captures_count);\n  JERRY_DEBUG_MSG (\"Non-capturing groups: %d\\n\", compiled_code_p->non_captures_count);\n\n  const uint8_t *bytecode_start_p = (const uint8_t *) (compiled_code_p + 1);\n  const uint8_t *bytecode_p = bytecode_start_p;\n\n  while (true)\n  {\n    JERRY_DEBUG_MSG (\"[%3u] \", (uint32_t) ((uintptr_t) bytecode_p - (uintptr_t) bytecode_start_p));\n    re_opcode_t op = *bytecode_p++;\n    switch (op)\n    {\n      case RE_OP_ALTERNATIVE_START:\n      {\n        JERRY_DEBUG_MSG (\"ALTERNATIVE_START \");\n        const uint32_t offset = re_get_value (&bytecode_p) + re_get_bytecode_offset (bytecode_start_p, bytecode_p);\n        JERRY_DEBUG_MSG (\"tail offset: [%3u]\\n\", offset);\n        break;\n      }\n      case RE_OP_ALTERNATIVE_NEXT:\n      {\n        JERRY_DEBUG_MSG (\"ALTERNATIVE_NEXT \");\n        const uint32_t offset = re_get_value (&bytecode_p) + re_get_bytecode_offset (bytecode_start_p, bytecode_p);\n        JERRY_DEBUG_MSG (\"tail offset: [%3u]\\n\", offset);\n        break;\n      }\n      case RE_OP_NO_ALTERNATIVE:\n      {\n        JERRY_DEBUG_MSG (\"NO_ALTERNATIVES\\n\");\n        break;\n      }\n      case RE_OP_CAPTURING_GROUP_START:\n      {\n        JERRY_DEBUG_MSG (\"CAPTURING_GROUP_START \");\n        JERRY_DEBUG_MSG (\"idx: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"capture count: %u, \", re_get_value (&bytecode_p));\n\n        const uint32_t qmin = re_get_value (&bytecode_p);\n        JERRY_DEBUG_MSG (\"qmin: %u\", qmin);\n        if (qmin == 0)\n        {\n          const uint32_t offset = re_get_value (&bytecode_p) + re_get_bytecode_offset (bytecode_start_p, bytecode_p);\n          JERRY_DEBUG_MSG (\", tail offset: [%3u]\\n\", offset);\n        }\n        else\n        {\n          JERRY_DEBUG_MSG (\"\\n\");\n        }\n\n        break;\n      }\n      case RE_OP_NON_CAPTURING_GROUP_START:\n      {\n        JERRY_DEBUG_MSG (\"NON_CAPTURING_GROUP_START \");\n        JERRY_DEBUG_MSG (\"idx: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"capture start: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"capture count: %u, \", re_get_value (&bytecode_p));\n\n        const uint32_t qmin = re_get_value (&bytecode_p);\n        JERRY_DEBUG_MSG (\"qmin: %u\", qmin);\n        if (qmin == 0)\n        {\n          const uint32_t offset = re_get_value (&bytecode_p) + re_get_bytecode_offset (bytecode_start_p, bytecode_p);\n          JERRY_DEBUG_MSG (\", tail offset: [%3u]\\n\", offset);\n        }\n        else\n        {\n          JERRY_DEBUG_MSG (\"\\n\");\n        }\n\n        break;\n      }\n      case RE_OP_GREEDY_CAPTURING_GROUP_END:\n      {\n        JERRY_DEBUG_MSG (\"GREEDY_CAPTURING_GROUP_END \");\n        JERRY_DEBUG_MSG (\"idx: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"qmin: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"qmax: %u\\n\", re_get_value (&bytecode_p) - RE_QMAX_OFFSET);\n        break;\n      }\n      case RE_OP_LAZY_CAPTURING_GROUP_END:\n      {\n        JERRY_DEBUG_MSG (\"LAZY_CAPTURING_GROUP_END \");\n        JERRY_DEBUG_MSG (\"idx: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"qmin: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"qmax: %u\\n\", re_get_value (&bytecode_p) - RE_QMAX_OFFSET);\n        break;\n      }\n      case RE_OP_GREEDY_NON_CAPTURING_GROUP_END:\n      {\n        JERRY_DEBUG_MSG (\"GREEDY_NON_CAPTURING_GROUP_END \");\n        JERRY_DEBUG_MSG (\"idx: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"qmin: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"qmax: %u\\n\", re_get_value (&bytecode_p) - RE_QMAX_OFFSET);\n        break;\n      }\n      case RE_OP_LAZY_NON_CAPTURING_GROUP_END:\n      {\n        JERRY_DEBUG_MSG (\"LAZY_NON_CAPTURING_GROUP_END \");\n        JERRY_DEBUG_MSG (\"idx: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"qmin: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"qmax: %u\\n\", re_get_value (&bytecode_p) - RE_QMAX_OFFSET);\n        break;\n      }\n      case RE_OP_GREEDY_ITERATOR:\n      {\n        JERRY_DEBUG_MSG (\"GREEDY_ITERATOR \");\n        JERRY_DEBUG_MSG (\"qmin: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"qmax: %u, \", re_get_value (&bytecode_p) - RE_QMAX_OFFSET);\n        const uint32_t offset = re_get_value (&bytecode_p) + re_get_bytecode_offset (bytecode_start_p, bytecode_p);\n        JERRY_DEBUG_MSG (\"tail offset: [%3u]\\n\", offset);\n        break;\n      }\n      case RE_OP_LAZY_ITERATOR:\n      {\n        JERRY_DEBUG_MSG (\"LAZY_ITERATOR \");\n        JERRY_DEBUG_MSG (\"qmin: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"qmax: %u, \", re_get_value (&bytecode_p) - RE_QMAX_OFFSET);\n        const uint32_t offset = re_get_value (&bytecode_p) + re_get_bytecode_offset (bytecode_start_p, bytecode_p);\n        JERRY_DEBUG_MSG (\"tail offset: [%3u]\\n\", offset);\n        break;\n      }\n      case RE_OP_ITERATOR_END:\n      {\n        JERRY_DEBUG_MSG (\"ITERATOR_END\\n\");\n        break;\n      }\n      case RE_OP_BACKREFERENCE:\n      {\n        JERRY_DEBUG_MSG (\"BACKREFERENCE \");\n        JERRY_DEBUG_MSG (\"idx: %d\\n\", re_get_value (&bytecode_p));\n        break;\n      }\n      case RE_OP_ASSERT_LINE_START:\n      {\n        JERRY_DEBUG_MSG (\"ASSERT_LINE_START\\n\");\n        break;\n      }\n      case RE_OP_ASSERT_LINE_END:\n      {\n        JERRY_DEBUG_MSG (\"ASSERT_LINE_END\\n\");\n        break;\n      }\n      case RE_OP_ASSERT_LOOKAHEAD_POS:\n      {\n        JERRY_DEBUG_MSG (\"ASSERT_LOOKAHEAD_POS \");\n        JERRY_DEBUG_MSG (\"qmin: %u, \", *bytecode_p++);\n        JERRY_DEBUG_MSG (\"capture start: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"capture count: %u, \", re_get_value (&bytecode_p));\n        const uint32_t offset = re_get_value (&bytecode_p) + re_get_bytecode_offset (bytecode_start_p, bytecode_p);\n        JERRY_DEBUG_MSG (\"tail offset: [%3u]\\n\", offset);\n        break;\n      }\n      case RE_OP_ASSERT_LOOKAHEAD_NEG:\n      {\n        JERRY_DEBUG_MSG (\"ASSERT_LOOKAHEAD_NEG \");\n        JERRY_DEBUG_MSG (\"qmin: %u, \", *bytecode_p++);\n        JERRY_DEBUG_MSG (\"capture start: %u, \", re_get_value (&bytecode_p));\n        JERRY_DEBUG_MSG (\"capture count: %u, \", re_get_value (&bytecode_p));\n        const uint32_t offset = re_get_value (&bytecode_p) + re_get_bytecode_offset (bytecode_start_p, bytecode_p);\n        JERRY_DEBUG_MSG (\"tail offset: [%3u]\\n\", offset);\n        break;\n      }\n      case RE_OP_ASSERT_END:\n      {\n        JERRY_DEBUG_MSG (\"ASSERT_END\\n\");\n        break;\n      }\n      case RE_OP_ASSERT_WORD_BOUNDARY:\n      {\n        JERRY_DEBUG_MSG (\"ASSERT_WORD_BOUNDARY\\n\");\n        break;\n      }\n      case RE_OP_ASSERT_NOT_WORD_BOUNDARY:\n      {\n        JERRY_DEBUG_MSG (\"ASSERT_NOT_WORD_BOUNDARY\\n\");\n        break;\n      }\n      case RE_OP_CLASS_ESCAPE:\n      {\n        ecma_class_escape_t escape = (ecma_class_escape_t) *bytecode_p++;\n        JERRY_DEBUG_MSG (\"CLASS_ESCAPE \\\\%c\\n\", escape_chars[escape]);\n        break;\n      }\n      case RE_OP_CHAR_CLASS:\n      {\n        JERRY_DEBUG_MSG (\"CHAR_CLASS \");\n        uint8_t flags = *bytecode_p++;\n        uint32_t char_count = (flags & RE_CLASS_HAS_CHARS) ? re_get_value (&bytecode_p) : 0;\n        uint32_t range_count = (flags & RE_CLASS_HAS_RANGES) ? re_get_value (&bytecode_p) : 0;\n\n        if (flags & RE_CLASS_INVERT)\n        {\n          JERRY_DEBUG_MSG (\"inverted \");\n        }\n\n        JERRY_DEBUG_MSG (\"escapes: \");\n        uint8_t escape_count = flags & RE_CLASS_ESCAPE_COUNT_MASK;\n        while (escape_count--)\n        {\n          JERRY_DEBUG_MSG (\"\\\\%c, \", escape_chars[*bytecode_p++]);\n        }\n\n        JERRY_DEBUG_MSG (\"chars: \");\n        while (char_count--)\n        {\n          JERRY_DEBUG_MSG (\"\\\\u%04x, \", re_get_char (&bytecode_p, re_ctx_p->flags & RE_FLAG_UNICODE));\n        }\n\n        JERRY_DEBUG_MSG (\"ranges: \");\n        while (range_count--)\n        {\n          const lit_code_point_t begin = re_get_char (&bytecode_p, re_ctx_p->flags & RE_FLAG_UNICODE);\n          const lit_code_point_t end = re_get_char (&bytecode_p, re_ctx_p->flags & RE_FLAG_UNICODE);\n          JERRY_DEBUG_MSG (\"\\\\u%04x-\\\\u%04x, \", begin, end);\n        }\n\n        JERRY_DEBUG_MSG (\"\\n\");\n        break;\n      }\n      case RE_OP_UNICODE_PERIOD:\n      {\n        JERRY_DEBUG_MSG (\"UNICODE_PERIOD\\n\");\n        break;\n      }\n      case RE_OP_PERIOD:\n      {\n        JERRY_DEBUG_MSG (\"PERIOD\\n\");\n        break;\n      }\n      case RE_OP_CHAR:\n      {\n        JERRY_DEBUG_MSG (\"CHAR \\\\u%04x\\n\", re_get_char (&bytecode_p, re_ctx_p->flags & RE_FLAG_UNICODE));\n        break;\n      }\n      case RE_OP_BYTE:\n      {\n        const uint8_t ch = *bytecode_p++;\n        JERRY_DEBUG_MSG (\"BYTE \\\\u%04x '%c'\\n\", ch, (char) ch);\n        break;\n      }\n      case RE_OP_EOF:\n      {\n        JERRY_DEBUG_MSG (\"EOF\\n\");\n        return;\n      }\n      default:\n      {\n        JERRY_DEBUG_MSG (\"UNKNOWN(%d)\\n\", (uint32_t) op);\n        break;\n      }\n    }\n  }\n} /* re_dump_bytecode */\n#endif /* JERRY_REGEXP_DUMP_BYTE_CODE */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n"
  },
  {
    "path": "jerry-core/parser/regexp/re-bytecode.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef RE_BYTECODE_H\n#define RE_BYTECODE_H\n\n#include \"ecma-globals.h\"\n\n#include \"re-compiler-context.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup regexparser Regular expression\n * @{\n *\n * \\addtogroup regexparser_bytecode Bytecode\n * @{\n */\n\n/**\n * Size of the RegExp bytecode cache\n */\n#define RE_CACHE_SIZE 8u\n\n/**\n * Maximum value that can be encoded in the RegExp bytecode as a single byte.\n */\n#define RE_VALUE_1BYTE_MAX 0xFE\n\n/**\n * Marker that signals that the actual value is enocded in the following 4 bytes in the bytecode.\n */\n#define RE_VALUE_4BYTE_MARKER 0xFF\n\n/**\n * RegExp opcodes\n */\ntypedef enum\n{\n  RE_OP_EOF, /**< end of pattern */\n\n  RE_OP_ALTERNATIVE_START, /**< start of alternatives */\n  RE_OP_ALTERNATIVE_NEXT, /**< next alternative */\n  RE_OP_NO_ALTERNATIVE, /**< no alternative */\n\n  RE_OP_CAPTURING_GROUP_START, /**< start of a capturing group */\n  RE_OP_NON_CAPTURING_GROUP_START, /**< start of a non-capturing group */\n\n  RE_OP_GREEDY_CAPTURING_GROUP_END, /**< end of a greedy capturing group */\n  RE_OP_GREEDY_NON_CAPTURING_GROUP_END, /**< end of a greedy non-capturing group */\n  RE_OP_LAZY_CAPTURING_GROUP_END, /**< end of a lazy capturing group */\n  RE_OP_LAZY_NON_CAPTURING_GROUP_END, /**< end of a lazy non-capturing group */\n\n  RE_OP_GREEDY_ITERATOR, /**< greedy iterator */\n  RE_OP_LAZY_ITERATOR, /**< lazy iterator */\n  RE_OP_ITERATOR_END, /*** end of an iterator */\n\n  RE_OP_BACKREFERENCE, /**< backreference */\n\n  RE_OP_ASSERT_LINE_START, /**< line start assertion */\n  RE_OP_ASSERT_LINE_END, /**< line end assertion */\n  RE_OP_ASSERT_WORD_BOUNDARY, /**< word boundary assertion */\n  RE_OP_ASSERT_NOT_WORD_BOUNDARY, /**< not word boundary assertion */\n  RE_OP_ASSERT_LOOKAHEAD_POS, /**< positive lookahead assertion */\n  RE_OP_ASSERT_LOOKAHEAD_NEG, /**< negative lookahead assertion */\n  RE_OP_ASSERT_END, /**< end of an assertion */\n\n  RE_OP_CLASS_ESCAPE, /**< class escape */\n  RE_OP_CHAR_CLASS, /**< character class */\n  RE_OP_UNICODE_PERIOD, /**< period in full unicode mode */\n  RE_OP_PERIOD, /**< period in non-unicode mode */\n  RE_OP_CHAR, /**< any code point */\n  RE_OP_BYTE, /**< 1-byte utf8 character */\n} re_opcode_t;\n\n/**\n * Compiled byte code data.\n */\ntypedef struct\n{\n  ecma_compiled_code_t header; /**< compiled code header */\n  uint32_t captures_count; /**< number of capturing groups */\n  uint32_t non_captures_count; /**< number of non-capturing groups */\n  ecma_value_t source; /**< original RegExp pattern */\n} re_compiled_code_t;\n\nvoid re_initialize_regexp_bytecode (re_compiler_ctx_t *re_ctx_p);\nuint32_t re_bytecode_size (re_compiler_ctx_t *re_ctx_p);\n\nvoid re_append_opcode (re_compiler_ctx_t *re_ctx_p, const re_opcode_t opcode);\nvoid re_append_byte (re_compiler_ctx_t *re_ctx_p, const uint8_t byte);\nvoid re_append_char (re_compiler_ctx_t *re_ctx_p, const lit_code_point_t cp);\nvoid re_append_value (re_compiler_ctx_t *re_ctx_p, const uint32_t value);\n\nvoid re_insert_opcode (re_compiler_ctx_t *re_ctx_p, const uint32_t offset, const re_opcode_t opcode);\nvoid re_insert_byte (re_compiler_ctx_t *re_ctx_p, const uint32_t offset, const uint8_t byte);\nvoid re_insert_char (re_compiler_ctx_t *re_ctx_p, const uint32_t offset, const lit_code_point_t cp);\nvoid re_insert_value (re_compiler_ctx_t *re_ctx_p, const uint32_t offset, const uint32_t value);\n\nre_opcode_t re_get_opcode (const uint8_t **bc_p);\nuint8_t re_get_byte (const uint8_t **bc_p);\nlit_code_point_t re_get_char (const uint8_t **bc_p, bool unicode);\nuint32_t re_get_value (const uint8_t **bc_p);\n\n#if JERRY_REGEXP_DUMP_BYTE_CODE\nvoid re_dump_bytecode (re_compiler_ctx_t *bc_ctx);\n#endif /* JERRY_REGEXP_DUMP_BYTE_CODE */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n#endif /* !RE_BYTECODE_H */\n"
  },
  {
    "path": "jerry-core/parser/regexp/re-compiler-context.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef RE_COMPILER_CONTEXT_H\n#define RE_COMPILER_CONTEXT_H\n\n#include \"re-token.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup regexparser Regular expression\n * @{\n *\n * \\addtogroup regexparser_compiler Compiler\n * @{\n */\n\n/**\n * RegExp compiler context\n */\ntypedef struct\n{\n  const lit_utf8_byte_t *input_start_p; /**< start of input pattern */\n  const lit_utf8_byte_t *input_curr_p; /**< current position in input pattern */\n  const lit_utf8_byte_t *input_end_p; /**< end of input pattern */\n\n  uint8_t *bytecode_start_p; /**< start of bytecode block */\n  size_t bytecode_size; /**< size of bytecode */\n\n  uint32_t captures_count; /**< number of capture groups */\n  uint32_t non_captures_count; /**< number of non-capture groups */\n\n  int groups_count; /**< number of groups */\n  uint16_t flags; /**< RegExp flags */\n  re_token_t token; /**< current token */\n} re_compiler_ctx_t;\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n#endif /* !RE_COMPILER_CONTEXT_H */\n"
  },
  {
    "path": "jerry-core/parser/regexp/re-compiler.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"re-compiler.h\"\n\n#include \"ecma-exceptions.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-regexp-object.h\"\n\n#include \"jcontext.h\"\n#include \"jmem.h\"\n#include \"jrt-libc-includes.h\"\n#include \"lit-char-helpers.h\"\n#include \"re-bytecode.h\"\n#include \"re-compiler-context.h\"\n#include \"re-parser.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup regexparser Regular expression\n * @{\n *\n * \\addtogroup regexparser_compiler Compiler\n * @{\n */\n\n/**\n * Search for the given pattern in the RegExp cache.\n *\n * @return pointer to bytecode if found\n *         NULL - otherwise\n */\nstatic re_compiled_code_t *\nre_cache_lookup (ecma_string_t *pattern_str_p, /**< pattern string */\n                 uint16_t flags) /**< flags */\n{\n  re_compiled_code_t **cache_p = JERRY_CONTEXT (re_cache);\n\n  for (uint8_t idx = 0u; idx < RE_CACHE_SIZE; idx++)\n  {\n    re_compiled_code_t *cached_bytecode_p = cache_p[idx];\n\n    if (cached_bytecode_p == NULL)\n    {\n      break;\n    }\n\n    ecma_string_t *cached_pattern_str_p = ecma_get_string_from_value (cached_bytecode_p->source);\n\n    if (cached_bytecode_p->header.status_flags == flags\n        && ecma_compare_ecma_strings (cached_pattern_str_p, pattern_str_p))\n    {\n      return cached_bytecode_p;\n    }\n  }\n\n  return NULL;\n} /* re_cache_lookup */\n\n/**\n * Run garbage collection in RegExp cache.\n */\nvoid\nre_cache_gc (void)\n{\n  re_compiled_code_t **cache_p = JERRY_CONTEXT (re_cache);\n\n  for (uint32_t i = 0u; i < RE_CACHE_SIZE; i++)\n  {\n    const re_compiled_code_t *cached_bytecode_p = cache_p[i];\n\n    if (cached_bytecode_p == NULL)\n    {\n      break;\n    }\n\n    ecma_bytecode_deref ((ecma_compiled_code_t *) cached_bytecode_p);\n    cache_p[i] = NULL;\n  }\n\n  JERRY_CONTEXT (re_cache_idx) = 0;\n} /* re_cache_gc */\n\n/**\n * Compilation of RegExp bytecode\n *\n * @return pointer to bytecode if compilation was successful\n *         NULL - otherwise\n */\nre_compiled_code_t *\nre_compile_bytecode (ecma_string_t *pattern_str_p, /**< pattern */\n                     uint16_t flags) /**< flags */\n{\n  re_compiled_code_t *cached_bytecode_p = re_cache_lookup (pattern_str_p, flags);\n\n  if (cached_bytecode_p != NULL)\n  {\n    ecma_bytecode_ref ((ecma_compiled_code_t *) cached_bytecode_p);\n    return cached_bytecode_p;\n  }\n\n  re_compiler_ctx_t re_ctx;\n  re_ctx.flags = flags;\n  re_ctx.captures_count = 1;\n  re_ctx.non_captures_count = 0;\n\n  re_initialize_regexp_bytecode (&re_ctx);\n\n  ECMA_STRING_TO_UTF8_STRING (pattern_str_p, pattern_start_p, pattern_start_size);\n\n  re_ctx.input_start_p = pattern_start_p;\n  re_ctx.input_curr_p = (lit_utf8_byte_t *) pattern_start_p;\n  re_ctx.input_end_p = pattern_start_p + pattern_start_size;\n  re_ctx.groups_count = -1;\n\n  /* Parse RegExp pattern */\n  ecma_value_t result = re_parse_alternative (&re_ctx, true);\n\n  ECMA_FINALIZE_UTF8_STRING (pattern_start_p, pattern_start_size);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    /* Compilation failed, free bytecode. */\n    jmem_heap_free_block (re_ctx.bytecode_start_p, re_ctx.bytecode_size);\n    return NULL;\n  }\n\n  /* Align bytecode size to JMEM_ALIGNMENT so that it can be stored in the bytecode header. */\n  const uint32_t final_size = JERRY_ALIGNUP (re_ctx.bytecode_size, JMEM_ALIGNMENT);\n  re_compiled_code_t *re_compiled_code_p =\n    (re_compiled_code_t *) jmem_heap_realloc_block (re_ctx.bytecode_start_p, re_ctx.bytecode_size, final_size);\n\n  /* Bytecoded will be inserted into the cache and returned to the caller, so refcount is implicitly set to 2. */\n  re_compiled_code_p->header.refs = 2;\n  re_compiled_code_p->header.size = (uint16_t) (final_size >> JMEM_ALIGNMENT_LOG);\n  re_compiled_code_p->header.status_flags = re_ctx.flags;\n\n  ecma_ref_ecma_string (pattern_str_p);\n  re_compiled_code_p->source = ecma_make_string_value (pattern_str_p);\n  re_compiled_code_p->captures_count = re_ctx.captures_count;\n  re_compiled_code_p->non_captures_count = re_ctx.non_captures_count;\n\n#if JERRY_REGEXP_DUMP_BYTE_CODE\n  if (JERRY_CONTEXT (jerry_init_flags) & JERRY_INIT_SHOW_REGEXP_OPCODES)\n  {\n    re_dump_bytecode (&re_ctx);\n  }\n#endif /* JERRY_REGEXP_DUMP_BYTE_CODE */\n\n  uint8_t cache_idx = JERRY_CONTEXT (re_cache_idx);\n\n  if (JERRY_CONTEXT (re_cache)[cache_idx] != NULL)\n  {\n    ecma_bytecode_deref ((ecma_compiled_code_t *) JERRY_CONTEXT (re_cache)[cache_idx]);\n  }\n\n  JERRY_CONTEXT (re_cache)[cache_idx] = re_compiled_code_p;\n  JERRY_CONTEXT (re_cache_idx) = (uint8_t) (cache_idx + 1) % RE_CACHE_SIZE;\n\n  return re_compiled_code_p;\n} /* re_compile_bytecode */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n"
  },
  {
    "path": "jerry-core/parser/regexp/re-compiler.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef RE_COMPILER_H\n#define RE_COMPILER_H\n\n#include \"ecma-globals.h\"\n\n#include \"re-bytecode.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup regexparser Regular expression\n * @{\n *\n * \\addtogroup regexparser_compiler Compiler\n * @{\n */\n\nre_compiled_code_t *re_compile_bytecode (ecma_string_t *pattern_str_p, uint16_t flags);\n\nvoid re_cache_gc (void);\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n#endif /* !RE_COMPILER_H */\n"
  },
  {
    "path": "jerry-core/parser/regexp/re-parser.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"re-parser.h\"\n\n#include \"ecma-exceptions.h\"\n#include \"ecma-globals.h\"\n\n#include \"jcontext.h\"\n#include \"jrt-libc-includes.h\"\n#include \"lit-char-helpers.h\"\n#include \"re-compiler.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup regexparser Regular expression\n * @{\n *\n * \\addtogroup regexparser_parser Parser\n * @{\n */\n\n/**\n * Get the start opcode for the current group.\n *\n * @return RegExp opcode\n */\nstatic re_opcode_t\nre_get_group_start_opcode (bool is_capturing) /**< is capturing group */\n{\n  return (is_capturing) ? RE_OP_CAPTURING_GROUP_START : RE_OP_NON_CAPTURING_GROUP_START;\n} /* re_get_group_start_opcode */\n\n/**\n * Get the end opcode for the current group.\n *\n * @return RegExp opcode\n */\nstatic re_opcode_t\nre_get_group_end_opcode (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context */\n                         bool is_capturing) /**< is capturing group */\n{\n  if (is_capturing)\n  {\n    if (re_ctx_p->token.greedy)\n    {\n      return RE_OP_GREEDY_CAPTURING_GROUP_END;\n    }\n\n    return RE_OP_LAZY_CAPTURING_GROUP_END;\n  }\n\n  if (re_ctx_p->token.greedy)\n  {\n    return RE_OP_GREEDY_NON_CAPTURING_GROUP_END;\n  }\n\n  return RE_OP_LAZY_NON_CAPTURING_GROUP_END;\n} /* re_get_group_end_opcode */\n\n/**\n * Enclose the given bytecode to a group.\n */\nstatic void\nre_insert_into_group (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context */\n                      uint32_t group_start_offset, /**< offset of group start */\n                      uint32_t idx, /**< index of group */\n                      uint32_t capture_start, /**< index of first nested capture */\n                      bool is_capturing) /**< is capturing group */\n{\n  uint32_t qmin = re_ctx_p->token.qmin;\n  uint32_t qmax = re_ctx_p->token.qmax;\n\n  if (JERRY_UNLIKELY (!is_capturing && re_bytecode_size (re_ctx_p) == group_start_offset))\n  {\n    return;\n  }\n\n  if (qmin == 0)\n  {\n    re_insert_value (re_ctx_p, group_start_offset, re_bytecode_size (re_ctx_p) - group_start_offset);\n  }\n\n  re_insert_value (re_ctx_p, group_start_offset, qmin);\n  re_insert_value (re_ctx_p, group_start_offset, re_ctx_p->captures_count - capture_start);\n\n  if (!is_capturing)\n  {\n    re_insert_value (re_ctx_p, group_start_offset, capture_start);\n  }\n  else\n  {\n    JERRY_ASSERT (idx == capture_start);\n  }\n\n  re_insert_value (re_ctx_p, group_start_offset, idx);\n  re_insert_opcode (re_ctx_p, group_start_offset, re_get_group_start_opcode (is_capturing));\n\n  re_append_opcode (re_ctx_p, re_get_group_end_opcode (re_ctx_p, is_capturing));\n  re_append_value (re_ctx_p, idx);\n  re_append_value (re_ctx_p, qmin);\n  re_append_value (re_ctx_p, qmax + RE_QMAX_OFFSET);\n} /* re_insert_into_group */\n\n/**\n * Insert simple atom iterator.\n */\nstatic void\nre_insert_atom_iterator (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context */\n                         uint32_t start_offset) /**< atom start offset */\n{\n  const uint32_t qmin = re_ctx_p->token.qmin;\n  const uint32_t qmax = re_ctx_p->token.qmax;\n\n  if (qmin == 1 && qmax == 1)\n  {\n    return;\n  }\n\n  re_append_opcode (re_ctx_p, RE_OP_ITERATOR_END);\n  re_insert_value (re_ctx_p, start_offset, re_bytecode_size (re_ctx_p) - start_offset);\n  re_insert_value (re_ctx_p, start_offset, qmax + RE_QMAX_OFFSET);\n  re_insert_value (re_ctx_p, start_offset, qmin);\n  re_insert_opcode (re_ctx_p, start_offset, re_ctx_p->token.greedy ? RE_OP_GREEDY_ITERATOR : RE_OP_LAZY_ITERATOR);\n} /* re_insert_atom_iterator */\n\n/**\n * Insert a lookahead assertion.\n */\nstatic void\nre_insert_assertion_lookahead (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context */\n                               uint32_t start_offset, /**< atom start offset */\n                               uint32_t capture_start, /**< index of first nested capture */\n                               bool negative) /** lookahead type */\n{\n  const uint32_t qmin = re_ctx_p->token.qmin;\n\n  re_append_opcode (re_ctx_p, RE_OP_ASSERT_END);\n  re_insert_value (re_ctx_p, start_offset, re_bytecode_size (re_ctx_p) - start_offset);\n\n  /* We need to clear nested capturing group results when a negative assertion or the tail after a positive assertion\n   * does not match, so we store the begin and end index of nested capturing groups. */\n  re_insert_value (re_ctx_p, start_offset, re_ctx_p->captures_count - capture_start);\n  re_insert_value (re_ctx_p, start_offset, capture_start);\n\n  /* Lookaheads always result in zero length matches, which means iterations will always stop on the first match.\n   * This allows us to not have to deal with iterations beyond one. Either qmin == 0 which will implicitly match,\n   * or qmin > 0, in which case the first iteration will decide whether the assertion matches depending on whether\n   * the iteration matched or not. This also allows us to ignore qmax entirely. */\n  re_insert_byte (re_ctx_p, start_offset, (uint8_t) JERRY_MIN (qmin, 1));\n\n  const re_opcode_t opcode = (negative) ? RE_OP_ASSERT_LOOKAHEAD_NEG : RE_OP_ASSERT_LOOKAHEAD_POS;\n  re_insert_opcode (re_ctx_p, start_offset, opcode);\n} /* re_insert_assertion_lookahead */\n\n/**\n * Consume non greedy (question mark) character if present.\n */\nstatic void\nre_parse_lazy_char (re_compiler_ctx_t *re_ctx_p) /**< RegExp parser context */\n{\n  if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p && *re_ctx_p->input_curr_p == LIT_CHAR_QUESTION)\n  {\n    re_ctx_p->input_curr_p++;\n    re_ctx_p->token.greedy = false;\n    return;\n  }\n\n  re_ctx_p->token.greedy = true;\n} /* re_parse_lazy_char */\n\n/**\n * Parse a max 3 digit long octal number from the input string, with a decimal value less than 256.\n *\n * @return value of the octal number\n */\nstatic uint32_t\nre_parse_octal (re_compiler_ctx_t *re_ctx_p) /**< RegExp parser context */\n{\n  JERRY_ASSERT (re_ctx_p->input_curr_p < re_ctx_p->input_end_p);\n  JERRY_ASSERT (lit_char_is_octal_digit (*re_ctx_p->input_curr_p));\n\n  uint32_t value = (uint32_t) (*re_ctx_p->input_curr_p++) - LIT_CHAR_0;\n\n  if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p && lit_char_is_octal_digit (*re_ctx_p->input_curr_p))\n  {\n    value = value * 8 + (*re_ctx_p->input_curr_p++) - LIT_CHAR_0;\n  }\n\n  if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p && lit_char_is_octal_digit (*re_ctx_p->input_curr_p))\n  {\n    const uint32_t new_value = value * 8 + (*re_ctx_p->input_curr_p) - LIT_CHAR_0;\n\n    if (new_value <= RE_MAX_OCTAL_VALUE)\n    {\n      value = new_value;\n      re_ctx_p->input_curr_p++;\n    }\n  }\n\n  return value;\n} /* re_parse_octal */\n\n/**\n * Check that the currently parsed quantifier is valid.\n *\n * @return ECMA_VALUE_ERROR, if quantifier is invalid\n *         ECMA_VALUE_EMPTY, otherwise\n */\nstatic ecma_value_t\nre_check_quantifier (re_compiler_ctx_t *re_ctx_p)\n{\n  if (re_ctx_p->token.qmin > re_ctx_p->token.qmax)\n  {\n    /* ECMA-262 v5.1 15.10.2.5 */\n    return ecma_raise_syntax_error (ECMA_ERR_MIN_GREATER_THAN_MAX);\n  }\n\n  return ECMA_VALUE_EMPTY;\n} /* re_check_quantifier */\n\n/**\n * Parse RegExp quantifier.\n *\n * @return ECMA_VALUE_TRUE - if parsed successfully\n *         ECMA_VALUE_FALSE - otherwise\n */\nstatic ecma_value_t\nre_parse_quantifier (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context */\n{\n  if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p)\n  {\n    switch (*re_ctx_p->input_curr_p)\n    {\n      case LIT_CHAR_QUESTION:\n      {\n        re_ctx_p->input_curr_p++;\n        re_ctx_p->token.qmin = 0;\n        re_ctx_p->token.qmax = 1;\n\n        re_parse_lazy_char (re_ctx_p);\n        return ECMA_VALUE_TRUE;\n      }\n      case LIT_CHAR_ASTERISK:\n      {\n        re_ctx_p->input_curr_p++;\n        re_ctx_p->token.qmin = 0;\n        re_ctx_p->token.qmax = RE_INFINITY;\n\n        re_parse_lazy_char (re_ctx_p);\n        return ECMA_VALUE_TRUE;\n      }\n      case LIT_CHAR_PLUS:\n      {\n        re_ctx_p->input_curr_p++;\n        re_ctx_p->token.qmin = 1;\n        re_ctx_p->token.qmax = RE_INFINITY;\n\n        re_parse_lazy_char (re_ctx_p);\n        return ECMA_VALUE_TRUE;\n      }\n      case LIT_CHAR_LEFT_BRACE:\n      {\n        const lit_utf8_byte_t *current_p = re_ctx_p->input_curr_p + 1;\n        uint32_t qmin = 0;\n        uint32_t qmax = RE_INFINITY;\n\n        if (current_p >= re_ctx_p->input_end_p)\n        {\n          break;\n        }\n\n        if (!lit_char_is_decimal_digit (*current_p))\n        {\n          break;\n        }\n\n        qmin = lit_parse_decimal (&current_p, re_ctx_p->input_end_p);\n\n        if (current_p >= re_ctx_p->input_end_p)\n        {\n          break;\n        }\n\n        lit_utf8_byte_t ch = *current_p++;\n        if (ch == LIT_CHAR_RIGHT_BRACE)\n        {\n          qmax = qmin;\n        }\n        else if (ch == LIT_CHAR_COMMA)\n        {\n          if (current_p >= re_ctx_p->input_end_p)\n          {\n            break;\n          }\n\n          if (lit_char_is_decimal_digit (*current_p))\n          {\n            qmax = lit_parse_decimal (&current_p, re_ctx_p->input_end_p);\n          }\n\n          if (current_p >= re_ctx_p->input_end_p || *current_p++ != LIT_CHAR_RIGHT_BRACE)\n          {\n            break;\n          }\n        }\n        else\n        {\n          break;\n        }\n\n        re_ctx_p->token.qmin = qmin;\n        re_ctx_p->token.qmax = qmax;\n        re_ctx_p->input_curr_p = current_p;\n        re_parse_lazy_char (re_ctx_p);\n        return ECMA_VALUE_TRUE;\n      }\n      default:\n      {\n        break;\n      }\n    }\n  }\n\n  re_ctx_p->token.qmin = 1;\n  re_ctx_p->token.qmax = 1;\n  re_ctx_p->token.greedy = true;\n\n  return ECMA_VALUE_FALSE;\n} /* re_parse_quantifier */\n\n/**\n * Count the number of groups in the current pattern.\n */\nstatic void\nre_count_groups (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context */\n{\n  bool is_char_class = 0;\n  re_ctx_p->groups_count = 0;\n  const lit_utf8_byte_t *curr_p = re_ctx_p->input_start_p;\n\n  while (curr_p < re_ctx_p->input_end_p)\n  {\n    switch (*curr_p++)\n    {\n      case LIT_CHAR_BACKSLASH:\n      {\n        if (curr_p < re_ctx_p->input_end_p)\n        {\n          lit_utf8_incr (&curr_p);\n        }\n        break;\n      }\n      case LIT_CHAR_LEFT_SQUARE:\n      {\n        is_char_class = true;\n        break;\n      }\n      case LIT_CHAR_RIGHT_SQUARE:\n      {\n        is_char_class = false;\n        break;\n      }\n      case LIT_CHAR_LEFT_PAREN:\n      {\n        if (curr_p < re_ctx_p->input_end_p && *curr_p != LIT_CHAR_QUESTION && !is_char_class)\n        {\n          re_ctx_p->groups_count++;\n        }\n        break;\n      }\n    }\n  }\n} /* re_count_groups */\n\n/**\n * Check if a code point is a Syntax character\n *\n * @return true, if syntax character\n *         false, otherwise\n */\nstatic bool\nre_is_syntax_char (lit_code_point_t cp) /**< code point */\n{\n  return (cp == LIT_CHAR_CIRCUMFLEX || cp == LIT_CHAR_DOLLAR_SIGN || cp == LIT_CHAR_BACKSLASH || cp == LIT_CHAR_DOT\n          || cp == LIT_CHAR_ASTERISK || cp == LIT_CHAR_PLUS || cp == LIT_CHAR_QUESTION || cp == LIT_CHAR_LEFT_PAREN\n          || cp == LIT_CHAR_RIGHT_PAREN || cp == LIT_CHAR_LEFT_SQUARE || cp == LIT_CHAR_RIGHT_SQUARE\n          || cp == LIT_CHAR_LEFT_BRACE || cp == LIT_CHAR_RIGHT_BRACE || cp == LIT_CHAR_VLINE);\n} /* re_is_syntax_char */\n\n/**\n * Parse a Character Escape or a Character Class Escape.\n *\n * @return ECMA_VALUE_EMPTY, if parsed successfully\n *         ECMA_VALUE_ERROR, otherwise\n */\nstatic ecma_value_t\nre_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context */\n{\n  JERRY_ASSERT (re_ctx_p->input_curr_p < re_ctx_p->input_end_p);\n  re_ctx_p->token.type = RE_TOK_CHAR;\n\n  if (lit_char_is_decimal_digit (*re_ctx_p->input_curr_p))\n  {\n    /* NULL code point escape, only valid if there are no following digits. */\n    if (*re_ctx_p->input_curr_p == LIT_CHAR_0\n        && (re_ctx_p->input_curr_p + 1 >= re_ctx_p->input_end_p\n            || !lit_char_is_decimal_digit (re_ctx_p->input_curr_p[1])))\n    {\n      re_ctx_p->input_curr_p++;\n      re_ctx_p->token.value = LIT_UNICODE_CODE_POINT_NULL;\n      return ECMA_VALUE_EMPTY;\n    }\n\n    if (re_ctx_p->flags & RE_FLAG_UNICODE)\n    {\n      return ecma_raise_syntax_error (ECMA_ERR_INVALID_ESCAPE_SEQUENCE);\n    }\n\n    /* Legacy octal escape sequence */\n    if (lit_char_is_octal_digit (*re_ctx_p->input_curr_p))\n    {\n      re_ctx_p->token.value = re_parse_octal (re_ctx_p);\n      return ECMA_VALUE_EMPTY;\n    }\n\n    /* Identity escape */\n    re_ctx_p->token.value = *re_ctx_p->input_curr_p++;\n    return ECMA_VALUE_EMPTY;\n  }\n\n  lit_code_point_t ch = lit_cesu8_read_next (&re_ctx_p->input_curr_p);\n  switch (ch)\n  {\n    /* Character Class escapes */\n    case LIT_CHAR_LOWERCASE_D:\n    {\n      re_ctx_p->token.type = RE_TOK_CLASS_ESCAPE;\n      re_ctx_p->token.value = RE_ESCAPE_DIGIT;\n      break;\n    }\n    case LIT_CHAR_UPPERCASE_D:\n    {\n      re_ctx_p->token.type = RE_TOK_CLASS_ESCAPE;\n      re_ctx_p->token.value = RE_ESCAPE_NOT_DIGIT;\n      break;\n    }\n    case LIT_CHAR_LOWERCASE_S:\n    {\n      re_ctx_p->token.type = RE_TOK_CLASS_ESCAPE;\n      re_ctx_p->token.value = RE_ESCAPE_WHITESPACE;\n      break;\n    }\n    case LIT_CHAR_UPPERCASE_S:\n    {\n      re_ctx_p->token.type = RE_TOK_CLASS_ESCAPE;\n      re_ctx_p->token.value = RE_ESCAPE_NOT_WHITESPACE;\n      break;\n    }\n    case LIT_CHAR_LOWERCASE_W:\n    {\n      re_ctx_p->token.type = RE_TOK_CLASS_ESCAPE;\n      re_ctx_p->token.value = RE_ESCAPE_WORD_CHAR;\n      break;\n    }\n    case LIT_CHAR_UPPERCASE_W:\n    {\n      re_ctx_p->token.type = RE_TOK_CLASS_ESCAPE;\n      re_ctx_p->token.value = RE_ESCAPE_NOT_WORD_CHAR;\n      break;\n    }\n    /* Control escapes */\n    case LIT_CHAR_LOWERCASE_F:\n    {\n      re_ctx_p->token.value = LIT_CHAR_FF;\n      break;\n    }\n    case LIT_CHAR_LOWERCASE_N:\n    {\n      re_ctx_p->token.value = LIT_CHAR_LF;\n      break;\n    }\n    case LIT_CHAR_LOWERCASE_R:\n    {\n      re_ctx_p->token.value = LIT_CHAR_CR;\n      break;\n    }\n    case LIT_CHAR_LOWERCASE_T:\n    {\n      re_ctx_p->token.value = LIT_CHAR_TAB;\n      break;\n    }\n    case LIT_CHAR_LOWERCASE_V:\n    {\n      re_ctx_p->token.value = LIT_CHAR_VTAB;\n      break;\n    }\n    /* Control letter */\n    case LIT_CHAR_LOWERCASE_C:\n    {\n      if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p)\n      {\n        ch = *re_ctx_p->input_curr_p;\n\n        if ((ch >= LIT_CHAR_ASCII_UPPERCASE_LETTERS_BEGIN && ch <= LIT_CHAR_ASCII_UPPERCASE_LETTERS_END)\n            || (ch >= LIT_CHAR_ASCII_LOWERCASE_LETTERS_BEGIN && ch <= LIT_CHAR_ASCII_LOWERCASE_LETTERS_END))\n        {\n          re_ctx_p->token.value = (ch % 32);\n          re_ctx_p->input_curr_p++;\n\n          break;\n        }\n      }\n\n      if (re_ctx_p->flags & RE_FLAG_UNICODE)\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_INVALID_CONTROL_ESCAPE_SEQUENCE);\n      }\n\n      re_ctx_p->token.value = LIT_CHAR_BACKSLASH;\n      re_ctx_p->input_curr_p--;\n\n      break;\n    }\n    /* Hex escape */\n    case LIT_CHAR_LOWERCASE_X:\n    {\n      uint32_t hex_value = lit_char_hex_lookup (re_ctx_p->input_curr_p, re_ctx_p->input_end_p, 2);\n      if (hex_value != UINT32_MAX)\n      {\n        re_ctx_p->token.value = hex_value;\n        re_ctx_p->input_curr_p += 2;\n        break;\n      }\n\n      if (re_ctx_p->flags & RE_FLAG_UNICODE)\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_INVALID_HEX_ESCAPE_SEQUENCE);\n      }\n\n      re_ctx_p->token.value = LIT_CHAR_LOWERCASE_X;\n      break;\n    }\n    /* Unicode escape */\n    case LIT_CHAR_LOWERCASE_U:\n    {\n      uint32_t hex_value = lit_char_hex_lookup (re_ctx_p->input_curr_p, re_ctx_p->input_end_p, 4);\n      if (hex_value != UINT32_MAX)\n      {\n        re_ctx_p->token.value = hex_value;\n        re_ctx_p->input_curr_p += 4;\n\n        if (re_ctx_p->flags & RE_FLAG_UNICODE && lit_is_code_point_utf16_high_surrogate (re_ctx_p->token.value)\n            && re_ctx_p->input_curr_p + 6 <= re_ctx_p->input_end_p && re_ctx_p->input_curr_p[0] == '\\\\'\n            && re_ctx_p->input_curr_p[1] == 'u')\n        {\n          hex_value = lit_char_hex_lookup (re_ctx_p->input_curr_p + 2, re_ctx_p->input_end_p, 4);\n          if (lit_is_code_point_utf16_low_surrogate (hex_value))\n          {\n            re_ctx_p->token.value =\n              lit_convert_surrogate_pair_to_code_point ((ecma_char_t) re_ctx_p->token.value, (ecma_char_t) hex_value);\n            re_ctx_p->input_curr_p += 6;\n          }\n        }\n\n        break;\n      }\n\n      if (re_ctx_p->flags & RE_FLAG_UNICODE)\n      {\n        if (re_ctx_p->input_curr_p + 1 < re_ctx_p->input_end_p && re_ctx_p->input_curr_p[0] == LIT_CHAR_LEFT_BRACE\n            && lit_char_is_hex_digit (re_ctx_p->input_curr_p[1]))\n        {\n          lit_code_point_t cp = lit_char_hex_to_int (re_ctx_p->input_curr_p[1]);\n          re_ctx_p->input_curr_p += 2;\n\n          while (re_ctx_p->input_curr_p < re_ctx_p->input_end_p && lit_char_is_hex_digit (*re_ctx_p->input_curr_p))\n          {\n            cp = cp * 16 + lit_char_hex_to_int (*re_ctx_p->input_curr_p++);\n\n            if (JERRY_UNLIKELY (cp > LIT_UNICODE_CODE_POINT_MAX))\n            {\n              return ecma_raise_syntax_error (ECMA_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE);\n            }\n          }\n\n          if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p && *re_ctx_p->input_curr_p == LIT_CHAR_RIGHT_BRACE)\n          {\n            re_ctx_p->input_curr_p++;\n            re_ctx_p->token.value = cp;\n            break;\n          }\n        }\n\n        return ecma_raise_syntax_error (ECMA_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE);\n      }\n\n      re_ctx_p->token.value = LIT_CHAR_LOWERCASE_U;\n      break;\n    }\n    /* Identity escape */\n    default:\n    {\n      /* Must be '/', or one of SyntaxCharacter */\n      if (re_ctx_p->flags & RE_FLAG_UNICODE && ch != LIT_CHAR_SLASH && !re_is_syntax_char (ch))\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_INVALID_ESCAPE);\n      }\n      re_ctx_p->token.value = ch;\n    }\n  }\n\n  return ECMA_VALUE_EMPTY;\n} /* re_parse_char_escape */\n\n/**\n * Read the input pattern and parse the next token for the RegExp compiler\n *\n * @return empty ecma value - if parsed successfully\n *         error ecma value - otherwise\n *\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t\nre_parse_next_token (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context */\n{\n  if (re_ctx_p->input_curr_p >= re_ctx_p->input_end_p)\n  {\n    re_ctx_p->token.type = RE_TOK_EOF;\n    return ECMA_VALUE_EMPTY;\n  }\n\n  ecma_char_t ch = lit_cesu8_read_next (&re_ctx_p->input_curr_p);\n\n  switch (ch)\n  {\n    case LIT_CHAR_CIRCUMFLEX:\n    {\n      re_ctx_p->token.type = RE_TOK_ASSERT_START;\n      return ECMA_VALUE_EMPTY;\n    }\n    case LIT_CHAR_DOLLAR_SIGN:\n    {\n      re_ctx_p->token.type = RE_TOK_ASSERT_END;\n      return ECMA_VALUE_EMPTY;\n    }\n    case LIT_CHAR_VLINE:\n    {\n      re_ctx_p->token.type = RE_TOK_ALTERNATIVE;\n      return ECMA_VALUE_EMPTY;\n    }\n    case LIT_CHAR_DOT:\n    {\n      re_ctx_p->token.type = RE_TOK_PERIOD;\n      /* Check quantifier */\n      break;\n    }\n    case LIT_CHAR_BACKSLASH:\n    {\n      if (re_ctx_p->input_curr_p >= re_ctx_p->input_end_p)\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_INVALID_ESCAPE);\n      }\n\n      /* DecimalEscape, Backreferences cannot start with a zero digit. */\n      if (*re_ctx_p->input_curr_p > LIT_CHAR_0 && *re_ctx_p->input_curr_p <= LIT_CHAR_9)\n      {\n        const lit_utf8_byte_t *digits_p = re_ctx_p->input_curr_p;\n        const uint32_t value = lit_parse_decimal (&digits_p, re_ctx_p->input_end_p);\n\n        if (re_ctx_p->groups_count < 0)\n        {\n          re_count_groups (re_ctx_p);\n        }\n\n        if (value <= (uint32_t) re_ctx_p->groups_count)\n        {\n          /* Valid backreference */\n          re_ctx_p->input_curr_p = digits_p;\n          re_ctx_p->token.type = RE_TOK_BACKREFERENCE;\n          re_ctx_p->token.value = value;\n\n          /* Check quantifier */\n          break;\n        }\n      }\n\n      if (*re_ctx_p->input_curr_p == LIT_CHAR_LOWERCASE_B)\n      {\n        re_ctx_p->input_curr_p++;\n        re_ctx_p->token.type = RE_TOK_ASSERT_WORD_BOUNDARY;\n        return ECMA_VALUE_EMPTY;\n      }\n      else if (*re_ctx_p->input_curr_p == LIT_CHAR_UPPERCASE_B)\n      {\n        re_ctx_p->input_curr_p++;\n        re_ctx_p->token.type = RE_TOK_ASSERT_NOT_WORD_BOUNDARY;\n        return ECMA_VALUE_EMPTY;\n      }\n\n      const ecma_value_t parse_result = re_parse_char_escape (re_ctx_p);\n\n      if (ECMA_IS_VALUE_ERROR (parse_result))\n      {\n        return parse_result;\n      }\n\n      /* Check quantifier */\n      break;\n    }\n    case LIT_CHAR_LEFT_PAREN:\n    {\n      if (re_ctx_p->input_curr_p >= re_ctx_p->input_end_p)\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_UNTERMINATED_GROUP);\n      }\n\n      if (*re_ctx_p->input_curr_p == LIT_CHAR_QUESTION)\n      {\n        re_ctx_p->input_curr_p++;\n        if (re_ctx_p->input_curr_p >= re_ctx_p->input_end_p)\n        {\n          return ecma_raise_syntax_error (ECMA_ERR_INVALID_GROUP);\n        }\n\n        ch = *re_ctx_p->input_curr_p++;\n\n        if (ch == LIT_CHAR_EQUALS)\n        {\n          re_ctx_p->token.type = RE_TOK_ASSERT_LOOKAHEAD;\n          re_ctx_p->token.value = false;\n        }\n        else if (ch == LIT_CHAR_EXCLAMATION)\n        {\n          re_ctx_p->token.type = RE_TOK_ASSERT_LOOKAHEAD;\n          re_ctx_p->token.value = true;\n        }\n        else if (ch == LIT_CHAR_COLON)\n        {\n          re_ctx_p->token.type = RE_TOK_START_NON_CAPTURE_GROUP;\n        }\n        else\n        {\n          return ecma_raise_syntax_error (ECMA_ERR_INVALID_GROUP);\n        }\n      }\n      else\n      {\n        re_ctx_p->token.type = RE_TOK_START_CAPTURE_GROUP;\n      }\n\n      return ECMA_VALUE_EMPTY;\n    }\n    case LIT_CHAR_RIGHT_PAREN:\n    {\n      re_ctx_p->token.type = RE_TOK_END_GROUP;\n\n      return ECMA_VALUE_EMPTY;\n    }\n    case LIT_CHAR_LEFT_SQUARE:\n    {\n      re_ctx_p->token.type = RE_TOK_CHAR_CLASS;\n\n      if (re_ctx_p->input_curr_p >= re_ctx_p->input_end_p)\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_UNTERMINATED_CHARACTER_CLASS);\n      }\n\n      return ECMA_VALUE_EMPTY;\n    }\n    case LIT_CHAR_QUESTION:\n    case LIT_CHAR_ASTERISK:\n    case LIT_CHAR_PLUS:\n    {\n      return ecma_raise_syntax_error (ECMA_ERR_INVALID_QUANTIFIER);\n    }\n    case LIT_CHAR_LEFT_BRACE:\n    {\n      re_ctx_p->input_curr_p--;\n      if (ecma_is_value_true (re_parse_quantifier (re_ctx_p)))\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_NOTHING_TO_REPEAT);\n      }\n\n      if (re_ctx_p->flags & RE_FLAG_UNICODE)\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_LONE_QUANTIFIER_BRACKET);\n      }\n\n      re_ctx_p->input_curr_p++;\n      re_ctx_p->token.type = RE_TOK_CHAR;\n      re_ctx_p->token.value = ch;\n\n      /* Check quantifier */\n      break;\n    }\n    case LIT_CHAR_RIGHT_SQUARE:\n    case LIT_CHAR_RIGHT_BRACE:\n    {\n      if (re_ctx_p->flags & RE_FLAG_UNICODE)\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_LONE_QUANTIFIER_BRACKET);\n      }\n\n      /* FALLTHRU */\n    }\n    default:\n    {\n      re_ctx_p->token.type = RE_TOK_CHAR;\n      re_ctx_p->token.value = ch;\n\n      if (re_ctx_p->flags & RE_FLAG_UNICODE && lit_is_code_point_utf16_high_surrogate (ch)\n          && re_ctx_p->input_curr_p < re_ctx_p->input_end_p)\n      {\n        const ecma_char_t next = lit_cesu8_peek_next (re_ctx_p->input_curr_p);\n        if (lit_is_code_point_utf16_low_surrogate (next))\n        {\n          re_ctx_p->token.value = lit_convert_surrogate_pair_to_code_point (ch, next);\n          re_ctx_p->input_curr_p += LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;\n        }\n      }\n\n      /* Check quantifier */\n      break;\n    }\n  }\n\n  re_parse_quantifier (re_ctx_p);\n  return re_check_quantifier (re_ctx_p);\n} /* re_parse_next_token */\n\n/**\n * Append a character class range to the bytecode.\n */\nstatic void\nre_class_add_range (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context */\n                    lit_code_point_t start, /**< range begin */\n                    lit_code_point_t end) /**< range end */\n{\n  if (re_ctx_p->flags & RE_FLAG_IGNORE_CASE)\n  {\n    start = ecma_regexp_canonicalize_char (start, re_ctx_p->flags & RE_FLAG_UNICODE);\n    end = ecma_regexp_canonicalize_char (end, re_ctx_p->flags & RE_FLAG_UNICODE);\n  }\n\n  re_append_char (re_ctx_p, start);\n  re_append_char (re_ctx_p, end);\n} /* re_class_add_range */\n\n/**\n * Add a single character to the character class\n */\nstatic void\nre_class_add_char (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context */\n                   uint32_t class_offset, /**< character class bytecode offset*/\n                   lit_code_point_t cp) /**< code point */\n{\n  if (re_ctx_p->flags & RE_FLAG_IGNORE_CASE)\n  {\n    cp = ecma_regexp_canonicalize_char (cp, re_ctx_p->flags & RE_FLAG_UNICODE);\n  }\n\n  re_insert_char (re_ctx_p, class_offset, cp);\n} /* re_class_add_char */\n\n/**\n * Invalid character code point\n */\n#define RE_INVALID_CP 0xFFFFFFFF\n\n/**\n * Read the input pattern and parse the range of character class\n *\n * @return empty ecma value - if parsed successfully\n *         error ecma value - otherwise\n *\n *         Returned value must be freed with ecma_free_value\n */\nstatic ecma_value_t\nre_parse_char_class (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context */\n{\n  static const uint8_t escape_flags[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20 };\n  const uint32_t class_offset = re_bytecode_size (re_ctx_p);\n\n  uint8_t found_escape_flags = 0;\n  uint8_t out_class_flags = 0;\n\n  uint32_t range_count = 0;\n  uint32_t char_count = 0;\n  bool is_range = false;\n\n  JERRY_ASSERT (re_ctx_p->input_curr_p < re_ctx_p->input_end_p);\n  if (*re_ctx_p->input_curr_p == LIT_CHAR_CIRCUMFLEX)\n  {\n    re_ctx_p->input_curr_p++;\n    out_class_flags |= RE_CLASS_INVERT;\n  }\n\n  lit_code_point_t start = RE_INVALID_CP;\n\n  while (true)\n  {\n    if (re_ctx_p->input_curr_p >= re_ctx_p->input_end_p)\n    {\n      return ecma_raise_syntax_error (ECMA_ERR_UNTERMINATED_CHARACTER_CLASS);\n    }\n\n    if (*re_ctx_p->input_curr_p == LIT_CHAR_RIGHT_SQUARE)\n    {\n      if (is_range)\n      {\n        if (start != RE_INVALID_CP)\n        {\n          re_class_add_char (re_ctx_p, class_offset, start);\n          char_count++;\n        }\n\n        re_class_add_char (re_ctx_p, class_offset, LIT_CHAR_MINUS);\n        char_count++;\n      }\n\n      re_ctx_p->input_curr_p++;\n      break;\n    }\n\n    JERRY_ASSERT (re_ctx_p->input_curr_p < re_ctx_p->input_end_p);\n    lit_code_point_t current;\n\n    if (*re_ctx_p->input_curr_p == LIT_CHAR_BACKSLASH)\n    {\n      re_ctx_p->input_curr_p++;\n      if (re_ctx_p->input_curr_p >= re_ctx_p->input_end_p)\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_INVALID_ESCAPE);\n      }\n\n      if (*re_ctx_p->input_curr_p == LIT_CHAR_LOWERCASE_B)\n      {\n        re_ctx_p->input_curr_p++;\n        current = LIT_CHAR_BS;\n      }\n      else if (*re_ctx_p->input_curr_p == LIT_CHAR_MINUS)\n      {\n        re_ctx_p->input_curr_p++;\n        current = LIT_CHAR_MINUS;\n      }\n      else if ((re_ctx_p->flags & RE_FLAG_UNICODE) == 0 && *re_ctx_p->input_curr_p == LIT_CHAR_LOWERCASE_C\n               && re_ctx_p->input_curr_p + 1 < re_ctx_p->input_end_p\n               && (lit_char_is_decimal_digit (*(re_ctx_p->input_curr_p + 1))\n                   || *(re_ctx_p->input_curr_p + 1) == LIT_CHAR_UNDERSCORE))\n      {\n        current = ((uint8_t) * (re_ctx_p->input_curr_p + 1) % 32);\n        re_ctx_p->input_curr_p += 2;\n      }\n      else\n      {\n        if (ECMA_IS_VALUE_ERROR (re_parse_char_escape (re_ctx_p)))\n        {\n          return ECMA_VALUE_ERROR;\n        }\n\n        if (re_ctx_p->token.type == RE_TOK_CLASS_ESCAPE)\n        {\n          const uint8_t escape = (uint8_t) re_ctx_p->token.value;\n          found_escape_flags |= escape_flags[escape];\n          current = RE_INVALID_CP;\n        }\n        else\n        {\n          JERRY_ASSERT (re_ctx_p->token.type == RE_TOK_CHAR);\n          current = re_ctx_p->token.value;\n        }\n      }\n    }\n    else if (re_ctx_p->flags & RE_FLAG_UNICODE)\n    {\n      current = ecma_regexp_unicode_advance (&re_ctx_p->input_curr_p, re_ctx_p->input_end_p);\n    }\n    else\n    {\n      current = lit_cesu8_read_next (&re_ctx_p->input_curr_p);\n    }\n\n    if (is_range)\n    {\n      is_range = false;\n\n      if (start != RE_INVALID_CP && current != RE_INVALID_CP)\n      {\n        if (start > current)\n        {\n          return ecma_raise_syntax_error (ECMA_ERR_RANGE_OUT_OF_ORDER_IN_CHARACTER_CLASS);\n        }\n\n        re_class_add_range (re_ctx_p, start, current);\n        range_count++;\n        continue;\n      }\n\n      if (re_ctx_p->flags & RE_FLAG_UNICODE)\n      {\n        return ecma_raise_syntax_error (ECMA_ERR_INVALID_CHARACTER_CLASS);\n      }\n\n      if (start != RE_INVALID_CP)\n      {\n        re_class_add_char (re_ctx_p, class_offset, start);\n        char_count++;\n      }\n      else if (current != RE_INVALID_CP)\n      {\n        re_class_add_char (re_ctx_p, class_offset, current);\n        char_count++;\n      }\n\n      re_class_add_char (re_ctx_p, class_offset, LIT_CHAR_MINUS);\n      char_count++;\n      continue;\n    }\n\n    if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p && *re_ctx_p->input_curr_p == LIT_CHAR_MINUS)\n    {\n      re_ctx_p->input_curr_p++;\n      start = current;\n      is_range = true;\n      continue;\n    }\n\n    if (current != RE_INVALID_CP)\n    {\n      re_class_add_char (re_ctx_p, class_offset, current);\n      char_count++;\n    }\n  }\n\n  uint8_t escape_count = 0;\n  for (ecma_class_escape_t escape = RE_ESCAPE__START; escape < RE_ESCAPE__COUNT; ++escape)\n  {\n    if (found_escape_flags & escape_flags[escape])\n    {\n      re_insert_byte (re_ctx_p, class_offset, (uint8_t) escape);\n      escape_count++;\n    }\n  }\n\n  if (range_count > 0)\n  {\n    re_insert_value (re_ctx_p, class_offset, range_count);\n    out_class_flags |= RE_CLASS_HAS_RANGES;\n  }\n\n  if (char_count > 0)\n  {\n    re_insert_value (re_ctx_p, class_offset, char_count);\n    out_class_flags |= RE_CLASS_HAS_CHARS;\n  }\n\n  JERRY_ASSERT (escape_count <= RE_CLASS_ESCAPE_COUNT_MASK);\n  out_class_flags |= escape_count;\n\n  re_insert_byte (re_ctx_p, class_offset, out_class_flags);\n  re_insert_opcode (re_ctx_p, class_offset, RE_OP_CHAR_CLASS);\n\n  re_parse_quantifier (re_ctx_p);\n  return re_check_quantifier (re_ctx_p);\n} /* re_parse_char_class */\n\n/**\n * Parse alternatives\n *\n * @return empty ecma value - if alternative was successfully parsed\n *         error ecma value - otherwise\n *\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\nre_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context */\n                      bool expect_eof) /**< expect end of file */\n{\n  ECMA_CHECK_STACK_USAGE ();\n  uint32_t alternative_offset = re_bytecode_size (re_ctx_p);\n  bool first_alternative = true;\n\n  while (true)\n  {\n    ecma_value_t next_token_result = re_parse_next_token (re_ctx_p);\n    if (ECMA_IS_VALUE_ERROR (next_token_result))\n    {\n      return next_token_result;\n    }\n\n    JERRY_ASSERT (ecma_is_value_empty (next_token_result));\n\n    uint32_t atom_offset = re_bytecode_size (re_ctx_p);\n\n    switch (re_ctx_p->token.type)\n    {\n      case RE_TOK_START_CAPTURE_GROUP:\n      {\n        const uint32_t idx = re_ctx_p->captures_count++;\n        const uint32_t capture_start = idx;\n\n        ecma_value_t result = re_parse_alternative (re_ctx_p, false);\n        if (ECMA_IS_VALUE_ERROR (result))\n        {\n          return result;\n        }\n\n        re_parse_quantifier (re_ctx_p);\n\n        if (ECMA_IS_VALUE_ERROR (re_check_quantifier (re_ctx_p)))\n        {\n          return ECMA_VALUE_ERROR;\n        }\n\n        re_insert_into_group (re_ctx_p, atom_offset, idx, capture_start, true);\n        break;\n      }\n      case RE_TOK_START_NON_CAPTURE_GROUP:\n      {\n        const uint32_t idx = re_ctx_p->non_captures_count++;\n        const uint32_t capture_start = re_ctx_p->captures_count;\n\n        ecma_value_t result = re_parse_alternative (re_ctx_p, false);\n        if (ECMA_IS_VALUE_ERROR (result))\n        {\n          return result;\n        }\n\n        re_parse_quantifier (re_ctx_p);\n\n        if (ECMA_IS_VALUE_ERROR (re_check_quantifier (re_ctx_p)))\n        {\n          return ECMA_VALUE_ERROR;\n        }\n\n        re_insert_into_group (re_ctx_p, atom_offset, idx, capture_start, false);\n        break;\n      }\n      case RE_TOK_PERIOD:\n      {\n        re_append_opcode (re_ctx_p, (re_ctx_p->flags & RE_FLAG_UNICODE) ? RE_OP_UNICODE_PERIOD : RE_OP_PERIOD);\n        re_insert_atom_iterator (re_ctx_p, atom_offset);\n        break;\n      }\n      case RE_TOK_ALTERNATIVE:\n      {\n        re_insert_value (re_ctx_p, alternative_offset, re_bytecode_size (re_ctx_p) - alternative_offset);\n        re_insert_opcode (re_ctx_p,\n                          alternative_offset,\n                          first_alternative ? RE_OP_ALTERNATIVE_START : RE_OP_ALTERNATIVE_NEXT);\n\n        alternative_offset = re_bytecode_size (re_ctx_p);\n        first_alternative = false;\n        break;\n      }\n      case RE_TOK_ASSERT_START:\n      {\n        re_append_opcode (re_ctx_p, RE_OP_ASSERT_LINE_START);\n        break;\n      }\n      case RE_TOK_ASSERT_END:\n      {\n        re_append_opcode (re_ctx_p, RE_OP_ASSERT_LINE_END);\n        break;\n      }\n      case RE_TOK_ASSERT_WORD_BOUNDARY:\n      {\n        re_append_opcode (re_ctx_p, RE_OP_ASSERT_WORD_BOUNDARY);\n        break;\n      }\n      case RE_TOK_ASSERT_NOT_WORD_BOUNDARY:\n      {\n        re_append_opcode (re_ctx_p, RE_OP_ASSERT_NOT_WORD_BOUNDARY);\n        break;\n      }\n      case RE_TOK_ASSERT_LOOKAHEAD:\n      {\n        const uint32_t start_capture_count = re_ctx_p->captures_count;\n        const bool is_negative = !!re_ctx_p->token.value;\n\n        ecma_value_t result = re_parse_alternative (re_ctx_p, false);\n\n        if (ECMA_IS_VALUE_ERROR (result))\n        {\n          return result;\n        }\n\n        if (re_ctx_p->flags & RE_FLAG_UNICODE)\n        {\n          re_ctx_p->token.qmin = 1;\n          re_ctx_p->token.qmax = 1;\n          re_ctx_p->token.greedy = true;\n        }\n        else\n        {\n          re_parse_quantifier (re_ctx_p);\n\n          if (ECMA_IS_VALUE_ERROR (re_check_quantifier (re_ctx_p)))\n          {\n            return ECMA_VALUE_ERROR;\n          }\n        }\n\n        re_insert_assertion_lookahead (re_ctx_p, atom_offset, start_capture_count, is_negative);\n        break;\n      }\n      case RE_TOK_BACKREFERENCE:\n      {\n        const uint32_t backref_idx = re_ctx_p->token.value;\n        re_append_opcode (re_ctx_p, RE_OP_BACKREFERENCE);\n        re_append_value (re_ctx_p, backref_idx);\n\n        if (re_ctx_p->token.qmin != 1 || re_ctx_p->token.qmax != 1)\n        {\n          const uint32_t group_idx = re_ctx_p->non_captures_count++;\n          re_insert_into_group (re_ctx_p, atom_offset, group_idx, re_ctx_p->captures_count, false);\n        }\n\n        break;\n      }\n      case RE_TOK_CLASS_ESCAPE:\n      {\n        const ecma_class_escape_t escape = (ecma_class_escape_t) re_ctx_p->token.value;\n        re_append_opcode (re_ctx_p, RE_OP_CLASS_ESCAPE);\n        re_append_byte (re_ctx_p, (uint8_t) escape);\n\n        re_insert_atom_iterator (re_ctx_p, atom_offset);\n        break;\n      }\n      case RE_TOK_CHAR_CLASS:\n      {\n        ecma_value_t result = re_parse_char_class (re_ctx_p);\n\n        if (ECMA_IS_VALUE_ERROR (result))\n        {\n          return result;\n        }\n\n        re_insert_atom_iterator (re_ctx_p, atom_offset);\n        break;\n      }\n      case RE_TOK_END_GROUP:\n      {\n        if (expect_eof)\n        {\n          return ecma_raise_syntax_error (ECMA_ERR_UNMATCHED_CLOSE_BRACKET);\n        }\n\n        if (!first_alternative)\n        {\n          re_insert_value (re_ctx_p, alternative_offset, re_bytecode_size (re_ctx_p) - alternative_offset);\n          re_insert_opcode (re_ctx_p, alternative_offset, RE_OP_ALTERNATIVE_NEXT);\n        }\n\n        return ECMA_VALUE_EMPTY;\n      }\n      case RE_TOK_EOF:\n      {\n        if (!expect_eof)\n        {\n          return ecma_raise_syntax_error (ECMA_ERR_UNEXPECTED_END_OF_PATTERN);\n        }\n\n        if (!first_alternative)\n        {\n          re_insert_value (re_ctx_p, alternative_offset, re_bytecode_size (re_ctx_p) - alternative_offset);\n          re_insert_opcode (re_ctx_p, alternative_offset, RE_OP_ALTERNATIVE_NEXT);\n        }\n\n        re_append_opcode (re_ctx_p, RE_OP_EOF);\n        return ECMA_VALUE_EMPTY;\n      }\n      default:\n      {\n        JERRY_ASSERT (re_ctx_p->token.type == RE_TOK_CHAR);\n\n        lit_code_point_t ch = re_ctx_p->token.value;\n\n        if (ch <= LIT_UTF8_1_BYTE_CODE_POINT_MAX && (re_ctx_p->flags & RE_FLAG_IGNORE_CASE) == 0)\n        {\n          re_append_opcode (re_ctx_p, RE_OP_BYTE);\n          re_append_byte (re_ctx_p, (uint8_t) ch);\n\n          re_insert_atom_iterator (re_ctx_p, atom_offset);\n          break;\n        }\n\n        if (re_ctx_p->flags & RE_FLAG_IGNORE_CASE)\n        {\n          ch = ecma_regexp_canonicalize_char (ch, re_ctx_p->flags & RE_FLAG_UNICODE);\n        }\n\n        re_append_opcode (re_ctx_p, RE_OP_CHAR);\n        re_append_char (re_ctx_p, ch);\n\n        re_insert_atom_iterator (re_ctx_p, atom_offset);\n        break;\n      }\n    }\n  }\n\n  return ECMA_VALUE_EMPTY;\n} /* re_parse_alternative */\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n"
  },
  {
    "path": "jerry-core/parser/regexp/re-parser.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef RE_PARSER_H\n#define RE_PARSER_H\n\n#include \"re-compiler-context.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup regexparser Regular expression\n * @{\n *\n * \\addtogroup regexparser_parser Parser\n * @{\n */\n\n/**\n * @}\n *\n * \\addtogroup regexparser_parser Parser\n * @{\n */\n\n/**\n * Value used for infinite quantifier.\n */\n#define RE_INFINITY UINT32_MAX\n\n/**\n * Maximum decimal value of an octal escape\n */\n#define RE_MAX_OCTAL_VALUE 0xff\n\necma_value_t re_parse_alternative (re_compiler_ctx_t *re_ctx_p, bool expect_eof);\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n#endif /* !RE_PARSER_H */\n"
  },
  {
    "path": "jerry-core/parser/regexp/re-token.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef RE_TOKEN_H\n#define RE_TOKEN_H\n\n#include \"ecma-globals.h\"\n\n#if JERRY_BUILTIN_REGEXP\n\n/** \\addtogroup parser Parser\n * @{\n *\n * \\addtogroup regexparser Regular expression\n * @{\n *\n * \\addtogroup regexparser_parser Parser\n * @{\n */\n\n/**\n * RegExp token type definitions\n */\ntypedef enum\n{\n  RE_TOK_EOF, /**< EOF */\n  RE_TOK_BACKREFERENCE, /**< \"\\[0..9]\" */\n  RE_TOK_ALTERNATIVE, /**< \"|\" */\n  RE_TOK_ASSERT_START, /**< \"^\" */\n  RE_TOK_ASSERT_END, /**< \"$\" */\n  RE_TOK_PERIOD, /**< \".\" */\n  RE_TOK_START_CAPTURE_GROUP, /**< \"(\" */\n  RE_TOK_START_NON_CAPTURE_GROUP, /**< \"(?:\" */\n  RE_TOK_END_GROUP, /**< \")\" */\n  RE_TOK_ASSERT_LOOKAHEAD, /**< \"(?=\" */\n  RE_TOK_ASSERT_WORD_BOUNDARY, /**< \"\\b\" */\n  RE_TOK_ASSERT_NOT_WORD_BOUNDARY, /**< \"\\B\" */\n  RE_TOK_CLASS_ESCAPE, /**< \"\\d \\D \\w \\W \\s \\S\" */\n  RE_TOK_CHAR_CLASS, /**< \"[ ]\" */\n  RE_TOK_CHAR, /**< any character */\n} re_token_type_t;\n\n/**\n * RegExp token\n */\ntypedef struct\n{\n  uint32_t value; /**< value of the token */\n  uint32_t qmin; /**< minimum number of token iterations */\n  uint32_t qmax; /**< maximum number of token iterations */\n  re_token_type_t type; /**< type of the token */\n  bool greedy; /**< type of iteration */\n} re_token_t;\n\n/**\n * @}\n * @}\n * @}\n */\n\n#endif /* JERRY_BUILTIN_REGEXP */\n#endif /* !RE_TOKEN_H */\n"
  },
  {
    "path": "jerry-core/profiles/README.md",
    "content": "### About profile files\n\nSpecify compile definitions in profile files to use when compiling the `jerry-core` target.\n\nThe default profile is ``es.next`` which enables all of the currently implemented features.\n\n### Using profiles with the build system\n\nYou can specify the profile for the build system in the following ways:\n  * with absolute path\n  * with a name (this options selects profiles/$(name).profile file)\n\n#### Restrictions\nOnly single line options are allowed in the profile file. Any line starting with hash-mark is ignored. Semicolon character is not allowed.\n\n\n### Example usage\n\n#### 1. Using the build script\n\nIf you want to use a predefined profile, run the build script as follows\n(assuming that you are in the project root folder):\n\n```\n./tools/build.py --profile=minimal\n```\n\nAlternatively, if you want to use a custom profile at\n`/absolute/path/to/my.profile`:\n\n```\n# Disable not needed features\nJERRY_BUILTIN_CONTAINER=0\nJERRY_BUILTIN_DATAVIEW=0\nJERRY_BUILTIN_TYPEDARRAY=0\n```\n\nRun the build script as follows (assuming that you are in the project root\nfolder):\n\n```\n./tools/build.py --profile=/absolute/path/to/my.profile\n```\n\n\n#### 2. Using only CMake build system\n\nSet FEATURE_PROFILE option to one of the following values:\n* the profile with absolute path\n* name of the profile (which needs to exist in the `profiles` folder)\n\n\n### Configurations\n\nIn JerryScript all of the features are enabled by default, so an empty profile file turns on all of the available ECMA features.\nThe defines can have a value of `0` or `1`. If for whatever reason one of them are not defined, it is treated as if it were\ndefined to `1`.\n\n#### Built-ins\n\n* `JERRY_BUILTINS`:\n  Enables or disable all of the Built-in objects\n* `JERRY_BUILTIN_ANNEXB`:\n  Enables or disables the [Annex B](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-B) of the ECMA5.1 standard.\n* `JERRY_BUILTIN_ARRAY`:\n  Enables or disable the [Array](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.4) built-in.\n* `JERRY_BUILTIN_BOOLEAN`:\n  Enables or disables the [Boolean](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.6) built-in.\n* `JERRY_BUILTIN_DATE`:\n  Enables or disables the [Date](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.9) built-in.\n* `JERRY_BUILTIN_ERRORS`:\n  Enables or disables the [Native Error Types](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.11.6) (EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError).\n  **Note**: The [Error](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.11.2) object remains available.\n* `JERRY_BUILTIN_JSON`:\n  Enables or disables the [JSON](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.12) built-in.\n* `JERRY_BUILTIN_MATH`:\n  Enables or disables the [Math](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.8) built-in.\n* `JERRY_BUILTIN_NUMBER`:\n  Enables or disables the [Number](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.7) built-in.\n* `JERRY_BUILTIN_REGEXP`:\n  Enables or disables the [RegExp](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.10) built-in.\n* `JERRY_BUILTIN_STRING`:\n  Enables or disables the [String](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.5) built-in.\n* `JERRY_BUILTIN_BIGINT`:\n  Enables or disables the [BigInt](https://262.ecma-international.org/11.0/#sec-ecmascript-language-types-bigint-type) syntax and built-in.\n* `JERRY_BUILTIN_CONTAINER`:\n  Enables or disables the following built-ins:\n    * [Set](https://www.ecma-international.org/ecma-262/6.0/#sec-set-objects) built-in.\n    * [WeakSet](https://262.ecma-international.org/11.0/#sec-weakmap-objects) built-in.\n    * [Map](http://www.ecma-international.org/ecma-262/6.0/#sec-keyed-collection) built-ins.\n    * [WeakMap](https://262.ecma-international.org/11.0/#sec-weakmap-objects) built-in.\n* `JERRY_BUILTIN_DATAVIEW`:\n  Enables or disables the [DataView](https://www.ecma-international.org/ecma-262/6.0/#sec-dataview-objects) built-in.\n* `JERRY_BUILTIN_GLOBAL_THIS`:\n  Enables or disables the [GlobalThisValue](https://262.ecma-international.org/11.0/#sec-globalthis) built-in.\n* `JERRY_BUILTIN_PROXY`:\n  Enables or disables the [Proxy](https://262.ecma-international.org/11.0/#sec-proxy-object-internal-methods-and-internal-slots) related internal workings and built-in.\n* `JERRY_BUILTIN_REALMS`:\n  Enables or disables the [Realms](https://262.ecma-international.org/11.0/#sec-code-realms) support in the engine.\n* `JERRY_BUILTIN_REFLECT`:\n  Enables or disables the [Reflect](https://262.ecma-international.org/11.0/#sec-reflect-object) built-in.\n* `JERRY_BUILTIN_TYPEDARRAY`:\n  Enables or disables the [ArrayBuffer](http://www.ecma-international.org/ecma-262/6.0/#sec-arraybuffer-objects) and [TypedArray](http://www.ecma-international.org/ecma-262/6.0/#sec-typedarray-objects) built-ins.\n* `JERRY_BUILTIN_WEAKREF`:\n  Enables or disables the [WeakRef](https://tc39.es/ecma262/#sec-weak-ref-constructor) built-in.\n* `JERRY_MODULE_SYSTEM`:\n  Enables or disable the [module system](http://www.ecma-international.org/ecma-262/6.0/#sec-modules) language element.\n\n"
  },
  {
    "path": "jerry-core/profiles/es.next.profile",
    "content": "# All features are enabled by default.\n"
  },
  {
    "path": "jerry-core/profiles/minimal.profile",
    "content": "JERRY_BUILTINS=0\nJERRY_UNICODE_CASE_CONVERSION=0\n"
  },
  {
    "path": "jerry-core/vm/opcodes-ecma-arithmetics.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"jrt-libc-includes.h\"\n#include \"opcodes.h\"\n\n/** \\addtogroup vm Virtual machine\n * @{\n *\n * \\addtogroup vm_opcodes Opcodes\n * @{\n */\n\n/**\n * Perform ECMA number arithmetic operation.\n *\n * The algorithm of the operation is following:\n *   leftNum = ToNumber (leftValue);\n *   rightNum = ToNumber (rightValue);\n *   result = leftNum ArithmeticOp rightNum;\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\ndo_number_arithmetic (number_arithmetic_op op, /**< number arithmetic operation */\n                      ecma_value_t left_value, /**< left value */\n                      ecma_value_t right_value) /**< right value */\n{\n  ecma_number_t left_number;\n  left_value = ecma_op_to_numeric (left_value, &left_number, ECMA_TO_NUMERIC_ALLOW_BIGINT);\n\n  if (ECMA_IS_VALUE_ERROR (left_value))\n  {\n    return left_value;\n  }\n\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n#if JERRY_BUILTIN_BIGINT\n  if (JERRY_LIKELY (!ecma_is_value_bigint (left_value)))\n  {\n#endif /* JERRY_BUILTIN_BIGINT */\n\n    ecma_number_t right_number;\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (right_value, &right_number)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_number_t result = ECMA_NUMBER_ZERO;\n\n    switch (op)\n    {\n      case NUMBER_ARITHMETIC_SUBTRACTION:\n      {\n        result = left_number - right_number;\n        break;\n      }\n      case NUMBER_ARITHMETIC_MULTIPLICATION:\n      {\n        result = left_number * right_number;\n        break;\n      }\n      case NUMBER_ARITHMETIC_DIVISION:\n      {\n        result = left_number / right_number;\n        break;\n      }\n      case NUMBER_ARITHMETIC_REMAINDER:\n      {\n        if (ecma_number_is_nan (left_number) || ecma_number_is_nan (right_number)\n            || ecma_number_is_infinity (left_number) || ecma_number_is_zero (right_number))\n        {\n          result = ecma_number_make_nan ();\n          break;\n        }\n\n        if (ecma_number_is_infinity (right_number)\n            || (ecma_number_is_zero (left_number) && !ecma_number_is_zero (right_number)))\n        {\n          result = left_number;\n          break;\n        }\n\n        result = ecma_number_remainder (left_number, right_number);\n        break;\n      }\n      case NUMBER_ARITHMETIC_EXPONENTIATION:\n      {\n        result = ecma_number_pow (left_number, right_number);\n        break;\n      }\n    }\n\n    ret_value = ecma_make_number_value (result);\n#if JERRY_BUILTIN_BIGINT\n  }\n  else\n  {\n    bool free_right_value;\n    right_value = ecma_bigint_get_bigint (right_value, &free_right_value);\n\n    if (ECMA_IS_VALUE_ERROR (right_value))\n    {\n      ecma_free_value (left_value);\n      return right_value;\n    }\n\n    switch (op)\n    {\n      case NUMBER_ARITHMETIC_SUBTRACTION:\n      {\n        ret_value = ecma_bigint_add_sub (left_value, right_value, false);\n        break;\n      }\n      case NUMBER_ARITHMETIC_MULTIPLICATION:\n      {\n        ret_value = ecma_bigint_mul (left_value, right_value);\n        break;\n      }\n      case NUMBER_ARITHMETIC_DIVISION:\n      {\n        ret_value = ecma_bigint_div_mod (left_value, right_value, false);\n        break;\n      }\n      case NUMBER_ARITHMETIC_REMAINDER:\n      {\n        ret_value = ecma_bigint_div_mod (left_value, right_value, true);\n        break;\n      }\n      case NUMBER_ARITHMETIC_EXPONENTIATION:\n      {\n        ret_value = ecma_bigint_pow (left_value, right_value);\n        break;\n      }\n    }\n\n    ecma_free_value (left_value);\n    if (free_right_value)\n    {\n      ecma_free_value (right_value);\n    }\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n  return ret_value;\n} /* do_number_arithmetic */\n\n/**\n * 'Addition' opcode handler.\n *\n * See also: ECMA-262 v5, 11.6.1\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\nopfunc_addition (ecma_value_t left_value, /**< left value */\n                 ecma_value_t right_value) /**< right value */\n{\n  bool free_left_value = false;\n  bool free_right_value = false;\n\n  if (ecma_is_value_object (left_value))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (left_value);\n    left_value = ecma_op_object_default_value (obj_p, ECMA_PREFERRED_TYPE_NO);\n    free_left_value = true;\n\n    if (ECMA_IS_VALUE_ERROR (left_value))\n    {\n      return left_value;\n    }\n  }\n\n  if (ecma_is_value_object (right_value))\n  {\n    ecma_object_t *obj_p = ecma_get_object_from_value (right_value);\n    right_value = ecma_op_object_default_value (obj_p, ECMA_PREFERRED_TYPE_NO);\n    free_right_value = true;\n\n    if (ECMA_IS_VALUE_ERROR (right_value))\n    {\n      if (free_left_value)\n      {\n        ecma_free_value (left_value);\n      }\n      return right_value;\n    }\n  }\n\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n  if (ecma_is_value_string (left_value) || ecma_is_value_string (right_value))\n  {\n    ecma_string_t *string1_p = ecma_op_to_string (left_value);\n\n    if (JERRY_UNLIKELY (string1_p == NULL))\n    {\n      if (free_left_value)\n      {\n        ecma_free_value (left_value);\n      }\n      if (free_right_value)\n      {\n        ecma_free_value (right_value);\n      }\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_string_t *string2_p = ecma_op_to_string (right_value);\n\n    if (JERRY_UNLIKELY (string2_p == NULL))\n    {\n      if (free_right_value)\n      {\n        ecma_free_value (right_value);\n      }\n      if (free_left_value)\n      {\n        ecma_free_value (left_value);\n      }\n      ecma_deref_ecma_string (string1_p);\n      return ECMA_VALUE_ERROR;\n    }\n\n    string1_p = ecma_concat_ecma_strings (string1_p, string2_p);\n    ret_value = ecma_make_string_value (string1_p);\n\n    ecma_deref_ecma_string (string2_p);\n  }\n#if JERRY_BUILTIN_BIGINT\n  else if (JERRY_UNLIKELY (ecma_is_value_bigint (left_value)) && JERRY_UNLIKELY (ecma_is_value_bigint (right_value)))\n  {\n    ret_value = ecma_bigint_add_sub (left_value, right_value, true);\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n  else\n  {\n    ecma_number_t num_left;\n    ecma_number_t num_right;\n    if (!ECMA_IS_VALUE_ERROR (ecma_op_to_number (left_value, &num_left))\n        && !ECMA_IS_VALUE_ERROR (ecma_op_to_number (right_value, &num_right)))\n    {\n      ret_value = ecma_make_number_value (num_left + num_right);\n    }\n    else\n    {\n      ret_value = ECMA_VALUE_ERROR;\n    }\n  }\n\n  if (free_left_value)\n  {\n    ecma_free_value (left_value);\n  }\n\n  if (free_right_value)\n  {\n    ecma_free_value (right_value);\n  }\n\n  return ret_value;\n} /* opfunc_addition */\n\n/**\n * Unary operation opcode handler.\n *\n * See also: ECMA-262 v5, 11.4, 11.4.6, 11.4.7\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\nopfunc_unary_operation (ecma_value_t left_value, /**< left value */\n                        bool is_plus) /**< unary plus flag */\n{\n  ecma_number_t left_number;\n  left_value = ecma_op_to_numeric (left_value, &left_number, ECMA_TO_NUMERIC_ALLOW_BIGINT);\n\n  if (ECMA_IS_VALUE_ERROR (left_value))\n  {\n    return left_value;\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (JERRY_LIKELY (!ecma_is_value_bigint (left_value)))\n  {\n    return ecma_make_number_value (is_plus ? left_number : -left_number);\n  }\n\n  ecma_value_t ret_value;\n\n  if (is_plus)\n  {\n    ret_value = ecma_raise_type_error (ECMA_ERR_UNARY_PLUS_IS_NOT_ALLOWED_FOR_BIGINTS);\n  }\n  else\n  {\n    ret_value = left_value;\n\n    if (left_value != ECMA_BIGINT_ZERO)\n    {\n      ret_value = ecma_bigint_negate (ecma_get_extended_primitive_from_value (left_value));\n    }\n  }\n\n  ecma_free_value (left_value);\n  return ret_value;\n#else /* !JERRY_BUILTIN_BIGINT */\n  return ecma_make_number_value (is_plus ? left_number : -left_number);\n#endif /* JERRY_BUILTIN_BIGINT */\n} /* opfunc_unary_operation */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/vm/opcodes-ecma-bitwise.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-alloc.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"opcodes.h\"\n\n/** \\addtogroup vm Virtual machine\n * @{\n *\n * \\addtogroup vm_opcodes Opcodes\n * @{\n */\n\n/**\n * Perform ECMA number logic operation.\n *\n * The algorithm of the operation is following:\n *   leftNum = ToNumber (leftValue);\n *   rightNum = ToNumber (rightValue);\n *   result = leftNum BitwiseLogicOp rightNum;\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\ndo_number_bitwise_logic (number_bitwise_logic_op op, /**< number bitwise logic operation */\n                         ecma_value_t left_value, /**< left value */\n                         ecma_value_t right_value) /**< right value */\n{\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));\n\n  ecma_number_t left_number;\n  left_value = ecma_op_to_numeric (left_value, &left_number, ECMA_TO_NUMERIC_ALLOW_BIGINT);\n\n  if (ECMA_IS_VALUE_ERROR (left_value))\n  {\n    return left_value;\n  }\n\n  ecma_value_t ret_value = ECMA_VALUE_EMPTY;\n\n#if JERRY_BUILTIN_BIGINT\n  if (JERRY_LIKELY (!ecma_is_value_bigint (left_value)))\n  {\n#endif /* JERRY_BUILTIN_BIGINT */\n    ecma_number_t right_number;\n\n    if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (right_value, &right_number)))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    ecma_number_t result = ECMA_NUMBER_ZERO;\n    uint32_t right_uint32 = ecma_number_to_uint32 (right_number);\n\n    switch (op)\n    {\n      case NUMBER_BITWISE_LOGIC_AND:\n      {\n        uint32_t left_uint32 = ecma_number_to_uint32 (left_number);\n        result = (ecma_number_t) ((int32_t) (left_uint32 & right_uint32));\n        break;\n      }\n      case NUMBER_BITWISE_LOGIC_OR:\n      {\n        uint32_t left_uint32 = ecma_number_to_uint32 (left_number);\n        result = (ecma_number_t) ((int32_t) (left_uint32 | right_uint32));\n        break;\n      }\n      case NUMBER_BITWISE_LOGIC_XOR:\n      {\n        uint32_t left_uint32 = ecma_number_to_uint32 (left_number);\n        result = (ecma_number_t) ((int32_t) (left_uint32 ^ right_uint32));\n        break;\n      }\n      case NUMBER_BITWISE_SHIFT_LEFT:\n      {\n        result = (ecma_number_t) ((int32_t) ((uint32_t) ecma_number_to_int32 (left_number) << (right_uint32 & 0x1F)));\n        break;\n      }\n      case NUMBER_BITWISE_SHIFT_RIGHT:\n      {\n        result = (ecma_number_t) (ecma_number_to_int32 (left_number) >> (right_uint32 & 0x1F));\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (op == NUMBER_BITWISE_SHIFT_URIGHT);\n\n        uint32_t left_uint32 = ecma_number_to_uint32 (left_number);\n        result = (ecma_number_t) (left_uint32 >> (right_uint32 & 0x1F));\n        break;\n      }\n    }\n\n    ret_value = ecma_make_number_value (result);\n\n#if JERRY_BUILTIN_BIGINT\n  }\n  else\n  {\n    bool free_right_value;\n    right_value = ecma_bigint_get_bigint (right_value, &free_right_value);\n\n    if (ECMA_IS_VALUE_ERROR (right_value))\n    {\n      ecma_free_value (left_value);\n      return right_value;\n    }\n\n    switch (op)\n    {\n      case NUMBER_BITWISE_LOGIC_AND:\n      {\n        ret_value = ecma_bigint_and (left_value, right_value);\n        break;\n      }\n      case NUMBER_BITWISE_LOGIC_OR:\n      {\n        ret_value = ecma_bigint_or (left_value, right_value);\n        break;\n      }\n      case NUMBER_BITWISE_LOGIC_XOR:\n      {\n        ret_value = ecma_bigint_xor (left_value, right_value);\n        break;\n      }\n      case NUMBER_BITWISE_SHIFT_LEFT:\n      {\n        ret_value = ecma_bigint_shift (left_value, right_value, true);\n        break;\n      }\n      case NUMBER_BITWISE_SHIFT_RIGHT:\n      {\n        ret_value = ecma_bigint_shift (left_value, right_value, false);\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (op == NUMBER_BITWISE_SHIFT_URIGHT);\n\n        ret_value = ecma_raise_type_error (ECMA_ERR_UNSIGNED_RIGHT_SHIFT_IS_NOT_ALLOWED_FOR_BIGINTS);\n        break;\n      }\n    }\n\n    ecma_free_value (left_value);\n    if (free_right_value)\n    {\n      ecma_free_value (right_value);\n    }\n  }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n  return ret_value;\n} /* do_number_bitwise_logic */\n\n/**\n * Perform ECMA number bitwise not operation.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\ndo_number_bitwise_not (ecma_value_t value) /**< value */\n{\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (value));\n\n  ecma_number_t number;\n  value = ecma_op_to_numeric (value, &number, ECMA_TO_NUMERIC_ALLOW_BIGINT);\n\n  if (ECMA_IS_VALUE_ERROR (value))\n  {\n    return value;\n  }\n\n#if JERRY_BUILTIN_BIGINT\n  if (JERRY_LIKELY (!ecma_is_value_bigint (value)))\n  {\n#endif /* JERRY_BUILTIN_BIGINT */\n    return ecma_make_number_value ((ecma_number_t) ((int32_t) ~ecma_number_to_uint32 (number)));\n#if JERRY_BUILTIN_BIGINT\n  }\n\n  ecma_value_t ret_value = ecma_bigint_unary (value, ECMA_BIGINT_UNARY_BITWISE_NOT);\n  ecma_free_value (value);\n  return ret_value;\n#endif /* JERRY_BUILTIN_BIGINT */\n} /* do_number_bitwise_not */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/vm/opcodes-ecma-relational-equality.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-comparison.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-objects.h\"\n\n#include \"opcodes.h\"\n\n/** \\addtogroup vm Virtual machine\n * @{\n *\n * \\addtogroup vm_opcodes Opcodes\n * @{\n */\n\n/**\n * Equality opcode handler.\n *\n * See also: ECMA-262 v5, 11.9.1, 11.9.2\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\nopfunc_equality (ecma_value_t left_value, /**< left value */\n                 ecma_value_t right_value) /**< right value */\n{\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));\n\n  ecma_value_t compare_result = ecma_op_abstract_equality_compare (left_value, right_value);\n\n  JERRY_ASSERT (ecma_is_value_boolean (compare_result) || ECMA_IS_VALUE_ERROR (compare_result));\n\n  return compare_result;\n} /* opfunc_equality */\n\n/**\n * Relation opcode handler.\n *\n * See also: ECMA-262 v5, 11.8.1, 11.8.2, 11.8.3, 11.8.4\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\nopfunc_relation (ecma_value_t left_value, /**< left value */\n                 ecma_value_t right_value, /**< right value */\n                 bool left_first, /**< 'LeftFirst' flag */\n                 bool is_invert) /**< is invert */\n{\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));\n\n  ecma_value_t ret_value = ecma_op_abstract_relational_compare (left_value, right_value, left_first);\n\n  if (ECMA_IS_VALUE_ERROR (ret_value))\n  {\n    return ret_value;\n  }\n\n  if (ecma_is_value_undefined (ret_value))\n  {\n    ret_value = ECMA_VALUE_FALSE;\n  }\n  else\n  {\n    JERRY_ASSERT (ecma_is_value_boolean (ret_value));\n\n    if (is_invert)\n    {\n      ret_value = ecma_invert_boolean_value (ret_value);\n    }\n  }\n\n  return ret_value;\n} /* opfunc_relation */\n\n/**\n * 'instanceof' opcode handler.\n *\n * See also: ECMA-262 v5, 11.8.6\n *\n * @return ecma value\n *         returned value must be freed with ecma_free_value.\n */\necma_value_t\nopfunc_instanceof (ecma_value_t left_value, /**< left value */\n                   ecma_value_t right_value) /**< right value */\n{\n  if (!ecma_is_value_object (right_value))\n  {\n    return ecma_raise_type_error (ECMA_ERR_RIGHT_VALUE_OF_INSTANCEOF_MUST_BE_AN_OBJECT);\n  }\n\n  ecma_value_t has_instance_method = ecma_op_get_method_by_symbol_id (right_value, LIT_GLOBAL_SYMBOL_HAS_INSTANCE);\n  if (ECMA_IS_VALUE_ERROR (has_instance_method))\n  {\n    return has_instance_method;\n  }\n\n  if (JERRY_UNLIKELY (!ecma_is_value_undefined (has_instance_method)))\n  {\n    ecma_object_t *method_obj_p = ecma_get_object_from_value (has_instance_method);\n    ecma_value_t has_instance_result = ecma_op_function_call (method_obj_p, right_value, &left_value, 1);\n\n    ecma_free_value (has_instance_method);\n\n    if (ECMA_IS_VALUE_ERROR (has_instance_result))\n    {\n      return has_instance_result;\n    }\n\n    bool has_instance = ecma_op_to_boolean (has_instance_result);\n    ecma_free_value (has_instance_result);\n\n    return ecma_make_boolean_value (has_instance);\n  }\n\n  ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);\n  return ecma_op_object_has_instance (right_value_obj_p, left_value);\n} /* opfunc_instanceof */\n\n/**\n * 'in' opcode handler.\n *\n * See also:\n *  * ECMA-262 v5, 11.8.7\n *  * ECAM-262 v6, 12.9.3\n *\n * @return ecma value\n *         returned value must be freed with ecma_free_value.\n */\necma_value_t\nopfunc_in (ecma_value_t left_value, /**< left value */\n           ecma_value_t right_value) /**< right value */\n{\n  if (!ecma_is_value_object (right_value))\n  {\n    return ecma_raise_type_error (ECMA_ERR_RIGHT_VALUE_OF_IN_MUST_BE_AN_OBJECT);\n  }\n\n  ecma_string_t *property_name_p = ecma_op_to_property_key (left_value);\n\n  if (JERRY_UNLIKELY (property_name_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);\n  ecma_value_t result = ecma_op_object_has_property (right_value_obj_p, property_name_p);\n  ecma_deref_ecma_string (property_name_p);\n  return result;\n} /* opfunc_in */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/vm/opcodes.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"opcodes.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-promise-object.h\"\n#include \"ecma-proxy-object.h\"\n\n#include \"jcontext.h\"\n#include \"vm-defines.h\"\n#include \"vm-stack.h\"\n\n/** \\addtogroup vm Virtual machine\n * @{\n *\n * \\addtogroup vm_opcodes Opcodes\n * @{\n */\n\n/**\n * 'typeof' opcode handler.\n *\n * See also: ECMA-262 v5, 11.4.3\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\nopfunc_typeof (ecma_value_t left_value) /**< left value */\n{\n  return ecma_make_magic_string_value (ecma_get_typeof_lit_id (left_value));\n} /* opfunc_typeof */\n\n/**\n * Update data property for object literals.\n */\nvoid\nopfunc_set_data_property (ecma_object_t *object_p, /**< object */\n                          ecma_string_t *prop_name_p, /**< data property name */\n                          ecma_value_t value) /**< new value */\n{\n  JERRY_ASSERT (!ecma_op_object_is_fast_array (object_p));\n\n  ecma_property_t *property_p = ecma_find_named_property (object_p, prop_name_p);\n  ecma_property_value_t *prop_value_p;\n\n  if (property_p == NULL)\n  {\n    prop_value_p =\n      ecma_create_named_data_property (object_p, prop_name_p, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL);\n  }\n  else\n  {\n    JERRY_ASSERT (ECMA_PROPERTY_IS_RAW (*property_p));\n\n    prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n    if (!(*property_p & ECMA_PROPERTY_FLAG_DATA))\n    {\n#if JERRY_CPOINTER_32_BIT\n      ecma_getter_setter_pointers_t *getter_setter_pair_p;\n      getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t,\n                                                        ECMA_PROPERTY_VALUE_PTR (property_p)->getter_setter_pair_cp);\n      jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));\n#endif /* JERRY_CPOINTER_32_BIT */\n\n      *property_p |= ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_FLAG_WRITABLE;\n      prop_value_p->value = ecma_copy_value_if_not_object (value);\n      return;\n    }\n  }\n\n  ecma_named_data_property_assign_value (object_p, prop_value_p, value);\n} /* opfunc_set_data_property */\n\n/**\n * Update getter or setter for object literals.\n */\nvoid\nopfunc_set_accessor (bool is_getter, /**< is getter accessor */\n                     ecma_value_t object, /**< object value */\n                     ecma_string_t *accessor_name_p, /**< accessor name */\n                     ecma_value_t accessor) /**< accessor value */\n{\n  ecma_object_t *object_p = ecma_get_object_from_value (object);\n\n  JERRY_ASSERT (!ecma_op_object_is_fast_array (object_p));\n\n  ecma_property_t *property_p = ecma_find_named_property (object_p, accessor_name_p);\n  ecma_object_t *accessor_p = ecma_get_object_from_value (accessor);\n\n  ecma_object_t *getter_func_p = NULL;\n  ecma_object_t *setter_func_p = NULL;\n\n  if (is_getter)\n  {\n    getter_func_p = accessor_p;\n  }\n  else\n  {\n    setter_func_p = accessor_p;\n  }\n\n  if (property_p == NULL)\n  {\n    ecma_create_named_accessor_property (object_p,\n                                         accessor_name_p,\n                                         getter_func_p,\n                                         setter_func_p,\n                                         ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE,\n                                         NULL);\n  }\n  else\n  {\n    JERRY_ASSERT (ECMA_PROPERTY_IS_RAW (*property_p));\n\n    ecma_property_value_t *prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n\n    if (*property_p & ECMA_PROPERTY_FLAG_DATA)\n    {\n#if JERRY_CPOINTER_32_BIT\n      ecma_getter_setter_pointers_t *getter_setter_pair_p;\n      getter_setter_pair_p = jmem_pools_alloc (sizeof (ecma_getter_setter_pointers_t));\n#endif /* JERRY_CPOINTER_32_BIT */\n\n      ecma_free_value_if_not_object (prop_value_p->value);\n      *property_p = (uint8_t) (*property_p & ~(ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_FLAG_WRITABLE));\n\n#if JERRY_CPOINTER_32_BIT\n      ECMA_SET_POINTER (getter_setter_pair_p->getter_cp, getter_func_p);\n      ECMA_SET_POINTER (getter_setter_pair_p->setter_cp, setter_func_p);\n      ECMA_SET_NON_NULL_POINTER (prop_value_p->getter_setter_pair_cp, getter_setter_pair_p);\n#else /* !JERRY_CPOINTER_32_BIT */\n      ECMA_SET_POINTER (prop_value_p->getter_setter_pair.getter_cp, getter_func_p);\n      ECMA_SET_POINTER (prop_value_p->getter_setter_pair.setter_cp, setter_func_p);\n#endif /* JERRY_CPOINTER_32_BIT */\n      return;\n    }\n\n    if (is_getter)\n    {\n      ecma_set_named_accessor_property_getter (object_p, prop_value_p, accessor_p);\n    }\n    else\n    {\n      ecma_set_named_accessor_property_setter (object_p, prop_value_p, accessor_p);\n    }\n  }\n} /* opfunc_set_accessor */\n\n/**\n * Deletes an object property.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\nvm_op_delete_prop (ecma_value_t object, /**< base object */\n                   ecma_value_t property, /**< property name */\n                   bool is_strict) /**< strict mode */\n{\n  if (!ecma_op_require_object_coercible (object))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_string_t *name_string_p = ecma_op_to_property_key (property);\n\n  if (JERRY_UNLIKELY (name_string_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t obj_value = ecma_op_to_object (object);\n  /* The ecma_op_require_object_coercible call already checked the op_to_object error cases. */\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (obj_value));\n  JERRY_ASSERT (ecma_is_value_object (obj_value));\n  ecma_object_t *obj_p = ecma_get_object_from_value (obj_value);\n  JERRY_ASSERT (!ecma_is_lexical_environment (obj_p));\n\n  ecma_value_t delete_op_ret = ecma_op_object_delete (obj_p, name_string_p, is_strict);\n  JERRY_ASSERT (ecma_is_value_boolean (delete_op_ret) || ECMA_IS_VALUE_ERROR (delete_op_ret));\n  ecma_deref_object (obj_p);\n  ecma_deref_ecma_string (name_string_p);\n\n  if (is_strict && ecma_is_value_false (delete_op_ret))\n  {\n    return ecma_raise_type_error (ECMA_ERR_OPERATOR_DELETE_RETURNED_FALSE_IN_STRICT_MODE);\n  }\n\n  return delete_op_ret;\n} /* vm_op_delete_prop */\n\n/**\n * Deletes a variable.\n *\n * @return ecma value\n *         Returned value must be freed with ecma_free_value\n */\necma_value_t\nvm_op_delete_var (ecma_value_t name_literal, /**< name literal */\n                  ecma_object_t *lex_env_p) /**< lexical environment */\n{\n  ecma_value_t completion_value = ECMA_VALUE_EMPTY;\n\n  ecma_string_t *var_name_str_p = ecma_get_string_from_value (name_literal);\n\n  ecma_object_t *ref_base_lex_env_p = ecma_op_resolve_reference_base (lex_env_p, var_name_str_p);\n\n#if JERRY_BUILTIN_PROXY\n  if (JERRY_UNLIKELY (ref_base_lex_env_p == ECMA_OBJECT_POINTER_ERROR))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  if (ref_base_lex_env_p == NULL)\n  {\n    completion_value = ECMA_VALUE_TRUE;\n  }\n  else\n  {\n    JERRY_ASSERT (ecma_is_lexical_environment (ref_base_lex_env_p));\n\n    completion_value = ecma_op_delete_binding (ref_base_lex_env_p, var_name_str_p);\n  }\n\n  return completion_value;\n} /* vm_op_delete_var */\n\n/**\n * 'for-in' opcode handler\n *\n *  Note: from ES2015 (ES6) the for-in can trigger error when\n *        the property names are not available (ex.: via Proxy ownKeys).\n *        In these cases an error must be returned.\n *\n *        This error is returned as the `result_obj_p` and the\n *        function's return value is NULL.\n *\n * See also:\n *          ECMA-262 v5, 12.6.4\n *\n * @return - chain list of property names\n *         - In case of error: NULL is returned and the `result_obj_p`\n *           must be checked.\n */\necma_collection_t *\nopfunc_for_in (ecma_value_t iterable_value, /**< ideally an iterable value */\n               ecma_value_t *result_obj_p) /**< expression object */\n{\n  /* 3. */\n  if (ecma_is_value_undefined (iterable_value) || ecma_is_value_null (iterable_value))\n  {\n    return NULL;\n  }\n\n  /* 4. */\n  ecma_value_t obj_expr_value = ecma_op_to_object (iterable_value);\n  /* ecma_op_to_object will only raise error on null/undefined values but those are handled above. */\n  JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (obj_expr_value));\n  ecma_object_t *obj_p = ecma_get_object_from_value (obj_expr_value);\n  ecma_collection_t *prop_names_p = ecma_op_object_enumerate (obj_p);\n\n  if (JERRY_UNLIKELY (prop_names_p == NULL))\n  {\n    ecma_deref_object (obj_p);\n    *result_obj_p = ECMA_VALUE_ERROR;\n    return NULL;\n  }\n\n  if (prop_names_p->item_count != 0)\n  {\n    *result_obj_p = ecma_make_object_value (obj_p);\n    return prop_names_p;\n  }\n\n  ecma_deref_object (obj_p);\n  ecma_collection_destroy (prop_names_p);\n\n  return NULL;\n} /* opfunc_for_in */\n\n/**\n * 'VM_OC_APPEND_ARRAY' opcode handler specialized for spread objects\n *\n * @return ECMA_VALUE_ERROR - if the operation failed\n *         ECMA_VALUE_EMPTY, otherwise\n */\nstatic ecma_value_t JERRY_ATTR_NOINLINE\nopfunc_append_to_spread_array (ecma_value_t *stack_top_p, /**< current stack top */\n                               uint16_t values_length) /**< number of elements to set */\n{\n  JERRY_ASSERT (!(values_length & OPFUNC_HAS_SPREAD_ELEMENT));\n\n  ecma_object_t *array_obj_p = ecma_get_object_from_value (stack_top_p[-1]);\n  JERRY_ASSERT (ecma_get_object_type (array_obj_p) == ECMA_OBJECT_TYPE_ARRAY);\n\n  ecma_extended_object_t *ext_array_obj_p = (ecma_extended_object_t *) array_obj_p;\n  uint32_t old_length = ext_array_obj_p->u.array.length;\n\n  for (uint32_t i = 0, idx = old_length; i < values_length; i++, idx++)\n  {\n    if (ecma_is_value_array_hole (stack_top_p[i]))\n    {\n      continue;\n    }\n\n    if (stack_top_p[i] == ECMA_VALUE_SPREAD_ELEMENT)\n    {\n      i++;\n      ecma_value_t ret_value = ECMA_VALUE_ERROR;\n      ecma_value_t spread_value = stack_top_p[i];\n\n      ecma_value_t next_method;\n      ecma_value_t iterator = ecma_op_get_iterator (spread_value, ECMA_VALUE_SYNC_ITERATOR, &next_method);\n\n      if (!ECMA_IS_VALUE_ERROR (iterator))\n      {\n        while (true)\n        {\n          ecma_value_t next_value = ecma_op_iterator_step (iterator, next_method);\n\n          if (ECMA_IS_VALUE_ERROR (next_value))\n          {\n            break;\n          }\n\n          if (ecma_is_value_false (next_value))\n          {\n            idx--;\n            ret_value = ECMA_VALUE_EMPTY;\n            break;\n          }\n\n          ecma_value_t value = ecma_op_iterator_value (next_value);\n\n          ecma_free_value (next_value);\n\n          if (ECMA_IS_VALUE_ERROR (value))\n          {\n            break;\n          }\n\n          ecma_value_t put_comp;\n          put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p,\n                                                            idx++,\n                                                            value,\n                                                            ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n\n          JERRY_ASSERT (ecma_is_value_true (put_comp));\n          ecma_free_value (value);\n        }\n      }\n\n      ecma_free_value (iterator);\n      ecma_free_value (next_method);\n      ecma_free_value (spread_value);\n\n      if (ECMA_IS_VALUE_ERROR (ret_value))\n      {\n        for (uint32_t k = i + 1; k < values_length; k++)\n        {\n          ecma_free_value (stack_top_p[k]);\n        }\n\n        return ret_value;\n      }\n    }\n    else\n    {\n      ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p,\n                                                                     idx,\n                                                                     stack_top_p[i],\n                                                                     ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);\n      JERRY_ASSERT (ecma_is_value_true (put_comp));\n      ecma_free_value (stack_top_p[i]);\n    }\n  }\n\n  return ECMA_VALUE_EMPTY;\n} /* opfunc_append_to_spread_array */\n\n/**\n * Spread function call/construct arguments into an ecma-collection\n *\n * @return NULL - if the operation failed\n *         pointer to the ecma-collection with the spreaded arguments, otherwise\n */\nJERRY_ATTR_NOINLINE ecma_collection_t *\nopfunc_spread_arguments (ecma_value_t *stack_top_p, /**< pointer to the current stack top */\n                         uint8_t arguments_list_len) /**< number of arguments */\n{\n  ecma_collection_t *buff_p = ecma_new_collection ();\n\n  for (uint32_t i = 0; i < arguments_list_len; i++)\n  {\n    ecma_value_t arg = *stack_top_p++;\n\n    if (arg != ECMA_VALUE_SPREAD_ELEMENT)\n    {\n      ecma_collection_push_back (buff_p, arg);\n      continue;\n    }\n\n    ecma_value_t ret_value = ECMA_VALUE_ERROR;\n    ecma_value_t spread_value = *stack_top_p++;\n    i++;\n\n    ecma_value_t next_method;\n    ecma_value_t iterator = ecma_op_get_iterator (spread_value, ECMA_VALUE_SYNC_ITERATOR, &next_method);\n\n    if (!ECMA_IS_VALUE_ERROR (iterator))\n    {\n      while (true)\n      {\n        ecma_value_t next_value = ecma_op_iterator_step (iterator, next_method);\n\n        if (ECMA_IS_VALUE_ERROR (next_value))\n        {\n          break;\n        }\n\n        if (ecma_is_value_false (next_value))\n        {\n          ret_value = ECMA_VALUE_EMPTY;\n          break;\n        }\n\n        ecma_value_t value = ecma_op_iterator_value (next_value);\n\n        ecma_free_value (next_value);\n\n        if (ECMA_IS_VALUE_ERROR (value))\n        {\n          break;\n        }\n\n        ecma_collection_push_back (buff_p, value);\n      }\n    }\n\n    ecma_free_value (iterator);\n    ecma_free_value (next_method);\n    ecma_free_value (spread_value);\n\n    if (ECMA_IS_VALUE_ERROR (ret_value))\n    {\n      for (uint32_t k = i + 1; k < arguments_list_len; k++)\n      {\n        ecma_free_value (*stack_top_p++);\n      }\n\n      ecma_collection_free (buff_p);\n      buff_p = NULL;\n      break;\n    }\n  }\n\n  return buff_p;\n} /* opfunc_spread_arguments */\n\n/**\n * 'VM_OC_APPEND_ARRAY' opcode handler, for setting array object properties\n *\n * @return ECMA_VALUE_ERROR - if the operation failed\n *         ECMA_VALUE_EMPTY, otherwise\n */\necma_value_t JERRY_ATTR_NOINLINE\nopfunc_append_array (ecma_value_t *stack_top_p, /**< current stack top */\n                     uint16_t values_length) /**< number of elements to set\n                                              *   with potential OPFUNC_HAS_SPREAD_ELEMENT flag */\n{\n  if (values_length >= OPFUNC_HAS_SPREAD_ELEMENT)\n  {\n    return opfunc_append_to_spread_array (stack_top_p, (uint16_t) (values_length & ~OPFUNC_HAS_SPREAD_ELEMENT));\n  }\n\n  ecma_object_t *array_obj_p = ecma_get_object_from_value (stack_top_p[-1]);\n  JERRY_ASSERT (ecma_get_object_type (array_obj_p) == ECMA_OBJECT_TYPE_ARRAY);\n\n  ecma_extended_object_t *ext_array_obj_p = (ecma_extended_object_t *) array_obj_p;\n  uint32_t old_length = ext_array_obj_p->u.array.length;\n\n  if (JERRY_LIKELY (ecma_op_array_is_fast_array (ext_array_obj_p)))\n  {\n    uint32_t filled_holes = 0;\n    ecma_value_t *values_p = ecma_fast_array_extend (array_obj_p, old_length + values_length);\n\n    for (uint32_t i = 0; i < values_length; i++)\n    {\n      values_p[old_length + i] = stack_top_p[i];\n\n      if (!ecma_is_value_array_hole (stack_top_p[i]))\n      {\n        filled_holes++;\n\n        ecma_deref_if_object (stack_top_p[i]);\n      }\n    }\n\n    ext_array_obj_p->u.array.length_prop_and_hole_count -= filled_holes * ECMA_FAST_ARRAY_HOLE_ONE;\n\n    if (JERRY_UNLIKELY ((values_length - filled_holes) > ECMA_FAST_ARRAY_MAX_NEW_HOLES_COUNT))\n    {\n      ecma_fast_array_convert_to_normal (array_obj_p);\n    }\n  }\n  else\n  {\n    for (uint32_t i = 0; i < values_length; i++)\n    {\n      if (!ecma_is_value_array_hole (stack_top_p[i]))\n      {\n        ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (old_length + i);\n\n        ecma_property_value_t *prop_value_p;\n\n        prop_value_p = ecma_create_named_data_property (array_obj_p,\n                                                        index_str_p,\n                                                        ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,\n                                                        NULL);\n\n        ecma_deref_ecma_string (index_str_p);\n        prop_value_p->value = stack_top_p[i];\n        ecma_deref_if_object (stack_top_p[i]);\n      }\n    }\n    ext_array_obj_p->u.array.length = old_length + values_length;\n  }\n\n  return ECMA_VALUE_EMPTY;\n} /* opfunc_append_array */\n\n/**\n * Create an executable object using the current frame context\n *\n * @return executable object\n */\nvm_executable_object_t *\nopfunc_create_executable_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                                 vm_create_executable_object_type_t type) /**< executable object type */\n{\n  const ecma_compiled_code_t *bytecode_header_p = frame_ctx_p->shared_p->bytecode_header_p;\n  size_t size, register_end;\n\n  ecma_bytecode_ref ((ecma_compiled_code_t *) bytecode_header_p);\n\n  if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_header_p;\n    register_end = (size_t) args_p->register_end;\n    size = (register_end + (size_t) args_p->stack_limit) * sizeof (ecma_value_t);\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_header_p;\n    register_end = (size_t) args_p->register_end;\n    size = (register_end + (size_t) args_p->stack_limit) * sizeof (ecma_value_t);\n  }\n\n  size_t total_size = JERRY_ALIGNUP (sizeof (vm_executable_object_t) + size, sizeof (uintptr_t));\n\n  ecma_object_t *proto_p = NULL;\n  /* Async function objects are not accessible, so their class_id is not relevant. */\n  uint8_t class_type = ECMA_OBJECT_CLASS_GENERATOR;\n\n  if (type == VM_CREATE_EXECUTABLE_OBJECT_GENERATOR)\n  {\n    ecma_builtin_id_t default_proto_id = ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE;\n\n    if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) == CBC_FUNCTION_ASYNC_GENERATOR)\n    {\n      default_proto_id = ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE;\n      class_type = ECMA_OBJECT_CLASS_ASYNC_GENERATOR;\n    }\n\n    JERRY_ASSERT (frame_ctx_p->shared_p->status_flags & VM_FRAME_CTX_SHARED_NON_ARROW_FUNC);\n    proto_p = ecma_op_get_prototype_from_constructor (frame_ctx_p->shared_p->function_object_p, default_proto_id);\n  }\n\n  ecma_object_t *object_p = ecma_create_object (proto_p, total_size, ECMA_OBJECT_TYPE_CLASS);\n\n  vm_executable_object_t *executable_object_p = (vm_executable_object_t *) object_p;\n\n  if (type == VM_CREATE_EXECUTABLE_OBJECT_GENERATOR)\n  {\n    ecma_deref_object (proto_p);\n  }\n\n  executable_object_p->extended_object.u.cls.type = class_type;\n  executable_object_p->extended_object.u.cls.u2.executable_obj_flags = 0;\n  ECMA_SET_INTERNAL_VALUE_ANY_POINTER (executable_object_p->extended_object.u.cls.u3.head, NULL);\n  executable_object_p->iterator = ECMA_VALUE_UNDEFINED;\n\n  JERRY_ASSERT (!(frame_ctx_p->status_flags & VM_FRAME_CTX_DIRECT_EVAL));\n\n  /* Copy shared data and frame context. */\n  vm_frame_ctx_shared_t *new_shared_p = &(executable_object_p->shared);\n  *new_shared_p = *(frame_ctx_p->shared_p);\n  new_shared_p->status_flags &= (uint32_t) ~VM_FRAME_CTX_SHARED_HAS_ARG_LIST;\n  new_shared_p->status_flags |= VM_FRAME_CTX_SHARED_EXECUTABLE;\n\n  vm_frame_ctx_t *new_frame_ctx_p = &(executable_object_p->frame_ctx);\n  *new_frame_ctx_p = *frame_ctx_p;\n  new_frame_ctx_p->shared_p = new_shared_p;\n\n  /* The old register values are discarded. */\n  ecma_value_t *new_registers_p = VM_GET_REGISTERS (new_frame_ctx_p);\n  memcpy (new_registers_p, VM_GET_REGISTERS (frame_ctx_p), size);\n\n  size_t stack_top = (size_t) (frame_ctx_p->stack_top_p - VM_GET_REGISTERS (frame_ctx_p));\n  ecma_value_t *new_stack_top_p = new_registers_p + stack_top;\n\n  new_frame_ctx_p->stack_top_p = new_stack_top_p;\n\n  /* Initial state is \"not running\", so all object references are released. */\n\n  if (frame_ctx_p->context_depth > 0)\n  {\n    JERRY_ASSERT (type != VM_CREATE_EXECUTABLE_OBJECT_GENERATOR);\n\n    ecma_value_t *register_end_p = new_registers_p + register_end;\n\n    JERRY_ASSERT (register_end_p <= new_stack_top_p);\n\n    while (new_registers_p < register_end_p)\n    {\n      ecma_deref_if_object (*new_registers_p++);\n    }\n\n    vm_ref_lex_env_chain (frame_ctx_p->lex_env_p, frame_ctx_p->context_depth, new_registers_p, false);\n\n    new_registers_p += frame_ctx_p->context_depth;\n\n    JERRY_ASSERT (new_registers_p <= new_stack_top_p);\n  }\n\n  while (new_registers_p < new_stack_top_p)\n  {\n    ecma_deref_if_object (*new_registers_p++);\n  }\n\n  JERRY_ASSERT (*VM_GET_EXECUTABLE_ITERATOR (new_frame_ctx_p) == ECMA_VALUE_UNDEFINED);\n\n  new_frame_ctx_p->this_binding = ecma_copy_value_if_not_object (new_frame_ctx_p->this_binding);\n\n  JERRY_CONTEXT (vm_top_context_p) = new_frame_ctx_p->prev_context_p;\n\n  return executable_object_p;\n} /* opfunc_create_executable_object */\n\n/**\n * Byte code which resumes an executable object with throw\n */\nconst uint8_t opfunc_resume_executable_object_with_throw[1] = { CBC_THROW };\n\n/**\n * Byte code which resumes an executable object with return\n */\nconst uint8_t opfunc_resume_executable_object_with_return[2] = { CBC_EXT_OPCODE, CBC_EXT_RETURN };\n\n/**\n * Resume the execution of an inactive executable object\n *\n * @return value provided by the execution\n */\necma_value_t\nopfunc_resume_executable_object (vm_executable_object_t *executable_object_p, /**< executable object */\n                                 ecma_value_t value) /**< value pushed onto the stack (takes the reference) */\n{\n  const ecma_compiled_code_t *bytecode_header_p = executable_object_p->shared.bytecode_header_p;\n  ecma_value_t *register_p = VM_GET_REGISTERS (&executable_object_p->frame_ctx);\n  ecma_value_t *register_end_p;\n\n  if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_header_p;\n    register_end_p = register_p + args_p->register_end;\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_header_p;\n    register_end_p = register_p + args_p->register_end;\n  }\n\n  ecma_value_t *stack_top_p = executable_object_p->frame_ctx.stack_top_p;\n\n  if (value != ECMA_VALUE_EMPTY)\n  {\n    *stack_top_p = value;\n    executable_object_p->frame_ctx.stack_top_p = stack_top_p + 1;\n  }\n\n  if (executable_object_p->frame_ctx.context_depth > 0)\n  {\n    while (register_p < register_end_p)\n    {\n      ecma_ref_if_object (*register_p++);\n    }\n\n    vm_ref_lex_env_chain (executable_object_p->frame_ctx.lex_env_p,\n                          executable_object_p->frame_ctx.context_depth,\n                          register_p,\n                          true);\n\n    register_p += executable_object_p->frame_ctx.context_depth;\n  }\n\n  while (register_p < stack_top_p)\n  {\n    ecma_ref_if_object (*register_p++);\n  }\n\n  ecma_ref_if_object (executable_object_p->frame_ctx.this_binding);\n  ecma_ref_if_object (executable_object_p->iterator);\n\n  JERRY_ASSERT (ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED (executable_object_p));\n\n  executable_object_p->extended_object.u.cls.u2.executable_obj_flags |= ECMA_EXECUTABLE_OBJECT_RUNNING;\n\n  executable_object_p->frame_ctx.prev_context_p = JERRY_CONTEXT (vm_top_context_p);\n  JERRY_CONTEXT (vm_top_context_p) = &executable_object_p->frame_ctx;\n\n  /* inside the generators the \"new.target\" is always \"undefined\" as it can't be invoked with \"new\" */\n  ecma_object_t *old_new_target = JERRY_CONTEXT (current_new_target_p);\n  JERRY_CONTEXT (current_new_target_p) = NULL;\n\n#if JERRY_BUILTIN_REALMS\n  ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);\n  JERRY_CONTEXT (global_object_p) = ecma_op_function_get_realm (bytecode_header_p);\n#endif /* JERRY_BUILTIN_REALMS */\n\n  ecma_value_t result = vm_execute (&executable_object_p->frame_ctx);\n\n#if JERRY_BUILTIN_REALMS\n  JERRY_CONTEXT (global_object_p) = saved_global_object_p;\n#endif /* JERRY_BUILTIN_REALMS */\n\n  JERRY_CONTEXT (current_new_target_p) = old_new_target;\n  executable_object_p->extended_object.u.cls.u2.executable_obj_flags &= (uint8_t) ~ECMA_EXECUTABLE_OBJECT_RUNNING;\n\n  if (executable_object_p->frame_ctx.call_operation != VM_EXEC_RETURN)\n  {\n    JERRY_ASSERT (executable_object_p->frame_ctx.call_operation == VM_NO_EXEC_OP);\n\n    /* All resources are released. */\n    executable_object_p->extended_object.u.cls.u2.executable_obj_flags |= ECMA_EXECUTABLE_OBJECT_COMPLETED;\n    ecma_deref_if_object (executable_object_p->frame_ctx.this_binding);\n    return result;\n  }\n\n  JERRY_CONTEXT (vm_top_context_p) = executable_object_p->frame_ctx.prev_context_p;\n\n  register_p = VM_GET_REGISTERS (&executable_object_p->frame_ctx);\n  stack_top_p = executable_object_p->frame_ctx.stack_top_p;\n\n  if (executable_object_p->frame_ctx.context_depth > 0)\n  {\n    while (register_p < register_end_p)\n    {\n      ecma_deref_if_object (*register_p++);\n    }\n\n    vm_ref_lex_env_chain (executable_object_p->frame_ctx.lex_env_p,\n                          executable_object_p->frame_ctx.context_depth,\n                          register_p,\n                          false);\n\n    register_p += executable_object_p->frame_ctx.context_depth;\n  }\n\n  while (register_p < stack_top_p)\n  {\n    ecma_deref_if_object (*register_p++);\n  }\n\n  ecma_deref_if_object (executable_object_p->frame_ctx.this_binding);\n  ecma_deref_if_object (executable_object_p->iterator);\n\n  return result;\n} /* opfunc_resume_executable_object */\n\n/**\n * Fulfill the next promise of the async generator with the value\n */\nvoid\nopfunc_async_generator_yield (ecma_extended_object_t *async_generator_object_p, /**< async generator object */\n                              ecma_value_t value) /**< value (takes the reference) */\n{\n  ecma_async_generator_task_t *task_p;\n  task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t, async_generator_object_p->u.cls.u3.head);\n\n  ecma_value_t iter_result = ecma_create_iter_result_object (value, ECMA_VALUE_FALSE);\n  ecma_fulfill_promise (task_p->promise, iter_result);\n\n  ecma_free_value (iter_result);\n  ecma_free_value (value);\n\n  ecma_value_t next = task_p->next;\n  async_generator_object_p->u.cls.u3.head = next;\n\n  JERRY_ASSERT (task_p->operation_value == ECMA_VALUE_UNDEFINED);\n  jmem_heap_free_block (task_p, sizeof (ecma_async_generator_task_t));\n\n  if (!ECMA_IS_INTERNAL_VALUE_NULL (next))\n  {\n    ecma_value_t executable_object = ecma_make_object_value ((ecma_object_t *) async_generator_object_p);\n    ecma_enqueue_promise_async_generator_job (executable_object);\n  }\n} /* opfunc_async_generator_yield */\n\n/**\n * Creates a new executable object and awaits for the value\n *\n * Note:\n *   extra_flags can be used to set additional extra_info flags\n *\n * @return a new Promise object on success, error otherwise\n */\necma_value_t\nopfunc_async_create_and_await (vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                               ecma_value_t value, /**< awaited value (takes reference) */\n                               uint16_t extra_flags) /**< extra flags */\n{\n  JERRY_ASSERT (\n    CBC_FUNCTION_GET_TYPE (frame_ctx_p->shared_p->bytecode_header_p->status_flags) == CBC_FUNCTION_ASYNC\n    || (CBC_FUNCTION_GET_TYPE (frame_ctx_p->shared_p->bytecode_header_p->status_flags) == CBC_FUNCTION_ASYNC_ARROW));\n\n  ecma_object_t *promise_p = ecma_builtin_get (ECMA_BUILTIN_ID_PROMISE);\n  ecma_value_t result = ecma_promise_reject_or_resolve (ecma_make_object_value (promise_p), value, true);\n  ecma_free_value (value);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  vm_executable_object_t *executable_object_p;\n  executable_object_p = opfunc_create_executable_object (frame_ctx_p, VM_CREATE_EXECUTABLE_OBJECT_ASYNC);\n\n  executable_object_p->extended_object.u.cls.u2.executable_obj_flags |= extra_flags;\n\n  ecma_promise_async_then (result, ecma_make_object_value ((ecma_object_t *) executable_object_p));\n  ecma_deref_object ((ecma_object_t *) executable_object_p);\n  ecma_free_value (result);\n\n  result = ecma_op_create_promise_object (ECMA_VALUE_EMPTY, ECMA_VALUE_UNDEFINED, promise_p);\n\n  JERRY_ASSERT (ecma_is_value_object (result));\n  executable_object_p->iterator = result;\n\n  return result;\n} /* opfunc_async_create_and_await */\n\n/**\n * PrivateMethodOrAccessorAdd abstact operation.\n *\n * See also: ECMAScript v12, 7.3.29.\n *\n * @return ECMA_VALUE_ERROR - initialization fails\n *         ECMA_VALUE_UNDEFINED - otherwise\n */\nstatic ecma_value_t\nopfunc_private_method_or_accessor_add (ecma_object_t *class_object_p, /**< the function itself */\n                                       ecma_object_t *this_obj_p, /**< this object */\n                                       uint32_t static_flag) /**< static_flag */\n{\n  ecma_string_t *internal_string_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_CLASS_PRIVATE_ELEMENTS);\n  ecma_property_t *prop_p = ecma_find_named_property (class_object_p, internal_string_p);\n\n  if (prop_p == NULL)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  ecma_value_t *collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, ECMA_PROPERTY_VALUE_PTR (prop_p)->value);\n  ecma_value_t *current_p = collection_p + 1;\n  ecma_value_t *end_p = ecma_compact_collection_end (collection_p);\n\n  while (current_p < end_p)\n  {\n    uint32_t prop_desc = *current_p++;\n    ecma_private_property_kind_t kind = ECMA_PRIVATE_PROPERTY_KIND (prop_desc);\n\n    if ((prop_desc & ECMA_PRIVATE_PROPERTY_STATIC_FLAG) != static_flag || kind == ECMA_PRIVATE_FIELD)\n    {\n      current_p += 2;\n      continue;\n    }\n\n    ecma_string_t *prop_name_p = ecma_get_symbol_from_value (*current_p++);\n    ecma_value_t method = *current_p++;\n\n    JERRY_ASSERT (prop_name_p->u.hash & ECMA_SYMBOL_FLAG_PRIVATE_INSTANCE_METHOD);\n\n    if (ecma_op_object_is_fast_array (this_obj_p))\n    {\n      ecma_fast_array_convert_to_normal (this_obj_p);\n    }\n\n    prop_p = ecma_find_named_property (this_obj_p, prop_name_p);\n    ecma_object_t *method_p = ecma_get_object_from_value (method);\n\n    if (kind == ECMA_PRIVATE_METHOD)\n    {\n      if (prop_p != NULL)\n      {\n        return ecma_raise_type_error (ECMA_ERR_CANNOT_DECLARE_SAME_PRIVATE_FIELD_TWICE);\n      }\n\n      ecma_property_value_t *prop_value_p =\n        ecma_create_named_data_property (this_obj_p, prop_name_p, ECMA_PROPERTY_FIXED, NULL);\n      prop_value_p->value = method;\n      continue;\n    }\n\n    if (prop_p == NULL)\n    {\n      ecma_object_t *getter_p = (kind == ECMA_PRIVATE_GETTER) ? method_p : NULL;\n      ecma_object_t *setter_p = (kind == ECMA_PRIVATE_SETTER) ? method_p : NULL;\n      ecma_create_named_accessor_property (this_obj_p, prop_name_p, getter_p, setter_p, ECMA_PROPERTY_FIXED, NULL);\n      continue;\n    }\n\n    ecma_property_value_t *accessor_objs_p = ECMA_PROPERTY_VALUE_PTR (prop_p);\n    ecma_getter_setter_pointers_t *get_set_pair_p = ecma_get_named_accessor_property (accessor_objs_p);\n\n    if (kind == ECMA_PRIVATE_GETTER)\n    {\n      ECMA_SET_POINTER (get_set_pair_p->getter_cp, method_p);\n    }\n    else\n    {\n      JERRY_ASSERT (kind == ECMA_PRIVATE_SETTER);\n      ECMA_SET_POINTER (get_set_pair_p->setter_cp, method_p);\n    }\n  }\n\n  return ECMA_VALUE_UNDEFINED;\n} /* opfunc_private_method_or_accessor_add */\n\n/**\n * DefineField abstract operation.\n *\n * See also: ECMAScript v12, 7.3.32.\n *\n * @return ECMA_VALUE_ERROR - operation fails\n *         ECMA_VALUE_{TRUE/FALSE} - otherwise\n */\necma_value_t\nopfunc_define_field (ecma_value_t base, /**< base */\n                     ecma_value_t property, /**< property */\n                     ecma_value_t value) /**< value */\n{\n  ecma_string_t *property_key_p = ecma_op_to_property_key (property);\n\n  JERRY_ASSERT (property_key_p != NULL);\n  ecma_object_t *obj_p = ecma_get_object_from_value (base);\n  ecma_property_descriptor_t desc = ecma_make_empty_property_descriptor ();\n  desc.value = value;\n  desc.flags = (JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE\n                | JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_CONFIGURABLE_DEFINED\n                | JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_SHOULD_THROW);\n\n  ecma_value_t result = ecma_op_object_define_own_property (obj_p, property_key_p, &desc);\n  ecma_deref_ecma_string (property_key_p);\n\n  return result;\n} /* opfunc_define_field */\n\n/**\n * Initialize class fields.\n *\n * @return ECMA_VALUE_ERROR - initialization fails\n *         ECMA_VALUE_UNDEFINED - otherwise\n */\necma_value_t\nopfunc_init_class_fields (ecma_object_t *class_object_p, /**< the function itself */\n                          ecma_value_t this_val) /**< this_arg of the function */\n{\n  JERRY_ASSERT (ecma_is_value_object (this_val));\n  ecma_object_t *this_obj_p = ecma_get_object_from_value (this_val);\n\n  ecma_value_t result = opfunc_private_method_or_accessor_add (class_object_p, this_obj_p, 0);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  ecma_string_t *name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_INIT);\n  ecma_property_t *property_p = ecma_find_named_property (class_object_p, name_p);\n\n  if (property_p == NULL)\n  {\n    return ECMA_VALUE_UNDEFINED;\n  }\n\n  vm_frame_ctx_shared_class_fields_t shared_class_fields;\n  shared_class_fields.header.status_flags = VM_FRAME_CTX_SHARED_HAS_CLASS_FIELDS;\n  shared_class_fields.computed_class_fields_p = NULL;\n\n  name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_COMPUTED);\n  ecma_property_t *class_field_property_p = ecma_find_named_property (class_object_p, name_p);\n\n  if (class_field_property_p != NULL)\n  {\n    ecma_value_t value = ECMA_PROPERTY_VALUE_PTR (class_field_property_p)->value;\n    shared_class_fields.computed_class_fields_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, value);\n  }\n\n  ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n  JERRY_ASSERT (ecma_op_is_callable (property_value_p->value));\n\n  ecma_extended_object_t *ext_function_p;\n  ext_function_p = (ecma_extended_object_t *) ecma_get_object_from_value (property_value_p->value);\n  shared_class_fields.header.bytecode_header_p = ecma_op_function_get_compiled_code (ext_function_p);\n  shared_class_fields.header.function_object_p = &ext_function_p->object;\n\n  ecma_object_t *scope_p =\n    ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_function_p->u.function.scope_cp);\n\n  result = vm_run (&shared_class_fields.header, this_val, scope_p);\n\n  JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result) || result == ECMA_VALUE_UNDEFINED);\n  return result;\n} /* opfunc_init_class_fields */\n\n/**\n * Initialize static class fields.\n *\n * @return ECMA_VALUE_ERROR - initialization fails\n *         ECMA_VALUE_UNDEFINED - otherwise\n */\necma_value_t\nopfunc_init_static_class_fields (ecma_value_t function_object, /**< the function itself */\n                                 ecma_value_t this_val) /**< this_arg of the function */\n{\n  JERRY_ASSERT (ecma_op_is_callable (function_object));\n  JERRY_ASSERT (ecma_is_value_object (this_val));\n\n  ecma_string_t *name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_COMPUTED);\n  ecma_object_t *function_object_p = ecma_get_object_from_value (function_object);\n  ecma_property_t *class_field_property_p = ecma_find_named_property (function_object_p, name_p);\n\n  vm_frame_ctx_shared_class_fields_t shared_class_fields;\n  shared_class_fields.header.function_object_p = function_object_p;\n  shared_class_fields.header.status_flags = VM_FRAME_CTX_SHARED_HAS_CLASS_FIELDS;\n  shared_class_fields.computed_class_fields_p = NULL;\n\n  if (class_field_property_p != NULL)\n  {\n    ecma_value_t value = ECMA_PROPERTY_VALUE_PTR (class_field_property_p)->value;\n    shared_class_fields.computed_class_fields_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, value);\n  }\n\n  ecma_extended_object_t *ext_function_p = (ecma_extended_object_t *) function_object_p;\n  shared_class_fields.header.bytecode_header_p = ecma_op_function_get_compiled_code (ext_function_p);\n\n  ecma_object_t *scope_p =\n    ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_function_p->u.function.scope_cp);\n\n  ecma_value_t result = vm_run (&shared_class_fields.header, this_val, scope_p);\n\n  JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result) || result == ECMA_VALUE_UNDEFINED);\n  return result;\n} /* opfunc_init_static_class_fields */\n\n/**\n * Add the name of a computed field to a name list\n *\n * @return ECMA_VALUE_ERROR - name is not a valid property name\n *         ECMA_VALUE_UNDEFINED - otherwise\n */\necma_value_t\nopfunc_add_computed_field (ecma_value_t class_object, /**< class object */\n                           ecma_value_t name) /**< name of the property */\n{\n  ecma_string_t *prop_name_p = ecma_op_to_property_key (name);\n\n  if (JERRY_UNLIKELY (prop_name_p == NULL))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  if (ecma_prop_name_is_symbol (prop_name_p))\n  {\n    name = ecma_make_symbol_value (prop_name_p);\n  }\n  else\n  {\n    name = ecma_make_string_value (prop_name_p);\n  }\n\n  ecma_string_t *name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_COMPUTED);\n  ecma_object_t *class_object_p = ecma_get_object_from_value (class_object);\n\n  ecma_property_t *property_p = ecma_find_named_property (class_object_p, name_p);\n  ecma_value_t *compact_collection_p;\n  ecma_property_value_t *property_value_p;\n\n  if (property_p == NULL)\n  {\n    ECMA_CREATE_INTERNAL_PROPERTY (class_object_p, name_p, property_p, property_value_p);\n    compact_collection_p = ecma_new_compact_collection ();\n  }\n  else\n  {\n    property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n    compact_collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, property_value_p->value);\n  }\n\n  compact_collection_p = ecma_compact_collection_push_back (compact_collection_p, name);\n  ECMA_SET_INTERNAL_VALUE_POINTER (property_value_p->value, compact_collection_p);\n  return ECMA_VALUE_UNDEFINED;\n} /* opfunc_add_computed_field */\n\n/**\n * Create implicit class constructor\n *\n * See also: ECMAScript v6, 14.5.14\n *\n * @return - new external function ecma-object\n */\necma_value_t\nopfunc_create_implicit_class_constructor (uint8_t opcode, /**< current cbc opcode */\n                                          const ecma_compiled_code_t *bytecode_p) /**< current byte code */\n{\n  /* 8. */\n  ecma_value_t script_value = ((cbc_uint8_arguments_t *) bytecode_p)->script_value;\n  cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n\n  if (JERRY_UNLIKELY (script_p->refs_and_type >= CBC_SCRIPT_REF_MAX))\n  {\n    jerry_fatal (JERRY_FATAL_REF_COUNT_LIMIT);\n  }\n\n  ecma_object_t *function_object_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE),\n                                                         sizeof (ecma_extended_object_t),\n                                                         ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION);\n\n  ecma_extended_object_t *constructor_object_p = (ecma_extended_object_t *) function_object_p;\n\n  script_p->refs_and_type += CBC_SCRIPT_REF_ONE;\n  constructor_object_p->u.constructor_function.script_value = script_value;\n  constructor_object_p->u.constructor_function.flags = 0;\n\n  /* 10.a.i */\n  if (opcode == CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR_HERITAGE)\n  {\n    constructor_object_p->u.constructor_function.flags |= ECMA_CONSTRUCTOR_FUNCTION_HAS_HERITAGE;\n  }\n\n  ecma_property_value_t *prop_value_p;\n  prop_value_p = ecma_create_named_data_property (function_object_p,\n                                                  ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH),\n                                                  ECMA_PROPERTY_FLAG_CONFIGURABLE,\n                                                  NULL);\n  prop_value_p->value = ecma_make_uint32_value (0);\n\n  return ecma_make_object_value (function_object_p);\n} /* opfunc_create_implicit_class_constructor */\n\n/**\n * Set the [[HomeObject]] attribute of the given functon object\n */\nextern inline void JERRY_ATTR_ALWAYS_INLINE\nopfunc_set_home_object (ecma_object_t *func_p, /**< function object */\n                        ecma_object_t *parent_env_p) /**< parent environment */\n{\n  JERRY_ASSERT (ecma_is_lexical_environment (parent_env_p));\n\n  if (ecma_get_object_type (func_p) == ECMA_OBJECT_TYPE_FUNCTION)\n  {\n    ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) func_p;\n    ECMA_SET_NON_NULL_POINTER_TAG (ext_func_p->u.function.scope_cp,\n                                   parent_env_p,\n                                   JMEM_CP_GET_POINTER_TAG_BITS (ext_func_p->u.function.scope_cp));\n  }\n} /* opfunc_set_home_object */\n\n/**\n * Make private key from descriptor\n *\n * @return pointer to private key\n */\necma_string_t *\nopfunc_make_private_key (ecma_value_t descriptor) /**< descriptor */\n{\n  ecma_string_t *private_key_p = ecma_new_symbol_from_descriptor_string (descriptor);\n  private_key_p->u.hash |= ECMA_SYMBOL_FLAG_PRIVATE_KEY;\n\n  return (ecma_string_t *) private_key_p;\n} /* opfunc_make_private_key */\n\n/**\n * Find a private property in the private elements internal property given the key\n *\n * @return pointer to the private property - if it is found,\n *         NULL - othervise\n */\nstatic ecma_property_t *\nopfunc_find_private_key (ecma_object_t *class_object_p, /**< class environment */\n                         ecma_object_t *obj_p, /**< object */\n                         ecma_string_t *search_key_p, /**< key */\n                         ecma_string_t **out_private_key_p) /**< [out] private key */\n{\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    return NULL;\n  }\n\n  ecma_string_t *internal_string_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_CLASS_PRIVATE_ELEMENTS);\n  ecma_property_t *prop_p = ecma_find_named_property (class_object_p, internal_string_p);\n\n  if (prop_p == NULL)\n  {\n    return NULL;\n  }\n\n  ecma_value_t *collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, ECMA_PROPERTY_VALUE_PTR (prop_p)->value);\n  ecma_value_t *current_p = collection_p + 1;\n  ecma_value_t *end_p = ecma_compact_collection_end (collection_p);\n\n  while (current_p < end_p)\n  {\n    current_p++; /* skip kind */\n    ecma_string_t *private_key_p = ecma_get_prop_name_from_value (*current_p++);\n    current_p++; /* skip value */\n\n    JERRY_ASSERT (ecma_prop_name_is_symbol (private_key_p));\n\n    ecma_string_t *private_key_desc_p =\n      ecma_get_string_from_value (((ecma_extended_string_t *) private_key_p)->u.symbol_descriptor);\n\n    if (ecma_compare_ecma_strings (private_key_desc_p, search_key_p))\n    {\n      prop_p = ecma_find_named_property (obj_p, private_key_p);\n\n      if (out_private_key_p)\n      {\n        *out_private_key_p = private_key_p;\n      }\n\n      return prop_p;\n    }\n  }\n\n  return NULL;\n} /* opfunc_find_private_key */\n\n/**\n * PrivateElementFind abstact operation\n *\n * See also: ECMAScript v12, 7.3.27\n *\n * @return - ECMA_VALUE_ERROR - if the operation fails\n *           ECMA_VALUE_EMPTY - otherwise\n */\nstatic ecma_property_t *\nopfunc_find_private_element (ecma_object_t *obj_p, /**< object */\n                             ecma_string_t *key_p, /**< key */\n                             ecma_string_t **private_key_p, /**< [out] private key */\n                             bool allow_heritage) /**< heritage flag */\n{\n  JERRY_ASSERT (private_key_p != NULL);\n  JERRY_ASSERT (*private_key_p == NULL);\n  ecma_object_t *lex_env_p = JERRY_CONTEXT (vm_top_context_p)->lex_env_p;\n\n  while (true)\n  {\n    JERRY_ASSERT (lex_env_p != NULL);\n\n    if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_CLASS\n        && (lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_LEXICAL_ENV_HAS_DATA) != 0\n        && !ECMA_LEX_ENV_CLASS_IS_MODULE (lex_env_p))\n    {\n      ecma_object_t *class_object_p = ((ecma_lexical_environment_class_t *) lex_env_p)->object_p;\n\n      ecma_property_t *prop_p = opfunc_find_private_key (class_object_p, obj_p, key_p, private_key_p);\n\n      if (prop_p || *private_key_p != NULL)\n      {\n        /* Found non shadowed property */\n        return prop_p;\n      }\n\n      if (!allow_heritage)\n      {\n        return NULL;\n      }\n    }\n\n    if (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL)\n    {\n      break;\n    }\n\n    lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n  }\n\n  return NULL;\n} /* opfunc_find_private_element */\n\n/**\n * In expression runtime evaluation in case of private identifiers\n *\n * See also: ECMAScript v12, 13.10.1\n *\n * @return - ECMA_VALUE_ERROR - if the operation fails\n *           ECMA_VALUE_TRUE - if the property was found in the base object\n *           ECMA_VALUE_FALSE - otherwise\n */\necma_value_t\nopfunc_private_in (ecma_value_t base, /**< base */\n                   ecma_value_t property) /**< property */\n{\n  if (!ecma_is_value_object (base))\n  {\n    return ecma_raise_type_error (ECMA_ERR_RIGHT_VALUE_OF_IN_MUST_BE_AN_OBJECT);\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (base);\n  ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (property);\n  ecma_string_t *private_key_p = NULL;\n\n  ecma_property_t *prop_p = opfunc_find_private_element (obj_p, prop_name_p, &private_key_p, false);\n\n  return ecma_make_boolean_value (prop_p != NULL);\n} /* opfunc_private_in */\n\n/**\n * PrivateFieldAdd abstact operation\n *\n * See also: ECMAScript v12, 7.3.28\n *\n * @return - ECMA_VALUE_ERROR - if the operation fails\n *           ECMA_VALUE_EMPTY - otherwise\n */\necma_value_t\nopfunc_private_field_add (ecma_value_t base, /**< base object */\n                          ecma_value_t property, /**< property name */\n                          ecma_value_t value) /**< ecma value */\n{\n  ecma_object_t *obj_p = ecma_get_object_from_value (base);\n  ecma_string_t *prop_name_p = ecma_get_string_from_value (property);\n  ecma_string_t *private_key_p = NULL;\n\n  if (ecma_op_object_is_fast_array (obj_p))\n  {\n    ecma_fast_array_convert_to_normal (obj_p);\n  }\n\n  ecma_property_t *prop_p = opfunc_find_private_element (obj_p, prop_name_p, &private_key_p, false);\n\n  if (prop_p != NULL)\n  {\n    return ecma_raise_type_error (ECMA_ERR_CANNOT_DECLARE_SAME_PRIVATE_FIELD_TWICE);\n  }\n\n  ecma_property_value_t *value_p =\n    ecma_create_named_data_property (obj_p, private_key_p, ECMA_PROPERTY_FLAG_WRITABLE, NULL);\n\n  value_p->value = ecma_copy_value_if_not_object (value);\n\n  return ECMA_VALUE_EMPTY;\n} /* opfunc_private_field_add */\n\n/**\n * PrivateSet abstact operation\n *\n * See also: ECMAScript v12, 7.3.31\n *\n * @return - ECMA_VALUE_ERROR - if the operation fails\n *           ECMA_VALUE_EMPTY - otherwise\n */\necma_value_t\nopfunc_private_set (ecma_value_t base, /**< this object */\n                    ecma_value_t property, /**< property name */\n                    ecma_value_t value) /**< ecma value */\n{\n  ecma_value_t base_obj = ecma_op_to_object (base);\n\n  if (ECMA_IS_VALUE_ERROR (base_obj))\n  {\n    return base_obj;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (base_obj);\n  ecma_string_t *prop_name_p = ecma_get_string_from_value (property);\n  ecma_string_t *private_key_p = NULL;\n\n  ecma_property_t *prop_p = opfunc_find_private_element (obj_p, prop_name_p, &private_key_p, true);\n\n  ecma_value_t result;\n\n  if (prop_p == NULL)\n  {\n    result = ecma_raise_type_error (ECMA_ERR_CANNOT_WRITE_PRIVATE_MEMBER_TO_AN_OBJECT_WHOSE_CLASS_DID_NOT_DECLARE_IT);\n  }\n  else if (*prop_p & ECMA_PROPERTY_FLAG_DATA)\n  {\n    JERRY_ASSERT (ecma_prop_name_is_symbol (private_key_p));\n\n    if (private_key_p->u.hash & ECMA_SYMBOL_FLAG_PRIVATE_INSTANCE_METHOD)\n    {\n      result = ecma_raise_type_error (ECMA_ERR_PRIVATE_METHOD_IS_NOT_WRITABLE);\n    }\n    else\n    {\n      ecma_value_assign_value (&ECMA_PROPERTY_VALUE_PTR (prop_p)->value, value);\n      result = ecma_copy_value (value);\n    }\n  }\n  else\n  {\n    ecma_getter_setter_pointers_t *get_set_pair_p = ecma_get_named_accessor_property (ECMA_PROPERTY_VALUE_PTR (prop_p));\n    result = ecma_op_invoke_setter (get_set_pair_p, base, value);\n  }\n\n  ecma_deref_object (obj_p);\n\n  return result;\n} /* opfunc_private_set */\n\n/**\n * PrivateGet abstact operation\n *\n * See also: ECMAScript v12, 7.3.30\n *\n * @return - ECMA_VALUE_ERROR - if the operation fails\n *           private property value - otherwise\n */\necma_value_t\nopfunc_private_get (ecma_value_t base, /**< this object */\n                    ecma_value_t property) /**< property name */\n{\n  ecma_value_t base_obj = ecma_op_to_object (base);\n\n  if (ECMA_IS_VALUE_ERROR (base_obj))\n  {\n    return base_obj;\n  }\n\n  ecma_object_t *obj_p = ecma_get_object_from_value (base_obj);\n  ecma_string_t *prop_name_p = ecma_get_string_from_value (property);\n  ecma_string_t *private_key_p = NULL;\n\n  ecma_property_t *prop_p = opfunc_find_private_element (obj_p, prop_name_p, &private_key_p, true);\n\n  ecma_value_t result;\n\n  if (prop_p == NULL)\n  {\n    result = ecma_raise_type_error (ECMA_ERR_CANNOT_READ_PRIVATE_MEMBER_TO_AN_OBJECT_WHOSE_CLASS_DID_NOT_DECLARE_IT);\n  }\n  else if (*prop_p & ECMA_PROPERTY_FLAG_DATA)\n  {\n    result = ecma_copy_value (ECMA_PROPERTY_VALUE_PTR (prop_p)->value);\n  }\n  else\n  {\n    ecma_getter_setter_pointers_t *get_set_pair_p = ecma_get_named_accessor_property (ECMA_PROPERTY_VALUE_PTR (prop_p));\n\n    if (get_set_pair_p->getter_cp == JMEM_CP_NULL)\n    {\n      result = ecma_raise_type_error (ECMA_ERR_PRIVATE_FIELD_WAS_DEFINED_WITHOUT_A_GETTER);\n    }\n    else\n    {\n      result = ecma_op_invoke_getter (get_set_pair_p, base);\n    }\n  }\n\n  ecma_deref_object (obj_p);\n\n  return result;\n} /* opfunc_private_get */\n\n/**\n * Find the private property in the object who's private key descriptor matches the given key\n *\n * @return pointer to private key\n */\nstatic ecma_string_t *\nopfunc_create_private_key (ecma_value_t *collection_p, /**< collection of private properties */\n                           ecma_value_t search_key, /**< key */\n                           ecma_private_property_kind_t search_kind) /**< kind of the property */\n{\n  if (search_kind < ECMA_PRIVATE_GETTER)\n  {\n    return opfunc_make_private_key (search_key);\n  }\n\n  ecma_string_t *search_key_p = ecma_get_string_from_value (search_key);\n\n  ecma_value_t *current_p = collection_p + 1;\n  ecma_value_t *end_p = ecma_compact_collection_end (collection_p);\n\n  while (current_p < end_p)\n  {\n    ecma_private_property_kind_t kind = ECMA_PRIVATE_PROPERTY_KIND (*current_p++);\n    ecma_string_t *private_key_p = ecma_get_prop_name_from_value (*current_p++);\n    current_p++; /* skip value */\n\n    if (kind < ECMA_PRIVATE_GETTER)\n    {\n      continue;\n    }\n\n    JERRY_ASSERT (ecma_prop_name_is_symbol (private_key_p));\n\n    ecma_string_t *private_key_desc_p =\n      ecma_get_string_from_value (((ecma_extended_string_t *) private_key_p)->u.symbol_descriptor);\n\n    if (ecma_compare_ecma_strings (private_key_desc_p, search_key_p))\n    {\n      ecma_deref_ecma_string (search_key_p);\n      ecma_ref_ecma_string (private_key_p);\n      return private_key_p;\n    }\n  }\n\n  return opfunc_make_private_key (search_key);\n} /* opfunc_create_private_key */\n\n/**\n * Collect private members for PrivateMethodOrAccessorAdd and PrivateFieldAdd abstract operations\n */\nvoid\nopfunc_collect_private_properties (ecma_value_t constructor, /**< constructor */\n                                   ecma_value_t prop_name, /**< property name */\n                                   ecma_value_t value, /**< value */\n                                   uint8_t opcode) /**< opcode */\n{\n  ecma_private_property_kind_t kind = ECMA_PRIVATE_FIELD;\n  bool is_static = false;\n\n  if (opcode >= CBC_EXT_COLLECT_PRIVATE_STATIC_FIELD)\n  {\n    opcode = (uint8_t) (opcode - PARSER_STATIC_PRIVATE_TO_PRIVATE_OFFSET);\n    is_static = true;\n  }\n\n  if (opcode == CBC_EXT_COLLECT_PRIVATE_METHOD)\n  {\n    prop_name ^= value;\n    value ^= prop_name;\n    prop_name ^= value;\n    kind = ECMA_PRIVATE_METHOD;\n  }\n  else if (opcode == CBC_EXT_COLLECT_PRIVATE_GETTER)\n  {\n    kind = ECMA_PRIVATE_GETTER;\n  }\n  else if (opcode == CBC_EXT_COLLECT_PRIVATE_SETTER)\n  {\n    kind = ECMA_PRIVATE_SETTER;\n  }\n\n  JERRY_ASSERT (ecma_is_value_object (constructor));\n  JERRY_ASSERT (ecma_is_value_string (prop_name));\n  JERRY_ASSERT (ecma_is_value_object (value) || ecma_is_value_undefined (value));\n\n  ecma_object_t *constructor_p = ecma_get_object_from_value (constructor);\n  ecma_string_t *internal_string_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_CLASS_PRIVATE_ELEMENTS);\n  ecma_property_t *prop_p = ecma_find_named_property (constructor_p, internal_string_p);\n  ecma_value_t *collection_p;\n  ecma_property_value_t *prop_value_p;\n\n  if (prop_p == NULL)\n  {\n    collection_p = ecma_new_compact_collection ();\n    ECMA_CREATE_INTERNAL_PROPERTY (constructor_p, internal_string_p, prop_p, prop_value_p);\n    ECMA_SET_INTERNAL_VALUE_POINTER (prop_value_p->value, collection_p);\n  }\n  else\n  {\n    prop_value_p = ECMA_PROPERTY_VALUE_PTR (prop_p);\n    collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, prop_value_p->value);\n  }\n\n  ecma_string_t *key_p = opfunc_create_private_key (collection_p, prop_name, kind);\n\n  if (kind != ECMA_PRIVATE_FIELD)\n  {\n    key_p->u.hash |= ECMA_SYMBOL_FLAG_PRIVATE_INSTANCE_METHOD;\n  }\n\n  if (is_static)\n  {\n    kind |= ECMA_PRIVATE_PROPERTY_STATIC_FLAG;\n  }\n\n  collection_p = ecma_compact_collection_push_back (collection_p, (ecma_value_t) kind);\n  collection_p = ecma_compact_collection_push_back (collection_p, ecma_make_symbol_value (key_p));\n  collection_p = ecma_compact_collection_push_back (collection_p, value);\n\n#ifndef JERRY_NDEBUG\n  ecma_value_t *end_p = ecma_compact_collection_end (collection_p);\n  ecma_value_t *current_p = collection_p + 1;\n\n  JERRY_ASSERT ((end_p - current_p) % ECMA_PRIVATE_ELEMENT_LIST_SIZE == 0);\n#endif /* !defined (JERRY_NDEBUG) */\n\n  ECMA_SET_INTERNAL_VALUE_POINTER (prop_value_p->value, collection_p);\n\n  ecma_free_value (value);\n} /* opfunc_collect_private_properties */\n\n/**\n * ClassDefinitionEvaluation environment initialization part\n *\n * See also: ECMAScript v6, 14.5.14\n */\nvoid\nopfunc_push_class_environment (vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                               ecma_value_t **vm_stack_top, /**< VM stack top */\n                               ecma_value_t class_name) /**< class name */\n{\n  JERRY_ASSERT (ecma_is_value_string (class_name));\n  ecma_object_t *class_env_p = ecma_create_decl_lex_env (frame_ctx_p->lex_env_p);\n\n  /* 4.a */\n  ecma_property_value_t *property_value_p;\n  property_value_p = ecma_create_named_data_property (class_env_p,\n                                                      ecma_get_string_from_value (class_name),\n                                                      ECMA_PROPERTY_FLAG_ENUMERABLE,\n                                                      NULL);\n\n  property_value_p->value = ECMA_VALUE_UNINITIALIZED;\n  frame_ctx_p->lex_env_p = class_env_p;\n\n  *(*vm_stack_top)++ = ECMA_VALUE_RELEASE_LEX_ENV;\n} /* opfunc_push_class_environment */\n\n/**\n * ClassDefinitionEvaluation object initialization part\n *\n * See also: ECMAScript v6, 14.5.14\n *\n * @return - ECMA_VALUE_ERROR - if the operation fails\n *           ECMA_VALUE_EMPTY - otherwise\n */\necma_value_t\nopfunc_init_class (vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                   ecma_value_t *stack_top_p) /**< stack top */\n{\n  /* 5.b, 6.e.ii */\n  ecma_object_t *ctor_parent_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);\n  ecma_object_t *proto_parent_p = NULL;\n  bool free_proto_parent = false;\n\n  ecma_value_t super_class = stack_top_p[-2];\n  ecma_object_t *ctor_p = ecma_get_object_from_value (stack_top_p[-1]);\n\n  bool heritage_present = !ecma_is_value_array_hole (super_class);\n\n  /* 5. ClassHeritage opt is not present */\n  if (!heritage_present)\n  {\n    /* 5.a */\n    proto_parent_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n  }\n  else if (!ecma_is_value_null (super_class))\n  {\n    /* 6.f, 6.g.i */\n    if (!ecma_is_constructor (super_class))\n    {\n      return ecma_raise_type_error (ECMA_ERR_CLASS_EXTENDS_NOT_CONSTRUCTOR);\n    }\n\n    ecma_object_t *parent_p = ecma_get_object_from_value (super_class);\n\n    /* 6.g.ii */\n    ecma_value_t proto_parent = ecma_op_object_get_by_magic_id (parent_p, LIT_MAGIC_STRING_PROTOTYPE);\n\n    /* 6.g.iii */\n    if (ECMA_IS_VALUE_ERROR (proto_parent))\n    {\n      return proto_parent;\n    }\n\n    /* 6.g.iv */\n    if (ecma_is_value_object (proto_parent))\n    {\n      proto_parent_p = ecma_get_object_from_value (proto_parent);\n      free_proto_parent = true;\n    }\n    else if (ecma_is_value_null (proto_parent))\n    {\n      proto_parent_p = NULL;\n    }\n    else\n    {\n      ecma_free_value (proto_parent);\n      return ecma_raise_type_error (ECMA_ERR_PROPERTY_PROTOTYPE_IS_NOT_AN_OBJECT);\n    }\n\n    /* 6.g.v */\n    ctor_parent_p = parent_p;\n  }\n\n  /* 7. */\n  ecma_object_t *proto_p = ecma_create_object (proto_parent_p, 0, ECMA_OBJECT_TYPE_GENERAL);\n  ecma_value_t proto = ecma_make_object_value (proto_p);\n\n  ECMA_SET_POINTER (ctor_p->u2.prototype_cp, ctor_parent_p);\n\n  if (free_proto_parent)\n  {\n    ecma_deref_object (proto_parent_p);\n  }\n  ecma_free_value (super_class);\n\n  /* 16. */\n  ecma_property_value_t *property_value_p;\n  property_value_p = ecma_create_named_data_property (ctor_p,\n                                                      ecma_get_magic_string (LIT_MAGIC_STRING_PROTOTYPE),\n                                                      ECMA_PROPERTY_FIXED,\n                                                      NULL);\n  property_value_p->value = proto;\n\n  /* 18. */\n  property_value_p = ecma_create_named_data_property (proto_p,\n                                                      ecma_get_magic_string (LIT_MAGIC_STRING_CONSTRUCTOR),\n                                                      ECMA_PROPERTY_CONFIGURABLE_WRITABLE,\n                                                      NULL);\n  property_value_p->value = ecma_make_object_value (ctor_p);\n\n  if (ecma_get_object_type (ctor_p) == ECMA_OBJECT_TYPE_FUNCTION)\n  {\n    opfunc_bind_class_environment (frame_ctx_p->lex_env_p, proto_p, ctor_p, ctor_p);\n\n    /* 15. set F’s [[ConstructorKind]] internal slot to \"derived\". */\n    if (heritage_present)\n    {\n      ECMA_SET_THIRD_BIT_TO_POINTER_TAG (((ecma_extended_object_t *) ctor_p)->u.function.scope_cp);\n    }\n  }\n\n  stack_top_p[-2] = stack_top_p[-1];\n  stack_top_p[-1] = proto;\n\n  return ECMA_VALUE_EMPTY;\n} /* opfunc_init_class */\n\n/**\n * Creates a new class lexical environment and binds the bound object and the class's object\n *\n * @return newly created class lexical environment - if func_obj_p is not present\n *         NULL - otherwise, also the environment is set as the func_obj_p's scope\n */\necma_object_t *\nopfunc_bind_class_environment (ecma_object_t *lex_env_p, /**< lexical environment */\n                               ecma_object_t *home_object_p, /**< bound object */\n                               ecma_object_t *ctor_p, /**< constructor object */\n                               ecma_object_t *func_obj_p) /**< function object */\n{\n  ecma_object_t *proto_env_p = ecma_create_lex_env_class (lex_env_p, sizeof (ecma_lexical_environment_class_t));\n  ECMA_SET_NON_NULL_POINTER (proto_env_p->u1.bound_object_cp, home_object_p);\n  ((ecma_lexical_environment_class_t *) proto_env_p)->object_p = ctor_p;\n  ((ecma_lexical_environment_class_t *) proto_env_p)->type = ECMA_LEX_ENV_CLASS_TYPE_CLASS_ENV;\n\n  if (func_obj_p)\n  {\n    JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION);\n    ECMA_SET_NON_NULL_POINTER_TAG (((ecma_extended_object_t *) func_obj_p)->u.function.scope_cp, proto_env_p, 0);\n    ecma_deref_object (proto_env_p);\n    return NULL;\n  }\n\n  return proto_env_p;\n} /* opfunc_bind_class_environment */\n\n/**\n * Set [[Enumerable]] and [[HomeObject]] attributes for all class method\n */\nstatic void\nopfunc_set_class_attributes (ecma_object_t *obj_p, /**< object */\n                             ecma_object_t *parent_env_p) /**< parent environment */\n{\n  jmem_cpointer_t prop_iter_cp = obj_p->u1.property_list_cp;\n\n#if JERRY_PROPERTY_HASHMAP\n  if (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)\n    {\n      prop_iter_cp = prop_iter_p->next_property_cp;\n    }\n  }\n#endif /* JERRY_PROPERTY_HASHMAP */\n\n  while (prop_iter_cp != JMEM_CP_NULL)\n  {\n    ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);\n    JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));\n\n    ecma_property_pair_t *property_pair_p = (ecma_property_pair_t *) prop_iter_p;\n\n    for (uint32_t index = 0; index < ECMA_PROPERTY_PAIR_ITEM_COUNT; index++)\n    {\n      uint8_t property = property_pair_p->header.types[index];\n\n      if (!ECMA_PROPERTY_IS_RAW (property))\n      {\n        JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_DELETED\n                      || (ECMA_PROPERTY_IS_INTERNAL (property)\n                          && LIT_INTERNAL_MAGIC_STRING_IGNORED (property_pair_p->names_cp[index])));\n        continue;\n      }\n\n      if (property & ECMA_PROPERTY_FLAG_DATA)\n      {\n        if (ecma_is_value_object (property_pair_p->values[index].value) && ecma_is_property_enumerable (property))\n        {\n          property_pair_p->header.types[index] = (uint8_t) (property & ~ECMA_PROPERTY_FLAG_ENUMERABLE);\n          opfunc_set_home_object (ecma_get_object_from_value (property_pair_p->values[index].value), parent_env_p);\n        }\n        continue;\n      }\n\n      property_pair_p->header.types[index] = (uint8_t) (property & ~ECMA_PROPERTY_FLAG_ENUMERABLE);\n      ecma_property_value_t *accessor_objs_p = property_pair_p->values + index;\n\n      ecma_getter_setter_pointers_t *get_set_pair_p = ecma_get_named_accessor_property (accessor_objs_p);\n\n      if (get_set_pair_p->getter_cp != JMEM_CP_NULL)\n      {\n        opfunc_set_home_object (ECMA_GET_NON_NULL_POINTER (ecma_object_t, get_set_pair_p->getter_cp), parent_env_p);\n      }\n\n      if (get_set_pair_p->setter_cp != JMEM_CP_NULL)\n      {\n        opfunc_set_home_object (ECMA_GET_NON_NULL_POINTER (ecma_object_t, get_set_pair_p->setter_cp), parent_env_p);\n      }\n    }\n\n    prop_iter_cp = prop_iter_p->next_property_cp;\n  }\n} /* opfunc_set_class_attributes */\n\n/**\n * Set [[HomeObject]] attributes for all class private elements\n */\nstatic void\nopfunc_set_private_instance_method_attributes (ecma_object_t *class_object_p, /**< class constructor  */\n                                               ecma_object_t *parent_env_p) /**< parent environment */\n{\n  ecma_string_t *internal_string_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_CLASS_PRIVATE_ELEMENTS);\n  ecma_property_t *prop_p = ecma_find_named_property (class_object_p, internal_string_p);\n\n  if (prop_p == NULL)\n  {\n    return;\n  }\n\n  ecma_value_t *collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, ECMA_PROPERTY_VALUE_PTR (prop_p)->value);\n  ecma_value_t *current_p = collection_p + 1;\n  ecma_value_t *end_p = ecma_compact_collection_end (collection_p);\n\n  while (current_p < end_p)\n  {\n    current_p += 2; /* skip kind, name */\n    ecma_value_t value = *current_p++;\n\n    if (!ecma_is_value_undefined (value))\n    {\n      opfunc_set_home_object (ecma_get_object_from_value (value), parent_env_p);\n    }\n  }\n} /* opfunc_set_private_instance_method_attributes */\n\n/**\n * Pop the current lexical environment referenced by the frame context\n */\nvoid\nopfunc_pop_lexical_environment (vm_frame_ctx_t *frame_ctx_p) /**< frame context */\n{\n  ecma_object_t *outer_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, frame_ctx_p->lex_env_p->u2.outer_reference_cp);\n  ecma_deref_object (frame_ctx_p->lex_env_p);\n  frame_ctx_p->lex_env_p = outer_env_p;\n} /* opfunc_pop_lexical_environment */\n\n/**\n * ClassDefinitionEvaluation finalization part\n *\n * See also: ECMAScript v6, 14.5.14\n */\nvoid\nopfunc_finalize_class (vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                       ecma_value_t **vm_stack_top_p, /**< current vm stack top */\n                       ecma_value_t class_name) /**< class name */\n{\n  JERRY_ASSERT (ecma_is_value_undefined (class_name) || ecma_is_value_string (class_name));\n  ecma_value_t *stack_top_p = *vm_stack_top_p;\n\n  ecma_object_t *ctor_p = ecma_get_object_from_value (stack_top_p[-2]);\n  ecma_object_t *proto_p = ecma_get_object_from_value (stack_top_p[-1]);\n\n  ecma_object_t *class_env_p = frame_ctx_p->lex_env_p;\n\n  /* 23.a */\n  if (!ecma_is_value_undefined (class_name))\n  {\n    ecma_op_initialize_binding (class_env_p, ecma_get_string_from_value (class_name), stack_top_p[-2]);\n  }\n\n  ecma_object_t *ctor_env_p = opfunc_bind_class_environment (class_env_p, ctor_p, ctor_p, NULL);\n  ecma_object_t *proto_env_p = opfunc_bind_class_environment (class_env_p, proto_p, ctor_p, NULL);\n\n  opfunc_set_class_attributes (ctor_p, ctor_env_p);\n  opfunc_set_class_attributes (proto_p, proto_env_p);\n  opfunc_set_private_instance_method_attributes (ctor_p, proto_env_p);\n\n  ecma_deref_object (proto_env_p);\n  ecma_deref_object (ctor_env_p);\n  ecma_deref_object (proto_p);\n\n  JERRY_ASSERT ((ecma_is_value_undefined (class_name) ? stack_top_p[-3] == ECMA_VALUE_UNDEFINED\n                                                      : stack_top_p[-3] == ECMA_VALUE_RELEASE_LEX_ENV));\n\n  /* only the current class remains on the stack */\n  if (stack_top_p[-3] == ECMA_VALUE_RELEASE_LEX_ENV)\n  {\n    opfunc_pop_lexical_environment (frame_ctx_p);\n  }\n\n  ecma_value_t result = opfunc_private_method_or_accessor_add (ctor_p, ctor_p, ECMA_PRIVATE_PROPERTY_STATIC_FLAG);\n  JERRY_ASSERT (ecma_is_value_undefined (result));\n\n  stack_top_p[-3] = stack_top_p[-2];\n  *vm_stack_top_p -= 2;\n} /* opfunc_finalize_class */\n\n/**\n * MakeSuperPropertyReference operation\n *\n * See also: ECMAScript v6, 12.3.5.3\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_EMPTY - otherwise\n */\necma_value_t\nopfunc_form_super_reference (ecma_value_t **vm_stack_top_p, /**< current vm stack top */\n                             vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                             ecma_value_t prop_name, /**< property name to resolve */\n                             uint8_t opcode) /**< current cbc opcode */\n{\n  ecma_environment_record_t *environment_record_p = ecma_op_get_environment_record (frame_ctx_p->lex_env_p);\n\n  if (environment_record_p && !ecma_op_this_binding_is_initialized (environment_record_p))\n  {\n    return ecma_raise_reference_error (ECMA_ERR_CALL_SUPER_CONSTRUCTOR_DERIVED_CLASS_BEFORE_THIS);\n  }\n\n  ecma_value_t parent = ecma_op_resolve_super_base (frame_ctx_p->lex_env_p);\n\n  if (ECMA_IS_VALUE_ERROR (parent))\n  {\n    return ecma_raise_type_error (ECMA_ERR_INVOKE_NULLABLE_SUPER_METHOD);\n  }\n\n  if (!ecma_op_require_object_coercible (parent))\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t *stack_top_p = *vm_stack_top_p;\n\n  if (opcode >= CBC_EXT_SUPER_PROP_ASSIGNMENT_REFERENCE)\n  {\n    JERRY_ASSERT (opcode == CBC_EXT_SUPER_PROP_ASSIGNMENT_REFERENCE\n                  || opcode == CBC_EXT_SUPER_PROP_LITERAL_ASSIGNMENT_REFERENCE);\n    *stack_top_p++ = parent;\n    *stack_top_p++ = ecma_copy_value (prop_name);\n    *vm_stack_top_p = stack_top_p;\n\n    return ECMA_VALUE_EMPTY;\n  }\n\n  ecma_object_t *parent_p = ecma_get_object_from_value (parent);\n  ecma_string_t *prop_name_p = ecma_op_to_property_key (prop_name);\n\n  if (prop_name_p == NULL)\n  {\n    ecma_deref_object (parent_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t result = ecma_op_object_get_with_receiver (parent_p, prop_name_p, frame_ctx_p->this_binding);\n  ecma_deref_ecma_string (prop_name_p);\n  ecma_deref_object (parent_p);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  if (opcode == CBC_EXT_SUPER_PROP_LITERAL_REFERENCE || opcode == CBC_EXT_SUPER_PROP_REFERENCE)\n  {\n    *stack_top_p++ = ecma_copy_value (frame_ctx_p->this_binding);\n    *stack_top_p++ = ECMA_VALUE_UNDEFINED;\n  }\n\n  *stack_top_p++ = result;\n  *vm_stack_top_p = stack_top_p;\n\n  return ECMA_VALUE_EMPTY;\n} /* opfunc_form_super_reference */\n\n/**\n * Assignment operation for SuperRefence base\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_EMPTY - otherwise\n */\necma_value_t\nopfunc_assign_super_reference (ecma_value_t **vm_stack_top_p, /**< vm stack top */\n                               vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                               uint32_t opcode_data) /**< opcode data to store the result */\n{\n  ecma_value_t *stack_top_p = *vm_stack_top_p;\n\n  ecma_value_t base_obj = ecma_op_to_object (stack_top_p[-3]);\n\n  if (ECMA_IS_VALUE_ERROR (base_obj))\n  {\n    return base_obj;\n  }\n\n  ecma_object_t *base_obj_p = ecma_get_object_from_value (base_obj);\n  ecma_string_t *prop_name_p = ecma_op_to_property_key (stack_top_p[-2]);\n\n  if (prop_name_p == NULL)\n  {\n    ecma_deref_object (base_obj_p);\n    return ECMA_VALUE_ERROR;\n  }\n\n  bool is_strict = (frame_ctx_p->status_flags & VM_FRAME_CTX_IS_STRICT) != 0;\n\n  ecma_value_t result =\n    ecma_op_object_put_with_receiver (base_obj_p, prop_name_p, stack_top_p[-1], frame_ctx_p->this_binding, is_strict);\n\n  ecma_deref_ecma_string (prop_name_p);\n  ecma_deref_object (base_obj_p);\n\n  if (ECMA_IS_VALUE_ERROR (result))\n  {\n    return result;\n  }\n\n  for (int32_t i = 1; i <= 3; i++)\n  {\n    ecma_free_value (stack_top_p[-i]);\n  }\n\n  stack_top_p -= 3;\n\n  if (opcode_data & VM_OC_PUT_STACK)\n  {\n    *stack_top_p++ = result;\n  }\n  else if (opcode_data & VM_OC_PUT_BLOCK)\n  {\n    ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p, 0));\n    VM_GET_REGISTERS (frame_ctx_p)[0] = result;\n  }\n\n  *vm_stack_top_p = stack_top_p;\n\n  return result;\n} /* opfunc_assign_super_reference */\n\n/**\n * Copy data properties of an object\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_EMPTY - otherwise\n */\necma_value_t\nopfunc_copy_data_properties (ecma_value_t target_object, /**< target object */\n                             ecma_value_t source_object, /**< source object */\n                             ecma_value_t filter_array) /**< filter array */\n{\n  bool source_to_object = false;\n\n  if (!ecma_is_value_object (source_object))\n  {\n    source_object = ecma_op_to_object (source_object);\n\n    if (ECMA_IS_VALUE_ERROR (source_object))\n    {\n      return source_object;\n    }\n\n    source_to_object = true;\n  }\n\n  ecma_object_t *source_object_p = ecma_get_object_from_value (source_object);\n  ecma_collection_t *names_p = ecma_op_object_own_property_keys (source_object_p, JERRY_PROPERTY_FILTER_ALL);\n\n#if JERRY_BUILTIN_PROXY\n  if (names_p == NULL)\n  {\n    JERRY_ASSERT (!source_to_object);\n    return ECMA_VALUE_ERROR;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_object_t *target_object_p = ecma_get_object_from_value (target_object);\n  ecma_value_t *buffer_p = names_p->buffer_p;\n  ecma_value_t *buffer_end_p = buffer_p + names_p->item_count;\n  ecma_value_t *filter_start_p = NULL;\n  ecma_value_t *filter_end_p = NULL;\n  ecma_value_t result = ECMA_VALUE_EMPTY;\n\n  if (filter_array != ECMA_VALUE_UNDEFINED)\n  {\n    ecma_object_t *filter_array_p = ecma_get_object_from_value (filter_array);\n\n    JERRY_ASSERT (ecma_get_object_type (filter_array_p) == ECMA_OBJECT_TYPE_ARRAY);\n    JERRY_ASSERT (ecma_op_object_is_fast_array (filter_array_p));\n\n    if (filter_array_p->u1.property_list_cp != JMEM_CP_NULL)\n    {\n      filter_start_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, filter_array_p->u1.property_list_cp);\n      filter_end_p = filter_start_p + ((ecma_extended_object_t *) filter_array_p)->u.array.length;\n    }\n  }\n\n  while (buffer_p < buffer_end_p)\n  {\n    ecma_string_t *property_name_p = ecma_get_prop_name_from_value (*buffer_p++);\n\n    if (filter_start_p != NULL)\n    {\n      ecma_value_t *filter_p = filter_start_p;\n\n      do\n      {\n        if (ecma_compare_ecma_strings (property_name_p, ecma_get_prop_name_from_value (*filter_p)))\n        {\n          break;\n        }\n      } while (++filter_p < filter_end_p);\n\n      if (filter_p != filter_end_p)\n      {\n        continue;\n      }\n    }\n\n    ecma_property_descriptor_t descriptor;\n    result = ecma_op_object_get_own_property_descriptor (source_object_p, property_name_p, &descriptor);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      break;\n    }\n\n    if (result == ECMA_VALUE_FALSE)\n    {\n      continue;\n    }\n\n    if (!(descriptor.flags & JERRY_PROP_IS_ENUMERABLE))\n    {\n      ecma_free_property_descriptor (&descriptor);\n      continue;\n    }\n\n    if ((descriptor.flags & JERRY_PROP_IS_VALUE_DEFINED) && !ECMA_OBJECT_IS_PROXY (source_object_p))\n    {\n      result = descriptor.value;\n    }\n    else\n    {\n      ecma_free_property_descriptor (&descriptor);\n\n      result = ecma_op_object_get (source_object_p, property_name_p);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        break;\n      }\n    }\n\n    opfunc_set_data_property (target_object_p, property_name_p, result);\n    ecma_free_value (result);\n\n    result = ECMA_VALUE_EMPTY;\n  }\n\n  if (JERRY_UNLIKELY (source_to_object))\n  {\n    ecma_deref_object (source_object_p);\n  }\n\n  ecma_collection_free (names_p);\n  return result;\n} /* opfunc_copy_data_properties */\n\n/**\n * Check whether the current lexical scope has restricted binding declaration with the given name\n *\n * Steps are include ES11: 8.1.1.4.14 HasRestrictedGlobalProperty abstract operation\n *\n * @return ECMA_VALUE_ERROR - if the operation fails\n *         ECMA_VALUE_TRUE - if it has restricted property binding\n *         ECMA_VALUE_FALSE - otherwise\n */\necma_value_t\nopfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                                             ecma_string_t *name_p) /**< binding name */\n{\n  JERRY_ASSERT (ecma_get_lex_env_type (frame_ctx_p->lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);\n\n#if JERRY_BUILTIN_REALMS\n  JERRY_ASSERT (frame_ctx_p->this_binding == JERRY_CONTEXT (global_object_p)->this_binding);\n#else /* !JERRY_BUILTIN_REALMS */\n  JERRY_ASSERT (frame_ctx_p->this_binding == ecma_builtin_get_global ());\n#endif /* JERRY_BUILTIN_REALMS */\n\n  ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;\n  ecma_property_t *binding_p = ecma_find_named_property (lex_env_p, name_p);\n\n  if (binding_p != NULL)\n  {\n    return ECMA_VALUE_TRUE;\n  }\n\n#if JERRY_BUILTIN_REALMS\n  ecma_object_t *const global_scope_p = ecma_get_global_scope ((ecma_object_t *) JERRY_CONTEXT (global_object_p));\n#else /* !JERRY_BUILTIN_REALMS */\n  ecma_object_t *const global_scope_p = ecma_get_global_scope (global_obj_p);\n#endif /* JERRY_BUILTIN_REALMS */\n\n  if (global_scope_p != lex_env_p)\n  {\n    return ECMA_VALUE_FALSE;\n  }\n\n  ecma_object_t *global_obj_p = ecma_get_object_from_value (frame_ctx_p->this_binding);\n\n#if JERRY_BUILTIN_PROXY\n  if (ECMA_OBJECT_IS_PROXY (global_obj_p))\n  {\n    ecma_property_descriptor_t prop_desc;\n    ecma_value_t status = ecma_proxy_object_get_own_property_descriptor (global_obj_p, name_p, &prop_desc);\n\n    if (ecma_is_value_true (status))\n    {\n      status = ecma_make_boolean_value ((prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE) == 0);\n      ecma_free_property_descriptor (&prop_desc);\n    }\n\n    return status;\n  }\n#endif /* JERRY_BUILTIN_PROXY */\n\n  ecma_property_t property = ecma_op_object_get_own_property (global_obj_p, name_p, NULL, ECMA_PROPERTY_GET_NO_OPTIONS);\n\n  JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND || ECMA_PROPERTY_IS_FOUND (property));\n\n  return ecma_make_boolean_value (property != ECMA_PROPERTY_TYPE_NOT_FOUND\n                                  && !ecma_is_property_configurable (property));\n} /* opfunc_lexical_scope_has_restricted_binding */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/vm/opcodes.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef OPCODES_H\n#define OPCODES_H\n\n#include \"ecma-globals.h\"\n\n#include \"vm-defines.h\"\n\n/** \\addtogroup vm Virtual machine\n * @{\n *\n * \\addtogroup vm_opcodes Opcodes\n * @{\n */\n\n/**\n * Number arithmetic operations.\n */\ntypedef enum\n{\n  NUMBER_ARITHMETIC_SUBTRACTION, /**< subtraction */\n  NUMBER_ARITHMETIC_MULTIPLICATION, /**< multiplication */\n  NUMBER_ARITHMETIC_DIVISION, /**< division */\n  NUMBER_ARITHMETIC_REMAINDER, /**< remainder calculation */\n  NUMBER_ARITHMETIC_EXPONENTIATION, /**< exponentiation */\n} number_arithmetic_op;\n\n/**\n * Number bitwise logic operations.\n */\ntypedef enum\n{\n  NUMBER_BITWISE_LOGIC_AND, /**< bitwise AND calculation */\n  NUMBER_BITWISE_LOGIC_OR, /**< bitwise OR calculation */\n  NUMBER_BITWISE_LOGIC_XOR, /**< bitwise XOR calculation */\n  NUMBER_BITWISE_SHIFT_LEFT, /**< bitwise LEFT SHIFT calculation */\n  NUMBER_BITWISE_SHIFT_RIGHT, /**< bitwise RIGHT_SHIFT calculation */\n  NUMBER_BITWISE_SHIFT_URIGHT, /**< bitwise UNSIGNED RIGHT SHIFT calculation */\n} number_bitwise_logic_op;\n\n/**\n * Types for opfunc_create_executable_object.\n */\ntypedef enum\n{\n  VM_CREATE_EXECUTABLE_OBJECT_GENERATOR, /**< create a generator function */\n  VM_CREATE_EXECUTABLE_OBJECT_ASYNC, /**< create an async function */\n} vm_create_executable_object_type_t;\n\n/**\n * The stack contains spread object during the upcoming APPEND_ARRAY operation\n */\n#define OPFUNC_HAS_SPREAD_ELEMENT (1 << 8)\n\necma_value_t opfunc_equality (ecma_value_t left_value, ecma_value_t right_value);\n\necma_value_t do_number_arithmetic (number_arithmetic_op op, ecma_value_t left_value, ecma_value_t right_value);\n\necma_value_t opfunc_unary_operation (ecma_value_t left_value, bool is_plus);\n\necma_value_t do_number_bitwise_logic (number_bitwise_logic_op op, ecma_value_t left_value, ecma_value_t right_value);\n\necma_value_t do_number_bitwise_not (ecma_value_t value);\n\necma_value_t opfunc_addition (ecma_value_t left_value, ecma_value_t right_value);\n\necma_value_t opfunc_relation (ecma_value_t left_value, ecma_value_t right_value, bool left_first, bool is_invert);\n\necma_value_t opfunc_in (ecma_value_t left_value, ecma_value_t right_value);\n\necma_value_t opfunc_instanceof (ecma_value_t left_value, ecma_value_t right_value);\n\necma_value_t opfunc_typeof (ecma_value_t left_value);\n\nvoid opfunc_set_data_property (ecma_object_t *object_p, ecma_string_t *prop_name_p, ecma_value_t value);\n\nvoid opfunc_set_accessor (bool is_getter, ecma_value_t object, ecma_string_t *accessor_name_p, ecma_value_t accessor);\n\necma_value_t vm_op_delete_prop (ecma_value_t object, ecma_value_t property, bool is_strict);\n\necma_value_t vm_op_delete_var (ecma_value_t name_literal, ecma_object_t *lex_env_p);\n\necma_collection_t *opfunc_for_in (ecma_value_t left_value, ecma_value_t *result_obj_p);\n\necma_collection_t *opfunc_spread_arguments (ecma_value_t *stack_top_p, uint8_t argument_list_len);\n\necma_value_t opfunc_append_array (ecma_value_t *stack_top_p, uint16_t values_length);\n\nvm_executable_object_t *opfunc_create_executable_object (vm_frame_ctx_t *frame_ctx_p,\n                                                         vm_create_executable_object_type_t type);\n\nextern const uint8_t opfunc_resume_executable_object_with_throw[];\nextern const uint8_t opfunc_resume_executable_object_with_return[];\n\necma_value_t opfunc_resume_executable_object (vm_executable_object_t *executable_object_p, ecma_value_t value);\n\nvoid opfunc_async_generator_yield (ecma_extended_object_t *async_generator_object_p, ecma_value_t value);\n\necma_value_t opfunc_async_create_and_await (vm_frame_ctx_t *frame_ctx_p, ecma_value_t value, uint16_t extra_flags);\n\necma_value_t opfunc_init_class_fields (ecma_object_t *class_object_p, ecma_value_t this_val);\n\necma_value_t opfunc_init_static_class_fields (ecma_value_t function_object, ecma_value_t this_val);\n\necma_value_t opfunc_add_computed_field (ecma_value_t class_object, ecma_value_t name);\n\necma_value_t opfunc_create_implicit_class_constructor (uint8_t opcode, const ecma_compiled_code_t *bytecode_p);\n\nvoid opfunc_set_home_object (ecma_object_t *func_p, ecma_object_t *parent_env_p);\n\necma_value_t opfunc_define_field (ecma_value_t base, ecma_value_t property, ecma_value_t value);\n\necma_string_t *opfunc_make_private_key (ecma_value_t descriptor);\n\necma_value_t opfunc_private_in (ecma_value_t base, ecma_value_t property);\n\necma_value_t opfunc_private_field_add (ecma_value_t base, ecma_value_t property, ecma_value_t value);\n\necma_value_t opfunc_private_set (ecma_value_t base, ecma_value_t property, ecma_value_t value);\n\necma_value_t opfunc_private_get (ecma_value_t base, ecma_value_t property);\n\nvoid opfunc_collect_private_properties (ecma_value_t constructor,\n                                        ecma_value_t prop_name,\n                                        ecma_value_t method,\n                                        uint8_t opcode);\n\nvoid opfunc_push_class_environment (vm_frame_ctx_t *frame_ctx_p, ecma_value_t **vm_stack_top, ecma_value_t class_name);\n\necma_value_t opfunc_init_class (vm_frame_ctx_t *frame_context_p, ecma_value_t *stack_top_p);\n\necma_object_t *opfunc_bind_class_environment (ecma_object_t *lex_env_p,\n                                              ecma_object_t *home_object_p,\n                                              ecma_object_t *ctor_p,\n                                              ecma_object_t *func_obj_p);\n\nvoid opfunc_pop_lexical_environment (vm_frame_ctx_t *frame_ctx_p);\n\nvoid opfunc_finalize_class (vm_frame_ctx_t *frame_ctx_p, ecma_value_t **vm_stack_top_p, ecma_value_t class_name);\n\necma_value_t opfunc_form_super_reference (ecma_value_t **vm_stack_top_p,\n                                          vm_frame_ctx_t *frame_ctx_p,\n                                          ecma_value_t prop_name,\n                                          uint8_t opcode);\n\necma_value_t\nopfunc_assign_super_reference (ecma_value_t **vm_stack_top_p, vm_frame_ctx_t *frame_ctx_p, uint32_t opcode_data);\n\necma_value_t\nopfunc_copy_data_properties (ecma_value_t target_object, ecma_value_t source_object, ecma_value_t filter_array);\n\necma_value_t opfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *vm_frame_ctx_p, ecma_string_t *name_p);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !OPCODES_H */\n"
  },
  {
    "path": "jerry-core/vm/vm-defines.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n#ifndef VM_DEFINES_H\n#define VM_DEFINES_H\n\n#include \"ecma-globals.h\"\n\n#include \"byte-code.h\"\n\n/** \\addtogroup vm Virtual machine\n * @{\n *\n * \\addtogroup vm_executor Executor\n * @{\n */\n\n/**\n * Helper for += on uint16_t values.\n */\n#define VM_PLUS_EQUAL_U16(base, value) (base) = (uint16_t) ((base) + (value))\n\n/**\n * Helper for -= on uint16_t values.\n */\n#define VM_MINUS_EQUAL_U16(base, value) (base) = (uint16_t) ((base) - (value))\n\n/**\n * Flag bits of vm_frame_ctx_shared_t\n */\ntypedef enum\n{\n  VM_FRAME_CTX_SHARED_HAS_ARG_LIST = (1 << 0), /**< has argument list */\n  VM_FRAME_CTX_SHARED_DIRECT_EVAL = (1 << 1), /**< direct eval call */\n  VM_FRAME_CTX_SHARED_FREE_THIS = (1 << 2), /**< free this binding */\n  VM_FRAME_CTX_SHARED_FREE_LOCAL_ENV = (1 << 3), /**< free local environment */\n  VM_FRAME_CTX_SHARED_NON_ARROW_FUNC = (1 << 4), /**< non-arrow function */\n  VM_FRAME_CTX_SHARED_HERITAGE_PRESENT = (1 << 5), /**< class heritage present */\n  VM_FRAME_CTX_SHARED_HAS_CLASS_FIELDS = (1 << 6), /**< has class fields */\n  VM_FRAME_CTX_SHARED_EXECUTABLE = (1 << 7), /**< frame is an executable object constructed\n                                              *   with opfunc_create_executable_object */\n} vm_frame_ctx_shared_flags_t;\n\n/**\n * Shared data between the interpreter and the caller\n */\ntypedef struct\n{\n  const ecma_compiled_code_t *bytecode_header_p; /**< currently executed byte-code data */\n  ecma_object_t *function_object_p; /**< function obj */\n  uint32_t status_flags; /**< combination of vm_frame_ctx_shared_flags_t bits */\n} vm_frame_ctx_shared_t;\n\n/**\n * Shared data extended with arguments\n */\ntypedef struct\n{\n  vm_frame_ctx_shared_t header; /**< shared data header */\n  const ecma_value_t *arg_list_p; /**< arguments list */\n  uint32_t arg_list_len; /**< arguments list length */\n} vm_frame_ctx_shared_args_t;\n\n/**\n * Shared data extended with computed class fields\n */\ntypedef struct\n{\n  vm_frame_ctx_shared_t header; /**< shared data header */\n  ecma_value_t *computed_class_fields_p; /**< names of the computed class fields */\n} vm_frame_ctx_shared_class_fields_t;\n\n/**\n * Get the computed class field\n */\n#define VM_GET_COMPUTED_CLASS_FIELDS(frame_ctx_p) \\\n  (((vm_frame_ctx_shared_class_fields_t *) ((frame_ctx_p)->shared_p))->computed_class_fields_p)\n\n/**\n * Flag bits of vm_frame_ctx_t\n */\ntypedef enum\n{\n  VM_FRAME_CTX_DIRECT_EVAL = (1 << 1), /**< direct eval call */\n  VM_FRAME_CTX_IS_STRICT = (1 << 2), /**< strict mode */\n} vm_frame_ctx_flags_t;\n\n/**\n * Context of interpreter, related to a JS stack frame\n */\ntypedef struct vm_frame_ctx_t\n{\n  vm_frame_ctx_shared_t *shared_p; /**< shared information */\n  const uint8_t *byte_code_p; /**< current byte code pointer */\n  const uint8_t *byte_code_start_p; /**< byte code start pointer */\n  ecma_value_t *stack_top_p; /**< stack top pointer */\n  ecma_value_t *literal_start_p; /**< literal list start pointer */\n  ecma_object_t *lex_env_p; /**< current lexical environment */\n  struct vm_frame_ctx_t *prev_context_p; /**< previous context */\n  ecma_value_t this_binding; /**< this binding */\n  uint16_t context_depth; /**< current context depth */\n  uint8_t status_flags; /**< combination of vm_frame_ctx_flags_t bits */\n  uint8_t call_operation; /**< perform a call or construct operation */\n  /* Registers start immediately after the frame context. */\n} vm_frame_ctx_t;\n\n/**\n * Get register list corresponding to the frame context.\n */\n#define VM_GET_REGISTERS(frame_ctx_p) ((ecma_value_t *) ((frame_ctx_p) + 1))\n\n/**\n * Read or write a specific register.\n */\n#define VM_GET_REGISTER(frame_ctx_p, i) (((ecma_value_t *) ((frame_ctx_p) + 1))[i])\n\n/**\n * Calculate the executable object from a vm_executable_object frame context.\n */\n#define VM_GET_EXECUTABLE_OBJECT(frame_ctx_p) \\\n  ((ecma_extended_object_t *) ((uintptr_t) (frame_ctx_p) - (uintptr_t) offsetof (vm_executable_object_t, frame_ctx)))\n\n/**\n * Calculate the shared_part from a vm_executable_object frame context.\n */\n#define VM_GET_EXECUTABLE_ITERATOR(frame_ctx_p)                                                           \\\n  ((ecma_value_t *) ((uintptr_t) (frame_ctx_p) - (uintptr_t) offsetof (vm_executable_object_t, frame_ctx) \\\n                     + (uintptr_t) offsetof (vm_executable_object_t, iterator)))\n\n/**\n * Generator frame context.\n */\ntypedef struct\n{\n  ecma_extended_object_t extended_object; /**< extended object part */\n  vm_frame_ctx_shared_t shared; /**< shared part */\n  ecma_value_t iterator; /**< executable object's iterator */\n  vm_frame_ctx_t frame_ctx; /**< frame context part */\n} vm_executable_object_t;\n\n/**\n * Real backtrace frame data passed to the jerry_backtrace_cb_t handler.\n */\nstruct jerry_frame_internal_t\n{\n  vm_frame_ctx_t *context_p; /**< context pointer */\n  uint8_t frame_type; /**< frame type */\n  jerry_frame_location_t location; /**< location information */\n  ecma_value_t function; /**< function reference */\n  ecma_value_t this_binding; /**< this binding passed to the function */\n};\n\n/**\n * @}\n * @}\n */\n\n#endif /* !VM_DEFINES_H */\n"
  },
  {
    "path": "jerry-core/vm/vm-stack.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"vm-stack.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-promise-object.h\"\n\n#include \"jcontext.h\"\n#include \"vm-defines.h\"\n\n/** \\addtogroup vm Virtual machine\n * @{\n *\n * \\addtogroup stack VM stack\n * @{\n */\n\nJERRY_STATIC_ASSERT (PARSER_WITH_CONTEXT_STACK_ALLOCATION == PARSER_BLOCK_CONTEXT_STACK_ALLOCATION,\n                     with_context_stack_allocation_must_be_equal_to_block_context_stack_allocation);\n\nJERRY_STATIC_ASSERT (PARSER_WITH_CONTEXT_STACK_ALLOCATION == PARSER_TRY_CONTEXT_STACK_ALLOCATION,\n                     with_context_stack_allocation_must_be_equal_to_block_context_stack_allocation);\n\nJERRY_STATIC_ASSERT (PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION == PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION,\n                     for_of_context_stack_allocation_must_be_equal_to_for_await_of_context_stack_allocation);\n\n/**\n * Abort (finalize) the current variable length stack context, and remove it.\n *\n * @return new stack top\n */\necma_value_t *\nvm_stack_context_abort_variable_length (vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                                        ecma_value_t *vm_stack_top_p, /**< current stack top */\n                                        uint32_t context_stack_allocation) /**< 0 - if all context element\n                                                                            *       should be released\n                                                                            *   context stack allocation - otherwise */\n{\n  JERRY_ASSERT (VM_CONTEXT_IS_VARIABLE_LENGTH (VM_GET_CONTEXT_TYPE (vm_stack_top_p[-1])));\n\n  uint32_t context_size = VM_GET_CONTEXT_END (vm_stack_top_p[-1]);\n  VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, context_size);\n\n  JERRY_ASSERT (context_size > 0);\n  --vm_stack_top_p;\n\n  if (context_stack_allocation == 0)\n  {\n    context_stack_allocation = context_size;\n  }\n\n  for (uint32_t i = 1; i < context_stack_allocation; i++)\n  {\n    ecma_free_value (*(--vm_stack_top_p));\n  }\n\n  return vm_stack_top_p;\n} /* vm_stack_context_abort_variable_length */\n\n/**\n * Abort (finalize) the current stack context, and remove it.\n *\n * @return new stack top\n */\necma_value_t *\nvm_stack_context_abort (vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                        ecma_value_t *vm_stack_top_p) /**< current stack top */\n{\n  ecma_value_t context_info = vm_stack_top_p[-1];\n\n  if (context_info & VM_CONTEXT_HAS_LEX_ENV)\n  {\n    ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;\n    JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);\n    frame_ctx_p->lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n    ecma_deref_object (lex_env_p);\n  }\n\n  switch (VM_GET_CONTEXT_TYPE (context_info))\n  {\n    case VM_CONTEXT_FINALLY_THROW:\n    case VM_CONTEXT_FINALLY_RETURN:\n    {\n      ecma_free_value (vm_stack_top_p[-2]);\n      /* FALLTHRU */\n    }\n    case VM_CONTEXT_FINALLY_JUMP:\n    {\n      VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FINALLY_CONTEXT_STACK_ALLOCATION);\n      vm_stack_top_p -= PARSER_FINALLY_CONTEXT_STACK_ALLOCATION;\n      break;\n    }\n    case VM_CONTEXT_TRY:\n    case VM_CONTEXT_CATCH:\n    case VM_CONTEXT_BLOCK:\n    case VM_CONTEXT_WITH:\n    {\n      VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_WITH_CONTEXT_STACK_ALLOCATION);\n      vm_stack_top_p -= PARSER_WITH_CONTEXT_STACK_ALLOCATION;\n      break;\n    }\n    case VM_CONTEXT_ITERATOR:\n    case VM_CONTEXT_OBJ_INIT:\n    case VM_CONTEXT_OBJ_INIT_REST:\n    {\n      vm_stack_top_p = vm_stack_context_abort_variable_length (frame_ctx_p, vm_stack_top_p, 0);\n      break;\n    }\n    case VM_CONTEXT_FOR_OF:\n    case VM_CONTEXT_FOR_AWAIT_OF:\n    {\n      ecma_free_value (vm_stack_top_p[-2]);\n      ecma_free_value (vm_stack_top_p[-3]);\n      ecma_free_value (vm_stack_top_p[-4]);\n\n      VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION);\n      vm_stack_top_p -= PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION;\n      break;\n    }\n    default:\n    {\n      JERRY_ASSERT (VM_GET_CONTEXT_TYPE (vm_stack_top_p[-1]) == VM_CONTEXT_FOR_IN);\n\n      ecma_collection_t *collection_p;\n      collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, vm_stack_top_p[-2]);\n\n      ecma_value_t *buffer_p = collection_p->buffer_p;\n\n      for (uint32_t index = vm_stack_top_p[-3]; index < collection_p->item_count; index++)\n      {\n        ecma_free_value (buffer_p[index]);\n      }\n\n      ecma_collection_destroy (collection_p);\n\n      ecma_free_value (vm_stack_top_p[-4]);\n\n      VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION);\n      vm_stack_top_p -= PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION;\n      break;\n    }\n  }\n\n  return vm_stack_top_p;\n} /* vm_stack_context_abort */\n\n/**\n * Decode branch offset.\n *\n * @return branch offset\n */\nstatic uint32_t\nvm_decode_branch_offset (const uint8_t *branch_offset_p, /**< start offset of byte code */\n                         uint32_t length) /**< length of the branch */\n{\n  uint32_t branch_offset = *branch_offset_p;\n\n  JERRY_ASSERT (length >= 1 && length <= 3);\n\n  switch (length)\n  {\n    case 3:\n    {\n      branch_offset <<= 8;\n      branch_offset |= *(++branch_offset_p);\n      /* FALLTHRU */\n    }\n    case 2:\n    {\n      branch_offset <<= 8;\n      branch_offset |= *(++branch_offset_p);\n      break;\n    }\n  }\n\n  return branch_offset;\n} /* vm_decode_branch_offset */\n\n/**\n * Byte code which resumes an executable object with throw\n */\nstatic const uint8_t vm_stack_resume_executable_object_with_context_end[1] = { CBC_CONTEXT_END };\n\n/**\n * Find a finally up to the end position.\n *\n * @return value specified in vm_stack_found_type\n */\nvm_stack_found_type\nvm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                       ecma_value_t *stack_top_p, /**< current stack top */\n                       vm_stack_context_type_t finally_type, /**< searching this finally */\n                       uint32_t search_limit) /**< search up-to this byte code */\n{\n  JERRY_ASSERT (finally_type <= VM_CONTEXT_FINALLY_RETURN);\n\n  if (finally_type != VM_CONTEXT_FINALLY_JUMP)\n  {\n    search_limit = 0xffffffffu;\n  }\n\n  while (frame_ctx_p->context_depth > 0)\n  {\n    vm_stack_context_type_t context_type = VM_GET_CONTEXT_TYPE (stack_top_p[-1]);\n    uint32_t context_end = VM_GET_CONTEXT_END (stack_top_p[-1]);\n    JERRY_ASSERT (!VM_CONTEXT_IS_VARIABLE_LENGTH (context_type) || finally_type != VM_CONTEXT_FINALLY_JUMP);\n\n    if (!VM_CONTEXT_IS_VARIABLE_LENGTH (context_type) && search_limit < context_end)\n    {\n      frame_ctx_p->stack_top_p = stack_top_p;\n      return VM_CONTEXT_FOUND_EXPECTED;\n    }\n\n    if (context_type == VM_CONTEXT_TRY || context_type == VM_CONTEXT_CATCH)\n    {\n      const uint8_t *byte_code_p;\n      uint32_t branch_offset_length;\n      uint32_t branch_offset;\n\n      if (search_limit == context_end)\n      {\n        frame_ctx_p->stack_top_p = stack_top_p;\n        return VM_CONTEXT_FOUND_EXPECTED;\n      }\n\n      if (stack_top_p[-1] & VM_CONTEXT_HAS_LEX_ENV)\n      {\n        ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;\n        JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);\n        frame_ctx_p->lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n        ecma_deref_object (lex_env_p);\n      }\n\n      byte_code_p = frame_ctx_p->byte_code_start_p + context_end;\n\n      if (context_type == VM_CONTEXT_TRY)\n      {\n        JERRY_ASSERT (byte_code_p[0] == CBC_EXT_OPCODE);\n\n        if (byte_code_p[1] >= CBC_EXT_CATCH && byte_code_p[1] <= CBC_EXT_CATCH_3)\n        {\n          branch_offset_length = CBC_BRANCH_OFFSET_LENGTH (byte_code_p[1]);\n          branch_offset = vm_decode_branch_offset (byte_code_p + 2, branch_offset_length);\n\n          if (finally_type == VM_CONTEXT_FINALLY_THROW)\n          {\n            branch_offset += (uint32_t) (byte_code_p - frame_ctx_p->byte_code_start_p);\n\n            stack_top_p[-1] = VM_CREATE_CONTEXT (VM_CONTEXT_CATCH, branch_offset);\n\n            byte_code_p += 2 + branch_offset_length;\n            frame_ctx_p->byte_code_p = byte_code_p;\n            frame_ctx_p->stack_top_p = stack_top_p;\n            return VM_CONTEXT_FOUND_FINALLY;\n          }\n\n          byte_code_p += branch_offset;\n\n          if (*byte_code_p == CBC_CONTEXT_END)\n          {\n            VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);\n            stack_top_p -= PARSER_TRY_CONTEXT_STACK_ALLOCATION;\n            continue;\n          }\n        }\n      }\n      else\n      {\n        JERRY_ASSERT (context_type == VM_CONTEXT_CATCH);\n\n        if (byte_code_p[0] == CBC_CONTEXT_END)\n        {\n          VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);\n          stack_top_p -= PARSER_TRY_CONTEXT_STACK_ALLOCATION;\n          continue;\n        }\n      }\n\n      JERRY_ASSERT (byte_code_p[0] == CBC_EXT_OPCODE);\n\n      VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION);\n      stack_top_p += PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION;\n\n      if (JERRY_UNLIKELY (byte_code_p[1] == CBC_EXT_ASYNC_EXIT))\n      {\n        branch_offset = (uint32_t) (byte_code_p - frame_ctx_p->byte_code_start_p);\n        stack_top_p[-1] = VM_CREATE_CONTEXT ((uint32_t) finally_type, branch_offset);\n\n        frame_ctx_p->byte_code_p = byte_code_p;\n        frame_ctx_p->stack_top_p = stack_top_p;\n        return VM_CONTEXT_FOUND_FINALLY;\n      }\n\n      JERRY_ASSERT (byte_code_p[1] >= CBC_EXT_FINALLY && byte_code_p[1] <= CBC_EXT_FINALLY_3);\n\n      branch_offset_length = CBC_BRANCH_OFFSET_LENGTH (byte_code_p[1]);\n      branch_offset = vm_decode_branch_offset (byte_code_p + 2, branch_offset_length);\n\n      branch_offset += (uint32_t) (byte_code_p - frame_ctx_p->byte_code_start_p);\n\n      stack_top_p[-1] = VM_CREATE_CONTEXT ((uint32_t) finally_type, branch_offset);\n\n      byte_code_p += 2 + branch_offset_length;\n      frame_ctx_p->byte_code_p = byte_code_p;\n      frame_ctx_p->stack_top_p = stack_top_p;\n      return VM_CONTEXT_FOUND_FINALLY;\n    }\n    else if (stack_top_p[-1] & VM_CONTEXT_CLOSE_ITERATOR)\n    {\n      JERRY_ASSERT (context_type == VM_CONTEXT_FOR_OF || context_type == VM_CONTEXT_FOR_AWAIT_OF\n                    || context_type == VM_CONTEXT_ITERATOR);\n      JERRY_ASSERT (finally_type == VM_CONTEXT_FINALLY_THROW || !jcontext_has_pending_exception ());\n\n      ecma_value_t exception = ECMA_VALUE_UNDEFINED;\n      if (finally_type == VM_CONTEXT_FINALLY_THROW)\n      {\n        exception = jcontext_take_exception ();\n      }\n\n      ecma_value_t result;\n\n      if (context_type == VM_CONTEXT_ITERATOR)\n      {\n        result = ecma_op_iterator_close (stack_top_p[-2]);\n      }\n      else\n      {\n        ecma_value_t iterator = stack_top_p[-3];\n        result = ecma_op_get_method_by_magic_id (iterator, LIT_MAGIC_STRING_RETURN);\n\n        if (!ECMA_IS_VALUE_ERROR (result) && !ecma_is_value_undefined (result))\n        {\n          ecma_object_t *return_obj_p = ecma_get_object_from_value (result);\n          result = ecma_op_function_validated_call (result, iterator, NULL, 0);\n          ecma_deref_object (return_obj_p);\n\n          if (context_type == VM_CONTEXT_FOR_AWAIT_OF && !ECMA_IS_VALUE_ERROR (result))\n          {\n            ecma_extended_object_t *async_generator_object_p = VM_GET_EXECUTABLE_OBJECT (frame_ctx_p);\n\n            result = ecma_promise_async_await (async_generator_object_p, result);\n\n            if (!ECMA_IS_VALUE_ERROR (result))\n            {\n              uint16_t extra_flags =\n                (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD | (ECMA_AWAIT_FOR_CLOSE << ECMA_AWAIT_STATE_SHIFT));\n              async_generator_object_p->u.cls.u2.executable_obj_flags |= extra_flags;\n\n              stack_top_p = vm_stack_context_abort (frame_ctx_p, stack_top_p);\n\n              VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FINALLY_CONTEXT_STACK_ALLOCATION);\n              stack_top_p += PARSER_FINALLY_CONTEXT_STACK_ALLOCATION;\n\n              stack_top_p[-1] = VM_CREATE_CONTEXT ((uint32_t) finally_type, context_end);\n              if (finally_type == VM_CONTEXT_FINALLY_THROW)\n              {\n                stack_top_p[-2] = exception;\n              }\n\n              frame_ctx_p->call_operation = VM_EXEC_RETURN;\n              frame_ctx_p->byte_code_p = vm_stack_resume_executable_object_with_context_end;\n              frame_ctx_p->stack_top_p = stack_top_p;\n              return VM_CONTEXT_FOUND_AWAIT;\n            }\n          }\n\n          if (!ECMA_IS_VALUE_ERROR (result))\n          {\n            bool is_object = ecma_is_value_object (result);\n\n            ecma_free_value (result);\n            result = ECMA_VALUE_UNDEFINED;\n\n            if (!is_object)\n            {\n              result = ecma_raise_type_error (ECMA_ERR_ITERATOR_RETURN_RESULT_IS_NOT_OBJECT);\n            }\n          }\n        }\n      }\n\n      JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result) || result == ECMA_VALUE_UNDEFINED);\n\n      if (ECMA_IS_VALUE_ERROR (result))\n      {\n        if (finally_type != VM_CONTEXT_FINALLY_THROW)\n        {\n          frame_ctx_p->stack_top_p = vm_stack_context_abort (frame_ctx_p, stack_top_p);\n          return VM_CONTEXT_FOUND_ERROR;\n        }\n\n        ecma_free_value (jcontext_take_exception ());\n        jcontext_raise_exception (exception);\n      }\n      else if (finally_type == VM_CONTEXT_FINALLY_THROW)\n      {\n        jcontext_raise_exception (exception);\n      }\n    }\n\n    stack_top_p = vm_stack_context_abort (frame_ctx_p, stack_top_p);\n  }\n\n  frame_ctx_p->stack_top_p = stack_top_p;\n  return VM_CONTEXT_FOUND_EXPECTED;\n} /* vm_stack_find_finally */\n\n/**\n * Get the offsets of ecma values corresponding to the passed context.\n *\n * @return array of offsets, last item represents the size of the context item\n */\nuint32_t\nvm_get_context_value_offsets (ecma_value_t *context_item_p) /**< any item of a context */\n{\n  switch (VM_GET_CONTEXT_TYPE (context_item_p[-1]))\n  {\n    case VM_CONTEXT_FINALLY_THROW:\n    case VM_CONTEXT_FINALLY_RETURN:\n    {\n      return (PARSER_FINALLY_CONTEXT_STACK_ALLOCATION << VM_CONTEXT_OFFSET_SHIFT) | 2;\n    }\n    case VM_CONTEXT_FINALLY_JUMP:\n    {\n      return PARSER_FINALLY_CONTEXT_STACK_ALLOCATION;\n    }\n    case VM_CONTEXT_TRY:\n    case VM_CONTEXT_CATCH:\n    case VM_CONTEXT_BLOCK:\n    case VM_CONTEXT_WITH:\n    {\n      return PARSER_WITH_CONTEXT_STACK_ALLOCATION;\n    }\n    case VM_CONTEXT_FOR_IN:\n    {\n      return (PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION << VM_CONTEXT_OFFSET_SHIFT) | 4;\n    }\n    default:\n    {\n      JERRY_ASSERT (VM_GET_CONTEXT_TYPE (context_item_p[-1]) == VM_CONTEXT_FOR_OF\n                    || VM_GET_CONTEXT_TYPE (context_item_p[-1]) == VM_CONTEXT_FOR_AWAIT_OF);\n\n      return ((PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION << (VM_CONTEXT_OFFSET_SHIFT * 3))\n              | (4 << (VM_CONTEXT_OFFSET_SHIFT * 2)) | (3 << VM_CONTEXT_OFFSET_SHIFT) | 2);\n    }\n  }\n} /* vm_get_context_value_offsets */\n\n/**\n * Ref / deref lexical environments in the chain using the current context.\n */\nvoid\nvm_ref_lex_env_chain (ecma_object_t *lex_env_p, /**< top of lexical environment */\n                      uint16_t context_depth, /**< depth of function context */\n                      ecma_value_t *context_end_p, /**< end of function context */\n                      bool do_ref) /**< ref or deref lexical environments */\n{\n  ecma_value_t *context_top_p = context_end_p + context_depth;\n  JERRY_ASSERT (context_top_p > context_end_p);\n\n  do\n  {\n    if (context_top_p[-1] & VM_CONTEXT_HAS_LEX_ENV)\n    {\n      JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);\n      ecma_object_t *next_lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n\n      if (do_ref)\n      {\n        ecma_ref_object (lex_env_p);\n      }\n      else\n      {\n        ecma_deref_object (lex_env_p);\n      }\n\n      lex_env_p = next_lex_env_p;\n    }\n\n    if (VM_CONTEXT_IS_VARIABLE_LENGTH (VM_GET_CONTEXT_TYPE (context_top_p[-1])))\n    {\n      ecma_value_t *last_item_p = context_top_p - VM_GET_CONTEXT_END (context_top_p[-1]);\n      JERRY_ASSERT (last_item_p >= context_end_p);\n      context_top_p--;\n\n      do\n      {\n        if (do_ref)\n        {\n          ecma_ref_if_object (*(--context_top_p));\n        }\n        else\n        {\n          ecma_deref_if_object (*(--context_top_p));\n        }\n      } while (context_top_p > last_item_p);\n\n      continue;\n    }\n\n    uint32_t offsets = vm_get_context_value_offsets (context_top_p);\n\n    while (VM_CONTEXT_HAS_NEXT_OFFSET (offsets))\n    {\n      int32_t offset = VM_CONTEXT_GET_NEXT_OFFSET (offsets);\n\n      if (do_ref)\n      {\n        ecma_ref_if_object (context_top_p[offset]);\n      }\n      else\n      {\n        ecma_deref_if_object (context_top_p[offset]);\n      }\n\n      offsets >>= VM_CONTEXT_OFFSET_SHIFT;\n    }\n\n    JERRY_ASSERT (context_top_p >= context_end_p + offsets);\n    context_top_p -= offsets;\n  } while (context_top_p > context_end_p);\n} /* vm_ref_lex_env_chain */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/vm/vm-stack.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef VM_STACK_H\n#define VM_STACK_H\n\n#include \"ecma-globals.h\"\n\n#include \"vm-defines.h\"\n\n/** \\addtogroup vm Virtual machine\n * @{\n *\n * \\addtogroup stack VM stack\n * @{\n */\n\n/**\n * Create context on the vm stack.\n */\n#define VM_CREATE_CONTEXT(type, end_offset) ((ecma_value_t) ((type) | ((end_offset) << 7)))\n\n/**\n * Create context on the vm stack with environment.\n */\n#define VM_CREATE_CONTEXT_WITH_ENV(type, end_offset) (VM_CREATE_CONTEXT ((type), (end_offset)) | VM_CONTEXT_HAS_LEX_ENV)\n\n/**\n * Get type of a vm context.\n */\n#define VM_GET_CONTEXT_TYPE(value) ((vm_stack_context_type_t) ((value) &0x1f))\n\n/**\n * Get the end position of a vm context.\n */\n#define VM_GET_CONTEXT_END(value) ((value) >> 7)\n\n/**\n * This flag is set if the context has a lexical environment.\n */\n#define VM_CONTEXT_HAS_LEX_ENV 0x20\n\n/**\n * This flag is set if the iterator close operation should be invoked during a for-of context break.\n */\n#define VM_CONTEXT_CLOSE_ITERATOR 0x40\n\n/**\n * Context types for the vm stack.\n */\ntypedef enum\n{\n  /* Update VM_CONTEXT_IS_FINALLY macro if the following three values are changed. */\n  VM_CONTEXT_FINALLY_JUMP, /**< finally context with a jump */\n  VM_CONTEXT_FINALLY_THROW, /**< finally context with a throw */\n  VM_CONTEXT_FINALLY_RETURN, /**< finally context with a return */\n  VM_CONTEXT_TRY, /**< try context */\n  VM_CONTEXT_CATCH, /**< catch context */\n  VM_CONTEXT_BLOCK, /**< block context */\n  VM_CONTEXT_WITH, /**< with context */\n  VM_CONTEXT_FOR_IN, /**< for-in context */\n  VM_CONTEXT_FOR_OF, /**< for-of context */\n  VM_CONTEXT_FOR_AWAIT_OF, /**< for-await-of context */\n\n  /* contexts with variable length */\n  VM_CONTEXT_ITERATOR, /**< iterator context */\n  VM_CONTEXT_OBJ_INIT, /**< object-initializer context */\n  VM_CONTEXT_OBJ_INIT_REST, /**< object-initializer-rest context */\n} vm_stack_context_type_t;\n\n/**\n * Return types for vm_stack_find_finally.\n */\ntypedef enum\n{\n  VM_CONTEXT_FOUND_FINALLY, /**< found finally */\n  VM_CONTEXT_FOUND_ERROR, /**< found an error */\n  VM_CONTEXT_FOUND_AWAIT, /**< found an await operation */\n  VM_CONTEXT_FOUND_EXPECTED, /**< found the type specified in finally_type */\n} vm_stack_found_type;\n\n/**\n * Checks whether the context has variable context size\n *\n * Layout:\n * - [context descriptor]\n * - [JS values belong to the context]\n * - [previous JS values stored by the VM stack]\n */\n#define VM_CONTEXT_IS_VARIABLE_LENGTH(context_type) ((context_type) >= VM_CONTEXT_ITERATOR)\n\n/**\n * Checks whether the context type is a finally type.\n */\n#define VM_CONTEXT_IS_FINALLY(context_type) ((context_type) <= VM_CONTEXT_FINALLY_RETURN)\n\n/**\n * Shift needs to be applied to get the next item of the offset array.\n */\n#define VM_CONTEXT_OFFSET_SHIFT 4\n\n/**\n * Checks whether an offset is available.\n */\n#define VM_CONTEXT_HAS_NEXT_OFFSET(offsets) ((offsets) >= (1 << VM_CONTEXT_OFFSET_SHIFT))\n\n/**\n * Get the next offset from the offset array.\n */\n#define VM_CONTEXT_GET_NEXT_OFFSET(offsets) (-((int32_t) ((offsets) & ((1 << VM_CONTEXT_OFFSET_SHIFT) - 1))))\n\necma_value_t *vm_stack_context_abort_variable_length (vm_frame_ctx_t *frame_ctx_p,\n                                                      ecma_value_t *vm_stack_top_p,\n                                                      uint32_t context_stack_allocation);\necma_value_t *vm_stack_context_abort (vm_frame_ctx_t *frame_ctx_p, ecma_value_t *vm_stack_top_p);\nvm_stack_found_type vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p,\n                                           ecma_value_t *stack_top_p,\n                                           vm_stack_context_type_t finally_type,\n                                           uint32_t search_limit);\nuint32_t vm_get_context_value_offsets (ecma_value_t *context_item_p);\nvoid vm_ref_lex_env_chain (ecma_object_t *lex_env_p, uint16_t context_depth, ecma_value_t *context_end_p, bool do_ref);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !VM_STACK_H */\n"
  },
  {
    "path": "jerry-core/vm/vm-utils.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-array-object.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-line-info.h\"\n\n#include \"jcontext.h\"\n#include \"lit-char-helpers.h\"\n#include \"vm.h\"\n\n/**\n * Check whether currently executed code is strict mode code\n *\n * @return true - current code is executed in strict mode,\n *         false - otherwise\n */\nbool\nvm_is_strict_mode (void)\n{\n  JERRY_ASSERT (JERRY_CONTEXT (vm_top_context_p) != NULL);\n\n  return JERRY_CONTEXT (vm_top_context_p)->status_flags & VM_FRAME_CTX_IS_STRICT;\n} /* vm_is_strict_mode */\n\n/**\n * Check whether currently performed call (on top of call-stack) is performed in form,\n * meeting conditions of 'Direct Call to Eval' (see also: ECMA-262 v5, 15.1.2.1.1)\n *\n * Warning:\n *         the function should only be called from implementation\n *         of built-in 'eval' routine of Global object\n *\n * @return true - currently performed call is performed through 'eval' identifier,\n *                without 'this' argument,\n *         false - otherwise\n */\nextern inline bool JERRY_ATTR_ALWAYS_INLINE\nvm_is_direct_eval_form_call (void)\n{\n  return (JERRY_CONTEXT (status_flags) & ECMA_STATUS_DIRECT_EVAL) != 0;\n} /* vm_is_direct_eval_form_call */\n\n/**\n * Get backtrace. The backtrace is an array of strings where\n * each string contains the position of the corresponding frame.\n * The array length is zero if the backtrace is not available.\n *\n * @return array ecma value\n */\necma_value_t\nvm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimited */\n{\n#if JERRY_LINE_INFO\n  vm_frame_ctx_t *context_p = JERRY_CONTEXT (vm_top_context_p);\n\n  if (max_depth == 0)\n  {\n    max_depth = UINT32_MAX;\n  }\n\n  ecma_object_t *array_p = ecma_op_new_array_object (0);\n  JERRY_ASSERT (ecma_op_object_is_fast_array (array_p));\n  uint32_t index = 0;\n\n  while (context_p != NULL)\n  {\n    const ecma_compiled_code_t *bytecode_header_p = context_p->shared_p->bytecode_header_p;\n    ecma_value_t source_name = ecma_get_source_name (bytecode_header_p);\n    ecma_string_t *str_p = ecma_get_string_from_value (source_name);\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n\n    if (ecma_string_is_empty (str_p))\n    {\n      ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) \"<unknown>:\", 10);\n    }\n    else\n    {\n      ecma_stringbuilder_append (&builder, str_p);\n      ecma_stringbuilder_append_byte (&builder, LIT_CHAR_COLON);\n    }\n\n    if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO)\n    {\n      jerry_frame_location_t location;\n      ecma_line_info_get (ecma_compiled_code_get_line_info (bytecode_header_p),\n                          (uint32_t) (context_p->byte_code_p - context_p->byte_code_start_p),\n                          &location);\n\n      ecma_string_t *line_str_p = ecma_new_ecma_string_from_uint32 (location.line);\n      ecma_stringbuilder_append (&builder, line_str_p);\n      ecma_deref_ecma_string (line_str_p);\n\n      ecma_stringbuilder_append_byte (&builder, LIT_CHAR_COLON);\n\n      line_str_p = ecma_new_ecma_string_from_uint32 (location.column);\n      ecma_stringbuilder_append (&builder, line_str_p);\n      ecma_deref_ecma_string (line_str_p);\n    }\n    else\n    {\n      ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) \"1:1\", 3);\n    }\n\n    ecma_string_t *builder_str_p = ecma_stringbuilder_finalize (&builder);\n    ecma_fast_array_set_property (array_p, index, ecma_make_string_value (builder_str_p));\n    ecma_deref_ecma_string (builder_str_p);\n\n    context_p = context_p->prev_context_p;\n    index++;\n\n    if (index >= max_depth)\n    {\n      break;\n    }\n  }\n\n  return ecma_make_object_value (array_p);\n#else /* !JERRY_LINE_INFO */\n  JERRY_UNUSED (max_depth);\n\n  return ecma_make_object_value (ecma_op_new_array_object (0));\n#endif /* JERRY_LINE_INFO */\n} /* vm_get_backtrace */\n"
  },
  {
    "path": "jerry-core/vm/vm.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"vm.h\"\n\n#include \"ecma-alloc.h\"\n#include \"ecma-arguments-object.h\"\n#include \"ecma-array-object.h\"\n#include \"ecma-bigint.h\"\n#include \"ecma-builtin-object.h\"\n#include \"ecma-builtins.h\"\n#include \"ecma-comparison.h\"\n#include \"ecma-conversion.h\"\n#include \"ecma-errors.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-function-object.h\"\n#include \"ecma-gc.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-iterator-object.h\"\n#include \"ecma-lcache.h\"\n#include \"ecma-lex-env.h\"\n#include \"ecma-objects-general.h\"\n#include \"ecma-objects.h\"\n#include \"ecma-promise-object.h\"\n#include \"ecma-regexp-object.h\"\n\n#include \"common.h\"\n#include \"jcontext.h\"\n#include \"opcodes.h\"\n#include \"vm-stack.h\"\n\n/** \\addtogroup vm Virtual machine\n * @{\n *\n * \\addtogroup vm_executor Executor\n * @{\n */\n\nJERRY_STATIC_ASSERT ((sizeof (vm_frame_ctx_t) % sizeof (ecma_value_t)) == 0,\n                     sizeof_vm_frame_ctx_must_be_sizeof_ecma_value_t_aligned);\n\n/**\n * Get the value of object[property].\n *\n * @return ecma value\n */\nstatic ecma_value_t\nvm_op_get_value (ecma_value_t object, /**< base object */\n                 ecma_value_t property) /**< property name */\n{\n  if (ecma_is_value_object (object))\n  {\n    ecma_object_t *object_p = ecma_get_object_from_value (object);\n    ecma_string_t *property_name_p = NULL;\n\n    if (ecma_is_value_integer_number (property))\n    {\n      ecma_integer_value_t int_value = ecma_get_integer_from_value (property);\n\n      if (int_value >= 0 && int_value <= ECMA_DIRECT_STRING_MAX_IMM)\n      {\n        if (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_ARRAY)\n        {\n          ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;\n\n          if (JERRY_LIKELY (ecma_op_array_is_fast_array (ext_object_p)\n                            && (uint32_t) int_value < ext_object_p->u.array.length))\n          {\n            ecma_value_t *values_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, object_p->u1.property_list_cp);\n\n            if (JERRY_LIKELY (!ecma_is_value_array_hole (values_p[int_value])))\n            {\n              return ecma_fast_copy_value (values_p[int_value]);\n            }\n          }\n        }\n\n        property_name_p = (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_UINT, (uintptr_t) int_value);\n      }\n    }\n    else if (ecma_is_value_string (property))\n    {\n      property_name_p = ecma_get_string_from_value (property);\n    }\n\n    if (ecma_is_value_symbol (property))\n    {\n      property_name_p = ecma_get_symbol_from_value (property);\n    }\n\n    if (property_name_p != NULL)\n    {\n#if JERRY_LCACHE\n      ecma_property_t *property_p = ecma_lcache_lookup (object_p, property_name_p);\n\n      if (property_p != NULL && (*property_p & ECMA_PROPERTY_FLAG_DATA))\n      {\n        JERRY_ASSERT (!ECMA_PROPERTY_IS_INTERNAL (*property_p));\n        return ecma_fast_copy_value (ECMA_PROPERTY_VALUE_PTR (property_p)->value);\n      }\n#endif /* JERRY_LCACHE */\n\n      /* There is no need to free the name. */\n      return ecma_op_object_get (object_p, property_name_p);\n    }\n  }\n\n  if (JERRY_UNLIKELY (ecma_is_value_undefined (object) || ecma_is_value_null (object)))\n  {\n#if JERRY_ERROR_MESSAGES\n    ecma_value_t error_value =\n      ecma_raise_standard_error_with_format (JERRY_ERROR_TYPE, \"Cannot read property '%' of %\", property, object);\n#else /* !JERRY_ERROR_MESSAGES */\n    ecma_value_t error_value = ecma_raise_type_error (ECMA_ERR_EMPTY);\n#endif /* JERRY_ERROR_MESSAGES */\n    return error_value;\n  }\n\n  ecma_string_t *property_name_p = ecma_op_to_property_key (property);\n\n  if (property_name_p == NULL)\n  {\n    return ECMA_VALUE_ERROR;\n  }\n\n  ecma_value_t get_value_result = ecma_op_get_value_object_base (object, property_name_p);\n\n  ecma_deref_ecma_string (property_name_p);\n  return get_value_result;\n} /* vm_op_get_value */\n\n/**\n * Set the value of object[property].\n *\n * Note:\n *  this function frees its object and property arguments\n *\n * @return an ecma value which contains an error\n *         if the property setting is unsuccessful\n */\nstatic ecma_value_t\nvm_op_set_value (ecma_value_t base, /**< base object */\n                 ecma_value_t property, /**< property name */\n                 ecma_value_t value, /**< ecma value */\n                 bool is_strict) /**< strict mode */\n{\n  ecma_value_t result = ECMA_VALUE_EMPTY;\n  ecma_object_t *object_p;\n  ecma_string_t *property_p;\n\n  if (JERRY_UNLIKELY (!ecma_is_value_object (base)))\n  {\n    if (JERRY_UNLIKELY (ecma_is_value_null (base) || ecma_is_value_undefined (base)))\n    {\n#if JERRY_ERROR_MESSAGES\n      result = ecma_raise_standard_error_with_format (JERRY_ERROR_TYPE, \"Cannot set property '%' of %\", property, base);\n#else /* !JERRY_ERROR_MESSAGES */\n      result = ecma_raise_type_error (ECMA_ERR_EMPTY);\n#endif /* JERRY_ERROR_MESSAGES */\n      ecma_free_value (property);\n      return result;\n    }\n\n    if (JERRY_UNLIKELY (!ecma_is_value_prop_name (property)))\n    {\n      property_p = ecma_op_to_string (property);\n      ecma_fast_free_value (property);\n\n      if (JERRY_UNLIKELY (property_p == NULL))\n      {\n        ecma_free_value (base);\n        return ECMA_VALUE_ERROR;\n      }\n    }\n    else\n    {\n      property_p = ecma_get_prop_name_from_value (property);\n    }\n\n    ecma_value_t object = ecma_op_to_object (base);\n    JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (object));\n\n    object_p = ecma_get_object_from_value (object);\n    ecma_op_ordinary_object_prevent_extensions (object_p);\n\n    result = ecma_op_object_put_with_receiver (object_p, property_p, value, base, is_strict);\n\n    ecma_free_value (base);\n  }\n  else\n  {\n    object_p = ecma_get_object_from_value (base);\n\n    if (JERRY_UNLIKELY (!ecma_is_value_prop_name (property)))\n    {\n      property_p = ecma_op_to_string (property);\n      ecma_fast_free_value (property);\n\n      if (JERRY_UNLIKELY (property_p == NULL))\n      {\n        ecma_deref_object (object_p);\n        return ECMA_VALUE_ERROR;\n      }\n    }\n    else\n    {\n      property_p = ecma_get_prop_name_from_value (property);\n    }\n\n    if (!ecma_is_lexical_environment (object_p))\n    {\n      result = ecma_op_object_put_with_receiver (object_p, property_p, value, base, is_strict);\n    }\n    else\n    {\n      result = ecma_op_set_mutable_binding (object_p, property_p, value, is_strict);\n    }\n  }\n\n  ecma_deref_object (object_p);\n  ecma_deref_ecma_string (property_p);\n  return result;\n} /* vm_op_set_value */\n\n/** Compact bytecode define */\n#define CBC_OPCODE(arg1, arg2, arg3, arg4) arg4,\n\n/**\n * Decode table for both opcodes and extended opcodes.\n */\nstatic const uint16_t vm_decode_table[] JERRY_ATTR_CONST_DATA = { CBC_OPCODE_LIST CBC_EXT_OPCODE_LIST };\n\n#undef CBC_OPCODE\n\n/**\n * Run global code\n *\n * Note:\n *      returned value must be freed with ecma_free_value, when it is no longer needed.\n *\n * @return ecma value\n */\necma_value_t\nvm_run_global (const ecma_compiled_code_t *bytecode_p, /**< pointer to bytecode to run */\n               ecma_object_t *function_object_p) /**< function object if available */\n{\n#if JERRY_BUILTIN_REALMS\n  ecma_object_t *global_obj_p = (ecma_object_t *) ecma_op_function_get_realm (bytecode_p);\n#else /* !JERRY_BUILTIN_REALMS */\n  ecma_object_t *global_obj_p = ecma_builtin_get_global ();\n#endif /* JERRY_BUILTIN_REALMS */\n\n  if (bytecode_p->status_flags & CBC_CODE_FLAGS_LEXICAL_BLOCK_NEEDED)\n  {\n    ecma_create_global_lexical_block (global_obj_p);\n  }\n\n  ecma_object_t *const global_scope_p = ecma_get_global_scope (global_obj_p);\n\n  vm_frame_ctx_shared_t shared;\n  shared.bytecode_header_p = bytecode_p;\n  shared.function_object_p = function_object_p;\n  shared.status_flags = 0;\n\n#if JERRY_BUILTIN_REALMS\n  ecma_value_t this_binding = ((ecma_global_object_t *) global_obj_p)->this_binding;\n\n  ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);\n  JERRY_CONTEXT (global_object_p) = (ecma_global_object_t *) global_obj_p;\n#else /* !JERRY_BUILTIN_REALMS */\n  ecma_value_t this_binding = ecma_make_object_value (global_obj_p);\n#endif /* JERRY_BUILTIN_REALMS */\n\n  ecma_value_t result = vm_run (&shared, this_binding, global_scope_p);\n\n#if JERRY_BUILTIN_REALMS\n  JERRY_CONTEXT (global_object_p) = saved_global_object_p;\n#endif /* JERRY_BUILTIN_REALMS */\n\n  return result;\n} /* vm_run_global */\n\n/**\n * Run specified eval-mode bytecode\n *\n * @return ecma value\n */\necma_value_t\nvm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */\n             uint32_t parse_opts) /**< ecma_parse_opts_t option bits */\n{\n  ecma_value_t this_binding;\n  ecma_object_t *lex_env_p;\n\n  /* ECMA-262 v5, 10.4.2 */\n  if (parse_opts & ECMA_PARSE_DIRECT_EVAL)\n  {\n    this_binding = ecma_copy_value (JERRY_CONTEXT (vm_top_context_p)->this_binding);\n    lex_env_p = JERRY_CONTEXT (vm_top_context_p)->lex_env_p;\n\n#if JERRY_DEBUGGER\n    uint32_t chain_index = JERRY_CONTEXT (debugger_eval_chain_index);\n    JERRY_CONTEXT (debugger_eval_chain_index) = 0;\n\n    while (chain_index != 0)\n    {\n      if (JERRY_UNLIKELY (lex_env_p->u2.outer_reference_cp == JMEM_CP_NULL))\n      {\n        ecma_bytecode_deref (bytecode_data_p);\n        ecma_free_value (this_binding);\n        return ecma_raise_range_error (ECMA_ERR_INVALID_SCOPE_CHAIN_INDEX_FOR_EVAL);\n      }\n\n      lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n\n      if ((ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND)\n          || (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE))\n      {\n        chain_index--;\n      }\n    }\n#endif /* JERRY_DEBUGGER */\n  }\n  else\n  {\n#if JERRY_BUILTIN_REALMS\n    ecma_object_t *global_obj_p = (ecma_object_t *) ecma_op_function_get_realm (bytecode_data_p);\n    this_binding = ((ecma_global_object_t *) global_obj_p)->this_binding;\n    ecma_ref_object (ecma_get_object_from_value (this_binding));\n#else /* !JERRY_BUILTIN_REALMS */\n    ecma_object_t *global_obj_p = ecma_builtin_get_global ();\n    ecma_ref_object (global_obj_p);\n    this_binding = ecma_make_object_value (global_obj_p);\n#endif /* JERRY_BUILTIN_REALMS */\n    lex_env_p = ecma_get_global_scope (global_obj_p);\n  }\n\n  ecma_ref_object (lex_env_p);\n\n  if ((bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE) != 0)\n  {\n    ecma_object_t *strict_lex_env_p = ecma_create_decl_lex_env (lex_env_p);\n\n    ecma_deref_object (lex_env_p);\n    lex_env_p = strict_lex_env_p;\n  }\n\n  if ((bytecode_data_p->status_flags & CBC_CODE_FLAGS_LEXICAL_BLOCK_NEEDED) != 0)\n  {\n    ecma_object_t *lex_block_p = ecma_create_decl_lex_env (lex_env_p);\n    lex_block_p->type_flags_refs |= ECMA_OBJECT_FLAG_BLOCK;\n\n    ecma_deref_object (lex_env_p);\n    lex_env_p = lex_block_p;\n  }\n\n  vm_frame_ctx_shared_t shared;\n  shared.bytecode_header_p = bytecode_data_p;\n  shared.function_object_p = NULL;\n  shared.status_flags = (parse_opts & ECMA_PARSE_DIRECT_EVAL) ? VM_FRAME_CTX_SHARED_DIRECT_EVAL : 0;\n\n  ecma_value_t completion_value = vm_run (&shared, this_binding, lex_env_p);\n\n  ecma_deref_object (lex_env_p);\n  ecma_free_value (this_binding);\n\n#if JERRY_SNAPSHOT_EXEC\n  if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))\n  {\n    ecma_bytecode_deref (bytecode_data_p);\n  }\n#else /* !JERRY_SNAPSHOT_EXEC */\n  ecma_bytecode_deref (bytecode_data_p);\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n  return completion_value;\n} /* vm_run_eval */\n\n#if JERRY_MODULE_SYSTEM\n\n/**\n * Run module code\n *\n * Note:\n *      returned value must be freed with ecma_free_value, when it is no longer needed.\n *\n * @return ecma value\n */\necma_value_t\nvm_run_module (ecma_module_t *module_p) /**< module to be executed */\n{\n  const ecma_value_t module_init_result = ecma_module_initialize (module_p);\n\n  if (ECMA_IS_VALUE_ERROR (module_init_result))\n  {\n    return module_init_result;\n  }\n\n  vm_frame_ctx_shared_t shared;\n  shared.bytecode_header_p = module_p->u.compiled_code_p;\n  shared.function_object_p = &module_p->header.object;\n  shared.status_flags = 0;\n\n  return vm_run (&shared, ECMA_VALUE_UNDEFINED, module_p->scope_p);\n} /* vm_run_module */\n\n#endif /* JERRY_MODULE_SYSTEM */\n\n/**\n * Construct object\n *\n * @return object value\n */\nstatic ecma_value_t\nvm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */\n                             ecma_value_t lit_value) /**< literal */\n{\n  ecma_compiled_code_t *bytecode_p;\n\n#if JERRY_SNAPSHOT_EXEC\n  if (JERRY_LIKELY (!(frame_ctx_p->shared_p->bytecode_header_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)))\n  {\n#endif /* JERRY_SNAPSHOT_EXEC */\n    bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, lit_value);\n#if JERRY_SNAPSHOT_EXEC\n  }\n  else\n  {\n    uint8_t *byte_p = ((uint8_t *) frame_ctx_p->shared_p->bytecode_header_p) + lit_value;\n    bytecode_p = (ecma_compiled_code_t *) byte_p;\n  }\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n#if JERRY_BUILTIN_REGEXP\n  if (JERRY_UNLIKELY (!CBC_IS_FUNCTION (bytecode_p->status_flags)))\n  {\n    ecma_object_t *regexp_obj_p = ecma_op_regexp_alloc (NULL);\n\n    if (JERRY_UNLIKELY (regexp_obj_p == NULL))\n    {\n      return ECMA_VALUE_ERROR;\n    }\n\n    return ecma_op_create_regexp_from_bytecode (regexp_obj_p, (re_compiled_code_t *) bytecode_p);\n  }\n#else /* !JERRY_BUILTIN_REGEXP */\n  JERRY_ASSERT (CBC_IS_FUNCTION (bytecode_p->status_flags));\n#endif /* JERRY_BUILTIN_REGEXP */\n\n  ecma_object_t *func_obj_p;\n\n  if (JERRY_UNLIKELY (CBC_FUNCTION_IS_ARROW (bytecode_p->status_flags)))\n  {\n    func_obj_p = ecma_op_create_arrow_function_object (frame_ctx_p->lex_env_p, bytecode_p, frame_ctx_p->this_binding);\n  }\n  else\n  {\n    func_obj_p = ecma_op_create_any_function_object (frame_ctx_p->lex_env_p, bytecode_p);\n  }\n\n  return ecma_make_object_value (func_obj_p);\n} /* vm_construct_literal_object */\n\n/**\n * Get implicit this value\n *\n * @return true - if the implicit 'this' value is updated,\n *         false - otherwise\n */\nstatic inline bool JERRY_ATTR_ALWAYS_INLINE\nvm_get_implicit_this_value (ecma_value_t *this_value_p) /**< [in,out] this value */\n{\n  if (ecma_is_value_object (*this_value_p))\n  {\n    ecma_object_t *this_obj_p = ecma_get_object_from_value (*this_value_p);\n\n    if (ecma_is_lexical_environment (this_obj_p))\n    {\n      ecma_value_t completion_value = ecma_op_implicit_this_value (this_obj_p);\n\n      JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (completion_value));\n\n      *this_value_p = completion_value;\n      return true;\n    }\n  }\n  return false;\n} /* vm_get_implicit_this_value */\n\n/**\n * Special bytecode sequence for error handling while the vm_loop\n * is preserved for an execute operation\n */\nstatic const uint8_t vm_error_byte_code_p[] = { CBC_EXT_OPCODE, CBC_EXT_ERROR };\n\n/**\n * Get class function object\n *\n * @return the pointer to the object\n */\nstatic ecma_object_t *\nvm_get_class_function (vm_frame_ctx_t *frame_ctx_p) /**< frame context */\n{\n  JERRY_ASSERT (frame_ctx_p != NULL);\n\n  if (frame_ctx_p->shared_p->status_flags & VM_FRAME_CTX_SHARED_NON_ARROW_FUNC)\n  {\n    return frame_ctx_p->shared_p->function_object_p;\n  }\n\n  ecma_environment_record_t *environment_record_p = ecma_op_get_environment_record (frame_ctx_p->lex_env_p);\n\n  JERRY_ASSERT (environment_record_p != NULL);\n  return ecma_get_object_from_value (environment_record_p->function_object);\n} /* vm_get_class_function */\n\n/**\n * 'super(...)' function call handler.\n */\nstatic void\nvm_super_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */\n{\n  JERRY_ASSERT (frame_ctx_p->call_operation == VM_EXEC_SUPER_CALL);\n  JERRY_ASSERT (frame_ctx_p->byte_code_p[0] == CBC_EXT_OPCODE);\n\n  const uint8_t *byte_code_p = frame_ctx_p->byte_code_p + 3;\n  uint8_t opcode = byte_code_p[-2];\n  uint32_t arguments_list_len;\n\n  bool spread_arguments = opcode >= CBC_EXT_SPREAD_SUPER_CALL;\n\n  ecma_collection_t *collection_p = NULL;\n  ecma_value_t *arguments_p;\n\n  if (spread_arguments)\n  {\n    ecma_value_t collection = *(--frame_ctx_p->stack_top_p);\n    collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, collection);\n    arguments_p = collection_p->buffer_p;\n    arguments_list_len = collection_p->item_count;\n  }\n  else\n  {\n    arguments_list_len = byte_code_p[-1];\n    arguments_p = frame_ctx_p->stack_top_p;\n  }\n\n  ecma_value_t func_value = *(--frame_ctx_p->stack_top_p);\n  ecma_value_t completion_value;\n\n  ecma_environment_record_t *environment_record_p = ecma_op_get_environment_record (frame_ctx_p->lex_env_p);\n  JERRY_ASSERT (environment_record_p);\n\n  if (!ecma_is_constructor (func_value))\n  {\n    completion_value = ecma_raise_type_error (ECMA_ERR_VALUE_FOR_CLASS_HERITAGE_IS_NOT_A_CONSTRUCTOR);\n  }\n  else\n  {\n    ecma_object_t *func_obj_p = ecma_get_object_from_value (func_value);\n    completion_value =\n      ecma_op_function_construct (func_obj_p, JERRY_CONTEXT (current_new_target_p), arguments_p, arguments_list_len);\n\n    if (!ECMA_IS_VALUE_ERROR (completion_value) && ecma_op_this_binding_is_initialized (environment_record_p))\n    {\n      ecma_free_value (completion_value);\n      completion_value = ecma_raise_reference_error (ECMA_ERR_SUPER_CONSTRUCTOR_MAY_ONLY_BE_CALLED_ONCE);\n    }\n  }\n\n  /* Free registers. */\n  for (uint32_t i = 0; i < arguments_list_len; i++)\n  {\n    ecma_fast_free_value (arguments_p[i]);\n  }\n\n  if (collection_p != NULL)\n  {\n    ecma_collection_destroy (collection_p);\n  }\n\n  if (ecma_is_value_object (completion_value))\n  {\n    ecma_op_bind_this_value (environment_record_p, completion_value);\n    frame_ctx_p->this_binding = completion_value;\n\n    ecma_value_t fields_value = opfunc_init_class_fields (vm_get_class_function (frame_ctx_p), completion_value);\n\n    if (ECMA_IS_VALUE_ERROR (fields_value))\n    {\n      ecma_free_value (completion_value);\n      completion_value = ECMA_VALUE_ERROR;\n    }\n  }\n\n  ecma_free_value (func_value);\n\n  if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (completion_value)))\n  {\n#if JERRY_DEBUGGER\n    JERRY_CONTEXT (debugger_exception_byte_code_p) = frame_ctx_p->byte_code_p;\n#endif /* JERRY_DEBUGGER */\n    frame_ctx_p->byte_code_p = (uint8_t *) vm_error_byte_code_p;\n  }\n  else\n  {\n    frame_ctx_p->byte_code_p = byte_code_p;\n    uint32_t opcode_data = vm_decode_table[(CBC_END + 1) + opcode];\n\n    if (!(opcode_data & (VM_OC_PUT_STACK | VM_OC_PUT_BLOCK)))\n    {\n      ecma_fast_free_value (completion_value);\n    }\n    else if (opcode_data & VM_OC_PUT_STACK)\n    {\n      *frame_ctx_p->stack_top_p++ = completion_value;\n    }\n    else\n    {\n      ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p, 0));\n      VM_GET_REGISTERS (frame_ctx_p)[0] = completion_value;\n    }\n  }\n} /* vm_super_call */\n\n/**\n * Perform one of the following call/construct operation with spreaded argument list\n *   - f(...args)\n *   - o.f(...args)\n *   - new O(...args)\n */\nstatic void\nvm_spread_operation (vm_frame_ctx_t *frame_ctx_p) /**< frame context */\n{\n  JERRY_ASSERT (frame_ctx_p->byte_code_p[0] == CBC_EXT_OPCODE);\n\n  uint8_t opcode = frame_ctx_p->byte_code_p[1];\n  ecma_value_t completion_value;\n  ecma_value_t collection = *(--frame_ctx_p->stack_top_p);\n\n  ecma_collection_t *collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, collection);\n  ecma_value_t func_value = *(--frame_ctx_p->stack_top_p);\n  bool is_call_prop = opcode >= CBC_EXT_SPREAD_CALL_PROP;\n\n  if (frame_ctx_p->byte_code_p[1] == CBC_EXT_SPREAD_NEW)\n  {\n    ecma_error_msg_t constructor_message_id = ecma_check_constructor (func_value);\n    if (constructor_message_id != ECMA_IS_VALID_CONSTRUCTOR)\n    {\n      completion_value = ecma_raise_type_error (constructor_message_id);\n    }\n    else\n    {\n      ecma_object_t *constructor_obj_p = ecma_get_object_from_value (func_value);\n\n      completion_value = ecma_op_function_construct (constructor_obj_p,\n                                                     constructor_obj_p,\n                                                     collection_p->buffer_p,\n                                                     collection_p->item_count);\n    }\n  }\n  else\n  {\n    ecma_value_t this_value = is_call_prop ? frame_ctx_p->stack_top_p[-2] : ECMA_VALUE_UNDEFINED;\n\n    if (!ecma_is_value_object (func_value) || !ecma_op_object_is_callable (ecma_get_object_from_value (func_value)))\n    {\n      completion_value = ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION);\n    }\n    else\n    {\n      ecma_object_t *func_obj_p = ecma_get_object_from_value (func_value);\n\n      completion_value =\n        ecma_op_function_call (func_obj_p, this_value, collection_p->buffer_p, collection_p->item_count);\n    }\n\n    if (is_call_prop)\n    {\n      ecma_free_value (*(--frame_ctx_p->stack_top_p));\n      ecma_free_value (*(--frame_ctx_p->stack_top_p));\n    }\n  }\n\n  ecma_collection_free (collection_p);\n  ecma_free_value (func_value);\n\n  if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (completion_value)))\n  {\n#if JERRY_DEBUGGER\n    JERRY_CONTEXT (debugger_exception_byte_code_p) = frame_ctx_p->byte_code_p;\n#endif /* JERRY_DEBUGGER */\n    frame_ctx_p->byte_code_p = (uint8_t *) vm_error_byte_code_p;\n  }\n  else\n  {\n    uint32_t opcode_data = vm_decode_table[(CBC_END + 1) + opcode];\n\n    if (!(opcode_data & (VM_OC_PUT_STACK | VM_OC_PUT_BLOCK)))\n    {\n      ecma_fast_free_value (completion_value);\n    }\n    else if (opcode_data & VM_OC_PUT_STACK)\n    {\n      *frame_ctx_p->stack_top_p++ = completion_value;\n    }\n    else\n    {\n      ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p, 0));\n      VM_GET_REGISTERS (frame_ctx_p)[0] = completion_value;\n    }\n\n    /* EXT_OPCODE, SPREAD_OPCODE, BYTE_ARG */\n    frame_ctx_p->byte_code_p += 3;\n  }\n} /* vm_spread_operation */\n\n/**\n * 'Function call' opcode handler.\n *\n * See also: ECMA-262 v5, 11.2.3\n */\nstatic void\nopfunc_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */\n{\n  const uint8_t *byte_code_p = frame_ctx_p->byte_code_p + 1;\n  uint8_t opcode = byte_code_p[-1];\n  uint32_t arguments_list_len;\n\n  if (opcode >= CBC_CALL0)\n  {\n    arguments_list_len = (unsigned int) ((opcode - CBC_CALL0) / 6);\n  }\n  else\n  {\n    arguments_list_len = *byte_code_p++;\n  }\n\n  bool is_call_prop = ((opcode - CBC_CALL) % 6) >= 3;\n\n  ecma_value_t *stack_top_p = frame_ctx_p->stack_top_p - arguments_list_len;\n  ecma_value_t this_value = is_call_prop ? stack_top_p[-3] : ECMA_VALUE_UNDEFINED;\n  ecma_value_t func_value = stack_top_p[-1];\n\n  ecma_value_t completion_value =\n    ecma_op_function_validated_call (func_value, this_value, stack_top_p, arguments_list_len);\n\n  JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_DIRECT_EVAL;\n\n  /* Free registers. */\n  for (uint32_t i = 0; i < arguments_list_len; i++)\n  {\n    ecma_fast_free_value (stack_top_p[i]);\n  }\n\n  if (is_call_prop)\n  {\n    ecma_free_value (*(--stack_top_p));\n    ecma_free_value (*(--stack_top_p));\n  }\n\n  if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (completion_value)))\n  {\n#if JERRY_DEBUGGER\n    JERRY_CONTEXT (debugger_exception_byte_code_p) = frame_ctx_p->byte_code_p;\n#endif /* JERRY_DEBUGGER */\n    frame_ctx_p->byte_code_p = (uint8_t *) vm_error_byte_code_p;\n  }\n  else\n  {\n    frame_ctx_p->byte_code_p = byte_code_p;\n    ecma_free_value (*(--stack_top_p));\n    uint32_t opcode_data = vm_decode_table[opcode];\n\n    if (!(opcode_data & (VM_OC_PUT_STACK | VM_OC_PUT_BLOCK)))\n    {\n      ecma_fast_free_value (completion_value);\n    }\n    else if (opcode_data & VM_OC_PUT_STACK)\n    {\n      *stack_top_p++ = completion_value;\n    }\n    else\n    {\n      ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p, 0));\n      VM_GET_REGISTERS (frame_ctx_p)[0] = completion_value;\n    }\n  }\n\n  frame_ctx_p->stack_top_p = stack_top_p;\n} /* opfunc_call */\n\n/**\n * 'Constructor call' opcode handler.\n *\n * See also: ECMA-262 v5, 11.2.2\n */\nstatic void\nopfunc_construct (vm_frame_ctx_t *frame_ctx_p) /**< frame context */\n{\n  const uint8_t *byte_code_p = frame_ctx_p->byte_code_p + 1;\n  uint8_t opcode = byte_code_p[-1];\n  unsigned int arguments_list_len;\n\n  if (opcode >= CBC_NEW0)\n  {\n    arguments_list_len = (unsigned int) (opcode - CBC_NEW0);\n  }\n  else\n  {\n    arguments_list_len = *byte_code_p++;\n  }\n\n  ecma_value_t *stack_top_p = frame_ctx_p->stack_top_p - arguments_list_len;\n  ecma_value_t constructor_value = stack_top_p[-1];\n  ecma_value_t completion_value;\n\n  ecma_error_msg_t constructor_message_id = ecma_check_constructor (constructor_value);\n  if (constructor_message_id != ECMA_IS_VALID_CONSTRUCTOR)\n  {\n    completion_value = ecma_raise_type_error (constructor_message_id);\n  }\n  else\n  {\n    ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor_value);\n\n    completion_value =\n      ecma_op_function_construct (constructor_obj_p, constructor_obj_p, stack_top_p, arguments_list_len);\n  }\n\n  /* Free registers. */\n  for (uint32_t i = 0; i < arguments_list_len; i++)\n  {\n    ecma_fast_free_value (stack_top_p[i]);\n  }\n\n  if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (completion_value)))\n  {\n#if JERRY_DEBUGGER\n    JERRY_CONTEXT (debugger_exception_byte_code_p) = frame_ctx_p->byte_code_p;\n#endif /* JERRY_DEBUGGER */\n    frame_ctx_p->byte_code_p = (uint8_t *) vm_error_byte_code_p;\n  }\n  else\n  {\n    ecma_free_value (stack_top_p[-1]);\n    frame_ctx_p->byte_code_p = byte_code_p;\n    stack_top_p[-1] = completion_value;\n  }\n\n  frame_ctx_p->stack_top_p = stack_top_p;\n} /* opfunc_construct */\n\n/**\n * Read literal index from the byte code stream into destination.\n *\n * @param destination destination\n */\n#define READ_LITERAL_INDEX(destination)                                                      \\\n  do                                                                                         \\\n  {                                                                                          \\\n    (destination) = *byte_code_p++;                                                          \\\n    if ((destination) >= encoding_limit)                                                     \\\n    {                                                                                        \\\n      (destination) = (uint16_t) ((((destination) << 8) | *byte_code_p++) - encoding_delta); \\\n    }                                                                                        \\\n  } while (0)\n\n/**\n * Get literal value by literal index.\n *\n * @param literal_index literal index\n * @param target_value target value\n *\n * TODO: For performance reasons, we define this as a macro.\n * When we are able to construct a function with similar speed,\n * we can remove this macro.\n */\n#define READ_LITERAL(literal_index, target_value)                                                 \\\n  do                                                                                              \\\n  {                                                                                               \\\n    if ((literal_index) < ident_end)                                                              \\\n    {                                                                                             \\\n      if ((literal_index) < register_end)                                                         \\\n      {                                                                                           \\\n        /* Note: There should be no specialization for arguments. */                              \\\n        (target_value) = ecma_fast_copy_value (VM_GET_REGISTER (frame_ctx_p, literal_index));     \\\n      }                                                                                           \\\n      else                                                                                        \\\n      {                                                                                           \\\n        ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);      \\\n                                                                                                  \\\n        result = ecma_op_resolve_reference_value (frame_ctx_p->lex_env_p, name_p);                \\\n                                                                                                  \\\n        if (ECMA_IS_VALUE_ERROR (result))                                                         \\\n        {                                                                                         \\\n          goto error;                                                                             \\\n        }                                                                                         \\\n        (target_value) = result;                                                                  \\\n      }                                                                                           \\\n    }                                                                                             \\\n    else if (literal_index < const_literal_end)                                                   \\\n    {                                                                                             \\\n      (target_value) = ecma_fast_copy_value (literal_start_p[literal_index]);                     \\\n    }                                                                                             \\\n    else                                                                                          \\\n    {                                                                                             \\\n      /* Object construction. */                                                                  \\\n      (target_value) = vm_construct_literal_object (frame_ctx_p, literal_start_p[literal_index]); \\\n    }                                                                                             \\\n  } while (0)\n\n/**\n * Store the original value for post increase/decrease operators\n *\n * @param value original value\n */\n#define POST_INCREASE_DECREASE_PUT_RESULT(value)                                                             \\\n  if (opcode_data & VM_OC_PUT_STACK)                                                                         \\\n  {                                                                                                          \\\n    if (opcode_flags & VM_OC_IDENT_INCR_DECR_OPERATOR_FLAG)                                                  \\\n    {                                                                                                        \\\n      JERRY_ASSERT (opcode == CBC_POST_INCR_IDENT_PUSH_RESULT || opcode == CBC_POST_DECR_IDENT_PUSH_RESULT); \\\n      *stack_top_p++ = (value);                                                                              \\\n    }                                                                                                        \\\n    else                                                                                                     \\\n    {                                                                                                        \\\n      /* The parser ensures there is enough space for the                                                    \\\n       * extra value on the stack. See js-parser-expr.c. */                                                  \\\n      JERRY_ASSERT (opcode == CBC_POST_INCR_PUSH_RESULT || opcode == CBC_POST_DECR_PUSH_RESULT);             \\\n      stack_top_p++;                                                                                         \\\n      stack_top_p[-1] = stack_top_p[-2];                                                                     \\\n      stack_top_p[-2] = stack_top_p[-3];                                                                     \\\n      stack_top_p[-3] = (value);                                                                             \\\n    }                                                                                                        \\\n    opcode_data &= (uint32_t) ~VM_OC_PUT_STACK;                                                              \\\n  }                                                                                                          \\\n  else                                                                                                       \\\n  {                                                                                                          \\\n    JERRY_ASSERT (opcode_data &VM_OC_PUT_BLOCK);                                                             \\\n    ecma_free_value (VM_GET_REGISTER (frame_ctx_p, 0));                                                      \\\n    VM_GET_REGISTERS (frame_ctx_p)[0] = (value);                                                             \\\n    opcode_data &= (uint32_t) ~VM_OC_PUT_BLOCK;                                                              \\\n  }\n\n/**\n * Get the end of the existing topmost context\n */\n#define VM_LAST_CONTEXT_END() (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth)\n\n/**\n * Run generic byte code.\n *\n * @return ecma value\n */\nstatic ecma_value_t JERRY_ATTR_NOINLINE\nvm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */\n{\n  const ecma_compiled_code_t *bytecode_header_p = frame_ctx_p->shared_p->bytecode_header_p;\n  const uint8_t *byte_code_p = frame_ctx_p->byte_code_p;\n  ecma_value_t *literal_start_p = frame_ctx_p->literal_start_p;\n\n  ecma_value_t *stack_top_p;\n  uint16_t encoding_limit;\n  uint16_t encoding_delta;\n  uint16_t register_end;\n  uint16_t ident_end;\n  uint16_t const_literal_end;\n  int32_t branch_offset = 0;\n  uint8_t branch_offset_length = 0;\n  ecma_value_t left_value;\n  ecma_value_t right_value;\n  ecma_value_t result = ECMA_VALUE_EMPTY;\n  bool is_strict = ((bytecode_header_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE) != 0);\n\n  /* Prepare for byte code execution. */\n  if (!(bytecode_header_p->status_flags & CBC_CODE_FLAGS_FULL_LITERAL_ENCODING))\n  {\n    encoding_limit = CBC_SMALL_LITERAL_ENCODING_LIMIT;\n    encoding_delta = CBC_SMALL_LITERAL_ENCODING_DELTA;\n  }\n  else\n  {\n    encoding_limit = CBC_FULL_LITERAL_ENCODING_LIMIT;\n    encoding_delta = CBC_FULL_LITERAL_ENCODING_DELTA;\n  }\n\n  if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) (bytecode_header_p);\n    register_end = args_p->register_end;\n    ident_end = args_p->ident_end;\n    const_literal_end = args_p->const_literal_end;\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) (bytecode_header_p);\n    register_end = args_p->register_end;\n    ident_end = args_p->ident_end;\n    const_literal_end = args_p->const_literal_end;\n  }\n\n  stack_top_p = frame_ctx_p->stack_top_p;\n\n  /* Outer loop for exception handling. */\n  while (true)\n  {\n    /* Internal loop for byte code execution. */\n    while (true)\n    {\n      const uint8_t *byte_code_start_p = byte_code_p;\n      uint8_t opcode = *byte_code_p++;\n      uint32_t opcode_data = opcode;\n\n      if (opcode == CBC_EXT_OPCODE)\n      {\n        opcode = *byte_code_p++;\n        opcode_data = (uint32_t) ((CBC_END + 1) + opcode);\n      }\n\n      opcode_data = vm_decode_table[opcode_data];\n\n      left_value = ECMA_VALUE_UNDEFINED;\n      right_value = ECMA_VALUE_UNDEFINED;\n\n      uint32_t operands = VM_OC_GET_ARGS_INDEX (opcode_data);\n\n      if (operands >= VM_OC_GET_LITERAL)\n      {\n        uint16_t literal_index;\n        READ_LITERAL_INDEX (literal_index);\n        READ_LITERAL (literal_index, left_value);\n\n        if (operands != VM_OC_GET_LITERAL)\n        {\n          switch (operands)\n          {\n            case VM_OC_GET_LITERAL_LITERAL:\n            {\n              uint16_t second_literal_index;\n              READ_LITERAL_INDEX (second_literal_index);\n              READ_LITERAL (second_literal_index, right_value);\n              break;\n            }\n            case VM_OC_GET_STACK_LITERAL:\n            {\n              JERRY_ASSERT (stack_top_p > VM_GET_REGISTERS (frame_ctx_p) + register_end);\n              right_value = left_value;\n              left_value = *(--stack_top_p);\n              break;\n            }\n            default:\n            {\n              JERRY_ASSERT (operands == VM_OC_GET_THIS_LITERAL);\n\n              right_value = left_value;\n              left_value = ecma_copy_value (frame_ctx_p->this_binding);\n              break;\n            }\n          }\n        }\n      }\n      else if (operands >= VM_OC_GET_STACK)\n      {\n        JERRY_ASSERT (operands == VM_OC_GET_STACK || operands == VM_OC_GET_STACK_STACK);\n\n        JERRY_ASSERT (stack_top_p > VM_GET_REGISTERS (frame_ctx_p) + register_end);\n        left_value = *(--stack_top_p);\n\n        if (operands == VM_OC_GET_STACK_STACK)\n        {\n          JERRY_ASSERT (stack_top_p > VM_GET_REGISTERS (frame_ctx_p) + register_end);\n          right_value = left_value;\n          left_value = *(--stack_top_p);\n        }\n      }\n      else if (operands == VM_OC_GET_BRANCH)\n      {\n        branch_offset_length = CBC_BRANCH_OFFSET_LENGTH (opcode);\n        JERRY_ASSERT (branch_offset_length >= 1 && branch_offset_length <= 3);\n\n        branch_offset = *(byte_code_p++);\n\n        if (JERRY_UNLIKELY (branch_offset_length != 1))\n        {\n          branch_offset <<= 8;\n          branch_offset |= *(byte_code_p++);\n\n          if (JERRY_UNLIKELY (branch_offset_length == 3))\n          {\n            branch_offset <<= 8;\n            branch_offset |= *(byte_code_p++);\n          }\n        }\n\n        if (opcode_data & VM_OC_BACKWARD_BRANCH)\n        {\n#if JERRY_VM_HALT\n          if (JERRY_CONTEXT (vm_exec_stop_cb) != NULL && --JERRY_CONTEXT (vm_exec_stop_counter) == 0)\n          {\n            result = JERRY_CONTEXT (vm_exec_stop_cb) (JERRY_CONTEXT (vm_exec_stop_user_p));\n\n            if (ecma_is_value_undefined (result))\n            {\n              JERRY_CONTEXT (vm_exec_stop_counter) = JERRY_CONTEXT (vm_exec_stop_frequency);\n            }\n            else\n            {\n              JERRY_CONTEXT (vm_exec_stop_counter) = 1;\n\n              if (ecma_is_value_exception (result))\n              {\n                ecma_throw_exception (result);\n              }\n              else\n              {\n                jcontext_raise_exception (result);\n              }\n\n              JERRY_ASSERT (jcontext_has_pending_exception ());\n              jcontext_set_abort_flag (true);\n              result = ECMA_VALUE_ERROR;\n              goto error;\n            }\n          }\n#endif /* JERRY_VM_HALT */\n\n          branch_offset = -branch_offset;\n        }\n      }\n\n      switch (VM_OC_GROUP_GET_INDEX (opcode_data))\n      {\n        case VM_OC_POP:\n        {\n          JERRY_ASSERT (stack_top_p > VM_GET_REGISTERS (frame_ctx_p) + register_end);\n          ecma_free_value (*(--stack_top_p));\n          continue;\n        }\n        case VM_OC_POP_BLOCK:\n        {\n          ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p, 0));\n          VM_GET_REGISTERS (frame_ctx_p)[0] = *(--stack_top_p);\n          continue;\n        }\n        case VM_OC_PUSH:\n        {\n          *stack_top_p++ = left_value;\n          continue;\n        }\n        case VM_OC_PUSH_TWO:\n        {\n          *stack_top_p++ = left_value;\n          *stack_top_p++ = right_value;\n          continue;\n        }\n        case VM_OC_PUSH_THREE:\n        {\n          uint16_t literal_index;\n\n          *stack_top_p++ = left_value;\n          left_value = ECMA_VALUE_UNDEFINED;\n\n          READ_LITERAL_INDEX (literal_index);\n          READ_LITERAL (literal_index, left_value);\n\n          *stack_top_p++ = right_value;\n          *stack_top_p++ = left_value;\n          continue;\n        }\n        case VM_OC_PUSH_UNDEFINED:\n        {\n          *stack_top_p++ = ECMA_VALUE_UNDEFINED;\n          continue;\n        }\n        case VM_OC_PUSH_TRUE:\n        {\n          *stack_top_p++ = ECMA_VALUE_TRUE;\n          continue;\n        }\n        case VM_OC_PUSH_FALSE:\n        {\n          *stack_top_p++ = ECMA_VALUE_FALSE;\n          continue;\n        }\n        case VM_OC_PUSH_NULL:\n        {\n          *stack_top_p++ = ECMA_VALUE_NULL;\n          continue;\n        }\n        case VM_OC_PUSH_THIS:\n        {\n          *stack_top_p++ = ecma_copy_value (frame_ctx_p->this_binding);\n          continue;\n        }\n        case VM_OC_PUSH_0:\n        {\n          *stack_top_p++ = ecma_make_integer_value (0);\n          continue;\n        }\n        case VM_OC_PUSH_POS_BYTE:\n        {\n          ecma_integer_value_t number = *byte_code_p++;\n          *stack_top_p++ = ecma_make_integer_value (number + 1);\n          continue;\n        }\n        case VM_OC_PUSH_NEG_BYTE:\n        {\n          ecma_integer_value_t number = *byte_code_p++;\n          *stack_top_p++ = ecma_make_integer_value (-(number + 1));\n          continue;\n        }\n        case VM_OC_PUSH_LIT_0:\n        {\n          stack_top_p[0] = left_value;\n          stack_top_p[1] = ecma_make_integer_value (0);\n          stack_top_p += 2;\n          continue;\n        }\n        case VM_OC_PUSH_LIT_POS_BYTE:\n        {\n          ecma_integer_value_t number = *byte_code_p++;\n          stack_top_p[0] = left_value;\n          stack_top_p[1] = ecma_make_integer_value (number + 1);\n          stack_top_p += 2;\n          continue;\n        }\n        case VM_OC_PUSH_LIT_NEG_BYTE:\n        {\n          ecma_integer_value_t number = *byte_code_p++;\n          stack_top_p[0] = left_value;\n          stack_top_p[1] = ecma_make_integer_value (-(number + 1));\n          stack_top_p += 2;\n          continue;\n        }\n        case VM_OC_PUSH_OBJECT:\n        {\n          ecma_object_t *obj_p =\n            ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL);\n\n          *stack_top_p++ = ecma_make_object_value (obj_p);\n          continue;\n        }\n        case VM_OC_PUSH_NAMED_FUNC_EXPR:\n        {\n          ecma_object_t *func_p = ecma_get_object_from_value (left_value);\n\n          JERRY_ASSERT (ecma_get_object_type (func_p) == ECMA_OBJECT_TYPE_FUNCTION);\n\n          ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) func_p;\n\n          JERRY_ASSERT (frame_ctx_p->lex_env_p\n                        == ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_func_p->u.function.scope_cp));\n\n          ecma_object_t *name_lex_env = ecma_create_decl_lex_env (frame_ctx_p->lex_env_p);\n\n          ecma_op_create_immutable_binding (name_lex_env, ecma_get_string_from_value (right_value), left_value);\n\n          ECMA_SET_NON_NULL_POINTER_TAG (ext_func_p->u.function.scope_cp, name_lex_env, 0);\n\n          ecma_free_value (right_value);\n          ecma_deref_object (name_lex_env);\n          *stack_top_p++ = left_value;\n          continue;\n        }\n        case VM_OC_CREATE_BINDING:\n        {\n          uint32_t literal_index;\n\n          READ_LITERAL_INDEX (literal_index);\n\n          ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n\n          JERRY_ASSERT (ecma_get_lex_env_type (frame_ctx_p->lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);\n          JERRY_ASSERT (ecma_find_named_property (frame_ctx_p->lex_env_p, name_p) == NULL);\n\n          uint8_t prop_attributes = ECMA_PROPERTY_FLAG_WRITABLE;\n\n          if (opcode == CBC_CREATE_LET)\n          {\n            prop_attributes = ECMA_PROPERTY_ENUMERABLE_WRITABLE;\n          }\n          else if (opcode == CBC_CREATE_CONST)\n          {\n            prop_attributes = ECMA_PROPERTY_FLAG_ENUMERABLE;\n          }\n\n          ecma_property_value_t *property_value_p;\n          property_value_p = ecma_create_named_data_property (frame_ctx_p->lex_env_p, name_p, prop_attributes, NULL);\n\n          if (opcode != CBC_CREATE_VAR)\n          {\n            property_value_p->value = ECMA_VALUE_UNINITIALIZED;\n          }\n\n          continue;\n        }\n        case VM_OC_VAR_EVAL:\n        {\n          uint32_t literal_index;\n          ecma_value_t lit_value = ECMA_VALUE_UNDEFINED;\n\n          if (opcode == CBC_CREATE_VAR_FUNC_EVAL)\n          {\n            uint32_t value_index;\n            READ_LITERAL_INDEX (value_index);\n            JERRY_ASSERT (value_index >= const_literal_end);\n\n            lit_value = vm_construct_literal_object (frame_ctx_p, literal_start_p[value_index]);\n          }\n\n          READ_LITERAL_INDEX (literal_index);\n          JERRY_ASSERT (literal_index >= register_end);\n\n          ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n          ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;\n\n          while (lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK)\n          {\n#if !(defined JERRY_NDEBUG)\n            if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n            {\n              ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n              JERRY_ASSERT (property_p == NULL || !(*property_p & ECMA_PROPERTY_FLAG_ENUMERABLE));\n            }\n#endif /* !JERRY_NDEBUG */\n\n            JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);\n            lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n          }\n\n#if !(defined JERRY_NDEBUG)\n          if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n          {\n            ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n            JERRY_ASSERT (property_p == NULL || !(*property_p & ECMA_PROPERTY_FLAG_ENUMERABLE));\n          }\n#endif /* !JERRY_NDEBUG */\n\n          /* 'Variable declaration' */\n          result = ecma_op_has_binding (lex_env_p, name_p);\n\n#if JERRY_BUILTIN_PROXY\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n#endif /* JERRY_BUILTIN_PROXY */\n\n          ecma_property_t *prop_p = NULL;\n\n          if (ecma_is_value_false (result))\n          {\n            bool is_configurable = (frame_ctx_p->status_flags & VM_FRAME_CTX_DIRECT_EVAL) != 0;\n            prop_p = ecma_op_create_mutable_binding (lex_env_p, name_p, is_configurable);\n\n            if (JERRY_UNLIKELY (prop_p == ECMA_PROPERTY_POINTER_ERROR))\n            {\n              result = ECMA_VALUE_ERROR;\n              goto error;\n            }\n          }\n\n          if (lit_value != ECMA_VALUE_UNDEFINED)\n          {\n            JERRY_ASSERT (ecma_is_value_object (lit_value));\n\n            if (prop_p != NULL)\n            {\n              JERRY_ASSERT (ecma_is_value_undefined (ECMA_PROPERTY_VALUE_PTR (prop_p)->value));\n              JERRY_ASSERT (ecma_is_property_writable (*prop_p));\n              ECMA_PROPERTY_VALUE_PTR (prop_p)->value = lit_value;\n              ecma_free_object (lit_value);\n            }\n            else\n            {\n              result = ecma_op_put_value_lex_env_base (lex_env_p, name_p, is_strict, lit_value);\n              ecma_free_object (lit_value);\n\n              if (ECMA_IS_VALUE_ERROR (result))\n              {\n                goto error;\n              }\n            }\n          }\n          continue;\n        }\n        case VM_OC_EXT_VAR_EVAL:\n        {\n          uint32_t literal_index;\n          ecma_value_t lit_value = ECMA_VALUE_UNDEFINED;\n\n          JERRY_ASSERT (byte_code_start_p[0] == CBC_EXT_OPCODE);\n\n          if (opcode == CBC_EXT_CREATE_VAR_FUNC_EVAL)\n          {\n            uint32_t value_index;\n            READ_LITERAL_INDEX (value_index);\n            JERRY_ASSERT (value_index >= const_literal_end);\n\n            lit_value = vm_construct_literal_object (frame_ctx_p, literal_start_p[value_index]);\n          }\n\n          READ_LITERAL_INDEX (literal_index);\n          JERRY_ASSERT (literal_index >= register_end);\n\n          ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n          ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;\n          ecma_object_t *prev_lex_env_p = NULL;\n\n          while (lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK)\n          {\n#if !(defined JERRY_NDEBUG)\n            if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n            {\n              ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n              JERRY_ASSERT (property_p == NULL || !(*property_p & ECMA_PROPERTY_FLAG_ENUMERABLE));\n            }\n#endif /* !JERRY_NDEBUG */\n\n            JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);\n            prev_lex_env_p = lex_env_p;\n            lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n          }\n\n          JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);\n          JERRY_ASSERT (prev_lex_env_p != NULL\n                        && ecma_get_lex_env_type (prev_lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);\n\n          ecma_property_t *property_p = ecma_find_named_property (prev_lex_env_p, name_p);\n          ecma_property_value_t *property_value_p;\n\n          if (property_p == NULL)\n          {\n            property_value_p =\n              ecma_create_named_data_property (prev_lex_env_p, name_p, ECMA_PROPERTY_CONFIGURABLE_WRITABLE, NULL);\n\n            if (lit_value == ECMA_VALUE_UNDEFINED)\n            {\n              continue;\n            }\n          }\n          else\n          {\n            if (lit_value == ECMA_VALUE_UNDEFINED)\n            {\n              continue;\n            }\n\n            property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n            ecma_free_value_if_not_object (property_value_p->value);\n          }\n\n          property_value_p->value = lit_value;\n          ecma_deref_object (ecma_get_object_from_value (lit_value));\n          continue;\n        }\n        case VM_OC_CREATE_ARGUMENTS:\n        {\n          uint32_t literal_index;\n          READ_LITERAL_INDEX (literal_index);\n\n          JERRY_ASSERT (frame_ctx_p->shared_p->status_flags & VM_FRAME_CTX_SHARED_HAS_ARG_LIST);\n\n          result = ecma_op_create_arguments_object ((vm_frame_ctx_shared_args_t *) (frame_ctx_p->shared_p),\n                                                    frame_ctx_p->lex_env_p);\n\n          if (literal_index < register_end)\n          {\n            JERRY_ASSERT (VM_GET_REGISTER (frame_ctx_p, literal_index) == ECMA_VALUE_UNDEFINED);\n            VM_GET_REGISTER (frame_ctx_p, literal_index) = result;\n            continue;\n          }\n\n          ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n\n          JERRY_ASSERT (ecma_find_named_property (frame_ctx_p->lex_env_p, name_p) == NULL);\n\n          uint8_t prop_attributes = ECMA_PROPERTY_FLAG_WRITABLE;\n          ecma_property_value_t *property_value_p;\n\n          property_value_p = ecma_create_named_data_property (frame_ctx_p->lex_env_p, name_p, prop_attributes, NULL);\n          property_value_p->value = result;\n\n          ecma_deref_object (ecma_get_object_from_value (result));\n          continue;\n        }\n#if JERRY_SNAPSHOT_EXEC\n        case VM_OC_SET_BYTECODE_PTR:\n        {\n          memcpy (&byte_code_p, byte_code_p++, sizeof (uintptr_t));\n          frame_ctx_p->byte_code_start_p = byte_code_p;\n          continue;\n        }\n#endif /* JERRY_SNAPSHOT_EXEC */\n        case VM_OC_INIT_ARG_OR_FUNC:\n        {\n          uint32_t literal_index, value_index;\n          ecma_value_t lit_value;\n          bool release = false;\n\n          READ_LITERAL_INDEX (value_index);\n\n          if (value_index < register_end)\n          {\n            /* Take (not copy) the reference. */\n            lit_value = ecma_copy_value_if_not_object (VM_GET_REGISTER (frame_ctx_p, value_index));\n          }\n          else\n          {\n            lit_value = vm_construct_literal_object (frame_ctx_p, literal_start_p[value_index]);\n            release = true;\n          }\n\n          READ_LITERAL_INDEX (literal_index);\n\n          JERRY_ASSERT (value_index != literal_index);\n          JERRY_ASSERT (value_index >= register_end || literal_index >= register_end);\n\n          if (literal_index < register_end)\n          {\n            ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p, literal_index));\n            JERRY_ASSERT (release);\n            VM_GET_REGISTER (frame_ctx_p, literal_index) = lit_value;\n            continue;\n          }\n\n          ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n\n          JERRY_ASSERT (ecma_get_lex_env_type (frame_ctx_p->lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);\n          JERRY_ASSERT (ecma_find_named_property (frame_ctx_p->lex_env_p, name_p) == NULL);\n\n          ecma_property_value_t *property_value_p;\n          property_value_p =\n            ecma_create_named_data_property (frame_ctx_p->lex_env_p, name_p, ECMA_PROPERTY_FLAG_WRITABLE, NULL);\n\n          JERRY_ASSERT (property_value_p->value == ECMA_VALUE_UNDEFINED);\n          property_value_p->value = lit_value;\n\n          if (release)\n          {\n            ecma_deref_object (ecma_get_object_from_value (lit_value));\n          }\n          continue;\n        }\n        case VM_OC_CHECK_VAR:\n        {\n          JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (frame_ctx_p->shared_p->bytecode_header_p->status_flags)\n                        == CBC_FUNCTION_SCRIPT);\n\n          uint32_t literal_index;\n          READ_LITERAL_INDEX (literal_index);\n\n          if ((frame_ctx_p->lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK) == 0)\n          {\n            continue;\n          }\n\n          ecma_string_t *const literal_name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n          ecma_property_t *const binding_p = ecma_find_named_property (frame_ctx_p->lex_env_p, literal_name_p);\n\n          if (binding_p != NULL)\n          {\n            result = ecma_raise_syntax_error (ECMA_ERR_LOCAL_VARIABLE_IS_REDECLARED);\n            goto error;\n          }\n\n          continue;\n        }\n        case VM_OC_CHECK_LET:\n        {\n          JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (frame_ctx_p->shared_p->bytecode_header_p->status_flags)\n                        == CBC_FUNCTION_SCRIPT);\n\n          uint32_t literal_index;\n          READ_LITERAL_INDEX (literal_index);\n\n          ecma_string_t *literal_name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n          ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;\n\n          if (lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK)\n          {\n            result = opfunc_lexical_scope_has_restricted_binding (frame_ctx_p, literal_name_p);\n\n            if (!ecma_is_value_false (result))\n            {\n              if (ecma_is_value_true (result))\n              {\n                result = ecma_raise_syntax_error (ECMA_ERR_LOCAL_VARIABLE_IS_REDECLARED);\n              }\n\n              JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result));\n              goto error;\n            }\n\n            continue;\n          }\n\n          result = ecma_op_has_binding (lex_env_p, literal_name_p);\n\n#if JERRY_BUILTIN_PROXY\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n#endif /* JERRY_BUILTIN_PROXY */\n\n          if (ecma_is_value_true (result))\n          {\n            result = ecma_raise_syntax_error (ECMA_ERR_LOCAL_VARIABLE_IS_REDECLARED);\n            goto error;\n          }\n\n          continue;\n        }\n        case VM_OC_ASSIGN_LET_CONST:\n        {\n          uint32_t literal_index;\n          READ_LITERAL_INDEX (literal_index);\n\n          JERRY_ASSERT (literal_index >= register_end);\n          JERRY_ASSERT (ecma_get_lex_env_type (frame_ctx_p->lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE\n                        || (ecma_get_lex_env_type (frame_ctx_p->lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_CLASS\n                            && ECMA_LEX_ENV_CLASS_IS_MODULE (frame_ctx_p->lex_env_p)));\n\n          ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n          ecma_property_t *property_p = ecma_find_named_property (frame_ctx_p->lex_env_p, name_p);\n\n          JERRY_ASSERT (property_p != NULL && ECMA_PROPERTY_IS_RAW_DATA (*property_p)\n                        && (*property_p & ECMA_PROPERTY_FLAG_DATA));\n          JERRY_ASSERT (ECMA_PROPERTY_VALUE_PTR (property_p)->value == ECMA_VALUE_UNINITIALIZED);\n\n          ECMA_PROPERTY_VALUE_PTR (property_p)->value = left_value;\n\n          if (ecma_is_value_object (left_value))\n          {\n            ecma_deref_object (ecma_get_object_from_value (left_value));\n          }\n          continue;\n        }\n        case VM_OC_INIT_BINDING:\n        {\n          uint32_t literal_index;\n\n          READ_LITERAL_INDEX (literal_index);\n\n          JERRY_ASSERT (literal_index >= register_end);\n\n          ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n\n          JERRY_ASSERT (ecma_get_lex_env_type (frame_ctx_p->lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);\n          JERRY_ASSERT (ecma_find_named_property (frame_ctx_p->lex_env_p, name_p) == NULL);\n\n          uint8_t prop_attributes = ECMA_PROPERTY_FLAG_WRITABLE;\n\n          if (opcode == CBC_INIT_LET)\n          {\n            prop_attributes = ECMA_PROPERTY_ENUMERABLE_WRITABLE;\n          }\n          else if (opcode == CBC_INIT_CONST)\n          {\n            prop_attributes = ECMA_PROPERTY_FLAG_ENUMERABLE;\n          }\n\n          ecma_property_value_t *property_value_p;\n          property_value_p = ecma_create_named_data_property (frame_ctx_p->lex_env_p, name_p, prop_attributes, NULL);\n\n          JERRY_ASSERT (property_value_p->value == ECMA_VALUE_UNDEFINED);\n\n          ecma_value_t value = *(--stack_top_p);\n\n          property_value_p->value = value;\n          ecma_deref_if_object (value);\n          continue;\n        }\n        case VM_OC_THROW_CONST_ERROR:\n        {\n          result = ecma_raise_type_error (ECMA_ERR_CONSTANT_BINDINGS_CANNOT_BE_REASSIGNED);\n          goto error;\n        }\n        case VM_OC_COPY_TO_GLOBAL:\n        {\n          uint32_t literal_index;\n          READ_LITERAL_INDEX (literal_index);\n\n          ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n          ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;\n\n          while (lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK)\n          {\n#ifndef JERRY_NDEBUG\n            if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n            {\n              ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n\n              JERRY_ASSERT (property_p == NULL || !(*property_p & ECMA_PROPERTY_FLAG_ENUMERABLE));\n            }\n#endif /* !JERRY_NDEBUG */\n\n            JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);\n            lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n          }\n\n          if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)\n          {\n            ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);\n            ecma_property_value_t *prop_value_p;\n\n            if (property_p == NULL)\n            {\n              prop_value_p = ecma_create_named_data_property (lex_env_p, name_p, ECMA_PROPERTY_FLAG_WRITABLE, NULL);\n            }\n            else\n            {\n#ifndef JERRY_NDEBUG\n              JERRY_ASSERT (!(*property_p & ECMA_PROPERTY_FLAG_ENUMERABLE));\n#endif /* !JERRY_NDEBUG */\n              prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n            }\n\n            ecma_named_data_property_assign_value (lex_env_p, prop_value_p, left_value);\n          }\n          else\n          {\n            result = ecma_op_set_mutable_binding (lex_env_p, name_p, left_value, is_strict);\n\n            if (ECMA_IS_VALUE_ERROR (result))\n            {\n              goto error;\n            }\n          }\n\n          goto free_left_value;\n        }\n        case VM_OC_COPY_FROM_ARG:\n        {\n          uint32_t literal_index;\n          READ_LITERAL_INDEX (literal_index);\n          JERRY_ASSERT (literal_index >= register_end);\n\n          ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n          ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;\n          ecma_object_t *arg_lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n\n          JERRY_ASSERT ((lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK)\n                        && ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);\n          JERRY_ASSERT (arg_lex_env_p != NULL && !(arg_lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK)\n                        && ecma_get_lex_env_type (arg_lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);\n\n          ecma_property_value_t *property_value_p;\n          property_value_p = ecma_create_named_data_property (lex_env_p, name_p, ECMA_PROPERTY_FLAG_WRITABLE, NULL);\n\n          ecma_property_t *property_p = ecma_find_named_property (arg_lex_env_p, name_p);\n          JERRY_ASSERT (property_p != NULL);\n\n          ecma_property_value_t *arg_prop_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n          property_value_p->value = ecma_copy_value_if_not_object (arg_prop_value_p->value);\n          continue;\n        }\n        case VM_OC_CLONE_CONTEXT:\n        {\n          JERRY_ASSERT (byte_code_start_p[0] == CBC_EXT_OPCODE);\n\n          bool copy_values = (byte_code_start_p[1] == CBC_EXT_CLONE_FULL_CONTEXT);\n          frame_ctx_p->lex_env_p = ecma_clone_decl_lexical_environment (frame_ctx_p->lex_env_p, copy_values);\n          continue;\n        }\n        case VM_OC_SET__PROTO__:\n        {\n          result = ecma_builtin_object_object_set_proto (stack_top_p[-1], left_value);\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n          goto free_left_value;\n        }\n        case VM_OC_CLASS_CALL_STATIC_BLOCK:\n        {\n          result = ecma_op_function_call (ecma_get_object_from_value (left_value), frame_ctx_p->this_binding, NULL, 0);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n          goto free_left_value;\n        }\n        case VM_OC_PUSH_STATIC_FIELD_FUNC:\n        {\n          JERRY_ASSERT (byte_code_start_p[0] == CBC_EXT_OPCODE\n                        && (byte_code_start_p[1] == CBC_EXT_PUSH_STATIC_FIELD_FUNC\n                            || byte_code_start_p[1] == CBC_EXT_PUSH_STATIC_COMPUTED_FIELD_FUNC));\n\n          bool push_computed = (byte_code_start_p[1] == CBC_EXT_PUSH_STATIC_COMPUTED_FIELD_FUNC);\n          ecma_value_t value = stack_top_p[-1];\n\n          if (!push_computed)\n          {\n            stack_top_p++;\n          }\n\n          memmove (stack_top_p - 3, stack_top_p - 4, 3 * sizeof (ecma_value_t));\n          stack_top_p[-4] = left_value;\n\n          ecma_object_t *class_object_p = ecma_get_object_from_value (stack_top_p[-2]);\n          ecma_object_t *initializer_func_p = ecma_get_object_from_value (left_value);\n          opfunc_bind_class_environment (frame_ctx_p->lex_env_p, class_object_p, class_object_p, initializer_func_p);\n\n          if (!push_computed)\n          {\n            continue;\n          }\n\n          left_value = value;\n          /* FALLTHRU */\n        }\n        case VM_OC_ADD_COMPUTED_FIELD:\n        {\n          JERRY_ASSERT (byte_code_start_p[0] == CBC_EXT_OPCODE\n                        && (byte_code_start_p[1] == CBC_EXT_PUSH_STATIC_COMPUTED_FIELD_FUNC\n                            || byte_code_start_p[1] == CBC_EXT_ADD_COMPUTED_FIELD\n                            || byte_code_start_p[1] == CBC_EXT_ADD_STATIC_COMPUTED_FIELD));\n\n          int index = (byte_code_start_p[1] == CBC_EXT_ADD_COMPUTED_FIELD) ? -2 : -4;\n          result = opfunc_add_computed_field (stack_top_p[index], left_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n          goto free_left_value;\n        }\n        case VM_OC_COPY_DATA_PROPERTIES:\n        {\n          left_value = *(--stack_top_p);\n\n          if (ecma_is_value_undefined (left_value) || ecma_is_value_null (left_value))\n          {\n            continue;\n          }\n\n          result = opfunc_copy_data_properties (stack_top_p[-1], left_value, ECMA_VALUE_UNDEFINED);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          goto free_left_value;\n        }\n        case VM_OC_SET_COMPUTED_PROPERTY:\n        {\n          /* Swap values. */\n          left_value ^= right_value;\n          right_value ^= left_value;\n          left_value ^= right_value;\n          /* FALLTHRU */\n        }\n        case VM_OC_SET_PROPERTY:\n        {\n          JERRY_STATIC_ASSERT (VM_OC_NON_STATIC_FLAG == VM_OC_BACKWARD_BRANCH,\n                               vm_oc_non_static_flag_must_be_equal_to_vm_oc_backward_branch);\n\n          JERRY_ASSERT ((opcode_data >> VM_OC_NON_STATIC_SHIFT) <= 0x1);\n\n          ecma_string_t *prop_name_p = ecma_op_to_property_key (right_value);\n\n          if (JERRY_UNLIKELY (prop_name_p == NULL))\n          {\n            result = ECMA_VALUE_ERROR;\n            goto error;\n          }\n\n          if (JERRY_UNLIKELY (ecma_compare_ecma_string_to_magic_id (prop_name_p, LIT_MAGIC_STRING_PROTOTYPE))\n              && !(opcode_data & VM_OC_NON_STATIC_FLAG))\n          {\n            result = ecma_raise_type_error (ECMA_ERR_CLASS_IS_NON_CONFIGURABLE);\n            goto error;\n          }\n\n          const int index = (int) (opcode_data >> VM_OC_NON_STATIC_SHIFT) - 2;\n\n          ecma_object_t *object_p = ecma_get_object_from_value (stack_top_p[index]);\n\n          opfunc_set_data_property (object_p, prop_name_p, left_value);\n          ecma_deref_ecma_string (prop_name_p);\n\n          goto free_both_values;\n        }\n        case VM_OC_SET_GETTER:\n        case VM_OC_SET_SETTER:\n        {\n          JERRY_ASSERT ((opcode_data >> VM_OC_NON_STATIC_SHIFT) <= 0x1);\n\n          ecma_string_t *prop_name_p = ecma_op_to_property_key (left_value);\n\n          if (JERRY_UNLIKELY (prop_name_p == NULL))\n          {\n            result = ECMA_VALUE_ERROR;\n            goto error;\n          }\n\n          if (JERRY_UNLIKELY (ecma_compare_ecma_string_to_magic_id (prop_name_p, LIT_MAGIC_STRING_PROTOTYPE))\n              && !(opcode_data & VM_OC_NON_STATIC_FLAG))\n          {\n            result = ecma_raise_type_error (ECMA_ERR_CLASS_IS_NON_CONFIGURABLE);\n            goto error;\n          }\n\n          const int index = (int) (opcode_data >> VM_OC_NON_STATIC_SHIFT) - 2;\n          opfunc_set_accessor (VM_OC_GROUP_GET_INDEX (opcode_data) == VM_OC_SET_GETTER,\n                               stack_top_p[index],\n                               prop_name_p,\n                               right_value);\n\n          ecma_deref_ecma_string (prop_name_p);\n\n          goto free_both_values;\n        }\n        case VM_OC_PUSH_ARRAY:\n        {\n          /* Note: this operation cannot throw an exception */\n          *stack_top_p++ = ecma_make_object_value (ecma_op_new_array_object (0));\n          continue;\n        }\n        case VM_OC_LOCAL_EVAL:\n        {\n          ECMA_CLEAR_LOCAL_PARSE_OPTS ();\n          uint8_t parse_opts = *byte_code_p++;\n          ECMA_SET_LOCAL_PARSE_OPTS (parse_opts);\n          continue;\n        }\n        case VM_OC_SUPER_CALL:\n        {\n          uint8_t arguments_list_len = *byte_code_p++;\n\n          if (opcode >= CBC_EXT_SPREAD_SUPER_CALL)\n          {\n            stack_top_p -= arguments_list_len;\n            ecma_collection_t *arguments_p = opfunc_spread_arguments (stack_top_p, arguments_list_len);\n\n            if (JERRY_UNLIKELY (arguments_p == NULL))\n            {\n              result = ECMA_VALUE_ERROR;\n              goto error;\n            }\n\n            stack_top_p++;\n            ECMA_SET_INTERNAL_VALUE_POINTER (stack_top_p[-1], arguments_p);\n          }\n          else\n          {\n            stack_top_p -= arguments_list_len;\n          }\n\n          frame_ctx_p->call_operation = VM_EXEC_SUPER_CALL;\n          frame_ctx_p->byte_code_p = byte_code_start_p;\n          frame_ctx_p->stack_top_p = stack_top_p;\n          return ECMA_VALUE_UNDEFINED;\n        }\n        case VM_OC_PUSH_CLASS_ENVIRONMENT:\n        {\n          uint16_t literal_index;\n\n          READ_LITERAL_INDEX (literal_index);\n          opfunc_push_class_environment (frame_ctx_p, &stack_top_p, literal_start_p[literal_index]);\n          continue;\n        }\n        case VM_OC_PUSH_IMPLICIT_CTOR:\n        {\n          *stack_top_p++ = opfunc_create_implicit_class_constructor (opcode, frame_ctx_p->shared_p->bytecode_header_p);\n          continue;\n        }\n        case VM_OC_DEFINE_FIELD:\n        {\n          result = opfunc_define_field (frame_ctx_p->this_binding, right_value, left_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          goto free_both_values;\n        }\n        case VM_OC_ASSIGN_PRIVATE:\n        {\n          result = opfunc_private_set (stack_top_p[-3], stack_top_p[-2], stack_top_p[-1]);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          ecma_free_value (stack_top_p[-3]);\n          ecma_free_value (stack_top_p[-2]);\n          ecma_free_value (stack_top_p[-1]);\n          stack_top_p -= 3;\n\n          if (opcode_data & VM_OC_PUT_STACK)\n          {\n            *stack_top_p++ = result;\n          }\n          else if (opcode_data & VM_OC_PUT_BLOCK)\n          {\n            ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p, 0));\n            VM_GET_REGISTERS (frame_ctx_p)[0] = result;\n          }\n          else\n          {\n            ecma_free_value (result);\n          }\n\n          goto free_both_values;\n        }\n        case VM_OC_PRIVATE_FIELD_ADD:\n        {\n          result = opfunc_private_field_add (frame_ctx_p->this_binding, right_value, left_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          goto free_both_values;\n        }\n        case VM_OC_PRIVATE_PROP_GET:\n        {\n          result = opfunc_private_get (left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_PRIVATE_PROP_REFERENCE:\n        {\n          result = opfunc_private_get (stack_top_p[-1], left_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = left_value;\n          *stack_top_p++ = result;\n          continue;\n        }\n        case VM_OC_PRIVATE_IN:\n        {\n          result = opfunc_private_in (left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_COLLECT_PRIVATE_PROPERTY:\n        {\n          opfunc_collect_private_properties (stack_top_p[-2], left_value, right_value, opcode);\n          continue;\n        }\n        case VM_OC_INIT_CLASS:\n        {\n          result = opfunc_init_class (frame_ctx_p, stack_top_p);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n          continue;\n        }\n        case VM_OC_FINALIZE_CLASS:\n        {\n          JERRY_ASSERT (opcode == CBC_EXT_FINALIZE_NAMED_CLASS || opcode == CBC_EXT_FINALIZE_ANONYMOUS_CLASS);\n\n          if (opcode == CBC_EXT_FINALIZE_NAMED_CLASS)\n          {\n            uint16_t literal_index;\n            READ_LITERAL_INDEX (literal_index);\n            left_value = literal_start_p[literal_index];\n          }\n\n          opfunc_finalize_class (frame_ctx_p, &stack_top_p, left_value);\n          continue;\n        }\n        case VM_OC_SET_FIELD_INIT:\n        {\n          ecma_string_t *property_name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_INIT);\n          ecma_object_t *proto_object_p = ecma_get_object_from_value (stack_top_p[-1]);\n          ecma_object_t *class_object_p = ecma_get_object_from_value (stack_top_p[-2]);\n          ecma_object_t *initializer_func_p = ecma_get_object_from_value (left_value);\n\n          opfunc_bind_class_environment (frame_ctx_p->lex_env_p, proto_object_p, class_object_p, initializer_func_p);\n\n          ecma_property_value_t *property_value_p =\n            ecma_create_named_data_property (class_object_p, property_name_p, ECMA_PROPERTY_FIXED, NULL);\n          property_value_p->value = left_value;\n\n          property_name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_COMPUTED);\n          ecma_property_t *property_p = ecma_find_named_property (class_object_p, property_name_p);\n\n          if (property_p != NULL)\n          {\n            property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);\n            ecma_value_t *compact_collection_p =\n              ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, property_value_p->value);\n            compact_collection_p = ecma_compact_collection_shrink (compact_collection_p);\n            ECMA_SET_INTERNAL_VALUE_POINTER (property_value_p->value, compact_collection_p);\n          }\n\n          goto free_left_value;\n        }\n        case VM_OC_RUN_FIELD_INIT:\n        {\n          JERRY_ASSERT (frame_ctx_p->shared_p->status_flags & VM_FRAME_CTX_SHARED_NON_ARROW_FUNC);\n          result = opfunc_init_class_fields (frame_ctx_p->shared_p->function_object_p, frame_ctx_p->this_binding);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n          continue;\n        }\n        case VM_OC_RUN_STATIC_FIELD_INIT:\n        {\n          left_value = stack_top_p[-2];\n          stack_top_p[-2] = stack_top_p[-1];\n          stack_top_p--;\n\n          result = opfunc_init_static_class_fields (left_value, stack_top_p[-1]);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n          goto free_left_value;\n        }\n        case VM_OC_SET_NEXT_COMPUTED_FIELD:\n        {\n          ecma_integer_value_t next_index = ecma_get_integer_from_value (stack_top_p[-2]) + 1;\n          stack_top_p[-2] = ecma_make_integer_value (next_index);\n\n          JERRY_ASSERT (frame_ctx_p->shared_p->status_flags & VM_FRAME_CTX_SHARED_HAS_CLASS_FIELDS);\n\n          ecma_value_t *computed_class_fields_p = VM_GET_COMPUTED_CLASS_FIELDS (frame_ctx_p);\n          JERRY_ASSERT ((ecma_value_t) next_index < ECMA_COMPACT_COLLECTION_GET_SIZE (computed_class_fields_p));\n          ecma_value_t prop_name = computed_class_fields_p[next_index];\n\n          if (opcode == CBC_EXT_SET_NEXT_COMPUTED_FIELD_ANONYMOUS_FUNC)\n          {\n            ecma_object_t *func_obj_p = ecma_get_object_from_value (stack_top_p[-1]);\n\n            JERRY_ASSERT (ecma_find_named_property (func_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_NAME)) == NULL);\n            ecma_property_value_t *value_p;\n            value_p = ecma_create_named_data_property (func_obj_p,\n                                                       ecma_get_magic_string (LIT_MAGIC_STRING_NAME),\n                                                       ECMA_PROPERTY_FLAG_CONFIGURABLE,\n                                                       NULL);\n\n            if (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION)\n            {\n              ECMA_SET_SECOND_BIT_TO_POINTER_TAG (((ecma_extended_object_t *) func_obj_p)->u.function.scope_cp);\n            }\n\n            value_p->value = ecma_copy_value (prop_name);\n          }\n\n          result = opfunc_define_field (frame_ctx_p->this_binding, prop_name, stack_top_p[-1]);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          ecma_free_value (*(--stack_top_p));\n          continue;\n        }\n        case VM_OC_PUSH_SUPER_CONSTRUCTOR:\n        {\n          result = ecma_op_function_get_super_constructor (vm_get_class_function (frame_ctx_p));\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          continue;\n        }\n        case VM_OC_RESOLVE_LEXICAL_THIS:\n        {\n          result = ecma_op_get_this_binding (frame_ctx_p->lex_env_p);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          continue;\n        }\n        case VM_OC_OBJECT_LITERAL_HOME_ENV:\n        {\n          if (opcode == CBC_EXT_PUSH_OBJECT_SUPER_ENVIRONMENT)\n          {\n            ecma_value_t obj_value = stack_top_p[-1];\n            ecma_object_t *obj_env_p = ecma_create_lex_env_class (frame_ctx_p->lex_env_p, 0);\n\n            ECMA_SET_NON_NULL_POINTER (obj_env_p->u1.bound_object_cp, ecma_get_object_from_value (obj_value));\n            stack_top_p[-1] = ecma_make_object_value (obj_env_p);\n            *stack_top_p++ = obj_value;\n          }\n          else\n          {\n            JERRY_ASSERT (opcode == CBC_EXT_POP_OBJECT_SUPER_ENVIRONMENT);\n            ecma_deref_object (ecma_get_object_from_value (stack_top_p[-2]));\n            stack_top_p[-2] = stack_top_p[-1];\n            stack_top_p--;\n          }\n          continue;\n        }\n        case VM_OC_SET_HOME_OBJECT:\n        {\n          int offset = opcode == CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT_COMPUTED ? -1 : 0;\n          opfunc_set_home_object (ecma_get_object_from_value (stack_top_p[-1]),\n                                  ecma_get_object_from_value (stack_top_p[-3 + offset]));\n          continue;\n        }\n        case VM_OC_SUPER_REFERENCE:\n        {\n          result = opfunc_form_super_reference (&stack_top_p, frame_ctx_p, left_value, opcode);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          goto free_left_value;\n        }\n        case VM_OC_SET_FUNCTION_NAME:\n        {\n          char *prefix_p = NULL;\n          lit_utf8_size_t prefix_size = 0;\n\n          if (opcode != CBC_EXT_SET_FUNCTION_NAME)\n          {\n            ecma_value_t prop_name_value;\n\n            if (opcode == CBC_EXT_SET_CLASS_NAME)\n            {\n              uint16_t literal_index;\n              READ_LITERAL_INDEX (literal_index);\n              prop_name_value = literal_start_p[literal_index];\n            }\n            else\n            {\n              prop_name_value = stack_top_p[-2];\n            }\n\n            ecma_string_t *prop_name_p = ecma_op_to_property_key (prop_name_value);\n\n            if (JERRY_UNLIKELY (prop_name_p == NULL))\n            {\n              result = ECMA_VALUE_ERROR;\n              goto error;\n            }\n\n            left_value = ecma_make_prop_name_value (prop_name_p);\n\n            if (opcode != CBC_EXT_SET_CLASS_NAME)\n            {\n              ecma_ref_ecma_string (prop_name_p);\n              ecma_free_value (stack_top_p[-2]);\n              stack_top_p[-2] = left_value;\n            }\n\n            if (opcode == CBC_EXT_SET_COMPUTED_GETTER_NAME || opcode == CBC_EXT_SET_COMPUTED_SETTER_NAME)\n            {\n              prefix_p = (opcode == CBC_EXT_SET_COMPUTED_GETTER_NAME) ? \"get \" : \"set \";\n              prefix_size = 4;\n            }\n          }\n\n          ecma_object_t *func_obj_p = ecma_get_object_from_value (stack_top_p[-1]);\n\n          if (ecma_find_named_property (func_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_NAME)) != NULL)\n          {\n            ecma_free_value (left_value);\n            continue;\n          }\n\n          ecma_property_value_t *value_p;\n          value_p = ecma_create_named_data_property (func_obj_p,\n                                                     ecma_get_magic_string (LIT_MAGIC_STRING_NAME),\n                                                     ECMA_PROPERTY_FLAG_CONFIGURABLE,\n                                                     NULL);\n\n          if (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION)\n          {\n            ECMA_SET_SECOND_BIT_TO_POINTER_TAG (((ecma_extended_object_t *) func_obj_p)->u.function.scope_cp);\n          }\n\n          value_p->value =\n            ecma_op_function_form_name (ecma_get_prop_name_from_value (left_value), prefix_p, prefix_size);\n          ecma_free_value (left_value);\n          continue;\n        }\n        case VM_OC_PUSH_SPREAD_ELEMENT:\n        {\n          *stack_top_p++ = ECMA_VALUE_SPREAD_ELEMENT;\n          continue;\n        }\n        case VM_OC_PUSH_REST_OBJECT:\n        {\n          vm_frame_ctx_shared_t *shared_p = frame_ctx_p->shared_p;\n\n          JERRY_ASSERT (shared_p->status_flags & VM_FRAME_CTX_SHARED_HAS_ARG_LIST);\n\n          const ecma_value_t *arg_list_p = ((vm_frame_ctx_shared_args_t *) shared_p)->arg_list_p;\n          uint32_t arg_list_len = ((vm_frame_ctx_shared_args_t *) shared_p)->arg_list_len;\n          uint16_t argument_end;\n\n          if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n          {\n            argument_end = ((cbc_uint16_arguments_t *) bytecode_header_p)->argument_end;\n          }\n          else\n          {\n            argument_end = ((cbc_uint8_arguments_t *) bytecode_header_p)->argument_end;\n          }\n\n          if (arg_list_len < argument_end)\n          {\n            arg_list_len = argument_end;\n          }\n\n          result = ecma_op_new_array_object_from_buffer (arg_list_p + argument_end, arg_list_len - argument_end);\n\n          JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n          *stack_top_p++ = result;\n          continue;\n        }\n        case VM_OC_ITERATOR_CONTEXT_CREATE:\n        {\n          result = ecma_op_get_iterator (stack_top_p[-1], ECMA_VALUE_SYNC_ITERATOR, &left_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          uint32_t context_size =\n            (uint32_t) (stack_top_p + PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION - VM_LAST_CONTEXT_END ());\n          stack_top_p += PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION;\n          VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, context_size);\n\n          stack_top_p[-1] = VM_CREATE_CONTEXT (VM_CONTEXT_ITERATOR, context_size) | VM_CONTEXT_CLOSE_ITERATOR;\n          stack_top_p[-2] = result;\n          stack_top_p[-3] = left_value;\n\n          continue;\n        }\n        case VM_OC_ITERATOR_STEP:\n        {\n          ecma_value_t *last_context_end_p = VM_LAST_CONTEXT_END ();\n\n          ecma_value_t iterator = last_context_end_p[-2];\n          ecma_value_t next_method = last_context_end_p[-3];\n\n          result = ecma_op_iterator_step (iterator, next_method);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            last_context_end_p[-1] &= (uint32_t) ~VM_CONTEXT_CLOSE_ITERATOR;\n            goto error;\n          }\n\n          ecma_value_t value = ECMA_VALUE_UNDEFINED;\n\n          if (!ecma_is_value_false (result))\n          {\n            value = ecma_op_iterator_value (result);\n            ecma_free_value (result);\n\n            if (ECMA_IS_VALUE_ERROR (value))\n            {\n              last_context_end_p[-1] &= (uint32_t) ~VM_CONTEXT_CLOSE_ITERATOR;\n              result = value;\n              goto error;\n            }\n          }\n          else\n          {\n            last_context_end_p[-1] &= (uint32_t) ~VM_CONTEXT_CLOSE_ITERATOR;\n          }\n\n          *stack_top_p++ = value;\n          continue;\n        }\n        case VM_OC_ITERATOR_CONTEXT_END:\n        {\n          JERRY_ASSERT (VM_LAST_CONTEXT_END () == stack_top_p);\n\n          if (stack_top_p[-1] & VM_CONTEXT_CLOSE_ITERATOR)\n          {\n            stack_top_p[-1] &= (uint32_t) ~VM_CONTEXT_CLOSE_ITERATOR;\n            result = ecma_op_iterator_close (stack_top_p[-2]);\n\n            if (ECMA_IS_VALUE_ERROR (result))\n            {\n              goto error;\n            }\n          }\n\n          stack_top_p =\n            vm_stack_context_abort_variable_length (frame_ctx_p, stack_top_p, PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION);\n          continue;\n        }\n        case VM_OC_DEFAULT_INITIALIZER:\n        {\n          JERRY_ASSERT (stack_top_p > VM_GET_REGISTERS (frame_ctx_p) + register_end);\n\n          if (stack_top_p[-1] != ECMA_VALUE_UNDEFINED)\n          {\n            byte_code_p = byte_code_start_p + branch_offset;\n            continue;\n          }\n\n          stack_top_p--;\n          continue;\n        }\n        case VM_OC_REST_INITIALIZER:\n        {\n          ecma_object_t *array_p = ecma_op_new_array_object (0);\n          JERRY_ASSERT (ecma_op_object_is_fast_array (array_p));\n\n          ecma_value_t *last_context_end_p = VM_LAST_CONTEXT_END ();\n          ecma_value_t iterator = last_context_end_p[-2];\n          ecma_value_t next_method = last_context_end_p[-3];\n          uint32_t index = 0;\n\n          while (true)\n          {\n            result = ecma_op_iterator_step (iterator, next_method);\n\n            if (ECMA_IS_VALUE_ERROR (result))\n            {\n              last_context_end_p[-1] &= (uint32_t) ~VM_CONTEXT_CLOSE_ITERATOR;\n              ecma_deref_object (array_p);\n              goto error;\n            }\n\n            if (ecma_is_value_false (result))\n            {\n              last_context_end_p[-1] &= (uint32_t) ~VM_CONTEXT_CLOSE_ITERATOR;\n              break;\n            }\n\n            ecma_value_t value = ecma_op_iterator_value (result);\n            ecma_free_value (result);\n\n            if (ECMA_IS_VALUE_ERROR (value))\n            {\n              ecma_deref_object (array_p);\n              result = value;\n              goto error;\n            }\n\n            bool set_result = ecma_fast_array_set_property (array_p, index++, value);\n            JERRY_ASSERT (set_result);\n            ecma_free_value (value);\n          }\n\n          *stack_top_p++ = ecma_make_object_value (array_p);\n          continue;\n        }\n        case VM_OC_OBJ_INIT_CONTEXT_CREATE:\n        {\n          left_value = stack_top_p[-1];\n          vm_stack_context_type_t context_type = VM_CONTEXT_OBJ_INIT;\n          uint32_t context_stack_allocation = PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION;\n\n          if (opcode == CBC_EXT_OBJ_INIT_REST_CONTEXT_CREATE)\n          {\n            context_type = VM_CONTEXT_OBJ_INIT_REST;\n            context_stack_allocation = PARSER_OBJ_INIT_REST_CONTEXT_STACK_ALLOCATION;\n          }\n\n          uint32_t context_size = (uint32_t) (stack_top_p + context_stack_allocation - VM_LAST_CONTEXT_END ());\n          stack_top_p += context_stack_allocation;\n          VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, context_size);\n\n          stack_top_p[-1] = VM_CREATE_CONTEXT (context_type, context_size);\n          stack_top_p[-2] = left_value;\n\n          if (context_type == VM_CONTEXT_OBJ_INIT_REST)\n          {\n            stack_top_p[-3] = ecma_make_object_value (ecma_op_new_array_object (0));\n          }\n          continue;\n        }\n        case VM_OC_OBJ_INIT_CONTEXT_END:\n        {\n          JERRY_ASSERT (stack_top_p == VM_LAST_CONTEXT_END ());\n\n          uint32_t context_stack_allocation = PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION;\n\n          if (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_OBJ_INIT_REST)\n          {\n            context_stack_allocation = PARSER_OBJ_INIT_REST_CONTEXT_STACK_ALLOCATION;\n          }\n\n          stack_top_p = vm_stack_context_abort_variable_length (frame_ctx_p, stack_top_p, context_stack_allocation);\n          continue;\n        }\n        case VM_OC_OBJ_INIT_PUSH_REST:\n        {\n          ecma_value_t *last_context_end_p = VM_LAST_CONTEXT_END ();\n          if (!ecma_op_require_object_coercible (last_context_end_p[-2]))\n          {\n            result = ECMA_VALUE_ERROR;\n            goto error;\n          }\n\n          ecma_object_t *prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);\n          ecma_object_t *result_object_p = ecma_create_object (prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL);\n\n          left_value = ecma_make_object_value (result_object_p);\n          result = opfunc_copy_data_properties (left_value, last_context_end_p[-2], last_context_end_p[-3]);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          ecma_free_value (last_context_end_p[-3]);\n          last_context_end_p[-3] = last_context_end_p[-2];\n          last_context_end_p[-2] = ECMA_VALUE_UNDEFINED;\n\n          *stack_top_p++ = left_value;\n          continue;\n        }\n        case VM_OC_INITIALIZER_PUSH_NAME:\n        {\n          if (JERRY_UNLIKELY (!ecma_is_value_prop_name (left_value)))\n          {\n            ecma_string_t *property_key = ecma_op_to_property_key (left_value);\n\n            if (property_key == NULL)\n            {\n              result = ECMA_VALUE_ERROR;\n              goto error;\n            }\n\n            ecma_free_value (left_value);\n            left_value = ecma_make_string_value (property_key);\n          }\n\n          ecma_value_t *last_context_end_p = VM_LAST_CONTEXT_END ();\n          ecma_object_t *array_obj_p = ecma_get_object_from_value (last_context_end_p[-3]);\n          JERRY_ASSERT (ecma_get_object_type (array_obj_p) == ECMA_OBJECT_TYPE_ARRAY);\n\n          ecma_extended_object_t *ext_array_obj_p = (ecma_extended_object_t *) array_obj_p;\n          ecma_fast_array_set_property (array_obj_p, ext_array_obj_p->u.array.length, left_value);\n          /* FALLTHRU */\n        }\n        case VM_OC_INITIALIZER_PUSH_PROP:\n        {\n          ecma_value_t *last_context_end_p = VM_LAST_CONTEXT_END ();\n          ecma_value_t base = last_context_end_p[-2];\n\n          if (opcode == CBC_EXT_INITIALIZER_PUSH_PROP)\n          {\n            left_value = *last_context_end_p++;\n            while (last_context_end_p < stack_top_p)\n            {\n              last_context_end_p[-1] = *last_context_end_p;\n              last_context_end_p++;\n            }\n            stack_top_p--;\n          }\n\n          result = vm_op_get_value (base, left_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_left_value;\n        }\n        case VM_OC_SPREAD_ARGUMENTS:\n        {\n          uint8_t arguments_list_len = *byte_code_p++;\n          stack_top_p -= arguments_list_len;\n\n          ecma_collection_t *arguments_p = opfunc_spread_arguments (stack_top_p, arguments_list_len);\n\n          if (JERRY_UNLIKELY (arguments_p == NULL))\n          {\n            result = ECMA_VALUE_ERROR;\n            goto error;\n          }\n\n          stack_top_p++;\n          ECMA_SET_INTERNAL_VALUE_POINTER (stack_top_p[-1], arguments_p);\n\n          frame_ctx_p->call_operation = VM_EXEC_SPREAD_OP;\n          frame_ctx_p->byte_code_p = byte_code_start_p;\n          frame_ctx_p->stack_top_p = stack_top_p;\n          return ECMA_VALUE_UNDEFINED;\n        }\n        case VM_OC_CREATE_GENERATOR:\n        {\n          frame_ctx_p->call_operation = VM_EXEC_RETURN;\n          frame_ctx_p->byte_code_p = byte_code_p;\n          frame_ctx_p->stack_top_p = stack_top_p;\n\n          vm_executable_object_t *executable_object_p;\n          executable_object_p = opfunc_create_executable_object (frame_ctx_p, VM_CREATE_EXECUTABLE_OBJECT_GENERATOR);\n\n          return ecma_make_object_value ((ecma_object_t *) executable_object_p);\n        }\n        case VM_OC_YIELD:\n        {\n          frame_ctx_p->call_operation = VM_EXEC_RETURN;\n          frame_ctx_p->byte_code_p = byte_code_p;\n          frame_ctx_p->stack_top_p = --stack_top_p;\n          return *stack_top_p;\n        }\n        case VM_OC_ASYNC_YIELD:\n        {\n          ecma_extended_object_t *async_generator_object_p = VM_GET_EXECUTABLE_OBJECT (frame_ctx_p);\n\n          opfunc_async_generator_yield (async_generator_object_p, stack_top_p[-1]);\n\n          frame_ctx_p->call_operation = VM_EXEC_RETURN;\n          frame_ctx_p->byte_code_p = byte_code_p;\n          frame_ctx_p->stack_top_p = --stack_top_p;\n          return ECMA_VALUE_UNDEFINED;\n        }\n        case VM_OC_ASYNC_YIELD_ITERATOR:\n        {\n          ecma_extended_object_t *async_generator_object_p = VM_GET_EXECUTABLE_OBJECT (frame_ctx_p);\n\n          JERRY_ASSERT (\n            !(async_generator_object_p->u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD));\n\n          /* Byte code is executed at the first time. */\n          left_value = stack_top_p[-1];\n          result = ecma_op_get_iterator (left_value, ECMA_VALUE_ASYNC_ITERATOR, stack_top_p - 1);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          ecma_free_value (left_value);\n          left_value = result;\n          result = ecma_op_iterator_next (left_value, stack_top_p[-1], ECMA_VALUE_UNDEFINED);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          result = ecma_promise_async_await (async_generator_object_p, result);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          async_generator_object_p->u.cls.u2.executable_obj_flags |= ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD;\n          *VM_GET_EXECUTABLE_ITERATOR (frame_ctx_p) = left_value;\n\n          frame_ctx_p->call_operation = VM_EXEC_RETURN;\n          frame_ctx_p->byte_code_p = byte_code_p;\n          frame_ctx_p->stack_top_p = stack_top_p;\n          return ECMA_VALUE_UNDEFINED;\n        }\n        case VM_OC_AWAIT:\n        {\n          if (JERRY_UNLIKELY (!(frame_ctx_p->shared_p->status_flags & VM_FRAME_CTX_SHARED_EXECUTABLE)))\n          {\n            frame_ctx_p->call_operation = VM_EXEC_RETURN;\n            frame_ctx_p->byte_code_p = byte_code_p;\n            frame_ctx_p->stack_top_p = --stack_top_p;\n\n            result = opfunc_async_create_and_await (frame_ctx_p, *stack_top_p, 0);\n\n            if (ECMA_IS_VALUE_ERROR (result))\n            {\n              goto error;\n            }\n            return result;\n          }\n          /* FALLTHRU */\n        }\n        case VM_OC_GENERATOR_AWAIT:\n        {\n          ecma_extended_object_t *async_generator_object_p = VM_GET_EXECUTABLE_OBJECT (frame_ctx_p);\n\n          result = ecma_promise_async_await (async_generator_object_p, *(--stack_top_p));\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          frame_ctx_p->call_operation = VM_EXEC_RETURN;\n          frame_ctx_p->byte_code_p = byte_code_p;\n          frame_ctx_p->stack_top_p = stack_top_p;\n          return ECMA_VALUE_UNDEFINED;\n        }\n        case VM_OC_EXT_RETURN:\n        {\n          result = left_value;\n          left_value = ECMA_VALUE_UNDEFINED;\n\n          ecma_value_t *stack_bottom_p = VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth;\n\n          while (stack_top_p > stack_bottom_p)\n          {\n            ecma_fast_free_value (*(--stack_top_p));\n          }\n\n          goto error;\n        }\n        case VM_OC_ASYNC_EXIT:\n        {\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n\n          if (!(frame_ctx_p->shared_p->status_flags & VM_FRAME_CTX_SHARED_EXECUTABLE))\n          {\n            result = ecma_op_create_promise_object (ECMA_VALUE_EMPTY, ECMA_VALUE_UNDEFINED, NULL);\n          }\n          else\n          {\n            result = *VM_GET_EXECUTABLE_ITERATOR (frame_ctx_p);\n            *VM_GET_EXECUTABLE_ITERATOR (frame_ctx_p) = ECMA_VALUE_UNDEFINED;\n          }\n\n          vm_stack_context_type_t context_type = VM_GET_CONTEXT_TYPE (stack_top_p[-1]);\n\n          if (context_type == VM_CONTEXT_TRY)\n          {\n            JERRY_ASSERT (frame_ctx_p->context_depth == PARSER_TRY_CONTEXT_STACK_ALLOCATION);\n            left_value = ECMA_VALUE_UNDEFINED;\n          }\n          else\n          {\n            JERRY_ASSERT (frame_ctx_p->context_depth == PARSER_FINALLY_CONTEXT_STACK_ALLOCATION);\n            left_value = stack_top_p[-2];\n          }\n\n          if (context_type == VM_CONTEXT_FINALLY_THROW)\n          {\n            ecma_reject_promise (result, left_value);\n          }\n          else\n          {\n            JERRY_ASSERT (context_type == VM_CONTEXT_TRY || context_type == VM_CONTEXT_FINALLY_RETURN);\n            ecma_fulfill_promise (result, left_value);\n          }\n\n          ecma_free_value (left_value);\n\n          frame_ctx_p->context_depth = 0;\n          frame_ctx_p->call_operation = VM_NO_EXEC_OP;\n          return result;\n        }\n        case VM_OC_STRING_CONCAT:\n        {\n          ecma_string_t *left_str_p = ecma_op_to_string (left_value);\n\n          if (JERRY_UNLIKELY (left_str_p == NULL))\n          {\n            result = ECMA_VALUE_ERROR;\n            goto error;\n          }\n          ecma_string_t *right_str_p = ecma_op_to_string (right_value);\n\n          if (JERRY_UNLIKELY (right_str_p == NULL))\n          {\n            ecma_deref_ecma_string (left_str_p);\n            result = ECMA_VALUE_ERROR;\n            goto error;\n          }\n\n          ecma_string_t *result_str_p = ecma_concat_ecma_strings (left_str_p, right_str_p);\n          ecma_deref_ecma_string (right_str_p);\n\n          *stack_top_p++ = ecma_make_string_value (result_str_p);\n          goto free_both_values;\n        }\n        case VM_OC_GET_TEMPLATE_OBJECT:\n        {\n          uint8_t tagged_idx = *byte_code_p++;\n          ecma_collection_t *collection_p = ecma_compiled_code_get_tagged_template_collection (bytecode_header_p);\n          JERRY_ASSERT (tagged_idx < collection_p->item_count);\n\n          *stack_top_p++ = ecma_copy_value (collection_p->buffer_p[tagged_idx]);\n          continue;\n        }\n        case VM_OC_PUSH_NEW_TARGET:\n        {\n          ecma_object_t *new_target_object_p = JERRY_CONTEXT (current_new_target_p);\n          if (new_target_object_p == NULL)\n          {\n            *stack_top_p++ = ECMA_VALUE_UNDEFINED;\n          }\n          else\n          {\n            ecma_ref_object (new_target_object_p);\n            *stack_top_p++ = ecma_make_object_value (new_target_object_p);\n          }\n          continue;\n        }\n        case VM_OC_REQUIRE_OBJECT_COERCIBLE:\n        {\n          if (!ecma_op_require_object_coercible (stack_top_p[-1]))\n          {\n            result = ECMA_VALUE_ERROR;\n            goto error;\n          }\n          continue;\n        }\n        case VM_OC_ASSIGN_SUPER:\n        {\n          result = opfunc_assign_super_reference (&stack_top_p, frame_ctx_p, opcode_data);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n          continue;\n        }\n        case VM_OC_PUSH_ELISON:\n        {\n          *stack_top_p++ = ECMA_VALUE_ARRAY_HOLE;\n          continue;\n        }\n        case VM_OC_APPEND_ARRAY:\n        {\n          uint16_t values_length = *byte_code_p++;\n          stack_top_p -= values_length;\n\n          if (*byte_code_start_p == CBC_EXT_OPCODE)\n          {\n            values_length = (uint16_t) (values_length | OPFUNC_HAS_SPREAD_ELEMENT);\n          }\n          result = opfunc_append_array (stack_top_p, values_length);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          continue;\n        }\n        case VM_OC_IDENT_REFERENCE:\n        {\n          uint16_t literal_index;\n\n          READ_LITERAL_INDEX (literal_index);\n\n          JERRY_ASSERT (literal_index < ident_end);\n\n          if (literal_index < register_end)\n          {\n            *stack_top_p++ = ECMA_VALUE_REGISTER_REF;\n            *stack_top_p++ = ecma_make_integer_value (literal_index);\n            *stack_top_p++ = ecma_fast_copy_value (VM_GET_REGISTER (frame_ctx_p, literal_index));\n          }\n          else\n          {\n            ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n\n            ecma_object_t *ref_base_lex_env_p;\n\n            result = ecma_op_get_value_lex_env_base (frame_ctx_p->lex_env_p, &ref_base_lex_env_p, name_p);\n\n            if (ECMA_IS_VALUE_ERROR (result))\n            {\n              goto error;\n            }\n\n            ecma_ref_object (ref_base_lex_env_p);\n            ecma_ref_ecma_string (name_p);\n            *stack_top_p++ = ecma_make_object_value (ref_base_lex_env_p);\n            *stack_top_p++ = ecma_make_string_value (name_p);\n            *stack_top_p++ = result;\n          }\n          continue;\n        }\n        case VM_OC_PROP_GET:\n        {\n          result = vm_op_get_value (left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_PROP_REFERENCE:\n        {\n          /* Forms with reference requires preserving the base and offset. */\n\n          if (opcode == CBC_PUSH_PROP_REFERENCE)\n          {\n            left_value = stack_top_p[-2];\n            right_value = stack_top_p[-1];\n          }\n          else if (opcode == CBC_PUSH_PROP_LITERAL_REFERENCE)\n          {\n            *stack_top_p++ = left_value;\n            right_value = left_value;\n            left_value = stack_top_p[-2];\n          }\n          else\n          {\n            JERRY_ASSERT (opcode == CBC_PUSH_PROP_LITERAL_LITERAL_REFERENCE\n                          || opcode == CBC_PUSH_PROP_THIS_LITERAL_REFERENCE);\n            *stack_top_p++ = left_value;\n            *stack_top_p++ = right_value;\n          }\n          /* FALLTHRU */\n        }\n        case VM_OC_PROP_PRE_INCR:\n        case VM_OC_PROP_PRE_DECR:\n        case VM_OC_PROP_POST_INCR:\n        case VM_OC_PROP_POST_DECR:\n        {\n          result = vm_op_get_value (left_value, right_value);\n\n          if (opcode < CBC_PRE_INCR)\n          {\n            left_value = ECMA_VALUE_UNDEFINED;\n            right_value = ECMA_VALUE_UNDEFINED;\n          }\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          if (opcode < CBC_PRE_INCR)\n          {\n            break;\n          }\n\n          stack_top_p += 2;\n          left_value = result;\n          right_value = ECMA_VALUE_UNDEFINED;\n          /* FALLTHRU */\n        }\n        case VM_OC_PRE_INCR:\n        case VM_OC_PRE_DECR:\n        case VM_OC_POST_INCR:\n        case VM_OC_POST_DECR:\n        {\n          uint32_t opcode_flags = VM_OC_GROUP_GET_INDEX (opcode_data) - VM_OC_PROP_PRE_INCR;\n          ecma_number_t result_number;\n\n          byte_code_p = byte_code_start_p + 1;\n\n          if (ecma_is_value_integer_number (left_value))\n          {\n            result = left_value;\n            left_value = ECMA_VALUE_UNDEFINED;\n\n            ecma_integer_value_t int_value = (ecma_integer_value_t) result;\n            ecma_integer_value_t int_increase = 0;\n\n            if (opcode_flags & VM_OC_DECREMENT_OPERATOR_FLAG)\n            {\n              if (int_value > ECMA_INTEGER_NUMBER_MIN_SHIFTED)\n              {\n                int_increase = -(1 << ECMA_DIRECT_SHIFT);\n              }\n            }\n            else if (int_value < ECMA_INTEGER_NUMBER_MAX_SHIFTED)\n            {\n              int_increase = 1 << ECMA_DIRECT_SHIFT;\n            }\n\n            if (JERRY_LIKELY (int_increase != 0))\n            {\n              /* Postfix operators require the unmodifed number value. */\n              if (opcode_flags & VM_OC_POST_INCR_DECR_OPERATOR_FLAG)\n              {\n                POST_INCREASE_DECREASE_PUT_RESULT (result);\n              }\n\n              result = (ecma_value_t) (int_value + int_increase);\n              break;\n            }\n            result_number = (ecma_number_t) ecma_get_integer_from_value (result);\n          }\n          else if (ecma_is_value_float_number (left_value))\n          {\n            result = left_value;\n            left_value = ECMA_VALUE_UNDEFINED;\n            result_number = ecma_get_number_from_value (result);\n          }\n          else\n          {\n            result = ecma_op_to_numeric (left_value, &result_number, ECMA_TO_NUMERIC_ALLOW_BIGINT);\n\n            if (ECMA_IS_VALUE_ERROR (result))\n            {\n              goto error;\n            }\n\n            ecma_free_value (left_value);\n            left_value = ECMA_VALUE_UNDEFINED;\n\n#if JERRY_BUILTIN_BIGINT\n            if (JERRY_UNLIKELY (ecma_is_value_bigint (result)))\n            {\n              ecma_bigint_unary_operation_type operation_type = ECMA_BIGINT_UNARY_INCREASE;\n\n              if (opcode_flags & VM_OC_DECREMENT_OPERATOR_FLAG)\n              {\n                operation_type = ECMA_BIGINT_UNARY_DECREASE;\n              }\n\n              /* Postfix operators require the unmodifed number value. */\n              if (opcode_flags & VM_OC_POST_INCR_DECR_OPERATOR_FLAG)\n              {\n                POST_INCREASE_DECREASE_PUT_RESULT (result);\n\n                result = ecma_bigint_unary (result, operation_type);\n              }\n              else\n              {\n                ecma_value_t original_value = result;\n                result = ecma_bigint_unary (original_value, operation_type);\n                ecma_free_value (original_value);\n              }\n\n              if (ECMA_IS_VALUE_ERROR (result))\n              {\n                goto error;\n              }\n              break;\n            }\n#endif /* JERRY_BUILTIN_BIGINT */\n\n            result = ecma_make_number_value (result_number);\n          }\n\n          ecma_number_t increase = ECMA_NUMBER_ONE;\n\n          if (opcode_flags & VM_OC_DECREMENT_OPERATOR_FLAG)\n          {\n            /* For decrement operators */\n            increase = ECMA_NUMBER_MINUS_ONE;\n          }\n\n          /* Postfix operators require the unmodifed number value. */\n          if (opcode_flags & VM_OC_POST_INCR_DECR_OPERATOR_FLAG)\n          {\n            POST_INCREASE_DECREASE_PUT_RESULT (result);\n\n            result = ecma_make_number_value (result_number + increase);\n            break;\n          }\n\n          if (ecma_is_value_integer_number (result))\n          {\n            result = ecma_make_number_value (result_number + increase);\n          }\n          else\n          {\n            result = ecma_update_float_number (result, result_number + increase);\n          }\n          break;\n        }\n        case VM_OC_ASSIGN:\n        {\n          result = left_value;\n          left_value = ECMA_VALUE_UNDEFINED;\n          break;\n        }\n        case VM_OC_MOV_IDENT:\n        {\n          uint32_t literal_index;\n\n          READ_LITERAL_INDEX (literal_index);\n\n          JERRY_ASSERT (literal_index < register_end);\n          JERRY_ASSERT (!(opcode_data & (VM_OC_PUT_STACK | VM_OC_PUT_BLOCK)));\n\n          ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p, literal_index));\n          VM_GET_REGISTER (frame_ctx_p, literal_index) = left_value;\n          continue;\n        }\n        case VM_OC_ASSIGN_PROP:\n        {\n          result = stack_top_p[-1];\n          stack_top_p[-1] = left_value;\n          left_value = ECMA_VALUE_UNDEFINED;\n          break;\n        }\n        case VM_OC_ASSIGN_PROP_THIS:\n        {\n          result = stack_top_p[-1];\n          stack_top_p[-1] = ecma_copy_value (frame_ctx_p->this_binding);\n          *stack_top_p++ = left_value;\n          left_value = ECMA_VALUE_UNDEFINED;\n          break;\n        }\n        case VM_OC_RETURN_FUNCTION_END:\n        {\n          if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) == CBC_FUNCTION_SCRIPT)\n          {\n            result = VM_GET_REGISTER (frame_ctx_p, 0);\n            VM_GET_REGISTERS (frame_ctx_p)[0] = ECMA_VALUE_UNDEFINED;\n          }\n          else\n          {\n            result = ECMA_VALUE_UNDEFINED;\n          }\n\n          goto error;\n        }\n        case VM_OC_RETURN:\n        {\n          JERRY_ASSERT (opcode == CBC_RETURN || opcode == CBC_RETURN_WITH_LITERAL);\n\n          result = left_value;\n          left_value = ECMA_VALUE_UNDEFINED;\n          goto error;\n        }\n        case VM_OC_THROW:\n        {\n          jcontext_raise_exception (left_value);\n\n          result = ECMA_VALUE_ERROR;\n          left_value = ECMA_VALUE_UNDEFINED;\n          goto error;\n        }\n        case VM_OC_THROW_REFERENCE_ERROR:\n        {\n          result = ecma_raise_reference_error (ECMA_ERR_UNDEFINED_REFERENCE);\n          goto error;\n        }\n        case VM_OC_EVAL:\n        {\n          JERRY_CONTEXT (status_flags) |= ECMA_STATUS_DIRECT_EVAL;\n          continue;\n        }\n        case VM_OC_CALL:\n        {\n          frame_ctx_p->call_operation = VM_EXEC_CALL;\n          frame_ctx_p->byte_code_p = byte_code_start_p;\n          frame_ctx_p->stack_top_p = stack_top_p;\n          return ECMA_VALUE_UNDEFINED;\n        }\n        case VM_OC_NEW:\n        {\n          frame_ctx_p->call_operation = VM_EXEC_CONSTRUCT;\n          frame_ctx_p->byte_code_p = byte_code_start_p;\n          frame_ctx_p->stack_top_p = stack_top_p;\n          return ECMA_VALUE_UNDEFINED;\n        }\n        case VM_OC_ERROR:\n        {\n          JERRY_ASSERT (frame_ctx_p->byte_code_p[1] == CBC_EXT_ERROR);\n#if JERRY_DEBUGGER\n          frame_ctx_p->byte_code_p = JERRY_CONTEXT (debugger_exception_byte_code_p);\n#endif /* JERRY_DEBUGGER */\n\n          result = ECMA_VALUE_ERROR;\n          goto error;\n        }\n        case VM_OC_RESOLVE_BASE_FOR_CALL:\n        {\n          ecma_value_t this_value = stack_top_p[-3];\n\n          if (this_value == ECMA_VALUE_REGISTER_REF)\n          {\n            /* Lexical environment cannot be 'this' value. */\n            stack_top_p[-2] = ECMA_VALUE_UNDEFINED;\n            stack_top_p[-3] = ECMA_VALUE_UNDEFINED;\n          }\n          else if (vm_get_implicit_this_value (&this_value))\n          {\n            ecma_free_value (stack_top_p[-3]);\n            stack_top_p[-3] = this_value;\n          }\n\n          continue;\n        }\n        case VM_OC_PROP_DELETE:\n        {\n          result = vm_op_delete_prop (left_value, right_value, is_strict);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          JERRY_ASSERT (ecma_is_value_boolean (result));\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_DELETE:\n        {\n          uint16_t literal_index;\n\n          READ_LITERAL_INDEX (literal_index);\n\n          if (literal_index < register_end)\n          {\n            *stack_top_p++ = ECMA_VALUE_FALSE;\n            continue;\n          }\n\n          result = vm_op_delete_var (literal_start_p[literal_index], frame_ctx_p->lex_env_p);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          JERRY_ASSERT (ecma_is_value_boolean (result));\n\n          *stack_top_p++ = result;\n          continue;\n        }\n        case VM_OC_JUMP:\n        {\n          byte_code_p = byte_code_start_p + branch_offset;\n          continue;\n        }\n        case VM_OC_BRANCH_IF_STRICT_EQUAL:\n        {\n          ecma_value_t value = *(--stack_top_p);\n\n          JERRY_ASSERT (stack_top_p > VM_GET_REGISTERS (frame_ctx_p) + register_end);\n\n          if (ecma_op_strict_equality_compare (value, stack_top_p[-1]))\n          {\n            byte_code_p = byte_code_start_p + branch_offset;\n            ecma_free_value (*--stack_top_p);\n          }\n          ecma_free_value (value);\n          continue;\n        }\n        case VM_OC_BRANCH_IF_TRUE:\n        case VM_OC_BRANCH_IF_FALSE:\n        case VM_OC_BRANCH_IF_LOGICAL_TRUE:\n        case VM_OC_BRANCH_IF_LOGICAL_FALSE:\n        {\n          uint32_t opcode_flags = VM_OC_GROUP_GET_INDEX (opcode_data) - VM_OC_BRANCH_IF_TRUE;\n          ecma_value_t value = *(--stack_top_p);\n\n          bool boolean_value = ecma_op_to_boolean (value);\n\n          if (opcode_flags & VM_OC_BRANCH_IF_FALSE_FLAG)\n          {\n            boolean_value = !boolean_value;\n          }\n\n          if (boolean_value)\n          {\n            byte_code_p = byte_code_start_p + branch_offset;\n            if (opcode_flags & VM_OC_LOGICAL_BRANCH_FLAG)\n            {\n              /* \"Push\" the value back to the stack. */\n              ++stack_top_p;\n              continue;\n            }\n          }\n\n          ecma_fast_free_value (value);\n          continue;\n        }\n        case VM_OC_BRANCH_OPTIONAL_CHAIN:\n        {\n          left_value = stack_top_p[-1];\n\n          bool pop_reference = byte_code_p[0] == CBC_EXT_OPCODE && byte_code_p[1] == CBC_EXT_POP_REFERENCE;\n\n          if (!(ecma_is_value_null (left_value) || ecma_is_value_undefined (left_value)))\n          {\n            if (pop_reference)\n            {\n              byte_code_p += 2;\n            }\n\n            continue;\n          }\n\n          stack_top_p[-1] = ECMA_VALUE_UNDEFINED;\n          byte_code_p = byte_code_start_p + branch_offset;\n\n          if (!pop_reference)\n          {\n            continue;\n          }\n          /* FALLTHRU */\n        }\n        case VM_OC_POP_REFERENCE:\n        {\n          ecma_free_value (stack_top_p[-2]);\n          ecma_free_value (stack_top_p[-3]);\n          stack_top_p[-3] = stack_top_p[-1];\n          stack_top_p -= 2;\n          continue;\n        }\n        case VM_OC_BRANCH_IF_NULLISH:\n        {\n          left_value = stack_top_p[-1];\n\n          if (!ecma_is_value_null (left_value) && !ecma_is_value_undefined (left_value))\n          {\n            byte_code_p = byte_code_start_p + branch_offset;\n            continue;\n          }\n          --stack_top_p;\n          continue;\n        }\n        case VM_OC_PLUS:\n        case VM_OC_MINUS:\n        {\n          result = opfunc_unary_operation (left_value, VM_OC_GROUP_GET_INDEX (opcode_data) == VM_OC_PLUS);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_left_value;\n        }\n        case VM_OC_NOT:\n        {\n          *stack_top_p++ = ecma_make_boolean_value (!ecma_op_to_boolean (left_value));\n          JERRY_ASSERT (ecma_is_value_boolean (stack_top_p[-1]));\n          goto free_left_value;\n        }\n        case VM_OC_BIT_NOT:\n        {\n          JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_MASK == ((1 << ECMA_DIRECT_SHIFT) - 1),\n                               direct_type_mask_must_fill_all_bits_before_the_value_starts);\n\n          if (ecma_is_value_integer_number (left_value))\n          {\n            *stack_top_p++ = (~ECMA_DIRECT_TYPE_MASK) ^ left_value;\n            goto free_left_value;\n          }\n\n          result = do_number_bitwise_not (left_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_left_value;\n        }\n        case VM_OC_VOID:\n        {\n          *stack_top_p++ = ECMA_VALUE_UNDEFINED;\n          goto free_left_value;\n        }\n        case VM_OC_TYPEOF_IDENT:\n        {\n          uint16_t literal_index;\n\n          READ_LITERAL_INDEX (literal_index);\n\n          JERRY_ASSERT (literal_index < ident_end);\n\n          if (literal_index < register_end)\n          {\n            left_value = ecma_copy_value (VM_GET_REGISTER (frame_ctx_p, literal_index));\n          }\n          else\n          {\n            ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n\n            ecma_object_t *ref_base_lex_env_p;\n\n            result = ecma_op_get_value_lex_env_base (frame_ctx_p->lex_env_p, &ref_base_lex_env_p, name_p);\n\n            if (ref_base_lex_env_p == NULL)\n            {\n              jcontext_release_exception ();\n              result = ECMA_VALUE_UNDEFINED;\n            }\n            else if (ECMA_IS_VALUE_ERROR (result))\n            {\n              goto error;\n            }\n\n            left_value = result;\n          }\n          /* FALLTHRU */\n        }\n        case VM_OC_TYPEOF:\n        {\n          result = opfunc_typeof (left_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_left_value;\n        }\n        case VM_OC_ADD:\n        {\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            ecma_integer_value_t left_integer = ecma_get_integer_from_value (left_value);\n            ecma_integer_value_t right_integer = ecma_get_integer_from_value (right_value);\n            *stack_top_p++ = ecma_make_int32_value ((int32_t) (left_integer + right_integer));\n            continue;\n          }\n\n          if (ecma_is_value_float_number (left_value) && ecma_is_value_number (right_value))\n          {\n            ecma_number_t new_value =\n              (ecma_get_float_from_value (left_value) + ecma_get_number_from_value (right_value));\n\n            *stack_top_p++ = ecma_update_float_number (left_value, new_value);\n            ecma_free_number (right_value);\n            continue;\n          }\n\n          if (ecma_is_value_float_number (right_value) && ecma_is_value_integer_number (left_value))\n          {\n            ecma_number_t new_value =\n              ((ecma_number_t) ecma_get_integer_from_value (left_value) + ecma_get_float_from_value (right_value));\n\n            *stack_top_p++ = ecma_update_float_number (right_value, new_value);\n            continue;\n          }\n\n          result = opfunc_addition (left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_SUB:\n        {\n          JERRY_STATIC_ASSERT (ECMA_INTEGER_NUMBER_MAX * 2 <= INT32_MAX && ECMA_INTEGER_NUMBER_MIN * 2 >= INT32_MIN,\n                               doubled_ecma_numbers_must_fit_into_int32_range);\n\n          JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));\n\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            ecma_integer_value_t left_integer = ecma_get_integer_from_value (left_value);\n            ecma_integer_value_t right_integer = ecma_get_integer_from_value (right_value);\n            *stack_top_p++ = ecma_make_int32_value ((int32_t) (left_integer - right_integer));\n            continue;\n          }\n\n          if (ecma_is_value_float_number (left_value) && ecma_is_value_number (right_value))\n          {\n            ecma_number_t new_value =\n              (ecma_get_float_from_value (left_value) - ecma_get_number_from_value (right_value));\n\n            *stack_top_p++ = ecma_update_float_number (left_value, new_value);\n            ecma_free_number (right_value);\n            continue;\n          }\n\n          if (ecma_is_value_float_number (right_value) && ecma_is_value_integer_number (left_value))\n          {\n            ecma_number_t new_value =\n              ((ecma_number_t) ecma_get_integer_from_value (left_value) - ecma_get_float_from_value (right_value));\n\n            *stack_top_p++ = ecma_update_float_number (right_value, new_value);\n            continue;\n          }\n\n          result = do_number_arithmetic (NUMBER_ARITHMETIC_SUBTRACTION, left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_MUL:\n        {\n          JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));\n\n          JERRY_STATIC_ASSERT (ECMA_INTEGER_MULTIPLY_MAX * ECMA_INTEGER_MULTIPLY_MAX <= ECMA_INTEGER_NUMBER_MAX\n                                 && -(ECMA_INTEGER_MULTIPLY_MAX * ECMA_INTEGER_MULTIPLY_MAX) >= ECMA_INTEGER_NUMBER_MIN,\n                               square_of_integer_multiply_max_must_fit_into_integer_value_range);\n\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            ecma_integer_value_t left_integer = ecma_get_integer_from_value (left_value);\n            ecma_integer_value_t right_integer = ecma_get_integer_from_value (right_value);\n\n            if (-ECMA_INTEGER_MULTIPLY_MAX <= left_integer && left_integer <= ECMA_INTEGER_MULTIPLY_MAX\n                && -ECMA_INTEGER_MULTIPLY_MAX <= right_integer && right_integer <= ECMA_INTEGER_MULTIPLY_MAX\n                && left_integer != 0 && right_integer != 0)\n            {\n              *stack_top_p++ = ecma_integer_multiply (left_integer, right_integer);\n              continue;\n            }\n\n            ecma_number_t multiply = (ecma_number_t) left_integer * (ecma_number_t) right_integer;\n            *stack_top_p++ = ecma_make_number_value (multiply);\n            continue;\n          }\n\n          if (ecma_is_value_float_number (left_value) && ecma_is_value_number (right_value))\n          {\n            ecma_number_t new_value =\n              (ecma_get_float_from_value (left_value) * ecma_get_number_from_value (right_value));\n\n            *stack_top_p++ = ecma_update_float_number (left_value, new_value);\n            ecma_free_number (right_value);\n            continue;\n          }\n\n          if (ecma_is_value_float_number (right_value) && ecma_is_value_integer_number (left_value))\n          {\n            ecma_number_t new_value =\n              ((ecma_number_t) ecma_get_integer_from_value (left_value) * ecma_get_float_from_value (right_value));\n\n            *stack_top_p++ = ecma_update_float_number (right_value, new_value);\n            continue;\n          }\n\n          result = do_number_arithmetic (NUMBER_ARITHMETIC_MULTIPLICATION, left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_DIV:\n        {\n          JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));\n\n          result = do_number_arithmetic (NUMBER_ARITHMETIC_DIVISION, left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_MOD:\n        {\n          JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));\n\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            ecma_integer_value_t left_integer = ecma_get_integer_from_value (left_value);\n            ecma_integer_value_t right_integer = ecma_get_integer_from_value (right_value);\n\n            if (right_integer != 0)\n            {\n              ecma_integer_value_t mod_result = left_integer % right_integer;\n\n              if (mod_result != 0 || left_integer >= 0)\n              {\n                *stack_top_p++ = ecma_make_integer_value (mod_result);\n                continue;\n              }\n            }\n          }\n\n          result = do_number_arithmetic (NUMBER_ARITHMETIC_REMAINDER, left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_EXP:\n        {\n          result = do_number_arithmetic (NUMBER_ARITHMETIC_EXPONENTIATION, left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_EQUAL:\n        {\n          result = opfunc_equality (left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_NOT_EQUAL:\n        {\n          result = opfunc_equality (left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = ecma_invert_boolean_value (result);\n          goto free_both_values;\n        }\n        case VM_OC_STRICT_EQUAL:\n        {\n          bool is_equal = ecma_op_strict_equality_compare (left_value, right_value);\n\n          result = ecma_make_boolean_value (is_equal);\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_STRICT_NOT_EQUAL:\n        {\n          bool is_equal = ecma_op_strict_equality_compare (left_value, right_value);\n\n          result = ecma_make_boolean_value (!is_equal);\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_BIT_OR:\n        {\n          JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_MASK == ((1 << ECMA_DIRECT_SHIFT) - 1),\n                               direct_type_mask_must_fill_all_bits_before_the_value_starts);\n\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            *stack_top_p++ = left_value | right_value;\n            continue;\n          }\n\n          result = do_number_bitwise_logic (NUMBER_BITWISE_LOGIC_OR, left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_BIT_XOR:\n        {\n          JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_MASK == ((1 << ECMA_DIRECT_SHIFT) - 1),\n                               direct_type_mask_must_fill_all_bits_before_the_value_starts);\n\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            *stack_top_p++ = left_value ^ right_value;\n            continue;\n          }\n\n          result = do_number_bitwise_logic (NUMBER_BITWISE_LOGIC_XOR, left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_BIT_AND:\n        {\n          JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_MASK == ((1 << ECMA_DIRECT_SHIFT) - 1),\n                               direct_type_mask_must_fill_all_bits_before_the_value_starts);\n\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            *stack_top_p++ = left_value & right_value;\n            continue;\n          }\n\n          result = do_number_bitwise_logic (NUMBER_BITWISE_LOGIC_AND, left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_LEFT_SHIFT:\n        {\n          JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_MASK == ((1 << ECMA_DIRECT_SHIFT) - 1),\n                               direct_type_mask_must_fill_all_bits_before_the_value_starts);\n\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            ecma_integer_value_t left_integer = ecma_get_integer_from_value (left_value);\n            ecma_integer_value_t right_integer = ecma_get_integer_from_value (right_value);\n\n            *stack_top_p++ = ecma_make_int32_value ((int32_t) ((uint32_t) left_integer << (right_integer & 0x1f)));\n            continue;\n          }\n\n          result = do_number_bitwise_logic (NUMBER_BITWISE_SHIFT_LEFT, left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_RIGHT_SHIFT:\n        {\n          JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_MASK == ((1 << ECMA_DIRECT_SHIFT) - 1),\n                               direct_type_mask_must_fill_all_bits_before_the_value_starts);\n\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            ecma_integer_value_t left_integer = ecma_get_integer_from_value (left_value);\n            ecma_integer_value_t right_integer = ecma_get_integer_from_value (right_value);\n            *stack_top_p++ = ecma_make_integer_value (left_integer >> (right_integer & 0x1f));\n            continue;\n          }\n\n          result = do_number_bitwise_logic (NUMBER_BITWISE_SHIFT_RIGHT, left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_UNS_RIGHT_SHIFT:\n        {\n          JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_MASK == ((1 << ECMA_DIRECT_SHIFT) - 1),\n                               direct_type_mask_must_fill_all_bits_before_the_value_starts);\n\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            uint32_t left_uint32 = (uint32_t) ecma_get_integer_from_value (left_value);\n            ecma_integer_value_t right_integer = ecma_get_integer_from_value (right_value);\n            *stack_top_p++ = ecma_make_uint32_value (left_uint32 >> (right_integer & 0x1f));\n            continue;\n          }\n\n          result = do_number_bitwise_logic (NUMBER_BITWISE_SHIFT_URIGHT, left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_LESS:\n        {\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            bool is_less = (ecma_integer_value_t) left_value < (ecma_integer_value_t) right_value;\n#if !JERRY_VM_HALT\n            /* This is a lookahead to the next opcode to improve performance.\n             * If it is CBC_BRANCH_IF_TRUE_BACKWARD, execute it. */\n            if (*byte_code_p <= CBC_BRANCH_IF_TRUE_BACKWARD_3 && *byte_code_p >= CBC_BRANCH_IF_TRUE_BACKWARD)\n            {\n              byte_code_start_p = byte_code_p++;\n              branch_offset_length = CBC_BRANCH_OFFSET_LENGTH (*byte_code_start_p);\n              JERRY_ASSERT (branch_offset_length >= 1 && branch_offset_length <= 3);\n\n              if (is_less)\n              {\n                branch_offset = *(byte_code_p++);\n\n                if (JERRY_UNLIKELY (branch_offset_length != 1))\n                {\n                  branch_offset <<= 8;\n                  branch_offset |= *(byte_code_p++);\n                  if (JERRY_UNLIKELY (branch_offset_length == 3))\n                  {\n                    branch_offset <<= 8;\n                    branch_offset |= *(byte_code_p++);\n                  }\n                }\n\n                /* Note: The opcode is a backward branch. */\n                byte_code_p = byte_code_start_p - branch_offset;\n              }\n              else\n              {\n                byte_code_p += branch_offset_length;\n              }\n\n              continue;\n            }\n#endif /* !JERRY_VM_HALT */\n            *stack_top_p++ = ecma_make_boolean_value (is_less);\n            continue;\n          }\n\n          if (ecma_is_value_number (left_value) && ecma_is_value_number (right_value))\n          {\n            ecma_number_t left_number = ecma_get_number_from_value (left_value);\n            ecma_number_t right_number = ecma_get_number_from_value (right_value);\n\n            *stack_top_p++ = ecma_make_boolean_value (left_number < right_number);\n            goto free_both_values;\n          }\n\n          result = opfunc_relation (left_value, right_value, true, false);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_GREATER:\n        {\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            ecma_integer_value_t left_integer = (ecma_integer_value_t) left_value;\n            ecma_integer_value_t right_integer = (ecma_integer_value_t) right_value;\n\n            *stack_top_p++ = ecma_make_boolean_value (left_integer > right_integer);\n            continue;\n          }\n\n          if (ecma_is_value_number (left_value) && ecma_is_value_number (right_value))\n          {\n            ecma_number_t left_number = ecma_get_number_from_value (left_value);\n            ecma_number_t right_number = ecma_get_number_from_value (right_value);\n\n            *stack_top_p++ = ecma_make_boolean_value (left_number > right_number);\n            goto free_both_values;\n          }\n\n          result = opfunc_relation (left_value, right_value, false, false);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_LESS_EQUAL:\n        {\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            ecma_integer_value_t left_integer = (ecma_integer_value_t) left_value;\n            ecma_integer_value_t right_integer = (ecma_integer_value_t) right_value;\n\n            *stack_top_p++ = ecma_make_boolean_value (left_integer <= right_integer);\n            continue;\n          }\n\n          if (ecma_is_value_number (left_value) && ecma_is_value_number (right_value))\n          {\n            ecma_number_t left_number = ecma_get_number_from_value (left_value);\n            ecma_number_t right_number = ecma_get_number_from_value (right_value);\n\n            *stack_top_p++ = ecma_make_boolean_value (left_number <= right_number);\n            goto free_both_values;\n          }\n\n          result = opfunc_relation (left_value, right_value, false, true);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_GREATER_EQUAL:\n        {\n          if (ecma_are_values_integer_numbers (left_value, right_value))\n          {\n            ecma_integer_value_t left_integer = (ecma_integer_value_t) left_value;\n            ecma_integer_value_t right_integer = (ecma_integer_value_t) right_value;\n\n            *stack_top_p++ = ecma_make_boolean_value (left_integer >= right_integer);\n            continue;\n          }\n\n          if (ecma_is_value_number (left_value) && ecma_is_value_number (right_value))\n          {\n            ecma_number_t left_number = ecma_get_number_from_value (left_value);\n            ecma_number_t right_number = ecma_get_number_from_value (right_value);\n\n            *stack_top_p++ = ecma_make_boolean_value (left_number >= right_number);\n            goto free_both_values;\n          }\n\n          result = opfunc_relation (left_value, right_value, true, true);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_IN:\n        {\n          result = opfunc_in (left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_INSTANCEOF:\n        {\n          result = opfunc_instanceof (left_value, right_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          goto free_both_values;\n        }\n        case VM_OC_BLOCK_CREATE_CONTEXT:\n        {\n          ecma_value_t *stack_context_top_p;\n          stack_context_top_p = VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth;\n\n          JERRY_ASSERT (stack_context_top_p == stack_top_p || stack_context_top_p == stack_top_p - 1);\n\n          if (byte_code_start_p[0] != CBC_EXT_OPCODE)\n          {\n            branch_offset += (int32_t) (byte_code_start_p - frame_ctx_p->byte_code_start_p);\n\n            if (stack_context_top_p != stack_top_p)\n            {\n              /* Preserve the value of switch statement. */\n              stack_context_top_p[1] = stack_context_top_p[0];\n            }\n\n            stack_context_top_p[0] = VM_CREATE_CONTEXT_WITH_ENV (VM_CONTEXT_BLOCK, branch_offset);\n\n            VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_BLOCK_CONTEXT_STACK_ALLOCATION);\n            stack_top_p += PARSER_BLOCK_CONTEXT_STACK_ALLOCATION;\n          }\n          else\n          {\n            JERRY_ASSERT (byte_code_start_p[1] == CBC_EXT_TRY_CREATE_ENV);\n\n            JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_context_top_p[-1]) == VM_CONTEXT_TRY\n                          || VM_GET_CONTEXT_TYPE (stack_context_top_p[-1]) == VM_CONTEXT_CATCH\n                          || VM_GET_CONTEXT_TYPE (stack_context_top_p[-1]) == VM_CONTEXT_FINALLY_JUMP\n                          || VM_GET_CONTEXT_TYPE (stack_context_top_p[-1]) == VM_CONTEXT_FINALLY_THROW\n                          || VM_GET_CONTEXT_TYPE (stack_context_top_p[-1]) == VM_CONTEXT_FINALLY_RETURN);\n\n            JERRY_ASSERT (!(stack_context_top_p[-1] & VM_CONTEXT_HAS_LEX_ENV));\n\n            stack_context_top_p[-1] |= VM_CONTEXT_HAS_LEX_ENV;\n          }\n\n          frame_ctx_p->lex_env_p = ecma_create_decl_lex_env (frame_ctx_p->lex_env_p);\n          frame_ctx_p->lex_env_p->type_flags_refs |= ECMA_OBJECT_FLAG_BLOCK;\n\n          continue;\n        }\n        case VM_OC_WITH:\n        {\n          ecma_value_t value = *(--stack_top_p);\n          ecma_object_t *object_p;\n          ecma_object_t *with_env_p;\n\n          branch_offset += (int32_t) (byte_code_start_p - frame_ctx_p->byte_code_start_p);\n\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n\n          result = ecma_op_to_object (value);\n          ecma_free_value (value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          object_p = ecma_get_object_from_value (result);\n\n          with_env_p = ecma_create_object_lex_env (frame_ctx_p->lex_env_p, object_p);\n          ecma_deref_object (object_p);\n\n          VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_WITH_CONTEXT_STACK_ALLOCATION);\n          stack_top_p += PARSER_WITH_CONTEXT_STACK_ALLOCATION;\n\n          stack_top_p[-1] = VM_CREATE_CONTEXT_WITH_ENV (VM_CONTEXT_WITH, branch_offset);\n\n          with_env_p->type_flags_refs |= ECMA_OBJECT_FLAG_BLOCK;\n          frame_ctx_p->lex_env_p = with_env_p;\n          continue;\n        }\n        case VM_OC_FOR_IN_INIT:\n        {\n          ecma_value_t value = *(--stack_top_p);\n\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n\n          ecma_value_t expr_obj_value = ECMA_VALUE_UNDEFINED;\n          ecma_collection_t *prop_names_p = opfunc_for_in (value, &expr_obj_value);\n          ecma_free_value (value);\n\n          if (prop_names_p == NULL)\n          {\n            if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (expr_obj_value)))\n            {\n              result = expr_obj_value;\n              goto error;\n            }\n\n            /* The collection is already released */\n            byte_code_p = byte_code_start_p + branch_offset;\n            continue;\n          }\n\n          branch_offset += (int32_t) (byte_code_start_p - frame_ctx_p->byte_code_start_p);\n\n          VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION);\n          stack_top_p += PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION;\n          stack_top_p[-1] = VM_CREATE_CONTEXT (VM_CONTEXT_FOR_IN, branch_offset);\n          ECMA_SET_INTERNAL_VALUE_ANY_POINTER (stack_top_p[-2], prop_names_p);\n          stack_top_p[-3] = 0;\n          stack_top_p[-4] = expr_obj_value;\n\n          if (byte_code_p[0] == CBC_EXT_OPCODE && byte_code_p[1] == CBC_EXT_CLONE_CONTEXT)\n          {\n            /* No need to duplicate the first context. */\n            byte_code_p += 2;\n          }\n\n          continue;\n        }\n        case VM_OC_FOR_IN_GET_NEXT:\n        {\n          ecma_value_t *context_top_p = VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth;\n\n          ecma_collection_t *collection_p;\n          collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, context_top_p[-2]);\n\n          JERRY_ASSERT (VM_GET_CONTEXT_TYPE (context_top_p[-1]) == VM_CONTEXT_FOR_IN);\n\n          uint32_t index = context_top_p[-3];\n          ecma_value_t *buffer_p = collection_p->buffer_p;\n\n          *stack_top_p++ = buffer_p[index];\n          context_top_p[-3]++;\n          continue;\n        }\n        case VM_OC_FOR_IN_HAS_NEXT:\n        {\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n\n          ecma_collection_t *collection_p;\n          collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, stack_top_p[-2]);\n\n          JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_FOR_IN);\n\n          ecma_value_t *buffer_p = collection_p->buffer_p;\n          ecma_object_t *object_p = ecma_get_object_from_value (stack_top_p[-4]);\n          uint32_t index = stack_top_p[-3];\n\n          while (index < collection_p->item_count)\n          {\n            ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (buffer_p[index]);\n\n            result = ecma_op_object_has_property (object_p, prop_name_p);\n\n            if (ECMA_IS_VALUE_ERROR (result))\n            {\n              stack_top_p[-3] = index;\n              goto error;\n            }\n\n            if (JERRY_LIKELY (ecma_is_value_true (result)))\n            {\n              byte_code_p = byte_code_start_p + branch_offset;\n              break;\n            }\n\n            ecma_deref_ecma_string (prop_name_p);\n            index++;\n          }\n\n          if (index == collection_p->item_count)\n          {\n            ecma_deref_object (object_p);\n            ecma_collection_destroy (collection_p);\n            VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION);\n            stack_top_p -= PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION;\n          }\n          else\n          {\n            stack_top_p[-3] = index;\n          }\n          continue;\n        }\n        case VM_OC_FOR_OF_INIT:\n        {\n          ecma_value_t value = *(--stack_top_p);\n\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n\n          ecma_value_t next_method;\n          ecma_value_t iterator = ecma_op_get_iterator (value, ECMA_VALUE_SYNC_ITERATOR, &next_method);\n\n          ecma_free_value (value);\n\n          if (ECMA_IS_VALUE_ERROR (iterator))\n          {\n            result = iterator;\n            goto error;\n          }\n\n          result = ecma_op_iterator_step (iterator, next_method);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            ecma_free_value (iterator);\n            ecma_free_value (next_method);\n            goto error;\n          }\n\n          if (ecma_is_value_false (result))\n          {\n            ecma_free_value (iterator);\n            ecma_free_value (next_method);\n            byte_code_p = byte_code_start_p + branch_offset;\n            continue;\n          }\n\n          ecma_value_t next_value = ecma_op_iterator_value (result);\n          ecma_free_value (result);\n\n          if (ECMA_IS_VALUE_ERROR (next_value))\n          {\n            result = next_value;\n            ecma_free_value (iterator);\n            ecma_free_value (next_method);\n            goto error;\n          }\n\n          branch_offset += (int32_t) (byte_code_start_p - frame_ctx_p->byte_code_start_p);\n\n          VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION);\n          stack_top_p += PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION;\n          stack_top_p[-1] = VM_CREATE_CONTEXT (VM_CONTEXT_FOR_OF, branch_offset) | VM_CONTEXT_CLOSE_ITERATOR;\n          stack_top_p[-2] = next_value;\n          stack_top_p[-3] = iterator;\n          stack_top_p[-4] = next_method;\n\n          if (byte_code_p[0] == CBC_EXT_OPCODE && byte_code_p[1] == CBC_EXT_CLONE_CONTEXT)\n          {\n            /* No need to duplicate the first context. */\n            byte_code_p += 2;\n          }\n          continue;\n        }\n        case VM_OC_FOR_OF_GET_NEXT:\n        {\n          ecma_value_t *context_top_p = VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth;\n          JERRY_ASSERT (VM_GET_CONTEXT_TYPE (context_top_p[-1]) == VM_CONTEXT_FOR_OF\n                        || VM_GET_CONTEXT_TYPE (context_top_p[-1]) == VM_CONTEXT_FOR_AWAIT_OF);\n          JERRY_ASSERT (context_top_p[-1] & VM_CONTEXT_CLOSE_ITERATOR);\n\n          *stack_top_p++ = context_top_p[-2];\n          context_top_p[-2] = ECMA_VALUE_UNDEFINED;\n          continue;\n        }\n        case VM_OC_FOR_OF_HAS_NEXT:\n        {\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n          JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_FOR_OF);\n          JERRY_ASSERT (stack_top_p[-1] & VM_CONTEXT_CLOSE_ITERATOR);\n\n          stack_top_p[-1] &= (uint32_t) ~VM_CONTEXT_CLOSE_ITERATOR;\n          result = ecma_op_iterator_step (stack_top_p[-3], stack_top_p[-4]);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          if (ecma_is_value_false (result))\n          {\n            ecma_free_value (stack_top_p[-2]);\n            ecma_free_value (stack_top_p[-3]);\n            ecma_free_value (stack_top_p[-4]);\n            VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION);\n            stack_top_p -= PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION;\n            continue;\n          }\n\n          ecma_value_t next_value = ecma_op_iterator_value (result);\n          ecma_free_value (result);\n\n          if (ECMA_IS_VALUE_ERROR (next_value))\n          {\n            result = next_value;\n            goto error;\n          }\n\n          JERRY_ASSERT (stack_top_p[-2] == ECMA_VALUE_UNDEFINED);\n          stack_top_p[-1] |= VM_CONTEXT_CLOSE_ITERATOR;\n          stack_top_p[-2] = next_value;\n          byte_code_p = byte_code_start_p + branch_offset;\n          continue;\n        }\n        case VM_OC_FOR_AWAIT_OF_INIT:\n        {\n          ecma_value_t value = *(--stack_top_p);\n\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n\n          ecma_value_t next_method;\n          result = ecma_op_get_iterator (value, ECMA_VALUE_ASYNC_ITERATOR, &next_method);\n\n          ecma_free_value (value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          ecma_value_t iterator = result;\n          result = ecma_op_iterator_next (result, next_method, ECMA_VALUE_EMPTY);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            ecma_free_value (iterator);\n            ecma_free_value (next_method);\n            goto error;\n          }\n\n          branch_offset += (int32_t) (byte_code_start_p - frame_ctx_p->byte_code_start_p);\n\n          VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION);\n          stack_top_p += PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION;\n          stack_top_p[-1] = VM_CREATE_CONTEXT (VM_CONTEXT_FOR_AWAIT_OF, branch_offset);\n          stack_top_p[-2] = ECMA_VALUE_UNDEFINED;\n          stack_top_p[-3] = iterator;\n          stack_top_p[-4] = next_method;\n\n          if (byte_code_p[0] == CBC_EXT_OPCODE && byte_code_p[1] == CBC_EXT_CLONE_CONTEXT)\n          {\n            /* No need to duplicate the first context. */\n            byte_code_p += 2;\n          }\n\n          frame_ctx_p->call_operation = VM_EXEC_RETURN;\n          frame_ctx_p->byte_code_p = byte_code_p;\n          frame_ctx_p->stack_top_p = stack_top_p;\n\n          uint16_t extra_flags =\n            (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD | (ECMA_AWAIT_FOR_NEXT << ECMA_AWAIT_STATE_SHIFT));\n\n          if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) == CBC_FUNCTION_ASYNC_GENERATOR\n              || (frame_ctx_p->shared_p->status_flags & VM_FRAME_CTX_SHARED_EXECUTABLE))\n          {\n            ecma_extended_object_t *executable_object_p = VM_GET_EXECUTABLE_OBJECT (frame_ctx_p);\n            result = ecma_promise_async_await (executable_object_p, result);\n\n            if (ECMA_IS_VALUE_ERROR (result))\n            {\n              goto error;\n            }\n\n            executable_object_p->u.cls.u2.executable_obj_flags |= extra_flags;\n            return ECMA_VALUE_UNDEFINED;\n          }\n\n          result = opfunc_async_create_and_await (frame_ctx_p, result, extra_flags);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n          return result;\n        }\n        case VM_OC_FOR_AWAIT_OF_HAS_NEXT:\n        {\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n          JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_FOR_AWAIT_OF);\n          JERRY_ASSERT (stack_top_p[-1] & VM_CONTEXT_CLOSE_ITERATOR);\n\n          stack_top_p[-1] &= (uint32_t) ~VM_CONTEXT_CLOSE_ITERATOR;\n          result = ecma_op_iterator_next (stack_top_p[-3], stack_top_p[-4], ECMA_VALUE_EMPTY);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          ecma_extended_object_t *executable_object_p = VM_GET_EXECUTABLE_OBJECT (frame_ctx_p);\n          result = ecma_promise_async_await (executable_object_p, result);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          uint16_t extra_flags =\n            (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD | (ECMA_AWAIT_FOR_NEXT << ECMA_AWAIT_STATE_SHIFT));\n          executable_object_p->u.cls.u2.executable_obj_flags |= extra_flags;\n\n          frame_ctx_p->call_operation = VM_EXEC_RETURN;\n          frame_ctx_p->byte_code_p = byte_code_start_p + branch_offset;\n          frame_ctx_p->stack_top_p = stack_top_p;\n          return ECMA_VALUE_UNDEFINED;\n        }\n        case VM_OC_TRY:\n        {\n          /* Try opcode simply creates the try context. */\n          branch_offset += (int32_t) (byte_code_start_p - frame_ctx_p->byte_code_start_p);\n\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n\n          VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_TRY_CONTEXT_STACK_ALLOCATION);\n          stack_top_p += PARSER_TRY_CONTEXT_STACK_ALLOCATION;\n\n          stack_top_p[-1] = VM_CREATE_CONTEXT (VM_CONTEXT_TRY, branch_offset);\n          continue;\n        }\n        case VM_OC_CATCH:\n        {\n          /* Catches are ignored and turned to jumps. */\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n          JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_TRY);\n\n          byte_code_p = byte_code_start_p + branch_offset;\n          continue;\n        }\n        case VM_OC_FINALLY:\n        {\n          branch_offset += (int32_t) (byte_code_start_p - frame_ctx_p->byte_code_start_p);\n\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n\n          JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_TRY\n                        || VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_CATCH);\n\n          if (stack_top_p[-1] & VM_CONTEXT_HAS_LEX_ENV)\n          {\n            ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;\n            JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);\n            frame_ctx_p->lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n            ecma_deref_object (lex_env_p);\n          }\n\n          VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION);\n          stack_top_p += PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION;\n\n          stack_top_p[-1] = VM_CREATE_CONTEXT (VM_CONTEXT_FINALLY_JUMP, branch_offset);\n          stack_top_p[-2] = (ecma_value_t) branch_offset;\n          continue;\n        }\n        case VM_OC_CONTEXT_END:\n        {\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n          JERRY_ASSERT (!(stack_top_p[-1] & VM_CONTEXT_CLOSE_ITERATOR));\n\n          ecma_value_t context_type = VM_GET_CONTEXT_TYPE (stack_top_p[-1]);\n\n          if (!VM_CONTEXT_IS_FINALLY (context_type))\n          {\n            stack_top_p = vm_stack_context_abort (frame_ctx_p, stack_top_p);\n\n            JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n            continue;\n          }\n\n          if (stack_top_p[-1] & VM_CONTEXT_HAS_LEX_ENV)\n          {\n            ecma_object_t *lex_env_p = frame_ctx_p->lex_env_p;\n            JERRY_ASSERT (lex_env_p->u2.outer_reference_cp != JMEM_CP_NULL);\n            frame_ctx_p->lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, lex_env_p->u2.outer_reference_cp);\n            ecma_deref_object (lex_env_p);\n          }\n\n          VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FINALLY_CONTEXT_STACK_ALLOCATION);\n          stack_top_p -= PARSER_FINALLY_CONTEXT_STACK_ALLOCATION;\n\n          if (context_type == VM_CONTEXT_FINALLY_RETURN)\n          {\n            result = *stack_top_p;\n            goto error;\n          }\n\n          if (context_type == VM_CONTEXT_FINALLY_THROW)\n          {\n            jcontext_raise_exception (*stack_top_p);\n#if JERRY_VM_THROW\n            JERRY_CONTEXT (status_flags) |= ECMA_STATUS_ERROR_THROWN;\n#endif /* JERRY_VM_THROW */\n            result = ECMA_VALUE_ERROR;\n\n#if JERRY_DEBUGGER\n            JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);\n#endif /* JERRY_DEBUGGER */\n            goto error;\n          }\n\n          JERRY_ASSERT (context_type == VM_CONTEXT_FINALLY_JUMP);\n\n          uint32_t jump_target = *stack_top_p;\n\n          vm_stack_found_type type =\n            vm_stack_find_finally (frame_ctx_p, stack_top_p, VM_CONTEXT_FINALLY_JUMP, jump_target);\n          stack_top_p = frame_ctx_p->stack_top_p;\n          switch (type)\n          {\n            case VM_CONTEXT_FOUND_FINALLY:\n            {\n              byte_code_p = frame_ctx_p->byte_code_p;\n\n              JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_FINALLY_JUMP);\n              stack_top_p[-2] = jump_target;\n              break;\n            }\n            case VM_CONTEXT_FOUND_ERROR:\n            {\n              JERRY_ASSERT (jcontext_has_pending_exception ());\n              result = ECMA_VALUE_ERROR;\n              goto error;\n            }\n            case VM_CONTEXT_FOUND_AWAIT:\n            {\n              JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_FINALLY_JUMP);\n              stack_top_p[-2] = jump_target;\n              return ECMA_VALUE_UNDEFINED;\n            }\n            default:\n            {\n              byte_code_p = frame_ctx_p->byte_code_start_p + jump_target;\n              break;\n            }\n          }\n\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n          continue;\n        }\n        case VM_OC_JUMP_AND_EXIT_CONTEXT:\n        {\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n          JERRY_ASSERT (!jcontext_has_pending_exception ());\n\n          branch_offset += (int32_t) (byte_code_start_p - frame_ctx_p->byte_code_start_p);\n\n          vm_stack_found_type type =\n            vm_stack_find_finally (frame_ctx_p, stack_top_p, VM_CONTEXT_FINALLY_JUMP, (uint32_t) branch_offset);\n          stack_top_p = frame_ctx_p->stack_top_p;\n          switch (type)\n          {\n            case VM_CONTEXT_FOUND_FINALLY:\n            {\n              byte_code_p = frame_ctx_p->byte_code_p;\n\n              JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_FINALLY_JUMP);\n              stack_top_p[-2] = (uint32_t) branch_offset;\n              break;\n            }\n            case VM_CONTEXT_FOUND_ERROR:\n            {\n              JERRY_ASSERT (jcontext_has_pending_exception ());\n              result = ECMA_VALUE_ERROR;\n              goto error;\n            }\n            case VM_CONTEXT_FOUND_AWAIT:\n            {\n              JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_FINALLY_JUMP);\n              stack_top_p[-2] = (uint32_t) branch_offset;\n              return ECMA_VALUE_UNDEFINED;\n            }\n            default:\n            {\n              byte_code_p = frame_ctx_p->byte_code_start_p + branch_offset;\n              break;\n            }\n          }\n\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n          continue;\n        }\n#if JERRY_MODULE_SYSTEM\n        case VM_OC_MODULE_IMPORT:\n        {\n          left_value = *(--stack_top_p);\n\n          ecma_value_t user_value = ECMA_VALUE_UNDEFINED;\n          ecma_value_t script_value = ((cbc_uint8_arguments_t *) bytecode_header_p)->script_value;\n\n#if JERRY_SNAPSHOT_EXEC\n          if (JERRY_UNLIKELY (!(bytecode_header_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)))\n          {\n#endif /* JERRY_SNAPSHOT_EXEC */\n            cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n\n            if (script_p->refs_and_type & CBC_SCRIPT_HAS_USER_VALUE)\n            {\n              user_value = CBC_SCRIPT_GET_USER_VALUE (script_p);\n            }\n#if JERRY_SNAPSHOT_EXEC\n          }\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n          result = ecma_module_import (left_value, user_value);\n          ecma_free_value (left_value);\n\n          if (ECMA_IS_VALUE_ERROR (result))\n          {\n            goto error;\n          }\n\n          *stack_top_p++ = result;\n          continue;\n        }\n        case VM_OC_MODULE_IMPORT_META:\n        {\n          ecma_value_t script_value = ((cbc_uint8_arguments_t *) bytecode_header_p)->script_value;\n          cbc_script_t *script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, script_value);\n\n          JERRY_ASSERT (script_p->refs_and_type & CBC_SCRIPT_HAS_IMPORT_META);\n\n          ecma_value_t import_meta = CBC_SCRIPT_GET_IMPORT_META (script_p, script_p->refs_and_type);\n          ecma_object_t *import_meta_object_p = ecma_get_object_from_value (import_meta);\n\n          if (ecma_get_object_type (import_meta_object_p) != ECMA_OBJECT_TYPE_GENERAL)\n          {\n            JERRY_ASSERT (ecma_object_class_is (import_meta_object_p, ECMA_OBJECT_CLASS_MODULE));\n\n            ecma_value_t module = import_meta;\n            import_meta_object_p = ecma_create_object (NULL, 0, ECMA_OBJECT_TYPE_GENERAL);\n            import_meta = ecma_make_object_value (import_meta_object_p);\n\n            if (JERRY_CONTEXT (module_import_meta_callback_p) != NULL)\n            {\n              void *user_p = JERRY_CONTEXT (module_import_meta_callback_user_p);\n              JERRY_CONTEXT (module_import_meta_callback_p) (module, import_meta, user_p);\n            }\n\n            CBC_SCRIPT_GET_IMPORT_META (script_p, script_p->refs_and_type) = import_meta;\n          }\n          else\n          {\n            ecma_ref_object (import_meta_object_p);\n          }\n\n          *stack_top_p++ = import_meta;\n          continue;\n        }\n#endif /* JERRY_MODULE_SYSTEM */\n#if JERRY_DEBUGGER\n        case VM_OC_BREAKPOINT_ENABLED:\n        {\n          if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_IGNORE)\n          {\n            continue;\n          }\n\n          JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n\n          JERRY_ASSERT (!(frame_ctx_p->shared_p->bytecode_header_p->status_flags & CBC_CODE_FLAGS_DEBUGGER_IGNORE));\n\n          frame_ctx_p->byte_code_p = byte_code_start_p;\n\n          jerry_debugger_breakpoint_hit (JERRY_DEBUGGER_BREAKPOINT_HIT);\n          if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_EXCEPTION_THROWN)\n          {\n            result = ECMA_VALUE_ERROR;\n            goto error;\n          }\n          continue;\n        }\n        case VM_OC_BREAKPOINT_DISABLED:\n        {\n          if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_IGNORE)\n          {\n            continue;\n          }\n\n          JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);\n\n          JERRY_ASSERT (!(frame_ctx_p->shared_p->bytecode_header_p->status_flags & CBC_CODE_FLAGS_DEBUGGER_IGNORE));\n\n          frame_ctx_p->byte_code_p = byte_code_start_p;\n\n          if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_STOP)\n              && (JERRY_CONTEXT (debugger_stop_context) == NULL\n                  || JERRY_CONTEXT (debugger_stop_context) == JERRY_CONTEXT (vm_top_context_p)))\n          {\n            jerry_debugger_breakpoint_hit (JERRY_DEBUGGER_BREAKPOINT_HIT);\n            if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_EXCEPTION_THROWN)\n            {\n              result = ECMA_VALUE_ERROR;\n              goto error;\n            }\n            continue;\n          }\n\n          if (JERRY_CONTEXT (debugger_message_delay) > 0)\n          {\n            JERRY_CONTEXT (debugger_message_delay)--;\n            continue;\n          }\n\n          JERRY_CONTEXT (debugger_message_delay) = JERRY_DEBUGGER_MESSAGE_FREQUENCY;\n\n          if (jerry_debugger_receive (NULL))\n          {\n            continue;\n          }\n\n          if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_STOP)\n              && (JERRY_CONTEXT (debugger_stop_context) == NULL\n                  || JERRY_CONTEXT (debugger_stop_context) == JERRY_CONTEXT (vm_top_context_p)))\n          {\n            jerry_debugger_breakpoint_hit (JERRY_DEBUGGER_BREAKPOINT_HIT);\n            if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_EXCEPTION_THROWN)\n            {\n              result = ECMA_VALUE_ERROR;\n              goto error;\n            }\n          }\n          continue;\n        }\n#endif /* JERRY_DEBUGGER */\n        case VM_OC_NONE:\n        default:\n        {\n          JERRY_ASSERT (VM_OC_GROUP_GET_INDEX (opcode_data) == VM_OC_NONE);\n\n          jerry_fatal (JERRY_FATAL_DISABLED_BYTE_CODE);\n        }\n      }\n\n      JERRY_ASSERT (VM_OC_HAS_PUT_RESULT (opcode_data));\n\n      if (opcode_data & VM_OC_PUT_IDENT)\n      {\n        uint16_t literal_index;\n\n        READ_LITERAL_INDEX (literal_index);\n\n        if (literal_index < register_end)\n        {\n          ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p, literal_index));\n          VM_GET_REGISTER (frame_ctx_p, literal_index) = result;\n\n          if (opcode_data & (VM_OC_PUT_STACK | VM_OC_PUT_BLOCK))\n          {\n            result = ecma_fast_copy_value (result);\n          }\n        }\n        else\n        {\n          ecma_string_t *var_name_str_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n\n          ecma_value_t put_value_result =\n            ecma_op_put_value_lex_env_base (frame_ctx_p->lex_env_p, var_name_str_p, is_strict, result);\n\n          if (ECMA_IS_VALUE_ERROR (put_value_result))\n          {\n            ecma_free_value (result);\n            result = put_value_result;\n            goto error;\n          }\n\n          if (!(opcode_data & (VM_OC_PUT_STACK | VM_OC_PUT_BLOCK)))\n          {\n            ecma_fast_free_value (result);\n          }\n        }\n      }\n      else if (opcode_data & VM_OC_PUT_REFERENCE)\n      {\n        ecma_value_t property = *(--stack_top_p);\n        ecma_value_t base = *(--stack_top_p);\n\n        if (base == ECMA_VALUE_REGISTER_REF)\n        {\n          property = (ecma_value_t) ecma_get_integer_from_value (property);\n          ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p, property));\n          VM_GET_REGISTER (frame_ctx_p, property) = result;\n\n          if (!(opcode_data & (VM_OC_PUT_STACK | VM_OC_PUT_BLOCK)))\n          {\n            goto free_both_values;\n          }\n          result = ecma_fast_copy_value (result);\n        }\n        else\n        {\n          ecma_value_t set_value_result = vm_op_set_value (base, property, result, is_strict);\n\n          if (ECMA_IS_VALUE_ERROR (set_value_result))\n          {\n            ecma_free_value (result);\n            result = set_value_result;\n            goto error;\n          }\n\n          if (!(opcode_data & (VM_OC_PUT_STACK | VM_OC_PUT_BLOCK)))\n          {\n            ecma_fast_free_value (result);\n            goto free_both_values;\n          }\n        }\n      }\n\n      if (opcode_data & VM_OC_PUT_STACK)\n      {\n        *stack_top_p++ = result;\n      }\n      else if (opcode_data & VM_OC_PUT_BLOCK)\n      {\n        ecma_fast_free_value (VM_GET_REGISTER (frame_ctx_p, 0));\n        VM_GET_REGISTERS (frame_ctx_p)[0] = result;\n      }\n\nfree_both_values:\n      ecma_fast_free_value (right_value);\nfree_left_value:\n      ecma_fast_free_value (left_value);\n    }\n\nerror:\n    ecma_fast_free_value (left_value);\n    ecma_fast_free_value (right_value);\n\n    if (ECMA_IS_VALUE_ERROR (result))\n    {\n      JERRY_ASSERT (jcontext_has_pending_exception ());\n      ecma_value_t *stack_bottom_p = VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth;\n\n      while (stack_top_p > stack_bottom_p)\n      {\n        ecma_value_t stack_item = *(--stack_top_p);\n        if (stack_item == ECMA_VALUE_RELEASE_LEX_ENV)\n        {\n          opfunc_pop_lexical_environment (frame_ctx_p);\n          continue;\n        }\n\n        ecma_fast_free_value (stack_item);\n      }\n\n#if JERRY_VM_THROW\n      if (!(JERRY_CONTEXT (status_flags) & ECMA_STATUS_ERROR_THROWN))\n      {\n        JERRY_CONTEXT (status_flags) |= ECMA_STATUS_ERROR_THROWN;\n\n        jerry_throw_cb_t vm_throw_callback_p = JERRY_CONTEXT (vm_throw_callback_p);\n\n        if (vm_throw_callback_p != NULL)\n        {\n          vm_throw_callback_p (JERRY_CONTEXT (error_value), JERRY_CONTEXT (vm_throw_callback_user_p));\n        }\n      }\n#endif /* JERRY_VM_THROW */\n\n#if JERRY_DEBUGGER\n      const uint32_t dont_stop =\n        (JERRY_DEBUGGER_VM_IGNORE_EXCEPTION | JERRY_DEBUGGER_VM_IGNORE | JERRY_DEBUGGER_VM_EXCEPTION_THROWN);\n\n      if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)\n          && !(frame_ctx_p->shared_p->bytecode_header_p->status_flags\n               & (CBC_CODE_FLAGS_DEBUGGER_IGNORE | CBC_CODE_FLAGS_STATIC_FUNCTION))\n          && !(JERRY_CONTEXT (debugger_flags) & dont_stop))\n      {\n        /* Save the error to a local value, because the engine enters breakpoint mode after,\n           therefore an evaluation error, or user-created error throw would overwrite it. */\n        ecma_value_t current_error_value = JERRY_CONTEXT (error_value);\n\n        if (jerry_debugger_send_exception_string (current_error_value))\n        {\n          jerry_debugger_breakpoint_hit (JERRY_DEBUGGER_EXCEPTION_HIT);\n\n          if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_EXCEPTION_THROWN)\n          {\n            ecma_free_value (current_error_value);\n          }\n          else\n          {\n            JERRY_CONTEXT (error_value) = current_error_value;\n          }\n\n          JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);\n        }\n      }\n#endif /* JERRY_DEBUGGER */\n    }\n\n    JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n\n    if (frame_ctx_p->context_depth == 0)\n    {\n      /* In most cases there is no context. */\n      frame_ctx_p->call_operation = VM_NO_EXEC_OP;\n      return result;\n    }\n\n    if (!ECMA_IS_VALUE_ERROR (result))\n    {\n      switch (vm_stack_find_finally (frame_ctx_p, stack_top_p, VM_CONTEXT_FINALLY_RETURN, 0))\n      {\n        case VM_CONTEXT_FOUND_FINALLY:\n        {\n          stack_top_p = frame_ctx_p->stack_top_p;\n          byte_code_p = frame_ctx_p->byte_code_p;\n\n          JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_FINALLY_RETURN);\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n          stack_top_p[-2] = result;\n          continue;\n        }\n        case VM_CONTEXT_FOUND_ERROR:\n        {\n          JERRY_ASSERT (jcontext_has_pending_exception ());\n\n          ecma_free_value (result);\n          stack_top_p = frame_ctx_p->stack_top_p;\n          result = ECMA_VALUE_ERROR;\n          break;\n        }\n        case VM_CONTEXT_FOUND_AWAIT:\n        {\n          stack_top_p = frame_ctx_p->stack_top_p;\n\n          JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_FINALLY_RETURN);\n          stack_top_p[-2] = result;\n          return ECMA_VALUE_UNDEFINED;\n        }\n        default:\n        {\n          goto finish;\n        }\n      }\n    }\n\n    JERRY_ASSERT (jcontext_has_pending_exception ());\n\n    if (!jcontext_has_pending_abort ())\n    {\n      switch (vm_stack_find_finally (frame_ctx_p, stack_top_p, VM_CONTEXT_FINALLY_THROW, 0))\n      {\n        case VM_CONTEXT_FOUND_FINALLY:\n        {\n          stack_top_p = frame_ctx_p->stack_top_p;\n          byte_code_p = frame_ctx_p->byte_code_p;\n\n          JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n          JERRY_ASSERT (!(stack_top_p[-1] & VM_CONTEXT_HAS_LEX_ENV));\n\n#if JERRY_DEBUGGER\n          JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);\n#endif /* JERRY_DEBUGGER */\n\n          result = jcontext_take_exception ();\n\n          if (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_FINALLY_THROW)\n          {\n            stack_top_p[-2] = result;\n            continue;\n          }\n\n          JERRY_ASSERT (VM_GET_CONTEXT_TYPE (stack_top_p[-1]) == VM_CONTEXT_CATCH);\n\n          *stack_top_p++ = result;\n          continue;\n        }\n        case VM_CONTEXT_FOUND_AWAIT:\n        {\n          JERRY_ASSERT (VM_GET_CONTEXT_TYPE (frame_ctx_p->stack_top_p[-1]) == VM_CONTEXT_FINALLY_THROW);\n          return ECMA_VALUE_UNDEFINED;\n        }\n        default:\n        {\n          break;\n        }\n      }\n    }\n    else\n    {\n      do\n      {\n        JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);\n\n        stack_top_p = vm_stack_context_abort (frame_ctx_p, stack_top_p);\n      } while (frame_ctx_p->context_depth > 0);\n    }\n\nfinish:\n    frame_ctx_p->call_operation = VM_NO_EXEC_OP;\n    return result;\n  }\n} /* vm_loop */\n\n#if JERRY_MODULE_SYSTEM\n\n/**\n * Create and initialize module scope with all data properties\n *\n * @return ECMA_VALUE_EMPTY on success,\n *         ECMA_VALUE_ERROR on failure\n */\necma_value_t\nvm_init_module_scope (ecma_module_t *module_p) /**< module without scope */\n{\n  ecma_object_t *global_object_p;\n#if JERRY_BUILTIN_REALMS\n  global_object_p = (ecma_object_t *) ecma_op_function_get_realm (module_p->u.compiled_code_p);\n#else /* !JERRY_BUILTIN_REALMS */\n  global_object_p = ecma_builtin_get_global ();\n#endif /* JERRY_BUILTIN_REALMS */\n\n  ecma_object_t *scope_p = ecma_create_lex_env_class (ecma_get_global_environment (global_object_p),\n                                                      sizeof (ecma_lexical_environment_class_t));\n  const ecma_compiled_code_t *compiled_code_p = module_p->u.compiled_code_p;\n  ecma_value_t *literal_start_p;\n  uint8_t *byte_code_p;\n  uint16_t encoding_limit;\n  uint16_t encoding_delta;\n\n  ((ecma_lexical_environment_class_t *) scope_p)->object_p = (ecma_object_t *) module_p;\n  ((ecma_lexical_environment_class_t *) scope_p)->type = ECMA_LEX_ENV_CLASS_TYPE_MODULE;\n\n  module_p->scope_p = scope_p;\n  ecma_deref_object (scope_p);\n\n  if (compiled_code_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) compiled_code_p;\n\n    literal_start_p = (ecma_value_t *) (args_p + 1);\n    literal_start_p -= args_p->register_end;\n    byte_code_p = (uint8_t *) (literal_start_p + args_p->literal_end);\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) compiled_code_p;\n\n    literal_start_p = (ecma_value_t *) (args_p + 1);\n    literal_start_p -= args_p->register_end;\n    byte_code_p = (uint8_t *) (literal_start_p + args_p->literal_end);\n  }\n\n  /* Prepare for byte code execution. */\n  if (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_FULL_LITERAL_ENCODING))\n  {\n    encoding_limit = CBC_SMALL_LITERAL_ENCODING_LIMIT;\n    encoding_delta = CBC_SMALL_LITERAL_ENCODING_DELTA;\n  }\n  else\n  {\n    encoding_limit = CBC_FULL_LITERAL_ENCODING_LIMIT;\n    encoding_delta = CBC_FULL_LITERAL_ENCODING_DELTA;\n  }\n\n  JERRY_ASSERT (*byte_code_p >= CBC_JUMP_FORWARD && *byte_code_p <= CBC_JUMP_FORWARD_3);\n\n  byte_code_p += 1 + CBC_BRANCH_OFFSET_LENGTH (*byte_code_p);\n\n  while (true)\n  {\n    uint8_t opcode = *byte_code_p++;\n\n    switch (opcode)\n    {\n      case CBC_CREATE_VAR:\n      case CBC_CREATE_LET:\n      case CBC_CREATE_CONST:\n      {\n        uint32_t literal_index;\n\n        READ_LITERAL_INDEX (literal_index);\n\n        ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n\n        JERRY_ASSERT (ecma_find_named_property (scope_p, name_p) == NULL);\n\n        uint8_t prop_attributes = ECMA_PROPERTY_FLAG_WRITABLE;\n\n        if (opcode == CBC_CREATE_LET)\n        {\n          prop_attributes = ECMA_PROPERTY_ENUMERABLE_WRITABLE;\n        }\n        else if (opcode == CBC_CREATE_CONST)\n        {\n          prop_attributes = ECMA_PROPERTY_FLAG_ENUMERABLE;\n        }\n\n        ecma_property_value_t *property_value_p;\n        property_value_p = ecma_create_named_data_property (scope_p, name_p, prop_attributes, NULL);\n\n        if (opcode != CBC_CREATE_VAR)\n        {\n          property_value_p->value = ECMA_VALUE_UNINITIALIZED;\n        }\n        break;\n      }\n      case CBC_INIT_ARG_OR_FUNC:\n      {\n        uint32_t literal_index;\n\n        READ_LITERAL_INDEX (literal_index);\n\n        ecma_compiled_code_t *function_bytecode_p;\n#if JERRY_SNAPSHOT_EXEC\n        if (JERRY_LIKELY (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)))\n        {\n#endif /* JERRY_SNAPSHOT_EXEC */\n          function_bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_start_p[literal_index]);\n#if JERRY_SNAPSHOT_EXEC\n        }\n        else\n        {\n          uint8_t *byte_p = ((uint8_t *) compiled_code_p) + literal_start_p[literal_index];\n          function_bytecode_p = (ecma_compiled_code_t *) byte_p;\n        }\n#endif /* JERRY_SNAPSHOT_EXEC */\n\n        JERRY_ASSERT (CBC_IS_FUNCTION (function_bytecode_p->status_flags));\n\n        ecma_object_t *function_obj_p;\n\n        if (JERRY_UNLIKELY (CBC_FUNCTION_IS_ARROW (function_bytecode_p->status_flags)))\n        {\n          function_obj_p = ecma_op_create_arrow_function_object (scope_p, function_bytecode_p, ECMA_VALUE_UNDEFINED);\n        }\n        else\n        {\n          function_obj_p = ecma_op_create_any_function_object (scope_p, function_bytecode_p);\n        }\n\n        READ_LITERAL_INDEX (literal_index);\n        ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);\n\n        JERRY_ASSERT (ecma_find_named_property (scope_p, name_p) == NULL);\n\n        ecma_property_value_t *property_value_p;\n        property_value_p = ecma_create_named_data_property (scope_p, name_p, ECMA_PROPERTY_FLAG_WRITABLE, NULL);\n\n        JERRY_ASSERT (property_value_p->value == ECMA_VALUE_UNDEFINED);\n        property_value_p->value = ecma_make_object_value (function_obj_p);\n        ecma_deref_object (function_obj_p);\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (opcode == CBC_RETURN_FUNCTION_END);\n        return ECMA_VALUE_EMPTY;\n      }\n    }\n  }\n} /* vm_init_module_scope */\n\n#endif /* JERRY_MODULE_SYSTEM */\n\n#undef READ_LITERAL\n#undef READ_LITERAL_INDEX\n\nJERRY_STATIC_ASSERT ((int) VM_FRAME_CTX_SHARED_DIRECT_EVAL == (int) VM_FRAME_CTX_DIRECT_EVAL,\n                     vm_frame_ctx_shared_direct_eval_must_be_equal_to_frame_ctx_direct_eval);\n\nJERRY_STATIC_ASSERT ((int) CBC_CODE_FLAGS_STRICT_MODE == (int) VM_FRAME_CTX_IS_STRICT,\n                     cbc_code_flags_strict_mode_must_be_equal_to_vm_frame_ctx_is_strict);\n\n/**\n * Initialize code block execution\n */\nstatic void JERRY_ATTR_NOINLINE\nvm_init_exec (vm_frame_ctx_t *frame_ctx_p) /**< frame context */\n{\n  vm_frame_ctx_shared_t *shared_p = frame_ctx_p->shared_p;\n  const ecma_compiled_code_t *bytecode_header_p = shared_p->bytecode_header_p;\n\n  frame_ctx_p->prev_context_p = JERRY_CONTEXT (vm_top_context_p);\n  frame_ctx_p->context_depth = 0;\n  frame_ctx_p->status_flags = (uint8_t) ((shared_p->status_flags & VM_FRAME_CTX_DIRECT_EVAL)\n                                         | (bytecode_header_p->status_flags & VM_FRAME_CTX_IS_STRICT));\n\n  uint16_t argument_end, register_end;\n  ecma_value_t *literal_p;\n\n  if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_header_p;\n\n    argument_end = args_p->argument_end;\n    register_end = args_p->register_end;\n\n    literal_p = (ecma_value_t *) (args_p + 1);\n    literal_p -= register_end;\n    frame_ctx_p->literal_start_p = literal_p;\n    literal_p += args_p->literal_end;\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_header_p;\n\n    argument_end = args_p->argument_end;\n    register_end = args_p->register_end;\n\n    literal_p = (ecma_value_t *) (args_p + 1);\n    literal_p -= register_end;\n    frame_ctx_p->literal_start_p = literal_p;\n    literal_p += args_p->literal_end;\n  }\n\n  frame_ctx_p->byte_code_p = (uint8_t *) literal_p;\n  frame_ctx_p->byte_code_start_p = (uint8_t *) literal_p;\n  frame_ctx_p->stack_top_p = VM_GET_REGISTERS (frame_ctx_p) + register_end;\n\n  uint32_t arg_list_len = 0;\n\n  if (argument_end > 0)\n  {\n    JERRY_ASSERT (shared_p->status_flags & VM_FRAME_CTX_SHARED_HAS_ARG_LIST);\n\n    const ecma_value_t *arg_list_p = ((vm_frame_ctx_shared_args_t *) shared_p)->arg_list_p;\n    arg_list_len = ((vm_frame_ctx_shared_args_t *) shared_p)->arg_list_len;\n\n    if (arg_list_len > argument_end)\n    {\n      arg_list_len = argument_end;\n    }\n\n    for (uint32_t i = 0; i < arg_list_len; i++)\n    {\n      VM_GET_REGISTER (frame_ctx_p, i) = ecma_fast_copy_value (arg_list_p[i]);\n    }\n  }\n\n  /* The arg_list_len contains the end of the copied arguments.\n   * Fill everything else with undefined. */\n  if (register_end > arg_list_len)\n  {\n    ecma_value_t *stack_p = VM_GET_REGISTERS (frame_ctx_p) + arg_list_len;\n\n    for (uint32_t i = arg_list_len; i < register_end; i++)\n    {\n      *stack_p++ = ECMA_VALUE_UNDEFINED;\n    }\n  }\n\n  JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_DIRECT_EVAL;\n  JERRY_CONTEXT (vm_top_context_p) = frame_ctx_p;\n} /* vm_init_exec */\n\n/**\n * Resume execution of a code block.\n *\n * @return ecma value\n */\necma_value_t JERRY_ATTR_NOINLINE\nvm_execute (vm_frame_ctx_t *frame_ctx_p) /**< frame context */\n{\n  while (true)\n  {\n    ecma_value_t completion_value = vm_loop (frame_ctx_p);\n\n    switch (frame_ctx_p->call_operation)\n    {\n      case VM_EXEC_CALL:\n      {\n        opfunc_call (frame_ctx_p);\n        break;\n      }\n      case VM_EXEC_SUPER_CALL:\n      {\n        vm_super_call (frame_ctx_p);\n        break;\n      }\n      case VM_EXEC_SPREAD_OP:\n      {\n        vm_spread_operation (frame_ctx_p);\n        break;\n      }\n      case VM_EXEC_RETURN:\n      {\n        return completion_value;\n      }\n      case VM_EXEC_CONSTRUCT:\n      {\n        opfunc_construct (frame_ctx_p);\n        break;\n      }\n      default:\n      {\n        JERRY_ASSERT (frame_ctx_p->call_operation == VM_NO_EXEC_OP);\n\n        const ecma_compiled_code_t *bytecode_header_p = frame_ctx_p->shared_p->bytecode_header_p;\n        uint32_t register_end;\n\n        if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n        {\n          register_end = ((cbc_uint16_arguments_t *) bytecode_header_p)->register_end;\n        }\n        else\n        {\n          register_end = ((cbc_uint8_arguments_t *) bytecode_header_p)->register_end;\n        }\n\n        /* Free arguments and registers */\n        ecma_value_t *registers_p = VM_GET_REGISTERS (frame_ctx_p);\n        for (uint32_t i = 0; i < register_end; i++)\n        {\n          ecma_fast_free_value (registers_p[i]);\n        }\n\n#if JERRY_DEBUGGER\n        if (JERRY_CONTEXT (debugger_stop_context) == JERRY_CONTEXT (vm_top_context_p))\n        {\n          /* The engine will stop when the next breakpoint is reached. */\n          JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_STOP);\n          JERRY_CONTEXT (debugger_stop_context) = NULL;\n        }\n#endif /* JERRY_DEBUGGER */\n\n        JERRY_CONTEXT (vm_top_context_p) = frame_ctx_p->prev_context_p;\n        return completion_value;\n      }\n    }\n  }\n} /* vm_execute */\n\n/**\n * Run the code.\n *\n * @return ecma value\n */\necma_value_t\nvm_run (vm_frame_ctx_shared_t *shared_p, /**< shared data */\n        ecma_value_t this_binding_value, /**< value of 'ThisBinding' */\n        ecma_object_t *lex_env_p) /**< lexical environment to use */\n{\n  const ecma_compiled_code_t *bytecode_header_p = shared_p->bytecode_header_p;\n  vm_frame_ctx_t *frame_ctx_p;\n  size_t frame_size;\n\n  if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_UINT16_ARGUMENTS)\n  {\n    cbc_uint16_arguments_t *args_p = (cbc_uint16_arguments_t *) bytecode_header_p;\n    frame_size = (size_t) (args_p->register_end + args_p->stack_limit);\n  }\n  else\n  {\n    cbc_uint8_arguments_t *args_p = (cbc_uint8_arguments_t *) bytecode_header_p;\n    frame_size = (size_t) (args_p->register_end + args_p->stack_limit);\n  }\n\n  JERRY_VLA (ecma_value_t, stack, frame_size + (sizeof (vm_frame_ctx_t) / sizeof (ecma_value_t)));\n\n  frame_ctx_p = (vm_frame_ctx_t *) stack;\n\n  frame_ctx_p->shared_p = shared_p;\n  frame_ctx_p->lex_env_p = lex_env_p;\n  frame_ctx_p->this_binding = this_binding_value;\n\n  vm_init_exec (frame_ctx_p);\n  return vm_execute (frame_ctx_p);\n} /* vm_run */\n\n/**\n * @}\n * @}\n */\n"
  },
  {
    "path": "jerry-core/vm/vm.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef VM_H\n#define VM_H\n\n#include \"ecma-globals.h\"\n#include \"ecma-module.h\"\n\n#include \"jrt.h\"\n#include \"vm-defines.h\"\n\n/** \\addtogroup vm Virtual machine\n * @{\n *\n * \\addtogroup vm_executor Executor\n * @{\n */\n\n/**\n * Each CBC opcode is transformed to three vm opcodes:\n *\n *  - first opcode is a \"get arguments\" opcode which specifies\n *    the type (register, literal, stack, etc.) and number\n *    (from 0 to 2) of input arguments\n *  - second opcode is a \"group\" opcode which specifies\n *    the actual operation (add, increment, call, etc.)\n *  - third opcode is a \"put result\" opcode which specifies\n *    the destination where the result is stored (register,\n *    stack, etc.)\n */\n\n/**\n * If VM_OC_GET_ARGS_INDEX(opcode) == VM_OC_GET_BRANCH,\n * this flag signals that the branch is a backward branch.\n */\n#define VM_OC_BACKWARD_BRANCH (1 << 15)\n\n/**\n * Position of \"get arguments\" opcode.\n */\n#define VM_OC_GET_ARGS_SHIFT 8\n\n/**\n * Mask of \"get arguments\" opcode.\n */\n#define VM_OC_GET_ARGS_MASK 0x7\n\n/**\n * Generate the binary representation of a \"get arguments\" opcode.\n */\n#define VM_OC_GET_ARGS_CREATE_INDEX(V) (((V) &VM_OC_GET_ARGS_MASK) << VM_OC_GET_ARGS_SHIFT)\n\n/**\n * Extract the \"get arguments\" opcode.\n */\n#define VM_OC_GET_ARGS_INDEX(O) ((O) & (VM_OC_GET_ARGS_MASK << VM_OC_GET_ARGS_SHIFT))\n\n/**\n * Checks whether the result is stored somewhere.\n */\n#define VM_OC_HAS_GET_ARGS(V) ((V) & (VM_OC_GET_ARGS_MASK << VM_OC_GET_ARGS_SHIFT))\n\n/**\n * Argument getters that are part of the opcodes.\n */\ntypedef enum\n{\n  VM_OC_GET_NONE = VM_OC_GET_ARGS_CREATE_INDEX (0), /**< do nothing */\n  VM_OC_GET_BRANCH = VM_OC_GET_ARGS_CREATE_INDEX (1), /**< branch argument */\n  VM_OC_GET_STACK = VM_OC_GET_ARGS_CREATE_INDEX (2), /**< pop one element from the stack */\n  VM_OC_GET_STACK_STACK = VM_OC_GET_ARGS_CREATE_INDEX (3), /**< pop two elements from the stack */\n\n  VM_OC_GET_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (4), /**< resolve literal */\n  VM_OC_GET_LITERAL_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (5), /**< resolve two literals */\n  VM_OC_GET_STACK_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (6), /**< pop one element from the stack\n                                                              *   and resolve a literal */\n  VM_OC_GET_THIS_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (7), /**< get this and resolve a literal */\n} vm_oc_get_types;\n\n/**\n * Mask of \"group\" opcode.\n */\n#define VM_OC_GROUP_MASK 0xff\n\n/**\n * Extract the \"group\" opcode.\n */\n#define VM_OC_GROUP_GET_INDEX(O) ((O) &VM_OC_GROUP_MASK)\n\n/**\n * Opcodes.\n */\ntypedef enum\n{\n  VM_OC_POP, /**< pop from stack */\n  VM_OC_POP_BLOCK, /**< pop block */\n  VM_OC_PUSH, /**< push one literal  */\n  VM_OC_PUSH_TWO, /**< push two literals */\n  VM_OC_PUSH_THREE, /**< push three literals */\n  VM_OC_PUSH_UNDEFINED, /**< push undefined value */\n  VM_OC_PUSH_TRUE, /**< push true value */\n  VM_OC_PUSH_FALSE, /**< push false value */\n  VM_OC_PUSH_NULL, /**< push null value */\n  VM_OC_PUSH_THIS, /**< push this */\n  VM_OC_PUSH_0, /**< push number zero */\n  VM_OC_PUSH_POS_BYTE, /**< push number between 1 and 256 */\n  VM_OC_PUSH_NEG_BYTE, /**< push number between -1 and -256 */\n  VM_OC_PUSH_LIT_0, /**< push literal and number zero */\n  VM_OC_PUSH_LIT_POS_BYTE, /**< push literal and number between 1 and 256 */\n  VM_OC_PUSH_LIT_NEG_BYTE, /**< push literal and number between -1 and -256 */\n  VM_OC_PUSH_OBJECT, /**< push object */\n  VM_OC_PUSH_NAMED_FUNC_EXPR, /**< push named function expression */\n  VM_OC_SET_PROPERTY, /**< set property */\n\n  VM_OC_SET_GETTER, /**< set getter */\n  VM_OC_SET_SETTER, /**< set setter */\n  VM_OC_PUSH_ARRAY, /**< push array */\n  VM_OC_PUSH_ELISON, /**< push elison */\n  VM_OC_APPEND_ARRAY, /**< append array */\n  VM_OC_IDENT_REFERENCE, /**< ident reference */\n  VM_OC_PROP_REFERENCE, /**< prop reference */\n  VM_OC_PROP_GET, /**< prop get */\n\n  /* These eight opcodes must be in this order. */\n  VM_OC_PROP_PRE_INCR, /**< prefix increment of a property */\n  VM_OC_PROP_PRE_DECR, /**< prop prefix decrement of a property */\n  VM_OC_PROP_POST_INCR, /**< prop postfix increment of a property */\n  VM_OC_PROP_POST_DECR, /**< prop postfix decrement of a property */\n  VM_OC_PRE_INCR, /**< prefix increment  */\n  VM_OC_PRE_DECR, /**< prefix decrement */\n  VM_OC_POST_INCR, /**< postfix increment */\n  VM_OC_POST_DECR, /**< postfix decrement */\n\n  VM_OC_PROP_DELETE, /**< delete property */\n  VM_OC_DELETE, /**< delete */\n\n  VM_OC_MOV_IDENT, /**< move identifier register reference */\n  VM_OC_ASSIGN, /**< assign */\n  VM_OC_ASSIGN_PROP, /**< assign property */\n  VM_OC_ASSIGN_PROP_THIS, /**< assign prop this */\n\n  VM_OC_RETURN, /**< return */\n  VM_OC_RETURN_FUNCTION_END, /**< return at the end of a function/script */\n  VM_OC_THROW, /**< throw */\n  VM_OC_THROW_REFERENCE_ERROR, /**< throw reference error */\n\n  VM_OC_EVAL, /**< eval */\n  VM_OC_CALL, /**< call */\n  VM_OC_NEW, /**< new */\n  VM_OC_RESOLVE_BASE_FOR_CALL, /**< resolve base value before call */\n  VM_OC_ERROR, /**< error while the vm_loop is suspended */\n\n  VM_OC_JUMP, /**< jump */\n  VM_OC_BRANCH_IF_NULLISH, /** branch if undefined or null */\n  VM_OC_BRANCH_OPTIONAL_CHAIN, /** branch if undefined or null and adjust stack */\n  VM_OC_POP_REFERENCE, /** prop identifier or property reference from the stack */\n  VM_OC_BRANCH_IF_STRICT_EQUAL, /**< branch if strict equal */\n\n  /* These four opcodes must be in this order. */\n  VM_OC_BRANCH_IF_TRUE, /**< branch if true */\n  VM_OC_BRANCH_IF_FALSE, /**< branch if false */\n  VM_OC_BRANCH_IF_LOGICAL_TRUE, /**< branch if logical true */\n  VM_OC_BRANCH_IF_LOGICAL_FALSE, /**< branch if logical false */\n\n  VM_OC_PLUS, /**< unary plus */\n  VM_OC_MINUS, /**< unary minus */\n  VM_OC_NOT, /**< not */\n  VM_OC_BIT_NOT, /**< bitwise not */\n  VM_OC_VOID, /**< void */\n  VM_OC_TYPEOF_IDENT, /**< typeof identifier */\n  VM_OC_TYPEOF, /**< typeof */\n\n  VM_OC_ADD, /**< binary add */\n  VM_OC_SUB, /**< binary sub */\n  VM_OC_MUL, /**< mul */\n  VM_OC_DIV, /**< div */\n  VM_OC_MOD, /**< mod */\n  VM_OC_EXP, /**< exponentiation */\n\n  VM_OC_EQUAL, /**< equal */\n  VM_OC_NOT_EQUAL, /**< not equal */\n  VM_OC_STRICT_EQUAL, /**< strict equal */\n  VM_OC_STRICT_NOT_EQUAL, /**< strict not equal */\n  VM_OC_LESS, /**< less */\n  VM_OC_GREATER, /**< greater */\n  VM_OC_LESS_EQUAL, /**< less equal */\n  VM_OC_GREATER_EQUAL, /**< greater equal */\n  VM_OC_IN, /**< in */\n  VM_OC_INSTANCEOF, /**< instanceof */\n\n  VM_OC_BIT_OR, /**< bitwise or */\n  VM_OC_BIT_XOR, /**< bitwise xor */\n  VM_OC_BIT_AND, /**< bitwise and */\n  VM_OC_LEFT_SHIFT, /**< left shift */\n  VM_OC_RIGHT_SHIFT, /**< right shift */\n  VM_OC_UNS_RIGHT_SHIFT, /**< unsigned right shift */\n\n  VM_OC_BLOCK_CREATE_CONTEXT, /**< create lexical environment for blocks enclosed in braces */\n  VM_OC_WITH, /**< with */\n  VM_OC_FOR_IN_INIT, /**< for-in init context */\n  VM_OC_FOR_IN_GET_NEXT, /**< get next */\n  VM_OC_FOR_IN_HAS_NEXT, /**< has next */\n\n  VM_OC_TRY, /**< try */\n  VM_OC_CATCH, /**< catch */\n  VM_OC_FINALLY, /**< finally */\n  VM_OC_CONTEXT_END, /**< context end */\n  VM_OC_JUMP_AND_EXIT_CONTEXT, /**< jump and exit context */\n\n  VM_OC_CREATE_BINDING, /**< create variables */\n  VM_OC_CREATE_ARGUMENTS, /**< create arguments object */\n  VM_OC_SET_BYTECODE_PTR, /**< setting bytecode pointer */\n  VM_OC_VAR_EVAL, /**< variable and function evaluation */\n  VM_OC_EXT_VAR_EVAL, /**< variable and function evaluation for\n                       *   functions with separate argument context */\n  VM_OC_INIT_ARG_OR_FUNC, /**< create and init a function or argument binding */\n\n#if JERRY_DEBUGGER\n  VM_OC_BREAKPOINT_ENABLED, /**< enabled breakpoint for debugger */\n  VM_OC_BREAKPOINT_DISABLED, /**< disabled breakpoint for debugger */\n#endif /* JERRY_DEBUGGER */\n  VM_OC_CLASS_CALL_STATIC_BLOCK, /**< call the class static block */\n  VM_OC_DEFINE_FIELD, /**< define class field  */\n  VM_OC_PRIVATE_PROP_REFERENCE, /**< reference to class private method */\n  VM_OC_ASSIGN_PRIVATE, /**< assign to private field  */\n  VM_OC_PRIVATE_FIELD_ADD, /**< add private field */\n  VM_OC_PRIVATE_PROP_GET, /**< get private field */\n  VM_OC_PRIVATE_IN, /**< 'in' opcode handler for private identifiers */\n  VM_OC_COLLECT_PRIVATE_PROPERTY, /**< collect private properties */\n  VM_OC_CHECK_VAR, /**< check redeclared vars in the global scope */\n  VM_OC_CHECK_LET, /**< check redeclared lets in the global scope */\n  VM_OC_ASSIGN_LET_CONST, /**< assign values to let/const declarations */\n  VM_OC_INIT_BINDING, /**< create and intialize a binding */\n  VM_OC_THROW_CONST_ERROR, /**< throw invalid assignment to const variable error */\n  VM_OC_COPY_TO_GLOBAL, /**< copy value to global lex env */\n  VM_OC_COPY_FROM_ARG, /**< copy value from arg lex env */\n  VM_OC_CLONE_CONTEXT, /**< clone lexical environment with let/const declarations */\n  VM_OC_COPY_DATA_PROPERTIES, /**< copy data properties of an object */\n  VM_OC_SET_COMPUTED_PROPERTY, /**< set computed property */\n\n  VM_OC_FOR_OF_INIT, /**< for-of init context */\n  VM_OC_FOR_OF_GET_NEXT, /**< for-of get next */\n  VM_OC_FOR_OF_HAS_NEXT, /**< for-of has next */\n  VM_OC_FOR_AWAIT_OF_INIT, /**< for-await-of init context */\n  VM_OC_FOR_AWAIT_OF_HAS_NEXT, /**< for-await-of has next */\n\n  VM_OC_LOCAL_EVAL, /**< eval in local context */\n  VM_OC_SUPER_CALL, /**< call the 'super' constructor */\n  VM_OC_PUSH_CLASS_ENVIRONMENT, /**< push class environment */\n  VM_OC_PUSH_IMPLICIT_CTOR, /**< create implicit class constructor */\n  VM_OC_INIT_CLASS, /**< initialize class */\n  VM_OC_FINALIZE_CLASS, /**< finalize class */\n  VM_OC_SET_FIELD_INIT, /**< store the class field initializer function */\n  VM_OC_SET_STATIC_FIELD_INIT, /**< store the static class field initializer function */\n  VM_OC_RUN_FIELD_INIT, /**< run the class field initializer function */\n  VM_OC_RUN_STATIC_FIELD_INIT, /**< run the static class field initializer function */\n  VM_OC_SET_NEXT_COMPUTED_FIELD, /**< set the next computed field of a class */\n  VM_OC_PUSH_SUPER_CONSTRUCTOR, /**< getSuperConstructor operation */\n  VM_OC_RESOLVE_LEXICAL_THIS, /**< resolve this_binding from from the lexical environment */\n  VM_OC_SUPER_REFERENCE, /**< push super reference */\n  VM_OC_SET_HOME_OBJECT, /**< set the [[HomeObject]] environment in an object literal */\n  VM_OC_OBJECT_LITERAL_HOME_ENV, /**< create/destroy [[HomeObject]] environment of an object literal */\n  VM_OC_SET_FUNCTION_NAME, /**< set function name property */\n\n  VM_OC_PUSH_SPREAD_ELEMENT, /**< push spread element */\n  VM_OC_PUSH_REST_OBJECT, /**< push rest object */\n  VM_OC_ITERATOR_CONTEXT_CREATE, /**< create iterator conext */\n  VM_OC_ITERATOR_CONTEXT_END, /**< finalize iterator cotnext */\n  VM_OC_ITERATOR_STEP, /**< IteratorStep abstract operation */\n  VM_OC_OBJ_INIT_CONTEXT_CREATE, /**< create object initializer context */\n  VM_OC_OBJ_INIT_CONTEXT_END, /**< finalize object initializer context */\n  VM_OC_OBJ_INIT_PUSH_REST, /**< push the object with the rest properties */\n  VM_OC_INITIALIZER_PUSH_NAME, /**< append string to name list array and push the string */\n  VM_OC_DEFAULT_INITIALIZER, /**< default initializer inside a pattern */\n  VM_OC_REST_INITIALIZER, /**< create rest object inside an array pattern */\n  VM_OC_INITIALIZER_PUSH_PROP, /**< push property for object initializer */\n  VM_OC_SPREAD_ARGUMENTS, /**< perform function call/construct with spreaded arguments */\n  VM_OC_CREATE_GENERATOR, /**< create a generator object */\n  VM_OC_YIELD, /**< yield operation */\n  VM_OC_ASYNC_YIELD, /**< async yield operation */\n  VM_OC_ASYNC_YIELD_ITERATOR, /**< async yield iterator operation */\n  VM_OC_AWAIT, /**< await operation */\n  VM_OC_GENERATOR_AWAIT, /**< generator await operation */\n  VM_OC_EXT_RETURN, /**< return which also clears the stack */\n  VM_OC_ASYNC_EXIT, /**< return from async function */\n  VM_OC_STRING_CONCAT, /**< string concatenation */\n  VM_OC_GET_TEMPLATE_OBJECT, /**< GetTemplateObject operation */\n  VM_OC_PUSH_NEW_TARGET, /**< push new.target onto the stack */\n  VM_OC_REQUIRE_OBJECT_COERCIBLE, /**< RequireObjectCoercible opretaion */\n  VM_OC_ASSIGN_SUPER, /**< assign super reference */\n  VM_OC_SET__PROTO__, /**< set prototype when __proto__: form is used */\n  VM_OC_PUSH_STATIC_FIELD_FUNC, /**< push static field initializer function */\n  VM_OC_ADD_COMPUTED_FIELD, /**< add computed field name */\n#if JERRY_MODULE_SYSTEM\n  VM_OC_MODULE_IMPORT, /**< module dynamic import */\n  VM_OC_MODULE_IMPORT_META, /**< module import.meta */\n#endif /* JERRY_MODULE_SYSTEM */\n\n  VM_OC_NONE, /**< a special opcode for unsupported byte codes */\n} vm_oc_types;\n\n/**\n * Unused opcodes, but required by byte-code types.\n */\ntypedef enum\n{\n#if !JERRY_DEBUGGER\n  VM_OC_BREAKPOINT_ENABLED = VM_OC_NONE, /**< enabled breakpoint for debugger is unused */\n  VM_OC_BREAKPOINT_DISABLED = VM_OC_NONE, /**< disabled breakpoint for debugger is unused */\n#endif /* !JERRY_DEBUGGER */\n#if !JERRY_MODULE_SYSTEM\n  VM_OC_MODULE_IMPORT = VM_OC_NONE, /**< module dynamic import */\n  VM_OC_MODULE_IMPORT_META = VM_OC_NONE, /**< module import.meta */\n#endif /* JERRY_MODULE_SYSTEM */\n\n  VM_OC_UNUSED = VM_OC_NONE /**< placeholder if the list is empty */\n} vm_oc_unused_types;\n\n/**\n * Decrement operator.\n */\n#define VM_OC_DECREMENT_OPERATOR_FLAG 0x1\n\n/**\n * Postfix increment/decrement operator.\n */\n#define VM_OC_POST_INCR_DECR_OPERATOR_FLAG 0x2\n\n/**\n * An named variable is updated by the increment/decrement operator.\n */\n#define VM_OC_IDENT_INCR_DECR_OPERATOR_FLAG 0x4\n\n/**\n * Jump to target offset if input value is logical false.\n */\n#define VM_OC_BRANCH_IF_FALSE_FLAG 0x1\n\n/**\n * Branch optimized for logical and/or opcodes.\n */\n#define VM_OC_LOGICAL_BRANCH_FLAG 0x2\n\n/**\n * Bit index shift for non-static property initializers.\n */\n#define VM_OC_NON_STATIC_SHIFT 15\n\n/**\n * This flag is set for static property initializers.\n */\n#define VM_OC_NON_STATIC_FLAG (0x1 << VM_OC_NON_STATIC_SHIFT)\n\n/**\n * Position of \"put result\" opcode.\n */\n#define VM_OC_PUT_RESULT_SHIFT 11\n\n/**\n * Mask of \"put result\" opcode.\n */\n#define VM_OC_PUT_RESULT_MASK 0xf\n\n/**\n * Generate a \"put result\" opcode flag bit.\n */\n#define VM_OC_PUT_RESULT_CREATE_FLAG(V) (((V) &VM_OC_PUT_RESULT_MASK) << VM_OC_PUT_RESULT_SHIFT)\n\n/**\n * Checks whether the result is stored somewhere.\n */\n#define VM_OC_HAS_PUT_RESULT(V) ((V) & (VM_OC_PUT_RESULT_MASK << VM_OC_PUT_RESULT_SHIFT))\n\n/**\n * Specify where the result is stored\n */\ntypedef enum\n{\n  VM_OC_PUT_IDENT = VM_OC_PUT_RESULT_CREATE_FLAG (0x1),\n  VM_OC_PUT_REFERENCE = VM_OC_PUT_RESULT_CREATE_FLAG (0x2),\n  VM_OC_PUT_STACK = VM_OC_PUT_RESULT_CREATE_FLAG (0x4),\n  VM_OC_PUT_BLOCK = VM_OC_PUT_RESULT_CREATE_FLAG (0x8),\n} vm_oc_put_types;\n\n/**\n * Non-recursive vm_loop: the vm_loop can be suspended\n * to execute a call /construct operation. These return\n * types of the vm_loop tells whether a call operation\n * is in progress or the vm_loop is finished.\n */\ntypedef enum\n{\n  VM_NO_EXEC_OP, /**< do nothing */\n  VM_EXEC_CALL, /**< invoke a function */\n  VM_EXEC_SUPER_CALL, /**< invoke a function through 'super' keyword */\n  VM_EXEC_SPREAD_OP, /**< call/construct operation with spreaded argument list */\n  VM_EXEC_RETURN, /**< return with the completion value without freeing registers */\n  VM_EXEC_CONSTRUCT, /**< construct a new object */\n} vm_call_operation;\n\necma_value_t vm_run_global (const ecma_compiled_code_t *bytecode_p, ecma_object_t *function_object_p);\necma_value_t vm_run_eval (ecma_compiled_code_t *bytecode_data_p, uint32_t parse_opts);\n\n#if JERRY_MODULE_SYSTEM\necma_value_t vm_run_module (ecma_module_t *module_p);\necma_value_t vm_init_module_scope (ecma_module_t *module_p);\n#endif /* JERRY_MODULE_SYSTEM */\n\necma_value_t vm_run (vm_frame_ctx_shared_t *shared_p, ecma_value_t this_binding_value, ecma_object_t *lex_env_p);\necma_value_t vm_execute (vm_frame_ctx_t *frame_ctx_p);\n\nbool vm_is_strict_mode (void);\nbool vm_is_direct_eval_form_call (void);\n\necma_value_t vm_get_backtrace (uint32_t max_depth);\n\n/**\n * @}\n * @}\n */\n\n#endif /* !VM_H */\n"
  },
  {
    "path": "jerry-debugger/README.md",
    "content": "# Available JerryScript debugger tools\n\n  - JerryScript console debugger client ( jerry_client.py )\n  - IoT.js Code ( https://github.com/jerryscript-project/iotjscode )\n  - JerryScript debugger Chrome webtool ( https://github.com/jerryscript-project/jerryscript-debugger-ts )\n"
  },
  {
    "path": "jerry-debugger/jerry_client.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom cmd import Cmd\nfrom pprint import pprint\nimport math\nimport socket\nimport sys\nimport logging\nimport time\nimport jerry_client_main\n\nfrom jerry_client_websocket import WebSocket\nfrom jerry_client_rawpacket import RawPacket\nfrom jerry_client_tcp import Socket\n\ndef write(string):\n    print(string, end='')\n\nclass DebuggerPrompt(Cmd):\n    # pylint: disable=too-many-instance-attributes,too-many-arguments\n    def __init__(self, debugger):\n        Cmd.__init__(self)\n        self.debugger = debugger\n        self.stop = False\n        self.quit = False\n\n    def precmd(self, line):\n        self.stop = False\n        if self.debugger.non_interactive:\n            print(f\"{line}\")\n        return line\n\n    def postcmd(self, stop, line):\n        return self.stop\n\n    def do_quit(self, _):\n        \"\"\" Exit JerryScript debugger \"\"\"\n        self.debugger.quit()\n        self.quit = True\n        self.stop = True\n\n    def do_display(self, args):\n        \"\"\" Toggle source code display after breakpoints \"\"\"\n        if args:\n            line_num = src_check_args(args)\n            if line_num >= 0:\n                self.debugger.display = line_num\n        else:\n            print(\"Non-negative integer number expected, 0 turns off this function\")\n\n    def do_break(self, args):\n        \"\"\" Insert breakpoints on the given lines or functions \"\"\"\n        write(self.debugger.set_break(args))\n    do_b = do_break\n\n    def do_list(self, _):\n        \"\"\" Lists the available breakpoints \"\"\"\n        write(self.debugger.breakpoint_list())\n\n    def do_delete(self, args):\n        \"\"\" Delete the given breakpoint, use 'delete all|active|pending' to clear all the given breakpoints \"\"\"\n        write(self.debugger.delete(args))\n\n    def do_exception(self, args):\n        \"\"\" Config the exception handler module \"\"\"\n        write(self.debugger.exception(args))\n\n    def do_next(self, args):\n        \"\"\" Next breakpoint in the same code block \"\"\"\n        self.stop = True\n        if not args:\n            args = 0\n            self.debugger.next()\n            return\n\n        try:\n            args = int(args)\n            if args <= 0:\n                raise ValueError(args)\n\n            while args > 0:\n                self.debugger.next()\n                time.sleep(0.1)\n\n                while True:\n                    result = self.debugger.process_messages()\n                    res_type = result.get_type()\n\n                    if res_type == result.END:\n                        self.quit = True\n                        return\n                    if res_type == result.TEXT:\n                        write(result.get_text())\n                    elif res_type == result.PROMPT:\n                        break\n\n                args -= 1\n        except ValueError as val_errno:\n            print(f\"Error: expected a positive integer: {val_errno}\")\n    do_n = do_next\n\n    def do_step(self, _):\n        \"\"\" Next breakpoint, step into functions \"\"\"\n        self.debugger.step()\n        self.stop = True\n    do_s = do_step\n\n    def do_continue(self, _):\n        \"\"\" Continue execution \"\"\"\n        self.debugger.do_continue()\n        self.stop = True\n        if not self.debugger.non_interactive:\n            print(\"Press enter to stop JavaScript execution.\")\n    do_c = do_continue\n\n    def do_finish(self, _):\n        \"\"\" Continue running until the current function returns \"\"\"\n        self.debugger.finish()\n        self.stop = True\n    do_f = do_finish\n\n    def do_backtrace(self, args):\n        \"\"\" Get backtrace data from debugger \"\"\"\n        write(self.debugger.backtrace(args))\n        self.stop = True\n    do_bt = do_backtrace\n\n    def do_src(self, args):\n        \"\"\" Get current source code \"\"\"\n        if args:\n            line_num = src_check_args(args)\n            if line_num >= 0:\n                write(self.debugger.print_source(line_num, 0))\n        else:\n            write(self.debugger.print_source(0, 0))\n    do_source = do_src\n\n    def do_scroll(self, _):\n        \"\"\" Scroll the source up or down \"\"\"\n        while True:\n            key = sys.stdin.readline()\n            if key == 'w\\n':\n                _scroll_direction(self.debugger, \"up\")\n            elif key == 's\\n':\n                _scroll_direction(self.debugger, \"down\")\n            elif key == 'q\\n':\n                break\n            else:\n                print(\"Invalid key\")\n\n    def do_eval(self, args):\n        \"\"\" Evaluate JavaScript source code \"\"\"\n        self.debugger.eval(args)\n        self.stop = True\n    do_e = do_eval\n    do_print = do_eval\n    do_p = do_eval\n\n    def do_eval_at(self, args):\n        \"\"\" Evaluate JavaScript source code at a scope chain level \"\"\"\n\n        code = ''\n        index = 0\n        try:\n            args = args.split(\" \", 1)\n\n            index = int(args[0])\n\n            if len(args) == 2:\n                code = args[1]\n\n            if index < 0 or index > 65535:\n                raise ValueError(f\"Invalid scope chain index: {index} (must be between 0 and 65535)\")\n\n        except ValueError as val_errno:\n            print(f\"Error: {val_errno}\")\n            return\n\n        self.debugger.eval_at(code, index)\n        self.stop = True\n\n    def do_throw(self, args):\n        \"\"\" Throw an exception \"\"\"\n        self.debugger.throw(args)\n        self.stop = True\n\n    def do_abort(self, args):\n        \"\"\" Throw an exception which cannot be caught \"\"\"\n        self.debugger.abort(args)\n        self.stop = True\n\n    def do_restart(self, _):\n        \"\"\" Restart the engine's debug session \"\"\"\n        self.debugger.restart()\n        self.stop = True\n    do_res = do_restart\n\n    def do_scope(self, _):\n        \"\"\" Get lexical environment chain \"\"\"\n        self.debugger.scope_chain()\n        self.stop = True\n\n    def do_variables(self, args):\n        \"\"\" Get scope variables from debugger \"\"\"\n        write(self.debugger.scope_variables(args))\n        self.stop = True\n\n    def do_memstats(self, _):\n        \"\"\" Memory statistics \"\"\"\n        self.debugger.memstats()\n        self.stop = True\n    do_ms = do_memstats\n\n    def do_dump(self, args):\n        \"\"\" Dump all of the debugger data \"\"\"\n        if args:\n            print(\"Error: No argument expected\")\n        else:\n            pprint(self.debugger.function_list)\n\n    # pylint: disable=invalid-name\n    def do_EOF(self, _):\n        \"\"\" Exit JerryScript debugger \"\"\"\n        print(\"Unexpected end of input. Connection closed.\")\n        self.debugger.quit()\n        self.quit = True\n        self.stop = True\n\ndef _scroll_direction(debugger, direction):\n    \"\"\" Helper function for do_scroll \"\"\"\n    debugger.src_offset_diff = int(max(math.floor(debugger.display / 3), 1))\n    if direction == \"up\":\n        debugger.src_offset -= debugger.src_offset_diff\n    else:\n        debugger.src_offset += debugger.src_offset_diff\n    print(debugger.print_source(debugger.display, debugger.src_offset)['value'])\n\ndef src_check_args(args):\n    try:\n        line_num = int(args)\n        if line_num < 0:\n            print(\"Error: Non-negative integer number expected\")\n            return -1\n\n        return line_num\n    except ValueError as val_errno:\n        print(f\"Error: Non-negative integer number expected: {val_errno}\")\n        return -1\n\n# pylint: disable=too-many-branches,too-many-locals,too-many-statements,import-outside-toplevel\ndef main():\n    args = jerry_client_main.arguments_parse()\n\n    channel = None\n    protocol = None\n\n    if args.protocol == \"tcp\":\n        address = None\n        if \":\" not in args.address:\n            address = (args.address, 5001) # use default port\n        else:\n            host, port = args.address.split(\":\")\n            address = (host, int(port))\n\n        protocol = Socket(address)\n    elif args.protocol == \"serial\":\n        from jerry_client_serial import Serial\n        protocol = Serial(args.serial_config)\n    else:\n        print(\"Unsupported transmission protocol\")\n        return -1\n\n    if args.channel == \"websocket\":\n        channel = WebSocket(protocol=protocol)\n    elif args.channel == \"rawpacket\":\n        channel = RawPacket(protocol=protocol)\n    else:\n        print(\"Unsupported communication channel\")\n        return -1\n\n    debugger = jerry_client_main.JerryDebugger(channel)\n    debugger.non_interactive = args.non_interactive\n\n    logging.debug(\"Connected to JerryScript\")\n\n    prompt = DebuggerPrompt(debugger)\n    prompt.prompt = \"(jerry-debugger) \"\n\n    if args.color:\n        debugger.set_colors()\n\n    if args.display:\n        debugger.display = args.display\n        prompt.do_display(args.display)\n    else:\n        prompt.stop = False\n\n    if args.exception is not None:\n        prompt.do_exception(str(args.exception))\n\n    if args.client_source:\n        debugger.store_client_sources(args.client_source)\n\n    while True:\n        if prompt.quit:\n            break\n\n        result = debugger.process_messages()\n        res_type = result.get_type()\n\n        if res_type == result.END:\n            break\n        if res_type == result.PROMPT:\n            prompt.cmdloop()\n        elif res_type == result.TEXT:\n            write(result.get_text())\n        continue\n\nif __name__ == \"__main__\":\n    try:\n        main()\n    except socket.error as error_msg:\n        ERRNO = error_msg.errno\n        MSG = str(error_msg)\n        if ERRNO == 111:\n            sys.exit(\"Failed to connect to the JerryScript debugger.\")\n        elif ERRNO in (32, 104):\n            sys.exit(\"Connection closed.\")\n        else:\n            sys.exit(f\"Failed to connect to the JerryScript debugger.\\nError: {MSG}\")\n"
  },
  {
    "path": "jerry-debugger/jerry_client_main.py",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport logging\nimport re\nimport select\nimport struct\nimport sys\n\n# Expected debugger protocol version.\nJERRY_DEBUGGER_VERSION = 9\n\n# Messages sent by the server to client.\nJERRY_DEBUGGER_CONFIGURATION = 1\nJERRY_DEBUGGER_PARSE_ERROR = 2\nJERRY_DEBUGGER_BYTE_CODE_CP = 3\nJERRY_DEBUGGER_PARSE_FUNCTION = 4\nJERRY_DEBUGGER_BREAKPOINT_LIST = 5\nJERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST = 6\nJERRY_DEBUGGER_SOURCE_CODE = 7\nJERRY_DEBUGGER_SOURCE_CODE_END = 8\nJERRY_DEBUGGER_SOURCE_CODE_NAME = 9\nJERRY_DEBUGGER_SOURCE_CODE_NAME_END = 10\nJERRY_DEBUGGER_FUNCTION_NAME = 11\nJERRY_DEBUGGER_FUNCTION_NAME_END = 12\nJERRY_DEBUGGER_WAITING_AFTER_PARSE = 13\nJERRY_DEBUGGER_RELEASE_BYTE_CODE_CP = 14\nJERRY_DEBUGGER_MEMSTATS_RECEIVE = 15\nJERRY_DEBUGGER_BREAKPOINT_HIT = 16\nJERRY_DEBUGGER_EXCEPTION_HIT = 17\nJERRY_DEBUGGER_EXCEPTION_STR = 18\nJERRY_DEBUGGER_EXCEPTION_STR_END = 19\nJERRY_DEBUGGER_BACKTRACE_TOTAL = 20\nJERRY_DEBUGGER_BACKTRACE = 21\nJERRY_DEBUGGER_BACKTRACE_END = 22\nJERRY_DEBUGGER_EVAL_RESULT = 23\nJERRY_DEBUGGER_EVAL_RESULT_END = 24\nJERRY_DEBUGGER_WAIT_FOR_SOURCE = 25\nJERRY_DEBUGGER_OUTPUT_RESULT = 26\nJERRY_DEBUGGER_OUTPUT_RESULT_END = 27\nJERRY_DEBUGGER_SCOPE_CHAIN = 28\nJERRY_DEBUGGER_SCOPE_CHAIN_END = 29\nJERRY_DEBUGGER_SCOPE_VARIABLES = 30\nJERRY_DEBUGGER_SCOPE_VARIABLES_END = 31\nJERRY_DEBUGGER_CLOSE_CONNECTION = 32\n\n# Debugger option flags\nJERRY_DEBUGGER_LITTLE_ENDIAN = 0x1\n\n# Subtypes of eval\nJERRY_DEBUGGER_EVAL_EVAL = \"\\0\"\nJERRY_DEBUGGER_EVAL_THROW = \"\\1\"\nJERRY_DEBUGGER_EVAL_ABORT = \"\\2\"\n\n# Subtypes of eval result\nJERRY_DEBUGGER_EVAL_OK = 1\nJERRY_DEBUGGER_EVAL_ERROR = 2\n\n# Subtypes of output\nJERRY_DEBUGGER_OUTPUT_PRINT = 1\nJERRY_DEBUGGER_OUTPUT_LOG = 2\n\n# Messages sent by the client to server.\nJERRY_DEBUGGER_FREE_BYTE_CODE_CP = 1\nJERRY_DEBUGGER_UPDATE_BREAKPOINT = 2\nJERRY_DEBUGGER_EXCEPTION_CONFIG = 3\nJERRY_DEBUGGER_PARSER_CONFIG = 4\nJERRY_DEBUGGER_MEMSTATS = 5\nJERRY_DEBUGGER_STOP = 6\nJERRY_DEBUGGER_PARSER_RESUME = 7\nJERRY_DEBUGGER_CLIENT_SOURCE = 8\nJERRY_DEBUGGER_CLIENT_SOURCE_PART = 9\nJERRY_DEBUGGER_NO_MORE_SOURCES = 10\nJERRY_DEBUGGER_CONTEXT_RESET = 11\nJERRY_DEBUGGER_CONTINUE = 12\nJERRY_DEBUGGER_STEP = 13\nJERRY_DEBUGGER_NEXT = 14\nJERRY_DEBUGGER_FINISH = 15\nJERRY_DEBUGGER_GET_BACKTRACE = 16\nJERRY_DEBUGGER_EVAL = 17\nJERRY_DEBUGGER_EVAL_PART = 18\nJERRY_DEBUGGER_GET_SCOPE_CHAIN = 19\nJERRY_DEBUGGER_GET_SCOPE_VARIABLES = 20\n\nJERRY_DEBUGGER_SCOPE_WITH = 1\nJERRY_DEBUGGER_SCOPE_LOCAL = 2\nJERRY_DEBUGGER_SCOPE_CLOSURE = 3\nJERRY_DEBUGGER_SCOPE_GLOBAL = 4\nJERRY_DEBUGGER_SCOPE_NON_CLOSURE = 5\n\nJERRY_DEBUGGER_VALUE_NONE = 1\nJERRY_DEBUGGER_VALUE_UNDEFINED = 2\nJERRY_DEBUGGER_VALUE_NULL = 3\nJERRY_DEBUGGER_VALUE_BOOLEAN = 4\nJERRY_DEBUGGER_VALUE_NUMBER = 5\nJERRY_DEBUGGER_VALUE_STRING = 6\nJERRY_DEBUGGER_VALUE_FUNCTION = 7\nJERRY_DEBUGGER_VALUE_ARRAY = 8\nJERRY_DEBUGGER_VALUE_OBJECT = 9\n\n\ndef arguments_parse():\n    parser = argparse.ArgumentParser(description=\"JerryScript debugger client\")\n\n    parser.add_argument(\"address\", action=\"store\", nargs=\"?\", default=\"localhost:5001\",\n                        help=\"specify a unique network address for tcp connection (default: %(default)s)\")\n    parser.add_argument(\"-v\", \"--verbose\", action=\"store_true\", default=False,\n                        help=\"increase verbosity (default: %(default)s)\")\n    parser.add_argument(\"--non-interactive\", action=\"store_true\", default=False,\n                        help=\"disable stop when newline is pressed (default: %(default)s)\")\n    parser.add_argument(\"--color\", action=\"store_true\", default=False,\n                        help=\"enable color highlighting on source commands (default: %(default)s)\")\n    parser.add_argument(\"--display\", action=\"store\", default=None, type=int,\n                        help=\"set display range\")\n    parser.add_argument(\"--exception\", action=\"store\", default=None, type=int, choices=[0, 1],\n                        help=\"set exception config, usage 1: [Enable] or 0: [Disable]\")\n    parser.add_argument(\"--client-source\", action=\"store\", default=[], type=str, nargs=\"+\",\n                        help=\"specify a javascript source file to execute\")\n    parser.add_argument(\"--channel\", choices=[\"websocket\", \"rawpacket\"], default=\"websocket\",\n                        help=\"specify the communication channel (default: %(default)s)\")\n    parser.add_argument(\"--protocol\", choices=[\"tcp\", \"serial\"], default=\"tcp\",\n                        help=\"specify the transmission protocol over the communication channel (default: %(default)s)\")\n    parser.add_argument(\"--serial-config\", metavar=\"CONFIG_STRING\", default=\"/dev/ttyUSB0,115200,8,N,1\",\n                        help=\"Configure parameters for serial port (default: %(default)s)\")\n    args = parser.parse_args()\n\n    if args.verbose:\n        logging.basicConfig(format=\"%(levelname)s: %(message)s\", level=logging.DEBUG)\n        logging.debug(\"Debug logging mode: ON\")\n\n    return args\n\n\nclass JerryBreakpoint:\n\n    def __init__(self, line, offset, function):\n        self.line = line\n        self.offset = offset\n        self.function = function\n        self.active_index = -1\n\n    def __str__(self):\n        result = self.function.source_name or \"<unknown>\"\n        result += f\":{self.line}\"\n\n        if self.function.is_func:\n            result += \" (in \"\n            result += self.function.name or \"function\"\n            result += f\"() at line:{self.function.line}, col:{self.function.column})\"\n        return result\n\n    def __repr__(self):\n        return f\"Breakpoint(line:{self.line}, offset:{self.offset}, active_index:{self.active_index})\"\n\nclass JerryPendingBreakpoint:\n    def __init__(self, line=None, source_name=None, function=None):\n        self.function = function\n        self.line = line\n        self.source_name = source_name or \"\"\n\n        self.index = -1\n\n    def __str__(self):\n        result = self.source_name\n        if self.line:\n            result += f\":{self.line}\"\n        else:\n            result += f\"{self.function}()\"\n        return result\n\n\nclass JerryFunction:\n    # pylint: disable=too-many-instance-attributes,too-many-arguments\n    def __init__(self, is_func, byte_code_cp, source, source_name, line, column, name, lines, offsets):\n        self.is_func = bool(is_func)\n        self.byte_code_cp = byte_code_cp\n        self.source = re.split(\"\\r\\n|[\\r\\n]\", source)\n        self.source_name = source_name\n        self.name = name\n        self.lines = {}\n        self.offsets = {}\n        self.line = line\n        self.column = column\n        self.first_breakpoint_line = lines[0]\n        self.first_breakpoint_offset = offsets[0]\n\n        if len(self.source) > 1 and not self.source[-1]:\n            self.source.pop()\n\n        for i, _line in enumerate(lines):\n            offset = offsets[i]\n            breakpt = JerryBreakpoint(_line, offset, self)\n            self.lines[_line] = breakpt\n            self.offsets[offset] = breakpt\n\n    def __repr__(self):\n        result = f\"Function(byte_code_cp:0x{self.byte_code_cp:x}, source_name:{self.source_name!r}, \"\\\n                 f\"name:{self.name!r}, line:{self.line}, column:{self.column} {{ \"\n\n        result += ','.join([str(breakpoint) for breakpoint in self.lines.values()])\n\n        return result + \" })\"\n\n\nclass Multimap:\n\n    def __init__(self):\n        self.map = {}\n\n    def get(self, key):\n        if key in self.map:\n            return self.map[key]\n        return []\n\n    def insert(self, key, value):\n        if key in self.map:\n            self.map[key].append(value)\n        else:\n            self.map[key] = [value]\n\n    def delete(self, key, value):\n        items = self.map[key]\n\n        if len(items) == 1:\n            del self.map[key]\n        else:\n            del items[items.index(value)]\n\n    def __repr__(self):\n        return f\"Multimap({self.map!r})\"\n\n\nclass DebuggerAction:\n    END = 0\n    WAIT = 1\n    TEXT = 2\n    PROMPT = 3\n\n    def __init__(self, action_type, action_text):\n        self.action_type = action_type\n        self.action_text = action_text\n\n    def get_type(self):\n        return self.action_type\n\n    def get_text(self):\n        return self.action_text\n\n\nclass JerryDebugger:\n    # pylint: disable=too-many-instance-attributes,too-many-statements,too-many-public-methods,no-self-use\n    def __init__(self, channel):\n        self.prompt = False\n        self.function_list = {}\n        self.source = ''\n        self.source_name = ''\n        self.exception_string = ''\n        self.frame_index = 0\n        self.scope_vars = \"\"\n        self.scope_data = \"\"\n        self.client_sources = []\n        self.last_breakpoint_hit = None\n        self.next_breakpoint_index = 0\n        self.active_breakpoint_list = {}\n        self.pending_breakpoint_list = {}\n        self.line_list = Multimap()\n        self.display = 0\n        self.green = ''\n        self.red = ''\n        self.yellow = ''\n        self.green_bg = ''\n        self.yellow_bg = ''\n        self.blue = ''\n        self.nocolor = ''\n        self.src_offset = 0\n        self.src_offset_diff = 0\n        self.non_interactive = False\n        self.current_out = \"\"\n        self.current_log = \"\"\n        self.channel = channel\n\n        config_size = 8\n        # The server will send the configuration message after connection established\n        # type [1]\n        # configuration [1]\n        # version [4]\n        # max_message_size [1]\n        # cpointer_size [1]\n        result = self.channel.connect(config_size)\n\n        if len(result) != config_size or result[0] != JERRY_DEBUGGER_CONFIGURATION:\n            raise Exception(\"Unexpected configuration\")\n\n        self.little_endian = result[1] & JERRY_DEBUGGER_LITTLE_ENDIAN\n        self.max_message_size = result[6]\n        self.cp_size = result[7]\n\n        if self.little_endian:\n            self.byte_order = \"<\"\n            logging.debug(\"Little-endian machine\")\n        else:\n            self.byte_order = \">\"\n            logging.debug(\"Big-endian machine\")\n\n        if self.cp_size == 2:\n            self.cp_format = \"H\"\n        else:\n            self.cp_format = \"I\"\n\n        self.idx_format = \"I\"\n\n        self.version = struct.unpack(self.byte_order + self.idx_format, result[2:6])[0]\n        if self.version != JERRY_DEBUGGER_VERSION:\n            raise Exception(f\"Incorrect debugger version from target: {self.version} \"\n                            f\"expected: {JERRY_DEBUGGER_VERSION}\")\n\n        logging.debug(\"Compressed pointer size: %d\", self.cp_size)\n\n    def __del__(self):\n        if self.channel is not None:\n            self.channel.close()\n\n    def _exec_command(self, command_id):\n        message = struct.pack(self.byte_order + \"BB\",\n                              1,\n                              command_id)\n        self.channel.send_message(self.byte_order, message)\n\n    def quit(self):\n        self.prompt = False\n        self._exec_command(JERRY_DEBUGGER_CONTINUE)\n\n    def set_colors(self):\n        self.nocolor = '\\033[0m'\n        self.green = '\\033[92m'\n        self.red = '\\033[31m'\n        self.yellow = '\\033[93m'\n        self.green_bg = '\\033[42m\\033[30m'\n        self.yellow_bg = '\\033[43m\\033[30m'\n        self.blue = '\\033[94m'\n\n    def stop(self):\n        self._exec_command(JERRY_DEBUGGER_STOP)\n\n    def set_break(self, args):\n        if not args:\n            return \"Error: Breakpoint index expected\"\n\n        if ':' in args:\n            try:\n                if int(args.split(':', 1)[1]) <= 0:\n                    return \"Error: Positive breakpoint index expected\"\n\n                return self._set_breakpoint(args, False)\n\n            except ValueError as val_errno:\n                return f\"Error: Positive breakpoint index expected: {val_errno}\"\n\n        return self._set_breakpoint(args, False)\n\n    def breakpoint_list(self):\n        result = ''\n        if self.active_breakpoint_list:\n            result += f\"=== {self.green_bg}Active breakpoints {self.nocolor} ===\\n\"\n            for breakpt in self.active_breakpoint_list.values():\n                result += f\" {breakpt.active_index}: {breakpt}\\n\"\n        if self.pending_breakpoint_list:\n            result += f\"=== {self.yellow_bg}Pending breakpoints{self.nocolor} ===\\n\"\n            for breakpt in self.pending_breakpoint_list.values():\n                result += f\" {breakpt.index}: {breakpt} (pending)\\n\"\n\n        if not self.active_breakpoint_list and not self.pending_breakpoint_list:\n            result += \"No breakpoints\\n\"\n\n        return result\n\n    def delete(self, args):\n        if not args:\n            return \"Error: Breakpoint index expected\\n\" \\\n                   \"Delete the given breakpoint, use 'delete all|active|pending' \" \\\n                   \"to clear all the given breakpoints\\n \"\n        if args in ['all', 'pending', 'active']:\n            if args != \"pending\":\n                for i in list(self.active_breakpoint_list.values()):\n                    breakpt = self.active_breakpoint_list[i.active_index]\n                    del self.active_breakpoint_list[i.active_index]\n                    breakpt.active_index = -1\n                    self._send_breakpoint(breakpt)\n\n            if args != \"active\":\n                if self.pending_breakpoint_list:\n                    self.pending_breakpoint_list.clear()\n                    self._send_parser_config(0)\n            return \"\"\n\n        try:\n            breakpoint_index = int(args)\n        except ValueError as val_errno:\n            return f\"Error: Integer number expected, {val_errno}\\n\"\n\n        if breakpoint_index in self.active_breakpoint_list:\n            breakpt = self.active_breakpoint_list[breakpoint_index]\n            del self.active_breakpoint_list[breakpoint_index]\n            breakpt.active_index = -1\n            self._send_breakpoint(breakpt)\n            return f\"Breakpoint {breakpoint_index} deleted\\n\"\n        if breakpoint_index in self.pending_breakpoint_list:\n            del self.pending_breakpoint_list[breakpoint_index]\n            if not self.pending_breakpoint_list:\n                self._send_parser_config(0)\n            return f\"Pending breakpoint {breakpoint_index} deleted\\n\"\n        return f\"Error: Breakpoint {breakpoint_index} not found\\n\"\n\n    def next(self):\n        self.prompt = False\n        self._exec_command(JERRY_DEBUGGER_NEXT)\n\n    def step(self):\n        self.prompt = False\n        self._exec_command(JERRY_DEBUGGER_STEP)\n\n    def do_continue(self):\n        self.prompt = False\n        self._exec_command(JERRY_DEBUGGER_CONTINUE)\n\n    def finish(self):\n        self.prompt = False\n        self._exec_command(JERRY_DEBUGGER_FINISH)\n\n    def backtrace(self, args):\n        max_depth = 0\n        min_depth = 0\n        get_total = 0\n\n        if args:\n            args = args.split(\" \")\n            try:\n                if \"t\" in args:\n                    get_total = 1\n                    args.remove(\"t\")\n\n                if len(args) >= 2:\n                    min_depth = int(args[0])\n                    max_depth = int(args[1])\n                    if max_depth <= 0 or min_depth < 0:\n                        return \"Error: Positive integer number expected\\n\"\n                    if min_depth > max_depth:\n                        return \"Error: Start depth needs to be lower than or equal to max depth\\n\"\n                elif len(args) >= 1:\n                    max_depth = int(args[0])\n                    if max_depth <= 0:\n                        return \"Error: Positive integer number expected\\n\"\n\n            except ValueError as val_errno:\n                return f\"Error: Positive integer number expected, {val_errno}\\n\"\n\n        self.frame_index = min_depth\n\n        message = struct.pack(self.byte_order + \"BB\" + self.idx_format + self.idx_format + \"B\",\n                              1 + 4 + 4 + 1,\n                              JERRY_DEBUGGER_GET_BACKTRACE,\n                              min_depth,\n                              max_depth,\n                              get_total)\n\n        self.channel.send_message(self.byte_order, message)\n\n        self.prompt = False\n        return \"\"\n\n    def eval(self, code):\n        self._send_string(JERRY_DEBUGGER_EVAL_EVAL + code, JERRY_DEBUGGER_EVAL)\n        self.prompt = False\n\n    def eval_at(self, code, index):\n        self._send_string(JERRY_DEBUGGER_EVAL_EVAL + code, JERRY_DEBUGGER_EVAL, index)\n        self.prompt = False\n\n    def throw(self, code):\n        self._send_string(JERRY_DEBUGGER_EVAL_THROW + code, JERRY_DEBUGGER_EVAL)\n        self.prompt = False\n\n    def abort(self, args):\n        self.delete(\"all\")\n        self.exception(\"0\")  # disable the exception handler\n        self._send_string(JERRY_DEBUGGER_EVAL_ABORT + args, JERRY_DEBUGGER_EVAL)\n        self.prompt = False\n\n    def restart(self):\n        self._send_string(JERRY_DEBUGGER_EVAL_ABORT + \"\\\"r353t\\\"\", JERRY_DEBUGGER_EVAL)\n        self.prompt = False\n\n    def exception(self, args):\n        try:\n            enabled = int(args)\n        except (ValueError, TypeError):\n            enabled = -1\n\n        if enabled not in [0, 1]:\n            return \"Error: Invalid input! Usage 1: [Enable] or 0: [Disable]\\n\"\n\n        if enabled:\n            logging.debug(\"Stop at exception enabled\")\n            self._send_exception_config(enabled)\n\n            return \"Stop at exception enabled\\n\"\n\n        logging.debug(\"Stop at exception disabled\")\n        self._send_exception_config(enabled)\n\n        return \"Stop at exception disabled\\n\"\n\n    def scope_chain(self):\n        self.prompt = False\n        self._exec_command(JERRY_DEBUGGER_GET_SCOPE_CHAIN)\n\n    def scope_variables(self, args):\n        index = 0\n        if args:\n            try:\n                index = int(args)\n                if index < 0:\n                    print(\"Error: A non negative integer number expected\")\n                    return \"\"\n\n            except ValueError as val_errno:\n                return f\"Error: Non negative integer number expected, {val_errno}\\n\"\n\n        message = struct.pack(self.byte_order + \"BB\" + self.idx_format,\n                              1 + 4,\n                              JERRY_DEBUGGER_GET_SCOPE_VARIABLES,\n                              index)\n\n        self.channel.send_message(self.byte_order, message)\n\n        self.prompt = False\n        return \"\"\n\n    def memstats(self):\n        self.prompt = False\n        self._exec_command(JERRY_DEBUGGER_MEMSTATS)\n\n    def _send_string(self, args, message_type, index=0):\n        args = args.encode('utf8')\n\n        # 1: length of type byte\n        # 4: length of an uint32 value\n        message_header = 1 + 4\n\n        # Add scope chain index\n        if message_type == JERRY_DEBUGGER_EVAL:\n            args = struct.pack(self.byte_order + \"I\", index) + args\n\n        size = len(args)\n\n        max_fragment = min(self.max_message_size - message_header, size)\n\n        message = struct.pack(self.byte_order + \"BBI\",\n                              max_fragment + message_header,\n                              message_type,\n                              size)\n\n        if size == max_fragment:\n            self.channel.send_message(self.byte_order, message + args)\n            return\n\n        self.channel.send_message(self.byte_order, message + args[0:max_fragment])\n        offset = max_fragment\n\n        if message_type == JERRY_DEBUGGER_EVAL:\n            message_type = JERRY_DEBUGGER_EVAL_PART\n        else:\n            message_type = JERRY_DEBUGGER_CLIENT_SOURCE_PART\n\n        # 1: length of type byte\n        message_header = 1\n\n        max_fragment = self.max_message_size - message_header\n        while offset < size:\n            next_fragment = min(max_fragment, size - offset)\n\n            message = struct.pack(self.byte_order + \"BB\",\n                                  next_fragment + message_header,\n                                  message_type)\n\n            prev_offset = offset\n            offset += next_fragment\n\n            self.channel.send_message(self.byte_order, message + args[prev_offset:offset])\n\n    def _breakpoint_pending_exists(self, breakpt):\n        for existing_bp in self.pending_breakpoint_list.values():\n            if (breakpt.line and existing_bp.source_name == breakpt.source_name and \\\n                existing_bp.line == breakpt.line) \\\n               or (not breakpt.line and existing_bp.function == breakpt.function):\n                return True\n\n        return False\n\n    def _send_breakpoint(self, breakpt):\n        message = struct.pack(self.byte_order + \"BBB\" + self.cp_format + self.idx_format,\n                              1 + 1 + self.cp_size + 4,\n                              JERRY_DEBUGGER_UPDATE_BREAKPOINT,\n                              int(breakpt.active_index >= 0),\n                              breakpt.function.byte_code_cp,\n                              breakpt.offset)\n        self.channel.send_message(self.byte_order, message)\n\n    def _send_bytecode_cp(self, byte_code_cp):\n        message = struct.pack(self.byte_order + \"BB\" + self.cp_format,\n                              1 + self.cp_size,\n                              JERRY_DEBUGGER_FREE_BYTE_CODE_CP,\n                              byte_code_cp)\n        self.channel.send_message(self.byte_order, message)\n\n    def _send_exception_config(self, enable):\n        message = struct.pack(self.byte_order + \"BBB\",\n                              1 + 1,\n                              JERRY_DEBUGGER_EXCEPTION_CONFIG,\n                              enable)\n        self.channel.send_message(self.byte_order, message)\n\n    def _send_parser_config(self, enable):\n        message = struct.pack(self.byte_order + \"BBB\",\n                              1 + 1,\n                              JERRY_DEBUGGER_PARSER_CONFIG,\n                              enable)\n        self.channel.send_message(self.byte_order, message)\n\n    def store_client_sources(self, args):\n        self.client_sources = args\n\n    def send_client_source(self):\n        # Send no more source message if there is no source\n        if not self.client_sources:\n            self.send_no_more_source()\n            return\n\n        path = self.client_sources.pop(0)\n        if not path.lower().endswith('.js'):\n            sys.exit(\"Error: Javascript file expected!\")\n            return\n\n        with open(path, 'r', encoding='utf8') as src_file:\n            content = path + \"\\0\" + src_file.read()\n            self._send_string(content, JERRY_DEBUGGER_CLIENT_SOURCE)\n\n    def send_no_more_source(self):\n        self._exec_command(JERRY_DEBUGGER_NO_MORE_SOURCES)\n\n    # pylint: disable=too-many-branches,too-many-locals,too-many-statements,too-many-return-statements\n    def process_messages(self):\n        result = \"\"\n        while True:\n            data = self.channel.get_message(False)\n            if not self.non_interactive:\n                if sys.stdin in select.select([sys.stdin], [], [], 0)[0]:\n                    sys.stdin.readline()\n                    self.stop()\n\n            if data == b'':\n                action_type = DebuggerAction.PROMPT if self.prompt else DebuggerAction.WAIT\n                return DebuggerAction(action_type, \"\")\n\n            if not data:  # Break the while loop if there is no more data.\n                return DebuggerAction(DebuggerAction.END, \"\")\n\n            buffer_type = data[0]\n            buffer_size = len(data) -1\n\n            logging.debug(\"Main buffer type: %d, message size: %d\", buffer_type, buffer_size)\n\n            if buffer_type in [JERRY_DEBUGGER_PARSE_ERROR,\n                               JERRY_DEBUGGER_BYTE_CODE_CP,\n                               JERRY_DEBUGGER_PARSE_FUNCTION,\n                               JERRY_DEBUGGER_BREAKPOINT_LIST,\n                               JERRY_DEBUGGER_SOURCE_CODE,\n                               JERRY_DEBUGGER_SOURCE_CODE_END,\n                               JERRY_DEBUGGER_SOURCE_CODE_NAME,\n                               JERRY_DEBUGGER_SOURCE_CODE_NAME_END,\n                               JERRY_DEBUGGER_FUNCTION_NAME,\n                               JERRY_DEBUGGER_FUNCTION_NAME_END]:\n                result = self._parse_source(data)\n                if result:\n                    return DebuggerAction(DebuggerAction.TEXT, result)\n\n            elif buffer_type == JERRY_DEBUGGER_WAITING_AFTER_PARSE:\n                self._exec_command(JERRY_DEBUGGER_PARSER_RESUME)\n\n            elif buffer_type == JERRY_DEBUGGER_RELEASE_BYTE_CODE_CP:\n                self._release_function(data)\n\n            elif buffer_type in [JERRY_DEBUGGER_BREAKPOINT_HIT, JERRY_DEBUGGER_EXCEPTION_HIT]:\n                breakpoint_data = struct.unpack(self.byte_order + self.cp_format + self.idx_format, data[1:])\n\n                breakpt = self._get_breakpoint(breakpoint_data)\n                self.last_breakpoint_hit = breakpt[0]\n\n                if buffer_type == JERRY_DEBUGGER_EXCEPTION_HIT:\n                    result += \"Exception throw detected (to disable automatic stop type exception 0)\\n\"\n                    if self.exception_string:\n                        result += f\"Exception hint: {self.exception_string}\\n\"\n                        self.exception_string = \"\"\n\n                if breakpt[1]:\n                    breakpoint_info = \"at\"\n                else:\n                    breakpoint_info = \"around\"\n\n                if breakpt[0].active_index >= 0:\n                    breakpoint_info += f\" breakpoint:{self.red}{breakpt[0].active_index}{self.nocolor}\"\n\n                result += f\"Stopped {breakpoint_info} {breakpt[0]}\\n\"\n\n                if self.display > 0:\n                    result += self.print_source(self.display, self.src_offset)\n\n                self.prompt = True\n                return DebuggerAction(DebuggerAction.TEXT, result)\n\n            elif buffer_type in [JERRY_DEBUGGER_EXCEPTION_STR, JERRY_DEBUGGER_EXCEPTION_STR_END]:\n                self.exception_string += data[1:].decode('utf8')\n\n            elif buffer_type == JERRY_DEBUGGER_BACKTRACE_TOTAL:\n                total = struct.unpack(self.byte_order + self.idx_format, data[1:])[0]\n                result += f\"Total number of frames: {total}\\n\"\n                return DebuggerAction(DebuggerAction.TEXT, result)\n\n            elif buffer_type in [JERRY_DEBUGGER_BACKTRACE, JERRY_DEBUGGER_BACKTRACE_END]:\n                frame_index = self.frame_index\n\n                buffer_pos = 1\n                while buffer_size > 0:\n                    breakpoint_data = struct.unpack(self.byte_order + self.cp_format + self.idx_format,\n                                                    data[buffer_pos: buffer_pos + self.cp_size + 4])\n\n                    breakpt = self._get_breakpoint(breakpoint_data)\n\n                    result += f\"Frame {frame_index}: {breakpt[0]}\\n\"\n\n                    frame_index += 1\n                    buffer_pos += self.cp_size + 4\n                    buffer_size -= self.cp_size + 4\n\n                if buffer_type == JERRY_DEBUGGER_BACKTRACE_END:\n                    self.prompt = True\n                else:\n                    self.frame_index = frame_index\n\n                return DebuggerAction(DebuggerAction.TEXT, result)\n\n            elif buffer_type in [JERRY_DEBUGGER_EVAL_RESULT,\n                                 JERRY_DEBUGGER_EVAL_RESULT_END,\n                                 JERRY_DEBUGGER_OUTPUT_RESULT,\n                                 JERRY_DEBUGGER_OUTPUT_RESULT_END]:\n\n                result = self._process_incoming_text(buffer_type, data)\n                return DebuggerAction(DebuggerAction.TEXT, result)\n\n            elif buffer_type == JERRY_DEBUGGER_MEMSTATS_RECEIVE:\n\n                memory_stats = struct.unpack(self.byte_order + self.idx_format * 5,\n                                             data[1: 1 + 4 * 5])\n\n                result += f\"Allocated bytes: {memory_stats[0]}\\n\"\n                result += f\"Byte code bytes: {memory_stats[1]}\\n\"\n                result += f\"String bytes: {memory_stats[2]}\\n\"\n                result += f\"Object bytes: {memory_stats[3]}\\n\"\n                result += f\"Property bytes: {memory_stats[4]}\\n\"\n\n                self.prompt = True\n                return DebuggerAction(DebuggerAction.TEXT, result)\n\n            elif buffer_type == JERRY_DEBUGGER_WAIT_FOR_SOURCE:\n                self.send_client_source()\n\n            elif buffer_type in [JERRY_DEBUGGER_SCOPE_CHAIN, JERRY_DEBUGGER_SCOPE_CHAIN_END]:\n                self.scope_data = data[1:]\n\n                if buffer_type == JERRY_DEBUGGER_SCOPE_CHAIN_END:\n                    result = self._process_scope()\n                    self.scope_data = \"\"\n\n                    self.prompt = True\n\n                return DebuggerAction(DebuggerAction.TEXT, result)\n\n            elif buffer_type in [JERRY_DEBUGGER_SCOPE_VARIABLES, JERRY_DEBUGGER_SCOPE_VARIABLES_END]:\n                self.scope_vars += data[1:].decode('utf8')\n\n                if buffer_type == JERRY_DEBUGGER_SCOPE_VARIABLES_END:\n                    result = self._process_scope_variables()\n                    self.scope_vars = \"\"\n\n                    self.prompt = True\n\n                return DebuggerAction(DebuggerAction.TEXT, result)\n\n            elif JERRY_DEBUGGER_CLOSE_CONNECTION:\n                return DebuggerAction(DebuggerAction.END, \"\")\n\n            else:\n                raise Exception(\"Unknown message\")\n\n    def print_source(self, line_num, offset):\n        msg = \"\"\n        last_bp = self.last_breakpoint_hit\n\n        if not last_bp:\n            return \"\"\n\n        lines = last_bp.function.source\n        if last_bp.function.source_name:\n            msg += f\"Source: {last_bp.function.source_name}\\n\"\n\n        if line_num == 0:\n            start = 0\n            end = len(last_bp.function.source)\n        else:\n            start = max(last_bp.line - line_num, 0)\n            end = min(last_bp.line + line_num - 1, len(last_bp.function.source))\n            if offset:\n                if start + offset < 0:\n                    self.src_offset += self.src_offset_diff\n                    offset += self.src_offset_diff\n                elif end + offset > len(last_bp.function.source):\n                    self.src_offset -= self.src_offset_diff\n                    offset -= self.src_offset_diff\n\n                start = max(start + offset, 0)\n                end = min(end + offset, len(last_bp.function.source))\n\n        for i in range(start, end):\n            if i == last_bp.line - 1:\n                msg += f\"{self.green}{i + 1:>4}{self.nocolor} {self.red}>{self.nocolor} {lines[i]}\\n\"\n            else:\n                msg += f\"{self.green}{i + 1:>4}{self.nocolor}   {lines[i]}\\n\"\n\n        return msg\n\n\n    # pylint: disable=too-many-branches,too-many-locals,too-many-statements\n    def _parse_source(self, data):\n        source_code = b\"\"\n        source_code_name = b\"\"\n        function_name = b\"\"\n        stack = [{\"line\": 1,\n                  \"column\": 1,\n                  \"name\": \"\",\n                  \"lines\": [],\n                  \"offsets\": []}]\n        new_function_list = {}\n        result = \"\"\n\n        while True:\n            if data is None:\n                return \"Error: connection lost during source code receiving\"\n\n            buffer_type = data[0]\n            buffer_size = len(data) - 1\n\n            logging.debug(\"Parser buffer type: %d, message size: %d\", buffer_type, buffer_size)\n\n            if buffer_type == JERRY_DEBUGGER_PARSE_ERROR:\n                logging.error(\"Syntax error found\")\n                return \"\"\n\n            if buffer_type in [JERRY_DEBUGGER_SOURCE_CODE, JERRY_DEBUGGER_SOURCE_CODE_END]:\n                source_code += data[1:]\n\n            elif buffer_type in [JERRY_DEBUGGER_SOURCE_CODE_NAME, JERRY_DEBUGGER_SOURCE_CODE_NAME_END]:\n                source_code_name += data[1:]\n\n            elif buffer_type in [JERRY_DEBUGGER_FUNCTION_NAME, JERRY_DEBUGGER_FUNCTION_NAME_END]:\n                function_name += data[1:]\n\n            elif buffer_type == JERRY_DEBUGGER_PARSE_FUNCTION:\n                logging.debug(\"Source name: %s, function name: %s\", source_code_name.decode('utf8'),\n                              function_name.decode('utf8'))\n\n                position = struct.unpack(self.byte_order + self.idx_format + self.idx_format,\n                                         data[1: 1 + 4 + 4])\n\n                stack.append({\"source\": source_code.decode('utf8'),\n                              \"source_name\": source_code_name.decode('utf8'),\n                              \"line\": position[0],\n                              \"column\": position[1],\n                              \"name\": function_name.decode('utf8'),\n                              \"lines\": [],\n                              \"offsets\": []})\n                function_name = b\"\"\n\n            elif buffer_type in [JERRY_DEBUGGER_BREAKPOINT_LIST, JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST]:\n                name = \"lines\"\n                if buffer_type == JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST:\n                    name = \"offsets\"\n\n                logging.debug(\"Breakpoint %s received\", name)\n\n                buffer_pos = 1\n                while buffer_size > 0:\n                    line = struct.unpack(self.byte_order + self.idx_format,\n                                         data[buffer_pos: buffer_pos + 4])\n                    stack[-1][name].append(line[0])\n                    buffer_pos += 4\n                    buffer_size -= 4\n\n            elif buffer_type == JERRY_DEBUGGER_BYTE_CODE_CP:\n                byte_code_cp = struct.unpack(self.byte_order + self.cp_format,\n                                             data[1: 1 + self.cp_size])[0]\n\n                logging.debug(\"Byte code cptr received: {0x%x}\", byte_code_cp)\n\n                func_desc = stack.pop()\n\n                # We know the last item in the list is the general byte code.\n                if not stack:\n                    func_desc[\"source\"] = source_code.decode('utf8')\n                    func_desc[\"source_name\"] = source_code_name.decode('utf8')\n\n                function = JerryFunction(stack,\n                                         byte_code_cp,\n                                         func_desc[\"source\"],\n                                         func_desc[\"source_name\"],\n                                         func_desc[\"line\"],\n                                         func_desc[\"column\"],\n                                         func_desc[\"name\"],\n                                         func_desc[\"lines\"],\n                                         func_desc[\"offsets\"])\n\n                new_function_list[byte_code_cp] = function\n\n                if not stack:\n                    logging.debug(\"Parse completed.\")\n                    break\n\n            elif buffer_type == JERRY_DEBUGGER_RELEASE_BYTE_CODE_CP:\n                # Redefined functions are dropped during parsing.\n                byte_code_cp = struct.unpack(self.byte_order + self.cp_format,\n                                             data[1: 1 + self.cp_size])[0]\n\n                if byte_code_cp in new_function_list:\n                    del new_function_list[byte_code_cp]\n                    self._send_bytecode_cp(byte_code_cp)\n                else:\n                    self._release_function(data)\n\n            elif buffer_type in [JERRY_DEBUGGER_OUTPUT_RESULT,\n                                 JERRY_DEBUGGER_OUTPUT_RESULT_END]:\n                result += self._process_incoming_text(buffer_type, data)\n\n            else:\n                logging.error(\"Parser error!\")\n                raise Exception(\"Unexpected message\")\n\n            data = self.channel.get_message(True)\n\n        # Copy the ready list to the global storage.\n        self.function_list.update(new_function_list)\n\n        for function in new_function_list.values():\n            for line, breakpt in function.lines.items():\n                self.line_list.insert(line, breakpt)\n\n        # Try to set the pending breakpoints\n        if self.pending_breakpoint_list:\n            logging.debug(\"Pending breakpoints available\")\n            bp_list = self.pending_breakpoint_list\n\n            for breakpoint_index, breakpt in list(bp_list.items()):\n                source_lines = 0\n                for src in new_function_list.values():\n                    if (src.source_name == breakpt.source_name or\n                            src.source_name.endswith(\"/\" + breakpt.source_name) or\n                            src.source_name.endswith(\"\\\\\" + breakpt.source_name)):\n                        source_lines = len(src.source)\n                        break\n\n                if breakpt.line:\n                    if breakpt.line <= source_lines:\n                        command = breakpt.source_name + \":\" + str(breakpt.line)\n                        set_result = self._set_breakpoint(command, True)\n\n                        if set_result:\n                            result += set_result\n                            del bp_list[breakpoint_index]\n                elif breakpt.function:\n                    command = breakpt.function\n                    set_result = self._set_breakpoint(command, True)\n\n                    if set_result:\n                        result += set_result\n                        del bp_list[breakpoint_index]\n\n            if not bp_list:\n                self._send_parser_config(0)\n            return result\n\n        logging.debug(\"No pending breakpoints\")\n        return result\n\n\n    def _release_function(self, data):\n        byte_code_cp = struct.unpack(self.byte_order + self.cp_format,\n                                     data[1: 1 + self.cp_size])[0]\n\n        function = self.function_list[byte_code_cp]\n\n        for line, breakpt in function.lines.items():\n            self.line_list.delete(line, breakpt)\n            if breakpt.active_index >= 0:\n                del self.active_breakpoint_list[breakpt.active_index]\n\n        del self.function_list[byte_code_cp]\n        self._send_bytecode_cp(byte_code_cp)\n        logging.debug(\"Function {0x%x} byte-code released\", byte_code_cp)\n\n\n    def _enable_breakpoint(self, breakpt):\n        if isinstance(breakpt, JerryPendingBreakpoint):\n            if self._breakpoint_pending_exists(breakpt):\n                return f\"{self.yellow}Pending breakpoint{self.nocolor} already exists\\n\"\n\n            self.next_breakpoint_index += 1\n            breakpt.index = self.next_breakpoint_index\n            self.pending_breakpoint_list[self.next_breakpoint_index] = breakpt\n            return f\"{self.yellow}Pending breakpoint {breakpt.index}{self.nocolor} at {breakpt}\\n\"\n\n        if breakpt.active_index < 0:\n            self.next_breakpoint_index += 1\n            self.active_breakpoint_list[self.next_breakpoint_index] = breakpt\n            breakpt.active_index = self.next_breakpoint_index\n            self._send_breakpoint(breakpt)\n\n        return f\"{self.green}Breakpoint {breakpt.active_index}{self.nocolor} at {breakpt}\\n\"\n\n\n    def _set_breakpoint(self, string, pending):\n        line = re.match(\"(.*):(\\\\d+)$\", string)\n        result = \"\"\n\n        if line:\n            source_name = line.group(1)\n            new_line = int(line.group(2))\n\n            for breakpt in self.line_list.get(new_line):\n                func_source = breakpt.function.source_name\n                if (source_name == func_source or\n                        func_source.endswith(\"/\" + source_name) or\n                        func_source.endswith(\"\\\\\" + source_name)):\n\n                    result += self._enable_breakpoint(breakpt)\n\n        else:\n            functions_to_enable = []\n            for function in self.function_list.values():\n                if function.name == string:\n                    functions_to_enable.append(function)\n\n            functions_to_enable.sort(key=lambda x: x.line)\n\n            for function in functions_to_enable:\n                result += self._enable_breakpoint(function.lines[function.first_breakpoint_line])\n\n        if not result and not pending:\n            print(f\"No breakpoint found, do you want to add a \"\n                  f\"{self.yellow}pending breakpoint{self.nocolor}? (y or [n]) \", end='')\n\n            ans = sys.stdin.readline()\n            if ans in ['yes\\n', 'y\\n']:\n                if not self.pending_breakpoint_list:\n                    self._send_parser_config(1)\n\n                if line:\n                    breakpt = JerryPendingBreakpoint(int(line.group(2)), line.group(1))\n                else:\n                    breakpt = JerryPendingBreakpoint(function=string)\n                result += self._enable_breakpoint(breakpt)\n\n        return result\n\n\n    def _get_breakpoint(self, breakpoint_data):\n        function = self.function_list[breakpoint_data[0]]\n        offset = breakpoint_data[1]\n\n        if offset in function.offsets:\n            return (function.offsets[offset], True)\n\n        if offset < function.first_breakpoint_offset:\n            return (function.offsets[function.first_breakpoint_offset], False)\n\n        nearest_offset = -1\n\n        for current_offset in function.offsets:\n            if offset >= current_offset > nearest_offset:\n                nearest_offset = current_offset\n\n        return (function.offsets[nearest_offset], False)\n\n    def _process_incoming_text(self, buffer_type, data):\n        message = \"\"\n        msg_type = buffer_type\n        while True:\n            if buffer_type in [JERRY_DEBUGGER_EVAL_RESULT_END,\n                               JERRY_DEBUGGER_OUTPUT_RESULT_END]:\n                subtype = data[-1]\n                message += data[1:-1].decode('utf8')\n                break\n            message += data[1:].decode('utf8')\n\n            data = self.channel.get_message(True)\n            buffer_type = data[0]\n            # Checks if the next frame would be an invalid data frame.\n            # If it is not the message type, or the end type of it, an exception is thrown.\n            if buffer_type not in [msg_type, msg_type + 1]:\n                raise Exception(\"Invalid data caught\")\n\n        # Subtypes of output\n        if buffer_type == JERRY_DEBUGGER_OUTPUT_RESULT_END:\n            if subtype == JERRY_DEBUGGER_OUTPUT_PRINT:\n\n                message = self.current_out + message\n                lines = message.split(\"\\n\")\n                self.current_out = lines.pop()\n\n                return \"\".join([f\"{line}\\n\" for line in lines])\n\n            if subtype == JERRY_DEBUGGER_OUTPUT_LOG:\n                message = self.current_log + message\n                lines = message.split(\"\\n\")\n                self.current_log = lines.pop()\n\n                return \"\".join([f\"{line}\\n\" for line in lines])\n\n        # Subtypes of eval\n        self.prompt = True\n\n        if not message.endswith(\"\\n\"):\n            message += \"\\n\"\n\n        if subtype == JERRY_DEBUGGER_EVAL_ERROR:\n            return f\"Uncaught exception: {message}\"\n        return message\n\n    def _process_scope_variables(self):\n        buff_size = len(self.scope_vars)\n        buff_pos = 0\n\n        table = [['name', 'type', 'value']]\n\n        while buff_pos != buff_size:\n            # Process name\n            name_length = ord(self.scope_vars[buff_pos])\n            buff_pos += 1\n            name = self.scope_vars[buff_pos:buff_pos + name_length]\n            buff_pos += name_length\n\n            # Process type\n            value_type = ord(self.scope_vars[buff_pos])\n\n            buff_pos += 1\n\n            value_length = ord(self.scope_vars[buff_pos])\n            buff_pos += 1\n            value = self.scope_vars[buff_pos: buff_pos + value_length]\n            buff_pos += value_length\n\n            if value_type == JERRY_DEBUGGER_VALUE_UNDEFINED:\n                table.append([name, 'undefined', value])\n            elif value_type == JERRY_DEBUGGER_VALUE_NULL:\n                table.append([name, 'Null', value])\n            elif value_type == JERRY_DEBUGGER_VALUE_BOOLEAN:\n                table.append([name, 'Boolean', value])\n            elif value_type == JERRY_DEBUGGER_VALUE_NUMBER:\n                table.append([name, 'Number', value])\n            elif value_type == JERRY_DEBUGGER_VALUE_STRING:\n                table.append([name, 'String', value])\n            elif value_type == JERRY_DEBUGGER_VALUE_FUNCTION:\n                table.append([name, 'Function', value])\n            elif value_type == JERRY_DEBUGGER_VALUE_ARRAY:\n                table.append([name, 'Array', '[' + value + ']'])\n            elif value_type == JERRY_DEBUGGER_VALUE_OBJECT:\n                table.append([name, 'Object', value])\n\n        result = self._form_table(table)\n\n        return result\n\n    def _process_scope(self):\n        result = \"\"\n        table = [['level', 'type']]\n\n        for i, level in enumerate(self.scope_data):\n            if level == JERRY_DEBUGGER_SCOPE_WITH:\n                table.append([str(i), 'with'])\n            elif level == JERRY_DEBUGGER_SCOPE_GLOBAL:\n                table.append([str(i), 'global'])\n            elif level == JERRY_DEBUGGER_SCOPE_NON_CLOSURE:\n                # Currently it is only marks the catch closure.\n                table.append([str(i), 'catch'])\n            elif level == JERRY_DEBUGGER_SCOPE_LOCAL:\n                table.append([str(i), 'local'])\n            elif level == JERRY_DEBUGGER_SCOPE_CLOSURE:\n                table.append([str(i), 'closure'])\n            else:\n                raise Exception(\"Unexpected scope chain element\")\n\n        result = self._form_table(table)\n\n        return result\n\n    def _form_table(self, table):\n        result = \"\"\n        col_width = [max(len(x) for x in col) for col in zip(*table)]\n        for line in table:\n            result += \" | \".join(f\"{x:<{col_width[i]}}\" for i, x in enumerate(line)) + \" \\n\"\n\n        return result\n"
  },
  {
    "path": "jerry-debugger/jerry_client_rawpacket.py",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport struct\n\nMAX_BUFFER_SIZE = 256\n\nclass RawPacket:\n    \"\"\" Simplified transmission layer. \"\"\"\n    def __init__(self, protocol):\n        self.protocol = protocol\n        self.data_buffer = b\"\"\n\n    def connect(self, config_size):\n        \"\"\"  Create connection. \"\"\"\n        self.protocol.connect()\n        self.data_buffer = b\"\"\n\n        # It will return with the Network configurations, which has the following struct:\n        # header [1] - size[1]\n        # configuration [config_size]\n        len_expected = config_size + 1\n\n        while len(self.data_buffer) < len_expected:\n            self.data_buffer += self.protocol.receive_data()\n\n        expected = struct.pack(\"B\", config_size)\n\n        if self.data_buffer[0:1] != expected:\n            raise Exception(\"Unexpected configuration\")\n\n        result = self.data_buffer[1:len_expected]\n        self.data_buffer = self.data_buffer[len_expected:]\n\n        return result\n\n    def close(self):\n        \"\"\" Close connection. \"\"\"\n        self.protocol.close()\n\n    def send_message(self, _, data):\n        \"\"\" Send message. \"\"\"\n        msg_size = len(data)\n\n        while msg_size > 0:\n            bytes_send = self.protocol.send_data(data)\n            if bytes_send < msg_size:\n                data = data[bytes_send:]\n            msg_size -= bytes_send\n\n    def get_message(self, blocking):\n        \"\"\" Receive message. \"\"\"\n\n        # Connection was closed\n        if self.data_buffer is None:\n            return None\n\n        while True:\n            if len(self.data_buffer) >= 1:\n                size = self.data_buffer[0]\n                if size == 0:\n                    raise Exception(\"Unexpected data frame\")\n\n                if len(self.data_buffer) >= size + 1:\n                    result = self.data_buffer[1:size + 1]\n                    self.data_buffer = self.data_buffer[size + 1:]\n                    return result\n\n            if not blocking and not self.protocol.ready():\n                return b''\n\n            received_data = self.protocol.receive_data(MAX_BUFFER_SIZE)\n\n            if not received_data:\n                return None\n\n            self.data_buffer += received_data\n"
  },
  {
    "path": "jerry-debugger/jerry_client_serial.py",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport select\nimport serial\n\nclass Serial:\n    \"\"\" Create a new socket using the given address family, socket type and protocol number. \"\"\"\n    def __init__(self, serial_config):\n        config = serial_config.split(',')\n        config_size = len(config)\n\n        port = config[0] if config_size > 0 else \"/dev/ttyUSB0\"\n        baudrate = config[1] if config_size > 1 else 115200\n        bytesize = int(config[2]) if config_size > 2 else 8\n        parity = config[3] if config_size > 3 else 'N'\n        stopbits = int(config[4]) if config_size > 4 else 1\n\n        self.ser = serial.Serial(port=port, baudrate=baudrate, parity=parity,\n                                 stopbits=stopbits, bytesize=bytesize, timeout=1)\n\n    def connect(self):\n        \"\"\" Connect to the server, write a 'c' to the serial port \"\"\"\n        self.send_data('c')\n\n    def close(self):\n        \"\"\"\"  close the serial port. \"\"\"\n        self.ser.close()\n\n    def receive_data(self, max_size=1024):\n        \"\"\" The maximum amount of data to be received at once is specified by max_size. \"\"\"\n        return self.ser.read(max_size)\n\n    def send_data(self, data):\n        \"\"\" Write data to the serial port. \"\"\"\n        return self.ser.write(data)\n\n    def ready(self):\n        \"\"\" Monitor the file descriptor. \"\"\"\n        result = select.select([self.ser.fileno()], [], [], 0)[0]\n\n        return self.ser.fileno() in result\n"
  },
  {
    "path": "jerry-debugger/jerry_client_tcp.py",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport socket\nimport select\n\n# pylint: disable=too-many-arguments,superfluous-parens\nclass Socket:\n    \"\"\" Create a new socket using the given address family, socket type and protocol number. \"\"\"\n    def __init__(self, address, socket_family=socket.AF_INET, socket_type=socket.SOCK_STREAM, proto=0, fileno=None):\n        self.address = address\n        self.socket = socket.socket(socket_family, socket_type, proto, fileno)\n\n    def connect(self):\n        \"\"\"\n        Connect to a remote socket at address (host, port).\n        The format of address depends on the address family.\n        \"\"\"\n        print(f\"Connecting to: {self.address[0]}:{self.address[1]}\")\n        self.socket.connect(self.address)\n\n    def close(self):\n        \"\"\"\" Mark the socket closed. \"\"\"\n        self.socket.close()\n\n    def receive_data(self, max_size=1024):\n        \"\"\" The maximum amount of data to be received at once is specified by max_size. \"\"\"\n        return self.socket.recv(max_size)\n\n    def send_data(self, data):\n        \"\"\" Send data to the socket. The socket must be connected to a remote socket. \"\"\"\n        return self.socket.send(data)\n\n    def ready(self):\n        \"\"\" Monitor the file descriptor. \"\"\"\n        result = select.select([self.socket], [], [], 0)[0]\n\n        return self.socket in result\n"
  },
  {
    "path": "jerry-debugger/jerry_client_websocket.py",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport struct\n\nMAX_BUFFER_SIZE = 128\nWEBSOCKET_BINARY_FRAME = 2\nWEBSOCKET_FIN_BIT = 0x80\n\nclass WebSocket:\n    def __init__(self, protocol):\n\n        self.data_buffer = b\"\"\n        self.protocol = protocol\n\n    def __handshake(self):\n        \"\"\" Client Handshake Request. \"\"\"\n        self.__send_data(b\"GET /jerry-debugger HTTP/1.1\\r\\n\" +\n                         b\"Upgrade: websocket\\r\\n\" +\n                         b\"Connection: Upgrade\\r\\n\" +\n                         b\"Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\\r\\n\\r\\n\")\n\n        # Expected answer from the handshake.\n        expected = (b\"HTTP/1.1 101 Switching Protocols\\r\\n\" +\n                    b\"Upgrade: websocket\\r\\n\" +\n                    b\"Connection: Upgrade\\r\\n\" +\n                    b\"Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\\r\\n\\r\\n\")\n\n        len_expected = len(expected)\n\n        while len(self.data_buffer) < len_expected:\n            self.data_buffer += self.protocol.receive_data()\n\n        if self.data_buffer[0:len_expected] != expected:\n            raise Exception(\"Unexpected handshake\")\n\n        if len(self.data_buffer) > len_expected:\n            self.data_buffer = self.data_buffer[len_expected:]\n        else:\n            self.data_buffer = b\"\"\n\n    def connect(self, config_size):\n        \"\"\"  WebSockets connection. \"\"\"\n        self.protocol.connect()\n        self.data_buffer = b\"\"\n        self.__handshake()\n\n        # It will return with the Network configurations, which has the following struct:\n        # header [2] - opcode[1], size[1]\n        # configuration [config_size]\n        len_expected = config_size + 2\n\n        while len(self.data_buffer) < len_expected:\n            self.data_buffer += self.protocol.receive_data()\n\n        expected = struct.pack(\"BB\",\n                               WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,\n                               config_size)\n\n        if self.data_buffer[0:2] != expected:\n            raise Exception(\"Unexpected configuration\")\n\n        result = self.data_buffer[2:len_expected]\n        self.data_buffer = self.data_buffer[len_expected:]\n\n        return result\n\n    def __send_data(self, data):\n        \"\"\" Private function to send data using the given protocol. \"\"\"\n        size = len(data)\n\n        while size > 0:\n            bytes_send = self.protocol.send_data(data)\n            if bytes_send < size:\n                data = data[bytes_send:]\n            size -= bytes_send\n\n    def send_message(self, byte_order, packed_data):\n        \"\"\" Send message. \"\"\"\n        message = struct.pack(byte_order + \"BBI\",\n                              WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,\n                              WEBSOCKET_FIN_BIT + struct.unpack(byte_order + \"B\", packed_data[0:1])[0],\n                              0) + packed_data[1:]\n\n        self.__send_data(message)\n\n    def close(self):\n        \"\"\" Close the WebSockets connection. \"\"\"\n        self.protocol.close()\n\n    def get_message(self, blocking):\n        \"\"\" Receive message. \"\"\"\n\n        # Connection was closed\n        if self.data_buffer is None:\n            return None\n\n        while True:\n            if len(self.data_buffer) >= 2:\n                if self.data_buffer[0] != WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT:\n                    raise Exception(\"Unexpected data frame\")\n\n                size = self.data_buffer[1]\n                if size == 0 or size >= 126:\n                    raise Exception(\"Unexpected data frame\")\n\n                if len(self.data_buffer) >= size + 2:\n                    result = self.data_buffer[2:size + 2]\n                    self.data_buffer = self.data_buffer[size + 2:]\n                    return result\n\n            if not blocking and not self.protocol.ready():\n                return b''\n\n            data = self.protocol.receive_data(MAX_BUFFER_SIZE)\n\n            if not data:\n                self.data_buffer = None\n                return None\n            self.data_buffer += data\n"
  },
  {
    "path": "jerry-ext/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required (VERSION 3.10)\nset(JERRY_EXT_NAME jerry-ext)\nproject (${JERRY_EXT_NAME} C)\n\n# Optional features\nset(FEATURE_INIT_FINI OFF CACHE BOOL \"Enable library constructor/destructor support?\")\n\n# Status messages\nmessage(STATUS \"FEATURE_INIT_FINI              \" ${FEATURE_INIT_FINI})\n\n# Include directories\nset(INCLUDE_EXT_PUBLIC \"${CMAKE_CURRENT_SOURCE_DIR}/include\")\nset(INCLUDE_EXT_PRIVATE \"${CMAKE_CURRENT_SOURCE_DIR}/common\")\n\nset(INCLUDE_EXT_PUBLIC ${INCLUDE_EXT_PUBLIC} PARENT_SCOPE) # for jerry-port\n\nif(FEATURE_INIT_FINI)\n  set(DEFINES_EXT ${DEFINES_EXT} ENABLE_INIT_FINI)\nendif()\n\n# Source directories\nset(SOURCE_EXT\n  arg/arg-js-iterator-helper.c\n  arg/arg-transform-functions.c\n  arg/arg.c\n  debugger/debugger-common.c\n  debugger/debugger-rp.c\n  debugger/debugger-serial.c\n  debugger/debugger-sha1.c\n  debugger/debugger-tcp.c\n  debugger/debugger-ws.c\n  handle-scope/handle-scope-allocator.c\n  handle-scope/handle-scope.c\n  module/module.c\n  util/handlers.c\n  util/print.c\n  util/properties.c\n  util/repl.c\n  util/sources.c\n  util/test262.c\n)\n\nadd_library(${JERRY_EXT_NAME} ${SOURCE_EXT})\n\ntarget_include_directories(${JERRY_EXT_NAME} PUBLIC ${INCLUDE_EXT_PUBLIC})\ntarget_include_directories(${JERRY_EXT_NAME} PRIVATE ${INCLUDE_EXT_PRIVATE})\ntarget_compile_definitions(${JERRY_EXT_NAME} PUBLIC ${DEFINES_EXT})\ntarget_link_libraries(${JERRY_EXT_NAME} jerry-core)\n\nset(JERRY_EXT_PKGCONFIG_LIBS)\n\nif(\"${PLATFORM}\" STREQUAL \"WINDOWS\" AND JERRY_DEBUGGER)\n  target_link_libraries(${JERRY_EXT_NAME} ws2_32)\n  set(JERRY_EXT_PKGCONFIG_LIBS -lws2_32)\nendif()\n\nconfigure_file(libjerry-ext.pc.in libjerry-ext.pc @ONLY)\n\ninstall(TARGETS ${JERRY_EXT_NAME} DESTINATION lib)\ninstall(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjerry-ext.pc DESTINATION lib/pkgconfig)\ninstall(DIRECTORY ${INCLUDE_EXT_PUBLIC}/ DESTINATION include)\n"
  },
  {
    "path": "jerry-ext/arg/arg-internal.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_ARG_INTERNAL_H\n#define JERRYX_ARG_INTERNAL_H\n\n#include \"jerryscript.h\"\n\n/**\n * The iterator structor for JS arguments.\n */\nstruct jerryx_arg_js_iterator_t\n{\n  const jerry_value_t *js_arg_p; /**< the JS arguments */\n  const jerry_length_t js_arg_cnt; /**< the total num of JS arguments */\n  jerry_length_t js_arg_idx; /**< current index of JS argument */\n};\n\n#endif /* !JERRYX_ARG_INTERNAL_H */\n"
  },
  {
    "path": "jerry-ext/arg/arg-js-iterator-helper.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"arg-internal.h\"\n#include \"jerryscript-ext/arg.h\"\n\n/**\n * Pop the current JS argument from the iterator.\n * It will change the index and js_arg_p value in the iterator.\n *\n * @return the current JS argument.\n */\njerry_value_t\njerryx_arg_js_iterator_pop (jerryx_arg_js_iterator_t *js_arg_iter_p) /**< the JS arg iterator */\n{\n  return (js_arg_iter_p->js_arg_idx++ < js_arg_iter_p->js_arg_cnt ? *js_arg_iter_p->js_arg_p++ : jerry_undefined ());\n} /* jerryx_arg_js_iterator_pop */\n\n/**\n * Restore the previous JS argument from the iterator.\n * It will change the index and js_arg_p value in the iterator.\n *\n * @return the restored (now current) JS argument.\n */\njerry_value_t\njerryx_arg_js_iterator_restore (jerryx_arg_js_iterator_t *js_arg_iter_p) /**< the JS arg iterator */\n{\n  if (js_arg_iter_p->js_arg_idx == 0)\n  {\n    return jerry_undefined ();\n  }\n\n  --js_arg_iter_p->js_arg_idx;\n  --js_arg_iter_p->js_arg_p;\n\n  return *js_arg_iter_p->js_arg_p;\n} /* jerryx_arg_js_iterator_restore */\n\n/**\n * Get the current JS argument from the iterator.\n *\n * Note:\n *     Unlike jerryx_arg_js_iterator_pop, it will not change index and\n *     js_arg_p value in the iterator.\n *\n * @return the current JS argument.\n */\njerry_value_t\njerryx_arg_js_iterator_peek (jerryx_arg_js_iterator_t *js_arg_iter_p) /**< the JS arg iterator */\n{\n  return (js_arg_iter_p->js_arg_idx < js_arg_iter_p->js_arg_cnt ? *js_arg_iter_p->js_arg_p : jerry_undefined ());\n} /* jerryx_arg_js_iterator_peek */\n\n/**\n * Get the index of the current JS argument\n *\n * @return the index\n */\njerry_length_t\njerryx_arg_js_iterator_index (jerryx_arg_js_iterator_t *js_arg_iter_p) /**< the JS arg iterator */\n{\n  return js_arg_iter_p->js_arg_idx;\n} /* jerryx_arg_js_iterator_index */\n"
  },
  {
    "path": "jerry-ext/arg/arg-transform-functions.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <math.h>\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/arg.h\"\n\n/**\n * The common function to deal with optional arguments.\n * The core transform function is provided by argument `func`.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_optional (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                               const jerryx_arg_t *c_arg_p, /**< native arg */\n                               jerryx_arg_transform_func_t func) /**< the core transform function */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_peek (js_arg_iter_p);\n\n  if (jerry_value_is_undefined (js_arg))\n  {\n    return jerryx_arg_js_iterator_pop (js_arg_iter_p);\n  }\n\n  return func (js_arg_iter_p, c_arg_p);\n} /* jerryx_arg_transform_optional */\n\n/**\n * The common part in transforming a JS argument to a number (double or certain int) type.\n * Type coercion is not allowed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\nstatic jerry_value_t\njerryx_arg_transform_number_strict_common (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                           double *number_p) /**< [out] the number in JS arg */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_pop (js_arg_iter_p);\n\n  if (!jerry_value_is_number (js_arg))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"It is not a number.\");\n  }\n\n  *number_p = jerry_value_as_number (js_arg);\n\n  return jerry_undefined ();\n} /* jerryx_arg_transform_number_strict_common */\n\n/**\n * The common part in transforming a JS argument to a number (double or certain int) type.\n * Type coercion is allowed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\nstatic jerry_value_t\njerryx_arg_transform_number_common (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                    double *number_p) /**< [out] the number in JS arg */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_pop (js_arg_iter_p);\n\n  jerry_value_t to_number = jerry_value_to_number (js_arg);\n\n  if (jerry_value_is_exception (to_number))\n  {\n    jerry_value_free (to_number);\n\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"It can not be converted to a number.\");\n  }\n\n  *number_p = jerry_value_as_number (to_number);\n  jerry_value_free (to_number);\n\n  return jerry_undefined ();\n} /* jerryx_arg_transform_number_common */\n\n/**\n * Transform a JS argument to a double. Type coercion is not allowed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_number_strict (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                    const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  return jerryx_arg_transform_number_strict_common (js_arg_iter_p, c_arg_p->dest);\n} /* jerryx_arg_transform_number_strict */\n\n/**\n * Transform a JS argument to a double. Type coercion is allowed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_number (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                             const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  return jerryx_arg_transform_number_common (js_arg_iter_p, c_arg_p->dest);\n} /* jerryx_arg_transform_number */\n\n/**\n * Helper function to process a double number before converting it\n * to an integer.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\nstatic jerry_value_t\njerryx_arg_helper_process_double (double *d, /**< [in, out] the number to be processed */\n                                  double min, /**< the min value for clamping */\n                                  double max, /**< the max value for clamping */\n                                  jerryx_arg_int_option_t option) /**< the converting policies */\n{\n  if (*d != *d) /* isnan (*d) triggers conversion warning on clang<9 */\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"The number is NaN.\");\n  }\n\n  if (option.clamp == JERRYX_ARG_NO_CLAMP)\n  {\n    if (*d > max || *d < min)\n    {\n      return jerry_throw_sz (JERRY_ERROR_TYPE, \"The number is out of range.\");\n    }\n  }\n  else\n  {\n    *d = *d < min ? min : *d;\n    *d = *d > max ? max : *d;\n  }\n\n  if (option.round == JERRYX_ARG_ROUND)\n  {\n    *d = (*d >= 0.0) ? floor (*d + 0.5) : ceil (*d - 0.5);\n  }\n  else if (option.round == JERRYX_ARG_FLOOR)\n  {\n    *d = floor (*d);\n  }\n  else\n  {\n    *d = ceil (*d);\n  }\n\n  return jerry_undefined ();\n} /* jerryx_arg_helper_process_double */\n\n/**\n * Use the macro to define thr transform functions for int type.\n */\n#define JERRYX_ARG_TRANSFORM_FUNC_FOR_INT_TEMPLATE(type, suffix, min, max)                    \\\n  jerry_value_t jerryx_arg_transform_##type##suffix (jerryx_arg_js_iterator_t *js_arg_iter_p, \\\n                                                     const jerryx_arg_t *c_arg_p)             \\\n  {                                                                                           \\\n    double tmp = 0.0;                                                                         \\\n    jerry_value_t rv = jerryx_arg_transform_number##suffix##_common (js_arg_iter_p, &tmp);    \\\n    if (jerry_value_is_exception (rv))                                                        \\\n    {                                                                                         \\\n      return rv;                                                                              \\\n    }                                                                                         \\\n    jerry_value_free (rv);                                                                    \\\n    union                                                                                     \\\n    {                                                                                         \\\n      jerryx_arg_int_option_t int_option;                                                     \\\n      uintptr_t extra_info;                                                                   \\\n    } u = { .extra_info = c_arg_p->extra_info };                                              \\\n    rv = jerryx_arg_helper_process_double (&tmp, min, max, u.int_option);                     \\\n    if (jerry_value_is_exception (rv))                                                        \\\n    {                                                                                         \\\n      return rv;                                                                              \\\n    }                                                                                         \\\n    *(type##_t *) c_arg_p->dest = (type##_t) tmp;                                             \\\n    return rv;                                                                                \\\n  }\n\n#define JERRYX_ARG_TRANSFORM_FUNC_FOR_INT(type, min, max)              \\\n  JERRYX_ARG_TRANSFORM_FUNC_FOR_INT_TEMPLATE (type, _strict, min, max) \\\n  JERRYX_ARG_TRANSFORM_FUNC_FOR_INT_TEMPLATE (type, , min, max)\n\nJERRYX_ARG_TRANSFORM_FUNC_FOR_INT (uint8, 0, UINT8_MAX)\nJERRYX_ARG_TRANSFORM_FUNC_FOR_INT (int8, INT8_MIN, INT8_MAX)\nJERRYX_ARG_TRANSFORM_FUNC_FOR_INT (uint16, 0, UINT16_MAX)\nJERRYX_ARG_TRANSFORM_FUNC_FOR_INT (int16, INT16_MIN, INT16_MAX)\nJERRYX_ARG_TRANSFORM_FUNC_FOR_INT (uint32, 0, UINT32_MAX)\nJERRYX_ARG_TRANSFORM_FUNC_FOR_INT (int32, INT32_MIN, INT32_MAX)\n\n#undef JERRYX_ARG_TRANSFORM_FUNC_FOR_INT_TEMPLATE\n#undef JERRYX_ARG_TRANSFORM_FUNC_FOR_INT\n/**\n * Transform a JS argument to a boolean. Type coercion is not allowed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_boolean_strict (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                     const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_pop (js_arg_iter_p);\n\n  if (!jerry_value_is_boolean (js_arg))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"It is not a boolean.\");\n  }\n\n  bool *dest = c_arg_p->dest;\n  *dest = jerry_value_is_true (js_arg);\n\n  return jerry_undefined ();\n} /* jerryx_arg_transform_boolean_strict */\n\n/**\n * Transform a JS argument to a boolean. Type coercion is allowed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_boolean (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                              const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_pop (js_arg_iter_p);\n\n  bool to_boolean = jerry_value_to_boolean (js_arg);\n\n  bool *dest = c_arg_p->dest;\n  *dest = to_boolean;\n\n  return jerry_undefined ();\n} /* jerryx_arg_transform_boolean */\n\n/**\n * The common routine for string transformer.\n * It works for both CESU-8 and UTF-8 string.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\nstatic jerry_value_t\njerryx_arg_string_to_buffer_common_routine (jerry_value_t js_arg, /**< JS arg */\n                                            const jerryx_arg_t *c_arg_p, /**< native arg */\n                                            jerry_encoding_t encoding) /**< string encoding */\n{\n  jerry_char_t *target_p = (jerry_char_t *) c_arg_p->dest;\n  jerry_size_t target_buf_size = (jerry_size_t) c_arg_p->extra_info;\n\n  jerry_size_t size = jerry_string_size (js_arg, encoding);\n\n  if (size > target_buf_size - 1)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"Buffer size is not large enough.\");\n  }\n\n  jerry_string_to_buffer (js_arg, encoding, target_p, target_buf_size);\n  target_p[size] = '\\0';\n\n  return jerry_undefined ();\n} /* jerryx_arg_string_to_buffer_common_routine */\n\n/**\n * Transform a JS argument to a UTF-8/CESU-8 char array. Type coercion is not allowed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\nstatic jerry_value_t\njerryx_arg_transform_string_strict_common (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                           const jerryx_arg_t *c_arg_p, /**< the native arg */\n                                           jerry_encoding_t encoding) /**< string encoding */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_pop (js_arg_iter_p);\n\n  if (!jerry_value_is_string (js_arg))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"It is not a string.\");\n  }\n\n  return jerryx_arg_string_to_buffer_common_routine (js_arg, c_arg_p, encoding);\n} /* jerryx_arg_transform_string_strict_common */\n\n/**\n * Transform a JS argument to a UTF-8/CESU-8 char array. Type coercion is allowed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\nstatic jerry_value_t\njerryx_arg_transform_string_common (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                    const jerryx_arg_t *c_arg_p, /**< the native arg */\n                                    jerry_encoding_t encoding) /**< string encoding */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_pop (js_arg_iter_p);\n\n  jerry_value_t to_string = jerry_value_to_string (js_arg);\n\n  if (jerry_value_is_exception (to_string))\n  {\n    jerry_value_free (to_string);\n\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"It can not be converted to a string.\");\n  }\n\n  jerry_value_t ret = jerryx_arg_string_to_buffer_common_routine (to_string, c_arg_p, encoding);\n  jerry_value_free (to_string);\n\n  return ret;\n} /* jerryx_arg_transform_string_common */\n\n/**\n * Transform a JS argument to a cesu8 char array. Type coercion is not allowed.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_string_strict (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                    const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  return jerryx_arg_transform_string_strict_common (js_arg_iter_p, c_arg_p, JERRY_ENCODING_CESU8);\n} /* jerryx_arg_transform_string_strict */\n\n/**\n * Transform a JS argument to a utf8 char array. Type coercion is not allowed.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_utf8_string_strict (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                         const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  return jerryx_arg_transform_string_strict_common (js_arg_iter_p, c_arg_p, JERRY_ENCODING_UTF8);\n} /* jerryx_arg_transform_utf8_string_strict */\n\n/**\n * Transform a JS argument to a cesu8 char array. Type coercion is allowed.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_string (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                             const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  return jerryx_arg_transform_string_common (js_arg_iter_p, c_arg_p, JERRY_ENCODING_CESU8);\n} /* jerryx_arg_transform_string */\n\n/**\n * Transform a JS argument to a utf8 char array. Type coercion is allowed.\n *\n * Note:\n *      returned value must be freed with jerry_value_free, when it is no longer needed.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_utf8_string (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                  const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  return jerryx_arg_transform_string_common (js_arg_iter_p, c_arg_p, JERRY_ENCODING_UTF8);\n} /* jerryx_arg_transform_utf8_string */\n\n/**\n * Check whether the JS argument is jerry function, if so, assign to the native argument.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_function (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                               const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_pop (js_arg_iter_p);\n\n  if (!jerry_value_is_function (js_arg))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"It is not a function.\");\n  }\n\n  jerry_value_t *func_p = c_arg_p->dest;\n  *func_p = jerry_value_copy (js_arg);\n\n  return jerry_undefined ();\n} /* jerryx_arg_transform_function */\n\n/**\n * Check whether the native pointer has the expected type info.\n * If so, assign it to the native argument.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_native_pointer (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                     const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_pop (js_arg_iter_p);\n\n  if (!jerry_value_is_object (js_arg))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"It is not an object.\");\n  }\n\n  const jerry_object_native_info_t *expected_info_p;\n  expected_info_p = (const jerry_object_native_info_t *) c_arg_p->extra_info;\n  void **ptr_p = (void **) c_arg_p->dest;\n  *ptr_p = jerry_object_get_native_ptr (js_arg, expected_info_p);\n\n  if (*ptr_p == NULL)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"The object has no native pointer or type does not match.\");\n  }\n\n  return jerry_undefined ();\n} /* jerryx_arg_transform_native_pointer */\n\n/**\n * Check whether the JS object's properties have expected types, and transform them into native args.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_object_props (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                   const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_pop (js_arg_iter_p);\n\n  const jerryx_arg_object_props_t *object_props = (const jerryx_arg_object_props_t *) c_arg_p->extra_info;\n\n  return jerryx_arg_transform_object_properties (js_arg,\n                                                 object_props->name_p,\n                                                 object_props->name_cnt,\n                                                 object_props->c_arg_p,\n                                                 object_props->c_arg_cnt);\n} /* jerryx_arg_transform_object_props */\n\n/**\n * Check whether the JS array's items have expected types, and transform them into native args.\n *\n * @return jerry undefined: the transformer passes,\n *         jerry error: the transformer fails.\n */\njerry_value_t\njerryx_arg_transform_array_items (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                  const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_pop (js_arg_iter_p);\n\n  const jerryx_arg_array_items_t *array_items_p = (const jerryx_arg_array_items_t *) c_arg_p->extra_info;\n\n  return jerryx_arg_transform_array (js_arg, array_items_p->c_arg_p, array_items_p->c_arg_cnt);\n} /* jerryx_arg_transform_array_items */\n\n/**\n * Define transformer for optional argument.\n */\n#define JERRYX_ARG_TRANSFORM_OPTIONAL(type)                                                      \\\n  jerry_value_t jerryx_arg_transform_##type##_optional (jerryx_arg_js_iterator_t *js_arg_iter_p, \\\n                                                        const jerryx_arg_t *c_arg_p)             \\\n  {                                                                                              \\\n    return jerryx_arg_transform_optional (js_arg_iter_p, c_arg_p, jerryx_arg_transform_##type);  \\\n  }\n\nJERRYX_ARG_TRANSFORM_OPTIONAL (number)\nJERRYX_ARG_TRANSFORM_OPTIONAL (number_strict)\nJERRYX_ARG_TRANSFORM_OPTIONAL (boolean)\nJERRYX_ARG_TRANSFORM_OPTIONAL (boolean_strict)\nJERRYX_ARG_TRANSFORM_OPTIONAL (string)\nJERRYX_ARG_TRANSFORM_OPTIONAL (string_strict)\nJERRYX_ARG_TRANSFORM_OPTIONAL (utf8_string)\nJERRYX_ARG_TRANSFORM_OPTIONAL (utf8_string_strict)\nJERRYX_ARG_TRANSFORM_OPTIONAL (function)\nJERRYX_ARG_TRANSFORM_OPTIONAL (native_pointer)\nJERRYX_ARG_TRANSFORM_OPTIONAL (object_props)\nJERRYX_ARG_TRANSFORM_OPTIONAL (array_items)\n\nJERRYX_ARG_TRANSFORM_OPTIONAL (uint8)\nJERRYX_ARG_TRANSFORM_OPTIONAL (uint16)\nJERRYX_ARG_TRANSFORM_OPTIONAL (uint32)\nJERRYX_ARG_TRANSFORM_OPTIONAL (int8)\nJERRYX_ARG_TRANSFORM_OPTIONAL (int16)\nJERRYX_ARG_TRANSFORM_OPTIONAL (int32)\nJERRYX_ARG_TRANSFORM_OPTIONAL (int8_strict)\nJERRYX_ARG_TRANSFORM_OPTIONAL (int16_strict)\nJERRYX_ARG_TRANSFORM_OPTIONAL (int32_strict)\nJERRYX_ARG_TRANSFORM_OPTIONAL (uint8_strict)\nJERRYX_ARG_TRANSFORM_OPTIONAL (uint16_strict)\nJERRYX_ARG_TRANSFORM_OPTIONAL (uint32_strict)\n\n#undef JERRYX_ARG_TRANSFORM_OPTIONAL\n\n/**\n * Ignore the JS argument.\n *\n * @return jerry undefined\n */\njerry_value_t\njerryx_arg_transform_ignore (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                             const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  (void) js_arg_iter_p; /* unused */\n  (void) c_arg_p; /* unused */\n\n  return jerry_undefined ();\n} /* jerryx_arg_transform_ignore */\n"
  },
  {
    "path": "jerry-ext/arg/arg.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-ext/arg.h\"\n\n#include \"jerryscript.h\"\n\n#include \"arg-internal.h\"\n#include \"jext-common.h\"\n\nJERRYX_STATIC_ASSERT (sizeof (jerryx_arg_int_option_t) <= sizeof (((jerryx_arg_t *) 0)->extra_info),\n                      jerryx_arg_number_options_t_must_fit_into_extra_info);\n\n/**\n * Validate the JS arguments and assign them to the native arguments.\n *\n * @return jerry undefined: all validators passed,\n *         jerry error: a validator failed.\n */\njerry_value_t\njerryx_arg_transform_args (const jerry_value_t *js_arg_p, /**< points to the array with JS arguments */\n                           const jerry_length_t js_arg_cnt, /**< the count of the `js_arg_p` array */\n                           const jerryx_arg_t *c_arg_p, /**< points to the array of validation/transformation steps */\n                           jerry_length_t c_arg_cnt) /**< the count of the `c_arg_p` array */\n{\n  jerry_value_t ret = jerry_undefined ();\n\n  jerryx_arg_js_iterator_t iterator = { .js_arg_p = js_arg_p, .js_arg_cnt = js_arg_cnt, .js_arg_idx = 0 };\n\n  for (; c_arg_cnt != 0 && !jerry_value_is_exception (ret); c_arg_cnt--, c_arg_p++)\n  {\n    ret = c_arg_p->func (&iterator, c_arg_p);\n  }\n\n  return ret;\n} /* jerryx_arg_transform_args */\n\n/**\n * Validate the this value and the JS arguments,\n * and assign them to the native arguments.\n * This function is useful to perform input validation inside external\n * function handlers (see jerry_external_handler_t).\n * @note this_val is processed as the first value, before the array of arguments.\n *\n * @return jerry undefined: all validators passed,\n *         jerry error: a validator failed.\n */\njerry_value_t\njerryx_arg_transform_this_and_args (const jerry_value_t this_val, /**< the this_val for the external function */\n                                    const jerry_value_t *js_arg_p, /**< points to the array with JS arguments */\n                                    const jerry_length_t js_arg_cnt, /**< the count of the `js_arg_p` array */\n                                    const jerryx_arg_t *c_arg_p, /**< points to the array of transformation steps */\n                                    jerry_length_t c_arg_cnt) /**< the count of the `c_arg_p` array */\n{\n  if (c_arg_cnt == 0)\n  {\n    return jerry_undefined ();\n  }\n\n  jerryx_arg_js_iterator_t iterator = { .js_arg_p = &this_val, .js_arg_cnt = 1, .js_arg_idx = 0 };\n\n  jerry_value_t ret = c_arg_p->func (&iterator, c_arg_p);\n\n  if (jerry_value_is_exception (ret))\n  {\n    jerry_value_free (ret);\n\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"'this' validation failed.\");\n  }\n\n  return jerryx_arg_transform_args (js_arg_p, js_arg_cnt, c_arg_p + 1, c_arg_cnt - 1);\n} /* jerryx_arg_transform_this_and_args */\n\n/**\n * Validate the `obj_val`'s properties,\n * and assign them to the native arguments.\n *\n * @return jerry undefined: all validators passed,\n *         jerry error: a validator failed.\n */\njerry_value_t\njerryx_arg_transform_object_properties (const jerry_value_t obj_val, /**< the JS object */\n                                        const jerry_char_t **name_p, /**< property name list of the JS object */\n                                        const jerry_length_t name_cnt, /**< count of the name list */\n                                        const jerryx_arg_t *c_arg_p, /**< points to the array of transformation steps */\n                                        jerry_length_t c_arg_cnt) /**< the count of the `c_arg_p` array */\n{\n  if (!jerry_value_is_object (obj_val))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"Not an object.\");\n  }\n\n  JERRY_VLA (jerry_value_t, prop, name_cnt);\n\n  for (jerry_length_t i = 0; i < name_cnt; i++, name_p++)\n  {\n    const jerry_value_t name_str = jerry_string_sz ((char *) (*name_p));\n    prop[i] = jerry_object_get (obj_val, name_str);\n    jerry_value_free (name_str);\n\n    if (jerry_value_is_exception (prop[i]))\n    {\n      for (jerry_length_t j = 0; j < i; j++)\n      {\n        jerry_value_free (prop[j]);\n      }\n\n      return prop[i];\n    }\n  }\n\n  const jerry_value_t ret = jerryx_arg_transform_args (prop, name_cnt, c_arg_p, c_arg_cnt);\n\n  for (jerry_length_t i = 0; i < name_cnt; i++)\n  {\n    jerry_value_free (prop[i]);\n  }\n\n  return ret;\n} /* jerryx_arg_transform_object_properties */\n\n/**\n * Validate the items in the JS array and assign them to the native arguments.\n *\n * @return jerry undefined: all validators passed,\n *         jerry error: a validator failed.\n */\njerry_value_t\njerryx_arg_transform_array (const jerry_value_t array_val, /**< points to the JS array */\n                            const jerryx_arg_t *c_arg_p, /**< points to the array of validation/transformation steps */\n                            jerry_length_t c_arg_cnt) /**< the count of the `c_arg_p` array */\n{\n  if (!jerry_value_is_array (array_val))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"Not an array.\");\n  }\n\n  JERRY_VLA (jerry_value_t, arr, c_arg_cnt);\n\n  for (jerry_length_t i = 0; i < c_arg_cnt; i++)\n  {\n    arr[i] = jerry_object_get_index (array_val, i);\n\n    if (jerry_value_is_exception (arr[i]))\n    {\n      for (jerry_length_t j = 0; j < i; j++)\n      {\n        jerry_value_free (arr[j]);\n      }\n\n      return arr[i];\n    }\n  }\n\n  const jerry_value_t ret = jerryx_arg_transform_args (arr, c_arg_cnt, c_arg_p, c_arg_cnt);\n\n  for (jerry_length_t i = 0; i < c_arg_cnt; i++)\n  {\n    jerry_value_free (arr[i]);\n  }\n\n  return ret;\n} /* jerryx_arg_transform_array */\n"
  },
  {
    "path": "jerry-ext/common/jext-common.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JEXT_COMMON_H\n#define JEXT_COMMON_H\n\n#include <stdio.h>\n#include <string.h>\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n/*\n * Make sure unused parameters, variables, or expressions trigger no compiler warning.\n */\n#define JERRYX_UNUSED(x) ((void) (x))\n\n/*\n * Asserts\n *\n * Warning:\n *         Don't use JERRY_STATIC_ASSERT in headers, because\n *         __LINE__ may be the same for asserts in a header\n *         and in an implementation file.\n */\n#define JERRYX_STATIC_ASSERT_GLUE_(a, b, c) a##b##_##c\n#define JERRYX_STATIC_ASSERT_GLUE(a, b, c)  JERRYX_STATIC_ASSERT_GLUE_ (a, b, c)\n#define JERRYX_STATIC_ASSERT(x, msg)                                                  \\\n  enum                                                                                \\\n  {                                                                                   \\\n    JERRYX_STATIC_ASSERT_GLUE (static_assertion_failed_, __LINE__, msg) = 1 / (!!(x)) \\\n  }\n\n#ifndef JERRY_NDEBUG\nvoid JERRY_ATTR_NORETURN jerry_assert_fail (const char *assertion,\n                                            const char *file,\n                                            const char *function,\n                                            const uint32_t line);\nvoid JERRY_ATTR_NORETURN jerry_unreachable (const char *file, const char *function, const uint32_t line);\n\n#define JERRYX_ASSERT(x)                                    \\\n  do                                                        \\\n  {                                                         \\\n    if (JERRY_UNLIKELY (!(x)))                              \\\n    {                                                       \\\n      jerry_assert_fail (#x, __FILE__, __func__, __LINE__); \\\n    }                                                       \\\n  } while (0)\n\n#define JERRYX_UNREACHABLE()                          \\\n  do                                                  \\\n  {                                                   \\\n    jerry_unreachable (__FILE__, __func__, __LINE__); \\\n  } while (0)\n#else /* JERRY_NDEBUG */\n#define JERRYX_ASSERT(x) \\\n  do                     \\\n  {                      \\\n    if (false)           \\\n    {                    \\\n      JERRYX_UNUSED (x); \\\n    }                    \\\n  } while (0)\n\n#ifdef __GNUC__\n#define JERRYX_UNREACHABLE() __builtin_unreachable ()\n#endif /* __GNUC__ */\n\n#ifdef _MSC_VER\n#define JERRYX_UNREACHABLE() _assume (0)\n#endif /* _MSC_VER */\n\n#ifndef JERRYX_UNREACHABLE\n#define JERRYX_UNREACHABLE()\n#endif /* !JERRYX_UNREACHABLE */\n\n#endif /* !JERRY_NDEBUG */\n\n/*\n * Logging\n */\n#define JERRYX_ERROR_MSG(...)   jerry_log (JERRY_LOG_LEVEL_ERROR, __VA_ARGS__)\n#define JERRYX_WARNING_MSG(...) jerry_log (JERRY_LOG_LEVEL_WARNING, __VA_ARGS__)\n#define JERRYX_DEBUG_MSG(...)   jerry_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__)\n#define JERRYX_TRACE_MSG(...)   jerry_log (JERRY_LOG_LEVEL_TRACE, __VA_ARGS__)\n\n#endif /* !JEXT_COMMON_H */\n"
  },
  {
    "path": "jerry-ext/debugger/debugger-common.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <assert.h>\n\n#include \"jerryscript-ext/debugger.h\"\n#include \"jext-common.h\"\n\n/**\n * Must be called after the connection has been initialized.\n */\nvoid\njerryx_debugger_after_connect (bool success) /**< tells whether the connection\n                                              *   has been successfully established */\n{\n#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)\n  if (success)\n  {\n    jerry_debugger_transport_start ();\n  }\n  else\n  {\n    jerry_debugger_transport_close ();\n  }\n#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) */\n  JERRYX_UNUSED (success);\n#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */\n} /* jerryx_debugger_after_connect */\n\n/**\n * Check that value contains the reset abort value.\n *\n * Note: if the value is the reset abort value, the value is released.\n *\n * return true, if reset abort\n *        false, otherwise\n */\nbool\njerryx_debugger_is_reset (jerry_value_t value) /**< jerry value */\n{\n  if (!jerry_value_is_abort (value))\n  {\n    return false;\n  }\n\n  jerry_value_t abort_value = jerry_exception_value (value, false);\n\n  if (!jerry_value_is_string (abort_value))\n  {\n    jerry_value_free (abort_value);\n    return false;\n  }\n\n  static const char restart_str[] = \"r353t\";\n\n  jerry_size_t str_size = jerry_string_size (abort_value, JERRY_ENCODING_CESU8);\n  bool is_reset = false;\n\n  if (str_size == sizeof (restart_str) - 1)\n  {\n    JERRY_VLA (jerry_char_t, str_buf, str_size);\n    jerry_string_to_buffer (abort_value, JERRY_ENCODING_CESU8, str_buf, str_size);\n\n    is_reset = memcmp (restart_str, (char *) (str_buf), str_size) == 0;\n\n    if (is_reset)\n    {\n      jerry_value_free (value);\n    }\n  }\n\n  jerry_value_free (abort_value);\n  return is_reset;\n} /* jerryx_debugger_is_reset */\n"
  },
  {
    "path": "jerry-ext/debugger/debugger-rp.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-ext/debugger.h\"\n#include \"jext-common.h\"\n\n#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)\n\n/* A simplified transmission layer. */\n\n/**\n * Size of the raw packet header.\n */\n#define JERRYX_DEBUGGER_RAWPACKET_HEADER_SIZE 1\n/**\n * Maximum message size with 1 byte size field.\n */\n#define JERRYX_DEBUGGER_RAWPACKET_ONE_BYTE_LEN_MAX 255\n\n/**\n * Header for incoming packets.\n */\ntypedef struct\n{\n  uint8_t size; /**< size of the message */\n} jerryx_rawpacket_receive_header_t;\n\n/**\n * Close a tcp connection.\n */\nstatic void\njerryx_debugger_rp_close (jerry_debugger_transport_header_t *header_p) /**< header for the transport interface */\n{\n  JERRYX_ASSERT (!jerry_debugger_transport_is_connected ());\n\n  jerry_heap_free ((void *) header_p, sizeof (jerry_debugger_transport_header_t));\n} /* jerryx_debugger_rp_close */\n\n/**\n * Send data over a simple raw packet connection.\n *\n * @return true - if the data has been sent successfully\n *         false - otherwise\n */\nstatic bool\njerryx_debugger_rp_send (jerry_debugger_transport_header_t *header_p, /**< header for the transport interface */\n                         uint8_t *message_p, /**< message to be sent */\n                         size_t message_length) /**< message length in bytes */\n{\n  JERRYX_ASSERT (message_length <= JERRYX_DEBUGGER_RAWPACKET_ONE_BYTE_LEN_MAX);\n\n  message_p[-1] = (uint8_t) message_length;\n\n  return header_p->next_p->send (header_p->next_p, message_p - 1, message_length + 1);\n} /* jerryx_debugger_rp_send */\n\n/**\n * Receive data from a rawpacket connection.\n *\n * @return true - if data has been received successfully\n *         false - otherwise\n */\nstatic bool\njerryx_debugger_rp_receive (jerry_debugger_transport_header_t *header_p, /**< header for the transport interface */\n                            jerry_debugger_transport_receive_context_t *receive_context_p) /**< receive context */\n{\n  if (!header_p->next_p->receive (header_p->next_p, receive_context_p))\n  {\n    return false;\n  }\n\n  if (receive_context_p->message_p == NULL)\n  {\n    return true;\n  }\n\n  size_t message_total_length = receive_context_p->message_total_length;\n\n  if (message_total_length == 0)\n  {\n    /* Byte stream. */\n    if (receive_context_p->message_length < sizeof (jerryx_rawpacket_receive_header_t))\n    {\n      receive_context_p->message_p = NULL;\n      return true;\n    }\n  }\n  else\n  {\n    /* Datagram packet. */\n    JERRYX_ASSERT (receive_context_p->message_length >= sizeof (jerryx_rawpacket_receive_header_t));\n  }\n\n  uint8_t *message_p = receive_context_p->message_p;\n  size_t message_length = (size_t) (message_p[0]);\n\n  if (message_total_length == 0)\n  {\n    size_t new_total_length = message_length + sizeof (jerryx_rawpacket_receive_header_t);\n\n    /* Byte stream. */\n    if (receive_context_p->message_length < new_total_length)\n    {\n      receive_context_p->message_p = NULL;\n      return true;\n    }\n\n    receive_context_p->message_total_length = new_total_length;\n  }\n  else\n  {\n    /* Datagram packet. */\n    JERRYX_ASSERT (receive_context_p->message_length == (message_length + sizeof (jerryx_rawpacket_receive_header_t)));\n  }\n\n  receive_context_p->message_p = message_p + sizeof (jerryx_rawpacket_receive_header_t);\n  receive_context_p->message_length = message_length;\n\n  return true;\n} /* jerryx_debugger_rp_receive */\n\n/**\n * Initialize a simple raw packet transmission layer.\n *\n * @return true - if the connection succeeded\n *         false - otherwise\n */\nbool\njerryx_debugger_rp_create (void)\n{\n  const jerry_size_t interface_size = sizeof (jerry_debugger_transport_header_t);\n  jerry_debugger_transport_header_t *header_p;\n  header_p = (jerry_debugger_transport_header_t *) jerry_heap_alloc (interface_size);\n\n  if (!header_p)\n  {\n    return false;\n  }\n\n  header_p->close = jerryx_debugger_rp_close;\n  header_p->send = jerryx_debugger_rp_send;\n  header_p->receive = jerryx_debugger_rp_receive;\n\n  jerry_debugger_transport_add (header_p,\n                                JERRYX_DEBUGGER_RAWPACKET_HEADER_SIZE,\n                                JERRYX_DEBUGGER_RAWPACKET_ONE_BYTE_LEN_MAX,\n                                JERRYX_DEBUGGER_RAWPACKET_HEADER_SIZE,\n                                JERRYX_DEBUGGER_RAWPACKET_ONE_BYTE_LEN_MAX);\n\n  return true;\n} /* jerryx_debugger_rp_create */\n\n#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) */\n\n/**\n * Dummy function when debugger is disabled.\n *\n * @return false\n */\nbool\njerryx_debugger_rp_create (void)\n{\n  return false;\n} /* jerryx_debugger_rp_create */\n\n#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */\n"
  },
  {
    "path": "jerry-ext/debugger/debugger-serial.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-debugger-transport.h\"\n\n#include \"jerryscript-ext/debugger.h\"\n#include \"jext-common.h\"\n\n#if (defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) && !defined _WIN32\n\n#include <errno.h>\n#include <fcntl.h>\n#include <stdlib.h>\n#include <termios.h>\n#include <unistd.h>\n\n/* Max size of configuration string */\n#define CONFIG_SIZE (255)\n\n/**\n * Implementation of transport over serial connection.\n */\ntypedef struct\n{\n  jerry_debugger_transport_header_t header; /**< transport header */\n  int fd; /**< file descriptor */\n} jerryx_debugger_transport_serial_t;\n\n/**\n * Configure parameters for a serial port.\n */\ntypedef struct\n{\n  char *device_id;\n  uint32_t baud_rate; /**< specify the rate at which bits are transmitted for the serial interface */\n  uint32_t data_bits; /**< specify the number of data bits to transmit over the serial interface */\n  char parity; /**< specify how you want to check parity bits in the data bits transmitted via the serial port */\n  uint32_t stop_bits; /**< specify the number of bits used to indicate the end of a byte. */\n} jerryx_debugger_transport_serial_config_t;\n\n/**\n * Correctly close a file descriptor.\n */\nstatic inline void\njerryx_debugger_serial_close_fd (int fd) /**< file descriptor to close */\n{\n  if (close (fd) != 0)\n  {\n    JERRYX_ERROR_MSG (\"Error while closing the file descriptor: %d\\n\", errno);\n  }\n} /* jerryx_debugger_serial_close_fd */\n\n/**\n * Set a file descriptor to blocking or non-blocking mode.\n *\n * @return true if everything is ok\n *         false if there was an error\n **/\nstatic bool\njerryx_debugger_serial_set_blocking (int fd, bool blocking)\n{\n  /* Save the current flags */\n  int flags = fcntl (fd, F_GETFL, 0);\n  if (flags == -1)\n  {\n    JERRYX_ERROR_MSG (\"Error %d during get flags from file descriptor\\n\", errno);\n    return false;\n  }\n\n  if (blocking)\n  {\n    flags &= ~O_NONBLOCK;\n  }\n  else\n  {\n    flags |= O_NONBLOCK;\n  }\n\n  if (fcntl (fd, F_SETFL, flags) == -1)\n  {\n    JERRYX_ERROR_MSG (\"Error %d during set flags from file descriptor\\n\", errno);\n    return false;\n  }\n\n  return true;\n} /* jerryx_debugger_serial_set_blocking */\n\n/**\n * Configure the file descriptor used by the serial communcation.\n *\n * @return true if everything is ok\n *         false if there was an error\n */\nstatic inline bool\njerryx_debugger_serial_configure_attributes (int fd, jerryx_debugger_transport_serial_config_t serial_config)\n{\n  struct termios options;\n  memset (&options, 0, sizeof (options));\n\n  /* Get the parameters associated with the file descriptor */\n  if (tcgetattr (fd, &options) != 0)\n  {\n    JERRYX_ERROR_MSG (\"Error %d from tggetattr\\n\", errno);\n    return false;\n  }\n\n  /* Set the input and output baud rates */\n  cfsetispeed (&options, serial_config.baud_rate);\n  cfsetospeed (&options, serial_config.baud_rate);\n\n  /* Set the control modes */\n  options.c_cflag &= (uint32_t) ~CSIZE; // character size mask\n  options.c_cflag |= (CLOCAL | CREAD); // ignore modem control lines and enable the receiver\n\n  switch (serial_config.data_bits)\n  {\n    case 5:\n    {\n      options.c_cflag |= CS5; // set character size mask to 5-bit chars\n      break;\n    }\n    case 6:\n    {\n      options.c_cflag |= CS6; // set character size mask to 6-bit chars\n      break;\n    }\n    case 7:\n    {\n      options.c_cflag |= CS7; // set character size mask to 7-bit chars\n      break;\n    }\n    case 8:\n    {\n      options.c_cflag |= CS8; // set character size mask to 8-bit chars\n      break;\n    }\n    default:\n    {\n      JERRYX_ERROR_MSG (\"Unsupported data bits: %d\\n\", serial_config.data_bits);\n      return false;\n    }\n  }\n\n  switch (serial_config.parity)\n  {\n    case 'N':\n    {\n      options.c_cflag &= (unsigned int) ~(PARENB | PARODD);\n      break;\n    }\n    case 'O':\n    {\n      options.c_cflag |= PARENB;\n      options.c_cflag |= PARODD;\n      break;\n    }\n    case 'E':\n    {\n      options.c_cflag |= PARENB;\n      options.c_cflag |= PARODD;\n      break;\n    }\n    default:\n    {\n      JERRYX_ERROR_MSG (\"Unsupported parity: %c\\n\", serial_config.parity);\n      return false;\n    }\n  }\n\n  switch (serial_config.stop_bits)\n  {\n    case 1:\n    {\n      options.c_cflag &= (uint32_t) ~CSTOPB; // set 1 stop bits\n      break;\n    }\n    case 2:\n    {\n      options.c_cflag |= CSTOPB; // set 2 stop bits\n      break;\n    }\n    default:\n    {\n      JERRYX_ERROR_MSG (\"Unsupported stop bits: %d\\n\", serial_config.stop_bits);\n      return false;\n    }\n  }\n\n  /* Set the input modes */\n  options.c_iflag &= (uint32_t) ~IGNBRK; // disable break processing\n  options.c_iflag &= (uint32_t) ~(IXON | IXOFF | IXANY); // disable xon/xoff ctrl\n\n  /* Set the output modes: no remapping, no delays */\n  options.c_oflag = 0;\n\n  /* Set the local modes: no signaling chars, no echo, no canoncial processing */\n  options.c_lflag = 0;\n\n  /* Read returns when at least one byte of data is available. */\n  options.c_cc[VMIN] = 1; // read block\n  options.c_cc[VTIME] = 5; // 0.5 seconds read timeout\n\n  /* Set the parameters associated with the file descriptor */\n  if (tcsetattr (fd, TCSANOW, &options) != 0)\n  {\n    JERRYX_ERROR_MSG (\"Error %d from tcsetattr\", errno);\n    return false;\n  }\n\n  /* Flushes both data received but not read, and data written but not transmitted */\n  if (tcflush (fd, TCIOFLUSH) != 0)\n  {\n    JERRYX_ERROR_MSG (\"Error %d in tcflush() :%s\\n\", errno, strerror (errno));\n    jerryx_debugger_serial_close_fd (fd);\n    return false;\n  }\n\n  return true;\n} /* jerryx_debugger_serial_configure_attributes */\n\n/**\n * Close a serial connection.\n */\nstatic void\njerryx_debugger_serial_close (jerry_debugger_transport_header_t *header_p) /**< serial implementation */\n{\n  JERRYX_ASSERT (!jerry_debugger_transport_is_connected ());\n\n  jerryx_debugger_transport_serial_t *serial_p = (jerryx_debugger_transport_serial_t *) header_p;\n\n  JERRYX_DEBUG_MSG (\"Serial connection closed.\\n\");\n\n  jerryx_debugger_serial_close_fd (serial_p->fd);\n\n  jerry_heap_free ((void *) header_p, sizeof (jerryx_debugger_transport_serial_t));\n} /* jerryx_debugger_serial_close */\n\n/**\n * Send data over a serial connection.\n *\n * @return true - if the data has been sent successfully\n *         false - otherwise\n */\nstatic bool\njerryx_debugger_serial_send (jerry_debugger_transport_header_t *header_p, /**< serial implementation */\n                             uint8_t *message_p, /**< message to be sent */\n                             size_t message_length) /**< message length in bytes */\n{\n  JERRYX_ASSERT (jerry_debugger_transport_is_connected ());\n\n  jerryx_debugger_transport_serial_t *serial_p = (jerryx_debugger_transport_serial_t *) header_p;\n\n  do\n  {\n    ssize_t sent_bytes = write (serial_p->fd, message_p, message_length);\n\n    if (sent_bytes < 0)\n    {\n      if (errno == EWOULDBLOCK)\n      {\n        continue;\n      }\n\n      JERRYX_ERROR_MSG (\"Error: write to file descriptor: %d\\n\", errno);\n      jerry_debugger_transport_close ();\n      return false;\n    }\n\n    message_p += sent_bytes;\n    message_length -= (size_t) sent_bytes;\n  } while (message_length > 0);\n\n  return true;\n} /* jerryx_debugger_serial_send */\n\n/**\n * Receive data from a serial connection.\n */\nstatic bool\njerryx_debugger_serial_receive (jerry_debugger_transport_header_t *header_p, /**< serial implementation */\n                                jerry_debugger_transport_receive_context_t *receive_context_p) /**< receive context */\n{\n  jerryx_debugger_transport_serial_t *serial_p = (jerryx_debugger_transport_serial_t *) header_p;\n\n  uint8_t *buffer_p = receive_context_p->buffer_p + receive_context_p->received_length;\n  size_t buffer_size = JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE - receive_context_p->received_length;\n\n  ssize_t length = read (serial_p->fd, buffer_p, buffer_size);\n\n  if (length <= 0)\n  {\n    if (errno != EWOULDBLOCK || length == 0)\n    {\n      jerry_debugger_transport_close ();\n      return false;\n    }\n    length = 0;\n  }\n\n  receive_context_p->received_length += (size_t) length;\n\n  if (receive_context_p->received_length > 0)\n  {\n    receive_context_p->message_p = receive_context_p->buffer_p;\n    receive_context_p->message_length = receive_context_p->received_length;\n  }\n\n  return true;\n} /* jerryx_debugger_serial_receive */\n\n/**\n * Create a serial connection.\n *\n * @return true if successful,\n *         false otherwise\n */\nbool\njerryx_debugger_serial_create (const char *config) /**< specify the configuration */\n{\n  /* Parse the configuration string */\n  char tmp_config[CONFIG_SIZE];\n  strncpy (tmp_config, config, CONFIG_SIZE);\n  jerryx_debugger_transport_serial_config_t serial_config;\n\n  char *token = strtok (tmp_config, \",\");\n  serial_config.device_id = token ? token : \"/dev/ttyS0\";\n  serial_config.baud_rate = (token = strtok (NULL, \",\")) ? (uint32_t) strtoul (token, NULL, 10) : 115200;\n  serial_config.data_bits = (token = strtok (NULL, \",\")) ? (uint32_t) strtoul (token, NULL, 10) : 8;\n  serial_config.parity = (token = strtok (NULL, \",\")) ? token[0] : 'N';\n  serial_config.stop_bits = (token = strtok (NULL, \",\")) ? (uint32_t) strtoul (token, NULL, 10) : 1;\n\n  int fd = open (serial_config.device_id, O_RDWR);\n\n  if (fd < 0)\n  {\n    JERRYX_ERROR_MSG (\"Error %d opening %s: %s\", errno, serial_config.device_id, strerror (errno));\n    return false;\n  }\n\n  if (!jerryx_debugger_serial_configure_attributes (fd, serial_config))\n  {\n    jerryx_debugger_serial_close_fd (fd);\n    return false;\n  }\n\n  JERRYX_DEBUG_MSG (\"Waiting for client connection\\n\");\n\n  /* Client will sent a 'c' char to initiate the connection. */\n  uint8_t conn_char;\n  ssize_t t = read (fd, &conn_char, 1);\n  if (t != 1 || conn_char != 'c' || !jerryx_debugger_serial_set_blocking (fd, false))\n  {\n    return false;\n  }\n\n  JERRYX_DEBUG_MSG (\"Client connected\\n\");\n\n  jerry_size_t size = sizeof (jerryx_debugger_transport_serial_t);\n\n  jerry_debugger_transport_header_t *header_p;\n  header_p = (jerry_debugger_transport_header_t *) jerry_heap_alloc (size);\n\n  if (!header_p)\n  {\n    jerryx_debugger_serial_close_fd (fd);\n    return false;\n  }\n\n  header_p->close = jerryx_debugger_serial_close;\n  header_p->send = jerryx_debugger_serial_send;\n  header_p->receive = jerryx_debugger_serial_receive;\n\n  ((jerryx_debugger_transport_serial_t *) header_p)->fd = fd;\n\n  jerry_debugger_transport_add (header_p,\n                                0,\n                                JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE,\n                                0,\n                                JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE);\n\n  return true;\n} /* jerryx_debugger_serial_create */\n\n#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) || _WIN32 */\n/**\n * Dummy function when debugger is disabled.\n *\n * @return false\n */\nbool\njerryx_debugger_serial_create (const char *config)\n{\n  JERRYX_UNUSED (config);\n  return false;\n} /* jerryx_debugger_serial_create */\n\n#endif /* (defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) && !defined _WIN32 */\n"
  },
  {
    "path": "jerry-ext/debugger/debugger-sha1.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n *  FIPS-180-1 compliant SHA-1 implementation\n *\n *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved\n *  SPDX-License-Identifier: Apache-2.0\n *\n *  Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n *  not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n *  http://www.apache.org/licenses/LICENSE-2.0\n *\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n *\n *  This file is part of mbed TLS (https://tls.mbed.org)\n */\n\n/*\n *  The SHA-1 standard was published by NIST in 1993.\n *\n *  http://www.itl.nist.gov/fipspubs/fip180-1.htm\n */\n\n#include \"debugger-sha1.h\"\n\n#include \"jext-common.h\"\n\n#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)\n\n/**\n * SHA-1 context structure.\n */\ntypedef struct\n{\n  uint32_t total[2]; /**< number of bytes processed */\n  uint32_t state[5]; /**< intermediate digest state */\n  uint8_t buffer[64]; /**< data block being processed */\n} jerryx_sha1_context;\n\n/* 32-bit integer manipulation macros (big endian). */\n\n#define JERRYX_SHA1_GET_UINT32_BE(n, b, i)                                                                         \\\n  {                                                                                                                \\\n    (n) = (((uint32_t) (b)[(i) + 0]) << 24) | (((uint32_t) (b)[(i) + 1]) << 16) | (((uint32_t) (b)[(i) + 2]) << 8) \\\n          | ((uint32_t) (b)[(i) + 3]);                                                                             \\\n  }\n\n#define JERRYX_SHA1_PUT_UINT32_BE(n, b, i) \\\n  {                                        \\\n    (b)[(i) + 0] = (uint8_t) ((n) >> 24);  \\\n    (b)[(i) + 1] = (uint8_t) ((n) >> 16);  \\\n    (b)[(i) + 2] = (uint8_t) ((n) >> 8);   \\\n    (b)[(i) + 3] = (uint8_t) ((n));        \\\n  }\n\n/**\n * Initialize SHA-1 context.\n */\nstatic void\njerryx_sha1_init (jerryx_sha1_context *sha1_context_p) /**< SHA-1 context */\n{\n  memset (sha1_context_p, 0, sizeof (jerryx_sha1_context));\n\n  sha1_context_p->total[0] = 0;\n  sha1_context_p->total[1] = 0;\n\n  sha1_context_p->state[0] = 0x67452301;\n  sha1_context_p->state[1] = 0xEFCDAB89;\n  sha1_context_p->state[2] = 0x98BADCFE;\n  sha1_context_p->state[3] = 0x10325476;\n  sha1_context_p->state[4] = 0xC3D2E1F0;\n} /* jerryx_sha1_init */\n\n#define JERRYX_SHA1_P(a, b, c, d, e, x)                              \\\n  do                                                                 \\\n  {                                                                  \\\n    e += JERRYX_SHA1_SHIFT (a, 5) + JERRYX_SHA1_F (b, c, d) + K + x; \\\n    b = JERRYX_SHA1_SHIFT (b, 30);                                   \\\n  } while (0)\n\n/**\n * Update SHA-1 internal buffer status.\n */\nstatic void\njerryx_sha1_process (jerryx_sha1_context *sha1_context_p, /**< SHA-1 context */\n                     const uint8_t data[64]) /**< data buffer */\n{\n  uint32_t temp, W[16], A, B, C, D, E;\n\n  JERRYX_SHA1_GET_UINT32_BE (W[0], data, 0);\n  JERRYX_SHA1_GET_UINT32_BE (W[1], data, 4);\n  JERRYX_SHA1_GET_UINT32_BE (W[2], data, 8);\n  JERRYX_SHA1_GET_UINT32_BE (W[3], data, 12);\n  JERRYX_SHA1_GET_UINT32_BE (W[4], data, 16);\n  JERRYX_SHA1_GET_UINT32_BE (W[5], data, 20);\n  JERRYX_SHA1_GET_UINT32_BE (W[6], data, 24);\n  JERRYX_SHA1_GET_UINT32_BE (W[7], data, 28);\n  JERRYX_SHA1_GET_UINT32_BE (W[8], data, 32);\n  JERRYX_SHA1_GET_UINT32_BE (W[9], data, 36);\n  JERRYX_SHA1_GET_UINT32_BE (W[10], data, 40);\n  JERRYX_SHA1_GET_UINT32_BE (W[11], data, 44);\n  JERRYX_SHA1_GET_UINT32_BE (W[12], data, 48);\n  JERRYX_SHA1_GET_UINT32_BE (W[13], data, 52);\n  JERRYX_SHA1_GET_UINT32_BE (W[14], data, 56);\n  JERRYX_SHA1_GET_UINT32_BE (W[15], data, 60);\n\n#define JERRYX_SHA1_SHIFT(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))\n\n#define JERRYX_SHA1_R(t)                                                            \\\n  (temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ W[(t - 14) & 0x0F] ^ W[t & 0x0F], \\\n   W[t & 0x0F] = JERRYX_SHA1_SHIFT (temp, 1))\n\n  A = sha1_context_p->state[0];\n  B = sha1_context_p->state[1];\n  C = sha1_context_p->state[2];\n  D = sha1_context_p->state[3];\n  E = sha1_context_p->state[4];\n\n  uint32_t K = 0x5A827999;\n\n#define JERRYX_SHA1_F(x, y, z) (z ^ (x & (y ^ z)))\n\n  JERRYX_SHA1_P (A, B, C, D, E, W[0]);\n  JERRYX_SHA1_P (E, A, B, C, D, W[1]);\n  JERRYX_SHA1_P (D, E, A, B, C, W[2]);\n  JERRYX_SHA1_P (C, D, E, A, B, W[3]);\n  JERRYX_SHA1_P (B, C, D, E, A, W[4]);\n  JERRYX_SHA1_P (A, B, C, D, E, W[5]);\n  JERRYX_SHA1_P (E, A, B, C, D, W[6]);\n  JERRYX_SHA1_P (D, E, A, B, C, W[7]);\n  JERRYX_SHA1_P (C, D, E, A, B, W[8]);\n  JERRYX_SHA1_P (B, C, D, E, A, W[9]);\n  JERRYX_SHA1_P (A, B, C, D, E, W[10]);\n  JERRYX_SHA1_P (E, A, B, C, D, W[11]);\n  JERRYX_SHA1_P (D, E, A, B, C, W[12]);\n  JERRYX_SHA1_P (C, D, E, A, B, W[13]);\n  JERRYX_SHA1_P (B, C, D, E, A, W[14]);\n  JERRYX_SHA1_P (A, B, C, D, E, W[15]);\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (16));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (17));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (18));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (19));\n\n#undef JERRYX_SHA1_F\n\n  K = 0x6ED9EBA1;\n\n#define JERRYX_SHA1_F(x, y, z) (x ^ y ^ z)\n\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (20));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (21));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (22));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (23));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (24));\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (25));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (26));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (27));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (28));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (29));\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (30));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (31));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (32));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (33));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (34));\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (35));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (36));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (37));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (38));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (39));\n\n#undef JERRYX_SHA1_F\n\n  K = 0x8F1BBCDC;\n\n#define JERRYX_SHA1_F(x, y, z) ((x & y) | (z & (x | y)))\n\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (40));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (41));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (42));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (43));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (44));\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (45));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (46));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (47));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (48));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (49));\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (50));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (51));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (52));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (53));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (54));\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (55));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (56));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (57));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (58));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (59));\n\n#undef JERRYX_SHA1_F\n\n  K = 0xCA62C1D6;\n\n#define JERRYX_SHA1_F(x, y, z) (x ^ y ^ z)\n\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (60));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (61));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (62));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (63));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (64));\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (65));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (66));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (67));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (68));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (69));\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (70));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (71));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (72));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (73));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (74));\n  JERRYX_SHA1_P (A, B, C, D, E, JERRYX_SHA1_R (75));\n  JERRYX_SHA1_P (E, A, B, C, D, JERRYX_SHA1_R (76));\n  JERRYX_SHA1_P (D, E, A, B, C, JERRYX_SHA1_R (77));\n  JERRYX_SHA1_P (C, D, E, A, B, JERRYX_SHA1_R (78));\n  JERRYX_SHA1_P (B, C, D, E, A, JERRYX_SHA1_R (79));\n\n#undef JERRYX_SHA1_F\n\n  sha1_context_p->state[0] += A;\n  sha1_context_p->state[1] += B;\n  sha1_context_p->state[2] += C;\n  sha1_context_p->state[3] += D;\n  sha1_context_p->state[4] += E;\n\n#undef JERRYX_SHA1_SHIFT\n#undef JERRYX_SHA1_R\n} /* jerryx_sha1_process */\n\n#undef JERRYX_SHA1_P\n\n/**\n * SHA-1 update buffer.\n */\nstatic void\njerryx_sha1_update (jerryx_sha1_context *sha1_context_p, /**< SHA-1 context */\n                    const uint8_t *source_p, /**< source buffer */\n                    size_t source_length) /**< length of source buffer */\n{\n  size_t fill;\n  uint32_t left;\n\n  if (source_length == 0)\n  {\n    return;\n  }\n\n  left = sha1_context_p->total[0] & 0x3F;\n  fill = 64 - left;\n\n  sha1_context_p->total[0] += (uint32_t) source_length;\n\n  /* Check overflow. */\n  if (sha1_context_p->total[0] < (uint32_t) source_length)\n  {\n    sha1_context_p->total[1]++;\n  }\n\n  if (left && source_length >= fill)\n  {\n    memcpy ((void *) (sha1_context_p->buffer + left), source_p, fill);\n    jerryx_sha1_process (sha1_context_p, sha1_context_p->buffer);\n    source_p += fill;\n    source_length -= fill;\n    left = 0;\n  }\n\n  while (source_length >= 64)\n  {\n    jerryx_sha1_process (sha1_context_p, source_p);\n    source_p += 64;\n    source_length -= 64;\n  }\n\n  if (source_length > 0)\n  {\n    memcpy ((void *) (sha1_context_p->buffer + left), source_p, source_length);\n  }\n} /* jerryx_sha1_update */\n\n/**\n * SHA-1 final digest.\n */\nstatic void\njerryx_sha1_finish (jerryx_sha1_context *sha1_context_p, /**< SHA-1 context */\n                    uint8_t destination_p[20]) /**< result */\n{\n  uint8_t buffer[16];\n\n  uint32_t high = (sha1_context_p->total[0] >> 29) | (sha1_context_p->total[1] << 3);\n  uint32_t low = (sha1_context_p->total[0] << 3);\n\n  uint32_t last = sha1_context_p->total[0] & 0x3F;\n  uint32_t padn = (last < 56) ? (56 - last) : (120 - last);\n\n  memset (buffer, 0, sizeof (buffer));\n  buffer[0] = 0x80;\n\n  while (padn > sizeof (buffer))\n  {\n    jerryx_sha1_update (sha1_context_p, buffer, sizeof (buffer));\n    buffer[0] = 0;\n    padn -= (uint32_t) sizeof (buffer);\n  }\n\n  jerryx_sha1_update (sha1_context_p, buffer, padn);\n\n  JERRYX_SHA1_PUT_UINT32_BE (high, buffer, 0);\n  JERRYX_SHA1_PUT_UINT32_BE (low, buffer, 4);\n\n  jerryx_sha1_update (sha1_context_p, buffer, 8);\n\n  JERRYX_SHA1_PUT_UINT32_BE (sha1_context_p->state[0], destination_p, 0);\n  JERRYX_SHA1_PUT_UINT32_BE (sha1_context_p->state[1], destination_p, 4);\n  JERRYX_SHA1_PUT_UINT32_BE (sha1_context_p->state[2], destination_p, 8);\n  JERRYX_SHA1_PUT_UINT32_BE (sha1_context_p->state[3], destination_p, 12);\n  JERRYX_SHA1_PUT_UINT32_BE (sha1_context_p->state[4], destination_p, 16);\n} /* jerryx_sha1_finish */\n\n#undef JERRYX_SHA1_GET_UINT32_BE\n#undef JERRYX_SHA1_PUT_UINT32_BE\n\n/**\n * Computes the SHA-1 value of the combination of the two input buffers.\n */\nvoid\njerryx_debugger_compute_sha1 (const uint8_t *source1_p, /**< first part of the input */\n                              size_t source1_length, /**< length of the first part */\n                              const uint8_t *source2_p, /**< second part of the input */\n                              size_t source2_length, /**< length of the second part */\n                              uint8_t destination_p[20]) /**< result */\n{\n  jerryx_sha1_context sha1_context;\n\n  jerryx_sha1_init (&sha1_context);\n  jerryx_sha1_update (&sha1_context, source1_p, source1_length);\n  jerryx_sha1_update (&sha1_context, source2_p, source2_length);\n  jerryx_sha1_finish (&sha1_context, destination_p);\n} /* jerryx_debugger_compute_sha1 */\n\n#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */\n"
  },
  {
    "path": "jerry-ext/debugger/debugger-sha1.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef DEBUGGER_SHA1_H\n#define DEBUGGER_SHA1_H\n\n#include \"jerryscript-debugger-transport.h\"\n\n#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)\n\n/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */\n\nvoid jerryx_debugger_compute_sha1 (const uint8_t *input1,\n                                   size_t input1_len,\n                                   const uint8_t *input2,\n                                   size_t input2_len,\n                                   uint8_t output[20]);\n\n#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */\n\n#endif /* !DEBUGGER_SHA1_H */\n"
  },
  {
    "path": "jerry-ext/debugger/debugger-tcp.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-debugger-transport.h\"\n\n#include \"jerryscript-ext/debugger.h\"\n#include \"jext-common.h\"\n\n#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)\n\n#include <errno.h>\n\n#ifdef _WIN32\n#include <BaseTsd.h>\n\n#include <WS2tcpip.h>\n#include <winsock2.h>\n\n/* On Windows the WSAEWOULDBLOCK value can be returned for non-blocking operations */\n#define JERRYX_EWOULDBLOCK WSAEWOULDBLOCK\n\n/* On Windows the invalid socket's value of INVALID_SOCKET */\n#define JERRYX_SOCKET_INVALID INVALID_SOCKET\n\n/*\n * On Windows, socket functions have the following signatures:\n * int send(SOCKET s, const char *buf, int len, int flags);\n * int recv(SOCKET s, char *buf, int len, int flags);\n * int setsockopt(SOCKET s, int level, int optname, const char *optval, int optlen);\n */\ntypedef int jerryx_socket_ssize_t;\ntypedef SOCKET jerryx_socket_t;\ntypedef char jerryx_socket_void_t;\ntypedef int jerryx_socket_size_t;\n#else /* !_WIN32 */\n#include <arpa/inet.h>\n#include <fcntl.h>\n#include <sys/socket.h>\n#include <unistd.h>\n\n/* On *nix the EWOULDBLOCK errno value can be returned for non-blocking operations */\n#define JERRYX_EWOULDBLOCK    EWOULDBLOCK\n\n/* On *nix the invalid socket has a value of -1 */\n#define JERRYX_SOCKET_INVALID (-1)\n\n/*\n * On *nix, socket functions have the following signatures:\n * ssize_t send(int sockfd, const void *buf, size_t len, int flags);\n * ssize_t recv(int sockfd, void *buf, size_t len, int flags);\n * int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);\n */\ntypedef ssize_t jerryx_socket_ssize_t;\ntypedef int jerryx_socket_t;\ntypedef void jerryx_socket_void_t;\ntypedef size_t jerryx_socket_size_t;\n#endif /* _WIN32 */\n\n/**\n * Implementation of transport over tcp/ip.\n */\ntypedef struct\n{\n  jerry_debugger_transport_header_t header; /**< transport header */\n  jerryx_socket_t tcp_socket; /**< tcp socket */\n} jerryx_debugger_transport_tcp_t;\n\n/**\n * Get the network error value.\n *\n * On Windows this returns the result of the `WSAGetLastError ()` call and\n * on any other system the `errno` value.\n *\n *\n * @return last error value.\n */\nstatic inline int\njerryx_debugger_tcp_get_errno (void)\n{\n#ifdef _WIN32\n  return WSAGetLastError ();\n#else /* !_WIN32 */\n  return errno;\n#endif /* _WIN32 */\n} /* jerryx_debugger_tcp_get_errno */\n\n/**\n * Correctly close a single socket.\n */\nstatic inline void\njerryx_debugger_tcp_close_socket (jerryx_socket_t socket_id) /**< socket to close */\n{\n#ifdef _WIN32\n  closesocket (socket_id);\n#else /* !_WIN32 */\n  close (socket_id);\n#endif /* _WIN32 */\n} /* jerryx_debugger_tcp_close_socket */\n\n/**\n * Log tcp error message.\n */\nstatic void\njerryx_debugger_tcp_log_error (int errno_value) /**< error value to log */\n{\n  if (errno_value == 0)\n  {\n    return;\n  }\n\n#ifdef _WIN32\n  char *error_message = NULL;\n  FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,\n                 NULL,\n                 (DWORD) errno_value,\n                 MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),\n                 (LPTSTR) &error_message,\n                 0,\n                 NULL);\n  JERRYX_ERROR_MSG (\"TCP Error: %s\\n\", error_message);\n  LocalFree (error_message);\n#else /* !_WIN32 */\n  JERRYX_ERROR_MSG (\"TCP Error: %s\\n\", strerror (errno_value));\n#endif /* _WIN32 */\n} /* jerryx_debugger_tcp_log_error */\n\n/**\n * Close a tcp connection.\n */\nstatic void\njerryx_debugger_tcp_close (jerry_debugger_transport_header_t *header_p) /**< tcp implementation */\n{\n  JERRYX_ASSERT (!jerry_debugger_transport_is_connected ());\n\n  jerryx_debugger_transport_tcp_t *tcp_p = (jerryx_debugger_transport_tcp_t *) header_p;\n\n  JERRYX_DEBUG_MSG (\"TCP connection closed.\\n\");\n\n  jerryx_debugger_tcp_close_socket (tcp_p->tcp_socket);\n\n  jerry_heap_free ((void *) header_p, sizeof (jerryx_debugger_transport_tcp_t));\n} /* jerryx_debugger_tcp_close */\n\n/**\n * Send data over a tcp connection.\n *\n * @return true - if the data has been sent successfully\n *         false - otherwise\n */\nstatic bool\njerryx_debugger_tcp_send (jerry_debugger_transport_header_t *header_p, /**< tcp implementation */\n                          uint8_t *message_p, /**< message to be sent */\n                          size_t message_length) /**< message length in bytes */\n{\n  JERRYX_ASSERT (jerry_debugger_transport_is_connected ());\n\n  jerryx_debugger_transport_tcp_t *tcp_p = (jerryx_debugger_transport_tcp_t *) header_p;\n  jerryx_socket_size_t remaining_bytes = (jerryx_socket_size_t) message_length;\n\n  do\n  {\n#ifdef __linux__\n    ssize_t is_err = recv (tcp_p->tcp_socket, NULL, 0, MSG_PEEK);\n\n    if (is_err == 0 && errno != JERRYX_EWOULDBLOCK)\n    {\n      int err_val = errno;\n      jerry_debugger_transport_close ();\n      jerryx_debugger_tcp_log_error (err_val);\n      return false;\n    }\n#endif /* __linux__ */\n\n    jerryx_socket_ssize_t sent_bytes = send (tcp_p->tcp_socket, (jerryx_socket_void_t *) message_p, remaining_bytes, 0);\n\n    if (sent_bytes < 0)\n    {\n      int err_val = jerryx_debugger_tcp_get_errno ();\n\n      if (err_val == JERRYX_EWOULDBLOCK)\n      {\n        continue;\n      }\n\n      jerry_debugger_transport_close ();\n      jerryx_debugger_tcp_log_error (err_val);\n      return false;\n    }\n\n    message_p += sent_bytes;\n    remaining_bytes -= (jerryx_socket_size_t) sent_bytes;\n  } while (remaining_bytes > 0);\n\n  return true;\n} /* jerryx_debugger_tcp_send */\n\n/**\n * Receive data from a tcp connection.\n */\nstatic bool\njerryx_debugger_tcp_receive (jerry_debugger_transport_header_t *header_p, /**< tcp implementation */\n                             jerry_debugger_transport_receive_context_t *receive_context_p) /**< receive context */\n{\n  jerryx_debugger_transport_tcp_t *tcp_p = (jerryx_debugger_transport_tcp_t *) header_p;\n\n  jerryx_socket_void_t *buffer_p =\n    (jerryx_socket_void_t *) (receive_context_p->buffer_p + receive_context_p->received_length);\n  jerryx_socket_size_t buffer_size =\n    (jerryx_socket_size_t) (JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE - receive_context_p->received_length);\n\n  jerryx_socket_ssize_t length = recv (tcp_p->tcp_socket, buffer_p, buffer_size, 0);\n\n  if (length <= 0)\n  {\n    int err_val = jerryx_debugger_tcp_get_errno ();\n\n    if (err_val != JERRYX_EWOULDBLOCK || length == 0)\n    {\n      jerry_debugger_transport_close ();\n      jerryx_debugger_tcp_log_error (err_val);\n      return false;\n    }\n    length = 0;\n  }\n\n  receive_context_p->received_length += (size_t) length;\n\n  if (receive_context_p->received_length > 0)\n  {\n    receive_context_p->message_p = receive_context_p->buffer_p;\n    receive_context_p->message_length = receive_context_p->received_length;\n  }\n\n  return true;\n} /* jerryx_debugger_tcp_receive */\n\n/**\n * Utility method to prepare the server socket to accept connections.\n *\n * The following steps are performed:\n *  * Configure address re-use.\n *  * Bind the socket to the given port\n *  * Start listening on the socket.\n *\n * @return true if everything is ok\n *         false if there was an error\n */\nstatic bool\njerryx_debugger_tcp_configure_socket (jerryx_socket_t server_socket, /** < socket to configure */\n                                      uint16_t port) /** < port number to be used for the socket */\n{\n  struct sockaddr_in addr;\n\n  addr.sin_family = AF_INET;\n  addr.sin_port = htons (port);\n  addr.sin_addr.s_addr = INADDR_ANY;\n\n  const int opt_value = 1;\n\n  if (setsockopt (server_socket, SOL_SOCKET, SO_REUSEADDR, (const jerryx_socket_void_t *) &opt_value, sizeof (int))\n      != 0)\n  {\n    return false;\n  }\n\n  if (bind (server_socket, (struct sockaddr *) &addr, sizeof (struct sockaddr_in)) != 0)\n  {\n    return false;\n  }\n\n  if (listen (server_socket, 1) != 0)\n  {\n    return false;\n  }\n\n  return true;\n} /* jerryx_debugger_tcp_configure_socket */\n\n/**\n * Create a tcp connection.\n *\n * @return true if successful,\n *         false otherwise\n */\nbool\njerryx_debugger_tcp_create (uint16_t port) /**< listening port */\n{\n#ifdef _WIN32\n  WSADATA wsaData;\n  int wsa_init_status = WSAStartup (MAKEWORD (2, 2), &wsaData);\n  if (wsa_init_status != NO_ERROR)\n  {\n    JERRYX_ERROR_MSG (\"WSA Error: %d\\n\", wsa_init_status);\n    return false;\n  }\n#endif /* _WIN32*/\n\n  jerryx_socket_t server_socket = socket (AF_INET, SOCK_STREAM, 0);\n  if (server_socket == JERRYX_SOCKET_INVALID)\n  {\n    jerryx_debugger_tcp_log_error (jerryx_debugger_tcp_get_errno ());\n    return false;\n  }\n\n  if (!jerryx_debugger_tcp_configure_socket (server_socket, port))\n  {\n    int error = jerryx_debugger_tcp_get_errno ();\n    jerryx_debugger_tcp_close_socket (server_socket);\n    jerryx_debugger_tcp_log_error (error);\n    return false;\n  }\n\n  JERRYX_DEBUG_MSG (\"Waiting for client connection\\n\");\n\n  struct sockaddr_in addr;\n  socklen_t sin_size = sizeof (struct sockaddr_in);\n\n  jerryx_socket_t tcp_socket = accept (server_socket, (struct sockaddr *) &addr, &sin_size);\n\n  jerryx_debugger_tcp_close_socket (server_socket);\n\n  if (tcp_socket == JERRYX_SOCKET_INVALID)\n  {\n    jerryx_debugger_tcp_log_error (jerryx_debugger_tcp_get_errno ());\n    return false;\n  }\n\n  /* Set non-blocking mode. */\n#ifdef _WIN32\n  u_long nonblocking_enabled = 1;\n  if (ioctlsocket (tcp_socket, (long) FIONBIO, &nonblocking_enabled) != NO_ERROR)\n  {\n    jerryx_debugger_tcp_close_socket (tcp_socket);\n    return false;\n  }\n#else /* !_WIN32 */\n  int socket_flags = fcntl (tcp_socket, F_GETFL, 0);\n\n  if (socket_flags < 0)\n  {\n    close (tcp_socket);\n    return false;\n  }\n\n  if (fcntl (tcp_socket, F_SETFL, socket_flags | O_NONBLOCK) == -1)\n  {\n    close (tcp_socket);\n    return false;\n  }\n#endif /* _WIN32 */\n\n  JERRYX_DEBUG_MSG (\"Connected from: %s\\n\", inet_ntoa (addr.sin_addr));\n\n  jerry_size_t size = sizeof (jerryx_debugger_transport_tcp_t);\n\n  jerry_debugger_transport_header_t *header_p;\n  header_p = (jerry_debugger_transport_header_t *) jerry_heap_alloc (size);\n\n  if (!header_p)\n  {\n    jerryx_debugger_tcp_close_socket (tcp_socket);\n    return false;\n  }\n\n  header_p->close = jerryx_debugger_tcp_close;\n  header_p->send = jerryx_debugger_tcp_send;\n  header_p->receive = jerryx_debugger_tcp_receive;\n\n  ((jerryx_debugger_transport_tcp_t *) header_p)->tcp_socket = tcp_socket;\n\n  jerry_debugger_transport_add (header_p,\n                                0,\n                                JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE,\n                                0,\n                                JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE);\n\n  return true;\n} /* jerryx_debugger_tcp_create */\n\n#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) */\n\n/**\n * Dummy function when debugger is disabled.\n *\n * @return false\n */\nbool\njerryx_debugger_tcp_create (uint16_t port)\n{\n  JERRYX_UNUSED (port);\n  return false;\n} /* jerryx_debugger_tcp_create */\n\n#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */\n"
  },
  {
    "path": "jerry-ext/debugger/debugger-ws.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"debugger-sha1.h\"\n#include \"jerryscript-ext/debugger.h\"\n#include \"jext-common.h\"\n\n#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)\n\n/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */\n\n/**\n * Last fragment of a Websocket package.\n */\n#define JERRYX_DEBUGGER_WEBSOCKET_FIN_BIT 0x80\n\n/**\n * Masking-key is available.\n */\n#define JERRYX_DEBUGGER_WEBSOCKET_MASK_BIT 0x80\n\n/**\n * Opcode type mask.\n */\n#define JERRYX_DEBUGGER_WEBSOCKET_OPCODE_MASK 0x0fu\n\n/**\n * Packet length mask.\n */\n#define JERRYX_DEBUGGER_WEBSOCKET_LENGTH_MASK 0x7fu\n\n/**\n * Size of websocket header size.\n */\n#define JERRYX_DEBUGGER_WEBSOCKET_HEADER_SIZE 2\n\n/**\n * Payload mask size in bytes of a websocket package.\n */\n#define JERRYX_DEBUGGER_WEBSOCKET_MASK_SIZE 4\n\n/**\n * Maximum message size with 1 byte size field.\n */\n#define JERRYX_DEBUGGER_WEBSOCKET_ONE_BYTE_LEN_MAX 125\n\n/**\n * WebSocket opcode types.\n */\ntypedef enum\n{\n  JERRYX_DEBUGGER_WEBSOCKET_TEXT_FRAME = 1, /**< text frame */\n  JERRYX_DEBUGGER_WEBSOCKET_BINARY_FRAME = 2, /**< binary frame */\n  JERRYX_DEBUGGER_WEBSOCKET_CLOSE_CONNECTION = 8, /**< close connection */\n  JERRYX_DEBUGGER_WEBSOCKET_PING = 9, /**< ping (keep alive) frame */\n  JERRYX_DEBUGGER_WEBSOCKET_PONG = 10, /**< reply to ping frame */\n} jerryx_websocket_opcode_type_t;\n\n/**\n * Header for incoming packets.\n */\ntypedef struct\n{\n  uint8_t ws_opcode; /**< websocket opcode */\n  uint8_t size; /**< size of the message */\n  uint8_t mask[4]; /**< mask bytes */\n} jerryx_websocket_receive_header_t;\n\n/**\n * Convert a 6-bit value to a Base64 character.\n *\n * @return Base64 character\n */\nstatic uint8_t\njerryx_to_base64_character (uint8_t value) /**< 6-bit value */\n{\n  if (value < 26)\n  {\n    return (uint8_t) (value + 'A');\n  }\n\n  if (value < 52)\n  {\n    return (uint8_t) (value - 26 + 'a');\n  }\n\n  if (value < 62)\n  {\n    return (uint8_t) (value - 52 + '0');\n  }\n\n  if (value == 62)\n  {\n    return (uint8_t) '+';\n  }\n\n  return (uint8_t) '/';\n} /* jerryx_to_base64_character */\n\n/**\n * Encode a byte sequence into Base64 string.\n */\nstatic void\njerryx_to_base64 (const uint8_t *source_p, /**< source data */\n                  uint8_t *destination_p, /**< destination buffer */\n                  size_t length) /**< length of source, must be divisible by 3 */\n{\n  while (length >= 3)\n  {\n    uint8_t value = (source_p[0] >> 2);\n    destination_p[0] = jerryx_to_base64_character (value);\n\n    value = (uint8_t) (((source_p[0] << 4) | (source_p[1] >> 4)) & 0x3f);\n    destination_p[1] = jerryx_to_base64_character (value);\n\n    value = (uint8_t) (((source_p[1] << 2) | (source_p[2] >> 6)) & 0x3f);\n    destination_p[2] = jerryx_to_base64_character (value);\n\n    value = (uint8_t) (source_p[2] & 0x3f);\n    destination_p[3] = jerryx_to_base64_character (value);\n\n    source_p += 3;\n    destination_p += 4;\n    length -= 3;\n  }\n} /* jerryx_to_base64 */\n\n/**\n * Process WebSocket handshake.\n *\n * @return true - if the handshake was completed successfully\n *         false - otherwise\n */\nstatic bool\njerryx_process_handshake (uint8_t *request_buffer_p) /**< temporary buffer */\n{\n  size_t request_buffer_size = 1024;\n  uint8_t *request_end_p = request_buffer_p;\n\n  /* Buffer request text until the double newlines are received. */\n  while (true)\n  {\n    jerry_debugger_transport_receive_context_t context;\n    if (!jerry_debugger_transport_receive (&context))\n    {\n      JERRYX_ASSERT (!jerry_debugger_transport_is_connected ());\n      return false;\n    }\n\n    if (context.message_p == NULL)\n    {\n      jerry_debugger_transport_sleep ();\n      continue;\n    }\n\n    size_t length = request_buffer_size - 1u - (size_t) (request_end_p - request_buffer_p);\n\n    if (length < context.message_length)\n    {\n      JERRYX_ERROR_MSG (\"Handshake buffer too small.\\n\");\n      return false;\n    }\n\n    /* Both stream and datagram packets are supported. */\n    memcpy (request_end_p, context.message_p, context.message_length);\n\n    jerry_debugger_transport_receive_completed (&context);\n\n    request_end_p += (size_t) context.message_length;\n    *request_end_p = 0;\n\n    if (request_end_p > request_buffer_p + 4 && memcmp (request_end_p - 4, \"\\r\\n\\r\\n\", 4) == 0)\n    {\n      break;\n    }\n  }\n\n  /* Check protocol. */\n  const char get_text[] = \"GET /jerry-debugger\";\n  size_t text_len = sizeof (get_text) - 1;\n\n  if ((size_t) (request_end_p - request_buffer_p) < text_len || memcmp (request_buffer_p, get_text, text_len) != 0)\n  {\n    JERRYX_ERROR_MSG (\"Invalid handshake format.\\n\");\n    return false;\n  }\n\n  uint8_t *websocket_key_p = request_buffer_p + text_len;\n\n  const char key_text[] = \"Sec-WebSocket-Key:\";\n  text_len = sizeof (key_text) - 1;\n\n  while (true)\n  {\n    if ((size_t) (request_end_p - websocket_key_p) < text_len)\n    {\n      JERRYX_ERROR_MSG (\"Sec-WebSocket-Key not found.\\n\");\n      return false;\n    }\n\n    if (websocket_key_p[0] == 'S' && websocket_key_p[-1] == '\\n' && websocket_key_p[-2] == '\\r'\n        && memcmp (websocket_key_p, key_text, text_len) == 0)\n    {\n      websocket_key_p += text_len;\n      break;\n    }\n\n    websocket_key_p++;\n  }\n\n  /* String terminated by double newlines. */\n\n  while (*websocket_key_p == ' ')\n  {\n    websocket_key_p++;\n  }\n\n  uint8_t *websocket_key_end_p = websocket_key_p;\n\n  while (*websocket_key_end_p > ' ')\n  {\n    websocket_key_end_p++;\n  }\n\n  /* Since the request_buffer_p is not needed anymore it can\n   * be reused for storing the SHA-1 key and Base64 string. */\n\n  const size_t sha1_length = 20;\n\n  jerryx_debugger_compute_sha1 (websocket_key_p,\n                                (size_t) (websocket_key_end_p - websocket_key_p),\n                                (const uint8_t *) \"258EAFA5-E914-47DA-95CA-C5AB0DC85B11\",\n                                36,\n                                request_buffer_p);\n\n  /* The SHA-1 key is 20 bytes long but jerryx_to_base64 expects\n   * a length divisible by 3 so an extra 0 is appended at the end. */\n  request_buffer_p[sha1_length] = 0;\n\n  jerryx_to_base64 (request_buffer_p, request_buffer_p + sha1_length + 1, sha1_length + 1);\n\n  /* Last value must be replaced by equal sign. */\n\n  const uint8_t response_prefix[] =\n    \"HTTP/1.1 101 Switching Protocols\\r\\nUpgrade: websocket\\r\\nConnection: Upgrade\\r\\nSec-WebSocket-Accept: \";\n\n  if (!jerry_debugger_transport_send (response_prefix, sizeof (response_prefix) - 1)\n      || !jerry_debugger_transport_send (request_buffer_p + sha1_length + 1, 27))\n  {\n    return false;\n  }\n\n  const uint8_t response_suffix[] = \"=\\r\\n\\r\\n\";\n  return jerry_debugger_transport_send (response_suffix, sizeof (response_suffix) - 1);\n} /* jerryx_process_handshake */\n\n/**\n * Close a tcp connection.\n */\nstatic void\njerryx_debugger_ws_close (jerry_debugger_transport_header_t *header_p) /**< tcp implementation */\n{\n  JERRYX_ASSERT (!jerry_debugger_transport_is_connected ());\n\n  jerry_heap_free ((void *) header_p, sizeof (jerry_debugger_transport_header_t));\n} /* jerryx_debugger_ws_close */\n\n/**\n * Send data over a websocket connection.\n *\n * @return true - if the data has been sent successfully\n *         false - otherwise\n */\nstatic bool\njerryx_debugger_ws_send (jerry_debugger_transport_header_t *header_p, /**< tcp implementation */\n                         uint8_t *message_p, /**< message to be sent */\n                         size_t message_length) /**< message length in bytes */\n{\n  JERRYX_ASSERT (message_length <= JERRYX_DEBUGGER_WEBSOCKET_ONE_BYTE_LEN_MAX);\n\n  message_p[-2] = JERRYX_DEBUGGER_WEBSOCKET_FIN_BIT | JERRYX_DEBUGGER_WEBSOCKET_BINARY_FRAME;\n  message_p[-1] = (uint8_t) message_length;\n\n  return header_p->next_p->send (header_p->next_p, message_p - 2, message_length + 2);\n} /* jerryx_debugger_ws_send */\n\n/**\n * Receive data from a websocket connection.\n */\nstatic bool\njerryx_debugger_ws_receive (jerry_debugger_transport_header_t *header_p, /**< tcp implementation */\n                            jerry_debugger_transport_receive_context_t *receive_context_p) /**< receive context */\n{\n  if (!header_p->next_p->receive (header_p->next_p, receive_context_p))\n  {\n    return false;\n  }\n\n  if (receive_context_p->message_p == NULL)\n  {\n    return true;\n  }\n\n  size_t message_total_length = receive_context_p->message_total_length;\n\n  if (message_total_length == 0)\n  {\n    /* Byte stream. */\n    if (receive_context_p->message_length < sizeof (jerryx_websocket_receive_header_t))\n    {\n      receive_context_p->message_p = NULL;\n      return true;\n    }\n  }\n  else\n  {\n    /* Datagram packet. */\n    JERRYX_ASSERT (receive_context_p->message_length >= sizeof (jerryx_websocket_receive_header_t));\n  }\n\n  uint8_t *message_p = receive_context_p->message_p;\n\n  if ((message_p[0] & ~JERRYX_DEBUGGER_WEBSOCKET_OPCODE_MASK) != JERRYX_DEBUGGER_WEBSOCKET_FIN_BIT\n      || (message_p[1] & JERRYX_DEBUGGER_WEBSOCKET_LENGTH_MASK) > JERRYX_DEBUGGER_WEBSOCKET_ONE_BYTE_LEN_MAX\n      || !(message_p[1] & JERRYX_DEBUGGER_WEBSOCKET_MASK_BIT))\n  {\n    JERRYX_ERROR_MSG (\"Unsupported Websocket message.\\n\");\n    jerry_debugger_transport_close ();\n    return false;\n  }\n\n  if ((message_p[0] & JERRYX_DEBUGGER_WEBSOCKET_OPCODE_MASK) != JERRYX_DEBUGGER_WEBSOCKET_BINARY_FRAME)\n  {\n    JERRYX_ERROR_MSG (\"Unsupported Websocket opcode.\\n\");\n    jerry_debugger_transport_close ();\n    return false;\n  }\n\n  size_t message_length = (size_t) (message_p[1] & JERRYX_DEBUGGER_WEBSOCKET_LENGTH_MASK);\n\n  if (message_total_length == 0)\n  {\n    size_t new_total_length = message_length + sizeof (jerryx_websocket_receive_header_t);\n\n    /* Byte stream. */\n    if (receive_context_p->message_length < new_total_length)\n    {\n      receive_context_p->message_p = NULL;\n      return true;\n    }\n\n    receive_context_p->message_total_length = new_total_length;\n  }\n  else\n  {\n    /* Datagram packet. */\n    JERRYX_ASSERT (receive_context_p->message_length == (message_length + sizeof (jerryx_websocket_receive_header_t)));\n  }\n\n  message_p += sizeof (jerryx_websocket_receive_header_t);\n\n  receive_context_p->message_p = message_p;\n  receive_context_p->message_length = message_length;\n\n  /* Unmask data bytes. */\n  const uint8_t *mask_p = message_p - JERRYX_DEBUGGER_WEBSOCKET_MASK_SIZE;\n  const uint8_t *mask_end_p = message_p;\n  const uint8_t *message_end_p = message_p + message_length;\n\n  while (message_p < message_end_p)\n  {\n    /* Invert certain bits with xor operation. */\n    *message_p = *message_p ^ *mask_p;\n\n    message_p++;\n    mask_p++;\n\n    if (JERRY_UNLIKELY (mask_p >= mask_end_p))\n    {\n      mask_p -= JERRYX_DEBUGGER_WEBSOCKET_MASK_SIZE;\n    }\n  }\n\n  return true;\n} /* jerryx_debugger_ws_receive */\n\n/**\n * Initialize the websocket transportation layer.\n *\n * @return true - if the connection succeeded\n *         false - otherwise\n */\nbool\njerryx_debugger_ws_create (void)\n{\n  bool is_handshake_ok = false;\n\n  const jerry_size_t buffer_size = 1024;\n  uint8_t *request_buffer_p = (uint8_t *) jerry_heap_alloc (buffer_size);\n\n  if (!request_buffer_p)\n  {\n    return false;\n  }\n\n  is_handshake_ok = jerryx_process_handshake (request_buffer_p);\n\n  jerry_heap_free ((void *) request_buffer_p, buffer_size);\n\n  if (!is_handshake_ok && jerry_debugger_transport_is_connected ())\n  {\n    return false;\n  }\n\n  const jerry_size_t interface_size = sizeof (jerry_debugger_transport_header_t);\n  jerry_debugger_transport_header_t *header_p;\n  header_p = (jerry_debugger_transport_header_t *) jerry_heap_alloc (interface_size);\n\n  if (!header_p)\n  {\n    return false;\n  }\n\n  header_p->close = jerryx_debugger_ws_close;\n  header_p->send = jerryx_debugger_ws_send;\n  header_p->receive = jerryx_debugger_ws_receive;\n\n  jerry_debugger_transport_add (header_p,\n                                JERRYX_DEBUGGER_WEBSOCKET_HEADER_SIZE,\n                                JERRYX_DEBUGGER_WEBSOCKET_ONE_BYTE_LEN_MAX,\n                                JERRYX_DEBUGGER_WEBSOCKET_HEADER_SIZE + JERRYX_DEBUGGER_WEBSOCKET_MASK_SIZE,\n                                JERRYX_DEBUGGER_WEBSOCKET_ONE_BYTE_LEN_MAX);\n\n  return true;\n} /* jerryx_debugger_ws_create */\n\n#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) */\n\n/**\n * Dummy function when debugger is disabled.\n *\n * @return false\n */\nbool\njerryx_debugger_ws_create (void)\n{\n  return false;\n} /* jerryx_debugger_ws_create */\n\n#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */\n"
  },
  {
    "path": "jerry-ext/handle-scope/handle-scope-allocator.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdlib.h>\n\n#include \"handle-scope-internal.h\"\n#include \"jext-common.h\"\n\nstatic jerryx_handle_scope_t jerryx_handle_scope_root = {\n  .prelist_handle_count = 0,\n  .handle_ptr = NULL,\n};\nstatic jerryx_handle_scope_t *jerryx_handle_scope_current = &jerryx_handle_scope_root;\nstatic jerryx_handle_scope_pool_t jerryx_handle_scope_pool = {\n  .count = 0,\n  .start = NULL,\n};\n\n#define JERRYX_HANDLE_SCOPE_POOL_PRELIST_LAST jerryx_handle_scope_pool.prelist + JERRYX_SCOPE_PRELIST_SIZE - 1\n\n#define JERRYX_HANDLE_SCOPE_PRELIST_IDX(scope) (scope - jerryx_handle_scope_pool.prelist)\n\n/**\n * Get current handle scope top of stack.\n */\njerryx_handle_scope_t *\njerryx_handle_scope_get_current (void)\n{\n  return jerryx_handle_scope_current;\n} /* jerryx_handle_scope_get_current */\n\n/**\n * Get root handle scope.\n */\njerryx_handle_scope_t *\njerryx_handle_scope_get_root (void)\n{\n  return &jerryx_handle_scope_root;\n} /* jerryx_handle_scope_get_root */\n\n/**\n * Determines if given handle scope is located in pre-allocated list.\n *\n * @param scope - the one to be determined.\n */\nstatic bool\njerryx_handle_scope_is_in_prelist (jerryx_handle_scope_t *scope)\n{\n  return (jerryx_handle_scope_pool.prelist <= scope)\n         && (scope <= (jerryx_handle_scope_pool.prelist + JERRYX_SCOPE_PRELIST_SIZE - 1));\n} /* jerryx_handle_scope_is_in_prelist */\n\n/**\n * Get the parent of given handle scope.\n * If given handle scope is in prelist, the parent must be in prelist too;\n * if given is the first item of heap chain list, the parent must be the last one of prelist;\n * the parent must be in chain list otherwise.\n *\n * @param scope - the one to be permformed on.\n * @returns - the parent of the given scope.\n */\njerryx_handle_scope_t *\njerryx_handle_scope_get_parent (jerryx_handle_scope_t *scope)\n{\n  if (scope == &jerryx_handle_scope_root)\n  {\n    return NULL;\n  }\n  if (!jerryx_handle_scope_is_in_prelist (scope))\n  {\n    jerryx_handle_scope_dynamic_t *dy_scope = (jerryx_handle_scope_dynamic_t *) scope;\n    if (dy_scope == jerryx_handle_scope_pool.start)\n    {\n      return JERRYX_HANDLE_SCOPE_POOL_PRELIST_LAST;\n    }\n    jerryx_handle_scope_dynamic_t *parent = dy_scope->parent;\n    return (jerryx_handle_scope_t *) parent;\n  }\n  if (scope == jerryx_handle_scope_pool.prelist)\n  {\n    return &jerryx_handle_scope_root;\n  }\n  return jerryx_handle_scope_pool.prelist + JERRYX_HANDLE_SCOPE_PRELIST_IDX (scope) - 1;\n} /* jerryx_handle_scope_get_parent */\n\n/**\n * Get the child of given handle scope.\n * If the given handle scope is in heap chain list, its child must be in heap chain list too;\n * if the given handle scope is the last one of prelist, its child must be the first item of chain list;\n * the children are in prelist otherwise.\n *\n * @param scope - the one to be permformed on.\n * @returns the child of the given scope.\n */\njerryx_handle_scope_t *\njerryx_handle_scope_get_child (jerryx_handle_scope_t *scope)\n{\n  if (scope == &jerryx_handle_scope_root)\n  {\n    if (jerryx_handle_scope_pool.count > 0)\n    {\n      return jerryx_handle_scope_pool.prelist;\n    }\n    return NULL;\n  }\n  if (!jerryx_handle_scope_is_in_prelist (scope))\n  {\n    jerryx_handle_scope_dynamic_t *child = ((jerryx_handle_scope_dynamic_t *) scope)->child;\n    return (jerryx_handle_scope_t *) child;\n  }\n  if (scope == JERRYX_HANDLE_SCOPE_POOL_PRELIST_LAST)\n  {\n    return (jerryx_handle_scope_t *) jerryx_handle_scope_pool.start;\n  }\n  ptrdiff_t idx = JERRYX_HANDLE_SCOPE_PRELIST_IDX (scope);\n  if (idx < 0)\n  {\n    return NULL;\n  }\n  if ((unsigned long) idx >= jerryx_handle_scope_pool.count - 1)\n  {\n    return NULL;\n  }\n  return jerryx_handle_scope_pool.prelist + idx + 1;\n} /* jerryx_handle_scope_get_child */\n\n/**\n * Claims a handle scope either from prelist or allocating a new memory block,\n * and increment pool's scope count by 1, and set current scope to the newly claimed one.\n * If there are still available spaces in prelist, claims a block in prelist;\n * otherwise allocates a new memory block from heap and sets its fields to default values,\n * and link it to previously dynamically allocated scope, or link it to pool's start pointer.\n *\n * @returns the newly claimed handle scope pointer.\n */\njerryx_handle_scope_t *\njerryx_handle_scope_alloc (void)\n{\n  jerryx_handle_scope_t *scope;\n  if (jerryx_handle_scope_pool.count < JERRYX_SCOPE_PRELIST_SIZE)\n  {\n    scope = jerryx_handle_scope_pool.prelist + jerryx_handle_scope_pool.count;\n  }\n  else\n  {\n    jerryx_handle_scope_dynamic_t *dy_scope;\n    dy_scope = (jerryx_handle_scope_dynamic_t *) jerry_heap_alloc (sizeof (jerryx_handle_scope_dynamic_t));\n    JERRYX_ASSERT (dy_scope != NULL);\n    dy_scope->child = NULL;\n\n    if (jerryx_handle_scope_pool.count != JERRYX_SCOPE_PRELIST_SIZE)\n    {\n      jerryx_handle_scope_dynamic_t *dy_current = (jerryx_handle_scope_dynamic_t *) jerryx_handle_scope_current;\n      dy_scope->parent = dy_current;\n      dy_current->child = dy_scope;\n    }\n    else\n    {\n      jerryx_handle_scope_pool.start = dy_scope;\n      dy_scope->parent = NULL;\n    }\n\n    scope = (jerryx_handle_scope_t *) dy_scope;\n  }\n\n  scope->prelist_handle_count = 0;\n  scope->escaped = false;\n  scope->handle_ptr = NULL;\n\n  jerryx_handle_scope_current = scope;\n  ++jerryx_handle_scope_pool.count;\n  return (jerryx_handle_scope_t *) scope;\n} /* jerryx_handle_scope_alloc */\n\n/**\n * Deannounce a previously claimed handle scope, return it to pool\n * or free the allocated memory block.\n *\n * @param scope - the one to be freed.\n */\nvoid\njerryx_handle_scope_free (jerryx_handle_scope_t *scope)\n{\n  if (scope == &jerryx_handle_scope_root)\n  {\n    return;\n  }\n\n  --jerryx_handle_scope_pool.count;\n  if (scope == jerryx_handle_scope_current)\n  {\n    jerryx_handle_scope_current = jerryx_handle_scope_get_parent (scope);\n  }\n\n  if (!jerryx_handle_scope_is_in_prelist (scope))\n  {\n    jerryx_handle_scope_dynamic_t *dy_scope = (jerryx_handle_scope_dynamic_t *) scope;\n    if (dy_scope == jerryx_handle_scope_pool.start)\n    {\n      jerryx_handle_scope_pool.start = dy_scope->child;\n    }\n    else if (dy_scope->parent != NULL)\n    {\n      dy_scope->parent->child = dy_scope->child;\n    }\n    jerry_heap_free (dy_scope, sizeof (jerryx_handle_scope_dynamic_t));\n    return;\n  }\n  /**\n   * Nothing to do with scopes in prelist\n   */\n} /* jerryx_handle_scope_free */\n"
  },
  {
    "path": "jerry-ext/handle-scope/handle-scope-internal.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_HANDLE_SCOPE_INTERNAL_H\n#define JERRYX_HANDLE_SCOPE_INTERNAL_H\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/handle-scope.h\"\n\nJERRY_C_API_BEGIN\n\n/** MARK: - handle-scope-allocator.c */\ntypedef struct jerryx_handle_scope_pool_s jerryx_handle_scope_pool_t;\n/**\n * A linear allocating memory pool for type jerryx_handle_scope_t,\n * in which allocated item shall be released in reversed order of allocation\n */\nstruct jerryx_handle_scope_pool_s\n{\n  jerryx_handle_scope_t prelist[JERRYX_SCOPE_PRELIST_SIZE]; /**< inlined handle scopes in the pool */\n  size_t count; /**< number of handle scopes in the pool */\n  jerryx_handle_scope_dynamic_t *start; /**< start address of dynamically allocated handle scope list */\n};\n\njerryx_handle_scope_t *jerryx_handle_scope_get_parent (jerryx_handle_scope_t *scope);\n\njerryx_handle_scope_t *jerryx_handle_scope_get_child (jerryx_handle_scope_t *scope);\n\njerryx_handle_scope_t *jerryx_handle_scope_alloc (void);\n\nvoid jerryx_handle_scope_free (jerryx_handle_scope_t *scope);\n/** MARK: - END handle-scope-allocator.c */\n\n/** MARK: - handle-scope.c */\nvoid jerryx_handle_scope_release_handles (jerryx_handle_scope scope);\n\njerry_value_t jerryx_hand_scope_escape_handle_from_prelist (jerryx_handle_scope scope, size_t idx);\n\njerry_value_t jerryx_handle_scope_add_handle_to (jerryx_handle_t *handle, jerryx_handle_scope scope);\n\njerryx_handle_scope_status jerryx_escape_handle_internal (jerryx_escapable_handle_scope scope,\n                                                          jerry_value_t escapee,\n                                                          jerry_value_t *result,\n                                                          bool should_promote);\n/** MARK: - END handle-scope.c */\n\nJERRY_C_API_END\n\n#endif /* !JERRYX_HANDLE_SCOPE_INTERNAL_H */\n"
  },
  {
    "path": "jerry-ext/handle-scope/handle-scope.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdlib.h>\n\n#include \"handle-scope-internal.h\"\n#include \"jext-common.h\"\n\nJERRYX_STATIC_ASSERT (JERRYX_SCOPE_PRELIST_SIZE < 32, JERRYX_SCOPE_PRELIST_SIZE_MUST_BE_LESS_THAN_SIZE_OF_UINT8_T);\n\n/**\n * Opens a new handle scope and attach it to current global scope as a child scope.\n *\n * @param result - [out value] opened scope.\n * @return status code, jerryx_handle_scope_ok if success.\n */\njerryx_handle_scope_status\njerryx_open_handle_scope (jerryx_handle_scope *result)\n{\n  *result = jerryx_handle_scope_alloc ();\n  return jerryx_handle_scope_ok;\n} /* jerryx_open_handle_scope */\n\n/**\n * Release all jerry values attached to given scope\n *\n * @param scope - the scope of handles to be released.\n */\nvoid\njerryx_handle_scope_release_handles (jerryx_handle_scope scope)\n{\n  size_t prelist_handle_count = scope->prelist_handle_count;\n  if (prelist_handle_count == JERRYX_HANDLE_PRELIST_SIZE && scope->handle_ptr != NULL)\n  {\n    jerryx_handle_t *a_handle = scope->handle_ptr;\n    while (a_handle != NULL)\n    {\n      jerry_value_free (a_handle->jval);\n      jerryx_handle_t *sibling = a_handle->sibling;\n      jerry_heap_free (a_handle, sizeof (jerryx_handle_t));\n      a_handle = sibling;\n    }\n    scope->handle_ptr = NULL;\n    prelist_handle_count = JERRYX_HANDLE_PRELIST_SIZE;\n  }\n\n  for (size_t idx = 0; idx < prelist_handle_count; idx++)\n  {\n    jerry_value_free (scope->handle_prelist[idx]);\n  }\n  scope->prelist_handle_count = 0;\n} /* jerryx_handle_scope_release_handles */\n\n/**\n * Close the scope and its child scopes and release all jerry values that\n * resides in the scopes.\n * Scopes must be closed in the reverse order from which they were created.\n *\n * @param scope - the scope closed.\n * @return status code, jerryx_handle_scope_ok if success.\n */\njerryx_handle_scope_status\njerryx_close_handle_scope (jerryx_handle_scope scope)\n{\n  /**\n   * Release all handles related to given scope and its child scopes\n   */\n  jerryx_handle_scope a_scope = scope;\n  do\n  {\n    jerryx_handle_scope_release_handles (a_scope);\n    jerryx_handle_scope child = jerryx_handle_scope_get_child (a_scope);\n    jerryx_handle_scope_free (a_scope);\n    a_scope = child;\n  } while (a_scope != NULL);\n\n  return jerryx_handle_scope_ok;\n} /* jerryx_close_handle_scope */\n\n/**\n * Opens a new handle scope from which one object can be promoted to the outer scope\n * and attach it to current global scope as a child scope.\n *\n * @param result - [out value] opened escapable handle scope.\n * @return status code, jerryx_handle_scope_ok if success.\n */\njerryx_handle_scope_status\njerryx_open_escapable_handle_scope (jerryx_handle_scope *result)\n{\n  return jerryx_open_handle_scope (result);\n} /* jerryx_open_escapable_handle_scope */\n\n/**\n * Close the scope and its child scopes and release all jerry values that\n * resides in the scopes.\n * Scopes must be closed in the reverse order from which they were created.\n *\n * @param scope - the one to be closed.\n * @return status code, jerryx_handle_scope_ok if success.\n */\njerryx_handle_scope_status\njerryx_close_escapable_handle_scope (jerryx_handle_scope scope)\n{\n  return jerryx_close_handle_scope (scope);\n} /* jerryx_close_escapable_handle_scope */\n\n/**\n * Internal helper.\n * Escape a jerry value from the scope, yet did not promote it to outer scope.\n * An assertion of if parent exists shall be made before invoking this function.\n *\n * @param scope - scope of the handle added to.\n * @param idx - expected index of the handle in the scope's prelist.\n * @returns escaped jerry value id\n */\njerry_value_t\njerryx_hand_scope_escape_handle_from_prelist (jerryx_handle_scope scope, size_t idx)\n{\n  jerry_value_t jval = scope->handle_prelist[idx];\n  if (scope->prelist_handle_count == JERRYX_HANDLE_PRELIST_SIZE && scope->handle_ptr != NULL)\n  {\n    jerryx_handle_t *handle = scope->handle_ptr;\n    scope->handle_ptr = handle->sibling;\n    scope->handle_prelist[idx] = handle->jval;\n    jerry_heap_free (handle, sizeof (jerryx_handle_t));\n    return jval;\n  }\n\n  if (idx < JERRYX_HANDLE_PRELIST_SIZE - 1)\n  {\n    scope->handle_prelist[idx] = scope->handle_prelist[scope->prelist_handle_count - 1];\n  }\n  return jval;\n} /* jerryx_hand_scope_escape_handle_from_prelist */\n\n/**\n * Internal helper.\n * Escape a jerry value from the given escapable handle scope.\n *\n * @param scope - the expected scope to be escaped from.\n * @param escapee - the jerry value to be escaped.\n * @param result - [out value] escaped jerry value result.\n * @param should_promote - true if the escaped value should be added to parent\n *                         scope after escaped from the given handle scope.\n * @return status code, jerryx_handle_scope_ok if success.\n */\njerryx_handle_scope_status\njerryx_escape_handle_internal (jerryx_escapable_handle_scope scope,\n                               jerry_value_t escapee,\n                               jerry_value_t *result,\n                               bool should_promote)\n{\n  if (scope->escaped)\n  {\n    return jerryx_escape_called_twice;\n  }\n\n  jerryx_handle_scope parent = jerryx_handle_scope_get_parent (scope);\n  if (parent == NULL)\n  {\n    return jerryx_handle_scope_mismatch;\n  }\n\n  bool found = false;\n  {\n    size_t found_idx = 0;\n    size_t prelist_count = scope->prelist_handle_count;\n    /**\n     * Search prelist in a reversed order since last added handle\n     * is possible the one to be escaped\n     */\n    for (size_t idx_plus_1 = prelist_count; idx_plus_1 > 0; --idx_plus_1)\n    {\n      if (escapee == scope->handle_prelist[idx_plus_1 - 1])\n      {\n        found = true;\n        found_idx = idx_plus_1 - 1;\n        break;\n      }\n    }\n\n    if (found)\n    {\n      *result = jerryx_hand_scope_escape_handle_from_prelist (scope, found_idx);\n\n      --scope->prelist_handle_count;\n      if (should_promote)\n      {\n        scope->escaped = true;\n        /**\n         * Escape handle to parent scope\n         */\n        jerryx_create_handle_in_scope (*result, jerryx_handle_scope_get_parent (scope));\n      }\n      return jerryx_handle_scope_ok;\n    }\n  };\n\n  if (scope->prelist_handle_count <= JERRYX_HANDLE_PRELIST_SIZE && scope->handle_ptr == NULL)\n  {\n    return jerryx_handle_scope_mismatch;\n  }\n\n  /**\n   * Handle chain list is already in an reversed order,\n   * search through it as it is\n   */\n  jerryx_handle_t *handle = scope->handle_ptr;\n  jerryx_handle_t *memo_handle = NULL;\n  jerryx_handle_t *found_handle = NULL;\n  while (!found)\n  {\n    if (handle == NULL)\n    {\n      return jerryx_handle_scope_mismatch;\n    }\n    if (handle->jval != escapee)\n    {\n      memo_handle = handle;\n      handle = handle->sibling;\n      continue;\n    }\n    /**\n     * Remove found handle from current scope's handle chain\n     */\n    found = true;\n    found_handle = handle;\n    if (memo_handle == NULL)\n    {\n      // found handle is the first handle in heap\n      scope->handle_ptr = found_handle->sibling;\n    }\n    else\n    {\n      memo_handle->sibling = found_handle->sibling;\n    }\n  }\n\n  if (should_promote)\n  {\n    /**\n     * Escape handle to parent scope\n     */\n    *result = jerryx_handle_scope_add_handle_to (found_handle, parent);\n\n    scope->escaped = true;\n  }\n  return jerryx_handle_scope_ok;\n} /* jerryx_escape_handle_internal */\n\n/**\n * Promotes the handle to the JavaScript object so that it is valid for the lifetime of\n * the outer scope. It can only be called once per scope. If it is called more than\n * once an error will be returned.\n *\n * @param scope - the expected scope to be escaped from.\n * @param escapee - the jerry value to be escaped.\n * @param result - [out value] escaped jerry value result.\n * @return status code, jerryx_handle_scope_ok if success.\n */\njerryx_handle_scope_status\njerryx_escape_handle (jerryx_escapable_handle_scope scope, jerry_value_t escapee, jerry_value_t *result)\n{\n  return jerryx_escape_handle_internal (scope, escapee, result, true);\n} /* jerryx_escape_handle */\n\n/**\n * Escape a handle from scope yet do not promote it to the outer scope.\n * Leave the handle's life time management up to user.\n *\n * @param scope - the expected scope to be removed from.\n * @param escapee - the jerry value to be removed.\n * @param result - [out value] removed jerry value result.\n * @return status code, jerryx_handle_scope_ok if success.\n */\njerryx_handle_scope_status\njerryx_remove_handle (jerryx_escapable_handle_scope scope, jerry_value_t escapee, jerry_value_t *result)\n{\n  return jerryx_escape_handle_internal (scope, escapee, result, false);\n} /* jerryx_remove_handle */\n\n/**\n * Try to reuse given handle if possible while adding to the scope.\n *\n * @param handle - the one to be added to the scope.\n * @param scope - the scope of handle to be added to.\n * @returns the jerry value id wrapped by given handle.\n */\njerry_value_t\njerryx_handle_scope_add_handle_to (jerryx_handle_t *handle, jerryx_handle_scope scope)\n{\n  size_t prelist_handle_count = scope->prelist_handle_count;\n  if (prelist_handle_count < JERRYX_HANDLE_PRELIST_SIZE)\n  {\n    ++scope->prelist_handle_count;\n    jerry_value_t jval = handle->jval;\n    jerry_heap_free (handle, sizeof (jerryx_handle_t));\n    scope->handle_prelist[prelist_handle_count] = jval;\n    return jval;\n  }\n\n  handle->sibling = scope->handle_ptr;\n  scope->handle_ptr = handle;\n  return handle->jval;\n} /* jerryx_handle_scope_add_handle_to */\n\n/**\n * Add given jerry value to the scope.\n *\n * @param jval - jerry value to be added to scope.\n * @param scope - the scope of the jerry value been expected to be added to.\n * @return jerry value that added to scope.\n */\njerry_value_t\njerryx_create_handle_in_scope (jerry_value_t jval, jerryx_handle_scope scope)\n{\n  size_t prelist_handle_count = scope->prelist_handle_count;\n  if (prelist_handle_count < JERRYX_HANDLE_PRELIST_SIZE)\n  {\n    scope->handle_prelist[prelist_handle_count] = jval;\n\n    ++scope->prelist_handle_count;\n    return jval;\n  }\n  jerryx_handle_t *handle = (jerryx_handle_t *) jerry_heap_alloc (sizeof (jerryx_handle_t));\n  JERRYX_ASSERT (handle != NULL);\n  handle->jval = jval;\n\n  handle->sibling = scope->handle_ptr;\n  scope->handle_ptr = handle;\n\n  return jval;\n} /* jerryx_create_handle_in_scope */\n\n/**\n * Add given jerry value to current top scope.\n *\n * @param jval - jerry value to be added to scope.\n * @return jerry value that added to scope.\n */\njerry_value_t\njerryx_create_handle (jerry_value_t jval)\n{\n  return jerryx_create_handle_in_scope (jval, jerryx_handle_scope_get_current ());\n} /* jerryx_create_handle */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/arg.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_ARG_H\n#define JERRYX_ARG_H\n\n#include <stdbool.h>\n#include <stddef.h>\n#include <stdint.h>\n\n#include \"jerryscript.h\"\n\nJERRY_C_API_BEGIN\n\n/**\n * The forward declaration of jerryx_arg_t.\n */\ntypedef struct jerryx_arg_t jerryx_arg_t;\n\n/**\n * The forward declaration of jerryx_arg_js_iterator_t\n */\ntypedef struct jerryx_arg_js_iterator_t jerryx_arg_js_iterator_t;\n\n/**\n * Signature of the transform function.\n */\ntypedef jerry_value_t (*jerryx_arg_transform_func_t) (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                                                      const jerryx_arg_t *c_arg_p); /**< native arg */\n\n/**\n * The structure used in jerryx_arg_object_properties\n */\ntypedef struct\n{\n  const jerry_char_t **name_p; /**< property name list of the JS object */\n  jerry_length_t name_cnt; /**< count of the name list */\n  const jerryx_arg_t *c_arg_p; /**< points to the array of transformation steps */\n  jerry_length_t c_arg_cnt; /**< the count of the `c_arg_p` array */\n} jerryx_arg_object_props_t;\n\n/**\n * The structure used in jerryx_arg_array\n */\ntypedef struct\n{\n  const jerryx_arg_t *c_arg_p; /**< points to the array of transformation steps */\n  jerry_length_t c_arg_cnt; /**< the count of the `c_arg_p` array */\n} jerryx_arg_array_items_t;\n\n/**\n * The structure defining a single validation & transformation step.\n */\nstruct jerryx_arg_t\n{\n  jerryx_arg_transform_func_t func; /**< the transform function */\n  void *dest; /**< pointer to destination where func should store the result */\n  uintptr_t extra_info; /**< extra information, specific to func */\n};\n\njerry_value_t jerryx_arg_transform_this_and_args (const jerry_value_t this_val,\n                                                  const jerry_value_t *js_arg_p,\n                                                  const jerry_length_t js_arg_cnt,\n                                                  const jerryx_arg_t *c_arg_p,\n                                                  jerry_length_t c_arg_cnt);\n\njerry_value_t jerryx_arg_transform_args (const jerry_value_t *js_arg_p,\n                                         const jerry_length_t js_arg_cnt,\n                                         const jerryx_arg_t *c_arg_p,\n                                         jerry_length_t c_arg_cnt);\n\njerry_value_t jerryx_arg_transform_object_properties (const jerry_value_t obj_val,\n                                                      const jerry_char_t **name_p,\n                                                      const jerry_length_t name_cnt,\n                                                      const jerryx_arg_t *c_arg_p,\n                                                      jerry_length_t c_arg_cnt);\njerry_value_t\njerryx_arg_transform_array (const jerry_value_t array_val, const jerryx_arg_t *c_arg_p, jerry_length_t c_arg_cnt);\n\n/**\n * Indicates whether an argument is allowed to be coerced into the expected JS type.\n */\ntypedef enum\n{\n  JERRYX_ARG_COERCE, /**< the transform inside will invoke toNumber, toBoolean or toString */\n  JERRYX_ARG_NO_COERCE /**< the type coercion is not allowed. */\n} jerryx_arg_coerce_t;\n\n/**\n * Indicates whether an argument is optional or required.\n */\ntypedef enum\n{\n  /**\n   * The argument is optional. If the argument is `undefined` the transform is\n   * successful and `c_arg_p->dest` remains untouched.\n   */\n  JERRYX_ARG_OPTIONAL,\n  /**\n   * The argument is required. If the argument is `undefined` the transform\n   * will fail and `c_arg_p->dest` remains untouched.\n   */\n  JERRYX_ARG_REQUIRED\n} jerryx_arg_optional_t;\n\n/**\n * Indicates the rounding policy which will be chosen to transform an integer.\n */\ntypedef enum\n{\n  JERRYX_ARG_ROUND, /**< round */\n  JERRYX_ARG_FLOOR, /**< floor */\n  JERRYX_ARG_CEIL /**< ceil */\n} jerryx_arg_round_t;\n\n/**\n * Indicates the clamping policy which will be chosen to transform an integer.\n * If the policy is NO_CLAMP, and the number is out of range,\n * then the transformer will throw a range error.\n */\ntypedef enum\n{\n  JERRYX_ARG_CLAMP, /**< clamp the number when it is out of range */\n  JERRYX_ARG_NO_CLAMP /**< throw a range error */\n} jerryx_arg_clamp_t;\n\n/* Inline functions for initializing jerryx_arg_t */\n\n#define JERRYX_ARG_INTEGER(type)                                                 \\\n  static inline jerryx_arg_t jerryx_arg_##type (type##_t *dest,                  \\\n                                                jerryx_arg_round_t round_flag,   \\\n                                                jerryx_arg_clamp_t clamp_flag,   \\\n                                                jerryx_arg_coerce_t coerce_flag, \\\n                                                jerryx_arg_optional_t opt_flag);\n\nJERRYX_ARG_INTEGER (uint8)\nJERRYX_ARG_INTEGER (int8)\nJERRYX_ARG_INTEGER (uint16)\nJERRYX_ARG_INTEGER (int16)\nJERRYX_ARG_INTEGER (uint32)\nJERRYX_ARG_INTEGER (int32)\n\n#undef JERRYX_ARG_INTEGER\n\nstatic inline jerryx_arg_t\njerryx_arg_number (double *dest, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag);\nstatic inline jerryx_arg_t\njerryx_arg_boolean (bool *dest, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag);\nstatic inline jerryx_arg_t\njerryx_arg_string (char *dest, uint32_t size, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag);\nstatic inline jerryx_arg_t\njerryx_arg_utf8_string (char *dest, uint32_t size, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag);\nstatic inline jerryx_arg_t jerryx_arg_function (jerry_value_t *dest, jerryx_arg_optional_t opt_flag);\nstatic inline jerryx_arg_t\njerryx_arg_native_pointer (void **dest, const jerry_object_native_info_t *info_p, jerryx_arg_optional_t opt_flag);\nstatic inline jerryx_arg_t jerryx_arg_ignore (void);\nstatic inline jerryx_arg_t jerryx_arg_custom (void *dest, uintptr_t extra_info, jerryx_arg_transform_func_t func);\nstatic inline jerryx_arg_t jerryx_arg_object_properties (const jerryx_arg_object_props_t *obj_prop_p,\n                                                         jerryx_arg_optional_t opt_flag);\nstatic inline jerryx_arg_t jerryx_arg_array (const jerryx_arg_array_items_t *array_items_p,\n                                             jerryx_arg_optional_t opt_flag);\n\njerry_value_t jerryx_arg_transform_optional (jerryx_arg_js_iterator_t *js_arg_iter_p,\n                                             const jerryx_arg_t *c_arg_p,\n                                             jerryx_arg_transform_func_t func);\n\n/* Helper functions for transform functions. */\njerry_value_t jerryx_arg_js_iterator_pop (jerryx_arg_js_iterator_t *js_arg_iter_p);\njerry_value_t jerryx_arg_js_iterator_restore (jerryx_arg_js_iterator_t *js_arg_iter_p);\njerry_value_t jerryx_arg_js_iterator_peek (jerryx_arg_js_iterator_t *js_arg_iter_p);\njerry_length_t jerryx_arg_js_iterator_index (jerryx_arg_js_iterator_t *js_arg_iter_p);\n\n#include \"arg.impl.h\"\n\nJERRY_C_API_END\n\n#endif /* !JERRYX_ARG_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/arg.impl.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_ARG_IMPL_H\n#define JERRYX_ARG_IMPL_H\n\n/* transform functions for each type. */\n\n#define JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL(type)                                                               \\\n  jerry_value_t jerryx_arg_transform_##type (jerryx_arg_js_iterator_t *js_arg_iter_p, const jerryx_arg_t *c_arg_p); \\\n  jerry_value_t jerryx_arg_transform_##type##_optional (jerryx_arg_js_iterator_t *js_arg_iter_p,                    \\\n                                                        const jerryx_arg_t *c_arg_p);\n\n#define JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT(type) \\\n  JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (type)                 \\\n  JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (type##_strict)\n\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (uint8)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (int8)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (uint16)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (int16)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (uint32)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (int32)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (number)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (string)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (utf8_string)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (boolean)\n\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (function)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (native_pointer)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (object_props)\nJERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (array_items)\n\njerry_value_t jerryx_arg_transform_ignore (jerryx_arg_js_iterator_t *js_arg_iter_p, const jerryx_arg_t *c_arg_p);\n\n#undef JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL\n#undef JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT\n\n/**\n * The structure indicates the options used to transform integer argument.\n * It will be passed into jerryx_arg_t's  extra_info field.\n */\ntypedef struct\n{\n  uint8_t round; /**< rounding policy */\n  uint8_t clamp; /**< clamping policy */\n} jerryx_arg_int_option_t;\n\n/**\n * The macro used to generate jerryx_arg_xxx for int type.\n */\n#define JERRYX_ARG_INT(type)                                                                  \\\n  static inline jerryx_arg_t jerryx_arg_##type (type##_t *dest,                               \\\n                                                jerryx_arg_round_t round_flag,                \\\n                                                jerryx_arg_clamp_t clamp_flag,                \\\n                                                jerryx_arg_coerce_t coerce_flag,              \\\n                                                jerryx_arg_optional_t opt_flag)               \\\n  {                                                                                           \\\n    jerryx_arg_transform_func_t func;                                                         \\\n    if (coerce_flag == JERRYX_ARG_NO_COERCE)                                                  \\\n    {                                                                                         \\\n      if (opt_flag == JERRYX_ARG_OPTIONAL)                                                    \\\n      {                                                                                       \\\n        func = jerryx_arg_transform_##type##_strict_optional;                                 \\\n      }                                                                                       \\\n      else                                                                                    \\\n      {                                                                                       \\\n        func = jerryx_arg_transform_##type##_strict;                                          \\\n      }                                                                                       \\\n    }                                                                                         \\\n    else                                                                                      \\\n    {                                                                                         \\\n      if (opt_flag == JERRYX_ARG_OPTIONAL)                                                    \\\n      {                                                                                       \\\n        func = jerryx_arg_transform_##type##_optional;                                        \\\n      }                                                                                       \\\n      else                                                                                    \\\n      {                                                                                       \\\n        func = jerryx_arg_transform_##type;                                                   \\\n      }                                                                                       \\\n    }                                                                                         \\\n    union                                                                                     \\\n    {                                                                                         \\\n      jerryx_arg_int_option_t int_option;                                                     \\\n      uintptr_t extra_info;                                                                   \\\n    } u = { .int_option = { .round = (uint8_t) round_flag, .clamp = (uint8_t) clamp_flag } }; \\\n    return (jerryx_arg_t){ .func = func, .dest = (void *) dest, .extra_info = u.extra_info }; \\\n  }\n\nJERRYX_ARG_INT (uint8)\nJERRYX_ARG_INT (int8)\nJERRYX_ARG_INT (uint16)\nJERRYX_ARG_INT (int16)\nJERRYX_ARG_INT (uint32)\nJERRYX_ARG_INT (int32)\n\n#undef JERRYX_ARG_INT\n\n/**\n * Create a validation/transformation step (`jerryx_arg_t`) that expects to\n * consume one `number` JS argument and stores it into a C `double`.\n *\n * @return a jerryx_arg_t instance.\n */\nstatic inline jerryx_arg_t\njerryx_arg_number (double *dest, /**< pointer to the double where the result should be stored */\n                   jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */\n                   jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */\n{\n  jerryx_arg_transform_func_t func;\n\n  if (coerce_flag == JERRYX_ARG_NO_COERCE)\n  {\n    if (opt_flag == JERRYX_ARG_OPTIONAL)\n    {\n      func = jerryx_arg_transform_number_strict_optional;\n    }\n    else\n    {\n      func = jerryx_arg_transform_number_strict;\n    }\n  }\n  else\n  {\n    if (opt_flag == JERRYX_ARG_OPTIONAL)\n    {\n      func = jerryx_arg_transform_number_optional;\n    }\n    else\n    {\n      func = jerryx_arg_transform_number;\n    }\n  }\n\n  return (jerryx_arg_t){ .func = func, .dest = (void *) dest };\n} /* jerryx_arg_number */\n\n/**\n * Create a validation/transformation step (`jerryx_arg_t`) that expects to\n * consume one `boolean` JS argument and stores it into a C `bool`.\n *\n * @return a jerryx_arg_t instance.\n */\nstatic inline jerryx_arg_t\njerryx_arg_boolean (bool *dest, /**< points to the native bool */\n                    jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */\n                    jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */\n{\n  jerryx_arg_transform_func_t func;\n\n  if (coerce_flag == JERRYX_ARG_NO_COERCE)\n  {\n    if (opt_flag == JERRYX_ARG_OPTIONAL)\n    {\n      func = jerryx_arg_transform_boolean_strict_optional;\n    }\n    else\n    {\n      func = jerryx_arg_transform_boolean_strict;\n    }\n  }\n  else\n  {\n    if (opt_flag == JERRYX_ARG_OPTIONAL)\n    {\n      func = jerryx_arg_transform_boolean_optional;\n    }\n    else\n    {\n      func = jerryx_arg_transform_boolean;\n    }\n  }\n\n  return (jerryx_arg_t){ .func = func, .dest = (void *) dest };\n} /* jerryx_arg_boolean */\n\n/**\n * Create a validation/transformation step (`jerryx_arg_t`) that expects to\n * consume one `string` JS argument and stores it into a C `char` array.\n *\n * @return a jerryx_arg_t instance.\n */\nstatic inline jerryx_arg_t\njerryx_arg_string (char *dest, /**< pointer to the native char array where the result should be stored */\n                   uint32_t size, /**< the size of native char array */\n                   jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */\n                   jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */\n{\n  jerryx_arg_transform_func_t func;\n\n  if (coerce_flag == JERRYX_ARG_NO_COERCE)\n  {\n    if (opt_flag == JERRYX_ARG_OPTIONAL)\n    {\n      func = jerryx_arg_transform_string_strict_optional;\n    }\n    else\n    {\n      func = jerryx_arg_transform_string_strict;\n    }\n  }\n  else\n  {\n    if (opt_flag == JERRYX_ARG_OPTIONAL)\n    {\n      func = jerryx_arg_transform_string_optional;\n    }\n    else\n    {\n      func = jerryx_arg_transform_string;\n    }\n  }\n\n  return (jerryx_arg_t){ .func = func, .dest = (void *) dest, .extra_info = (uintptr_t) size };\n} /* jerryx_arg_string */\n\n/**\n * Create a validation/transformation step (`jerryx_arg_t`) that expects to\n * consume one `string` JS argument and stores it into a C utf8 `char` array.\n *\n * @return a jerryx_arg_t instance.\n */\nstatic inline jerryx_arg_t\njerryx_arg_utf8_string (char *dest, /**< [out] pointer to the native char array where the result should be stored */\n                        uint32_t size, /**< the size of native char array */\n                        jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */\n                        jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */\n{\n  jerryx_arg_transform_func_t func;\n\n  if (coerce_flag == JERRYX_ARG_NO_COERCE)\n  {\n    if (opt_flag == JERRYX_ARG_OPTIONAL)\n    {\n      func = jerryx_arg_transform_utf8_string_strict_optional;\n    }\n    else\n    {\n      func = jerryx_arg_transform_utf8_string_strict;\n    }\n  }\n  else\n  {\n    if (opt_flag == JERRYX_ARG_OPTIONAL)\n    {\n      func = jerryx_arg_transform_utf8_string_optional;\n    }\n    else\n    {\n      func = jerryx_arg_transform_utf8_string;\n    }\n  }\n\n  return (jerryx_arg_t){ .func = func, .dest = (void *) dest, .extra_info = (uintptr_t) size };\n} /* jerryx_arg_utf8_string */\n\n/**\n * Create a validation/transformation step (`jerryx_arg_t`) that expects to\n * consume one `function` JS argument and stores it into a C `jerry_value_t`.\n *\n * @return a jerryx_arg_t instance.\n */\nstatic inline jerryx_arg_t\njerryx_arg_function (jerry_value_t *dest, /**< pointer to the jerry_value_t where the result should be stored */\n                     jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */\n{\n  jerryx_arg_transform_func_t func;\n\n  if (opt_flag == JERRYX_ARG_OPTIONAL)\n  {\n    func = jerryx_arg_transform_function_optional;\n  }\n  else\n  {\n    func = jerryx_arg_transform_function;\n  }\n\n  return (jerryx_arg_t){ .func = func, .dest = (void *) dest };\n} /* jerryx_arg_function */\n\n/**\n * Create a validation/transformation step (`jerryx_arg_t`) that expects to\n * consume one `object` JS argument that is 'backed' with a native pointer with\n * a given type info. In case the native pointer info matches, the transform\n * will succeed and the object's native pointer will be assigned to *dest.\n *\n * @return a jerryx_arg_t instance.\n */\nstatic inline jerryx_arg_t\njerryx_arg_native_pointer (void **dest, /**< pointer to where the resulting native pointer should be stored */\n                           const jerry_object_native_info_t *info_p, /**< expected the type info */\n                           jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */\n{\n  jerryx_arg_transform_func_t func;\n\n  if (opt_flag == JERRYX_ARG_OPTIONAL)\n  {\n    func = jerryx_arg_transform_native_pointer_optional;\n  }\n  else\n  {\n    func = jerryx_arg_transform_native_pointer;\n  }\n\n  return (jerryx_arg_t){ .func = func, .dest = (void *) dest, .extra_info = (uintptr_t) info_p };\n} /* jerryx_arg_native_pointer */\n\n/**\n * Create a jerryx_arg_t instance for ignored argument.\n *\n * @return a jerryx_arg_t instance.\n */\nstatic inline jerryx_arg_t\njerryx_arg_ignore (void)\n{\n  return (jerryx_arg_t){ .func = jerryx_arg_transform_ignore };\n} /* jerryx_arg_ignore */\n\n/**\n * Create a jerryx_arg_t instance with custom transform.\n *\n * @return a jerryx_arg_t instance.\n */\nstatic inline jerryx_arg_t\njerryx_arg_custom (void *dest, /**< pointer to the native argument where the result should be stored */\n                   uintptr_t extra_info, /**< the extra parameter, specific to the transform function */\n                   jerryx_arg_transform_func_t func) /**< the custom transform function */\n{\n  return (jerryx_arg_t){ .func = func, .dest = dest, .extra_info = extra_info };\n} /* jerryx_arg_custom */\n\n/**\n * Create a jerryx_arg_t instance for object properties.\n *\n * @return a jerryx_arg_t instance.\n */\nstatic inline jerryx_arg_t\njerryx_arg_object_properties (const jerryx_arg_object_props_t *obj_prop_p, /**< pointer to object property mapping */\n                              jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */\n{\n  jerryx_arg_transform_func_t func;\n\n  if (opt_flag == JERRYX_ARG_OPTIONAL)\n  {\n    func = jerryx_arg_transform_object_props_optional;\n  }\n  else\n  {\n    func = jerryx_arg_transform_object_props;\n  }\n\n  return (jerryx_arg_t){ .func = func, .dest = NULL, .extra_info = (uintptr_t) obj_prop_p };\n} /* jerryx_arg_object_properties */\n\n/**\n * Create a jerryx_arg_t instance for array.\n *\n * @return a jerryx_arg_t instance.\n */\nstatic inline jerryx_arg_t\njerryx_arg_array (const jerryx_arg_array_items_t *array_items_p, /**< pointer to array items mapping */\n                  jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */\n{\n  jerryx_arg_transform_func_t func;\n\n  if (opt_flag == JERRYX_ARG_OPTIONAL)\n  {\n    func = jerryx_arg_transform_array_items_optional;\n  }\n  else\n  {\n    func = jerryx_arg_transform_array_items;\n  }\n\n  return (jerryx_arg_t){ .func = func, .dest = NULL, .extra_info = (uintptr_t) array_items_p };\n} /* jerryx_arg_array */\n\n#endif /* !JERRYX_ARG_IMPL_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/autorelease.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_AUTORELEASE_H\n#define JERRYX_AUTORELEASE_H\n\nJERRY_C_API_BEGIN\n\n#include \"autorelease.impl.h\"\n\n/*\n * Macro for `const jerry_value_t` for which jerry_value_free () is\n * automatically called when the variable goes out of scope.\n *\n * Example usage:\n * static void foo (bool enable)\n * {\n *   JERRYX_AR_VALUE_T bar = jerry_string (...);\n *\n *   if (enable) {\n *     JERRYX_AR_VALUE_T baz = jerry_current_realm ();\n *\n *     // ...\n *\n *     // jerry_value_free (baz) and jerry_value_free (bar) is called automatically before\n *     // returning, because `baz` and `bar` go out of scope.\n *     return;\n *   }\n *\n *   // jerry_value_free (bar) is called automatically when the function returns,\n *   // because `bar` goes out of scope.\n * }\n */\n#define JERRYX_AR_VALUE_T __JERRYX_AR_VALUE_T_IMPL\n\nJERRY_C_API_END\n\n#endif /* !JERRYX_AUTORELEASE_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/autorelease.impl.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_AUTORELEASE_IMPL_H\n#define JERRYX_AUTORELEASE_IMPL_H\n\n#include \"jerryscript.h\"\n\n#ifdef __GNUC__\n/*\n * Calls jerry_value_free (*value).\n * The GCC __cleanup__ function must take a pointer to the variable to clean up.\n */\nstatic inline void\njerryx_autorelease_cleanup (const jerry_value_t *value) /**< jerry value */\n{\n  jerry_value_free (*value);\n} /* jerryx_autorelease_cleanup */\n\n#define __JERRYX_AR_VALUE_T_IMPL const jerry_value_t __attribute__ ((__cleanup__ (jerryx_autorelease_cleanup)))\n#else /* !__GNUC__ */\n/* TODO: for other compilers */\n#error \"No autorelease implementation for your compiler!\"\n#endif /* __GNUC__ */\n\n#endif /* !JERRYX_AUTORELEASE_IMPL_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/debugger.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_DEBUGGER_H\n#define JERRYX_DEBUGGER_H\n\n#include \"jerryscript-debugger-transport.h\"\n#include \"jerryscript.h\"\n\nJERRY_C_API_BEGIN\n\nvoid jerryx_debugger_after_connect (bool success);\n\n/*\n * Message transmission interfaces.\n */\nbool jerryx_debugger_tcp_create (uint16_t port);\nbool jerryx_debugger_serial_create (const char *config);\n\n/*\n * Message encoding interfaces.\n */\nbool jerryx_debugger_ws_create (void);\nbool jerryx_debugger_rp_create (void);\n\nbool jerryx_debugger_is_reset (jerry_value_t value);\n\nJERRY_C_API_END\n\n#endif /* !JERRYX_HANDLER_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/handle-scope.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_HANDLE_SCOPE_H\n#define JERRYX_HANDLE_SCOPE_H\n\n#include \"jerryscript.h\"\n\nJERRY_C_API_BEGIN\n\n#ifndef JERRYX_HANDLE_PRELIST_SIZE\n#define JERRYX_HANDLE_PRELIST_SIZE 20\n#endif /* !defined(JERRYX_HANDLE_PRELIST_SIZE) */\n\n#ifndef JERRYX_SCOPE_PRELIST_SIZE\n#define JERRYX_SCOPE_PRELIST_SIZE 20\n#endif /* !defined(JERRYX_SCOPE_PRELIST_SIZE) */\n\ntypedef struct jerryx_handle_t jerryx_handle_t;\n/**\n * Dynamically allocated handle in the scopes.\n * Scopes has it's own size-limited linear storage of handles. Still there\n * might be not enough space left for new handles, dynamically allocated\n * `jerryx_handle_t` could ease the pre-allocated linear memory burden.\n */\nstruct jerryx_handle_t\n{\n  jerry_value_t jval; /**< jerry value of the handle bound to */\n  jerryx_handle_t *sibling; /**< next sibling the the handle */\n};\n\n#define JERRYX_HANDLE_SCOPE_FIELDS                          \\\n  jerry_value_t handle_prelist[JERRYX_HANDLE_PRELIST_SIZE]; \\\n  uint8_t prelist_handle_count;                             \\\n  bool escaped;                                             \\\n  jerryx_handle_t *handle_ptr\n\ntypedef struct jerryx_handle_scope_s jerryx_handle_scope_t;\ntypedef jerryx_handle_scope_t *jerryx_handle_scope;\ntypedef jerryx_handle_scope_t *jerryx_escapable_handle_scope;\n/**\n * Inlined simple handle scope type.\n */\nstruct jerryx_handle_scope_s\n{\n  JERRYX_HANDLE_SCOPE_FIELDS; /**< common handle scope fields */\n};\n\ntypedef struct jerryx_handle_scope_dynamic_s jerryx_handle_scope_dynamic_t;\n/**\n * Dynamically allocated handle scope type.\n */\nstruct jerryx_handle_scope_dynamic_s\n{\n  JERRYX_HANDLE_SCOPE_FIELDS; /**< common handle scope fields */\n  jerryx_handle_scope_dynamic_t *child; /**< child dynamically allocated handle scope */\n  jerryx_handle_scope_dynamic_t *parent; /**< parent dynamically allocated handle scope */\n};\n\n#undef JERRYX_HANDLE_SCOPE_FIELDS\n\ntypedef enum\n{\n  jerryx_handle_scope_ok = 0,\n\n  jerryx_escape_called_twice,\n  jerryx_handle_scope_mismatch,\n} jerryx_handle_scope_status;\n\njerryx_handle_scope_status jerryx_open_handle_scope (jerryx_handle_scope *result);\n\njerryx_handle_scope_status jerryx_close_handle_scope (jerryx_handle_scope scope);\n\njerryx_handle_scope_status jerryx_open_escapable_handle_scope (jerryx_handle_scope *result);\n\njerryx_handle_scope_status jerryx_close_escapable_handle_scope (jerryx_handle_scope scope);\n\njerryx_handle_scope_status\njerryx_escape_handle (jerryx_escapable_handle_scope scope, jerry_value_t escapee, jerry_value_t *result);\n\n/**\n * Completely escape a handle from handle scope,\n * leave life time management totally up to user.\n */\njerryx_handle_scope_status\njerryx_remove_handle (jerryx_escapable_handle_scope scope, jerry_value_t escapee, jerry_value_t *result);\n\njerry_value_t jerryx_create_handle (jerry_value_t jval);\n\njerry_value_t jerryx_create_handle_in_scope (jerry_value_t jval, jerryx_handle_scope scope);\n\n/** MARK: - handle-scope-allocator.c */\njerryx_handle_scope_t *jerryx_handle_scope_get_current (void);\n\njerryx_handle_scope_t *jerryx_handle_scope_get_root (void);\n/** MARK: - END handle-scope-allocator.c */\n\nJERRY_C_API_END\n\n#endif /* !JERRYX_HANDLE_SCOPE_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/handlers.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_HANDLERS_H\n#define JERRYX_HANDLERS_H\n\n#include \"jerryscript-types.h\"\n\nJERRY_C_API_BEGIN\n\njerry_value_t jerryx_handler_assert (const jerry_call_info_t *call_info_p,\n                                     const jerry_value_t args_p[],\n                                     const jerry_length_t args_cnt);\njerry_value_t\njerryx_handler_gc (const jerry_call_info_t *call_info_p, const jerry_value_t args_p[], const jerry_length_t args_cnt);\njerry_value_t jerryx_handler_print (const jerry_call_info_t *call_info_p,\n                                    const jerry_value_t args_p[],\n                                    const jerry_length_t args_cnt);\njerry_value_t jerryx_handler_source_name (const jerry_call_info_t *call_info_p,\n                                          const jerry_value_t args_p[],\n                                          const jerry_length_t args_cnt);\njerry_value_t jerryx_handler_create_realm (const jerry_call_info_t *call_info_p,\n                                           const jerry_value_t args_p[],\n                                           const jerry_length_t args_cnt);\nvoid jerryx_handler_promise_reject (jerry_promise_event_type_t event_type,\n                                    const jerry_value_t object,\n                                    const jerry_value_t value,\n                                    void *user_p);\njerry_value_t jerryx_handler_source_received (const jerry_char_t *source_name_p,\n                                              size_t source_name_size,\n                                              const jerry_char_t *source_p,\n                                              size_t source_size,\n                                              void *user_p);\nJERRY_C_API_END\n\n#endif /* !JERRYX_HANDLERS_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/module.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_MODULE_H\n#define JERRYX_MODULE_H\n\n#include \"jerryscript.h\"\n\nJERRY_C_API_BEGIN\n\n/**\n * Declare the signature for the module initialization function.\n */\ntypedef jerry_value_t (*jerryx_native_module_on_resolve_t) (void);\n\n/**\n * Declare the structure used to define a module. One should only make use of this structure via the\n * JERRYX_NATIVE_MODULE macro declared below.\n */\ntypedef struct jerryx_native_module_t\n{\n  const jerry_char_t *name_p; /**< name of the module */\n  const jerryx_native_module_on_resolve_t on_resolve_p; /**< function that returns a new instance of the module */\n  struct jerryx_native_module_t *next_p; /**< pointer to next module in the list */\n} jerryx_native_module_t;\n\n/**\n * Declare the constructor and destructor attributes. These evaluate to nothing if this extension is built without\n * library constructor/destructor support.\n */\n#ifdef ENABLE_INIT_FINI\n#ifdef _MSC_VER\n/**\n * Only Visual Studio 2008 and upper version support for __pragma keyword\n * refer to https://msdn.microsoft.com/en-us/library/d9x1s805(v=vs.90).aspx\n */\n#if _MSC_VER >= 1500\n#ifdef _WIN64\n#define JERRYX_MSVC_INCLUDE_SYM(s) comment (linker, \"/include:\" #s)\n#else /* !_WIN64 */\n#define JERRYX_MSVC_INCLUDE_SYM(s) comment (linker, \"/include:_\" #s)\n#endif /* _WIN64 */\n\n#ifdef __cplusplus\n#define JERRYX_MSCV_EXTERN_C extern \"C\"\n#else /* !__cplusplus */\n#define JERRYX_MSCV_EXTERN_C\n#endif /* __cplusplus */\n\n#pragma section(\".CRT$XCU\", read)\n#pragma section(\".CRT$XTU\", read)\n\n#define JERRYX_MSVC_FUNCTION_ON_SECTION(sec_name, f)                                \\\n  static void f (void);                                                             \\\n  __pragma (JERRYX_MSVC_INCLUDE_SYM (f##_section)) __declspec (allocate (sec_name)) \\\n    JERRYX_MSCV_EXTERN_C void (*f##_section) (void) = f;                            \\\n  static void f (void)\n\n#define JERRYX_MODULE_CONSTRUCTOR(f) JERRYX_MSVC_FUNCTION_ON_SECTION (\".CRT$XCU\", f)\n#define JERRYX_MODULE_DESTRUCTOR(f)  JERRYX_MSVC_FUNCTION_ON_SECTION (\".CRT$XTU\", f)\n#else /* !(_MSC_VER >= 1500) */\n#error \"Only Visual Studio 2008 and upper version are supported.\"\n#endif /* _MSC_VER >= 1500 */\n#elif defined(__GNUC__)\n#define JERRYX_MODULE_CONSTRUCTOR(f)                  \\\n  static void f (void) __attribute__ ((constructor)); \\\n  static void f (void)\n\n#define JERRYX_MODULE_DESTRUCTOR(f)                  \\\n  static void f (void) __attribute__ ((destructor)); \\\n  static void f (void)\n#else /* __GNUC__ */\n#error \"`FEATURE_INIT_FINI` build flag isn't supported on this compiler\"\n#endif /* _MSC_VER */\n#else /* !ENABLE_INIT_FINI */\n#define JERRYX_MODULE_CONSTRUCTOR(f) \\\n  void f (void);                     \\\n  void f (void)\n\n#define JERRYX_MODULE_DESTRUCTOR(f) \\\n  void f (void);                    \\\n  void f (void)\n#endif /* ENABLE_INIT_FINI */\n\n/**\n * Having two levels of macros allows strings to be used unquoted.\n */\n#define JERRYX_NATIVE_MODULE(module_name, on_resolve_cb) JERRYX_NATIVE_MODULE_IMPLEM (module_name, on_resolve_cb)\n\n#define JERRYX_NATIVE_MODULE_IMPLEM(module_name, on_resolve_cb)                                          \\\n  static jerryx_native_module_t _##module_name##_definition = { .name_p = (jerry_char_t *) #module_name, \\\n                                                                .on_resolve_p = (on_resolve_cb),         \\\n                                                                .next_p = NULL };                        \\\n                                                                                                         \\\n  JERRYX_MODULE_CONSTRUCTOR (module_name##_register)                                                     \\\n  {                                                                                                      \\\n    jerryx_native_module_register (&_##module_name##_definition);                                        \\\n  }                                                                                                      \\\n                                                                                                         \\\n  JERRYX_MODULE_DESTRUCTOR (module_name##_unregister)                                                    \\\n  {                                                                                                      \\\n    jerryx_native_module_unregister (&_##module_name##_definition);                                      \\\n  }\n\n/**\n * Register a native module. This makes it available for loading via jerryx_module_resolve, when\n * jerryx_module_native_resolver is passed in as a possible resolver.\n */\nvoid jerryx_native_module_register (jerryx_native_module_t *module_p);\n\n/**\n * Unregister a native module. This removes the module from the list of available native modules, meaning that\n * subsequent calls to jerryx_module_resolve with jerryx_module_native_resolver will not be able to find it.\n */\nvoid jerryx_native_module_unregister (jerryx_native_module_t *module_p);\n\n/**\n * Declare the function pointer type for canonical name resolution.\n */\ntypedef jerry_value_t (*jerryx_module_get_canonical_name_t) (const jerry_value_t name); /**< The name for which to\n                                                                                         *   compute the canonical\n                                                                                         *   name */\n\n/**\n * Declare the function pointer type for module resolution.\n */\ntypedef bool (*jerryx_module_resolve_t) (const jerry_value_t canonical_name, /**< The module's canonical name */\n                                         jerry_value_t *result); /**< The resulting module, if the function returns\n                                                                  *   true */\n\n/**\n * Declare the structure for module resolvers.\n */\ntypedef struct\n{\n  jerryx_module_get_canonical_name_t get_canonical_name_p; /**< function pointer to establish the canonical name of a\n                                                            *   module */\n  jerryx_module_resolve_t resolve_p; /**< function pointer to resolve a module */\n} jerryx_module_resolver_t;\n\n/**\n * Declare the JerryScript module resolver so that it may be added to an array of jerryx_module_resolver_t items and\n * thus passed to jerryx_module_resolve.\n */\nextern jerryx_module_resolver_t jerryx_module_native_resolver;\n\n/**\n * Load a copy of a module into the current context using the provided module resolvers, or return one that was already\n * loaded if it is found.\n */\njerry_value_t\njerryx_module_resolve (const jerry_value_t name, const jerryx_module_resolver_t **resolvers_p, size_t count);\n\n/**\n * Delete a module from the cache or, if name has the JavaScript value of undefined, clear the entire cache.\n */\nvoid jerryx_module_clear_cache (const jerry_value_t name, const jerryx_module_resolver_t **resolvers_p, size_t count);\n\nJERRY_C_API_END\n\n#endif /* !JERRYX_MODULE_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/print.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_PRINT_H\n#define JERRYX_PRINT_H\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript-types.h\"\n\nJERRY_C_API_BEGIN\n\njerry_value_t jerryx_print_value (const jerry_value_t value);\nvoid jerryx_print_buffer (const jerry_char_t *buffer_p, jerry_size_t buffer_size);\nvoid jerryx_print_backtrace (unsigned depth);\nvoid jerryx_print_unhandled_exception (jerry_value_t exception);\nvoid jerryx_print_unhandled_rejection (jerry_value_t exception);\n\nJERRY_C_API_END\n\n#endif /* !JERRYX_PRINT_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/properties.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_PROPERTIES_H\n#define JERRYX_PROPERTIES_H\n\n#include \"jerryscript-types.h\"\n\nJERRY_C_API_BEGIN\n\n/*\n * Handler registration helper\n */\n\nbool jerryx_register_global (const char *name_p, jerry_external_handler_t handler_p);\n\n/**\n * Struct used by the `jerryx_set_functions` method to\n * register multiple methods for a given object.\n */\ntypedef struct\n{\n  const char *name; /**< name of the property to add */\n  jerry_value_t value; /**< value of the property */\n} jerryx_property_entry;\n\n#define JERRYX_PROPERTY_NUMBER(NAME, NUMBER) \\\n  (jerryx_property_entry)                    \\\n  {                                          \\\n    NAME, jerry_number (NUMBER)              \\\n  }\n#define JERRYX_PROPERTY_STRING(NAME, STR, SIZE)                                \\\n  (jerryx_property_entry)                                                      \\\n  {                                                                            \\\n    NAME, jerry_string ((const jerry_char_t *) STR, SIZE, JERRY_ENCODING_UTF8) \\\n  }\n#define JERRYX_PROPERTY_STRING_SZ(NAME, STR) \\\n  (jerryx_property_entry)                    \\\n  {                                          \\\n    NAME, jerry_string_sz (STR)              \\\n  }\n#define JERRYX_PROPERTY_BOOLEAN(NAME, VALUE) \\\n  (jerryx_property_entry)                    \\\n  {                                          \\\n    NAME, jerry_boolean (VALUE)              \\\n  }\n#define JERRYX_PROPERTY_FUNCTION(NAME, FUNC) \\\n  (jerryx_property_entry)                    \\\n  {                                          \\\n    NAME, jerry_function_external (FUNC)     \\\n  }\n#define JERRYX_PROPERTY_UNDEFINED(NAME) \\\n  (jerryx_property_entry)               \\\n  {                                     \\\n    NAME, jerry_undefined ()            \\\n  }\n#define JERRYX_PROPERTY_LIST_END() \\\n  (jerryx_property_entry)          \\\n  {                                \\\n    NULL, 0                        \\\n  }\n\n/**\n * Stores the result of property register operation.\n */\ntypedef struct\n{\n  jerry_value_t result; /**< result of property registration (undefined or error object) */\n  uint32_t registered; /**< number of successfully registered methods */\n} jerryx_register_result;\n\njerryx_register_result jerryx_set_properties (const jerry_value_t target_object, const jerryx_property_entry entries[]);\n\nvoid jerryx_release_property_entry (const jerryx_property_entry entries[],\n                                    const jerryx_register_result register_result);\n\nJERRY_C_API_END\n\n#endif /* !JERRYX_PROPERTIES_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/repl.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_REPL_H\n#define JERRYX_REPL_H\n\n#include \"jerryscript-types.h\"\n\nJERRY_C_API_BEGIN\n\nvoid jerryx_repl (const jerry_char_t *prompt_p, jerry_size_t prompt_size);\n\nJERRY_C_API_END\n\n#endif /* !JERRYX_REPL_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/sources.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_SOURCES_H\n#define JERRYX_SOURCES_H\n\n#include \"jerryscript-types.h\"\n\nJERRY_C_API_BEGIN\n\njerry_value_t jerryx_source_parse_script (const char* path);\njerry_value_t jerryx_source_exec_script (const char* path);\njerry_value_t jerryx_source_exec_module (const char* path);\njerry_value_t jerryx_source_exec_snapshot (const char* path, size_t function_index);\njerry_value_t jerryx_source_exec_stdin (void);\n\nJERRY_C_API_END\n\n#endif /* !JERRYX_EXEC_H */\n"
  },
  {
    "path": "jerry-ext/include/jerryscript-ext/test262.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRYX_TEST262_H\n#define JERRYX_TEST262_H\n\n#include \"jerryscript-types.h\"\n\nJERRY_C_API_BEGIN\n\nvoid jerryx_test262_register (void);\n\nJERRY_C_API_END\n\n#endif /* !JERRYX_TEST262_H */\n"
  },
  {
    "path": "jerry-ext/libjerry-ext.pc.in",
    "content": "prefix=@CMAKE_INSTALL_PREFIX@\nlibdir=${prefix}/lib\nincludedir=${prefix}/include\n\nName: libjerry-ext\nDescription: JerryScript: lightweight JavaScript engine (extensions library)\nURL: https://github.com/jerryscript-project/jerryscript\nVersion: @JERRY_VERSION@\nRequires.private: libjerry-core\nLibs: -L${libdir} -ljerry-ext\nLibs.private: @JERRY_EXT_PKGCONFIG_LIBS@\nCflags: -I${includedir}\n"
  },
  {
    "path": "jerry-ext/module/module.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-ext/module.h\"\n\n#include <string.h>\n\n#include \"jerryscript.h\"\n\nstatic const char *module_name_property_name = \"moduleName\";\nstatic const char *module_not_found = \"Module not found\";\nstatic const char *module_name_not_string = \"Module name is not a string\";\n\n/**\n * Create an error related to modules\n *\n * Creates an error object of the requested type with the additional property \"moduleName\" the value of which is a\n * string containing the name of the module that was requested when the error occurred.\n *\n * @return the error\n */\nstatic jerry_value_t\njerryx_module_create_error (jerry_error_t error_type, /**< the type of error to create */\n                            const char *message, /**< the error message */\n                            const jerry_value_t module_name) /**< the module name */\n{\n  jerry_value_t error_object = jerry_error_sz (error_type, message);\n  jerry_value_t property_name = jerry_string_sz (module_name_property_name);\n\n  jerry_value_free (jerry_object_set (error_object, property_name, module_name));\n\n  jerry_value_free (property_name);\n  return jerry_throw_value (error_object, true);\n} /* jerryx_module_create_error */\n\n/**\n * Initialize the module manager extension.\n */\nstatic void\njerryx_module_manager_init (void *user_data_p)\n{\n  *((jerry_value_t *) user_data_p) = jerry_object ();\n} /* jerryx_module_manager_init */\n\n/**\n * Deinitialize the module manager extension.\n */\nstatic void\njerryx_module_manager_deinit (void *user_data_p) /**< context pointer to deinitialize */\n{\n  jerry_value_free (*(jerry_value_t *) user_data_p);\n} /* jerryx_module_manager_deinit */\n\n/**\n * Declare the context data manager for modules.\n */\nstatic const jerry_context_data_manager_t jerryx_module_manager = { .init_cb = jerryx_module_manager_init,\n                                                                    .deinit_cb = jerryx_module_manager_deinit,\n                                                                    .bytes_needed = sizeof (jerry_value_t) };\n\n/**\n * Global static entry point to the linked list of available modules.\n */\nstatic jerryx_native_module_t *first_module_p = NULL;\n\nvoid\njerryx_native_module_register (jerryx_native_module_t *module_p)\n{\n  module_p->next_p = first_module_p;\n  first_module_p = module_p;\n} /* jerryx_native_module_register */\n\nvoid\njerryx_native_module_unregister (jerryx_native_module_t *module_p)\n{\n  jerryx_native_module_t *parent_p = NULL, *iter_p = NULL;\n\n  for (iter_p = first_module_p; iter_p != NULL; parent_p = iter_p, iter_p = iter_p->next_p)\n  {\n    if (iter_p == module_p)\n    {\n      if (parent_p)\n      {\n        parent_p->next_p = module_p->next_p;\n      }\n      else\n      {\n        first_module_p = module_p->next_p;\n      }\n      module_p->next_p = NULL;\n    }\n  }\n} /* jerryx_native_module_unregister */\n\n/**\n * Attempt to retrieve a module by name from a cache, and return false if not found.\n */\nstatic bool\njerryx_module_check_cache (jerry_value_t cache, /**< cache from which to attempt to retrieve the module by name */\n                           jerry_value_t module_name, /**< JerryScript string value holding the module name */\n                           jerry_value_t *result) /**< Resulting value */\n{\n  bool ret = false;\n\n  /* Check if the cache has the module. */\n  jerry_value_t js_has_property = jerry_object_has (cache, module_name);\n\n  /* If we succeed in getting an answer, we examine the answer. */\n  if (!jerry_value_is_exception (js_has_property))\n  {\n    bool has_property = jerry_value_is_true (js_has_property);\n\n    /* If the module is indeed in the cache, we return it. */\n    if (has_property)\n    {\n      if (result != NULL)\n      {\n        (*result) = jerry_object_get (cache, module_name);\n      }\n      ret = true;\n    }\n  }\n\n  jerry_value_free (js_has_property);\n\n  return ret;\n} /* jerryx_module_check_cache */\n\n/**\n * Attempt to cache a loaded module.\n *\n * @return the module on success, otherwise the error encountered when attempting to cache. In the latter case, the\n * @p module is released.\n */\nstatic jerry_value_t\njerryx_module_add_to_cache (jerry_value_t cache, /**< cache to which to add the module */\n                            jerry_value_t module_name, /**< key at which to cache the module */\n                            jerry_value_t module) /**< the module to cache */\n{\n  jerry_value_t ret = jerry_object_set (cache, module_name, module);\n\n  if (jerry_value_is_exception (ret))\n  {\n    jerry_value_free (module);\n  }\n  else\n  {\n    jerry_value_free (ret);\n    ret = module;\n  }\n\n  return ret;\n} /* jerryx_module_add_to_cache */\n\nstatic const char *on_resolve_absent = \"Module on_resolve () must not be NULL\";\n\n/**\n * Declare and define the default module resolver - one which examines what modules are defined in the above linker\n * section and loads one that matches the requested name, caching the result for subsequent requests using the context\n * data mechanism.\n */\nstatic bool\njerryx_resolve_native_module (const jerry_value_t canonical_name, /**< canonical name of the module */\n                              jerry_value_t *result) /**< [out] where to put the resulting module instance */\n{\n  const jerryx_native_module_t *module_p = NULL;\n\n  jerry_size_t name_size = jerry_string_size (canonical_name, JERRY_ENCODING_UTF8);\n  JERRY_VLA (jerry_char_t, name_string, name_size);\n  jerry_string_to_buffer (canonical_name, JERRY_ENCODING_UTF8, name_string, name_size);\n\n  /* Look for the module by its name in the list of module definitions. */\n  for (module_p = first_module_p; module_p != NULL; module_p = module_p->next_p)\n  {\n    if (module_p->name_p != NULL && strlen ((char *) module_p->name_p) == name_size\n        && !strncmp ((char *) module_p->name_p, (char *) name_string, name_size))\n    {\n      /* If we find the module by its name we load it and cache it if it has an on_resolve () and complain otherwise. */\n      (*result) =\n        ((module_p->on_resolve_p) ? module_p->on_resolve_p ()\n                                  : jerryx_module_create_error (JERRY_ERROR_TYPE, on_resolve_absent, canonical_name));\n      return true;\n    }\n  }\n\n  return false;\n} /* jerryx_resolve_native_module */\n\njerryx_module_resolver_t jerryx_module_native_resolver = { .get_canonical_name_p = NULL,\n                                                           .resolve_p = jerryx_resolve_native_module };\n\nstatic void\njerryx_module_resolve_local (const jerry_value_t name, /**< name of the module to load */\n                             const jerryx_module_resolver_t **resolvers_p, /**< list of resolvers */\n                             size_t resolver_count, /**< number of resolvers in @p resolvers */\n                             jerry_value_t *result) /**< location to store the result, or NULL to remove the module */\n{\n  size_t index;\n  size_t canonical_names_used = 0;\n  jerry_value_t instances;\n  JERRY_VLA (jerry_value_t, canonical_names, resolver_count);\n  jerry_value_t (*get_canonical_name_p) (const jerry_value_t name);\n  bool (*resolve_p) (const jerry_value_t canonical_name, jerry_value_t *result);\n\n  if (!jerry_value_is_string (name))\n  {\n    if (result != NULL)\n    {\n      *result = jerryx_module_create_error (JERRY_ERROR_COMMON, module_name_not_string, name);\n    }\n    goto done;\n  }\n\n  instances = *(jerry_value_t *) jerry_context_data (&jerryx_module_manager);\n\n  /**\n   * Establish the canonical name for the requested module. Each resolver presents its own canonical name. If one of\n   * the canonical names matches a cached module, it is returned as the result.\n   */\n  for (index = 0; index < resolver_count; index++)\n  {\n    get_canonical_name_p = (resolvers_p[index] == NULL ? NULL : resolvers_p[index]->get_canonical_name_p);\n    canonical_names[index] = ((get_canonical_name_p == NULL) ? jerry_value_copy (name) : get_canonical_name_p (name));\n    canonical_names_used++;\n    if (jerryx_module_check_cache (instances, canonical_names[index], result))\n    {\n      /* A NULL for result indicates that we are to delete the module from the cache if found. Let's do that here.*/\n      if (result == NULL)\n      {\n        jerry_object_delete (instances, canonical_names[index]);\n      }\n      goto done;\n    }\n  }\n\n  if (result == NULL)\n  {\n    goto done;\n  }\n\n  /**\n   * Past this point we assume a module is wanted, and therefore result is not NULL. So, we try each resolver until one\n   * manages to resolve the module.\n   */\n  for (index = 0; index < resolver_count; index++)\n  {\n    resolve_p = (resolvers_p[index] == NULL ? NULL : resolvers_p[index]->resolve_p);\n    if (resolve_p != NULL && resolve_p (canonical_names[index], result))\n    {\n      if (!jerry_value_is_exception (*result))\n      {\n        *result = jerryx_module_add_to_cache (instances, canonical_names[index], *result);\n      }\n      goto done;\n    }\n  }\n\n  /* If none of the resolvers manage to find the module, complain with \"Module not found\" */\n  *result = jerryx_module_create_error (JERRY_ERROR_COMMON, module_not_found, name);\n\ndone:\n  /* Release the canonical names as returned by the various resolvers. */\n  for (index = 0; index < canonical_names_used; index++)\n  {\n    jerry_value_free (canonical_names[index]);\n  }\n} /* jerryx_module_resolve_local */\n\n/**\n * Resolve a single module using the module resolvers available in the section declared above and load it into the\n * current context.\n *\n * @p name - name of the module to resolve\n * @p resolvers - list of resolvers to invoke\n * @p count - number of resolvers in the list\n *\n * @return a jerry_value_t containing one of the followings:\n *   - the result of having loaded the module named @p name, or\n *   - the result of a previous successful load, or\n *   - an error indicating that something went wrong during the attempt to load the module.\n */\njerry_value_t\njerryx_module_resolve (const jerry_value_t name, /**< name of the module to load */\n                       const jerryx_module_resolver_t **resolvers_p, /**< list of resolvers */\n                       size_t resolver_count) /**< number of resolvers in @p resolvers */\n{\n  /* Set to zero to circumvent fatal warning. */\n  jerry_value_t ret = 0;\n  jerryx_module_resolve_local (name, resolvers_p, resolver_count, &ret);\n  return ret;\n} /* jerryx_module_resolve */\n\nvoid\njerryx_module_clear_cache (const jerry_value_t name, /**< name of the module to remove, or undefined */\n                           const jerryx_module_resolver_t **resolvers_p, /**< list of resolvers */\n                           size_t resolver_count) /**< number of resolvers in @p resolvers */\n{\n  void *instances_p = jerry_context_data (&jerryx_module_manager);\n\n  if (jerry_value_is_undefined (name))\n  {\n    /* We were requested to clear the entire cache, so we bounce the context data in the most agnostic way possible. */\n    jerryx_module_manager.deinit_cb (instances_p);\n    jerryx_module_manager.init_cb (instances_p);\n    return;\n  }\n\n  /* Delete the requested module from the cache if it's there. */\n  jerryx_module_resolve_local (name, resolvers_p, resolver_count, NULL);\n} /* jerryx_module_clear_cache */\n"
  },
  {
    "path": "jerry-ext/util/handlers.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-ext/handlers.h\"\n\n#include \"jerryscript-core.h\"\n#include \"jerryscript-debugger.h\"\n#include \"jerryscript-port.h\"\n\n#include \"jerryscript-ext/print.h\"\n\n/**\n * Provide a 'print' implementation for scripts.\n *\n * The routine converts all of its arguments to strings and outputs them\n * by using jerry_port_print_buffer.\n *\n * The NULL character is output as \"\\u0000\", other characters are output\n * bytewise.\n *\n * Note:\n *      This implementation does not use standard C `printf` to print its\n *      output. This allows more flexibility but also extends the core\n *      JerryScript engine port API. Applications that want to use\n *      `jerryx_handler_print` must ensure that their port implementation also\n *      provides `jerry_port_print_buffer`.\n *\n * @return undefined - if all arguments could be converted to strings,\n *         error - otherwise.\n */\njerry_value_t\njerryx_handler_print (const jerry_call_info_t *call_info_p, /**< call information */\n                      const jerry_value_t args_p[], /**< function arguments */\n                      const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  (void) call_info_p; /* unused */\n\n  for (jerry_length_t index = 0; index < args_cnt; index++)\n  {\n    if (index > 0)\n    {\n      jerryx_print_buffer (JERRY_ZSTR_ARG (\" \"));\n    }\n\n    jerry_value_t result = jerryx_print_value (args_p[index]);\n\n    if (jerry_value_is_exception (result))\n    {\n      return result;\n    }\n  }\n\n  jerryx_print_buffer (JERRY_ZSTR_ARG (\"\\n\"));\n  return jerry_undefined ();\n} /* jerryx_handler_print */\n\n/**\n * Hard assert for scripts. The routine calls jerry_port_fatal on assertion failure.\n *\n * Notes:\n *  * If the `JERRY_FEATURE_LINE_INFO` runtime feature is enabled (build option: `JERRY_LINE_INFO`)\n *    a backtrace is also printed out.\n *\n * @return true - if only one argument was passed and that argument was a boolean true.\n *         Note that the function does not return otherwise.\n */\njerry_value_t\njerryx_handler_assert (const jerry_call_info_t *call_info_p, /**< call information */\n                       const jerry_value_t args_p[], /**< function arguments */\n                       const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  (void) call_info_p; /* unused */\n\n  if (args_cnt == 1 && jerry_value_is_true (args_p[0]))\n  {\n    return jerry_boolean (true);\n  }\n\n  /* Assert failed, print a bit of JS backtrace */\n  jerry_log (JERRY_LOG_LEVEL_ERROR, \"Script Error: assertion failed\\n\");\n  jerryx_print_backtrace (5);\n\n  jerry_port_fatal (JERRY_FATAL_FAILED_ASSERTION);\n} /* jerryx_handler_assert */\n\n/**\n * Expose garbage collector to scripts.\n *\n * @return undefined.\n */\njerry_value_t\njerryx_handler_gc (const jerry_call_info_t *call_info_p, /**< call information */\n                   const jerry_value_t args_p[], /**< function arguments */\n                   const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  (void) call_info_p; /* unused */\n\n  jerry_gc_mode_t mode =\n    ((args_cnt > 0 && jerry_value_to_boolean (args_p[0])) ? JERRY_GC_PRESSURE_HIGH : JERRY_GC_PRESSURE_LOW);\n\n  jerry_heap_gc (mode);\n  return jerry_undefined ();\n} /* jerryx_handler_gc */\n\n/**\n * Get the resource name (usually a file name) of the currently executed script or the given function object\n *\n * Note: returned value must be freed with jerry_value_free, when it is no longer needed\n *\n * @return JS string constructed from\n *         - the currently executed function object's resource name, if the given value is undefined\n *         - resource name of the function object, if the given value is a function object\n *         - \"<anonymous>\", otherwise\n */\njerry_value_t\njerryx_handler_source_name (const jerry_call_info_t *call_info_p, /**< call information */\n                            const jerry_value_t args_p[], /**< function arguments */\n                            const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  (void) call_info_p; /* unused */\n\n  jerry_value_t undefined_value = jerry_undefined ();\n  jerry_value_t source_name = jerry_source_name (args_cnt > 0 ? args_p[0] : undefined_value);\n  jerry_value_free (undefined_value);\n\n  return source_name;\n} /* jerryx_handler_source_name */\n\n/**\n * Create a new realm.\n *\n * @return new Realm object\n */\njerry_value_t\njerryx_handler_create_realm (const jerry_call_info_t *call_info_p, /**< call information */\n                             const jerry_value_t args_p[], /**< function arguments */\n                             const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  (void) call_info_p; /* unused */\n  (void) args_p; /* unused */\n  (void) args_cnt; /* unused */\n  return jerry_realm ();\n} /* jerryx_handler_create_realm */\n\n/**\n * Handler for unhandled promise rejection events.\n */\nvoid\njerryx_handler_promise_reject (jerry_promise_event_type_t event_type, /**< event type */\n                               const jerry_value_t object, /**< target object */\n                               const jerry_value_t value, /**< optional argument */\n                               void *user_p) /**< user pointer passed to the callback */\n{\n  (void) value;\n  (void) user_p;\n\n  if (event_type != JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER)\n  {\n    return;\n  }\n\n  jerry_value_t result = jerry_promise_result (object);\n  jerryx_print_unhandled_rejection (result);\n\n  jerry_value_free (result);\n} /* jerryx_handler_promise_reject */\n\n/**\n * Runs the source code received by jerry_debugger_wait_for_client_source.\n *\n * @return result fo the source code execution\n */\njerry_value_t\njerryx_handler_source_received (const jerry_char_t *source_name_p, /**< resource name */\n                                size_t source_name_size, /**< size of resource name */\n                                const jerry_char_t *source_p, /**< source code */\n                                size_t source_size, /**< source code size */\n                                void *user_p) /**< user pointer */\n{\n  (void) user_p; /* unused */\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string (source_name_p, (jerry_size_t) source_name_size, JERRY_ENCODING_UTF8);\n\n  jerry_value_t ret_val = jerry_parse (source_p, source_size, &parse_options);\n\n  jerry_value_free (parse_options.source_name);\n\n  if (!jerry_value_is_exception (ret_val))\n  {\n    jerry_value_t func_val = ret_val;\n    ret_val = jerry_run (func_val);\n    jerry_value_free (func_val);\n  }\n\n  return ret_val;\n} /* jerryx_handler_source_received */\n"
  },
  {
    "path": "jerry-ext/util/print.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-ext/print.h\"\n\n#include <assert.h>\n#include <inttypes.h>\n#include <stdarg.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"jerryscript-core.h\"\n#include \"jerryscript-debugger.h\"\n#include \"jerryscript-port.h\"\n\n/**\n * Print buffer size\n */\n#define JERRYX_PRINT_BUFFER_SIZE 64\n\n/**\n * Max line size that will be printed on a Syntax Error\n */\n#define JERRYX_SYNTAX_ERROR_MAX_LINE_LENGTH 256\n\n/**\n * Struct for buffering print output\n */\ntypedef struct\n{\n  jerry_size_t index; /**< write index */\n  jerry_char_t data[JERRYX_PRINT_BUFFER_SIZE]; /**< buffer data */\n} jerryx_print_buffer_t;\n\n/**\n * Callback used by jerryx_print_value to batch written characters and print them in bulk.\n * NULL bytes are escaped and written as '\\u0000'.\n *\n * @param value:  encoded byte value\n * @param user_p: user pointer\n */\nstatic void\njerryx_buffered_print (uint32_t value, void *user_p)\n{\n  jerryx_print_buffer_t *buffer_p = (jerryx_print_buffer_t *) user_p;\n\n  if (value == '\\0')\n  {\n    jerryx_print_buffer (buffer_p->data, buffer_p->index);\n    buffer_p->index = 0;\n\n    jerryx_print_buffer (JERRY_ZSTR_ARG (\"\\\\u0000\"));\n    return;\n  }\n\n  assert (value <= UINT8_MAX);\n  buffer_p->data[buffer_p->index++] = (uint8_t) value;\n\n  if (buffer_p->index >= JERRYX_PRINT_BUFFER_SIZE)\n  {\n    jerryx_print_buffer (buffer_p->data, buffer_p->index);\n    buffer_p->index = 0;\n  }\n} /* jerryx_buffered_print */\n\n/**\n * Convert a value to string and print it to standard output.\n * NULL characters are escaped to \"\\u0000\", other characters are output as-is.\n *\n * @param value: input value\n */\njerry_value_t\njerryx_print_value (const jerry_value_t value)\n{\n  jerry_value_t string;\n\n  if (jerry_value_is_symbol (value))\n  {\n    string = jerry_symbol_descriptive_string (value);\n  }\n  else\n  {\n    string = jerry_value_to_string (value);\n\n    if (jerry_value_is_exception (string))\n    {\n      return string;\n    }\n  }\n\n  jerryx_print_buffer_t buffer;\n  buffer.index = 0;\n\n  jerry_string_iterate (string, JERRY_ENCODING_UTF8, &jerryx_buffered_print, &buffer);\n  jerry_value_free (string);\n\n  jerryx_print_buffer (buffer.data, buffer.index);\n\n  return jerry_undefined ();\n} /* jerryx_print */\n\n/**\n * Print a buffer to standard output, also sending it to the debugger, if connected.\n *\n * @param buffer_p: inptut string buffer\n * @param buffer_size: size of the string\n */\nvoid\njerryx_print_buffer (const jerry_char_t *buffer_p, jerry_size_t buffer_size)\n{\n  jerry_port_print_buffer (buffer_p, buffer_size);\n#if JERRY_DEBUGGER\n  jerry_debugger_send_output (buffer_p, buffer_size);\n#endif /* JERRY_DEBUGGER */\n} /* jerryx_print_buffer */\n\n/**\n * Print backtrace as log messages up to a specific depth.\n *\n * @param depth: backtrace depth\n */\nvoid\njerryx_print_backtrace (unsigned depth)\n{\n  if (!jerry_feature_enabled (JERRY_FEATURE_LINE_INFO))\n  {\n    return;\n  }\n\n  jerry_log (JERRY_LOG_LEVEL_ERROR, \"Script backtrace (top %u):\\n\", depth);\n\n  jerry_value_t backtrace_array = jerry_backtrace (depth);\n  unsigned array_length = jerry_array_length (backtrace_array);\n\n  for (unsigned idx = 0; idx < array_length; idx++)\n  {\n    jerry_value_t property = jerry_object_get_index (backtrace_array, idx);\n\n    jerry_char_t buffer[JERRYX_PRINT_BUFFER_SIZE];\n\n    jerry_size_t copied = jerry_string_to_buffer (property, JERRY_ENCODING_UTF8, buffer, JERRYX_PRINT_BUFFER_SIZE - 1);\n    buffer[copied] = '\\0';\n\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \" %u: %s\\n\", idx, buffer);\n    jerry_value_free (property);\n  }\n\n  jerry_value_free (backtrace_array);\n} /* jerryx_print_backtrace */\n\n/**\n * Print an unhandled exception value\n *\n * The function will take ownership of the value, and free it.\n *\n * @param exception: unhandled exception value\n */\nvoid\njerryx_print_unhandled_exception (jerry_value_t exception) /**< exception value */\n{\n  assert (jerry_value_is_exception (exception));\n  jerry_value_t value = jerry_exception_value (exception, true);\n\n  JERRY_VLA (jerry_char_t, buffer_p, JERRYX_PRINT_BUFFER_SIZE);\n\n  jerry_value_t string = jerry_value_to_string (value);\n\n  jerry_size_t copied = jerry_string_to_buffer (string, JERRY_ENCODING_UTF8, buffer_p, JERRYX_PRINT_BUFFER_SIZE - 1);\n  buffer_p[copied] = '\\0';\n\n  if (jerry_feature_enabled (JERRY_FEATURE_ERROR_MESSAGES) && jerry_error_type (value) == JERRY_ERROR_SYNTAX)\n  {\n    jerry_char_t *string_end_p = buffer_p + copied;\n    jerry_size_t err_line = 0;\n    jerry_size_t err_col = 0;\n    char *path_str_p = NULL;\n    char *path_str_end_p = NULL;\n\n    /* 1. parse column and line information */\n    for (jerry_char_t *current_p = buffer_p; current_p < string_end_p; current_p++)\n    {\n      if (*current_p == '[')\n      {\n        current_p++;\n\n        if (*current_p == '<')\n        {\n          break;\n        }\n\n        path_str_p = (char *) current_p;\n        while (current_p < string_end_p && *current_p != ':')\n        {\n          current_p++;\n        }\n\n        path_str_end_p = (char *) current_p;\n\n        if (current_p == string_end_p)\n        {\n          break;\n        }\n\n        err_line = (unsigned int) strtol ((char *) current_p + 1, (char **) &current_p, 10);\n\n        if (current_p == string_end_p)\n        {\n          break;\n        }\n\n        err_col = (unsigned int) strtol ((char *) current_p + 1, NULL, 10);\n        break;\n      }\n    } /* for */\n\n    if (err_line > 0 && err_col > 0 && err_col < JERRYX_SYNTAX_ERROR_MAX_LINE_LENGTH)\n    {\n      /* Temporarily modify the error message, so we can use the path. */\n      *path_str_end_p = '\\0';\n\n      jerry_size_t source_size;\n      jerry_char_t *source_p = jerry_port_source_read (path_str_p, &source_size);\n\n      /* Revert the error message. */\n      *path_str_end_p = ':';\n\n      if (source_p != NULL)\n      {\n        uint32_t curr_line = 1;\n        jerry_size_t pos = 0;\n\n        /* 2. seek and print */\n        while (pos < source_size && curr_line < err_line)\n        {\n          if (source_p[pos] == '\\n')\n          {\n            curr_line++;\n          }\n\n          pos++;\n        }\n\n        /* Print character if:\n         * - The max line length is not reached.\n         * - The current position is valid (it is not the end of the source).\n         * - The current character is not a newline.\n         **/\n        for (uint32_t char_count = 0;\n             (char_count < JERRYX_SYNTAX_ERROR_MAX_LINE_LENGTH) && (pos < source_size) && (source_p[pos] != '\\n');\n             char_count++, pos++)\n        {\n          jerry_log (JERRY_LOG_LEVEL_ERROR, \"%c\", source_p[pos]);\n        }\n\n        jerry_log (JERRY_LOG_LEVEL_ERROR, \"\\n\");\n        jerry_port_source_free (source_p);\n\n        while (--err_col)\n        {\n          jerry_log (JERRY_LOG_LEVEL_ERROR, \"~\");\n        }\n\n        jerry_log (JERRY_LOG_LEVEL_ERROR, \"^\\n\\n\");\n      }\n    }\n  }\n\n  jerry_log (JERRY_LOG_LEVEL_ERROR, \"Unhandled exception: %s\\n\", buffer_p);\n  jerry_value_free (string);\n\n  if (jerry_value_is_object (value))\n  {\n    jerry_value_t backtrace_val = jerry_object_get_sz (value, \"stack\");\n\n    if (jerry_value_is_array (backtrace_val))\n    {\n      uint32_t length = jerry_array_length (backtrace_val);\n\n      /* This length should be enough. */\n      if (length > 32)\n      {\n        length = 32;\n      }\n\n      for (unsigned i = 0; i < length; i++)\n      {\n        jerry_value_t item_val = jerry_object_get_index (backtrace_val, i);\n\n        if (jerry_value_is_string (item_val))\n        {\n          copied = jerry_string_to_buffer (item_val, JERRY_ENCODING_UTF8, buffer_p, JERRYX_PRINT_BUFFER_SIZE - 1);\n          buffer_p[copied] = '\\0';\n\n          jerry_log (JERRY_LOG_LEVEL_ERROR, \" %u: %s\\n\", i, buffer_p);\n        }\n\n        jerry_value_free (item_val);\n      }\n    }\n\n    jerry_value_free (backtrace_val);\n  }\n\n  jerry_value_free (value);\n} /* jerryx_print_unhandled_exception */\n\n/**\n * Print unhandled promise rejection.\n *\n * @param result: promise rejection result\n */\nvoid\njerryx_print_unhandled_rejection (jerry_value_t result) /**< result value */\n{\n  jerry_value_t reason = jerry_value_to_string (result);\n\n  if (!jerry_value_is_exception (reason))\n  {\n    JERRY_VLA (jerry_char_t, buffer_p, JERRYX_PRINT_BUFFER_SIZE);\n    jerry_size_t copied = jerry_string_to_buffer (reason, JERRY_ENCODING_UTF8, buffer_p, JERRYX_PRINT_BUFFER_SIZE - 1);\n    buffer_p[copied] = '\\0';\n\n    jerry_log (JERRY_LOG_LEVEL_WARNING, \"Uncaught Promise rejection: %s\\n\", buffer_p);\n  }\n  else\n  {\n    jerry_log (JERRY_LOG_LEVEL_WARNING, \"Uncaught Promise rejection: (reason cannot be converted to string)\\n\");\n  }\n\n  jerry_value_free (reason);\n} /* jerryx_print_unhandled_rejection */\n"
  },
  {
    "path": "jerry-ext/util/properties.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-ext/properties.h\"\n\n#include \"jerryscript-core.h\"\n\n/**\n * Register a JavaScript function in the global object.\n *\n * @return true - if the operation was successful,\n *         false - otherwise.\n */\nbool\njerryx_register_global (const char *name_p, /**< name of the function */\n                        jerry_external_handler_t handler_p) /**< function callback */\n{\n  jerry_value_t global_obj_val = jerry_current_realm ();\n  jerry_value_t function_name_val = jerry_string_sz (name_p);\n  jerry_value_t function_val = jerry_function_external (handler_p);\n\n  jerry_value_t result_val = jerry_object_set (global_obj_val, function_name_val, function_val);\n  bool result = jerry_value_is_true (result_val);\n\n  jerry_value_free (result_val);\n  jerry_value_free (function_val);\n  jerry_value_free (function_name_val);\n  jerry_value_free (global_obj_val);\n\n  return result;\n} /* jerryx_register_global */\n\n/**\n * Set multiple properties on a target object.\n *\n * The properties are an array of (name, property value) pairs and\n * this list must end with a (NULL, 0) entry.\n *\n * Notes:\n *  - Each property value in the input array is released after a successful property registration.\n *  - The property name must be a zero terminated UTF-8 string.\n *  - There should be no '\\0' (NULL) character in the name excluding the string terminator.\n *  - The method `jerryx_release_property_entry` must be called if there is any failed registration\n *    to release the values in the entries array.\n *\n * @return `jerryx_register_result` struct - if everything is ok with the (undefined, property entry count) values.\n *         In case of error the (error object, registered property count) pair.\n */\njerryx_register_result\njerryx_set_properties (const jerry_value_t target_object, /**< target object */\n                       const jerryx_property_entry entries[]) /**< array of method entries */\n{\n#define JERRYX_SET_PROPERTIES_RESULT(VALUE, IDX) ((jerryx_register_result){ VALUE, IDX })\n  uint32_t idx = 0;\n\n  if (entries == NULL)\n  {\n    return JERRYX_SET_PROPERTIES_RESULT (jerry_undefined (), 0);\n  }\n\n  for (; (entries[idx].name != NULL); idx++)\n  {\n    const jerryx_property_entry *entry = &entries[idx];\n\n    jerry_value_t prop_name = jerry_string_sz (entry->name);\n    jerry_value_t result = jerry_object_set (target_object, prop_name, entry->value);\n\n    jerry_value_free (prop_name);\n\n    // By API definition:\n    // The jerry_object_set returns TRUE if there is no problem\n    // and error object if there is any problem.\n    // Thus there is no need to check if the boolean value is false or not.\n    if (!jerry_value_is_boolean (result))\n    {\n      return JERRYX_SET_PROPERTIES_RESULT (result, idx);\n    }\n\n    jerry_value_free (entry->value);\n    jerry_value_free (result);\n  }\n\n  return JERRYX_SET_PROPERTIES_RESULT (jerry_undefined (), idx);\n#undef JERRYX_SET_PROPERTIES_RESULT\n} /* jerryx_set_properties */\n\n/**\n * Release all jerry_value_t in a jerryx_property_entry array based on\n * a previous jerryx_set_properties call.\n *\n * In case of a successful registration it is safe to call this method.\n */\nvoid\njerryx_release_property_entry (const jerryx_property_entry entries[], /**< list of property entries */\n                               const jerryx_register_result register_result) /**< previous result of registration */\n{\n  if (entries == NULL)\n  {\n    return;\n  }\n\n  for (uint32_t idx = register_result.registered; entries[idx].name != NULL; idx++)\n  {\n    jerry_value_free (entries[idx].value);\n  }\n} /* jerryx_release_property_entry */\n"
  },
  {
    "path": "jerry-ext/util/repl.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-ext/repl.h\"\n\n#include <stdio.h>\n#include <string.h>\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/print.h\"\n\nvoid\njerryx_repl (const jerry_char_t *prompt_p, jerry_size_t prompt_size)\n{\n  jerry_value_t result;\n\n  while (true)\n  {\n    jerryx_print_buffer (prompt_p, prompt_size);\n    fflush (stdout);\n\n    jerry_size_t length;\n    jerry_char_t *line_p = jerry_port_line_read (&length);\n\n    if (line_p == NULL)\n    {\n      jerryx_print_buffer (JERRY_ZSTR_ARG (\"\\n\"));\n      return;\n    }\n\n    if (length == 0)\n    {\n      continue;\n    }\n\n    if (!jerry_validate_string (line_p, length, JERRY_ENCODING_UTF8))\n    {\n      jerry_port_line_free (line_p);\n      result = jerry_throw_sz (JERRY_ERROR_SYNTAX, \"Input is not a valid UTF-8 string\");\n      goto exception;\n    }\n\n    result = jerry_parse (line_p, length, NULL);\n    jerry_port_line_free (line_p);\n\n    if (jerry_value_is_exception (result))\n    {\n      goto exception;\n    }\n\n    jerry_value_t script = result;\n    result = jerry_run (script);\n    jerry_value_free (script);\n\n    if (jerry_value_is_exception (result))\n    {\n      goto exception;\n    }\n\n    jerry_value_t print_result = jerryx_print_value (result);\n    jerry_value_free (result);\n    result = print_result;\n\n    if (jerry_value_is_exception (result))\n    {\n      goto exception;\n    }\n\n    jerryx_print_buffer (JERRY_ZSTR_ARG (\"\\n\"));\n\n    jerry_value_free (result);\n    result = jerry_run_jobs ();\n\n    if (jerry_value_is_exception (result))\n    {\n      goto exception;\n    }\n\n    jerry_value_free (result);\n    continue;\n\nexception:\n    jerryx_print_unhandled_exception (result);\n  }\n} /* jerryx_repl */\n"
  },
  {
    "path": "jerry-ext/util/sources.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-ext/sources.h\"\n\n#include <assert.h>\n#include <inttypes.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"jerryscript-debugger.h\"\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/print.h\"\n\njerry_value_t\njerryx_source_parse_script (const char *path_p)\n{\n  jerry_size_t source_size;\n  jerry_char_t *source_p = jerry_port_source_read (path_p, &source_size);\n\n  if (source_p == NULL)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Failed to open file: %s\\n\", path_p);\n    return jerry_throw_sz (JERRY_ERROR_SYNTAX, \"Source file not found\");\n  }\n\n  if (!jerry_validate_string (source_p, source_size, JERRY_ENCODING_UTF8))\n  {\n    jerry_port_source_free (source_p);\n    return jerry_throw_sz (JERRY_ERROR_SYNTAX, \"Input is not a valid UTF-8 encoded string.\");\n  }\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name =\n    jerry_string ((const jerry_char_t *) path_p, (jerry_size_t) strlen (path_p), JERRY_ENCODING_UTF8);\n\n  jerry_value_t result = jerry_parse (source_p, source_size, &parse_options);\n\n  jerry_value_free (parse_options.source_name);\n  jerry_port_source_free (source_p);\n\n  return result;\n} /* jerryx_source_parse_script */\n\njerry_value_t\njerryx_source_exec_script (const char *path_p)\n{\n  jerry_value_t result = jerryx_source_parse_script (path_p);\n\n  if (!jerry_value_is_exception (result))\n  {\n    jerry_value_t script = result;\n    result = jerry_run (script);\n    jerry_value_free (script);\n  }\n\n  return result;\n} /* jerryx_source_exec_script */\n\njerry_value_t\njerryx_source_exec_module (const char *path_p)\n{\n  jerry_value_t specifier =\n    jerry_string ((const jerry_char_t *) path_p, (jerry_size_t) strlen (path_p), JERRY_ENCODING_UTF8);\n  jerry_value_t referrer = jerry_undefined ();\n\n  jerry_value_t module = jerry_module_resolve (specifier, referrer, NULL);\n\n  jerry_value_free (referrer);\n  jerry_value_free (specifier);\n\n  if (jerry_value_is_exception (module))\n  {\n    return module;\n  }\n\n  if (jerry_module_state (module) == JERRY_MODULE_STATE_UNLINKED)\n  {\n    jerry_value_t link_result = jerry_module_link (module, NULL, NULL);\n\n    if (jerry_value_is_exception (link_result))\n    {\n      jerry_value_free (module);\n      return link_result;\n    }\n\n    jerry_value_free (link_result);\n  }\n\n  jerry_value_t result = jerry_module_evaluate (module);\n  jerry_value_free (module);\n\n  jerry_module_cleanup (jerry_undefined ());\n  return result;\n} /* jerryx_source_exec_module */\n\njerry_value_t\njerryx_source_exec_snapshot (const char *path_p, size_t function_index)\n{\n  jerry_size_t source_size;\n  jerry_char_t *source_p = jerry_port_source_read (path_p, &source_size);\n\n  if (source_p == NULL)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Failed to open file: %s\\n\", path_p);\n    return jerry_throw_sz (JERRY_ERROR_SYNTAX, \"Snapshot file not found\");\n  }\n\n  jerry_value_t result =\n    jerry_exec_snapshot ((uint32_t *) source_p, source_size, function_index, JERRY_SNAPSHOT_EXEC_COPY_DATA, NULL);\n\n  jerry_port_source_free (source_p);\n  return result;\n} /* jerryx_source_exec_snapshot */\n\njerry_value_t\njerryx_source_exec_stdin (void)\n{\n  jerry_char_t *source_p = NULL;\n  jerry_size_t source_size = 0;\n\n  while (true)\n  {\n    jerry_size_t line_size;\n    jerry_char_t *line_p = jerry_port_line_read (&line_size);\n\n    if (line_p == NULL)\n    {\n      break;\n    }\n\n    jerry_size_t new_size = source_size + line_size;\n    source_p = realloc (source_p, new_size);\n    if (source_p == NULL)\n    {\n      return jerry_throw_sz (JERRY_ERROR_COMMON, \"Out of memory.\");\n    }\n\n    memcpy (source_p + source_size, line_p, line_size);\n    jerry_port_line_free (line_p);\n    source_size = new_size;\n  }\n\n  if (!jerry_validate_string (source_p, source_size, JERRY_ENCODING_UTF8))\n  {\n    free (source_p);\n    return jerry_throw_sz (JERRY_ERROR_SYNTAX, \"Input is not a valid UTF-8 encoded string.\");\n  }\n\n  jerry_value_t result = jerry_parse (source_p, source_size, NULL);\n  free (source_p);\n\n  if (jerry_value_is_exception (result))\n  {\n    return result;\n  }\n\n  jerry_value_t script = result;\n  result = jerry_run (script);\n  jerry_value_free (script);\n\n  return result;\n} /* jerryx_source_exec_stdin */\n"
  },
  {
    "path": "jerry-ext/util/test262.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-ext/test262.h\"\n\n#include <assert.h>\n#include <string.h>\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/handlers.h\"\n\n/**\n * Register a method for the $262 object.\n */\nstatic void\njerryx_test262_register_function (jerry_value_t test262_obj, /** $262 object */\n                                  const char *name_p, /**< name of the function */\n                                  jerry_external_handler_t handler_p) /**< function callback */\n{\n  jerry_value_t function_val = jerry_function_external (handler_p);\n  jerry_value_t result_val = jerry_object_set_sz (test262_obj, name_p, function_val);\n  jerry_value_free (function_val);\n\n  assert (!jerry_value_is_exception (result_val));\n  jerry_value_free (result_val);\n} /* jerryx_test262_register_function */\n\n/**\n * $262.detachArrayBuffer\n *\n * A function which implements the DetachArrayBuffer abstract operation\n *\n * @return null value - if success\n *         value marked with error flag - otherwise\n */\nstatic jerry_value_t\njerryx_test262_detach_array_buffer (const jerry_call_info_t *call_info_p, /**< call information */\n                                    const jerry_value_t args_p[], /**< function arguments */\n                                    const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  (void) call_info_p; /* unused */\n\n  if (args_cnt < 1 || !jerry_value_is_arraybuffer (args_p[0]))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"Expected an ArrayBuffer object\");\n  }\n\n  /* TODO: support the optional 'key' argument */\n\n  return jerry_arraybuffer_detach (args_p[0]);\n} /* jerryx_test262_detach_array_buffer */\n\n/**\n * $262.evalScript\n *\n * A function which accepts a string value as its first argument and executes it\n *\n * @return completion of the script parsing and execution.\n */\nstatic jerry_value_t\njerryx_test262_eval_script (const jerry_call_info_t *call_info_p, /**< call information */\n                            const jerry_value_t args_p[], /**< function arguments */\n                            const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  (void) call_info_p; /* unused */\n\n  if (args_cnt < 1 || !jerry_value_is_string (args_p[0]))\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"Expected a string\");\n  }\n\n  jerry_value_t ret_value = jerry_parse_value (args_p[0], NULL);\n\n  if (!jerry_value_is_exception (ret_value))\n  {\n    jerry_value_t func_val = ret_value;\n    ret_value = jerry_run (func_val);\n    jerry_value_free (func_val);\n  }\n\n  return ret_value;\n} /* jerryx_test262_eval_script */\n\nstatic jerry_value_t jerryx_test262_create (jerry_value_t global_obj);\n\n/**\n * $262.createRealm\n *\n * A function which creates a new realm object, and returns a newly created $262 object\n *\n * @return a new $262 object\n */\nstatic jerry_value_t\njerryx_test262_create_realm (const jerry_call_info_t *call_info_p, /**< call information */\n                             const jerry_value_t args_p[], /**< function arguments */\n                             const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  (void) call_info_p; /* unused */\n  (void) args_p; /* unused */\n  (void) args_cnt; /* unused */\n\n  jerry_value_t realm_object = jerry_realm ();\n  jerry_value_t previous_realm = jerry_set_realm (realm_object);\n  assert (!jerry_value_is_exception (previous_realm));\n\n  jerry_value_t test262_object = jerryx_test262_create (realm_object);\n  jerry_set_realm (previous_realm);\n  jerry_value_free (realm_object);\n\n  return test262_object;\n} /* jerryx_test262_create_realm */\n\n/**\n * Create a new $262 object\n *\n * @return a new $262 object\n */\nstatic jerry_value_t\njerryx_test262_create (jerry_value_t global_obj) /**< global object */\n{\n  jerry_value_t test262_object = jerry_object ();\n\n  jerryx_test262_register_function (test262_object, \"detachArrayBuffer\", jerryx_test262_detach_array_buffer);\n  jerryx_test262_register_function (test262_object, \"evalScript\", jerryx_test262_eval_script);\n  jerryx_test262_register_function (test262_object, \"createRealm\", jerryx_test262_create_realm);\n  jerryx_test262_register_function (test262_object, \"gc\", jerryx_handler_gc);\n\n  jerry_value_t result = jerry_object_set_sz (test262_object, \"global\", global_obj);\n  assert (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  return test262_object;\n} /* create_test262 */\n\n/**\n * Add a new test262 object to the current global object.\n */\nvoid\njerryx_test262_register (void)\n{\n  jerry_value_t global_obj = jerry_current_realm ();\n  jerry_value_t test262_obj = jerryx_test262_create (global_obj);\n\n  jerry_value_t result = jerry_object_set_sz (global_obj, \"$262\", test262_obj);\n  assert (!jerry_value_is_exception (result));\n\n  jerry_value_free (result);\n  jerry_value_free (test262_obj);\n  jerry_value_free (global_obj);\n} /* jerryx_test262_register */\n"
  },
  {
    "path": "jerry-main/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required (VERSION 3.10)\nproject (jerry-main C)\n\n# Optional build settings\nset(ENABLE_LINK_MAP           OFF CACHE BOOL \"Enable generating a link map file?\")\nset(JERRY_TEST_STACK_MEASURE  OFF CACHE BOOL \"Enable stack measurement for the jerry-test binary?\")\n\n# Status messages\nmessage(STATUS \"ENABLE_LINK_MAP                \" ${ENABLE_LINK_MAP})\nmessage(STATUS \"JERRY_TEST_STACK_MEASURE       \" ${JERRY_TEST_STACK_MEASURE})\n\n# Generate map file\nif(ENABLE_LINK_MAP)\n  if(\"${PLATFORM}\" STREQUAL \"DARWIN\")\n    set(LINKER_FLAGS_COMMON \"${LINKER_FLAGS_COMMON} -Xlinker -map -Xlinker jerry.map\")\n  else()\n    set(LINKER_FLAGS_COMMON \"${LINKER_FLAGS_COMMON} -Xlinker -Map -Xlinker jerry.map\")\n  endif()\nendif()\n\n# Get version information from git\nif(IS_DIRECTORY \"${CMAKE_SOURCE_DIR}/.git\")\n  execute_process(COMMAND git rev-parse --short HEAD\n                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\n                  OUTPUT_VARIABLE JERRY_COMMIT_HASH\n                  OUTPUT_STRIP_TRAILING_WHITESPACE)\n  set(JERRY_COMMIT_HASH \" (${JERRY_COMMIT_HASH})\")\nelse()\n  set(JERRY_COMMIT_HASH \"\")\nendif()\n\nset(DEFINES_JERRY ${DEFINES_JERRY} JERRY_COMMIT_HASH=\"${JERRY_COMMIT_HASH}\")\n\nmacro(jerry_create_executable JERRY_NAME)\n  add_executable(${JERRY_NAME} ${ARGN})\n  set_property(TARGET ${JERRY_NAME}\n               PROPERTY LINK_FLAGS \"${LINKER_FLAGS_COMMON}\")\n  target_compile_definitions(${JERRY_NAME} PRIVATE ${DEFINES_JERRY})\n\n  target_link_libraries(${JERRY_NAME} jerry-core)\n\n  install(TARGETS ${JERRY_NAME} DESTINATION bin)\nendmacro()\n\n# Jerry with libfuzzer support\nif(JERRY_LIBFUZZER)\n  jerry_create_executable(\"jerry-libfuzzer\" \"main-libfuzzer.c\")\n  target_link_libraries(\"jerry-libfuzzer\" jerry-port -fsanitize=fuzzer)\nendif()\n\n# Jerry standalones\nif(JERRY_CMDLINE)\n  jerry_create_executable(\"jerry\" \"main-desktop.c\" \"arguments/options.c\" \"arguments/cli.c\")\n  target_link_libraries(\"jerry\" jerry-ext jerry-port)\nendif()\n\nif(JERRY_CMDLINE_TEST)\n  jerry_create_executable(\"jerry-test\" \"benchmark/main-benchmark.c\" \"benchmark/stubs.c\")\n  target_link_libraries(\"jerry-test\" jerry-port)\n  if (JERRY_TEST_STACK_MEASURE)\n    target_compile_definitions(\"jerry-test\" PRIVATE -DJERRY_TEST_STACK_MEASURE=1)\n  endif()\nendif()\n\nif(JERRY_CMDLINE_SNAPSHOT)\n  jerry_create_executable(\"jerry-snapshot\" \"main-snapshot.c\" \"arguments/cli.c\")\n  target_link_libraries(\"jerry-snapshot\" jerry-port)\nendif()\n"
  },
  {
    "path": "jerry-main/arguments/cli.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"cli.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n\n/*\n * Fixed layout settings\n */\n\n/**\n * Wrap lines at:\n */\n#define CLI_LINE_LENGTH 80\n\n/**\n * Indent various lines with:\n */\n#define CLI_LINE_INDENT 2\n\n/**\n * Tab stop (for multi-column display) at:\n */\n#define CLI_LINE_TAB 24\n\n/**\n * Declare a char VLA and concatenate a program name and a sub-command name\n * (separated by a single space) into the new array. Useful for printing command\n * line option usage summary for sub-commands.\n *\n * @param CMDNAME name of the new array variable.\n * @param PROGNAME string containing the name of the program.\n * @param CMD string continaing the name of the sub-command.\n */\n#define CLI_CMD_NAME(CMDNAME, PROGNAME, CMD)              \\\n  char CMDNAME[strlen ((PROGNAME)) + strlen ((CMD)) + 2]; \\\n  strncpy (CMDNAME, (PROGNAME), strlen ((PROGNAME)));     \\\n  CMDNAME[strlen ((PROGNAME))] = ' ';                     \\\n  strncpy (CMDNAME + strlen ((PROGNAME)) + 1, (CMD), strlen ((CMD)) + 1)\n\n/*\n * Command line option handling\n */\n\n/**\n * Initialize a command line option processor.\n *\n * @return the state that should be passed to other cli_ functions.\n */\ncli_state_t\ncli_init (const cli_opt_t *options_p, /**< array of option definitions, terminated by CLI_OPT_DEFAULT */\n          int argc, /**< number of command line arguments */\n          char **argv) /**< array of command line arguments */\n{\n  return (cli_state_t){ .error = NULL, .arg = NULL, .index = 1, .argc = argc, .argv = argv, .opts = options_p };\n} /* cli_init */\n\n/**\n * Use another option list.\n */\nvoid\ncli_change_opts (cli_state_t *state_p, /**< state of the command line option processor */\n                 const cli_opt_t *options_p) /**< array of option definitions, terminated by CLI_OPT_DEFAULT */\n{\n  state_p->opts = options_p;\n} /* cli_change_opts */\n\n/**\n * Checks whether the current argument is an option.\n *\n * Note:\n *   The state_p->error is not NULL on error and it contains the error message.\n *\n * @return the ID of the option that was found or a CLI_OPT_ constant otherwise.\n */\nint\ncli_consume_option (cli_state_t *state_p) /**< state of the command line option processor */\n{\n  if (state_p->error != NULL)\n  {\n    return CLI_OPT_END;\n  }\n\n  if (state_p->index >= state_p->argc)\n  {\n    state_p->arg = NULL;\n    return CLI_OPT_END;\n  }\n\n  const char *arg = state_p->argv[state_p->index];\n\n  state_p->arg = arg;\n\n  if (arg[0] != '-')\n  {\n    return CLI_OPT_DEFAULT;\n  }\n\n  if (arg[1] == '-')\n  {\n    arg += 2;\n\n    for (const cli_opt_t *opt = state_p->opts; opt->id != CLI_OPT_DEFAULT; opt++)\n    {\n      if (opt->longopt != NULL && strcmp (arg, opt->longopt) == 0)\n      {\n        state_p->index++;\n        return opt->id;\n      }\n    }\n\n    state_p->error = \"Unknown long option\";\n    return CLI_OPT_END;\n  }\n\n  arg++;\n\n  for (const cli_opt_t *opt = state_p->opts; opt->id != CLI_OPT_DEFAULT; opt++)\n  {\n    if (opt->opt != NULL && strcmp (arg, opt->opt) == 0)\n    {\n      state_p->index++;\n      return opt->id;\n    }\n  }\n\n  state_p->error = \"Unknown option\";\n  return CLI_OPT_END;\n} /* cli_consume_option */\n\n/**\n * Returns the next argument as string.\n *\n * Note:\n *   The state_p->error is not NULL on error and it contains the error message.\n *\n * @return argument string\n */\nconst char *\ncli_consume_string (cli_state_t *state_p) /**< state of the command line option processor */\n{\n  if (state_p->error != NULL)\n  {\n    return NULL;\n  }\n\n  if (state_p->index >= state_p->argc)\n  {\n    state_p->error = \"Expected string argument\";\n    state_p->arg = NULL;\n    return NULL;\n  }\n\n  state_p->arg = state_p->argv[state_p->index];\n\n  state_p->index++;\n  return state_p->arg;\n} /* cli_consume_string */\n\n/**\n * Returns the next argument as integer.\n *\n * Note:\n *   The state_p->error is not NULL on error and it contains the error message.\n *\n * @return argument integer\n */\nint\ncli_consume_int (cli_state_t *state_p) /**< state of the command line option processor */\n{\n  if (state_p->error != NULL)\n  {\n    return 0;\n  }\n\n  state_p->error = \"Expected integer argument\";\n\n  if (state_p->index >= state_p->argc)\n  {\n    state_p->arg = NULL;\n    return 0;\n  }\n\n  state_p->arg = state_p->argv[state_p->index];\n\n  char *endptr;\n  long int value = strtol (state_p->arg, &endptr, 10);\n\n  if (*endptr != '\\0')\n  {\n    return 0;\n  }\n\n  state_p->error = NULL;\n  state_p->index++;\n  return (int) value;\n} /* cli_consume_int */\n\n/**\n * Return next agument as path index.\n *\n * @return path index\n */\nuint32_t\ncli_consume_path (cli_state_t *state_p) /**< state of the command line option processor */\n{\n  if (state_p->error != NULL)\n  {\n    return 0;\n  }\n\n  uint32_t path_index = (uint32_t) state_p->index;\n  cli_consume_string (state_p);\n\n  return path_index;\n} /* cli_consume_path */\n\n/*\n * Print helper functions\n */\n\n/**\n * Pad with spaces.\n */\nstatic void\ncli_print_pad (int cnt) /**< number of spaces to print */\n{\n  for (int i = 0; i < cnt; i++)\n  {\n    printf (\" \");\n  }\n} /* cli_print_pad */\n\n/**\n * Print the prefix of a string.\n */\nstatic void\ncli_print_prefix (const char *str, /**< string to print */\n                  int len) /**< length of the prefix to print */\n{\n  for (int i = 0; i < len; i++)\n  {\n    printf (\"%c\", *str++);\n  }\n} /* cli_print_prefix */\n\n/**\n * Print usage summary of options.\n */\nstatic void\ncli_opt_usage (const char *prog_name_p, /**< program name, typically argv[0] */\n               const char *command_name_p, /**< command name if available */\n               const cli_opt_t *opts_p) /**< array of command line option definitions, terminated by CLI_OPT_DEFAULT */\n{\n  int length = (int) strlen (prog_name_p);\n  const cli_opt_t *current_opt_p = opts_p;\n\n  printf (\"%s\", prog_name_p);\n\n  if (command_name_p != NULL)\n  {\n    int command_length = (int) strlen (command_name_p);\n\n    if (length + 1 + command_length > CLI_LINE_LENGTH)\n    {\n      length = CLI_LINE_INDENT - 1;\n      printf (\"\\n\");\n      cli_print_pad (length);\n    }\n\n    printf (\" %s\", command_name_p);\n  }\n\n  while (current_opt_p->id != CLI_OPT_DEFAULT)\n  {\n    const char *opt_p = current_opt_p->opt;\n    int opt_length = 2 + 1;\n\n    if (opt_p == NULL)\n    {\n      opt_p = current_opt_p->longopt;\n      opt_length++;\n    }\n\n    opt_length += (int) strlen (opt_p);\n\n    if (length + 1 + opt_length >= CLI_LINE_LENGTH)\n    {\n      length = CLI_LINE_INDENT - 1;\n      printf (\"\\n\");\n      cli_print_pad (length);\n    }\n    length += opt_length;\n\n    printf (\" [\");\n\n    if (current_opt_p->opt != NULL)\n    {\n      printf (\"-%s\", opt_p);\n    }\n    else\n    {\n      printf (\"--%s\", opt_p);\n    }\n\n    if (current_opt_p->meta != NULL)\n    {\n      printf (\" %s\", current_opt_p->meta);\n    }\n\n    printf (\"]\");\n\n    current_opt_p++;\n  }\n\n  if (current_opt_p->meta != NULL)\n  {\n    const char *opt_p = current_opt_p->meta;\n    int opt_length = (int) (2 + strlen (opt_p));\n\n    if (length + 1 + opt_length >= CLI_LINE_LENGTH)\n    {\n      length = CLI_LINE_INDENT - 1;\n      printf (\"\\n\");\n      cli_print_pad (length);\n    }\n\n    printf (\" [%s]\", opt_p);\n  }\n\n  printf (\"\\n\\n\");\n} /* cli_opt_usage */\n\n/**\n * Print a help message wrapped into the second column.\n */\nstatic void\ncli_print_help (const char *help) /**< the help message to print */\n{\n  while (help != NULL && *help != 0)\n  {\n    int length = -1;\n    int i = 0;\n    for (; i < CLI_LINE_LENGTH - CLI_LINE_TAB && help[i] != 0; i++)\n    {\n      if (help[i] == ' ')\n      {\n        length = i;\n      }\n    }\n    if (length < 0 || i < CLI_LINE_LENGTH - CLI_LINE_TAB)\n    {\n      length = i;\n    }\n\n    cli_print_prefix (help, length);\n\n    help += length;\n    while (*help == ' ')\n    {\n      help++;\n    }\n\n    if (*help != 0)\n    {\n      printf (\"\\n\");\n      cli_print_pad (CLI_LINE_TAB);\n    }\n  }\n} /* cli_print_help */\n\n/**\n * Print detailed help for options.\n */\nvoid\ncli_help (const char *prog_name_p, /**< program name, typically argv[0] */\n          const char *command_name_p, /**< command name if available */\n          const cli_opt_t *options_p) /**< array of command line option definitions, terminated by CLI_OPT_DEFAULT */\n{\n  cli_opt_usage (prog_name_p, command_name_p, options_p);\n\n  const cli_opt_t *opt_p = options_p;\n\n  while (opt_p->id != CLI_OPT_DEFAULT)\n  {\n    int length = CLI_LINE_INDENT;\n    cli_print_pad (CLI_LINE_INDENT);\n\n    if (opt_p->opt != NULL)\n    {\n      printf (\"-%s\", opt_p->opt);\n      length += (int) (strlen (opt_p->opt) + 1);\n    }\n\n    if (opt_p->opt != NULL && opt_p->longopt != NULL)\n    {\n      printf (\", \");\n      length += 2;\n    }\n\n    if (opt_p->longopt != NULL)\n    {\n      printf (\"--%s\", opt_p->longopt);\n      length += (int) (strlen (opt_p->longopt) + 2);\n    }\n\n    if (opt_p->meta != NULL)\n    {\n      printf (\" %s\", opt_p->meta);\n      length += 1 + (int) strlen (opt_p->meta);\n    }\n\n    if (opt_p->help != NULL)\n    {\n      if (length >= CLI_LINE_TAB)\n      {\n        printf (\"\\n\");\n        length = 0;\n      }\n      cli_print_pad (CLI_LINE_TAB - length);\n      length = CLI_LINE_TAB;\n\n      cli_print_help (opt_p->help);\n    }\n\n    printf (\"\\n\");\n    opt_p++;\n  }\n\n  if (opt_p->help != NULL)\n  {\n    int length = 0;\n\n    if (opt_p->meta != NULL)\n    {\n      length = (int) (CLI_LINE_INDENT + strlen (opt_p->meta));\n\n      cli_print_pad (CLI_LINE_INDENT);\n      printf (\"%s\", opt_p->meta);\n    }\n\n    if (length >= CLI_LINE_TAB)\n    {\n      printf (\"\\n\");\n      length = 0;\n    }\n\n    cli_print_pad (CLI_LINE_TAB - length);\n\n    cli_print_help (opt_p->help);\n    printf (\"\\n\");\n  }\n} /* cli_help */\n"
  },
  {
    "path": "jerry-main/arguments/cli.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef CLI_H\n#define CLI_H\n\n#include <stdint.h>\n#include <string.h>\n\n/**\n * Command line option definition.\n */\ntypedef struct\n{\n  int id; /**< unique ID of the option (CLI_OPT_DEFAULT, or anything >= 0) */\n  const char *opt; /**< short option variant (in the form of \"x\" without dashes) */\n  const char *longopt; /**< long option variant (in the form of \"xxx\" without dashes) */\n  const char *meta; /**< name(s) of the argument(s) of the option, for display only */\n  const char *help; /**< descriptive help message of the option */\n} cli_opt_t;\n\n/**\n * Special marker for default option which also marks the end of the option list.\n */\n#define CLI_OPT_DEFAULT -1\n\n/**\n * Returned by cli_consume_option () when no more options are available\n * or an error occurred.\n */\n#define CLI_OPT_END -2\n\n/**\n * State of the sub-command processor.\n * No fields should be accessed other than error and arg.\n */\ntypedef struct\n{\n  /* Public fields. */\n  const char *error; /**< public field for error message */\n  const char *arg; /**< last processed argument as string */\n\n  /* Private fields. */\n  int index; /**< current argument index */\n  int argc; /**< remaining number of arguments */\n  char **argv; /**< remaining arguments */\n  const cli_opt_t *opts; /**< options */\n} cli_state_t;\n\n/**\n * Macro for writing command line option definition struct literals.\n */\n#define CLI_OPT_DEF(...) /*(cli_opt_t)*/ \\\n  {                                      \\\n    __VA_ARGS__                          \\\n  }\n\n/*\n * Functions for CLI.\n */\n\ncli_state_t cli_init (const cli_opt_t *options_p, int argc, char **argv);\nvoid cli_change_opts (cli_state_t *state_p, const cli_opt_t *options_p);\nint cli_consume_option (cli_state_t *state_p);\nconst char *cli_consume_string (cli_state_t *state_p);\nint cli_consume_int (cli_state_t *state_p);\nuint32_t cli_consume_path (cli_state_t *state_p);\nvoid cli_help (const char *prog_name_p, const char *command_name_p, const cli_opt_t *options_p);\n\n#endif /* !CLI_H */\n"
  },
  {
    "path": "jerry-main/arguments/options.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"options.h\"\n\n#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"cli.h\"\n#include \"jerryscript-ext/print.h\"\n\n/**\n * Command line option IDs\n */\ntypedef enum\n{\n  OPT_HELP,\n  OPT_VERSION,\n  OPT_MEM_STATS,\n  OPT_TEST262_OBJECT,\n  OPT_PARSE_ONLY,\n  OPT_SHOW_OP,\n  OPT_SHOW_RE_OP,\n  OPT_DEBUG_SERVER,\n  OPT_DEBUG_PORT,\n  OPT_DEBUG_CHANNEL,\n  OPT_DEBUG_PROTOCOL,\n  OPT_DEBUG_SERIAL_CONFIG,\n  OPT_DEBUGGER_WAIT_SOURCE,\n  OPT_EXEC_SNAP,\n  OPT_EXEC_SNAP_FUNC,\n  OPT_MODULE,\n  OPT_LOG_LEVEL,\n  OPT_NO_PROMPT,\n  OPT_CALL_ON_EXIT,\n  OPT_USE_STDIN,\n} main_opt_id_t;\n\n/**\n * Command line options\n */\nstatic const cli_opt_t main_opts[] = {\n  CLI_OPT_DEF (.id = OPT_HELP, .opt = \"h\", .longopt = \"help\", .help = \"print this help and exit\"),\n  CLI_OPT_DEF (.id = OPT_VERSION, .opt = \"v\", .longopt = \"version\", .help = \"print tool and library version and exit\"),\n  CLI_OPT_DEF (.id = OPT_MEM_STATS, .longopt = \"mem-stats\", .help = \"dump memory statistics\"),\n  CLI_OPT_DEF (.id = OPT_TEST262_OBJECT, .longopt = \"test262-object\", .help = \"create test262 object\"),\n  CLI_OPT_DEF (.id = OPT_PARSE_ONLY, .longopt = \"parse-only\", .help = \"don't execute JS input\"),\n  CLI_OPT_DEF (.id = OPT_SHOW_OP, .longopt = \"show-opcodes\", .help = \"dump parser byte-code\"),\n  CLI_OPT_DEF (.id = OPT_SHOW_RE_OP, .longopt = \"show-regexp-opcodes\", .help = \"dump regexp byte-code\"),\n  CLI_OPT_DEF (.id = OPT_DEBUG_SERVER,\n               .longopt = \"start-debug-server\",\n               .help = \"start debug server and wait for a connecting client\"),\n  CLI_OPT_DEF (.id = OPT_DEBUG_PORT,\n               .longopt = \"debug-port\",\n               .meta = \"NUM\",\n               .help = \"debug server port (default: 5001)\"),\n  CLI_OPT_DEF (.id = OPT_DEBUG_CHANNEL,\n               .longopt = \"debug-channel\",\n               .meta = \"[websocket|rawpacket]\",\n               .help = \"Specify the debugger transmission channel (default: websocket)\"),\n  CLI_OPT_DEF (.id = OPT_DEBUG_PROTOCOL,\n               .longopt = \"debug-protocol\",\n               .meta = \"PROTOCOL\",\n               .help = \"Specify the transmission protocol over the communication channel (tcp|serial, default: tcp)\"),\n  CLI_OPT_DEF (.id = OPT_DEBUG_SERIAL_CONFIG,\n               .longopt = \"serial-config\",\n               .meta = \"OPTIONS_STRING\",\n               .help = \"Configure parameters for serial port (default: /dev/ttyS0,115200,8,N,1)\"),\n  CLI_OPT_DEF (.id = OPT_DEBUGGER_WAIT_SOURCE,\n               .longopt = \"debugger-wait-source\",\n               .help = \"wait for an executable source from the client\"),\n  CLI_OPT_DEF (.id = OPT_EXEC_SNAP,\n               .longopt = \"exec-snapshot\",\n               .meta = \"FILE\",\n               .help = \"execute input snapshot file(s)\"),\n  CLI_OPT_DEF (.id = OPT_EXEC_SNAP_FUNC,\n               .longopt = \"exec-snapshot-func\",\n               .meta = \"FILE NUM\",\n               .help = \"execute specific function from input snapshot file(s)\"),\n  CLI_OPT_DEF (.id = OPT_MODULE, .opt = \"m\", .longopt = \"module\", .meta = \"FILE\", .help = \"execute module file\"),\n  CLI_OPT_DEF (.id = OPT_LOG_LEVEL, .longopt = \"log-level\", .meta = \"NUM\", .help = \"set log level (0-3)\"),\n  CLI_OPT_DEF (.id = OPT_NO_PROMPT, .longopt = \"no-prompt\", .help = \"don't print prompt in REPL mode\"),\n  CLI_OPT_DEF (.id = OPT_CALL_ON_EXIT,\n               .longopt = \"call-on-exit\",\n               .meta = \"STRING\",\n               .help = \"invoke the specified function when the process is just about to exit\"),\n  CLI_OPT_DEF (.id = OPT_USE_STDIN, .opt = \"\", .help = \"read from standard input\"),\n  CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = \"FILE\", .help = \"input JS file(s)\")\n};\n\n/**\n * Check whether a usage-related condition holds. If not, print an error\n * message, print the usage, and terminate the application.\n */\nstatic bool\ncheck_usage (bool condition, /**< the condition that must hold */\n             const char *name, /**< name of the application (argv[0]) */\n             const char *msg, /**< error message to print if condition does not hold */\n             const char *opt) /**< optional part of the error message */\n{\n  if (!condition)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"%s: %s%s\\n\", name, msg, opt != NULL ? opt : \"\");\n    return false;\n  }\n\n  return true;\n} /* check_usage */\n\n/**\n * Check whether JerryScript has a requested feature enabled or not. If not,\n * print a warning message.\n *\n * @return the status of the feature.\n */\nstatic bool\ncheck_feature (jerry_feature_t feature, /**< feature to check */\n               const char *option) /**< command line option that triggered this check */\n{\n  if (!jerry_feature_enabled (feature))\n  {\n    jerry_log_set_level (JERRY_LOG_LEVEL_WARNING);\n    jerry_log (JERRY_LOG_LEVEL_WARNING, \"Ignoring '%s' option because this feature is disabled!\\n\", option);\n    return false;\n  }\n\n  return true;\n} /* check_feature */\n\n/**\n * Parse input arguments\n *\n * @return true, if application should continue execution\n *         false, if application should exit\n */\nbool\nmain_parse_args (int argc, /**< argc */\n                 char **argv, /**< argv */\n                 main_args_t *arguments_p) /**< [in/out] arguments reference */\n{\n  arguments_p->source_count = 0;\n\n  arguments_p->debug_channel = \"websocket\";\n  arguments_p->debug_protocol = \"tcp\";\n  arguments_p->debug_serial_config = \"/dev/ttyS0,115200,8,N,1\";\n  arguments_p->debug_port = 5001;\n\n  arguments_p->exit_cb_name_p = NULL;\n  arguments_p->init_flags = JERRY_INIT_EMPTY;\n  arguments_p->option_flags = OPT_FLAG_EMPTY;\n\n  arguments_p->parse_result = JERRY_STANDALONE_EXIT_CODE_FAIL;\n\n  cli_state_t cli_state = cli_init (main_opts, argc, argv);\n  for (int id = cli_consume_option (&cli_state); id != CLI_OPT_END; id = cli_consume_option (&cli_state))\n  {\n    switch (id)\n    {\n      case OPT_HELP:\n      {\n        cli_help (argv[0], NULL, main_opts);\n\n        arguments_p->parse_result = JERRY_STANDALONE_EXIT_CODE_OK;\n        return false;\n      }\n      case OPT_VERSION:\n      {\n        printf (\"Version: %d.%d.%d%s\\n\",\n                JERRY_API_MAJOR_VERSION,\n                JERRY_API_MINOR_VERSION,\n                JERRY_API_PATCH_VERSION,\n                JERRY_COMMIT_HASH);\n\n        arguments_p->parse_result = JERRY_STANDALONE_EXIT_CODE_OK;\n        return false;\n      }\n      case OPT_MEM_STATS:\n      {\n        if (check_feature (JERRY_FEATURE_HEAP_STATS, cli_state.arg))\n        {\n          jerry_log_set_level (JERRY_LOG_LEVEL_DEBUG);\n          arguments_p->init_flags |= JERRY_INIT_MEM_STATS;\n        }\n        break;\n      }\n      case OPT_TEST262_OBJECT:\n      {\n        arguments_p->option_flags |= OPT_FLAG_TEST262_OBJECT;\n        break;\n      }\n      case OPT_PARSE_ONLY:\n      {\n        arguments_p->option_flags |= OPT_FLAG_PARSE_ONLY;\n        break;\n      }\n      case OPT_SHOW_OP:\n      {\n        if (check_feature (JERRY_FEATURE_PARSER_DUMP, cli_state.arg))\n        {\n          jerry_log_set_level (JERRY_LOG_LEVEL_DEBUG);\n          arguments_p->init_flags |= JERRY_INIT_SHOW_OPCODES;\n        }\n        break;\n      }\n      case OPT_CALL_ON_EXIT:\n      {\n        arguments_p->exit_cb_name_p = cli_consume_string (&cli_state);\n        break;\n      }\n      case OPT_SHOW_RE_OP:\n      {\n        if (check_feature (JERRY_FEATURE_REGEXP_DUMP, cli_state.arg))\n        {\n          jerry_log_set_level (JERRY_LOG_LEVEL_DEBUG);\n          arguments_p->init_flags |= JERRY_INIT_SHOW_REGEXP_OPCODES;\n        }\n        break;\n      }\n      case OPT_DEBUG_SERVER:\n      {\n        if (check_feature (JERRY_FEATURE_DEBUGGER, cli_state.arg))\n        {\n          arguments_p->option_flags |= OPT_FLAG_DEBUG_SERVER;\n        }\n        break;\n      }\n      case OPT_DEBUG_PORT:\n      {\n        if (check_feature (JERRY_FEATURE_DEBUGGER, cli_state.arg))\n        {\n          arguments_p->debug_port = (uint16_t) cli_consume_int (&cli_state);\n        }\n        break;\n      }\n      case OPT_DEBUG_CHANNEL:\n      {\n        if (check_feature (JERRY_FEATURE_DEBUGGER, cli_state.arg))\n        {\n          const char *debug_channel = cli_consume_string (&cli_state);\n          if (!check_usage (!strcmp (debug_channel, \"websocket\") || !strcmp (debug_channel, \"rawpacket\"),\n                            argv[0],\n                            \"Error: invalid value for --debug-channel: \",\n                            cli_state.arg))\n          {\n            return false;\n          }\n\n          arguments_p->debug_channel = debug_channel;\n        }\n        break;\n      }\n      case OPT_DEBUG_PROTOCOL:\n      {\n        if (check_feature (JERRY_FEATURE_DEBUGGER, cli_state.arg))\n        {\n          const char *debug_protocol = cli_consume_string (&cli_state);\n\n          if (!check_usage (!strcmp (debug_protocol, \"tcp\") || !strcmp (debug_protocol, \"serial\"),\n                            argv[0],\n                            \"Error: invalid value for --debug-protocol: \",\n                            cli_state.arg))\n          {\n            return false;\n          }\n\n          arguments_p->debug_protocol = debug_protocol;\n        }\n        break;\n      }\n      case OPT_DEBUG_SERIAL_CONFIG:\n      {\n        if (check_feature (JERRY_FEATURE_DEBUGGER, cli_state.arg))\n        {\n          arguments_p->debug_serial_config = cli_consume_string (&cli_state);\n        }\n        break;\n      }\n      case OPT_DEBUGGER_WAIT_SOURCE:\n      {\n        if (check_feature (JERRY_FEATURE_DEBUGGER, cli_state.arg))\n        {\n          arguments_p->option_flags |= OPT_FLAG_WAIT_SOURCE;\n        }\n        break;\n      }\n      case OPT_EXEC_SNAP:\n      {\n        const bool is_enabled = check_feature (JERRY_FEATURE_SNAPSHOT_EXEC, cli_state.arg);\n        const uint32_t path_index = cli_consume_path (&cli_state);\n\n        if (is_enabled)\n        {\n          main_source_t *source_p = arguments_p->sources_p + arguments_p->source_count;\n          arguments_p->source_count++;\n\n          source_p->type = SOURCE_SNAPSHOT;\n          source_p->path_index = path_index;\n          source_p->snapshot_index = 0;\n        }\n\n        break;\n      }\n      case OPT_EXEC_SNAP_FUNC:\n      {\n        const bool is_enabled = check_feature (JERRY_FEATURE_SNAPSHOT_EXEC, cli_state.arg);\n        const uint32_t path_index = cli_consume_path (&cli_state);\n        const uint16_t snapshot_index = (uint16_t) cli_consume_int (&cli_state);\n\n        if (is_enabled)\n        {\n          main_source_t *source_p = arguments_p->sources_p + arguments_p->source_count;\n          arguments_p->source_count++;\n\n          source_p->type = SOURCE_SNAPSHOT;\n          source_p->path_index = path_index;\n          source_p->snapshot_index = snapshot_index;\n        }\n\n        break;\n      }\n      case OPT_MODULE:\n      {\n        const uint32_t path_index = cli_consume_path (&cli_state);\n\n        main_source_t *source_p = arguments_p->sources_p + arguments_p->source_count;\n        arguments_p->source_count++;\n\n        source_p->type = SOURCE_MODULE;\n        source_p->path_index = path_index;\n        source_p->snapshot_index = 0;\n\n        break;\n      }\n      case OPT_LOG_LEVEL:\n      {\n        long int log_level = cli_consume_int (&cli_state);\n        if (!check_usage (log_level >= 0 && log_level <= 3,\n                          argv[0],\n                          \"Error: invalid value for --log-level: \",\n                          cli_state.arg))\n        {\n          return false;\n        }\n\n        jerry_log_set_level ((jerry_log_level_t) log_level);\n        break;\n      }\n      case OPT_NO_PROMPT:\n      {\n        arguments_p->option_flags |= OPT_FLAG_NO_PROMPT;\n        break;\n      }\n      case OPT_USE_STDIN:\n      {\n        arguments_p->option_flags |= OPT_FLAG_USE_STDIN;\n        break;\n      }\n      case CLI_OPT_DEFAULT:\n      {\n        main_source_t *source_p = arguments_p->sources_p + arguments_p->source_count;\n        arguments_p->source_count++;\n\n        source_p->type = SOURCE_SCRIPT;\n        source_p->path_index = cli_consume_path (&cli_state);\n        break;\n      }\n      default:\n      {\n        cli_state.error = \"Internal error\";\n        break;\n      }\n    }\n  }\n\n  if (cli_state.error != NULL)\n  {\n    if (cli_state.arg != NULL)\n    {\n      jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: %s %s\\n\", cli_state.error, cli_state.arg);\n    }\n    else\n    {\n      jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: %s\\n\", cli_state.error);\n    }\n\n    return false;\n  }\n\n  arguments_p->parse_result = JERRY_STANDALONE_EXIT_CODE_OK;\n  return true;\n} /* main_parse_args */\n"
  },
  {
    "path": "jerry-main/arguments/options.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef MAIN_OPTIONS_H\n#define MAIN_OPTIONS_H\n\n#include <stdbool.h>\n#include <stdint.h>\n\n/**\n * Standalone Jerry exit codes\n */\n#define JERRY_STANDALONE_EXIT_CODE_OK   (0)\n#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)\n\n/**\n * Argument option flags.\n */\ntypedef enum\n{\n  OPT_FLAG_EMPTY = 0,\n  OPT_FLAG_PARSE_ONLY = (1 << 0),\n  OPT_FLAG_DEBUG_SERVER = (1 << 1),\n  OPT_FLAG_WAIT_SOURCE = (1 << 2),\n  OPT_FLAG_NO_PROMPT = (1 << 3),\n  OPT_FLAG_USE_STDIN = (1 << 4),\n  OPT_FLAG_TEST262_OBJECT = (1u << 5),\n} main_option_flags_t;\n\n/**\n * Source types\n */\ntypedef enum\n{\n  SOURCE_SNAPSHOT,\n  SOURCE_MODULE,\n  SOURCE_SCRIPT,\n} main_source_type_t;\n\n/**\n * Input source file.\n */\ntypedef struct\n{\n  uint32_t path_index;\n  uint16_t snapshot_index;\n  uint16_t type;\n} main_source_t;\n\n/**\n * Arguments struct to store parsed command line arguments.\n */\ntypedef struct\n{\n  main_source_t *sources_p;\n  uint32_t source_count;\n\n  const char *debug_channel;\n  const char *debug_protocol;\n  const char *debug_serial_config;\n  uint16_t debug_port;\n\n  const char *exit_cb_name_p;\n\n  uint16_t option_flags;\n  uint16_t init_flags;\n  uint8_t parse_result;\n} main_args_t;\n\nbool main_parse_args (int argc, char **argv, main_args_t *arguments_p);\n\n#endif /* !MAIN_OPTIONS_H */\n"
  },
  {
    "path": "jerry-main/benchmark/main-benchmark.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n/**\n * Maximum size of source code / snapshots buffer\n */\n#define JERRY_BUFFER_SIZE (1048576)\n\n/**\n * Standalone Jerry exit codes\n */\n#define JERRY_STANDALONE_EXIT_CODE_OK   (0)\n#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)\n\nstatic uint8_t buffer[JERRY_BUFFER_SIZE];\n\nstatic const uint8_t *\nread_file (const char *file_name, size_t *out_size_p)\n{\n  FILE *file = fopen (file_name, \"rb\");\n  if (file == NULL)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: failed to open file: %s\\n\", file_name);\n    return NULL;\n  }\n\n  size_t bytes_read = fread (buffer, 1u, sizeof (buffer), file);\n  if (!bytes_read)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: failed to read file: %s\\n\", file_name);\n    fclose (file);\n    return NULL;\n  }\n\n  fclose (file);\n\n  *out_size_p = bytes_read;\n  return (const uint8_t *) buffer;\n} /* read_file */\n\nstatic void\nprint_help (char *name)\n{\n  printf (\"Usage: %s [OPTION]... [FILE]...\\n\"\n          \"\\n\"\n          \"Options:\\n\"\n          \"  -h, --help\\n\"\n          \"\\n\",\n          name);\n} /* print_help */\n\n/* Global \"argc\" and \"argv\" used to avoid argument passing via stack. */\nstatic int argc;\nstatic char **argv;\n\nstatic JERRY_ATTR_NOINLINE int\nrun (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n  jerry_value_t ret_value = jerry_undefined ();\n\n  for (int i = 1; i < argc; i++)\n  {\n    const char *file_name = argv[i];\n    size_t source_size;\n\n    const jerry_char_t *source_p = read_file (file_name, &source_size);\n\n    if (source_p == NULL)\n    {\n      ret_value = jerry_throw_sz (JERRY_ERROR_COMMON, \"\");\n      break;\n    }\n    else\n    {\n      ret_value = jerry_parse (source_p, source_size, NULL);\n\n      if (!jerry_value_is_exception (ret_value))\n      {\n        jerry_value_t func_val = ret_value;\n        ret_value = jerry_run (func_val);\n        jerry_value_free (func_val);\n      }\n    }\n\n    if (jerry_value_is_exception (ret_value))\n    {\n      break;\n    }\n\n    jerry_value_free (ret_value);\n    ret_value = jerry_undefined ();\n  }\n\n  int ret_code =\n    !jerry_value_is_exception (ret_value) ? JERRY_STANDALONE_EXIT_CODE_OK : JERRY_STANDALONE_EXIT_CODE_FAIL;\n\n  jerry_value_free (ret_value);\n  jerry_cleanup ();\n\n  return ret_code;\n} /* run */\n\n#if defined(JERRY_TEST_STACK_MEASURE) && (JERRY_TEST_STACK_MEASURE)\n\n/**\n * How this stack measuring works:\n *\n * 1) Get the current stack pointer before doing the test execution.\n *    This will be the \"Stack bottom\".\n * 2) Fill the stack towards lower addresses with a placeholder 32 bit value.\n *    A \"STACK_MEASURE_RANGE\" big area will be filled with the value starting\n *    from \"Stack bottom\".\n *    The \"Stack bottom\" + \"STACK_MEASURE_RANGE\" will be the \"Stack top\".\n * 3) Run the tests.\n * 4) Check the stack backwards from \"Stack top\" to see where the 32 bit placeholder\n *    value is not present. The point where the 32 bit value is not found is\n *    considered to be the \"Stack max\". The \"Stack bottom\" - \"Stack max\" substraction\n *    will give the stack usage in bytes.\n *\n *\n * Based on this the expected stack layout is:\n * The stack is expected to \"grow\" towards lower address.\n *\n * |-------|\n * |       |    <- low address - \"Stack top\"\n * |-------|\n * |       |\n * |-------|\n *    ....\n * |-------|\n * |       |    <- \"Stack max\"\n * |-------|\n *    ....\n * |-------|\n * |       |    <- high address - \"Stack bottom\"\n * |-------|\n *\n */\n\n#if !(defined(__linux__) && __linux__)\n#error \"Unsupported stack measurement platform!\"\n#endif /* !(defined ( __linux__) && __linux__) */\n\n#if defined(__x86_64__)\n#define STACK_SAVE(TARGET)                           \\\n  {                                                  \\\n    __asm volatile (\"mov %%rsp, %0\" : \"=m\"(TARGET)); \\\n  }\n#elif defined(__i386__)\n#define STACK_SAVE(TARGET)                           \\\n  {                                                  \\\n    __asm volatile (\"mov %%esp, %0\" : \"=m\"(TARGET)); \\\n  }\n#elif defined(__arm__)\n#define STACK_SAVE(TARGET)                        \\\n  {                                               \\\n    __asm volatile (\"mov %0, sp\" : \"=r\"(TARGET)); \\\n  }\n#else /* !defined (__x86_64__) && !defined (__i386__) && !defined (__arm__) */\n#error \"Unsupported stack measurement target!\"\n#endif /* !defined (__x86_64__) && !defined (__i386__) && !defined (__arm__) */\n\nstatic void *g_stack_bottom = 0x0;\n\n#define STACK_MEASURE_RANGE ((2 * 1024 * 1024))\n#define STACK_PATTERN       (0xDEADBEEF)\n#define STACK_INIT(TARGET, SIZE)                                  \\\n  do                                                              \\\n  {                                                               \\\n    for (size_t idx = 0; idx < (SIZE / sizeof (uint32_t)); idx++) \\\n    {                                                             \\\n      ((uint32_t *) (TARGET))[idx] = STACK_PATTERN;               \\\n    }                                                             \\\n  } while (0)\n\n#define STACK_USAGE(TARGET, SIZE)   stack_usage (TARGET, SIZE)\n#define STACK_TOP_PTR(TARGET, SIZE) (uint32_t *) (((uint8_t *) TARGET) - SIZE)\n\nstatic void\nstack_usage (uint32_t *stack_top_p, size_t length_in_bytes)\n{\n  uint32_t *stack_bottom_p = stack_top_p + (length_in_bytes / sizeof (uint32_t));\n  uint32_t *stack_p = stack_top_p;\n\n  while (stack_p < stack_bottom_p)\n  {\n    if (*stack_p != STACK_PATTERN)\n    {\n      break;\n    }\n    stack_p++;\n  }\n\n  jerry_log (JERRY_LOG_LEVEL_ERROR,\n             \"Used stack: %u\\n\",\n             (unsigned int) ((uint8_t *) stack_bottom_p - (uint8_t *) stack_p));\n} /* stack_usage */\n\n#else /* (JERRY_TEST_STACK_MEASURE) && (JERRY_TEST_STACK_MEASURE) */\n#define STACK_SAVE(TARGET)\n#define STACK_INIT(TARGET, SIZE)\n#define STACK_USAGE(TARGET, SIZE)\n#endif /* #if defined (JERRY_TEST_STACK_MEASURE) && (JERRY_TEST_STACK_MEASURE) */\n\nint\nmain (int main_argc, char **main_argv)\n{\n  union\n  {\n    double d;\n    unsigned u;\n  } now = { .d = jerry_port_current_time () };\n  srand (now.u);\n\n  argc = main_argc;\n  argv = main_argv;\n\n  if (argc <= 1 || (argc == 2 && (!strcmp (\"-h\", argv[1]) || !strcmp (\"--help\", argv[1]))))\n  {\n    print_help (argv[0]);\n    return JERRY_STANDALONE_EXIT_CODE_OK;\n  }\n\n  STACK_SAVE (g_stack_bottom);\n  STACK_INIT (STACK_TOP_PTR (g_stack_bottom, STACK_MEASURE_RANGE), STACK_MEASURE_RANGE);\n\n  int result = run ();\n\n  STACK_USAGE (STACK_TOP_PTR (g_stack_bottom, STACK_MEASURE_RANGE), STACK_MEASURE_RANGE);\n\n  if (result == JERRY_STANDALONE_EXIT_CODE_FAIL)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Unhandled exception: Script Error!\\n\");\n  }\n\n  return result;\n} /* main */\n"
  },
  {
    "path": "jerry-main/benchmark/stubs.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * This source contains libc overrides for the sake of stable benchmarking. If\n * building a binary for the purpose of benchmarking, the object compiled from\n * this source is to be injected into the list of objects-to-be-linked before\n * the list of libraries-to-be-linked to ensure that the linker picks up these\n * implementations.\n */\n\n#ifdef __GNUC__\n/*\n * Note:\n *      This is nasty and dangerous. However, we only need the timeval structure\n *      from sys/time.h. Unfortunately, the same header also declares\n *      gettimeofday, which has different declarations on different platforms\n *      (e.g., macOS, Linux). So, instead of #ifdef'ing for platforms, we simply\n *      tweak the header to declare another function. Don't try this at home.\n */\n#define gettimeofday __prevent_conflicting_gettimeofday_declarations__\n#include <sys/time.h>\n#undef gettimeofday\n\nint gettimeofday (struct timeval *, void *);\n\n/**\n * Useless but stable gettimeofday implementation. Returns Epoch. Ensures that\n * test cases relying on \"now\" yield stable results.\n */\nint\ngettimeofday (struct timeval *tv, void *tz)\n{\n  (void) tz;\n  tv->tv_sec = 0;\n  tv->tv_usec = 0;\n  return 0;\n} /* gettimeofday */\n#endif /* __GNUC__ */\n\nint rand (void);\n\n/**\n * Useless but stable rand implementation. Returns 4. Ensures that test cases\n * relying on randomness yield stable results.\n */\nint\nrand (void)\n{\n  return 4; /* Chosen by fair dice roll. Guaranteed to be random. */\n} /* rand */\n"
  },
  {
    "path": "jerry-main/main-desktop.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"arguments/options.h\"\n#include \"jerryscript-ext/debugger.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/print.h\"\n#include \"jerryscript-ext/properties.h\"\n#include \"jerryscript-ext/repl.h\"\n#include \"jerryscript-ext/sources.h\"\n#include \"jerryscript-ext/test262.h\"\n\n/**\n * Initialize random seed\n */\nstatic void\nmain_init_random_seed (void)\n{\n  union\n  {\n    double d;\n    unsigned u;\n  } now = { .d = jerry_port_current_time () };\n\n  srand (now.u);\n} /* main_init_random_seed */\n\n/**\n * Initialize debugger\n */\nstatic bool\nmain_init_debugger (main_args_t *arguments_p) /**< main arguments */\n{\n  bool result = false;\n\n  if (!strcmp (arguments_p->debug_protocol, \"tcp\"))\n  {\n    result = jerryx_debugger_tcp_create (arguments_p->debug_port);\n  }\n  else\n  {\n    assert (!strcmp (arguments_p->debug_protocol, \"serial\"));\n    result = jerryx_debugger_serial_create (arguments_p->debug_serial_config);\n  }\n\n  if (!strcmp (arguments_p->debug_channel, \"rawpacket\"))\n  {\n    result = result && jerryx_debugger_rp_create ();\n  }\n  else\n  {\n    assert (!strcmp (arguments_p->debug_channel, \"websocket\"));\n    result = result && jerryx_debugger_ws_create ();\n  }\n\n  jerryx_debugger_after_connect (result);\n  return result;\n} /* main_init_debugger */\n\n/**\n * Inits the engine and the debugger\n */\nstatic void\nmain_init_engine (main_args_t *arguments_p) /**< main arguments */\n{\n  jerry_init (arguments_p->init_flags);\n\n  jerry_promise_on_event (JERRY_PROMISE_EVENT_FILTER_ERROR, jerryx_handler_promise_reject, NULL);\n\n  if (arguments_p->option_flags & OPT_FLAG_DEBUG_SERVER)\n  {\n    if (!main_init_debugger (arguments_p))\n    {\n      jerry_log (JERRY_LOG_LEVEL_WARNING, \"Failed to initialize debugger!\\n\");\n    }\n  }\n\n  if (arguments_p->option_flags & OPT_FLAG_TEST262_OBJECT)\n  {\n    jerryx_test262_register ();\n  }\n\n  jerryx_register_global (\"assert\", jerryx_handler_assert);\n  jerryx_register_global (\"gc\", jerryx_handler_gc);\n  jerryx_register_global (\"print\", jerryx_handler_print);\n  jerryx_register_global (\"sourceName\", jerryx_handler_source_name);\n  jerryx_register_global (\"createRealm\", jerryx_handler_create_realm);\n} /* main_init_engine */\n\nint\nmain (int argc, char **argv)\n{\n  main_init_random_seed ();\n  JERRY_VLA (main_source_t, sources_p, argc);\n\n  main_args_t arguments;\n  arguments.sources_p = sources_p;\n\n  if (!main_parse_args (argc, argv, &arguments))\n  {\n    return arguments.parse_result;\n  }\n\nrestart:\n  main_init_engine (&arguments);\n  int return_code = JERRY_STANDALONE_EXIT_CODE_FAIL;\n  jerry_value_t result;\n\n  for (uint32_t source_index = 0; source_index < arguments.source_count; source_index++)\n  {\n    main_source_t *source_file_p = sources_p + source_index;\n    const char *file_path_p = argv[source_file_p->path_index];\n\n    switch (source_file_p->type)\n    {\n      case SOURCE_MODULE:\n      {\n        result = jerryx_source_exec_module (file_path_p);\n        break;\n      }\n      case SOURCE_SNAPSHOT:\n      {\n        result = jerryx_source_exec_snapshot (file_path_p, source_file_p->snapshot_index);\n        break;\n      }\n      default:\n      {\n        assert (source_file_p->type == SOURCE_SCRIPT);\n\n        if ((arguments.option_flags & OPT_FLAG_PARSE_ONLY) != 0)\n        {\n          result = jerryx_source_parse_script (file_path_p);\n        }\n        else\n        {\n          result = jerryx_source_exec_script (file_path_p);\n        }\n\n        break;\n      }\n    }\n\n    if (jerry_value_is_exception (result))\n    {\n      if (jerryx_debugger_is_reset (result))\n      {\n        jerry_cleanup ();\n\n        goto restart;\n      }\n\n      jerryx_print_unhandled_exception (result);\n      goto exit;\n    }\n\n    jerry_value_free (result);\n  }\n\n  if (arguments.option_flags & OPT_FLAG_WAIT_SOURCE)\n  {\n    while (true)\n    {\n      jerry_debugger_wait_for_source_status_t receive_status;\n      receive_status = jerry_debugger_wait_for_client_source (jerryx_handler_source_received, NULL, &result);\n\n      if (receive_status == JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED)\n      {\n        jerry_log (JERRY_LOG_LEVEL_ERROR, \"Connection aborted before source arrived.\");\n        goto exit;\n      }\n\n      if (receive_status == JERRY_DEBUGGER_SOURCE_END)\n      {\n        jerry_log (JERRY_LOG_LEVEL_DEBUG, \"No more client source.\\n\");\n        break;\n      }\n\n      assert (receive_status == JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED\n              || receive_status == JERRY_DEBUGGER_SOURCE_RECEIVED);\n\n      if (receive_status == JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED || jerryx_debugger_is_reset (result))\n      {\n        jerry_cleanup ();\n        goto restart;\n      }\n\n      assert (receive_status == JERRY_DEBUGGER_SOURCE_RECEIVED);\n      jerry_value_free (result);\n    }\n  }\n  else if (arguments.option_flags & OPT_FLAG_USE_STDIN)\n  {\n    result = jerryx_source_exec_stdin ();\n\n    if (jerry_value_is_exception (result))\n    {\n      jerryx_print_unhandled_exception (result);\n      goto exit;\n    }\n\n    jerry_value_free (result);\n  }\n  else if (arguments.source_count == 0)\n  {\n    if ((arguments.option_flags & OPT_FLAG_NO_PROMPT))\n    {\n      jerryx_repl (JERRY_ZSTR_ARG (\"\"));\n    }\n    else\n    {\n      jerryx_repl (JERRY_ZSTR_ARG (\"jerry> \"));\n    }\n  }\n\n  result = jerry_run_jobs ();\n\n  if (jerry_value_is_exception (result))\n  {\n    jerryx_print_unhandled_exception (result);\n    goto exit;\n  }\n\n  jerry_value_free (result);\n\n  if (arguments.exit_cb_name_p != NULL)\n  {\n    jerry_value_t global = jerry_current_realm ();\n    jerry_value_t callback_fn = jerry_object_get_sz (global, arguments.exit_cb_name_p);\n    jerry_value_free (global);\n\n    if (jerry_value_is_function (callback_fn))\n    {\n      result = jerry_call (callback_fn, jerry_undefined (), NULL, 0);\n\n      if (jerry_value_is_exception (result))\n      {\n        jerryx_print_unhandled_exception (result);\n        goto exit;\n      }\n\n      jerry_value_free (result);\n    }\n\n    jerry_value_free (callback_fn);\n  }\n\n  return_code = JERRY_STANDALONE_EXIT_CODE_OK;\n\nexit:\n  jerry_cleanup ();\n\n  return return_code;\n} /* main */\n"
  },
  {
    "path": "jerry-main/main-libfuzzer.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdlib.h>\n\n#include \"jerryscript.h\"\n\nint\nLLVMFuzzerTestOneInput (const uint8_t *data, size_t size)\n{\n  srand (0);\n  jerry_init (JERRY_INIT_EMPTY);\n\n  if (jerry_validate_string ((jerry_char_t *) data, (jerry_size_t) size, JERRY_ENCODING_UTF8))\n  {\n    jerry_parse_options_t parse_options;\n    parse_options.options = JERRY_PARSE_NO_OPTS;\n    jerry_value_t parse_value = jerry_parse ((jerry_char_t *) data, size, &parse_options);\n\n    if (!jerry_value_is_exception (parse_value))\n    {\n      jerry_value_t run_value = jerry_run (parse_value);\n      jerry_value_free (run_value);\n\n      run_value = jerry_run_jobs ();\n      jerry_value_free (run_value);\n    }\n\n    jerry_value_free (parse_value);\n  }\n\n  jerry_cleanup ();\n\n  return 0;\n} /* LLVMFuzzerTestOneInput */\n"
  },
  {
    "path": "jerry-main/main-snapshot.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"arguments/cli.h\"\n\n/**\n * Maximum size for loaded snapshots\n */\n#define JERRY_BUFFER_SIZE (1048576)\n\n/**\n * Maximum number of loaded literals\n */\n#define JERRY_LITERAL_LENGTH (4096)\n\n/**\n * Standalone Jerry exit codes\n */\n#define JERRY_STANDALONE_EXIT_CODE_OK   (0)\n#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)\n\nstatic uint8_t input_buffer[JERRY_BUFFER_SIZE];\nstatic uint32_t output_buffer[JERRY_BUFFER_SIZE / 4];\nstatic jerry_char_t literal_buffer[JERRY_BUFFER_SIZE];\nstatic const char *output_file_name_p = \"js.snapshot\";\nstatic jerry_length_t magic_string_lengths[JERRY_LITERAL_LENGTH];\nstatic const jerry_char_t *magic_string_items[JERRY_LITERAL_LENGTH];\n\n/**\n * Check whether JerryScript has a requested feature enabled or not. If not,\n * print a warning message.\n *\n * @return the status of the feature.\n */\nstatic bool\ncheck_feature (jerry_feature_t feature, /**< feature to check */\n               const char *option) /**< command line option that triggered this check */\n{\n  if (!jerry_feature_enabled (feature))\n  {\n    jerry_log_set_level (JERRY_LOG_LEVEL_WARNING);\n    jerry_log (JERRY_LOG_LEVEL_WARNING, \"Ignoring '%s' option because this feature is disabled!\\n\", option);\n    return false;\n  }\n  return true;\n} /* check_feature */\n\n/**\n * Utility method to check and print error in the given cli state.\n *\n * @return true - if any error is detected\n *         false - if there is no error in the cli state\n */\nstatic bool\ncheck_cli_error (const cli_state_t *const cli_state_p)\n{\n  if (cli_state_p->error != NULL)\n  {\n    if (cli_state_p->arg != NULL)\n    {\n      jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: %s %s\\n\", cli_state_p->error, cli_state_p->arg);\n    }\n    else\n    {\n      jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: %s\\n\", cli_state_p->error);\n    }\n\n    return true;\n  }\n\n  return false;\n} /* check_cli_error */\n\n/**\n * Loading a single file into the memory.\n *\n * @return size of file - if loading is successful\n *         0 - otherwise\n */\nstatic size_t\nread_file (uint8_t *input_pos_p, /**< next position in the input buffer */\n           const char *file_name) /**< file name */\n{\n  FILE *file = fopen (file_name, \"rb\");\n\n  if (file == NULL)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: failed to open file: %s\\n\", file_name);\n    return 0;\n  }\n\n  size_t max_size = (size_t) (input_buffer + JERRY_BUFFER_SIZE - input_pos_p);\n\n  size_t bytes_read = fread (input_pos_p, 1u, max_size, file);\n  fclose (file);\n\n  if (bytes_read == 0)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: failed to read file: %s\\n\", file_name);\n    return 0;\n  }\n\n  if (bytes_read == max_size)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: file too large: %s\\n\", file_name);\n    return 0;\n  }\n\n  printf (\"Input file '%s' (%zu bytes) loaded.\\n\", file_name, bytes_read);\n  return bytes_read;\n} /* read_file */\n\n/**\n * Print error value\n */\nstatic void\nprint_unhandled_exception (jerry_value_t error_value) /**< error value */\n{\n  assert (!jerry_value_is_exception (error_value));\n\n  jerry_value_t err_str_val = jerry_value_to_string (error_value);\n\n  if (jerry_value_is_exception (err_str_val))\n  {\n    /* Avoid recursive error throws. */\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Snapshot error: [value cannot be converted to string]\\n\");\n    jerry_value_free (err_str_val);\n    return;\n  }\n\n  jerry_char_t err_str_buf[256];\n  jerry_size_t bytes = jerry_string_to_buffer (err_str_val, JERRY_ENCODING_UTF8, err_str_buf, sizeof (err_str_buf) - 1);\n  err_str_buf[bytes] = '\\0';\n\n  jerry_log (JERRY_LOG_LEVEL_ERROR, \"Snapshot error: %s\\n\", (char *) err_str_buf);\n  jerry_value_free (err_str_val);\n} /* print_unhandled_exception */\n\n/**\n * Generate command line option IDs\n */\ntypedef enum\n{\n  OPT_GENERATE_HELP,\n  OPT_GENERATE_STATIC,\n  OPT_GENERATE_SHOW_OP,\n  OPT_GENERATE_FUNCTION,\n  OPT_GENERATE_OUT,\n  OPT_IMPORT_LITERAL_LIST\n} generate_opt_id_t;\n\n/**\n * Generate command line options\n */\nstatic const cli_opt_t generate_opts[] = {\n  CLI_OPT_DEF (.id = OPT_GENERATE_HELP, .opt = \"h\", .longopt = \"help\", .help = \"print this help and exit\"),\n  CLI_OPT_DEF (.id = OPT_GENERATE_STATIC, .opt = \"s\", .longopt = \"static\", .help = \"generate static snapshot\"),\n  CLI_OPT_DEF (.id = OPT_GENERATE_FUNCTION,\n               .opt = \"f\",\n               .longopt = \"generate-function-snapshot\",\n               .meta = \"ARGUMENTS\",\n               .help = \"generate function snapshot with given arguments\"),\n  CLI_OPT_DEF (.id = OPT_IMPORT_LITERAL_LIST,\n               .longopt = \"load-literals-list-format\",\n               .meta = \"FILE\",\n               .help = \"import literals from list format (for static snapshots)\"),\n  CLI_OPT_DEF (.id = OPT_GENERATE_SHOW_OP, .longopt = \"show-opcodes\", .help = \"print generated opcodes\"),\n  CLI_OPT_DEF (.id = OPT_GENERATE_OUT,\n               .opt = \"o\",\n               .meta = \"FILE\",\n               .help = \"specify output file name (default: js.snapshot)\"),\n  CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = \"FILE\", .help = \"input source file\")\n};\n\n/**\n * Process 'generate' command.\n *\n * @return error code (0 - no error)\n */\nstatic int\nprocess_generate (cli_state_t *cli_state_p, /**< cli state */\n                  int argc, /**< number of arguments */\n                  char *prog_name_p) /**< program name */\n{\n  (void) argc;\n\n  uint32_t snapshot_flags = 0;\n  jerry_init_flag_t flags = JERRY_INIT_EMPTY;\n\n  const char *file_name_p = NULL;\n  uint8_t *source_p = input_buffer;\n  size_t source_length = 0;\n  const char *literals_file_name_p = NULL;\n  const char *function_args_p = NULL;\n\n  cli_change_opts (cli_state_p, generate_opts);\n\n  for (int id = cli_consume_option (cli_state_p); id != CLI_OPT_END; id = cli_consume_option (cli_state_p))\n  {\n    switch (id)\n    {\n      case OPT_GENERATE_HELP:\n      {\n        cli_help (prog_name_p, \"generate\", generate_opts);\n        return JERRY_STANDALONE_EXIT_CODE_OK;\n      }\n      case OPT_GENERATE_STATIC:\n      {\n        snapshot_flags |= JERRY_SNAPSHOT_SAVE_STATIC;\n        break;\n      }\n      case OPT_GENERATE_FUNCTION:\n      {\n        function_args_p = cli_consume_string (cli_state_p);\n        break;\n      }\n      case OPT_IMPORT_LITERAL_LIST:\n      {\n        literals_file_name_p = cli_consume_string (cli_state_p);\n        break;\n      }\n      case OPT_GENERATE_SHOW_OP:\n      {\n        if (check_feature (JERRY_FEATURE_PARSER_DUMP, cli_state_p->arg))\n        {\n          jerry_log_set_level (JERRY_LOG_LEVEL_DEBUG);\n          flags |= JERRY_INIT_SHOW_OPCODES;\n        }\n        break;\n      }\n      case OPT_GENERATE_OUT:\n      {\n        output_file_name_p = cli_consume_string (cli_state_p);\n        break;\n      }\n      case CLI_OPT_DEFAULT:\n      {\n        if (file_name_p != NULL)\n        {\n          jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: Exactly one input file must be specified\\n\");\n          return JERRY_STANDALONE_EXIT_CODE_FAIL;\n        }\n\n        file_name_p = cli_consume_string (cli_state_p);\n\n        if (cli_state_p->error == NULL)\n        {\n          source_length = read_file (source_p, file_name_p);\n\n          if (source_length == 0)\n          {\n            jerry_log (JERRY_LOG_LEVEL_ERROR, \"Input file is empty\\n\");\n            return JERRY_STANDALONE_EXIT_CODE_FAIL;\n          }\n        }\n        break;\n      }\n      default:\n      {\n        cli_state_p->error = \"Internal error\";\n        break;\n      }\n    }\n  }\n\n  if (check_cli_error (cli_state_p))\n  {\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  if (file_name_p == NULL)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: Exactly one input file must be specified\\n\");\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  jerry_init (flags);\n\n  if (!jerry_validate_string (source_p, (jerry_size_t) source_length, JERRY_ENCODING_UTF8))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: Input must be a valid UTF-8 string.\\n\");\n    jerry_cleanup ();\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  if (literals_file_name_p != NULL)\n  {\n    /* Import literal list */\n    uint8_t *sp_buffer_start_p = source_p + source_length + 1;\n    size_t sp_buffer_size = read_file (sp_buffer_start_p, literals_file_name_p);\n\n    if (sp_buffer_size > 0)\n    {\n      const char *sp_buffer_p = (const char *) sp_buffer_start_p;\n      uint32_t num_of_lit = 0;\n\n      do\n      {\n        char *sp_buffer_end_p = NULL;\n        jerry_length_t mstr_size = (jerry_length_t) strtol (sp_buffer_p, &sp_buffer_end_p, 10);\n        if (mstr_size > 0)\n        {\n          magic_string_items[num_of_lit] = (jerry_char_t *) (sp_buffer_end_p + 1);\n          magic_string_lengths[num_of_lit] = mstr_size;\n          num_of_lit++;\n        }\n        sp_buffer_p = sp_buffer_end_p + mstr_size + 1;\n      } while ((size_t) (sp_buffer_p - (char *) sp_buffer_start_p) < sp_buffer_size);\n\n      if (num_of_lit > 0)\n      {\n        jerry_register_magic_strings (magic_string_items, num_of_lit, magic_string_lengths);\n      }\n    }\n  }\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n  /* To avoid cppcheck warning. */\n  parse_options.argument_list = 0;\n  parse_options.source_name =\n    jerry_string ((const jerry_char_t *) file_name_p, (jerry_size_t) strlen (file_name_p), JERRY_ENCODING_UTF8);\n\n  if (function_args_p != NULL)\n  {\n    parse_options.options |= JERRY_PARSE_HAS_ARGUMENT_LIST;\n    parse_options.argument_list = jerry_string ((const jerry_char_t *) function_args_p,\n                                                (jerry_size_t) strlen (function_args_p),\n                                                JERRY_ENCODING_UTF8);\n  }\n\n  jerry_value_t snapshot_result = jerry_parse ((jerry_char_t *) source_p, source_length, &parse_options);\n\n  if (!jerry_value_is_exception (snapshot_result))\n  {\n    jerry_value_t parse_result = snapshot_result;\n    snapshot_result =\n      jerry_generate_snapshot (parse_result, snapshot_flags, output_buffer, sizeof (output_buffer) / sizeof (uint32_t));\n    jerry_value_free (parse_result);\n  }\n\n  if (parse_options.options & JERRY_PARSE_HAS_ARGUMENT_LIST)\n  {\n    jerry_value_free (parse_options.argument_list);\n  }\n\n  jerry_value_free (parse_options.source_name);\n\n  if (jerry_value_is_exception (snapshot_result))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: Generating snapshot failed!\\n\");\n\n    snapshot_result = jerry_exception_value (snapshot_result, true);\n\n    print_unhandled_exception (snapshot_result);\n\n    jerry_value_free (snapshot_result);\n    jerry_cleanup ();\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  size_t snapshot_size = (size_t) jerry_value_as_number (snapshot_result);\n  jerry_value_free (snapshot_result);\n\n  FILE *snapshot_file_p = fopen (output_file_name_p, \"wb\");\n  if (snapshot_file_p == NULL)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: Unable to write snapshot file: '%s'\\n\", output_file_name_p);\n    jerry_cleanup ();\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  fwrite (output_buffer, sizeof (uint8_t), snapshot_size, snapshot_file_p);\n  fclose (snapshot_file_p);\n\n  printf (\"Created snapshot file: '%s' (%zu bytes)\\n\", output_file_name_p, snapshot_size);\n\n  jerry_cleanup ();\n  return JERRY_STANDALONE_EXIT_CODE_OK;\n} /* process_generate */\n\n/**\n * Literal dump command line option IDs\n */\ntypedef enum\n{\n  OPT_LITERAL_DUMP_HELP,\n  OPT_LITERAL_DUMP_FORMAT,\n  OPT_LITERAL_DUMP_OUT,\n} literal_dump_opt_id_t;\n\n/**\n * Literal dump command line options\n */\nstatic const cli_opt_t literal_dump_opts[] = {\n  CLI_OPT_DEF (.id = OPT_LITERAL_DUMP_HELP, .opt = \"h\", .longopt = \"help\", .help = \"print this help and exit\"),\n  CLI_OPT_DEF (.id = OPT_LITERAL_DUMP_FORMAT,\n               .longopt = \"format\",\n               .meta = \"[c|list]\",\n               .help = \"specify output format (default: list)\"),\n  CLI_OPT_DEF (.id = OPT_LITERAL_DUMP_OUT, .opt = \"o\", .help = \"specify output file name (default: literals.[h|list])\"),\n  CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = \"FILE(S)\", .help = \"input snapshot files\")\n};\n\n/**\n * Process 'litdump' command.\n *\n * @return error code (0 - no error)\n */\nstatic int\nprocess_literal_dump (cli_state_t *cli_state_p, /**< cli state */\n                      int argc, /**< number of arguments */\n                      char *prog_name_p) /**< program name */\n{\n  uint8_t *input_pos_p = input_buffer;\n\n  cli_change_opts (cli_state_p, literal_dump_opts);\n\n  JERRY_VLA (const uint32_t *, snapshot_buffers, argc);\n  JERRY_VLA (size_t, snapshot_buffer_sizes, argc);\n  uint32_t number_of_files = 0;\n  const char *literals_file_name_p = NULL;\n  bool is_c_format = false;\n\n  for (int id = cli_consume_option (cli_state_p); id != CLI_OPT_END; id = cli_consume_option (cli_state_p))\n  {\n    switch (id)\n    {\n      case OPT_LITERAL_DUMP_HELP:\n      {\n        cli_help (prog_name_p, \"litdump\", literal_dump_opts);\n        return JERRY_STANDALONE_EXIT_CODE_OK;\n      }\n      case OPT_LITERAL_DUMP_FORMAT:\n      {\n        const char *fromat_str_p = cli_consume_string (cli_state_p);\n        if (!strcmp (\"c\", fromat_str_p))\n        {\n          is_c_format = true;\n        }\n        else if (!strcmp (\"list\", fromat_str_p))\n        {\n          is_c_format = false;\n        }\n        else\n        {\n          jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: Unsupported literal dump format.\");\n          return JERRY_STANDALONE_EXIT_CODE_FAIL;\n        }\n        break;\n      }\n      case OPT_LITERAL_DUMP_OUT:\n      {\n        literals_file_name_p = cli_consume_string (cli_state_p);\n        break;\n      }\n      case CLI_OPT_DEFAULT:\n      {\n        const char *file_name_p = cli_consume_string (cli_state_p);\n\n        if (cli_state_p->error == NULL)\n        {\n          size_t size = read_file (input_pos_p, file_name_p);\n\n          if (size == 0)\n          {\n            return JERRY_STANDALONE_EXIT_CODE_FAIL;\n          }\n\n          snapshot_buffers[number_of_files] = (const uint32_t *) input_pos_p;\n          snapshot_buffer_sizes[number_of_files] = size;\n\n          number_of_files++;\n          const uintptr_t mask = sizeof (uint32_t) - 1;\n          input_pos_p = (uint8_t *) ((((uintptr_t) input_pos_p) + size + mask) & ~mask);\n        }\n        break;\n      }\n      default:\n      {\n        cli_state_p->error = \"Internal error\";\n        break;\n      }\n    }\n  }\n\n  if (check_cli_error (cli_state_p))\n  {\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  if (number_of_files < 1)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: at least one input file must be specified.\\n\");\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n#if defined(JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)\n  context_init ();\n#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  size_t lit_buf_sz = 0;\n  if (number_of_files == 1)\n  {\n    lit_buf_sz = jerry_get_literals_from_snapshot (snapshot_buffers[0],\n                                                   snapshot_buffer_sizes[0],\n                                                   literal_buffer,\n                                                   JERRY_BUFFER_SIZE,\n                                                   is_c_format);\n  }\n  else\n  {\n    /* The input contains more than one input snapshot file, so we must merge them first. */\n    const char *error_p = NULL;\n    size_t merged_snapshot_size = jerry_merge_snapshots (snapshot_buffers,\n                                                         snapshot_buffer_sizes,\n                                                         number_of_files,\n                                                         output_buffer,\n                                                         JERRY_BUFFER_SIZE,\n                                                         &error_p);\n\n    if (merged_snapshot_size == 0)\n    {\n      jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: %s\\n\", error_p);\n      jerry_cleanup ();\n      return JERRY_STANDALONE_EXIT_CODE_FAIL;\n    }\n\n    printf (\"Successfully merged the input snapshots (%zu bytes).\\n\", merged_snapshot_size);\n\n    lit_buf_sz = jerry_get_literals_from_snapshot (output_buffer,\n                                                   merged_snapshot_size,\n                                                   literal_buffer,\n                                                   JERRY_BUFFER_SIZE,\n                                                   is_c_format);\n  }\n\n  if (lit_buf_sz == 0)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR,\n               \"Error: Literal saving failed! No literals were found in the input snapshot(s).\\n\");\n    jerry_cleanup ();\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  if (literals_file_name_p == NULL)\n  {\n    literals_file_name_p = is_c_format ? \"literals.h\" : \"literals.list\";\n  }\n\n  FILE *file_p = fopen (literals_file_name_p, \"wb\");\n\n  if (file_p == NULL)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: cannot open file: '%s'\\n\", literals_file_name_p);\n    jerry_cleanup ();\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  fwrite (literal_buffer, sizeof (uint8_t), lit_buf_sz, file_p);\n  fclose (file_p);\n\n  printf (\"Literals are saved into '%s' (%zu bytes).\\n\", literals_file_name_p, lit_buf_sz);\n\n  jerry_cleanup ();\n  return JERRY_STANDALONE_EXIT_CODE_OK;\n} /* process_literal_dump */\n\n/**\n * Merge command line option IDs\n */\ntypedef enum\n{\n  OPT_MERGE_HELP,\n  OPT_MERGE_OUT,\n} merge_opt_id_t;\n\n/**\n * Merge command line options\n */\nstatic const cli_opt_t merge_opts[] = {\n  CLI_OPT_DEF (.id = OPT_MERGE_HELP, .opt = \"h\", .longopt = \"help\", .help = \"print this help and exit\"),\n  CLI_OPT_DEF (.id = OPT_MERGE_OUT, .opt = \"o\", .help = \"specify output file name (default: js.snapshot)\"),\n  CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = \"FILE\", .help = \"input snapshot files, minimum two\")\n};\n\n/**\n * Process 'merge' command.\n *\n * @return error code (0 - no error)\n */\nstatic int\nprocess_merge (cli_state_t *cli_state_p, /**< cli state */\n               int argc, /**< number of arguments */\n               char *prog_name_p) /**< program name */\n{\n  uint8_t *input_pos_p = input_buffer;\n\n  cli_change_opts (cli_state_p, merge_opts);\n\n  JERRY_VLA (const uint32_t *, merge_buffers, argc);\n  JERRY_VLA (size_t, merge_buffer_sizes, argc);\n  uint32_t number_of_files = 0;\n\n  for (int id = cli_consume_option (cli_state_p); id != CLI_OPT_END; id = cli_consume_option (cli_state_p))\n  {\n    switch (id)\n    {\n      case OPT_MERGE_HELP:\n      {\n        cli_help (prog_name_p, \"merge\", merge_opts);\n        return JERRY_STANDALONE_EXIT_CODE_OK;\n      }\n      case OPT_MERGE_OUT:\n      {\n        output_file_name_p = cli_consume_string (cli_state_p);\n        break;\n      }\n      case CLI_OPT_DEFAULT:\n      {\n        const char *file_name_p = cli_consume_string (cli_state_p);\n\n        if (cli_state_p->error == NULL)\n        {\n          size_t size = read_file (input_pos_p, file_name_p);\n\n          if (size == 0)\n          {\n            return JERRY_STANDALONE_EXIT_CODE_FAIL;\n          }\n\n          merge_buffers[number_of_files] = (const uint32_t *) input_pos_p;\n          merge_buffer_sizes[number_of_files] = size;\n\n          number_of_files++;\n          const uintptr_t mask = sizeof (uint32_t) - 1;\n          input_pos_p = (uint8_t *) ((((uintptr_t) input_pos_p) + size + mask) & ~mask);\n        }\n        break;\n      }\n      default:\n      {\n        cli_state_p->error = \"Internal error\";\n        break;\n      }\n    }\n  }\n\n  if (check_cli_error (cli_state_p))\n  {\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  if (number_of_files < 2)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: at least two input files must be passed.\\n\");\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n#if defined(JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)\n  context_init ();\n#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const char *error_p = NULL;\n  size_t merged_snapshot_size = jerry_merge_snapshots (merge_buffers,\n                                                       merge_buffer_sizes,\n                                                       number_of_files,\n                                                       output_buffer,\n                                                       JERRY_BUFFER_SIZE,\n                                                       &error_p);\n\n  if (merged_snapshot_size == 0)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: %s\\n\", error_p);\n    jerry_cleanup ();\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  FILE *file_p = fopen (output_file_name_p, \"wb\");\n\n  if (file_p == NULL)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: cannot open file: '%s'\\n\", output_file_name_p);\n    jerry_cleanup ();\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  fwrite (output_buffer, 1u, merged_snapshot_size, file_p);\n  fclose (file_p);\n\n  printf (\"Merge is completed. Merged snapshot is saved into '%s' (%zu bytes).\\n\",\n          output_file_name_p,\n          merged_snapshot_size);\n\n  jerry_cleanup ();\n  return JERRY_STANDALONE_EXIT_CODE_OK;\n} /* process_merge */\n\n/**\n * Command line option IDs\n */\ntypedef enum\n{\n  OPT_HELP,\n} main_opt_id_t;\n\n/**\n * Command line options\n */\nstatic const cli_opt_t main_opts[] = {\n  CLI_OPT_DEF (.id = OPT_HELP, .opt = \"h\", .longopt = \"help\", .help = \"print this help and exit\"),\n  CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = \"COMMAND\", .help = \"specify the command\")\n};\n\n/**\n * Print available commands.\n */\nstatic void\nprint_commands (char *prog_name_p) /**< program name */\n{\n  cli_help (prog_name_p, NULL, main_opts);\n\n  printf (\"\\nAvailable commands:\\n\"\n          \"  generate\\n\"\n          \"  litdump\\n\"\n          \"  merge\\n\"\n          \"\\nPassing -h or --help after a command displays its help.\\n\");\n} /* print_commands */\n\n/**\n * Main function.\n *\n * @return error code (0 - no error)\n */\nint\nmain (int argc, /**< number of arguments */\n      char **argv) /**< argument list */\n{\n  cli_state_t cli_state = cli_init (main_opts, argc, argv);\n\n  for (int id = cli_consume_option (&cli_state); id != CLI_OPT_END; id = cli_consume_option (&cli_state))\n  {\n    switch (id)\n    {\n      case OPT_MERGE_HELP:\n      {\n        /* Help is always printed if no command is provided. */\n        break;\n      }\n      case CLI_OPT_DEFAULT:\n      {\n        const char *command_p = cli_consume_string (&cli_state);\n\n        if (cli_state.error != NULL)\n        {\n          break;\n        }\n\n        if (!strcmp (\"merge\", command_p))\n        {\n          return process_merge (&cli_state, argc, argv[0]);\n        }\n        else if (!strcmp (\"litdump\", command_p))\n        {\n          return process_literal_dump (&cli_state, argc, argv[0]);\n        }\n        else if (!strcmp (\"generate\", command_p))\n        {\n          return process_generate (&cli_state, argc, argv[0]);\n        }\n\n        jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: unknown command: %s\\n\\n\", command_p);\n        print_commands (argv[0]);\n\n        return JERRY_STANDALONE_EXIT_CODE_FAIL;\n      }\n      default:\n      {\n        cli_state.error = \"Internal error\";\n        break;\n      }\n    }\n  }\n\n  if (check_cli_error (&cli_state))\n  {\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  print_commands (argv[0]);\n  return JERRY_STANDALONE_EXIT_CODE_OK;\n} /* main */\n"
  },
  {
    "path": "jerry-math/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required (VERSION 3.10)\nset(JERRY_MATH_NAME jerry-math)\nproject (${JERRY_MATH_NAME} C)\n\n# Compiler / linker flags\n# TODO: Reduce the below list of warning/error disablings as much as possible\nset(COMPILE_FLAGS_MATH_GCC_CLANG \"${COMPILE_FLAGS_MATH_GCC_CLANG} -Wno-error=sign-compare\")\nset(COMPILE_FLAGS_MATH_GCC_CLANG \"${COMPILE_FLAGS_MATH_GCC_CLANG} -Wno-error=sign-conversion\")\nset(COMPILE_FLAGS_MATH_GCC_CLANG \"${COMPILE_FLAGS_MATH_GCC_CLANG} -Wno-sign-conversion\")\nset(COMPILE_FLAGS_MATH_GCC_CLANG \"${COMPILE_FLAGS_MATH_GCC_CLANG} -Wno-sign-compare\")\nset(COMPILE_FLAGS_MATH_GCC_CLANG \"${COMPILE_FLAGS_MATH_GCC_CLANG} -Wno-strict-aliasing\")\n\n# Include directories\nset(INCLUDE_MATH \"${CMAKE_CURRENT_SOURCE_DIR}/include\")\n\n# Source directories\nset(SOURCE_MATH\n  acos.c\n  acosh.c\n  asin.c\n  asinh.c\n  atan.c\n  atan2.c\n  atanh.c\n  cbrt.c\n  ceil.c\n  copysign.c\n  cosh.c\n  exp.c\n  expm1.c\n  fabs.c\n  floor.c\n  fmod.c\n  log.c\n  log10.c\n  log1p.c\n  log2.c\n  nextafter.c\n  pow.c\n  scalbn.c\n  sinh.c\n  sqrt.c\n  tanh.c\n  trig.c\n)\n\n# Amalgamated JerryScript source/header build.\n#  The process will create the following files:\n#   * jerryscript-math.c\n#   * math.h\nif(ENABLE_AMALGAM)\n  set(HEADER_MATH\n    include/math.h\n    jerry-math-internal.h\n  )\n  set(AMALGAM_MATH_C \"${CMAKE_BINARY_DIR}/amalgam/jerryscript-math.c\")\n  set(AMALGAM_MATH_H \"${CMAKE_BINARY_DIR}/amalgam/math.h\")\n\n  add_custom_command(OUTPUT ${AMALGAM_MATH_C} ${AMALGAM_MATH_H}\n                     COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/tools/amalgam.py\n                             --jerry-math\n                             --output-dir ${CMAKE_BINARY_DIR}/amalgam\n                     DEPENDS ${SOURCE_MATH}\n                             ${HEADER_MATH}\n                             ${CMAKE_SOURCE_DIR}/tools/amalgam.py\n  )\n  add_custom_target(amalgam-math DEPENDS ${AMALGAM_MATH_C} ${AMALGAM_MATH_H})\n  add_dependencies(amalgam amalgam-math)\n\n  set(SOURCE_MATH ${AMALGAM_MATH_C} ${AMALGAM_MATH_H})\nendif()\n\nadd_library(${JERRY_MATH_NAME} ${SOURCE_MATH})\nif(USING_GCC OR USING_CLANG)\n  set_property(TARGET ${JERRY_MATH_NAME}\n               PROPERTY COMPILE_FLAGS \"${COMPILE_FLAGS_MATH_GCC_CLANG}\")\nendif()\ntarget_include_directories(${JERRY_MATH_NAME} PUBLIC ${INCLUDE_MATH})\nadd_dependencies(${JERRY_MATH_NAME} amalgam)\n\nconfigure_file(libjerry-math.pc.in libjerry-math.pc @ONLY)\n\ninstall(TARGETS ${JERRY_MATH_NAME} DESTINATION lib)\ninstall(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjerry-math.pc DESTINATION lib/pkgconfig)\ninstall(DIRECTORY ${INCLUDE_MATH}/ DESTINATION include/jerryscript-math)\n"
  },
  {
    "path": "jerry-math/acos.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_acos.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* acos(x)\n *\n * Method:\n *      acos(x)  = pi/2 - asin(x)\n *      acos(-x) = pi/2 + asin(x)\n * For |x|<=0.5\n *      acos(x) = pi/2 - (x + x*x^2*R(x^2))     (see asin.c)\n * For x>0.5\n *      acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2)))\n *              = 2asin(sqrt((1-x)/2))\n *              = 2s + 2s*z*R(z)        ...z=(1-x)/2, s=sqrt(z)\n *              = 2f + (2c + 2s*z*R(z))\n *     where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term\n *     for f so that f+c ~ sqrt(z).\n * For x<-0.5\n *      acos(x) = pi - 2asin(sqrt((1-|x|)/2))\n *              = pi - 0.5*(s+s*z*R(z)), where z=(1-|x|)/2,s=sqrt(z)\n *\n * Special cases:\n *      if x is NaN, return x itself;\n *      if |x|>1, return NaN with invalid signal.\n *\n * Function needed: sqrt\n */\n\n#define one     1.00000000000000000000e+00 /* 0x3FF00000, 0x00000000 */\n#define pi      3.14159265358979311600e+00 /* 0x400921FB, 0x54442D18 */\n#define pio2_hi 1.57079632679489655800e+00 /* 0x3FF921FB, 0x54442D18 */\n#define pio2_lo 6.12323399573676603587e-17 /* 0x3C91A626, 0x33145C07 */\n#define pS0     1.66666666666666657415e-01 /* 0x3FC55555, 0x55555555 */\n#define pS1     -3.25565818622400915405e-01 /* 0xBFD4D612, 0x03EB6F7D */\n#define pS2     2.01212532134862925881e-01 /* 0x3FC9C155, 0x0E884455 */\n#define pS3     -4.00555345006794114027e-02 /* 0xBFA48228, 0xB5688F3B */\n#define pS4     7.91534994289814532176e-04 /* 0x3F49EFE0, 0x7501B288 */\n#define pS5     3.47933107596021167570e-05 /* 0x3F023DE1, 0x0DFDF709 */\n#define qS1     -2.40339491173441421878e+00 /* 0xC0033A27, 0x1C8A2D4B */\n#define qS2     2.02094576023350569471e+00 /* 0x40002AE5, 0x9C598AC8 */\n#define qS3     -6.88283971605453293030e-01 /* 0xBFE6066C, 0x1B8D0159 */\n#define qS4     7.70381505559019352791e-02 /* 0x3FB3B8C5, 0xB12E9282 */\n\ndouble\nacos (double x)\n{\n  double z, p, q, r, w, s, c;\n  int hx, ix;\n\n  hx = __HI (x);\n  ix = hx & 0x7fffffff;\n  if (ix >= 0x3ff00000) /* |x| >= 1 */\n  {\n    if (((ix - 0x3ff00000) | __LO (x)) == 0) /* |x| == 1 */\n    {\n      if (hx > 0) /* acos(1) = 0  */\n      {\n        return 0.0;\n      }\n      else /* acos(-1) = pi */\n      {\n        return pi + 2.0 * pio2_lo;\n      }\n    }\n    return NAN; /* acos(|x|>1) is NaN */\n  }\n  if (ix < 0x3fe00000) /* |x| < 0.5 */\n  {\n    if (ix <= 0x3c600000) /* if |x| < 2**-57 */\n    {\n      return pio2_hi + pio2_lo;\n    }\n    z = x * x;\n    p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 + z * (pS4 + z * pS5)))));\n    q = one + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4)));\n    r = p / q;\n    return pio2_hi - (x - (pio2_lo - x * r));\n  }\n  else if (hx < 0) /* x < -0.5 */\n  {\n    z = (one + x) * 0.5;\n    p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 + z * (pS4 + z * pS5)))));\n    q = one + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4)));\n    s = sqrt (z);\n    r = p / q;\n    w = r * s - pio2_lo;\n    return pi - 2.0 * (s + w);\n  }\n  else /* x > 0.5 */\n  {\n    double_accessor df;\n    z = (one - x) * 0.5;\n    s = sqrt (z);\n    df.dbl = s;\n    df.as_int.lo = 0;\n    c = (z - df.dbl * df.dbl) / (s + df.dbl);\n    p = z * (pS0 + z * (pS1 + z * (pS2 + z * (pS3 + z * (pS4 + z * pS5)))));\n    q = one + z * (qS1 + z * (qS2 + z * (qS3 + z * qS4)));\n    r = p / q;\n    w = r * s + c;\n    return 2.0 * (df.dbl + w);\n  }\n} /* acos */\n\n#undef one\n#undef pi\n#undef pio2_hi\n#undef pio2_lo\n#undef pS0\n#undef pS1\n#undef pS2\n#undef pS3\n#undef pS4\n#undef pS5\n#undef qS1\n#undef qS2\n#undef qS3\n#undef qS4\n"
  },
  {
    "path": "jerry-math/acosh.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_acosh.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* acosh(x)\n * Method :\n *  Based on\n *    acosh(x) = log [ x + sqrt(x * x - 1) ]\n *  we have\n *    acosh(x) := log(x) + ln2, if x is large; else\n *    acosh(x) := log(2x - 1 / (sqrt(x * x - 1) + x)), if x > 2; else\n *    acosh(x) := log1p(t + sqrt(2.0 * t + t * t)); where t = x - 1.\n *\n * Special cases:\n *  acosh(x) is NaN with signal if x < 1.\n *  acosh(NaN) is NaN without signal.\n */\n\n#define one 1.0\n#define ln2 6.93147180559945286227e-01 /* 0x3FE62E42, 0xFEFA39EF */\n\ndouble\nacosh (double x)\n{\n  double t;\n  int hx;\n  hx = __HI (x);\n  if (hx < 0x3ff00000)\n  {\n    /* x < 1 */\n    return NAN;\n  }\n  else if (hx >= 0x41b00000)\n  {\n    /* x > 2**28 */\n    if (hx >= 0x7ff00000)\n    {\n      /* x is inf of NaN */\n      return x + x;\n    }\n    else\n    {\n      /* acosh(huge) = log(2x) */\n      return log (x) + ln2;\n    }\n  }\n  else if (((hx - 0x3ff00000) | __LO (x)) == 0)\n  {\n    /* acosh(1) = 0 */\n    return 0.0;\n  }\n  else if (hx > 0x40000000)\n  {\n    /* 2**28 > x > 2 */\n    t = x * x;\n    return log (2.0 * x - one / (x + sqrt (t - one)));\n  }\n  else\n  {\n    /* 1 < x < 2 */\n    t = x - one;\n    return log1p (t + sqrt (2.0 * t + t * t));\n  }\n} /* acosh */\n\n#undef one\n#undef ln2\n"
  },
  {
    "path": "jerry-math/asin.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_asin.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* asin(x)\n *\n * Method:\n *      Since  asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ...\n *      we approximate asin(x) on [0,0.5] by\n *              asin(x) = x + x*x^2*R(x^2)\n *      where\n *              R(x^2) is a rational approximation of (asin(x)-x)/x^3\n *      and its remez error is bounded by\n *              |(asin(x)-x)/x^3 - R(x^2)| < 2^(-58.75)\n *\n *      For x in [0.5,1]\n *              asin(x) = pi/2-2*asin(sqrt((1-x)/2))\n *      Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2;\n *      then for x>0.98\n *              asin(x) = pi/2 - 2*(s+s*z*R(z))\n *                      = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo)\n *      For x<=0.98, let pio4_hi = pio2_hi/2, then\n *              f = hi part of s;\n *              c = sqrt(z) - f = (z-f*f)/(s+f)         ...f+c=sqrt(z)\n *      and\n *              asin(x) = pi/2 - 2*(s+s*z*R(z))\n *                      = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo)\n *                      = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c))\n *\n * Special cases:\n *      if x is NaN, return x itself;\n *      if |x|>1, return NaN with invalid signal.\n */\n\n#define one     1.00000000000000000000e+00 /* 0x3FF00000, 0x00000000 */\n#define huge    1.000e+300\n#define pio2_hi 1.57079632679489655800e+00 /* 0x3FF921FB, 0x54442D18 */\n#define pio2_lo 6.12323399573676603587e-17 /* 0x3C91A626, 0x33145C07 */\n#define pio4_hi 7.85398163397448278999e-01 /* 0x3FE921FB, 0x54442D18 */\n/* coefficient for R(x^2) */\n#define pS0 1.66666666666666657415e-01 /* 0x3FC55555, 0x55555555 */\n#define pS1 -3.25565818622400915405e-01 /* 0xBFD4D612, 0x03EB6F7D */\n#define pS2 2.01212532134862925881e-01 /* 0x3FC9C155, 0x0E884455 */\n#define pS3 -4.00555345006794114027e-02 /* 0xBFA48228, 0xB5688F3B */\n#define pS4 7.91534994289814532176e-04 /* 0x3F49EFE0, 0x7501B288 */\n#define pS5 3.47933107596021167570e-05 /* 0x3F023DE1, 0x0DFDF709 */\n#define qS1 -2.40339491173441421878e+00 /* 0xC0033A27, 0x1C8A2D4B */\n#define qS2 2.02094576023350569471e+00 /* 0x40002AE5, 0x9C598AC8 */\n#define qS3 -6.88283971605453293030e-01 /* 0xBFE6066C, 0x1B8D0159 */\n#define qS4 7.70381505559019352791e-02 /* 0x3FB3B8C5, 0xB12E9282 */\n\ndouble\nasin (double x)\n{\n  double t, p, q, c, r, s;\n  double_accessor w;\n  int hx, ix;\n\n  hx = __HI (x);\n  ix = hx & 0x7fffffff;\n  if (ix >= 0x3ff00000) /* |x| >= 1 */\n  {\n    if (((ix - 0x3ff00000) | __LO (x)) == 0) /* asin(1) = +-pi/2 with inexact */\n    {\n      return x * pio2_hi + x * pio2_lo;\n    }\n    return NAN; /* asin(|x|>1) is NaN */\n  }\n  else if (ix < 0x3fe00000) /* |x| < 0.5 */\n  {\n    if (ix < 0x3e400000) /* if |x| < 2**-27 */\n    {\n      if (huge + x > one) /* return x with inexact if x != 0 */\n      {\n        return x;\n      }\n    }\n    t = x * x;\n    p = t * (pS0 + t * (pS1 + t * (pS2 + t * (pS3 + t * (pS4 + t * pS5)))));\n    q = one + t * (qS1 + t * (qS2 + t * (qS3 + t * qS4)));\n    w.dbl = p / q;\n    return x + x * w.dbl;\n  }\n  /* 1 > |x| >= 0.5 */\n  w.dbl = one - fabs (x);\n  t = w.dbl * 0.5;\n  p = t * (pS0 + t * (pS1 + t * (pS2 + t * (pS3 + t * (pS4 + t * pS5)))));\n  q = one + t * (qS1 + t * (qS2 + t * (qS3 + t * qS4)));\n  s = sqrt (t);\n  if (ix >= 0x3FEF3333) /* if |x| > 0.975 */\n  {\n    w.dbl = p / q;\n    t = pio2_hi - (2.0 * (s + s * w.dbl) - pio2_lo);\n  }\n  else\n  {\n    w.dbl = s;\n    w.as_int.lo = 0;\n    c = (t - w.dbl * w.dbl) / (s + w.dbl);\n    r = p / q;\n    p = 2.0 * s * r - (pio2_lo - 2.0 * c);\n    q = pio4_hi - 2.0 * w.dbl;\n    t = pio4_hi - (p - q);\n  }\n  if (hx > 0)\n  {\n    return t;\n  }\n  else\n  {\n    return -t;\n  }\n} /* asin */\n\n#undef one\n#undef huge\n#undef pio2_hi\n#undef pio2_lo\n#undef pio4_hi\n#undef pS0\n#undef pS1\n#undef pS2\n#undef pS3\n#undef pS4\n#undef pS5\n#undef qS1\n#undef qS2\n#undef qS3\n#undef qS4\n"
  },
  {
    "path": "jerry-math/asinh.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_asinh.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* asinh(x)\n * Method :\n *  Based on\n *    asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]\n *  we have\n *  asinh(x) := x  if  1 + x * x = 1,\n *           := sign(x) * (log(x)+ln2)) for large |x|, else\n *           := sign(x) * log(2|x| + 1 / (|x| + sqrt(x * x + 1))) if|x| > 2, else\n *           := sign(x) * log1p(|x| + x^2 / (1 + sqrt(1 + x^2)))\n */\n\n#define one  1.0\n#define ln2  6.93147180559945286227e-01 /* 0x3FE62E42, 0xFEFA39EF */\n#define huge 1.0e+300\n\ndouble\nasinh (double x)\n{\n  double t, w;\n  int hx, ix;\n  hx = __HI (x);\n  ix = hx & 0x7fffffff;\n  if (ix >= 0x7ff00000)\n  {\n    /* x is inf or NaN */\n    return x + x;\n  }\n  if (ix < 0x3e300000)\n  {\n    /* |x| < 2**-28 */\n    if (huge + x > one)\n    {\n      /* return x inexact except 0 */\n      return x;\n    }\n  }\n  if (ix > 0x41b00000)\n  {\n    /* |x| > 2**28 */\n    w = log (fabs (x)) + ln2;\n  }\n  else if (ix > 0x40000000)\n  {\n    /* 2**28 > |x| > 2.0 */\n    t = fabs (x);\n    w = log (2.0 * t + one / (sqrt (x * x + one) + t));\n  }\n  else\n  {\n    /* 2.0 > |x| > 2**-28 */\n    t = x * x;\n    w = log1p (fabs (x) + t / (one + sqrt (one + t)));\n  }\n  if (hx > 0)\n  {\n    return w;\n  }\n  else\n  {\n    return -w;\n  }\n} /* asinh */\n\n#undef one\n#undef ln2\n#undef huge\n"
  },
  {
    "path": "jerry-math/atan.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_atan.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* atan(x)\n *\n * Method:\n *   1. Reduce x to positive by atan(x) = -atan(-x).\n *   2. According to the integer k=4t+0.25 chopped, t=x, the argument\n *      is further reduced to one of the following intervals and the\n *      arctangent of t is evaluated by the corresponding formula:\n *\n *      [0,7/16]      atan(x) = t-t^3*(a1+t^2*(a2+...(a10+t^2*a11)...)\n *      [7/16,11/16]  atan(x) = atan(1/2) + atan( (t-0.5)/(1+t/2) )\n *      [11/16.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) )\n *      [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1.5)/(1+1.5t) )\n *      [39/16,INF]   atan(x) = atan(INF) + atan( -1/t )\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n */\n\nstatic const double atanhi[] = {\n  4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */\n  7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */\n  9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */\n  1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */\n};\n\nstatic const double atanlo[] = {\n  2.26987774529616870924e-17, /* atan(0.5)lo 0x3C7A2B7F, 0x222F65E2 */\n  3.06161699786838301793e-17, /* atan(1.0)lo 0x3C81A626, 0x33145C07 */\n  1.39033110312309984516e-17, /* atan(1.5)lo 0x3C700788, 0x7AF0CBBD */\n  6.12323399573676603587e-17, /* atan(inf)lo 0x3C91A626, 0x33145C07 */\n};\n\n#define aT0  3.33333333333329318027e-01 /* 0x3FD55555, 0x5555550D */\n#define aT1  -1.99999999998764832476e-01 /* 0xBFC99999, 0x9998EBC4 */\n#define aT2  1.42857142725034663711e-01 /* 0x3FC24924, 0x920083FF */\n#define aT3  -1.11111104054623557880e-01 /* 0xBFBC71C6, 0xFE231671 */\n#define aT4  9.09088713343650656196e-02 /* 0x3FB745CD, 0xC54C206E */\n#define aT5  -7.69187620504482999495e-02 /* 0xBFB3B0F2, 0xAF749A6D */\n#define aT6  6.66107313738753120669e-02 /* 0x3FB10D66, 0xA0D03D51 */\n#define aT7  -5.83357013379057348645e-02 /* 0xBFADDE2D, 0x52DEFD9A */\n#define aT8  4.97687799461593236017e-02 /* 0x3FA97B4B, 0x24760DEB */\n#define aT9  -3.65315727442169155270e-02 /* 0xBFA2B444, 0x2C6A6C2F */\n#define aT10 1.62858201153657823623e-02 /* 0x3F90AD3A, 0xE322DA11 */\n\n#define one  1.0\n#define huge 1.0e300\n\ndouble\natan (double x)\n{\n  double w, s1, s2, z;\n  int ix, hx, id;\n\n  hx = __HI (x);\n  ix = hx & 0x7fffffff;\n  if (ix >= 0x44100000) /* if |x| >= 2^66 */\n  {\n    if (ix > 0x7ff00000 || (ix == 0x7ff00000 && (__LO (x) != 0)))\n    {\n      return x + x; /* NaN */\n    }\n    if (hx > 0)\n    {\n      return atanhi[3] + atanlo[3];\n    }\n    else\n    {\n      return -atanhi[3] - atanlo[3];\n    }\n  }\n  if (ix < 0x3fdc0000) /* |x| < 0.4375 */\n  {\n    if (ix < 0x3e200000) /* |x| < 2^-29 */\n    {\n      if (huge + x > one) /* raise inexact */\n      {\n        return x;\n      }\n    }\n    id = -1;\n  }\n  else\n  {\n    x = fabs (x);\n    if (ix < 0x3ff30000) /* |x| < 1.1875 */\n    {\n      if (ix < 0x3fe60000) /* 7/16 <= |x| < 11/16 */\n      {\n        id = 0;\n        x = (2.0 * x - one) / (2.0 + x);\n      }\n      else /* 11/16 <= |x| < 19/16 */\n      {\n        id = 1;\n        x = (x - one) / (x + one);\n      }\n    }\n    else\n    {\n      if (ix < 0x40038000) /* |x| < 2.4375 */\n      {\n        id = 2;\n        x = (x - 1.5) / (one + 1.5 * x);\n      }\n      else /* 2.4375 <= |x| < 2^66 */\n      {\n        id = 3;\n        x = -1.0 / x;\n      }\n    }\n  }\n  /* end of argument reduction */\n  z = x * x;\n  w = z * z;\n  /* break sum from i=0 to 10 aT[i] z**(i+1) into odd and even poly */\n  s1 = z * (aT0 + w * (aT2 + w * (aT4 + w * (aT6 + w * (aT8 + w * aT10)))));\n  s2 = w * (aT1 + w * (aT3 + w * (aT5 + w * (aT7 + w * aT9))));\n  if (id < 0)\n  {\n    return x - x * (s1 + s2);\n  }\n  else\n  {\n    z = atanhi[id] - ((x * (s1 + s2) - atanlo[id]) - x);\n    return (hx < 0) ? -z : z;\n  }\n} /* atan */\n\n#undef aT0\n#undef aT1\n#undef aT2\n#undef aT3\n#undef aT4\n#undef aT5\n#undef aT6\n#undef aT7\n#undef aT8\n#undef aT9\n#undef aT10\n#undef one\n#undef huge\n"
  },
  {
    "path": "jerry-math/atan2.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_atan2.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* atan2(y,x)\n *\n * Method:\n *      1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).\n *      2. Reduce x to positive by (if x and y are unexceptional):\n *              ARG (x+iy) = arctan(y/x)           ... if x > 0,\n *              ARG (x+iy) = pi - arctan[y/(-x)]   ... if x < 0,\n *\n * Special cases:\n *      ATAN2((anything), NaN ) is NaN;\n *      ATAN2(NAN , (anything) ) is NaN;\n *      ATAN2(+-0, +(anything but NaN)) is +-0  ;\n *      ATAN2(+-0, -(anything but NaN)) is +-pi ;\n *      ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2;\n *      ATAN2(+-(anything but INF and NaN), +INF) is +-0 ;\n *      ATAN2(+-(anything but INF and NaN), -INF) is +-pi;\n *      ATAN2(+-INF,+INF ) is +-pi/4 ;\n *      ATAN2(+-INF,-INF ) is +-3pi/4;\n *      ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n */\n\n#define tiny   1.0e-300\n#define zero   0.0\n#define pi_o_4 7.8539816339744827900E-01 /* 0x3FE921FB, 0x54442D18 */\n#define pi_o_2 1.5707963267948965580E+00 /* 0x3FF921FB, 0x54442D18 */\n#define pi     3.1415926535897931160E+00 /* 0x400921FB, 0x54442D18 */\n#define pi_lo  1.2246467991473531772E-16 /* 0x3CA1A626, 0x33145C07 */\n\ndouble\natan2 (double y, double x)\n{\n  double_accessor z;\n  int k, m, hx, hy, ix, iy;\n  unsigned lx, ly;\n\n  hx = __HI (x);\n  ix = hx & 0x7fffffff;\n  lx = __LO (x);\n  hy = __HI (y);\n  iy = hy & 0x7fffffff;\n  ly = __LO (y);\n  if (((ix | ((lx | -lx) >> 31)) > 0x7ff00000) || ((iy | ((ly | -ly) >> 31)) > 0x7ff00000)) /* x or y is NaN */\n  {\n    return x + y;\n  }\n  if (((hx - 0x3ff00000) | lx) == 0) /* x = 1.0 */\n  {\n    return atan (y);\n  }\n  m = ((hy < 0) ? 1 : 0) + ((hx < 0) ? 2 : 0); /* 2 * sign(x) + sign(y) */\n\n  /* when y = 0 */\n  if ((iy | ly) == 0)\n  {\n    switch (m)\n    {\n      case 0:\n      case 1:\n      {\n        return y; /* atan(+-0,+anything) = +-0 */\n      }\n      case 2:\n      {\n        return pi + tiny; /* atan(+0,-anything) = pi */\n      }\n      case 3:\n      {\n        return -pi - tiny; /* atan(-0,-anything) = -pi */\n      }\n    }\n  }\n  /* when x = 0 */\n  if ((ix | lx) == 0)\n  {\n    return (hy < 0) ? -pi_o_2 - tiny : pi_o_2 + tiny;\n  }\n\n  /* when x is INF */\n  if (ix == 0x7ff00000)\n  {\n    if (iy == 0x7ff00000)\n    {\n      switch (m)\n      {\n        case 0: /* atan(+INF,+INF) */\n        {\n          return pi_o_4 + tiny;\n        }\n        case 1: /* atan(-INF,+INF) */\n        {\n          return -pi_o_4 - tiny;\n        }\n        case 2: /* atan(+INF,-INF) */\n        {\n          return 3.0 * pi_o_4 + tiny;\n        }\n        case 3: /* atan(-INF,-INF) */\n        {\n          return -3.0 * pi_o_4 - tiny;\n        }\n      }\n    }\n    else\n    {\n      switch (m)\n      {\n        case 0: /* atan(+...,+INF) */\n        {\n          return zero;\n        }\n        case 1: /* atan(-...,+INF) */\n        {\n          return -zero;\n        }\n        case 2: /* atan(+...,-INF) */\n        {\n          return pi + tiny;\n        }\n        case 3: /* atan(-...,-INF) */\n        {\n          return -pi - tiny;\n        }\n      }\n    }\n  }\n  /* when y is INF */\n  if (iy == 0x7ff00000)\n  {\n    return (hy < 0) ? -pi_o_2 - tiny : pi_o_2 + tiny;\n  }\n\n  /* compute y / x */\n  k = (iy - ix) >> 20;\n  if (k > 60) /* |y / x| > 2**60 */\n  {\n    z.dbl = pi_o_2 + 0.5 * pi_lo;\n  }\n  else if (hx < 0 && k < -60) /* |y| / x < -2**60 */\n  {\n    z.dbl = 0.0;\n  }\n  else /* safe to do y / x */\n  {\n    z.dbl = atan (fabs (y / x));\n  }\n  switch (m)\n  {\n    case 0: /* atan(+,+) */\n    {\n      return z.dbl;\n    }\n    case 1: /* atan(-,+) */\n    {\n      z.as_int.hi ^= 0x80000000;\n      return z.dbl;\n    }\n    case 2: /* atan(+,-) */\n    {\n      return pi - (z.dbl - pi_lo);\n    }\n    /* case 3: */\n    default: /* atan(-,-) */\n    {\n      return (z.dbl - pi_lo) - pi;\n    }\n  }\n} /* atan2 */\n\n#undef tiny\n#undef zero\n#undef pi_o_4\n#undef pi_o_2\n#undef pi\n#undef pi_lo\n"
  },
  {
    "path": "jerry-math/atanh.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_atanh.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* atanh(x)\n * Method :\n *    1.Reduced x to positive by atanh(-x) = -atanh(x)\n *    2.For x >= 0.5\n *              1              2x                          x\n *  atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)\n *              2             1 - x                      1 - x\n *\n *   For x < 0.5\n *    atanh(x) = 0.5 * log1p(2x + 2x * x / (1 - x))\n *\n * Special cases:\n *  atanh(x) is NaN if |x| > 1 with signal;\n *  atanh(NaN) is that NaN with no signal;\n *  atanh(+-1) is +-INF with signal.\n *\n */\n\n#define zero 0.0\n#define one  1.0\n#define huge 1.0e+300\n\ndouble\natanh (double x)\n{\n  double t;\n  int hx, ix;\n  double_accessor temp;\n  temp.dbl = x;\n  hx = temp.as_int.hi;\n  ix = hx & 0x7fffffff;\n\n  /* |x| > 1 */\n  if ((ix | ((unsigned int) (temp.as_int.lo | (-temp.as_int.lo)) >> 31)) > 0x3ff00000)\n  {\n    return NAN;\n  }\n  if (ix == 0x3ff00000)\n  {\n    return x / zero;\n  }\n  if (ix < 0x3e300000 && (huge + x) > zero)\n  {\n    return x; /* x<2**-28 */\n  }\n\n  /* x <- |x| */\n  temp.as_int.hi = ix;\n  if (ix < 0x3fe00000)\n  {\n    /* x < 0.5 */\n    t = temp.dbl + temp.dbl;\n    t = 0.5 * log1p (t + t * temp.dbl / (one - temp.dbl));\n  }\n  else\n  {\n    t = 0.5 * log1p ((temp.dbl + temp.dbl) / (one - temp.dbl));\n  }\n  if (hx >= 0)\n  {\n    return t;\n  }\n  else\n  {\n    return -t;\n  }\n} /* atanh */\n\n#undef zero\n#undef one\n#undef huge\n"
  },
  {
    "path": "jerry-math/cbrt.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_cbrt.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* cbrt(x)\n * Return cube root of x\n */\n\n#define B1 715094163 /* B1 = (682 - 0.03306235651) * 2**20 */\n#define B2 696219795 /* B2 = (664 - 0.03306235651) * 2**20 */\n#define C  5.42857142857142815906e-01 /* 19/35     = 0x3FE15F15, 0xF15F15F1 */\n#define D  -7.05306122448979611050e-01 /* -864/1225 = 0xBFE691DE, 0x2532C834 */\n#define E  1.41428571428571436819e+00 /* 99/70     = 0x3FF6A0EA, 0x0EA0EA0F */\n#define F  1.60714285714285720630e+00 /* 45/28     = 0x3FF9B6DB, 0x6DB6DB6E */\n#define G  3.57142857142857150787e-01 /* 5/14      = 0x3FD6DB6D, 0xB6DB6DB7 */\n\ndouble\ncbrt (double x)\n{\n  double r, s, w;\n  double_accessor t, temp;\n  unsigned int sign;\n  t.dbl = 0.0;\n  temp.dbl = x;\n\n  sign = temp.as_int.hi & 0x80000000; /* sign = sign(x) */\n  temp.as_int.hi ^= sign;\n\n  if (temp.as_int.hi >= 0x7ff00000)\n  {\n    /* cbrt(NaN, INF) is itself */\n    return (x + x);\n  }\n  if ((temp.as_int.hi | temp.as_int.lo) == 0)\n  {\n    /* cbrt(0) is itself */\n    return (x);\n  }\n  /* rough cbrt to 5 bits */\n  if (temp.as_int.hi < 0x00100000) /* subnormal number */\n  {\n    t.as_int.hi = 0x43500000; /* set t= 2**54 */\n    t.dbl *= temp.dbl;\n    t.as_int.hi = t.as_int.hi / 3 + B2;\n  }\n  else\n  {\n    t.as_int.hi = temp.as_int.hi / 3 + B1;\n  }\n\n  /* new cbrt to 23 bits, may be implemented in single precision */\n  r = t.dbl * t.dbl / temp.dbl;\n  s = C + r * t.dbl;\n  t.dbl *= G + F / (s + E + D / s);\n\n  /* chopped to 20 bits and make it larger than cbrt(x) */\n  t.as_int.lo = 0;\n  t.as_int.hi += 0x00000001;\n\n  /* one step newton iteration to 53 bits with error less than 0.667 ulps */\n  s = t.dbl * t.dbl; /* t*t is exact */\n  r = temp.dbl / s;\n  w = t.dbl + t.dbl;\n  r = (r - t.dbl) / (w + r); /* r-s is exact */\n  t.dbl = t.dbl + (t.dbl * r);\n\n  /* retore the sign bit */\n  t.as_int.hi |= sign;\n  return (t.dbl);\n} /* cbrt */\n\n#undef B1\n#undef B2\n#undef C\n#undef D\n#undef E\n#undef F\n#undef G\n"
  },
  {
    "path": "jerry-math/ceil.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_ceil.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* ceil(x)\n * Return x rounded toward -inf to integral value\n *\n * Method:\n *      Bit twiddling.\n *\n * Exception:\n *      Inexact flag raised if x not equal to ceil(x).\n */\n\n#define huge 1.0e300\n\ndouble\nceil (double x)\n{\n  int i0, i1, j0;\n  unsigned i, j;\n\n  i0 = __HI (x);\n  i1 = __LO (x);\n  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;\n  if (j0 < 20)\n  {\n    if (j0 < 0) /* raise inexact if x != 0 */\n    {\n      if (huge + x > 0.0) /* return 0 * sign(x) if |x| < 1 */\n      {\n        if (i0 < 0)\n        {\n          i0 = 0x80000000;\n          i1 = 0;\n        }\n        else if ((i0 | i1) != 0)\n        {\n          i0 = 0x3ff00000;\n          i1 = 0;\n        }\n      }\n    }\n    else\n    {\n      i = (0x000fffff) >> j0;\n      if (((i0 & i) | i1) == 0) /* x is integral */\n      {\n        return x;\n      }\n      if (huge + x > 0.0) /* raise inexact flag */\n      {\n        if (i0 > 0)\n        {\n          i0 += (0x00100000) >> j0;\n        }\n        i0 &= (~i);\n        i1 = 0;\n      }\n    }\n  }\n  else if (j0 > 51)\n  {\n    if (j0 == 0x400) /* inf or NaN */\n    {\n      return x + x;\n    }\n    else /* x is integral */\n    {\n      return x;\n    }\n  }\n  else\n  {\n    i = ((unsigned) (0xffffffff)) >> (j0 - 20);\n    if ((i1 & i) == 0) /* x is integral */\n    {\n      return x;\n    }\n    if (huge + x > 0.0) /* raise inexact flag */\n    {\n      if (i0 > 0)\n      {\n        if (j0 == 20)\n        {\n          i0 += 1;\n        }\n        else\n        {\n          j = i1 + (1 << (52 - j0));\n          if (j < i1) /* got a carry */\n          {\n            i0 += 1;\n          }\n          i1 = j;\n        }\n      }\n      i1 &= (~i);\n    }\n  }\n\n  double_accessor ret;\n  ret.as_int.hi = i0;\n  ret.as_int.lo = i1;\n  return ret.dbl;\n} /* ceil */\n\n#undef huge\n"
  },
  {
    "path": "jerry-math/copysign.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_copysign.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* copysign(x,y) returns a value with the magnitude of x and\n * with the sign bit of y.\n */\n\ndouble\ncopysign (double x, double y)\n{\n  double_accessor ret;\n  ret.dbl = x;\n  ret.as_int.hi = (__HI (x) & 0x7fffffff) | (__HI (y) & 0x80000000);\n  return ret.dbl;\n} /* copysign */\n"
  },
  {
    "path": "jerry-math/cosh.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_cosh.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* cosh(x)\n * Method:\n * mathematically cosh(x) if defined to be (exp(x) + exp(-x)) / 2\n *  1. Replace x by |x| (cosh(x) = cosh(-x)).\n *  2.\n *                                                 [ exp(x) - 1 ]^2\n *      0        <= x <= ln2/2  :  cosh(x) := 1 + -------------------\n *                                                     2*exp(x)\n *\n *                                             exp(x) +  1/exp(x)\n *      ln2/2    <= x <= 22     :  cosh(x) := -------------------\n *                                                    2\n *\n *      22       <= x <= lnovft :  cosh(x) := exp(x)/2\n *      lnovft   <= x <= ln2ovft:  cosh(x) := exp(x/2)/2 * exp(x/2)\n *      ln2ovft  <  x           :  cosh(x) := huge * huge (overflow)\n *\n * Special cases:\n *  cosh(x) is |x| if x is +INF, -INF, or NaN.\n *  only cosh(0) = 1 is exact for finite x.\n */\n\n#define one  1.0\n#define half 0.5\n#define huge 1.0e300\n\ndouble\ncosh (double x)\n{\n  double t, w;\n  int ix;\n  unsigned lx;\n\n  /* High word of |x|. */\n  ix = __HI (x);\n  ix &= 0x7fffffff;\n\n  /* x is INF or NaN */\n  if (ix >= 0x7ff00000)\n  {\n    return x * x;\n  }\n  /* |x| in [0, 0.5 * ln2], return 1 + expm1(|x|)^2 / (2 * exp(|x|)) */\n  if (ix < 0x3fd62e43)\n  {\n    t = expm1 (fabs (x));\n    w = one + t;\n    if (ix < 0x3c800000)\n    {\n      /* cosh(tiny) = 1 */\n      return w;\n    }\n    return one + (t * t) / (w + w);\n  }\n\n  /* |x| in [0.5 * ln2, 22], return (exp(|x|) + 1 / exp(|x|) / 2; */\n  if (ix < 0x40360000)\n  {\n    t = exp (fabs (x));\n    return half * t + half / t;\n  }\n\n  /* |x| in [22, log(maxdouble)] return half * exp(|x|) */\n  if (ix < 0x40862E42)\n  {\n    return half * exp (fabs (x));\n  }\n  /* |x| in [log(maxdouble), overflowthresold] */\n  lx = ((1 >> 29) + (unsigned int) x);\n  if ((ix < 0x408633CE) || ((ix == 0x408633ce) && (lx <= (unsigned) 0x8fb9f87d)))\n  {\n    w = exp (half * fabs (x));\n    t = half * w;\n    return t * w;\n  }\n\n  /* |x| > overflowthresold, cosh(x) overflow */\n  return huge * huge;\n} /* cosh */\n\n#undef one\n#undef half\n#undef huge\n"
  },
  {
    "path": "jerry-math/exp.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_exp.c 1.6 04/04/22\n */\n\n#include \"jerry-math-internal.h\"\n\n/* exp(x)\n * Returns the exponential of x.\n *\n * Method:\n *   1. Argument reduction:\n *      Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.\n *      Given x, find r and integer k such that\n *\n *               x = k*ln2 + r,  |r| <= 0.5*ln2.\n *\n *      Here r will be represented as r = hi-lo for better\n *      accuracy.\n *\n *   2. Approximation of exp(r) by a special rational function on\n *      the interval [0,0.34658]:\n *      Write\n *          R(r**2) = r*(exp(r)+1)/(exp(r)-1) = 2 + r*r/6 - r**4/360 + ...\n *      We use a special Remes algorithm on [0,0.34658] to generate\n *      a polynomial of degree 5 to approximate R. The maximum error\n *      of this polynomial approximation is bounded by 2**-59. In\n *      other words,\n *          R(z) ~ 2.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5\n *      (where z=r*r, and the values of P1 to P5 are listed below)\n *      and\n *          |                  5          |     -59\n *          | 2.0+P1*z+...+P5*z   -  R(z) | <= 2\n *          |                             |\n *      The computation of exp(r) thus becomes\n *                             2*r\n *              exp(r) = 1 + -------\n *                            R - r\n *                                 r*R1(r)\n *                     = 1 + r + ----------- (for better accuracy)\n *                                2 - R1(r)\n *      where\n *                               2       4             10\n *              R1(r) = r - (P1*r  + P2*r  + ... + P5*r   ).\n *\n *   3. Scale back to obtain exp(x):\n *      From step 1, we have\n *         exp(x) = 2^k * exp(r)\n *\n * Special cases:\n *      exp(INF) is INF, exp(NaN) is NaN;\n *      exp(-INF) is 0, and\n *      for finite argument, only exp(0)=1 is exact.\n *\n * Accuracy:\n *      according to an error analysis, the error is always less than\n *      1 ulp (unit in the last place).\n *\n * Misc. info:\n *      For IEEE double\n *          if x >  7.09782712893383973096e+02 then exp(x) overflow\n *          if x < -7.45133219101941108420e+02 then exp(x) underflow\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n */\n\nstatic const double halF[2] = {\n  0.5,\n  -0.5,\n};\nstatic const double ln2HI[2] = {\n  6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */\n  -6.93147180369123816490e-01, /* 0xbfe62e42, 0xfee00000 */\n};\nstatic const double ln2LO[2] = {\n  1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */\n  -1.90821492927058770002e-10, /* 0xbdea39ef, 0x35793c76 */\n};\n\n#define one         1.0\n#define huge        1.0e+300\n#define twom1000    9.33263618503218878990e-302 /* 2**-1000=0x01700000,0 */\n#define o_threshold 7.09782712893383973096e+02 /* 0x40862E42, 0xFEFA39EF */\n#define u_threshold -7.45133219101941108420e+02 /* 0xc0874910, 0xD52D3051 */\n#define invln2      1.44269504088896338700e+00 /* 0x3ff71547, 0x652b82fe */\n#define P1          1.66666666666666019037e-01 /* 0x3FC55555, 0x5555553E */\n#define P2          -2.77777777770155933842e-03 /* 0xBF66C16C, 0x16BEBD93 */\n#define P3          6.61375632143793436117e-05 /* 0x3F11566A, 0xAF25DE2C */\n#define P4          -1.65339022054652515390e-06 /* 0xBEBBBD41, 0xC5D26BF1 */\n#define P5          4.13813679705723846039e-08 /* 0x3E663769, 0x72BEA4D0 */\n\ndouble\nexp (double x) /* default IEEE double exp */\n{\n  double hi, lo, c, t;\n  int k = 0, xsb;\n  unsigned hx;\n\n  hx = __HI (x); /* high word of x */\n  xsb = (hx >> 31) & 1; /* sign bit of x */\n  hx &= 0x7fffffff; /* high word of |x| */\n\n  /* filter out non-finite argument */\n  if (hx >= 0x40862E42) /* if |x| >= 709.78... */\n  {\n    if (hx >= 0x7ff00000)\n    {\n      if (((hx & 0xfffff) | __LO (x)) != 0) /* NaN */\n      {\n        return x + x;\n      }\n      else /* exp(+-inf) = {inf,0} */\n      {\n        return (xsb == 0) ? x : 0.0;\n      }\n    }\n    if (x > o_threshold) /* overflow */\n    {\n      return huge * huge;\n    }\n    if (x < u_threshold) /* underflow */\n    {\n      return twom1000 * twom1000;\n    }\n  }\n\n  /* argument reduction */\n  if (hx > 0x3fd62e42) /* if  |x| > 0.5 ln2 */\n  {\n    if (hx < 0x3FF0A2B2) /* and |x| < 1.5 ln2 */\n    {\n      hi = x - ln2HI[xsb];\n      lo = ln2LO[xsb];\n      k = 1 - xsb - xsb;\n    }\n    else\n    {\n      k = (int) (invln2 * x + halF[xsb]);\n      t = k;\n      hi = x - t * ln2HI[0]; /* t * ln2HI is exact here */\n      lo = t * ln2LO[0];\n    }\n    x = hi - lo;\n  }\n  else if (hx < 0x3e300000) /* when |x| < 2**-28 */\n  {\n    if (huge + x > one) /* trigger inexact */\n    {\n      return one + x;\n    }\n  }\n  else\n  {\n    k = 0;\n  }\n\n  double_accessor ret;\n\n  /* x is now in primary range */\n  t = x * x;\n  c = x - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5))));\n  if (k == 0)\n  {\n    return one - ((x * c) / (c - 2.0) - x);\n  }\n  else\n  {\n    ret.dbl = one - ((lo - (x * c) / (2.0 - c)) - hi);\n  }\n  if (k >= -1021)\n  {\n    ret.as_int.hi += (((unsigned int) k) << 20); /* add k to y's exponent */\n    return ret.dbl;\n  }\n  else\n  {\n    ret.as_int.hi += ((k + 1000) << 20); /* add k to y's exponent */\n    return ret.dbl * twom1000;\n  }\n} /* exp */\n\n#undef one\n#undef huge\n#undef twom1000\n#undef o_threshold\n#undef u_threshold\n#undef invln2\n#undef P1\n#undef P2\n#undef P3\n#undef P4\n#undef P5\n"
  },
  {
    "path": "jerry-math/expm1.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_expm1.c 5.1 93/09/24\n */\n\n#include \"jerry-math-internal.h\"\n\n/* expm1(x)\n * Returns exp(x)-1, the exponential of x minus 1.\n *\n * Method\n *   1. Argument reduction:\n *  Given x, find r and integer k such that\n *\n *               x = k*ln2 + r,  |r| <= 0.5*ln2 ~ 0.34658\n *\n *      Here a correction term c will be computed to compensate\n *  the error in r when rounded to a floating-point number.\n *\n *   2. Approximating expm1(r) by a special rational function on\n *  the interval [0,0.34658]:\n *  Since\n *      r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 - r^4/360 + ...\n *  we define R1(r*r) by\n *      r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 * R1(r*r)\n *  That is,\n *      R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r)\n *         = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r))\n *         = 1 - r^2/60 + r^4/2520 - r^6/100800 + ...\n *      We use a special Reme algorithm on [0,0.347] to generate\n *   a polynomial of degree 5 in r*r to approximate R1. The\n *  maximum error of this polynomial approximation is bounded\n *  by 2**-61. In other words,\n *      R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5\n *  where   Q1  =  -1.6666666666666567384E-2,\n *     Q2  =   3.9682539681370365873E-4,\n *     Q3  =  -9.9206344733435987357E-6,\n *     Q4  =   2.5051361420808517002E-7,\n *     Q5  =  -6.2843505682382617102E-9;\n *    z   =  r*r,\n *  with error bounded by\n *      |                  5           |     -61\n *      | 1.0+Q1*z+...+Q5*z   -  R1(z) | <= 2\n *      |                              |\n *\n *  expm1(r) = exp(r)-1 is then computed by the following\n *   specific way which minimize the accumulation rounding error:\n *                        2     3\n *                        r     r    [ 3 - (R1 + R1*r/2)  ]\n *        expm1(r) = r + --- + --- * [--------------------]\n *                        2     2    [ 6 - r*(3 - R1*r/2) ]\n *\n *  To compensate the error in the argument reduction, we use\n *    expm1(r+c) = expm1(r) + c + expm1(r)*c\n *         ~ expm1(r) + c + r*c\n *  Thus c+r*c will be added in as the correction terms for\n *  expm1(r+c). Now rearrange the term to avoid optimization\n *   screw up:\n *                  (      2                                    2 )\n *                  ({  ( r    [ R1 -  (3 - R1*r/2) ]  )  }    r  )\n *   expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- )\n *                  ({  ( 2    [ 6 - r*(3 - R1*r/2) ]  )  }    2  )\n *                  (                                             )\n *\n *       = r - E\n *   3. Scale back to obtain expm1(x):\n *  From step 1, we have\n *     expm1(x) = either 2^k*[expm1(r)+1] - 1\n *              = or     2^k*[expm1(r) + (1-2^-k)]\n *   4. Implementation notes:\n *  (A). To save one multiplication, we scale the coefficient Qi\n *       to Qi*2^i, and replace z by (x^2)/2.\n *  (B). To achieve maximum accuracy, we compute expm1(x) by\n *    (i)   if x < -56*ln2, return -1.0, (raise inexact if x!=inf)\n *    (ii)  if k=0, return r-E\n *    (iii) if k=-1, return 0.5*(r-E)-0.5\n *    (iv)  if k=1 if r < -0.25, return 2*((r+0.5)- E)\n *                  else       return  1.0+2.0*(r-E);\n *    (v)   if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1)\n *    (vi)  if k <= 20, return 2^k((1-2^-k)-(E-r)), else\n *    (vii) return 2^k(1-((E+2^-k)-r))\n *\n * Special cases:\n *  expm1(INF) is INF, expm1(NaN) is NaN;\n *  expm1(-INF) is -1, and\n *  for finite argument, only expm1(0)=0 is exact.\n *\n * Accuracy:\n *  according to an error analysis, the error is always less than\n *  1 ulp (unit in the last place).\n *\n * Misc. info.\n *  For IEEE double\n *      if x >  7.09782712893383973096e+02 then expm1(x) overflow\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n */\n\n#define one         1.0\n#define huge        1.0e+300\n#define tiny        1.0e-300\n#define o_threshold 7.09782712893383973096e+02 /* 0x40862E42, 0xFEFA39EF */\n#define ln2_hi      6.93147180369123816490e-01 /* 0x3fe62e42, 0xfee00000 */\n#define ln2_lo      1.90821492927058770002e-10 /* 0x3dea39ef, 0x35793c76 */\n#define invln2      1.44269504088896338700e+00 /* 0x3ff71547, 0x652b82fe */\n\n/* Scaled Q's: Qn_here = 2**n * Qn_above, for R(2*z) where z = hxs = x*x/2: */\n#define Q1 -3.33333333333331316428e-02 /* BFA11111 111110F4 */\n#define Q2 1.58730158725481460165e-03 /* 3F5A01A0 19FE5585 */\n#define Q3 -7.93650757867487942473e-05 /* BF14CE19 9EAADBB7 */\n#define Q4 4.00821782732936239552e-06 /* 3ED0CFCA 86E65239 */\n#define Q5 -2.01099218183624371326e-07 /* BE8AFDB7 6E09C32D */\n\ndouble\nexpm1 (double x)\n{\n  double y, hi, lo, c, e, hxs, hfx, r1;\n  double_accessor t, twopk;\n  int k, xsb;\n  unsigned int hx;\n\n  hx = __HI (x);\n  xsb = hx & 0x80000000; /* sign bit of x */\n  hx &= 0x7fffffff; /* high word of |x| */\n\n  /* filter out huge and non-finite argument */\n  if (hx >= 0x4043687A)\n  {\n    /* if |x|>=56*ln2 */\n    if (hx >= 0x40862E42)\n    {\n      /* if |x|>=709.78... */\n      if (hx >= 0x7ff00000)\n      {\n        unsigned int low;\n        low = __LO (x);\n        if (((hx & 0xfffff) | low) != 0)\n        {\n          /* NaN */\n          return x + x;\n        }\n        else\n        {\n          /* exp(+-inf)-1={inf,-1} */\n          return (xsb == 0) ? x : -1.0;\n        }\n      }\n      if (x > o_threshold)\n      {\n        /* overflow */\n        return huge * huge;\n      }\n    }\n    if (xsb != 0)\n    {\n      /* x < -56*ln2, return -1.0 with inexact */\n      if (x + tiny < 0.0) /* raise inexact */\n      {\n        /* return -1 */\n        return tiny - one;\n      }\n    }\n  }\n\n  /* argument reduction */\n  if (hx > 0x3fd62e42)\n  {\n    /* if  |x| > 0.5 ln2 */\n    if (hx < 0x3FF0A2B2)\n    {\n      /* and |x| < 1.5 ln2 */\n      if (xsb == 0)\n      {\n        hi = x - ln2_hi;\n        lo = ln2_lo;\n        k = 1;\n      }\n      else\n      {\n        hi = x + ln2_hi;\n        lo = -ln2_lo;\n        k = -1;\n      }\n    }\n    else\n    {\n      k = (int) (invln2 * x + ((xsb == 0) ? 0.5 : -0.5));\n      t.dbl = k;\n      hi = x - t.dbl * ln2_hi; /* t*ln2_hi is exact here */\n      lo = t.dbl * ln2_lo;\n    }\n    x = hi - lo;\n    c = (hi - x) - lo;\n  }\n  else if (hx < 0x3c900000)\n  {\n    /* when |x|<2**-54, return x */\n    return x;\n  }\n  else\n  {\n    k = 0;\n  }\n\n  /* x is now in primary range */\n  hfx = 0.5 * x;\n  hxs = x * hfx;\n  r1 = one + hxs * (Q1 + hxs * (Q2 + hxs * (Q3 + hxs * (Q4 + hxs * Q5))));\n  t.dbl = 3.0 - r1 * hfx;\n  e = hxs * ((r1 - t.dbl) / (6.0 - x * t.dbl));\n  if (k == 0)\n  {\n    /* c is 0 */\n    return x - (x * e - hxs);\n  }\n  else\n  {\n    twopk.as_int.hi = 0x3ff00000 + ((unsigned int) k << 20); /* 2^k */\n    twopk.as_int.lo = 0;\n    e = (x * (e - c) - c);\n    e -= hxs;\n    if (k == -1)\n    {\n      return 0.5 * (x - e) - 0.5;\n    }\n    if (k == 1)\n    {\n      if (x < -0.25)\n      {\n        return -2.0 * (e - (x + 0.5));\n      }\n      else\n      {\n        return one + 2.0 * (x - e);\n      }\n    }\n    if ((k <= -2) || (k > 56))\n    {\n      /* suffice to return exp(x)-1 */\n      y = one - (e - x);\n      if (k == 1024)\n      {\n        const double twop1023 = ((double_accessor){ .as_int = { .hi = 0x7fe00000, .lo = 0 } }).dbl; /* 0x1p1023 */\n        y = y * 2.0 * twop1023;\n      }\n      else\n      {\n        y = y * twopk.dbl;\n      }\n      return y - one;\n    }\n    t.dbl = one;\n    if (k < 20)\n    {\n      t.as_int.hi = (0x3ff00000 - (0x200000 >> k)); /* t=1-2^-k */\n      y = t.dbl - (e - x);\n      y = y * twopk.dbl;\n    }\n    else\n    {\n      t.as_int.hi = ((0x3ff - k) << 20); /* 2^-k */\n      y = x - (e + t.dbl);\n      y += one;\n      y = y * twopk.dbl;\n    }\n  }\n  return y;\n} /* expm1 */\n\n#undef one\n#undef huge\n#undef tiny\n#undef o_threshold\n#undef ln2_hi\n#undef ln2_lo\n#undef invln2\n#undef Q1\n#undef Q2\n#undef Q3\n#undef Q4\n#undef Q5\n"
  },
  {
    "path": "jerry-math/fabs.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_fabs.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* fabs(x) returns the absolute value of x.\n */\n\ndouble\nfabs (double x)\n{\n  double_accessor ret;\n  ret.dbl = x;\n  ret.as_int.hi &= 0x7fffffff;\n  return ret.dbl;\n} /* fabs */\n"
  },
  {
    "path": "jerry-math/floor.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_floor.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* floor(x)\n * Return x rounded toward -inf to integral value\n *\n * Method:\n *      Bit twiddling.\n *\n * Exception:\n *      Inexact flag raised if x not equal to floor(x).\n */\n\n#define huge 1.0e300\n\ndouble\nfloor (double x)\n{\n  int i0, i1, j0;\n  unsigned i, j;\n\n  i0 = __HI (x);\n  i1 = __LO (x);\n  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;\n  if (j0 < 20)\n  {\n    if (j0 < 0) /* raise inexact if x != 0 */\n    {\n      if (huge + x > 0.0) /* return 0 * sign(x) if |x| < 1 */\n      {\n        if (i0 >= 0)\n        {\n          i0 = i1 = 0;\n        }\n        else if (((i0 & 0x7fffffff) | i1) != 0)\n        {\n          i0 = 0xbff00000;\n          i1 = 0;\n        }\n      }\n    }\n    else\n    {\n      i = (0x000fffff) >> j0;\n      if (((i0 & i) | i1) == 0) /* x is integral */\n      {\n        return x;\n      }\n      if (huge + x > 0.0) /* raise inexact flag */\n      {\n        if (i0 < 0)\n        {\n          i0 += (0x00100000) >> j0;\n        }\n        i0 &= (~i);\n        i1 = 0;\n      }\n    }\n  }\n  else if (j0 > 51)\n  {\n    if (j0 == 0x400) /* inf or NaN */\n    {\n      return x + x;\n    }\n    else /* x is integral */\n    {\n      return x;\n    }\n  }\n  else\n  {\n    i = ((unsigned) (0xffffffff)) >> (j0 - 20);\n    if ((i1 & i) == 0) /* x is integral */\n    {\n      return x;\n    }\n    if (huge + x > 0.0) /* raise inexact flag */\n    {\n      if (i0 < 0)\n      {\n        if (j0 == 20)\n        {\n          i0 += 1;\n        }\n        else\n        {\n          j = i1 + (1 << (52 - j0));\n          if (j < i1) /* got a carry */\n          {\n            i0 += 1;\n          }\n          i1 = j;\n        }\n      }\n      i1 &= (~i);\n    }\n  }\n\n  double_accessor ret;\n  ret.as_int.hi = i0;\n  ret.as_int.lo = i1;\n  return ret.dbl;\n} /* floor */\n\n#undef huge\n"
  },
  {
    "path": "jerry-math/fmod.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_fmod.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* fmod(x,y)\n * Return x mod y in exact arithmetic\n *\n * Method: shift and subtract\n */\n\nstatic const double Zero[] = {\n  0.0,\n  -0.0,\n};\n\ndouble\nfmod (double x, double y)\n{\n  int n, hx, hy, hz, ix, iy, sx, i;\n  unsigned lx, ly, lz;\n\n  hx = __HI (x); /* high word of x */\n  lx = __LO (x); /* low  word of x */\n  hy = __HI (y); /* high word of y */\n  ly = __LO (y); /* low  word of y */\n  sx = hx & 0x80000000; /* sign of x */\n  hx ^= sx; /* |x| */\n  hy &= 0x7fffffff; /* |y| */\n\n  /* purge off exception values */\n  if ((hy | ly) == 0 || (hx >= 0x7ff00000) || /* y = 0, or x not finite */\n      ((hy | ((ly | -ly) >> 31)) > 0x7ff00000)) /* or y is NaN */\n  {\n    return NAN;\n  }\n  if (hx <= hy)\n  {\n    if ((hx < hy) || (lx < ly)) /* |x| < |y| return x */\n    {\n      return x;\n    }\n    if (lx == ly) /* |x| = |y| return x * 0 */\n    {\n      return Zero[(unsigned) sx >> 31];\n    }\n  }\n\n  /* determine ix = ilogb(x) */\n  if (hx < 0x00100000) /* subnormal x */\n  {\n    if (hx == 0)\n    {\n      for (ix = -1043, i = lx; i > 0; i <<= 1)\n      {\n        ix -= 1;\n      }\n    }\n    else\n    {\n      for (ix = -1022, i = (hx << 11); i > 0; i <<= 1)\n      {\n        ix -= 1;\n      }\n    }\n  }\n  else\n  {\n    ix = (hx >> 20) - 1023;\n  }\n\n  /* determine iy = ilogb(y) */\n  if (hy < 0x00100000) /* subnormal y */\n  {\n    if (hy == 0)\n    {\n      for (iy = -1043, i = ly; i > 0; i <<= 1)\n      {\n        iy -= 1;\n      }\n    }\n    else\n    {\n      for (iy = -1022, i = (hy << 11); i > 0; i <<= 1)\n      {\n        iy -= 1;\n      }\n    }\n  }\n  else\n  {\n    iy = (hy >> 20) - 1023;\n  }\n\n  /* set up {hx,lx}, {hy,ly} and align y to x */\n  if (ix >= -1022)\n  {\n    hx = 0x00100000 | (0x000fffff & hx);\n  }\n  else /* subnormal x, shift x to normal */\n  {\n    n = -1022 - ix;\n    if (n <= 31)\n    {\n      hx = (((unsigned int) hx) << n) | (lx >> (32 - n));\n      lx <<= n;\n    }\n    else\n    {\n      hx = lx << (n - 32);\n      lx = 0;\n    }\n  }\n  if (iy >= -1022)\n  {\n    hy = 0x00100000 | (0x000fffff & hy);\n  }\n  else /* subnormal y, shift y to normal */\n  {\n    n = -1022 - iy;\n    if (n <= 31)\n    {\n      hy = (((unsigned int) hy) << n) | (ly >> (32 - n));\n      ly <<= n;\n    }\n    else\n    {\n      hy = ly << (n - 32);\n      ly = 0;\n    }\n  }\n\n  /* fix point fmod */\n  n = ix - iy;\n  while (n--)\n  {\n    hz = hx - hy;\n    lz = lx - ly;\n    if (lx < ly)\n    {\n      hz -= 1;\n    }\n    if (hz < 0)\n    {\n      hx = hx + hx + (lx >> 31);\n      lx = lx + lx;\n    }\n    else\n    {\n      if ((hz | lz) == 0) /* return sign(x) * 0 */\n      {\n        return Zero[(unsigned) sx >> 31];\n      }\n      hx = hz + hz + (lz >> 31);\n      lx = lz + lz;\n    }\n  }\n  hz = hx - hy;\n  lz = lx - ly;\n  if (lx < ly)\n  {\n    hz -= 1;\n  }\n  if (hz >= 0)\n  {\n    hx = hz;\n    lx = lz;\n  }\n\n  /* convert back to floating value and restore the sign */\n  if ((hx | lx) == 0) /* return sign(x) * 0 */\n  {\n    return Zero[(unsigned) sx >> 31];\n  }\n  while (hx < 0x00100000) /* normalize x */\n  {\n    hx = hx + hx + (lx >> 31);\n    lx = lx + lx;\n    iy -= 1;\n  }\n\n  double_accessor ret;\n  if (iy >= -1022) /* normalize output */\n  {\n    hx = ((hx - 0x00100000) | ((iy + 1023) << 20));\n    ret.as_int.hi = hx | sx;\n    ret.as_int.lo = lx;\n  }\n  else /* subnormal output */\n  {\n    n = -1022 - iy;\n    if (n <= 20)\n    {\n      lx = (lx >> n) | ((unsigned) hx << (32 - n));\n      hx >>= n;\n    }\n    else if (n <= 31)\n    {\n      lx = (hx << (32 - n)) | (lx >> n);\n      hx = sx;\n    }\n    else\n    {\n      lx = hx >> (n - 32);\n      hx = sx;\n    }\n    ret.as_int.hi = hx | sx;\n    ret.as_int.lo = lx;\n  }\n  return ret.dbl; /* exact output */\n} /* fmod */\n"
  },
  {
    "path": "jerry-math/include/math.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JERRY_MATH_H\n#define JERRY_MATH_H\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif /* __cplusplus */\n\n/* General Constants. */\n#ifdef _MSC_VER\n#define INFINITY ((float) (1e+300 * 1e+300)) /* 1e+300*1e+300 must overflow */\n#define NAN      ((float) (INFINITY * 0.0f))\n#else /* !_MSC_VER */\n#define INFINITY ((float) (1.0 / 0.0))\n#define NAN      ((float) (0.0 / 0.0))\n#endif /* _MSC_VER */\n#define HUGE_VAL ((double) INFINITY)\n\n#define isnan(x)    ((x) != (x))\n#define isinf(x)    ((x) == INFINITY ? 1 : (x) == -INFINITY ? -1 : 0)\n#define isfinite(x) (!isinf (x) && !isnan (x))\n\n/* Exponential and Logarithmic constants. */\n#define M_E       2.7182818284590452353602874713526625\n#define M_SQRT2   1.4142135623730950488016887242096981\n#define M_SQRT1_2 0.7071067811865475244008443621048490\n#define M_LOG2E   1.4426950408889634073599246810018921\n#define M_LOG10E  0.4342944819032518276511289189166051\n#define M_LN2     0.6931471805599453094172321214581765\n#define M_LN10    2.3025850929940456840179914546843642\n\n/* Trigonometric Constants. */\n#define M_PI       3.1415926535897932384626433832795029\n#define M_PI_2     1.5707963267948966192313216916397514\n#define M_PI_4     0.7853981633974483096156608458198757\n#define M_1_PI     0.3183098861837906715377675267450287\n#define M_2_PI     0.6366197723675813430755350534900574\n#define M_2_SQRTPI 1.1283791670955125738961589031215452\n\n/* Trigonometric functions. */\ndouble cos (double);\ndouble sin (double);\ndouble tan (double);\ndouble acos (double);\ndouble asin (double);\ndouble atan (double);\ndouble atan2 (double, double);\n\n/* Hyperbolic functions. */\ndouble cosh (double x);\ndouble sinh (double x);\ndouble tanh (double x);\n\n/* Inverse hyperbolic functions */\ndouble acosh (double);\ndouble asinh (double);\ndouble atanh (double);\n\n/* Exponential and logarithmic functions. */\ndouble exp (double);\ndouble expm1 (double);\ndouble log (double);\ndouble log1p (double);\ndouble log2 (double);\ndouble log10 (double);\n\n/* Power functions. */\ndouble pow (double, double);\ndouble sqrt (double);\ndouble cbrt (double);\n\n/* Rounding and remainder functions. */\ndouble ceil (double);\ndouble floor (double);\n\n/* Other functions. */\ndouble fabs (double);\ndouble fmod (double, double);\n\ndouble nextafter (double, double);\n\n#ifdef __cplusplus\n} /* __cplusplus_extern_C */\n#endif /* __cplusplus */\n#endif /* !JERRY_MATH_H */\n"
  },
  {
    "path": "jerry-math/jerry-math-internal.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)fdlibm.h 1.5 04/04/22\n */\n\n#ifndef JERRY_MATH_INTERNAL_H\n#define JERRY_MATH_INTERNAL_H\n\n/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly\n   but these catch some common cases. */\n\n#ifndef __LITTLE_ENDIAN\n/* Check if compiler has byte order macro. Some older versions do not.\n * If byte order is supported and set to little or target is among common\n * cases checked define __LITTLE_ENDIAN.\n */\n#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(i486) || defined(__i486) || defined(__i486__)  \\\n     || defined(intel) || defined(x86) || defined(i86pc) || defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) \\\n     || defined(__alpha) || defined(__osf__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)      \\\n     || defined(_M_ARM) || defined(_M_ARM64) || defined(__xtensa__) || defined(__MIPSEL))                            \\\n  || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))\n#define __LITTLE_ENDIAN\n#endif /* platform defines */\n#endif /* !__LITTLE_ENDIAN */\n\n#ifdef __LITTLE_ENDIAN\n#define __HI(x) *(1 + (const int *) &x)\n#define __LO(x) *(const int *) &x\ntypedef union\n{\n  double dbl;\n  struct\n  {\n    int lo;\n    int hi;\n  } as_int;\n} double_accessor;\n#else /* !__LITTLE_ENDIAN */\n#define __HI(x) *(const int *) &x\n#define __LO(x) *(1 + (const int *) &x)\n\ntypedef union\n{\n  double dbl;\n  struct\n  {\n    int hi;\n    int lo;\n  } as_int;\n} double_accessor;\n#endif /* __LITTLE_ENDIAN */\n\n#ifndef NAN\n#ifdef _MSC_VER\n#define INFINITY ((float) (1e+300 * 1e+300)) /* 1e+300*1e+300 must overflow */\n#define NAN      ((float) (INFINITY * 0.0f))\n#else /* !_MSC_VER */\n#define INFINITY ((float) (1.0 / 0.0))\n#define NAN      ((float) (0.0 / 0.0))\n#endif /* _MSC_VER */\n#endif /* !NAN */\n\n/*\n * ANSI/POSIX\n */\ndouble acos (double x);\ndouble asin (double x);\ndouble atan (double x);\ndouble atan2 (double y, double x);\ndouble cos (double x);\ndouble sin (double x);\ndouble tan (double x);\n\ndouble cosh (double x);\ndouble sinh (double x);\ndouble tanh (double x);\n\ndouble acosh (double x);\ndouble asinh (double x);\ndouble atanh (double x);\n\ndouble exp (double x);\ndouble expm1 (double x);\ndouble log (double x);\ndouble log1p (double x);\ndouble log2 (double x);\ndouble log10 (double);\n\ndouble pow (double x, double y);\ndouble sqrt (double x);\ndouble cbrt (double);\n\ndouble ceil (double x);\ndouble fabs (double x);\ndouble floor (double x);\ndouble fmod (double x, double y);\n\ndouble nextafter (double x, double y);\n\n/*\n * Functions callable from C, intended to support IEEE arithmetic.\n */\ndouble copysign (double x, double y);\ndouble scalbn (double x, int n);\n\n#endif /* !JERRY_MATH_INTERNAL_H */\n"
  },
  {
    "path": "jerry-math/libjerry-math.pc.in",
    "content": "prefix=@CMAKE_INSTALL_PREFIX@\nlibdir=${prefix}/lib\nincludedir=${prefix}/include/jerryscript-math\n\nName: libjerry-math\nDescription: JerryScript: lightweight JavaScript engine (minimal math library)\nURL: https://github.com/jerryscript-project/jerryscript\nVersion: @JERRY_VERSION@\nLibs: -L${libdir} -ljerry-math\nCflags: -I${includedir}\n"
  },
  {
    "path": "jerry-math/log.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_log.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* log(x)\n * Return the logrithm of x\n *\n * Method :\n *   1. Argument Reduction: find k and f such that\n *                      x = 2^k * (1+f),\n *         where  sqrt(2)/2 < 1+f < sqrt(2) .\n *\n *   2. Approximation of log(1+f).\n *      Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)\n *               = 2s + 2/3 s**3 + 2/5 s**5 + .....,\n *               = 2s + s*R\n *      We use a special Reme algorithm on [0,0.1716] to generate\n *      a polynomial of degree 14 to approximate R The maximum error\n *      of this polynomial approximation is bounded by 2**-58.45. In\n *      other words,\n *                      2      4      6      8      10      12      14\n *          R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s  +Lg6*s  +Lg7*s\n *      (the values of Lg1 to Lg7 are listed in the program)\n *      and\n *          |      2          14          |     -58.45\n *          | Lg1*s +...+Lg7*s    -  R(z) | <= 2\n *          |                             |\n *      Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.\n *      In order to guarantee error in log below 1ulp, we compute log\n *      by\n *              log(1+f) = f - s*(f - R)                (if f is not too large)\n *              log(1+f) = f - (hfsq - s*(hfsq+R)).     (better accuracy)\n *\n *      3. Finally,  log(x) = k*ln2 + log(1+f).\n *                          = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))\n *         Here ln2 is split into two floating point number:\n *                      ln2_hi + ln2_lo,\n *         where n*ln2_hi is always exact for |n| < 2000.\n *\n * Special cases:\n *      log(x) is NaN with signal if x < 0 (including -INF) ;\n *      log(+INF) is +INF; log(0) is -INF with signal;\n *      log(NaN) is that NaN with no signal.\n *\n * Accuracy:\n *      according to an error analysis, the error is always less than\n *      1 ulp (unit in the last place).\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n */\n\n#define zero   0.0\n#define ln2_hi 6.93147180369123816490e-01 /* 3fe62e42 fee00000 */\n#define ln2_lo 1.90821492927058770002e-10 /* 3dea39ef 35793c76 */\n#define two54  1.80143985094819840000e+16 /* 43500000 00000000 */\n#define Lg1    6.666666666666735130e-01 /* 3FE55555 55555593 */\n#define Lg2    3.999999999940941908e-01 /* 3FD99999 9997FA04 */\n#define Lg3    2.857142874366239149e-01 /* 3FD24924 94229359 */\n#define Lg4    2.222219843214978396e-01 /* 3FCC71C5 1D8E78AF */\n#define Lg5    1.818357216161805012e-01 /* 3FC74664 96CB03DE */\n#define Lg6    1.531383769920937332e-01 /* 3FC39A09 D078C69F */\n#define Lg7    1.479819860511658591e-01 /* 3FC2F112 DF3E5244 */\n\ndouble\nlog (double x)\n{\n  double hfsq, f, s, z, R, w, t1, t2, dk;\n  int k, hx, i, j;\n  unsigned lx;\n\n  hx = __HI (x); /* high word of x */\n  lx = __LO (x); /* low  word of x */\n\n  k = 0;\n  if (hx < 0x00100000) /* x < 2**-1022  */\n  {\n    if (((hx & 0x7fffffff) | lx) == 0) /* log(+-0) = -inf */\n    {\n      return -INFINITY;\n    }\n    if (hx < 0) /* log(-#) = NaN */\n    {\n      return NAN;\n    }\n    k -= 54;\n    x *= two54; /* subnormal number, scale up x */\n    hx = __HI (x); /* high word of x */\n  }\n  if (hx >= 0x7ff00000)\n  {\n    return x + x;\n  }\n  k += (hx >> 20) - 1023;\n  hx &= 0x000fffff;\n  i = (hx + 0x95f64) & 0x100000;\n\n  double_accessor temp;\n  temp.dbl = x;\n  temp.as_int.hi = hx | (i ^ 0x3ff00000); /* normalize x or x / 2 */\n  k += (i >> 20);\n  f = temp.dbl - 1.0;\n\n  if ((0x000fffff & (2 + hx)) < 3) /* |f| < 2**-20 */\n  {\n    if (f == zero)\n    {\n      if (k == 0)\n      {\n        return zero;\n      }\n      else\n      {\n        dk = (double) k;\n        return dk * ln2_hi + dk * ln2_lo;\n      }\n    }\n    R = f * f * (0.5 - 0.33333333333333333 * f);\n    if (k == 0)\n    {\n      return f - R;\n    }\n    else\n    {\n      dk = (double) k;\n      return dk * ln2_hi - ((R - dk * ln2_lo) - f);\n    }\n  }\n  s = f / (2.0 + f);\n  dk = (double) k;\n  z = s * s;\n  i = hx - 0x6147a;\n  w = z * z;\n  j = 0x6b851 - hx;\n  t1 = w * (Lg2 + w * (Lg4 + w * Lg6));\n  t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7)));\n  i |= j;\n  R = t2 + t1;\n  if (i > 0)\n  {\n    hfsq = 0.5 * f * f;\n    if (k == 0)\n    {\n      return f - (hfsq - s * (hfsq + R));\n    }\n    else\n    {\n      return dk * ln2_hi - ((hfsq - (s * (hfsq + R) + dk * ln2_lo)) - f);\n    }\n  }\n  else\n  {\n    if (k == 0)\n    {\n      return f - s * (f - R);\n    }\n    else\n    {\n      return dk * ln2_hi - ((s * (f - R) - dk * ln2_lo) - f);\n    }\n  }\n} /* log */\n\n#undef zero\n#undef ln2_hi\n#undef ln2_lo\n#undef two54\n#undef Lg1\n#undef Lg2\n#undef Lg3\n#undef Lg4\n#undef Lg5\n#undef Lg6\n#undef Lg7\n"
  },
  {
    "path": "jerry-math/log10.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_log10.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* log10(x)\n * Return the base 10 logarithm of x\n *\n * Method :\n *  Let log10_2hi = leading 40 bits of log10(2) and\n *      log10_2lo = log10(2) - log10_2hi,\n *      ivln10   = 1/log(10) rounded.\n *  Then\n *    n = ilogb(x),\n *    if(n<0)  n = n+1;\n *    x = scalbn(x,-n);\n *    log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x))\n *\n * Note 1:\n *  To guarantee log10(10**n)=n, where 10**n is normal, the rounding\n *  mode must set to Round-to-Nearest.\n * Note 2:\n *  [1/log(10)] rounded to 53 bits has error  .198   ulps;\n *  log10 is monotonic at all binary break points.\n *\n * Special cases:\n *  log10(x) is NaN with signal if x < 0;\n *  log10(+INF) is +INF with no signal; log10(0) is -INF with signal;\n *  log10(NaN) is that NaN with no signal;\n *  log10(10**N) = N  for N=0,1,...,22.\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following constants.\n * The decimal values may be used, provided that the compiler will convert\n * from decimal to binary accurately enough to produce the hexadecimal values\n * shown.\n */\n\n#define zero      0.0\n#define two54     1.80143985094819840000e+16 /* 0x43500000, 0x00000000 */\n#define ivln10    4.34294481903251816668e-01 /* 0x3FDBCB7B, 0x1526E50E */\n#define log10_2hi 3.01029995663611771306e-01 /* 0x3FD34413, 0x509F6000 */\n#define log10_2lo 3.69423907715893078616e-13 /* 0x3D59FEF3, 0x11F12B36 */\n\ndouble\nlog10 (double x)\n{\n  double y, z;\n  int i, k, hx;\n  unsigned lx;\n  double_accessor temp;\n\n  hx = __HI (x); /* high word of x */\n  lx = __LO (x); /* low word of x */\n\n  k = 0;\n  if (hx < 0x00100000)\n  {\n    /* x < 2**-1022  */\n    if (((hx & 0x7fffffff) | lx) == 0)\n    {\n      /* log(+-0)=-inf */\n      return -INFINITY;\n    }\n    if (hx < 0)\n    {\n      /* log(-#) = NaN */\n      return NAN;\n    }\n    k -= 54;\n    x *= two54; /* subnormal number, scale up x */\n    hx = __HI (x); /* high word of x */\n  }\n  if (hx >= 0x7ff00000)\n  {\n    return x + x;\n  }\n  k += (hx >> 20) - 1023;\n  i = ((unsigned) k & 0x80000000) >> 31;\n  hx = (hx & 0x000fffff) | ((0x3ff - i) << 20);\n  y = (double) (k + i);\n  temp.dbl = x;\n  temp.as_int.hi = hx;\n  z = y * log10_2lo + ivln10 * log (temp.dbl);\n  return z + y * log10_2hi;\n} /* log10 */\n\n#undef zero\n#undef two54\n#undef ivln10\n#undef log10_2hi\n#undef log10_2lo\n"
  },
  {
    "path": "jerry-math/log1p.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_log1p.c 5.1 93/09/24\n */\n\n#include \"jerry-math-internal.h\"\n\n/* log1p(x)\n * Method :\n *   1. Argument Reduction: find k and f such that\n *      1+x = 2^k * (1+f),\n *     where  sqrt(2)/2 < 1+f < sqrt(2) .\n *\n *      Note. If k=0, then f=x is exact. However, if k!=0, then f\n *  may not be representable exactly. In that case, a correction\n *  term is need. Let u=1+x rounded. Let c = (1+x)-u, then\n *  log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u),\n *  and add back the correction term c/u.\n *  (Note: when x > 2**53, one can simply return log(x))\n *\n *   2. Approximation of log1p(f).\n *  Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)\n *     = 2s + 2/3 s**3 + 2/5 s**5 + .....,\n *          = 2s + s*R\n *      We use a special Reme algorithm on [0,0.1716] to generate\n *   a polynomial of degree 14 to approximate R The maximum error\n *  of this polynomial approximation is bounded by 2**-58.45. In\n *  other words,\n *            2      4      6      8      10      12      14\n *      R(z) ~ Lp1*s +Lp2*s +Lp3*s +Lp4*s +Lp5*s  +Lp6*s  +Lp7*s\n *    (the values of Lp1 to Lp7 are listed in the program)\n *  and\n *      |      2          14          |     -58.45\n *      | Lp1*s +...+Lp7*s    -  R(z) | <= 2\n *      |                             |\n *  Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.\n *  In order to guarantee error in log below 1ulp, we compute log\n *  by\n *    log1p(f) = f - (hfsq - s*(hfsq+R)).\n *\n *  3. Finally, log1p(x) = k*ln2 + log1p(f).\n *            = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))\n *     Here ln2 is split into two floating point number:\n *      ln2_hi + ln2_lo,\n *     where n*ln2_hi is always exact for |n| < 2000.\n *\n * Special cases:\n *  log1p(x) is NaN with signal if x < -1 (including -INF) ;\n *  log1p(+INF) is +INF; log1p(-1) is -INF with signal;\n *  log1p(NaN) is that NaN with no signal.\n *\n * Accuracy:\n *  according to an error analysis, the error is always less than\n *  1 ulp (unit in the last place).\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n *\n * Note: Assuming log() return accurate answer, the following\n *    algorithm can be used to compute log1p(x) to within a few ULP:\n *\n *    u = 1+x;\n *    if(u==1.0) return x ; else\n *         return log(u)*(x/(u-1.0));\n *\n *   See HP-15C Advanced Functions Handbook, p.193.\n */\n\n#define zero   0.0\n#define ln2_hi 6.93147180369123816490e-01 /* 3fe62e42 fee00000 */\n#define ln2_lo 1.90821492927058770002e-10 /* 3dea39ef 35793c76 */\n#define two54  1.80143985094819840000e+16 /* 43500000 00000000 */\n#define Lp1    6.666666666666735130e-01 /* 3FE55555 55555593 */\n#define Lp2    3.999999999940941908e-01 /* 3FD99999 9997FA04 */\n#define Lp3    2.857142874366239149e-01 /* 3FD24924 94229359 */\n#define Lp4    2.222219843214978396e-01 /* 3FCC71C5 1D8E78AF */\n#define Lp5    1.818357216161805012e-01 /* 3FC74664 96CB03DE */\n#define Lp6    1.531383769920937332e-01 /* 3FC39A09 D078C69F */\n#define Lp7    1.479819860511658591e-01 /* 3FC2F112 DF3E5244 */\n\ndouble\nlog1p (double x)\n{\n  double hfsq, f, c, s, z, R;\n  double_accessor u;\n  int k, hx, hu, ax;\n\n  hx = __HI (x);\n  ax = hx & 0x7fffffff;\n  c = 0;\n  k = 1;\n  if (hx < 0x3FDA827A)\n  {\n    /* 1+x < sqrt(2)+ */\n    if (ax >= 0x3ff00000)\n    {\n      /* x <= -1.0 */\n      if (x == -1.0)\n      {\n        /* log1p(-1) = -inf */\n        return -INFINITY;\n      }\n      else\n      {\n        /* log1p(x<-1) = NaN */\n        return NAN;\n      }\n    }\n    if (ax < 0x3e200000)\n    { /* |x| < 2**-29 */\n      if ((two54 + x > zero) /* raise inexact */\n          && (ax < 0x3c900000)) /* |x| < 2**-54 */\n      {\n        return x;\n      }\n      else\n      {\n        return x - x * x * 0.5;\n      }\n    }\n    if ((hx > 0) || hx <= ((int) 0xbfd2bec4))\n    {\n      /* sqrt(2)/2- <= 1+x < sqrt(2)+ */\n      k = 0;\n      f = x;\n      hu = 1;\n    }\n  }\n  if (hx >= 0x7ff00000)\n  {\n    return x + x;\n  }\n  if (k != 0)\n  {\n    if (hx < 0x43400000)\n    {\n      u.dbl = 1.0 + x;\n      hu = u.as_int.hi;\n      k = (hu >> 20) - 1023;\n      c = (k > 0) ? 1.0 - (u.dbl - x) : x - (u.dbl - 1.0); /* correction term */\n      c /= u.dbl;\n    }\n    else\n    {\n      u.dbl = x;\n      hu = u.as_int.hi;\n      k = (hu >> 20) - 1023;\n      c = 0;\n    }\n    hu &= 0x000fffff;\n    /*\n     * The approximation to sqrt(2) used in thresholds is not\n     * critical.  However, the ones used above must give less\n     * strict bounds than the one here so that the k==0 case is\n     * never reached from here, since here we have committed to\n     * using the correction term but don't use it if k==0.\n     */\n    if (hu < 0x6a09e)\n    {\n      /* u ~< sqrt(2) */\n      u.as_int.hi = hu | 0x3ff00000; /* normalize u */\n    }\n    else\n    {\n      k += 1;\n      u.as_int.hi = hu | 0x3fe00000; /* normalize u/2 */\n      hu = (0x00100000 - hu) >> 2;\n    }\n    f = u.dbl - 1.0;\n  }\n  hfsq = 0.5 * f * f;\n  if (hu == 0)\n  {\n    /* |f| < 2**-20 */\n    if (f == zero)\n    {\n      if (k == 0)\n      {\n        return zero;\n      }\n      else\n      {\n        c += k * ln2_lo;\n        return k * ln2_hi + c;\n      }\n    }\n    R = hfsq * (1.0 - 0.66666666666666666 * f);\n    if (k == 0)\n    {\n      return f - R;\n    }\n    else\n    {\n      return k * ln2_hi - ((R - (k * ln2_lo + c)) - f);\n    }\n  }\n  s = f / (2.0 + f);\n  z = s * s;\n  R = z * (Lp1 + z * (Lp2 + z * (Lp3 + z * (Lp4 + z * (Lp5 + z * (Lp6 + z * Lp7))))));\n  if (k == 0)\n  {\n    return f - (hfsq - s * (hfsq + R));\n  }\n  else\n  {\n    return k * ln2_hi - ((hfsq - (s * (hfsq + R) + (k * ln2_lo + c))) - f);\n  }\n} /* log1p */\n\n#undef zero\n#undef ln2_hi\n#undef ln2_lo\n#undef two54\n#undef Lp1\n#undef Lp2\n#undef Lp3\n#undef Lp4\n#undef Lp5\n#undef Lp6\n#undef Lp7\n"
  },
  {
    "path": "jerry-math/log2.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_log2.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* log2(x)\n * Return the base 2 logarithm of x.  See e_log.c and k_log.h for most\n * comments.\n *\n * This reduces x to {k, 1+f} exactly as in e_log.c, then calls the kernel,\n * then does the combining and scaling steps\n *    log2(x) = (f - 0.5*f*f + k_log1p(f)) / ln2 + k\n * in not-quite-routine extra precision.\n */\n\n#define zero    0.0\n#define two54   1.80143985094819840000e+16 /* 0x43500000, 0x00000000 */\n#define ivln2hi 1.44269504072144627571e+00 /* 0x3FF71547, 0x65200000 */\n#define ivln2lo 1.67517131648865118353e-10 /* 0x3DE705FC, 0x2EEFA200 */\n#define Lg1     6.666666666666735130e-01 /* 0x3FE55555, 0x55555593 */\n#define Lg2     3.999999999940941908e-01 /* 0x3FD99999, 0x9997FA04 */\n#define Lg3     2.857142874366239149e-01 /* 0x3FD24924, 0x94229359 */\n#define Lg4     2.222219843214978396e-01 /* 0x3FCC71C5, 0x1D8E78AF */\n#define Lg5     1.818357216161805012e-01 /* 0x3FC74664, 0x96CB03DE */\n#define Lg6     1.531383769920937332e-01 /* 0x3FC39A09, 0xD078C69F */\n#define Lg7     1.479819860511658591e-01 /* 0x3FC2F112, 0xDF3E5244 */\n\ndouble\nlog2 (double x)\n{\n  double f, hfsq, hi, lo, r, val_hi, val_lo, w, y;\n  int i, k, hx;\n  unsigned int lx;\n  double_accessor temp;\n\n  hx = __HI (x); /* high word of x */\n  lx = __LO (x); /* low word of x */\n\n  k = 0;\n  if (hx < 0x00100000)\n  { /* x < 2**-1022  */\n    if (((hx & 0x7fffffff) | lx) == 0)\n    {\n      return -INFINITY; /* log(+-0)=-inf */\n    }\n    if (hx < 0)\n    {\n      return NAN; /* log(-#) = NaN */\n    }\n    k -= 54;\n    x *= two54; /* subnormal number, scale up x */\n    hx = __HI (x); /* high word of x */\n  }\n  if (hx >= 0x7ff00000)\n  {\n    return x + x;\n  }\n  if (hx == 0x3ff00000 && lx == 0)\n  {\n    return zero; /* log(1) = +0 */\n  }\n  k += (hx >> 20) - 1023;\n  hx &= 0x000fffff;\n  i = (hx + 0x95f64) & 0x100000;\n  temp.dbl = x;\n  temp.as_int.hi = hx | (i ^ 0x3ff00000); /* normalize x or x/2 */\n  k += (i >> 20);\n  y = (double) k;\n  f = temp.dbl - 1.0;\n  hfsq = 0.5 * f * f;\n  double s, z, R, t1, t2;\n\n  s = f / (2.0 + f);\n  z = s * s;\n  w = z * z;\n  t1 = w * (Lg2 + w * (Lg4 + w * Lg6));\n  t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7)));\n  R = t2 + t1;\n  r = s * (hfsq + R);\n  /*\n   * f-hfsq must (for args near 1) be evaluated in extra precision\n   * to avoid a large cancellation when x is near sqrt(2) or 1/sqrt(2).\n   * This is fairly efficient since f-hfsq only depends on f, so can\n   * be evaluated in parallel with R.  Not combining hfsq with R also\n   * keeps R small (though not as small as a true `lo' term would be),\n   * so that extra precision is not needed for terms involving R.\n   *\n   * Compiler bugs involving extra precision used to break Dekker's\n   * theorem for spitting f-hfsq as hi+lo, unless double_t was used\n   * or the multi-precision calculations were avoided when double_t\n   * has extra precision.  These problems are now automatically\n   * avoided as a side effect of the optimization of combining the\n   * Dekker splitting step with the clear-low-bits step.\n   *\n   * y must (for args near sqrt(2) and 1/sqrt(2)) be added in extra\n   * precision to avoid a very large cancellation when x is very near\n   * these values.  Unlike the above cancellations, this problem is\n   * specific to base 2.  It is strange that adding +-1 is so much\n   * harder than adding +-ln2 or +-log10_2.\n   *\n   * This uses Dekker's theorem to normalize y+val_hi, so the\n   * compiler bugs are back in some configurations, sigh.  And I\n   * don't want to used double_t to avoid them, since that gives a\n   * pessimization and the support for avoiding the pessimization\n   * is not yet available.\n   *\n   * The multi-precision calculations for the multiplications are\n   * routine.\n   */\n  hi = f - hfsq;\n  temp.dbl = hi;\n  temp.as_int.lo = 0;\n\n  lo = (f - hi) - hfsq + r;\n  val_hi = hi * ivln2hi;\n  val_lo = (lo + hi) * ivln2lo + lo * ivln2hi;\n\n  /* spadd(val_hi, val_lo, y), except for not using double_t: */\n  w = y + val_hi;\n  val_lo += (y - w) + val_hi;\n  val_hi = w;\n\n  return val_lo + val_hi;\n} /* log2 */\n\n#undef zero\n#undef two54\n#undef ivln2hi\n#undef ivln2lo\n#undef Lg1\n#undef Lg2\n#undef Lg3\n#undef Lg4\n#undef Lg5\n#undef Lg6\n#undef Lg7\n"
  },
  {
    "path": "jerry-math/nextafter.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_nextafter.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\ndouble\nnextafter (double x, double y)\n{\n  int hx, hy, ix, iy;\n  unsigned lx, ly;\n  double_accessor ret;\n\n  hx = __HI (x); /* high word of x */\n  lx = __LO (x); /* low  word of x */\n  hy = __HI (y); /* high word of y */\n  ly = __LO (y); /* low  word of y */\n  ix = hx & 0x7fffffff; /* |x| */\n  iy = hy & 0x7fffffff; /* |y| */\n\n  if (((ix >= 0x7ff00000) && ((ix - 0x7ff00000) | lx) != 0) /* x is nan */\n      || ((iy >= 0x7ff00000) && ((iy - 0x7ff00000) | ly) != 0)) /* y is nan */\n  {\n    return x + y;\n  }\n\n  if (x == y)\n  {\n    return x; /* x=y, return x */\n  }\n\n  if ((ix | lx) == 0)\n  { /* x == 0 */\n    ret.as_int.hi = hy & 0x80000000; /* return +-minsubnormal */\n    ret.as_int.lo = 1;\n    y = ret.dbl * ret.dbl;\n    if (y == ret.dbl)\n    {\n      return y;\n    }\n    else\n    {\n      return ret.dbl; /* raise underflow flag */\n    }\n  }\n\n  if (hx >= 0)\n  { /* x > 0 */\n    if (hx > hy || ((hx == hy) && (lx > ly)))\n    { /* x > y, x -= ulp */\n      if (lx == 0)\n      {\n        hx -= 1;\n      }\n\n      lx -= 1;\n    }\n    else\n    { /* x < y, x += ulp */\n      lx += 1;\n\n      if (lx == 0)\n      {\n        hx += 1;\n      }\n    }\n  }\n  else\n  { /* x < 0 */\n    if (hy >= 0 || hx > hy || ((hx == hy) && (lx > ly)))\n    { /* x < y, x -= ulp */\n      if (lx == 0)\n      {\n        hx -= 1;\n      }\n\n      lx -= 1;\n    }\n    else\n    { /* x > y, x += ulp */\n      lx += 1;\n\n      if (lx == 0)\n      {\n        hx += 1;\n      }\n    }\n  }\n\n  hy = hx & 0x7ff00000;\n\n  if (hy >= 0x7ff00000)\n  {\n    return x + x; /* overflow */\n  }\n\n  if (hy < 0x00100000)\n  { /* underflow */\n    y = x * x;\n    if (y != x)\n    { /* raise underflow flag */\n      ret.as_int.hi = hx;\n      ret.as_int.lo = lx;\n      return ret.dbl;\n    }\n  }\n\n  ret.as_int.hi = hx;\n  ret.as_int.lo = lx;\n  return ret.dbl;\n} /* nextafter */\n"
  },
  {
    "path": "jerry-math/pow.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_pow.c 1.5 04/04/22\n */\n\n#include \"jerry-math-internal.h\"\n\n/* pow(x,y) return x**y\n *\n *                    n\n * Method:  Let x =  2   * (1+f)\n *      1. Compute and return log2(x) in two pieces:\n *              log2(x) = w1 + w2,\n *         where w1 has 53-24 = 29 bit trailing zeros.\n *      2. Perform y*log2(x) = n+y' by simulating muti-precision\n *         arithmetic, where |y'|<=0.5.\n *      3. Return x**y = 2**n*exp(y'*log2)\n *\n * Special cases:\n *      0.  +1 ** (anything) is 1\n *      1.  (anything) ** 0  is 1\n *      2.  (anything) ** 1  is itself\n *      3.  (anything) ** NAN is NAN\n *      4.  NAN ** (anything except 0) is NAN\n *      5.  +-(|x| > 1) **  +INF is +INF\n *      6.  +-(|x| > 1) **  -INF is +0\n *      7.  +-(|x| < 1) **  +INF is +0\n *      8.  +-(|x| < 1) **  -INF is +INF\n *      9.  -1          ** +-INF is 1\n *      10. +0 ** (+anything except 0, NAN)               is +0\n *      11. -0 ** (+anything except 0, NAN, odd integer)  is +0\n *      12. +0 ** (-anything except 0, NAN)               is +INF\n *      13. -0 ** (-anything except 0, NAN, odd integer)  is +INF\n *      14. -0 ** (odd integer) = -( +0 ** (odd integer) )\n *      15. +INF ** (+anything except 0,NAN) is +INF\n *      16. +INF ** (-anything except 0,NAN) is +0\n *      17. -INF ** (anything)  = -0 ** (-anything)\n *      18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)\n *      19. (-anything except 0 and inf) ** (non-integer) is NAN\n *\n * Accuracy:\n *      pow(x,y) returns x**y nearly rounded. In particular\n *                      pow(integer,integer)\n *      always returns the correct integer provided it is\n *      representable.\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n */\n\nstatic const double bp[] = {\n  1.0,\n  1.5,\n};\nstatic const double dp_h[] = {\n  0.0,\n  5.84962487220764160156e-01, /* 0x3FE2B803, 0x40000000 */\n};\nstatic const double dp_l[] = {\n  0.0,\n  1.35003920212974897128e-08, /* 0x3E4CFDEB, 0x43CFD006 */\n};\n\n#define zero  0.0\n#define one   1.0\n#define two   2.0\n#define two53 9007199254740992.0 /* 0x43400000, 0x00000000 */\n#define huge  1.0e300\n#define tiny  1.0e-300\n/* poly coefs for (3/2) * (log(x) - 2s - 2/3 * s**3 */\n#define L1      5.99999999999994648725e-01 /* 0x3FE33333, 0x33333303 */\n#define L2      4.28571428578550184252e-01 /* 0x3FDB6DB6, 0xDB6FABFF */\n#define L3      3.33333329818377432918e-01 /* 0x3FD55555, 0x518F264D */\n#define L4      2.72728123808534006489e-01 /* 0x3FD17460, 0xA91D4101 */\n#define L5      2.30660745775561754067e-01 /* 0x3FCD864A, 0x93C9DB65 */\n#define L6      2.06975017800338417784e-01 /* 0x3FCA7E28, 0x4A454EEF */\n#define P1      1.66666666666666019037e-01 /* 0x3FC55555, 0x5555553E */\n#define P2      -2.77777777770155933842e-03 /* 0xBF66C16C, 0x16BEBD93 */\n#define P3      6.61375632143793436117e-05 /* 0x3F11566A, 0xAF25DE2C */\n#define P4      -1.65339022054652515390e-06 /* 0xBEBBBD41, 0xC5D26BF1 */\n#define P5      4.13813679705723846039e-08 /* 0x3E663769, 0x72BEA4D0 */\n#define lg2     6.93147180559945286227e-01 /* 0x3FE62E42, 0xFEFA39EF */\n#define lg2_h   6.93147182464599609375e-01 /* 0x3FE62E43, 0x00000000 */\n#define lg2_l   -1.90465429995776804525e-09 /* 0xBE205C61, 0x0CA86C39 */\n#define ovt     8.0085662595372944372e-0017 /* -(1024-log2(ovfl+.5ulp)) */\n#define cp      9.61796693925975554329e-01 /* 0x3FEEC709, 0xDC3A03FD = 2 / (3 ln2) */\n#define cp_h    9.61796700954437255859e-01 /* 0x3FEEC709, 0xE0000000 = (float) cp */\n#define cp_l    -7.02846165095275826516e-09 /* 0xBE3E2FE0, 0x145B01F5 = tail of cp_h */\n#define ivln2   1.44269504088896338700e+00 /* 0x3FF71547, 0x652B82FE = 1 / ln2 */\n#define ivln2_h 1.44269502162933349609e+00 /* 0x3FF71547, 0x60000000 = 24b 1 / ln2 */\n#define ivln2_l 1.92596299112661746887e-08 /* 0x3E54AE0B, 0xF85DDF44 = 1 / ln2 tail */\n\ndouble\npow (double x, double y)\n{\n  double_accessor t1, ax, p_h, y1, t, z;\n  double z_h, z_l, p_l;\n  double t2, r, s, u, v, w;\n  int i, j, k, yisint, n;\n  int hx, hy, ix, iy;\n  unsigned lx, ly;\n\n  hx = __HI (x);\n  lx = __LO (x);\n  hy = __HI (y);\n  ly = __LO (y);\n  ix = hx & 0x7fffffff;\n  iy = hy & 0x7fffffff;\n\n  /* x == one: 1**y = 1 */\n  if (((hx - 0x3ff00000) | lx) == 0)\n  {\n    return one;\n  }\n\n  /* y == zero: x**0 = 1 */\n  if ((iy | ly) == 0)\n  {\n    return one;\n  }\n\n  /* +-NaN return x + y */\n  if (ix > 0x7ff00000 || ((ix == 0x7ff00000) && (lx != 0)) || iy > 0x7ff00000 || ((iy == 0x7ff00000) && (ly != 0)))\n  {\n    return x + y;\n  }\n\n  /* determine if y is an odd int when x < 0\n   * yisint = 0 ... y is not an integer\n   * yisint = 1 ... y is an odd int\n   * yisint = 2 ... y is an even int\n   */\n  yisint = 0;\n  if (hx < 0)\n  {\n    if (iy >= 0x43400000) /* even integer y */\n    {\n      yisint = 2;\n    }\n    else if (iy >= 0x3ff00000)\n    {\n      k = (iy >> 20) - 0x3ff; /* exponent */\n      if (k > 20)\n      {\n        j = ly >> (52 - k);\n        if ((j << (52 - k)) == ly)\n        {\n          yisint = 2 - (j & 1);\n        }\n      }\n      else if (ly == 0)\n      {\n        j = iy >> (20 - k);\n        if ((j << (20 - k)) == iy)\n        {\n          yisint = 2 - (j & 1);\n        }\n      }\n    }\n  }\n\n  /* special value of y */\n  if (ly == 0)\n  {\n    if (iy == 0x7ff00000) /* y is +-inf */\n    {\n      if (((ix - 0x3ff00000) | lx) == 0) /* +-1**+-inf is 1 */\n      {\n        return one;\n      }\n      else if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */\n      {\n        return (hy >= 0) ? y : zero;\n      }\n      else /* (|x|<1)**-,+inf = inf,0 */\n      {\n        return (hy < 0) ? -y : zero;\n      }\n    }\n    if (iy == 0x3ff00000) /* y is +-1 */\n    {\n      if (hy < 0)\n      {\n        return one / x;\n      }\n      else\n      {\n        return x;\n      }\n    }\n    if (hy == 0x40000000) /* y is 2 */\n    {\n      return x * x;\n    }\n    if (hy == 0x3fe00000) /* y is 0.5 */\n    {\n      if (hx >= 0) /* x >= +0 */\n      {\n        return sqrt (x);\n      }\n    }\n  }\n\n  ax.dbl = fabs (x);\n  /* special value of x */\n  if (lx == 0)\n  {\n    if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000)\n    {\n      z.dbl = ax.dbl; /* x is +-0,+-inf,+-1 */\n      if (hy < 0)\n      {\n        z.dbl = one / z.dbl; /* z = (1 / |x|) */\n      }\n      if (hx < 0)\n      {\n        if (((ix - 0x3ff00000) | yisint) == 0)\n        {\n          z.dbl = NAN; /* (-1)**non-int is NaN */\n        }\n        else if (yisint == 1)\n        {\n          z.dbl = -z.dbl; /* (x<0)**odd = -(|x|**odd) */\n        }\n      }\n      return z.dbl;\n    }\n  }\n\n  n = (hx < 0) ? 0 : 1;\n\n  /* (x<0)**(non-int) is NaN */\n  if ((n | yisint) == 0)\n  {\n    return NAN;\n  }\n\n  s = one; /* s (sign of result -ve**odd) = -1 else = 1 */\n  if ((n | (yisint - 1)) == 0)\n  {\n    s = -one; /* (-ve)**(odd int) */\n  }\n\n  /* |y| is huge */\n  if (iy > 0x41e00000) /* if |y| > 2**31 */\n  {\n    if (iy > 0x43f00000) /* if |y| > 2**64, must o/uflow */\n    {\n      if (ix <= 0x3fefffff)\n      {\n        return (hy < 0) ? huge * huge : tiny * tiny;\n      }\n      if (ix >= 0x3ff00000)\n      {\n        return (hy > 0) ? huge * huge : tiny * tiny;\n      }\n    }\n    /* over/underflow if x is not close to one */\n    if (ix < 0x3fefffff)\n    {\n      return (hy < 0) ? s * huge * huge : s * tiny * tiny;\n    }\n    if (ix > 0x3ff00000)\n    {\n      return (hy > 0) ? s * huge * huge : s * tiny * tiny;\n    }\n    /* now |1 - x| is tiny <= 2**-20, suffice to compute\n       log(x) by x - x^2 / 2 + x^3 / 3 - x^4 / 4 */\n    t.dbl = ax.dbl - one; /* t has 20 trailing zeros */\n    w = (t.dbl * t.dbl) * (0.5 - t.dbl * (0.3333333333333333333333 - t.dbl * 0.25));\n    u = ivln2_h * t.dbl; /* ivln2_h has 21 sig. bits */\n    v = t.dbl * ivln2_l - w * ivln2;\n    t1.dbl = u + v;\n    t1.as_int.lo = 0;\n    t2 = v - (t1.dbl - u);\n  }\n  else\n  {\n    double_accessor s_h, t_h;\n    double ss, s2, s_l, t_l;\n\n    n = 0;\n    /* take care subnormal number */\n    if (ix < 0x00100000)\n    {\n      ax.dbl *= two53;\n      n -= 53;\n      ix = ax.as_int.hi;\n    }\n    n += ((ix) >> 20) - 0x3ff;\n    j = ix & 0x000fffff;\n    /* determine interval */\n    ix = j | 0x3ff00000; /* normalize ix */\n    if (j <= 0x3988E) /* |x| < sqrt(3/2) */\n    {\n      k = 0;\n    }\n    else if (j < 0xBB67A) /* |x| < sqrt(3) */\n    {\n      k = 1;\n    }\n    else\n    {\n      k = 0;\n      n += 1;\n      ix -= 0x00100000;\n    }\n    ax.as_int.hi = ix;\n\n    /* compute ss = s_h + s_l = (x - 1) / (x + 1) or (x - 1.5) / (x + 1.5) */\n    u = ax.dbl - bp[k]; /* bp[0] = 1.0, bp[1] = 1.5 */\n    v = one / (ax.dbl + bp[k]);\n    ss = u * v;\n    s_h.dbl = ss;\n    s_h.as_int.lo = 0;\n    /* t_h = ax + bp[k] High */\n    t_h.dbl = zero;\n    t_h.as_int.hi = ((ix >> 1) | 0x20000000) + 0x00080000 + (k << 18);\n    t_l = ax.dbl - (t_h.dbl - bp[k]);\n    s_l = v * ((u - s_h.dbl * t_h.dbl) - s_h.dbl * t_l);\n    /* compute log(ax) */\n    s2 = ss * ss;\n    r = s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6)))));\n    r += s_l * (s_h.dbl + ss);\n    s2 = s_h.dbl * s_h.dbl;\n    t_h.dbl = 3.0 + s2 + r;\n    t_h.as_int.lo = 0;\n    t_l = r - ((t_h.dbl - 3.0) - s2);\n    /* u + v = ss * (1 + ...) */\n    u = s_h.dbl * t_h.dbl;\n    v = s_l * t_h.dbl + t_l * ss;\n    /* 2 / (3 * log2) * (ss + ...) */\n    p_h.dbl = u + v;\n    p_h.as_int.lo = 0;\n    p_l = v - (p_h.dbl - u);\n    z_h = cp_h * p_h.dbl; /* cp_h + cp_l = 2 / (3 * log2) */\n    z_l = cp_l * p_h.dbl + p_l * cp + dp_l[k];\n    /* log2(ax) = (ss + ...) * 2 / (3 * log2) = n + dp_h + z_h + z_l */\n    t.dbl = (double) n;\n    t1.dbl = (((z_h + z_l) + dp_h[k]) + t.dbl);\n    t1.as_int.lo = 0;\n    t2 = z_l - (((t1.dbl - t.dbl) - dp_h[k]) - z_h);\n  }\n\n  /* split up y into y1 + y2 and compute (y1 + y2) * (t1 + t2) */\n  y1.dbl = y;\n  y1.as_int.lo = 0;\n  p_l = (y - y1.dbl) * t1.dbl + y * t2;\n  p_h.dbl = y1.dbl * t1.dbl;\n  z.dbl = p_l + p_h.dbl;\n  j = z.as_int.hi;\n  i = z.as_int.lo;\n  if (j >= 0x40900000) /* z >= 1024 */\n  {\n    if (((j - 0x40900000) | i) != 0) /* if z > 1024 */\n    {\n      return s * huge * huge; /* overflow */\n    }\n    else\n    {\n      if (p_l + ovt > z.dbl - p_h.dbl)\n      {\n        return s * huge * huge; /* overflow */\n      }\n    }\n  }\n  else if ((j & 0x7fffffff) >= 0x4090cc00) /* z <= -1075 */\n  {\n    if (((j - 0xc090cc00) | i) != 0) /* z < -1075 */\n    {\n      return s * tiny * tiny; /* underflow */\n    }\n    else\n    {\n      if (p_l <= z.dbl - p_h.dbl)\n      {\n        return s * tiny * tiny; /* underflow */\n      }\n    }\n  }\n  /*\n   * compute 2**(p_h + p_l)\n   */\n  i = j & 0x7fffffff;\n  k = (i >> 20) - 0x3ff;\n  n = 0;\n  if (i > 0x3fe00000) /* if |z| > 0.5, set n = [z + 0.5] */\n  {\n    n = j + (0x00100000 >> (k + 1));\n    k = ((n & 0x7fffffff) >> 20) - 0x3ff; /* new k for n */\n    t.dbl = zero;\n    t.as_int.hi = (n & ~(0x000fffff >> k));\n    n = ((n & 0x000fffff) | 0x00100000) >> (20 - k);\n    if (j < 0)\n    {\n      n = -n;\n    }\n    p_h.dbl -= t.dbl;\n  }\n  t.dbl = p_l + p_h.dbl;\n  t.as_int.lo = 0;\n  u = t.dbl * lg2_h;\n  v = (p_l - (t.dbl - p_h.dbl)) * lg2 + t.dbl * lg2_l;\n  z.dbl = u + v;\n  w = v - (z.dbl - u);\n  t.dbl = z.dbl * z.dbl;\n  t1.dbl = z.dbl - t.dbl * (P1 + t.dbl * (P2 + t.dbl * (P3 + t.dbl * (P4 + t.dbl * P5))));\n  r = (z.dbl * t1.dbl) / (t1.dbl - two) - (w + z.dbl * w);\n  z.dbl = one - (r - z.dbl);\n  j = z.as_int.hi;\n  j += (n << 20);\n  if ((j >> 20) <= 0) /* subnormal output */\n  {\n    z.dbl = scalbn (z.dbl, n);\n  }\n  else\n  {\n    z.as_int.hi += (n << 20);\n  }\n  return s * z.dbl;\n} /* pow */\n\n#undef zero\n#undef one\n#undef two\n#undef two53\n#undef huge\n#undef tiny\n#undef L1\n#undef L2\n#undef L3\n#undef L4\n#undef L5\n#undef L6\n#undef P1\n#undef P2\n#undef P3\n#undef P4\n#undef P5\n#undef lg2\n#undef lg2_h\n#undef lg2_l\n#undef ovt\n#undef cp\n#undef cp_h\n#undef cp_l\n#undef ivln2\n#undef ivln2_h\n#undef ivln2_l\n"
  },
  {
    "path": "jerry-math/scalbn.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_scalbn.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* scalbn(x,n) returns x* 2**n  computed by  exponent\n * manipulation rather than by actually performing an\n * exponentiation or a multiplication.\n */\n\n#define two54  1.80143985094819840000e+16 /* 0x43500000, 0x00000000 */\n#define twom54 5.55111512312578270212e-17 /* 0x3C900000, 0x00000000 */\n#define huge   1.0e+300\n#define tiny   1.0e-300\n\ndouble\nscalbn (double x, int n)\n{\n  int k, hx, lx;\n\n  hx = __HI (x);\n  lx = __LO (x);\n  k = (hx & 0x7ff00000) >> 20; /* extract exponent */\n  if (k == 0) /* 0 or subnormal x */\n  {\n    if ((lx | (hx & 0x7fffffff)) == 0) /* +-0 */\n    {\n      return x;\n    }\n    x *= two54;\n    hx = __HI (x);\n    k = ((hx & 0x7ff00000) >> 20) - 54;\n    if (n < -50000) /*underflow */\n    {\n      return tiny * x;\n    }\n  }\n  if (k == 0x7ff) /* NaN or Inf */\n  {\n    return x + x;\n  }\n  k = k + n;\n  if (k > 0x7fe) /* overflow  */\n  {\n    return huge * copysign (huge, x);\n  }\n  if (k > 0) /* normal result */\n  {\n    double_accessor ret;\n    ret.dbl = x;\n    ret.as_int.hi = (hx & 0x800fffff) | (k << 20);\n    return ret.dbl;\n  }\n  if (k <= -54)\n  {\n    if (n > 50000) /* in case integer overflow in n + k */\n    {\n      return huge * copysign (huge, x); /*overflow */\n    }\n    else\n    {\n      return tiny * copysign (tiny, x); /*underflow */\n    }\n  }\n  k += 54; /* subnormal result */\n  double_accessor ret;\n  ret.dbl = x;\n  ret.as_int.hi = (hx & 0x800fffff) | (k << 20);\n  return ret.dbl * twom54;\n} /* scalbn */\n\n#undef two54\n#undef twom54\n#undef huge\n#undef tiny\n"
  },
  {
    "path": "jerry-math/sinh.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_sinh.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* __sinh(x)\n * Method:\n * mathematically sinh(x) if defined to be (exp(x) - exp(-x)) / 2\n *  1. Replace x by |x| (sinh(-x) = -sinh(x)).\n *  2.\n *                                             E + E/(E+1)\n *      0        <= x <= 22     :  sinh(x) := -------------, E = expm1(x)\n *                                                  2\n *\n *      22       <= x <= lnovft :  sinh(x) := exp(x) / 2\n *      lnovft   <= x <= ln2ovft:  sinh(x) := exp(x / 2) / 2 * exp(x / 2)\n *      ln2ovft  <  x           :  sinh(x) := x * shuge (overflow)\n *\n * Special cases:\n *  sinh(x) is |x| if x is +INF, -INF, or NaN.\n *  only sinh(0) = 0 is exact for finite x.\n */\n\n#define one   1.0\n#define half  0.5\n#define shuge 1.0e307\n\ndouble\nsinh (double x)\n{\n  double t, w, h;\n  int ix, jx;\n  unsigned lx;\n\n  /* High word of |x|. */\n  jx = __HI (x);\n  ix = jx & 0x7fffffff;\n\n  /* x is INF or NaN */\n  if (ix >= 0x7ff00000)\n  {\n    return x + x;\n  }\n\n  h = 0.5;\n  if (jx < 0)\n  {\n    h = -h;\n  }\n  /* |x| in [0,22], return sign(x) * 0.5 * (E + E / (E + 1))) */\n  if (ix < 0x40360000)\n  {\n    /* |x| < 22 */\n    if (ix < 0x3e300000)\n    {\n      /* |x| < 2**-28 */\n      if (shuge + x > one)\n      {\n        /* sinh(tiny) = tiny with inexact */\n        return x;\n      }\n    }\n    t = expm1 (fabs (x));\n    if (ix < 0x3ff00000)\n    {\n      return h * (2.0 * t - t * t / (t + one));\n    }\n    return h * (t + t / (t + one));\n  }\n\n  /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */\n  if (ix < 0x40862E42)\n  {\n    return h * exp (fabs (x));\n  }\n  /* |x| in [log(maxdouble), overflowthresold] */\n  lx = ((1 >> 29) + (unsigned int) x);\n  if (ix < 0x408633CE || ((ix == 0x408633ce) && (lx <= (unsigned) 0x8fb9f87d)))\n  {\n    w = exp (0.5 * fabs (x));\n    t = h * w;\n    return t * w;\n  }\n\n  /* |x| > overflowthresold, sinh(x) overflow */\n  return x * shuge;\n} /* sinh */\n\n#undef one\n#undef half\n#undef huge\n"
  },
  {
    "path": "jerry-math/sqrt.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)e_sqrt.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* sqrt(x)\n * Return correctly rounded sqrt.\n *\n *           ------------------------------------------\n *           |  Use the hardware sqrt if you have one |\n *           ------------------------------------------\n *\n * Method:\n *   Bit by bit method using integer arithmetic. (Slow, but portable)\n *   1. Normalization\n *      Scale x to y in [1,4) with even powers of 2:\n *      find an integer k such that  1 <= (y=x*2^(2k)) < 4, then\n *              sqrt(x) = 2^k * sqrt(y)\n *   2. Bit by bit computation\n *      Let q  = sqrt(y) truncated to i bit after binary point (q = 1),\n *           i                                                   0\n *                                     i+1         2\n *          s  = 2*q , and      y  =  2   * ( y - q  ).         (1)\n *           i      i            i                 i\n *\n *      To compute q    from q , one checks whether\n *                  i+1       i\n *\n *                            -(i+1) 2\n *                      (q + 2      ) <= y.                     (2)\n *                        i\n *                                                            -(i+1)\n *      If (2) is false, then q   = q ; otherwise q   = q  + 2      .\n *                             i+1   i             i+1   i\n *\n *      With some algebric manipulation, it is not difficult to see\n *      that (2) is equivalent to\n *                             -(i+1)\n *                      s  +  2       <= y                      (3)\n *                       i                i\n *\n *      The advantage of (3) is that s  and y  can be computed by\n *                                    i      i\n *      the following recurrence formula:\n *          if (3) is false\n *\n *          s     =  s  ,       y    = y   ;                    (4)\n *           i+1      i          i+1    i\n *\n *          otherwise,\n *                         -i                     -(i+1)\n *          s     =  s  + 2  ,  y    = y  -  s  - 2             (5)\n *           i+1      i          i+1    i     i\n *\n *      One may easily use induction to prove (4) and (5).\n *      Note. Since the left hand side of (3) contain only i+2 bits,\n *            it does not necessary to do a full (53-bit) comparison\n *            in (3).\n *   3. Final rounding\n *      After generating the 53 bits result, we compute one more bit.\n *      Together with the remainder, we can decide whether the\n *      result is exact, bigger than 1/2ulp, or less than 1/2ulp\n *      (it will never equal to 1/2ulp).\n *      The rounding mode can be detected by checking whether\n *      huge + tiny is equal to huge, and whether huge - tiny is\n *      equal to huge for some floating point number \"huge\" and \"tiny\".\n *\n * Special cases:\n *      sqrt(+-0) = +-0         ... exact\n *      sqrt(inf) = inf\n *      sqrt(-ve) = NaN         ... with invalid signal\n *      sqrt(NaN) = NaN         ... with invalid signal for signaling NaN\n *\n * Other methods: see the appended file at the end of the program below.\n */\n\n#define one  1.0\n#define tiny 1.0e-300\n\ndouble\nsqrt (double x)\n{\n  int sign = (int) 0x80000000;\n  unsigned r, t1, s1, ix1, q1;\n  int ix0, s0, q, m, t, i;\n\n  ix0 = __HI (x); /* high word of x */\n  ix1 = __LO (x); /* low word of x */\n\n  /* take care of Inf and NaN */\n  if ((ix0 & 0x7ff00000) == 0x7ff00000)\n  {\n    return x * x + x; /* sqrt(NaN) = NaN, sqrt(+inf) = +inf, sqrt(-inf) = sNaN */\n  }\n  /* take care of zero */\n  if (ix0 <= 0)\n  {\n    if (((ix0 & (~sign)) | ix1) == 0) /* sqrt(+-0) = +-0 */\n    {\n      return x;\n    }\n    else if (ix0 < 0) /* sqrt(-ve) = sNaN */\n    {\n      return NAN;\n    }\n  }\n  /* normalize x */\n  m = (ix0 >> 20);\n  if (m == 0) /* subnormal x */\n  {\n    while (ix0 == 0)\n    {\n      m -= 21;\n      ix0 |= (ix1 >> 11);\n      ix1 <<= 21;\n    }\n    for (i = 0; (ix0 & 0x00100000) == 0; i++)\n    {\n      ix0 <<= 1;\n    }\n    m -= i - 1;\n    ix0 |= (ix1 >> (32 - i));\n    ix1 <<= i;\n  }\n  m -= 1023; /* unbias exponent */\n  ix0 = (ix0 & 0x000fffff) | 0x00100000;\n  if (m & 1) /* odd m, double x to make it even */\n  {\n    ix0 += ix0 + ((ix1 & sign) >> 31);\n    ix1 += ix1;\n  }\n  m >>= 1; /* m = [m / 2] */\n\n  /* generate sqrt(x) bit by bit */\n  ix0 += ix0 + ((ix1 & sign) >> 31);\n  ix1 += ix1;\n  q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */\n  r = 0x00200000; /* r = moving bit from right to left */\n\n  while (r != 0)\n  {\n    t = s0 + r;\n    if (t <= ix0)\n    {\n      s0 = t + r;\n      ix0 -= t;\n      q += r;\n    }\n    ix0 += ix0 + ((ix1 & sign) >> 31);\n    ix1 += ix1;\n    r >>= 1;\n  }\n\n  r = sign;\n  while (r != 0)\n  {\n    t1 = s1 + r;\n    t = s0;\n    if ((t < ix0) || ((t == ix0) && (t1 <= ix1)))\n    {\n      s1 = t1 + r;\n      if (((t1 & sign) == sign) && (s1 & sign) == 0)\n      {\n        s0 += 1;\n      }\n      ix0 -= t;\n      if (ix1 < t1)\n      {\n        ix0 -= 1;\n      }\n      ix1 -= t1;\n      q1 += r;\n    }\n    ix0 += ix0 + ((ix1 & sign) >> 31);\n    ix1 += ix1;\n    r >>= 1;\n  }\n\n  double_accessor ret;\n\n  /* use floating add to find out rounding direction */\n  if ((ix0 | ix1) != 0)\n  {\n    ret.dbl = one - tiny; /* trigger inexact flag */\n    if (ret.dbl >= one)\n    {\n      ret.dbl = one + tiny;\n      if (q1 == (unsigned) 0xffffffff)\n      {\n        q1 = 0;\n        q += 1;\n      }\n      else if (ret.dbl > one)\n      {\n        if (q1 == (unsigned) 0xfffffffe)\n        {\n          q += 1;\n        }\n        q1 += 2;\n      }\n      else\n      {\n        q1 += (q1 & 1);\n      }\n    }\n  }\n  ix0 = (q >> 1) + 0x3fe00000;\n  ix1 = q1 >> 1;\n  if ((q & 1) == 1)\n  {\n    ix1 |= sign;\n  }\n  ix0 += (m << 20);\n  ret.as_int.hi = ix0;\n  ret.as_int.lo = ix1;\n  return ret.dbl;\n} /* sqrt */\n\n#undef one\n#undef tiny\n\n/*\nOther methods  (use floating-point arithmetic)\n-------------\n(This is a copy of a drafted paper by Prof W. Kahan\nand K.C. Ng, written in May, 1986)\n\n        Two algorithms are given here to implement sqrt(x)\n        (IEEE double precision arithmetic) in software.\n        Both supply sqrt(x) correctly rounded. The first algorithm (in\n        Section A) uses newton iterations and involves four divisions.\n        The second one uses reciproot iterations to avoid division, but\n        requires more multiplications. Both algorithms need the ability\n        to chop results of arithmetic operations instead of round them,\n        and the INEXACT flag to indicate when an arithmetic operation\n        is executed exactly with no roundoff error, all part of the\n        standard (IEEE 754-1985). The ability to perform shift, add,\n        subtract and logical AND operations upon 32-bit words is needed\n        too, though not part of the standard.\n\nA.  sqrt(x) by Newton Iteration\n\n   (1)  Initial approximation\n\n        Let x0 and x1 be the leading and the trailing 32-bit words of\n        a floating point number x (in IEEE double format) respectively\n\n            1    11                  52                           ...widths\n           ------------------------------------------------------\n        x: |s|    e     |             f                         |\n           ------------------------------------------------------\n              msb    lsb  msb                                 lsb ...order\n\n             ------------------------        ------------------------\n        x0:  |s|   e    |    f1     |    x1: |          f2           |\n             ------------------------        ------------------------\n\n        By performing shifts and subtracts on x0 and x1 (both regarded\n        as integers), we obtain an 8-bit approximation of sqrt(x) as\n        follows.\n\n                k  := (x0>>1) + 0x1ff80000;\n                y0 := k - T1[31&(k>>15)].       ... y ~ sqrt(x) to 8 bits\n        Here k is a 32-bit integer and T1[] is an integer array containing\n        correction terms. Now magically the floating value of y (y's\n        leading 32-bit word is y0, the value of its trailing word is 0)\n        approximates sqrt(x) to almost 8-bit.\n\n        Value of T1:\n        static int T1[32]= {\n        0,      1024,   3062,   5746,   9193,   13348,  18162,  23592,\n        29598,  36145,  43202,  50740,  58733,  67158,  75992,  85215,\n        83599,  71378,  60428,  50647,  41945,  34246,  27478,  21581,\n        16499,  12183,  8588,   5674,   3403,   1742,   661,    130,};\n\n    (2) Iterative refinement\n\n        Apply Heron's rule three times to y, we have y approximates\n        sqrt(x) to within 1 ulp (Unit in the Last Place):\n\n                y := (y+x/y)/2          ... almost 17 sig. bits\n                y := (y+x/y)/2          ... almost 35 sig. bits\n                y := y-(y-x/y)/2        ... within 1 ulp\n\n        Remark 1.\n            Another way to improve y to within 1 ulp is:\n\n                y := (y+x/y)            ... almost 17 sig. bits to 2*sqrt(x)\n                y := y - 0x00100006     ... almost 18 sig. bits to sqrt(x)\n\n                                2\n                            (x-y )*y\n                y := y + 2* ----------  ...within 1 ulp\n                               2\n                             3y  + x\n\n        This formula has one division fewer than the one above; however,\n        it requires more multiplications and additions. Also x must be\n        scaled in advance to avoid spurious overflow in evaluating the\n        expression 3y*y+x. Hence it is not recommended uless division\n        is slow. If division is very slow, then one should use the\n        reciproot algorithm given in section B.\n\n    (3) Final adjustment\n\n        By twiddling y's last bit it is possible to force y to be\n        correctly rounded according to the prevailing rounding mode\n        as follows. Let r and i be copies of the rounding mode and\n        inexact flag before entering the square root program. Also we\n        use the expression y+-ulp for the next representable floating\n        numbers (up and down) of y. Note that y+-ulp = either fixed\n        point y+-1, or multiply y by nextafter(1,+-inf) in chopped\n        mode.\n\n        I := FALSE;     ... reset INEXACT flag I\n        R := RZ;        ... set rounding mode to round-toward-zero\n                z := x/y;       ... chopped quotient, possibly inexact\n                If(not I) then {        ... if the quotient is exact\n                    if(z=y) {\n                        I := i;  ... restore inexact flag\n                        R := r;  ... restore rounded mode\n                        return sqrt(x):=y.\n                    } else {\n                        z := z - ulp;   ... special rounding\n                    }\n                }\n                i := TRUE;              ... sqrt(x) is inexact\n                If (r=RN) then z=z+ulp  ... rounded-to-nearest\n                If (r=RP) then {        ... round-toward-+inf\n                    y = y+ulp; z=z+ulp;\n                }\n                y := y+z;               ... chopped sum\n                y0:=y0-0x00100000;      ... y := y/2 is correctly rounded.\n                I := i;                 ... restore inexact flag\n                R := r;                 ... restore rounded mode\n                return sqrt(x):=y.\n\n    (4) Special cases\n\n        Square root of +inf, +-0, or NaN is itself;\n        Square root of a negative number is NaN with invalid signal.\n\nB.  sqrt(x) by Reciproot Iteration\n\n   (1)  Initial approximation\n\n        Let x0 and x1 be the leading and the trailing 32-bit words of\n        a floating point number x (in IEEE double format) respectively\n        (see section A). By performing shifs and subtracts on x0 and y0,\n        we obtain a 7.8-bit approximation of 1/sqrt(x) as follows.\n\n            k := 0x5fe80000 - (x0>>1);\n            y0:= k - T2[63&(k>>14)].    ... y ~ 1/sqrt(x) to 7.8 bits\n\n        Here k is a 32-bit integer and T2[] is an integer array\n        containing correction terms. Now magically the floating\n        value of y (y's leading 32-bit word is y0, the value of\n        its trailing word y1 is set to zero) approximates 1/sqrt(x)\n        to almost 7.8-bit.\n\n        Value of T2:\n        static int T2[64]= {\n        0x1500, 0x2ef8, 0x4d67, 0x6b02, 0x87be, 0xa395, 0xbe7a, 0xd866,\n        0xf14a, 0x1091b,0x11fcd,0x13552,0x14999,0x15c98,0x16e34,0x17e5f,\n        0x18d03,0x19a01,0x1a545,0x1ae8a,0x1b5c4,0x1bb01,0x1bfde,0x1c28d,\n        0x1c2de,0x1c0db,0x1ba73,0x1b11c,0x1a4b5,0x1953d,0x18266,0x16be0,\n        0x1683e,0x179d8,0x18a4d,0x19992,0x1a789,0x1b445,0x1bf61,0x1c989,\n        0x1d16d,0x1d77b,0x1dddf,0x1e2ad,0x1e5bf,0x1e6e8,0x1e654,0x1e3cd,\n        0x1df2a,0x1d635,0x1cb16,0x1be2c,0x1ae4e,0x19bde,0x1868e,0x16e2e,\n        0x1527f,0x1334a,0x11051,0xe951, 0xbe01, 0x8e0d, 0x5924, 0x1edd,};\n\n    (2) Iterative refinement\n\n        Apply Reciproot iteration three times to y and multiply the\n        result by x to get an approximation z that matches sqrt(x)\n        to about 1 ulp. To be exact, we will have\n                -1ulp < sqrt(x)-z<1.0625ulp.\n\n        ... set rounding mode to Round-to-nearest\n           y := y*(1.5-0.5*x*y*y)       ... almost 15 sig. bits to 1/sqrt(x)\n           y := y*((1.5-2^-30)+0.5*x*y*y)... about 29 sig. bits to 1/sqrt(x)\n        ... special arrangement for better accuracy\n           z := x*y                     ... 29 bits to sqrt(x), with z*y<1\n           z := z + 0.5*z*(1-z*y)       ... about 1 ulp to sqrt(x)\n\n        Remark 2. The constant 1.5-2^-30 is chosen to bias the error so that\n        (a) the term z*y in the final iteration is always less than 1;\n        (b) the error in the final result is biased upward so that\n                -1 ulp < sqrt(x) - z < 1.0625 ulp\n            instead of |sqrt(x)-z|<1.03125ulp.\n\n    (3) Final adjustment\n\n        By twiddling y's last bit it is possible to force y to be\n        correctly rounded according to the prevailing rounding mode\n        as follows. Let r and i be copies of the rounding mode and\n        inexact flag before entering the square root program. Also we\n        use the expression y+-ulp for the next representable floating\n        numbers (up and down) of y. Note that y+-ulp = either fixed\n        point y+-1, or multiply y by nextafter(1,+-inf) in chopped\n        mode.\n\n        R := RZ;                ... set rounding mode to round-toward-zero\n        switch(r) {\n            case RN:            ... round-to-nearest\n               if(x<= z*(z-ulp)...chopped) z = z - ulp; else\n               if(x<= z*(z+ulp)...chopped) z = z; else z = z+ulp;\n               break;\n            case RZ:case RM:    ... round-to-zero or round-to--inf\n               R:=RP;           ... reset rounding mod to round-to-+inf\n               if(x<z*z ... rounded up) z = z - ulp; else\n               if(x>=(z+ulp)*(z+ulp) ...rounded up) z = z+ulp;\n               break;\n            case RP:            ... round-to-+inf\n               if(x>(z+ulp)*(z+ulp)...chopped) z = z+2*ulp; else\n               if(x>z*z ...chopped) z = z+ulp;\n               break;\n        }\n\n        Remark 3. The above comparisons can be done in fixed point. For\n        example, to compare x and w=z*z chopped, it suffices to compare\n        x1 and w1 (the trailing parts of x and w), regarding them as\n        two's complement integers.\n\n        ...Is z an exact square root?\n        To determine whether z is an exact square root of x, let z1 be the\n        trailing part of z, and also let x0 and x1 be the leading and\n        trailing parts of x.\n\n        If ((z1&0x03ffffff)!=0) ... not exact if trailing 26 bits of z!=0\n            I := 1;             ... Raise Inexact flag: z is not exact\n        else {\n            j := 1 - [(x0>>20)&1]       ... j = logb(x) mod 2\n            k := z1 >> 26;              ... get z's 25-th and 26-th\n                                            fraction bits\n            I := i or (k&j) or ((k&(j+j+1))!=(x1&3));\n        }\n        R:= r           ... restore rounded mode\n        return sqrt(x):=z.\n\n        If multiplication is cheaper then the foregoing red tape, the\n        Inexact flag can be evaluated by\n\n            I := i;\n            I := (z*z!=x) or I.\n\n        Note that z*z can overwrite I; this value must be sensed if it is\n        True.\n\n        Remark 4. If z*z = x exactly, then bit 25 to bit 0 of z1 must be\n        zero.\n\n                    --------------------\n                z1: |        f2        |\n                    --------------------\n                bit 31             bit 0\n\n        Further more, bit 27 and 26 of z1, bit 0 and 1 of x1, and the odd\n        or even of logb(x) have the following relations:\n\n        -------------------------------------------------\n        bit 27,26 of z1         bit 1,0 of x1   logb(x)\n        -------------------------------------------------\n        00                      00              odd and even\n        01                      01              even\n        10                      10              odd\n        10                      00              even\n        11                      01              even\n        -------------------------------------------------\n\n    (4) Special cases (see (4) of Section A).\n */\n"
  },
  {
    "path": "jerry-math/tanh.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)s_tanh.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n/* tanh(x)\n * Return the Hyperbolic Tangent of x\n *\n * Method:\n *                                 x   -x\n *                                e -  e\n *  0. tanh(x) is defined to be -----------\n *                                 x    -x\n *                                e  +  e\n *\n *  1. reduce x to non-negative by tanh(-x) = -tanh(x).\n *  2.  0      <= x <= 2**-55 : tanh(x) := x * (one + x)\n *\n *                                          -t\n *      2**-55 <  x <=  1     : tanh(x) := -----; t = expm1(-2x)\n *                                         t + 2\n *\n *                                               2\n *      1      <= x <=  22.0  : tanh(x) := 1-  ----- ; t = expm1(2x)\n *                                             t + 2\n *\n *      22.0   <  x <= INF    : tanh(x) := 1.\n *\n * Special cases:\n *  tanh(NaN) is NaN;\n *  only tanh(0) = 0 is exact for finite x.\n */\n#define one  1.0\n#define two  2.0\n#define tiny 1.0e-300\n\ndouble\ntanh (double x)\n{\n  double t, z;\n  int jx, ix;\n\n  /* High word of |x|. */\n  jx = __HI (x);\n  ix = jx & 0x7fffffff;\n\n  /* x is INF or NaN */\n  if (ix >= 0x7ff00000)\n  {\n    if (jx >= 0)\n    {\n      /* tanh(+-inf) = +-1 */\n      return one / x + one;\n    }\n    else\n    {\n      /* tanh(NaN) = NaN */\n      return one / x - one;\n    }\n  }\n\n  /* |x| < 22 */\n  if (ix < 0x40360000)\n  {\n    /* |x| < 2**-55 */\n    if (ix < 0x3c800000)\n    {\n      /* tanh(small) = small */\n      return x * (one + x);\n    }\n    if (ix >= 0x3ff00000)\n    {\n      /* |x| >= 1  */\n      t = expm1 (two * fabs (x));\n      z = one - two / (t + two);\n    }\n    else\n    {\n      t = expm1 (-two * fabs (x));\n      z = -t / (t + two);\n    }\n  }\n  else\n  {\n    /* |x| > 22, return +-1 */\n    z = one - tiny; /* raised inexact flag */\n  }\n  return (jx >= 0) ? z : -z;\n} /* tanh */\n\n#undef one\n#undef two\n#undef tiny\n"
  },
  {
    "path": "jerry-math/trig.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * This file is based on work under the following copyright and permission\n * notice:\n *\n *     Copyright (C) 1993, 2004 by Sun Microsystems, Inc. All rights reserved.\n *\n *     Developed at SunSoft, a Sun Microsystems, Inc. business.\n *     Permission to use, copy, modify, and distribute this\n *     software is freely granted, provided that this notice\n *     is preserved.\n *\n *     @(#)k_rem_pio2.c 1.3 95/01/18\n *     @(#)e_rem_pio2.c 1.4 95/01/18\n *     @(#)k_sin.c 1.3 95/01/18\n *     @(#)k_cos.c 1.3 95/01/18\n *     @(#)k_tan.c 1.5 04/04/22\n *     @(#)s_sin.c 1.3 95/01/18\n *     @(#)s_cos.c 1.3 95/01/18\n *     @(#)s_tan.c 1.3 95/01/18\n */\n\n#include \"jerry-math-internal.h\"\n\n#define zero   0.00000000000000000000e+00 /* 0x00000000, 0x00000000 */\n#define half   5.00000000000000000000e-01 /* 0x3FE00000, 0x00000000 */\n#define one    1.00000000000000000000e+00 /* 0x3FF00000, 0x00000000 */\n#define two24  1.67772160000000000000e+07 /* 0x41700000, 0x00000000 */\n#define twon24 5.96046447753906250000e-08 /* 0x3E700000, 0x00000000 */\n\n/* __kernel_rem_pio2(x,y,e0,nx,prec)\n * double x[],y[]; int e0,nx,prec;\n *\n * __kernel_rem_pio2 return the last three digits of N with\n *              y = x - N*pi/2\n * so that |y| < pi/2.\n *\n * The method is to compute the integer (mod 8) and fraction parts of\n * (2/pi)*x without doing the full multiplication. In general we\n * skip the part of the product that are known to be a huge integer (\n * more accurately, = 0 mod 8 ). Thus the number of operations are\n * independent of the exponent of the input.\n *\n * (2/pi) is represented by an array of 24-bit integers in ipio2[].\n *\n * Input parameters:\n *      x[]     The input value (must be positive) is broken into nx\n *              pieces of 24-bit integers in double precision format.\n *              x[i] will be the i-th 24 bit of x. The scaled exponent\n *              of x[0] is given in input parameter e0 (i.e., x[0]*2^e0\n *              match x's up to 24 bits.\n *\n *              Example of breaking a double positive z into x[0]+x[1]+x[2]:\n *                      e0 = ilogb(z)-23\n *                      z  = scalbn(z,-e0)\n *              for i = 0,1,2\n *                      x[i] = floor(z)\n *                      z    = (z-x[i])*2**24\n *\n *      y[]     ouput result in an array of double precision numbers.\n *              The dimension of y[] is:\n *                      24-bit  precision       1\n *                      53-bit  precision       2\n *                      64-bit  precision       2\n *                      113-bit precision       3\n *              The actual value is the sum of them. Thus for 113-bit\n *              precison, one may have to do something like:\n *\n *              long double t,w,r_head, r_tail;\n *              t = (long double)y[2] + (long double)y[1];\n *              w = (long double)y[0];\n *              r_head = t+w;\n *              r_tail = w - (r_head - t);\n *\n *      e0      The exponent of x[0]\n *\n *      nx      dimension of x[]\n *\n *      prec    an integer indicating the precision:\n *                      0       24  bits (single)\n *                      1       53  bits (double)\n *                      2       64  bits (extended)\n *                      3       113 bits (quad)\n *\n * External function:\n *      double scalbn(), floor();\n *\n * Here is the description of some local variables:\n *\n *      ipio2[] integer array, contains the (24*i)-th to (24*i+23)-th\n *              bit of 2/pi after binary point. The corresponding\n *              floating value is\n *\n *                      ipio2[i] * 2^(-24(i+1)).\n *\n *      jk      jk+1 is the initial number of terms of ipio2[] needed\n *              in the computation. The recommended value is 2,3,4,\n *              6 for single, double, extended,and quad.\n *\n *      jz      local integer variable indicating the number of\n *              terms of ipio2[] used.\n *\n *      jx      nx - 1\n *\n *      jv      index for pointing to the suitable ipio2[] for the\n *              computation. In general, we want\n *                      ( 2^e0*x[0] * ipio2[jv-1]*2^(-24jv) )/8\n *              is an integer. Thus\n *                      e0-3-24*jv >= 0 or (e0-3)/24 >= jv\n *              Hence jv = max(0,(e0-3)/24).\n *\n *      jp      jp+1 is the number of terms in PIo2[] needed, jp = jk.\n *\n *      q[]     double array with integral value, representing the\n *              24-bits chunk of the product of x and 2/pi.\n *\n *      q0      the corresponding exponent of q[0]. Note that the\n *              exponent for q[i] would be q0-24*i.\n *\n *      PIo2[]  double precision array, obtained by cutting pi/2\n *              into 24 bits chunks.\n *\n *      f[]     ipio2[] in floating point\n *\n *      iq[]    integer array by breaking up q[] in 24-bits chunk.\n *\n *      fq[]    final product of x*(2/pi) in fq[0],..,fq[jk]\n *\n *      ih      integer. If >0 it indicates q[] is >= 0.5, hence\n *              it also indicates the *sign* of the result.\n */\n\n/*\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n */\n\n/* initial value for jk */\nstatic const int init_jk[] = { 2, 3, 4, 6 };\n\nstatic const double PIo2[] = {\n  1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */\n  7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */\n  5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */\n  3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */\n  1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */\n  1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */\n  2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */\n  2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */\n};\n\n/*\n * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi\n */\nstatic const int ipio2[] = {\n  0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, 0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7,\n  0x246E3A, 0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, 0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C,\n  0x7026B4, 0x5F7E41, 0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, 0x97FFDE, 0x05980F, 0xEF2F11,\n  0x8B5A0A, 0x6D1F6D, 0x367ECF, 0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, 0xF17B3D, 0x0739F7,\n  0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, 0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, 0x91615E,\n  0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, 0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B,\n};\n\nstatic int\n__kernel_rem_pio2 (double *x, double *y, int e0, int nx, int prec)\n{\n  int jz, jx, jv, jp, jk, carry, n, iq[20], i, j, k, m, q0, ih;\n  double z, fw, f[20], fq[20], q[20];\n\n  /* initialize jk */\n  jk = init_jk[prec];\n  jp = jk;\n\n  /* determine jx, jv, q0, note that 3 > q0 */\n  jx = nx - 1;\n  jv = (e0 - 3) / 24;\n  if (jv < 0)\n  {\n    jv = 0;\n  }\n  q0 = e0 - 24 * (jv + 1);\n\n  /* set up f[0] to f[jx + jk] where f[jx + jk] = ipio2[jv + jk] */\n  j = jv - jx;\n  m = jx + jk;\n  for (i = 0; i <= m; i++, j++)\n  {\n    f[i] = (j < 0) ? zero : (double) ipio2[j];\n  }\n\n  /* compute q[0], q[1], ... q[jk] */\n  for (i = 0; i <= jk; i++)\n  {\n    for (j = 0, fw = 0.0; j <= jx; j++)\n    {\n      fw += x[j] * f[jx + i - j];\n    }\n    q[i] = fw;\n  }\n\n  jz = jk;\nrecompute:\n  /* distill q[] into iq[] reversingly */\n  for (i = 0, j = jz, z = q[jz]; j > 0; i++, j--)\n  {\n    fw = (double) ((int) (twon24 * z));\n    iq[i] = (int) (z - two24 * fw);\n    z = q[j - 1] + fw;\n  }\n\n  /* compute n */\n  z = scalbn (z, q0); /* actual value of z */\n  z -= 8.0 * floor (z * 0.125); /* trim off integer >= 8 */\n  n = (int) z;\n  z -= (double) n;\n  ih = 0;\n  if (q0 > 0) /* need iq[jz - 1] to determine n */\n  {\n    i = (iq[jz - 1] >> (24 - q0));\n    n += i;\n    iq[jz - 1] -= i << (24 - q0);\n    ih = iq[jz - 1] >> (23 - q0);\n  }\n  else if (q0 == 0)\n  {\n    ih = iq[jz - 1] >> 23;\n  }\n  else if (z >= 0.5)\n  {\n    ih = 2;\n  }\n\n  if (ih > 0) /* q > 0.5 */\n  {\n    n += 1;\n    carry = 0;\n    for (i = 0; i < jz; i++) /* compute 1 - q */\n    {\n      j = iq[i];\n      if (carry == 0)\n      {\n        if (j != 0)\n        {\n          carry = 1;\n          iq[i] = 0x1000000 - j;\n        }\n      }\n      else\n      {\n        iq[i] = 0xffffff - j;\n      }\n    }\n    if (q0 > 0) /* rare case: chance is 1 in 12 */\n    {\n      switch (q0)\n      {\n        case 1:\n        {\n          iq[jz - 1] &= 0x7fffff;\n          break;\n        }\n        case 2:\n        {\n          iq[jz - 1] &= 0x3fffff;\n          break;\n        }\n      }\n    }\n    if (ih == 2)\n    {\n      z = one - z;\n      if (carry != 0)\n      {\n        z -= scalbn (one, q0);\n      }\n    }\n  }\n\n  /* check if recomputation is needed */\n  if (z == zero)\n  {\n    j = 0;\n    for (i = jz - 1; i >= jk; i--)\n    {\n      j |= iq[i];\n    }\n    if (j == 0) /* need recomputation */\n    {\n      for (k = 1; iq[jk - k] == 0; k++) /* k = no. of terms needed */\n      {\n      }\n\n      for (i = jz + 1; i <= jz + k; i++) /* add q[jz + 1] to q[jz + k] */\n      {\n        f[jx + i] = (double) ipio2[jv + i];\n        for (j = 0, fw = 0.0; j <= jx; j++)\n        {\n          fw += x[j] * f[jx + i - j];\n        }\n        q[i] = fw;\n      }\n      jz += k;\n      goto recompute;\n    }\n  }\n\n  /* chop off zero terms */\n  if (z == 0.0)\n  {\n    jz -= 1;\n    q0 -= 24;\n    while (iq[jz] == 0)\n    {\n      jz--;\n      q0 -= 24;\n    }\n  }\n  else\n  { /* break z into 24-bit if necessary */\n    z = scalbn (z, -q0);\n    if (z >= two24)\n    {\n      fw = (double) ((int) (twon24 * z));\n      iq[jz] = (int) (z - two24 * fw);\n      jz += 1;\n      q0 += 24;\n      iq[jz] = (int) fw;\n    }\n    else\n    {\n      iq[jz] = (int) z;\n    }\n  }\n\n  /* convert integer \"bit\" chunk to floating-point value */\n  fw = scalbn (one, q0);\n  for (i = jz; i >= 0; i--)\n  {\n    q[i] = fw * (double) iq[i];\n    fw *= twon24;\n  }\n\n  /* compute PIo2[0, ..., jp] * q[jz, ..., 0] */\n  for (i = jz; i >= 0; i--)\n  {\n    for (fw = 0.0, k = 0; k <= jp && k <= jz - i; k++)\n    {\n      fw += PIo2[k] * q[i + k];\n    }\n    fq[jz - i] = fw;\n  }\n\n  /* compress fq[] into y[] */\n  switch (prec)\n  {\n    case 0:\n    {\n      fw = 0.0;\n      for (i = jz; i >= 0; i--)\n      {\n        fw += fq[i];\n      }\n      y[0] = (ih == 0) ? fw : -fw;\n      break;\n    }\n    case 1:\n    case 2:\n    {\n      fw = 0.0;\n      for (i = jz; i >= 0; i--)\n      {\n        fw += fq[i];\n      }\n      y[0] = (ih == 0) ? fw : -fw;\n      fw = fq[0] - fw;\n      for (i = 1; i <= jz; i++)\n      {\n        fw += fq[i];\n      }\n      y[1] = (ih == 0) ? fw : -fw;\n      break;\n    }\n    case 3: /* painful */\n    {\n      for (i = jz; i > 0; i--)\n      {\n        fw = fq[i - 1] + fq[i];\n        fq[i] += fq[i - 1] - fw;\n        fq[i - 1] = fw;\n      }\n      for (i = jz; i > 1; i--)\n      {\n        fw = fq[i - 1] + fq[i];\n        fq[i] += fq[i - 1] - fw;\n        fq[i - 1] = fw;\n      }\n      for (fw = 0.0, i = jz; i >= 2; i--)\n      {\n        fw += fq[i];\n      }\n      if (ih == 0)\n      {\n        y[0] = fq[0];\n        y[1] = fq[1];\n        y[2] = fw;\n      }\n      else\n      {\n        y[0] = -fq[0];\n        y[1] = -fq[1];\n        y[2] = -fw;\n      }\n    }\n  }\n  return n & 7;\n} /* __kernel_rem_pio2 */\n\n/* __ieee754_rem_pio2(x,y)\n * return the remainder of x rem pi/2 in y[0]+y[1]\n * use __kernel_rem_pio2()\n */\n\nstatic const int npio2_hw[] = {\n  0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, 0x4025FDBB, 0x402921FB,\n  0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, 0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB,\n  0x403AB41B, 0x403C463A, 0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C,\n  0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, 0x404858EB, 0x404921FB,\n};\n\n/*\n * invpio2:  53 bits of 2/pi\n * pio2_1:   first  33 bit of pi/2\n * pio2_1t:  pi/2 - pio2_1\n * pio2_2:   second 33 bit of pi/2\n * pio2_2t:  pi/2 - (pio2_1 + pio2_2)\n * pio2_3:   third  33 bit of pi/2\n * pio2_3t:  pi/2 - (pio2_1 + pio2_2 + pio2_3)\n */\n#define invpio2 6.36619772367581382433e-01 /* 0x3FE45F30, 0x6DC9C883 */\n#define pio2_1  1.57079632673412561417e+00 /* 0x3FF921FB, 0x54400000 */\n#define pio2_1t 6.07710050650619224932e-11 /* 0x3DD0B461, 0x1A626331 */\n#define pio2_2  6.07710050630396597660e-11 /* 0x3DD0B461, 0x1A600000 */\n#define pio2_2t 2.02226624879595063154e-21 /* 0x3BA3198A, 0x2E037073 */\n#define pio2_3  2.02226624871116645580e-21 /* 0x3BA3198A, 0x2E000000 */\n#define pio2_3t 8.47842766036889956997e-32 /* 0x397B839A, 0x252049C1 */\n\nstatic int\n__ieee754_rem_pio2 (double x, double *y)\n{\n  double_accessor z;\n  double w, t, r, fn;\n  double tx[3];\n  int e0, i, j, nx, n, ix, hx;\n\n  hx = __HI (x); /* high word of x */\n  ix = hx & 0x7fffffff;\n  if (ix <= 0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */\n  {\n    y[0] = x;\n    y[1] = 0;\n    return 0;\n  }\n  if (ix < 0x4002d97c) /* |x| < 3pi/4, special case with n = +-1 */\n  {\n    if (hx > 0)\n    {\n      z.dbl = x - pio2_1;\n      if (ix != 0x3ff921fb) /* 33 + 53 bit pi is good enough */\n      {\n        y[0] = z.dbl - pio2_1t;\n        y[1] = (z.dbl - y[0]) - pio2_1t;\n      }\n      else /* near pi/2, use 33 + 33 + 53 bit pi */\n      {\n        z.dbl -= pio2_2;\n        y[0] = z.dbl - pio2_2t;\n        y[1] = (z.dbl - y[0]) - pio2_2t;\n      }\n      return 1;\n    }\n    else /* negative x */\n    {\n      z.dbl = x + pio2_1;\n      if (ix != 0x3ff921fb) /* 33 + 53 bit pi is good enough */\n      {\n        y[0] = z.dbl + pio2_1t;\n        y[1] = (z.dbl - y[0]) + pio2_1t;\n      }\n      else /* near pi/2, use 33 + 33 + 53 bit pi */\n      {\n        z.dbl += pio2_2;\n        y[0] = z.dbl + pio2_2t;\n        y[1] = (z.dbl - y[0]) + pio2_2t;\n      }\n      return -1;\n    }\n  }\n  if (ix <= 0x413921fb) /* |x| ~<= 2^19 * (pi/2), medium size */\n  {\n    t = fabs (x);\n    n = (int) (t * invpio2 + half);\n    fn = (double) n;\n    r = t - fn * pio2_1;\n    w = fn * pio2_1t; /* 1st round good to 85 bit */\n    if (n < 32 && ix != npio2_hw[n - 1])\n    {\n      y[0] = r - w; /* quick check no cancellation */\n    }\n    else\n    {\n      j = ix >> 20;\n      y[0] = r - w;\n      i = j - (((__HI (y[0])) >> 20) & 0x7ff);\n      if (i > 16) /* 2nd iteration needed, good to 118 */\n      {\n        t = r;\n        w = fn * pio2_2;\n        r = t - w;\n        w = fn * pio2_2t - ((t - r) - w);\n        y[0] = r - w;\n        i = j - (((__HI (y[0])) >> 20) & 0x7ff);\n        if (i > 49) /* 3rd iteration need, 151 bits acc, will cover all possible cases */\n        {\n          t = r;\n          w = fn * pio2_3;\n          r = t - w;\n          w = fn * pio2_3t - ((t - r) - w);\n          y[0] = r - w;\n        }\n      }\n    }\n    y[1] = (r - y[0]) - w;\n    if (hx < 0)\n    {\n      y[0] = -y[0];\n      y[1] = -y[1];\n      return -n;\n    }\n    else\n    {\n      return n;\n    }\n  }\n  /*\n   * all other (large) arguments\n   */\n  if (ix >= 0x7ff00000) /* x is inf or NaN */\n  {\n    y[0] = y[1] = x - x;\n    return 0;\n  }\n  /* set z = scalbn(|x|, ilogb(x) - 23) */\n  z.as_int.lo = __LO (x);\n  e0 = (ix >> 20) - 1046; /* e0 = ilogb(z) - 23; */\n  z.as_int.hi = ix - (e0 << 20);\n  for (i = 0; i < 2; i++)\n  {\n    tx[i] = (double) ((int) (z.dbl));\n    z.dbl = (z.dbl - tx[i]) * two24;\n  }\n  tx[2] = z.dbl;\n  nx = 3;\n  while (tx[nx - 1] == zero) /* skip zero term */\n  {\n    nx--;\n  }\n  n = __kernel_rem_pio2 (tx, y, e0, nx, 2);\n  if (hx < 0)\n  {\n    y[0] = -y[0];\n    y[1] = -y[1];\n    return -n;\n  }\n  return n;\n} /* __ieee754_rem_pio2 */\n\n/* __kernel_sin( x, y, iy)\n * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854\n * Input x is assumed to be bounded by ~pi/4 in magnitude.\n * Input y is the tail of x.\n * Input iy indicates whether y is 0. (if iy=0, y assume to be 0).\n *\n * Algorithm\n *      1. Since sin(-x) = -sin(x), we need only to consider positive x.\n *      2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0.\n *      3. sin(x) is approximated by a polynomial of degree 13 on\n *         [0,pi/4]\n *                               3            13\n *              sin(x) ~ x + S1*x + ... + S6*x\n *         where\n *\n *      |sin(x)         2     4     6     8     10     12  |     -58\n *      |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x  +S6*x   )| <= 2\n *      |  x                                               |\n *\n *      4. sin(x+y) = sin(x) + sin'(x')*y\n *                  ~ sin(x) + (1-x*x/2)*y\n *         For better accuracy, let\n *                   3      2      2      2      2\n *              r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6))))\n *         then                   3    2\n *              sin(x) = x + (S1*x + (x *(r-y/2)+y))\n */\n\n#define S1 -1.66666666666666324348e-01 /* 0xBFC55555, 0x55555549 */\n#define S2 8.33333333332248946124e-03 /* 0x3F811111, 0x1110F8A6 */\n#define S3 -1.98412698298579493134e-04 /* 0xBF2A01A0, 0x19C161D5 */\n#define S4 2.75573137070700676789e-06 /* 0x3EC71DE3, 0x57B1FE7D */\n#define S5 -2.50507602534068634195e-08 /* 0xBE5AE5E6, 0x8A2B9CEB */\n#define S6 1.58969099521155010221e-10 /* 0x3DE5D93A, 0x5ACFD57C */\n\nstatic double\n__kernel_sin (double x, double y, int iy)\n{\n  double z, r, v;\n  int ix;\n\n  ix = __HI (x) & 0x7fffffff; /* high word of x */\n  if (ix < 0x3e400000) /* |x| < 2**-27 */\n  {\n    if ((int) x == 0)\n    {\n      return x; /* generate inexact */\n    }\n  }\n  z = x * x;\n  v = z * x;\n  r = S2 + z * (S3 + z * (S4 + z * (S5 + z * S6)));\n  if (iy == 0)\n  {\n    return x + v * (S1 + z * r);\n  }\n  else\n  {\n    return x - ((z * (half * y - v * r) - y) - v * S1);\n  }\n} /* __kernel_sin */\n\n/*\n * __kernel_cos( x,  y )\n * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164\n * Input x is assumed to be bounded by ~pi/4 in magnitude.\n * Input y is the tail of x.\n *\n * Algorithm\n *      1. Since cos(-x) = cos(x), we need only to consider positive x.\n *      2. if x < 2^-27 (hx<0x3e400000 0), return 1 with inexact if x!=0.\n *      3. cos(x) is approximated by a polynomial of degree 14 on\n *         [0,pi/4]\n *                                       4            14\n *              cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x\n *         where the remez error is\n *\n *      |              2     4     6     8     10    12     14 |     -58\n *      |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x  +C6*x  )| <= 2\n *      |                                                      |\n *\n *                     4     6     8     10    12     14\n *      4. let r = C1*x +C2*x +C3*x +C4*x +C5*x  +C6*x  , then\n *             cos(x) = 1 - x*x/2 + r\n *         since cos(x+y) ~ cos(x) - sin(x)*y\n *                        ~ cos(x) - x*y,\n *         a correction term is necessary in cos(x) and hence\n *              cos(x+y) = 1 - (x*x/2 - (r - x*y))\n *         For better accuracy when x > 0.3, let qx = |x|/4 with\n *         the last 32 bits mask off, and if x > 0.78125, let qx = 0.28125.\n *         Then\n *              cos(x+y) = (1-qx) - ((x*x/2-qx) - (r-x*y)).\n *         Note that 1-qx and (x*x/2-qx) is EXACT here, and the\n *         magnitude of the latter is at least a quarter of x*x/2,\n *         thus, reducing the rounding error in the subtraction.\n */\n\n#define C1 4.16666666666666019037e-02 /* 0x3FA55555, 0x5555554C */\n#define C2 -1.38888888888741095749e-03 /* 0xBF56C16C, 0x16C15177 */\n#define C3 2.48015872894767294178e-05 /* 0x3EFA01A0, 0x19CB1590 */\n#define C4 -2.75573143513906633035e-07 /* 0xBE927E4F, 0x809C52AD */\n#define C5 2.08757232129817482790e-09 /* 0x3E21EE9E, 0xBDB4B1C4 */\n#define C6 -1.13596475577881948265e-11 /* 0xBDA8FAE9, 0xBE8838D4 */\n\nstatic double\n__kernel_cos (double x, double y)\n{\n  double a, hz, z, r;\n  int ix;\n\n  ix = __HI (x) & 0x7fffffff; /* ix = |x|'s high word */\n  if (ix < 0x3e400000) /* if x < 2**27 */\n  {\n    if (((int) x) == 0)\n    {\n      return one; /* generate inexact */\n    }\n  }\n  z = x * x;\n  r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6)))));\n  if (ix < 0x3FD33333) /* if |x| < 0.3 */\n  {\n    return one - (0.5 * z - (z * r - x * y));\n  }\n  else\n  {\n    double_accessor qx;\n    if (ix > 0x3fe90000) /* x > 0.78125 */\n    {\n      qx.dbl = 0.28125;\n    }\n    else\n    {\n      qx.as_int.hi = ix - 0x00200000; /* x / 4 */\n      qx.as_int.lo = 0;\n    }\n    hz = 0.5 * z - qx.dbl;\n    a = one - qx.dbl;\n    return a - (hz - (z * r - x * y));\n  }\n} /* __kernel_cos */\n\n/* __kernel_tan( x, y, k )\n * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854\n * Input x is assumed to be bounded by ~pi/4 in magnitude.\n * Input y is the tail of x.\n * Input k indicates whether tan (if k = 1) or -1/tan (if k = -1) is returned.\n *\n * Algorithm\n *      1. Since tan(-x) = -tan(x), we need only to consider positive x.\n *      2. if x < 2^-28 (hx<0x3e300000 0), return x with inexact if x!=0.\n *      3. tan(x) is approximated by a odd polynomial of degree 27 on\n *         [0,0.67434]\n *                               3             27\n *              tan(x) ~ x + T1*x + ... + T13*x\n *         where\n *\n *              |tan(x)         2     4            26   |     -59.2\n *              |----- - (1+T1*x +T2*x +.... +T13*x    )| <= 2\n *              |  x                                    |\n *\n *         Note: tan(x+y) = tan(x) + tan'(x)*y\n *                        ~ tan(x) + (1+x*x)*y\n *         Therefore, for better accuracy in computing tan(x+y), let\n *                   3      2      2       2       2\n *              r = x *(T2+x *(T3+x *(...+x *(T12+x *T13))))\n *         then\n *                                  3    2\n *              tan(x+y) = x + (T1*x + (x *(r+y)+y))\n *\n *      4. For x in [0.67434,pi/4],  let y = pi/4 - x, then\n *              tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y))\n *                     = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))\n */\n\n#define T0     3.33333333333334091986e-01 /* 3FD55555, 55555563 */\n#define T1     1.33333333333201242699e-01 /* 3FC11111, 1110FE7A */\n#define T2     5.39682539762260521377e-02 /* 3FABA1BA, 1BB341FE */\n#define T3     2.18694882948595424599e-02 /* 3F9664F4, 8406D637 */\n#define T4     8.86323982359930005737e-03 /* 3F8226E3, E96E8493 */\n#define T5     3.59207910759131235356e-03 /* 3F6D6D22, C9560328 */\n#define T6     1.45620945432529025516e-03 /* 3F57DBC8, FEE08315 */\n#define T7     5.88041240820264096874e-04 /* 3F4344D8, F2F26501 */\n#define T8     2.46463134818469906812e-04 /* 3F3026F7, 1A8D1068 */\n#define T9     7.81794442939557092300e-05 /* 3F147E88, A03792A6 */\n#define T10    7.14072491382608190305e-05 /* 3F12B80F, 32F0A7E9 */\n#define T11    -1.85586374855275456654e-05 /* BEF375CB, DB605373 */\n#define T12    2.59073051863633712884e-05 /* 3EFB2A70, 74BF7AD4 */\n#define pio4   7.85398163397448278999e-01 /* 3FE921FB, 54442D18 */\n#define pio4lo 3.06161699786838301793e-17 /* 3C81A626, 33145C07 */\n\nstatic double\n__kernel_tan (double x, double y, int iy)\n{\n  double_accessor z;\n  double r, v, w, s;\n  int ix, hx;\n\n  hx = __HI (x); /* high word of x */\n  ix = hx & 0x7fffffff; /* high word of |x| */\n  if (ix < 0x3e300000) /* x < 2**-28 */\n  {\n    if ((int) x == 0) /* generate inexact */\n    {\n      if (((ix | __LO (x)) | (iy + 1)) == 0)\n      {\n        return one / fabs (x);\n      }\n      else\n      {\n        if (iy == 1)\n        {\n          return x;\n        }\n        else /* compute -1 / (x + y) carefully */\n        {\n          double a;\n          double_accessor t;\n\n          z.dbl = w = x + y;\n          z.as_int.lo = 0;\n          v = y - (z.dbl - x);\n          t.dbl = a = -one / w;\n          t.as_int.lo = 0;\n          s = one + t.dbl * z.dbl;\n          return t.dbl + a * (s + t.dbl * v);\n        }\n      }\n    }\n  }\n  if (ix >= 0x3FE59428) /* |x| >= 0.6744 */\n  {\n    if (hx < 0)\n    {\n      x = -x;\n      y = -y;\n    }\n    z.dbl = pio4 - x;\n    w = pio4lo - y;\n    x = z.dbl + w;\n    y = 0.0;\n  }\n  z.dbl = x * x;\n  w = z.dbl * z.dbl;\n  /*\n   * Break x^5 * (T[1] + x^2 * T[2] + ...) into\n   * x^5 (T[1] + x^4 * T[3] + ... + x^20 * T[11]) +\n   * x^5 (x^2 * (T[2] + x^4 * T[4] + ... + x^22 * [T12]))\n   */\n  r = T1 + w * (T3 + w * (T5 + w * (T7 + w * (T9 + w * T11))));\n  v = z.dbl * (T2 + w * (T4 + w * (T6 + w * (T8 + w * (T10 + w * T12)))));\n  s = z.dbl * x;\n  r = y + z.dbl * (s * (r + v) + y);\n  r += T0 * s;\n  w = x + r;\n  if (ix >= 0x3FE59428)\n  {\n    v = (double) iy;\n    return (double) (1 - ((hx >> 30) & 2)) * (v - 2.0 * (x - (w * w / (w + v) - r)));\n  }\n  if (iy == 1)\n  {\n    return w;\n  }\n  else\n  {\n    /*\n     * if allow error up to 2 ulp, simply return\n     * -1.0 / (x + r) here\n     */\n    /* compute -1.0 / (x + r) accurately */\n    double a;\n    double_accessor t;\n\n    z.dbl = w;\n    z.as_int.lo = 0;\n    v = r - (z.dbl - x); /* z + v = r + x */\n    t.dbl = a = -1.0 / w; /* a = -1.0 / w */\n    t.as_int.lo = 0;\n    s = 1.0 + t.dbl * z.dbl;\n    return t.dbl + a * (s + t.dbl * v);\n  }\n} /* __kernel_tan */\n\n/* Method:\n *      Let S,C and T denote the sin, cos and tan respectively on\n *      [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2\n *      in [-pi/4 , +pi/4], and let n = k mod 4.\n *      We have\n *\n *          n        sin(x)      cos(x)        tan(x)\n *     ----------------------------------------------------------\n *          0          S           C             T\n *          1          C          -S            -1/T\n *          2         -S          -C             T\n *          3         -C           S            -1/T\n *     ----------------------------------------------------------\n *\n * Special cases:\n *      Let trig be any of sin, cos, or tan.\n *      trig(+-INF)  is NaN, with signals;\n *      trig(NaN)    is that NaN;\n *\n * Accuracy:\n *      TRIG(x) returns trig(x) nearly rounded\n */\n\n/* sin(x)\n * Return sine function of x.\n *\n * kernel function:\n *      __kernel_sin            ... sine function on [-pi/4,pi/4]\n *      __kernel_cos            ... cose function on [-pi/4,pi/4]\n *      __ieee754_rem_pio2      ... argument reduction routine\n */\ndouble\nsin (double x)\n{\n  double y[2], z = 0.0;\n  int n, ix;\n\n  /* High word of x. */\n  ix = __HI (x);\n\n  /* |x| ~< pi/4 */\n  ix &= 0x7fffffff;\n  if (ix <= 0x3fe921fb)\n  {\n    return __kernel_sin (x, z, 0);\n  }\n\n  /* sin(Inf or NaN) is NaN */\n  else if (ix >= 0x7ff00000)\n  {\n    return x - x;\n  }\n\n  /* argument reduction needed */\n  else\n  {\n    n = __ieee754_rem_pio2 (x, y);\n    switch (n & 3)\n    {\n      case 0:\n      {\n        return __kernel_sin (y[0], y[1], 1);\n      }\n      case 1:\n      {\n        return __kernel_cos (y[0], y[1]);\n      }\n      case 2:\n      {\n        return -__kernel_sin (y[0], y[1], 1);\n      }\n      default:\n      {\n        return -__kernel_cos (y[0], y[1]);\n      }\n    }\n  }\n} /* sin */\n\n/* cos(x)\n * Return cosine function of x.\n *\n * kernel function:\n *      __kernel_sin            ... sine function on [-pi/4,pi/4]\n *      __kernel_cos            ... cosine function on [-pi/4,pi/4]\n *      __ieee754_rem_pio2      ... argument reduction routine\n */\n\ndouble\ncos (double x)\n{\n  double y[2], z = 0.0;\n  int n, ix;\n\n  /* High word of x. */\n  ix = __HI (x);\n\n  /* |x| ~< pi/4 */\n  ix &= 0x7fffffff;\n  if (ix <= 0x3fe921fb)\n  {\n    return __kernel_cos (x, z);\n  }\n\n  /* cos(Inf or NaN) is NaN */\n  else if (ix >= 0x7ff00000)\n  {\n    return x - x;\n  }\n\n  /* argument reduction needed */\n  else\n  {\n    n = __ieee754_rem_pio2 (x, y);\n    switch (n & 3)\n    {\n      case 0:\n      {\n        return __kernel_cos (y[0], y[1]);\n      }\n      case 1:\n      {\n        return -__kernel_sin (y[0], y[1], 1);\n      }\n      case 2:\n      {\n        return -__kernel_cos (y[0], y[1]);\n      }\n      default:\n      {\n        return __kernel_sin (y[0], y[1], 1);\n      }\n    }\n  }\n} /* cos */\n\n/* tan(x)\n * Return tangent function of x.\n *\n * kernel function:\n *      __kernel_tan            ... tangent function on [-pi/4,pi/4]\n *      __ieee754_rem_pio2      ... argument reduction routine\n */\n\ndouble\ntan (double x)\n{\n  double y[2], z = 0.0;\n  int n, ix;\n\n  /* High word of x. */\n  ix = __HI (x);\n\n  /* |x| ~< pi/4 */\n  ix &= 0x7fffffff;\n  if (ix <= 0x3fe921fb)\n  {\n    return __kernel_tan (x, z, 1);\n  }\n\n  /* tan(Inf or NaN) is NaN */\n  else if (ix >= 0x7ff00000)\n  {\n    return x - x; /* NaN */\n  }\n\n  /* argument reduction needed */\n  else\n  {\n    n = __ieee754_rem_pio2 (x, y);\n    return __kernel_tan (y[0], y[1], 1 - ((n & 1) << 1)); /*   1 -- n even, -1 -- n odd */\n  }\n} /* tan */\n\n#undef zero\n#undef half\n#undef one\n#undef two24\n#undef twon24\n#undef invpio2\n#undef pio2_1\n#undef pio2_1t\n#undef pio2_2\n#undef pio2_2t\n#undef pio2_3\n#undef pio2_3t\n#undef S1\n#undef S2\n#undef S3\n#undef S4\n#undef S5\n#undef S6\n#undef C1\n#undef C2\n#undef C3\n#undef C4\n#undef C5\n#undef C6\n#undef T0\n#undef T1\n#undef T2\n#undef T3\n#undef T4\n#undef T5\n#undef T6\n#undef T7\n#undef T8\n#undef T9\n#undef T10\n#undef T11\n#undef T12\n#undef pio4\n#undef pio4lo\n"
  },
  {
    "path": "jerry-port/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required (VERSION 3.10)\nset(JERRY_PORT_NAME jerry-port)\nproject (${JERRY_PORT_NAME} C)\n\n# Source directories\nset(PORT_SOURCES\n  common/jerry-port-context.c\n  common/jerry-port-fs.c\n  common/jerry-port-io.c\n  common/jerry-port-process.c\n  unix/jerry-port-unix-date.c\n  unix/jerry-port-unix-fs.c\n  unix/jerry-port-unix-process.c\n  win/jerry-port-win-date.c\n  win/jerry-port-win-fs.c\n  win/jerry-port-win-process.c\n)\n\n# Define _BSD_SOURCE and _DEFAULT_SOURCE\n# (should only be necessary if we used compiler default libc but not checking that)\nset(PORT_DEFINES\n  _BSD_SOURCE\n  _DEFAULT_SOURCE\n  JERRY_GLOBAL_HEAP_SIZE=${JERRY_GLOBAL_HEAP_SIZE}\n)\n\n# Amalgamated JerryScript source/header build.\n#  The process will create the following files:\n#   * jerryscript-port.c\n#   * jerryscript-port.h\nif(ENABLE_AMALGAM)\n  set(AMALGAM_PORT_C \"${CMAKE_BINARY_DIR}/amalgam/jerryscript-port.c\")\n\n  add_custom_command(OUTPUT ${AMALGAM_PORT_C}\n                     COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/tools/amalgam.py\n                             --jerry-port\n                             --output-dir ${CMAKE_BINARY_DIR}/amalgam\n                     DEPENDS ${PORT_SOURCES}\n                             ${CMAKE_SOURCE_DIR}/tools/amalgam.py\n  )\n  add_custom_target(amalgam-port DEPENDS ${AMALGAM_PORT_C})\n  add_dependencies(amalgam amalgam-port)\n\n  set(PORT_SOURCES ${AMALGAM_PORT_C})\nendif()\n\nINCLUDE (CheckStructHasMember)\n# CHECK_STRUCT_HAS_MEMBER works by trying to compile some C code that accesses the\n# given field of the given struct. However, our default compiler options break this\n# C code, so turn a couple of them off for this.\nif(USING_GCC OR USING_CLANG)\n  set(CMAKE_REQUIRED_FLAGS \"-Wno-error=strict-prototypes -Wno-error=old-style-definition -Wno-error=unused-value\")\nendif()\n\n# tm.tm_gmtoff is non-standard, so glibc doesn't expose it in c99 mode\n# (our default). Define some macros to expose it anyway.\nset(CMAKE_REQUIRED_DEFINITIONS \"-D_BSD_SOURCE -D_DEFAULT_SOURCE\")\nCHECK_STRUCT_HAS_MEMBER (\"struct tm\" tm_gmtoff time.h HAVE_TM_GMTOFF)\n\n# localtime_r is is not threadsafe with clang on OSX\nif(HAVE_TM_GMTOFF AND NOT \"${PLATFORM}\" STREQUAL \"DARWIN\" AND NOT USING_CLANG)\n  set(PORT_DEFINES ${PORT_DEFINES} HAVE_TM_GMTOFF)\nendif()\n\n# Default Jerry port implementation library\nadd_library(${JERRY_PORT_NAME} ${PORT_SOURCES})\nadd_dependencies(${JERRY_PORT_NAME} amalgam)\ntarget_include_directories(${JERRY_PORT_NAME} PRIVATE ${INCLUDE_CORE_PUBLIC})\ntarget_compile_definitions(${JERRY_PORT_NAME} PRIVATE ${PORT_DEFINES})\n\n# Installation\nconfigure_file(libjerry-port.pc.in libjerry-port.pc @ONLY)\n\ninstall(TARGETS ${JERRY_PORT_NAME} DESTINATION lib)\ninstall(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjerry-port.pc DESTINATION lib/pkgconfig)\n"
  },
  {
    "path": "jerry-port/common/jerry-port-context.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdlib.h>\n\n#include \"jerryscript-port.h\"\n\n#ifndef JERRY_GLOBAL_HEAP_SIZE\n#define JERRY_GLOBAL_HEAP_SIZE 512\n#endif /* JERRY_GLOBAL_HEAP_SIZE */\n\n/**\n * Pointer to the current context.\n * Note that it is a global variable, and is not a thread safe implementation.\n */\nstatic jerry_context_t *current_context_p = NULL;\n\nsize_t JERRY_ATTR_WEAK\njerry_port_context_alloc (size_t context_size)\n{\n  size_t total_size = context_size + JERRY_GLOBAL_HEAP_SIZE * 1024;\n  current_context_p = malloc (total_size);\n\n  return total_size;\n} /* jerry_port_context_alloc */\n\njerry_context_t *JERRY_ATTR_WEAK\njerry_port_context_get (void)\n{\n  return current_context_p;\n} /* jerry_port_context_get */\n\nvoid JERRY_ATTR_WEAK\njerry_port_context_free (void)\n{\n  free (current_context_p);\n} /* jerry_port_context_free */\n"
  },
  {
    "path": "jerry-port/common/jerry-port-fs.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"jerryscript-port.h\"\n\n#if defined(__GLIBC__) || defined(_WIN32)\n#include <sys/stat.h>\n\n#ifndef S_ISDIR\n#define S_ISDIR(mode) (((mode) &S_IFMT) == S_IFDIR)\n#endif /* !defined(S_ISDIR) */\n#endif /* __GLIBC__ */\n\n/**\n * Determines the size of the given file.\n * @return size of the file\n */\nstatic jerry_size_t\njerry_port_get_file_size (FILE *file_p) /**< opened file */\n{\n  fseek (file_p, 0, SEEK_END);\n  long size = ftell (file_p);\n  fseek (file_p, 0, SEEK_SET);\n\n  return (jerry_size_t) size;\n} /* jerry_port_get_file_size */\n\njerry_char_t *JERRY_ATTR_WEAK\njerry_port_source_read (const char *file_name_p, jerry_size_t *out_size_p)\n{\n  /* TODO(dbatyai): Temporary workaround for nuttx target\n   * The nuttx target builds and copies the jerryscript libraries as a separate build step, which causes linking issues\n   * later due to different libc libraries. It should incorporate the amalgam sources into the main nuttx build so that\n   * the correct libraries are used, then this guard should be removed from here and also from the includes. */\n#if defined(__GLIBC__) || defined(_WIN32)\n  struct stat stat_buffer;\n  if (stat (file_name_p, &stat_buffer) == -1 || S_ISDIR (stat_buffer.st_mode))\n  {\n    return NULL;\n  }\n#endif /* __GLIBC__ */\n\n  FILE *file_p = fopen (file_name_p, \"rb\");\n\n  if (file_p == NULL)\n  {\n    return NULL;\n  }\n\n  jerry_size_t file_size = jerry_port_get_file_size (file_p);\n  jerry_char_t *buffer_p = (jerry_char_t *) malloc (file_size);\n\n  if (buffer_p == NULL)\n  {\n    fclose (file_p);\n    return NULL;\n  }\n\n  size_t bytes_read = fread (buffer_p, 1u, file_size, file_p);\n\n  if (bytes_read != file_size)\n  {\n    fclose (file_p);\n    free (buffer_p);\n    return NULL;\n  }\n\n  fclose (file_p);\n  *out_size_p = (jerry_size_t) bytes_read;\n\n  return buffer_p;\n} /* jerry_port_source_read */\n\nvoid JERRY_ATTR_WEAK\njerry_port_source_free (uint8_t *buffer_p)\n{\n  free (buffer_p);\n} /* jerry_port_source_free */\n\n/**\n * These functions provide generic implementation for paths and are only enabled when the compiler support weak symbols,\n * and we are not building for a platform that has platform specific versions.\n */\n#if !(defined(__unix__) || defined(__APPLE__) || defined(_WIN32))\n\njerry_char_t *JERRY_ATTR_WEAK\njerry_port_path_normalize (const jerry_char_t *path_p, jerry_size_t path_size)\n{\n  jerry_char_t *buffer_p = (jerry_char_t *) malloc (path_size + 1);\n\n  if (buffer_p == NULL)\n  {\n    return NULL;\n  }\n\n  /* Also copy terminating zero byte. */\n  memcpy (buffer_p, path_p, path_size + 1);\n\n  return buffer_p;\n} /* jerry_port_path_normalize */\n\nvoid JERRY_ATTR_WEAK\njerry_port_path_free (jerry_char_t *path_p)\n{\n  free (path_p);\n} /* jerry_port_path_free */\n\njerry_size_t JERRY_ATTR_WEAK\njerry_port_path_base (const jerry_char_t *path_p)\n{\n  const jerry_char_t *basename_p = (jerry_char_t *) strrchr ((char *) path_p, '/') + 1;\n\n  if (basename_p == NULL)\n  {\n    return 0;\n  }\n\n  return (jerry_size_t) (basename_p - path_p);\n} /* jerry_port_path_base */\n\n#endif /* !(defined(__unix__) || defined(__APPLE__) || defined(_WIN32)) */\n"
  },
  {
    "path": "jerry-port/common/jerry-port-io.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"jerryscript-port.h\"\n\n/**\n * Default implementation of jerry_port_log. Prints log messages to stderr.\n */\nvoid JERRY_ATTR_WEAK\njerry_port_log (const char *message_p) /**< message */\n{\n  fputs (message_p, stderr);\n} /* jerry_port_log */\n\nvoid JERRY_ATTR_WEAK\njerry_port_print_buffer (const jerry_char_t *buffer_p, jerry_size_t buffer_size)\n{\n  fwrite (buffer_p, 1, buffer_size, stdout);\n} /* jerry_port_print_buffer */\n\njerry_char_t *JERRY_ATTR_WEAK\njerry_port_line_read (jerry_size_t *out_size_p)\n{\n  char *line_p = NULL;\n  size_t allocated = 0;\n  size_t bytes = 0;\n\n  while (true)\n  {\n    allocated += 64;\n    line_p = realloc (line_p, allocated);\n    if (line_p == NULL)\n    {\n      jerry_port_fatal (JERRY_FATAL_OUT_OF_MEMORY);\n    }\n\n    while (bytes < allocated - 1)\n    {\n      char ch = (char) fgetc (stdin);\n\n      if (feof (stdin))\n      {\n        free (line_p);\n        return NULL;\n      }\n\n      line_p[bytes++] = ch;\n\n      if (ch == '\\n')\n      {\n        *out_size_p = (jerry_size_t) bytes;\n        line_p[bytes++] = '\\0';\n        return (jerry_char_t *) line_p;\n      }\n    }\n  }\n} /* jerry_port_line_read */\n\nvoid JERRY_ATTR_WEAK\njerry_port_line_free (jerry_char_t *buffer_p)\n{\n  free (buffer_p);\n} /* jerry_port_line_free */\n"
  },
  {
    "path": "jerry-port/common/jerry-port-process.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdlib.h>\n\n#include \"jerryscript-port.h\"\n\n#if !defined(_WIN32)\n\n/**\n * Default implementation of jerry_port_init. Do nothing.\n */\nvoid JERRY_ATTR_WEAK\njerry_port_init (void)\n{\n} /* jerry_port_init */\n\n#endif /* !defined(_WIN32) */\n\n/**\n * Default implementation of jerry_port_fatal. Calls 'abort' if exit code is\n * non-zero, 'exit' otherwise.\n */\nvoid JERRY_ATTR_WEAK\njerry_port_fatal (jerry_fatal_code_t code) /**< cause of error */\n{\n  if (code != 0 && code != JERRY_FATAL_OUT_OF_MEMORY)\n  {\n    abort ();\n  }\n\n  exit ((int) code);\n} /* jerry_port_fatal */\n"
  },
  {
    "path": "jerry-port/libjerry-port.pc.in",
    "content": "prefix=@CMAKE_INSTALL_PREFIX@\nlibdir=${prefix}/lib\nincludedir=${prefix}/include\n\nName: libjerry-port\nDescription: JerryScript: lightweight JavaScript engine (default port library)\nURL: https://github.com/jerryscript-project/jerryscript\nVersion: @JERRY_VERSION@\nLibs: -L${libdir} -ljerry-port\nCflags: -I${includedir}\n"
  },
  {
    "path": "jerry-port/unix/jerry-port-unix-date.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n\n#if defined(__unix__) || defined(__APPLE__)\n\n#include <sys/time.h>\n#include <time.h>\n\nint32_t\njerry_port_local_tza (double unix_ms)\n{\n  time_t time = (time_t) unix_ms / 1000;\n\n#if defined(HAVE_TM_GMTOFF)\n  struct tm tm;\n  localtime_r (&time, &tm);\n\n  return ((int32_t) tm.tm_gmtoff) * 1000;\n#else /* !defined(HAVE_TM_GMTOFF) */\n  struct tm gmt_tm;\n  struct tm local_tm;\n\n  gmtime_r (&time, &gmt_tm);\n  localtime_r (&time, &local_tm);\n\n  time_t gmt = mktime (&gmt_tm);\n\n  /* mktime removes the daylight saving time from the result time value, however we want to keep it */\n  local_tm.tm_isdst = 0;\n  time_t local = mktime (&local_tm);\n\n  return (int32_t) difftime (local, gmt) * 1000;\n#endif /* HAVE_TM_GMTOFF */\n} /* jerry_port_local_tza */\n\ndouble\njerry_port_current_time (void)\n{\n  struct timeval tv;\n  gettimeofday (&tv, NULL);\n\n  return ((double) tv.tv_sec) * 1000.0 + ((double) tv.tv_usec) / 1000.0;\n} /* jerry_port_current_time */\n\n#endif /* defined(__unix__) || defined(__APPLE__) */\n"
  },
  {
    "path": "jerry-port/unix/jerry-port-unix-fs.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n\n#if defined(__unix__) || defined(__APPLE__)\n\n#include <stdlib.h>\n#include <string.h>\n\njerry_char_t *\njerry_port_path_normalize (const jerry_char_t *path_p, jerry_size_t path_size)\n{\n  (void) path_size;\n\n  return (jerry_char_t *) realpath ((char *) path_p, NULL);\n} /* jerry_port_path_normalize */\n\nvoid\njerry_port_path_free (jerry_char_t *path_p)\n{\n  free (path_p);\n} /* jerry_port_path_free */\n\njerry_size_t JERRY_ATTR_WEAK\njerry_port_path_base (const jerry_char_t *path_p)\n{\n  const jerry_char_t *basename_p = (jerry_char_t *) strrchr ((char *) path_p, '/') + 1;\n\n  return (jerry_size_t) (basename_p - path_p);\n} /* jerry_port_path_base */\n\n#endif /* defined(__unix__) || defined(__APPLE__) */\n"
  },
  {
    "path": "jerry-port/unix/jerry-port-unix-process.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n\n#if defined(__unix__) || defined(__APPLE__)\n\n#if !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 500\n#undef _XOPEN_SOURCE\n/* Required macro for sleep functions (nanosleep or usleep) */\n#define _XOPEN_SOURCE 500\n#endif /* !(defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 500) */\n\n#include <unistd.h>\n\nvoid\njerry_port_sleep (uint32_t sleep_time)\n{\n  usleep ((useconds_t) sleep_time * 1000);\n} /* jerry_port_sleep */\n\n#endif /* defined(__unix__) || defined(__APPLE__) */\n"
  },
  {
    "path": "jerry-port/win/jerry-port-win-date.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n\n#if defined(_WIN32)\n\n#include <windows.h>\n\n#include <time.h>\n#include <winbase.h>\n#include <winnt.h>\n\n#define UNIX_EPOCH_IN_TICKS 116444736000000000LL /* difference between 1970 and 1601 */\n#define TICKS_PER_MS        10000LL /* 1 tick is 100 nanoseconds */\n\n/*\n * If you take the limit of SYSTEMTIME (last millisecond in 30827) then you end up with\n * a FILETIME of 0x7fff35f4f06c58f0 by using SystemTimeToFileTime(). However, if you put\n * 0x7fffffffffffffff into FileTimeToSystemTime() then you will end up in the year 30828,\n * although this date is invalid for SYSTEMTIME. Any larger value (0x8000000000000000 and above)\n * causes FileTimeToSystemTime() to fail.\n * https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime\n * https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime\n */\n#define UNIX_EPOCH_DATE_1601_01_02  -11644387200000LL /* unit: ms */\n#define UNIX_EPOCH_DATE_30827_12_29 9106702560000000LL /* unit: ms */\n\n/**\n * Convert unix time to a FILETIME value.\n *\n * https://support.microsoft.com/en-us/help/167296/how-to-convert-a-unix-time-t-to-a-win32-filetime-or-systemtime\n */\nstatic void\nunix_time_to_filetime (LONGLONG t, LPFILETIME ft_p)\n{\n  LONGLONG ll = t * TICKS_PER_MS + UNIX_EPOCH_IN_TICKS;\n\n  ft_p->dwLowDateTime = (DWORD) ll;\n  ft_p->dwHighDateTime = (DWORD) (ll >> 32);\n} /* unix_time_to_filetime */\n\n/**\n * Convert a FILETIME to a unix time value.\n *\n * @return unix time\n */\nstatic LONGLONG\nfiletime_to_unix_time (LPFILETIME ft_p)\n{\n  ULARGE_INTEGER date;\n  LONGLONG ll;\n  date.HighPart = ft_p->dwHighDateTime;\n  date.LowPart = ft_p->dwLowDateTime;\n  ll = (LONGLONG) date.QuadPart - UNIX_EPOCH_IN_TICKS;\n  return ll / TICKS_PER_MS;\n} /* filetime_to_unix_time */\n\nint32_t\njerry_port_local_tza (double unix_ms)\n{\n  FILETIME utc;\n  FILETIME local;\n  SYSTEMTIME utc_sys;\n  SYSTEMTIME local_sys;\n  LONGLONG t = (LONGLONG) (unix_ms);\n\n  /*\n   * If the time is earlier than the date 1601-01-02, then always using date 1601-01-02 to\n   * query time zone adjustment. This date (1601-01-02) will make sure both UTC and local\n   * time succeed with Win32 API. The date 1601-01-01 may lead to a win32 api failure, as\n   * after converting between local time and utc time, the time may be earlier than 1601-01-01\n   * in UTC time, that exceeds the FILETIME representation range.\n   */\n  if (t < UNIX_EPOCH_DATE_1601_01_02)\n  {\n    t = UNIX_EPOCH_DATE_1601_01_02;\n  }\n\n  /* Like above, do not use the last supported day */\n  if (t > UNIX_EPOCH_DATE_30827_12_29)\n  {\n    t = UNIX_EPOCH_DATE_30827_12_29;\n  }\n  unix_time_to_filetime (t, &utc);\n\n  if (FileTimeToSystemTime (&utc, &utc_sys) && SystemTimeToTzSpecificLocalTime (NULL, &utc_sys, &local_sys)\n      && SystemTimeToFileTime (&local_sys, &local))\n  {\n    LONGLONG unix_local = filetime_to_unix_time (&local);\n    return (int32_t) (unix_local - t);\n  }\n\n  return 0;\n} /* jerry_port_local_tza */\n\ndouble\njerry_port_current_time (void)\n{\n  FILETIME ft;\n  GetSystemTimeAsFileTime (&ft);\n  return (double) filetime_to_unix_time (&ft);\n} /* jerry_port_current_time */\n\n#endif /* defined(_WIN32) */\n"
  },
  {
    "path": "jerry-port/win/jerry-port-win-fs.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n\n#if defined(_WIN32)\n\n#include <stdlib.h>\n#include <string.h>\n\njerry_char_t *\njerry_port_path_normalize (const jerry_char_t *path_p, jerry_size_t path_size)\n{\n  (void) path_size;\n\n  return (jerry_char_t *) _fullpath (NULL, (const char *) path_p, _MAX_PATH);\n} /* jerry_port_path_normalize */\n\nvoid\njerry_port_path_free (jerry_char_t *path_p)\n{\n  free (path_p);\n} /* jerry_port_path_free */\n\njerry_size_t\njerry_port_path_base (const jerry_char_t *path_p)\n{\n  const jerry_char_t *end_p = path_p + strlen ((const char *) path_p);\n\n  while (end_p > path_p)\n  {\n    if (end_p[-1] == '/' || end_p[-1] == '\\\\')\n    {\n      return (jerry_size_t) (end_p - path_p);\n    }\n\n    end_p--;\n  }\n\n  return 0;\n} /* jerry_port_path_base */\n\n#endif /* defined(_WIN32) */\n"
  },
  {
    "path": "jerry-port/win/jerry-port-win-process.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n#include \"jerryscript-port.h\"\n\n#if defined(_WIN32)\n\n#include <windows.h>\n\n#include <crtdbg.h>\n#include <stdio.h>\n\nvoid\njerry_port_init (void)\n{\n  if (!IsDebuggerPresent ())\n  {\n    /* Make output streams unbuffered by default */\n    setvbuf (stdout, NULL, _IONBF, 0);\n    setvbuf (stderr, NULL, _IONBF, 0);\n\n    /*\n     * By default abort() only generates a crash-dump in *non* debug\n     * builds. As our Assert() / ExceptionalCondition() uses abort(),\n     * leaving the default in place would make debugging harder.\n     *\n     * MINGW's own C runtime doesn't have _set_abort_behavior(). When\n     * targeting Microsoft's UCRT with mingw, it never links to the debug\n     * version of the library and thus doesn't need the call to\n     * _set_abort_behavior() either.\n     */\n#if !defined(__MINGW32__) && !defined(__MINGW64__)\n    _set_abort_behavior (_CALL_REPORTFAULT | _WRITE_ABORT_MSG, _CALL_REPORTFAULT | _WRITE_ABORT_MSG);\n#endif /* !defined(__MINGW32__) && !defined(__MINGW64__) */\n\n    /*\n     * SEM_FAILCRITICALERRORS causes more errors to be reported to\n     * callers.\n     *\n     * We used to also specify SEM_NOGPFAULTERRORBOX, but that prevents\n     * windows crash reporting from working. Which includes registered\n     * just-in-time debuggers, making it unnecessarily hard to debug\n     * problems on windows. Now we try to disable sources of popups\n     * separately below (note that SEM_NOGPFAULTERRORBOX did not actually\n     * prevent all sources of such popups).\n     */\n    SetErrorMode (SEM_FAILCRITICALERRORS);\n\n    /*\n     * Show errors on stderr instead of popup box (note this doesn't\n     * affect errors originating in the C runtime, see below).\n     */\n    _set_error_mode (_OUT_TO_STDERR);\n\n    /*\n     * In DEBUG builds, errors, including assertions, C runtime errors are\n     * reported via _CrtDbgReport. By default such errors are displayed\n     * with a popup (even with NOGPFAULTERRORBOX), preventing forward\n     * progress. Instead report such errors stderr (and the debugger).\n     * This is C runtime specific and thus the above incantations aren't\n     * sufficient to suppress these popups.\n     */\n    _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);\n    _CrtSetReportFile (_CRT_ERROR, _CRTDBG_FILE_STDERR);\n    _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);\n    _CrtSetReportFile (_CRT_ASSERT, _CRTDBG_FILE_STDERR);\n    _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);\n    _CrtSetReportFile (_CRT_WARN, _CRTDBG_FILE_STDERR);\n  }\n} /* jerry_port_init */\n\nvoid\njerry_port_sleep (uint32_t sleep_time)\n{\n  Sleep (sleep_time);\n} /* jerry_port_sleep */\n\n#endif /* defined(_WIN32) */\n"
  },
  {
    "path": "sonar-project.properties",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nsonar.projectName=JerryScript\nsonar.projectKey=jerryscript-project_jerryscript\nsonar.sources=jerry-core,jerry-ext,jerry-main,jerry-port\nsonar.cfamily.build-wrapper-output=bw-output\n"
  },
  {
    "path": "targets/baremetal-sdk/espressif/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required(VERSION 3.5)\n\nset(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig)\n# Workaround to generate sdkconfig into the build directory.\nfile(TOUCH ${SDKCONFIG})\n\ninclude($ENV{IDF_PATH}/tools/cmake/project.cmake)\n\nproject(jerryscript)\n"
  },
  {
    "path": "targets/baremetal-sdk/espressif/README.md",
    "content": "### About\n\nThis folder contains files to run JerryScript on\n[ESP8666 board](https://www.espressif.com/en/products/socs/esp8266) with\n[ESP8266 RTOS SDK](https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/) and\n[ESP32 board](https://www.espressif.com/en/products/socs/esp32) with\n[esp-idf](https://docs.espressif.com/projects/esp-idf/en/latest/).\n\nBoth targets is based on ESP-IDF Style so the build system and the directory structure is the same.\nPlease see the following documents for additional information about the targets:\n\n- [esp8266-rtos-sdk](esp8266-rtos-sdk/README.md)\n- [esp-idf](esp-idf/README.md)\n"
  },
  {
    "path": "targets/baremetal-sdk/espressif/esp-idf/Makefile.travis",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\n# Default target for running the build test outside the Travis CI environment.\nall:\n\t$(MAKE) install\n\t$(MAKE) script\n\n\n## Targets for installing build dependencies of the ESP8266 JerryScript target.\n\n# Install tools via apt.\ninstall-apt-get-deps:\n\tsudo apt-get install -q -y wget\n\n# Fetch and extract Xtensa toolchain.\ninstall-xtensa-esp32-gcc:\n\twget https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-linux-amd64.tar.gz --no-check-certificate --directory-prefix /tmp\n\ttar xvfz /tmp/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-linux-amd64.tar.gz --directory /tmp\n\n# Fetch Espressif IoT Development Framework and install its dependencies.\ninstall-esp-idf:\n\tgit clone https://github.com/espressif/esp-idf.git /tmp/esp-idf -b release/v4.4\n\tIDF_PATH=/tmp/esp-idf python -m pip install --user -r /tmp/esp-idf/requirements.txt\n\n# Perform all the necessary (JerryScript-independent) installation steps.\ninstall-noapt: install-xtensa-esp32-gcc install-esp-idf\ninstall: install-apt-get-deps install-noapt\n\n\n## Targets for building ESP-IDF with JerryScript.\n\n# Build the firmware (ESP-IDF with JerryScript).\nscript:\n\tPATH=/tmp/xtensa-esp32-elf/bin:$(PATH) \\\n\tpython /tmp/esp-idf/tools/idf.py \\\n\t\t--project-dir ./targets/baremetal-sdk/espressif \\\n\t\t--build-dir ./build/esp-idf \\\n\t\tset-target esp32 \\\n\t\tall\n"
  },
  {
    "path": "targets/baremetal-sdk/espressif/esp-idf/README.md",
    "content": "### About\n\nThis folder contains files to run JerryScript on\n[ESP32 board](https://www.espressif.com/en/products/socs/esp32) with\n[ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/latest/).\nThe document had been validated on Ubuntu 20.04 operating system.\n\n### How to build\n\n#### 1. Setup the build environment\n\nClone the necessary projects into a `jerry-esp` directory.\nThe latest tested working version of ESP-IDF SDK is `release/v4.4`.\n\n```sh\n# Create a base folder for all the projects.\nmkdir jerry-esp && cd jerry-esp\n\ngit clone https://github.com/jerryscript-project/jerryscript.git\ngit clone https://github.com/espressif/esp-idf.git -b release/v4.4\n\n# SDK requires Xtensa toolchain.\nwget https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz\n```\n\nThe following directory structure has been created:\n\n```\njerry-esp\n  + jerryscript\n  |  + targets\n  |      + baremetal-sdk\n  |          + espressif\n  |\n  + esp-idf\n  + xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz\n```\n\n#### 2. Install dependencies of the projects\n\n```sh\n# Assuming you are in jerry-esp folder.\njerryscript/tools/apt-get-install-deps.sh\n\n# Install dependencies of esp-idf.\npython -m pip install --user -r esp-idf/requirements.txt\n\n# Extract the downloaded toolchain.\ntar -xvf xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz\n```\n\n#### 3. Build ESP-IDF (with JerryScript)\n\n```sh\n# Assuming you are in jerry-esp folder.\nPATH=${PWD}/xtensa-esp32-elf/bin:$PATH esp-idf/tools/idf.py \\\n  --project-dir jerryscript/targets/baremetal-sdk/espressif \\\n  --build-dir jerryscript/build/esp-idf \\\n  set-target esp32 \\\n  all\n```\n\nThe created binary is a `jerrycript.bin` named file located in `jerryscript/build/esp-idf` folder.\n\n#### 4. Flash the device\n\nConnect Micro-USB for charging and flashing the device. The device should be visible as /dev/ttyUSB0.\n\n```sh\n# Assuming you are in jerry-esp folder.\nsudo python esp-idf/components/esptool_py/esptool/esptool.py \\\n  --chip esp32 \\\n  --port /dev/ttyUSB0 \\\n  --baud 460800 \\\n  --before default_reset \\\n  --after hard_reset \\\n  write_flash \\\n  --flash_mode dio \\\n  --flash_size detect \\\n  --flash_freq 40m \\\n  0x1000 jerryscript/build/esp-idf/bootloader/bootloader.bin \\\n  0x8000 jerryscript/build/esp-idf/partition_table/partition-table.bin \\\n  0x10000 jerryscript/build/esp-idf/jerryscript.bin\n```\n\n#### 5. Connect to the device\n\nesp-idf provides a Python script for serial communication.\nOther programs also can be used such as minicom, picocom, etc.\n\n* The device should be visible as `/dev/ttyUSB0`\n* The device uses `115200` baud rate for serial communication\n* Press `CTRL` + `ALT` + `]` to exit monitor program\n\n```sh\n# Assuming you are in jerry-esp folder.\nPATH=${PWD}/xtensa-esp32-elf/bin:$PATH esp-idf/tools/idf_monitor.py \\\n  --port /dev/ttyUSB0 \\\n  --baud 115200 \\\n  --toolchain-prefix=xtensa-esp32-elf- \\\n  jerryscript/build/esp-idf/jerryscript.elf\n```\n\nThe following output should be captured:\n\n```\nI (0) cpu_start: App cpu up.\nI (326) cpu_start: Pro cpu start user code\nI (326) cpu_start: cpu freq: 160000000\nI (326) cpu_start: Application information:\nI (331) cpu_start: Project name:     jerryscript\nI (336) cpu_start: App version:      v2.4.0-278-ge815e540-dirty\nI (342) cpu_start: Compile time:     Jan 21 2022 11:38:44\nI (349) cpu_start: ELF file SHA256:  2e874acb5a45c0cb...\nI (355) cpu_start: ESP-IDF:          v4.4-beta1-284-gd83021a6e8-dirt\nI (362) heap_init: Initializing. RAM available for dynamic allocation:\nI (369) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM\nI (375) heap_init: At 3FFB8510 len 00027AF0 (158 KiB): DRAM\nI (381) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM\nI (387) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM\nI (394) heap_init: At 4008B3E8 len 00014C18 (83 KiB): IRAM\nI (401) spi_flash: detected chip: generic\nI (405) spi_flash: flash io: dio\nI (410) cpu_start: Starting scheduler on PRO CPU.\nI (0) cpu_start: Starting scheduler on APP CPU.\nI (420) JS: This test run the following script code: \nI (430) JS: print ('Hello, World!');\nHello, World!\n```\n"
  },
  {
    "path": "targets/baremetal-sdk/espressif/esp8266-rtos-sdk/Makefile.travis",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\n# Default target for running the build test outside the Travis CI environment.\nall:\n\t$(MAKE) install\n\t$(MAKE) script\n\n\n## Targets for installing build dependencies of the ESP8266 JerryScript target.\n\n# Install tools via apt.\ninstall-apt-get-deps:\n\tsudo apt-get install -q -y wget\n\n# Fetch and extract Xtensa toolchain.\ninstall-xtensa-lx106-gcc:\n\twget https://dl.espressif.com/dl/xtensa-lx106-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz --no-check-certificate --directory-prefix /tmp\n\ttar xvfz /tmp/xtensa-lx106-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz --directory /tmp\n\n# Fetch Espressif SDK and install its dependencies.\ninstall-espressif-sdk:\n\tgit clone https://github.com/espressif/ESP8266_RTOS_SDK.git /tmp/ESP8266_RTOS_SDK -b release/v3.4\n\tpython -m pip install --user -r /tmp/ESP8266_RTOS_SDK/requirements.txt\n\n# Perform all the necessary (JerryScript-independent) installation steps. - edited -\ninstall-noapt: install-xtensa-lx106-gcc install-espressif-sdk\ninstall: install-apt-get-deps install-noapt\n\n\n## Targets for building ESP8266 with JerryScript.\n\n# Build the firmware (ESP8266 with JerryScript).\nscript:\n\tPATH=/tmp/xtensa-lx106-elf/bin:$(PATH) \\\n\tpython /tmp/ESP8266_RTOS_SDK/tools/idf.py \\\n\t\t--project-dir ./targets/baremetal-sdk/espressif \\\n\t\t--build-dir ./build/esp8266-rtos-sdk \\\n\t\tall\n"
  },
  {
    "path": "targets/baremetal-sdk/espressif/esp8266-rtos-sdk/README.md",
    "content": "### About\n\nThis folder contains files to run JerryScript on\n[ESP8666 board](https://www.espressif.com/en/products/socs/esp8266) with\n[ESP8266 RTOS SDK](https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/).\nThe document had been validated on Ubuntu 20.04 operating system.\n\n### How to build\n\n#### 1. Setup the build environment\n\nClone the necessary projects into a `jerry-esp` directory.\nThe latest tested working version of ESP8266 RTOS SDK is `release/v3.4`.\n\n```sh\n# Create a base folder for all the projects.\nmkdir jerry-esp && cd jerry-esp\n\ngit clone https://github.com/jerryscript-project/jerryscript.git\ngit clone https://github.com/espressif/ESP8266_RTOS_SDK -b release/v3.4\n\n# SDK requires Xtensa toolchain.\nwget https://dl.espressif.com/dl/xtensa-lx106-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz\n```\n\nThe following directory structure has been created:\n\n```\njerry-esp\n  + jerryscript\n  |  + targets\n  |      + baremetal-sdk\n  |          + espressif\n  |\n  + ESP8266_RTOS_SDK\n  + xtensa-lx106-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz\n```\n\n#### 2. Install dependencies of the projects\n\n```sh\n# Assuming you are in jerry-esp folder.\njerryscript/tools/apt-get-install-deps.sh\n\n# Install dependencies of ESP8266-RTOS-SDK.\npython -m pip install --user -r ESP8266_RTOS_SDK/requirements.txt\n\n# Extract the downloaded toolchain.\ntar -xvf xtensa-lx106-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz\n```\n\n#### 3. Build ESP8266-RTOS-SDK (with JerryScript)\n\n```sh\n# Assuming you are in jerry-esp folder.\nPATH=${PWD}/xtensa-lx106-elf/bin:$PATH ESP8266_RTOS_SDK/tools/idf.py \\\n  --project-dir jerryscript/targets/baremetal-sdk/espressif \\\n  --build-dir jerryscript/build/esp8266-rtos-sdk \\\n  all\n```\n\nThe created binary is a `jerryscript.bin` named file located in `jerryscript/build/esp8266-rtos-sdk` folder.\n\n#### 4. Flash the device\n\nConnect Micro-USB for charging and flashing the device. The device should be visible as /dev/ttyUSB0.\n\n```sh\n# Assuming you are in jerry-esp folder.\nsudo python ESP8266_RTOS_SDK/components/esptool_py/esptool/esptool.py \\\n  --port /dev/ttyUSB0 \\\n  --baud 460800 \\\n  --before default_reset \\\n  --after hard_reset \\\n  write_flash \\\n  --flash_mode dio \\\n  --flash_freq 40m \\\n  --flash_size 2MB \\\n  0x0 jerryscript/build/esp8266-rtos-sdk/bootloader/bootloader.bin \\\n  0x8000 jerryscript/build/esp8266-rtos-sdk/partition_table/partition-table.bin \\\n  0x10000 jerryscript/build/esp8266-rtos-sdk/jerryscript.bin\n```\n\n#### 5. Connect to the device\n\nESP8266-RTOS-SDK provides a Python script for serial communication.\nOther programs also can be used such as minicom, picocom, etc.\n\n* The device should be visible as `/dev/ttyUSB0`\n* The device uses `74880` baud rate for serial communication\n* Press `CTRL` + `ALT` + `]` to exit monitor program\n\n```sh\n# Assuming you are in jerry-esp folder.\nsudo PATH=${PWD}/xtensa-lx106-elf/bin:$PATH ESP8266_RTOS_SDK/tools/idf_monitor.py \\\n  --port /dev/ttyUSB0 \\\n  --baud 78880 \\\n  --toolchain-prefix=xtensa-lx106-elf- \\\n  jerryscript/build/esp8266-rtos-sdk/jerryscript.elf\n```\n\nThe following output should be captured:\n\n```\nI (43) boot: ESP-IDF v3.4-43-ge9516e4c 2nd stage bootloader\nI (43) boot: compile time 11:14:06\nI (43) qio_mode: Enabling default flash chip QIO\nI (51) boot: SPI Speed      : 40MHz\nI (57) boot: SPI Mode       : QIO\nI (63) boot: SPI Flash Size : 2MB\nI (69) boot: Partition Table:\nI (75) boot: ## Label            Usage          Type ST Offset   Length\nI (86) boot:  0 nvs              WiFi data        01 02 00009000 00006000\nI (97) boot:  1 phy_init         RF data          01 01 0000f000 00001000\nI (108) boot:  2 factory          factory app      00 00 00010000 000f0000\nI (120) boot: End of partition table\nI (126) esp_image: segment 0: paddr=0x00010010 vaddr=0x40210010 size=0x5c540 (378176) map\n0x40210010: _stext at ??:?\n\nI (140) esp_image: segment 1: paddr=0x0006c558 vaddr=0x4026c550 size=0x0baa8 ( 47784) map\nI (153) esp_image: segment 2: paddr=0x00078008 vaddr=0x3ffe8000 size=0x0042c (  1068) load\nI (167) esp_image: segment 3: paddr=0x0007843c vaddr=0x40100000 size=0x00080 (   128) load\nI (181) esp_image: segment 4: paddr=0x000784c4 vaddr=0x40100080 size=0x0484c ( 18508) load\nI (194) boot: Loaded app from partition at offset 0x10000\nI (215) JS: This test run the following script code: \nI (216) JS: print ('Hello, World!');\nHello, World!\n```\n"
  },
  {
    "path": "targets/baremetal-sdk/espressif/main/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\ncmake_minimum_required(VERSION 3.5)\n\n# Set JerryScript variables\nset(JERRY_ROOT_DIR ${PROJECT_DIR}/../../..)\nset(JERRY_BUILD_DIR ${JERRY_ROOT_DIR}/build/jerry)\nset(JERRY_INCLUDE_DIRS \"${JERRY_ROOT_DIR}/jerry-ext/include\" \"${JERRY_ROOT_DIR}/jerry-core/include\")\nset(JERRY_HEAP_SIZE 20)\n\n# Make compile flags separated by spaces\nstring(REPLACE \";\" \" \" COMPILE_FLAGS \"${COMPILE_OPTIONS};${C_COMPILE_OPTIONS}\")\n\n# Build JerryScript\nexecute_process(COMMAND ${JERRY_ROOT_DIR}/tools/build.py\n                            --clean\n\t\t                    --builddir=${JERRY_BUILD_DIR}\n                            --lto=OFF\n                            --jerry-cmdline=OFF\n                            --jerry-math=OFF\n                            --amalgam=ON\n                            --mem-heap=${JERRY_HEAP_SIZE}\n                            --profile=es.next\n                            --compile-flag=${COMPILE_FLAGS}\n                            --toolchain=${CMAKE_TOOLCHAIN_FILE})\n\n# Register JerryScript target application\nidf_component_register(SRCS \"jerry-main.c\" \"jerry-port.c\" INCLUDE_DIRS ${JERRY_INCLUDE_DIRS})\n\nadd_library(jerry-core STATIC IMPORTED)\nadd_library(jerry-ext STATIC IMPORTED)\nadd_library(jerry-port STATIC IMPORTED)\n\nset_target_properties(jerry-core PROPERTIES IMPORTED_LOCATION \"${JERRY_BUILD_DIR}/lib/libjerry-core.a\")\nset_target_properties(jerry-ext PROPERTIES IMPORTED_LOCATION \"${JERRY_BUILD_DIR}/lib/libjerry-ext.a\")\nset_target_properties(jerry-port PROPERTIES IMPORTED_LOCATION \"${JERRY_BUILD_DIR}/lib/libjerry-port.a\")\n\n# jerry-core has espressif/main/jerry-port.c as dependency\ntarget_link_libraries(jerry-core INTERFACE ${COMPONENT_LIB})\n# jerry-main has jerry-core, jerry-ext, jerry-port as dependencies\ntarget_link_libraries(${COMPONENT_LIB} INTERFACE jerry-core jerry-ext jerry-port)\n"
  },
  {
    "path": "targets/baremetal-sdk/espressif/main/jerry-main.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n\n/**\n * Jerryscript simple test\n */\nvoid app_main()\n{\n  jerry_value_t ret_value = jerry_undefined ();\n  const jerry_char_t script[] = \"print ('Hello, World!');\";\n\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n  jerry_log_set_level (JERRY_LOG_LEVEL_DEBUG);\n  jerry_log (JERRY_LOG_LEVEL_DEBUG, \"This test run the following script code: %s\", script);\n\n  /* Register the print function in the global object */\n  jerryx_register_global (\"print\", jerryx_handler_print);\n\n  /* Setup Global scope code */\n  ret_value = jerry_parse (script, sizeof (script) - 1, NULL);\n\n  if (!jerry_value_is_exception (ret_value))\n  {\n    /* Execute the parsed source code in the Global scope */\n    ret_value = jerry_run (ret_value);\n  }\n\n  if (jerry_value_is_exception (ret_value))\n  {\n    jerry_log (JERRY_LOG_LEVEL_DEBUG, \"Script error...\\n\\n\");\n  }\n\n  jerry_value_free (ret_value);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n} /* test_jerry */\n"
  },
  {
    "path": "targets/baremetal-sdk/espressif/main/jerry-port.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdlib.h>\n#include <string.h>\n#include <sys/stat.h>\n#include <sys/time.h>\n#include <sys/types.h>\n#include <unistd.h>\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"esp_log.h\"\n#include \"esp_system.h\"\n#include \"freertos/FreeRTOS.h\"\n#include \"freertos/task.h\"\n\nstatic const char ESP_JS_TAG[] = \"JS\";\n\nvoid\njerry_port_log (const char *message_p)\n{\n  ESP_LOGI (ESP_JS_TAG, \"%s\", message_p);\n} /* jerry_port_log */\n\nvoid\njerry_port_fatal (jerry_fatal_code_t code)\n{\n  ESP_LOGE (ESP_JS_TAG, \"Fatal error: %d\", code);\n  vTaskSuspend (NULL);\n  abort ();\n} /* jerry_port_fatal */\n\nint32_t\njerry_port_local_tza (double unix_ms)\n{\n  struct tm tm;\n  char buf[8];\n  time_t now = (time_t) unix_ms / 1000;\n\n  localtime_r (&now, &tm);\n  strftime (buf, 8, \"%z\", &tm);\n  return -atoi (buf) * 3600 * 1000 / 100;\n} /* jerry_port_local_tza */\n\ndouble\njerry_port_current_time (void)\n{\n  struct timeval tv;\n\n  if (gettimeofday (&tv, NULL) == 0)\n  {\n    return ((double) tv.tv_sec) * 1000.0 + ((double) tv.tv_usec) / 1000.0;\n  }\n  return 0.0;\n} /* jerry_port_current_time */\n"
  },
  {
    "path": "targets/baremetal-sdk/particle/Makefile.particle",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nPARTICLE_FIRMWARE := $(CURDIR)/../particle/firmware\n\nJERRYDIR ?= $(CURDIR)\nJERRYHEAP  ?= 16\n\nBUILD_DIR  ?= $(JERRYDIR)/build/particle\n\nEXT_CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4\nEXT_CFLAGS += -Wno-error=format=\n\n.PHONY: jerrycore jerry-main flash clean\n\nPARTICLE_BUILD_CONFIG = \\\n\t INCLUDE_DIRS=$(JERRYDIR)/jerry-core/include \\\n\t LIBS=jerry-core \\\n\t PLATFORM=photon \\\n\t LIB_DIRS=$(BUILD_DIR)/lib \\\n\t APPDIR=$(JERRYDIR)/targets/baremetal-sdk/particle/source \\\n\t TARGET_FILE=jerry_main \\\n\t TARGET_DIR=$(BUILD_DIR) \\\n\t LDFLAGS=--specs=nano.specs\n\nall: jerrycore jerry-main\n\njerrycore:\n\tmkdir -p $(BUILD_DIR)\n\tcmake -B$(BUILD_DIR) -H./ \\\n\t -DCMAKE_SYSTEM_NAME=MCU \\\n\t -DCMAKE_SYSTEM_PROCESSOR=armv7l \\\n\t -DCMAKE_C_COMPILER=arm-none-eabi-gcc \\\n\t -DCMAKE_C_COMPILER_WORKS=TRUE \\\n\t -DENABLE_LTO=ON \\\n\t -DJERRY_CMDLINE=OFF \\\n\t -DJERRY_PROFILE=minimal \\\n\t -DENABLE_STRIP=OFF \\\n\t -DEXTERNAL_COMPILE_FLAGS=\"$(EXT_CFLAGS)\" \\\n\t -DJERRY_GLOBAL_HEAP_SIZE=$(JERRYHEAP)\n\n\tmake -C$(BUILD_DIR) jerry-core\n\njerry-main: jerrycore\n\t$(PARTICLE_BUILD_CONFIG) make -C$(PARTICLE_FIRMWARE) -f $(PARTICLE_FIRMWARE)/makefile\n\nflash:\n\t$(PARTICLE_BUILD_CONFIG) make -C$(PARTICLE_FIRMWARE)/main -f $(PARTICLE_FIRMWARE)/main/makefile program-dfu\n\nclean:\n\t$(PARTICLE_BUILD_CONFIG) make -C$(PARTICLE_FIRMWARE) -f $(PARTICLE_FIRMWARE)/makefile clean\n\trm -rf $(BUILD_DIR)\n"
  },
  {
    "path": "targets/baremetal-sdk/particle/README.md",
    "content": "### About\n\nThis folder contains files to run JerryScript beside Particle Device Firmware on Photon board.\nIt  runs a mini example, blinking an LED which is the \"Hello World\" example of the microcontroller universe.\n\n### How to build\n\n#### 1. Preface / Directory structure\n\nAssume `root` as the path to the projects to build.\nThe folder tree related would look like this.\n\n```\nroot\n  + jerryscript\n  |  + targets\n  |      + os\n  |        + particle\n  + particle\n  |  + firmware\n```\n\n\n#### 2, Update/Install the Particle Firmware\n\nFor detailed descriptions please visit the official website of the firmware: https://www.particle.io/\n\nYou can checkout the firmware with the following command:\n\n```\n# assume you are in root folder\ngit clone https://github.com/spark/firmware.git particle/firmware\n````\n\nThe Photon’s latest firmware release is hosted in the latest branch of the firmware repo.\n\n```\n# assume you are in root folder\ncd particle/firmware\ngit checkout latest\n```\n\nBefore you type any commands, put your Photon in DFU mode: hold down both the SETUP and RESET buttons. Then release RESET, but hold SETUP until you see the RGB blink yellow. That means the Photon is in DFU mode. To verify that the Photon is in DFU mode and dfu-util is installed properly, try the dfu-util -l command. You should see the device, and the important parts there are the hex values inside the braces – the USB VID and PID, which should be 2b04 and d006 for the Photon.\n\nTo build and flash the firmware: switch to the modules directory then call make with a few parameters to build and upload the firmware:\n\n```\ncd modules\nmake PLATFORM=photon clean all program-dfu\n```\n\n#### 3. Build JerryScript\n\n```\n# assume you are in root folder\ncd jerryscript\nmake -f ./targets/baremetal-sdk/particle/Makefile.particle\n```\n\nThis will create a binary file in the `/build/particle/` folder:\n```\njerry_main.bin\n```\n\nThat’s the binary what we’ll be flashing with dfu-util.\n\n\n#### 4. Flashing\n\nMake sure you put your Photon in DFU mode.\nAlternatively, you can make your life a bit easier by using the make command to invoke dfu-util:\n\n```\nmake -f targets/baremetal-sdk/particle/Makefile.particle flash\n```\n\nYou can also use this dfu-util command directly to upload your BIN file to the Photon’s application memory:\n\n```\ndfu-util -d 2b04:d006 -a 0 -i 0 -s 0x80A0000:leave -D build/particle/jerry_main.bin\n```\n\n#### 5. Cleaning\n\nTo clean the build result:\n```\nmake -f targets/baremetal-sdk/particle/Makefile.particle clean\n```\n\n### Running the example\n\nThe example program will blinks the D7 led periodically after the flash."
  },
  {
    "path": "targets/baremetal-sdk/particle/source/main.cpp",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"application.h\"\n#include \"jerryscript.h\"\n\nSYSTEM_MODE (MANUAL);\n\n/**\n * Set led value\n */\nstatic jerry_value_t\nset_led  (const jerry_value_t func_value, /**< function object */\n          const jerry_value_t this_value, /**< this arg */\n          const jerry_value_t *args_p, /**< function arguments */\n          const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  if (args_cnt != 2)\n  {\n    Serial.println (\"Wrong arguments count in 'test.setLed' function.\");\n    return jerry_boolean (false);\n  }\n\n  int ledPin = jerry_value_as_number (args_p[0]);\n  bool value = jerry_value_is_true (args_p[1]);\n\n  pinMode (ledPin, OUTPUT);\n  digitalWrite (ledPin, value);\n\n  return jerry_boolean (true);\n} /* set_led */\n\n/**\n * Delay function\n */\nstatic jerry_value_t\njs_delay (const jerry_value_t func_value, /**< function object */\n          const jerry_value_t this_value, /**< this arg */\n          const jerry_value_t *args_p, /**< function arguments */\n          const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  if (args_cnt != 1)\n  {\n    Serial.println (\"Wrong arguments count in 'test.delay' function.\");\n    return jerry_boolean (false);\n  }\n\n  int millisec = jerry_value_as_number (args_p[0]);\n\n  delay (millisec);\n\n  return jerry_boolean (true);\n} /* js_delay */\n\n/*\n * Init available js functions\n */\nstatic void\ninit_jerry ()\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Create an empty JS object */\n  jerry_value_t object = jerry_object ();\n\n  jerry_value_t func_obj;\n  jerry_value_t prop_name;\n\n  func_obj = jerry_function_external (set_led);\n  prop_name = jerry_string_sz (\"setLed\");\n  jerry_value_free (jerry_object_set (object, prop_name, func_obj));\n  jerry_value_free (prop_name);\n  jerry_value_free (func_obj);\n\n  func_obj = jerry_function_external (js_delay);\n  prop_name = jerry_string_sz (\"delay\");\n  jerry_value_free (jerry_object_set (object, prop_name, func_obj));\n  jerry_value_free (prop_name);\n  jerry_value_free (func_obj);\n\n  /* Wrap the JS object (not empty anymore) into a jerry api value */\n  jerry_value_t global_object = jerry_current_realm ();\n\n  /* Add the JS object to the global context */\n  prop_name = jerry_string_sz (\"test\");\n  jerry_value_free (jerry_object_set (global_object, prop_name, object));\n  jerry_value_free (prop_name);\n  jerry_value_free (object);\n  jerry_value_free (global_object);\n} /* init_jerry */\n\n/**\n * Jerryscript simple test\n */\nstatic void\ntest_jerry ()\n{\n  const jerry_char_t script[] = \" \\\n    test.setLed(7, true); \\\n    test.delay(250); \\\n    test.setLed(7, false); \\\n    test.delay(250); \\\n  \";\n\n  jerry_value_t eval_ret = jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);\n\n  /* Free JavaScript value, returned by eval */\n  jerry_value_free (eval_ret);\n} /* test_jerry */\n\n/**\n * Setup code for particle firmware\n */\nvoid\nsetup ()\n{\n  Serial.begin (9600);\n  delay (2000);\n  Serial.println (\"Beginning Listening mode test!\");\n} /* setup */\n\n/**\n * Loop code for particle firmware\n */\nvoid\nloop ()\n{\n  init_jerry ();\n\n  /* Turn on and off the D7 LED */\n  test_jerry ();\n\n  jerry_cleanup ();\n} /* loop */\n"
  },
  {
    "path": "targets/os/mbedos/.gitignore",
    "content": ".mbed\n"
  },
  {
    "path": "targets/os/mbedos/Makefile",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# default board: FRDM-K64F\nBOARD ?= K64F\n\n# defult toolchain\nTOOLCHAIN ?= GCC_ARM\n\n# path to jerryscript/targets/os/mbedos5\nJERRY_TARGET_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))\n\n# path to the root jerryscript directory\nJERRY_ROOT_DIR = $(realpath $(JERRY_TARGET_DIR)/../../..)\n\n# default build path\nBUILD_DIR ?= $(JERRY_ROOT_DIR)/build/mbed-os\n\n# default jerry heap size (in KB)\nJERRY_HEAP_SIZE ?= 70\n\ndefine MBED_CLI_FLAGS\n\t--clean\n\t--mbed-os-path $(MBED_OS_DIR)\n\t--program-path $(JERRY_ROOT_DIR)\n\t--toolchain $(TOOLCHAIN)\n\t--mbed-target $(BOARD)\n\t--app-config $(JERRY_ROOT_DIR)/mbed_lib.json\nendef\n\n.PHONY: all\nall: .build\n\n.PHONY: clean\nclean: .extra-files-remove\n\trm -rf $(JERRY_ROOT_DIR)/build/mbed-os\n\n.PHONY: flash\nflash: .mbed-set-flash-flag .build\n\n.PHONY: .mbed-set-flash-flag\n.mbed-set-flash-flag:\n\t$(eval MBED_CLI_FLAGS += --flash)\n\n.PHONY: .build\n.build: .extra-files-copy .mbed-build .extra-files-remove\n\n.PHONY: .mbed-build\n.mbed-build:\n\tmbed-tools compile $(strip $(MBED_CLI_FLAGS))\n\n.PHONY: .extra-files-copy\n.extra-files-copy:\n\tcp mbedignore.txt $(JERRY_ROOT_DIR)/.mbedignore\n\tcp mbed_lib.json $(JERRY_ROOT_DIR)/mbed_lib.json\n\n.PHONY: .extra-files-remove\n.extra-files-remove:\n\trm -f $(JERRY_ROOT_DIR)/.mbedignore\n\trm -f $(JERRY_ROOT_DIR)/mbed_lib.json\n"
  },
  {
    "path": "targets/os/mbedos/Makefile.travis",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\n# Default target for running the build test outside the Travis CI environment.\nall:\n\t$(MAKE) install\n\t$(MAKE) script\n\n\n## Targets for installing build dependencies of the Mbed OS JerryScript target.\n\ninstall-mbedos:\n\tgit clone https://github.com/ARMmbed/mbed-os.git ../mbed-os -b mbed-os-6.17.0\n\n# Deploy Mbed and install Mbed Python dependencies.\ninstall-mbedos-deps:\n\tpip3 install --upgrade pip\n\tpip3 install mbed-tools setuptools\n\tpip3 install -r ../mbed-os/requirements.txt\n\ninstall: install-mbedos install-mbedos-deps\n\n## Targets for building Mbed OS with JerryScript.\n\n# Build the firmware (Mbed OS with JerryScript).\nscript:\n\t$(MAKE) -C targets/os/mbedos MBED_OS_DIR=$(realpath ../mbed-os)\n"
  },
  {
    "path": "targets/os/mbedos/README.md",
    "content": "### About\n\nThis folder contains files to run JerryScript on\n[FRDM-K64F board](https://os.mbed.com/platforms/frdm-k64f/) with\n[Mbed OS](https://os.mbed.com/).\nThe document had been validated on Ubuntu 20.04 operating system.\n\n#### 1. Setup the build environment\n\nClone the necessary projects into a `jerry-mbedos` directory.\nThe latest tested working version of Mbed is `mbed-os-6.15.0`.\n\n```sh\nmkdir jerry-mbedos && cd jerry-mbedos\n\ngit clone https://github.com/jerryscript-project/jerryscript.git\ngit clone https://github.com/ARMmbed/mbed-os.git -b mbed-os-6.15.0\n```\n\nThe following directory structure has been created:\n\n```\njerry-mbedos\n  + jerryscript\n  |  + targets\n  |      + os\n  |        + mbedos\n  + mbed-os\n```\n\n#### 2. Install dependencies of the projects\n\n```sh\n# Assuming you are in jerry-mbedos folder.\njerryscript/tools/apt-get-install-deps.sh\n\nsudo apt install stlink-tools\npip install --user mbed-cli\n# Install Python dependencies of Mbed OS.\npip install --user -r mbed-os/requirements.txt\n```\n\n#### 3. Build Mbed OS (with JerryScript)\n\n```\n# Assuming you are in jerry-mbedos folder.\nmake -C jerryscript/targets/os/mbedos MBED_OS_DIR=${PWD}/mbed-os\n```\n\nThe created binary is a `mbedos.bin` named file located in `jerryscript/build/mbed-os` folder.\n\n#### 4. Flash\n\nConnect Micro-USB for charging and flashing the device.\n\n```\n# Assuming you are in jerry-mbedos folder.\nmake -C jerryscript/targets/os/mbedos MBED_OS_DIR=${PWD}/mbed-os flash\n```\n\n#### 5. Connect to the device\n\nThe device should be visible as `/dev/ttyACM0` on the host.\nYou can use `minicom` communication program with `115200` baud rate.\n\n```sh\nsudo minicom --device=/dev/ttyACM0 --baud=115200\n```\n\nSet `Add Carriage Ret` option in `minicom` by `CTRL-A -> Z -> U` key combinations.\nPress `RESET` on the board to get the output of JerryScript application:\n\n```\nThis test run the following script code: [print ('Hello, World!');]\n\nHello, World!\n```\n"
  },
  {
    "path": "targets/os/mbedos/jerry-main.cpp",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n#include \"mbed.h\"\n\n/**\n * Standalone Jerry exit codes\n */\n#define JERRY_STANDALONE_EXIT_CODE_OK   (0)\n#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)\n\n#if MBED_MAJOR_VERSION == 5\nstatic Serial serial(USBTX, USBRX, 115200);\n#elif MBED_MAJOR_VERSION == 6\nstatic BufferedSerial serial(USBTX, USBRX, 115200);\n#else\n#error Unsupported Mbed OS version.\n#endif\n\nint main()\n{\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t script[] = \"print ('Hello, World!');\";\n  jerry_log (JERRY_LOG_LEVEL_DEBUG, \"This test run the following script code: [%s]\\n\\n\", script);\n\n  /* Register the print function in the global object. */\n  jerryx_register_global (\"print\", jerryx_handler_print);\n\n  /* Setup Global scope code */\n  jerry_value_t ret_value = jerry_parse (script, sizeof (script) - 1, NULL);\n\n  if (!jerry_value_is_exception (ret_value))\n  {\n    /* Execute the parsed source code in the Global scope */\n    ret_value = jerry_run (ret_value);\n  }\n\n  int ret_code = JERRY_STANDALONE_EXIT_CODE_OK;\n\n  if (jerry_value_is_exception (ret_value))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"[Error] Script Error!\");\n\n    ret_code = JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  jerry_value_free (ret_value);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return ret_code;\n}\n"
  },
  {
    "path": "targets/os/mbedos/jerry-port.cpp",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n\n#include \"jerryscript-port.h\"\n\n#include \"mbed.h\"\n\nvoid\njerry_port_fatal (jerry_fatal_code_t code)\n{\n  exit ((int) code);\n} /* jerry_port_fatal */\n\nvoid\njerry_port_log (const char *message_p)\n{\n  while (*message_p != '\\0')\n  {\n    if (*message_p == '\\n')\n    {\n      /* add CR for proper display in serial monitors */\n      fputc ('\\r', stderr);\n    }\n\n    fputc (*message_p++, stderr);\n  }\n} /* jerry_port_log */\n\nint32_t\njerry_port_local_tza (double unix_ms)\n{\n  (void) unix_ms;\n\n  return 0;\n} /* jerry_port_local_tza */\n\ndouble\njerry_port_current_time (void)\n{\n  static uint64_t last_tick = 0;\n  static time_t last_time = 0;\n  static uint32_t skew = 0;\n\n  uint64_t curr_tick = us_ticker_read (); /* The value is in microseconds. */\n  time_t curr_time = time (NULL); /*  The value is in seconds. */\n  double result = curr_time * 1000;\n\n  /* The us_ticker_read () has an overflow for each UINT_MAX microseconds\n   * (~71 mins). For each overflow event the ticker-based clock is about 33\n   * milliseconds fast. Without a timer thread the milliseconds part of the\n   * time can be corrected if the difference of two get_current_time calls\n   * are within the mentioned 71 mins. Above that interval we can assume\n   * that the milliseconds part of the time is negligibe.\n   */\n  if (curr_time - last_time > (time_t) (((uint32_t) -1) / 1000000))\n  {\n    skew = 0;\n  }\n  else if (last_tick > curr_tick)\n  {\n    skew = (skew + 33) % 1000;\n  }\n  result += (curr_tick / 1000 - skew) % 1000;\n\n  last_tick = curr_tick;\n  last_time = curr_time;\n  return result;\n} /* jerry_port_current_time */\n"
  },
  {
    "path": "targets/os/mbedos/mbed_lib.json",
    "content": "{\n  \"name\": \"jerry\",\n  \"macros\": [\"JERRY_GLOBAL_HEAP_SIZE=70\"]\n}\n"
  },
  {
    "path": "targets/os/mbedos/mbedignore.txt",
    "content": "cmake/*\ndocs/*\njerry-main/*\njerry-math/*\ntargets/*\ntests/*\nthird-party/*\ntools/*\n"
  },
  {
    "path": "targets/os/nuttx/.gitignore",
    "content": "# Files generated / copied by the NuttX build\n.built\n.depend\nMake.dep\n*.c.obj\n*.o\n*.a\n"
  },
  {
    "path": "targets/os/nuttx/Kconfig",
    "content": "#\n# For a description of the syntax of this configuration file,\n# see the file kconfig-language.txt in the NuttX tools repository.\n#\n\nconfig INTERPRETERS_JERRYSCRIPT\n\tbool \"Jerryscript JavaScript engine\"\n\tdefault n\n\nif INTERPRETERS_JERRYSCRIPT\n\nconfig INTERPRETERS_JERRYSCRIPT_PRIORITY\n\tint \"Jerryscript priority\"\n\tdefault 100\n\nconfig INTERPRETERS_JERRYSCRIPT_STACKSIZE\n\tint \"Jerryscript stack size\"\n\tdefault 16384\n\nendif # INTERPRETERS_JERRYSCRIPT\n"
  },
  {
    "path": "targets/os/nuttx/Make.defs",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nifeq ($(CONFIG_INTERPRETERS_JERRYSCRIPT),y)\nCONFIGURED_APPS += $(APPDIR)/interpreters/jerryscript\nendif\n"
  },
  {
    "path": "targets/os/nuttx/Makefile",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ninclude $(APPDIR)/Make.defs\n\n# Jerryscript built-in application information.\nPROGNAME  = jerry\nPRIORITY  = $(CONFIG_INTERPRETERS_JERRYSCRIPT_PRIORITY)\nSTACKSIZE = $(CONFIG_INTERPRETERS_JERRYSCRIPT_STACKSIZE)\n\n# Path to the JerryScript and NuttX projects. If not specified, it is\n# supposed that JerryScript is located next to the nuttx folder.\nJERRYSCRIPT_ROOT_DIR ?= $(abspath ../../../../jerryscript)\nNUTTX_INCLUDE_DIR ?= $(abspath $(JERRYSCRIPT_ROOT_DIR)/../nuttx/include)\n\nCFLAGS += -std=c99\nCFLAGS += -I$(JERRYSCRIPT_ROOT_DIR)/jerry-core/include\nCFLAGS += -I$(JERRYSCRIPT_ROOT_DIR)/jerry-ext/include\nCFLAGS += -I$(JERRYSCRIPT_ROOT_DIR)/jerry-math/include\n\n# These libs should be copied from the JerryScript project.\nLIBS = libjerry-core.a libjerry-ext.a libjerry-math.a libjerry-port.a\n\nASRCS = setjmp.S\nCSRCS = jerry-port.c\nMAINSRC = jerry-main.c\n\n.PHONY: copylibs\ncopylibs:\n\tcp $(JERRYSCRIPT_ROOT_DIR)/build/lib/lib*.a .\n\n$(LIBS): copylibs\n\t$(firstword $(AR)) x $@\n\n.PHONY: updateobjs\nupdateobjs:\n\t$(eval OBJS += $(shell find . -name \"*.obj\"))\n\n.PHONY: cleanlibs\ncleanlibs: updateobjs\n\trm -f $(OBJS)\n\n.PHONY: libjerry\nlibjerry:\n\t$(JERRYSCRIPT_ROOT_DIR)/tools/build.py \\\n\t\t--clean \\\n\t\t--lto=OFF \\\n\t\t--jerry-cmdline=OFF \\\n\t\t--jerry-math=ON \\\n\t\t--amalgam=ON \\\n\t\t--mem-heap=70 \\\n\t\t--profile=es.next \\\n\t\t--compile-flag=\"-I${NUTTX_INCLUDE_DIR}\" \\\n\t\t--toolchain=$(abspath $(JERRYSCRIPT_ROOT_DIR)/cmake/toolchain_mcu_stm32f4.cmake)\n\nclean:: cleanlibs\n\narchive: libjerry $(LIBS) updateobjs\n\ninclude $(APPDIR)/Application.mk\n"
  },
  {
    "path": "targets/os/nuttx/Makefile.travis",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\n# Default target for running the build test outside the Travis CI environment.\nall:\n\t$(MAKE) install\n\t$(MAKE) script\n\n\n## Targets for installing build dependencies of the NuttX JerryScript target.\n\n# Install cross-compiler and tools via apt.\ninstall-apt-get-deps:\n\tsudo apt-get install -q -y gcc-arm-none-eabi gperf\n\n# Fetch and build kconfig-frontends (kconfig-conf) from nuttx/tools.\nLOCAL_INSTALL:=$(CURDIR)/../local/\n\ninstall-kconfig:\n\tgit clone https://bitbucket.org/nuttx/tools.git ../tools\n\tmkdir -p $(LOCAL_INSTALL)\n\t# FIXME: 'autoreconf --force --install' is a workaround after\n\t#        https://bitbucket.org/nuttx/tools/commits/164450f982b404fdc2b3233db51dc3eaa1f08b7f\n\tcd ../tools/kconfig-frontends && autoreconf --force --install && ./configure --disable-mconf --disable-nconf --disable-gconf --disable-qconf --disable-shared --enable-static --prefix=$(LOCAL_INSTALL)\n\t$(MAKE) -C ../tools/kconfig-frontends\n\t$(MAKE) -C ../tools/kconfig-frontends install\n\n# Fetch nuttx/{apps,nuttx} repositories.\ninstall-clone-nuttx:\n\tgit clone https://github.com/apache/incubator-nuttx-apps.git ../apps -b releases/10.2\n\tgit clone https://github.com/apache/incubator-nuttx.git ../nuttx -b releases/10.2\n\n# Perform all the necessary (JerryScript-independent) installation steps.\ninstall-noapt: install-kconfig install-clone-nuttx\ninstall: install-apt-get-deps install-noapt\n\n\n## Targets for building NuttX with JerryScript.\n\n# Link in the NuttX JerryScript target directory under the NuttX apps tree.\nscript-add-jerryscript-app:\n\tln -s ../../jerryscript/targets/os/nuttx ../apps/interpreters/jerryscript\n\n# Configure USB shell.\nscript-configure-usbnsh:\n\tcd ../nuttx/tools && PATH=$(LOCAL_INSTALL)/bin:$$PATH ./configure.sh stm32f4discovery:usbnsh\n\n# Configure and build the firmware (NuttX with JerryScript).\nscript: script-add-jerryscript-app script-configure-usbnsh\n\techo 'CONFIG_ARCH_FPU=y' >> ../nuttx/.config\n\techo 'CONFIG_SCHED_ONEXIT=y' >> ../nuttx/.config\n\techo 'CONFIG_INTERPRETERS_JERRYSCRIPT=y'>> ../nuttx/.config\n\tPATH=$(LOCAL_INSTALL)/bin:$$PATH $(MAKE) -C ../nuttx olddefconfig\n\tPATH=$(LOCAL_INSTALL)/bin:$$PATH $(MAKE) -C ../nuttx\n"
  },
  {
    "path": "targets/os/nuttx/README.md",
    "content": "### About\n\nThis folder contains files to run JerryScript on\n[STM32F4-Discovery board](https://www.st.com/en/evaluation-tools/stm32f4discovery.html) with\n[NuttX](https://nuttx.apache.org/).\nThe document had been validated on Ubuntu 20.04 operating system.\n\n### How to build\n\n#### 1. Setup the build environment for STM32F4-Discovery board\n\nClone the necessary projects into a `jerry-nuttx` directory.\nThe latest tested working version of NuttX is 10.2.\n\n```sh\n# Create a base folder for all the projects.\nmkdir jerry-nuttx && cd jerry-nuttx\n\ngit clone https://github.com/jerryscript-project/jerryscript.git\ngit clone https://github.com/apache/incubator-nuttx.git nuttx -b releases/10.2\ngit clone https://github.com/apache/incubator-nuttx-apps.git apps -b releases/10.2\ngit clone https://bitbucket.org/nuttx/tools.git tools\ngit clone https://github.com/texane/stlink.git -b v1.5.1-patch\n```\n\nThe following directory structure is created after these commands:\n\n```\njerry-nuttx\n  + jerryscript\n  |  + targets\n  |      + os\n  |        + nuttx\n  + nuttx\n  + apps\n  + tools\n  + stlink\n```\n\n#### 2. Install dependencies of the projects\n\n```sh\n# Assuming you are in jerry-nuttx folder.\njerryscript/tools/apt-get-install-deps.sh\n\n# Toolchain dependencies of NuttX.\nsudo apt install gcc-arm-none-eabi binutils-arm-none-eabi\n\n# Tool dependencies of NuttX.\nsudo apt install \\\n    bison flex gettext texinfo libncurses5-dev libncursesw5-dev \\\n    gperf automake libtool pkg-config build-essential gperf genromfs \\\n    libgmp-dev libmpc-dev libmpfr-dev libisl-dev binutils-dev libelf-dev \\\n    libexpat-dev gcc-multilib g++-multilib picocom u-boot-tools util-linux\n\n# ST-Link and serial communication dependencies.\nsudo apt install libusb-1.0-0-dev minicom\n```\n\n#### 3. Copy JerryScript's application files to NuttX\n\nMove JerryScript application files to `apps/interpreters/jerryscript` folder.\n\n```sh\n# Assuming you are in jerry-nuttx folder.\nmkdir -p apps/interpreters/jerryscript\ncp jerryscript/targets/os/nuttx/* apps/interpreters/jerryscript/\n\n# Or more simply:\n# ln -s jerryscript/targets/os/nuttx apps/interpreters/jerryscript\n```\n\n#### 4. Build kconfig-frontend to configure NuttX\n\nSkip this section if `kconfig-frontends` had alrady been installed by package manager.\n\n```sh\n# Assuming you are in jerry-nuttx folder.\ncd tools/kconfig-frontends\n\n./configure \\\n    --disable-nconf \\\n    --disable-gconf \\\n    --disable-qconf \\\n    --disable-shared \\\n    --enable-static \\\n    --prefix=${PWD}/install\n\nmake\nmake install\n# Add install folder to PATH\nPATH=${PWD}/install/bin:$PATH\n```\n\n#### 5. Configure NuttX\n\nConfigure NuttX for serial communication. A `.config` file contains all the options for the build.\n\n```sh\n# Assuming you are in jerry-nuttx folder.\ncd nuttx/tools\n\n# Configure NuttX to use USB console shell.\n./configure.sh stm32f4discovery:usbnsh\n```\n\nBy default, JerryScript is disabled so it is needed to modify the configuration file. It can\nbe done by using menuconfig (section 5.1) or modifying the `.config` file directly (section 5.2).\n\n##### 5.1 Enable JerryScript using menuconfig\n\n```sh\n# Assuming you are in jerry-nuttx folder.\n# Might be required to run `make menuconfig` twice.\nmake -C nuttx menuconfig\n```\n\n* Enable `System Type -> FPU support`\n* Enable `Application Configuration -> Interpreters -> JerryScript`\n\n[Optional] Enabling ROMFS helps to flash JavaScript input files to the device's flash memory.\n\n* Enable `File systems -> ROMFS file system`\n* Enable `Application configuration -> NSH library -> Scripting Support -> Support ROMFS start-up script`\n\n[Optional] Enabling MMCSD helps to mount sd card on the device.\nNote: These options are for the micro-sd card slot of STM32F4-Discovery base-board.\n\n* Enable `System Type -> STM32 Peripheral Support -> SDIO`\n* Enable `RTOS Features -> Work queue support -> High priority (kernel) worker thread`\n* Enable `RTOS Features -> RTOS hooks -> Custom board late initialization`\n* Enable `RTOS Features -> RTOS hooks -> Enable on_exit() API`\n* Enable `Driver Support -> MMC/SD Driver Support`\n* Disable `Driver Support -> MMC/SD Driver Support -> MMC/SD write protect pin`\n* Disable `Driver Support -> MMC/SD Driver Support -> MMC/SD SPI transfer support`\n* Enable `Driver Support -> MMC/SD Driver Support -> MMC/SD SDIO transfer support`\n* Enable `File systems -> FAT file system`\n* Enable `File systems -> FAT file system -> FAT upper/lower names`\n* Enable `File systems -> FAT file system -> FAT long file names`\n\n##### 5.2 Enable JerryScript without user interaction\n\nA simpler solution is to append the necessary content to the `.config` configuration file:\n\n```sh\n# Assuming you are in jerry-nuttx folder.\ncat >> nuttx/.config << EOL\nCONFIG_ARCH_FPU=y\nCONFIG_SCHED_ONEXIT=y\nCONFIG_INTERPRETERS_JERRYSCRIPT=y\nCONFIG_INTERPRETERS_JERRYSCRIPT_PRIORITY=100\nCONFIG_INTERPRETERS_JERRYSCRIPT_STACKSIZE=16384\nEOL\n```\n\n[Optional] Enable ROM File System\n\n```sh\n# Assuming you are in jerry-nuttx folder.\ncat >> nuttx/.config << EOL\nCONFIG_BOARDCTL_ROMDISK=y\nCONFIG_FS_ROMFS=y\nCONFIG_NSH_ROMFSETC=y\nCONFIG_NSH_ROMFSMOUNTPT=\"/etc\"\nCONFIG_NSH_INITSCRIPT=\"init.d/rcS\"\nCONFIG_NSH_ROMFSDEVNO=0\nCONFIG_NSH_ROMFSSECTSIZE=64\nCONFIG_NSH_DEFAULTROMFS=y\nEOL\n```\n\n[Optional] Enable MMCSD driver and FAT File System\n\nNote: These options are for the micro-sd card slot of STM32F4-Discovery base-board.\n\n```sh\n# Assuming you are in jerry-nuttx folder.\ncat >> nuttx/.config << EOL\nCONFIG_STM32_SDIO=y\nCONFIG_STM32_SDIO_DMAPRIO=0x00010000\nCONFIG_MMCSD_HAVE_CARDDETECT=y\nCONFIG_BOARD_LATE_INITIALIZE=y\nCONFIG_BOARD_INITTHREAD_STACKSIZE=2048\nCONFIG_BOARD_INITTHREAD_PRIORITY=240\nCONFIG_SIG_SIGWORK=17\nCONFIG_SCHED_WORKQUEUE=y\nCONFIG_SCHED_HPWORK=y\nCONFIG_SCHED_HPNTHREADS=1\nCONFIG_SCHED_HPWORKPRIORITY=224\nCONFIG_SCHED_HPWORKSTACKSIZE=2048\nCONFIG_BCH=y\nCONFIG_ARCH_HAVE_SDIO=y\nCONFIG_ARCH_HAVE_SDIOWAIT_WRCOMPLETE=y\nCONFIG_ARCH_HAVE_SDIO_PREFLIGHT=y\nCONFIG_MMCSD=y\nCONFIG_MMCSD_NSLOTS=1\nCONFIG_MMCSD_MMCSUPPORT=y\nCONFIG_MMCSD_SDIO=y\nCONFIG_FS_FAT=y\nCONFIG_FAT_LCNAMES=y\nCONFIG_FAT_LFN=y\nCONFIG_FAT_MAXFNAME=32\nCONFIG_FAT_LFN_ALIAS_TRAILCHARS=0\nCONFIG_FSUTILS_MKFATFS=y\nCONFIG_NSH_MMCSDSLOTNO=0\nEOL\n```\n\n#### 6. Provide JavaScript files for STM32F4 device\n\n##### 6.1. Create ROMFS image from a custom folder\n\nSkip this section if MMCSD is used. Otherwise, generate a C header file from a custom folder.\nTry to minimize the size of the folder due to the limited capacity of flash memory.\n\n```sh\n# Assuming you are in jerry-nuttx folder.\nmkdir jerry-example\n# Let hello.js be a possible JavaScript input for JerryScript.\ncp jerryscript/tests/hello.js jerry-example\n\n# Generate ROMFS image from a custom folder.\ngenromfs -f romfs_img -d jerry-example\n\n# Dump image as C header file and override NuttX's default ROMFS file.\nxxd -i romfs_img apps/nshlib/nsh_romfsimg.h\n\n# Add const modifier to place the content to flash memory.\nsed -i \"s/unsigned/const\\ unsigned/g\" apps/nshlib/nsh_romfsimg.h\n```\n\n##### 6.2. Copy files to memory card\n\nSkip this section if ROMFS is used. Otherwise, copy your files to a FAT32 formatted memory card.\n\n#### 7. Build NuttX (with JerryScript)\n\n```sh\n# Assuming you are in jerry-nuttx folder.\nmake -C nuttx\n```\n\n#### 8. Flash the device\n\nConnect Mini-USB for charging and flasing the device.\n\n```sh\n# Assuming you are in jerry-nuttx folder.\nmake -C stlink release\n\nsudo stlink/build/Release/st-flash write nuttx/nuttx.bin 0x8000000\n```\n\n#### 9. Connect to the device\n\nConnect Micro-USB for serial communication. The device should be visible as `/dev/ttyACM0` on the host.\nYou can use `minicom` communication program with `115200` baud rate.\n\n```sh\nsudo minicom --device=/dev/ttyACM0 --baud=115200\n```\n\nSet `Add Carriage Ret` option in `minicom` by `CTRL-A -> Z -> U` key combinations.\nYou may have to press `RESET` on the board and press `Enter` key on the console several times to make `nsh` prompt visible.\nNuttShell (NSH) prompt looks like as follows:\n\n```\nNuttShell (NSH) NuttX-10.2.0\nnsh>\n```\n\n#### 10. Run JerryScript\n\n##### 10.1 Run `jerry` without input\n\n```\nNuttShell (NSH) NuttX-10.2.0\nnsh> jerry\nNo input files, running a hello world demo:\nHello world 5 times from JerryScript\n```\n\n##### 10.2 Run `jerry` with files from ROMFS\n\n```\nNuttShell (NSH) NuttX-10.2.0\nnsh> jerry /etc/hello.js\n```\n\n##### 10.3 Run `jerry` with files from memory card\n\nAfter NuttX has initialized, the card reader should be visible as `/dev/mmcsd0` on the device.\nMount it to be JavaScript files reachable.\n\n```\nNuttShell (NSH) NuttX-10.2.0\nnsh> mount -t vfat /dev/mmcsd0 /mnt\nnsh> jerry /mnt/hello.js\n```\n"
  },
  {
    "path": "targets/os/nuttx/jerry-main.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/debugger.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/print.h\"\n#include \"jerryscript-ext/properties.h\"\n#include \"jerryscript-ext/repl.h\"\n#include \"jerryscript-ext/sources.h\"\n#include \"setjmp.h\"\n\n/**\n * Maximum command line arguments number.\n */\n#define JERRY_MAX_COMMAND_LINE_ARGS (16)\n\n/**\n * Standalone Jerry exit codes.\n */\n#define JERRY_STANDALONE_EXIT_CODE_OK   (0)\n#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)\n\n/**\n * Context size of the SYNTAX_ERROR\n */\n#define SYNTAX_ERROR_CONTEXT_SIZE 2\n\n/**\n * Print usage and available options\n */\nstatic void\nprint_help (char *name)\n{\n  printf (\"Usage: %s [OPTION]... [FILE]...\\n\"\n          \"\\n\"\n          \"Options:\\n\"\n          \"  --log-level [0-3]\\n\"\n          \"  --mem-stats\\n\"\n          \"  --mem-stats-separate\\n\"\n          \"  --show-opcodes\\n\"\n          \"  --start-debug-server\\n\"\n          \"  --debug-server-port [port]\\n\"\n          \"\\n\",\n          name);\n} /* print_help */\n\n/**\n * Convert string into unsigned integer\n *\n * @return converted number\n */\nstatic uint32_t\nstr_to_uint (const char *num_str_p) /**< string to convert */\n{\n  assert (jerry_feature_enabled (JERRY_FEATURE_ERROR_MESSAGES));\n\n  uint32_t result = 0;\n\n  while (*num_str_p >= '0' && *num_str_p <= '9')\n  {\n    result *= 10;\n    result += (uint32_t) (*num_str_p - '0');\n    num_str_p++;\n  }\n\n  return result;\n} /* str_to_uint */\n\n/**\n * Register a JavaScript function in the global object.\n */\nstatic void\nregister_js_function (const char *name_p, /**< name of the function */\n                      jerry_external_handler_t handler_p) /**< function callback */\n{\n  jerry_value_t result_val = jerryx_register_global (name_p, handler_p);\n\n  if (jerry_value_is_exception (result_val))\n  {\n    jerry_log (JERRY_LOG_LEVEL_WARNING, \"Warning: failed to register '%s' method.\", name_p);\n  }\n\n  jerry_value_free (result_val);\n} /* register_js_function */\n\n/**\n * Main program.\n *\n * @return 0 if success, error code otherwise\n */\n#ifdef CONFIG_BUILD_KERNEL\nint\nmain (int argc, FAR char *argv[])\n#else /* !defined(CONFIG_BUILD_KERNEL) */\nint\njerry_main (int argc, char *argv[])\n#endif /* defined(CONFIG_BUILD_KERNEL) */\n{\n  if (argc > JERRY_MAX_COMMAND_LINE_ARGS)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR,\n               \"Too many command line arguments. Current maximum is %d\\n\",\n               JERRY_MAX_COMMAND_LINE_ARGS);\n\n    return JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  const char *file_names[JERRY_MAX_COMMAND_LINE_ARGS];\n  int i;\n  int files_counter = 0;\n  bool start_debug_server = false;\n  uint16_t debug_port = 5001;\n\n  jerry_init_flag_t flags = JERRY_INIT_EMPTY;\n\n  for (i = 1; i < argc; i++)\n  {\n    if (!strcmp (\"-h\", argv[i]) || !strcmp (\"--help\", argv[i]))\n    {\n      print_help (argv[0]);\n      return JERRY_STANDALONE_EXIT_CODE_OK;\n    }\n    else if (!strcmp (\"--mem-stats\", argv[i]))\n    {\n      flags |= JERRY_INIT_MEM_STATS;\n      jerry_log_set_level (JERRY_LOG_LEVEL_DEBUG);\n    }\n    else if (!strcmp (\"--show-opcodes\", argv[i]))\n    {\n      flags |= JERRY_INIT_SHOW_OPCODES | JERRY_INIT_SHOW_REGEXP_OPCODES;\n      jerry_log_set_level (JERRY_LOG_LEVEL_DEBUG);\n    }\n    else if (!strcmp (\"--log-level\", argv[i]))\n    {\n      if (++i < argc && strlen (argv[i]) == 1 && argv[i][0] >= '0' && argv[i][0] <= '3')\n      {\n        jerry_log_set_level (argv[i][0] - '0');\n      }\n      else\n      {\n        jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: wrong format or invalid argument\\n\");\n        return JERRY_STANDALONE_EXIT_CODE_FAIL;\n      }\n    }\n    else if (!strcmp (\"--start-debug-server\", argv[i]))\n    {\n      start_debug_server = true;\n    }\n    else if (!strcmp (\"--debug-server-port\", argv[i]))\n    {\n      if (++i < argc)\n      {\n        debug_port = str_to_uint (argv[i]);\n      }\n      else\n      {\n        jerry_log (JERRY_LOG_LEVEL_ERROR, \"Error: wrong format or invalid argument\\n\");\n        return JERRY_STANDALONE_EXIT_CODE_FAIL;\n      }\n    }\n    else\n    {\n      file_names[files_counter++] = argv[i];\n    }\n  }\n\n  jerry_init (flags);\n\n  if (start_debug_server)\n  {\n    jerryx_debugger_after_connect (jerryx_debugger_tcp_create (debug_port) && jerryx_debugger_ws_create ());\n  }\n\n  register_js_function (\"assert\", jerryx_handler_assert);\n  register_js_function (\"gc\", jerryx_handler_gc);\n  register_js_function (\"print\", jerryx_handler_print);\n\n  jerry_value_t ret_value = jerry_undefined ();\n  int ret_code = JERRY_STANDALONE_EXIT_CODE_OK;\n\n  if (files_counter == 0)\n  {\n    jerryx_repl (JERRY_ZSTR_ARG (\"jerry> \"));\n  }\n  else\n  {\n    for (i = 0; i < files_counter; i++)\n    {\n      ret_value = jerryx_source_exec_script (file_names[i]);\n      if (jerry_value_is_exception (ret_value))\n      {\n        ret_code = JERRY_STANDALONE_EXIT_CODE_FAIL;\n        jerryx_print_unhandled_exception (ret_value);\n        break;\n      }\n\n      jerry_value_free (ret_value);\n    }\n  }\n\n  ret_value = jerry_run_jobs ();\n\n  if (jerry_value_is_exception (ret_value))\n  {\n    ret_code = JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  jerry_value_free (ret_value);\n  jerry_cleanup ();\n\n  return ret_code;\n} /* main */\n"
  },
  {
    "path": "targets/os/nuttx/jerry-port.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n\n#include \"jerryscript-port.h\"\n\nvoid\njerry_port_log (const char *message_p)\n{\n  (void) message_p;\n} /* jerry_port_log */\n\njerry_char_t *\njerry_port_line_read (jerry_size_t *out_size_p)\n{\n  (void) out_size_p;\n  return NULL;\n} /* jerry_port_line_read */\n\nvoid\njerry_port_fatal (jerry_fatal_code_t code)\n{\n  exit ((int) code);\n} /* jerry_port_fatal */\n\nint32_t\njerry_port_local_tza (double unix_ms)\n{\n  (void) unix_ms;\n\n  /* We live in UTC. */\n  return 0;\n} /* jerry_port_local_tza */\n\ndouble\njerry_port_current_time (void)\n{\n  return 0;\n} /* jerry_port_current_time */\n"
  },
  {
    "path": "targets/os/nuttx/setjmp.S",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.syntax unified\n\n.macro func _name\n.global \\_name\n.type \\_name, %function\n\\_name:\n.endm\n.macro endfunc _name\n.size \\_name, .-\\_name\n.endm\n\n/**\n * setjmp (jmp_buf env)\n *\n * See also:\n *          longjmp\n *\n * @return 0 - if returns from direct call,\n *         nonzero - if returns after longjmp.\n */\nfunc setjmp\n  stmia r0!, {r4 - r11, lr}\n  str sp, [r0], #4\n  vstm r0, {s16 - s31}\n  mov r0, #0\n  bx lr\nendfunc setjmp\n\n/**\n * longjmp (jmp_buf env, int val)\n *\n * Note:\n *      if val is not 0, then it would be returned from setjmp,\n *      otherwise - 0 would be returned.\n *\n * See also:\n *          setjmp\n */\nfunc longjmp\n  ldmia r0!, {r4 - r11, lr}\n  ldr sp, [r0]\n  add r0, r0, #4\n  vldm r0, {s16 - s31}\n  mov r0, r1\n  cmp r0, #0\n  bne 1f\n  mov r0, #1\n  1:\n  bx lr\nendfunc longjmp\n"
  },
  {
    "path": "targets/os/nuttx/setjmp.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n#ifndef SETJMP_H\n#define SETJMP_H\n\n#include <stdint.h>\n\ntypedef uint64_t jmp_buf[14];\n\nint setjmp (jmp_buf env);\nvoid longjmp (jmp_buf env, int val);\n\n#endif /* !SETJMP_H */\n"
  },
  {
    "path": "targets/os/openwrt/readme.md",
    "content": "# JerryScript for OpenWrt build guide\n\nThis document describes the steps required to compile the JerryScript\nfor OpenWrt. For target device the TP-Link WR1043ND v1.x router is\nused. Please be advised, that if you have a different one minor\nmodifications to this document could be required.\n\nIMPORTANT!\n\nAs the TP-Link WR1043ND is a mips based device and mips is a big-endian\narchitecture a JerryScript snapshot which was built on an little-endian\nsystem will not work correctly. Thus it is advised that the\nsnapshot functionally should be used with caution, that is\nDO NOT run snapshots generated on little-endian system(s) on\na big-endian system.\n\n## OpenWrt notes\n\nIn 2018 ~January the OpenWrt and LEDE project merged into one\nand thus the old OpenWrt parts are now usable only from\nan archived repository: https://github.com/openwrt/archive\n\n## OpenWrt toolchain setup\n\nTo build the JerryScript for OpenWrt a toolchain is required for\nthe target router/device. The toolchain setup in this document was\ntested on an Ubuntu 16.04.3 LTS Linux.\n\nSteps required for toolchain creation:\n\n### 0. Install OpenWrt build requirements\n```sh\n$ sudo apt-get install git-core build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev subversion mercurial\n```\n\n### 1. Clone OpenWrt (Chaos Calmer version)\n\n```sh\n$ git clone https://github.com/openwrt/archive openwrt -b chaos_calmer\n$ cd openwrt\n```\n\n### 2. Run Menuconfig and configure the OpenWrt\n\n```sh\n$ make menuconfig\n```\n\nOptions which should be set:\n* Set \"Target System\" to \"Atheros AR7xxx/AR9xxx\".\n* Set \"Target Profile\" to \"TP-LINK TL-WR1043N/ND\".\n\nSave the configuration (as .config) and exit from the menuconfig.\n\n### 3. Configure the environment variables\n\n```sh\n$ export BUILDROOT=$(pwd) # where the openwrt root dir is\n$ export STAGING_DIR=${BUILDROOT}/staging_dir/ # required by the compiler\n$ export PATH=$PATH:${STAGING_DIR}/host/bin:${STAGING_DIR}/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/\n```\n\nThe name `toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2` is created based on the menuconfig.\nThis changes depending on the target device!\n\n### 4. Build the OpenWrt\n\n```sh\n$ make\n```\n\n### 5. Check if the compiler was built\n\n```sh\n$ mips-openwrt-linux-gcc --version # running this should print out the version information\n```\n\nAt this point we have the required compiler for OpenWrt.\n\n## Build JerryScript for OpenWrt\n\n### 0. Check environment\n\nPlease check if the `STAGING_DIR` is configured correctly and that the toolchain binary is on the `PATH`.\n\n### 1. Run the build with the OpenWrt toolchain file\n\n```\n$ ./tools/build.py --toolchain cmake/toolchain_openwrt_mips.cmake \\\n                   --lto OFF\n```\n\n### 2. Copy the binary\n\nAfter a successful build the `build/bin/jerry` binary file can be copied to the target device.\nOn how to copy a binary file to an OpenWrt target device please see the OpenWrt manual(s).\n"
  },
  {
    "path": "targets/os/riot/Makefile",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# application name\nAPPLICATION = riot_jerryscript\n\n# default BOARD enviroment\nBOARD ?= stm32f4discovery\n\n# path to jerryscript/targets/os/riot\nTARGET_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))\n\n# path to the JERRYSCRIPT directory\nJERRYDIR ?= $(TARGET_DIR)/../../..\n\n# path to the RIOT base directory\nRIOTBASE ?= $(JERRYDIR)/../RIOT\n\n# path to the application directory\nAPPDIR ?= $(JERRYDIR)/targets/os/riot/source\n\n# path to the binary directory\nBUILDDIR ?= $(JERRYDIR)/build/riot-stm32f4\n\n# path to the binary directory\nBINDIR ?= $(BUILDDIR)/bin\n\n# Change this to 0 show compiler invocation lines by default:\nQUIET ?= 1\n\nINCLUDES += -I$(JERRYDIR)/jerry-core/include\nINCLUDES += -I$(JERRYDIR)/jerry-ext/include\n\nARCHIVES += $(JERRYDIR)/build/lib/libjerry-core.a\nARCHIVES += $(JERRYDIR)/build/lib/libjerry-ext.a\nARCHIVES += $(JERRYDIR)/build/lib/libjerry-port.a\n\nUSEMODULE += shell\nUSEMODULE += shell_cmds_default\nUSEMODULE += posix_sleep\n\n.PHONY: libjerry\nlibjerry:\n\t$(JERRYDIR)/tools/build.py \\\n\t\t--clean \\\n\t\t--lto=OFF \\\n\t\t--jerry-cmdline=OFF \\\n\t\t--jerry-math=ON \\\n\t\t--amalgam=ON \\\n\t\t--mem-heap=70 \\\n\t\t--profile=es.next \\\n\t\t--compile-flag=-fshort-enums \\\n\t\t--toolchain=$(abspath $(JERRYDIR)/cmake/toolchain_mcu_stm32f4.cmake)\n\n.PHONY: clear-cflags\nclear-cflags:\n\t$(eval BACKUP := $(CFLAGS))\n\t$(eval CFLAGS := )\n\n.PHONY: restore-cflags\nrestore-cflags:\n\t$(eval CFLAGS := $(BACKUP))\n\n# CFLAGS is filled by Makefile.include that is only for RIOT.\n# Clear CFLAGS temporarily while compiling JerryScript.\nall: clear-cflags libjerry restore-cflags\n\ninclude $(RIOTBASE)/Makefile.include\n"
  },
  {
    "path": "targets/os/riot/Makefile.travis",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\n# Default target for running the build test outside the Travis CI environment.\nall:\n\t$(MAKE) install\n\t$(MAKE) script\n\n\n## Targets for installing build dependencies of the RIOT JerryScript target.\n\n# Install cross-compiler via apt.\ninstall-apt-get-deps:\n\tsudo apt-get install -q -y clang gcc-arm-embedded gcc-multilib\n\n# Fetch RIOT OS repository.\ninstall-clone-riot:\n\tgit clone https://github.com/RIOT-OS/RIOT.git ../RIOT -b 2025.04\n\n# Perform all the necessary (JerryScript-independent) installation steps.\ninstall-noapt: install-clone-riot\ninstall: install-apt-get-deps install-noapt\n\n## Targets for building RIOT with JerryScript.\n\n# Build the firmware (RIOT with JerryScript).\nscript:\n\t$(MAKE) -f ./targets/os/riot/Makefile\n"
  },
  {
    "path": "targets/os/riot/README.md",
    "content": "### About\n\nThis folder contains files to run JerryScript on\n[STM32F4-Discovery board](https://www.st.com/en/evaluation-tools/stm32f4discovery.html) with\n[RIOT](https://www.riot-os.org/).\nThe document had been validated on Ubuntu 20.04 operating system.\n\n### How to build\n\n#### 1. Setup the build environment for STM32F4-Discovery board\n\nClone the necessary projects into a `jerry-riot` directory.\nThe latest tested working version of RIOT is `2021.10`.\n\n```sh\n# Create a base folder for all the projects.\nmkdir jerry-riot && cd jerry-riot\n\ngit clone https://github.com/jerryscript-project/jerryscript.git\ngit clone https://github.com/RIOT-OS/RIOT.git -b 2021.10\n```\n\n#### 2. Install dependencies of the projects\n\n```\n# Assuming you are in jerry-riot folder.\njerryscript/tools/apt-get-install-deps.sh\n\nsudo apt install gcc-arm-none-eabi openocd minicom\n```\n\nThe following directory structure has been created:\n\n```\njerry-riot\n  + jerryscript\n  |  + targets\n  |      + os\n  |        + riot\n  + RIOT\n```\n\n#### 3. Build RIOT (with JerryScript)\n\n```\n# Assuming you are in jerry-riot folder.\nmake BOARD=stm32f4discovery -f jerryscript/targets/os/riot/Makefile\n```\n\nThe created binary is a `riot_jerryscript.elf` named file located in `jerryscript/build/riot-stm32f4/bin/` folder.\n\n#### 4. Flash the device\n\nConnect Mini-USB for charging and flashing the device.\n\n```\n# Assuming you are in jerry-riot folder.\nmake BOARD=stm32f4discovery -f jerryscript/targets/os/riot/Makefile flash\n```\n\nNote: `ST-LINK` also can be used that is described at [this page](https://github.com/RIOT-OS/RIOT/wiki/ST-LINK-tool).\n\n#### 5. Connect to the device\n\nUse `USB To TTL Serial Converter` for serial communication. STM32F4-Discovery pins are mapped by RIOT as follows:\n\n```\n  STM32f4-Discovery PA2 pin is configured for TX.\n  STM32f4-Discovery PA3 pin is configured for RX.\n```\n\n* Connect `STM32f4-Discovery` **PA2** pin to **RX** pin of `USB To TTL Serial Converter`\n* Connect `STM32f4-Discovery` **PA3** pin to **TX** pin of `USB To TTL Serial Converter`\n* Connect `STM32f4-Discovery` **GND** pin to **GND** pin of `USB To TTL Serial Converter`\n\nThe device should be visible as `/dev/ttyUSB0`. Use `minicom` communication program with `115200`.\n\n* In `minicom`, set `Add Carriage Ret` to `off` in by `CTRL-A -> Z -> U` key combinations.\n* In `minicom`, set `Hardware Flow Control` to `no` by `CTRL-A -> Z -> O -> Serial port setup -> F` key combinations.\n\n```sh\nsudo minicom --device=/dev/ttyUSB0 --baud=115200\n```\n\nRIOT prompt looks like as follows:\n\n```\nmain(): This is RIOT! (Version: 2021.10)\nYou are running RIOT on a(n) stm32f4discovery board.\nThis board features a(n) stm32 MCU.\n>\n```\n\nYou may have to press `RESET` on the board and press `Enter` key on the console several times to make RIOT prompt visible.\n\n#### 6. Run JerrySript\n\nType `help` to list shell commands:\n\n```\n> help\nCommand              Description\n---------------------------------------\ntest                 Jerryscript Hello World test\nreboot               Reboot the node\nversion              Prints current RIOT_VERSION\npm                   interact with layered PM subsystem\n```\n\nType `test` to execute JerryScript:\n\n```\n> test\nThis test run the following script code: [print ('Hello, World!');]\n\nHello, World!\n```\n"
  },
  {
    "path": "targets/os/riot/source/jerry-main.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n#include \"shell.h\"\n\n/**\n * Standalone Jerry exit codes\n */\n#define JERRY_STANDALONE_EXIT_CODE_OK   (0)\n#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)\n\n/**\n * Jerryscript simple test\n */\nint\ntest_jerry (int argc, char **argv)\n{\n  /* Suppress compiler errors */\n  (void) argc;\n  (void) argv;\n\n  jerry_value_t ret_value = jerry_undefined ();\n\n  const jerry_char_t script[] = \"print ('Hello, World!');\";\n  printf (\"This test run the following script code: [%s]\\n\\n\", script);\n\n  /* Initialize engine */\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Register the print function in the global object. */\n  jerryx_register_global (\"print\", jerryx_handler_print);\n\n  /* Setup Global scope code */\n  ret_value = jerry_parse (script, sizeof (script) - 1, NULL);\n\n  if (!jerry_value_is_exception (ret_value))\n  {\n    /* Execute the parsed source code in the Global scope */\n    ret_value = jerry_run (ret_value);\n  }\n\n  int ret_code = JERRY_STANDALONE_EXIT_CODE_OK;\n\n  if (jerry_value_is_exception (ret_value))\n  {\n    printf (\"Script Error!\");\n\n    ret_code = JERRY_STANDALONE_EXIT_CODE_FAIL;\n  }\n\n  jerry_value_free (ret_value);\n\n  /* Cleanup engine */\n  jerry_cleanup ();\n\n  return ret_code;\n\n} /* test_jerry */\n\nconst shell_command_t shell_commands[] = { { \"test\", \"Jerryscript Hello World test\", test_jerry },\n                                           { NULL, NULL, NULL } };\n\nint\nmain (void)\n{\n  union\n  {\n    double d;\n    unsigned u;\n  } now = { .d = jerry_port_current_time () };\n  srand (now.u);\n  printf (\"You are running RIOT on a(n) %s board.\\n\", RIOT_BOARD);\n  printf (\"This board features a(n) %s MCU.\\n\", RIOT_CPU);\n\n  /* start the shell */\n  char line_buf[SHELL_DEFAULT_BUFSIZE];\n  shell_run (shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);\n\n  return 0;\n}\n"
  },
  {
    "path": "targets/os/riot/source/jerry-port.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdlib.h>\n#include <string.h>\n\n#include \"jerryscript-port.h\"\n\nint32_t\njerry_port_local_tza (double unix_ms)\n{\n  (void) unix_ms;\n\n  /* We live in UTC. */\n  return 0;\n} /* jerry_port_local_tza */\n\ndouble\njerry_port_current_time (void)\n{\n  return 0;\n} /* jerry_port_current_time */\n"
  },
  {
    "path": "targets/os/zephyr/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required(VERSION 3.20.0)\n\nfind_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})\nproject(NONE)\n\nset(JERRY_BASE ${CMAKE_SOURCE_DIR}/../../..)\n\n# Build JerryScript\nexecute_process(COMMAND ${JERRY_BASE}/tools/build.py\n                            --clean\n                            --lto=OFF\n                            --jerry-cmdline=OFF\n                            --jerry-math=ON\n                            --amalgam=ON\n                            --mem-heap=70\n                            --profile=es.next\n                            --toolchain=${JERRY_BASE}/cmake/toolchain_mcu_stm32f4.cmake)\n\n# Define library targets\nadd_library(jerry-core STATIC IMPORTED)\nadd_library(jerry-ext STATIC IMPORTED)\nadd_library(jerry-port STATIC IMPORTED)\n\n# Define include directories and archives\nset_target_properties(jerry-core PROPERTIES IMPORTED_LOCATION ${JERRY_BASE}/build/lib/libjerry-core.a)\nset_target_properties(jerry-core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${JERRY_BASE}/jerry-core/include)\nset_target_properties(jerry-ext PROPERTIES IMPORTED_LOCATION ${JERRY_BASE}/build/lib/libjerry-ext.a)\nset_target_properties(jerry-ext PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${JERRY_BASE}/jerry-ext/include)\nset_target_properties(jerry-port PROPERTIES IMPORTED_LOCATION ${JERRY_BASE}/build/lib/libjerry-port.a)\n\ntarget_sources(app PRIVATE src/jerry-main.c src/getline-zephyr.c src/jerry-port.c)\ntarget_link_libraries(app PUBLIC jerry-core jerry-ext jerry-port)\n"
  },
  {
    "path": "targets/os/zephyr/Makefile.travis",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\n# Default target for running the build test outside the Travis CI environment.\nall:\n\t$(MAKE) install\n\t$(MAKE) script\n\n\n## Targets for installing build dependencies of the Zephyr JerryScript target.\n\n# Install tools via apt.\ninstall-apt-get-deps:\n\tsudo apt-get install -q -y gperf dfu-util device-tree-compiler gcc-arm-none-eabi\n\n# Install Zephyr SDK.\ninstall-zephyr-toolchain:\n\twget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.13.2/zephyr-toolchain-arm-0.13.2-linux-x86_64-setup.run -O ../zephyr-toolchain-arm-0.13.2-linux-x86_64-setup.run\n\tsh ../zephyr-toolchain-arm-0.13.2-linux-x86_64-setup.run -- -y -d $(CURDIR)/../zephyr-toolchain-0.13.2\n\n# Fetch Zephyr Project repository and install python dependencies.\ninstall-zephyr:\n\tgit clone https://github.com/zephyrproject-rtos/zephyr.git ../zephyr -b v2.7.0\n\tpip3 install -U pip\n\tpip3 install -U setuptools\n\tpip3 install -r ../zephyr/scripts/requirements.txt\n\n# Install recent CMake\ninstall-cmake:\n\tpip install cmake\n\tcmake --version\n\n# Perform all the necessary (JerryScript-independent) installation steps.\ninstall-noapt: install-zephyr-toolchain install-zephyr install-cmake\ninstall: install-apt-get-deps install-noapt\n\n\n## Targets for building Zephyr with JerryScript.\n\n# Initialize west meta-tool\ninit-west:\n\twest init -l $(CURDIR)/../zephyr\n\twest update hal_stm32 cmsis\n\twest zephyr-export\n\n# Build the firmware (Zephyr with JerryScript).\nSHELL=bash\nscript: init-west\n\texport ZEPHYR_TOOLCHAIN_VARIANT=zephyr && \\\n\texport ZEPHYR_SDK_INSTALL_DIR=$(CURDIR)/../zephyr-toolchain-0.13.2 && \\\n\twest build -d $(CURDIR)/../build -p auto -b stm32f4_disco targets/os/zephyr/ -- -G'Unix Makefiles'\n"
  },
  {
    "path": "targets/os/zephyr/README.md",
    "content": "### About\n\nThis folder contains files to run JerryScript on\n[STM32F4-Discovery board](https://www.st.com/en/evaluation-tools/stm32f4discovery.html) with\n[Zephyr](https://zephyrproject.org/).\nThe document had been validated on Ubuntu 20.04 operating system.\n\n#### 1. Setup the build environment\n\nClone the necessary projects into a `jerry-zephyr` directory.\nThe latest tested working version of Zephyr is `v2.7.0`.\n\n```sh\nmkdir jerry-zephyr && cd jerry-zephyr\n\ngit clone https://github.com/jerryscript-project/jerryscript.git\ngit clone https://github.com/zephyrproject-rtos/zephyr -b v2.7.0\n\n# Zephyr requires its toolchain.\nwget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.13.2/zephyr-toolchain-arm-0.13.2-linux-x86_64-setup.run\n```\n\nThe following directory structure has been created:\n\n```\njerry-zephyr\n  + jerryscript\n  |  + targets\n  |      + os\n  |        + zephyr\n  + zephyr\n  + zephyr-toolchain-arm-0.13.2-linux-x86_64-setup.run\n```\n\n#### 2. Install dependencies of the projects\n\n```sh\n# Assuming you are in jerry-zephyr folder.\njerryscript/tools/apt-get-install-deps.sh\n\n# Tool dependencies of Zephyr.\nsudo apt install --no-install-recommends \\\n  git cmake ninja-build gperf ccache dfu-util device-tree-compiler \\\n  python3-dev python3-pip python3-setuptools python3-tk python3-wheel \\\n  xz-utils file make gcc gcc-multilib g++-multilib libsdl2-dev\n\n# Install Python dependencies of Zephyr.\npip3 install --user -r zephyr/scripts/requirements.txt\n\n# Install Zephyr toolchain.\nchmod +x zephyr-toolchain-arm-0.13.2-linux-x86_64-setup.run\n./zephyr-toolchain-arm-0.13.2-linux-x86_64-setup.run -- -y -d ${PWD}/zephyr-toolchain-0.13.2\n```\n\nNote: CMake 3.20 is required. If the installed CMake is older, upgrade it for example [this way](https://apt.kitware.com/).\n\n#### 3. Initialize west meta-tool for Zephyr\n\n```\n# Assuming you are in jerry-zephyr folder.\nwest init -l zephyr\nwest update hal_stm32 cmsis\nwest zephyr-export\n```\n\n#### 4. Build Zephyr (with JerryScript)\n\n```\n# Assuming you are in jerry-zephyr folder.\nwest build -p auto -b stm32f4_disco jerryscript/targets/os/zephyr/\n```\n\nThe created binary is a `zephyr.elf` named file located in `jerry-zephyr/build/zephyr/bin/` folder.\n\n#### 5. Flash\n\nInstall `udev` rules which allows to flash STM32F4-Discovery as a regular user:\n\n```\n# Assuming you are in jerry-zephyr folder.\nsudo cp zephyr-toolchain-0.13.2/sysroots/x86_64-pokysdk-linux/usr/share/openocd/contrib/60-openocd.rules /etc/udev/rules.d\nsudo udevadm control --reload\n```\n\nConnect Mini-USB for charging and flasing the device.\n\n```\n# Assuming you are in jerry-zephyr folder.\nwest flash\n```\n\n#### 6. Connect to the device\n\nUse `USB To TTL Serial Converter` for serial communication. STM32F4-Discovery pins are mapped by Zephyr as follows:\n\n```\n  STM32f4-Discovery PA2 pin is configured for TX.\n  STM32f4-Discovery PA3 pin is configured for RX.\n```\n\n* Connect `STM32f4-Discovery` **PA2** pin to **RX** pin of `USB To TTL Serial Converter`\n* Connect `STM32f4-Discovery` **PA3** pin to **TX** pin of `USB To TTL Serial Converter`\n* Connect `STM32f4-Discovery` **GND** pin to **GND** pin of `USB To TTL Serial Converter`\n\nThe device should be visible as `/dev/ttyUSB0`. Use `minicom` communication program with `115200`.\n\n* In `minicom`, set `Add Carriage Ret` to `off` in by `CTRL-A -> Z -> U` key combinations.\n* In `minicom`, set `Hardware Flow Control` to `no` by `CTRL-A -> Z -> O -> Serial port setup -> F` key combinations.\n\n```sh\nsudo minicom --device=/dev/ttyUSB0 --baud=115200\n```\n\nPress `RESET` on the board to get the initial message with JerryScript command prompt:\n\n```\n*** Booting Zephyr OS build v2.7.99-1786-ga08b65ef42db  ***\nJerryScript build: Nov 25 2021 14:17:17\nJerryScript API 3.0.0\nZephyr version 2.7.99\njs>\n```\n\nRun the following JavaScript example:\n\n```\njs> var test = 0; for (t = 100; t < 1000; t++) test += t; print ('Hello World! ' + test);\nHello World! 494550\nundefined\n```\n"
  },
  {
    "path": "targets/os/zephyr/prj.conf",
    "content": "CONFIG_BUILD_OUTPUT_BIN=y\nCONFIG_STDOUT_CONSOLE=y\nCONFIG_NEWLIB_LIBC=y\nCONFIG_FPU=y\nCONFIG_MAIN_STACK_SIZE=2048\nCONFIG_CONSOLE_HANDLER=y\n"
  },
  {
    "path": "targets/os/zephyr/src/getline-zephyr.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <zephyr.h>\n#include <drivers/uart.h>\n#include <drivers/console/console.h>\n#include <drivers/console/uart_console.h>\n#include \"getline-zephyr.h\"\n\n/* While app processes one input line, Zephyr will have another line\n   buffer to accumulate more console input. */\nstatic struct console_input line_bufs[2];\n\nstatic struct k_fifo free_queue;\nstatic struct k_fifo used_queue;\n\nchar *zephyr_getline(void)\n{\n  static struct console_input *cmd;\n\n  /* Recycle cmd buffer returned previous time */\n  if (cmd != NULL)\n  {\n    k_fifo_put(&free_queue, cmd);\n  }\n\n  cmd = k_fifo_get(&used_queue, K_FOREVER);\n  return cmd->line;\n}\n\nvoid zephyr_getline_init(void)\n{\n  int i;\n\n  k_fifo_init(&used_queue);\n  k_fifo_init(&free_queue);\n  for (i = 0; i < sizeof(line_bufs) / sizeof(*line_bufs); i++)\n  {\n    k_fifo_put(&free_queue, &line_bufs[i]);\n  }\n\n  /* Zephyr UART handler takes an empty buffer from free_queue,\n     stores UART input in it until EOL, and then puts it into\n     used_queue. */\n  uart_register_input(&free_queue, &used_queue, NULL);\n}\n"
  },
  {
    "path": "targets/os/zephyr/src/getline-zephyr.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvoid zephyr_getline_init(void);\nchar *zephyr_getline(void);\n"
  },
  {
    "path": "targets/os/zephyr/src/jerry-main.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sys/printk.h>\n#include <zephyr.h>\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"getline-zephyr.h\"\n#include \"jerryscript-ext/handlers.h\"\n#include \"jerryscript-ext/properties.h\"\n#include \"jerryscript-ext/repl.h\"\n\nvoid\nmain (void)\n{\n  union\n  {\n    double d;\n    unsigned u;\n  } now = { .d = jerry_port_current_time () };\n  srand (now.u);\n\n  uint32_t zephyr_ver = sys_kernel_version_get ();\n  printf (\"JerryScript build: \" __DATE__ \" \" __TIME__ \"\\n\");\n  printf (\"JerryScript API %d.%d.%d\\n\", JERRY_API_MAJOR_VERSION, JERRY_API_MINOR_VERSION, JERRY_API_PATCH_VERSION);\n  printf (\"Zephyr version %d.%d.%d\\n\",\n          (int) SYS_KERNEL_VER_MAJOR (zephyr_ver),\n          (int) SYS_KERNEL_VER_MINOR (zephyr_ver),\n          (int) SYS_KERNEL_VER_PATCHLEVEL (zephyr_ver));\n\n  zephyr_getline_init ();\n  jerry_init (JERRY_INIT_EMPTY);\n  jerryx_register_global (\"print\", jerryx_handler_print);\n\n  jerryx_repl (JERRY_ZSTR_ARG (\"js> \"));\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "targets/os/zephyr/src/jerry-port.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n#include <zephyr.h>\n\n#include \"jerryscript-port.h\"\n\n#include \"getline-zephyr.h\"\n\nvoid\njerry_port_fatal (jerry_fatal_code_t code)\n{\n  exit ((int) code);\n} /* jerry_port_fatal */\n\nint32_t\njerry_port_local_tza (double unix_ms)\n{\n  (void) unix_ms;\n\n  /* We live in UTC. */\n  return 0;\n} /* jerry_port_local_tza */\n\ndouble\njerry_port_current_time (void)\n{\n  int64_t ms = k_uptime_get ();\n  return (double) ms;\n} /* jerry_port_current_time */\n\nvoid\njerry_port_sleep (uint32_t sleep_time)\n{\n  k_usleep ((useconds_t) sleep_time * 1000);\n} /* jerry_port_sleep */\n\njerry_char_t *\njerry_port_line_read (jerry_size_t *out_size_p)\n{\n  char *line_p = zephyr_getline ();\n\n  *out_size_p = (jerry_size_t) strlen (line_p);\n  return (jerry_char_t *) line_p;\n} /* jerry_port_line_read */\n\nvoid\njerry_port_line_free (jerry_char_t *line_p)\n{\n  (void) line_p;\n} /* jerry_port_line_free */\n"
  },
  {
    "path": "tests/.gitattributes",
    "content": "*.js text eol=lf\njerry/windows-line-ending.js text eol=crlf\n"
  },
  {
    "path": "tests/benchmarks/jerry/fill-array-with-numbers-3-times-5000-elements.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor (i = 0; i < 3; i++)\n{\n  a = [];\n\n  for (j = 0; j < 5000; j++)\n  {\n    a[j] = j;\n  }\n}\n"
  },
  {
    "path": "tests/benchmarks/jerry/function_loop.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar x = 7;\nvar y = 3;\nvar count = 1000000;\n\nfunction cse_opt(x, y)\n{\n    var tmp1 = x * x;\n    var tmp2 = y * y;\n    var tmp3 = tmp1 * tmp1;\n    var tmp4 = tmp2 * tmp2;\n    \n    for (var i = 0; i < count; i++) {\n        var cached1 = tmp3 * x\n        var cached2 = tmp4 * y;\n        var cached_n_cached = cached1 + cached2;\n        var ret_val = cached_n_cached + cached_n_cached;\n    }\n    \n    return ret_val + ret_val;\n};\n\ncse_opt(x, y);"
  },
  {
    "path": "tests/benchmarks/jerry/gc.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f (o, i) {\n  if (--i > 0) {\n    f ({a:o, b:o}, i);\n  }\n}\n\nfor (var i = 0; i < 100; i++)\n{\n  ({} + f ({}, 12));\n}\n\nfor(var i = 0; i < 100; i++)\n{\n  var obj = {}, obj_l;\n  obj_l = obj;\n\n  for (var k = 0; k < 1500; k++)\n  {\n    obj_l.prop = {};\n    obj_l = obj_l.prop;\n  }\n}\n"
  },
  {
    "path": "tests/benchmarks/jerry/loop_arithmetics_10kk.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar count = 10000000;\nvar x = 7;\nvar y = 3;\n\nvar tmp1;\nvar tmp2;\nvar tmp3;\nvar tmp4;\n\nfor (var i = 0; i < count; i++)\n{\n  tmp1 = x * x;\n  tmp2 = y * y;\n  tmp3 = tmp1 * tmp1;\n  tmp4 = tmp2 * tmp2;\n}\n"
  },
  {
    "path": "tests/benchmarks/jerry/loop_arithmetics_1kk.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar count = 1000000;\nvar x = 7;\nvar y = 3;\n\nvar tmp1;\nvar tmp2;\nvar tmp3;\nvar tmp4;\n\nfor (var i = 0; i < count; i++)\n{\n  tmp1 = x * x;\n  tmp2 = y * y;\n  tmp3 = tmp1 * tmp1;\n  tmp4 = tmp2 * tmp2;\n}\n"
  },
  {
    "path": "tests/debugger/client_source.cmd",
    "content": "s\ns\ns\ncontinue\n"
  },
  {
    "path": "tests/debugger/client_source.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/client_source.js:15\n(jerry-debugger) s\nclient-source-test\nStopped at tests/debugger/client_source.js:40\n(jerry-debugger) s\nStopped at tests/debugger/client_source.js:35 (in test() at line:33, col:1)\n(jerry-debugger) s\nfunction test\nStopped at tests/debugger/client_source.js:36 (in test() at line:33, col:1)\n(jerry-debugger) continue\nfunction foo\nfunction bar\nfunction finish\nfinish: test-foo-bar\n"
  },
  {
    "path": "tests/debugger/client_source.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"client-source-test\");\n\nfunction finish(z) {\n  print(\"function finish\");\n  print(\"finish: \" + z);\n}\n\nfunction bar(y) {\n  print(\"function bar\");\n  finish(y + \"-bar\");\n}\n\nfunction foo(x)\n{\n  print(\"function foo\");\n  bar(x + \"-foo\");\n}\n\nfunction test()\n{\n  print(\"function test\");\n  var x = \"test\";\n  foo(x);\n}\n\ntest();\n"
  },
  {
    "path": "tests/debugger/client_source_multiple.cmd",
    "content": "n\nn\ns\ns\ns\ns\nc\n"
  },
  {
    "path": "tests/debugger/client_source_multiple.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/client_source_multiple_2.js:15\n(jerry-debugger) n\nmultiple-client-source-test-file-2\nStopped at tests/debugger/client_source_multiple_1.js:15\n(jerry-debugger) n\nmultiple-client-source-test-file-1\nStopped at tests/debugger/client_source_multiple_1.js:27\n(jerry-debugger) s\nStopped at tests/debugger/client_source_multiple_1.js:18 (in foo() at line:17, col:1)\n(jerry-debugger) s\nfoo\nStopped at tests/debugger/client_source_multiple_1.js:19 (in foo() at line:17, col:1)\n(jerry-debugger) s\nStopped at tests/debugger/client_source_multiple_2.js:18 (in bar() at line:17, col:1)\n(jerry-debugger) s\nbar\nStopped at tests/debugger/client_source_multiple_2.js:19 (in bar() at line:17, col:1)\n(jerry-debugger) c\nstr-argument: called-from-test-file-1\ncrossFoo\nstr-argument: called-from-test-file-2\n"
  },
  {
    "path": "tests/debugger/client_source_multiple_1.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"multiple-client-source-test-file-1\");\n\nfunction foo() {\n  print(\"foo\");\n  bar(\"called-from-test-file-1\");\n}\n\nfunction crossFoo(str) {\n  print(\"crossFoo\");\n  print(\"str-argument: \" + str);\n}\n\nfoo();\n"
  },
  {
    "path": "tests/debugger/client_source_multiple_2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"multiple-client-source-test-file-2\");\n\nfunction bar(str) {\n  print(\"bar\");\n  print(\"str-argument: \" + str);\n  crossFoo(\"called-from-test-file-2\");\n}\n"
  },
  {
    "path": "tests/debugger/do_abort.cmd",
    "content": "s\ns\ns\ns\nabort new Error('Fatal error :)')\n"
  },
  {
    "path": "tests/debugger/do_abort.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_abort.js:24\n(jerry-debugger) s\nStopped at tests/debugger/do_abort.js:25\n(jerry-debugger) s\nStopped at tests/debugger/do_abort.js:26\n(jerry-debugger) s\nStopped at tests/debugger/do_abort.js:20 (in g() at line:19, col:1)\n(jerry-debugger) s\nStopped at tests/debugger/do_abort.js:16 (in f() at line:15, col:1)\n(jerry-debugger) abort new Error('Fatal error :)')\nUnhandled exception: Error: Fatal error :)\n"
  },
  {
    "path": "tests/debugger/do_abort.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f() {\n  return 32;\n}\n\nfunction g() {\n  f();\n}\n\n// In regular JS, it is not possible to escape from this loop\nwhile (true) {\n  try {\n    g();\n  } catch (e) {\n    var s = \"Don't stop here\";\n  }\n}\n"
  },
  {
    "path": "tests/debugger/do_backtrace.cmd",
    "content": "next\nn\nnext\nstep\nnext\ns\nbt 1 2 t\nbt 1 2\nbt 0 3 t\nbt\nbt 2\nbt 2 t\nn\nn\ns\nbacktrace\nbt 4 4\nbt 600 919\nbt 3 500\nbt 42\nbt 4 3\nc\n"
  },
  {
    "path": "tests/debugger/do_backtrace.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_backtrace.js:15\n(jerry-debugger) next\nbacktrace-test\nStopped at tests/debugger/do_backtrace.js:28\n(jerry-debugger) n\nStopped at tests/debugger/do_backtrace.js:37\n(jerry-debugger) next\nStopped at tests/debugger/do_backtrace.js:40\n(jerry-debugger) step\nStopped at tests/debugger/do_backtrace.js:32 (in test() at line:30, col:1)\n(jerry-debugger) next\nfunction test\nStopped at tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)\n(jerry-debugger) s\nStopped at tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1)\n(jerry-debugger) bt 1 2 t\nTotal number of frames: 3\nFrame 1: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)\n(jerry-debugger) bt 1 2\nFrame 1: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)\n(jerry-debugger) bt 0 3 t\nTotal number of frames: 3\nFrame 0: tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1)\nFrame 1: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)\nFrame 2: tests/debugger/do_backtrace.js:40\n(jerry-debugger) bt\nFrame 0: tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1)\nFrame 1: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)\nFrame 2: tests/debugger/do_backtrace.js:40\n(jerry-debugger) bt 2\nFrame 0: tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1)\nFrame 1: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)\n(jerry-debugger) bt 2 t\nTotal number of frames: 3\nFrame 0: tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1)\nFrame 1: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)\n(jerry-debugger) n\nfunction foo\nStopped at tests/debugger/do_backtrace.js:24 (in foo() at line:21, col:1)\n(jerry-debugger) n\nStopped at tests/debugger/do_backtrace.js:25 (in foo() at line:21, col:1)\n(jerry-debugger) s\nStopped at tests/debugger/do_backtrace.js:18 (in f4() at line:17, col:1)\n(jerry-debugger) backtrace\nFrame 0: tests/debugger/do_backtrace.js:18 (in f4() at line:17, col:1)\nFrame 1: tests/debugger/do_backtrace.js:25 (in foo() at line:21, col:1)\nFrame 2: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)\nFrame 3: tests/debugger/do_backtrace.js:40\n(jerry-debugger) bt 4 4\n(jerry-debugger) bt 600 919\n(jerry-debugger) bt 3 500\nFrame 3: tests/debugger/do_backtrace.js:40\n(jerry-debugger) bt 42\nFrame 0: tests/debugger/do_backtrace.js:18 (in f4() at line:17, col:1)\nFrame 1: tests/debugger/do_backtrace.js:25 (in foo() at line:21, col:1)\nFrame 2: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)\nFrame 3: tests/debugger/do_backtrace.js:40\n(jerry-debugger) bt 4 3\nError: Start depth needs to be lower than or equal to max depth\n(jerry-debugger) c\nfunction f4\n"
  },
  {
    "path": "tests/debugger/do_backtrace.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"backtrace-test\");\n\nfunction f4() {\n\tprint(\"function f4\");\n}\n\nfunction foo()\n{\n  print(\"function foo\");\n  var tmp = 4;\n  f4();\n}\n\nvar cat = 'cat';\n\nfunction test()\n{\n\tprint(\"function test\");\n\tfoo();\n}\n\nvar\n\tx =\n\t  1;\n\ntest();\n"
  },
  {
    "path": "tests/debugger/do_break.cmd",
    "content": "break do_break.js:51\nb do_break.js:36\nbreak f\nlist\nc\ndelete 1\nlist\nc\ncontinue\nc\n"
  },
  {
    "path": "tests/debugger/do_break.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_break.js:15\n(jerry-debugger) break do_break.js:51\nBreakpoint 1 at tests/debugger/do_break.js:51\n(jerry-debugger) b do_break.js:36\nBreakpoint 2 at tests/debugger/do_break.js:36 (in test() at line:20, col:1)\n(jerry-debugger) break f\nBreakpoint 3 at tests/debugger/do_break.js:33 (in f() at line:31, col:3)\nBreakpoint 4 at tests/debugger/do_break.js:45 (in f() at line:43, col:1)\n(jerry-debugger) list\n=== Active breakpoints  ===\n 1: tests/debugger/do_break.js:51\n 2: tests/debugger/do_break.js:36 (in test() at line:20, col:1)\n 3: tests/debugger/do_break.js:33 (in f() at line:31, col:3)\n 4: tests/debugger/do_break.js:45 (in f() at line:43, col:1)\n(jerry-debugger) c\nbreak test\nvar cat\nStopped at breakpoint:1 tests/debugger/do_break.js:51\n(jerry-debugger) delete 1\nBreakpoint 1 deleted\n(jerry-debugger) list\n=== Active breakpoints  ===\n 2: tests/debugger/do_break.js:36 (in test() at line:20, col:1)\n 3: tests/debugger/do_break.js:33 (in f() at line:31, col:3)\n 4: tests/debugger/do_break.js:45 (in f() at line:43, col:1)\n(jerry-debugger) c\nStopped at breakpoint:2 tests/debugger/do_break.js:36 (in test() at line:20, col:1)\n(jerry-debugger) continue\nfunction test\nStopped at breakpoint:3 tests/debugger/do_break.js:33 (in f() at line:31, col:3)\n(jerry-debugger) c\n"
  },
  {
    "path": "tests/debugger/do_break.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"break test\");\n\nprint (\"var cat\");\nvar cat = 'cat';\n\nfunction test(x)\n{\n  function f() {\n    return 0;\n  }\n\n  function f() {\n    /* Again. */\n    return 1;\n  }\n\n  function f() {\n    /* And again. */\n    return 2;\n  }\n\n  print(\"function test\");\n  var a = 3;\n  var b = 5, c = a + b;\n  global_var = f();\n  return c;\n}\n\nfunction f() {\n  /* And again. */\n}\n\nvar\n  x =\n    1;\n\ntest(x);\n"
  },
  {
    "path": "tests/debugger/do_continue.cmd",
    "content": "continue\n"
  },
  {
    "path": "tests/debugger/do_continue.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_continue.js:16\n(jerry-debugger) continue\n"
  },
  {
    "path": "tests/debugger/do_continue.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Empty file. */\n"
  },
  {
    "path": "tests/debugger/do_delete.cmd",
    "content": "next\nb do_delete.js:17\nb do_delete.js:21\ny\nb do_delete.js:19\nb do_delete.js:18\nlist\ndelete 2\ndelete 3\nlist\nc\nc\n"
  },
  {
    "path": "tests/debugger/do_delete.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_delete.js:15\n(jerry-debugger) next\ndelete tests\nStopped at tests/debugger/do_delete.js:17\n(jerry-debugger) b do_delete.js:17\nBreakpoint 1 at tests/debugger/do_delete.js:17\n(jerry-debugger) b do_delete.js:21\nNo breakpoint found, do you want to add a pending breakpoint? (y or [n]) Pending breakpoint 2 at do_delete.js:21\n(jerry-debugger) b do_delete.js:19\nBreakpoint 3 at tests/debugger/do_delete.js:19\n(jerry-debugger) b do_delete.js:18\nBreakpoint 4 at tests/debugger/do_delete.js:18\n(jerry-debugger) list\n=== Active breakpoints  ===\n 1: tests/debugger/do_delete.js:17\n 3: tests/debugger/do_delete.js:19\n 4: tests/debugger/do_delete.js:18\n=== Pending breakpoints ===\n 2: do_delete.js:21 (pending)\n(jerry-debugger) delete 2\nPending breakpoint 2 deleted\n(jerry-debugger) delete 3\nBreakpoint 3 deleted\n(jerry-debugger) list\n=== Active breakpoints  ===\n 1: tests/debugger/do_delete.js:17\n 4: tests/debugger/do_delete.js:18\n(jerry-debugger) c\nStopped at breakpoint:4 tests/debugger/do_delete.js:18\n(jerry-debugger) c\n"
  },
  {
    "path": "tests/debugger/do_delete.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"delete tests\");\n\nvar x = 10;\nvar y = 10;\nvar pi = 3.14;\n\nfunction delete_test(x,y) {\n\tvar sum = x + y;\n\treturn\n}\n\ndelete_test(x, y);\n\nvar z = 0;\n"
  },
  {
    "path": "tests/debugger/do_delete_all.cmd",
    "content": "break do_delete_all.js:17\nb do_delete_all.js:18\nb do_delete_all.js:21\nb do_delete_all:350\ny\nb do_delete_all:37\ny\nlist\ndelete all\nnext\nc\n"
  },
  {
    "path": "tests/debugger/do_delete_all.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_delete_all.js:15\n(jerry-debugger) break do_delete_all.js:17\nBreakpoint 1 at tests/debugger/do_delete_all.js:17\n(jerry-debugger) b do_delete_all.js:18\nBreakpoint 2 at tests/debugger/do_delete_all.js:18\n(jerry-debugger) b do_delete_all.js:21\nBreakpoint 3 at tests/debugger/do_delete_all.js:21 (in delete_test() at line:20, col:1)\n(jerry-debugger) b do_delete_all:350\nNo breakpoint found, do you want to add a pending breakpoint? (y or [n]) Pending breakpoint 4 at do_delete_all:350\n(jerry-debugger) b do_delete_all:37\nNo breakpoint found, do you want to add a pending breakpoint? (y or [n]) Pending breakpoint 5 at do_delete_all:37\n(jerry-debugger) list\n=== Active breakpoints  ===\n 1: tests/debugger/do_delete_all.js:17\n 2: tests/debugger/do_delete_all.js:18\n 3: tests/debugger/do_delete_all.js:21 (in delete_test() at line:20, col:1)\n=== Pending breakpoints ===\n 4: do_delete_all:350 (pending)\n 5: do_delete_all:37 (pending)\n(jerry-debugger) delete all\n(jerry-debugger) next\nStopped at tests/debugger/do_delete_all.js:16\n(jerry-debugger) c\n"
  },
  {
    "path": "tests/debugger/do_delete_all.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = \"Delete all breakpoints\";\nvar patt = new RegExp(\"e\");\nvar res = patt.test(str);\nvar pi = Math.PI;\n\nfunction delete_test(x,y) {\n\tvar sum = x + y;\n}\n"
  },
  {
    "path": "tests/debugger/do_display.cmd",
    "content": "b a\nb b\nb c\nb d\ndisplay\nc\ndisplay 2\nc\ndisplay 5435\nc\ndisplay 0\nc\nc\n"
  },
  {
    "path": "tests/debugger/do_display.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_display.js:20\n(jerry-debugger) b a\nBreakpoint 1 at tests/debugger/do_display.js:15 (in a() at line:15, col:1)\n(jerry-debugger) b b\nBreakpoint 2 at tests/debugger/do_display.js:16 (in b() at line:16, col:1)\n(jerry-debugger) b c\nBreakpoint 3 at tests/debugger/do_display.js:17 (in c() at line:17, col:1)\n(jerry-debugger) b d\nBreakpoint 4 at tests/debugger/do_display.js:18 (in d() at line:18, col:1)\n(jerry-debugger) display\nNon-negative integer number expected, 0 turns off this function\n(jerry-debugger) c\nStopped at breakpoint:1 tests/debugger/do_display.js:15 (in a() at line:15, col:1)\n(jerry-debugger) display 2\n(jerry-debugger) c\nhi\nStopped at breakpoint:2 tests/debugger/do_display.js:16 (in b() at line:16, col:1)\nSource: tests/debugger/do_display.js\n  15   function a() { print(\"hi\"); }\n  16 > function b() { print(\"welcome\"); }\n  17   function c() { print(\"hello\"); }\n(jerry-debugger) display 5435\n(jerry-debugger) c\nwelcome\nStopped at breakpoint:3 tests/debugger/do_display.js:17 (in c() at line:17, col:1)\nSource: tests/debugger/do_display.js\n   1   // Copyright JS Foundation and other contributors, http://js.foundation\n   2   //\n   3   // Licensed under the Apache License, Version 2.0 (the \"License\");\n   4   // you may not use this file except in compliance with the License.\n   5   // You may obtain a copy of the License at\n   6   //\n   7   //     http://www.apache.org/licenses/LICENSE-2.0\n   8   //\n   9   // Unless required by applicable law or agreed to in writing, software\n  10   // distributed under the License is distributed on an \"AS IS\" BASIS\n  11   // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  12   // See the License for the specific language governing permissions and\n  13   // limitations under the License.\n  14   \n  15   function a() { print(\"hi\"); }\n  16   function b() { print(\"welcome\"); }\n  17 > function c() { print(\"hello\"); }\n  18   function d() { print(\"goodbye\"); }\n  19   \n  20   a();\n  21   b();\n  22   c();\n  23   d();\n(jerry-debugger) display 0\n(jerry-debugger) c\nhello\nStopped at breakpoint:4 tests/debugger/do_display.js:18 (in d() at line:18, col:1)\n(jerry-debugger) c\ngoodbye\n"
  },
  {
    "path": "tests/debugger/do_display.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction a() { print(\"hi\"); }\nfunction b() { print(\"welcome\"); }\nfunction c() { print(\"hello\"); }\nfunction d() { print(\"goodbye\"); }\n\na();\nb();\nc();\nd();\n"
  },
  {
    "path": "tests/debugger/do_eval.cmd",
    "content": "e a\nn\neval a\nbreak f\nn\np b\nnext\nprint b\ne \"1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 XXX 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 YYY 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ZZZ \" + 123\ne b = 8\nn\ne a\nc\n"
  },
  {
    "path": "tests/debugger/do_eval.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_eval.js:15\n(jerry-debugger) e a\nundefined\n(jerry-debugger) n\nStopped at tests/debugger/do_eval.js:23\n(jerry-debugger) eval a\n5\n(jerry-debugger) break f\nBreakpoint 1 at tests/debugger/do_eval.js:19 (in f() at line:17, col:1)\n(jerry-debugger) n\nStopped at breakpoint:1 tests/debugger/do_eval.js:19 (in f() at line:17, col:1)\n(jerry-debugger) p b\nundefined\n(jerry-debugger) next\nStopped at tests/debugger/do_eval.js:20 (in f() at line:17, col:1)\n(jerry-debugger) print b\n6\n(jerry-debugger) e \"1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 XXX 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 YYY 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ZZZ \" + 123\n1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 XXX 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 YYY 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ZZZ 123\n(jerry-debugger) e b = 8\n8\n(jerry-debugger) n\nStopped at tests/debugger/do_eval.js:24\n(jerry-debugger) e a\n11.3\n(jerry-debugger) c\n"
  },
  {
    "path": "tests/debugger/do_eval.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = 5;\n\nfunction f(a)\n{\n  var b = 6;\n  return a + b;\n}\n\na = f(3.3);\nnull;\n"
  },
  {
    "path": "tests/debugger/do_eval_at.cmd",
    "content": "eval_at 0\neval_at 0 b\nn\neval_at 0 b\nb do_eval_at.js:20\nn\nscope\neval_at 0 b\neval_at 1 b\neval_at 0 b=20\neval_at 1 b=100\nn\neval_at 0 a\nscope\neval_at 0 b\neval_at -1 b\neval_at 65536 b\neval_at b\neval_at 200\nc\n"
  },
  {
    "path": "tests/debugger/do_eval_at.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_eval_at.js:15\n(jerry-debugger) eval_at 0\nundefined\n(jerry-debugger) eval_at 0 b\nundefined\n(jerry-debugger) n\nStopped at tests/debugger/do_eval_at.js:23\n(jerry-debugger) eval_at 0 b\n2\n(jerry-debugger) b do_eval_at.js:20\nBreakpoint 1 at tests/debugger/do_eval_at.js:20 (in f() at line:17, col:1)\n(jerry-debugger) n\nStopped at breakpoint:1 tests/debugger/do_eval_at.js:20 (in f() at line:17, col:1)\n(jerry-debugger) scope\nlevel | type   \n0     | local  \n1     | global \n(jerry-debugger) eval_at 0 b\n6\n(jerry-debugger) eval_at 1 b\n2\n(jerry-debugger) eval_at 0 b=20\n20\n(jerry-debugger) eval_at 1 b=100\n100\n(jerry-debugger) n\nStopped at tests/debugger/do_eval_at.js:25\n(jerry-debugger) eval_at 0 a\n23\n(jerry-debugger) scope\nlevel | type   \n0     | global \n(jerry-debugger) eval_at 0 b\n100\n(jerry-debugger) eval_at -1 b\nError: Invalid scope chain index: -1 (must be between 0 and 65535)\n(jerry-debugger) eval_at 65536 b\nError: Invalid scope chain index: 65536 (must be between 0 and 65535)\n(jerry-debugger) eval_at b\nError: invalid literal for int() with base 10: 'b'\n(jerry-debugger) eval_at 200\nUncaught exception: Error\n(jerry-debugger) c\n"
  },
  {
    "path": "tests/debugger/do_eval_at.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar b = 2;\n\nfunction f(a)\n{\n  var b = 6;\n  return a + b;\n}\n\nvar a = f(3);\n\nnull;\n"
  },
  {
    "path": "tests/debugger/do_eval_syntax.cmd",
    "content": "n\neval loop\nc\n"
  },
  {
    "path": "tests/debugger/do_eval_syntax.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_eval_syntax.js:24\n(jerry-debugger) n\nStopped at tests/debugger/do_eval_syntax.js:26\n(jerry-debugger) eval loop\nUncaught exception: Error\n(jerry-debugger) c\nbar function\n"
  },
  {
    "path": "tests/debugger/do_eval_syntax.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction foo(loop)\n{\n    while(loop)\n    {\n        print(\"eval\");\n        print(\"syntax\");\n    }\n}\n\nvar a = 10;\n\neval(\"bar = function bar() {\\nprint('bar function') }\");\nbar();\n"
  },
  {
    "path": "tests/debugger/do_exception.cmd",
    "content": "c\nc\nc\nc\nquit\n"
  },
  {
    "path": "tests/debugger/do_exception.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_exception.js:15\n(jerry-debugger) c\nexception handler configuration test\nException throw detected (to disable automatic stop type exception 0)\nException hint: TypeError\nStopped around tests/debugger/do_exception.js:19 (in foo() at line:17, col:1)\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: ReferenceError\nStopped at tests/debugger/do_exception.js:24 (in foo() at line:17, col:1)\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: 456\nStopped at tests/debugger/do_exception.js:29 (in foo() at line:17, col:1)\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: RangeError: Bad range!\nStopped around tests/debugger/do_exception.js:34 (in foo() at line:17, col:1)\n(jerry-debugger) quit\n"
  },
  {
    "path": "tests/debugger/do_exception.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"exception handler configuration test\")\n\nfunction foo() {\n  try {\n    undefined();\n  } catch (e) {\n  }\n\n  try {\n    xxx();\n  } catch (e) {\n  }\n\n  try {\n    throw 456;\n  } catch (e) {\n  }\n\n  try {\n    throw new RangeError(\"Bad range!\");\n  } catch (e) {\n  }\n}\n\nfoo()\n"
  },
  {
    "path": "tests/debugger/do_finish.cmd",
    "content": "finish\nfinish\nfinish\nstep\nfinish\ncontinue\n"
  },
  {
    "path": "tests/debugger/do_finish.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_finish.js:15\n(jerry-debugger) finish\nfinish-test\nStopped at tests/debugger/do_finish.js:26\n(jerry-debugger) finish\nStopped at tests/debugger/do_finish.js:18 (in foo() at line:17, col:1)\n(jerry-debugger) finish\nfoo\nbar\nStopped at tests/debugger/do_finish.js:42\n(jerry-debugger) step\nStopped at tests/debugger/do_finish.js:29 (in dog() at line:28, col:1)\n(jerry-debugger) finish\n*bark*\n*sit*\n*bark*\nStopped at tests/debugger/do_finish.js:44\n(jerry-debugger) continue\nEND: finish-test\n"
  },
  {
    "path": "tests/debugger/do_finish.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"finish-test\");\n\nfunction foo() {\n  print(\"foo\");\n  return bar();\n}\n\nfunction bar() {\n  return \"bar\";\n}\n\nprint(foo());\n\nfunction dog() {\n  bark();\n  sit();\n  bark();\n}\n\nfunction bark() {\n  print(\"*bark*\");\n}\n\nfunction sit() {\n  print(\"*sit*\");\n}\n\ndog();\n\nprint(\"END: finish-test\");\n"
  },
  {
    "path": "tests/debugger/do_help.cmd",
    "content": "help\nquit\n"
  },
  {
    "path": "tests/debugger/do_help.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_help.js:15\n(jerry-debugger) help\n\nDocumented commands (type help <topic>):\n========================================\nEOF        bt        dump       f         ms     quit     scroll  variables\nabort      c         e          finish    n      res      source\nb          continue  eval       help      next   restart  src   \nbacktrace  delete    eval_at    list      p      s        step  \nbreak      display   exception  memstats  print  scope    throw \n\n(jerry-debugger) quit\n"
  },
  {
    "path": "tests/debugger/do_help.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"help tests\");\n"
  },
  {
    "path": "tests/debugger/do_list.cmd",
    "content": "b do_list.js:18\nb do_list.js:19\nlist\nquit\n"
  },
  {
    "path": "tests/debugger/do_list.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_list.js:15\n(jerry-debugger) b do_list.js:18\nBreakpoint 1 at tests/debugger/do_list.js:18\n(jerry-debugger) b do_list.js:19\nBreakpoint 2 at tests/debugger/do_list.js:19\n(jerry-debugger) list\n=== Active breakpoints  ===\n 1: tests/debugger/do_list.js:18\n 2: tests/debugger/do_list.js:19\n(jerry-debugger) quit\n"
  },
  {
    "path": "tests/debugger/do_list.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"list tests\");\n\nvar x = 10;\nvar y = 10;\nvar pi = 3.14;\nvar z = x + y;\n"
  },
  {
    "path": "tests/debugger/do_next.cmd",
    "content": "next\nnext\nn\nn\nnext\nn\nnext\nc\n"
  },
  {
    "path": "tests/debugger/do_next.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_next.js:15\n(jerry-debugger) next\nnext test\nStopped at tests/debugger/do_next.js:28\n(jerry-debugger) next\nFunc\nStopped at tests/debugger/do_next.js:30\n(jerry-debugger) n\nStopped at tests/debugger/do_next.js:33\n(jerry-debugger) n\nFunc\nStopped at tests/debugger/do_next.js:35\n(jerry-debugger) next\nStopped at tests/debugger/do_next.js:39\n(jerry-debugger) n\nStopped at tests/debugger/do_next.js:40\n(jerry-debugger) next\nStopped at tests/debugger/do_next.js:42\n(jerry-debugger) c\n"
  },
  {
    "path": "tests/debugger/do_next.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"next test\");\n\nfunction test()\n{\n  function f()\n  {\n    return 0;\n  }\n\n  print(\"Func\");\n  return f;\n}\n\nvar f = test(),\n    g,\n    h = f();\n\n{\n  let a = test(),\n      b,\n      c = a();\n}\n\n\neval(\"(function () {} `a`)\")\ngc();\n\nf();\n"
  },
  {
    "path": "tests/debugger/do_pending_breakpoints.cmd",
    "content": "break :1\ny\nbreak f\ny\nlist\nc\nlist\nc\nc\n"
  },
  {
    "path": "tests/debugger/do_pending_breakpoints.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_pending_breakpoints.js:15\n(jerry-debugger) break :1\nNo breakpoint found, do you want to add a pending breakpoint? (y or [n]) Pending breakpoint 1 at :1\n(jerry-debugger) break f\nNo breakpoint found, do you want to add a pending breakpoint? (y or [n]) Pending breakpoint 2 at f()\n(jerry-debugger) list\n=== Pending breakpoints ===\n 1: :1 (pending)\n 2: f() (pending)\n(jerry-debugger) c\npending-breakpoints\nBreakpoint 3 at <unknown>:1\nBreakpoint 4 at <unknown>:3 (in f() at line:2, col:1)\nStopped at breakpoint:3 <unknown>:1\n(jerry-debugger) list\n=== Active breakpoints  ===\n 3: <unknown>:1\n 4: <unknown>:3 (in f() at line:2, col:1)\n(jerry-debugger) c\nStopped at breakpoint:4 <unknown>:3 (in f() at line:2, col:1)\n(jerry-debugger) c\n"
  },
  {
    "path": "tests/debugger/do_pending_breakpoints.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"pending-breakpoints\");\n\neval(\"1;\\nfunction f()\\n{ return 5 }\");\n\nvar bird = \"colibri\";\nf();\nvar a = 234;\n"
  },
  {
    "path": "tests/debugger/do_print.cmd",
    "content": "c\n"
  },
  {
    "path": "tests/debugger/do_print.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_print.js:15\n(jerry-debugger) c\nHello world!\nA [  ] 110 null true undefined\n\n[A\nB C\nD E\nF\nG]\n1: Az élet gyönyörű.\n2: Az élet gyönyörű.\n3: Az élet gyönyörű.\n4: Az élet gyönyörű.\n5: Az élet gyönyörű.\n6: Az élet gyönyörű.\n7: Az élet gyönyörű.\n8: Az élet gyönyörű.\n9: Az élet gyönyörű.\n10: Az élet gyönyörű.\n\n"
  },
  {
    "path": "tests/debugger/do_print.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"Hello world!\");\nprint(\"A\", \"[\", \"\", \"]\", 1.1e2, null, true, undefined);\nprint();\nprint(\"[A\\nB\", \"C\\nD\", \"E\\nF\\nG]\");\n\nvar s = \"\";\n\nfor (i = 1; i <= 10; i++) {\n  /* Translated from hungarian: life is beautiful */\n  s += i + \": Az élet gyönyörű.\\n\";\n}\n\n/* Long string with non-ascii characters. */\nprint(s);\n"
  },
  {
    "path": "tests/debugger/do_quit.cmd",
    "content": "quit\n"
  },
  {
    "path": "tests/debugger/do_quit.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_quit.js:15\n(jerry-debugger) quit\n"
  },
  {
    "path": "tests/debugger/do_quit.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint(\"quit test\");\n\nfunction func() {\n  'use strict';\n  'use stri' + 'ct';\n}\n\n{\n  {\n    print(\"quit\");\n  }\n}\n\n;\n;\n\nvar\n  x =\n    1,\n  y =\n    2\n\ntest = function\n(\n)\n{\n}\n"
  },
  {
    "path": "tests/debugger/do_restart.cmd",
    "content": "n\nn\nn\nrestart\n"
  },
  {
    "path": "tests/debugger/do_restart.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_restart.js:23\n(jerry-debugger) n\nStopped at tests/debugger/do_restart.js:24\n(jerry-debugger) n\nfoo\nStopped at tests/debugger/do_restart.js:25\n(jerry-debugger) n\nbar\nStopped at tests/debugger/do_restart.js:24\n(jerry-debugger) restart\nConnecting to: localhost:5001\nStopped at tests/debugger/do_restart.js:23\n(jerry-debugger) continue\nfoo\nbar\nfoo\nbar\n"
  },
  {
    "path": "tests/debugger/do_restart.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction foo() {\n  print(\"foo\");\n}\n\nfunction bar() {\n  print(\"bar\");\n}\n\nfor (var i = 0; i < 2; i++) {\n  foo();\n  bar();\n}\n"
  },
  {
    "path": "tests/debugger/do_scope.cmd",
    "content": "scope\nb do_scope.js:22\nc\nscope\nc\nscope\nb do_scope.js:28\nc\nscope\nb do_scope.js:31\nc\nscope\nb do_scope.js:33\nc\nscope\nb do_scope.js:35\nc\nscope\nc\n"
  },
  {
    "path": "tests/debugger/do_scope.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_scope.js:15\n(jerry-debugger) scope\nlevel | type   \n0     | global \n(jerry-debugger) b do_scope.js:22\nBreakpoint 1 at tests/debugger/do_scope.js:22 (in f() at line:17, col:1)\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: error\nStopped at tests/debugger/do_scope.js:19 (in f() at line:17, col:1)\n(jerry-debugger) scope\nlevel | type   \n0     | local  \n1     | global \n(jerry-debugger) c\nStopped at breakpoint:1 tests/debugger/do_scope.js:22 (in f() at line:17, col:1)\n(jerry-debugger) scope\nlevel | type   \n0     | catch  \n1     | local  \n2     | global \n(jerry-debugger) b do_scope.js:28\nBreakpoint 2 at tests/debugger/do_scope.js:28 (in function() at line:27, col:4)\n(jerry-debugger) c\nStopped at breakpoint:2 tests/debugger/do_scope.js:28 (in function() at line:27, col:4)\n(jerry-debugger) scope\nlevel | type    \n0     | local   \n1     | closure \n2     | global  \n(jerry-debugger) b do_scope.js:31\nBreakpoint 3 at tests/debugger/do_scope.js:31 (in function() at line:27, col:4)\n(jerry-debugger) c\nStopped at breakpoint:3 tests/debugger/do_scope.js:31 (in function() at line:27, col:4)\n(jerry-debugger) scope\nlevel | type    \n0     | with    \n1     | local   \n2     | closure \n3     | global  \n(jerry-debugger) b do_scope.js:33\nBreakpoint 4 at tests/debugger/do_scope.js:33 (in function() at line:27, col:4)\n(jerry-debugger) c\nStopped at breakpoint:4 tests/debugger/do_scope.js:33 (in function() at line:27, col:4)\n(jerry-debugger) scope\nlevel | type    \n0     | with    \n1     | with    \n2     | local   \n3     | closure \n4     | global  \n(jerry-debugger) b do_scope.js:35\nBreakpoint 5 at tests/debugger/do_scope.js:35 (in function() at line:27, col:4)\n(jerry-debugger) c\nStopped at breakpoint:5 tests/debugger/do_scope.js:35 (in function() at line:27, col:4)\n(jerry-debugger) scope\nlevel | type    \n0     | with    \n1     | local   \n2     | closure \n3     | global  \n(jerry-debugger) c\n"
  },
  {
    "path": "tests/debugger/do_scope.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar c = 4;\n\nfunction f() {\n  try {\n    throw \"error\";\n  }\n  catch (err) {\n    var c = 10;\n  }\n\n  var z = true;\n  var g = 0;\n  (function() {\n    var a = [1,2,3]\n    a.y = \"abc\";\n    with (a) {\n      var h = [4,5,6]\n      with (h) {\n        h.d = \"dfg\"\n      }\n      a.d = g + c;\n    }\n  })();\n}\n\nf();\n\n"
  },
  {
    "path": "tests/debugger/do_src.cmd",
    "content": "b f\nn\nnext\ns\nsource 0\nn\nstep\nsrc\nc\n"
  },
  {
    "path": "tests/debugger/do_src.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_src.js:19\n(jerry-debugger) b f\nBreakpoint 1 at tests/debugger/do_src.js:16 (in f() at line:15, col:1)\n(jerry-debugger) n\nStopped at breakpoint:1 tests/debugger/do_src.js:16 (in f() at line:15, col:1)\n(jerry-debugger) next\nF1\nStopped at tests/debugger/do_src.js:20\n(jerry-debugger) s\nStopped at <unknown>:1\n(jerry-debugger) source 0\n   1 > f = function f() {\n   2   print('F2') }\n(jerry-debugger) n\nStopped at tests/debugger/do_src.js:21\n(jerry-debugger) step\nStopped at <unknown>:2 (in f() at line:1, col:5)\n(jerry-debugger) src\n   1   f = function f() {\n   2 > print('F2') }\n(jerry-debugger) c\nF2\n"
  },
  {
    "path": "tests/debugger/do_src.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f() {\n  print(\"F1\");\n}\n\nf();\neval(\"f = function f() {\\nprint('F2') }\");\nf();\n"
  },
  {
    "path": "tests/debugger/do_step.cmd",
    "content": "step\nstep\nbacktrace\nnext\nbt\nnext\ns\nn\nbt\nc\n"
  },
  {
    "path": "tests/debugger/do_step.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_step.js:32\n(jerry-debugger) step\nStopped at tests/debugger/do_step.js:22 (in f1() at line:15, col:1)\n(jerry-debugger) step\nStopped at tests/debugger/do_step.js:19 (in g() at line:17, col:3)\n(jerry-debugger) backtrace\nFrame 0: tests/debugger/do_step.js:19 (in g() at line:17, col:3)\nFrame 1: tests/debugger/do_step.js:22 (in f1() at line:15, col:1)\nFrame 2: tests/debugger/do_step.js:32\n(jerry-debugger) next\nStopped at tests/debugger/do_step.js:23 (in f1() at line:15, col:1)\n(jerry-debugger) bt\nFrame 0: tests/debugger/do_step.js:23 (in f1() at line:15, col:1)\nFrame 1: tests/debugger/do_step.js:32\n(jerry-debugger) next\nStopped at tests/debugger/do_step.js:33\n(jerry-debugger) s\nStopped at tests/debugger/do_step.js:28 (in f2() at line:26, col:1)\n(jerry-debugger) n\nStopped at tests/debugger/do_step.js:29 (in f2() at line:26, col:1)\n(jerry-debugger) bt\nFrame 0: tests/debugger/do_step.js:29 (in f2() at line:26, col:1)\nFrame 1: tests/debugger/do_step.js:33\n(jerry-debugger) c\n"
  },
  {
    "path": "tests/debugger/do_step.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f1()\n{\n  function g()\n  {\n    return 6;\n  }\n\n  var i = g();\n  g();\n}\n\nfunction f2()\n{\n  f1();\n  return 7;\n}\n\nf1();\nf2();\n"
  },
  {
    "path": "tests/debugger/do_throw.cmd",
    "content": "s\ns\ns\ns\ns\nthrow new Error('Escape')\nthrow new Error('Once upon a time there lived in a certain village a little country girl, the prettiest creature who was ever seen. Her mother was excessively fond of her; and her grandmother doted on her still more. This good woman had a little red riding hood made for her. It suited the girl so extremely well that everybody called her Little Red Riding Hood. One day her mother, having made some cakes, said to her, \"Go, my dear, and see how your grandmother is doing, for I hear she has been very ill. Take her a cake, and this little pot of butter.\"')\neval e.message.length\nthrow new Error('Exit')\n"
  },
  {
    "path": "tests/debugger/do_throw.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_throw.js:23\n(jerry-debugger) s\nStopped at tests/debugger/do_throw.js:24\n(jerry-debugger) s\nStopped at tests/debugger/do_throw.js:26\n(jerry-debugger) s\nStopped at tests/debugger/do_throw.js:27\n(jerry-debugger) s\nStopped at tests/debugger/do_throw.js:20 (in g() at line:19, col:1)\n(jerry-debugger) s\nStopped at tests/debugger/do_throw.js:16 (in f() at line:15, col:1)\n(jerry-debugger) throw new Error('Escape')\nStopped at tests/debugger/do_throw.js:31\n(jerry-debugger) throw new Error('Once upon a time there lived in a certain village a little country girl, the prettiest creature who was ever seen. Her mother was excessively fond of her; and her grandmother doted on her still more. This good woman had a little red riding hood made for her. It suited the girl so extremely well that everybody called her Little Red Riding Hood. One day her mother, having made some cakes, said to her, \"Go, my dear, and see how your grandmother is doing, for I hear she has been very ill. Take her a cake, and this little pot of butter.\"')\nStopped at tests/debugger/do_throw.js:34\n(jerry-debugger) eval e.message.length\n538\n(jerry-debugger) throw new Error('Exit')\nUnhandled exception: Error: Exit\n"
  },
  {
    "path": "tests/debugger/do_throw.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f() {\n  return 32;\n}\n\nfunction g() {\n  f();\n}\n\ntry {\n  try {\n\n    while (true) {\n      g();\n    }\n\n  } catch (e) {\n    var s = \"Stop here\";\n  }\n} catch (e) {\n  var s = \"Stop here again\";\n}\n"
  },
  {
    "path": "tests/debugger/do_throw_adv.cmd",
    "content": "c\ns\nc\nc\nc\nc\nc\nc\nc\nc\nc\n"
  },
  {
    "path": "tests/debugger/do_throw_adv.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_throw_adv.js:15\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: 2\nStopped at tests/debugger/do_throw_adv.js:18 (in f() at line:17, col:1)\n(jerry-debugger) s\nStopped at tests/debugger/do_throw_adv.js:32\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: 4\nStopped at tests/debugger/do_throw_adv.js:18 (in f() at line:17, col:1)\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: Catch again\nStopped at tests/debugger/do_throw_adv.js:41\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: 7\nStopped at tests/debugger/do_throw_adv.js:18 (in f() at line:17, col:1)\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: 10\nStopped at tests/debugger/do_throw_adv.js:18 (in f() at line:17, col:1)\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: Replace the other error\nStopped at tests/debugger/do_throw_adv.js:63\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: 13\nStopped at tests/debugger/do_throw_adv.js:18 (in f() at line:17, col:1)\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: Should be caught\nStopped at tests/debugger/do_throw_adv.js:76\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: 16\nStopped at tests/debugger/do_throw_adv.js:18 (in f() at line:17, col:1)\n(jerry-debugger) c\nUnhandled exception: 16\n"
  },
  {
    "path": "tests/debugger/do_throw_adv.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = 1;\n\nfunction f() {\n  throw ++a;\n}\n\nfunction g() {\n  f();\n}\n\nfunction h() {\n  g();\n}\n\ntry {\n  h();\n} catch (e) {\n  ++a;\n}\n\ntry {\n  h();\n} catch (e) {\n  ++a;\n\n  try {\n    throw \"Catch again\";\n  } catch (e) {\n    ++a;\n  }\n}\n\ntry {\n  try {\n    h();\n  } finally {\n    ++a;\n  }\n  ++a; /* Should not happen. */\n} catch (e) {\n  ++a;\n}\n\ntry {\n  try {\n    h();\n  } finally {\n    ++a;\n    throw \"Replace the other error\";\n  }\n} catch (e) {\n  ++a;\n}\n\ntry {\n  break_try_label: try {\n    h();\n  } finally {\n    ++a;\n    break break_try_label;\n  }\n  throw \"Should be caught\";\n} catch (e) {\n  ++a;\n}\n\nh();\n"
  },
  {
    "path": "tests/debugger/do_variables.cmd",
    "content": "scope\nvariables\nvariables 1\nvariables 0\nb tests/debugger/do_variables.js:20\nc\nscope\nvariables 0\nvariables 1\nvariables 2\nb tests/debugger/do_variables.js:30\nc\nscope\nvariables 1\nvariables 0\nb tests/debugger/do_variables.js:33\nc\nc\nscope\nvariables 0\nvariables 1\nb tests/debugger/do_variables.js:50\nc\nscope\nvariables 0\nvariables 1\nvariables 2\nc\n"
  },
  {
    "path": "tests/debugger/do_variables.expected",
    "content": "Connecting to: localhost:5001\nStopped at tests/debugger/do_variables.js:15\n(jerry-debugger) scope\nlevel | type   \n0     | global \n(jerry-debugger) variables\nname        | type      | value     \nf           | Function  |           \naddX        | Function  |           \nz           | undefined | undefined \nc           | undefined | undefined \ncreateRealm | Function  |           \nsourceName  | Function  |           \nprint       | Function  |           \ngc          | Function  |           \nassert      | Function  |           \n(jerry-debugger) variables 1\nname | type | value \n(jerry-debugger) variables 0\nname        | type      | value     \nf           | Function  |           \naddX        | Function  |           \nz           | undefined | undefined \nc           | undefined | undefined \ncreateRealm | Function  |           \nsourceName  | Function  |           \nprint       | Function  |           \ngc          | Function  |           \nassert      | Function  |           \n(jerry-debugger) b tests/debugger/do_variables.js:20\nBreakpoint 1 at tests/debugger/do_variables.js:20 (in function() at line:19, col:10)\n(jerry-debugger) c\nStopped at breakpoint:1 tests/debugger/do_variables.js:20 (in function() at line:19, col:10)\n(jerry-debugger) scope\nlevel | type    \n0     | local   \n1     | closure \n2     | global  \n(jerry-debugger) variables 0\nname | type      | value     \nb    | undefined | undefined \nn    | Number    | 9         \n(jerry-debugger) variables 1\nname | type   | value \nx    | Number | 3     \n(jerry-debugger) variables 2\nname        | type     | value \naddThree    | Function |       \nf           | Function |       \naddX        | Function |       \nz           | Number   | 5     \nc           | Number   | 4     \ncreateRealm | Function |       \nsourceName  | Function |       \nprint       | Function |       \ngc          | Function |       \nassert      | Function |       \n(jerry-debugger) b tests/debugger/do_variables.js:30\nBreakpoint 2 at tests/debugger/do_variables.js:30 (in f() at line:28, col:1)\n(jerry-debugger) c\nStopped at breakpoint:2 tests/debugger/do_variables.js:30 (in f() at line:28, col:1)\n(jerry-debugger) scope\nlevel | type   \n0     | local  \n1     | global \n(jerry-debugger) variables 1\nname        | type     | value \nd           | Number   | 12    \naddThree    | Function |       \nf           | Function |       \naddX        | Function |       \nz           | Number   | 5     \nc           | Number   | 4     \ncreateRealm | Function |       \nsourceName  | Function |       \nprint       | Function |       \ngc          | Function |       \nassert      | Function |       \n(jerry-debugger) variables 0\nname | type      | value     \nb    | undefined | undefined \nx    | undefined | undefined \nuser | undefined | undefined \nm    | undefined | undefined \nc    | undefined | undefined \n(jerry-debugger) b tests/debugger/do_variables.js:33\nBreakpoint 3 at tests/debugger/do_variables.js:33 (in f() at line:28, col:1)\n(jerry-debugger) c\nException throw detected (to disable automatic stop type exception 0)\nException hint: error\nStopped at breakpoint:2 tests/debugger/do_variables.js:30 (in f() at line:28, col:1)\n(jerry-debugger) c\nStopped at breakpoint:3 tests/debugger/do_variables.js:33 (in f() at line:28, col:1)\n(jerry-debugger) scope\nlevel | type   \n0     | catch  \n1     | local  \n2     | global \n(jerry-debugger) variables 0\nname | type   | value \nerr  | String | error \n(jerry-debugger) variables 1\nname | type      | value     \nb    | undefined | undefined \nx    | undefined | undefined \nuser | undefined | undefined \nm    | undefined | undefined \nc    | undefined | undefined \n(jerry-debugger) b tests/debugger/do_variables.js:50\nBreakpoint 4 at tests/debugger/do_variables.js:50 (in function() at line:46, col:4)\n(jerry-debugger) c\nStopped at breakpoint:4 tests/debugger/do_variables.js:50 (in function() at line:46, col:4)\n(jerry-debugger) scope\nlevel | type    \n0     | with    \n1     | local   \n2     | closure \n3     | global  \n(jerry-debugger) variables 0\nname | type   | value \ny    | String | abc   \n0    | Number | 1     \n1    | Number | 2     \n2    | Number | 3     \n(jerry-debugger) variables 1\nname | type      | value     \nh    | undefined | undefined \na    | Array     | [1,2,3]   \n(jerry-debugger) variables 2\nname | type    | value           \nb    | Number  | 10              \nx    | Boolean | true            \nuser | Object  | [object Object] \nm    | Null    | null            \nc    | Number  | 10              \n(jerry-debugger) c\n"
  },
  {
    "path": "tests/debugger/do_variables.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar c = 4;\nvar z = 5;\n\nfunction addX(x) {\n  return function(n) {\n    var b = 2;\n    return n + x;\n  }\n}\n\naddThree = addX(3);\nd = addThree(c+z);\n\nfunction f() {\n  try {\n    throw \"error\";\n  }\n  catch (err) {\n    var c = 10;\n  }\n\n  var m = null;\n\n  var user = {\n    name: \"John\",\n    age: 30\n  };\n\n  var x = true;\n  var b = 10;\n\n  (function() {\n    var a = [1,2,3]\n    a.y = \"abc\";\n    with (a) {\n      var h = [4,5,6]\n      with (h) {\n        h.d = \"dfg\"\n      }\n      a.d = x;\n    }\n  })();\n}\n\nf();\n\n"
  },
  {
    "path": "tests/hello.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint (\"Hello JerryScript!\");\n"
  },
  {
    "path": "tests/jerry/and-or.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction fail() {\n  assert (0);\n  return true;\n}\n\nif (false && fail()) {\n  assert (0);\n}\n\nif (true && false && fail()) {\n  assert (0);\n}\n\nif (true || fail()) {\n} else {\n  assert (0);\n}\n\nif (false || true || fail()) {\n} else {\n  assert (0);\n}\n"
  },
  {
    "path": "tests/jerry/argument-spread.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax\n\nfunction mustThrow(str) {\n  try {\n    eval(str);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n}\n\nfunction assertArrayEqual(actual, expected) {\n  assert(actual.length === expected.length);\n\n  for (var i = 0; i < actual.length; i++) {\n    assert(actual[i] === expected[i]);\n  }\n}\n\n// Spread syntax\nfunction sum(x, y, z) {\n  return x + y + z;\n}\n\nconst numbers = [1, 2, 3];\n\nassert(sum(...numbers) === 6);\n\n// Replace apply()\nfunction myFunction (v, w, x, y, z) {\n  return v + w + x + y + z;\n}\nvar args = [0, 1];\n\nassert(myFunction (-1, ...args, 2, ...[3]) == 5);\n\n// Apply for new\nvar dateFields = [1970, 0, 1];\nvar d = new Date(...dateFields);\n\nassert(d.toString().substring(0, 24) === \"Thu Jan 01 1970 00:00:00\");\n\nfunction applyAndNew(constructor, args) {\n   function partial () {\n      return constructor.apply (this, args);\n   };\n   if (typeof constructor.prototype === \"object\") {\n      partial.prototype = Object.create(constructor.prototype);\n   }\n   return partial;\n}\n\nfunction myConstructor () {\n   assertArrayEqual(arguments, myArguments);\n   this.prop1 = \"val1\";\n   this.prop2 = \"val2\";\n};\n\nvar myArguments = [\"hi\", \"how\", \"are\", \"you\", \"mr\", null];\nvar myConstructorWithArguments = applyAndNew(myConstructor, myArguments);\n\nvar obj = new myConstructorWithArguments;\nassert(Object.keys(obj).length === 2);\nassert(obj.prop1 === \"val1\");\nassert(obj.prop2 === \"val2\");\n\n// Test spread prop call\nvar o = { f(a,b,c) { return a + b + c },\n          g(a,b) { throw new TypeError (\"5\") }\n        };\n\nassert (o.f(...[\"a\", \"b\", \"c\"]) === \"abc\");\n\nmustThrow (\"o.g (...[1,2])\")\n\n// Test spread super call\nclass MyArray extends Array {\n  constructor(...args) {\n    super(...args);\n  }\n}\n\nvar array = new MyArray(1, 2, 3);\nassertArrayEqual(array, [1,2,3]);\nassert(array instanceof MyArray);\nassert(array instanceof Array);\n\nfunction argumentOrderTest() {\n  var result = []\n  for (i = 0; i < arguments.length; i++) {\n      result.push(arguments[i]);\n  }\n\n  return result;\n}\n\nassertArrayEqual(argumentOrderTest(1, 2, ...[3, 4]), [1, 2, 3, 4]);\n"
  },
  {
    "path": "tests/jerry/arguments-iterator.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrayPrototypeValues = Array.prototype.values;\n\nfunction f_mapped() {\n  assert(typeof arguments[Symbol.iterator] === 'function');\n  assert(arguments[Symbol.iterator] === arrayPrototypeValues);\n  assert(Object.hasOwnProperty.call(arguments, Symbol.iterator));\n\n  let sum = 0;\n  for (a of arguments) {\n    sum += a;\n  }\n  return sum;\n};\n\nfunction f_unmapped(b = 2) {\n  assert(typeof arguments[Symbol.iterator] === 'function');\n  assert(arguments[Symbol.iterator] === arrayPrototypeValues);\n  assert(Object.hasOwnProperty.call(arguments, Symbol.iterator));\n\n  let sum = 0;\n  for (a of arguments) {\n    sum += a;\n  }\n  return sum;\n};\n\nassert(f_mapped(1, 2, 3, 4, 5) === 15);\nassert(f_unmapped(1, 2, 3, 4, 5) === 15);\n\nObject.defineProperty(Array.prototype, \"values\", { get : function () {\n  /* should not be executed */\n  assert(false);\n}});\n\nassert(f_mapped(1, 2, 3, 4, 5) === 15);\nassert(f_unmapped(1, 2, 3, 4, 5) === 15);\n"
  },
  {
    "path": "tests/jerry/arguments-parse.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_parse_error (txt) {\n  try {\n    eval (txt)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\nfunction f_args (a,b,c) {\n  return arguments;\n}\n\ncheck_parse_error (\"f_args (1 2 3)\");\ncheck_parse_error (\"f_args (1; 2; 3)\");\ncheck_parse_error (\"f_args (())\");\ncheck_parse_error (\"f_args (1, 2, 3\");\ncheck_parse_error (\"f_args 1, 2, 3)\");\ncheck_parse_error (\"f_args 1, 2, 3\");\ncheck_parse_error (\"f_args 1; 2; 3\");\ncheck_parse_error (\"f_args{1, 2, 3}\");\n"
  },
  {
    "path": "tests/jerry/arguments.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f_arg (arguments)\n{\n  return arguments;\n}\nassert (f_arg (1) === 1);\n\nfunction f (a, b, c)\n{\n  return arguments;\n}\n\nargs = f();\nassert (args[0] === undefined);\n\nargs = f (1, 2, 3, 4, 5);\nassert (args[0] === 1);\nassert (args[1] === 2);\nassert (args[2] === 3);\nassert (args[3] === 4);\nassert (args[4] === 5);\nassert (args[5] === undefined);\n\nassert (args.callee === f);\nassert (typeof args.caller === 'undefined');\n\nfunction g (a, b, c)\n{\n  assert (arguments[0] === 1);\n  assert (arguments[1] === undefined);\n  assert (arguments[2] === undefined);\n\n  a = 'a';\n  b = 'b';\n  c = 'c';\n\n  assert (arguments[0] === 'a');\n  assert (arguments[1] === 'b');\n  assert (arguments[2] === 'c');\n\n  arguments [0] = 1;\n  arguments [1] = 2;\n  arguments [2] = 3;\n\n  assert (a === 1);\n  assert (b === 2);\n  assert (c === 3);\n\n  delete arguments [0];\n  arguments[0] = 'new value';\n  assert (a === 1);\n\n  a = 'a';\n  b = 'b';\n  c = 'c';\n\n  assert (arguments[0] === 'new value');\n  assert (arguments[1] === 'b');\n  assert (arguments[2] === 'c');\n}\n\ng (1);\n\nfn_expr = function (a, b, c)\n{\n  'use strict';\n\n  assert (arguments[0] === 1);\n  assert (arguments[1] === undefined);\n  assert (arguments[2] === undefined);\n\n  a = 'a';\n  b = 'b';\n  c = 'c';\n\n  assert (arguments[0] === 1);\n  assert (arguments[1] === undefined);\n  assert (arguments[2] === undefined);\n\n  arguments [0] = 1;\n  arguments [1] = 'p';\n  arguments [2] = 'q';\n\n  assert (a === 'a');\n  assert (b === 'b');\n  assert (c === 'c');\n\n  delete arguments [0];\n  arguments[0] = 'new value';\n  assert (a === 'a');\n\n  a = 'a';\n  b = 'b';\n  c = 'c';\n\n  assert (arguments[0] === 'new value');\n  assert (arguments[1] === 'p');\n  assert (arguments[2] === 'q');\n\n  function check_type_error_for_property (obj, prop) {\n    try {\n      var v = obj[prop];\n      assert (false);\n    }\n    catch (e) {\n      assert (e instanceof TypeError);\n    }\n  }\n\n  check_type_error_for_property (arguments, 'callee');\n}\n\nfn_expr (1);\n\n(function () {\n var a = [arguments];\n})();\n\nfunction nested_args()\n{\n  var a;\n  for (var i = 0; i < 1; i++)\n  {\n    if (i == 0)\n    {\n      a = arguments[i];\n    }\n  }\n  assert(a === 3);\n}\nnested_args(3);\n\n\nfunction f1(a, b, c)\n{\n  'use strict';\n  assert(!Object.hasOwnProperty(arguments,'caller'));\n}\n\nf1(1, 2, 3);\n\n// Normal arguments access\n\nfunction f2(a = arguments)\n{\n  assert(arguments[1] === 2)\n  var arguments = 1\n  assert(arguments === 1)\n  assert(a[1] === 2)\n}\nf2(undefined, 2)\n\nfunction f3(a = arguments)\n{\n  assert(arguments() === \"X\")\n  function arguments() { return \"X\" }\n  assert(arguments() === \"X\")\n  assert(a[1] === \"R\")\n}\nf3(undefined, \"R\")\n\nfunction f4(a = arguments)\n{\n  const arguments = 3.25\n  assert(arguments === 3.25)\n  assert(a[1] === -1.5)\n}\nf4(undefined, -1.5)\n\n// Normal arguments access with eval\n\nfunction f5(a = arguments)\n{\n  assert(arguments[1] === 2)\n  var arguments = 1\n  assert(arguments === 1)\n  assert(a[1] === 2)\n  eval()\n}\nf5(undefined, 2)\n\nfunction f6(a = arguments)\n{\n  assert(arguments() === \"X\")\n  function arguments() { return \"X\" }\n  assert(arguments() === \"X\")\n  assert(a[1] === \"R\")\n  eval()\n}\nf6(undefined, \"R\")\n\nfunction f7(a = arguments)\n{\n  const arguments = 3.25\n  assert(arguments === 3.25)\n  assert(a[1] === -1.5)\n  eval()\n}\nf7(undefined, -1.5)\n\n// Argument access through a function\n\nfunction f8(a = () => arguments)\n{\n  assert(arguments[1] === 2)\n  var arguments = 1\n  assert(arguments === 1)\n  assert(a()[1] === 2)\n}\nf8(undefined, 2)\n\nfunction f9(a = () => arguments)\n{\n  assert(arguments() === \"X\")\n  function arguments() { return \"X\" }\n  assert(arguments() === \"X\")\n  assert(a()[1] === \"R\")\n}\nf9(undefined, \"R\")\n\nfunction f10(a = () => arguments)\n{\n  let arguments = 3.25\n  assert(arguments === 3.25)\n  assert(a()[1] === -1.5)\n}\nf10(undefined, -1.5)\n\n// Argument access through an eval\n\nfunction f11(a = eval(\"() => arguments\"))\n{\n  assert(arguments[1] === 2)\n  var arguments = 1\n  assert(arguments === 1)\n  assert(a()[1] === 2)\n}\nf11(undefined, 2)\n\nfunction f12(a = eval(\"() => arguments\"))\n{\n  assert(arguments() === \"X\")\n  function arguments() { return \"X\" }\n  assert(arguments() === \"X\")\n  assert(a()[1] === \"R\")\n}\nf12(undefined, \"R\")\n\nfunction f13(a = eval(\"() => arguments\"))\n{\n  const arguments = 3.25\n  assert(arguments === 3.25)\n  assert(a()[1] === -1.5)\n}\nf13(undefined, -1.5)\n\n// Other cases\n\ntry {\n  function f14(a = arguments)\n  {\n    assert(a[1] === 6)\n    arguments;\n    let arguments = 1;\n  }\n  f14(undefined, 6)\n  assert(false)\n} catch (e) {\n  assert(e instanceof ReferenceError)\n}\n\ntry {\n  eval(\"'use strict'; function f(a = arguments) { arguments = 5; eval() }\");\n  assert(false)\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n\nfunction f15()\n{\n  assert(arguments[0] === \"A\")\n  var arguments = 1\n  assert(arguments === 1)\n}\nf15(\"A\")\n\nfunction f16()\n{\n  assert(arguments() === \"W\")\n  function arguments() { return \"W\" }\n  assert(arguments() === \"W\")\n}\nf16(\"A\")\n\nfunction f17(a = arguments = \"Val\")\n{\n  assert(arguments === \"Val\")\n}\nf17();\n\nfunction f18(s = (v) => arguments = v, g = () => arguments)\n{\n  const arguments = -3.25\n  s(\"X\")\n\n  assert(g() === \"X\")\n  assert(arguments === -3.25)\n}\nf18()\n\nfunction f19(e = (v) => eval(v))\n{\n  var arguments = -12.5\n  e(\"arguments[0] = 4.5\")\n\n  assert(e(\"arguments[0]\") === 4.5)\n  assert(e(\"arguments[1]\") === \"A\")\n  assert(arguments === -12.5)\n}\nf19(undefined, \"A\");\n\nfunction f20 (arguments, a = eval('arguments')) {\n  assert(a === 3.1);\n  assert(arguments === 3.1);\n}\nf20(3.1);\n\nfunction f21 (arguments, a = arguments) {\n  assert(a === 3.1);\n  assert(arguments === 3.1);\n}\nf21(3.1);\n\nfunction f22 (arguments, [a = arguments]) {\n  assert(a === 3.1);\n  assert(arguments === 3.1);\n}\nf22(3.1, []);\n\ntry {\n  function f23(p = eval(\"var arguments\"), arguments)\n  {\n  }\n  f23()\n  assert(false)\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n\ntry {\n  function f24(p = eval(\"var arguments\")) {\n    let arguments;\n  }\n  f24()\n  assert(false)\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n\ntry {\n  function f25(p = eval(\"var arguments\")) {\n    function arguments() { }\n  }\n  f25()\n  assert(false)\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n\nfunction f26(arguments, eval = () => eval()) {\n  assert(arguments === undefined);\n}\nf26(undefined);\n"
  },
  {
    "path": "tests/jerry/arithmetic-parse.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (txt) {\n  try {\n    eval (txt)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\nvar a = 21;\nvar b = 10;\nvar c;\n\ncheck_syntax_error (\"c =  a++b\");\ncheck_syntax_error (\"c =  a--b\");\n\ncheck_syntax_error (\"c = a +* b\");\ncheck_syntax_error (\"c = a -* b\");\ncheck_syntax_error (\"c = a +/ b\");\ncheck_syntax_error (\"c = a -/ b\");\ncheck_syntax_error (\"c = a +% b\");\ncheck_syntax_error (\"c = a -% b\");\n\ncheck_syntax_error (\"a =* b\");\ncheck_syntax_error (\"a =/ b\");\ncheck_syntax_error (\"a =% b\");\n\ncheck_syntax_error (\"c = a+\");\ncheck_syntax_error (\"c = a-\");\n\ncheck_syntax_error(\"a++\\n()\");\ncheck_syntax_error(\"a--\\n.b\");\n\nassert((-2 .toString()) === -2);\n\nNumber.prototype[0] = 123;\nassert(-2[0] === -123);\n\nfunction f() {\n  var a = 0;\n  function g() {}\n\n  try {\n    eval (\"g(this, 'a' = 1)\");\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n\n  try {\n    eval (\"g(this, 'a' += 1)\");\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n\n  assert (a === 0);\n}\nf();\n\nfunction g(a, b)\n{\n  assert(b === \"undefined\");\n}\ng(this, typeof undeclared_var)\n\nfunction h()\n{\n  var done = false;\n  var o = { a: function () { done = (this === o) } }\n  function f() {}\n\n  with (o) {\n    f(this, a());\n  }\n  assert(done);\n}\nh();\n"
  },
  {
    "path": "tests/jerry/arithmetics-2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = 21;\nvar b = 10;\nvar c;\n\nc = a + b;\nassert(c == 31);\n\nc = a - b;\nassert(c == 11);\n\nc = a * b;\nassert(c == 210);\n\nc = a / b;\nassert(c >= 2.1 - 0.000001 && c <= 2.1 + 0.000001);\n\nc = a % b;\nassert(c == 1);\n\nc = a++;\nassert(c == 21);\n\nc = a--;\nassert(c == 22);\n\nvar o = { p : 1 };\n\nassert (++o.p === 2);\nassert (o.p === 2);\nassert (--o.p === 1);\nassert (o.p === 1);\n\ntry {\n  eval ('++ ++ a');\n  assert (false);\n}\ncatch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (0.1 + 0.2 != 0.3);\n"
  },
  {
    "path": "tests/jerry/arithmetics-3.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar o1 = { valueOf() { return Symbol() } }\nvar o2 = { valueOf() { throw \"Should not reach here\" } }\n\nfunction check_type_error(code) {\n  try {\n    eval(code)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n  }\n}\n\ncheck_type_error(\"o1 - o2\")\ncheck_type_error(\"o1 * o2\")\ncheck_type_error(\"o1 / o2\")\ncheck_type_error(\"o1 % o2\")\ncheck_type_error(\"o1 ** o2\")\ncheck_type_error(\"o1 | o2\")\ncheck_type_error(\"o1 & o2\")\ncheck_type_error(\"o1 ^ o2\")\ncheck_type_error(\"o1 << o2\")\ncheck_type_error(\"o1 >> o2\")\ncheck_type_error(\"o1 >>> o2\")\n"
  },
  {
    "path": "tests/jerry/arithmetics-bignums.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar big = 2147483646;\n\nbig++;\nassert(big == 2147483647);\n\nbig += 1;\nassert(big == 2147483648); // overflow on 32bit numbers\n\nbig++;\nassert(big == 2147483649); // overflow on 32bit numbers\n\nassert ((1152921504606846976).toString() === \"1152921504606847000\");\n\nassert (1.797693134862315808e+308 === Infinity);\n\nassert (9999999999999999 == 10000000000000000);\n\nassert((9007199254740993).toString() === \"9007199254740992\");\n\nassert((9007199254740992).toString() === \"9007199254740992\");\n\nassert((9007199254740994).toString() === \"9007199254740994\");\n\nassert((1.00517e+21).toString() === \"1.0051699999999999e+21\");\n\nassert((1.00001e+21).toString() === \"1.0000099999999999e+21\");\n\nassert((9007199254740995).toString() === \"9007199254740996\");\n\nassert((18014398509481989).toString() === \"18014398509481988\");\n\nassert((18014398509481990).toString() === \"18014398509481992\");\n\nassert((18014398509481991).toString() === \"18014398509481992\");\n\nassert((18014398509481993).toString() === \"18014398509481992\");\n\nassert((18014398509481994).toString() === \"18014398509481992\");\n\nassert((18014398509481997).toString() === \"18014398509481996\");\n\nassert((18014398509481998).toString() === \"18014398509482000\");\n\n"
  },
  {
    "path": "tests/jerry/arithmetics.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert((1 + 2) == 3);\nassert((2 + 1) == 3);\nassert((2 + 1) != 4);\n\nassert((7 + 7) == 14);\nassert((7 - 7) == 0);\nassert((7 * 7) == 49);\nassert((7 / 7) == 1);\nassert((7 + 7) == 14);\nassert((7 % 7) == 0);\n\nvar number = 81;\nassert((number + 9) == 90);\nassert((number - 9) == 72);\nassert((number * 10) == 810);\nassert((number / 9) == 9);\nassert((number % 79) == 2);\n\nvar num1 = 1234567, num2 = 1234000;\nassert((num1 % num2) == 567);\n\nassert (1 / (-1 % -1) < 0);\nassert (1 / (-1 % 1) < 0);\nassert (1 / (1 % -1) > 0);\nassert (1 / (1 % 1) > 0);\n\nassert (eval (\"x\\n\\n=\\n\\n6\\n\\n/\\n\\n3\") === 2)\n"
  },
  {
    "path": "tests/jerry/array-from.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2014 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n// Some methods are taken from v8/test/mjsunit/mjsunit.js\n\nfunction classOf(object) {\n  // Argument must not be null or undefined.\n  var string = Object.prototype.toString.call(object);\n  // String has format [object <ClassName>].\n  return string.substring(8, string.length - 1);\n}\n\n/**\n * Compares two objects for key/value equality.\n * Returns true if they are equal, false otherwise.\n */\nfunction deepObjectEquals(a, b) {\n  var aProps = Object.keys(a);\n  aProps.sort();\n  var bProps = Object.keys(b);\n  bProps.sort();\n  if (!deepEquals(aProps, bProps)) {\n    return false;\n  }\n  for (var i = 0; i < aProps.length; i++) {\n    if (!deepEquals(a[aProps[i]], b[aProps[i]])) {\n      return false;\n    }\n  }\n  return true;\n}\n\nvar assertInstanceof = function assertInstanceof(obj, type) {\n  if (!(obj instanceof type)) {\n    var actualTypeName = null;\n    var actualConstructor = Object.getPrototypeOf(obj).constructor;\n    if (typeof actualConstructor == \"function\") {\n      actualTypeName = actualConstructor.name || String(actualConstructor);\n    } print(\"Object <\" + obj + \"> is not an instance of <\" + (type.name || type) + \">\" + (actualTypeName ? \" but of < \" + actualTypeName + \">\" : \"\"));\n  }\n};\n\nfunction deepEquals(a, b) {\n  if (a === b) {\n    if (a === 0) return (1 / a) === (1 / b);\n    return true;\n  }\n  if (typeof a != typeof b) return false;\n  if (typeof a == \"number\") return isNaN(a) && isNaN(b);\n  if (typeof a !== \"object\" && typeof a !== \"function\") return false;\n  var objectClass = classOf(a);\n  if (objectClass !== classOf(b)) return false;\n  if (objectClass === \"RegExp\") {\n    return (a.toString() === b.toString());\n  }\n  if (objectClass === \"Function\") return false;\n  if (objectClass === \"Array\") {\n    var elementCount = 0;\n    if (a.length != b.length) {\n      return false;\n    }\n    for (var i = 0; i < a.length; i++) {\n      if (!deepEquals(a[i], b[i]))\n      return false;\n    }\n    return true;\n  }\n  if (objectClass == \"String\" || objectClass == \"Number\" || objectClass == \"Boolean\" || objectClass == \"Date\") {\n    if (a.valueOf() !== b.valueOf()) return false;\n  }\n  return deepObjectEquals(a, b);\n}\n\nvar assertEquals = function assertEquals(expected, found, name_opt) {\n  if (!deepEquals(found, expected)) {\n    assert(false);\n  }\n};\n\nfunction assertArrayLikeEquals(value, expected, type) {\n  assertInstanceof(value, type);\n  assert(expected.length === value.length);\n  for (var i=0; i<value.length; ++i) {\n    assertEquals(expected[i], value[i]);\n  }\n}\n\nassert(1 === Array.from.length);\n\n// Assert that constructor is called with \"length\" for array-like objects\n\nvar myCollectionCalled = false;\nfunction MyCollection(length) {\n  myCollectionCalled = true;\n  assert(1 === arguments.length);\n\n  assert(5 === length);\n}\n\nArray.from.call(MyCollection, {length: 5});\nassert(myCollectionCalled === true);\n// Assert that calling mapfn with / without thisArg in sloppy and strict modes\n// works as expected.\n\nvar global = this;\nfunction non_strict(){ assert(global === this); }\nfunction strict(){ \"use strict\"; assert(void 0 === this); }\nfunction strict_null(){ \"use strict\"; assert(null === this); }\nArray.from([1], non_strict);\nArray.from([1], non_strict, void 0);\nArray.from([1], strict);\nArray.from([1], strict, void 0);\n\nfunction testArrayFrom(thisArg, constructor) {\n  assertArrayLikeEquals(Array.from.call(thisArg, [], undefined), [], constructor);\n  assertArrayLikeEquals(Array.from.call(thisArg, NaN), [], constructor);\n  assertArrayLikeEquals(Array.from.call(thisArg, Infinity), [], constructor);\n  assertArrayLikeEquals(Array.from.call(thisArg, 10000000), [], constructor);\n  assertArrayLikeEquals(Array.from.call(thisArg, 'test'), ['t', 'e', 's', 't'], constructor);\n\n  assertArrayLikeEquals(Array.from.call(thisArg,\n    { length: 1, '0': { 'foo': 'bar' } }), [{'foo': 'bar'}], constructor);\n  assertArrayLikeEquals(Array.from.call(thisArg, { length: -1, '0': { 'foo': 'bar' } }), [], constructor);\n  assertArrayLikeEquals(Array.from.call(thisArg,\n    [ 'foo', 'bar', 'baz' ]), ['foo', 'bar', 'baz'], constructor);\n  var kSet = new Set(['foo', 'bar', 'baz']);\n  assertArrayLikeEquals(Array.from.call(thisArg, kSet), ['foo', 'bar', 'baz'], constructor);\n  var kMap = new Map(['foo', 'bar', 'baz'].entries());\n  assertArrayLikeEquals(Array.from.call(thisArg, kMap), [[0, 'foo'], [1, 'bar'], [2, 'baz']], constructor);\n  assertArrayLikeEquals(Array.from.call(thisArg, 'test', function(x) {\n    return this.filter(x);\n  }, {\n    filter: function(x) { return x.toUpperCase(); }\n  }), ['T', 'E', 'S', 'T'], constructor);\n  assertArrayLikeEquals(Array.from.call(thisArg, 'test', function(x) {\n    return x.toUpperCase();\n  }), ['T', 'E', 'S', 'T'], constructor);\n\n  try {\n    Array.from.call(thisArg, null);\n    assert(false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Array.from.call(thisArg, undefined);\n    assert(false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Array.from.call(thisArg, [], null);\n    assert(false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Array.from.call(thisArg, [], \"noncallable\");\n    assert(false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  var nullIterator = {};\n  nullIterator[Symbol.iterator] = null;\n  assertArrayLikeEquals(Array.from.call(thisArg, nullIterator), [],\n  constructor);\n\n  var nonObjIterator = {};\n  nonObjIterator[Symbol.iterator] = function() { return \"nonObject\"; };\n\n  try {\n    Array.from.call(thisArg, nonObjIterator);\n    assert(false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Array.from.call(thisArg, [], null);\n    assert(false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  // Ensure iterator is only accessed once, and only invoked once\n  var called = false;\n  var arr = [1, 2, 3];\n  var obj = {};\n\n  // Test order --- only get iterator method once\n  function testIterator() {\n    assert(called !== \"@@iterator should be called only once\");\n    called = true;\n    assert(obj === this);\n    return arr[Symbol.iterator]();\n  }\n  var getCalled = false;\n  Object.defineProperty(obj, Symbol.iterator, {\n    get: function() {\n      assert(getCalled !== \"@@iterator should be accessed only once\");\n      getCalled = true;\n      return testIterator;\n    },\n    set: function() {\n      // \"@@iterator should not be set\"\n      assert(false);\n    }\n  });\n  assertArrayLikeEquals(Array.from.call(thisArg, obj), [1, 2, 3], constructor);\n}\n\nfunction Other() {}\n\nvar boundFn = (function() {}).bind(Array, 27);\n\ntestArrayFrom(Array, Array);\ntestArrayFrom(null, Array);\ntestArrayFrom({}, Array);\ntestArrayFrom(Object, Object);\ntestArrayFrom(Other, Other);\ntestArrayFrom(Math.cos, Array);\ntestArrayFrom(boundFn, boundFn);\n\n// Assert that [[DefineOwnProperty]] is used in ArrayFrom, meaning a\n// setter isn't called, and a failed [[DefineOwnProperty]] will throw.\nvar setterCalled = 0;\nfunction exotic() {\n  Object.defineProperty(this,  '0', {\n    get: function() { return 2; },\n    set: function() { setterCalled++; }\n  });\n}\n\n// Non-configurable properties can't be overwritten with DefineOwnProperty\n// The setter wasn't called\ntry {\n  Array.from.call(exotic, [1]);\n  assert(false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert( 0 === setterCalled);\n\n// Non-callable iterators should cause a TypeError before calling the target\n// constructor.\nitems = {};\nitems[Symbol.iterator] = 7;\nfunction TestError() {}\nfunction ArrayLike() { throw new TestError() }\n\ntry {\n  Array.from.call(ArrayLike, items);\n  assert(false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// Check that array properties defined are writable, enumerable, configurable\nfunction ordinary() { }\nvar x = Array.from.call(ordinary, [2]);\nvar xlength = Object.getOwnPropertyDescriptor(x, 'length');\nassert(1 === xlength.value);\nassert(true === xlength.writable);\nassert(true === xlength.enumerable);\nassert(true === xlength.configurable);\nvar x0 = Object.getOwnPropertyDescriptor(x, 0);\nassert(2 === x0.value);\nassert(true === xlength.writable);\nassert(true === xlength.enumerable);\nassert(true === xlength.configurable);\n\n/* Test iterator close */\nfunction __createIterableObject (arr, methods) {\n  methods = methods || {};\n  if (typeof Symbol !== 'function' || !Symbol.iterator) {\n    return {};\n  }\n  arr.length++;\n  var iterator = {\n    next: function() {\n      return { value: arr.shift(), done: arr.length <= 0 };\n    },\n    'return': methods['return'],\n    'throw': methods['throw']\n  };\n  var iterable = {};\n  iterable[Symbol.iterator] = function () { return iterator; };\n  return iterable;\n};\n\nfunction close1() {\n  var closed = false;\n  var iter = __createIterableObject([1, 2, 3], {\n      'return': function() { closed = true; return {}; }\n  });\n\n  try {\n    Array.from(iter, x => { throw 5 });\n    assert(false);\n  } catch (e) {\n    assert(e === 5);\n  }\n\n  return closed;\n}\nassert(close1());\n\nfunction close2() {\n  var closed = false;\n  var iter = __createIterableObject([1, 2, 3], {\n      'return': function() { closed = true; throw 6 }\n  });\n\n  try {\n    Array.from(iter, x => { throw 5 });\n    assert(false);\n  } catch (e) {\n    assert(e === 5);\n  }\n\n  return closed;\n}\nassert(close2());\n\n"
  },
  {
    "path": "tests/jerry/array-isarray.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Array.isArray([]) === true);\nassert(Array.isArray([1]) === true);\nassert(Array.isArray(new Array()) === true);\nassert(Array.isArray(new Array('a', 'b', 'c', 'd')) === true);\nassert(Array.isArray(new Array(3)) === true);\nassert(Array.isArray(Array.prototype) === true);\nassert(Array.isArray(new Proxy([], {})) === true);\n\nassert(Array.isArray() === false);\nassert(Array.isArray({}) === false);\nassert(Array.isArray(null) === false);\nassert(Array.isArray(undefined) === false);\nassert(Array.isArray(17) === false);\nassert(Array.isArray('Array') === false);\nassert(Array.isArray(true) === false);\nassert(Array.isArray(false) === false);\nassert(Array.isArray(new Uint8Array(32)) === false);\nassert(Array.isArray({ __proto__: Array.prototype }) === false);\n\nvar revocable = Proxy.revocable ({}, {});\nvar proxy = revocable.proxy;\nrevocable.revoke();\n\ntry {\n  Array.isArray(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar revocable = Proxy.revocable ([], {});\nvar proxy = revocable.proxy;\n\nassert(Array.isArray(proxy) === true);\n"
  },
  {
    "path": "tests/jerry/array-new-target-support.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction F (){}\nvar obj = Reflect.construct (Array, [], F);\nobj[2] = 'foo';\nassert (obj.length === 3 && obj instanceof F);\n\ntry {\n  Reflect.construct (Array, [-1], F);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\nvar o = new Proxy (function f () {}, { get (t,p,r) { if (p == \"prototype\") { throw \"Kitten\" } Reflect.get (...arguments) }})\n\ntry {\n  Reflect.construct (Array, [], o)\n} catch (e) {\n  assert (e === \"Kitten\");\n}\n"
  },
  {
    "path": "tests/jerry/array-of.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Test with regular inputs\nvar array1 = Array.of(1, 2, 3, 4, 5);\nassert(array1.length === 5);\nassert(array1[2] === 3);\n\n// Test with no input\nvar array2 = Array.of();\nassert(array2.length === 0);\nassert(array2[0] === undefined);\n\n// Test when an input is another array\nvar array3 = Array.of(array1, 6, 7);\nassert(array3.length === 3);\nassert(array3[0] instanceof Array);\nassert(array3[0][3] === 4);\nassert(array3[2] === 7);\n\n// Test with undefined\nvar array4 = Array.of(undefined);\nassert(array4.length === 1);\nassert(array4[0] === undefined);\n\n// Test when input is an object\nvar obj = {\n  0: 0,\n  1: 1\n};\n\nvar array5 = Array.of(obj, 2, 3);\nassert(array5[0] instanceof Object);\nassert(array5[0][0] === 0);\nassert(array5[0][1] === 1);\nassert(array5[2] === 3);\n\n// Test with array holes\nvar array6 = Array.of.apply(null, [,,undefined]);\nassert(array6.length === 3);\nassert(array6[0] === undefined);\n\n// Test with another class\nvar hits = 0;\nfunction Test() {\n    hits++;\n}\nTest.of = Array.of;\n\nhits = 0;\nvar array6 = Test.of(1, 2);\nassert(hits === 1);\nassert(array6.length === 2);\nassert(array6[1] === 2);\n\n// Test with bounded builtin function\nvar boundedBuiltinFn = Array.of.bind(Array);\nvar array7 = Array.of.call(boundedBuiltinFn, boundedBuiltinFn);\nassert(array7.length === 1);\nassert(array7[0] === boundedBuiltinFn);\n\n// Test superficial features\nvar desc = Object.getOwnPropertyDescriptor(Array, \"of\");\nassert(desc.configurable === true);\nassert(desc.writable === true);\nassert(desc.enumerable === false);\nassert(Array.of.length === 0);\n"
  },
  {
    "path": "tests/jerry/array-pattern.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction checkSyntax (str) {\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\nfunction assertArrayEqual (actual, expected) {\n  assert (actual.length === expected.length);\n\n  for (var i = 0; i < actual.length; i++) {\n    assert (actual[i] === expected[i]);\n  }\n}\n\nfunction mustThrow (str) {\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n}\n\nfunction mustNotThrow (str) {\n  try {\n    eval (str);\n  } catch (e) {\n    assert (false);\n  }\n}\n\ncheckSyntax (\"var [a]\");\ncheckSyntax (\"var [a, o.a]\");\ncheckSyntax (\"var [a, ...b,]\");\ncheckSyntax (\"var [a, ...b = 4]\");\ncheckSyntax (\"var [a, ...[b] = 4]\");\ncheckSyntax (\"var [let]\");\ncheckSyntax (\"var [get = []\");\ncheckSyntax (\"var [get : 5]\");\ncheckSyntax (\"var [[a = {},]\");\ncheckSyntax (\"let [a,a] = []\");\ncheckSyntax (\"let [a, ...a] = []\");\ncheckSyntax (\"const [a,a] = []\");\ncheckSyntax (\"const [a, ...a] = []\");\ncheckSyntax (\"[new Object()] = []\");\ncheckSyntax (\"[Object()] = []\");\ncheckSyntax (\"[(a, b, d, c)] = []\");\ncheckSyntax (\"[super] = []\");\ncheckSyntax (\"[this] = []\");\ncheckSyntax (\"[()] = []\");\ncheckSyntax (\"try { let [$] = $;\");\ncheckSyntax (\"let a, [ b.c ] = [6];\");\ncheckSyntax (\"let [(a)] = [1]\");\ncheckSyntax (\"[...a = []] = [1]\");\ncheckSyntax (\"[...[a] = []] = [1]\");\ncheckSyntax (\"[...[a, [...b] = []] = []] = [1]\");\n\nmustThrow (\"var [a] = 4\");\nmustThrow (\"var [a] = 5\");\nmustThrow (\"var [a] = {}\");\nmustThrow (\"var [a] = { get [Symbol.iterator] () { throw new TypeError } }\");\nmustThrow (\"var [a] = { [Symbol.iterator] () {} }\");\nmustThrow (\"var [a] = { [Symbol.iterator] () { return {} } }\");\nmustThrow (\"var [a] = { [Symbol.iterator] () { return { next: 5 } } }\");\nmustThrow (\"var [a] = { [Symbol.iterator] () { return { next: 5 } } }\");\nmustThrow (\"var [a] = { [Symbol.iterator] () { return { get next() { throw new TypeError } } } }\");\nmustThrow (\"var [a] = { [Symbol.iterator] () { return { next () { } } } }\");\nmustThrow (\"var [a] = { [Symbol.iterator] () { return { next () { } } } }\");\nmustThrow (\"var [a] = { [Symbol.iterator] () { return { next () { return { get value () { throw new TypeError }}}}}}\");\nmustThrow (\"var [a] = { [Symbol.iterator] () { return { next () { return { get done () { throw new TypeError }}}}}}\");\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment\n\n// Basic variable assignment\n(function () {\n  var foo = [\"one\", \"two\", \"three\"];\n\n  var [red, yellow, green] = foo;\n  assert (red === \"one\");\n  assert (yellow === \"two\");\n  assert (green === \"three\");\n}) ();\n\n// Assignment separate from declaration\n(function () {\n  var a, b;\n\n  [a, b] = [1, 2];\n  assert (a === 1);\n  assert (b === 2);\n}) ();\n\n// Default values\n(function () {\n  var a, b;\n  [a = 5, b = 7] = [1];\n\n  assert (a === 1);\n  assert (b === 7);\n}) ();\n\n// Swapping variables\n(function () {\n  var a = 1;\n  var b = 3;\n\n  [a, b] = [b, a];\n  assert (a === 3);\n  assert (b === 1);\n\n  var arr = [1,2,3];\n  [arr[2], arr[1]] = [arr[1], arr[2]];\n  assertArrayEqual (arr, [1, 3, 2]);\n}) ();\n\n// Parsing an array returned from a function\n(function () {\n  function f() {\n    return [1, 2];\n  }\n\n  var a, b;\n  [a, b] = f();\n  assert (a === 1);\n  assert (b === 2);\n}) ();\n\n// Ignoring some returned values\n(function () {\n  function f() {\n    return [1, 2, 3];\n  }\n\n  var a, b;\n  [a, ,b] = f();\n  assert (a === 1);\n  assert (b === 3);\n}) ();\n\n// Ignoring some returned values\n(function () {\n  var [a, ...b] = [1, 2, 3];\n  assert (a === 1);\n  assertArrayEqual (b, [2, 3]);\n}) ();\n\n// Unpacking values from a regular expression match\n(function () {\n  function parseProtocol(url) {\n    var parsedURL = /^(\\w+)\\:\\/\\/([^\\/]+)\\/(.*)$/.exec(url);\n    if (!parsedURL) {\n      return false;\n    }\n\n    var [, protocol, fullhost, fullpath] = parsedURL;\n    return protocol;\n  }\n\n  assert (parseProtocol(\"https://developer.mozilla.org/en-US/Web/JavaScript\") === \"https\");\n}) ();\n\n// Test inner patterns I.\n(function () {\n  let [a, [b, [c = 4, d = 5]], [e] = [6]] = [1, [2, [3,undefined]]];\n\n  assert (a === 1);\n  assert (b === 2);\n  assert (c === 3);\n  assert (d === 5);\n  assert (e === 6);\n}) ();\n\n// Test inner patterns II.\n(function () {\n  var o = {};\n  [a, b, c, o.a = 4, o.b, o.c = 3] = [\"1\", \"2\", \"3\", undefined, \"8\", \"6\"];\n\n  assert (a === \"1\");\n  assert (b === \"2\");\n  assert (c === \"3\");\n  assert (o.a === 4);\n  assert (o.b === \"8\");\n  assert (o.c === \"6\");\n}) ();\n\n// Test rest element I.\n(function () {\n  var o = {};\n  [...o.a] = [\"1\", \"2\", \"3\"];\n\n  assertArrayEqual (o.a, [\"1\", \"2\", \"3\"]);\n}) ();\n\n// Test rest element II.\n(function () {\n  [...[a,b,c]] = [\"1\", \"2\", \"3\"];\n\n  assert (a === \"1\");\n  assert (b === \"2\");\n  assert (c === \"3\");\n}) ();\n\n// Test inner object pattern I.\n(function () {\n  [{f : a, g : b}, , , ...[c, d, e]] = [{ f : \"1\", g : \"2\"}, 3, 4, 5, 6, 7];\n\n  assert (a === \"1\");\n  assert (b === \"2\");\n  assert (c === 5);\n  assert (d === 6);\n  assert (e === 7);\n}) ();\n\n// Multiple declaration\n(function () {\n  var [a] = [1], [b] = [2];\n\n  assert (a === 1);\n  assert (b === 2);\n}) ();\n\n// Force the creation of lexical environment I.\n(function () {\n  const [a] = [1];\n  eval();\n\n  assert (a === 1);\n}) ();\n\n// Force the creation of lexical environment II.\n(function () {\n  let [a] = [1];\n  eval();\n\n  assert (a === 1);\n}) ();\n\n// Check the parsing of AssignmentElement\n(function () {\n  var a = 6;\n  [((a))] = [7];\n  assert (a === 7);\n}) ();\n\n// Test iterator closing\nfunction __createIterableObject (arr, methods) {\n  methods = methods || {};\n  if (typeof Symbol !== 'function' || !Symbol.iterator) {\n    return {};\n  }\n  arr.length++;\n  var iterator = {\n    next: function() {\n      return { value: arr.shift(), done: arr.length <= 0 };\n    },\n    'return': methods['return'],\n    'throw': methods['throw']\n  };\n  var iterable = {};\n  iterable[Symbol.iterator] = function () { return iterator; };\n  return iterable;\n};\n\n(function () {\n  var closed = false;\n  var iter = __createIterableObject([1, 2, 3], {\n    'return': function() { closed = true; return {}; }\n  });\n  var [a, b] = iter;\n  assert (closed === true);\n  assert (a === 1);\n  assert (b === 2);\n}) ();\n\n(function () {\n  var value = { y: \"42\" };\n  var x = {};\n  var assignmentResult, iterationResult, iter;\n\n  iter = (function*() {\n    assignmentResult = { y: x[yield] } = value;\n  }());\n\n  iterationResult = iter.next();\n\n  assert (assignmentResult === undefined);\n  assert (iterationResult.value === undefined);\n  assert (iterationResult.done === false);\n  assert (x.prop === undefined);\n\n  iterationResult = iter.next('prop');\n\n  assert (assignmentResult === value);\n  assert (iterationResult.value === undefined);\n  assert (iterationResult.done === true);\n  assert (x.prop === \"42\");\n}) ();\n\n(function () {\n  var value = { foo: \"42\" };\n  var x = {};\n  var assignmentResult, iterationResult, iter;\n\n  iter = (function*() {\n    assignmentResult = { ['f' + 'o' + 'o']: x[yield] } = value;\n  }());\n\n  iterationResult = iter.next();\n\n  assert (assignmentResult === undefined);\n  assert (iterationResult.value === undefined);\n  assert (iterationResult.done === false);\n  assert (x.prop === undefined);\n\n  iterationResult = iter.next('prop');\n\n  assert (assignmentResult === value);\n  assert (iterationResult.value === undefined);\n  assert (iterationResult.done === true);\n  assert (x.prop === \"42\");\n}) ();\n\nmustThrow (`var iter = __createIterableObject([],\n           { get 'return'() { throw new TypeError() }});\n           var [a] = iter`);\n\nmustNotThrow (`var iter = __createIterableObject([],\n              { 'return': 5 });\n              var [a] = iter`);\n\nmustNotThrow (`var iter = __createIterableObject([],\n              { 'return': function() { return 5; }});\n              var [a] = iter`);\n\nmustThrow (`try { throw 5 } catch (e) {\n            var iter = __createIterableObject([],\n            { get 'return'() { throw new TypeError() }});\n            var [a] = iter }`);\n\nmustNotThrow (`try { throw 5 } catch (e) {\n              var iter = __createIterableObject([],\n              { 'return': 5 });\n              var [a] = iter }`);\n\nmustNotThrow (`try { throw 5 } catch (e) {\n              var iter = __createIterableObject([],\n              { 'return': function() { return 5; }});\n              var [a] = iter }`);\n\ntry {\n  eval (\"var a = 0; 1 + [a] = [1]\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-at.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar obj = {};\nvar array = ['Apple', 'Banana', \"zero\", 0, obj, 'Apple'];\n\nvar index = array.at(0);\nassert(index === 'Apple');\nassert(array[index] === undefined);\n\nassert(array.at(array.length) === undefined);\nassert(array.at(array.length+1) === undefined);\nassert(array.at(array.length-1) === 'Apple');\nassert(array.at(\"1\") === 'Banana');\nassert(array.at(-1) === 'Apple');\nassert(array.at(\"-1\") === 'Apple');\nassert(array.at(\"-20\") === undefined);\n\n/* 7 */\nvar obj = {}\nobj.length = 1;\nObject.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\nobj.at = Array.prototype.at;\n\ntry {\n  obj.at(0);\n  assert(false);\n} catch(e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\ntry {\n  Array.prototype.at.call(undefined)\n  assert (false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-concat.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [\"foo\", [], Infinity, 4]\nvar new_arr = array.concat();\n\nassert(new_arr.length === array.length)\nfor (i = 0; i < array.length; i++) {\n  assert(array[i] === new_arr[i]);\n}\n\nvar obj = { concat : Array.prototype.concat };\nvar arr1 = [\"Apple\", 6, \"Peach\"];\nvar arr2 = [obj, \"Cherry\", \"Grape\"];\n\nvar new_array = obj.concat(arr1);\nassert(new_array.length === 4);\nassert(new_array[0] === obj);\nassert(new_array[1] === \"Apple\");\nassert(new_array[2] === 6);\nassert(new_array[3] === \"Peach\");\n\nvar new_array = arr1.concat(arr2, obj, 1);\n\nassert(new_array.length === 8);\nassert(new_array[0] === \"Apple\");\nassert(new_array[1] === 6);\nassert(new_array[2] === \"Peach\");\nassert(new_array[3] === obj);\nassert(new_array[4] === \"Cherry\");\nassert(new_array[5] === \"Grape\");\nassert(new_array[6] === obj);\nassert(new_array[7] === 1);\n\nvar arr1 = [1,2];\nvar arr2 = [4,5,6,7,8];\nvar arr3 = [,,9,10];\nvar arr4 = [];\nvar expected = [1,2,4,5,6,7,8,,,9,10];\n\nvar result = arr1.concat(arr2, arr3, arr4);\n\nassert(result.length === expected.length)\nfor (i = 0; i < result.length; i++) {\n  assert(result[i] === expected[i]);\n}\n\nvar arr1 = [];\narr1.length = 2;\nvar arr2 = [];\narr2.length = 3;\nassert(arr1.concat(arr2).length === arr1.length + arr2.length);\n\n// Checking behavior when unable to get element\nvar arr = []\nObject.defineProperty(arr, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\narr.length = 1;\n\ntry {\n  arr.concat();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n/* ES v5.1 15.4.4.4.5.\n   Checking behavior when unable to get element from a given array */\narr1 = [];\narr2 = [];\narr3 = [];\nObject.defineProperty(arr2, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  arr1.concat(arr2, arr3);\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-copywithin.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {};\n\n// Checking behavior with normal inputs\nvar array = [\"foo\", 1, \"bar\", obj, 2, \"baz\"];\nassert(array.copyWithin(2,0,6).toString() === \"foo,1,foo,1,bar,[object Object]\");\nassert(array.copyWithin(0,1,3).toString() === \"1,foo,foo,1,bar,[object Object]\");\nassert(array.copyWithin(3,0,4).toString() === \"1,foo,foo,1,foo,foo\");\n\n// Checking behavior with default inputs\nvar array = [\"foo\", 1, \"bar\", obj, 2, \"baz\"];\nassert(array.copyWithin().toString() === \"foo,1,bar,[object Object],2,baz\");\nassert(array.copyWithin(2).toString() === \"foo,1,foo,1,bar,[object Object]\");\nassert(array.copyWithin(1,4).toString() === \"foo,bar,[object Object],1,bar,[object Object]\");\n\n// Checking behavior when argument is negative or bigger then length\nvar array = [\"foo\", 1, \"bar\", obj, 2, \"baz\"];\nassert(array.copyWithin(12,3,-3).toString() === \"foo,1,bar,[object Object],2,baz\");\nassert(array.copyWithin(-2,-4,3).toString() === \"foo,1,bar,[object Object],bar,baz\");\nassert(array.copyWithin(1,-5,30).toString() === \"foo,1,bar,[object Object],bar,baz\");\n\n// Checking behavior with undefined, NaN, +/- Infinity\nvar array = [\"foo\", 1, \"bar\", obj, 2, \"baz\"];\nassert(array.copyWithin(undefined).toString() === \"foo,1,bar,[object Object],2,baz\");\nassert(array.copyWithin(2, NaN).toString()=== \"foo,1,foo,1,bar,[object Object]\");\nassert(array.copyWithin(2,undefined,5).toString() === \"foo,1,foo,1,foo,1\");\n\nvar array = [\"foo\", 1, \"bar\", obj, 2, \"baz\"];\nassert(array.copyWithin(Infinity,2,NaN).toString() === \"foo,1,bar,[object Object],2,baz\");\nassert(array.copyWithin(Infinity,-Infinity,4).toString()=== \"foo,1,bar,[object Object],2,baz\");\nassert(array.copyWithin(NaN,0,3).toString() === \"foo,1,bar,[object Object],2,baz\");\n\n// Checking behavior when no length property defined\nvar obj = { copyWithin : Array.prototype.copyWithin };\n\nobj.copyWithin();\nassert(obj.length === undefined);\n\n// Checking behavior when unable to get length\nvar obj = { copyWithin : Array.prototype.copyWithin };\nObject.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.copyWithin(1);\n  assert(false)\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get element\nvar obj = { copyWithin : Array.prototype.copyWithin, length : 5 };\nObject.defineProperty(obj, '2', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.copyWithin(2);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when a property is not defined\nvar obj = { '0' : 2, '2' : \"foo\", length : 3, copyWithin : Array.prototype.copyWithin };\n\nobj.copyWithin(1);\nassert(obj[0] === 2);\nassert(obj[1] === 2);\n\nfunction array_check(result_array, expected_array) {\n  assert(result_array instanceof Array);\n  assert(result_array.length === expected_array.length);\n  for (var idx = 0; idx < expected_array.length; idx++) {\n    assert(result_array[idx] === expected_array[idx]);\n  }\n}\n\n// Remove the buffer\nvar array = [1, 2, 3];\nvar value = array.copyWithin(0, {\n    valueOf: function() {\n        array.length = 0;\n    }\n})\narray_check(value, []);\n\n// Extend the buffer\nvar array = [1, 2, 3];\nvar value = array.copyWithin(1, {\n    valueOf: function() {\n        array.length = 6;\n    }\n})\narray_check(value, [1, 1, 2, undefined, undefined, undefined]);\n\n// Reduce the buffer\nvar array = [1, 2, 3, 4, 5, 6, 7];\nvar value = array.copyWithin(4, 2, {\n    valueOf: function() {\n        array.length = 3;\n    }\n})\narray_check(value, [1, 2, 3]);\n\n// Reduce the buffer and extend the buffer\nvar array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\nvar value = array.copyWithin(7, {\n    valueOf: function() {\n        array.length = 5;\n    }\n})\narray_check(value, [1, 2, 3, 4, 5, , , 1, 2, 3]);\n\n// Copy with overlapping (backward copy)\nvar array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\nvar value = array.copyWithin(0, 2, 8)\narray_check(value, [3, 4, 5, 6, 7, 8, 7, 8, 9, 10]);\n"
  },
  {
    "path": "tests/jerry/array-prototype-entries.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  Array.prototype.entries.call (undefined);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError)\n}\n\nvar array = ['a', \"foo\", 1, 1.5, true, {} ,[], function f () { }];\n\nvar iterator = array.entries ();\n\nvar current_item = iterator.next ();\n\nfor (var i = 0; i < array.length; i++) {\n  assert (current_item.value[0] === i);\n  assert (current_item.value[1] === array[i]);\n  assert (current_item.done === false);\n\n  current_item = iterator.next ();\n}\n\nassert (current_item.value === undefined);\nassert (current_item.done === true);\n\nfunction foo_error () {\n  throw new ReferenceError (\"foo\");\n}\n\narray = [1, 2, 3, 4, 5, 6, 7];\n\n['0', '3', '5'].forEach (function (e) {\n  Object.defineProperty (array, e, { 'get' : foo_error });\n})\n\niterator = array.entries ();\n\nvar expected_values = [2, 3, 5, 7];\nvar expected_indices = [1, 2, 4, 6];\nvar expected_values_idx = 0;\n\nfor (var i = 0; i < array.length; i++) {\n  try {\n    current_item = iterator.next ();\n    assert (current_item.value[0] === expected_indices[expected_values_idx]);\n    assert (current_item.value[1] === expected_values[expected_values_idx]);\n    assert (current_item.done === false);\n    expected_values_idx++;\n  } catch (e) {\n    assert (e instanceof ReferenceError);\n    assert (e.message === \"foo\");\n  }\n}\n\ncurrent_item = iterator.next ();\nassert (current_item.value === undefined);\nassert (current_item.done === true);\n\n/* Test empty array */\narray = [];\n\niterator = array.entries ();\ncurrent_item = iterator.next ();\n\nassert (current_item.value === undefined);\nassert (current_item.done === true);\n\n/* Test delete elements after the iterator has been constructed */\n\narray = [0, 1, 2, 3, 4, 5];\niterator = array.entries ();\n\nfor (var i = 0; i < array.length; i++) {\n  current_item = iterator.next ();\n  assert (current_item.value[0] === i);\n  assert (current_item.value[1] === array[i]);\n  assert (current_item.done === false);\n  array.pop();\n}\n\nassert ([].entries ().toString () === \"[object Array Iterator]\");\n"
  },
  {
    "path": "tests/jerry/array-prototype-every.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [\"foo\", [], Infinity, 4];\n\nfunction f(arg1, arg2, arg3) {\n  assert(arg1 === array[arg2]);\n  assert(arg3 === array);\n  return true;\n}\n\nassert(array.every(f) === true);\n\nfunction g(arg1, arg2, arg3) {\n  if (arg1 === 1) {\n    return true;\n  } else {\n    return false;\n  }\n}\n\nvar arr1 = [1, 1, 1, 1, 1, 2];\nassert(arr1.every(g) === false);\n\nvar arr2 = [1, 1, 1, 1, 1, 1];\nassert(arr2.every(g) === true);\n\n// Checking behavior when unable to get length\nvar obj = { every : Array.prototype.every };\nObject.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.every(f);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get element\nvar obj = { every : Array.prototype.every, length : 1};\nObject.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.every(f);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-fill.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2014 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nfunction assertArrayEquals (array1, array2) {\n  if (array1.length !== array2.length) {\n    return false;\n  }\n\n  for (var i = 0; i < array1.length; i++) {\n    if (array1[i] !== array2[i]) {\n      return false;\n    }\n  }\n\n  return true;\n}\n\nassert (1 === Array.prototype.fill.length);\n\nassert (assertArrayEquals ([].fill (8), []));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (), [undefined, undefined, undefined, undefined, undefined]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8), [8, 8, 8, 8, 8]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8, 1), [0, 8, 8, 8, 8]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8, 10), [0, 0, 0, 0, 0]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8, -5), [8, 8, 8, 8, 8]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8, 1, 4), [0, 8, 8, 8, 0]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8, 1, -1), [0, 8, 8, 8, 0]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8, 1, 42), [0, 8, 8, 8, 8]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8, -3, 42), [0, 0, 8, 8, 8]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8, -3, 4), [0, 0, 8, 8, 0]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8, -2, -1), [0, 0, 0, 8, 0]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8, -1, -3), [0, 0, 0, 0, 0]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (8, undefined, 4), [8, 8, 8, 8, 0]));\nassert (assertArrayEquals ([ ,  ,  ,  , 0].fill (8, 1, 3), [, 8, 8, , 0]));\nassert (assertArrayEquals ([0, 0, 0, 0, 0].fill (7.8), [7.8, 7.8, 7.8, 7.8, 7.8]));\nassert (assertArrayEquals ([\"foo\", \"bar\", \"baz\"].fill (1), [1, 1, 1]));\n\n\n// If the range is empty, the array is not actually modified and\n// should not throw, even when applied to a frozen object.\nassert (assertArrayEquals (Object.freeze ([1, 2, 3]).fill (0, 0, 0), [1, 2, 3]));\n\n// Test exceptions\ntry {\n  Object.freeze ([0]).fill ();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\ntry {\n  Array.prototype.fill.call (null)\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\ntry {\n  Array.prototype.fill.call (undefined)\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nfunction TestFillObjectWithAccessors () {\n  var kLength = 5;\n\n  var log = [];\n\n  var object = {\n    length: kLength,\n    get 1 () {\n      log.push (\"get 1\");\n      return this.foo;\n    },\n\n    set 1 (val) {\n      log.push (\"set 1 \" + val);\n      this.foo = val;\n    }\n  };\n\n  Array.prototype.fill.call (object, 42);\n\n  assert (kLength === object.length);\n  assert (assertArrayEquals ([\"set 1 42\"], log));\n\n  for  (var i = 0; i < kLength; ++i) {\n    assert (42 === object[i]);\n  }\n}\nTestFillObjectWithAccessors ();\n\nfunction TestFillObjectWithMaxNumberLength () {\n  var kMaxSafeInt = Math.pow (2, 32) - 1;\n  var object = {};\n  object.length = kMaxSafeInt;\n\n  Array.prototype.fill.call (object, 42, Math.pow (2, 32) - 4);\n\n  assert (kMaxSafeInt === object.length);\n  assert (42 === object[kMaxSafeInt - 3]);\n  assert (42 === object[kMaxSafeInt - 2]);\n  assert (42 === object[kMaxSafeInt - 1]);\n}\nTestFillObjectWithMaxNumberLength ();\n\nfunction TestFillObjectWithPrototypeAccessors () {\n  var kLength = 5;\n  var log = [];\n  var proto = {\n    get 1 () {\n      log.push (\"get 0\");\n      return this.foo;\n    },\n\n    set 1 (val) {\n      log.push (\"set 1 \" + val);\n      this.foo = val;\n    }\n  };\n\n  var object = { 0:0, 2:2, length: kLength};\n  Object.setPrototypeOf (object, proto);\n\n  Array.prototype.fill.call (object, \"42\");\n\n  assert (kLength === object.length);\n  assert (assertArrayEquals ([\"set 1 42\"], log));\n  assert (object.hasOwnProperty (0) == true);\n  assert (object.hasOwnProperty (1) == false);\n  assert (object.hasOwnProperty (2) == true);\n  assert (object.hasOwnProperty (3) == true);\n  assert (object.hasOwnProperty (4) == true);\n\n  for (var i = 0; i < kLength; ++i) {\n    assert (\"42\" === object[i]);\n  }\n}\nTestFillObjectWithPrototypeAccessors ();\n\nfunction TestFillSealedObject () {\n  var object = { length: 42 };\n  Object.seal (object);\n\n  try {\n    Array.prototype.fill.call (object);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n}\nTestFillSealedObject ();\n\nfunction TestFillFrozenObject () {\n  var object = { length: 42 };\n  Object.freeze (object);\n\n  try {\n    Array.prototype.fill.call (object);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n}\nTestFillFrozenObject ();\n\nfunction array_check(result_array, expected_array) {\n  assert(result_array instanceof Array);\n  assert(result_array.length === expected_array.length);\n  for (var idx = 0; idx < expected_array.length; idx++) {\n    assert(result_array[idx] === expected_array[idx]);\n  }\n}\n\n\n// Remove the buffer\nvar array = [1, 2, 3, 4, 5];\nvar value = array.fill(2, 0, {\n    valueOf: function() {\n        array.length = 0;\n    }\n})\n\narray_check(value, []);\n\n// Extend the buffer\nvar array = [1, 2, 3];\nvar value = array.fill(1, {\n    valueOf: function() {\n        array.length = 6;\n    }\n})\n\narray_check(value, [1, 1, 1, undefined, undefined, undefined]);\n\n// Reduce the buffer\nvar array = [1, 2, 3, 4, 5, 6, 7];\nvar value = array.fill(4, {\n    valueOf: function() {\n        array.length = 3;\n    }\n})\n\narray_check(value, [4, 4, 4]);\n"
  },
  {
    "path": "tests/jerry/array-prototype-filter.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [\"foo\", [], Infinity, 4]\n\nfunction f(arg1, arg2, arg3) {\n  assert(arg1 === array[arg2]);\n  assert(arg3 === array);\n  return true;\n}\n\nvar filtered = array.filter(f);\nassert(filtered.length === array.length);\nfor (i = 0; i < filtered.length; i++) {\n  assert(filtered[i] === array[i]);\n}\n\nvar array = [1, 2, 3, 4, 5, 6, 7, 8];\n\nfunction g (arg1, arg2, arg3) {\n  if (arg2 % 2 === 0) {\n    return true;\n  } else {\n    return false;\n  }\n}\n\nfiltered = array.filter(g)\nassert(filtered.length === 4);\nassert(filtered[0] === 1);\nassert(filtered[1] === 3);\nassert(filtered[2] === 5);\nassert(filtered[3] === 7);\n\nvar arr = [1,2];\nArray.prototype[0] = 3;\nvar newArr = arr.filter(function() { return true; });\ndelete Array.prototype[0];\nassert(newArr.hasOwnProperty(\"0\"));\nassert(newArr[0] === 1);\n\n// Checking behavior when unable to get length\nvar obj = {};\nObject.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\nobj.filter = Array.prototype.filter;\n\ntry {\n  obj.filter(f);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get element\nvar obj = {}\nobj.length = 1;\nObject.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\nobj.filter = Array.prototype.filter\n\ntry {\n  obj.filter(f);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-find-index.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrow_is_available = false;\n\ntry {\n  assert (eval (\"(f => 5) ()\") === 5);\n  arrow_is_available = true;\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nvar array1 = [5, 12, 0, 8, 130, 44];\n\nfunction bigger_than_10 (element) {\n  return element > 10;\n}\n\nassert (array1.findIndex (bigger_than_10) === 1);\n\nfunction less_than_0 (element) {\n  if (element == 0) {\n    throw new Error (\"zero\");\n  }\n  return element < 0;\n}\n\ntry {\n  array1.findIndex (less_than_0);\n  assert (false);\n} catch (e) {\n  assert (e instanceof Error);\n  assert (e.message === \"zero\");\n}\n\nvar inventory = [\n    {name: 'apples', quantity: 2},\n    {name: 'bananas', quantity: 0},\n    {name: 'cherries', quantity: 5}\n];\n\nfunction isCherries (fruit) {\n    return fruit.name === 'cherries';\n}\n\nassert (JSON.stringify (inventory.findIndex (isCherries)) === \"2\");\n\nif (arrow_is_available) {\n  assert (eval (\"inventory.findIndex (fruit => fruit.name === 'bananas')\") === 1);\n}\n\n/* Test the callback function arguments */\nvar src_array = [4, 6, 8, 12];\nvar array_index = 0;\n\nfunction isPrime (element, index, array) {\n  assert (array_index++ === index);\n  assert (array === src_array)\n  assert (element === array[index]);\n\n  var start = 2;\n  while (start <= Math.sqrt (element)) {\n    if (element % start++ < 1) {\n      return false;\n    }\n  }\n  return element > 1;\n}\n\nassert (src_array.findIndex (isPrime) === -1);\n\nsrc_array = [4, 5, 8, 12];\narray_index = 0;\nassert (src_array.findIndex (isPrime) === 1);\n\n// Checking behavior when the given object is not %Array%\ntry {\n  Array.prototype.findIndex.call (5);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// Checking behavior when unable to get length\nvar obj = {};\nObject.defineProperty (obj, 'length', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\nobj.findIndex = Array.prototype.findIndex;\n\ntry {\n  obj.findIndex ();\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\nvar data = { 0: 1, 2: -3, 3: \"string\" }\nassert (Array.prototype.findIndex.call (data, function (e) { return e < 5; }) === -1);\n\n// Checking behavior when unable to get element\nvar obj = {}\nobj.length = 1;\nObject.defineProperty (obj, '0', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\nobj.findIndex = Array.prototype.findIndex;\n\ntry {\n  obj.findIndex (function () { return undefined; });\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// Checking behavior when the first argument is not a callback\nvar array = [1, 2, 3];\n\ntry {\n  array.findIndex (5);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// Checking behavior when the first argument does not exist\ntry {\n  array.findIndex ();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// Checking behavior when there are more than 2 arguments\nassert (array.findIndex (function (e) { return e < 2 }, {}, 8, 4, 5, 6, 6) === 0);\n\nfunction func (element) {\n  return element > 8;\n}\n\n/* ES v6.0 22.1.3.9.8.c\n   Checking behavior when the first element deletes the second */\nfunction f() { delete arr[1]; };\nvar arr = [0, 1, 2, 3];\nObject.defineProperty(arr, '0', { 'get' : f });\nArray.prototype.findIndex.call(arr, func);\n\n/* ES v6.0 22.1.3.9.8\n   Checking whether predicate is called also for empty elements */\nvar count = 0;\n\n[,,,].findIndex(function() { count++; return false; });\nassert (count == 3);\n"
  },
  {
    "path": "tests/jerry/array-prototype-find.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrow_is_available = false;\n\ntry {\n  assert (eval (\"(f => 5) ()\") === 5);\n  arrow_is_available = true;\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nvar array1 = [5, 12, 0, 8, 130, 44];\n\nfunction bigger_than_10 (element) {\n  return element > 10;\n}\n\nassert (array1.find (bigger_than_10) === 12);\n\nfunction less_than_0 (element) {\n  if (element == 0) {\n    throw new Error (\"zero\");\n  }\n  return element < 0;\n}\n\ntry {\n  array1.find (less_than_0);\n  assert (false);\n} catch (e) {\n  assert (e instanceof Error);\n  assert (e.message === \"zero\");\n}\n\nvar inventory = [\n    {name: 'apples', quantity: 2},\n    {name: 'bananas', quantity: 0},\n    {name: 'cherries', quantity: 5}\n];\n\nfunction isCherries (fruit) {\n    return fruit.name === 'cherries';\n}\n\nassert (JSON.stringify (inventory.find (isCherries)) === '{\"name\":\"cherries\",\"quantity\":5}');\n\nif (arrow_is_available) {\n  assert (eval (\"inventory.find (fruit => fruit.name === 'bananas')\") === inventory[1]);\n}\n\n/* Test the callback function arguments */\nvar src_array = [4, 6, 8, 12];\nvar array_index = 0;\n\nfunction isPrime (element, index, array) {\n  assert (array_index++ === index);\n  assert (array === src_array)\n  assert (element === array[index]);\n\n  var start = 2;\n  while (start <= Math.sqrt (element)) {\n    if (element % start++ < 1) {\n      return false;\n    }\n  }\n  return element > 1;\n}\n\nassert (src_array.find (isPrime) === undefined);\n\nsrc_array = [4, 5, 8, 12];\narray_index = 0;\nassert (src_array.find (isPrime) === 5);\n\n\n// Checking behavior when unable to get length\nvar obj = {};\nObject.defineProperty (obj, 'length', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\nobj.find = Array.prototype.find;\n\ntry {\n  obj.find ();\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\nvar data = { 0: 1, 2: -3, 3: \"string\" }\nassert (Array.prototype.find.call (data, function (e) { return e < 5; }) === undefined);\n\n// Checking behavior when unable to get element\nvar obj = {}\nobj.length = 1;\nObject.defineProperty (obj, '0', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\nobj.find = Array.prototype.find\n\ntry {\n  obj.find (function () { return undefined; });\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// Checking behavior when the first argument is not a callback\nvar array = [1, 2, 3];\n\ntry {\n  array.find (5);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// Checking behavior when the first argument does not exist\ntry {\n  array.find ();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// Checking behavior when the there are more than 2 arguments\nassert (array.find (function (e) { return e < 2 }, {}, 8, 4, 5, 6, 6) === 1);\n\nfunction func (element) {\n  return element > 8;\n}\n\n/* ES v6.0 22.1.3.8.8.c\n   Checking behavior when the first element deletes the second */\nfunction f() { delete arr[1]; };\nvar arr = [0, 1, 2, 3];\nObject.defineProperty(arr, '0', { 'get' : f });\nArray.prototype.find.call(arr, func);\n\n/* ES v6.0 22.1.3.8.8\n   Checking whether predicate is called also for empty elements */\nvar count = 0;\n\n[,,,].find(function() { count++; return false; });\nassert (count == 3);\n"
  },
  {
    "path": "tests/jerry/array-prototype-flat-flatMap.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// helper function - simple implementation\nArray.prototype.equals = function (array) {\n  if (this.length != array.length)\n    return false;\n\n  for (var i = 0; i < this.length; i++) {\n    if (this[i] instanceof Array && array[i] instanceof Array) {\n      if (!this[i].equals(array[i]))\n        return false;\n      }\n      else if (this[i] != array[i]) {\n        return false;\n    }\n  }\n\n  return true;\n}\n// various checks on flat prototype\nassert ([1, 4, 9].flat(2).equals([1, 4, 9]))\nassert ([[4,9]].flat(0).equals([[4,9]]))\nassert ([[4,9]].flat(1).equals([4,9]))\nassert ([1, 4, [9,3,[2,4,[3,4]]]].flat(5).equals([1, 4, 9, 3, 2, 4, 3, 4]));\n\nvar array1 = [1,3,4]\nvar array2 = [array1,array1]\nassert(array2.flat(1).equals([1,3,4,1,3,4]))\nassert(array2.flat(0).equals([[1,3,4],[1,3,4]]))\n\nvar array3 = [array2]\nassert(array3.flat(0).equals([[[1,3,4],[1,3,4]]]))\nassert(array3.flat(1).equals([[1,3,4],[1,3,4]]))\nassert(array3.flat(2).equals([1,3,4,1,3,4]))\n\nvar array4 = []\nassert(array4.flat(10).equals([]))\n\nvar array5 = [null, array4]\nassert(array5.flat(10).equals([null]))\n\n// various checks on flatMap Prototype\nassert([1, 2, 3, 4].flatMap(x => [x, x * 2]).equals([1,2,2,4,3,6,4,8]))\nassert([1, 2, 3, 4].flatMap(x => [x, x * x]).equals([1,1,2,4,3,9,4,16]))\nassert(array1.flatMap(x => [x, x * 2]).equals([1,2,3,6,4,8]))\nassert(array4.flatMap(x => [x, x * 2]).equals([]))\n\nfunction check_flat (map, depth)\n{\n  try {\n    map.flat (depth)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n}\n\nfunction check_flat_map (map, mapper)\n{\n  try {\n    map.flatMap (mapper)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n}\n\n// invalid depth\ncheck_flat ([1,2], Symbol())\n\n// constructor is null\nvar a = new Array();\na.constructor = null;\ncheck_flat (a,1)\n\n// callback is not object\ncheck_flat_map ([1,2], null)\n\n// constructor is null\ncheck_flat_map (a,x => [x, x * x])\n\n// \"0\" get is a TypeError\nvar array_2 = [1,2]\nObject.defineProperty (array_2, '0', { 'get' : function () { throw new TypeError (); } });\ncheck_flat (array_2, 1)\ncheck_flat_map (array_2,x => [x, x * x])\n\n// \"0\" is not Array and throw error\nvar revocable = Proxy.revocable ({}, {});\nvar proxy = revocable.proxy;\nrevocable.revoke();\nvar array_3 = [proxy,2]\ncheck_flat (array_3, 1)\n\n// second call of FlattenIntoArray return with a error\nvar array_4_1 = [1,2]\nObject.defineProperty (array_4_1, '0', { 'get' : function () { throw new TypeError (); } });\nvar array_4 = [array_4_1,1,2]\ncheck_flat (array_4, 1)\n\n// unable to add new property\nvar array_5 = [array_2,1,2]\ncheck_flat (array_2, 1)\n\nvar A = function(_length) {\n  Object.defineProperty(this, \"0\", {\n    writable: true,\n    configurable: false,\n  });\n};\n\nvar arr = [1];\narr.constructor = {};\narr.constructor[Symbol.species] = A;\n\ncheck_flat_map (arr, A)\n\n// element value is not found\nvar array_6 = []\narray_6.length = 2\narray_6.flat()\n\n// mapped function is error\nvar array_7 = [1,2]\nvar f = function () {\n  throw new TypeError()\n}\ncheck_flat_map (array_7, f)\n\nvar obj = new Proxy ([], { get(t, p, r) {\n  if (p === 'length') {\n    throw new TypeError();\n  }\n}})\n"
  },
  {
    "path": "tests/jerry/array-prototype-foreach.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [\"foo\", [], Infinity, 4]\n\nfunction f(arg1, arg2, arg3) {\n  assert(arg1 === array[arg2]);\n  assert(arg3 === array);\n}\n\narray.forEach(f);\n\n// Checking behavior when unable to get length\nvar obj = {};\nObject.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\nobj.forEach = Array.prototype.forEach;\n\ntry {\n  obj.forEach(f);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get element\nvar obj = {}\nobj.length = 1;\nObject.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\nobj.forEach = Array.prototype.forEach\n\ntry {\n  obj.forEach(f);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-includes.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Array.prototype.includes.length === 1);\nassert(Array.prototype.includes.name === \"includes\");\n\nvar num_arr = [1, 2, 3,,4, 5];\nvar str_arr = ['foo', 'bar', 'baz', NaN, 'foo'];\nvar obj = {};\nvar obj_arr = [1, obj, 2];\nvar empry_arr = [];\n\nassert(num_arr.includes(3) === true);\nassert(num_arr.includes(3, 4) === false);\nassert(num_arr.includes(3, -5) === true);\nassert(num_arr.includes(undefined) === true);\nassert(num_arr.includes(3, Infinity) === false);\nassert(num_arr.includes(3, -0) === true);\nassert(str_arr.includes(NaN) === true);\nassert(str_arr.includes('foo', 4) === true);\nassert(str_arr.includes('f') === false);\nassert(obj_arr.includes(obj) === true);\nassert(obj_arr.includes({}) === false);\nassert(empry_arr.includes() === false);\nassert(empry_arr.includes(3) === false);\nassert([undefined].includes() === true);\n\nObject.defineProperty(num_arr, \"1\", { get: function() {throw 42}});\n\ntry {\n  num_arr.includes(4);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\nvar sym = Symbol('foo');\n\ntry {\n  num_arr.includes(3, sym);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Remove the buffer\nvar array = [1, 2, 3, 4, 5];\nvar found = array.includes(4, {\n    valueOf: function() {\n        array.length = 0;\n    }\n})\n\nassert(found === false);\n\n// Extend the buffer\nvar array = [1, 2, 3];\nvar found = array.includes(2, {\n    valueOf: function() {\n        array.length = 5;\n    }\n})\n\nassert(found === true);\n\n// Reduce the buffer\nvar array = [1, 2, 3, 4, 5, 6, 7];\nvar found = array.includes(6, {\n    valueOf: function() {\n        array.length = 5;\n    }\n})\n\nassert(found === false);\n"
  },
  {
    "path": "tests/jerry/array-prototype-indexof.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {};\nvar array = [\"foo\", 19, \"bar\", obj, \"foo\", 29, \"baz\"];\n\nvar index = array.indexOf(\"foo\");\nassert(index === 0);\nassert(array[index] === \"foo\");\n\nassert(array.indexOf(\"foo\", 1) === 4);\nassert(array.indexOf(\"foo\", 5) === -1);\n\nvar index = array.indexOf(\"baz\");\nassert(index === 6);\nassert(array[index] === \"baz\");\n\nassert(array.indexOf(\"baz\", 7) === -1);\n\nvar index = array.indexOf(obj);\nassert(index === 3);\nassert(array[index] === obj);\n\nassert(array.indexOf(\"foo\", NaN) === 0);\nassert(array.indexOf(\"foo\", Infinity) === -1);\nassert(array.indexOf(\"foo\", -Infinity) === 0);\n\nassert([true].indexOf(true, -0) === 0);\n\n// Checking behavior when length is zero\nvar obj = { indexOf : Array.prototype.indexOf, length : 0 };\nassert(obj.indexOf(\"foo\") === -1);\n\n// Checking behavior when start index >= length\nvar arr = [11, 22, 33, 44];\nassert(arr.indexOf(44, 4) === -1);\n\nvar fromIndex = {\n  toString: function () {\n    return {};\n  },\n\n  valueOf: function () {\n    return {};\n  }\n};\n\ntry {\n  [0, 1].indexOf(1, fromIndex);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Checking behavior when unable to get length\nvar obj = { indexOf : Array.prototype.indexOf}\nObject.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.indexOf(\"bar\");\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get element\nvar obj = { indexOf : Array.prototype.indexOf, length : 1}\nObject.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.indexOf(\"bar\");\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Remove the buffer\nvar array = [1, 2, 3, 4, 5];\nvar value = array.indexOf(4, {\n    valueOf: function() {\n        array.length = 0;\n    }\n})\n\nassert(value === -1);\n\n// Extend the buffer\nvar array = [1, 2, 3];\nvar value = array.indexOf(2, {\n    valueOf: function() {\n        array.length = 5;\n    }\n})\n\nassert(value === 1);\n\n// Reduce the buffer\nvar array = [1, 2, 3, 4, 5, 6, 7];\nvar value = array.indexOf(6, {\n    valueOf: function() {\n        array.length = 5;\n    }\n})\n\nassert(value === -1);\n"
  },
  {
    "path": "tests/jerry/array-prototype-join.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert ([].join() === \"\");\nassert ([1].join() === \"1\");\nassert ([1, 2].join() === \"1,2\");\n\n\nassert ([].join('--') === \"\");\nassert ([1].join(\"--\") === \"1\");\nassert ([1, 2].join('--') === \"1--2\");\n\nassert ([1,2,3].join({toString: function() { return \"--\"; }}) === \"1--2--3\");\n\n\n// Join should use 'length' to as the number of elements int the array.\nvar lst = [1,2,3,4];\nlst.length = 3;\nassert (lst.join() === [1,2,3].join());\n\n// Checking behavior when unable to get length.\nvar obj = {};\nObject.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\nobj.join = Array.prototype.join;\n\ntry {\n  obj.join();\n  // Should not be reached.\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// Check join argument fail.\ntry {\n  [1,2,3].join({toString: function() { throw new ReferenceError (\"foo\"); }});\n  // Should not be reached.\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// Check single join element fail.\ntry {\n  [1, 2, {toString: function() { throw new ReferenceError (\"foo\"); }}, 4].join();\n  // Should not be reached.\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// Check join on different object.\nvar obj_2 = {};\nobj_2.length = 3;\nobj_2[0] = 1;\nobj_2[1] = 2;\nobj_2[2] = 3;\nobj_2[3] = 4;\n\nobj_2.join = Array.prototype.join;\n\nassert (obj_2.join() === \"1,2,3\");\n\n/* ES v5.1 15.4.4.5.7.\n   Checking behavior when an element throws error */\ntry {\n  var f = function () { throw new TypeError(\"ooo\");};\n  var arr = [0, 1, 2, 3];\n  Object.defineProperty(arr, '0', { 'get' : f });\n  Array.prototype.join.call(arr);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n  assert(e.message == \"ooo\");\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-keys.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  Array.prototype.keys.call (undefined);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError)\n}\n\nvar array = ['a', \"foo\", 1, 1.5, true, {} ,[], function f () { }];\n\nvar iterator = array.keys ();\n\nvar current_item = iterator.next ();\n\nfor (var i = 0; i < array.length; i++) {\n  assert (current_item.value === i);\n  assert (current_item.done === false);\n\n  current_item = iterator.next ();\n}\n\nassert (current_item.value === undefined);\nassert (current_item.done === true);\n\nfunction foo_error () {\n  throw new ReferenceError (\"foo\");\n}\n\narray = [1, 2, 3, 4, 5, 6, 7];\n\n['0', '3', '5'].forEach (function (e) {\n  Object.defineProperty (array, e, { 'get' : foo_error });\n})\n\niterator = array.keys ();\n\nfor (var i = 0; i < array.length; i++) {\n  try {\n    current_item = iterator.next ();\n    assert (current_item.value === i);\n    assert (current_item.done === false);\n  } catch (e) {\n    assert (e instanceof ReferenceError);\n    assert (e.message === \"foo\");\n  }\n}\n\ncurrent_item = iterator.next ();\nassert (current_item.value === undefined);\nassert (current_item.done === true);\n\n/* Test empty array */\narray = [];\n\niterator = array.keys ();\ncurrent_item = iterator.next ();\n\nassert (current_item.value === undefined);\nassert (current_item.done === true);\n\n/* Test delete elements after the iterator has been constructed */\n\narray = [0, 1, 2, 3, 4, 5];\niterator = array.keys ();\n\nfor (var i = 0; i < array.length; i++) {\n  current_item = iterator.next ();\n  assert (current_item.value === i);\n  assert (current_item.done === false);\n  array.pop();\n}\n\nassert ([].keys ().toString () === \"[object Array Iterator]\");\n"
  },
  {
    "path": "tests/jerry/array-prototype-lastindexof.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// This test will not pass on FLOAT32 due to precision issues\n\nvar obj = {};\nvar array = [\"foo\", 19, \"bar\", obj, \"foo\", 29, \"baz\"];\n\nvar index = array.lastIndexOf(\"foo\");\nassert(index === 4);\nassert(array[index] === \"foo\");\n\nassert(array.lastIndexOf(\"foo\", 3) === 0);\nassert(array.lastIndexOf(\"foo\", -8) === -1);\n\nvar index = array.lastIndexOf(\"baz\");\nassert(index === 6);\nassert(array[index] === \"baz\");\n\nassert(array.lastIndexOf(\"baz\", -2) === -1);\n\nvar index = array.lastIndexOf(obj);\nassert(index === 3);\nassert(array[index] === obj);\n\nassert(array.lastIndexOf(\"foo\", NaN) === 0);\nassert(array.lastIndexOf(\"foo\", Infinity) === 4);\nassert(array.lastIndexOf(\"foo\", -Infinity) === -1);\n\nvar arr = [];\narr[4294967294] = \"foo\";\nassert(arr.lastIndexOf(\"foo\", -1) === 4294967294)\n\nvar arr = [1,2];\nassert(arr.lastIndexOf(2, undefined) === -1);\nassert(arr.lastIndexOf(2) === 1);\n\n// Checking behavior when unable to get length\nvar obj = { lastIndexOf : Array.prototype.lastIndexOf}\nObject.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.lastIndexOf(\"bar\");\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get element\nvar obj = { lastIndexOf : Array.prototype.lastIndexOf, length : 1}\nObject.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.lastIndexOf(\"bar\");\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Remove the buffer\nvar array = [1, 2, 3, 4, 5];\nvar value = array.lastIndexOf(4, {\n    valueOf: function() {\n        array.length = 0;\n    }\n})\n\nassert(value === -1);\n\n// Extend the buffer\nvar array = [1, 2, 3];\nvar value = array.lastIndexOf(1, {\n    valueOf: function() {\n        array.length = 5;\n    }\n})\n\nassert(value === 0);\n\n// Reduce the buffer\nvar array = [1, 2, 3, 4, 5, 6, 7];\nvar value = array.indexOf(5, {\n    valueOf: function() {\n        array.length = 2;\n    }\n})\n\nassert(value === -1);\n"
  },
  {
    "path": "tests/jerry/array-prototype-map.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// helper function - simple implementation\nArray.prototype.equals = function (array) {\n  if (this.length != array.length)\n    return false;\n\n  for (var i = 0; i < this.length; i++) {\n    if (this[i] instanceof Array && array[i] instanceof Array) {\n      if (!this[i].equals(array[i]))\n        return false;\n      }\n      else if (this[i] != array[i]) {\n        return false;\n    }\n  }\n\n  return true;\n}\n\n// check function type\ntry {\n  [0].map(new Object());\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// various checks\nassert ([1, 4, 9].map(Math.sqrt).equals([1, 2, 3]));\n\nassert (isNaN([1, 4, \"X\"].map(Number)[2]));\n\nvar func = function(val, idx) {\n  return val + idx;\n};\n\nassert ([1, 4, 9].map(func).equals([1,5,11]));\n\nassert ([1, \"X\", 10].map(func).equals([1, \"X1\", 12]));\n\nvar arr = [1,2,3];\narr.length = 5;\nassert(arr.map(func).length === arr.length);\n\nvar long_array = [0, 1];\nassert (long_array.map(func).equals([0,2]));\n\nlong_array[100] = 1;\nassert (long_array.map(func).equals([0,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,101]));\n\nvar arr = [1,2];\nArray.prototype[0] = 3;\nvar newArr = arr.map(function(value) { return value; });\ndelete Array.prototype[0];\nassert(newArr.hasOwnProperty(\"0\"));\nassert(newArr[0] === 1);\n\n// check behavior when unable to get length\nvar obj = {};\nObject.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\nobj.map = Array.prototype.map;\n\ntry {\n  obj.map(func);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// check behavior when unable to get element\nvar obj = {}\nobj.length = 1;\nObject.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\nobj.map = Array.prototype.map\n\ntry {\n  obj.map(func);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// check thisArg\nvar thisArg = {add: 10};\nvar func2 = function(value) {\n  return this.add + value;\n}\nassert([1,2].map(func2, thisArg).equals([11, 12]));\n\n// check passed Object\nvar array_example = [1,2];\nObject.defineProperty(array_example, 'const', { 'get' : function () {return \"CT\";} });\nvar func3 = function(value, idx, thisobj) {\n  return value * idx + thisobj.const;\n}\nassert(array_example.map(func3).equals([\"0CT\", \"2CT\"]));\n"
  },
  {
    "path": "tests/jerry/array-prototype-pop.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [\"foo\", [], Infinity, 4]\nassert(array.length === 4);\n\nassert(array.pop() === 4)\nassert(array.length === 3);\n\nassert(array.pop() === Infinity);\nassert(array.length === 2);\n\nvar a = array.pop()\nassert(a instanceof Array);\nassert(array.length === 1);\n\nassert(array.pop() === \"foo\");\nassert(array.length === 0);\n\nassert(array.pop() === undefined);\nassert(array.length === 0);\n\n// Checking behavior when unable to get length\nvar obj = { pop : Array.prototype.pop };\nObject.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.pop();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to set length\nvar obj = { pop : Array.prototype.pop };\nObject.defineProperty(obj, 'length', { 'set' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.pop();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when no length property defined\nvar obj = { pop : Array.prototype.pop };\nassert(obj.length === undefined)\nassert(obj.pop() === undefined)\nassert(obj.length === 0)\n\n// Checking behavior when unable to get element\nvar obj = { pop : Array.prototype.pop, length : 1 };\nObject.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.pop();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n/* ES v5.1 15.4.4.6.5.c\n   Checking behavior when unable to delete property */\nvar obj = {pop : Array.prototype.pop, length : 2};\nObject.defineProperty(obj, '1', function () {});\n\ntry {\n  obj.pop();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.6.5.d\n   Checking behavior when array is not modifiable */\nvar obj = {pop : Array.prototype.pop, length : 2};\nObject.freeze(obj);\n\ntry {\n  obj.pop();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-push.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// This test will not pass on FLOAT32 due to precision issues\n\nvar len;\nvar d = [];\nassert (d.length === 0);\nlen = d.push();\nassert (d.length === 0);\nassert (d.length === len);\nlen = d.push(1);\nassert (d.length === 1);\nassert (d.length === len);\nlen = d.push(2);\nassert (d.length === 2);\nassert (d.length === len);\nlen = d.push('a');\nassert (d.length === 3);\nassert (d.length === len);\nlen = d.push('b', 'c', 3);\nassert (d.length == 6);\nassert (d.length === len);\nassert (d[0] === 1);\nassert (d[1] === 2);\nassert (d[2] === 'a');\nassert (d[3] === 'b');\nassert (d[4] === 'c');\nassert (d[5] === 3);\n\nvar a = [];\na.length = 4294967294;\nassert(a.push(\"x\") === 4294967295);\nassert(a.length === 4294967295);\nassert(a[4294967294] === \"x\");\n\ntry {\n  a.push(\"y\");\n  assert(false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\nassert(a.length === 4294967295)\n\nvar o = { length : 4294967294, push : Array.prototype.push };\nassert(o.push(\"x\") === 4294967295);\nassert(o.length === 4294967295);\nassert(o[4294967294] === \"x\");\n\ntry {\n  assert(o.push(\"y\") === 4294967296);\n} catch (e) {\n  assert(false);\n}\nassert(o.length === 4294967296);\nassert(o[4294967295] === \"y\");\n\n/* ES v5.1 15.4.4.7.5.\n   Checking behavior when array is non-extensible while pushing */\nvar arr = [];\nObject.freeze(arr);\n\ntry {\n  arr.push(1, 2);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-reduce-right.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// This test will not pass on FLOAT32 due to precision issues\n\nvar func = function(a, b) {\n  return a + b;\n}\n\n// check function type\ntry {\n  [0].reduceRight(new Object());\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// check for init value\ntry {\n  [].reduceRight(func);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  var a = new Array();\n  a.length = 10;\n  a.reduceRight(func);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError)\n}\n\n// various checks\nassert([].reduceRight(func, 1) === 1);\n\nassert([].reduceRight(func, undefined) === undefined);\n\nassert([0].reduceRight(func) === 0);\n\nassert([0, 1].reduceRight(func) === 1);\n\nassert([0, 1].reduceRight(func, 1) === 2);\n\nassert([0, 1, 2, 3].reduceRight(func, 1) === 7);\n\nassert ([\"A\",\"B\"].reduceRight(func) === \"BA\");\n\nassert ([\"A\",\"B\"].reduceRight(func, \"Init:\") === \"Init:BA\");\n\nassert ([0, 1].reduceRight(func, 3.2) === 4.2);\n\nassert ([0, \"x\", 1].reduceRight(func) === \"1x0\");\n\nassert ([0, \"x\", 1].reduceRight(func, 3.2) === \"4.2x0\");\n\nvar long_array = [0, 1];\nassert (long_array.reduceRight(func,10) === 11);\n\nlong_array[10000] = 1;\nassert (long_array.reduceRight(func,10) === 12);\n\nvar accessed = false;\nfunction callbackfn(prevVal, curVal, idx, obj) {\n    accessed = true;\n    return typeof prevVal === \"undefined\";\n}\n\nvar obj = { 0: 11, length: 1 };\n\nassert (Array.prototype.reduceRight.call(obj, callbackfn, undefined) === true && accessed);\n"
  },
  {
    "path": "tests/jerry/array-prototype-reduce.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// This test will not pass on FLOAT32 due to precision issues\n\nvar func = function(a, b) {\n  return a + b;\n}\n\n// check function type\ntry {\n  [0].reduce(new Object());\n  assert(false);\n}\ncatch(e) {\n  assert(e instanceof TypeError);\n}\n\n// check for init value\ntry {\n  [].reduce(func);\n  assert(false);\n}\ncatch(e) {\n  assert(e instanceof TypeError);\n}\n\n// various checks\nassert ([].reduce(func, 1) === 1);\n\nassert ([].reduce(func, undefined) === undefined);\n\nassert ([0].reduce(func) === 0);\n\nassert ([0, 1].reduce(func) === 1);\n\nassert ([0, 1].reduce(func, 1) === 2);\n\nassert ([0, 1, 2, 3].reduce(func, 1) === 7);\n\nassert ([\"A\",\"B\"].reduce(func) === \"AB\");\n\nassert ([\"A\",\"B\"].reduce(func, \"Init:\") === \"Init:AB\");\n\nassert ([0, 1].reduce(func, 3.2) === 4.2);\n\nassert ([0, \"x\", 1].reduce(func) === \"0x1\");\n\nassert ([0, \"x\", 1].reduce(func, 3.2) === \"3.2x1\");\n\nvar long_array = [0, 1];\nassert (long_array.reduce(func,10) === 11);\n\nlong_array[10000] = 1;\nassert (long_array.reduce(func,10) === 12);\n\nvar accessed = false;\nfunction callbackfn(prevVal, curVal, idx, obj) {\n    accessed = true;\n    return typeof prevVal === \"undefined\";\n}\n\nvar obj = { 0: 11, length: 1 };\n\nassert (Array.prototype.reduce.call(obj, callbackfn, undefined) === true && accessed);\n"
  },
  {
    "path": "tests/jerry/array-prototype-reverse.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [4, 3, 2, 1, 0]\n\narray.reverse();\n\nfor (i = 0; i < array.length; i++) {\n  assert(array[i] === i);\n}\n\n// Checking behavior when unable to get length\nvar obj = { reverse : Array.prototype.reverse };\nObject.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.reverse();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get element\nvar obj = { reverse : Array.prototype.reverse, length : 3 };\nObject.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.reverse();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n/* ES v5.1 15.4.4.8.6.e.\n   Checking behavior when unable to get the last element */\nvar obj = { reverse : Array.prototype.reverse, length : 4 };\nObject.defineProperty(obj, '3', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.reverse();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n/* ES v5.1 15.4.4.8.6.h.i.\n   Checking behavior when first 3 elements are not writable */\ntry {\n  var arr = [,,, 3, 4, 5, 6,,,,,,,,,0, 1, 2, 3, 4, 5, 6];\n  Object.defineProperty(arr, '0', {});\n  Object.defineProperty(arr, '1', {});\n  Object.defineProperty(arr, '2', {});\n  Array.prototype.reverse.call(arr);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.8.6.h.ii.\n   Checking behavior when last 3 elements are not writable */\ntry {\n  var arr = [0, 1, 2, 3, 4, 5, 6,,,,,,,,,0, 1, 2, 3,,,];\n  Object.defineProperty(arr, '19', {});\n  Object.defineProperty(arr, '20', {});\n  Object.defineProperty(arr, '21', {});\n  Array.prototype.reverse.call(arr);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.8.6.i.i.\n   Checking behavior when first elements do not exist and the array is freezed */\ntry {\n  var arr = [,,,,,,,,,,,,,,,,0, 1, 2, 3, 4, 5, 6];\n  arr = Object.freeze(arr);\n  Array.prototype.reverse.call(arr);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.8.6.i.ii.\n   Checking behavior when unable to get the first 2 elements */\nvar obj = { reverse : Array.prototype.reverse, length : 4 };\nObject.defineProperty(obj, '2', { value : 0 });\nObject.defineProperty(obj, '3', { value : 0 });\ntry {\n  obj.reverse();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.8.6.j.i.\n   Checking behavior when unable to get the last 2 elements */\nvar obj = { reverse : Array.prototype.reverse, length : 4 };\nObject.defineProperty(obj, '0', { value : 0 });\nObject.defineProperty(obj, '1', { value : 0 });\ntry {\n  obj.reverse();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-shift.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [\"foo\", [], Infinity, 4]\n\nassert(array.length === 4);\n\nassert(array.shift() === \"foo\");\nassert(array.length === 3);\n\nvar a = array.shift();\nassert(a instanceof Array);\nassert(array.length === 2);\n\nassert(array.shift() === Infinity);\nassert(array.length === 1);\n\nassert(array.shift() === 4);\nassert(array.length === 0);\n\nassert(array.shift() === undefined);\nassert(array.length === 0);\n\nvar referenceErrorThrower = function () {\n  throw new ReferenceError (\"foo\");\n}\n\n// Checking behavior when unable to get length\nvar obj = { shift : Array.prototype.shift };\nObject.defineProperty(obj, 'length', { 'get' : referenceErrorThrower });\n\ntry {\n  obj.shift();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to set length\nvar obj = { shift : Array.prototype.shift };\nObject.defineProperty(obj, 'length', { 'set' : referenceErrorThrower });\n\ntry {\n  obj.shift();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when no length property defined\nvar obj = { shift : Array.prototype.shift };\nassert (obj.length === undefined)\nassert (obj.shift() === undefined)\nassert (obj.length === 0)\n\n// Checking behavior when unable to get element\nvar obj = { shift : Array.prototype.shift, length : 1 };\nObject.defineProperty(obj, '0', { 'get' : referenceErrorThrower });\n\ntry {\n  obj.shift();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n/* ES v5.1 15.4.4.9.7.c.\n   Checking behavior when the array is freezed */\ntry {\n  f = function () { throw new ReferenceError(\"getter\"); };\n  arr =  { length : 9 };\n  Object.defineProperty(arr, '8', { 'get' : f });\n  Array.prototype.shift.call(arr);\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n  assert(e.message == \"getter\");\n}\n\n/* ES v5.1 15.4.4.9.7.d.ii.\n   Checking behavior when the array is freezed */\ntry {\n  arr =  { length : 9 };\n  Object.defineProperty(arr, '8', { value : 8 });\n  Object.defineProperty(arr, '7', { value : 7 });\n  Array.prototype.shift.call(arr);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.9.7.e.i.\n   Checking behavior when the first element is null */\ntry {\n  arr = { length : 9 };\n  Object.defineProperty(arr, '0', { value : null });\n  Array.prototype.shift.call(arr);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.9.8.\n   Checking behavior when last element is not writable */\ntry {\n  arr = { length : 9 };\n  Object.defineProperty(arr, '8', { writable : false });\n  Array.prototype.shift.call(arr);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.9.9.\n   Checking behavior when the array is freezed */\ntry {\n  arr = { length : 9 };\n  Object.freeze(arr);\n  Array.prototype.shift.call(arr);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-slice.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// This test will not pass on FLOAT32 due to precision issues\n\nvar array = [54, undefined, \"Lemon\", -127];\n\nvar array1 = array.slice();\nvar array2 = array.slice(\"a\", \"3\");\nvar array3 = array.slice(-2);\nvar array4 = array.slice(-12, undefined);\nvar array5 = array.slice(undefined, -3);\nvar array6 = array.slice(Infinity, NaN);\nvar array7 = array.slice(-Infinity, Infinity);\nvar array8 = array.slice(NaN, -Infinity);\n\nassert (array1.length == 4);\nassert (array1[0] == 54);\nassert (array1[1] == undefined);\nassert (array1[2] == \"Lemon\");\nassert (array1[3] == -127);\n\nassert (array2.length == 3);\nassert (array2[0] == 54);\nassert (array2[1] == undefined);\nassert (array2[2] == \"Lemon\");\n\nassert (array3.length == 2);\nassert (array3[0] == \"Lemon\");\nassert (array3[1] == -127);\n\nassert (array4.length == 4);\nassert (array4[0] == 54);\nassert (array4[1] == undefined);\nassert (array4[2] == \"Lemon\");\nassert (array4[3] == -127);\n\nassert (array5.length == 1);\nassert (array5[0] == 54);\n\nassert (array6.length == 0);\n\nassert (array7.length == 4);\nassert (array7[0] == 54);\nassert (array7[1] == undefined);\nassert (array7[2] == \"Lemon\");\nassert (array7[3] == -127);\n\nassert (array8.length == 0);\n\nvar array = [];\narray[4294967293] = \"foo\";\narray.length = 4294967295;\nvar result = array.slice(4294967293, -1)\nassert(result.length === 1)\nassert(result[0] === \"foo\")\n\narray[0] = \"bar\";\nvar result = array.slice(-4294967295, -4294967294)\nassert(result.length === 1)\nassert(result[0] === \"bar\")\n\nvar array = [];\narray[0] = \"foo\";\nvar result = array.slice(4294967296, 4294967297);\nassert(result.length === 0);\n\narray[4294967293] = \"bar\";\nvar result = array.slice(-4294967297, -4294967296);\nassert(result.length === 0);\n\nvar arr = [1,2];\nArray.prototype[0] = 3;\nvar newArr = arr.slice(0, 1);\ndelete Array.prototype[0];\nassert(newArr.hasOwnProperty(\"0\"));\nassert(newArr[0] === 1);\n\n// Checking behavior when unable to get length\nvar obj = { slice : Array.prototype.slice };\nObject.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.slice(1, 2);\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get element\nvar obj = { length : 1, slice : Array.prototype.slice };\nObject.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.slice(0, 1);\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n/* ES v5.1 15.4.4.10.5.\n   Checking behavior when start value throws exception */\nvar arg1 = { };\nObject.defineProperty(arg1, 'valueOf', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\nvar obj = { slice : Array.prototype.slice };\n\ntry {\n  obj.slice(arg1);\n  assert(false);\n} catch (e) {\n  assert(e.message === 'foo');\n  assert(e instanceof ReferenceError);\n}\n\n/* ES v5.1 15.4.4.10.7.\n   Checking behavior when end value throws exception */\nvar arg2 = { };\nObject.defineProperty(arg2, 'valueOf', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\nvar obj = { slice : Array.prototype.slice };\n\ntry {\n  obj.slice(0, arg2);\n  assert(false);\n} catch (e) {\n  assert(e.message === 'foo');\n  assert(e instanceof ReferenceError);\n}\n\n/* ES v5.1 15.4.4.10.10.\n   Checking behavior when unable to get element */\nvar obj = { length : 3, slice : Array.prototype.slice };\nObject.defineProperty(obj, '1', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.slice(0, 3);\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\nfunction array_check(result_array, expected_array) {\n  assert(result_array instanceof Array);\n  assert(result_array.length === expected_array.length);\n  for (var idx = 0; idx < expected_array.length; idx++) {\n    assert(result_array[idx] === expected_array[idx]);\n  }\n}\n\n// Remove the buffer\nvar array = [1, 2, 3, 4, 5];\nvar value = array.slice(4, {\n    valueOf: function() {\n        array.length = 0;\n    }\n})\n\narray_check(value, []);\n\n// Extend the buffer\nvar array = [1, 2, 3, 4, 5];\nvar value = array.slice(6, {\n    valueOf: function() {\n        array.length = 10;\n    }\n})\n\narray_check(value, []);\n\n// Reduce the buffer\nvar array = [1, 2, 3, 4, 5];\nvar value = array.slice(1, {\n    valueOf: function() {\n        array.length = 3;\n    }\n})\n\narray_check(value, []);\n\n// Constructor creates longer array than expected.\nclass LongArray extends Array {\n  constructor(len) {\n      super (42);\n      this.fill (\"foo\");\n  }\n}\n\nvar a = new LongArray (5);\na.length = 5;\nvar sliced = a.slice ();\nassert (sliced.length == 5);\nassert (JSON.stringify (sliced) == '[\"foo\",\"foo\",\"foo\",\"foo\",\"foo\"]')\n\n// Constructor creates shorter array than expected.\nclass ShortArray extends Array {\n  constructor(len) {\n      super (2);\n      this.fill (\"bar\");\n  }\n}\n\nvar b = new ShortArray (8);\nb.length = 8;\nb.fill (\"asd\", 2);\nvar sliced2 = b.slice ();\nassert (sliced2.length == 8);\nassert (JSON.stringify (sliced2) == '[\"bar\",\"bar\",\"asd\",\"asd\",\"asd\",\"asd\",\"asd\",\"asd\"]');\n\n// Constructor creates array of the expected size.\nclass ExactArray extends Array {\n  constructor(len) {\n      super (len);\n      this.fill (\"baz\");\n  }\n}\n\nvar c = new ExactArray (5);\nvar sliced3 = c.slice();\nassert (sliced3.length == 5);\nassert (JSON.stringify (sliced3) == '[\"baz\",\"baz\",\"baz\",\"baz\",\"baz\"]');\n"
  },
  {
    "path": "tests/jerry/array-prototype-some.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [\"foo\", [], Infinity, 4];\n\nfunction f(arg1, arg2, arg3) {\n  assert(arg1 === array[arg2]);\n  assert(arg3 === array);\n  return false;\n}\n\nassert(array.some(f) === false);\n\nfunction g(arg1, arg2, arg3) {\n  if (arg1 === 1) {\n    return true;\n  } else {\n    return false;\n  }\n}\n\nvar arr1 = [2, 2, 2, 2, 2, 2];\nassert(arr1.some(g) === false);\n\nvar arr2 = [2, 2, 2, 2, 2, 1];\nassert(arr2.some(g) === true);\n\n// Checking behavior when unable to get length\nvar obj = { some : Array.prototype.some };\nObject.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.some(f);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get element\nvar obj = { some : Array.prototype.some, length : 1};\nObject.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.some(f);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-sort.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [\"Peach\", \"Apple\", \"Orange\", \"Grape\", \"Cherry\", \"Apricot\", \"Grapefruit\"];\narray.sort();\n\nassert(array[0] === \"Apple\");\nassert(array[1] === \"Apricot\");\nassert(array[2] === \"Cherry\");\nassert(array[3] === \"Grape\");\nassert(array[4] === \"Grapefruit\");\nassert(array[5] === \"Orange\");\nassert(array[6] === \"Peach\");\n\nvar array = [6, 4, 5, 1, 2, 9, 7, 3, 0, 8];\n\n// Default comparison\narray.sort();\nfor (i = 0; i < array.length; i++) {\n  assert(array[i] === i);\n}\n\n// Using custom comparison function\nfunction f(arg1, arg2) {\n  if (arg1 < arg2) {\n    return 1;\n  } else if (arg1 > arg2) {\n    return -1;\n  } else {\n    return 0;\n  }\n}\n\narray.sort(f);\nfor (i = 0; i < array.length; i++) {\n  assert(array[array.length - i - 1] === i);\n}\n\n// Sorting sparse array\nvar array = [1,,2,,3,,4,undefined,5];\nvar expected = [1,2,3,4,5,undefined,,,,];\n\narray.sort();\n\nassert(array.length === expected.length);\nfor (i = 0; i < array.length; i++) {\n  assert(expected.hasOwnProperty (i) === array.hasOwnProperty (i));\n  assert(array[i] === expected[i]);\n}\n\n// Checking behavior when provided comparefn is not callable\nvar obj = {};\nvar arr = [];\ntry {\n  arr.sort(obj);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Checking behavior when unable to get length\nvar obj = { sort : Array.prototype.sort}\nObject.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.sort();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get element\nvar obj = { sort : Array.prototype.sort, length : 1}\nObject.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.sort();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get elements\nvar obj = { sort : Array.prototype.sort, length : 2};\nObject.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\nObject.defineProperty(obj, '1', { 'get' : function () { throw new ReferenceError (\"bar\"); } });\n\ntry {\n  obj.sort();\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when array is non-extensible while sorting\nvar arr = [1, 0];\n\ntry {\n  arr.sort(function () { Object.freeze(arr) });\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Checking behavior when unable to delete property\nvar obj = {sort : Array.prototype.sort, '0' : 2, '1' : 1, length : 4};\nObject.defineProperty(obj, '3', function () {});\n\ntry {\n  obj.sort();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Checking behavior when unable to get the last element\nvar arr = [1, 2, ];\nObject.defineProperty(arr, '2', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  arr.sort();\n  assert(false);\n} catch (e) {\n  assert(e.message === 'foo');\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when lhs_value throws exception at comparefn\nf = function () { throw new ReferenceError('foo'); };\nobj = { 'toString' : f };\narr = [obj, 1];\n\ntry {\n  arr.sort();\n  assert(false);\n} catch (e) {\n  assert(e.message === 'foo');\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when rhs_value throws exception at comparefn\nf = function () { throw new ReferenceError('foo'); };\nobj = { 'toString' : f };\narr = [1, obj];\n\ntry {\n  arr.sort();\n  assert(false);\n} catch (e) {\n  assert(e.message === 'foo');\n  assert(e instanceof ReferenceError);\n}\n\n// Sorting when array elements are the same string\narr = ['foo', 'foo'];\narr.sort();\n\nassert(arr[0] === 'foo');\nassert(arr[1] === 'foo');\n\n// Checking behavior when comparefn's call value cannot be converted to number\nobj = { };\nObject.defineProperty(obj, 'toString', function () { });\nf = function () { return obj };\narr = [1, 2];\n\ntry {\n  arr.sort(f);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar proxy = new Proxy({length: 5}, {\n  getOwnPropertyDescriptor() { throw 42.5; }\n})\n\ntry {\n  Array.prototype.sort.call(proxy);\n  assert(false);\n} catch (e) {\n  assert(e === 42.5);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-splice.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// This test will not pass on FLOAT32 due to precision issues\n\nfunction setDefaultValues()\n{\n  return [54, undefined, -127, \"sunshine\"];\n}\n\nvar array = setDefaultValues();\nvar array1 = array.splice();\n\nassert (array.length == 4);\nassert (array[0] == 54);\nassert (array[1] == undefined);\nassert (array[2] == -127);\nassert (array[3] == \"sunshine\");\nassert (array1.length == 0);\n\n// --------------------------------------------------------\narray = setDefaultValues(); // 54, undefined, -127, \"sunshine\"\nvar array2 = array.splice(2);\n\nassert (array.length == 2);\nassert (array[0] == 54);\nassert (array[1] == undefined);\nassert (array2.length == 2);\nassert (array2[0] == -127);\nassert (array2[1] == \"sunshine\");\n\n// --------------------------------------------------------\narray = setDefaultValues(); // 54, undefined, -127, \"sunshine\"\nvar array3 = array.splice(2, 1);\n\nassert (array.length == 3);\nassert (array[0] == 54);\nassert (array[1] == undefined);\nassert (array[2] == \"sunshine\");\nassert (array3.length == 1);\nassert (array3[0] == -127);\n\n// --------------------------------------------------------\narray = setDefaultValues(); // 54, undefined, -127, \"sunshine\"\nvar array4 = array.splice(0, 3, 6720, \"Szeged\");\n\nassert (array.length == 3);\nassert (array[0] == 6720);\nassert (array[1] == \"Szeged\");\nassert (array[2] == \"sunshine\");\nassert (array4.length == 3);\nassert (array4[0] == 54);\nassert (array4[1] == undefined);\nassert (array4[2] == -127);\n\n// --------------------------------------------------------\narray = setDefaultValues(); // 54, undefined, -127, \"sunshine\"\nvar array5 = array.splice(-2, -2, 6720, \"Szeged\");\n\nassert (array.length == 6);\nassert (array[0] == 54);\nassert (array[1] == undefined);\nassert (array[2] == 6720);\nassert (array[3] == \"Szeged\");\nassert (array[4] == -127);\nassert (array[5] == \"sunshine\");\nassert (array5.length == 0);\n\n// --------------------------------------------------------\narray = setDefaultValues(); // 54, undefined, -127, \"sunshine\"\nvar array6 = array.splice(undefined, undefined, undefined);\n\nassert (array.length == 5);\nassert (array[0] == undefined);\nassert (array[1] == 54);\nassert (array[2] == undefined);\nassert (array[3] == -127);\nassert (array[4] == \"sunshine\");\nassert (array6.length == 0);\n\n// --------------------------------------------------------\narray = setDefaultValues(); // 54, undefined, -127, \"sunshine\"\nvar array7 = array.splice(Infinity, NaN);\nassert (array.length == 4);\nassert (array[0] == 54);\nassert (array[1] == undefined);\nassert (array[2] == -127);\nassert (array[3] == \"sunshine\");\nassert (array7.length == 0);\n\n// --------------------------------------------------------\narray = setDefaultValues(); // 54, undefined, -127, \"sunshine\"\nvar array8 = array.splice(-Infinity, Infinity);\n\nassert (array.length == 0);\nassert (array8.length == 4);\nassert (array8[0] == 54);\nassert (array8[1] == undefined);\nassert (array8[2] == -127);\nassert (array8[3] == \"sunshine\");\n\n// --------------------------------------------------------\narray = setDefaultValues(); // 54, undefined, -127, \"sunshine\"\nvar array9 = array.splice(NaN, -Infinity);\nassert (array.length == 4);\nassert (array[0] == 54);\nassert (array[1] == undefined);\nassert (array[2] == -127);\nassert (array[3] == \"sunshine\");\nassert (array9.length == 0);\n\n// --------------------------------------------------------\narray = setDefaultValues(); // 54, undefined, -127, \"sunshine\"\nvar array10 = array.splice(-3, 4, Infinity, \"university\");\nassert (array.length == 3);\nassert (array[0] == 54);\nassert (array[1] == Infinity);\nassert (array[2] == \"university\");\nassert (array10.length == 3);\nassert (array10[0] == undefined);\nassert (array10[1] == -127);\nassert (array10[2] == \"sunshine\");\n\nvar array = [];\narray[4294967294] = \"foo\";\nvar result = array.splice(4294967294, 1, \"x\")\nassert(result.length === 1)\nassert(result[0] === \"foo\")\nassert(array[4294967294] === \"x\")\n\narray[0] = \"bar\";\nvar result = array.splice(-4294967295, 1, \"y\");\nassert(result.length === 1)\nassert(result[0] === \"bar\")\nassert(array[0] === \"y\")\n\nvar arr = [1,2];\nArray.prototype[0] = 3;\nvar newArr = arr.splice(0, 1);\ndelete Array.prototype[0];\nassert(newArr.hasOwnProperty(\"0\"));\nassert(newArr[0] === 1);\n\n// Checking behavior when unable to get length\nvar obj = {splice : Array.prototype.splice};\nObject.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.splice(1, 2, \"item1\", \"item2\");\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to get element\nvar obj = {length : 1, splice : Array.prototype.splice};\nObject.defineProperty(obj, '0', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.splice(0, 1, \"item1\", \"item2\");\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n/* ES v5.1 15.4.4.12.5.\n   Checking behavior when the first argument of the function is an object, which throws error */\ntry {\n  var o = {};\n  Object.defineProperty(o, 'toString', { 'get' : function() { throw new ReferenceError(\"1\"); } });\n  [1, 2].splice(o);\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n  assert(e.message == \"1\");\n}\n\n/* ES v5.1 15.4.4.12.7.\n   Checking behavior when the second argument of the function is an object, which throws error */\ntry {\n  var o = {};\n  Object.defineProperty(o, 'toString', { 'get' : function() { throw new ReferenceError(\"2\"); } });\n  [1, 2].splice(1, o);\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n  assert(e.message == \"2\");\n}\n\n/* ES v5.1 15.4.4.12.9.b\n   Checking behavior when the first element throws error */\ntry {\n  var a = [1, 5, 6, 7, 8, 5];\n  Object.defineProperty(a, '0', { 'get' : function() { throw new ReferenceError(\"foo0\"); } });\n  Array.prototype.splice.call(a, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3);\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n  assert(e.message == \"foo0\");\n}\n\n/* ES v5.1 15.4.4.12.12.b.iii.\n   Checking behavior when an element of the array throws error */\nfunction f0() { throw new TypeError(\"4\"); };\n\ntry {\n  obj = {get: f0, valueOf : f0, toString: f0};\n  arr = [1, 2, obj, 4, 5];\n  Object.defineProperty(arr, '4', { 'get' : f0 });\n  arr.splice(1, 3, obj);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n  assert(e.message == \"4\");\n}\n\n/* ES v5.1 15.4.4.12 12.b.iv.\n   Checking behavior when a modified object is an element of the array */\nfunction f() {\n  delete arr[3];\n  arr.length = 13;\n  Object.defineProperty(arr, '5', function() { });\n};\n\ntry {\n  obj = {get: f, valueOf : f, toString: f};\n  arr = [1, 2, obj, 4, 5];\n  Object.defineProperty(arr, '2',{ 'get' : f } );\n  for(var i = 0; i < arr.length; i++) {\n    var a = arr[i];\n  }\n  arr.splice(1, 4, obj);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.12.12.b.v.\n   Checking behavior when elements are getting deleted by an element which only has a get function */\nfunction f1() {\n  for(var i = 0; i < arr.length; i++) {\n    delete arr[i];\n  }\n};\n\ntry{\n  arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];\n  delete arr[2];\n  Object.defineProperty(arr, '2', { 'get' : f1 });\n  arr.splice(1, 7, 5);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.12.12.d.i.\n   Checking behavior when a modified object is an element of the array and deletes the elements */\nfunction f2() {\n  for(var i = 0; i < arr.length; i++) {\n    delete arr[i];\n  }\n};\n\ntry {\n  obj = {get: f2, valueOf : f2, toString: f2 };\n  arr = [1, 2, obj, 4, 5];\n  for(var i = 0; i < 6; i++) {\n    Object.defineProperty(arr, i, { 'get' : f2 });\n  }\n  arr.splice(1, 3, obj);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.12.13.b.iii.\n   Checking behavior when a yet non existing element will throw an error */\nfunction f3() { throw new TypeError(\"6\");};\n\ntry {\n  arr = [1, 2, 4, 5];\n  Object.defineProperty(arr, '4',{ 'get' : f3 });\n  arr.splice(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n  assert(e.message == \"6\");\n}\n\n/* ES v5.1 15.4.4.12.13.b.iv.2.\n   Checking behavior when the last element gets deleted */\nfunction f4() { delete arr[23]; };\n\ntry {\n  arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24];\n  delete arr[23];\n  Object.defineProperty(arr, '23', { 'get' : f4 });\n  arr.splice(1, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.12.13.b.v.1.\n   Checking behavior when the last element throws error */\nfunction f5() {\n  for(var i = 0; i < arr.length; i++) {\n    delete arr[i];\n  }\n};\n\ntry {\n  arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24];\n  delete arr[23];\n  Object.defineProperty(arr, '23', { 'get' : f5 });\n  arr.splice(1, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.12.15.b.\n   Checking behavior when the issue is the same as above, but splice has more arguments */\nfunction f6() {\n  for(var i = 0; i < arr.length; i++) {\n    delete arr[i];\n  }\n};\n\ntry {\n  arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];\n  delete arr[2];\n  Object.defineProperty(arr, '2', { 'get' : f6 });\n  arr.splice(1, 7, 5, 5, 5, 5);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.12.16.\n   Checking behavior when the array is empty, large, and not writable */\ntry {\n  arr = [];\n  Object.defineProperty(arr, 'length', { value : 999, writable: false });\n  arr.splice(1, 2, 4, 5);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-tolocalestring.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert ([].toLocaleString() === \"\");\nassert ([1].toLocaleString() === \"1\");\nassert ([1,2].toLocaleString() === \"1,2\");\nassert ([1,2,3].toLocaleString() === \"1,2,3\");\n\nvar test_ok = {\n  length: 1,\n  toLocaleString: function() { return \"1\"; }\n};\n\nassert ([3, test_ok, 4, test_ok].toLocaleString() === \"3,1,4,1\");\n\n\nvar obj = { toLocaleString: function() {} };\nvar test_non_str_locale = [undefined, obj, null, obj, obj];\n\nassert(test_non_str_locale.toLocaleString() === \",undefined,,undefined,undefined\");\n\nvar test_fail = {\n  toLocaleString: \"FAIL\"\n};\n\ntry {\n  [test_fail].toLocaleString();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n\nvar test_fail_call = {\n  toLocaleString: function() { throw new ReferenceError(\"foo\"); }\n};\n\n\ntry {\n  [1, 2, test_fail_call].toLocaleString();\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-tostring.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Our own join method if the internal join is not implemented.\nfunction join(sep)\n{\n  sep = sep ? sep : \",\";\n  var result = \"\";\n\n  for (var i = 0; i < this.length; ++i) {\n    result += this[i];\n    if (i + 1 < this.length) {\n      result += sep;\n    }\n  }\n\n  return result;\n}\n\n// Force fallback to object.prototype.toString()\nArray.prototype.join = 1;\n\nassert ([1].toString() === \"[object Array]\");\n\nArray.prototype.join = join;\n\nassert ([1, 2].toString() === \"1,2\");\n\nvar test = [1,2,3];\ntest.join = function() { throw ReferenceError (\"foo\"); };\n\ntry {\n  test.toString();\n\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n\n// Test if the join returns a ReferenceError\nvar arr = [1,2]\nObject.defineProperty(arr, 'join', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\ntry {\n  arr.toString();\n\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/array-prototype-unshift.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = []\n\nassert(array.length === 0);\n\narray.unshift(\"foo\");\nassert(array.length === 1);\nassert(array[0] === \"foo\");\n\narray.unshift(new Array())\nassert(array.length === 2);\nassert(array[0] instanceof Array);\nassert(array[1] === \"foo\")\n\narray.unshift(Infinity);\nassert(array.length === 3);\nassert(array[0] === Infinity);\nassert(array[1] instanceof Array);\nassert(array[2] === \"foo\")\n\narray.unshift(\"bar\", 0);\nassert(array.length === 5);\nassert(array[0] === \"bar\");\nassert(array[1] === 0);\nassert(array[2] === Infinity);\nassert(array[3] instanceof Array);\nassert(array[4] === \"foo\")\n\n\n// Checking behavior when no length property defined\nvar obj = { unshift : Array.prototype.unshift };\n\nassert(obj.length === undefined);\nobj.unshift(1,2,3);\nassert(obj.length === 3);\n\n// Checking behavior when unable to get length\nvar obj = { unshift : Array.prototype.unshift };\nObject.defineProperty(obj, 'length', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.unshift(1);\n  assert(false)\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable to set length\nvar obj = { unshift : Array.prototype.unshift };\nObject.defineProperty(obj, 'length', { 'set' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.unshift(2);\n  assert(false)\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when unable shift elements\nvar obj = { unshift : Array.prototype.unshift, length : 1 };\nObject.defineProperty(obj, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.unshift(3);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\nvar obj = { unshift : Array.prototype.unshift, length : 1 };\nObject.defineProperty(obj, '0', { 'set' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj.unshift(4);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// Checking behavior when a property is not defined\nvar obj = { '0' : \"foo\", '2' : \"bar\", length : 3, unshift : Array.prototype.unshift };\nassert(obj.unshift(\"baz\") === 4);\nassert(obj[0] === \"baz\");\nassert(obj[1] === \"foo\");\nassert(obj[2] === undefined);\nassert(obj[3] === \"bar\");\n\n/* ES v5.1 15.4.4.13.6.d.ii.\n   Checking behavior when the array is freezed */\ntry {\n  var arr = [0, 1];\n  Object.freeze(arr);\n  Array.prototype.unshift.call(arr, 2, 3);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* ES v5.1 15.4.4.13.6.e.i.\n   Checking behavior when the array has only one property and bigger length */\ntry {\n  var arr = { length : 9 };\n  Object.defineProperty(arr, '6', { value : 2 });\n  Array.prototype.unshift.call(arr, 2, 3);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar arrayLike = {get 5() { throw \"shouldn't throw\"; }};\narrayLike.length = 10;\nArray.prototype.unshift.call(arrayLike);\n"
  },
  {
    "path": "tests/jerry/array-prototype-values.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  Array.prototype.values.call (undefined);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError)\n}\n\nvar array = ['a', \"foo\", 1, 1.5, true, {} ,[], function f () { }];\n\nvar iterator = array.values ();\n\n/* The initial value of the @@iterator property is the same function object\n   as the initial value of the Array.prototype.values property. */\nvar symbol_iterator = array[Symbol.iterator] ();\n\nvar current_item = iterator.next ();\nvar symbol_current_item = symbol_iterator.next ();\n\nfor (var i = 0; i < array.length; i++) {\n  assert (current_item.value === array[i]);\n  assert (current_item.done === false);\n\n  assert (current_item.value === symbol_current_item.value);\n  assert (current_item.done === symbol_current_item.done);\n\n  current_item = iterator.next ();\n  symbol_current_item = symbol_iterator.next ();\n}\n\nassert (current_item.value === undefined);\nassert (current_item.done === true);\nassert (current_item.value === symbol_current_item.value);\nassert (current_item.done === symbol_current_item.done);\n\nfunction foo_error () {\n  throw new ReferenceError (\"foo\");\n}\n\narray = [1, 2, 3, 4, 5, 6, 7];\n\n['0', '3', '5'].forEach (function (e) {\n  Object.defineProperty (array, e, { 'get' : foo_error });\n})\n\niterator = array.values ();\n\nvar expected_values = [2, 3, 5, 7];\nvar expected_values_idx = 0;\n\nfor (var i = 0; i < array.length; i++) {\n  try {\n    current_item = iterator.next ();\n    assert (current_item.value === expected_values[expected_values_idx++]);\n    assert (current_item.done === false);\n  } catch (e) {\n    assert (e instanceof ReferenceError);\n    assert (e.message === \"foo\");\n  }\n}\n\ncurrent_item = iterator.next ();\nassert (current_item.value === undefined);\nassert (current_item.done === true);\n\n/* Test empty array */\narray = [];\n\niterator = array.values ();\ncurrent_item = iterator.next ();\n\nassert (current_item.value === undefined);\nassert (current_item.done === true);\n\n/* Test delete elements after the iterator has been constructed */\n\narray = [0, 1, 2, 3, 4, 5];\niterator = array.values ();\n\nfor (var i = 0; i < array.length; i++) {\n  current_item = iterator.next ();\n  assert (current_item.value === array[i]);\n  assert (current_item.done === false);\n  array.pop();\n}\n\nassert ([].values ().toString () === \"[object Array Iterator]\");\n"
  },
  {
    "path": "tests/jerry/array-slice.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nlet buf = new ArrayBuffer(10);\nlet a1 = new Int8Array(buf, 0, 5);\na1.fill(1);\na1.constructor = {\n    [Symbol.species]: function (len) {\n        return new Int8Array(buf, 5, 5);\n    }\n};\nlet a2 = a1.slice(2,4);\nres = new Int8Array(buf, 0, 10);\n\n//Expected: 1, 1, 1, 1, 1, 1, 1, 0, 0, 0\nfor (let i = 0; i < 10; i++) {\n    if (i < 7) {\n        assert(res[i] === 1);\n    } else {\n        assert(res[i] === 0);\n    }\n}\n"
  },
  {
    "path": "tests/jerry/array-species.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n// Test the ES2015 @@species feature\n\n'use strict';\n\n// Subclasses of Array construct themselves under map, etc\n\nclass MyArray extends Array { }\n\nfunction assertEquals(a, b) {\n  assert(a === b);\n}\n\nassertEquals(MyArray, new MyArray().map(()=>{}).constructor);\nassertEquals(MyArray, new MyArray().filter(()=>{}).constructor);\nassertEquals(MyArray, new MyArray().slice().constructor);\nassertEquals(MyArray, new MyArray().splice().constructor);\nassertEquals(MyArray, new MyArray().concat([1]).constructor);\nassertEquals(1, new MyArray().concat([1])[0]);\n\n// Subclasses can override @@species to return the another class\n\nclass MyOtherArray extends Array {\n  static get [Symbol.species]() { return MyArray; }\n}\n\nassertEquals(MyArray, new MyOtherArray().map(()=>{}).constructor);\nassertEquals(MyArray, new MyOtherArray().filter(()=>{}).constructor);\nassertEquals(MyArray, new MyOtherArray().slice().constructor);\nassertEquals(MyArray, new MyOtherArray().splice().constructor);\nassertEquals(MyArray, new MyOtherArray().concat().constructor);\n\n// Array  methods on non-arrays return arrays\n\nclass MyNonArray extends Array {\n  static get [Symbol.species]() { return MyObject; }\n}\n\nclass MyObject { }\n\nassertEquals(MyObject,\n             Array.prototype.map.call(new MyNonArray(), ()=>{}).constructor);\nassertEquals(MyObject,\n             Array.prototype.filter.call(new MyNonArray(), ()=>{}).constructor);\nassertEquals(MyObject,\n             Array.prototype.slice.call(new MyNonArray()).constructor);\nassertEquals(MyObject,\n             Array.prototype.splice.call(new MyNonArray()).constructor);\nassertEquals(MyObject,\n             Array.prototype.concat.call(new MyNonArray()).constructor);\n\nassertEquals(undefined,\n             Array.prototype.map.call(new MyNonArray(), ()=>{}).length);\nassertEquals(undefined,\n             Array.prototype.filter.call(new MyNonArray(), ()=>{}).length);\n// slice, splice, and concat actually do explicitly define the length.\nassertEquals(0, Array.prototype.slice.call(new MyNonArray()).length);\nassertEquals(0, Array.prototype.splice.call(new MyNonArray()).length);\nassertEquals(1, Array.prototype.concat.call(new MyNonArray(), ()=>{}).length);\n\n// Defaults when constructor or @@species is missing or non-constructor\n\nclass MyDefaultArray extends Array {\n  static get [Symbol.species]() { return undefined; }\n}\nassertEquals(Array, new MyDefaultArray().map(()=>{}).constructor);\n\nclass MyOtherDefaultArray extends Array { }\nassertEquals(MyOtherDefaultArray,\n             new MyOtherDefaultArray().map(()=>{}).constructor);\nMyOtherDefaultArray.prototype.constructor = undefined;\nassertEquals(Array, new MyOtherDefaultArray().map(()=>{}).constructor);\nassertEquals(Array, new MyOtherDefaultArray().concat().constructor);\n\n// Exceptions propagated when getting constructor @@species throws\n\nclass SpeciesError extends Error { }\nclass ConstructorError extends Error { }\nclass MyThrowingArray extends Array {\n  static get [Symbol.species]() { throw new SpeciesError; }\n}\n\nfunction assertThrows (a, b) {\n  try {\n    a();\n  } catch (e) {\n    assert(e instanceof b);\n  }\n}\n\nassertThrows(() => new MyThrowingArray().map(()=>{}), SpeciesError);\nObject.defineProperty(MyThrowingArray.prototype, 'constructor', {\n    get() { throw new ConstructorError; }\n});\nassertThrows(() => new MyThrowingArray().map(()=>{}), ConstructorError);\n\n// Previously unexpected errors from setting properties in arrays throw\n\nclass FrozenArray extends Array {\n  constructor(...args) {\n    super(...args);\n    Object.freeze(this);\n  }\n}\nassertThrows(() => new FrozenArray([1]).map(()=>0), TypeError);\nassertThrows(() => new FrozenArray([1]).filter(()=>true), TypeError);\nassertThrows(() => new FrozenArray([1]).slice(0, 1), TypeError);\nassertThrows(() => new FrozenArray([1]).splice(0, 1), TypeError);\nassertThrows(() => new FrozenArray([]).concat([1]), TypeError);\n\n// Verify call counts and constructor parameters\n\nvar count;\nvar params;\nclass MyObservedArray extends Array {\n  constructor(...args) {\n    super(...args);\n    params = args;\n  }\n  static get [Symbol.species]() {\n    count++\n    return this;\n  }\n}\n\nfunction assertArrayEquals(value, expected, type) {\n  assert(expected.length === value.length);\n  for (var i=0; i<value.length; ++i) {\n    assertEquals(expected[i], value[i]);\n  }\n}\n\ncount = 0;\nparams = undefined;\nassertEquals(MyObservedArray,\n             new MyObservedArray().map(()=>{}).constructor);\nassertEquals(1, count);\nassertArrayEquals([0], params);\n\ncount = 0;\nparams = undefined;\nassertEquals(MyObservedArray,\n             new MyObservedArray().filter(()=>{}).constructor);\nassertEquals(1, count);\nassertArrayEquals([0], params);\n\ncount = 0;\nparams = undefined;\nassertEquals(MyObservedArray,\n             new MyObservedArray().concat().constructor);\nassertEquals(1, count);\nassertArrayEquals([0], params);\n\ncount = 0;\nparams = undefined;\nassertEquals(MyObservedArray,\n             new MyObservedArray().slice().constructor);\nassertEquals(1, count);\nassertArrayEquals([0], params);\n\ncount = 0;\nparams = undefined;\nassertEquals(MyObservedArray,\n             new MyObservedArray().splice().constructor);\nassertEquals(1, count);\nassertArrayEquals([0], params);\n"
  },
  {
    "path": "tests/jerry/array-spread.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction assertArrayEqual (actual, expected) {\n  assert (actual.length === expected.length);\n\n  for (var i = 0; i < actual.length; i++) {\n    assert (actual[i] === expected[i]);\n  }\n}\n\nfunction checkSyntax (str) {\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\nfunction mustThrow (str) {\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n}\n\ncheckSyntax (\"{...a}\");\ncheckSyntax (\"...a\");\ncheckSyntax (\"[...]\");\ncheckSyntax (\"[...(...)]\");\ncheckSyntax (\"[......]\");\n\nmustThrow (\"[...5]\");\nmustThrow (\"[...5, 'foo', 'bar']\");\nmustThrow (\"[...{}]\");\nmustThrow (\"[...{ get [Symbol.iterator] () { throw new TypeError } }]\");\nmustThrow (\"[...{ [Symbol.iterator] () {} }, 'foo']\");\nmustThrow (\"[...{ [Symbol.iterator] () { return {} } }]\");\nmustThrow (\"[...{ [Symbol.iterator] () { return { next: 5 } } }]\");\nmustThrow (\"[...{ [Symbol.iterator] () { return { next: 5 } } }], 'foo'\");\nmustThrow (\"[...{ [Symbol.iterator] () { return { get next() { throw new TypeError } } } }]\");\nmustThrow (\"[...{ [Symbol.iterator] () { return { next () { } } } }]\");\nmustThrow (\"[...{ [Symbol.iterator] () { return { next () { } } } }, 'foo']\");\nmustThrow (\"[...{ [Symbol.iterator] () { return { next () { return { get value () { throw new TypeError } } } } } } ]\");\nmustThrow (\"[...{ [Symbol.iterator] () { return { next () { return { get done () { throw new TypeError } } } } } } ]\");\n\nvar arr1 = [0, 1, 2];\nvar arr2 = [3, 4, 5];\nvar arr3 = [{}, {}, {}];\nvar expected = [0, 1, 2, 3 ,4, 5];\n\nassertArrayEqual ([...arr1, ...arr2], [0, 1, 2, 3 ,4, 5]);\nassertArrayEqual ([...arr2, ...arr1], [3 ,4, 5, 0, 1, 2]);\nassertArrayEqual ([...arr1, 9, 9, 9, ...arr2], [0, 1, 2, 9, 9, 9, 3 ,4, 5]);\nassertArrayEqual ([...arr1, ...[...arr2]], [0, 1, 2, 3 ,4, 5]);\nassertArrayEqual ([\"0\" , \"1\", ...arr1, ...[...arr2]], [\"0\", \"1\", 0, 1, 2, 3 ,4, 5]);\nassertArrayEqual ([...arr3], arr3);\nassertArrayEqual ([...\"foobar\"], [\"f\", \"o\", \"o\", \"b\", \"a\" ,\"r\"]);\nassertArrayEqual ([...(new Set([1, \"foo\", arr3]))], [1, \"foo\", arr3]);\n\nvar holyArray = [,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...arr1];\nassert (holyArray.length === 83);\nassert (holyArray[82] === 2);\nassert (holyArray[81] === 1);\nassert (holyArray[80] === 0);\n"
  },
  {
    "path": "tests/jerry/array.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar cars = [\"Saab\", \"Volvo\", \"BMW\"];\n\nassert (cars[0] === \"Saab\");\nassert (cars[1] === \"Volvo\");\nassert (cars[2] === \"BMW\");\n\nvar cars1 = new Array(\"Saab\", \"Volvo\", \"BMW\");\nassert (cars[0] === cars1[0]);\nassert (cars[1] === cars1[1]);\nassert (cars[2] === cars1[2]);\n\nvar a = new Array();\nassert (typeof (a) === \"object\");\nassert (Array.isArray (a));\nassert (Array.isArray ([1, 2, 3]));\n\nvar b = new Array (30000);\nassert(b.length === 30000);\nassert (b[20000] === undefined);\nb[20000] = 1;\nassert (b[20000] === 1);\nb[20000] = 10;\nassert (b[20000] === 10);\n\nassert(b.length === 30000);\nassert(b[10000] === undefined);\nObject.defineProperty (b, '10000', {value : 25, writable : false});\nassert(b[10000] === 25);\nb[10000] = 30;\nassert(b[10000] === 25);\n\nassert(b.length === 30000);\nassert(b[50000] === undefined);\nassert(b.length === 30000);\nb[50000] = 5;\nassert(b.length === 50001);\nassert(b[50000] === 5);\nb[50000] = 10;\nassert(b[50000] === 10);\nObject.defineProperty (b, '50000', {writable : false});\nassert(b[50000] === 10);\nb[50000] = 20;\nassert(b[50000] === 10);\n\nObject.defineProperty (b, '50000', {writable : true});\nassert(b[50000] === 10);\nb[50000] = 30;\nassert(b[50000] === 30);\n\nb.length = 5;\nassert(b[50000] === undefined);\n\nassert(([1, 2, 3]).length === 3);\n\nassert(Array.prototype.constructor === Array);\nassert(Array.prototype.length === 0);\nArray.prototype[0] = 'string value';\nassert(Array.prototype.length === 1);\nassert(Array.prototype[0] === 'string value');\n\nvar c = [0,,,'3'];\nassert (c[0] === 0);\nassert (c[1] === undefined);\nassert (c[2] === undefined);\nassert (c[3] === '3');\n\nb[0] = 1;\nc[0] += b[0];\nassert (c[0] == 1);\n\nvar arr = [\n  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,\n  17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,\n  33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,\n  49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,\n  65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,\n  81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,\n  97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,\n  113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,\n  129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,\n  145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160,\n  161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,\n  177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,\n  193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,\n  209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,\n  225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,\n  241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,\n  257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,\n  273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,\n  289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,\n  305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320,\n  321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336,\n  337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352,\n  353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368,\n  369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,\n  385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400,\n  401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416,\n  417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432,\n  433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448,\n  449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464,\n  465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480,\n  481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496,\n  497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512,\n  513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528,\n  529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544,\n  545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560,\n  561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576,\n  577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592,\n  593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608,\n  609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624,\n  625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640,\n  641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656,\n  657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672,\n  673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688,\n  689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704,\n  705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720,\n  721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736,\n  737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752,\n  753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768,\n  769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784,\n  785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800,\n  801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816,\n  817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832,\n  833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848,\n  849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864,\n  865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880,\n  881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896,\n  897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912,\n  913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928,\n  929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944,\n  945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960,\n  961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976,\n  977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992,\n  993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008,\n  1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024 ];\n\nfor (i = 0; i < 1024; i++)\n{\n  assert (arr[i] === i + 1);\n}\n\nvar elision = [0,,2 ,3];\nassert (elision.hasOwnProperty(1) == false);\n\n(function () {\n  \"use strict\";\n  var arr = [1];\n  Object.defineProperty (arr, \"length\", {value: 1, writable: false});\n\n  try {\n    arr[2] = 5;\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n}) ();\n"
  },
  {
    "path": "tests/jerry/arraybuffer-isview.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nassert(ArrayBuffer.isView() === false);\nassert(ArrayBuffer.isView([]) === false);\nassert(ArrayBuffer.isView({}) === false);\nassert(ArrayBuffer.isView(null) === false);\nassert(ArrayBuffer.isView(undefined) === false);\nassert(ArrayBuffer.isView(new ArrayBuffer(10)) === false);\n\nassert(ArrayBuffer.isView(new Int8Array()) === true);\nassert(ArrayBuffer.isView(new Uint8Array()) === true);\nassert(ArrayBuffer.isView(new Uint8ClampedArray()) === true);\nassert(ArrayBuffer.isView(new Int16Array()) === true);\nassert(ArrayBuffer.isView(new Uint16Array()) === true);\nassert(ArrayBuffer.isView(new Int32Array()) === true);\nassert(ArrayBuffer.isView(new Uint32Array()) === true);\nassert(ArrayBuffer.isView(new Float32Array()) === true);\nassert(ArrayBuffer.isView(new Float64Array()) === true);\n\nassert(ArrayBuffer.isView(new Int8Array(10).subarray(0, 3)) === true);\n\nvar buffer = new ArrayBuffer(2);\nvar dv = new DataView(buffer);\nassert(ArrayBuffer.isView(dv) === true);\n"
  },
  {
    "path": "tests/jerry/arrow-assignment.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar y = 0\nvar prot = Object.getPrototypeOf(/ /)\n\nprot.setY = function (v) { y = v }\n\nassert(y === 0)\n// Since arrow function is an assignment expression, this affects certain constructs\nvar f = x => {}\n/ /.setY(5)\nassert(y === 5)\n\nvar s\n// This is not a function call\nassert(eval(\"s = x => { return 1 }\\n(3)\") === 3)\nassert(typeof s === \"function\")\n\n// This is a function call\nassert(eval(\"s = function () { return 1 }\\n(3)\") === 1)\nassert(s === 1)\n\nvar f = 5 ? x => 1 : x => 2\nassert(f() === 1)\n\nvar f = [x => 2][0]\nassert(f() === 2)\n\nvar f = 123; f += x => y\nassert(typeof f === \"string\")\n\n// Comma operator\nassert(eval(\"x => {}, 5\") === 5)\n"
  },
  {
    "path": "tests/jerry/arrow-eval.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nlet a = 4\n\nvar f = () => {\n  eval(\"var a = 5\")\n  assert(a === 5)\n}\nf()\n\nassert(a === 4)\n\nfunction g() {\n  eval(\"var b = 6\")\n\n  assert(b === 6)\n\n  var h = () => delete b\n  h()\n\n  try {\n    b\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n  }\n}\ng()\n"
  },
  {
    "path": "tests/jerry/arrow-function.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction must_throw (str)\n{\n  try\n  {\n    eval (\"switch (1) { default: \" + str + \"}\");\n    assert (false);\n  }\n  catch (e)\n  {\n  }\n\n  try\n  {\n    eval (str);\n    assert (false);\n  }\n  catch (e)\n  {\n  }\n}\n\nfunction must_throw_strict (str)\n{\n  try\n  {\n    eval (\"'use strict'; switch (1) { default: \" + str + \"}\");\n    assert (false);\n  }\n  catch (e)\n  {\n  }\n\n  try\n  {\n    eval (\"'use strict'; \" + str);\n    assert (false);\n  }\n  catch (e)\n  {\n  }\n}\n\nswitch (1)\n{\ndefault:\n\n  var func = x => { return x + 3 }\n  assert (func(5) == 8);\n\n  a => 5 /* no semicolon after */\n\n  assert (((x =>\n    x + 1))(4) == 5)\n\n  assert ((a => a += 3, b => b -= 3)(4) == 1);\n\n  func = true ? x=>x+2:y=>y-2\n  assert (func(10) == 12);\n\n  func = arguments =>\n    { return arguments + 4; }\n  assert (func(2) == 6);\n\n  func = (\n          ) => { return typeof\n    arguments\n  }\n  assert (func() === \"undefined\");\n\n  if (a => 0)\n  {\n  }\n  else\n  {\n    assert (false);\n  }\n\n  assert ((\n    (\n    static\n    ,\n    package\n    ) => static + package\n  ) (2, 12) == 14);\n\n  var global_var = 7;\n\n  assert ((\n    (\n    static\n    ,\n    package\n    ) => { global_var = 5; return static + package }\n  )(4, 5) == 9);\n\n  assert (global_var == 5);\n\n  func = (x , y) => {}\n  assert (func() === undefined)\n\n  assert ((x => y => z => 6)()()() == 6)\n\n  func = x => x - 6\n  var func2 = y => func(y)\n  assert (func2 (17) == 11)\n\n  func = (m) => m++\n  assert (func (4) == 4)\n\n  func = () =>\n    ((([0,0,0])))\n  assert (func ().length == 3);\n\n  func = (a = 5, b = 7 * 2) => a + b;\n  assert (func() == 19);\n  assert (func(1) == 15);\n\n  func = (a = Math.cos(0)) => a;\n  assert (func() == 1);\n}\n\nmust_throw (\"var x => x;\");\nmust_throw (\"(()) => 0\");\nmust_throw (\"((x)) => 0\");\nmust_throw (\"(((x))) => 0\");\nmust_throw (\"(x==6) => 0\");\nmust_throw (\"(x y) => 0\");\nmust_throw (\"x\\n => 0\");\nmust_throw (\"this => 0\");\nmust_throw (\"(true) => 0\");\nmust_throw (\"()\\n=>5\");\nmust_throw (\"3 + x => 3\");\nmust_throw (\"3 || x => 3\");\nmust_throw (\"a = 3 || (x,y) => 3\");\nmust_throw (\"x => {} (4)\");\nmust_throw (\"!x => 4\");\nmust_throw (\"x => {} = 1\");\nmust_throw (\"x => {} a = 1\");\nmust_throw (\"x => {} ? 1 : 0\");\nmust_throw (\"(x,x,x) => 0\");\nmust_throw (\"(x,x,x) => { }\");\nmust_throw_strict (\"(package) => 0\");\nmust_throw_strict (\"(package) => { return 5 }\");\nmust_throw_strict (\"(x,x,x) => 0\");\nmust_throw_strict (\"(x,x,x) => { }\");\n\nvar f = (a) => 1;\nassert(f() === 1);\n\nvar f = (a => 2);\nassert(f() === 2);\n\nvar f = ((((a => ((3))))));\nassert(f() === 3);\n\nvar f = (((a) => 4));\nassert(f() === 4);\n\nvar f = (a,b) => 5;\nassert(f() === 5);\n\nvar f = (((a,b) => 6));\nassert(f() === 6);\n\nvar f = ((a,b) => x => (a) => 7);\nassert(f()()() === 7);\n\nvar f = (((a=1,b=2) => ((x => (((a) => 8))))));\nassert(f()()() === 8);\n\nvar f = () => {};\n\nassert(f.hasOwnProperty('caller') === false);\nassert(f.hasOwnProperty('arguments') === false);\n\nmust_throw(\"var f = () => {}; f.caller\")\nmust_throw(\"var f = () => {}; f.arguments\")\nmust_throw(\"var f = () => {}; f.caller = 1\")\nmust_throw(\"var f = () => {}; f.arguments = 2\")\n"
  },
  {
    "path": "tests/jerry/arrow-this.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar o = {\n  x: 13,\n\n  f: function()\n  {\n    return () => this.x + 1\n  },\n\n  g: function()\n  {\n    return function() {\n      return this.x + 1\n    }\n  }\n}\n\nassert(o.f().call(o) === 14);\nassert(o.g().call(o) === 14);\n\nassert(o.f()() === 14);\n\nvar o2 = { x:4, f:o.f(), g:o.g() }\n\nassert(o2.f() === 14);\nassert(o2.g() === 5);\n"
  },
  {
    "path": "tests/jerry/assignments.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar b = 5;\n\nassert((b += 10) == 15);\nassert((b -= 3) == 12);\nassert((b *= 10) == 120);\nassert((b /= 10) == 12);\nassert((b %= 10) == 2);\n"
  },
  {
    "path": "tests/jerry/async-from-sync-iterator.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nasync function f() {\n    let arr_idx = 0;\n    for await (let a of [0, 1, 2, 3]) {\n        assert(arr_idx++ == a);\n    }\n\n    let char_code = \"a\".charCodeAt(0);\n    for await (let a of \"abc\") {\n        assert(char_code++ == a.charCodeAt(0));\n    }\n\n    let set_idx = 0;\n    for await (let a of new Set([0, 1, 2, 3])) {\n        assert(set_idx++ == a);\n    }\n\n    let map_idx = 0;\n    for await (let [key, value] of new Map([0, 1, 2, 3].entries())) {\n        assert(map_idx++ == value);\n    }\n}\n\nasync function* asyncg(obj) {\n    yield* obj;\n}\n\nasync function f1() {\n    var caught = false;\n    var iter = asyncg({\n        get [Symbol.iterator]() {\n            throw \"Symbol.iteratorError\"\n        },\n    });\n\n    iter.next().catch(e => {\n        caught = true;\n        assert(e === \"Symbol.iteratorError\")\n    }).then(e => {\n        assert(caught)\n    });\n}\n\nasync function f2() {\n    var caught = false;\n    var iter = asyncg({\n        [Symbol.iterator]() {\n            return {\n                next() {\n                    throw \"nextError\";\n                },\n            };\n        },\n    });\n\n    iter.next().catch(e => {\n        caught = true;\n        assert(e === \"nextError\")\n    }).then(e => {\n        assert(caught)\n    });\n}\n\nasync function f3() {\n    var caught = false;\n    var iter = asyncg({\n        [Symbol.iterator]() {\n            return {\n                next() {\n                    return {\n                        get value() {\n                            throw \"valueError\"\n                        },\n                        done: false\n                    };\n                },\n            };\n        },\n    });\n\n    iter.next().catch(e => {\n        caught = true;\n        assert(e === \"valueError\")\n    }).then(e => {\n        assert(caught)\n    });\n}\n\nasync function f4() {\n    var caught = false;\n    var iter = asyncg({\n        [Symbol.iterator]() {\n            return {\n                next() {\n                    return {\n                        value: \"value\",\n                        get done() {\n                            throw \"doneError\"\n                        },\n                    };\n                },\n            };\n        },\n    });\n\n    iter.next().catch(e => {\n        caught = true;\n        assert(e === \"doneError\")\n    }).then(e => {\n        assert(caught)\n    });\n}\n\nasync function f5() {\n    var caught = false;\n\n    var iter = asyncg({\n        [Symbol.iterator]() {\n            return {\n                next() {\n                    return {\n                        value: 1,\n                        done: false\n                    };\n                },\n                get return () {\n                    throw \"returnError\"\n                }\n            };\n        }\n    });\n\n    iter.next().then(function (res) {\n        assert(res.value === 1);\n        assert(!res.done);\n        iter.return().catch(e => {\n            caught = true;\n            assert(e == \"returnError\");\n        }).then(e => {\n            assert(caught);\n        });\n    });\n}\n\nasync function f6() {\n    var caught = false;\n\n    var iter = asyncg({\n        [Symbol.iterator]() {\n            return {\n                next() {\n                    return {\n                        value: 1,\n                        done: false\n                    };\n                },\n                get throw () {\n                    throw \"throwError\"\n                }\n            };\n        }\n    });\n\n    iter.next().then(function (res) {\n        assert(res.value === 1);\n        assert(!res.done);\n        iter.throw().catch(e => {\n            caught = true;\n            assert(e == \"throwError\");\n        }).then(e => {\n            assert(caught);\n        });\n    });\n}\n\nconst tests = [f, f1, f2, f3, f4, f5, f6];\n\nfor (let t of tests) {\n    t();\n}\n\n"
  },
  {
    "path": "tests/jerry/atomics.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nconst buffer = new SharedArrayBuffer (16);\nconst uint8 = new Uint8Array(buffer);\n\nAtomics.isLockFree(3);\n\nconst sab = new SharedArrayBuffer (1024);\nconst int32 = new Int32Array (sab);\n\nAtomics.wait (int32, 0, 0);\nAtomics.notify (int32, 0, 1);\n\ntry {\n  let a;\n  Atomics.add (a, 0, 0);\n  assert(false);\n} catch (ex) {\n  assert (ex instanceof TypeError);\n}\n\ntry {\n  Atomics.add (new Float32Array(10), 0, 2);\n  assert(false);\n} catch (ex) {\n  assert (ex instanceof TypeError);\n}\n\ntry {\n  Atomics.add (uint8, 100, 0);\n  assert(false);\n} catch (ex) {\n  assert (ex instanceof RangeError);\n}\n\ntry {\n  Atomics.add (uint8, -1, 0);\n  assert(false);\n} catch (ex) {\n  assert (ex instanceof RangeError);\n}\n\nassert(Atomics.store(uint8, 0, -1) === -1);\nassert(Atomics.add(uint8, 0, 1) === 255);\nassert(Atomics.load(uint8, 0) === 0);\n\nconst ta_int8 = new Int8Array(new ArrayBuffer(2));\nta_int8[0] = 5;\n\nAtomics.store(ta_int8, 1, 127)\n\nassert(Atomics.load(ta_int8, 0) === 5);\n\nassert(Atomics.add(ta_int8, 0, 12) === 5);\nassert(Atomics.load(ta_int8, 0) === 17);\n\nassert(Atomics.and(ta_int8, 0, 1) === 17);\nassert(Atomics.load(ta_int8, 0) === 1);\n\nassert(Atomics.compareExchange(ta_int8, 0, 5, 123) === 1);\nassert(Atomics.load(ta_int8, 0) === 1);\n\nassert(Atomics.compareExchange(ta_int8, 1, 123, ta_int8[0]) === 127);\nassert(Atomics.load(ta_int8, 0) === 1);\n\nassert(Atomics.compareExchange(ta_int8, 0, 1, 123) === 1);\nassert(Atomics.load(ta_int8, 0) === 123);\n\nassert(Atomics.store(ta_int8, 0, -0) === 0);\nassert(Atomics.load(ta_int8, 0) === 0);\n\nassert(Atomics.store(ta_int8, 0, 1) === 1);\nassert(Atomics.load(ta_int8, 0) === 1);\n\nassert(Atomics.exchange(ta_int8, 0, 12) === 1);\nassert(Atomics.load(ta_int8, 0) === 12);\n\nassert(Atomics.or(ta_int8, 0, 1) === 12);\nassert(Atomics.load(ta_int8, 0) === 13);\n\nassert(Atomics.sub(ta_int8, 0, 2) === 13);\nassert(Atomics.load(ta_int8, 0) === 11);\n\nassert(Atomics.xor(ta_int8, 0, 1) === 11);\nassert(Atomics.load(ta_int8, 0) === 10);\n\nconst ta_bigintint64 = new BigInt64Array(new ArrayBuffer(16));\nta_bigintint64[0] = 5n;\n\nAtomics.store(ta_bigintint64, 1, 127n)\n\nassert(Atomics.load(ta_bigintint64, 0) === 5n);\n\nassert(Atomics.add(ta_bigintint64, 0, 12n) === 5n);\nassert(Atomics.load(ta_bigintint64, 0) === 17n);\n\nassert(Atomics.and(ta_bigintint64, 0, 1n) === 17n);\nassert(Atomics.load(ta_bigintint64, 0) === 1n);\n\nassert(Atomics.compareExchange(ta_bigintint64, 0, 5n, 123n) === 1n);\nassert(Atomics.load(ta_bigintint64, 0) === 1n);\n\nassert(Atomics.compareExchange(ta_bigintint64, 1, 123n, ta_bigintint64[0]) === 127n);\nassert(Atomics.load(ta_bigintint64, 0) === 1n);\n\nassert(Atomics.compareExchange(ta_bigintint64, 0, 1n, 123n) === 1n);\nassert(Atomics.load(ta_bigintint64, 0) === 123n);\n\nassert(Atomics.store(ta_bigintint64, 0, -0n) === 0n);\nassert(Atomics.load(ta_bigintint64, 0) === 0n);\n\nassert(Atomics.store(ta_bigintint64, 0, 1n) === 1n);\nassert(Atomics.load(ta_bigintint64, 0) === 1n);\n\nassert(Atomics.exchange(ta_bigintint64, 0, 12n) === 1n);\nassert(Atomics.load(ta_bigintint64, 0) === 12n);\n\nassert(Atomics.or(ta_bigintint64, 0, 1n) === 12n);\nassert(Atomics.load(ta_bigintint64, 0) === 13n);\n\nassert(Atomics.sub(ta_bigintint64, 0, 2n) === 13n);\nassert(Atomics.load(ta_bigintint64, 0) === 11n);\n\nassert(Atomics.xor(ta_bigintint64, 0, 1n) === 11n);\nassert(Atomics.load(ta_bigintint64, 0) === 10n);\n\ntry {\n  Atomics.store(ta_bigintint64, 0, 1);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.store(ta_int8, 0, 1n);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.store(ta_int8, 0n, 1);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.store(ta_int8, 2, 1);\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\ntry {\n  Atomics.store(ta_int8, -1, 1);\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\ntry {\n  Atomics.load(ta_int8, 0n);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.load(ta_int8, 2);\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\ntry {\n  Atomics.load(ta_int8, -1);\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\ntry {\n  Atomics.exchange(ta_bigintint64, 0, 1);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.exchange(ta_int8, 0, 1n);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.exchange(ta_int8, 0n, 1);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.compareExchange(ta_bigintint64, 0n, 1n, 0n);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.compareExchange(ta_bigintint64, 0, 1, 0n);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.compareExchange(ta_int8, 0, 1n, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.compareExchange(ta_bigintint64, 0, 1n, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.compareExchange(ta_int8, 0, 1, 0n);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.compareExchange(ta_int8, 2, 1, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\ntry {\n  Atomics.compareExchange(ta_int8, -1, 1, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\nconst ta_float32 = new Float32Array(new ArrayBuffer(4));\n\ntry {\n  Atomics.store(ta_float32, 0, 127);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.load(ta_float32, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Atomics.compareExchange(ta_float32, 0, 1, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/bigint-typedarray-prototype-filter.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction arrayEquals(result, expected) {\n  assert(result.length === expected.length);\n\n  for (var idx = 0; idx < result.length; idx++) {\n    assert(result[idx] === expected[idx]);\n  }\n}\n\nvar bigint64_array = new BigInt64Array([1n, 2n, 3n, -4n, 5n]);\n\nfunction positive(element, index, array) {\n  return element > 0n;\n}\n\nvar bigint64_filter = bigint64_array.filter(positive);\narrayEquals(bigint64_filter, [1n, 2n, 3n, 5n]);\n\nvar biguint64_array = new BigUint64Array([1n, 2n, 3n, -4n, 5n]);\nvar biguint64_filter = biguint64_array.filter(positive);\nassert(biguint64_filter.length === 5);\n"
  },
  {
    "path": "tests/jerry/bigint-typedarray-prototype-reduce.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar bigint64_array = new BigInt64Array([1n, 2n, 3n, -4n, 5n]);\n\nfunction sum(prev, current) {\n  return prev + current;\n}\n\nvar bigint64_reduce_result = bigint64_array.reduce(sum, 7n);\nassert(bigint64_reduce_result === 14n);\n\nvar biguint64_array = new BigUint64Array([1n, 2n, 3n, -4n, 5n]);\nvar biguint64_reduce_result = biguint64_array.reduce(sum, 7n);\nassert(biguint64_reduce_result === 18446744073709551630n);\n"
  },
  {
    "path": "tests/jerry/bigint1.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_result(bigint, expected)\n{\n  assert(bigint.toString() === expected)\n}\n\nfunction check_result16(bigint, expected)\n{\n  assert(bigint.toString(16) === expected)\n}\n\nfunction check_syntax_error(code)\n{\n  try {\n    eval(code)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof SyntaxError)\n  }\n}\n\nassert(typeof BigInt(\"0\") == \"bigint\")\n\n// Test BigInt string parsing and toString\n\ncheck_syntax_error(\"BigInt('-0x5')\");\ncheck_syntax_error(\"BigInt('-')\");\ncheck_syntax_error(\"BigInt('00x5')\");\ncheck_syntax_error(\"BigInt('11a')\");\ncheck_syntax_error(\"BigInt('0b2')\");\ncheck_syntax_error(\"BigInt('1n')\");\n\ncheck_result(BigInt(\"0\"), \"0\")\ncheck_result(BigInt(\"-0\"), \"0\")\ncheck_result(BigInt(\"100000000000000000000000000000000000000\"), \"100000000000000000000000000000000000000\")\ncheck_result(BigInt(\"-1234567890123456789012345678901234567890\"), \"-1234567890123456789012345678901234567890\")\ncheck_result(BigInt(\"+1\"), \"1\")\ncheck_result(BigInt(\"+000000000000000000001\"), \"1\")\ncheck_result(BigInt(\"-000000000000000000000\"), \"0\")\ncheck_result(BigInt(\"0x00abcdefABCDEF0123456789000000000000000\"), \"239460437713606077082343926293727858623774720\")\ncheck_result(BigInt(\"0b00100000000000010000000000010000000000010\"), \"274911469570\")\n\nassert(BigInt(\"100000000000000000000000000000000000000\").toString(22) === \"2ci67fiek1bkhec5fig7aiii9hf8c\")\ncheck_result16(BigInt(\"239460437713606077082343926293727858623774720\"), \"abcdefabcdef0123456789000000000000000\")\n\n// Test negate\n\ncheck_result(-BigInt(\"0\"), \"0\")\ncheck_result(-BigInt(\"100\"), \"-100\")\ncheck_result(-BigInt(\"-100\"), \"100\")\ncheck_result(-BigInt(\"100000000000000000000000000000000000000000000\"), \"-100000000000000000000000000000000000000000000\")\ncheck_result(-BigInt(\"-100000000000000000000000000000000000000000000\"), \"100000000000000000000000000000000000000000000\")\n\n// Test addition\n\ncheck_result(BigInt(\"0\") + BigInt(\"0\"), \"0\")\ncheck_result(BigInt(\"1\") + BigInt(\"1\"), \"2\")\ncheck_result(BigInt(\"0\") + BigInt(\"100\"), \"100\")\ncheck_result(BigInt(\"0\") + BigInt(\"-100\"), \"-100\")\ncheck_result(BigInt(\"100\") + BigInt(\"0\"), \"100\")\ncheck_result(BigInt(\"-100\") + BigInt(\"0\"), \"-100\")\n\ncheck_result(BigInt(\"100000000000000000000000000000000000000\") + BigInt(\"100000000000000000000000000000000000000\"),\n             \"200000000000000000000000000000000000000\");\ncheck_result(BigInt(\"-100000000000000000000000000000000000000\") + BigInt(\"-100000000000000000000000000000000000000\"),\n             \"-200000000000000000000000000000000000000\");\ncheck_result(BigInt(\"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3\") + BigInt(\"0xd\"),\n             \"115792089237316195423570985008687907853269984665640564039457584007913129639936\");\ncheck_result(BigInt(\"0xd\") + BigInt(\"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3\"),\n             \"115792089237316195423570985008687907853269984665640564039457584007913129639936\");\n\ncheck_result(BigInt(\"100000000000000000000000000000000000000\") + BigInt(\"-100000000000000000000000000000000000000\"), \"0\")\ncheck_result(BigInt(\"100000000000000000000000000000000000001\") + BigInt(\"-100000000000000000000000000000000000000\"), \"1\")\ncheck_result(BigInt(\"100000000000000000000000000000000000000\") + BigInt(\"-100000000000000000000000000000000000001\"), \"-1\")\ncheck_result(BigInt(\"-100000000000000000000000000000000000000\") + BigInt(\"100000000000000000000000000000000000000\"), \"0\")\ncheck_result(BigInt(\"-100000000000000000000000000000000000001\") + BigInt(\"100000000000000000000000000000000000000\"), \"-1\")\ncheck_result(BigInt(\"-100000000000000000000000000000000000000\") + BigInt(\"100000000000000000000000000000000000001\"), \"1\")\n\n// Test substraction\n\ncheck_result(BigInt(\"0\") - BigInt(\"0\"), \"0\")\ncheck_result(BigInt(\"2\") - BigInt(\"1\"), \"1\")\ncheck_result(BigInt(\"0\") - BigInt(\"100\"), \"-100\")\ncheck_result(BigInt(\"0\") - BigInt(\"-100\"), \"100\")\ncheck_result(BigInt(\"100\") - BigInt(\"0\"), \"100\")\ncheck_result(BigInt(\"-100\") - BigInt(\"0\"), \"-100\")\n\ncheck_result(BigInt(\"100000000000000000000000000000000000000\") - BigInt(\"-100000000000000000000000000000000000000\"),\n             \"200000000000000000000000000000000000000\");\ncheck_result(BigInt(\"-100000000000000000000000000000000000000\") - BigInt(\"100000000000000000000000000000000000000\"),\n             \"-200000000000000000000000000000000000000\");\ncheck_result(BigInt(\"100000000000000000000000000000000000000\") - BigInt(\"-1\"),\n             \"100000000000000000000000000000000000001\");\ncheck_result(BigInt(\"-100000000000000000000000000000000000000\") - BigInt(\"1\"),\n             \"-100000000000000000000000000000000000001\");\ncheck_result(BigInt(\"1\") - BigInt(\"-100000000000000000000000000000000000000\"),\n             \"100000000000000000000000000000000000001\");\ncheck_result(BigInt(\"-1\") - BigInt(\"100000000000000000000000000000000000000\"),\n             \"-100000000000000000000000000000000000001\");\n\ncheck_result(BigInt(\"100000000000000000000000000000000000000\") - BigInt(\"100000000000000000000000000000000000000\"), \"0\")\ncheck_result(BigInt(\"100000000000000000000000000000000000001\") - BigInt(\"100000000000000000000000000000000000000\"), \"1\")\ncheck_result(BigInt(\"100000000000000000000000000000000000000\") - BigInt(\"100000000000000000000000000000000000001\"), \"-1\")\ncheck_result(BigInt(\"-100000000000000000000000000000000000000\") - BigInt(\"-100000000000000000000000000000000000000\"), \"0\")\ncheck_result(BigInt(\"-100000000000000000000000000000000000001\") - BigInt(\"-100000000000000000000000000000000000000\"), \"-1\")\ncheck_result(BigInt(\"-100000000000000000000000000000000000000\") - BigInt(\"-100000000000000000000000000000000000001\"), \"1\")\n\n// Test multiplication\n\ncheck_result(BigInt(\"0\") * BigInt(\"0\"), \"0\")\ncheck_result(BigInt(\"1000\") * BigInt(\"0\"), \"0\")\ncheck_result(BigInt(\"0\") * BigInt(\"1000\"), \"0\")\ncheck_result(BigInt(\"1\") * BigInt(\"100000000000000000000000000000000000000\"), \"100000000000000000000000000000000000000\")\ncheck_result(BigInt(\"1\") * BigInt(\"-100000000000000000000000000000000000000\"), \"-100000000000000000000000000000000000000\")\ncheck_result(BigInt(\"-1\") * BigInt(\"100000000000000000000000000000000000000\"), \"-100000000000000000000000000000000000000\")\ncheck_result(BigInt(\"-1\") * BigInt(\"-100000000000000000000000000000000000000\"), \"100000000000000000000000000000000000000\")\ncheck_result(BigInt(\"100000000000000000000000000000000000000\") * BigInt(\"1\"), \"100000000000000000000000000000000000000\")\ncheck_result(BigInt(\"-100000000000000000000000000000000000000\") * BigInt(\"1\"), \"-100000000000000000000000000000000000000\")\ncheck_result(BigInt(\"100000000000000000000000000000000000000\") * BigInt(\"-1\"), \"-100000000000000000000000000000000000000\")\ncheck_result(BigInt(\"-100000000000000000000000000000000000000\") * BigInt(\"-1\"), \"100000000000000000000000000000000000000\")\n\ncheck_result(BigInt(\"100000000000000000000000000000000000000\") * BigInt(\"100000000000000000000000000000000000000\"),\n             \"10000000000000000000000000000000000000000000000000000000000000000000000000000\")\ncheck_result(BigInt(\"100000000000000000000000000000000000000\") * BigInt(\"-100000000000000000000000000000000000000\"),\n             \"-10000000000000000000000000000000000000000000000000000000000000000000000000000\")\ncheck_result(BigInt(\"-100000000000000000000000000000000000000\") * BigInt(\"100000000000000000000000000000000000000\"),\n             \"-10000000000000000000000000000000000000000000000000000000000000000000000000000\")\ncheck_result(BigInt(\"-100000000000000000000000000000000000000\") * BigInt(\"-100000000000000000000000000000000000000\"),\n             \"10000000000000000000000000000000000000000000000000000000000000000000000000000\")\n\n// Test divide\n\ntry {\n  BigInt(\"32\") / BigInt(\"0\")\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError)\n}\n\ntry {\n  BigInt(\"32\") % BigInt(\"0\")\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError)\n}\n\ncheck_result(BigInt(\"0\") / BigInt(\"1234\"), \"0\")\ncheck_result(BigInt(\"0\") % BigInt(\"1234\"), \"0\")\n\ncheck_result(BigInt(\"100\") / BigInt(\"70\"), \"1\")\ncheck_result(BigInt(\"100\") % BigInt(\"70\"), \"30\")\ncheck_result(BigInt(\"-100\") / BigInt(\"70\"), \"-1\")\ncheck_result(BigInt(\"-100\") % BigInt(\"70\"), \"-30\")\ncheck_result(BigInt(\"100\") / BigInt(\"-70\"), \"-1\")\ncheck_result(BigInt(\"100\") % BigInt(\"-70\"), \"30\")\ncheck_result(BigInt(\"-100\") / BigInt(\"-70\"), \"1\")\ncheck_result(BigInt(\"-100\") % BigInt(\"-70\"), \"-30\")\n\ncheck_result(BigInt(\"100\") / BigInt(\"100\"), \"1\")\ncheck_result(BigInt(\"100\") % BigInt(\"100\"), \"0\")\ncheck_result(BigInt(\"-100\") / BigInt(\"100\"), \"-1\")\ncheck_result(BigInt(\"-100\") % BigInt(\"100\"), \"0\")\ncheck_result(BigInt(\"100\") / BigInt(\"-100\"), \"-1\")\ncheck_result(BigInt(\"100\") % BigInt(\"-100\"), \"0\")\ncheck_result(BigInt(\"-100\") / BigInt(\"-100\"), \"1\")\ncheck_result(BigInt(\"-100\") % BigInt(\"-100\"), \"0\")\n\n/* Division by small value. */\ncheck_result(BigInt(\"100000000000000000000\") / BigInt(\"1000000\"), \"100000000000000\")\ncheck_result(BigInt(\"100000000000000000000\") % BigInt(\"1000000\"), \"0\")\ncheck_result(BigInt(\"12345678901234567890\") / BigInt(\"1000000\"), \"12345678901234\")\ncheck_result(BigInt(\"12345678901234567890\") % BigInt(\"1000000\"), \"567890\")\n\n/* Division by large value. */\ncheck_result(BigInt(\"100000000000000000000\") / BigInt(\"100000000000000000\"), \"1000\")\ncheck_result(BigInt(\"100000000000000000000\") % BigInt(\"100000000000000000\"), \"0\")\ncheck_result(BigInt(\"12345678901234567890123456789012345678901234567890123456789012345678901234567890\") / BigInt(\"10000000000000000000000000000000000000\"),\n                    \"1234567890123456789012345678901234567890123\")\ncheck_result(BigInt(\"12345678901234567890123456789012345678901234567890123456789012345678901234567890\") % BigInt(\"10000000000000000000000000000000000000\"),\n                    \"4567890123456789012345678901234567890\")\ncheck_result16(BigInt(\"0xffffffffffffffffffffffff\") / BigInt(\"0x100000000\"), \"ffffffffffffffff\")\ncheck_result16(BigInt(\"0xffffffffffffffffffffffff\") % BigInt(\"0x100000000\"), \"ffffffff\")\n\n/* Triggers a corner case. */\ncheck_result(BigInt(\"170141183420855150493001878992821682176\") / BigInt(\"39614081266355540842216685573\"), \"4294967293\")\ncheck_result(BigInt(\"170141183420855150493001878992821682176\") % BigInt(\"39614081266355540842216685573\"), \"39614081266355540837921718287\")\n\n// Test shift\n\ncheck_result(BigInt(\"0\") << BigInt(\"10000000\"), \"0\")\ncheck_result(BigInt(\"0\") >> BigInt(\"10000000\"), \"0\")\ncheck_result(BigInt(\"10000000\") << BigInt(\"0\"), \"10000000\")\ncheck_result(BigInt(\"10000000\") >> BigInt(\"0\"), \"10000000\")\n\ncheck_result(BigInt(\"4096\") << BigInt(\"2\"), \"16384\")\ncheck_result(BigInt(\"4096\") << BigInt(\"-2\"), \"1024\")\ncheck_result(BigInt(\"4096\") >> BigInt(\"2\"), \"1024\")\ncheck_result(BigInt(\"4096\") >> BigInt(\"-2\"), \"16384\")\n\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") << BigInt(\"1\"), \"11fdebf9fffdebf9fffdebf9fffdebf9fe\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") << BigInt(\"19\"), \"47f7afe7fff7afe7fff7afe7fff7afe7f80000\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") << BigInt(\"31\"), \"47f7afe7fff7afe7fff7afe7fff7afe7f80000000\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") << BigInt(\"32\"), \"8fef5fcfffef5fcfffef5fcfffef5fcff00000000\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") << BigInt(\"51\"), \"47f7afe7fff7afe7fff7afe7fff7afe7f8000000000000\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") << BigInt(\"63\"), \"47f7afe7fff7afe7fff7afe7fff7afe7f8000000000000000\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") << BigInt(\"64\"), \"8fef5fcfffef5fcfffef5fcfffef5fcff0000000000000000\")\n\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") >> BigInt(\"1\"), \"47f7afe7fff7afe7fff7afe7fff7afe7f\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") >> BigInt(\"19\"), \"11fdebf9fffdebf9fffdebf9fffde\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") >> BigInt(\"31\"), \"11fdebf9fffdebf9fffdebf9ff\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") >> BigInt(\"32\"), \"8fef5fcfffef5fcfffef5fcff\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") >> BigInt(\"51\"), \"11fdebf9fffdebf9fffde\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") >> BigInt(\"63\"), \"11fdebf9fffdebf9ff\")\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") >> BigInt(\"64\"), \"8fef5fcfffef5fcff\")\n\ncheck_result16(-BigInt(\"0xff\") >> BigInt(\"8\"), \"-1\")\ncheck_result16(-BigInt(\"0xff\") >> BigInt(\"1000\"), \"-1\")\ncheck_result16(-BigInt(\"0xff\") >> BigInt(\"7\"), \"-2\")\ncheck_result16(-BigInt(\"0xff00000000\") >> BigInt(\"32\"), \"-ff\")\ncheck_result16(-BigInt(\"0xff80000000\") >> BigInt(\"32\"), \"-100\")\ncheck_result16(-BigInt(\"0xff00000000000000000000000000000000\") >> BigInt(\"128\"), \"-ff\")\ncheck_result16(-BigInt(\"0xff80000000000000000000000000000000\") >> BigInt(\"128\"), \"-100\")\ncheck_result16(-BigInt(\"0xfe00000000000000000000000000000000\") >> BigInt(\"129\"), \"-7f\")\ncheck_result16(-BigInt(\"0xff00000000000000000000000000000000\") >> BigInt(\"129\"), \"-80\")\n\ncheck_result16(BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") >> BigInt(\"10000000000000000000000000\"), \"0\")\n\ntry {\n  BigInt(\"0x8fef5fcfffef5fcfffef5fcfffef5fcff\") << BigInt(\"10000000000000000000000000\");\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError)\n}\n"
  },
  {
    "path": "tests/jerry/bigint2.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntry {\n  new BigInt(\"1\")\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\nfunction check_type_error (code)\n{\n  try {\n    eval(code)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n  }\n}\n\ncheck_type_error(\"+BigInt('0')\")\n\ncheck_type_error(\"BigInt('1') + 1\")\ncheck_type_error(\"BigInt('2') - 2\")\ncheck_type_error(\"BigInt('3') * 3\")\ncheck_type_error(\"BigInt('4') / 4\")\ncheck_type_error(\"BigInt('5') % 5\")\ncheck_type_error(\"BigInt('6') ** 6\")\n\ncheck_type_error(\"1 + BigInt('1')\")\ncheck_type_error(\"2 - BigInt('2')\")\ncheck_type_error(\"3 * BigInt('3')\")\ncheck_type_error(\"4 / BigInt('4')\")\ncheck_type_error(\"5 % BigInt('5')\")\ncheck_type_error(\"6 ** BigInt('6')\")\n\ncheck_type_error(\"BigInt('1') & 1\")\ncheck_type_error(\"BigInt('2') | 2\")\ncheck_type_error(\"BigInt('3') ^ 3\")\ncheck_type_error(\"BigInt('4') << 4\")\ncheck_type_error(\"BigInt('5') >> 5\")\ncheck_type_error(\"BigInt('6') >>> 6\")\n\ncheck_type_error(\"1 & BigInt('1')\")\ncheck_type_error(\"2 | BigInt('2')\")\ncheck_type_error(\"3 ^ BigInt('3')\")\ncheck_type_error(\"4 << BigInt('4')\")\ncheck_type_error(\"5 >> BigInt('5')\")\ncheck_type_error(\"6 >>> BigInt('6')\")\n"
  },
  {
    "path": "tests/jerry/bigint3.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_result(bigint, expected)\n{\n  assert(bigint.toString() === expected)\n}\n\nfunction check_error (code, error_type)\n{\n  try {\n    eval(code)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof error_type)\n  }\n}\n\ncheck_error(\"BigInt(undefined)\", TypeError)\ncheck_error(\"BigInt(null)\", TypeError)\ncheck_error(\"BigInt(Symbol())\", TypeError)\n\ncheck_error(\"BigInt(0.25)\", RangeError)\ncheck_error(\"BigInt(-0.25)\", RangeError)\ncheck_error(\"BigInt(-10000000.25)\", RangeError)\ncheck_error(\"BigInt(4503599627370495.5)\", RangeError)\ncheck_error(\"BigInt(NaN)\", RangeError)\ncheck_error(\"BigInt(Infinity)\", RangeError)\n\ncheck_result(BigInt(true), \"1\")\ncheck_result(BigInt(false), \"0\")\ncheck_result(BigInt({ valueOf() { return \"0x100\" } }), \"256\")\n\ncheck_result(BigInt(0), \"0\")\ncheck_result(BigInt(-0), \"0\")\ncheck_result(BigInt(8192), \"8192\")\ncheck_result(BigInt(-0xffffffffff), \"-1099511627775\")\ncheck_result(BigInt(0x1fffffffffffff), \"9007199254740991\")\ncheck_result(BigInt(-4503599627370496), \"-4503599627370496\")\ncheck_result(BigInt(4503599627370496.5), \"4503599627370496\")\ncheck_result(BigInt(9007199254740991.5), \"9007199254740992\")\ncheck_result(BigInt(0x1fffffffffffff * (2 ** 70)), \"10633823966279325802638835764831453184\")\ncheck_result(BigInt(-0x1fffffffffffff * (2 ** 128)), \"-3064991081731777376434327133362154903862870812598992896\")\n\n"
  },
  {
    "path": "tests/jerry/bigint4.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Boolean. */\n\nassert(!BigInt(\"0\") === true)\nassert(!BigInt(\"1\") === false)\nassert(!BigInt(\"-1\") === false)\n\n/* Strict equal. */\n\nassert(BigInt(\"0\") === BigInt(\"0\"))\nassert(BigInt(\"-77\") === BigInt(\"-77\"))\nassert(!(BigInt(\"-77\") !== BigInt(\"-77\")))\n\nassert(!(Object(BigInt(\"-77\")) === BigInt(\"-77\")))\nassert(BigInt(\"-77\") !== Object(BigInt(\"-77\")))\n\nassert(BigInt(\"0xffffffffffffffffffffffffffffffff\") === BigInt(\"0xffffffffffffffffffffffffffffffff\"))\nassert(!(BigInt(\"0xfffffffffffffffffffffffffffffffe\") === BigInt(\"0xffffffffffffffffffffffffffffffff\")))\nassert(BigInt(\"0x100000000000000000000000000000000\") !== BigInt(\"0xffffffffffffffffffffffffffffffff\"))\nassert(!(BigInt(\"1234\") === 1234))\nassert(-4567 !== BigInt(\"-4567\"))\n\n/* Equal. */\n\nassert(BigInt(\"0x100\") == BigInt(\"256\"))\nassert(BigInt(\"-77\") == \"-77\")\nassert(\"168\" == BigInt(\"168\"))\nassert(!(\"0xffffffffffffffffffffffffffffffff\" != BigInt(\"0xffffffffffffffffffffffffffffffff\")))\n\nassert(BigInt(\"0x1000\") == 0x1000)\nassert(468123 == BigInt(\"468123\"))\n\nassert(!(BigInt(\"100000000\") == 100000000.5))\nassert(-0.125 != BigInt(\"0\"))\nassert(!(\"InvalidBigIntString\" == BigInt(\"100000000\")))\nassert(BigInt(\"100000000\") != \"10000 0000\")\n\nassert(BigInt(\"0\") == 0)\nassert(!(-0 != BigInt(\"0\")))\nassert(!(BigInt(\"0\") == 0.0000152587890625))\nassert(0.0000152587890625 != BigInt(\"0\"))\n\nassert(!(BigInt(\"100000000\") == NaN))\nassert(NaN != BigInt(\"-100000000\"))\nassert(!(BigInt(\"100000000000000000000000000\") == Infinity))\nassert(Infinity != BigInt(\"100000000000000000000000000\"))\n\n/* Relational. */\n\nassert(!(BigInt(\"1234\") < BigInt(\"1234\")))\nassert(BigInt(\"1234\") >= BigInt(\"1234\"))\nassert(BigInt(\"1234\") <= BigInt(\"1234\"))\nassert(!(BigInt(\"1234\") > BigInt(\"1234\")))\n\nassert(BigInt(\"1234\") < BigInt(\"1235\"))\nassert(!(BigInt(\"1234\") >= BigInt(\"1235\")))\nassert(BigInt(\"1234\") <= BigInt(\"1235\"))\nassert(!(BigInt(\"1234\") > BigInt(\"1235\")))\n\nassert(!(BigInt(\"123456789012345678901234567890\") < \"123456789012345678901234567890\"))\nassert(BigInt(\"123456789012345678901234567890\") >= \"123456789012345678901234567890\")\nassert(BigInt(\"123456789012345678901234567890\") <= \"123456789012345678901234567890\")\nassert(!(BigInt(\"123456789012345678901234567890\") > \"123456789012345678901234567890\"))\n\nassert(!(\"0x1234567890abcdef1234567890abcdef\" < BigInt(\"0x1234567890abcdef1234567890abcdef\")))\nassert(\"0x1234567890abcdef1234567890abcdef\" >= BigInt(\"0x1234567890abcdef1234567890abcdef\"))\nassert(\"0x1234567890abcdef1234567890abcdef\" <= BigInt(\"0x1234567890abcdef1234567890abcdef\"))\nassert(!(\"0x1234567890abcdef1234567890abcdef\" > BigInt(\"0x1234567890abcdef1234567890abcdef\")))\n\nassert(!(\"Invalid\" < BigInt(\"100\")))\nassert(!(\"Invalid\" >= BigInt(\"100\")))\nassert(!(\"Invalid\" <= BigInt(\"100\")))\nassert(!(\"Invalid\" > BigInt(\"100\")))\n\nassert(!(BigInt(\"0\") < \"NotABigInt\"))\nassert(!(BigInt(\"0\") >= \"NotABigInt\"))\nassert(!(BigInt(\"0\") <= \"NotABigInt\"))\nassert(!(BigInt(\"0\") > \"NotABigInt\"))\n\nassert(!(BigInt(\"0\") < 0))\nassert(BigInt(\"0\") >= 0)\nassert(BigInt(\"0\") <= 0)\nassert(!(BigInt(\"0\") > 0))\n\nassert(!(-0 < BigInt(\"0\")))\nassert(-0 >= BigInt(\"0\"))\nassert(-0 <= BigInt(\"0\"))\nassert(!(-0 > BigInt(\"0\")))\n\nassert(BigInt(\"0\") < 67)\nassert(!(BigInt(\"0\") > 67))\nassert(!(BigInt(\"0\") < -0.125))\nassert(BigInt(\"0\") > -0.125)\n\nassert(!(BigInt(\"7\") < NaN))\nassert(!(BigInt(\"7\") >= NaN))\nassert(!(BigInt(\"7\") <= NaN))\nassert(!(BigInt(\"7\") > NaN))\n\nassert(!(Infinity < BigInt(\"1000000000000000000000000000000\")))\nassert(!(Infinity <= BigInt(\"1000000000000000000000000000000\")))\nassert(Infinity >= BigInt(\"1000000000000000000000000000000\"))\nassert(Infinity > BigInt(\"1000000000000000000000000000000\"))\n\nassert(-Infinity < BigInt(\"1000000000000000000000000000000\"))\nassert(-Infinity <= BigInt(\"1000000000000000000000000000000\"))\nassert(!(-Infinity >= BigInt(\"1000000000000000000000000000000\")))\nassert(!(-Infinity > BigInt(\"1000000000000000000000000000000\")))\n\nassert(BigInt(\"-10000\") < 1)\nassert(BigInt(\"-10000\") <= 1)\nassert(!(BigInt(\"-10000\") >= 1))\nassert(!(BigInt(\"-10000\") > 1))\n\nassert(!(1 < BigInt(\"-12345678\")))\nassert(!(1 <= BigInt(\"-12345678\")))\nassert(1 >= BigInt(\"-12345678\"))\nassert(1 > BigInt(\"-12345678\"))\n\nassert(!(BigInt(\"1\") < 0.5))\nassert(!(BigInt(\"1\") <= 0.5))\nassert(BigInt(\"1\") >= 0.5)\nassert(BigInt(\"1\") > 0.5)\n\nassert(!(-0.5 < BigInt(\"-1\")))\nassert(!(-0.5 <= BigInt(\"-1\")))\nassert(-0.5 >= BigInt(\"-1\"))\nassert(-0.5 > BigInt(\"-1\"))\n\nassert(!(BigInt(\"0x1000000000000000000000000000000\") < 0x100000))\nassert(!(BigInt(\"0x1000000000000000000000000000000\") <= 0x100000))\nassert(BigInt(\"0x1000000000000000000000000000000\") >= 0x100000)\nassert(BigInt(\"0x1000000000000000000000000000000\") > 0x100000)\n\nassert(-0x1000000000000000000000000000000 < BigInt(\"-1234\"))\nassert(-0x1000000000000000000000000000000 <= BigInt(\"-1234\"))\nassert(!(-0x1000000000000000000000000000000 >= BigInt(\"-1234\")))\nassert(!(-0x1000000000000000000000000000000 > BigInt(\"-1234\")))\n\nassert(0x1234567880000000000000000000000 < BigInt(\"0x1234567890000000000000000000000\"))\nassert(0x1234567880000000000000000000000 <= BigInt(\"0x1234567890000000000000000000000\"))\nassert(!(0x1234567880000000000000000000000 > BigInt(\"0x1234567890000000000000000000000\")))\nassert(!(0x1234567880000000000000000000000 >= BigInt(\"0x1234567890000000000000000000000\")))\n\nassert(-BigInt(\"0x1234567890000000000000000000000\") < -0x1234567880000000000000000000000)\nassert(-BigInt(\"0x1234567890000000000000000000000\") <= -0x1234567880000000000000000000000)\nassert(!(-BigInt(\"0x1234567890000000000000000000000\") >= -0x1234567880000000000000000000000))\nassert(!(-BigInt(\"0x1234567890000000000000000000000\") > -0x1234567880000000000000000000000))\n\n// True because of rounding\nassert(0x1234567890000000000000000000001 < BigInt(\"0x1234567890000000000000000000001\"))\nassert(0x1234567890000000000000000000001 <= BigInt(\"0x1234567890000000000000000000001\"))\nassert(!(0x1234567890000000000000000000001 >= BigInt(\"0x1234567890000000000000000000001\")))\nassert(!(0x1234567890000000000000000000001 > BigInt(\"0x1234567890000000000000000000001\")))\n\nassert(-BigInt(\"0x1234567890000000000000000000001\") < -0x1234567890000000000000000000001)\nassert(-BigInt(\"0x1234567890000000000000000000001\") <= -0x1234567890000000000000000000001)\nassert(!(-BigInt(\"0x1234567890000000000000000000001\") >= -0x1234567890000000000000000000001))\nassert(!(-BigInt(\"0x1234567890000000000000000000001\") > -0x1234567890000000000000000000001))\n\nassert(!(1.0000152587890625 < BigInt(\"1\")))\nassert(!(1.0000152587890625 <= BigInt(\"1\")))\nassert(1.0000152587890625 >= BigInt(\"1\"))\nassert(1.0000152587890625 > BigInt(\"1\"))\n\nassert(!(BigInt(\"-1\") < -1.0000152587890625))\nassert(!(BigInt(\"-1\") <= -1.0000152587890625))\nassert(BigInt(\"-1\") >= -1.0000152587890625)\nassert(BigInt(\"-1\") > -1.0000152587890625)\n"
  },
  {
    "path": "tests/jerry/bigint5.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_syntax_error(code)\n{\n  try {\n    eval(code)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof SyntaxError)\n  }\n}\n\ncheck_syntax_error(\"1N\")\ncheck_syntax_error(\"3.5n\")\ncheck_syntax_error(\"3e10n\")\ncheck_syntax_error(\"3e+10n\")\ncheck_syntax_error(\"0xn\")\ncheck_syntax_error(\"0on\")\ncheck_syntax_error(\"0bn\")\ncheck_syntax_error(\"0777n\")\ncheck_syntax_error(\"00777n\")\ncheck_syntax_error(\"0x1 n\")\n\nassert(0n == 0n)\nassert(0n == -0n)\nassert(12n == 12n)\nassert(123456789012345678901234567890123456789012345678901234567890n == 123456789012345678901234567890123456789012345678901234567890n)\nassert(12n != -12n)\nassert(123456789012345678901234567890123456789012345678901234567890n != -123456789012345678901234567890123456789012345678901234567890n)\n\nassert(0xffn == 255n)\nassert(0o77777n == 0x7fffn)\nassert(255n.toString(16) == \"ff\")\n\nvar o = { 12n : \"data\" }\nassert(o[12] === \"data\")\n\nvar c = class C { static 19n () { return \"BigInt\" } }\nassert(c[19]() === \"BigInt\")\n\nfunction f(p, q) {\n  assert(p + q === 5000n)\n}\nf(-1000n, 6000n)\n"
  },
  {
    "path": "tests/jerry/bigint6.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Test bitwise 'and' operation\n\nassert((0n & 0n) === 0n)\nassert((0x12345678n & 0n) === 0n)\nassert((0n & 0x12345678n) === 0n)\nassert((0xff00ff00ff00ff00ff00n & 0xff00ff00ff00ff00ffn) === 0n)\nassert((0x12345678ffffffff12345678ffffffffn & 0xffff87654321n) === 0x567887654321n)\nassert((0xf56cd2479efcdn & 0x56cdf23bc02134e3bdc56f43297be4c27n) === 0x6540004384c05n)\nassert((0x45c308bd83cf279n & -0x100000000n) === 0x45c308b00000000n)\nassert((-0x10000000000000000n & 0xffffffffffffffffn) === 0n)\nassert((-0x11234567890abcdefn & 0xffffffffffffffffffffn) === 0xfffeedcba9876f543211n)\nassert((-0x10000000000000n & -0x10000000000000n) === -0x10000000000000n)\nassert((-0x100000000000000001n & -0x1n) === -0x100000000000000001n)\n\n// Test bitwise 'or' operation\n\nassert((0n | 0n) === 0n)\nassert((0x123456789abcdefn | 0n) === 0x123456789abcdefn)\nassert((0n | 0x123456789abcdefn) === 0x123456789abcdefn)\nassert((0xaa00bb00cc00dd00ee00n | 0xff00ee00dd00cc00bbn) === 0xaaffbbeeccddddcceebbn);\nassert((0xfedcba09876543210fedcba09876543210n | 0x7n) === 0xfedcba09876543210fedcba09876543217n)\nassert((0x8n | 0xfedcba09876543210fedcba09876543210n) === 0xfedcba09876543210fedcba09876543218n)\nassert((-0xc34bd5f946c7a92b69b3a96cd7c2a12n | 0xfcbacfbn) === -0xc34bd5f946c7a92b69b3a96c0340201n)\nassert((-0xb314c297ba3n | 0xfeacb00000000n) === -0x1304c297ba3n)\nassert((-0x74b186cd308b377cb23n | -0x5cba7935b213cd657d937c42975de63802a7b92cd49an) === -0x74900280200b124c001n)\nassert((-0x10000000000000000n | -0x100000000000000000000000000000000n) === -0x10000000000000000n)\n\n// Test bitwise 'xor' operation\n\nassert((0n ^ 0n) === 0n)\nassert((0x123456789abcdefn ^ 0n) === 0x123456789abcdefn)\nassert((0n ^ 0x123456789abcdefn) === 0x123456789abcdefn)\nassert((0x74b186cd308b355cb23cd28cd75n ^ 0x74b186cd308b355cb23cd28cd75n) === 0n)\nassert((0xff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ffn ^ 0xf0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0fn) === 0xff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff0n)\nassert((0x31988644a57e18n ^ 0xb2303b6f2efcb4de7761c01622440f9d985d07dbfe03c9f1n) === 0xb2303b6f2efcb4de7761c01622440f9d986c9f5dbaa6b7e9n)\nassert((-0xd858541b8eb3e6ae247b1f84dbd8cc2db66n ^ 0x0811a0e70710fcf965n) === -0xd858541b8eb3e6ae24fa058aaba9c3e2201n)\nassert((0x38d00faa3f33n ^ -0x89c40cdc4a064dcd8b3663feb322026dn) === -0x89c40cdc4a064dcd8b365b2ebc883d60n)\nassert((-0x66cb3001b88361a25b8715922n ^ -0x66cb3001b88361a25b8715922n) === 0n)\nassert((-0x893bff556397300afe6411d8727c0aaffn ^ -0xef69f24dfcd1447397d62217c6ad2n) === 0x893b103c91daccdbba17860e506bcc02fn)\n"
  },
  {
    "path": "tests/jerry/bigint7.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Bitwise not\n\nassert(~BigInt(\"0\") === -1n)\nassert(~BigInt(\"-1\") === 0n)\n\nassert(~BigInt(\"0xffffffff\") === -0x100000000n)\nassert(~BigInt(\"0x100000000\") === -0x100000001n)\nassert(~BigInt(\"0x10000ffff\") === -0x100010000n)\nassert(~(-BigInt(\"0xffffffff\")) === 0xfffffffen)\nassert(~(-BigInt(\"0x100000000\")) === 0xffffffffn)\nassert(~(-BigInt(\"0x10000ffff\")) === 0x10000fffen)\n\nassert(~BigInt(\"0xffffffffffffffff\") === -0x10000000000000000n)\nassert(~BigInt(\"0xffffffffffffffffffffffffffffffff\") === -0x100000000000000000000000000000000n)\nassert(~BigInt(\"0x100000000000000000000000000000000\") === -0x100000000000000000000000000000001n)\nassert(~BigInt(\"0x100000000000000ffffffffffffffffff\") === -0x100000000000001000000000000000000n)\nassert(~(-BigInt(\"0xffffffffffffffff\")) === 0xfffffffffffffffen)\nassert(~(-BigInt(\"0xffffffffffffffffffffffffffffffff\")) === 0xfffffffffffffffffffffffffffffffen)\nassert(~(-BigInt(\"0x100000000000000000000000000000000\")) === 0xffffffffffffffffffffffffffffffffn)\nassert(~(-BigInt(\"0xffffffffffffff000000000000000000\")) === 0xfffffffffffffeffffffffffffffffffn)\n\n// Increase\n\nvar a = 0n\nassert(++a === 1n)\nassert(a === 1n)\n\na = -1n\nassert(++a === 0n)\nassert(a === 0n)\n\na = 1n\nassert(++a === 2n)\nassert(a === 2n)\n\na = 0xffffffffn\nassert(++a === 0x100000000n)\nassert(a === 0x100000000n)\n\na = { b:0xffffffffffffffffn }\nassert(++a.b === 0x10000000000000000n)\nassert(a.b === 0x10000000000000000n)\n\na = 0xffffffffffffffffffffffffffffffffn\nassert(a++ === 0xffffffffffffffffffffffffffffffffn)\nassert(a === 0x100000000000000000000000000000000n)\n\na = { b:0x100000000000000ffffffffffffffffffn }\nassert(a.b++ === 0x100000000000000ffffffffffffffffffn)\nassert(a.b === 0x100000000000001000000000000000000n)\n\na = -0x10000000000000001n;\nfor (var i = 0; i < 1; i++, a++) ;\nassert(a === -0x10000000000000000n)\n\na = { b:-0x100000000000001000000000000000000n }\nfor (var i = 0; i < 1; i++, ++a.b) ;\nassert(a.b === -0x100000000000000ffffffffffffffffffn)\n\n// Decrease\n\na = 0n\nassert(--a === -1n)\nassert(a === -1n)\n\na = 1n\nassert(--a === 0n)\nassert(a === 0n)\n\na = -1n\nassert(--a === -2n)\nassert(a === -2n)\n\na = 0x100000000n\nassert(--a === 0xffffffffn)\nassert(a === 0xffffffffn)\n\na = -0xffffffffffffffffn\nassert(a-- === -0xffffffffffffffffn)\nassert(a === -0x10000000000000000n)\n\na = { b:0x10000000000000000n }\nassert(--a.b === 0xffffffffffffffffn)\nassert(a.b === 0xffffffffffffffffn)\n\na = 0x100000000000000000000000000000000n\nassert(a-- === 0x100000000000000000000000000000000n)\nassert(a === 0xffffffffffffffffffffffffffffffffn)\n\na = { b:0x100000000000001000000000000000000n }\nassert(a.b-- === 0x100000000000001000000000000000000n)\nassert(a.b === 0x100000000000000ffffffffffffffffffn)\n\na = 0x10000000000000001n;\nfor (var i = 0; i < 1; i++, a--) ;\nassert(a === 0x10000000000000000n)\n\na = { b:-0x100000000000000ffffffffffffffffffn }\nfor (var i = 0; i < 1; i++, --a.b) ;\nassert(a.b === -0x100000000000001000000000000000000n)\n"
  },
  {
    "path": "tests/jerry/bigint8.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Exponentiation\n\ntry {\n  12n ** -7n\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError)\n}\n\nassert((0n ** 0n) === 1n)\nassert((1n ** 0n) === 1n)\nassert(((-2n) ** 0n) === 1n)\nassert((1000000000000000000000000000000000n ** 0n) === 1n)\nassert(((-1000000000000000000000000000000000n) ** 0n) === 1n)\n\nassert((1n ** 1n) === 1n)\nassert((1n ** 10000000000000000000000000000000n) === 1n)\nassert(((-1n) ** 1n) === -1n)\nassert(((-1n) ** 10000000000000000000000000000000n) === 1n)\nassert(((-1n) ** 10000000000000000000000000000001n) === -1n)\n\nassert((2n ** 10n) === 1024n)\nassert((2n ** 11n) === 2048n)\nassert(((-2n) ** 10n) === 1024n)\nassert(((-2n) ** 11n) === -2048n)\nassert((2n ** 64n) === 0x10000000000000000n)\nassert((2n ** 65n) === 0x20000000000000000n)\nassert(((-2n) ** 64n) === 0x10000000000000000n)\nassert(((-2n) ** 65n) === -0x20000000000000000n)\n\nassert((2n ** 190n) === 0x400000000000000000000000000000000000000000000000n)\nassert((2n ** 191n) === 0x800000000000000000000000000000000000000000000000n)\nassert(((-2n) ** 190n) === 0x400000000000000000000000000000000000000000000000n)\nassert(((-2n) ** 191n) === -0x800000000000000000000000000000000000000000000000n)\n\nassert((103n ** 32n) === 25750827556851106532658069028441289322166445432839581773436522241n)\nassert((103n ** 31n) === 250008034532535014880175427460595041962781023619801764790645847n)\nassert(((-79n) ** 32n) === 5297450670659957549009604563595170759963655420038456036451841n)\nassert(((-79n) ** 31n) === -67056337603290601886197526121457857721058929367575392866479n)\n\n"
  },
  {
    "path": "tests/jerry/bigint9.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nassert(Number(0n) === 0)\nassert(Number(1n) === 1)\nassert(Number(2n) === 2)\nassert(Number(0x100n) === 256)\nassert(Number(-1n) === -1)\nassert(Number(-2n) === -2)\nassert(Number(-0x100n) === -256)\n\nassert(Number(0x1fffffffffffffn) === 0x1fffffffffffff)\nassert(Number(-0x3fffffffffffffn) === -0x40000000000000)\nassert(Number(1000n ** 1000n) === Number.POSITIVE_INFINITY)\nassert(Number((-1000n) ** 1001n) === Number.NEGATIVE_INFINITY)\n\n// Rounding to even\n\nassert(Number(0x80000000000004n) === 0x80000000000000)\nassert(Number(0x80000000000008n) === 0x80000000000008)\nassert(Number(0x8000000000000cn) === 0x80000000000010)\nassert(Number(0x80000000000004n) === 0x80000000000000)\nassert(Number(0x80000000000006n) === 0x80000000000008)\nassert(Number(0x800000000000f400000000000000000000000000000000n) === 0x800000000000f000000000000000000000000000000000)\nassert(Number(0x800000000000f400000000000000000000000000000001n) === 0x800000000000f800000000000000000000000000000000)\n\n// Construct\n\nassert((new Number(0n)).valueOf() === 0)\nassert((new Number(-3256n)).valueOf() == -3256)\n"
  },
  {
    "path": "tests/jerry/binary-literal.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction checkSyntaxError (str) {\n  try {\n    eval(str);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n\n// Test with invalid literals\ncheckSyntaxError(\"0c\");\ncheckSyntaxError(\"0b\");\ncheckSyntaxError(\"0b0123456\");\ncheckSyntaxError(\"0b2\");\n\ncheckSyntaxError(\"0C\");\ncheckSyntaxError(\"0B\");\ncheckSyntaxError(\"0B2\");\n\ncheckSyntaxError(\"000b01010101\");\ncheckSyntaxError(\"010b01010101\");\ncheckSyntaxError(\"11 0b01010101\");\n\n// Test with valid literals\nassert(0b111 === 7);\nassert(0b111110111 === 503);\nassert(0b111101010101 === 3925);\nassert(0b00000000000001 === 1);\nassert(0b00000000000000 === 0);\nassert(0b1101001 === parseInt (\"1101001\", 2));\n\nassert(0B111 === 7);\nassert(0B111110111 === 503);\nassert(0B111101010101 === 3925);\nassert(0B00000000000001 === 1);\nassert(0B00000000000000 === 0);\nassert(0B1101001 === parseInt (\"1101001\", 2));\n"
  },
  {
    "path": "tests/jerry/bitwise-logic.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert((5 & 2) === 0);\nassert((2 & 2) === 2);\nassert((5 | 2) === 7);\nassert((5 | 5) === 5);\nassert((5 ^ 2) === 7);\nassert((5 ^ 5) === 0);\nassert((~5) == -6);\n"
  },
  {
    "path": "tests/jerry/block-var-redecl.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (script)\n{\n  try\n  {\n    eval (script);\n    assert (false);\n  }\n  catch (e)\n  {\n    assert (e instanceof SyntaxError);\n  }\n}\n\neval(\"function f(){}; var f;\");\neval(\"var f; function f(){};\");\n\neval(\"function f(){}; { var f; }\")\neval(\"{ var f; } function f(){};\")\n\neval(\"{ function f(){}; } var f;\")\neval(\"var f; { function f(){}; }\")\n\ncheck_syntax_error (\"{ function f(){}; var f; }\");\ncheck_syntax_error (\"{ var f; function f(){}; }\");\n\neval(\"{ { function f(){}; } var f; }\")\neval(\"{ var f; { function f(){}; } }\")\n\ncheck_syntax_error (\"{ function f(){}; { var f; } }\")\ncheck_syntax_error (\"{ { var f; } function f(){}; }\")\n\neval(\"{ { function f(){}; } { var f; } }\")\neval(\"{ { var f; } { function f(){}; } }\")\n\neval(\"function g(){ function f(){}; var f; }\")\neval(\"function g(){ var f; function f(){}; }\")\n\neval(\"function g(){ function f(){}; { var f; } }\")\neval(\"function g(){ { var f; } function f(){}; }\")\n\neval(\"function g(){ { function f(){}; } var f; }\")\neval(\"function g(){ var f; { function f(){}; } }\")\n"
  },
  {
    "path": "tests/jerry/break-continue-nested-to-try-with-blocks.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* with */\n\nfor (var i = 0; i < 10; i++)\n{\n  with ({})\n  {\n    break;\n\n    assert (false);\n  }\n}\nassert (i === 0);\n\nfor (var i = 0; i < 10; i++)\n{\n  with ({})\n  {\n    continue;\n\n    assert (false);\n  }\n}\nassert (i === 10);\n\n/* try */\nfor (var i = 0; i < 10; i++)\n{\n  try\n  {\n    break;\n\n    assert (false);\n  }\n  catch (e)\n  {\n  }\n}\nassert (i === 0);\n\nfor (var i = 0; i < 10; i++)\n{\n  try\n  {\n    continue;\n\n    assert (false);\n  }\n  catch (e)\n  {\n  }\n}\nassert (i === 10);\n\n/* catch */\nfor (var i = 0; i < 10; i++)\n{\n  try\n  {\n    throw new TypeError ();\n    assert (false);\n  }\n  catch (e)\n  {\n    break;\n    assert (false);\n  }\n}\nassert (i === 0);\n\nfor (var i = 0; i < 10; i++)\n{\n  try\n  {\n    throw new TypeError ();\n    assert (false);\n  }\n  catch (e)\n  {\n    continue;\n    assert (false);\n  }\n}\nassert (i === 10);\n\n\n/* finally */\nfor (var i = 0; i < 10; i++)\n{\n  try\n  {\n    throw new TypeError ();\n    assert (false);\n  }\n  catch (e)\n  {\n  }\n  finally\n  {\n    break;\n    assert (false);\n  }\n}\nassert (i === 0);\n\nfor (var i = 0; i < 10; i++)\n{\n  try\n  {\n    throw new TypeError ();\n    assert (false);\n  }\n  catch (e)\n  {\n  }\n  finally\n  {\n    continue;\n    assert (false);\n  }\n}\nassert (i === 10);\n\n\n/* with - switch */\n\nstr = '';\nfor (var i = 0; i < 10; i++)\n{\n  with ({})\n  {\n    switch (i)\n    {\n      case 0:\n        str += 'A';\n        break;\n      default:\n        str += 'B';\n        continue;\n    }\n\n    str += 'C';\n  }\n}\nassert (str === 'ACBBBBBBBBB');\n"
  },
  {
    "path": "tests/jerry/builtin-constructor-class.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nFunction.prototype.toString = Object.prototype.toString;\nassert(Array.toString() === \"[object Function]\");\nassert(Number.toString() === \"[object Function]\");\nassert(String.toString() === \"[object Function]\");\nassert(Boolean.toString() === \"[object Function]\");\nassert(Object.toString() === \"[object Function]\");\nassert(Function.toString() === \"[object Function]\");\nassert(Date.toString() === \"[object Function]\");\nassert(RegExp.toString() === \"[object Function]\");\n\nassert(Math.toString() === \"[object Math]\");\nassert(JSON.toString() === \"[object JSON]\");\n"
  },
  {
    "path": "tests/jerry/builtin-objects-accessor-property-configurable.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar test_failed = false;\n\nfunction verifyConfigurableAccessor (obj, name, string) {\n  let prop = Object.getOwnPropertyDescriptor (obj, name);\n  if (prop.get && !prop.configurable) {\n    print (string + \" should be configurable, but wasn't\");\n    test_failed = true;\n  }\n}\n\nfor (let builtin_name of Reflect.ownKeys (this)) {\n  let builtin_obj = this[builtin_name];\n  if (builtin_name[0] === builtin_name[0].toUpperCase () && typeof builtin_obj == \"function\") {\n    for (let prop of Reflect.ownKeys (builtin_obj)) {\n      verifyConfigurableAccessor (builtin_obj, prop, builtin_name + \".\" + prop.toString ());\n    }\n\n    let builtin_proto = builtin_obj.prototype;\n    if (builtin_proto) {\n      for (let prop of Reflect.ownKeys (builtin_proto)) {\n        verifyConfigurableAccessor (builtin_proto, prop, builtin_name + \".prototype.\" + prop.toString ());\n      }\n    }\n\n    builtin_proto = Reflect.getPrototypeOf (builtin_obj);\n    if (builtin_proto !== Function.prototype) {\n      for (let prop of Reflect.ownKeys (builtin_proto.prototype)) {\n        verifyConfigurableAccessor (builtin_proto.prototype, prop, builtin_name + \".[[Prototype]].prototype.\" + prop.toString ());\n      }\n    }\n  }\n}\n\nassert (!test_failed);\n"
  },
  {
    "path": "tests/jerry/builtin-prototypes.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nassert (Object.prototype.toString.call (String.prototype) === '[object String]');\nassert (String.prototype.toString() === \"\");\n\nassert (Object.prototype.toString.call (Boolean.prototype) === '[object Boolean]');\nassert (Boolean.prototype.valueOf() === false);\n\nassert (Object.prototype.toString.call (Number.prototype) === '[object Number]');\nassert (Number.prototype.valueOf() === 0);\n\nvar prototypes = [\n    Date.prototype,\n    RegExp.prototype,\n    Error.prototype,\n    EvalError.prototype,\n    RangeError.prototype,\n    ReferenceError.prototype,\n    SyntaxError.prototype,\n    TypeError.prototype,\n    URIError.prototype\n  ]\n\nfor (proto of prototypes) {\n  assert (Object.prototype.toString.call (proto) === '[object Object]');\n}\n\ntry {\n  Date.prototype.valueOf();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  RegExp.prototype.exec(\"\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  RegExp.prototype.compile(\"a\", \"u\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (RegExp.prototype.source === '(?:)');\nassert (RegExp.prototype.global === undefined);\nassert (RegExp.prototype.ignoreCase === undefined);\nassert (RegExp.prototype.multiline === undefined);\nassert (RegExp.prototype.sticky === undefined);\nassert (RegExp.prototype.unicode === undefined);\nassert (RegExp.prototype.dotAll === undefined);\nassert (RegExp.prototype.flags === '');\n"
  },
  {
    "path": "tests/jerry/class-fields1.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error(code)\n{\n  try {\n    eval(code)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof SyntaxError)\n  }\n}\n\nfunction check_property(obj, name, value)\n{\n  property = Object.getOwnPropertyDescriptor(obj, name)\n  assert(typeof property === \"object\")\n  assert(property.value === value)\n}\n\ncheck_syntax_error(\"class C { get a = 5 }\");\ncheck_syntax_error(\"class C { id1 id2 }\");\ncheck_syntax_error(\"class C { a = 5,6 }\");\ncheck_syntax_error(\"class C { set\\na = 6 }\");\ncheck_syntax_error(\"class C { constructor }\");\ncheck_syntax_error(\"class C { static constructor }\");\ncheck_syntax_error(\"class C { constructor = 1 }\");\ncheck_syntax_error(\"class C { static constructor = 1 }\");\ncheck_syntax_error(\"class C { f = arguments }\");\ncheck_syntax_error(\"class C { static f = a\\\\u0072guments }\");\ncheck_syntax_error(\"class C { f = () => arguments }\");\ncheck_syntax_error(\"class C { f = arguments => 1 }\");\ncheck_syntax_error(\"class C { f = ([arguments]) => 1 }\");\ncheck_syntax_error(\"new class { f = eval('arguments') }\");\ncheck_syntax_error(\"new class { f = eval('arguments => 1') }\");\n\nvar res = 10\nvar counter = 0\n\nfunction f1() {\n  counter++\n  return 5\n}\n\nvar C1 = class {\n  get = \"a\" + f1()\n  static; set; a = () => Math.cos(0)\n  v\\u0061r\n  f\\u006fr = () => this\n  arguments = this\n}\n\nres = new C1\ncheck_property(res, \"get\", \"a5\")\ncheck_property(res, \"static\", undefined)\ncheck_property(res, \"set\", undefined)\nassert(res.a() === 1)\ncheck_property(res, \"var\", undefined)\nassert(res.for() === res)\nassert(res.arguments === res)\n\nclass C2 {\n  constructor(a = this.x, b = this.y) {\n    assert(a === undefined)\n    assert(b === undefined)\n    check_property(this, 'x', 11)\n    check_property(this, 'y', \"ab\")\n  }\n  x = 5 + 6\n  y = \"a\" + 'b'\n}\n\nres = new C2\n\nclass C3 {\n  constructor() {\n    assert(this.x === 1)\n    return { z:\"zz\" }\n  }\n  x = 1\n}\n\nclass C4 extends C3 {\n  constructor() {\n    super()\n    assert(Object.getOwnPropertyDescriptor(this, \"x\") === undefined)\n    check_property(this, \"y\", 2)\n    check_property(this, \"z\", \"zz\")\n  }\n  y = 2\n}\nnew C4\n\nvar o = {}\nclass C5 extends C3 {\n  'pr op' = o\n  3 = true\n}\nres = new C5\nassert(Object.getOwnPropertyDescriptor(res, \"x\") === undefined)\ncheck_property(res, \"pr op\", o)\ncheck_property(res, \"3\", true)\ncheck_property(res, \"z\", \"zz\")\n\nclass C6 {\n  a= () => this\n  b= this\n}\n\nclass C7 extends C6 {\n  c= () => this\n  d= this\n}\n\ncount = 0\nclass C8 extends C7 {\n  constructor() {\n    count++\n    super()\n  }\n\n  e= () => this\n  f= this\n}\n\nvar res = new C8\nassert(res.a() === res)\nassert(res.b === res)\nassert(res.c() === res)\nassert(res.d === res)\nassert(res.e() === res)\nassert(res.f === res)\n\ncount = 0\nclass C9 {\n  a=assert(++count === 5)\n  a=assert(++count === 6)\n  a=assert(++count === 7)\n  a=assert(++count === 8)\n  static a=assert(++count === 1)\n  static a=assert(++count === 2)\n  static a=assert(++count === 3)\n  static a=assert(++count === 4)\n}\n\nassert(count === 4)\nnew C9\nassert(count === 8)\n\ncount = 0\nclass C10 {\n  [(assert(++count == 1), \"aa\")] = assert(++count == 5);\n  [(assert(++count == 2), \"bb\")] = assert(++count == 6);\n  cc = assert(++count == 7);\n  [(assert(++count == 3), \"aa\")] = assert(++count == 8);\n  [(assert(++count == 4), \"bb\")] = assert(++count == 9);\n}\n\nassert(count == 4)\nassert(Reflect.ownKeys(new C10).toString() === \"aa,bb,cc\");\nassert(count == 9)\n\nres = \"p\"\nclass C11 {\n  p1 = assert(Reflect.ownKeys(this).toString() === \"\");\n  [res + 2] = assert(Reflect.ownKeys(this).toString() === \"p1\");\n  [res + 1] = assert(Reflect.ownKeys(this).toString() === \"p1,p2\");\n  p3 = assert(Reflect.ownKeys(this).toString() === \"p1,p2\");\n  [res + 4] = assert(Reflect.ownKeys(this).toString() === \"p1,p2,p3\");\n}\nnew C11\n"
  },
  {
    "path": "tests/jerry/class-fields2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar count = 0\nclass C1 {\n  error = assert(++count === 1)\n  error = function() { throw 40.5 }()\n}\n\ntry {\n  new C1\n  assert(false)\n} catch(e) {\n  assert(e === 40.5)\n  assert(count === 1)\n}\n\ncount = 0\nclass C2 {\n  constructor(a = assert(++count === 1)) {}\n  error = function() { throw \"Err\" }()\n  error = assert(false)\n}\n\ntry {\n  new C2\n  assert(false)\n} catch(e) {\n  assert(e === \"Err\")\n  assert(count === 1)\n}\n\ncount = 0\nvar o = {}\n\nclass C3 extends class {\n  error = function() { throw o }()\n} {\n  constructor() {\n    assert(++count === 1)\n    super()\n    assert(false)\n  }\n}\n\ntry {\n  new C3\n  assert(false)\n} catch (e) {\n  assert(e === o)\n  assert(count === 1)\n}\n\ncount = 0\nclass C4 {\n  constructor() {\n    assert(++count === 2)\n  }\n  a = assert(++count === 1)\n}\n\nclass C5 extends C4 {\n  ok = assert(++count === 3)\n  error = function() { assert(++count === 4); throw \"Except\" }()\n  never = assert(false)\n}\n\ntry {\n  new C5\n  assert(false)\n} catch (e) {\n  assert(e === \"Except\")\n  assert(count === 4)\n}\n\ncount = 0\no = []\nclass C6 {\n  a = assert(++count === 2)\n}\n\nclass C7 extends C6 {\n  constructor() {\n    assert(++count === 1)\n    eval('super()')\n    assert(false)\n  }\n  ok = assert(++count === 3)\n  error = function() { assert(++count === 4); throw o }()\n  never = assert(false)\n}\n\ntry {\n  new C7\n  assert(false)\n} catch (e) {\n  assert(e === o)\n  assert(count === 4)\n}\n\nvar res\nclass C8 {\n  /* Create a non-configurable accessor */\n  a = (res = this, Object.defineProperty(this, \"b\", { get() {} }));\n  b = 6\n}\n\ntry {\n  new C8\n  assert(false)\n} catch(e) {\n  assert(e instanceof TypeError)\n  assert(Reflect.ownKeys(res).toString() === \"b,a\")\n}\n\nclass C9 {\n  [\"p\" + 1]\n  [\"p\" + 2] = (res = this, Object.freeze(this));\n  p3\n}\n\ntry {\n  new C9\n  assert(false)\n} catch(e) {\n  assert(e instanceof TypeError)\n  assert(Reflect.ownKeys(res).toString() === \"p1\")\n}\n"
  },
  {
    "path": "tests/jerry/class-fields3.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_property(obj, name, value)\n{\n  property = Object.getOwnPropertyDescriptor(obj, name)\n  assert(typeof property === \"object\")\n  assert(property.value === value)\n}\n\nvar o = {}\nvar name = \"Pro\"\nvar res = 0\nvar counter = 0\n\nfunction f1() {\n  counter++\n}\n\nclass C1 {\n  static\n    v\\u0061r\n  static Prop =\n    res\n    =\n    \"msg\"\n  static\n    Prop\n    =\n    f1()\n  static [name + \"p\"] = (f1(), o)\n  static 22 = 3 * 4  ;static 23 = 5 + 6\n  static 'a b'\n}\n\ncheck_property(C1, \"var\", undefined)\ncheck_property(C1, \"Prop\", o)\ncheck_property(C1, 22, 12)\ncheck_property(C1, 23, 11)\ncheck_property(C1, \"a b\", undefined)\nassert(res === \"msg\")\nassert(counter === 2)\n\ncounter = 0\nclass C2 {\n  static a = (assert(++counter === 6), \"x\")\n  static [(assert(++counter === 1), \"b\")]\n  static [(assert(++counter === 2), \"f\")]() {}\n  static [(assert(++counter === 3), \"c\")] = (assert(++counter === 7), this);\n  [(assert(++counter === 4), \"a\")]\n  static [(assert(++counter === 5), \"d\")];static e = (assert(++counter === 8), C2)\n}\n\nassert(counter === 8)\ncheck_property(C2, \"a\", \"x\")\ncheck_property(C2, \"b\", undefined)\ncheck_property(C2, \"c\", C2)\ncheck_property(C2, \"d\", undefined)\ncheck_property(C2, \"e\", C2)\n\nres = new C2\ncheck_property(res, \"a\", undefined)\n\nlet C3 = class C4 {\n  static f() {}\n  static xx = C4\n  static yy = this\n}\n\nassert(Reflect.ownKeys(C3).toString() === \"length,name,prototype,f,xx,yy\")\ncheck_property(C3, \"xx\", C3)\ncheck_property(C3, \"yy\", C3)\n"
  },
  {
    "path": "tests/jerry/class-fields4.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  {\n    A;\n    class A { }\n  }\n  assert(false)\n} catch (e) {\n  assert(e instanceof ReferenceError)\n}\n\ntry {\n  {\n    class A { [A] () {} }\n  }\n  assert(false)\n} catch (e) {\n  assert(e instanceof ReferenceError)\n}\n\ntry {\n  {\n    var a = class A { [A] () {} }\n  }\n  assert(false)\n} catch (e) {\n  assert(e instanceof ReferenceError)\n}\n\n{\n  class C {\n    a = C\n    static b = C\n  }\n\n  var X = C\n  C = 6\n  var c = new X\n\n  assert(X.b === X)\n  assert(c.a === X)\n}\n\n{\n  let a = 6\n  let b = 7\n  class C {\n    p = a + b\n  }\n  assert((new C).p === 13)\n}\n\ntry {\n  {\n    class C { static a = C = 5  }\n  }\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\ntry {\n  {\n    class C { static [C = 5] = 6 }\n  }\n  assert(false)\n} catch (e) {\n  assert(e instanceof ReferenceError)\n}\n"
  },
  {
    "path": "tests/jerry/class-fields5.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar count = 0\n\nclass C1 {\n  constructor() {\n    assert(++count === 3)\n  }\n\n  a = (assert(++count === 2), 1.1)\n}\n\nclass C2 extends C1 {\n  constructor() {\n    var s = () => super()\n\n    function g() {\n      assert(++count === 1)\n      eval(\"s()\");\n    }\n\n    g();\n    assert(++count === 5)\n  }\n\n  b = (assert(++count === 4), \"prop\")\n}\n\nvar c = new C2\nassert(count === 5)\nassert(c.a === 1.1)\nassert(c.b === \"prop\")\n\nvar o = {}\ncount = 0\n\nclass C3 extends C1 {\n  constructor() {\n    var s = () => () => eval(\"() => eval('super()')\")\n\n    function g() {\n      assert(++count === 1)\n      s()()()\n    }\n\n    g();\n    assert(++count === 5)\n  }\n\n  b = (assert(++count === 4), o)\n}\n\nc = new C3\nassert(count === 5)\nassert(c.a === 1.1)\nassert(c.b === o)\n\nvar f\nclass C4 extends Array {\n  a = 6.6\n\n  constructor() {\n    f = () => super()\n    super()\n  }\n}\nc = new C4\nassert(c.a === 6.6)\n\ntry {\n  f()\n  assert(false)\n} catch(e) {\n  assert(e instanceof ReferenceError)\n}\n"
  },
  {
    "path": "tests/jerry/class-get-set-as-method.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nclass A {\n  // Test skipping spaces\n  get     (a, b, c) {\n    return a + b + c;\n  }\n\n  // Test skipping spaces\n  static get(a, b, c) {\n    return a - b - c;\n  }\n\n  set (a, b) {\n    return a * b;\n  }\n\n  static set (a, b) {\n    return a / b;\n  }\n}\n\nassert(A.get(1, 2, 3) === -4);\nassert(A.set(2, 1) === 2);\n\nvar a = new A;\n\nassert(a.get(1, 2, 3) === 6);\nassert(a.set(2, 2) === 4);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-bound.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar g = Array.bind (0, 1, 2, 3)\ng.prototype = Array.prototype;\n\nclass C extends g {}\n\nclass D extends C {\n  constructor () {\n    super (4, 5);\n  }\n}\n\nvar d = new D;\nassert (Object.getPrototypeOf (d) == D.prototype);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-builtin-array.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n function isInstanceofArray (instance) {\n   assert (instance instanceof C);\n   assert (instance instanceof B);\n   assert (instance instanceof A);\n   assert (instance instanceof Array);\n }\n\n class A extends Array {\n   f () {\n     return 5;\n   }\n }\n\n class B extends A {\n   g () {\n     return eval (\"eval ('super.f ()')\");\n   }\n }\n\n class C extends B {\n   h () {\n     return eval ('super.g ()');\n   }\n }\n\n var c = new C (1, 2, 3, 4, 5, 6);\n\n isInstanceofArray (c);\n c.push (7);\n assert (c.length === 7);\n assert (c.f () === 5);\n assert (c.g () === 5);\n assert (c.h () === 5);\n\n // Test built-in Array prototype methods\n var mapped = c.map ((x) => x * 2);\n isInstanceofArray (mapped);\n\n for (var i = 0; i < mapped.length; i++) {\n   assert (mapped[i] == c[i] * 2);\n }\n\n var concated = c.concat (c);\n isInstanceofArray (concated);\n\n for (var i = 0; i < concated.length; i++) {\n   assert (concated[i] == c[i % (concated.length / 2)]);\n }\n\n var sliced = c.slice (c);\n isInstanceofArray (sliced);\n\n for (var i = 0; i < sliced.length; i++) {\n   assert (sliced[i] == c[i]);\n }\n\n var filtered = c.filter ((x) => x > 100);\n isInstanceofArray (sliced);\n assert (filtered.length === 0);\n\n var spliced = c.splice (c.length - 1);\n isInstanceofArray (spliced);\n assert (spliced.length === 1);\n assert (spliced[0] === 7);\n\n c.constructor = 5;\n\n try {\n   mapped = c.map ((x) => x * 2);\n   assert (false);\n } catch (e) {\n   assert (e instanceof TypeError);\n }\n\n try {\n   concated = c.concat (c);\n   assert (false);\n } catch (e) {\n   assert (e instanceof TypeError);\n }\n\n try {\n   sliced = c.slice (c);\n   assert (false);\n } catch (e) {\n   assert (e instanceof TypeError);\n }\n\n try {\n   filtered = c.filter ((x) => x > 100);\n   assert (false);\n } catch (e) {\n   assert (e instanceof TypeError);\n }\n\n try {\n   spliced = c.splice (0);\n   assert (false);\n } catch (e) {\n   assert (e instanceof TypeError);\n }\n"
  },
  {
    "path": "tests/jerry/class-inheritance-builtin-typedarray.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n function isInstanceofTypedArray (instance) {\n   assert (instance instanceof C);\n   assert (instance instanceof B);\n   assert (instance instanceof A);\n   assert (instance instanceof Uint8Array);\n }\n\n class A extends Uint8Array {\n   f () {\n     return 5;\n   }\n }\n\n class B extends A {\n   g () {\n     return super.f ();\n   }\n }\n\n class C extends B {\n   h () {\n     return super.g ();\n   }\n }\n\n var c = new C ([1, 2, 3, 4, 5, 6]);\n\n isInstanceofTypedArray (c);\n assert (c.length === 6);\n assert (c.f () === 5)\n assert (c.g () === 5)\n assert (c.h () === 5)\n\n/* TODO: Enable these tests after Symbol has been implemented\n var mapped = c.map ((x) => x * 2);\n isInstanceofTypedArray (mapped);\n\n for (var i = 0; i < mapped.length; i++) {\n   assert (mapped[i] == c[i] * 2);\n }\n\n var filtered = c.filter ((x) => x > 100);\n isInstanceofTypedArray (filtered);\n assert (filtered.length === 0);\n\n c.constructor = 5;\n\n try {\n   mapped = c.map ((x) => x * 2);\n   assert (false);\n } catch (e) {\n   assert (e instanceof TypeError)\n }\n\n try {\n   filtered = c.filter ((x) => x > 100);\n   assert (false);\n } catch (e) {\n   assert (e instanceof TypeError)\n }\n*/\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-1.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass Animal {\n  constructor (name) {\n    this.name = name;\n  }\n\n  hello () {\n    return \"Hello I am \" + this.name;\n  }\n\n  static speak () {\n    return \"Animals roar.\";\n  }\n\n  static explain () {\n    return \"I can walk,\";\n  }\n\n  whoAmI () {\n    return \"I am an Animal.\";\n  }\n\n  breath () {\n    return \"I am breathing.\";\n  }\n\n  get myName () {\n    return this.name;\n  }\n\n  set rename (name) {\n    this.name = name;\n  }\n}\n\nclass Dog extends Animal {\n  constructor (name, barks) {\n    super (name);\n    this.barks = barks;\n  }\n\n  hello () {\n    return super.hello () + \" and I can \" + (this.barks ? \"bark\" : \"not bark\");\n  }\n\n  whoAmI () {\n    return \"I am a Dog.\";\n  }\n\n  static speak () {\n    return \"Dogs bark.\";\n  }\n\n  static explain () {\n    return super.explain () + \" jump,\";\n  }\n\n  bark () {\n    return this.barks ? \"Woof\" : \"----\";\n  }\n}\n\nclass Doge extends Dog {\n  constructor (name, barks, awesomeness) {\n    super (name, barks);\n    this.awesomeness = awesomeness;\n  }\n\n  hello () {\n    return super.hello () + \" and I'm \" + (this.awesomeness > 9000 ? \"super awesome\" : \"awesome\") + \".\";\n  }\n\n  whoAmI ( ) {\n    return \"I am a Doge.\";\n  }\n\n  static speak () {\n    return \"Doges wow.\";\n  }\n\n  static explain () {\n    return super.explain () + \" dance.\";\n  }\n}\n\nvar doge = new Doge (\"doggoe\", true, 10000);\nassert (doge.name === \"doggoe\");\ndoge.rename = \"doggo\";\nassert (doge.myName === \"doggo\");\nassert (doge.barks === true);\nassert (doge.awesomeness === 10000);\nassert (doge.hello () === \"Hello I am doggo and I can bark and I'm super awesome.\");\nassert (doge.whoAmI () === \"I am a Doge.\");\nassert (doge.breath () === \"I am breathing.\");\nassert (doge.bark () === \"Woof\");\nassert (Doge.speak () === \"Doges wow.\");\nassert (Doge.explain () === \"I can walk, jump, dance.\");\nassert (doge instanceof Animal);\nassert (doge instanceof Dog);\nassert (doge instanceof Doge);\nassert (Dog.prototype.constructor === Dog)\nassert (Doge.prototype.constructor === Doge)\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-10.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n class A extends Array {\n   constructor () {\n     return null;\n   }\n }\n\n class B extends A { }\n\n try {\n   new B;\n   assert (false);\n } catch (e) {\n   assert (e instanceof TypeError);\n }\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-11.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n class A extends Array {\n   constructor () {\n     assert (false);\n     return null;\n   }\n }\n\n class B extends A {\n   constructor () {\n     return { o : 10 };\n   }\n }\n\n var b = new B;\n assert (b.o === 10);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-12.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n class A extends Array {\n   constructor (a, b, c) {\n     eval (\"eval ('super (a, b, c)')\");\n     eval (\"eval ('this.f = 5;')\");\n     assert (this.h ()()() === 5);\n\n     return { o : 4 };\n   }\n\n   g () {\n     return function () {\n       return 5;\n     }\n   }\n }\n\n class B extends A {\n   constructor (a, b, c) {\n     eval (\"eval ('super (a, b, c)')\");\n     assert (this.f === undefined)\n     assert (this.o === 4)\n     this.k = 5;\n     return { o : 7 };\n   }\n\n   h () {\n     return super[\"g\"];\n   }\n }\n\n var b = new B (1, 2, 3, 4);\n assert (b.k === undefined);\n assert (b.o === 7);\n assert (b.h === undefined);\n assert (b.g === undefined);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-13.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n class C extends Array {\n   constructor (a, b) {\n     var a = eval ('super (arguments);');\n   }\n }\n\n class D extends C {\n   constructor () {\n      var a = eval (\"eval ('super (1, 2);')\");\n      return\n   }\n }\n\n var d = new D;\n assert (JSON.stringify (d) === '[{\"0\":1,\"1\":2}]');\n assert (d + \"\" === \"[object Arguments]\");\n assert (d.length === 1);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-14.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass A {\n  constructor () {\n    this.a = 5;\n  }\n\n  f () {\n    return 10;\n  }\n\n  super () {\n    this.super = 10;\n    return 15;\n  }\n}\n\nclass B extends A {\n  constructor () {\n    super ();\n    assert (super.f === A.prototype.f);\n    super.f = 8;\n    assert (this.f === 8);\n    assert (super.f === A.prototype.f);\n\n    assert (this.a === 5);\n    super.a = 10;\n    assert (this.a === 10);\n\n    assert (super.super () === 15);\n    assert (this.super === 10);\n    super.super = 20;\n    assert (this.super === 20);\n    assert (super.super () === 15);\n  }\n}\n\nvar b = new B;\nassert (b.f === 8);\nassert (b.a === 10);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-15.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n class A extends Array {\n   constructor () {\n     super ();\n     return;\n   }\n };\n\n var a = new A;\n assert (a.length === 0);\n assert (a instanceof Array);\n assert (a instanceof A);\n assert (JSON.stringify (a) === \"[]\");\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-2.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n class C {\n   static a () {\n     return 5;\n   }\n }\n\n class D extends C {\n   constructor () {\n     super ();\n   }\n }\n\n assert (D.a () === 5);\n\n C.a = function () {\n   return 6;\n }\n\n assert (D.a () === 6);\n\n C = 5;\n\n assert (D.a () === 6);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-3.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass A extends Array {\n  constructor (a, b, c) {\n    super (a, b);\n    this.f = 5;\n  }\n}\n\nclass B extends A { }\n\nvar b = new B (1, 2, 3, 4);\nassert (b.f === 5);\nassert (b.length === 2);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-4.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n class A extends Array {\n   constructor (a, b, c) {\n     super (a, b);\n     this.f = 5;\n   }\n }\n\n class B extends A {\n   constructor (a, b, c) {\n     super (a, b);\n     this.g = super.f;\n     this.h = this.f;\n   }\n }\n\n var b = new B (1, 2, 3, 4);\n assert (b.g === undefined);\n assert (b.h === 5);\n assert (b.length === 2);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-5.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n class A extends Array {\n   constructor (a, b, c) {\n     eval (\"eval ('super (a, b, c)')\");\n     eval (\"eval ('this.f = 5;')\");\n   }\n }\n\n class B extends A { }\n\n var b = new B (1, 2, 3, 4);\n assert (b.f === 5);\n assert (b.length === 3);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-6.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n class A extends Array {\n   constructor (a, b, c, d, e) {\n     eval (\"eval ('super (a, b, c)')\");\n     this.a = 6;\n     return new String (\"foo\");\n   }\n\n   f () {\n     return 5;\n   }\n }\n\n class B extends A {\n   constructor (a, b, c, d) {\n    eval (\"eval ('super (a, b, c, d)')\");\n    assert (super.f () === 5);\n   }\n }\n\n var a = new B (1, 2, 3, 4, 5, 6);\n assert (a.a === undefined);\n assert (a[0] + a[1] + a[2] === \"foo\");\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-7.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n class C extends Array {\n   constructor () {\n     var a = eval ('super (1, 2); 5');\n     assert (a === 5);\n   }\n }\n\n class D extends C {\n   constructor () {\n      var a = eval (\"eval ('super (1, 2); 3')\");\n      assert (a === 3);\n   }\n }\n\n var d = new D;\n\n assert (JSON.stringify (d) === \"[1,2]\");\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-8.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n var A = Array;\n var order = 0;\n\n function f () {\n   order++;\n\n   return function () {\n     return A;\n   }\n }\n\n var B = class extends f ()() {\n   constructor () {\n     assert (++order === 2);\n     eval (\"eval ('super (1, 2, 3, 4)')\");\n     try {\n       super (1, 2, 3, 4, 5)\n       assert (false);\n     } catch (e) {\n       assert (e instanceof ReferenceError)\n     }\n\n     assert (this.g ()()()() === 10);\n     assert (eval (\"eval ('this.g ()')()\")()() === 10);\n     assert (eval (\"eval ('this.g ()')\")()()() === 10);\n     assert (eval (\"eval ('this.g ()()()')\")() === 10);\n     assert (eval (\"eval ('this.g')\")()()()() === 10);\n     this.push (5);\n     assert (this.length === 5)\n     eval ('this.push (6)');\n     assert (this.length === 6);\n     eval (\"eval ('this.push (7)')\");\n     this.j = 6;\n     return;\n   }\n }\n\n var C = class extends B {\n   g () {\n     return function () {\n       return () => {\n         return 10;\n       }\n     }\n   }\n }\n\n var D = class D extends C {\n    constructor () {\n      super ();\n      this.k = 5;\n      return\n    }\n\n    g () {\n      return eval ('super[\"g\"]');\n    }\n }\n\n assert (order === 1);\n\n var d = new D;\n assert (d.length === 7);\n assert (d.k === 5);\n assert (d.j === 6);\n assert (d instanceof D);\n assert (d instanceof C);\n assert (d instanceof B);\n assert (d instanceof f ()());\n assert (JSON.stringify (d) === \"[1,2,3,4,5,6,7]\");\n"
  },
  {
    "path": "tests/jerry/class-inheritance-core-9.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n var order = 0;\n\n try {\n   var A = class extends null {\n     constructor () {\n       order++;\n     }\n   }\n\n   new A;\n } catch (e) {\n   assert (order === 1);\n   assert (e instanceof ReferenceError);\n }\n"
  },
  {
    "path": "tests/jerry/class-inheritance-early-semantics.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction must_throw (str) {\n  try {\n    eval (\"switch (1) { default: \" + str + \"}\");\n    assert (false);\n  } catch (e) { }\n\n  try {\n    eval (str);\n    assert (false);\n  }\n  catch (e) { }\n\n  try {\n    eval (\"'use strict'; switch (1) { default: \" + str + \"}\");\n    assert (false);\n  } catch (e) { }\n\n  try {\n    eval (\"'use strict'; \" + str);\n    assert (false);\n  } catch (e) { }\n}\n\nclass A {\n  constructor (a) {\n    this.a = a;\n  }\n\n  f () {\n    return 5;\n  }\n}\n\nmust_throw (\"class B extends 5 + 6 + 5 { constructor (a, b) { super (a) } }\");\n\nmust_throw (\"class B extends null { constructor () { super () } }; new B\");\n\nmust_throw (\"var o = { a : 5 }; \\\n             class B extends Object.keys (o)[0] { constructor (a, b) { super (a) } } \\\n             var b = new B (1, 2);\");\n\nmust_throw (\"class B extends A { constructor (a, b) { this.b = b} } \\\n             var b = new B (1, 2);\");\n\nmust_throw (\"class B extends A { constructor (a, b) { super.f () } } \\\n             var b = new B (1, 2);\");\n\nmust_throw (\"class B extends A { constructor (a, b) { eval ('this.b = b') } } \\\n             var b = new B (1, 2);\");\n\nmust_throw (\"class B extends A { constructor (a, b) { eval ('super.f ()') } } \\\n             var b = new B (1, 2);\");\n\nmust_throw (\"class B extends A { constructor (a, b) { super (a); super (a); } } \\\n             var b = new B (1, 2);\");\n\nmust_throw (\"class B extends A { constructor (a, b) { eval ('super (a)'); eval ('super (a)'); } } \\\n             var b = new B (1, 2);\");\n\nmust_throw (\"class B extends A { constructor (a, b) { super (a) } g () { super (a) } } \\\n             var b = new B (1, 2);\");\n\nmust_throw (\"class B extends A { constructor (a, b) { super (a) } g () { eval ('super (a)') } } \\\n             var b = new B (1, 2); \\\n             b.g ();\");\n\nmust_throw (\"class B extends A { constructor (a, b) { super (a) } g () { return function () { return super.f () } } } \\\n             var b = new B (1, 2); \\\n             b.g ()();\");\n\nmust_throw (\"class B extends A { constructor (a, b) { super (a) } \\\n                                 g () { return function () { return eval ('super.f ()') } } } \\\n             var b = new B (1, 2); \\\n             b.g ()();\");\n\nmust_throw (\"class B extends A { constructor (a, b) { super (a) } \\\n                                 g () { return function () { return eval (\\\"eval ('super.f ();')\\\") } } } \\\n             var b = new B (1, 2); \\\n             b.g ()();\");\n\nmust_throw (\"class A extends Array { constructor () { return 5; } }; new A\");\n\nmust_throw (\"class A extends Array { constructor () { return undefined; } }; new A\");\n\nmust_throw (\"class B extends undefined { }; new B;\");\n\nmust_throw (\"var A = class extends Array { . }\");\n\nmust_throw (\"class Array extends Array { }\");\n\nmust_throw (\"class A extends A { }\");\n\nmust_throw (\"class A extends { constructor () { super () } }\");\n\nmust_throw (\"class A extends a * b {}\");\n\nmust_throw (\"class A extends a = b {}\");\n\nmust_throw (\"class A extends a++ {}\");\n\nmust_throw (\"class A extends -a {}\");\n\nclass B extends A {\n  constructor (a, b) {\n    super (a);\n    assert (super.f () === 5);\n  }\n\n  g () {\n    return () => {\n      return super.f ();\n    }\n  }\n\n  h () {\n    return () => {\n      return () => {\n        return eval ('super.f ()');\n      }\n    }\n  }\n}\n\nvar b = new B (1, 2);\nassert (b.g ()() === 5);\nassert (b.h ()()() === 5);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-has-instance.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Create bound implicit class constructor */\nclass myArray extends Array { };\n\nvar array = new myArray (1);\narray.push (2);\nassert (array.length === 2);\nassert (array instanceof myArray);\nassert (array instanceof Array);\nassert (!([] instanceof myArray));\n\n/* Add a new element to the bound function chain */\nclass mySecretArray extends myArray { };\n\nvar secretArray = new mySecretArray (1, 2);\nsecretArray.push (3);\nassert (secretArray.length === 3);\nassert (secretArray instanceof mySecretArray);\nassert (secretArray instanceof myArray);\nassert (secretArray instanceof Array);\nassert (!([] instanceof mySecretArray));\n\n/* Add a new element to the bound function chain */\nclass myEpicSecretArray extends mySecretArray { };\n\nvar epicSecretArray = new myEpicSecretArray (1, 2, 3);\nepicSecretArray.push (4);\nassert (epicSecretArray.length === 4);\nassert (epicSecretArray instanceof myEpicSecretArray);\nassert (epicSecretArray instanceof mySecretArray);\nassert (epicSecretArray instanceof myArray);\nassert (epicSecretArray instanceof Array);\nassert (!([] instanceof myEpicSecretArray));\n"
  },
  {
    "path": "tests/jerry/class-inheritance-inner-class.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// TODO: enable this test when super keyword is supported for normal functions\n/*\nvar console = { assert : assert };\n\nclass C1 {\n  f () {\n    return 5;\n  }\n}\n\nclass C2 extends C1 {\n  f () {\n    assert (super.f () === 5);\n\n    class G {\n      g () {\n        assert (super.f === undefined);\n        assert (super.toString () === \"[object Object]\");\n        var a = super.valueOf ();\n        try {\n          a ();\n          assert (false);\n        } catch (e) {\n          assert (e instanceof TypeError);\n        }\n      }\n\n      constructor () {\n        // Test to overwrite the current lit-object\n        console.assert (Object.getPrototypeOf (this) === G.prototype);\n\n        try {\n          eval (\"super ()\");\n          assert (false);\n        } catch (e) {\n          assert (e instanceof SyntaxError);\n        }\n      }\n    }\n\n    var g = new G ();\n    g.g ();\n  }\n}\n\n(new C2).f ();\n*/\n"
  },
  {
    "path": "tests/jerry/class-inheritance-mixins-1.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar calculatorMixin = Base => class extends Base {\n  f () {\n    return 1;\n  }\n};\n\nvar randomizerMixin = Base => class extends Base {\n  g () {\n    return 2;\n  }\n};\n\nclass A {\n  constructor () { }\n}\n\nclass B extends calculatorMixin (randomizerMixin (A)) {\n\n}\n\nvar b = new B ();\nassert (b.f () === 1)\nassert (b.g () === 2);\n"
  },
  {
    "path": "tests/jerry/class-inheritance-mixins-2.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n order = 0;\n\n var Mixin1 = (superclass) => class extends superclass {\n   foo () {\n     assert (order++ == 1)\n     if (super.foo) {\n       super.foo ();\n     }\n   }\n };\n\n var Mixin2 = (superclass) => class extends superclass {\n   foo () {\n     assert (order++ == 2)\n     if (super.foo) {\n       assert (super.foo () === 5);\n     }\n   }\n };\n\n class S {\n   foo () {\n     assert (order++ == 3)\n     return 5;\n   }\n }\n\n class C extends Mixin1 (Mixin2 (S)) {\n   foo () {\n     assert (order++ == 0)\n     super.foo ();\n   }\n }\n\n new C ().foo ()\n"
  },
  {
    "path": "tests/jerry/class-super-access-direct.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass Base {\n  constructor () {\n    this.parent_value = 100;\n  }\n\n  parent_value () {\n    return this.parent_value;\n  }\n\n  parent_value_arg (a, b, c) {\n    if (c) {\n      return this.parent_value + a + b + c;\n    } else if (b) {\n      return this.parent_value + a + b;\n    } else {\n      return this.parent_value + a;\n    }\n  }\n\n  method () {\n    return {\n      method: function (a, b, c, d, e) { return -50 + a + b + c + d + e; }\n    }\n  }\n}\n\nclass Target extends Base {\n  constructor () {\n    super ();\n    this.parent_value = -10;\n  }\n\n  parent_value () {\n    throw new Error ('(parent_value)');\n  }\n\n  parent_value_direct () {\n    return super.parent_value ();\n  }\n\n  parent_value_direct_arg (a, b, c) {\n    if (c) {\n      return super.parent_value_arg (a, b, c);\n    } else if (b) {\n      return super.parent_value_arg (a, b);\n    } else {\n      return super.parent_value_arg (a);\n    }\n  }\n\n  method () {\n    throw new Error (\"(method)\");\n  }\n\n  parent_method_dot () {\n    return super.method ().method (1, 2, 3, 4, 5)\n  }\n\n  parent_method_index () {\n    return super['method']()['method'](1, 2, 3, 4, 5);\n  }\n}\n\n\nvar obj = new Target ();\n\nassert (obj.parent_value_direct () === -10);\nassert (obj.parent_value_direct_arg (1) === -9);\nassert (obj.parent_value_direct_arg (1, 2) === -7);\nassert (obj.parent_value_direct_arg (1, 2, 3) === -4);\n\ntry {\n  obj.parent_value();\n  assert (false)\n} catch (ex) {\n  /* 'obj.parent_value is a number! */\n  assert (ex instanceof TypeError);\n}\n\nassert (obj.parent_method_dot () === -35);\nassert (obj.parent_method_index () === -35);\n\ntry {\n  obj.method ();\n  assert (false);\n} catch (ex) {\n  assert (ex.message === '(method)');\n}\n"
  },
  {
    "path": "tests/jerry/class-super-access-indirect.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass Base {\n  constructor () {\n    this.parent_value = 100;\n  }\n\n  parent_value () {\n    return this.parent_value;\n  }\n\n  parent_value_arg (a, b, c) {\n    if (c) {\n      return this.parent_value + a + b + c;\n    } else if (b) {\n      return this.parent_value + a + b;\n    } else {\n      return this.parent_value + a;\n    }\n  }\n\n  method () {\n    return {\n      method: function (a, b, c, d, e) { return -50 + a + b + c + d + e; }\n    }\n  }\n}\n\nclass Target extends Base {\n  constructor () {\n    super ();\n    this.parent_value = -10;\n  }\n\n  parent_value () {\n    throw new Error ('(parent_value)');\n  }\n\n  parent_value_indirect () {\n    return super.parent_value.call (this);\n  }\n\n  parent_value_indirect_arg (a, b, c) {\n    if (c) {\n      return super.parent_value_arg.call (this, a, b, c);\n    } else if (b) {\n      return super.parent_value_arg.call (this, a, b);\n    } else {\n      return super.parent_value_arg.call (this, a);\n    }\n  }\n\n  method () {\n    throw new Error (\"(method)\");\n  }\n\n  parent_method_dot () {\n    return super.method.call (this).method (1, 2, 3, 4, 5)\n  }\n\n  parent_method_index() {\n    return super['method'].call (this)['method'] (1, 2, 3, 4, 5);\n  }\n}\n\n\nvar obj = new Target();\n\nassert (obj.parent_value_indirect () === -10);\nassert (obj.parent_value_indirect_arg (1) === -9);\nassert (obj.parent_value_indirect_arg (1, 2) === -7);\nassert (obj.parent_value_indirect_arg (1, 2, 3) === -4);\n\ntry {\n  obj.parent_value ();\n  assert (false);\n} catch (ex) {\n  /* 'obj.parent_value is a number! */\n  assert (ex instanceof TypeError);\n}\n\nassert (obj.parent_method_dot () === -35);\nassert (obj.parent_method_index () === -35);\n\ntry {\n  obj.method();\n  assert (false);\n} catch (ex) {\n  assert (ex.message === '(method)');\n}\n\nvar demo_object = {\n  parent_value: 1000,\n  method: function () {\n    throw new Error ('Very bad!');\n  }\n}\n\nassert (obj.parent_value_indirect_arg.call (demo_object, 1) === 1001);\nassert (obj.parent_value_indirect_arg.call (demo_object, 1, 2) === 1003);\n\nassert (obj.parent_method_dot.call (demo_object) === -35);\n"
  },
  {
    "path": "tests/jerry/class-with.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar called = false\nvar obj = { f() { assert(this === obj); called = true } }\n\nfunction f() {\n  assert(false)\n}\n\nwith (obj) {\n  new class {\n    constructor() {\n      f()\n    }\n  }\n}\n\nassert(called)\n"
  },
  {
    "path": "tests/jerry/class.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction must_throw(str) {\n  try {\n    eval(\"switch (1) { default: \" + str + \"}\");\n    assert(false);\n  } catch (e) {\n  }\n\n  try {\n    eval(str);\n    assert(false);\n  }\n  catch (e) {\n  }\n\n  must_throw_strict(str);\n}\n\nfunction must_throw_strict(str) {\n  try {\n    eval (\"'use strict'; switch (1) { default: \" + str + \"}\");\n    assert (false);\n  } catch (e) {\n  }\n\n  try {\n    eval(\"'use strict'; \" + str);\n    assert(false);\n  } catch (e) {\n  }\n}\n\nmust_throw(\"class {}\");\nmust_throw(\"class class {}\");\nmust_throw(\"class A { constructor() {} this.a = 5 }\");\nmust_throw(\"class A { constructor() {} constructor() {} }\");\nmust_throw(\"class A { static prototype() {} }\");\nmust_throw(\"class A { static get prototype() {} }\");\nmust_throw(\"class A { static set prototype() {} }\");\nmust_throw(\"class A { static prototyp\\u{0065}() {} }\");\nmust_throw(\"class A { static get prototyp\\u{0065}() {} }\");\nmust_throw(\"class A { static set prototyp\\u{0065}() {} }\");\nmust_throw(\"class A { static 'prototype'() {} }\");\nmust_throw(\"class A { static get 'prototype'() {} }\");\nmust_throw(\"class A { static set 'prototype'() {} }\");\nmust_throw(\"class A { static 'prototyp\\u{0065}'() {} }\");\nmust_throw(\"class A { static get 'prototyp\\u{0065}'() {} }\");\nmust_throw(\"class A { static set 'prototyp\\u{0065}'() {} }\");\nmust_throw(\"class A { get constructor() {} }\");\nmust_throw(\"class A { set constructor() {} }\");\nmust_throw(\"class A {}; A()\");\nmust_throw(\"class X {}; var o = {}; Object.defineProperty(o, 'p', { get: X, set: X }); o.p;\");\nmust_throw(\"var a = new A; class A {};\");\nmust_throw(\"class A { g\\\\u0065t e() {} }\");\nmust_throw('class A { \"static\" e() {} }');\nmust_throw('class A { *constructor() {} }');\n\nassert(eval(\"class A {}\") === undefined);\nassert(eval(\"var a = class A {}\") === undefined);\nassert(eval(\"var a = class {}\") === undefined);\nassert(eval(\"class A { ; ; ; ;;;;;;;;;;;; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;; }\") === undefined);\nassert(eval('class A {\"constructor\"() {} }') === undefined);\nassert(isNaN (eval('switch(1) { default: (class A{} % 1) }')));\n\nclass A1 {\n  [\"constructor\"]() {\n    return 5;\n  }\n}\n\nassert ((new A1).constructor() === 5);\n\nclass A2 {\n  *[\"constructor\"]() {\n    yield 5;\n  }\n}\n\nassert ((new A2).constructor().next().value === 5);\n\nclass B {\n}\n\nvar b = new B;\nassert (typeof B  === \"function\");\nassert (typeof b === \"object\");\nassert (b.constructor === B);\n\nclass C {\n  c1() {\n    return 5;\n  }\n\n  c2() {\n    return this._c;\n  }\n  3() {\n    return 3;\n  }\n\n  super() {\n    return 42;\n  }\n  return() {\n    return 43;\n  }\n\n  static *constructor() {\n    return 44;\n  }\n}\n\nvar c = new C;\nassert (c.c1() === 5);\nassert (c.c2() === undefined);\nassert (c[\"3\"]() === 3);\nassert (c.super() === 42);\nassert (c.return() === 43);\nassert (c.constructor === C);\nassert (C.constructor().next().value === 44);\n\nclass D {\n  constructor(d) {\n    this._d = d;\n  }\n\n  d1() {\n    return this._d;\n  }\n}\nvar d = new D(5);\nassert (d.d1() === 5);\nassert (d.constructor === D);\n\nclass E {\n  constructor(e) {\n    this._e = e;\n  }\n\n  get e() {\n    return this._e;\n  }\n\n  set e(e) {\n    this._e = e;\n  }\n\n  get () {\n    return 11;\n  }\n\n  set () {\n    return 12;\n  }\n}\nvar e = new E (5);\nassert (e.e === 5);\ne.e = 10;\nassert (e.e === 10);\nassert (e.get() === 11);\nassert (e.set() === 12);\nassert (e.constructor === E);\n\nvar F = class ClassF {\n  constructor(f) {\n    this._f = f;\n  }\n\n  static f1() {\n    return this;\n  }\n\n  static f2() {\n    return this._f;\n  }\n\n  static f3(a, b) {\n    return a + b;\n  }\n\n  static constructor(a) {\n    return a;\n  }\n\n  static static(a) {\n    return a;\n  }\n\n  static 2 (a) {\n    return 2 * a;\n  }\n\n  static function(a) {\n    return 3 * a;\n  }\n}\n\nvar f = new F(5);\n\nassert (f.f1 === undefined);\nassert (f.f2 === undefined);\nassert (F.f1() === F);\nassert (F.f2() === undefined);\nassert (F.f3(1, 1) === 2);\nassert (F.constructor(5) === 5);\nassert (F.static(5) === 5);\nassert (F[\"2\"](5) === 10);\nassert (F.function(5) === 15);\nassert (f.constructor === F);\n\nvar G = class {\n  static set a(a) {\n    this._a = a;\n  }\n  static get a() {\n    return this._a;\n  }\n  static set 1(a) {\n    this._a = a;\n  }\n  static get 1() {\n    return this._a;\n  }\n\n  static get() {\n    return 11;\n  }\n\n  static set() {\n    return 12;\n  }\n\n  static set constructor(a) {\n    this._a = a;\n  }\n  static get constructor() {\n    return this._a;\n  }\n\n  static g1() {\n    return 5;\n  }\n\n  static g1() {\n    return 10;\n  }\n}\n\nG.a = 10;\nassert (G.a === 10);\nassert (G.g1() === 10);\nG[\"1\"] = 20;\nassert (G[\"1\"] === 20);\nassert (G.get() == 11);\nassert (G.set() == 12);\nG.constructor = 30;\nassert (G.constructor === 30);\n\nclass H {\n  method() { assert (typeof H === 'function'); return H; }\n}\n\nlet H_original = H;\nvar H_method = H.prototype.method;\nC = undefined;\nassert(C === undefined);\nC = H_method();\nassert(C === H_original);\n\nvar I = class C {\n  method() { assert(typeof C === 'function'); return C; }\n}\n\nlet I_original = I;\nvar I_method = I.prototype.method;\nI = undefined;\nassert(I === undefined);\nI = I_method();\nassert(I == I_original);\n\nvar J_method;\nclass J {\n  static [(J_method = eval('(function() { return J; })'), \"X\")]() {}\n}\nvar J_original = J;\nJ = 6;\nassert (J_method() == J_original);\n\nvar K_method;\nclass K {\n  constructor () {\n    K_method = function() { return K; }\n  }\n}\nvar K_original = K;\nnew K;\nK = 6;\nassert (K_method() == K_original);\n\nvar L_method;\nclass L extends (L_method = function() { return L; }) {\n}\nvar L_original = L;\nL = 6;\nassert (L_method() == L_original);\n\n/* Test cleanup class environment */\ntry {\n  class A {\n    [d]() {}\n  }\n  let d;\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n\ntry {\n  class A extends d {}\n  let d;\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\ntry {\n  var a = 1 + 2 * 3 >> class A extends d {};\n  let d;\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/class_static_block.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error(code) {\n  try {\n    eval(code)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof SyntaxError)\n  }\n}\n\ncheck_syntax_error(\"static {}\");\ncheck_syntax_error(\"class C { #static {} }\");\ncheck_syntax_error(\"function foo() { static {} }\");\ncheck_syntax_error(\"class C { static { return; } }\");\ncheck_syntax_error(\"class C { static { break; } }\");\ncheck_syntax_error(\"class C { static { continue; } }\");\ncheck_syntax_error(\"class C { static { await => 0; } }\");\ncheck_syntax_error(\"class C { static { yield } }\");\ncheck_syntax_error(\"class C { static { super(); } }\");\ncheck_syntax_error(\"class C { static { let a; let a; } }\");\ncheck_syntax_error(\"class C { static { label: label: 0 } }\");\ncheck_syntax_error(\"class C { static { let #a; } }\");\ncheck_syntax_error(\"class C { static { (class { [arguments]() { } }); } }\");\ncheck_syntax_error(\"class C { static {x: while (false) {continue y; } } }\");\ncheck_syntax_error(\"function* g() { class C { static { yield; } } }\");\n\ntry {\n  class C {\n    static {\n      function foo() {\n        return this.a\n      };\n\n      foo()\n    }\n  }\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\nclass Parent {\n  static fieldP = 'fieldP'\n}\n\nclass C1 extends Parent{\n  static a = 0;\n  static #privateField = 1;\n\n  static {\n    assert(this.a === 0)\n    assert(this.#privateField === 1)\n\n    this.a = 1\n    this.b = super.fieldP\n    this.c = new.target\n\n    assert(this.a === 1)\n    assert(this.b === 'fieldP')\n    assert(this.c === undefined)\n    assert(this.d === undefined)\n  }\n\n  static d = 2\n\n  static {\n    assert(this.b === 'fieldP')\n    assert(this.d === 2)\n  }\n\n  static {\n    function f() {\n      assert(this === undefined)\n    }\n\n    let a = 11\n    assert (this.a !== a)\n  }\n\n}\n\nclass C2 {\n  getPrivateField;\n  static getPrivateField2;\n  static invalidAccess;\n}\n\nlet getPrivateField;\n\nclass C3 {\n  #privateField = 'invalid';\n  static #staticPrivateField = 'private';\n\n  constructor(p) {\n    this.#privateField = p;\n  }\n\n  static {\n    getPrivateField = (d) => d.#privateField;\n    C2.getPrivateField = () => this.#staticPrivateField;\n    C2.getPrivateField2 = () => this.#staticPrivateField;\n    C2.invalidAccess = () => this.#privateField;\n  }\n}\n\nassert(getPrivateField(new C3('private field')) == 'private field');\nassert(C2.getPrivateField() === 'private')\nassert(C2.getPrivateField2() === 'private')\n\ntry {\n  C2.invalidAccess()\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\nlet a = 'outter'\nlet b, c\n\nclass C5 {\n  static {\n    let a = 'first block'\n    b = a\n  }\n\n  static {\n    let a = \"second block\"\n    c = a\n  }\n}\n\nassert(a === \"outter\")\nassert(b === \"first block\")\nassert(c === \"second block\")\n"
  },
  {
    "path": "tests/jerry/const1.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst a = 6\nassert(!delete a)\nassert(a === 6)\n\ntry {\n  eval(\"a = 7\")\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\nfunction check_type_error(code) {\n  try {\n    eval(code)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n  }\n}\n\n// Register cases\ncheck_type_error(\"{ const a = 0; a = 1 }\");\ncheck_type_error(\"{ const a = 0; a += 1 }\");\ncheck_type_error(\"{ const a = 0; a -= 1 }\");\ncheck_type_error(\"{ const a = 0; a *= 1 }\");\ncheck_type_error(\"{ const a = 0; a %= 1 }\");\ncheck_type_error(\"{ const a = 0; a /= 1 }\");\ncheck_type_error(\"{ const a = 0; a <<= 1 }\");\ncheck_type_error(\"{ const a = 0; a >>= 1 }\");\ncheck_type_error(\"{ const a = 0; a >>>= 1 }\");\ncheck_type_error(\"{ const a = 0; a &= 1 }\");\ncheck_type_error(\"{ const a = 0; a |= 1 }\");\ncheck_type_error(\"{ const a = 0; a ^= 1 }\");\ncheck_type_error(\"{ const a = 0; a++ }\");\ncheck_type_error(\"{ const a = 0; a-- }\");\ncheck_type_error(\"{ const a = 0; ++a }\");\ncheck_type_error(\"{ const a = 0; --a }\");\ncheck_type_error(\"{ const a = 0; [a] = [1] }\");\ncheck_type_error(\"{ const a = 0; ({a} = { a:1 }) }\");\n\n// Non-register cases\ncheck_type_error(\"{ const a = 0; (function (){ a = 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a += 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a -= 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a *= 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a %= 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a /= 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a <<= 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a >>= 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a >>>= 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a &= 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a |= 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a ^= 1 })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a++ })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ a-- })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ ++a })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ --a })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ [a] = [1] })() }\");\ncheck_type_error(\"{ const a = 0; (function (){ ({a} = { a:1 }) })() }\");\n"
  },
  {
    "path": "tests/jerry/continue.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfor (var i = 0; i < 1000; i++)\n{\n  switch (1)\n  {\n  default:\n    /* This block must not be enclosed in braces. */\n    let j = eval();\n    continue;\n  }\n}\n\nnext:\nfor (var i = 0; i < 1000; i++)\n{\n  for (let j = eval(); true; )\n  {\n    continue next;\n  }\n}\n\nnext:\nfor (var i = 0; i < 1000; i++)\n{\n  for (let j in {a:1})\n  {\n    eval()\n    continue next;\n  }\n}\n"
  },
  {
    "path": "tests/jerry/dataview.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* ES11 24.3.2.1.1 */\ntry {\n  DataView ();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n/* ES11 24.3.2.1.2 (not object) */\ntry {\n  new DataView (5);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n/* ES11 24.3.2.1.2 (no [[ArrayBufferData]] internal slot) */\ntry {\n  new DataView ({});\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar buffer = new ArrayBuffer (16);\n\n/* ES11 24.3.2.1.3 (offset < 0)*/\ntry {\n  new DataView (buffer, -1);\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\n/* ES11 24.3.2.1.3 (offset > 2^53) */\ntry {\n  new DataView (buffer, Number.MAX_SAFE_INTEGER + 1);\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\n/* ES11 24.3.2.1.3 (ToInteger throws ReferenceError) */\ntry {\n  new DataView (buffer, { toString: function () { throw new ReferenceError ('foo') } });\n  assert (false);\n} catch (e) {\n  assert (e instanceof ReferenceError);\n  assert (e.message === 'foo');\n}\n\n\n/* ES11 24.3.2.1.6 */\ntry {\n  new DataView (buffer, 17);\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\n/* ES11 24.3.2.1.8.a */\ntry {\n  new DataView (buffer, 0, { toString: function () { throw new ReferenceError ('bar') } });\n  assert (false);\n} catch (e) {\n  assert (e instanceof ReferenceError);\n  assert (e.message === 'bar');\n}\n\n/* ES11 24.3.2.1.8.a */\ntry {\n  new DataView (buffer, 0, Infinity);\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\n/* ES11 24.3.2.1.8.b */\ntry {\n  new DataView (buffer, 4, 13);\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\n/* Tests accessors: ES11 24.3.4.{1, 2, 3}.2 */\nvar accessorList = ['buffer', 'byteLength', 'byteOffset'];\n\naccessorList.forEach (function (prop) {\n  try {\n    var obj = {};\n    Object.setPrototypeOf (obj, DataView.prototype);\n    obj[prop];\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n});\n\nbuffer = new ArrayBuffer (32);\nvar view1 = new DataView (buffer);\n\nassert (view1.buffer === buffer);\nassert (view1.byteOffset === 0);\nassert (view1.byteLength === buffer.byteLength);\n\nvar view2 = new DataView (buffer, 8);\nassert (view2.buffer === buffer);\nassert (view2.byteOffset === 8);\nassert (view2.byteLength === buffer.byteLength - view2.byteOffset);\n\nvar view3 = new DataView (buffer, 8, 16);\nassert (view3.buffer === buffer);\nassert (view3.byteOffset === 8);\nassert (view3.byteLength === 16);\n\n/* Test get/set routines */\nvar getters = ['getInt8', 'getUint8', 'getInt16', 'getUint16', 'getInt32', 'getUint32', 'getFloat32', 'getFloat64'];\nvar setters = ['setInt8', 'setUint8', 'setInt16', 'setUint16', 'setInt32', 'setUint32', 'setFloat32', 'setFloat64'];\nvar gettersSetters = getters.concat (setters);\n\ngettersSetters.forEach (function (propName) {\n  /* ES11 24.3.1.{1, 2}.1 */\n  var routine = DataView.prototype[propName];\n  try {\n    DataView.prototype[propName].call (5);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  /* ES11 24.3.1.{1, 2}.1 */\n  try {\n    DataView.prototype[propName].call ({});\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  /* ES11 24.3.1.{1, 2}.3 (ToInteger throws ReferenceError) */\n  try {\n    var buffer = new ArrayBuffer (16);\n    var view = new DataView (buffer)\n    view[propName] ({ toString : function () { throw new ReferenceError ('fooBar') } });\n    assert (false);\n  } catch (e) {\n    assert (e instanceof ReferenceError);\n    assert (e.message == 'fooBar');\n  }\n\n  var buffer = new ArrayBuffer (16);\n  var view = new DataView (buffer)\n\n  /* ES11 24.3.1.{1, 2}.3 (getIndex < 0) */\n  try {\n    view[propName] (-1);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof RangeError);\n  }\n\n  /* ES11 24.3.1.1.10, 24.3.1.2.12 */\n  try {\n    view[propName] (20);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof RangeError);\n  }\n});\n\n/* Test the endianness */\nfunction validateResult (view, offset, isLitteEndian, results) {\n  for (var i = 0; i < getters.length; i++) {\n    assert (results[i] === view[getters[i]](offset, isLitteEndian));\n  }\n}\n\nbuffer = new ArrayBuffer (24);\nview1 = new DataView (buffer);\nview2 = new DataView (buffer, 4, 12);\nview3 = new DataView (buffer, 6, 18);\nview4 = new DataView (buffer);\nview5 = new DataView (buffer);\n\nview1.setUint8 (0, 255);\nvalidateResult(view1, 0, false, [-1, 255, -256, 65280, -16777216, 4278190080, -1.7014118346046924e+38, -5.486124068793689e+303]);\nvalidateResult(view1, 0, true, [-1, 255, 255, 255, 255, 255, 3.5733110840282835e-43, 1.26e-321]);\nvalidateResult(view1, 2, false, [0, 0, 0, 0, 0, 0, 0, 0]);\nvalidateResult(view1, 2, true, [0, 0, 0, 0, 0, 0, 0, 0]);\n\nview1.setInt16 (4, 40000);\nvalidateResult(view1, 4, false, [-100, 156, -25536, 40000, -1673527296, 2621440000, -6.352747104407253e-22, -1.2938158758247024e-172]);\nvalidateResult(view2, 0, false, [-100, 156, -25536, 40000, -1673527296, 2621440000, -6.352747104407253e-22, -1.2938158758247024e-172]);\nvalidateResult(view1, 4, true, [-100, 156, 16540, 16540, 16540, 16540, 2.3177476599932474e-41, 8.172e-320]);\nvalidateResult(view2, 0, true, [-100, 156, 16540, 16540, 16540, 16540, 2.3177476599932474e-41, 8.172e-320]);\n\nview2.setUint32 (2, 3000000000, true);\nvalidateResult(view2, 2, false, [0, 0, 94, 94, 6213810, 6213810, 8.707402410606192e-39, 6.856613170926581e-307]);\nvalidateResult(view3, 0, false, [0, 0, 94, 94, 6213810, 6213810, 8.707402410606192e-39, 6.856613170926581e-307]);\nvalidateResult(view2, 2, true, [0, 0, 24064, 24064, -1294967296, 3000000000, -2.425713319098577e-8, 1.4821969375e-314]);\nvalidateResult(view3, 0, true, [0, 0, 24064, 24064, -1294967296, 3000000000, -2.425713319098577e-8, 1.4821969375e-314]);\n\nview3.setFloat32 (4, 8.5);\nvalidateResult(view3, 4, false, [65, 65, 16648, 16648, 1091043328, 1091043328, 8.5, 196608]);\nvalidateResult(view3, 4, true, [65, 65, 2113, 2113, 2113, 2113, 2.9609436551183385e-42, 1.044e-320]);\nvalidateResult(view2, 4, false, [-48, 208, -12110, 53426, -793624312, 3501342984, -23924850688, -5.411000515087672e+80]);\nvalidateResult(view2, 4, true, [-48, 208, -19760, 45776, 138523344, 138523344, 5.828901796903399e-34, 6.84396254e-316]);\n\nview4.setBigInt64 (0, 2n);\nassert(view4.getBigInt64(0) === 2n);\nview4.setBigInt64 (1, -2n);\nassert(view4.getBigInt64(1) === -2n);\nassert(view4.getBigUint64(1) === 18446744073709551614n);\n\nview5.setBigUint64 (0, 2n);\nassert(view5.getBigUint64(0) === 2n);\nview5.setBigUint64 (1, -2n);\nassert(view5.getBigUint64(1) === 18446744073709551614n);\nassert(view5.getBigInt64(1) === -2n);\n\n/* Second and third arguments can be \"undefined\" and there should be no error. */\nvar arrayBufferOk = new ArrayBuffer (12);\n\nvar dtviewA = new DataView (arrayBufferOk, 0, undefined);\nassert (dtviewA.byteLength === 12);\nassert (dtviewA.byteOffset === 0);\n\nvar dtviewB = new DataView (arrayBufferOk, 1, undefined);\nassert (dtviewB.byteLength === 11);\nassert (dtviewB.byteOffset === 1);\n\nvar dtviewC = new DataView (arrayBufferOk, null, undefined);\nassert (dtviewC.byteLength === 12);\nassert (dtviewC.byteOffset === 0);\n\nvar dtviewD = new DataView (arrayBufferOk, 0, null);\nassert (dtviewD.byteLength === 0);\nassert (dtviewD.byteOffset === 0);\n\nvar dtviewE = new DataView (arrayBufferOk, null, null);\nassert (dtviewE.byteLength === 0);\nassert (dtviewE.byteOffset === 0);\n\nvar dtviewF = new DataView (arrayBufferOk, null, 1);\nassert (dtviewF.byteLength === 1);\nassert (dtviewF.byteOffset === 0);\n\nvar dtviewF = new DataView (arrayBufferOk, undefined, 1);\nassert(dtviewF.byteLength === 1);\nassert(dtviewF.byteOffset === 0);\n"
  },
  {
    "path": "tests/jerry/date-annexb.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar d = new Date(1999, 1, 1);\nassert (d.getYear() === 99);\nd = new Date(1874, 4, 9);\nassert (d.getYear() === -26);\nd = new Date(2015, 8, 17);\nassert (d.getYear() === 115);\nd = new Date(NaN);\nassert (isNaN (d.getYear()));\n\nvar d = new Date();\nd.setYear(91);\nassert (d.getFullYear() === 1991 && d.getYear() === 91);\n\nd = new Date();\nd.setYear(NaN);\nassert (isNaN(d.valueOf()));\n\nd = new Date();\nd.setYear(2015);\nassert (d.getFullYear() === 2015);\n\nd = new Date(2000, 1, 29);\nd.setYear(2004);\nassert (d.getFullYear() === 2004 && d.getMonth() === 1 && d.getDate() === 29);\nd.setYear(2015);\nassert (d.getFullYear() === 2015 && d.getMonth() === 2 && d.getDate() === 1);\n\nassert (/Thu, 17 Sep 2015 \\d{2}:\\d{2}:\\d{2} GMT/.test (new Date(\"2015-09-17\").toGMTString()));\n\nd = new Date(NaN);\nassert (d.toGMTString() === \"Invalid Date\");\n"
  },
  {
    "path": "tests/jerry/date-construct.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (Date.length == 7);\n\nvar d;\n\ntry\n{\n  d = new Date({toString: function() { throw new Error(\"foo\"); }});\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof Error);\n  assert (e.message === \"foo\");\n}\n\nd = new Date(\"abcd\");\nassert (isNaN(d.valueOf()));\n\nd = new Date();\nassert (!isNaN(d.valueOf()));\n\nd = new Date(\"2015-01-01\");\nassert (d.valueOf() == 1420070400000);\n\nd = new Date(1420070400000);\nassert (d.valueOf() == 1420070400000);\n\nd = new Date(2015,0,1,0,0,0,0);\nassert (d.valueOf() - (d.getTimezoneOffset() * 60000) == 1420070400000);\n\nd = new Date(8.64e+15);\nassert (d.valueOf() == 8.64e+15);\n\nd = new Date(8.64e+15 + 1);\nassert (isNaN(d.valueOf()));\n\nd = new Date(20000000, 0, 1);\nassert (isNaN(d.valueOf()));\n\nd = new Date(0, 20000000, 1);\nassert (isNaN(d.valueOf()));\n\nvar Obj = function (val)\n{\n  this.value = val;\n  this.valueOf = function () { throw new ReferenceError (\"valueOf-\" + this.value); };\n  this.toString = function () { throw new ReferenceError (\"toString-\"+ this.value); };\n};\n\ntry\n{\n  d = new Date (new Obj (1), new Obj (2));\n  // Should not be reached.\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof ReferenceError);\n  assert (e.message === \"valueOf-1\");\n}\n\nassert (typeof Date (2015) == \"string\");\nassert (typeof Date() != typeof (new Date ()));\n\nvar sym = Symbol();\nvar date;\n\ntry {\n  date = new Date(sym, 11, 17, 3, 24, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  date = new Date(1997, sym, 17, 3, 24, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  date = new Date(1997, 11, sym, 3, 24, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  date = new Date(1997, 11, 17, sym, 24, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  date = new Date(1997, 11, 17, 3, sym, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  date = new Date(1997, 11, 17, 3, 24, sym);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  date = new Date(1997, 11, 17, 3, 24, 0, sym);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/date-getters.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* 1. test case */\nvar d = new Date(2015, 6, 9, 12, 13, 14, 121);\n\nassert (d.getFullYear() == 2015);\nassert (d.getUTCFullYear() == 2015);\nassert (d.getMonth() == 6);\nassert (d.getUTCMonth() == 6);\nassert (d.getDate() == 9);\nassert (d.getUTCDate() == 9);\nassert (d.getDay() == 4);\nassert (d.getUTCDay() == 4);\nassert (d.getHours() == 12);\nassert (d.getUTCHours() == (12 + d.getTimezoneOffset() / 60));\nassert (d.getMinutes() == 13);\nassert (d.getUTCMinutes() == 13);\nassert (d.getSeconds() == 14);\nassert (d.getUTCSeconds() == 14);\nassert (d.getMilliseconds() == 121);\nassert (d.getUTCMilliseconds() == 121);\n\n/* 2. test case */\nvar d = new Date(\"2015-07-09T12:13:14.121+01:30\");\n\nassert (d.getFullYear() == 2015);\nassert (d.getUTCFullYear() == 2015);\nassert (d.getMonth() == 6);\nassert (d.getUTCMonth() == 6);\nassert (d.getDate() == 9);\nassert (d.getUTCDate() == 9);\nassert (d.getDay() == 4);\nassert (d.getUTCDay() == 4);\nassert (d.getHours() == Math.floor(12 - 1.5 - d.getTimezoneOffset() / 60));\nassert (d.getUTCHours() == Math.floor(12 - 1.5));\nassert (d.getMinutes() == 43);\nassert (d.getUTCMinutes() == 43);\nassert (d.getSeconds() == 14);\nassert (d.getUTCSeconds() == 14);\nassert (d.getMilliseconds() == 121);\nassert (d.getUTCMilliseconds() == 121);\n\n/* 3. test case */\nvar d = new Date(0);\n\nassert (d.getFullYear() == 1970);\nassert (d.getUTCFullYear() == 1970);\nassert (d.getMonth() == 0);\nassert (d.getUTCMonth() == 0);\nassert (d.getDate() == 1);\nassert (d.getUTCDate() == 1);\nassert (d.getDay() == 4);\nassert (d.getUTCDay() == 4);\nassert (d.getHours() == 0 - (d.getTimezoneOffset() / 60));\nassert (d.getUTCHours() == 0);\nassert (d.getMinutes() == 0);\nassert (d.getUTCMinutes() == 0);\nassert (d.getSeconds() == 0);\nassert (d.getUTCSeconds() == 0);\nassert (d.getMilliseconds() == 0);\nassert (d.getUTCMilliseconds() == 0);\n\n/* 4. test case */\nvar d = new Date(\"abcd\");\nassert (isNaN (d));\n\nassert (isNaN (d.getFullYear()));\nassert (isNaN (d.getUTCFullYear()));\nassert (isNaN (d.getMonth()));\nassert (isNaN (d.getUTCMonth()));\nassert (isNaN (d.getDate()));\nassert (isNaN (d.getUTCDate()));\nassert (isNaN (d.getDay()));\nassert (isNaN (d.getUTCDay()));\nassert (isNaN (d.getHours()));\nassert (isNaN (d.getUTCHours()));\nassert (isNaN (d.getMinutes()));\nassert (isNaN (d.getUTCMinutes()));\nassert (isNaN (d.getSeconds()));\nassert (isNaN (d.getUTCSeconds()));\nassert (isNaN (d.getMilliseconds()));\nassert (isNaN (d.getUTCMilliseconds()));\nassert (isNaN (d.getTimezoneOffset()));\n\n/* 5. test case */\nassert (new Date(2013, -1).getMonth() === 11);\nassert (new Date(-2, -2).getFullYear() === -3);\nassert (new Date(30888, 2).getFullYear() === 30888);\nassert (new Date(-1, -1).getFullYear() === -2);\nassert (new Date(-1, -1, -1).getMonth() === 10);\nassert (new Date(-1, -1, -1, -1).getDate() === 28);\nassert (new Date(-1, -1, -1, -1, -1).getHours() === 22);\nassert (new Date(-1, -1, -1, -1, -1, -1).getMinutes() === 58);\nassert (new Date(-1, -1, -1, -1, -1, -1, -1).getSeconds() === 58);\nassert (new Date(-1, -1, -1, -1, -1, -1, -1, -1).getMilliseconds() === 999);\n\n/* 6. test case */\nassert (isNaN(new Date(20000000, 0).getFullYear()));\nassert (new Date(0, 0).getFullYear() === 1900);\nassert (new Date(1.2, 0).getFullYear() === 1901);\n\n/* 7. test case */\n/* A Number can exactly represent all integers from -9,007,199,254,740,992 to 9,007,199,254,740,992 (21.1.2.8 and 21.1.2.6).\n   A time value supports a slightly smaller range of -8,640,000,000,000,000 to 8,640,000,000,000,000 milliseconds. */\nassert((new Date(8640000000000000).getFullYear()) == 275760);\nassert(isNaN(new Date(8640000000000001).getFullYear()));\nassert((new Date(-8640000000000000).getFullYear()) == -271821);\nassert(isNaN(new Date(-8640000000000001).getFullYear()));\n\n/* 8. test case */\nassert((new Date(-271821, 3, 21).getFullYear()) == -271821);\nassert(isNaN(new Date(1970, 0, -100000000).getFullYear())); \nassert(new Date(1970, 0, -100000000 + 1).getFullYear() == -271821);\nassert(isNaN(new Date(1970, 0, 100000000 + 2).getFullYear())); \nassert(new Date(1970, 0, 100000000).getFullYear() == 275760);\nassert(isNaN(new Date(4294967295, -51536298411).getFullYear()));\nassert((new Date(4294967295, -51536300000).getFullYear()) == 275628);\n"
  },
  {
    "path": "tests/jerry/date-parse.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar wrongFormats = [\"\",\n                    \"2\",\n                    \"20\",\n                    \"201\",\n                    \"2015-\",\n                    \"2015-01-\",\n                    \"2015-01-01-\",\n                    \"qwerty\",\n                    \"2015-01-01T\",\n                    \"2015-01-01T1:1\",\n                    \"2015-01-01T01\",\n                    \"2015-01-01T01\",\n                    \"2015-01-01T01:01F\",\n                    \"T2015\",\n                    \"2015-01-01Z\",\n                    \"2015-01-01+01:00\",\n                    \"2015-01-01T00:00+01\",\n                    \"2015-01-01T00:00+1\",\n                    \"2015-01-01T00:00-01\",\n                    \"2015-01-01T00:00.000\",\n                    \"2015-01-01T00:00:\",\n                    \"2015-01-01T00:\",\n                    \"2015-01-01T00:00:00.1\",\n                    \"2015-01-01T00:00:00.01\",\n                    \"2015-01-01T24:01:00.000\",\n                    \"2015-01-01T24:00:01.000\",\n                    \"2015-01-01T24:00:00.001\",\n                    \"2015-01-01T00:00+01:00Z\",\n                    \"2015/01-01\",\n                    \"2015-01-32\",\n                    \"2015--1\",\n                    \"2015-13\",\n                    \"2015-01--1\",\n                    \"-215\",\n                    \"-215-01-01\",\n                    \"2015-01-00\",\n                    \"2015-01-01T25:00\",\n                    \"2015-01-01T00:60\",\n                    \"2015-01-01T-1:00\",\n                    \"2015-01-01T00:-1\",\n                    \"2e+3\",\n                    \"+2015-01-01\",\n                    \"-2015-01-01\",\n                    \"+02015-01-01\",\n                    \"-02015-01-01\",\n                    \"002015-01-01\",\n                    \"+0002015-01-01\",\n                    \"-0002015-01-01\",\n                    \"2015-01T00:00:00.000-03X00\",\n                    \"2015-01T00:00:00.000-02-02\",\n                    \"2015-01-01T00-03:00\",\n                    \"Fri Jan 01 1 00:00:00 GMT+0000\",\n                    \"Fri Jan 01 11 00:00:00 GMT+0000\",\n                    \"Fri Jan 01 111 00:00:00 GMT+0000\",\n                    \"Fri Jan 01 1234567 00:00:00 GMT+0000\",\n                    \"Fri Jan 01 +1000 00:00:00 GMT+0000\",\n                    \"Fri Jan 01 -1 00:00:00 GMT+0000\",\n                    \"Fri Jan 01 -11 00:00:00 GMT+0000\",\n                    \"Fri Jan 01 -111 00:00:00 GMT+0000\",\n                    \"Fri Jan 01 -1234567 00:00:00 GMT+0000\",\n                    \"Thu Apr 10 1997\"];\n\nfor (i in wrongFormats) {\n  var d = Date.parse(wrongFormats[i]);\n  assert (isNaN(d));\n}\n\nvar d;\n\nd = Date.parse(undefined);\nassert (isNaN(d));\n\nd = Date.parse({});\nassert (isNaN(d));\n\nd = Date.parse(2000 + 15);\nassert (d == 1420070400000);\n\nd = Date.parse(\"2015\");\nassert (d == 1420070400000);\n\nd = Date.parse(\"2015-01\");\nassert (d == 1420070400000);\n\nd = Date.parse(\"2015-01-01\");\nassert (d == 1420070400000);\n\nvar timezoneOffsetMS = new Date(0).getTimezoneOffset() * 60000;\n\nd = Date.parse(\"2015-01T00:00\");\nassert (d == 1420070400000 + timezoneOffsetMS);\n\nd = Date.parse(\"2015-01T00:00:00\");\nassert (d == 1420070400000 + timezoneOffsetMS);\n\nd = Date.parse(\"2015-01T00:00:00.000\");\nassert (d == 1420070400000 + timezoneOffsetMS);\n\nd = Date.parse(\"2015-01T24:00:00.000\");\nassert (d == 1420156800000 + timezoneOffsetMS);\n\nd = Date.parse(\"2015-01T00:00:00.000+03:00\");\nassert (d == 1420059600000);\n\nd = Date.parse(\"2015-01T00:00:00.000-03:00\");\nassert (d == 1420081200000);\n\nd = Date.parse(\"2015-07-03T14:35:43.123+01:30\");\nassert (d == 1435928743123);\n\nassert (isNaN(Date.parse(\"-271821-04-19T23:59:59.999Z\"))) // -8640000000000001 - out of range\nassert (Date.parse(\"-271821-04-20T00:00:00.000Z\") == -8640000000000000)\nassert (Date.parse(\"-000001-12-31T23:59:59.999Z\") == -62167219200001)\nassert (Date.parse(\"0000-01-01T00:00:00.000Z\") == -62167219200000)\nassert (Date.parse(\"0009-12-31T23:59:59.999Z\") == -61851600000001)\nassert (Date.parse(\"0010-01-01T00:00:00.000Z\") == -61851600000000)\nassert (Date.parse(\"0099-12-31T23:59:59.999Z\") == -59011459200001)\nassert (Date.parse(\"0100-01-01T00:00:00.000Z\") == -59011459200000)\nassert (Date.parse(\"0999-12-31T23:59:59.999Z\") == -30610224000001)\nassert (Date.parse(\"1000-01-01T00:00:00.000Z\") == -30610224000000)\nassert (Date.parse(\"1969-12-31T23:59:59.999Z\") == -1)\nassert (Date.parse(\"1970-01-01T00:00:00.000Z\") == 0)\nassert (Date.parse(\"1970-01-01T00:00:00.001Z\") == 1)\nassert (Date.parse(\"9999-12-31T23:59:59.999Z\") == 253402300799999)\nassert (Date.parse(\"+010000-01-01T00:00:00.000Z\") == 253402300800000)\nassert (Date.parse(\"+275760-09-13T00:00:00.000Z\") == 8640000000000000)\nassert (isNaN(Date.parse(\"+275760-09-13T00:00:00.001Z\"))) // 8640000000000001 - out of range\n\n// Date.toString() format\nassert (isNaN(Date.parse(\"Mon Apr 19 -271821 23:59:59 GMT+0000\"))) // -8640000000001000 - out of range\nassert (Date.parse(\"Tue Apr 20 -271821 00:00:00 GMT+0000\") == -8640000000000000)\nassert (Date.parse(\"Fri Dec 31 -0001 23:59:59 GMT+0000\") == -62167219201000)\nassert (Date.parse(\"Sat Jan 01 0000 00:00:00 GMT+0000\") == -62167219200000)\nassert (Date.parse(\"Thu Dec 31 0009 23:59:59 GMT+0000\") == -61851600001000)\nassert (Date.parse(\"Fri Jan 01 0010 00:00:00 GMT+0000\") == -61851600000000)\nassert (Date.parse(\"Thu Dec 31 0099 23:59:59 GMT+0000\") == -59011459201000)\nassert (Date.parse(\"Fri Jan 01 0100 00:00:00 GMT+0000\") == -59011459200000)\nassert (Date.parse(\"Tue Dec 31 0999 23:59:59 GMT+0000\") == -30610224001000)\nassert (Date.parse(\"Wed Jan 01 1000 00:00:00 GMT+0000\") == -30610224000000)\nassert (Date.parse(\"Wed Dec 31 1969 23:59:59 GMT+0000\") == -1000)\nassert (Date.parse(\"Thu Jan 01 1970 00:00:00 GMT+0000\") == 0)\nassert (Date.parse(\"Thu Jan 01 1970 00:00:01 GMT+0000\") == 1000)\nassert (Date.parse(\"Fri Dec 31 9999 23:59:59 GMT+0000\") == 253402300799000)\nassert (Date.parse(\"Sat Jan 01 10000 00:00:00 GMT+0000\") == 253402300800000)\nassert (Date.parse(\"Sat Sep 13 275760 00:00:00 GMT+0000\") == 8640000000000000)\nassert (isNaN(Date.parse(\"Sat Sep 13 275760 00:00:01 GMT+0000\"))) // 8640000000001000 - out of range\n\n// Date.toUTCString() format\nassert (isNaN(Date.parse(\"Mon, 19 Apr -271821 23:59:59 GMT\"))) // -8640000000001000 - out of range\nassert (Date.parse(\"Tue, 20 Apr -271821 00:00:00 GMT\") == -8640000000000000)\nassert (Date.parse(\"Fri, 31 Dec -0001 23:59:59 GMT\") == -62167219201000)\nassert (Date.parse(\"Sat, 01 Jan 0000 00:00:00 GMT\") == -62167219200000)\nassert (Date.parse(\"Thu, 31 Dec 0009 23:59:59 GMT\") == -61851600001000)\nassert (Date.parse(\"Fri, 01 Jan 0010 00:00:00 GMT\") == -61851600000000)\nassert (Date.parse(\"Thu, 31 Dec 0099 23:59:59 GMT\") == -59011459201000)\nassert (Date.parse(\"Fri, 01 Jan 0100 00:00:00 GMT\") == -59011459200000)\nassert (Date.parse(\"Tue, 31 Dec 0999 23:59:59 GMT\") == -30610224001000)\nassert (Date.parse(\"Wed, 01 Jan 1000 00:00:00 GMT\") == -30610224000000)\nassert (Date.parse(\"Wed, 31 Dec 1969 23:59:59 GMT\") == -1000)\nassert (Date.parse(\"Thu, 01 Jan 1970 00:00:00 GMT\") == 0)\nassert (Date.parse(\"Thu, 01 Jan 1970 00:00:01 GMT\") == 1000)\nassert (Date.parse(\"Fri, 31 Dec 9999 23:59:59 GMT\") == 253402300799000)\nassert (Date.parse(\"Sat, 01 Jan 10000 00:00:00 GMT\") == 253402300800000)\nassert (Date.parse(\"Sat, 13 Sep 275760 00:00:00 GMT\") == 8640000000000000)\nassert (isNaN(Date.parse(\"Sat, 13 Sep 275760 00:00:01 GMT\"))) // 8640000000001000 - out of range\n\n// Non standard date formats\nassert (Date.parse(\"2000/01/01 12:12Z\") == 946728720000)\nassert (Date.parse(\"1991-07-13 16:04Z\") == 679421040000)\n\nassert(Date.parse('Tue, 13 Sep 275760 00:00:00 GMT') == 8640000000000000);\nassert(isNaN(Date.parse('Tue, 14 Sep 275760 00:00:00 GMT')));\nassert(Date.parse(\"Tue, 20 Apr -271821 00:00:00 GMT\") == -8640000000000000);\nassert(isNaN(Date.parse(\"Tue, 19 Apr -271821 00:00:00 GMT\")));\nassert(Date.parse('9999') == 253370764800000);\nassert(isNaN(Date.parse('10000')));\nassert(Date.parse('-100000') == -3217862419200000);\nassert(isNaN(Date.parse('-99999')));\n"
  },
  {
    "path": "tests/jerry/date-prototype-toprimitive.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar dateObj = new Date(\"1997-04-10\");\nvar dateNaN = new Date(NaN);\n\n// Test with default hint\nvar result = dateObj[Symbol.toPrimitive](\"default\");\nassert(result.toString().substring(0,15) === \"Thu Apr 10 1997\");\nresult = dateNaN[Symbol.toPrimitive](\"default\");\nassert(dateNaN == \"Invalid Date\");\n\n// Test with number hint\nresult = dateObj[Symbol.toPrimitive](\"number\");\nassert(result.toString() === \"860630400000\");\nresult = dateNaN[Symbol.toPrimitive](\"number\");\nassert(isNaN(result) === true);\n\n// Test with string hint\nresult = dateObj[Symbol.toPrimitive](\"string\");\nassert(result.toString().substring(0,15) === \"Thu Apr 10 1997\");\nresult = dateNaN[Symbol.toPrimitive](\"string\");\nassert(result == \"Invalid Date\");\n\n// Test with invalid hint\ntry {\n  result = dateObj[Symbol.toPrimitive](90);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Test with invalid hint value\ntry {\n  dateObj[Symbol.toPrimitive]('error');\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Test when unable to call toPrimitive\ntry {\n  Date.prototype[Symbol.toPrimitive].call(undefined);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/date-setters.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar ms = 1;\nvar sec = 1000 * ms;\nvar min = 60 * sec;\nvar hour = 60 * min;\nvar day = 24 * hour; /* 86400000 */\nvar d = new Date();\n\n/* 15.9.5.27 Date.prototype.setTime (time) */\nassert (d.setTime(0) == 0);\nd.setTime(0);\nassert (d.setTime(day) == day);\nassert (d.getDate() == 2);\n\n/* 15.9.5.28 Date.prototype.setMilliseconds (ms) */\nd.setTime(0);\nassert (d.setMilliseconds(1) == ms);\nassert (d.getMilliseconds() == 1);\n\n/* 15.9.5.29 Date.prototype.setUTCMilliseconds (ms) */\nd.setTime(0);\nassert (d.setUTCMilliseconds(1) == ms);\nassert (d.getUTCMilliseconds() == 1);\n\n/* 15.9.5.30 Date.prototype.setSeconds (sec [, ms ] ) */\nd.setTime(0);\nassert (d.setSeconds(1) == sec);\nassert (d.getSeconds() == 1);\nd.setTime(0);\nassert (d.setSeconds(1, 1) == sec + ms);\nassert (d.getSeconds() == 1);\nassert (d.getMilliseconds() == 1);\n\n/* 15.9.5.31 Date.prototype.setUTCSeconds (sec [, ms ] ) */\nd.setTime(0);\nassert (d.setUTCSeconds(1) == sec);\nassert (d.getUTCSeconds() == 1);\nd.setTime(0);\nassert (d.setUTCSeconds(1, 1) == sec + ms);\nassert (d.getUTCSeconds() == 1);\nassert (d.getUTCMilliseconds() == 1);\n\n/* 15.9.5.32 Date.prototype.setMinutes (min [, sec [, ms ] ] ) */\nd.setTime(0);\nassert (d.setMinutes(1) == min);\nassert (d.getMinutes() == 1);\nd.setTime(0);\nassert (d.setMinutes(1, 1) == min + sec);\nassert (d.getMinutes() == 1);\nassert (d.getSeconds() == 1);\nd.setTime(0);\nassert (d.setMinutes(1, 1, 1) == min + sec + ms);\nassert (d.getMinutes() == 1);\nassert (d.getSeconds() == 1);\nassert (d.getMilliseconds() == 1);\n\n/* 15.9.5.33 Date.prototype.setUTCMinutes (min [, sec [, ms ] ] ) */\nd.setTime(0);\nassert (d.setUTCMinutes(1) == min);\nassert (d.getUTCMinutes() == 1);\nd.setTime(0);\nassert (d.setUTCMinutes(1, 1) == min + sec);\nassert (d.getUTCMinutes() == 1);\nassert (d.getUTCSeconds() == 1);\nd.setTime(0);\nassert (d.setUTCMinutes(1, 1, 1) == min + sec + ms);\nassert (d.getUTCMinutes() == 1);\nassert (d.getUTCSeconds() == 1);\nassert (d.getUTCMilliseconds() == 1);\n\n/* 15.9.5.34 Date.prototype.setHours (hour [, min [, sec [, ms ] ] ] ) */\nd.setTime(0);\nassert (d.setHours(1) == hour + d.getTimezoneOffset() * 60000);\nassert (d.getHours() == 1);\nd.setTime(0);\nassert (d.setHours(1, 1) == hour + min + d.getTimezoneOffset() * 60000);\nassert (d.getHours() == 1);\nassert (d.getMinutes() == 1);\nd.setTime(0);\nassert (d.setHours(1, 1, 1) == hour + min + sec + d.getTimezoneOffset() * 60000);\nassert (d.getHours() == 1);\nassert (d.getMinutes() == 1);\nassert (d.getSeconds() == 1);\nd.setTime(0);\nassert (d.setHours(1, 1, 1, 1) == hour + min + sec + ms + d.getTimezoneOffset() * 60000);\nassert (d.getHours() == 1);\nassert (d.getMinutes() == 1);\nassert (d.getSeconds() == 1);\nassert (d.getMilliseconds() == 1);\n\n/* 15.9.5.35 Date.prototype.setUTCHours (hour [, min [, sec [, ms ] ] ] ) */\nd.setTime(0);\nassert (d.setUTCHours(1) == hour);\nassert (d.getUTCHours() == 1);\nd.setTime(0);\nassert (d.setUTCHours(1, 1) == hour + min);\nassert (d.getUTCHours() == 1);\nassert (d.getUTCMinutes() == 1);\nd.setTime(0);\nassert (d.setUTCHours(1, 1, 1) == hour + min + sec);\nassert (d.getUTCHours() == 1);\nassert (d.getUTCMinutes() == 1);\nassert (d.getUTCSeconds() == 1);\nd.setTime(0);\nassert (d.setUTCHours(1, 1, 1, 1) == hour + min + sec + ms);\nassert (d.getUTCHours() == 1);\nassert (d.getUTCMinutes() == 1);\nassert (d.getUTCSeconds() == 1);\nassert (d.getUTCMilliseconds() == 1);\n\n/* 15.9.5.36 Date.prototype.setDate (date) */\nd.setTime(0);\nassert (d.setDate(0) == -day);\nassert (d.getDate() == 31);\nd.setTime(0);\nassert (d.setDate(1) == 0);\nassert (d.getDate() == 1);\n\n/* 15.9.5.37 Date.prototype.setUTCDate (date) */\nd.setTime(0);\nassert (d.setUTCDate(0) == -day);\nassert (d.getUTCDate() == 31);\nd.setTime(0);\nassert (d.setUTCDate(1) == 0);\nassert (d.getUTCDate() == 1);\n\n/* 15.9.5.38 Date.prototype.setMonth (month [, date ] ) */\nd.setTime(0);\nassert (d.setMonth(0) == 0);\nassert (d.getMonth() == 0);\nd.setTime(0);\nassert (d.setMonth(0, 0) == -day);\nassert (d.getMonth() == 11);\nassert (d.getDate() == 31);\nd.setTime(0);\nassert (d.setMonth(1) == 31 * day);\nassert (d.getMonth() == 1);\nd.setTime(0);\nassert (d.setMonth(12) == 365 * day);\nassert (d.getMonth() == 0);\nd.setTime(0);\nassert (d.setMonth(13) == (365 + 31) * day);\nassert (d.getMonth() == 1);\n\n/* 15.9.5.39 Date.prototype.setUTCMonth (month [, date ] ) */\nd.setTime(0);\nassert (d.setUTCMonth(0) == 0);\nassert (d.getUTCMonth() == 0);\nd.setTime(0);\nassert (d.setUTCMonth(0, 0) == -day);\nassert (d.getUTCMonth() == 11);\nassert (d.getUTCDate() == 31);\nd.setTime(0);\nassert (d.setUTCMonth(1) == 31 * day);\nassert (d.getUTCMonth() == 1);\nd.setTime(0);\nassert (d.setUTCMonth(12) == 365 * day);\nassert (d.getUTCMonth() == 0);\nd.setTime(0);\nassert (d.setUTCMonth(13) == (365 + 31) * day);\nassert (d.getUTCMonth() == 1);\n\n/* 15.9.5.40 Date.prototype.setFullYear (year [, month [, date ] ] ) */\nd.setTime(0);\nassert (d.setFullYear(0) == -62167219200000);\nassert (d.getFullYear() == 0);\nd.setTime(0);\nassert (d.setFullYear(0, 0) == -62167219200000);\nassert (d.getFullYear() == 0);\nassert (d.getMonth() == 0);\nd.setTime(0);\nassert (d.setFullYear(0, 0, 0) == -62167219200000 - day);\nassert (d.getFullYear() == -1);\nassert (d.getMonth() == 11);\nassert (d.getDate() == 31);\nd.setTime(0);\nassert (d.setFullYear(1970) == 0);\nassert (d.getFullYear() == 1970);\n\n/* 15.9.5.41 Date.prototype.setUTCFullYear (year [, month [, date ] ] ) */\nd.setTime(0);\nassert (d.setUTCFullYear(0) == -62167219200000);\nassert (d.getUTCFullYear() == 0);\nd.setTime(0);\nassert (d.setUTCFullYear(0, 0) == -62167219200000);\nassert (d.getUTCFullYear() == 0);\nassert (d.getUTCMonth() == 0);\nd.setTime(0);\nassert (d.setUTCFullYear(0, 0, 0) == -62167219200000 - day);\nassert (d.getUTCFullYear() == -1);\nassert (d.getUTCMonth() == 11);\nassert (d.getUTCDate() == 31);\nd.setTime(0);\nassert (d.setUTCFullYear(1970) == 0);\nassert (d.getUTCFullYear() == 1970);\n\n/* ECMA262 v11 20.4.1.2 Day Number and Time within Day\n   msPerDay = 86400000\n   TimeWithinDay(t) = t modulo msPerDay\n\n   ECMA262 v11 5.2.5 Mathematical Operations\n   The notation “x modulo y” (y must be finite and nonzero) computes a value k of the same sign as y (or zero).\n\n   Consequently TimeWithinDay(t) >= 0. It can be tested properly with dates close to 1970.\n*/\nd = new Date(\"1969-12-01T01:00:00.000Z\");\nd.setFullYear(1968);\nassert (d.toISOString() == \"1968-12-01T01:00:00.000Z\");\n\nd = new Date(\"1970-01-31T01:00:00.000Z\");\nd.setFullYear(1971);\nassert (d.toISOString() == \"1971-01-31T01:00:00.000Z\");\n\n/* Without argument */\nd = new Date();\nassert (isNaN (d.setTime()));\nassert (isNaN (d.setMilliseconds()));\nassert (isNaN (d.setUTCMilliseconds()));\nassert (isNaN (d.setSeconds()));\nassert (isNaN (d.setUTCSeconds()));\nassert (isNaN (d.setMinutes()));\nassert (isNaN (d.setUTCMinutes()));\nassert (isNaN (d.setHours()));\nassert (isNaN (d.setUTCHours()));\nassert (isNaN (d.setDate()));\nassert (isNaN (d.getUTCDate()));\nassert (isNaN (d.setMonth()));\nassert (isNaN (d.setUTCMonth()));\nassert (isNaN (d.setFullYear()));\nassert (isNaN (d.setUTCFullYear()));\n\nvar date = new Date('1975-08-19');\nvar date2 = new Date('1975-08-19');\nvar date3 = new Date('1975-08-19');\nvar date4 = new Date('1975-08-19');\nvar date5 = new Date('1975-08-19');\nvar date6 = new Date('1975-08-19');\ndate.setFullYear(275760, 8, 13);\ndate2.setFullYear(275760, 8, 14);\ndate3.setFullYear(-271820, 6570968, 13);\ndate4.setFullYear(-271820, 6570968, 14);\ndate5.setFullYear(-271821);\ndate6.setFullYear(-271822);\nassert(date.getFullYear() == 275760);\nassert(isNaN(date2.getFullYear()));\nassert(date3.getFullYear() == 275760);\nassert(isNaN(date4.getFullYear()));\nassert(date5.getFullYear() == -271821);\nassert(isNaN(date6.getFullYear()));\n"
  },
  {
    "path": "tests/jerry/date-toisostring.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    d = new Date (-8640000000000001)\n    assert (d == \"Invalid Date\")\n    d.toISOString()\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError)\n}\n\nassert (new Date (-8640000000000000).toISOString() == \"-271821-04-20T00:00:00.000Z\")\n\nassert (new Date(-62167219200001).toISOString() == \"-000001-12-31T23:59:59.999Z\")\nassert (new Date(-62167219200000).toISOString() == \"0000-01-01T00:00:00.000Z\")\n\nassert (new Date(-61851600000001).toISOString() == \"0009-12-31T23:59:59.999Z\")\nassert (new Date(-61851600000000).toISOString() == \"0010-01-01T00:00:00.000Z\")\n\nassert (new Date(-59011459200001).toISOString() == \"0099-12-31T23:59:59.999Z\")\nassert (new Date(-59011459200000).toISOString() == \"0100-01-01T00:00:00.000Z\")\n\nassert (new Date(-30610224000001).toISOString() == \"0999-12-31T23:59:59.999Z\")\nassert (new Date(-30610224000000).toISOString() == \"1000-01-01T00:00:00.000Z\")\n\nassert (new Date(-1).toISOString() == \"1969-12-31T23:59:59.999Z\")\nassert (new Date(0).toISOString() == \"1970-01-01T00:00:00.000Z\")\nassert (new Date(1).toISOString() == \"1970-01-01T00:00:00.001Z\")\n\nassert (new Date(253402300799999).toISOString() == \"9999-12-31T23:59:59.999Z\")\nassert (new Date(253402300800000).toISOString() == \"+010000-01-01T00:00:00.000Z\")\n\nassert (new Date (8640000000000000).toISOString() == \"+275760-09-13T00:00:00.000Z\")\n\ntry {\n    d = new Date (8640000000000001)\n    assert (d == \"Invalid Date\")\n    d.toISOString()\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError)\n}\n"
  },
  {
    "path": "tests/jerry/date-tojson.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {\n    toISOString: function() { return \"RESULT-ToISOString\"; },\n    valueOf: function() { return \"RESULT-valueOf\"; }\n};\n\nvar result = Date.prototype.toJSON.call(obj);\n\nassert(result === \"RESULT-ToISOString\");\n"
  },
  {
    "path": "tests/jerry/date-tostring.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (new Date (NaN) == \"Invalid Date\");\nassert (new Date (Infinity, 1, 1, 0, 0, 0) == \"Invalid Date\");\nassert (new Date (2015, Infinity, 1, 0, 0, 0) == \"Invalid Date\");\nassert (new Date (2015, 7, 1, 0, Infinity, 0) == \"Invalid Date\");\nassert (new Date (NaN, 1, 1, 0, 0, 0) == \"Invalid Date\");\nassert (new Date (2015, NaN, 1, 0, 0, 0) == \"Invalid Date\");\nassert (new Date (2015, 7, 1, 0, NaN, 0) == \"Invalid Date\");\nassert (/Fri Feb 13 2015 \\d{2}:\\d{2}:\\d{2} GMT\\+\\d{2}\\d{2}/.test (new Date (\"2015-02-13\")));\nassert (/Wed Jul 08 2015 \\d{2}:\\d{2}:\\d{2} GMT\\+\\d{2}\\d{2}/.test (new Date (\"2015-07-08T11:29:05.023\")));\n\ntry\n{\n  Date.prototype.toString.call(-1);\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nvar date = new Date(0);\nassert (/Thu Jan 01 1970 \\d{2}:\\d{2}:\\d{2} GMT\\+\\d{2}\\d{2}/.test (date.toString()));\nassert (date.toUTCString() === \"Thu, 01 Jan 1970 00:00:00 GMT\");\nassert (date.toISOString() === \"1970-01-01T00:00:00.000Z\");\n\ndate = new Date(\"2015-08-12T09:40:20.000Z\")\nassert (/Wed Aug 12 2015 \\d{2}:\\d{2}:\\d{2} GMT\\+\\d{2}\\d{2}/.test (date.toString()));\nassert (date.toUTCString() === \"Wed, 12 Aug 2015 09:40:20 GMT\");\nassert (date.toISOString() === \"2015-08-12T09:40:20.000Z\");\n\nassert (new Date (NaN).toDateString () == \"Invalid Date\");\nassert (new Date (\"2015-02-13\").toDateString () == \"Fri Feb 13 2015\");\nassert (new Date (\"2015-07-08T11:29:05.023\").toDateString () == \"Wed Jul 08 2015\");\n\ntry\n{\n  Date.prototype.toDateString.call(-1);\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nassert (new Date (NaN).toTimeString () == \"Invalid Date\");\nassert (new Date (Number.POSITIVE_INFINITY).toString () === \"Invalid Date\");\nassert (new Date (\"2015-02-13\").toGMTString () == \"Fri, 13 Feb 2015 00:00:00 GMT\");\nassert (new Date (\"2015-07-08T11:29:05.023+01:00\").toGMTString () == \"Wed, 08 Jul 2015 10:29:05 GMT\");\nassert (new Date (\"2015-07-08T11:29:05.023+10:00\").toGMTString () == \"Wed, 08 Jul 2015 01:29:05 GMT\");\n\ntry\n{\n  Date.prototype.toTimeString.call(-1);\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nassert (new Date (\"2015-07-16\").toISOString () == \"2015-07-16T00:00:00.000Z\");\nassert (new Date (\"2015-07-16T11:29:05.023+00:00\").toISOString () == \"2015-07-16T11:29:05.023Z\");\n\ntry\n{\n  new Date (NaN).toISOString ();\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof RangeError);\n}\n\ntry\n{\n  new Date (Number.POSITIVE_INFINITY).toISOString ();\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof RangeError);\n}\n\ntry\n{\n  Date.prototype.toISOString.call(-1);\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nassert (new Date (NaN).toUTCString () == \"Invalid Date\");\nassert (new Date (\"2015-07-16\").toUTCString () == \"Thu, 16 Jul 2015 00:00:00 GMT\");\nassert (new Date (\"2015-07-16T11:29:05.023+00:00\").toUTCString () == \"Thu, 16 Jul 2015 11:29:05 GMT\");\n\ntry\n{\n  Date.prototype.toUTCString.call(-1);\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nassert (new Date (NaN).toJSON () == null);\nassert (new Date (\"2015-07-16\").toJSON () == \"2015-07-16T00:00:00.000Z\");\nassert (new Date (\"2015-07-16T11:29:05.023+00:00\").toJSON () == \"2015-07-16T11:29:05.023Z\");\n\ntry\n{\n  Date.prototype.toJSON.call(-1);\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\ndate_time = new Date (\"2015-07-08T11:29:05.023+00:00\").toJSON ();\nassert (new Date (date_time).toISOString () == \"2015-07-08T11:29:05.023Z\");\n\nassert (typeof Date (2015) == \"string\");\nassert (typeof Date() != typeof (new Date ()));\nassert (Date () == (new Date ()).toString ());\nassert (Date (2015, 1, 1) == (new Date ()).toString ());\nassert (Date (Number.NaN) == Date ());\n\nassert (new Date (\"2015-07-08T11:29:05.023Z\").toISOString() == \"2015-07-08T11:29:05.023Z\");\n\n// corner cases\nassert (new Date (-8640000000000001).toString() == \"Invalid Date\")\nassert (new Date (-8640000000000000).toGMTString() == \"Tue, 20 Apr -271821 00:00:00 GMT\")\n\nassert (new Date(-62167219200001).toGMTString() == \"Fri, 31 Dec -0001 23:59:59 GMT\")\nassert (new Date(-62167219200000).toGMTString() == \"Sat, 01 Jan 0000 00:00:00 GMT\")\n\nassert (new Date(-61851600000001).toGMTString() == \"Thu, 31 Dec 0009 23:59:59 GMT\")\nassert (new Date(-61851600000000).toGMTString() == \"Fri, 01 Jan 0010 00:00:00 GMT\")\n\nassert (new Date(-59011459200001).toGMTString() == \"Thu, 31 Dec 0099 23:59:59 GMT\")\nassert (new Date(-59011459200000).toGMTString() == \"Fri, 01 Jan 0100 00:00:00 GMT\")\n\nassert (new Date(-30610224000001).toGMTString() == \"Tue, 31 Dec 0999 23:59:59 GMT\")\nassert (new Date(-30610224000000).toGMTString() == \"Wed, 01 Jan 1000 00:00:00 GMT\")\n\nassert (new Date(-1).toGMTString() == \"Wed, 31 Dec 1969 23:59:59 GMT\")\nassert (new Date(0).toGMTString() == \"Thu, 01 Jan 1970 00:00:00 GMT\")\nassert (new Date(1).toGMTString() == \"Thu, 01 Jan 1970 00:00:00 GMT\")\n\nassert (new Date(253402300799999).toGMTString() == \"Fri, 31 Dec 9999 23:59:59 GMT\")\nassert (new Date(253402300800000).toGMTString() == \"Sat, 01 Jan 10000 00:00:00 GMT\")\n\nassert (new Date (8640000000000000).toGMTString() == \"Sat, 13 Sep 275760 00:00:00 GMT\")\nassert (new Date (8640000000000001).toGMTString() == \"Invalid Date\")\n"
  },
  {
    "path": "tests/jerry/date-utc.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar d;\n\nd = Date.UTC(undefined);\nassert (isNaN(d));\n\nd = Date.UTC({});\nassert (isNaN(d));\n\nd = Date.UTC(2000 + 15, 0);\nassert (d == 1420070400000);\n\nd = Date.UTC(2015, 0);\nassert (d == 1420070400000);\n\nd = Date.UTC(2015, 0, 1);\nassert (d == 1420070400000);\n\nd = Date.UTC(2015, 0, 1, 0);\nassert (d == 1420070400000);\n\nd = Date.UTC(2015, 0, 1, 0, 0);\nassert (d == 1420070400000);\n\nd = Date.UTC(2015, 0, 1, 0, 0, 0);\nassert (d == 1420070400000);\n\nd = Date.UTC(2015, 0, 1, 0, 0, 0, 0);\nassert (d == 1420070400000);\n\nd = Date.UTC(2015, 6, 3, 14, 35, 43, 123);\nassert (d == 1435934143123);\n"
  },
  {
    "path": "tests/jerry/decimal-with-leading-zero.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// valid decimal with leading zero\nassert (01239 === 1239)\nassert (0999 === 999)\nassert (0000000000009 === 9)\n\nfunction invalid_strict_cases (string)\n{\n  \"use strict\"\n  try {\n    eval (string)\n    assert (false)\n  } catch (e) {\n    assert (true)\n  }\n}\n\n// invalid strict test-cases\ninvalid_strict_cases (\"09\")\ninvalid_strict_cases (\"01239\")\n\n// invalid to create bigint with decimal with leading zero\nfunction invalid_cases (string)\n{\n  try {\n    eval (string)\n    assert (false)\n  } catch (e) {\n    assert (true)\n  }\n}\n\ninvalid_cases (\"09n\")\ninvalid_cases (\"01239n\")\n"
  },
  {
    "path": "tests/jerry/delete.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* argument is not reference */\nassert (delete 0 === true);\nassert (delete \"0\" === true);\nassert (delete (a = 1) === true);\nassert (delete delete a === true);\n\n/* argument is unresolvable reference */\nassert (delete undefined_variable === true);\n\n/* argument is object-based reference */\nvar a = [1];\nassert (a[0] === 1);\nassert (delete a[0] === true);\nassert (a[0] == undefined);\n\nvar b = {c:0};\nassert (b.c === 0);\nassert (delete b.c === true);\nassert (b.c === undefined);\n\n/* argument is lexical environment-based reference */\nvar a = 1;\nassert (a === 1);\nassert (delete a === false);\nassert (a === 1);\n"
  },
  {
    "path": "tests/jerry/directive.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (code)\n{\n  try {\n    eval (code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\neval(\"function f(a, b = 4) { }\")\ncheck_syntax_error (\"function f(a, b = 4) { 'use strict' }\")\n\neval('function f(...a) { }')\ncheck_syntax_error ('function f(...a) { \"use strict\" }')\n\neval(\"({ f([a,b]) { } })\")\ncheck_syntax_error (\"({ f([a,b]) { 'use strict' } })\")\n\neval(\"function f(a, b = 4) { 'directive1'\\n'directive2'\\n }\")\ncheck_syntax_error (\"function f(a, b = 4) { 'directive1'\\n'directive2'\\n'use strict' }\")\n"
  },
  {
    "path": "tests/jerry/do-while.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = 0;\n\ndo a++\nwhile (false)\n\ndo { a++ } while (false)\n\ntry {\n  eval(\"do a++ while (false)\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/empty-varg.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = Object();"
  },
  {
    "path": "tests/jerry/equality.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert((5 == 5) == true);\nassert((7 != 2) == true);\n\nvar num = 0;\nvar obj = new String(\"0\");\nvar str = \"0\";\nvar b = false;\n\nassert(num === num);\nassert(obj === obj);\nassert(str === str);\n\nassert((num === obj) == false);\nassert((num === str) == false);\nassert((obj === str) == false);\nassert((null === undefined) == false);\nassert((obj === null) == false);\nassert((obj === undefined) == false);\n"
  },
  {
    "path": "tests/jerry/error-names.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar items = [\n  [TypeError, \"TypeError\"],\n  [SyntaxError, \"SyntaxError\"],\n  [URIError, \"URIError\"],\n  [EvalError, \"EvalError\"],\n  [RangeError, \"RangeError\"],\n  [ReferenceError, \"ReferenceError\"],\n];\n\nfor (var idx = 0; idx < items.length; idx++) {\n  var type = items[idx][0];\n  var expected_name = items[idx][1];\n  assert (type.name === expected_name);\n\n  assert ((new type).name === expected_name);\n}\n\nassert (AggregateError.name === \"AggregateError\");\nassert (new AggregateError([]).name === \"AggregateError\")\n\ntry\n{\n  new AggregateError.name === \"TypeError\";\n}\ncatch(e)\n{\n  assert (e instanceof TypeError)\n}\n"
  },
  {
    "path": "tests/jerry/error.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar e;\n\n/* Error */\ne = new Error ();\nassert (e.name === \"Error\");\nassert (e.message === \"\");\nassert (e.toString() === \"Error\");\n\ne = new Error(\"some message\");\nassert (e.name === \"Error\");\nassert (e.message === \"some message\");\nassert (e.toString() === \"Error: some message\");\n\ne.name = \"\";\nassert (e.toString() === \"some message\");\ne.message = \"\";\nassert (e.toString() === \"\");\n\nassert (Error.prototype.toString !== Object.prototype.toString);\nassert (Error.prototype.constructor === Error);\nassert (Error.prototype.name === \"Error\");\nassert (Error.prototype.message === \"\");\nassert (Error.prototype.toString() === \"Error\");\n\n/* TypeError */\ne = new TypeError ();\nassert (e.name === \"TypeError\");\nassert (e.message === \"\");\nassert (e.toString() === \"TypeError\");\n\ne = new TypeError(\"some message\");\nassert (e.name === \"TypeError\");\nassert (e.message === \"some message\");\nassert (e.toString() === \"TypeError: some message\");\n\ne.name = \"\";\nassert (e.toString() === \"some message\");\ne.message = \"\";\nassert (e.toString() === \"\");\n\nassert (TypeError.prototype.toString === Error.prototype.toString);\nassert (TypeError.prototype.constructor === TypeError);\nassert (TypeError.prototype.name === \"TypeError\");\nassert (TypeError.prototype.message === \"\");\nassert (TypeError.prototype.toString() === \"TypeError\");\n\ntry\n{\n  null[1] = 'abcd';\n\n  assert (false);\n}\ncatch (e)\n{\n  assert(e instanceof TypeError);\n  assert(e instanceof Error);\n  assert(e instanceof Object);\n\n  assert(!(e instanceof Function));\n}\n\n\n/* ReferenceError */\ne = new ReferenceError ();\nassert (e.name === \"ReferenceError\");\nassert (e.message === \"\");\nassert (e.toString() === \"ReferenceError\");\n\ne = new ReferenceError(\"some message\");\nassert (e.name === \"ReferenceError\");\nassert (e.message === \"some message\");\nassert (e.toString() === \"ReferenceError: some message\");\n\ne.name = \"\";\nassert (e.toString() === \"some message\");\ne.message = \"\";\nassert (e.toString() === \"\");\n\nassert (ReferenceError.prototype.toString === Error.prototype.toString);\nassert (ReferenceError.prototype.constructor === ReferenceError);\nassert (ReferenceError.prototype.name === \"ReferenceError\");\nassert (ReferenceError.prototype.message === \"\");\nassert (ReferenceError.prototype.toString() === \"ReferenceError\");\n\ntry\n{\n  var a = non_existing_variable;\n\n  assert (false);\n}\ncatch (e)\n{\n  assert(e instanceof ReferenceError);\n  assert(e instanceof Error);\n  assert(e instanceof Object);\n\n  assert(!(e instanceof Function));\n}\n\n/* EvalError */\ne = new EvalError ();\nassert (e.name === \"EvalError\");\nassert (e.message === \"\");\nassert (e.toString() === \"EvalError\");\n\ne = new EvalError(\"some message\");\nassert (e.name === \"EvalError\");\nassert (e.message === \"some message\");\nassert (e.toString() === \"EvalError: some message\");\n\ne.name = \"\";\nassert (e.toString() === \"some message\");\ne.message = \"\";\nassert (e.toString() === \"\");\n\nassert (EvalError.prototype.toString === Error.prototype.toString);\nassert (EvalError.prototype.constructor === EvalError);\nassert (EvalError.prototype.name === \"EvalError\");\nassert (EvalError.prototype.message === \"\");\nassert (EvalError.prototype.toString() === \"EvalError\");\n\n/* RangeError */\ne = new RangeError ();\nassert (e.name === \"RangeError\");\nassert (e.message === \"\");\nassert (e.toString() === \"RangeError\");\n\ne = new RangeError(\"some message\");\nassert (e.name === \"RangeError\");\nassert (e.message === \"some message\");\nassert (e.toString() === \"RangeError: some message\");\n\ne.name = \"\";\nassert (e.toString() === \"some message\");\ne.message = \"\";\nassert (e.toString() === \"\");\n\nassert (RangeError.prototype.toString === Error.prototype.toString);\nassert (RangeError.prototype.constructor === RangeError);\nassert (RangeError.prototype.name === \"RangeError\");\nassert (RangeError.prototype.message === \"\");\nassert (RangeError.prototype.toString() === \"RangeError\");\n\n/* SyntaxError */\ne = new SyntaxError ();\nassert (e.name === \"SyntaxError\");\nassert (e.message === \"\");\nassert (e.toString() === \"SyntaxError\");\n\ne = new SyntaxError(\"some message\");\nassert (e.name === \"SyntaxError\");\nassert (e.message === \"some message\");\nassert (e.toString() === \"SyntaxError: some message\");\n\ne.name = \"\";\nassert (e.toString() === \"some message\");\ne.message = \"\";\nassert (e.toString() === \"\");\n\nassert (SyntaxError.prototype.toString === Error.prototype.toString);\nassert (SyntaxError.prototype.constructor === SyntaxError);\nassert (SyntaxError.prototype.name === \"SyntaxError\");\nassert (SyntaxError.prototype.message === \"\");\nassert (SyntaxError.prototype.toString() === \"SyntaxError\");\n\n/* URIError */\ne = new URIError ();\nassert (e.name === \"URIError\");\nassert (e.message === \"\");\nassert (e.toString() === \"URIError\");\n\ne = new URIError(\"some message\");\nassert (e.name === \"URIError\");\nassert (e.message === \"some message\");\nassert (e.toString() === \"URIError: some message\");\n\ne.name = \"\";\nassert (e.toString() === \"some message\");\ne.message = \"\";\nassert (e.toString() === \"\");\n\nassert (URIError.prototype.toString === Error.prototype.toString);\nassert (URIError.prototype.constructor === URIError);\nassert (URIError.prototype.name === \"URIError\");\nassert (URIError.prototype.message === \"\");\nassert (URIError.prototype.toString() === \"URIError\");\n\n/* Prototype of NativeErrors should be Error */\nassert(Object.getPrototypeOf(EvalError) === Error);\nassert(Object.getPrototypeOf(RangeError) === Error);\nassert(Object.getPrototypeOf(ReferenceError) === Error);\nassert(Object.getPrototypeOf(SyntaxError) === Error);\nassert(Object.getPrototypeOf(TypeError) === Error);\nassert(Object.getPrototypeOf(URIError) === Error);\nassert(Object.getPrototypeOf(AggregateError) === Error);\n"
  },
  {
    "path": "tests/jerry/es.next/bigint-as-int-n.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(BigInt.asIntN('1', 1n) === -1n)\nassert(BigInt.asIntN(1.1, 1n) === -1n)\nassert(BigInt.asIntN(2, 2n**2n) === 0n)\nassert(BigInt.asIntN(undefined, 1n) === 0n)\n\nvar array = [1, 1n, -1n]\n\nassert(BigInt.asIntN(array[0], 1n) == -1n)\nassert(BigInt.asIntN(array[0], array[1]) == -1n)\nassert(BigInt.asIntN(array[0], array[2]) == -1n)\n\nfunction f(param1, param2) {\n  assert(BigInt.asIntN(param1, param2) === 0n)\n}\nf(0,10n)\nf(10,0n)\n\ntry {\n  assert(f(1, \"1n\") === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n\ntry {\n  assert(BigInt.asIntN(Number.POSITIVE_INFINITY, 1n) === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError)\n}\n\ntry {\n  assert(BigInt.asIntN(Number.NEGATIVE_INFINITY, 1n) === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError)\n}\n\ntry {\n  assert(BigInt.asIntN(1, Number.POSITIVE_INFINITY) === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\ntry {\n  assert(BigInt.asIntN(1, Number.NEGATIVE_INFINITY) === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\ntry {\n  assert(BigInt.asIntN(1, 1 + 1n) === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\ntry {\n  assert(BigInt.asIntN(2n, 2n**2n) === 0n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\ntry {\n  BigInt.asIntN().call(undefined,1n)\n  assert (false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  BigInt.asIntN().call(1,undefined)\n  assert (false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  BigInt.asIntN().call(undefined,undefined)\n  assert (false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  assert(BigInt.asIntN(Infinity, 2n) === RangeError)\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError)\n}\n"
  },
  {
    "path": "tests/jerry/es.next/bigint-as-uint-n.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(BigInt.asUintN('1', 1n) === 1n)\nassert(BigInt.asUintN(1.1, 1n) === 1n)\nassert(BigInt.asUintN(2, 2n**2n) === 0n)\nassert(BigInt.asUintN(undefined, 1n) === 0n)\n\nvar array = [1, 1n, -1n]\n\nassert(BigInt.asUintN(array[0], 1n) == 1n)\nassert(BigInt.asUintN(array[0], array[1]) == 1n)\nassert(BigInt.asUintN(array[0], array[2]) == 1n)\n\nfunction f(param1, param2) {\nassert(BigInt.asUintN(param1, param2) === 0n)\n}\nf(0,10n)\nf(10,0n)\n\ntry {\n  assert(f(1, \"1n\") === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n\ntry {\n  assert(BigInt.asUintN(Number.POSITIVE_INFINITY, 1n) === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError)\n}\n\ntry {\n  assert(BigInt.asUintN(Number.NEGATIVE_INFINITY, 1n) === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError)\n}\n\ntry {\n  assert(BigInt.asUintN(1, Number.POSITIVE_INFINITY) === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\ntry {\n  assert(BigInt.asUintN(1, Number.NEGATIVE_INFINITY) === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\ntry {\n  assert(BigInt.asUintN(1, 1 + 1n) === 1n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\ntry {\n  assert(BigInt.asUintN(2n, 2n**2n) === 0n)\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\ntry {\n  BigInt.asUintN().call(undefined,1n)\n  assert (false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  BigInt.asUintN().call(1,undefined)\n  assert (false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  BigInt.asUintN().call(undefined,undefined)\n  assert (false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  assert(BigInt.asUintN(Infinity, 2n) === RangeError)\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError)\n}\n"
  },
  {
    "path": "tests/jerry/es.next/optional-chaining.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction expectSyntaxError(str) {\n  try {\n    eval(str);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n\nfunction expectTypeError(cb) {\n  try {\n    cb();\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n}\n\nexpectSyntaxError(\"this?.a``\");\nexpectSyntaxError(\"this?.['a']``\");\nexpectSyntaxError(\"this?.``\");\nexpectSyntaxError(\"this.a?.``\");\nexpectSyntaxError(\"this['a']?.``\");\nexpectSyntaxError(\"this?.a = 9\");\nexpectSyntaxError(\"this.a.a.a.a.a?.a = 9\");\nexpectSyntaxError(\"this?.a.a.a.a.a.a = 9\");\nexpectSyntaxError(\"this?.a++\");\nexpectSyntaxError(\"this?.a.a.a.a.a.a++\");\nexpectSyntaxError(\"this.a.a.a.a.?a.a++\");\nexpectSyntaxError(\"this?.a--\");\nexpectSyntaxError(\"this?.a.a.a.a.a.a--\");\nexpectSyntaxError(\"this.a.a.a.a.?a.a--\");\n\nvar o = {\n  a: 4.1,\n  b() {\n    return 4.2;\n  },\n  c: {\n    a: 4.3,\n    b() {\n      return 4.4\n    }\n  },\n  e(...args) {\n    return args.reduce((p, c) => p + c);\n  }\n}\n\n\nassert(o?.a === 4.1);\nassert(o?.a2 === undefined);\nassert(this.o?.a === 4.1);\nassert(this.o?.a2 === undefined);\nassert(this.o?.['a'] === 4.1);\nassert(this.o?.['a2'] === undefined);\nassert(typeof o?.a === 'number');\nassert(typeof o?.a2 === 'undefined');\n\nassert(o?.c?.a === 4.3);\nassert(o?.c?.a2 === undefined);\nassert(this.o?.c?.a === 4.3);\nassert(this.o?.c?.a2 === undefined);\nassert(this.o?.c?.['a'] === 4.3);\nassert(this.o?.c?.['a2'] === undefined);\nassert(typeof o?.c?.a === 'number');\nassert(typeof o?.c?.a2 === 'undefined');\n\nassert(o?.d === undefined);\nassert(o?.d?.d === undefined);\nassert(o?.d?.d?.['d'] === undefined);\n\nassert(o?.b?.() === 4.2);\nassert(o?.b2?.() === undefined);\n\nassert(o?.c?.b?.() === 4.4);\nassert(o?.c?.b2?.() === undefined);\n\nassert(o?.e(...[1.25, 2.25, 3.25]) === 6.75);\nassert(o?.e(...[1.25, 2.25, 3.25], ...[0.25]) === 7);\nassert(o?.['e'](...[1.25, 2.25, 3.25]) === 6.75);\nassert(o?.['e'](...[1.25, 2.25, 3.25], ...[0.25]) === 7);\n\nassert(o?.e?.(...[1.25, 2.25, 3.25]) === 6.75);\nassert(o?.e?.(...[1.25, 2.25, 3.25], ...[0.25]) === 7);\nassert(o?.['e']?.(...[1.25, 2.25, 3.25]) === 6.75);\nassert(o?.['e']?.(...[1.25, 2.25, 3.25], ...[0.25]) === 7);\n\n// Test short circuit\nlet count = 0;\nassert(undefined?.[count++] === undefined);\nassert(undefined?.[count++]() === undefined);\nassert(undefined?.[count++]()() === undefined);\nassert(null?.[count++] === undefined);\nassert(null?.[count++]() === undefined);\nassert(null?.[count++]()() === undefined);\nassert(count === 0);\n\n// Test optional call\nvar g = undefined;\n\nfunction f () {\n  return 4.5;\n}\n\nassert(g?.() === undefined);\nassert(this?.g?.() === undefined);\nassert(this.g?.() === undefined);\n\nexpectTypeError(_ => {\n  this.g();\n});\n\nassert(f?.() === 4.5);\nassert(this?.f?.() === 4.5);\nassert(this.f?.() === 4.5);\nassert(f() === 4.5);\n\n// test direct eval\nvar a = 5.1;\neval('a = 5.2');\nassert(a === 5.2);\neval?.('a = 5.3');\nassert(a === 5.3);\neval?.(...['a = 5.4']);\nassert(a === 5.4);\n\nconst saved_eval = eval;\neval = undefined;\n\neval?.('a = 5.5')\nassert(a === 5.4);\neval?.(...['a = 5.5'])\nassert(a === 5.4);\n\neval = saved_eval;\n\n// test optional private property access\nclass A {\n  #a = 5.1;\n\n  test(o) {\n    return o?.#a;\n  }\n}\n\nlet instance = new A;\nassert(instance.test(instance) === 5.1);\nassert(instance.test(undefined) === undefined);\nassert(instance.test(null) === undefined);\nexpectTypeError(_ => {\n  instance.test({});\n});\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4870.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nasync function f() {\n    let arr = [0.000000];\n    let fuzz_v152 = arr;\n    let fuzz_v159 = fuzz_v152.__proto__;\n    fuzz_v152.valueOf = function* (fuzz_v166, fuzz_v167) {\n        while (arr) {\n        }\n        var fuzz_v172 = ~f;\n        arr >>= [1.100000];\n        return fuzz_v167;\n    };\n    arr.includes(arr, [340282346638528859811704183484516925440.000000], arr);\n    delete [10];\n    let fuzz_v253 = f.__proto__;\n    let fuzz_v256 = {\n        \"D5FP8\": f\n    };\n    arr[\"map\"](f, new Object(true));\n    arr.flat();\n    let fuzz_v69 = false;\n    await this;\n    await f;\n    var fuzz_v43 = arr -= new Date(new String({\n        \"findIndex\": arr\n    }));\n    await this;\n    let fuzz_v286 = Symbol.reject();\n    await f;\n    await new Promise(f);\n    await new Promise(async function* (fuzz_v80) {\n        var fuzz_v82 = new Uint32Array(fuzz_v80, arr, [1.100000], fuzz_v80, fuzz_v80);\n        let fuzz_v96 = fuzz_v82.__proto__;\n        this.length = 4;\n    });\n    await new Promise(async function* (fuzz_v138, fuzz_v139) {\n        fuzz_v138.__proto__ = fuzz_v139;\n        let fuzz_v147 = function* (fuzz_v149, fuzz_v150, fuzz_v151, fuzz_v152) {\n            let fuzz_v165 = Reflect.apply(fuzz_v152, {\n                \"findIndex\": fuzz_v150\n            }, [{}]);\n            switch ({\n                includes: fuzz_v138,\n                set valueOf(fuzz_v175) {\n                    fuzz_v150.valueOf = fuzz_v175;\n                    return;\n                }\n            }) {\n                case [1.100000]:\n                    throw arr;\n                    break;\n                case 5643033980980220.000000:\n                    let fuzz_v203 = String.prototype.trim.call(new String());\n                    break;\n                default:\n                    fuzz_v43.valueOf = fuzz_v150;\n            }\n            let fuzz_v214 = fuzz_v69;\n            let fuzz_v223 = Number.isInteger(2147483648);\n        };\n        var fuzz_v228 = f;\n        delete f.__proto__;\n        let fuzz_v237 = {};\n    });\n    await new Promise(f);\n    await new Promise(async function* (fuzz_v269, fuzz_v270, fuzz_v271) {\n        class fuzz_class273 extends f {\n\n        }\n        return arr;\n    });\n    await new Promise(fuzz_v286);\n}\nf(f, f);\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4888.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar ab = new Int8Array(20).map((v, i) => i + 1).buffer;\nvar ta = new Int8Array(ab, 0, 10);\nta.constructor = {\n  [Symbol.species]: function (len) {\n    return new Int8Array(ab, 1, len);\n  }\n};\n\nvar tb = ta.slice();\n\nfor (let e of ta) {\n  assert(e === 1);\n}\n\nfor (let e of tb) {\n  assert(e === 1);\n}\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4894.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar sab = new SharedArrayBuffer(4);\nvar a = new Int32Array(sab);\n\n/* TODO: replace with the correct value whenever AtomicModifyWrite is properly implemented */\nassert(Atomics.add(a, -0, 1) === 0);\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4900.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction assertArrayEqual(actual, expected) {\n  assert(actual.length === expected.length);\n\n  for (var i = 0; i < actual.length; i++) {\n    assert(actual[i] === expected[i]);\n  }\n}\n\nvar i = 0;\nvar a = [];\nvar JSEtest = [];\n\nJSEtest.__defineGetter__(0, function NaN() {\n  if (i++ > 2) {\n    return;\n  }\n\n  JSEtest.shift();\n  gc();\n  a.push(0);\n  a.concat(JSEtest);\n});\n\nJSEtest[0];\n\nassertArrayEqual(a, [0, 0, 0]);\nassertArrayEqual(JSEtest, []);\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4916.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    eval(`var a = { get {(param)} }`);\n    assert(false);\n}\ncatch (e) {\n    assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4924.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    eval(`async((a))`);\n    assert(false);\n}\ncatch (e) {\n    assert(e instanceof ReferenceError);\n}\n\ntry {\n    eval(`async(async((async((a)))))`);\n    assert(false);\n}\ncatch (e) {\n    assert(e instanceof ReferenceError);\n}\n\ntry {\n    eval(`async((a)`);\n    assert(false);\n}\ncatch (e) {\n    assert(e instanceof SyntaxError);\n}\n\ntry {\n    eval(`async((a)))`);\n    assert(false);\n}\ncatch (e) {\n    assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4925.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  for (const i = 0;;)\n    (i) = 5;\n  assert(false);\n} catch (e) {\n    assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4927.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass C1 { async }\nclass C2 { async; constructor() {} }\nclass C3 { async = 5.1; constructor() {} }\n\nassert((new C1).async === undefined);\nassert((new C2).async === undefined);\nassert((new C3).async === 5.1);\n\ntry {\n  eval('class C1 { async* }');\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4928.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('var { a, b, ...rest }\"');\n  assert(false);\n} catch(e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4930.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(`class JSEtest {\n      #test262;\n\n      getPrivateReference() {\n          return this.#test262;\n      }\n\n      setPrivateReference(value) {function    this.#test262 = value;\n      }\n      };\n  `);\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4934.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction expectTypeError(cb) {\n  try {\n    cb();\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n}\n\nclass JSEtest {\n  static set #m(v) {\n    this._v = v;\n  }\n\n  static b() {\n    new Proxy([1], {}).#m = \"Test262\";\n  }\n\n  static c() {\n    [1].#m = \"Test262\";\n  }\n}\n\nexpectTypeError(_ => JSEtest.b());\nexpectTypeError(_ => JSEtest.c());\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4936.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass JSEtest {\n  set #m(v) {\n    this._v = v;\n  }\n\n  method() {\n    let self = !this;\n    self.#m = 'Test262';\n  }\n}\n\nlet c = new JSEtest();\n\ntry {\n  c.method();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4937-4938.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Object.prototype.toString.call(class {}) === \"[object Function]\");\nassert(Object.prototype.toString.call(BigInt.prototype) === \"[object BigInt]\");\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4939-4940.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar date = new Date(1970, 0);\ndate.setYear(-0);\nassert(date.getFullYear() === 1900)\n"
  },
  {
    "path": "tests/jerry/es.next/regression-test-issue-4941.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    Object.prototype.__proto__ = new Proxy({}, {});\n    assert(false);\n} catch (e) {\n    assert(e instanceof TypeError);\n}\n\ntry {\n    __proto__.__proto__ = new Proxy({}, {});\n    assert(false);\n} catch (e) {\n    assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/escape-sequences.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert ('abcd\\\nefgh' === 'abcdefgh');\n\nassert ('\\'' === \"'\");\nassert (\"\\'\" === \"'\");\nassert ('\\\"' === '\"');\nassert (\"\\\"\" === '\"');\n\nassert ((new String ('\\\\')).length === 1);\nassert ((new String ('\\b')).length === 1);\nassert ((new String ('\\f')).length === 1);\nassert ((new String ('\\n')).length === 1);\nassert ((new String ('\\r')).length === 1);\nassert ((new String ('\\t')).length === 1);\nassert ((new String ('\\v')).length === 1);\n\n/* verifying character codes */\nassert ((new String ('\\\\')).charCodeAt (0) === 92);\nassert ((new String ('\\b')).charCodeAt (0) === 8);\nassert ((new String ('\\f')).charCodeAt (0) === 12);\nassert ((new String ('\\n')).charCodeAt (0) === 10);\nassert ((new String ('\\r')).charCodeAt (0) === 13);\nassert ((new String ('\\t')).charCodeAt (0) === 9);\nassert ((new String ('\\v')).charCodeAt (0) === 11);\n\n/* 'p' is not SingleEscapeCharacter */\nassert ('\\p' === 'p');\n\nvar v\\u0061riable = 'valu\\u0065';\nassert (variable === 'value');\n"
  },
  {
    "path": "tests/jerry/eval-with.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f() {\n  try {\n    a;\n    assert (false);\n  } catch (e) {\n    assert (e instanceof ReferenceError);\n  }\n\n  var o = { a:1 };\n\n  with (o)\n  {\n    eval(\"var a = 2\")\n  }\n\n  assert (o.a === 2);\n  assert (a === undefined);\n}\nf();\n\nfunction g() {\n  try {\n    a;\n    assert (false);\n  } catch (e) {\n    assert (e instanceof ReferenceError);\n  }\n\n  var o = { a:1 };\n\n  with (o)\n  {\n    eval(\"function a() { return 8; }\")\n  }\n\n  assert (o.a === 1);\n  assert (a() === 8);\n}\ng();\n"
  },
  {
    "path": "tests/jerry/eval.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (eval () === undefined);\nassert (eval (undefined) === undefined);\nassert (eval (null) === null);\nassert (eval (true) === true);\nassert (eval (false) === false);\nassert (eval (1) === 1);\nassert (eval (eval) === eval);\n\n/* Indirect eval */\nfunction f1()\n{\n var v1 = 'local value';\n\n assert (v1 === 'local value');\n assert (typeof (this.v1) === 'undefined');\n\n r = this.eval ('var v1 = \"global value\";');\n\n assert (v1 === 'local value');\n assert (this.v1 === 'global value');\n assert (r === undefined);\n};\n\nf1 ();\n\n/* Direct eval from strict mode code */\nfunction f2 (global)\n{\n 'use strict';\n var v2 = 'local value';\n\n assert (v2 === 'local value');\n assert (typeof (global.v2) === 'undefined');\n\n r = eval ('var v2 = \"global value\";');\n\n assert (v2 === 'local value');\n assert (typeof (global.v2) === 'undefined');\n assert (r === undefined);\n\n try\n {\n   eval ('arguments = 1;');\n   assert (false);\n }\n catch (e)\n {\n   assert (e instanceof SyntaxError);\n }\n}\n\nf2 (this);\n\nvar y;\n\nfor (var i = 0; i < 100; i++)\n{\n  var r = eval ('var x =' + ' 1;');\n  assert (typeof (x) === 'number');\n  assert (r === undefined);\n\n  delete x;\n  assert (typeof (x) === 'undefined');\n\n  r = eval ('\"use ' + 's' + 't' + 'r' + 'i' + 'c' + 't\"; va' + 'r x = 1;');\n  assert (typeof (x) === 'undefined');\n  assert (r === \"use strict\");\n\n  y = 'str';\n  assert (typeof (y) === 'string');\n\n  delete y;\n  assert (typeof (y) === 'string');\n\n  r = eval ('var y = \"another ' + 'string\";');\n  assert (y === 'another string');\n  assert (r == undefined);\n\n  delete y;\n  assert (typeof (y) === 'string');\n\n  r = eval ('if (true) 3; else 5;');\n  assert (r === 3);\n}\n\n// Check SyntaxError handling\ntry\n{\n  eval ('var var;');\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof SyntaxError);\n}\n\ntry\n{\n  eval (\"v_0 = {a: Math, /[]/};\");\n  assert (false);\n}\ncatch(e)\n{\n  assert (e instanceof SyntaxError);\n}\n\n// nested eval with function expressions\ncode = 'eval(\"(function (){})\")';\ncode = \"eval ('\" + code + \"')\";\neval (code);\n\n// Eval enclosed in brackets is still an eval.\nvar p1 = 0;\n\nfunction f3() {\n  var p1 = 5;\n  (eval)(\"assert(p1 === 5)\");\n}\nf3();\n\nfunction f4() {\n  var p1 = 6;\n  ((eval))(\"assert(p1 === 6)\");\n}\nf4();\n\nfunction f5() {\n  var p1 = 7;\n  (((((eval)))(\"assert(p1 === 7)\")));\n}\nf5();\n\nfunction f6() {\n  var p1 = 8;\n  var e = eval;\n\n  e(\"assert(p1 === 0)\");\n  (((((e)))(\"assert(p1 === 0)\")));\n}\nf6();\n\ny = 1;\nfunction f7() {\n  function x() { return y; }\n  eval(\"assert(x()() === 5); function y() { return 5 } assert(x()() === 5)\");\n}\nf7()\n\neval(\" \");\neval(\"(function () {})\")\n\ntry {\n  /* Only fails in ES5.1 */\n  eval(\"()=>0\")\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n"
  },
  {
    "path": "tests/jerry/exponentiation.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar two = 2\nvar three = 3\n\n// Precedence (right-to-left) tests\nassert(2 ** 3 ** 2 === 512)\nassert((2 ** 3) ** 2 === 64)\nassert(2 ** (3 ** 2) === 512)\nassert(two ** three ** two === 512)\nassert((two ** three) ** two === 64)\nassert(two ** (three ** two) === 512)\n\nassert(2 ** 2 * 3 ** 3 === 4 * 27)\nassert(two ** two * three ** three === 4 * 27)\n\nvar a = 3\nassert((a **= 3) === 27)\nassert(a === 27)\n\na = 2\nassert((a **= a **= 2) === 16)\nassert(a === 16)\n\nfunction assertThrows(src) {\n  try {\n    eval(src)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof SyntaxError)\n  }\n}\n\nassertThrows(\"-2 ** 2\")\nassertThrows(\"+a ** 2\")\nassertThrows(\"!a ** 2\")\nassertThrows(\"~a ** 2\")\nassertThrows(\"void a ** 2\")\nassertThrows(\"typeof a ** 2\")\nassertThrows(\"delete a ** 2\")\nassertThrows(\"!(-a) ** 2\")\n\nassert((-2) ** 2 === 4)\n\na = 3\nassert((-+-a) ** 3 === 27)\n\na = 0\nassert((!a) ** 2 === 1)\n\na = 0\nassert(isNaN((void a) ** 3))\n\na = -4\nassert(++a ** 2 === 9)\nassert(a === -3)\n\na = -2\nassert(a-- ** 2 === 4)\nassert(a === -3)\n"
  },
  {
    "path": "tests/jerry/fail/arguments-assignment-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\narguments = 1;\n"
  },
  {
    "path": "tests/jerry/fail/arguments-catch-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\ntry{}catch(arguments){};\n"
  },
  {
    "path": "tests/jerry/fail/arguments-in-prop-set-param-list-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\nvar a = { set a(arguments) {} };\n"
  },
  {
    "path": "tests/jerry/fail/arguments-in-var-decl-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\nvar arguments;\n"
  },
  {
    "path": "tests/jerry/fail/arguments-param-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\nfunction f(arguments) {}\n"
  },
  {
    "path": "tests/jerry/fail/arguments-postfix-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\narguments++;\n"
  },
  {
    "path": "tests/jerry/fail/arguments-prefix-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\n++arguments;\n"
  },
  {
    "path": "tests/jerry/fail/delete-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\ndelete a;\n"
  },
  {
    "path": "tests/jerry/fail/escape-sequences-invalid-hex.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = '\\x5t';\n"
  },
  {
    "path": "tests/jerry/fail/escape-sequences-invalid-unicode.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = '\\u004t';\n"
  },
  {
    "path": "tests/jerry/fail/escape-sequences-invalid-variable.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a\\u0028bcd;\n"
  },
  {
    "path": "tests/jerry/fail/eval-assignment-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\neval = 1;\n"
  },
  {
    "path": "tests/jerry/fail/eval-catch-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\ntry{}catch(eval){};\n"
  },
  {
    "path": "tests/jerry/fail/eval-in-prop-set-param-list-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\nvar a = { set a(eval) {} };\n"
  },
  {
    "path": "tests/jerry/fail/eval-in-var-decl-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\nvar eval;\n"
  },
  {
    "path": "tests/jerry/fail/eval-param-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\nfunction f(eval) {}\n"
  },
  {
    "path": "tests/jerry/fail/eval-postfix-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\neval++;\n"
  },
  {
    "path": "tests/jerry/fail/eval-prefix-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\n++eval;\n"
  },
  {
    "path": "tests/jerry/fail/func-expr-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\";\n\n(function () {\n  var let = 1;\n})();\n"
  },
  {
    "path": "tests/jerry/fail/labelled-statements-break-across-function.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\na: for (var i = 0; i < 10; i++)\n{\n  function f ()\n  {\n    for (var j = 0; n < 10; j++)\n    {\n      break a;\n    }\n  }\n\n  f ();\n}\n"
  },
  {
    "path": "tests/jerry/fail/labelled-statements-duplicate-label.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\na: a: for (var i = 0; i < 10; i++)\n{\n  break a;\n}\n"
  },
  {
    "path": "tests/jerry/fail/labelled-statements-no-label.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor (var i = 0; i < 10; i++)\n{\n  break a;\n}\n"
  },
  {
    "path": "tests/jerry/fail/let-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\nvar let = 1;\n"
  },
  {
    "path": "tests/jerry/fail/module-001.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// File does not exist.\nimport b from \"module-exports.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-002.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { , as b } from \"../module-export-01.mjs\";\n"
  },
  {
    "path": "tests/jerry/fail/module-003.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport , as b from \"../module-export-01.mjs\";\n"
  },
  {
    "path": "tests/jerry/fail/module-004.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { b as , } from \"../module-export-01.mjs\";\n"
  },
  {
    "path": "tests/jerry/fail/module-005.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Named imports must be in a NamedImports block. */\nimport b as , from \"../module-export-01.mjs\";\n"
  },
  {
    "path": "tests/jerry/fail/module-006.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Can't have reserved words for the referenced bindings. */\nexport { yield as y };\n"
  },
  {
    "path": "tests/jerry/fail/module-007.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Module requests must always be evaluated. */\nimport \"./module-sideeffect.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-008.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* A string literal must always follow the 'from' keyword. */\nimport { b } from\n"
  },
  {
    "path": "tests/jerry/fail/module-009.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* A string literal must always follow the 'from' keyword. */\nimport { b } from 3\n"
  },
  {
    "path": "tests/jerry/fail/module-010.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Can't have duplicate local bindings */\nimport { c as a, d as a } from \"../module-export-01.mjs\";\n"
  },
  {
    "path": "tests/jerry/fail/module-011.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport\n"
  },
  {
    "path": "tests/jerry/fail/module-012.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport\n"
  },
  {
    "path": "tests/jerry/fail/module-013.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport var a = 4;\nexport 3\n"
  },
  {
    "path": "tests/jerry/fail/module-014.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Import/export statements must be in the global scope. */\nif (true) {\n  import { c } from \"../module-export-01.mjs\";\n}\n"
  },
  {
    "path": "tests/jerry/fail/module-015.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Import/export statements must be in the global scope. */\nfunction someFunction() {\n  import { c } from \"../module-export-01.mjs\";\n}\n"
  },
  {
    "path": "tests/jerry/fail/module-016.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Import/export statements must be in the global scope. */\neval ('import { c } from \"../module-export-01.mjs\";');\n"
  },
  {
    "path": "tests/jerry/fail/module-017.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* NamedImports must always be followed by a FromClause. */\nimport { b }, from \"../module-export-01.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-018.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* An import statement can have either a NameSpaceImport or NamedIpmorts */\nimport * as mod, { b } from \"../module-export-01.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-019.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* An ImportClause must be followed by a FromClause. */\nimport { c }\n"
  },
  {
    "path": "tests/jerry/fail/module-020.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* '*' is not valid inside NamedImports. */\nimport { *, d } from \"../module-imported-01.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-021.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Can't have duplicated local bindings. */\nimport { b } from \"../module-export-01.mjs\"\nimport { b } from \"../module-export-02.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-022.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* FromClause must follow an ImportClause. */\nimport from \"../module-export-02.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-023.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Namespace imports must have a local name. */\nimport * from \"../module-export-01.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-024.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function ns() {}\n/* Duplicated export. */\nexport * as ns from \"../module-export-fail-test.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-025.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Indirect exports must be checked if they are resolvable. */\nexport { l } from \"../module-export-01.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-026.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Can't have circular imports/exports. */\nexport { b } from \"./module-027.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-027.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Can't have circular imports/exports. */\nexport { b } from \"./module-026.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-028.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Ambiguous import */\nimport { x } from \"../module-export-05.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-029.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Import/export statements must be in the global scope. */\nFunction('','import { c } from \"../module-export-01.mjs\";')\n"
  },
  {
    "path": "tests/jerry/fail/module-030.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* No default export found. */\nimport def from \"../module-export-06.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-031.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport default function () { function () {} }\n"
  },
  {
    "path": "tests/jerry/fail/module-032.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nlet a;\nimport { a } from \"../module-export-fail-test.mjs\";\n"
  },
  {
    "path": "tests/jerry/fail/module-033.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar a;\nimport { a } from \"../module-export-fail-test.mjs\";\n"
  },
  {
    "path": "tests/jerry/fail/module-034.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { a } from \"../module-export-fail-test.mjs\";\nclass a {};\n"
  },
  {
    "path": "tests/jerry/fail/module-035.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { a } from \"../module-export-fail-test.mjs\";\nfunction a() {}\n"
  },
  {
    "path": "tests/jerry/fail/module-036.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport \"./module-await-001.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-037.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport \"./module-await-001.mjs\"\n"
  },
  {
    "path": "tests/jerry/fail/module-await-001.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nawait\n"
  },
  {
    "path": "tests/jerry/fail/module-export-001.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport default await 1;\n"
  },
  {
    "path": "tests/jerry/fail/module-export-default-arrow.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport default () => 1, 5;\n"
  },
  {
    "path": "tests/jerry/fail/module-sideeffect.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nthrow new Error(\"side-effect\")\n"
  },
  {
    "path": "tests/jerry/fail/octal-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\nvar a = 07;\n"
  },
  {
    "path": "tests/jerry/fail/param-duplication-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\nfunction f(a, a) {}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1387.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n'use strict'\nfunction undefined () {}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1549.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nva'c=\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1550.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ndo break; while a\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1597.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  throw 1\n} catch (e) {\n\n  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n\n  throw 1\n}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1598.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor (;; a[,b] )\n  break;\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1615.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n0x10000 && eval(0x10000())\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1624.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nwith ({}) {\n  a = function (b)\n  {\n    var init;\n    init();\n  }\n}\na();\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1671.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nArray.prototype.push(\"A\", \"B\", 0, 1)\nArray.prototype.sort(JSON.parse)\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1831.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/኱𞻲/‌ஃ︠﹍\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1871-1.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n𝄞\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1871-2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ng𝄞\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1873.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nwhile (\n  {a: a,\n   get a() {}\n }) continue;\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-1918.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nthrow $ = {name: function () {}}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2039.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n` ?N\\7$D\\\\${D ?N@ ${Z ?11.1\u0001Z7$D\\\\${D ?N@ ${Z ?11.1\u0001 ?11.1\u0001.G.{Z %11.0\u0001.G.\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2069.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nnull[1] = 'abcd';\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2094.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction a() {\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2095.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar e = new SyntaxError('dummy');\ne.name = 'Syntax';\nthrow e;\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2106.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nnew Float32Array({ length: 0x40000001 });\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2180.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nJSON.parse('\"' + '\\\\');\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2192.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nJSON.parse('\"' + '\\\\u');\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2344.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nnew RegExp().compile(\"\\\\1\\\\\");\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2489.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.defineProperty(Object.prototype, 0, {'get': function() { throw $ }});\n/**\n * The below line is added becase the patch #2526 introduces internal properties for promises.\n * The Reference Error this issue produced can still be reproduced by calling this line.\n * The reason it was present before is that Promise's 0th property was Promise which could be modified\n * with the above line, and the engine getting that property for internal purposes got the `throw $` instead.\n * Thanks to internal properties, it can't be modified anymore from JS side, therefore Promise won't trigger the error.\n * To keep this issue's output as it was before, the `Array.prototype[0];` line is added.\n */\nArray.prototype[0];\nPromise.all();\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2654.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n--null.static ? this : [ , ] instanceof true;\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2659.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n`eval`(\"eval ('super (a, b, c)')\");\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2719.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nJSON.stringify(URIError, valueOf, new String('abc\\u2040\\u2030cba'));\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2774.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Discard the output of the 'print' function */\nprint = function () {}\n\nprint ( JSON . stringify ( \"\" ) === '\"\"' )\nnormal_string = \"asdasd\"\nprint ( JSON . stringify ( normal_string ) == '\"asdasd\"' )\nformat_characters = \"\\ba\\fs\\nd\\ra\\tsd\"\nprint ( JSON . stringify ( format_characters ) == '\"\\\\ba\\\\fs\\\\nd\\\\ra\\\\tsd\"' )\nctl_string = \"asd\u001fasd\"\nprint ( JSON . stringify ( ctl_string ) == \"h\" )\nescpad_string = \"\\\"asda\\sd\"\nprint ( JSON . stringify ( escpad_string ) == '\"\\\\\"asdasd\"' )\nprint ( JSON . stringify ( '\\u2040' ) == '\"⁀\"' )\nprint ( JSON . stringify ( 'abc\\u2040\\u2030cba' ) == '\"abc⁀‰cba\"' )\nprint ( JSON . stringify ( 1 ) === '1' )\nprint ( JSON . stringify ( 0 ) === 'true' )\nprint ( JSON . stringify ( \"\" ) === '\"foo\"' )\nprint ( JSON . stringify ( ) === 'null' )\nprint ( NaN , RegExp ( \"54\" ) )\nprint ( JSON . stringify ( new Number ( 1 ) ) === 0 )\nprint ( JSON . stringify ( new Boolean ( 0 ) ) === 0 )\nprint ( JSON . stringify ( new String ( 0 ) ) === 0 )\nempty_object = { }\nprint ( JSON . stringify ( empty_object ) == '{}' )\nempty_object = { }\nempty_object . a = undefined\nprint ( JSON . stringify ( empty_object ) == 0 )\np_object = { $ : 1 , \"b\" : 0 , \"\" : 0 , \"d\" : 0 , \"e\" : undefined }\nprint ( JSON . stringify ( p_object ) == '{\"a\":1,\"b\":true,\"c\":\"foo\",\"d\":null}' )\no_object = { $ : new Number ( 1 ) , \"\" : new Boolean ( 0 ) , \"c\" : new String ( 0 ) }\nprint ( JSON . stringify ( o_object ) == '{\"a\":1,\"b\":true,\"c\":\"foo\"}' )\nchild = { $ : 1 , \"\" : new String ( ) , \"c\" : undefined }\nparent = { $ : 0 , \"b\" : child , \"\" : 0 }\nprint ( JSON . stringify ( parent ) == '{\"a\":true,\"b\":{\"a\":1,\"b\":\"\\\\nfoo\"},\"c\":null}' )\nrecursive_object = { }\nrecursive_object . $ = 0\nrecursive_object . $ = recursive_object\ntry { JSON . stringify ( recursive_object )\n$ ( $ )\n} catch ( e ) { print ( e instanceof TypeError )\n}\nempty_array = [ ]\nprint ( JSON . stringify ( JSON . parse ) == '[]' )\narray = [ undefined ]\nprint ( JSON . stringify ( array ) == '[null]' )\np_array = [ 1 , 0 , \"\" , 0 , undefined ]\nprint ( JSON . stringify ( p_array ) == '[1,true,\"foo\",null,null]' )\no_array = [ new Number ( 1 ) , new Boolean ( 0 ) , new String ( 0 ) ]\nprint ( \"#xy#\" . replace ( /(x)((((((((y))))))))/ , \"$00|$01|$011|$090|$10|$99\" ) === \"#$00|x|x1|y0|x0|y9#\" )\nchild = [ 1 , new String ( \"\\nfoo\" ) , undefined ]\nparent = [ 0 , child , 0 ]\nprint ( JSON . stringify ( parent ) == '[true,[1,\"\\\\nfoo\",null],null]' )\nrecursive_array = [ ]\nrecursive_array [ 0 ] = 0\nrecursive_array [ 1 ] = recursive_array\nprint ( \"\" . match ( ) !== void 0 )\nobject = { $ : 1 , $ : [ 1.25 , 2.5 , 3.75 ] }\nprint ( JSON . stringify ( object ) == '{\"a\":1,\"b\":[1,true,{\"a\":\"foo\"}]}' )\nobject = { $ : [ /  / ] , $ : { } }\nprint ( JSON . stringify ( object ) === '{\"a\":[1],\"b\":{}}' )\narray = [ 1 , { $ : 2 , \"\" : 0 , c : [ 3 ] } ]\nprint ( JSON . stringify ( array ) == '[1,{\"a\":2,\"b\":true,\"c\":[3]}]' )\nto_json_object = { }\nto_json_object . $ = 2\nto_json_object . toJSON = function ( ) {\n}\nprint ( JSON . stringify ( to_json_object ) === \"3\" )\nfunction replacer_function ( ) { if ( typeof ( ℇ ) == \"\" ) return \"FOO\"\n} object = { $ : 0 , \"b\" : new String ( \"JSON\" ) , \"\" : 3 }\nprint ( JSON . stringify ( object , replacer_function ) == '{\"a\":\"FOO\",\"b\":\"JSON\",\"c\":3}' )\nfilter = [ \"\" ]\nprint ( JSON . stringify ( object , filter ) == '{\"a\":\"JSON\",\"b\":\"JSON\"}' )\nprint ( JSON . stringify ( [ ] , [ 0 , 'foo' ] ) === 0 )\nnumber = new Number ( )\nnumber . toString = { }\nnumber . valueOf = [ ]\ntry { JSON . stringify ( [ ] , [ number ] )\n$ ( $ )\n} catch ( e ) { print ( e instanceof TypeError )\n}\nfunction replacer_thrower ( ) { throw new ReferenceError ( $ )\n} try { $ . $ ( $ , $ )\n$ ( $ )\n} catch ( e ) { print ( e . message === 0 )\nprint ( e instanceof ReferenceError )\n}\nobject = { $ : 2 }\nprint ( JSON . stringify ( object , 3 ) == 0 )\nvar f = new Function ( \" a\\t ,  b\" , \"\\u0020c\" , \"return a + b + c;\" )\nprint ( JSON . stringify ( object , 0 ) == 0 )\nprint ( JSON . stringify ( object ) == 0 )\nprint ( JSON . stringify ( ) == 0 )\nprint ( JSON . stringify ( object , new Boolean ( 0 ) ) == 0 )\nprint ( ReferenceError ( 0 ) == '{\"a\":2}' )\nprint ( JSON . stringify ( object , new String ( 0 ) ) == 0 )\nprint ( JSON . stringify ( object , { $ : 3 } ) == 0 )\nobject = { $ : 2 }\nprint ( JSON . stringify ( object , 0 , \"\" ) == '{\\n   \"a\": 2\\n}' )\nprint ( JSON . stringify ( object , 0 , \"\" ) == '{\\nasd\"a\": 2\\n}' )\nprint ( JSON . stringify ( object , 0 , \"\" ) == '{\\nasd0123456\"a\": 2\\n}' )\nprint ( JSON . stringify ( object , 0 , \"asd\\u20400123456789\" ) == '{\\nasd⁀012345\"a\": 2\\n}' )\nprint ( JSON . stringify ( object , 0 , 100 ) == '{\\n          \"a\": 2\\n}' )\nprint ( JSON . stringify ( object , 0 , - 5 ) == 0 )\narray = [ 0 ]\nprint ( JSON . stringify ( array , 0 , \"   \" ) == '[\\n   2\\n]' )\nprint ( JSON . stringify ( array , 0 , \"asd\" ) == '[\\nasd2\\n]' )\nprint ( JSON . stringify ( array , 0 , \"asd0123456789\" ) == '[\\nasd01234562\\n]' )\nprint ( JSON . stringify ( array , 0 , \"\" ) == '[\\nasd⁀0123452\\n]' )\nprint ( )\nprint ( JSON . stringify ( array , 0 , - 5 ) == '[2]' )\nnested_object = { $ : 2 , \"\" : { $ : this } }\nprint ( JSON . stringify ( nested_object , 0 , 2 ) == \"zero\" )\n$ = [ $ , [ $ , $ ] ]\n$ ( $ . $ ( nested_array , 0 , $ ) == '[\\n  2,\\n  [\\n    1,\\n    true\\n  ]\\n]' )\n$\n$ ( $ . $ ( $ , $ , $ ) == $ )\n$ ( $ . $ ( $ , $ , $ ) == $ )\n$\n$\n$ ( $ . $ ( $ , $ , [ $ , $ , $ ] ) == $ )\n$ ( $ . $ ( $ , $ , { $ : 3 } ) == $ )\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2775.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Discard the output of the 'print' function */\nprint = function () {}\n\nprint ( JSON . stringify ( \"\" ) === '\"\"' )\nnormal_string = \"asdasd\"\nprint ( JSON . stringify ( normal_string ) == '\"asdasd\"' )\nformat_characters = \"\\ba\\fs\\nd\\ra\\tsd\"\nprint ( JSON . stringify ( format_characters ) == '\"\\\\ba\\\\fs\\\\nd\\\\ra\\\\tsd\"' )\nctl_string = \"asd\u001fasd\"\nprint ( JSON . stringify ( ctl_string ) == '\"asd\\\\u001fasd\"' )\nescpad_string = \"\\\"asda\\sd\"\nprint ( JSON . stringify ( escpad_string ) == '\"\\\\\"asdasd\"' )\nprint ( JSON . stringify ( true ) === 'true' )\nprint ( JSON . stringify ( \"foo\" ) === '\"foo\"' )\nprint ( JSON . stringify ( null ) === 'null' )\nprint ( JSON . stringify ( RegExp ) === undefined )\nprint ( JSON . stringify ( new Number ( 1 ) ) === '1' )\nprint ( JSON . stringify ( new Boolean ( true ) ) === 'true' )\nprint ( JSON . stringify ( new String ( \"foo\" ) ) === '\"foo\"' )\nempty_object = { }\nprint ( JSON . stringify ( empty_object ) == '{}' )\nempty_object = { }\nempty_object . $ = undefined\nprint ( JSON . stringify ( empty_object ) == '{}' )\np_object = { \"a\" : 1 , \"b\" : true , \"c\" : \"foo\" , \"d\" : null , \"e\" : undefined }\nprint ( JSON . stringify ( p_object ) == '{\"a\":1,\"b\":true,\"c\":\"foo\",\"d\":null}' )\no_object = { \"a\" : new Number ( 1 ) , \"b\" : new Boolean ( true ) , \"c\" : new String ( \"foo\" ) }\nprint ( JSON . stringify ( o_object ) == '{\"a\":1,\"b\":true,\"c\":\"foo\"}' )\nchild = { \"a\" : 1 , \"b\" : new String ( \"\\nfoo\" ) , $ : undefined }\nparent = { \"a\" : true , \"b\" : child , \"c\" : null }\nprint ( JSON . stringify ( parent ) == '{\"a\":true,\"b\":{\"a\":1,\"b\":\"\\\\nfoo\"},\"c\":null}' )\nrecursive_object = { }\nrecursive_object . $ = 0\nrecursive_object . b = recursive_object\ntry { JSON . stringify ( recursive_object )\n$ ( ')' )\n} catch ( e ) { print ( e instanceof TypeError )\n}\nempty_array = [ ]\nprint ( JSON . stringify ( empty_array ) == '[]' )\narray = [ undefined ]\nprint ( JSON . stringify ( array ) == '[null]' )\np_array = [ 1 , true , \"foo\" , null , undefined ]\nprint ( JSON . stringify ( p_array ) == '[1,true,\"foo\",null,null]' )\no_array = [ new Number ( 1 ) , new Boolean ( true ) , new String ( \"foo\" ) ]\nprint ( JSON . stringify ( o_array ) == '[1,true,\"foo\"]' )\nchild = [ 1 , new String ( \"\\nfoo\" ) , undefined ]\nparent = [ true , child , null ]\nprint ( JSON . stringify ( parent ) == '[true,[1,\"\\\\nfoo\",null],null]' )\nrecursive_array = [ ]\nrecursive_array [ 0 ] = 2\nrecursive_array [ 1 ] = recursive_array\ntry { JSON . stringify ( recursive_array )\n$ ( $ )\n} catch ( e ) { print ( e instanceof TypeError )\n}\nobject = { \"a\" : 1 , \"b\" : [ 1 , true , { \"a\" : \"foo\" } ] }\nprint ( JSON . stringify ( object ) == '{\"a\":1,\"b\":[1,true,{\"a\":\"foo\"}]}' )\nobject = { \"a\" : [ 1 ] , \"b\" : { } }\nprint ( JSON . stringify ( object ) === '{\"a\":[1],\"b\":{}}' )\narray = [ 1 , { \"a\" : 2 , \"b\" : true , c : [ 3 ] } ]\nprint ( JSON . stringify ( array ) == '[1,{\"a\":2,\"b\":true,\"c\":[3]}]' )\nto_json_object = { }\nto_json_object . $ = 0\nto_json_object . $ = function ( ) {\n}\nvar v1 = ( new Int8Array ( 149 ) ) . subarray ( 78 )\nfunction replacer_function ( $ , value ) { if ( typeof ( value ) == \"string\" ) return \"FOO\"\nreturn value\n} object = { \"a\" : \"JSON\" , \"b\" : new String ( \"JSON\" ) , \"c\" : 3 }\nprint ( JSON . stringify ( object , replacer_function ) == '{\"a\":\"FOO\",\"b\":\"JSON\",\"c\":3}' )\nfilter = [ \"a\" , \"b\" ]\nprint ( JSON . stringify ( object , filter ) == '{\"a\":\"JSON\",\"b\":\"JSON\"}' )\nprint ( JSON . stringify ( [ ] , [ \"\" , 4 ] ) === '[]' )\nnumber = new Number ( 2.2 )\nnumber . toString = { }\nnew Promise ( isFinite . toString ) . catch ( Promise . prototype . then )\ntry { } catch ( $ ) { $ ( $ instanceof $ )\n}\nfunction replacer_thrower ( ) { throw new ReferenceError ( \"foo\" )\n} try { JSON . stringify ( object , replacer_thrower )\n} catch ( e ) { print ( e . message === \"foo\" )\nprint ( e instanceof ReferenceError )\n}\nobject = { \"a\" : 2 }\nprint ( JSON . stringify ( object , 3 ) == '{\"a\":2}' )\nprint ( JSON . stringify ( object , 0 ) == '{\"a\":2}' )\nprint ( JSON . stringify ( object , 0 ) == '{\"a\":2}' )\nprint ( JSON . stringify ( object , undefined ) == '{\"a\":2}' )\nprint ( JSON . stringify ( object , 0 ) == '{\"a\":2}' )\nprint ( JSON . stringify ( object , new Boolean ( 0 ) ) == '{\"a\":2}' )\nprint ( JSON . stringify ( object , 0 , \"asd\\u20400123456789\" ) == '{\\nasd⁀012345\"a\": 2\\n}' )\nprint ( JSON . stringify ( object , 0 , 100 ) == '{\\n          \"a\": 2\\n}' )\nprint ( JSON . stringify ( object , 0 , - 5 ) == '{\"a\":2}' )\narray = [ 2 ]\nprint ( JSON . stringify ( array , 0 , \"   \" ) == '[\\n   2\\n]' )\nprint ( JSON . stringify ( array , 0 , \"asd\" ) == '[\\nasd2\\n]' )\nprint ( JSON . stringify ( array , 0 , \"asd0123456789\" ) == '[\\nasd01234562\\n]' )\nprint ( JSON . stringify ( array , 0 , \"asd\\u20400123456789\" ) == '[\\nasd⁀0123452\\n]' )\nprint ( JSON . stringify ( array , 0 , 100 ) == '[\\n          2\\n]' )\nprint ( JSON . stringify ( array , 0 , - 5 ) == '[2]' )\nnested_object = { do : 2 , let : this }\nprint ( JSON . stringify ( nested_object , 0 , 2 ) == '{\\n  \"a\": 2,\\n  \"b\": {\\n    \"c\": 1,\\n    \"d\": true\\n  }\\n}' )\n$ = [ $ , [ $ ] ]\n$ ( $ . $ ( nested_array , $ , 2 ) == '[\\n  2,\\n  [\\n    1,\\n    true\\n  ]\\n]' )\n$\n$\n$\n$ ( $ . $ ( $ , 0 , $ ) == $ )\neval ( \"{}/a/g\" )\n$ ( $ . $ ( $ , $ , [ $ , $ , 0 ] ) == $ )\n$ ( $ . $ ( $ , $ , { $ : 3 } ) == $ )\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2819.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  for (this << class extends this {} in this) { }\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2846.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f ( ) { }\nvar B = class extends f { constructor ( ){ eval ( \"eval ('super (1, 2, 3, 4)')\" ) ; } }\n    C = class extends B { g ( ) { { ( ) => { } } } }\n    D = class extends C { constructor ( ) { super ( )\n}\n\ng () { eval () } }\neval = eval.bind()\nnew D\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2885.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.defineProperties(constructor, { $: Object })\nJSON.parse('{\"a\":1}', function (k) {\n  if (k) { $ *= $ }\n})\nvar $ = Object.freeze(RegExp($, 'g')).exec()\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2894.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nArray.prototype.unshift(Object(Symbol()));\nArray.prototype.reduce(function(p_0, p_1) { return p_0 + p_1}, \"\");\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2896.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport {} from \"dummy.mjs\";\nexport {} from \"../module-export-04.mjs\";\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2897.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nobject = { valueOf: function ( ) { return Symbol ( \"foo\" ) } };\nassert(\"\" + object);\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2901.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nobject = new Object ( )\nvar str = Symbol ( 'foo' )\nassert ( object + str === \"[object Object]\" )\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2902.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar b = Symbol.for();\nfor (var $;;) {$ = $(\"\" + b)};\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2908-1.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport{p0hc\"=\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2908-2.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport{a as p0hc\"=\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2908-3.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport{p0hc\"=\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2908-4.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport{a as p0hc\"=\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-2993.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nthrow new SyntaxError(\"𐐀\");\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3094.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass $ {\n  set ( ) {}\n}\nfor ( ; 10 ; i )\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3096.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass $ {\n  set ( ) {\n    while ( done )\n  }\n}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3101.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor ( ; ; ( ) => 0) {\n    for ( ; $; $) ;\n}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3102.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nwhile ( $(($) => {}) ) {\n    while ($);\n}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3112.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar iter = \"\" [ Symbol.iterator ] ( );\niter.next.constructor ( Object.getPrototypeOf( iter ) )\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3117.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar $ = class { } .prototype  = [ ]\nswitch ( '1' ) {\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3119.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\na ( ) = { m ( ) { } } .m ( ) = class { m ( ) { } }.sameValue\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3121.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar Base = function ( ) { }.bind( );\nObject.defineProperty ( Base , 'prototype' , { get : function ( ) {$} } );\nclass C extends Base { }\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3123.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nswitch ($) {\n  case $: class $ {;}\n  case $$: class $$ {; ; ; ; ;;;; ;}\n  case 6:\n}\n\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3131.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nswitch ( $) { case $: for ( ; ; ) ; case $ :}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3140.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor (; []; [//])\nfunction f14(v33, v34) {\nswitch (!0x13) {}\n }\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3145.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n[this?$\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3152.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n$ = { $: () => 0, $: $ }\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3173.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar NISLFuzzingFunc = function(d, c) {\n    var a = d.toPrecision(c);\n};\nvar NISLParameter0 = 59246;\nvar NISLParameter1 = function(p) {\n};\nNISLFuzzingFunc(NISLParameter0, NISLParameter1);\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3174.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nif ($)\n    function $ ( ) { };\nelse if ( b ) c\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3214.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar $ = { $ ( ){ } } = { g ( ) { ( ) => m ++ ( ) } }  = class extends C { constructor ( ) { super () } }\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3253-1.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a;\nexport { a\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3253-2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a, b;\nexport { a as b\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3275.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor ( i in this ) class ${ } eval ( )\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3276.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nwith ({ }) class ${ $( ) { $ } }\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3297.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"98765\".replace(76, function ( ) { return $ })\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3299.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f (a, b = $+ function ( ) { } ( ), $) { }\nvar $ = { $: function ($) { }}\nf( )\n\nfunction duplicatedArg ( a , b = d , c ) {\n  try {\n    var eval\n    var id_1\n    if ( id_2 === eval ( ) ) { }\n  } finally { }\n}\n\nduplicatedArg(1, 2)\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3300.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ny = 6\nfunction i ( a , b = ( y ) + 2 , c = typeof id_0 ) {\n  function x ( ) { }\n    eval ( \"//Single Line Comments\\u2029 var =;\" )\n   c === \"undefined\"\n   print ( y === 10 )\n   ( id_2 === 11 )\n}\ni ( )\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3394.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nclass Animal { }\n\nclass Dog extends Animal {\n    static explain() {\n        super.explain(...[])\n    }\n}\n\nDog.explain()\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3398.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f($, [\n    [b, [c] = [], {} = {\n        $: eval()\n    }]\n] = [[]], c) {}\nf()\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3410.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nvar a;\nPromise.race([a]).then(function() {\n  [] = []\n});\nthrow 0.1234;\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3554.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function(){try{}catch(e){function e\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-358.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nlabel_0: \n    if (false)\n        do  {\n            continue label_0;\n        } while (false);"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3714.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction $() {\n    if ($)\n    function\n}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3735.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction $({ $ $() {}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-384.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyrnse.\n\n'use stricto\n// C_pyrnsq.\n\n'use strictI\n// Copyrnse. Functionn f_0(){\n    'use strictT\n// Copyrnse.\n\n'use strict)\n// Copyrnse.\n\n'use strict;"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-3882.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor(let{[function(){}]:{}} = ()=>{} in []) ;\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-4403.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nthrow new SyntaxError(\"[0: 98, 1: 54, 8: false, 10: 21, foo: bar]\");\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-4754.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass a { b() { for (let\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-4920.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nconst v2 = String.fromCodePoint(1337);\nconst v4 = v2.padEnd(1337, v2);\nconst v7 = undefined[v4];\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-5085.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nasync () => {}\nawait Symbol;\nclass B{}\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-5141.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass C { #get [Symbol]; }\n"
  },
  {
    "path": "tests/jerry/fail/regression-test-issue-5153.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass C { async #*method()  }\n"
  },
  {
    "path": "tests/jerry/fail/throw-error-object.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nthrow new SyntaxError(\"error\");\n"
  },
  {
    "path": "tests/jerry/fail/throw-number.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nthrow 0.1234;\n"
  },
  {
    "path": "tests/jerry/fail/throw-string.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nthrow \"SyntaxError\"\n"
  },
  {
    "path": "tests/jerry/fail/with-strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\n\nwith (Array) {}\n"
  },
  {
    "path": "tests/jerry/for-await-of-iterator-close.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar successCount = 0;\n\n// Test 1\n\nvar asyncIter1 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    return {\n      next() {\n        assert(++idx === 1)\n        return Promise.resolve({ value: \"Val\", done: false })\n      }\n      /* No return() function */\n    }\n  }\n}\n\nasync function f1() {\n  for await (var v of asyncIter1) {\n    assert(v === \"Val\")\n    break\n  }\n  successCount++\n\nexit:\n  for await (var v of asyncIter1) {\n    for await (var v of asyncIter1) {\n      assert(v === \"Val\")\n      break exit\n    }\n    assert(false)\n  }\n  successCount++\n\n  try {\n    for await (var v of asyncIter1) {\n      assert(v === \"Val\")\n      throw 3.75\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === 3.75)\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter1) {\n      assert(v === \"Val\")\n      return {}\n    }\n    assert(false)\n  } finally {\n    successCount++\n  }\n  assert(false)\n}\n\nf1()\n\n// Test 2\n\nvar o2 = {}\nvar returnCount2 = 0\nvar asyncIter2 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    return {\n      next() {\n        assert(++idx === 1)\n        return Promise.resolve({ value: o2, done: false })\n      },\n      return(...v) {\n        assert(v.length === 0)\n        returnCount2++\n        return Promise.resolve({})\n      }\n    }\n  }\n}\n\nasync function f2() {\n  for await (var v of asyncIter2) {\n    assert(v === o2)\n    break\n  }\n  successCount++\n\nexit:\n  for await (var v of asyncIter2) {\n    for await (var v of asyncIter2) {\n      assert(v === o2)\n      break exit\n    }\n    assert(false)\n  }\n  successCount++\n\n  try {\n    for await (var v of asyncIter2) {\n      assert(v === o2)\n      throw o2\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === o2)\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter2) {\n      assert(v === o2)\n      return \"Ret\"\n    }\n    assert(false)\n  } finally {\n    successCount++\n  }\n  assert(false)\n  print(\"OK\")\n}\n\nf2()\n\n// Test 3\n\nvar asyncIter3 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    return {\n      next() {\n        assert(++idx === 1)\n        return Promise.resolve({ value: -4.5, done: false })\n      },\n      return() {\n        throw \"Error\"\n      }\n    }\n  }\n}\n\nasync function *f3() {\n  try {\n    for await (var v of asyncIter3) {\n      assert(v === -4.5)\n      break\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === \"Error\")\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter3) {\n      assert(v === -4.5)\n      return\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === \"Error\")\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter3) {\n      assert(v === -4.5)\n      throw \"Exit\"\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === \"Exit\")\n    successCount++\n  }\n}\n\nf3().next()\n\n// Test 4\n\nvar o4 = {}\nvar asyncIter4 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    return {\n      next() {\n        assert(++idx === 1)\n        return Promise.resolve({ value: -4.5, done: false })\n      },\n      get return() {\n        throw o4\n      }\n    }\n  }\n}\n\nasync function *f4() {\n  try {\n    for await (var v of asyncIter4) {\n      assert(v === -4.5)\n      break\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === o4)\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter4) {\n      assert(v === -4.5)\n      return\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === o4)\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter4) {\n      assert(v === -4.5)\n      throw 9.25\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === 9.25)\n    successCount++\n  }\n}\n\nf4().next()\n\n// Test 5\n\nvar asyncIter5 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    return {\n      next() {\n        assert(++idx === 1)\n        return Promise.resolve({ value: -4.5, done: false })\n      },\n      get return() {\n        return \"Not callable\"\n      }\n    }\n  }\n}\n\nasync function f5() {\n  try {\n    for await (var v of asyncIter5) {\n      assert(v === -4.5)\n      break\n    }\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter5) {\n      assert(v === -4.5)\n      return\n    }\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n    successCount++\n  }\n\n  var o = {}\n  try {\n    for await (var v of asyncIter5) {\n      assert(v === -4.5)\n      throw o\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === o)\n    successCount++\n  }\n}\n\nf5()\n\n// Test 6\n\nvar asyncIter6 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    return {\n      next() {\n        assert(++idx === 1)\n        return Promise.resolve({ value: -4.5, done: false })\n      },\n      return() {\n        return Promise.resolve(4.5)\n      }\n    }\n  }\n}\n\nasync function f6() {\n  try {\n    for await (var v of asyncIter6) {\n      assert(v === -4.5)\n      break\n    }\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter6) {\n      assert(v === -4.5)\n      return\n    }\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter6) {\n      assert(v === -4.5)\n      throw true\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === true)\n    successCount++\n  }\n}\n\nf6()\n\n// Test 7\n\nvar asyncIter7 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    return {\n      next() {\n        assert(++idx === 1)\n        return Promise.resolve({ value: -4.5, done: false })\n      },\n      return() {\n        return Promise.reject(\"Rejected\")\n      }\n    }\n  }\n}\n\nasync function f7() {\n  try {\n    for await (var v of asyncIter7) {\n      assert(v === -4.5)\n      break\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === \"Rejected\")\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter7) {\n      assert(v === -4.5)\n      return\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === \"Rejected\")\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter7) {\n      assert(v === -4.5)\n      throw true\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === true)\n    successCount++\n  }\n}\n\nf7()\n\n// Test 8\n\nvar asyncIter8 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    return {\n      next() {\n        assert(++idx === 1)\n        return Promise.resolve({ value: -4.5, done: false })\n      },\n      return() {\n        return {}\n      }\n    }\n  }\n}\n\nasync function f8() {\n  for await (var v of asyncIter8) {\n    assert(v === -4.5)\n    break\n  }\n  successCount++\n\n  try {\n    for await (var v of asyncIter8) {\n      assert(v === -4.5)\n      throw null\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === null)\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter8) {\n      assert(v === -4.5)\n      return\n    }\n    assert(false)\n  } finally {\n    successCount++\n  }\n}\n\nf8()\n\n// Test 9\n\nvar asyncIter9 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    return {\n      next() {\n        assert(++idx === 1)\n        return Promise.resolve({ value: -4.5, done: false })\n      },\n      return() {\n        throw \"Except\"\n      }\n    }\n  }\n}\n\nasync function f9() {\n  try {\n    for await (var v of asyncIter9) {\n      assert(v === -4.5)\n      break\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === \"Except\")\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter9) {\n      assert(v === -4.5)\n      throw 7.5\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === 7.5)\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter9) {\n      assert(v === -4.5)\n      for await (var v of asyncIter9) {\n        assert(v === -4.5)\n        for await (var v of asyncIter9) {\n          assert(v === -4.5)\n          throw \"Leave\"\n        }\n        assert(false)\n      }\n      assert(false)\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === \"Leave\")\n    successCount++\n  }\n\n  try {\n    for await (var v of asyncIter9) {\n      assert(v === -4.5)\n      return\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === \"Except\")\n    successCount++\n  }\n}\n\nf9()\n\n// Test 10\n\nvar asyncIter10 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    return {\n      next() {\n        throw \"NoNext\"\n      },\n      return() {\n        assert(false)\n      },\n      throw() {\n        assert(false)\n      }\n    }\n  }\n}\n\nasync function f10() {\n  try {\n    try {\n      for await (var v of asyncIter10) {\n        assert(false)\n      }\n      assert(false)\n    } finally {\n      successCount++\n    }\n  } catch (e) {\n    assert(e === \"NoNext\")\n    successCount++\n  }\n}\n\nf10()\n\n// Test 11\n\nvar asyncIter11 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    return {\n      next() {\n        if (++idx < 3)\n          return Promise.resolve({ value: -4.5, done: false })\n        throw \"NoNext\"\n      },\n      return() {\n        assert(false)\n      },\n      throw() {\n        assert(false)\n      }\n    }\n  }\n}\n\nasync function f11() {\n  try {\n    try {\n      for await (var v of asyncIter11) {\n        assert(v === -4.5)\n      }\n      assert(false)\n    } finally {\n      successCount++\n    }\n  } catch (e) {\n    assert(e === \"NoNext\")\n    successCount++\n  }\n}\n\nf11()\n\n// Test 12\n\nvar o12 = {}\nasync function *gen12()\n{\n  try {\n    yield 9.5\n    assert(false)\n  } finally {\n    successCount++\n  }\n  assert(false)\n}\n\nasync function f12()\n{\n  for await (var v of gen12())\n  {\n    assert(v === 9.5)\n    break;\n  }\n  successCount++\n}\n\nf12()\n\n// END\n\nfunction __checkAsync() {\n  assert(returnCount2 === 5)\n  assert(successCount === 36)\n}\n"
  },
  {
    "path": "tests/jerry/for-await-of.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (code)\n{\n  try {\n    eval (code);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\ncheck_syntax_error (\"for await (a of b)\");\ncheck_syntax_error (\"async function f() { for await (a in b) ; }\");\ncheck_syntax_error (\"async function f() { for await ( ; ; ) ; }\");\ncheck_syntax_error (\"async function f() { for await (let a = 0; a < 4; a++) ; }\");\n\nvar successCount = 0;\n\n// Test 1\n\nvar promise1 = Promise.resolve(\"Resolved\");\n\nvar asyncIter1 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n\n    function next() {\n      idx++;\n      if (idx == 1) {\n        return { value:\"Val\", done: false }\n      } else if (idx == 2) {\n        return { value:promise1, done: false }\n      } else if (idx == 3) {\n        return { value:4.5, done: false }\n      }\n      return { value:promise1, done: true }\n    }\n\n    successCount++\n    return { next }\n  }\n}\n\nfunction checkAsyncIter1(v, idx)\n{\n  if (idx === 1) {\n    assert(v === \"Val\")\n  } else if (idx === 2) {\n    assert(v === promise1)\n  } else if (idx === 3) {\n    assert(v === 4.5)\n  } else {\n    assert(false)\n  }\n}\n\nasync function f1a() {\n  var idx = 0;\n  for await (var v of asyncIter1) {\n    checkAsyncIter1(v, ++idx);\n    successCount++;\n  }\n  successCount++;\n}\n\nf1a()\n\nasync function f1b() {\n  await promise1\n\n  var idx = 0;\n  for await (var v of asyncIter1) {\n    checkAsyncIter1(v, ++idx);\n    successCount++;\n  }\n  successCount++;\n}\n\nf1b()\n\nasync function *f1c() {\n  var idx = 0;\n  for await (var v of asyncIter1) {\n    checkAsyncIter1(v, ++idx);\n    successCount++;\n  }\n  successCount++;\n}\n\nf1c().next()\n\nasync function *f1d() {\n  await promise1\n\n  var idx = 0;\n  for await (var v of asyncIter1) {\n    checkAsyncIter1(v, ++idx);\n    successCount++;\n  }\n  successCount++;\n}\n\nf1d().next()\n\n// Test 2\n\nvar state2 = 0\nvar promise2 = Promise.reject(\"Rejected\");\n\nvar asyncIter2 = {\n  [Symbol.asyncIterator]() {\n    var idx = 0;\n    assert(++state2 === 1)\n\n    function next() {\n      idx++;\n      if (idx == 1) {\n        assert(++state2 === 2)\n        return { value:\"Str\", done: false }\n      } else if (idx == 2) {\n        assert(++state2 === 4)\n        return { value:promise2, done: false }\n      } else if (idx == 3) {\n        assert(++state2 === 6)\n        return { value:-3.5, done: false }\n      }\n      assert(++state2 === 8)\n      return { value:promise2, done: true }\n    }\n\n    successCount++\n    return { next }\n  }\n}\n\nfunction checkAsyncIter2(v, idx)\n{\n  if (idx === 1) {\n    assert(v === \"Str\")\n  } else if (idx === 2) {\n    assert(v === promise2)\n  } else if (idx === 3) {\n    assert(v === -3.5)\n  } else {\n    assert(false)\n  }\n}\n\nasync function *f2a() {\n  var idx = 0;\n  for await (var v of asyncIter2) {\n    checkAsyncIter2(v, ++idx)\n    yield v\n  }\n  successCount++;\n}\n\nasync function f2b() {\n  var idx = 0;\n  var g = f2a();\n  var v;\n\n  while (true) {\n    v = await g.next()\n\n    if (v.done) {\n      break;\n    }\n\n    checkAsyncIter2(v.value, ++idx)\n    ++state2\n    assert(state2 === 3 || state2 === 5 || state2 === 7)\n  }\n\n  successCount++;\n}\n\nf2b();\n\n// Test 3\n\nvar o3 = {}\nasync function* gen3()\n{\n  yield o3\n  yield \"Res\"\n}\n\nasync function f3()\n{\n  var idx = 0\n\n  for await (var v of gen3())\n  {\n    idx++\n\n    if (idx === 1)\n    {\n      assert(v === o3)\n    }\n    else\n    {\n      assert(idx === 2)\n      assert(v === \"Res\")\n    }\n  }\n  successCount++\n}\n\nf3()\n\n// END\n\nfunction __checkAsync() {\n  assert(state2 === 8)\n  assert(successCount === 24)\n}\n"
  },
  {
    "path": "tests/jerry/for-in-parse.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction parse (txt) {\n  try {\n    eval (txt)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\nvar obj = {a: 1, b: 2, c:3, d:4};\n\nvar forIn =\n  \"for var prop in obj\" +\n  \"   obj [prop] += 4\"\nparse (forIn)\n\nvar forIn =\n  \"for [var prop in obj]\" +\n  \"   obj[prop] += 4;\"\nparse (forIn)\n\nvar forIn =\n  \"for (var prop obj)\" +\n  \"   obj[prop] += 4;\"\nparse (forIn)\n\nvar forIn =\n  \"foreach (var prop in obj)\" +\n  \"   obj[prop] += 4;\"\nparse (forIn)\n"
  },
  {
    "path": "tests/jerry/for-in.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// 1.\nvar simple_obj = {a: 1, b: 2, c: 3, d: 4};\nfor (var prop_of_simple_obj in simple_obj) {\n    simple_obj[prop_of_simple_obj] += 4;\n}\n\nassert(simple_obj.a === 5\n       && simple_obj.b === 6\n       && simple_obj.c === 7\n       && simple_obj.d === 8);\n\n// 2.\nfor\n    (\n    var\n        prop_of_simple_obj in simple_obj\n    ) {\n    simple_obj[prop_of_simple_obj] -= 4;\n}\n\nassert(simple_obj.a === 1\n       && simple_obj.b === 2\n       && simple_obj.c === 3\n       && simple_obj.d === 4);\n\n// 3.\nfunction test() {\n  var cnt = 0;\n\n  for (var prop_of_simple_obj in simple_obj) {\n    if (prop_of_simple_obj === 'b')\n      continue;\n\n    cnt++;\n\n    simple_obj[prop_of_simple_obj] += 4;\n  }\n\n  return cnt;\n}\n\nvar ret_val = test();\n\nassert((simple_obj.a === 5\n        && simple_obj.b === 2\n        && simple_obj.c === 7\n        && simple_obj.d == 8)\n       && ret_val === 3);\n\n// 4.\nvar array_obj = new Array(1, 2, 3, 4, 5, 6, 7);\nvar prop_of_array_obj;\n\narray_obj.eight = 8;\n\nfor (prop_of_array_obj in array_obj) {\n    array_obj[prop_of_array_obj] += 1;\n}\n\nassert(array_obj[0] === 2\n       && array_obj[1] === 3\n       && array_obj[2] === 4\n       && array_obj[3] === 5\n       && array_obj[4] === 6\n       && array_obj[5] === 7\n       && array_obj[6] === 8\n       && array_obj['eight'] === 9);\n\n// 5.\nvar null_obj = null;\nfor (var prop_of_null_obj in null_obj) {\n    assert(false);\n}\n\n// 6.\nvar empty_object = {};\nfor (var prop_of_empty_object in empty_object) {\n    assert(false);\n}\n\n// 7.\nfor (var i in undefined) {\n    assert(false);\n}\n\n// 8.\nvar base_obj = {base_prop: \"base\"};\n\nfunction constr() {\n    this.derived_prop = \"derived\";\n}\n\nconstr.prototype = base_obj;\n\nvar derived_obj = new constr();\n\nfor (var prop_of_derived_obj in derived_obj) {\n    derived_obj[prop_of_derived_obj] += \"A\";\n}\n\nassert(derived_obj.base_prop === \"baseA\" && derived_obj.derived_prop === \"derivedA\");\n\n// 9.\nlog = {};\ncount = 0;\n\nfor (i in {q : 1})\n{\n  log [i] = true;\n  count++;\n}\n\nassert (count == 1 && 'q' in log);\n\n// 10.\nlog = {};\ncount = 0;\n\nfor (i in {q : 1, p : 2, get f() { ; }, set f (v) { ; }, get t () { }, set c (v) {}})\n{\n  log [i] = true;\n  count++;\n}\n\nassert (count == 5\n        && 'q' in log\n        && 'p' in log\n        && 'f' in log\n        && 't' in log\n        && 'c' in log);\n\n// 11.\nlog = {};\ncount = 0;\n\nvar a = [];\na[5] = 5;\nfor (var x in a)\n{\n  log[x] = true;\n  count++;\n}\n\nassert (count == 1\n        && '5' in log);\n\n// 12.\nlog = {};\ncount = 0;\n\nq = { c : 3, d : 4 };\n\nfunction p_constructor ()\n{\n  this.a = 1;\n  this.b = 2;\n\n  return this;\n}\n\np_constructor.prototype = q;\np = new p_constructor ();\n\nObject.defineProperty (p, 'h', { value : 5, enumerable : false, configurable : true });\nObject.defineProperty (q, 'h', { value : 6, enumerable : true, configurable : true });\n\nfor (var i in p)\n{\n  log[i] = true;\n  count++;\n}\n\nassert (count == 4\n        && 'a' in log\n        && 'b' in log\n        && 'c' in log\n        && 'd' in log);\n\n// 13.\nlog = {};\ncount = 0;\n\nfunction f()\n{\n  var tmp = { a: 1, b: 2, c: 3, d: 4 };\n\n  return tmp;\n}\n\nfor (var i in f())\n{\n  log[i] = true;\n  count++;\n}\n\nassert (count == 4\n        && 'a' in log\n        && 'b' in log\n        && 'c' in log\n        && 'd' in log);\n\n// 14.\nlog = {};\ncount = 0;\n\nb = 'prop';\nc = { prop : 1 };\nBoolean.prototype.boolean_prototype_prop = 1;\n\nfor (a in b in c)\n{\n  log[a] = true;\n  count++;\n}\n\nassert (count == 1\n        && 'boolean_prototype_prop' in log);\n\n// 15.\nlog = {};\ncount = 0;\n\nfor (a in 'prop' in { prop : 1 })\n{\n  log[a] = true;\n  count++;\n}\n\nassert (count == 1\n        && 'boolean_prototype_prop' in log);\n\n// 16.\na = 'str';\nb = {};\nfor ((a in b) ; ; )\n{\n  break;\n}\n\n// 17.\nlog = {};\ncount = 0;\n\nvar base_obj = { base_prop1: \"base1\", base_prop2: \"base2\" };\n\nfunction l () {\n    this.derived_prop1 = \"derived1\";\n    this.derived_prop2 = \"derived2\";\n}\n\nl.prototype = base_obj;\n\nvar derived_obj = new l();\n\nfor (var prop_of_derived_obj in derived_obj) {\n  delete derived_obj.derived_prop1;\n  delete derived_obj.derived_prop2;\n  delete base_obj.base_prop1;\n  delete base_obj.base_prop2;\n\n  log[prop_of_derived_obj] = true;\n  count++;\n}\n\nassert(count == 1\n       && ('base_prop1' in log\n           || 'base_prop2' in log\n           || 'derived_prop1' in log\n           || 'derived_prop2' in log));\n\ntry {\n  /* This form is a SyntaxError even in ES5.1. */\n  eval(\"for (a = b in {}) ;\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/for-let-reference-error.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nfunction check_reference_error (code)\n{\n  try {\n    eval (code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof ReferenceError)\n  }\n}\n\ncheck_reference_error(\"for (let x of [x]) {}\")\ncheck_reference_error(\"for (const x of [x]) {}\")\n\ncheck_reference_error(\"for (let x in {x}) {}\")\ncheck_reference_error(\"for (const x in {x}) {}\")\n"
  },
  {
    "path": "tests/jerry/for-let.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arr = [];\nfor (let i = 0, j = 0; i < 10; j++)\n{\n  arr[i] = function() { return i + j; }\n  i++;\n}\n\nfor (let i = 0; i < 10; i++)\n  assert(arr[i]() === (i * 2 + 1));\n\nvar j = 0, k = 0;\nfor (let i = 0; j = i, i < 10; i++)\n{\n  let i = -3;\n  assert(i === -3);\n  assert(j === k);\n  k++;\n}\n\nvar j = 0, k = 0;\nfor (let i = 0; eval(\"j = i\"), i < 10; i++)\n{\n  let i = -3;\n  assert(i === -3);\n  assert(j === k);\n  k++;\n}\n\nvar arr = [];\nfor (let i in { x:1, y:1, z:1 })\n{\n  let str = \"P\";\n  arr.push(function () { return str + i; });\n}\n\nassert(arr[0]() === \"Px\");\nassert(arr[1]() === \"Py\");\nassert(arr[2]() === \"Pz\");\n\ntry {\n  for (let i in (function() { return i; })()) {}\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n\ntry {\n  for (let i = 0, j = 0; i < 5; i++, j++)\n  {\n    if (i === 3)\n    {\n      eval(\"throw -42\")\n    }\n  }\n  assert(false);\n} catch (e) {\n  assert(e === -42);\n}\n\nexit: {\n  for (let i = 0, j = 0; i < 5; i++, j++)\n  {\n    if (eval(\"i === 3\")) {\n      assert(i === 3);\n      break exit;\n    }\n  }\n  assert(false);\n}\n\nvar f = null, g = null, h = null;\n\nfor (let i = 0;\n     f = function() { return i }, i < 1;\n     i++, g = function() { return i })\n{\n  h = function() { return i };\n}\nassert(f() === 1);\nassert(g() === 1);\nassert(h() === 0);\n\nvar arr = [];\nfor (const i in { aa:4, bb:5, cc:6 })\n{\n  arr.push(function () { return i });\n}\n\nassert(arr[0]() === \"aa\");\nassert(arr[1]() === \"bb\");\nassert(arr[2]() === \"cc\");\n"
  },
  {
    "path": "tests/jerry/for-of-iterator-close.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction createIterable(arr, methods = {}) {\n  let iterable = function *() {\n    let idx = 0;\n    while (idx < arr.length) {\n      yield arr[idx];\n      idx++;\n    }\n  }();\n  iterable['return'] = methods['return'];\n  iterable['throw'] = methods['throw'];\n\n  return iterable;\n};\n\nfunction close1() {\n  var closed = false;\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { closed = true; return {}; }\n  });\n  for (var it of iter) break;\n  return closed;\n}\n\nassert(close1());\n\nfunction close2() {\n  var closed = false;\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { closed = true; return {}; }\n  });\n  try {\n    for (var it of iter) throw 0;\n    assert(false);\n  } catch(e){\n    assert(e === 0);\n  }\n  return closed;\n}\n\nassert(close2());\n\nfunction close3() {\n  var closed = false;\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { closed = true; return {}; }\n  });\n  for (var it of iter) continue;\n  return closed;\n}\n\nassert(!close3());\n\nfunction close4() {\n  var closed = false;\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { closed = true; throw 6; }\n  });\n  try {\n    for (var it of iter) throw 5;\n    assert(false);\n  } catch(e) {\n    assert(e === 5);\n  }\n  return closed;\n}\n\nassert(close4());\n\nfunction close5() {\n  var closed_called = 0;\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { closed_called++; throw 6; }\n  });\n  try {\n    for (var it of iter) {\n      for (var it of iter) {\n        throw 5;\n      }\n      assert(false);\n    }\n    assert(false);\n  } catch(e) {\n    assert(e === 5);\n  }\n  return closed_called === 2;\n}\n\nassert(close5());\n\nfunction close6() {\n  var closed = false;\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { closed = true; return {}; }\n  });\n  for (var it of iter) {};\n\n  return closed;\n}\n\nassert(!close6());\n\nvar close7_result = false;\nfunction close7() {\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { close7_result = true; throw \"5\"; }\n  });\n\n  for (var it of iter) {\n    return \"foo\";\n  }\n}\n\ntry {\n  close7();\n  assert(false);\n} catch (e) {\n  assert(close7_result);\n  assert(e === \"5\");\n}\n\nfunction close8() {\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { close8_result = true; throw \"5\"; }\n  });\n\n  for (var it of iter) {\n    throw \"foo\";\n  }\n}\n\nvar close8_result = false;\ntry {\n  close8();\n  assert(false);\n} catch (e) {\n  assert(e === \"foo\");\n  assert(close8_result);\n}\n\nfunction close9() {\n  var closed = false;\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { closed = true; throw \"5\"; }\n  });\n\n  try {\n    for (var it of iter) {\n      break;\n    }\n  } finally {\n    assert(closed);\n    throw \"foo\"\n  }\n}\n\ntry {\n  close9();\n  assert(false);\n} catch (e) {\n  assert(e === \"foo\");\n}\n\nfunction close10() {\n  var closed = false;\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { closed = true; return {}; }\n  });\n\n  try {\n    for (var it of iter) {\n      return \"foo\";\n    }\n  } finally {\n    assert(closed);\n    throw \"bar\";\n  }\n}\n\ntry {\n  close10();\n  assert(false);\n} catch (e) {\n  assert(e === \"bar\");\n}\n\nfunction close11() {\n  var closed = false;\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { closed = true; throw \"5\"; }\n  });\n\n  try {\n    for (var it of iter) {\n      return \"foo\";\n    }\n  } finally {\n    assert(closed);\n    throw \"bar\";\n  }\n}\n\ntry {\n  close11();\n  assert(false);\n} catch (e) {\n  assert(e === \"bar\");\n}\n\nfunction close12() {\n  var closed = false;\n  var iter = createIterable([1, 2, 3], {\n    'return': function() { closed = true; throw \"5\"; }\n  });\n\n  try {\n    for (var it of iter) {\n      throw \"foo\";\n    }\n  } finally {\n    assert(closed);\n    throw \"bar\";\n  }\n}\n\ntry {\n  close12();\n  assert(false);\n} catch (e) {\n  assert(e === \"bar\");\n}\n"
  },
  {
    "path": "tests/jerry/for-of-statement-head.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor (a of [1] || [2]) {}\n\n"
  },
  {
    "path": "tests/jerry/for-of.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction parse (txt) {\n  try {\n    eval (txt)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\nfunction checkError (obj) {\n  try {\n    for (var a of obj);\n    assert (false)\n  } catch (e) {\n    assert (e instanceof TypeError)\n  }\n}\n\nvar arr = [1,2,3,4]\n\nvar forOf =\n  \"for var prop of obj\" +\n  \"   obj [prop] += 4\"\nparse (forOf)\n\nvar forOf =\n  \"for [var prop of obj]\" +\n  \"   obj[prop] += 4;\"\nparse (forOf)\n\nvar forOf =\n  \"for (var prop obj)\" +\n  \"   obj[prop] += 4;\"\nparse (forOf)\n\nvar forOf =\n  \"foreach (var prop of obj)\" +\n  \"   obj[prop] += 4;\"\nparse (forOf)\n\nvar forOf =\n  \"for (var a \\\"of\\\" []) {}\"\nparse (forOf)\n\nvar forOf =\n  \"for (let x of [], []) {}\"\nparse (forOf)\n\nvar forOf =\n  \"for (var x of [], []) {}\"\nparse (forOf)\n\ncheckError(7)\n\nvar obj = {}\nObject.defineProperty(obj, Symbol.iterator, { get : function () { throw TypeError ('foo');}});\ncheckError (obj);\n\nvar obj = {\n  [Symbol.iterator] : 5\n}\n\ncheckError (obj);\n\nvar obj = {\n  [Symbol.iterator] () {\n    return 5\n  }\n}\n\ncheckError(obj);\n\nvar obj = {\n  [Symbol.iterator] () {\n    return {}\n  }\n}\ncheckError(obj);\n\nvar obj = {\n  [Symbol.iterator] () {\n    return {\n      next() {\n        return 5;\n      }\n    }\n  }\n}\ncheckError(obj);\n\nvar array = [0, 1, 2, 3, 4, 5];\n\nvar i = 0;\nfor (var a of array) {\n  assert (a === i++);\n}\n\nvar obj = {\n  [Symbol.iterator]() {\n    return {\n      counter : 0,\n      next () {\n        if (this.counter == 10) {\n          return { done : true, value : undefined };\n        }\n        return { done: false, value: this.counter++ };\n      }\n    }\n  }\n}\n\nvar i = 0;\nfor (var a of obj) {\n  assert (a === i++);\n}\n\nvar status = 0;\ni = 0;\n\nfunction yieldNext() {\n  ++status\n  assert(status === 3 || status === 6 || status === 9)\n  return {\n    get value() {\n      ++status\n      assert(status === 4 || status === 7)\n      return \"Res\"\n    },\n    done: ++i >= 3\n  }\n}\n\nobj = {\n  [Symbol.iterator]() {\n    assert(++status === 1)\n    return {\n      get next() {\n        assert(++status === 2)\n        return yieldNext\n      }\n    }\n  }\n}\n\nfunction getX() {\n  ++status\n  assert(status === 5 || status === 8)\n  return { x:0 }\n}\n\nfor (getX().x of obj)\n  ;\nassert(status == 9)\n"
  },
  {
    "path": "tests/jerry/for-parse.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction parse(txt) {\n  try {\n    eval(txt)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof SyntaxError)\n  }\n}\n\nparse(\"for (;;;) print('hello')\") \nparse(\"for (,,) print('hello')\") \nparse(\"for (i = 0; i < 10; i++; ) print('i: ' + i)\") \nparse(\"for (i = 0; i < 10; i++)\")\nparse(\"for i = 0; i < 10; i++ {}\")\nparse(\"for (i = 0;; i < 10; i++) {}\")\nparse(\"for (i = 0; j = 1; i < 10; i++) print('i: '+ i + ' j: ' + j)\")\nparse(\"for (i = 0 j = 5;i<10 || j<10; i++, j++) {}\")\nparse(\"for (i = 0, j = 5; i < 10 || j < 10; i++ j++) {}\")\nparse(\"for (i = 0, j = 5; i < 10 j < 10; i++, j++) {}\")\n\nvar doubleFor =\n\"for (i = 0; i < 5; i++) { \"+ \n\"  for (j = 0; j < 5; j++) { print('i: ' + i + ' j: ' + j) }\";\nparse(doubleFor)\n\nvar doubleFor2 =\n\"for (i = 0; i < 5; i++) { \"+ \n\"  for (j = 0; j < 5; j++) { print('i: ' + i + ' j: ' + j)\";\nparse(doubleFor2)\n"
  },
  {
    "path": "tests/jerry/for-pattern.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (code)\n{\n  try {\n    eval (code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\nvar idx = 0;\nfor (var [a,b] of [[1,2], [3,4]])\n{\n  if (idx == 0)\n  {\n    assert(a === 1);\n    assert(b === 2);\n    idx = 1;\n  }\n  else\n  {\n    assert(a === 3);\n    assert(b === 4);\n  }\n}\n\nassert(a === 3);\nassert(b === 4);\n\nidx = 0;\nfor (let [a,b] of [[5,6], [7,8]])\n{\n  if (idx == 0)\n  {\n    assert(a === 5);\n    assert(b === 6);\n    idx = 1;\n  }\n  else\n  {\n    assert(a === 7);\n    assert(b === 8);\n  }\n}\n\nassert(a === 3);\nassert(b === 4);\n\nidx = 0;\nfor (let [a,b] of [[11,12], [13,14]])\n{\n  if (idx == 0)\n  {\n    eval(\"assert(a === 11)\");\n    eval(\"assert(b === 12)\");\n    idx = 1;\n  }\n  else\n  {\n    eval(\"assert(a === 13)\");\n    eval(\"assert(b === 14)\");\n  }\n}\n\nassert(a === 3);\nassert(b === 4);\n\ncheck_syntax_error(\"for (let [a,b] = [1,2] of [[3,4]]) {}\")\n\nidx = 0;\nfor ([a,b] of [[10,true], [\"x\",null]])\n{\n  if (idx == 0)\n  {\n    assert(a === 10);\n    assert(b === true);\n    idx = 1;\n  }\n  else\n  {\n    assert(a === \"x\");\n    assert(b === null);\n  }\n}\n\nassert(a === \"x\");\nassert(b === null);\n\ncheck_syntax_error(\"for ([a,b] = [1,2] of [[3,4]]) {}\")\n\nvar o = {}\nfor ([a, b] = [o,false]; false; )\n{\n  assert(false);\n}\n\nassert(a === o);\nassert(b === false);\n\nfor ([a, b] + [a, b]; false; )\n{\n  assert(false);\n}\n\ncheck_syntax_error(\"for ([a,b] + 1 of [[3,4]]) {}\")\n"
  },
  {
    "path": "tests/jerry/for.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// 1.\nvar i = 0;\nfor (; i < 100; i++) {\n}\nassert(i == 100);\n\n// 2.\nfor (var j = 0; j < 100; j++) {\n}\nassert(j == 100);\n\n// 3.\nfor (i = 0; ; ) {\n  if (i == 100) {\n    break;\n    assert(false);\n  }\n  i++;\n}\nassert(i == 100);\n\n// 4.\nfor (i = 0; i < 10; i++) {\n  for (j = 0; j < 10; j++) {\n  }\n}\nassert(i != 100);\nassert(j != 100);\nassert(i == 10);\nassert(j == 10);\n\n// 5.\ns = '';\nfor (\nvar i = {x: 0};\n\n i.x < 2\n;\n i.x++\n\n)\n {\n  s += i.x;\n}\n\nassert (s === '01');\n\n// 6.\ns = '';\nfor (\nvar i = {x: 0};\n\n i.x < 2\n;\n\n i.x++\n\n)\n {\n  s += i.x;\n}\n\nassert (s === '01');\n\n// 7.\na = [];\nfor (; a[0]; ) {\n  assert (false);\n}\n"
  },
  {
    "path": "tests/jerry/forin-header-strict.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n'use strict';\ntry {\n  eval('for (var i = 0 in {}) {}');\n  assert(false);\n} catch(e) {\n  assert(e instanceof SyntaxError);\n}\n\ntry {\n  eval('for (var = i of {}) {}');\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\nvar reached = false;\n\nfor (var i in {}) {\n  reached = true;\n}\nassert(!reached);\n\nfor (var i of []) {\n  reached = true;\n}\nassert(!reached);\n\nfor (let i in {}) {\n  reached = true;\n}\nassert(!reached);\n\nfor (let i of []) {\n  reached = true;\n}\nassert(!reached);\n\nfor (const i in {}) {\n  reached = true;\n}\nassert(!reached);\n\nfor (const i of []) {\n  reached = true;\n}\nassert(!reached);\n"
  },
  {
    "path": "tests/jerry/func-decl.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f() {\n    return 'foo';\n}\nassert ((function() {\n    if (1 === 1) {\n        function f() {\n            return 'bar';\n        }\n    }\n    return f();\n})() === 'bar');\n\nfunction check_syntax_error (s) {\n  try {\n    eval (s);\n    assert (false);\n  }\n  catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\ncheck_syntax_error (\"'use strict'; function arguments () {}\");\ncheck_syntax_error (\"'use strict'; var l = function arguments () {}\");\n\ncheck_syntax_error (\"function f__strict_mode_duplicate_parameters (p, p) { 'use strict'; }\");\n\nfunction test_strict_mode_propagation_in_func_expr_and_getters_setters () {\n  var p = function () {\n    'use strict';\n\n    return true;\n  }\n\n  var o = { get prop () { 'use strict'; return true; }, set prop (v) { 'use strict'; } };\n\n  function test () {\n    tmp_eval = eval;\n    eval = tmp_eval;\n  }\n}\n"
  },
  {
    "path": "tests/jerry/function-accessor.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar g = (Object.getOwnPropertyDescriptor({get a(){}}, 'a')).get;\n\ntry {\n  new g;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar s = (Object.getOwnPropertyDescriptor({set a(value){}}, 'a')).set;\n\ntry {\n  new s;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/function-args.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f1(x)\n{\n  var c1 = (x >= 1);\n  var c2 = (x <= 10);\n\n  if (c1 === true)\n  {\n    if (c2 === true)\n    {\n      assert(t);\n\n      return;\n    }\n  }\n\n  assert(t === false);\n}\n\nvar i;\nvar t = true;\n\nfor(i = 1; i <= 10; i++)\n{\n  f1(i);\n}\n\nt = false;\n\nfor(i = 11; i <= 20; i++)\n{\n  f1(i);\n}\n\nfunction g (p, p) {\n  assert (p === arguments[1]);\n  assert (p === 'second');\n}\n\ng ('first', 'second');\n\ntry {\n  f1 ({});\n  f1 (undefined_variable);\n  assert (false);\n}\ncatch (e) {\n  assert (e instanceof ReferenceError);\n}\n\nfunction f2 ()\n{\n  return this;\n}\n\nwith ({})\n{\n  assert (f2 () === this);\n}\n"
  },
  {
    "path": "tests/jerry/function-arguments-caller.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f_simple () {\n}\n\nfunction f_strict () {\n  \"use strict\";\n}\n\ntry {\n  Function.prototype[\"arguments\"];\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(f_simple[\"arguments\"] === null);\n\ntry {\n  f_strict[\"arguments\"];\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nlet desc = Object.getOwnPropertyDescriptor(f_simple, \"arguments\");\nassert(desc.value === null);\nassert(desc.writable === false);\nassert(desc.enumerable === false);\nassert(desc.configurable === false);\nassert(Object.getOwnPropertyDescriptor(f_strict, \"arguments\") === undefined);\n\ntry {\n  Function.prototype[\"caller\"];\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(f_simple[\"caller\"] === undefined);\n\ntry {\n  f_strict[\"caller\"];\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ndesc = Object.getOwnPropertyDescriptor(f_simple, \"caller\");\nassert(desc.value === undefined);\nassert(desc.writable === false);\nassert(desc.enumerable === false);\nassert(desc.configurable === false);\nassert(Object.getOwnPropertyDescriptor(f_strict, \"arguments\") === undefined);\n"
  },
  {
    "path": "tests/jerry/function-async-gen1.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar successCount = 0\n\nfunction check_fulfilled(p, value, done)\n{\n  assert(p instanceof Promise)\n\n  p.then(function(v) {\n    assert(v.value === value)\n    assert(v.done === done)\n    successCount++\n  }, function() {\n    assert(false)\n  })\n}\n\nfunction check_rejected(p, value)\n{\n  assert(p instanceof Promise)\n\n  p.then(function(v) {\n    assert(false)\n  }, function(v) {\n    assert(v === value)\n    successCount++\n  })\n}\n\n\nfunction check_type_error(p)\n{\n  assert(p instanceof Promise)\n\n  p.then(function(v) {\n    assert(false)\n  }, function(v) {\n    assert(v instanceof TypeError);\n    successCount++\n  })\n}\n\n// Test 1\n\nvar gen, r, o\n\nasync function *f1(p, o) {\n  assert((yield \"Test1\") === \"Test2\")\n  await p\n\n  assert((yield 1.5) === 2.5)\n  await \"String\"\n\n  return o\n}\n\nassert(Object.prototype.toString.call(f1) === \"[object AsyncGeneratorFunction]\")\n\no = {}\ngen = f1(new Promise(function(resolve, reject) { r = resolve }), o)\n\nassert(Object.prototype.toString.call(gen) === \"[object AsyncGenerator]\")\n\ncheck_fulfilled(gen.next(), \"Test1\", false)\ncheck_fulfilled(gen.next(\"Test2\"), 1.5, false)\ncheck_fulfilled(gen.next(2.5), o, true)\ncheck_fulfilled(gen.next(), undefined, true)\ncheck_fulfilled(gen.next(), undefined, true)\ncheck_type_error(gen.next.call(undefined))\ncheck_type_error(gen.throw.call(undefined))\ncheck_type_error(gen.return.call(undefined))\n\nr(1)\n\n// Test 2\n\nasync function *f2(o) {\n  try {\n    await {}\n    yield o\n    assert(false)\n  } catch (e) {\n    assert(e === \"Throw\")\n  }\n\n  try {\n    await \"String\"\n    yield 12\n    assert(false)\n  } catch (e) {\n    assert(e === o)\n\n    throw o\n  }\n}\n\no = {}\ngen = f2(o)\ncheck_fulfilled(gen.next(), o, false)\ncheck_fulfilled(gen.throw(\"Throw\"), 12, false)\ncheck_rejected(gen.throw(o), o)\n\ncheck_fulfilled(gen.next(), undefined, true)\ncheck_rejected(gen.throw(), undefined)\ncheck_fulfilled(gen.return(), undefined, true)\n\n// Test 3\n\nasync function *f3() {\n  throw \"Msg\"\n}\n\ngen = f3()\ncheck_rejected(gen.next(), \"Msg\")\ngen = f3()\ncheck_rejected(gen.throw(\"End\"), \"End\")\n\n// Test 4\n\nasync function *f4() {\n  assert(++state === 1)\n  await 1\n  assert(++state === 4)\n}\n\nvar state = 0\ngen = f4()\ngen.next()\n\nassert(++state === 2)\ngen.next()\nassert(++state === 3)\n\n// Test 5\n\nasync function *f5() {\n  assert(++state2 === 1)\n  yield 1\n  assert(++state2 === 4)\n}\n\nvar state2 = 0\ngen = f5()\ngen.next()\n\nassert(++state2 === 2)\ngen.next()\nassert(++state2 === 3)\n\n// Test 6\n\nasync function *f6() {\n  return \"Res\"\n}\n\nvar genLate = f6()\nvar p = genLate.next()\n\nassert(p instanceof Promise)\n\np.then(function(v) {\n  assert(v.value === \"Res\")\n  assert(v.done === true)\n  successCount++\n\n  check_fulfilled(genLate.next(), undefined, true)\n  var o = {}\n  check_rejected(genLate.throw(o), o)\n  check_fulfilled(genLate.return(), undefined, true)\n}, function() {\n  assert(false)\n})\n\n// Test 7\n\nvar AsyncGeneratorFun = Object.getPrototypeOf(async function *() {}).constructor;\n\no = {}\ngen = AsyncGeneratorFun(\"p, o, x = 5.5\", \"assert((await p) === 'P'); yield o; return x\")\ngen = gen(new Promise(function(resolve, reject) { r = resolve }), o)\n\ncheck_fulfilled(gen.next(), o, false)\ncheck_fulfilled(gen.next(), 5.5, true)\ncheck_fulfilled(gen.next(), undefined, true)\ncheck_fulfilled(gen.next(), undefined, true)\n\nr(\"P\")\n\n// Test 8\n\nasync function *f8() {\n  var o = {}\n  function f() {}\n\n  check_fulfilled(selfGen.next(), o, false)\n  check_fulfilled(selfGen.next(), f, true)\n  check_fulfilled(selfGen.next(), undefined, true)\n\n  yield \"Str\"\n  yield o\n  return f\n}\n\nvar selfGen = f8();\ncheck_fulfilled(selfGen.next(), \"Str\", false)\n\n// Test 9\n\nasync function *f9() {\n  try {\n    yield \"X\"\n  } finally {\n    successCount++;\n  }\n  yield \"Y\"\n  return 1;\n}\n\ngen = f9()\ncheck_fulfilled(gen.next(), \"X\", false)\ncheck_fulfilled(gen.return(\"Ret\"), \"Ret\", true)\ncheck_fulfilled(gen.next(), undefined, true)\n\n// END\n\nfunction __checkAsync() {\n  assert(successCount === 32)\n  assert(state === 4)\n  assert(state2 === 4)\n}\n"
  },
  {
    "path": "tests/jerry/function-async-gen2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar successCount = 0\n\nfunction check_fulfilled(p, value, done)\n{\n  assert(p instanceof Promise)\n\n  p.then(function(v) {\n    assert(v.value === value)\n    assert(v.done === done)\n    successCount++\n  }, function() {\n    assert(false)\n  })\n}\n\nfunction check_rejected(p, value)\n{\n  assert(p instanceof Promise)\n\n  p.then(function(v) {\n    assert(false)\n  }, function(v) {\n    assert(v === value)\n    successCount++\n  })\n}\n\n// Test 1\n\nvar o1 = {}\nvar arr1 = []\nvar async1 = {\n  [Symbol.asyncIterator]() {\n    arr1 = []\n    var i = 0\n    return {\n      next(v) {\n        var res\n\n        if (i == 0) {\n          assert(v === undefined)\n          res = { value:\"Res\", done:false }\n        } else if (i == 1) {\n          assert(v === \"B\")\n          res = { value:{}, done:false }\n        } else if (i == 2) {\n          assert(v === o1)\n          res = Promise.resolve(\"Nested\")\n          res = { value:res, done:false }\n        } else {\n          assert(v === -1.5)\n          res = { value:3.5, done:true }\n        }\n        i++\n\n        arr1.push(res)\n        return Promise.resolve(res)\n      }\n    }\n  }\n}\n\nasync function *f1() {\n  successCount++\n  assert((yield *async1) === 3.5)\n  successCount++\n  return \"End\"\n}\n\nasync function f1_run() {\n  var gen = f1()\n\n  var res = await gen.next(\"A\")\n  assert(res != arr1[0])\n  assert(res.value === \"Res\")\n  assert(arr1[0].value === \"Res\")\n  assert(res.done === false)\n  assert(arr1[0].done === false)\n  successCount++\n\n  var res = await gen.next(\"B\")\n  assert(res != arr1[1])\n  assert(res.value === arr1[1].value)\n  assert(res.done === false)\n  assert(arr1[1].done === false)\n  successCount++\n\n  var res = await gen.next(o1)\n  assert(res != arr1[2])\n  assert(res.value === \"Nested\")\n  assert(arr1[2].value instanceof Promise)\n  assert(res.done === false)\n  assert(arr1[2].done === false)\n  successCount++\n\n  var res = await gen.next(-1.5)\n  assert(res.value === \"End\")\n  assert(res.done === true)\n  successCount++\n}\n\nf1_run()\n\n// Test 2\n\nvar o2 = {}\nvar async2 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next() {\n        throw \"Except\"\n      }\n    }\n  }\n}\n\nasync function *f2() {\n  successCount++\n  try {\n    try {\n      yield *async2\n      assert(false)\n    } finally {\n      successCount++\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === \"Except\")\n    successCount++\n    throw o2\n  }\n  assert(false)\n}\n\nvar gen = f2()\ncheck_rejected(gen.next(), o2)\n\n// Test 3\n\nvar o3 = {}\nvar async3 = {\n  [Symbol.asyncIterator]() {\n    var i = 0\n    return {\n      next() {\n        if (i == 0) {\n          i++\n          return { value:6.25, done:false }\n        }\n        throw o3\n      }\n    }\n  }\n}\n\nasync function *f3() {\n  successCount++\n  try {\n    try {\n      yield *async3\n      assert(false)\n    } finally {\n      successCount++\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === o3)\n    successCount++\n    return o3\n  }\n  assert(false)\n}\n\nvar gen = f3()\ncheck_fulfilled(gen.next(), 6.25, false)\ncheck_fulfilled(gen.next(), o3, true)\n\n// Test 4\n\nvar async4 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next() {\n        /* Returns with a promise which fails. */\n        return { value:Promise.reject(\"Failed!\"), done:false }\n      }\n    }\n  }\n}\n\nasync function *f4() {\n  successCount++\n  try {\n    try {\n      yield *async4\n      assert(false)\n    } finally {\n      successCount++\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === \"Failed!\")\n    successCount++\n    return\n  }\n  assert(false)\n}\n\nvar gen = f4()\ncheck_fulfilled(gen.next(), undefined, true)\n\n// Test 5\n\nvar async5 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next() {\n        /* Returns with a promise which fails. */\n        return { value:Promise.reject(\"FailedAndDone!\"), done:true }\n      }\n    }\n  }\n}\n\nasync function *f5() {\n  successCount++\n  try {\n    var p = yield *async5\n    assert(p instanceof Promise)\n    check_rejected(p, \"FailedAndDone!\")\n    successCount++\n  } catch (e) {\n    assert(false)\n  }\n}\n\nvar gen = f5()\ncheck_fulfilled(gen.next(), undefined, true)\n\n// Test 6\n\nvar state = 0\n\nvar o6 = {}\nvar async6 = {\n  [Symbol.asyncIterator]() {\n    var i = 0\n    assert(++state === 2)\n\n    return {\n      next() {\n        i++\n        if (i == 1) {\n          assert(++state === 3)\n          return { value:5.75, done:false }\n        } else if (i == 2) {\n          assert(++state === 7)\n          return { value:o6, done:false }\n        } else if (i == 3) {\n          assert(++state === 8)\n          return { value:\"Val\", done:true }\n        }\n      }\n    }\n  }\n}\n\nasync function *f6() {\n  assert(++state === 1)\n\n  assert((yield *async6) === \"Val\")\n\n  assert(++state === 9)\n  return \"End\"\n}\n\nvar gen = f6()\ncheck_fulfilled(gen.next(), 5.75, false)\nassert(++state === 4)\ncheck_fulfilled(gen.next(), o6, false)\nassert(++state === 5)\ncheck_fulfilled(gen.next(), \"End\", true)\nassert(++state === 6)\n\n// END\n\nfunction __checkAsync() {\n  assert(successCount === 26)\n  assert(state === 9)\n}\n"
  },
  {
    "path": "tests/jerry/function-async-gen3.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar successCount = 0\n\nfunction check_fulfilled(p, value, done)\n{\n  assert(p instanceof Promise)\n\n  p.then(function(v) {\n    assert(v.value === value)\n    assert(v.done === done)\n    successCount++\n  }, function() {\n    assert(false)\n  })\n}\n\nfunction check_rejected(p, value)\n{\n  assert(p instanceof Promise)\n\n  p.then(function(v) {\n    assert(false)\n  }, function(v) {\n    assert(v === value)\n    successCount++\n  })\n}\n\n// Test 1\n\nvar o1 = Promise.reject(\"Err\")\nvar async1 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next(v) {\n        assert(v === undefined)\n        return { value:0, done:false }\n      },\n      throw(v) {\n        assert(v === \"Except\")\n        /* Failed result result. */\n        throw o1\n      }\n    }\n  }\n}\n\nasync function *f1() {\n  successCount++\n  try {\n    try {\n      yield *async1\n      assert(false)\n    } finally {\n      successCount++\n    }\n    assert(false)\n  } catch (e) {\n    assert(e === o1)\n    successCount++\n    return\n  }\n  assert(false)\n}\n\nvar gen = f1()\ncheck_fulfilled(gen.next(), 0, false)\ncheck_fulfilled(gen.throw(\"Except\"), undefined, true)\n\n// Test 2\n\nvar o2 = Promise.resolve(\"Message\")\nvar async2 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next(v) {\n        assert(v === undefined)\n        return { value:1, done:false }\n      },\n      throw(v) {\n        assert(v === o2)\n        /* Successful result. */\n        return { value:o2, done:false }\n      }\n    }\n  }\n}\n\nasync function *f2() {\n  successCount++\n  try {\n    yield *async2\n  } finally {\n    /* Never completes. */\n    assert(false)\n  }\n}\n\nvar gen = f2()\ncheck_fulfilled(gen.next(), 1, false)\ncheck_fulfilled(gen.throw(o2), \"Message\", false)\n\n// Test 3\n\nvar o3 = Promise.resolve(\"Message\")\nvar async3 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next(v) {\n        assert(v === undefined)\n        return { value:2, done:false }\n      },\n      throw(v) {\n        assert(v === -2.5)\n        /* Successful result. */\n        return { value:o3, done:true }\n      }\n    }\n  }\n}\n\nasync function *f3() {\n  successCount++\n  assert((yield *async3) === o3)\n  successCount++\n  return -4.25\n}\n\nvar gen = f3()\ncheck_fulfilled(gen.next(), 2, false)\ncheck_fulfilled(gen.throw(-2.5), -4.25, true)\n\n// Test 4\n\nvar async4 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next(v) {\n        assert(v === undefined)\n        return { value:3, done:false }\n      }\n    }\n  }\n}\n\nasync function *f4() {\n  successCount++\n  try {\n    yield *async4\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n    successCount++\n  }\n}\n\nvar gen = f4()\ncheck_fulfilled(gen.next(), 3, false)\ncheck_fulfilled(gen.throw(), undefined, true)\n\n// Test 5\n\nvar async5 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next(v) {\n        assert(v === undefined)\n        return { value:4, done:false }\n      },\n      return(v) {\n        assert(v === undefined)\n        throw \"Close!\"\n      }\n    }\n  }\n}\n\nasync function *f5() {\n  successCount++\n  try {\n    yield *async5\n    assert(false)\n  } catch (e) {\n    assert(e === \"Close!\")\n    successCount++\n  }\n}\n\nvar gen = f5()\ncheck_fulfilled(gen.next(), 4, false)\ncheck_fulfilled(gen.throw(1), undefined, true)\n\n// Test 6\n\nvar o6 = Promise.resolve(\"Return!\")\nvar async6 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next(v) {\n        assert(v === undefined)\n        return { value:5, done:false }\n      }\n    }\n  }\n}\n\nasync function *f6() {\n  successCount++\n  try {\n    yield *async6\n    assert(false)\n  } finally {\n    successCount++\n  }\n}\n\nvar gen = f6()\ncheck_fulfilled(gen.next(), 5, false)\ncheck_fulfilled(gen.return(o6), \"Return!\", true)\n\n// Test 7\n\nvar arr = []\nvar o7 = Promise.resolve(arr)\nvar async7 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next(v) {\n        assert(v === undefined)\n        return { value:6, done:false }\n      },\n      return(v) {\n        assert(v === arr)\n        /* Successful result. */\n        return { value:o7, done:false }\n      }\n    }\n  }\n}\n\nasync function *f7() {\n  successCount++\n  try {\n    yield *async7\n  } finally {\n    /* Never completes. */\n    assert(false)\n  }\n}\n\nvar gen = f7()\ncheck_fulfilled(gen.next(), 6, false)\ncheck_fulfilled(gen.return(o7), arr, false)\n\n// Test 8\n\nvar o8 = Promise.resolve(6.75)\nvar async8 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next(v) {\n        assert(v === undefined)\n        return { value:7, done:false }\n      },\n      return(v) {\n        assert(v === 6.75)\n        /* Successful result. */\n        return { value:o8, done:true }\n      }\n    }\n  }\n}\n\nasync function *f8() {\n  successCount++\n  try {\n    yield *async8\n  } finally {\n    successCount++\n  }\n  /* Return skips this code path. */\n  assert(false)\n}\n\nvar gen = f8()\ncheck_fulfilled(gen.next(), 7, false)\ncheck_fulfilled(gen.return(o8), o8, true)\n\n// Test 9\n\nvar o9 = Promise.reject(\"reject\")\nvar async9 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next(v) {\n        assert(v === undefined)\n        return { value:8, done:false }\n      },\n      throw(v) {\n        assert(v === \"reject\")\n        throw \"End\"\n      },\n      get return() {\n        assert(false)\n      }\n    }\n  }\n}\n\nasync function *f9() {\n  successCount++\n  try {\n    yield *async9\n  } catch (e) {\n    successCount++\n    assert(e === \"End\")\n    throw e\n  }\n  /* Throw skips this code path. */\n  assert(false)\n}\n\nvar gen = f9()\ncheck_fulfilled(gen.next(), 8, false)\ncheck_rejected(gen.return(o9), \"End\")\n\n// Test 10\n\nvar o10 = Promise.reject(arr)\nvar async10 = {\n  [Symbol.asyncIterator]() {\n    return {\n      next(v) {\n        assert(v === undefined)\n        return { value:9, done:false }\n      },\n      get return() {\n        successCount++\n        return function() {\n          /* Only called during iterator close. */\n          assert(arguments.length === 0)\n          successCount++\n        }\n      }\n    }\n  }\n}\n\nasync function *f10() {\n  successCount++\n  try {\n    yield *async10\n  } catch (e) {\n    successCount++\n    assert(e instanceof TypeError)\n    throw -3.25\n  }\n  assert(false)\n}\n\nvar gen = f10()\ncheck_fulfilled(gen.next(), 9, false)\ncheck_rejected(gen.return(o10), -3.25)\n\n// END\n\nfunction __checkAsync() {\n  assert(successCount == 41)\n}\n"
  },
  {
    "path": "tests/jerry/function-async-gen4.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar successCount = 0\n\nfunction check_fulfilled(p, value, done)\n{\n  assert(p instanceof Promise)\n\n  p.then(function(v) {\n    assert(v.value === value)\n    assert(v.done === done)\n    successCount++\n  }, function() {\n    assert(false)\n  })\n}\n\nfunction check_rejected(p, value)\n{\n  assert(p instanceof Promise)\n\n  p.then(function(v) {\n    assert(false)\n  }, function(v) {\n    assert(v === value)\n    successCount++\n  })\n}\n\n// Test 1\n\nvar o1 = {}\nvar state1 = 0\nvar async1 = {\n  [Symbol.asyncIterator]() {\n    return {\n      get next() {\n        assert(++state1 === 2)\n        return function () {\n          return { value:\"Res\", done:false }\n        }\n      },\n      get throw() {\n        ++state1\n        assert(state1 === 5 || state1 === 7 || state1 == 9)\n        return function (v) {\n          assert(v === \"Input\")\n          return { value:o1, done:false }\n        }\n      },\n      get return() {\n        ++state1\n        assert(state1 === 6 || state1 === 8 || state1 == 10)\n        return function (v) {\n          assert(v === o1)\n          return { value:4.5, done:false }\n        }\n      }\n    }\n  }\n}\n\nasync function *f1() {\n  assert(++state1 === 1)\n  yield *async1\n  assert(false)\n}\n\nvar gen = f1()\ncheck_fulfilled(gen.next(), \"Res\", false)\nassert(++state1 === 3)\ncheck_fulfilled(gen.throw(\"Input\"), o1, false)\ncheck_fulfilled(gen.return(o1), 4.5, false)\n\ncheck_fulfilled(gen.next(), \"Res\", false)\ncheck_fulfilled(gen.throw(\"Input\"), o1, false)\ncheck_fulfilled(gen.return(o1), 4.5, false)\n\ncheck_fulfilled(gen.next(), \"Res\", false)\ncheck_fulfilled(gen.throw(\"Input\"), o1, false)\ncheck_fulfilled(gen.return(o1), 4.5, false)\nassert(++state1 === 4)\n\n// Test 2\n\nvar state2 = 0\nvar async2 = {\n  [Symbol.asyncIterator]() {\n    return {\n      get next() {\n        assert(++state2 === 2)\n        return \"Not callable\"\n      }\n    }\n  }\n}\n\nasync function *f2() {\n  assert(++state2 === 1)\n  try {\n    yield *async2\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n  }\n  return \"End\"\n}\n\ngen = f2()\ncheck_fulfilled(gen.next(), \"End\", true)\n\n// END\n\nfunction __checkAsync() {\n  assert(state1 == 10)\n  assert(state2 == 2)\n  assert(successCount == 10)\n}\n"
  },
  {
    "path": "tests/jerry/function-async1.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* This test checks async modifiers (nothing else). */\n\nfunction check_promise(p, value)\n{\n  assert(p instanceof Promise)\n\n  p.then(function(v) {\n    assert(v === value)\n  })\n}\n\n/* Async functions */\n\nasync function f(a) {\n  return a\n}\n\ncheck_promise(f(1), 1)\n\nf = async function (a) { return a }\ncheck_promise(f(2), 2)\n\nf = (async function (a) { return a })\ncheck_promise(f(3), 3)\n\nf = [async function (a) { return a }]\ncheck_promise(f[0](4), 4)\n\n/* These four are parser tests. */\nasync => {}\nasync async => {}\n(async => {})\n(async async => {})\n\nf = async => async;\nassert(f(5) === 5)\n\nf = async async => async;\ncheck_promise(f(6), 6)\n\nf = (async => async)\nassert(f(7) === 7)\n\nf = (async async => async)\ncheck_promise(f(8), 8)\n\nf = [async => async]\nassert(f[0](9) === 9)\n\nf = [async async => async]\ncheck_promise(f[0](10), 10)\n\nf = async (a, b) => a + b;\ncheck_promise(f(10, 1), 11)\n\nf = (async (a, b) => a + b);\ncheck_promise(f(10, 2), 12)\n\nf = [async (a, b) => a + b];\ncheck_promise(f[0](10, 3), 13)\n\nf = true ? async () => 14 : 0;\ncheck_promise(f(), 14)\n\nf = (1, async async => async)\ncheck_promise(f(15), 15)\n\n/* Functions contain async references */\n\nfunction f1() {\n  var async = 1;\n\n  /* The arrow function after the newline should be ignored. */\n  var v1 = async\n  async => async\n\n  /* The function statement after the newline should not be an async function. */\n  var v2 = async\n  function g() { return 2 }\n\n  async\n  function h() { return 3 }\n\n  assert(v1 === 1)\n  assert(v2 === 1)\n  assert(g() === 2)\n  assert(h() === 3)\n}\nf1();\n\nfunction f2() {\n  var async = 1;\n\n  function g() { async = 2; }\n  g();\n\n  assert(async == 2);\n}\nf2();\n\nfunction f3() {\n  var v = 3;\n  var async = () => v = 4;\n\n  function g() { async(); }\n  g();\n\n  assert(v === 4);\n}\nf3();\n\nfunction f4() {\n  var v = 5;\n  var async = (a, b) => v = a + b;\n\n  function g() { async(((v)), ((v))); }\n  g();\n\n  assert(v === 10);\n}\nf4();\n\nfunction f5() {\n  var v = 0;\n  var async = (a, b) => v = a + b;\n\n  function g() { async((async(1,2)), ((async(3,4)))); }\n  g();\n\n  assert(v === 10);\n}\nf5();\n"
  },
  {
    "path": "tests/jerry/function-async2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* This test checks async modifiers (nothing else). */\n\nfunction check_syntax_error (code)\n{\n  try {\n    eval (code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\ncheck_syntax_error(\"function async f() {}\")\ncheck_syntax_error(\"(a,b) async => 1\")\n/* SyntaxError because arrow declaration is an assignment expression. */\ncheck_syntax_error(\"async * (a,b) => 1\")\ncheck_syntax_error(\"({ *async f() {} })\")\ncheck_syntax_error(\"class C { async static f() {} }\")\ncheck_syntax_error(\"class C { * async f() {} }\")\ncheck_syntax_error(\"class C { static * async f() {} }\")\n\n\nfunction check_promise(p, value)\n{\n  assert(p instanceof Promise)\n\n  p.then(function(v) {\n    assert(v === value)\n  })\n}\n\nvar o = {\n  async f() { return 1 },\n  async() { return 2 },\n  async *x() {}, /* Parser test, async iterators are needed to work. */\n}\n\ncheck_promise(o.f(), 1)\nassert(o.async() === 2)\n\nclass C {\n  async f() { return 3 }\n  async *x() {} /* Parser test, async iterators are needed to work. */\n  static async f() { return 4 }\n  static async *y() {} /* Parser test, async iterators are needed to work. */\n  async() { return 5 }\n  static async() { return 6 }\n}\n\nvar c = new C\n\ncheck_promise(c.f(), 3)\ncheck_promise(C.f(), 4)\nassert(c.async() === 5)\nassert(C.async() === 6)\n"
  },
  {
    "path": "tests/jerry/function-async3.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* This test async prototype. */\n\nvar proto1 = Object.getPrototypeOf(async () => {})\nvar proto2 = Object.getPrototypeOf(async function () {})\n\nassert(proto1 === proto2)\nassert(typeof proto1 === \"object\")\nassert(proto1[Symbol.toStringTag] === \"AsyncFunction\")\nassert(typeof proto1.constructor === \"function\")\nassert(proto1.constructor.name === \"AsyncFunction\")\n\nvar successCount = 0\nvar f = proto1.constructor(\"p\", \"assert(await p === 'Res'); successCount++\")\nf(Promise.resolve(\"Res\"))\n\nfunction __checkAsync() {\n  assert(successCount === 1)\n}\n"
  },
  {
    "path": "tests/jerry/function-await1.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* This test checks await expressions (nothing else). */\n\nfunction check_syntax_error (code)\n{\n  try {\n    eval (code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\ncheck_syntax_error(\"(async function await() {})\")\ncheck_syntax_error(\"(async function *await() {})\")\ncheck_syntax_error(\"async function f(await) {}\")\ncheck_syntax_error(\"(async function f(await) {})\")\ncheck_syntax_error(\"async function f(a = await new Promise) {}\")\ncheck_syntax_error(\"async function f() { function await() {} }\")\ncheck_syntax_error(\"async await => 0\");\ncheck_syntax_error(\"async (await) => 0\");\ncheck_syntax_error(\"async function f() { await () => 0 }\");\ncheck_syntax_error(\"async (a) => a\\\\u0077ait a\");\ncheck_syntax_error(\"async (a) => { () => 0\\na\\\\u0077ait a }\");\n\n// Valid uses of await\n\nasync a => await a\nasync a => { await a }\nasync (a) => await a\nasync(a) => { await a }\n\n// Nested async and non-async functions\n\nasync (a) => {\n  () => await\n  await a\n}\n\n(a) => {\n  await\n  async (a) => await a\n  await\n  async (a) => await a\n  a\\u0077ait\n}\n\nasync function f1(a) {\n  await a\n  (function () { await ? async function(a) { await a } : await })\n  await a\n}\n\nasync (a) => {\n  await a;\n  () => await ? async (a) => await a : await\n  await a\n}\n\nasync (a) => {\n  (a = () => await, [b] = (c))\n  await a\n  (a, b = () => await)\n  await a\n}\n\n// Object initializers\n\nvar o = {\n  async await(a) {\n    await a;\n    () => await\n    await a\n  },\n\n  f(a) {\n    await\n    async (a) => await a\n    await\n    async (a) => await a\n    a\\u0077ait\n  },\n\n  async [\"g\"] () {\n    await a;\n    () => await\n    await a\n  }\n}\n\nasync function f2(a) {\n  var o = {\n    [await a]() { await % await }\n  }\n  await a;\n}\n\nclass C {\n  async await(a) {\n    await a;\n    () => await\n    await a\n  }\n\n  f(a) {\n    await\n    async (a) => await a\n    await\n    async (a) => await a\n    a\\u0077ait\n  }\n\n  async [\"g\"] () {\n    await a;\n    () => await\n    await a\n  }\n}\n\nasync function f3(a) {\n  class C {\n    [await a]() { await % await }\n  }\n  await a;\n}\n"
  },
  {
    "path": "tests/jerry/function-await2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar successCount = 0\nvar p, r\n\n// Test 1\n\nasync function f1(p)\n{\n  assert(await p === 1)\n  return 2\n}\n\np = new Promise(function(resolve, reject) { r = resolve })\n\nf1(p).then(function (v) {\n  assert(v === 2)\n  successCount++\n})\n\nr(1)\n\n// Test 2\n\nvar f2 = async(p) =>\n{\n  assert(await p === 3)\n}\n\np = new Promise(function(resolve, reject) { r = resolve })\n\nf2(p).then(function (v) {\n  assert(v === undefined)\n  successCount++\n})\n\nr(3)\n\n// Test 3\n\nvar thenableCounter = 0\n\nasync function f3()\n{\n  return new Promise(function(resolve) { resolve(f3) })\n}\n\nf3.then = function(resolve) {\n  // Repeating resolve with 'then'\n  if (++thenableCounter < 5) {\n    resolve(f3)\n  } else {\n    successCount++\n  }\n}\n\nf3()\n\n// Test 4\n\nasync function f4(p)\n{\n  try {\n    throw 4\n  } catch (e) {\n    throw 5\n  }\n}\n\np = new Promise(function(resolve, reject) { r = resolve })\n\nf4(p).then(undefined, function (v) {\n  assert(v === 5)\n  successCount++\n})\n\nr(1)\n\n// Test 5\n\nasync function f5(p)\n{\n  try {\n    return 6\n  } finally {\n    throw 7\n  }\n}\n\np = new Promise(function(resolve, reject) { r = resolve })\n\nf5(p).then(undefined, function (v) {\n  assert(v === 7)\n  successCount++\n})\n\nr(1)\n\n// Test 6\n\np = new Promise(function(resolve, reject) { r = resolve })\n\nasync function f6(p)\n{\n  await p\n  return self\n}\n\nvar self = f6()\n\nself.then(undefined, function (v) {\n  assert(v instanceof TypeError)\n  successCount++\n})\n\nr(1)\n\n// Test 7\n\nasync function f7(p)\n{\n  var x = {}\n  assert((await x) === x)\n\n  x = 3.14\n  assert((await x) === x)\n\n  x = \"Test string\"\n  assert((await x) === x)\n\n  successCount++\n}\nf7();\n\n// Test 8\n\nasync function f8() {\n  var p = new Promise(function() {});\n  Object.defineProperty(p, 'constructor', { get() { throw \"Error!\" } });\n\n  await p\n}\n\nf8().then(undefined, function (v) {\n  assert(v === \"Error!\")\n  successCount++\n})\n\n// END\n\nfunction __checkAsync() {\n  assert(successCount === 8)\n  assert(thenableCounter === 5)\n}\n"
  },
  {
    "path": "tests/jerry/function-await3.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar successCount = 0\n\nasync function f1()\n{\n  throw 1\n}\n\nasync function f2()\n{\n  try {\n    assert(await f1() && false)\n  } catch (e) {\n    assert(e === 1)\n    return 2\n  } finally {\n    return 3\n  }\n}\n\nasync function f3()\n{\n  return await f2() + 1\n}\n\nasync function f4()\n{\n  return await f1()\n}\n\nasync function f5()\n{\n  var o = { a:f2, b:f2, c:f2, d:f2 }\n\n  for (i in o) {\n    var p1 = f3()\n    var p2 = f4()\n\n    assert(await o[i]() === 3)\n    assert(await p1 === 4)\n\n    try {\n      assert(await p2 && false)\n    } catch (e) {\n      assert(e === 1)\n    }\n\n    successCount++\n  }\n}\n\nf5()\n\nfunction __checkAsync() {\n  assert(successCount === 4)\n}\n"
  },
  {
    "path": "tests/jerry/function-call.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (code)\n{\n  try {\n    eval (code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\nfunction f(...a)\n{\n  return a.length\n}\n\ncheck_syntax_error (\"f(,)\")\ncheck_syntax_error (\"f(,1)\")\ncheck_syntax_error (\"f(1,,)\")\ncheck_syntax_error (\"f(1,,2)\")\n\nassert(f(10) === 1)\nassert(f(10,) === 1)\nassert(f(10,11) === 2)\nassert(f(10,11,) === 2)\n"
  },
  {
    "path": "tests/jerry/function-construct.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar f = new Function ('');\nassert (f () === undefined);\n\nvar f = new Function ('\"use strict\"; f = undefined;');\nassert (f () === undefined && f === undefined);\n\nvar f = new Function ('\"use strict\"; q = undefined;');\ntry\n{\n  f ();\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof ReferenceError);\n}\n\nvar singleArgFunction = new Function ('arg', 'return arg');\n\nassert (singleArgFunction (5) === 5);\n\nfor (i = 1; i < 10; i ++)\n{\n  var f = new Function ('a', 'b', 'var q = a; b++; function f (k) {return q + k + b++;}; return f;');\n\n  var fns = new Array ();\n\n  for (var n = 0; n < 10; n++)\n  {\n    var r = f (1, 7);\n    fns[n] = r;\n\n    var check_value = 10;\n\n    for (var m = 0; m < 100; m++)\n    {\n      var value = r (1);\n      assert (check_value++ === value);\n    }\n  }\n\n  var check_value = 109;\n  for (var n = 0; n < 11; n++)\n  {\n    for (var m = 0; m < 10; m++)\n    {\n      var value = fns [m] (m * n);\n      assert (value == check_value + m * n);\n    }\n\n    check_value++;\n  }\n}\n\nvar f = new Function (\"a,b\", \"c\", \"return a + b + c;\");\nassert (f (1,2,3) === 6);\n\nf = new Function (\"a,b\", \"c,d\", \"return a + b + c + d;\");\nassert (f (1,2,3,4) === 10);\n\nf = new Function (\"a\" , \"b\", \"c,d\", \"return a + b + c + d;\");\nassert (f (1,2,3,4) === 10);\n\nvar f = new Function (\" a\\t ,  b\", \"\\u0020c\", \"return a + b + c;\");\nassert (f (1,2,3) === 6);\n\nf = new Function (\"a, \\n b  \\u0020\", \"c \\t, d\\n\", \"return a + b + c + d;\");\nassert (f (1,2,3,4) === 10);\n\nf = new Function (\" a\\t\" , \"\\nb \", \" \\u0020c , d \", \"return a + b + c + d;\");\nassert (f (1,2,3,4) === 10);\n\ntry\n{\n  new Function ({\n    toString : function () {\n      throw new TypeError();\n    },\n    valueOf : function () {\n      throw new TypeError();\n    }\n  });\n\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nvar p = { toString : function() { throw 1; } };\nvar body = { toString : function() { throw \"body\"; } };\n\ntry\n{\n  new Function (p, body);\n  // Should not be reached.\n  assert (false);\n}\ncatch (e)\n{\n  assert (e === 1);\n}\n\n// Check SyntaxError handling\ntry\n{\n  new Function ('var var;');\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof SyntaxError);\n}\n\ntry\n{\n  new Function ('a;b', 'return;');\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/function-decl.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (code)\n{\n  try {\n    eval (code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\ncheck_syntax_error (\"function f(,) {}\")\ncheck_syntax_error (\"function f(...a,) {}\")\ncheck_syntax_error (\"function f(a = 1 + 1,,) {}\")\ncheck_syntax_error (\"function f(a,,b) {}\")\ncheck_syntax_error (\"function f(,a) {}\")\n\nfunction f1(a,) {}\nassert(f1.length === 1)\n\nfunction f2(a = 1,) {}\nassert(f2.length === 0)\n\nfunction f3(a = 1, b = 1 + 1, c,) {}\nassert(f3.length === 0)\n\nvar f4 = async(a,) => {}\nassert(f4.length === 1)\n\nvar f5 = async(a = 1,b,) => {}\nassert(f5.length === 0)\n\nassert(((a, b = 1 + 1, c,) => {}).length === 1)\n\nassert(((a = 1, b, c = 1 + 1,) => {}).length === 0)\n\nfunction f6([a=1, b], [c, [d = 5] = []], e, [{f} = {}, g],) {}\nassert(f6.length === 4)\n\nfunction f7([a, {b = 1, 4 : c = 2} = {}], {'cc' : d = 5, e}, f, {g, h} = a = {},) {}\nassert(f7.length === 3)\n\nfunction f8(a, [b] = [], ...e) {}\nassert(f8.length === 1)\n"
  },
  {
    "path": "tests/jerry/function-expr-named.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar expr = \"Dummy value\";\n\nvar f = function expr() {\n  assert(expr === f);\n  expr = 6;\n  assert(expr === f);\n  assert(!(delete expr));\n  assert(expr === f);\n}\n\nf();\n\nf = function expr() {\n  assert(expr === undefined);\n  var expr = 6;\n  assert(expr === 6);\n}\n\nf();\n\nvar f = function expr() {\n  assert(expr === f);\n  eval(\"var expr = 8\");\n  assert(expr === 8);\n}\n\nf();\n\nvar f = function expr(i) {\n  assert(expr === f);\n\n  if (i > 0) {\n    expr(i - 1);\n  }\n}\n\nf(10);\n"
  },
  {
    "path": "tests/jerry/function-external.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  assert(!({} instanceof assert));\n} catch(e) {\n  assert(false);\n}\n\ntry {\n  ({} instanceof Math.sin);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\nMath.sin.prototype = {}\n\ntry {\n  assert(!({} instanceof Math.sin));\n} catch(e) {\n  assert(false);\n}\n"
  },
  {
    "path": "tests/jerry/function-if.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_syntax_error (code)\n{\n  try {\n    eval (code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\ncheck_syntax_error (\"'use strict'; if (true) function f() {}\")\ncheck_syntax_error (\"'use strict'; if (true) ; else function f() {}\")\ncheck_syntax_error (\"'use strict'; a: function f() {}\")\ncheck_syntax_error (\"if (true) async function f() {}\")\ncheck_syntax_error (\"if (true) ; else async function f() {}\")\ncheck_syntax_error (\"if (true) a: function f() {}\")\ncheck_syntax_error (\"if (true) ; else a: function f() {}\")\n\nvar g = 1\nvar h = 1\n\nfunction f1(p)\n{\n  assert(g === undefined)\n  assert(h === undefined)\n\n  if (p)\n    // Same as: { function g() { return 3 } }\n    function g() { return 3 }\n  else\n    // Same as: { function h() { return 4 } }\n    function h() { return 4 }\n\n  if (p) {\n    assert(g() === 3)\n    assert(h === undefined)\n  } else {\n    assert(g === undefined)\n    assert(h() === 4)\n  }\n}\n\nf1(true)\nf1(false)\n\nfunction f2()\n{\n  assert(g() === 2)\n  a: b: c: d: function g() { return 2 }\n\n  assert(h === undefined)\n\n  {\n    assert(h() === 3)\n    a: b: c: d: function h() { return 3 }\n  }\n\n  assert(h() === 3)\n\n  try {\n    assert(h() === 4)\n    a: b: c: d: function h() { return 4 }\n    throw 1\n  } catch (e) {\n    assert(h() === 5)\n    a: b: c: d: function h() { return 5 }\n  } finally {\n    assert(h() === 6)\n    a: b: c: d: function h() { return 6 }\n  }\n\n  assert(h() === 6)\n\n  switch (1) {\n  default:\n    assert(h() === 7)\n    a: b: c: d: function h() { return 7 }\n  }\n\n  assert(h() === 7)\n}\nf2()\n\nfunction f3()\n{\n  assert(h === undefined)\n\n  {\n    let a = eval(\"1\")\n    assert(a === 1)\n    assert(h() === 1)\n    a: b: c: d: function h() { return 1 }\n  }\n\n  assert(h() === 1)\n\n  {\n    eval(\"a: b: c: d: function h() { return 2 }\")\n    assert(h() === 2)\n  }\n\n  assert(h() === 2)\n}\nf3()\n"
  },
  {
    "path": "tests/jerry/function-name.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction assertNameExists(func) {\n  assert(func.hasOwnProperty('name') === true);\n}\nfunction assertNameNotExists(func) {\n  assert(func.hasOwnProperty('name') === false);\n  assert(Function.prototype.name === '');\n  assert(func.name === '');\n}\n\nfunction assertConfigurableOnlyMethod(func) {\n  let desc = Object.getOwnPropertyDescriptor(func, 'name');\n  assert(desc.configurable === true);\n  assert(desc.writable === false);\n  assert(desc.enumerable === false);\n\n  delete func.name;\n  assertNameNotExists(func);\n\n  Object.defineProperty(func, 'name', {value: 'newName', configurable: true});\n  assert (Object.getOwnPropertyDescriptor(func, 'name').value === 'newName');\n  assertNameExists(func);\n\n  delete func.name;\n  assertNameNotExists(func);\n  Object.defineProperty(func, 'name', desc);\n}\n\nfunction assertConfigurableOnlyAccessor(func, name, method) {\n  let accessor = Object.getOwnPropertyDescriptor(func, name)[method];\n  assertConfigurableOnlyMethod(accessor);\n}\n\nfunction assertMethodName(func, name, functionName = name) {\n  assertNameExists(func);\n  assertConfigurableOnlyMethod(func)\n  assert(Object.getOwnPropertyDescriptor(func, 'name').value === functionName)\n}\n\nfunction assertGetterName(obj, name, functionName = name) {\n  assertConfigurableOnlyAccessor(obj, name, 'get');\n  assert(Object.getOwnPropertyDescriptor(obj, name).get['name'] === 'get ' + functionName)\n}\n\nfunction assertSetterName(obj, name, functionName = name) {\n  assertConfigurableOnlyAccessor(obj, name, 'set');\n  assert(Object.getOwnPropertyDescriptor(obj, name).set['name'] === 'set ' + functionName)\n}\n\nvar func1 = function () {};\nassertMethodName(func1, 'func1');\n\nvar func2 = function bar() {};\nassertMethodName(func2, 'bar');\n\nvar func3 = (function () {}).prototype.constructor;\nassert(typeof func3 === 'function');\nassertMethodName(func3, '');\n\nvar func4;\nfunc4 = function () {}\nassertMethodName(func4, 'func4');\n\nvar func5;\nfunc5 = function bar () {}\nassertMethodName(func5, 'bar');\n\nvar func6;\n(func6) = function () {}\nassertMethodName(func6, '');\n\nvar func7;\n(func7) = function bar () {}\nassertMethodName(func7, 'bar');\n\nlet emptySymbolMethod = Symbol();\nlet namedSymbolMethod = Symbol('foo');\nlet emptySymbolGetter = Symbol();\nlet namedSymbolGetter = Symbol('foo');\nlet emptySymbolSetter = Symbol();\nlet namedSymbolSetter = Symbol('foo');\n\nvar o = {\n  func1() {},\n  func2: function () {},\n  func3: function bar() {},\n  func4: () => {},\n  func5: class {},\n  func6: class A {},\n  func7: class name { static name () {} },\n  ['func' + '8']() {},\n  ['func' + '9']: function () {},\n  ['func' + '10']: function bar() {},\n  ['func' + '11']: () => {},\n  ['func' + '12']: class {},\n  ['func' + '13']: class A {},\n  ['func' + '14']: class name { static name () {} },\n  get func15() {},\n  get ['func' + '16']() {},\n  set func17(a) {},\n  set ['func' + '18'](a) {},\n  [emptySymbolMethod]() {},\n  [namedSymbolMethod]() {},\n  get [emptySymbolGetter]() {},\n  get [namedSymbolGetter]() {},\n  set [emptySymbolSetter](a) {},\n  set [namedSymbolSetter](a) {},\n}\n\nassertMethodName(o.func1, 'func1');\nassertMethodName(o.func2, 'func2');\nassertMethodName(o.func3, 'bar');\nassertMethodName(o.func4, 'func4');\nassertMethodName(o.func5, 'func5');\nassertMethodName(o.func6, 'A');\nassert(typeof o.func7 === 'function');\n\nassertMethodName(o.func8, 'func8');\nassertMethodName(o.func9, 'func9');\nassertMethodName(o.func10, 'bar');\nassertMethodName(o.func11, 'func11');\nassertMethodName(o.func12, 'func12');\nassertMethodName(o.func13, 'A');\nassert(typeof o.func14 === 'function');\n\nassertGetterName(o, 'func15');\nassertGetterName(o, 'func16');\nassertSetterName(o, 'func17');\nassertSetterName(o, 'func17');\n\nassertMethodName(o[emptySymbolMethod], '');\nassertMethodName(o[namedSymbolMethod], '[foo]');\nassertGetterName(o, emptySymbolGetter, '');\nassertGetterName(o, namedSymbolGetter, '[foo]');\nassertSetterName(o, emptySymbolSetter, '');\nassertSetterName(o, namedSymbolSetter, '[foo]');\n\nclass A  {\n  constructor () {}\n  func1() {}\n  get func2() {}\n  set func3(a) {}\n\n  static func4() {}\n  static get func5() {}\n  static set func6(a) {}\n\n  ['func' + '7']() {}\n  get ['func' + '8']() {}\n  set ['func' + '9'](a) {}\n\n  static ['func' + '10']() {}\n  static get ['func' + '11']() {}\n  static set ['func' + '12'](a) {}\n\n  [emptySymbolMethod]() {}\n  [namedSymbolMethod]() {}\n  get [emptySymbolGetter]() {}\n  get [namedSymbolGetter]() {}\n  set [emptySymbolSetter](a) {}\n  set [namedSymbolSetter](a) {}\n\n  static [emptySymbolMethod]() {}\n  static [namedSymbolMethod]() {}\n  static get [emptySymbolGetter]() {}\n  static get [namedSymbolGetter]() {}\n  static set [emptySymbolSetter](a) {}\n  static set [namedSymbolSetter](a) {}\n}\n\nassertMethodName(A.prototype.func1, 'func1');\nassertGetterName(A.prototype, 'func2');\nassertSetterName(A.prototype, 'func3');\n\nassertMethodName(A.func4, 'func4');\nassertGetterName(A, 'func5');\nassertSetterName(A, 'func6');\n\nassertMethodName(A.prototype.func7, 'func7');\nassertGetterName(A.prototype, 'func8');\nassertSetterName(A.prototype, 'func9');\n\nassertMethodName(A.func10, 'func10');\nassertGetterName(A, 'func11');\nassertSetterName(A, 'func12');\n\nassertMethodName(A[emptySymbolMethod], '');\nassertMethodName(A[namedSymbolMethod], '[foo]');\nassertGetterName(A, emptySymbolGetter, '');\nassertGetterName(A, namedSymbolGetter, '[foo]');\nassertSetterName(A, emptySymbolSetter, '');\nassertSetterName(A, namedSymbolSetter, '[foo]');\n\nassertMethodName(A.prototype[emptySymbolMethod], '');\nassertMethodName(A.prototype[namedSymbolMethod], '[foo]');\nassertGetterName(A.prototype, emptySymbolGetter, '');\nassertGetterName(A.prototype, namedSymbolGetter, '[foo]');\nassertSetterName(A.prototype, emptySymbolSetter, '');\nassertSetterName(A.prototype, namedSymbolSetter, '[foo]');\n\nclass B  {\n  func1() {}\n  get func2() {}\n  set func3(a) {}\n\n  static func4() {}\n  static get func5() {}\n  static set func6(a) {}\n\n  ['func' + '7']() {}\n  get ['func' + '8']() {}\n  set ['func' + '9'](a) {}\n\n  static ['func' + '10']() {}\n  static get ['func' + '11']() {}\n  static set ['func' + '12'](a) {}\n\n  [emptySymbolMethod]() {}\n  [namedSymbolMethod]() {}\n  get [emptySymbolGetter]() {}\n  get [namedSymbolGetter]() {}\n  set [emptySymbolSetter](a) {}\n  set [namedSymbolSetter](a) {}\n\n  static [emptySymbolMethod]() {}\n  static [namedSymbolMethod]() {}\n  static get [emptySymbolGetter]() {}\n  static get [namedSymbolGetter]() {}\n  static set [emptySymbolSetter](a) {}\n  static set [namedSymbolSetter](a) {}\n}\n\nassertMethodName(B.prototype.func1, 'func1');\nassertGetterName(B.prototype, 'func2');\nassertSetterName(B.prototype, 'func3');\n\nassertMethodName(B.func4, 'func4');\nassertGetterName(B, 'func5');\nassertSetterName(B, 'func6');\n\nassertMethodName(B.prototype.func7, 'func7');\nassertGetterName(B.prototype, 'func8');\nassertSetterName(B.prototype, 'func9');\n\nassertMethodName(B.func10, 'func10');\nassertGetterName(B, 'func11');\nassertSetterName(B, 'func12');\n\nassertMethodName(B[emptySymbolMethod], '');\nassertMethodName(B[namedSymbolMethod], '[foo]');\nassertGetterName(B, emptySymbolGetter, '');\nassertGetterName(B, namedSymbolGetter, '[foo]');\nassertSetterName(B, emptySymbolSetter, '');\nassertSetterName(B, namedSymbolSetter, '[foo]');\n\nassertMethodName(B.prototype[emptySymbolMethod], '');\nassertMethodName(B.prototype[namedSymbolMethod], '[foo]');\nassertGetterName(B.prototype, emptySymbolGetter, '');\nassertGetterName(B.prototype, namedSymbolGetter, '[foo]');\nassertSetterName(B.prototype, emptySymbolSetter, '');\nassertSetterName(B.prototype, namedSymbolSetter, '[foo]');\n\nlet names = ['push', 'pop', 'reduce', 'reduceRight'];\n\nfor (let n of names) {\n  assert(Array.prototype[n].name === n);\n}\n\nassert(Array.prototype[Symbol.iterator].name === 'values');\nassert(Array.prototype.values.name === 'values');\nassert(Object.getOwnPropertyDescriptor(Array, Symbol.species).get.name === 'get [Symbol.species]');\nassert(Object.getOwnPropertyDescriptor(String.prototype, Symbol.iterator).value.name === '[Symbol.iterator]');\nassert(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').get.name === 'get __proto__');\nassert(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set.name === 'set __proto__');\n\nlet arFunc;\nlet array = [];\narray['original'] = array;\narray['original'][arFunc = ()=>{ }]=function(){}\nassertMethodName(array[arFunc], '');\n\nvar o = { 0 : class {} };\n\nassertMethodName(o['0'], '0');\n"
  },
  {
    "path": "tests/jerry/function-new-target.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar get = [];\nvar p = new Proxy(Function, { get: function(o, k) { get.push(k); return o[k]; }});\nnew p;\n\nassert(get + '' === \"prototype\");\n\nvar func = function() {}\nvar reflect = Reflect.construct(Function, ['a','b','return a+b'], func);\nassert(Object.getPrototypeOf(reflect) == func.prototype);\n\nvar o = new Proxy (function f () {}, { get(t,p,r) { if (p == \"prototype\") { throw 42 }}})\n\ntry {\n  Reflect.construct(Function, [], o);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n"
  },
  {
    "path": "tests/jerry/function-param-init.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar local = 0;\n\nswitch(0) { /* This switch forces a pre-scanner run. */\ndefault:\n\n  function f(a = (5, local = 6),\n             b = ((5 + function(a = 6) { return a }() * 3)),\n             c,\n             d = true ? 1 : 2)\n  {\n    return \"\" + a + \", \" + b + \", \" + c + \", \" + d;\n  }\n\n  assert(f() === \"6, 23, undefined, 1\");\n  assert(local === 6);\n\n  var obj = {\n    f: function(a = [10,,20],\n                b,\n                c = Math.cos(0),\n                d)\n    {\n      return \"\" + a + \", \" + b + \", \" + c + \", \" + d;\n    }\n  };\n\n  assert(obj.f() === \"10,,20, undefined, 1, undefined\");\n\n  function g(a, b = (local = 7)) { }\n\n  local = 0;\n  g();\n  assert(local === 7);\n\n  local = 0;\n  g(0);\n  assert(local === 7);\n\n  local = 0;\n  g(0, undefined);\n  assert(local === 7);\n\n  local = 0;\n  g(0, null);\n  assert(local === 0);\n\n  local = 0;\n  g(0, false);\n  assert(local === 0);\n  break;\n}\n\nfunction CheckSyntaxError(str)\n{\n  try {\n    eval(str);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n\nCheckSyntaxError('function x(a += 5) {}');\nCheckSyntaxError('function x(a =, b) {}');\nCheckSyntaxError('function x(a = (b) {}');\nCheckSyntaxError('function x(a, a = 5) {}');\nCheckSyntaxError('function x(a = 5, a) {}');\n\n// Pre-scanner tests.\nvar str = \"a = 5, b, c = function() { for (var a = 0; a < 4; a++) ; return a; } ()\"\n\nvar f = new Function (str, str);\nf();\n\nvar f = new Function (str, \"return (a + c) * (b == undefined ? 1 : 0)\");\nassert (f() == 9);\n\nfunction duplicatedArg (a = c, b = d, c) {\n  assert(a === 1);\n  assert(b === 2);\n  assert(c === 3);\n}\n\nduplicatedArg(1, 2, 3);\n"
  },
  {
    "path": "tests/jerry/function-param-init2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f(a, b = a)\n{\n  function a() { return 2; }\n\n  assert(a() === 2);\n  assert(b === 1)\n}\nf(1);\n\nfunction g(a, b = a)\n{\n  function a() { return 2; }\n\n  eval(\"assert(a() === 2)\");\n  eval(\"assert(b === 1)\");\n}\ng(1);\n\nvar x = 1;\nfunction h(a = x) {\n  assert(x === undefined);\n  var x = 2;\n  assert(a === 1);\n  assert(x === 2);\n}\nh();\n\nx = function() { return 4; }\nlet y = 6;\n\nfunction i(a = x() / 2, b = (y) + 2, c = typeof z) {\n  let y = 10;\n  let z = 11;\n\n  function x() { return 5; }\n\n  assert(a === 2);\n  assert(x() === 5);\n  assert(b === 8);\n  assert(c === \"undefined\");\n  assert(y === 10);\n  assert(z === 11);\n}\ni();\n\nvar arguments = 10;\nfunction j(a = arguments[1])\n{\n  assert(a === 2);\n  a = 3;\n  assert(arguments[0] === undefined)\n}\nj(undefined,2);\n\nfunction k(a = 2)\n{\n  let d = 5;\n  assert(d === 5);\n  eval(\"assert(a === 2)\");\n}\nk();\n\nfunction l(a = 3)\n{\n  const d = 6;\n  assert(d === 6);\n  eval(\"assert(a === 3)\");\n}\nl();\n\nfunction m(a, b = 2)\n{\n  assert(a === 1);\n  assert(arguments[0] === 1);\n  assert(b === 2);\n  assert(arguments[1] === undefined);\n\n  a = 8;\n  b = 9;\n\n  assert(a === 8);\n  assert(arguments[0] === 1);\n  assert(b === 9);\n  assert(arguments[1] === undefined);\n}\nm(1);\n"
  },
  {
    "path": "tests/jerry/function-param-init3.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar d = 1\nfunction f(a = function () { return d })\n{\n  var d = 2\n  assert(d === 2)\n  assert(a() === 1)\n}\nf()\n\nvar g = (a = () => d) => {\n  var d = 2\n  assert(d === 2)\n  assert(a() === 1)\n}\ng()\n\nvar h = ([{a}] = [{a: function () { return d }}]) => {\n  var d = 2\n  assert(d === 2)\n  assert(a() === 1)\n}\nh()\n\nfunction i(a = ((eval))(\"(function () { return d })\"))\n{\n  var d = 2\n  assert(d === 2)\n  assert(a() === 1)\n}\ni()\n\nfunction j(a = (([1, ((() => d))])[1]))\n{\n  var d = 2\n  assert(d === 2)\n  assert(a() === 1)\n}\nj()\n\nvar m = 0\nfunction l(a)\n{\n  m = a\n  return m\n}\n\nfunction k(a = l(() => d))\n{\n  var d = 2\n  assert(d === 2)\n  assert(a() === 1)\n  assert(m() === 1)\n}\nk()\n"
  },
  {
    "path": "tests/jerry/function-param-init4.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_reference_error(code)\n{\n  try {\n    eval(code);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof ReferenceError);\n  }\n}\n\nfunction f1(a = a)\n{\n  assert(a === 1)\n}\nf1(1)\ncheck_reference_error(\"f1()\");\n\nfunction f2([a] = 1 + a)\n{\n  assert(a === 2)\n}\nf2([2])\ncheck_reference_error(\"f2()\");\n\nfunction f3([a = !a])\n{\n  assert(a === 2)\n}\nf3([2])\ncheck_reference_error(\"f3([])\");\n\nfunction f4([[a]] = a)\n{\n  assert(a === 3)\n}\nf4([[3]])\ncheck_reference_error(\"f4()\");\n\nfunction f5([[a], b = a] = a)\n{\n  assert(a === 4 && b === 4)\n}\nf5([[4]])\ncheck_reference_error(\"f5()\")\n\nfunction f6(a = 3 - ((b)), b)\n{\n  assert(a === 1 && b === 2)\n}\nf6(1, 2)\ncheck_reference_error(\"f6(undefined, 2)\");\n\nfunction f7(a = b(), [b])\n{\n  assert(a === 3 && b === 4)\n}\nf7(3, [4])\ncheck_reference_error(\"f7(undefined, [4])\");\n\nfunction f8(a = (function () { return a * 2 })())\n{\n  assert(a === 1)\n}\nf8(1)\ncheck_reference_error(\"f8()\");\n\nfunction f9({a = b, b:{b}})\n{\n  assert(a === 2 && b === 3)\n}\nf9({a:2, b:{b:3}})\ncheck_reference_error(\"f9({b:{b:3}})\");\n\nfunction f10(a = eval(\"a\"))\n{\n  assert(a === 1)\n}\nf10(1)\ncheck_reference_error(\"f10()\");\n\nfunction f11([a] = eval(\"a\"))\n{\n  assert(a === 2)\n}\nf11([2])\ncheck_reference_error(\"f11()\");\n\nfunction f12({a} = eval(\"a\"))\n{\n  assert(a === 3)\n}\nf12({a:3})\ncheck_reference_error(\"f12()\");\n\nfunction f13(a = arguments)\n{\n  assert(a[0] === undefined)\n  assert(a[1] === 4)\n  arguments[0] = 5\n  assert(a[0] === 5)\n}\nf13(undefined, 4)\n\nfunction f14(a, b = function() { return a; }(), c = (() => a)())\n{\n  assert(a === 6 && b === 6 && c === 6)\n}\nf14(6)\n\nfunction f15(a = (() => b)(), b)\n{\n  assert(a === 1 && b === 2)\n}\nf15(1, 2)\ncheck_reference_error(\"f15(undefined, 2)\");\n\nvar f16 = (a = a) =>\n{\n  assert(a === 1)\n}\nf16(1)\ncheck_reference_error(\"f16()\");\n\nvar f17 = ([[a]] = a) =>\n{\n  assert(a === 2)\n}\nf17([[2]])\ncheck_reference_error(\"f17()\");\n\nvar f18 = ({a = b, b:{b}}) =>\n{\n  assert(a === 3 && b === 4)\n}\nf18({a:3, b:{b:4}})\ncheck_reference_error(\"f18({b:{b:4}})\");\n\nvar f19 = (a = eval(\"a\")) =>\n{\n  assert(a === 5)\n}\nf19(5)\ncheck_reference_error(\"f19()\");\n\nvar f20 = ([a] = eval(\"a\")) =>\n{\n  assert(a === 6)\n}\nf20([6])\ncheck_reference_error(\"f20()\");\n"
  },
  {
    "path": "tests/jerry/function-pattern1.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction must_throw (str, type = SyntaxError)\n{\n  try\n  {\n    eval (str);\n    assert (false);\n  }\n  catch (e)\n  {\n    assert (e instanceof type)\n  }\n}\n\nmust_throw (\"function f(a, [a]) {}\");\nmust_throw (\"function f([a], a) {}\");\nmust_throw (\"function f(a = b, [b]) {}; f()\", ReferenceError);\nmust_throw (\"function f([a+b]) {}\");\nmust_throw (\"function f([a().b]) {}\");\nmust_throw (\"function f(...[a] = [1]) {}\");\n\nfunction a1([a,b]) {\n  var a, b;\n\n  assert(a === 1);\n  assert(b === undefined);\n\n  var a = 3;\n  assert(a === 3);\n}\na1([1]);\n\nfunction a2([a,b]) {\n  eval(\"var a, b\");\n  assert(a === 1);\n  assert(b === undefined);\n\n  eval(\"var a = 3\");\n  assert(a === 3);\n}\na2([1]);\n\nfunction f1(a, [b], c, [d], e)\n{\n  assert (a === 1);\n  assert (b === 2);\n  assert (c === 3);\n  assert (d === 4);\n  assert (e === 5);\n}\nf1(1, [2], 3, [4], 5)\n\nfunction f2(a, [b], c, [d], e)\n{\n  eval(\"\");\n  assert (a === 1);\n  assert (b === 2);\n  assert (c === 3);\n  assert (d === 4);\n  assert (e === 5);\n}\nf2(1, [2], 3, [4], 5)\n\nvar g1 = (a, [b], c, [d], e) => {\n  assert (a === 1);\n  assert (b === 2);\n  assert (c === 3);\n  assert (d === 4);\n  assert (e === 5);\n}\ng1(1, [2], 3, [4], 5)\n\nvar g2 = (a, [b], c, [d], e) => {\n  eval(\"\");\n  assert (a === 1);\n  assert (b === 2);\n  assert (c === 3);\n  assert (d === 4);\n  assert (e === 5);\n}\ng2(1, [2], 3, [4], 5)\n"
  },
  {
    "path": "tests/jerry/function-pattern2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert((function([a], b, {c}) {}).length === 3);\n\nfunction f([a = \"x\", b = \"y\", c = \"z\"])\n{\n  assert(a === \"a\");\n  assert(b === \"b\");\n  assert(c === \"z\");\n}\nf(\"ab\")\n\nfunction g({ [\"x\" + \"y\"]: { a = 4, b = 5 }, })\n{\n  assert(a === 1);\n  assert(b === 5);\n}\ng({ xy: { a:1 } });\n\nfunction h([,,a,,b,,])\n{\n  assert(a === 3);\n  assert(b === 5);\n}\nh([1,2,3,4,5,6,7,8])\n\nfunction i([a] = [42], b = a)\n{\n  assert(a === 42);\n  assert(b === 42);\n}\ni();\n\nfunction j(a, [[b = a, [c] = [b], { d } = { d:eval(\"c\") }], e = d + 1] = [[]])\n{\n  assert(a === 8);\n  assert(b === 8);\n  assert(c === 8);\n  assert(d === 8);\n  assert(e === 9);\n}\nj(8);\n\nfunction k([a = function() { return a; }])\n{\n  assert(typeof a === \"function\");\n  assert(a() === a);\n}\nk([]);\n\nfunction l(a = 0, ...[b, c = 1, d = 4])\n{\n  assert(a === 1);\n  assert(b === 2);\n  assert(c === 3);\n  assert(d === 4);\n}\nl(1,2,3);\n\nFunction(\"{a, x:b}\",\"[c]\", \"{ 'dd':d, e = Math.cos(0)}\",\n  \"assert(a === 1);\" +\n  \"assert(b === undefined);\" +\n  \"assert(c === 3);\" +\n  \"assert(d === 4);\" +\n  \"assert(e === 1);\"\n)({a:1, b:3}, [3], {a:1, b:2, dd:4});\n\nfunction m()\n{\n  var prop_name = \"x\";\n  var def_val = 123;\n\n  function g({[prop_name]: a, b = def_val })\n  {\n    assert(a === 12);\n    assert(b === 123);\n  }\n\n  g({ x:12 })\n}\nm();\n"
  },
  {
    "path": "tests/jerry/function-properties.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction getProperties(obj)\n{\n  var str = \"\";\n  for (name in obj)\n  {\n    if (str)\n    {\n      str += \" \" + name;\n    }\n    else\n    {\n      str = name;\n    }\n  }\n  return str;\n}\n\nvar prototype_obj = { dummy:1, length:1, caller:null,\n                      arguments:null, prototype:null };\n\nvar func = function() {};\n\nObject.setPrototypeOf(func, prototype_obj);\nassert(getProperties(func) == \"dummy\");\n\nvar bound_func = (function() {}).bind(null);\nObject.setPrototypeOf(bound_func, prototype_obj);\nassert(getProperties(bound_func) == \"dummy caller arguments prototype\");\n\n// 'print' is an external function\nObject.setPrototypeOf(print, prototype_obj);\nassert(getProperties(print) == \"dummy length caller arguments\");\n\nfunction f1() {}\nassert(Reflect.ownKeys(f1).toString() === \"length,name,arguments,caller,prototype\")\n\nasync function f2() {}\nassert(Reflect.ownKeys(f2).toString() === \"length,name\")\n"
  },
  {
    "path": "tests/jerry/function-prototype-apply.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// See a general usage: number addition.\nfunction addNum ()\n{\n  var sum = 0;\n  for(var i = 0; i < arguments.length; i++)\n  {\n    sum += arguments[i];\n  }\n  return sum;\n}\n\nvar array = [6720, 4, 42];\nvar obj;\n\nobj = addNum.apply(obj, array);\nassert (obj === 6766);\n\n// If the arguments are missing.\nobj = addNum.apply();\nassert (obj === 0);\n\nobj = addNum.apply(obj);\nassert (obj === 0);\n\n// If the function is a builtin.\nassert (Math.min.apply(null, array) === 4);\nassert (Math.max.apply(null, array) === 6720);\n\n// If the function can't be used as caller.\ntry {\n  obj = new Function.prototype.apply();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// If the called function throws an error.\nfunction throwError ()\n{\n  throw new ReferenceError (\"foo\");\n}\n\ntry {\n  obj = throwError.apply(obj, array);\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// If the array access throws an error.\nObject.defineProperty(array, '0', { 'get' : function () { throw new ReferenceError (\"foo\"); } });\n\ntry {\n  obj = addNum.apply(obj, array);\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/function-prototype-bind.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar mul = function(a, b) {\n  return a * b;\n};\n\nvar triple = mul.bind(null, 3);\ndelete mul;\nassert (triple(20) === 60);\nassert (triple.prototype === undefined);\n\nvar dupl = triple.bind({}, 2);\nassert (dupl() === 6);\nassert (dupl.prototype === undefined);\n\ntry {\n  var obj = {};\n  var new_func = obj.bind(null, 'foo');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar obj1 = {num : 36};\n\nvar f1 = function(a) {\n  return this.num + a;\n}\n\nvar add36 = f1.bind(obj1);\nassert (add36(24) === 60);\n\nvar appendfoo = f1.bind(obj1, \"foo\");\nassert (appendfoo() === \"36foo\");\n\nvar f2 = function(a) {\n  return this.num + a.num;\n}\n\nvar sum = f2.bind(obj1, obj1);\nassert (sum() === 72);\n\nfunction P(x, y) {\n  this.x = x;\n  this.y = y;\n}\n\nvar P1 = P.bind({}, 2);\nvar _p1 = new P1();\nassert (_p1.x === 2);\nassert (_p1.y === undefined);\nassert (_p1 instanceof P);\nassert (_p1 instanceof P1);\n\nvar P2 = P1.bind(null);\nvar _p2 = new P2();\nassert (_p2.x === 2);\nassert (_p2.y === undefined);\n\n_p2 = new P2(12, 60);\nassert (_p2.x === 2);\nassert (_p2.y === 12);\n\n_p2 = new P2({}, 12);\nassert (_p2.x === 2);\nassert (Object.getPrototypeOf(_p2.y) === Object.prototype);\nassert (_p2 instanceof P);\nassert (_p2 instanceof P1);\nassert (_p2 instanceof P2);\n\nvar P3 = P2.bind({}, 5);\nvar _p3 = new P3(8);\nassert (_p3.x === 2);\nassert (_p3.y === 5);\nassert (_p3 instanceof P);\nassert (_p3 instanceof P1);\nassert (_p3 instanceof P2);\nassert (_p3 instanceof P3);\n\nvar P4 = P.bind();\nP4(4, 5);\nassert (x === 4);\nassert (y === 5);\n\nvar _x = x;\nvar _y = y;\n\nvar P5 = P.bind(undefined);\nP5(5, 4);\nassert (x === _y);\nassert (y === _x);\n\nvar number = Number.constructor;\nvar bound = number.bind(null, 24);\nvar foo = new bound();\nassert (foo() === undefined);\n\nvar number = Number;\nvar bound = number.bind(null, 3);\nvar foo = new bound();\nassert (foo == 3);\nassert (foo instanceof Number);\nassert (foo.prototype === undefined);\n\nvar func = Number.prototype.toString.bind('foo');\nassert (func instanceof Function);\n\ntry {\n  var math = Math.sin;\n  var bound = math.bind(null, 0);\n  var foo = new bound();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar foo = function(x, y) { }\n\nvar bound = foo.bind(null);\nassert(bound.length === 2);\n\nbound = foo.bind(null, 9);\nassert(bound.length === 1);\n\nbound = foo.bind(null, 9, 8);\nassert(bound.length === 0);\n\n/* extended class */\n(function() {\n  class C extends Function {}\n  var c = new C(\"x\", \"y\", \"return this.foo + x + y;\").bind({foo : 1}, 2);\n  assert(c(3) === 6);\n  assert(c instanceof C);\n})();\n\nfunction boundPrototypeChecker(f, proto) {\n  Object.setPrototypeOf(f, proto);\n\n  var boundFunc = Function.prototype.bind.call(f, null);\n  assert(Object.getPrototypeOf(boundFunc) === proto);\n}\n\n/* generator function */\n(function() {\n  var f = function*(){};\n  boundPrototypeChecker(f, Function.prototype)\n  boundPrototypeChecker(f, {})\n  boundPrototypeChecker(f, null);\n})();\n\n/* arrow function */\n(function() {\n  var f = () => 5;\n  boundPrototypeChecker(f, Function.prototype)\n  boundPrototypeChecker(f, {})\n  boundPrototypeChecker(f, null);\n})();\n\n/* simple class */\n(function() {\n  class C {};\n  boundPrototypeChecker(C, Function.prototype)\n  boundPrototypeChecker(C, {})\n  boundPrototypeChecker(C, null);\n})();\n\n/* subclasses */\n(function() {\n  function boundPrototypeChecker(superclass) {\n    class C extends superclass {\n      constructor() {\n        return Object.create(null);\n      }\n    }\n    var boundF = Function.prototype.bind.call(C, null);\n    assert(Object.getPrototypeOf(boundF) === Object.getPrototypeOf(C));\n  }\n\n  boundPrototypeChecker(function(){});\n  boundPrototypeChecker(Array);\n  boundPrototypeChecker(null);\n})();\n"
  },
  {
    "path": "tests/jerry/function-prototype-hasinstance-class.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass base {\n  constructor (value) {\n    this.member = value;\n  }\n\n  method () {\n    return this.member;\n  }\n}\n\nclass sub {\n  constructor (value) {\n    this.member = value;\n  }\n}\n\nvar obj_base = new base (3);\nvar obj_sub = new sub (4);\n\nassert (base[Symbol.hasInstance](obj_base) === true);\nassert (base[Symbol.hasInstance](obj_sub) === false);\n\nassert (sub[Symbol.hasInstance](obj_base) === false);\nassert (sub[Symbol.hasInstance](obj_sub) === true);\n\n\nclass sub_c extends base {\n  constructor (value) {\n    super(value);\n    this.member = value;\n  }\n}\n\nvar obj_sub_c = new sub_c (5);\n\nassert (base[Symbol.hasInstance](obj_sub_c) === true);\n\nassert (sub_c[Symbol.hasInstance](obj_base) === false);\nassert (sub_c[Symbol.hasInstance](obj_sub_c) === true);\n"
  },
  {
    "path": "tests/jerry/function-prototype-hasinstance.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction base (value) {\n  this.member = value;\n}\n\nbase.prototype.method = function () { return this.member; }\n\nfunction sub (value) {\n  this.member = value;\n}\n\nsub.prototype = base;\n\n\nvar obj_base = new base (3);\nvar obj_sub = new sub (4);\n\nassert (base[Symbol.hasInstance] (obj_base) === true);\nassert (base[Symbol.hasInstance] (obj_sub) === false);\nassert (Object[Symbol.hasInstance] (obj_base) === true);\nassert (Object[Symbol.hasInstance] (obj_sub) === true);\nassert (obj_base.method () === 3);\n\nassert (sub[Symbol.hasInstance] (obj_base) === false);\nassert (sub[Symbol.hasInstance] (obj_sub) === true);\nassert (obj_sub.method === undefined);\n\nfunction sub_c (value) {\n  this.member = value;\n}\n\nsub_c.prototype = Object.create (base.prototype)\nsub_c.prototype.constructor = sub_c\n\nvar obj_sub_c = new sub_c (5);\n\nassert (base[Symbol.hasInstance] (obj_sub_c) === true);\n\nassert (sub_c[Symbol.hasInstance] (obj_base) === false);\nassert (sub_c[Symbol.hasInstance] (obj_sub_c) === true);\nassert (Object[Symbol.hasInstance] (obj_sub_c) === true);\nassert (Function.prototype[Symbol.hasInstance].call (sub_c, obj_sub_c) === true);\n\nassert (obj_sub_c.method () === 5);\n\nassert (base[Symbol.hasInstance] (3) === false);\nassert (Number[Symbol.hasInstance] (33) === false);\nassert (Number[Symbol.hasInstance] (new Number (33)) === true);\nassert (Object[Symbol.hasInstance] (44) === false);\nassert (Object[Symbol.hasInstance] (new Number (22)) === true);\n\nassert (base[Symbol.hasInstance] ('demo') === false);\nassert (String[Symbol.hasInstance] ('demo') === false);\nassert (String[Symbol.hasInstance] (new String ('demo')) === true);\nassert (Object[Symbol.hasInstance] ('demo') === false);\nassert (Object[Symbol.hasInstance] (new String ('demo')) === true);\n\nassert (base[Symbol.hasInstance] ([]) === false);\nassert (base[Symbol.hasInstance] ([1, 2]) === false);\nassert (Array[Symbol.hasInstance] ([1, 2]) === true);\nassert (Array[Symbol.hasInstance] (new Array(1, 2)) === true);\nassert (Object[Symbol.hasInstance] ([]) === true);\nassert (Object[Symbol.hasInstance] (new Array()) === true);\n\nassert (base[Symbol.hasInstance] (new RegExp('abc')) === false);\nassert (RegExp[Symbol.hasInstance] (/abc/) === true);\nassert (RegExp[Symbol.hasInstance] (new RegExp('abc')) === true);\nassert (Object[Symbol.hasInstance] (/abc/) === true);\n"
  },
  {
    "path": "tests/jerry/function-prototype-tostring.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (Math.cos.toString() === \"function () { [native code] }\");\n\nvar has_toString = none.toString() != \"function () { /* ecmascript */ }\"\n\nfunction check(f, expected)\n{\n  assert (f.toString() === (has_toString ? expected : \"function () { /* ecmascript */ }\"))\n}\n\nfunction none() { return 1; }\ncheck (none, \"function none() { return 1; }\")\nassert (none.bind({}).toString() === \"function () { [native code] }\")\n\nfunction single(b) { return 1; }\ncheck (single, \"function single(b) { return 1; }\")\nassert (single.bind({}).toString() === \"function () { [native code] }\")\n\nfunction multiple(a,b) { return 1; }\ncheck (multiple, \"function multiple(a,b) { return 1; }\")\nassert (multiple.bind({}).toString() === \"function () { [native code] }\")\n\nfunction lots(a,b,c,d,e,f,g,h,i,j,k) { return 1; }\ncheck (lots, \"function lots(a,b,c,d,e,f,g,h,i,j,k) { return 1; }\")\nassert (lots.bind({}).toString() === \"function () { [native code] }\")\nfunction check() {}\n\nif (check.toString() !== \"function () { /* ecmascript */ }\")\n{\n  var a, b, o, c, f;\n\n  /* Function statements. */\n\n  a = 6; function f1(a,b=1,c) { return a /* comment */ + b + c } b = 7\n  assert(f1.toString() === \"function f1(a,b=1,c) { return a /* comment */ + b + c }\")\n\n  a = 6; function * f2(a,b,c=1) {\n    function x() {}\n  } b = 7\n  assert(f2.toString() === \"function * f2(a,b,c=1) {\\n    function x() {}\\n  }\")\n\n  a = 6;async  function   f3 ( a , b , c ) { } b = 7\n  assert(f3.toString() === \"async  function   f3 ( a , b , c ) { }\")\n\n  a = 6;async/**/function*f4(a,b,c){} b = 7\n  assert(f4.toString() === \"async/**/function*f4(a,b,c){}\")\n\n  /* Object initializers. */\n\n  o = {f(a) { return a }}\n  assert(o.f.toString() === \"f(a) { return a }\")\n\n  o = {f:function(a){/**/}}\n  assert(o.f.toString() === \"function(a){/**/}\")\n\n  o = { [function(){ return 'f' }()] (a = function() {}) {} }\n  assert(o.f.toString() === \"[function(){ return 'f' }()] (a = function() {}) {}\")\n\n  o = {*  f(a) {}}\n  assert(o.f.toString() === \"*  f(a) {}\")\n\n  o = {*[function(){ return 'f' }()](a) {}}\n  assert(o.f.toString() === \"*[function(){ return 'f' }()](a) {}\")\n\n  o = {async/**/f(a) {}}\n  assert(o.f.toString() === \"async/**/f(a) {}\")\n\n  o = {/**/async   [function(){ return 'f' }()](a) {}/**/}\n  assert(o.f.toString() === \"async   [function(){ return 'f' }()](a) {}\")\n\n  o = {a:1,async/**/*/**/f(a) {},b:1}\n  assert(o.f.toString() === \"async/**/*/**/f(a) {}\")\n\n  o = {async *//\n       [function(){ return 'f' }()](a) {}/**/}\n  assert(o.f.toString() === \"async *//\\n       [function(){ return 'f' }()](a) {}\")\n\n  o = { get a() {return/**/6} }\n  assert(Object.getOwnPropertyDescriptor(o, \"a\").get.toString() === \"get a() {return/**/6}\")\n\n  o = { get[function(){ return 'a' }()](){} }\n  assert(Object.getOwnPropertyDescriptor(o, \"a\").get.toString() === \"get[function(){ return 'a' }()](){}\")\n\n  o = { set a(v) {/**/} }\n  assert(Object.getOwnPropertyDescriptor(o, \"a\").set.toString() === \"set a(v) {/**/}\")\n\n  o = {/**/set/**/[function(){ return 'a' }()]/**/(v) {/**/}/**/}\n  assert(Object.getOwnPropertyDescriptor(o, \"a\").set.toString() === \"set/**/[function(){ return 'a' }()]/**/(v) {/**/}\")\n\n  /* Class static functions. */\n\n  c = class { static/**/f() {}/**/ }\n  assert(c.f.toString() === \"f() {}\")\n\n  c = class { static[function(){ return 'f' }()]() {} }\n  assert(c.f.toString() === \"[function(){ return 'f' }()]() {}\")\n\n  c = class { static    *f() {} }\n  assert(c.f.toString() === \"*f() {}\")\n\n  c = class {/**/static *  [function(){ return 'f' }()](a=6){}/**/}\n  assert(c.f.toString() === \"*  [function(){ return 'f' }()](a=6){}\")\n\n  c = class { static/**/async f() {} }\n  assert(c.f.toString() === \"async f() {}\")\n\n  c = class {static   async[function(){ return 'f' }()]() {/**/}}\n  assert(c.f.toString() === \"async[function(){ return 'f' }()]() {/**/}\")\n\n  c = class { static async*f() {}}\n  assert(c.f.toString() === \"async*f() {}\")\n\n  c = class { static async*/**/[function(){ return 'f' }()](){} }\n  assert(c.f.toString() === \"async*/**/[function(){ return 'f' }()](){}\")\n\n  c = class { static/**/get/**/a() {}}\n  assert(Object.getOwnPropertyDescriptor(c, \"a\").get.toString() === \"get/**/a() {}\")\n\n  c = class {static  set  a(v){}}\n  assert(Object.getOwnPropertyDescriptor(c, \"a\").set.toString() === \"set  a(v){}\")\n\n  c = class { static   get[function(){ return 'a' }()](){} }\n  assert(Object.getOwnPropertyDescriptor(c, \"a\").get.toString() === \"get[function(){ return 'a' }()](){}\")\n\n  c = class { static   set[function(){ return 'a' }()](v){}//\n            }\n  assert(Object.getOwnPropertyDescriptor(c, \"a\").set.toString() === \"set[function(){ return 'a' }()](v){}\")\n\n  /* Class functions. */\n\n  o = Object.getPrototypeOf(new class {/**/f() {}/**/})\n  assert(o.f.toString() === \"f() {}\")\n\n  o = Object.getPrototypeOf(new class {[function(){ return 'f' }()](){}})\n  assert(o.f.toString() === \"[function(){ return 'f' }()](){}\")\n\n  o = Object.getPrototypeOf(new class {  * /**/  f() {}  })\n  assert(o.f.toString() === \"* /**/  f() {}\")\n\n  o = Object.getPrototypeOf(new class {  *  [function(){ return 'f' }()]/**/(){}  })\n  assert(o.f.toString() === \"*  [function(){ return 'f' }()]/**/(){}\")\n\n  o = Object.getPrototypeOf(new class {async f() {}})\n  assert(o.f.toString() === \"async f() {}\")\n\n  o = Object.getPrototypeOf(new class {async[function(){ return 'f' }()](){}})\n  assert(o.f.toString() === \"async[function(){ return 'f' }()](){}\")\n\n  o = Object.getPrototypeOf(new class {/**/get/**/a() {}/**/})\n  assert(Object.getOwnPropertyDescriptor(o, \"a\").get.toString() === \"get/**/a() {}\")\n\n  o = Object.getPrototypeOf(new class { set  a(v){} })\n  assert(Object.getOwnPropertyDescriptor(o, \"a\").set.toString() === \"set  a(v){}\")\n\n  o = Object.getPrototypeOf(new class {/**/get/**/[function(){ return 'a' }()]() {}/**/})\n  assert(Object.getOwnPropertyDescriptor(o, \"a\").get.toString() === \"get/**/[function(){ return 'a' }()]() {}\")\n\n  o = Object.getPrototypeOf(new class {  set/**/[function(){ return 'a' }()]( v ){}  })\n  assert(Object.getOwnPropertyDescriptor(o, \"a\").set.toString() === \"set/**/[function(){ return 'a' }()]( v ){}\")\n\n  /* Function creators. */\n  f = Function(\"a,b\", \"return a + b\")\n  assert(f.toString() === \"function anonymous(a,b\\n) {\\nreturn a + b\\n}\")\n\n  f = Function(\"\", \"\")\n  assert(f.toString() === \"function anonymous(\\n) {\\n\\n}\")\n\n  f = function*(){}.constructor(\"a,b\", \"c\", \"yield a; return b + c\")\n  assert(f.toString() === \"function* anonymous(a,b,c\\n) {\\nyield a; return b + c\\n}\")\n\n  f = async function(){}.constructor(\"a\", \"return a + 'x'\")\n  assert(f.toString() === \"async function anonymous(a\\n) {\\nreturn a + 'x'\\n}\")\n\n  f = async function*(){}.constructor(\"a=3\", \"return a\")\n  assert(f.toString() === \"async function* anonymous(a=3\\n) {\\nreturn a\\n}\")\n\n  f = Function(\"a = function(x) { return x + 3 }\", \"return a\")\n  assert(f().toString() === \"function(x) { return x + 3 }\")\n\n  f = Function(\"return function(x) { return x + 3 }\")\n  assert(f().toString() === \"function(x) { return x + 3 }\")\n\n  /* Arrow functions. */\n  f = x => x + 1/**/\n  assert(f.toString() === \"x => x + 1\")\n\n  f =x => { return x + 1 }/**/\n  assert(f.toString() === \"x => { return x + 1 }\")\n\n  f = (/**/) => 'x' //\n    + y\n  assert(f.toString() === \"(/**/) => 'x' //\\n    + y\")\n\n  f =  async  x  =>  x + 1\n  assert(f.toString() === \"async  x  =>  x + 1\")\n\n  f =/**/async (x,/**/y)=>/**/null\n  assert(f.toString() === \"async (x,/**/y)=>/**/null\")\n}\n"
  },
  {
    "path": "tests/jerry/function-rest-parameter.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction CheckSyntaxError (str)\n{\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n\n  /* force the pre-scanner */\n  try {\n    eval ('switch (1) { default: ' + str + '}');\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\nCheckSyntaxError ('function x (a, b, ...c, d) {}');\nCheckSyntaxError ('function x (... c = 5) {}');\nCheckSyntaxError ('function x (...) {}');\nCheckSyntaxError ('function x (a, a, ...a) {}');\nCheckSyntaxError ('\"use strict\" function x (...arguments) {}');\nCheckSyntaxError ('var o = { set e (...args) { } }');\n\nrest_params = ['hello', true, 7, {}, [], function () {}];\n\nfunction f (x, y, ...a) {\n  for (var i = 0; i < a.length; i++) {\n    assert (a[i] == rest_params[i]);\n  }\n  return (x + y) * a.length;\n}\n\nassert (f (1, 2, rest_params[0], rest_params[1], rest_params[2]) === 9);\nassert (f.length === 2);\n\nfunction g (...a) {\n  return a.reduce (function (accumulator, currentValue) { return accumulator + currentValue });\n}\n\nassert (g (1, 2, 3, 4) === 10);\n\nfunction h (...arguments) {\n  return arguments.length;\n}\n\nassert (h (1, 2, 3, 4) === 4);\n\nfunction f2 (a = 1, b = 1, c = 1, ...d) {\n  assert (JSON.stringify (d) === '[]');\n  return a + b + c;\n}\n\nassert (f2 () === 3);\nassert (f2 (2) === 4);\nassert (f2 (2, 3) === 6);\nassert (f2 (2, 3, 4) === 9);\n\nfunction g2 (a = 5, b = a + 1, ...c) {\n  return a + b + c.length;\n}\n\nassert (g2 () === 11);\nassert (g2 (1) === 3);\nassert (g2 (1, 2) === 3);\nassert (g2 (1, 2, 3) === 4);\n\nfunction args(a, ...b)\n{\n  assert(a === 1);\n  assert(arguments[0] === 1);\n\n  a = 5;\n\n  assert(a === 5);\n  assert(arguments[0] === 1);\n\n  assert(arguments[1] === 2);\n  assert(b[0] === 2)\n}\nargs(1, 2);\n"
  },
  {
    "path": "tests/jerry/function-return.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f_empty()\n{\n  return;\n}\n\nfunction f_42()\n{\n  return 42;\n}\n\nfunction f_expr()\n{\n  var a = 5;\n  var b = 5;\n  return a + b;\n}\n\nassert(f_expr() === 10);\nassert(f_42() === 42);"
  },
  {
    "path": "tests/jerry/function-scope.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f1(a)\n{\n  assert(a === 2)\n  {\n    assert(a() === 1)\n    function a() { return 1 }\n  }\n  assert(a === 2)\n}\nf1(2)\n\nfunction f2([a])\n{\n  assert(a === 4)\n  {\n    assert(a() === 3)\n    function a() { return 3 }\n  }\n  assert(a === 4)\n}\nf2([4])\n\nfunction f3(a)\n{\n  assert(a() === 5)\n  {\n    assert(a() === 6)\n    function a() { return 6 }\n  }\n  assert(a() === 5)\n\n  function a() { return 5 }\n}\nf3(7)\n\nfunction f4(a)\n{\n  assert(a === 8)\n  {\n    eval(\"function a() { return 9 }\")\n    assert(a() === 9)\n  }\n  assert(a() === 9)\n}\nf4(8)\n\nfunction f5(a, b = function() { return a }) {\n  function a() { return 9 }\n\n  assert(a() === 9)\n  assert(b() === 10)\n}\nf5(10)\n"
  },
  {
    "path": "tests/jerry/function-scope2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = 1;\nvar b = 2;\n\nfunction f(x = eval(\"eval('var a = 3; function b() { return 4 } () => a')\"), y = b) {\n  eval(\"eval('var a = 5; function b() { return 6 }')\");\n\n  assert(a === 5);\n  assert(b() === 6);\n\n  assert(x() === 3);\n  assert(y() === 4);\n\n  delete a;\n  delete b;\n\n  assert(a === 3);\n  assert(b() === 4);\n\n  assert(x() === 3);\n  assert(y() === 4);\n\n  delete a;\n  delete b;\n\n  assert(a === 1);\n  assert(b === 2);\n\n  assert(x() === 1);\n  assert(y() === 4);\n}\nf()\n\nfunction g() {\n  'use strict'\n\n  function h(x, y = function() { return x }) {\n    var x = 2;\n\n    /* This should not overwrite y. */\n    eval(\"var y = 3; assert (y === 3)\");\n\n    assert(x === 2);\n    assert(typeof y === \"function\");\n    assert(y() === 1);\n  }\n  h(1);\n}\ng();\n\nfunction h(a, get = () => a, set = (v) => a = v) {\n  assert(a === 1);\n\n  var a = 2;\n\n  assert(a === 2);\n  assert(get() === 1);\n\n  set(3)\n  a = 4;\n\n  assert(a === 4);\n  assert(get() === 3);\n}\nh(1);\n\nfunction i([a], get = () => a, set = (v) => a = v) {\n  assert(a === 1);\n\n  var a;\n  assert(a === 1);\n\n  a = 2;\n\n  assert(a === 2);\n  assert(get() === 1);\n\n  set(3)\n  a = 4;\n\n  assert(a === 4);\n  assert(get() === 3);\n}\ni([1]);\n\nfunction j(a = eval()) {\n  var a = 3.14;\n\n  try {\n    eval(\"throw 1; function a() { return 8; }\")\n    assert(false)\n  } catch (e) {\n    assert(e === 1)\n  }\n\n  assert(a() === 8)\n}\nj()\n"
  },
  {
    "path": "tests/jerry/function-scopes.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  (function() {\n    function decl() {}\n  })();\n  decl();\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n\ntry {\n  var o = {\n    get p() {\n      function decl() {\n      }\n    }\n  };\n  decl();\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/function.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Function.constructor === Function);\nassert(Function.prototype() === undefined);\nassert(Function.length === 1);\n"
  },
  {
    "path": "tests/jerry/function.prototype.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f (arg1, arg2, arg3)\n{\n  this.string = arg1;\n  this.number = arg2;\n  this.boolean = arg3;\n}\n\nvar this_arg = {};\n\nf.call (this_arg, 's', 1, true, null);\n\nassert (this_arg.string  === 's');\nassert (this_arg.number  === 1);\nassert (this_arg.boolean === true);\n"
  },
  {
    "path": "tests/jerry/gc.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {}, obj_l;\nobj_l = obj;\n\nfor (var k = 0; k < 1500; k++)\n{\n  obj_l.prop = {};\n  obj_l = obj_l.prop;\n}\n\nfunction f (o, i) {\n  if (--i > 0) {\n    f ({a:o, b:o}, i);\n  }\n}\n\nfor (var i = 0; i < 100; i++)\n{\n  ({} + f ({}, 12));\n}\n"
  },
  {
    "path": "tests/jerry/generator-function-in-single-statement.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nfunction parse(txt) {\n    try {\n        eval(txt)\n        assert(false)\n    } catch (e) {\n        assert(e instanceof SyntaxError)\n    }\n}\n\nparse(\"if (true) function* g() {  }\")\nparse(\"if (false) ; else function* g() {  }\")\n"
  },
  {
    "path": "tests/jerry/generator-function.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\n// Test %GeneratorPrototype%\n(function () {\n  function* generatorFn(){}\n  var ownProto = Object.getPrototypeOf(generatorFn());\n  var sharedProto = Object.getPrototypeOf(ownProto);\n\n  assert(ownProto === generatorFn.prototype);\n  assert(sharedProto !== Object.prototype);\n  assert(sharedProto === Object.getPrototypeOf(function*(){}.prototype));\n  assert(sharedProto.hasOwnProperty('next'));\n})();\n\n// Test %GeneratorPrototype% prototype chain\n(function () {\n  function* generatorFn(){}\n  var g = generatorFn();\n  var ownProto = Object.getPrototypeOf(g);\n  var sharedProto = Object.getPrototypeOf(ownProto);\n  var iterProto = Object.getPrototypeOf(sharedProto);\n\n  assert(ownProto === generatorFn.prototype);\n  assert(iterProto.hasOwnProperty(Symbol.iterator));\n  assert(!sharedProto.hasOwnProperty(Symbol.iterator));\n  assert(!ownProto.hasOwnProperty(Symbol.iterator));\n  assert(g[Symbol.iterator]() === g);\n})();\n\n// Test %GeneratorPrototype% prototype chain\n(function () {\n  function* g(){}\n  var iterator = new g.constructor(\"a\",\"b\",\"c\",\"() => yield\\n yield a; yield b; yield c;\")(1,2,3);\n\n  var item = iterator.next();\n  assert(item.value === 1);\n  assert(item.done === false);\n\n  item = iterator.next();\n  assert(item.value === 2);\n  assert(item.done === false);\n\n  item = iterator.next();\n  assert(item.value === 3);\n  assert(item.done === false);\n\n  item = iterator.next();\n  assert(item.value === undefined);\n  assert(item.done === true);\n\n  assert(g.constructor === (function*(){}).constructor);\n})();\n\n// Test GeneratorFunction parsing\n(function () {\n  function *f() {};\n\n  try {\n    Object.getPrototypeOf(f).constructor(\"yield\", \"\");\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n})();\n\n// Test correct property membership\n(function () {\n  function *f() {};\n\n  Object.getPrototypeOf(f).xx = 5;\n  assert(Object.getPrototypeOf(f).prototype.constructor.xx === 5);\n})();\n\n// Test GetPrototypeFromConstructor\n(function () {\n  function *f() {};\n\n  var originalProto = f.prototype;\n  f.prototype = 5;\n  assert(Object.getPrototypeOf(f()) === Object.getPrototypeOf(originalProto));\n  var fakeProto = { x : 6 };\n  f.prototype = fakeProto;\n  assert(Object.getPrototypeOf(f()) === fakeProto);\n  assert(f.next === undefined);\n})();\n"
  },
  {
    "path": "tests/jerry/generator-initializer.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file checks core generator operations. */\n\nfunction check_syntax_error (code)\n{\n  try {\n    eval (code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\ncheck_syntax_error (\"({ * })\")\ncheck_syntax_error (\"({ *, b:4 })\")\ncheck_syntax_error (\"({ *a:4 })\")\ncheck_syntax_error (\"({ *['a']:4 })\")\ncheck_syntax_error (\"({ *a(yield) {} })\")\ncheck_syntax_error (\"({ get *a() {} })\")\ncheck_syntax_error (\"({ set *b(v) {} })\")\n\ncheck_syntax_error (\"class C { * }\")\ncheck_syntax_error (\"class C { static * }\")\ncheck_syntax_error (\"class C { *() {} }\")\ncheck_syntax_error (\"class C { static * () {} }\")\ncheck_syntax_error (\"class C { *['a'] {} }\")\n\nfunction check_result(result, value, done)\n{\n  assert(result.value === value)\n  assert(result.done === done)\n}\n\nfunction postfix(a) { return a + \"b\" }\n\nvar o = {\n  * a () {\n    yield 1\n    return 2\n  },\n  *2(x) {\n    yield x + 1\n    return x + 2\n  },\n  *[postfix(\"a\")]() {\n    var o = { get yield() { return 3 + 2 } }\n\n    yield o.yield\n    return 6\n  },\n  *yield() {\n    var o = { yield:7 }\n\n    yield o.yield\n    return 8\n  }\n}\n\nvar f = o.a()\ncheck_result(f.next(), 1, false)\ncheck_result(f.next(), 2, true)\n\nvar f = o[2](2)\ncheck_result(f.next(), 3, false)\ncheck_result(f.next(), 4, true)\n\nvar f = o.ab()\ncheck_result(f.next(), 5, false)\ncheck_result(f.next(), 6, true)\n\nvar f = o.yield()\ncheck_result(f.next(), 7, false)\ncheck_result(f.next(), 8, true)\n\nclass C {\n  * a () {\n    yield 1\n    return 2\n  }\n\n  *3(x) {\n    yield x + 1\n    return x + 2\n  }\n\n  *[postfix(\"a\")]() {\n    var o = { get yield() { return 3 + 2 } }\n\n    yield o.yield\n    return 6\n  }\n\n  static *yield() {\n    var o = { yield:7 }\n\n    yield o.yield\n    return 8\n  }\n\n  static * [postfix(\"b\") ] (v = 9) {\n    return v\n  }\n}\n\nvar c = new C\n\nvar f = c.a()\ncheck_result(f.next(), 1, false)\ncheck_result(f.next(), 2, true)\n\nvar f = c[3](2)\ncheck_result(f.next(), 3, false)\ncheck_result(f.next(), 4, true)\n\nvar f = c.ab()\ncheck_result(f.next(), 5, false)\ncheck_result(f.next(), 6, true)\n\nvar f = C.yield()\ncheck_result(f.next(), 7, false)\ncheck_result(f.next(), 8, true)\n\nvar f = C.bb()\ncheck_result(f.next(), 9, true)\n"
  },
  {
    "path": "tests/jerry/generator-return.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_result(result, value, done)\n{\n  assert(result.value === value)\n  assert(result.done === done)\n}\n\nfunction * gen1(a) {\n  return \"a: \" + (yield a.p)\n}\n\nvar f = gen1({})\ncheck_result(f.return(4), 4, true)\ncheck_result(f.next(), undefined, true)\n\nf = gen1({ p:\"x\" })\ncheck_result(f.next(), \"x\", false)\ncheck_result(f.return(10), 10, true)\ncheck_result(f.next(), undefined, true)\n\nf = gen1({ p:\"b\" })\ncheck_result(f.next(), \"b\", false)\ncheck_result(f.next(), \"a: undefined\", true)\ncheck_result(f.next(), undefined, true)\n\nfunction*gen2() {\n  try {\n    for (let i in { x:1, y:2 })\n    {\n      assert((yield i) === \"33\")\n    }\n    assert(false)\n  } catch (e) {\n    assert(false)\n  } finally {\n    yield \"z\"\n  }\n}\n\nf = gen2()\ncheck_result(f.return(\"ret\"), \"ret\", true)\ncheck_result(f.next(), undefined, true)\n\nf = gen2()\ncheck_result(f.next(), \"x\", false)\ncheck_result(f.return(\"ret\"), \"z\", false)\ncheck_result(f.next(), \"ret\", true)\ncheck_result(f.next(), undefined, true)\n\nfunction* gen3() {\n  try {\n    return 8\n  } finally {\n    yield 1\n  }\n}\n\nf = gen3()\ncheck_result(f.next(), 1, false)\ncheck_result(f.return(2), 2, true)\n"
  },
  {
    "path": "tests/jerry/generator-throw.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_result(result, value, done)\n{\n  assert(result.value === value)\n  assert(result.done === done)\n}\n\nfunction check_throw(str, expected)\n{\n  try {\n    eval(str)\n    assert(false);\n  } catch (e) {\n    assert(e === expected);\n  }\n}\n\nfunction * gen1(a) {\n  return \"a: \" + (yield a.p)\n}\n\nvar f = gen1({})\ncheck_throw(\"f.throw(4)\", 4)\ncheck_result(f.next(), undefined, true)\n\nf = gen1({ p:\"x\" })\ncheck_result(f.next(), \"x\", false)\ncheck_throw(\"f.throw(10)\", 10)\ncheck_result(f.next(), undefined, true)\n\nf = gen1({ p:\"b\" })\ncheck_result(f.next(), \"b\", false)\ncheck_result(f.next(), \"a: undefined\", true)\ncheck_result(f.next(), undefined, true)\n\nfunction*gen2() {\n  try {\n    for (let i in { x:1, y:2 })\n    {\n      assert((yield i) === \"33\")\n    }\n    assert(false)\n  } finally {\n    yield \"z\"\n  }\n}\n\nf = gen2()\ncheck_throw(\"f.throw('throw')\", \"throw\")\ncheck_result(f.next(), undefined, true)\n\nf = gen2()\ncheck_result(f.next(), \"x\", false)\ncheck_result(f.throw(\"throw\"), \"z\", false)\ncheck_throw(\"f.next()\", \"throw\")\ncheck_result(f.next(), undefined, true)\n\nfunction/* generator */*/* generator */gen3() {\n  try {\n    return 8\n  } finally {\n    yield 1\n  }\n}\n\nf = gen3()\ncheck_result(f.next(), 1, false)\ncheck_throw(\"f.throw(2)\", 2)\n\nfunction\n  /* generator */\n  *\n  /* generator */\n  gen4()\n{\n}\n\nf = gen4()\ncheck_result(f.next(), undefined, true)\ncheck_throw(\"f.throw('Str')\", \"Str\")\n"
  },
  {
    "path": "tests/jerry/generator-yield-iterator.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_result(result, value, done)\n{\n  assert(result.value === value)\n  assert(result.done === done)\n}\n\nfunction *gen1() {\n  yield 1\n  yield *[2,3,4]\n  yield 5\n}\n\nvar g = gen1()\ncheck_result(g.next(), 1, false)\ncheck_result(g.next(), 2, false)\ncheck_result(g.next(), 3, false)\ncheck_result(g.next(), 4, false)\ncheck_result(g.next(), 5, false)\ncheck_result(g.next(), undefined, true)\n\nfunction *gen2() {\n  yield * true\n}\n\ntry {\n  g = gen2()\n  g.next()\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\nvar t0 = 0, t1 = 0\n\nfunction *gen3() {\n  function *f() {\n    try {\n      yield 5\n    } finally {\n      t0 = 1\n    }\n  }\n\n  try {\n    yield *f()\n  } finally {\n    t1 = 1\n  }\n}\n\ng = gen3()\ncheck_result(g.next(), 5, false)\ncheck_result(g.return(13), 13, true)\nassert(t0 === 1)\nassert(t1 === 1)\n\nt0 = -1\nt1 = 0\n\nfunction *gen4() {\n  function next(arg)\n  {\n    t0++;\n\n    if (t0 === 0)\n    {\n      assert(arg === undefined);\n      return { value:2, done:false }\n    }\n    if (t0 === 1)\n    {\n      assert(arg === -3);\n      return { value:3, done:false }\n    }\n    assert(arg === -4);\n    return { value:4, done:true }\n  }\n\n  var o = { [Symbol.iterator]() { return { next } } }\n  assert((yield *o) === 4)\n  return 5;\n}\n\ng = gen4()\ncheck_result(g.next(-2), 2, false)\ncheck_result(g.next(-3), 3, false)\ncheck_result(g.next(-4), 5, true)\n\nfunction *gen5() {\n  function *f() {\n    try {\n      yield 1\n      assert(false)\n    } catch (e) {\n      assert(e === 10)\n    }\n    return 2\n  }\n\n  assert((yield *f()) === 2)\n  yield 3\n}\n\ng = gen5()\ncheck_result(g.next(), 1, false)\ncheck_result(g.throw(10), 3, false)\n\nvar o = {}\nvar state = 0\nvar iter6 = {\n  [Symbol.iterator]() {\n    return {\n      get next() {\n        assert(++state === 2)\n        return function () {\n          return { value:\"Res\", done:false }\n        }\n      },\n      get throw() {\n        ++state\n        assert(state === 4 || state === 9 || state == 14)\n        return function (v) {\n          assert(v === \"Input\")\n          return { value:o, done:false }\n        }\n      },\n      get return() {\n        ++state\n        assert(state === 6 || state === 11 || state == 16)\n        return function (v) {\n          assert(v === o)\n          return { value:4.5, done:false }\n        }\n      }\n    }\n  }\n}\n\nfunction *gen6() {\n  assert(++state === 1)\n  yield *iter6\n  assert(false)\n}\n\ng = gen6()\ncheck_result(g.next(), \"Res\", false)\nassert(++state === 3)\ncheck_result(g.throw(\"Input\"), o, false)\nassert(++state === 5)\ncheck_result(g.return(o), 4.5, false)\nassert(++state === 7)\n\ncheck_result(g.next(), \"Res\", false)\nassert(++state === 8)\ncheck_result(g.throw(\"Input\"), o, false)\nassert(++state === 10)\ncheck_result(g.return(o), 4.5, false)\nassert(++state === 12)\n\ncheck_result(g.next(), \"Res\", false)\nassert(++state === 13)\ncheck_result(g.throw(\"Input\"), o, false)\nassert(++state === 15)\ncheck_result(g.return(o), 4.5, false)\nassert(++state === 17)\n\nstate = 0\nvar iter7 = {\n  [Symbol.iterator]() {\n    return {\n      get next() {\n        assert(++state === 2)\n        return \"Not callable\"\n      }\n    }\n  }\n}\n\nfunction *gen7() {\n  assert(++state === 1)\n  yield *iter7\n  assert(false)\n}\n\ng = gen7()\ntry {\n  g.next()\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n"
  },
  {
    "path": "tests/jerry/generator-yield.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file checks yield syntax errors. */\n\nfunction check_syntax_error(str)\n{\n  try {\n    eval(str);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n\nfunction  *  gen()\n{\n  yield , yield\n\n  yield\n     , yield\n\n  (yield\n  )\n\n  yield[\n  1]\n}\n\nfunction*gen2()\n{\n  1 ?\n    yield\n  :\n    yield\n}\n\nvar gen3 = function*(){\n  (yield)/[yield]\n}\n\ncheck_syntax_error(\"function *gen(){ yield % yield }\");\ncheck_syntax_error(\"function *gen(){ (yield) % yield }\");\ncheck_syntax_error(\"function *gen(){ yield % (yield) }\");\ncheck_syntax_error(\"function *gen(){ (yield\\n1) }\");\ncheck_syntax_error(\"function *gen(){ function yield() {} }\");\ncheck_syntax_error(\"function *gen(){ (yield)=>1 }\");\ncheck_syntax_error(\"function *gen(){ yield => 1 }\");\ncheck_syntax_error(\"function *gen(){ yi\\\\u0065ld 1 }\");\n\nfunction *gen4() {\n  var f = function yield(i) {\n    if (i = 0)\n      return yield(i + 1)\n\n    return 39\n  }\n\n  return f(0)\n}\n\nassert(gen4().next().value === 39);\n\n(function *() {\n  () => yield\n  yield 1;\n})\n\nfunction *gen5() {\n  var o = {\n    [\"f\"]() { yield % yield }\n  }\n  yield 1;\n}\n"
  },
  {
    "path": "tests/jerry/generator.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file checks core generator operations. */\n\nfunction check_result(result, value, done)\n{\n  assert(result.value === value)\n  assert(result.done === done)\n}\n\nfunction * gen1(a = (t = 8)) {\n  var o = { p: 2 }\n  var x = 3.25\n\n  assert((o.p + (yield 10)) === 23)\n  assert((o.p + (yield 11)) === 24)\n  return x\n}\n\n/* Cannot be invoked with new. */\ntry {\n  new gen1\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\n/* Fully read values. */\nvar t = 0\nvar g = gen1()\nassert(t === 8)\n\ncheck_result(g.next(20), 10, false)\ncheck_result(g.next(21), 11, false)\ncheck_result(g.next(22), 3.25, true)\ncheck_result(g.next(23), undefined, true)\n\n/* Partly read values (gc needs to free a suspended generator). */\nt = 0\ng = gen1()\nassert(t === 8)\n\ncheck_result(g.next(20), 10, false)\n\nfunction * gen2() {\n  for (i in { x:0, y:1, z:2 })\n  {\n    let a = eval(\"'s'\")\n\n    var b = yield a + i\n    assert (b === ++t)\n  }\n}\n\n/* Fully read values. */\nt = 0\nf = gen2()\n\ncheck_result(f.next(0), \"sx\", false)\ncheck_result(f.next(1), \"sy\", false)\ncheck_result(f.next(2), \"sz\", false)\ncheck_result(f.next(3), undefined, true)\ncheck_result(f.next(4), undefined, true)\n\n/* Partly read values (gc needs to free a suspended generator). */\nf = gen2()\n\nt = 0\ncheck_result(f.next(0), \"sx\", false)\n\nfunction *gen3() {\n  function f(yield) {\n    return -yield * 2\n  }\n\n  var g = (v) => {\n    assert(v === 6)\n  }\n\n  g(yield yield f(++t))\n\n  return 77\n}\n\n/* Fully read values. */\nt = 0\nf = gen3()\n\ncheck_result(f.next(0), -2, false)\ncheck_result(f.next(88), 88, false)\ncheck_result(f.next(6), 77, true)\n\n/* Partly read values (gc needs to free a suspended generator). */\nt = 0\nf = gen3()\n\ncheck_result(f.next(0), -2, false)\n\nfunction\n      /* generator: */ *\n      /* name: */ gen4() {\n\n  let a = eval(\"5\")\n  with ({a})\n  {\n    let a = eval(\"6\")\n\n    for (let a = 10; a < 11; a++)\n    {\n      let a = eval(\"7\")\n      yield (a)\n    }\n\n    yield a, !assert(a === 6)\n  }\n  assert((yield a) === undefined)\n}\n\n/* Fully read values. */\nf = gen4()\n\ncheck_result(f.next(), 7, false)\ncheck_result(f.next(), 6, false)\ncheck_result(f.next(), 5, false)\ncheck_result(f.next(), undefined, true)\n\n/* Partly read values (gc needs to free a suspended generator). */\nf = gen4()\n\ncheck_result(f.next(), 7, false)\n\nfunction*gen5(a,b,c,d) {\n  yield a\n  yield b\n  yield c\n  yield d\n}\n\n/* Fully read values. */\nt = []\nfor(let i of gen5(1,3,5,7)) {\n  t.push(i)\n}\n\nassert(t.length === 4)\nassert(t[0] === 1)\nassert(t[1] === 3)\nassert(t[2] === 5)\nassert(t[3] === 7)\n\n/* Partly read values (gc needs to free a suspended generator). */\nt = []\nfor(let i of gen5(1,3,5,7)) {\n  t.push(i)\n  if (i === 3) {\n    break\n  }\n}\n\nassert(t.length === 2)\nassert(t[0] === 1)\nassert(t[1] === 3)\n\n/* Recursive generator call. */\nfunction* gen6(a,b,c,d) {\n  yield f.next()\n}\n\nf = gen6()\n\ntry {\n  f.next()\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\n/* Parameterless yield. */\nfunction* gen7() {\n  yield\n}\n\nf = gen7()\ncheck_result(f.next(), undefined, false)\ncheck_result(f.next(), undefined, true)\n\n"
  },
  {
    "path": "tests/jerry/get-value.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\n/*\n * Check that in case of 'primitive' base, 'this' argument of [[Call]] is the base value, not ToObject (base).\n */\nfunction test_1 ()\n{\n 'use strict';\n\n Object.defineProperty (Number.prototype,\n                        'getter',\n                        { get : function () { return this; }, configurable : true });\n\n assert ((10).getter === 10);\n assert (typeof ((10).getter) === 'number');\n\n delete Number.prototype.getter;\n}\n\ntest_1 ();\n"
  },
  {
    "path": "tests/jerry/getter-setter-this-value.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction Box(data) {\n  this._data = data;\n}\n\nvar box = new Box('=');\n\nObject.defineProperty(Box.prototype, 'data', {\n  get: function () {\n    assert(this === box);\n    return this._data;\n  },\n  set: function (data) {\n    assert(this === box);\n    this._data = data;\n  }\n});\n\nassert(box.data === '=');\nbox.data = '+';\nassert(box.data === '+');\n\nfunction test_access(value, proto) {\n  \"use strict\"\n\n  Object.defineProperty(proto, 'test', {\n    get: function () { assert (this === value) },\n    set: function () { assert (this === value) }\n  });\n\n  value.test;\n  value.test = undefined;\n}\n\ntest_access (\"str\", String.prototype);\ntest_access (1, Number.prototype);\ntest_access (true, Boolean.prototype);\n"
  },
  {
    "path": "tests/jerry/global-escaping.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Escaping\n\nassert (escape (\"\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f\") ===\n        \"%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F\");\nassert (escape (\"\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f\") ===\n        \"%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F\");\nassert (escape (\" !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN\") ===\n        \"%20%21%22%23%24%25%26%27%28%29*+%2C-./0123456789%3A%3B%3C%3D%3E%3F@ABCDEFGHIJKLMN\");\nassert (escape (\"OPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}\\x7F\") ===\n        \"OPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7F\");\n\nassert (escape(\"\\x80\\x95\\xaf\\xfe\\xff\") === \"%80%95%AF%FE%FF\");\nassert (escape(\"\\u0100\\ud800\\udc00\") === \"%u0100%uD800%uDC00\");\n\nassert (escape({}) === \"%5Bobject%20Object%5D\");\nassert (escape(true) === \"true\");\n\n// Unescaping\n\nassert (unescape (\"%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F\") ===\n        \"\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f\");\nassert (unescape(\"%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F\") ===\n        \"\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f\");\nassert (unescape(\"%20%21%22%23%24%25%26%27%28%29*+%2C-./0123456789%3A%3B%3C%3D%3E%3F@ABCDEFGHIJKLMN\") ===\n        \" !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN\");\nassert (unescape(\"OPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7F\") ===\n        \"OPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}\\x7F\");\nassert (unescape(\"%80%95%AF%FE%FF\") === \"\\x80\\x95\\xaf\\xfe\\xff\");\nassert (unescape(\"%ud800\") === \"\\ud800\");\nassert (unescape(\"\\ud800\") === \"\\ud800\");\nassert (unescape(\"\\ud800\\udc00\") === \"\\ud800\\udc00\");\nassert (unescape(\"%ud800%udc00\") === \"\\ud800\\udc00\");\nassert (unescape(\"\\ud800%udc00\") === \"\\ud800\\udc00\");\nassert (unescape(\"%ud800\\udc00\") === \"\\ud800\\udc00\");\n\nassert (unescape({}) === \"[object Object]\");\nassert (unescape(true) === \"true\")\nassert (unescape() === \"undefined\");\nassert (unescape(1985) === \"1985\");\nassert (unescape(\"%5#%uu\") === \"%5#%uu\");\n\n// Inversion\n\nvar str = \"\\u0001\\u0000\\uFFFF\";\nassert (unescape(escape(str)) === str);\n"
  },
  {
    "path": "tests/jerry/global-parsefloat.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(parseFloat(\"1\") === 1);\nassert(parseFloat(\"+1\") === 1);\nassert(parseFloat(\"-1\") === -1);\nassert(parseFloat(\"1.2\") === 1.2);\nassert(parseFloat(\"+1.2\") === 1.2);\nassert(parseFloat(\"-1.2\") === -1.2);\nassert(parseFloat(\"1.2e3\") === 1200);\nassert(parseFloat(\"+1.2e3\") === 1200);\nassert(parseFloat(\"-1.2e3\") === -1200);\nassert(parseFloat(\"   \\n\\t  1.2e3\") === 1200);\nassert(parseFloat(\"03.02e1\") === 30.2);\nassert(parseFloat(\"003.\") === 3);\nassert(parseFloat(\".2e3\") === 200);\nassert(parseFloat(\"1.e3\") === 1000);\nassert(parseFloat(\"1.2e\") === 1.2);\nassert(parseFloat(\"1.e\") === 1);\nassert(parseFloat(\"1.e3\") === 1000);\nassert(parseFloat(\"1e3\") === 1000);\nassert(parseFloat(\"1e\") === 1);\nassert(parseFloat(\"1.2e3foo\") === 1200);\nassert(isNaN(parseFloat(\"foo1.2e3foo\")));\nassert(parseFloat(\"Infinity\") === Infinity);\nassert(parseFloat(\"-Infinity\") === -Infinity);\nassert(parseFloat(\"Infinityfoo\") === Infinity);\nassert(parseFloat(\"-Infinityfoo\") === -Infinity);\nassert(isNaN(parseFloat(\"\")));\nassert(isNaN(parseFloat(\".\")));\nassert(isNaN(parseFloat(\"..\")));\nassert(isNaN(parseFloat(\"+\")));\nassert(isNaN(parseFloat(\"-\")));\nassert(isNaN(parseFloat(\"e\")));\nassert(isNaN(parseFloat(\"a\")));\nassert(isNaN(parseFloat(\"e+\")));\nassert(isNaN(parseFloat(\"+e-\")));\nassert(isNaN(parseFloat(\".e\")));\nassert(isNaN(parseFloat(\".a\")));\nassert(isNaN(parseFloat(\"e3\")));\nassert(isNaN(parseFloat(\".e3\")));\nassert(parseFloat(\"1..2\") === 1);\nassert(parseFloat(\"1.2.3\") === 1.2);\nassert(parseFloat(\"1.2ee3\") === 1.2);\nassert(parseFloat(\"0\") === 0);\nassert(parseFloat(\".0\") === 0);\nassert(parseFloat(\"0.e3\") === 0);\nassert(parseFloat(\"0.0e3\") === 0);\nassert(parseFloat(\"1.2eA\") === 1.2);\nassert(parseFloat(\"1.ae3\") === 1);\nassert(parseFloat(\"\\u00a0\\u00a01.2e3\") === 1200);\nassert(parseFloat(\"\\u2029\\u2029\\u00a01.2e\\u00D0\") === 1.2);\nassert(isNaN(parseFloat(\"\\u2029\\u2029\\u00a0\\u00D01.2e3\")));\nassert(parseFloat(\"\\u2029\\u2029\\u00a01.\\u20292e\\u00D0\") === 1);\nassert(isNaN(parseFloat(\"\\u2029\\u2029\")));\n\nvar obj = new Object();\nvar arr = [3,4,5];\nvar num = 7;\nvar bool = true;\nvar undef;\n\nassert(isNaN(parseFloat(obj)));\nassert(parseFloat(arr) === 3);\nassert(parseFloat(num) === 7);\nassert(isNaN(parseFloat(bool)));\nassert(isNaN(parseFloat(undef)));\n\nvar obj = { toString : function () { throw new ReferenceError(\"foo\") } };\ntry {\n  parseFloat(obj);\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n  assert(e.message === \"foo\");\n}\n"
  },
  {
    "path": "tests/jerry/global-parseint.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(parseInt(\"123\") === 123);\nassert(parseInt(\"+123\") === 123);\nassert(parseInt(\"-123\") === -123);\nassert(parseInt(\"0123\") === 123);\nassert(parseInt(\"  123\") === 123);\nassert(parseInt(\" \\n  123\") === 123);\nassert(parseInt(\" \\n  123  \\t\") === 123);\nassert(parseInt(\"0x123\") === 291);\nassert(parseInt(\"0X123\") === 291);\nassert(parseInt(\"123\", 4) === 27);\nassert(parseInt(\"ABC\", 16) === 2748);\nassert(parseInt(\"12A3\") === 12);\nassert(parseInt(\"12.34\") === 12);\nassert(isNaN(parseInt(\"AB\")));\nassert(isNaN(parseInt(\"\")));\nassert(isNaN(parseInt(\"-\")));\nassert(isNaN(parseInt(\"-\", 11)));\nassert(parseInt(\"\\u00a0123\") === 123);\nassert(parseInt(\"\\u20291  123\\u00D0\") === 1);\nassert(parseInt(\"\\u00a0123\", 13) === 198);\nassert(parseInt(\"\\u2029123  1\\u00D0\", 11) === 146);\nassert(isNaN(parseInt(\"\\u0009\")));\nassert(isNaN(parseInt(\"\\u00A0\")));\nassert(parseInt(\"\\u00A0\\u00A0-1\") === parseInt(\"-1\"));\nassert(parseInt(\"\\u00A01\") === parseInt(\"1\"));\n\nvar bool = true;\nvar obj = new Object();\nvar num = 8;\nvar arr = [2,3,4];\nvar undef;\n\nassert(isNaN(parseInt(bool, bool)));\nassert(isNaN(parseInt(bool, obj)));\nassert(isNaN(parseInt(bool, num)));\nassert(isNaN(parseInt(bool, arr)));\n\nassert(isNaN(parseInt(obj, bool)));\nassert(isNaN(parseInt(obj, obj)));\nassert(isNaN(parseInt(obj, num)));\nassert(isNaN(parseInt(obj, arr)));\n\nassert(isNaN(parseInt(num, bool)));\nassert(parseInt(num, obj) === 8);\nassert(isNaN(parseInt(num, num)));\nassert(parseInt(num, arr) === 8);\n\nassert(isNaN(parseInt(arr, bool)));\nassert(parseInt(arr, obj) === 2);\nassert(parseInt(arr, num) === 2);\nassert(parseInt(arr, arr) === 2);\n\nassert(isNaN(parseInt(undef, bool)));\nassert(isNaN(parseInt(undef, obj)));\nassert(isNaN(parseInt(undef, num)));\nassert(isNaN(parseInt(undef, arr)));\n\nvar obj = { toString : function () { throw new ReferenceError(\"foo\") } };\ntry {\n  parseInt(obj);\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n  assert(e.message === \"foo\");\n}\n"
  },
  {
    "path": "tests/jerry/global-this.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(this === globalThis)\nassert(this.globalThis === globalThis)\n\nglobalThis = \"X\"\nassert(globalThis === \"X\")\n"
  },
  {
    "path": "tests/jerry/global-unescape.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright (C) 2016 the V8 project authors. All rights reserved.\n// This code is governed by the BSD license found in the LICENSE file.\n\nassert(unescape('%U0000') === '%U0000');\nassert(unescape('%t0000') === '%t0000');\nassert(unescape('%v0000') ==='%v0000');\nassert(unescape('%%0000') === '%\\x0000');\n\n// tests for two hexa unescape\nassert(unescape('%0%0000') === '%0\\x0000');\nassert(unescape('%0%0100') === '%0\\x0100');\n\nassert(unescape('%0%2900') === '%0)00');\nassert(unescape('%0%2a00') === '%0*00');\nassert(unescape('%0%2A00') === '%0*00');\nassert(unescape('%0%2b00') === '%0+00');\nassert(unescape('%0%2B00') === '%0+00');\nassert(unescape('%0%2c00') === '%0,00');\nassert(unescape('%0%2C00') === '%0,00');\nassert(unescape('%0%2d00') === '%0-00');\nassert(unescape('%0%2D00') === '%0-00');\n\nassert(unescape('%0%3900') === '%0900');\nassert(unescape('%0%3a00') === '%0:00');\nassert(unescape('%0%3A00') === '%0:00');\n\nassert(unescape('%0%3f00') === '%0?00');\nassert(unescape('%0%3F00') === '%0?00');\nassert(unescape('%0%4000') === '%0@00');\n\nassert(unescape('%0%5a00') === '%0Z00');\nassert(unescape('%0%5A00') === '%0Z00');\nassert(unescape('%0%5b00') === '%0[00');\nassert(unescape('%0%5B00') === '%0[00');\n\nassert(unescape('%0%5e00') === '%0^00');\nassert(unescape('%0%5E00') === '%0^00');\nassert(unescape('%0%5f00') === '%0_00');\nassert(unescape('%0%5F00') === '%0_00');\nassert(unescape('%0%6000') === '%0`00');\nassert(unescape('%0%6100') === '%0a00');\n\nassert(unescape('%0%7a00') === '%0z00');\nassert(unescape('%0%7A00') === '%0z00');\nassert(unescape('%0%7b00') === '%0{00');\nassert(unescape('%0%7B00') === '%0{00');\n\nassert(unescape('%0%fe00') === '%0\\xfe00');\nassert(unescape('%0%Fe00') === '%0\\xfe00');\nassert(unescape('%0%fE00') === '%0\\xfe00');\nassert(unescape('%0%FE00') === '%0\\xfe00');\n\nassert(unescape('%0%ff00') === '%0\\xff00');\nassert(unescape('%0%Ff00') === '%0\\xff00');\nassert(unescape('%0%fF00') === '%0\\xff00');\nassert(unescape('%0%FF00') === '%0\\xff00');\n\n// tests for unicode unescape\nassert(unescape('%0%u00290') === '%0)0');\nassert(unescape('%0%u002a0') === '%0*0');\nassert(unescape('%0%u002A0') === '%0*0');\nassert(unescape('%0%u002b0') === '%0+0');\nassert(unescape('%0%u002B0') === '%0+0');\nassert(unescape('%0%u002c0') === '%0,0');\nassert(unescape('%0%u002C0') === '%0,0');\nassert(unescape('%0%u002d0') === '%0-0');\nassert(unescape('%0%u002D0') === '%0-0');\n\nassert(unescape('%0%u00390') === '%090');\nassert(unescape('%0%u003a0') === '%0:0');\nassert(unescape('%0%u003A0') === '%0:0');\n\nassert(unescape('%0%u003f0') === '%0?0');\nassert(unescape('%0%u003F0') === '%0?0');\nassert(unescape('%0%u00400') === '%0@0');\n\nassert(unescape('%0%u005a0') === '%0Z0');\nassert(unescape('%0%u005A0') === '%0Z0');\nassert(unescape('%0%u005b0') === '%0[0');\nassert(unescape('%0%u005B0') === '%0[0');\n\nassert(unescape('%0%u005e0') === '%0^0');\nassert(unescape('%0%u005E0') === '%0^0');\nassert(unescape('%0%u005f0') === '%0_0');\nassert(unescape('%0%u005F0') === '%0_0');\nassert(unescape('%0%u00600') === '%0`0');\nassert(unescape('%0%u00610') === '%0a0');\n\nassert(unescape('%0%u007a0') === '%0z0');\nassert(unescape('%0%u007A0') === '%0z0');\nassert(unescape('%0%u007b0') === '%0{0');\nassert(unescape('%0%u007B0') === '%0{0');\n\nassert(unescape('%0%ufffe0') === '%0\\ufffe0');\nassert(unescape('%0%uFffe0') === '%0\\ufffe0');\nassert(unescape('%0%ufFfe0') === '%0\\ufffe0');\nassert(unescape('%0%uffFe0') === '%0\\ufffe0');\nassert(unescape('%0%ufffE0') === '%0\\ufffe0');\nassert(unescape('%0%uFFFE0') === '%0\\ufffe0');\n\nassert(unescape('%0%uffff0') === '%0\\uffff0');\nassert(unescape('%0%uFfff0') === '%0\\uffff0');\nassert(unescape('%0%ufFff0') === '%0\\uffff0');\nassert(unescape('%0%uffFf0') === '%0\\uffff0');\nassert(unescape('%0%ufffF0') === '%0\\uffff0');\nassert(unescape('%0%uFFFF0') === '%0\\uffff0');\n"
  },
  {
    "path": "tests/jerry/global-uri-coding.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// URI encoding\n\n// This test will not pass on FLOAT32 due to precision issues\n\nfunction checkEncodeURIParseError (str)\n{\n  try {\n    encodeURI (str);\n    assert (false);\n  } catch(e) {\n    assert(e instanceof URIError);\n  }\n}\n\nassert (encodeURI (\"\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f\") ===\n        \"%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F\");\nassert (encodeURI (\"\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f\") ===\n        \"%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F\");\nassert (encodeURI (\" !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN\") ===\n         \"%20!%22#$%25&'()*+,-./0123456789:;%3C=%3E?@ABCDEFGHIJKLMN\");\nassert (encodeURI (\"OPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}\\x7F\") ===\n         \"OPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7F\");\n\nassert (encodeURIComponent (\"\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f\") ===\n        \"%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F\");\nassert (encodeURIComponent (\"\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f\") ===\n        \"%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F\");\nassert (encodeURIComponent (\" !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN\") ===\n        \"%20!%22%23%24%25%26'()*%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMN\");\nassert (encodeURIComponent (\"OPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}\\x7F\") ===\n        \"OPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7F\");\n\nassert (encodeURI (\"\\xe9\") == \"%C3%A9\");\nassert (encodeURI (\"\\ud7ff\") == \"%ED%9F%BF\");\nassert (encodeURI (\"\\ue000\") == \"%EE%80%80\");\nassert (encodeURI (\"\\ud800\\udc00\") == \"%F0%90%80%80\");\nassert (encodeURI (String.fromCharCode(0xd800, 0xdc00)) == \"%F0%90%80%80\");\n\ncheckEncodeURIParseError (\"\\ud800\");\ncheckEncodeURIParseError (\"\\udfff\");\n\n// URI decoding\n\nfunction checkDecodeURIParseError (str)\n{\n  try {\n    decodeURI (str);\n    assert (false);\n  } catch(e) {\n    assert(e instanceof URIError);\n  }\n}\n\nassert (decodeURI (\"%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F\") ===\n        \"\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f\");\nassert (decodeURI (\"%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F\") ===\n        \"\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f\");\nassert (decodeURI (\"%20%21%22%23%24%25%26%27%28%29%2a%2b%2c%2d%2e%2f\") ===\n        \" !\\\"%23%24%%26'()*%2b%2c-.%2f\");\nassert (decodeURI (\"%30%31%32%33%34%35%36%37%38%39%3a%3b%3c%3d%3e%3f\") ===\n        \"0123456789%3a%3b<%3d>%3f\");\nassert (decodeURI (\"%40%41%42%43%44%45%46%47%48%49%4a%4b%4c%4d%4e%4f\") ===\n        \"%40ABCDEFGHIJKLMNO\");\nassert (decodeURI (\"%50%51%52%53%54%55%56%57%58%59%5a%5b%5c%5d%5e%5f\") ===\n        \"PQRSTUVWXYZ[\\\\]^_\");\nassert (decodeURI (\"%60%61%62%63%64%65%66%67%68%69%6a%6b%6c%6d%6e%6f\") ===\n        \"`abcdefghijklmno\");\nassert (decodeURI (\"%70%71%72%73%74%75%76%77%78%79%7a%7b%7c%7d%7e\") ===\n        \"pqrstuvwxyz{|}~\");\n\nassert (decodeURIComponent (\"%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F\") ===\n        \"\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\x0f\");\nassert (decodeURIComponent (\"%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F\") ===\n        \"\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f\");\nassert (decodeURIComponent (\"%20%21%22%23%24%25%26%27%28%29%2a%2b%2c%2d%2e%2f\") ===\n        \" !\\\"#$%&'()*+,-./\");\nassert (decodeURIComponent (\"%30%31%32%33%34%35%36%37%38%39%3a%3b%3c%3d%3e%3f\") ===\n        \"0123456789:;<=>?\");\nassert (decodeURIComponent (\"%40%41%42%43%44%45%46%47%48%49%4a%4b%4c%4d%4e%4f\") ===\n        \"@ABCDEFGHIJKLMNO\");\nassert (decodeURIComponent (\"%50%51%52%53%54%55%56%57%58%59%5a%5b%5c%5d%5e%5f\") ===\n        \"PQRSTUVWXYZ[\\\\]^_\");\nassert (decodeURIComponent (\"%60%61%62%63%64%65%66%67%68%69%6a%6b%6c%6d%6e%6f\") ===\n        \"`abcdefghijklmno\");\nassert (decodeURIComponent (\"%70%71%72%73%74%75%76%77%78%79%7a%7b%7c%7d%7e\") ===\n        \"pqrstuvwxyz{|}~\");\n\nassert (decodeURI (\"%6A%6B%6C%6D%6E%6F\") === \"jklmno\");\nassert (decodeURI (\"%C3%A9\") === \"\\xe9\");\nassert (decodeURI (\"%e2%b1%a5\") === \"\\u2c65\");\nassert (decodeURI (\"%f0%90%90%a8\") === \"\\ud801\\udc28\");\n\ncheckDecodeURIParseError (\"13%\");\ncheckDecodeURIParseError (\"%0g\");\ncheckDecodeURIParseError (\"%1G\");\ncheckDecodeURIParseError (\"%a\");\ncheckDecodeURIParseError (\"%c1%81\");\ncheckDecodeURIParseError (\"a%80b\");\ncheckDecodeURIParseError (\"%f4%90%80%80\");\ncheckDecodeURIParseError (\"%ed%a0%80\");\ncheckDecodeURIParseError (\"%ed%b0%80\");\ncheckDecodeURIParseError (\"%fa%81%82%83%84\");\ncheckDecodeURIParseError (\"%fd%81%82%83%84%85\");\n\n// Coerce (automatic toString()) tests\n\nassert (decodeURI ([1, 2, 3]) === \"1,2,3\");\nassert (decodeURI ({ x:1 }) === \"[object Object]\");\nassert (encodeURI (void 0) === \"undefined\");\nassert (encodeURI (216.000e1) === \"2160\");\n\n// Combining surrogate fragments\n\nassert (decodeURI(\"\\ud800\\udc00 \\ud800 \\udc00\") === \"\\ud800\\udc00 \\ud800 \\udc00\");\nassert (decodeURI(\"%f0%90%80%80\") === \"\\ud800\\udc00\");\nassert (decodeURI(\"\\ud800%f0%90%80%80\\ud800\") === \"\\ud800\\ud800\\udc00\\ud800\");\nassert (decodeURI(\"\\udc00%f0%90%80%80\\udc00\") === \"\\udc00\\ud800\\udc00\\udc00\");\n\ncheckDecodeURIParseError (\"\\ud800%ed%b0%80\");\ncheckDecodeURIParseError (\"%ed%a0%80\\udc00\");\n"
  },
  {
    "path": "tests/jerry/global.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nassert (this.hasOwnProperty !== undefined);\n"
  },
  {
    "path": "tests/jerry/hash.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\na = {};\na['12345']=1;\na['13345']=3;\na['sss45']=4;\na['1'] = 2;\n\nassert (a[12345] === 1);\nassert (a[1] === 2);\nassert (a[13345] === 3);\nassert (a['sss45'] === 4);\n"
  },
  {
    "path": "tests/jerry/identifier-escape.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_syntax_error (code) {\n  try {\n    eval(code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\neval(\"\\u{000010C80}: break \\ud803\\udc80\")\neval(\"\\\\u{10C80}: break \\ud803\\udc80\")\neval(\"$\\u{000010C80}$: break $\\ud803\\udc80$\")\neval(\"$\\\\u{10C82}$: break $\\ud803\\udc82$\")\n\nassert(\"\\u{000010C80}\".length === 2)\nassert(\"x\\u{010C80}y\".length === 4)\nassert(\"\\u{10C80}\" === \"\\ud803\\u{dc80}\")\nassert(\"\\u{0}\\x01\" === \"\\u0000\\u0001\")\n\n/* Surrogate pairs are not combined if they passed as \\u sequences. */\ncheck_syntax_error(\"\\\\u{10C80}: break \\\\ud803\\\\udc80\");\n"
  },
  {
    "path": "tests/jerry/if-else.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar was_then = false, was_else = false;\n\nif (true) {\n  was_then = true;\n} else {\n  was_else = true;\n}\n\nassert (was_then && !was_else);\n\nwas_then = false;\nwas_else = false;\n\nif (false) {\n  was_then = true;\n} else {\n  was_else = true;\n}\n\nassert (was_else && !was_then);\n\n"
  },
  {
    "path": "tests/jerry/if_parser.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction test_parse_error (txt) {\n  try {\n    eval (txt)\n    assert (false)\n  } catch (e){\n    assert (e instanceof SyntaxError)\n  }\n}\n\nvar if1=\n\"if (false)() print ('t')\" +\n\"else print ('f')\"\ntest_parse_error (if1)\n\ntest_parse_error (\"if (true)() { print ('t') }\")\ntest_parse_error (\"if {} (true) print ('t')\")\ntest_parse_error (\"if (true false) print ('t')\")\ntest_parse_error (\"if (true && || false) print ('t')\")\ntest_parse_error (\"if (&& true) print ('t')\")\ntest_parse_error (\"if (true ||) print ('t')\")\ntest_parse_error (\"if (true && {false || true}) print ('t')\")\n\nvar elseif1 =\n\"if (false) print ('if statement') \" +\n\"elseif (false) print ('else if statement') \" +\n\"else print ('else statement') \"\ntest_parse_error (elseif1);\n\nvar elseif2 =\n\"if (false) print ('if statement') \" +\n\"elif (false) print ('else if statement') \" +\n\"else print ('else statement') \"\ntest_parse_error (elseif2)\n\nvar elseif3 =\n\"if (false) print ('if statement') \" +\n\"else (false) print ('else if statement') \" +\n\"else print ('else statement') \"\ntest_parse_error (elseif3)\n"
  },
  {
    "path": "tests/jerry/initializer-in-for-of-statement-head.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction parse(txt) {\n    try {\n        eval(txt)\n        assert(false)\n    } catch (e) {\n        assert(e instanceof SyntaxError)\n    }\n}\n\nparse(\"for (var x = 1 of []) { }\")\n"
  },
  {
    "path": "tests/jerry/insert-semicolon.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar f = new Function ('return a');\n"
  },
  {
    "path": "tests/jerry/instanceof-symbol-hasinstance-class.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass NoParent {\n  static [Symbol.hasInstance] (arg) {\n    return false;\n  }\n}\n\nvar obj = new NoParent ();\n\nassert ((obj instanceof NoParent) === false);\n\nclass PositiveNumber {\n  static [Symbol.hasInstance] (arg) {\n    return (arg instanceof Number) && (arg >= 0);\n  }\n}\n\nvar num_a = new Number (33);\nvar num_b = new Number (-50);\n\nassert ((num_a instanceof PositiveNumber) === true);\nassert ((num_b instanceof PositiveNumber) === false);\n\n\nclass ErrorAlways {\n  static [Symbol.hasInstance] (arg) {\n    throw new URIError(\"ErrorAlways\");\n  }\n}\n\ntry {\n  (new Object ()) instanceof ErrorAlways;\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof URIError);\n}\n"
  },
  {
    "path": "tests/jerry/instanceof-symbol-hasinstance.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction NoParent () { }\n\nObject.defineProperty (NoParent, Symbol.hasInstance, {\n    value: function (arg) { return false; }\n});\n\nvar obj = new NoParent ();\n\nassert ((obj instanceof NoParent) === false);\n\ntry {\n  Object.defineProperty (NoParent, Symbol.hasInstance, {\n    value: function (arg) { return true; }\n  });\n  assert (false)\n} catch (ex) {\n  assert (ex instanceof TypeError);\n}\n\n\nfunction PositiveNumber () { }\n\nObject.defineProperty (PositiveNumber, Symbol.hasInstance, {\n    value: function (arg) { return (arg instanceof Number) && (arg >= 0); }\n})\n\nvar num_a = new Number (33);\nvar num_b = new Number (-50);\n\nassert ((num_a instanceof PositiveNumber) === true);\nassert ((num_b instanceof PositiveNumber) === false);\n\n\nfunction ErrorAlways () { }\n\nObject.defineProperty (ErrorAlways, Symbol.hasInstance, {\n    value: function (arg) { throw new URIError (\"ErrorAlways\"); }\n})\n\ntry {\n  (new Object ()) instanceof ErrorAlways;\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof URIError);\n}\n\n\nfunction NonCallable () { }\n\nObject.defineProperty (NonCallable, Symbol.hasInstance, { value: 11 });\n\ntry {\n  (new Object ()) instanceof NonCallable;\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof TypeError);\n}\n\n\nfunction ErrorGenerator () { }\n\nObject.defineProperty (ErrorGenerator, Symbol.hasInstance, {\n    get: function () { throw new URIError (\"ErrorGenerator\"); }\n});\n\ntry {\n  (new Object ()) instanceof ErrorGenerator;\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof URIError);\n}\n"
  },
  {
    "path": "tests/jerry/intrinsic-properties.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Array.prototype.values === Array.prototype[Symbol.iterator]);\nassert(Set.prototype.values === Set.prototype[Symbol.iterator]);\nassert(Set.prototype.keys === Set.prototype[Symbol.iterator]);\nassert(Map.prototype.entries === Map.prototype[Symbol.iterator]);\nassert(Date.prototype.toGMTString === Date.prototype.toUTCString);\nassert(Number.parseInt === parseInt);\nassert(Number.parseFloat === parseFloat);\n\nvar typedarrays = [Uint8Array, Uint16Array, Uint32Array, Int8Array, Int16Array, Int32Array, Float32Array, Float64Array];\nfor (ta1 of typedarrays) {\n  for (ta2 of typedarrays) {\n    assert(ta1.prototype.values === ta2.prototype[Symbol.iterator]);\n  }\n\n  assert(ta1.prototype.toString === Array.prototype.toString);\n}\n"
  },
  {
    "path": "tests/jerry/iterator-prototype.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [];\nvar array_iterator = array[Symbol.iterator]();\nvar array_iterator_prototype = Object.getPrototypeOf (array_iterator);\nvar iterator_prototype = Object.getPrototypeOf (array_iterator_prototype);\nvar iterator_prototype_iterator = iterator_prototype[Symbol.iterator]();\n\nassert (iterator_prototype === iterator_prototype_iterator);\n"
  },
  {
    "path": "tests/jerry/json-parse-proxy.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Test JSON parse [[delete]] with Array */\nvar badDeleteArray = new Proxy([0], {\n  deleteProperty: function() {\n    throw \"My Super Error A\";\n  }\n});\n\ntry {\n  JSON.parse('[0,0]', function() { this[1] = badDeleteArray; });\n} catch (ex) {\n  assert(ex === \"My Super Error A\");\n}\n\n/* Test JSON parse [[delete]] with Objects */\nvar badDeleteObj = new Proxy([0], {\n  deleteProperty: function() {\n    throw \"My Super Error B\";\n  }\n});\n\ntry {\n  JSON.parse('[0,0]', function() { this[1] = badDeleteObj; });\n} catch (ex) {\n  assert(ex === \"My Super Error B\");\n}\n\n/* Test JSON parse property define with Array */\nvar badDefineArray = new Proxy([null], {\n  defineProperty: function(_, name) {\n    throw \"My Super Error C\";\n  }\n});\n\ntry {\n  JSON.parse('[\"first\", null]', function(_, value) {\n    if (value === 'first') {\n      this[1] = badDefineArray;\n    }\n    return value;\n  });\n} catch (ex) {\n  assert(ex === \"My Super Error C\");\n}\n\n/* Test JSON parse property define with Object */\nvar badDefineObj = new Proxy({0: null}, {\n  defineProperty: function(_, name) {\n    throw \"My Super Error D\";\n  }\n});\n\ntry {\n  JSON.parse('[\"first\", null]', function(_, value) {\n    if (value === 'first') {\n      this[1] = badDefineObj;\n    }\n    return value;\n  });\n} catch (ex) {\n  assert(ex === \"My Super Error D\");\n}\n\n/* Test JSON parse keys call */\nvar badKeys = new Proxy({}, {\n  ownKeys: function() {\n    throw \"My Super Error E\";\n  }\n});\n\ntry {\n  JSON.parse('[0,0]', function() { this[1] = badKeys; });\n} catch (ex) {\n  assert(ex === \"My Super Error E\");\n}\n"
  },
  {
    "path": "tests/jerry/json-parse.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// This test will not pass on FLOAT32 due to precision issues\n\n// Checking primitve types\nvar str;\nvar result;\nvar log;\n\nfunction check_parse_error (str)\n{\n  try {\n    JSON.parse (str);\n    // Should throw a parse error.\n    assert (false);\n  } catch (e) {\n  }\n}\n\nstr = ' null ';\nassert (JSON.parse (str) === null);\nstr = 'true';\nassert (JSON.parse (str) === true);\nstr = 'false';\nassert (JSON.parse (str) === false);\nstr = '-32.5e002';\nassert (JSON.parse (str) == -3250);\nstr = '\"str\"';\nassert (JSON.parse (str) == \"str\");\nstr = '\"\\\\b\\\\f\\\\n\\\\t\\\\r\"'\nassert (JSON.parse (str) === \"\\b\\f\\n\\t\\r\");\n/* Note: \\u is parsed by the lexer, \\\\u is by the JSON parser. */\nstr = '\"\\\\u0000\\\\u001f\"';\nassert (JSON.parse (str) === \"\\x00\\x1f\");\nstr = '\"\\\\ud801\\\\udc00\\\\ud801\\udc00\\ud801\\\\udc00\\ud801\\udc00\"';\nassert (JSON.parse (str) === \"\\ud801\\udc00\\ud801\\udc00\\ud801\\udc00\\ud801\\udc00\");\n/* These surrogates do not form a valid surrogate pairs. */\nstr = '\"\\\\ud801,\\\\udc00,\\\\ud801,\\udc00,\\ud801,\\\\udc00,\\ud801,\\udc00\"';\nassert (JSON.parse (str) === \"\\ud801,\\udc00,\\ud801,\\udc00,\\ud801,\\udc00,\\ud801,\\udc00\");\n\ncheck_parse_error ('undefined');\ncheck_parse_error ('falses');\ncheck_parse_error ('+5');\ncheck_parse_error ('5.');\ncheck_parse_error ('01');\ncheck_parse_error ('0x1');\ncheck_parse_error ('0e-');\ncheck_parse_error ('3e+a');\ncheck_parse_error ('55e4,');\ncheck_parse_error ('5 true');\ncheck_parse_error (\"'str'\");\ncheck_parse_error ('\\x00');\ncheck_parse_error ('\"\\x00\"');\ncheck_parse_error ('\"\\x1f\"');\n\n// Checking objects\nstr = ' { \"x\": 0, \"yy\": null, \"zzz\": { \"A\": 4.0, \"BB\": { \"1\": 63e-1 }, \"CCC\" : false } } ';\nresult = JSON.parse (str);\nassert (typeof result == \"object\");\nassert (result.x === 0);\nassert (result.yy === null);\nassert (typeof result.zzz == \"object\");\nassert (result.zzz.A === 4);\nassert (typeof result.zzz.BB == \"object\");\nassert (result.zzz.BB[\"1\"] === 6.3);\nassert (result.zzz.CCC === false);\n\ncheck_parse_error ('{');\ncheck_parse_error ('{{{}');\ncheck_parse_error ('{x:5}');\ncheck_parse_error ('{true:4}');\ncheck_parse_error ('{\"x\":5 \"y\":6}');\ncheck_parse_error ('{\"x\":5,\"y\":6,}');\ncheck_parse_error ('{\"x\":5,,\"y\":6}');\n\n// Checking arrays\nstr = '[{\"x\":[]},[[]],{}, [ null ] ]';\nresult = JSON.parse (str);\nassert (result.length === 4);\nassert (typeof result === \"object\");\nassert (typeof result[0] === \"object\");\nassert (typeof result[0].x === \"object\");\nassert (result[0].x.length === 0);\nassert (result[1].length === 1);\nassert (result[1][0].length === 0);\nassert (typeof result[2] === \"object\");\nassert (result[3].length === 1);\nassert (result[3][0] === null);\n\ncheck_parse_error ('[');\ncheck_parse_error ('[[[]');\ncheck_parse_error ('[ true null ]');\ncheck_parse_error ('[1,,2]');\ncheck_parse_error ('[1,2,]');\ncheck_parse_error ('[1] [2]');\n\n// Checking parse with different primitive types\n\nassert (JSON.parse (null) == null);\nassert (JSON.parse (true) == true);\nassert (JSON.parse (3) == 3);\n\ntry {\n  JSON.parse (undefined);\n  // Should not be reached.\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\n// Checking parse with different object types\n\nobject = { toString: function() { return false; } };\nassert (JSON.parse (object) == false);\n\nobject = {\"a\": 3, \"b\": \"foo\"};\ntry {\n  JSON.parse (object);\n  // Should not be reached.\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\narray = [3, \"foo\"];\ntry {\n  JSON.parse (array);\n  // Should not be reached.\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (JSON.parse (new Number (3)) == 3);\nassert (JSON.parse (new Boolean (true)) == true);\n\nobject = new String ('{\"a\": 3, \"b\": \"foo\"}');\nresult = JSON.parse (object);\n\nassert (result.a == 3);\nassert (result.b == \"foo\");\n\n// Checking reviver\n\nfunction toStringReviver(k, v)\n{\n  log += \"<\" + k + \">:\" + (typeof v == \"number\" ? v : \"(obj)\") + \", \";\n  return v;\n}\n\nstr = '{ \"a\":1, \"b\":2, \"c\": { \"d\":4, \"e\": { \"f\":6 } } }';\nlog = \"\";\nJSON.parse (str, toStringReviver);\nassert (log === \"<a>:1, <b>:2, <d>:4, <f>:6, <e>:(obj), <c>:(obj), <>:(obj), \");\n\nstr = '[ 32, 47, 33 ]';\nlog = \"\";\nJSON.parse (str, toStringReviver);\nassert (log === \"<0>:32, <1>:47, <2>:33, <>:(obj), \");\n\n// Defining properties multiple times\n\nstr = ' { \"a\":1, \"b\":2, \"a\":3 } ';\nlog = \"\";\nJSON.parse (str, toStringReviver);\nassert (log === \"<a>:3, <b>:2, <>:(obj), \");\n\nstr = ' { \"a\":1, \"b\":2, \"b\":3 } ';\nlog = \"\";\nJSON.parse (str, toStringReviver);\nassert (log === \"<a>:1, <b>:3, <>:(obj), \");\n\nstr = ' { \"a\":1, \"b\":{}, \"b\":[], \"a\":2, \"b\":3, \"c\":4 } ';\nlog = \"\";\nJSON.parse (str, toStringReviver);\nassert (log === \"<a>:2, <b>:3, <c>:4, <>:(obj), \");\n\n// Changing property value\n\nstr = ' { \"a\":1, \"b\":2, \"c\":3 } ';\nresult = JSON.parse (str, function (k, v) {\n  if (k == \"a\")\n  {\n    return 8;\n  }\n  if (k == \"b\")\n  {\n    return 9;\n  }\n  if (k == \"c\")\n  {\n    return void 0;\n  }\n  return v;\n});\n\nassert (result.a === 8);\nassert (result.b === 9);\nassert (result.c === void 0);\n\n// Adding / deleting properties\n\nstr = ' { \"a\":1, \"b\":2 } ';\nlog = \"\";\nresult = JSON.parse (str, function (k, v) {\n  if (k == \"a\")\n  {\n    // Deleted properties must still be enumerated.\n    delete this[\"b\"];\n    // New properties must not be enumerated.\n    this.c = 4;\n  }\n  if (k != \"\")\n  {\n    log += \"<\" + k + \">:\" + v + \" \";\n  }\n  return v;\n});\n\nassert (log === \"<a>:1 <b>:undefined \");\nassert (result.a === 1);\nassert (result.b === void 0);\nassert (result.c === 4);\n\n// Changing properties to accessors\n\nstr = ' { \"a\":1, \"b\":2, \"c\":3 } ';\nlog = \"\";\nJSON.parse (str, function (k, v) {\n  if (k == \"a\")\n  {\n    Object.defineProperty(this, \"b\", {\n      enumerable: true,\n      configurable: true,\n      get: function() { return 12; }\n    });\n    Object.defineProperty(this, \"c\", {\n      enumerable: true,\n      configurable: true,\n      set: function(val) { }\n    });\n  }\n  if (k != \"\")\n  {\n    log += \"<\" + k + \">:\" + v + \" \";\n  }\n  return v;\n});\nassert (log === \"<a>:1 <b>:12 <c>:undefined \");\n\n// Forcing extra walk steps\n\nstr = ' { \"a\":1, \"b\":2 } ';\nlog = \"\";\nJSON.parse (str, function (k, v) {\n  if (k == \"a\")\n  {\n     this.b = { x:3, y:4 };\n  }\n  if (k != \"\")\n  {\n    log += \"<\" + k + \">:\" + v + \" \";\n  }\n  return v;\n});\nassert (log === \"<a>:1 <x>:3 <y>:4 <b>:[object Object] \");\n\n// Setting a property to read-only, and change its value.\n\nstr = ' { \"a\":1, \"b\":2 } ';\nresult = JSON.parse (str, function (k, v) {\n  if (k == \"a\")\n  {\n    Object.defineProperty(this, \"b\", {\n      enumerable: true,\n      // FIXME: Should work with configurable: true.\n      configurable: false,\n      writable: false,\n      value: 2\n    });\n    return 8;\n  }\n  if (k == \"b\")\n  {\n    return 9;\n  }\n  return v;\n});\n\nassert (result.a === 8);\nassert (result.b === 2);\n\n// Throw error in the reviver\n\ntry {\n  str = ' { \"a\":1, \"b\":2 } ';\n  result = JSON.parse (str, function (k, v) { throw new ReferenceError(\"error\"); } );\n  assert(false);\n} catch (e) {\n  assert (e.message === \"error\");\n  assert (e instanceof ReferenceError);\n}\n\n// Throw error in a getter\n\ntry {\n  str = ' { \"a\":1, \"b\":2 } ';\n  JSON.parse (str, function (k, v) {\n    if (k == \"a\")\n    {\n      Object.defineProperty(this, \"b\", {\n        enumerable: true,\n        configurable: true,\n        get: function() { throw new ReferenceError(\"error\"); }\n      });\n    }\n    return v;\n  });\n  assert(false);\n} catch (e) {\n  assert (e.message === \"error\");\n  assert (e instanceof ReferenceError);\n}\n\n// Checking reviver with different primitive types\n\nstr = ' { \"a\":1 } ';\n\nresult = JSON.parse (str, 4);\nassert (result.a == 1);\n\nresult = JSON.parse (str, null);\nassert (result.a == 1);\n\nresult = JSON.parse (str, undefined);\nassert (result.a == 1);\n\nresult = JSON.parse (str, true);\nassert (result.a == 1);\n\nresult = JSON.parse (str, \"foo\");\nassert (result.a == 1);\n\n// Checking reviver with different object types\n\nstr = ' { \"a\":1 } ';\n\nresult = JSON.parse(str, new Boolean (true));\nassert (result.a == 1);\n\nresult = JSON.parse(str, new String (\"foo\"));\nassert (result.a == 1);\n\nresult = JSON.parse(str, new Number (3));\nassert (result.a == 1);\n\nresult = JSON.parse(str, {\"a\": 2});\nassert (result.a == 1);\n\nresult = JSON.parse(str, [1, 2, 3]);\nassert (result.a == 1);\n"
  },
  {
    "path": "tests/jerry/json-stringify.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Checking quoting strings\nassert (JSON.stringify (\"\") === '\"\"');\n\nnormal_string = \"asdasd\";\nassert (JSON.stringify (normal_string) == '\"asdasd\"');\n\nformat_characters = \"\\ba\\fs\\nd\\ra\\tsd\";\nassert (JSON.stringify (format_characters) == '\"\\\\ba\\\\fs\\\\nd\\\\ra\\\\tsd\"');\n\nctl_string = \"asd\u001fasd\";\nassert (JSON.stringify (ctl_string) == '\"asd\\\\u001fasd\"');\n\nescpad_string = \"\\\"asda\\sd\";\nassert (JSON.stringify (escpad_string) == '\"\\\\\"asdasd\"');\n\nassert (JSON.stringify('\\u2040') == '\"⁀\"');\nassert (JSON.stringify('abc\\u2040\\u2030cba') == '\"abc⁀‰cba\"');\n\n// Checking primitive types\nassert (JSON.stringify (1) === '1');\nassert (JSON.stringify (true) === 'true');\nassert (JSON.stringify (\"foo\") === '\"foo\"');\nassert (JSON.stringify (null) === 'null');\nassert (JSON.stringify (undefined) === undefined);\n\nassert (JSON.stringify (new Number(1)) === '1');\nassert (JSON.stringify (new Boolean(true)) === 'true');\nassert (JSON.stringify (new String(\"foo\")) === '\"foo\"');\n\n// Checking objects\nempty_object = {}\nassert (JSON.stringify (empty_object) == '{}');\n\nempty_object = {};\nempty_object.a = undefined;\n\nassert (JSON.stringify (empty_object) == '{}');\n\np_object = { \"a\": 1, \"b\": true, \"c\": \"foo\", \"d\": null, \"e\": undefined };\nassert (JSON.stringify (p_object) == '{\"a\":1,\"b\":true,\"c\":\"foo\",\"d\":null}');\n\no_object = { \"a\": new Number(1), \"b\": new Boolean(true), \"c\": new String(\"foo\") };\nassert (JSON.stringify (o_object) == '{\"a\":1,\"b\":true,\"c\":\"foo\"}');\n\nchild = { \"a\": 1, \"b\": new String(\"\\nfoo\"), \"c\": undefined };\nparent = { \"a\": true, \"b\": child, \"c\": null};\n\nassert (JSON.stringify (parent) == '{\"a\":true,\"b\":{\"a\":1,\"b\":\"\\\\nfoo\"},\"c\":null}');\n\nrecursive_object = {};\nrecursive_object.a = 2;\nrecursive_object.b = recursive_object;\n\ntry {\n  JSON.stringify (recursive_object)\n  // Should not be reached.\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// Checking arrays\nempty_array = [];\nassert (JSON.stringify (empty_array) == '[]');\n\narray = [undefined];\nassert (JSON.stringify (array) == '[null]');\n\np_array = [1, true, \"foo\", null, undefined];\nassert (JSON.stringify (p_array) == '[1,true,\"foo\",null,null]');\n\no_array = [new Number(1), new Boolean(true), new String(\"foo\")];\nassert (JSON.stringify (o_array) == '[1,true,\"foo\"]');\n\nchild = [ 1, new String(\"\\nfoo\"), undefined ];\nparent = [ true, child, null ];\n\nassert (JSON.stringify (parent) == '[true,[1,\"\\\\nfoo\",null],null]');\n\nrecursive_array = [];\nrecursive_array[0] = 2;\nrecursive_array[1] = recursive_array;\n\ntry {\n  JSON.stringify (recursive_array)\n  // Should not be reached.\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nobject = {\"a\": 1, \"b\": [1, true, {\"a\": \"foo\"}]};\nassert (JSON.stringify (object) == '{\"a\":1,\"b\":[1,true,{\"a\":\"foo\"}]}');\n\nobject = {\"a\": [1], \"b\": {}};\nassert (JSON.stringify(object) === '{\"a\":[1],\"b\":{}}');\n\narray = [1, {\"a\": 2, \"b\": true, c: [3]}];\nassert (JSON.stringify (array) == '[1,{\"a\":2,\"b\":true,\"c\":[3]}]');\n\n// Filtering / replacing\nto_json_object = {};\nto_json_object.a = 2;\nto_json_object.toJSON = function (key) { return 3; };\n\nassert (JSON.stringify (to_json_object) === \"3\");\n\nfunction replacer_function (key, value)\n{\n  if (typeof(value) == \"string\")\n    return \"FOO\";\n  return value;\n}\n\nobject = { \"a\": \"JSON\", \"b\": new String(\"JSON\"), \"c\": 3 };\nassert (JSON.stringify (object, replacer_function) == '{\"a\":\"FOO\",\"b\":\"JSON\",\"c\":3}');\n\nfilter = [\"a\", \"b\"];\nassert (JSON.stringify (object, filter) == '{\"a\":\"JSON\",\"b\":\"JSON\"}');\n\nassert (JSON.stringify ([], [ 'foo', 'foo' ]) === '[]');\n\nnumber = new Number(2.2);\nnumber.toString = {};\nnumber.valueOf = [];\n\ntry\n{\n  JSON.stringify([], [number]);\n  // Should not be reached.\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\n// Throw error in the replacer function\nfunction replacer_thrower (key, value)\n{\n  throw new ReferenceError(\"foo\");\n  return value;\n}\n\ntry {\n  JSON.stringify (object, replacer_thrower)\n  // Should not be reached.\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// Checking replacer with different primitive types\nobject = { \"a\": 2 };\nassert (JSON.stringify (object, 3) == '{\"a\":2}');\nassert (JSON.stringify (object, true) == '{\"a\":2}');\nassert (JSON.stringify (object, null) == '{\"a\":2}');\nassert (JSON.stringify (object, undefined) == '{\"a\":2}');\nassert (JSON.stringify (object, \"foo\") == '{\"a\":2}');\n\n// Checking replacer with different primitive types\nassert (JSON.stringify (object, new Boolean (true)) == '{\"a\":2}');\nassert (JSON.stringify (object, new Number (3)) == '{\"a\":2}');\nassert (JSON.stringify (object, new String (\"foo\")) == '{\"a\":2}');\nassert (JSON.stringify (object, { \"a\": 3 }) == '{\"a\":2}');\n\n// Checking JSON formatting\nobject = {\"a\": 2};\nassert (JSON.stringify (object, null, \"   \") == '{\\n   \"a\": 2\\n}');\nassert (JSON.stringify (object, null, \"asd\") == '{\\nasd\"a\": 2\\n}');\nassert (JSON.stringify (object, null, \"asd0123456789\") == '{\\nasd0123456\"a\": 2\\n}');\nassert (JSON.stringify (object, null, \"asd\\u20400123456789\") == '{\\nasd⁀012345\"a\": 2\\n}');\nassert (JSON.stringify (object, null, 100) == '{\\n          \"a\": 2\\n}');\nassert (JSON.stringify (object, null, -5) == '{\"a\":2}');\n\narray = [2];\nassert (JSON.stringify (array, null, \"   \") == '[\\n   2\\n]');\nassert (JSON.stringify (array, null, \"asd\") == '[\\nasd2\\n]');\nassert (JSON.stringify (array, null, \"asd0123456789\") == '[\\nasd01234562\\n]');\nassert (JSON.stringify (array, null, \"asd\\u20400123456789\") == '[\\nasd⁀0123452\\n]');\nassert (JSON.stringify (array, null, 100) == '[\\n          2\\n]');\nassert (JSON.stringify (array, null, -5) == '[2]');\n\nnested_object = {\"a\": 2, \"b\": {\"c\": 1, \"d\": true}};\nassert (JSON.stringify (nested_object, null, 2) == '{\\n  \"a\": 2,\\n  \"b\": {\\n    \"c\": 1,\\n    \"d\": true\\n  }\\n}');\n\nnested_array = [2, [1,true]];\nassert (JSON.stringify (nested_array, null, 2) == '[\\n  2,\\n  [\\n    1,\\n    true\\n  ]\\n]');\n\n// Checking space (formatting parameter) with different primititve types\nobject = { \"a\": 2 };\nassert (JSON.stringify (object, null, true) == '{\"a\":2}');\nassert (JSON.stringify (object, null, null) == '{\"a\":2}');\nassert (JSON.stringify (object, null, undefined) == '{\"a\":2}');\n\n// Checking space (formatting parameter) with different object types\nassert (JSON.stringify (object, null, new Boolean (true)) == '{\"a\":2}');\nassert (JSON.stringify (object, null, [1, 2, 3] ) == '{\"a\":2}');\nassert (JSON.stringify (object, null, { \"a\": 3 }) == '{\"a\":2}');\n\n// Test array replacer\nassert (JSON.stringify ({\"key1\": false, \"key2\": 12}, [], \"abc\") === '{}');\nassert (JSON.stringify ({\"key1\": false, \"key2\": 12}, [\"key1\"], \"abc\") === '{\\nabc\"key1\": false\\n}');\nassert (JSON.stringify ({\"key1\": false, \"key2\": 12}, [\"key2\"], \"abc\") === '{\\nabc\"key2\": 12\\n}');\nassert (JSON.stringify ({\"key1\": false, \"key2\": 12}, [\"key1\", \"key2\"], \"abc\") === '{\\nabc\"key1\": false,\\nabc\"key2\": 12\\n}');\nassert (JSON.stringify ({\"key1\": false, \"key2\": 12}, [\"key\", \"key3\"], \"abc\") === '{}');\n\n// Test with proxy\nassert(JSON.stringify(new Proxy(['foo'], {})) === '[\"foo\"]');\nassert(JSON.stringify(new Proxy({0:\"foo\"}, {})) === '{\"0\":\"foo\"}');\n\nvar target = [1,2,3];\nvar handler = {\n  get(target, prop) {\n    if (prop == \"length\")\n    {\n      throw 42;\n    }\n  }\n}\n\ntry {\n  JSON.stringify(new Proxy(target,handler));\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\nvar revocable = Proxy.revocable (target, { get (t, p , r) {\n  if (p == \"toJSON\") {\n    revocable.revoke();\n  }\n}});\nvar proxy = revocable.proxy;\n\ntry {\n  JSON.stringify(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Checking quoting strings\nassert(JSON.stringify(\"ab𬄕\u001fc\") === '\"ab𬄕\\\\u001fc\"');\nassert(JSON.stringify(\"ab\\uDC01c\u001fd\") === '\"ab\\\\udc01c\\\\u001fd\"');\nassert(JSON.stringify(\"ab\\uDC01c\u001fd\\uD8331e\") === '\"ab\\\\udc01c\\\\u001fd\\\\ud8331e\"');\n\n// Test case where the proxy is already revoked\nvar handle = Proxy.revocable([], {});\nhandle.revoke();\n\ntry {\n  JSON.stringify(handle.proxy);\n  assert(false);\n} catch (ex) {\n  assert(ex instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/json-superset.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(eval(\"'\\u2028'\") === \"\\u2028\");\nassert(eval(\"'\\u2029'\") === \"\\u2029\");\n"
  },
  {
    "path": "tests/jerry/keyword.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error(code)\n{\n  try {\n    eval(code)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof SyntaxError)\n  }\n}\n\nfunction check_strict_syntax_error(code)\n{\n  \"use strict\"\n\n  try {\n    eval(code)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof SyntaxError)\n  }\n}\n\ncheck_syntax_error(\"d\\\\u006f {} while (false)\")\ncheck_syntax_error(\"\\\\u0076\\\\u0061\\\\u0072 var = 5\")\ncheck_syntax_error(\"wit\\\\u0068 ({}) {}\")\ncheck_syntax_error(\"\\\\u0066alse\")\ncheck_syntax_error(\"type\\\\006ff 3.14\")\ncheck_syntax_error(\"try {} fin\\\\u0061lly {}\")\ncheck_syntax_error(\"f\\\\u0075nction f() {}\")\ncheck_syntax_error(\"a instanc\\\\u0065of b\")\n\ncheck_strict_syntax_error(\"\\\\u006c\\\\u0065\\\\u0074 _let = 5\");\ncheck_strict_syntax_error(\"\\\\u0070rotecte\\\\u0064\");\n"
  },
  {
    "path": "tests/jerry/labelled-statements.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* 1 */\n\na: a = 1;\n\nstr = '';\n\na: for (j = 0; j < 10; j++)\n{\n  str += 'A';\n\n  b: for (i = 0; i < 10; i++)\n  {\n    str += 'B';\n\n    break a;\n\n    str += 'C';\n  }\n\n  str += 'D';\n}\n\nassert (str === 'AB');\n\n/* 2 */\nstr = '';\n\na: for (j = 0; j < 5; j++)\n{\n  str += 'A';\n\n  b: for (i = 0; i < 5; i++)\n  {\n    str += 'B';\n\n    switch (1)\n    {\n      case 1:\n        continue b;\n      default:\n        break b;\n    }\n\n    str += 'C';\n  }\n\n  str += 'D';\n}\n\nassert (str === 'ABBBBBDABBBBBDABBBBBDABBBBBDABBBBBD');\n\n/* 3 */\nstr = '';\n\na: for (j = 0; j < 5; j++)\n{\n  str += 'A';\n\n  b: for (i = 0; i < 5; i++)\n  {\n    str += 'B';\n\n    switch (1)\n    {\n      case 1:\n        continue a;\n    }\n\n    str += 'C';\n  }\n\n  str += 'D';\n}\n\nassert (str === 'ABABABABAB');\n\n/* 4 */\nstr = '';\n\na: for (j = 0; j < 5; j++)\n{\n  str += 'A';\n\n  b: for (i = 0; i < 5; i++)\n  {\n    str += 'B';\n\n    switch (1)\n    {\n      case 1:\n        break b;\n    }\n\n    str += 'C';\n  }\n\n  str += 'D';\n}\n\nassert (str === 'ABDABDABDABDABD');\n\n/* 5 */\nstr = '';\n\na: for (j = 0; j < 5; j++)\n{\n  str += 'A';\n\n  b: for (i = 0; i < 5; i++)\n  {\n    str += 'B';\n\n    switch (1)\n    {\n      case 1:\n        break a;\n    }\n\n    str += 'C';\n  }\n\n  str += 'D';\n}\n\nassert (str === 'AB');\n\n\n/* 6 */\nstr = '';\n\na: for (j = 0; j < 5; j++)\n{\n  str += 'A';\n\n  b: for (i = 0; i < 5; i++)\n  {\n    str += 'B';\n\n    with ({})\n    {\n      break b;\n    }\n\n    str += 'C';\n  }\n\n  str += 'D';\n}\n\nassert (str === 'ABDABDABDABDABD');\n\n/* 7 */\nstr = '';\n\na: for (j = 0; j < 5; j++)\n{\n  c:\n  {\n    str += 'A';\n\n    b: for (i = 0; i < 5; i++)\n    {\n      str += 'B';\n\n      with ({})\n      {\n        break c;\n      }\n\n      str += 'C';\n    }\n\n    str += 'D';\n  }\n}\n\nassert (str === 'ABABABABAB');\n\n/* 8 */\n\na: {\n function f ()\n {\n      str = '';\n\n   a: for (i = 0; i < 5; i++)\n      {\n        str += 'A';\n\n        for (j = 0; j < 5; j++)\n        {\n          str += 'B';\n\n          continue a;\n\n          str += 'C';\n        }\n        str += 'D';\n      }\n\n    assert (str === 'ABABABABAB');\n }\n}\n\nf ();\n\n/* 9 */\n\nstr = '';\n\nfor (i = 0; i < 5; i++)\n{\n  str += 'A';\n\n  switch (i)\n  {\n    case 0:\n    {\n      str += '0';\n      break;\n    }\n    case 1:\n    {\n      str += '1';\n      break;\n    }\n    case 2:\n    {\n      str += '2';\n      break;\n    }\n    case 3:\n    {\n      str += '3';\n      break;\n    }\n    case 4:\n    {\n      str += '4';\n      break;\n    }\n  }\n\n  str += 'B';\n}\n\nassert (str === 'A0BA1BA2BA3BA4B');\n\n/* 10 */\n\nstr = '';\n\nfor (i = 0; i < 2; i++)\n{\n  str += '[A]';\n\n  a:\n  for (j = 0; j < 5; j++)\n  {\n    str += '[B]';\n\n    switch (j)\n    {\n      case 0:\n      {\n        str += '[0]';\n        break;\n      }\n      case 1:\n      {\n        str += '[1]';\n        if (i % 2 == 0)\n        {\n          str += '[1.1]';\n          break a;\n        }\n        else\n        {\n          str += '[1.2]';\n        }\n      }\n      case 2:\n      {\n        str += '[2]';\n        continue a;\n      }\n      case 3:\n      {\n        str += '[3]';\n        break;\n      }\n      case 4:\n      {\n        str += '[4]';\n        continue a;\n      }\n    }\n\n    str += '[C]';\n  }\n\n  str += '[D]';\n}\n\nassert (str === '[A][B][0][C][B][1][1.1][D]' +\n                '[A][B][0][C][B][1][1.2][2][B][2][B][3][C][B][4][D]');\n"
  },
  {
    "path": "tests/jerry/large_literal.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar literal = \"a\"\n\nfor (var i = 0; i < 25; i++)\n  literal += \"\\\\u0061bcdefghij\"\n\nassert(eval(\"var \" + literal + \" = 42; \" + literal) === 42)\n\nliteral = undefined\n\nvar str = \"\"\nvar expected = \"\"\n\nfor (var i = 0; i < 1000; i++)\n{\n  str += \"123456789\\\\n\"\n  expected += \"123456789\\n\"\n}\n\nassert(eval('\"' + str + '\"') === expected);\n\n"
  },
  {
    "path": "tests/jerry/length-property.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar builtin_objects = [\n  Array,\n  ArrayBuffer,\n  Boolean,\n  DataView,\n  Date,\n  Error,\n  EvalError,\n  Function,\n  Map,\n  Number,\n  Object,\n  Promise,\n  RangeError,\n  ReferenceError,\n  RegExp,\n  Set,\n  SharedArrayBuffer,\n  String,\n  Symbol,\n  SyntaxError,\n  TypeError,\n  URIError,\n  WeakMap,\n  WeakSet,\n];\n\nvar builtin_typedArrays = [\n  Float32Array,\n  Float64Array,\n  Int16Array,\n  Int32Array,\n  Int8Array,\n  Uint16Array,\n  Uint32Array,\n  Uint8Array,\n  Uint8ClampedArray,\n];\n\n\n(function () {\n  /* each length property is configurable */\n  var desc;\n  \n  for (obj of builtin_objects) {\n    desc = Object.getOwnPropertyDescriptor(obj, 'length');                                                                                                                    \n    assert(desc.writable === false);\n    assert(desc.enumerable === false);\n    assert(desc.configurable === true);\n  }\n  \n  for (ta of builtin_typedArrays) {\n    desc = Object.getOwnPropertyDescriptor(ta, 'length');                                                                                                                    \n    assert(desc.writable === false);\n    assert(desc.enumerable === false);\n    assert(desc.configurable === true);\n  }\n})();\n\n(function () {\n  /* each length property can be deleted */\n  for (obj of builtin_objects) {\n    assert(obj.hasOwnProperty('length') === true);\n    assert(delete obj.length);\n    assert(obj.hasOwnProperty('length') === false);\n  }\n\n  for (ta of builtin_typedArrays) {\n    assert(ta.hasOwnProperty('length') === true);\n    assert(delete ta.length);\n    assert(ta.hasOwnProperty('length') === false);\n  }\n})();\n\n(function () {\n  /* test length property of builtin function */\n  for (obj of builtin_objects) {\n    var property_names = Object.getOwnPropertyNames(obj);\n    for (var name of property_names) {\n      if (typeof obj[name] == 'function') {\n        var func = obj[name];\n        var desc = Object.getOwnPropertyDescriptor(func, 'length');\n        assert(desc.writable === false);\n        assert(desc.enumerable === false);\n        assert(desc.configurable === true);\n\n        assert(func.hasOwnProperty('length') === true);\n        assert(delete func.length);\n        assert(func.hasOwnProperty('length') === false);\n      }\n    }\n  }\n})();\n\n(function () {\n  /* test length property of function objects */\n  var normal_func = function () {};\n  var arrow_func = () => {};\n  var bound_func = normal_func.bind({});\n  var nested_bound_func = arrow_func.bind().bind(1);\n\n  var functions = [normal_func, arrow_func, bound_func, nested_bound_func];\n\n  for (func of functions) {\n    var desc = Object.getOwnPropertyDescriptor(func, 'length');\n    assert(desc.writable === false);\n    assert(desc.enumerable === false);\n    assert(desc.configurable === true);\n  }\n\n  for (func of functions) {\n    assert(func.hasOwnProperty('length') === true);\n    assert(delete func.length);\n    assert(func.hasOwnProperty('length') === false);\n  }\n})();\n\n(function() {\n  /* changing the length of f affects the bound function */\n  function f(a,b,c) {}\n  Object.defineProperty(f, \"length\", { value: 30 });\n  var g = f.bind(1,2)\n  assert(g.length === 29);\n})();\n\n(function() {\n  /* changing the length of f does not affect the bound function */\n  function f(a,b,c) {}\n  var g = f.bind(1,2)\n  Object.defineProperty(f, \"length\", { value: 30 });\n  assert(g.length === 2);\n})();\n"
  },
  {
    "path": "tests/jerry/let1.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar a = 5;\nvar a = 6;\nlet b = 7;\n\nassert (a === 6);\nassert (this.a === 6);\nassert (b === 7);\nassert (this.b === undefined);\n\n{\n  let c;\n  c = 8;\n\n  {\n    let c = 9;\n    assert (c === 9);\n  }\n\n  {\n    function c() { return 10 }\n    assert (c() === 10);\n  }\n\n  assert (c === 8);\n}\nassert (typeof c === \"undefined\");\n\n"
  },
  {
    "path": "tests/jerry/let10.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_reference_error (code)\n{\n  try {\n    eval (code);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof ReferenceError);\n  }\n}\n\ncheck_reference_error (\"let b = a, a;\");\ncheck_reference_error (\"const b = b;\");\ncheck_reference_error (\"a; let b, a;\");\ncheck_reference_error (\"a = 1; let b, a;\");\n\nfunction f() {\n  return x + y.a;\n}\n\ncheck_reference_error (\"x\");\ncheck_reference_error (\"y\");\ncheck_reference_error (\"x = 1\");\ncheck_reference_error (\"y = 1\");\n\nlet x = 6;\nassert (x === 6);\nlet y = { a: 7 };\nassert (y.a === 7);\n\nassert (f() === 13);\n"
  },
  {
    "path": "tests/jerry/let11.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nlet b = 5;\neval('function b() { return 8; }; assert(b() === 8);');\nassert(b === 5);\n"
  },
  {
    "path": "tests/jerry/let12.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction checkSyntax (str) {\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\ncheckSyntax (\"if (5) let a;\");\ncheckSyntax (\"if (5) const a;\");\ncheckSyntax (\"if (0) {} else let a;\");\ncheckSyntax (\"if (0) {} else const a;\");\ncheckSyntax (\"while (5) let a;\");\ncheckSyntax (\"while (5) const a;\");\ncheckSyntax (\"do let a; while (5)\");\ncheckSyntax (\"do const a; while (5)\");\ncheckSyntax (\"for (a in b) let c;\");\ncheckSyntax (\"for (a in b) const c;\");\ncheckSyntax (\"for (a of b) let c;\");\ncheckSyntax (\"for (a of b) const c;\");\ncheckSyntax (\"for (;;) let c;\");\ncheckSyntax (\"for (;;) const c;\");\ncheckSyntax (\"with ({}) let c;\");\ncheckSyntax (\"with ({}) const c;\");\ncheckSyntax (\"a: let c;\");\ncheckSyntax (\"a: const c;\");\n"
  },
  {
    "path": "tests/jerry/let13.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Declaring let */\n\n/* Note: l\\u0065t is let */\n\nfunction check_syntax_error (code) {\n  try {\n    eval(code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\nfunction check_strict_syntax_error (code) {\n  \"use strict\"\n\n  try {\n    eval(code)\n    assert (false)\n  } catch (e) {\n    assert (e instanceof SyntaxError)\n  }\n}\n\ncheck_syntax_error(\"let let = 5\")\ncheck_syntax_error(\"const [let] = [1]\")\ncheck_syntax_error(\"const l\\u0065t = 6\")\ncheck_syntax_error(\"let [l\\u0065t] = [2]\")\ncheck_syntax_error(\"l\\\\u0065t a\")\ncheck_strict_syntax_error(\"var let = 5\")\ncheck_strict_syntax_error(\"function let() {}\")\ncheck_strict_syntax_error(\"for (let in []) ;\")\ncheck_strict_syntax_error(\"l\\\\u0065t;\")\n\nvar let = 1\nassert(let === 1)\n\nvar [let] = [2]\nassert(let === 2)\n\nvar x = 0;\nlet = [ () => x = 1 ]\n\nl\\u0065t[0]()\nassert(x === 1)\n\nfunction f1()\n{\n  var a = 0\n\n  function let(l\\u0065t) {\n    a = let\n  }\n\n  let(3)\n\n  assert(a === 3)\n}\nf1()\n\nfunction f2()\n{\n  var let = [1]\n\n  /* First: destructuring pattern definition */\n  let\n  [a] = [2]\n\n  assert(a === 2)\n\n  a = 0\n\n  /* Second: property access */\n  l\\u0065t\n  [a] = [3]\n\n  assert(let[0][0] === 3)\n}\nf2()\n\nvar arr = []\n\nfor (let in [\"x\",\"y\"])\n  arr.push(let)\n\nassert(arr[0] === \"0\")\nassert(arr[1] === \"1\")\n\n/* Let and arrow */\n\nfor (let => 4; false ; ) ;\n\nlet => 5\n\n/* Let label */\nlet: break let\n"
  },
  {
    "path": "tests/jerry/let14.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f() { return 4 }\n\nexit: {\n  assert(f() === 6);\n  break exit;\n  function f() { return 6; }\n}\nassert(f() === 4);\n\n{\n  assert(f() === 6);\n  f = 1;\n  assert(f === 1);\n  function f() { return 6; }\n  f = 2;\n  assert(f === 2);\n}\nassert(f === 1);\n\nfunction g() { return 3 }\nexit: {\n  assert(g() === 5);\n  function g() { return 4; }\n  break exit;\n  function g() { return 5; }\n}\nassert(g() === 5);\n\nfunction h() {\n  try {\n    x;\n    assert(false);\n  } catch (e) {\n    assert(e instanceof ReferenceError);\n  }\n\n  eval(\"exit: { assert(x() === 8); x = 4; break exit; function x() { return 8; } }\");\n  assert(x === undefined);\n}\nh();\n"
  },
  {
    "path": "tests/jerry/let15.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n{\n  try {\n    f()\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n  }\n\n  let a = 1;\n\n  try {\n    f()\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n  }\n\n  let [b] = [2];\n\n  try {\n    f()\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n  }\n\n  const {c} = { c:3 };\n\n  f();\n  function f() { assert(a + b + c === 6) }\n}\n\n{\n  let a = 3;\n  let [b] = [4];\n  const {c} = { c:5 };\n\n  let f = (function () { assert(a + b + c === 12) })\n  f();\n\n  {\n    function g() { assert(a + b + c === 12) }\n    g();\n  }\n}\n\n{\n  class C {}\n\n  assert(function () { return C } () === C);\n}\n"
  },
  {
    "path": "tests/jerry/let2.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_syntax_error (code)\n{\n  try {\n    eval (code);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\ncheck_syntax_error (\"let a; let b; let a\");\ncheck_syntax_error (\"let a, b, a\");\ncheck_syntax_error (\"var a; let a;\");\ncheck_syntax_error (\"var a; const a = 3;\");\ncheck_syntax_error (\"let a; var a;\");\ncheck_syntax_error (\"const a = 3; var x, y, a;\");\ncheck_syntax_error (\"const a\");\ncheck_syntax_error (\"{ const a }\");\ncheck_syntax_error (\"const a, b\");\ncheck_syntax_error (\"let a; { let b; { var a; } }\");\ncheck_syntax_error (\"{ { var a = 4; } }; let a = 3\");\ncheck_syntax_error (\"function a() {}; let a;\");\ncheck_syntax_error (\"let a; function a() {};\");\ncheck_syntax_error (\"{ { function a() {}; let a; } }\");\ncheck_syntax_error (\"{ { let a; function a() {}; } }\");\ncheck_syntax_error (\"let a = 1; const b = 5; const a = 2;\");\ncheck_syntax_error (\"try {} catch (e) { let e; }\");\ncheck_syntax_error (\"try {} catch (e) { const e = 1; }\");\ncheck_syntax_error (\"let A; class A {}\");\ncheck_syntax_error (\"const A; class A {}\");\ncheck_syntax_error (\"class A {}; let A\");\ncheck_syntax_error (\"class A {}; const A = 1\");\n"
  },
  {
    "path": "tests/jerry/let3.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar g = -1;\n\nfunction f1() {\n  /* Function copied to var. */\n  assert (g === undefined);\n\n  {\n    assert (g() === 1);\n    function g() { return 1 };\n\n    {\n      assert (g() === 2);\n      function g() { return 2 };\n    }\n\n    assert (g() === 1);\n  }\n\n  assert (g() === 2);\n}\nf1();\n\nfunction f2() {\n  /* Function is not copied to var. */\n  'use strict'\n  assert (g === -1);\n\n  {\n    assert (g() === 1);\n    function g() { return 1 };\n\n    {\n      assert (g() === 2);\n      function g() { return 2 };\n    }\n\n    assert (g() === 1);\n  }\n\n  assert (g === -1);\n}\nf2();\n\nfunction f3() {\n  /* Function hoisted as let. */\n  assert (g === -1);\n\n  {\n    let g = 1;\n\n    {\n      if (true)\n      {\n        assert (g() === 2);\n\n        if (true)\n        {\n          assert (g() === 2);\n        }\n\n        function g() { return 2 };\n      }\n\n      assert (g === 1);\n    }\n\n    assert (g === 1);\n  }\n\n  assert (g === -1);\n}\nf3();\n"
  },
  {
    "path": "tests/jerry/let4.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar g = -1;\n\nfunction f1() {\n  /* Function copied to var. */\n  assert (g === undefined);\n\n  {\n    assert (g() === 1);\n    function g() { return 1 };\n\n    {\n      eval(\"assert (g() === 2)\");\n      function g() { return 2 };\n    }\n\n    assert (g() === 1);\n  }\n\n  assert (g() === 2);\n}\nf1();\n\nfunction f2() {\n  /* Function is not copied to var. */\n  'use strict'\n  assert (g === -1);\n\n  {\n    assert (g() === 1);\n    function g() { return 1 };\n\n    {\n      eval(\"assert (g() === 2)\");\n      function g() { return 2 };\n    }\n\n    assert (g() === 1);\n  }\n\n  assert (g === -1);\n}\nf2();\n\nfunction f3() {\n  /* Function hoisted as let. */\n  assert (g === -1);\n\n  {\n    let g = 1;\n\n    {\n      if (true)\n      {\n        assert (g() === 2);\n\n        if (true)\n        {\n          eval(\"assert (g() === 2)\");\n        }\n\n        function g() { return 2 };\n      }\n\n      assert (g === 1);\n    }\n\n    assert (g === 1);\n  }\n\n  assert (g === -1);\n}\nf3();\n"
  },
  {
    "path": "tests/jerry/let5.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nlet arr = [];\n\nfor (var a = 0; a < 10; a++)\n{\n  let j = a;\n  var f;\n\n  {\n    f = function () { return j; }\n\n    let j = (a & 0x1) ? a + 10 : a + 100;\n  }\n\n  arr[j] = f;\n}\n\nfor (var a = 0; a < 10; a++)\n{\n  assert (arr[a]() == ((a & 0x1) ? a + 10 : a + 100))\n}\n"
  },
  {
    "path": "tests/jerry/let6.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntry {\n  let a = 1;\n  eval (\"assert(a === 1)\");\n} catch (e) {\n  assert (false);\n}\n\nassert (typeof a === \"undefined\");\n\ntry {\n  let a = 2;\n  eval (\"assert(a === 2)\");\n\n  assert (typeof b === \"undefined\");\n  throw 3;\n} catch (e) {\n  let b = e;\n  eval (\"assert(b === 3)\");\n\n  assert (typeof a === \"undefined\");\n}\n\nassert (typeof a === \"undefined\");\nassert (typeof b === \"undefined\");\n\ntry {\n  let a = 4;\n  eval (\"assert(a === 4)\");\n\n  assert (typeof b === \"undefined\");\n} finally {\n  let b = 5;\n  eval (\"assert(b === 5)\");\n\n  assert (typeof a === \"undefined\");\n}\n\nassert (typeof a === \"undefined\");\nassert (typeof b === \"undefined\");\n\ntry {\n  let a = 6;\n  eval (\"assert(a === 6)\");\n\n  assert (typeof b === \"undefined\");\n  assert (typeof c === \"undefined\");\n  throw 7;\n} catch (e) {\n  let b = e;\n  eval (\"assert(b === 7)\");\n\n  assert (typeof a === \"undefined\");\n  assert (typeof c === \"undefined\");\n} finally {\n  let c = 8;\n  eval (\"assert(c === 8)\");\n\n  assert (typeof a === \"undefined\");\n  assert (typeof b === \"undefined\");\n}\n\nassert (typeof a === \"undefined\");\nassert (typeof b === \"undefined\");\nassert (typeof c === \"undefined\");\n"
  },
  {
    "path": "tests/jerry/let7.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nassert (typeof f === \"undefined\");\n\nfunction g() { return 6; }\n\nswitch (g()) {\ncase f():\n\n  let g = 9;\n\n  assert (g === 9);\n\n  function f() { return 6; }\n  break;\n\ndefault:\n  assert (false);\n}\n\nassert (f() === 6);\n\nswitch (g()) {\ncase f() - 2:\n\n  let g = 9;\n\n  assert ((function() { return g + f(); })() === 17);\n\n  function f() { return 8; }\n  break;\n\ndefault:\n  assert (false);\n}\n\nassert (f() === 8);\n\nswitch (g()) {\ncase g() + 5:\n  {\n    let g = 4;\n    assert (g == 4);\n  }\n  break;\n\ndefault:\n  /* If the declaration is not \"executed\", it has no effect */\n  function g() { return 1; }\n  assert (false);\n}\n\nassert (g() === 6);\n\nswitch (g()) {\ncase g() * 2:\n  {\n    let g = 4;\n    assert (g == 4);\n    eval();\n  }\n\n  function g() { return 3; }\n  break;\n\ndefault:\n  assert (false);\n}\n\nassert (g() === 3);\n"
  },
  {
    "path": "tests/jerry/let8.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nassert (typeof A === \"undefined\");\n\n{\n  class A {};\n\n  {\n    let A = 6;\n\n    assert (A === 6);\n  }\n\n  assert (typeof A === \"function\");\n}\n\nassert (typeof A === \"undefined\");\n\n{\n  let A = 5;\n  {\n    {\n      class A {};\n\n      assert (typeof A === \"function\");\n    }\n\n    assert (A === 5);\n  }\n}\n\nassert (typeof A === \"undefined\");\n\n{\n  let A = 5;\n  {\n    {\n      class A {};\n\n      eval ('assert (typeof A === \"function\")');\n    }\n\n    eval ('assert (A === 5)');\n  }\n}\n"
  },
  {
    "path": "tests/jerry/let9.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction f() {\n  try {\n    a;\n    assert (false);\n  } catch (e) {\n    assert (e instanceof ReferenceError);\n  }\n\n  eval (\"assert (a === undefined); { function a() { return 5; } }\");\n  assert (a() === 5);\n\n  /* Variables created by eval can be deleted. */\n  delete a;\n\n  try {\n    a;\n    assert (false);\n  } catch (e) {\n    assert (e instanceof ReferenceError);\n  }\n}\nf();\n\nfunction g() {\n  let a = 1;\n\n  eval (\"assert (a === 1);\"\n        + \"{ function a() { return 2; } assert (a() === 2) }\"\n        + \"assert (a === 1);\");\n\n  assert (a === 1);\n}\ng();\n"
  },
  {
    "path": "tests/jerry/logical-assignment.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction testLogicalOr(truish, falsish, value) {\n  let a = truish;\n  a ||= value;\n  expectSame(a, truish);\n\n  a = falsish;\n  a ||= value;\n  expectSame(a, value);\n\n  a = {\n    a: truish\n  };\n  a.a ||= value\n  expectSame(a.a, truish);\n\n  a = {\n    a: falsish\n  };\n  a.a ||= value;\n  expectSame(a.a, value);\n\n  let called = false;\n  let setter = function (_) {\n    called = true\n  };\n  a = Object.defineProperty({}, \"a\", {\n    set: setter\n  });\n  let obj = {\n    a: value\n  }\n  a ||= obj;\n  expectSame(called, false);\n  expectSame(Object.getOwnPropertyDescriptor(a, \"a\").set, setter);\n\n  a = falsish;\n  a ||= function () {};\n  expectSame(typeof a, 'function');\n  expectSame(a.name, 'a');\n\n  a = falsish;\n  a ||= class {};\n  expectSame(typeof a, 'function');\n  expectSame(a.name, 'a');\n\n  const b = truish;\n  b ||= value;\n  expectSame(b, truish);\n\n  expectSame(this.b, undefined);\n  this.b ||= value;\n  expectSame(this.b, value);\n}\n\nfunction testLogicalAnd(truish, falsish, value) {\n  let a = falsish;\n  a &&= value;\n  expectSame(a, falsish);\n\n  a = truish;\n  a &&= value;\n  expectSame(a, value);\n\n  a = {\n    a: falsish\n  };\n  a.a &&= value\n  expectSame(a.a, falsish);\n\n  a = {\n    a: truish\n  };\n  a.a &&= value;\n  expectSame(a.a, value);\n\n  let called = false;\n  let setter = function (_) {\n    called = true\n  };\n  a = Object.defineProperty({}, \"a\", {\n    set: setter\n  });\n  let obj = {\n    a: value\n  };\n  a &&= obj;\n  expectSame(called, false);\n  expectSame(Object.getOwnPropertyDescriptor(a, \"a\").value, obj.a);\n\n  a = truish;\n  a &&= function () {};\n  expectSame(typeof a, 'function');\n  expectSame(a.name, 'a');\n\n  a = truish;\n  a &&= class {};\n  expectSame(typeof a, 'function');\n  expectSame(a.name, 'a');\n\n  const b = falsish;\n  b &&= value;\n  expectSame(b, falsish);\n\n  expectSame(this.b, undefined);\n  this.b &&= value;\n  expectSame(this.b, undefined);\n}\n\nfunction testNullish(truish, falsish, value) {\n  let a = falsish;\n  a ??= value;\n  expectSame(a, value);\n\n  a = truish;\n  a ??= value;\n  expectSame(a, truish);\n\n  a = {\n    a: falsish\n  };\n  a.a ??= value\n  expectSame(a.a, value);\n\n  a = {\n    a: truish\n  };\n  a.a ??= value;\n  expectSame(a.a, truish);\n\n  let called = false;\n  let setter = function (_) {\n    called = true\n  };\n  a = Object.defineProperty({}, \"a\", {\n    set: setter\n  });\n  let obj = {\n    a: value\n  };\n  a ??= obj;\n  expectSame(called, false);\n  expectSame(Object.getOwnPropertyDescriptor(a, \"a\").set, setter);\n\n  a = falsish;\n  a ??= function () {};\n  expectSame(typeof a, 'function');\n  expectSame(a.name, 'a');\n\n  a = falsish;\n  a ??= class {};\n  expectSame(typeof a, 'function');\n  expectSame(a.name, 'a');\n\n  const b = truish;\n  b ??= value;\n  expectSame(b, truish);\n\n  expectSame(this.b, undefined);\n  this.b ??= value;\n  expectSame(this.b, value);\n}\n\nconst nullishValues = [undefined, null];\nconst logicalTrueValues = [1.1, Infinity, 1n, true, \"foo\", {}, Symbol()];\nconst logicalFalseValues = [0, 0.0, NaN, 0n, false, \"\", ...nullishValues];\nconst allValues = [...logicalTrueValues, ...logicalFalseValues];\n\nfunction testValues(cb, falseValues) {\n  for (const truish of logicalTrueValues) {\n    for (const falsish of falseValues) {\n      for (const value of allValues) {\n        cb.call({}, truish, falsish, value);\n      }\n    }\n  }\n}\n\nfunction expectSame(x, value) {\n  if (typeof x === 'number' && isNaN(x)) {\n    assert(typeof value === 'number');\n    assert(isNaN(value));\n  } else {\n    assert(x === value);\n  }\n}\n\ntestValues(testLogicalOr, logicalFalseValues);\ntestValues(testLogicalAnd, logicalFalseValues);\ntestValues(testNullish, nullishValues);\n\nfunction expectTypeError(str) {\n  try {\n    eval(str);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n}\n\nexpectTypeError(\"const c = 0; c ||= 8\");\nexpectTypeError(\"const c = 1; c &&= 8\");\nexpectTypeError(\"const c = undefined; c ??= 8\");\n"
  },
  {
    "path": "tests/jerry/logical.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert((!false) === true);\n\nassert((true || true) === true);\nassert((false || true) === true);\nassert((false || false) === false);\nassert((true || false) === true);\n\nassert((true && true) === true);\nassert((true && false) === false);\nassert((false && true) === false);\nassert((false && false) === false);"
  },
  {
    "path": "tests/jerry/map-iterators.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar methods = ['entries', 'keys', 'values', Symbol.iterator];\n\nmethods.forEach(function (method) {\n  try {\n    Map.prototype[method].call(5);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n});\n\nmethods.forEach(function (method) {\n  try {\n    Map.prototype[method].call({});\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n});\n\nvar testArray = [{0: '0', 1: 0},\n                 {0: '1', 1: 1},\n                 {0: '2', 1: 2},\n                 {0: '3', 1: 3},\n                 {0: '4', 1: 4},\n                 {0: '5', 1: 5},\n                 {0: '6', 1: 6}];\n\nvar m = new Map(testArray);\n\nmethods.forEach(function(method) {\n  assert(m[method]().toString() === '[object Map Iterator]');\n});\n\nmethods.forEach(function (method) {\n  try {\n    m[method].next.call(5);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n});\n\nmethods.forEach(function (method) {\n  try {\n    m[method].next.call({});\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n});\n\nvar entryIterators = [m.entries(), m[Symbol.iterator]()];\nvar keyIterator = m.keys();\nvar valueIterator = m.values();\nvar elementCount = m.size;\n\nfor (var i = 0; i < elementCount; i++) {\n  entryIterators.forEach(function(element) {\n    var next = element.next();\n    assert(next.done === false);\n    assert(next.value[0] === '' + i);\n    assert(next.value[1] === i);\n  });\n\n  var next = keyIterator.next();\n  assert(next.done === false);\n  assert(next.value === '' + i);\n\n  var next = valueIterator.next();\n  assert(next.done === false);\n  assert(next.value === i);\n}\n\nentryIterators.forEach(function(element) {\n  var next = element.next();\n  assert(next.done === true);\n  assert(next.value === undefined);\n});\n\nvar next = keyIterator.next();\nassert(next.done === true);\nassert(next.value === undefined);\n\nnext = valueIterator.next();\nassert(next.done === true);\nassert(next.value === undefined);\n\nvar entryIterators = [m.entries(), m[Symbol.iterator]()];\nvar keyIterator = m.keys();\nvar valueIterator = m.values();\nvar elementCount = m.size;\n\nfor (var i = 0; i < elementCount; i++) {\n  entryIterators.forEach(function(element) {\n    var next = element.next();\n    assert(next.done === false);\n    assert(next.value[0] === '' + i);\n    assert(next.value[1] === i);\n  });\n\n  var next = keyIterator.next();\n  assert(next.done === false);\n  assert(next.value === '' + i);\n\n  var next = valueIterator.next();\n  assert(next.done === false);\n  assert(next.value === i);\n  m.delete('' + i);\n}\n\nassert(m.size === 0);\n\nm = new Map(testArray);\nvar loopCount = 0;\nvar expected = [{0: '0', 1: 0},\n                {0: '2', 1: 2},\n                {0: '4', 1: 4},\n                {0: '6', 1: 6},\n                {0: '1', 1: 1},\n                {0: '3', 1: 3},\n                {0: '5', 1: 5}]\n\nm.forEach(function(value, key) {\n  if (loopCount === 0) {\n    for (i = 0; i < testArray.length; i++) {\n      if (i % 2) {\n        m.delete(testArray[i][0]);\n        m.set(testArray[i][0], testArray[i][1]);\n      }\n    }\n  }\n\n  assert (key === expected[loopCount][0]);\n  assert (value === expected[loopCount][1]);\n\n  loopCount++;\n});\n\nassert(loopCount === expected.length);\n\nloopCount = 0;\nexpected = [{0: '0', 1: 0},\n            {0: '1', 1: 1}];\n\nfor (var [key, value] of m) {\n  if (loopCount === 0) {\n    m.clear();\n    m.set('1', 1);\n  }\n\n  assert(key === expected[loopCount][0]);\n  assert(value === expected[loopCount][1]);\n\n  loopCount++;\n}\n\nm = new Map(testArray);\nloopCount = 0;\n\nfor (var [key, value] of m) {\n  if (loopCount === 0) {\n    m.delete('' + testArray.length - 1);\n  }\n\n  assert(key === '' + loopCount);\n  assert(value === loopCount);\n\n  loopCount++;\n}\n"
  },
  {
    "path": "tests/jerry/map-prototype-foreach.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar map = new Map();\n\n/* Test when the map object keys are strings */\nfor (var i = 0; i < 15; i++) {\n  map.set (\"foo\" + i, i);\n  assert (map.size === i + 1);\n}\n\nvar counter = 0;\n\nmap.forEach (function (value, key) {\n  assert (typeof key === \"string\");\n  assert (key === \"foo\" + counter);\n  assert (typeof value === \"number\");\n  assert (value === counter);\n  counter++;\n});\n\nmap.clear ();\nassert (map.size === 0);\ncounter = 0;\n\n/* Test when the map object keys are numbers */\nfor (var i = 0; i < 15; i++) {\n  map.set (i + 0.5, \"foo\" + i);\n  assert (map.size === i + 1);\n}\n\nmap.forEach (function (value, key) {\n  assert (typeof key === \"number\");\n  assert (key === counter + 0.5);\n  assert (typeof value === \"string\");\n  assert (value === \"foo\" + counter);\n  counter++;\n});\n\nmap.clear ();\nassert (map.size === 0);\ncounter = 0;\n\nvar objectList = [];\n\n/* Test when the map object keys are objects */\nfor (var i = 0; i < 15; i++) {\n  objectList[i] = { index : i };\n  map.set (objectList[i], \"foo\" + i);\n  assert (map.size === i + 1);\n}\n\nmap.forEach (function (value, key) {\n  assert (typeof key === \"object\");\n  assert (key === objectList[counter]);\n  assert (key.index === objectList[counter].index);\n  assert (typeof value === \"string\");\n  assert (value === \"foo\" + counter);\n  counter++;\n});\n\n/* Test when the this argument is not a map object */\ntry {\n  Map.prototype.forEach.call ({});\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n/* Test when the 1st argument is not callable */\ntry {\n  map.forEach (5);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n/* Test when the the callback function throws error */\ntry {\n  map.forEach (function (value, key) {\n    throw new ReferenceError (\"foo\");\n  });\n  assert (false);\n} catch (e) {\n  assert (e instanceof ReferenceError);\n  assert (e.message === \"foo\");\n}\n\n/* Test when the 2nd optional argument is present */\nvar object = {\n  _secret : 42\n}\n\nmap.forEach (function (value, key) {\n  assert (this._secret === 42);\n}, object);\n\n/* Test third argument of callback */\nmap = new Map();\nmap.set('foo', 42);\nmap.set('bar', 84);\n\nmap.forEach(function(value, key, thisArg) {\n  assert (typeof thisArg === \"object\");\n  assert (thisArg === map);\n});\n"
  },
  {
    "path": "tests/jerry/map.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar m = new Map();\nassert(m.size == 0);\nassert(m.set(1, 1) === m);\nassert(m.has(1));\nassert(m.size == 1);\n\nassert(m.set(undefined, 123) === m);\nassert(m.size == 2);\nassert(m.has(undefined));\nassert(m.get(undefined) === 123);\n\nassert(m.set(null, 456) === m);\nassert(m.size == 3);\nassert(m.has(null));\nassert(m.get(null) === 456);\n\nassert(m.set(\"strItem\", { x:789 }) === m);\nassert(m.size == 4);\nassert(m.has(\"str\" + \"Item\"));\nassert(m.get(\"st\" + \"rItem\").x === 789);\n\nassert(m.set(12.25, 12.25) === m);\nassert(m.size == 5);\nassert(m.has(12 + (function() { return 0.25 })()));\nassert(m.get(13 - (function() { return 0.75 })()) === 12.25);\n\nassert(m.delete(1))\nassert(m.size == 4);\nassert(!m.has(1));\nassert(m.get(1) === undefined);\n\nassert(!m.delete(2));\n\nassert(m.delete(12 + (function() { return 0.25 })()));\nassert(m.size == 3);\nassert(!m.has(12.25));\nassert(m.get(12.25) === undefined);\n\nassert(m.delete(\"strI\" + \"tem\"))\nassert(m.delete(undefined))\nassert(m.size == 1);\n\nassert(m.delete(null))\nassert(m.size == 0);\n\nm.set(1,1)\nm.set(2,2)\nm.set(3,3)\nm.set(1,7)\nm.set(1,8)\nm.set(2,7)\nm.set(2,8)\nm.set(3,7)\nm.set(3,8)\n\nassert(m.size == 3);\nassert(m.get(1) === 8);\nassert(m.get(2) === 8);\nassert(m.get(3) === 8);\n\nm.set(NaN, \"not a number\");\nassert(m.size === 4);\nassert(m.get(NaN) === \"not a number\");\nassert(m.get(Number(\"foo\")) === \"not a number\")\n\nm.set(0, \"PosZero\");\nassert(m.size === 5);\nm.set(-0, \"NegZero\");\nassert(m.size === 5);\nassert(m.get (0) === \"NegZero\");\nassert(m.get (-0) === \"NegZero\");\n\nvar symbolFoo = Symbol (\"foo\");\nm.set (symbolFoo, \"SymbolFoo\");\nassert(m.size === 6);\nassert(m.get(symbolFoo) === \"SymbolFoo\");\n\nvar object = {};\nm.set (object, \"object\");\nassert(m.size === 7);\nassert(m.get(object) === \"object\");\nassert(m.get({}) === undefined);\n\nvar myObj = { o : 4 };\nm.set(\"foo\", myObj);\nassert(m.size === 8);\nassert(m.get (\"foo\") === myObj);\nassert(m.get (\"foo\").o === 4);\n\nm.clear();\nassert(m.size === 0);\n\nm.set(\"foo\", myObj);\nassert(m.size === 1);\nassert(m.get (\"foo\") === myObj);\nassert(m.get (\"foo\").o === 4);\n\nvar mapNameDesc = Object.getOwnPropertyDescriptor (Map, 'name');\nassert(mapNameDesc.value === \"Map\");\nassert(mapNameDesc.writable === false);\nassert(mapNameDesc.enumerable === false);\nassert(mapNameDesc.configurable === true);\n\nassert(Map.prototype.name === undefined);\n\nm = new Map([{0: \"foo\", 1: 3}, {0 : \"bar\", 1 : 2}]);\n\nassert (m.size === 2);\nassert (m.get(\"foo\") === 3);\nassert (m.get(\"bar\") === 2);\n\nfunction createIterable(arr, methods = {}) {\n  let iterable = function *() {\n    let idx = 0;\n    while (idx < arr.length) {\n      yield arr[idx];\n      idx++;\n    }\n  }();\n  iterable['return'] = methods['return'];\n  iterable['throw'] = methods['throw'];\n\n  return iterable;\n};\n\nvar closed = false;\nvar iter = createIterable([1, 2, 3], {\n  'return': function(){ closed = true; return {}; }\n});\ntry {\n  new Map(iter);\n} catch(e){}\n\nassert(closed === true);\n\nvar map = new Map();\nmap.set(-0, \"foo\");\nvar k;\nmap.forEach(function (value, key) {\n  k = 1 / key;\n});\n\nassert(k === Infinity);\nassert(map.get(+0) === \"foo\");\n\n[Symbol.iterator, Symbol.toStringTag].forEach(e => assert (Reflect.ownKeys(Map.prototype).includes(e)));\n"
  },
  {
    "path": "tests/jerry/math-abs.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar nan = NaN;\nvar p_zero = 0.0;\nvar m_zero = -p_zero;\nvar p_inf = Infinity;\nvar m_inf = -p_inf;\n\nassert (isNaN(Math['abs'](NaN)));\nassert (Math['abs'](p_zero) === p_zero);\nassert (Math['abs'](m_zero) === p_zero);\nassert (Math['abs'](p_inf) === p_inf);\nassert (Math['abs'](m_inf) === p_inf);\n\nassert (Math['abs'](0.5) === 0.5);\nassert (Math['abs'](-0.5) === 0.5);\nassert (Math['abs'](1.2) === 1.2);\nassert (Math['abs'](1.5) === 1.5);\nassert (Math['abs'](0.7) === 0.7);\nassert (Math['abs'](0.2) === 0.2);\nassert (Math['abs'](-0.2) === 0.2);\nassert (Math['abs'](-0.7) === 0.7);\nassert (Math['abs'](-1.2) === 1.2);\nassert (Math['abs'](-1.7) === 1.7);\nassert (Math['abs'](-1.5) === 1.5);\n"
  },
  {
    "path": "tests/jerry/math-acosh.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar nan = NaN;\nvar p_zero = 0.0;\nvar m_zero = -p_zero;\n\nfunction isSameZero (x, y)\n{\n  return x === 0 && (1 / x) === (1 / y);\n}\n\nassert(isNaN(Math.acosh(NaN)));\nassert(isNaN(Math.acosh(0)));\nassert(isNaN(Math.acosh(Number.NEGATIVE_INFINITY)));\nassert(isSameZero(Math.acosh(1), p_zero));\nassert(Math.acosh(Number.POSITIVE_INFINITY) === Number.POSITIVE_INFINITY);\n\n"
  },
  {
    "path": "tests/jerry/math-asinh.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar nan = NaN;\nvar p_zero = 0.0;\nvar m_zero = -p_zero;\n\nfunction isSameZero (x, y)\n{\n  return x === 0 && (1 / x) === (1 / y);\n}\n\nassert(isNaN(Math.asinh(NaN)));\nassert(isSameZero(Math.asinh(p_zero), p_zero));\nassert(isSameZero(Math.asinh(m_zero), m_zero));\nassert(Math.asinh(Number.POSITIVE_INFINITY) === Number.POSITIVE_INFINITY);\nassert(Math.asinh(Number.NEGATIVE_INFINITY) === Number.NEGATIVE_INFINITY);\n\n"
  },
  {
    "path": "tests/jerry/math-atanh.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar nan = NaN;\nvar p_zero = 0.0;\nvar m_zero = -p_zero;\n\nfunction isSameZero (x, y)\n{\n  return x === 0 && (1 / x) === (1 / y);\n}\n\nassert(isNaN(Math.atanh(NaN)));\nassert(isNaN(Math.atanh(2)));\nassert(isNaN(Math.atanh(44)));\nassert(isNaN(Math.atanh(-2)));\nassert(isNaN(Math.atanh(-13)));\nassert(isSameZero(Math.atanh(p_zero), p_zero));\nassert(isSameZero(Math.atanh(m_zero), m_zero));\nassert(Math.atanh(-1) === Number.NEGATIVE_INFINITY);\nassert(Math.atanh(1) === Number.POSITIVE_INFINITY);\n"
  },
  {
    "path": "tests/jerry/math-cbrt.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar p_zero = 0.0;\nvar n_zero = -p_zero;\n\nfunction isSameZero (x, y)\n{\n  return x === 0 && (1 / x) === (1 / y);\n}\n\nfunction approxEq (x, y)\n{\n  return Math.abs(x - y) <= Number.EPSILON * 2\n}\n\nassert(isNaN(Math.cbrt(NaN)));\nassert(isSameZero(Math.cbrt(p_zero), p_zero));\nassert(isSameZero(Math.cbrt(n_zero), n_zero));\nassert(Math.cbrt(Number.POSITIVE_INFINITY) === Number.POSITIVE_INFINITY);\nassert(Math.cbrt(Number.NEGATIVE_INFINITY) === Number.NEGATIVE_INFINITY);\n\nassert(Math.cbrt(1.0) === 1.0);\nassert(Math.cbrt(-1.0) === -1.0);\n\nassert(approxEq(Math.cbrt(27.0), 3.0));\nassert(approxEq(Math.cbrt(0.001), 0.1));\n"
  },
  {
    "path": "tests/jerry/math-cosh.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar p_zero = 0.0;\nvar n_zero = -p_zero;\n\nassert(isNaN(Math.cosh(NaN)));\nassert(Math.cosh(p_zero) === 1);\nassert(Math.cosh(n_zero) === 1);\nassert(Math.cosh(Number.POSITIVE_INFINITY) === Number.POSITIVE_INFINITY);\nassert(Math.cosh(Number.NEGATIVE_INFINITY) === Number.POSITIVE_INFINITY);\n"
  },
  {
    "path": "tests/jerry/math-exp.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(isNaN(Math['exp'] (NaN)));\nassert(Math['exp'] (0.0) === 1.0);\nassert(Math['exp'] (Infinity) === Infinity);\nassert(Math['exp'] (-Infinity) === 0.0);\n\nassert(Math['exp'] (1) >= 0.999999 * Math['E']);\nassert(Math['exp'] (1) <= 1.000001 * Math['E']);\n\nassert(Math['exp'] (-1) >= 0.999999 * (1 / Math['E']));\nassert(Math['exp'] (-1) <= 1.000001 * (1 / Math['E']));\n\nassert(Math['exp'] (0.5) >= 0.999999 * 1.6487212707);\nassert(Math['exp'] (0.5) <= 1.000001 * 1.6487212707);\n\nassert(Math['exp'] (30) >= 0.999999 * 1.06864745815e+13);\nassert(Math['exp'] (30) <= 1.000001 * 1.06864745815e+13);\n"
  },
  {
    "path": "tests/jerry/math-expm1.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar p_zero = 0.0;\nvar n_zero = -p_zero;\n\nfunction isSameZero (x, y)\n{\n  return x === 0 && (1 / x) === (1 / y);\n}\n\nassert(isNaN(Math.expm1(NaN)));\nassert(isSameZero(Math.expm1(p_zero), p_zero));\nassert(isSameZero(Math.expm1(n_zero), n_zero));\nassert(Math.expm1(Number.POSITIVE_INFINITY) === Number.POSITIVE_INFINITY);\nassert(Math.expm1(Number.NEGATIVE_INFINITY) === -1);\nassert(1/Math.expm1(-0) === Number.NEGATIVE_INFINITY)\nassert(1/Math.expm1(0) === Number.POSITIVE_INFINITY)\nassert(Math.expm1(1) <= 1.00000001 * (Math.E - 1));\nassert(Math.expm1(1) >= 0.99999999 * (Math.E - 1));\n"
  },
  {
    "path": "tests/jerry/math-functions-tonumber-rule.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = \"\";\nvar a = {valueOf: function() { str += \"a\"; return 1;}};\nvar b = {valueOf: function() { str += \"b\"; return NaN;}};\nvar c = {valueOf: function() { str += \"c\"; return 2;}};\n\nMath.min (a, b, c);\nassert (str === \"abc\");\n\nstr = \"\";\nMath.max (a, b, c);\nassert (str === \"abc\");\n\nstr = \"\";\nMath.pow(b,a);\nassert (str === \"ba\");\n\nstr = \"\";\nMath.atan2(b,a);\nassert (str === \"ba\");\n"
  },
  {
    "path": "tests/jerry/math-functions-tonumber-rule2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = \"\";\nvar a = {valueOf: function() { str += \"a\"; return 1;}};\nvar b = {valueOf: function() { str += \"b\"; return NaN;}};\nvar c = {valueOf: function() { str += \"c\"; return 2;}};\nvar d = {valueOf: function() { str += \"d\"; return Infinity;}};\nvar e = {valueOf: function() { str += \"e\"; return 3;}};\n\nMath.hypot (a, b, c, d, e);\nassert (str === \"abcde\");\n"
  },
  {
    "path": "tests/jerry/math-log.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert( isNaN (Math.log(NaN)) );\nassert( isNaN (Math.log (-1)) );\nassert( isNaN (Math.log (-Infinity)) );\n\nassert( Math.log (0) === -Infinity );\nassert( Math.log (1) === 0 );\nassert( Math.log (Infinity) === Infinity );\nassert( Math.log (2) >= Math.LN2 * 0.999999 );\nassert( Math.log (2) <= Math.LN2 * 1.000001 );\n\nvar very_close_to_1_but_greater = 1.0000001;\nassert( very_close_to_1_but_greater > 1.0 );\n\nassert( Math.log (very_close_to_1_but_greater) >= 0.0 );\nassert( Math.log (very_close_to_1_but_greater) <= 0.000001 );\n\nvar very_close_to_1_but_less = 0.999999;\nassert( very_close_to_1_but_less < 1.0 );\n\nassert( Math.log (very_close_to_1_but_less) <= 0.0 );\nassert( Math.log (very_close_to_1_but_less) >= -0.00001 );\n\nassert( Math.log (2.7182818284590452354) >= 0.999999 );\nassert( Math.log (2.7182818284590452354) <= 1.000001 );\n\nassert( Math.log (0.000000001) <= 0.999999 * (-20.7232658369) );\nassert( Math.log (0.000000001) >= 1.000001 * (-20.7232658369) );\n\nassert( Math.log (1.0e+38) >= 0.999999 * 87.4982335338 );\nassert( Math.log (1.0e+38) <= 1.000001 * 87.4982335338 );\n"
  },
  {
    "path": "tests/jerry/math-log10.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar p_zero = 0.0;\nvar n_zero = -p_zero;\n\nassert(isNaN(Math.log10(NaN)));\nassert(isNaN(Math.log10(-42)));\nassert(isNaN(Math.log10(-3.0)));\nassert(Math.log10(n_zero) === Number.NEGATIVE_INFINITY);\nassert(Math.log10(p_zero) === Number.NEGATIVE_INFINITY);\nassert(Math.log10(1) === p_zero);\nassert(Math.log10(Number.POSITIVE_INFINITY) === Number.POSITIVE_INFINITY);\nassert(Math.log10(10.0) === 1);\nassert(Math.log10(100.0) === 2)\n"
  },
  {
    "path": "tests/jerry/math-log1p.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar p_zero = 0.0;\nvar n_zero = -p_zero;\n\nfunction isSameZero (x, y)\n{\n  return x === 0 && (1 / x) === (1 / y);\n}\n\nassert(isNaN(Math.log1p(NaN)));\nassert(isNaN(Math.log1p(-42)));\nassert(isNaN(Math.log1p(-3.0)));\nassert(isSameZero(Math.log1p(n_zero), n_zero));\nassert(isSameZero(Math.log1p(p_zero), p_zero));\nassert(Math.log1p(-1) === Number.NEGATIVE_INFINITY);\nassert(Math.log1p(Number.POSITIVE_INFINITY) === Number.POSITIVE_INFINITY);\nassert(Math.log1p(Math.E - 1) === 1);\n"
  },
  {
    "path": "tests/jerry/math-log2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar p_zero = 0.0;\nvar n_zero = -p_zero;\n\nassert(isNaN(Math.log2(NaN)));\nassert(isNaN(Math.log2(-42)));\nassert(isNaN(Math.log2(-3.0)));\nassert(Math.log2(n_zero) === Number.NEGATIVE_INFINITY);\nassert(Math.log2(p_zero) === Number.NEGATIVE_INFINITY);\nassert(Math.log2(1) === p_zero);\nassert(Math.log2(Number.POSITIVE_INFINITY) === Number.POSITIVE_INFINITY);\nassert(Math.log2(2.0) === 1);\nassert(Math.log2(4.0) === 2)\nassert(Math.log2(1024.0) === 10)\n"
  },
  {
    "path": "tests/jerry/math-max.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(isNaN (Math['max'] (1.0, NaN)));\nassert(isNaN (Math['max'] (NaN, 1.0)));\nassert(isNaN (Math['max'] (Infinity, NaN)));\nassert(isNaN (Math['max'] (NaN, Infinity)));\nassert(Math['max'] (1.0, 3.0, 0.0) === 3.0);\nassert(Math['max'] (1.0, 3.0, Infinity) === Infinity);\nassert(Math['max'] (1.0, 3.0, -Infinity) === 3.0);\nassert(Math['max'] (-Infinity, Infinity) === Infinity);\nassert(Math['max'] (Infinity, -Infinity) === Infinity);\nassert(Math['max'] (Infinity, Infinity) === Infinity);\nassert(Math['max'] (-Infinity, -Infinity) === -Infinity);\nassert(Math['max'] () === -Infinity);\n\nassert(Math['max'] (0.0, -0.0) === 0.0);\nassert(Math['max'] (-0.0, 0.0) === 0.0);\n\nassert(Math['max'] (2, Infinity) === Infinity);\nassert(Math['max'] (Infinity, 2) === Infinity);\nassert(Math['max'] (2, -Infinity) === 2);\nassert(Math['max'] (-Infinity, 2) === 2);\n\nassert(Math['max'] (-2, Infinity) === Infinity);\nassert(Math['max'] (Infinity, -2) === Infinity);\nassert(Math['max'] (-2, -Infinity) === -2);\nassert(Math['max'] (-Infinity, -2) === -2);\n"
  },
  {
    "path": "tests/jerry/math-min.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(isNaN (Math['min'] (1.0, NaN)));\nassert(isNaN (Math['min'] (NaN, 1.0)));\nassert(isNaN (Math['min'] (-Infinity, NaN)));\nassert(isNaN (Math['min'] (NaN, -Infinity)));\nassert(Math['min'] (1.0, 3.0, 0.0) === 0.0);\nassert(Math['min'] (1.0, 3.0, Infinity) === 1.0);\nassert(Math['min'] (1.0, 3.0, -Infinity) === -Infinity);\nassert(Math['min'] (-Infinity, Infinity) === -Infinity);\nassert(Math['min'] (Infinity, -Infinity) === -Infinity);\nassert(Math['min'] (Infinity, Infinity) === Infinity);\nassert(Math['min'] (-Infinity, -Infinity) === -Infinity);\nassert(Math['min'] () === Infinity);\n\nassert(Math['min'] (0.0, -0.0) === -0.0);\nassert(Math['min'] (-0.0, 0.0) === -0.0);\n\nassert(Math['min'] (2, -Infinity) === -Infinity);\nassert(Math['min'] (-Infinity, 2) === -Infinity);\nassert(Math['min'] (2, Infinity) === 2);\nassert(Math['min'] (Infinity, 2) === 2);\n\nassert(Math['min'] (-2, Infinity) === -2);\nassert(Math['min'] (Infinity, -2) === -2);\nassert(Math['min'] (-2, -Infinity) === -Infinity);\nassert(Math['min'] (-Infinity, -2) === -Infinity);\n"
  },
  {
    "path": "tests/jerry/math-pow.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert ( isNaN (Math.pow (0.0 /* any number */, NaN)) );\nassert ( Math.pow (NaN, 0.0) === 1.0 );\nassert ( Math.pow (NaN, -0.0) === 1.0 );\nassert ( isNaN (Math.pow (NaN, 1.0 /* any non-zero number */)) );\nassert ( Math.pow (2.0, Infinity) === Infinity );\nassert ( Math.pow (2.0, -Infinity) === 0.0 );\nassert ( isNaN (Math.pow (1.0, Infinity)) );\nassert ( isNaN (Math.pow (1.0, -Infinity)) );\nassert ( Math.pow (0.5, Infinity) === 0.0 );\nassert ( Math.pow (0.5, -Infinity) === Infinity );\nassert ( Math.pow (Infinity, 1.0) === Infinity );\nassert ( Math.pow (Infinity, -1.0) === 0 );\nassert ( Math.pow (-Infinity, 3.0) === -Infinity );\nassert ( Math.pow (-Infinity, 2.0) === Infinity );\nassert ( Math.pow (-Infinity, 2.5) === Infinity );\nassert ( Math.pow (-Infinity, -3.0) === -0.0 );\nassert ( Math.pow (-Infinity, -2.0) === 0.0 );\nassert ( Math.pow (-Infinity, -2.5) === 0.0 );\nassert ( Math.pow (0.0, 1.2) === 0.0 );\nassert ( Math.pow (0.0, -1.2) === Infinity );\nassert ( Math.pow (-0.0, 3.0) === -0.0 );\nassert ( Math.pow (-0.0, 2.0) === 0.0 );\nassert ( Math.pow (-0.0, 2.5) === 0.0 );\nassert ( Math.pow (-0.0, -3.0) === -Infinity );\nassert ( Math.pow (-0.0, -2.0) === Infinity );\nassert ( Math.pow (-0.0, -2.5) === Infinity );\nassert ( isNaN (Math.pow (-3, 2.5)) );\n\nassert(Math.pow (-2, 2) === 4);\nassert(Math.pow (2, 2) === 4);\n\nassert(Math.pow (2, 3) === 8);\nassert(Math.pow (-2, 3) === -8);\n\nassert(Math.pow (5, 3) === 125);\nassert(Math.pow (-5, 3) === -125);\n"
  },
  {
    "path": "tests/jerry/math-round.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar nan = NaN;\nvar p_zero = 0.0;\nvar m_zero = -p_zero;\nvar p_inf = Infinity;\nvar m_inf = -p_inf;\n\nassert (isNaN(Math['round'](NaN)));\nassert (Math['round'](p_zero) === p_zero);\nassert (Math['round'](m_zero) === m_zero);\nassert (Math['round'](p_inf) === p_inf);\nassert (Math['round'](m_inf) === m_inf);\n\nassert (Math['round'](0.5) === 1.0);\nassert (Math['round'](-0.5) === -0.0);\nassert (Math['round'](1.2) === 1.0);\nassert (Math['round'](1.5) === 2.0);\nassert (Math['round'](0.7) === 1.0);\nassert (Math['round'](0.2) === 0.0);\nassert (Math['round'](-0.2) === -0.0);\nassert (Math['round'](-0.7) === -1.0);\nassert (Math['round'](-1.2) === -1.0);\nassert (Math['round'](-1.7) === -2.0);\nassert (Math['round'](-1.5) === -1.0);\n\nassert (Math['round'](1) === 1);\nassert (Math['round'](-1) === -1);\n\nfor (var n = 1; n <= 53; n++)\n{\n  var x = Math.pow(2, n)\n  assert (Math['round'](x - 1) === x - 1);\n  assert (Math['round'](x) === x);\n  assert (Math['round'](x + 1) === x + 1);\n  assert (Math['round'](-x - 1) === -x - 1);\n  assert (Math['round'](-x) === -x);\n  assert (Math['round'](-x + 1) === -x + 1);\n}\n"
  },
  {
    "path": "tests/jerry/math-sign.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar nan = NaN;\nvar p_zero = 0.0;\nvar m_zero = -p_zero;\n\nassert (isNaN(Math['sign'](NaN)));\nassert (Math['sign'](p_zero) === p_zero);\nassert (Math['sign'](m_zero) === m_zero);\nassert (Math['sign'](-5) === -1);\nassert (Math['sign'](5) === 1);\n"
  },
  {
    "path": "tests/jerry/math-sinh.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar p_zero = 0.0;\nvar n_zero = -p_zero;\n\nfunction isSameZero (x, y)\n{\n  return x === 0 && (1 / x) === (1 / y);\n}\n\nassert(isNaN(Math.sinh(NaN)));\nassert(isSameZero(Math.sinh(p_zero), p_zero));\nassert(isSameZero(Math.sinh(n_zero), n_zero));\nassert(Math.sinh(Number.POSITIVE_INFINITY) === Number.POSITIVE_INFINITY);\nassert(Math.sinh(Number.NEGATIVE_INFINITY) === Number.NEGATIVE_INFINITY);\n"
  },
  {
    "path": "tests/jerry/math-tanh.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar p_zero = 0.0;\nvar n_zero = -p_zero;\n\nfunction isSameZero (x, y)\n{\n  return x === 0 && (1 / x) === (1 / y);\n}\n\nassert(isNaN(Math.tanh(NaN)));\nassert(isSameZero(Math.tanh(p_zero), p_zero));\nassert(isSameZero(Math.tanh(n_zero), n_zero));\nassert(Math.tanh(Number.POSITIVE_INFINITY) === 1);\nassert(Math.tanh(Number.NEGATIVE_INFINITY) === -1);\n"
  },
  {
    "path": "tests/jerry/math-trig.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar delta = 0.0001;\nvar mod_m = 1.0 - delta;\nvar mod_p = 1.0 + delta;\n\nassert (isNaN (Math.cos (NaN)));\nassert ((Math.cos (+0.0)) == 1.0);\nassert ((Math.cos (-0.0)) == 1.0);\nassert (isNaN (Math.cos (Infinity)));\nassert (isNaN (Math.cos (-Infinity)));\n\nassert (Math.cos (Math.PI) > -1.0 * mod_p);\nassert (Math.cos (Math.PI) < -1.0 * mod_m);\n\nassert (Math.cos (Math.PI / 2) > -delta);\nassert (Math.cos (Math.PI / 2) < +delta);\nassert (Math.cos (-Math.PI / 2) > -delta);\nassert (Math.cos (-Math.PI / 2) < +delta);\n\nassert (Math.cos (Math.PI / 4) > mod_m * Math.SQRT2 / 2);\nassert (Math.cos (Math.PI / 4) < mod_p * Math.SQRT2 / 2);\n\nassert (Math.cos (-Math.PI / 4) > mod_m * Math.SQRT2 / 2);\nassert (Math.cos (-Math.PI / 4) < mod_p * Math.SQRT2 / 2);\n\nassert (isNaN (Math.sin (NaN)));\nassert (1.0 / Math.sin (0.0) == Infinity);\nassert (1.0 / Math.sin (-0.0) == -Infinity);\nassert (isNaN (Math.sin (Infinity)));\nassert (isNaN (Math.sin (-Infinity)));\n\nassert (Math.sin (Math.PI) > -delta);\nassert (Math.sin (Math.PI) < +delta);\n\nassert (Math.sin (Math.PI / 2) > 1.0 * mod_m);\nassert (Math.sin (Math.PI / 2) < 1.0 * mod_p);\n\nassert (Math.sin (-Math.PI / 2) > -1.0 * mod_p);\nassert (Math.sin (-Math.PI / 2) < -1.0 * mod_m);\n\nassert (Math.sin (Math.PI / 4) > mod_m * Math.SQRT2 / 2);\nassert (Math.sin (Math.PI / 4) < mod_p * Math.SQRT2 / 2);\n\nassert (Math.sin (-Math.PI / 4) > -mod_p * Math.SQRT2 / 2);\nassert (Math.sin (-Math.PI / 4) < -mod_m * Math.SQRT2 / 2);\n\nvar step = 0.01;\n\nfor (var x = -2 * Math.PI; x <= 2 * Math.PI; x += step)\n{\n  var s = Math.sin (x);\n  var c = Math.cos (x);\n  var sqr_s = s * s;\n  var sqr_c = c * c;\n\n  assert (sqr_s + sqr_c > mod_m);\n  assert (sqr_s + sqr_c < mod_p);\n}\n"
  },
  {
    "path": "tests/jerry/math-trunc.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar nan = NaN;\nvar p_zero = 0.0;\nvar m_zero = -p_zero;\nvar p_inf = Infinity;\nvar m_inf = -p_inf;\n\nfunction isSameZero (x, y)\n{\n  return x === 0 && (1 / x) === (1 / y);\n}\n\nassert (isNaN(Math['trunc'](NaN)));\nassert (isSameZero (Math['trunc'](p_zero), p_zero));\nassert (isSameZero (Math['trunc'](m_zero), m_zero));\nassert (Math['trunc'](p_inf) === p_inf);\nassert (Math['trunc'](m_inf) === m_inf);\nassert (isSameZero (Math['trunc'](0.5), p_zero));\nassert (isSameZero (Math['trunc'](-0.5), m_zero));\nassert (Math['trunc'](1.2) === 1);\nassert (Math['trunc'](-1.5) === -1);\nassert (Math['trunc'](65.7) === 65);\nassert (Math['trunc'](-24.9) === -24);\n"
  },
  {
    "path": "tests/jerry/module-circular-01.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport var a = 0\nexport let b = 1\n\nfunction other() {\n  return 33.5\n}\n\nexport function early() {\n  // This function is called before the module is executed\n  assert(other() === 33.5)\n  assert(a === undefined)\n  a = \"X\"\n\n  try {\n    b\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n  }\n}\n\nearly = \"Loaded\"\n\nimport * as o from \"module-circular-02.mjs\"\n"
  },
  {
    "path": "tests/jerry/module-circular-02.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport * as o from \"module-circular-01.mjs\"\n\nif (o.early != \"Loaded\")\n{\n  // The scope of module-circular-01.mjs is initialized and functions are usable\n  // However, the module script has not been executed\n\n  assert(o.a === undefined)\n  o.early()\n  assert(o.a === \"X\")\n\n  try {\n    o.b\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n  }\n\n  try {\n    o.a = \"X\"\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n  }\n\n  assert(o[Symbol.toStringTag] === \"Module\")\n\n  var result = Object.getOwnPropertyDescriptor(o, \"a\")\n  assert(result.value === \"X\")\n  assert(result.configurable === false)\n  assert(result.enumerable === true)\n  assert(result.writable === true)\n\n  try {\n    Object.getOwnPropertyDescriptor(o, \"b\")\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n  }\n\n  result = Object.getOwnPropertyDescriptor(o, Symbol.toStringTag)\n  assert(result.value === \"Module\")\n  assert(result.configurable === false)\n  assert(result.enumerable === false)\n  assert(result.writable === false)\n\n  Object.defineProperty(o, \"a\", { value: \"X\" })\n\n  try {\n    Object.defineProperty(o, \"a\", { value: \"Y\" })\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n  }\n\n  try {\n    Object.defineProperty(o, \"b\", { value:5 })\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n  }\n\n  Object.defineProperty(o, Symbol.toStringTag, { value: \"Module\", writable:false })\n\n  try {\n    Object.defineProperty(o, Symbol.toStringTag, { writable:true })\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n  }\n}\n"
  },
  {
    "path": "tests/jerry/module-circular-03.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport var a = 0\nexport let b = 1\n\nfunction other() {\n  return 33.5\n}\n\nexport function early() {\n  // This function is called before the module is executed\n  assert(other() === 33.5)\n  assert(a === undefined)\n  a = \"X\"\n\n  try {\n    b\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n  }\n}\n\nearly = \"Loaded\"\n\nimport * as o from \"module-circular-04.mjs\"\n"
  },
  {
    "path": "tests/jerry/module-circular-04.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {a as aa, b as bb, early} from \"module-circular-03.mjs\"\n\nexport var a = 5\n\nif (early != \"Loaded\")\n{\n  // The scope of module-circular-03.mjs is initialized and functions are usable\n  // However, the module script has not been executed\n\n  assert(aa === undefined)\n  early()\n  assert(aa === \"X\")\n\n  try {\n    bb\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n  }\n\n  a = 7\n\n  try {\n    aa = \"X\"\n    assert(false)\n  } catch (e) {\n    assert(e instanceof TypeError)\n  }\n\n  try {\n    c = 4\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n  }\n}\n"
  },
  {
    "path": "tests/jerry/module-circular-05.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {a} from \"./module-circular-06.mjs\"\nassert(a === 6.5)\n"
  },
  {
    "path": "tests/jerry/module-circular-06.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport {b as a} from \"./module-circular-07.mjs\";\nimport {b} from \"./module-circular-07.mjs\"\nassert(b === 6.5 || b === undefined)\n"
  },
  {
    "path": "tests/jerry/module-circular-07.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from \"./module-circular-08.mjs\"\nexport * from \"./module-circular-09.mjs\"\n"
  },
  {
    "path": "tests/jerry/module-circular-08.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport {a as b} from \"./module-circular-06.mjs\"\n"
  },
  {
    "path": "tests/jerry/module-circular-09.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport var b = 6.5\n"
  },
  {
    "path": "tests/jerry/module-dynamic-import.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_syntax_error(code)\n{\n  try {\n    eval(code);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n\ncheck_syntax_error(\"import('a.mjs',4)\");\ncheck_syntax_error(\"(import('a.mjs',4))\");\ncheck_syntax_error(\"(import 'a.mjs')\");\n"
  },
  {
    "path": "tests/jerry/module-export-01.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport {};\nexport {a as aa,};\nexport {b as bb, c as cc};\nexport {d};\nexport var x = 40;\nexport function f(a) {return a;} x++; /* test auto semicolon insertion */\nexport class Dog {\n  constructor (name) {\n    this.name = name;\n  }\n\n  speak() {\n    return this.name + \" barks.\"\n  }\n} x++; /* test auto semicolon insertion */\nexport default \"default\";\n\nvar a = \"a\";\nvar b = 5;\nvar c = function(a) { return 2 * a;}\nvar d = [1,2,3];\n\nassert (x === 42);\nassert (f(1) === 1);\nvar dog = new Dog(\"Pluto\")\nassert(dog.speak() === \"Pluto barks.\")\n"
  },
  {
    "path": "tests/jerry/module-export-02.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport {} from \"module-export-01.mjs\";\nexport {aa,} from \"module-export-01.mjs\";\nexport {bb as b_, cc as c_} from \"module-export-01.mjs\";\nexport * from \"module-export-01.mjs\";\nexport default function () {return \"default\"};\n"
  },
  {
    "path": "tests/jerry/module-export-03.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport default class {\n  constructor(num) {\n    this.num = num\n  }\n\n  incr() {\n    return ++(this.num);\n  }\n}\n\nexport * from \"module-export-02.mjs\"\n"
  },
  {
    "path": "tests/jerry/module-export-04.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport var x = 41\nexport default a = \"str\"\n"
  },
  {
    "path": "tests/jerry/module-export-05.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"module-export-01.mjs\";\nexport * from \"module-export-04.mjs\";\nexport default a = \"str\"\n"
  },
  {
    "path": "tests/jerry/module-export-06.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport {}\nexport {} from \"module-export-01.mjs\";\nexport {};\nexport {} from \"module-export-04.mjs\"\n"
  },
  {
    "path": "tests/jerry/module-export-07.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar y, z;\nexport default x = y = z = \"default\";\n"
  },
  {
    "path": "tests/jerry/module-export-08.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"./module-export-04.mjs\";\nexport let c = 5;\n"
  },
  {
    "path": "tests/jerry/module-export-09.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Test sorting order */\n\nexport let\n  c = 4,\n  bc = 3,\n  ddd = 6,\n  dddd = 7,\n  bb = 2,\n  dd = 5,\n  a = 1\n"
  },
  {
    "path": "tests/jerry/module-export-10.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Export the same namespace using two names */\nexport\n  * as ns1 from\n  \"./module-export-04.mjs\"\nexport * as\n  ns2\n  from \"./module-export-04.mjs\"\nexport *\n  as ns3 from \"./module-export-04.mjs\"\n\n/* Local bindings can have the same names as exports. */\nimport ns1, {x as ns2}\n  from \"./module-export-04.mjs\"\nlet ns3 = 9.5\n\nassert(ns1 === \"str\")\nassert(ns2 === 41)\nassert(ns3 === 9.5)\n"
  },
  {
    "path": "tests/jerry/module-export-default-1.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nlet counter = 0.1;\nexport default function* g() { return \"foo1\"; } counter++; /* test auto semicolon insertion */\nexport {counter};\n"
  },
  {
    "path": "tests/jerry/module-export-default-10.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport default function f() { return 1.5 }\nexport function g(v) { f = v; return \"X\" }\n"
  },
  {
    "path": "tests/jerry/module-export-default-2.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nlet counter = 1.1;\nexport default async function* g() { return \"foo2\"; } counter++; /* test auto semicolon insertion */\nexport {counter};\n"
  },
  {
    "path": "tests/jerry/module-export-default-3.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nlet counter = 2.1;\nexport default async function g() { return \"foo3\"; } counter++; /* test auto semicolon insertion */\nexport {counter};\n"
  },
  {
    "path": "tests/jerry/module-export-default-4.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar async = \"foo4\";\n\nexport default async;\n"
  },
  {
    "path": "tests/jerry/module-export-default-5.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport default _ => \"foo5\";\n"
  },
  {
    "path": "tests/jerry/module-export-default-6.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport default async _ => \"foo6\";\n"
  },
  {
    "path": "tests/jerry/module-export-default-7.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport default async (a, b) => a + b;\n"
  },
  {
    "path": "tests/jerry/module-export-default-8.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nlet counter = 7.1;\nexport default class A { static x = \"foo8\" } counter++; /* test auto semicolon insertion */\nexport {counter};\n"
  },
  {
    "path": "tests/jerry/module-export-default-9.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nlet counter = 8.1;\nexport default class { static x = \"foo9\" } counter++; /* test auto semicolon insertion */\nexport {counter};\n"
  },
  {
    "path": "tests/jerry/module-export-default-main.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport foo1, { counter as bar1 } from \"./module-export-default-1.mjs\"\nimport foo2, { counter as bar2 } from \"./module-export-default-2.mjs\"\nimport foo3, { counter as bar3 } from \"./module-export-default-3.mjs\"\nimport foo4 from \"./module-export-default-4.mjs\"\nimport foo5 from \"./module-export-default-5.mjs\"\nimport foo6 from \"./module-export-default-6.mjs\"\nimport foo7 from \"./module-export-default-7.mjs\"\nimport foo8, { counter as bar8 } from \"./module-export-default-8.mjs\"\nimport foo9, { counter as bar9 } from \"./module-export-default-9.mjs\"\nimport foo10, { g as bar10 } from \"./module-export-default-10.mjs\"\n\nlet async_queue_expected = [\"foo2\", \"foo3\", \"foo6\", \"foo7\"];\nlet async_queue = [];\n\n(function() {\n  assert(foo1().next().value === \"foo1\");\n  assert(bar1 === 1.1);\n})();\n\n(async function() {\n  async_queue.push((await foo2().next()).value);\n  assert(bar2 === 2.1);\n})();\n\n(async function() {\n  async_queue.push(await foo3());\n  assert(bar3 === 3.1);\n})();\n\n(function() {\n  assert(foo4 === \"foo4\");\n})();\n\n(function() {\n  assert(foo5() === \"foo5\");\n})();\n\n(async function() {\n  async_queue.push(await foo6());\n})();\n\n(async function() {\n  async_queue.push(await foo7(\"foo\", \"7\"));\n})();\n\n(function() {\n  assert(foo8.x === \"foo8\");\n  assert(bar8 === 8.1);\n})();\n\n(function() {\n  assert(foo9.x === \"foo9\");\n  assert(bar9 === 9.1);\n})();\n\n(function() {\n  var o = {}\n  assert(foo10() === 1.5);\n  assert(bar10(o) === \"X\");\n  assert(foo10 === o);\n})();\n\nArray.prototype.assertArrayEqual = function(expected) {\n  assert(this.length === expected.length);\n  print(this);\n  print(expected);\n\n  for (var i = 0; i < this.length; i++) {\n    assert(this[i] === expected[i]);\n  }\n}\n\nlet global = new Function('return this;')();\n\nglobal.__checkAsync = function() {\n  async_queue.assertArrayEqual(async_queue_expected);\n}\n"
  },
  {
    "path": "tests/jerry/module-export-fail-test.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This module is imported by failing tests. */\nexport let a;\n"
  },
  {
    "path": "tests/jerry/module-import-01.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport \"./module-export-01.mjs\";\nimport def from \"module-export-01.mjs\";\nimport {} from \"module-export-01.mjs\";\nimport {aa as a,} from \"module-export-01.mjs\";\nimport {bb as b, cc as c} from \"module-export-01.mjs\";\nimport {x} from \"module-export-01.mjs\";\nimport * as mod from \"module-export-01.mjs\";\n\nassert (def === \"default\");\nassert (a === \"a\");\nassert (b === 5);\nassert (c(b) === 10);\nassert (Array.isArray(mod.d))\nassert (x === 42)\nassert (mod.f(\"str\") === \"str\")\n\nvar dog = new mod.Dog(\"Oddie\")\nassert (dog.speak() === \"Oddie barks.\")\n"
  },
  {
    "path": "tests/jerry/module-import-02.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport def, * as mod from \"module-export-02.mjs\";\nimport {b_, c_,} from \"module-export-02.mjs\";\n\nassert (def() === \"default\")\nassert (mod.aa === \"a\")\nassert (b_ === 5)\nassert (c_(b_) === 10)\nassert (mod.x === 42)\nassert (Array.isArray(mod.d))\n"
  },
  {
    "path": "tests/jerry/module-import-03.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport incrementer, {aa, c_, x,} from \"module-export-03.mjs\"\nvar i = new incrementer(3);\nassert(i.incr() === 4);\nassert(i.incr() === 5);\nassert(i.incr() === 6);\n\nassert (aa === \"a\");\nassert (x === 42);\nassert (c_(x) == 84);\n"
  },
  {
    "path": "tests/jerry/module-import-04.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport \"module-import-01.mjs\";\nimport \"module-export-05.mjs\";\nimport \"module-export-06.mjs\";\nimport \"module-export-07.mjs\";\n"
  },
  {
    "path": "tests/jerry/module-import-05.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as f from \"./module-export-08.mjs\";\n\nassert (f.c === 5)\nassert (f.x === 41)\nassert (Object.getPrototypeOf(f) === null)\n\ntry {\n  Object.hasOwnProperty(f, \"default\")\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError)\n}\n\nObject.setPrototypeOf(f, null)\n\ntry {\n  Object.setPrototypeOf(f, {})\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError)\n}\n"
  },
  {
    "path": "tests/jerry/module-import-06.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as namespace from \"module-export-09.mjs\"\n\nassert(JSON.stringify(namespace) === '{\"a\":1,\"bb\":2,\"bc\":3,\"c\":4,\"dd\":5,\"ddd\":6,\"dddd\":7}')\n\ntry {\n  namespace = 8\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\ntry {\n  namespace += 8\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n"
  },
  {
    "path": "tests/jerry/module-import-07.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {ns1 as obj, ns2} from \"module-export-10.mjs\"\nimport {ns3} from \"module-export-10.mjs\"\n\nassert(typeof obj === \"object\")\nassert(obj === ns2)\nassert(obj === ns3)\n\nassert(obj.x === 41)\ntry {\n  obj.x = 42\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError)\n}\nassert(obj.x === 41)\n"
  },
  {
    "path": "tests/jerry/module-import-global.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport JSON, { counter as Object } from 'module-export-default-1.mjs'\n\n// Overwriting globals.\nassert(typeof JSON === \"function\")\nassert(Object === 1.1)\n\n// Globals are still available.\nassert(typeof globalThis.JSON === \"object\")\nassert(typeof globalThis.Object === \"function\")\n"
  },
  {
    "path": "tests/jerry/module-namespace-01.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as o from \"./module-namespace-02.mjs\"\nimport def from \"./module-namespace-02.mjs\"\n\nassert(o.default === 8.5)\nassert(def === 8.5)\n\nvar val = {}\n\nassert(o.a === 2.5);\nassert(o.b === undefined);\nassert(o.c(val) === \"c\")\nassert(o.d === \"d\")\n\nassert(o.a === val);\nassert(o.default === 8.5)\nassert(def === 8.5)\n"
  },
  {
    "path": "tests/jerry/module-namespace-02.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport def, {a} from \"./module-namespace-03.mjs\"\n/* Nothing is tracked, only the result value is exported. */\nexport default def\nexport {a}\n\nexport * from \"./module-namespace-03.mjs\"\nexport * from \"./module-namespace-04.mjs\"\n\nimport * as o1 from \"./module-namespace-03.mjs\"\nimport * as o2 from \"./module-namespace-04.mjs\"\n\nassert(def === 8.5)\nassert(o1.default === 8.5)\nassert(o2.default === undefined)\n"
  },
  {
    "path": "tests/jerry/module-namespace-03.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport var a = 2.5\nexport var b = 4\nexport var c = function(v) {\n  assert(def === 0);\n  a = v;\n  return \"c\"\n}\n\nvar def = 8.5\n/* Nothing is tracked, only the result value is exported. */\nexport default def\ndef = 0\n"
  },
  {
    "path": "tests/jerry/module-namespace-04.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport var a = 5\nexport var b = 6\nexport var d = \"d\"\n"
  },
  {
    "path": "tests/jerry/module-source-name-export.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport function getName() {\n  return sourceName();\n}\n\nexport function getNamePromise(collector) {\n  return new Promise((resolve) => { collector[\"start\"] = sourceName(); resolve(); })\n    .then(() => { collector[\"middle\"] = sourceName(); });\n}\n\n"
  },
  {
    "path": "tests/jerry/module-source-name.mjs",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { getName, getNamePromise } from \"./module-source-name-export.mjs\"\n\nassert(getName().endsWith(\"module-source-name-export.mjs\"));\n\nvar collector = {};\ngetNamePromise(collector).then(() => { collector[\"end\"] = sourceName(); });\n\nfunction __checkAsync() {\n  assert(collector[\"start\"].endsWith(\"module-source-name-export.mjs\"));\n  assert(collector[\"middle\"].endsWith(\"module-source-name-export.mjs\"));\n  assert(collector[\"end\"].endsWith(\"module-source-name.mjs\"));\n  assert(Object.keys(collector).length === 3);\n}\n"
  },
  {
    "path": "tests/jerry/nested-function.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f1()\n{\n  function f2()\n    {\n      assert(k > 0);\n      assert(i < 10000);\n\n      if(--k == 0)\n        {\n          return;\n        }\n\n      f2();\n    }\n\n  k = 17;\n\n  f2();\n}\n\nvar k;\nvar i;\n\nfor(i = 0; i < 100; i++)\n{\n  f1();\n}\n"
  },
  {
    "path": "tests/jerry/new-line-in-literal.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (eval (\"'1\\\\\\r\\n2'\") === '12');\n\nassert (eval (\"'1\\\\\\n2'\") === '12');\n"
  },
  {
    "path": "tests/jerry/new-target-async.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nasync function async_method () {\n    assert (new.target === undefined);\n}\n\nasync_method ();\n"
  },
  {
    "path": "tests/jerry/new-target-class.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass Simple {\n  constructor () {\n    assert (new.target === Simple);\n    this.called = 0;\n  }\n\n  get getter () {\n    this.called++;\n    return new.target;\n  }\n\n  set setter (val) {\n    assert (new.target === undefined);\n    this.called++;\n  }\n}\n\nvar smp = new Simple ();\nassert (smp.getter === undefined);\nassert (smp.called === 1);\nsmp.setter = -1;\nassert (smp.called === 2);\n\nclass BaseA {\n  constructor () {\n    assert (new.target === SubA);\n  }\n}\n\nclass SubA extends BaseA {\n  constructor () {\n    super ();\n    assert (new.target === SubA);\n  }\n}\n\nnew SubA ();\n\n/* TODO: enable if there is class name support. */\n/*\nclass Named {\n  constructor () {\n    assert(new.target.name == \"Named\");\n  }\n}\n\nnew Named ();\n*/\n"
  },
  {
    "path": "tests/jerry/new-target-error.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction F (){}\nvar obj = Reflect.construct (Error, [], F);\nobj[2] = 'foo';\nassert (obj instanceof F);\n\ntry {\n  Reflect.construct (Error, [-1], F);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\nvar o = new Proxy (function f () {}, { get (t,p,r) { if (p == \"prototype\") { throw \"34\" } Reflect.get (...arguments) }})\n\ntry {\n  Reflect.construct (Error, [], o)\n} catch (e) {\n  assert (e === \"34\");\n}\n"
  },
  {
    "path": "tests/jerry/new-target-for-boolean.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  Reflect.construct (Boolean, true);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.construct (Boolean, false);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nclass MyBoolean extends Boolean {};\nvar b1= new MyBoolean();\nassert(Object.getPrototypeOf(b1) == MyBoolean.prototype)\n"
  },
  {
    "path": "tests/jerry/new-target-for-containers.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar o = new Proxy (function f () {}, { get(t,p,r) { if (p == \"prototype\") { throw 42.1 } Reflect.get(...arguments) }})\n\ntry {\n  Reflect.construct (Map, [], o);\n  assert (false);\n} catch (e) {\n  assert(e == 42.1)\n}\n\ntry {\n  Reflect.construct (Set, [], o);\n  assert (false);\n} catch (e) {\n  assert(e == 42.1)\n}\n\ntry {\n  Reflect.construct (WeakMap, [], o);\n  assert (false);\n} catch (e) {\n  assert(e == 42.1)\n}\n\ntry {\n  Reflect.construct (WeakSet, [], o);\n  assert (false);\n} catch (e) {\n  assert(e == 42.1)\n}\n\ntry {\n  Reflect.construct (Map);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.construct (Set);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.construct (WeakMap);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.construct (WeakSet);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nclass MyMap extends Map {};\nclass MySet extends Set {};\nclass MyWeakMap extends WeakMap {};\nclass MyWeakSet extends WeakSet {};\nvar m1= new MyMap();\nvar s1= new MySet();\nvar wm1= new MyWeakMap();\nvar ws1= new MyWeakSet();\n\nassert(Object.getPrototypeOf(m1) == MyMap.prototype)\nassert(Object.getPrototypeOf(s1) == MySet.prototype)\nassert(Object.getPrototypeOf(wm1) == MyWeakMap.prototype)\nassert(Object.getPrototypeOf(ws1) == MyWeakSet.prototype)\n"
  },
  {
    "path": "tests/jerry/new-target-for-dataview.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n*     http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n//\nvar buffer = new ArrayBuffer (16);\ntry {\n Reflect.construct (DataView, [buffer], 4, 13);\n assert (false);\n} catch (e) {\n assert (e instanceof TypeError);\n}\n\ntry {\n Reflect.construct (DataView, [buffer], 1);\n assert (false);\n} catch (e) {\n assert (e instanceof TypeError);\n}\nclass MyDataView extends DataView {};\nvar d1 = new MyDataView(buffer);\n\nassert(Object.getPrototypeOf(d1) == MyDataView.prototype)\n"
  },
  {
    "path": "tests/jerry/new-target-for-date-object.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n*     http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\ntry {\n Reflect.construct (Date,);\n assert (false);\n} catch (e) {\n assert (e instanceof TypeError);\n}\n\ntry {\n Reflect.construct (Date, \"2015-01-01\");\n assert (false);\n} catch (e) {\n assert (e instanceof TypeError);\n}\n\ntry {\n Reflect.construct (Date, 1420070400000);\n assert (false);\n} catch (e) {\n assert (e instanceof TypeError);\n}\n\nclass MyDate extends Date {};\nvar d1= new MyDate();\n\nassert(Object.getPrototypeOf(d1) == MyDate.prototype)\n"
  },
  {
    "path": "tests/jerry/new-target-for-number.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  Reflect.construct (Number);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.construct (Number, 1);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nclass MyNumber extends Number {};\nvar n1= new MyNumber();\n\nassert(Object.getPrototypeOf(n1) == MyNumber.prototype)\n"
  },
  {
    "path": "tests/jerry/new-target-for-string.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n try {\n  Reflect.construct (String, \"\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.construct (String, \"randomText\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nclass MyString extends String {};\nvar s1= new MyString();\n\nassert(Object.getPrototypeOf(s1) == MyString.prototype)\n"
  },
  {
    "path": "tests/jerry/new-target-for-typedarray-and-arraybuffer.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass MyInt32Array extends Int32Array {};\nvar t1= new MyInt32Array([1,2]);\n\nassert(Object.getPrototypeOf(t1) == MyInt32Array.prototype)\n\n\nclass MyArrayBuffer extends ArrayBuffer {};\nvar t2= new MyArrayBuffer(8);\n\nassert(Object.getPrototypeOf(t2) == MyArrayBuffer.prototype)\n"
  },
  {
    "path": "tests/jerry/new-target-generator.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction *demo_gen () {\n    for (var idx = 0; idx < 3; idx++)\n    {\n      assert (new.target === undefined);\n      yield idx;\n      assert (new.target === undefined);\n    }\n}\n\nvar gen = demo_gen ();\n\nvar value = 0;\nfor (var item of gen)\n{\n  value = item;\n}\n\nassert (value === 2);\n"
  },
  {
    "path": "tests/jerry/new-target.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction null_target () {\n  assert (new.target === undefined);\n}\n\nfunction demo () {\n  null_target ();\n  return new.target;\n}\n\nassert (demo () === undefined);\nassert ((new demo ()) === demo);\n\n/* new.target is only valid inside functions */\ntry {\n  eval (\"new.target\");\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof SyntaxError);\n}\n\ntry {\n  var eval_other = eval;\n  eval_other (\"new.target\");\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof SyntaxError);\n}\n\n/* test with arrow function */\nvar arrow_called = false;\nfunction arrow () {\n    assert (new.target === arrow);\n    var mth = () => { return new.target; }\n    assert (mth () === arrow);\n    arrow_called = true;\n}\n\nnew arrow ();\nassert (arrow_called === true);\n\n/* test unary operation */\nvar f_called = false;\nfunction f () {\n  assert (isNaN (-new.target));\n  f_called = true;\n}\n\nnew f ();\nassert (f_called === true);\n\n/* test property access */\nfunction fg (callback_object) {\n  callback_object.value = new.target.value;\n}\n\nfg.value = 22;\n\nvar test_obj = {};\nnew fg (test_obj);\n\nassert (test_obj.value === 22);\n\n\n/* test new.target with eval */\nfunction eval_test () {\n  var target = eval (\"new.target\");\n  assert (target === eval_test);\n}\n\nnew eval_test ();\n\nfunction eval_eval_test () {\n  var target = eval ('eval(\"new.target\")');\n  assert (target === eval_eval_test);\n}\n\nnew eval_eval_test ();\n\n/* new.target is only valid in direct eval */\nfunction eval_test_2 () {\n  var ev = eval;\n  try {\n    ev (\"new.target\");\n    assert (false);\n  } catch (ex) {\n    assert (ex instanceof SyntaxError);\n  }\n}\n\nnew eval_test_2 ();\n\nfunction eval_test_3 () {\n  var ev = eval;\n  try {\n    eval (\"ev ('new.target')\");\n    assert (false);\n  } catch (ex) {\n    assert (ex instanceof SyntaxError);\n  }\n}\n\nnew eval_test_3 ();\n\n/* test assignment of the \"new.target\" */\nfunction expect_syntax_error (src)\n{\n  try {\n    eval (src);\n    assert (false);\n  } catch (ex) {\n    assert (ex instanceof SyntaxError);\n  }\n}\n\nexpect_syntax_error (\"function assign () { new.target = 3; }\");\nexpect_syntax_error (\"function assign () { new.target += 3; }\");\nexpect_syntax_error (\"function assign () { new.target *= 3; }\");\nexpect_syntax_error (\"function assign () { new.target -= 3; }\");\nexpect_syntax_error (\"function assign () { new.target |= 3; }\");\nexpect_syntax_error (\"function assign () { new.target &= 3; }\");\n\nexpect_syntax_error (\"function assign () { new.target++; }\");\nexpect_syntax_error (\"function assign () { ++new.target; }\");\nexpect_syntax_error (\"function assign () { new.target--; }\");\nexpect_syntax_error (\"function assign () { --new.target; }\");\n\nexpect_syntax_error (\"function synt () { new....target; }\");\n\nfunction delete_test () {\n  assert ((delete new.target) === true);\n}\n\nnew delete_test ();\n\nfunction binary_test_1 () {\n    /*/ new.target is converted to string */\n    var str = (new.target + 1);\n    assert (str.substring(0, 8) === \"function\"\n            && str.substring(str.length - 2, str.length) === \"}1\");\n}\nfunction binary_test_2 () { assert (isNaN (new.target - 3)); }\nfunction binary_test_3 () { assert (isNaN (new.target * 2)); }\nfunction binary_test_4 () { assert (isNaN (new.target / 4)); }\n\nnew binary_test_1 ();\nnew binary_test_2 ();\nnew binary_test_3 ();\nnew binary_test_4 ();\n"
  },
  {
    "path": "tests/jerry/nullish-coalescing.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//basic valid cases with logical operator\nassert((1 ?? 2) == 1)\nassert((0 ?? 2) == 0)\nassert(null ?? 2 == 2)\nassert(null ?? undefined == undefined)\nassert(null ?? undefined ?? 2 == 2)\nassert(null ?? undefined ?? null ?? 10  == 10)\nassert(null ?? (undefined || null) ?? 10  == 10)\nassert(null ?? (undefined && null) ?? 10  == 10)\nassert((null ?? true) && (true ?? null) == true)\n\n//cannot evulate the right expression if left is not null or undefined\nfunction poison () {\n  throw 23;\n}\nassert(true ?? poison ())\nassert(null ?? null ?? true ?? poison ())\n\nfunction checkSyntax (str) {\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\n// invalid use cases\nvar headNullish1 = \"(null ?? null || null )\";\nvar headNullish2 = \"(null ?? null && null )\";\nvar tailNullish1 = \"(null || null ?? null )\";\nvar tailNullish2 = \"(null || null ?? null )\";\n\ncheckSyntax (headNullish1);\ncheckSyntax (headNullish2);\ncheckSyntax (tailNullish1);\ncheckSyntax (tailNullish2);\n"
  },
  {
    "path": "tests/jerry/number-constants.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//This test will not pass on FLOAT32 due to precision issues\n\nassert(Number.MAX_SAFE_INTEGER === 9007199254740991);\nassert(Number.MIN_SAFE_INTEGER === -9007199254740991);\nassert(Number.EPSILON === 2.2204460492503130808472633361816e-16);\n"
  },
  {
    "path": "tests/jerry/number-isfinite.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Number['isFinite'] (Infinity) === false);\nassert(Number['isFinite'] (-Infinity) === false);\nassert(Number['isFinite'] (NaN) === false);\nassert(Number['isFinite'] (0) === true);\nassert(Number['isFinite'] (2e64) === true);\n"
  },
  {
    "path": "tests/jerry/number-isinteger.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Number['isInteger'] ('valami') === false);\nassert(Number['isInteger'] (NaN) === false);\nassert(Number['isInteger'] (Infinity) === false);\nassert(Number['isInteger'] (-Infinity) === false);\nassert(Number['isInteger'] (3.5) === false);\nassert(Number['isInteger'] (-100000) === true);\nassert(Number['isInteger'] (5.0000000000000001) === true);\n"
  },
  {
    "path": "tests/jerry/number-isnan.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Number['isNaN'] ('valami') === false);\nassert(Number['isNaN'] (NaN) === true);\nassert(Number['isNaN'] (1) === false);\nassert(Number['isNaN'] (Number.NaN) === true);\nassert(Number['isNaN'] (0 / 0) === true);\n"
  },
  {
    "path": "tests/jerry/number-issafeinteger.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Number['isSafeInteger'] (Math.pow(2, 53)) === false);\nassert(Number['isSafeInteger'] (Math.pow(2, 53) - 1) === true);\nassert(Number['isSafeInteger'] (NaN) === false);\nassert(Number['isSafeInteger'] (-3.0) === true);\nassert(Number['isSafeInteger'] (Infinity) === false);\nassert(Number['isSafeInteger'] (3.5) === false);\n"
  },
  {
    "path": "tests/jerry/number-methods.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (Number.parseInt ('18528769') === 18528769);\nassert (Number.parseFloat ('1.2e3') === 1.2e3);\nassert (parseInt ('18528769') === 18528769);\nassert (parseFloat ('1.2e3') === 1.2e3);\n\nassert(Number.parseInt === parseInt);\n\nassert(Number.parseFloat === parseFloat);\n"
  },
  {
    "path": "tests/jerry/number-prototype-to-exponential.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//This test will not pass on FLOAT32 due to precision issues\n\nassert((123.56).toExponential() === \"1.2356e+2\");\nassert((123.56).toExponential(0) === \"1e+2\");\nassert((123.56).toExponential(1) === \"1.2e+2\");\nassert((123.56).toExponential(5) === \"1.23560e+2\");\nassert((-1.23).toExponential(1) === \"-1.2e+0\");\nassert((0.00023).toExponential(0) === \"2e-4\");\nassert((0.356).toExponential(1) === \"3.6e-1\");\nassert((0.0000356).toExponential(2) === \"3.56e-5\");\nassert((0.000030056).toExponential(2) === \"3.01e-5\");\nassert(Infinity.toExponential(0) === \"Infinity\");\nassert((-Infinity).toExponential(0) === \"-Infinity\");\nassert(NaN.toExponential(0) === \"NaN\");\nassert((0.0).toExponential(0) === \"0e+0\");\nassert((0.0).toExponential(1) === \"0.0e+0\");\nassert((-0.0).toExponential(0) === \"0e+0\");\nassert((-0.0).toExponential(1) === \"0.0e+0\");\nassert((123456789012345678901.0).toExponential(20) === \"1.23456789012345680000e+20\");\nassert((123456789012345678901.0).toExponential(\"6\") === \"1.234568e+20\");\nassert((123.45).toExponential(3.2) === \"1.235e+2\");\nassert((123.45).toExponential(-0.1) === \"1e+2\");\nassert((12).toExponential(21) === \"1.200000000000000000000e+1\")\n\ntry {\n    (12).toExponential(Number.MAX_VALUE);\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError)\n}\n\ntry {\n    (12).toExponential(Infinity);\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError)\n}\n\ntry {\n    (12).toExponential(-1);\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError)\n}\n\ntry {\n    Number.prototype.toExponential.call(new Object());\n    assert(false);\n} catch (e) {\n    assert(e instanceof TypeError)\n}\n"
  },
  {
    "path": "tests/jerry/number-prototype-to-fixed.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//This test will not pass on FLOAT32 due to precision issues\n\nassert((123.56).toFixed() === \"124\");\nassert((123.56).toFixed(0) === \"124\");\nassert((123.56).toFixed(1) === \"123.6\");\nassert((123.56).toFixed(5) === \"123.56000\");\nassert((1.23e-10).toFixed(2) === \"0.00\");\nassert((1.23e+20).toFixed(2) === \"123000000000000000000.00\");\nassert((1.23e+21).toFixed(2) === \"1.23e+21\");\nassert((-1.23).toFixed(1) === \"-1.2\");\nassert((0.00023).toFixed(0) === \"0\");\nassert((0.356).toFixed(2) === \"0.36\");\nassert((0.0000356).toFixed(5) === \"0.00004\");\nassert((0.000030056).toFixed(7) === \"0.0000301\");\nassert(Infinity.toFixed(0) === \"Infinity\");\nassert((-Infinity).toFixed(0) === \"-Infinity\");\nassert(NaN.toFixed(0) === \"NaN\");\nassert((0.0).toFixed(0) === \"0\");\nassert((0.0).toFixed(1) === \"0.0\");\nassert((-0.0).toFixed(0) === \"0\");\nassert((-0.0).toFixed(1) === \"0.0\");\nassert((123.56).toFixed(NaN) === \"124\");\nassert((123.56).toFixed(-0.9) === \"124\");\nassert((0.095).toFixed(2) === \"0.10\");\nassert((0.995).toFixed(2) === \"1.00\")\nassert((9.995).toFixed(2) === \"10.00\");\nassert((7.995).toFixed(2) === \"8.00\");\nassert((8.995).toFixed(2) === \"9.00\");\nassert((99.995).toFixed(2) === \"100.00\");\nassert((12).toFixed(21) === \"12.000000000000000000000\");\nassert((-1111111111111111111111.12).toFixed(3) === \"-1.1111111111111111e+21\");\nassert((1111111111111111111111.12).toFixed(3) === \"1.1111111111111111e+21\");\n\ntry {\n    Number.prototype.toExponential.call(new Object());\n    assert(false);\n} catch (e) {\n    assert(e instanceof TypeError)\n}\n\ntry {\n    (12).toFixed(-1);\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError)\n}\n\nassert ((0.5).toFixed(0) === \"1\");\nassert ((1.5).toFixed(0) === \"2\");\nassert ((12.5).toFixed(0) === \"13\");\nassert ((123.5).toFixed(0) === \"124\");\nassert ((1234.5).toFixed(0) === \"1235\");\nassert ((0.567).toFixed(0) === \"1\");\nassert ((1.567).toFixed(0) === \"2\");\nassert ((12.567).toFixed(0) === \"13\");\nassert ((123.567).toFixed(0) === \"124\");\nassert ((1234.567).toFixed(0) === \"1235\");\n\nassert ((1.2567).toFixed(0) === \"1\");\nassert ((1.2567).toFixed(1) === \"1.3\");\nassert ((1.2567).toFixed(2) === \"1.26\");\nassert ((1.2567).toFixed(3) === \"1.257\");\nassert ((1.2567).toFixed(4) === \"1.2567\");\nassert ((1.2567).toFixed(5) === \"1.25670\");\n\nassert ((12.3567).toFixed(0) === \"12\");\nassert ((12.3567).toFixed(1) === \"12.4\");\nassert ((12.3567).toFixed(2) === \"12.36\");\nassert ((12.3567).toFixed(3) === \"12.357\");\nassert ((12.3567).toFixed(4) === \"12.3567\");\nassert ((12.3567).toFixed(5) === \"12.35670\");\n\nassert ((123.4567).toFixed(0) === \"123\");\nassert ((123.4567).toFixed(1) === \"123.5\");\nassert ((123.4567).toFixed(2) === \"123.46\");\nassert ((123.4567).toFixed(3) === \"123.457\");\nassert ((123.4567).toFixed(4) === \"123.4567\");\nassert ((123.4567).toFixed(5) === \"123.45670\");\n"
  },
  {
    "path": "tests/jerry/number-prototype-to-precision.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//This test will not pass on FLOAT32 due to precision issues\n\nassert((123.56).toPrecision() === \"123.56\");\nassert((123.56).toPrecision(1) === \"1e+2\");\nassert((123.56).toPrecision(2) === \"1.2e+2\");\nassert((123.56).toPrecision(6) === \"123.560\");\nassert((-1.23).toPrecision(1) === \"-1\");\nassert((0.00023).toPrecision(1) === \"0.0002\");\nassert((0.356).toPrecision(2) === \"0.36\");\nassert((0.0000356).toPrecision(5) === \"0.000035600\");\nassert((0.000030056).toPrecision(4) === \"0.00003006\");\nassert(Infinity.toPrecision(1) === \"Infinity\");\nassert((-Infinity).toPrecision(1) === \"-Infinity\");\nassert(NaN.toPrecision(1) === \"NaN\");\nassert((0.0).toPrecision(1) === \"0\");\nassert((-0.0).toPrecision(1) === \"0\");\nassert((0.0).toPrecision(6) === \"0.00000\");\nassert((123456789012345678901.0).toPrecision(20) === \"1.2345678901234568000e+20\");\nassert((123456789012345678901.0).toPrecision(21) === \"123456789012345680000\");\nassert((123456789012345678901.0).toPrecision(\"6\") === \"1.23457e+20\");\nassert((0.0000004).toPrecision(2) === \"4.0e-7\");\nassert((0.000004).toPrecision(2) === \"0.0000040\");\nassert((1234.92).toPrecision(4) === \"1235\");\nassert((1234.92).toPrecision(3) === \"1.23e+3\");\n\nassert((123.56).toPrecision(1.3) === \"1e+2\");\nassert((123.56).toPrecision(21.9) === \"123.560000000000000000\");\nassert((12).toPrecision(22) === \"12.00000000000000000000\")\n\nassert(Number(982).toPrecision(1) === \"1e+3\");\nassert(Number(982).toPrecision(2) === \"9.8e+2\");\nassert(Number(1499).toPrecision(1) === \"1e+3\");\nassert(Number(1500).toPrecision(1) === \"2e+3\");\n\ntry {\n    (12).toPrecision(0);\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError)\n}\n\ntry {\n    Number.prototype.toExponential.call(new Object());\n    assert(false);\n} catch (e) {\n    assert(e instanceof TypeError)\n}\n\n\nassert((+Infinity).toPrecision(1000) === \"Infinity\");\nvar n = new Number(+Infinity);\nassert(n.toPrecision(1000) === \"Infinity\");\n\nassert((-Infinity).toPrecision(1000) === \"-Infinity\");\nvar n = new Number(-Infinity);\nassert(n.toPrecision(1000) === \"-Infinity\");\n\nassert(NaN.toPrecision(undefined) === \"NaN\");\n  \nvar calls = 0;\n\nvar p = {\n  valueOf: function() {\n    calls++;\n\treturn Infinity;\n  }\n};\n\nassert(NaN.toPrecision(p) === \"NaN\");\nassert(calls === 1);\n\nvar n = new Number(NaN);\ncalls = 0;\nassert(n.toPrecision(p) === \"NaN\");\nassert(calls === 1);\n"
  },
  {
    "path": "tests/jerry/number-prototype-to-string.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// This test will not pass on FLOAT32 due to precision issues\n\nassert((NaN).toString() === \"NaN\");\nassert((-Infinity).toString() === \"-Infinity\");\nassert((Infinity).toString() === \"Infinity\");\nassert((NaN).toString(6) === \"NaN\");\nassert((-Infinity).toString(7) === \"-Infinity\");\nassert((Infinity).toString(8) === \"Infinity\");\nassert((16).toString(16) === \"10\");\nassert((15).toString(16) === \"f\");\nassert((12.5).toString(4) === \"30.2\");\nassert((0.005).toString(4) === \"0.000110132232011013223201101323\");\nassert((2000).toString(4) === \"133100\");\nassert((2000).toString(3) === \"2202002\");\nassert((2000).toString(16) === \"7d0\");\nassert((0.03125).toString(2) === \"0.00001\");\nassert((0.03125).toString(16) === \"0.08\");\nassert((0.0001).toString(4) === \"0.000000122031232023223013010030231\")\nassert((0).toString(16) === \"0\");\nassert((-16).toString(16) === \"-10\");\nassert((-15).toString(16) === \"-f\");\nassert((-12.5).toString(4) === \"-30.2\");\nassert((-0.005).toString(4) === \"-0.000110132232011013223201101323\");\nassert((-2000).toString(4) === \"-133100\");\nassert((-2000).toString(3) === \"-2202002\");\nassert((-2000).toString(16) === \"-7d0\");\nassert((-0.03125).toString(2) === \"-0.00001\");\nassert((-0.03125).toString(16) === \"-0.08\");\nassert((-0.0001).toString(4) === \"-0.000000122031232023223013010030231\")\nassert((-0).toString(16) === \"0\");\nassert((1e+73).toString(35) === \"2nx1mg1l0w6b000000000000000000000000000000000000\")\nassert((-1e+73).toString(35) === \"-2nx1mg1l0w6b000000000000000000000000000000000000\")\nassert((1).toString(undefined) === \"1\")\n\nassert((123400).toString(2) === \"11110001000001000\");\nassert((123400).toString(3) === \"20021021101\");\nassert((123400).toString(4) === \"132020020\");\nassert((123400).toString(5) === \"12422100\");\nassert((123400).toString(6) === \"2351144\");\nassert((123400).toString(7) === \"1022524\");\nassert((123400).toString(8) === \"361010\");\nassert((123400).toString(9) === \"207241\");\nassert((123400).toString(10) === \"123400\");\nassert((123400).toString(11) === \"84792\");\nassert((123400).toString(12) === \"5b4b4\");\nassert((123400).toString(13) === \"44224\");\nassert((123400).toString(14) === \"32d84\");\nassert((123400).toString(15) === \"2686a\");\nassert((123400).toString(16) === \"1e208\");\nassert((123400).toString(17) === \"181ge\");\nassert((123400).toString(18) === \"132fa\");\nassert((123400).toString(19) === \"hife\");\nassert((123400).toString(20) === \"f8a0\");\nassert((123400).toString(21) === \"d6h4\");\nassert((123400).toString(22) === \"bcl2\");\nassert((123400).toString(23) === \"a365\");\nassert((123400).toString(24) === \"8m5g\");\nassert((123400).toString(25) === \"7mb0\");\nassert((123400).toString(26) === \"70e4\");\nassert((123400).toString(27) === \"677a\");\nassert((123400).toString(28) === \"5hb4\");\nassert((123400).toString(29) === \"51l5\");\nassert((123400).toString(30) === \"4h3a\");\nassert((123400).toString(31) === \"44ck\");\nassert((123400).toString(32) === \"3og8\");\nassert((123400).toString(33) === \"3ead\");\nassert((123400).toString(34) === \"34pe\");\nassert((123400).toString(35) === \"2upp\");\nassert((123400).toString(36) === \"2n7s\");\n\nassert ((1152921504606846600).toString([1,2,3,4].slice(1,2)) === \"111111111111111111111111111111111111111111111111111010000000\");\nassert ((-1152921504606846600).toString(2) === \"-111111111111111111111111111111111111111111111111111010000000\");\n\nassert ((0x100000000000061).toString(2) === \"100000000000000000000000000000000000000000000000001100000\")\nassert ((-0x100000000000061).toString(16) === \"-100000000000060\");\n\nassert((123400).toString(new Number(16)) === \"1e208\");\n\nassert(65535.9.toString(3) === \"10022220020.220022002200220022002201\");\n\nvar digit_chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9',\n                   'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',\n                   'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',\n                   'u', 'v', 'w', 'x', 'y', 'z'];\n\nfor (radix = 2; radix <= 36; radix++) {\n  for (num = 1; num < 100; num++) {\n    var value = num;\n    var str = \"\";\n    while (value > 0) {\n      str = digit_chars[value % radix] + str;\n      value = Math.floor(value / radix);\n    }\n\n    assert(str === (num).toString(radix));\n  }\n}\n\ntry {\n  assert((123).toString(1));\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\ntry {\n  assert((123).toString(37));\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\ntry {\n  assert((123).toString(Infinity));\n  assert(false)\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/numeric-separator.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\n// few valid numeric separators\nassert (1_1 == 11)\nassert (0x11_11 == 4369)\nassert (0b11_11 == 15)\nassert (0o11_11 == 585)\nassert (1_1n == 11n)\nassert (100_001.11_00 == 100001.11)\nassert (0x11_11n == 4369n)\n\n// checker functions\n\nfunction invalid_numeric_separator (expression)\n{\n  try {\n    var a = eval (expression)\n    assert (false)\n  } catch (e) {\n    assert (true)\n  }\n}\n\n// few invalid numeric separators\ninvalid_numeric_separator (\"_1_1\")\ninvalid_numeric_separator (\"1__1\")\ninvalid_numeric_separator (\"1_1_n\")\ninvalid_numeric_separator (\"1_1n_\")\ninvalid_numeric_separator (\"0b_11\")\ninvalid_numeric_separator (\"0x_11\")\ninvalid_numeric_separator (\"0o_11\")\ninvalid_numeric_separator (\"0_0.123\")\n"
  },
  {
    "path": "tests/jerry/object-assign.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar object1 = {\n  a: 1,\n  b: 2,\n  c: 3\n};\n\nvar object2 = Object.assign ({c: 4, d: 5}, object1);\n\nassert (JSON.stringify (object2) === '{\"c\":3,\"d\":5,\"a\":1,\"b\":2}');\nassert (object2.c === 3);\nassert (object2.d === 5);\n\n// Cloning an object\nvar obj = { a: 1 };\nvar copy = Object.assign ({}, obj);\nassert (JSON.stringify (copy) === '{\"a\":1}'); // { a: 1 }\n\n// Warning for Deep Clone\nfunction deepClone() {\n  'use strict';\n\n  var obj1 = { a: 0 , b: { c: 0}};\n  var obj2 = Object.assign ({}, obj1);\n  assert (JSON.stringify (obj2) === '{\"a\":0,\"b\":{\"c\":0}}');\n\n  obj1.a = 1;\n  assert (JSON.stringify (obj1) === '{\"a\":1,\"b\":{\"c\":0}}');\n  assert (JSON.stringify (obj2) === '{\"a\":0,\"b\":{\"c\":0}}');\n\n  obj2.a = 2;\n  assert (JSON.stringify (obj1) === '{\"a\":1,\"b\":{\"c\":0}}');\n  assert (JSON.stringify (obj2) === '{\"a\":2,\"b\":{\"c\":0}}');\n\n  obj2.b.c = 3;\n  assert (JSON.stringify (obj1) === '{\"a\":1,\"b\":{\"c\":3}}');\n  assert (JSON.stringify (obj2) === '{\"a\":2,\"b\":{\"c\":3}}');\n\n  // Deep Clone\n  obj1 = { a: 0 , b: { c: 0}};\n  var obj3 = JSON.parse (JSON.stringify (obj1));\n  obj1.a = 4;\n  obj1.b.c = 4;\n  assert (JSON.stringify (obj3) === '{\"a\":0,\"b\":{\"c\":0}}');\n}\n\ndeepClone();\n\n// Merging objects\nvar o1 = { a: 1 };\nvar o2 = { b: 2 };\nvar o3 = { c: 3 };\n\nvar obj = Object.assign (o1, o2, o3);\nassert (JSON.stringify (obj) === '{\"a\":1,\"b\":2,\"c\":3}');\nassert (JSON.stringify (o1) === '{\"a\":1,\"b\":2,\"c\":3}');  //target object itself is changed.\n\n//Merging objects with same properties\nvar o1 = { a: 1, b: 1, c: 1 };\nvar o2 = { b: 2, c: 2 };\nvar o3 = { c: 3 };\n\nvar obj = Object.assign ({}, o1, o2, o3);\nassert (JSON.stringify (obj) === '{\"a\":1,\"b\":2,\"c\":3}');\n\n// Properties on the prototype chain and non-enumerable properties cannot be copied\nvar obj = Object.create({ foo: 1 }, { // foo is on obj's prototype chain.\n  bar: {\n    value: 2  // bar is a non-enumerable property.\n  },\n  baz: {\n    value: 3,\n    enumerable: true  // baz is an own enumerable property.\n  }\n});\n\nvar copy = Object.assign ({}, obj);\nassert (JSON.stringify (copy) === '{\"baz\":3}');\n\n// Primitives will be wrapped to objects\nvar v1 = 'abc';\nvar v2 = true;\nvar v3 = 10;\n\nvar obj = Object.assign ({}, v1, null, v2, undefined, v3);\n// Primitives will be wrapped, null and undefined will be ignored.\n// Note, only string wrappers can have own enumerable properties.\nassert (JSON.stringify (obj) === '{\"0\":\"a\",\"1\":\"b\",\"2\":\"c\"}');\n\n//Exceptions will interrupt the ongoing copying task\nvar target = Object.defineProperty ({}, 'foo', {\n  value: 1,\n  writable: false\n}); // target.foo is a read-only property\n\ntry {\n  // TypeError: \"foo\" is read-only,the Exception is thrown when assigning target.foo\n  Object.assign (target, { bar: 2 }, { foo2: 3, foo: 3, foo3: 3 }, { baz: 4 });\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (target.bar === 2);  // the first source was copied successfully.\nassert (target.foo2 === 3); // the first property of the second source was copied successfully.\nassert (target.foo === 1);  // exception is thrown here.\nassert (target.foo3 === undefined); // assign method has finished, foo3 will not be copied.\nassert (target.baz === undefined);  // the third source will not be copied either.\n\n// Copying accessors\nvar obj = {\n  foo: 1,\n  get bar() {\n    return 2;\n  }\n};\n\nvar copy = Object.assign ({}, obj);\nassert (JSON.stringify (copy) === '{\"foo\":1,\"bar\":2}');\nassert (copy.bar === 2); // the value of copy.bar is obj.bar's getter's return value.\n\n// This is an assign function that copies full descriptors\nfunction completeAssign (target, sources) {\n  sources.forEach (source => {\n    var descriptors = Object.keys (source).reduce ((descriptors, key) => {\n      descriptors[key] = Object.getOwnPropertyDescriptor (source, key);\n      return descriptors;\n    }, {});\n\n    Object.defineProperties (target, descriptors);\n  });\n  return target;\n}\n\nvar copy = completeAssign ({}, [obj]);\nassert (JSON.stringify (copy) === '{\"foo\":1,\"bar\":2}');\nassert (copy.bar === 2);\n\n// Test when target is not coercible to object\ntry {\n  Object.assign.call (undefined);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError)\n}\n\nvar asd = Symbol (\"asd\");\nvar foo = Symbol (\"foo\");\nvar bar = Symbol (\"bar\");\nvar obj = {1: 5, \"a\": 6, [foo]: 7, [asd]: 8, [bar]: 9};\nvar result = Object.assign ({}, obj);\nassert (result[foo] == 7);\nassert (result[asd] == 8);\nassert (result[bar] == 9);\n\nobj = {}\nassert(Object.assign(obj, { a:1, b:undefined, get c() {}, set d(v) {}}) == obj);\nassert(Object.getOwnPropertyDescriptor(obj, \"a\").enumerable);\nassert(Object.getOwnPropertyDescriptor(obj, \"b\").enumerable);\nassert(Object.getOwnPropertyDescriptor(obj, \"c\").enumerable);\nassert(Object.getOwnPropertyDescriptor(obj, \"d\").enumerable);\n"
  },
  {
    "path": "tests/jerry/object-computed-prescanner.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction member_str() {\n  return \"member\";\n}\n\nswitch (true) {\ndefault:\n  var obj = {\n    [\"val\" + \"ue\"]: 0,\n    set[member_str()](x) {\n      // Multiple statements.\n      this.value = x + 4;\n      this.value += 2;\n    },\n    get[member_str() ? member_str() : \"\"]() {\n      // Multiple statements.\n      this.value = this.value + 1;\n      return this.value;\n    },\n    get\n      [1 + 2]\n      ()\n    {\n      return 3;\n    },\n    [false ? member_str()\n           : \"\"]\n     :8\n  }\n}\n\nobj[\"member\"] = 10;\nassert(obj.member === 17);\nassert(obj.member === 18);\n\nassert(obj[3] === 3);\nassert(obj[\"3\"] === 3);\n\nassert(obj[\"\"] === 8);\n"
  },
  {
    "path": "tests/jerry/object-computed.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Test object literals. */\n\nvar local = 0;\n\nfunction f(x)\n{\n  return x + \"et\";\n}\n\nvar o = {\n  a: 5,\n  [\n    \"pr\" +\n    \"op\"]  : 6,\n\n  [f\n   (\"g\")\n   ]\n   : 7,\n\n  [f(\n   \"s\"\n   )  ]: 8,\n\n  get    [f\n    (\"res\")\n    ]\n    () { return 9 },\n\n  set\n  [f(\"res\")](\n   value) { local = value },\n};\n\nassert(o.a === 5);\nassert(o.prop === 6);\nassert(o.get === 7);\nassert(o.set === 8);\n\nlocal = 0;\no.reset = 10;\nassert(local === 10);\nassert(o.reset === 9);\n\n/* Test classes. */\n\nfunction fxy() {\n  return \"xy\";\n}\n\nclass C {\n  [fxy()] () {\n    return 6;\n  }\n\n  static [fxy()]() {\n    return 7;\n  }\n\n  get [\"a\" + 1]() {\n    return 8;\n  }\n\n  set [\"a\" + 1](x) {\n    local = x;\n  }\n\n  static get [\"a\" + 1]() {\n    return 10;\n  }\n\n  static set [\"a\" + 1](x) {\n    local = x;\n  }\n};\n\nvar c = new C;\nassert(c.xy() === 6);\nassert(C.xy() === 7);\n\nlocal = 0;\nc.a1 = 9;\nassert(local === 9);\nassert(c.a1 === 8);\n\nlocal = 0;\nC.a1 = 11;\nassert(local === 11);\nassert(C.a1 === 10);\n\nclass D {\n  [(() => \"const\" + \"ructor\")()] (arg) {\n    this.a = arg;\n  }\n}\n\nvar d = new D;\nassert(d.a === undefined);\nd.constructor(7);\nassert(d.a === 7);\n\nclass E {\n  get [\"_constructor_\".substring(1,12)]() {\n    return this.a;\n  }\n}\n\nvar e = new E;\nassert(e.constructor === undefined);\ne.a = 8;\nassert(e.constructor === 8);\n\nfunction throw_error(snippet)\n{\n  try {\n    eval(snippet);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n}\n\nthrow_error(\"new class { static ['proto' + 'type'] () {} }\");\nthrow_error(\"new class { static get ['proto' + 'type'] () {} }\");\nthrow_error(\"new class { static set ['proto' + 'type'] (x) {} }\");\n"
  },
  {
    "path": "tests/jerry/object-copy-data.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction checkOwnProperties(obj, propList)\n{\n  names = Object.getOwnPropertyNames(obj)\n  assert(names.length === propList.length)\n\n  for (var i = 0; i < propList.length; ++i)\n  {\n    assert(names[i] === propList[i])\n\n    var descriptor = Object.getOwnPropertyDescriptor(obj, names[i])\n    assert(descriptor.writable == true && descriptor.get === undefined && descriptor.set === undefined);\n  }\n}\n\nvar o = {...\"a\" + \"bc\"}\n\nassert(o[0] === \"a\")\nassert(o[1] === \"b\")\nassert(o[2] === \"c\")\ncheckOwnProperties(o, [\"0\", \"1\", \"2\"])\n\ns = { a:3.5, b() {}, get c() { return \"Prop\" } }\no = {...null, ...undefined, ...s}\n\nassert(o.a === 3.5)\nassert(o.b === s.b)\nassert(o.c === \"Prop\")\ncheckOwnProperties(o, [\"a\", \"b\", \"c\"])\n\ns = { a:\"X\", b:-1.25, c:\"Str\" }\no = { get a() {}, set b(v) {}, ...s, c() { return 1 }}\n\nassert(o.a === \"X\")\nassert(o.b === -1.25)\nassert(o.c() === 1)\ncheckOwnProperties(o, [\"a\", \"b\", \"c\"])\n\ns = { p1:[1,2], \"(a)\":\"Msg\" }\nObject.defineProperty(s, 'nonEnumerable', { value: 8.75, writable: true, enumerable:false });\nassert(s.nonEnumerable === 8.75)\n\no = { ...s, \"p!\":5, ...s, ...s }\nassert(o.p1 === s.p1)\nassert(o[\"(a)\"] === \"Msg\")\nassert(o[\"p!\"] === 5)\ncheckOwnProperties(o, [\"p1\", \"(a)\", \"p!\"])\n\nvar sym = Symbol('Any')\ns = [ { [sym]:5, a:6 } ]\no = { ...((s))[0] }\n\nassert(o[sym] === 5)\nassert(o.a === 6)\ncheckOwnProperties(o, [\"a\"])\n"
  },
  {
    "path": "tests/jerry/object-create.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Example where we create an object with a couple of sample properties.\n// (Note that the second parameter maps keys to *property descriptors*.)\nvar o = Object.create(Object.prototype, {\n  // foo is a regular 'value property'\n  foo: { writable: true, configurable: true, value: 'hello' },\n  // bar is a getter-and-setter (accessor) property\n  bar: {\n    configurable: false,\n    get: function() { return 10; },\n    set: function(value) { console.log('Setting `o.bar` to', value); }\n  }\n});\n\n// create a new object whose prototype is a new, empty object\n// and a adding single property 'p', with value 42\nvar o = Object.create({}, { p: { value: 42 } });\n// by default properties ARE NOT writable, enumerable or configurable:\no.p = 24;\nassert (o.p === 42);\n\n// to specify an ES3 property\nvar o2 = Object.create({}, {\n  p: {\n    value: 42,\n    writable: true,\n    enumerable: true,\n    configurable: true\n  }\n});\n\nassert (o2.p === 42);\n\n// Shape - superclass\nfunction Shape() {\n  this.x = 0;\n  this.y = 0;\n}\n\n// superclass method\nShape.prototype.move = function(x, y) {\n  this.x += x;\n  this.y += y;\n};\n\n// Rectangle - subclass\nfunction Rectangle() {\n  Shape.call(this); // call super constructor.\n}\n\n// subclass extends superclass\nRectangle.prototype = Object.create(Shape.prototype);\nRectangle.prototype.constructor = Rectangle;\n\nvar rect = new Rectangle();\n\nassert (rect instanceof Rectangle);\nassert (rect instanceof Shape);\nrect.move(1, 1);\nassert (rect.x === 1)\nassert (rect.y === 1);\n\nvar obj = {\n  protoFunction: function() {\n    return 3;\n  }\n};\n\nObject.defineProperties(obj, {\n  \"foo\": {\n    value: 42,\n    writable: true,\n  },\n  \"a\": {\n    value: \"b\",\n    configurable: true\n  },\n  \"bar\": {\n    get: function() {\n      return this.foo;\n    },\n  },\n});\n\nvar obj2 = Object.create(obj);\n\nassert (obj2.protoFunction() === 3);\nassert (obj2.foo === 42);\nassert (obj2.a === \"b\");\nassert (obj2.bar === 42);\nassert (Object.getPrototypeOf (obj2) === obj);\n\n\nvar props = {\n    prop1: {\n        value: 1,\n    },\n    hey: function () {\n        return \"ho\";\n    }\n};\n\nvar obj3 = Object.create(obj, props);\nassert (obj3.prop1 === 1);\nassert (obj3.protoFunction() === 3);\ntry {\n  assert (obj3.hey === undefined);\n  obj3.hey();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// Create an object with null as prototype\nvar obj = Object.create(null)\nassert (typeof (obj) === \"object\");\nassert (Object.getPrototypeOf (obj) === null);\n\ntry {\n    Object.create()\n    assert (false);\n} catch (e) {\n    assert (e instanceof TypeError);\n}\n\ntry {\n    Object.create(undefined)\n    assert (false);\n} catch (e) {\n    assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/object-define-properties.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {};\nObject.defineProperties(obj, {\n  \"foo\": {\n    value: true,\n    writable: true\n  },\n  \"bar\": {\n    value: \"baz\",\n    writable: false\n  },\n  \"Hello\": {\n    value: \"world\",\n    writable: false\n  },\n  \"inner_object\": {\n    value : {\n      \"a\" : 1,\n      \"b\" : {\n        value: \"foo\"\n      }\n    }\n  }\n});\n\nassert (obj.foo === true);\nassert (obj.bar === \"baz\");\nassert (obj.Hello === \"world\");\nassert (obj.inner_object.a === 1);\nassert (obj.inner_object.b.value === \"foo\");\n\n// These cases should throw TypeError\ntry {\n  Object.defineProperties(obj, undefined);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Object.defineProperties(obj, null);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Object.defineProperties(undefined, {\n    \"foo\": {\n      value: true,\n      writable: true\n    }\n  });\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// Check for internal assert, see issue #131.\ntry {\n  Object.defineProperties([], undefined);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// If one of the properties is wrong than it shouldn't update the object.\nvar obj2 = {\n  a: 5\n};\ntry {\n  Object.defineProperties(obj2, {\n    \"foo\": {\n      value: true,\n      writable: true\n    },\n    \"bar\": {\n      value: 3,\n      set: 3\n    },\n    \"Hello\": {\n      value: \"world\",\n      writable: false\n    }\n  });\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n  assert (obj2.foo === undefined);\n  assert (obj2.set === undefined);\n  assert (obj2.Hello === undefined);\n  assert (obj2.a === 5);\n}\n\n// Define accessors\nvar obj = {};\nObject.defineProperties(obj, {\n  \"foo\": {\n    value: 42,\n    writable: true,\n  },\n  \"bar\": {\n    get: function() { return this.foo },\n    set: function(v) { this.foo = v }\n  }\n});\n\nassert (obj.bar === 42);\nobj.bar = \"baz\";\nassert (obj.foo === \"baz\");\n\n// Define get method which throws error\nvar obj = {};\nvar props = {\n  prop1: {\n    value: 1,\n    writable: true,\n  },\n  get bar() {\n    throw new TypeError(\"foo\");\n    return { value : 2, writable : true };\n  },\n  prop2: {\n    value: 3,\n    writable: true,\n  },\n  prop3: {\n    value: 4,\n    writable: true,\n  }\n};\n\ntry {\n  Object.defineProperties(obj, props);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n  assert (e.message === \"foo\");\n}\n\n// Define get method which deletes a property\nvar obj = {};\nObject.defineProperties(obj, {\n  \"foo\": {\n    value: 42,\n    writable: true,\n  },\n  \"a\": {\n    value: \"b\",\n    configurable: true\n  },\n  \"bar\": {\n    get: function() {\n      delete this.a;\n      return this.foo;\n    },\n  }\n});\n\nassert (obj.a === \"b\");\nassert (obj.bar === 42);\nassert (obj.a === undefined);\n\nvar obj = {};\nvar props = {\n  prop1: {\n    value: 1,\n    writable: true,\n  },\n  get bar() {\n    delete props.prop1;\n    delete props.prop2;\n    return { value : 2, writable : true };\n  },\n  prop2: {\n    value: 3,\n    writable: true,\n  },\n  prop3: {\n    value: 4,\n    writable: true,\n  }\n};\n\nObject.defineProperties(obj, props);\nvar bar_desc = Object.getOwnPropertyDescriptor(obj, 'bar');\nassert(bar_desc.value === 2);\nassert(bar_desc.writable === true);\nassert(obj.prop2 === undefined);\n\nvar prop1_desc = Object.getOwnPropertyDescriptor(obj, 'prop1');\nvar prop3_desc = Object.getOwnPropertyDescriptor(obj, 'prop3');\nassert(prop1_desc.value === 1);\nassert(prop1_desc.writable === true);\nassert(prop3_desc.value === 4);\nassert(prop3_desc.writable === true);\n\nvar object = {};\nvar symbol = Symbol(\"symbol\");\n\nObject.defineProperties(object, {\n  \"foo\": {\n    value: true,\n    writable: true\n  },\n  [symbol]: {\n    value: \"a symbol\",\n    configurable: true\n  }\n});\n\nassert (object.foo === true);\nassert (object[symbol] === \"a symbol\");\n\ntry {\n  Object.defineProperties(undefined, {\n    [symbol]: {\n      value: \"a symbol\",\n      writable: true\n    }\n  });\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// If one of the properties is wrong than it shouldn't update the object.\nvar obj2 = {\n  a: 5\n};\ntry {\n  Object.defineProperties(obj2, {\n    \"foo\": {\n      value: true,\n      writable: true\n    },\n    [symbol]: {\n      value: \"a symbol\",\n      set: 3\n    }\n  });\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n  assert (obj2.foo === undefined);\n  assert (obj2[symbol] === undefined);\n  assert (obj2.a === 5);\n}\n\n// Define accessors\nvar object = {};\nObject.defineProperties(object, {\n  \"foo\": {\n    value: 42,\n    writable: true,\n  },\n  [symbol]: {\n    get: function() { return this.foo },\n    set: function(v) { this.foo = v }\n  }\n});\n\nassert (object[symbol] === 42);\nobject[symbol] = \"baz\";\nassert (object[symbol] === \"baz\");\n\n// Define get method which throws error\nvar object = {};\nvar props = {\n  [symbol]: {\n    value: 3,\n    writable: true\n  },\n  get bar() {\n    throw new TypeError(\"foo\");\n    return { value : 2, writable : true };\n  },\n};\n\ntry {\n  Object.defineProperties(object, props);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n  assert (e.message === \"foo\");\n}\n// Define get method which deletes a property\nvar object = {};\nObject.defineProperties(object, {\n  \"foo\": {\n    value: 42,\n    writable: true,\n  },\n  [symbol]: {\n    value: \"a symbol\",\n    configurable: true\n  },\n  \"bar\": {\n    get: function() {\n      delete this[symbol];\n      return this.foo;\n    },\n  }\n});\n\nassert (object[symbol] === \"a symbol\");\nassert (object.bar === 42);\nassert (object[symbol] === undefined);\n\nvar object = {};\nvar props = {\n  [symbol]: {\n    value: \"a symbol\",\n    configurable: true\n  },\n  get bar() {\n    delete props[symbol];\n    delete props.prop1;\n    return { value : 2, writable : true };\n  },\n  prop1: {\n    value: 3,\n    writable: true,\n  },\n};\n\nObject.defineProperties(object, props);\nvar bar_desc = Object.getOwnPropertyDescriptor(object, 'bar');\nassert(bar_desc.value === 2);\nassert(bar_desc.writable === true);\nassert(object.prop1 === undefined);\nassert(object[symbol] === undefined);\n"
  },
  {
    "path": "tests/jerry/object-defineproperty.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = [];\n\nObject.defineProperty (obj, \"prop\", {\n    value: 2010,\n    writable: true,\n    enumerable: true,\n    configurable: false\n});\n\nassert (obj.hasOwnProperty (\"prop\"));\nfunction getFunc() {\n    return 20;\n}\n\ntry {\n    Object.defineProperty (obj, \"prop\", {\n        get: getFunc\n    });\n    assert (false);\n} catch (e) {\n    assert (e instanceof TypeError);\n    var desc = Object.getOwnPropertyDescriptor (obj, \"prop\");\n    assert (desc.value === 2010);\n    assert (typeof (desc.get) === 'undefined');\n}\n\nobj = {};\nvar setter = function () {};\n\nObject.defineProperty(obj, \"prop\", {\n    set: setter,\n    configurable: true\n});\n\nvar desc1 = Object.getOwnPropertyDescriptor(obj, \"prop\");\n\nObject.defineProperty(obj, \"prop\", {\n    set: undefined\n});\n\nvar desc2 = Object.getOwnPropertyDescriptor(obj, \"prop\");\nassert (desc1.set === setter && desc2.set === undefined);\n\nobj = {};\n\n/* This error is thrown even in non-strict mode. */\nObject.defineProperty(obj, 'f', {\n  set: function(value) { throw 234; },\n});\n\ntry {\n  obj.f = 5;\n  assert (false);\n} catch (err) {\n  assert (err === 234);\n}\n\ntry {\n  Object.defineProperty(42, \"prop\", {\n      set: undefined\n  });\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/object-entries.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar object = {};\nvar symbol = Symbol(\"symbol\");\n\nObject.defineProperties(object, {\n  a: {\n    value: 42,\n    enumerable: true\n  },\n  b: {\n    value: \"foo\",\n    enumerable: false\n  },\n  [symbol]: {\n    value: \"symbol\",\n    enumerable: true\n  }\n});\n\n// Object.keys and Object.entries should have the same keys\nvar keys = Object.keys(object);\nvar entries = Object.entries(object);\n\nassert(keys.length === entries.length);\nfor (let i = 0; i < keys.length; i++) {\n  assert(keys[i] === entries[i][0]);\n}\n\n// Test object entries\nvar entries = Object.entries(object);\nassert(entries instanceof Array);\nassert(entries.length === 1);\nassert(entries[0].length === 2);\nassert(entries[0][0] === \"a\");\nassert(entries[0][1] === 42);\n\n// Test array entries\nvar array = [1, 2, \"three\"];\nvar entries = Object.entries(array);\n\nassert(entries instanceof Array);\nassert(entries.length === array.length);\n\nfor (let i = 0; i < entries.length; i++) {\n  assert(entries[i][0] === i + \"\");\n  assert(entries[i][1] === array[i]);\n}\n\n// Test prototype chain\nfunction Parent() {}\nParent.prototype.inheritedMethod = function() {};\n\nfunction method() {};\nfunction Child() {\n  this.prop = 5;\n  this.method = method;\n}\n\nChild.prototype = new Parent;\nChild.prototype.prototypeMethod = function() {};\n\nvar entries = Object.entries (new Child());\nassert(entries.length === 2);\nassert(entries[0][0] === \"prop\");\nassert(entries[0][1] === 5);\nassert(entries[1][0] === \"method\");\nassert(entries[1][1] === method);\n\n// Test with primitive values\nvar entries = Object.entries(true);\nassert(entries instanceof Array);\nassert(entries.length === 0);\n\ntry {\n  Object.entries(undefined);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\ntry {\n  Object.entries(null);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\n// Test proxy object\nvar object = {};\n\nObject.defineProperties(object, {\n  a: {\n    value: \"foo\",\n    enumerable: false\n  },\n  b: {\n    value: \"bar\",\n    enumerable: true,\n    writable: false\n  }\n});\n\nvar proxy = new Proxy(object, {\n  getOwnPropertyDescriptor: function(o, v) {\n    handlers.push(\"D\");\n    return Object.getOwnPropertyDescriptor(o, v);\n  },\n  get: function(o, v) {\n    handlers.push(\"G\");\n    return o[v];\n  }\n});\n\nvar handlers = [];\nvar entries = Object.entries(proxy);\n\nassert(entries.length === 1);\nassert(entries[0][0] === \"b\");\nassert(entries[0][1] === \"bar\");\nassert(handlers.length === 3);\nassert(handlers.toString() === \"D,D,G\");\n\n// exception during enumeration\nvar obj = {\n  get a() { throw \"error\" },\n  get b() { throw \"shouldn't run\" }\n};\n\ntry {\n  Object.entries(obj);\n} catch (err) {\n  assert(err == \"error\")\n}\n"
  },
  {
    "path": "tests/jerry/object-freeze-with-symbol.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar s1 = Symbol();\nvar s2 = Symbol();\nvar obj = {};\n\nobj[s1] = 1;\nObject.freeze(obj);\n\nobj[s1] = 2;\nobj[s2] = 3\n\nassert(obj[s1] === 1);\nassert(obj[s2] === undefined);\nassert(delete obj[s1] === false);\n\nassert(Object.isFrozen(obj));\n"
  },
  {
    "path": "tests/jerry/object-fromEntries.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// helper function - simple implementation\nArray.prototype.equals = function (array) {\n  if (this.length != array.length)\n    return false;\n\n  for (var i = 0; i < this.length; i++) {\n    if (this[i] instanceof Array && array[i] instanceof Array) {\n      if (!this[i].equals (array[i]))\n        return false;\n      }\n      else if (this[i] != array[i]) {\n        return false;\n    }\n  }\n\n  return true;\n}\n\n// converting map to object\nconst map = new Map ([ ['foo', 'bar'], ['baz', 42] ]);\nconst obj_map = Object.fromEntries (map);\nassert (Object.values (obj_map).equals ([\"bar\", 42]));\nassert (Object.keys (obj_map).equals ([\"foo\", 'baz']));\n\n// converting array to object\nconst arr = [ ['0', 'a'], ['1', 'b'], ['2', 'c'] ];\nconst obj_arr = Object.fromEntries (arr);\nassert (Object.values (obj_arr).equals ([\"a\", \"b\", \"c\"]));\nassert (Object.keys (obj_arr).equals ([\"0\", '1', '2']));\n\n// transfrom object to other object\nconst object1 = { a: 1, b: 2, c: 3 };\nconst object2 = Object.fromEntries (\n  Object.entries (object1)\n  .map (([ key, val ]) => [ key, val * 2 ])\n);\nassert (Object.keys (object2).equals ([\"a\", \"b\", \"c\"]));\nassert (Object.values (object2).equals ([2, 4, 6]));\n\n// map with undefined or null member\nconst map2 = new Map ([ ['foo', undefined], ['baz', null] ]);\nconst obj_map2 = Object.fromEntries (map2);\nassert (Object.values (obj_map2).equals ([undefined, null]));\nassert (Object.keys(obj_map2).equals ([\"foo\", 'baz']))\n\n// don't have a value\nconst map3 = new Map ([ ['foo'], ['baz'] ]);\nconst obj_map3 = Object.fromEntries (map3);\nassert (Object.values(obj_map3).equals ([undefined, undefined]));\nassert (Object.keys(obj_map3).equals ([\"foo\", 'baz']));\n\n// empty map\nconst map4 = new Map ([]);\nconst obj_map4 = Object.fromEntries (map4);\nassert (Object.values(obj_map4).equals ([]));\nassert (Object.keys(obj_map4).equals ([]));\n\n// few invalid argument\nfunction check_iterator (iterator) {\n  try {\n    Object.fromEntries (iterator);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n}\n\ncheck_iterator (null);\ncheck_iterator (undefined);\ncheck_iterator (5);\ncheck_iterator ()\n\n// closed iterator\nvar returned = false;\nvar closed_iterable = {\n  [Symbol.iterator]: function () {\n    var advanced = false;\n    return {\n      next: function () {\n        if (advanced) {\n          throw 42 // meaning of life;\n        }\n        advanced = true;\n        return {\n          done: false,\n          value: 'ab',\n        };\n      },\n      return: function () {\n        if (returned) {\n          throw 42 // meaning of life;\n        }\n        returned = true;\n      },\n    };\n  },\n};\n\ncheck_iterator (closed_iterable)\nassert (returned);\n\nvar next_iterable = {\n  [Symbol.iterator]: function () {\n    return {\n      next: function () {\n        return null;\n      },\n      return: function () {\n        throw 42 // meaning of life;\n      },\n    };\n  },\n};\n\ncheck_iterator (next_iterable)\n\n// uncallable next\nvar next_iterable_2 = {\n  [Symbol.iterator]: function () {\n    return {\n      next: null,\n      return: function () {\n        throw 42 // meaning of life;\n      },\n    };\n  },\n};\n\ncheck_iterator (next_iterable_2)\n\n// get '0' error\nreturned = false;\nvar iterable_0 = {\n  [Symbol.iterator]: function () {\n    var advanced = false;\n    return {\n      next: function () {\n        if (advanced) {\n          throw 42 // meaning of life;\n        }\n        advanced = true;\n        return {\n          done: false,\n          value: {\n            get '0' () {\n              throw new TypeError ();\n            },\n            get '1' () {\n              return \"value\";\n            },\n          },\n        };\n      },\n      return: function () {\n        if (returned) {\n          throw 42 // meaning of life;\n        }\n        returned = true;\n      },\n    };\n  },\n};\n\ncheck_iterator (iterable_0)\nassert (returned);\n\n// error in toPropertyKey\nreturned = false;\nvar iterable = {\n  [Symbol.iterator]: function () {\n    var advanced = false;\n    return {\n      next: function () {\n        if (advanced) {\n          throw 42 // meaning of life;\n        }\n        advanced = true;\n        return {\n          done: false,\n          value: {\n            0: {\n              get toString () { throw new TypeError }\n            },\n            get '1' () {\n              return \"value\";\n            },\n          },\n        };\n      },\n      return: function () {\n        if (returned) {\n          throw 42 // meaning of life;\n        }\n        returned = true;\n      },\n    };\n  },\n};\n\ncheck_iterator (iterable)\nassert (returned);\n\n// get '1' error\nreturned = false;\nvar iterable = {\n  [Symbol.iterator]: function () {\n    var advanced = false;\n    return {\n      next: function () {\n        if (advanced) {\n          throw 42 // meaning of life;\n        }\n        advanced = true;\n        return {\n          done: false,\n          value: {\n            get '0' () {\n              return 'key';\n            },\n            get '1' () {\n              throw new TypeError;\n            },\n          },\n        };\n      },\n      return: function () {\n        if (returned) {\n          throw 42 // meaning of life;\n        }\n        returned = true;\n      },\n    };\n  },\n};\n\ncheck_iterator (iterable)\nassert (returned);\n\n// next value is error\nvar iterable = {\n  [Symbol.iterator] () {\n    return {\n      next () {\n        return {\n          get value () {\n            throw new TypeError }\n          }\n        }\n      }\n    }\n  }\n\ncheck_iterator (iterable)\n"
  },
  {
    "path": "tests/jerry/object-get-own-property-descriptor.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj;\nvar desc;\n\nobj = { bar: 42 };\ndesc = Object.getOwnPropertyDescriptor (obj, 'bar');\n// desc is { configurable: true, enumerable: true, value: 42, writable: true }\nassert (desc.value === 42);\nassert (desc.configurable);\nassert (desc.writable);\nassert (desc.enumerable);\n\nobj = { \"foo\": \"bar\" };\ndesc = Object.getOwnPropertyDescriptor (obj, 'foo');\nassert (desc.value === \"bar\");\n\nobj = {};\nObject.defineProperty (obj, 'baz', { value: 8675309, writable: false, enumerable: false });\ndesc = Object.getOwnPropertyDescriptor (obj, 'baz');\n// desc is { value: 8675309, writable: false, enumerable: false, configurable: false }\nassert (desc.value === 8675309);\nassert (!desc.configurable);\nassert (!desc.writable);\nassert (!desc.enumerable);\n\nobj = { \"0.00001\": 1 };\ndesc = Object.getOwnPropertyDescriptor (obj, 1e-5);\nassert ( desc.value === 1);\n\nobj = { \"123\": 1 };\ndesc = Object.getOwnPropertyDescriptor (obj, 123);\nassert (desc.value === 1);\n\nobj = { \"undefined\": 1 };\nvar desc1 = Object.getOwnPropertyDescriptor (obj, undefined);\nvar desc2 = Object.getOwnPropertyDescriptor (obj, \"undefined\");\nassert (desc1.value === 1 && desc2.value === 1);\n\nobj = { \"0\": 1 };\ndesc = Object.getOwnPropertyDescriptor (obj, -0);\nassert (desc.value === 1);\n\nobj = { \"Hellobj\": 42 };\ndesc = Object.getOwnPropertyDescriptor (obj, new String (\"Hellobj\"));\nassert (desc.value === 42);\n\nobj = {};\ndesc = Object.getOwnPropertyDescriptor (obj, 'baz');\nassert (desc === undefined);\n\nobj = { get foo() { return obj.bar; }, set foo(a) { obj.bar = a; }, bar: 0 };\ndesc = Object.getOwnPropertyDescriptor(obj, 'foo');\n// d is { configurable: true, enumerable: true, get: /*the getter function*/, set: /*the setter function*/ }\nassert (typeof(desc.get) === 'function');\nassert (typeof(desc.set) === 'function');\nassert (desc.configurable);\nassert (desc.enumerable);\nassert (obj.foo === 0)\n\nvar array_desc = Object.getOwnPropertyDescriptor(Array, \"prototype\");\nassert (array_desc.configurable === false);\nassert (array_desc.writable === false);\nassert (array_desc.enumerable === false);\n\nvar obj_undef;\ntry {\n    Object.getOwnPropertyDescriptor (obj_undef, \"fail\");\n    assert (false);\n} catch (e) {\n    assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/object-get-own-property-descriptors.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar object = {};\nvar symbol = Symbol(\"symbol\");\n\nfunction getter() { return 2; }\nfunction setter(value) {}\n\n// Append a symbol property.\nobject[symbol] = \"symbol\";\n\nObject.defineProperties(object, {\n  \"foo\" : {\n    get: getter,\n    set: setter,\n    enumerable: true,\n    configurable: true,\n  },\n  \"bar\": {\n    value: \"bar\",\n    writable: true,\n    enumerable: false,\n    configurable: true,\n  },\n  \"baz\": {\n    value: undefined,\n    writable: false,\n    enumerable: true,\n    configurable: false,\n  },\n});\n\nvar descriptors = Object.getOwnPropertyDescriptors(object);\n\n// All the descriptor keys should be enumerable.\nvar keys = Object.keys(descriptors);\nvar names = Object.getOwnPropertyNames(descriptors);\nvar symbols = Object.getOwnPropertySymbols(descriptors);\n\nassert(keys.length === names.length);\nassert(symbols.length === 1);\n\nfor (var idx = 0; idx < keys.length; idx++) {\n  assert(keys[idx] === names[idx]);\n}\n\nassert(descriptors[symbol].value === \"symbol\");\n\nassert(descriptors[\"foo\"].get === getter);\nassert(descriptors[\"foo\"].set === setter);\nassert(descriptors[\"foo\"].enumerable === true);\nassert(descriptors[\"foo\"].configurable === true);\n\nassert(descriptors[\"bar\"].value === \"bar\");\nassert(descriptors[\"bar\"].writable === true);\nassert(descriptors[\"bar\"].enumerable === false);\nassert(descriptors[\"bar\"].configurable === true);\n\nassert(descriptors[\"baz\"].value === undefined);\nassert(descriptors[\"baz\"].writable === false);\nassert(descriptors[\"baz\"].enumerable === true);\nassert(descriptors[\"baz\"].configurable === false);\n\n// Compare getOwnPropertyDescriptor and getOwnPropertyDescriptors.\nfor (let i of Object.getOwnPropertyNames(object)) {\n  let lhs = JSON.stringify(Object.getOwnPropertyDescriptor(object, i));\n  let rhs = JSON.stringify(descriptors[i]);\n\n  assert(lhs === rhs);\n}\n\nvar array_desc = Object.getOwnPropertyDescriptors(Array);\nassert(array_desc.prototype.value === Array.prototype);\nassert(array_desc.prototype.writable === false);\nassert(array_desc.prototype.configurable === false);\nassert(array_desc.prototype.enumerable === false);\n\ntry {\n  Object.getOwnPropertyDescriptors(undefined);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\nvar proxy_get_desc_handler = new Proxy(object, {\n  getOwnPropertyDescriptor(target, prop) {\n    throw new Error(\"Error\");\n  }\n});\n\nvar proxy_own_keys_handler = new Proxy(object, {\n  ownKeys: 42,\n});\n\ntry {\n  Object.getOwnPropertyDescriptors(proxy_get_desc_handler);\n  assert(false);\n} catch(e) {\n  assert(e instanceof Error);\n}\n\ntry {\n  Object.getOwnPropertyDescriptors(proxy_own_keys_handler);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/object-get-own-property-names.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Test array\nvar arr = ['a', 'b', 'c'];\nvar props = Object.getOwnPropertyNames(arr);\n// props should contain: 0,1,2,length and the order is not defined!\nassert (props.indexOf(\"0\") !== -1);\nassert (props.indexOf(\"1\") !== -1);\nassert (props.indexOf(\"2\") !== -1);\nassert (props.indexOf(\"length\") !== -1);\nassert (props.length === 4);\n\n// Test object\nvar obj = {key1: 'a', key3: 'b', key2: 'c', key4: 'c', key5: ''};\nprops = Object.getOwnPropertyNames(obj);\n// props should contain: key1,key2,key3,key4,key5 and the order is not defined!\nassert (props.indexOf(\"key1\") !== -1);\nassert (props.indexOf(\"key2\") !== -1);\nassert (props.indexOf(\"key3\") !== -1);\nassert (props.indexOf(\"key4\") !== -1);\nassert (props.indexOf(\"key5\") !== -1);\nassert (props.length === 5);\n\nvar obj2 = {};\nObject.defineProperties(obj2, {\n    key_one: {enumerable: true, value: 'one'},\n    key_two: {enumerable: false, value: 'two'},\n});\n\nprops = Object.getOwnPropertyNames(obj2);\n// props should contain: key_one,key_two and the order is not defined!\nassert (props.indexOf(\"key_one\") !== -1);\nassert (props.indexOf(\"key_two\") !== -1);\nassert (props.length === 2);\n\n// Test prototype chain\nfunction Parent() {}\nParent.prototype.inheritedMethod = function() {};\n\nfunction Child() {\n  this.prop = 5;\n  this.method = function() {};\n}\nChild.prototype = new Parent;\nChild.prototype.prototypeMethod = function() {};\n\nprops = Object.getOwnPropertyNames (new Child());\n// props should contain: prop,method and the order is not defined!\nassert (props.indexOf(\"prop\") !== -1);\nassert (props.indexOf(\"method\") !== -1);\n\nassert (props.length === 2);\n\n// Check that Object.getOwnPropertyNames does NOT include Symbols by default.\nvar asd = Symbol (\"asd\");\nvar foo = Symbol (\"foo\");\nvar bar = Symbol (\"bar\");\nvar result = Object.getOwnPropertyNames ({1: 5, \"a\": 6, [foo]: 7, [asd]: 8, [bar]: 9});\nassert (!Object.hasOwnProperty (result, foo));\nassert (!Object.hasOwnProperty (result, asd));\nassert (!Object.hasOwnProperty (result, bar));\n"
  },
  {
    "path": "tests/jerry/object-get-own-property-symbols.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Test array\nvar a = Symbol ('a');\nvar b = Symbol ('b');\nvar c = Symbol ('c');\nvar d = Symbol ();\n\nvar arr = [a, b, c, d];\nvar props = Object.getOwnPropertySymbols (arr);\n// props should not contain: a, b, c, d\nassert (props.indexOf ('0') === -1);\nassert (props.indexOf ('1') === -1);\nassert (props.indexOf ('2') === -1);\nassert (props.indexOf ('length') === -1);\nassert (props.length === 0);\n\n// Test object\nvar obj = {};\nobj[a] = 'a';\nobj[b] = 'b';\nobj[c] = 'c';\nobj[d] = 'd';\nprops = Object.getOwnPropertySymbols (obj);\n// props should contain: a, b, c, d and the order is not defined!\nassert (props.indexOf(a) !== -1);\nassert (props.indexOf(b) !== -1);\nassert (props.indexOf(c) !== -1);\nassert (props.indexOf(d) !== -1);\nassert (props.length === 4);\n\n// Test same descriptions\nvar fooSymbol1 = Symbol ('foo');\nvar fooSymbol2 = Symbol ('foo');\nvar fooSymbol3 = Symbol ('foo');\nvar fooSymbol4 = Symbol ('foo');\n\nvar obj = {}\nobj[fooSymbol1] = 'foo';\nobj[fooSymbol2] = 'bar';\nobj[fooSymbol3] = 'foobar';\nobj[fooSymbol4] = 'barfoo';\n\nprops = Object.getOwnPropertySymbols (obj);\nassert (props.indexOf (fooSymbol1) !== -1);\nassert (props.indexOf (fooSymbol2) !== -1);\nassert (props.indexOf (fooSymbol3) !== -1);\nassert (props.indexOf (fooSymbol4) !== -1);\nassert (props.length === 4);\n\nvar mixed_object = {};\nvar foo = Symbol ('foo');\nvar bar = Symbol.for ('bar');\n\nmixed_object[foo] = 'localSymbol';\nmixed_object[bar] = 'globalSymbol';\nmixed_object['foo'] = 'string';\n\nvar props = Object.getOwnPropertySymbols (mixed_object);\n\nassert (typeof props[0] === 'symbol')\nassert (props.indexOf(foo) !== -1);\nassert (props.indexOf(bar) !== -1);\nassert (props.indexOf('foo') === -1);\nassert (props.length === 2)\n\n// Test prototype chain\nfunction Parent() {}\nParent.prototype.inheritedMethod = function() {};\n\nfunction Child() {\n  this[a] = 5;\n  this[b] = function() {};\n}\nChild.prototype = new Parent;\nChild.prototype.prototypeMethod = function() {};\n\nprops = Object.getOwnPropertySymbols (new Child());\n// props should contain: a, b and the order is not defined!\nassert (props.indexOf(a) !== -1);\nassert (props.indexOf(b) !== -1);\n\nassert (props.length === 2);\n\n// Test non-emumerable symbols\nvar object = {};\nvar foo = Symbol ('foo');\nvar foo2 = Symbol ('foo2');\nobject[foo] = 'EnumerableSymbolProp';\nObject.defineProperty(object, foo2, { value : 'NonEnumerableSymbolProp' });\n\nprops = Object.getOwnPropertySymbols (object);\n\nassert (props.indexOf(foo) !== -1);\nassert (props.indexOf(foo2) !== -1);\nassert (props.length === 2);\nassert (Object.getOwnPropertyDescriptor (object, foo).enumerable === true);\nassert (Object.getOwnPropertyDescriptor (object, foo2).enumerable === false);\n"
  },
  {
    "path": "tests/jerry/object-getprototypeof.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = true;\nobj = Object.getPrototypeOf(a);\nassert (obj == Boolean.prototype);\n\na = 5;\nobj = Object.getPrototypeOf(a);\nassert (obj == Number.prototype);\n\na = \"string\";\nobj = Object.getPrototypeOf(a);\nassert (obj == String.prototype);\n\na = [1,2,3];\nobj = Object.getPrototypeOf(a);\nassert (obj == Array.prototype);\n\ntry {\n  a = null;\n  obj = Object.getPrototypeOf(a);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/object-hasown.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = { \"foo\": 5 };\n\nassert(Object.hasOwn(obj, \"foo\") == true);\nassert(Object.hasOwn(obj, \"bar\") == false);\n\nconst handler1 = {};\n\nconst handler2 = {\n    getOwnPropertyDescriptor(target, prop, receiver) {\n        return { configurable: true, enumerable: true, value: true };\n    }\n};\n\nconst handler3 = {\n    getOwnPropertyDescriptor(target, prop, receiver) { }\n};\n\nconst proxy1 = new Proxy(obj, handler1);\nconst proxy2 = new Proxy(obj, handler2);\nconst proxy3 = new Proxy(obj, handler3);\n\nassert(Object.hasOwn(proxy1, \"foo\") == true);\nassert(Object.hasOwn(proxy1, \"bar\") == false);\n\nassert(Object.hasOwn(proxy2, \"foo\") == true);\nassert(Object.hasOwn(proxy2, \"bar\") == true);\n\nassert(Object.hasOwn(proxy3, \"foo\") == false);\nassert(Object.hasOwn(proxy3, \"bar\") == false);\n\ntry {\n    Object.hasOwn({}, { get toString() { throw \"foo\" } });\n} catch (e) {\n    assert(e === \"foo\");\n}\n\ntry {\n    Object.hasOwn(undefined);\n    assert(false);\n} catch (e) {\n    assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/object-initializer.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nswitch (1) {\ndefault:\n  var o = {\n    value: 10,\n    func() {\n      return 234 + this.value;\n    },\n    [\"a\" + \"b\"]() {\n      return 456 - this.value;\n    }\n  }\n}\n\nassert(o.func() === 244);\nassert(o.ab() === 446);\n\nswitch (1) {\ndefault:\n  var ab = 5;\n  var cd = 6;\n  o = {\n    ab,\n    cd: 8,\n    cd\n  }\n}\n\nassert(o.ab === 5);\nassert(o.cd === 6);\n\nfunction exception_expected(str) {\n  try {\n    eval(str);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n\n// These forms are invalid.\nexception_expected('({ true })');\nexception_expected('({ 13 })');\nexception_expected('({ \"x\" })');\n\nswitch (1) {\ndefault:\n  // These forms are valid.\n  ({ true: true });\n  ({ 13: 13 });\n  ({ \"x\": \"x\" });\n\n  var get = 8;\n  var set = 12;\n  var o = ({ get, set });\n\n  assert(o.get == 8);\n  assert(o.set == 12);\n}\n\nvar obj = { get() { return 5; }, set() { return 6; } };\n\nassert (obj.get() === 5);\nassert (obj.set() === 6);\n"
  },
  {
    "path": "tests/jerry/object-is-extensible.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// New objects are extensible.\nvar empty = {};\nassert (Object.isExtensible(empty) === true);\n\n// ...but that can be changed.\nObject.preventExtensions(empty);\nassert(Object.isExtensible(empty) === false);\n\n// Sealed objects are by definition non-extensible.\nvar sealed = Object.seal({});\nassert (Object.isExtensible(sealed) === false);\n\n// Frozen objects are also by definition non-extensible.\nvar frozen = Object.freeze({});\nassert(Object.isExtensible(frozen) === false);\n"
  },
  {
    "path": "tests/jerry/object-is.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Object.is(2, \"foo\") === false);\nassert(Object.is(null, 2) === false);\n\nvar x;\nassert(Object.is(x, 2) === false);\n\nassert(Object.is(null, null) === true);\n\nassert(Object.is(2, 8) === false);\nassert(Object.is(8, 8) === true);\n\nassert(Object.is(3.14, 6.28) === false);\nassert(Object.is(3.14, 3.14) === true);\n\nassert(Object.is('foo', 'foo') === true);\nassert(Object.is('foo', 'bar') === false);\nassert(Object.is(new String('foo'), 'foo') === false);\n\nassert(Object.is([], []) === false);\n\nassert(Object.is(true, true) === true);\nassert(Object.is(false, false) === true);\nassert(Object.is(true, false) === false);\nassert(Object.is(false, true) === false);\nassert(Object.is(\"\", false) === false);\nassert(Object.is(0, false) === false);\n\nsym1 = Symbol.for('foo');\nsym2 = Symbol.for('foo');\nassert(Object.is(sym1, sym2) === true);\nassert(Object.is(Symbol('foo'), Symbol('foo')) === false);\n\nvar foo = { a: 1 };\nvar bar = { a: 1 };\nvar zoo = foo;\nassert(Object.is(foo, foo) === true);\nassert(Object.is(foo, bar) === false);\nassert(Object.is(foo, zoo) === true);\n\n// Special Cases\nassert(Object.is(+0, -0) === false);\nassert(Object.is(+0, 0) === true);\nassert(Object.is(-0, -0) === true);\nassert(Object.is(-0, 0) === false);\nassert(Object.is(NaN, 0/0) === true);\n"
  },
  {
    "path": "tests/jerry/object-keys.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Test array\nvar arr = ['a', 'b', 'c'];\nvar props = Object.keys(arr);\n// props should contain: 0,1,2 and the order is not defined!\nassert (props.indexOf(\"0\") !== -1);\nassert (props.indexOf(\"1\") !== -1);\nassert (props.indexOf(\"2\") !== -1);\nassert (props.length === 3);\n\n// Test object\nvar obj = {key1: 'a', key3: 'b', key2: 'c', key4: 'c', key5: ''};\nprops = Object.keys(obj);\n// props should contain: key1,key2,key3,key4,key5 and the order is not defined!\nassert (props.indexOf(\"key1\") !== -1);\nassert (props.indexOf(\"key2\") !== -1);\nassert (props.indexOf(\"key3\") !== -1);\nassert (props.indexOf(\"key4\") !== -1);\nassert (props.indexOf(\"key5\") !== -1);\nassert (props.length === 5);\n\nvar obj2 = {};\nObject.defineProperties(obj2, {\n    key_one: {enumerable: true, value: 'one'},\n    key_two: {enumerable: false, value: 'two'},\n});\n\nprops = Object.keys(obj2);\n// props should contain: key_one\nassert (props.indexOf(\"key_one\") !== -1);\nassert (props.indexOf(\"key_two\") === -1);\nassert (props.length === 1);\n\n// Test prototype chain\nfunction Parent() {}\nParent.prototype.inheritedMethod = function() {};\n\nfunction Child() {\n  this.prop = 5;\n  this.method = function() {};\n}\nChild.prototype = new Parent;\nChild.prototype.prototypeMethod = function() {};\n\nprops = Object.keys (new Child());\n// props should contain: prop,method and the order is not defined!\nassert (props.indexOf(\"prop\") !== -1);\nassert (props.indexOf(\"method\") !== -1);\nassert (props.length === 2);\n\nvar o = {};\n\nObject.defineProperty(o, 'a', {\n  value: \"OK\",\n  writable: true,\n  enumerable: true,\n  configurable: true\n});\n\nObject.defineProperty(o, 'b', {\n  value: \"NOT_OK\",\n  writable: true,\n  enumerable: false,\n  configurable: true\n});\n\nObject.defineProperty(o, 'c', {\n  value: \"OK\",\n  writable: true,\n  enumerable: true,\n  configurable: true\n});\n\nprops = Object.keys(o);\nassert(props.length === 2);\nassert(o[props[0]] === \"OK\");\nassert(o[props[1]] === \"OK\");\n\nvar object = {};\n\nObject.defineProperties(object, {\n  a: {\n    value: \"foo\",\n    enumerable: false\n  },\n  b: {\n    value: \"bar\",\n    enumerable: true,\n    writable: false\n  }\n});\n\nvar proxy = new Proxy(object, {\n  getOwnPropertyDescriptor: function(o, v) {\n    handlers.push(\"D\");\n    return Object.getOwnPropertyDescriptor(o, v);\n  },\n  get: function(o, v) {\n    handlers.push(\"G\");\n    return o[v];\n  }\n});\n\nvar handlers = [];\nvar keys = Object.keys(proxy);\n\nassert(keys.length === 1);\nassert(keys[0] === \"b\");\nassert(handlers.length === 2);\nassert(handlers.toString() === \"D,D\");\n"
  },
  {
    "path": "tests/jerry/object-literal-2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = {get a(){return undefined}, set a(b){}}\n\nvar b = {if:0, else:1, try:2, catch:3, finally:4, let:5}\n\nassert (b.if + b.else + b.try + b.catch + b.finally + b.let === 15)\n\nfunction c() {\n  \"use strict\"\n  var b = {let:15, enum:10}\n  assert (b.let + b.enum === 25)\n}\nc();\n\nfunction d () {\n  \"use strict\";\n\n  try {\n    /* 'let' is a FutureReservedWord in strict mode code */\n    eval ('var a = { get prop () { let = 1; } }');\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\nd ();\n"
  },
  {
    "path": "tests/jerry/object-literal-prescanner.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nswitch (true) {\ndefault:\n  var obj = {\n    value: 0,\n    set\n      member\n      (x)\n    {\n      // Multiple statements.\n      this.value = x + 4;\n      this.value += 2;\n    },\n    get\"member\"() {\n      // Multiple statements.\n      this.value = this.value + 1;\n      return this.value;\n    },\n    get 3() {\n      return 3;\n    }\n  }\n}\n\nobj[\"member\"] = 10;\nassert(obj.member === 17);\nassert(obj.member === 18);\n\nassert(obj[3] === 3);\nassert(obj[\"3\"] === 3);\n"
  },
  {
    "path": "tests/jerry/object-literal-super.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar setter1_called = false;\nvar setter2_called = false;\n\nvar obj1 = {\n  method1() {\n    return 1;\n  },\n  ['method2']() {\n    return 2;\n  },\n  *method3() {\n    return 3;\n  },\n  *['method4']() {\n    return 4;\n  },\n  get getter1() {\n    return 5;\n  },\n  get ['getter2']() {\n    return 6;\n  },\n  set setter1(rhs) {\n    setter1_called = true;\n    assert(rhs === 7);\n  },\n  set ['setter2'](rhs) {\n    setter2_called = true;\n    assert(rhs === 8);\n  },\n}\n\nvar obj2 = {\n  method1() {\n    return super.method1();\n  },\n  ['method2']() {\n    return super.method2();\n  },\n  *method3() {\n    return super.method3();\n  },\n  *['method4']() {\n    return super.method4();\n  },\n  get getter1() {\n    return super.getter1;\n  },\n  get ['getter2']() {\n    return super.getter2;\n  },\n  set setter1(rhs) {\n    super.setter1 = rhs;\n  },\n  set ['setter2'](rhs) {\n    super.setter2 = rhs;\n  },\n  __proto__: obj1,\n}\n\nassert(obj2.method1() === 1);\nassert(obj2.method2() === 2);\nassert(obj2.method3().next().value.next().value === 3);\nassert(obj2.method4().next().value.next().value === 4);\n\nassert(obj2.getter1 === 5);\nassert(obj2.getter2 === 6);\n\nobj2.setter1 = 7;\nassert(setter1_called);\nobj2.setter2 = 8;\nassert(setter2_called);\n\nlet obj3 = {\n  a() {\n    return 9;\n  }\n}\n\nlet obj4 = {\n  a() {\n    return eval('super.a()');\n  },\n  __proto__: obj3,\n}\n\nassert(obj4.a() === 9);\n\nlet obj5 = {\n  a() {\n    return (_ => super.a())();\n  },\n  __proto__: obj3,\n}\n\nassert(obj5.a() === 9);\n\nlet obj6 = {\n  a() {\n    return (_ => _ => super.a())()();\n  },\n  __proto__: obj3,\n}\n\nassert(obj6.a() === 9);\n\n\nfunction checkSyntax(src) {\n  try {\n    eval(src);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n\ncheckSyntax('({ a : function () { super.a }})')\ncheckSyntax('({ [\\'a\\'] : function () { super.a }})')\n"
  },
  {
    "path": "tests/jerry/object-literal.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar person = {\n    firstName:\"John\",\n    lastName:\"Doe\",\n    age:50,\n    eyeColor:\"blue\",\n    \"gender\":\"male\",\n    0:0\n};\n\nassert (person.firstName === \"John\");\nassert (person[\"firstName\"] === \"John\");\nassert (person.lastName === \"Doe\");\nassert (person[\"lastName\"] === \"Doe\");\nassert (person.age === 50);\nassert (person[\"age\"] === 50);\nassert (person.eyeColor === \"blue\");\nassert (person[\"eyeColor\"] === \"blue\");\nassert (person.gender === \"male\");\nassert (person[\"gender\"] === \"male\");\nassert (person[\"0\"] === 0);\n\nvar x = person;\nx.age = 40;\nassert (x.age === 40);\nassert (person.age === 40);\n\nvar john = new Object();\njohn.firstName = \"John\";\njohn.lastName = \"Doe\";\njohn.age = 40;\njohn.eyeColor = \"blue\";\n\nassert (person.firstName === john.firstName);\nassert (person.lastName === john.lastName);\nassert (person.age === john.age);\nassert (person.eyeColor === john.eyeColor);\n\nvar a, b; \nb = 'property1'; \na = { \n  'property1' : 'value1', \n  get property2 () { return 1; }, \n  set property2 (a) {\n    if (true)\n      this.property3 = a * 10;\n    else\n      this.property3 = a;\n  },\n  set property3 (b) { this.property1 = b; }\n}; \nassert (a.property1 === 'value1'); \nassert (a.property2 === 1); \na.property3 = 'value2'; \nassert (a.property1 === 'value2'); \na.property2 = 2.5; \nassert (a.property1 === 25); \nb = delete a[b]; \nassert (b === true); \nassert (a.property1 === undefined); \n\nflow = '';\na = {\n  get q ()\n  {\n    flow += 'get: ' + (typeof q);\n\n    return 0;\n  },\n  set q (v)\n  {\n    flow += ', set: ' + (typeof q);\n  }\n};\n\na.q;\na.q = 1;\n\nassert (flow == 'get: undefined, set: undefined');\n\nvar data = {\n  '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,\n  '9': 9, '10': 10, '11': 11, '12': 12, '13': 13, '14': 14, '15': 15, '16': 16,\n  '17': 17, '18': 18, '19': 19, '20': 20, '21': 21, '22': 22, '23': 23, '24': 24,\n  '25': 25, '26': 26, '27': 27, '28': 28, '29': 29, '30': 30, '31': 31, '32': 32,\n  '33': 33, '34': 34, '35': 35, '36': 36, '37': 37, '38': 38, '39': 39, '40': 40,\n  '41': 41, '42': 42, '43': 43, '44': 44, '45': 45, '46': 46, '47': 47, '48': 48,\n  '49': 49, '50': 50, '51': 51, '52': 52, '53': 53, '54': 54, '55': 55, '56': 56,\n  '57': 57, '58': 58, '59': 59, '60': 60, '61': 61, '62': 62, '63': 63, '64': 64,\n  '65': 65, '66': 66, '67': 67, '68': 68, '69': 69, '70': 70, '71': 71, '72': 72,\n  '73': 73, '74': 74, '75': 75, '76': 76, '77': 77, '78': 78, '79': 79, '80': 80,\n  '81': 81, '82': 82, '83': 83, '84': 84, '85': 85, '86': 86, '87': 87, '88': 88,\n  '89': 89, '90': 90, '91': 91, '92': 92, '93': 93, '94': 94, '95': 95, '96': 96,\n  '97': 97, '98': 98, '99': 99, '100': 100, '101': 101, '102': 102, '103': 103, '104': 104,\n  '105': 105, '106': 106, '107': 107, '108': 108, '109': 109, '110': 110, '111': 111, '112': 112,\n  '113': 113, '114': 114, '115': 115, '116': 116, '117': 117, '118': 118, '119': 119, '120': 120,\n  '121': 121, '122': 122, '123': 123, '124': 124, '125': 125, '126': 126, '127': 127, '128': 128,\n  '129': 129, '130': 130, '131': 131, '132': 132, '133': 133, '134': 134, '135': 135, '136': 136,\n  '137': 137, '138': 138, '139': 139, '140': 140, '141': 141, '142': 142, '143': 143, '144': 144,\n  '145': 145, '146': 146, '147': 147, '148': 148, '149': 149, '150': 150, '151': 151, '152': 152,\n  '153': 153, '154': 154, '155': 155, '156': 156, '157': 157, '158': 158, '159': 159, '160': 160,\n  '161': 161, '162': 162, '163': 163, '164': 164, '165': 165, '166': 166, '167': 167, '168': 168,\n  '169': 169, '170': 170, '171': 171, '172': 172, '173': 173, '174': 174, '175': 175, '176': 176,\n  '177': 177, '178': 178, '179': 179, '180': 180, '181': 181, '182': 182, '183': 183, '184': 184,\n  '185': 185, '186': 186, '187': 187, '188': 188, '189': 189, '190': 190, '191': 191, '192': 192,\n  '193': 193, '194': 194, '195': 195, '196': 196, '197': 197, '198': 198, '199': 199, '200': 200,\n  '201': 201, '202': 202, '203': 203, '204': 204, '205': 205, '206': 206, '207': 207, '208': 208,\n  '209': 209, '210': 210, '211': 211, '212': 212, '213': 213, '214': 214, '215': 215, '216': 216,\n  '217': 217, '218': 218, '219': 219, '220': 220, '221': 221, '222': 222, '223': 223, '224': 224,\n  '225': 225, '226': 226, '227': 227, '228': 228, '229': 229, '230': 230, '231': 231, '232': 232,\n  '233': 233, '234': 234, '235': 235, '236': 236, '237': 237, '238': 238, '239': 239, '240': 240,\n  '241': 241, '242': 242, '243': 243, '244': 244, '245': 245, '246': 246, '247': 247, '248': 248,\n  '249': 249, '250': 250, '251': 251, '252': 252, '253': 253, '254': 254, '255': 255, '256': 256,\n  '257': 257, '258': 258, '259': 259, '260': 260, '261': 261, '262': 262, '263': 263, '264': 264,\n  '265': 265, '266': 266, '267': 267, '268': 268, '269': 269, '270': 270, '271': 271, '272': 272,\n  '273': 273, '274': 274, '275': 275, '276': 276, '277': 277, '278': 278, '279': 279, '280': 280,\n  '281': 281, '282': 282, '283': 283, '284': 284, '285': 285, '286': 286, '287': 287, '288': 288,\n  '289': 289, '290': 290, '291': 291, '292': 292, '293': 293, '294': 294, '295': 295, '296': 296,\n  '297': 297, '298': 298, '299': 299, '300': 300, '301': 301, '302': 302, '303': 303, '304': 304,\n  '305': 305, '306': 306, '307': 307, '308': 308, '309': 309, '310': 310, '311': 311, '312': 312,\n  '313': 313, '314': 314, '315': 315, '316': 316, '317': 317, '318': 318, '319': 319, '320': 320,\n  '321': 321, '322': 322, '323': 323, '324': 324, '325': 325, '326': 326, '327': 327, '328': 328,\n  '329': 329, '330': 330, '331': 331, '332': 332, '333': 333, '334': 334, '335': 335, '336': 336,\n  '337': 337, '338': 338, '339': 339, '340': 340, '341': 341, '342': 342, '343': 343, '344': 344,\n  '345': 345, '346': 346, '347': 347, '348': 348, '349': 349, '350': 350, '351': 351, '352': 352,\n  '353': 353, '354': 354, '355': 355, '356': 356, '357': 357, '358': 358, '359': 359, '360': 360,\n  '361': 361, '362': 362, '363': 363, '364': 364, '365': 365, '366': 366, '367': 367, '368': 368,\n  '369': 369, '370': 370, '371': 371, '372': 372, '373': 373, '374': 374, '375': 375, '376': 376,\n  '377': 377, '378': 378, '379': 379, '380': 380, '381': 381, '382': 382, '383': 383, '384': 384,\n  '385': 385, '386': 386, '387': 387, '388': 388, '389': 389, '390': 390, '391': 391, '392': 392,\n  '393': 393, '394': 394, '395': 395, '396': 396, '397': 397, '398': 398, '399': 399, '400': 400,\n  '401': 401, '402': 402, '403': 403, '404': 404, '405': 405, '406': 406, '407': 407, '408': 408,\n  '409': 409, '410': 410, '411': 411, '412': 412, '413': 413, '414': 414, '415': 415, '416': 416,\n  '417': 417, '418': 418, '419': 419, '420': 420, '421': 421, '422': 422, '423': 423, '424': 424,\n  '425': 425, '426': 426, '427': 427, '428': 428, '429': 429, '430': 430, '431': 431, '432': 432,\n  '433': 433, '434': 434, '435': 435, '436': 436, '437': 437, '438': 438, '439': 439, '440': 440,\n  '441': 441, '442': 442, '443': 443, '444': 444, '445': 445, '446': 446, '447': 447, '448': 448,\n  '449': 449, '450': 450, '451': 451, '452': 452, '453': 453, '454': 454, '455': 455, '456': 456,\n  '457': 457, '458': 458, '459': 459, '460': 460, '461': 461, '462': 462, '463': 463, '464': 464,\n  '465': 465, '466': 466, '467': 467, '468': 468, '469': 469, '470': 470, '471': 471, '472': 472,\n  '473': 473, '474': 474, '475': 475, '476': 476, '477': 477, '478': 478, '479': 479, '480': 480,\n  '481': 481, '482': 482, '483': 483, '484': 484, '485': 485, '486': 486, '487': 487, '488': 488,\n  '489': 489, '490': 490, '491': 491, '492': 492, '493': 493, '494': 494, '495': 495, '496': 496,\n  '497': 497, '498': 498, '499': 499, '500': 500, '501': 501, '502': 502, '503': 503, '504': 504,\n  '505': 505, '506': 506, '507': 507, '508': 508, '509': 509, '510': 510, '511': 511, '512': 512,\n  '513': 513, '514': 514, '515': 515, '516': 516, '517': 517, '518': 518, '519': 519, '520': 520,\n  '521': 521, '522': 522, '523': 523, '524': 524, '525': 525, '526': 526, '527': 527, '528': 528,\n  '529': 529, '530': 530, '531': 531, '532': 532, '533': 533, '534': 534, '535': 535, '536': 536,\n  '537': 537, '538': 538, '539': 539, '540': 540, '541': 541, '542': 542, '543': 543, '544': 544,\n  '545': 545, '546': 546, '547': 547, '548': 548, '549': 549, '550': 550, '551': 551, '552': 552,\n  '553': 553, '554': 554, '555': 555, '556': 556, '557': 557, '558': 558, '559': 559, '560': 560,\n  '561': 561, '562': 562, '563': 563, '564': 564, '565': 565, '566': 566, '567': 567, '568': 568,\n  '569': 569, '570': 570, '571': 571, '572': 572, '573': 573, '574': 574, '575': 575, '576': 576,\n  '577': 577, '578': 578, '579': 579, '580': 580, '581': 581, '582': 582, '583': 583, '584': 584,\n  '585': 585, '586': 586, '587': 587, '588': 588, '589': 589, '590': 590, '591': 591, '592': 592,\n  '593': 593, '594': 594, '595': 595, '596': 596, '597': 597, '598': 598, '599': 599, '600': 600,\n  '601': 601, '602': 602, '603': 603, '604': 604, '605': 605, '606': 606, '607': 607, '608': 608,\n  '609': 609, '610': 610, '611': 611, '612': 612, '613': 613, '614': 614, '615': 615, '616': 616,\n  '617': 617, '618': 618, '619': 619, '620': 620, '621': 621, '622': 622, '623': 623, '624': 624,\n  '625': 625, '626': 626, '627': 627, '628': 628, '629': 629, '630': 630, '631': 631, '632': 632,\n  '633': 633, '634': 634, '635': 635, '636': 636, '637': 637, '638': 638, '639': 639, '640': 640,\n  '641': 641, '642': 642, '643': 643, '644': 644, '645': 645, '646': 646, '647': 647, '648': 648,\n  '649': 649, '650': 650, '651': 651, '652': 652, '653': 653, '654': 654, '655': 655, '656': 656,\n  '657': 657, '658': 658, '659': 659, '660': 660, '661': 661, '662': 662, '663': 663, '664': 664,\n  '665': 665, '666': 666, '667': 667, '668': 668, '669': 669, '670': 670, '671': 671, '672': 672,\n  '673': 673, '674': 674, '675': 675, '676': 676, '677': 677, '678': 678, '679': 679, '680': 680,\n  '681': 681, '682': 682, '683': 683, '684': 684, '685': 685, '686': 686, '687': 687, '688': 688,\n  '689': 689, '690': 690, '691': 691, '692': 692, '693': 693, '694': 694, '695': 695, '696': 696,\n  '697': 697, '698': 698, '699': 699, '700': 700, '701': 701, '702': 702, '703': 703, '704': 704,\n  '705': 705, '706': 706, '707': 707, '708': 708, '709': 709, '710': 710, '711': 711, '712': 712,\n  '713': 713, '714': 714, '715': 715, '716': 716, '717': 717, '718': 718, '719': 719, '720': 720,\n  '721': 721, '722': 722, '723': 723, '724': 724, '725': 725, '726': 726, '727': 727, '728': 728,\n  '729': 729, '730': 730, '731': 731, '732': 732, '733': 733, '734': 734, '735': 735, '736': 736,\n  '737': 737, '738': 738, '739': 739, '740': 740, '741': 741, '742': 742, '743': 743, '744': 744,\n  '745': 745, '746': 746, '747': 747, '748': 748, '749': 749, '750': 750, '751': 751, '752': 752,\n  '753': 753, '754': 754, '755': 755, '756': 756, '757': 757, '758': 758, '759': 759, '760': 760,\n  '761': 761, '762': 762, '763': 763, '764': 764, '765': 765, '766': 766, '767': 767, '768': 768,\n  '769': 769, '770': 770, '771': 771, '772': 772, '773': 773, '774': 774, '775': 775, '776': 776,\n  '777': 777, '778': 778, '779': 779, '780': 780, '781': 781, '782': 782, '783': 783, '784': 784,\n  '785': 785, '786': 786, '787': 787, '788': 788, '789': 789, '790': 790, '791': 791, '792': 792,\n  '793': 793, '794': 794, '795': 795, '796': 796, '797': 797, '798': 798, '799': 799, '800': 800,\n  '801': 801, '802': 802, '803': 803, '804': 804, '805': 805, '806': 806, '807': 807, '808': 808,\n  '809': 809, '810': 810, '811': 811, '812': 812, '813': 813, '814': 814, '815': 815, '816': 816,\n  '817': 817, '818': 818, '819': 819, '820': 820, '821': 821, '822': 822, '823': 823, '824': 824,\n  '825': 825, '826': 826, '827': 827, '828': 828, '829': 829, '830': 830, '831': 831, '832': 832,\n  '833': 833, '834': 834, '835': 835, '836': 836, '837': 837, '838': 838, '839': 839, '840': 840,\n  '841': 841, '842': 842, '843': 843, '844': 844, '845': 845, '846': 846, '847': 847, '848': 848,\n  '849': 849, '850': 850, '851': 851, '852': 852, '853': 853, '854': 854, '855': 855, '856': 856,\n  '857': 857, '858': 858, '859': 859, '860': 860, '861': 861, '862': 862, '863': 863, '864': 864,\n  '865': 865, '866': 866, '867': 867, '868': 868, '869': 869, '870': 870, '871': 871, '872': 872,\n  '873': 873, '874': 874, '875': 875, '876': 876, '877': 877, '878': 878, '879': 879, '880': 880,\n  '881': 881, '882': 882, '883': 883, '884': 884, '885': 885, '886': 886, '887': 887, '888': 888,\n  '889': 889, '890': 890, '891': 891, '892': 892, '893': 893, '894': 894, '895': 895, '896': 896,\n  '897': 897, '898': 898, '899': 899, '900': 900, '901': 901, '902': 902, '903': 903, '904': 904,\n  '905': 905, '906': 906, '907': 907, '908': 908, '909': 909, '910': 910, '911': 911, '912': 912,\n  '913': 913, '914': 914, '915': 915, '916': 916, '917': 917, '918': 918, '919': 919, '920': 920,\n  '921': 921, '922': 922, '923': 923, '924': 924, '925': 925, '926': 926, '927': 927, '928': 928,\n  '929': 929, '930': 930, '931': 931, '932': 932, '933': 933, '934': 934, '935': 935, '936': 936,\n  '937': 937, '938': 938, '939': 939, '940': 940, '941': 941, '942': 942, '943': 943, '944': 944,\n  '945': 945, '946': 946, '947': 947, '948': 948, '949': 949, '950': 950, '951': 951, '952': 952,\n  '953': 953, '954': 954, '955': 955, '956': 956, '957': 957, '958': 958, '959': 959, '960': 960,\n  '961': 961, '962': 962, '963': 963, '964': 964, '965': 965, '966': 966, '967': 967, '968': 968,\n  '969': 969, '970': 970, '971': 971, '972': 972, '973': 973, '974': 974, '975': 975, '976': 976,\n  '977': 977, '978': 978, '979': 979, '980': 980, '981': 981, '982': 982, '983': 983, '984': 984,\n  '985': 985, '986': 986, '987': 987, '988': 988, '989': 989, '990': 990, '991': 991, '992': 992,\n  '993': 993, '994': 994, '995': 995, '996': 996, '997': 997, '998': 998, '999': 999, '1000': 1000,\n  '1001': 1001, '1002': 1002, '1003': 1003, '1004': 1004, '1005': 1005, '1006': 1006, '1007': 1007, '1008': 1008,\n  '1009': 1009, '1010': 1010, '1011': 1011, '1012': 1012, '1013': 1013, '1014': 1014, '1015': 1015, '1016': 1016,\n  '1017': 1017, '1018': 1018, '1019': 1019, '1020': 1020, '1021': 1021, '1022': 1022, '1023': 1023, '1024': 1024 };\n\nfor (i = 1; i <= 1024; i++)\n{\n  assert (data[i] === i);\n}\n"
  },
  {
    "path": "tests/jerry/object-methods.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (JSON.stringify (Object.getOwnPropertyNames(\"hello\")) === '[\"0\",\"1\",\"2\",\"3\",\"4\",\"length\"]');\n\nvar n = Object.assign(42, {a: \"str\"});\nassert (n instanceof Number);\nassert (n.valueOf() === 42);\nassert (n.a === \"str\");\n\nassert (JSON.stringify (Object.getOwnPropertySymbols(\"hello\")) === '[]');\n\nassert (JSON.stringify (Object.keys(\"str\")) === '[\"0\",\"1\",\"2\"]');\n\nvar d = Object.getOwnPropertyDescriptor(\"hello\", '1');\nassert (d.value === \"e\");\nassert (d.writable === false);\nassert (d.enumerable === true);\nassert (d.configurable === false);\n\nassert (Object.seal(42) === 42);\nassert (Object.seal(\"a\") === \"a\");\nassert (Object.seal(undefined) === undefined);\nassert (Object.seal() === undefined);\n\nassert (Object.isSealed(42) === true);\nassert (Object.isSealed(\"a\") === true);\nassert (Object.isSealed(undefined) === true);\nassert (Object.isSealed() === true);\n\nassert (Object.freeze(42) === 42);\nassert (Object.freeze(\"a\") === \"a\");\nassert (Object.freeze(undefined) === undefined);\nassert (Object.freeze() === undefined);\n\nassert (Object.isFrozen(42) === true);\nassert (Object.isFrozen(\"a\") === true);\nassert (Object.isFrozen(undefined) === true);\nassert (Object.isFrozen() === true);\n\nassert (Object.preventExtensions(42) === 42);\nassert (Object.preventExtensions(\"a\") === \"a\");\nassert (Object.preventExtensions(undefined) === undefined);\nassert (Object.preventExtensions() === undefined);\n\nassert (Object.isExtensible(42) === false);\nassert (Object.isExtensible(\"a\") === false);\nassert (Object.isExtensible(undefined) === false);\nassert (Object.isExtensible() === false);\n"
  },
  {
    "path": "tests/jerry/object-pattern.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction checkSyntax (str) {\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\nfunction mustThrow (str) {\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n}\n\ncheckSyntax (\"var {a}\");\ncheckSyntax (\"var {a, o.a}\");\ncheckSyntax (\"var {a,,} = 4\");\ncheckSyntax (\"var {a :} = 4\");\ncheckSyntax (\"var {a : ,} = 4\");\ncheckSyntax (\"var {a : ['foobar']} = 4\");\ncheckSyntax (\"var {let}\");\ncheckSyntax (\"var {get = []\");\ncheckSyntax (\"var {get : 5}\");\ncheckSyntax (\"var {[a = {},}\");\ncheckSyntax (\"let {a,a} = []\");\ncheckSyntax (\"let {a : b, b} = []\");\ncheckSyntax (\"const {a,a} = []\");\ncheckSyntax (\"const {a : b, b} = []\");\ncheckSyntax (\"try { let {$} = $;\");\ncheckSyntax (\"let a, { 'x': a } = {x : 4};\");\ncheckSyntax (\"let a, { x: b.c } = {x : 6};\");\ncheckSyntax (\"let {a:(a)} = {a:1}\");\n\nmustThrow (\"var {a} = null\");\nmustThrow (\"var {a} = undefined\");\nmustThrow (\"function f ({a : {}}) {}; f({});\");\nmustThrow (\"function f ({}) {}; f();\");\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment\n\n// Basic assignment\n(function () {\n  var o = {p: 42, q: true};\n  var {p, q} = o;\n\n  assert (p === 42);\n  assert (q === true);\n}) ();\n\n// Assignment without declaration\n(function () {\n  var a, b;\n  ({a, b} = {a: 1, b: 2});\n\n  assert (a === 1);\n  assert (b === 2);\n}) ();\n\n// Assigning to new variable names\n(function () {\n  var o = {p: 42, q: true};\n  var {p: foo, q: bar} = o;\n\n  assert (foo === 42);\n  assert (bar === true);\n}) ();\n\n// Default values\n(function () {\n  var {a = 10, b = 5} = {a: 3};\n\n  assert (a === 3);\n  assert (b === 5);\n}) ();\n\n\n// Assigning to new variables names and providing default values\n(function () {\n  var {a: aa = 10, b: bb = 5} = {a: 3};\n\n  assert (aa === 3);\n  assert (bb === 5);\n}) ();\n\n// Nested object and array destructuring\n(function () {\n  const metadata = {\n    title: 'Scratchpad',\n    translations: [\n      {\n        locale: 'de',\n        localization_tags: [],\n        last_edit: '2014-04-14T08:43:37',\n        url: '/de/docs/Tools/Scratchpad',\n        title: 'JavaScript-Umgebung'\n      }\n    ],\n    url: '/en-US/docs/Tools/Scratchpad'\n  };\n\n  let {\n    title: englishTitle, // rename\n    translations: [\n      {\n         title: localeTitle, // rename\n      },\n    ],\n  } = metadata;\n\n  assert (englishTitle === \"Scratchpad\");\n  assert (localeTitle === \"JavaScript-Umgebung\");\n}) ();\n\n// Computed object property names and destructuring\n(function () {\n  let key = 'z';\n  let {[key]: foo} = {z: 'bar'};\n\n  assert (foo === \"bar\");\n}) ();\n\n// Invalid JavaScript identifier as a property name\n(function () {\n  const foo = { 'fizz-buzz': true };\n  const { 'fizz-buzz': fizzBuzz } = foo;\n\n  assert (fizzBuzz === true);\n}) ();\n\n// Combined Array and Object Destructuring\n(function () {\n  const props = [\n    { id: 1, name: 'Fizz'},\n    { id: 2, name: 'Buzz'},\n    { id: 3, name: 'FizzBuzz'}\n  ];\n\n  const [,, { name }] = props;\n\n  assert (name === \"FizzBuzz\");\n}) ();\n\n// The prototype chain is looked up when the object is deconstructed\n(function () {\n  var obj = {self: '123'};\n  Object.getPrototypeOf(obj).prot = '456';\n  const {self, prot} = obj;\n  assert (self === '123');\n  assert (prot === '456');\n}) ();\n\n// Test inner patterns I.\n(function () {\n  var a,b,c,d,e;\n  var o = { a : { b: 2 }, c: 1, d: { e: undefined } };\n  var { e: { b : a } = { b : 2, a : 1}, d: { e: { b : e = 2} = { b } } } = o;\n  assert (a === 2);\n  assert (b === undefined);\n  assert (c === undefined);\n  assert (d === undefined);\n  assert (e === 2);\n}) ();\n\n// Test inner patterns II.\n(function () {\n  var a,b,c,d,e;\n  var o = { a : [{ b : 2 ,}, d], e : 5 };\n\n  var { a: [{b, c  = 3}, d = 4], e } = o;\n  assert (a === undefined);\n  assert (b === 2);\n  assert (c === 3);\n  assert (d === 4);\n  assert (e === 5);\n}) ();\n\n// Multiple declaration\n(function () {\n  var {a} = {a : 1}, {b} = {b : 2};\n\n  assert (a === 1);\n  assert (b === 2);\n}) ();\n\n// Force the creation of lexical environment I.\n(function () {\n  const {a} = {a : 1};\n  eval();\n\n  assert (a === 1);\n}) ();\n\n// Force the creation of lexical environment II.\n(function () {\n  let {a} = {a : 1};\n  eval();\n\n  assert (a === 1);\n}) ();\n\n// Check the parsing of AssignmentElement\n(function () {\n  var a = 6;\n  ({\"a\": ((a)) } = {a : 7});\n  assert (a === 7);\n}) ();\n\n(function () {\n  var o = {};\n\n  ({ a : o.c } = { get a() { return 5.2 }})\n\n  assert(o.c == 5.2);\n}) ();\n\ntry {\n  eval (\"var a = 0; -{a} = {a:1}\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nvar abruptObj = Object.defineProperty({}, 'a', {\n  get() { throw 5.2; }\n});\n\ntry {\n  const { a } = abruptObj;\n  assert (false);\n} catch (e) {\n  assert (e === 5.2);\n}\n"
  },
  {
    "path": "tests/jerry/object-pattern2.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction checkSyntax (str) {\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\ncheckSyntax (\"var {a, ...b, a} = {}\")\ncheckSyntax (\"var {a, ...b = 6} = {}\")\ncheckSyntax (\"var {a, ...[b]} = {}\")\ncheckSyntax (\"function f({a, ...a}) {}\")\ncheckSyntax (\"let {a, ...a} = {}\")\ncheckSyntax (\"let {a, ...(b)} = {}\")\ncheckSyntax (\"({a, ...{b}} = {})\")\ncheckSyntax (\"({a, ...([b])} = {})\")\ncheckSyntax (\"({a, ...b().a = 6} = {})\")\ncheckSyntax (\"try {} catch ({ ...a } = {}) {}\")\ncheckSyntax (\"for ({ ...a } = {} of []) {}\")\n\nvar sym1 = Symbol(\"sym1\")\nvar sym2 = Symbol(\"sym2\")\n\nfunction rest_compare(rest, values)\n{\n  var keys = Reflect.ownKeys(rest);\n\n  assert(keys.length * 2 === values.length)\n\n  for (var i = 0; i < keys.length; i++) {\n    key = keys[i]\n    assert(key === values[i * 2])\n    assert(rest[key] === values[i * 2 + 1])\n  }\n}\n\nfunction f1() {\n  var { bb, ...rest } = { a:true, bb:6.25, [sym1]:\"X\" }\n\n  assert(bb === 6.25)\n  rest_compare(rest, [\"a\", true, sym1, \"X\"])\n}\nf1()\n\nfunction f2() {\n  var a, b, rest = {};\n\n  ({ a, \"+\": b, ...rest.c } = { \"+\": -3.75, [sym1]:6.25, [sym2]: sym2 })\n\n  assert(a === undefined)\n  assert(b === -3.75)\n  rest_compare(rest.c, [sym1, 6.25, sym2, sym2])\n}\nf2()\n\nfunction f3() {\n  var a, rest1, rest2;\n\n  ({ A:{ [sym2]: a, ...rest1 }, B:{ ...rest2 } = { X:null, 7:\"A\" } } = { A:{ [sym1]: 7.5, [sym2]: 3.5, S:-5.5 } })\n\n  assert(a === 3.5)\n  rest_compare(rest1, [\"S\", -5.5, sym1, 7.5])\n  rest_compare(rest2, [\"7\", \"A\", \"X\", null])\n}\nf3()\n\nfunction f4() {\n  try {\n    throw { A:5, [sym1]:6, [sym2]:7, b:8 }\n    assert(false)\n  } catch({ b, c, ...rest }) {\n    assert(b === 8)\n    assert(c === undefined)\n    rest_compare(rest, [\"A\", 5, sym1, 6, sym2, 7])\n  }\n}\nf4()\n\nfunction f5() {\n  var a = {}, b = {}, c = {}, d = () => c\n\n  for ({ A:a.x, B:b.y, ...d().z } of [ { B:\"AA\", C:6.25, [sym1]:-4.5 } ]) {\n    assert(a.x === undefined)\n    assert(typeof Object.getOwnPropertyDescriptor(a, \"x\") === \"object\")\n    assert(b.y === \"AA\")\n    rest_compare(c.z, [\"C\", 6.25, sym1, -4.5])\n  }\n}\nf5()\n\nfunction f6({ [(() => \"A\")() + \"A\"]:a, ...b },\n            { A:c, [sym1]:d, [sym2]:e, ...f } = { A:\"X\", [sym2]: 5.5 }) {\n  assert(a === 6)\n  rest_compare(b, [\"B\", 7, sym1, 8.25])\n  assert(c === \"X\")\n  assert(d === undefined)\n  assert(e === 5.5)\n  rest_compare(f, [])\n}\nf6({ [sym1]:8.25, B:7, AA:6 })\n\nfunction f7() {\n  var b, o = {}, rest\n\n  ({ [\"A\" + \"A\"]:b, ...{o}.o.rest } = { [sym1]:5.5, A:\"X\", AA:-0.25 })\n\n  assert(b === -0.25)\n  rest_compare(o.rest, [ \"A\", \"X\", sym1, 5.5])\n}\nf7()\n\nfunction f8() {\n  var a, b;\n\n  ({ ...(b) } = { })\n  rest_compare(b, []);\n\n  [a,a,...{ ...b  }] = [\"A\", \"B\", \"C\", \"D\"]\n  rest_compare(b, [\"0\", \"C\", \"1\", \"D\"])\n}\nf8()\n\nfunction f9() {\n  var counter = 0;\n\n  for (const { ...rest} in { B: \"AA\", C: 6.25 }) {\n    switch (counter) {\n      case 0: {\n        /* rest === { '0': 'B' } */\n        assert(rest['0'] === 'B');\n        break;\n        }\n      case 1: {\n        /* rest === { '0': 'C' } */\n        assert(rest['0'] == 'C');\n        break;\n      }\n    }\n    counter++;\n  }\n  assert(counter === 2);\n}\nf9()\n"
  },
  {
    "path": "tests/jerry/object-property-redefiniton.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction checkOwnProperties(obj, propList)\n{\n  names = Object.getOwnPropertyNames(obj)\n  assert(names.length === propList.length)\n\n  for (var i = 0; i < propList.length; ++i)\n  {\n    assert(names[i] === propList[i])\n\n    var descriptor = Object.getOwnPropertyDescriptor(obj, names[i])\n    if (i % 2 == 0) {\n      assert(descriptor.writable == true);\n      assert(descriptor.enumerable == true);\n      assert(descriptor.configurable == true);\n      assert(descriptor.get === undefined);\n      assert(descriptor.set === undefined);\n    } else {\n      assert(descriptor.writable == undefined);\n      assert(descriptor.enumerable == true);\n      assert(descriptor.configurable == true);\n      assert(descriptor.get !== undefined || descriptor.set !== undefined);\n    }\n  }\n}\n\nvar o = {\n  get a() {},\n  b:6,\n  set c(_) {\n  },\n  d:10,\n  a: 11,\n  get b () {},\n  c: 12,\n  set d (_) {}\n}\n\ncheckOwnProperties(o, ['a', 'b', 'c', 'd']);\n"
  },
  {
    "path": "tests/jerry/object-prototype-define-getter.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar o = {};\no.__defineGetter__('foo', function() { return 5; });\nassert(o.foo === 5);\n\nvar obj = {};\nfunction bar() { return \"bar\"; }\nObject.prototype.__defineGetter__.call(obj, \"foo\", bar);\nvar prop = Object.getOwnPropertyDescriptor(obj, \"foo\");\nassert(prop.get == bar);\nassert(!prop.writable);\nassert(prop.configurable);\nassert(prop.enumerable);\n\nvar obj = {};\nvar sym = Symbol();\nfunction bar() { return \"bar\"; }\nObject.prototype.__defineGetter__.call(obj, sym, bar);\nvar prop = Object.getOwnPropertyDescriptor(obj, sym);\nassert(prop.get == bar);\nassert(!prop.writable);\nassert(prop.configurable);\nassert(prop.enumerable);;\n\nvar key = '__accessors_test__';\nObject.prototype.__defineGetter__.call(1, key, function(){});\n\ntry {\n  Object.prototype.__defineGetter__.call(null, key, function(){});\n  assert(false);\n} catch(e){\n  assert(e instanceof TypeError);\n}\n\nvar def = [];\nvar p = new Proxy({}, { defineProperty: function(o, v, desc) { def.push(v); Object.defineProperty(o, v, desc); return true; }});\nObject.prototype.__defineGetter__.call(p, \"foo\", Object);\nassert(def + '' === \"foo\");\n\nvar func = function() {};\nvar subject = Object.defineProperty(\n  {}, 'foo', { value: 1, configurable: false }\n);\n\ntry {\n  subject.__defineGetter__('foo', func);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar subject = Object.preventExtensions({ existing: null });\n\nsubject.__defineGetter__('existing', func);\n\ntry {\n  subject.__defineGetter__('brand new', func);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar __defineGetter__ = Object.prototype.__defineGetter__;\nvar counter = 0;\nvar key = {\n  toString: function() {\n    counter += 1;\n  }\n};\n\ntry {\n  __defineGetter__.call(undefined, key, func);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  __defineGetter__.call(null, key, func);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(counter === 0);\n\nvar subject = {};\nvar symbol = Symbol('');\nvar counter = 0;\nvar key = {\n  toString: function() {\n    counter += 1;\n  }\n};\n\ntry {\n  subject.__defineGetter__(key, '');\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  subject.__defineGetter__(key, 23);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  subject.__defineGetter__(key, true);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  subject.__defineGetter__(key, symbol);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  subject.__defineGetter__(key, {});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(counter === 0);\n"
  },
  {
    "path": "tests/jerry/object-prototype-define-setter.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar o = {};\no.__defineSetter__('foo', function(val) { this.bar = val; });\no.foo = 5;\nassert(o.foo === undefined); // undefined\nassert(o.bar === 5); \n\nvar obj = {};\nfunction bar() {}\nObject.prototype.__defineSetter__.call(obj, \"foo\", bar);\nvar prop = Object.getOwnPropertyDescriptor(obj, \"foo\");\nassert(prop.set === bar);\nassert(!prop.writable);\nassert(prop.configurable);\nassert(prop.enumerable);\n\nvar obj = {};\nvar sym = Symbol();\nfunction bar(baz) {}\nObject.prototype.__defineSetter__.call(obj, sym, bar);\nvar prop = Object.getOwnPropertyDescriptor(obj, sym);\nassert(prop.set === bar);\nassert(!prop.writable);\nassert(prop.configurable);\nassert(prop.enumerable);\n\nvar key = '__accessors_test__';\nObject.prototype.__defineSetter__.call(1, key, function(){});\n\ntry {\n  Object.prototype.__defineSetter__.call(null, key, function(){});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar def = [];\nvar p = new Proxy({}, { defineProperty: function(o, v, desc) { def.push(v); Object.defineProperty(o, v, desc); return true; }});\nObject.prototype.__defineSetter__.call(p, \"foo\", Object);\nassert(def + '' === \"foo\");\n\nvar func = function() {};\nvar subject = Object.defineProperty(\n  {}, 'attr', { value: 1, configurable: false }\n);\n\ntry {\n  subject.__defineSetter__('attr', func);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar subject = Object.preventExtensions({ existing: null });\n\nsubject.__defineSetter__('existing', func);\n\ntry {\n  subject.__defineSetter__('brand new', func);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar __defineSetter__ = Object.prototype.__defineSetter__;\nvar counter = 0;\nvar key = {\n  toString: function() {\n    counter += 1;\n  }\n};\n\ntry {\n  __defineSetter__.call(undefined, key, func);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  __defineSetter__.call(null, key, func);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(counter === 0);\n\nvar subject = {};\nvar symbol = Symbol('');\nvar counter = 0;\nvar key = {\n  toString: function() {\n    counter += 1;\n  }\n};\n\ntry {\n  subject.__defineSetter__(key, '');\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  subject.__defineSetter__(key, 23);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  subject.__defineSetter__(key, true);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  subject.__defineSetter__(key, symbol);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  subject.__defineSetter__(key, {});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(counter === 0);\n"
  },
  {
    "path": "tests/jerry/object-prototype-hasownproperty.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj1 = {};\nobj1.prop = \"hi\";\n\nassert (obj1.hasOwnProperty('prop') === true);\nassert (obj1.hasOwnProperty('NO_PROP') === false);\n\n\n// Test if the toString fails.\ntry {\n  obj1.hasOwnProperty({toString: function() { throw new ReferenceError (\"foo\"); }});\n\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// Test if the toObject fails.\n\nvar obj2;\ntry {\n  obj2.hasOwnProperty(\"fail\");\n\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar obj_undef;\nvar obj3 = {};\nObject.defineProperty(obj3, 'Test', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\nassert (obj3.hasOwnProperty(\"Test\") === true);\n\nObject.defineProperty(obj3, 'Test2', { 'get' : function () { return 0/0; } });\nassert (obj3.hasOwnProperty(\"Test2\") === true);\n\nObject.defineProperty(obj3, 'Test4', { 'get' : function () { return obj_undef; } });\nassert (obj3.hasOwnProperty(\"Test4\") === true);\n"
  },
  {
    "path": "tests/jerry/object-prototype-isprototypeof.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction Function_A() { }\nfunction Function_B() { }\nFunction_B.prototype = new Function_A();\n\nfunction Function_C() { }\nFunction_C.prototype = new Function_B();\n\nfunction Function_D() { }\nFunction_D.prototype = new Function_C();\n\nvar d_instance = new Function_D();\n\nassert (Function_A.prototype.isPrototypeOf (d_instance) === true)\nassert (Function_A.prototype.isPrototypeOf (Array) === false)\n\n\nassert (Function_A.prototype.isPrototypeOf.call(0, 0) === false);\nassert (Function_A.prototype.isPrototypeOf.call(Function_A, 0) === false);\n\nassert (Function.prototype.isPrototypeOf (Object) === true)\n"
  },
  {
    "path": "tests/jerry/object-prototype-lookup-getter.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {\n  get foo() { return \"bar\" },\n  qux: 1,\n  set bar(value) { this.x = value }\n};\n\nvar foo = Object.prototype.__lookupGetter__.call(obj, \"foo\");\nassert(foo() === \"bar\");\nassert(Object.prototype.__lookupGetter__.call(obj, \"qux\") === undefined);\nassert(Object.prototype.__lookupGetter__.call(obj, \"baz\") === undefined);\nassert(Object.prototype.__lookupGetter__.call(obj, \"bar\") === undefined);\n\nvar foo = Object.prototype.__lookupGetter__.call(Object.create(obj), \"foo\");\nassert(foo() === \"bar\");\nassert(Object.prototype.__lookupGetter__.call(obj, \"qux\") === undefined);\nassert(Object.prototype.__lookupGetter__.call(obj, \"baz\") === undefined);\nassert(Object.prototype.__lookupGetter__.call(obj, \"bar\") === undefined);\n\nvar sym = Symbol();\nvar sym2 = Symbol();\nvar obj = {};\nObject.defineProperty(obj, sym, { get: function() { return \"bar\"; }});\nObject.defineProperty(obj, sym2, { value: 1 });\nvar foo = Object.prototype.__lookupGetter__.call(obj, sym);\n\nassert(foo() === \"bar\");\nassert(Object.prototype.__lookupGetter__.call(obj, sym2) === undefined);\nassert(Object.prototype.__lookupGetter__.call(obj, Symbol()) === undefined);\n\nObject.prototype.__lookupGetter__.call(1, 'key');\n\ntry {\n  Object.prototype.__lookupGetter__.call(null, 'key');\n  assert(false);\n} catch(e){\n  assert(e instanceof TypeError);\n}\n\nvar a = {};\nvar b = Object.create(a);\nb.foo = 1;\nObject.defineProperty(a, \"foo\", {function () {}})\nassert(b.__lookupGetter__(\"foo\") === undefined);\n\nvar gopd = [];\nvar gpo = false;\nvar p = new Proxy({}, {\n  getPrototypeOf: function(o) { gpo = true; return Object.getPrototypeOf(o); },\n  getOwnPropertyDescriptor: function(o, v) { gopd.push(v); return Object.getOwnPropertyDescriptor(o, v); }\n});\n\nObject.prototype.__lookupGetter__.call(p, \"foo\");\nassert(gopd + '' === \"foo\");\nassert(gpo === true);\n\nvar __lookupGetter__ = Object.prototype.__lookupGetter__;\nvar counter = 0;\nvar key = {\n  toString: function() {\n    counter += 1;\n  }\n};\n\ntry {\n  __lookupGetter__.call(undefined, key);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  __lookupGetter__.call(null, key);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(counter === 0);\n"
  },
  {
    "path": "tests/jerry/object-prototype-lookup-setter.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {\n  set foo(value) { return \"bar\" },\n  qux: 1,\n  get bar() {}\n};\n  \nvar foo = Object.prototype.__lookupSetter__.call(obj, \"foo\");\nassert(foo() === \"bar\");\nassert(Object.prototype.__lookupSetter__.call(obj, \"qux\") === undefined);\nassert(Object.prototype.__lookupSetter__.call(obj, \"baz\") === undefined);\nassert(Object.prototype.__lookupSetter__.call(obj, \"bar\") === undefined);\n\nvar foo = Object.prototype.__lookupSetter__.call(Object.create(obj), \"foo\");\nassert(foo() === \"bar\");\nassert(Object.prototype.__lookupSetter__.call(obj, \"qux\") === undefined);\nassert(Object.prototype.__lookupSetter__.call(obj, \"baz\") === undefined);\nassert(Object.prototype.__lookupSetter__.call(obj, \"bar\") === undefined);\n\nvar sym = Symbol();\nvar sym2 = Symbol();\nvar obj = {};\nObject.defineProperty(obj, sym, { set: function(value) { return \"bar\"; }});\nObject.defineProperty(obj, sym2, { value: 1 });\nvar foo = Object.prototype.__lookupSetter__.call(obj, sym);\n\nassert(foo() === \"bar\");\nassert(Object.prototype.__lookupSetter__.call(obj, sym2) === undefined);\nassert(Object.prototype.__lookupSetter__.call(obj, Symbol()) === undefined);\n\nObject.prototype.__lookupSetter__.call(1, 'key');\n\ntry {\n  Object.prototype.__lookupSetter__.call(null, 'key');\n  assert(false);\n} catch(e){\n  assert(e instanceof TypeError);\n}\n\nvar a = {};\nvar b = Object.create(a);\nb.foo = 1;\nObject.defineProperty(a, \"foo\", {function () {}})\nassert(b.__lookupSetter__(\"foo\") === undefined);\n\nvar gopd = [];\nvar gpo = false;\nvar p = new Proxy({}, {\n  getPrototypeOf: function(o) { gpo = true; return Object.getPrototypeOf(o); },\n  getOwnPropertyDescriptor: function(o, v) { gopd.push(v); return Object.getOwnPropertyDescriptor(o, v); }\n});\n\nObject.prototype.__lookupSetter__.call(p, \"foo\");\nassert(gopd + '' === \"foo\");\nassert(gpo);\n\nvar __lookupSetter__ = Object.prototype.__lookupSetter__;\nvar counter = 0;\nvar key = {\n  toString: function() {\n    counter += 1;\n  }\n};\n\ntry {\n  __lookupSetter__.call(undefined, key);  \n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  __lookupSetter__.call(null, key);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError); \n}\n\nassert(counter === 0);\n"
  },
  {
    "path": "tests/jerry/object-prototype-property.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Tests that if multiple properties with the same name is\n// in the prototype chain, only the first one is inspected\n\nvar not_called = 0;\nvar called = 0;\n\nfunction accessor_proto() {\n  Object.defineProperty(this, \"prop\",\n    { get: function() { return 3.5 }, set: function(v) { called++ } }\n  )\n}\n\nfunction data_proto() {\n  Object.defineProperty(this, \"prop\",\n    { value:7, writable:true }\n  )\n}\n\naccessor_proto.prototype = { get prop() { not_called++ }, set prop(v) { not_called++ } }\ndata_proto.prototype = accessor_proto.prototype\n\nfunction create_accessor() {}\nfunction create_data() {}\n\ncreate_accessor.prototype = new accessor_proto();\ncreate_data.prototype = new data_proto();\n\nvar o = new create_accessor()\no.prop = 1\nassert(o.prop === 3.5)\nassert(Object.getPrototypeOf(o) === create_accessor.prototype)\n\no = new create_data()\no.prop = 'X'\nassert(o.prop === 'X')\nassert(Object.getPrototypeOf(o) === create_data.prototype)\n\nassert(not_called === 0)\nassert(called === 1)\n"
  },
  {
    "path": "tests/jerry/object-prototype-propertyisenumerable.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {};\n\n// Test if the toString fails.\ntry {\n  obj.propertyIsEnumerable({ toString: function() { throw new ReferenceError (\"foo\"); } });\n\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// Test if the toObject fails.\nvar obj1;\ntry {\n  obj1.propertyIsEnumerable(\"fail\");\n\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar array = [];\nobj.prop = \"bar\";\narray[0] = \"bar\";\n\nassert (obj.propertyIsEnumerable('prop') === true);\nassert (array.propertyIsEnumerable(0) === true);\n\nassert (obj.propertyIsEnumerable('length') === false);\nassert (array.propertyIsEnumerable('length') === false);\nassert (Math.propertyIsEnumerable('random') === false);\n\n// Creating a new property\nObject.defineProperty(obj, 'prop1', { value: 'foo', enumerable: true });\nObject.defineProperty(obj, 'prop2', { value: 'foo', enumerable: false });\nObject.defineProperty(obj, 'prop3', { value: 'foo' });\nassert (obj.propertyIsEnumerable('prop1') === true);\nassert (obj.propertyIsEnumerable('prop2') === false);\nassert (obj.propertyIsEnumerable('prop3') === false);\n\nObject.defineProperty(array, 'prop1', { value: 'foo', enumerable: true });\nObject.defineProperty(array, 'prop2', { value: 'foo', enumerable: false });\nObject.defineProperty(array, 'prop3', { value: 'foo' });\nassert (array.propertyIsEnumerable('prop1') === true);\nassert (array.propertyIsEnumerable('prop2') === false);\nassert (array.propertyIsEnumerable('prop3') === false);\n\n// Modify an existing one\nObject.defineProperty(obj, 'prop', { value: 'foo', enumerable: false });\nassert (obj.propertyIsEnumerable('prop') === false);\nObject.defineProperty(obj, 'prop', { value: 'foo', enumerable: true });\nassert (obj.propertyIsEnumerable('prop') === true);\n\nObject.defineProperty(array, 0, { value: 'foo', enumerable: false });\nassert (array.propertyIsEnumerable(0) === false);\nObject.defineProperty(array, 0, { value: 'foo', enumerable: true });\nassert (array.propertyIsEnumerable(0) === true);\n\n// Enumerability of inherited properties\nfunction construct1()\n{\n  this.prop1 = 'foo';\n}\n\nfunction construct2()\n{\n  this.prop2 = 'foo';\n}\n\nconstruct2.prototype = new construct1;\nconstruct2.prototype.constructor = construct2;\n\nvar obj2 = new construct2();\nobj2.prop3 = 'foo';\n\nassert (obj2.propertyIsEnumerable('prop3') === true);\nassert (obj2.propertyIsEnumerable('prop2') === true);\nassert (obj2.propertyIsEnumerable('prop1') === false);\n\nobj2.prop1 = 'foo';\n\nassert (obj2.propertyIsEnumerable('prop1') === true);\n"
  },
  {
    "path": "tests/jerry/object-prototype-proto.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('var o = { __proto__ : 5, __proto__ : 5 }');\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\nvar f = function(){};\nassert((new f()).__proto__ === f.prototype);\n\nvar o = {};\no.__proto__ = Array.prototype;\nassert(o instanceof Array);\n\nvar obj = Object.create(null)\np = {};\nobj.__proto__ = p;\nassert(Object.getPrototypeOf(obj) !== p);\n\nvar Circle = function () {};\nvar shape = {};\nvar circle = new Circle();\n\nshape.__proto__ = circle;\n\nassert(Object.getPrototypeOf(shape) === circle);\nassert(shape.__proto__ === circle);\n\nassert(Object.prototype.hasOwnProperty('__proto__') === true);\n\nvar desc = Object.getOwnPropertyDescriptor(Object.prototype,\"__proto__\");\nassert((desc && \"get\" in desc && \"set\" in desc && desc.configurable && !desc.enumerable) === true);\n\nassert((Object.getOwnPropertyNames(Object.prototype).indexOf('__proto__') > -1) === true);\n\ntry {\n  shape.__proto__ = shape;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar o2 = { [\"__proto__\"] : null };\nassert(o2.__proto__ === null);\nassert(Object.getPrototypeOf(o2) === Object.prototype);\n\nvar o3 = { __proto__ : null };\nassert(o3.__proto__ === undefined);\nassert(Object.getPrototypeOf(o3) === null);\n\nvar o4 = { \"__proto__\" : null };\nassert(o4.__proto__ === undefined);\nassert(Object.getPrototypeOf(o4) === null);\n\nvar __proto__ = [];\nvar o5 = { __proto__ };\nassert(o5.__proto__ === __proto__);\nassert(Object.getPrototypeOf(o5) === Object.prototype);\n\nvar o6 = { __proto__() { return \"42\" } };\nassert(o6.__proto__() === \"42\");\nassert(Object.getPrototypeOf(o6) === Object.prototype);\n\nvar o7 = { __\\u0070r\\u006ft\\u006f__: null };\nassert(o7.__proto__ === undefined);\nassert(Object.getPrototypeOf(o7) === null);\n\nvar o8 = { };\no8.__proto__ = Array.prototype;\nassert(Object.getPrototypeOf(o8) === Array.prototype);\n\nvar str1 = '{\"__proto__\": [] }';\nvar obj1 = JSON.parse(str1);\nassert(Object.getPrototypeOf(obj1) === Object.prototype);\nassert(Array.isArray(obj1.__proto__));\n"
  },
  {
    "path": "tests/jerry/object-prototype-tolocalestring.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj1 = {};\nobj1.toString = function () { return \"mystring\"; }\n\nassert (obj1.toLocaleString() === \"mystring\");\n\nvar obj2 = {a: 3};\nassert (obj2.toLocaleString() === \"[object Object]\");\n\n\nvar obj3 = {toLocaleString: function() { throw ReferenceError (\"foo\"); }};\ntry {\n  obj3.toLocaleString();\n\n  assert (false);\n} catch (e) {\n  assert (e.message === \"foo\");\n  assert (e instanceof ReferenceError);\n}\n\n// Test invalid toString call\nvar obj4 = {toString: 2};\ntry {\n  obj4.toLocaleString();\n\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n// Test undefined toString call\nvar obj5 = {};\nvar obj6;\nobj5.toString = obj6\ntry {\n  obj5.toLocaleString();\n\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/object-prototype-tostring.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Symbol prototype @@toStringTag */\nassert (Symbol.prototype[Symbol.toStringTag] === \"Symbol\");\nassert (Object.prototype.toString.call (Symbol ()) === \"[object Symbol]\");\n\nassert (delete Symbol.prototype[Symbol.toStringTag]);\nassert (Symbol.prototype[Symbol.toStringTag] === undefined);\nSymbol.prototype[Symbol.toStringTag] = \"myStringTag1\";\nassert (Object.prototype.toString.call (Symbol ()) === \"[object myStringTag1]\");\nSymbol.prototype[Symbol.toStringTag] = {};\nassert (Object.prototype.toString.call (Symbol ()) === \"[object Object]\");\n\n/* Math @@toStringTag */\nassert (Math[Symbol.toStringTag] === \"Math\");\nassert (Object.prototype.toString.call (Math) === \"[object Math]\");\n\nassert (delete Math[Symbol.toStringTag]);\nassert (Math[Symbol.toStringTag] === undefined);\nMath[Symbol.toStringTag] = \"myStringTag2\";\nassert (Object.prototype.toString.call (Math) === \"[object myStringTag2]\");\nMath[Symbol.toStringTag] = {};\nassert (Object.prototype.toString.call (Math) === \"[object Object]\");\n\n/* ArrayBuffer.prototype @@toStringTag */\nassert (ArrayBuffer.prototype[Symbol.toStringTag] === \"ArrayBuffer\");\nassert (Object.prototype.toString.call (new ArrayBuffer ()) === \"[object ArrayBuffer]\");\n\nassert (delete ArrayBuffer.prototype[Symbol.toStringTag]);\nassert (ArrayBuffer.prototype[Symbol.toStringTag] === undefined);\nArrayBuffer.prototype[Symbol.toStringTag] = \"myStringTag3\";\nassert (Object.prototype.toString.call (new ArrayBuffer ()) === \"[object myStringTag3]\");\nArrayBuffer.prototype[Symbol.toStringTag] = {};\nassert (ArrayBuffer.prototype.toString.call (new ArrayBuffer ()) === \"[object Object]\");\n\n/* SharedArrayBuffer.prototype @@toStringTag */\nassert (SharedArrayBuffer.prototype[Symbol.toStringTag] === \"SharedArrayBuffer\");\nassert (Object.prototype.toString.call (new SharedArrayBuffer ()) === \"[object SharedArrayBuffer]\");\n\nassert (delete SharedArrayBuffer.prototype[Symbol.toStringTag]);\nassert (SharedArrayBuffer.prototype[Symbol.toStringTag] === undefined);\nSharedArrayBuffer.prototype[Symbol.toStringTag] = \"myStringTag3\";\nassert (Object.prototype.toString.call (new SharedArrayBuffer ()) === \"[object myStringTag3]\");\nSharedArrayBuffer.prototype[Symbol.toStringTag] = {};\nassert (SharedArrayBuffer.prototype.toString.call (new SharedArrayBuffer ()) === \"[object Object]\");\n\n/* Promise.prototype @@toStringTag */\nassert (Promise.prototype[Symbol.toStringTag] === \"Promise\");\nassert (Object.prototype.toString.call (new Promise (function () {})) === \"[object Promise]\");\n\nassert (delete Promise.prototype[Symbol.toStringTag]);\nassert (Promise.prototype[Symbol.toStringTag] === undefined);\nPromise.prototype[Symbol.toStringTag] = \"myStringTag4\";\nassert (Object.prototype.toString.call (new Promise (function () {})) === \"[object myStringTag4]\");\nPromise.prototype[Symbol.toStringTag] = {};\nassert (Promise.prototype.toString.call (new Promise (function () {})) === \"[object Object]\");\n\n/* Map.prototype @@toStringTag */\nassert (Map.prototype[Symbol.toStringTag] === \"Map\");\nassert (Object.prototype.toString.call (new Map ()) === \"[object Map]\");\nassert (Object.prototype.toString.call (Map) === \"[object Function]\");\n\nassert (delete Map.prototype[Symbol.toStringTag]);\nassert (Map.prototype[Symbol.toStringTag] === undefined);\nMap.prototype[Symbol.toStringTag] = \"myStringTag5\";\nassert (Map.prototype.toString.call (new Map ()) === \"[object myStringTag5]\");\nassert (Object.prototype.toString.call (Map) === \"[object Function]\");\nMap.prototype[Symbol.toStringTag] = {};\nassert (Map.prototype.toString.call (new Map) === \"[object Object]\");\n\n/* JSON @@toStringTag */\nassert (JSON[Symbol.toStringTag] === \"JSON\");\nassert (Object.prototype.toString.call (JSON) === \"[object JSON]\");\n\nassert (delete JSON[Symbol.toStringTag]);\nassert (JSON[Symbol.toStringTag] === undefined);\nJSON[Symbol.toStringTag] = \"myStringTag6\";\nassert (Map.prototype.toString.call (JSON) === \"[object myStringTag6]\");\nJSON[Symbol.toStringTag] = {};\nassert (Object.prototype.toString.call (JSON) === \"[object Object]\");\n\nvar typedArrayTypes = [\"Int8Array\",\n                       \"Uint8Array\",\n                       \"Uint8ClampedArray\",\n                       \"Int16Array\",\n                       \"Uint16Array\",\n                       \"Int32Array\",\n                       \"Uint32Array\",\n                       \"Float32Array\",\n                       \"Float64Array\"];\n\nfor (var i = 0; i < typedArrayTypes.length; i++) {\n  var typedArray = this[typedArrayTypes[i]];\n  assert (typedArray.prototype[Symbol.toStringTag] === undefined);\n  assert (Object.prototype.toString.call (typedArray) === \"[object Function]\");\n  assert (Object.prototype.toString.call (typedArray.prototype) === \"[object Object]\");\n\n  var newArray = new typedArray ();\n  assert (newArray[Symbol.toStringTag] === typedArrayTypes[i]);\n  assert (Object.prototype.toString.call (newArray) === \"[object \" + typedArrayTypes[i] + \"]\");\n}\n"
  },
  {
    "path": "tests/jerry/object-seal-with-symbol.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar s1 = Symbol();\nvar s2 = Symbol();\nvar obj = {};\n\nobj[s1] = 1;\nObject.seal(obj);\n\nobj[s1] = 2;\nobj[s2] = 3\n\nassert(obj[s1] === 2);\nassert(obj[s2] === undefined);\nassert(delete obj[s1] === false);\n"
  },
  {
    "path": "tests/jerry/object-values.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Test array\nvar arr = [\"a\", \"b\", \"c\"];\nvar values = Object.values(arr);\n\nassert(values.indexOf(\"a\") === 0);\nassert(values.indexOf(\"b\") === 1);\nassert(values.indexOf(\"c\") === 2);\nassert(values.length === 3);\n\n// Test object\nvar obj = {key1: \"a\", key3: \"b\", key2: \"c\", key4: \"d\", key5: \"e\"};\nvar values = Object.values(obj);\n\nassert(values.indexOf(\"a\") === 0);\nassert(values.indexOf(\"b\") === 1);\nassert(values.indexOf(\"c\") === 2);\nassert(values.indexOf(\"d\") === 3);\nassert(values.indexOf(\"e\") === 4);\nassert(values.length === 5);\n\nvar obj2 = {};\nObject.defineProperties(obj2, {\n    key_one: {enumerable: true, value: \"one\"},\n    key_two: {enumerable: false, value: \"two\"},\n});\n\nvar values = Object.values(obj2);\n// values should contain: key_one\nassert(values.indexOf(\"one\") === 0);\nassert(values.indexOf(\"two\") === -1);\nassert(values.length === 1);\n\n// Test prototype chain\nfunction Parent() {}\nParent.prototype.inheritedMethod = function() {};\n\nfunction method() {};\nfunction Child() {\n  this.prop = 5;\n  this.method = method;\n}\n\nChild.prototype = new Parent;\nChild.prototype.prototypeMethod = function() {};\n\nvar values = Object.values(new Child());\n\nassert(values.indexOf(5) === 0);\nassert(values.indexOf(method) === 1);\nassert(values.length === 2);\n\n// Check enumerable properties\nvar o = {};\n\nObject.defineProperty(o, \"a\", {\n  value: \"OK a\",\n  writable: true,\n  enumerable: true,\n  configurable: true\n});\n\nObject.defineProperty(o, \"b\", {\n  value: \"NOT_OK\",\n  writable: true,\n  enumerable: false,\n  configurable: true\n});\n\nObject.defineProperty(o, \"c\", {\n  value: \"OK c\",\n  writable: true,\n  enumerable: true,\n  configurable: true\n});\n\nvar values = Object.values(o);\nassert(values.length === 2);\nassert(values[0] === \"OK a\");\nassert(values[1] === \"OK c\");\n\n// Test proxy object\nvar object = {};\n\nObject.defineProperties(object, {\n  a: {\n    value: \"foo\",\n    enumerable: false\n  },\n  b: {\n    value: \"bar\",\n    enumerable: true,\n    writable: false\n  }\n});\n\nvar proxy = new Proxy(object, {\n  getOwnPropertyDescriptor: function(o, v) {\n    handlers.push(\"D\");\n    return Object.getOwnPropertyDescriptor(o, v);\n  },\n  get: function(o, v) {\n    handlers.push(\"G\");\n    return o[v];\n  }\n});\n\nvar handlers = [];\nvar values = Object.values(proxy);\n\nassert(values.length === 1);\nassert(values[0] === \"bar\")\nassert(handlers.length === 3);\nassert(handlers.toString() === \"D,D,G\");\n\n// exception during enumeration\nvar obj = {\n  get a() { throw \"error\" },\n  get b() { throw \"shouldn't run\" }\n};\n\ntry {\n  Object.values(obj);\n} catch (err) {\n  assert(err == \"error\")\n}\n"
  },
  {
    "path": "tests/jerry/object_freeze.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {\n  prop: function() {},\n  foo: 'bar'\n};\n\n// New properties may be added, existing properties may be changed or removed\nobj.foo = 'baz';\nobj.lumpy = 'woof';\ndelete obj.prop;\n\nvar o = Object.freeze(obj);\n\nassert(Object.isFrozen(obj) === true);\n\n// Now any changes will fail\nobj.foo = 'quux'; // silently does nothing\nassert (obj.foo === 'baz');\n\nobj.quaxxor = 'the friendly duck'; // silently doesn't add the property\nassert (obj.quaxxor === undefined);\n\n// ...and in strict mode such attempts will throw TypeErrors\nfunction fail(){\n  'use strict';\n\n  try {\n    obj.foo = 'sparky'; // throws a TypeError\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    delete obj.foo; // throws a TypeError\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    obj.sparky = 'arf'; // throws a TypeError\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n}\n\nfail();\n\n// Attempted changes through Object.defineProperty will also throw\n\ntry {\n  Object.defineProperty(obj, 'ohai', { value: 17 }); // throws a TypeError\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Object.defineProperty(obj, 'foo', { value: 'eit' }); // throws a TypeError\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/object_seal.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {\n  prop: function() {},\n  foo: 'bar'\n};\n// New properties may be added, existing properties may be changed or removed.\nobj.foo = 'baz';\nobj.lumpy = 'woof';\ndelete obj.prop;\n\nvar o = Object.seal(obj);\n\nassert (o === obj);\nassert (Object.isSealed (obj) === true);\n\n// Changing property values on a sealed object still works.\nobj.foo = 'quux';\nassert (obj.foo === 'quux');\n// But you can't convert data properties to accessors, or vice versa.\ntry {\n    Object.defineProperty(obj, 'foo', { get: function() { return 42; } }); // throws a TypeError\n    assert (false);\n} catch (e) {\n    assert (e instanceof TypeError);\n}\n\n// Now any changes, other than to property values, will fail.\nobj.quaxxor = 'the friendly duck'; // silently doesn't add the property\ndelete obj.foo; // silently doesn't delete the property\n\nassert (obj.quaxxor === undefined);\nassert (obj.foo === 'quux')\n\ntry {\n    // Attempted additions through Object.defineProperty will also throw.\n    Object.defineProperty (obj, 'ohai', { value: 17 }); // throws a TypeError\n    assert (false);\n} catch (e) {\n    assert (e instanceof TypeError);\n}\n\ntry {\n    Object.defineProperties (obj, { 'ohai' : { value: 17 } });\n    assert (false);\n} catch (e) {\n    assert (e instanceof TypeError);\n}\n\nObject.defineProperty (obj, 'foo', { value: 'eit' });\nassert (obj.foo === 'eit')\n\n// Objects aren't sealed by default.\nvar empty = {};\nassert (Object.isSealed (empty) === false);\n\n// If you make an empty object non-extensible, it is vacuously sealed.\nObject.preventExtensions (empty);\nassert (Object.isSealed (empty) === true);\n\n// The same is not true of a non-empty object, unless its properties are all non-configurable.\nvar hasProp = { fee: 'fie foe fum' };\nObject.preventExtensions (hasProp);\nassert (Object.isSealed (hasProp) === false);\n\n// But make them all non-configurable and the object becomes sealed.\nObject.defineProperty (hasProp, 'fee', { configurable: false });\nassert (Object.isSealed (hasProp) === true);\n\n// The easiest way to seal an object, of course, is Object.seal.\nvar sealed = {};\nObject.seal (sealed);\nassert (Object.isSealed (sealed) === true);\n"
  },
  {
    "path": "tests/jerry/octal-literal.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction checkSyntaxError (str) {\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\ncheckSyntaxError (\"0p\");\ncheckSyntaxError (\"0o\");\ncheckSyntaxError (\"0o0123456789\");\ncheckSyntaxError (\"0o9\");\n\ncheckSyntaxError (\"0p\");\ncheckSyntaxError (\"0O\");\ncheckSyntaxError (\"0O9\");\n\n// Check strict mode\ncheckSyntaxError (\"'use strict'; 0777\");\nassert (eval (\"'use strict'; 0o777\") === 511);\n\nassert (0o123 === 83);\nassert (0o77777777 === 16777215);\nassert (0o767 === parseInt (\"767\", 8));\nassert (0767 === 0o767);\n\nassert (0O123 === 83);\nassert (0O77777777 === 16777215);\nassert (0O767 === parseInt (\"767\", 8));\nassert (0767 === 0O767);\n"
  },
  {
    "path": "tests/jerry/octal.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (010 === 8);\n"
  },
  {
    "path": "tests/jerry/parser-additive-op-assign.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.7.2\n\nvar tests = [\n  // this\n  'this + this = 42',\n  'this + null = 42',\n  'this + undefined = 42',\n  'this + true = 42',\n  'this + 12 = 42',\n  'this + \"foo\" = 42',\n  'this + [12] = 42',\n  'this + {} = 42',\n  'this + class a {} = 42',\n  'this + function a(){} = 42',\n  'this + /[a]/ = 42',\n  'this + `foo` = 42',\n  'this - this = 42',\n  'this - null = 42',\n  'this - undefined = 42',\n  'this - true = 42',\n  'this - 12 = 42',\n  'this - \"foo\" = 42',\n  'this - [12] = 42',\n  'this - {} = 42',\n  'this - class a {} = 42',\n  'this - function a(){} = 42',\n  'this - /[a]/ = 42',\n  'this - `foo` = 42',\n  // undefined\n  'undefined + null = 42',\n  'undefined + undefined = 42',\n  'undefined + true = 42',\n  'undefined + 12 = 42',\n  'undefined + \"foo\" = 42',\n  'undefined + [12] = 42',\n  'undefined + {} = 42',\n  'undefined + class a {} = 42',\n  'undefined + function a(){} = 42',\n  'undefined + /[a]/ = 42',\n  'undefined + `foo` = 42',\n  'undefined - null = 42',\n  'undefined - undefined = 42',\n  'undefined - true = 42',\n  'undefined - 12 = 42',\n  'undefined - \"foo\" = 42',\n  'undefined - [12] = 42',\n  'undefined - {} = 42',\n  'undefined - class a {} = 42',\n  'undefined - function a(){} = 42',\n  'undefined - /[a]/ = 42',\n  'undefined - `foo` = 42',\n  // NullLiteral\n  'null + null = 42',\n  'null + true = 42',\n  'null + 12 = 42',\n  'null + \"foo\" = 42',\n  'null + [12] = 42',\n  'null + {} = 42',\n  'null + class a {} = 42',\n  'null + function a(){} = 42',\n  'null + /[a]/ = 42',\n  'null + `foo` = 42',\n  'null - null = 42',\n  'null - true = 42',\n  'null - 12 = 42',\n  'null - \"foo\" = 42',\n  'null - [12] = 42',\n  'null - {} = 42',\n  'null - class a {} = 42',\n  'null - function a(){} = 42',\n  'null - /[a]/ = 42',\n  'null - `foo` = 42',\n  // BooleanLiteral \n  'true + true = 42',\n  'true + 12 = 42',\n  'true + \"foo\" = 42',\n  'true + [12] = 42',\n  'true + {} = 42',\n  'true + class a {} = 42',\n  'true + function a(){} = 42',\n  'true + /[a]/ = 42',\n  'true + `foo` = 42',\n  'true - true = 42',\n  'true - 12 = 42',\n  'true - \"foo\" = 42',\n  'true - [12] = 42',\n  'true - {} = 42',\n  'true - class a {} = 42',\n  'true - function a(){} = 42',\n  'true - /[a]/ = 42',\n  'true - `foo` = 42',\n  // DecimalLiteral \n  '5 + 12 = 42',\n  '5 + \"foo\" = 42',\n  '5 + [12] = 42',\n  '5 + {} = 42',\n  '5 + class a {} = 42',\n  '5 + function a(){} = 42',\n  '5 + /[a]/ = 42',\n  '5 + `foo` = 42',\n  '5 - 12 = 42',\n  '5 - \"foo\" = 42',\n  '5 - [12] = 42',\n  '5 - {} = 42',\n  '5 - class a {} = 42',\n  '5 - function a(){} = 42',\n  '5 - /[a]/ = 42',\n  '5 - `foo` = 42',\n  // StringLiteral\n  '\"foo\" + \"foo\" = 42',\n  '\"foo\" + [12] = 42',\n  '\"foo\" + {} = 42',\n  '\"foo\" + class a {} = 42',\n  '\"foo\" + function a(){} = 42',\n  '\"foo\" + /[a]/ = 42',\n  '\"foo\" + `foo` = 42',\n  '\"foo\" - \"foo\" = 42',\n  '\"foo\" - [12] = 42',\n  '\"foo\" - {} = 42',\n  '\"foo\" - class a {} = 42',\n  '\"foo\" - function a(){} = 42',\n  '\"foo\" - /[a]/ = 42',\n  '\"foo\" - `foo` = 42',\n  // ArrayLiteral\n  '[12] + [12] = 42',\n  '[12] + {} = 42',\n  '[12] + class a {} = 42',\n  '[12] + function a(){} = 42',\n  '[12] + /[a]/ = 42',\n  '[12] + `foo` = 42',\n  '[12] - [12] = 42',\n  '[12] - {} = 42',\n  '[12] - class a {} = 42',\n  '[12] - function a(){} = 42',\n  '[12] - /[a]/ = 42',\n  '[12] - `foo` = 42',\n  // ObjectLiteral\n  '{} + {} = 42',\n  '{} + class a {} = 42',\n  '{} + function a(){} = 42',\n  '{} + /[a]/ = 42',\n  '{} + `foo` = 42',\n  '{} - {} = 42',\n  '{} - class a {} = 42',\n  '{} - function a(){} = 42',\n  '{} - /[a]/ = 42',\n  '{} - `foo` = 42',\n  // ClassExpression\n  'class a {} + class b {} = 42',\n  'class a {} + function a(){} = 42',\n  'class a {} + /[a]/ = 42',\n  'class a {} + `foo` = 42',\n  'class a {} - class b {} = 42',\n  'class a {} - function a(){} = 42',\n  'class a {} - /[a]/ = 42',\n  'class a {} - `foo` = 42',\n  // RegularExpressionLiteral\n  '/[a]/ + function a(){} = 42',\n  '/[a]/ + /[a]/ = 42',\n  '/[a]/ + `foo` = 42',\n  '/[a]/ - function a(){} = 42',\n  '/[a]/ - /[a]/ = 42',\n  '/[a]/ - `foo` = 42',\n  // TemplateLiteral\n  '`foo` + function a(){} = 42',\n  '`foo` + `foo` = 42',\n  '`foo` - function a(){} = 42',\n  '`foo` - `foo` = 42',\n  // combining with MultiplicativeExpression\n  '6 * 6 + !4 / 7 = 42',\n  '-6 * !6 - ~4 / \"foo\" = 42',\n  '~\"foo\" * void 12 % 6 = 42',\n  'typeof [] * 8 * [] / !function a(){} = 42',\n  '+[2] % /foo/ + !undefined - +\"[1,2]\" = 42',\n  'var a = 5; ++a * \"foo\" + function a(){} = 42',\n  '+/(?:)/ % 25 + void 6 / typeof class a {} = 42',\n  'function a(){}; var b = new a(); ++a / !23 - !a = 42',\n  'var a = {\"foo\": function(){}}; void \"foo\" % 12 - typeof a.foo = 42',\n  'var a = {\"foo\": function(){}}; void \"foo\" % 12 + typeof a.foo() = 42',\n  'var a = [1,2,3]; !a[0] % /[A]/ + delete 12 = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-binary-bitwise-op-assign-1.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.11.2 & operation\n\nvar tests = [\n  // this\n  'this & this = 42',\n  'this & null = 42',\n  'this & undefined = 42',\n  'this & true = 42',\n  'this & 12 = 42',\n  'this & \"foo\" = 42',\n  'this & [12] = 42',\n  'this & class a {} = 42',\n  'this & function a(){} = 42',\n  'this & /[a]/ = 42',\n  'this & `foo` = 42',\n  // undefined\n  'undefined & null = 42',\n  'undefined & undefined = 42',\n  'undefined & true = 42',\n  'undefined & 12 = 42',\n  'undefined & \"foo\" = 42',\n  'undefined & [12] = 42',\n  'undefined & class a {} = 42',\n  'undefined & function a(){} = 42',\n  'undefined & /[a]/ = 42',\n  'undefined & `foo` = 42',\n  // NullLiteral\n  'null & null = 42',\n  'null & true = 42',\n  'null & 12 = 42',\n  'null & \"foo\" = 42',\n  'null & [12] = 42',\n  'null & class a {} = 42',\n  'null & function a(){} = 42',\n  'null & /[a]/ = 42',\n  'null & `foo` = 42',\n  // BooleanLiteral \n  'true & true = 42',\n  'true & 12 = 42',\n  'true & \"foo\" = 42',\n  'true & [12] = 42',\n  'true & class a {} = 42',\n  'true & function a(){} = 42',\n  'true & /[a]/ = 42',\n  'true & `foo` = 42',\n  // DecimalLiteral \n  '5 & 12 = 42',\n  '5 & \"foo\" = 42',\n  '5 & [12] = 42',\n  '5 & class a {} = 42',\n  '5 & function a(){} = 42',\n  '5 & /[a]/ = 42',\n  '5 & `foo` = 42',\n  // StringLiteral\n  '\"foo\" & \"foo\" = 42',\n  '\"foo\" & [12] = 42',\n  '\"foo\" & class a {} = 42',\n  '\"foo\" & function a(){} = 42',\n  '\"foo\" & /[a]/ = 42',\n  '\"foo\" & `foo` = 42',\n  // ArrayLiteral\n  '[12] & [12] = 42',\n  '[12] & class a {} = 42',\n  '[12] & function a(){} = 42',\n  '[12] & /[a]/ = 42',\n  '[12] & `foo` = 42',\n  // ObjectLiteral\n  'this & {} = 42',\n  'undefined & {} = 42',\n  'null & {} = 42',\n  'true & {} = 42',\n  '5 & {} = 42',\n  '\"foo\" & {} = 42',\n  '[12] & {} = 42',\n  '/[a]/ & {} = 42',\n  '`foo` & {} = 42',\n  // RegularExpressionLiteral\n  '/[a]/ & class a{} = 42',\n  '/[a]/ & function a(){} = 42',\n  '/[a]/ & /[a]/ = 42',\n  '/[a]/ & `foo` = 42',\n  // TemplateLiteral\n  '`foo` & class a{} = 42',\n  '`foo` & function a(){} = 42',\n  '`foo` & `foo` = 42',\n  // combining with EqualityExpression\n  '[] << !5 * function a(){} & \"foo\" == !\"foo\" % 6 + !4 / 7 = 42',\n  'void function a(){} & +6 << /[A]/ + !6 - ~4 / \"foo\" = 42',\n  'var a = 5; 5 << [] * 12 != [1,2,3] & ++a  * typeof \"foo\" & function a(){} = 42',\n  '`foo` === \"foo\" & +/(?:)/ % 25 + void 6 % delete class a {} = 42',\n  'function a(){}; var b = new a(); 5 & ++a / !23 & !a >> 12 * [] == /foo/ = 42',\n  'var a = {\"foo\": function(){}}; void \"foo\" % 12 & /[A-Z]/ + 12 >> typeof a.foo != a.foo() = 42',\n  '4 % [1,2] - class a{} << typeof \"foo\" == !25 & [] != 13 >> \"foo\" + delete 3 / /(?:)/ = 42',\n  'var a = [1,2,3]; a[2] == \"foo\" >> [] << typeof class a{} * 12 + void [] / [] != !a[0] % /[A]/ - delete `` & ++a[1] - a[2]-- = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-binary-bitwise-op-assign-2.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.11.2 ^ operation\n\nvar tests = [\n  // this\n  'this ^ this = 42',\n  'this ^ null = 42',\n  'this ^ undefined = 42',\n  'this ^ true = 42',\n  'this ^ 12 = 42',\n  'this ^ \"foo\" = 42',\n  'this ^ [12] = 42',\n  'this ^ class a {} = 42',\n  'this ^ function a(){} = 42',\n  'this ^ /[a]/ = 42',\n  'this ^ `foo` = 42',\n  // undefined\n  'undefined ^ null = 42',\n  'undefined ^ undefined = 42',\n  'undefined ^ true = 42',\n  'undefined ^ 12 = 42',\n  'undefined ^ \"foo\" = 42',\n  'undefined ^ [12] = 42',\n  'undefined ^ class a {} = 42',\n  'undefined ^ function a(){} = 42',\n  'undefined ^ /[a]/ = 42',\n  'undefined ^ `foo` = 42',\n  // NullLiteral\n  'null ^ null = 42',\n  'null ^ true = 42',\n  'null ^ 12 = 42',\n  'null ^ \"foo\" = 42',\n  'null ^ [12] = 42',\n  'null ^ class a {} = 42',\n  'null ^ function a(){} = 42',\n  'null ^ /[a]/ = 42',\n  'null ^ `foo` = 42',\n  // BooleanLiteral \n  'true ^ true = 42',\n  'true ^ 12 = 42',\n  'true ^ \"foo\" = 42',\n  'true ^ [12] = 42',\n  'true ^ class a {} = 42',\n  'true ^ function a(){} = 42',\n  'true ^ /[a]/ = 42',\n  'true ^ `foo` = 42',\n  // DecimalLiteral \n  '5 ^ 12 = 42',\n  '5 ^ \"foo\" = 42',\n  '5 ^ [12] = 42',\n  '5 ^ class a {} = 42',\n  '5 ^ function a(){} = 42',\n  '5 ^ /[a]/ = 42',\n  '5 ^ `foo` = 42',\n  // StringLiteral\n  '\"foo\" ^ \"foo\" = 42',\n  '\"foo\" ^ [12] = 42',\n  '\"foo\" ^ class a {} = 42',\n  '\"foo\" ^ function a(){} = 42',\n  '\"foo\" ^ /[a]/ = 42',\n  '\"foo\" ^ `foo` = 42',\n  // ArrayLiteral\n  '[12] ^ [12] = 42',\n  '[12] ^ class a {} = 42',\n  '[12] ^ function a(){} = 42',\n  '[12] ^ /[a]/ = 42',\n  '[12] ^ `foo` = 42',\n  // ObjectLiteral\n  'this ^ {} = 42',\n  'undefined ^ {} = 42',\n  'null ^ {} = 42',\n  'true ^ {} = 42',\n  '5 ^ {} = 42',\n  '\"foo\" ^ {} = 42',\n  '[12] ^ {} = 42',\n  '/[a]/ ^ {} = 42',\n  '`foo` ^ {} = 42',\n  // RegularExpressionLiteral\n  '/[a]/ ^ class a{} = 42',\n  '/[a]/ ^ function a(){} = 42',\n  '/[a]/ ^ /[a]/ = 42',\n  '/[a]/ ^ `foo` = 42',\n  // TemplateLiteral\n  '`foo` ^ class a{} = 42',\n  '`foo` ^ function a(){} = 42',\n  '`foo` ^ `foo` = 42',\n  // combining with EqualityExpression\n  '[] << !5 * function a(){} ^ \"foo\" == !\"foo\" % 6 + !4 / 7 = 42',\n  'void function a(){} ^ +6 << /[A]/ + !6 - ~4 / \"foo\" = 42',\n  'var a = 5; 5 << [] * 12 != [1,2,3] ^ ++a  * typeof \"foo\" ^ function a(){} = 42',\n  '`foo` === \"foo\" ^ +/(?:)/ % 25 + void 6 % delete class a {} = 42',\n  'function a(){}; var b = new a(); 5 ^ ++a / !23 ^ !a >> 12 * [] == /foo/ = 42',\n  'var a = {\"foo\": function(){}}; void \"foo\" % 12 ^ /[A-Z]/ + 12 >> typeof a.foo != a.foo() = 42',\n  '4 % [1,2] - class a{} << typeof \"foo\" == !25 ^ [] != 13 >> \"foo\" + delete 3 / /(?:)/ = 42',\n  'var a = [1,2,3]; a[2] == \"foo\" >> [] << typeof class a{} * 12 + void [] / [] != !a[0] % /[A]/ - delete `` ^ ++a[1] - a[2]-- = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-binary-bitwise-op-assign-3.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.11.2 | operation\n\nvar tests = [\n  // this\n  'this | this = 42',\n  'this | null = 42',\n  'this | undefined = 42',\n  'this | true = 42',\n  'this | 12 = 42',\n  'this | \"foo\" = 42',\n  'this | [12] = 42',\n  'this | class a {} = 42',\n  'this | function a(){} = 42',\n  'this | /[a]/ = 42',\n  'this | `foo` = 42',\n  // undefined\n  'undefined | null = 42',\n  'undefined | undefined = 42',\n  'undefined | true = 42',\n  'undefined | 12 = 42',\n  'undefined | \"foo\" = 42',\n  'undefined | [12] = 42',\n  'undefined | class a {} = 42',\n  'undefined | function a(){} = 42',\n  'undefined | /[a]/ = 42',\n  'undefined | `foo` = 42',\n  // NullLiteral\n  'null | null = 42',\n  'null | true = 42',\n  'null | 12 = 42',\n  'null | \"foo\" = 42',\n  'null | [12] = 42',\n  'null | class a {} = 42',\n  'null | function a(){} = 42',\n  'null | /[a]/ = 42',\n  'null | `foo` = 42',\n  // BooleanLiteral \n  'true | true = 42',\n  'true | 12 = 42',\n  'true | \"foo\" = 42',\n  'true | [12] = 42',\n  'true | class a {} = 42',\n  'true | function a(){} = 42',\n  'true | /[a]/ = 42',\n  'true | `foo` = 42',\n  // DecimalLiteral \n  '5 | 12 = 42',\n  '5 | \"foo\" = 42',\n  '5 | [12] = 42',\n  '5 | class a {} = 42',\n  '5 | function a(){} = 42',\n  '5 | /[a]/ = 42',\n  '5 | `foo` = 42',\n  // StringLiteral\n  '\"foo\" | \"foo\" = 42',\n  '\"foo\" | [12] = 42',\n  '\"foo\" | class a {} = 42',\n  '\"foo\" | function a(){} = 42',\n  '\"foo\" | /[a]/ = 42',\n  '\"foo\" | `foo` = 42',\n  // ArrayLiteral\n  '[12] | [12] = 42',\n  '[12] | class a {} = 42',\n  '[12] | function a(){} = 42',\n  '[12] | /[a]/ = 42',\n  '[12] | `foo` = 42',\n  // ObjectLiteral\n  'this | {} = 42',\n  'undefined | {} = 42',\n  'null | {} = 42',\n  'true | {} = 42',\n  '5 | {} = 42',\n  '\"foo\" | {} = 42',\n  '[12] | {} = 42',\n  '/[a]/ | {} = 42',\n  '`foo` | {} = 42',\n  // RegularExpressionLiteral\n  '/[a]/ | class a{} = 42',\n  '/[a]/ | function a(){} = 42',\n  '/[a]/ | /[a]/ = 42',\n  '/[a]/ | `foo` = 42',\n  // TemplateLiteral\n  '`foo` | class a{} = 42',\n  '`foo` | function a(){} = 42',\n  '`foo` | `foo` = 42',\n  // combining with EqualityExpression\n  '[] << !5 * function a(){} | \"foo\" == !\"foo\" % 6 + !4 / 7 = 42',\n  'void function a(){} | +6 << /[A]/ + !6 - ~4 / \"foo\" = 42',\n  'var a = 5; 5 << [] * 12 != [1,2,3] | ++a  * typeof \"foo\" | function a(){} = 42',\n  '`foo` === \"foo\" | +/(?:)/ % 25 + void 6 % delete class a {} = 42',\n  'function a(){}; var b = new a(); 5 | ++a / !23 | !a >> 12 * [] == /foo/ = 42',\n  'var a = {\"foo\": function(){}}; void \"foo\" % 12 | /[A-Z]/ + 12 >> typeof a.foo != a.foo() = 42',\n  '4 % [1,2] - class a{} << typeof \"foo\" == !25 | [] != 13 >> \"foo\" + delete 3 / /(?:)/ = 42',\n  'var a = [1,2,3]; a[2] == \"foo\" >> [] << typeof class a{} * 12 + void [] / [] != !a[0] % /[A]/ - delete `` | ++a[1] - a[2]-- = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-binary-logical-op-assign.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.12.1\n\nvar tests = [\n  // this\n  'this && this = 42',\n  'this && null = 42',\n  'this && undefined = 42',\n  'this && true = 42',\n  'this && 12 = 42',\n  'this && \"foo\" = 42',\n  'this && [12] = 42',\n  'this && class a {} = 42',\n  'this && function a(){} = 42',\n  'this && /[a]/ = 42',\n  'this && `foo` = 42',\n  'this || this = 42',\n  'this || null = 42',\n  'this || undefined = 42',\n  'this || true = 42',\n  'this || 12 = 42',\n  'this || \"foo\" = 42',\n  'this || [12] = 42',\n  'this || class a {} = 42',\n  'this || function a(){} = 42',\n  'this || /[a]/ = 42',\n  'this || `foo` = 42',\n  // undefined\n  'undefined && null = 42',\n  'undefined && undefined = 42',\n  'undefined && true = 42',\n  'undefined && 12 = 42',\n  'undefined && \"foo\" = 42',\n  'undefined && [12] = 42',\n  'undefined && class a {} = 42',\n  'undefined && function a(){} = 42',\n  'undefined && /[a]/ = 42',\n  'undefined && `foo` = 42',\n  'undefined || null = 42',\n  'undefined || undefined = 42',\n  'undefined || true = 42',\n  'undefined || 12 = 42',\n  'undefined || \"foo\" = 42',\n  'undefined || [12] = 42',\n  'undefined || class a {} = 42',\n  'undefined || function a(){} = 42',\n  'undefined || /[a]/ = 42',\n  'undefined || `foo` = 42',\n  // NullLiteral\n  'null && null = 42',\n  'null && true = 42',\n  'null && 12 = 42',\n  'null && \"foo\" = 42',\n  'null && [12] = 42',\n  'null && class a {} = 42',\n  'null && function a(){} = 42',\n  'null && /[a]/ = 42',\n  'null && `foo` = 42',\n  'null || null = 42',\n  'null || true = 42',\n  'null || 12 = 42',\n  'null || \"foo\" = 42',\n  'null || [12] = 42',\n  'null || class a {} = 42',\n  'null || function a(){} = 42',\n  'null || /[a]/ = 42',\n  'null || `foo` = 42',\n  // BooleanLiteral \n  'true && true = 42',\n  'true && 12 = 42',\n  'true && \"foo\" = 42',\n  'true && [12] = 42',\n  'true && class a {} = 42',\n  'true && function a(){} = 42',\n  'true && /[a]/ = 42',\n  'true && `foo` = 42',\n  'true || true = 42',\n  'true || 12 = 42',\n  'true || \"foo\" = 42',\n  'true || [12] = 42',\n  'true || class a {} = 42',\n  'true || function a(){} = 42',\n  'true || /[a]/ = 42',\n  'true || `foo` = 42',\n  // DecimalLiteral \n  '5 && 12 = 42',\n  '5 && \"foo\" = 42',\n  '5 && [12] = 42',\n  '5 && class a {} = 42',\n  '5 && function a(){} = 42',\n  '5 && /[a]/ = 42',\n  '5 && `foo` = 42',\n  '5 || 12 = 42',\n  '5 || \"foo\" = 42',\n  '5 || [12] = 42',\n  '5 || class a {} = 42',\n  '5 || function a(){} = 42',\n  '5 || /[a]/ = 42',\n  '5 || `foo` = 42',\n  // StringLiteral\n  '\"foo\" && \"foo\" = 42',\n  '\"foo\" && [12] = 42',\n  '\"foo\" && class a {} = 42',\n  '\"foo\" && function a(){} = 42',\n  '\"foo\" && /[a]/ = 42',\n  '\"foo\" && `foo` = 42',\n  '\"foo\" || \"foo\" = 42',\n  '\"foo\" || [12] = 42',\n  '\"foo\" || class a {} = 42',\n  '\"foo\" || function a(){} = 42',\n  '\"foo\" || /[a]/ = 42',\n  '\"foo\" || `foo` = 42',\n  // ArrayLiteral\n  '[12] && [12] = 42',\n  '[12] && class a {} = 42',\n  '[12] && function a(){} = 42',\n  '[12] && /[a]/ = 42',\n  '[12] && `foo` = 42',\n  '[12] || [12] = 42',\n  '[12] || class a {} = 42',\n  '[12] || function a(){} = 42',\n  '[12] || /[a]/ = 42',\n  '[12] || `foo` = 42',\n  // ObjectLiteral\n  'this && {} = 42',\n  'this || {} = 42',\n  'undefined && {} = 42',\n  'undefined || {} = 42',\n  'null && {} = 42',\n  'null || {} = 42',\n  'true && {} = 42',\n  'true || {} = 42',\n  '5 && {} = 42',\n  '5 || {} = 42',\n  '\"foo\" && {} = 42',\n  '\"foo\" || {} = 42',\n  '[12] && {} = 42',\n  '[12] || {} = 42',\n  '/[a]/ && {} = 42',\n  '`foo` && {} = 42',\n  '/[a]/ || {} = 42',\n  '`foo` || {} = 42',\n  // RegularExpressionLiteral\n  '/[a]/ && class a{} = 42',\n  '/[a]/ && function a(){} = 42',\n  '/[a]/ && /[a]/ = 42',\n  '/[a]/ && `foo` = 42',\n  '/[a]/ || class a{} = 42',\n  '/[a]/ || function a(){} = 42',\n  '/[a]/ || /[a]/ = 42',\n  '/[a]/ || `foo` = 42',\n  // TemplateLiteral\n  '`foo` && class a{} = 42',\n  '`foo` && function a(){} = 42',\n  '`foo` && `foo` = 42',\n  '`foo` || class a{} = 42',\n  '`foo` || function a(){} = 42',\n  '`foo` || `foo` = 42',\n  // combining with BitwiseORExpression and LogicalANDExpression\n  '[] << !5 * function a(){} | \"foo\" == !\"foo\" % 6 + !4 / 7 || 23 & +[] >> 4 * delete 12 = 42',\n  '[] << !5 * function a(){} | \"foo\" == !\"foo\" % 6 + !4 / 7 && 23 & +[] >> 4 * delete 12 = 42',\n  '4 % [1,2] - class a{} << typeof \"foo\" == !25 | [] != 13 >> \"foo\" + delete 3 / /(?:)/ || ++a * \"foo\" + function a(){} = 42',\n  '4 % [1,2] - class a{} << typeof \"foo\" == !25 | [] != 13 >> \"foo\" + delete 3 / /(?:)/ && ++a * \"foo\" + function a(){} = 42',\n  '`foo` === \"foo\" | +/(?:)/ % 25 + void 6 % delete class a {} || 5 >> void function a(){} !== +6 * !6 - ~4 / \"foo\" = 42',\n  '`foo` === \"foo\" | +/(?:)/ % 25 + void 6 % delete class a {} && 5 >> void function a(){} !== +6 * !6 - ~4 / \"foo\" = 42',\n  'var a = 5; 5 + class a{} << typeof \"foo\" == !25 | [] != 13 >> \"foo\" + delete 3 || 5 << [] * 12 != [1,2,3] ^ ++a  * typeof \"foo\" ^ function a(){} = 42',\n  'var a = 5; 5 + class a{} << typeof \"foo\" == !25 | [] != 13 >> \"foo\" + delete 3 && 5 << [] * 12 != [1,2,3] ^ ++a  * typeof \"foo\" ^ function a(){} = 42',\n  '[1,2] >> +5 * function a(){} ^ !\"foo\" == !\"foo\" % ~6 + !4 / void /foo/ || [3] << !5 * function a(){} ^ \"foo\" == !\"foo\" % 6 + !0b11 / 0xFF = 42',\n  '[1,2] >> +5 * function a(){} ^ !\"foo\" == !\"foo\" % ~6 + !4 / void /foo/ && [3] << !5 * function a(){} ^ \"foo\" == !\"foo\" % 6 + !0b11 / 0xFF = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-covered-parenthesized-exp-assign.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA-262 v6 12.2.1.5 and 12.2.10.3\n\nvar tests = [\n  // this\n  '(this) = 42;',\n  // NullLiteral\n  '(null) = 42;',\n  // BooleanLiteral\n  '(false) = 42;',\n  '(true) = 42;',\n  // DecimalLiteral\n  '(12) = 42;',\n  '(0.12) = 42;',\n  '(.12) = 42;',\n  '(1.23e4) = 42;',\n  '(.23e-2) = 42;',\n  // BinaryIntegerLiteral\n  '(0b11) = 42; ',\n  '(0B11) = 42;',\n  // OctalIntegerLiteral\n  '(0o67) = 42;',\n  '(0O67) = 42;',\n  // HexIntegerLiteral\n  '(0xDD) = 42;',\n  '(0XDD) = 42;',\n  // StringLiteral\n  '(\"foo\") = 42;',\n  '(\\'foo\\') = 42;',\n  '(\"\\\\n\") = 42;',\n  '(\\'\\\\n\\') = 42;',\n  '(\"\\\\0\") = 42;',\n  '(\\'\\\\0\\') = 42;',\n  '(\"\\\\x0F\") = 42;',\n  '(\\'\\\\x0F\\') = 42;',\n  '(\"\\\\uFFFF\") = 42;',\n  '(\\'\\\\uFFFF\\') = 42;',\n  '(\"\\\\u{F}\") = 42;',\n  '(\\'\\\\u{F}\\') = 42;',\n  '(\"\\\\d\") = 42;',\n  '(\\'\\\\d\\') = 42;',\n  '(\"\\\\u000A\") = 42;',\n  '(\\'\\\\u000A\\') = 42;',\n  // ArrayLiteral\n  '([]) = 42;',\n  '([1]) = 42;',\n  '([1,,]) = 42;',\n  '([1,a=5]) = 42;',\n  // ObjectLiteral\n  '({}) = 42;',\n  '({yield}) = 42;',\n  '({$a}) = 42;',\n  '({a}) = 42;',\n  '({a : 5}) = 42;',\n  '({5 : 5}) = 42;',\n  '({\"foo\" : 5}) = 42;',\n  '({[key] : 5}) = 42;',\n  '({func(){}}) = 42;',\n  '({get(){}}) = 42;',\n  '({set(prop){}}) = 42;',\n  '({*func(){}}) = 42;',\n  // FunctionExpression\n  '(function(){}) = 42;',\n  '(function(...a){}) = 42;',\n  '(function a(){}) = 42;',\n  '(function a(...a){}) = 42;',\n  '(function (a){}) = 42;',\n  '(function a(a){}) = 42;',\n  // ClassExpression\n  '(class a {}) = 42;',\n  'class b {}; (class a extends b {}) = 42;',\n  '(class a {function(){}}) = 42;',\n  // GeneratorExpression\n  '(function *a (){}) = 42;',\n  // RegularExpressionLiteral\n  '(/(?:)/) = 42;',\n  '(/a/) = 42;',\n  '(/\\\\a/) = 42;',\n  '(/[a]/) = 42;',\n  '(/a/g) = 42;',\n  '(/a/i) = 42;',\n  '(/a/m) = 42;',\n  '(/a/u) = 42;',\n  '(/a/y) = 42;',\n  // TemplateLiteral\n  '(``) = 42;',\n  'a = 5; (`${a}`) = 42;',\n  '(`\\\\a`) = 42;',\n  '(`\\\\0`) = 42;',\n  '(`\\\\xFF`) = 42;',\n  '(`\\\\uFFFF`) = 42;',\n  '(`\\\\u{F}`) = 42;',\n  '(`foo`) = 42;',\n  '(`\\\\u000A`) = 42;',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-delete-op-assign.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA-262 v6 12.5.3 delete UnaryExpression\n\nvar tests = [\n  // IdentifierReference\n  'var obj = {a : 10, ret : function(params) {delete a = 42;}}',\n  // NullLiteral\n  'var a = null; delete a = 42',\n  // BooleanLiteral \n  'var a = true; delete a = 42',\n  'var a = false; delete a = 42',\n  // DecimalLiteral \n  'var a = 5; delete a = 42',\n  'var a = 1.23e4; delete a = 42',\n  // BinaryIntegerLiteral \n  'var a = 0b11; delete a = 42',\n  'var a = 0B11; delete a = 42',\n  // OctalIntegerLiteral \n  'var a = 0o66; delete a = 42',\n  'var a = 0O66; delete a = 42',\n  // HexIntegerLiteral \n  'var a = 0xFF; delete a = 42',\n  'var a = 0xFF; delete a = 42',\n  // StringLiteral\n  'var a = \"foo\"; delete a = 42',\n  'var a = \"\\\\n\"; delete a = 42',\n  'var a = \"\\\\uFFFF\"; delete a = 42',\n  'var a =\"\\\\u{F}\"; delete a = 42',\n  // ArrayLiteral\n  'var a = []; delete a = 42',\n  'var a = [1,a=5]; delete a = 42',\n  // ObjectLiteral\n  'var a = {}; delete a = 42',\n  'var a = {\"foo\" : 5}; delete a = 42',\n  'var a = {5 : 5}; delete a = 42',\n  'var a = {a : 5}; delete a = 42',\n  'var a = {[key] : 5}; delete a = 42',\n  'var a = {func(){}}; delete a = 42',\n  'var a = {get(){}}; delete a = 42',\n  'var a = {set(prop){}}; delete a = 42',\n  'var a = {*func(){}}; delete a = 42',\n  // ClassExpression\n  'class a {}; delete a = 42',\n  'class a {}; class b extends a {}; delete b = 42',\n  'class a {function(){}}; delete a = 42',\n  // GeneratorExpression\n  'function *a (){}; delete a = 42',\n  // RegularExpressionLiteral\n  'var a = /(?:)/; delete a = 42',\n  'var a = /a/; delete a = 42',\n  'var a = /[a]/; delete a = 42',\n  'var a = /a/g; delete a = 42',\n  // TemplateLiteral\n  'var a = ``; delete a = 42',\n  'a = 5; var b = (`${a}`); delete b = 42',\n  'var a = `foo`; delete a = 42',\n  'var a = `\\\\uFFFF`; delete a = 42',\n  // MemberExpression\n  'var a = [1,2,3]; delete a[0] = 42',\n  'var a = {0:12}; delete a[0] = 42',\n  'var a = {\"foo\":12}; delete a.foo = 42',\n  'var a = {func: function(){}}; delete a.func = 42',\n  // SuperProperty\n  'class a {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }} ' +\n  'class b extends a {constructor() {super();} foo() {delete super.foo = 42;}}',\n  // NewExpression\n  'function a() {}; var b = new a(); delete b = 42',\n  'class g {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }}; ' +\n  'var a = new g(); delete a = 42',\n  'class a {}; var n = new a(); delete a = 42',\n  // CallExpression\n  'function a(prop){return prop}; var b = a(12); delete b = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-equality-exp-assign-1.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.10.1 == and != operations\n\nvar tests = [\n  // this\n  'this == this = 42',\n  'this == null = 42',\n  'this == undefined = 42',\n  'this == true = 42',\n  'this == 12 = 42',\n  'this == \"foo\" = 42',\n  'this == [12] = 42',\n  'this == class a {} = 42',\n  'this == function a(){} = 42',\n  'this == /[a]/ = 42',\n  'this == `foo` = 42',\n  'this != this = 42',\n  'this != null = 42',\n  'this != undefined = 42',\n  'this != true = 42',\n  'this != 12 = 42',\n  'this != \"foo\" = 42',\n  'this != [12] = 42',\n  'this != class a {} = 42',\n  'this != function a(){} = 42',\n  'this != /[a]/ = 42',\n  'this != `foo` = 42',\n  // undefined\n  'undefined == null = 42',\n  'undefined == undefined = 42',\n  'undefined == true = 42',\n  'undefined == 12 = 42',\n  'undefined == \"foo\" = 42',\n  'undefined == [12] = 42',\n  'undefined == class a {} = 42',\n  'undefined == function a(){} = 42',\n  'undefined == /[a]/ = 42',\n  'undefined == `foo` = 42',\n  'undefined != null = 42',\n  'undefined != undefined = 42',\n  'undefined != true = 42',\n  'undefined != 12 = 42',\n  'undefined != \"foo\" = 42',\n  'undefined != [12] = 42',\n  'undefined != class a {} = 42',\n  'undefined != function a(){} = 42',\n  'undefined != /[a]/ = 42',\n  'undefined != `foo` = 42',\n  // NullLiteral\n  'null == null = 42',\n  'null == true = 42',\n  'null == 12 = 42',\n  'null == \"foo\" = 42',\n  'null == [12] = 42',\n  'null == class a {} = 42',\n  'null == function a(){} = 42',\n  'null == /[a]/ = 42',\n  'null == `foo` = 42',\n  'null != null = 42',\n  'null != true = 42',\n  'null != 12 = 42',\n  'null != \"foo\" = 42',\n  'null != [12] = 42',\n  'null != class a {} = 42',\n  'null != function a(){} = 42',\n  'null != /[a]/ = 42',\n  'null != `foo` = 42',\n  // BooleanLiteral \n  'true == true = 42',\n  'true == 12 = 42',\n  'true == \"foo\" = 42',\n  'true == [12] = 42',\n  'true == class a {} = 42',\n  'true == function a(){} = 42',\n  'true == /[a]/ = 42',\n  'true == `foo` = 42',\n  'true != true = 42',\n  'true != 12 = 42',\n  'true != \"foo\" = 42',\n  'true != [12] = 42',\n  'true != class a {} = 42',\n  'true != function a(){} = 42',\n  'true != /[a]/ = 42',\n  'true != `foo` = 42',\n  // DecimalLiteral \n  '5 == 12 = 42',\n  '5 == \"foo\" = 42',\n  '5 == [12] = 42',\n  '5 == class a {} = 42',\n  '5 == function a(){} = 42',\n  '5 == /[a]/ = 42',\n  '5 == `foo` = 42',\n  '5 != 12 = 42',\n  '5 != \"foo\" = 42',\n  '5 != [12] = 42',\n  '5 != class a {} = 42',\n  '5 != function a(){} = 42',\n  '5 != /[a]/ = 42',\n  '5 != `foo` = 42',\n  // StringLiteral\n  '\"foo\" == \"foo\" = 42',\n  '\"foo\" == [12] = 42',\n  '\"foo\" == class a {} = 42',\n  '\"foo\" == function a(){} = 42',\n  '\"foo\" == /[a]/ = 42',\n  '\"foo\" == `foo` = 42',\n  '\"foo\" != \"foo\" = 42',\n  '\"foo\" != [12] = 42',\n  '\"foo\" != class a {} = 42',\n  '\"foo\" != function a(){} = 42',\n  '\"foo\" != /[a]/ = 42',\n  '\"foo\" != `foo` = 42',\n  // ArrayLiteral\n  '[12] == [12] = 42',\n  '[12] == class a {} = 42',\n  '[12] == function a(){} = 42',\n  '[12] == /[a]/ = 42',\n  '[12] == `foo` = 42',\n  '[12] != [12] = 42',\n  '[12] != class a {} = 42',\n  '[12] != function a(){} = 42',\n  '[12] != /[a]/ = 42',\n  '[12] != `foo` = 42',\n  // ObjectLiteral\n  'this == {} = 42',\n  'this != {} = 42',\n  'undefined == {} = 42',\n  'undefined != {} = 42',\n  'null == {} = 42',\n  'null != {} = 42',\n  'true == {} = 42',\n  'true != {} = 42',\n  '5 == {} = 42',\n  '5 != {} = 42',\n  '\"foo\" == {} = 42',\n  '\"foo\" != {} = 42',\n  '[12] == {} = 42',\n  '[12] != {} = 42',\n  '/[a]/ == {} = 42',\n  '`foo` == {} = 42',\n  '/[a]/ != {} = 42',\n  '`foo` != {} = 42',\n  // RegularExpressionLiteral\n  '/[a]/ == class a{} = 42',\n  '/[a]/ == function a(){} = 42',\n  '/[a]/ == /[a]/ = 42',\n  '/[a]/ == `foo` = 42',\n  '/[a]/ != class a{} = 42',\n  '/[a]/ != function a(){} = 42',\n  '/[a]/ != /[a]/ = 42',\n  '/[a]/ != `foo` = 42',\n  // TemplateLiteral\n  '`foo` == class a{} = 42',\n  '`foo` == function a(){} = 42',\n  '`foo` == `foo` = 42',\n  '`foo` != class a{} = 42',\n  '`foo` != function a(){} = 42',\n  '`foo` != `foo` = 42',\n  // combining with RelationalExpression\n  '\"foo\" == 6 * 6 + !4 / 7 = 42',\n  '5 >> void function a(){} != +6 * !6 - ~4 / \"foo\" = 42',\n  'var a = 5; \"foo\" >> 5 >= 12 != --a / \"foo\" << function a(){} = 42',\n  '~`foo` << !5 == /(?:)/ >> \"foo\" + void 6 / typeof class a {} = 42',\n  'function a(){}; var b = new a(); 6 + 3 == +/[A]/ / \"foo\" + 2 << 12 == 5 >> b / !23 + ++b = 42',\n  'var a = {\"foo\": function(){}}; !4 * delete a != 3 >> void \"foo\" % 12 != ++a.foo = 42',\n  'var a = {\"foo\": function(){}}; [1,2,3] / 5 >> void \"foo\" == 5 << -\"foo\" % 12 == typeof a.foo() = 42',\n  'var a = [1,2,3]; a[2] == !a[0] % /[A]/ - delete 12 = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-equality-exp-assign-2.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.10.1 === and !== operations\n\nvar tests = [\n  // this\n  'this === this = 42',\n  'this === null = 42',\n  'this === undefined = 42',\n  'this === true = 42',\n  'this === 12 = 42',\n  'this === \"foo\" = 42',\n  'this === [12] = 42',\n  'this === class a {} = 42',\n  'this === function a(){} = 42',\n  'this === /[a]/ = 42',\n  'this === `foo` = 42',\n  'this !== this = 42',\n  'this !== null = 42',\n  'this !== undefined = 42',\n  'this !== true = 42',\n  'this !== 12 = 42',\n  'this !== \"foo\" = 42',\n  'this !== [12] = 42',\n  'this !== class a {} = 42',\n  'this !== function a(){} = 42',\n  'this !== /[a]/ = 42',\n  'this !== `foo` = 42',\n  // undefined\n  'undefined === null = 42',\n  'undefined === undefined = 42',\n  'undefined === true = 42',\n  'undefined === 12 = 42',\n  'undefined === \"foo\" = 42',\n  'undefined === [12] = 42',\n  'undefined === class a {} = 42',\n  'undefined === function a(){} = 42',\n  'undefined === /[a]/ = 42',\n  'undefined === `foo` = 42',\n  'undefined !== null = 42',\n  'undefined !== undefined = 42',\n  'undefined !== true = 42',\n  'undefined !== 12 = 42',\n  'undefined !== \"foo\" = 42',\n  'undefined !== [12] = 42',\n  'undefined !== class a {} = 42',\n  'undefined !== function a(){} = 42',\n  'undefined !== /[a]/ = 42',\n  'undefined !== `foo` = 42',\n  // NullLiteral\n  'null === null = 42',\n  'null === true = 42',\n  'null === 12 = 42',\n  'null === \"foo\" = 42',\n  'null === [12] = 42',\n  'null === class a {} = 42',\n  'null === function a(){} = 42',\n  'null === /[a]/ = 42',\n  'null === `foo` = 42',\n  'null !== null = 42',\n  'null !== true = 42',\n  'null !== 12 = 42',\n  'null !== \"foo\" = 42',\n  'null !== [12] = 42',\n  'null !== class a {} = 42',\n  'null !== function a(){} = 42',\n  'null !== /[a]/ = 42',\n  'null !== `foo` = 42',\n  // BooleanLiteral \n  'true === true = 42',\n  'true === 12 = 42',\n  'true === \"foo\" = 42',\n  'true === [12] = 42',\n  'true === class a {} = 42',\n  'true === function a(){} = 42',\n  'true === /[a]/ = 42',\n  'true === `foo` = 42',\n  'true !== true = 42',\n  'true !== 12 = 42',\n  'true !== \"foo\" = 42',\n  'true !== [12] = 42',\n  'true !== class a {} = 42',\n  'true !== function a(){} = 42',\n  'true !== /[a]/ = 42',\n  'true !== `foo` = 42',\n  // DecimalLiteral \n  '5 === 12 = 42',\n  '5 === \"foo\" = 42',\n  '5 === [12] = 42',\n  '5 === class a {} = 42',\n  '5 === function a(){} = 42',\n  '5 === /[a]/ = 42',\n  '5 === `foo` = 42',\n  '5 !== 12 = 42',\n  '5 !== \"foo\" = 42',\n  '5 !== [12] = 42',\n  '5 !== class a {} = 42',\n  '5 !== function a(){} = 42',\n  '5 !== /[a]/ = 42',\n  '5 !== `foo` = 42',\n  // StringLiteral\n  '\"foo\" === \"foo\" = 42',\n  '\"foo\" === [12] = 42',\n  '\"foo\" === class a {} = 42',\n  '\"foo\" === function a(){} = 42',\n  '\"foo\" === /[a]/ = 42',\n  '\"foo\" === `foo` = 42',\n  '\"foo\" !== \"foo\" = 42',\n  '\"foo\" !== [12] = 42',\n  '\"foo\" !== class a {} = 42',\n  '\"foo\" !== function a(){} = 42',\n  '\"foo\" !== /[a]/ = 42',\n  '\"foo\" !== `foo` = 42',\n  // ArrayLiteral\n  '[12] === [12] = 42',\n  '[12] === class a {} = 42',\n  '[12] === function a(){} = 42',\n  '[12] === /[a]/ = 42',\n  '[12] === `foo` = 42',\n  '[12] !== [12] = 42',\n  '[12] !== class a {} = 42',\n  '[12] !== function a(){} = 42',\n  '[12] !== /[a]/ = 42',\n  '[12] !== `foo` = 42',\n  // ObjectLiteral\n  'this === {} = 42',\n  'this !== {} = 42',\n  'undefined === {} = 42',\n  'undefined !== {} = 42',\n  'null === {} = 42',\n  'null !== {} = 42',\n  'true === {} = 42',\n  'true !== {} = 42',\n  '5 === {} = 42',\n  '5 !== {} = 42',\n  '\"foo\" === {} = 42',\n  '\"foo\" !== {} = 42',\n  '[12] === {} = 42',\n  '[12] !== {} = 42',\n  '/[a]/ === {} = 42',\n  '`foo` === {} = 42',\n  '/[a]/ !== {} = 42',\n  '`foo` !== {} = 42',\n  // RegularExpressionLiteral\n  '/[a]/ === class a{} = 42',\n  '/[a]/ === function a(){} = 42',\n  '/[a]/ === /[a]/ = 42',\n  '/[a]/ === `foo` = 42',\n  '/[a]/ !== class a{} = 42',\n  '/[a]/ !== function a(){} = 42',\n  '/[a]/ !== /[a]/ = 42',\n  '/[a]/ !== `foo` = 42',\n  // TemplateLiteral\n  '`foo` === class a{} = 42',\n  '`foo` === function a(){} = 42',\n  '`foo` === `foo` = 42',\n  '`foo` !== class a{} = 42',\n  '`foo` !== function a(){} = 42',\n  '`foo` !== `foo` = 42',\n  // combining with RelationalExpression\n  '\"foo\" === 6 * 6 + !4 / 7 = 42',\n  '5 >> void function a(){} !== +6 * !6 - ~4 / \"foo\" = 42',\n  'var a == 5; \"foo\" >> 5 >== 12 !== --a / \"foo\" << function a(){} = 42',\n  '~`foo` << !5 === /(?:)/ >> \"foo\" + void 6 / typeof class a {} = 42',\n  'function a(){}; var b == new a(); 6 + 3 === +/[A]/ / \"foo\" + 2 << 12 === 5 >> b / !23 + ++b = 42',\n  'var a == {\"foo\": function(){}}; !4 * delete a !== 3 >> void \"foo\" % 12 !== ++a.foo = 42',\n  'var a == {\"foo\": function(){}}; [1,2,3] / 5 >> void \"foo\" === 5 << -\"foo\" % 12 === typeof a.foo() = 42',\n  'var a == [1,2,3]; a[2] === !a[0] % /[A]/ - delete 12 = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-mult-op-assign-1.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.6.2 * operator\n\nvar tests = [\n  // this\n  'this * this = 42',\n  'this * null = 42',\n  'this * undefined = 42',\n  'this * true = 42',\n  'this * 12 = 42',\n  'this * \"foo\" = 42',\n  'this * [12] = 42',\n  'this * class a {} = 42',\n  'this * function a(){} = 42',\n  'this * /[a]/ = 42',\n  'this * `foo` = 42',\n  // undefined\n  'undefined * null = 42',\n  'undefined * undefined = 42',\n  'undefined * true = 42',\n  'undefined * 12 = 42',\n  'undefined * \"foo\" = 42',\n  'undefined * [12] = 42',\n  'undefined * class a {} = 42',\n  'undefined * function a(){} = 42',\n  'undefined * /[a]/ = 42',\n  'undefined * `foo` = 42',\n  // NullLiteral\n  'null * null = 42',\n  'null * true = 42',\n  'null * 12 = 42',\n  'null * \"foo\" = 42',\n  'null * [12] = 42',\n  'null * class a {} = 42',\n  'null * function a(){} = 42',\n  'null * /[a]/ = 42',\n  'null * `foo` = 42',\n  // BooleanLiteral \n  'true * true = 42',\n  'true * 12 = 42',\n  'true * \"foo\" = 42',\n  'true * [12] = 42',\n  'true * class a {} = 42',\n  'true * function a(){} = 42',\n  'true * /[a]/ = 42',\n  'true * `foo` = 42',\n  // DecimalLiteral \n  '5 * 12 = 42',\n  '5 * \"foo\" = 42',\n  '5 * [12] = 42',\n  '5 * class a {} = 42',\n  '5 * function a(){} = 42',\n  '5 * /[a]/ = 42',\n  '5 * `foo` = 42',\n  // StringLiteral\n  '\"foo\" * \"foo\" = 42',\n  '\"foo\" * [12] = 42',\n  '\"foo\" * class a {} = 42',\n  '\"foo\" * function a(){} = 42',\n  '\"foo\" * /[a]/ = 42',\n  '\"foo\" * `foo` = 42',\n  // ArrayLiteral\n  '[12] * [12] = 42',\n  '[12] * class a {} = 42',\n  '[12] * function a(){} = 42',\n  '[12] * /[a]/ = 42',\n  '[12] * `foo` = 42',\n  // ObjectLiteral\n  'this * {} = 42',\n  'undefined * {} = 42',\n  'null * {} = 42',\n  'true * {} = 42',\n  '5 * {} = 42',\n  '\"foo\" * {} = 42',\n  '[12] * {} = 42',\n  '/[a]/ * {} = 42',\n  '`foo` * {} = 42',\n  // RegularExpressionLiteral\n  '/[a]/ * class a{} = 42',\n  '/[a]/ * function a(){} = 42',\n  '/[a]/ * /[a]/ = 42',\n  '/[a]/ * `foo` = 42',\n  // TemplateLiteral\n  '`foo` * class a{} = 42',\n  '`foo` * function a(){} = 42',\n  '`foo` * `foo` = 42',\n  // combining with UnaryExpression\n  '6 * +6 = 42',\n  '6 * -6 = 42',\n  '6 * !6 = 42',\n  '6 * ~6 = 42',\n  'typeof 6 * ~6 = 42',\n  'var a = 6; 6 * ++a = 42',\n  'var a = 6; 6 * --a = 42',\n  'function a(){}; var b = new a(); \"foo\" * ++a = 42',\n  'class a {}; var b = new a(); ++b * function c(){} = 42',\n  'var a = [1,2,3]; var b = {\"foo\" : function(){}}; !a[0] * b.foo = 42',\n  'var a = [1,2,3]; var b = {\"foo\" : function(){}}; !a[0] * b.foo() = 42',\n  'var a = [1]; var b = {\"foo\" : function(){}}; ++a[0] * void b.foo() = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n    "
  },
  {
    "path": "tests/jerry/parser-mult-op-assign-2.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.6.2 / operator\n\nvar tests = [\n  // this\n  'this / this = 42',\n  'this / null = 42',\n  'this / undefined = 42',\n  'this / true = 42',\n  'this / 12 = 42',\n  'this / \"foo\" = 42',\n  'this / [12] = 42',\n  'this / class a {} = 42',\n  'this / function a(){} = 42',\n  'this / /[a]/ = 42',\n  'this / `foo` = 42',\n  // undefined\n  'undefined / null = 42',\n  'undefined / undefined = 42',\n  'undefined / true = 42',\n  'undefined / 12 = 42',\n  'undefined / \"foo\" = 42',\n  'undefined / [12] = 42',\n  'undefined / class a {} = 42',\n  'undefined / function a(){} = 42',\n  'undefined / /[a]/ = 42',\n  'undefined / `foo` = 42',\n  // NullLiteral\n  'null / null = 42',\n  'null / true = 42',\n  'null / 12 = 42',\n  'null / \"foo\" = 42',\n  'null / [12] = 42',\n  'null / class a {} = 42',\n  'null / function a(){} = 42',\n  'null / /[a]/ = 42',\n  'null / `foo` = 42',\n  // BooleanLiteral \n  'true / true = 42',\n  'true / 12 = 42',\n  'true / \"foo\" = 42',\n  'true / [12] = 42',\n  'true / class a {} = 42',\n  'true / function a(){} = 42',\n  'true / /[a]/ = 42',\n  'true / `foo` = 42',\n  // DecimalLiteral \n  '5 / 12 = 42',\n  '5 / \"foo\" = 42',\n  '5 / [12] = 42',\n  '5 / class a {} = 42',\n  '5 / function a(){} = 42',\n  '5 / /[a]/ = 42',\n  '5 / `foo` = 42',\n  // StringLiteral\n  '\"foo\" / \"foo\" = 42',\n  '\"foo\" / [12] = 42',\n  '\"foo\" / class a {} = 42',\n  '\"foo\" / function a(){} = 42',\n  '\"foo\" / /[a]/ = 42',\n  '\"foo\" / `foo` = 42',\n  // ArrayLiteral\n  '[12] / [12] = 42',\n  '[12] / class a {} = 42',\n  '[12] / function a(){} = 42',\n  '[12] / /[a]/ = 42',\n  '[12] / `foo` = 42',\n  // ObjectLiteral\n  'this / {} = 42',\n  'undefined / {} = 42',\n  'null / {} = 42',\n  'true / {} = 42',\n  '5 / {} = 42',\n  '\"foo\" / {} = 42',\n  '[12] / {} = 42',\n  '/[a]/ / {} = 42',\n  '`foo` / {} = 42',\n  // RegularExpressionLiteral\n  '/[a]/ / class a{} = 42',\n  '/[a]/ / function a(){} = 42',\n  '/[a]/ / /[a]/ = 42',\n  '/[a]/ / `foo` = 42',\n  // TemplateLiteral\n  '`foo` / class a{} = 42',\n  '`foo` / function a(){} = 42',\n  '`foo` / `foo` = 42',\n  // combining with UnaryExpression\n  '6 / +6 = 42',\n  '6 / -6 = 42',\n  '6 / !6 = 42',\n  '6 / ~6 = 42',\n  'typeof 6 / ~6 = 42',\n  'var a = 6; 6 / ++a = 42',\n  'var a = 6; 6 / --a = 42',\n  'function a(){}; var b = new a(); \"foo\" / ++a = 42',\n  'class a {}; var b = new a(); ++b / function c(){} = 42',\n  'var a = [1,2,3]; var b = {\"foo\" : function(){}}; !a[0] / b.foo = 42',\n  'var a = [1,2,3]; var b = {\"foo\" : function(){}}; !a[0] / b.foo() = 42',\n  'var a = [1]; var b = {\"foo\" : function(){}}; ++a[0] / void b.foo() = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n    "
  },
  {
    "path": "tests/jerry/parser-mult-op-assign-3.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.6.2 % operator\n\nvar tests = [\n  // this\n  'this % this = 42',\n  'this % null = 42',\n  'this % undefined = 42',\n  'this % true = 42',\n  'this % 12 = 42',\n  'this % \"foo\" = 42',\n  'this % [12] = 42',\n  'this % class a {} = 42',\n  'this % function a(){} = 42',\n  'this % /[a]/ = 42',\n  'this % `foo` = 42',\n  // undefined\n  'undefined % null = 42',\n  'undefined % undefined = 42',\n  'undefined % true = 42',\n  'undefined % 12 = 42',\n  'undefined % \"foo\" = 42',\n  'undefined % [12] = 42',\n  'undefined % class a {} = 42',\n  'undefined % function a(){} = 42',\n  'undefined % /[a]/ = 42',\n  'undefined % `foo` = 42',\n  // NullLiteral\n  'null % null = 42',\n  'null % true = 42',\n  'null % 12 = 42',\n  'null % \"foo\" = 42',\n  'null % [12] = 42',\n  'null % class a {} = 42',\n  'null % function a(){} = 42',\n  'null % /[a]/ = 42',\n  'null % `foo` = 42',\n  // BooleanLiteral \n  'true % true = 42',\n  'true % 12 = 42',\n  'true % \"foo\" = 42',\n  'true % [12] = 42',\n  'true % class a {} = 42',\n  'true % function a(){} = 42',\n  'true % /[a]/ = 42',\n  'true % `foo` = 42',\n  // DecimalLiteral \n  '5 % 12 = 42',\n  '5 % \"foo\" = 42',\n  '5 % [12] = 42',\n  '5 % class a {} = 42',\n  '5 % function a(){} = 42',\n  '5 % /[a]/ = 42',\n  '5 % `foo` = 42',\n  // StringLiteral\n  '\"foo\" % \"foo\" = 42',\n  '\"foo\" % [12] = 42',\n  '\"foo\" % class a {} = 42',\n  '\"foo\" % function a(){} = 42',\n  '\"foo\" % /[a]/ = 42',\n  '\"foo\" % `foo` = 42',\n  // ArrayLiteral\n  '[12] % [12] = 42',\n  '[12] % class a {} = 42',\n  '[12] % function a(){} = 42',\n  '[12] % /[a]/ = 42',\n  '[12] % `foo` = 42',\n  // ObjectLiteral\n  'this % {} = 42',\n  'undefined % {} = 42',\n  'true % {} = 42',\n  'null % {} = 42',\n  '5 % {} = 42',\n  '\"foo\" % {} = 42',\n  '[12] % {} = 42',\n  '/[a]/ % {} = 42',\n  '`foo` % {} = 42',\n  // RegularExpressionLiteral\n  '/[a]/ % function a(){} = 42',\n  '/[a]/ % /[a]/ = 42',\n  '/[a]/ % `foo` = 42',\n  // TemplateLiteral\n  '`foo` % function a(){} = 42',\n  '`foo` % `foo` = 42',\n  // combining with UnaryExpression\n  '6 % +6 = 42',\n  '6 % -6 = 42',\n  '6 % !6 = 42',\n  '6 % ~6 = 42',\n  'typeof 6 % ~6 = 42',\n  'var a = 6; 6 % ++a = 42',\n  'var a = 6; 6 % --a = 42',\n  'function a(){}; var b = new a(); \"foo\" % ++a = 42',\n  'class a {}; var b = new a(); ++b % function c(){} = 42',\n  'var a = [1,2,3]; var b = {\"foo\" : function(){}}; !a[0] % b.foo = 42',\n  'var a = [1,2,3]; var b = {\"foo\" : function(){}}; !a[0] % b.foo() = 42',\n  'var a = [1]; var b = {\"foo\" : function(){}}; ++a[0] % void b.foo() = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-not-op-assign.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.4.5 ~ UnaryExpression and ! UnaryExpression\n\nvar tests = [\n  // IdentifierReference\n  'var obj = {a : 10, ret : function(params) {return !a = 42;}}',\n  'var obj = {a : 10, ret : function(params) {return ~a = 42;}}',\n  // NullLiteral\n  'var a = null; !a = 42',\n  'var a = null; ~a = 42',\n  // BooleanLiteral \n  'var a = true; !a = 42',\n  'var a = false; !a = 42',\n  'var a = true; ~a = 42',\n  'var a = false; ~a = 42',\n  // DecimalLiteral \n  'var a = 5; !a = 42',\n  'var a = 1.23e4; !a = 42',\n  'var a = 5; ~a = 42',\n  'var a = 1.23e4; ~a = 42',\n  // BinaryIntegerLiteral \n  'var a = 0b11; !a = 42',\n  'var a = 0B11; !a = 42',\n  'var a = 0b11; ~a = 42',\n  'var a = 0B11; ~a = 42',\n  // OctalIntegerLiteral \n  'var a = 0o66; !a = 42',\n  'var a = 0O66; !a = 42',\n  'var a = 0o66; ~a = 42',\n  'var a = 0O66; ~a = 42',\n  // HexIntegerLiteral \n  'var a = 0xFF; !a = 42',\n  'var a = 0xFF; !a = 42',\n  'var a = 0xFF; ~a = 42',\n  'var a = 0xFF; ~a = 42',\n  // StringLiteral\n  'var a = \"foo\"; !a = 42',\n  'var a = \"\\\\n\"; !a = 42',\n  'var a = \"\\\\uFFFF\"; !a = 42',\n  'var a =\"\\\\u{F}\"; !a = 42',\n  'var a = \"foo\"; ~a = 42',\n  'var a = \"\\\\n\"; ~a = 42',\n  'var a = \"\\\\uFFFF\"; ~a = 42',\n  'var a =\"\\\\u{F}\"; ~a = 42',\n  // ArrayLiteral\n  'var a = []; !a = 42',\n  'var a = [1,a=5]; !a = 42',\n  'var a = []; ~a = 42',\n  'var a = [1,a=5]; ~a = 42',\n  // ObjectLiteral\n  'var a = {}; !a = 42',\n  'var a = {\"foo\" : 5}; !a = 42',\n  'var a = {5 : 5}; !a = 42',\n  'var a = {a : 5}; !a = 42',\n  'var a = {[key] : 5}; !a = 42',\n  'var a = {func(){}}; !a = 42',\n  'var a = {get(){}}; !a = 42',\n  'var a = {set(prop){}}; !a = 42',\n  'var a = {*func(){}}; !a = 42',\n  'var a = {}; ~a = 42',\n  'var a = {\"foo\" : 5}; ~a = 42',\n  'var a = {5 : 5}; ~a = 42',\n  'var a = {a : 5}; ~a = 42',\n  'var a = {[key] : 5}; ~a = 42',\n  'var a = {func(){}}; ~a = 42',\n  'var a = {get(){}}; ~a = 42',\n  'var a = {set(prop){}}; ~a = 42',\n  'var a = {*func(){}}; ~a = 42',\n  // ClassExpression\n  'class a {}; !a = 42',\n  'class a {}; class b extends a {}; !b = 42',\n  'class a {function(){}}; !a = 42',\n  'class a {}; ~a = 42',\n  'class a {}; class b extends a {}; ~b = 42',\n  'class a {function(){}}; ~a = 42',\n  // GeneratorExpression\n  'function *a (){}; !a = 42',\n  'function *a (){}; ~a = 42',\n  // RegularExpressionLiteral\n  'var a = /(?:)/; !a = 42',\n  'var a = /a/; !a = 42',\n  'var a = /[a]/; !a = 42',\n  'var a = /a/g; !a = 42',\n  'var a = /(?:)/; ~a = 42',\n  'var a = /a/; ~a = 42',\n  'var a = /[a]/; ~a = 42',\n  'var a = /a/g; ~a = 42',\n  // TemplateLiteral\n  'var a = ``; !a = 42',\n  'a = 5; var b = (`${a}`); !b = 42',\n  'var a = `foo`; !a = 42',\n  'var a = `\\\\uFFFF`; !a = 42',\n  'var a = ``; ~a = 42',\n  'a = 5; var b = (`${a}`); ~b = 42',\n  'var a = `foo`; ~a = 42',\n  'var a = `\\\\uFFFF`; ~a = 42',\n  // MemberExpression\n  'var a = [1,2,3]; !a[0] = 42',\n  'var a = {0:12}; !a[0] = 42',\n  'var a = {\"foo\":12}; !a.foo = 42',\n  'var a = {func: function(){}}; !a.func = 42',\n  'var a = [1,2,3]; ~a[0] = 42',\n  'var a = {0:12}; ~a[0] = 42',\n  'var a = {\"foo\":12}; ~a.foo = 42',\n  'var a = {func: function(){}}; ~a.func = 42',\n  // SuperProperty\n  'class a {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }} ' +\n  'class b extends a {constructor() {super();} foo() {!super.foo = 42;}}',\n  'class a {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }} ' +\n  'class b extends a {constructor() {super();} foo() {~super.foo = 42;}}',\n  // NewExpression\n  'function a() {}; var b = new a(); !b = 42',\n  'function a() {}; var b = new a(); ~b = 42',\n  'class g {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }}; ' +\n  'var a = new g(); !a = 42',\n  'class g {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }}; ' +\n  'var a = new g(); ~a = 42',\n  'class a {}; var n = new a(); !a = 42',\n  'class a {}; var n = new a(); ~a = 42',\n  // CallExpression\n  'function a(prop){return prop}; var b = a(12); !b = 42',\n  'function a(prop){return prop}; var b = a(12); ~b = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n    "
  },
  {
    "path": "tests/jerry/parser-oom.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* String which is 32 bytes long. */\nvar str = \"1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+\";\n\nfor (var i = 0; i < 10; i++) {\n  str = str + str;\n}\n\nstr = \"(function() { return \" + str + \"1 })\";\n\n/* Eat memory. */\nvar array = [];\n\ntry\n{\n  for (var i = 0; i < 30; i++)\n  {\n    array[i] = eval(str);\n  }\n  assert (false);\n}\ncatch (err)\n{\n  array = null;\n  assert (err === null);\n}\n"
  },
  {
    "path": "tests/jerry/parser-oom2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* String which is 32 bytes long. */\nvar str = \"'\\\\t' +'\\\\t' +'\\\\t'+'\\\\t'+'\\\\t'+'\\\\t'+\";\n\nfor (var i = 0; i < 10; i++) {\n  str = str + str;\n}\n\nstr = \"(function() { return \" + str + \"1 })\";\n\n/* Eat memory. */\nvar array = [];\n\ntry\n{\n  for (var i = 0; i < 90; i++)\n  {\n    array[i] = eval(str);\n  }\n  assert (false);\n}\ncatch (err)\n{\n  array = null;\n  assert (err === null);\n}\n"
  },
  {
    "path": "tests/jerry/parser-plus-negation-op-assign.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA-262 v6 12.4.5 + UnaryExpression and - UnaryExpression\n\nvar tests = [\n  // IdentifierReference\n  'var obj = {a : 10, ret : function(params) {return +a = 42;}}',\n  'var obj = {a : 10, ret : function(params) {return -a = 42;}}',\n  // NullLiteral\n  'var a = null; +a = 42',\n  'var a = null; -a = 42',\n  // BooleanLiteral \n  'var a = true; +a = 42',\n  'var a = false; +a = 42',\n  'var a = true; -a = 42',\n  'var a = false; -a = 42',\n  // DecimalLiteral \n  'var a = 5; +a = 42',\n  'var a = 1.23e4; +a = 42',\n  'var a = 5; -a = 42',\n  'var a = 1.23e4; -a = 42',\n  // BinaryIntegerLiteral \n  'var a = 0b11; +a = 42',\n  'var a = 0B11; +a = 42',\n  'var a = 0b11; -a = 42',\n  'var a = 0B11; -a = 42',\n  // OctalIntegerLiteral \n  'var a = 0o66; +a = 42',\n  'var a = 0O66; +a = 42',\n  'var a = 0o66; -a = 42',\n  'var a = 0O66; -a = 42',\n  // HexIntegerLiteral \n  'var a = 0xFF; +a = 42',\n  'var a = 0xFF; +a = 42',\n  'var a = 0xFF; -a = 42',\n  'var a = 0xFF; -a = 42',\n  // StringLiteral\n  'var a = \"foo\"; +a = 42',\n  'var a = \"\\\\n\"; +a = 42',\n  'var a = \"\\\\uFFFF\"; +a = 42',\n  'var a =\"\\\\u{F}\"; +a = 42',\n  'var a = \"foo\"; -a = 42',\n  'var a = \"\\\\n\"; -a = 42',\n  'var a = \"\\\\uFFFF\"; -a = 42',\n  'var a =\"\\\\u{F}\"; -a = 42',\n  // ArrayLiteral\n  'var a = []; +a = 42',\n  'var a = [1,a=5]; +a = 42',\n  'var a = []; -a = 42',\n  'var a = [1,a=5]; -a = 42',\n  // ObjectLiteral\n  'var a = {}; +a = 42',\n  'var a = {\"foo\" : 5}; +a = 42',\n  'var a = {5 : 5}; +a = 42',\n  'var a = {a : 5}; +a = 42',\n  'var a = {[key] : 5}; +a = 42',\n  'var a = {func(){}}; +a = 42',\n  'var a = {get(){}}; +a = 42',\n  'var a = {set(prop){}}; +a = 42',\n  'var a = {*func(){}}; +a = 42',\n  'var a = {}; -a = 42',\n  'var a = {\"foo\" : 5}; -a = 42',\n  'var a = {5 : 5}; -a = 42',\n  'var a = {a : 5}; -a = 42',\n  'var a = {[key] : 5}; -a = 42',\n  'var a = {func(){}}; -a = 42',\n  'var a = {get(){}}; -a = 42',\n  'var a = {set(prop){}}; -a = 42',\n  'var a = {*func(){}}; -a = 42',\n  // ClassExpression\n  'class a {}; +a = 42',\n  'class a {}; class b extends a {}; +b = 42',\n  'class a {function(){}}; +a = 42',\n  'class a {}; -a = 42',\n  'class a {}; class b extends a {}; -b = 42',\n  'class a {function(){}}; -a = 42',\n  // GeneratorExpression\n  'function *a (){}; +a = 42',\n  'function *a (){}; -a = 42',\n  // RegularExpressionLiteral\n  'var a = /(?:)/; +a = 42',\n  'var a = /a/; +a = 42',\n  'var a = /[a]/; +a = 42',\n  'var a = /a/g; +a = 42',\n  'var a = /(?:)/; -a = 42',\n  'var a = /a/; -a = 42',\n  'var a = /[a]/; -a = 42',\n  'var a = /a/g; -a = 42',\n  // TemplateLiteral\n  'var a = ``; +a = 42',\n  'a = 5; var b = (`${a}`); +b = 42',\n  'var a = `foo`; +a = 42',\n  'var a = `\\\\uFFFF`; +a = 42',\n  'var a = ``; -a = 42',\n  'a = 5; var b = (`${a}`); -b = 42',\n  'var a = `foo`; -a = 42',\n  'var a = `\\\\uFFFF`; -a = 42',\n  // MemberExpression\n  'var a = [1,2,3]; +a[0] = 42',\n  'var a = {0:12}; +a[0] = 42',\n  'var a = {\"foo\":12}; +a.foo = 42',\n  'var a = {func: function(){}}; +a.func = 42',\n  'var a = [1,2,3]; -a[0] = 42',\n  'var a = {0:12}; -a[0] = 42',\n  'var a = {\"foo\":12}; -a.foo = 42',\n  'var a = {func: function(){}}; -a.func = 42',\n  // SuperProperty\n  'class a {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }} ' +\n  'class b extends a {constructor() {super();} foo() {+super.foo = 42;}}',\n  'class a {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }} ' +\n  'class b extends a {constructor() {super();} foo() {-super.foo = 42;}}',\n  // NewExpression\n  'function a() {}; var b = new a(); +b = 42',\n  'function a() {}; var b = new a(); -b = 42',\n  'class g {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }}; ' +\n  'var a = new g(); +a = 42',\n  'class g {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }}; ' +\n  'var a = new g(); -a = 42',\n  'class a {}; var n = new a(); +a = 42',\n  'class a {}; var n = new a(); -a = 42',\n  // CallExpression\n  'function a(prop){return prop}; var b = a(12); +b = 42',\n  'function a(prop){return prop}; var b = a(12); -b = 42',\n];\n  \nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n  "
  },
  {
    "path": "tests/jerry/parser-postfix-exp-assign.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA-262 v6 12.4.3\n\nvar tests = [\n  // IdentifierReference\n  'var obj = {a : 10, ret : function(params) {return a++ = 42;}}',\n  'var obj = {a : 10, ret : function(params) {return a-- = 42;}}',\n  // NullLiteral\n  'var a = null; a++ = 42',\n  'var a = null; a-- = 42',\n  // BooleanLiteral \n  'var a = true; a++ = 42',\n  'var a = false; a++ = 42',\n  'var a = true; a-- = 42',\n  'var a = false; a-- = 42',\n  // DecimalLiteral \n  'var a = 5; a++ = 42',\n  'var a = 1.23e4; a++ = 42',\n  'var a = 5; a-- = 42',\n  'var a = 1.23e4; a-- = 42',\n  // BinaryIntegerLiteral \n  'var a = 0b11; a++ = 42',\n  'var a = 0B11; a++ = 42',\n  'var a = 0b11; a-- = 42',\n  'var a = 0B11; a-- = 42',\n  // OctalIntegerLiteral \n  'var a = 0o66; a++ = 42',\n  'var a = 0O66; a++ = 42',\n  'var a = 0o66; a-- = 42',\n  'var a = 0O66; a-- = 42',\n  // HexIntegerLiteral \n  'var a = 0xFF; a++ = 42',\n  'var a = 0xFF; a++ = 42',\n  'var a = 0xFF; a-- = 42',\n  'var a = 0xFF; a-- = 42',\n  // StringLiteral\n  'var a = \"foo\"; a++ = 42',\n  'var a = \"\\\\n\"; a++ = 42',\n  'var a = \"\\\\uFFFF\"; a++ = 42',\n  'var a =\"\\\\u{F}\"; a++ = 42',\n  'var a = \"foo\"; a-- = 42',\n  'var a = \"\\\\n\"; a-- = 42',\n  'var a = \"\\\\uFFFF\"; a-- = 42',\n  'var a =\"\\\\u{F}\"; a-- = 42',\n  // ArrayLiteral\n  'var a = []; a++ = 42',\n  'var a = [1,a=5]; a++ = 42',\n  'var a = []; a-- = 42',\n  'var a = [1,a=5]; a-- = 42',\n  // ObjectLiteral\n  'var a = {}; a++ = 42',\n  'var a = {\"foo\" : 5}; a++ = 42',\n  'var a = {5 : 5}; a++ = 42',\n  'var a = {a : 5}; a++ = 42',\n  'var a = {[key] : 5}; a++ = 42',\n  'var a = {func(){}}; a++ = 42',\n  'var a = {get(){}}; a++ = 42',\n  'var a = {set(prop){}}; a++ = 42',\n  'var a = {*func(){}}; a++ = 42',\n  'var a = {}; a-- = 42',\n  'var a = {\"foo\" : 5}; a-- = 42',\n  'var a = {5 : 5}; a-- = 42',\n  'var a = {a : 5}; a-- = 42',\n  'var a = {[key] : 5}; a-- = 42',\n  'var a = {func(){}}; a-- = 42',\n  'var a = {get(){}}; a-- = 42',\n  'var a = {set(prop){}}; a-- = 42',\n  'var a = {*func(){}}; a-- = 42',\n  // ClassExpression\n  'class a {}; a++ = 42',\n  'class a {}; class b extends a {}; b++ = 42',\n  'class a {function(){}}; a++ = 42',\n  'class a {}; a-- = 42',\n  'class a {}; class b extends a {}; b-- = 42',\n  'class a {function(){}}; a-- = 42',\n  // GeneratorExpression\n  'function *a (){}; a++ = 42',\n  'function *a (){}; a-- = 42',\n  // RegularExpressionLiteral\n  'var a = /(?:)/; a++ = 42',\n  'var a = /a/; a++ = 42',\n  'var a = /[a]/; a++ = 42',\n  'var a = /a/g; a++ = 42',\n  'var a = /(?:)/; a-- = 42',\n  'var a = /a/; a-- = 42',\n  'var a = /[a]/; a-- = 42',\n  'var a = /a/g; a-- = 42',\n  // TemplateLiteral\n  'var a = ``; a++ = 42',\n  'a = 5; var b = (`${a}`); b++ = 42',\n  'var a = `foo`; a++ = 42',\n  'var a = `\\\\uFFFF`; a++ = 42',\n  'var a = ``; a-- = 42',\n  'a = 5; var b = (`${a}`); b-- = 42',\n  'var a = `foo`; a-- = 42',\n  'var a = `\\\\uFFFF`; a-- = 42',\n  // MemberExpression\n  'var a = [1,2,3]; a[0]++ = 42',\n  'var a = {0:12}; a[0]++ = 42',\n  'var a = {\"foo\":12}; a.foo++ = 42',\n  'var a = {func: function(){}}; a.func++ = 42',\n  'var a = [1,2,3]; a[0]-- = 42',\n  'var a = {0:12}; a[0]-- = 42',\n  'var a = {\"foo\":12}; a.foo-- = 42',\n  'var a = {func: function(){}}; a.func-- = 42',\n  // SuperProperty\n  'class a {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }} ' +\n  'class b extends a {constructor() {super();} foo() {super.foo++ = 42;}}',\n  'class a {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }} ' +\n  'class b extends a {constructor() {super();} foo() {super.foo-- = 42;}}',\n  // NewExpression\n  'function a() {}; var b = new a(); b++ = 42',\n  'function a() {}; var b = new a(); b-- = 42',\n  'class g {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }}; ' +\n  'var a = new g(); a++ = 42',\n  'class g {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }}; ' +\n  'var a = new g(); a-- = 42',\n  'class a {}; var n = new a(); a++ = 42',\n  'class a {}; var n = new a(); a-- = 42',\n  // CallExpression\n  'function a(prop){return prop}; var b = a(12); b++ = 42',\n  'function a(prop){return prop}; var b = a(12); b-- = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-prefix-exp-assign.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA-262 v6 12.5.3 ++ UnaryExpression[?Yield] and -- UnaryExpression[?Yield]\n\nvar tests = [\n  // IdentifierReference\n  'var obj = {a : 10, ret : function(params) {return ++a = 42;}}',\n  'var obj = {a : 10, ret : function(params) {return --a = 42;}}',\n  // NullLiteral\n  'var a = null; ++a = 42',\n  'var a = null; --a = 42',\n  // BooleanLiteral \n  'var a = true; ++a = 42',\n  'var a = false; ++a = 42',\n  'var a = true; --a = 42',\n  'var a = false; --a = 42',\n  // DecimalLiteral \n  'var a = 5; ++a = 42',\n  'var a = 1.23e4; ++a = 42',\n  'var a = 5; --a = 42',\n  'var a = 1.23e4; --a = 42',\n  // BinaryIntegerLiteral \n  'var a = 0b11; ++a = 42',\n  'var a = 0B11; ++a = 42',\n  'var a = 0b11; --a = 42',\n  'var a = 0B11; --a = 42',\n  // OctalIntegerLiteral \n  'var a = 0o66; ++a = 42',\n  'var a = 0O66; ++a = 42',\n  'var a = 0o66; --a = 42',\n  'var a = 0O66; --a = 42',\n  // HexIntegerLiteral \n  'var a = 0xFF; ++a = 42',\n  'var a = 0xFF; ++a = 42',\n  'var a = 0xFF; --a = 42',\n  'var a = 0xFF; --a = 42',\n  // StringLiteral\n  'var a = \"foo\"; ++a = 42',\n  'var a = \"\\\\n\"; ++a = 42',\n  'var a = \"\\\\uFFFF\"; ++a = 42',\n  'var a =\"\\\\u{F}\"; ++a = 42',\n  'var a = \"foo\"; --a = 42',\n  'var a = \"\\\\n\"; --a = 42',\n  'var a = \"\\\\uFFFF\"; --a = 42',\n  'var a =\"\\\\u{F}\"; --a = 42',\n  // ArrayLiteral\n  'var a = []; ++a = 42',\n  'var a = [1,a=5]; ++a = 42',\n  'var a = []; --a = 42',\n  'var a = [1,a=5]; --a = 42',\n  // ObjectLiteral\n  'var a = {}; ++a = 42',\n  'var a = {\"foo\" : 5}; ++a = 42',\n  'var a = {5 : 5}; ++a = 42',\n  'var a = {a : 5}; ++a = 42',\n  'var a = {[key] : 5}; ++a = 42',\n  'var a = {func(){}}; ++a = 42',\n  'var a = {get(){}}; ++a = 42',\n  'var a = {set(prop){}}; ++a = 42',\n  'var a = {*func(){}}; ++a = 42',\n  'var a = {}; --a = 42',\n  'var a = {\"foo\" : 5}; --a = 42',\n  'var a = {5 : 5}; --a = 42',\n  'var a = {a : 5}; --a = 42',\n  'var a = {[key] : 5}; --a = 42',\n  'var a = {func(){}}; --a = 42',\n  'var a = {get(){}}; --a = 42',\n  'var a = {set(prop){}}; --a = 42',\n  'var a = {*func(){}}; --a = 42',\n  // ClassExpression\n  'class a {}; ++a = 42',\n  'class a {}; class b extends a {}; b++ = 42',\n  'class a {function(){}}; ++a = 42',\n  'class a {}; --a= 42',\n  'class a {}; class b extends a {}; --b = 42',\n  'class a {function(){}}; --a = 42',\n  // GeneratorExpression\n  'function *a (){}; ++a = 42',\n  'function *a (){}; --a = 42',\n  // RegularExpressionLiteral\n  'var a = /(?:)/; ++a = 42',\n  'var a = /a/; ++a = 42',\n  'var a = /[a]/; ++a = 42',\n  'var a = /a/g; ++a = 42',\n  'var a = /(?:)/; --a = 42',\n  'var a = /a/; --a = 42',\n  'var a = /[a]/; --a = 42',\n  'var a = /a/g; --a = 42',\n  // TemplateLiteral\n  'var a = ``; ++a = 42',\n  'a = 5; var b = (`${a}`); b++ = 42',\n  'var a = `foo`; ++a = 42',\n  'var a = `\\\\uFFFF`; ++a = 42',\n  'var a = ``; --a = 42',\n  'a = 5; var b = (`${a}`); --b = 42',\n  'var a = `foo`; --a = 42',\n  'var a = `\\\\uFFFF`; --a = 42',\n  // MemberExpression\n  'var a = [1,2,3]; ++a[0] = 42',\n  'var a = {0:12}; ++a[0] = 42',\n  'var a = {\"foo\":12}; ++a.foo = 42',\n  'var a = {func: function(){}}; ++a.func = 42',\n  'var a = [1,2,3]; --a[0] = 42',\n  'var a = {0:12}; --a[0] = 42',\n  'var a = {\"foo\":12}; --a.foo = 42',\n  'var a = {func: function(){}}; --a.func = 42',\n  // SuperProperty\n  'class a {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }} ' +\n  'class b extends a {constructor() {super();} foo() {++super.foo = 42;}}',\n  'class a {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }} ' +\n  'class b extends a {constructor() {super();} foo() {--super.foo = 42;}}',\n  // NewExpression\n  'function a() {}; var b = new a(); ++b = 42',\n  'function a() {}; var b = new a(); --b = 42',\n  'class g {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }}; ' +\n  'var a = new g(); ++a = 42',\n  'class g {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }}; ' +\n  'var a = new g(); --a = 42',\n  // CallExpression\n  'function a(prop){return prop}; var b = a(12); ++b = 42',\n  'function a(prop){return prop}; var b = a(12); --b = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-rational-exp-assign-1.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// tests for ECMA~262 v6 12.9.2 < and <= operations\n\nvar tests = [\n  // this\n  'this < this = 42',\n  'this < null = 42',\n  'this < undefined = 42',\n  'this < true = 42',\n  'this < 12 = 42',\n  'this < \"foo\" = 42',\n  'this < [12] = 42',\n  'this < class a {} = 42',\n  'this < function a(){} = 42',\n  'this < /[a]/ = 42',\n  'this < `foo` = 42',\n  'this <= this = 42',\n  'this <= null = 42',\n  'this <= undefined = 42',\n  'this <= true = 42',\n  'this <= 12 = 42',\n  'this <= \"foo\" = 42',\n  'this <= [12] = 42',\n  'this <= class a {} = 42',\n  'this <= function a(){} = 42',\n  'this <= /[a]/ = 42',\n  'this <= `foo` = 42',\n  // undefined\n  'undefined < null = 42',\n  'undefined < undefined = 42',\n  'undefined < true = 42',\n  'undefined < 12 = 42',\n  'undefined < \"foo\" = 42',\n  'undefined < [12] = 42',\n  'undefined < class a {} = 42',\n  'undefined < function a(){} = 42',\n  'undefined < /[a]/ = 42',\n  'undefined < `foo` = 42',\n  'undefined <= null = 42',\n  'undefined <= undefined = 42',\n  'undefined <= true = 42',\n  'undefined <= 12 = 42',\n  'undefined <= \"foo\" = 42',\n  'undefined <= [12] = 42',\n  'undefined <= class a {} = 42',\n  'undefined <= function a(){} = 42',\n  'undefined <= /[a]/ = 42',\n  'undefined <= `foo` = 42',\n  // NullLiteral\n  'null < null = 42',\n  'null < true = 42',\n  'null < 12 = 42',\n  'null < \"foo\" = 42',\n  'null < [12] = 42',\n  'null < class a {} = 42',\n  'null < function a(){} = 42',\n  'null < /[a]/ = 42',\n  'null < `foo` = 42',\n  'null <= null = 42',\n  'null <= true = 42',\n  'null <= 12 = 42',\n  'null <= \"foo\" = 42',\n  'null <= [12] = 42',\n  'null <= class a {} = 42',\n  'null <= function a(){} = 42',\n  'null <= /[a]/ = 42',\n  'null <= `foo` = 42',\n  // BooleanLiteral \n  'true < true = 42',\n  'true < 12 = 42',\n  'true < \"foo\" = 42',\n  'true < [12] = 42',\n  'true < class a {} = 42',\n  'true < function a(){} = 42',\n  'true < /[a]/ = 42',\n  'true < `foo` = 42',\n  'true <= true = 42',\n  'true <= 12 = 42',\n  'true <= \"foo\" = 42',\n  'true <= [12] = 42',\n  'true <= class a {} = 42',\n  'true <= function a(){} = 42',\n  'true <= /[a]/ = 42',\n  'true <= `foo` = 42',\n  // DecimalLiteral \n  '5 < 12 = 42',\n  '5 < \"foo\" = 42',\n  '5 < [12] = 42',\n  '5 < class a {} = 42',\n  '5 < function a(){} = 42',\n  '5 < /[a]/ = 42',\n  '5 < `foo` = 42',\n  '5 <= 12 = 42',\n  '5 <= \"foo\" = 42',\n  '5 <= [12] = 42',\n  '5 <= class a {} = 42',\n  '5 <= function a(){} = 42',\n  '5 <= /[a]/ = 42',\n  '5 <= `foo` = 42',\n  // StringLiteral\n  '\"foo\" < \"foo\" = 42',\n  '\"foo\" < [12] = 42',\n  '\"foo\" < class a {} = 42',\n  '\"foo\" < function a(){} = 42',\n  '\"foo\" < /[a]/ = 42',\n  '\"foo\" < `foo` = 42',\n  '\"foo\" <= \"foo\" = 42',\n  '\"foo\" <= [12] = 42',\n  '\"foo\" <= class a {} = 42',\n  '\"foo\" <= function a(){} = 42',\n  '\"foo\" <= /[a]/ = 42',\n  '\"foo\" <= `foo` = 42',\n  // ArrayLiteral\n  '[12] < [12] = 42',\n  '[12] < class a {} = 42',\n  '[12] < function a(){} = 42',\n  '[12] < /[a]/ = 42',\n  '[12] < `foo` = 42',\n  '[12] <= [12] = 42',\n  '[12] <= class a {} = 42',\n  '[12] <= function a(){} = 42',\n  '[12] <= /[a]/ = 42',\n  '[12] <= `foo` = 42',\n  // ObjectLiteral\n  'this < {} = 42',\n  'this <= {} = 42',\n  'undefined < {} = 42',\n  'undefined <= {} = 42',\n  'null < {} = 42',\n  'null <= {} = 42',\n  'true < {} = 42',\n  'true <= {} = 42',\n  '5 < {} = 42',\n  '5 <= {} = 42',\n  '\"foo\" < {} = 42',\n  '\"foo\" <= {} = 42',\n  '[12] < {} = 42',\n  '[12] <= {} = 42',\n  '/[a]/ < {}  = 42',\n  '`foo` < {}  = 42',\n  '/[a]/ <= {}  = 42',\n  '`foo` <= {}  = 42',\n  // RegularExpressionLiteral\n  '/[a]/ < class a{} = 42',\n  '/[a]/ < function a(){} = 42',\n  '/[a]/ < /[a]/ = 42',\n  '/[a]/ < `foo` = 42',\n  '/[a]/ <= class a{} = 42',\n  '/[a]/ <= function a(){} = 42',\n  '/[a]/ <= /[a]/ = 42',\n  '/[a]/ <= `foo` = 42',\n  // TemplateLiteral\n  '`foo` < class a{} = 42',\n  '`foo` < function a(){} = 42',\n  '`foo` < `foo` = 42',\n  '`foo` <= class a{} = 42',\n  '`foo` <= function a(){} = 42',\n  '`foo` <= `foo` = 42',\n  // combining with ShiftExpression\n  '6 * !4 + void 4 <=\"foo\" << 6 * 6 + !4 / 7 = 42',\n  '+/[A]/ % !4 + typeof [] << 3 <= \"foo\" << 6 / 6 << !4 / 7 = 42',\n  '~12 < !/[A-Z]/ * 12 - void [] >> 1 + class a {} = 42',\n  'var a = [1,2,3]; +a[0] * !a[1] + \"foo\" >> a[2] <= typeof a[1] + /foo/ * 12 = 42',\n  'var a = [1,2,3]; 0 / ++a[1] - a[2] << !12 < void a[1] % 12 = 42',\n  'function a(){}; var b = new a(); b >> 12 <= [1,2] / !23 + !a = 42',\n  'var a = {\"foo\": function(){}}; 12 * ~5 >> \"foo\" + [] < void \"foo\" % 12 <= ++a.foo = 42',\n  'var a = {\"foo\": function(){}}; [] < \"foo\" % 12 << typeof a.foo() + 8 = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-rational-exp-assign-2.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.9.2 > and >= operations\n\nvar tests = [\n  // this\n  'this > this = 42',\n  'this > null = 42',\n  'this > undefined = 42',\n  'this > true = 42',\n  'this > 12 = 42',\n  'this > \"foo\" = 42',\n  'this > [12] = 42',\n  'this > class a {} = 42',\n  'this > function a(){} = 42',\n  'this > /[a]/ = 42',\n  'this > `foo` = 42',\n  'this >= this = 42',\n  'this >= null = 42',\n  'this >= undefined = 42',\n  'this >= true = 42',\n  'this >= 12 = 42',\n  'this >= \"foo\" = 42',\n  'this >= [12] = 42',\n  'this >= class a {} = 42',\n  'this >= function a(){} = 42',\n  'this >= /[a]/ = 42',\n  'this >= `foo` = 42',\n  // undefined\n  'undefined > null = 42',\n  'undefined > undefined = 42',\n  'undefined > true = 42',\n  'undefined > 12 = 42',\n  'undefined > \"foo\" = 42',\n  'undefined > [12] = 42',\n  'undefined > class a {} = 42',\n  'undefined > function a(){} = 42',\n  'undefined > /[a]/ = 42',\n  'undefined > `foo` = 42',\n  'undefined >= null = 42',\n  'undefined >= undefined = 42',\n  'undefined >= true = 42',\n  'undefined >= 12 = 42',\n  'undefined >= \"foo\" = 42',\n  'undefined >= [12] = 42',\n  'undefined >= class a {} = 42',\n  'undefined >= function a(){} = 42',\n  'undefined >= /[a]/ = 42',\n  'undefined >= `foo` = 42',\n  // NullLiteral\n  'null > null = 42',\n  'null > true = 42',\n  'null > 12 = 42',\n  'null > \"foo\" = 42',\n  'null > [12] = 42',\n  'null > class a {} = 42',\n  'null > function a(){} = 42',\n  'null > /[a]/ = 42',\n  'null > `foo` = 42',\n  'null >= null = 42',\n  'null >= true = 42',\n  'null >= 12 = 42',\n  'null >= \"foo\" = 42',\n  'null >= [12] = 42',\n  'null >= class a {} = 42',\n  'null >= function a(){} = 42',\n  'null >= /[a]/ = 42',\n  'null >= `foo` = 42',\n  // BooleanLiteral \n  'true > true = 42',\n  'true > 12 = 42',\n  'true > \"foo\" = 42',\n  'true > [12] = 42',\n  'true > class a {} = 42',\n  'true > function a(){} = 42',\n  'true > /[a]/ = 42',\n  'true > `foo` = 42',\n  'true >= true = 42',\n  'true >= 12 = 42',\n  'true >= \"foo\" = 42',\n  'true >= [12] = 42',\n  'true >= class a {} = 42',\n  'true >= function a(){} = 42',\n  'true >= /[a]/ = 42',\n  'true >= `foo` = 42',\n  // DecimalLiteral \n  '5 > 12 = 42',\n  '5 > \"foo\" = 42',\n  '5 > [12] = 42',\n  '5 > class a {} = 42',\n  '5 > function a(){} = 42',\n  '5 > /[a]/ = 42',\n  '5 > `foo` = 42',\n  '5 >= 12 = 42',\n  '5 >= \"foo\" = 42',\n  '5 >= [12] = 42',\n  '5 >= class a {} = 42',\n  '5 >= function a(){} = 42',\n  '5 >= /[a]/ = 42',\n  '5 >= `foo` = 42',\n  // StringLiteral\n  '\"foo\" > \"foo\" = 42',\n  '\"foo\" > [12] = 42',\n  '\"foo\" > class a {} = 42',\n  '\"foo\" > function a(){} = 42',\n  '\"foo\" > /[a]/ = 42',\n  '\"foo\" > `foo` = 42',\n  '\"foo\" >= \"foo\" = 42',\n  '\"foo\" >= [12] = 42',\n  '\"foo\" >= class a {} = 42',\n  '\"foo\" >= function a(){} = 42',\n  '\"foo\" >= /[a]/ = 42',\n  '\"foo\" >= `foo` = 42',\n  // ArrayLiteral\n  '[12] > [12] = 42',\n  '[12] > class a {} = 42',\n  '[12] > function a(){} = 42',\n  '[12] > /[a]/ = 42',\n  '[12] > `foo` = 42',\n  '[12] >= [12] = 42',\n  '[12] >= class a {} = 42',\n  '[12] >= function a(){} = 42',\n  '[12] >= /[a]/ = 42',\n  '[12] >= `foo` = 42',\n  // ObjectLiteral\n  'this > {} = 42',\n  'this >= {} = 42',\n  'undefined > {} = 42',\n  'undefined >= {} = 42',\n  'null > {} = 42',\n  'null >= {} = 42',\n  'true > {} = 42',\n  'true >= {} = 42',\n  '5 > {} = 42',\n  '5 >= {} = 42',\n  '\"foo\" > {} = 42',\n  '\"foo\" >= {} = 42',\n  '[12] > {} = 42',\n  '[12] >= {} = 42',\n  '/[a]/ > {}  = 42',\n  '`foo` > {}  = 42',\n  '/[a]/ >= {}  = 42',\n  '`foo` >= {}  = 42',\n  // RegularExpressionLiteral\n  '/[a]/ > class a{} = 42',\n  '/[a]/ > function a(){} = 42',\n  '/[a]/ > /[a]/ = 42',\n  '/[a]/ > `foo` = 42',\n  '/[a]/ >= class a{} = 42',\n  '/[a]/ >= function a(){} = 42',\n  '/[a]/ >= /[a]/ = 42',\n  '/[a]/ >= `foo` = 42',\n  // TemplateLiteral\n  '`foo` > class a{} = 42',\n  '`foo` > function a(){} = 42',\n  '`foo` > `foo` = 42',\n  '`foo` >= class a{} = 42',\n  '`foo` >= function a(){} = 42',\n  '`foo` >= `foo` = 42',\n  // combining with ShiftExpression\n  '6 * !4 + void 4 >=\"foo\" >> 6 * 6 + !4 / 7 = 42',\n  '+/[A]/ % !4 + typeof [] >> 3 >= \"foo\" >> 6 / 6 >> !4 / 7 = 42',\n  '~12 > !/[A-Z]/ * 12 - void [] >> 1 + class a {} = 42',\n  'var a = [1,2,3]; +a[0] * !a[1] + \"foo\" >> a[2] >= typeof a[1] + /foo/ * 12 = 42',\n  'var a = [1,2,3]; 0 / ++a[1] - a[2] >> !12 > void a[1] % 12 = 42',\n  'function a(){}; var b = new a(); b >> 12 >= [1,2] / !23 + !a = 42',\n  'var a = {\"foo\": function(){}}; 12 * ~5 >> \"foo\" + [] > void \"foo\" % 12 >= ++a.foo = 42',\n  'var a = {\"foo\": function(){}}; [] > \"foo\" % 12 >> typeof a.foo() + 8 = 42',\n];\n\nfor (var i = 0; i > tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-shift-exp-assign.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.8.2\n\nvar tests = [\n  // this\n  'this << this = 42',\n  'this << null = 42',\n  'this << undefined = 42',\n  'this << true = 42',\n  'this << 12 = 42',\n  'this << \"foo\" = 42',\n  'this << [12] = 42',\n  'this << class a {} = 42',\n  'this << function a(){} = 42',\n  'this << /[a]/ = 42',\n  'this << `foo` = 42',\n  'this >> this = 42',\n  'this >> null = 42',\n  'this >> undefined = 42',\n  'this >> true = 42',\n  'this >> 12 = 42',\n  'this >> \"foo\" = 42',\n  'this >> [12] = 42',\n  'this >> class a {} = 42',\n  'this >> function a(){} = 42',\n  'this >> /[a]/ = 42',\n  'this >> `foo` = 42',\n  // undefined\n  'undefined << null = 42',\n  'undefined << undefined = 42',\n  'undefined << true = 42',\n  'undefined << 12 = 42',\n  'undefined << \"foo\" = 42',\n  'undefined << [12] = 42',\n  'undefined << class a {} = 42',\n  'undefined << function a(){} = 42',\n  'undefined << /[a]/ = 42',\n  'undefined << `foo` = 42',\n  'undefined >> null = 42',\n  'undefined >> undefined = 42',\n  'undefined >> true = 42',\n  'undefined >> 12 = 42',\n  'undefined >> \"foo\" = 42',\n  'undefined >> [12] = 42',\n  'undefined >> class a {} = 42',\n  'undefined >> function a(){} = 42',\n  'undefined >> /[a]/ = 42',\n  'undefined >> `foo` = 42',\n  // NullLiteral\n  'null << null = 42',\n  'null << true = 42',\n  'null << 12 = 42',\n  'null << \"foo\" = 42',\n  'null << [12] = 42',\n  'null << class a {} = 42',\n  'null << function a(){} = 42',\n  'null << /[a]/ = 42',\n  'null << `foo` = 42',\n  'null >> null = 42',\n  'null >> true = 42',\n  'null >> 12 = 42',\n  'null >> \"foo\" = 42',\n  'null >> [12] = 42',\n  'null >> class a {} = 42',\n  'null >> function a(){} = 42',\n  'null >> /[a]/ = 42',\n  'null >> `foo` = 42',\n  // BooleanLiteral \n  'true << true = 42',\n  'true << 12 = 42',\n  'true << \"foo\" = 42',\n  'true << [12] = 42',\n  'true << class a {} = 42',\n  'true << function a(){} = 42',\n  'true << /[a]/ = 42',\n  'true << `foo` = 42',\n  'true >> true = 42',\n  'true >> 12 = 42',\n  'true >> \"foo\" = 42',\n  'true >> [12] = 42',\n  'true >> class a {} = 42',\n  'true >> function a(){} = 42',\n  'true >> /[a]/ = 42',\n  'true >> `foo` = 42',\n  // DecimalLiteral \n  '5 << 12 = 42',\n  '5 << \"foo\" = 42',\n  '5 << [12] = 42',\n  '5 << class a {} = 42',\n  '5 << function a(){} = 42',\n  '5 << /[a]/ = 42',\n  '5 << `foo` = 42',\n  '5 >> 12 = 42',\n  '5 >> \"foo\" = 42',\n  '5 >> [12] = 42',\n  '5 >> class a {} = 42',\n  '5 >> function a(){} = 42',\n  '5 >> /[a]/ = 42',\n  '5 >> `foo` = 42',\n  // StringLiteral\n  '\"foo\" << \"foo\" = 42',\n  '\"foo\" << [12] = 42',\n  '\"foo\" << class a {} = 42',\n  '\"foo\" << function a(){} = 42',\n  '\"foo\" << /[a]/ = 42',\n  '\"foo\" << `foo` = 42',\n  '\"foo\" >> \"foo\" = 42',\n  '\"foo\" >> [12] = 42',\n  '\"foo\" >> class a {} = 42',\n  '\"foo\" >> function a(){} = 42',\n  '\"foo\" >> /[a]/ = 42',\n  '\"foo\" >> `foo` = 42',\n  // ArrayLiteral\n  '[12] << [12] = 42',\n  '[12] << class a {} = 42',\n  '[12] << function a(){} = 42',\n  '[12] << /[a]/ = 42',\n  '[12] << `foo` = 42',\n  '[12] >> [12] = 42',\n  '[12] >> class a {} = 42',\n  '[12] >> function a(){} = 42',\n  '[12] >> /[a]/ = 42',\n  '[12] >> `foo` = 42',\n  // ObjectLiteral\n  'this << {} = 42',\n  'this >> {} = 42',\n  'undefined << {} = 42',\n  'undefined >> {} = 42',\n  'null << {} = 42',\n  'null >> {} = 42',\n  'true << {} = 42',\n  'true >> {} = 42',\n  '5 << {} = 42',\n  '5 >> {} = 42',\n  '\"foo\" << {} = 42',\n  '\"foo\" >> {} = 42',\n  '[12] << {} = 42',\n  '[12] >> {} = 42',\n  '/[a]/ << {} = 42',\n  '`foo` << {} = 42',\n  '/[a]/ >> {} = 42',\n  '`foo` >> {} = 42',\n  // RegularExpressionLiteral\n  '/[a]/ << class a{} = 42',\n  '/[a]/ << function a(){} = 42',\n  '/[a]/ << /[a]/ = 42',\n  '/[a]/ << `foo` = 42',\n  '/[a]/ >> class a{} = 42',\n  '/[a]/ >> function a(){} = 42',\n  '/[a]/ >> /[a]/ = 42',\n  '/[a]/ >> `foo` = 42',\n  // TemplateLiteral\n  '`foo` << class a{} = 42',\n  '`foo` << function a(){} = 42',\n  '`foo` << `foo` = 42',\n  '`foo` >> class a{} = 42',\n  '`foo` >> function a(){} = 42',\n  '`foo` >> `foo` = 42',\n  // combining with AdditiveExpression\n  '\"foo\" << 6 * 6 + !4 / 7 = 42',\n  'void function a(){} >> +6 * !6 - ~4 / \"foo\" = 42',\n  'var a = 5; 5 >>> ++a * \"foo\" << function a(){} = 42',\n  '`foo` << +/(?:)/ % 25 + void 6 / typeof class a {} = 42',\n  'function a(){}; var b = new a(); 5 >>> ++a / !23 + !a = 42',\n  'var a = {\"foo\": function(){}}; void \"foo\" % 12 >> typeof a.foo = 42',\n  'var a = {\"foo\": function(){}}; -\"foo\" % 12 << typeof a.foo() = 42',\n  'var a = [1,2,3]; a[2] << !a[0] % /[A]/ - delete 12 = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/parser-typeof-op-assign.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.4.5 typeof UnaryExpression\n\nvar tests = [\n  // IdentifierReference\n  'var obj = {a : 10, ret : function(params) {typeof a = 42;}}',\n  // NullLiteral\n  'var a = null; typeof a = 42',\n  // BooleanLiteral \n  'var a = true; typeof a = 42',\n  'var a = false; typeof a = 42',\n  // DecimalLiteral \n  'var a = 5; typeof a = 42',\n  'var a = 1.23e4; typeof a = 42',\n  // BinaryIntegerLiteral \n  'var a = 0b11; typeof a = 42',\n  'var a = 0B11; typeof a = 42',\n  // OctalIntegerLiteral \n  'var a = 0o66; typeof a = 42',\n  'var a = 0O66; typeof a = 42',\n  // HexIntegerLiteral \n  'var a = 0xFF; typeof a = 42',\n  'var a = 0xFF; typeof a = 42',\n  // StringLiteral\n  'var a = \"foo\"; typeof a = 42',\n  'var a = \"\\\\n\"; typeof a = 42',\n  'var a = \"\\\\uFFFF\"; typeof a = 42',\n  'var a =\"\\\\u{F}\"; typeof a = 42',\n  // ArrayLiteral\n  'var a = []; typeof a = 42',\n  'var a = [1,a=5]; typeof a = 42',\n  // ObjectLiteral\n  'var a = {}; typeof a = 42',\n  'var a = {\"foo\" : 5}; typeof a = 42',\n  'var a = {5 : 5}; typeof a = 42',\n  'var a = {a : 5}; typeof a = 42',\n  'var a = {[key] : 5}; typeof a = 42',\n  'var a = {func(){}}; typeof a = 42',\n  'var a = {get(){}}; typeof a = 42',\n  'var a = {set(prop){}}; typeof a = 42',\n  'var a = {*func(){}}; typeof a = 42',\n  // ClassExpression\n  'class a {}; typeof a = 42',\n  'class a {}; class b extends a {}; typeof b = 42',\n  'class a {function(){}}; typeof a = 42',\n  // GeneratorExpression\n  'function *a (){}; typeof a = 42',\n  // RegularExpressionLiteral\n  'var a = /(?:)/; typeof a = 42',\n  'var a = /a/; typeof a = 42',\n  'var a = /[a]/; typeof a = 42',\n  'var a = /a/g; typeof a = 42',\n  // TemplateLiteral\n  'var a = ``; typeof a = 42',\n  'a = 5; var b = (`${a}`); typeof b = 42',\n  'var a = `foo`; typeof a = 42',\n  'var a = `\\\\uFFFF`; typeof a = 42',\n  // MemberExpression\n  'var a = [1,2,3]; typeof a[0] = 42',\n  'var a = {0:12}; typeof a[0] = 42',\n  'var a = {\"foo\":12}; typeof a.foo = 42',\n  'var a = {func: function(){}}; typeof a.func = 42',\n  // SuperProperty\n  'class a {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }} ' +\n  'class b extends a {constructor() {super();} foo() {typeof super.foo = 42;}}',\n  // NewExpression\n  'function a() {}; var b = new a(); typeof b = 42',\n  'class a {}; var n = new a(); typeof a = 42',\n  'class g {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }}; ' +\n  'var a = new g(); typeof a = 42',\n  // CallExpression\n  'function a(prop){return prop}; var b = a(12); typeof b = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n   "
  },
  {
    "path": "tests/jerry/parser-void-op-assign.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tests for ECMA~262 v6 12.4.5 void UnaryExpression\n\nvar tests = [\n  // IdentifierReference\n  'var obj = {a : 10, ret : function(params) {void a = 42;}}',\n  // NullLiteral\n  'var a = null; void a = 42',\n  // BooleanLiteral \n  'var a = true; void a = 42',\n  'var a = false; void a = 42',\n  // DecimalLiteral \n  'var a = 5; void a = 42',\n  'var a = 1.23e4; void a = 42',\n  // BinaryIntegerLiteral \n  'var a = 0b11; void a = 42',\n  'var a = 0B11; void a = 42',\n  // OctalIntegerLiteral \n  'var a = 0o66; void a = 42',\n  'var a = 0O66; void a = 42',\n  // HexIntegerLiteral \n  'var a = 0xFF; void a = 42',\n  'var a = 0xFF; void a = 42',\n  // StringLiteral\n  'var a = \"foo\"; void a = 42',\n  'var a = \"\\\\n\"; void a = 42',\n  'var a = \"\\\\uFFFF\"; void a = 42',\n  'var a =\"\\\\u{F}\"; void a = 42',\n  // ArrayLiteral\n  'var a = []; void a = 42',\n  'var a = [1,a=5]; void a = 42',\n  // ObjectLiteral\n  'var a = {}; void a = 42',\n  'var a = {\"foo\" : 5}; void a = 42',\n  'var a = {5 : 5}; void a = 42',\n  'var a = {a : 5}; void a = 42',\n  'var a = {[key] : 5}; void a = 42',\n  'var a = {func(){}}; void a = 42',\n  'var a = {get(){}}; void a = 42',\n  'var a = {set(prop){}}; void a = 42',\n  'var a = {*func(){}}; void a = 42',\n  // ClassExpression\n  'class a {}; void a = 42',\n  'class a {}; class b extends a {}; void b = 42',\n  'class a {function(){}}; void a = 42',\n  // GeneratorExpression\n  'function *a (){}; void a = 42',\n  // RegularExpressionLiteral\n  'var a = /(?:)/; void a = 42',\n  'var a = /a/; void a = 42',\n  'var a = /[a]/; void a = 42',\n  'var a = /a/g; void a = 42',\n  // TemplateLiteral\n  'var a = ``; void a = 42',\n  'a = 5; var b = (`${a}`); void b = 42',\n  'var a = `foo`; void a = 42',\n  'var a = `\\\\uFFFF`; void a = 42',\n  // MemberExpression\n  'var a = [1,2,3]; void a[0] = 42',\n  'var a = {0:12}; void a[0] = 42',\n  'var a = {\"foo\":12}; void a.foo = 42',\n  'var a = {func: function(){}}; void a.func = 42',\n  // SuperProperty\n  'class a {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }} ' +\n  'class b extends a {constructor() {super();} foo() {void super.foo = 42;}}',\n  // NewExpression\n  'function a() {}; var b = new a(); void b = 42',\n  'class g {constructor() {Object.defineProperty(this, \\'foo\\', {configurable:true, writable:true, value:1}); }}; ' +\n  'var a = new g(); void a = 42',\n  'class a {}; var n = new a(); void a = 42',\n  // CallExpression\n  'function a(prop){return prop}; var b = a(12); void b = 42',\n];\n\nfor (var i = 0; i < tests.length; i++)\n{\n  try {\n    eval(tests[i]);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n    "
  },
  {
    "path": "tests/jerry/prescanner.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = 0;\nvar count = 0;\nwhile ( function() { while (++a < 0) ; } (), a < 4) {\n  while (++count < 0) ;\n}\nassert(count == 3);\n\nfor (a = 0, count = 0; function() { while (++a < 0) ; } (), a < 4 ; ) {\n  while (++count < 0) ;\n}\nassert(count == 3);\n\na = 0;\ncount = 0;\nswitch (100) {\n  default:\n    while (++a < 2) ;\n    break;\n\n  case (function () { for (var a = 0; a <= 1; a++) count ++; return a; })():\n    while (++a < 100) ;\n    break;\n\n  case (function () { for (var a = 0; a <= 2; a++) count ++; return a; })():\n    while (++a < 100) ;\n    break;\n\n  case (function () { for (var a = 0; a <= 3; a++) count ++; return a; })():\n    while (++a < 100) ;\n    break;\n\n  case (function () { for (var a = 0; a <= 4; a++) count ++; return a; })():\n    while (++a < 100) ;\n    break;\n}\n\nassert (count == 14);\nassert (a == 2);\n"
  },
  {
    "path": "tests/jerry/private_fields.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_syntax_error(code) {\n  try {\n    eval(code)\n    assert(false)\n  } catch (e) {\n    assert(e instanceof SyntaxError)\n  }\n}\n\ncheck_syntax_error(\"#a\");\ncheck_syntax_error(\"class A { #a; #a; }\");\ncheck_syntax_error(\"class A { # a; }\");\ncheck_syntax_error(\"class A { #5; }\");\ncheck_syntax_error(\"class A { #\\\"bar\\\"; }\");\ncheck_syntax_error(\"class A { ##; }\");\ncheck_syntax_error(\"class A { ##a; }\");\ncheck_syntax_error(\"class A { #a; foo(){ delete this.#a } }\");\ncheck_syntax_error(\"class A { #constructor; }\");\ncheck_syntax_error(\"class A { #constructor(){}; }\");\ncheck_syntax_error(\"class A { #a; foo(){ if(#a){ } } }\");\ncheck_syntax_error(\"class A { #a; foo(){ if(#b){ } } }\");\ncheck_syntax_error(\"class A { #a; foo(){ if(#a in this){ let b = #b } } }\");\ncheck_syntax_error(\"class A { #a; }; let b = new A(); b.#a\");\ncheck_syntax_error(\"class A { #a; }; class B extends A { foo(){ return this.#a; } }\");\ncheck_syntax_error(\"class A { #a; get #a(){}; }\");\ncheck_syntax_error(\"class A { set #a(){}; get #a(){}; #a; }\");\ncheck_syntax_error(\"class A { get #a(){}; get #a(){}; }\");\ncheck_syntax_error(\"class A { async *#a(){}; #a }\");\ncheck_syntax_error(\"class A { async get #a(){}; }\");\ncheck_syntax_error(\"class A { get *#a(){}; }\");\ncheck_syntax_error(\"class A { static get #a(){}; set #a(){}; #a; }\");\ncheck_syntax_error(\"class A { static #a(){}; #a; }\");\ncheck_syntax_error(\"class A extends B{ foo(){ super.#a }}\");\ncheck_syntax_error(\"class A extends function() { x = this.#foo; }{ #foo; };\");\ncheck_syntax_error(\"class A { static async *#bar(x) { } #bar }\");\ncheck_syntax_error(\"class A { static async #bar(x) { } #bar }\");\ncheck_syntax_error(\"class A { static *#bar(x) { } #bar }\");\ncheck_syntax_error(\"class A { async *#bar(x) { } #bar }\");\ncheck_syntax_error(\"class A { async #bar(x) { } #bar }\");\ncheck_syntax_error(\"class A { *#bar(x) { } #bar }\");\n\n\nclass A {\n  #a = 1;\n  static #k = 12;\n  #m_;\n  b() {\n    return this.#a;\n  }\n  #c() {\n    return 5 + 6;\n  }\n  callC() {\n    return this.#c();\n  }\n  get #m() {\n    return this.#m_;\n  }\n  set #m(value) {\n    this.#m_ = value;\n  }\n  setM() {\n    this.#m = \"foo\";\n  }\n  getM() {\n    return this.#m;\n  }\n  static getK() {\n    return A.#k;\n  }\n}\n\nvar var1 = new A();\nassert(var1.b() == 1);\nassert(var1.callC() == 11);\nvar1.setM();\nassert(var1.getM() == \"foo\");\nassert(A.getK() == 12);\n\nclass B extends A {\n  #a = 2;\n  c() {\n    return this.#a;\n  }\n}\n\nvar var2 = new B();\nassert(var2.b() == 1);\nassert(var2.c() == 2);\n\n// Every evaluation of class body creates a new private field\nclass C {\n  #a = 3;\n  b(o) {\n    return o.#a;\n  }\n}\n\nclass D {\n  #a = 4;\n}\n\nvar var3 = new C();\nvar var4 = new D();\n\ntry {\n  var3.b(var4);\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nfunction createClass() {\n  return class {\n    #a = 1;\n    b() {\n      return this.#a;\n    }\n  }\n}\n\nvar C1 = createClass();\nvar C2 = createClass();\n\nvar var5 = new C1();\nvar var6 = new C2();\n\nassert(var5.b.call(var5) == 1);\n\ntry {\n  var5.b.call(var6);\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Cannot access private member from an object whose class did not declare it\nclass E {\n  #a = 5;\n  b = class {\n    c() {\n      return this.#a;\n    }\n  }\n  d() {\n    var var7 = new this.b();\n    return var7.c();\n  }\n}\n\nvar var8 = new E();\n\ntry {\n  var8.d();\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nclass F {\n  #a = 5;\n  b = class {\n    #a = 6;\n    c() {\n      return this.#a;\n    }\n  }\n  d() {\n    var var9 = new this.b();\n    return var9.c();\n  }\n}\n\nvar var10 = new F();\nassert(var10.d() == 6);\n\n// Private field is defined without a getter\nclass G {\n  set #a(o) { }\n  b() {\n    return this.#a;\n  }\n}\n\nvar var11 = new G();\n\ntry {\n  var11.b();\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Private field is defined without a setter\nclass H {\n  get #a() {\n    return 12;\n  }\n  b() {\n    this.#a = 5;\n  }\n}\n\nvar var12 = new H();\n\ntry {\n  var12.b();\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Private method is not writable\nclass I {\n  #a() { }\n  b() {\n    this.#a = function () { }\n  }\n}\n\nvar var13 = new I();\n\ntry {\n  var13.b();\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Cannot declare the same private field twice\nclass J {\n  constructor(arg) {\n    return arg;\n  }\n}\n\nclass K extends J {\n  #a;\n  constructor(arg) {\n    super(arg);\n  }\n}\n\nvar var14 = new K();\n\ntry {\n  new K(var14)\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Private methods are installed when the super returns\nvar L = class {\n  a = this.b();\n}\n\nclass M extends L {\n  b() {\n    this.#m();\n  }\n  #m() {\n    return 42;\n  }\n}\n\ntry {\n  new M()\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Private field can be shadowed on inner classes\nclass N {\n  static #a = 1;\n  static getA() {\n    return this.#a;\n  }\n  static b = class {\n    set #a(v) { this._v = v; }\n    static access(o) {\n      o.#a = 2;\n    }\n  }\n}\n\nvar var15 = new N.b();\nN.b.access(var15);\n\nassert(N.getA() == 1);\nassert(var15._v == 2);\n\ntry {\n  N.b.access(N);\n  assert(false)\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Private fields are accessible in eval code\nclass O {\n  #a;\n  b() {\n    eval(\"this.#a = 12;\")\n  }\n  c() {\n    return this.#a;\n  }\n}\n\nvar var16 = new O();\nvar16.b();\nassert(var16.c() == 12);\n\n// Private fields are accessible in Array object\nclass P extends Array {\n  #a = 1;\n  b() {\n    return this.#a;\n  }\n}\n\nvar var17 = new P();\nassert(var17.b() == 1);\n\nclass Q extends Array {\n  #a() {\n    return 1;\n  }\n  b() {\n    return this.#a();\n  }\n}\n\nvar var18 = new Q();\nassert(var18.b() == 1);\n"
  },
  {
    "path": "tests/jerry/promise-all-iterator.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction createIterable(arr, methods = {}) {\n  let iterable = function *() {\n    let idx = 0;\n    while (idx < arr.length) {\n      yield arr[idx];\n      idx++;\n    }\n  }();\n  iterable['return'] = methods['return'];\n  iterable['throw'] = methods['throw'];\n\n  return iterable;\n};\n\n// iterator next\nPromise.all({[Symbol.iterator]() { return {get next() { throw 5; }}}\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator value\nPromise.all({ [Symbol.iterator] () { return { next () { return { get value () { throw 5 }}}}}\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator done\nPromise.all({ [Symbol.iterator] () { return { next () { return { get done () { throw 5 }}}}}\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator get\nPromise.all({ get [Symbol.iterator] () { throw 5 }\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\nvar fulfills = Promise.all(createIterable([\n  new Promise(resolve => { resolve(\"foo\"); }),\n  new Promise(resolve => { resolve(\"bar\"); }),\n]));\nvar rejects = Promise.all(createIterable([\n  new Promise((_, reject) => { reject(\"baz\"); }),\n  new Promise((_, reject) => { reject(\"qux\"); }),\n]));\n\nfulfills.then(result => { assert (result + \"\" === \"foo,bar\"); });\nrejects.catch(result => { assert (result === \"baz\"); });\n\nvar closed = true;\ndelete Promise.resolve;\nPromise.all(createIterable([1,2,3], {'return': function () { closed = false; }}));\nassert (!closed);\n\nvar arr = [];\nObject.defineProperty(arr, Symbol.species, { get: function () { assert(false) }});\nPromise.all(arr);\n"
  },
  {
    "path": "tests/jerry/promise-all-settled.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction createIterable(arr, methods = {}) {\n  let iterable = function *() {\n    let idx = 0;\n    while (idx < arr.length) {\n      yield arr[idx];\n      idx++;\n    }\n  }();\n  iterable['return'] = methods['return'];\n  iterable['throw'] = methods['throw'];\n\n  return iterable;\n};\n\n// iterator next\nPromise.allSettled({\n  [Symbol.iterator]() { return {get next() { throw 5; }}}\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator value\nPromise.allSettled({\n  [Symbol.iterator] () { return { next () { return { get value () { throw 5 }}}}}\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator done\nPromise.allSettled({\n  [Symbol.iterator] () { return { next () { return { get done () { throw 5 }}}}}\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator get\nPromise.allSettled({\n  get [Symbol.iterator] () { throw 5 }\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\nvar fulfills = Promise.allSettled(createIterable([\n  new Promise(resolve => { resolve(\"foo\"); }),\n  new Promise(resolve => { resolve(\"bar\"); }),\n]));\nvar rejects = Promise.allSettled(createIterable([\n  new Promise((_, reject) => { reject(\"baz\"); }),\n  new Promise((_, reject) => { reject(\"qux\"); }),\n]));\n\nfulfills.then(result => {\n  assert(Object.getPrototypeOf(result) === Array.prototype);\n  assert(result.length === 2)\n  assert(Object.getPrototypeOf(result[0]) === Object.prototype);\n  assert(result[0].status === \"fulfilled\");\n  assert(result[0].value === \"foo\");\n  assert(Object.getPrototypeOf(result[1]) === Object.prototype);\n  assert(result[1].status === \"fulfilled\");\n  assert(result[1].value === \"bar\");\n});\nrejects.then(result => {\n  assert(Object.getPrototypeOf(result) === Array.prototype);\n  assert(result.length === 2)\n  assert(Object.getPrototypeOf(result[0]) === Object.prototype);\n  assert(result[0].status === \"rejected\");\n  assert(result[0].reason === \"baz\");\n  assert(Object.getPrototypeOf(result[1]) === Object.prototype);\n  assert(result[1].status === \"rejected\");\n  assert(result[1].reason === \"qux\");\n});\n\nvar closed = true;\ndelete Promise.resolve;\nPromise.allSettled(createIterable([1,2,3], {'return': function () { closed = false; }}));\nassert (!closed);\n\nvar arr = [];\nObject.defineProperty(arr, Symbol.species, { get: function () { assert(false) }});\nPromise.allSettled(arr);\n\nPromise.resolve = function () {\n  return { then(resolve,reject) {\n    assert(resolve !== reject)\n  }};\n}\n\nPromise.allSettled([1,2])\n"
  },
  {
    "path": "tests/jerry/promise-any.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction createIterable(arr, methods = {}) {\n  let iterable = function *() {\n    let idx = 0;\n    while (idx < arr.length) {\n      yield arr[idx];\n      idx++;\n    }\n  }();\n\n  iterable['return'] = methods['return'];\n  iterable['throw'] = methods['throw'];\n  return iterable;\n};\n\n// iterator next\nPromise.any({\n  [Symbol.iterator]() { return {get next() { throw 5; }}}\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator value\nPromise.any({\n  [Symbol.iterator] () { return { next () { return { get value () { throw 5 }}}}}\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator done\nPromise.any({\n  [Symbol.iterator] () { return { next () { return { get done () { throw 5 }}}}}\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator get\nPromise.any({\n  get [Symbol.iterator] () { throw 5 }\n}).then(onfullfilled => {\n  // If this is not called, the promise has failed, and catch must be called.\n  assert(false);\n}).catch(err => {\n  assert(err === 5);\n});\n\nvar fulfills = Promise.any(createIterable([\n  new Promise(resolve => { resolve(\"foo\"); }),\n  new Promise(resolve => { resolve(\"bar\"); }),\n]));\nvar rejects = Promise.any(createIterable([\n  new Promise((_, reject) => { reject(\"baz\"); }),\n  new Promise((_, reject) => { reject(\"qux\"); }),\n]));\n\nfulfills.then(result => { assert (result + \"\" === \"foo\"); });\nrejects.catch(result => { assert (result == \"AggregateError\"); });\n\nvar closed = true;\ndelete Promise.resolve;\nPromise.any(createIterable([1,2,3], {'return': function () { closed = false; }}));\nassert (!closed);\n\nvar arr = [];\nObject.defineProperty(arr, Symbol.species, { get: function () { assert(false) }});\nPromise.any(arr);\n\nPromise.resolve = function () {\n  return { then(resolve,reject) {\n    assert(resolve !== reject)\n  }};\n}\n\nPromise.any([1,2])\n"
  },
  {
    "path": "tests/jerry/promise-new-target.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntry {\n  Reflect.construct (Promise);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nclass MyPromise extends Promise {};\n\nvar p1= new MyPromise(function(){});\nassert(Object.getPrototypeOf(p1) == MyPromise.prototype)\n"
  },
  {
    "path": "tests/jerry/promise-on-finally.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// test basic functionality\nvar order = [];\nvar reason = {};\nvar reject = Promise.reject(reason);\nreject.then = function() {\n  order.push(1);\n  return Promise.prototype.then.apply(this, arguments);\n};\n\nvar value = {};\nvar resolve = Promise.resolve(value);\nresolve.then = function() {\n  order.push(4);\n  return Promise.prototype.then.apply(this, arguments);\n};\n\nreject.catch(function(e) {\n\torder.push(2);\n\tthrow e;\n}).finally(function() {\n\torder.push(3);\n\treturn resolve;\n}).catch(function(e) {\n\torder.push(5);\n});\n\nfunction __checkAsync() {\n  assert(order.length === 5);\n  for (var i = 0; i < order.length; i++)\n  {\n    assert(i + 1 === order[i]);\n  }\n}\n\n// check length property\nvar desc = Object.getOwnPropertyDescriptor(Promise.prototype.finally, \"length\");\nassert(desc.value === 1);\nassert(desc.enumerable === false);\nassert(desc.configurable === true);\nassert(desc.writable === false);\n\n// invokes then with function\nvar target = new Promise(function() {});\nvar returnValue = {};\nvar callCount = 0;\nvar thisValue = null;\nvar argCount = null;\nvar firstArg = null;\nvar secondArg = null;\n\ntarget.then = function(a, b) {\n  callCount += 1;\n\n  thisValue = this;\n  argCount = arguments.length;\n  firstArg = a;\n  secondArg = b;\n\n  return returnValue;\n};\n\nvar originalFinallyHandler = function() {};\nvar result = Promise.prototype.finally.call(target, originalFinallyHandler, 2, 3);\n\n(callCount === 1);\nassert(thisValue === target);\nassert(argCount === 2);\nassert(typeof firstArg === 'function');\nassert(firstArg.length === 1);\nassert(typeof secondArg === 'function');\nassert(secondArg.length === 1);\nassert(result === returnValue);\n\n// invokes then with non-function\nresult = Promise.prototype.finally.call(target, 1, 2, 3);\n\nassert(callCount === 2);\nassert(thisValue === target);\nassert(argCount === 2);\nassert(firstArg === 1);\nassert(secondArg === 1);\nassert(result == returnValue);\n\n// thes when 'then' is not callable\nvar thrower = function() {\n  throw 42;\n};\n\nvar symbol = Symbol();\nvar p = new Promise(function() {});\n\np.then = undefined;\ntry {\n  Promise.prototype.finally.call(p, thrower);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\np.then = null;\ntry {\n  Promise.prototype.finally.call(p, thrower);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\np.then = 1;\ntry {\n  Promise.prototype.finally.call(p, thrower);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\np.then = symbol;\ntry {\n  Promise.prototype.finally.call(p, thrower);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\np.then = {};\ntry {\n  Promise.prototype.finally.call(p, thrower);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/promise-race-iterator.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction createIterable(arr, methods = {}) {\n  let iterable = function *() {\n    let idx = 0;\n    while (idx < arr.length) {\n      yield arr[idx];\n      idx++;\n    }\n  }();\n  iterable['return'] = methods['return'];\n  iterable['throw'] = methods['throw'];\n\n  return iterable;\n};\n\n// iterator next\nPromise.race({[Symbol.iterator]() { return {get next() { throw 5; }}}\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator value\nPromise.race({ [Symbol.iterator] () { return { next () { return { get value () { throw 5 }}}}}\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator done\nPromise.race({ [Symbol.iterator] () { return { next () { return { get done () { throw 5 }}}}}\n}).catch(err => {\n  assert(err === 5);\n});\n\n// iterator get\nPromise.race({ get [Symbol.iterator] () { throw 5 }\n}).catch(err => {\n  assert(err === 5);\n});\n\nvar fulfills = Promise.race(createIterable([\n  new Promise(resolve => { resolve(\"foo\"); }),\n  new Promise(resolve => { resolve(\"bar\"); }),\n]));\nvar rejects = Promise.race(createIterable([\n  new Promise((_, reject) => { reject(\"baz\"); }),\n  new Promise((_, reject) => { reject(\"qux\"); }),\n]));\n\nfulfills.then(result => { assert (result + \"\" === \"foo\"); });\nrejects.catch(result => { assert (result === \"baz\"); });\n\nvar closed = true;\ndelete Promise.resolve;\nPromise.race(createIterable([1,2,3], {'return': function () { closed = false; }}));\nassert (!closed);\n\nvar arr = [];\nObject.defineProperty(arr, Symbol.species, { get: function () { assert(false) }});\nPromise.race(arr);\n"
  },
  {
    "path": "tests/jerry/promise-species.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n// Test that Promises use @@species appropriately\n\n// Another constructor with no species will not be instantiated\n\nvar test = new Promise(function(){});\nvar bogoCount = 0;\nfunction bogusConstructor() { bogoCount++; }\ntest.constructor = bogusConstructor;\nassert(Promise.resolve(test) instanceof Promise);\nassert(!(Promise.resolve(test) instanceof bogusConstructor));\n\n// If there is a species, it will be instantiated\n// @@species will be read exactly once, and the constructor is called with a\n// function\nvar count = 0;\nvar params;\n\nclass MyPromise extends Promise {\n  constructor(...args) {\n    super(...args);\n    params = args;\n  }\n  static get [Symbol.species]() {\n    count++\n    return this;\n  }\n}\n\nvar myPromise = MyPromise.resolve().then();\nassert(1 === count);\nassert(1 === params.length);\nassert('function' === typeof(params[0]));\nassert(myPromise instanceof MyPromise);\nassert(myPromise instanceof Promise);\n"
  },
  {
    "path": "tests/jerry/promise-thenable.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar counter = 0;\n\nfunction f() { }\n\nf.then = function(resolve) {\n  if (++counter < 10) {\n    resolve(f)\n  }\n}\n\nnew Promise(function(resolve) {\n  resolve(f)\n})\n\nfunction __checkAsync() {\n  assert(counter == 10)\n}\n"
  },
  {
    "path": "tests/jerry/proxy-date-prototype-json.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Test the Date.prototype.toJSON method's internal operation order\n * by creating a Proxy to catch the method invokations.\n */\nvar found = [];\n\nvar target = {\n  toString: function() { return \"TARGET_toString\"; },\n  toISOString: function() { return \"TARGET_toISOString\"; }\n};\n\nvar prox = new Proxy(target, {\n  get: function(trg, key) {\n    found.push(key);\n    return trg[key];\n  }\n});\n\n/* Date.prototype.toJSON -> ... -> <target>.toISOString() */\nvar json_result = Date.prototype.toJSON.call(prox);\nassert(json_result === \"TARGET_toISOString\");\n\n/* Data.prototype.toJSON -> toPrimitive -> Get -> [[Get]]\n * The first element in the \"found\" properties should be the \"@@toPrimitive\" well-known Symbol.\n */\nassert(found[0] === Symbol.toPrimitive);\n\n/* Date.prototype.toJSON -> Invoke -> GetMethod -> GetV -> [[Get]]\n * All other elements are \"methods\" and there should be no duplicates.\n */\nvar methods = found.slice(1);\nassert(methods.toString() === \"valueOf,toString,toISOString\");\n"
  },
  {
    "path": "tests/jerry/proxy-evil-recursion.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Stack limit check must be enabled to run this test correctly! */\n\nfunction expect_error(error_type, method) {\n  try {\n    method();\n    assert(false);\n  } catch (ex) {\n    assert (ex instanceof error_type);\n  }\n}\n\n/**\n * Create a proxy with recursion via prototype\n */\nvar proxy_one = new Proxy({length:2}, {});\n\nReflect.setPrototypeOf(proxy_one, proxy_one); /* [[SetPrototypeOf]] does not trigger recursion */\n// aka. proxy_one.__proto__ = proxy_one; /* [[SetPrototypeOf]] */\n\nfunction test_proxy_internals_using_proto(proxy_obj) {\n  /* These methods can be recursive calls via prototype */\n  expect_error(RangeError, function() { proxy_obj[1]; /* [[Get]] */ });\n  expect_error(RangeError, function() { proxy_obj[1] = 2; /* [[Set]] */ });\n  expect_error(RangeError, function() { 3 in proxy_obj; /* [[Has]] */ });\n  expect_error(RangeError, function() { Reflect.has(proxy_obj, 3); /* [[Has]] */ });\n}\n\ntest_proxy_internals_using_proto(proxy_one);\n\nfunction test_proxy_internals_not_using_proto(proxy_obj) {\n  /* The methods below should not trigger recursion via __proto__ */\n  delete proxy_obj.none; /* [[Delete]] */\n  delete proxy_obj[\"other\"]; /* [[Delete]] */\n\n  Object.getPrototypeOf(proxy_obj); /* [[GetPrototypeOf]] */\n  Reflect.isExtensible(proxy_obj); /* [[IsExtensible]] */\n  Object.preventExtensions(proxy_obj); /* [[PreventExtensions]] */\n  Reflect.getOwnPropertyDescriptor(proxy_obj, \"key\"); /* [[GetOwnProperty]] */\n  Reflect.defineProperty(proxy_obj, \"key2\", { value: 4}); /* [[DefineOwnProperty]] */\n  Reflect.ownKeys(proxy_obj); /* [[OwnPropertyKeys]] */\n}\n\ntest_proxy_internals_not_using_proto(proxy_one);\n\nexpect_error(TypeError, function() { proxy_one(3, 4); /* [[Call]] */ });\nexpect_error(TypeError, function() { new proxy_one(4); /* [[Construct]] */ });\n\n/* Special handler to trigger proxy recursion, WARNING DO NOT use in production code! */\nvar handler = {\n  is_handler: true,\n  proxy_target: false,\n  counts: {\n    get: 0,\n    set: 0,\n    has: 0,\n    deleteProperty: 0,\n    getPrototypeOf: 0,\n    setPrototypeOf: 0,\n    isExtensible: 0,\n    preventExtensions: 0,\n    getOwnPropertyDescriptor: 0,\n    defineProperty: 0,\n    ownKeys: 0,\n  },\n  get: function(target, key) {\n    assert(this.is_handler);\n    assert(this.proxy_target !== false);\n    this.counts.get++;\n    return this.proxy_target.key;\n  },\n  set: function(target, key, value) {\n    assert(this.is_handler);\n    assert(this.proxy_target !== false);\n    this.counts.set++;\n    return this.proxy_target.key = value;\n  },\n  has: function(target, key) {\n    assert(this.is_handler);\n    assert(this.proxy_target !== false);\n    this.counts.has++;\n    return Reflect.has(this.proxy_target, key);\n  },\n  deleteProperty: function(target, key) {\n    assert(this.is_handler);\n    assert(this.proxy_target !== false);\n    this.counts.deleteProperty++;\n    return Reflect.deleteProperty(this.proxy_target, key);\n  },\n  getPrototypeOf: function(target) {\n    assert(this.is_handler);\n    assert(this.proxy_target !== false);\n    this.counts.getPrototypeOf++;\n    return Reflect.getPrototypeOf(this.proxy_target);\n  },\n  setPrototypeOf: function(target, newproto) {\n    assert(this.is_handler);\n    assert(this.proxy_target !== false);\n    this.counts.setPrototypeOf++;\n    return Reflect.setPrototypeOf(this.proxy_target, newproto);\n  },\n  isExtensible: function(target) {\n    assert(this.is_handler);\n    assert(this.proxy_target !== false);\n    this.counts.isExtensible++;\n    return Reflect.isExtensible(this.proxy_target);\n  },\n  preventExtensions: function(target) {\n    assert(this.is_handler);\n    assert(this.proxy_target !== false);\n    this.counts.preventExtensions++;\n    return Reflect.preventExtensions(this.proxy_target);\n  },\n  getOwnPropertyDescriptor: function(target, key) {\n    assert(this.is_handler);\n    assert(this.proxy_target !== false);\n    this.counts.getOwnPropertyDescriptor++;\n    return Reflect.getOwnPropertyDescriptor(this.proxy_target, key);\n  },\n  defineProperty: function(target, key, attrs) {\n    assert(this.is_handler);\n    assert(this.proxy_target !== false);\n    this.counts.defineProperty++;\n    return Reflect.defineProperty(this.proxy_target, key, attrs);\n  },\n  ownKeys: function(target) {\n    assert(this.is_handler);\n    assert(this.proxy_target !== false);\n    this.counts.ownKeys++;\n    return Reflect.ownKeys(this.proxy_target);\n  }\n};\n\n\nvar proxy_two = new Proxy({length:2}, handler);\n\nhandler.proxy_target = proxy_two;\n\ntest_proxy_internals_using_proto(proxy_two);\n\nexpect_error(RangeError, function() { delete proxy_two.none; /* [[Delete]] */ });\nexpect_error(RangeError, function() { delete proxy_two[\"other\"]; /* [[Delete]] */ });\nexpect_error(RangeError, function() { Object.getPrototypeOf(proxy_two); /* [[GetPrototypeOf]] */ });\nexpect_error(RangeError, function() { Object.setPrototypeOf(proxy_two, {}); /* [[GetPrototypeOf]] */ });\nexpect_error(RangeError, function() { Reflect.isExtensible(proxy_two); /* [[IsExtensible]] */ });\nexpect_error(RangeError, function() { Object.preventExtensions(proxy_two); /* [[PreventExtensions]] */ });\nexpect_error(RangeError, function() { Reflect.getOwnPropertyDescriptor(proxy_two, \"key\"); /* [[GetOwnProperty]] */ });\nexpect_error(RangeError, function() { Reflect.defineProperty(proxy_two, \"key2\", { value: 4}); /* [[DefineOwnProperty]] */ });\nexpect_error(RangeError, function() { Reflect.ownKeys(proxy_two); /* [[OwnPropertyKeys]] */ });\n"
  },
  {
    "path": "tests/jerry/proxy-extension.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nvar target = Object.create(null);\nvar p = new Proxy(target, {\n  defineProperty: function() {\n    return true;\n  }\n});\n\nObject.preventExtensions(p);\n\ntry {\n  p.prop = null;\n  assert(false)\n}\ncatch(e)\n{\n  assert(e instanceof TypeError)\n}\n"
  },
  {
    "path": "tests/jerry/proxy-for-in.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar handlerBoolean = {\n  ownKeys: function() { return true; },\n}\nvar boolProxy = new Proxy({}, handlerBoolean);\n\ntry {\n  for (var a in boolProxy) {\n    // This should never be called.\n    assert (false);\n  }\n\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof TypeError);\n}\n\n\nvar handlerSymbol = {\n  ownKeys: function() { return Symbol(\"alma\"); },\n}\nvar symbolProxy = new Proxy({}, handlerSymbol);\n\ntry {\n  for (var a in symbolProxy) {\n    // This should never be called.\n    assert (false);\n  }\n\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof TypeError);\n}\n\n\nvar handlerNumber = {\n  ownKeys: function() { return 1; },\n}\nvar numberProxy = new Proxy({}, handlerNumber);\n\ntry {\n  for (var a in numberProxy) {\n    // This should never be called.\n    assert (false);\n  }\n\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof TypeError);\n}\n\n\nvar handlerObject = {\n  ownKeys: function() { return {}; },\n}\nvar objectProxy = new Proxy({}, handlerObject);\n\nfor (var a in objectProxy) {\n  // This should never be called.\n  assert (false);\n}\n"
  },
  {
    "path": "tests/jerry/proxy_call.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar target = function () {};\nvar handler = { apply (target) {\n  throw 42;\n}};\n\nvar proxy = new Proxy (target, handler);\n\ntry {\n  // opfunc_call\n  proxy (5)\n  assert (false);\n} catch (e) {\n  assert (e == 42);\n}\n\ntry {\n  var revocable = Proxy.revokable (function () {}, {});\n  proxy = new Proxy(revocable.proxy, {})\n  revocable.revoke();\n  proxy (5)\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nfunction sum (a, b) {\n  return a + b;\n}\n\nvar handler = {\n  apply: function (target, thisArg, argumentsList) {\n    return target (argumentsList[0], argumentsList[1]) * 10;\n  }\n};\n\nvar proxy1 = new Proxy(sum, handler);\n\nassert (sum (1, 2) === 3);\nassert (proxy1 (1, 2) === 30);\n\n// Non Callable tests\nvar proxy = new Proxy ({},{});\ntry {\n  proxy()\n  assert (false)\n} catch (e) {\n  assert (e instanceof TypeError)\n}\n\nvar proxy2 = new Proxy(proxy, {});\ntry {\n  proxy2()\n  assert (false)\n} catch (e) {\n  assert (e instanceof TypeError)\n}\n\n// No arguments\nvar called = false;\nvar target = function () {\n  called = true;\n}\nvar proxy = new Proxy (target, {});\nassert (!called);\nproxy();\nassert (called);\n\ncalled = false;\nvar proxy2 = new Proxy (proxy, {});\nassert (!called);\nproxy2();\nassert (called);\n\n//1 Argument\nvar called = false;\nvar target = function (a) {\n  called = true;\n  assert ('1' === a);\n}\nvar proxy = new Proxy (target, {});\nassert (!called);\nproxy ('1');\nassert (called);\n\n// 2 Arguments\nvar called = false;\nvar target = function (a, b) {\n  called = true;\n  assert ('1' === a);\n  assert ('2' === b);\n}\nvar proxy = new Proxy (target, {});\nassert (!called);\nproxy ('1', '2');\nassert (called);\n\n// Changed receiver\nvar apply_receiver = {receiver:true};\nvar seen_receiver = undefined;\nvar target = function () {\n  seen_receiver = this;\n}\nvar proxy = new Proxy (target, {});\nassert (undefined === seen_receiver);\nReflect.apply (proxy, apply_receiver, [1,2,3,4]);\nassert (apply_receiver === seen_receiver);\n\n// Trap\nvar called_target = false;\nvar called_handler = false;\nvar target = function (a, b) {\n  called_target = true;\n  assert (1 === a);\n  assert (2 === b);\n}\nvar handler = {\n  apply: function (target, this_arg, args) {\n    target.apply (this_arg, args);\n    called_handler = true;\n  }\n}\nvar proxy = new Proxy (target, handler);\nassert (!called_target);\nassert (!called_handler);\nReflect.apply (proxy, {rec:1}, [1,2]);\nassert (called_target);\nassert (called_handler);\n\n// Trap array arg\nvar called_target = false;\nvar called_handler = false;\nvar target = function (a, b) {\n  called_target = true;\n  var arg = [1, 2];\n  assert (arg[0] === a[0]);\n  assert (arg[1] === a[1]);\n  assert (3 === b);\n}\nvar handler = {\n  apply: function (target, this_arg, args) {\n    target.apply (this_arg, args);\n    called_handler = true;\n  }\n}\nvar proxy = new Proxy (target, handler);\nassert (!called_target);\nassert (!called_handler);\nproxy ([1,2], 3);\nassert (called_target);\nassert (called_handler);\n\n// Trap object arg\nvar called_target = false;\nvar called_handler = false;\nvar target = function (o) {\n  called_target = true;\n  var obj = {a: 1, b: 2}\n  assert (obj.a === o.a);\n  assert (obj.b === o.b)\n}\nvar handler = {\n  apply: function (target, this_arg, args) {\n    target.apply (this_arg, args);\n    called_handler = true;\n  }\n}\nvar proxy = new Proxy (target, handler);\nassert (!called_target);\nassert (!called_handler);\nproxy ({a: 1, b: 2});\nassert (called_target);\nassert (called_handler);\n\n// Trap generator arg\nfunction* gen () {\n  yield 1;\n  yield 2;\n  yield 3;\n}\nvar called_target = false;\nvar called_handler = false;\nvar target = function (g) {\n  called_target = true;\n  var arr = [1, 2, 3];\n  var arr2 = [...g];\n  assert (arr[0] === arr2[0]);\n  assert (arr[1] === arr2[1]);\n  assert (arr[2] === arr2[2]);\n}\nvar handler = {\n  apply: function (target, this_arg, args) {\n    target.apply (this_arg, args);\n    called_handler = true;\n  }\n}\nvar proxy = new Proxy (target, handler);\nassert (!called_target);\nassert (!called_handler);\nproxy (gen());\nassert (called_target);\nassert (called_handler);\n\n// Noncallable Trap\nvar called_target = false;\nvar target = function () {\n  called_target = true;\n};\nvar handler = {\n  apply: 'non callable trap'\n};\n\nvar proxy = new Proxy(target, handler);\ntry {\n  proxy ();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (!called_target);\n\n// Null trap\nvar _args;\nvar target = function (a, b) {\n  _args = [a, b];\n  return a + b;\n};\nvar handler = {\n  apply: null\n};\n\nvar proxy = new Proxy (target, handler);\nvar result = proxy (1, 2);\n\nassert (result === 3);\nassert (_args.length === 2);\nassert (_args[0] === 1);\nassert (_args[1] === 2);\n\nvar values = [NaN, 1.5, 100, /RegExp/, \"string\", {}, [], Symbol(),\n                new Map(), new Set(), new WeakMap(), new WeakSet()];\nvalues.forEach(target => {\n  target = Object (target);\n  var proxy = new Proxy(target, { apply() { assert (false) } });\n  try {\n    proxy();\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    ({ proxy }).proxy();\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Reflect.apply(proxy, null, []);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Reflect.apply(proxy, { proxy }, []);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Reflect.apply(proxy, { proxy }, []);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Function.prototype.call.apply (proxy, [null]);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Function.prototype.apply.apply (proxy, [null, []]);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  var proxy_to_proxy = new Proxy (proxy, { apply() { assert (false); } });\n\n  try {\n    proxy_to_proxy ();\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    ({ proxy_to_proxy }).proxy_to_proxy();\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Reflect.apply (proxy_to_proxy, null, []);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Reflect.apply (proxy_to_proxy, { proxy }, []);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Function.prototype.call.apply (proxy_to_proxy, [null]);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  try {\n    Function.prototype.apply.apply (proxy_to_proxy, [null, []]);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n});\n"
  },
  {
    "path": "tests/jerry/proxy_construct.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar target = function () {};\nvar handler = { construct (target) {\n  throw 42;\n}};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  // opfunc_call\n  new proxy(5)\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\ntry {\n  // 22.1.2.3.4.a\n  Array.of.call(proxy);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test basic functionality\nvar proxy = new Proxy({},{});\n\ntry {\n  new proxy();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar proxy2 = new Proxy(proxy, {});\n\ntry {\n  new proxy2();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar called = false;\n\nfunction Target() {\n  called = true;\n  this.property1 = 'value1';\n};\n\nTarget.prototype = {};\nvar proxy = new Proxy(Target, {});\n\nassert(called === false);\n\nvar instance = new proxy();\n\nassert(called === true);\nassert('value1' === instance.property1);\nassert(Target.prototype === Object.getPrototypeOf(instance));\n\nvar proxy2 = new Proxy(proxy, {});\ncalled = false;\nvar instance2 = new proxy2();\n\nassert(called === true);\nassert('value1' === instance2.property1);\nassert(Target.prototype === Object.getPrototypeOf(instance));\n\nfunction Target2(a, b) {\n  this.sum = a + b;\n};\nvar handler = {\n  construct(t, c, args) {\n      return { sum: 42 };\n  }\n};\nvar proxy = new Proxy(Target2, handler);\nassert((new proxy(1, 2)).sum === 42);\n\nfunction Target3(arg1, arg2) {\n  this.arg1 = arg1;\n  this.arg2 = arg2;\n}\nvar seen_target, seen_arguments, seen_new_target;\nvar handler = {\n  construct(target, args, new_target) {\n    seen_target = target;\n    seen_arguments = args;\n    seen_new_target = new_target;\n    return Reflect.construct(target, args, new_target);\n  }\n}\nvar proxy = new Proxy(Target3, handler);\nvar instance = new proxy('a', 'b');\n\nassert(Target3 === seen_target);\nassert(JSON.stringify(seen_arguments) === '[\"a\",\"b\"]');\nassert(proxy === seen_new_target);\nassert('a' === instance.arg1);\nassert('b' === instance.arg2);\n\nvar instance2 = Reflect.construct(proxy, ['a1', 'b1'], Array);\nassert(Target3 === seen_target);\nassert(JSON.stringify(seen_arguments) === '[\"a1\",\"b1\"]');\nassert(Array === seen_new_target);\nassert('a1'=== instance2.arg1);\nassert('b1' === instance2.arg2);\n\nvar p = new Proxy(function() {}, {\n  construct: function(target, argumentsList, newTarget) {\n    throw 42;\n  }\n});\n\ntry {\n  new p();\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test when invariants gets violated\nvar p = new Proxy(function() {}, {\n  construct: function(target, argumentsList, newTarget) {\n    return 1;\n  }\n});\n\ntry {\n  new p();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError); \n}\n\nvar p = new Proxy({}, {\n  construct: function(target, argumentsList, newTarget) {\n    return {};\n  }\n});\n\ntry {\n  new p();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError); \n}\n"
  },
  {
    "path": "tests/jerry/proxy_create.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar target = {}\nvar handler = {};\nvar proxy = new Proxy(target, handler);\n\nvar revocable = Proxy.revocable(target, handler);\nrevocable.revoke();\nvar rev_proxy = revocable.proxy;\n\ntry {\n  Proxy(target, handler);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  new Proxy(undefined, undefined);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  new Proxy(rev_proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* In ES11+ the standard changed revoked proxy is a valid input for a new Proxy */\nvar proxy_rev_handler = new Proxy({}, rev_proxy);\nvar proxy_rev_target_Br = new Proxy(rev_proxy, {});\n"
  },
  {
    "path": "tests/jerry/proxy_define_own_property.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar target = function () {};\nvar handler = { defineProperty (target) {\n  throw 42;\n}, construct () {\n  return {};\n}};\n\nvar proxy = new Proxy(target, handler);\n\n// 22.1.2.3.8.c\nArray.of.call(proxy, 5)\n\n// test basic functionality\nvar g_target, g_name;\n\nvar handler = {\n  defineProperty: function(target, name, desc) {\n    g_target = target;\n    g_name = name;\n    return true;\n  }\n}\n\nvar target = {};\nvar proxy = new Proxy(target, handler);\nvar desc = { value: 1, writable: true, configurable: true };\n\nObject.defineProperty(proxy, \"foo\", desc);\n\nassert(target === g_target);\nassert(\"foo\" === g_name);\n\nvar handler = {\n  defineProperty: function(target, name, desc) {\n    Object.defineProperty(target, name, desc);\n  }\n}\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.defineProperty(proxy, \"bar\", desc);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar bar = Object.getOwnPropertyDescriptor(proxy, \"bar\");\nassert(bar.value === 1);\nassert(bar.writable);\nassert(bar.configurable);\n\ntry {\n  Object.defineProperty(proxy, \"name\", {});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n\n// test when trap is not callable\nvar target = {};\nvar handler = {\n  defineProperty: 1\n}\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.defineProperty(proxy, \"foo\", {value: \"foo\"});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when trap is undefined\nvar target = {};\nvar handler = {\n  defineProperty: undefined\n}\n\nvar proxy = new Proxy(target, handler);\nvar desc = { value: 1 };\n\nObject.defineProperty(proxy, \"prop1\", desc);\nassert(proxy.prop1 === 1);\n\nvar target2 = {};\nvar proxy2 = new Proxy(target2, {});\n\nObject.defineProperty(proxy2, \"prop2\", desc);\nassert(proxy2.prop2 === 1);\n\n// test when invariants gets violated\nvar target = {};\nvar handler = {\n  defineProperty: function(target, name, desc) {\n    return true;\n  }\n}\n\nvar proxy = new Proxy(target, handler);\n\nObject.preventExtensions(target);\n\ntry {\n  Object.defineProperty(proxy, \"foo\", {value: 1});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar target = {};\nvar desc = {value: 1, writable: true, configurable: false, enumerable: true};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.defineProperty(proxy, \"foo\", desc);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar target = {};\nvar handler = {\n  defineProperty: function(target, name, desc) {\n    return true;\n  }\n}\n\nvar proxy = new Proxy(target, handler);\n\nObject.defineProperty(target, \"foo\", {value: 1, writable: false, configurable: false});\n\ntry {\n  Object.defineProperty(proxy, 'foo', {value: 2});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntarget.bar = \"baz\";\n\ntry {\n  Object.defineProperty(proxy, 'bar', {value: 2, configurable: false});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar trapCalls = 0;\nvar p = new Proxy({}, {\n  defineProperty: function(t, prop, desc) {\n    Object.defineProperty(t, prop, {\n      configurable: false,\n      writable: true,\n    });\n\n    trapCalls++;\n    return true;\n  },\n});\n\ntry {\n  Reflect.defineProperty (p, \"prop\", {\n    writable: false,\n  });\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (trapCalls == 1)\n"
  },
  {
    "path": "tests/jerry/proxy_delete.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar target = {};\nvar handler = { deleteProperty (target) {\n  throw 42;\n}, get (object, propName) {\n  if (propName == \"length\") {\n    return 5;\n  }\n}};\n\nvar proxy = new Proxy(target, handler);\n\nvar a = 5;\n\n// ecma_op_delete_binding\nwith (proxy) {\n  delete a\n}\n\ntry {\n  // 22.1.3.16.6.e\n  Array.prototype.pop.call(proxy);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test basic functionality\nvar target = {foo: \"bar\"};\nvar handler = {\n  deleteProperty(obj, prop) {\n    delete obj[prop];\n  }\n}\n\nvar proxy = new Proxy(target, handler);\n\nassert(target.foo === \"bar\")\nassert(proxy.foo === \"bar\");\n\nassert(delete proxy.foo === false);\n\nassert(target.foo === undefined);\nassert(proxy.foo === undefined);\n\nassert(target.bar === undefined);\nassert(delete proxy.bar == false);\nassert(target.bar === undefined);\n\nvar handler2 = {\n  deleteProperty(obj, prop) {\n    delete obj[prop];\n    return true;\n  }\n}\n\nvar proxy = new Proxy(target, handler2);\n\nassert(target.bar === undefined);\nassert(delete proxy.bar == true);\nassert(target.bar === undefined);\n\n// test with no trap\nvar target = {1: 42};\nvar handler = {};\nvar proxy = new Proxy(target, handler);\n\nassert(target[1] === 42)\nassert(delete proxy[1] === true)\nassert(target[1] === undefined);\n\n// test with undefined trap\nvar target = {2: 52};\nvar handler = { deleteProperty: null};\nvar proxy = new Proxy(target, handler);\n\nassert(target[2] === 52)\nassert(delete proxy[2] === true)\nassert(target[2] === undefined);\n\n// test when trap is invalid\nvar target = {};\nvar handler = { deleteProperty: true };\nvar proxy = new Proxy(target, handler);\n\ntry {\n  delete proxy[0];\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when handler is null\nvar revocable = Proxy.revocable ({}, {});\nvar proxy = revocable.proxy;\nrevocable.revoke();\n\ntry {\n  delete proxy.foo;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when target is proxy\nvar target = {prop: \"foo\"};\nvar handler = {\n  deleteProperty(obj, prop) {\n    delete obj[prop];\n  }\n};\n\nvar proxy1 = new Proxy(target, handler);\nvar proxy2 = new Proxy(proxy1, handler);\n\nassert(target.prop === \"foo\");\nassert(proxy1.prop === \"foo\");\nassert(proxy2.prop === \"foo\");\n\ndelete proxy2.prop;\n\nassert(target.prop === undefined);\nassert(proxy1.prop === undefined);\nassert(proxy2.prop === undefined);\n\n// tests when invariants gets violated\nvar target = {};\nvar handler = {\n  deleteProperty(obj, prop) {\n    delete obj[prop];\n    return true;\n  }\n};\n\nObject.defineProperty(target, \"foo\", {\n  configurable: false,\n  value: \"foo\"\n});\n\nvar proxy = new Proxy (target, handler);\n\ntry {\n  delete proxy.foo;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar trapCalls = 0;\nvar p = new Proxy({prop: 1}, {\n  deleteProperty: function(t, prop) {\n    Object.preventExtensions(t);\n    trapCalls++;\n    return true;\n  },\n});\n\ntry {\n  Reflect.deleteProperty (p, \"prop\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (trapCalls == 1);\n"
  },
  {
    "path": "tests/jerry/proxy_flags.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar target_called = 0;\nfunction target_method() {\n  target_called++;\n}\n\nvar proxy_revocable_function = Proxy.revocable(target_method, {})\nvar proxy_function = proxy_revocable_function.proxy;\n\n/* Test Proxy IsCallable(target) */\n/* The proxy target should have a function type. */\nassert(typeof(proxy_function) === \"function\");\n\n/* The proxy can be called with new */\nvar new_obj = new proxy_function()\nassert(new_obj instanceof target_method);\nassert(target_called === 1);\n\n/* Test Proxy IsConstructor(target) */\n/* Array.from tries to use the \"this\" value as constructor. */\nvar array_result = Array.from.call(proxy_function, [1, 2, 3]);\nassert(Array.isArray(array_result) === false);\nassert(target_called === 2);\n\nproxy_revocable_function.revoke();\n\n/* Test Proxy IsCallable(target) if the proxy is revoked. */\n/* After the proxy was revoked the type is still function. */\nassert(typeof(proxy_function) === \"function\");\n\n/* After the proxy was revoked the constructor should not be called\n * and an error should be reported\n */\ntry {\n  new proxy_function();\n  assert(false);\n} catch (ex) {\n  assert(ex instanceof TypeError);\n}\n\nassert(target_called === 2);\n\n/* Test Proxy IsConstructor(target) if the proxy is revoked. */\n/* Array.from tries to use the \"this\" value as constructor and as the\n * proxy is revoked the constructor call should fail.\n * The IsConstructor(proxy_function) is still true.\n */\ntry {\n  Array.from.call(proxy_function, [1, 2, 3]);\n  assert(false);\n} catch (ex) {\n  assert(ex instanceof TypeError);\n}\n\nassert(target_called === 2);\n"
  },
  {
    "path": "tests/jerry/proxy_get.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar target = {};\nvar handler = { get (target) {\n  throw 42;\n}};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  // vm_op_get_value\n  proxy.a\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\ntry {\n  // ecma_op_get_value_object_base\n  proxy[2];\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\ntry {\n  // @@toPrimitive symbol\n  proxy + \"foo\";\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test basic funcionality\nvar target = {\n  target_one: 1,\n  prop: \"value\"\n};\n\nvar handler = {handler: 1};\nvar proxy = new Proxy(target, handler);\n\nassert(proxy.prop === \"value\");\nassert(proxy.nothing === undefined);\nassert(proxy.handler === undefined);\n\nhandler.get = function () {return \"value 2\"};\n\nassert(proxy.prop === \"value 2\");\nassert(proxy.nothing === \"value 2\");\nassert(proxy.handler === \"value 2\");\n\nvar handler2 = new Proxy({get: function() {return \"value 3\"}}, {});\nvar proxy2 = new Proxy(target, handler2);\n\nassert(proxy2.prop === \"value 3\");\nassert(proxy2.nothing === \"value 3\");\nassert(proxy2.handler === \"value 3\");\n\nvar get = [];\nvar p = new Proxy([0,,2,,4,,], { get: function(o, k) { get.push(k); return o[k]; }});\nArray.prototype.reverse.call(p);\n\nassert(get + '' === \"length,0,4,2\");\n\n// test when get throws an error\nvar handler = new Proxy({}, {get: function() {throw 42;}});\nvar proxy = new Proxy ({}, handler);\n\ntry {\n  proxy.prop;\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test when trap is undefined\nvar handler = new Proxy({}, {get: function() {return undefined}});\nvar target = {prop: \"value\"};\nvar proxy = new Proxy(target, handler);\nassert(proxy.prop === \"value\");\nassert(proxy.prop2 === undefined);\n\n// test when invariants gets violated\nvar target = {};\nvar handler = {get: function(r, p){if (p != \"key4\") return \"value\"}}\nvar proxy = new Proxy(target, handler);\n\nassert(proxy.key === \"value\");\nassert(proxy.key2 === \"value\");\nassert(proxy.key3 === \"value\");\nassert(proxy.key4 === undefined);\n\nObject.defineProperty(target, \"key\", {\n  configurable: false,\n  writable: false,\n  value: \"different value\"\n});\n\ntry {\n  proxy.key;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n\nObject.defineProperty(target, \"key2\", {\n  configurable: false,\n  get: function() {return \"different value\"}\n});\n\nassert(proxy.key2 === \"value\");\n\nObject.defineProperty(target, \"key3\", {\n  configurable: false,\n  set: function() {}\n});\n\ntry {\n  proxy.key3;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError)\n}\n"
  },
  {
    "path": "tests/jerry/proxy_get_own_property_descriptor.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar target = {};\nvar handler = { getOwnPropertyDescriptor (target) {\n  throw \"cat\";\n}};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  // 19.1.3.2.5\n  Object.prototype.hasOwnProperty.call(proxy);\n  assert(false);\n} catch(e) {\n  assert(e == \"cat\");\n}\n\ntry {\n  // 19.1.3.4\n  Object.prototype.propertyIsEnumerable.call(proxy)\n  assert(false);\n} catch(e) {\n  assert(e == \"cat\");\n}\n\ntry {\n  // 19.1.2.6.5\n  Object.getOwnPropertyDescriptor(proxy)\n  assert(false);\n} catch(e) {\n  assert(e == \"cat\");\n}\n\nvar target = {};\nvar configurable_desc = {\n  value: 123,\n  configurable: true,\n  writable: true,\n  enumerable: false,\n};\nObject.defineProperty(target, \"configurable\", configurable_desc);\n\nvar nonconfigurable_desc = {\n  value: 234,\n  configurable: false,\n  writable: false,\n  enumerable: true\n}\nObject.defineProperty(target, \"nonconfigurable\", nonconfigurable_desc);\n\nvar proxied_desc = {\n  value: 345,\n  configurable: true\n};\n\nvar proxied_desc = {\n  value: 345,\n  configurable: true\n};\n\nvar handler = {\n  \"getOwnPropertyDescriptor\": function(target, name) {\n    if (name === \"proxied\") {\n      return proxied_desc;\n    }\n    if (name === \"return_null\") {\n      return null;\n    }\n    return Object.getOwnPropertyDescriptor(target, name);\n  }\n};\n\nvar proxy = new Proxy(target, handler);\nvar proxy_without_handler = new Proxy(target, {});\n\n// Checking basic functionality:\n\nvar configurable_obj = Object.getOwnPropertyDescriptor(proxy, \"configurable\");\n\nassert(configurable_desc.value == configurable_obj.value);\nassert(configurable_desc.configurable == configurable_obj.configurable);\nassert(configurable_desc.writable == configurable_obj.writable);\nassert(configurable_desc.enumerable == configurable_obj.enumerable);\n\nvar nonconfigurable_obj = Object.getOwnPropertyDescriptor(proxy, \"nonconfigurable\");\nassert(nonconfigurable_obj.value == nonconfigurable_desc.value);\nassert(nonconfigurable_obj.configurable == nonconfigurable_desc.configurable);\nassert(nonconfigurable_obj.writable == nonconfigurable_desc.writable);\nassert(nonconfigurable_obj.enumerable == nonconfigurable_desc.enumerable);\n\nvar other_obj = { value: proxied_desc.value,\n                  configurable: proxied_desc.configurable,\n                  enumerable: false,\n                  writable: false }\nvar proxied_obj = Object.getOwnPropertyDescriptor(proxy, \"proxied\");\n\nassert(other_obj.value == proxied_obj.value);\nassert(other_obj.configurable == proxied_obj.configurable);\nassert(other_obj.writable == proxied_obj.writable);\nassert(other_obj.enumerable == proxied_obj.enumerable);\n\nvar other_obj2 = Object.getOwnPropertyDescriptor(proxy_without_handler, \"configurable\");\n\nassert(other_obj2.value == configurable_desc.value);\nassert(other_obj2.configurable == configurable_desc.configurable);\nassert(other_obj2.writable == configurable_desc.writable);\nassert(other_obj2.enumerable == configurable_desc.enumerable);\n\nvar other_obj3 = Object.getOwnPropertyDescriptor(proxy_without_handler, \"nonconfigurable\");\n\nassert(other_obj3.value == nonconfigurable_desc.value);\nassert(other_obj3.configurable == nonconfigurable_desc.configurable);\nassert(other_obj3.writable == nonconfigurable_desc.writable);\nassert(other_obj3.enumerable == nonconfigurable_desc.enumerable);\n\ntry {\n  Object.getOwnPropertyDescriptor(proxy, \"return_null\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// Checking invariants mentioned explicitly by the ES spec:\n\n// (Inv-1) \"A property cannot be reported as non-existent, if it exists as a\n// non-configurable own property of the target object.\"\nhandler.getOwnPropertyDescriptor = function(target, name) { return undefined; };\n\ntry {\n  Object.getOwnPropertyDescriptor(proxy, \"nonconfigurable\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\nassert(Object.getOwnPropertyDescriptor(proxy, \"configurable\") == undefined)\n\n// (Inv-2) \"A property cannot be reported as non-configurable, if it does not\n// exist as an own property of the target object or if it exists as a\n// configurable own property of the target object.\"\nhandler.getOwnPropertyDescriptor = function(target, name) {\n  return {value: 234, configurable: false, enumerable: true};\n};\n\ntry {\n  Object.getOwnPropertyDescriptor(proxy, \"nonexistent\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Object.getOwnPropertyDescriptor(proxy, \"configurable\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\nassert(!Object.getOwnPropertyDescriptor(proxy, \"nonconfigurable\").configurable);\n\n// (Inv-3) \"A property cannot be reported as non-existent, if it exists as an\n// own property of the target object and the target object is not extensible.\"\nObject.seal(target);\nhandler.getOwnPropertyDescriptor = function(target, name) { return undefined; };\n\ntry {\n  Object.getOwnPropertyDescriptor(proxy, \"configurable\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Object.getOwnPropertyDescriptor(proxy, \"nonconfigurable\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\nassert(undefined == Object.getOwnPropertyDescriptor(proxy, \"nonexistent\"));\n\n// (Inv-4) \"A property cannot be reported as existent, if it does not exist as\n// an own property of the target object and the target object is not\n// extensible.\"\nvar existent_desc = {value: \"yes\"};\nhandler.getOwnPropertyDescriptor = function() { return existent_desc; };\n\ntry {\n  Object.getOwnPropertyDescriptor(proxy, \"nonexistent\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\nvar new_obj =  {  value: \"yes\",\n                  writable: false,\n                  enumerable: false,\n                  configurable: false };\nvar conf_proxied = Object.getOwnPropertyDescriptor(proxy, \"configurable\");\n\nassert(new_obj.value == conf_proxied.value);\nassert(new_obj.configurable == conf_proxied.configurable);\nassert(new_obj.writable == conf_proxied.writable);\nassert(new_obj.enumerable == conf_proxied.enumerable);\n\n// Checking individual bailout points in the implementation:\n\n// Step 6: Trap is not callable.\nhandler.getOwnPropertyDescriptor = {};\n\ntry {\n  Object.getOwnPropertyDescriptor(proxy, \"configurable\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// Step 8: Trap throws.\nhandler.getOwnPropertyDescriptor = function() { throw \"unicorn\"; };\n\ntry {\n  Object.getOwnPropertyDescriptor(proxy, \"configurable\");\n  assert(false);\n} catch(e) {\n  assert(e == \"unicorn\");\n}\n\n// Step 9: Trap result is neither undefined nor an object.\nhandler.getOwnPropertyDescriptor = function() { return 1; }\n\ntry {\n  Object.getOwnPropertyDescriptor(proxy, \"configurable\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// Step 11b: See (Inv-1) above.\n// Step 11e: See (Inv-3) above.\n\n// Step 16: Incompatible PropertyDescriptor; a non-configurable property\n// cannot be reported as configurable. (Inv-4) above checks more cases.\nhandler.getOwnPropertyDescriptor = function(target, name) {\n  return {value: 456, configurable: true, writable: true}\n};\n\ntry {\n  Object.getOwnPropertyDescriptor(proxy, \"nonconfigurable\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// Step 17: See (Inv-2) above.\n\nvar result = [];\nvar proxy = new Proxy({foo: 1, bar: 2}, {\n  getOwnPropertyDescriptor: function(o, v) {\n    result.push(v);\n    return Object.getOwnPropertyDescriptor(o, v);\n  }\n});\n\nObject.assign({}, proxy);\n\nassert(result.length === 2);\nassert(result[0] === \"foo\");\nassert(result[1] === \"bar\");\n\n\nvar trapCalls = 0;\nvar p = new Proxy({}, {\n  getOwnPropertyDescriptor: function(t, prop) {\n    Object.defineProperty(t, prop, {\n      configurable: false,\n      writable: true,\n    });\n\n    trapCalls++;\n    return {\n      configurable: false,\n      writable: false,\n    };\n  },\n});\n\ntry\n{\n  Object.getOwnPropertyDescriptor(p, \"prop\");\n  assert (false)\n}\ncatch (e)\n{\n  assert(e instanceof TypeError)\n}\n"
  },
  {
    "path": "tests/jerry/proxy_get_prototoype_of.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar target = {};\nvar handler = { getPrototypeOf (target) {\n  throw 42;\n}};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  // 19.1.2.9.2\n  Object.getPrototypeOf(proxy);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\ntry {\n  // 19.1.3.3\n  Object.prototype.isPrototypeOf(proxy);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n(function () {\n  class e extends Array {};\n  function f () {};\n  function g () {};\n\n  Object.setPrototypeOf(g, proxy);\n\n  // 7.3.19.7.b\n  try {\n    g instanceof f;\n    assert(false);\n  } catch (e) {\n    assert(e === 42);\n  }\n\n  // ecma_op_implicit_class_constructor_has_instance [[GetPrototypeOf]]\n  try {\n    g instanceof e;\n    assert(false);\n  } catch (e) {\n    assert(e === 42);\n  }\n})();\n\ntry {\n  // 9.4.1.3.3\n  Function.prototype.bind.call(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test basic functionality\nvar target = {};\nvar handler = {\n  getPrototypeOf(target) {\n    return Array.prototype;\n  }\n}\nvar proxy = new Proxy(target, handler);\n\nassert(Object.getPrototypeOf(proxy) === Array.prototype);\nassert(Reflect.getPrototypeOf(proxy) === Array.prototype);\nassert(Array.prototype.isPrototypeOf(proxy));\nassert(proxy instanceof Array);\n\nvar obj = Object.preventExtensions({});\nassert(Object.getPrototypeOf(obj) === Object.prototype);\n\nvar handler = {\n  getPrototypeOf(target) {\n    return Object.prototype;\n  }\n}\nvar proxy = new Proxy(target, handler);\nassert(Object.getPrototypeOf(proxy) === Object.prototype);\n\n// test with no trap\nvar target = {};\nvar handler = {};\nvar proxy = new Proxy(target, handler);\n\nassert(Object.getPrototypeOf(proxy) === Object.prototype);\n\n// test with \"undefined\" trap\nvar target = {};\nvar handler = { getPrototypeOf: null };\nvar proxy = new Proxy(target, handler);\n\nassert(Object.getPrototypeOf(proxy) === Object.prototype);\n\n// test with invalid trap\nvar target = {};\nvar handler = { getPrototypeOf: 42 };\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.getPrototypeOf(proxy)\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when target is proxy\nvar target = {};\nvar handler = {};\nvar proxy = new Proxy(target, handler);\n\nvar target_prototype = {};\nhandler.getPrototypeOf = function() {\n  return target_prototype ;\n}\n\nvar proxy2 = new Proxy(proxy, handler);\nassert(Object.getPrototypeOf(proxy2) === target_prototype);\n\n// test when invariants gets violated\nvar target = {};\nvar handler = {\n  getPrototypeOf(target) {\n    return 'foo';\n  }\n}\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.getPrototypeOf(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar target = Object.preventExtensions({});\nvar handler = {\n  getPrototypeOf(target) {\n    return {};\n  }\n}\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.getPrototypeOf(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/proxy_has.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar target = {};\nvar handler = { has (target) {\n  throw 42;\n}};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  // 12.9.3\n  \"foo\" in proxy;\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\ntry {\n  // 8.1.1.2.1\n  with (proxy) {\n    p;\n    assert(false);\n  }\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\ntry {\n  // ecma_op_put_value_lex_env_base/[[HasProperty]]\n  with (proxy) {\n    function a (){}\n    assert(false);\n  }\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test basic functionality\nvar target = {\n  \"target_one\": 1\n};\n\nvar handler = {\n  has: function(target, prop) {\n    return prop == \"present\";\n  }\n}\n\nvar proxy = new Proxy(target, handler);\n\nassert(\"present\" in proxy === true);\nassert(\"non_present\" in proxy === false);\n\nvar target = {\n  foo: 5,\n  bar: 10\n};\n\nvar handler = {\n  has: function(target, prop) {\n    if (prop[0] === 'f') {\n      return false;\n    }\n    return prop in target;\n  }\n};\n\nvar proxy = new Proxy(target, handler);\n\nassert(\"foo\" in proxy === false);\nassert(\"bar\" in proxy === true);\n\n// test with no trap\nvar target = {\n  foo: \"foo\"\n};\nvar handler = {};\nvar proxy = new Proxy(target, handler);\n\nassert(\"foo\" in proxy === true);\n\n// test with \"undefined\" trap\nvar target = {\n  foo: \"foo\"\n};\nvar handler = {has: null};\nvar proxy = new Proxy(target, handler);\n\nassert(\"foo\" in proxy === true);\n\n// test with invalid trap\nvar target = {\n  foo: \"foo\"\n};\nvar handler = {has: 42};\nvar proxy = new Proxy(target, handler);\n\ntry {\n  \"foo\" in proxy;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when target is proxy\nvar target = {\n  foo: \"foo\"\n};\n\nvar handler = {\n  has: function(target, prop) {\n    return prop in target;\n  }\n}\n\nvar proxy1 = new Proxy(target, handler);\nvar proxy2 = new Proxy(proxy1, handler);\n\nassert(\"foo\" in proxy2 === true);\n\n// test when invariants gets violated\nvar target = {};\n\nObject.defineProperty(target, \"prop\", {\n  configurable: false,\n  value: 10\n})\n\nvar handler = {\n  has: function(target, prop) {\n    return false;\n  }\n}\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  'prop' in proxy;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar target = { a: 10 };\nObject.preventExtensions(target);\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  'a' in proxy;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/proxy_is_extensible.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n// error checks\nvar target = {};\nvar handler = { isExtensible (target) {\n  throw 42;\n}};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  // 7.3.15\n  Object.isFrozen(proxy)\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\ntry {\n  // 7.3.15\n  Object.isSealed(proxy)\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\ntry {\n  // 7.2.5\n  Object.isExtensible(proxy)\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// no trap\nvar target = {};\nvar handler = {};\nvar proxy = new Proxy(target, handler);\nassert(Object.isExtensible(target) === true)\nassert(Object.isExtensible(proxy) === true);\nObject.preventExtensions(target);\nassert(Object.isExtensible(target) === false);\nassert(Object.isExtensible(proxy) === false);\n\n// undefined trap\nvar target = {};\nvar handler =  { isExtensible: null };\nvar proxy = new Proxy(target, handler);\nassert(Object.isExtensible(target) === true)\nassert(Object.isExtensible(proxy) === true);\nObject.preventExtensions(target);\nassert(Object.isExtensible(target) === false);\nassert(Object.isExtensible(proxy) === false);\n\n// invalid trap\nvar target = {};\nvar handler =  { isExtensible: true };\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.isExtensible(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError); \n}\n\n// valid trap\nvar target = { prop1: true };\nvar handler = {\n  isExtensible(target) {\n    target.prop1 = false;\n    return Object.isExtensible(target);\n  }\n};\n\nvar proxy = new Proxy(target, handler);\nassert(Object.isExtensible(proxy) === true);\nassert(target.prop1 === false);\nObject.preventExtensions(target);\nassert(Object.isExtensible(target) === false);\nassert(Object.isExtensible(proxy) === false);\n\n// trap result is invalid\nvar target = {};\nvar handler = {\n  isExtensible(target) {\n    return false;\n  }\n};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.isExtensible(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// handler is null\nvar target = {};\nvar handler = { \n  isExtensible (target) {\n    return Object.isExtensible(target);\n  }\n};\n\nvar revocable = Proxy.revocable (target, {});\nvar proxy = revocable.proxy;\nrevocable.revoke();\n\ntry {\n  Object.isExtensible(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// proxy within proxy\nvar target = {};\nvar handler1 = {\n  isExtensible(target) {\n    return Object.isExtensible(target);\n  }\n};\n\nvar handler2 = {\n  isExtensible(target) {\n    return false;\n  }\n};\n\nvar proxy = new Proxy(target, handler1);\nvar proxy2 = new Proxy(proxy, handler1);\nassert(Object.isExtensible(proxy2) === true);\n\nvar proxy3 = new Proxy(proxy, handler2);\n\ntry {\n  Object.isExtensible(proxy3);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar proxy4 = new Proxy(proxy2, handler1);\nObject.preventExtensions(target);\nassert(Object.isExtensible(proxy4) === false);\n"
  },
  {
    "path": "tests/jerry/proxy_own_keys.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nfunction array_check(result_array, expected_array) {\n  assert(result_array instanceof Array);\n  assert(result_array.length === expected_array.length);\n  for (var idx = 0; idx < expected_array.length; idx++) {\n    assert(result_array[idx] === expected_array[idx]);\n  }\n}\n\nvar target = {};\nvar handler = { ownKeys (target) {\n  throw 42;\n}};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  // 19.1.2.14.4\n  Object.keys(proxy);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\ntry {\n  // 19.1.2.7.1\n  Object.getOwnPropertyNames(proxy);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\ntry {\n  // 19.1.2.8.1\n  Object.getOwnPropertySymbols(proxy);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\nvar handler = { ownKeys (target) {\n  return [\"a\"];\n}};\n\nvar proxy = new Proxy(target, handler);\nvar sort_result = Array.prototype.sort.call(proxy);\nassert(Object.keys(sort_result).length === 0);\n\n// test basic functionality\nvar symA = Symbol(\"smA\");\nvar symB = Symbol(\"smB\");\nvar target = { prop1: \"prop1\", prop2: \"prop2\"};\ntarget[symB] = \"s3\";\nvar handler = {\n  ownKeys: function(target) {\n    return [\"foo\", \"bar\", symA];\n  }\n}\n\nvar proxy = new Proxy(target, handler);\n\narray_check(Reflect.ownKeys(proxy), [\"foo\", \"bar\", symA]);\narray_check(Object.getOwnPropertyNames(proxy), [\"foo\", \"bar\"]);\narray_check(Object.keys(proxy), []);\narray_check(Object.getOwnPropertySymbols(proxy), [symA]);\n\nhandler.ownKeys = function(target) {return Object.getOwnPropertyNames(target);};\n\narray_check(Reflect.ownKeys(proxy), [\"prop1\", \"prop2\"]);\narray_check(Object.getOwnPropertyNames(proxy), [\"prop1\", \"prop2\"]);\narray_check(Object.keys(proxy), [\"prop1\", \"prop2\"]);\narray_check(Object.getOwnPropertySymbols(proxy), []);\n\n// test with no trap\nvar target = { prop1: \"prop1\", prop2: \"prop2\"};\nvar handler = {};\nvar proxy = new Proxy(target, handler);\n\nassert(JSON.stringify(Object.getOwnPropertyNames(proxy)) === '[\"prop1\",\"prop2\"]');\n\n// test wtih \"undefined\" trap\nvar target = { prop1: \"prop1\", prop2: \"prop2\"};\nvar handler = {ownKeys: null};\nvar proxy = new Proxy(target, handler);\n\nassert(JSON.stringify(Object.getOwnPropertyNames(proxy)) === '[\"prop1\",\"prop2\"]');\n\n// test with invalid trap\nvar target = { prop1: \"prop1\", prop2: \"prop2\"};\nvar handler = {ownKeys: 42};\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.getOwnPropertyNames(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when CreateListFromArrayLike called on non-object\nvar target = { prop1: \"prop1\", prop2: \"prop2\"};\nvar handler = {\n\townKeys: function(target) {\n      return \"foo\";\n    }\n};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.getOwnPropertyNames(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test with invalid property key\nvar target = {};\nvar handler = {\n\townKeys: function(target) {\n      return [5];\n    }\n};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.getOwnPropertyNames(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test with duplicated keys\nvar p = new Proxy({}, {\n\townKeys: function(target) {\n\t  return [\"foo\", \"foo\"];\n\t}\n});\n\ntry {\n  Object.keys(p);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test with lots of keys\nvar keyslist = [];\n\nvar handler = {\n\townKeys: function(target) {\n      for (var idx = 0; idx < 30; idx++) {\n        keyslist.push(\"K\" + idx);\n      }\n      return keyslist;\n    }\n};\n\nvar proxy = new Proxy(target, handler);\nassert(JSON.stringify(Object.getOwnPropertyNames(proxy)) === JSON.stringify(keyslist));\n\n// test when invariants gets violated\nvar target = {\n  \"target_one\": 1\n};\nObject.defineProperty(target, \"nonconf\", {value: 1, configurable: false});\n\nvar keys = [\"foo\"];\n\nvar handler = {\n\townKeys: function(target) {\n      return keys;\n    }\n};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.getOwnPropertyNames(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nkeys = [\"nonconf\"];\nassert(JSON.stringify(Object.getOwnPropertyNames(proxy)) === '[\"nonconf\"]');\n\nObject.preventExtensions(target);\nkeys = [\"foo\", \"nonconf\"];\n\ntry {\n  Object.getOwnPropertyNames(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nkeys = [\"target_one\", \"nonconf\"];\n\nassert(JSON.stringify(Object.getOwnPropertyNames(proxy)) === '[\"target_one\",\"nonconf\"]');\n\nkeys = [\"target_one\", \"nonconf\", \"foo\"];\n\ntry {\n  Object.getOwnPropertyNames(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar object = {};\nObject.defineProperties(object, {\n  a: { value: 42, enumerable: false },\n  b: { value: \"foo\", enumerable: true },\n  c: { value: \"bar\", enumerable: false }\n});\n\nvar handler = {\n  ownKeys(target) {\n    return Reflect.ownKeys(target);\n  }\n};\n\nvar proxy = new Proxy(object, handler);\n\nassert(Object.keys(proxy).length === 1);\nassert(Object.keys(proxy)[0] === \"b\");"
  },
  {
    "path": "tests/jerry/proxy_prevent_extensions.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar target = {};\nvar handler = { preventExtensions (target) {\n  throw 42;\n}};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  // 7.3.14\n  Object.freeze(proxy)\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\ntry {\n  // 7.3.14\n  Object.seal(proxy)\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test with no trap\nvar target = {};\nvar handler = {};\nvar proxy = new Proxy(target, handler);\n\nassert(Object.isExtensible(target) === true);\nassert(Object.isExtensible(proxy) === true);\nObject.preventExtensions(proxy);\nassert(Object.isExtensible(target) === false);\nassert(Object.isExtensible(proxy) === false);\n\n// test with \"undefined\" trap\nvar target = {};\nvar handler = { preventExtensions: null };\nvar proxy = new Proxy(target, handler);\n\nassert(Object.isExtensible(target) === true);\nassert(Object.isExtensible(proxy) === true);\nObject.preventExtensions(proxy);\nassert(Object.isExtensible(target) === false);\nassert(Object.isExtensible(proxy) === false);\n\n// test with invalid trap\nvar target = {};\nvar handler = { preventExtensions: 42 };\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.preventExtensions(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test with valid trap\nvar target = { foo: \"bar\" };\nvar handler = {\n  preventExtensions(target) {\n    target.foo = \"foo\"\n    Object.preventExtensions(target);\n    return true;\n  }\n}\n\nvar proxy = new Proxy(target, handler);\nassert(Object.isExtensible(target) === true);\nassert(Object.isExtensible(proxy) === true);\nassert(target.foo === \"bar\");\nObject.preventExtensions(proxy);\nassert(Object.isExtensible(target) === false);\nassert(Object.isExtensible(proxy) === false);\nassert(target.foo === \"foo\");\n\n// test when invariants gets violated\nvar target = {};\nvar handler = {\n  preventExtensions(target) {\n    return true;\n  }\n}\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.preventExtensions(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when target is proxy\nvar target = {};\nvar handler = {\n  preventExtensions(target) {\n    Object.preventExtensions(target);\n    return true;\n  }\n}\n\nvar proxy1 = new Proxy(target, handler);\nvar proxy2 = new Proxy(proxy1, handler);\n\nassert(Object.isExtensible(target) === true);\nassert(Object.isExtensible(proxy1) === true);\nassert(Object.isExtensible(proxy2) === true);\nObject.preventExtensions(proxy2);\nassert(Object.isExtensible(target) === false);\nassert(Object.isExtensible(proxy1) === false);\nassert(Object.isExtensible(proxy2) === false);\n\nvar target = {};\nvar handler = {\n  preventExtensions(target) {\n    return true;\n  }\n}\n\nvar proxy1 = new Proxy(target, handler);\nvar proxy2 = new Proxy(proxy1, handler);\n\ntry {\n  Object.preventExtensions(proxy2);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/proxy_revocable.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar target = function () {};\nvar handler = { get (name) {\n  return 5;\n}};\n\nvar revocable = Proxy.revocable(target, handler);\n\nvar proxy = revocable.proxy;\n\nassert(proxy.a === 5);\n\nrevocable.revoke();\n\ntry {\n  proxy.a;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Proxy.revocable();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Proxy.revocable(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar p1 = Proxy.revocable({}, proxy);\np1.a = 3;\nassert(p1.a == 3);\n\nvar p2 = Proxy.revocable(proxy, {});\np2.b = 43;\nassert(p2.b == 43);\n\nassert(typeof(target.a) === \"undefined\");\nassert(typeof(target.b) === \"undefined\");\n\n// Try accessing the \"a\" property again, it should fail\ntry {\n  proxy.a;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/proxy_set.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n// test basic funcionality\nfunction Monster() {\n  this.eyeCount = 4;\n}\n\nvar handler = {\n  set(obj, prop, value) {\n    if (prop == 'eyeCount') {\n      obj[prop] = value;\n    } else {\n      obj[prop] = \"foo\";\n    }\n  }\n};\n\nvar monster = new Monster();\nvar proxy = new Proxy(monster, handler);\n\nproxy.eyeCount = 1;\nproxy.foo = \"bar\";\n\nassert(monster.eyeCount === 1);\nassert(monster.foo === \"foo\");\n\nvar target = { foo: \"foo\"};\nvar handler = {\n  set: function(obj, prop, value) {\n    obj[prop] = \"\";\n  }\n};\nvar proxy = new Proxy(target, handler);\n\nproxy.foo = 12;\nassert(target.foo === \"\");\n\nvar properties = [\"bla\", \"0\", 1, Symbol(), {[Symbol.toPrimitive]() {return \"a\"}}];\n\nvar target = {};\nvar handler = {};\nvar proxy = new Proxy(target, handler);\n\n// test when property does not exist on target\n/* TODO: Enable these tests when Proxy.[[GetOwnProperty]] has been implemented\nfor (var p of properties) {\n  proxy.p = 42;\n  assert(target.p === 42);\n}\n\n// test when property exists as writable data on target\nfor (var p of properties) {\n  Object.defineProperty(target, p, {\n    writable: true,\n    value: 24\n  });\n\n  proxy.p = 42;\n  assert(target.p === 42);\n}\n*/\n// test when target is a proxy\nvar target = {};\nvar handler = {\n  set(obj, prop, value) {\n    obj[prop] = value;\n  }\n};\n\nvar proxy = new Proxy(target, handler);\nvar proxy2 = new Proxy(proxy, handler);\n\nproxy2.prop = \"foo\";\n\nassert(target.prop === \"foo\");\n\n// test when handler is null\nvar target = {};\nvar handler = {\n  set(obj, prop, value) {\n    obj[prop] = value;\n  }\n};\n\nvar revocable = Proxy.revocable (target, {});\nvar proxy = revocable.proxy;\nrevocable.revoke();\n\ntry {\n  proxy.prop = 42;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when invariants gets violated\nvar target = {};\nvar handler = { set() {return 42} };\nvar proxy = new Proxy(target, handler);\n\nObject.defineProperty(target, \"key\", {\n  configurable: false,\n  writable: false,\n  value: 0\n});\n\ntry {\n  proxy.key = 600;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nObject.defineProperty(target, \"key2\", {\n  configurable: false,\n  set: undefined\n});\n\ntry {\n  proxy.key2 = 500;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n/* Setting a new property should be configurable, enumerable, and writable by default\n * over a proxy.\n */\nvar setPropProxy = new Proxy({}, {});\nsetPropProxy[\"alma\"] = 3;\n\nvar desc = Object.getOwnPropertyDescriptor(setPropProxy, \"alma\");\n\nassert(desc.writable === true);\nassert(desc.enumerable === true);\nassert(desc.configurable === true);\nassert(desc.value === 3);\n"
  },
  {
    "path": "tests/jerry/proxy_set_apply_receiver.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar get = [];\nvar p = new Proxy({\n  exec: function() {\n    return null;\n  }\n}, {\n  get: function(o, k) {\n    get.push(k);\n    return o[k];\n  }\n});\nRegExp.prototype[Symbol.match].call(p);\np.global = true;\nRegExp.prototype[Symbol.match].call(p);\n\nassert(get + '' === \"global,exec,global,unicode,exec\");\n"
  },
  {
    "path": "tests/jerry/proxy_set_prototoype_of.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar target = {};\nvar handler = { setPrototypeOf (target) {\n  throw 42;\n}};\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  // 19.1.2.18\n  Object.setPrototypeOf(proxy, {});\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test basic funcionality\nvar targetProto = {};\nvar target = {\n  foo: false\n};\n\nvar handler = {\n  setPrototypeOf(target, targetrProto) {\n    target.foo = true;\n    return false;\n  }\n};\n\nvar proxy = new Proxy(target, handler);\n\nassert(Reflect.setPrototypeOf(proxy, targetProto) === false);\nassert(target.foo === true);\n\ntry {\n  Object.setPrototypeOf(proxy, targetProto);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Object.setPrototypeOf(proxy, undefined);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Object.setPrototypeOf(proxy, 1);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar target = {};\nvar handler = {};\nvar prototype = [];\n\nvar proxy = new Proxy(target, handler);\n\nObject.setPrototypeOf(proxy, prototype);\nassert(Object.getPrototypeOf(target) === prototype);\n\nhandler.setPrototypeOf = function(target, proto) {\n  return false;\n};\n\ntry {\n  Object.setPrototypeOf(proxy, {});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nhandler.setPrototypeOf = function(target, proto) {\n  return undefined;\n};\n\ntry {\n  Object.setPrototypeOf(proxy, {});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nhandler.setPrototypeOf = function(proto) {};\n\ntry {\n  Object.setPrototypeOf(proxy, {});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar proto = {};\nObject.setPrototypeOf(proto, Function.prototype);\n\nvar seen_prototype;\nvar seen_target;\n\nhandler.setPrototypeOf = function(target, proto) {\n  seen_target = target;\n  seen_prototype = proto;\n  return true;\n}\n\nObject.setPrototypeOf(proxy, proto);\nassert(target === seen_target);\nassert(proto === seen_prototype);\n\n// test when target is proxy\nvar target = {};\nvar handler = {};\nvar handler2 = {};\nvar target2 = new Proxy(target, handler2);\nvar proxy2 = new Proxy(target2, handler);\nvar prototype = [2,3];\n\nObject.setPrototypeOf(proxy2, prototype);\n\nassert(prototype === Object.getPrototypeOf(target));\n\n// test when invariants gets violated\nvar target = {};\nvar handler = {\n    setPrototypeOf(target, proto) {\n        Object.setPrototypeOf(target, Function.prototype);\n        Object.preventExtensions(target);\n        return true;\n    }\n}\n\nvar proxy = new Proxy(target, handler);\n\ntry {\n  Object.setPrototypeOf(proxy, Array.prototype);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/realms1.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar realm = createRealm()\nvar ev = realm.eval\n\nassert(realm.Math != Math)\nassert(typeof realm.Math === \"object\")\nassert(realm.Object != Object)\nassert(typeof realm.Object === \"function\")\nassert(realm.eval != eval)\nassert(typeof realm.eval === \"function\")\n\n// Share our 'assert' function with the realm\nrealm.assert = assert\n\n// Test1: var1 and var2 must be different properties\n\nrealm.var1 = 3.5\nassert(realm.var2 === undefined)\n\nvar var1 = \"X\"\nvar var2 = \"Y\"\n\nev(\"assert(var1 === 3.5); \\\n    try { realm; assert(false) } catch (e) { assert(e instanceof ReferenceError) } \\\n    assert(this === globalThis); \\\n    var var2 = this\")\nassert(realm.var2 === realm)\n\nassert(var1 === \"X\")\nassert(var2 === \"Y\")\n\n// Test2: constructing any objects (including errors) must use the realm\n\nassert (realm.RangeError != RangeError)\nassert (realm.RangeError.prototype != RangeError.prototype)\n\nrealm.RangeError.prototype.myProperty = \"XY\"\nassert(RangeError.prototype.myProperty === undefined)\n\ntry {\n  var NumberToString = realm.Number.prototype.toString;\n  NumberToString.call(0, 0)\n  assert(false)\n} catch (e) {\n  assert(e instanceof realm.RangeError)\n  assert(!(e instanceof RangeError))\n  assert(e.myProperty === \"XY\")\n}\n\nassert (realm.SyntaxError != SyntaxError)\nassert (realm.SyntaxError.prototype != SyntaxError.prototype)\n\nrealm.SyntaxError.prototype.myProperty = \"AB\"\nassert(SyntaxError.prototype.myProperty === undefined)\n\ntry {\n  ev(\"5 +\")\n  assert(false)\n} catch (e) {\n  assert(e instanceof realm.SyntaxError)\n  assert(!(e instanceof SyntaxError))\n  assert(e.myProperty === \"AB\")\n}\n\n// Test3: only the realm corresponding to the function matters\n\nrealm.Boolean.prototype.valueOf.a = Function.prototype.apply\nBoolean.prototype.valueOf.a = realm.Function.prototype.apply\n\ntry {\n  realm.Boolean.prototype.valueOf.a()\n} catch (e) {\n  assert(e instanceof realm.TypeError)\n  assert(!(e instanceof TypeError))\n}\n\ntry {\n  Boolean.prototype.valueOf.a()\n} catch (e) {\n  assert(e instanceof TypeError)\n  assert(!(e instanceof realm.TypeError))\n}\n"
  },
  {
    "path": "tests/jerry/realms2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Test1: realm cannot be gc-ed until it is referenced\n\nfunction f1() {\n  var ev = createRealm().eval\n\n  gc()\n\n  try {\n    ev(\"5 +\")\n  } catch (e) {\n    assert(e instanceof ev(\"this\").SyntaxError)\n    assert(!(e instanceof SyntaxError))\n  }\n}\nf1()\n\n// Test2: built-ins cannot be gc-ed until the realm exists\n\nfunction f2() {\n  var realm = createRealm()\n\n  var str = new realm.String(\"A\");\n  // Assign a property to String.prototype\n  Object.getPrototypeOf(str).myProperty = \"XY\"\n\n  str = null\n  // No reference to String.prototype\n  gc()\n\n  str = new realm.String(\"A\")\n  assert(Object.getPrototypeOf(str).myProperty === \"XY\")\n  assert(realm.String.prototype.myProperty === \"XY\")\n}\nf2()\n"
  },
  {
    "path": "tests/jerry/realms3.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Test1: reading global values from other realms\n\nvar a = 4.5\n\nfunction f1()\n{\n  var realm = createRealm()\n  var f = realm.eval(\"function g() { return a } g\")\n\n  realm.a = -6.25\n  assert(f() === -6.25)\n  assert(a === 4.5)\n  assert(realm.g === f)\n\n  realm.eval(\"var v1 = 6; eval('var v2 = 7.5')\")\n  assert(realm.v1 === 6)\n  assert(realm.v2 === 7.5)\n\n  var e = realm.eval\n\n  eval(\"e('var v3 = -5.25'); var v3 = 1.5; e('v3++')\")\n  assert(realm.v3 === -4.25)\n  assert(v3 === 1.5)\n}\nf1()\n\n// Test2: recursive calls\n\nvar b = \"S\"\n\nfunction f2()\n{\n  function f(fun) {\n    return fun() + b;\n  }\n\n  var realm = createRealm()\n\n  realm.eval(\"function h() { return b }\")\n\n  var g = realm.Function(\"fun\", \"return fun(h) + b\")\n\n  realm.b = \"X\"\n  assert(g(f) === \"XSX\")\n  assert(b === \"S\")\n}\nf2()\n\n// Test3: built-in functions\n\nfunction f3()\n{\n  var realm = createRealm()\n\n  realm.f = function () { return eval(\"/a/\") }\n\n  var res = realm.eval(\"[f(), /a/, f(), /b/]\")\n\n  assert(Object.getPrototypeOf(res[0]) === RegExp.prototype)\n  assert(Object.getPrototypeOf(res[1]) === realm.RegExp.prototype)\n  assert(Object.getPrototypeOf(res[2]) === RegExp.prototype)\n  assert(Object.getPrototypeOf(res[3]) === realm.RegExp.prototype)\n\n  realm.g = function () { return non_existent }\n\n  try {\n    realm.eval(\"g()\")\n    assert(false)\n  } catch (e) {\n    assert(e instanceof ReferenceError)\n    assert(!(e instanceof realm.ReferenceError))\n  }\n\n  try {\n    realm.eval(\"non_existent\")\n    assert(false)\n  } catch (e) {\n    assert(e instanceof realm.ReferenceError)\n    assert(!(e instanceof ReferenceError))\n  }\n}\nf3()\n\n// Test4: generator functions\n\nfunction f4()\n{\n  function f() {\n    return b;\n  }\n\n  var realm = createRealm()\n\n  function check_gen_result(result, value, done)\n  {\n    assert(Object.getPrototypeOf(result) === realm.Object.prototype)\n    assert(result.value === value)\n    assert(result.done === done)\n  }\n\n  realm.eval(\"var a = 'P', b = 'Q'\")\n\n  var gen = realm.eval(\"function* gen(f) { yield f() + a; yield f() + b; return a + b + f() }\")\n\n  var it = realm.gen(f)\n\n  check_gen_result(it.next(), \"SP\", false)\n  check_gen_result(it.next(), \"SQ\", false)\n  check_gen_result(it.next(), \"PQS\", true)\n}\nf4()\n\n// Test5: async functions\n\nvar successCount = 0\n\nfunction f5()\n{\n  function f() {\n    return b;\n  }\n\n  var r, p = new Promise(function(resolve, reject) { r = resolve })\n\n  var realm = createRealm()\n\n  realm.assert = assert\n  realm.eval(\"async function asy(p, f) { assert(f() === 'S'); assert(await p === 4.5); return f() + b }\")\n\n  realm.b = \"X\"\n\n  realm.asy(p, f).then(function(v) {\n    assert(v === \"SX\")\n    successCount++\n  }, function() {\n    assert(false)\n  })\n  r(4.5)\n}\nf5()\n\n// Test6: async generator functions\n\nfunction f6()\n{\n  function f() {\n    return b;\n  }\n\n  var r, p = new Promise(function(resolve, reject) { r = resolve })\n\n  var realm = createRealm()\n\n  function check_fulfilled(p, value, done)\n  {\n    assert(p instanceof realm.Promise)\n\n    p.then(function(v) {\n      assert(v.value === value)\n      assert(v.done === done)\n      successCount++\n    }, function() {\n      assert(false)\n    })\n  }\n\n  realm.assert = assert\n  realm.eval(\"async function *asygen(p, f) { assert(f() === 'S'); assert(await p === -1.5); yield f() + a; return f() + b }\")\n\n  realm.a = \"X\"\n  realm.b = \"Y\"\n\n  var gen = realm.asygen(p, f)\n\n  check_fulfilled(gen.next(), \"SX\", false)\n  check_fulfilled(gen.next(), \"SY\", true)\n\n  r(-1.5)\n}\nf6()\n\nfunction __checkAsync() {\n  assert(successCount === 3)\n}\n"
  },
  {
    "path": "tests/jerry/realms4.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar realm = createRealm()\n\nfunction compare(a, b)\n{\n  assert (a === b)\n  assert (typeof a === \"symbol\")\n  assert (typeof b === \"symbol\")\n}\n\ncompare(Symbol.asyncIterator, realm.Symbol.asyncIterator)\ncompare(Symbol.hasInstance, realm.Symbol.hasInstance)\ncompare(Symbol.isConcatSpreadable, realm.Symbol.isConcatSpreadable)\ncompare(Symbol.iterator, realm.Symbol.iterator)\ncompare(Symbol.match, realm.Symbol.match)\ncompare(Symbol.replace, realm.Symbol.replace)\ncompare(Symbol.search, realm.Symbol.search)\ncompare(Symbol.species, realm.Symbol.species)\ncompare(Symbol.split, realm.Symbol.split)\ncompare(Symbol.toPrimitive, realm.Symbol.toPrimitive)\ncompare(Symbol.toStringTag, realm.Symbol.toStringTag)\ncompare(Symbol.unscopables, realm.Symbol.unscopables)\n"
  },
  {
    "path": "tests/jerry/reflect-apply.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (Reflect['apply'](Math.floor, undefined, [1.75]) === 1);\nassert (Reflect['apply'](String.fromCharCode, undefined, [104, 101, 108, 108, 111]) === \"hello\");\nassert (Reflect['apply'](RegExp.prototype.exec, /ab/, ['confabulation']).index === 4);\nassert (Reflect['apply'](''.charAt, 'ponies', [3]) === \"i\");\n"
  },
  {
    "path": "tests/jerry/reflect-construct.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  Reflect.construct ();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.construct (Date);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar d = Reflect.construct (Date, [1776, 6, 4]);\nassert (d instanceof Date);\nassert (d.getFullYear () === 1776);\n\nfunction func1 (a, b, c) {\n  this.sum = a + b + c;\n}\n\nvar args = [1, 2, 3];\nvar object1 = new func1 (...args);\nvar object2 = Reflect.construct (func1, args);\n\nassert (object2.sum === 6);\nassert (object1.sum === 6);\n\nfunction CatClass () {\n  this.name = 'Cat';\n}\n\nfunction DogClass () {\n  this.name = 'Dog';\n}\n\nvar obj1 = Reflect.construct (CatClass, args, DogClass);\nassert (obj1.name === 'Cat');\nassert (!(obj1 instanceof CatClass));\nassert (obj1 instanceof DogClass);\n\ntry {\n  Reflect.construct (func1, 5, 5);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.construct (5, 5);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nfunction func2 () {\n  throw 5;\n}\n\ntry {\n  Reflect.construct (func2, {});\n  assert (false);\n} catch (e) {\n  assert (e === 5);\n}\n"
  },
  {
    "path": "tests/jerry/reflect-define-Property.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {};\nassert(Reflect['defineProperty'](obj, 'x', {value: 7}) === true);\nassert(Reflect['defineProperty'](obj, 'y', {value: function() {throw 5}}) === true);\ntry {\n    Reflect['defineProperty'](obj, {toString: function() {throw new TypeError(5)}}, {value: 8});\n    assert(false);\n} catch (e) {\n    assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/reflect-deleteproperty.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2014 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar object = {\n  property: 'Batcat'\n};\n\nReflect.deleteProperty (object, 'property');\n\nassert (object.property === undefined);\n\nassert (2 === Reflect.deleteProperty.length);\n\ntry {\n  Reflect.deleteProperty ();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.deleteProperty (42, 'bat');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.deleteProperty (null, 'bat');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar target = {bat: 42};\nvar a = { [Symbol.toPrimitive]: function() { return 'bat' } };\nvar b = { [Symbol.toPrimitive]: function() { throw 'cat' } };\n\nassert (Reflect.deleteProperty (target, a));\n\ntry {\n  Reflect.deleteProperty (target, b);\n  assert (false);\n} catch (e) {\n  assert (e === 'cat');\n}\n"
  },
  {
    "path": "tests/jerry/reflect-get-own-property-description.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar object1 = {\n    property1: 42\n};\n\nassert(Reflect.getOwnPropertyDescriptor(object1, 'property1').value === 42);\nassert(Reflect.getOwnPropertyDescriptor(object1, 'property2') === undefined);\nassert(Reflect.getOwnPropertyDescriptor(object1, 'property1').writable === true);\n"
  },
  {
    "path": "tests/jerry/reflect-get.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2017 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar object1 = {\n  x: \"Bat\",\n  y: \"Cat\"\n};\n\nassert (Reflect.get (object1, 'y') === \"Cat\");\n\ntry {\n  Reflect.get ();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (Reflect.get ({}) === undefined);\n\nvar o = {x: 10};\nfunction foo () {\n  try {\n    return Reflect.get (o, \"x\");\n  } catch (e) {\n    return 1;\n  }\n}\n\nassert (10 === foo());\n\nvar c = {};\nfunction foo2 (a) {\n  try {\n    return Reflect.get (c, a);\n  } catch (e) {\n    return 1;\n  }\n}\n\nassert (1 === foo2 ({[Symbol.toPrimitive]() { throw new Error(); }}));\n"
  },
  {
    "path": "tests/jerry/reflect-getPrototypeOf.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (Reflect['getPrototypeOf']({}) === Object.prototype);\nassert (Reflect['getPrototypeOf'](Object.create(null)) === null);\nassert (Reflect['getPrototypeOf'](Object.prototype) === null);\n\ntry {\n  Reflect.getPrototypeOf();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.getPrototypeOf(\"str\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/reflect-has.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2014 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nassert (Reflect.has ({x: 0}, 'x') === true);\nassert (Reflect.has ({x: 0}, 'y') === false);\n\nassert (Reflect.has ({x: 0}, 'toString') === true);\n\nvar object = {\n  prop: 'Apple'\n};\n\nassert (Reflect.has (object, 'prop') === true);\n\nassert (2 === Reflect.has.length);\n\ntry {\n  Reflect.has ();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.has (42, 'batcat');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.has (null, 'bat');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar target = {bat: 42};\nvar a = { [Symbol.toPrimitive]: function () { return 'bat' } };\nvar b = { [Symbol.toPrimitive]: function () { throw 'cat' } };\n\nassert (Reflect.has (target, a) === true);\n\ntry {\n  Reflect.has (target, b);\n  assert (false);\n} catch (e) {\n  assert (e === 'cat');\n}\n"
  },
  {
    "path": "tests/jerry/reflect-isextensible.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar empty = {};\nassert (Reflect['isExtensible'](empty) === true);\n\nReflect.preventExtensions(empty);\nassert (Reflect['isExtensible'](empty) === false);\n\nvar sealed = Object.seal({});\nassert (Reflect['isExtensible'](sealed) === false);\n"
  },
  {
    "path": "tests/jerry/reflect-own-keys.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2015 the V8 project authors. All rights reserved.\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n//     * Redistributions of source code must retain the above copyright\n//       notice, this list of conditions and the following disclaimer.\n//     * Redistributions in binary form must reproduce the above\n//       copyright notice, this list of conditions and the following\n//       disclaimer in the documentation and/or other materials provided\n//       with the distribution.\n//     * Neither the name of Google Inc. nor the names of its\n//       contributors may be used to endorse or promote products derived\n//       from this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nvar object1 = {\n  property1: 42,\n  property2: 13\n};\n\nvar array1 = [];\n\nassert (Reflect.ownKeys (object1)[0] === \"property1\");\nassert (Reflect.ownKeys (object1)[1] === \"property2\");\nassert (Reflect.ownKeys (object1).length === 2);\n\nvar obj = { a: 1, b: 2};\nvar keys = Reflect.ownKeys (obj);\nassert (2 === keys.length);\nassert (\"a\" === keys[0]);\nassert (\"b\" === keys[1]);\n\nvar obj = { a: function(){}, b: function(){} };\nvar keys = Reflect.ownKeys (obj);\nassert (2 === keys.length);\nassert (\"a\" === keys[0]);\nassert (\"b\" === keys[1]);\n\n// Check slow case\nvar obj = { a: 1, b: 2, c: 3 };\ndelete obj.b;\nvar keys = Reflect.ownKeys (obj)\nassert (2 === keys.length);\nassert (\"a\" === keys[0]);\nassert (\"c\" === keys[1]);\n\n// Check that non-enumerable properties are being returned.\nvar keys = Reflect.ownKeys ([1, 2]);\nassert (3 === keys.length);\nassert (\"0\" === keys[0]);\nassert (\"1\" === keys[1]);\nassert (\"string\" === typeof keys[0]);\nassert (\"string\" === typeof keys[1]);\nassert (\"length\" === keys[2]);\n\n// Check that no proto properties are returned.\nvar obj = { foo: \"foo\" };\nvar obj2 = { bar: \"bar\" };\nObject.setPrototypeOf (obj, obj2)\nkeys = Reflect.ownKeys (obj);\nassert (1 === keys.length);\nassert (\"foo\" === keys[0]);\n\n// Check that getter properties are returned.\nvar obj = {};\nObject.defineProperty (obj, \"getter\", function() {})\n//obj.__defineGetter__(\"getter\", function() {});\nkeys = Reflect.ownKeys (obj);\nassert (1 === keys.length);\nassert (\"getter\" === keys[0]);\n\n// Check that implementation does not access Array.prototype.\nvar savedConcat = Array.prototype.concat;\nArray.prototype.concat = function() { return []; }\nkeys = Reflect.ownKeys ({0: 'foo', bar: 'baz'});\nassert (2 === keys.length);\nassert ('0' === keys[0]);\nassert ('bar'=== keys[1]);\nassert (Array.prototype === Object.getPrototypeOf (keys))\nArray.prototype.concat = savedConcat;\n\ntry {\n  Reflect.ownKeys (4);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.ownKeys(\"cica\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.ownKeys(true);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (Reflect.ownKeys (Object (4)) !== [])\nassert (Reflect.ownKeys (Object (\"foo\")) !== [\"0\", \"1\", \"2\", \"length\"])\nassert (Reflect.ownKeys (Object (4)) !== []);\nassert (Reflect.ownKeys (Object (\"foo\")) !== [0, 1, 2, \"length\"]);\nassert (Reflect.ownKeys (Object (true)) !== []);\n\nvar id = Symbol(\"my kitten\");\nvar user = {\n  name: \"Bob\",\n  age:  30,\n  [id]: \"is batcat\"\n}\n\nassert (Reflect.ownKeys (user)[0] === \"name\");\nassert (Reflect.ownKeys (user)[1] === \"age\");\nassert (Reflect.ownKeys (user)[2] === id);\n"
  },
  {
    "path": "tests/jerry/reflect-preventextensions.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar object1 = {};\n\nassert (Reflect['isExtensible'](object1) === true);\n\nReflect.preventExtensions(object1);\nassert (Reflect['isExtensible'](object1) === false);\n"
  },
  {
    "path": "tests/jerry/reflect-set.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2014 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nvar object = {};\nReflect.set (object, 'property', 'batcat');\n\nassert (object.property === 'batcat');\n\nvar array = ['cat', 'cat', 'cat'];\nReflect.set (array, 2, 'bat');\n\nassert (array[2] === 'bat');\n\nassert (3 === Reflect.set.length);\n\ntry {\n  Reflect.set ();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.set (42, 'bat');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Reflect.set (null, 'bat');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar target = {};\nvar a = { [Symbol.toPrimitive]: function () { return 'bat' } };\nvar b = { [Symbol.toPrimitive]: function () { throw 'cat' } };\nassert (Reflect.set (target, a, 42) === true);\nassert (42 === target.bat);\n\ntry {\n  Reflect.set (null, 'bat');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar y = [];\nObject.defineProperty (y, 0, {value: 42, configurable: false});\nassert (Reflect.set (y, 'length', 0) === false);\nassert (Reflect.set (y, 'length', 2) === true);\n"
  },
  {
    "path": "tests/jerry/reflect-setPrototypeOf.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar object1 = {};\n\nassert(Reflect.setPrototypeOf(object1, Object.prototype) === true);\nassert(Reflect.setPrototypeOf(object1, null) === true);\n\nvar object2 = {};\nassert(Reflect.setPrototypeOf(Object.freeze(object2), null) === false);\n"
  },
  {
    "path": "tests/jerry/regexp-accessors-descriptors.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar accessors = [ 'flags', 'global', 'ignoreCase', 'multiline', 'source', 'sticky', 'unicode' ]\n\naccessors.forEach(function(attr) {\n    var desc = Object.getOwnPropertyDescriptor(RegExp.prototype, attr);\n    assert(typeof desc.get === 'function')\n    assert(desc.set === undefined)\n    assert(desc.enumerable === false)\n    assert(desc.configurable === true)\n});\n"
  },
  {
    "path": "tests/jerry/regexp-alternatives.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r;\n\nr = new RegExp (\"a|b\");\nassert (r.exec(\"a\") == \"a\");\n\nr = new RegExp (\"a|b\");\nassert (r.exec(\"b\") == \"b\");\n\nr = new RegExp (\"a|b|c\");\nassert (r.exec(\"b\") == \"b\");\n\nr = new RegExp (\"a|b|c\");\nassert (r.exec(\"c\") == \"c\");\n\nr = new RegExp (\"a|b|c|d\");\nassert (r.exec(\"\") == undefined);\n\nr = new RegExp (\"a|b|c|d\");\nassert (r.exec(\"a\") == \"a\");\n\nr = new RegExp (\"a|b|c|d\");\nassert (r.exec(\"b\") == \"b\");\n\nr = new RegExp (\"a|b|c|d\");\nassert (r.exec(\"c\") == \"c\");\n\nr = new RegExp (\"a|b|c|d\");\nassert (r.exec(\"d\") == \"d\");\n\nr = new RegExp (\"a|bb|c|d\");\nassert (r.exec(\"e\") == undefined);\n\nr = new RegExp (\"a|bb|c|d\");\nassert (r.exec(\"bb\") == \"bb\");\n\nr = new RegExp (\"a|bb|c|d\");\nassert (r.exec(\"bba\") == \"bb\");\n\nr = new RegExp (\"a|bb|c|d\");\nassert (r.exec(\"bbbb\") == \"bb\");\n\nr = new RegExp (\"a|bb|c|d\");\nassert (r.exec(\"a\") == \"a\");\n\nr = new RegExp (\"a|bb|c|d\");\nassert (r.exec(\"b\") == undefined);\n\nr = new RegExp(\"(?:a|b)\\\\b|\\\\.\\\\w+\", \"g\");\nassert (r.exec(\"name.lower()\")[0] === \".lower\")\n"
  },
  {
    "path": "tests/jerry/regexp-assertions.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar t;\n\nt = new RegExp (\"^alma$\").exec(\"alma\");\nassert (t == \"alma\");\n\nt = new RegExp (\"^alma$\").exec(\"almaa\");\nassert (t == undefined);\n\nt = new RegExp (\"^alma$\").exec(\"aalma\");\nassert (t == undefined);\n\nt = new RegExp (\"^alma\").exec(\"alma\");\nassert (t == \"alma\");\n\nt = new RegExp (\"^alma\").exec(\"almaa\");\nassert (t == \"alma\");\n\nt = new RegExp (\"^alma\").exec(\"aalma\");\nassert (t == undefined);\n\nt = new RegExp (\"alma$\").exec(\"alma\");\nassert (t == \"alma\");\n\nt = new RegExp (\"alma$\").exec(\"almaa\");\nassert (t == undefined);\n\nt = new RegExp (\"alma$\").exec(\"aalma\");\nassert (t == \"alma\");\n\nt = new RegExp (\"\\\\bis\\\\b\").exec(\"This island is beautiful\");\nassert (t == \"is\");\n\nt = new RegExp (\"\\\\Bis\\\\B\").exec(\"This island is beautiful\");\nassert (t == undefined);\n\nt = new RegExp (\"\\\\Bis\").exec(\"This island is beautiful\");\nassert (t == \"is\");\n\nt = new RegExp (\"is\\\\B\").exec(\"This island is beautiful\");\nassert (t == \"is\");\n\nt = new RegExp (\"\\\\Bis\\\\b\").exec(\"This island is beautiful\");\nassert (t == \"is\");\n\nt = new RegExp (\"\\\\bis\\\\B\").exec(\"This island is beautiful\");\nassert (t == \"is\");\n\nt = new RegExp (\"al(?=(ma))\").exec(\"al\");\nassert (t == undefined);\n\nt = new RegExp (\"al(?!(ma))\").exec(\"ala\");\nassert (t[0] == \"al\");\nassert (t[1] == undefined);\n\nt = new RegExp (\"al(?=(ma))\").exec(\"alma\");\nassert (t[0] == \"al\");\nassert (t[1] == \"ma\");\n\nt = new RegExp (\"al(?=(ma))\").exec(\"almama\");\nassert (t[0] == \"al\");\nassert (t[1] == \"ma\");\n\nt = new RegExp (\"(al)(?=(ma))ma\").exec(\"al\");\nassert (t == undefined);\n\nt = new RegExp (\"(al)(?=(ma)ma)\").exec(\"al\");\nassert (t == undefined);\n\nt = new RegExp (\"al(?=(ma))*ma\").exec(\"alma\");\nassert (t[0] == \"alma\");\nassert (t[1] == undefined);\n\nt = new RegExp (\"al(?!(ma))*ma\").exec(\"alma\");\nassert (t[0] == \"alma\");\nassert (t[1] == undefined);\n\nt = new RegExp (\"al(?=(ma))ma\").exec(\"alma\");\nassert (t[0] == \"alma\");\nassert (t[1] == \"ma\");\n\nt = new RegExp (\"al(?!(ma))ma\").exec(\"alma\");\nassert (t == undefined);\n\nt = new RegExp (\"(al)(?=(ma))ma\").exec(\"almama\");\nt = new RegExp (\"(al)(?=(ma)ma)\").exec(\"almama\");\n\nt = new RegExp (\"al(?=(ma))ma\").exec(\"almama\");\nassert (t[0] == \"alma\");\nassert (t[1] == \"ma\");\n\nt = new RegExp (\"al(?=(ma)ma)\").exec(\"almama\");\nassert (t[0] == \"al\");\nassert (t[1] == \"ma\");\n\nt = new RegExp (\"al(?!(ma))ma\").exec(\"almama\");\nassert (t == undefined);\n\nt = new RegExp (\"a(?=(a)(a))aab|aaac\").exec(\"aaac\");\nt = new RegExp (\"a(?=(a)(a))aab|aaac\").exec(\"aaab\");\n\nt = new RegExp (\"(?!(a)b)|ab\").exec(\"ab\");\nassert (t[0] == \"ab\");\nassert (t[1] == undefined);\n\nt = new RegExp (\"(?=(a)b)|ab\").exec(\"ab\");\nassert (t[0] == \"\");\nassert (t[1] == \"a\");\n\nt = new RegExp (\"(?=a|.)Dt\").exec(\"Dt\");\nassert (t == \"Dt\");\n\nt = new RegExp (\"(?=.|a)Dt\").exec(\"Dt\");\nassert (t == \"Dt\");\n\nt = new RegExp (\"(?=a|b)Dt\").exec(\"Dt\");\nassert (t == undefined);\n\nt = new RegExp (\"(?=.|P)\").exec(\"a\");\nassert (t == \"\");\n\nt = new RegExp (\"(?=.)\").exec(\"a\");\nassert (t == \"\");\n\nt = new RegExp (\"(?!a|.)Dt\").exec(\"Dt\");\nassert (t == undefined);\n\nt = new RegExp (\"(?!.|a)Dt\").exec(\"Dt\");\nassert (t == undefined);\n\nt = new RegExp (\"(?!a|b)Dt\").exec(\"Dt\");\nassert (t == \"Dt\");\n\nt = new RegExp (\"(?!.|P)\").exec(\"a\");\nassert (t == \"\");\n\nt = new RegExp (\"(?!.)\").exec(\"a\");\nassert (t == \"\");\n\nt = new RegExp (\"abc\",\"g\");\nt.lastIndex = {toString: function () { return \"4\"}};\nvar result = t.exec(\"abc   abc\");\nassert(result[0] === \"abc\");\nassert(result.index === 6);\n\nt = new RegExp (\"abc\",\"g\");\nt.lastIndex = {valueOf: function () { return \"4\"}};\nvar result = t.exec(\"abc   abc\");\nassert(result[0] === \"abc\");\nassert(result.index === 6);\n\nt = new RegExp (\"abc\",\"g\");\nt.lastIndex = \"2\"\nvar result = t.exec(\"abc   abc\");\nassert(result[0] === \"abc\");\nassert(result.index === 6);\n"
  },
  {
    "path": "tests/jerry/regexp-backreference.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r;\n\nr = new RegExp (\"(a)b\\\\1\").exec(\"aba\");\nassert (r[0] == \"aba\");\nassert (r[1] == \"a\");\n\nr = new RegExp (\"(a)b\\\\1\").exec(\"b\");\nassert (r == undefined);\n\nr = new RegExp (\"(a)*b\\\\1\").exec(\"b\");\nassert (r[0] == \"b\");\nassert (r[1] == undefined);\n\nassert (JSON.stringify (/[[]?(a)\\1/.exec(\"aa\")) === '[\"aa\",\"a\"]');\nassert (JSON.stringify (/\\1{2,5}()\\B/.exec(\"asd\")) === '[\"\",\"\"]');\n"
  },
  {
    "path": "tests/jerry/regexp-backtrack.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (JSON.stringify (/(?:(a)*){3,}/.exec(\"aaaab\")) === '[\"aaaa\",null]');\nassert (JSON.stringify (/((a)*){3,}/.exec(\"aaaab\")) === '[\"aaaa\",\"\",null]');\nassert (JSON.stringify (/((a)+){3,}/.exec(\"aaaab\")) === '[\"aaaa\",\"a\",\"a\"]');\nassert (JSON.stringify (/((.)*){3,}/.exec(\"abcd\")) === '[\"abcd\",\"\",null]');\nassert (JSON.stringify (/((.)+){3,}/.exec(\"abcd\")) === '[\"abcd\",\"d\",\"d\"]');\n\nassert (JSON.stringify (/((.){1,2}){1,2}/.exec(\"abc\")) === '[\"abc\",\"c\",\"c\"]');\nassert (JSON.stringify (/(?:(a)*?)asd/.exec(\"aaasd\")) === '[\"aaasd\",\"a\"]');\nassert (JSON.stringify (/(?:(a)*)asd/.exec(\"aaasd\")) === '[\"aaasd\",\"a\"]');\n\nassert (JSON.stringify (/(.)*((a)*|(b)*)/.exec(\"ab\")) === '[\"ab\",\"b\",\"\",null,null]');\nassert (JSON.stringify (/(.)*((x)|(y))+/.exec(\"xy\")) === '[\"xy\",\"x\",\"y\",null,\"y\"]');\nassert (JSON.stringify (/(.)*((y)|(x))+/.exec(\"xy\")) === '[\"xy\",\"x\",\"y\",\"y\",null]');\n\nassert (JSON.stringify (/((?:a)*)/.exec(\"aaaad\")) === '[\"aaaa\",\"aaaa\"]');\nassert (JSON.stringify (/((y)+|x)+/.exec(\"x\")) === '[\"x\",\"x\",null]');\nassert (JSON.stringify (/((?:y)*|x)+/.exec(\"x\")) === '[\"x\",\"x\"]');\nassert (JSON.stringify (/((y)*|x)+/.exec(\"x\")) === '[\"x\",\"x\",null]');\nassert (JSON.stringify (/((y)*|x)*/.exec(\"x\")) === '[\"x\",\"x\",null]');\nassert (JSON.stringify (/(?:(y)*|x)*/.exec(\"x\")) === '[\"x\",null]');\nassert (JSON.stringify (/(?:(y)*|(x))*/.exec(\"x\")) === '[\"x\",null,\"x\"]');\n\nassert (JSON.stringify (/((?:a)*)asd/.exec(\"aaasd\")) === '[\"aaasd\",\"aa\"]');\nassert (JSON.stringify (/((?:a)+)asd/.exec(\"aaasd\")) === '[\"aaasd\",\"aa\"]');\nassert (JSON.stringify (/((?:a)*?)asd/.exec(\"aaasd\")) === '[\"aaasd\",\"aa\"]');\nassert (JSON.stringify (/((?:a)+?)asd/.exec(\"aaasd\")) === '[\"aaasd\",\"aa\"]');\n\nassert (JSON.stringify (/((y)|(z)|(a))*/.exec(\"yazx\")) === '[\"yaz\",\"z\",null,\"z\",null]');\nassert (JSON.stringify (/((y)|(z)|(.))*/.exec(\"yaz\")) === '[\"yaz\",\"z\",null,\"z\",null]');\nassert (JSON.stringify (/((y)*|(z)*|(a)*)*/.exec(\"yazx\")) === '[\"yaz\",\"z\",null,\"z\",null]')\nassert (JSON.stringify (/((y)|(z)|(a))*/.exec(\"yazx\")) === '[\"yaz\",\"z\",null,\"z\",null]')\nassert (JSON.stringify (/(?:(y)|(z)|(a))*/.exec(\"yazx\")) === '[\"yaz\",null,\"z\",null]')\nassert (JSON.stringify (/((y)|(z)|(a))+?/.exec(\"yazx\")) === '[\"y\",\"y\",\"y\",null,null]')\nassert (JSON.stringify (/(?:(y)|(z)|(a))+?/.exec(\"yazx\")) === '[\"y\",\"y\",null,null]')\n\nassert (JSON.stringify (/(?:(x|y)*|z)*/.exec(\"yz\")) === '[\"yz\",null]');\nassert (JSON.stringify (/((x|y)*|z)*/.exec(\"yz\")) == '[\"yz\",\"z\",null]');\nassert (JSON.stringify (/(((x|y)*|(v|w)*|z)*)asd/.exec(\"xyzwvxzasd\")) === '[\"xyzwvxzasd\",\"xyzwvxz\",\"z\",null,null]');\n\nassert (JSON.stringify (/((a)*){1,3}b/.exec(\"ab\")) === '[\"ab\",\"a\",\"a\"]')\nassert (JSON.stringify (/((a)*){2,3}b/.exec(\"ab\")) === '[\"ab\",\"\",null]')\nassert (JSON.stringify (/((a)*){3,3}b/.exec(\"ab\")) === '[\"ab\",\"\",null]')\n\nassert (JSON.stringify (/((a)*){3,}b/.exec(\"aaaab\")) === '[\"aaaab\",\"\",null]');\nassert (JSON.stringify (/((a)*)*b/.exec(\"aaaab\")) === '[\"aaaab\",\"aaaa\",\"a\"]');\n\nassert (JSON.stringify (/((bb?)*)*a/.exec(\"bbba\")) === '[\"bbba\",\"bbb\",\"b\"]');\nassert (JSON.stringify (/((b)*)*a/.exec(\"bbba\")) === '[\"bbba\",\"bbb\",\"b\"]');\n\nassert (JSON.stringify (/(aa|a)a/.exec(\"aa\")) === '[\"aa\",\"a\"]');\nassert (JSON.stringify (/(aa|a)?a/.exec(\"aa\")) === '[\"aa\",\"a\"]');\nassert (JSON.stringify (/(aa|a)+?a/.exec(\"aa\")) === '[\"aa\",\"a\"]');\nassert (JSON.stringify (/(?:aa|a)a/.exec(\"aa\")) === '[\"aa\"]');\nassert (JSON.stringify (/(?:aa|a)?a/.exec(\"aa\")) === '[\"aa\"]');\nassert (JSON.stringify (/(?:aa|a)+?a/.exec(\"aa\")) === '[\"aa\"]');\n\nassert (JSON.stringify (/(aa|a)a/.exec(\"a\")) === 'null');\nassert (JSON.stringify (/(aa|a)?a/.exec(\"a\")) === '[\"a\",null]');\nassert (JSON.stringify (/(aa|a)+?a/.exec(\"a\")) === 'null');\nassert (JSON.stringify (/(?:aa|a)a/.exec(\"a\")) === 'null');\nassert (JSON.stringify (/(?:aa|a)?a/.exec(\"a\")) === '[\"a\"]');\nassert (JSON.stringify (/(?:aa|a)+?a/.exec(\"a\")) === 'null');\n\nassert (JSON.stringify (/a+/.exec(\"aaasd\")) === '[\"aaa\"]');\nassert (JSON.stringify (/a+?/.exec(\"aaasd\")) === '[\"a\"]');\n\nassert (JSON.stringify (/a+sd/.exec(\"aaasd\")) === '[\"aaasd\"]');\nassert (JSON.stringify (/a+?sd/.exec(\"aaasd\")) === '[\"aaasd\"]');\n\nassert (JSON.stringify (/a{2}sd/.exec(\"aaasd\")) === '[\"aasd\"]');\nassert (JSON.stringify (/a{3}sd/.exec(\"aaasd\")) === '[\"aaasd\"]');\n\nassert (JSON.stringify (/(?=a)/.exec(\"a\")) === '[\"\"]');\nassert (JSON.stringify (/(?=a)+/.exec(\"a\")) === '[\"\"]');\nassert (JSON.stringify (/(?=a)*/.exec(\"a\")) === '[\"\"]');\nassert (JSON.stringify (/(?=(a))?/.exec(\"a\")) === '[\"\",null]');\nassert (JSON.stringify (/(?=(a))+?/.exec(\"a\")) === '[\"\",\"a\"]');\nassert (JSON.stringify (/(?=(a))*?/.exec(\"a\")) === '[\"\",null]');\n\nassert (JSON.stringify (/(?!a)/.exec(\"a\")) === '[\"\"]');\nassert (JSON.stringify (/(?!a)+/.exec(\"a\")) === '[\"\"]');\nassert (JSON.stringify (/(?!a)*/.exec(\"a\")) === '[\"\"]');\nassert (JSON.stringify (/(?!(a))?/.exec(\"a\")) === '[\"\",null]');\nassert (JSON.stringify (/(?!(a))+?/.exec(\"a\")) === '[\"\",null]');\nassert (JSON.stringify (/(?!(a))*?/.exec(\"a\")) === '[\"\",null]');\n\nassert (JSON.stringify (/al(?=(ma))*ma/.exec(\"alma\")) === '[\"alma\",null]');\nassert (JSON.stringify (/al(?!(ma))*ma/.exec(\"alma\")) === '[\"alma\",null]');\nassert (JSON.stringify (/al(?=(ma))+ma/.exec(\"alma\")) === '[\"alma\",\"ma\"]');\nassert (JSON.stringify (/al(?!(ma))+ma/.exec(\"alma\")) === 'null');\n\nassert (JSON.stringify (/(?=())x|/.exec(\"asd\")) === '[\"\",null]');\nassert (JSON.stringify (/(?!())x|/.exec(\"asd\")) === '[\"\",null]');\n\nassert (JSON.stringify (/(().*)+.$/.exec(\"abcdefg\")) === '[\"abcdefg\",\"abcdef\",\"\"]');\nassert (JSON.stringify (/(().*)+?.$/.exec(\"abcdefg\")) === '[\"abcdefg\",\"abcdef\",\"\"]');\nassert (JSON.stringify (/(?:().*)+.$/.exec(\"abcdefg\")) === '[\"abcdefg\",\"\"]');\nassert (JSON.stringify (/(?:().*)+?.$/.exec(\"abcdefg\")) === '[\"abcdefg\",\"\"]');\n\nassert (JSON.stringify(/((?=())|.)+^/.exec(\"a\")) === '[\"\",\"\",\"\"]');\nassert (JSON.stringify(/(?:(|\\b\\w+?){2})+$/.exec(\"aaaa\")) === '[\"aaaa\",\"aaaa\"]');\n"
  },
  {
    "path": "tests/jerry/regexp-capture-groups.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r;\n\n// Simple test cases\nr = new RegExp (\"()\");\nassert (r.exec (\"a\") == \",\");\n\nr = new RegExp (\"(a)\");\nassert (r.exec (\"a\") == \"a,a\");\n\nr = new RegExp (\"((a)b)c\");\nassert (r.exec (\"abc\") == \"abc,ab,a\");\n\nr = new RegExp (\"(a)*\");\nassert (r.exec (\"b\")[0] == \"\");\nassert (r.exec (\"b\")[1] == undefined);\nassert (r.exec (\"aaaa\") == \"aaaa,a\");\n\nr = new RegExp (\"(a)+\");\nassert (r.exec (\"aaaa\") == \"aaaa,a\");\n\nr = new RegExp (\"(a){4}\");\nassert (r.exec (\"aaaa\") == \"aaaa,a\");\n\nr = new RegExp (\"(a){1,2}\");\nassert (r.exec (\"a\") == \"a,a\");\nassert (r.exec (\"aa\") == \"aa,a\");\nassert (r.exec (\"aaaa\") == \"aa,a\");\n\nr = new RegExp (\"(a)?\");\nassert (r.exec (\"a\") == \"a,a\");\nassert (r.exec (\"b\")[0] == \"\");\nassert (r.exec (\"b\")[1] == undefined);\n\n// Test greedy iterations\nr = new RegExp (\"(a){1,3}a\");\nassert (r.exec(\"aa\") == \"aa,a\");\n\nr = new RegExp (\"(a){1,3}a\");\nassert (r.exec(\"aaa\") == \"aaa,a\");\n\nr = new RegExp (\"(a){1,3}\");\nassert (r.exec(\"a\") == \"a,a\");\n\nr = new RegExp (\"(a){1,3}\");\nassert (r.exec(\"aaa\") == \"aaa,a\");\n\nr = new RegExp (\"(a){1,3}\");\nassert (r.exec(\"aaaa\") == \"aaa,a\");\n\nr = new RegExp (\"(a){1,5}\");\nassert (r.exec(\"aaaa\") == \"aaaa,a\");\n\nr = new RegExp (\"(a|b){1,2}\");\nassert (r.exec(\"a\") == \"a,a\");\n\nr = new RegExp (\"(a|b){1,3}a\");\nassert (r.exec(\"aaa\") == \"aaa,a\");\n\nr = new RegExp (\"(a|b){1,3}a\");\nassert (r.exec(\"aba\") == \"aba,b\");\n\nr = new RegExp (\"(a|b){1,3}a\");\nassert (r.exec(\"b\") == undefined);\n\nr = new RegExp (\"(a|b){1,3}a\");\nassert (r.exec(\"bbb\") == undefined);\n\nr = new RegExp (\"(a|b){1,3}\");\nassert (r.exec(\"a\") == \"a,a\");\n\nr = new RegExp (\"(a|b){1,3}\");\nassert (r.exec(\"aa\") == \"aa,a\");\n\nr = new RegExp (\"(a|b){1,3}\");\nassert (r.exec(\"aaa\") == \"aaa,a\");\n\nr = new RegExp (\"(a|b){1,3}\");\nassert (r.exec(\"ab\") == \"ab,b\");\n\nr = new RegExp (\"(a|b){1,3}\");\nassert (r.exec(\"aba\") == \"aba,a\");\n\nr = new RegExp (\"(a|b){1,3}\");\nassert (r.exec(\"bab\") == \"bab,b\");\n\nr = new RegExp (\"(a|b){1,3}\");\nassert (r.exec(\"bbb\") == \"bbb,b\");\n\nr = new RegExp (\"(a|b){1,4}a\");\nassert (r.exec(\"bbb\") == undefined);\n\nr = new RegExp (\"(a|b){1,4}\");\nassert (r.exec(\"ab\") == \"ab,b\");\n\nr = new RegExp (\"(a|b){1,4}\");\nassert (r.exec(\"aba\") == \"aba,a\");\n\nr = new RegExp (\"(a|b){1,4}\");\nassert (r.exec(\"bbb\") == \"bbb,b\");\n\nr = new RegExp (\"(a|b){1,5}\");\nassert (r.exec(\"aba\") == \"aba,a\");\n\nr = new RegExp (\"(a|b){1,5}\");\nassert (r.exec(\"abab\") == \"abab,b\");\n\nr = new RegExp (\"(a|b){1,5}\");\nassert (r.exec(\"bbb\") == \"bbb,b\");\n\nr = new RegExp (\"(aba)*\");\nassert (r.exec(\"aaaa\") == \",\");\n\nr = new RegExp (\"(aba)+\");\nassert (r.exec(\"aaaa\") == undefined);\n\nr = new RegExp (\"(a|bb|c|d)\");\nassert (r.exec(\"a\") == \"a,a\");\n\nr = new RegExp (\"(a|b)\");\nassert (r.exec(\"a\") == \"a,a\");\n\nr = new RegExp (\"(a|b)+\");\nassert (r.exec(\"aba\") == \"aba,a\");\n\nr = new RegExp (\"(a|b)\");\nassert (r.exec(\"b\") == \"b,b\");\n\nr = new RegExp (\"(a)\");\nassert (r.exec(\"a\") == \"a,a\");\n\nr = new RegExp (\"(a)*\");\nassert (r.exec(\"a\") == \"a,a\");\n\nr = new RegExp (\"(a)*\");\nassert (r.exec(\"aaaa\") == \"aaaa,a\");\n\nr = new RegExp (\"(a)+\");\nassert (r.exec(\"aaaa\") == \"aaaa,a\");\n\nr = new RegExp (\"(a|aa){0,3}b\");\nassert (r.exec(\"aaaaaab\") == \"aaaaaab,aa\");\n\nr = new RegExp (\"((a){2,3}){4}b\");\nassert (r.exec(\"aaaaaaaab\") == \"aaaaaaaab,aa,a\");\n\n// Test non-greedy iterations\nr = new RegExp (\"(a)+?\");\nassert (r.exec(\"aaaa\") == \"a,a\");\n\nr = new RegExp (\"(a)*?aa\");\nassert (r.exec(\"aaaa\") == \"aa,\");\n\nr = new RegExp (\"(aaa|aa)*?aa\");\nassert (r.exec(\"aaaa\")[0] == \"aa\");\nassert (r.exec(\"aaaa\")[1] == undefined);\n\nr = new RegExp (\"(a)??aa\");\nassert (r.exec(\"aaaa\")[0] == \"aa\");\nassert (r.exec(\"aaaa\")[1] == undefined);\n\nr = new RegExp (\"(a)?aa\");\nassert (r.exec(\"aaaa\") == \"aaa,a\");\n\nr = new RegExp (\"(()*?)*?a\");\nassert (r.exec(\"ba\")[0] == \"a\");\nassert (r.exec(\"ba\")[1] == undefined);\nassert (r.exec(\"ba\")[2] == undefined);\n\nr = new RegExp (\"((bb?)*)*a\");\nassert (r.exec(\"bbba\") == \"bbba,bbb,b\");\n\nr = new RegExp (\"((bb?)*)*bbb\\\\Ba\");\nassert (r.exec(\"bbba\")[0] == \"bbba\");\nassert (r.exec(\"bbba\")[1] == undefined);\nassert (r.exec(\"bbba\")[2] == undefined);\n\nr = new RegExp (\"(a??){0,1}a\");\nassert (r.exec(\"aa\") == \"aa,a\");\n\nr = new RegExp (\"(a?){0,1}a\");\nassert (r.exec(\"aa\") == \"aa,a\");\n\nr = new RegExp (\"(a{0,1}?){0,1}a\");\nassert (r.exec(\"aa\") == \"aa,a\");\n\nr = new RegExp (\"(|.)+\");\nassert (JSON.stringify (r.exec(\"asdfgh\")) === '[\"asdfgh\",\"h\"]');\n\nassert (JSON.stringify (/([^\\W](){8,}?){5}/.exec(\"asdfghijk\")) === '[\"asdfg\",\"g\",\"\"]');\nassert (JSON.stringify (/(()+?(.+)|){3,}./u.exec(\"asdfghi\")) === '[\"asdfghi\",\"\",null,null]')\nassert (JSON.stringify (/(()+?(.+)|){3,}?./u.exec(\"asdfghi\")) === '[\"asdfghi\",\"\",null,null]')\nassert (JSON.stringify (/(?:()+?(.+)|){3,}./u.exec(\"asdfghi\")) === '[\"asdfghi\",null,null]')\nassert (JSON.stringify (/(?:()+?(.+)|){3,}?./u.exec(\"asdfghi\")) === '[\"asdfghi\",null,null]')\n"
  },
  {
    "path": "tests/jerry/regexp-character-class.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r;\n\nr = new RegExp (\"[abc]*\").exec(\"aaabbcccabcacbacabacbacab\");\nassert (r == \"aaabbcccabcacbacabacbacab\");\n\nr = new RegExp (\"[abc]*\").exec(\"aaabbcccabdcacb\");\nassert (r == \"aaabbcccab\");\n\nr = new RegExp (\"[abc]*\").exec(\"defghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"[a-z]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"[A-Z]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"[^a-z]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"[^A-Z]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"\\\\d*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"\\\\D*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"\\\\w*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"\\\\W*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"\\\\s*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"\\\\S*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"[\\\\d]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"[\\\\D]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"[\\\\w]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"[\\\\W]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"[\\\\s]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"[\\\\S]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"[^\\\\d]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"[^\\\\D]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"[^\\\\w]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"[^\\\\W]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"[^\\\\s]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"[^\\\\S]*\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"\");\n\nr = new RegExp (\"\\\\d*\").exec(\"0123456789\");\nassert (r == \"0123456789\");\n\ntry\n{\n  r = new RegExp(\"[\");\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof SyntaxError);\n}\n\ntry\n{\n  r = new RegExp(\"[\\\\\");\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof SyntaxError);\n}\n\nr = new RegExp (\"^[\\\\u0061-\\\\u007a]+$\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"^[\\\\u0061-\\\\u007a]+\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"[\\\\u0061-\\\\u007a]+$\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"^[\\\\x61-\\\\x7a]+$\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"^[\\\\x61-\\\\x7a]+\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp (\"[\\\\x61-\\\\x7a]+$\").exec(\"abcdefghjklmnopqrstuvwxyz\");\nassert (r == \"abcdefghjklmnopqrstuvwxyz\");\n\nr = new RegExp(\"[\\\\u0800-\\\\uffff]\", \"g\");\nassert (r.test (\"\\uffff\"));\nassert (!r.test (\"\\uffff\"));\n\nr = new RegExp(\"[\\0]\");\nassert (r.test (\"\\0\"));\nassert (!r.test (\"0\"));\n\nr = new RegExp(\"[\\0-\\1]\");\nassert (r.test (\"\\1\"));\n"
  },
  {
    "path": "tests/jerry/regexp-construct.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r;\n\nr = new RegExp ();\nassert (r.source == \"(?:)\");\nassert (r.global == false);\nassert (r.ignoreCase == false);\nassert (r.multiline == false);\n\nr = new RegExp (\"a\");\nassert (r.source == \"a\");\nassert (r.global == false);\nassert (r.ignoreCase == false);\nassert (r.multiline == false);\n\nr = new RegExp (\"a\",\"gim\");\nassert (r.source == \"a\");\nassert (r.global == true);\nassert (r.ignoreCase == true);\nassert (r.multiline == true);\n\nr = RegExp (\"a\");\nassert (r.source == \"a\");\nassert (r.global == false);\nassert (r.ignoreCase == false);\nassert (r.multiline == false);\n\nr = RegExp (\"a\",\"gim\");\nassert (r.source == \"a\");\nassert (r.global == true);\nassert (r.ignoreCase == true);\nassert (r.multiline == true);\n\nvar r2;\n\nr2 = RegExp (r);\nassert (r2.source == \"a\");\nassert (r2.global == true);\nassert (r2.ignoreCase == true);\nassert (r2.multiline == true);\n\nr2 = RegExp (r, undefined);\nassert (r2.source == \"a\");\nassert (r2.global == true);\nassert (r2.ignoreCase == true);\nassert (r2.multiline == true);\n\nr = /(?:)/;\nassert (r.source == \"(?:)\");\nassert (r.global == false);\nassert (r.ignoreCase == false);\nassert (r.multiline == false);\n\nr = /a/;\nassert (r.source == \"a\");\nassert (r.global == false);\nassert (r.ignoreCase == false);\nassert (r.multiline == false);\n\nr = /a/gim;\nassert (r.source == \"a\");\nassert (r.global == true);\nassert (r.ignoreCase == true);\nassert (r.multiline == true);\n\n/* The 'undefined' argument for the RegExp constructor should not be converted to string,\n * and it should behave just like when there is no argument.\n */\nr1 = new RegExp();\nr2 = new RegExp(undefined);\nvar foo;\nr3 = new RegExp(foo)\n\nassert (r1.source === r2.source);\nassert (r2.source === r3.source);\n\nr = new RegExp (\"foo\", undefined);\nassert (r.source === \"foo\");\nassert (r.global === false);\nassert (r.ignoreCase === false);\nassert (r.multiline === false);\n\nr = new RegExp (\"foo\", void 0);\nassert (r.source === \"foo\");\nassert (r.global === false);\nassert (r.ignoreCase === false);\nassert (r.multiline === false);\n\ntry {\n  new RegExp (undefined, \"ii\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp (\"\", \"gg\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp (void 0, \"mm\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nr = new RegExp (undefined, undefined);\nassert (r.source == \"(?:)\");\nassert (r.global == false);\nassert (r.ignoreCase == false);\nassert (r.multiline == false);\n\n/* RegExp properties */\nassert (RegExp.length === 2);\n\nvar r = RegExp (\"a\",\"gim\");\nvar r2 = RegExp (r,\"gim\");\nvar r3 = RegExp (r);\n\nassert(r2.source === 'a');\nassert(r2.global === true);\nassert(r2.ignoreCase === true);\nassert(r2.multiline === true);\n\nassert(r3.source === 'a');\nassert(r3.global === true);\nassert(r3.ignoreCase === true);\nassert(r3.multiline === true);\n\nvar obj = { get source() { throw 5 }, [Symbol.match] : true }\n\ntry {\n  new RegExp (obj);\n  assert(false)\n} catch (e) {\n  assert(e === 5);\n}\n\nr = new RegExp (\"a\",\"gimuy\");\nassert (r.global === true);\nassert (r.ignoreCase === true);\nassert (r.multiline === true);\nassert (r.unicode === true);\nassert (r.sticky === true);\n\ntry {\n  new RegExp (\"a\", \"uu\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp (\"a\", \"yy\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regexp-dotAll.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str1 = 'bar\\nexample foo example';\nvar str2 = 'bare\\nxample foo example';\nvar regex_with_dotAll_flag = new RegExp ('bar.example','s');\nvar regex_without_dotAll_flag = new RegExp ('bar.example');\n\n// testing regexp.prototype.dotAll\nassert (regex_with_dotAll_flag.dotAll == true);\nassert (regex_without_dotAll_flag.dotAll == false);\n\n// basic dotAll flag test\nassert (str1.replace (regex_with_dotAll_flag,'') == \" foo example\");\nassert (str1.replace (regex_without_dotAll_flag,'') == str1);\nassert (str2.replace (regex_with_dotAll_flag, \"\") == str2);\n\n// testing dotAll with other flag\nfor (let re of [/^.$/su, /^.$/sum]) {\n  assert (re.test(\"a\"));\n  assert (re.test(\"3\"));\n  assert (re.test(\"π\"));\n  assert (re.test(\"\\u2027\"));\n  assert (re.test(\"\\u0085\"));\n  assert (re.test(\"\\v\"));\n  assert (re.test(\"\\f\"));\n  assert (re.test(\"\\u180E\"));\n  assert (re.test(\"\\u{10300}\"));\n  assert (re.test(\"\\n\"));\n  assert (re.test(\"\\r\"));\n  assert (re.test(\"\\u2028\"));\n  assert (re.test(\"\\u2029\"));\n  assert (re.test(\"\\uD800\"));\n  assert (re.test(\"\\uDFFF\"));\n}\n"
  },
  {
    "path": "tests/jerry/regexp-flags.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r = /[𐲡-𐲱𐲟]/u;\n\nvar m = r.exec(\"𐲬\");\nassert(m !== null);\nassert(m[0] === \"𐲬\");\n\nr = /[𐲡E]/ug;\nassert (r.exec(\"E𐲡E\")[0] === 'E');\nassert (r.exec(\"E𐲡E\")[0] === '𐲡');\nassert (r.exec(\"E𐲡E\")[0] === 'E');\n\ntry {\n  eval(\"/[𐲡-𐲱𐲟]/\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (/\\udc96/.exec(\"\\ud803\\udc96\")[0] === '\\udc96');\nassert (/\\udc96/u.exec(\"\\ud803\\udc96\") === null);\nassert (/\\udc96/u.exec(\"\\udc96\")[0] === '\\udc96');\n\nassert (/\\ud803/.exec(\"\\ud803\\udc96\")[0] === '\\ud803');\nassert (/\\ud803/u.exec(\"\\ud803\\udc96\") === null);\nassert (/\\ud803/u.exec(\"\\ud803\")[0] === '\\ud803');\n\nassert (/./u.exec(\"\\ud803\\udc96\")[0] === '𐲖');\nassert (/./.exec(\"\\ud803\\udc96\")[0] === '\\ud803');\nassert (/./u.exec(\"\\ud803\\ud803\")[0] === '\\ud803');\nassert (/./u.exec(\"\\udc96\\udc96\")[0] === '\\udc96');\nassert (/./u.exec(\"\\ud803\")[0] === '\\ud803');\n\nvar r = /abc/y;\nm = r.exec (\"strabcstr\");\nassert (m === null);\n\nr.lastIndex = 3;\nm = r.exec (\"strabcstr\");\nassert (m[0] === \"abc\");\nassert (r.lastIndex === 6);\n\nm = r.exec (\"strabcstr\");\nassert (m === null);\nassert (r.lastIndex === 0);\n\nvar r = /abc/yg;\nm = r.exec (\"strabcstr\");\nassert (m === null);\n\nassert (RegExp.prototype.flags === \"\");\n\nvar flagsProp = Object.getOwnPropertyDescriptor (RegExp.prototype, \"flags\");\nassert(flagsProp.get.call({}) === '');\n"
  },
  {
    "path": "tests/jerry/regexp-lastindex.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar t = /abc/g;\nt.lastIndex = -12.5;\nresult = t.exec(\"abc   abc\");\nassert(result[0] === \"abc\");\nassert(result.index === 0);\nassert(t.lastIndex === 3);\n\nassert(RegExp.prototype.lastIndex === undefined)\n\nvar r = /./y\nr.lastIndex = -1;\nassert (JSON.stringify(r.exec(\"abca\")) === '[\"a\"]');\nassert (r.lastIndex === 1);\nassert (JSON.stringify(r.exec(\"abca\")) === '[\"b\"]');\nassert (r.lastIndex === 2);\n\nr.lastIndex = 5;\nassert (JSON.stringify(r.exec(\"abca\")) === 'null');\nassert (r.lastIndex === 0);\n\nvar r = /a/y\nassert (JSON.stringify(r.exec(\"abca\")) === '[\"a\"]');\nassert (r.lastIndex === 1);\nassert (JSON.stringify(r.exec(\"abca\")) === 'null');\nassert (r.lastIndex === 0);\n\nvar r = /./g\nr.lastIndex = -1;\nassert (JSON.stringify(r.exec(\"abca\")) === '[\"a\"]');\nassert (r.lastIndex === 1);\nassert (JSON.stringify(r.exec(\"abca\")) === '[\"b\"]');\nassert (r.lastIndex === 2);\n\nr.lastIndex = 5;\nassert (JSON.stringify(r.exec(\"abca\")) === 'null');\nassert (r.lastIndex === 0);\n\nvar r = /a/g\nassert (JSON.stringify(r.exec(\"abca\")) === '[\"a\"]');\nassert (r.lastIndex === 1);\nassert (JSON.stringify(r.exec(\"abca\")) === '[\"a\"]');\nassert (r.lastIndex === 4);\nassert (JSON.stringify(r.exec(\"abca\")) === 'null');\nassert (r.lastIndex === 0);\n\nvar r = /./uim\nr.lastIndex = 2;\nassert (JSON.stringify(r.exec(\"abcd\")) === '[\"a\"]');\nassert (r.lastIndex === 2);\n\nr.lastIndex = \"lastIndex\";\nassert (JSON.stringify(r.exec(\"abcd\")) === '[\"a\"]');\nassert (r.lastIndex === \"lastIndex\");\n"
  },
  {
    "path": "tests/jerry/regexp-literal.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar t;\n\nt = /\\//.exec(\"/\");\nassert (t == \"/\");\n\nt = /[/]/.exec(\"/\");\nassert (\"a\"+/x/+\"b\" == \"a/x/b\");\n\nt = /\\/\\[[\\]/]/.exec(\"/[/\");\nassert (t == \"/[/\");\n\nt = /\\u0000/.exec(\"\\u0000\");\nassert (t == \"\\u0000\");\n\ntry {\n  eval(\"/\" + String.fromCharCode(\"0x0000\") + \"/\");\n} catch (e) {\n  assert (false);\n}\n\ntry {\n  eval(\"var x = 5\\n\\n/foo/\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\ntry {\n  eval(\"var x = 5;\\n\\n/foo/\");\n} catch (e) {\n  assert(false);\n}\n\ntry {\n  eval(\"for (;false;/abc/.exec(\\\"abc\\\")) {5}\");\n} catch (e) {\n  assert(false);\n}\n\ntry {\n  eval(\"var a = [] /foo/\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\ntry {\n  eval(\"/\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\ntry {\n  eval(\"var x = /aaa/\");\n} catch (e) {\n  assert (false);\n}\n\ntry {\n  eval(\"{}/a/g\");\n} catch (e) {\n  assert (false);\n}\n\ntry {\n  eval(\"var a, g; +{}/a/g\");\n} catch (e) {\n  assert (false);\n}\n"
  },
  {
    "path": "tests/jerry/regexp-new-target.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction F(){}\nvar obj = Reflect.construct(RegExp, [\"baz\",\"g\"], F);\nassert(RegExp.prototype.exec.call(obj, \"foobarbaz\")[0] === \"baz\")\nassert(obj.lastIndex === 9)\nassert(obj instanceof F);\n"
  },
  {
    "path": "tests/jerry/regexp-non-capture-groups.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r;\n\n// Simple test cases\nr = new RegExp (\"(?:)\");\nassert (r.exec (\"a\") == \"\");\n\nr = new RegExp (\"(?:a)\");\nassert (r.exec (\"a\") == \"a\");\n\nr = new RegExp (\"(?:(?:a)b)c\");\nassert (r.exec (\"abc\") == \"abc\");\n\nr = new RegExp (\"(?:a)*\");\nassert (r.exec (\"b\") == \"\");\nassert (r.exec (\"aaaa\") == \"aaaa\");\n\nr = new RegExp (\"(?:a)+\");\nassert (r.exec (\"aaaa\") == \"aaaa\");\n\nr = new RegExp (\"(?:a){4}\");\nassert (r.exec (\"aaaa\") == \"aaaa\");\n\nr = new RegExp (\"(?:a){1,2}\");\nassert (r.exec (\"a\") == \"a\");\nassert (r.exec (\"aa\") == \"aa\");\nassert (r.exec (\"aaaa\") == \"aa\");\n\nr = new RegExp (\"(?:a)?\");\nassert (r.exec (\"a\") == \"a\");\nassert (r.exec (\"b\") == \"\");\n\n// Test greedy iterations\nr = new RegExp (\"(?:a){1,3}a\");\nassert (r.exec (\"aa\") == \"aa\");\n\nr = new RegExp (\"(?:a){1,3}a\");\nassert (r.exec (\"aaa\") == \"aaa\");\n\nr = new RegExp (\"(?:a){1,3}\");\nassert (r.exec (\"a\") == \"a\");\n\nr = new RegExp (\"(?:a){1,3}\");\nassert (r.exec (\"aaa\") == \"aaa\");\n\nr = new RegExp (\"(?:a){1,3}\");\nassert (r.exec (\"aaaa\") == \"aaa\");\n\nr = new RegExp (\"(?:a){1,5}\");\nassert (r.exec (\"aaaa\") == \"aaaa\");\n\nr = new RegExp (\"(?:a|b){1,2}\");\nassert (r.exec (\"a\") == \"a\");\n\nr = new RegExp (\"(?:a|b){1,3}a\");\nassert (r.exec (\"aaa\") == \"aaa\");\n\nr = new RegExp (\"(?:a|b){1,3}a\");\nassert (r.exec (\"aba\") == \"aba\");\n\nr = new RegExp (\"(?:a|b){1,3}a\");\nassert (r.exec (\"b\") == undefined);\n\nr = new RegExp (\"(?:a|b){1,3}a\");\nassert (r.exec (\"bbb\") == undefined);\n\nr = new RegExp (\"(?:a|b){1,3}\");\nassert (r.exec (\"a\") == \"a\");\n\nr = new RegExp (\"(?:a|b){1,3}\");\nassert (r.exec (\"aa\") == \"aa\");\n\nr = new RegExp (\"(?:a|b){1,3}\");\nassert (r.exec (\"aaa\") == \"aaa\");\n\nr = new RegExp (\"(?:a|b){1,3}\");\nassert (r.exec (\"ab\") == \"ab\");\n\nr = new RegExp (\"(?:a|b){1,3}\");\nassert (r.exec (\"aba\") == \"aba\");\n\nr = new RegExp (\"(?:a|b){1,3}\");\nassert (r.exec (\"bab\") == \"bab\");\n\nr = new RegExp (\"(?:a|b){1,3}\");\nassert (r.exec (\"bbb\") == \"bbb\");\n\nr = new RegExp (\"(?:a|b){1,4}a\");\nassert (r.exec (\"bbb\") == undefined);\n\nr = new RegExp (\"(?:a|b){1,4}\");\nassert (r.exec (\"ab\") == \"ab\");\n\nr = new RegExp (\"(?:a|b){1,4}\");\nassert (r.exec (\"aba\") == \"aba\");\n\nr = new RegExp (\"(?:a|b){1,4}\");\nassert (r.exec (\"bbb\") == \"bbb\");\n\nr = new RegExp (\"(?:a|b){1,5}\");\nassert (r.exec (\"abab\") == \"abab\");\n\nr = new RegExp (\"(?:aba)*\");\nassert (r.exec (\"aaaa\") == \"\");\n\nr = new RegExp (\"(?:aba)+\");\nassert (r.exec (\"aaaa\") == undefined);\n\nr = new RegExp (\"(?:a|bb|c|d)\");\nassert (r.exec (\"a\") == \"a\");\n\nr = new RegExp (\"(?:a|b|c|d)\");\nassert (r.exec (\"\") == undefined);\n\nr = new RegExp (\"(?:a|b|c|d)\");\nassert (r.exec (\"a\") == \"a\");\n\nr = new RegExp (\"(?:a|b|c|d)\");\nassert (r.exec (\"b\") == \"b\");\n\nr = new RegExp (\"(?:a|b|c|d)\");\nassert (r.exec (\"c\") == \"c\");\n\nr = new RegExp (\"(?:a|b|c|d)\");\nassert (r.exec (\"d\") == \"d\");\n\nr = new RegExp (\"(?:a|b)+\");\nassert (r.exec (\"aba\") == \"aba\");\n\nr = new RegExp (\"(?:a|b)\");\nassert (r.exec (\"b\") == \"b\");\n\nr = new RegExp (\"(?:a)\");\nassert (r.exec (\"a\") == \"a\");\n\nr = new RegExp (\"(?:a)*\");\nassert (r.exec (\"a\") == \"a\");\n\nr = new RegExp (\"(?:a)*\");\nassert (r.exec (\"aaaa\") == \"aaaa\");\n\nr = new RegExp (\"(?:a)+\");\nassert (r.exec (\"aaaa\") == \"aaaa\");\n\nr = new RegExp (\"(?:a)?aa\");\nassert (r.exec (\"aaaa\") == \"aaa\");\n\nr = new RegExp (\"(?:a?){0,1}a\");\nassert (r.exec (\"aa\") == \"aa\");\n\nr = new RegExp (\"(?:a|aa){0,3}b\");\nassert (r.exec (\"aaaaaab\") == \"aaaaaab\");\n\nr = new RegExp (\"(?:(?:a){2,3}){4}b\");\nassert (r.exec (\"aaaaaaaab\") == \"aaaaaaaab\");\n\n// Test non-greedy iterations\nr = new RegExp (\"(?:a)+?\");\nassert (r.exec (\"aaaa\") == \"a\");\n\nr = new RegExp (\"(?:a)*?aa\");\nassert (r.exec (\"aaaa\") == \"aa\");\n\nr = new RegExp (\"(?:aaa|aa)*?aa\");\nassert (r.exec (\"aaaa\") == \"aa\");\n\nr = new RegExp (\"(?:a)??aa\");\nassert (r.exec (\"aaaa\") == \"aa\");\n\nr = new RegExp (\"(?:(?:)*?)*?a\");\nassert (r.exec (\"ba\") == \"a\");\n\nr = new RegExp (\"(?:(?:bb?)*)*a\");\nassert (r.exec (\"bbba\") == \"bbba\");\n\nr = new RegExp (\"(?:(?:bb?)*)*bbb\\\\Ba\");\nassert (r.exec (\"bbba\") == \"bbba\");\n\nr = new RegExp (\"(?:a??){0,1}a\");\nassert (r.exec (\"aa\") == \"aa\");\n\nr = new RegExp (\"(?:a{0,1}?){0,1}a\");\nassert (r.exec (\"aa\") == \"aa\");\n"
  },
  {
    "path": "tests/jerry/regexp-prototype-match-all.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(RegExp.prototype[Symbol.matchAll].length === 1);\nvar desc = Object.getOwnPropertyDescriptor(RegExp.prototype[Symbol.matchAll], \"length\");\nassert(!desc.enumerable);\nassert(!desc.writable);\nassert(desc.configurable);\n\nassert(RegExp.prototype[Symbol.matchAll].name === \"[Symbol.matchAll]\");\nvar desc = Object.getOwnPropertyDescriptor(RegExp.prototype[Symbol.matchAll], \"name\");\nassert(!desc.enumerable);\nassert(!desc.writable);\nassert(desc.configurable);\n\n// test basic functionality\nvar re = /[0-9]+/g;\nvar str = '2016-01-02';\nvar result = re[Symbol.matchAll](str);\nassert(Array.from(result, x => x[0]).toString() === \"2016,01,02\");\n\nclass MyRegExp extends RegExp {\n  [Symbol.matchAll](str) {\n    const result = RegExp.prototype[Symbol.matchAll].call(this, str);\n    if (!result) {\n      return null;\n    }\n    return Array.from(result);\n  }\n}\n  \nvar regexp = new MyRegExp('-[0-9]+', 'g');\nvar result = re[Symbol.matchAll](\"2016-01-02|2019-03-07\");\nassert(Array.from(result, x => x[0]).toString() === \"2016,01,02,2019,03,07\");\n\nvar counter = 0;\nvar callArgs;\nvar regexp = /\\d/u;\nregexp.constructor = {\n  [Symbol.species]: function(){\n    counter++;\n    callArgs = arguments;\n    return /\\w/g;\n  }\n};\n\nvar str = 'a*b';\nvar result = regexp[Symbol.matchAll](str);\n\nassert(counter === 1);\nassert(callArgs.length === 2);\nassert(callArgs[0] === regexp);\nassert(callArgs[1] === 'u');\nassert(Array.from(result, x => x[0]).toString() === \"a\");\n\n// test when flags throws error\nvar regexp = /a/g;\nObject.defineProperty(regexp, 'flags', { get () { throw 42; }});\n\ntry {\n  regexp[Symbol.matchAll](\"foo\");\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test when flags value is symbol\nvar regexp = /a/g;\nvar sym = Symbol(\"foo\")\nObject.defineProperty(regexp, 'flags', { value: sym });\n\ntry {\n  regexp[Symbol.matchAll](\"foo\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when match Symbol throws error\nvar regexp = /[A-Z]/g;\nObject.defineProperty (regexp, Symbol.match, { get () { throw 42; }});\n\ntry {\n  regexp[Symbol.matchAll](\"foo\");\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test when can't create RegExp\nvar obj = {\n  toString() {\n     throw 42;\n   }\n};\n\ntry {\n  RegExp.prototype[Symbol.matchAll].call(obj, ''); \n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test when constructor throws error\nvar regexp = /./;\nObject.defineProperty(regexp, 'constructor', {\n  get(){\n    throw 42;\n  }\n});\n\ntry {\n  regexp[Symbol.matchAll](\"foo\");\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test when global flag throws error\nvar regexp = /[A-Z]/;\nObject.defineProperty(regexp, 'global', { get() { throw 42; }});\n\ntry {\n  regexp[Symbol.matchAll]('');\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test when lastIndex throws error\nvar regexp = /[A-Z]/;\nregexp.lastIndex = {\n  valueOf() {\n    throw 42;\n  }\n};\n\ntry {\n  regexp[Symbol.matchAll](\"foo\");\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test when argument is not an object\ntry {\n  RegExp.prototype[Symbol.matchAll].call(null, '');\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  RegExp.prototype[Symbol.matchAll].call(true, '');\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  RegExp.prototype[Symbol.matchAll].call('', '');\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  RegExp.prototype[Symbol.matchAll].call(Symbol(), '');\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  RegExp.prototype[Symbol.matchAll].call(1, '');\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regexp-prototype-match.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar regexp = /[0-9]+/g;\nvar str = '2016-01-02';\nvar num = 12131233;\n\n// Test with string input\nvar result = regexp[Symbol.match](str);\nassert(result.toString() === \"2016,01,02\");\n\nregexp = /[0-5]+/g;\nresult = regexp[Symbol.match](str);\nassert(result.toString() === \"201,01,02\");\n\nregexp = /[0-1]+/g;\nresult = regexp[Symbol.match](str);\nassert(result.toString() === \"01,01,0\");\n\nregexp = /([0-9]+)-([0-9]+)-([0-9]+)/g\nresult = regexp[Symbol.match](str);\nassert(result.toString() === \"2016-01-02\");\n\n// Test with number input\nregexp = /[0-9]+/g;\nresult = regexp[Symbol.match](num);\nassert(result.toString() === \"12131233\");\n\n// Test with empty string\nresult = regexp[Symbol.match]('');\nassert(result === null);\n\n// Test with undefined\nresult = regexp[Symbol.match](undefined);\nassert(result === null);\n\n// Test when input is not a regexp\nregexp = 12;\n\ntry {\n  result = regexp[Symbol.match](str);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Test with RegExp subclass where we override the [Symbol.match] function\nclass RegExpSub extends RegExp {\n  [Symbol.match](str) {\n    var result = RegExp.prototype[Symbol.match].call(this, str);\n    if (result) {\n      return \"VALID\";\n    }\n    else\n    {\n      return \"INVALID\";\n    }\n  }\n}\n\nvar regexp1 = new RegExpSub('([0-9]+)-([0-9]+)-([0-9]+)');\nresult = regexp1[Symbol.match](str);\nassert(result === \"VALID\");\n\nvar o = {\n  lastIndex: 0,\n  global: true,\n  exec: function () {\n    if (this.lastIndex === 0)\n    {\n      this.lastIndex = 1;\n      return {0: 3.14, index: 2};\n    }\n\n    return null;\n  }\n}\n\nvar result = RegExp.prototype[Symbol.match].call(o, \"asd\");\nassert(result.length === 1);\nassert(typeof result[0] === \"string\");\nassert(result[0] === \"3.14\");\n"
  },
  {
    "path": "tests/jerry/regexp-prototype-source.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar regexp = /fooBar/ig;\nassert(regexp.source === 'fooBar');\n\nassert(new RegExp().source === '(?:)');\n\nassert(new RegExp('/foo/').source === '\\\\/foo\\\\/');\nassert(new RegExp('/foo/').source.length === 7);\n\nassert(new RegExp('bar', 'ug').source === 'bar');\n\nassert(new RegExp('/\\?/').source === '\\\\/?\\\\/');\nassert(new RegExp('/\\?/').source.length === 5);\n\nassert(new RegExp('\\n').source === '\\\\n');\n\nassert(new RegExp('\\r').source === '\\\\r');\n\nassert(new RegExp('\\u2028').source === '\\\\u2028');\n\nassert(new RegExp('\\u2029').source === '\\\\u2029');\n\nassert(new RegExp('/\\n/').source === '\\\\/\\\\n\\\\/');\nassert(new RegExp('/\\n/').source.length === 6);\n\nassert(new RegExp(/\\/\\//).source === '\\\\/\\\\/');\nassert(new RegExp(/\\?\\//g).source === '\\\\?\\\\/');\n\nassert (RegExp.prototype.source === '(?:)')\n\nvar sourceProp = Object.getOwnPropertyDescriptor (RegExp.prototype, \"source\");\ntry {\n  sourceProp.get.call({});\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regexp-prototype-split.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nresult = /./[Symbol.split]('string', -13);\nassert(result.length === 7);\n\nresult = /./[Symbol.split]('string', 2);\nassert(result.length === 2);\n"
  },
  {
    "path": "tests/jerry/regexp-prototype-test.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = 'something interesting';\nvar regexp = new RegExp('o*');\nObject.defineProperty(regexp, 'exec', { 'get':  function () {throw 42}});\n\ntry {\n  regexp.test(str);\n  assert(false);\n} catch (e) {\n  assert(e === 42);  \n}\n"
  },
  {
    "path": "tests/jerry/regexp-routines.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r;\n\nr = new RegExp (\"a\");\nassert (r.exec (\"a\") == \"a\");\nassert (r.exec (\"b\") == null);\ntry {\n  r.exec.call({}, \"a\");\n  assert (false)\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nassert (r.test (\"a\") == true);\nassert (r.test (\"b\") == false);\ntry {\n  r.test.call({}, \"a\");\n  assert (false)\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nr = new RegExp (\"a\", \"mig\");\nassert (r.toString () == \"/a/gim\");\n\n/* Test continous calls to the exec method to see how does the match\n * updates the lastIndex propertyand see if the match restarts.\n */\nvar re = new RegExp(\"a\", \"g\");\nresult = re.exec(\"a\");\nassert (result.length === 1);\nassert (result[0] === \"a\");\nassert (re.lastIndex === 1);\n\nassert (re.exec(\"a\") === null);\nassert (re.lastIndex === 0);\n\nresult = re.exec(\"a\");\nassert (result.length === 1);\nassert (result[0] === \"a\");\nassert (re.lastIndex === 1);\n\nvar re1 = /foo/gim;\nvar re2 = /bar/g;\n\ntry {\n  re2.compile(\"asd\", \"ggim\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n  assert (re2 == \"/bar/g\");\n}\n\ntry {\n  re2.compile(\"[\", undefined);\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n  assert (re2 == \"/bar/g\");\n}\n\ntry {\n  re2.compile(re1, \"im\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n  assert (re2 == \"/bar/g\");\n}\n\nre2.lastIndex = 2;\nassert (re2.compile(\"asd\", \"im\") === re2);\n\nassert (re2 == \"/asd/im\");\nassert (re2.global === false);\nassert (re2.ignoreCase === true);\nassert (re2.multiline === true);\nassert (re2.source === \"asd\");\nassert (re2.lastIndex === 0);\n\nassert (re2.compile(re1) === re2);\nassert (re2.toString() === re1.toString());\nassert (re2.global === re1.global);\nassert (re2.ignoreCase === re1.ignoreCase);\nassert (re2.multiline === re1.multiline);\nassert (re2.source === re1.source);\nassert (re2.lastIndex === 0);\n\nvar r = /./\nr.lastIndex = {\n  valueOf: function() {\n    throw \"abrupt lastIndex\"\n  }\n}\n\ntry {\n  r.exec(\"a\");\n  assert(false);\n} catch (e) {\n  assert (e === \"abrupt lastIndex\");\n}\n\n\nvar r = new RegExp('a', 'gimuy');\nassert (r.flags === 'gimuy');\nassert (r.toString() === '/a/gimuy');\n\ntry {\n  Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call(42);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar o = {\n  global: true,\n  unicode: true,\n  sticky: true,\n  source: \"str\"\n}\n\nObject.defineProperty(o, 'flags', Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags'));\nassert(o.flags === \"guy\");\nassert (RegExp.prototype.toString.call (o) === \"/str/guy\");\n\nObject.defineProperty(o, 'multiline', { 'get': function () {throw \"abrupt flag get\"; }});\ntry {\n  o.flags\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt flag get\");\n}\n\ntry {\n  RegExp.prototype.toString.call(42);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (RegExp.prototype.toString.call({}) === \"/undefined/undefined\");\n\nvar o = {};\nObject.defineProperty (o, 'source', { 'get' : function () {throw \"abrupt source get\"; } });\ntry {\n  RegExp.prototype.toString.call(o);\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt source get\");\n}\n\nvar o = {source: {toString: function() {throw \"abrupt source toString\";}}};\ntry {\n  RegExp.prototype.toString.call(o);\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt source toString\");\n}\n\nvar o = {source: \"str\"};\nObject.defineProperty (o, 'flags', { 'get' : function () {throw \"abrupt flags get\"; } });\ntry {\n  RegExp.prototype.toString.call(o);\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt flags get\");\n}\n\nvar o = {source: \"str\", flags: {toString: function() {throw \"abrupt flags toString\";}}};\ntry {\n  RegExp.prototype.toString.call(o);\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt flags toString\");\n}\n\nvar o = {\n  global: true,\n  source: \"str\"\n}\n\nObject.defineProperty(o, 'unicode', { 'get': function () {throw \"abrupt unicode get\"; }});\ntry {\n  RegExp.prototype[Symbol.match].call(o, \"str\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt unicode get\");\n}\n\nassert (\"str𐲡fgh\".replace(/(?:)/gu, \"x\") === 'xsxtxrx𐲡xfxgxhx');\nassert (\"str𐲡fgh\".replace(/(?:)/g, \"x\") === 'xsxtxrx\\ud803x\\udca1xfxgxhx');\n\nr = /(?:)/gu;\n/* Disable fast path. */\nr.exec = function (s) { return RegExp.prototype.exec.call(this, s); };\n\nassert (\"str𐲡fgh\".replace(r, \"x\") === 'xsxtxrx𐲡xfxgxhx');\nObject.defineProperty(r, 'unicode', {value: false});\nassert (\"str𐲡fgh\".replace(r, \"x\") === 'xsxtxrx\\ud803x\\udca1xfxgxhx');\n\nr = /(?:)/gu;\nassert (RegExp.prototype[Symbol.match].call(r, \"str𐲡fgh\").length === 8);\nObject.defineProperty(r, 'unicode', {value: false});\nassert (RegExp.prototype[Symbol.match].call(r, \"str𐲡fgh\").length === 9);\n\nr = /(?:)/gy;\nr.lastIndex = 2;\nassert (\"asd\".replace(r, \"x\") === \"xaxsxdx\");\nassert (r.lastIndex === 0);\n\nr.lastIndex = 5;\nassert (\"asd\".replace(r, \"x\") === \"xaxsxdx\");\nassert (r.lastIndex === 0);\n\nr = /(?:)/y;\nr.lastIndex = 2;\nassert (\"asd\".replace(r, \"x\") === \"asxd\");\nassert (r.lastIndex === 2);\n\nr.lastIndex = 5;\nassert (\"asd\".replace(r, \"x\") === \"asd\");\nassert (r.lastIndex === 0);\n\nr.lastIndex = 2;\n/* Disable fast path. */\nr.exec = function (s) { return RegExp.prototype.exec.call(this, s); };\nassert (\"asd\".replace(r, \"x\") === \"asxd\");\nassert (r.lastIndex === 2);\n\nr.lastIndex = 5;\nassert (\"asd\".replace(r, \"x\") === \"asd\");\nassert (r.lastIndex === 0);\n\nassert (RegExp.prototype[Symbol.match].call(/a/y, \"aaa\").length === 1);\nassert (RegExp.prototype[Symbol.match].call(/a/gy, \"aaa\").length === 3);\n\nvar length = Object.getOwnPropertyDescriptor(RegExp.prototype.compile, \"length\");\nassert(!length.enumerable);\nassert(!length.writable);\nassert(length.configurable);\nassert(length.value === 2);\n\nvar re = /./;\nre.lastIndex = 23;\n\ntry {\n  re.compile(re, null);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  re.compile(re, 0);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  re.compile(re, '');\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  re.compile(re, false);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  re.compile(re, {});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  re.compile(re, []);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(re.lastIndex === 23);\n\nvar subject = /initial/;\nObject.defineProperty(subject, 'lastIndex', { value: 45, writable: false });\n\ntry {\n  subject.compile(/updated/gi);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(subject.toString() === new RegExp('updated', 'gi').toString());\nassert(subject.lastIndex === 45);\n"
  },
  {
    "path": "tests/jerry/regexp-simple-atom-and-iterations.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r;\n\nr = new RegExp (\"a\");\nassert (r.exec (\"a\") == \"a\");\nassert (r.exec (\"b\") == undefined);\n\nr = new RegExp (\"abc\");\nassert (r.exec (\"abc\") == \"abc\");\n\nr = new RegExp (\"a*\");\nassert (r.exec (\"aaa\") == \"aaa\");\nassert (r.exec (\"b\") == \"\");\n\nr = new RegExp (\"a+\");\nassert (r.exec (\"aaa\") == \"aaa\");\nassert (r.exec (\"b\") == undefined);\n\nr = new RegExp (\"ab*\");\nassert (r.exec (\"a\") == \"a\");\nassert (r.exec (\"ab\") == \"ab\");\nassert (r.exec (\"abbbb\") == \"abbbb\");\nassert (r.exec (\"bbb\") == undefined);\n\nr = new RegExp (\"a?\");\nassert (r.exec (\"a\") == \"a\");\nassert (r.exec (\"b\") == \"\");\n\nr = new RegExp (\"a{4}\");\nassert (r.exec (\"aaa\") == undefined);\nassert (r.exec (\"aaaaa\") == \"aaaa\");\nassert (r.exec (\"aaaa\") == \"aaaa\");\n\nr = new RegExp (\"a{2,6}\");\nassert (r.exec (\"a\") == undefined);\nassert (r.exec (\"aa\") == \"aa\");\nassert (r.exec (\"aaaaaa\") == \"aaaaaa\");\nassert (r.exec (\"aaaaaaa\") == \"aaaaaa\");\n\nr = new RegExp (\".*\");\nassert (r.exec (\"abcdefghijkl\") == \"abcdefghijkl\");\n\nr = /\\n/;\nassert (r.exec (\"\\n\") == \"\\n\");\n\nassert (/[\\12]+/.exec (\"1\\n\\n\\n\\n\\n2\") == \"\\n\\n\\n\\n\\n\");\nassert (/[\\1284]+/.exec (\"1\\n\\n8\\n4\\n\\n2\") == \"\\n\\n8\\n4\\n\\n\");\nassert (/[\\89]12/.exec (\"1\\9128123\") == \"912\");\nassert (/[\\11]/.exec (\"1\\n\\n\\t\\n\\n2\") == \"\\t\");\nassert (/[\\142][\\143][\\144]/.exec (\"abcde\") == \"bcd\");\n\nassert (/\\12+/.exec (\"1\\n\\n\\n\\n\\n2\") == \"\\n\\n\\n\\n\\n\");\nassert (/\\11/.exec (\"1\\n\\n\\t\\n\\n2\") == \"\\t\");\nassert (/\\142\\143\\144/.exec (\"abcde\") == \"bcd\");\nassert (/\\942\\143\\144/.exec (\"a942cde\") == \"942cd\");\nassert (/\\14234/.exec (\"b34\") == \"b34\");\n\nassert (/(\\d+)\\2([abc]+)\\1\\2/.exec(\"123abc123abc\") == \"123abc123abc,123,abc\");\nassert (/([abc]+)\\40([d-f]+)\\12\\1/.exec(\"abc def\\nabc\") == \"abc def\\nabc,abc,def\");\n\nvar expected = \"8765432911,8,7,6,5,4,3,2,9,1\";\nassert (/(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)\\9(\\d)\\9/.exec(\"8765432911\") == expected);\n\nr = /\\c/;\nassert (r.exec (\"\\\\c\") == \"\\\\c\");\n\nr = /[\\c]/;\nassert (r.exec (\"c\") == \"c\");\n\nr = /[\\c1]/;\nassert (r.exec (\"\\u0011\") == \"\\u0011\");\n\nr = /\\c3/;\nassert (r.exec (\"\\\\c3\") == \"\\\\c3\");\n\nr = /\\cIasd/;\nassert (r.exec (\"\\tasd\") == \"\\tasd\");\n\nr = /.??$/;\nassert (JSON.stringify (r.exec(\"asd\")) === '[\"d\"]');\n"
  },
  {
    "path": "tests/jerry/regexp-unicode.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar result = /\\0/.exec(\"\\u0000\");\nassert (result !== null);\nassert (result[0] === \"\\u0000\");\n\nresult = /\\0/u.exec(\"\\u0000\");\nassert (result !== null);\nassert (result[0] === \"\\u0000\");\n\nresult = /\\000/.exec(\"\\u0000\");\nassert (result !== null);\nassert (result[0] === \"\\u0000\");\n\ntry {\n  new RegExp(\"\\\\000\", 'u').exec(\"\\u0000\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nresult = /\\0000/.exec(\"\\u0000\\u0030\");\nassert (result !== null);\nassert (result[0] === \"\\u0000\\u0030\");\n\nresult = /\\377/.exec(\"\\u00ff\");\nassert (result !== null);\nassert (result[0] === \"\\u00ff\");\n\ntry {\n  new RegExp(\"\\\\377\", 'u').exec(\"\\u00ff\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nresult = /\\3777/.exec(\"\\u00ff\\u0037\");\nassert (result !== null);\nassert (result[0] === \"\\u00ff\\u0037\");\n\ntry {\n  new RegExp(\"\\\\3777\", 'u').exec(\"\\u00ff\\u0037\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nresult = /\\400/.exec(\"\\u0020\\u0030\");\nassert (result !== null);\nassert (result[0] === \"\\u0020\\u0030\");\n\ntry {\n  new RegExp(\"\\\\400\", 'u').exec(\"\\u0020\\u0030\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nresult = /(\\1)/.exec(\"\\u0001\");\nassert (result !== null);\nassert (result[0].length === 0);\n\nresult = /(\\1)/u.exec(\"\\u0001\");\nassert (result !== null);\nassert (result[0].length === 0);\n\nresult = /(\\2)/.exec(\"\\u0002\");\nassert (result !== null);\nassert (result[0] === '\\u0002');\n\ntry {\n  new RegExp(\"(\\\\2)\", 'u').exec(\"\\u0002\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nresult = /\\8/.exec(\"\\u0038\");\nassert (result !== null);\nassert (result[0] === '8');\n\nresult = /\\99/.exec(\"\\u0039\\u0039\");\nassert (result !== null);\nassert (result[0] === \"99\");\n\n// CharClassEscape\nassert (/\\d+/.exec(\"123\")[0] === \"123\");\nassert (/\\D+/.exec(\"abc\")[0] === \"abc\");\nassert (/\\s+/.exec(\"   \")[0] === \"   \");\nassert (/\\S+/.exec(\"abc\")[0] === \"abc\");\nassert (/\\w+/.exec(\"abc\")[0] === \"abc\");\nassert (/\\W+/.exec(\"|||\")[0] === \"|||\");\nassert (/\\d+/u.exec(\"123\")[0] === \"123\");\nassert (/\\D+/u.exec(\"abc\")[0] === \"abc\");\nassert (/\\s+/u.exec(\"   \")[0] === \"   \");\nassert (/\\S+/u.exec(\"abc\")[0] === \"abc\");\nassert (/\\w+/u.exec(\"abc\")[0] === \"abc\");\nassert (/\\W+/u.exec(\"|||\")[0] === \"|||\");\n\nassert (/\\d+/u.exec(\"\\u{10CAF}\") === null);\nassert (/\\D+/u.exec(\"\\u{10CAF}\")[0] === \"\\u{10CAF}\");\nassert (/\\s+/u.exec(\"\\u{10CAF}\") === null);\nassert (/\\S+/u.exec(\"\\u{10CAF}\")[0] === \"\\u{10CAF}\");\nassert (/\\w+/u.exec(\"\\u{10CAF}\") === null);\nassert (/\\W+/u.exec(\"\\u{10CAF}\")[0] === \"\\u{10CAF}\");\n\nresult = /\\xz/.exec(\"xz\");\nassert (result !== null);\nassert (result[0] === \"xz\");\n\ntry {\n  new RegExp(\"\\\\xz\", \"u\").exec(\"xz\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nresult = /\\c/.exec(\"\\\\c\");\nassert (result !== null);\nassert (result[0] === \"\\\\c\");\n\ntry {\n  new RegExp(\"\\\\c\", 'u').exec(\"\\\\c\")\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nresult = /\\c1/.exec(\"\\\\c1\");\nassert (result !== null);\nassert (result[0] === \"\\\\c1\");\n\ntry {\n  new RegExp(\"\\\\c1\", 'u').exec(\"\\\\c1\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp(\"^+\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp(\"$+\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp(\"\\\\b+\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp(\"\\\\B+\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (/[\\b]/.exec(\"\\u0008\")[0] === \"\\u0008\");\nassert (/[\\b]/u.exec(\"\\u0008\")[0] === \"\\u0008\");\nassert (/[\\B]/.exec(\"\\u0042\")[0] === \"\\u0042\");\n\ntry {\n  new RegExp (\"[\\\\B]\", 'u').exec(\"\\u0042\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (/[\\c1]/.exec(\"\\u0011\")[0] === \"\\u0011\");\nassert (/[\\c_]/.exec(\"\\u001f\")[0] === \"\\u001f\");\nassert (/[\\c]/.exec(\"\\\\\")[0] === \"\\\\\");\nassert (/[\\c]/.exec(\"c\")[0] === \"c\");\n\ntry {\n  new RegExp(\"[\\\\c1]\", 'u');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp(\"[\\\\c]\", 'u');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp(\"[\\\\c_]\", 'u');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (/{{1,2}/.exec(\"{{\")[0] === \"{{\");\n\ntry {\n  new RegExp(\"{{1,2}\", 'u').exec(\"{{\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (/a{1,2/.exec(\"a{1,2\")[0] === \"a{1,2\");\n\ntry {\n  new RegExp(\"a{1,2\", 'u').exec(\"a{1,2\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (/\\u017f/i.exec(\"s\") === null);\nassert (/\\u017f/ui.exec(\"s\")[0] === \"s\");\n\nassert (/𐲯/.exec(\"𐲯\")[0] === \"𐲯\");\nassert (/𐲯/u.exec(\"𐲯\")[0] === \"𐲯\");\nassert (/𐲯*?/.exec(\"𐲯\")[0] === \"\\ud803\");\nassert (/𐲯*?/u.exec(\"𐲯\")[0] === \"\");\nassert (/𐲯+/.exec(\"𐲯𐲯𐲯\")[0] === \"𐲯\");\nassert (/𐲯+/u.exec(\"𐲯𐲯𐲯\")[0] === \"𐲯𐲯𐲯\");\n\nassert (/\\ud803\\udc96*?/.exec(\"𐲖\")[0] === '\\ud803');\nassert (/\\ud803\\udc96*?/u.exec(\"𐲖\")[0] === '');\nassert (/\\ud803\\udc96+/.exec(\"𐲖𐲖𐲖\")[0] === '𐲖');\nassert (/\\ud803\\udc96+/u.exec(\"𐲖𐲖𐲖\")[0] === '𐲖𐲖𐲖');\n\nassert (/.*𐲗𐲘/u.exec(\"𐲓𐲔𐲕𐲖𐲗𐲘\")[0] === '𐲓𐲔𐲕𐲖𐲗𐲘');\n\nassert (/[\\u{10000}]/.exec(\"\\u{10000}\") === null);\nassert (/[\\u{10000}]/.exec(\"{\")[0] === \"{\");\nassert (/[^\\u{10000}]/.exec(\"\\u{10000}\")[0] === \"\\ud800\");\nassert (/[^\\u{10000}]/.exec(\"{\") === null);\n\nassert (/[\\uffff]/.exec(\"\\uffff\")[0] === \"\\uffff\");\nassert (/[^\\uffff]/.exec(\"\\uffff\") === null);\n\nassert (/[\\u{10000}]/u.exec(\"\\u{10000}\")[0] === \"\\u{10000}\");\nassert (/[\\u{10000}]/u.exec(\"{\") === null);\nassert (/[^\\u{10000}]/u.exec(\"\\u{10000}\") === null);\nassert (/[^\\u{10000}]/u.exec(\"{\")[0] === \"{\");\n\nassert (/[\\uffff]/u.exec(\"\\uffff\")[0] === \"\\uffff\");\nassert (/[^\\uffff]/u.exec(\"\\uffff\") === null);\n\nassert (/a{4294967296,4294967297}/.exec(\"aaaa\") === null);\nassert (/a{4294967294,4294967295}/.exec(\"aaaa\") === null);\nassert (/a{0000000000000000001,0000000000000000002}/u.exec(\"aaaa\")[0] === 'aa');\nassert (/(\\4294967297)/.exec(\"\\4294967297\")[0] === \"\\4294967297\");\nassert (/(\\1)/u.exec(\"aaaa\")[0] === \"\");\n\ntry {\n  new RegExp(\"a{4294967295,4294967294}\", '');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (/[\\d-\\s]/.exec(\"-\")[0] === \"-\");\nassert (/[0-\\s]/.exec(\"-\")[0] === \"-\");\nassert (/[\\d-0]/.exec(\"-\")[0] === \"-\");\n\ntry {\n  new RegExp(\"[\\\\d-\\\\s]\", 'u').exec(\"-\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp(\"[0-\\\\s]\", 'u').exec(\"-\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp(\"[\\\\d-0]\", 'u').exec(\"-\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (/[-]/.exec(\"-\")[0] === \"-\");\nassert (/[-]/u.exec(\"-\")[0] === \"-\");\nassert (/[--]/.exec(\"-\")[0] === \"-\");\nassert (/[--]/u.exec(\"-\")[0] === \"-\");\n\nassert (/}/.exec(\"}\")[0] === \"}\");\nassert (/\\}/u.exec(\"}\")[0] === \"}\");\n\ntry {\n  new RegExp(\"}\", 'u').exec(\"}\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (/]/.exec(\"]\")[0] === \"]\");\nassert (/\\]/u.exec(\"]\")[0] === \"]\");\n\ntry {\n  new RegExp(\"]\", 'u').exec(\"]\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert (/(?=)*/.exec(\"\")[0] === \"\");\nassert (/(?=)+/.exec(\"\")[0] === \"\");\nassert (/(?=){1,2}/.exec(\"\")[0] === \"\");\n\ntry {\n  new RegExp(\"(?=)*\", 'u');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp(\"(?=)+\", 'u');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp(\"(?=){1,2}\", 'u');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  new RegExp(\"(?=){2,1}\", '');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nassert(/\\w/iu.test(\"ſ\"));\nassert(/\\w/iu.test(\"\\u212a\"));\nassert(/k/iu.test(\"\\u212a\"));\nassert(/\\u{10c90}/iu.test(\"\\u{10cd0}\"));\n\nassert(/\\b/iu.test(\"ſ\"));\nassert(/\\b/iu.test(\"\\u212a\"));\nassert(/.\\B/iu.test(\"aſ\"));\nassert(/.\\B/iu.test(\"a\\u212a\"));\n"
  },
  {
    "path": "tests/jerry/regexp-web-compatibility.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction test_match(re, input, expected)\n{\n  var result = re.exec(input);\n\n  if (expected === null)\n  {\n    assert (result === null);\n    return;\n  }\n\n  assert (result !== null);\n  assert (result.length === expected.length);\n\n  for (var idx = 0; idx < result.length; idx++)\n  {\n    assert (result[idx] === expected[idx]);\n  }\n}\n\ntest_match (new RegExp (\"A{1,2}\"), \"B\", null);\ntest_match (new RegExp (\"A{1,2}\"), \"\", null);\ntest_match (new RegExp (\"A{1,2}\"), \"A\", [\"A\"]);\ntest_match (new RegExp (\"A{1,2}\"), \"AA\", [\"AA\"]);\ntest_match (new RegExp (\"A{1,2}\"), \"AAA\", [\"AA\"]);\n\ntest_match (new RegExp (\"A{1,}\"), \"B\", null);\ntest_match (new RegExp (\"A{1,}\"), \"GA\", [\"A\"]);\ntest_match (new RegExp (\"A{1,}\"), \"FAAAW\", [\"AAA\"]);\ntest_match (new RegExp (\"A{1,}\"), \"FAdAAW\", [\"A\"]);\n\n/* Test web compatiblity (ES2015 Annex B 1.4) */\n\ntest_match (new RegExp (\"A{1,2\"), \"A\", null);\ntest_match (new RegExp (\"A{1,2\"), \"AA\", null);\ntest_match (new RegExp (\"A{1,2\"), \"A{1,2\", [\"A{1,2\"]);\ntest_match (new RegExp (\"A{1,2\"), \"AA{1,2\", [\"A{1,2\"]);\n\ntest_match (new RegExp (\"A{1,\"), \"A\", null);\ntest_match (new RegExp (\"A{1,\"), \"AA\", null);\ntest_match (new RegExp (\"A{1,\"), \"A{1,\", [\"A{1,\"]);\ntest_match (new RegExp (\"A{1,\"), \"A{1,2\", [\"A{1,\"]);\ntest_match (new RegExp (\"A{1,\"), \"AA{1,2\", [\"A{1,\"]);\n\ntest_match (new RegExp (\"A{1\"), \"A\", null);\ntest_match (new RegExp (\"A{1\"), \"AA\", null);\ntest_match (new RegExp (\"A{1\"), \"A{1,\", [\"A{1\"]);\ntest_match (new RegExp (\"A{1\"), \"A{1,2\", [\"A{1\"]);\ntest_match (new RegExp (\"A{1\"), \"AA{1,2\", [\"A{1\"]);\n\ntest_match (new RegExp (\"A{\"), \"A\", null);\ntest_match (new RegExp (\"A{\"), \"AA\", null);\ntest_match (new RegExp (\"A{\"), \"A{,\", [\"A{\"]);\ntest_match (new RegExp (\"A{\"), \"A{1,\", [\"A{\"]);\ntest_match (new RegExp (\"A{\"), \"A{1,2\", [\"A{\"]);\ntest_match (new RegExp (\"A{\"), \"AA{1,2\", [\"A{\"]);\n\ntest_match (new RegExp (\"{\"), \"\", null);\ntest_match (new RegExp (\"{\"), \"AA\", null);\ntest_match (new RegExp (\"{\"), \"{,\", [\"{\"]);\ntest_match (new RegExp (\"{\"), \"{1,\", [\"{\"]);\ntest_match (new RegExp (\"{\"), \"{1,2\", [\"{\"]);\ntest_match (new RegExp (\"{\"), \"A{1,2\", [\"{\"]);\n\ntest_match (new RegExp (\"{{2,3}\"), \"\", null);\ntest_match (new RegExp (\"{{2,3}\"), \"AA\", null);\ntest_match (new RegExp (\"{{2,3}\"), \"{{,\", [\"{{\"]);\ntest_match (new RegExp (\"{{2,3}\"), \"{{{,\", [\"{{{\"]);\ntest_match (new RegExp (\"{{2,3}\"), \"{{{{,\", [\"{{{\"]);\n\ntest_match (new RegExp (\"{{2,3\"), \"{{{{,\", null);\ntest_match (new RegExp (\"{{2,3\"), \"{{2,3,\", [\"{{2,3\"]);\n\ntest_match (/A{1,2/, \"A\", null);\ntest_match (/A{1,2/, \"AA\", null);\ntest_match (/A{1,2/, \"A{1,2\", [\"A{1,2\"]);\ntest_match (/A{1,2/, \"AA{1,2\", [\"A{1,2\"]);\n\ntest_match (/A{1,/, \"A\", null);\ntest_match (/A{1,/, \"AA\", null);\ntest_match (/A{1,/, \"A{1,\", [\"A{1,\"]);\ntest_match (/A{1,/, \"A{1,2\", [\"A{1,\"]);\ntest_match (/A{1,/, \"AA{1,2\", [\"A{1,\"]);\n\ntest_match (/A{1/, \"A\", null);\ntest_match (/A{1/, \"AA\", null);\ntest_match (/A{1/, \"A{1,\", [\"A{1\"]);\ntest_match (/A{1/, \"A{1,2\", [\"A{1\"]);\ntest_match (/A{1/, \"AA{1,2\", [\"A{1\"]);\n\ntest_match (/A{/, \"A\", null);\ntest_match (/A{/, \"AA\", null);\ntest_match (/A{/, \"A{,\", [\"A{\"]);\ntest_match (/A{/, \"A{1,\", [\"A{\"]);\ntest_match (/A{/, \"A{1,2\", [\"A{\"]);\ntest_match (/A{/, \"AA{1,2\", [\"A{\"]);\n\ntest_match (/{/, \"\", null);\ntest_match (/{/, \"AA\", null);\ntest_match (/{/, \"{,\", [\"{\"]);\ntest_match (/{/, \"{1,\", [\"{\"]);\ntest_match (/{/, \"{1,2\", [\"{\"]);\ntest_match (/{/, \"A{1,2\", [\"{\"]);\n\ntest_match (/{{2,3}/, \"\", null);\ntest_match (/{{2,3}/, \"AA\", null);\ntest_match (/{{2,3}/, \"{{,\", [\"{{\"]);\ntest_match (/{{2,3}/, \"{{{,\", [\"{{{\"]);\ntest_match (/{{2,3}/, \"{{{{,\", [\"{{{\"]);\n\ntest_match (/{{2,3/, \"{{{{,\", null);\ntest_match (/{{2,3/, \"{{2,3,\", [\"{{2,3\"]);\n\ntry {\n    new RegExp (\"[\");\n    assert (false);\n} catch (ex) {\n    assert (ex instanceof SyntaxError);\n}\n\ntry {\n    eval (\"/[/\");\n    assert (false);\n} catch (ex) {\n    assert (ex instanceof SyntaxError);\n}\n\ntry {\n    new RegExp (\"(\");\n    assert (false);\n} catch (ex) {\n    assert (ex instanceof SyntaxError);\n}\n\ntry {\n    eval (\"/(/\");\n    assert (false);\n} catch (ex) {\n    assert (ex instanceof SyntaxError);\n}\n\ntest_match (new RegExp(\"\\s+{3,4\"), \"s+{3,4\", null);\ntest_match (new RegExp(\"\\s+{3,4\"), \"s{3,4\", [\"s{3,4\"]);\ntest_match (new RegExp(\"\\s+{3,4\"), \"ss{3,4\", [\"ss{3,4\"]);\ntest_match (new RegExp(\"\\\\s+{3,4\"), \"    {3,4\", [\"    {3,4\"]);\ntest_match (new RegExp(\"\\\\s+{3,4\"), \"   d{3,4\", null);\n\ntest_match (/s+{3,4/, \"s+{3,4\", null);\ntest_match (/s+{3,4/, \"s{3,4\", [\"s{3,4\"]);\ntest_match (/s+{3,4/, \"ss{3,4\", [\"ss{3,4\"]);\ntest_match (/\\s+{3,4/, \"    {3,4\", [\"    {3,4\"]);\ntest_match (/\\s+{3,4/, \"   d{3,4\", null);\n\ntry {\n    new RegExp (\"\\s+{3,4}\");\n    assert (false);\n} catch (ex) {\n    assert (ex instanceof SyntaxError);\n}\n\ntry {\n    eval (\"/\\\\s+{3,4}/\");\n    assert (false);\n} catch (ex) {\n    assert (ex instanceof SyntaxError);\n}\n\ntry {\n    new RegExp (\"a{2,3}{2,3}\");\n    assert (false);\n} catch (ex) {\n    assert (ex instanceof SyntaxError);\n}\n\ntry {\n    eval (\"/a{2,3}{2,3}/\");\n    assert (false);\n} catch (ex) {\n    assert (ex instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1054.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  new String(Number.MAX_VALUE)\n} catch(e) {\n  assert(false);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1071.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar d = new Date(864858163349847396, 1, 1, 1, 1, 1, 1, 1)\nassert (d.toGMTString() === \"Invalid Date\");\n\nd = new Date(864858, 1, 1, 1, 1, 1, 1, 1)\nassert (d.toGMTString() === \"Invalid Date\");\n\nd = new Date(86485, 1, 1, 1, 1, 1, 1, 1)\nassert (d.toGMTString() !== \"Invalid Date\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1072.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry { new (this.$)(new (this.RegExp)().ignoreCase).$ ()  } catch($){}\ntry { new (this.String)() .constructor.prototype.match()  } catch($){}\ntry { this.RegExp().compile() } catch($){}\ntry { this.$(this.RegExp.prototype .compile (this.RegExp.prototype))  } catch($){}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1073.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry { String.prototype(new (RegExp)())  } catch($){}\ntry { RegExp.prototype.compile() } catch($){}\ntry { isNaN(RegExp.prototype.compile(RegExp.prototype)) } catch($){}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1074.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry { this.Date.prototype.$ (this.isNaN.length, this.String.fromCharCode.length)  } catch($){}\ntry { this.String.prototype.constructor.prototype.$(new (this.RegExp)())  } catch($){}\ntry { this.RegExp.prototype.constructor.prototype.compile ()  } catch($){}\ntry { this.isNaN (undefined)  } catch($){}\ntry { new (this.Date)(\"2015-09-17\").constructor.parse()  } catch($){}\ntry { this.isNaN(this.RegExp.prototype.compile(this.RegExp.prototype))  } catch($){}\ntry { new $.$ ()  } catch($){}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1075.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry { new (RegExp)().$()  } catch($){}\ntry { RegExp.prototype.compile()  } catch($){}\ntry { new (this.$)(1, RegExp.prototype.compile(RegExp.prototype))  } catch($){}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1076.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry { Array.prototype.unshift(1)  } catch($){}\ntry { Object.freeze(this.Array.prototype)()  } catch($){}\ntry { new String(1).split(\"\")  } catch($){}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1078.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nArray.prototype.splice(Function.prototype, 1, this);\nObject.freeze(Array.prototype);\nvar res = (new String(\"Hello\")).split(new RegExp());\nassert(res.length == 5);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1079.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nArray.prototype.push(1)\nObject.freeze(Array.prototype)\ntry { new RegExp().constructor.prototype.exec()  } catch($){}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1081.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry { new RegExp().compile(A)  } catch (err) {}\ntry { A } catch (err) {}\ntry { new RegExp().constructor.prototype.toString()  } catch (A) {}\ntry { A } catch (err) {}\ntry { new RegExp(1, \"g\").exec(1)  } catch (A) {}\ntry { A } catch (err) {}\ntry { A } catch (A) {}\ntry { A } catch (A) {}\ntry { new (Boolean.constructor.prototype)  } catch (err) {}\ntry { Boolean  } catch (A) {}\ntry { A } catch(A) {}\ntry { new RegExp().compile(new (RegExp)())  } catch (A) {}\ntry { Math.max().constructor.seal(A) } catch (err) {}\ntry { Date.parse(RegExp.prototype.compile(RegExp.prototype)) } catch(A) {}\ntry { Boolean.A() } catch (err) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1082.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry { new (String)().A.A.A (A)  } catch (A) {}\ntry { new (this.RegExp)().A ()  } catch (A) {}\ntry { A.A.A ()  } catch (A) {}\ntry { ; } catch (A) {}\ntry { new A.A ()  } catch (A) {}\ntry { new (this.Date)().setMinutes (this.RegExp.prototype)  } catch (A) {}\ntry { ; } catch (A) {}\ntry { ; } catch (A) {}\ntry { new A.A (A)  } catch (A) {}\ntry { this.A (A)  } catch (A) {}\ntry { new A.A ()  } catch (A) {}\ntry { ; } catch (A) {}\ntry { ; } catch (A) {}\ntry { ; } catch (A) {}\ntry { ; } catch (A) {}\ntry { ; } catch (A) {}\ntry { ; } catch (A) {}\ntry { ; } catch (A) {}\ntry { ; } catch (A) {}\ntry { new A().A ()  } catch (A) {}\ntry { new A().A ()  } catch (A) {}\ntry { this.isNaN (this.RegExp.prototype.compile (this.RegExp.prototype))  } catch (A) {}\ntry { ; } catch (A) {}\ntry { A.A.A (A)  } catch (A) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1083.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry { ; } catch (A) {}\ntry { new (this.String)().A.A.A (A)  } catch (A) {}\ntry { ; } catch (A) {}\ntry { new (this.RegExp)().A ()  } catch (A) {}\ntry { A.A.A ()  } catch (A) {}\ntry {  } catch (A) {}\ntry { ; } catch (A) {}\ntry { ; } catch (A) {}\ntry { ; } catch (A) {}\ntry { ; } catch (A) {}\ntry { new A.A ()  } catch (A) {}\ntry { new (this.Date)().setMinutes (this.RegExp.prototype)  } catch (A) {}\ntry { this.A (A)  } catch (A) {}\ntry { new A.A ()  } catch (A) {}\ntry { this.isNaN (this.RegExp.prototype.compile (this.RegExp.prototype))  } catch (A) {}\ntry { ; } catch (A) {}\ntry { A.A.A(A)  } catch (A) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-112.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ndelete Function.prototype.toString;\nassert (Math.cos + 1 === '[object Function]1');\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-113.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nv_1 = [];\nv_1 * v_1[v_1 % v_1];\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-114.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nv_1 = 1;\nv_1[1] = 1;\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-115.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar v_1 = [,];\nObject.defineProperty(v_1, \"0\", {\n    set: function() {},\n});\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-117.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n[print(typeof v_1)];\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-121.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  function f_1() {\n    v_1 + v_1;\n  }\n\n  f_1(new f_1);\n\n  assert (false);\n} catch (e) {\n  assert (e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-122.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry\n{\n  print({toString: function() { throw new TypeError(\"foo\"); }}, []);\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n  assert (e.message === \"foo\");\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-123.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar v_1 = (1 + (1 + (1 +\n    (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 +\n    (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 +\n    (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 + (1 +\n    1\n    )) )) )) )) )) )) )) )) )) ))\n    )) )) )) )) )) )) )) )) )) ))\n    )) )) )) )) )) )) )) )) )) ))\n    )) );\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-128.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ndo {\n    try {\n    } finally {\n        break;\n    }\n} while (false);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1282.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar counter = 0;\n\n({ get \"0\"() { counter += 1; } })[0];\n({ get 0() { counter += 2; } })[0];\n({ get 0.0() { counter += 3; } })[0];\n({ get 0.() { counter += 4; } })[0];\n({ get 1.() { counter += 5; } })[1];\n({ get 5.2322341234123() { counter += 6; } })[5.2322341234123];\n\nassert (counter == 21);\n\n({ set \"0\"(q) { counter -= 1; } })[0] = \"dummy\";\n({ set 0(q) { counter -= 2; } })[0] = \"dummy\";\n({ set 0.0(q) { counter -= 3; } })[0] = \"dummy\";\n({ set 0.(q) { counter -= 4; } })[0] = \"dummy\";\n({ set 1.(q) { counter -= 5; } })[1] = \"dummy\";\n({ set 5.2322341234123(q) { counter -= 6; } })[5.2322341234123] = \"dummy\";\n\nassert (counter == 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1284.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar count = 0;\n[].length = { valueOf: function() { count++; return 1; } };\nassert(count == 2);\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1286.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar builtinEval = eval;\nvar eval = builtinEval.bind(undefined, \"context\");\n\nvar context = \"global\";\nfunction checkIfDirectEval() {\n  var context = \"function\";\n  return (eval() == \"function\");\n}\n\nassert (!checkIfDirectEval());\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-129.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    eval(\"do { \\\n        return null; \\\n        } while (false);\");\n    assert (false);\n} catch (e) {\n    assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1292.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function nonStrictFuncExpr() {\n  assert(typeof nonStrictFuncExpr == \"function\");\n  nonStrictFuncExpr = 123;\n  assert(typeof nonStrictFuncExpr == \"function\");\n})();\n\n(function strictFuncExpr() {\n  \"use strict\";\n  assert(typeof strictFuncExpr == \"function\");\n  try {\n    strictFuncExpr = 123;\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n  assert(typeof strictFuncExpr == \"function\");\n})();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-130.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nv_1 = Math.floor('\\u3d52');\nv_1 = Math.floor([]);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1300.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [ [0] ];\nvar obj = { prop : \"\" };\nvar i = 0;\nvar count = 0;\n\n(function () {\n      for (array[0][i] in obj)\n          count++;\n})();\n\nassert(array[0][0] == \"prop\");\nassert(count == 1);\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1309.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar errorMessage = \"toStringThrows\"\n\nvar toStringThrows = {\n  toString : function() {\n    throw new Error(errorMessage);\n  }\n}\n\ntry {\n  var obj = {};\n  obj[toStringThrows] = 3;\n  assert(false);\n} catch (e) {\n  assert(e.message == errorMessage);\n}\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-132.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Test raised by fuzzer\nv_0 = [,];\nv_1 = [,];\nv_2 = Object.defineProperties([,], { '0': {  get: function() { } } });\n\n// Test change from data to accessor type\nvar a = { x:2 };\nObject.defineProperty(a, \"x\", {\n      enumerable: true,\n      configurable: true,\n      get: function() { return 0; }\n});\n\n// Test change from accessor to data type\nvar obj = {test: 2};\n\nObject.defineProperty(obj, \"test\", {\n      enumerable: true,\n      configurable: true,\n      get: function() { return 0; }\n});\n\nObject.defineProperty(obj, \"x\", {\n      enumerable: true,\n      configurable: true,\n      value: -2\n});\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1386.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor (var y = 1950; y < 2050; y++) {\n  for (var m = 0; m < 12; m++) {\n    var last_date = new Date(y, m, 1).getDay ();\n    assert (!isNaN (last_date));\n    for (var d = 1; d < 32; d++) {\n      assert (last_date == new Date(y, m, d).getDay ());\n      last_date = (last_date + 1) % 7;\n    }\n  }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1389.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction x(){}\n\n\"a0\",\"a1\",\"a2\",\"a3\",\"a4\",\"a5\",\"a6\",\"a7\",\"a8\",\"a9\",\"a10\",\"a11\",\"a12\",\"a13\",\"a14\",\n\"a15\",\"a16\",\"a17\",\"a18\",\"a19\",\"a20\",\"a21\",\"a22\",\"a23\",\"a24\",\"a25\",\"a26\",\"a27\",\n\"a28\",\"a29\",\"a30\",\"a31\",\"a32\",\"a33\",\"a34\",\"a35\",\"a36\",\"a37\",\"a38\",\"a39\",\"a40\",\n\"a41\",\"a42\",\"a43\",\"a44\",\"a45\",\"a46\",\"a47\",\"a48\",\"a49\",\"a50\",\"a51\",\"a52\",\"a53\",\n\"a54\",\"a55\",\"a56\",\"a57\",\"a58\",\"a59\",\"a60\",\"a61\",\"a62\",\"a63\",\"a64\",\"a65\",\"a66\",\n\"a67\",\"a68\",\"a69\",\"a70\",\"a71\",\"a72\",\"a73\",\"a74\",\"a75\",\"a76\",\"a77\",\"a78\",\"a79\",\n\"a80\",\"a81\",\"a82\",\"a83\",\"a84\",\"a85\",\"a86\",\"a87\",\"a88\",\"a89\",\"a90\",\"a91\",\"a92\",\n\"a93\",\"a94\",\"a95\",\"a96\",\"a97\",\"a98\",\"a99\",\"a100\",\"a101\",\"a102\",\"a103\",\"a104\",\n\"a105\",\"a106\",\"a107\",\"a108\",\"a109\",\"a110\",\"a111\",\"a112\",\"a113\",\"a114\",\"a115\",\n\"a116\",\"a117\",\"a118\",\"a119\",\"a120\",\"a121\",\"a122\",\"a123\",\"a124\",\"a125\",\"a126\",\n\"a127\",\"a128\",\"a129\",\"a130\",\"a131\",\"a132\",\"a133\",\"a134\",\"a135\",\"a136\",\"a137\",\n\"a138\",\"a139\",\"a140\",\"a141\",\"a142\",\"a143\",\"a144\",\"a145\",\"a146\",\"a147\",\"a148\",\n\"a149\",\"a150\",\"a151\",\"a152\",\"a153\",\"a154\",\"a155\",\"a156\",\"a157\",\"a158\",\"a159\",\n\"a160\",\"a161\",\"a162\",\"a163\",\"a164\",\"a165\",\"a166\",\"a167\",\"a168\",\"a169\",\"a170\",\n\"a171\",\"a172\",\"a173\",\"a174\",\"a175\",\"a176\",\"a177\",\"a178\",\"a179\",\"a180\",\"a181\",\n\"a182\",\"a183\",\"a184\",\"a185\",\"a186\",\"a187\",\"a188\",\"a189\",\"a190\",\"a191\",\"a192\",\n\"a193\",\"a194\",\"a195\",\"a196\",\"a197\",\"a198\",\"a199\",\"a200\",\"a201\",\"a202\",\"a203\",\n\"a204\",\"a205\",\"a206\",\"a207\",\"a208\",\"a209\",\"a210\",\"a211\",\"a212\",\"a213\",\"a214\",\n\"a215\",\"a216\",\"a217\",\"a218\",\"a219\",\"a220\",\"a221\",\"a222\",\"a223\",\"a224\",\"a225\",\n\"a226\",\"a227\",\"a228\",\"a229\",\"a230\",\"a231\",\"a232\",\"a233\",\"a234\",\"a235\",\"a236\",\n\"a237\",\"a238\",\"a239\",\"a240\",\"a241\",\"a242\",\"a243\",\"a244\",\"a245\",\"a246\",\"a247\",\n\"a248\",\"a249\",\"a250\",\"a251\",\"a252\",\"a253\",\"a254\",\"a255\",\"a256\",\"a257\"\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1533.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = [];\n\nfor (var i = 0; i < 200; ++i)\n  a[i] = 5;\n\nfor (var i = 0; i < 200; ++i)\n  a[i] = a[i] + 5;\n\nfor (var i = 0; i < 200; ++i)\n  delete a[i]\n\na[0] = 5\n\na = [];\n\nfor (var i = 0; i < 200; ++i)\n  a[i] = 5;\n\na.length = 0\n\nfor (var i = 0; i < 200; ++i)\n  a[i] = 5;\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1547.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(new Date(Number.MAX_VALUE, Number.MAX_VALUE).toString() == \"Invalid Date\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1552.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar o = []\n\nfunction add(i)\n{\n  delete o[i & 31];\n  o[i] = 0;\n}\n\nfor (var i = 0; i < 130; i++)\n{\n  add(i)\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1555.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar src = \"var a = 0; while(a) { switch(a) {\";\n/* The += operation has a longer opcode. */\nfor (var i = 0; i < 3300; i++)\n    src += \"case \" + i + \": a += a += a; break; \";\nsrc += \"} }\";\n\neval(src);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1556.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Maximum 256 paramaters are allowed. */\nvar src = \"(function (\";\nfor (var i = 0; i < 254; i++)\n    src += \"a\" + i + \", \";\nsrc += \"b) { var c = 1; })()\";\n\neval(src);\n\n/* More than 256 parameters is a syntax error. */\nvar src = \"(function (\";\nfor (var i = 0; i < 255; i++)\n    src += \"a\" + i + \", \";\nsrc += \"b) { })()\";\n\ntry {\n  eval(src);\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\n/* Maximum 256 local variables are stored in registers.\n * The rest is stored in the lexical environment. */\nvar src = \"(function () {\";\nfor (var i = 0; i < 400; i++)\n    src += \"var a\" + i + \" = 5; \";\nsrc += \"})()\";\n\neval(src);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-156.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction dec(x) { return x - 1 };\nfor (var i = 5; i > 0; i = dec(i)) {}\nfor (var i = 11; i = dec (i); i--) {}\nfor (var i = dec (12); i > 0; i--) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1616.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar name = \"\";\n\ntry\n{\n  var a = new ArrayBuffer (0xfffffffe)\n}\ncatch (e)\n{\n  name = e.name;\n}\n\nassert(name === \"RangeError\");\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1621.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar eval = eval.bind()\ngc();\neval(\"1\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1622.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor (var a in new Int8Array(123));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1633.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ndelete new Uint16Array()[0]\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1636.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Number(\"Infinity\") == Infinity);\nassert(isNaN(Number(\"infinity\")));\nassert(isNaN(Number(\"InfinitY\")));\nassert(isNaN(Number(\"e\")));\nassert(isNaN(Number(\"e3\")));\nassert(Number(\"1e2\") == 100);\nassert(isNaN(Number(\".\")));\nassert(isNaN(Number(\".e2\")));\nassert(Number(\"0.\") == 0);\nassert(Number(\".0\") == 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-164.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar v_1 = { };\n\nfor (i = 0; i < 1; i++) {\n  with ( v_1 ) {\n    with ( v_1 ) { }\n  }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1657.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Negative out-of-range years should NOT cause hangs. */\nnew Date(-565224, 1);\nDate.UTC(-565224, 1);\nnew Date().setFullYear(-565224);\nnew Date().setUTCFullYear(-565224);\nnew Date().setYear(-565224);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1670.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar name = \"\";\n\ntry\n{\n  Int16Array.from();\n}\ncatch (e)\n{\n  name = e.name;\n}\n\nassert(name === \"TypeError\");\n\nInt16Array.of();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1763.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nnew Promise(Math.max.propertyIsEnumerable.toString).then()\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1765.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nFunction()(Promise.prototype.toLocaleString())\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1821.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n'\\\n'\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1829.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor ({ get 10() {} } ; ; ) break;\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1830.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/[\\꧿]ౘ/\n\nvar r = new RegExp (\"[\\꧿]ౘ\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1855.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert ((1 / 0*(-1)) == -Infinity);\nassert ((1 / 0*1) == Infinity);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1881.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nnew Promise(isFinite.toString).catch(Promise.prototype.then)\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1917.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert('foobar'.replace(/(ob)/g, '$0') == 'fo$0ar')\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1934.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar devNum = 38;\nvar devQueue = [];\nfor (var i = 0; i < devNum; i++)\n{\n    devQueue.push(i);\n}\n\nfor (var j = 0; j < devNum; j++)\n{\n    devQueue.shift();\n    devQueue.unshift(1);\n    devQueue.shift();\n    assert(j + devQueue.length + 1  == devNum)\n}\n\nassert(devQueue.length == 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1936.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar name = \"\";\n\ntry\n{\n  Object.defineProperties(constructor.isExtensible, {a: Object.getOwnPropertyDescriptor(Uint8ClampedArray, \"length\")})\n  new Int32Array(new ArrayBuffer(), undefined, 40000000000)\n}\ncatch (e)\n{\n  name = e.name;\n}\n\n\nassert(name === \"RangeError\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1947.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction a () {\n function b () {\n   // Can be any unicode escape character, ie: A\n   \\u0041\n }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-195.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction Error() { }\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1970.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  var a = Function.prototype.bind({0:0},30000000000);\n  a();\n}\ncatch (e) {\n  assert(false);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1972.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  [].length = {\n    valueOf: function() {\n      return Array.prototype.push (1), Object.freeze (Array.prototype);\n    }\n  }\n  assert (false);\n}\ncatch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1973.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nprint (777E7777777777 == Infinity)\nprint (-777E7777777777 == -Infinity)\nprint (777E-7777777777 == 0)\nprint (-777E-7777777777 == -0)\n\nprint (100E307 == Infinity)\nprint (10E307 == 1E308)\nprint (10E308 == Infinity)\nprint (1E308 == 1E308)\nprint (0.1E309 == 1E308)\nprint (0.1E310 == Infinity)\n\nprint (-100E307 == -Infinity)\nprint (-10E307 == -1E308)\nprint (-10E308 == -Infinity)\nprint (-1E308 == -1E308)\nprint (-0.1E309 == -1E308)\nprint (-0.1E310 == -Infinity)\n\nprint (5E-325 == 0)\nprint (50E-325 == 5E-324)\nprint (0.5E-324 == 0)\nprint (5E-324 == 5E-324)\nprint (0.05E-323 == 0)\nprint (0.5E-323 == 5E-324)\n\nprint (-5E-325 == -0)\nprint (-50E-325 == -5E-324)\nprint (-0.5E-324 == -0)\nprint (-5E-324 == -5E-324)\nprint (-0.05E-323 == -0)\nprint (-0.5E-323 == -5E-324)\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1974.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert((39000000000000700).toString(2) == \"10001010100011100100101100011010001111011000001011000000\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1990.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(unescape(\"%f׊nd\") === \"%f׊nd\")\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1993.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(parseFloat(Number.MAX_VALUE).toFixed(5) == parseFloat(Number.MAX_VALUE).toString());\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1995.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar name = \"\";\n\ntry\n{\n    Promise.race([\"\"]).$()\n}\ncatch (e)\n{\n    name = e.name;\n}\n\nassert(name === \"TypeError\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1996.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nnew Promise(function(f) {\n    f.apply()\n});\n\nnew Promise(function(f, r) {\n    r.apply()\n});\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-1997.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = Promise.resolve();\nfor (var i = 0; i < 200; i++)\n{\n    Promise.race([a]).then();\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2008.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n'\\\n'+'056';\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2058.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('/?:/');\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2073.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nDate.parse(\"2015-01-01T01߄'a': 1}:01F\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2105.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Adding property to a frozen object */\nvar a = {one: \"test\"};\na.two = 3;\nObject.freeze(a);\na.three = 7;\nassert(a.three === undefined);\n\n/* Adding properties to frozen global object */\nObject.freeze(this);\nassert(eval ('function b() {};') === undefined);\nassert(eval('var test_var = 3') === undefined);\n\n/* Check strict mode TypeError */\nfunction fail() {\n  'use strict';\n  a.one = 'test'; // throws a TypeError\n  delete a.two; // throws a TypeError\n  a.three = 'test2'; // throws a TypeError\n}\n\ntry {\n  fail();\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nfunction fail_two() {\n  'use strict';\n  this.a = 'test';\n}\n\ntry {\n  fail_two();\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n/* Check properties of a */\nassert(Object.keys(a) == \"one,two\");\n/* Check properties of global object */\nassert(Object.keys(this) == \"assert,gc,print,sourceName,createRealm,a,fail,fail_two\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2107.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar thenableWithError = {\n  then: function() { throw new Error(\"\") }\n};\n\nfunction executor(resolve) {\n  resolve(thenableWithError)\n}\n\nnew Promise(executor);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2108.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert((8e-9).toFixed(20) == \"0.00000000800000000000\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2110.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrowFn = () => {};\narrowFn.hasOwnProperty('caller');\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2111.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar value = {};\nvar poisonedThen = Object.defineProperty({}, 'then', {\n  get: function() {\n    throw value;\n  }\n});\nvar promise = new Promise(function(resolve) {\n  resolve(poisonedThen);\n});\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-212.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nwith(0xB276)\n  eval(\"foo = true;\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2143.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = new Uint8Array(2);\n\ntry {\n  a[0] = { valueOf : function() { throw \"intoint\"; } };\n  assert(false);\n} catch (e) {\n  assert(e === \"intoint\")\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2178.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Testcase from bugreport (issue: #2178).\nbad = \"'detailForm','detailForm:j_id166', []);\\\" ><img alt=\\\"Export to XLS format\\\" />\\n</a>\"\ngood = \"'detailForm','detailForm:j_id166');\\\" ><img alt=\\\"Export to XLS format\\\" />\\n</a>\"\nr = /'(detailForm:j_id\\d+)'[^>]+>[^>]+Export to XLS format/;\nassert(!!good.match(r) && !!bad.match(r));\n\n// Similar testcases.\nvar regexPatternCharacters = ['^', '$', '\\\\', '.', '*', '+', '?', '(', ')', '[', ']', '{', '}'];\nregexPatternCharacters.forEach(function (str) {\n  assert(str.match(/[^>]/) == str);\n})\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2181.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar error = {};\n\ntry {\n  var arrayBuffer = new ArrayBuffer(1);\n  var start = { valueOf : function ( ) { throw error; } };\n  var end = { valueOf : function ( ) { } };\n\n  arrayBuffer.slice(start, end);\n  assert(false);\n} catch (e) {\n  assert(e === error);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2182.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction test(len)\n{\n  function applyTest() { }\n  try {\n    applyTest.apply(null, { length : len });\n    assert(false);\n  } catch (e) {\n    assert(e instanceof RangeError);\n  }\n}\n\ntest(65536);\ntest(0x40000001);\ntest(0xffffffff);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2190.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  /(?:(?=x)){10000}xyz/.exec('xyz');\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2198.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar id_0 = Object.prototype.toString ; \nObject.prototype.toString = function ( ) { return \"SHIFTED\" } ; \nRegExp ( '#1: __str = new String({}); typeof __str === \"object\". Actual: typeof __str ===');\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2200.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n[\n  // This input caused a buffer overrun,\n  // see https://github.com/jerryscript-project/jerryscript/issues/2200\n  '\"\\\\ubad',\n  // Test similar malformations as well:\n  '\"\\\\ubad\"',\n  '\"\\\\u',\n].forEach(function(badJson) {\n  try {\n    JSON.parse(badJson);\n  } catch (e) {\n  }\n});\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2204.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  new RegExp(\"\\{{91406,456}\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof SyntaxError)\n}\n\ntry {\n  new RegExp(\"\\{91406,456}\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof SyntaxError)\n}\n\ntry {\n  new RegExp(\"\\({91406,456}\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof SyntaxError)\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2230.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\ntry {\n  ((new RegExp(\"[\\\\u0\")).exec(\"u\"));\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  ((new RegExp(\"[\\\\x0\")).exec(\"x\"));\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2237.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\ntry {\n  (new RegExp(\"[\\\\u0020\")).exec(\"u\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\ntry {\n  (new RegExp(\"[\\\\x20\")).exec(\"x\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2258-2963.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  JSON.stringify(10, Array);\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2272.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nNumber.isInteger = Number.isInteger || function (value) {\n  return typeof value === 'number' &&\n    isFinite (value) &&\n    Math.floor (value) === value;\n};\n\nvar now = Date.now ();\n\nassert (Number.isInteger (now));\n\nvar date = new Date(now); // Should not throw an error\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2384.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  \"[]{83}\".match(\"(?=){12,8}\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2386.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nMath in Number\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2398.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// This issue was triggered when show opcodes was enabled at compile\n// time but not enabled in runtime. A memory leak was created.\n\nfunction f()\n{\n  var \\u0042 = true;\n};\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2400.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Wrong byte codes were dumped for this function when show opcodes had been enabled\n\nfunction abc(a,b) {\n  var c = 6;\n  return arguments[0] + b + c;\n}\n\nabc(1, 2);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2409.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Must be a success.\neval('g\\\\u0065t: break get')\n\ntry {\n  // Must be a fail.\n  eval('({ g\\\\u0065t a() {} })')\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\n// Must be a success.\neval('({ g\\\\u0065t: 5 })')\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2414.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  // By default bound functions always support new operator.\n  // However, arrow functions must throw an error even in this case.\n\n  var f = (() => 1).bind();\n\n  new f;\n\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2435.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(new Int8Array(0)).filter(parseInt)\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2448.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar x = new RegExp('(/*()+?b+?b+?|.|)+')\n\ntry {\n  x.exec('?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????');\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-245.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry\n{\n  v_0 = new RegExp(\"N(?![^6](?:.)|(?!C[^k-o]*|p){0,}|H)|\\\\\\\\xDF\\\\db{0,}|i\\\\\\\\0?)\");\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2451.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar src = \"var a = 0; while(a) { switch(a) {\" ;\nfor (var i = 0; i < 4000; i++)\n    src += \"-Infinity\" + i + \"\\u00a0\\u00a01.2e3\";\nsrc += \"\\udc00%f0%90%80%80\\udc00\";\nprint(src);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2452.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar src = \"\";\nfor (var i = 0; i < 4000; i++)\n  src += \"\\udc00%f0%90%80%80\\udc00\";\nsrc += \"} }\";\nprint(src);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2453.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar src = \"\";\nfor (var i = 0; i < 4000; i++)\n  src += 4 + i + \": a += a += a; break; \";\n  src += \"\\𝔺\\\n\\ \";\nprint(src);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2465.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = eval(\"Object.prototype[1] = 0;\\\n              Promise.all()\")\na.catch(function(err) {\n  assert(err instanceof TypeError);\n});\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2468.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.prototype[1] = 0;\nPromise.race([]);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2478.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction fn(x) {\n  switch (x) {\n    case 1: { return }\n  }\n}\n\nnew Function(\"switch(1) { default: { return }}\")\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2486.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.setPrototypeOf(Math, Int32Array);\nfor (var i = 0; i < 200; i++) { \n    Promise.race([, [,] % {}]).then(); \n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2487.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.defineProperty(Array.prototype, 0, {set: function() {var $ = $()}});\nPromise.all([0]);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2488.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.defineProperty(Array.prototype, 0, {set: function() {throw \"MyError\"}});\nPromise.all([0]);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2489-original.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// This test case should not throw an error anymore.\nObject.defineProperty(Object.prototype, 0, {'get': function() { throw $ }});\nPromise.all();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2490.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Original issue\nObject.defineProperty(Object.prototype, 6, {});\nPromise.all([0]);\n\n// Variant 2\nObject.defineProperty(Object.prototype, 2, {});\nPromise.all([0]);\n\n// Variant 3\nObject.defineProperty(Object.prototype, 3, {});\nPromise.all([0]);\n\n// Variant 4\nObject.defineProperty(Object.prototype, 4, {});\nPromise.all([0]);\n\n// Variant 5\nObject.defineProperty(Object.prototype, 5, {});\nPromise.all([0]);\n\n// Variant 7\nObject.defineProperty(Object.prototype, 7, {});\nPromise.all([0]);\n\n// Variant 8\nObject.defineProperty(Object.prototype, 8, {});\nPromise.all([0]);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2494.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.defineProperty(Object.prototype, \"\", {});\nassert(JSON.stringify() === undefined)\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2528.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('for (/a/ in a => { }, a => { }, a => { }) throw 1');\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2544.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.defineProperty(Array.prototype, 0, { get : function () { throw $; } });\nvar global_err = undefined;\nPromise.race([ , this]).then(Error).catch(function(err) { global_err = err; });\n\nfunction __checkAsync() {\n  assert(global_err instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-255.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nv_0 = /(?!(?!l{666,}))/;\n\ntry\n{\n  v_0.exec(\"llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll\");\n}\ncatch (e)\n{\n  assert (e instanceof RangeError);\n  assert (e.message === \"RegExp executor steps limit is exceeded.\");\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-257.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r;\nr = new RegExp(\"]\");\nassert (r.exec(\"]\") == \"]\");\n\nr = new RegExp(\"}\");\nassert (r.exec(\"}\") == \"}\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2587.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f(a,b,c) {\n  var args = Array.prototype.slice.call(arguments, 3);\n  assert (typeof args.splice === \"function\");\n}\nf();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-260.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  isNaN(__proto__);\n} catch (e) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2602.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.defineProperty ( Array.prototype , 0 , { set : function ( ) { throw \"MyError\" } } ) ;\nPromise.all ( [ \"2015-01-01\" ] ) ;\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2603.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nObject.defineProperty( Array.prototype, 0, { set : function ( ) { throw \"MyError\" } } );\nPromise.all( [ .86456 ] ) ;\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-261.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  SyntaxError(RegExp());\n  isFinite(foo);\n} catch (e) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2614.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(\".5.\");\n  assert(false);\n} catch(e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-262.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    RegExp(\"\");\n    eval(encodeURI(isNaN(__proto__)));\n} catch (e) { }\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-263.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    Boolean(decodeURI(decodeURIComponent(Number())));\n} catch(err) {}\n try {\n    ReferenceError(isNaN(__proto__));\n } catch(err) {}\n try {\n    isNaN(__proto__);\n } catch(err) {}\n try {\n    load();\n } catch(err) {}\n try {\n    RegExp(\"\\n\");\n } catch(err) {}\n try {} catch(err) {}\n try {\n    ReferenceError(performance.__proto__.isPrototypeOf(arguments.map(os)));\n } catch(err) {}\n try {\n    Float64Array(performance,WeakSet(),Infinity.valueOf());\n } catch(err) {}\n try {\n    arguments.push(Int8Array(Boolean(isFinite(quit())),ArrayBuffer(os.system()),Array(read())));\n } catch(err) {}\n try {\n    Boolean(encodeURI(DataView(ArrayBuffer(os),parseFloat(Set()),URIError(Object(Int8Array(Function(parseInt(write(),RangeError(__proto__.valueOf()))),Int16Array(Map(),__proto__.valueOf(),readbuffer()),Math))))));\n } catch(err) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-264.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    Boolean(decodeURI(decodeURIComponent(Number())));\n } catch(err) {}\n try {\n    ReferenceError(isNaN(__proto__));\n } catch(err) {}\n try {\n    isNaN(__proto__);\n } catch(err) {}\n try {\n    load();\n } catch(err) {}\n try {\n    RegExp(\"\\n\");\n } catch(err) {}\n try {\n    Set();\n } catch(err) {}\n try {\n    ReferenceError(performance.__proto__.isPrototypeOf(arguments.map(os)));\n } catch(err) {}\n try {\n    Float64Array(performance,WeakSet(),Infinity.valueOf());\n } catch(err) {}\n try {\n    arguments.push(Int8Array(Boolean(isFinite(quit())),ArrayBuffer(os.system()),Array(read())));\n } catch(err) {}\n try {\n    Boolean(encodeURI(DataView(ArrayBuffer(os),parseFloat(Set()),URIError(Object(Int8Array(Function(parseInt(write(),RangeError(__proto__.valueOf()))),Int16Array(Map(),__proto__.valueOf(),readbuffer()),Math))))));\n } catch(err) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-265.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nparseInt(NaN,RegExp(\"54\"));\n\ntry {\n    parseInt(ArrayBuffer());\n} catch(err) {}\n\ntry {\n    isNaN(__proto__);\n} catch(err) {}\n\ntry {\n    RangeError(parseInt(Infinity,readbuffer()));\n} catch (err) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2652-2653.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.defineProperty (Object.prototype, \"\", { 'set' : function () { throw ReferenceError (\"\") } });\nassert (JSON.stringify () === undefined);\nprint (JSON.stringify ());\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2656.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = { \"arguments\": \"foo\" }\n\nfunction testcase ()\n{\n  return obj.hasOwnProperty (\"arguments\");\n}\n\nassert (testcase () === true);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2657.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval (\"var Mixin1 = (superclass) => class extends super.lass {};\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2658.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  var A = class extends null { }\n  new A;\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-266.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    String(\"test\");\n    isNaN(__proto__);\n} catch(err) {}\n\ntry {\n    SyntaxError(RegExp(\"[/]\"));\n} catch(err) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2660.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  new RegExp(\"\\{{91[06,456}\");\n  assert (false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2664.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar mustBeCalled = false;\n\nclass C1 {\n  f () {\n    mustBeCalled = true;\n    return function () {};\n  }\n}\n\nclass C2 extends C1 {\n  f () {\n    return class extends super.f() {}\n  }\n}\n\nvar c = new C2;\nc.f ();\n\nassert (mustBeCalled);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2666.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass C {\n  static D () {\n    return 5;\n  }\n}\n\nclass D extends C {}\n\nassert (D.D () === 5);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2667.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval (\"new Strin = class extends f ()() { constructor () { var C = class extends$B {}\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-267.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    RegExp(\"\\u2029\");\n} catch(err) {}\n\ntry {\n    URIError(isNaN(__proto__));\n} catch(err) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2671.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass Shape {\n  constructor (id,x,y) {\n    this.id = id;\n    this.x = x;\n    this.y = y;\n  }\n  toString () {\n      return \"Shape(\" + this.id + \")\"\n  }\n}\nclass Rectangle extends Shape {\n  constructor (id, x, y, width, height) {\n      super (id, x, y);\n  }\n  toString () {\n      return \"Rectangle > \" + super.toString ();\n  }\n}\nclass Circle extends Shape {\n  constructor (id, x, y, radius) {\n      super (id, x, y);\n  }\n  toString () {\n      return \"Circle > \" + super.toString ();\n  }\n}\nvar shape = new Shape (0, 0, 0);\nvar rec = new Rectangle (1, 0, 0, 4, 4);\nvar circ = new Circle (2, 0, 0, 4);\n\nassert (Object.keys (shape).toString () === \"id,x,y\");\nassert (rec.id === 1);\nassert (circ.id === 2);\nassert (rec.toString () === \"Rectangle > Shape(1)\");\nassert (circ.toString () === \"Circle > Shape(2)\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2693.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.defineProperty(Array.prototype, 0, { get : function ( ) { throw $ } });\nPromise.all([,]);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2698.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  Uint8Array.prototype.join.call([ \"2015-01-01T00:\", { toString : '2,1,3,4,0' } ], [ ]) ;\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2699.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f(a) {\n  function a() {\n    return 5;\n  }\n\n  assert (typeof a === \"function\");\n  assert (a () === 5);\n  assert (arguments[0] () === 5);\n}\n\nf (6);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2724.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  var obj = { reverse : Int32Array.prototype.join } ;\n  Object.defineProperty( obj, 'length', { 'get' : function(toPrecision) { return Object.create(/x/); }});\n  obj.reverse(\"$01$02$11$20\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-274.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n'�'\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2743.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar v1 = Object(Symbol(\"symbol\"))\nvar v2 = new RegExp();\nvar v3 = new Array(v1)\n\ntry {\n  var v4 = v3.forEach(function(p_0, p_1, p_2) { return p_0 + p_1 + p_2; }, v2);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2755.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  var v0 = Object.freeze (RegExp ($, \"g\")).exec ();\n  var $ = v0.every (Function (\"a1,a2,a3\",  \"this.shifted=a3+a2+a1.length;\"), v0.hasOwnProperty);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2757.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar v1 = (new Int8Array (149)).subarray (78);\nvar v1ToString = v1.toString ();\nv1.set (v1);\nassert (v1ToString === v1.toString ());\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-276.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* 256 \"a\" in the array */\n\ntry {\n      [\"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n        \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\", \"a\",\n          \"a\", \"a\", \"a\", \"a\"];\n} catch(e) { }\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2768.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (typeof new Object (Symbol ()) === \"object\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2769.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ndelete JSON[Symbol.toStringTag];\nJSON[Symbol.toStringTag ] = \"𖠀\";\nassert (Map.prototype.toString.call(JSON) === \"[object 𖠀]\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2770.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.defineProperty(Array.prototype, 0, {set: function() { return Array.prototype.push(), Object.freeze(Array.prototype)}});\nPromise.all([0]);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2777.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar f = function (a, b, ...argArr0) {\n    arguments;\n    assert (a === 1);\n    assert (b === 2);\n    assert (argArr0.length === 2);\n    assert (argArr0.toString() === \"3,4\");\n}\n\nf (1,2,3,4);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2779.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (Map.prototype.toString() === \"[object Map]\");\nassert (Object.prototype.toString.call (Symbol.prototype) === \"[object Symbol]\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2782.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrayLikeObj = { \"0\" : 0, \"1\" : 1, \"2\" : 2, \"length\": 3 }\n\niterator = Array.prototype.keys.call (arrayLikeObj);\n\nfor (var i = 0; i < arrayLikeObj.length; i++) {\n  var next = iterator.next ();\n  assert (next.value === i && next.done === false);\n}\n\nnext = iterator.next ();\nassert (next.done === true);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2783.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nvar id_0;\n$(encodeURIComponent);\nfunction $ ( ) { }\narray = [ $, $, $, $, $, $, $] ;\n[0, 0, 0].forEach(function(e) {Object.defineProperty(array, e, {'get' : Int32Array})})\niterator = array.entries();\nvar id_2 = [ ];\nvar id_3 = [ ];\nvar id_4 ;\nfor (var i ; i < 1000000; i++) {\n    try {\n        array = iterator.next();\n        $(Uint8ClampedArray.$[$])\n    } catch (e) { $(e instanceof ReferenceError) }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-279.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (isNaN (parseInt (RegExp (\"\\u2029\"))));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-280.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_reference_error (s) {\n  try {\n    eval (s);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof ReferenceError);\n  }\n}\n\ncheck_reference_error ('v_0 = {0: delete 3. instanceof foo() ^ {} }');\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2802.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(2e23 == 1.9999999999999998e+23);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2805.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrayBindNoArgs = Array.bind (this);\nvar bindWithArgs = arrayBindNoArgs.bind (this, 1, 2);\nvar array = new bindWithArgs ();\nassert (array instanceof Array);\nassert (array[0] === 1);\nassert (array[1] === 2);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-281.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nwhile(false) foo\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2822.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass Animal {\n    constructor() {\n        eval();\n    }\n    explain() { }\n}\nclass Dog extends Animal {\n    constructor() {\n        super()\n    }\n}\nclass Doge extends Dog {\n    whoAmI() {}\n}\n\nvar d = new Doge;\nassert (typeof d === \"object\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2823.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass myArray extends Array {}\nassert (!(undefined instanceof myArray));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2825.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar $;\nvar called = false;\n\nfunction f() {}\nvar B = class extends f {\n    constructor() {\n        eval();\n        super($)\n        this.g()\n    }\n}\nC = class extends B {\n    g() {\n        (() => {\n          called = true;\n        })()\n    }\n}\nD = class extends C {\n    constructor() {\n        super()\n    }\n    g() {\n        eval('super[\"g\"]')()\n    }\n}\nnew D\nassert (called);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2842.mjs",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function $ () { var $, b }\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2848.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrayBuffer = new ArrayBuffer;\nvar dataView = new DataView(arrayBuffer);\nassert (dataView.buffer === arrayBuffer);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-285.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nNaN == RegExp;\nNaN == Date;\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2850.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  (function () {\n    var d = new DataView(new ArrayBuffer())\n    for (var $; ;) {\n      d.setInt8(0)\n    }\n  })()\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2851.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction a (n) {\n  var array = new Int32Array(n)\n  var array2 = new Int32Array(array)\n  array2.set(new Uint8Array(array.buffer, 34))\n}\n\na(10)\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2852.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction createMap (count) {\n  var map = new Map()\n  for (var i = 0; i < count; i++) {\n    map.set(i)\n  }\n  return map\n}\n\nvar counter = 0;\ncreateMap(2000).forEach(function ($, key) {\n  counter++;\n  $ += key\n})\n\nassert(counter === 2000);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2853.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar map = new Map()\nmap.set()\nmap.set('bar')\n\nvar count = 0\nmap.forEach(function () {\n  if (count === 0) {\n    map.delete('bar')\n  }\n  count++;\n})\n\nassert(count === 1);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2854.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar buffer = new ArrayBuffer()\nvar dataView = new DataView(buffer, 0, undefined)\n\nassert(dataView.byteLength === 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2891.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nfunction f (name){\n  delete this.keywords[name];\n  assert (false);\n}\n\ntry {\n  f (\"jerry\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2895.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction createMap (count) {\n  var map = new Map ( )\n  for (var i = { member : 0, valueOf: function () { return this.member } }; i < count ; i ++) {\n    map.set(i);\n  }\n  return map\n}\ncreateMap(2000).forEach(function($, $) {})\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2905.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar func = function () {\n  foo.prototype = new Array(1, 2, 3);\n  function foo() {}\n  var f = new foo();\n  f.length = f;\n  try {\n    var a = \"Using f will give an error: \" + f;\n    assert(false);\n  } catch (e) {\n    assert(e instanceof RangeError);\n  }\n};\n\nfunc();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2910.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar map = new Map ; \nfor (var i = 0; i < 15 ; i ++ ) { map.set() } \nmap.forEach ( Number )\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2911.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar m = new Map;\nvar obj = { $: 0 };\nassert(m.set(\"strItem\", obj) === m);\ngc();\nassert(m.get(\"st\" + \"rItem\") === obj);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2914.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar func = function (number) {\n  \"use strict\";\n  number.foo = \"\";\n};\n\nvar func2 = function (number) {\n  \"use strict\";\n  number.bar = \"\";\n};\n\ntry {\n  func(-334918463);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Object.defineProperty(Number.prototype, \"foo\", { get : function() { throw ReferenceError(\"foo\"); },\n                                                   set : function(a) { throw ReferenceError(\"bar\"); },\n                                                 });\n  func(-334918463);\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n  assert(e.message === \"bar\");\n}\n\nvar setter_called = false;\nObject.defineProperty(Number.prototype, \"bar\", { get : function() { assert(false) },\n                                                 set : function(a) { setter_called = true; },\n                                               });\nfunc2(-334918463);\nassert(setter_called === true);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2936.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar 测试 = \"您好\";\nassert(测试 === \"您好\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2937.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar c = 0;\nvar p1 = this[c++];\nassert (p1 === undefined);\nassert (c === 1);\n\nvar p2 = this[c--];\nassert (p2 === undefined);\nassert (c === 0);\n\nvar p3 = this[++c];\nassert (p3 === undefined);\nassert (c === 1);\n\nvar p4 = this[--c];\nassert (p4 === undefined);\nassert (c === 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2947.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(new Uint32Array(Array(undefined, 9040650076)).findIndex(function (p_0) { return p_0 }) === 1);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2948.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  new (new Object()).constructor().constructor('abcdefghi').repeat(-4956799914495204378)\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2950.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = new Map();\nvar iterator = str[ Symbol.iterator ]();\n\ntry {\n  iterator.next.call({ })\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2951.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// To trigger the assertion the engine must be compiled with --system allocator=ON and --mem-stress-test=ON\nm = new Map([]);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2975.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Import/export statements must be in the global scope. */\nvar eval = eval.bind();\ntry {\n  eval('import { c } from \"tests/jerry/es.next/module-export-01.mjs\";');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-2990.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass A {\n  constructor() {\n    this.id = 50000;\n  }\n\n  getid(a) {\n    if (typeof a === 'number') {\n      this.id += a;\n    }\n    return this.id;\n  }\n}\n\nclass B extends A {\n  constructor() {\n    super();\n    this.id = 100;\n  }\n\n  getid_A() {\n    return super.getid.call(this);\n  }\n\n  getid_B(a) {\n    return super.getid.call(this, a);\n  }\n  getid_C(a) {\n    var fn = super.getid.bind(this);\n    return fn(a);\n  }\n}\n\nvar obj = new B();\n\nassert (obj.getid_A() === 100);\nassert (obj.getid_B(1) === 101);\nassert (obj.getid_C(1) === 102);\nassert (obj.id === 102);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3039.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = [];\nfor (var i = 0; i < 200; ++i) {\n  a[ i ] = 0;\n}\n\na.length = 1;\nfor (var i = 0; i < 5; ++i) {\n  a[ i ] = 0;\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3040.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar map = new Map();\nvar array = Array();\nmap.set(array);\nassert(map.has(array));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3043-3046.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// issue #3046\nvar map = new Map();\nvar array = [1.5];\nmap.set(array);\nassert(map.has(array));\n\n// issue #3043\nmap = new Map();\narray = [0];\nmap.set(array);\nassert(map.has(array));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3045.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar set = new Set();\nset.add();\nassert(!set.has([1]));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3048.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nthis[delete $];\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3049.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar func = function (a, b) { return a + b };\nassert(['A'].findIndex(func) == 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3050.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar counter = 0;\nvar expected = [0];\n\nvar b = [$];\nfunction dConstr () { }\ndConstr.prototype = b;\nvar d = new dConstr()\nfor (var $ in d) {\n  counter++;\n  assert($ in expected);\n}\n\nassert(counter === 1);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3055.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nvar src = '(function () {'\nfor (var i = 0; i < 550; i++) { src += 'var a' + i + ' = 5; ' }\nsrc += '})()'\neval(src)\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3060.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arr = [];\narr.length = 10;\narr.splice(0, 17);\narr.length = 4294967294;\narr.splice(1, 1, 1);\n\nassert(arr.length === 4294967294);\nassert(arr[0] === undefined);\nassert(arr[1] === 1);\nassert(arr[2] === undefined);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3062.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar map = new Map();\nvar obj = Object.freeze({});\nmap.set(obj, 1);\nassert(map.has(obj));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3063.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = \"123\" + \"test123\";\n\ntry {\n  str.repeat([1073741823]);\n  assert(false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3067.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Test case minimalized from issue #3067\n\nfunction f () { }\n\nclass B extends f {\n  constructor () {\n    super (0)\n    super.$\n    this.$ = $\n  }\n}\n\ntry {\n  var b = new B;\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3068.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arr = [0, Infinity];\nObject.defineProperties(arr, {\n    length: {\n    value: 1,\n    }\n});\n\nassert(arr.length === 1);\nassert(arr[0] === 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3070.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r = new RegExp(\"([X]{6}|.*)\", \"g\");\nvar s = \"a\";\ns.replace(r, () => r.compile(\"[PqaCZlWQUT]{0}\", \"m\"));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3072.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arr = [ , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ];\narr [4294967294] = 0\nassert (arr.length === 4294967295);\nassert (arr[4294967294] === 0);\n\nvar arrb = new ArrayBuffer(13);\n\ntry {\n  var d = new DataView(arrb, 12, -Infinity);\n  d.setFloat32(1, 1);\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3078.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrb = new ArrayBuffer(13);\nvar arr = new Uint8Array(arrb, 9);\nfor (var idx = 0; idx < arr.length; idx++) {\n  arr[idx] = idx + 1;\n}\n\nassert(arr.slice(1).toString() == \"2,3,4\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3079.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor (b = 0; b < 100; b++) {\n    var setv = new Set();\n    setv.add(1);\n    setv.add(Math.SQRT2);\n    setv.forEach(function(value, key, set) {\n        setv.clear();\n        (eval)(\"\" + 123);\n    });\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3082.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {\n  a: \"str\",\n  b: function() {},\n  c: true\n}\n\nassert (JSON.stringify (obj) === \"{\\\"a\\\":\\\"str\\\",\\\"c\\\":true}\");\nassert (JSON.stringify (obj, null, 2) === \"{\\n  \\\"a\\\": \\\"str\\\",\\n  \\\"c\\\": true\\n}\");\n\nvar obj = {\n  f: function() {}\n}\n\nassert (JSON.stringify (obj) === \"{}\");\nassert (JSON.stringify (obj, null, 2) === \"{}\");\n\nvar obj = {\n  f: function() {},\n  a: null\n}\n\nassert (JSON.stringify (obj) === \"{\\\"a\\\":null}\");\nassert (JSON.stringify (obj, null, 2) === \"{\\n  \\\"a\\\": null\\n}\");\n\nvar obj = {\n  a: false,\n  f: function() {}\n}\n\nassert (JSON.stringify (obj) === \"{\\\"a\\\":false}\");\nassert (JSON.stringify (obj, null, 2) === \"{\\n  \\\"a\\\": false\\n}\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3084.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(\"\".repeat(1.1) === \"\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3095.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass $ {\n  set ( ) {\n    switch ( $ ) { }\n  }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3097.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nswitch ($) {\n  case $: function $( $ = $, ... c ) { }\n  case $ :\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3105.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = String.fromCharCode([-10] + \"123\", Date.UTC(15, 13, 15));\nstr.repeat(11);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3106.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar symbol = Symbol();\nvar arr = [{}];\nwith (arr.pop()){\n    arr.push(symbol.valueOf());\n}\n\ntry {\n  arr.length = String.fromCharCode(Object.freeze(arr));\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3107.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arr = new Int8Array(200);\nvar result = arr.copyWithin(100, 14, 5);\n\nassert (arr === result);\n\nfor (i = 0; i < 200; i++)\n{\n    assert (arr[i] === 0);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3109.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrb = new ArrayBuffer(14);\n\ntry {\n  var arr = new DataView(arrb, 13, Infinity);\n  assert(false);\n  arr.setUint32(9, -65536);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3114.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction $() {\n  var id_0 = $.SIMD.id_1;\n  var id_1 = id_2.check;\n  var id_3 = id_4;\n  var id_5 = id_6.id_7;\n  var id_7 = id_8.id_9;\n  var id_9 = id_10;\n  var id_11 = id_12;\n  var id_13 = id_14;\n  var id_15 = id_16;\n  var id_17 = id_18;\n  var id_19 = id_20;\n  var id_21 = id_22;\n  var id_23 = id_24;\n  var id_25 = id_26;\n  var id_27 = id_28;\n  var id_29 = id_30.and;\n  var id_31 = id_32.or;\n  var id_33 = id_34.xor;\n  var id_35 = id_36.not;\n  var id_37 = id_38;\n  var id_39 = id_40;\n  var id_41 = id_42.id_43;\n  var id_43 = id_44.id_45;\n  var id_45 = id_46.store\n  var id_47 = id_48.id_49;\n  var id_49 = id_50.id_51;\n  var id_56 = id_57.splat;\n  var id_58 = id_59;\n  var id_60 = id_61.id_62;\n  var id_62 = id_63.abs;\n  var id_64 = id_65.neg;\n  var id_66 = id_67.add;\n  var id_68 = id_69.sub;\n  var id_70 = id_71.mul;\n  var id_72 = id_73.div;\n  var id_74 = id_75.min;\n  var id_76 = id_77.max;\n  var id_78 = id_79.sqrt;\n  var id_80 = id_81.id_82;\n  var id_82 = id_83.shuffle;\n  var id_84 = id_85.lessThan;\n  var id_86 = id_87.lessThanOrEqual;\n  var id_88 = id_89.equal;\n  var id_90 = id_91.notEqual;\n  var id_92 = id_93.greaterThan;\n  var id_94 = id_95.greaterThanOrEqual;\n  var id_96 = id_97.select;\n  var id_98 = id_99.load;\n  var id_100 = id_101.id_102;\n  var id_102 = id_103.id_104;\n  var $ = id_105.id_106;\n  var id_106 = id_107;\n  var id_108 = id_109.id_110;\n  var id_110 = id_111;\n  var id_112 = id_113;\n  var fround = stdlib.Math.fround;\n  var id_114 = id_115(imports.asmModule);\n  var id_116 = id_117;\n  var id_118 = id_119(5033.2, 3401.0, 665.34, 32234.1);\n  var id_120 = id_121(1065353216, 1073741824, 1077936128, 1082130432);\n  var gval = 1234;\n  var id_126 = $.id_127;\n  var id_127 = $.$;\n\n  function id_165() {\n    value = id_166;\n    id_167(id_168)\n  }\n\n  function id_169() {\n    return id_170(id_171)\n  }\n\n  function id_172() {\n    $ = id_173;\n    id_174(id_175)\n  }\n\n  function id_176() {\n    return id_177(id_178)\n  }\n\n  function id_179() {\n    $ = id_180;\n    id_181(id_182)\n  }\n\n  function id_183() {\n    return id_184(id_185)\n  }\n\n  function id_186() {\n    $ = id_187;\n    id_188(id_189)\n  }\n\n  function id_190() {}\n\n  function id_193() {\n    $ = id_194;\n    id_195(id_196)\n  }\n\n  function $() {}\n\n  function id_200() {\n    id_201(id_202, id_203);\n    return id_204(id_205)\n  }\n\n  function id_206() {\n    var $ = id_208;\n    while ($) {\n      id_209 = id_210;\n      for (;;) {\n        switch ($) {\n          case $:\n            id_211(id_212, id_213);\n          case $:\n            id_214(id_215, id_216);\n          case $:\n            id_217(id_218, id_219);\n          case $:\n            id_220(id_221, id_222)\n        }\n        id_223 = id_224(id_225, id_226)\n      }\n\n    }\n\n    return id_227(id_228)\n  }\n\n  function id_229() {\n    var $ = id_231;\n    for (;;) {\n      id_232 = id_233;\n      for (;;) {\n        switch ($) {\n          case $:\n            id_234(id_235, id_236);\n          case $:\n            id_237(id_238, id_239);\n          case $:\n            id_240(id_241, id_242);\n          case $:\n            id_243(id_244, id_245)\n        }\n        id_246 = id_247(id_248, id_249)\n      }\n\n    }\n\n    return id_250(id_251)\n  }\n\n  function id_252() {\n    var $ = id_254;\n    do {\n      id_255 = id_256;\n      for (;;) {\n        switch ($) {\n          case $:\n            id_257(id_258, id_259);\n          case $:\n            id_260(id_261, id_262);\n          case $:\n            id_263(id_264, id_265);\n          case $:\n            id_266(id_267, id_268)\n        }\n        id_269 = id_270(id_271, id_272)\n      }\n\n    }\n    while ($) return id_273(id_274)\n  }\n\n  function id_275() {\n    var $ = id_277;\n    while ($) {\n      id_278 = id_279;\n      for (;;) {\n        id_280(id_281, id_282);\n        id_283 = id_284(id_285, id_286)\n      }\n\n    }\n\n    return id_287(id_288)\n  }\n\n  function id_289() {\n    var $ = id_291;\n    while ($) {\n      id_292 = id_293;\n      for (;;) {\n        id_294(id_295, id_296);\n        id_297 = id_298(id_299, id_300)\n      }\n\n    }\n\n    return id_301(id_302)\n  }\n\n  function id_303() {\n    var $ = id_305;\n    while ((loopIndex) < (loopCOUNT)) {\n      id_306 = id_307;\n      for (;;) {\n        id_308(id_309, id_310);\n        id_311 = id_312(id_313, id_314)\n      }\n\n    }\n\n    return id_315(id_316)\n  }\n\n  function id_317() {\n    var $ = id_319;\n    while ($) {\n      id_320 = id_321;\n      for (;;) {\n        id_322(id_323, id_324);\n        id_325 = id_326(id_327, id_328)\n      }\n\n    }\n\n    return id_329(id_330)\n  }\n\n  function id_331() {\n    var $ = id_333;\n    while ($) {\n      id_334 = id_335;\n      for (;;) {\n        id_336(id_337, id_338);\n        id_339 = id_340(id_341, id_342)\n      }\n\n    }\n\n    return id_343(id_344)\n  }\n\n  function id_345() {\n    var $ = id_347;\n    while ($) {\n      id_348 = id_349;\n      for (;;) {\n        id_350(id_351, id_352);\n        id_353 = id_354(id_355, id_356)\n      }\n\n    }\n\n    return id_357(id_358)\n  }\n\n  function id_359() {\n    var $ = id_360;\n    while ($) {\n      for (;;) {\n        switch (functionPicker) {\n          case $:\n            v = id_361(id_362);\n          case $:\n            $ = id_363(id_364);\n          case $:\n            $ = id_365(id_366);\n          case $:\n            $ = id_367(id_368, idx)\n        }\n      }\n\n    }\n\n  }\n\n  function id_369() {\n    var $ = id_370;\n    for (;;) {\n      for (;;) {\n        switch ($) {\n          case $:\n            $ = id_371(id_372);\n          case $:\n            $ = id_373(id_374);\n          case $:\n            $ = id_375(id_376);\n          case $:\n            $ = id_377(id_378)\n        }\n      }\n\n    }\n\n  }\n\n  function id_379() {\n    var $ = id_380;\n    do {\n      for (;;) {\n        switch ($) {\n          case $:\n            $ = id_381(id_382);\n          case $:\n            $ = id_383(id_384);\n          case $:\n            $ = id_385(id_386);\n          case $:\n            $ = id_387(id_388)\n        }\n      }\n\n    }\n    while ($)\n  }\n\n  function id_389() {\n    var $ = id_390;\n    while ($) {\n      for (;;) {\n        $ = id_391(id_392)\n      }\n\n    }\n\n  }\n\n  function id_393() {\n    var $ = id_394;\n    end = (((length)))\n  }\n\n  function id_397() {\n    var $ = id_398;\n    while ($) {\n      for (;;) {\n        $ = id_399(id_400)\n      }\n\n    }\n\n  }\n\n  function id_401() {\n    var $ = id_402;\n    while ($) {\n      for (;;) {\n        $ = id_403(id_404)\n      }\n\n    }\n\n  }\n\n  function id_405() {\n    while ($) {\n      for (;;) {\n        $ = id_407(id_408)\n      }\n\n    }\n\n  }\n\n  function id_409() {\n    var $ = id_410;\n    while ($) {\n      for (;;) {\n        $ = id_411(id_412)\n      }\n\n    }\n\n  }\n  return {\n    changeHeap: ch,\n    id_413: id_414,\n    id_415: id_416,\n    id_417: id_418,\n    id_419: id_420,\n    id_421: id_422,\n    id_423: id_424,\n    id_425: id_426,\n    id_427: id_428,\n    id_429: id_430,\n    id_431: id_432,\n    id_433: id_434,\n    id_435: id_436,\n    id_437: id_438,\n    id_439: id_440,\n    id_441: id_442,\n    id_443: id_444,\n    id_445: id_446,\n    id_447: id_448,\n    id_449: id_450,\n    id_451: id_452,\n    id_453: id_454,\n    id_455: id_456,\n    id_457: id_458,\n    id_459: id_460,\n    id_461: id_462,\n    id_463: id_464,\n    id_465: id_466,\n    id_467: id_468,\n    id_469: id_470,\n    id_471: id_472,\n    id_473: id_474,\n    id_475: id_476,\n    id_477: $\n  }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3129.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrb = new ArrayBuffer(1);\nvar arr = new Uint8Array(arrb);\narr.lastIndexOf(Number.NaN, -[4294967280]);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-316.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  v_1 = RegExp.prototype.test;\n  v_1(ReferenceError);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\ntry {\n  v_1 = RegExp.prototype.exec;\n  v_1(ReferenceError);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\ntry {\n  v_1 = RegExp.prototype.toString;\n  v_1(ReferenceError);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3162.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry { v0 = this.toString( )} catch ( $ ) { }\ntry { v1 = this.toLocaleString( ).localeCompare( )} catch ( $ ) { }\ntry { var v14 = Int8Array.from(((Array)(v0.length))) } catch ( $ ) { }\ntry { v14(v14.fill(v1)) } catch ( $ ) { }\ntry { v0(v14.toLocaleString( )) } catch ( $ ) { }\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3204.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc3204_1 () {\n  (new Int16Array(7029)).subarray(5812).reduce(function() { })\n})();\n\n(function tc3204_2 () {\n  (new (Uint8Array)((new (ArrayBuffer)(\"5\")), EvalError.length)).reduceRight(function() { })\n})();\n\n(function tc3204_3 () {\n  var v0 = (((new ((new ((new Object).constructor)).constructor)).constructor)(\"\")).split( )\n  var $ = (new Float64Array(7652)).subarray(1872).reduce((new (v0.filter.constructor)))\n})();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3222.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar v0 = (Array((((new String).split().constructor)(Symbol( )))))\n\ntry {\n  var $ = (new Uint8ClampedArray).set((new ((new constructor).constructor(this).Uint32Array)), v0)\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3229.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar NISLFuzzingFunc = function(e) {\n  Number(0).toString(e);\n};\n\nvar NISLParameter4 = \"Hello Jerry\";\n\ntry {\n  NISLFuzzingFunc(NISLParameter4);\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\ntry {\n  Number.prototype.toString.call(-Infinity, \"Unicorn invasion\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3237.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrayBufferVar1 = new ArrayBuffer(12, 8);\nvar arrayVar1 = new Uint8Array(arrayBufferVar1, 9);\narrayVar1.lastIndexOf(15, -Math.LOG10E);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3243.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  (new Int8Array((new ArrayBuffer()), 1, Infinity)).reverse()\n  assert(false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3250.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrowFn = () => { };\nassert (arrowFn.prototype === undefined);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3252.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    function NoParent ( ) { }\n    Number.constructor( NoParent, Symbol.hasInstance, { })\n    assert (false)\n} catch (e) {\n    assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3262.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert ((new Float64Array(Object('foobar').split())).every(function (p_0) { return p_0 }) === false);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3267.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar hasProp = $ => { }\nObject.preventExtensions(hasProp);\nassert (Object.isSealed(hasProp) === false);\n\nvar keys = Object.getOwnPropertyNames(hasProp);\nassert (keys.length === 2);\nassert (keys[0] === \"length\");\nassert (keys[1] === \"name\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3271.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction bar(a) {\n  assert(a[0] === 10);\n  a.hasOwnProperty(0);\n  assert(a[0] === 10);\n}\n\nfunction foo(a) {\n  assert(a === 20);\n  a = 10;\n  bar(arguments);\n}\n\nfunction barStrict(a) {\n  \"use strict\"\n  assert(a[0] === 20);\n  a.hasOwnProperty(0);\n  assert(a[0] === 20);\n}\n\nfunction fooStrict(a) {\n  \"use strict\"\n  assert(a === 20);\n  a = 10;\n  barStrict(arguments);\n}\n\nfoo(20);\nfooStrict(20);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3298.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar $ = { $: function ( $) { } };\n\nfunction g ( b = (local = $) ) {\n  var o ;\n  function f ( ) { return this === o }\n}\n\ng ()\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3302.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction g ( a, b = a ) {\n  function a ( ) { }\n  function $ ( ) { }\n  eval ( \"\" )\n}\ng ( );\n\n$ = function ( ) {\n  function x ( ) { }\n}\n\nfunction j ( ) { }\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3306.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  typeof(a);\n  let a;\n  assert (false);\n} catch (e) {\n  assert (e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3313.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(\"var\" + \"\\u2029\" + 'g\\\\u0065t: break get' );\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3325.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar text = 'x';\nassert (text.charAt(0) === \"x\");\nassert (text.charAt(-0.1) === \"x\");\nassert (text.charAt(-0.5) === \"x\");\nassert (text.charAt(-0.9) === \"x\");\nassert (text.charAt(0.85) === \"x\");\n\nassert (text.charAt(-0.5) !== \"\");\nassert (text.charAt(0.85) !== \"\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3348.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  [$, this.$] = [ ];\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3355.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar $ = $ => { }\n/ /\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3356.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar alpha = []; \nvar $ = {[$] : $} \nobj = {}  \nobj[ Symbol.isConcatSpreadable ] = \"\\O\"  \nalpha.concat(obj)\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3360.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction $ (b = [ ].$) { };\nassert ($() === undefined);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3361.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar fakeArray = { [ Symbol ] : 0};\nfakeArray[ Symbol.isConcatSpreadable ] = 2.756;\n[].concat(fakeArray);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3363.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (typeof x === 'undefined');\nlet { t: [ { a: b } ] } = { t: [ { a: 'a' } ] };\nassert (b === 'a');\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3364.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(eval(...[0]) === 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3376.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function () {\n  new Promise(isFinite.toString)\n})();\n\n(function () {\n  [ ] = [ ]\n})\n({})\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3381.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\na: function f() {return true;}\n\nassert (f() === true);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3383.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (typeof Function('[]', 0) == \"function\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-339.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry\n{\n  eval ('var y = 4e;');\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3390.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = Promise.resolve( 'a' );\nvar b = Promise.reject( 'b' );\nPromise.race( [ a , b ] ).then ( function ( x ) { var a , b ; [ a , b ] = [ 1 , 2 ]; String( a === 1 ); } , function ( x ) { } );\nPromise.race( [ b , a ] ).then ( function ( x ) { String ( false ) ;}, function ( x ) { } );\nPromise.race( [ , b , a ] ).then ( function ( x ) { String ( x === undefined ) ; }, function ( x ) { String ( false ); } );\nPromise.race( a ).then ( function ( x ) { String ( false ); }, function ( x ) { String ( x.name === \"TypeError\" ); } );\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3395.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfor (var [] of [[], []])\n    \"\".split(new RegExp())\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3396.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction i($, b = (eval(\"var x\"))) {\n    function x() {}\n    eval()\n}\ni()\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3397.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar $\n\n$++\n[ ]\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-340.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n'\\0'+'456';\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3408.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [0, 0, obj, 0, 0];\narray.copyWithin(NaN, 67, 0);\nvar obj\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3409.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a;\nPromise.race([a]).then(function() {[] = []});\nPromise.race().then(function() {}, function() { throw \"'this' had incorrect value!\"})\n\nvar a = Promise.resolve('a');\nvar b = Promise.reject('b');\nPromise.race([a, b]).then(function(x) {\n    var [a, b] = [1, 2];\n}, function(x) {});\nPromise.race([b, a]).then(function(x) {}, function(x) {});\nPromise.race([, b, a]).then(function(x) {}, function(x) {});\nPromise.race(a).then(function(x) {}, function(x) {\n    String(i.name === \"TypeError\");\n});\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-341.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry\n{\n  eval ('\\xbf\\x0a\\x0a');\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3411.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a;\nPromise.race([a]).then(function() {[] = []});\nPromise.race().then(function() {}, function() { throw \"'this' had incorrect value!\"})\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3419.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval ('Function(\"[]\", 0)()');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3420.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  Array.from.call(String, $);\n  function $() {}\n  assert(fasle);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3421.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright 2014 the V8 project authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nfor (let [] of [[],[]]);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3422.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (typeof RegExp('{}') === \"object\");\nlet {t: []} = {t: []};\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3431.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval ('function g({[\"y\"]: []}) {}; g({xy: {}})');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  eval ('function g([], {}, [], {}) {}; g()');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3434.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction g({\n    [\"y\"]: {\n        get = 5\n    }\n}) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3437.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n[...RegExp.prototype.compile] = ([]);\n\nassert(RegExp.prototype.compile.length === 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3454.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\"use strict\"\ntry {\n  eval(\"var $ = function yield() {}\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3455.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  [...RegExp.$.$] = String();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar o = { a : { b : { c : { d: { e : { } } } } } };\n\n[...o.a.b.c.d.e] = \"foo\";\n\nassert(o.a.b.c.d.e.length === 3);\nassert(o.a.b.c.d.e[0] === \"f\");\nassert(o.a.b.c.d.e[1] === \"o\");\nassert(o.a.b.c.d.e[2] === \"o\");\n\n[o.a.b.c.d.e] = \"foo\";\n\nassert(o.a.b.c.d.e === \"f\");\n\n[this.o.a.b.c.d.e] = \"bar\";\nassert(this.o.a.b.c.d.e === \"b\");\n\n[...this.o.a.b.c.d.e] = \"bar\";\nassert(this.o.a.b.c.d.e.length === 3);\nassert(this.o.a.b.c.d.e[0] === \"b\");\nassert(this.o.a.b.c.d.e[1] === \"a\");\nassert(this.o.a.b.c.d.e[2] === \"r\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3458.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass Animal {}\nclass Dog extends Animal {\n  static explain () {\n    super.f = 8\n  }\n}\n\nassert (Dog.f === undefined);\nassert (Animal.f === undefined);\n\nDog.explain ()\n\nassert (Animal.f === undefined);\nassert (Dog.f === 8);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3459.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass MyOtherArray {}\n\nclass MyNonArray extends Array {\n  static [Symbol.species] () {}\n}\n\ntry {\n  (() => MyNonArray)().prototype.slice.call(new MyNonArray((0) === 1))\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3467.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(new Function(\"return\")() === undefined);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3477.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction _p(arg1, arg2) {\n  return arg1 ? arg1 : arg2;\n}\n\nvar _ref;\nvar constructor = _p(this, (_ref = Object.getPrototypeOf(function (){})).call({}));\nassert(constructor === this);\n\ntry {\n  _p(this, (_ref += Object.getPrototypeOf(function (){})).call({}));\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3478.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.prototype[\"symbol\"] = 0;\nPromise.race([]);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3479.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass MyObservedArray extends Array {\n    constructor() {\n        super('\"use strict\"; var x = \"\\\\411\";')\n    } [Symbol]() {}\n}\n\nnew MyObservedArray().slice()\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3483.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction assertThrows(src) {\n  try {\n    eval(src);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n\nassertThrows('Setting `o.bar` to');\nassertThrows('Setting `o.bar`; Setting `o.bar` to');\nassertThrows('Setting `o.bar`; Setting `o.bar`; Setting `o.bar` to');\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3485.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = new Float32Array([$])\n\ntry {\n  var $ = a.map(function () { $() });\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3519.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('function method () { [\"\"] = $ }');\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);  \n}\n\ntry {\n  eval (\"function mm () { [new.target] = 3; }\");\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3523.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {\n    sort: Array.prototype.sort,\n    $: 0\n}\nassert(obj.sort() === obj);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3527.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction assertThrows(src) {\n  try {\n    eval(src);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n\nassertThrows(`function $({\n  $: {\n      [$.$]\n  }\n}) {}`);\n\nassertThrows(`function $({\n  $: {\n      [$]\n  }\n}) {}`);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3532.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar reached = false;\n\nfunction dConstr () {}\ndConstr.prototype = [, ]\nfor (var $ in new dConstr()) {\n  reached = true;\n}\n\nassert(!reached);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3534.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [5.1, Infinity]\nReflect.preventExtensions(array);\n\nassert(array.pop() == Infinity);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3536.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass A {\n  constructor() {\n    var hasProp = $ => {}\n    Object.preventExtensions(hasProp);\n    assert(Object.isSealed(hasProp) === false);\n  }\n  super() {\n    $: $\n  }\n}\nclass B extends A {\n  constructor() {\n    super() (super.super)\n  }\n}\n\ntry {\n  new B;\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-354.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar data = {\n'1': '', '2': '', '3': '', '4': '', '5': '', '6': '', '7': '', '8': '',\n'9': '', '10': '', '11': '', '12': '', '13': '', '14': '', '15': '', '16': '',\n'17': '', '18': '', '19': '', '20': '', '21': '', '22': '', '23': '', '24': '',\n'25': '', '26': '', '27': '', '28': '', '29': '', '30': '', '31': '', '32': '',\n'33': '', '34': '', '35': '', '36': '', '37': '', '38': '', '39': '', '40': '',\n'41': '', '42': '', '43': '', '44': '', '45': '', '46': '', '47': '', '48': '',\n'49': '', '50': '', '51': '', '52': '', '53': '', '54': '', '55': '', '56': '',\n'57': '', '58': '', '59': '', '60': '', '61': '', '62': '', '63': '', '64': '',\n'65': '', '66': '', '67': '', '68': '', '69': '', '70': '', '71': '', '72': '',\n'73': '', '74': '', '75': '', '76': '', '77': '', '78': '', '79': '', '80': '',\n'81': '', '82': '', '83': '', '84': '', '85': '', '86': '', '87': '', '88': '',\n'89': '', '90': '', '91': '', '92': '', '93': '', '94': '', '95': '', '96': '',\n'97': '', '98': '', '99': '', '100': '', '101': '', '102': '', '103': '', '104': '',\n'105': '', '106': '', '107': '', '108': '', '109': '', '110': '', '111': '', '112': '',\n'113': '', '114': '', '115': '', '116': '', '117': '', '118': '', '119': '', '120': '',\n'121': '', '122': '', '123': '', '124': '', '125': '', '126': '', '127': '', '128': '',\n'129': '', '130': '', '131': '', '132': '', '133': '', '134': '', '135': '', '136': '',\n'137': '', '138': '', '139': '', '140': '', '141': '', '142': '', '143': '', '144': '',\n'145': '', '146': '', '147': '', '148': '', '149': '', '150': '', '151': '', '152': '',\n'153': '', '154': '', '155': '', '156': '', '157': '', '158': '', '159': '', '160': '',\n'161': '', '162': '', '163': '', '164': '', '165': '', '166': '', '167': '', '168': '',\n'169': '', '170': '', '171': '', '172': '', '173': '', '174': '', '175': '', '176': '',\n'177': '', '178': '', '179': '', '180': '', '181': '', '182': '', '183': '', '184': '',\n'185': '', '186': '', '187': '', '188': '', '189': '', '190': '', '191': '', '192': '',\n'193': '', '194': '', '195': '', '196': '', '197': '', '198': '', '199': '', '200': '',\n'201': '', '202': '', '203': '', '204': '', '205': '', '206': '', '207': '', '208': '',\n'209': '', '210': '', '211': '', '212': '', '213': '', '214': '', '215': '', '216': '',\n'217': '', '218': '', '219': '', '220': '', '221': '', '222': '', '223': '', '224': '',\n'225': '', '226': '', '227': '', '228': '', '229': '', '230': '', '231': '', '232': '',\n'233': '', '234': '', '235': '', '236': '', '237': '', '238': '', '239': '', '240': '',\n'241': '', '242': '', '243': '', '244': '', '245': '', '246': '', '247': '', '248': '',\n'249': '', '250': '', '251': '', '252': '', '253': '', '254': '', '255': '',\n'256': '',\n};\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3553.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar src = \"0?0:0+++++0\";\n\ntry {\n  eval (src);\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3580.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar func = function(val, idx) {\n    return val + idx\n};\n\nString([0, \"X\"].map(func).copyWithin([]));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3588.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Test if the native function as constructor is correctly invoked\n// when used as parent \"class\"\n\nclass C extends print {}\nnew C ()\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3589.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('[this,000000000,this,99999999=9999999]');\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\ntry {\n  eval('[this,999+=8]');\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-359.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f_0(a_0) {\n    \"use strict\";\n    Object.freeze({a: \"foo\"});\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3595.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Test if the native function as constructor is correctly invoked\n// when used as parent \"class\"\n\nvar src = \"({ $($) { a(...args) }\";\n\ntry {\n  eval (src);\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3606.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nvar expected = '{\"at\":true,\"copyWithin\":true,\"entries\":true,\"fill\":true,\"find\":true,\"findIndex\":true,\"flat\":true,\"flatMap\":true,\"includes\":true,\"keys\":true,\"values\":true}';\nassert(JSON.stringify(Array.prototype[Symbol.unscopables]) === expected);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3608.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar src = \"function $() { return $ ? $ : $ * $++() } switch ($) {}\";\n\ntry {\n  eval (src);\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3611.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar tcs = [\n  \"for (const [] of $)\",\n  \"for (const [] in $)\",\n  \"for (let [] of $)\",\n  \"for (let [] in $)\",\n  \"for (const {} of $)\",\n  \"for (const {} in $)\",\n  \"for (let {} of $)\",\n  \"for (let {} in $)\",\n];\n\nfor (let e of tcs) {\n  try {\n    eval (e);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n\n  try {\n    eval (e + \" {}\");\n    assert (false);\n  } catch (e) {\n    assert (e instanceof ReferenceError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3625.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar Base = function() {}.bind();\nObject.defineProperty(Base, 'prototype', {\n    get: function() {\n        return Int8Array + Function\n    }\n});\n\ntry {\n  class C extends Base {}\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3628.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar g = Array.bind(0, 0, 0, 0)\ng.prototype = Array;\nclass C extends g {}\nclass D extends C {\n    constructor(a, b, c) {\n        eval(\"eval ('super (a, b, c, d)')\")\n\n    }\n}\nvar d = new D\nassert(d.length === 7);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3630.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  {\n    class eval {}\n    eval()\n  }\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3636.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f() {}\nvar B = class extends f {\n    constructor() {\n        String(Reflect.setPrototypeOf(B, null));\n        super($)\n    }\n}\nC = class extends B {\n    g() {\n        return function() {}\n    }\n}\nD = class extends C {\n    constructor() {\n        super()\n    }\n    g() {}\n}\n\ntry {\n  new D\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3637.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = [1, 2, 3, 4];\nvar b = a.slice(0, { valueOf: function(){ a.length = 0; return 100; } });\n\nassert(b.length === 4);\n\nvar c = [1, 2, 3, 4];\nc.prop = 4\nvar d = c.slice(0, { valueOf: function(){ c.length = 0; return 100; } });\n\nassert(d.length === 4);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3640.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar B = class {}\neval = class extends B {}\n\ntry {\n  eval();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3641.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\neval = class extends SyntaxError {\n  constructor() {\n      super()\n  }\n}\n\ntry {\n  eval()\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3647.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nf();\nlet g;\nfunction f() {\n  assert(eval('function g() { return 5}; g')() === 5);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3648.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar func = function () {};\nvar boundFunc = func.bind();\nvar externalFunc = print;\nvar builtinFunc = unescape;\n\n[func, boundFunc, externalFunc, builtinFunc].forEach(function (e) {\n  assert (Array.prototype.sort.call(e) === e);\n})\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3650.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar u = 5;\nassert ([this, u = u - 1].length === 2);\nassert (u === 4);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3655.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nlet str = 'for (let i of id_36) function testcase() { testcase';\n\ntry {\n  eval (str);\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3656.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n$ => $++\n[ ]\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3658.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction g({\n  [\"y\"]: {\n      a\n  }\n})\n{\n  {\n    function a() {}\n  }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3665.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar idx1 = 32.6;\nvar idx2 = 42.7;\nvar obj = { [idx1] : { [idx2] : {}}};\n([obj[idx1][idx2]] = [5.7]);\n\nassert (obj[idx1][idx2] === 5.7);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3671.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {\n  get source() {\n      return \"Iam\"\n  },\n  [Symbol.match]: true\n}\n\nvar regexp = new RegExp(obj);\nassert(regexp.source === \"Iam\");\n\nObject.defineProperty(obj, 'flags', {'get' : function () {throw 42}});\n\ntry {\n  new RegExp(obj);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3711.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction func() {}\n\nvar bound = func.bind();\n\n/* original test case from the issue report */\nif (function() {\n  return func.bind()(0, 0, 0, 0, 0, 0, 0)\n}());\n\n/* various versions of the issue report */\n\n/* call the bound function with a lots of args */\nfor (var idx = 0; idx < 50; idx++) {\n    var args = new Array(idx);\n\n    bound.apply(undefined, args);\n\n    delete args;\n}\n\n/* bind the function with multiple args and invoke it */\nfor (var idx = 0; idx < 25; idx++) {\n    var args = new Array(idx);\n\n    func.bind.apply(func, args).apply(undefined, args);\n\n    delete args;\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3713.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction $(b = eval()) {\n    \"\"\n    eval()\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3715.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass B extends Array {\n    constructor() {\n        super();\n        super.f = 8;\n    }\n}\nvar arg = new B()\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3727.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nFunction(\"a = 5, b, c = function() { for (var a = 0; a < 4; a++) ; return a; } ()\", \"eval ('super (a, b, c, d)')\")\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3748-3749.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* try to trigger the gc a few times*/\nfor (var i = 0; i < 2; i++)\n{\n  new RegExp(32.2, \"g\")\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3751.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(`for (let i in {\n            id_0: 1\n        })\n\n        (function() {\n                i\n        `);\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3760.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar split = RegExp.prototype[Symbol.split];\n\ntry {\n  split.call({[Symbol.match]: \"g\"});\n  assert(false);\n} catch (ex) {\n  assert(ex instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3761.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar result = parseFloat (\"IE\");\nassert (isNaN (result));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3778.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (parseFloat (-0.00001) === -0.00001);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3779.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar array = [1, 2, 3];\nvar idx_50 = array.lastIndexOf(50, {\n    valueOf: function() {\n        // Trigger removing elements from fast array.\n        array.length = 0;\n    }\n})\n\nassert (idx_50 === -1);\n\nvar idx_51 = array.lastIndexOf(51, {\n    valueOf: function() {\n        array.push(51)\n        return 10;\n    }\n})\n\nassert (idx_51 === -1);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3784.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar expected = ['0', '1', '2', '3', '4', '5'];\nvar actual = [];\n\nvar v1 = typeof 13.37;\nvar v3 = Object(v1);\nvar v5 = [13.37,13.37];\nvar v6 = [v5];\nv3.__proto__ = v6;\n\nfor (var v7 in v3) {\n  actual.push(v7);\n}\n\nassert(actual.length === expected.length);\n\nfor (var i = 0; i < actual.length; i++) {\n  assert(actual[i] === expected[i]);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3785.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = new Proxy({length:2}, {});\na.__proto__ = a;\n\ntry {\n  a[1];\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\ntry {\n  a[1] = 2;\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\ntry {\n  Array.prototype.forEach.call(a, ()=>{});\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3787.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar symbol = Symbol(\"s\");\nvar obj = {demo: \"3\"};\nobj[symbol] = 3;\n\nvar proxy = new Proxy(obj, []);\nvar str = JSON.stringify(proxy);\n\nassert(str === '{\"demo\":\"3\"}');\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-380.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar v_0 = [];\nvar v_1 = [['\\u200E', '\\u0601', '\\u0602', '\\u0603', '\\u06DD', '\\u070F'],[0x1107, 0x1175, 0x11B0]];\nv_0[v_1];\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-381.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f_0(){\n    'use strict';\n    var v_0 = {\n        p_0: function(a_0, a_1) {}\n    };\n    f_1(function(a_2) {});\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3812.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f (a) {\n  assert(a[0] === '𞹴');\n}\n\nf`𞹴`;\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3813.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar o = Object(\"str\");\no.toString = function() { throw \"toString error\" };\n\ntry {\n  JSON.stringify(o);\n  assert(false);\n} catch (e) {\n  assert(e === \"toString error\");\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3814.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f () {}\n\nassert((new f) instanceof new Proxy(f, {}))\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3815.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction a() {}\n\ntry {\n  eval('(a()) = a');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3817.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar replace = RegExp.prototype[Symbol.replace];\nreplace.call({ exec : ( ) => { return {  } } }, '^o𓙦һ', \"a\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3819.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('typeof (global.v2) = 123');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3820.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('(isNaN(parseFloat(\".\"))) = \\'abcd\\'');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3821.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (script)\n{\n  try\n  {\n    eval (script);\n    assert (false);\n  }\n  catch (e)\n  {\n    assert (e instanceof SyntaxError);\n  }\n}\n\ncheck_syntax_error ('function')\ncheck_syntax_error ('function a')\ncheck_syntax_error ('function a\"')\ncheck_syntax_error ('function a\"b')\ncheck_syntax_error ('function a(\"b')\ncheck_syntax_error ('function a(b, \"c')\ncheck_syntax_error ('function a(b, c\"d')\ncheck_syntax_error ('function a(b, c)\"d')\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3822.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(`function f ({array, 'a', { value: 'foo', enumerable: true } : 36}){}`);\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3823.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(`function f ({\"aba,a\"}){}`);\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3824.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(`var a = {\"foo//b\", };`);\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3825.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(`var errorMessage = \"toStringThrows\"\n\n  var toStringThrows = {\n    \"foo//bar/baz//foo\"\n  }\n\n  try {\n    var obj = {};\n    obj[toStringThrows] = 3;\n    assert(false);\n  } catch (e) {\n    assert(e.message == errorMessage);\n  }\n  `);\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3836.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction validate_typedarray (typedarray, result) {\n  assert(typedarray.length === result.length);\n  for (var i = 0; i < typedarray.length; i++) {\n    assert(typedarray[i] === result[i]);\n  }\n}\n\nvar v1 = new Float64Array(6);\nv1.buffer.constructor = Uint8Array;\nvar v2 = new Float64Array(v1);\n\nassert(v2.buffer.constructor === Uint8Array);\nvalidate_typedarray(v2, [0, 0, 0, 0, 0, 0]);\n\nvar v3 = new Uint32Array(6);\nv3.buffer.constructor = Float64Array;\nvar v4 = new Uint8Array(v3);\n\nassert(v4.buffer.constructor === Float64Array);\nvalidate_typedarray(v4, [0, 0, 0, 0, 0, 0]);\n\nvar v5 = new Uint32Array(6);\nv5.buffer.constructor = Set;\nvar v6 = new Uint8Array(v5);\n\nassert(v6.buffer.constructor === Set);\nvalidate_typedarray(v6, [0, 0, 0, 0, 0, 0]);\n\nvar species_called = false;\n\nvar v7 = new Float64Array(6);\nvar v8 = v7.buffer;\nv8.constructor = {\n  get [Symbol.species] (){\n    species_called = true;\n    return Uint8Array;\n  }\n}\nvar v9 = new Float64Array(v7);\n\nassert(species_called);\nassert(Reflect.getPrototypeOf(v9.buffer) === Uint8Array.prototype);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3837.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction dummy ()\n{\n  \"D\" + \"a\";\n}\n\nvar p1Handler = { getOwnPropertyDescriptor: dummy };\nvar p1 = new Proxy({}, p1Handler);\n\nfunction dummyString ()\n{\n  return \"a\";\n}\n\nvar p2Handler = { deleteProperty: dummyString };\nvar p2 = new Proxy(p1, p2Handler);\n\nvar result = (delete p2[1]);\n\nassert (result);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3841.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('$?$:$=>{ }?{ }:$')\n  assert(false)\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3842.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('while(0 ? 0 : ()=>{} | {})')\n  assert(false)\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3845.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(`typeof (a) = 1 === 'undefined';`);\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3849.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(`[]=$--['']`);\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3856.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nlet str = '';\nfunction async() {}\n\nasync(str)\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3857.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction async() {}\n\nnew async\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3860.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  Object (...1, {});\n  assert (false);\n} catch (ex) {\n  // expected error: \"TypeError: object is not iterable\"\n  assert (ex instanceof TypeError);\n}\n\ntry {\n  Object (...1, {}, {});\n  assert (false);\n} catch (ex) {\n  // expected error: \"TypeError: object is not iterable\"\n  assert (ex instanceof TypeError);\n}\n\ntry {\n  Object (...1, { \"prop\": 2 }, 1, { \"prop\": 2 });\n  assert (false);\n} catch (ex) {\n  // expected error: \"TypeError: object is not iterable\"\n  assert (ex instanceof TypeError);\n}\n\ntry {\n  Object (...1, \"str\");\n  assert (false);\n} catch (ex) {\n  // expected error: \"TypeError: object is not iterable\"\n  assert (ex instanceof TypeError);\n}\n\ntry {\n  Object (...[], { \"prop\": 2 }, 1, { \"prop\": 2 }, ...1);\n  assert (false);\n} catch (ex) {\n  // expected error: \"TypeError: object is not iterable\"\n  assert (ex instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3861.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  (function() {\n    function* generatorFn() {}\n    g = generatorFn()\n    ownProto = Object.getPrototypeOf(g)\n    sharedProto = Object.getPrototypeOf(ownProto)\n    propertyIsEnumerable(sharedProto)\n  })()\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3862.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar target = function() {};\nvar handler = {\n    get() {\n        if ($);\n    }\n};\n\nvar o = new Proxy(target, handler);\n\ntry {\n  Reflect.construct(Function, ['c'], o);\n  assert(false);  \n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3866.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a;\nvar b;\nvar called = false;\nPromise.race([a, b]);\nPromise.race([b, a]);\nPromise.race([, b, a]);\nPromise.race().then(function() {}, function() {\n    let str;\n    function getStr() {\n        return $ `$`\n    }\n    var $ = getStr()\n}).catch(e => {\n  called = true;\n  assert (e instanceof TypeError);\n})\n\nfunction __checkAsync() {\n  assert(called);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3868.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = new Proxy({ a : 4, b :4}, {});\nvar reached = false;\n\nfor (var $ in a)\n{\n  reached = true;\n}\n\nassert (reached === true);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3869.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('function a ({ *x:x }) {}')\n  assert(false)\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3870.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (new RegExp(\"\\ud800\", \"u\").exec(\"\\ud800\")[0] === \"\\ud800\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3871.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  new RegExp('\"\\\\u', 'u');\n  assert (false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3878.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar d = new Date();\n\nvar s = d.setHours();\nassert (typeof s === \"number\" && isNaN (s));\n\nvar g = d.getHours();\nassert (typeof g === \"number\" && isNaN (g));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3880.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nRegExp.prototype.constructor = \"\"\nvar r = /a/;\nassert (r.test (\"a\"));\n\nRegExp.prototype.constructor = {}\nr = /b/;\nassert (r.test (\"b\"));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3888.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction i(id_0, b = (eval(\"var x\"))) {\n    function x() {}\n    eval(!eval(\"var x = {}; x instanceof assert;\"))\n}\ni()\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3893.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nObject.prototype.toString = function () {\n  return a`` ;\n};\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3903.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (\"abcde\".indexOf(\"\",1) === 1);\nassert (\"abcde\".lastIndexOf(\"\",1) === 1);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3908.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(\"async(a,b+)\")\n  assert(false)\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3934.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r = /(?:(?:^b?)*)*a/.exec(\"bbba\")\n\nassert (r !== null);\nassert (r.index === 3);\nassert (r[0] === \"a\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3935.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nconst obj = {};\nvar a = { a : (o) = 1 } = obj;\n\nassert (a === obj);\nassert (o === 1);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3944.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n[function(a, a) { (function() { a }) }()]\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3945.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction a() {\n  this[2] = { b : new Proxy(Function, {}) }\n}\n\nJSON.parse(\"[1, 2, []]\", a);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3950.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction a() {\n  this[2] = new Proxy(new function() { return new Array }, {})\n  return {}\n}\n\nJSON.parse(\"[1, 2, []]\", a);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-3975.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\na = 10\nb = new Uint8Array(a)\nfunction c() { d }\n\ntry {\n  b.sort(c);\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4013.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(\"\\ud800\".toUpperCase() === \"\\ud800\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4016-4019.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction checkSyntax(str) {\n  try {\n    eval(str);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n\ncheckSyntax(`function a ([{ catch (e) {\n  eval(\"var e\");\n} }])`);\n\n\ncheckSyntax(`function a ({\n  catch (e) {\n  eval(\"var e\");\n}})`);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4017.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  var v0 = Object.freeze (RegExp (\"foo\", \"g\")).compile ();\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4018.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n[\n  '\"\\\\ubad',\n].forEach(function(result = JSON.parse (str, function (k, v) {\n  return v;\n})) {\n  r = eval ('\"use ' + 's' + 't' + 'r' + 'i' + 'c' + 't\"; va' + 'r x = 1;');\n});\n\n// Better test\nfunction f(result = function () {}) {\n  var x = 1;\n  eval ('\"use strict\"; var x = 2; assert(x === 2)');\n  assert(x === 1)\n}\nf()\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4043.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f(a, b, c) { }\n\nObject.defineProperty(f, \"length\", {\n  writable: true,\n  configurable: true,\n  value: 10 ** 42\n});\n\nassert(f.bind().length == 10 ** 42);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4044.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = Int32Array.prototype;\na.__proto__ = [];\n\nvar b = a.splice(7, -4, 8, 9, 10);\n\nb.__proto__ = a;\nb.length = 5;\n\ntry {\n  b = b.concat([]);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4045.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = new Proxy(eval, {});\nvar b = {\n    y : 2\n};\nb.__proto__ = a;\n\nvar f = [];\nvar c = [];\nvar d = new Date();\nd.__proto__ = b;\na.__proto__ = f;\n\nc.__proto__ = d;\n\n\nvar a1 = new String();\na1.__proto__ = c;\n\nassert(a.__proto__ === f);\nassert(b.__proto__.__proto__ === f);\nassert(d.__proto__.__proto__ === a);\nassert(c.__proto__.__proto__.__proto__ === a);\nassert(a1.__proto__.__proto__.__proto__.__proto__ === a);\n\nvar e = []\na1.__proto__ = e;\n\nassert(a1.__proto__ === e);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4048.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Single non-enumerable property leak check with Object.assign, */\nvar from = {};\nObject.defineProperty (from, \"abc\", { enumerable: false, get: function() { return new String (\"demo\"); }})\nassert ((from.abc + \"\") === \"demo\");\n\nvar out = Object.assign ({}, from);\nassert (typeof (out.abc) === \"undefined\");\n\n/* Test with Proxy */\nvar called_get = false;\nvar called_keys = false;\nvar called_desc = false;\nvar called_extra_get = false;\n\nvar prox = new Proxy (from, {\n  get: function (target, key) {\n    assert (key === \"ERR\");\n    called_get = true;\n    throw new URIError(\"ERR\");\n  },\n  ownKeys: function (target) {\n    called_keys = true;\n    return [\"abc\", \"ERR\"];\n  },\n  getOwnPropertyDescriptor: function(target, key) {\n    if (key === \"ERR\") {\n      called_desc = true;\n      return { enumerable: true,\n               get: function() {\n                 /* This should never be called! */\n                 called_extra_get = true;\n                 return \"ABC\";\n               },\n               configurable: true,\n      };\n    }\n    return Reflect.getOwnPropertyDescriptor(target, key);\n  },\n});\n\ntry {\n  var prox_out = Object.assign ({}, prox);\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof URIError);\n}\n\nassert (called_keys === true);\nassert (called_desc === true);\nassert (called_get === true);\n\nassert (called_extra_get === false);\n\n/* Original test case from the issue report: test if there is a leak on exit. */\nvar result = Object.assign({}, RegExp);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4050.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(`function write([a] of { }\n    (function Test1() {\n        write(\"\");\n    });`);\n  assert(false);\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4051.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction foo() {\n  for (var i = 0; i < 3; i++) {\n    const N = class { };\n    function bar(a0) { }\n    assert(N.name === 'N');\n  }\n}\nfoo();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4052.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {};\nvar proxy = new Proxy(obj, {\n    getOwnPropertyDescriptor: function (target, property) {\n    },\n});\nvar proxy2 = new Proxy(proxy, {\n    a: obj.prop2++\n});\n\ntry {\n  Object.freeze(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Object.seal(proxy);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4054.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(\"var obj = { m() {super.8 = 17;} };\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4056.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar r = new RegExp('a');\n\nnew RegExp('1');\nnew RegExp('2');\nnew RegExp('3');\nnew RegExp('4');\nnew RegExp('5');\nnew RegExp('6');\nnew RegExp('7');\nnew RegExp('8');\n\nr.compile(r);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4059.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  new new Proxy(Function(), { get:String.fromCharCode })\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4093.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar v138 = {\n    ownKeys: function() { return []; },\n};\n\nvar v140 = new Proxy ({}, v138);\n\n/* expected an empty array */\nvar result = Object.getOwnPropertyNames (v140);\n\nassert (result instanceof Array);\nassert (result.length === 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4094.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f() {\n  var o1 = {e:[]};\n  var o2 = o1;\n\n  async function g(a,b) {\n      await b;\n      o2 = 13.37;\n  }\n  g(\"a\");\n}\nf();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4097.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction* g(a) {\n    yield* a;\n    return -3.14;\n}\n\ntry {\n  var iter = g(\"foo\" + \"bar\");\n  new WeakMap(iter);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4129.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(JSON.stringify(\"\\uD834\") === '\"\\\\ud834\"');\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4131.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar P = function (executor) {\n  return new Promise (function () {\n    executor (\n      function () {},\n      function () {\n        throw new TypeError ();\n      }\n    );\n  });\n};\n\ntry {\n  Promise.reject.call (P);\n  assert (false)\n} catch (e) {\n  assert ( e instanceof TypeError)\n}\n\nvar P = function (executor) {\n  return new Promise ( function() {\n    executor(\n      function () {\n        throw new TypeError ();\n      },\n      function () {}\n    );\n  });\n};\n\ntry {\n  Promise.resolve.call(P);\n  assert (false)\n} catch (e) {\n  assert ( e instanceof TypeError)\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4132.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction async(p) {\n  return p;\n}\n\nassert(async(\"X\",) === \"X\")\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4138.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (new Object (0n) == 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4139.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar b;\nassert(0n !== b);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4146.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// helper function - simple implementation\nArray.prototype.equals = function (array) {\n  if (this.length != array.length)\n    return false;\n\n  for (var i = 0; i < this.length; i++) {\n    if (this[i] instanceof Array && array[i] instanceof Array) {\n      if (!this[i].equals(array[i]))\n        return false;\n      }\n      else if (this[i] != array[i]) {\n        return false;\n    }\n  }\n\n  return true;\n}\n\nfunction longDenseArray(){\n        var a = [0];\n        for(var i = 0; i < 60; i++){\n                a[i] = i;\n        }\n        return a;\n}\n\nfunction shorten(){\n        currArray.length = 20;\n        return 1;\n}\n\nvar array = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,,,,,,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19];\nvar currArray = longDenseArray();\ncurrArray.copyWithin(25, {valueOf: shorten})\nassert (currArray.length == 44)\nassert (currArray.equals (array))\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4147.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar asyncFunProto = Object.getPrototypeOf (async function() {});\nassert (Object.prototype.toString.call (asyncFunProto) === \"[object AsyncFunction]\")\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4148.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar calls = 0;\nNumber.prototype.toLocaleString = function() {\n  return {\n    toString: function() {\n      calls++;\n      if (calls > 1) {\n        throw \"ERROR V\";\n      }\n    }\n  };\n};\n\nvar array = [42.333333, 2.3];\n\nvar sampleA = new Float32Array(array);\ntry {\n  sampleA.toLocaleString();\n} catch(ex) {\n  assert(ex === \"ERROR V\");\n}\nassert(calls === 2);\n\nvar sampleB = new Uint8Array(array);\ntry {\n  sampleB.toLocaleString();\n} catch(ex) {\n  assert(ex === \"ERROR V\");\n}\nassert(calls === 3);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4149.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nlet x;\ntry {\n  (0,eval)('var x');\n  assert(false)\n} catch (e) {\n  assert(e instanceof SyntaxError)\n}\n\n(0,eval)('function x() {};');\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4213.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arr = new BigInt64Array([39n]);\n\nvar result = arr.find(function() { return true; });\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4214.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar called = false; Promise.resolve('d').finally((v) => called = true);\n\nfunction __checkAsync() {\n    assert(called);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4234.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntry {\n  1 < Symbol(1)\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Symbol(1) < 1\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  1n < Symbol(1)\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  Symbol(1) < 1n\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4238.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    eval(\" \\\n    class foo { \\\n        constructor() { \\\n            function bar() {} \\\n        } \\\n    \")\n} catch (e) {\n    assert (e instanceof SyntaxError)\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4265.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    eval (\"export class Dog {constructor() {}}; for (var a\")\n} catch (e) {\n    assert (e instanceof SyntaxError)\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-429.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar v_0 = [\n    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n    16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,\n    32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,\n    48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,\n    64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,\n    80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,\n    96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,\n    112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,\n    128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,\n    144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,\n    160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,\n    176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,\n    192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,\n    208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,\n    224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,\n    240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255\n];\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4341.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Shifting a negative bigint value with a big number to the right should be -1n. */\nassert((-1n >> (2n ** 32n)) === -1n);\nassert((-1n >> 2n) === -1n);\nassert((-1n >> (2n ** 1n)) === -1n);\nassert((-5n >> 3n) === -1n);\nassert((-5n >> 4n) === -1n);\nassert((-(2n ** 32n) >> (2n ** 31n)) === -1n);\nassert((-(2n ** 32n) >> (2n ** 32n)) === -1n);\nassert((-(2n ** 32n) >> (2n ** 33n)) === -1n);\nassert((-(2n ** 32n) >> (2n ** 33000n)) === -1n);\nassert((-(2n ** 32n) >> 32n) === -1n);\n\n/* (xn << -yn) ==> (xn >> yn) */\nassert((-1n << -(2n ** 32n)) === -1n);\nassert((-1n << -2n) === -1n);\nassert((-1n << -(2n ** 1n)) === -1n);\nassert((-5n << -3n) === -1n);\nassert((-5n << -4n) === -1n);\nassert((-(2n ** 32n) << -(2n ** 31n)) === -1n);\nassert((-(2n ** 32n) << -(2n ** 32n)) === -1n);\nassert((-(2n ** 32n) << -(2n ** 33n)) === -1n);\nassert((-(2n ** 32n) << -(2n ** 33000n)) === -1n);\n\n/* Partialy related tests. */\nassert((-(2n ** 32n) >> 31n) === -2n);\nassert((-(2n ** 32n) >> 30n) === -4n);\nassert((-(2n ** 32n) >> 29n) === -8n);\nassert((-(2n ** 32n) >> 28n) === -16n);\nassert((-(2n ** 32n) >> 16n) === -65536n);\nassert((-(2n ** 32n) >> 2n) === -1073741824n);\n\nassert((-5n >> 2n) === -2n);\nassert((-5n >> -4n) === -80n);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4375.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(\"1_\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4385.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('P`${*\\x10$');\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4396.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction demo() {\n}\n\nvar proxy = new Proxy(demo, {});\nvar weakset = new WeakSet();\n\n/* Internal: WeakSet adds an extra internal property to the proxy object. */\nweakset.add(proxy);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4397.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f () {\n  RegExp(\"[\\\\s-a]\", \"u\");\n}\n\nvar arr = new Float64Array();\nassert(arr.reduceRight(SyntaxError, f, 'RegExp(\"[\\\\s-a]\", \"u\"): ') === f);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4398.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar get = [];\nvar constructor = Function();\nconstructor[Symbol.species] = Object;\nvar p = new Proxy({ constructor: constructor, flags: '', exec: function() { return null; } }, { set: function (x) { this.set = x === 42; } });\n\ntry {\n  RegExp.prototype[Symbol.split].call(p, 7996);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-440.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function () {\n  var d = {};\n  var a = [arguments];\n})();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4402.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar p = new Proxy(Function(), { get: function closure() { eval(\"o.p.y\"); delete closure; return closure == arguments.callee && !(new String(undefined)); }});\n\ntry {\n  Function.prototype.bind.call(p);\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4405.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arr = [1];\n\nvar ta = new Int8Array(arr);\nObject.setPrototypeOf(arr, ta);\narr[1] = 2;\n\ntry {\n  ta = new Int8Array(arr);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4408.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('/(?<=^abc)def/');\n} catch(e) {\n  assert(e instanceof SyntaxError);\n}\n\ntry {\n  eval('/(?a)/;')\n} catch(e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4413.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert((new (class C2 { x = 5 })).x === 5);\nassert((new (class C2 { x = {} + {} })).x === \"[object Object][object Object]\");\nassert((new (class C2 { [\"foo\"] = 5; x = {} + {} })).foo === 5);\nassert((new (class C2 { [\"foo\"] = 5; x = 6 })).foo === 5);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4432.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f(x,x,x) {\n  return arguments[1];\n}\n\nassert(f(1) === undefined);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4440.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar handler = {\n  get: function(target, key) {\n    assert(typeof(target) === 'function');\n    assert(key === 'dummy');\n    return 42;\n  }\n};\n\ntry {\n  throw new Proxy(Function(), handler);\n  assert(false);\n} catch (ex) {\n  /* 'ex' is the Proxy */\n  assert(typeof(ex) === 'function');\n  assert(ex.dummy === 42);\n}\n\ntry {\n  throw new Proxy(EvalError(), { });\n} catch (ex) {\n  assert(ex instanceof EvalError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4441.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar get = [];\nvar constructor = Function();\nconstructor[Symbol.species] = Object;\nvar p = new Proxy({ constructor: constructor, flags: '', exec: function() { return /\\ua796/iu; } }, { defineProperty: function(o, k) { get.push(k); return o[k]; }});\n\ntry {\n  RegExp.prototype[Symbol.split].call(p, 7996);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4442.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('0x1_');\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4445.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Keeping test as it is due to the fact this was triggered via a gc related issue\n\nvar a= [\"\", \"\\0\", \"\\t\", \"\\n\", \"\\v\", \"\\f\", \"\\r\", \" \", \"\\u00a0\", \"\\u2028\", \"\\u2029\", \"\\ufeff\"]\nArray.prototype[4] = 10;\n\nfunction Test()\n{\n  a.sort(function() {\n    var A = function() { };\n    A.prototype.x = 42;\n    var o = new Proxy({\n        \"3\": {\n          writable:false,\n          value:20\n        }\n      }, /*handler*/ {\n        getPrototypeOf: function (val, size, ch) {\n          var result = new String(val);\n          if (ch == null) {\n            ch = \" \";\n          }\n          while (result.length < size) {\n            result = ch + result;\n          }\n          return result;\n        }\n      }\n    );\n\n    o.x = 43;\n    var result = \"\";\n    for (var p in o) {\n        result += o[p];\n    }\n    return a | 0;\n  });\n\n  throw new EvalError(\"error\");\n}\n\ntry {\n  Test();\n  assert(false);\n} catch (ex) {\n  assert (ex instanceof EvalError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4446.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass Base {\n  constructor() {\n      return new Proxy(this, {\n          defineProperty(target, p, desc) {\n              return Reflect.defineProperty(target, p, desc);\n          }\n      });\n  }\n}\n\nlet computedKey = \"test\";\nclass BasicTPK extends Base {\n  [computedKey] = \"basic\";\n}\n\nlet instance = new BasicTPK;\nassert(instance instanceof BasicTPK);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4463.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction Test262Error(message) {\n  this.message = message || \"\";\n}\n\nTest262Error.prototype.toString = function () {\n  return \"Test262Error: \" + this.message;\n};\n\nvar newTarget = function () {}.bind(null);\nObject.defineProperty(newTarget, \"prototype\", {\n  get() {\n    throw new Test262Error();\n  },\n});\n\nvar typedArrayConstructors = [\n  Float64Array,\n  Float32Array,\n  Int32Array,\n  Int16Array,\n  Int8Array,\n  Uint32Array,\n  Uint16Array,\n  Uint8Array,\n  Uint8ClampedArray,\n];\n\nfor (var type of typedArrayConstructors) {\n  try {\n    Reflect.construct(Uint8ClampedArray, [], newTarget);\n  } catch (error) {\n    if (!(error instanceof Test262Error)) {\n      throw \"error must be instanceof Test262Error\";\n    }\n  }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4464.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = [3.3, 2.2, 1];\n\ntry {\na.sort(function() {\n    var o = new Proxy({\n        get foo() {\n            return eval(\"function\");\n        },\n        set foo(arg) {\n            return s2 = s3\n        }\n    }, {\n        has: true,\n        get: function() {\n            a = true;\n            return 30;\n        }\n    });\n    o.x = 43;\n    var result = \"\";\n    for (var p in o)\n        result += o[p];\n});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4466.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar called_get = false;\nvar targetProxy = new Proxy({}, {\n  getOwnPropertyDescriptor: function(target, key) {\n    throw new URIError(\"Generate error\");\n  }\n});\n\nvar px = new Proxy(targetProxy, {\n  get: function(target, key) {\n    called_get = true;\n    return { debug: 1 };\n  }\n});\n\ntry {\n  px.abc;\n  assert(false);\n} catch (ex) {\n  assert(ex instanceof URIError);\n  assert(called_get === true);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4468.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = 'for (let i=0; i<(eval(\"1; function x() { }; 2;\")); x - i++) { x += delete x;}'\n\nvar e = eval(str)\nassert(e === 'function x() { }true'\n       || e === 'function () { /* ecmascript */ }true');\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4469.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction assertArrayEquals(array1, array2) {\n  if (array1.length !== array2.length) {\n    return false;\n  }\n\n  for (var i = 0; i < array1.length; i++) {\n    if (array1[i] !== array2[i]) {\n      return false;\n    }\n  }\n\n  return true;\n}\n\nfunction tag(site){\n  return site;\n}\n\nvar site1 = eval(\"tag`Cocoa`\");\nvar site3 = eval(\"tag`Cocoa`\");\n\nassertArrayEquals(site1, site3);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-447.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry\n{\n  for (v_0 in v_1) {};\n  f_0(v_2.v_3 === 5);\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-453.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n    var v_0 = [\n        ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,     \n        ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,     \n        ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,     \n        ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,     \n        ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,     \n        ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,     ];\n    }\ncatch(e) {}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4532.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar NISLFuzzingFunc = function () {\n  var hookCallback;\n  function hooks() {\n      return hookCallback.apply();\n  }\n  function setHookCallback() {\n  }\n  function isArray() {\n  }\n  function isObject() {\n  }\n  function isObjectEmpty() {\n  }\n  function isUndefined() {\n  }\n  function isNumber() {\n  }\n  function isDate() {\n  }\n  function map() {\n  }\n  function hasOwnProp() {\n  }\n  function extend() {\n      for (var i in b) {\n          if (hasOwnProp()) {\n          }\n      }\n  }\n  function createUTC() {\n  }\n  function defaultParsingFlags() {\n  }\n  function getParsingFlags() {\n      if (m._pf == null) {\n          m._pf = defaultParsingFlags();\n      }\n  }\n  if (Array.prototype.some) {\n  } else {\n      some = function () {\n      };\n  }\n  function isValid() {\n      if (m._isValid == null) {\n          var flags = getParsingFlags();\n      }\n  }\n  function createInvalid() {\n      var m = createUTC();\n      if (flags != null) {\n          extend();\n      } else {\n      }\n  }\n  var momentProperties = hooks.momentProperties = [];\n  function copyConfig() {\n      if (!isUndefined()) {\n          to._isAMomentObject = from._isAMomentObject;\n      }\n  }\n  var updateInProgress = false;\n  function Moment() {\n      copyConfig();\n      if (updateInProgress === false) {\n      }\n  }\n  function isMoment() {\n  }\n  function absFloor() {\n  }\n  function toInt() {\n  }\n  function compareArrays() {\n  }\n  function warn() {\n  }\n  function deprecate() {\n  }\n  var deprecations = {};\n  function deprecateSimple() {\n  }\n  hooks.suppressDeprecationWarnings = false;\n  hooks.deprecationHandler = null;\n  function isFunction() {\n  }\n  function set() {\n  }\n  function mergeConfigs() {\n  }\n  function Locale() {\n  }\n  if (Object.keys) {\n  } else {\n      keys = function () {\n      };\n  }\n  var defaultCalendar = {\n      sameDay: '[Today at] LT',\n      nextDay: '[Tomorrow at] LT',\n      nextWeek: 'dddd [at] LT',\n      lastDay: '[Yesterday at] LT',\n      lastWeek: '[Last] dddd [at] LT',\n      sameElse: 'L'\n  };\n  function calendar() {\n  }\n  var defaultLongDateFormat = {\n      LTS: 'h:mm:ss A',\n      LT: 'h:mm A',\n      L: 'MM/DD/YYYY',\n      LL: 'MMMM D, YYYY',\n      LLL: 'MMMM D, YYYY h:mm A',\n      LLLL: 'dddd, MMMM D, YYYY h:mm A'\n  };\n  function longDateFormat() {\n  }\n  var defaultInvalidDate = 'Invalid date';\n  function invalidDate() {\n  }\n  var defaultOrdinal = '%d';\n  var defaultDayOfMonthOrdinalParse = /\\d{1,2}/;\n  function ordinal() {\n  }\n  var defaultRelativeTime = {\n      future: 'in %s',\n      past: '%s ago',\n      s: 'a few seconds',\n      ss: '%d seconds',\n      m: 'a minute',\n      mm: '%d minutes',\n      h: 'an hour',\n      hh: '%d hours',\n      d: 'a day',\n      dd: '%d days',\n      M: 'a month',\n      MM: '%d months',\n      y: 'a year',\n      yy: '%d years'\n  };\n  function relativeTime() {\n  }\n  function pastFuture() {\n  }\n  var aliases = {};\n  function addUnitAlias() {\n  }\n  function normalizeUnits() {\n  }\n  function normalizeObjectUnits() {\n  }\n  var priorities = {};\n  function addUnitPriority() {\n  }\n  function getPrioritizedUnits() {\n  }\n  function zeroFill() {\n  }\n  var formattingTokens = /(\\[[^\\[]*\\])|(\\\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;\n  var localFormattingTokens = /(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g;\n  var formatFunctions = {};\n  var formatTokenFunctions = {};\n  function addFormatToken() {\n  }\n  function removeFormattingTokens() {\n  }\n  function makeFormatFunction() {\n  }\n  function formatMoment() {\n  }\n  function expandFormat() {\n  }\n  var match1 = /\\d/;\n  var match2 = /\\d\\d/;\n  var match3 = /\\d{3}/;\n  var match4 = /\\d{4}/;\n  var match6 = /[+-]?\\d{6}/;\n  var match1to2 = /\\d\\d?/;\n  var match3to4 = /\\d\\d\\d\\d?/;\n  var match5to6 = /\\d\\d\\d\\d\\d\\d?/;\n  var match1to3 = /\\d{1,3}/;\n  var match1to4 = /\\d{1,4}/;\n  var match1to6 = /[+-]?\\d{1,6}/;\n  var matchUnsigned = /\\d+/;\n  var matchSigned = /[+-]?\\d+/;\n  var matchOffset = /Z|[+-]\\d\\d:?\\d\\d/gi;\n  var matchShortOffset = /Z|[+-]\\d\\d(?::?\\d\\d)?/gi;\n  var matchTimestamp = /[+-]?\\d+(\\.\\d{1,3})?/;\n  var matchWord = /[0-9]{0,256}['a-z\\u00A0-\\u05FF\\u0700-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFF07\\uFF10-\\uFFEF]{1,256}|[\\u0600-\\u06FF\\/]{1,256}(\\s*?[\\u0600-\\u06FF]{1,256}){1,2}/i;\n  var regexes = {};\n  function addRegexToken() {\n  }\n  function getParseRegexForToken() {\n  }\n  function unescapeFormat() {\n  }\n  function regexEscape() {\n  }\n  var tokens = {};\n  function addParseToken() {\n  }\n  function addWeekParseToken() {\n  }\n  function addTimeToArrayFromToken() {\n  }\n  var YEAR = 0;\n  var MONTH = 1;\n  var DATE = 2;\n  var HOUR = 3;\n  var MINUTE = 4;\n  var SECOND = 5;\n  var MILLISECOND = 6;\n  var WEEK = 7;\n  var WEEKDAY = 8;\n  addFormatToken('Y', function () {\n  });\n  addFormatToken(['YY'], function () {\n  });\n  addFormatToken(['YYYY'], 'year');\n  addFormatToken(['YYYYY']);\n  addFormatToken(['YYYYYY']);\n  addParseToken(function () {\n  });\n  addParseToken(function () {\n  });\n  addParseToken(function () {\n  });\n  function daysInYear() {\n  }\n  function isLeapYear() {\n  }\n  hooks.parseTwoDigitYear = function () {\n  };\n  var getSetYear = makeGetSet('FullYear');\n  function getIsLeapYear() {\n  }\n  function makeGetSet() {\n  }\n  function get() {\n  }\n  function set$1() {\n  }\n  function stringGet() {\n  }\n  function stringSet() {\n  }\n  function mod() {\n  }\n  if (Array.prototype.indexOf) {\n  } else {\n      indexOf = function () {\n      };\n  }\n  function daysInMonth() {\n  }\n  addFormatToken('Mo', function () {\n  });\n  addFormatToken('MMM', function () {\n  });\n  addFormatToken('MMMM', function () {\n  });\n  addUnitAlias('month');\n  addRegexToken(function () {\n  });\n  addRegexToken(function () {\n  });\n  addParseToken(function () {\n  });\n  addParseToken(function () {\n  });\n  var MONTHS_IN_FORMAT = /D[oD]?(\\[[^\\[\\]]*\\]|\\s)+MMMM?/;\n  var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');\n  function localeMonths() {\n  }\n  var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split();\n  function localeMonthsShort() {\n      if (!m) {\n          return isArray() ? this._monthsShort : this._monthsShort['standalone'];\n      }\n  }\n  function handleStrictParse() {\n  }\n  function localeMonthsParse() {\n  }\n  function setMonth() {\n  }\n  function getSetMonth() {\n  }\n  function getDaysInMonth() {\n  }\n  var defaultMonthsShortRegex = matchWord;\n  function monthsShortRegex() {\n  }\n  var defaultMonthsRegex = matchWord;\n  function monthsRegex() {\n  }\n  function computeMonthsParse() {\n  }\n  function createDate() {\n  }\n  function createUTCDate() {\n  }\n  function firstWeekOffset() {\n  }\n  function dayOfYearFromWeeks() {\n  }\n  function weekOfYear() {\n  }\n  function weeksInYear() {\n  }\n  addFormatToken('w', ['ww'], 'wo', 'week');\n  addFormatToken('W', ['WW'], 'Wo', 'isoWeek');\n  addWeekParseToken(function () {\n  });\n  function localeWeek() {\n  }\n  var defaultLocaleWeek = {\n      dow: 0,\n      doy: 6\n  };\n  function localeFirstDayOfWeek() {\n  }\n  function localeFirstDayOfYear() {\n  }\n  function getSetWeek() {\n  }\n  function getSetISOWeek() {\n  }\n  addFormatToken('do', 'day');\n  addFormatToken(function () {\n  });\n  addFormatToken('ddd', function () {\n  });\n  addFormatToken('dddd', function () {\n  });\n  addFormatToken('e', 'weekday');\n  addFormatToken('E', 'isoWeekday');\n  addRegexToken(function () {\n  });\n  addRegexToken(function () {\n  });\n  function parseWeekday() {\n  }\n  function parseIsoWeekday() {\n  }\n  var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split();\n  function localeWeekdays() {\n  }\n  var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split();\n  function localeWeekdaysShort() {\n  }\n  var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split();\n  function localeWeekdaysMin() {\n  }\n  function handleStrictParse$1() {\n  }\n  function getSetLocaleDayOfWeek() {\n  }\n  var defaultWeekdaysRegex = matchWord;\n  function weekdaysRegex() {\n  }\n  var defaultWeekdaysMinRegex = matchWord;\n  function hFormat() {\n  }\n  addParseToken('hmmss', function () {\n  });\n  function getSetGlobalLocale() {\n  }\n  var tzRegex = /Z|[+-]\\d\\d(?::?\\d\\d)?/;\n  var aspNetJsonRegex = /^\\/?Date\\((\\-?\\d+)/i;\n  function configFromISO() {\n  }\n  function configFromStringAndArray() {\n  }\n  function configFromObject() {\n  }\n  function createFromConfig() {\n  }\n  function prepareConfig() {\n  }\n  var prototypeMin = deprecate('moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () {\n  });\n  var prototypeMax = deprecate('moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () {\n  });\n  function pickBy() {\n  }\n  function max() {\n  }\n  var now = function () {\n  };\n  var ordering = [];\n  function isValid$1() {\n  }\n  function offset() {\n  }\n  function offsetFromString() {\n  }\n  function cloneWithOffset() {\n  }\n  function getSetZone() {\n  }\n  function setOffsetToUTC() {\n  }\n  function setOffsetToLocal() {\n  }\n  function hasAlignedHourOffset() {\n  }\n  function isDaylightSavingTime() {\n  }\n  function isDaylightSavingTimeShifted() {\n  }\n  function createAdder() {\n  }\n  function addSubtract() {\n  }\n  var add = createAdder();\n  var subtract = createAdder();\n  function getCalendarFormat() {\n  }\n  function calendar$1() {\n  }\n  function clone() {\n  }\n  function isAfter() {\n  }\n  function isBefore() {\n  }\n  function isBetween() {\n  }\n  function isSame() {\n  }\n  function isSameOrAfter() {\n  }\n  function isSameOrBefore() {\n  }\n  function diff() {\n  }\n  hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';\n  function toString() {\n  }\n  function inspect() {\n  }\n  function format() {\n  }\n  function from() {\n  }\n  function fromNow() {\n  }\n  function to() {\n  }\n  function toNow() {\n  }\n  function locale() {\n  }\n  var lang = deprecate('moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function () {\n  });\n  function localeData() {\n  }\n  function startOf() {\n  }\n  function endOf() {\n  }\n  function valueOf() {\n  }\n  function unix() {\n  }\n  function toDate() {\n  }\n  function toArray() {\n  }\n  function toObject() {\n  }\n  function toJSON() {\n  }\n  function isValid$2() {\n  }\n  function parsingFlags() {\n  }\n  function invalidAt() {\n  }\n  var proto = Moment.prototype;\n  proto.parsingFlags = parsingFlags;\n  return \"42\"\n};\nvar NISLCallingResult = NISLFuzzingFunc();\nassert(NISLCallingResult === \"42\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4747.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = new Int32Array(256);\ntry {\n    a.sort(function () {\n        var o = new Proxy(this, {\n            has: function () {},\n            get: function () {\n                a = true;\n                return 30;\n            }\n        });\n        var result = \"\";\n        for (var p in o)\n            result += o[p];\n    });\n    assert(false);\n} catch (e) {\n    assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4777.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nvar fast_array = [];\nfor (var i = 0; i < 1000; i++) {\n    fast_array.push(i);\n}\n\nvar result_array = fast_array.slice(0, {valueOf: function() { fast_array.length = '3'; return 1000; }});\n\nassert(result_array.length === 1000);\n\nassert(result_array[0] === 0);\nassert(result_array[1] === 1);\nassert(result_array[2] === 2);\n\nfor (var i = 3; i < 1000; i++) {\n  assert(typeof(result_array[i]) === \"undefined\");\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4781.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction testAdvanceStringIndex(lastIndex) {\n  let exec_count = 0;\n  let last_last_index = -1;\n  let fake_re = {\n    exec: () => {\n      return exec_count++ == 0 ? [\"\"] : null;\n    },\n\n    get lastIndex() {\n      return lastIndex;\n    },\n\n    set lastIndex(value) {\n    },\n\n    get global() {\n      return true;\n    }\n  };\n\n  RegExp.prototype[Symbol.match].call(fake_re, \"abc\");\n}\n\ntestAdvanceStringIndex(0x7ffffff);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4793.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Make sure that TypedArray filter correctly copies the data (avoid overflow).\n// Test creates a smaller region for \"output\" TypedArray.\n// Last number is intentionally a \"big\" float.\nvar big_array = new Float64Array([0.523565555, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 333333232134.1]);\nbig_array.constructor = Float32Array;\n\nvar result_float32_array = big_array.filter(x => x % 2 == 0);\nassert(result_float32_array instanceof Float32Array);\nassert(result_float32_array.length === 5);\n\n// Create an even smaller result TypedArray.\nbig_array.constructor = Uint8Array;\nvar result_uint8_array = big_array.filter(x => x % 3 == 0);\nassert(result_uint8_array instanceof Uint8Array);\nassert(result_uint8_array.length === 3);\n\n// Trigger a filter error when at the last element\ntry {\n  big_array.filter(function(x, idx) {\n    if (idx > 10) {\n        throw new Error(\"Error test magic\");\n    }\n    return x % 4 == 0;\n  });\n} catch (ex) {\n  assert(ex instanceof Error);\n  assert(ex.message === \"Error test magic\");\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4848.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar once = false;\nvar m = 1;\n\nfunction JSEtest(){\n  if(!once){\n    m = new Array(1, 2, 3);\n    this[2] = m;\n  }\n  once = true;\n  return this[2] = m;\n}\n\ntry {\n  JSON.parse(\"[1, 2, [4, 5]]\", JSEtest);\n  assert(false);\n} catch (e){\n  assert(e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4850.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Number('0x10') === 16);\nassert(isNaN(Number('+0x10')));\nassert(isNaN(Number('-0x10')));\nassert(parseFloat('0x10') === 0);\nassert(parseFloat('+0x10') === 0);\nassert(parseFloat('-0x10') === 0);\nassert(0x10 === 16);\nassert(+0x10 === 16);\nassert(-0x10 === -16);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4871.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nresolved = false;\n\nfunction T(p, r, u) {\n  return Object.assign(p, {\n    then(onFulfilled, onRejected) {\n      if (u) {\n        onFulfilled(r);\n      } else {\n        onFulfilled();\n      }\n\n      return Promise.prototype.then.call(this, onFulfilled, onRejected);\n    }\n  });\n}\n\nvar ps = [T(Promise.resolve('success'))];\nPromise.all(ps).then(res => {\n  resolved = true;\n}).catch(err => {\n  assert(false);\n});\n\nfunction __checkAsync() {\n  assert(resolved);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4872.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass M {\n  get foo() {\n    return this._x;\n  }\n  set foo(x) {\n    this._x = x;\n  }\n}\n\nclass T5 extends M {\n  constructor() {\n    (() => super.foo = 20)();\n  }\n}\n\ntry {\n  new T5\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4874.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Make sure that TypedArray filter correctly copies the data (avoid overflow).\n// Test creates a smaller region for \"output\" TypedArray.\n// Last number is intentionally a \"big\" float.\n\nfor (let key of ['get', 'set']) {\n  try {\n    eval(`class { static ${key} #constructor() {} }`);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4875.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  Atomics.sub({});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4876.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass M {\n  constructor() {\n    this._x = 45;\n  }\n\n  get foo() {\n    return this._x;\n  }\n}\n\nclass N extends M {\n  constructor(x = () => super.foo) {\n    super();\n    assert(x() === 45);\n  }\n\n  x(x = () => super.foo) {\n    return x();\n  }\n}\n\nassert(new N().x() === 45);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4884.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(Object.prototype.toString.call(Atomics) === '[object Atomics]');\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4890.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nlet array = new Array(1);\narray.splice(1, 0, array);\n\ntry {\n  array.flat(Infinity);\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError)\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4892.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass MyArray extends class C{}\n{};\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-4901.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction foo() {\n    new foo();\n}\n\ntry {\n    foo();\n    assert(false)\n} catch (e) {\n    assert(e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-5013.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction foo() {\n    var a;\n    function* bar() {\n        try {\n            yield* b;\n        } catch (e) {\n            a = e;\n        }\n    }\n    var b = bar();\n    b.next();\n\n    return a;\n}\n\nfoo();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-5089.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nasync function test1() {\n    var a;\n    ({k: a = await 1} = \"XY\");\n}\ntest1();\ngc();\n\nasync function test2() {\n    var a;\n    [a = await 1] = \"\";\n}\ntest2();\ngc();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-5097.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass Foo extends ([]).constructor {\n    #g;\n}\n\nnew Foo();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-5100.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass Foo extends Array {\n    #x() {\n    }\n}\n\nvar bar = new Foo();\nbar[0] = 1;\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-5101.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar iter = 100;\nasync function f0() {\n    iter--;\n    function f6() {\n        return f0;\n    }\n    var proxy_handler = {\n        \"get\": f0,\n    };\n\n    f0.__proto__ = new Proxy(f6, proxy_handler);\n\n    if ((iter >= 0)) {\n        var v12 = f0();\n    }\n    return f0;\n}\nf0();\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-5114.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass c {\n    static {\n    }\n    ;\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-5117.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass Outer {\n    static {\n        eval(`\n            function staticfunc() {\n                arguments;\n            }\n\n            class Inner {\n            }\n        `);\n    }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-5138.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nclass C1 extends Array{\n    #test() {\n    }\n}\nnew C1()\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-541.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nnew RegExp(\"m\\u2820\");\nparseInt(\"145\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-563.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval('if (true) /abc/.exec(\"abc\");');\n} catch (e) {\n  assert (false);\n}\n\ntry {\n  eval('if (true) {} /abc/.exec(\"abc\");');\n} catch (e) {\n  assert (false);\n}\n\ntry {\n  eval('var a\\n/abc/.exec(\"abc\");');\n} catch (e) {\n  assert (false);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-566.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar setMethods =\n[\n    \"setTime\",\n    \"setMilliseconds\",\n    \"setSeconds\",\n    \"setUTCMilliseconds\",\n    \"setSeconds\",\n    \"setUTCSeconds\",\n    \"setMinutes\",\n    \"setUTCMinutes\",\n    \"setHours\",\n    \"setUTCHours\",\n    \"setDate\",\n    \"setUTCDate\",\n    \"setMonth\",\n    \"setUTCMonth\",\n    \"setFullYear\",\n    \"setUTCFullYear\"\n]\n\nfor(var i in setMethods)\n{\n  var setMethod = setMethods[i];\n  try\n  {\n    ({method: Date.prototype[setMethod]}).method(0);\n  }\n  catch (e)\n  {\n    assert(e instanceof TypeError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-612.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  RegExp.prototype.compile([]);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-613.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\na = \"é\"\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-614.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nJSON.stringify & (Date = 1);\n\nb = 1;\nthis.a = 2;\nthis.a\nb = 3;\nassert(b == 3);\nassert(a == 2);\nthis.a & (b = 4);\nassert(b == 4);\nassert(a == 2);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-639.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f_0() {\n      var f_0 = print;\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-640.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f_0() {\n  var f_0 = 10;\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-641.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry\n{\n  Object.freeze(RegExp.prototype.compile)();\n  assert(false);\n}\ncatch (e)\n{\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-642.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nFunction.prototype.length = function() {};\nFunction.prototype.bind(0);\nassert (Function.prototype.length === 0);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-644.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction a()\n{\n  for (i = 1; i < 5; i++)\n    if (i) {\n      5;\n    }\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-646.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a;\n\n(a) = 1;\n\nassert (a === 1);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-652.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(\"this / 10\");\n} catch (e) {\n  assert (false);\n}\n\ntry {\n  eval(\"var v_0 = 10;\\nv_0++ / 1\");\n} catch (e) {\n  assert (false);\n}\n\ntry {\n  eval(\"var v_0 = 10;\\nif (v_0++ / 1) {\\n}\");\n} catch (e) {\n  assert (false);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-653.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = \"foo\", r;\nswitch(a) {\n    case true ? \"foo\" : \"bar\":\n        r = \"OK\";\n        break;\n}\nassert(r === \"OK\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-654.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nswitch (true) {\n    case {\"foo\": \"bar\"}:\n        break;\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-655.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(\"if (true) {}\\n/a/;\");\n} catch (e) {\n  assert (false);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-667.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nswitch (1) {\n  case 0:\n    assert(false);\n    break;\n  case 2:\n    assert(false);\n    break;\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-669.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f(){return}\n\nswitch (1) {\n  case 1:\n    break}\n\nwhile (false) {continue}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-680.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry\n{\n  f1(function(a1){});\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof ReferenceError);\n}\n\nvar x = {\nfoo: function () { throw new TypeError(\"bar\"); }\n};\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-686.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (code) {\n  try {\n    eval(code);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\ncheck_syntax_error (\"function eval () {'use strict';}\");\ncheck_syntax_error (\"function f (eval) {'use strict';}\");\ncheck_syntax_error (\"function arguments () {'use strict';}\");\ncheck_syntax_error (\"function f (arguments) {'use strict';}\");\n\ncheck_syntax_error (\"(function eval () {'use strict';})\");\ncheck_syntax_error (\"(function f (eval) {'use strict';})\");\ncheck_syntax_error (\"(function arguments () {'use strict';})\");\ncheck_syntax_error (\"(function f (arguments) {'use strict';})\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-689.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n'use strict';\n\nfunction f (g) {\n  new g ({prop_name: 'value'});\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-703.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f(a, b) {\n  return {\n    a: a,\n    b: b\n  };\n}\n\nvar o = f('1', '2');\n\nassert(o.a == '1');\nassert(o.b == '2');\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-725.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n\teval(\"switch(foo){} {}\");\n\tassert(false);\n} catch (e) {\n\tassert(e instanceof ReferenceError);\n}\n\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-736.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar code = 'try\\n\\\n{\\n\\\n  print({toStSing:!function() { throw new TypeError(\"foo\"); }}, []);t (false);\\n\\\n}\\n\\\ncatch (e)\\n\\\n{\\n\\\n  assert*(e instanceof\\n\\\n  assert );\\n\\\n  asstrt (e.a%e === \"foo\");\\n\\\n}';\n\ntry {\n  eval(code);\n  assert(false);\n} catch(e) {\n  assert(e instanceof ReferenceError);\n}\n\nassert (!eval(\"var x = {}; x instanceof assert;\"));\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-737.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (s) {\n  try {\n    eval (s);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\n/* Test case #1 */\ncheck_syntax_error (\n\" new function f(f) {                                \\\n  return {className: 'xxx'};                         \\\n};                                                   \\\nx = 1;                                               \\\nfunction g(active) {                                 \\\n  for (i = 1; i <= 1000; i++) { if (i == active) {   \\\n  x = i;   if (f(\\\"\\\" + i) != null) { }              \\\n    } else {                                         \\\n  if (f(\\\"\\\" + i) != null) }                         \\\n  }                                                  \\\n}                                                    \\\ng(0)                                                 \\\n\");\n\n/* Test case #2 */\ncheck_syntax_error (\n\" new function a(a) {;for (f in [1,2,3]) print(f);   \\\n}; 1;                                                \\\nfunction g(active) {                                 \\\n  for (i = 1; i <= 1000; i++) { if (i == active) {   \\\n  xI                                                 \\\n      if (f != null) { }                             \\\n    } else {                                         \\\n  if (f(\\\"\\\" + i) != null) }                         \\\n  }                                                  \\\n}                                                    \\\ng(0)                                                 \\\n\");\n\n/* Test case #3 */\ncheck_syntax_error (\n\" new function f(f) {;for (f in [1,2,3]) pRint(f);   \\\n}; 1;                                                \\\nfunction g(active) {                                 \\\n  for (i = 1; i <= 1000; i++) { if (i == active) {   \\\n  x                                                  \\\n      if (f != null) { }                             \\\n    } else {                                         \\\n  if (f(\\\"\\\" + i) != null) }                         \\\n  }                                                  \\\n}                                                    \\\ng(0)                                                 \\\n\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-738.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction g() {};for (B in Boolean) print(f);\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-739.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  var res = RegExp.prototyj_l;\n  obj_l = obj;\n\n  for (var k = 0; k < 1500; k++)\n  {\n    obj_l.prop = {};\n    obj_l = obj_l.prop;\n  }\n\n  function f (f, i) {\n    if (--i > 0) {\n      f ({a:o, b:o}, i);\n    }\n  }\n\n  for (var i = 0; i < 100; i++)\n  {\n    ({} + f ({}, 12));\n  }\n\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-741.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = JSON.stringify (b=+'�');\n\nassert(a === \"null\");\n\nvar b = JSON.stringify (b=-'�0001');\n\nassert(b === \"null\");\n\nvar c = JSON.stringify (b=+'�');\n\nassert(c === \"null\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-743.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction Error(Error) { }\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-745.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(\"7E9.\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof SyntaxError);\n}\n\nassert(7E9.toString() === \"7000000000\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-747.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (''.replace(/$/g,\"a\") === \"a\");\nassert (''.replace(/^/g,\"a\") === \"a\");\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-781.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry\n{\n  Function (Array.isArray);\n  assert (false);\n}\ncatch (e)\n{ \n  assert (e instanceof SyntaxError);\n}\n\ntry { Function(TypeError.prototype) } catch (err) { }\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-782.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry\n{\n  String.prototype.search(RegExp.prototype);\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-783.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  RegExp.prototype.compile(RegExp.prototype);\n  assert(false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-785.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry { RegExp.prototype.toString() } catch (err) {  }\ntry { isNaN.apply(unescape, JSON.stringify) } catch (err) {  }\ntry { Array.prototype.forEach(eval) } catch (err) {  }\ntry { RegExp.prototype.compile(RegExp.prototype) } catch (err) {  }\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-786.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry { RegExp.prototype.toString() } catch (err) {  }\ntry { Date.prototype.toTimeString() } catch (err) {  }\ntry { Boolean.prototype.toString() } catch (err) {  }\ntry { String.prototype.match(isNaN) } catch (err) {  }\ntry { Math.round(Math.atan) } catch (err) {  }\ntry { Date.prototype.getUTCDay() } catch (err) {  }\ntry { toLocaleString() } catch (err) {  }\ntry { Array.prototype.join(String.prototype.split) } catch (err) {  }\ntry { Date.prototype.getSeconds() } catch (err) {  }\ntry { isNaN.apply(Date.prototype.toISOString, String.prototype.split) } catch (err) {  }\ntry { Math.cos(Object) } catch (err) {  }\ntry { Math.floor(Date.prototype.getUTCSeconds) } catch (err) {  }\ntry { isNaN.apply(assert, JSON.stringify) } catch (err) {  }\ntry { Number.prototype.toLocaleString() } catch (err) {  }\ntry { Date.prototype.getTimezoneOffset() } catch (err) {  }\ntry { Date.prototype.setMinutes(Object.getOwnPropertyDescriptor,  Object.getOwnPropertyNames) } catch (err) {  }\ntry { Math.log(String.prototype.search) } catch (err) {  }\ntry { ReferenceError(Object.defineProperty) } catch (err) {  }\ntry { Array.prototype.filter(Number.prototype.toLocaleString) } catch (err) {  }\ntry { Array.prototype.forEach(Date.prototype.getDay) } catch (err) {  }\ntry { Object.defineProperty(SyntaxError.prototype, Date.prototype.setUTCMinutes, Math.max) } catch (err) {  }\ntry { Date.prototype.setMilliseconds(String.prototype.localeCompare) } catch (err) {  }\ntry { Math.asin(Date.prototype.getDay) } catch (err) {  }\ntry { Array.prototype.some(Date.prototype.getDay) } catch (err) {  }\ntry { String.prototype.charCodeAt(toString) } catch (err) {  }\ntry { isPrototypeOf(Math.tan) } catch (err) {  }\ntry { Object.isFrozen(print) } catch (err) {  }\ntry { RegExp.prototype.compile(RegExp.prototype) } catch (err) {  }\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-798.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = {}, b = 0;\n\nwhile (a[b]) {\n  assert (false);\n}\n\nfor ( ; a[b]; ) {\n  assert (false);\n}\n\nvar flag = false;\ndo\n{\n  assert (!flag);\n  flag = true;\n} while (a[b]);\n\na = { };\na.b = { c : 1 };\n\nwith (a.b)\n{\n  assert (c === 1);\n}\n"
  },
  {
    "path": "tests/jerry/regression-test-issue-962.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction re_test (pattern, string, expected)\n{\n  assert ((new RegExp(pattern)).exec(string) == expected);\n}\n\nre_test(\"[\\\\u0020]\", \"u\", null);\nre_test(\"[\\\\u0020]\", \" \", \" \");\nre_test(\"[\\\\u0020]\", \"x\", null);\n\nre_test(\"[\\\\x20]\", \"u\", null);\nre_test(\"[\\\\x20]\", \" \", \" \");\nre_test(\"[\\\\x20]\", \"x\", null);\n"
  },
  {
    "path": "tests/jerry/regression-test-issues-43-183.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (script)\n{\n  try\n  {\n    eval (script);\n    assert (false);\n  }\n  catch (e)\n  {\n    assert (e instanceof SyntaxError);\n  }\n}\n\ncheck_syntax_error ('{');\ncheck_syntax_error ('}');\ncheck_syntax_error ('[');\ncheck_syntax_error (']');\ncheck_syntax_error ('(');\ncheck_syntax_error (')');\n\ncheck_syntax_error ('function f (');\ncheck_syntax_error ('function f ()');\ncheck_syntax_error ('function f () {');\ncheck_syntax_error ('function f () }');\ncheck_syntax_error ('function f ({) }');\ncheck_syntax_error ('function f { }');\ncheck_syntax_error ('function f {');\ncheck_syntax_error ('function f }');\n\ncheck_syntax_error ('a = [[];');\n\ncheck_syntax_error ('a = {;');\ncheck_syntax_error ('a = };');\ncheck_syntax_error ('a = {{};');\n\ncheck_syntax_error ('a = {get q {} };');\ncheck_syntax_error ('a = {get q ( {} };');\ncheck_syntax_error ('a = {get q ) {} };');\ncheck_syntax_error ('a = {get q () };');\ncheck_syntax_error ('a = {get q () { };');\ncheck_syntax_error ('a = {get q () };');\ncheck_syntax_error ('a = {get q () { };');\n"
  },
  {
    "path": "tests/jerry/relational.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert((7 < 4) == false);\nassert((7 > 4) == true);\n\nassert((7 <= 11) == true);\nassert((11 <= 11) == true);\n\nassert((7 >= 11) == false);\nassert((7 >= 7) == true);\n\nassert(0 > (0 - 'Infinity'));\nassert(0 < (0 - '-Infinity'));\nassert((0 - 'Infinity') < (0 - '-Infinity'));\n\nassert('a' > '');\nassert(!('' < ''));\nassert(!('' > ''));\nassert('abcd' > 'abc');\nassert('abc' < 'abcd');\nassert('abcd' <= 'abcd');\nassert('abcd' >= 'abcd');\nassert(!('abcd' > 'abcd'));\n"
  },
  {
    "path": "tests/jerry/restricted-properties.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction must_throw (str) {\n  try {\n    eval (\"switch (1) { default: \" + str + \"}\");\n    assert (false);\n  }\n  catch (e) {\n  }\n\n  try {\n    eval (str);\n    assert (false);\n  }\n  catch (e) {\n  }\n}\n\n// strict functions created using the Function constructor\nvar strictF = new Function('\"use strict\"');\n\nassert(strictF.hasOwnProperty('caller') === false);\nassert(strictF.hasOwnProperty('arguments') === false);\n\nmust_throw(\"strictF.caller\")\nmust_throw(\"strictF.arguments\")\nmust_throw(\"strictF.caller = 1\")\nmust_throw(\"strictF.arguments = 2\")\n\n// generator functions created using the Generator constructor\nvar GeneratorFunction = Object.getPrototypeOf(function*(){}).constructor\nvar generatorF = new GeneratorFunction()\n\nassert(generatorF.hasOwnProperty('caller') === false);\nassert(generatorF.hasOwnProperty('arguments') === false);\n\nmust_throw(\"generatorF.caller\")\nmust_throw(\"generatorF.arguments\")\nmust_throw(\"generatorF.caller = 1\")\nmust_throw(\"generatorF.arguments = 2\")\n\n// async functions created using the AsyncFunction constructor\nasync function asyncF() {}\n\nassert(asyncF.hasOwnProperty('caller') === false);\nassert(asyncF.hasOwnProperty('arguments') === false);\n\nmust_throw(\"asyncF.caller\")\nmust_throw(\"asyncF.arguments\")\nmust_throw(\"asyncF.caller = 1\")\nmust_throw(\"asyncF.arguments = 2\")\n\n// functions created using the bind method\nvar f = function () {};\nvar boundF = f.bind();\n\nassert(boundF.hasOwnProperty('caller') === false);\nassert(boundF.hasOwnProperty('arguments') === false);\n\nmust_throw(\"boundF.caller\")\nmust_throw(\"boundF.arguments\")\nmust_throw(\"boundF.caller = 1\")\nmust_throw(\"boundF.arguments = 2\")\n"
  },
  {
    "path": "tests/jerry/set-iterators.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar methods = ['entries', 'keys', 'values', Symbol.iterator];\n\nmethods.forEach(function (method) {\n  try {\n    Set.prototype[method].call(5);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n});\n\nmethods.forEach(function (method) {\n  try {\n    Set.prototype[method].call({});\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n});\n\nvar s = new Set([0, 1, 2, 3, 4, 5, 6]);\n\nmethods.forEach(function(method) {\n  assert(s[method]().toString() === '[object Set Iterator]');\n});\n\nmethods.forEach(function (method) {\n  try {\n    s[method].next.call(5);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n});\n\nmethods.forEach(function (method) {\n  try {\n    s[method].next.call({});\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n});\n\nvar setFromSet = new Set(s);\nassert(setFromSet.size === 7);\n\nvar iterators = [s.keys(), s.values(), s[Symbol.iterator]()];\nvar entryIterator = s.entries();\nvar elementCount = s.size;\n\nfor (var i = 0; i < elementCount; i++) {\n  iterators.forEach(function(element) {\n    var next = element.next();\n    assert(next.done === false);\n    assert(next.value === i);\n  });\n\n  var next = entryIterator.next();\n  assert(next.done === false);\n  assert(next.value[0] === i);\n  assert(next.value[1] === i);\n}\n\niterators.forEach(function(element) {\n    var next = element.next();\n    assert(next.done === true);\n    assert(next.value === undefined);\n  });\n\nvar next = entryIterator.next();\nassert(next.done === true);\nassert(next.value === undefined);\n\n\niterators = [s.keys(), s.values(), s[Symbol.iterator]()];\nentryIterator = s.entries();\nvar elementCount = s.size;\n\nfor (var i = 0; i < elementCount; i++) {\n  iterators.forEach(function(element) {\n    var next = element.next();\n    assert(next.done === false);\n    assert(next.value === i);\n  });\n\n  var next = entryIterator.next();\n  assert(next.done === false);\n  assert(next.value[0] === i);\n  assert(next.value[1] === i);\n  s.delete(i);\n}\n\nassert(s.size === 0);\n\ns = new Set ([0, 1]);\nvar expected = [0, 1, 2, 4, 5, 6, 3];\nvar loopCount = 0;\n\ns.forEach(function(element) {\n  if (loopCount === 0) {\n    for (var i = 0; i < expected.length ; i++) {\n      s.add(i);\n    }\n    s.delete(3);\n    s.add(3);\n  }\n  assert(element === expected[loopCount++]);\n});\n\nassert(loopCount === expected.length);\n\ns = new Set([0, 1, 2, 3, 4, 5, 6]);\nexpected = [0, 1];\nloopCount = 0;\n\nfor (var value of s) {\n  if (loopCount === 0) {\n    s.clear();\n    s.add(1);\n  }\n\n  assert(value === expected[loopCount++]);\n}\n\ns = new Set([0])\nexpected = [0, 1];\nloopCount = 0;\n\nfor (var value of s) {\n  if (loopCount === 0) {\n    s.add(2);\n    s.delete(2);\n    s.add(3);\n    s.delete(3);\n    s.add(1);\n  }\n\n  assert(value === expected[loopCount++]);\n}\n\nassert(Set.prototype.values === Set.prototype.keys);\n"
  },
  {
    "path": "tests/jerry/set.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar set = new Set();\nvar int = 1;\nassert (set.size === 0);\nassert (set.add (int) === set);\nassert (set.has (int));\nassert (set.size === 1);\n\nvar str = \"foobar\"\nassert (set.add (str) === set);\nassert (set.has (str));\nassert (set.size === 2);\n\nvar number = 5.78;\nassert (set.add (number) === set);\nassert (set.has (number));\nassert (set.size === 3);\n\nvar object = { a : 2, b : 4};\nassert (set.add (object) === set);\nassert (set.has (object));\nassert (set.size === 4);\n\nvar func = function () {};\nassert (set.add (func) === set);\nassert (set.has (func));\nassert (set.size === 5);\n\nvar symbol = Symbol (\"foo\");\nassert (set.add (symbol) === set);\nassert (set.has (symbol));\nassert (set.size === 6);\n\nassert (!set.has(5));\nassert (!set.has(\"foo\"));\nassert (!set.has({ a : 2, b : 4}));\nassert (!set.has(function () {}));\nassert (!set.has(Symbol (\"foo\")));\n\nvar elements = [int, str, number, object, func, symbol];\n\nvar i = 0;\nset.forEach (function (value, key) {\n  assert (key === elements[i]);\n  assert (value === elements[i]);\n  i++;\n});\n\nassert (set.delete (int));\nassert (set.size === 5);\nassert (set.delete (str));\nassert (set.size === 4);\nassert (set.delete (number));\nassert (set.size === 3);\nassert (set.delete (object));\nassert (set.size === 2);\nassert (set.delete (func));\nassert (set.size === 1);\nassert (set.delete (symbol));\nassert (set.size === 0);\n\nset = new Set([1, 2, 3, 4]);\nassert (set.has(1));\nassert (set.has(2));\nassert (set.has(3));\nassert (set.has(4));\n\nassert (set.size === 4);\nassert (set.add (2) === set);\nassert (set.size === 4);\nassert (set.delete (2));\nassert (set.size === 3);\n\nset.clear();\nassert(set.size === 0);\n\nset.add(3);\nassert(set.delete(3));\nassert(!set.delete(3));\n\nfunction createIterable(arr, methods = {}) {\n  let iterable = function *() {\n    let idx = 0;\n    while (idx < arr.length) {\n      yield arr[idx];\n      idx++;\n    }\n  }();\n  iterable['return'] = methods['return'];\n  iterable['throw'] = methods['throw'];\n\n  return iterable;\n};\n\nvar closed = false;\nvar iter = createIterable([1, 2, 3], {\n  'return': function(){ closed = true; return {}; }\n});\nvar add = Set.prototype.add;\nSet.prototype.add = function(){ throw 0 };\ntry {\n  new Set(iter);\n} catch(e){}\nSet.prototype.add = add;\n\nassert(closed === true);\n\n/* Test third argument of callback */\nvar s = new Set([1, 2, 3]);\n\ns.forEach(function(value, key, thisArg) {\n  assert (typeof thisArg === \"object\");\n  assert(thisArg === s);\n});\n\nvar set = new Set();\nset.add(-0);\nvar k;\nset.forEach(function (value) {\n  k = 1 / value;\n});\n\nassert(k === Infinity);\nassert(set.has(+0) === true);\n\n[Symbol.iterator, Symbol.toStringTag].forEach(e => assert (Reflect.ownKeys(Set.prototype).includes(e)));\n"
  },
  {
    "path": "tests/jerry/shift.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert((9 << 2) === 36);\nassert((14 << 2) === 56);\nassert((0 << 0) === 0);\nassert((0 << 1) === 0);\nassert((0 << -1) === 0);\nassert((1 << 0) === 1);\nassert((1 << 1) === 2);\nassert((-1 << 0) === -1);\nassert((-1 << 1) === -2);\nassert((1024 << 21) === -2147483648);\nassert((10 << -1) === 0);\nassert((33554431 << 22) === -4194304);\nassert((-1024 << 31) === 0);\nassert((1024 << 53) === -2147483648);\n\nassert((9 >> 2) === 2);\nassert((-14 >> 2) === -4);\n\nassert((9 >>> 2) === (9 >> 2));\n\nassert((\"-1.234\" << 0) == -1);\nassert((\"-1.234\" << -1) == -2147483648);\nassert((-1.2 << 0) === -1);\nassert((-1.1 << -1) === -2147483648);\nassert((-1.1 << -1.1) === -2147483648);\nassert((-1.1 << -999) === -33554432);\nassert((-1.1 << 999) === -128);\nassert((-33554431.0 << 0) === -33554431);\nassert((-33554431.0 << -1.1) === -2147483648);\nassert((-33554431.0 << -999) === 33554432);\n"
  },
  {
    "path": "tests/jerry/sqrt.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(isNaN(Math['sqrt'] (NaN)));\nassert(isNaN(Math['sqrt'] (-1.0)));\nassert(isNaN(Math['sqrt'] (-Infinity)));\nassert(Math['sqrt'] (0.0) === 0.0);\nassert(Math['sqrt'] (Infinity) === Infinity);\n\nassert(Math['sqrt'] (1.0) === 1.0);\nassert(Math['sqrt'] (2.0) >= Math['SQRT2'] * 0.999999);\nassert(Math['sqrt'] (2.0) <= Math['SQRT2'] * 1.000001);\nassert(Math['sqrt'] (0.5) >= Math['SQRT1_2'] * 0.999999);\nassert(Math['sqrt'] (0.5) <= Math['SQRT1_2'] * 1.000001);\n\nvar sqrt_1e38 = Math['sqrt'] (1.0e+38);\nassert(sqrt_1e38 > 0.999999 * 1.0e+19);\nassert(sqrt_1e38 < 1.000001 * 1.0e+19);\n\nvar sqrt_1e38 = Math['sqrt'] (1.0e-38);\nassert(sqrt_1e38 > 0.999999 * 1.0e-19);\nassert(sqrt_1e38 < 1.000001 * 1.0e-19);\n"
  },
  {
    "path": "tests/jerry/stack-limit.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f () {\n  f();\n}\n\ntry {\n  f();\n  assert(false);\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/strict.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n'use strict';\n\nvar temp;\n\ntry\n{\n  a = 1;\n\n  assert (false);\n} catch (e)\n{\n  assert (e instanceof ReferenceError);\n}\n\ntry\n{\n  NaN = 1;\n\n  assert (false);\n} catch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nfunction f()\n{\n  assert(this === undefined);\n}\n\nf();\n\nObject.function_prop = function ()\n{\n  assert (this === Object);\n}\n\nObject.function_prop ();\n\ntry\n{\n  var temp = f.caller;\n\n  assert (false);\n} catch (e)\n{\n  assert (e instanceof TypeError);\n}\n\ntry\n{\n  delete this.NaN;\n\n  assert (false);\n} catch (e)\n{\n  assert (e instanceof TypeError);\n}\n\ntry\n{\n  eval (\"'\\\\\" + \"101'\");\n\n  assert (false);\n} catch (e)\n{\n  assert (e instanceof SyntaxError);\n}\n\ntry\n{\n  var str1 = \"'\\\\\" + \"0'\";\n  var str2 = \"'\\\\x\" + \"00'\";\n  eval (str1);\n\n  assert (eval (str1) === eval (str2));\n} catch (e)\n{\n  assert (false);\n}\n\ntry\n{\n  var str1 = \"'\\\\\" + \"0\" + \"\\\\\" + \"0\" + \"\\\\\" + \"0'\";\n  var str2 = \"'\\\\x\" + \"00\" + \"\\\\x\" + \"00\" + \"\\\\x\" + \"00'\";\n  eval (str1);\n\n  assert (eval (str1) === eval (str2));\n} catch (e)\n{\n  assert (false);\n}\n\ntry\n{\n  var str1 = \"'foo\\\\\" + \"0\" + \"bar'\";\n  var str2 = \"'foo\\\\x\" + \"00\" + \"bar'\";\n  eval (str1);\n\n  assert (eval (str1) === eval (str2));\n} catch (e)\n{\n  assert (false);\n}\n\n(function (a) {\n  (function (a) {\n  });\n});\n"
  },
  {
    "path": "tests/jerry/strict2.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction check_syntax_error (script)\n{\n  try\n  {\n    eval (script);\n    assert (false);\n  }\n  catch (e)\n  {\n    assert (e instanceof SyntaxError);\n  }\n}\n\nvar\n  implements = 0,\n  private = 1,\n  public = 2,\n  interface = 3,\n  package = 4,\n  protected = 5,\n  let = 6,\n  yield = 7,\n  static = 8;\n\ncheck_syntax_error(\"'use strict'\\nimplements\")\ncheck_syntax_error(\"'use strict'\\n\\\\u0069mplements\")\nassert(eval(\"'use stric'\\nimplements\") === 0)\nassert(eval(\"'use stric'\\n\\\\u0069mplements\") === 0)\n\ncheck_syntax_error(\"'use strict'\\nprivate\")\ncheck_syntax_error(\"'use strict'\\n\\\\u0070rivate\")\nassert(eval(\"'use stric'\\nprivate\") === 1)\nassert(eval(\"'use stric'\\n\\\\u0070rivate\") === 1)\n\ncheck_syntax_error(\"'use strict'\\npublic\")\ncheck_syntax_error(\"'use strict'\\n\\\\u0070ublic\")\nassert(eval(\"'use stric'\\npublic\") === 2)\nassert(eval(\"'use stric'\\n\\\\u0070ublic\") === 2)\n\ncheck_syntax_error(\"'use strict'\\ninterface\")\ncheck_syntax_error(\"'use strict'\\n\\\\u0069nterface\")\nassert(eval(\"'use stric'\\ninterface\") === 3)\nassert(eval(\"'use stric'\\n\\\\u0069nterface\") === 3)\n\ncheck_syntax_error(\"'use strict'\\npackage\")\ncheck_syntax_error(\"'use strict'\\n\\\\u0070ackage\")\nassert(eval(\"'use stric'\\npackage\") === 4)\nassert(eval(\"'use stric'\\n\\\\u0070ackage\") === 4)\n\ncheck_syntax_error(\"'use strict'\\nprotected\")\ncheck_syntax_error(\"'use strict'\\n\\\\u0070rotected\")\nassert(eval(\"'use stric'\\nprotected\") === 5)\nassert(eval(\"'use stric'\\n\\\\u0070rotected\") === 5)\n\ncheck_syntax_error(\"'use strict'\\nlet\")\ncheck_syntax_error(\"'use strict'\\n\\\\u006cet\")\nassert(eval(\"'use stric'\\nlet\") === 6)\nassert(eval(\"'use stric'\\n\\\\u006cet\") === 6)\n\ncheck_syntax_error(\"'use strict'\\nyield\")\ncheck_syntax_error(\"'use strict'\\n\\\\u0079ield\")\nassert(eval(\"'use stric'\\nyield\") === 7)\nassert(eval(\"'use stric'\\n\\\\u0079ield\") === 7)\n\ncheck_syntax_error(\"'use strict'\\nstatic\")\ncheck_syntax_error(\"'use strict'\\n\\\\u0073tatic\")\nassert(eval(\"'use stric'\\nstatic\") === 8)\nassert(eval(\"'use stric'\\n\\\\u0073tatic\") === 8)\n"
  },
  {
    "path": "tests/jerry/string-fromcodepoint.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Tests with valid inputs\nassert(String.fromCodePoint(42) === \"*\")\nassert(String.fromCodePoint(65, 90) === \"AZ\");\nassert(String.fromCodePoint(0x404) === \"Є\");\nassert(String.fromCodePoint(194564) === \"你\");\nassert(String.fromCodePoint(0x1D306, 0x61, 0x1D307) === \"𝌆a𝌇\");\nassert(String.fromCodePoint(0x1F303) === \"🌃\");\n\n// Tests with invalid inputs\ntry {\n    assert(String.fromCodePoint('_'));\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError);\n}\n\ntry {\n    assert(String.fromCodePoint(Infinity));\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError);\n}\n\ntry {\n    assert(String.fromCodePoint(-1));\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError);\n}\n\ntry {\n    assert(String.fromCodePoint(3.14));\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError);\n}\n\ntry {\n    assert(String.fromCodePoint(3e-2));\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError);\n}\n\ntry {\n    assert(String.fromCodePoint(NaN));\n    assert(false);\n} catch (e) {\n    assert(e instanceof RangeError);\n}\n"
  },
  {
    "path": "tests/jerry/string-iterator.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  String.prototype[Symbol.iterator].call(undefined);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  String.prototype[Symbol.iterator].call(Symbol('foo'));\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar str = 'foobar';\nvar iterator = str[Symbol.iterator]();\n\ntry {\n  iterator.next.call(5);\n  assert (false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  iterator.next.call({});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar str = 'Example string.';\nvar expected = ['E', 'x', 'a', 'm', 'p', 'l', 'e', ' ', 's', 't', 'r', 'i', 'n', 'g', '.'];\n\nvar iterator = str[Symbol.iterator]();\nvar next = iterator.next();\nvar idx = 0;\n\nwhile (!next.done) {\n  assert(next.value === expected[idx++]);\n  assert(next.done === false);\n  next = iterator.next();\n}\n\nassert(next.value === undefined);\n\nvar str = '^o𓙦һR񼴆]ŭ媖?᯾豼עW򏋁';\nvar expected = ['^', 'o', '𓙦', 'һ', 'R', '񼴆', ']', 'ŭ', '媖', '?', '᯾', '豼', 'ע', 'W', '򏋁'];\n\niterator = str[Symbol.iterator]();\nnext = iterator.next();\nidx = 0;\n\nwhile (!next.done) {\n  assert(next.value === expected[idx++]);\n  assert(next.done === false);\n  next = iterator.next();\n}\n\nassert(next.value === undefined);\n\nassert(iterator.toString() === '[object String Iterator]');\nassert(iterator[Symbol.toStringTag] === 'String Iterator');\n\niterator = (' '.repeat(80000))[Symbol.iterator]();\nnext = iterator.next();\nidx = 0;\n\nwhile (!next.done) {\n  assert(next.value === ' ');\n  assert(next.done === false);\n  next = iterator.next();\n  idx++;\n}\nassert(idx == 80000);\n"
  },
  {
    "path": "tests/jerry/string-prototype-at.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar str = 'This is an Apple';\n\n/* Basic tests */\nvar index = str.at(0);\nassert(index === 'T');\nassert(str[index] === undefined);\n\nassert(str.at(str.length) === undefined);\nassert(str.at(str.length+1) === undefined);\nassert(str.at(str.length-1) === 'e');\nassert(str.at(\"1\") === 'h');\nassert(str.at(-1) === 'e');\nassert(str.at(\"-1\") === 'e');\nassert(str.at(\"-20\") === undefined);\n\ntry {\n  String.prototype.at.call(undefined)\n  assert (false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\nvar obj = {toString: function() { return \"Apple\"; } };\nobj.at = String.prototype.at;\nassert(obj.at(0) === 'A');\n\n/* BigInteger as num and char */\nassert(str.at(\"1n\") === 'T')\n\ntry {\n  str.at (10n);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/string-prototype-charat.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// check properties\n\nfunction length_configurable()\n{\n  function is_es51() {\n    return (typeof g === \"function\");\n    { function g() {} }\n  }\n  return is_es51() ? false : true;\n}\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.charAt, 'length').configurable === length_configurable());\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.charAt, 'length').enumerable === false);\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.charAt, 'length').writable === false);\n\nassert(String.prototype.charAt.length === 1);\n\n// check empty string\nassert(String.prototype.charAt.call(new String()) === \"\");\n\n// check NaN\nassert(\"hello world!\".charAt(NaN) === \"h\");\n\n// check Object\nassert(String.prototype.charAt.call({})  === \"[\");\n\n// simple checks\nassert(\"hello world!\".charAt(0) === \"h\");\n\nassert(\"hello world!\".charAt(1) === \"e\");\n\n// check +-Inf\nassert(\"hello world!\".charAt(-Infinity) === \"\");\n\nassert(\"hello world!\".charAt(Infinity) === \"\");\n\nassert(\"hello world!\".charAt(11) === \"!\");\n\nassert(\"hello world!\".charAt(12) === \"\");\n\n// check unicode\nassert(\"hello\\u000B\\u000C\\u0020\\u00A0world!\".charAt(8) === \"\\u00A0\");\n\nassert(\"hello\\uD834\\uDF06world!\".charAt(6) === \"\\uDF06\");\n\nassert(\"hell\\u006F\\u006F w\\u006F\\u006Frld!\".charAt(8) === \"\\u006F\");\n\nassert(\"\\u00A9\\u006F\".charAt(2) === \"\");\n\n// check negative\nassert(\"hello world!\".charAt(-1) === \"\");\n\nassert(\"hello world!\".charAt(-9999999) === \"\");\n\nassert(\"hello world!\".charAt(-0) === \"h\");\n\n// check undefined\nassert(\"hello world!\".charAt(undefined) === \"h\");\n\n// check booleans\nassert(\"hello world!\".charAt(true) === \"e\");\n\nassert(\"hello world!\".charAt(false) === \"h\");\n\n// check this is undefined\ntry {\n  String.prototype.charAt.call(undefined);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// check this is null\ntry {\n  String.prototype.charAt.call(null);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - undefined\ntry {\n  assert(true.charAt() === \"\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - null\ntry {\n  assert(String.prototype.charAt.call(null, 0) === \"\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - Boolean\nassert(String.prototype.charAt.call(true, 1) === \"r\");\n\n// check coercible - Object\nvar test_object = {firstName:\"John\", lastName:\"Doe\"};\nassert(String.prototype.charAt.call(test_object, 1) === \"o\");\n\n// check coercible - Number\nassert(String.prototype.charAt.call(123, 2) === \"3\");\n"
  },
  {
    "path": "tests/jerry/string-prototype-charcodeat.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// check properties\n\nfunction length_configurable()\n{\n  function is_es51() {\n    return (typeof g === \"function\");\n    { function g() {} }\n  }\n  return is_es51() ? false : true;\n}\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.charCodeAt, 'length').configurable === length_configurable());\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.charCodeAt, 'length').enumerable === false);\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.charCodeAt, 'length').writable === false);\n\nassert(String.prototype.charCodeAt.length === 1);\n\n// check empty string\nassert(isNaN(String.prototype.charCodeAt.call(new String())));\n\n// check Object with NaN pos\nassert(String.prototype.charCodeAt.call({}) === 91);\n\n// simple checks\nassert(\"hello world!\".charCodeAt(0) === 104);\n\nassert(\"hello world!\".charCodeAt(1) === 101);\n\nassert(\"HELLO WORLD\".charCodeAt(10) === 68);\n\n// check +-Inf\nassert(isNaN(\"hello world!\".charCodeAt(-Infinity)));\n\nassert(isNaN(\"hello world!\".charCodeAt(Infinity)));\n\nassert(\"hello world!\".charCodeAt(11) === 33);\n\nassert(isNaN(\"hello world!\".charCodeAt(12)));\n\n// check unicode\nassert(\"hello\\u000B\\u000C\\u0020\\u00A0world!\".charCodeAt(8) === 160);\n\nassert(\"hello\\uD834\\uDF06world!\".charCodeAt(6) === 57094);\n\nassert(\"hell\\u006F\\u006F w\\u006F\\u006Frld!\".charCodeAt(8) === 111);\n\nassert(isNaN(\"\\u00A9\\u006F\".charCodeAt(2)));\n\n// check negative\nassert(isNaN(\"hello world!\".charCodeAt(-1)));\n\nassert(isNaN(\"hello world!\".charCodeAt(-9999999)));\n\nassert(\"hello world!\".charCodeAt(-0) === 104);\n\n// check undefined\nassert(\"hello world!\".charCodeAt(undefined) === 104);\n\n// check booleans\nassert(\"hello world!\".charCodeAt(true) === 101);\n\nassert(\"hello world!\".charCodeAt(false) === 104);\n\n// check index above uint32_t\nassert(isNaN(\"hello world!\".charCodeAt(4294967299)));\n\n// check coercible - undefined\ntry {\n  assert(isNaN(String.prototype.charCodeAt.call(undefined)));\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - null\ntry {\n  assert(isNaN(String.prototype.charCodeAt.call(null, 0)));\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - Boolean\nassert(String.prototype.charCodeAt.call(true, 1) === 114);\nassert(String.prototype.charCodeAt.call(true) === 116);\n\n// check coercible - Object\nvar test_object = {firstName:\"John\", lastName:\"Doe\"};\nassert(String.prototype.charCodeAt.call(test_object, 1) === 111);\n\n// check coercible - Number\nassert(String.prototype.charCodeAt.call(123, 2) === 51);\n"
  },
  {
    "path": "tests/jerry/string-prototype-codepointat.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = \"A🌃B\\uD800\";\nvar obj = {};\n\n// Test with normal inputs\nassert(str.codePointAt(0) === 65);\nassert(str.codePointAt(1) === 127747);\nassert(str.codePointAt(2) === 57091);\nassert(str.codePointAt(3) === 66);\nassert(str.codePointAt(4) === 55296);\n\n// Test with string\nassert(str.codePointAt(\"a\") === 65);\nassert(str.codePointAt(\"B\") === 65);\n\n// Test with object\nassert(str.codePointAt(obj) === 65);\n\n// Test with NaN\nassert(str.codePointAt(NaN) === 65);\n\n// Test when the input >= length\nassert(str.codePointAt(5) === undefined);\nassert(str.codePointAt(10) === undefined);\n\n// Test witn negative\nassert(str.codePointAt(-1) === undefined);\nassert(str.codePointAt(-5) === undefined);\nassert(str.codePointAt(-0) === 65);\n\n// Test with undefined and +/- Infinity\nassert(str.codePointAt(undefined) === 65);\nassert(str.codePointAt(Infinity) === undefined);\nassert(str.codePointAt(-Infinity) === undefined);\n\n// Test with boolean\nassert(str.codePointAt(true) === 127747);\nassert(str.codePointAt(false) === 65);\n\n// Test when input > UINT32_MAX\nassert(str.codePointAt(4294967299) === undefined);\n"
  },
  {
    "path": "tests/jerry/string-prototype-concat.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// check properties\n\nfunction length_configurable()\n{\n  function is_es51() {\n    return (typeof g === \"function\");\n    { function g() {} }\n  }\n  return is_es51() ? false : true;\n}\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.concat, 'length').configurable === length_configurable());\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.concat, 'length').enumerable === false);\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.concat, 'length').writable === false);\n\n// simple checks\nvar s1 = \"Hello \";\nvar s2 = \"world!\";\nvar s3 = \" \";\nassert(s1.concat(s2, s3, 3, 10, \"  \", \".\") === \"Hello world! 310  .\");\nassert(\"Hello \".concat(s1) === \"Hello Hello \");\n\nassert(s1.concat(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) === \"Hello 012345678901234567890123456789\");\n\nassert(\"\".concat() === \"\");\n\n// check unicode\nassert(\"\\u0041\".concat(\"\\u0041\", \"\\u1041\") === \"\\u0041\\u0041\\u1041\");\nassert(\"\\u0041\\u1D306A\".concat(\"\\u0041\", \"\\u1041\") === \"\\u0041\\u1D306A\\u0041\\u1041\");\n\n// check undefined\nvar y;\nassert(\"Check \".concat(y) === \"Check undefined\");\n\n// check toString error in this object\nvar y = {};\ny.toString = function () { throw new ReferenceError (\"foo\");}\ny.concat = String.prototype.concat;\ntry {\n  y.concat(\"cat\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n\n// check toString error in arguments\nvar x = {};\nx.toString = function () { throw new ReferenceError (\"foo\");}\ntry {\n  \"a\".concat(x);\n  assert(false);\n} catch (e) {\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/string-prototype-endswith.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar x = \"Dancer of the Boreal Valley\";\nassert (x.endsWith (\"Valley\"));\nassert (x.endsWith (\"Boreal\", 20));\nassert (x.endsWith (\"Dancer\", 6));\nassert (x.endsWith (\"\"));\nassert (x.endsWith ([]));\n\nvar y = \"Lalafell\";\nassert (y.endsWith (\"Lala\") === false);\nassert (y.endsWith (\"fell\", 2) === false);\nassert (y.endsWith (\"Final\", \"Fantasy\") === false);\nassert (y.endsWith (\"Hydaelyn\", 30) === false);\nassert (y.endsWith (undefined) === false);\n\nassert(String.prototype.endsWith.call (5) === false);\n\nvar test_obj = {toString: function() { return \"A realm reborn\"; } };\ntest_obj.endsWith = String.prototype.endsWith;\nassert (test_obj.endsWith (\"reborn\") === true);\nassert (test_obj.endsWith (\"realm\") === false);\n\ntry {\n  String.prototype.endsWith.call (Symbol());\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  String.prototype.endsWith.call (undefined);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  String.prototype.endsWith.call (null);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar z = /[/]/;\ntry {\n  y.endsWith (z);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nz[Symbol.match] = false;\nassert(y.endsWith(z) === false);\n\ntry {\n  \"foo\".endsWith({[Symbol.match] : true});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".endsWith({get [Symbol.match] () { throw 5}});\n  assert(false);\n} catch (e) {\n  assert(e === 5);\n}\n"
  },
  {
    "path": "tests/jerry/string-prototype-includes.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar x = \"Good King Moggle Mog XII\";\nassert (x.includes (\"Moggle\"));\nassert (x.includes (\"Moggle Mog\", 3));\nassert (x.includes (\"\"));\nassert (x.includes ([]));\n\nvar y = \"Nidhogg's Rage\";\nassert (y.includes (\"Dragon\") === false);\nassert (y.includes (\"Rage\", 11) === false);\nassert (y.includes (\"Final\", \"Fantasy\") === false);\nassert (y.includes (\"Hydaelyn\", 30) === false);\nassert (y.includes (undefined) === false);\n\nassert(String.prototype.includes.call (5) === false);\n\nvar test_obj = {toString: function() { return \"The world of Eorzea\"; } };\ntest_obj.includes = String.prototype.includes;\nassert (test_obj.includes (\"Eorzea\") === true);\nassert (test_obj.includes (\"Viera\") === false);\n\ntry {\n  String.prototype.includes.call (Symbol());\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  String.prototype.includes.call (undefined);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  String.prototype.includes.call (null);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar z = /[/]/;\ntry {\n  y.includes (z);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nz[Symbol.match] = false;\nassert(y.includes(z) === false);\n\ntry {\n  \"foo\".includes({[Symbol.match] : true});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".includes({get [Symbol.match] () { throw 5}});\n  assert(false);\n} catch (e) {\n  assert(e === 5);\n}\n"
  },
  {
    "path": "tests/jerry/string-prototype-indexof.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// check properties\n\nfunction length_configurable()\n{\n  function is_es51() {\n    return (typeof g === \"function\");\n    { function g() {} }\n  }\n  return is_es51() ? false : true;\n}\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.indexOf, 'length').configurable === length_configurable());\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.indexOf, 'length').enumerable === false);\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.indexOf, 'length').writable === false);\n\nassert(String.prototype.indexOf.length === 1);\n\nassert(\"Hello world, welcome to the universe.\".indexOf(\"welcome\") === 13);\n\nassert(\"Hello world, welcome to the universe.\".indexOf(\"Hello world, welcome to the universe.\") === 0);\n\nassert(\"Hello world, welcome to the universe.\".indexOf(\"welcome\",10) == 13);\n\nassert(\"Hello world, welcome to the universe.\".indexOf(\"welcome\",-100) == 13);\n\nassert(\"Hello world, welcome to the universe.\".indexOf(\"welcome\", 15) === -1);\n\nassert(\"Hello world, welcome to the universe.\".indexOf(\"o\", 15) === 17);\n\n// check utf8 strings\nassert(\"\\uFFA2\".indexOf(\"\\uFFA2\") === 0);\n\nassert(\"\\uFFA2\".indexOf(\"A\") === -1);\n\nassert(\"w2\\uFFA2A\".indexOf(\"A\") === 3);\n\nassert(\"w2\\u1D306A\".indexOf(\"A\") === 4);\n\nassert(\"\\uD834\\uDF06\".indexOf(\"\\uDF06\") === 1);\n\nassert(\"\\uD834\\uDF06w2\\u1D306D\".indexOf(\"D\") === 6);\n\nassert(\"\\ud800\\dc00\".indexOf(\"\\dc00\") === 1);\n\nassert(\"\\u8000\\u0700\\u8000\\u8000A\".indexOf(\"A\", 3) === 4);\n\n// check prefix search\nassert(\"aaaabaaa\".indexOf(\"aaaba\") === 1);\n\n// check empty string\nassert(String.prototype.indexOf.call(new String()) === -1);\n\nassert(String.prototype.indexOf.call(\"\",\"\") === 0);\n\n// check NaN\nassert(\"Hello world, welcome to the universe.\".indexOf(NaN) === -1);\n\nassert(\"Hello world, welcome to the universe.\".indexOf(\"welcome\",NaN) === 13);\n\n// check Object\nassert(String.prototype.indexOf.call({}) === -1);\n\n// check +-Inf\nassert(\"hello world!\".indexOf(\"world\", -Infinity) === 6);\n\nassert(\"hello world!\".indexOf(\"world\", Infinity) === -1);\n\n// check numbers\nassert(\"hello world!\".indexOf(-1) === -1);\n\nassert(\"hello 0 world!\".indexOf(-0) === 6);\n\n// check undefined\nassert(\"hello world!\".indexOf(undefined) === -1);\n\nvar undefined_var;\nassert(\"Hello world, welcome to the universe.\".indexOf(\"welcome\", undefined_var) === 13);\n\n// check booleans\nassert(\"true\".indexOf(true, false) === 0);\n\n// check coercible - undefined\ntry {\n  String.prototype.indexOf.call(undefined);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - null\ntry {\n  String.prototype.indexOf.call(null);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - Boolean\nassert(String.prototype.indexOf.call(true, \"e\") === 3);\nassert(String.prototype.indexOf.call(false, \"e\") === 4);\n\n// check coercible - Object\nvar test_object = {firstName:\"John\", lastName:\"Doe\"};\nassert(String.prototype.indexOf.call(test_object, \"Obj\") === 8);\n\n// check coercible - Number\nassert(String.prototype.indexOf.call(123, \"2\") === 1);\n"
  },
  {
    "path": "tests/jerry/string-prototype-lastindexof.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// check properties\n\nfunction length_configurable()\n{\n  function is_es51() {\n    return (typeof g === \"function\");\n    { function g() {} }\n  }\n  return is_es51() ? false : true;\n}\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.lastIndexOf, 'length').configurable === length_configurable());\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.lastIndexOf, 'length').enumerable === false);\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.lastIndexOf, 'length').writable === false);\n\nassert(String.prototype.lastIndexOf.length === 1);\n\n// simple checks\nassert(\"Hello welcome, welcome to the universe.\".lastIndexOf(\"welcome\") === 15);\n\nassert(\"Hello world, welcome to the universe.\".lastIndexOf(\"Hello world, welcome to the universe.\") === 0);\n\nassert(\"Hello welcome, welcome to the universe.\".lastIndexOf(\"welcome\", 5) === -1);\n\nassert(\"Hello welcome, welcome to the universe.\".lastIndexOf(\"welcome\", -100) == -1);\n\nassert(\"Hello welcome, welcome to the universe.\".lastIndexOf(\"welcome\", 15) === 15);\n\nassert(\"Hello welcome, welcome to the universe o.\".lastIndexOf(\"o\", 10) === 10);\n\nassert(\"Hello welcome, welcome to the universe o.\".lastIndexOf(\"o\", 25) === 24);\n\nassert(\"Helloooo woooorld\".lastIndexOf(\"oooo\", 6) === 4);\n\n// check utf8 strings\nassert(\"\\uFFA2\".lastIndexOf(\"\\uFFA2\") === 0);\n\nassert(\"\\uFFA2\".lastIndexOf(\"A\") === -1);\n\nassert(\"w2\\uFFA2 A\".lastIndexOf(\"A\") === 4);\n\nassert(\"w2\\u1D306A\".indexOf(\"A\") === 4);\n\nassert(\"\\u0070A\".lastIndexOf(\"A\") === 1);\n\nassert(\"\\u8000A\".lastIndexOf(\"A\") === 1);\n\nassert(\"\\u0080\\u0080\\u0980\\u1080A\".lastIndexOf(\"A\") === 4);\n\nassert(\"\\u0080\\u0980\\u1080A\\u0080\\u0080\\u0980\\u1080\".lastIndexOf(\"A\", 4) === 3);\n\nassert(\"\\u0080\\u0080\\u0980\\u1080A\\u0980AA\\u0980A\".lastIndexOf(\"A\\u0980A\") === 7);\n\nassert(\"\\u0080\\u0080\\u0980\\u1080A\\u0980AA\\u0980A\".lastIndexOf(\"A\\u0980A\", 4) === 4);\n\nassert(\"\\uD834\\uDF06\".lastIndexOf(\"\\uDF06\") === 1);\n\nassert(\"\\uD834\\uDF06w2\\u1D306D\\uDF06w2\\u1D306D\".lastIndexOf(\"D\") === 12);\n\nassert(\"\\ud800\\dc00\\ud800\\dc00\".lastIndexOf(\"\\dc00\") === 6);\n\n// check empty string\nassert(String.prototype.lastIndexOf.call(new String()) === -1);\n\nassert(String.prototype.lastIndexOf.call(\"Hello world, welcome to the universe.\",\"\") === 37);\n\nassert(String.prototype.lastIndexOf.call(\"\",\"\") === 0);\n\n// check NaN\nassert(\"Hello world, welcome to the universe.\".lastIndexOf(NaN) === -1);\n\nassert(\"Hello world, welcome to the universe.\".lastIndexOf(\"o\", NaN) === 22);\n\n// check Object\nassert(String.prototype.lastIndexOf.call({}) === -1);\n\n// check +-Inf\nassert(\"hello world!\".lastIndexOf(\"world\", -Infinity) === -1);\n\nassert(\"hello world!\".lastIndexOf(\"world\", Infinity) === 6);\n\n// check numbers\nassert(\"hello world!\".lastIndexOf(-1) === -1);\n\nassert(\"hello 0 world!\".lastIndexOf(-0) === 6);\n\n// check undefined\nassert(\"hello world!\".lastIndexOf(undefined) === -1);\n\nvar undefined_var;\nassert(\"Hello world, welcome to the universe.\".lastIndexOf(\"welcome\", undefined_var) === 13);\n\n// check booleans\nassert(\"true\".lastIndexOf(true, false) === 0);\n\n// check coercible - undefined\ntry {\n  String.prototype.lastIndexOf.call(undefined);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - null\ntry {\n  String.prototype.lastIndexOf.call(null);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - Boolean\nassert(String.prototype.lastIndexOf.call(true, \"e\") === 3);\nassert(String.prototype.lastIndexOf.call(false, \"e\") === 4);\n\n// check coercible - Object\nvar test_object = {firstName:\"John\", lastName:\"Doe\"};\nassert(String.prototype.lastIndexOf.call(test_object, \"Obj\") === 8);\n\n// check coercible - Number\nassert(String.prototype.lastIndexOf.call(123, \"2\") === 1);\n"
  },
  {
    "path": "tests/jerry/string-prototype-localecompare.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str1 = \"ab\";\nvar str2 = \"cd\";\nassert (str1.localeCompare(str1) === 0);\nassert (str1.localeCompare(str2) === -1);\nassert (str2.localeCompare(str1) === 1);\n\nvar x = \"32\";\nvar y = \"-32\";\nassert (y.localeCompare(-31) === 1);\nassert (y.localeCompare(\"\") === 1);\nassert (y.localeCompare(-32) === 0);\nassert (x.localeCompare(33) === -1);\nassert (x.localeCompare() === -1);\nassert (x.localeCompare(null) === -1);\nassert (x.localeCompare(NaN) === -1);\nassert (x.localeCompare(Infinity) === -1);\nassert (x.localeCompare(-Infinity) === 1);\n\nvar array1 = [\"1\", 2];\nvar array2 = [3, 4];\nassert (String.prototype.localeCompare.call(42, array1) === 1);\nassert (String.prototype.localeCompare.call(array1, null) === -1);\nassert (String.prototype.localeCompare.call(array1, array1) === 0);\nassert (String.prototype.localeCompare.call(array1, array2) === -1);\nassert (String.prototype.localeCompare.call(array2, array1) === 1);\n\ntry {\n  var res = String.prototype.localeCompare.call(null, 0);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  var res = String.prototype.localeCompare.call();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/string-prototype-match-all.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert(String.prototype.matchAll.length === 1);\nvar desc = Object.getOwnPropertyDescriptor(String.prototype.matchAll, \"length\");\nassert(!desc.enumerable);\nassert(!desc.writable);\nassert(desc.configurable);\n\nassert(String.prototype.matchAll.name === \"matchAll\");\nvar desc = Object.getOwnPropertyDescriptor(String.prototype.matchAll, \"name\");\nassert(!desc.enumerable);\nassert(!desc.writable);\nassert(desc.configurable);\n\n// test basic functionality\nvar re = /[0-9]+/g;\nvar str = '2016-01-02|2019-03-07';\nvar result = str.matchAll(re);\nvar result_array = Array.from(result, x => x[0]);\nassert(result_array.toString() === \"2016,01,02,2019,03,07\");\n\nvar counter = 0;\nvar obj = {};\nRegExp.prototype[Symbol.matchAll] = function() {\n  counter++;\n  return obj;\n};\n\nassert('a'.matchAll(null) === obj);\nassert(counter === 1);\n\nassert(''.matchAll(undefined) === obj);\nassert(counter === 2) ;\n\nvar obj = {};\nvar retval = {};\nvar counter = 0;\nvar thisVal, args;\n\nobj[Symbol.matchAll] = function () {\n    counter++;\n  thisVal = this;\n  args = arguments;\n  return retval;\n};\n\nvar str = ''\n\nassert(str.matchAll(obj) === retval);\nassert(counter === 1);\nassert(thisVal === obj);\nassert(args !== undefined);\nassert(args.length === 1);\nassert(args[0] === str);\n\n// throw error when flag is not global\ntry {\n  \"foo\".matchAll(/a/);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".matchAll(/a/i);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".matchAll(/a/m);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".matchAll(/a/u);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".matchAll(/a/u);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".matchAll(/a/y);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar regexp = /a/;\nObject.defineProperty(regexp, 'flags', {\n  value: 'muyi'\n});\n\ntry {\n  \"foo\".matchAll(regexp);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when flags value is undefined\nvar regexp = /a/g;\nObject.defineProperty(regexp, 'flags', { value: undefined });\n\ntry {\n  \"foo\".matchAll(regexp)\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when match Symbol throws error\nvar regexp = /[A-Z]/g;\nObject.defineProperty (regexp, Symbol.match, { get () { throw 42; }});\n\ntry {\n  \"foo\".matchAll(regexp);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test when flags throws error\nvar regexp = /a/g;\nObject.defineProperty(regexp, 'flags', { get () { throw 42; }});\n\ntry {\n  \"foo\".matchAll(regexp);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\n// test when flags value is symbol\nvar regexp = /a/g;\nvar sym = Symbol(\"foo\")\nObject.defineProperty(regexp, 'flags', { value: sym });\n\ntry {\n  \"foo\".matchAll(regexp);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when matchAll Symbol throws error\nvar regexp = /[A-Z]/g;\nObject.defineProperty (regexp, Symbol.matchAll, { get () { throw 42; }});\n\ntry {\n  \"foo\".matchAll(regexp);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n"
  },
  {
    "path": "tests/jerry/string-prototype-match.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// check properties\n\nfunction length_configurable()\n{\n  function is_es51() {\n    return (typeof g === \"function\");\n    { function g() {} }\n  }\n  return is_es51() ? false : true;\n}\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.match, 'length').configurable === length_configurable());\nassert(Object.getOwnPropertyDescriptor(String.prototype.match, 'length').enumerable === false);\nassert(Object.getOwnPropertyDescriptor(String.prototype.match, 'length').writable === false);\n\nfunction match_equals (match_result, expected)\n{\n  if (match_result.length !== expected.length)\n  {\n    return false;\n  }\n\n  for(var i = 0; i < expected.length; i++)\n  {\n    if (match_result[i] !== expected[i])\n    {\n      return false;\n    }\n  }\n\n  return true;\n}\n\nassert (match_equals (\"hello\".match(\"o\"), [\"o\"]));\nassert (\"hello\".match(/ /g) == void 0);\n\nassert (match_equals (\"hello\".match(/o/), [\"o\"]));\n\nassert (match_equals (\"hello\".match(/l/), [\"l\"]));\nassert (match_equals (\"hello\".match(/l/g), [\"l\", \"l\"]));\n\nassert (\"\".match(/a/g) == void 0);\n\nassert (\"\".match() !== void 0 );\n\nassert (match_equals (\"\".match(), [\"\"]));\nassert (match_equals (\"\".match(undefined), [\"\"]));\nassert (match_equals (\"\".match(\"\"), [\"\"]));\n\nassert (match_equals (\"test 1, test 2, test 3, test 45\".match(/[0-9]+/g), [\"1\", \"2\", \"3\", \"45\"]));\n\nvar re = new RegExp(\"\", \"g\");\nassert (match_equals (\"a\".match(re), [\"\", \"\"]));\n\n\n/* Check Object coercible */\ntry {\n  String.prototype.match.call(undefined, \"\");\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\n/* Check toString conversion */\ntry {\n  var obj = { toString: function() { throw new ReferenceError(\"foo\"); } };\n  String.prototype.match.call(obj, \"\");\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof ReferenceError);\n  assert (e.message === \"foo\");\n}\n\n/* Check Invalid RegExp */\ntry {\n  var obj = { toString: function() { throw new ReferenceError(\"foo\"); } };\n  \"\".match (obj);\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof ReferenceError);\n  assert (e.message === \"foo\");\n}\n\n/* Check if lastIndex is set to 0 on start */\nvar re = /a/g;\nre.lastIndex = 3;\n\nassert (match_equals (\"a\".match(re), [\"a\"]));\n\nclass NewRegExp extends RegExp {\n  [Symbol.match](str) {\n      var result = RegExp.prototype[Symbol.match].call(this, str);\n      var successful = 0;\n      if (result) {\n          successful = 1;\n      }\n      return successful;\n  }\n}\n\nvar str = 'This is a random string.';\nvar regexp = new NewRegExp(/[A-Z]/g);\nassert(str.match(regexp) === 1);\n\ntry {\nString.prototype.match.call(null, regexp);\nassert(false);\n} catch (e) {\nassert(e instanceof TypeError);\n}\n\nvar regexp2 = /[A-Z]/g;\nregexp2[Symbol.match] = \"foo\";\n\ntry {\nstr.match(regexp2);\nassert(false);\n} catch (e) {\nassert(e instanceof TypeError);\n}\n\nObject.defineProperty (regexp2, Symbol.match, { get () { throw 5 }});\n\ntry {\nstr.match(regexp2);\nassert(false);\n} catch (e) {\nassert(e === 5);\n}\n\nvar wrong_sytnax = \"str.match(/[A-5]/g\";\n\ntry {\neval(wrong_sytnax);\nassert(false);\n} catch (e) {\nassert(e instanceof SyntaxError);\n}\n\ndelete(RegExp.prototype[Symbol.match]);\n\ntry {\nstr.match(regexp);\nassert(false);\n} catch (e) {\nassert(e instanceof TypeError);\n}\n\nvar regexp3 = \"foo\";\nRegExp.prototype[Symbol.match] = 3;\n\ntry {\nstr.match(regexp3);\nassert(false);\n} catch (e) {\nassert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/string-prototype-padding.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar test = \"bar\"\n\nassert(test.padStart(\"5\", \"foo\") === \"fobar\")\nassert(test.padStart(6, \"foo\") === \"foobar\")\nassert(test.padStart(8, '1234')=== \"12341bar\")\nassert(test.padEnd(5, \"baz\") === \"barba\")\nassert(test.padEnd(6, \"baz\") === \"barbaz\")\nassert(test.padEnd(8, '1234')=== \"bar12341\")\n\n// Check for negative value\nassert(test.padStart(-5, \"foo\") === \"bar\")\nassert(test.padEnd(-5, \"foo\") === \"bar\")\n\n// 21.1.3.15.1.6\nassert(test.padStart(10) === \"       bar\")\nassert(test.padEnd(10) === \"bar       \")\n\n// Empty FilString\nassert(test.padEnd(10, \"\") === \"bar\")\nassert(test.padStart(10, \"\") === \"bar\")\n\n// Check with unicode surrogate characters\n// 𐋀 = [55296, 57024]\nvar unicode_padded = \"a\".padStart(4 ,\"𐋀\")\nassert(unicode_padded.charCodeAt(0) == 55296)\nassert(unicode_padded.charCodeAt(1) == 57024)\nassert(unicode_padded.charCodeAt(2) == 55296)\nassert(unicode_padded.charCodeAt(3) == 97)\n\nunicode_padded = \"a\".padEnd(4 ,\"𐋀\")\nassert(unicode_padded.charCodeAt(0) == 97)\nassert(unicode_padded.charCodeAt(1) == 55296)\nassert(unicode_padded.charCodeAt(2) == 57024)\nassert(unicode_padded.charCodeAt(3) == 55296)\n\n// 𐋂 = [55296, 57026]\nunicode_padded = \"𐋂\".padStart(4 ,\"𐋀\")\nassert(unicode_padded.charCodeAt(0) == 55296)\nassert(unicode_padded.charCodeAt(1) == 57024)\nassert(unicode_padded.charCodeAt(2) == 55296)\nassert(unicode_padded.charCodeAt(3) == 57026)\n\n// Check for errors in length\ntry {\n  test.padStart(Symbol(\"Will this fail?\"), \"It should\" )\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\ntry {\n  test.padEnd(Symbol(\"Will this fail?\"), \"It should\" )\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n// Check for errors in fillString\ntry {\n  test.padStart(10, Symbol(\"Fail, this should. \" ))\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\ntry {\n  test.padEnd(10, Symbol(\"Fail, this should. \" ))\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/string-prototype-repeat.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// ES v6.0 21.1.3.13.6\nvar z = \"I am vengeance\";\ntry {\n  z.repeat (-1);\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\n// ES v6.0 21.1.3.13.7\nvar x = \"I am the night\";\ntry {\n  print(z.repeat (Infinity));\n  assert (false);\n} catch (e) {\n  assert (e instanceof RangeError);\n}\n\n// ES v6.0 21.1.3.13.8\nassert (z.repeat (0) === \"\");\nassert (z.repeat (NaN) === \"\");\n\nvar y = \"I am batman \";\nassert (y.repeat (3) === \"I am batman I am batman I am batman \");\n\nassert (String.prototype.repeat.call (\"My cat is awesome. \", 3) === \"My cat is awesome. My cat is awesome. My cat is awesome. \");\n\ntry {\n  String.prototype.repeat.call (undefined);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  String.prototype.repeat.call (null);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  String.prototype.repeat.call (undefined, \"Sylveon\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar a = Symbol (\"Unicorn invasion.\", 3);\ntry {\n  String.prototype.repeat.call (a);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\n"
  },
  {
    "path": "tests/jerry/string-prototype-replace-all.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Copyright (C) 2019 Leo Balter. All rights reserved.\n// This code is governed by the BSD license found in the LICENSE file.\n\nassert(String.prototype.replaceAll.length === 2);\nvar desc = Object.getOwnPropertyDescriptor(String.prototype.replaceAll, \"length\");\nassert(!desc.enumerable);\nassert(!desc.writable);\nassert(desc.configurable);\n\nassert(String.prototype.replaceAll.name === \"replaceAll\");\nvar desc = Object.getOwnPropertyDescriptor(String.prototype.replaceAll, \"name\");\nassert(!desc.enumerable);\nassert(!desc.writable);\nassert(desc.configurable);\n\n/**\n * Note: The RegExp based replaceAll works the same as the replace method except one special case,\n * when the regexp argument doesn't have a global flag, because then it throws an error\n */\n\ntry {\n  \"foo\".replaceAll(/./);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".replaceAll(/./i);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".replaceAll(/./m);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".replaceAll(/./u);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".replaceAll(/./y);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar regexp = /a/;\nObject.defineProperty(regexp, 'flags', {\n  value: 'muyi'\n});\n\ntry {\n  \"foo\".replaceAll(regexp);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nvar regexp = /a/g;\nObject.defineProperty(regexp, 'flags', { value: undefined });\n\ntry {\n  \"foo\".replaceAll(regexp);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test basic functionality\nvar str = \"foobarfoo\";\nassert(str.replaceAll(\"foo\", \"bar\") === \"barbarbar\");\n\nvar str = \"ab c ab cdab cab c\"\nassert(str.replaceAll(\"ab c\", \"z\") === \"z zdzz\");\n\nvar str = \"ab c\"\nassert(str.replaceAll(\"ab c\", \"z\") === \"z\");\n\nvar str = \"ab c \"\nassert(str.replaceAll(\"ab c\", \"z\") === \"z \");\n\nassert('aaab a a aac'.replaceAll('aa', 'z') === 'zab a a zc');\nassert('aaab a a aac'.replaceAll('aa', 'a') === 'aab a a ac');\nassert('aaab a a aac'.replaceAll('a', 'a') === 'aaab a a aac');\nassert('aaab a a aac'.replaceAll('a', 'z') === 'zzzb z z zzc');\n\nfunction replaceValue() {\n  throw 42;\n}\n\nassert('a'.replaceAll('b', replaceValue) === \"a\");\nassert('a'.replaceAll('aa', replaceValue) === \"a\")\n\nassert('aab c  \\nx'.replaceAll('', '_') === '_a_a_b_ _c_ _ _\\n_x_');\nassert('a'.replaceAll('', '_') === '_a_');\n\n// test with replacement string\nvar str = 'Ninguém é igual a ninguém. Todo o ser humano é um estranho ímpar.';\nassert(str.replaceAll('ninguém', '$$') ==='Ninguém é igual a $. Todo o ser humano é um estranho ímpar.');\nassert(str.replaceAll('é', '$$') === 'Ningu$m $ igual a ningu$m. Todo o ser humano $ um estranho ímpar.');\nassert(str.replaceAll('é', '$$ -') === 'Ningu$ -m $ - igual a ningu$ -m. Todo o ser humano $ - um estranho ímpar.');\nassert(str.replaceAll('é', '$$&') === 'Ningu$&m $& igual a ningu$&m. Todo o ser humano $& um estranho ímpar.');\nassert(str.replaceAll('é', '$$$') === 'Ningu$$m $$ igual a ningu$$m. Todo o ser humano $$ um estranho ímpar.');\nassert(str.replaceAll('é', '$$$$') === 'Ningu$$m $$ igual a ningu$$m. Todo o ser humano $$ um estranho ímpar.');\n\nassert(str.replaceAll('ninguém', '$&') === 'Ninguém é igual a ninguém. Todo o ser humano é um estranho ímpar.');\nassert(str.replaceAll('ninguém', '($&)') === 'Ninguém é igual a (ninguém). Todo o ser humano é um estranho ímpar.');\nassert(str.replaceAll('é', '($&)') === 'Ningu(é)m (é) igual a ningu(é)m. Todo o ser humano (é) um estranho ímpar.');\nassert(str.replaceAll('é', '($&) $&') === 'Ningu(é) ém (é) é igual a ningu(é) ém. Todo o ser humano (é) é um estranho ímpar.');\n\nassert(str.replaceAll('ninguém', '$\\'') === 'Ninguém é igual a . Todo o ser humano é um estranho ímpar.. Todo o ser humano é um estranho ímpar.');\nassert(str.replaceAll('.', '--- $\\'') === 'Ninguém é igual a ninguém---  Todo o ser humano é um estranho ímpar. Todo o ser humano é um estranho ímpar--- ');\nassert(str.replaceAll('é', '($\\')') === 'Ningu(m é igual a ninguém. Todo o ser humano é um estranho ímpar.)m ( igual a ninguém. Todo o ser humano é um estranho ímpar.) igual a ningu(m. Todo o ser humano é um estranho ímpar.)m. Todo o ser humano ( um estranho ímpar.) um estranho ímpar.');\nassert(str.replaceAll('é', '($\\') $\\'') === 'Ningu(m é igual a ninguém. Todo o ser humano é um estranho ímpar.) m é igual a ninguém. Todo o ser humano é um estranho ímpar.m ( igual a ninguém. Todo o ser humano é um estranho ímpar.)  igual a ninguém. Todo o ser humano é um estranho ímpar. igual a ningu(m. Todo o ser humano é um estranho ímpar.) m. Todo o ser humano é um estranho ímpar.m. Todo o ser humano ( um estranho ímpar.)  um estranho ímpar. um estranho ímpar.');\n\nassert(str.replaceAll('ninguém', '$`') === 'Ninguém é igual a Ninguém é igual a . Todo o ser humano é um estranho ímpar.');\nassert(str.replaceAll('Ninguém', '$`') === ' é igual a ninguém. Todo o ser humano é um estranho ímpar.');\nassert(str.replaceAll('ninguém', '($`)') === 'Ninguém é igual a (Ninguém é igual a ). Todo o ser humano é um estranho ímpar.');\nassert(str.replaceAll('é', '($`)') === 'Ningu(Ningu)m (Ninguém ) igual a ningu(Ninguém é igual a ningu)m. Todo o ser humano (Ninguém é igual a ninguém. Todo o ser humano ) um estranho ímpar.');\nassert(str.replaceAll('é', '($`) $`') === 'Ningu(Ningu) Ningum (Ninguém ) Ninguém  igual a ningu(Ninguém é igual a ningu) Ninguém é igual a ningum. Todo o ser humano (Ninguém é igual a ninguém. Todo o ser humano ) Ninguém é igual a ninguém. Todo o ser humano  um estranho ímpar.');\n\n// test when functional replacer toString throws error\nfunction custom() {\n  return {\n    toString() {\n      throw 42;\n    }\n  }\n}\n\ntry {\n  'a'.replaceAll('a', custom);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\nfunction symbol() {\n  return {\n    toString() {\n      return Symbol();\n    }\n  }\n}\n  \ntry {\n  'a'.replaceAll('a', symbol);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// test when functional replacer Symbol.replace throws error\nvar poisoned = 0;\nvar poison = {\n  toString() {\n    poisoned += 1;\n    throw 'Should not call toString on this/replaceValue';\n  },\n};\n\nvar searchValue = {\n  [Symbol.match]: false,\n  flags: 'g',\n  [Symbol.replace]() {\n    throw 42;\n  },\n  toString() {\n    throw 'Should not call toString on searchValue';\n  }\n};\n\ntry {\n  ''.replaceAll.call(poison, searchValue, poison);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n\nassert(poisoned === 0);\n\n// test when flags value is undefined or null\nvar poisoned = 0;\nvar poison = {\n  toString() {\n    poisoned += 1;\n    throw 'Should not call toString on this/replaceValue';\n  },\n};\n\nvar called = 0;\nvar value = undefined;\nvar searchValue = {\n  [Symbol.match]: true,\n  get flags() {\n    called += 1;\n    return value;\n  }\n};\n\ntry {\n  ''.replaceAll.call(poison, searchValue, poison);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(called === 1) // 1);\n\ncalled = 0;\nvalue = null;\n\ntry {\n  ''.replaceAll.call(poison, searchValue, poison);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(called === 1);\nassert(poisoned === 0);\n\n// test when Symbol.match throws error\nvar searchValue = {\n  get [Symbol.match]() {\n    throw 42;\n  }\n};\n\ntry {\n  ''.replaceAll.call(poison, searchValue, poison);\n  assert(false);\n} catch (e) {\n  assert(e === 42);\n}\n"
  },
  {
    "path": "tests/jerry/string-prototype-replace.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (\"abcabc\".replace(\"bc\", \":\") === \"a:abc\");\nassert (\"hello\".replace(\"\", \":\") === \":hello\");\nassert (\"hello\".replace(\"h\", \"\") === \"ello\");\nassert (\"\".replace(\"\", \"h\") === \"h\");\n\nassert (\"xabcxabcx\".replace (/abc/g, \"[$&][$`][$']\") === \"x[abc][x][xabcx]x[abc][xabcx][x]x\");\nassert (\"abc\".replace (/a(b)c|d()/, \"[$1][$01][$2][$02][$99][$123][$012]\") === \"[b][b][][][$99][b23][b2]\");\nassert (\"abc\".replace(\"abc\", \"$x$$5$0$00$\") === \"$x$5$0$00$\");\n\nassert (\"#x#\".replace(\"x\", \"$1\") === \"#$1#\");\nassert (\"#x#\".replace(/(x)/, \"$1$2\") === \"#x$2#\");\nassert (\"#x#\".replace(/(x)/, \"$01$02$11$20\") === \"#x$02x1$20#\");\nassert (\"#xy#\".replace(/(x)((((((((((y))))))))))/, \"$07|$20|$11|$12|$110|$99|$011\") === \"#y|y0|y|x2|y0|y9|x1#\");\nassert (\"#xy#\".replace(/(x)((((((((y))))))))/, \"$00|$01|$011|$090|$10|$99\") === \"#$00|x|x1|y0|x0|y9#\");\n\nassert (\"a true true story\".replace(true) === \"a undefined true story\");\nassert (\"1234\".replace(23, 32) === \"1324\");\n\nassert (\"abcabc\".replace(/bc/, \":\") === \"a:abc\");\nassert (\"axbcxx\".replace(/x*/g, \":\") === \":a::b:c::\");\n\nassert (\"\".replace(/|/g,\"஻\") === \"஻\");\nassert (\"஻BB8B@abXde^\".replace(/a/g,\"$஻Bce((/a%\") === \"஻BB8B@$஻Bce((/a%bXde^\");\nassert (\"abcab\".replace(/a/g,\"˙Ł$Đ\") === \"˙Ł$Đbc˙Ł$Đb\");\nassert (\"˙Ł$Đbc˙Ł$Đb\".replace(\"Ł$\",\"ab\") === \"˙abĐbc˙Ł$Đb\");\n\nassert (String.prototype.replace.call (12321, /2/g, \".\") === \"1.3.1\");\n\ntry\n{\n  String.prototype.replace.call (null, \"u\", \".\");\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nassert (\"98765\".replace(76, function () { return {}; }) === \"98[object Object]5\");\n\nfunction concat_arguments()\n{\n  var str = \"\";\n  for (var i = 0; i < arguments.length; i++)\n  {\n    str += \"[\" + arguments[i] + \"]\";\n  }\n  return str;\n}\n\nassert (\"abcdabcd\".replace(\"cd\", concat_arguments) === \"ab[cd][2][abcdabcd]abcd\");\nassert (\"abcdef\".replace (/a((b)c)|d()/, concat_arguments) === \"[abc][bc][b][undefined][0][abcdef]def\");\n\ntry\n{\n  \"x\".replace(\"x\", function() { throw \"MyError\"; });\n  assert (false);\n}\ncatch (e)\n{\n  assert (e === \"MyError\");\n}\n\nassert (\"\\ud801\\udc00\".replace(\"\\ud801\", \"#\") === \"#\\udc00\");\nassert (\"\\ud801\\udc00\".replace(\"\\udc00\", \"#\") === \"\\ud801#\");\n\nvar global = this;\n\nfunction case1()\n{\n  assert(this === global);\n  return \"y\";\n}\n\nfunction case2()\n{\n  \"use strict\";\n  assert(this === undefined);\n  return \"y\";\n}\n\nassert (\"x\".replace(\"x\", case1) === \"y\");\nassert (\"x\".replace(\"x\", case2) === \"y\");\n\nvar regexp = /r/g;\n\nObject.defineProperty(regexp, \"lastIndex\", {\n  configurable : false,\n  enumerable : false,\n  value : 0,\n  writable : false\n});\n\ntry {\n  \"r\".replace (regexp, \"x\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  \"str\".replace ({toString: function () {throw \"abrupt search toString\"}}, \"\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt search toString\");\n}\n\ntry {\n  \"str\".replace (\"str\", {toString: function () {throw \"abrupt search toString\"}});\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt search toString\");\n}\n\ntry {\n  \"str\".replace (\"str\", function () {return {toString: function () {throw \"abrupt replacer toString\"}}});\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt replacer toString\");\n}\n\nvar r = /./;\nr.lastIndex = {\n  valueOf: function() {\n    throw \"abrupt lastIndex\"\n  }\n}\n\ntry {\n  \"a\".replace(r, \"b\");\n  assert(false);\n} catch (e) {\n  assert(e === \"abrupt lastIndex\");\n}\n"
  },
  {
    "path": "tests/jerry/string-prototype-search.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (\"abcabbcd\".search (/abb+c/) === 3);\nassert (\"ababbccabd\".search (\"((?:(ax))|(bx)|ab*c+)\") === 2);\nassert (\"acbaabcabcabc\".search (/b+c/g) === 5);\nassert (\"abcabd\".search (\"c?a+d\") === -1);\n\nassert (String.prototype.search.call ({}, \"ec+t\") === 4);\n\ntry\n{\n  String.prototype.search.call (null, \"u\");\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nvar regexp = /x/g;\nregexp.lastIndex = \"index\";\n\nassert (\"aaxbb\".search (regexp) === 2);\nassert (\"aabb\".search (regexp) === -1);\nassert (regexp.lastIndex === \"index\");\n\nassert (\"##\\ud801\\udc00\".search (\"\\ud801\") === 2);\nassert (\"##\\ud801\\udc00\".search (\"\\udc00\") === 3);\n"
  },
  {
    "path": "tests/jerry/string-prototype-slice.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str = \"universe\";\nvar res;\n\nres = str.slice();\nassert (res === \"universe\");\n\nres = str.slice(1, 6);\nassert (res === \"niver\");\n\nres = str.slice(\"a\", \"-4\");\nassert (res === \"univ\");\n\nres = str.slice(-5);\nassert (res === \"verse\");\n\nres = str.slice(-12, undefined);\nassert (res === \"universe\");\n\nres = str.slice(undefined, -20);\nassert (res === \"\");\n\nres = str.slice(undefined, undefined);\nassert (res === \"universe\");\n\nres = str.slice(Infinity, NaN);\nassert (res === \"\");\n\nres = str.slice(-Infinity, Infinity);\nassert (res === \"universe\");\n\nres = str.slice(NaN, -Infinity);\nassert (res === \"\");\n\nres = str.slice(false, true);\nassert (res === \"u\");\n\nvar x;\nres = str.slice(x, x);\nassert (res === \"universe\");\n\nvar obj = {y: \"foo\"};\nvar arr = [x, x];\nres = str.slice(obj, arr);\nassert (res === \"\");\n"
  },
  {
    "path": "tests/jerry/string-prototype-split.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar res = \"\".split();\nassert (res[0] === \"\");\n\nres = \"foo\".split();\nassert (res[0] === \"foo\");\n\nvar str = \"foo//bar/baz//foo\";\nres = str.split(\"\");\n\nassert (res.length === 17);\nfor (var i = 0; i < res.length; i++)\n{\n  assert (res[i] === str[i]);\n}\n\nres = str.split(\"\", \"foo\");\nassert (res.length === 0);\n\nres = str.split(\"\", \"4\");\nassert (res.length === 4);\nfor (var i = 0; i < res.length; i++)\n{\n  assert (res[i] === str[i]);\n}\n\nres = str.split(undefined, undefined)\nassert (res.length === 1);\nassert (res[0] === \"foo//bar/baz//foo\");\n\nres = str.split(\"a\", false);\nassert (res.length === 0);\n\nres = str.split(\"a\", true);\nassert (res.length === 1);\nassert (res[0] === \"foo//b\");\n\nres = str.split(\"a\", NaN);\nassert (res.length === 0);\n\nres = str.split([\"o\"])\nassert (res.length === 5);\nassert (res[0] === \"f\");\nassert (res[1] === \"\");\nassert (res[2] === \"//bar/baz//f\");\nassert (res[3] === \"\");\nassert (res[4] === \"\");\n\nres = str.split([\"o\", \"/\"]);\nassert (res.length === 1);\nassert (res[0] === \"foo//bar/baz//foo\");\n\nres = str.split(\"a\", [\"2\"]);\nassert (res.length === 2);\nassert (res[0] === \"foo//b\");\nassert (res[1] === \"r/b\");\n\nres = str.split(\"a\", [\"2\", \"3\"]);\nassert (res.length === 0);\n\nvar obj = {x: 12, b: undefined};\nres = str.split(obj, 4);\nassert (res.length === 1);\nassert (res[0] === \"foo//bar/baz//foo\");\n\nres = str.split(\"o\", obj);\nassert (res.length === 0);\n\nres = str.split(false, true);\nassert (res.length === 1);\nassert (res[0] === \"foo//bar/baz//foo\");\n\nres = str.split(/\\/\\//);\nassert (res.length === 3);\nassert (res[0] === \"foo\");\nassert (res[1] === \"bar/baz\");\nassert (res[2] === \"foo\");\n\nres = str.split(/\\/\\//, 1);\nassert (res.length === 1);\nassert (res[0] === \"foo\");\n\nstr = \"fo123o12bar\";\nres = str.split(12, undefined);\nassert (res.length === 3);\nassert (res[0] === \"fo\");\nassert (res[1] === \"3o\");\nassert (res[2] === \"bar\");\n\nstr = \"aaabababaab\";\nres = str.split(/aa+/);\nassert (res.length === 3);\nassert (res[0] === \"\");\nassert (res[1] === \"babab\");\nassert (res[2] === \"b\");\n\nstr = \"A<B>bold</B>and<CODE>coded</CODE>\";\nres = str.split(/<(\\/)?([^<>]+)>/);\nassert (res.length === 13);\nvar expected = [\"A\", undefined, \"B\", \"bold\", \"/\", \"B\", \"and\", undefined, \"CODE\", \"coded\", \"/\", \"CODE\", \"\"];\nfor (var i = 0; i < res.length; i++)\n{\n  assert (res[i] === expected[i]);\n}\n\n/* Check Object coercible */\ntry {\n  String.prototype.split.call(undefined, \"\");\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\n/* Check toString conversion */\ntry {\n  var obj = { toString: function() { throw new ReferenceError(\"foo\"); } };\n  String.prototype.split.call(obj, \"\");\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof ReferenceError);\n  assert (e.message === \"foo\");\n}\n\n/* Check Invalid RegExp */\ntry {\n  var obj = { toString: function() { throw new ReferenceError(\"foo\"); } };\n  \"\".split(obj);\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof ReferenceError);\n  assert (e.message === \"foo\");\n}\n\nvar str = \"foo//bar/baz//foo\";\nres = str.split(\"a\", Infinity);\nassert (res.length === 0);\n\nres = str.split(/\\/\\//, -1);\nassert (res.length === 3);\nassert (res[0] === \"foo\");\nassert (res[1] === \"bar/baz\");\nassert (res[2] === \"foo\");\n"
  },
  {
    "path": "tests/jerry/string-prototype-startswith.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar x = \"My cat is awesome\";\nassert (x.startsWith (\"My\"));\nassert (x.startsWith (\"cat\", 3));\nassert (x.startsWith (\"awesome\", 10));\nassert (x.startsWith (\"\"));\nassert (x.startsWith (\"\", 1));\nassert (x.startsWith (\"\", 17));\nassert (x.startsWith ([]));\n\nassert (x.startsWith (\"doggo\") === false);\nassert (x.startsWith (\"awesome\", 2) === false);\nassert (x.startsWith (\"awesome\", \"oi\") === false);\nassert (x.startsWith (\"kitten\", 30) === false);\nassert (x.startsWith (undefined) === false);\nassert(String.prototype.startsWith.call (5) === false);\n\nvar test_obj = {toString: function() { return \"The world of Eorzea\"; } };\ntest_obj.startsWith = String.prototype.startsWith;\nassert (test_obj.startsWith (\"The\") === true);\nassert (test_obj.startsWith (\"Viera\") === false);\n\ntry {\n  String.prototype.startsWith.call (Symbol());\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  String.prototype.startsWith.call (undefined);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ny = /[/]/;\ntry {\n  x.startsWith (y);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ny[Symbol.match] = false;\nassert(x.startsWith(y) === false);\n\ntry {\n  \"foo\".startsWith({[Symbol.match] : true});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  \"foo\".startsWith({get [Symbol.match] () { throw 5}});\n  assert(false);\n} catch (e) {\n  assert(e === 5);\n}\n"
  },
  {
    "path": "tests/jerry/string-prototype-substr.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// check properties\n\nfunction length_configurable()\n{\n  function is_es51() {\n    return (typeof g === \"function\");\n    { function g() {} }\n  }\n  return is_es51() ? false : true;\n}\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.substr, 'length').configurable === length_configurable());\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.substr, 'length').enumerable === false);\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.substr, 'length').writable === false);\n\nassert(String.prototype.substr.length === 2);\n\nassert(String.prototype.substr.call(new String()) === \"\");\n\nassert(String.prototype.substr.call({}) === \"[object Object]\");\n\n// check this is undefined\ntry {\n  String.prototype.substr.call(undefined);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// check this is null\ntry {\n  String.prototype.substr.call(null);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// simple checks\nassert(\"Hello world!\".substr(0, 11) === \"Hello world\");\n\nassert(\"Hello world!\".substr(11, 0) === \"\");\n\nassert(\"Hello world!\".substr(0, 12) === \"Hello world!\");\n\nassert(\"Hello world!\".substr(12, 0) === \"\");\n// check NaN\nassert(\"Hello world!\".substr(NaN, 12) === \"Hello world!\");\n\n// check NaN\nassert(\"Hello world!\".substr(2, NaN) === \"\");\n\n// check end undefined\nassert(\"Hello world!\".substr(2, undefined) === \"llo world!\");\n\n// check negative\nassert(\"Hello world!\".substr(-1,8) === \"!\");\n\n// check negative\nassert(\"Hello\\tworld!\".substr(5,-8) === \"\");\n\n// check negative\nassert(\"Hello world!\".substr(-1,-8) === \"\");\n\n// check ranges\nassert(\"Hello world!\".substr(-1,10000) === \"!\");\n\nassert(\"Hello world!\".substr(10000,1000000) === \"\");\n\nassert(\"Hello world!\".substr(100000,1) === \"\");\n\n// check both undefined\nassert(\"Hello world!\".substr(undefined, undefined) === \"Hello world!\");\n\nvar undef_var;\nassert(\"Hello world!\".substr(undef_var, undef_var) === \"Hello world!\");\n\n// check integer conversion\nassert(\"Hello world!\".substr(undefined, 5) === \"Hello\");\n\nassert(\"Hello world!\".substr(undefined, \"bar\") === \"\");\n\nassert(\"Hello world!\".substr(2, true) === \"l\");\n\nassert(\"Hello world!\".substr(2, false) === \"\");\n\nassert(\"Hello world!\".substr(5, obj) === \" world!\");\n\n// check other objects\nvar obj = { substr : String.prototype.substr }\n\nobj.toString = function() {\n    return \"Iam\";\n}\nassert(obj.substr(0,1) === \"I\");\n\nobj.toString = function() {\n  throw new ReferenceError (\"foo\");\n};\n\ntry {\n  assert(obj.substr(100000,1));\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// check coercible - undefined\ntry {\n  assert(true.substr() === \"\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - null\ntry {\n  assert(String.prototype.substr.call(null, 0, 1) === \"\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - Boolean\nassert(String.prototype.substr.call(true, 0, 1) === \"t\");\n\n// check coercible - Object\nvar test_object = {firstName:\"John\", lastName:\"Doe\"};\nassert(String.prototype.substr.call(test_object, 0, 7) === \"[object\");\n\n// check coercible - Number\nassert(String.prototype.substr.call(123, 0, 3) === \"123\");\n"
  },
  {
    "path": "tests/jerry/string-prototype-substring.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// check properties\n\nfunction length_configurable()\n{\n  function is_es51() {\n    return (typeof g === \"function\");\n    { function g() {} }\n  }\n  return is_es51() ? false : true;\n}\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.substring, 'length').configurable === length_configurable());\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.substring, 'length').enumerable === false);\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.substring, 'length').writable === false);\n\nassert(String.prototype.substring.length === 2);\n\nassert(String.prototype.substring.call(new String()) === \"\");\n\nassert(String.prototype.substring.call({}) === \"[object Object]\");\n\n// check this is undefined\ntry {\n  String.prototype.substring.call(undefined);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// check this is null\ntry {\n  String.prototype.substring.call(null);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// simple checks\nassert(\"hello world!\".substring(0, 11) === \"hello world\");\n\nassert(\"hello world!\".substring(11, 0) === \"hello world\");\n\nassert(\"hello world!\".substring(0, 12) === \"hello world!\");\n\nassert(\"hello world!\".substring(12, 0) === \"hello world!\");\n\n// check NaN\nassert(\"hello world!\".substring(NaN, 12) === \"hello world!\");\n\n// check NaN\nassert(\"hello world!\".substring(2, NaN) === \"he\");\n\n// check end undefined\nassert(\"hello world!\".substring(2, undefined) === \"llo world!\");\n\n// check negative\nassert(\"hello world!\".substring(-1,8) === \"hello wo\");\n\n// check negative\nassert(\"hello\\tworld!\".substring(5,-8) === \"hello\");\n\n// check negative\nassert(\"hello world!\".substring(-1,-8) === \"\");\n\n// check ranges\nassert(\"hello world!\".substring(-1,10000) === \"hello world!\");\n\nassert(\"hello world!\".substring(10000,1000000) === \"\");\n\nassert(\"hello world!\".substring(100000,1) === \"ello world!\");\n\n// check both undefined\nassert(\"hello world!\".substring(undefined, undefined) === \"hello world!\");\n\nvar undef_var;\nassert(\"hello world!\".substring(undef_var, undef_var) === \"hello world!\");\n\n// check integer conversion\nassert(\"hello world!\".substring(undefined, 5) === \"hello\");\n\nassert(\"hello world!\".substring(undefined, \"bar\") === \"\");\n\nassert(\"hello world!\".substring(2, true) === \"e\");\n\nassert(\"hello world!\".substring(2, false) === \"he\");\n\nassert(\"hello world!\".substring(5, obj) === \" world!\");\n\n// check other objects\nvar obj = { substring : String.prototype.substring }\n\nobj.toString = function() {\n    return \"Iam\";\n}\nassert(obj.substring(100000,1) === \"am\");\n\nobj.toString = function() {\n  throw new ReferenceError (\"foo\");\n};\n\ntry {\n  assert(obj.substring(100000,1));\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n\n// check coercible - undefined\ntry {\n  assert(true.substring() === \"\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - null\ntry {\n  assert(String.prototype.substring.call(null, 0, 1) === \"\");\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// check coercible - Boolean\nassert(String.prototype.substring.call(true, 0, 1) === \"t\");\n\n// check coercible - Object\nvar test_object = {firstName:\"John\", lastName:\"Doe\"};\nassert(String.prototype.substring.call(test_object, 0, 7) === \"[object\");\n\n// check coercible - Number\nassert(String.prototype.substring.call(123, 0, 3) === \"123\");\n"
  },
  {
    "path": "tests/jerry/string-prototype-trim.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// check properties\n\nfunction length_configurable()\n{\n  function is_es51() {\n    return (typeof g === \"function\");\n    { function g() {} }\n  }\n  return is_es51() ? false : true;\n}\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.trim, 'length').configurable === length_configurable());\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.trim, 'length').enumerable === false);\n\nassert(Object.getOwnPropertyDescriptor(String.prototype.trim, 'length').writable === false);\n\nassert(String.prototype.trim.length === 0);\n\n// check this value\nassert(String.prototype.trim.call(new String()) === \"\");\n\nassert(String.prototype.trim.call({}) === \"[object Object]\");\n\n// check undefined\ntry {\n  String.prototype.trim.call(undefined);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// check null\ntry {\n  String.prototype.trim.call(null);\n  assert(false);\n} catch(e) {\n  assert(e instanceof TypeError);\n}\n\n// simple checks\nassert(\" hello world\".trim() === \"hello world\");\n\nassert(\"hello world \".trim() === \"hello world\");\n\nassert(\"    hello world   \".trim() === \"hello world\");\n\nassert(\"\\t  hello world\\n\".trim() === \"hello world\");\n\nassert(\"\\t\\n  hello world\\t \\n \".trim() === \"hello world\");\n\nassert(\"hello world\\n   \\t\\t\".trim() === \"hello world\");\n\nassert(\" hello world \\\\ \".trim() === \"hello world \\\\\");\n\nassert(\"**hello world**\".trim() === \"**hello world**\");\n\nassert(\" \\t \\n\".trim() === \"\");\n\nassert(\"          \".trim() === \"\");\n\nassert(\"\".trim() === \"\");\n\nassert(\"\\uf389\".trim() === \"\\uf389\");\nassert(String.prototype.trim.call('\\uf389') === \"\\uf389\");\nassert(\"\\u20291\\u00D0\".trim() === \"1\\u00D0\");\nassert(\"\\u20291\\u00A0\".trim() === \"1\");\n\nassert(\"\\u0009\\u000B\\u000C\\u0020\\u00A01\".trim() === \"1\");\nassert(\"\\u000A\\u000D\\u2028\\u202911\".trim() === \"11\");\n\nassert(\"\\u0009\\u000B\\u000C\\u0020\\u00A01\\u0009\\u000B\\u000C\\u0020\\u00A0\".trim() === \"1\");\nassert(\"\\u000A\\u000D\\u2028\\u202911\\u000A\\u000D\\u2028\\u2029\".trim() === \"11\");\n\nassert (\"\\u200B\".trim() === '\\u200B')\nassert (\"\\u200A\".trim() === '')\nassert (\"\\u00A0\".trim() === '')\n\nvar test = \"  asd  \";\nassert(test.trimStart() === \"asd  \")\nassert(test.trimStart().length === 5)\nassert(test.trimLeft() === \"asd  \")\nassert(test.trimLeft().length === 5)\nassert(String.prototype.trimStart === String.prototype.trimLeft)\n\nassert(test.trimEnd() === \"  asd\")\nassert(test.trimEnd().length === 5)\nassert(test.trimRight() === \"  asd\")\nassert(test.trimRight().length === 5)\nassert(String.prototype.trimEnd === String.prototype.trimRight)\n\nassert(test.trim() === \"asd\")\nassert(test.trim().length === 3)\n"
  },
  {
    "path": "tests/jerry/string-prototype.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (String.prototype.length === 0);\n"
  },
  {
    "path": "tests/jerry/string-raw-crash-escaping-backslash.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This test must be left unchanged - testing JerryScript crash */\n\ntry\n{\n  var s = 'print(String.raw`\\\\`)\\n// `';\n  eval (s)\n  asserts(false)\n}\ncatch (error)\n{\n}\n"
  },
  {
    "path": "tests/jerry/string-raw.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction assertThrows(str, error) {\n  try {\n    eval(str);\n    assert(false);\n  } catch (e) {\n    if (typeof error === \"function\") {\n      assert(e instanceof error);\n    } else {\n      assert(e === error)\n    }\n  }\n}\n\n// https://www.ecma-international.org/ecma-262/6.0/#sec-string.raw 21.1.2.4\n// Note: the string error messages represents the nth step of the routine\nvar abruptTests = [\n  [\"undefined\", TypeError], // 3.\n  [\"{ get raw() { throw '5'; } }\", '5'],\n  [\"{ raw : undefined }\", TypeError], // 5.toObject\n  [\"{ raw : { get length() { throw '7.1'; } } }\", '7.1'],\n  [\"{ raw : { length : { toString() { throw '7.2'; } } } }\", '7.2'],\n  [\"{ raw : { length: 2, get '0'() { throw '12.b.1'} } }\", '12.b.1'],\n  [\"{ raw : { length: 2, '0' : { toString() { throw '12.b.2';} } } }\", '12.b.2'],\n  [\"{ raw : { length: 2, '0' : 1 } }, { toString() { throw '12.h';} }\", '12.h'],\n];\n\nabruptTests.forEach(e => {\n  assertThrows(\"String.raw(\" + e[0] + \")\", e[1]);\n});\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw\nassert(String.raw`Hi\\n${2+3}!` === 'Hi\\\\n5!');\nassert(String.raw`Hi\\u000A!` === 'Hi\\\\u000A!');\n\nlet name = 'Bob';\nassert(String.raw`Hi\\n${name}!` === \"Hi\\\\nBob!\");\n\nlet str = String.raw({\n  raw: ['foo', 'bar', 'baz']\n}, 2 + 3, 'Java' + 'Script');\nassert(str === \"foo5barJavaScriptbaz\");\n\nassert(String.raw({ raw: 'test' }, 0, 1, 2) === \"t0e1s2t\");\n\nvar get = [];\nvar raw = new Proxy({length: 2, 0: '', 1: ''}, { get: function(o, k) { get.push(k); return o[k]; }});\nvar p = new Proxy({raw: raw}, { get: function(o, k) { get.push(k); return o[k]; }});\nString.raw(p);\nassert(get + '' === \"raw,length,0,1\");\n\nassert(String.raw`\\\\` == \"\\\\\\\\\")\nassert(String.raw`\\`` == \"\\\\`\")\nassert(String.raw`\\\n\\\n` == \"\\\\\\n\\\\\\n\")\nassert(String.raw`\\ ` == \"\\\\\\u2029\")\n"
  },
  {
    "path": "tests/jerry/string-surrogates-concat.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar str0 = \"𐐀\";\nvar str1 = \"\\ud801\\udc00\";\nvar str2 = \"\\ud801\";\nvar str3 = \"\\udc00\";\n\nvar str_concat = str2 + str3;\n\nassert(str0 == str_concat);\nassert(str1 == str_concat);\n"
  },
  {
    "path": "tests/jerry/string-upper-lower-case-conversion.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// LATIN SMALL LIGATURES\n// LATIN SMALL LIGATURE FF\nassert (\"\\ufb00\".toLowerCase() == \"\\ufb00\");\nassert (\"\\ufb00\".toUpperCase() == \"\\u0046\\u0046\");\n// LATIN SMALL LIGATURE FI\nassert (\"\\ufb01\".toLowerCase() == \"\\ufb01\");\nassert (\"\\ufb01\".toUpperCase() == \"\\u0046\\u0049\");\n// LATIN SMALL LIGATURE FL\nassert (\"\\ufb02\".toLowerCase() == \"\\ufb02\");\nassert (\"\\ufb02\".toUpperCase() == \"\\u0046\\u004c\");\n// LATIN SMALL LIGATURE FFI\nassert (\"\\ufb03\".toLowerCase() == \"\\ufb03\");\nassert (\"\\ufb03\".toUpperCase() == \"\\u0046\\u0046\\u0049\");\n// LATIN SMALL LIGATURE FFL\nassert (\"\\ufb04\".toLowerCase() == \"\\ufb04\");\nassert (\"\\ufb04\".toUpperCase() == \"\\u0046\\u0046\\u004c\");\n// LATIN SMALL LIGATURE LONG S T\nassert (\"\\ufb05\".toLowerCase() == \"\\ufb05\");\nassert (\"\\ufb05\".toUpperCase() == \"\\u0053\\u0054\");\n// LATIN SMALL LIGATURE ST\nassert (\"\\ufb06\".toLowerCase() == \"\\ufb06\");\nassert (\"\\ufb06\".toUpperCase() == \"\\u0053\\u0054\");\n\n// LATIN CAPITAL LETTER I WITH DOT ABOVE\nassert (\"\\u0130\".toLowerCase() == \"\\u0069\\u0307\");\nassert (\"\\u0130\".toUpperCase() == \"\\u0130\");\n\n// LATIN SMALL LETTER SHARP S\nassert (\"\\u00df\".toLowerCase() == \"\\u00df\");\nassert (\"\\u00df\".toUpperCase() == \"\\u0053\\u0053\");\n\n// LATIN CAPITAL LETTER I WITH BREVE\nassert (\"\\u012c\".toLowerCase() == \"\\u012d\");\nassert (\"\\u012c\".toUpperCase() == \"\\u012c\");\n// LATIN SMALL LETTER I WITH BREVE\nassert (\"\\u012d\".toLowerCase() == \"\\u012d\")\nassert (\"\\u012d\".toUpperCase() == \"\\u012c\");\n\n// Check randomly selected characters from conversion tables\n\n// lower-case conversions\nassert (\"\\u01c5\\u01c8\\u01cb\\u212b\".toLowerCase() == \"\\u01c6\\u01c9\\u01cc\\u00e5\");\nassert (\"\\u0130\".toLowerCase() == \"\\u0069\\u0307\");\n\n// upper-case conversions\nassert (\"\\u00b5\\u017f\".toUpperCase() == \"\\u039c\\u0053\");\nassert (\"\\ufb17\\u00df\\u1fbc\".toUpperCase() == \"\\u0544\\u053D\\u0053\\u0053\\u0391\\u0399\");\nassert (\"\\ufb03\\ufb04\".toUpperCase() == \"\\u0046\\u0046\\u0049\\u0046\\u0046\\u004c\");\n\n// character case ranges\nassert (\"\\u0100\\u0101\\u0139\\u03fa\\ua7b4\".toLowerCase() == \"\\u0101\\u0101\\u013a\\u03fb\\ua7b5\");\nassert (\"\\u0101\\u0100\\u013a\\u03fb\\ua7b5\".toUpperCase() == \"\\u0100\\u0100\\u0139\\u03fa\\ua7b4\");\n\n// character pairs\nassert (\"\\u0178\\ua7b1\\u0287\\ua7b3\".toLowerCase() == \"\\u00ff\\u0287\\u0287\\uab53\");\nassert (\"\\u00ff\\u0287\\ua7b1\\uab53\".toUpperCase() == \"\\u0178\\ua7b1\\ua7b1\\ua7b3\");\n\n// character case ranges\nassert (\"\\u00e0\\u00c0\\u00c1\\u00c2\\uff21\".toLowerCase() == \"\\u00e0\\u00e0\\u00e1\\u00e2\\uff41\");\nassert (\"\\u00e0\\u00c0\\u00e1\\u00e2\\uff41\".toUpperCase() == \"\\u00c0\\u00c0\\u00c1\\u00c2\\uff21\");\n\n// lower-case ranges\nassert (\"\\u1f88\\u1f98\\u1fa8\\u1f8b\\u1faf\".toLowerCase() == \"\\u1f80\\u1f90\\u1fa0\\u1f83\\u1fa7\");\n\n// upper-case special ranges\nassert (\"\\u1f80\\u1f81\\u1fa7\".toUpperCase() == \"\\u1f08\\u0399\\u1f09\\u0399\\u1f6f\\u0399\");\n\nassert (\"0123456789abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXYZ\".toLowerCase()\n        == \"0123456789abcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxyz\");\nassert (\"0123456789abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXYZ\".toUpperCase()\n        == \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXZYABCDEFGHIJKLMNOPQRSTUVWXYZ\");\n\n// Conversion of non-string objects.\n\nassert (String.prototype.toUpperCase.call(true) == \"TRUE\");\nassert (String.prototype.toLowerCase.call(-23) == \"-23\");\n\nvar object = { toString : function() { return \"<sTr>\"; } };\nassert (String.prototype.toUpperCase.call(object) == \"<STR>\");\nassert (String.prototype.toLowerCase.call(object) == \"<str>\");\n\ntry\n{\n  String.prototype.toUpperCase.call(null);\n  assert(false);\n}\ncatch (e)\n{\n  assert (e instanceof TypeError);\n}\n\nlet start = 0x10000\nlet end = 0x10FFFF\n\nconst lower_expected = [66560, 66561, 66562, 66563, 66564, 66565, 66566, 66567, 66568, 66569, 66570, 66571, 66572,\n                        66573, 66574, 66575, 66576, 66577, 66578, 66579, 66580, 66581, 66582, 66583, 66584, 66585,\n                        66586, 66587, 66588, 66589, 66590, 66591, 66592, 66593, 66594, 66595, 66596, 66597, 66598,\n                        66599, 66736, 66737, 66738, 66739, 66740, 66741, 66742, 66743, 66744, 66745, 66746, 66747,\n                        66748, 66749, 66750, 66751, 66752, 66753, 66754, 66755, 66756, 66757, 66758, 66759, 66760,\n                        66761, 66762, 66763, 66764, 66765, 66766, 66767, 66768, 66769, 66770, 66771, 68736, 68737,\n                        68738, 68739, 68740, 68741, 68742, 68743, 68744, 68745, 68746, 68747, 68748, 68749, 68750,\n                        68751, 68752, 68753, 68754, 68755, 68756, 68757, 68758, 68759, 68760, 68761, 68762, 68763,\n                        68764, 68765, 68766, 68767, 68768, 68769, 68770, 68771, 68772, 68773, 68774, 68775, 68776,\n                        68777, 68778, 68779, 68780, 68781, 68782, 68783, 68784, 68785, 68786, 71840, 71841, 71842,\n                        71843, 71844, 71845, 71846, 71847, 71848, 71849, 71850, 71851, 71852, 71853, 71854, 71855,\n                        71856, 71857, 71858, 71859, 71860, 71861, 71862, 71863, 71864, 71865, 71866, 71867, 71868,\n                        71869, 71870, 71871, 93760, 93761, 93762, 93763, 93764, 93765, 93766, 93767, 93768, 93769,\n                        93770, 93771, 93772, 93773, 93774, 93775, 93776, 93777, 93778, 93779, 93780, 93781, 93782,\n                        93783, 93784, 93785, 93786, 93787, 93788, 93789, 93790, 93791, 125184, 125185, 125186, 125187,\n                        125188, 125189, 125190, 125191, 125192, 125193, 125194, 125195, 125196, 125197, 125198, 125199,\n                        125200, 125201, 125202, 125203, 125204, 125205, 125206, 125207, 125208, 125209, 125210, 125211,\n                        125212, 125213, 125214, 125215, 125216, 125217];\n\nconst upper_expected = [66600, 66601, 66602, 66603, 66604, 66605, 66606, 66607, 66608, 66609, 66610, 66611, 66612,\n                        66613, 66614, 66615, 66616, 66617, 66618, 66619, 66620, 66621, 66622, 66623, 66624, 66625,\n                        66626, 66627, 66628, 66629, 66630, 66631, 66632, 66633, 66634, 66635, 66636, 66637, 66638,\n                        66639, 66776, 66777, 66778, 66779, 66780, 66781, 66782, 66783, 66784, 66785, 66786, 66787,\n                        66788, 66789, 66790, 66791, 66792, 66793, 66794, 66795, 66796, 66797, 66798, 66799, 66800,\n                        66801, 66802, 66803, 66804, 66805, 66806, 66807, 66808, 66809, 66810, 66811, 68800, 68801,\n                        68802, 68803, 68804, 68805, 68806, 68807, 68808, 68809, 68810, 68811, 68812, 68813, 68814,\n                        68815, 68816, 68817, 68818, 68819, 68820, 68821, 68822, 68823, 68824, 68825, 68826, 68827,\n                        68828, 68829, 68830, 68831, 68832, 68833, 68834, 68835, 68836, 68837, 68838, 68839, 68840,\n                        68841, 68842, 68843, 68844, 68845, 68846, 68847, 68848, 68849, 68850, 71872, 71873, 71874,\n                        71875, 71876, 71877, 71878, 71879, 71880, 71881, 71882, 71883, 71884, 71885, 71886, 71887,\n                        71888, 71889, 71890, 71891, 71892, 71893, 71894, 71895, 71896, 71897, 71898, 71899, 71900,\n                        71901, 71902, 71903, 93792, 93793, 93794, 93795, 93796, 93797, 93798, 93799, 93800, 93801,\n                        93802, 93803, 93804, 93805, 93806, 93807, 93808, 93809, 93810, 93811, 93812, 93813, 93814,\n                        93815, 93816, 93817, 93818, 93819, 93820, 93821, 93822, 93823, 125218, 125219, 125220, 125221,\n                        125222, 125223, 125224, 125225, 125226, 125227, 125228, 125229, 125230, 125231, 125232, 125233,\n                        125234, 125235, 125236, 125237, 125238, 125239, 125240, 125241, 125242, 125243, 125244, 125245,\n                        125246, 125247, 125248, 125249, 125250, 125251];\n\nfor (let iter of lower_expected) {\n  let cp = String.fromCodePoint(iter);\n  assert(cp !== cp.toLowerCase());\n}\n\nfor (let iter of upper_expected) {\n  let cp = String.fromCodePoint(iter);\n  assert(cp !== cp.toUpperCase());\n}\n\nassert(\"\\ud801A\".toLowerCase() === \"\\ud801a\");\n"
  },
  {
    "path": "tests/jerry/string.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = 'abcd';\nvar b = 'dfgh';\n\nc = a + b;\n\nassert(c == a + b);\nassert(c === a + b);\nassert(c != a);\nassert(c != b);\nassert(c !== a);\nassert(c !== b);\nassert(c != b + a);\nassert(c !== b + a);\n"
  },
  {
    "path": "tests/jerry/super-assignment.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar setterCalled = false;\n\nclass Base {\n  func () {\n    return 5;\n  }\n  funcArrow () {\n    return () => 5;\n  }\n  [\"com\" + \"puted\"] () {\n    return 10;\n  }\n  get getter () {\n    return 6;\n  }\n  set setter (a) {\n    setterCalled = true;\n  }\n  getSuperValueOf() {\n    return super.valueOf;\n  }\n}\n\nclass Derived extends Base {\n  func () {\n    return super.func();\n  }\n  funcArrow () {\n    return () => super.func();\n  }\n  [\"com\" + \"puted\"] () {\n    return super[\"com\" + \"puted\"]();\n  }\n  get getter () {\n    return super.getter;\n  }\n  set setter (a) {\n    super.setter = a;\n  }\n  deleteSuperReference () {\n    delete super.a;\n  }\n}\n\nvar derived = new Derived;\nvar base = new Base;\n\nassert (derived.func() === 5);\nassert (derived.funcArrow()() === 5);\nassert (derived.computed() === 10);\nassert (derived.getter === 6);\nderived.setter = 7;\nassert (setterCalled === true);\nassert (base.getSuperValueOf() === Object.prototype.valueOf);\n\ntry {\n  derived.deleteSuperReference();\n  assert (false);\n} catch (e) {\n  assert (e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/switch-case.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = 1;\n\nswitch (a) {\n  case 1:\n  case 2:\n    break;\n  case 3:\n    assert (0);\n}\n\nswitch (a) {\n  case 1:\n    break;\n  case 2:\n  case 3:\n    assert (0);\n}\n\nswitch (a) {\n  default:\n    assert (0);\n  case 1:\n    break;\n  case 2:\n  case 3:\n    assert (0);\n}\n\nswitch (a) {\n  default:\n    break;\n  case 2:\n  case 3:\n    assert (0);\n}\n\nswitch (a) {\n  case 3:\n    assert (0);\n  default:\n    assert (0);\n  case 1:\n}\n\nexecuted_case = '';\nswitch (a) {\n  default:\n    executed_case = 'default';\n    break;\n  case 2:\n    executed_case = 'case 2';\n    break;\n}\nassert (executed_case === 'default');\n\nvar counter = 0;\n\nswitch (\"var\") {\n  case \"var\":\n    counter++;\n  case \"var1\":\n    counter++;\n  case \"var2\":\n    counter++;\n  default:\n    counter++;\n}\n\nassert (counter === 4);\n\nvar flow = '';\n\nswitch (\"var\") {\n  case \"var\":\n    flow += '1';\n  case \"var1\":\n    flow += '2';\n  case \"var2\":\n    flow += '3';\n    switch (flow) {\n      case '123':\n       flow += 'a';\n       break;\n      default:\n       flow += 'b';\n    }\n  default:\n    flow += '4';\n}\n\nassert (flow === '123a4');\n\nswitch (0) { case 0: for (;false;); case 1: }\nswitch (0) { case 0: while (false); case 1: }\n"
  },
  {
    "path": "tests/jerry/symbol-computed-object-literal.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar symbolFoo = Symbol ('foo');\nvar symbolBar = Symbol ('bar');\n\nvar obj = {\n  _a : 5,\n  get [symbolFoo]() {\n    return this._a;\n  },\n  set [symbolFoo](a) {\n    this._a = a;\n  },\n  [symbolBar] : 10\n}\n\n/* Test accessor properties */\nassert (obj[symbolFoo] === 5);\nobj[symbolFoo] = 6;\nassert (obj[symbolFoo] === 6);\n\n/* Test nameddata properties */\nassert (obj[symbolBar] === 10);\nobj[symbolBar] = 20;\nassert (obj[symbolBar] === 20);\n"
  },
  {
    "path": "tests/jerry/symbol-exception.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntry {\n  undefined[Symbol (\"foo\")];\n  assert (false);\n} catch (e) {\n  /* Error message: Cannot read property 'Symbol(foo)' of undefined */\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/symbol-in.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar test_symbol = Symbol ('Test');\n\nvar obj = {};\n\nassert ((test_symbol in obj) === false);\n\nobj[test_symbol] = 'value';\n\nassert ((test_symbol in obj) === true);\nassert (obj[test_symbol] === 'value');\n\n\nvar array = [];\n\nassert ((test_symbol in array) === false);\n\narray[test_symbol] = 'value';\n\nassert ((test_symbol in array) === true);\nassert (array[test_symbol] === 'value');\n\n\nassert ((test_symbol in Symbol) === false);\n\ntry {\n  test_symbol in test_symbol;\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof TypeError);\n}\n\ntry {\n  test_symbol in 3;\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof TypeError);\n}\n\ntry {\n  test_symbol in 'Test';\n  assert (false);\n} catch (ex) {\n  assert (ex instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/symbol-isconcatspreadable.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Test with regular arrays\nvar alpha = ['a', 'b', 'c'];\nvar numeric = [1, 2, 3];\n\nvar alphaNumeric = alpha.concat(numeric);\nassert(JSON.stringify(alphaNumeric) === '[\"a\",\"b\",\"c\",1,2,3]');\nassert(alphaNumeric.length === 6);\n\nnumeric[Symbol.isConcatSpreadable] = false;\nalphaNumeric = alpha.concat(numeric);\nassert(JSON.stringify(alphaNumeric) === '[\"a\",\"b\",\"c\",[1,2,3]]');\nassert(alphaNumeric.length === 4);\n\nnumeric[Symbol.isConcatSpreadable] = true;\n\n// Test with array-like object\nvar fakeArray = {\n  [Symbol.isConcatSpreadable]: true,\n  length: 2,\n  0: 4,\n  1: 5\n}\n\nvar numericArray = numeric.concat(fakeArray);\nassert(JSON.stringify(numericArray) === '[1,2,3,4,5]');\nassert(numericArray.length === 5);\n\nfakeArray[Symbol.isConcatSpreadable] = false;\nnumericArray = numeric.concat(fakeArray);\nassert(JSON.stringify(numericArray) === '[1,2,3,{\"0\":4,\"1\":5,\"length\":2}]');\nassert(numericArray.length === 4);\n\n// Test with object\nvar obj = { 0: 'd' };\n\nvar alphaObj = alpha.concat(obj);\nassert(JSON.stringify(alphaObj) === '[\"a\",\"b\",\"c\",{\"0\":\"d\"}]');\nassert(alphaObj.length === 4);\n\nobj[Symbol.isConcatSpreadable] = true;\nalphaObj = alpha.concat(obj);\nassert(JSON.stringify(alphaObj) === '[\"a\",\"b\",\"c\"]');\nassert(alphaObj.length === 3);\n\n// Test with boolean\nvar bool = true;\nvar numericBool = numeric.concat(bool);\nassert(JSON.stringify(numericBool) === '[1,2,3,true]');\nassert(numericBool.length === 4);\n\nbool[Symbol.isConcatSpreadable] = false;\nnumericBool = numeric.concat(bool);\nassert(JSON.stringify(numericBool) === '[1,2,3,true]');\nassert(numericBool.length === 4);\n\n// Test when unable to concat\nvar array1 = [];\nvar array2 = [];\nObject.defineProperty(array2, '0', { 'get' : function () {throw new ReferenceError (\"foo\"); } });\n\ntry {\n  array1.concat(array2);\n  assert(false);\n} catch (e) {\n  assert(e.message === \"foo\");\n  assert(e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/symbol-key-keyfor.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntry {\n  Symbol.for (Symbol('foo'));\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError)\n}\n\nvar a = Symbol.for ('foo');\nvar b = Symbol.for ('foo');\n\nassert (a === b);\nassert (a == b);\n\nassert (Symbol.keyFor (a) === 'foo');\nassert (Symbol.keyFor (b) === 'foo');\n\n// Test non-string arguments\nvar c = Symbol.for (5);\nvar d = Symbol.for (5.58);\nvar e = Symbol.for ({});\n\nassert (Symbol.keyFor (c) === '5');\nassert (Symbol.keyFor (d) === '5.58');\nassert (Symbol.keyFor (e) === '[object Object]');\n\n// Test global symbol table\nvar array = [];\nfor (var i = 0; i < 15; i++) {\n  array[i] = Symbol.for ('foo' + i);\n\n  for (var j = 0; j < i; j++) {\n    assert (array[j] !== array[i]);\n  }\n}\n\ntry {\n  Symbol.keyFor ('NonSymbolValue');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nfor (var i = 0; i < 15; i++) {\n  assert (Symbol.keyFor (array[i]) === ('foo' + i));\n}\n"
  },
  {
    "path": "tests/jerry/symbol-prototype-description.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nassert(Symbol('desc').description === \"desc\");\nassert(Symbol.iterator.description === \"Symbol.iterator\");\nassert(Symbol.for('foo').description === \"foo\");\nassert(`${Symbol('foo').description}bar` === \"foobar\");\n\nvar desc = Object.getOwnPropertyDescriptor(Symbol.prototype, 'description');\n\nassert(desc.set === undefined);\nassert(typeof desc.get === \"function\");\nassert(desc.writable === undefined);\nassert(desc.enumerable === false);\nassert(desc.configurable === true);\n\nvar sym = Symbol('foo')\nassert(desc.get.call(Object(sym)) === \"foo\")\n\nvar obj_sym = Object(Symbol('foo'));\nassert(obj_sym.description === \"foo\");\n\ntry {\n  desc.get.call(null);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  desc.get.call(123);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  desc.get.call('test');\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  desc.get.call(undefined);\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  desc.get.call({});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\ntry {\n  desc.get.call(new Proxy({}, {}));\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\nassert(Symbol(\"\").description !== undefined);\nassert(Symbol().description === undefined);\n"
  },
  {
    "path": "tests/jerry/symbol-prototype-symbol-toprimitive.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntry {\n  Symbol.prototype[Symbol.toPrimitive].call ('NonSymbolValue');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Symbol.prototype[Symbol.toPrimitive].call ({});\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar foo = Symbol ('foo');\nassert (foo[Symbol.toPrimitive] () === foo);\n\nvar fooObj = Object (foo);\nassert (fooObj[Symbol.toPrimitive] () === foo);\n"
  },
  {
    "path": "tests/jerry/symbol-prototype-tostring.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntry {\n  Symbol.prototype.toString.call ('NonSymbolValue');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Symbol.prototype.toString.call ({});\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar foo = Symbol ('foo');\nassert (foo.toString () === \"Symbol(foo)\");\nassert (String (foo) === \"Symbol(foo)\");\n\nvar fooObj = Object (foo);\nassert (fooObj.toString () === \"Symbol(foo)\");\n\ntry {\n  String (fooObj);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n"
  },
  {
    "path": "tests/jerry/symbol-prototype-valueof.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntry {\n  Symbol.prototype.valueOf.call ('NonSymbolValue');\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  Symbol.prototype.valueOf.call ({});\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nvar foo = Symbol ('foo');\nassert (foo.valueOf () === foo);\n\nvar fooObj = Object (foo);\nassert (fooObj.valueOf () === foo);\n"
  },
  {
    "path": "tests/jerry/symbol-prototype.toprimitive.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar obj2 = {\n    [Symbol.toPrimitive](hint) {\n      if (hint == 'number') {\n        return 10;\n      }\n      if (hint == 'string') {\n        return 'hello';\n      }\n      return true;\n    }\n  };\n\n  assert(+obj2 === 10);\n  assert(`${obj2}` === \"hello\");\n  assert(obj2 + '' === \"true\");\n"
  },
  {
    "path": "tests/jerry/symbol-replace.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar replace = RegExp.prototype[Symbol.replace];\n\ntry {\n  replace.call (0, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  replace.call (new RegExp(), {\n    toString: () => {\n      throw \"abrupt string\"\n    }\n  }, \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt string\");\n}\n\ntry {\n  replace.call (new RegExp(), \"string\", {\n    toString: () => {\n      throw \"abrupt replace\"\n    }\n  });\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt replace\");\n}\n\ntry {\n  replace.call ({\n    get global() {\n      throw \"abrupt global\"\n    }\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt global\");\n}\n\ntry {\n  replace.call ({\n    global: true,\n    set lastIndex(idx) {\n      throw \"abrupt lastIndex\"\n    }\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt lastIndex\");\n}\n\ntry {\n  replace.call ({\n    get exec() {\n      throw \"abrupt exec\"\n    }\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt exec\");\n}\n\ntry {\n  replace.call ({\n    exec: RegExp.prototype.exec\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  replace.call ({\n    exec: 42\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  replace.call ({\n    exec: () => {\n      throw \"abrupt exec result\"\n    }\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt exec result\");\n}\n\ntry {\n  replace.call ({\n    exec: () => {\n      return 1\n    }\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  replace.call ({\n    exec: () => {\n      return {\n        get length() {\n          throw \"abrupt result length\"\n        }\n      }\n    }\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt result length\");\n}\n\ntry {\n  replace.call ({\n      global: true,\n      exec: () => {\n        return {\n          length: 1,\n          get 0() {\n            throw \"abrupt match\"\n          }\n        }\n      }\n    },\n    \"string\",\n    \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt match\");\n}\n\ntry {\n  replace.call ({\n      global: true,\n      exec: () => {\n        return {\n          length: 1,\n          get 0() {\n            return {\n              toString: () => {\n                throw \"abrupt match toString\"\n              }\n            }\n          }\n        }\n      }\n    },\n    \"string\",\n    \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt match toString\");\n}\n\nvar result_obj = {\n  toString: () => {\n    Object.defineProperty (result_obj, 'toString', {\n      value: () => {\n        throw \"abrupt match toString delayed\";\n      }\n    });\n    return \"str\";\n  }\n}\n\nvar first = true;\ntry {\n  replace.call ({\n      global: true,\n      exec: () => {\n        if (!first) {\n          return null;\n        }\n\n        first = false;\n        return {\n          length: 1,\n          get 0() {\n            return result_obj;\n          }\n        }\n      }\n    },\n    \"string\",\n    \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt match toString delayed\");\n}\n\ntry {\n  replace.call ({\n      global: true,\n      get lastIndex() {\n        throw \"abrupt lastIndex get\"\n      },\n      set lastIndex(i) {},\n      exec: () => {\n        return {\n          length: 1,\n          get 0() {\n            return {\n              toString: () => {\n                return \"\"\n              }\n            }\n          }\n        }\n      }\n    },\n    \"string\",\n    \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt lastIndex get\");\n}\n\ntry {\n  replace.call ({\n      global: true,\n      get lastIndex() {\n        return {\n          valueOf: () => {\n            throw \"abrupt lastIndex toNumber\"\n          }\n        }\n      },\n      set lastIndex(i) {},\n      exec: () => {\n        return {\n          length: 1,\n          get 0() {\n            return {\n              toString: () => {\n                return \"\"\n              }\n            }\n          }\n        }\n      }\n    },\n    \"string\",\n    \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt lastIndex toNumber\");\n}\n\nvar o = {\n  global: true,\n  exec: () => {\n    return {\n      length: 1,\n      get 0() {\n        return {\n          toString: () => {\n            return \"\"\n          }\n        }\n      }\n    }\n  }\n}\nObject.defineProperty (o, 'lastIndex', {\n  configurable: true,\n  get: () => {\n    Object.defineProperty (o, 'lastIndex', {\n      get: () => {\n        return {\n          valueOf: () => {\n            return 42\n          }\n        };\n      },\n      set: (i) => {\n        throw \"abrupt lastIndex put\";\n      },\n      configurable: true\n    });\n    return {\n      valueOf: () => {\n        return 24\n      }\n    };\n  },\n  set: (i) => {}\n});\n\ntry {\n  replace.call (o,\n    \"string\",\n    \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt lastIndex put\");\n}\n\no = {\n  global: true,\n  exec: () => {\n    return {\n      length: 1,\n      get 0() {\n        return {\n          toString: () => {\n            return \"\"\n          }\n        }\n      }\n    }\n  },\n};\nObject.defineProperty (o, 'lastIndex', {\n  get: () => {\n    Object.defineProperty (o, 'lastIndex', {\n      value: 0,\n      writable: false\n    });\n    return 0;\n  },\n  set: () => {}\n});\n\ntry {\n  replace.call (o,\n    \"string\",\n    \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\no = {\n  global: true\n};\nObject.defineProperty (o, 'exec', {\n  configurable: true,\n  value: () => {\n    Object.defineProperty (o, 'exec', {\n      get: () => {\n        throw \"abrupt exec\"\n      },\n      set: (v) => {}\n    });\n    return {\n      length: 1,\n      0: \"thisisastring\"\n    }\n  }\n});\n\ntry {\n  replace.call (o,\n    \"string\",\n    \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt exec\");\n}\n\ntry {\n  replace.call ({\n    exec: () => {\n      return {\n        length: 1,\n        0: \"str\",\n        get index() {\n          throw \"abrupt index\"\n        }\n      }\n    }\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt index\");\n}\n\ntry {\n  replace.call ({\n    exec: () => {\n      return {\n        length: 1,\n        0: \"str\",\n        get index() {\n          return {\n            valueOf: () => {\n              throw \"abrupt index toNumber\"\n            }\n          }\n        }\n      }\n    }\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt index toNumber\");\n}\n\ntry {\n  replace.call ({\n    exec: () => {\n      return {\n        length: 2,\n        0: \"str\",\n        index: 0,\n        get 1() {\n          throw \"abrupt capture\"\n        }\n      }\n    }\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt capture\");\n}\n\ntry {\n  replace.call ({\n    exec: () => {\n      return {\n        length: 2,\n        0: \"str\",\n        index: 0,\n        1: {\n          toString: () => {\n            throw \"abrupt capture toString\"\n          }\n        }\n      }\n    }\n  }, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt capture toString\");\n}\n\ntry {\n  replace.call ({\n    exec: () => {\n      return {\n        length: 2,\n        0: \"str\",\n        index: 0,\n        1: \"st\"\n      }\n    }\n  }, \"string\", () => {\n    throw \"abrupt replace\"\n  });\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt replace\");\n}\n\ntry {\n  replace.call ({\n    exec: () => {\n      return {\n        length: 2,\n        0: \"str\",\n        index: 0,\n        1: \"st\"\n      }\n    }\n  }, \"string\", () => {\n    return {\n      toString: () => {\n        throw \"abrupt replace toString\"\n      }\n    }\n  });\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt replace toString\");\n}\n\ntry {\n  replace.call (/abc/, \"abc\", () => {\n    throw \"fastpath abrupt replace\"\n  });\n  assert (false);\n} catch (e) {\n  assert (e === \"fastpath abrupt replace\");\n}\n\ntry {\n  replace.call (/abc/, \"abc\", () => {\n    return {\n      toString: () => {\n        throw \"fastpath abrupt replace\"\n      }\n    }\n  });\n  assert (false);\n} catch (e) {\n  assert (e === \"fastpath abrupt replace\");\n}\n\nassert (replace.call (/abc/, \"abc\", \"xyz\") === \"xyz\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"xyz\") === \"abxyzfg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$$-\") === \"ab-$-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$&-\") === \"ab-cde-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$`-\") === \"ab-ab-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$'-\") === \"ab-fg-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$0-\") === \"ab-$0-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$1-\") === \"ab-c-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$2-\") === \"ab-d-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$3-\") === \"ab-d-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$4-\") === \"ab--fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$5-\") === \"ab-e-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$6-\") === \"ab-$6-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$00-\") === \"ab-$00-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$01-\") === \"ab-c-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$10-\") === \"ab-c0-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$99-\") === \"ab-$99-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"-$$1-\") === \"ab-$1-fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"$\") === \"ab$fg\");\nassert (replace.call (/(c)((d)|(x))(e)/, \"abcdefg\", \"$@\") === \"ab$@fg\");\n\nreplace.call (/(c)((d)|(x))(e)/, \"abcdefg\", function () {\n  assert (arguments[0] === \"cde\");\n  assert (arguments[1] === \"c\");\n  assert (arguments[2] === \"d\");\n  assert (arguments[3] === \"d\");\n  assert (arguments[4] === undefined);\n  assert (arguments[5] === \"e\");\n  assert (arguments[6] === 2);\n  assert (arguments[7] === \"abcdefg\");\n});\n\nvar re = /ab/g;\nassert (replace.call (re, \"-ab-ab-ab-ab-\", \"cd\") === \"-cd-cd-cd-cd-\");\nassert (re.lastIndex === 0);\n\nre.lastIndex = 5;\nassert (replace.call (re, \"-ab-ab-ab-ab-\", \"cd\") === \"-cd-cd-cd-cd-\");\nassert (re.lastIndex === 0);\n\nassert (replace.call (/(?:)/g, \"string\", \"Duck\") === \"DucksDucktDuckrDuckiDucknDuckgDuck\");\n\nclass Regexplike {\n  constructor() {\n    this.index = 0;\n    this.global = true;\n  }\n\n  exec() {\n    if (this.index > 0) {\n      return null;\n    }\n\n    this.index = 39;\n    var result = {\n      length: 1,\n      0: \"Duck\",\n      index: this.index\n    };\n    return result;\n  }\n}\n\nre = new Regexplike();\n\n/* Well-behaved RegExp-like object. */\nassert (replace.call (re, \"What have you brought upon this cursed land\", \"$&\") === \"What have you brought upon this cursed Duck\");\n\nvar replace_count = 0;\n\nfunction replacer() {\n  replace_count++;\n  return arguments[0];\n}\n\nre.index = 0;\nre.exec = function () {\n  if (this.index > 3) {\n    return null;\n  }\n\n  var result = {\n    length: 1,\n    0: \"Duck\",\n    index: this.index++\n  };\n  return result;\n}\n\n/* Mis-behaving RegExp-like object, replace function is called on each match, but the result is ignored for inconsistent matches. */\nassert (replace.call (re, \"Badger\", replacer) === \"Ducker\");\nassert (replace_count === 4);\n\nre.index = 0;\nassert (replace.call (re, \"Badger\", \"Ord\") === \"Order\");\n\ntry {\n  replace.call (RegExp.prototype, \"string\", \"replace\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert(replace.call({ exec : ( ) => { return {  } } }, 'һ', \"a\") === \"a\");\nassert(replace.call({ exec : ( ) => { return {  } } }, 'һһһһһһһһһ', \"a\") === \"a\");\nassert(replace.call({ exec : ( ) => { return {  } } }, 'һһһһһһһһһһ', \"a\") === \"aһ\");\n\n/* Object with custom @@replace method */\nvar o = {}\no[Symbol.replace] = function () {\n  return \"Duck\"\n};\nassert (\"string\".replace (o, \"Mallard\") === \"Duck\");\n\no[Symbol.replace] = 42;\ntry {\n  \"string\".replace (o, \"Duck\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nObject.defineProperty (o, Symbol.replace, {\n  get: () => {\n    throw \"abrupt @@replace get\"\n  },\n  set: (v) => {}\n});\n\ntry {\n  \"string\".replace (o, \"Duck\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt @@replace get\");\n}\n\no = {};\no[Symbol.replace] = function () {\n  throw \"abrupt @@replace\"\n};\ntry {\n  \"string\".replace (o, \"str\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt @@replace\")\n}\n\nclass Regexplike2 {\n    exec() {\n        return {}\n    }\n}\nre = new Regexplike2();\nassert (replace.call (re, \"1\") === \"undefined\");\n\nvar abruptStickyRegexp = /./;\nObject.defineProperty(abruptStickyRegexp, 'sticky', {\n  get: function() {\n    throw \"abrupt sticky\";\n  }\n});\n\nassert(abruptStickyRegexp[Symbol.replace]() === \"undefinedndefined\");\n\nvar r = /./;\nr.lastIndex = {\n  valueOf: function() {\n    throw \"abrupt lastIndex\"\n  }\n}\n\ntry {\n  r[Symbol.replace](\"a\", \"b\");\n  assert(false);\n} catch (e) {\n  assert(e === \"abrupt lastIndex\");\n}\n\nvar r = /a/y;\nr.lastIndex = 3;\nassert (r[Symbol.replace](\"aaaaa\", \"b\") === \"aaaba\");\nassert (r.lastIndex === 4);\n\nassert (r[Symbol.replace](\"ccccc\", \"b\") === \"ccccc\");\nassert (r.lastIndex === 0);\n\nvar r = /a/yg;\nr.lastIndex = 3;\nassert (r[Symbol.replace](\"aaaaa\", \"b\") === \"bbbbb\");\nassert (r.lastIndex === 0);\n\nvar replaceCalled = false;\nvar r = /a/\nr.lastIndex = 2;\n\nassert(r[Symbol.replace](\"aaaa\", function(match, index) {\n  replaceCalled = true;\n  assert (match === \"a\");\n  assert (index === 0);\n  return \"b\";\n}) === \"baaa\");\n\nassert (replaceCalled);\nassert (r.lastIndex === 2);\n\n(function () {\n  var r = /./g;\n  var execWasCalled = false;\n  var coercibleIndex = {\n    valueOf: function() {\n      return Math.pow(2, 54);\n    },\n  };\n\n  var result = {\n    length: 1,\n    0: '',\n    index: 0,\n  };\n\n  r.exec = function() {\n    if (execWasCalled) {\n      return null;\n    }\n\n    r.lastIndex = coercibleIndex;\n    execWasCalled = true;\n    return result;\n  };\n\n  assert(r[Symbol.replace]('', '') === '');\n  assert(r.lastIndex === Math.pow(2, 53));\n})();\n"
  },
  {
    "path": "tests/jerry/symbol-search.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar search = RegExp.prototype[Symbol.search];\n\ntry {\n  search.call (0, \"string\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  search.call (new RegExp(), {\n    toString: () => {\n      throw \"abrupt string\"\n    }\n  });\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt string\");\n}\n\ntry {\n  search.call ({\n    get lastIndex() {\n      throw \"abrupt get lastIndex\"\n    }\n  }, \"string\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt get lastIndex\");\n}\n\ntry {\n  search.call ({\n    get lastIndex() {\n      return 3;\n    },\n    set lastIndex(idx) {\n      throw \"abrupt set lastIndex\"\n    }\n  }, \"string\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt set lastIndex\");\n}\n\ntry {\n  search.call ({\n    get exec() {\n      throw \"abrupt exec\"\n    }\n  }, \"string\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt exec\");\n}\n\ntry {\n  search.call ({\n    exec: RegExp.prototype.exec\n  }, \"string\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  search.call ({\n    exec: 42\n  }, \"string\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  search.call ({\n    exec: () => {\n      throw \"abrupt exec result\"\n    }\n  }, \"string\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt exec result\");\n}\n\ntry {\n  search.call ({\n    exec: () => {\n      return 1\n    }\n  }, \"string\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  search.call ({\n    exec: () => {\n      return {\n        get index() {\n          throw \"abrupt index\"\n        }\n      }\n    }\n  }, \"string\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt index\");\n}\n\nassert (search.call (/abc/, \"abc\") === 0);\nassert (search.call (/abc/, \"strabc\") === 3);\nassert (search.call (/abc/, \"bcd\") === -1);\n\nclass Regexplike {\n  constructor() {\n    this.index = 0;\n    this.global = true;\n  }\n\n  exec() {\n    if (this.index > 0) {\n      return null;\n    }\n\n    this.index = 42;\n    var result = {\n      length: 1,\n      0: \"Duck\",\n      index: this.index\n    };\n    return result;\n  }\n}\n\nre = new Regexplike();\nassert (search.call (re, \"str\") === 42);\n\n/* Object with custom @@search method */\nvar o = {}\no[Symbol.search] = function () {\n  return 4;\n};\nassert (\"string\".search (o) === 4);\n\no[Symbol.search] = 42;\ntry {\n  \"string\".search (o);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nObject.defineProperty (o, Symbol.search, {\n  get: () => {\n    throw \"abrupt @@search get\"\n  },\n  set: (v) => {}\n});\n\ntry {\n  \"string\".search (o);\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt @@search get\");\n}\n\no = {};\no[Symbol.search] = function () {\n  throw \"abrupt @@search\"\n};\ntry {\n  \"string\".search (o);\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt @@search\")\n}\n\no = {\n  exec: function () { return {index: \"Duck\"}; },\n};\nassert (\"string\".search (o) === 1);\n\no[Symbol.search] = RegExp.prototype[Symbol.search];\nassert (\"string\".search (o) === \"Duck\");\n\no = {\n  lastIndex: \"Duck\",\n  exec: () => {\n    return \"Duck\";\n  }\n}\n\ntry {\n  RegExp.prototype[Symbol.search].call (o, \"Duck\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\no = {\n  exec: () => {\n    return { 0: \"Duck\", index: 0 };\n  },\n  get lastIndex () {\n    return \"Duck\";\n  },\n  set lastIndex (v) {\n    return \"Duck\";\n  }\n}\n\nassert (RegExp.prototype[Symbol.search].call (o, \"str\") === 0);\n\nvar r = /a/;\nr.lastIndex = 3.14;\n\nvar get_calls = [];\nvar set_calls = [];\n\nvar handler = {\n  get: function(o, k) {\n    get_calls.push(k);\n\n    if (k === \"exec\") {\n      return (str) => r.exec(str);\n    }\n\n    return r[k];\n  },\n  set: function(o, k, v) {\n    set_calls.push(k);\n    r[k] = v;\n  }\n};\n\nvar p = new Proxy(r, handler);\ntry {\n  search.call(p, \"bba\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (get_calls.join(\",\") === \"lastIndex\");\nassert (set_calls.join(\",\") === \"lastIndex\");\nassert (r.lastIndex === 0);\n\nvar o = {\n  get lastIndex() {\n    Object.defineProperty(o, \"lastIndex\", {\n      get: function () { throw \"abrupt get second lastIndex\"; }\n    });\n    return 1;\n  },\n  set lastIndex(v) {},\n  exec: () => { return null; }\n}\n\ntry {\n  search.call(o, \"str\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt get second lastIndex\");\n}\n\nvar index = 1;\nvar o = {\n  get lastIndex() {\n    return index++;\n  },\n  set lastIndex(v) {\n    Object.defineProperty(o, \"lastIndex\", {\n      set: function (v) { throw \"abrupt set second lastIndex\"; }\n    });\n  },\n  exec: () => { return null; }\n}\n\ntry {\n  search.call(o, \"str\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt set second lastIndex\");\n}\n"
  },
  {
    "path": "tests/jerry/symbol-split.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar split = RegExp.prototype[Symbol.split];\n\ntry {\n  split.call (0, \"string\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  split.call (new RegExp(), {\n    toString: () => {\n      throw \"abrupt string\"\n    }\n  });\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt string\");\n}\n\ntry {\n  var o = {};\n  o.constructor = \"ctor\";\n  split.call (o, \"str\");\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  var o = {};\n  var c = {};\n  o.constructor = c;\n  Object.defineProperty (c, Symbol.species, { get: function () { throw \"abrupt species\";} });\n\n  split.call (o, \"str\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt species\");\n}\n\ntry {\n  split.call ({\n    get flags() {\n      throw \"abrupt flags\";\n    }\n  }, \"string\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt flags\");\n}\n\ntry {\n  split.call ({ toString: function () { return \"s\"; }, flags: \"g\"},\n              \"string\",\n              { valueOf: function () { throw \"abrupt limit\"; } });\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt limit\");\n}\n\nvar exec = RegExp.prototype.exec;\n\ntry {\n  Object.defineProperty(RegExp.prototype, \"exec\", { get : function() { throw \"abrupt get exec\"; }})\n  split.call ({ toString: function () { return \"s\"; }, flags: \"g\"},\n              \"string\")\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt get exec\");\n}\n\ntry {\n  Object.defineProperty(RegExp.prototype, \"exec\", { value: function (str) {\n    this.lastIndex++;\n    return { get length() { throw \"abrupt match length\"; }}\n  }});\n  split.call ({ toString: function () { return \"s\"; }, flags: \"g\"},\n              \"string\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt match length\");\n}\n\ntry {\n  Object.defineProperty(RegExp.prototype, \"exec\", { value: function (str) {\n    this.lastIndex++;\n    return { length: 2, get 1() { throw \"abrupt capture\"; }}\n  }});\n  split.call ({ toString: function () { return \"s\"; }, flags: \"g\"},\n              \"string\");\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt capture\");\n}\n\nObject.defineProperty(RegExp.prototype, \"exec\", { value: function (str) {\n  this.lastIndex = 10;\n  return { };\n}});\n\nvar result = split.call ({flags: \"g\"}, \"string\");\n\nassert(result.length === 2)\nassert(result[0] === \"\")\nassert(result[1] === \"\")\n"
  },
  {
    "path": "tests/jerry/symbol-unscopables.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar obj = {\n    prop1: 42,\n    prop2: 13,\n    prop3: \"foo\",\n    prop4: 1\n};\n\nvar obj2 = {\n    foo: \"foo\"\n};\n\nobj[Symbol.unscopables] = {\n    prop1: false,\n    prop2: true,\n    prop3: undefined,\n    prop4: obj2\n};\n\nwith (obj)\n{\n    assert(prop1 === 42);\n\n    try {\n      prop2;\n      assert(false);\n    } catch (e) {\n      assert(e instanceof ReferenceError);\n    }\n\n    assert (prop3 === \"foo\");\n\n    try {\n      prop4;\n      assert(false);\n    } catch (e) {\n      assert(e instanceof ReferenceError);\n    }\n\n    try {\n      prop5;\n      assert(false);\n    } catch (e) {\n      assert(e instanceof ReferenceError);\n    }\n}\n\nvar obj2 = {};\nObject.defineProperty(obj2, Symbol.unscopables, { get: function () { throw 42; } });\n\nwith (obj2) {\n  try {\n    prop;\n    assert(false);\n  } catch (e) {\n    assert(e instanceof ReferenceError);\n  }\n}\n\nvar obj3 = { foo: 12 };\nObject.defineProperty(obj3, Symbol.unscopables, { get: function () { throw 42; } });\n\nwith (obj3) {\n  try {\n    typeof foo;\n  } catch (e) {\n    assert(e === 42);\n  }\n}\n\nvar symbol_obj = Array.prototype[Symbol.unscopables];\nassert(symbol_obj.copyWithin === true);\nassert(symbol_obj.entries === true);\nassert(symbol_obj.fill === true);\nassert(symbol_obj.find === true);\nassert(symbol_obj.findIndex === true);\nassert(symbol_obj.keys === true);\nassert(symbol_obj.values === true);\n\nassert(Object.getPrototypeOf(Array.prototype[Symbol.unscopables]) === null);\n\nvar obj3 = Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], \"find\");\nassert(obj3.value === true);\nassert(obj3.writable === true);\nassert(obj3.enumerable == true);\nassert(obj3.configurable == true);\n\nvar a = { foo: 1, bar: 2 };\na[Symbol.unscopables] = { bar: true };\nwith (a) {\n  assert(foo === 1);\n  assert(typeof bar === \"undefined\");\n}\n\nlet track = [];\nlet proxy = new Proxy({ a : 4, [Symbol.unscopables] : [] }, {\n  has (t, p) {\n    track.push(p);\n    return Reflect.has(...arguments);\n  },\n  get (t, p, r) {\n    track.push(p);\n    return Reflect.get(...arguments);\n  }\n});\n\nwith (proxy){\n  a;\n}\n\nassert(track.length == 3);\nassert(track[0] === 'a');\nassert(track[1] === Symbol.unscopables);\nassert(track[2] === 'a');\n"
  },
  {
    "path": "tests/jerry/symbol.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar a = Symbol ('foo');\nvar b = Symbol ('bar');\n\nassert (a !== b);\nassert (a === a);\nassert (typeof a === 'symbol');\nassert (a.toString() == 'Symbol(foo)');\nassert (Object.prototype.toString.call (a) === \"[object Symbol]\");\nassert (JSON.stringify (a) === undefined);\n\nvar obj = { c : 10, d : 20};\nobj[a] = 'EnumerableSymbolProp';\nassert (obj[a] === 'EnumerableSymbolProp');\n\n// Symbol properties are not listed via for in\nObject.defineProperty(obj, b, { value : 'NonEnumerableSymbolProp' });\n\nvar counter = 0;\n\nfor (var v in obj) {\n  assert (v === 'c' || v === 'd');\n  counter++;\n}\n\nassert (counter === 2);\n\nvar keys = Object.keys (obj);\nassert (keys.length === 2);\nassert (keys[0] === 'c' || keys[0] === 'd');\nassert (keys[1] === 'd' || keys[1] === 'c');\n\nvar c = Symbol ('bar');\nvar obj2 = {};\nobj2[b] = 'foo';\nobj2[c] = 'bar';\n\nassert (obj2[b] == 'foo');\nassert (obj2[c] == 'bar');\n\ntry {\n  new Date (Symbol ('2018-11-09'));\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  a + 'append_string';\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (Object (a) == a);\nassert (Object (a) !== a);\n\n// Test built-in symbols\nvar a = ['hasInstance',\n         'isConcatSpreadable',\n         'iterator',\n         'match',\n         'replace',\n         'search',\n         'species',\n         'split',\n         'toPrimitive',\n         'toStringTag',\n         'unscopables'];\n\na.forEach (function (e) {\n  assert (Symbol[e].toString() === ('Symbol(Symbol.' + e +')'));\n  assert (typeof Symbol[e] === 'symbol');\n  /* Check for property descriptor ES 6 19.4.2.2 - 19.4.2.14 */\n  var desc = Object.getOwnPropertyDescriptor(Symbol, e)\n  assert (desc.writable === false);\n  assert (desc.enumerable === false);\n  assert (desc.configurable === false);\n});\n\nvar obj = {};\nObject.defineProperty(obj, a, { 'get' : function () {throw new ReferenceError ('foo'); } });\nObject.defineProperty(obj, b, { value : 5 });\nassert (obj[b] === 5);\n\ntry {\n  obj[a];\n  assert (false);\n} catch (e) {\n  assert (e instanceof ReferenceError);\n  assert (e.message === 'foo');\n}\n\nvar descriptor = Object.getOwnPropertyDescriptor(obj, b);\n\nassert (descriptor.configurable === false);\nassert (descriptor.enumerable === false);\nassert (descriptor.writable === false);\nassert (descriptor.value === 5);\n\nvar foo = Symbol ('foo');\nassert (foo[Symbol.toStringTag] === 'Symbol');\n\n// Test same descriptions\nvar symA = Symbol ('foobar');\nvar symB = Symbol ('foobar');\nassert (symA !== symB);\nassert (symA != symB);\n\nvar obj = { foobar : 55 };\nobj[symA] = 77;\nassert (obj[\"foobar\"] !== obj[symA]);\nassert (obj[\"foobar\"] != obj[symA]);\n"
  },
  {
    "path": "tests/jerry/tagged-template-literal.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals\n// Tagged templates\nvar person = 'Mike';\nvar age = 28;\n\nfunction myTag(strings, personExp, ageExp) {\n  assert(strings[0] == \"That \");\n  assert(strings[1] == \" is a \");\n  var str0 = strings[0];\n  var str1 = strings[1];\n\n  var ageStr;\n  if (ageExp > 99){\n    ageStr = 'centenarian';\n  } else {\n    ageStr = 'youngster';\n  }\n\n  return `${str0}${personExp}${str1}${ageStr}`;\n}\n\nvar output = myTag`That ${ person } is a ${ age }`;\nassert(output === \"That Mike is a youngster\");\n\nfunction template(strings, ...keys) {\n  return (function(...values) {\n    var dict = values[values.length - 1] || {};\n    var result = [strings[0]];\n    keys.forEach(function(key, i) {\n      var value = Number.isInteger(key) ? values[key] : dict[key];\n      result.push(value, strings[i + 1]);\n    });\n    return result.join('');\n  });\n}\n\nvar t1Closure = template`${0}${1}${0}!`;\nassert(t1Closure('Y', 'A') === \"YAY!\");\nvar t2Closure = template`${0} ${'foo'}!`;\nassert(t2Closure('Hello', {foo: 'World'}) === \"Hello World!\");\n\n// Raw strings\n(function () {\n  function tag(strings) {\n    assert(strings.raw[0].length === 40);\n  }\n\n  tag`string text line 1 \\n string text line 2`;\n})();\n\nassert (String.raw`Hi\\n${2+3}!` === \"Hi\\\\n5!\");\n\n(function () {\n  function empty(strings, ...params) {\n    assert(strings.length === 4);\n    assert(strings.raw.length === 4);\n    assert(params.length === 3);\n    strings.forEach ((e) => assert (e === \"\"));\n    strings.raw.forEach ((e) => assert (e === \"\"));\n    params.forEach ((e) => assert (e === 1));\n  }\n\n  empty`${1}${1}${1}`;\n})();\n\n(function () {\n  function f (str) {\n    return str.raw[0].length;\n  }\n  assert (eval(\"f`a\\u2029b`\") === 3);\n})();\n\n(function () {\n  function testRaw(parts, a, b) {\n    assert(parts instanceof Array);\n    assert(parts.raw instanceof Array);\n    assert(parts.length === 3);\n    assert(parts[0] === \"str\");\n    assert(parts[1] === \"escaped\\n\");\n    assert(parts[2] === \"\");\n    assert(parts.raw.length === 3);\n    assert(parts.raw[0] === \"str\");\n    assert(parts.raw[1] === \"escaped\\\\n\");\n    assert(parts.raw[2] === \"\");\n    assert(a === 123);\n    assert(b === 456);\n    return true;\n  }\n\n  assert(testRaw `str${123}escaped\\n${456}` === true);\n})();\n\n// TemplateStrings call site caching\n(function () {\n  let str = (arr) => arr;\n  function getStr() {\n    return str`foo`;\n  }\n  var chainedCall = getStr();\n  var localCall = str`foo`;\n  assert(chainedCall === getStr() && chainedCall !== localCall);\n})();\n\n// TemplateStrings permanent caching\n(function () {\n  let str = (arr) => arr;\n  function getStr() {\n    return str`foo`;\n  }\n  var chainedCall = getStr();\n  var localNew = new getStr();\n  assert(chainedCall === getStr() && chainedCall === localNew);\n})();\n\nvar templateObject;\n\n(function(p) {\n  templateObject = p;\n})`str`;\n\nvar desc = Object.getOwnPropertyDescriptor(templateObject, '0');\nassert(desc.writable === false);\nassert(desc.enumerable === true);\nassert(desc.configurable === false);\n\n(function () {\n  function f (strings, ...args) {\n    return function () {\n      return Array(...args);\n    };\n  }\n\n  var a = new f`${1}${2}${3}`;\n  assert(a.length === 3);\n  assert(a[0] === 1);\n  assert(a[1] === 2);\n  assert(a[2] === 3);\n\n  function g (strings, ...args) {\n    return Array;\n  }\n\n  a = new g`${1}${2}${3}`(4, 5, 6);\n  assert(a.length === 3);\n  assert(a[0] === 4);\n  assert(a[1] === 5);\n  assert(a[2] === 6);\n\n  try {\n    new (g`${1}${2}${3}`(4, 5, 6));\n    assert(false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  function h (strings, ...args) {\n    return 5;\n  }\n\n  try {\n    new h`foo`;\n    assert(false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n})();\n"
  },
  {
    "path": "tests/jerry/template_string.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction must_throw (str)\n{\n  try\n  {\n    eval (\"switch (1) { default: \" + str + \"}\");\n    assert (false);\n  }\n  catch (e)\n  {\n  }\n\n  try\n  {\n    eval (str);\n    assert (false);\n  }\n  catch (e)\n  {\n  }\n}\n\nvar a = 'A';\nvar b = 'B';\n\nswitch (1)\n{\ndefault:\n\n  ``;\n  `abc`;\n  `ab${a+b}${ `x` }c`;\n\n  assert (`` === '');\n  assert (`abc` === 'abc');\n  assert (`ab\\\n  c` === 'ab  c');\n  assert (`ab\n  c` === 'ab\\n  c');\n\n  assert (`prefix${a}` === 'prefixA');\n  assert (`${a}postfix` === 'Apostfix');\n  assert (`prefix${a}postfix` === 'prefixApostfix');\n\n  assert (`${a}${b}` === 'AB');\n  assert (`${a},${b}` === 'A,B');\n  assert (`${a}${b}${a}${b}` === 'ABAB');\n  assert (`${a},${b},${a},${b}` === 'A,B,A,B');\n  assert (`$${a},${b},${a},${b}$` === '$A,B,A,B$');\n\n  assert (`\\${}` === '${}');\n  assert (`$\\{}` === '${}');\n  assert (`x${  `y` + `z`  }x` === 'xyzx');\n  assert (`x${  `y` , `z`  }x` === 'xzx');\n\n  function f(x) { return x + 1; }\n\n  /* Precedence. */\n  var c = 1;\n  assert (`x${  f(1) * f(2)  }x${ c = 4 }` === 'x6x4');\n  assert (c === 4);\n  assert (`m${0 || 93}n${7 && 0}o` === 'm93n0o');\n\n  /* Result is always a string. */\n  assert (`${  function() { return true } () }` === 'true');\n  assert (`${  function() { return a.length } () }` === '1');\n\n  /* Result is a single string with its properties. */\n  assert(`${a}${b}${a}${b}`.length === 4);\n}\n\nmust_throw (\"`\");\nmust_throw (\"`${\");\nmust_throw (\"`${7\");\nmust_throw (\"`${}`\");\nmust_throw (\"`${1}\");\nmust_throw (\"`${1}.${\");\nmust_throw (\"`${1}.${2}\");\n\n// line break normalization\nvar cr = eval(\"`a\" + String.fromCharCode(13) + \"b`\");\nvar lf = eval(\"`a\" + String.fromCharCode(10) + \"b`\");\nvar crlf = eval(\"`a\" + String.fromCharCode(13,10) + \"b`\");\n\nassert(cr.length === 3);\nassert(lf.length === 3);\nassert(crlf.length === 3);\nassert(cr[1] === lf[1]);\nassert(lf[1] === crlf[1]);\nassert(crlf[1] === '\\n');\n"
  },
  {
    "path": "tests/jerry/test-new-string.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar a = new String ('abcd');\nvar b = String.fromCharCode (97, 98, 99, 100);\n\nassert (a + '' === 'abcd');\nassert (b + '' === 'abcd');\nassert (a + b === 'abcdabcd');\n"
  },
  {
    "path": "tests/jerry/test_suite_06.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_06__004() {\n  var arg = 3;\n  function a() {\n    return 5 + arg;\n  }\n\n  arg = 4;\n  var b = function () {\n    return 6 + arg;\n  };\n\n  arg = 5;\n  c = function e() {\n    return 7 + arg;\n  };\n\n  assert(a() + b() + c() === 33);\n})();\n\n(function tc_06__005() {\n  var a = \"\\u0410\\u0411\";\n  var b = \"\\u0509\\u0413\";\n\n  assert(a < b);\n})();\n\n(function tc_06__003() {\n  var obj = new Object();\n\n  function c(arg)\n  {\n    var obj = new Object();\n    obj.par = arg;\n    obj.print = function () {\n      return arg;\n    };\n    return obj;\n  }\n\n  var a = c(5);\n  var b = c(6);\n  assert(a.print() + b.par === 11);\n})();\n\n(function tc_06__001() {\n  var str = \"a\\u000Ab\";\n  assert(str[1] === '\\n');\n})();\n\n(function tc_06__002() {\n  function c(arg)\n  {\n    var obj = new Object();\n    obj.print = function () {\n      f = arg;\n    };\n    return obj;\n  }\n\n  a = c(5);\n  b = c(6);\n\n  a.print.toString = 7;\n\n  assert(typeof a.print.toString !== typeof b.print.toString);\n})();\n"
  },
  {
    "path": "tests/jerry/test_suite_07.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_07_09__002() {\n  function test()\n  {\n    var a = 1, b = 2;\n\n    return\n    a + b\n  }\n\n  var v = test();\n\n  assert(v !== 3);\n\n  assert(typeof v === \"undefined\")\n})();\n\n(function tc_07_09__008() {\n  function test()\n  {\n    var a = 10, b = 5;\n    var c = a + b\n\n    return c;\n  }\n\n  assert(test() == 15);\n})();\n\n(function tc_07_09__004() {\n  var obj = new Object();\n\n  function c(arg)\n  {\n    var obj = new Object();\n    obj.par = arg;\n    obj.print = function () {\n      return arg;\n    }\n    return obj;\n  }\n\n  var a, b = 1, d = 2, e = 3;\n\n  a = b + c\n          (d + e).print()\n\n  assert(a === 6);\n})();\n\n(function tc_07_09__005() {\n  var b = 4, c = 5;\n\n  a = b\n  --c\n\n  assert(a === 4 && c === 4);\n})();\n\n(function tc_07_09__007() {\n  var mainloop = 1, cnt = 0;\n\n  for (var i = 0; i < 10; ++i)\n  {\n    for (var j = 0; j < 10; ++j)\n    {\n      if (j == 6)\n      {\n        break\n        mainloop\n      }\n\n      ++cnt;\n    }\n  }\n\n  assert(cnt == 60);\n})();\n\n(function tc_07_09__009() {\n  {\n    var a, b = 3, c = 30;\n    a = b + c}\n\n  assert (a == 33);\n})();\n\n(function tc_07_09__010() {\n  assert (glob === undefined);\n\n  var glob = 34\n\n  assert (glob === 34);\n})();\n\n(function tc_07_09__003() {\n  var b = 4, c = 5;\n\n  a = b\n  ++c\n\n  assert(a === 4 && c === 6);\n})();\n\n(function tc_07_09__001() {\n  { 1\n  2 } 3\n})();\n\n(function tc_07_09__006() {\n  var mainloop = 1, cnt = 0;\n\n  for (var i = 0; i < 10; ++i)\n  {\n    for (var j = 0; j < 10; ++j)\n    {\n      if (j == 6)\n      {\n        continue\n        mainloop\n      }\n\n      ++cnt;\n    }\n  }\n\n  assert(cnt == 90);\n})();\n\n(function tc_07_06_01__001() {\n  var package = 1;\n})();\n\n(function tc_07_08_05__001() {\n  /a[a-z]/.exec(\"abcdefghi\");\n})();\n"
  },
  {
    "path": "tests/jerry/test_suite_08.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_08_02__001() {\n  var x = null;\n})();\n\n(function tc_08_02__002() {\n  assert(typeof null == 'object');\n})();\n\n(function tc_08_05__002() {\n  assert(typeof -Infinity == 'number');\n})();\n\n(function tc_08_05__001() {\n  a = 0x3e7;\n  assert(a == 999);\n})();\n\n(function tc_08_05__003() {\n  assert(0 > -Infinity);\n})();\n\n(function tc_08_04__009() {\n  var str = \"\";\n  var strObj = new String(\"\");\n  var strObj_ = new String();\n\n  assert(str.constructor === strObj.constructor);\n})();\n\n(function tc_08_04__007() {\n  var str = 'ABC';\n  var strObj = new String('ABC');\n  assert(str == strObj);\n})();\n\n(function tc_08_04__005() {\n  var s = 'hello';\n  assert(s[5] == undefined);\n})();\n\n(function tc_08_04__001() {\n  a = '';\n  assert(typeof a == \"string\");\n})();\n\n(function tc_08_04__017() {\n  var __str__ = \"\\u0041\\u0042\\u0043\" + 'ABC'\n  assert(__str__ === 'ABCABC');\n})();\n\n(function tc_08_04__004() {\n  var s = 'hello';\n  assert(s[0] == 'h');\n})();\n\n(function tc_08_04__016() {\n  var str = \"\";\n  var strObj = new String;\n\n  assert(typeof str != typeof strObj);\n})();\n\n(function tc_08_04__015() {\n  var str = \"\";\n  var strObj = new String;\n\n  assert(str !== strObj);\n})();\n\n(function tc_08_04__014() {\n  var str = \"\";\n  var strObj = new String;\n\n  assert(str == strObj);\n})();\n\n(function tc_08_04__003() {\n  var str = \"test\";\n  assert(str.constructor === String);\n})();\n\n(function tc_08_04__002() {\n  assert((\"x\\0a\" < \"x\\0b\") && (\"x\\0b\" < \"x\\0c\"));\n})();\n\n(function tc_08_04__010() {\n  var str = \"\";\n  var strObj = new String(\"\");\n  var strObj_ = new String();\n\n  assert(str.constructor === strObj_.constructor);\n})();\n\n(function tc_08_04__008() {\n  var str = 'ABC';\n  var strObj = new String('ABC');\n\n  assert(str !== strObj);\n})();\n\n(function tc_08_04__011() {\n  var str = \"\";\n  var strObj = new String(\"\");\n  var strObj_ = new String();\n\n  assert(str == strObj);\n})();\n\n(function tc_08_04__012() {\n  var str = \"\";\n  var strObj = new String(\"\");\n  var strObj_ = new String();\n\n  assert(str !== strObj);\n})();\n\n(function tc_08_04__013() {\n  var str = \"\";\n  var strObj = new String;\n\n  assert(str.constructor === strObj.constructor);\n})();\n\n(function tc_08_04__006() {\n  var str = 'ABC';\n  var strObj = new String('ABC');\n  assert(str.constructor === strObj.constructor);\n})();\n\n(function tc_08_01__011() {\n  assert (test ());\n\n  function test (arg)\n  {\n    if (typeof (arg) === \"undefined\")\n      return true;\n    else\n      return false;\n  }\n})();\n\n(function tc_08_01__009() {\n  var x;\n  assert(test1() === void 0);\n\n  function test1(x) {\n    return x;\n  }\n})();\n\n(function tc_08_01__008() {\n  var x;\n  assert(x === void 0);\n})();\n\n(function tc_08_01__010() {\n  assert (test ());\n\n  function test (arg)\n  {\n    if (typeof (arg) === \"undefined\")\n      return true;\n    else\n      return false;\n  }\n})();\n\n(function tc_08_01__001() {\n  var a;\n  assert(typeof (a) === \"undefined\");\n})();\n\n(function tc_08_01__006() {\n  assert(typeof (void 0) === \"undefined\");\n})();\n\n(function tc_08_01__002() {\n  var o = {};\n\n  assert(typeof (o.empty) === \"undefined\");\n})();\n\n(function tc_08_01__003() {\n  var a;\n  var b = null;\n\n  assert(a == b);\n})();\n\n(function tc_08_01__005() {\n  a = foo();\n\n  assert(typeof (a) === \"undefined\");\n\n  function foo() {\n  }\n})();\n\n(function tc_08_01__007() {\n  assert(undefined === void 0);\n})();\n\n(function tc_08_01__004() {\n  var a;\n  assert(!a);\n})();\n\n(function tc_08_03__003() {\n  assert(!(false == true));\n})();\n\n(function tc_08_03__001() {\n  var a = true;\n  assert(a);\n})();\n\n(function tc_08_03__002() {\n  var a = false;\n  assert(!a);\n})();\n\n(function tc_08_03__004() {\n  assert(!(false === true));\n})();\n\n(function tc_08_12_02__001() {\n  var prot = {\n    b: 3\n  };\n\n  function Custom() {\n  }\n\n  Custom.prototype = prot;\n\n  var obj = new Custom();\n\n  assert(obj.b === 3);\n})();\n"
  },
  {
    "path": "tests/jerry/test_suite_10.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_10_03_01__001() {\n  a = 10;\n\n  function foo() {\n    var b = 20;\n\n    assert(a + b === 30);\n  }\n\n  foo();\n})();\n"
  },
  {
    "path": "tests/jerry/test_suite_11.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_11_10__001() {\n  var a = 10;\n  a = 1 & 2;\n  assert(a == 0)\n})();\n\n(function tc_11_10__006() {\n  var a;\n  a = 4 | 1;\n  assert(a == 5)\n})();\n\n(function tc_11_10__004() {\n  var a = 4;\n  var b = null;\n  a = 1 & b;\n  assert(a == 0)\n})();\n\n(function tc_11_10__016() {\n  var a = 10;\n  a = 1 & 2147483648;\n  assert(a == 0)\n})();\n\n(function tc_11_10__017() {\n  var a = 10;\n  a = 1 & 2147483647;\n  assert(a == 1)\n})();\n\n(function tc_11_10__003() {\n  var a = 4;\n  var b = \"0\";\n  a = 1 & b;\n  assert(a == 0)\n})();\n\n(function tc_11_10__008() {\n  var a;\n  var b = \"0\";\n  a = 1 | b;\n  assert(a == 1)\n})();\n\n(function tc_11_10__010() {\n  var a = 4;\n  var b;\n  a = 1 | b;\n  assert(a == 1)\n})();\n\n(function tc_11_10__012() {\n  var a = 4;\n  var b = 1;\n  a ^ b;\n  assert(a == 4 && b == 1)\n})();\n\n(function tc_11_10__011() {\n  var a;\n  a = 1 ^ 3;\n  assert(a == 2)\n})();\n\n(function tc_11_10__015() {\n  var a = 4;\n  var b;\n  a = 1 ^ b;\n  assert(a == 1)\n})();\n\n(function tc_11_10__014() {\n  var a = 4;\n  var b = null;\n  a = 1 ^ b;\n  assert(a == 1)\n})();\n\n(function tc_11_10__013() {\n  var a;\n  var b = \"0\";\n  a = 1 ^ b;\n  assert(a == 1)\n})();\n\n(function tc_11_10__007() {\n  var a = 4;\n  var b = 1;\n  a | b;\n  assert(a == 4 && b == 1)\n})();\n\n(function tc_11_10__009() {\n  var a = 4;\n  var b = null;\n  a = 1 | b;\n  assert(a == 1)\n})();\n\n(function tc_11_10__002() {\n  var a = 4;\n  var b = 1;\n  a & b;\n  assert(a == 4 && b == 1)\n})();\n\n(function tc_11_10__005() {\n  var a = 4;\n  var b;\n  a = 1 & b;\n  assert(a == 0)\n})();\n\n(function tc_11_10__018() {\n  var a = 10;\n  a = 2147483647 & 2147483649;\n  assert(a == 1)\n})();\n\n(function tc_11_01_06__003() {\n  var a = 2;\n  var b = 3;\n\n  assert((a) + (b) === (a + b));\n})();\n\n(function tc_11_01_06__009() {\n  assert(typeof (a) === \"undefined\");\n})();\n\n(function tc_11_01_06__006() {\n  a = {\n    n: Number,\n    s: String\n  }\n\n  assert(typeof (a.property) === \"undefined\");\n})();\n\n(function tc_11_01_06__005() {\n  a = {\n    n: Number,\n    s: String\n  }\n\n  assert(delete(a.n) === true);\n})();\n\n(function tc_11_01_06__004() {\n  a = {\n    n: Number,\n    s: String\n  };\n  b = {\n    n: Number,\n    s: String\n  };\n  a.n = 1;\n  b.n = 2;\n  a.s = \"qwe\";\n  b.s = \"rty\";\n\n  assert(((a).n + (b).n === 3) && ((a).s + (b).s === \"qwerty\"));\n})();\n\n(function tc_11_01_06__002() {\n  var a = 1;\n  var b = 2;\n  assert(a + b === (a + b));\n})();\n\n(function tc_11_01_06__001() {\n  var a = [1, 2, 4];\n  var cnt = 0;\n\n  for (var i = (0 in a) ? 1 : 2; i < 10; ++i)\n  {\n    ++cnt;\n  }\n\n  assert(cnt == 9);\n})();\n\n(function tc_11_01_05__001() {\n  var a = {\n    b: 5\n  };\n\n  assert(a.b === 5);\n})();\n\n(function tc_11_01_05__006() {\n  var a = {\n    get a() {\n      return 3;\n    }\n  };\n\n  assert(a.a === 3);\n})();\n\n(function tc_11_01_05__008() {\n  var a = {\n    _a: 3,\n    get a() {\n      return this._a;\n    },\n    set a(newa) {\n      this._a = newa;\n    }\n\n  };\n\n  a.a = 5;\n\n  assert(a.a === 5);\n})();\n\n(function tc_11_01_05__002() {\n  var a = {\n    \"b\": 5\n  };\n\n  assert(a.b === 5);\n})();\n\n(function tc_11_01_05__004() {\n  var a = {\n    10.25: 5\n  };\n\n  assert(a[10.25] === 5);\n})();\n\n(function tc_11_01_05__003() {\n  var a = {\n    10: 5\n  };\n\n  assert(a[10] === 5);\n})();\n\n(function tc_11_01_05__007() {\n  var a = {\n    _a: 3,\n    get a() {\n      return this._a;\n    }\n  };\n\n  a._a = 5;\n\n  assert(a.a === 5);\n})();\n\n(function tc_11_01_05__005() {\n  var a = {\n    prop1: 1,\n    prop2: 2\n  };\n\n  assert(a.prop1 === 1 && a.prop2 === 2);\n})();\n\n(function tc_11_13_02__013() {\n  var a = 0xffffffff;\n  var _a = a;\n  var b = 4;\n  assert ((a <<= b) === (_a << b));\n})();\n\n(function tc_11_13_02__047() {\n  object = {\n    valueOf: function () {\n      return 16\n    },\n    toString: function () {\n      return 0\n    }\n  }\n\n  copyObject = object;\n  assert(((object >>>= 2) === (copyObject >>> 2)) && (object === (copyObject >>> 2)))\n})();\n\n(function tc_11_13_02__005() {\n  var a = true;\n  var b = false;\n  a += b;\n  assert(a === 1)\n})();\n\n(function tc_11_13_02__039() {\n  var a = 4;\n  var _a = a;\n  var b = 10;\n  assert((a %= b) === (_a % b))\n})();\n\n(function tc_11_13_02__040() {\n  object = {\n    valueOf: function () {\n      return 1\n    },\n    toString: function () {\n      return 0\n    }\n  }\n\n  copyObject = object;\n  assert(((object *= 2) === (copyObject * 2)) && (object === (copyObject * 2)))\n})();\n\n(function tc_11_13_02__050() {\n  object = {\n    valueOf: function () {\n      return 1\n    },\n    toString: function () {\n      return 0\n    }\n  }\n\n  copyObject = object;\n  assert(((object ^= 1) === (copyObject ^ 1)) && (object === (copyObject ^ 1)))\n})();\n\n(function tc_11_13_02__008() {\n  var a = 5;\n  var _a = a;\n  var b = 10;\n  assert((a -= b) === (_a - b))\n})();\n\n(function tc_11_13_02__002() {\n  var a = 1;\n  var b = \"2\";\n  a += b;\n  assert(a === \"12\")\n})();\n\n(function tc_11_13_02__011() {\n  var a = 102;\n  var _a = a;\n  var b = 10;\n  assert(((a %= b) === (_a % b)) && (a === (_a % b)))\n})();\n\n(function tc_11_13_02__014() {\n  var a = 0xffffffff;\n  var _a = a;\n  var b = 4;\n  assert ((a >>>= b) === (_a >>> b));\n})();\n\n(function tc_11_13_02__001() {\n  var a = 1;\n  var b = 2;\n  a += b;\n  assert(a === 3);\n})();\n\n(function tc_11_13_02__003() {\n  var a = \"1\";\n  var b = 2;\n  a += b;\n  assert(a === \"12\")\n})();\n\n(function tc_11_13_02__043() {\n  object = {\n    valueOf: function () {\n      return 178\n    },\n    toString: function () {\n      return 0\n    }\n  }\n\n  copyObject = object;\n  assert(((object /= 2) === (copyObject / 2)) && (object === (copyObject / 2)))\n})();\n\n(function tc_11_13_02__007() {\n  var a = 3;\n  var _a = a;\n  var b = 7;\n  assert((a += b) === (_a + b))\n})();\n\n(function tc_11_13_02__045() {\n  object = {\n    valueOf: function () {\n      return 16\n    },\n    toString: function () {\n      return 0\n    }\n  }\n\n  copyObject = object;\n  assert(((object <<= 2) === (copyObject << 2)) && (object === (copyObject << 2)))\n})();\n\n(function tc_11_13_02__010() {\n  var a = 1;\n  var _a = a;\n  var b = 10.6;\n  assert((a /= b) === (_a / b))\n})();\n\n(function tc_11_13_02__046() {\n  object = {\n    valueOf: function () {\n      return 16\n    },\n    toString: function () {\n      return 0\n    }\n  }\n\n  copyObject = object;\n  assert(((object >>= 2) === (copyObject >> 2)) && (object === (copyObject >> 2)))\n})();\n\n(function tc_11_13_02__042() {\n  object = {\n    valueOf: function () {\n      return 15\n    },\n    toString: function () {\n      return \"\"\n    }\n  }\n\n  copyObject = object;\n  assert(((object -= 2) === (copyObject - 2)) && (object === (copyObject - 2)))\n})();\n\n(function tc_11_13_02__004() {\n  var a = \"1\";\n  var b = \"2\";\n  a += b;\n  assert(a === \"12\")\n})();\n\n(function tc_11_13_02__049() {\n  object = {\n    valueOf: function () {\n      return 1\n    },\n    toString: function () {\n      return 0\n    }\n  }\n\n  copyObject = object;\n  assert(((object |= 1) === (copyObject | 1)) && (object === (copyObject | 1)))\n})();\n\n(function tc_11_13_02__009() {\n  var a = 10;\n  var _a = a;\n  var b = 1.5;\n  assert((a *= b) === (_a * b))\n})();\n\n(function tc_11_13_02__044() {\n  object = {\n    valueOf: function () {\n      return 1345\n    },\n    toString: function () {\n      return \"foo\"\n    }\n  }\n\n  copyObject = object;\n  assert(((object %= 2) === (copyObject % 2)) && (object === (copyObject % 2)))\n})();\n\n(function tc_11_13_02__048() {\n  object = {\n    valueOf: function () {\n      return 1\n    },\n    toString: function () {\n      return 0\n    }\n  }\n\n  copyObject = object;\n  assert(((object &= 1) === (copyObject & 1)) && (object === (copyObject & 1)))\n})();\n\n(function tc_11_13_02__006() {\n  var a = 1;\n  var b = null;\n  a += b;\n  assert(a === 1)\n})();\n\n(function tc_11_13_02__041() {\n  object = {\n    valueOf: function () {\n      return 1\n    },\n    toString: function () {\n      return 0\n    }\n  }\n\n  copyObject = object;\n  assert(((object += 2) === (copyObject + 2)) && (object === (copyObject + 2)))\n})();\n\n(function tc_11_13_02__051() {\n  object = {\n    valueOf: function () {\n      return \"12\"\n    },\n    toString: function () {\n      return 0\n    }\n  }\n\n  copyObject = object;\n  assert(((object += 3) === (copyObject + 3)) && (object === (copyObject + 3)))\n})();\n\n(function tc_11_13_02__012() {\n  var a = 0xffffffff;\n  var _a = a;\n  var b = 4;\n  assert ((a >>= b) === (_a >> b));\n})();\n\n(function tc_11_13_01__001() {\n  var a = 5;\n  var b;\n\n  b = a;\n  assert(b == 5)\n})();\n\n(function tc_11_07_01__008() {\n  var a = 5;\n  var b = a << true;\n  assert(b == 10)\n})();\n\n(function tc_11_07_01__006() {\n  var a = null;\n  var b = a << 2;\n  assert(b == 0)\n})();\n\n(function tc_11_07_01__004() {\n  var a = 5;\n  var b = a << \"2\";\n  assert(b == 20)\n})();\n\n(function tc_11_07_01__003() {\n  var a = 5;\n  var b = a << 1 + 1;\n  assert(b == 20)\n})();\n\n(function tc_11_07_01__007() {\n  var a = 5;\n  var b = a << null;\n  assert(b == 5)\n})();\n\n(function tc_11_07_01__005() {\n  var a;\n  var b = a << 2;\n  assert(b == 0)\n})();\n\n(function tc_11_07_01__001() {\n  var a = 5;\n  var b = a << 2\n  assert(b == 20)\n})();\n\n(function tc_11_07_01__009() {\n  var a = 5;\n  var b = a << -1;\n  assert(b == -2147483648)\n})();\n\n(function tc_11_07_03__007() {\n  var a = 20;\n  var b = a >>> true;\n  assert(b == 10)\n})();\n\n(function tc_11_07_03__006() {\n  var a = 5;\n  var b = a >>> null;\n  assert(b == 5)\n})();\n\n(function tc_11_07_03__004() {\n  var a;\n  var b = a >>> 2;\n  assert(b == 0)\n})();\n\n(function tc_11_07_03__005() {\n  var a = null;\n  var b = a >>> 2;\n  assert(b == 0)\n})();\n\n(function tc_11_07_03__002() {\n  var a = 20;\n      var b = a >>> 1+1;\n  assert(b == 5)\n})();\n\n(function tc_11_07_03__003() {\n  var a = 20;\n  var b = a >>> \"2\";\n  assert(b == 5)\n})();\n\n(function tc_11_07_03__001() {\n  var a = 20;\n  var b = a >>> 2\n  assert(b == 5)\n})();\n\n(function tc_11_07_02__001() {\n  var a = 20;\n  var b = a >> 2\n  assert(b == 5)\n})();\n\n(function tc_11_07_02__003() {\n  var a = 20;\n  var b = a >> \"2\";\n  assert(b == 5)\n})();\n\n(function tc_11_07_02__004() {\n  var a;\n  var b = a >> 2;\n  assert(b == 0)\n})();\n\n(function tc_11_07_02__005() {\n  var a = null;\n  var b = a >> 2;\n  assert(b == 0)\n})();\n\n(function tc_11_07_02__009() {\n  var b = -2147483648 >> 30;\n  assert(b == -2)\n})();\n\n(function tc_11_07_02__006() {\n  var a = 5;\n  var b = a >> null;\n  assert(b == 5)\n})();\n\n(function tc_11_07_02__007() {\n  var a = 20;\n  var b = a >> true;\n  assert(b == 10)\n})();\n\n(function tc_11_07_02__002() {\n  var a = 20;\n  var b = a >> 1 + 1;\n  assert(b == 5)\n})();\n\n(function tc_11_07_02__008() {\n  var a = 5;\n  var b = a >> -1;\n  assert(b == 0)\n})();\n\n(function tc_11_02_01__004() {\n  var name = \"name\"\n  var a = {name: \"name\", value: \"1\"};\n\n  assert(a[name] == \"name\");\n})();\n\n(function tc_11_02_01__002() {\n  var a = {name: \"name\", value: \"1\"};\n  var b = {name: \"b\", value: \"1\"};\n\n  assert((a.name == b.name) || (a.value == b.value));\n})();\n\n(function tc_11_02_01__011() {\n  var a = {name: \"a\", value: 1};\n  var b = {name: \"b\", value: 1};\n\n  assert(plus(a, b) === 2);\n\n  function plus(a, b)\n  {\n    return a.value + b.value;\n  }\n})();\n\n(function tc_11_02_01__003() {\n  var a = {name: \"name\", value: \"1\"};\n\n  assert(a[1] !== \"nameeeeeeeeeee\");\n})();\n\n(function tc_11_02_01__008() {\n  var a = {name: \"a\", value: \"1\"};\n  var b = {name: \"b\", value: \"1\"};\n\n  assert(isNaN(plus(a, b)));\n\n  function plus(a, b)\n  {\n    return a.value * b.name;\n  }\n})();\n\n(function tc_11_02_01__010() {\n  var a = {name: \"a\", value: \"1\"};\n  var b = {name: \"b\", value: 1};\n\n  assert(plus(a, b) === \"11\");\n\n  function plus(a, b)\n  {\n    return a.value + b.value;\n  }\n})();\n\n(function tc_11_02_01__001() {\n  var a = {name: \"name\", value: \"1\"};\n\n  assert(a.name !== \"nameeeeeeeeeee\");\n})();\n\n(function tc_11_02_01__007() {\n  var a = {name: \"a\", value: \"1\"};\n  var b = {name: \"b\", value: \"1\"};\n  assert(plus(a, b) !== 2)\n\n  function plus(a, b)\n  {\n    return a.value + b.value;\n  }\n})();\n\n(function tc_11_02_01__009() {\n  var a = {name: \"a\", value: \"1\"};\n  var b = {name: \"b\", value: \"1\"};\n\n  assert(plus(a, b) === \"11\");\n\n  function plus(a, b)\n  {\n    return a.value + b.value;\n  }\n})();\n\n(function tc_11_02_04__003() {\n  assert(f_arg().length === 0);\n\n  function f_arg(x, y) {\n    return arguments;\n  }\n})();\n\n(function tc_11_02_04__010() {\n  f_arg = function () {\n    return arguments;\n  }\n\n  var args = f_arg (1, 2, 3);\n\n  for (var i = 0; i < 3; i++)\n  {\n    assert(args[i] === i + 1);\n  }\n\n  assert(args[3] === undefined);\n})();\n\n(function tc_11_02_04__012() {\n  f_arg = function(x,y) {\n    return arguments;\n  }\n\n  assert(f_arg(1)[0] === 1);\n})();\n\n(function tc_11_02_04__007() {\n  f_arg = function () {\n    return arguments;\n  }\n\n  assert(f_arg(1, 2, 3)[0] === 1);\n})();\n\n(function tc_11_02_04__017() {\n  function f_arg() {\n  }\n\n  try\n  {\n    f_arg(x, x = 1);\n  }\n  catch (e) {\n    assert((e instanceof ReferenceError) === true);\n  }\n})();\n\n(function tc_11_02_04__019() {\n  function f_arg() {\n  }\n\n\n  var x = function () {\n    throw \"x\";\n  };\n  var y = function () {\n    throw \"y\";\n  };\n  try\n  {\n    f_arg(x(), y());\n    assert(false);\n  }\n  catch (e)\n  {\n    if (e === \"y\")\n    {\n      assert(false);\n    } else {\n      if (e !== \"x\")\n      {\n        assert(false);\n      }\n    }\n  }\n})();\n\n(function tc_11_02_04__016() {\n  function f_arg() {\n  }\n\n  f_arg(x=1,x);\n})();\n\n(function tc_11_02_04__014() {\n  f_arg = function(x,y) {\n    return arguments;\n  }\n\n  assert(f_arg(1,2,3)[3] === undefined);\n})();\n\n(function tc_11_02_04__006() {\n  f_arg = function () {\n    return arguments;\n  }\n\n  assert(f_arg(1, 2, 3).length === 3);\n})();\n\n(function tc_11_02_04__004() {\n  assert(f_arg()[0] === undefined);\n\n  function f_arg(x,y) {\n    return arguments;\n  }\n})();\n\n(function tc_11_02_04__011() {\n  f_arg = function(x,y) {\n    return arguments;\n  }\n\n  assert(f_arg(1,2,3).length === 3);\n})();\n\n(function tc_11_02_04__001() {\n  assert(f_arg().length === 0);\n\n  function f_arg() {\n    return arguments;\n  }\n})();\n\n(function tc_11_02_04__013() {\n  f_arg = function (x, y) {\n    return arguments;\n  }\n\n  assert(f_arg(1, 2, 3)[2] === 3);\n})();\n\n(function tc_11_02_04__009() {\n  f_arg = function () {\n    return arguments;\n  }\n\n  assert(f_arg(1, 2, 3)[3] === undefined);\n})();\n\n(function tc_11_02_04__005() {\n  f_arg = function ()\n  {\n    return arguments\n  }\n\n  assert(f_arg(1, 2).length === 2);\n\n  f_arg = function () {\n    return arguments;\n  }\n})();\n\n(function tc_11_02_04__002() {\n  assert(f_arg()[0] === undefined);\n\n  function f_arg() {\n    return arguments;\n  }\n})();\n\n(function tc_11_02_04__008() {\n  f_arg = function () {\n    return arguments;\n  }\n\n  assert(f_arg(1, 2, 3)[2] === 3);\n})();\n\n(function tc_11_02_04__018() {\n  function f_arg(x, y, z) {\n    return z;\n  }\n\n  assert(f_arg(x = 1, y = x, x + y) === 2);\n})();\n\n(function tc_11_02_02__006() {\n  function Animal(name)\n  {\n    this.name = name\n    this.canWalk = true\n    if (name == \"bird\")\n    {\n      this.canFly = true;\n    }\n  }\n\n  var animal = new Animal(\"animal\");\n  var bird = new Animal(\"bird\");\n  assert(animal.canFly !== bird.canFly);\n})();\n\n(function tc_11_02_02__004() {\n  function Animal(name)\n  {\n    this.name = name\n    this.canWalk = true\n  }\n\n  var animal = new Animal(\"animal\");\n  assert(animal.someparameter != \"insect\");\n})();\n\n(function tc_11_02_02__001() {\n  function Animal(name)\n  {\n    this.name = name\n    this.canWalk = true\n  }\n\n  var animal = new Animal(\"animal\");\n  assert(animal.name === \"animal\");\n})();\n\n(function tc_11_02_02__007() {\n  function Animal(name)\n  {\n    this.name = name\n    this.canWalk = true\n    if (name == \"bird\")\n    {\n      this.canFly = true;\n    }\n  }\n\n  var animal = new Animal(\"animal\");\n  var bird = new Animal(\"bird\");\n\n  assert(animal.canWalk === true);\n  assert(bird.canWalk === true);\n  assert(animal.canFly === undefined);\n  assert(bird.canFly === true);\n})();\n\n(function tc_11_02_02__009() {\n  var a = {};\n  a.b = true;\n  assert(typeof a == \"object\" && a.b == 1);\n})();\n\n(function tc_11_02_02__002() {\n  function Animal(name)\n  {\n    this.name = name\n    this.canWalk = true\n  }\n\n  var animal = new Animal(\"animal\");\n  assert(animal.name == \"animal\");\n})();\n\n(function tc_11_02_02__003() {\n  function Animal(name)\n  {\n    this.name = name\n    this.canWalk = true\n  }\n\n  var animal = new Animal(\"animal\");\n  assert(animal.name != \"insect\");\n})();\n\n(function tc_11_02_02__005() {\n  function Animal(name)\n  {\n    this.name = name\n    this.canWalk = true\n  }\n\n  var animal = new Animal(\"animal\");\n  assert(animal[1] != \"animal\");\n})();\n\n(function tc_11_02_02__008() {\n  function Animal(name)\n  {\n    this.name = name\n    this.canWalk = true\n  }\n\n  var animal = new Animal();\n\n  assert(animal.canWalk);\n})();\n\n(function tc_11_02_03__007() {\n  function foo()\n  {\n    return 1;\n  }\n  assert(foo() === 1);\n})();\n\n(function tc_11_02_03__006() {\n  var a = {};\n  a.toString();\n})();\n\n(function tc_11_02_03__017() {\n  var obj = {\n    field: Number,\n    foo: function () {\n      this.field++;\n    }\n  }\n\n  obj.field = 3;\n  obj.foo();\n\n  assert(obj.field === 4);\n})();\n\n(function tc_11_02_03__021() {\n  var a = 1;\n  var b = foo();\n  function foo()\n  {\n    return a;\n  }\n\n  assert(b === 1);\n})();\n\n(function tc_11_02_03__008() {\n  var a = {\n    foo: function ()\n    {\n      return 1;\n    }\n  }\n\n  assert(a.foo() === 1);\n})();\n\n(function tc_11_14__002() {\n  var a, b, c, res;\n\n  res = (a = 39, b = null, c = 12.5);\n\n  assert(a == 39 && b == null && c == 12.5 && res == 12.5)\n})();\n\n(function tc_11_14__001() {\n  var res = (33, false, 73.234, 100);\n\n  assert(res == 100);\n})();\n\n(function tc_11_04_07__001() {\n  var a = 1;\n  assert(-a === -1)\n})();\n\n(function tc_11_04_07__014() {\n  var a = new Number(1);\n  assert(-a === -1)\n})();\n\n(function tc_11_04_07__009() {\n  var a = false;\n  assert(-a === 0)\n})();\n\n(function tc_11_04_07__024() {\n  var a = {\n    valueOf: function () {\n      return -1;\n    }\n  }\n  assert(-a === 1)\n})();\n\n(function tc_11_04_07__010() {\n  var a = Infinity;\n  assert(-a === -Infinity)\n})();\n\n(function tc_11_04_07__011() {\n  var a = -Infinity;\n  assert(-a === Infinity)\n})();\n\n(function tc_11_04_07__029() {\n  var a = {\n    member: 1,\n    valueOf: function () {\n      return this.member;\n    }\n  }\n\n  assert(-a === -1)\n})();\n\n(function tc_11_04_07__004() {\n  var a = \"-1\";\n  assert(-a === 1)\n})();\n\n(function tc_11_04_07__003() {\n  var a = \"1\";\n  assert(-a === -1)\n})();\n\n(function tc_11_04_07__002() {\n  var a = -1;\n  assert(-a === 1)\n})();\n\n(function tc_11_04_07__006() {\n  var a = \"0\";\n  assert(-a === 0)\n})();\n\n(function tc_11_04_07__022() {\n  var a = [1, 2, 3, 4, 5];\n  assert(isNaN(-a))\n})();\n\n(function tc_11_04_07__028() {\n  var a = {\n    valueOf: function () {\n      return undefined;\n    }\n  }\n  assert(isNaN(-a))\n})();\n\n(function tc_11_04_07__027() {\n  var a = {\n    valueOf: function () {\n      return null;\n    }\n  }\n  assert(-a === -0)\n})();\n\n(function tc_11_04_07__008() {\n  var a = true;\n  assert(-a === -1)\n})();\n\n(function tc_11_04_07__018() {\n  var a = new String(\"-1\");\n  assert(-a === 1)\n})();\n\n(function tc_11_04_07__012() {\n  var a = undefined;\n  assert(isNaN(-a))\n})();\n\n(function tc_11_04_07__016() {\n  var a = new Number(0);\n  assert(-a === 0)\n})();\n\n(function tc_11_04_07__017() {\n  var a = new String(\"1\");\n  assert(-a === -1)\n})();\n\n(function tc_11_04_07__019() {\n  var a = new String(\"\");\n  assert(-a === 0)\n})();\n\n(function tc_11_04_07__021() {\n  var a = new Boolean(false);\n  assert(-a === 0)\n})();\n\n(function tc_11_04_07__025() {\n  var a = {\n    valueOf: function () {\n      return true;\n    }\n  }\n  assert(-a === -1)\n})();\n\n(function tc_11_04_07__030() {\n  var a = {\n    member: 1,\n  }\n\n  assert(isNaN(-a))\n})();\n\n(function tc_11_04_07__005() {\n  var a = 0;\n  assert(-a === 0)\n})();\n\n(function tc_11_04_07__007() {\n  var a = \"\";\n  assert(-a === 0)\n})();\n\n(function tc_11_04_07__026() {\n  var a = {\n    valueOf: function () {\n      return false;\n    }\n  }\n  assert(-a === 0)\n})();\n\n(function tc_11_04_07__023() {\n  var a = {\n    valueOf: function () {\n      return 1;\n    }\n  }\n  assert(-a === -1)\n})();\n\n(function tc_11_04_07__013() {\n  var a = null;\n  assert(-a === -0)\n})();\n\n(function tc_11_04_07__031() {\n  var a = {\n    valueOf: function () {\n      return \"qwerty\";\n    }\n  }\n\n  assert(isNaN(-a))\n})();\n\n(function tc_11_04_07__015() {\n  var a = new Number(-1);\n  assert(-a === 1)\n})();\n\n(function tc_11_04_07__033() {\n  var a = new Object;\n  a.toString = function () {\n    return \"1\";\n  }\n\n  assert(-a === -1)\n})();\n\n(function tc_11_04_07__032() {\n  var a = +0;\n\n  assert(-a === -0)\n})();\n\n(function tc_11_04_07__020() {\n  var a = new Boolean(true);\n  assert(-a === -1)\n})();\n\n(function tc_11_04_02__002() {\n  var b = 1;\n\n  var a = void(++b);\n\n  assert(a == undefined && b == 2);\n})();\n\n(function tc_11_04_02__001() {\n  var a = void(5 / 2);\n\n  assert(a == undefined);\n})();\n\n(function tc_11_04_04__005() {\n  var a = 25;\n\n  assert(++\n          a === 26)\n})();\n\n(function tc_11_04_04__011() {\n  var a = \"abc\";\n\n  assert(isNaN(++a));\n})();\n\n(function tc_11_04_04__001() {\n  var a = 25;\n\n  assert(++a === 26);\n})();\n\n(function tc_11_04_04__006() {\n  var a = 1.12;\n  var eps = 0.00000001;\n\n  assert(++a >= 2.12 - eps && a <= 2.12 + eps);\n})();\n\n(function tc_11_04_04__009() {\n  var a = undefined;\n\n  assert(isNaN(++a))\n})();\n\n(function tc_11_04_04__002() {\n  var a = 25, b = -1;\n  ;\n\n  assert(++a === ++b + 26);\n})();\n\n(function tc_11_04_04__012() {\n  var a = function () {\n  };\n\n  assert(isNaN(++a));\n})();\n\n(function tc_11_04_04__007() {\n  var a = true;\n\n  assert(++a === 2);\n})();\n\n(function tc_11_04_04__010() {\n  var a = null;\n\n  assert(++a === 1);\n})();\n\n(function tc_11_04_04__008() {\n  var a = {};\n\n  assert(isNaN(++a))\n})();\n\n(function tc_11_04_04__004() {\n  var a = 25;\n\n  assert((++a) / 2 === 13);\n})();\n\n(function tc_11_04_01__013() {\n  eval('var foo = 1;');\n  assert((delete foo) == true && typeof foo == \"undefined\");\n})();\n\n(function tc_11_04_01__012() {\n  this.test = function (arg)\n  {\n    return 1;\n  }\n\n  assert((delete test) == true);\n})();\n\n(function tc_11_04_01__011() {\n  function test(arg)\n  {\n    if ((delete arg) == false)\n      return 0;\n    else\n      return 1;\n  }\n\n  assert(!test(\"str\"));\n})();\n\n(function tc_11_04_01__002() {\n  var y = 43;\n\n  assert((delete y) == false && y == 43);\n})();\n\n(function tc_11_04_01__017() {\n  assert((delete i_dont_exist) == true);\n})();\n\n(function tc_11_04_01__004() {\n  var myobj = {\n    h: 4,\n    k: 5\n  };\n\n  assert((delete myobj.h) == true && myobj.h == undefined);\n})();\n\n(function tc_11_04_01__007() {\n  var fruits = ['apple', 'banana', 'kiwi', 'pineapple'];\n\n  delete fruits[3];\n\n  assert(!(3 in fruits) && fruits.length == 4);\n})();\n\nassert((delete arguments) == true);\n\n(function tc_11_04_01__006() {\n  function Foo() {\n  }\n  Foo.prototype.bar = 42;\n  var foo = new Foo();\n  if (!(delete foo.bar))\n    assert(false)\n\n  if (foo.bar != 42)\n    assert(false)\n\n  if (!(delete Foo.prototype.bar))\n    assert(false)\n})();\n\n(function tc_11_04_01__003() {\n  var y = 43;\n\n  assert((delete Math.PI) == false);\n})();\n\n(function tc_11_04_01__008() {\n  function x() {\n  }\n\n  assert((delete x) == false && typeof x == \"function\");\n})();\n\n(function tc_11_04_01__009() {\n  this.prop = \"prop\";\n\n  assert((delete this.prop) == true);\n})();\n\n(function tc_11_04_01__005() {\n  myobj = {\n          h: 4,\n          k: 5\n      };\n\n  assert ((delete myobj) == true);\n})();\n\n(function tc_11_04_01__001() {\n  x = 42;\n\n  assert ((delete x) == true);\n})();\n\n(function tc_11_04_06__013() {\n  var a = new String(\"-1\");\n  assert(+a === -1)\n})();\n\n(function tc_11_04_06__008() {\n  var a = new Number(1);\n  assert(+a === 1)\n})();\n\n(function tc_11_04_06__017() {\n  var a = new String(\"qwerty\");\n  assert(isNaN(+a))\n})();\n\n(function tc_11_04_06__018() {\n  var a = {\n    valueOf: function () {\n      return 1;\n    }\n  }\n\n  assert(+a === 1)\n})();\n\n(function tc_11_04_06__014() {\n  var a = undefined;\n  assert(isNaN(+a))\n})();\n\n(function tc_11_04_06__024() {\n  var a = {\n    member: Number\n  }\n\n  assert(isNaN(+a))\n})();\n\n(function tc_11_04_06__026() {\n  var array = [1, 2, 3, 4, 5];\n  assert(isNaN(+array))\n})();\n\n(function tc_11_04_06__004() {\n  var a = \"-1\";\n  assert(+a === -1)\n})();\n\n(function tc_11_04_06__001() {\n  var a = 1;\n  assert(+a === a)\n})();\n\n(function tc_11_04_06__005() {\n  var a = true;\n  assert(+a === 1)\n})();\n\n(function tc_11_04_06__023() {\n  var a = {\n    valueOf: function () {\n      return \"not a number\";\n    }\n  }\n\n  assert(isNaN(+a))\n})();\n\n(function tc_11_04_06__007() {\n  var a = new Number(0);\n  assert(+a === 0);\n})();\n\n(function tc_11_04_06__012() {\n  var a = new String(\"1\");\n  assert(+a === 1)\n})();\n\n(function tc_11_04_06__022() {\n  var a = {\n    valueOf: function () {\n      return false;\n    }\n  }\n\n  assert(+a === +0)\n})();\n\n(function tc_11_04_06__010() {\n  var a = new Boolean(true);\n  assert(+a === 1)\n})();\n\n(function tc_11_04_06__006() {\n  var a = false;\n  assert(+a === 0)\n})();\n\n(function tc_11_04_06__020() {\n  var a = {\n    valueOf: function () {\n      return -1;\n    }\n  }\n\n  assert(+a === -1)\n})();\n\n(function tc_11_04_06__021() {\n  var a = new Object;\n  a.valueOf = function () {\n    return true;\n  }\n\n  assert(+a === 1)\n})();\n\n(function tc_11_04_06__002() {\n  var a = -1;\n  assert(+a === a)\n})();\n\n(function tc_11_04_06__027() {\n  var a = {\n    toString: function () {\n      return \"1\"\n    }\n  }\n\n  assert(+a === 1)\n})();\n\n(function tc_11_04_06__015() {\n  var a = null;\n  assert(+a === +0)\n})();\n\n(function tc_11_04_06__025() {\n  var a = {\n    valueOf: function () {\n      return null;\n    }\n  }\n  assert(+a === +0)\n})();\n\n(function tc_11_04_06__019() {\n  var a = {\n    valueOf: function () {\n      return \"1\";\n    }\n  }\n\n  assert(+a === 1)\n})();\n\n(function tc_11_04_06__028() {\n  var a = {\n    valueOf: function () {\n      return \"\"\n    }\n  }\n\n  assert(+a === 0)\n})();\n\n(function tc_11_04_06__009() {\n  var a = new Number(-1);\n  assert(+a === -1)\n})();\n\n(function tc_11_04_06__003() {\n  var a = \"1\";\n  assert(+a === 1)\n})();\n\n(function tc_11_04_06__011() {\n  var a = new Boolean(false);\n  assert(+a === +0)\n})();\n\n(function tc_11_04_06__016() {\n  var a = NaN;\n  assert(isNaN(+a))\n})();\n\n(function tc_11_04_09__006() {\n  assert(!(+0) === true)\n})();\n\n(function tc_11_04_09__015() {\n  assert(![] === false)\n})();\n\n(function tc_11_04_09__004() {\n  var a = null;\n  assert(!a === true)\n})();\n\n(function tc_11_04_09__017() {\n  assert(!1 === false)\n})();\n\n(function tc_11_04_09__013() {\n  assert(!true === false)\n})();\n\n(function tc_11_04_09__005() {\n  var a = null;\n  assert(!a === true)\n})();\n\n(function tc_11_04_09__012() {\n  var a = {\n    valueOf: function () {\n      return false;\n    }\n  }\n  assert(!a === false)\n})();\n\n(function tc_11_04_09__002() {\n  var a = false;\n  assert(!a === true)\n})();\n\n(function tc_11_04_09__010() {\n  assert(!(\"anything\") === false)\n})();\n\n(function tc_11_04_09__011() {\n  var a = new Object;\n  assert(!a === false)\n})();\n\n(function tc_11_04_09__001() {\n  var a = true;\n  assert(!a === false)\n})();\n\n(function tc_11_04_09__007() {\n  assert(!(-0) === true)\n})();\n\n(function tc_11_04_09__018() {\n  assert(!(-Infinity) === false)\n})();\n\n(function tc_11_04_09__014() {\n  assert(!false === true)\n})();\n\n(function tc_11_04_09__016() {\n  assert(!0 === true)\n})();\n\n(function tc_11_04_09__003() {\n  var a = undefined;\n  assert(!a === true)\n})();\n\n(function tc_11_04_09__008() {\n  assert(!(NaN) === true)\n})();\n\n(function tc_11_04_09__019() {\n  assert(!Infinity === false)\n})();\n\n(function tc_11_04_09__009() {\n  assert(!(\"\") === true)\n})();\n\n(function tc_11_04_09__020() {\n  var a = new Boolean(true);\n  assert(!a === false)\n})();\n\n(function tc_11_04_08__001() {\n  var a = 0;\n  assert(~a === -1);\n})();\n\n(function tc_11_04_08__019() {\n  var a = {\n    valueOf: function () {\n      return \"0x001\"\n    }\n  }\n  assert(~a === -0x002)\n})();\n\n(function tc_11_04_08__007() {\n  var a = -0;\n  assert(~a === -1)\n})();\n\n(function tc_11_04_08__020() {\n  var a = {\n    valueOf: function () {\n      return -0x01\n    }\n  }\n  assert(~a === 0)\n})();\n\n(function tc_11_04_08__011() {\n  var a = 0x1fffffffe;\n  assert(~a === ~(0xfffffffe))\n})();\n\n(function tc_11_04_08__022() {\n  var a = Number(1);\n  assert(~a === -2)\n})();\n\n(function tc_11_04_08__021() {\n  var a = {\n    valueOf: function () {\n      return true\n    }\n  }\n  assert(~a === -2)\n})();\n\n(function tc_11_04_08__002() {\n  var a = -1;\n  assert(~a === 0)\n})();\n\n(function tc_11_04_08__006() {\n  var a = +0;\n  assert(~a === -1)\n})();\n\n(function tc_11_04_08__018() {\n  var a = false;\n  assert(~a === -1)\n})();\n\n(function tc_11_04_08__016() {\n  var a = \"Who cares?\";\n  assert(~a === -1)\n})();\n\n(function tc_11_04_08__003() {\n  var a = 1;\n  assert(~a === -2)\n})();\n\n(function tc_11_04_08__014() {\n  var a = 0xffff;\n  assert(~a === -0x10000)\n})();\n\n(function tc_11_04_08__008() {\n  var a = +Infinity;\n  assert(~a === -1)\n})();\n\n(function tc_11_04_08__017() {\n  var a = true;\n  assert(~a === -2)\n})();\n\n(function tc_11_04_08__004() {\n  var a = 0x0001;\n  assert(~a === -0x0002)\n})();\n\n(function tc_11_04_08__012() {\n  var a = 0x110000000;\n  assert(~a === ~(0x10000000))\n})();\n\n(function tc_11_04_08__009() {\n  var a = -Infinity;\n  assert(~a === -1)\n})();\n\n(function tc_11_04_08__005() {\n  var a = NaN;\n  assert(~a === -1)\n})();\n\n(function tc_11_04_08__013() {\n  var a = 0x1fffffff;\n  assert(~a === ~(0x1fffffff))\n})();\n\n(function tc_11_04_08__010() {\n  var a = 2 * 0x100000000;\n  assert(~a === -1)\n})();\n\n(function tc_11_04_08__015() {\n  var a = \"1\";\n  assert(~a === -2)\n})();\n\n(function tc_11_04_05__005() {\n  var a = 25;\n\n  assert(--\n          a === 24)\n})();\n\n(function tc_11_04_05__012() {\n  var a = function () {\n  };\n\n  assert(isNaN(--a));\n})();\n\n(function tc_11_04_05__008() {\n  var a = {};\n\n  assert(isNaN(--a))\n})();\n\n(function tc_11_04_05__009() {\n  var a = undefined;\n\n  assert(isNaN(--a))\n})();\n\n(function tc_11_04_05__002() {\n  var a = 25, b = 1;\n  ;\n\n  assert(--a === --b + 24)\n})();\n\n(function tc_11_04_05__006() {\n  var eps = 0.000000001;\n  var a = 1.12;\n\n  assert(--a >= 0.12 - eps &&\n          a <= 0.12 + eps)\n})();\n\n(function tc_11_04_05__010() {\n  var a = null;\n\n  assert(--a === -1);\n})();\n\n(function tc_11_04_05__011() {\n  var a = \"abc\";\n\n  assert(isNaN(--a));\n})();\n\n(function tc_11_04_05__004() {\n  var a = 25;\n\n  assert((--a) / 2 === 12)\n})();\n\n(function tc_11_04_05__007() {\n  var a = true;\n\n  assert(--a === 0)\n})();\n\n(function tc_11_04_05__001() {\n  var a = 25;\n\n  assert(--a === 24)\n})();\n\n(function tc_11_04_03__003() {\n  assert(typeof Math.LN2 === 'number' &&\n          typeof Infinity === 'number' &&\n          typeof NaN === 'number' &&\n          typeof Number(1) === 'number');\n})();\n\n(function tc_11_04_03__012() {\n  assert (typeof Math.sin === 'function');\n})();\n\n(function tc_11_04_03__007() {\n  assert(typeof Boolean(true) === 'boolean');\n})();\n\n(function tc_11_04_03__005() {\n  assert(typeof (typeof 1) === 'string' &&\n          typeof String(\"str\") === 'string');\n})();\n\n(function tc_11_04_03__008() {\n  assert(typeof undefined === 'undefined' &&\n          typeof smth === 'undefined');\n})();\n\n(function tc_11_04_03__009() {\n  assert(typeof {a: 1} === 'object' &&\n          typeof [1, 2, 4] === 'object')\n})();\n\n(function tc_11_04_03__006() {\n  assert(typeof true === 'boolean' &&\n          typeof false === 'boolean');\n})();\n\n(function tc_11_04_03__004() {\n  assert(typeof \"\" === 'string' &&\n          typeof \"str\" === 'string');\n})();\n\n(function tc_11_04_03__013() {\n  assert(typeof null === 'object');\n})();\n\n(function tc_11_04_03__011() {\n  assert (typeof function(){} === 'function')\n})();\n\n(function tc_11_04_03__002() {\n  assert(typeof 37 === 'number' &&\n          typeof 3.14 === 'number');\n})();\n\n(function tc_11_04_03__016() {\n  assert(typeof\n          24 === 'number')\n})();\n\n(function tc_11_04_03__010() {\n  assert(typeof new Date() === 'object' &&\n          typeof new Boolean(true) === 'object' &&\n          typeof new Number(1) === 'object' &&\n          typeof new String(\"abc\") === 'object')\n})();\n\n(function tc_11_04_03__001() {\n  assert(typeof 37 === 'number');\n})();\n\n(function tc_11_06_02__006() {\n  assert(1 - 1 === 0)\n})();\n\n(function tc_11_06_02__013() {\n  assert(\"1\" - \"1\" === 0)\n})();\n\n(function tc_11_06_02__012() {\n  assert(new Number(1) - new Number(1) === 0)\n})();\n\n(function tc_11_06_02__015() {\n  assert(new String(\"1\") - new String(\"1\") === 0)\n})();\n\n(function tc_11_06_02__002() {\n  var a = -10;\n  var b = 50;\n  assert((a - b === -60) && (b - a === 60))\n})();\n\n(function tc_11_06_02__014() {\n  assert(!(((\"1\" - new String(\"1\") !== 0) || (new String(\"1\") - 1 !== 0))))\n})();\n\n(function tc_11_06_02__004() {\n  var a = \"string\";\n  var b = 10;\n  assert(isNaN(a - b) && isNaN(b - a))\n})();\n\n(function tc_11_06_02__003() {\n  var a = -5;\n  var b = -100;\n  assert(a - b === 95)\n})();\n\n(function tc_11_06_02__010() {\n  assert(true - true === 0)\n})();\n\n(function tc_11_06_02__008() {\n  object = {\n    valueOf: function () {\n      return 1;\n    },\n    toString: function () {\n      return 0;\n    }\n  }\n  assert(!((object - 1 !== 0) || (1 - object !== 0)));\n})();\n\n(function tc_11_06_02__009() {\n  var x = 0;\n  assert(x - (x = 1) === -1)\n})();\n\n(function tc_11_06_02__017() {\n  assert(isNaN(\"x\" - 1) && isNaN(1 - \"x\"))\n})();\n\n(function tc_11_06_02__001() {\n  var a = 100;\n  var b = 20;\n  assert(a - b === 80)\n})();\n\n(function tc_11_06_02__011() {\n  assert(!(((new Number(1) - 1 !== 0) || (1 - new Number(1) !== 0))))\n})();\n\n(function tc_11_06_02__007() {\n  var object1 = new Object();\n  var object2 = new Object();\n  object1.prop = 1;\n  object2.prop = 1;\n  assert(object1.prop - object2.prop === 0)\n})();\n\n(function tc_11_06_02__005() {\n  var x = 1;\n  assert(!((x - 1 !== 0) || (1 - x !== 0)))\n})();\n\n(function tc_11_06_02__016() {\n  assert(isNaN(\"x\" - \"1\") && isNaN(\"1\" - \"x\"))\n})();\n\n(function tc_11_06_03__024() {\n  assert(\"1\" + 1 + 1 === (\"1\" + 1) + 1)\n})();\n\n(function tc_11_06_03__002() {\n  obj = new Object;\n  assert(isNaN(obj + NaN) && isNaN(NaN + obj))\n})();\n\n(function tc_11_06_03__007() {\n  assert(-0 + -0 === -0)\n})();\n\n(function tc_11_06_03__010() {\n  assert(2 + -2 === +0)\n})();\n\n(function tc_11_06_03__016() {\n  var a = 1;\n  var b = -1;\n  assert(a - b === a + -b)\n})();\n\n(function tc_11_06_03__017() {\n  assert(Number.MAX_VALUE - -0 === Number.MAX_VALUE)\n})();\n\n(function tc_11_06_03__012() {\n  assert(-Number.MAX_VALUE - Number.MAX_VALUE === -Infinity)\n})();\n\n(function tc_11_06_03__013() {\n  assert(!(Number.MIN_VALUE + -Number.MIN_VALUE !== +0))\n})();\n\n(function tc_11_06_03__009() {\n  assert(0 + 5 === 5)\n})();\n\n(function tc_11_06_03__015() {\n  assert(Number.MAX_VALUE - -Number.MAX_VALUE === +Infinity)\n})();\n\n(function tc_11_06_03__011() {\n  assert((+0 + +0 === +0) && (+0 + -0 === +0))\n})();\n\n(function tc_11_06_03__001() {\n  var a = 1;\n  var b = 2;\n  assert(a + b === b + a)\n})();\n\n(function tc_11_06_03__008() {\n  assert((+0 + +0 === +0) && (+0 + -0 === +0))\n})();\n\n(function tc_11_06_03__022() {\n  assert(-Number.MAX_VALUE + Number.MAX_VALUE + Number.MAX_VALUE === (-Number.MAX_VALUE + Number.MAX_VALUE) + Number.MAX_VALUE)\n})();\n\n(function tc_11_06_03__003() {\n  obj = new Object();\n  assert(isNaN(obj - NaN) && isNaN(NaN - obj))\n})();\n\n(function tc_11_06_03__018() {\n  assert(0 - 1 === -1)\n})();\n\n(function tc_11_06_03__019() {\n  assert(-Number.MAX_VALUE - -Number.MAX_VALUE === +0)\n})();\n\n(function tc_11_06_03__021() {\n  assert(-8.99e+307 - 8.99e+307 === -Infinity)\n})();\n\n(function tc_11_06_03__004() {\n  assert(isNaN(Infinity + -Infinity))\n})();\n\n(function tc_11_06_03__023() {\n  assert((-Number.MAX_VALUE + Number.MAX_VALUE) + Number.MAX_VALUE !== -Number.MAX_VALUE + (Number.MAX_VALUE + Number.MAX_VALUE))\n})();\n\n(function tc_11_06_03__005() {\n  assert((Infinity + Infinity === Infinity) && (-Infinity + -Infinity === -Infinity))\n})();\n\n(function tc_11_06_03__014() {\n  assert(-Number.MAX_VALUE - -Number.MAX_VALUE === +0)\n})();\n\n(function tc_11_06_03__006() {\n  assert(Infinity + 1 === Infinity)\n})();\n\n(function tc_11_06_03__025() {\n  assert((\"1\" + 1) + 1 !== \"1\" + (1 + 1))\n})();\n\n(function tc_11_06_03__020() {\n  assert(1e+308 - -1e+308 === +Infinity)\n})();\n\n(function tc_11_06_01__006() {\n  var y = 1;\n  assert(1 + y === 2)\n})();\n\n(function tc_11_06_01__012() {\n  object = {\n    valueOf: function () {\n      return 1\n    },\n    toString: function () {\n      return 0\n    }\n  }\n  assert(1 + object === 2)\n})();\n\n(function tc_11_06_01__010() {\n  assert(new Number(1) + new Number(1) === 2)\n})();\n\n(function tc_11_06_01__008() {\n  var objectx = new Object();\n  var objecty = new Object();\n  objectx.prop = 1;\n  objecty.prop = 1;\n  assert(objectx.prop + objecty.prop === 2)\n})();\n\n(function tc_11_06_01__005() {\n  var x = 1;\n  assert(x + 1 === 2)\n})();\n\n(function tc_11_06_01__007() {\n  assert(new Number(1) + 1 === 2)\n})();\n\n(function tc_11_06_01__002() {\n  var a = 12;\n  var b = \"3\";\n  assert(a + b === \"123\")\n})();\n\n(function tc_11_06_01__017() {\n  object = new Object()\n\n  var b = 1\n\n  assert(object + b === \"[object Object]1\")\n})();\n\n(function tc_11_06_01__015() {\n  object1 = {\n    valueOf: function () {\n      return 1;\n    },\n    toString: function () {\n      return 0;\n    }\n  }\n\n  object2 = {\n    valueOf: function () {\n      return 1;\n    },\n    toString: function () {\n      return 0;\n    }\n  }\n\n  assert(object1 + object2 === 2)\n})();\n\n(function tc_11_06_01__009() {\n  assert(1 + new Number(1) === 2)\n})();\n\n(function tc_11_06_01__018() {\n  object = new String()\n\n  var b = 1\n\n  assert(object + b === \"1\")\n})();\n\n(function tc_11_06_01__003() {\n  var a = \"12\";\n  var b = 3;\n  assert(a + b === \"123\")\n})();\n\n(function tc_11_06_01__011() {\n  object = {\n    valueOf: function () {\n      return 1\n    },\n    toString: function () {\n      return 0\n    }\n  }\n  assert(object + 1 === 2)\n})();\n\n(function tc_11_06_01__016() {\n  object = new Object()\n\n  var str = new String()\n\n  assert(object + str === \"[object Object]\")\n})();\n\n(function tc_11_06_01__001() {\n  var a = \"lirum \";\n  var b = \"ipsum\";\n  assert(a + b == \"lirum ipsum\")\n})();\n\n(function tc_11_06_01__013() {\n  object = {\n    valueOf: function () {\n      return 1\n    },\n    toString: function () {\n      return 0\n    }\n  }\n  assert(object + \"1\" === \"11\")\n})();\n\n(function tc_11_06_01__014() {\n  object = {\n    valueOf: function () {\n      return \"1\"\n    },\n    toString: function () {\n      return 0\n    }\n  }\n  assert(\"1\" + object === \"11\")\n})();\n\n(function tc_11_06_01__004() {\n  var a = 123;\n  var b = 456;\n  assert(a + b == 579)\n})();\n\n(function tc_11_09_04__020() {\n  var x = \"12.6asdg$7_sfk/sf/adf\\.3rqaf\\u0102\", y = \"12.6asdg$7_sfk/sf/adf\\.3rqaf\\u0102\"\n  assert(x === y)\n})();\n\n(function tc_11_09_04__007() {\n  var x = false, y = 0\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__015() {\n  var x = NaN, y = NaN\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__017() {\n  var x = 123.01, y = 0.0123e+4\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__006() {\n  var x = null, y = 0\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__001() {\n  var x, y = null\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__019() {\n  var x = -0, y = +0\n  assert(x === y)\n})();\n\n(function tc_11_09_04__023() {\n  var x = false, y = true\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__008() {\n  var x = \"0\", y = 0\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__024() {\n  var x = new String(\"abc\")\n  var y = x\n  assert(x === y)\n})();\n\n(function tc_11_09_04__011() {\n  var x, y\n  assert(x === y)\n})();\n\n(function tc_11_09_04__005() {\n  var x, y = new Function()\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__013() {\n  var x = NaN, y = 0\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__016() {\n  var x = 123.00, y = 0.0123e+4, eps = .00001\n  assert(x <= y + eps && x >= y - eps)\n})();\n\n(function tc_11_09_04__025() {\n  var x = new String(\"abc\")\n  var y = new String(\"abc\")\n\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__009() {\n  var x = \"0\", y = Object(0)\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__004() {\n  var x, y = -37.2e-6\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__002() {\n  var x, y = true\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__022() {\n  var x = false, y = false\n  assert(x === y)\n})();\n\n(function tc_11_09_04__014() {\n  var x = 0.0, y = NaN\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__010() {\n  var x = \"abc\", y = new String(\"abc\")\n\n  assert(x !== y)\n})();\n\n(function tc_11_09_04__021() {\n  var x = true, y = true\n  assert(x === y)\n})();\n\n(function tc_11_09_04__018() {\n  var x = +0, y = -0\n  assert(x === y)\n})();\n\n(function tc_11_09_04__012() {\n  var x = y = null\n  assert(x === y)\n})();\n\n(function tc_11_09_04__003() {\n  var x, y = \"undefined\"\n  assert(x !== y)\n})();\n\n(function tc_11_09_01__031() {\n  var x = Object(\"abc\")\n  var y = Object(\"abc\")\n  b = x, c = y\n  assert(!(c == b))\n})();\n\n(function tc_11_09_01__025() {\n  var x = false, y = \"-0\"\n  assert(x == y)\n})();\n\n(function tc_11_09_01__027() {\n  var x = true, y = \"-1\"\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__032() {\n  var x = \"a\"\n  var y = 2\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__002() {\n  var x = null, y = null\n  assert(x == y)\n})();\n\n(function tc_11_09_01__005() {\n  var x = 2.756, y = 2.756\n  assert(x == y)\n})();\n\n(function tc_11_09_01__007() {\n  var x = -0, y = +0\n  assert(x == y)\n})();\n\n(function tc_11_09_01__006() {\n  var x = +0, y = -0\n  assert(x == y)\n})();\n\n(function tc_11_09_01__008() {\n  var x = 2.8, y = 3.4\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__033() {\n  var x = \"12.1e5\"\n  var y = 1210000\n  assert(x == y)\n})();\n\n(function tc_11_09_01__036() {\n  var x = 1e-324\n  var y = false\n  assert(x == y)\n})();\n\n(function tc_11_09_01__011() {\n  var x = \"abg\", y = 'abh'\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__014() {\n  var x = false, y = false\n  assert(x == y)\n})();\n\n(function tc_11_09_01__020() {\n  var x = 0.123, y = \"0.123e0\"\n  assert(x == y)\n})();\n\n(function tc_11_09_01__017() {\n  var x = undefined, y = null\n  assert(x == y)\n})();\n\n(function tc_11_09_01__004() {\n  var x = 2, y = NaN\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__024() {\n  var x = 0.123, y = \"1.23e-1\"\n  assert(x == y)\n})();\n\n(function tc_11_09_01__003() {\n  var x = NaN, y = 1\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__034() {\n  var x = \"1\"\n  var y = true\n  assert(x == y)\n})();\n\n(function tc_11_09_01__021() {\n  var x = 0.123, y = \"0.123e+2\"\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__019() {\n  var x = 0.123, y = \"0.124\"\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__026() {\n  var x = true, y = \"+1\"\n  assert(x == y)\n})();\n\n(function tc_11_09_01__018() {\n  var x = 0.123, y = \"0.123\"\n  assert(x == y)\n})();\n\n(function tc_11_09_01__010() {\n  var x = \"abg\", y = 'abgs'\n  assert(x != y)\n})();\n\n(function tc_11_09_01__038() {\n  var x = \"0\", y = Object(0)\n  assert(x == y)\n})();\n\n(function tc_11_09_01__015() {\n  var x = false, y = true\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__009() {\n  var x = \"abg\", y = 'abg'\n  assert(x == y)\n})();\n\n(function tc_11_09_01__029() {\n  var x = true, y = \"123\"\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__016() {\n  var x = null, y = undefined\n  assert(x == y)\n})();\n\n(function tc_11_09_01__035() {\n  var x = 0\n  var y = false\n  assert(x == y)\n})();\n\n(function tc_11_09_01__037() {\n  var x = 0.1e-323\n  var y = false\n  assert(x == y)\n})();\n\n(function tc_11_09_01__013() {\n  var x = true, y = true\n  assert(x == y)\n})();\n\n(function tc_11_09_01__028() {\n  var x = true, y = \"true\"\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__030() {\n  var x = Object(\"abc\")\n  b = x\n  assert(x == b)\n})();\n\n(function tc_11_09_01__022() {\n  var x = 0.123, y = \"0.123a\"\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__023() {\n  var x = 0.123, y = \"b0.123\"\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__012() {\n  var x = \"abg\", y = 'aBg'\n  assert(!(x == y))\n})();\n\n(function tc_11_09_01__001() {\n  var x, y\n  assert(x == y)\n})();\n\n(function tc_11_09_02__035() {\n  var x = 0\n  var y = false\n  assert(x == y)\n})();\n\n(function tc_11_09_02__033() {\n  var x = \"12.1e5\"\n  var y = 1210000\n  assert(!(x != y))\n})();\n\n(function tc_11_09_02__019() {\n  var x = 0.123, y = \"0.124\"\n  assert(x != y)\n})();\n\n(function tc_11_09_02__018() {\n  var x = 0.123, y = \"0.123\"\n  assert(x == y)\n})();\n\n(function tc_11_09_02__005() {\n  var x = 2.756, y = 2.756\n  assert(x == y)\n})();\n\n(function tc_11_09_02__028() {\n  var x = true, y = \"true\"\n  assert(x != y)\n})();\n\n(function tc_11_09_02__024() {\n  var x = 0.123, y = \"1.23e-1\"\n  assert(x == y)\n})();\n\n(function tc_11_09_02__032() {\n  var x = \"a\"\n  var y = 2\n  assert(x != y)\n})();\n\n(function tc_11_09_02__021() {\n  var x = 0.123, y = \"0.123e+2\"\n  assert(!(x == y))\n})();\n\n(function tc_11_09_02__002() {\n  var x = null, y = null\n  assert(x == y)\n})();\n\n(function tc_11_09_02__026() {\n  var x = true, y = \"+1\"\n  assert(x == y)\n})();\n\n(function tc_11_09_02__037() {\n  var x = 1e-323\n  var y = false\n  assert(x != y)\n})();\n\n(function tc_11_09_02__012() {\n  var x = \"abg\", y = 'aBg'\n  assert(x != y)\n})();\n\n(function tc_11_09_02__016() {\n  var x = null, y = undefined\n  assert(x == y)\n})();\n\n(function tc_11_09_02__017() {\n  var x = undefined, y = null\n  assert(x == y)\n})();\n\n(function tc_11_09_02__031() {\n  var x = Object(\"abc\")\n  var y = Object(\"abc\")\n  b = x, c = y\n  assert(c != b)\n})();\n\n(function tc_11_09_02__023() {\n  var x = 0.123, y = \"b0.123\"\n  assert(x != y)\n})();\n\n(function tc_11_09_02__015() {\n  var x = false, y = true\n  assert(x != y)\n})();\n\n(function tc_11_09_02__034() {\n  var x = \"1\"\n  var y = true\n  assert(x == y)\n})();\n\n(function tc_11_09_02__036() {\n  var x = 1e-324\n  var y = false\n  assert(x == y)\n})();\n\n(function tc_11_09_02__022() {\n  var x = 0.123, y = \"0.123a\"\n  assert(x != y)\n})();\n\n(function tc_11_09_02__038() {\n  var x = \"0\", y = Object(0)\n  assert(x == y)\n})();\n\n(function tc_11_09_02__020() {\n  var x = 0.123, y = \"0.123e0\"\n  assert(x == y)\n})();\n\n(function tc_11_09_02__003() {\n  var x = NaN, y = 1\n  assert(x != y)\n})();\n\n(function tc_11_09_02__014() {\n  var x = false, y = false\n  assert(x == y)\n})();\n\n(function tc_11_09_02__011() {\n  var x = \"abg\", y = 'abh'\n  assert(x != y)\n})();\n\n(function tc_11_09_02__025() {\n  var x = false, y = \"-0\"\n  assert(x == y)\n})();\n\n(function tc_11_09_02__007() {\n  var x = -0, y = +0\n  assert(x == y)\n})();\n\n(function tc_11_09_02__030() {\n  var x = Object(\"abc\")\n  b = x\n  assert(x == b)\n})();\n\n(function tc_11_09_02__027() {\n  var x = true, y = \"-1\"\n  assert(x != y)\n})();\n\n(function tc_11_09_02__004() {\n  var x = 2, y = NaN\n  assert(x != y)\n})();\n\n(function tc_11_09_02__006() {\n  var x = +0, y = -0\n  assert(x == y)\n})();\n\n(function tc_11_09_02__013() {\n  var x = true, y = true\n  assert(x == y)\n})();\n\n(function tc_11_09_02__010() {\n  var x = \"abg\", y = 'abgs'\n  assert(x != y)\n})();\n\n(function tc_11_09_02__001() {\n  var x, y\n  assert(x == y)\n})();\n\n(function tc_11_09_02__029() {\n  var x = true, y = \"123\"\n  assert(x != y)\n})();\n\n(function tc_11_09_02__008() {\n  var x = 2.8, y = 3.4\n  assert(x != y)\n})();\n\n(function tc_11_09_02__009() {\n  var x = \"abg\", y = 'abg'\n  assert(x == y)\n})();\n\n(function tc_11_09_05__009() {\n  var x = \"0\", y = Object(0)\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__020() {\n  var x = \"12.6asdg$7_sfk/sf/adf\\.3rqaf\\u0102\", y = \"12.6asdg$7_sfk/sf/adf\\.3rqaf\\u0102\"\n  assert(x === y)\n})();\n\n(function tc_11_09_05__002() {\n  var x, y = true\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__023() {\n  var x = false, y = true\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__007() {\n  var x = false, y = 0\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__019() {\n  var x = -0, y = +0\n  assert(x === y)\n})();\n\n(function tc_11_09_05__004() {\n  var x, y = -37.2e-6\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__013() {\n  var x = NaN, y = 0\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__005() {\n  var x, y = new Function()\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__003() {\n  var x, y = \"undefined\"\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__018() {\n  var x = +0, y = -0\n  assert(x === y)\n})();\n\n(function tc_11_09_05__008() {\n  var x = \"0\", y = 0\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__012() {\n  var x = y = null\n  assert(x === y)\n})();\n\n(function tc_11_09_05__006() {\n  var x = null, y = 0\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__024() {\n  var x = new String(\"abc\")\n  var y = x\n  assert(x === y)\n})();\n\n(function tc_11_09_05__025() {\n  var x = new String(\"abc\")\n  var y = new String(\"abc\")\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__017() {\n  var x = 123.01, y = 0.0123e+4\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__015() {\n  var x = NaN, y = NaN\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__010() {\n  var x = \"abc\", y = new String(\"abc\")\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__022() {\n  var x = false, y = false\n  assert(x === y)\n})();\n\n(function tc_11_09_05__001() {\n  var x, y = null\n  assert(x !== y)\n})();\n\n(function tc_11_09_05__021() {\n  var x = true, y = true\n  assert(x === y)\n})();\n\n(function tc_11_09_05__011() {\n  var x, y\n  assert(x === y)\n})();\n\n(function tc_11_09_05__016() {\n  var x = 123.00, y = 0.0123e+4, eps = .00001\n  assert(x <= y + eps && x >= y - eps)\n})();\n\n(function tc_11_09_05__014() {\n  var x = 0.0, y = NaN\n  assert(x !== y)\n})();\n\n(function tc_11_11__007() {\n  var a = \"\";\n  var b = new Object();\n  assert(!((a && b) !== a))\n})();\n\n(function tc_11_11__001() {\n  var a = true;\n  var b = false;\n  assert(!((a && b) === true))\n})();\n\n(function tc_11_11__019() {\n  var a = false;\n  var b = new Object;\n  assert((a || b) === b)\n})();\n\n(function tc_11_11__022() {\n  var a = 123.456;\n  var b = new Object;\n  assert((a || b) === a)\n})();\n\n(function tc_11_11__017() {\n  var a = false;\n  var b = false;\n  assert((a || b) === false)\n})();\n\n(function tc_11_11__010() {\n  var a = 12345;\n  var b = new Object();\n  assert((a && b) === b)\n})();\n\n(function tc_11_11__005() {\n  var a = true;\n  var b = new Object();\n  assert((a && b) === b)\n})();\n\n(function tc_11_11__027() {\n  var a = new Object;\n  var b = \"who cares, what is this?\";\n  assert((a || b) === a)\n})();\n\n(function tc_11_11__013() {\n  var a = new Object;\n  var b = new Object;\n  assert((a && b) === b)\n})();\n\n(function tc_11_11__002() {\n  var a = true;\n  var b = true;\n  assert((a && b) === true)\n})();\n\n(function tc_11_11__009() {\n  var a = NaN;\n  var b = new Object ();\n  assert ((!a && b) === b);\n})();\n\n(function tc_11_11__008() {\n  var a = 0;\n  var b = new Object();\n  assert((a && b) === 0)\n})();\n\n(function tc_11_11__006() {\n  var a = \"not empty string\";\n  var b = new Object();\n  assert(!((a && b) !== b))\n})();\n\n(function tc_11_11__014() {\n  var a = true;\n  var b = false;\n  assert((a || b) === true)\n})();\n\n(function tc_11_11__004() {\n  var a = false;\n  var b = new Object();\n  assert((a && b) === false)\n})();\n\n(function tc_11_11__024() {\n  var a = \"\";\n  var b = new Object;\n  assert((a || b) === b)\n})();\n\n(function tc_11_11__018() {\n  var a = true;\n  var b = new Object;\n  assert((a || b) === true)\n})();\n\n(function tc_11_11__026() {\n  var a = undefined;\n  var b = new String(\"123\");\n  assert((a || b) === b)\n})();\n\n(function tc_11_11__023() {\n  var a = \"non empty string\";\n  var b = new Object;\n  assert((a || b) === a)\n})();\n\n(function tc_11_11__011() {\n  var a = null;\n  var b = new Object();\n  assert((a && b) === a)\n})();\n\n(function tc_11_11__020() {\n  var a1 = +0;\n  var a2 = -0;\n  var b = new Object;\n  assert(((a1 || b) === b) && ((a2 || b) === b))\n})();\n\n(function tc_11_11__021() {\n  var a = NaN;\n  var b = new Object;\n  assert((a || b) === b)\n})();\n\n(function tc_11_11__003() {\n  var a = false;\n  var b = false;\n  assert(!((a && b) === true))\n})();\n\n(function tc_11_11__025() {\n  var a = null;\n  var b = Number(123.5e5);\n  assert((a || b) === b)\n})();\n\n(function tc_11_11__012() {\n  var a = undefined;\n  var b = new Object();\n  assert((a && b) === a)\n})();\n\n(function tc_11_11__016() {\n  var a = false;\n  var b = true;\n  assert((a || b) === true)\n})();\n\n(function tc_11_11__015() {\n  var a = true;\n  var b = true;\n  assert((a || b) === true)\n})();\n\n(function tc_11_12__004() {\n  var a = 1;\n  var b = 2;\n  var c = 1;\n  var d = 1;\n\n  var e;\n\n  e = (a < b) ? (c = 100) : (d = 10);\n\n  assert(c == 100 && e == 100 && d == 1)\n})();\n\n(function tc_11_12__008() {\n  var cond = 23;\n  var a = [1, 2, 4];\n  var cnt = 0;\n\n  for (var i = (cond < 24) ? 0 in a : 2; i < 10; ++i)\n  {\n    ++cnt;\n  }\n\n  assert(cnt == 9)\n})();\n\n(function tc_11_12__005() {\n  var a = 1;\n  var b = 2;\n  var c = 1;\n  var d = 1;\n\n  var e;\n\n  e = (a > b) ? (c = 100) : (d = 10);\n\n  assert(c == 1 && e == 10 && d == 10)\n})();\n\n(function tc_11_12__003() {\n  var a = 1;\n  var b = 2;\n  var c = 3;\n\n  var d;\n\n  d = a > b ? 5 : b < c ? 10 : 15;\n\n  assert(d == 10)\n})();\n\n(function tc_11_12__012() {\n  var cond = 12;\n  var res;\n\n  res = (cond < 13)\n          ?\n          1\n          :\n          2;\n\n  assert(res == 1)\n})();\n\n(function tc_11_12__001() {\n  var a = 5;\n  var b = 3;\n\n  var c = (a > b) ? 12 : 14;\n\n  assert(c == 12)\n})();\n\n(function tc_11_12__002() {\n  var a = 1;\n  var b = 2;\n  var c = 3;\n\n  var d;\n\n  d = a < b ? b < c ? 5 : 10 : 15;\n\n  assert(d == 5)\n})();\n\n(function tc_11_05_02__017() {\n  assert(isNaN(null / undefined) === true)\n})();\n\n(function tc_11_05_02__036() {\n  assert(isNaN(false / null) === true)\n})();\n\n(function tc_11_05_02__056() {\n  assert(new String(\"2\") / new Number(1) === 2)\n})();\n\n(function tc_11_05_02__045() {\n  assert(isNaN(Number.NaN / 2) === true)\n})();\n\n(function tc_11_05_02__021() {\n  assert(\"6\" / 2 === 3)\n})();\n\n(function tc_11_05_02__028() {\n  assert(true / \"1\" === 1)\n})();\n\n(function tc_11_05_02__009() {\n  assert(false / true === 0)\n})();\n\n(function tc_11_05_02__080() {\n  assert(Number.NEGATIVE_INFINITY / 2 === Number.NEGATIVE_INFINITY)\n})();\n\n(function tc_11_05_02__073() {\n  assert(0 / Number.NEGATIVE_INFINITY === 0)\n})();\n\n(function tc_11_05_02__039() {\n  assert(isNaN(Number.NaN / +0) === true)\n})();\n\n(function tc_11_05_02__031() {\n  assert(isNaN(undefined / \"2\") === true)\n})();\n\n(function tc_11_05_02__058() {\n  assert(new String(\"2\") / new String(\"1\") === 2)\n})();\n\n(function tc_11_05_02__065() {\n  assert(new Boolean(true) / null === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__005() {\n  var a = 0;\n  assert((a = 1) / a === 1)\n})();\n\n(function tc_11_05_02__040() {\n  assert(isNaN(Number.NaN / -0) === true)\n})();\n\n(function tc_11_05_02__074() {\n  assert(0 / Number.POSITIVE_INFINITY === 0)\n})();\n\n(function tc_11_05_02__008() {\n  assert(true / true === 1)\n})();\n\n(function tc_11_05_02__088() {\n  assert(Number.MIN_VALUE / 2 === 0)\n})();\n\n(function tc_11_05_02__051() {\n  assert(false / new Boolean(true) === 0)\n})();\n\n(function tc_11_05_02__075() {\n  assert(Number.POSITIVE_INFINITY / 0 === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__024() {\n  assert(1 / null === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__087() {\n  assert(Number.MAX_VALUE / (-0.5) === Number.NEGATIVE_INFINITY)\n})();\n\n(function tc_11_05_02__019() {\n  assert(2 / true === 2)\n})();\n\n(function tc_11_05_02__067() {\n  assert(isNaN(undefined / new Boolean(true)) === true)\n})();\n\n(function tc_11_05_02__035() {\n  assert(isNaN(undefined / true) === true)\n})();\n\n(function tc_11_05_02__082() {\n  assert(2 / Number.POSITIVE_INFINITY === 0)\n})();\n\n(function tc_11_05_02__002() {\n  var a = 3;\n  assert(6 / a === 2)\n})();\n\n(function tc_11_05_02__059() {\n  assert(isNaN({} / {}) === true)\n})();\n\n(function tc_11_05_02__038() {\n  assert(isNaN(Number.NaN / Number.NaN) === true)\n})();\n\n(function tc_11_05_02__022() {\n  assert(isNaN(\"a\" / 2) === true)\n})();\n\n(function tc_11_05_02__060() {\n  assert(null / new Number(5) === 0)\n})();\n\n(function tc_11_05_02__057() {\n  assert(new String(\"2\") / 1 === 2)\n})();\n\n(function tc_11_05_02__006() {\n  var a = 0;\n  assert(a / (a = 1) === 0)\n})();\n\n(function tc_11_05_02__043() {\n  assert(isNaN(Number.NaN / Number.MAX_VALUE) === true)\n})();\n\n(function tc_11_05_02__025() {\n  assert(null / 1 === 0)\n})();\n\n(function tc_11_05_02__055() {\n  assert(false / new String(\"2\") === 0)\n})();\n\n(function tc_11_05_02__029() {\n  assert(\"2\" / true === 2)\n})();\n\n(function tc_11_05_02__026() {\n  assert(isNaN(1 / undefined) === true)\n})();\n\n(function tc_11_05_02__054() {\n  assert(new Boolean(false) / new String(\"2\") === 0)\n})();\n\n(function tc_11_05_02__044() {\n  assert(isNaN(Number.NaN / Number.MIN_VALUE) === true)\n})();\n\n(function tc_11_05_02__030() {\n  assert(isNaN(\"2\" / undefined) === true)\n})();\n\n(function tc_11_05_02__001() {\n  assert(6 / 3 === 2)\n})();\n\n(function tc_11_05_02__037() {\n  assert(null / true === 0)\n})();\n\n(function tc_11_05_02__081() {\n  assert(2 / Number.NEGATIVE_INFINITY === -0)\n})();\n\n(function tc_11_05_02__032() {\n  assert(\"2\" / null === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__047() {\n  assert(6 / new Number(3) === 2)\n})();\n\n(function tc_11_05_02__048() {\n  assert(new Number(6) / new Number(3) === 2)\n})();\n\n(function tc_11_05_02__089() {\n  assert(2 / Number.MIN_VALUE === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__012() {\n  assert(isNaN(\"a\" / \"3\") === true)\n})();\n\n(function tc_11_05_02__084() {\n  assert(isNaN(0 / 0) === true)\n})();\n\n(function tc_11_05_02__086() {\n  assert(Number.MAX_VALUE / Number.MAX_VALUE === 1)\n})();\n\n(function tc_11_05_02__085() {\n  assert(Number.MAX_VALUE / 0.5 === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__052() {\n  assert(new Boolean(true) / false === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__004() {\n  var a = 6;\n  var b = 3;\n  assert(a / b === 2)\n})();\n\n(function tc_11_05_02__033() {\n  assert(null / \"2\" === 0)\n})();\n\n(function tc_11_05_02__053() {\n  assert(new String(\"2\") / new Boolean(false) === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__014() {\n  assert(isNaN(null / null) === true)\n})();\n\n(function tc_11_05_02__042() {\n  assert(isNaN(Number.NaN / Number.NEGATIVE_INFINITY) === true)\n})();\n\n(function tc_11_05_02__010() {\n  assert(true / false === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__069() {\n  assert(isNaN(new String(\"5\") / undefined) === true)\n})();\n\n(function tc_11_05_02__076() {\n  assert(isNaN(Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY) === true)\n})();\n\n(function tc_11_05_02__023() {\n  assert(isNaN(6 / \"a\") === true)\n})();\n\n(function tc_11_05_02__018() {\n  assert(true / 1 === 1)\n})();\n\n(function tc_11_05_02__079() {\n  assert(isNaN(Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY) === true)\n})();\n\n(function tc_11_05_02__049() {\n  assert(new Number(2) / new Boolean(true) === 2)\n})();\n\n(function tc_11_05_02__062() {\n  assert(new String(\"5\") / null === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__078() {\n  assert(isNaN(Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY) === true)\n})();\n\n(function tc_11_05_02__083() {\n  assert(Number.POSITIVE_INFINITY / 2 === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__034() {\n  assert(isNaN(true / undefined) === true)\n})();\n\n(function tc_11_05_02__068() {\n  assert(isNaN(undefined / new String(\"5\")) === true)\n})();\n\n(function tc_11_05_02__013() {\n  assert(isNaN(\"6\" / \"a\") === true)\n})();\n\n(function tc_11_05_02__090() {\n  assert((1 / 2) / 4 !== 1 / (2 / 4))\n})();\n\n(function tc_11_05_02__072() {\n  assert(Number.NEGATIVE_INFINITY / 0 === Number.NEGATIVE_INFINITY)\n})();\n\n(function tc_11_05_02__016() {\n  assert(isNaN(undefined / null) === true)\n})();\n\n(function tc_11_05_02__003() {\n  var a = 6;\n  assert(a / 3 === 2)\n})();\n\n(function tc_11_05_02__061() {\n  assert(new Number(5) / null === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_02__066() {\n  assert(isNaN(new Boolean(true) / undefined) === true)\n})();\n\n(function tc_11_05_02__077() {\n  assert(isNaN(Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY) === true)\n})();\n\n(function tc_11_05_02__046() {\n  assert(new Number(6) / 3 === 2)\n})();\n\n(function tc_11_05_02__027() {\n  assert(isNaN(undefined / 1) === true)\n})();\n\n(function tc_11_05_02__015() {\n  assert(isNaN(undefined / undefined) === true)\n})();\n\n(function tc_11_05_02__020() {\n  assert(6 / \"2\" === 3)\n})();\n\n(function tc_11_05_02__063() {\n  assert(null / new String(\"5\") === 0)\n})();\n\n(function tc_11_05_02__041() {\n  assert(isNaN(Number.NaN / Number.POSITIVE_INFINITY) === true)\n})();\n\n(function tc_11_05_02__011() {\n  assert(\"6\" / \"3\" === 2)\n})();\n\n(function tc_11_05_02__050() {\n  assert(new Boolean(false) / new Boolean(true) === 0)\n})();\n\n(function tc_11_05_02__070() {\n  assert(isNaN(new Number(5) / undefined) === true)\n})();\n\n(function tc_11_05_02__064() {\n  assert(null / new Boolean(true) === 0)\n})();\n\n(function tc_11_05_02__071() {\n  assert(isNaN(undefined / new Number(5)) === true)\n})();\n\n(function tc_11_05_02__007() {\n  var a = 6;\n  assert(a /\n          3 === 2)\n})();\n\n(function tc_11_05_01__018() {\n  assert(true * 1 === 1)\n})();\n\n(function tc_11_05_01__015() {\n  assert(isNaN(undefined * undefined) === true)\n})();\n\n(function tc_11_05_01__085() {\n  assert(2 * Number.MAX_VALUE === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_01__048() {\n  assert(new Number(1) * new Number(1) === 1)\n})();\n\n(function tc_11_05_01__049() {\n  assert(new Number(1) * new Boolean(true) === 1)\n})();\n\n(function tc_11_05_01__050() {\n  assert(new Boolean(true) * new Boolean(true) === 1)\n})();\n\n(function tc_11_05_01__010() {\n  assert(false * false === 0)\n})();\n\n(function tc_11_05_01__078() {\n  assert(Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY === Number.NEGATIVE_INFINITY)\n})();\n\n(function tc_11_05_01__038() {\n  assert(isNaN(Number.NaN * Number.NaN) === true)\n})();\n\n(function tc_11_05_01__064() {\n  assert(null * new Boolean(true) === 0)\n})();\n\n(function tc_11_05_01__067() {\n  assert(isNaN(undefined * new Boolean(true)) === true)\n})();\n\n(function tc_11_05_01__058() {\n  assert(new String(\"2\") * new String(\"1\") === 2)\n})();\n\n(function tc_11_05_01__005() {\n  var a = 0;\n  assert((a = 1) * a === 1)\n})();\n\n(function tc_11_05_01__001() {\n  assert(2 * 3 === 6)\n})();\n\n(function tc_11_05_01__087() {\n  assert(Number.MAX_VALUE * (-1.5) === Number.NEGATIVE_INFINITY)\n})();\n\n(function tc_11_05_01__083() {\n  assert(Number.POSITIVE_INFINITY * 1 === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_01__069() {\n  assert(isNaN(new String(\"1\") * undefined) === true)\n})();\n\n(function tc_11_05_01__074() {\n  assert(isNaN(0 * Number.POSITIVE_INFINITY) === true)\n})();\n\n(function tc_11_05_01__029() {\n  assert(\"1\" * true === 1)\n})();\n\n(function tc_11_05_01__034() {\n  assert(isNaN(true * undefined) === true)\n})();\n\n(function tc_11_05_01__068() {\n  assert(isNaN(undefined * new String(\"1\")) === true)\n})();\n\n(function tc_11_05_01__061() {\n  assert(new Number(2) * null === 0)\n})();\n\n(function tc_11_05_01__077() {\n  assert(Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY === Number.NEGATIVE_INFINITY)\n})();\n\n(function tc_11_05_01__080() {\n  assert(Number.NEGATIVE_INFINITY * 1 === Number.NEGATIVE_INFINITY)\n})();\n\n(function tc_11_05_01__022() {\n  assert(isNaN(\"a\" * 1) === true)\n})();\n\n(function tc_11_05_01__019() {\n  assert(1 * true === 1)\n})();\n\n(function tc_11_05_01__006() {\n  var a = 0;\n  assert(a * (a = 1) === 0)\n})();\n\n(function tc_11_05_01__054() {\n  assert(new String(\"2\") * new Boolean(true) === 2)\n})();\n\n(function tc_11_05_01__013() {\n  assert(isNaN(\"1\" * \"a\") === true)\n})();\n\n(function tc_11_05_01__021() {\n  assert(\"2\" * 3 === 6)\n})();\n\n(function tc_11_05_01__063() {\n  assert(null * new String(\"2\") === 0)\n})();\n\n(function tc_11_05_01__035() {\n  assert(isNaN(undefined * true) === true)\n})();\n\n(function tc_11_05_01__056() {\n  assert(new String(\"2\") * new Number(1) === 2)\n})();\n\n(function tc_11_05_01__031() {\n  assert(isNaN(undefined * \"1\") === true)\n})();\n\n(function tc_11_05_01__084() {\n  assert(Number.MAX_VALUE * 2 === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_01__025() {\n  assert(null * 1 === 0)\n})();\n\n(function tc_11_05_01__042() {\n  assert(isNaN(Number.NaN * Number.NEGATIVE_INFINITY) === true)\n})();\n\n(function tc_11_05_01__079() {\n  assert(Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_01__040() {\n  assert(isNaN(Number.NaN * -0) === true)\n})();\n\n(function tc_11_05_01__007() {\n  var a = 2;\n  assert(a *\n          3 === 6)\n})();\n\n(function tc_11_05_01__070() {\n  assert(isNaN(new Number(1) * undefined) === true)\n})();\n\n(function tc_11_05_01__055() {\n  assert(new String(\"2\") * true === 2)\n})();\n\n(function tc_11_05_01__041() {\n  assert(isNaN(Number.NaN * Number.POSITIVE_INFINITY) === true)\n})();\n\n(function tc_11_05_01__003() {\n  var a = 3;\n  assert(a * 2 === 6)\n})();\n\n(function tc_11_05_01__014() {\n  assert(null * null === 0)\n})();\n\n(function tc_11_05_01__073() {\n  assert(isNaN(0 * Number.NEGATIVE_INFINITY) === true)\n})();\n\n(function tc_11_05_01__002() {\n  var a = 3;\n  assert(2 * a === 6)\n})();\n\n(function tc_11_05_01__004() {\n  var a = 3;\n  var b = 2;\n  assert(a * b === 6)\n})();\n\n(function tc_11_05_01__046() {\n  assert(1 * new Number(1) === 1)\n})();\n\n(function tc_11_05_01__026() {\n  assert(isNaN(1 * undefined) === true)\n})();\n\n(function tc_11_05_01__008() {\n  assert(true * true === 1)\n})();\n\n(function tc_11_05_01__060() {\n  assert(null * new Number(2) === 0)\n})();\n\n(function tc_11_05_01__028() {\n  assert(true * \"1\" === 1)\n})();\n\n(function tc_11_05_01__089() {\n  assert(0.1 * Number.MIN_VALUE === +0)\n})();\n\n(function tc_11_05_01__062() {\n  assert(new String(\"2\") * null === 0)\n})();\n\n(function tc_11_05_01__053() {\n  assert(new Boolean(true) * new String(\"2\") === 2)\n})();\n\n(function tc_11_05_01__037() {\n  assert(null * true === 0)\n})();\n\n(function tc_11_05_01__036() {\n  assert(true * null === 0)\n})();\n\n(function tc_11_05_01__047() {\n  assert(new Number(1) * 1 === 1)\n})();\n\n(function tc_11_05_01__033() {\n  assert(null * \"1\" === 0)\n})();\n\n(function tc_11_05_01__009() {\n  assert(true * false === 0)\n})();\n\n(function tc_11_05_01__032() {\n  assert(\"1\" * null === 0)\n})();\n\n(function tc_11_05_01__043() {\n  assert(isNaN(Number.NaN * Number.MAX_VALUE) === true)\n})();\n\n(function tc_11_05_01__051() {\n  assert(true * new Boolean(true) === 1)\n})();\n\n(function tc_11_05_01__017() {\n  assert(isNaN(null * undefined) === true)\n})();\n\n(function tc_11_05_01__024() {\n  assert(1 * null === 0)\n})();\n\n(function tc_11_05_01__012() {\n  assert(isNaN(\"a\" * \"1\") === true)\n})();\n\n(function tc_11_05_01__066() {\n  assert(isNaN(new Boolean(true) * undefined) === true)\n})();\n\n(function tc_11_05_01__076() {\n  assert(Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_01__081() {\n  assert((-1) * Number.NEGATIVE_INFINITY === Number.POSITIVE_INFINITY)\n})();\n\n(function tc_11_05_01__086() {\n  assert((-1.5) * Number.MAX_VALUE === Number.NEGATIVE_INFINITY)\n})();\n\n(function tc_11_05_01__090() {\n  assert((Number.MAX_VALUE * 1.1) * 0.9 !== Number.MAX_VALUE * (1.1 * 0.9))\n})();\n\n(function tc_11_05_01__020() {\n  assert(2 * \"3\" === 6)\n})();\n\n(function tc_11_05_01__088() {\n  assert(Number.MIN_VALUE * (-0.5) === -0)\n})();\n\n(function tc_11_05_01__016() {\n  assert(isNaN(undefined * null) === true)\n})();\n\n(function tc_11_05_01__075() {\n  assert(isNaN(Number.POSITIVE_INFINITY * 0) === true)\n})();\n\n(function tc_11_05_01__082() {\n  assert((-1) * Number.POSITIVE_INFINITY === Number.NEGATIVE_INFINITY)\n})();\n\n(function tc_11_05_01__059() {\n  assert(isNaN({} * {}) === true)\n})();\n\n(function tc_11_05_01__023() {\n  assert(isNaN(1 * \"a\") === true)\n})();\n\n(function tc_11_05_01__057() {\n  assert(new String(\"2\") * 1 === 2)\n})();\n\n(function tc_11_05_01__052() {\n  assert(new Boolean(true) * true === 1)\n})();\n\n(function tc_11_05_01__072() {\n  assert(isNaN(Number.NEGATIVE_INFINITY * 0) === true)\n})();\n\n(function tc_11_05_01__039() {\n  assert(isNaN(Number.NaN * +0) === true)\n})();\n\n(function tc_11_05_01__045() {\n  assert(isNaN(Number.NaN * 1) === true)\n})();\n\n(function tc_11_05_01__065() {\n  assert(new Boolean(true) * null === 0)\n})();\n\n(function tc_11_05_01__011() {\n  assert(\"2\" * \"3\" === 6)\n})();\n\n(function tc_11_05_01__027() {\n  assert(isNaN(undefined * 1) === true)\n})();\n\n(function tc_11_05_01__044() {\n  assert(isNaN(Number.NaN * Number.MIN_VALUE) === true)\n})();\n\n(function tc_11_05_01__071() {\n  assert(isNaN(undefined * new Number(1)))\n})();\n\n(function tc_11_05_01__030() {\n  assert(isNaN(\"1\" * undefined) === true)\n})();\n\n(function tc_11_05_03__005() {\n  assert(100 % -3 > 0)\n})();\n\n(function tc_11_05_03__022() {\n  var n = 100;\n  var d = new Boolean(false);\n  assert(isNaN(n % d))\n})();\n\n(function tc_11_05_03__013() {\n  assert(isNaN(-Infinity % Infinity))\n})();\n\n(function tc_11_05_03__018() {\n  var n = 105;\n  var d = 10;\n  assert(n % d === 5)\n})();\n\n(function tc_11_05_03__028() {\n  assert(isNaN(1 % null))\n})();\n\n(function tc_11_05_03__002() {\n  assert(isNaN(100 % NaN))\n})();\n\n(function tc_11_05_03__020() {\n  var n = 550;\n  var d = 5.5;\n  assert(n % d === 0)\n})();\n\n(function tc_11_05_03__026() {\n  assert(isNaN(undefined % 1))\n})();\n\n(function tc_11_05_03__007() {\n  assert(isNaN(Infinity % 3))\n})();\n\n(function tc_11_05_03__027() {\n  assert(null % 1 === +0)\n})();\n\n(function tc_11_05_03__030() {\n  var n = new Boolean(true);\n  var d = new String(\"\");\n  assert(isNaN(n % d))\n})();\n\n(function tc_11_05_03__015() {\n  assert(+0 % 5 === +0)\n})();\n\n(function tc_11_05_03__012() {\n  assert(0 % 5 === 0)\n})();\n\n(function tc_11_05_03__023() {\n  var n = \"100\";\n  var d = \"\";\n  assert(isNaN(n % d))\n})();\n\n(function tc_11_05_03__003() {\n  assert(isNaN(NaN % NaN))\n})();\n\n(function tc_11_05_03__010() {\n  assert(isNaN(Infinity % 0))\n})();\n\n(function tc_11_05_03__024() {\n  var n = {\n    valueOf: function () {\n      return 109.5;\n    }\n  }\n  var d = {\n    valueOf: function () {\n      return 5.5;\n    }\n  }\n  assert(n % d === 5)\n})();\n\n(function tc_11_05_03__029() {\n  var n = new String(\"100\");\n  var d = new String(\"10\");\n  assert(n % d === 0)\n})();\n\n(function tc_11_05_03__019() {\n  var n = 109.5;\n  var d = 5.5;\n  assert(n % d === 5)\n})();\n\n(function tc_11_05_03__008() {\n  assert(isNaN(-Infinity % 3))\n})();\n\n(function tc_11_05_03__025() {\n  var n = {\n    valueOf: function () {\n      return -Infinity;\n    }\n  }\n  var d = {\n    valueOf: function () {\n      return 0;\n    }\n  }\n  assert(isNaN(n % d))\n})();\n\n(function tc_11_05_03__021() {\n  var n = 100;\n  var d = new Boolean(true);\n  assert(n % d === 0)\n})();\n\n(function tc_11_05_03__006() {\n  assert(-100 % -3 < 0)\n})();\n\n(function tc_11_05_03__016() {\n  var n = 100;\n  var d = 10;\n  assert(n % d === 0)\n})();\n\n(function tc_11_05_03__009() {\n  assert(isNaN(5 % 0))\n})();\n\n(function tc_11_05_03__001() {\n  assert(isNaN(NaN % 1))\n})();\n\n(function tc_11_05_03__017() {\n  var n = 100.5;\n  var d = 10;\n  assert(n % d === 0.5)\n})();\n\n(function tc_11_05_03__011() {\n  assert(5 % Infinity === 5)\n})();\n\n(function tc_11_05_03__004() {\n  assert(-100 % 3 < 0)\n})();\n\n(function tc_11_05_03__014() {\n  assert(-0 % 5 === -0)\n})();\n\n(function tc_11_03_02__006() {\n  var a = true;\n  var b = false;\n  assert((a-- === 1) && (b-- === +0) && (a === 0) && (b === -1));\n})();\n\n(function tc_11_03_02__010() {\n  var a = \"1\";\n  assert((a-- === 1) && (a === 0));\n})();\n\n(function tc_11_03_02__015() {\n  var a = \"Infinity\";\n  assert((a-- === Infinity) && (a === Infinity));\n})();\n\n(function tc_11_03_02__013() {\n  var a = \"\";\n  assert((a-- === 0) && (a === -1));\n})();\n\n(function tc_11_03_02__016() {\n  var a = \"0xa\";\n  assert((a-- === 0xa) && (a === 9));\n})();\n\n(function tc_11_03_02__009() {\n  var a = undefined;\n  assert(isNaN(a--) && isNaN(a));\n})();\n\n(function tc_11_03_02__012() {\n  var a = \"1e3\";\n  assert((a-- === 1e3) && (a === 999));\n})();\n\n(function tc_11_03_02__011() {\n  var a = \"blah\";\n  assert(isNaN(a--) && isNaN(a));\n})();\n\n(function tc_11_03_02__014() {\n  var a = \"  \";\n\n  assert((a-- === 0) && (a === -1));\n\n})();\n\n(function tc_11_03_02__008() {\n  var a = null;\n  assert((a-- == +0) && (a === -1));\n})();\n\n(function tc_11_03_02__005() {\n  var a = 1;\n  assert((a-- === 1) && (a === 0));\n})();\n\n(function tc_11_03_02__007() {\n  var a = {\n    valueOf: function () {\n      return 1;\n    }\n  }\n\n  assert((a-- === 1) && (a === 0));\n\n})();\n\n(function tc_11_03_01__007() {\n  var a = {\n    valueOf: function () {\n      return 1;\n    }\n  }\n\n  assert((a++ === 1) && (a === 2));\n})();\n\n(function tc_11_03_01__016() {\n  var a = \"0xa\";\n  assert((a++ === 0xa) && (a === 0xb));\n})();\n\n(function tc_11_03_01__014() {\n  var a = \"  \";\n  assert((a++ === 0) && (a === 1));\n})();\n\n(function tc_11_03_01__015() {\n  var a = \"Infinity\";\n\n  assert((a++ === Infinity) && (a === Infinity));\n})();\n\n(function tc_11_03_01__009() {\n  var a = undefined;\n\n  assert(isNaN(a++) && isNaN(a));\n})();\n\n(function tc_11_03_01__005() {\n  var a = 1;\n\n  assert((a++ === 1) && (a === 2));\n})();\n\n(function tc_11_03_01__012() {\n  var a = \"1e3\";\n\n  assert((a++ === 1e3) && (a === 1001));\n\n})();\n\n(function tc_11_03_01__008() {\n  var a = null;\n\n  assert((a++ == +0) && (a === 1));\n})();\n\n(function tc_11_03_01__006() {\n  var a = true;\n  var b = false;\n\n  assert((a++ === 1) && (b++ === +0) && (a === 2) && (b === 1));\n})();\n\n(function tc_11_03_01__011() {\n  var a = \"blah\";\n  assert ( isNaN(a++) && isNaN(a) );\n})();\n\n(function tc_11_03_01__013() {\n  var a = \"\";\n  assert((a++ === 0) && (a === 1));\n})();\n\n(function tc_11_03_01__010() {\n  var a = \"1\";\n\n  assert((a++ === 1) && (a === 2));\n})();\n\n(function tc_11_08_07__008() {\n  var a = {name: 'Masha', 'age': 10}\n  var c = 'Masha' in a\n  assert(!c)\n})();\n\n(function tc_11_08_07__005() {\n  var a = {name: 'Masha', 'age': 10}\n  var c = 'name' in a\n  assert(c)\n})();\n\n(function tc_11_08_07__010() {\n  var a = new String('example');\n  assert('toString' in a);\n})();\n\n(function tc_11_08_07__007() {\n  var a = {name: 'Masha', 'age': 10}\n  var c = \"age\" in a\n  assert(c)\n})();\n\n(function tc_11_08_07__009() {\n  var a = {name: 'Masha', 'age': 10}\n  var c = \"toString\" in a\n  assert(c)\n})();\n\n(function tc_11_08_07__014() {\n  var c = 'PI' in Math\n  assert(c)\n})();\n\n(function tc_11_08_07__011() {\n  var a = new String('example')\n  var c = 'length' in a\n  assert(c)\n})();\n\n(function tc_11_08_07__013() {\n  var a = new String('example')\n  var c = 'toString' in a\n  assert(c)\n})();\n\n(function tc_11_08_07__001() {\n  var a = [1, 2, 3, 4, 5, 6]\n  var c = 0 in a\n  assert(c)\n})();\n\n(function tc_11_08_07__004() {\n  var a = [1, 2, 3, 4, 5, 6]\n  var c = '0' in a\n  assert(c)\n})();\n\n(function tc_11_08_07__003() {\n  var a = [1, 2, 3, 4, 5, 6]\n  var c = 6 in a\n  assert(!c)\n})();\n\n(function tc_11_08_07__002() {\n  var a = [1, 2, 3, 4, 5, 6]\n  var c = 5 in a\n  assert(c)\n})();\n\n(function tc_11_08_07__012() {\n  var a = new String('example');\n  assert(!('toString.' in a));\n})();\n\n(function tc_11_08_01__006() {\n  var a = false, b = true\n  var c = a < b\n  assert(c)\n})();\n\n(function tc_11_08_01__003() {\n  var a = \"abc\", b = \"abd\"\n  var c = a < b\n  assert(c)\n})();\n\n(function tc_11_08_01__002() {\n  var a = 7, b = 6\n  var c = a < b\n  assert(!c)\n})();\n\n(function tc_11_08_01__001() {\n  var a = 5, b = 7\n  var c = a < b\n  assert(c)\n})();\n\n(function tc_11_08_01__005() {\n  var a = null, b = undefined\n  var c = a < b\n  assert(!c)\n})();\n\n(function tc_11_08_01__004() {\n  var a = \"abd\", b = \"abc\"\n  var c = a < b\n  assert(!c)\n})();\n\n(function tc_11_08_04__006() {\n  var a = false, b = true\n  var c = a >= b\n  assert(!c)\n})();\n\n(function tc_11_08_04__005() {\n  var a = null, b = undefined\n  var c = a >= b\n  assert(!c)\n})();\n\n(function tc_11_08_04__003() {\n  var a = \"zbda\", b = \"zbd\"\n  var c = a >= b\n  assert(c)\n})();\n\n(function tc_11_08_04__001() {\n  var a = 700000000000000000000, b = 500000000000000000000\n  var c = a >= b\n  assert(c)\n})();\n\n(function tc_11_08_04__008() {\n  var a = 1.2, b = '1.2'\n  var c = a >= b\n  assert(c)\n})();\n\n(function tc_11_08_04__002() {\n  var a = 6.233, b = 6.234\n  var c = a >= b\n  assert(!c)\n})();\n\n(function tc_11_08_04__009() {\n  var a = 6.233, b = 6.233\n  var c = a >= b\n  assert(c)\n})();\n\n(function tc_11_08_04__004() {\n  var a = \"aaaaa1\", b = \"aaaaaz\"\n  var c = a >= b\n  assert(!c)\n})();\n\n(function tc_11_08_04__007() {\n  var a = false, b = false\n  var c = a >= b\n  assert(c)\n})();\n\n(function tc_11_08_03__010() {\n  var a = 2, b = function () {\n  }\n  var c = a <= b\n  assert(!c)\n})();\n\n(function tc_11_08_03__001() {\n  var a = 5, b = 7\n  var c = a <= b\n  assert(c)\n})();\n\n(function tc_11_08_03__008() {\n  var a = \"abd\", b = \"abd\"\n  var c = a <= b\n  assert(c)\n})();\n\n(function tc_11_08_03__005() {\n  var a = null, b = undefined\n  var c = a <= b\n  assert(!c)\n})();\n\n(function tc_11_08_03__007() {\n  var a = 7, b = 7\n  var c = a <= b\n  assert(c)\n})();\n\n(function tc_11_08_03__002() {\n  var a = 7, b = 6\n  var c = a <= b\n  assert(!c)\n})();\n\n(function tc_11_08_03__011() {\n  var a = 2, b = 'sdafg'\n  var c = a <= b\n  assert(!c)\n})();\n\n(function tc_11_08_03__009() {\n  var a = true, b = true\n  var c = a <= b\n  assert(c)\n})();\n\n(function tc_11_08_03__003() {\n  var a = \"abc\", b = \"abd\"\n  var c = a <= b\n  assert(c)\n})();\n\n(function tc_11_08_03__004() {\n  var a = \"abd\", b = \"abc\"\n  var c = a <= b\n  assert(!c)\n})();\n\n(function tc_11_08_03__006() {\n  var a = false, b = true\n  var c = a <= b\n  assert(c)\n})();\n\n(function tc_11_08_06__007() {\n  var a = new Object()\n  var c = a instanceof Object\n  assert(c)\n})();\n\n(function tc_11_08_06__005() {\n  var a = new String('abcd')\n  var c = a instanceof String\n  assert(c)\n})();\n\n(function tc_11_08_06__003() {\n  var a = new Number(2)\n  var c = a instanceof Number\n  assert(c)\n})();\n\n(function tc_11_08_06__002() {\n  var a = Number(2)\n  var c = a instanceof Number\n  assert(!c)\n})();\n\n(function tc_11_08_06__001() {\n  var a = 2\n  var c = a instanceof Number\n  assert(!c)\n})();\n\n(function tc_11_08_06__008() {\n  var a = null;\n  var c = a instanceof Object;\n  assert (!c);\n})();\n\n(function tc_11_08_06__004() {\n  var a = 'abcd'\n  var c = a instanceof String\n  assert(!c)\n})();\n\n(function tc_11_08_06__006() {\n  var a = function () {\n  }\n  var b = new a()\n  var c = b instanceof a\n  assert(c)\n})();\n\n(function tc_11_08_02__005() {\n  var a = null, b = undefined\n  var c = a > b\n  assert(!c)\n})();\n\n(function tc_11_08_02__004() {\n  var a = \"aaaaa1\", b = \"aaaaaz\"\n  var c = a > b\n  assert(!c)\n})();\n\n(function tc_11_08_02__003() {\n  var a = \"zbda\", b = \"zbd\"\n  var c = a > b\n  assert(c)\n})();\n\n(function tc_11_08_02__006() {\n  var a = false, b = true\n  var c = a > b\n  assert(!c)\n})();\n\n(function tc_11_08_02__001() {\n  var a = 700000000000000000000, b = 500000000000000000000\n  var c = a > b\n  assert(c)\n})();\n\n(function tc_11_08_02__002() {\n  var a = 6.233, b = 6.234\n  var c = a > b\n  assert(!c)\n})();\n"
  },
  {
    "path": "tests/jerry/test_suite_12.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_12_02__007() {\n  var a = 'undefined';\n\n  assert(a === 'undefined');\n})();\n\n(function tc_12_02__019() {\n  var\n          a = 2\n\n  assert(a === 2);\n})();\n\n(function tc_12_02__022() {\n  var a = 1;\n  var b = a;\n\n  assert(a === b);\n})();\n\n(function tc_12_02__003() {\n  var a = null;\n  assert(a === null);\n})();\n\n(function tc_12_02__001() {\n  var a;\n  assert(a === undefined);\n})();\n\n(function tc_12_02__006() {\n  var a = 'undefined';\n\n  assert(a === \"undefined\");\n})();\n\n(function tc_12_02__014() {\n  var\n\n          $a = 2;\n  assert($a === 2);\n})();\n\n(function tc_12_02__010() {\n  var a, b = 3.14, c;\n\n  assert(a === undefined && b === 3.14 && c === undefined)\n})();\n\n(function tc_12_02__004() {\n  var a = undefined;\n\n  assert(a === undefined);\n})();\n\n(function tc_12_02__005() {\n  var a = \"undefined\";\n\n  assert(a === \"undefined\");\n})();\n\n(function tc_12_02__009() {\n  var a = 1,\n          b,\n          c = 4;\n\n  b = a + c;\n\n  assert(b === 5);\n})();\n\n(function tc_12_02__011() {\n  var a, b, c;\n\n  assert(a === undefined && b === undefined && c === undefined);\n})();\n\n(function tc_12_02__002() {\n  var a = 12345;\n  assert(a === 12345);\n})();\n\n(function tc_12_02__020() {\n  var a = RegExp();\n\n  assert(a instanceof RegExp);\n})();\n\n(function tc_12_02__015() {\n  var a = 12 + \"abc\";\n\n  assert(a === \"12abc\");\n})();\n\n(function tc_12_02__018() {\n  var a = [];\n\n  assert(a instanceof Array && a.length === 0);\n})();\n\n(function tc_12_02__016() {\n  var a = {};\n  var b = typeof (a);\n\n  assert(b === \"object\" && b === typeof (Object()) && b === typeof ({}));\n})();\n\n(function tc_12_02__008() {\n  var a = false, b = true;\n\n  assert(a === false && b === true);\n})();\n\n(function tc_12_02__013() {\n  var\n          _a$1 = 2;\n\n  assert(_a$1 === 2);\n})();\n\n(function tc_12_02__012() {\n  var\n          _a1 = 2;\n\n  assert(_a1 === 2);\n})();\n\n(function tc_12_02__021() {\n  var a = new Date();\n\n  assert(a instanceof Date);\n})();\n\n(function tc_12_02_01__002() {\n  var arguments = 2;\n  assert(arguments === 2 && typeof (arguments) === \"number\");\n})();\n\n(function tc_12_02_01__001() {\n  var eval = 1;\n  assert(eval === 1 && typeof (eval) === \"number\");\n})();\n\n(function tc_12_12__006() {\n  var x = 0;\n  lablemark:\n          if (x < 6) {\n    ++x;\n    break lablemark;\n  }\n\n  assert(x !== 6);\n})();\n\n(function tc_12_12__010() {\n  var x = 0;\n  for (i = 0; i < 10; ++i) {\n    lablemark:\n            for (j = 0; j < 10; ++j) {\n      for (k = 0; k < 10; ++k) {\n        ++x;\n        continue lablemark;\n      }\n    }\n  }\n\n  assert(x == 100)\n})();\n\n(function tc_12_12__007() {\n  var x = 0;\n  for (i = 0; i < 10; ++i) {\n    for (j = 0; j < 10; ++j) {\n      lablemark:\n              for (k = 0; k < 10; ++k) {\n        ++x;\n        break lablemark;\n      }\n    }\n  }\n\n  assert(x == 100)\n})();\n\n(function tc_12_12__003() {\n  switchMark:\n          switch (1) {\n    case 0:\n      break;\n    case 1:\n      break switchMark;\n    case 2:\n      assert(false);\n  }\n})();\n\n(function tc_12_12__009() {\n  var x = 0;\n  lablemark:\n          for (i = 0; i < 10; ++i) {\n    for (j = 0; j < 10; ++j) {\n      for (k = 0; k < 10; ++k) {\n        ++x;\n        break lablemark;\n      }\n    }\n  }\n\n  assert(x == 1)\n})();\n\n(function tc_12_12__008() {\n  var x = 0;\n  for (i = 0; i < 10; ++i) {\n    lablemark:\n            for (j = 0; j < 10; ++j) {\n      for (k = 0; k < 10; ++k) {\n        ++x;\n        break lablemark;\n      }\n    }\n  }\n\n  assert(x == 10)\n})();\n\n(function tc_12_12__005() {\n  whileMark:\n          for (i = 0; i < 10; ++i) {\n    continue whileMark;\n    assert(false);\n  }\n})();\n\n(function tc_12_12__001() {\n  loop:\n          while (true) {\n    break loop;\n  }\n})();\n\n(function tc_12_12__004() {\n  var i = 0;\n\n  whileMark:\n          while (i < 10) {\n    ++i;\n    continue whileMark;\n    assert(false);\n  }\n})();\n\n(function tc_12_12__002() {\n  loop:\n          while (true) {\n    do {\n      for (; true; ) {\n        break loop;\n      }\n    } while (true);\n  }\n})();\n\n(function tc_12_03__003() {\n  var a=\"ab;c\"\n  ;\n  ;\n  assert (a === 'ab;c');\n})();\n\n(function tc_12_03__001() {\n  function test()\n  {\n    ;\n    return 1;;;;;;\n  }\n\n  test();\n})();\n\n(function tc_12_03__002() {\n  function test()\n  {\n   ;;;;;;\n   return 1\n  }\n\n  test();\n})();\n\n(function tc_12_05__001() {\n  function test()\n  {\n    if (true) {\n      return 1;\n    }\n    assert(false);\n  }\n\n  test();\n})();\n\n(function tc_12_05__007() {\n  var a = 1, b = 2;\n  var c;\n  if (a === 1)\n  {\n    if (b === 1)\n      c = 3;\n  }\n  else\n  if (b === 2)\n    c = 5;\n  else\n    c = 7;\n\n  assert(c === undefined);\n})();\n\n(function tc_12_05__008() {\n  var a = 1, b = 2;\n  var c;\n  if (a === 1)\n    if (b === 1)\n      c = 3;\n    else\n    if (b === 2)\n      c = 5;\n    else\n      c = 7;\n\n  assert(c === 5);\n\n})();\n\n(function tc_12_05__004() {\n  function test()\n  {\n    if (false)\n      assert(false);\n    else {\n      return 1;\n    }\n  }\n\n  test();\n})();\n\n(function tc_12_05__006() {\n  var a = 'w\\0', b = 'w\\0';\n  assert(a === b);\n})();\n\n(function tc_12_05__002() {\n  function test()\n  {\n    if (false) {\n      assert(false);\n    }\n  }\n\n  test();\n})();\n\n(function tc_12_05__005() {\n  function test()\n  {\n      if(true);\n  }\n\n  test();\n})();\n\n(function tc_12_05__003() {\n  function test()\n  {\n    if (true)\n    {\n      return 1;\n    }\n    else\n      assert(false);\n  }\n\n  test();\n})();\n\n(function tc_12_06_03__008() {\n  var sum = 1;\n\n  for (var i = 0; i < 10; i++, sum *= i)\n    ;\n\n  assert(sum === 3628800);\n})();\n\n(function tc_12_06_03__010() {\n  for\n          (\n                  var i = 0\n                  ;\n                  i < 10\n                  ;\n                  i++\n                  )\n  {\n    i++;\n  }\n\n  assert(i == 10);\n})();\n\n(function tc_12_06_03__005() {\n  var i = 0;\n  for (; ; )\n  {\n    if (i++ === 100)\n      break;\n  }\n})();\n\n(function tc_12_06_03__004() {\n  var i;\n\n  for (i = 1; i < 20; )\n    i *= 2;\n\n  assert(i === 32);\n})();\n\n(function tc_12_06_03__011() {\n  var i;\n\n  function test()\n  {\n    for (i = 0; i < 10; i++)\n    {\n      if (i === 4)\n        return 1;\n    }\n\n    return 0;\n  }\n\n  var r = test();\n\n  assert(r === 1 && i === 4);\n})();\n\n(function tc_12_06_03__009() {\n  var init;\n\n  for (init = (129 - 8) / 11; init != 11; )\n  {\n    init = 33;\n  }\n\n  assert(init == 11);\n})();\n\n(function tc_12_06_03__001() {\n  var cnt = 1;\n\n  for (var i = 0; i < 10; i++)\n    cnt++;\n\n  assert(cnt === 11 && i === 10);\n})();\n\n(function tc_12_06_03__006() {\n  var sum = 0;\n  for (var i = 1; i <= 10; i++)\n  {\n    for (var j = 1; j <= 5; j++)\n    {\n      sum += i * j;\n    }\n  }\n\n  assert(sum === 825);\n})();\n\n(function tc_12_06_03__007() {\n  var sum = 0;\n  for (var i = 1, j = 1, k = 1; i + j + k <= 100; i++, j += 2, k += 3)\n  {\n    sum += i + j + k;\n  }\n\n  assert(sum == 867);\n})();\n\n(function tc_12_06_03__003() {\n  var i;\n\n  for (i = 0; ; i += 5)\n  {\n    if (i === 100)\n      break;\n  }\n})();\n\n(function tc_12_06_03__002() {\n  var cond = 1.999;\n  var cnt = 0;\n\n  for (; cond < 10.333; cond += 1.121)\n    cnt++;\n\n  assert(cnt == 8);\n})();\n\n(function tc_12_06_04__007() {\n  var o = {a: 1, b: 2, c: 3, d: 4, e: 5};\n\n  function test()\n  {\n    for (var p in o)\n    {\n      if (p === 'c')\n        return 1;\n\n      o[p] += 4;\n    }\n    return 0;\n  }\n\n  var r = test();\n\n  assert(((o.a === 5 && o.b === 6 && o.c === 3) ||\n          (o.c === 3 && o.d === 8 && o.e === 9)) && r === 1);\n})();\n\n(function tc_12_06_04__006() {\n  var o = {a: 1, b: 2, c: 3};\n\n  for\n          (\n                  var\n                  p in o\n                  )\n  {\n    o[p] += 4;\n  }\n\n  assert(o.a === 5 && o.b === 6 && o.c === 7);\n})();\n\n(function tc_12_06_04__002() {\n  var a = new Array(1, 2, 3, 4, 5, 6, 7);\n  a.eight = 8;\n\n  var p;\n  for (p in a)\n  {\n    a[p] += 1;\n  }\n\n  assert(a[0] === 2 && a[1] === 3 && a[2] === 4 && a[3] === 5 &&\n          a[4] === 6 && a[5] === 7 && a[6] === 8 && a['eight'] === 9);\n})();\n\n(function tc_12_06_04__005() {\n  var b = {basep: \"base\"};\n\n  function dConstr()\n  {\n    this.derivedp = \"derived\";\n  }\n  dConstr.prototype = b;\n\n  var d = new dConstr();\n\n  for (var p in d)\n  {\n    d[p] += \"A\";\n  }\n\n  assert(d.basep === \"baseA\" && d.derivedp === \"derivedA\");\n})();\n\n(function tc_12_06_04__004() {\n  var a;\n\n  for (var p in a)\n  {\n    assert(false);\n  }\n})();\n\n(function tc_12_06_04__001() {\n  var o = {a: 1, b: 2, c: 3};\n\n  for (var p in o)\n  {\n    o[p] += 4;\n  }\n\n  assert(o.a === 5 && o.b === 6 && o.c === 7);\n})();\n\n(function tc_12_06_04__003() {\n  var a = null;\n\n  for (var p in a)\n  {\n    assert(false);\n  }\n})();\n\n(function tc_12_06_01__002() {\n  var cnt = 1;\n  do\n  {\n    cnt++;\n    if (cnt === 42) {\n      break;\n    }\n  } while (true);\n})();\n\n(function tc_12_06_01__010() {\n  var cnt = 0;\n\n  function test()\n  {\n    do\n    {\n      cnt++;\n      if (cnt === 8)\n        return 1;\n    }\n    while (cnt < 10);\n\n    return 0;\n  }\n\n  var r = test();\n\n  assert(cnt === 8 && r === 1);\n})();\n\n(function tc_12_06_01__009() {\n  var cnt = 0;\n  do\n  {\n    cnt++;\n  }\n  while\n          (cnt < 10\n                  );\n\n  assert(cnt === 10);\n})();\n\n(function tc_12_06_01__006() {\n  var cnt = 1;\n  do\n  {\n    cnt++;\n  }\n  while (false);\n\n  assert(cnt === 2);\n})();\n\n(function tc_12_06_01__001() {\n  var cnt = 1;\n  do\n    cnt++;\n  while (cnt < 10);\n\n  assert(cnt === 10);\n})();\n\n(function tc_12_06_01__007() {\n  var cnt = 1;\n  do\n  {\n    cnt++;\n  }\n  while (!\"string\");\n\n  assert(cnt === 2);\n})();\n\n(function tc_12_06_01__003() {\n  var cnt = 1;\n  do {\n    cnt++;\n\n    if (cnt === 10)\n    {\n      break;\n    }\n  }\n  while (0, 1);\n})();\n\n(function tc_12_06_01__005() {\n  var x = 1 / 3;\n  do\n  {\n    x = 1;\n  }\n  while (x === 3 / 9);\n  assert (x === 1);\n})();\n\n(function tc_12_06_01__008() {\n  var cnt = 0;\n  do\n  {\n    cnt++;\n  }\n  while (!(cnt & 0x8000));\n\n  assert(cnt == 32768);\n})();\n\n(function tc_12_06_01__004() {\n  var obj = new Object();\n  obj.x = \"defined\";\n  do\n  {\n    delete obj.x;\n  }\n  while (obj.x !== undefined);\n})();\n\n(function tc_12_06_02__004() {\n  var cnt = 33;\n\n  while (\"\")\n    cnt /= 2;\n\n  assert(cnt === 33);\n})();\n\n(function tc_12_06_02__005() {\n  var bVal = true;\n  var val = \"test\";\n\n  while (!bVal)\n  {\n    val += \" of while\";\n  }\n\n  assert(val === \"test\");\n})();\n\n(function tc_12_06_02__008() {\n  var cnt = 25;\n\n  function test()\n  {\n    while (cnt)\n    {\n      cnt--;\n      if (cnt === 3)\n        return 1;\n    }\n    return 0;\n  }\n\n  r = test();\n\n  assert(cnt === 3 && r === 1);\n})();\n\n(function tc_12_06_02__002() {\n  var cnt = 0;\n\n  while (1) {\n    cnt++;\n    if (cnt === 10)\n      break;\n  }\n})();\n\n(function tc_12_06_02__003() {\n  var cnt = 0;\n  while ((1234 - 34) % 23 - 1234 * 23.222)\n  {\n    cnt++;\n    if (cnt === 10)\n      break;\n  }\n})();\n\n(function tc_12_06_02__001() {\n  var cnt = 25;\n  while (cnt)\n    cnt--;\n\n  assert(cnt === 0);\n})();\n\n(function tc_12_06_02__007() {\n  var bitField = 0x1000000;\n  var cnt = 0;\n\n  while\n          (\n                  bitField >>= 1 &&\n                  true\n                  )\n  {\n    cnt++;\n  }\n\n  assert(cnt === 24);\n})();\n\n(function tc_12_06_02__006() {\n  var bitField = 0x1000000;\n  var cnt = 0;\n\n  while (bitField >>= 1)\n  {\n    cnt++;\n  }\n\n  assert(cnt === 24);\n})();\n\n(function tc_12_09__002() {\n  var r = test()\n\n  assert(r === 1);\n\n  function test()\n  {\n    return ((23 << 2) + 8) / 100;\n  }\n})();\n\n(function tc_12_09__001() {\n  var r = test()\n\n  assert(typeof r == 'object' && r.prop1 === \"property1\" && r.prop2 === 2 && r.prop3 === false);\n\n  function test()\n  {\n    var o = {\n      prop1: \"property1\",\n      prop2: 2,\n      prop3: false\n    };\n\n    return o;\n  }\n})();\n\n(function tc_12_09__005() {\n  var r = test()\n\n  assert(r === 100);\n\n  function test()\n  {\n    function internal()\n    {\n      return 100;\n    }\n\n    return internal();\n  }\n})();\n\n(function tc_12_09__006() {\n  var r = test()\n\n  assert(typeof r == 'function');\n\n  function test()\n  {\n    function internal()\n    {\n      return 100;\n    }\n\n    return internal;\n  }\n})();\n\n(function tc_12_09__004() {\n  var r = test()\n\n  assert(r == undefined);\n\n  function test()\n  {\n    var r = 1;\n    return\n    r;\n  }\n})();\n\n(function tc_12_09__003() {\n  var r = test()\n\n  assert(r === 33);\n\n  function test()\n  {\n    return 33;\n  }\n})();\n\n(function tc_12_04__003() {\n  var a, b, c\n  a = 2, b = 3, c = 4\n})();\n\n(function tc_12_04__001() {\n  var a = 5, b = 1;\n  (a + b);\n})();\n\n(function tc_12_04__002() {\n  var a = 5, b = 1;\n  a = a && b;\n})();\n\n(function tc_12_04__004() {\n  var a\n  a = function () {\n  }\n})();\n\n(function tc_12_08__008() {\n  var i = 9;\n  var cnt = 0;\n\n  while (i-- > 0)\n  {\n    if (i % 2)\n      break;\n\n    var j = 0;\n    while (j++ < 20)\n    {\n      if (j % 2 === 0)\n        break;\n      cnt++;\n    }\n\n  }\n\n  assert(cnt === 1);\n})();\n\n(function tc_12_08__014() {\n  var sum = 0;\n  var i = 0, j = 0;\n  top:\n          do\n  {\n    j = 0;\n\n    do\n    {\n      if (j > 9 && i % 2)\n        break top;\n\n      sum += 1;\n    }\n    while (j++ < 20);\n\n    sum += 1;\n  }\n  while (i++ < 10);\n\n  assert(sum === 32);\n})();\n\n(function tc_12_08__009() {\n  var sum = 0, i = 0;\n\n  WhileLabel:\n          while (++i < 10)\n  {\n    if (i === 5)\n    {\n      break WhileLabel;\n    }\n\n    sum += i;\n  }\n\n  assert(sum === 10);\n})();\n\n(function tc_12_08__010() {\n  var sum = 0;\n  var i = 0, j = 0;\n  top:\n          while (i++ < 10)\n  {\n    j = 0;\n    while (j++ < 20)\n    {\n      if (j > 9 && i % 2)\n        break top;\n\n      sum += 1;\n    }\n\n    sum += 1;\n  }\n\n  assert(sum === 9);\n})();\n\n(function tc_12_08__011() {\n  var mask = 0xff0f;\n  var numOnes = 0;\n\n  do\n  {\n    if (!(mask & 1))\n      break;\n\n    mask >>= 1;\n    numOnes++;\n  } while (mask);\n\n  assert(numOnes === 4);\n})();\n\n(function tc_12_08__002() {\n  var o = {p1: 1,\n    p2: {p1: 100, p2: 200, p3: 100},\n    p3: 4,\n    p4: 7,\n    p5: 124686,\n    p6: {p1: 100, p2: 200, p3: 100},\n    p7: 1},\n  sum = 0;\n\n  for (var p in o)\n  {\n    if (p === \"p4\")\n      break;\n\n    if (typeof (o[p]) === \"object\")\n    {\n      for (var pp in o[p])\n      {\n        if (pp === \"p2\")\n          break;\n\n        sum += o[p][pp];\n      }\n    }\n    else\n    {\n      sum += 20;\n    }\n  }\n\n  assert(sum === 140);\n})();\n\n(function tc_12_08__007() {\n  var mask = 0xff0f;\n  var numOnes = 0;\n\n  while (mask)\n  {\n    if (!(mask & 1))\n      break;\n\n    mask >>= 1;\n    numOnes++;\n  }\n\n  assert(numOnes === 4);\n})();\n\n(function tc_12_08__004() {\n  function main()\n  {\n    var sum = 0;\n    for (var i = 0; i < 10; i++)\n      for (var j = 0; j < 20; j++)\n      {\n        if (j === 10)\n          break;\n\n        sum += 1;\n      }\n\n    assert(sum === 100);\n  }\n\n  main ();\n})();\n\n(function tc_12_08__016() {\n  var o = {p1: 1, p2: 2, p3: {p1: 150, p2: 200, p3: 130, p4: 20}, p4: 4, p5: 46}, sum = 0;\n  for (var p in o)\n  {\n    if (p === \"p4\")\n      continue;\n\n    if (typeof (o[p]) === \"object\")\n    {\n      for (var pp in o[p])\n      {\n        if (pp === \"p2\")\n          break;\n\n        sum += o[p][pp];\n      }\n    }\n    else {\n      sum += o[p];\n    }\n  }\n\n  assert(sum === 199);\n})();\n\n(function tc_12_08__012() {\n  var i = 10;\n  var cnt = 0;\n\n  do\n  {\n    var j = 0;\n    do\n    {\n      if (j % 2 === 0)\n        break;\n      cnt++;\n    }\n    while (j++ < 20)\n\n    if (i % 2)\n      break;\n  }\n  while (i-- > 0);\n\n  assert(cnt === 0);\n})();\n\n(function tc_12_08__001() {\n  var o = {p1: 1,\n    p2: {p1: 100, p2: 200, p3: 100},\n    p3: 4,\n    p4: 7,\n    p5: 124686,\n    p6: {p1: 100, p2: 200, p3: 100},\n    p7: 1},\n  sum = 0;\n\n\n  for (var p in o)\n  {\n    if (p === \"p4\")\n      break;\n\n    if (typeof (o[p]) === \"object\")\n    {\n      top:\n              for (var pp in o[p])\n      {\n        if (pp === \"p2\")\n          break top;\n\n        sum += o[p][pp];\n      }\n    }\n\n    sum += 20;\n\n  }\n\n  assert(sum === 160);\n})();\n\n(function tc_12_08__018() {\n  var o = {p1: 1,\n    p2: {p1: 100, p2: 200, p3: 100},\n    p3: 4,\n    p4: 7,\n    p5: 124686,\n    p6: {p1: 100, p2: 200, p3: 100},\n    p7: 1},\n  sum = 0;\n\n  top:\n          for (var p in o)\n  {\n    if (p === \"p4\")\n      break;\n\n    if (typeof (o[p]) === \"object\")\n    {\n      for (var pp in o[p])\n      {\n        if (pp === \"p2\")\n          break top;\n\n        sum += o[p][pp];\n      }\n    }\n\n    sum += 20;\n\n  }\n\n  assert(sum === 120)\n})();\n\n(function tc_12_08__013() {\n  var sum = 0, i = 0;\n\n  DoWhileLabel:\n          do\n  {\n    if (i === 5)\n    {\n      break DoWhileLabel;\n    }\n\n    sum += i;\n  }\n  while (++i < 10);\n\n  assert(sum === 10);\n})();\n\n(function tc_12_08__005() {\n  var sum = 0;\n\n  ForLabel:\n          for (var i = 0; i < 10; i++)\n  {\n    if (i === 5)\n    {\n      break ForLabel;\n    }\n\n    sum += i;\n  }\n\n  assert(sum === 10);\n})();\n\n(function tc_12_08__015() {\n  var o = {p1: 1, p2: 2, p3: 3, p4: 1, p5: 2}, sum = 0;\n  for (var p in o)\n  {\n    if (p === \"p3\")\n    {\n      break;\n    }\n\n    sum += o[p];\n  }\n\n  assert(sum === 3);\n})();\n\n(function tc_12_08__017() {\n  var o = {a: 1, b: 2, c: 3};\n\n  ForLabel:\n          for (var p in o)\n  {\n    if (p === \"b\")\n      break ForLabel;\n    o[p] += 4;\n  }\n\n  assert(o.a + o.b + o.c === 10);\n})();\n\n(function tc_12_08__003() {\n  var sum = 0;\n  for (var i = 0; i < 10; i++)\n  {\n    if (i === 5)\n    {\n      break;\n    }\n\n    sum += i;\n  }\n\n  assert(sum === 10);\n})();\n\n(function tc_12_08__006() {\n  var sum = 0;\n  top:\n          for (var i = 0; i < 10; i++)\n  {\n    for (var j = 0; j < 20; j++)\n    {\n      if (j > 9 && i % 2)\n        break top;\n\n      sum += 1;\n    }\n\n    sum += 1;\n  }\n\n  assert(sum === 31);\n})();\n\n(function tc_12_10__003() {\n  var o = {prop: \"property\"};\n\n  with (o) {\n    assert(prop == \"property\");\n  }\n})();\n\n(function tc_12_10__005() {\n  with ({})\n  {\n    var x = \"abc\";\n  }\n\n  assert(x === \"abc\");\n})();\n\n(function tc_12_10__004() {\n  var x;\n\n  function test()\n  {\n    with (Math)\n    {\n      x = abs(-396);\n      return 1;\n    }\n\n    return 0;\n  }\n\n  var r = test();\n\n  assert(r === 1 && x === 396);\n})();\n\n(function tc_12_10__002() {\n  var o = {prop: \"property\"};\n\n  with (o) {\n    assert(prop == \"property\");\n  }\n})();\n\n(function tc_12_10__007() {\n  var x, y;\n\n  with\n          (\n                  Math)\n  {\n    x = cos(PI);\n  }\n\n  assert(x == -1);\n})();\n\n(function tc_12_10__001() {\n  var x, y;\n\n  with (Math) {\n    x = cos(PI);\n  }\n\n  assert(x == -1);\n})();\n\n(function tc_12_10__006() {\n  assert(test(\"hello\") == \"hello\" && typeof test({}) == \"object\" && test({arg: \"hello\"}) == \"hello\")\n\n  function test(arg) {\n    with (arg) {\n      return arg;\n    }\n  }\n})();\n\n(function tc_12_11__005() {\n  switch (1) {\n  }\n})();\n\n(function tc_12_11__002() {\n  var matchesCount = 0;\n\n  switch (\"key\") {\n    case \"key\":\n      ++matchesCount;\n      break;\n    case \"key\":\n      ++matchesCount;\n      break;\n    case \"another key\":\n      ++matchesCount;\n      break;\n    default:\n      ++matchesCount;\n      break;\n  }\n\n  assert (matchesCount === 1);\n})();\n\n(function tc_12_11__001() {\n  switch (1) {\n    case 0:\n      assert(false);\n    case 1:\n      break;\n    default:\n      assert(false);\n  }\n})();\n\n(function tc_12_11__006() {\n  function fact(n)\n  {\n    return n < 2 ? 1 : n * fact(n - 1);\n  }\n\n  switch (fact(5)) {\n    case 5 * fact(4):\n      break;\n    default:\n      assert(false);\n  }\n})();\n\n(function tc_12_11__004() {\n  var counter = 0;\n\n  switch (\"key\") {\n    case \"key\":\n      ++counter;\n    case \"another key\":\n      ++counter;\n    case \"another key2\":\n      ++counter;\n    default:\n      ++counter;\n  }\n\n  assert (counter == 4);\n})();\n\n(function tc_12_11__003() {\n  switch (1) {\n    case true:\n      assert(false);\n    case false:\n      assert(false);\n    default:\n      assert(true);\n  }\n})();\n\n(function tc_12_11__007() {\n  switch (\"key\") {\n    case \"another key\":\n      assert(false);\n    default:\n      break;\n    case \"another key2\":\n      assert(false);\n  }\n})();\n\n(function tc_12_14__001() {\n  try {\n    try {\n      throw \"error\";\n    } catch (e) {\n      throw e;\n    }\n    assert(false);\n  } catch (e) {\n  }\n})();\n\n(function tc_12_14__003() {\n  function test ()\n  {\n      try {\n          throw 1;\n      } catch (e) {\n          return (e === 1);\n      }\n\n      return false;\n  }\n\n  assert (test ());\n})();\n\n(function tc_12_14__004() {\n  function test ()\n  {\n    try {\n      throw \"error\";\n    } catch (e) {\n      return false;\n    } finally {\n      return true;\n    }\n\n    return false;\n  }\n\n  assert (test ());\n})();\n\n(function tc_12_14__006() {\n  function test ()\n  {\n    try {\n      var x = 1;\n    } finally {\n      return true;\n    }\n\n    return false;\n  }\n\n  assert (test ());\n})();\n\n(function tc_12_14__005() {\n  function test ()\n  {\n      try {\n          throw \"error\";\n      } catch (e) {\n          return true;\n      } finally {\n      }\n\n      return false;\n  }\n\n  assert (test ());\n})();\n\n(function tc_12_14__002() {\n  function test ()\n  {\n    try {\n      var x = 1;\n    } catch (e) {\n      return false;\n    }\n\n    return true;\n  }\n\n  assert (test ());\n})();\n\n(function tc_12_01__005() {\n  {\n    {\n      var a = null;\n      ;\n    }\n    {\n      {\n      }\n    }\n    a = 'null';\n  }\n\n  assert(a === 'null');\n})();\n\n(function tc_12_01__004() {\n  {\n    var a = null;\n    ;\n    a = 'null';\n  }\n\n  assert(a === 'null');\n})();\n\n(function tc_12_01__002() {\n  function test ()\n  {\n    {\n      return true;\n    }\n    return false;\n  }\n\n  assert (test ());\n})();\n\n(function tc_12_01__003() {\n  {;;}\n})();\n\n(function tc_12_01__001() {\n  {\n  }\n})();\n\n(function tc_12_13__001() {\n  function test ()\n  {\n    try {\n      if (true) {\n        throw \"error\";\n      }\n    } catch (e) {\n      return true;\n    }\n    return false;\n  }\n\n  assert (test ());\n})();\n\n(function tc_12_13__003() {\n  function d () {\n    throw \"exception\";\n  }\n  function c () {\n    d ();\n  }\n  function b () {\n    c ();\n  }\n  function a () {\n    b ();\n  }\n\n  function test ()\n  {\n    try {\n      a ();\n    } catch (e) {\n      return true;\n    }\n    return false;\n  }\n\n  assert (test ());\n})();\n\n(function tc_12_13__002() {\n  function test ()\n  {\n    try {\n      while (true) {\n        throw \"error\";\n      }\n    } catch (e) {\n      return true;\n    }\n    return false;\n  }\n\n  assert (test ());\n})();\n\n(function tc_12_07__001() {\n  var sum = 0;\n  for (var i = 0; i < 10; i++)\n  {\n    if (i === 5)\n    {\n      continue;\n    }\n\n    sum += i;\n  }\n\n  assert(sum === 40);\n})();\n\n(function tc_12_07__009() {\n  var sum = 0, i = 0;\n\n  WhileLabel:\n          while (++i < 10)\n  {\n    if (i === 5)\n    {\n      continue WhileLabel;\n    }\n\n    sum += i;\n  }\n\n  assert(sum === 40);\n})();\n\n(function tc_12_07__006() {\n  var sum = 0;\n  top:\n          for (var i = 0; i < 10; i++)\n  {\n    for (var j = 0; j < 20; j++)\n    {\n      if (j > 9 && i % 2)\n        continue top;\n\n      sum += 1;\n    }\n\n    sum += 1;\n  }\n\n  assert(sum === 155);\n})();\n\n(function tc_12_07__002() {\n  var sum = 0;\n  for (var i = 0; i < 10; i++)\n    for (var j = 0; j < 20; j++)\n    {\n      if (j > 9)\n        continue;\n\n      sum += 1;\n    }\n\n  assert(sum === 100);\n})();\n\n(function tc_12_07__015() {\n  var o = {p1: 1, p2: 2, p3: 3, p4: 4, p5: 5}, sum = 0;\n  for (var p in o)\n  {\n    if (p == \"p3\")\n    {\n      continue;\n    }\n\n    sum += o[p];\n  }\n\n  assert(sum == 12)\n})();\n\n(function tc_12_07__008() {\n  var i = 10;\n  var cnt = 0;\n\n  while (i-- > 0)\n  {\n    if (i % 2)\n      continue;\n\n    var j = 0;\n    while (j++ < 20)\n    {\n      if (j % 2 === 0)\n        continue;\n      cnt++;\n    }\n\n  }\n\n  assert(cnt === 50);\n})();\n\n(function tc_12_07__004() {\n  var o = {a: 1, b: 2, c: 3};\n\n  ForLabel:\n          for (var p in o)\n  {\n    if (p === \"b\")\n      continue ForLabel;\n    o[p] += 4;\n  }\n\n  assert(o.a === 5 && o.b === 2 && o.c === 7);\n})();\n\n(function tc_12_07__012() {\n  var i = 10;\n  var cnt = 0;\n\n  do\n  {\n    if (i % 2)\n      continue;\n\n    var j = 0;\n    do\n    {\n      if (j % 2 === 0)\n        continue;\n      cnt++;\n    }\n    while (j++ < 20)\n  }\n  while (i-- > 0);\n\n  assert(cnt === 60);\n})();\n\n(function tc_12_07__003() {\n  var o = {p1: 1, p2: 2, p3: {p1: 100, p2: 200, p3: 100}, p4: 4, p5: 5}, sum = 0;\n\n  top:\n          for (var p in o)\n  {\n    if (p === \"p2\")\n      continue;\n\n    if (typeof (o[p]) === \"object\")\n    {\n      for (var pp in o[p])\n      {\n        if (pp === \"p2\")\n          continue top;\n\n        sum += o[p][pp];\n      }\n    }\n\n    sum += 20;\n\n  }\n\n  assert(sum === 160);\n})();\n\n(function tc_12_07__016() {\n  var o = {p1: 1, p2: 2, p3: {p1: 100, p2: 200}, p4: 4, p5: 5}, sum = 0;\n  for (var p in o)\n  {\n    if (p === \"p2\")\n      continue;\n\n    if (typeof (o[p]) === \"object\")\n    {\n      for (var pp in o[p])\n      {\n        if (pp === \"p2\")\n          continue;\n\n        sum += o[p][pp];\n      }\n    }\n    else {\n      sum += o[p];\n    }\n  }\n\n  assert(sum === 110);\n})();\n\n(function tc_12_07__013() {\n  var sum = 0, i = 0;\n\n  DoWhileLabel:\n          do\n  {\n    if (i === 5)\n    {\n      continue DoWhileLabel;\n    }\n\n    sum += i;\n  }\n  while (++i < 10);\n\n  assert(sum === 40);\n})();\n\n(function tc_12_07__010() {\n  var sum = 0;\n  var i = 0, j = 0;\n  top:\n          while (i++ < 10)\n  {\n    j = 0;\n    while (j++ < 20)\n    {\n      if (j > 9 && i % 2)\n        continue top;\n\n      sum += 1;\n    }\n\n    sum += 1;\n  }\n\n  assert(sum === 150);\n})();\n\n(function tc_12_07__007() {\n  var mask = 0xff0f;\n  var numZeroes = 0;\n\n  while (mask)\n  {\n    mask >>= 1;\n\n    if (mask & 1)\n      continue;\n\n    numZeroes++;\n  }\n\n  assert(numZeroes === 5);\n})();\n\n(function tc_12_07__011() {\n  var mask = 0xff0f;\n  var numZeroes = 0;\n\n  do\n  {\n    mask >>= 1;\n\n    if (mask & 1)\n      continue;\n\n    numZeroes++;\n  } while (mask);\n\n  assert(numZeroes === 5);\n})();\n\n(function tc_12_07__005() {\n  var sum = 0;\n\n  ForLabel:\n          for (var i = 0; i < 10; i++)\n  {\n    if (i === 5)\n    {\n      continue ForLabel;\n    }\n\n    sum += i;\n  }\n\n  assert(sum === 40);\n})();\n\n(function tc_12_07__014() {\n  var sum = 0;\n  var i = 0, j = 0;\n  top:\n          do\n  {\n    j = 0;\n\n    do\n    {\n      if (j > 9 && i % 2)\n        continue top;\n\n      sum += 1;\n    }\n    while (j++ < 20);\n\n    sum += 1;\n  }\n  while (i++ < 10);\n\n  assert(sum === 182);\n})();\n"
  },
  {
    "path": "tests/jerry/test_suite_13.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_13__012() {\n  function foo(a, b, c, d) {\n    var deleted = true;\n    for (i = 0; i < arguments.length; i++)\n    {\n      delete arguments[i];\n      deleted = deleted && (typeof (arguments[i]) === \"undefined\");\n    }\n    return deleted;\n  }\n\n  assert(foo(\"A\", \"F\", 1, true) === true);\n})();\n\n(function tc_13__005() {\n  var foo = 1;\n\n  assert (foo === 1);\n\n  function foo()\n  {\n      return 1;\n  }\n})();\n\n(function tc_13__013() {\n  function foo(arguments) {\n    return arguments;\n  }\n\n  assert(foo(1) === 1);\n})();\n\n(function tc_13__010() {\n  function foo() {\n    return 1;\n  }\n  var object = new Object;\n  object.fun = foo;\n\n  assert(object.fun() === 1);\n})();\n\n(function tc_13__001() {\n  var b = 1;\n  for (var i = 1; i < 10; ++i)\n  {\n    b *= i;\n  }\n  var c = b;\n\n  assert(c == 362880);\n})();\n\n(function tc_13__007() {\n  function foo(arg) {\n    return ++arg;\n  }\n\n  assert(foo(1) === 2);\n})();\n\n(function tc_13__008() {\n  function foo(params) {\n    return arguments.length;\n  }\n\n  assert(foo(1, 'e', true, 5) === 4);\n})();\n\n(function tc_13__003() {\n  assert(function (param1, param2) {\n    return 1;\n  }(true, \"blah\") === 1);\n})();\n\n(function tc_13__011() {\n  function foo(param1) {\n    return delete arguments;\n  }\n\n  assert(!foo(\"param\"));\n})();\n\n(function tc_13__002() {\n  function foo() {\n    return 1;\n  }\n\n  assert(foo() === 1);\n})();\n\n(function tc_13__009() {\n  var check = typeof (foo) === \"function\";\n\n  var foo = 1;\n\n  check = check && (foo === 1);\n\n  function foo() {\n    return 1;\n  }\n\n  assert(check);\n})();\n\n(function tc_13__006() {\n  function foo() {\n  }\n\n  assert(foo() === undefined);\n})();\n\n(function tc_13__004() {\n  function foo() {\n  }\n\n  assert(typeof foo === \"function\");\n})();\n\n(function tc_13_01__001() {\n  function arguments (param) {\n    return true;\n  }\n  assert (arguments ());\n})();\n\n(function tc_13_02__001() {\n  var foo = function () {\n    this.caller = 123;\n  };\n  var f = new foo();\n  assert(f.caller === 123);\n})();\n\n(function tc_13_02__007() {\n  var obj = new function foo()\n  {\n    this.prop = 1;\n  };\n\n  assert(obj.prop === 1);\n})();\n\n(function tc_13_02__003() {\n  function foo(arg) {\n    arg.prop = 3;\n  }\n  var obj = new Object();\n  foo(obj);\n\n  assert(obj.prop === 3);\n})();\n\n(function tc_13_02__006() {\n  function foo() {\n    return;\n  }\n\n  assert(foo() === undefined);\n})();\n\n(function tc_13_02__004() {\n  function foo(arg) {\n    arg += 3;\n  }\n\n  var num = 1;\n  foo(num);\n\n  assert(num === 1);\n})();\n\n(function tc_13_02__005() {\n  function foo() {\n    return null;\n  }\n\n  assert(foo() === null);\n})();\n\n(function tc_13_02__008() {\n  function func() {\n  }\n\n  assert(Function.prototype.isPrototypeOf(func));\n})();\n"
  },
  {
    "path": "tests/jerry/test_suite_15.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_15_02_01__004() {\n  var a = 1;\n  assert(typeof Object(a) === 'object');\n})();\n\n(function tc_15_02_01__005() {\n  var a = true;\n\n  assert(typeof Object(a) === 'object');\n})();\n\n(function tc_15_02_01__002() {\n  var a;\n  a = Object(null);\n\n  assert(typeof a === 'object');\n})();\n\n(function tc_15_02_01__003() {\n  var a;\n  a = Object(undefined);\n\n  assert(typeof a === 'object');\n})();\n\n(function tc_15_02_01__006() {\n  var a = false;\n  assert(typeof Object(a) === 'object');\n})();\n\n(function tc_15_02_01__007() {\n  var a = \"some string\";\n\n  assert(typeof Object(a) === 'object');\n})();\n\n(function tc_15_02_01__009() {\n  var a = new Number(123.5);\n  assert (typeof Object(a) === 'object');\n})();\n\n(function tc_15_02_01__008() {\n  var a = \"some string\";\n  assert(typeof Object(a) === 'object');\n})();\n\n(function tc_15_02_01__010() {\n  var a = new String(\"nice string\");\n  assert(typeof Object(a) === 'object');\n})();\n\n(function tc_15_02_01__001() {\n  var a;\n  a = Object();\n\n  assert(typeof a === 'object');\n})();\n\n(function tc_15_02_03__018() {\n  var object = {\n    prop1: Number,\n    prop2: String,\n    prop3: Boolean\n  }\n\n  Object.seal(object);\n\n  check = delete object.prop1 || delete object.prop2 || delete object.prop3;\n\n  object.prop4 = 3;\n\n  check = check || Boolean(object.prop4);\n\n  assert(!check);\n})();\n\n(function tc_15_02_03__017() {\n  var object = {\n    prop1: \"qwerty\",\n    prop2: 123,\n  }\n\n  Object.freeze(object);\n\n  object.prop1 = \"asdf\";\n  object.prop3 = true;\n\n  assert(!(object.prop1 === \"asdf\") && !delete object.prop2 && !object.prop3);\n})();\n\n(function tc_15_02_03__001() {\n  assert(typeof Object.getPrototypeOf(Object) == \"function\" &&\n          Object.length == 1);\n})();\n\n(function tc_15_02_03__004() {\n  var object = {\n    prop1: Number,\n    prop2: String,\n    prop3: true,\n    prop4: 0\n  }\n\n  var keys = Object.keys(object);\n\n  assert(keys[0] == \"prop1\" &&\n          keys[1] == \"prop2\" &&\n          keys[2] == \"prop3\" &&\n          keys[3] == \"prop4\");\n\n})();\n\n(function tc_15_02_03__019() {\n  var emptyObject = {}\n\n  var properties = {\n    prop1: {\n      writable: true,\n      enumerable: true,\n      configurable: false,\n      value: \"I'm prop1\"\n    },\n    prop2: {\n      writable: true,\n      enumerable: true,\n      configurable: false,\n      value: \"I'm prop2\"\n    }\n  }\n\n  var isEnumerable = true;\n  var isConfigurable = true;\n  var isWritable = false;\n\n  Object.defineProperties(emptyObject, properties);\n\n  emptyObject.prop1 = \"hello\";\n  emptyObject.prop2 = \"world\";\n\n  if (emptyObject.prop1 === \"hello\" && emptyObject.prop2 == \"world\")\n    isWritable = true;\n\n  for (p in emptyObject) {\n    if (emptyObject[p] === \"hello\")\n      isEnumerable = !isEnumerable;\n    else if (emptyObject[p] === \"world\")\n      isEnumerable = !isEnumerable;\n  }\n\n  isConfigurable = delete emptyObject.prop1 && delete emptyObject.prop2\n\n  assert(isWritable && isEnumerable && !isConfigurable);\n})();\n\n(function tc_15_02_03__016() {\n  var emptyObject = {}\n\n  var propertyDescriptor = {\n    enumerable: true,\n    configurable: true,\n    get: function () {\n      return myProperty;\n    },\n    set: function (newValue) {\n      myProperty = newValue;\n    }\n  }\n\n  Object.defineProperty(emptyObject, 'myProperty', propertyDescriptor);\n\n  var checkGetSet = false;\n  var isEnumerable = false;\n  var isConfigurable = false;\n\n  emptyObject.myProperty = \"foobar\";\n  if (emptyObject.myProperty == \"foobar\")\n    checkGetSet = true;\n\n  for (p in emptyObject) {\n    if (emptyObject[p] == \"foobar\") {\n      isEnumerable = true;\n      break;\n    }\n  }\n\n  if (delete emptyObject.myProperty)\n    isConfigurable = true;\n\n  assert(checkGetSet && isEnumerable && isConfigurable);\n})();\n\n(function tc_15_02_03__010() {\n  var a = new String(\"qwe\");\n\n  names = Object.getOwnPropertyNames(a);\n\n  assert(names instanceof Array);\n\n  var is_0 = false, is_1 = false, is_2 = false, is_length = false;\n  for (var i = 0; i <= 3; i++)\n  {\n    if (names[i] === \"0\") { is_0 = true; }\n    if (names[i] === \"1\") { is_1 = true; }\n    if (names[i] === \"2\") { is_2 = true; }\n    if (names[i] === \"length\") { is_length = true; }\n  }\n\n  assert (is_0 && is_1 && is_2 && is_length);\n})();\n\n(function tc_15_02_03__020() {\n  var emptyObject = {}\n\n  var propertyDescriptor = {\n    enumerable: true,\n    configurable: true,\n    value: \"hello!\",\n    writable: true\n  }\n\n  Object.defineProperty(emptyObject, 'myProperty', propertyDescriptor);\n\n  var isWritable = false;\n  var isEnumerable = false;\n  var isConfigurable = false;\n\n  emptyObject.myProperty = \"foobar\";\n  if (emptyObject.myProperty == \"foobar\")\n    isWritable = true;\n\n  for (p in emptyObject) {\n    if (emptyObject[p] == \"foobar\") {\n      isEnumerable = true;\n      break;\n    }\n  }\n\n  if (delete emptyObject.myProperty)\n    isConfigurable = true;\n\n  assert(isWritable && isEnumerable && isConfigurable);\n})();\n\n(function tc_15_02_03__003() {\n  writable = false;\n  enumerable = false;\n  configurable = false;\n\n  Object.prototype = \"qwerty\";\n  if (Object.prototype === \"qwerty\")\n    writable = true;\n\n  for (prop in Object)\n  {\n    if (Object[prop] == \"qwerty\")\n      enumerable = true;\n  }\n\n  if (delete Object.prototype)\n    configurable = true;\n\n  assert(!writable && !enumerable && !configurable);\n})();\n\n(function tc_15_02_03__009() {\n  var a = {\n    prop1: Number,\n    prop2: String,\n    foo: function () {\n      return 1;\n    },\n    bar: function () {\n      return 0;\n    }\n  };\n  names = Object.getOwnPropertyNames(a);\n\n  assert(names instanceof Array &&\n          names[0] === \"prop1\" &&\n          names[1] === \"prop2\" &&\n          names[2] === \"foo\" &&\n          names[3] === \"bar\");\n})();\n\n(function tc_15_02_03__013() {\n  var niceObject = {\n    niceProp1: String,\n    niceProp2: Number,\n    niceMeth: function () {\n      return true;\n    }\n  }\n  var someElseObject = {\n    prop1: Boolean,\n    prop2: Number\n  }\n  var niceChild = Object.create(niceObject, someElseObject);\n\n  assert(Object.getPrototypeOf(niceChild) === niceObject);\n})();\n\n(function tc_15_02_03__012() {\n  var veryUsefulObject = {\n  }\n\n  Object.preventExtensions(veryUsefulObject);\n\n  veryUsefulObject.property = \"qwerty\";\n\n  veryUsefulObject.method = function () {\n    return \"asdf\";\n  }\n\n  assert(veryUsefulObject.property === undefined);\n  assert(veryUsefulObject.method === undefined);\n})();\n\n(function tc_15_02_03__008() {\n  var object1 = {\n    field1: 5,\n    field2: \"qwe\",\n    field3: true\n  }\n\n  var object2 = {\n    field1: 5,\n    field2: \"qwe\",\n    field3: true\n  }\n\n  Object.freeze(object1);\n\n  assert(Object.isFrozen(object1) && !Object.isFrozen(object2));\n})();\n\n(function tc_15_02_03__021() {\n  var emptyObject = {}\n\n  var propertyDescriptor = {\n    enumerable: true,\n    configurable: true,\n    value: \"hello!\",\n    writable: true\n  }\n\n  Object.defineProperty(emptyObject, 'myProperty', propertyDescriptor);\n\n  var newPropertyDescriptor = {\n    enumerable: false,\n    configurable: false,\n    writable: false\n  }\n\n  Object.defineProperty(emptyObject, 'myProperty', newPropertyDescriptor);\n\n  var isWritable = false;\n  var isEnumerable = false;\n  var isConfigurable = false;\n\n  emptyObject.myProperty = \"foobar\";\n  if (emptyObject.myProperty == \"foobar\")\n    isWritable = true;\n\n  for (p in emptyObject) {\n    if (emptyObject[p] == \"foobar\") {\n      isEnumerable = true;\n      break;\n    }\n  }\n\n  if (delete emptyObject.myProperty)\n    isConfigurable = true;\n\n  assert(!isWritable && !isEnumerable && !isConfigurable);\n})();\n\n(function tc_15_02_03__007() {\n  var a = {\n    foo: function () {\n      return 1\n    }\n  }\n  desc = Object.getOwnPropertyDescriptor(a, \"foo\");\n\n  assert(desc instanceof Object);\n})();\n\n(function tc_15_02_03__002() {\n  assert(typeof Object.prototype == \"object\");\n})();\n\n(function tc_15_02_03__011() {\n  var object1 = {\n    field1: 5,\n    field2: \"qwe\",\n    field3: true\n  }\n\n  var object2 = {\n    field1: 5,\n    field2: \"qwe\",\n    field3: true\n  }\n\n  Object.seal(object1);\n\n  assert(Object.isSealed(object1) && !Object.isSealed(object2));\n})();\n\n(function tc_15_02_03__014() {\n  var a = new String(\"qwe\");\n  var someElseObject = {\n    prop1: Boolean,\n    prop2: Number\n  }\n  var niceChild = Object.create(a, someElseObject);\n\n  assert(Object.getPrototypeOf(niceChild) === a);\n})();\n\n(function tc_15_02_03__006() {\n  var object1 = {\n    field1: 5,\n    field2: \"qwe\",\n    field3: true\n  }\n\n  var object2 = {\n    field1: 5,\n    field2: \"qwe\",\n    field3: true\n  }\n\n  Object.freeze(object1);\n\n  assert(!Object.isExtensible(object1) && Object.isExtensible(object2));\n})();\n\n(function tc_15_02_03__015() {\n  var a = {}\n  var someElseObject = undefined;\n  var childObject = Object.create(a, someElseObject);\n\n  assert(Object.getPrototypeOf(childObject) === a && Object.getOwnPropertyNames(childObject).length == 0);\n})();\n\n(function tc_15_02_03__005() {\n  var a = {\n    field: Number\n  }\n\n  assert(Object.getPrototypeOf(a) == Object.getPrototypeOf(Object()));\n})();\n\n(function tc_15_02_04__002() {\n  assert(Object.isExtensible(Object.getPrototypeOf(Object())));\n})();\n\n(function tc_15_02_04__001() {\n  assert(Object.getPrototypeOf(Object.getPrototypeOf(Object())) === null);\n})();\n\n(function tc_15_02_04_07__001() {\n  var object = {\n    prop: true\n  }\n\n  assert(!object.propertyIsEnumerable('prop2'));\n})();\n\n(function tc_15_02_04_07__002() {\n  var object = {}\n\n  var propertyDescriptor = {\n    enumerable: true,\n    configurable: true,\n    value: \"qwe\",\n    writable: true\n  }\n\n  Object.defineProperty(object, 'prop', propertyDescriptor);\n\n  assert(object.propertyIsEnumerable('prop'));\n})();\n\n(function tc_15_02_04_07__003() {\n  var object = {}\n\n  var propertyDescriptor = {\n    enumerable: false,\n    configurable: true,\n    value: \"qwe\",\n    writable: true\n  }\n\n  Object.defineProperty(object, 'prop', propertyDescriptor);\n\n  assert(!object.propertyIsEnumerable('prop'));\n})();\n\n(function tc_15_02_04_04__007() {\n  var a = false;\n\n  assert(a.valueOf() === false);\n})();\n\n(function tc_15_02_04_04__004() {\n  var a = new Number(5);\n\n  assert(a.valueOf() === 5);\n})();\n\n(function tc_15_02_04_04__001() {\n  var a = new Object();\n  assert(a.valueOf() === a);\n})();\n\n(function tc_15_02_04_04__003() {\n  var a = {\n    n: true,\n    s: \"qwerty\"\n  }\n\n  assert(a.valueOf() === a);\n})();\n\n(function tc_15_02_04_04__002() {\n  var a = {\n    n: Number(5)\n  }\n  assert(a.valueOf() === a);\n})();\n\n(function tc_15_02_04_04__008() {\n  var a = new String(\"qwe\");\n  assert(a.valueOf() === \"qwe\");\n})();\n\n(function tc_15_02_04_04__009() {\n  var a = \"asdfgh\";\n  assert(a.valueOf() === \"asdfgh\");\n})();\n\n(function tc_15_02_04_04__005() {\n  var a = 123;\n\n  assert(a.valueOf() === 123);\n})();\n\n(function tc_15_02_04_04__010() {\n  var a = \"123\";\n  assert(a.valueOf() === \"123\");\n})();\n\n(function tc_15_02_04_04__006() {\n  var a = new Boolean(true);\n\n  assert(a.valueOf() === true);\n})();\n\n(function tc_15_02_04_02__003() {\n  var obj = {};\n  assert(obj.toString() === \"[object Object]\");\n})();\n\n(function tc_15_02_04_02__001() {\n  assert(Object.prototype.toString.call(undefined) === \"[object Undefined]\");\n})();\n\n(function tc_15_02_04_02__002() {\n  assert(Object.prototype.toString.call(null) === \"[object Null]\");\n})();\n\n(function tc_15_02_04_02__004() {\n  assert(Object.prototype.toString.call(123) === \"[object Number]\");\n})();\n\n(function tc_15_02_04_05__002() {\n  var obj = {\n    prop1: 5\n  }\n\n  assert(!obj.hasOwnProperty(\"prop5\"));\n})();\n\n(function tc_15_02_04_05__004() {\n  function Parent() {\n    this.prop = 5;\n  }\n\n  function Child() {\n    this.prop2 = false;\n  }\n\n  Child.prototype = Parent;\n\n  var obj = new Child();\n\n  assert(obj.hasOwnProperty(\"prop2\"));\n})();\n\n(function tc_15_02_04_05__003() {\n  function Parent() {\n    this.prop = 5;\n  }\n\n  function Child() {\n    this.prop2 = false;\n  }\n\n  Child.prototype = Parent;\n\n  var obj = new Child();\n\n  assert(!obj.hasOwnProperty(\"prop\"));\n})();\n\n(function tc_15_02_04_05__001() {\n  var obj = {\n    prop1: 5,\n    prop2: \"qwe\",\n    prop3: Boolean\n  }\n\n  assert(obj.hasOwnProperty(\"prop1\"));\n})();\n\n(function tc_15_02_04_01__002() {\n  assert(Object.prototype.constructor === Object);\n})();\n\n(function tc_15_02_04_01__001() {\n  assert(Object.getPrototypeOf(Object()).constructor === Object);\n})();\n\n(function tc_15_02_04_03__003() {\n  assert(Object.toLocaleString() === Object.toString());\n})();\n\n(function tc_15_02_04_03__002() {\n  var o = new Object();\n  assert(o.toLocaleString() === o.toString());\n\n})();\n\n(function tc_15_02_04_03__001() {\n  assert(typeof Object.prototype.toLocaleString === 'function');\n})();\n\n(function tc_15_02_04_06__001() {\n  var a = new Object();\n  var b = 123;\n\n  assert(!a.isPrototypeOf(b));\n})();\n\n(function tc_15_02_04_06__002() {\n  var object = new Object();\n  var p = Object.getPrototypeOf(object);\n\n  assert(p.isPrototypeOf(object));\n})();\n\n(function tc_15_02_04_06__006() {\n  try\n  {\n    Object.prototype.isPrototypeOf.call(undefined, {});\n\n    assert(false);\n  } catch (e)\n  {\n    assert (e instanceof TypeError);\n  }\n})();\n\n(function tc_15_02_04_06__003() {\n  var object = new Object();\n  var otherObject = new Object();\n\n  assert(!otherObject.isPrototypeOf(object));\n})();\n\n(function tc_15_02_04_06__005() {\n  var object = Object.create(null);\n  var temp = new Object();\n  assert(!temp.isPrototypeOf(object));\n})();\n\n(function tc_15_02_04_06__004() {\n  var object = new Object();\n  assert(!object.isPrototypeOf(object));\n})();\n\n(function tc_15_02_02__009() {\n  var a = new Object(null);\n  assert(typeof a === 'object' &&\n          typeof (Object.getPrototypeOf(a)) === \"object\" &&\n          Object.isExtensible(a));\n})();\n\n(function tc_15_02_02__002() {\n  var a = new Object();\n  var b = new Object();\n\n  assert(a !== b);\n})();\n\n(function tc_15_02_02__006() {\n  var a = 5.5;\n  var b = new Object(a);\n  assert(typeof b === \"object\" && b == a && b !== a);\n})();\n\n(function tc_15_02_02__004() {\n  var a = {\n    field1: Number,\n    field2: String,\n    foo: function () {\n      return 0;\n    }\n  }\n  var b = new Object(a);\n  assert(a === b);\n})();\n\n(function tc_15_02_02__008() {\n  var a = new Object();\n  assert(typeof a === 'object' &&\n          typeof (Object.getPrototypeOf(a)) === \"object\" &&\n          Object.isExtensible(a));\n\n})();\n\n(function tc_15_02_02__010() {\n  var a = new Object(undefined);\n  assert(typeof a === 'object' &&\n          typeof (Object.getPrototypeOf(a)) === \"object\" &&\n          Object.isExtensible(a));\n\n})();\n\n(function tc_15_02_02__007() {\n  var a = true;\n  var b = new Object(a);\n  assert(typeof b === \"object\" && b == a && b !== a);\n})();\n\n(function tc_15_02_02__005() {\n  var a = \"foobar\";\n  var b = new Object(a);\n  assert(typeof b === \"object\" && b == a && b !== a);\n})();\n\n(function tc_15_02_02__003() {\n  var a = new Object();\n  var b = new Object(a);\n  assert(a === b);\n})();\n\n(function tc_15_02_02__001() {\n  var a = new Object();\n\n  assert(typeof a === 'object');\n})();\n\n(function tc_15_03_02_01__002() {\n  try\n  {\n    Function('a', 'a', '\"use strict\";');\n    assert(false);\n  }\n  catch (e)\n  {\n  }\n})();\n\n(function tc_15_03_02_01__005() {\n  \"use strict\";\n  try\n  {\n    Function('eval', 'return;');\n\n  }\n  catch (e)\n  {\n    assert(false);\n  }\n})();\n\n(function tc_15_03_02_01__009() {\n  \"use strict\";\n\n  try\n  {\n    Function('arguments', 'return;');\n  }\n  catch (e)\n  {\n    assert(false);\n  }\n})();\n\n(function tc_15_03_02_01__004() {\n  try\n  {\n    Function('eval', '\"use strict\";');\n    assert(false);\n  }\n  catch (e)\n  {\n  }\n})();\n\n(function tc_15_03_02_01__011() {\n  \"use strict\";\n\n  var foo = new Function(\"baz\", \"baz\", \"baz\", \"return 0;\");\n\n  assert(foo() === 0);\n})();\n\n(function tc_15_03_02_01__001() {\n  var func = new Function(\"a,b\", \"c\", \"return a+b+c\")\n  assert(func(1, 2, 3) == 6);\n})();\n\n(function tc_15_03_02_01__010() {\n  \"use strict\";\n\n  var foo = new Function(\"baz\", \"qux\", \"baz\", \"return 0;\");\n})();\n\n(function tc_15_03_02_01__008() {\n  \"use strict\";\n\n  try\n  {\n    Function('a,a', 'return a;');\n  }\n  catch (e)\n  {\n    assert(false);\n  }\n})();\n\n(function tc_15_03_02_01__007() {\n  try\n  {\n    Function('a,a', '\"use strict\";');\n    assert(false);\n  }\n  catch (e)\n  {\n  }\n})();\n\n(function tc_15_03_02_01__012s() {\n  \"use strict\";\n\n  try\n  {\n    Function('a', 'a', 'return;');\n  }\n  catch (e)\n  {\n    assert(false);\n  }\n})();\n\n(function tc_15_03_04_02__005() {\n  assert(Function.prototype.toString.hasOwnProperty('length'));\n\n  var obj = Function.prototype.toString.length;\n\n  Function.prototype.toString.length = function () {\n    return \"shifted\";\n  };\n\n  assert(Function.prototype.toString.length === obj);\n})();\n\n(function tc_15_03_04_02__002() {\n  var FACTORY = Function.prototype.toString;\n\n  try\n  {\n    var instance = new FACTORY;\n    assert(false);\n  }\n  catch (e)\n  {\n  }\n})();\n\n(function tc_15_03_04_02__003() {\n  assert(Function.prototype.toString.hasOwnProperty('length'));\n  assert(!Function.prototype.toString.propertyIsEnumerable('length'));\n  for (p in Function.prototype.toString)\n  {\n    assert(p !== \"length\");\n  }\n})();\n\n(function tc_15_03_04_02__006() {\n  assert(Function.prototype.toString.hasOwnProperty(\"length\"));\n  assert(Function.prototype.toString.length === 0);\n\n})();\n\n(function tc_15_03_03__004() {\n  assert(Function.hasOwnProperty(\"length\"));\n  assert(Function.length === 1);\n})();\n\n(function tc_15_03_03__002() {\n  assert(Function.prototype.isPrototypeOf(Function));\n})();\n\n(function tc_15_03_03__003() {\n  Function.prototype.indicator = 1;\n  assert (Function.indicator === 1);\n})();\n\n(function tc_15_03_03__001() {\n  assert(Function.hasOwnProperty(\"prototype\"));\n})();\n\n(function tc_15_03_03_01__001() {\n  var obj = Function.prototype;\n  Function.prototype = function () {\n    return \"shifted\";\n  };\n\n  if (Function.prototype !== obj)\n  {\n    assert(false);\n  }\n\n  try\n  {\n    if (Function.prototype() !== undefined)\n    {\n      assert(false);\n    }\n  }\n  catch (e)\n  {\n    assert(false);\n  }\n})();\n\n(function tc_15_03_03_01__002() {\n  if (Function.propertyIsEnumerable('prototype'))\n  {\n    assert(false);\n  }\n\n  var count = 0;\n\n  for (p in Function)\n  {\n    if (p === \"prototype\")\n      count++;\n  }\n\n  if (count !== 0)\n  {\n    assert(false);\n  }\n})();\n\n(function tc_15_03_03_01__003() {\n  delete Function.prototype;\n\n  if (!(Function.hasOwnProperty('prototype')))\n  {\n    assert(false);\n  }\n})();\n\n(function tc_15_03_03_01__004() {\n  function foo() {\n  }\n\n  Object.defineProperty(foo, 'prototype', {value: {}});\n  assert(foo.prototype ===\n          Object.getOwnPropertyDescriptor(foo, 'prototype').value);\n\n})();\n\n(function tc_15_07__001() {\n  var a = Number;\n  Number = null;\n  var b = new a(5);\n  Number = a;\n  assert(b !== 5);\n})();\n\n(function tc_15_07__002() {\n  var a = Number;\n  Number = null;\n  var b = new a(5)\n  Number = a;\n  assert(!(b === 5));\n})();\n\n(function tc_15_07_01__010() {\n  var a = Number;\n  Number = null;\n  var b = a(2);\n  Number = a;\n  assert(b === 2 && typeof b === \"number\");\n})();\n\n(function tc_15_07_01__002() {\n  assert (typeof Number(\"123456\") === \"number\");\n})();\n\n(function tc_15_07_01__005() {\n  assert (Number() === +0);\n})();\n\n(function tc_15_07_01__006() {\n  assert(isNaN(Number(new Error())));\n})();\n\n(function tc_15_07_01__008() {\n  assert(isNaN(Number(\"abcdefg\")));\n})();\n\n(function tc_15_07_01__004() {\n  assert (Number(753) === 753);\n})();\n\n(function tc_15_07_01__001() {\n  assert(Number(\"123456\") === 123456);\n})();\n\n(function tc_15_07_01__007() {\n  assert(typeof Number(\"abcdefg\") === \"number\");\n})();\n\n(function tc_15_07_01__003() {\n  assert(typeof Number(new Object()) === \"number\");\n})();\n\n(function tc_15_07_01__009() {\n  assert(isNaN(Number(function a() {return Infinity})));\n})();\n\n(function tc_15_07_02__011() {\n  var a = new Number();\n  assert(a.valueOf() === +0.0);\n})();\n\n(function tc_15_07_02__004() {\n  var a = Number\n  Number = null\n  var b = new a(\"1e12\")\n  Number = a;\n  assert(b.toString(35) === \"fiyo05lf\");\n})();\n\n(function tc_15_07_02__007() {\n  ts = Number.prototype.toString\n  delete Number.prototype.toString;\n  var a = new Number()\n  assert(a.toString() === \"[object Number]\");\n  Number.prototype.toString = ts;\n})();\n\n(function tc_15_07_02__001() {\n  var a = new Number(\"123456\");\n  assert((a == 123456) && (typeof a === 'object'));\n})();\n\n(function tc_15_07_02__006() {\n  var a = Number\n  Number = null\n  var b = new a(\"1e12\")\n  b.c = new a(new a(777))\n  Number = a;\n  assert(typeof b.c === \"object\" && b.c.valueOf() === 777)\n})();\n\n(function tc_15_07_02__003() {\n  var a = Number\n  Number = null\n  var b = new a(\"1e12\")\n  Number = a;\n  assert(b == 1000000000000 && typeof b === \"object\");\n})();\n\n(function tc_15_07_02__005() {\n  var a = Number\n  Number = null\n  var b = new a(\"1e12\")\n  b.c = new a(new Error())\n  Number = a;\n\n  assert(typeof b.c === \"object\" && isNaN(b.c));\n})();\n\n(function tc_15_07_02__010() {\n  var b = Number.prototype\n  var a = Number\n  Number = null\n  var c = new a(5)\n  Number = a;\n  assert(b === c.constructor.prototype);\n})();\n\n(function tc_15_07_02__009() {\n  var a = new Number(null)\n  assert(Number.prototype === a.constructor.prototype);\n})();\n\n(function tc_15_07_02__002() {\n  var a = new Number();\n  assert((a == +0.0) && (typeof a === 'object'));\n})();\n\n(function tc_15_07_02__008() {\n  var a = new Number(null)\n  assert(Number.prototype.isPrototypeOf(a));\n})();\n\n(function tc_15_07_04__003() {\n  assert(Object.prototype.isPrototypeOf(Number.prototype));\n})();\n\n(function tc_15_07_04_01__002() {\n  assert(Number.prototype.constructor === Number);\n})();\n\n(function tc_15_07_04_01__001() {\n  assert(Number.prototype.hasOwnProperty('constructor'));\n})();\n\n(function tc_15_07_04_02__012() {\n  assert((new Number(Number.POSITIVE_INFINITY)).toString(undefined) === \"Infinity\");\n})();\n\n(function tc_15_07_04_02__011() {\n  assert((new Number(NaN)).toString(undefined) === \"NaN\")\n})();\n\n(function tc_15_07_04_02__005() {\n  var a = -123456789012345\n  assert(a.toString(8) === \"-3404420603357571\");\n})();\n\n(function tc_15_07_04_02__003() {\n  var a = new Number(15);\n  assert(a.toString(2) === \"1111\");\n})();\n\n(function tc_15_07_04_02__010() {\n  assert((new Number(NaN)).toString() === \"NaN\");\n})();\n\n(function tc_15_07_04_02__001() {\n  var a = Number(0.1);\n  assert(a.toString(36) === \"0.3lllllllllm\");\n})();\n\n(function tc_15_07_04_02__013() {\n  assert ((new Number(Number.NEGATIVE_INFINITY)).toString(undefined) === \"-Infinity\");\n})();\n\n(function tc_15_07_04_02__004() {\n  var a = 123456789012345\n  assert(a.toString(8) === \"3404420603357571\");\n})();\n\n(function tc_15_07_04_02__009() {\n  assert(Number.prototype.hasOwnProperty('toString') &&\n          typeof Number.prototype.toString === \"function\");\n})();\n\n(function tc_15_07_03__004() {\n  var p = Object.getPrototypeOf(Number);\n  assert(p === Function.prototype);\n})();\n\n(function tc_15_07_03__002() {\n  assert(Number.hasOwnProperty(\"length\") && Number.length === 1);\n})();\n\n(function tc_15_07_03__003() {\n  assert(Function.prototype.isPrototypeOf(Number) === true);\n})();\n\n(function tc_15_07_03__001() {\n  assert(Number.constructor.prototype === Function.prototype);\n})();\n\n(function tc_15_07_03_02__002() {\n  assert(Number.MAX_VALUE === 1.7976931348623157e308);\n})();\n\n(function tc_15_07_03_02__003() {\n  assert(Number.MAX_VALUE === 1.7976931348623157e308);\n})();\n\n(function tc_15_07_03_02__004() {\n  var b = Number.MAX_VALUE;\n  Number.MAX_VALUE = 0;\n  assert(Number.MAX_VALUE === b);\n})();\n\n(function tc_15_07_03_02__006() {\n  for (x in Number)\n  {\n    if (x === \"MAX_VALUE\")\n    {\n      assert(false);\n    }\n  }\n})();\n\n(function tc_15_07_03_02__005() {\n  assert(!(delete Number.MAX_VALUE));\n})();\n\n(function tc_15_07_03_02__001() {\n  assert(Number.hasOwnProperty(\"MAX_VALUE\"));\n})();\n\n(function tc_15_07_03_01__001() {\n  assert(Number.hasOwnProperty(\"prototype\"));\n})();\n\n(function tc_15_07_03_01__002() {\n  var a = Object.getOwnPropertyDescriptor(Number, 'prototype');\n\n  assert((a.writable === false &&\n          a.enumerable === false &&\n          a.configurable === false));\n})();\n\n(function tc_15_07_03_01__003() {\n  assert(Object.getPrototypeOf(new Number()) === Number.prototype);\n})();\n\n(function tc_15_07_03_01__007() {\n  for (x in Number)\n  {\n    if (x === \"prototype\")\n    {\n      assert(false);\n    }\n  }\n})();\n\n(function tc_15_07_03_01__005() {\n  assert(delete Number.prototype === false)\n})();\n\n(function tc_15_07_03_01__006() {\n  assert(!Number.propertyIsEnumerable('prototype'));\n})();\n\n(function tc_15_07_03_06__001() {\n  assert(Number.hasOwnProperty(\"POSITIVE_INFINITY\"));\n})();\n\n(function tc_15_07_03_06__006() {\n  for (x in Number)\n  {\n    if (x === \"POSITIVE_INFINITY\")\n    {\n      assert(false);\n    }\n  }\n})();\n\n(function tc_15_07_03_06__007() {\n  assert(!Number.propertyIsEnumerable('POSITIVE_INFINITY'));\n})();\n\n(function tc_15_07_03_06__003() {\n  assert(Number.POSITIVE_INFINITY === Infinity);\n})();\n\n(function tc_15_07_03_06__005() {\n  assert(!(delete Number.POSITIVE_INFINITY));\n})();\n\n(function tc_15_07_03_06__002() {\n  assert(!isFinite(Number.POSITIVE_INFINITY) && Number.POSITIVE_INFINITY > 0);\n})();\n\n(function tc_15_07_03_06__004() {\n  var b = Number.POSITIVE_INFINITY\n  Number.POSITIVE_INFINITY = 0\n  assert(Number.POSITIVE_INFINITY === b);\n})();\n\n(function tc_15_07_03_05__005() {\n  assert(!(delete Number.NEGATIVE_INFINITY));\n})();\n\n(function tc_15_07_03_05__006() {\n  for (x in Number)\n  {\n    if (x === \"NEGATIVE_INFINITY\")\n    {\n      assert(false);\n    }\n  }\n})();\n\n(function tc_15_07_03_05__007() {\n  assert(!Number.propertyIsEnumerable('NEGATIVE_INFINITY'));\n})();\n\n(function tc_15_07_03_05__003() {\n  assert(Number.NEGATIVE_INFINITY === -Infinity);\n})();\n\n(function tc_15_07_03_05__001() {\n  assert(Number.hasOwnProperty(\"NEGATIVE_INFINITY\"));\n})();\n\n(function tc_15_07_03_05__002() {\n  assert(!(isFinite(Number.NEGATIVE_INFINITY) && Number.NEGATIVE_INFINITY < 0));\n})();\n\n(function tc_15_07_03_05__004() {\n  var b = Number.NEGATIVE_INFINITY;\n  Number.NEGATIVE_INFINITY = 0;\n  assert(Number.NEGATIVE_INFINITY === b);\n})();\n\n(function tc_15_07_03_04__001() {\n  assert(Number.hasOwnProperty(\"NaN\"));\n})();\n\n(function tc_15_07_03_04__005() {\n  assert(!(delete Number.NaN));\n})();\n\n(function tc_15_07_03_04__003() {\n  for (x in Number)\n  {\n    if (x === \"NaN\")\n    {\n      assert(false);\n    }\n  }\n})();\n\n(function tc_15_07_03_04__004() {\n  Number.NaN = 0;\n  assert(isNaN(Number.NaN));\n})();\n\n(function tc_15_07_03_04__002() {\n  assert(isNaN(Number.NaN));\n})();\n\n(function tc_15_07_03_03__001() {\n  assert(Number.hasOwnProperty(\"MIN_VALUE\"));\n})();\n\n(function tc_15_07_03_03__005() {\n  assert(!(delete Number.MIN_VALUE));\n})();\n\n(function tc_15_07_03_03__003() {\n  assert(Number.MIN_VALUE === 5e-324);\n})();\n\n(function tc_15_07_03_03__006() {\n  for (x in Number)\n  {\n    if (x === \"MIN_VALUE\")\n    {\n      assert(false);\n    }\n  }\n})();\n\n(function tc_15_07_03_03__004() {\n  var b = Number.MIN_VALUE\n  Number.MIN_VALUE = 0\n  assert(Number.MIN_VALUE === b);\n})();\n\n(function tc_15_07_03_03__002() {\n  assert(Number.MIN_VALUE === 5e-324);\n})();\n\n(function tc_15_05_02_01__002() {\n  var s = new String (\"\");\n  s.x = 1;\n  assert (s.x === 1);\n})();\n\n(function tc_15_05_02_01__001() {\n  assert(String.prototype.isPrototypeOf(new String(\"\")));\n})();\n\n(function tc_15_05_03_01__002() {\n  for (var p in String) {\n    if (p === String.prototype) {\n      assert(false);\n    }\n  }\n})();\n\n(function tc_15_05_03_01__001() {\n  String.prototype = 1;\n  assert(String.prototype !== 1);\n})();\n\n(function tc_15_05_03_02__001() {\n  assert (String.fromCharCode () === \"\");\n})();\n\n(function tc_15_05_03_02__002() {\n  assert (String.fromCharCode (65, 66, 67) === \"ABC\");\n})();\n\n(function tc_15_05_01_01__005() {\n  assert (String (false) === \"false\");\n})();\n\n(function tc_15_05_01_01__008() {\n  assert (String (-0) === \"0\");\n})();\n\n(function tc_15_05_01_01__013() {\n  assert (String (0.111111111111111) === \"0.111111111111111\");\n})();\n\n(function tc_15_05_01_01__010() {\n  assert (String (Infinity) === \"Infinity\");\n})();\n\n(function tc_15_05_01_01__007() {\n  assert (String (+0) === \"0\");\n})();\n\n(function tc_15_05_01_01__009() {\n  assert (String (-1) === \"-\" + String (1));\n})();\n\n(function tc_15_05_01_01__012() {\n  assert (String (10000000000000000000) === \"10000000000000000000\");\n})();\n\n(function tc_15_05_01_01__006() {\n  assert(String(NaN) === \"NaN\");\n})();\n\n(function tc_15_05_01_01__001() {\n  assert (String () === String (\"\"));\n})();\n\n(function tc_15_05_01_01__015() {\n  assert (String (0.000000111111111111111) === \"1.11111111111111e-7\");\n})();\n\n(function tc_15_05_01_01__004() {\n  assert (String (true) === \"true\");\n})();\n\n(function tc_15_05_01_01__014() {\n  assert (String (0.00000111111111111111) === \"0.00000111111111111111\");\n})();\n\n(function tc_15_05_01_01__002() {\n  assert (String (undefined) === \"undefined\");\n})();\n\n(function tc_15_05_01_01__003() {\n  assert (String (null) === \"null\");\n})();\n\n(function tc_15_05_01_01__011() {\n  assert (String (123000) === \"123000\");\n})();\n\n(function tc_15_05_04_07__001() {\n  assert(String(\"abcd\").indexOf(\"ab\") === 0);\n})();\n\n(function tc_15_05_04_07__002() {\n  assert(String(\"abcd\").indexOf(\"ab\", 0) === 0);\n})();\n\n(function tc_15_05_04_07__003() {\n  assert(String(\"abcd\").indexOf(\"ab\", 1) === -1);\n})();\n\n(function tc_15_05_04_01__001() {\n  assert (String.prototype.constructor === String);\n})();\n\n(function tc_15_05_04_05__001() {\n  assert(isNaN(String(\"abc\").charCodeAt(-1)));\n})();\n\n(function tc_15_05_04_05__002() {\n  assert(isNaN(String(\"abc\").charCodeAt(3)));\n})();\n\n(function tc_15_05_04_05__004() {\n  assert(String(\"abc\").charCodeAt(\"0\") === 97);\n})();\n\n(function tc_15_05_04_05__003() {\n  assert(String(\"abc\").charCodeAt(0) === 97);\n})();\n\n(function tc_15_05_04_03__001() {\n  assert (String (\"abc\").valueOf () === \"abc\");\n})();\n\n(function tc_15_05_04_02__001() {\n  assert (String (\"abc\").toString () === \"abc\");\n})();\n\n(function tc_15_05_04_02__002() {\n  assert (\"abc\".toString () === \"abc\");\n})();\n\n(function tc_15_05_04_04__003() {\n  assert(String(\"abc\").charAt(0) === \"a\");\n})();\n\n(function tc_15_05_04_04__004() {\n  assert(String(\"abc\").charAt(\"0\") === \"a\");\n})();\n\n(function tc_15_05_04_04__001() {\n  assert(String(\"abc\").charAt(-1) === \"\");\n})();\n\n(function tc_15_05_04_04__002() {\n  assert(String(\"abc\").charAt(3) === \"\");\n})();\n\n(function tc_15_05_04_06__004() {\n  assert (String ().concat.length === 1);\n})();\n\n(function tc_15_05_04_06__001() {\n  assert(String(\"abc\").concat(\"d\") === \"abcd\");\n})();\n\n(function tc_15_05_04_06__003() {\n  assert(String().concat(\"a\", \"b\", \"c\") === \"abc\");\n})();\n\n(function tc_15_05_04_06__002() {\n  assert(String().concat() === \"\");\n})();\n\n(function tc_15_08_02_06__011() {\n  assert(isNaN(Math.ceil(\"NaN\")));\n})();\n\n(function tc_15_08_02_06__007() {\n  assert (Math.ceil(-1.3) === -1);\n})();\n\n(function tc_15_08_02_06__006() {\n  assert(1/Math.ceil(-0.3) === -Infinity);\n})();\n\n(function tc_15_08_02_06__012() {\n  assert(isNaN(Math.ceil(new Object())));\n})();\n\n(function tc_15_08_02_06__003() {\n  assert(1/Math.ceil(-0) === -Infinity);\n})();\n\n(function tc_15_08_02_06__010() {\n  assert (Math.ceil(1.1) === 2);\n})();\n\n(function tc_15_08_02_06__004() {\n  assert(Math.ceil(-Infinity) === -Infinity);\n})();\n\n(function tc_15_08_02_06__009() {\n  assert (Math.ceil(1.9) === 2);\n})();\n\n(function tc_15_08_02_06__008() {\n  assert (Math.ceil(-1.9) === -1);\n})();\n\n(function tc_15_08_02_06__005() {\n  assert(Math.ceil(Infinity) === Number.POSITIVE_INFINITY);\n})();\n\n(function tc_15_08_02_06__002() {\n  var res = 1 / Math.ceil(+0)\n  assert(res === +Infinity && res !== -Infinity);\n})();\n\n(function tc_15_08_02_06__001() {\n  assert(isNaN(Math.ceil(NaN)));\n})();\n\n(function tc_15_08_02_16__005() {\n  assert (isNaN(Math.sin(-Infinity)));\n})();\n\n(function tc_15_08_02_16__001() {\n  assert (isNaN(Math.sin(NaN)));\n})();\n\n(function tc_15_08_02_16__003() {\n  assert (1/Math.sin(-0) === -Infinity);\n})();\n\n(function tc_15_08_02_16__004() {\n  assert (isNaN(Math.sin(Infinity)));\n})();\n\n(function tc_15_08_02_16__002() {\n  assert (1/Math.sin(+0) === Infinity);\n})();\n\n(function tc_15_08_02_03__009() {\n  assert(Math.asin(1) === Math.PI / 2);\n})();\n\n(function tc_15_08_02_03__007() {\n  assert(Math.asin(+0) === +0);\n})();\n\n(function tc_15_08_02_03__004() {\n  assert(!isNaN(Math.asin(-1.0000000000000001)));\n})();\n\n(function tc_15_08_02_03__005() {\n  assert(isNaN(Math.asin(-1.000000000000001)));\n})();\n\n(function tc_15_08_02_03__003() {\n  assert(!isNaN(Math.asin(1.0000000000000001)));\n})();\n\n(function tc_15_08_02_03__008() {\n  assert(Math.asin(-0) === -0);\n})();\n\n(function tc_15_08_02_03__006() {\n  assert(isNaN(Math.asin(-3)));\n})();\n\n(function tc_15_08_02_03__001() {\n  assert(isNaN(Math.asin(NaN)));\n})();\n\n(function tc_15_08_02_03__002() {\n  assert(isNaN(Math.asin(1.000000000000001)));\n})();\n\n(function tc_15_08_02_17__003() {\n  assert (1/Math.sqrt(+0) === Infinity);\n})();\n\n(function tc_15_08_02_17__005() {\n  assert (Math.sqrt(Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_17__004() {\n  assert (1/Math.sqrt(-0) === -Infinity);\n})();\n\n(function tc_15_08_02_17__002() {\n  assert (isNaN(Math.sqrt(-2)));\n})();\n\n(function tc_15_08_02_17__001() {\n  assert (isNaN(Math.sqrt(NaN)));\n})();\n\n(function tc_15_08_02_01__002() {\n  assert(Math.abs(-0.0) === +0.0);\n})();\n\n(function tc_15_08_02_01__001() {\n  assert(isNaN(Math.abs(NaN)));\n})();\n\n(function tc_15_08_02_01__005() {\n  assert(Math.abs(-123513745) === 123513745);\n})();\n\n(function tc_15_08_02_01__003() {\n  assert(Math.abs(Number.NEGATIVE_INFINITY) === Number.POSITIVE_INFINITY);\n})();\n\n(function tc_15_08_02_01__004() {\n  assert(Math.abs(Number.NEGATIVE_INFINITY) === Number.POSITIVE_INFINITY);\n})();\n\n(function tc_15_08_02_11__004() {\n  assert(isNaN(Math.max(NaN)));\n})();\n\n(function tc_15_08_02_11__012() {\n  assert(typeof Math.max === \"function\");\n})();\n\n(function tc_15_08_02_11__009() {\n  assert(Math.max() === -Infinity);\n})();\n\n(function tc_15_08_02_11__003() {\n  assert(isNaN(Math.max(Object())));\n})();\n\n(function tc_15_08_02_11__011() {\n  assert(Math.max(+0, -0) === +0);\n})();\n\n(function tc_15_08_02_11__006() {\n  assert(isNaN(Math.max(5, -7, NaN)));\n})();\n\n(function tc_15_08_02_11__001() {\n  assert(isNaN(Math.max(undefined)));\n})();\n\n(function tc_15_08_02_11__002() {\n  assert(isNaN(Math.max({})));\n})();\n\n(function tc_15_08_02_11__010() {\n  assert(Math.max() !== Infinity);\n})();\n\n(function tc_15_08_02_11__014() {\n  assert(1/Math.max(-0, +0) === Infinity);\n})();\n\n(function tc_15_08_02_11__005() {\n  assert(isNaN(Math.max(5, 7, NaN)));\n})();\n\n(function tc_15_08_02_11__008() {\n  assert(!isFinite(Math.max()));\n})();\n\n(function tc_15_08_02_11__007() {\n  assert(Math.max(5, -7) === 5);\n})();\n\n(function tc_15_08_02_11__013() {\n  assert(Math.max.length === 2);\n})();\n\n(function tc_15_08_02_07__003() {\n  assert (Math.cos(+0) === 1);\n})();\n\n(function tc_15_08_02_07__006() {\n  assert (isNaN(Math.cos(-Infinity)));\n})();\n\n(function tc_15_08_02_07__001() {\n  assert (isNaN(Math.cos(NaN)));\n})();\n\n(function tc_15_08_02_07__004() {\n  assert (Math.cos(-0) === 1);\n})();\n\n(function tc_15_08_02_07__007() {\n  assert (Math.cos(Math.PI) === -1);\n})();\n\n(function tc_15_08_02_07__002() {\n  assert(isNaN(Math.cos(\"   NaN\")));\n})();\n\n(function tc_15_08_02_07__005() {\n  assert (isNaN(Math.cos(Infinity)));\n})();\n\n(function tc_15_08_02_10__002() {\n  assert (isNaN(Math.log(-0.00001)));\n})();\n\n(function tc_15_08_02_10__004() {\n  assert (Math.log(-0) === -Infinity);\n})();\n\n(function tc_15_08_02_10__001() {\n  assert(isNaN(Math.log(NaN)));\n})();\n\n(function tc_15_08_02_10__005() {\n  assert (1/Math.log(1) === Infinity);\n})();\n\n(function tc_15_08_02_10__003() {\n  assert(Math.log(+0) === -Infinity);\n})();\n\n(function tc_15_08_02_10__006() {\n  assert (Math.log(Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_13__029() {\n  assert (Math.pow(2,2) === 4);\n})();\n\n(function tc_15_08_02_13__022() {\n  assert (1/Math.pow(+0, 5.2) === Infinity);\n})();\n\n(function tc_15_08_02_13__010() {\n  assert(isNaN(Math.pow(1, Infinity)));\n})();\n\n(function tc_15_08_02_13__023() {\n  assert(Math.pow(+0, -5.2) === Infinity);\n\n})();\n\n(function tc_15_08_02_13__017() {\n  assert (1/Math.pow(Infinity, -3) === Infinity);\n})();\n\n(function tc_15_08_02_13__024() {\n  assert (1/Math.pow(-0, 12) === Infinity);\n})();\n\n(function tc_15_08_02_13__031() {\n  assert(isNaN(Math.pow(1, NaN)));\n})();\n\n(function tc_15_08_02_13__007() {\n  assert (1/Math.pow(5, -Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_13__027() {\n  assert (Math.pow(-0, -1) === -Infinity);\n})();\n\n(function tc_15_08_02_13__014() {\n  assert(1 / Math.pow(0.3, Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_13__003() {\n  assert (Math.pow(NaN, +0, 5, \"qeqegfhb\") === 1);\n})();\n\n(function tc_15_08_02_13__002() {\n  assert(Math.pow(2, +0, 5, \"qeqegfhb\") === 1);\n})();\n\n(function tc_15_08_02_13__009() {\n  assert(Math.pow(-5, Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_13__021() {\n  assert (1/Math.pow(-Infinity, -5) === -Infinity);\n})();\n\n(function tc_15_08_02_13__001() {\n  assert(isNaN(Math.pow(2, \"NaN\", 5)));\n})();\n\n(function tc_15_08_02_13__025() {\n  assert (1/Math.pow(-0, 7) === -Infinity);\n})();\n\n(function tc_15_08_02_13__012() {\n  assert (isNaN(Math.pow(-1, -Infinity)));\n})();\n\n(function tc_15_08_02_13__016() {\n  assert (Math.pow(Infinity, 3) === Infinity);\n})();\n\n(function tc_15_08_02_13__013() {\n  assert(isNaN(Math.pow(1, -Infinity)));\n})();\n\n(function tc_15_08_02_13__011() {\n  assert (isNaN(Math.pow(-1, Infinity)));\n})();\n\n(function tc_15_08_02_13__015() {\n  assert (Math.pow(-0.3, -Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_13__028() {\n  assert(isNaN(Math.pow(-174, 1.78)));\n})();\n\n(function tc_15_08_02_13__008() {\n  assert (1/Math.pow(-5, -Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_13__006() {\n  assert (Math.pow(5, Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_13__026() {\n  assert (Math.pow(-0, -100) === Infinity);\n})();\n\n(function tc_15_08_02_13__004() {\n  assert (Math.pow(\"qeqegfhb\", -0) === 1);\n})();\n\n(function tc_15_08_02_13__030() {\n  assert (Math.pow(\"2   \",\"2.0\") === 4);\n})();\n\n(function tc_15_08_02_13__005() {\n  assert (isNaN(Math.pow(\"qeqegfhb\", 1)));\n})();\n\n(function tc_15_08_02_13__020() {\n  assert (1/Math.pow(-Infinity, -6) === Infinity);\n})();\n\n(function tc_15_08_02_13__019() {\n  assert (Math.pow(-Infinity, 5) === -Infinity);\n})();\n\n(function tc_15_08_02_13__018() {\n  assert (Math.pow(-Infinity, 6) === Infinity);\n})();\n\n(function tc_15_08_02_15__006() {\n  assert (1/Math.round(0.2) === Infinity);\n})();\n\n(function tc_15_08_02_15__003() {\n  assert (1/Math.round(-0) === -Infinity);\n})();\n\n(function tc_15_08_02_15__007() {\n  assert (1/Math.round(-0.3) === -Infinity);\n})();\n\n(function tc_15_08_02_15__005() {\n  assert (Math.round(-Infinity) === -Infinity);\n})();\n\n(function tc_15_08_02_15__001() {\n  assert (isNaN(Math.round(NaN)));\n})();\n\n(function tc_15_08_02_15__004() {\n  assert (Math.round(Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_15__002() {\n  assert (1/Math.round(+0) === Infinity);\n})();\n\n(function tc_15_08_02_05__003() {\n  assert(Math.atan2(Number.MIN_VALUE, +0) === Math.PI / 2);\n})();\n\n(function tc_15_08_02_05__020() {\n  assert(Math.atan2(-Number.MAX_VALUE, Number.POSITIVE_INFINITY) === -0);\n})();\n\n(function tc_15_08_02_05__019() {\n  assert(Math.atan2(Number.MAX_VALUE, -Infinity) === Math.PI);\n})();\n\n(function tc_15_08_02_05__008() {\n  assert(Math.atan2(+0, -0) === Math.PI);\n})();\n\n(function tc_15_08_02_05__029() {\n  assert(Math.atan2(-Infinity, -Infinity) === -3*Math.PI / 4);\n})();\n\n(function tc_15_08_02_05__016() {\n  assert(Math.atan2(-99999999, +0) === -Math.PI/2);\n})();\n\n(function tc_15_08_02_05__028() {\n  assert(Math.atan2(-Infinity, +Infinity) === -Math.PI / 4);\n})();\n\n(function tc_15_08_02_05__007() {\n  assert(Math.atan2(+0, +0) === +0);\n})();\n\n(function tc_15_08_02_05__006() {\n  assert(Math.atan2(+0, Number.MAX_VALUE) === +0);\n})();\n\n(function tc_15_08_02_05__009() {\n  assert(Math.atan2(+0, -Number.MIN_VALUE) === Math.PI);\n})();\n\n(function tc_15_08_02_05__025() {\n  assert(Math.atan2(-Infinity, -999999999) === -Math.PI / 2);\n})();\n\n(function tc_15_08_02_05__014() {\n  assert(Math.atan2(-0, -Number.MIN_VALUE) === -Math.PI);\n})();\n\n(function tc_15_08_02_05__026() {\n  assert(Math.atan2(Infinity, Infinity) === Math.PI / 4);\n})();\n\n(function tc_15_08_02_05__023() {\n  assert(Math.atan2(Infinity, -1) === Math.PI / 2);\n})();\n\n(function tc_15_08_02_05__024() {\n  assert(Math.atan2(-Infinity, -1) === -Math.PI / 2);\n})();\n\n(function tc_15_08_02_05__011() {\n  assert(Math.atan2(-0, Infinity) === -0);\n})();\n\n(function tc_15_08_02_05__010() {\n  assert(Math.atan2(+0, -Infinity) === Math.PI);\n})();\n\n(function tc_15_08_02_05__015() {\n  assert(Math.atan2(-0, -Infinity) === -Math.PI);\n})();\n\n(function tc_15_08_02_05__004() {\n  assert(!(Math.atan2(0, +0) === Math.PI / 2));\n})();\n\n(function tc_15_08_02_05__021() {\n  assert(Math.atan2(-Number.MIN_VALUE, Number.NEGATIVE_INFINITY) === -Math.PI);\n})();\n\n(function tc_15_08_02_05__022() {\n  assert(Math.atan2(Infinity, 1) === Math.PI / 2);\n})();\n\n(function tc_15_08_02_05__013() {\n  assert(Math.atan2(-0, -0) === -Math.PI);\n})();\n\n(function tc_15_08_02_05__027() {\n  assert(Math.atan2(Infinity, -Infinity) === 3*Math.PI / 4);\n})();\n\n(function tc_15_08_02_05__001() {\n  assert(isNaN(Math.atan2(NaN, 1)));\n})();\n\n(function tc_15_08_02_05__002() {\n  assert(isNaN(Math.atan2(1, NaN)));\n})();\n\n(function tc_15_08_02_05__017() {\n  assert(Math.atan2(-99999999, -0) === -Math.PI/2);\n})();\n\n(function tc_15_08_02_05__005() {\n  assert(Math.atan2(1, -0) === Math.PI / 2);\n})();\n\n(function tc_15_08_02_05__018() {\n  assert(Math.atan2(1, Infinity) === +0);\n})();\n\n(function tc_15_08_02_05__012() {\n  assert(Math.atan2(-0, +0) === -0);\n})();\n\n(function tc_15_08_02_02__002() {\n  assert(!isNaN(Math.acos(1.00000000000000000000001)));\n})();\n\n(function tc_15_08_02_02__003() {\n  assert(isNaN(Math.acos(Number.NEGATIVE_INFINITY)));\n})();\n\n(function tc_15_08_02_02__005() {\n  assert(isNaN(Math.acos(1.000000000000001)));\n})();\n\n(function tc_15_08_02_02__004() {\n  assert(Math.acos(1) === +0.0);\n})();\n\n(function tc_15_08_02_02__006() {\n  assert(isNaN(Math.acos(-7)));\n})();\n\n(function tc_15_08_02_02__001() {\n  assert(isNaN(Math.acos(NaN)));\n})();\n\n(function tc_15_08_02_12__010() {\n  assert(Math.min() !== -Infinity);\n})();\n\n(function tc_15_08_02_12__013() {\n  assert(Math.min.length === 2);\n})();\n\n(function tc_15_08_02_12__012() {\n  assert(typeof Math.min === \"function\");\n})();\n\n(function tc_15_08_02_12__014() {\n  assert(1/Math.min(+0, -0) === -Infinity);\n})();\n\n(function tc_15_08_02_12__005() {\n  assert(isNaN(Math.min(5, 7, NaN)));\n})();\n\n(function tc_15_08_02_12__001() {\n  assert(isNaN(Math.min(undefined)));\n})();\n\n(function tc_15_08_02_12__002() {\n  assert(isNaN(Math.min({})));\n})();\n\n(function tc_15_08_02_12__008() {\n  assert(!isFinite(Math.min()));\n})();\n\n(function tc_15_08_02_12__003() {\n  assert(isNaN(Math.min(Object())));\n})();\n\n(function tc_15_08_02_12__009() {\n  assert(Math.min() === Infinity);\n})();\n\n(function tc_15_08_02_12__004() {\n  assert(isNaN(Math.min(NaN)));\n})();\n\n(function tc_15_08_02_12__007() {\n  assert(Math.min(5, -7) === -7);\n})();\n\n(function tc_15_08_02_12__006() {\n  assert(isNaN(Math.min(5, -7, NaN)));\n})();\n\n(function tc_15_08_02_12__011() {\n  assert(Math.min(+0, -0) === +0);\n})();\n\n(function tc_15_08_02_18__007() {\n  assert (isNaN(Math.tan(undefined)));\n})();\n\n(function tc_15_08_02_18__001() {\n  assert (isNaN(Math.tan(NaN)));\n})();\n\n(function tc_15_08_02_18__006() {\n  assert (1/Math.tan(-0, NaN) === -Infinity);\n})();\n\n(function tc_15_08_02_18__005() {\n  assert (1/Math.tan(-0) === -Infinity);\n})();\n\n(function tc_15_08_02_18__002() {\n  assert (isNaN(Math.tan(Infinity)));\n})();\n\n(function tc_15_08_02_18__003() {\n  assert (isNaN(Math.tan(-Infinity)));\n})();\n\n(function tc_15_08_02_18__004() {\n  assert (1/Math.tan(+0) === Infinity);\n})();\n\n(function tc_15_08_02_04__002() {\n  assert(isNaN(Math.atan(undefined)));\n})();\n\n(function tc_15_08_02_04__006() {\n  assert(Math.atan(Infinity) === Math.PI / 2);\n})();\n\n(function tc_15_08_02_04__008() {\n  assert(Math.atan(Number.NEGATIVE_INFINITY) === -Math.PI / 2);\n})();\n\n(function tc_15_08_02_04__003() {\n  assert(isNaN(Math.atan({})));\n})();\n\n(function tc_15_08_02_04__007() {\n  assert(Math.atan(Number.POSITIVE_INFINITY) === Math.PI / 2);\n})();\n\n(function tc_15_08_02_04__004() {\n  assert(Math.atan(+0) === +0);\n})();\n\n(function tc_15_08_02_04__001() {\n  assert(isNaN(Math.atan(NaN)));\n})();\n\n(function tc_15_08_02_04__009() {\n  assert(Math.atan(-1) === -Math.PI / 4);\n})();\n\n(function tc_15_08_02_04__005() {\n  assert(Math.atan(-0) === -0);\n})();\n\n(function tc_15_08_02_09__001() {\n  assert (isNaN(Math.floor(NaN)));\n})();\n\n(function tc_15_08_02_09__006() {\n  assert (1/Math.floor(0.2) === Infinity);\n})();\n\n(function tc_15_08_02_09__008() {\n  assert (Math.floor(1.9) === -Math.ceil(-1.9));\n})();\n\n(function tc_15_08_02_09__007() {\n  assert (Math.floor(1.2) === -Math.ceil(-1.2));\n})();\n\n(function tc_15_08_02_09__002() {\n  assert (1/Math.floor(+0) === Infinity);\n})();\n\n(function tc_15_08_02_09__003() {\n  assert(1/Math.floor(-0) === -Infinity);\n})();\n\n(function tc_15_08_02_09__005() {\n  assert (Math.floor(-Infinity) === -Infinity);\n})();\n\n(function tc_15_08_02_09__004() {\n  assert (Math.floor(Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_08__004() {\n  assert (Math.exp(Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_08__002() {\n  assert (Math.exp(+0) === 1);\n})();\n\n(function tc_15_08_02_08__003() {\n  assert(Math.exp(-0) === 1);\n})();\n\n(function tc_15_08_02_08__001() {\n  assert (isNaN(Math.exp(NaN)));\n})();\n\n(function tc_15_08_02_08__006() {\n  assert (1/Math.exp(-Infinity) === Infinity);\n})();\n\n(function tc_15_08_02_08__005() {\n  assert (Math.exp(Infinity) === Infinity);\n})();\n\n(function tc_15_06_01_01__005() {\n  assert(false === Boolean(+0));\n})();\n\n(function tc_15_06_01_01__011() {\n  assert(true === Boolean(\"abcdef\"));\n})();\n\n(function tc_15_06_01_01__012() {\n  assert(true === Boolean({}));\n})();\n\n(function tc_15_06_01_01__002() {\n  assert(false === Boolean(null));\n})();\n\n(function tc_15_06_01_01__007() {\n  assert(false === Boolean(NaN));\n})();\n\n(function tc_15_06_01_01__001() {\n  assert(false === Boolean(undefined));\n})();\n\n(function tc_15_06_01_01__004() {\n  assert(true === Boolean(true));\n})();\n\n(function tc_15_06_01_01__009() {\n  assert(true === Boolean(-11111));\n})();\n\n(function tc_15_06_01_01__003() {\n  assert(false === Boolean(false));\n})();\n\n(function tc_15_06_01_01__010() {\n  assert(false === Boolean(\"\"));\n})();\n\n(function tc_15_06_01_01__006() {\n  assert(false === Boolean(-0));\n})();\n\n(function tc_15_06_01_01__008() {\n  assert(true === Boolean(11111));\n})();\n\n(function tc_15_06_02_01__002() {\n  var b = new Boolean (true);\n  b.x = 1;\n  assert (b.x === 1);\n})();\n\n(function tc_15_06_02_01__001() {\n  assert(Boolean.prototype.isPrototypeOf(new Boolean(true)));\n})();\n\n(function tc_15_06_04_03__001() {\n  assert(Boolean(false).valueOf() === false);\n})();\n\n(function tc_15_06_04_02__003() {\n  assert(true.toString() === \"true\");\n})();\n\n(function tc_15_06_04_02__001() {\n  assert(Boolean(true).toString() === \"true\");\n})();\n\n(function tc_15_06_04_02__002() {\n  assert(Boolean(false).toString() === \"false\");\n})();\n\n(function tc_15_06_04_01__001() {\n  assert(Boolean.prototype.constructor === Boolean);\n})();\n\n(function tc_15_06_03_01__001() {\n  for (var p in Boolean) {\n    if (p === Boolean.prototype) {\n      assert(false);\n    }\n  }\n})();\n\n(function tc_15_04_02_02__007() {\n  var a = new Array(\"5\");\n  assert(a.length === 1);\n})();\n\n(function tc_15_04_02_02__003() {\n  var a = new Array(5);\n  assert(a[0] === undefined);\n})();\n\n(function tc_15_04_02_02__008() {\n  var a = new Array(\"55\");\n  assert(a[0] === \"55\");\n})();\n\n(function tc_15_04_02_02__005() {\n  var a = new Array(5);\n  assert(a[10] === undefined);\n})();\n\n(function tc_15_04_02_02__002() {\n  var a = new Array(5);\n  assert(a.length === 5);\n})();\n\n(function tc_15_04_02_02__006() {\n  var a = new Array(0);\n  assert(a.length === 0);\n})();\n\n(function tc_15_04_02_02__004() {\n  var a = new Array(5);\n  assert(a[3] === undefined);\n})();\n\n(function tc_15_04_02_02__001() {\n  var a = new Array(5);\n  assert(typeof a === 'object');\n})();\n\n(function tc_15_04_02_01__001() {\n  var a = new Array();\n  assert(typeof a === 'object');\n})();\n\n(function tc_15_04_02_01__004() {\n  var a = new Array(1, 2, 5);\n  assert(a[1] === 2);\n})();\n\n(function tc_15_04_02_01__003() {\n  var a = new Array(1, 2, 5);\n  assert(a[0] === 1);\n})();\n\n(function tc_15_04_02_01__008() {\n  var a = new Array();\n  assert(a[0] === undefined);\n})();\n\n(function tc_15_04_02_01__005() {\n  var a = new Array(1, 2, 5);\n  assert(a[2] === 5);\n})();\n\n(function tc_15_04_02_01__007() {\n  var a = new Array();\n  assert(a.length === 0);\n})();\n\n(function tc_15_04_02_01__006() {\n  var a = new Array(1, 2, 5);\n  assert(a[3] === undefined);\n})();\n\n(function tc_15_04_02_01__002() {\n  var a = new Array(1, 2, 5);\n  assert(a.length === 3);\n})();\n\n(function tc_15_03_04_02__001() {\n  assert(Function.prototype.toString.hasOwnProperty('length'));\n  assert(delete Function.prototype.toString.length);\n  assert(!Function.prototype.toString.hasOwnProperty('length'));\n})();\n"
  },
  {
    "path": "tests/jerry/test_suite_19.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_19_01_02__003() {\n  function test_set_prototype_of_success(o, proto, msg)\n  {\n    assert(o === Object.setPrototypeOf(o, proto));\n\n    if (msg)\n    {\n      print(msg + \" PASS\");\n    }\n  }\n\n  (function test_nonobject_o(undefined)\n  {\n    test_set_prototype_of_success(true, new Object(), \"Object.setPrototypeOf(boolean, ...)\");\n    test_set_prototype_of_success(3.14, new Object(), \"Object.setPrototypeOf(number, ...)\");\n    test_set_prototype_of_success(\"xyz\", new Object(), \"Object.setPrototypeOf(string, ...)\");\n  })()\n})();\n\n(function tc_19_01_02__006() {\n  function test_set_prototype_of_success_set(o, proto, msg)\n  {\n    assert(o === Object.setPrototypeOf(o, proto));\n    assert(proto === Object.getPrototypeOf(o));\n\n    if (msg)\n    {\n      print(msg + \" PASS\");\n    }\n  }\n\n  (function test_set_prototype_of(undefined)\n  {\n    test_set_prototype_of_success_set(new Object(), new Object(), \"Object.setPrototypeOf(o1, o2)\");\n    test_set_prototype_of_success_set(new Object(), null, \"Object.setPrototypeOf(o, null)\");\n  })()\n})();\n\n(function tc_19_01_02__004() {\n  function test_set_prototype_of_error(o, proto, msg)\n  {\n    var name = \"\";\n\n    try\n    {\n      Object.setPrototypeOf(o, proto);\n    }\n    catch (e)\n    {\n      name = e.name;\n    }\n\n    assert(name === \"TypeError\");\n\n    if (msg)\n    {\n      print(msg + \" PASS (XFAIL)\");\n    }\n  }\n\n  function test_set_prototype_of_success_set(o, proto, msg)\n  {\n    assert(o === Object.setPrototypeOf(o, proto));\n    assert(proto === Object.getPrototypeOf(o));\n\n    if (msg)\n    {\n      print(msg + \" PASS\");\n    }\n  }\n\n  (function test_nonextensible_o(undefined)\n  {\n    var o = new Object();\n    var o_proto = Object.getPrototypeOf(o);\n    Object.preventExtensions(o);\n\n    test_set_prototype_of_success_set(o, o_proto, \"Object.setPrototypeOf(o_nonext, o_nonext.__proto__)\");\n    test_set_prototype_of_error(o, new Object(), \"Object.setPrototypeOf(o_nonext, ...)\");\n  })()\n})();\n\n(function tc_19_01_02__002() {\n  function test_set_prototype_of_error(o, proto, msg)\n  {\n    var name = \"\";\n\n    try\n    {\n      Object.setPrototypeOf(o, proto);\n    }\n    catch (e)\n    {\n      name = e.name;\n    }\n\n    assert(name === \"TypeError\");\n\n    if (msg)\n    {\n      print(msg + \" PASS (XFAIL)\");\n    }\n  }\n\n  (function test_nonobject_proto(undefined)\n  {\n    test_set_prototype_of_error(new Object(), undefined, \"Object.setPrototypeOf(..., undefined)\");\n    test_set_prototype_of_error(new Object(), true, \"Object.setPrototypeOf(..., boolean)\");\n    test_set_prototype_of_error(new Object(), 3.14, \"Object.setPrototypeOf(..., number)\");\n    test_set_prototype_of_error(new Object(), \"xyz\", \"Object.setPrototypeOf(..., string)\");\n  })()\n})();\n\n(function tc_19_01_02__005() {\n  function test_set_prototype_of_error(o, proto, msg)\n  {\n    var name = \"\";\n\n    try\n    {\n      Object.setPrototypeOf(o, proto);\n    }\n    catch (e)\n    {\n      name = e.name;\n    }\n\n    assert(name === \"TypeError\");\n\n    if (msg)\n    {\n      print(msg + \" PASS (XFAIL)\");\n    }\n  }\n\n  (function test_circularity(undefined)\n  {\n    var o = new Object();\n\n    test_set_prototype_of_error(o, o, \"Object.setPrototypeOf(o, o)\");\n  })()\n})();\n\n(function tc_19_01_02__001() {\n  function test_set_prototype_of_error(o, proto, msg)\n  {\n    var name = \"\";\n\n    try\n    {\n      Object.setPrototypeOf(o, proto);\n    }\n    catch (e)\n    {\n      name = e.name;\n    }\n\n    assert(name === \"TypeError\");\n\n    if (msg)\n    {\n      print(msg + \" PASS (XFAIL)\");\n    }\n  }\n\n  (function test_incoercible_o(undefined)\n  {\n    test_set_prototype_of_error(undefined, new Object(), \"Object.setPrototypeOf(undefined, ...)\");\n    test_set_prototype_of_error(null, new Object(), \"Object.setPrototypeOf(null, ...)\");\n  })();\n})();\n"
  },
  {
    "path": "tests/jerry/test_suite_22.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_22_02_02__004() {\n  function foo(v, k)\n  {\n    return this.num + v + k;\n  }\n\n  var a = Float32Array.from([10,20,30], foo, {num:0.5});\n\n  assert(a[0] === 10.5);\n  assert(a[1] === 21.5);\n  assert(a[2] === 32.5);\n})();\n\n/* ES11 22.2.1.1 - length is equal to 0 */\n(function tc_22_02_02__002() {\n  var a = Object.getPrototypeOf(Int8Array);\n  assert(a.length === 0);\n})();\n\n(function tc_22_02_02__003() {\n  var a = Object.getPrototypeOf(Int8Array);\n  var b = new Int8Array();\n  var c = Object.getPrototypeOf(Object.getPrototypeOf(b));\n  assert(c === a.prototype);\n})();\n\n(function tc_22_02_02__005() {\n  var name = \"\";\n\n  try\n  {\n    Int16Array.from.call(1);\n  }\n  catch (e)\n  {\n    name = e.name;\n  }\n\n  assert(name === \"TypeError\");\n\n  name = \"\";\n\n  try\n  {\n    Int16Array.from.call(Float32Array);\n  }\n  catch (e)\n  {\n    name = e.name;\n  }\n\n  assert(name === \"TypeError\");\n\n  name = \"\";\n\n  try\n  {\n    Int16Array.from.call(Float32Array, [1,2,3], 1);\n  }\n  catch (e)\n  {\n    name = e.name;\n  }\n\n  assert(name === \"TypeError\");\n\n  name = \"\";\n\n  try\n  {\n    Int16Array.from.call(Number, [1,2,3]);\n  }\n  catch (e)\n  {\n    name = e.name;\n  }\n\n  assert(name === \"TypeError\");\n})();\n\n(function tc_22_02_02__001() {\n  var a = Object.getPrototypeOf(Int8Array);\n  assert(a.name === \"TypedArray\");\n})();\n\n(function tc_22_02_01__013() {\n  var a = new Float32Array(2);\n\n  a[0] = 0.1;\n  a[1] = -2.3;\n\n  assert(a[0] === 0.10000000149011612);\n  assert(a[1] === -2.299999952316284);\n})();\n\n(function tc_22_02_01__021() {\n  var a = new Float32Array([0.1, 0.2, 0.3]);\n\n  var b = a.hasOwnProperty(1);\n  var c = a.hasOwnProperty(3);\n\n  assert (b === true);\n  assert (c === false);\n})();\n\n(function tc_22_02_01__002() {\n  var a = new Int8Array(5);\n  assert(a instanceof Int8Array);\n})();\n\n(function tc_22_02_01__006() {\n  var a = new Int8Array([1,2,3]);\n  assert(a instanceof Int8Array);\n})();\n\n(function tc_22_02_01__009() {\n  Int8Array.prototype[10] = 10;\n  var a = new Int8Array(5);\n  assert(a[10] === undefined);\n})();\n\n(function tc_22_02_01__015() {\n  var a = new Int32Array(8);\n\n  a[0] = 0xffffffff;\n  a[1] = 0xff00000001;\n  a[2] = 0xff80000001;\n  a[3] = -2.3;\n  a[4] = Number.NEGATIVE_INFINITY;\n  a[5] = NaN;\n  a[6] = 10e17;\n  a[7] = -10e17;\n\n  assert(a[0] === -1);\n  assert(a[1] === 1);\n  assert(a[2] === -2147483647);\n  assert(a[3] === -2);\n  assert(a[4] === 0);\n  assert(a[5] === 0);\n  assert(a[6] === -1486618624);\n  assert(a[7] === 1486618624);\n})();\n\n(function tc_22_02_01__018() {\n  var a = new Uint16Array(2);\n\n  a[0] = 0x123456789A;\n  a[1] = -2.3;\n\n  assert(a[0] === 0x789A);\n  assert(a[1] === 65534);\n})();\n\n(function tc_22_02_01__020() {\n  var name = \"\";\n\n  try\n  {\n    new Int16Array(Float32Array.prototype);\n  }\n  catch (e)\n  {\n    name = e.name;\n  }\n\n  assert(name === \"TypeError\");\n})();\n\n(function tc_22_02_01__016() {\n  var a = new Int8Array(3);\n\n  a[0] = 0xff;\n  a[1] = 0xff01;\n  a[2] = -2.3;\n\n  assert(a[0] === -1);\n  assert(a[1] === 1);\n  assert(a[2] === -2);\n})();\n\n(function tc_22_02_01__010() {\n  var a = new Float32Array([0.1, -3.4, 65535.9]);\n  var b = new Int16Array(a);\n  var c = new Uint8Array(a);\n  var d = new Int32Array(a);\n\n  assert(b[0] === 0);\n  assert(b[1] === -3);\n  assert(b[2] === -1);\n  assert(c[0] === 0);\n  assert(c[1] === 253);\n  assert(c[2] === 255);\n  assert(d[0] === 0);\n  assert(d[1] === -3);\n  assert(d[2] === 65535);\n})();\n\n(function tc_22_02_01__008() {\n  var a = new Int8Array([1.5,1000,-9]);\n  a[2] = a[1] * a[0];\n  assert(a[2] === -24);\n})();\n\n(function tc_22_02_01__014() {\n  var a = new Int16Array(3);\n\n  a[0] = 0xffff;\n  a[1] = 0xff0001;\n  a[2] = -2.3;\n\n  assert(a[0] === -1);\n  assert(a[1] === 1);\n  assert(a[2] === -2);\n})();\n\n(function tc_22_02_01__007() {\n  var a = new Int8Array(5);\n  assert(a[2] === 0);\n})();\n\n(function tc_22_02_01__017() {\n  var a = new Uint32Array(2);\n\n  a[0] = 0x123456789A;\n  a[1] = -2.3;\n\n  assert(a[0] === 0x3456789A);\n  assert(a[1] === 4294967294);\n})();\n\n(function tc_22_02_01__001() {\n  var a = new Int8Array();\n  assert(a instanceof Int8Array);\n})();\n\n(function tc_22_02_01__003() {\n  var a = new Int8Array('5');\n  assert(a instanceof Int8Array);\n})();\n\n(function tc_22_02_01__019() {\n  var a = new Uint8Array(2);\n\n  a[0] = 0x123456789A;\n  a[1] = -2.3;\n\n  assert(a[0] === 0x9A);\n  assert(a[1] === 254);\n})();\n\n(function tc_22_02_01__005() {\n  var a = new ArrayBuffer(5);\n  var b = new Int8Array(a);\n  assert(b instanceof Int8Array);\n})();\n\n(function tc_22_02_01__012() {\n  var a = new Float64Array(2);\n\n  a[0] = 0.1;\n  a[1] = -2.3;\n\n  assert(a[0] === 0.1);\n  assert(a[1] === -2.3);\n})();\n\n(function tc_22_02_01__011() {\n  var a = new Uint8ClampedArray([1.5, 2.5, -1.5, 10000]);\n\n  assert(a[0] === 2);\n  assert(a[1] === 2);\n  assert(a[2] === 0);\n  assert(a[3] === 255);\n})();\n\n(function tc_22_02_01__004() {\n  var a = new Int8Array(5);\n  var b = new Int8Array(a);\n  assert(a instanceof Int8Array);\n})();\n\n(function tc_22_02_03__015() {\n  var total = new Float32Array([-1.5, 0, 1.5, 2]).reduce(function(a, b, c) {\n    return a + b + c;\n  }, 10);\n\n  assert(total === 18);\n})();\n\n(function tc_22_02_03__003() {\n  var a = new Int8Array(5);\n  assert(a.byteLength === 5);\n})();\n\n(function tc_22_02_03__020() {\n  var uint8 = new Uint8Array(4);\n\n  uint8.set([10, \"11\", 12]);\n  assert(uint8[0] === 10 && uint8[1] === 11 && uint8[2] === 12);\n\n  uint8.set([13, 14.3, 15], 1);\n  assert(uint8[0] === 10 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);\n\n  uint8.set([16], NaN);\n  assert(uint8[0] === 16 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);\n\n  uint8.set([17], \"\");\n  assert(uint8[0] === 17 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);\n\n  uint8.set([18], \"0\");\n  assert(uint8[0] === 18 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);\n\n  uint8.set([19], false);\n  assert(uint8[0] === 19 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);\n\n  uint8.set([20], 0.2);\n  assert(uint8[0] === 20 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);\n\n  uint8.set([21], 0.9);\n  assert(uint8[0] === 21 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);\n\n  uint8.set([22], null);\n  assert(uint8[0] === 22 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);\n\n  uint8.set([23], {});\n  assert(uint8[0] === 23 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);\n\n  uint8.set([24], []);\n  assert(uint8[0] === 24 && uint8[1] === 13 && uint8[2] === 14 && uint8[3] === 15);\n\n  uint8.set([25], true);\n  assert(uint8[0] === 24 && uint8[1] === 25 && uint8[2] === 14 && uint8[3] === 15);\n})();\n\n(function tc_22_02_03__011() {\n  var a = new Float32Array([1.25, 2.5, 3.75]);\n\n  var b = a.map(function(num) {\n    return num * 2;\n  });\n\n  assert(a[0] === 1.25);\n  assert(a[1] === 2.5);\n  assert(a[2] === 3.75);\n  assert(b[0] === 2.5);\n  assert(b[1] === 5);\n  assert(b[2] === 7.5);\n})();\n\n(function tc_22_02_03__002() {\n  var a = new Int8Array(5);\n  assert(a.byteOffset === 0);\n})();\n\n(function tc_22_02_03__012() {\n  var a = new Float32Array([1.1, 2.2, 3.3, 4.4]);\n  var count = 0;\n\n  function f_every(num)\n  {\n    count++;\n    return num < 3;\n  }\n\n  var ret = a.every(f_every);\n\n  assert(ret === false);\n  assert(count === 3);\n})();\n\n(function tc_22_02_03__007() {\n  var a = new Uint8Array([10, 20, 30, 40]);\n  var o = {\n    \"small\":0,\n    \"large\":0\n  };\n  var func = function(v, k)\n  {\n    if (v < 25)\n    {\n      this.small = this.small + k;\n    }\n    else\n    {\n      this.large = this.large + k;\n    }\n  }\n\n  var ret = a.forEach(func, o);\n\n  assert(ret === undefined);\n  assert(o.small === 1);\n  assert(o.large === 5);\n})();\n\n(function tc_22_02_03__021() {\n  var float64 = new Float64Array(4);\n  float64.set([10.1, \"11.2\", 12.3]);\n  assert(float64[0] === 10.1 && float64[1] === 11.2 && float64[2] === 12.3);\n\n  float64.set([13.1, 14.2, 15.3], 1);\n  assert(float64[0] === 10.1 && float64[1] === 13.1 && float64[2] === 14.2 && float64[3] === 15.3);\n\n  try\n  {\n\n    float64.set([17.1, 18.2, 19.3], 2);\n    assert(false);\n  } catch (e)\n  {\n    assert(e instanceof RangeError)\n  }\n})();\n\n(function tc_22_02_03__009() {\n  var a = new Uint8Array([1, 2, 3, 4]);\n  var count = 0;\n\n  function f_every(num)\n  {\n    count++;\n    return num < 3;\n  }\n\n  var ret = a.every(f_every);\n\n  assert(ret === false);\n  assert(count === 3);\n})();\n\n(function tc_22_02_03__014() {\n  var a = new Float32Array([-1.1, 0.1, 2.5, 3.0]);\n  var o = {\n    \"small\":0,\n    \"large\":0\n  };\n  var func = function(v, k)\n  {\n    if (v < 2)\n    {\n      this.small = this.small + k;\n    }\n    else\n    {\n      this.large = this.large + k;\n    }\n  }\n\n  var ret = a.forEach(func, o);\n\n  assert(ret === undefined);\n  assert(o.small === 1);\n  assert(o.large === 5);\n})();\n\n(function tc_22_02_03__001() {\n  var a = new Int8Array(5);\n  assert(a.length === 5);\n})();\n\n(function tc_22_02_03__010() {\n  var a = new Uint8Array([1, 2, 3, 4]);\n  var count = 0;\n\n  function f_some(num)\n  {\n    count++;\n    return num > 3;\n  }\n\n  var ret = a.some(f_some);\n\n  assert(ret === true);\n  assert(count === 4);\n})();\n\n(function tc_22_02_03__006() {\n  var a = new Int8Array([1,2,3,4,5]);\n  var b = new Int8Array(a.buffer, 2, 3);\n\n  b[0] = 5.6;\n  assert(a[2] === 5);\n})();\n\n(function tc_22_02_03__018() {\n  var a = new Float32Array([-1.5, 0, 1.5]);\n  var b = a.reverse()\n\n  assert(a === b);\n  assert(a[0] === 1.5);\n  assert(a[1] === 0);\n  assert(a[2] === -1.5);\n})();\n\n(function tc_22_02_03__008() {\n  var a = new Uint8Array([1, 2, 3]);\n\n  var b = a.map(function(num) {\n    return num * 2;\n  });\n\n  assert(a[0] === 1);\n  assert(a[1] === 2);\n  assert(a[2] === 3);\n  assert(b[0] === 2);\n  assert(b[1] === 4);\n  assert(b[2] === 6);\n})();\n\n(function tc_22_02_03__016() {\n  var total = new Float32Array([-1.5, 0, 1.5, 2]).reduceRight(function(a, b) {\n    return a - b;\n  });\n\n  assert (total === 2)\n})();\n\n(function tc_22_02_03__013() {\n  var a = new Float32Array([1.1, 2.2, 3.3, 4.4]);\n  var count = 0;\n\n  function f_some(num)\n  {\n    count++;\n    return num > 3;\n  }\n\n  var ret = a.some(f_some);\n\n  assert(ret === true);\n  assert(count === 3);\n})();\n\n(function tc_22_02_03__005() {\n  var a = new Int8Array([1,2,3,4,5]);\n  var b = new Int8Array(a.buffer, 2, 3);\n\n  assert(a.buffer === b.buffer);\n  assert(b.length === 3);\n  assert(b.byteOffset === 2);\n  assert(b.byteLength === 3);\n})();\n\n(function tc_22_02_03__017() {\n  var a = new Float32Array([-1.5, 0, 1.5, 2]);\n  var b = a.filter(function(x){\n    return x > 0;\n  });\n\n  assert(a[0] === -1.5);\n  assert(a[1] === 0);\n  assert(a[2] === 1.5);\n  assert(a[3] === 2);\n  assert(b[0] === 1.5);\n  assert(b[1] === 2);\n  assert(b.length === 2);\n})();\n\n(function tc_22_02_03__019() {\n  var uint8 = new Uint8Array(4);\n\n\n  assert(uint8.set.length === 1)\n\n  try\n  {\n    uint8.set([1], -1);\n    assert(false);\n  } catch (e)\n  {\n    assert(e instanceof RangeError);\n  }\n\n  try\n  {\n    uint8.set([1], - (Math.pow(2, 32) + 1));\n    assert(false);\n  } catch (e)\n  {\n    assert(e instanceof RangeError);\n  }\n\n  try\n  {\n    uint8.set([1], -Infinity);\n    assert(false);\n  } catch (e)\n  {\n    assert(e instanceof RangeError);\n  }\n\n  try\n  {\n    uint8.set([1], Infinity);\n    assert(false);\n  } catch (e)\n  {\n    assert(e instanceof RangeError);\n  }\n\n  try\n  {\n    uint8.set([1], (Math.pow(2, 32) + 1));\n    assert(false);\n  } catch (e)\n  {\n    assert(e instanceof RangeError);\n  }\n\n  try\n  {\n\n    uint8.set([17, 18, 19], 2);\n    assert(false);\n  } catch (e)\n  {\n    assert(e instanceof RangeError)\n  }\n})();\n\n(function tc_22_02_03__004() {\n  var a = new Int8Array(5);\n  assert(a.buffer instanceof ArrayBuffer);\n})();\n\n(function tc_22_02_06__001() {\n  assert(Int8Array.prototype.BYTES_PER_ELEMENT === 1);\n  assert(Uint8Array.prototype.BYTES_PER_ELEMENT === 1);\n  assert(Uint8ClampedArray.prototype.BYTES_PER_ELEMENT === 1);\n  assert(Int16Array.prototype.BYTES_PER_ELEMENT === 2);\n  assert(Uint16Array.prototype.BYTES_PER_ELEMENT === 2);\n  assert(Int32Array.prototype.BYTES_PER_ELEMENT === 4);\n  assert(Uint32Array.prototype.BYTES_PER_ELEMENT === 4);\n  assert(Float32Array.prototype.BYTES_PER_ELEMENT === 4);\n  assert(Float64Array.prototype.BYTES_PER_ELEMENT === 8);\n})();\n\n(function tc_22_02_05__001() {\n  assert(Int8Array.BYTES_PER_ELEMENT === 1);\n  assert(Uint8Array.BYTES_PER_ELEMENT === 1);\n  assert(Uint8ClampedArray.BYTES_PER_ELEMENT === 1);\n  assert(Int16Array.BYTES_PER_ELEMENT === 2);\n  assert(Uint16Array.BYTES_PER_ELEMENT === 2);\n  assert(Int32Array.BYTES_PER_ELEMENT === 4);\n  assert(Uint32Array.BYTES_PER_ELEMENT === 4);\n  assert(Float32Array.BYTES_PER_ELEMENT === 4);\n  assert(Float64Array.BYTES_PER_ELEMENT === 8);\n})();\n"
  },
  {
    "path": "tests/jerry/test_suite_24.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_24_01_02__010() {\n  var a = new ArrayBuffer(NaN);\n  assert(a.byteLength === 0);\n})();\n\n(function tc_24_01_02__009() {\n  var a = new ArrayBuffer(undefined);\n  assert(a.byteLength === 0);\n})();\n\n(function tc_24_01_02__012() {\n  var name = \"\";\n  try\n  {\n    var a = new ArrayBuffer(-1.9);\n  }\n  catch (e)\n  {\n    name = e.name;\n  }\n\n  assert(name === \"RangeError\");\n})();\n\n(function tc_24_01_02__003() {\n  var a = new ArrayBuffer(\"5\");\n  assert(typeof a === 'object');\n  assert(a.byteLength === 5);\n})();\n\n(function tc_24_01_02__013() {\n  var name = \"\";\n  try\n  {\n    var a = new ArrayBuffer(Math.pow(2, 32) - 1);\n  }\n  catch (e)\n  {\n    name = e.name;\n  }\n\n  assert(name === \"RangeError\");\n})();\n\n(function tc_24_01_02__002() {\n  var a = new ArrayBuffer(5);\n  assert(typeof a === 'object');\n  assert(a.byteLength === 5);\n})();\n\n(function tc_24_01_02__007() {\n  var a = new ArrayBuffer(\"string\");\n  assert(a.byteLength === 0);\n})();\n\n(function tc_24_01_02__006() {\n  var a = new ArrayBuffer(5.5);\n  assert(a.byteLength === 5);\n})();\n\n(function tc_24_01_02__004() {\n  var name = \"\";\n\n  try\n  {\n    var a = ArrayBuffer();\n  }\n  catch (e)\n  {\n    name = e.name;\n  }\n\n  assert(name === \"TypeError\");\n})();\n\n(function tc_24_01_02__005() {\n  assert(ArrayBuffer.length === 1);\n})();\n\n(function tc_24_01_02__001() {\n  var a = new ArrayBuffer();\n  assert(typeof a === 'object');\n  assert(a.byteLength === 0);\n})();\n\n(function tc_24_01_02__008() {\n  var obj = {};\n  var a = new ArrayBuffer(obj);\n  assert(a.byteLength === 0);\n})();\n\n(function tc_24_01_02__011() {\n  var a = new ArrayBuffer(-0.3);\n  assert(a.byteLength === 0);\n\n  var b = new ArrayBuffer(-0.9);\n  assert(b.byteLength === 0);\n})();\n\n(function tc_24_01_04__002() {\n  var a = new ArrayBuffer(5);\n  assert(a.byteLength === 5);\n})();\n\n(function tc_24_01_04__006() {\n  var a = new ArrayBuffer(5);\n  var b = a.slice (3, 2);\n  assert(b.byteLength === 0);\n})();\n\n(function tc_24_01_04__001() {\n  assert(ArrayBuffer.prototype.constructor === ArrayBuffer);\n})();\n\n(function tc_24_01_04__004() {\n  var a = new ArrayBuffer(5);\n  var b = a.slice (1, 3);\n  assert(b.byteLength === 2);\n})();\n\n(function tc_24_01_04__003() {\n  var a = new ArrayBuffer(5);\n  a.byteLength = 10;\n  assert(a.byteLength === 5);\n})();\n\n(function tc_24_01_04__007() {\n  var a = new ArrayBuffer(5);\n  var b = a.slice();\n  assert(b.byteLength === 5);\n})();\n\n(function tc_24_01_04__005() {\n  var a = new ArrayBuffer(5);\n  var b = a.slice(1, -2);\n  assert(b.byteLength === 2);\n})();\n\n(function tc_24_01_03__001() {\n  assert(typeof ArrayBuffer.prototype === 'object');\n})();\n"
  },
  {
    "path": "tests/jerry/test_suite_25.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n(function tc_25_04_05__004() {\n  var a = new Promise(function(f, r){\n    f(\"a\");\n  });\n\n  var b = new Promise(function(f, r){\n    f(a);\n  })\n\n  b.then(function(x) {\n    assert (x === \"a\");\n  })\n})();\n\n(function tc_25_04_05__002() {\n  var obj = {name:\"\"};\n\n  var a = new Promise(function(f, r){\n    obj.name = obj.name + \"a\";\n    f(obj);\n  });\n\n  a.then(function(x) {\n    x.name = x.name + \"b\";\n    return x;\n  }).then(null, function(x) {\n    x.name = x.name + \"c\";\n    return x;\n  }).then(function(x) {\n    x.name = x.name + \"d\";\n    assert (obj.name === \"aebd\");\n  });\n\n  obj.name = obj.name + \"e\";\n\n  assert (obj.name === \"ae\")\n})();\n\n(function tc_25_04_05__006() {\n  var p = Promise.resolve(1).then(function(x) {\n    assert(x === 1);\n    return Promise.resolve(2);\n  }).then(function(x) {\n    assert(x === 2);\n    return Promise.reject(3);\n  }).catch(function(x) {\n    assert(x === 3);\n  });\n})();\n\n(function tc_25_04_05__001() {\n  assert (Promise.length === 1);\n})();\n\n(function tc_25_04_05__003() {\n  var a = new Promise(function(f, r){\n    r(0);\n  });\n\n  a\n  .then(function f1(x) {\n    return x + 1;\n  }, function r1(x){\n    return x + 10;\n  })\n  .then(function f2(x) {\n    throw x + 100\n  })\n  .then(function f3(x) {\n    return x + 1000\n  }, function r3(x) {\n    return x + 10000\n  })\n  .then(function(x) {\n    assert (x === 10110);\n  })\n})();\n\n(function tc_25_04_05__005() {\n  Promise.reject(\"abc\").catch(function(x)\n  {\n    assert (x === \"abc\");\n    return \"def\";\n  }).then(function(x) {\n    assert (x === \"def\");\n  });\n})();\n\n(function tc_25_04_04__005() {\n  var a = Promise.resolve('a');\n  var b = Promise.resolve('b');\n  var c = Promise.reject('c');\n\n  Promise.all([a, b, 1]).then(function(x)\n  {\n    assert (x[0] === 'a');\n    assert (x[1] === 'b');\n    assert (x[2] === 1);\n  }, function(x)\n  {\n    assert (false);\n  });\n\n  Promise.all([a, b, c, 1]).then(function(x)\n  {\n    assert (false);\n  }, function(x)\n  {\n    assert (x === 'c');\n  });\n\n  Promise.all([]).then(function(x)\n  {\n    assert (x.length === 0);\n  }, function(x)\n  {\n    assert (false);\n  });\n\n  Promise.all(a).then(function(x)\n  {\n    assert (false);\n  }, function(x)\n  {\n    assert(x.name === \"TypeError\");\n  });\n})();\n\n(function tc_25_04_04__001() {\n  Promise.resolve(\"abc\").then(function(x)\n  {\n    assert (x === \"abc\");\n  });\n})();\n\n(function tc_25_04_04__003() {\n  Promise.reject(\"abc\").then(function(x)\n  {\n    assert (false);\n  }, function(x)\n  {\n    assert (x === \"abc\");\n  });\n})();\n\n(function tc_25_04_04__002() {\n  var a = new Promise(function(f)\n  {\n    var o = {name: \"abc\"};\n    f(o);\n  })\n\n  Promise.resolve(a).then(function(x)\n  {\n    assert (x.name === \"abc\");\n  });\n})();\n\n(function tc_25_04_04__004() {\n  var a = Promise.resolve('a');\n  var b = Promise.reject('b');\n\n  Promise.race([a, b]).then(function(x)\n  {\n    assert (x === 'a');\n  }, function(x)\n  {\n    assert (false);\n  });\n\n  Promise.race([b, a]).then(function(x)\n  {\n    assert (false);\n  }, function(x)\n  {\n    assert (x === 'b');\n  });\n\n  Promise.race([ ,b, a]).then(function(x)\n  {\n    assert (x === undefined);\n  }, function(x)\n  {\n    assert (false);\n  });\n\n  Promise.race(a).then(function(x)\n  {\n    assert (false);\n  }, function(x)\n  {\n    assert(x.name === \"TypeError\");\n  });\n})();\n\n(function tc_25_04_03__002() {\n  var name1 = \"\";\n  var name2 = \"\";\n  var name3 = \"\";\n  function foo() {};\n\n  try\n  {\n    new Promise();\n  }\n  catch (e)\n  {\n    name1 = e.name;\n  }\n\n  try\n  {\n    Promise(foo);\n  }\n  catch (e)\n  {\n    name2 = e.name;\n  }\n\n  try\n  {\n    new Promise(\"string\");\n  }\n  catch (e)\n  {\n    name3 = e.name;\n  }\n\n  assert (name1 === \"TypeError\");\n  assert (name2 === \"TypeError\");\n  assert (name3 === \"TypeError\");\n})();\n\n(function tc_25_04_03__001() {\n  function foo() {};\n\n  var a = new Promise(foo);\n\n  assert (a instanceof Promise);\n})();\n"
  },
  {
    "path": "tests/jerry/this-arg.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar i = 0;\n\nfunction a() {}\n\na.prototype.b = function() { i++; }\n\na.prototype.c = function() { this.b(); i++; }\n\nvar aa = new a();\naa.c();\n\nassert (i === 2);\n"
  },
  {
    "path": "tests/jerry/to-length.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction compareArray(a, b) {\n  if (b.length !== a.length) {\n    return false;\n  }\n\n  for (var i = 0; i < a.length; i++) {\n    if (b[i] !== a[i]) {\n      return false;\n    }\n  }\n  return true;\n}\n\n// concat\n(function() {\n  try {\n    Array.prototype.concat.call({}, {[Symbol.isConcatSpreadable]: true, length : 2 **53 - 1})\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n\n  try {\n    Array.prototype.concat.call([1, 2, 3, 4], {[Symbol.isConcatSpreadable]: true, length : 2 **53 - 4})\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n})();\n\n// fill\n(function() {\n  var obj = { length: 2 ** 53 - 1, [2 ** 53 - 5] : 'foo'}\n  Array.prototype.fill.call(obj, 'bar', 2 ** 53 - 5)\n\n  assert(obj[2 ** 53 - 5] === 'bar');\n  assert(obj[2 ** 53 - 4] === 'bar');\n  assert(obj[2 ** 53 - 3] === 'bar');\n  assert(obj[2 ** 53 - 2] === 'bar');\n\n  obj = { length: 2 ** 53 + 2, [2 ** 53 - 2] : 'foo'}\n  Array.prototype.fill.call(obj, 'bar', 2 ** 53 - 2)\n\n  assert(obj[2 ** 53 - 2] === 'bar');\n  assert(obj[2 ** 53 - 1] === undefined);\n})();\n\n// includes\n(function() {\n  var obj = { length: 2 ** 53 - 1, [2 ** 53 - 5] : 'foo'}\n  assert(Array.prototype.includes.call(obj, 'foo', 2 ** 53 - 10) === true);\n\n  var obj = { length: 2 ** 53 - 1, [2 ** 53 + 5] : 'foo'}\n  assert(Array.prototype.includes.call(obj, 'foo', 2 ** 53 - 10) === false);\n})();\n\n// indexOf\n(function() {\n  var obj = { length: 2 ** 53 - 1, [2 ** 53 - 5] : 'foo'}\n  assert(Array.prototype.indexOf.call(obj, 'foo', 2 ** 53 - 10) === 2 ** 53 - 5);\n\n  var obj = { length: 2 ** 53 - 1, [2 ** 53 + 5] : 'foo'}\n  assert(Array.prototype.indexOf.call(obj, 'foo', 2 ** 53 - 10) === -1);\n})();\n\n// lastIndexOf\n(function() {\n  var obj = { length: 2 ** 53 - 1, [2 ** 53 - 5] : 'foo', [2 ** 53 - 6] : 'foo'}\n  assert(Array.prototype.lastIndexOf.call(obj, 'foo', 2 ** 53 - 2) === 2 ** 53 - 5);\n\n  var obj = { length: 2 ** 53 - 1, [2 ** 53 - 5] : 'foo', [2 ** 53 - 6] : 'foo'}\n  assert(Array.prototype.lastIndexOf.call(obj, 'foo', 10) === -1);\n})();\n\n\n// pop\n(function() {\n  var obj = { length: 2 ** 53 - 1, [2 ** 53 - 2] : 'foo', [2 ** 53 - 3] : 'bar'}\n  assert(Array.prototype.pop.call(obj) === 'foo');\n  assert(obj.length === 2 ** 53 - 2);\n\n  assert(Array.prototype.pop.call(obj) === 'bar');\n  assert(obj.length === 2 ** 53 - 3);\n})();\n\n// push\n(function() {\n  var obj = { length: 2 ** 53 - 1 };\n  try {\n    Array.prototype.push.call(obj, 'foo');\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n\n  var obj = { length: 2 ** 53 - 2, [2 ** 53 - 3] : 'foo'}\n\n  assert(Array.prototype.push.call(obj, 'bar') === 2 ** 53 - 1);\n  assert(obj.length === 2 ** 53 - 1);\n})();\n\n// slice\n(function() {\n  var obj = { length: 2 ** 53 - 1, [2 ** 53 - 5] : 'foo', [2 ** 53 - 2] : 'bar'};\n  var sliced = Array.prototype.slice.call(obj, 2 ** 53 - 10);\n  assert(compareArray(sliced, [,,,,,'foo',,,'bar']));\n\n  var sliced = Array.prototype.slice.call(obj, 2 ** 53 - 8, 2 ** 53 - 4);\n  assert(compareArray(sliced, [,,,'foo',]));\n})();\n\n// splice\n(function() {\n  var obj = { length: 2 ** 53 - 1, [2 ** 53 - 5] : 'foo', [2 ** 53 - 2] : 'bar'};\n  var spliced = Array.prototype.splice.call(obj, 2 ** 53 - 10, 5, '1', '2', '3', '4');\n  assert(compareArray(spliced, [,,,,,]));\n  assert(obj.length === 2 ** 53 - 2);\n  assert(obj[2 ** 53 - 3] === 'bar');\n  assert(obj[2 ** 53 - 6] === 'foo');\n  assert(obj[2 ** 53 - 7] === '4');\n  assert(obj[2 ** 53 - 8] === '3');\n  assert(obj[2 ** 53 - 9] === '2');\n  assert(obj[2 ** 53 - 10] === '1');\n})();\n\n// unshift\n(function() {\n  var obj = { length: 2 ** 53 - 1 };\n  try {\n    Array.prototype.unshift.call(obj, 'foo');\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n})();\n"
  },
  {
    "path": "tests/jerry/to-number-string.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nassert(+\"0b1101001\" === 105);\nassert(+\"0B1101001\" === 105);\nassert(+\"0o767\" === 503);\nassert(+\"0O767\" === 503);\n\nfunction assertNaN(str) {\n  assert(isNaN(+str));\n}\n\nassertNaN(\"0b\");\nassertNaN(\"0b12\");\nassertNaN(\"0b10101100103\");\nassertNaN(\"0b101foo\");\nassertNaN(\"0bfoo101\");\nassertNaN(\"0b12345\");\n\nassertNaN(\"0B\");\nassertNaN(\"0B12\");\nassertNaN(\"0B10101100103\");\nassertNaN(\"0B101foo\");\nassertNaN(\"0Bfoo101\");\nassertNaN(\"0B12345\");\n\nassertNaN(\"0o\");\nassertNaN(\"0o1289\");\nassertNaN(\"0o88888\");\nassertNaN(\"0o12345foo\");\nassertNaN(\"0ofoo12345\");\n\nassertNaN(\"0O\");\nassertNaN(\"0O1289\");\nassertNaN(\"0O88888\");\nassertNaN(\"0O12345foo\");\nassertNaN(\"0Ofoo12345\");\n"
  },
  {
    "path": "tests/jerry/to-property-key.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/* Test if the ToPropertyKey operation calls the @@ToPrimitive symbol */\n\nvar obj_A = {};\nvar sym = Symbol();\n\nvar toprimitive_called = 0;\n\nvar wrap = {\n    [Symbol.toPrimitive]: function() {\n        toprimitive_called++;\n        return sym;\n    }\n};\n\n/* <object>.hasOwnProperty calls the ToPropertyKey operation */\nassert (obj_A.hasOwnProperty (wrap) === false);\nassert (toprimitive_called === 1);\n\n/* \"in\" operator calls the ToPropertyKey operation */\nassert ((wrap in obj_A) === false);\nassert (toprimitive_called === 2);\n\nobj_A[sym] = 0;\n\n/* <object>.hasOwnProperty calls the ToPropertyKey operation */\nassert (obj_A.hasOwnProperty (wrap) === true);\nassert (toprimitive_called === 3);\n\n/* \"in\" operator calls the ToPropertyKey operation */\nassert ((wrap in obj_A) === true);\nassert (toprimitive_called === 4);\n\n\nvar obj_B = {};\n\n/* <object>.hasOwnProperty calls the ToPropertyKey operation */\nassert (obj_B.hasOwnProperty (wrap) === false);\nassert (toprimitive_called === 5);\n\n/* Object.defineProperty calls the ToPropertyKey operation */\nObject.defineProperty (obj_B, wrap, {\n  value: -1,\n  enumerable: false,\n  configurable: true,\n  writable: true\n});\nassert (toprimitive_called === 6);\n\nassert (obj_B[sym] === -1);\n\n/* Object.getOwnPropertyDescriptor calls the ToPropertyKey operation */\nvar desc = Object.getOwnPropertyDescriptor (obj_B, wrap);\nassert (toprimitive_called === 7);\n\nassert (desc.value === -1);\nassert (desc.enumerable === false);\nassert (desc.configurable === true);\nassert (desc.writable === true);\n\n/* Reflect.get calls the ToPropertyKey operation */\nassert (Reflect.get (obj_B, wrap) === -1);\nassert (toprimitive_called === 8);\n\n/* Reflect.deleteProperty calls the ToPropertyKey operation */\nassert (Reflect.deleteProperty (obj_B, wrap) === true);\nassert (toprimitive_called === 9);\n\n/* Reflect.has calls the ToPropertyKey operation */\nassert (Reflect.has (obj_B, wrap) === false);\nassert (toprimitive_called === 10);\n\n/* Reflect.defineProperty calls the ToPropertyKey operation */\nReflect.defineProperty (obj_B, wrap, {\n  value: 50,\n  enumerable: false,\n  configurable: true,\n  writable: true\n});\n\nassert (toprimitive_called === 11);\n\n/* Reflect.getOwnPropertyDescriptor calls the ToPropertyKey operation */\nvar desc_B = Reflect.getOwnPropertyDescriptor (obj_B, wrap);\nassert (toprimitive_called === 12);\n\nassert (desc_B.value === 50);\nassert (desc_B.enumerable === false);\nassert (desc_B.configurable === true);\nassert (desc_B.writable === true);\n\n/* Delete calls the ToPropertyKey operation */\ndelete obj_B[wrap];\nassert (toprimitive_called === 13);\n\n/* Get calls the ToPropertyKey operation */\nassert (obj_B[wrap] === undefined);\nassert (toprimitive_called === 14);\n\n/* Computed property calls the ToPropertyKey operation */\nvar obj_C = {\n    [wrap]: function() { return 100; }\n};\nassert (toprimitive_called === 15);\nassert (obj_C[sym]() === 100);\n\n/* Setter/Getter will each call the ToPropertyKey operation */\nvar obj_D = {\n    get [wrap] () { return 150; },\n    set [wrap] (value) { }\n};\nassert (toprimitive_called === 17);\nassert (obj_D[sym] === 150);\n"
  },
  {
    "path": "tests/jerry/try-catch-finally.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar was_catch = false, was_finally = false;\n\ntry {\n} catch (err) {\n  was_catch = true;\n} finally {\n  was_finally = true;\n}\n\nassert (!was_catch && was_finally);\n\nwas_catch = false;\nwas_finally = false;\n\ntry {\n  throw 1;\n  assert (0);\n} catch (err) {\n  assert (err === 1);\n  was_catch = true;\n} finally {\n  was_finally = true;\n}\n\nassert (was_catch && was_finally);"
  },
  {
    "path": "tests/jerry/try-catch.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar e = -1\n\nfunction f1()\n{\n  assert(e === undefined)\n  try {\n    throw 0\n  } catch (e) {\n    var e = 1\n    assert(e === 1)\n  }\n  assert(e === undefined)\n}\nf1()\n\nfunction f2()\n{\n  assert(e === undefined)\n  try {\n    throw 0\n  } catch (e) {\n    {\n      var e = 2\n      assert(e === 2)\n    }\n    assert(e === 2)\n  }\n  assert(e === undefined)\n}\nf2()\n\nfunction f3()\n{\n  assert(e === -1)\n  try {\n    throw [0]\n  } catch ([e]) {\n    {\n      try {\n        eval(\"var e = 2\")\n        assert(false)\n      } catch (e) {\n        assert(e instanceof SyntaxError)\n      }\n    }\n    assert(e === 0)\n  }\n  assert(e === -1)\n}\nf3()\n\nfunction f4()\n{\n  assert(e === undefined)\n  try {\n    throw 0\n  } catch (e) {\n    {\n      function e() { return 3 }\n      assert(e() === 3)\n    }\n    assert(e === 0)\n  }\n  assert(e() === 3)\n}\nf4()\n\nfunction f5()\n{\n  assert(e === -1)\n  try {\n    throw 0\n  } catch (e) {\n    {\n      eval(\"function e() { return 3 } assert(e === 0)\")\n      assert(e === 0)\n    }\n    assert(e === 0)\n  }\n  assert(e() === 3)\n}\nf5()\n\nfunction f6()\n{\n  let e = 4;\n  assert(e === 4)\n  try {\n    throw 0\n  } catch (e) {\n    {\n      function e() { return 5 }\n      assert(e() === 5)\n    }\n    assert(e === 0)\n  }\n  assert(e === 4)\n}\nf6()\n\nfunction f7()\n{\n  let e = 6;\n  assert(e === 6)\n  try {\n    throw 0\n  } catch (e) {\n    {\n      eval(\"function e() { return 7 } assert(e() === 7)\")\n    }\n    assert(e === 0)\n  }\n  assert(e === 6)\n}\nf7()\n\nfunction f8()\n{\n  var cnt = 0;\n\n  try {\n    throw \"A\"\n    asert(false)\n  } catch {\n    cnt++\n  }\n\n  let i = 0\n  const j = 0\n\n  try {\n    throw {}\n    asert(false)\n  } catch {\n    const i = 1.5\n    let j = 2\n    cnt += i * j\n  }\n\n  assert(i === 0)\n  assert(j === 0)\n  return cnt\n}\n\ntry {\n  assert(f8() === 4)\n} catch {\n  assert(false)\n}\n"
  },
  {
    "path": "tests/jerry/try-eval.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  e;\n  assert (false);\n} catch (e) {\n  eval(\"var e\");\n}\nassert (e === undefined);\n\nfunction f() {\n  try {\n    throw 1;\n    assert (false);\n  } catch (e) {\n    eval(\"var e\");\n  }\n}\nf();\n"
  },
  {
    "path": "tests/jerry/try-pattern.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_syntax_error(code)\n{\n  try {\n    eval(code);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof SyntaxError);\n  }\n}\n\ncheck_syntax_error(\"try {} catch() {}\");\ncheck_syntax_error(\"try {} catch([a] {}\");\ncheck_syntax_error(\"try {} catch([a] = [1]) {}\");\ncheck_syntax_error(\"try {} catch({a} = {a:1}) {}\");\ncheck_syntax_error(\"try {} catch(a,) {}\");\ncheck_syntax_error(\"try {} catch(a) { function a() {} }\");\ncheck_syntax_error(\"try {} catch(a) { { function a() {} } function a() {} }\");\ncheck_syntax_error(\"try {} catch([a]) { var a }\");\ncheck_syntax_error(\"try {} catch([a]) { { var a } }\");\ncheck_syntax_error(\"try {} catch([a]) { function a() {} }\");\n\ntry {\n  throw [1,2]\n  assert(false)\n} catch ([a, b]) {\n  assert(a === 1)\n  assert(b === 2)\n}\n\ntry {\n  throw { x:1, y:2 }\n  assert(false)\n} catch ({x, 'y':b}) {\n  assert(x === 1)\n  assert(b === 2)\n}\n\ntry {\n  throw [1,2]\n  assert(false)\n} catch ([a, b]) {\n  eval(\"assert(a === 1)\")\n  eval(\"assert(b === 2)\")\n}\n\ntry {\n  throw { x:1, y:2 }\n  assert(false)\n} catch ({x, 'y':b}) {\n  eval(\"assert(x === 1)\")\n  eval(\"assert(b === 2)\")\n}\n\ntry {\n  try {\n    throw []\n    assert(false)\n  } catch ([a = b, b]) {\n    assert(false)\n  }\n} catch (e) {\n  assert(e instanceof ReferenceError)\n}\n\ntry {\n  throw [{a : 5}];\n} catch([{a}]) {\n  assert(a === 5);\n}\n\nvar catchReached = false;\ntry {\n  throw [{}];\n  assert(false);\n} catch([{}]) {\n  catchReached = true;\n}\n\nassert(catchReached);\n"
  },
  {
    "path": "tests/jerry/typedArray-constructor.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction check_range_error(code)\n{\n  try {\n    eval(code);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof RangeError);\n  }\n}\n\n// Invalid cases\n\ncheck_range_error(\"new Uint8Array(1e15)\");\ncheck_range_error(\"new Uint8Array(4294967296)\");\ncheck_range_error(\"new Uint8Array(4294967296 - 1)\");\ncheck_range_error(\"new Uint8Array(-1)\");\n\n// Valid cases\nassert((new Uint8Array(3.5)).length === 3)\nassert((new Uint8Array(-0.5)).length === 0)\n"
  },
  {
    "path": "tests/jerry/typedArray-fill.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar a = new Int32Array([1, 2, 3, 4, 5]);\nassert(a.fill(0).toString() === '0,0,0,0,0');\nassert(a.toString() === '0,0,0,0,0');\nassert(a.fill(1, 3).toString() === '0,0,0,1,1');\nassert(a.toString() === '0,0,0,1,1');\nassert(a.fill(2, 1, 3).toString() === '0,2,2,1,1');\nassert(a.toString() === '0,2,2,1,1');\nassert(a.fill(3, -3).toString() === '0,2,3,3,3');\nassert(a.toString() === '0,2,3,3,3');\nassert(a.fill(4, -3, -1).toString() === '0,2,4,4,3');\nassert(a.toString() === '0,2,4,4,3');\nassert(a.fill(5, 3, 2).toString() === '0,2,4,4,3');\nassert(a.toString() === '0,2,4,4,3');\nassert(a.fill(6, -2, -3).toString() === '0,2,4,4,3');\nassert(a.toString() === '0,2,4,4,3');\nassert(a.fill(7, 4, 1).toString() === '0,2,4,4,3');\nassert(a.toString() === '0,2,4,4,3');\nassert(a.fill(8, -1, -4).toString() === '0,2,4,4,3');\nassert(a.toString() === '0,2,4,4,3');\nassert(a.fill(9, 1).fill(10, 1).toString() === '0,10,10,10,10');\nassert(a.toString() === '0,10,10,10,10');\nassert(a.fill(11, 0, 4).fill(12, 1, 2).toString() === '11,12,11,11,10');\nassert(a.toString() === '11,12,11,11,10');\nassert(a.fill(13, 999, 1000).fill(14, -1000, -999).toString() === '11,12,11,11,10');\nassert(a.toString() === '11,12,11,11,10');\nassert(a.fill(14, 0, 0).toString() === '11,12,11,11,10');\nassert(a.toString() === '11,12,11,11,10');\nassert(a.fill(15, a.length, a.length).toString() === '11,12,11,11,10');\nassert(a.toString() === '11,12,11,11,10');\nassert(a.fill(NaN).toString() === '0,0,0,0,0'); // NaN gets coerced into an integer.\nassert(a.toString() === '0,0,0,0,0');\nassert(a.fill({ valueOf: () => 16 }).toString() === '16,16,16,16,16');\nassert(a.toString() === '16,16,16,16,16');\n\nvar b = new Uint8Array();\nassert(b.fill(1).toString() === '');\nassert(b.toString() === '');\nassert(b.fill(2, 0, 0).toString() === '');\nassert(b.toString() === '');\nassert(b.fill(3, b.length, b.length).toString() === '');\nassert(b.toString() === '');\n\nvar c = new Uint8Array([0]);\nassert(c.fill(256).toString() === '0');\nassert(c.toString() === '0');\nassert(c.fill(257).toString() === '1');\nassert(c.toString() === '1');\n\ntry {\n  c.fill({});\n} catch (e) {\n  assert(e instanceof TypeError);\n  assert(c.toString() === '1');\n}\n\nvar d = new Float32Array([0]);\nassert(d.fill(NaN).toString() === 'NaN');\nassert(d.toString() === 'NaN');\n\nvar ab = new ArrayBuffer(4);\nvar e = new Uint8Array(ab);\nassert(e.fill(0).toString() === '0,0,0,0');\n\nvar f = new Uint32Array(ab);\nassert(f.fill(1).toString() === '1');\nassert(e.toString() === '1,0,0,0');\n\nvar g = new Uint8Array(ab, 1, 2);\nassert(g.toString() === '0,0');\nassert(g.fill(2).toString() === '2,2');\nassert(e.toString() === '1,2,2,0');\nassert(g.fill(3, -1).toString() === '2,3');\nassert(e.toString() === '1,2,3,0');\nassert(g.fill(4, 0, 2).toString() === '4,4');\nassert(e.toString() === '1,4,4,0');\nassert(g.fill(5, 0, 999).toString() === '5,5');\nassert(e.toString() === '1,5,5,0');\nassert(g.fill(6, -999, 999).toString() === '6,6');\nassert(e.toString() === '1,6,6,0');\nassert(g.fill(7, -999, 0).toString() === '6,6');\nassert(e.toString() === '1,6,6,0');\n\nvar ab2 = new ArrayBuffer(4);\nvar h = new Uint8Array(ab2);\nvar i = new Uint16Array(ab2, 0, 1);\nassert(i.fill(1).toString() === '1');\nassert(h.toString() === '1,0,0,0');\nvar j = new Uint16Array(ab2, 2, 1);\nassert(j.fill(1).toString() === '1');\nassert(h.toString() === '1,0,1,0');\n\nvar k = new BigInt64Array([1n, 2n, 3n, 4n, 5n]);\nassert(k.fill(1n, 1, 4).toString() === '1,1,1,1,5');\nassert(k.fill(18446744073709551616n, 0, 5).toString() === '0,0,0,0,0');\nassert(k.fill(-5n, 3, 5).toString() === '0,0,0,-5,-5');\n\nvar l = new BigUint64Array([1n, 2n, 3n, 4n, 5n]);\nassert(l.fill(-18446744073709551614n, 3, 5).toString() === '1,2,3,2,2');\nassert(l.fill(18446744073709551614n, 4).toString() === '1,2,3,2,18446744073709551614');\n\nvar cd = new SharedArrayBuffer(4);\nvar u8array = new Uint8Array(cd);\nassert(u8array.fill(0).toString() === '0,0,0,0');\n\nvar invalid = {\n  valueOf: function() {\n    throw new Error();\n  }\n};\n\nvar n = new BigInt64Array();\ntry {\n  n.fill(1n, invalid);\n  assert(false)\n} catch (e) {\n  assert(e instanceof Error);\n}\n\ntry {\n  n.fill(1n, 0, invalid);\n  assert(false)\n} catch (e) {\n  assert(e instanceof Error);\n}\n"
  },
  {
    "path": "tests/jerry/typedArray-find-index.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrow_is_available = false;\n\ntry {\n  assert (eval (\"(f => 5) ()\") === 5);\n  arrow_is_available = true;\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nvar typedArrayTypes = [Int8Array,\n                       Uint8Array,\n                       Uint8ClampedArray,\n                       Int16Array,\n                       Uint16Array,\n                       Int32Array,\n                       Uint32Array,\n                       Float32Array,\n                       Float64Array];\n\n\ntypedArrayTypes.forEach (function (TypedArray) {\n\n  var array1 = new TypedArray ([5, 12, 0, 8, 120, 44]);\n\n  function bigger_than_10 (element) {\n    return element > 10;\n  }\n\n  assert (array1.findIndex (bigger_than_10) === 1);\n\n  function less_than_0 (element) {\n    if (element == 0) {\n      throw new Error (\"zero\");\n    }\n    return element < 0;\n  }\n\n  try {\n    array1.findIndex (less_than_0);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof Error);\n    assert (e.message === \"zero\");\n  }\n\n  if (arrow_is_available) {\n    assert (eval (\"array1.findIndex (e => e > 100)\") === 4);\n  }\n\n  /* Test the callback function arguments */\n  var src_array = new TypedArray ([4, 6, 8, 12]);\n  var array_index = 0;\n\n  function isPrime (element, index, array) {\n    assert (array_index++ === index);\n    assert (array === src_array)\n    assert (element === array[index]);\n\n    var start = 2;\n    while (start <= Math.sqrt (element)) {\n      if (element % start++ < 1) {\n        return false;\n      }\n    }\n    return element > 1;\n  }\n\n  assert (src_array.findIndex (isPrime) === -1);\n\n  src_array = new TypedArray ([4, 5, 8, 12]);\n  array_index = 0;\n  assert (src_array.findIndex (isPrime) === 1);\n\n  // Checking behavior when the given object is not %TypedArray%\n  try {\n    TypedArray.prototype.findIndex.call (5);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  // Checking behavior when the first argument is not a callback\n  var array = new TypedArray ([1, 2, 3]);\n\n  try {\n    array.findIndex (5);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  // Checking behavior when the first argument does not exist\n  try {\n    array.findIndex ();\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  // Checking behavior when there are more than 2 arguments\n  assert (array.findIndex (function (e) { return e < 2 }, {}, 8, 4, 5, 6, 6) === 0);\n})\n\nfunction isNegative(element, index, array) {\n  return element < 0;\n}\n\nfunction isBigger(element, index, array) {\n  return element > 40n;\n}\n\nvar bigint_array = new BigInt64Array([10n, -20n, 30n, -40n, 50n]);\nvar biguint_array = new BigUint64Array([10n, 20n, 30n, 40n, 50n]);\n\nassert(bigint_array.findIndex(isNegative) === 1);\nassert(biguint_array.findIndex(isBigger) === 4);\n"
  },
  {
    "path": "tests/jerry/typedArray-find.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar arrow_is_available = false;\n\ntry {\n  assert (eval (\"(f => 5) ()\") === 5);\n  arrow_is_available = true;\n} catch (e) {\n  assert (e instanceof SyntaxError);\n}\n\nvar typedArrayTypes = [Int8Array,\n                       Uint8Array,\n                       Uint8ClampedArray,\n                       Int16Array,\n                       Uint16Array,\n                       Int32Array,\n                       Uint32Array,\n                       Float32Array,\n                       Float64Array];\n\n\ntypedArrayTypes.forEach (function (TypedArray) {\n\n  var array1 = new TypedArray ([5, 12, 0, 8, 120, 44]);\n\n  function bigger_than_10 (element) {\n    return element > 10;\n  }\n\n  assert (array1.find (bigger_than_10) === 12);\n\n  function less_than_0 (element) {\n    if (element == 0) {\n      throw new Error (\"zero\");\n    }\n    return element < 0;\n  }\n\n  try {\n    array1.find (less_than_0);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof Error);\n    assert (e.message === \"zero\");\n  }\n\n  if (arrow_is_available) {\n      assert (eval (\"array1.find (e => e > 100)\") === 120);\n  }\n\n  /* Test the callback function arguments */\n  var src_array = new TypedArray ([4, 6, 8, 12]);\n  var array_index = 0;\n\n  function isPrime (element, index, array) {\n    assert (array_index++ === index);\n    assert (array === src_array)\n    assert (element === array[index]);\n\n    var start = 2;\n    while (start <= Math.sqrt (element)) {\n      if (element % start++ < 1) {\n        return false;\n      }\n    }\n    return element > 1;\n  }\n\n  assert (src_array.find (isPrime) === undefined);\n\n  src_array = new TypedArray ([4, 5, 8, 12]);\n  array_index = 0;\n  assert (src_array.find (isPrime) === 5);\n\n  // Checking behavior when the given object is not %TypedArray%\n  try {\n    TypedArray.prototype.find.call (5);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  // Checking behavior when the first argument is not a callback\n  var array = new TypedArray ([1, 2, 3]);\n\n  try {\n    array.find (5);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  // Checking behavior when the first argument is not exists\n  try {\n    array.find ();\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  // Checking behavior when the there are more than 2 arguments\n  assert (array.find (function (e) { return e < 2 }, {}, 8, 4, 5, 6, 6) === 1);\n})\n"
  },
  {
    "path": "tests/jerry/typedArray-join.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar float_array = new Float32Array([1.125, 5.5, -1.25, -0.0]);\nvar int_array = new Int8Array([3, 2, 1, 100, -30]);\nvar uint_array = new Uint8Array([3, 2, 1, 100, -30]);\nvar empty_array = new Uint32Array();\n\nassert(float_array.join() === float_array.toString());\nassert(int_array.join('-') === \"3-2-1-100--30\");\nassert(uint_array.join('=') === \"3=2=1=100=226\");\nassert(empty_array.join('_') === \"\");\n"
  },
  {
    "path": "tests/jerry/typedArray-set-with-typedArray.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar a = new Int32Array([1, 2, 3, 4, 5]);\nvar b = new Int32Array(5);\n\ntry {\n  a.set(b, 123456);\n  assert(1 === 0); // Should not get here.\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\nb.set(a);\nassert(b.join() === '1,2,3,4,5');\ntry {\n  b.set(a, 1);\n  assert(1 === 0); // Should not get here.\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\nb.set(new Int32Array([99, 98]), 2);\nassert(b.join() === '1,2,99,98,5');\n\nb.set(new Int32Array([99, 98, 97]), 2);\nassert(b.join() === '1,2,99,98,97');\n\ntry {\n  b.set(new Int32Array([99, 98, 97, 96]), 2);\n  assert(1 === 0); // Should not get here.\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\ntry {\n  b.set([101, 102, 103, 104], 4);\n  assert(1 === 0); // Should not get here.\n} catch (e) {\n  assert(e instanceof RangeError);\n}\n\n//  ab = [ 0, 1, 2, 3, 4, 5, 6, 7 ]\n//  a1 = [ ^, ^, ^, ^, ^, ^, ^, ^ ]\n//  a2 =             [ ^, ^, ^, ^ ]\nvar ab = new ArrayBuffer(8);\nvar a1 = new Uint8Array(ab);\nfor (var i = 0; i < a1.length; i += 1) {\n  a1.set([i], i);\n}\n\nvar a2 = new Uint8Array(ab, 4);\na1.set(a2, 2);\nassert(a1.join() === '0,1,4,5,6,7,6,7');\nassert(a2.join() === '6,7,6,7');\n\nvar a3 = new Uint32Array(ab, 4);\na1.set(a3, 2);\nassert(a1.join() === '0,1,6,5,6,7,6,7');\nassert(a3.join() === '117835526');\n\nvar a4 = new Uint8Array(ab, 0, 4);\na1.set(a4, 2);\nassert(a1.join() === '0,1,0,1,6,5,6,7');\nassert(a4.join() === '0,1,0,1');\n\nvar a5 = new Uint32Array(ab, 4, 1);\na1.set(a5, 2);\nassert(a1.join() === '0,1,6,1,6,5,6,7');\nassert(a5.join() === '117835014');\n\nvar c = new Int32Array([0xFFFFFFFF]);\nvar d = new Uint8Array(4);\nd.set(c);\nassert(d.join() === '255,0,0,0');\n\nvar e = new Float32Array([3.33]);\nvar f = new Uint8Array(1);\nf.set(e);\nassert(f.join() === '3');\ne.set(f);\nassert(e.join() === '3');\n"
  },
  {
    "path": "tests/jerry/typedArray-sort.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Default sorting behavior.\nvar a = Uint8Array.from([4, 1, 3, 5, 4, 2]);\nassert(a.sort().toString() === '1,2,3,4,4,5');\nassert(a.toString() === '1,2,3,4,4,5');\n\n// Views into typedarrays should be properly sorted.\nvar b = Uint8Array.from([2, 1, 4, 3, 0]);\nassert(b.subarray(2, 4).sort().toString() === '3,4');\nassert(b.toString() === '2,1,3,4,0');\n\n// Empty typedarrays should be able to be \"sorted\".\nvar c = Uint8Array.from([]);\nassert(c.sort().toString() === '');\n\n// Infinity should be supported.\nvar d = Float32Array.from([Infinity, 3, 2, 1, -Infinity]);\nassert(d.sort().toString() === '-Infinity,1,2,3,Infinity');\n\n// +0 and -0 should be properly sorted.\nvar e = Float32Array.from([1, 0, -0, -1]);\nassert(e.sort().toString() === '-1,0,0,1');\n\n// NaN should be supported and always at the end.\nvar f = Float32Array.from([NaN, 0, 1, -1, -Infinity, Infinity, NaN]);\nassert(f.sort().toString() === '-Infinity,-1,0,1,Infinity,NaN,NaN');\n\n// The element size of the view should be sorted properly.\nvar ab = new ArrayBuffer(4);\nvar g = new Uint32Array(ab);\nvar h = new Uint8Array(ab);\nh.set([0xFF, 0, 0xFF, 0]);\nassert(h.toString() === '255,0,255,0');\nassert(g.toString() === '16711935');\nassert(h.subarray(0, 2).sort().toString() === '0,255');\nassert(h.subarray(2, 4).sort().toString() === '0,255');\nassert(g.toString() === '4278255360');\nassert(g.sort().toString() === '4278255360');\nassert(h.toString() === '0,255,0,255');\n\n// Comparator argument should be callable.\nvar i = Uint8Array.from([1, 2, 3]);\ntry {\n  i.sort({});\n  assert(false);\n} catch (e) {\n  assert(e instanceof TypeError);\n}\n\n// Comparator function returns a Number.\ni.sort(function (lhs, rhs) {\n  return rhs - lhs;\n});\nassert(i.toString() === '3,2,1');\n\n// Comparator function returns a non-Number type that coerces to a Number.\ni.sort(function (lhs, rhs) {\n  return { valueOf: function() { return rhs - lhs; } };\n});\nassert(i.toString() === '3,2,1');\n"
  },
  {
    "path": "tests/jerry/typedArray-stringify.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar float_array = new Float32Array([1.125, 5.5, -1.25, -0.0]);\nvar int_array = new Int8Array([3, 2, 1, 100, -30])\nvar uint_array = new Uint8Array([3, 2, 1, 100, -30])\nvar empty_array = new Uint32Array();\n\nassert((JSON.stringify(float_array)) === '{\"0\":1.125,\"1\":5.5,\"2\":-1.25,\"3\":0}');\nassert((JSON.stringify(int_array)) === '{\"0\":3,\"1\":2,\"2\":1,\"3\":100,\"4\":-30}');\nassert((JSON.stringify(uint_array)) === '{\"0\":3,\"1\":2,\"2\":1,\"3\":100,\"4\":226}');\nassert((JSON.stringify(empty_array)) === '{}');\n"
  },
  {
    "path": "tests/jerry/typedArray-subarray.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar a = new Int32Array([1, 2, 3, 4, 5]);\nassert(a.subarray().toString() === '1,2,3,4,5');\nassert(a.subarray(3).toString() === '4,5');\nassert(a.subarray(1, 3).toString() === '2,3');\nassert(a.subarray(-3).toString() === '3,4,5');\nassert(a.subarray(-3, -1).toString() === '3,4');\nassert(a.subarray(3, 2).toString() === '');\nassert(a.subarray(-2, -3).toString() === '');\nassert(a.subarray(4, 1).toString() === '');\nassert(a.subarray(-1, -4).toString() === '');\nassert(a.subarray(1).subarray(1).toString() === '3,4,5');\nassert(a.subarray(1, 4).subarray(1, 2).toString() === '3');\n\nvar b = new Uint8Array([]);\nassert(b.subarray(123456, -123456).toString() === '');\nassert(b.subarray().subarray().toString() === '');\n\nvar ab = new ArrayBuffer(28);\nvar tmp = new Int32Array(ab);\ntmp.set([0, 1, 2, 3, 4, 5, 0]);\nvar c = new Int32Array(ab, 4, 5);\nassert(c.toString() === '1,2,3,4,5');\nassert(c.subarray().toString() === '1,2,3,4,5');\nassert(c.subarray(3).toString() === '4,5');\nassert(c.subarray(1, 3).toString() === '2,3');\nassert(c.subarray(-3).toString() === '3,4,5');\nassert(c.subarray(-3, -1).toString() === '3,4');\nassert(c.subarray(3, 2).toString() === '');\nassert(c.subarray(-2, -3).toString() === '');\nassert(c.subarray(4, 1).toString() === '');\nassert(c.subarray(-1, -4).toString() === '');\nassert(c.subarray(1).subarray(1).toString() === '3,4,5');\nassert(c.subarray(1, 4).subarray(1, 2).toString() === '3');\n\nvar cd = new SharedArrayBuffer(28);\ntmp = new Int32Array(cd);\ntmp.set([0, 1, 2, 3, 4, 5, 0]);\nvar d = new Int32Array(cd, 4, 5);\nassert(d.subarray().toString() === '1,2,3,4,5');\nassert(d.subarray(3).toString() === '4,5');\nassert(d.subarray(1, 3).toString() === '2,3');\nassert(d.subarray(1, 3).toString() === '2,3');\nassert(d.subarray(-3).toString() === '3,4,5');\nassert(d.subarray(-3, -1).toString() === '3,4');\nassert(d.subarray(3, 2).toString() === '');\nassert(d.subarray(-2, -3).toString() === '');\nassert(d.subarray(4, 1).toString() === '');\nassert(d.subarray(-1, -4).toString() === '');\nassert(d.subarray(1).subarray(1).toString() === '3,4,5');\nassert(d.subarray(1, 4).subarray(1, 2).toString() === '3');\n"
  },
  {
    "path": "tests/jerry/typedArray-tostring.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar float_array = new Float32Array([1.125, 5.5, -1.25, -0.0]);\nvar int_array = new Int8Array([3, 2, 1, 100, -30])\nvar uint_array = new Uint8Array([3, 2, 1, 100, -30])\nvar empty_array = new Uint32Array();\n\nassert(float_array.toString() === \"1.125,5.5,-1.25,0\");\nassert(int_array.toString() === \"3,2,1,100,-30\");\nassert(uint_array.toString() === \"3,2,1,100,226\");\nassert(empty_array.toString() === \"\");\n"
  },
  {
    "path": "tests/jerry/typedarray-from.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar typedArrayConstructors = [\n    Uint8Array,\n    Int8Array,\n    Uint16Array,\n    Int16Array,\n    Uint32Array,\n    Int32Array,\n    Uint8ClampedArray,\n    Float32Array,\n    Float64Array\n];\n\nvar set = new Set([1,2,3]);\n\nvar foo = {};\nvar bar = {};\nvar weak_set = new WeakSet();\nweak_set.add(foo);\nweak_set.add(bar);\n\nvar string = new String('123');\n\nvar map = new Map();\nmap.set(0, 'zero');\nmap.set(1, 'one');\n\nvar weak_map = new WeakMap();\nweak_map.set(foo, 'foo');\nweak_map.set(bar, 'bar');\n\nvar string = '123';\n\nfor (var constructor of typedArrayConstructors)\n{\n    assert(constructor.from.length === 1);\n\n    try {\n      function f() {constructor.from.call(Array, []);}\n    } catch (e) {\n      assert(e instanceof TypeError); \n    }\n\n    assert(constructor.from(set).toString() === '1,2,3');\n    assert(constructor.from(weak_set).toString() === '');\n\n    if (constructor == Float32Array || constructor == Float64Array)\n    {\n        assert(constructor.from(map).toString() === 'NaN,NaN');\n    }\n    else\n    {\n        assert(constructor.from(map).toString() === '0,0');\n    }\n\n    assert(constructor.from(weak_map).toString() === '');\n    assert(constructor.from(string).toString() === '1,2,3');\n\n    try {\n      function f() {constructor.from.call({}, []);}\n    } catch (e) {\n      assert(e instanceof TypeError);\n    }\n\n    try {\n      function f() {constructor.from.call([], []);}\n    } catch (e) {\n      assert(e instanceof TypeError);\n    }\n\n    try {\n      function f() {constructor.from.call(1, []);}\n    } catch (e) {\n      assert(e instanceof TypeError);\n    }\n\n    try {\n      function f() {constructor.from.call(undefined, []);}\n    } catch (e) {\n      assert(e instanceof TypeError);\n    }\n\n    assert(constructor.from([1,2,3,4]).toString() === '1,2,3,4');\n    assert(constructor.from([12,45]).toString() === '12,45');\n    assert(constructor.from(NaN).toString() === '');\n    assert(constructor.from(Infinity).toString() === '');\n\n    assert(constructor.from([4,5,6], x => x + 1).toString() === '5,6,7');\n    assert(constructor.from([2,4,8], x => x * 2).toString() === '4,8,16');\n\n    try {\n      constructor.from([1,2,3], x => {throw 5});\n      assert(false);\n    } catch (e) {\n      assert(e === 5);\n    }\n\n    try {\n      constructor.from([Symbol.match]);\n      assert(false);\n    } catch (e) {\n      assert(e instanceof TypeError);\n    }\n\n    try {\n      constructor.from([1,1,1], 'foo');\n      assert(false);\n    } catch (e) {\n      assert (e instanceof TypeError);\n    }\n\n    try {\n      function f() {constructor.from(null)}\n    } catch (e) {\n      assert(e instanceof TypeError);\n    }\n\n    try {\n      function f() {constructor.from(undefined);}\n    } catch (e) {\n      assert(e instanceof TypeError);\n    }\n\n    var called = 0;\n    var arr = [1,2,3];\n    var obj = {};\n\n    function testIterator() {\n      called++;\n      return arr[Symbol.iterator]();\n    }\n\n    var getCalled = 0;\n    Object.defineProperty(obj, Symbol.iterator, {\n      get: function() {\n          getCalled++;\n          return testIterator;\n      },\n    });\n\n    assert(constructor.from(obj).toString() === '1,2,3');\n    assert(called === 1);\n    assert(getCalled === 1);\n}\n"
  },
  {
    "path": "tests/jerry/typedarray-of.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar int_typedarrays = [\n    Uint8ClampedArray,\n    Uint8Array,\n    Uint16Array,\n    Uint32Array,\n    Int8Array,\n    Int16Array,\n    Int32Array\n];\n\nvar float_typedarrays = [\n    Float32Array,\n    Float64Array,\n];\n\nvar obj = {\n    0: 0,\n    1: 1\n};\n\nint_typedarrays.forEach(function(e){\n    try {\n        e.of.call(undefined);\n        assert (false);\n    } catch (err) {\n        assert (err instanceof TypeError);\n    }\n\n    try {\n        e.of.call(obj);\n        assert (false);\n    } catch (err) {\n        assert (err instanceof TypeError);\n    }\n\n    // Test with regulat inputs\n    assert(e.of(1,2,3).toString() === \"1,2,3\");\n    assert(e.of(12,4,5,0).toString() === \"12,4,5,0\");\n    assert(e.of(23).toString() === \"23\");\n\n    // Test with string inputs\n    assert(e.of(\"12\",4).toString() === \"12,4\");\n    assert(e.of(1,2,\"foo\").toString() === \"1,2,0\");\n\n    // Test with undefined\n    assert(e.of(undefined).toString() === \"0\");\n\n    // Test with object\n    assert(e.of(obj).toString() === \"0\");\n\n    // Test with NaN\n    assert(e.of(NaN).toString() === \"0\");\n});\n\nfloat_typedarrays.forEach(function(e){\n    try {\n        e.of.call(undefined);\n        assert (false);\n    } catch (err) {\n        assert (err instanceof TypeError);\n    }\n\n    try {\n        e.of.call(obj);\n        assert (false);\n    } catch (err) {\n        assert (err instanceof TypeError);\n    }\n\n    // Test with regulat inputs\n    assert(e.of(1,2,3).toString() === \"1,2,3\");\n    assert(e.of(12,4,5,0).toString() === \"12,4,5,0\");\n    assert(e.of(23).toString() === \"23\");\n\n    // Test with string inputs\n    assert(e.of(\"12\",4).toString() === \"12,4\");\n    assert(e.of(1,2,\"foo\").toString() === \"1,2,NaN\");\n    assert(e.of(\"-12\").toString() === \"-12\");\n\n    // Test with undefined\n    assert(e.of(undefined).toString() === \"NaN\");\n\n    // Test with object\n    assert(e.of(obj).toString() === \"NaN\");\n\n    // Test with NaN\n    assert(e.of(NaN).toString() === \"NaN\");\n});\n\n// Test with negative inputs\nvar a = Uint8ClampedArray.of(-8);\nassert(a.toString() === \"0\");\n\na = Uint8Array.of(-8);\nassert(a.toString() === \"248\");\n\na = Uint16Array.of(-8);\nassert(a.toString() === \"65528\");\n\na = Uint32Array.of(-8);\nassert(a.toString() === \"4294967288\");\n\na = Int8Array.of(-8);\nassert(a.toString() === \"-8\");\n\na = Int16Array.of(-8);\nassert(a.toString() === \"-8\");\n\na = Int32Array.of(-8);\nassert(a.toString() === \"-8\");\n\na = Float32Array.of(-8);\nassert(a.toString() === \"-8\");\n\na = Float64Array.of(-8);\nassert(a.toString() === \"-8\");\n"
  },
  {
    "path": "tests/jerry/typedarray-offset-modulo.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar types = [\n  Uint16Array,\n  Uint32Array,\n  Float32Array,\n  Float64Array,\n  Int16Array,\n  Int32Array,\n]\n\nvar buffer = new ArrayBuffer (100);\n\nfor (var idx = 0; idx < types.length; idx++) {\n  try {\n    var target = types[idx];\n\n    /* TypedArray should throw error on incorrect offset (offset % elementSize != 0)! */\n    new target (buffer, target.BYTES_PER_ELEMENT + 1, 1);\n    assert (false);\n  } catch (ex) {\n    assert (ex instanceof RangeError);\n  }\n}\n"
  },
  {
    "path": "tests/jerry/typedarray-prototype-at.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Integer */\nvar normal_typedarrays = [\n  new Int8Array([0, 1, 2, 3, 0, 5, 6]),\n  new Uint8Array([0, 1, 2, 3, 0, 5, 6]),\n  new Uint8ClampedArray([0, 1, 2, 3, 0, 5, 6]),\n  new Int16Array([0, 1, 2, 3, 0, 5, 6]),\n  new Uint16Array([0, 1, 2, 3, 0, 5, 6]),\n  new Int32Array([0, 1, 2, 3, 0, 5, 6]),\n  new Uint32Array([0, 1, 2, 3, 0, 5, 6]),\n];\n\n/* Float */\nvar float_typedarrays = [\n  new Float32Array([1.5, 1.5, 2.5, 3.5, 0.5, 5.5, 10.5]),\n  new Float64Array([1.5, 2.5, 3.5, 0.5, 5.5, 6.5, 10.5]),\n];\n\n/* BigInt */\nvar bigint_typedarrays = [\n  new BigInt64Array([3n, 10n, 2n, 3n, 4n, 5n, 6n]),\n  new BigUint64Array([3n, 1n, 2n, 3n, 33n, 5n, 6n])\n];\n\nvar index = normal_typedarrays[0].at(0);\nassert(index === 0);\nassert(normal_typedarrays[index].at(0) === 0);\n\n/* Integer input */\nnormal_typedarrays.forEach(function(e){\n  assert(e.at(normal_typedarrays[1].length) === undefined);\n  assert(e.at(normal_typedarrays[2].length+1) === undefined);\n  assert(e.at(normal_typedarrays[3].length-1) === 6);\n  assert(e.at(0) === 0);\n  assert(e.at(\"-1\") === 6);\n  assert(e.at(-1) === 6);\n  assert(e.at(\"-20\") === undefined);\n  assert(e.at(100) === undefined)\n});\n\n/* Float input */\nfloat_typedarrays.forEach(function(f){\n  assert(f.at(float_typedarrays[1].length) === undefined);\n  assert(f.at(0) === 1.5);\n  assert(f.at(\"-1\") === 10.5);\n  assert(f.at(-1) === 10.5);\n  assert(f.at(\"-20\") === undefined);\n  assert(f.at(100) === undefined)\n});\n\n/* BigInt input */\nbigint_typedarrays.forEach(function(b){\n  assert(b.at(bigint_typedarrays[1].length) === undefined);\n  assert(b.at(0) === 3n);\n  assert(b.at(\"-1\") === 6n);\n  assert(b.at(-1) === 6n);\n  assert(b.at(\"-20\") === undefined);\n  assert(b.at(100) === undefined)\n});\n\nnormal_typedarrays.forEach(function(e){\n  try {\n    e.prototype.at.call(undefined);\n    assert(false);\n  } catch(e) {\n    assert(e instanceof TypeError);\n  }\n});\n"
  },
  {
    "path": "tests/jerry/typedarray-prototype-copy-within.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar typedarrays = [\n    new Uint8ClampedArray ([0, 1, 2, 3, 4, 5]),\n    new Uint8Array([0, 1, 2, 3, 4, 5]),\n    new Uint16Array([0, 1, 2, 3, 4, 5]),\n    new Uint32Array([0, 1, 2, 3, 4, 5]),\n    new Float32Array([0, 1, 2, 3, 4, 5]),\n    new Float64Array([0, 1, 2, 3, 4, 5]),\n    new Int8Array([0, 1, 2, 3, 4, 5]),\n    new Int16Array([0, 1, 2, 3, 4, 5]),\n    new Int32Array([0, 1, 2, 3, 4, 5])\n  ];\n\ntypedarrays.forEach(function(e){\n    try {\n        e.prototype.copyWithin.call (undefined);\n        assert (false);\n    } catch (err) {\n        assert (err instanceof TypeError);\n    }\n\n    // Test with normal inputs\n    assert(e.copyWithin(2, 1 ,4).toString() === '0,1,1,2,3,5');\n    assert(e.copyWithin(3, 4, 6).toString() === '0,1,1,3,5,5');\n    assert(e.copyWithin(4, 1, 3).toString() === '0,1,1,3,1,1');\n\n    e.set([5, 2, 1, 3, 4, 4]);\n\n    // Test with negative inputs\n    assert(e.copyWithin(2, -10, 3).toString() === '5,2,5,2,1,4');\n    assert(e.copyWithin(-3, 1, 6).toString() === '5,2,5,2,5,2');\n    assert(e.copyWithin(2, 0, -3).toString() === '5,2,5,2,5,2');\n\n    e.set([9, 3, 4, 5, 1, 7]);\n\n    // Test with default inputs\n    assert(e.copyWithin().toString() === '9,3,4,5,1,7');\n    assert(e.copyWithin(3).toString() === '9,3,4,9,3,4');\n    assert(e.copyWithin(1, 5).toString() === '9,4,4,9,3,4');\n\n    e.set([12, 3, 1, 43, 2, 9]);\n\n    // Test with too big inputs\n    assert(e.copyWithin(2, 12, 21).toString() === '12,3,1,43,2,9');\n    assert(e.copyWithin(4, 5, 13).toString() === '12,3,1,43,9,9');\n\n    e.set([1, 2, 3, 1, 2, 1]);\n\n    // Test with undefined inputs\n    assert(e.copyWithin(undefined, 2, 4).toString() === '3,1,3,1,2,1');\n    assert(e.copyWithin(undefined, undefined, 2).toString() === '3,1,3,1,2,1');\n    assert(e.copyWithin(3, undefined, 5).toString() === '3,1,3,3,1,3');\n\n    e.set([0, 2, 4, 2, 1, 5]);\n\n    // Test with NaN/+-Infinity\n    assert(e.copyWithin(NaN, 3, 5).toString() === '2,1,4,2,1,5');\n    assert(e.copyWithin(3, Infinity, 5).toString() === '2,1,4,2,1,5');\n    assert(e.copyWithin(1, 3, -Infinity).toString() === '2,1,4,2,1,5');\n});\n\nvar bigint_array = new BigInt64Array([1n, 2n, 3n, -4n, 5n]);\nassert(bigint_array.copyWithin(2, 1, 4).toString() === '1,2,2,3,-4');\nassert(bigint_array.copyWithin(0, 4).toString() === '-4,2,2,3,-4');\n\nvar biguint_array = new BigUint64Array([1n, 2n, 3n, 4n, 5n]);\nassert(biguint_array.copyWithin(0, 2, 4).toString() === '3,4,3,4,5');\nassert(biguint_array.copyWithin(-3, 0, 3).toString() === '3,4,3,4,3');\n"
  },
  {
    "path": "tests/jerry/typedarray-prototype-entries.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar normal_typedarrays = [\n  new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Uint16Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Uint32Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Float32Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Float64Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Int8Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Int16Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Int32Array([1, 2, 3, 4, 5, 6, 7, 8])\n];\n\nnormal_typedarrays.forEach (function(e){\n  try {\n    e.prototype.entries.call (undefined);\n    assert (false);\n  }\n  catch (e) {\n    assert (e instanceof TypeError)\n  }\n});\n\nnormal_typedarrays.forEach(function(e){\n  var iterator = e.entries ();\n  var current_item = iterator.next ();\n\n  for (var i = 0; i < e.length; i++) {\n    assert (current_item.value[0] === i);\n    assert (current_item.value[1] === e[i]);\n    assert (current_item.done === false);\n\n    current_item = iterator.next ();\n  }\n\n  assert (current_item.value === undefined);\n  assert (current_item.done === true);\n});\n\nvar empty_typedarrays = [\n  new Uint8Array([]),\n  new Uint16Array([]),\n  new Uint32Array([]),\n  new Float32Array([]),\n  new Float64Array([]),\n  new Int8Array([]),\n  new Int16Array([]),\n  new Int32Array([])\n];\n\nempty_typedarrays.forEach(function (e){\n  iterator = e.entries ();\n  current_item = iterator.next ();\n\n  assert (current_item.value === undefined);\n  assert (current_item.done === true);\n});\n\nassert ([].entries ().toString () === \"[object Array Iterator]\");\n\nvar bigint_array = new BigInt64Array([1n, 2n, 3n, 4n]);\nvar entries = bigint_array.entries();\nassert(entries.next().value[1] === 1n);\nassert(entries.next().value[1] === 2n);\n\nvar biguint_array = new BigUint64Array([1n, 2n, 3n, 4n]);\nvar entries = biguint_array.entries();\nassert(entries.next().value[1] === 1n);\nassert(entries.next().value[1] === 2n);\n"
  },
  {
    "path": "tests/jerry/typedarray-prototype-includes.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar typedarrays = [\n  new Uint8Array([0, 1, 2, 3, 0, 5, 6]),\n  new Uint16Array([0, 1, 2, 3, 0, 5, 6]),\n  new Uint32Array([0, 1, 2, 3, 0, 5, 6]),\n  new Float32Array([0, 1, 2, 3, 0, 5, 6]),\n  new Float64Array([0, 1, 2, 3, 0, 5, 6]),\n  new Int8Array([0, 1, 2, 3, 0, 5, 6]),\n  new Int16Array([0, 1, 2, 3, 0, 5, 6]),\n  new Int32Array([0, 1, 2, 3, 0, 5, 6])\n];\n\ntypedarrays.forEach(function(e){\n  assert(e.includes.length === 1);\n  assert(e.includes.name === \"includes\");\n  assert(e.includes() === false);\n  assert(e.includes(\"foo\") === false);\n  assert(e.includes(undefined) === false);\n  assert(e.includes(NaN) === false);\n  assert(e.includes(0) === true);\n  assert(e.includes(0, 4) === true);\n  assert(e.includes(0, 5) === false);\n  assert(e.includes(1, Infinity) === false);\n  assert(e.includes(1, -Infinity) === true);\n  assert(e.includes(6, 8) === false);\n  assert(e.includes(3, -5) === true);\n});\n\nvar empty_typedarrays = [\n  new Uint8Array([]),\n  new Uint16Array([]),\n  new Uint32Array([]),\n  new Float32Array([]),\n  new Float64Array([]),\n  new Int8Array([]),\n  new Int16Array([]),\n  new Int32Array([])\n];\n\nempty_typedarrays.forEach(function(e){\n  assert(e.includes(5) === false);\n});\n"
  },
  {
    "path": "tests/jerry/typedarray-prototype-indexof.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar normal_typedarrays = [\n  new Uint8Array([0, 1, 2, 3, 0, 5, 6]),\n  new Uint16Array([0, 1, 2, 3, 0, 5, 6]),\n  new Uint32Array([0, 1, 2, 3, 0, 5, 6]),\n  new Float32Array([0, 1, 2, 3, 0, 5, 6]),\n  new Float64Array([0, 1, 2, 3, 0, 5, 6]),\n  new Int8Array([0, 1, 2, 3, 0, 5, 6]),\n  new Int16Array([0, 1, 2, 3, 0, 5, 6]),\n  new Int32Array([0, 1, 2, 3, 0, 5, 6])\n];\n\nnormal_typedarrays.forEach(function(e){\n\n  try{\n    e.prototype.indexOf.call (undefined);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  var index = e.indexOf(0);\n  assert(index === 0);\n  assert(e[index] === 0);\n\n  // Regular input\n  assert(e.indexOf(0, 1) === 4);\n  assert(e.indexOf(0, 5) === -1);\n  assert(e.indexOf(3, -2) === -1);\n  assert(e.indexOf(5, -6) === 5);\n  assert(e.indexOf(2, -2) === -1);\n\n  // Empty input\n  assert(e.indexOf() === -1);\n\n  // String input\n  assert(e.indexOf(\"foo\") === -1);\n  assert(e.indexOf(3, \"foo\") === 3);\n\n  // Nan, +/-Infinity\n  assert(e.indexOf(0, NaN) === 0);\n  assert(e.indexOf(0, Infinity) === -1);\n  assert(e.indexOf(3, -Infinity) === 3);\n\n  // Checking behavior when fromIndex is undefined\n  e.set([1, 2]);\n\n  assert(e.indexOf(2, undefined) === 1);\n  assert(e.indexOf(2) === 1);\n\n  // Checking behavior when start index >= length\n  e.set([11, 22, 33, 44]);\n\n  assert(e.indexOf(44, 5) === -1);\n\n  var fromIndex = {\n    toString: function () {\n      return {};\n    },\n\n    valueOf: function () {\n      return {};\n    }\n  };\n\n  e.set([0, 1]);\n\n  try {\n    e.indexOf(1, fromIndex);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n});\n\n// Checking behavior when length is zero\nvar empty_typedarrays = [\n  new Uint8Array([]),\n  new Uint16Array([]),\n  new Uint32Array([]),\n  new Float32Array([]),\n  new Float64Array([]),\n  new Int8Array([]),\n  new Int16Array([]),\n  new Int32Array([])\n];\n\nempty_typedarrays.forEach(function(e){\n  assert(e.indexOf(0) === -1);\n});\n"
  },
  {
    "path": "tests/jerry/typedarray-prototype-keys.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar normal_typedarrays = [\n  new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Uint16Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Uint32Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Float32Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Float64Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Int8Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Int16Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Int32Array([1, 2, 3, 4, 5, 6, 7, 8])\n];\n\nnormal_typedarrays.forEach (function(e){\n  try {\n    e.prototype.keys.call (undefined);\n    assert (false);\n  }\n  catch (e) {\n    assert (e instanceof TypeError)\n  }\n});\n\nnormal_typedarrays.forEach(function (e){\n  var iterator = e.keys ();\n  var current_item = iterator.next ();\n\n  for (var i = 0; i < e.length; i++) {\n    assert (current_item.value === i);\n    assert (current_item.done === false);\n  \n    current_item = iterator.next ();\n  }\n\n  assert (current_item.value === undefined);\n  assert (current_item.done === true);\n});\n\nvar empty_typedarrays = [\n  new Uint8Array([]),\n  new Uint16Array([]),\n  new Uint32Array([]),\n  new Float32Array([]),\n  new Float64Array([]),\n  new Int8Array([]),\n  new Int16Array([]),\n  new Int32Array([])\n];\n\nempty_typedarrays.forEach(function (e){\n  iterator = e.keys ();\n  current_item = iterator.next ();\n\n  assert (current_item.value === undefined);\n  assert (current_item.done === true);\n});\n\nassert ([].keys ().toString () === \"[object Array Iterator]\");\n"
  },
  {
    "path": "tests/jerry/typedarray-prototype-lastindexof.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar normal_typedarrays = [\n  new Uint8Array([0, 1, 2, 3, 0, 5, 6]),\n  new Uint16Array([0, 1, 2, 3, 0, 5, 6]),\n  new Uint32Array([0, 1, 2, 3, 0, 5, 6]),\n  new Float32Array([0, 1, 2, 3, 0, 5, 6]),\n  new Float64Array([0, 1, 2, 3, 0, 5, 6]),\n  new Int8Array([0, 1, 2, 3, 0, 5, 6]),\n  new Int16Array([0, 1, 2, 3, 0, 5, 6]),\n  new Int32Array([0, 1, 2, 3, 0, 5, 6])\n];\n\nnormal_typedarrays.forEach(function(e){\n  try{\n    e.prototype.lastIndexOf.call (undefined);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof TypeError);\n  }\n\n  var index = e.lastIndexOf(0);\n  assert(index === 4);\n  assert(e[index] === 0);\n\n  // Regular input\n  assert(e.lastIndexOf(0, 3) === 0);\n  assert(e.lastIndexOf(0, -8) === -1);\n  assert(e.lastIndexOf(2) === 2);\n  assert(e.lastIndexOf(5, 3) === -1);\n  assert(e.lastIndexOf(3, 6) === 3);\n\n  // Empty input\n  assert(e.lastIndexOf() === -1);\n\n  // String input\n  assert(e.lastIndexOf(\"foo\") === -1);\n  assert(e.lastIndexOf(0, \"foo\") === 0);\n\n  // Nan, +/-Infinity\n  assert(e.lastIndexOf(0, NaN) === 0);\n  assert(e.lastIndexOf(0, Infinity) === 4);\n  assert(e.lastIndexOf(0, -Infinity) === -1);\n\n  // Checking behavior when fromIndex is undefined\n  e.set([1, 2]);\n\n  assert(e.lastIndexOf(2, undefined) === -1);\n  assert(e.lastIndexOf(2) === 2);\n\n  // Checking behavior when start index >= length\n  e.set([11, 22, 33, 44]);\n\n  assert(e.lastIndexOf(44, 8) === 3);\n\n  var fromIndex = {\n    toString: function () {\n      return {};\n    },\n\n    valueOf: function () {\n      return {};\n    }\n  };\n\n  e.set([0, 1]);\n\n  try {\n    e.lastIndexOf(1, fromIndex);\n    assert(false);\n  } catch (e) {\n    assert(e instanceof TypeError);\n  }\n});\n\n// Checking behavior when length is zero\nvar empty_typedarrays = [\n  new Uint8Array([]),\n  new Uint16Array([]),\n  new Uint32Array([]),\n  new Float32Array([]),\n  new Float64Array([]),\n  new Int8Array([]),\n  new Int16Array([]),\n  new Int32Array([])\n];\n\nempty_typedarrays.forEach(function(e){\n  assert(e.lastIndexOf(0) === -1);\n});\n"
  },
  {
    "path": "tests/jerry/typedarray-prototype-slice-ext-arraybuffer.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar typedarrays = [\n  Uint8ClampedArray,\n  Uint8Array,\n  Uint16Array,\n  Uint32Array,\n  Float32Array,\n  Float64Array,\n  Int8Array,\n  Int16Array,\n  Int32Array,\n];\n\nfor (var typeIdx = 0; typeIdx < typedarrays.length; typeIdx++) {\n  var buffer = new ArrayBuffer(100);\n  var typed = new typedarrays[typeIdx](buffer, 8, 6);\n  try {\n    typed.prototype.slice.call(undefined);\n    assert(false);\n  } catch (err) {\n    assert(err instanceof TypeError);\n  }\n\n  for (var idx = 0; idx < typed.length; idx++) {\n    typed[idx] = idx;\n  }\n\n  // Test with normal inputs\n  assert(typed.slice(1, 3).toString() === \"1,2\");\n  assert(typed.slice(2, 5).toString() === \"2,3,4\");\n  assert(typed.slice(0, 6).toString() === \"0,1,2,3,4,5\");\n\n  // Test witn negative inputs\n  assert(typed.slice(-2, 5).toString() === \"4\");\n  assert(typed.slice(0, -3).toString() === \"0,1,2\");\n  assert(typed.slice(-1, -4).toString() === \"\");\n\n  // Test with bigger inputs then length\n  assert(typed.slice(7, 1).toString() === \"\");\n  assert(typed.slice(2, 9).toString() === \"2,3,4,5\");\n\n  // Test with undefined\n  assert(typed.slice(undefined, 4).toString() === \"0,1,2,3\");\n  assert(typed.slice(0, undefined).toString() === \"0,1,2,3,4,5\");\n  assert(typed.slice(undefined, undefined).toString() === \"0,1,2,3,4,5\");\n\n  // Test with NaN and +/-Infinity\n  assert(typed.slice(NaN, 3).toString() === \"0,1,2\");\n  assert(typed.slice(2, Infinity).toString() === \"2,3,4,5\");\n  assert(typed.slice(-Infinity, Infinity).toString() === \"0,1,2,3,4,5\");\n\n  // Test with default inputs\n  assert(typed.slice().toString() === \"0,1,2,3,4,5\");\n  assert(typed.slice(4).toString() === \"4,5\");\n\n  delete buffer;\n}\n"
  },
  {
    "path": "tests/jerry/typedarray-prototype-slice.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar typedarrays = [\n    new Uint8ClampedArray([0, 1, 2, 3, 4, 5]),\n    new Uint8Array([0, 1, 2, 3, 4, 5]),\n    new Uint16Array([0, 1, 2, 3, 4, 5]),\n    new Uint32Array([0, 1, 2, 3, 4, 5]),\n    new Float32Array([0, 1, 2, 3, 4, 5]),\n    new Float64Array([0, 1, 2, 3, 4, 5]),\n    new Int8Array([0, 1, 2, 3, 4, 5]),\n    new Int16Array([0, 1, 2, 3, 4, 5]),\n    new Int32Array([0, 1, 2, 3, 4, 5])\n  ];\n\ntypedarrays.forEach(function(e){\n    try {\n        e.prototype.slice.call (undefined);\n        assert (false);\n    } catch (err) {\n        assert (err instanceof TypeError);\n    }\n\n    // Test with normal inputs\n    assert(e.slice(1, 3).toString() === \"1,2\");\n    assert(e.slice(2, 5).toString() === \"2,3,4\");\n    assert(e.slice(0, 6).toString() === \"0,1,2,3,4,5\");\n\n    // Test witn negative inputs\n    assert(e.slice(-2, 5).toString() === \"4\");\n    assert(e.slice(0, -3).toString() === \"0,1,2\");\n    assert(e.slice(-1, -4).toString() === \"\");\n\n    // Test with bigger inputs then length\n    assert(e.slice(7, 1).toString() === \"\");\n    assert(e.slice(2, 9).toString() === \"2,3,4,5\");\n\n    // Test with undefined\n    assert(e.slice(undefined, 4).toString() === \"0,1,2,3\");\n    assert(e.slice(0, undefined).toString() === \"0,1,2,3,4,5\");\n    assert(e.slice(undefined, undefined).toString() === \"0,1,2,3,4,5\");\n\n    // Test with NaN and +/-Infinity\n    assert(e.slice(NaN, 3).toString() === \"0,1,2\");\n    assert(e.slice(2, Infinity).toString() === \"2,3,4,5\");\n    assert(e.slice(-Infinity, Infinity).toString() === \"0,1,2,3,4,5\");\n\n    // Test with default inputs\n    assert(e.slice().toString() === \"0,1,2,3,4,5\");\n    assert(e.slice(4).toString() === \"4,5\");\n});\n"
  },
  {
    "path": "tests/jerry/typedarray-prototype-tolocalestring.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar int_typedarrays = [\n    new Uint8Array([0, 1, 2, 3, 4, 5]),\n    new Uint16Array([0, 1, 2, 3, 4, 5]),\n    new Uint32Array([0, 1, 2, 3, 4, 5]),\n    new Int8Array([0, 1, 2, 3, 4, 5]),\n    new Int16Array([0, 1, 2, 3, 4, 5]),\n    new Int32Array([0, 1, 2, 3, 4, 5])\n];\n\nvar float_typedarrays = [\n    new Float32Array([0, 1, 2, 3, 4, 5]),\n    new Float64Array([0, 1, 2, 3, 4, 5]),\n];\n\nint_typedarrays.forEach(function(e){\n    // Test with normal inputs\n    assert(e.toLocaleString() === \"0,1,2,3,4,5\");\n    e.set([3, 3, 6, 1, 2, 9]);\n    assert(e.toLocaleString() === \"3,3,6,1,2,9\");\n    e.set([32, 12, 2, 8, 32, 1]);\n    assert(e.toLocaleString() === \"32,12,2,8,32,1\");\n    // Test with undefined\n    e.set([12, undefined, 0, undefined, 3, 5]);\n    assert(e.toLocaleString() === \"12,0,0,0,3,5\");\n    // Test with null\n    e.set([null, 3, 3, 3, null, 10]);\n    assert(e.toLocaleString() === \"0,3,3,3,0,10\");\n    e.set([12, null, 21, null, null, null]);\n    assert(e.toLocaleString() === \"12,0,21,0,0,0\");\n});\n\nfloat_typedarrays.forEach(function(e){\n    // Test with normal inputs\n    assert(e.toLocaleString() === \"0,1,2,3,4,5\");\n    e.set([3, 3, 6, 1, 2, 9]);\n    assert(e.toLocaleString() === \"3,3,6,1,2,9\");\n    e.set([32, 12, 2, 8, 32, 1]);\n    assert(e.toLocaleString() === \"32,12,2,8,32,1\");\n    // Test with undefined\n    e.set([12, undefined, 0, undefined, 3, 5]);\n    assert(e.toLocaleString() === \"12,NaN,0,NaN,3,5\");\n    // Test with null\n    e.set([null, 3, 3, 3, null, 10]);\n    assert(e.toLocaleString() === \"0,3,3,3,0,10\");\n    e.set([12, null, 21, null, null, null]);\n    assert(e.toLocaleString() === \"12,0,21,0,0,0\");\n});\n\n// Test empty TypedArrays\nvar empty_typedarrays = [\n    new Uint8Array([]),\n    new Uint16Array([]),\n    new Uint32Array([]),\n    new Float32Array([]),\n    new Float64Array([]),\n    new Int8Array([]),\n    new Int16Array([]),\n    new Int32Array([])\n];\n\nempty_typedarrays.forEach(function(e){\n    assert(e.toLocaleString() === \"\");\n});\n\nNumber.prototype.toLocaleString = function() { return \"5\" }\n\nvar typedarrays = [\n    new Uint8Array([10]),\n    new Uint16Array([10]),\n    new Uint32Array([10]),\n    new Float32Array([10]),\n    new Float64Array([10]),\n    new Int8Array([10]),\n    new Int16Array([10]),\n    new Int32Array([10])\n];\n\ntypedarrays.forEach(function(e){\n    assert(e.toLocaleString() === \"5\");\n});\n\nNumber.prototype.toLocaleString = \"foo\";\n\ntypedarrays.forEach(function(e){\n    try {\n        assert(e.toLocaleString() === \"foo\");\n        assert(false);\n    } catch (err) {\n        assert(err instanceof TypeError);\n    }\n});\n"
  },
  {
    "path": "tests/jerry/typedarray-prototype-values.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar normal_typedarrays = [\n  new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Uint16Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Uint32Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Float32Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Float64Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Int8Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Int16Array([1, 2, 3, 4, 5, 6, 7, 8]),\n  new Int32Array([1, 2, 3, 4, 5, 6, 7, 8])\n];\n\nnormal_typedarrays.forEach (function(e){\n  try {\n    e.prototype.values.call (undefined);\n    assert (false);\n  }\n  catch (e) {\n    assert (e instanceof TypeError)\n  }\n});\n\nnormal_typedarrays.forEach(function (e){\n  var iterator = e.values ();\n  var symbol_iterator = e[Symbol.iterator] ();\n\n  var current_item = iterator.next ();\n  var symbol_current_item = symbol_iterator.next ();\n\n  for (var i = 0; i < e.length; i++) {\n    assert (current_item.value === e[i]);\n    assert (current_item.done === false);\n\n    assert (current_item.value === symbol_current_item.value);\n    assert (current_item.done === symbol_current_item.done);\n\n    current_item = iterator.next ();\n    symbol_current_item = symbol_iterator.next ();\n  }\n\n  assert (current_item.value === undefined);\n  assert (current_item.done === true);\n  assert (current_item.value === symbol_current_item.value);\n  assert (current_item.done === symbol_current_item.done)\n});\n\nvar empty_typedarrays = [\n  new Uint8Array([]),\n  new Uint16Array([]),\n  new Uint32Array([]),\n  new Float32Array([]),\n  new Float64Array([]),\n  new Int8Array([]),\n  new Int16Array([]),\n  new Int32Array([])\n];\n\nempty_typedarrays.forEach(function (e){\n  iterator = e.values ();\n  current_item = iterator.next ();\n\n  assert (current_item.value === undefined);\n  assert (current_item.done === true);\n});\n\nassert ([].values ().toString () === \"[object Array Iterator]\");\n"
  },
  {
    "path": "tests/jerry/typedarray-put.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar typedarrays = [\n  new Uint8ClampedArray([1]),\n  new Uint8Array([1]),\n  new Uint16Array([1]),\n  new Uint32Array([1]),\n  new Float32Array([1]),\n  new Float64Array([1]),\n  new Int8Array([1]),\n  new Int16Array([1]),\n  new Int32Array([1]),\n  new BigInt64Array([1n]),\n  new BigUint64Array([1n]),\n];\n\nfor (let ta of typedarrays) {\n  for (let prop_name of [2, 5.1]) {\n    var set_value = 4.2;\n\n    if (ta.constructor === BigInt64Array || ta.constructor === BigUint64Array)\n    {\n      set_value = 4n;\n    }\n\n    (function () {\n      \"use strict\";\n      let set_result = ta[prop_name] = set_value;\n      assert(set_result === set_value);\n      assert(!ta.hasOwnProperty(prop_name));\n      assert(ta.length === 1);\n    })();\n\n    (function () {\n      let set_result = ta[prop_name] = set_value;\n      assert(set_result === set_value);\n      assert(!ta.hasOwnProperty(prop_name));\n      assert(ta.length === 1);\n    })();\n  }\n}\n"
  },
  {
    "path": "tests/jerry/typedarray-symbol-properties.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar typedArrayTypes = [Int8Array,\n                       Uint8Array,\n                       Uint8ClampedArray,\n                       Int16Array,\n                       Uint16Array,\n                       Int32Array,\n                       Uint32Array,\n                       Float32Array,\n                       Float64Array];\n\ntypedArrayTypes.forEach (function (typedArrayType) {\n  var typedArray = new typedArrayType ();\n  var fooSymbol = Symbol (\"foo\");\n  var barSymbol = Symbol (\"bar\");\n  typedArray[fooSymbol] = 5;\n  assert (typedArray[fooSymbol] === 5);\n\n  Object.defineProperty (typedArray, barSymbol, {value: 10});\n  assert (typedArray[barSymbol] === 10);\n});\n"
  },
  {
    "path": "tests/jerry/typeof.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction f()\n{\n  return 1;\n}\n\nassert(typeof(a) === \"undefined\");\nassert(typeof(null) === \"object\");\nassert(typeof(false) === \"boolean\");\nassert(typeof(true) === \"boolean\");\nassert(typeof(1) === \"number\");\nassert(typeof(1.1) === \"number\");\nassert(typeof('abcd') === \"string\");\nassert(typeof(\"1.1\") === \"string\");\nassert(typeof(this) === \"object\");\nassert(typeof(f) === \"function\");\n"
  },
  {
    "path": "tests/jerry/unary-plus-minus.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (+0 === -0);\nassert (1/-0 === -Infinity);\nassert (1/+0 === Infinity);\nassert (\"3\" -+-+-+ \"1\" + \"1\" / \"3\" * \"6\" + \"2\" === \"42\");\nassert (isNaN (-NaN));"
  },
  {
    "path": "tests/jerry/unicode-escape-identifiers.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar \\u{102C0} = 2;\nassert(\\u{102C0} === 2);\n\nvar o1 = { \\u{102C0} : 3 };\nassert(o1['\\ud800\\udec0'] === 3);\n\nvar o2 = { '\\ud800\\udec0' : 4 };\nassert(o2.\\u{102C0} === 4);\n\ntry {\n  eval('var ⸯ');\n  assert(false);\n} catch(e) {\n  assert(e instanceof SyntaxError);\n}\n\nvar 𐋀 = 5;\nassert(𐋀 === 5);\n"
  },
  {
    "path": "tests/jerry/unicode-format-control-characters.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nfunction checkSyntax (str) {\n  try {\n    eval (str);\n    assert (false);\n  } catch (e) {\n    assert (e instanceof SyntaxError);\n  }\n}\n\n// Only \\u200C-Zero width non-joiner, and \\u200D-Zero width joiner are allowed\n\ncheckSyntax (\"_\\u200b\\u200d\");\ncheckSyntax (\"_\\u200c\\u200e\");\n\nvar _\\u200c\\u200d = 5;\n\nassert (_\\u200c\\u200d === 5);\n"
  },
  {
    "path": "tests/jerry/unusual.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar x = [0];\nassert (x == x);\nassert (x == !x);\nassert (Array(3) == \",,\");\n\nassert ([] + [] == \"\");\nassert ([] + {} == \"[object Object]\");\nassert (eval (\"{} + []\") == 0);\nassert (isNaN (eval (\"{} + {}\")));\nassert ({} + [] == \"[object Object]\");\nassert ({} + {} == \"[object Object][object Object]\");\n\nassert ((! + [] + [] + ![]) === \"truefalse\");\n"
  },
  {
    "path": "tests/jerry/var-decl.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nassert (x === undefined);\nassert (y === undefined);\nassert (z === undefined);\nassert (i === undefined);\nassert (j === undefined);\nassert (k === undefined);\nassert (q === undefined);\nassert (v === undefined);\n\neval ('var n');\neval ('var m = 1');\n\ntry\n{\n  x = p;\n  assert (false);\n}\ncatch (e)\n{\n  assert (e instanceof ReferenceError);\n}\n\n{\n  var y;\n}\nvar x = y;\n\ndo var z; while (0);\n\nfor (var i, j = function () {var p;}; i === undefined; i = null)\n{\n}\n\nfor (var q in {})\n{\n}\n\n{ var v = 1 }\n\ntry\n{\n  var k\n  l\n  assert (false)\n}\ncatch (e)\n{\n  assert (e instanceof ReferenceError);\n}\n"
  },
  {
    "path": "tests/jerry/variables.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar real = 42;\nvar float = 3.14;\nvar integer = -4;\nvar exponent = 1e7;\nvar str = 'literal';\n\na = 42;\n"
  },
  {
    "path": "tests/jerry/weakmap.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar m1 = new WeakMap();\nvar k1 = {};\nassert (m1.set (k1, 3.14) instanceof WeakMap);\nassert (m1.has (k1) === true);\nassert (m1.get (k1) === 3.14);\n\nk1 = {};\ngc (); /* This will remove the entry, but there is no way to validate it from js. */\n\nassert (m1.has (k1) === false);\nassert (m1.delete(k1) === false);\nassert (m1.set (k1, \"asd\" + \"fgh\") instanceof WeakMap);\nassert (m1.has (k1) === true);\nassert (m1.get (k1) === \"asdfgh\");\n\nassert (m1.delete (\"str\") === false);\nassert (m1.has (42) === false);\nassert (m1.get (42) === undefined);\ntry {\n  m1.set (42, 42);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ngc ();\nassert (m1.delete(k1) === true);\ngc ();\nassert (m1.has (k1) === false);\nk1 = {};\ngc ();\n\nObject.freeze(k1);\nassert (m1.set (k1, \"frozen\") instanceof WeakMap);\nassert (m1.has (k1) === true);\nassert (m1.get (k1) === \"frozen\");\nk1 = {};\ngc ();\n\nvar m2 = new WeakMap();\n\nm1.set (k1, \"str\" + \"str\");\nm2.set (k1, 42.42);\n\nk1 = {};\ngc ();\nvar k2 = {};\n\nm1.set (k1, \"str\" + \"str\");\nm1.set (k2, \"str2\" + \"str2\");\nm2.set (k1, 42.42);\nm2.set (k2, Infinity);\n\nm2.delete (k1);\ngc ();\nk1 = {};\nk2 = {};\ngc ();\n\nvar k3 = {};\nm1 = new WeakMap();\nm1.set(k1, \"str\" + \"str\");\nm1.set(k2, \"str2\" + \"str2\");\nm1.set(k3, \"str3\" + \"str3\");\nk1 = undefined;\nk2 = undefined;\nk3 = undefined;\nm1 = undefined;\ngc();\n\ntry {\n  WeakMap();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  WeakMap.prototype.get.call({});\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (new WeakMap(null) instanceof WeakMap);\n\nk1 = {};\nk2 = {};\nm1 = new WeakMap([[k1, 1.2], [k2, 1.3]]);\nassert (m1.has (k1));\nassert (m1.has (k2));\nassert (m1.get (k1) === 1.2);\nassert (m1.get (k2) === 1.3);\ngc();\nm1 = undefined;\ngc();\n\nm1 = new WeakMap();\nm1.set(k1, \"str\");\nm1.set(k1, \"4\");\nm1.set(k1, null);\nm1.set(k1, 42);\nassert (m1.has (k1));\nk1 = {};\ngc();\n\nm1 = new WeakMap();\nm1.set(k1, \"str\");\nm1.set(k1, \"4\");\nm1.set(k1, 42);\nm1.set(k1, null);\nassert (m1.has (k1));\nm1 = new WeakMap();\ngc();\n\ntry {\n  new WeakMap([[1,2],[3,4]]);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nfunction createIterable(arr, methods = {}) {\n  let iterable = function *() {\n    let idx = 0;\n    while (idx < arr.length) {\n      yield arr[idx];\n      idx++;\n    }\n  }();\n  iterable['return'] = methods['return'];\n  iterable['throw'] = methods['throw'];\n\n  return iterable;\n};\n\nvar closed = false;\nvar iter = createIterable([1, 2, 3], {\n  'return': function(){ closed = true; return {}; }\n});\ntry {\n  new WeakMap(iter);\n} catch(e){}\n\nassert(closed === true);\n\nm1.set([], []);\n\nassert (WeakMap.prototype.toString() === \"[object WeakMap]\");\n\nWeakMap.prototype.set = function () { throw \"abrupt set\" };\n\ntry {\n  new WeakMap([[{}, 1]]);\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt set\");\n}\n\nObject.defineProperty(WeakMap.prototype, 'set', {\n  get: () => { throw \"abrupt set getter\" }\n});\n\ntry {\n  new WeakMap([]);\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt set getter\");\n}\n\n[Symbol.toStringTag].forEach(e => assert (Reflect.ownKeys(WeakMap.prototype).includes(e)));\n"
  },
  {
    "path": "tests/jerry/weakref.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nvar target_obj = {};\nvar not_target_obj = {};\nvar weak_ref = new WeakRef(target_obj);\nvar weak_ref2 = new WeakRef(target_obj);\n\nassert (weak_ref.deref() === target_obj);\nassert (weak_ref.deref() === weak_ref2.deref());\nassert (weak_ref.deref() !== not_target_obj);\n\nassert (weak_ref2.deref() === target_obj);\nassert (weak_ref2.deref() !== not_target_obj);\nassert (weak_ref2.deref() === weak_ref2.deref());\n\ntarget_obj = undefined;\ngc();\n\nassert (weak_ref.deref() === undefined);\nassert (weak_ref2.deref() === undefined);\n\nvar key_obj_1 = {};\nvar key_obj_2 = {};\nvar key_obj_3 = {};\nvar target_obj_2 = {};\nvar target_obj_3 = {};\nvar weak_ref_3 = new WeakRef(key_obj_1);\nvar weak_ref_4 = new WeakRef(target_obj_2);\nvar weak_ref_5 = new WeakRef(target_obj_3);\n\nvar weak_map = new WeakMap();\nweak_map.set(key_obj_1, weak_ref_3);\nweak_map.set(key_obj_2, weak_ref_4);\nweak_map.set(key_obj_3, weak_ref_5);\n\nassert(weak_map.has(key_obj_1));\nassert(weak_map.has(key_obj_2));\nassert(weak_map.has(key_obj_3));\n\nassert(weak_map.get(key_obj_1).deref() === key_obj_1);\nassert(weak_map.get(key_obj_2).deref() === target_obj_2);\nassert(weak_map.get(key_obj_3).deref() === target_obj_3);\n\nkey_obj_1 = undefined;\ngc();\nassert(weak_map.get(key_obj_1) === undefined);\nassert(weak_ref_3.deref() === undefined);\n\nkey_obj_2 = undefined;\ngc();\nassert(weak_map.get(key_obj_2) === undefined);\nassert(weak_ref_4.deref() === target_obj_2);\n\ntarget_obj_3 = undefined;\ngc();\nassert(weak_map.get(key_obj_3) !== undefined);\nassert(weak_ref_5.deref() === undefined);\n"
  },
  {
    "path": "tests/jerry/weakset.js",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar m1 = new WeakSet();\n\nvar k1 = {};\nassert (m1.add (k1) instanceof WeakSet);\nassert (m1.has (k1) === true);\n\nk1 = {};\ngc (); /* This will remove the entry, but there is no way to validate it from js. */\n\nassert (m1.has (k1) === false);\nassert (m1.delete(k1) === false);\nassert (m1.add (k1) instanceof WeakSet);\nassert (m1.has (k1) === true);\n\nassert (m1.delete (\"str\") === false);\nassert (m1.has (42) === false);\n\ntry {\n  m1.add (42);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ngc ();\nassert (m1.delete(k1) === true);\ngc ();\nassert (m1.has (k1) === false);\nk1 = {};\ngc ();\n\nObject.freeze(k1);\nassert (m1.add (k1) instanceof WeakSet);\nassert (m1.has (k1) === true);\nk1 = {};\ngc ();\n\nvar m2 = new WeakSet();\n\nk1 = {};\ngc ();\nvar k2 = {};\n\nm1.add (k1);\nm1.add (k2);\nm2.add (k1);\nm2.add (k2);\n\nm2.delete (k1);\ngc ();\nk1 = {};\nk2 = {};\ngc ();\n\nnew WeakSet().add(new WeakSet().add(new WeakSet().add(new WeakSet().add(new WeakSet().add(new WeakSet().add(new WeakSet()))))));\ngc();\n\ntry {\n  WeakSet();\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\ntry {\n  WeakSet.prototype.get.call({});\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nassert (new WeakSet(null) instanceof WeakSet);\n\nk1 = {};\nk2 = {};\nm1 = new WeakSet([k1, k2]);\nassert (m1.has (k1));\nassert (m1.has (k2));\ngc();\nm1 = undefined;\ngc();\n\nm1 = new WeakSet();\nk1 = {};\nm1.add (k1);\nm1.add (k1);\nm1.add (k1);\nassert (m1.has (k1));\nk1 = {};\ngc();\n\nm1 = new WeakSet();\nm1.add (k1);\nm1.add (k1);\nm1.add (k1);\nassert (m1.has (k1));\nm1 = new WeakSet();\ngc();\n\ntry {\n  new WeakSet([1,2,3,4]);\n  assert (false);\n} catch (e) {\n  assert (e instanceof TypeError);\n}\n\nfunction createIterable(arr, methods = {}) {\n  let iterable = function *() {\n    let idx = 0;\n    while (idx < arr.length) {\n      yield arr[idx];\n      idx++;\n    }\n  }();\n  iterable['return'] = methods['return'];\n  iterable['throw'] = methods['throw'];\n\n  return iterable;\n};\n\nvar closed = false;\nvar iter = createIterable([1, 2, 3], {\n  'return': function(){ closed = true; return {}; }\n});\ntry {\n  new WeakMap(iter);\n} catch(e){}\n\nassert(closed === true);\n\nm1.add([]);\n\nassert (WeakSet.prototype.toString() === \"[object WeakSet]\");\n\nWeakSet.prototype.add = function () { throw \"abrupt add\" };\n\ntry {\n  new WeakSet([{}]);\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt add\");\n}\n\nObject.defineProperty(WeakSet.prototype, 'add', {\n  get: () => { throw \"abrupt add getter\" }\n});\n\ntry {\n  new WeakSet([]);\n  assert (false);\n} catch (e) {\n  assert (e === \"abrupt add getter\");\n}\n\n[Symbol.toStringTag].forEach(e => assert (Reflect.ownKeys(WeakSet.prototype).includes(e)));\n"
  },
  {
    "path": "tests/jerry/windows-line-ending.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\r\n//\r\n// Licensed under the Apache License, Version 2.0 (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n//     http://www.apache.org/licenses/LICENSE-2.0\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n\r\n// This test file should use CR-LF styled line endings to test if everything is\r\n// parsed correctly\r\n\r\n\r\nvar value =\r\n  5;\r\n\r\nassert (value === 5);\r\n"
  },
  {
    "path": "tests/jerry/zero-character.js",
    "content": "// Copyright JS Foundation and other contributors, http://js.foundation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\ntry {\n  eval(\"/*var \" + String.fromCharCode(0) + \"xx = 1*/\");\n}\ncatch (e) {\n  assert (false);\n}\n\nassert (\"x\\0y\" !== \"x\\0z\");\n"
  },
  {
    "path": "tests/snapshot-tests-skiplist.txt",
    "content": "tests/jerry/atomics.js\ntests/jerry/bigint-typedarray-prototype-filter.js\ntests/jerry/bigint5.js\ntests/jerry/bigint6.js\ntests/jerry/bigint7.js\ntests/jerry/bigint8.js\ntests/jerry/bigint9.js\ntests/jerry/es.next/bigint-as-int-n.js\ntests/jerry/es.next/bigint-as-uint-n.js\ntests/jerry/logical-assignment.js\ntests/jerry/module-circular-01.mjs\ntests/jerry/module-circular-02.mjs\ntests/jerry/module-circular-03.mjs\ntests/jerry/module-circular-04.mjs\ntests/jerry/module-circular-05.mjs\ntests/jerry/module-circular-06.mjs\ntests/jerry/module-circular-07.mjs\ntests/jerry/module-circular-08.mjs\ntests/jerry/module-circular-09.mjs\ntests/jerry/module-export-01.mjs\ntests/jerry/module-export-02.mjs\ntests/jerry/module-export-03.mjs\ntests/jerry/module-export-04.mjs\ntests/jerry/module-export-05.mjs\ntests/jerry/module-export-06.mjs\ntests/jerry/module-export-07.mjs\ntests/jerry/module-export-08.mjs\ntests/jerry/module-export-09.mjs\ntests/jerry/module-export-10.mjs\ntests/jerry/module-export-default-1.mjs\ntests/jerry/module-export-default-2.mjs\ntests/jerry/module-export-default-3.mjs\ntests/jerry/module-export-default-4.mjs\ntests/jerry/module-export-default-5.mjs\ntests/jerry/module-export-default-6.mjs\ntests/jerry/module-export-default-7.mjs\ntests/jerry/module-export-default-8.mjs\ntests/jerry/module-export-default-9.mjs\ntests/jerry/module-export-default-10.mjs\ntests/jerry/module-export-default-main.mjs\ntests/jerry/module-export-fail-test.mjs\ntests/jerry/module-import-01.mjs\ntests/jerry/module-import-02.mjs\ntests/jerry/module-import-03.mjs\ntests/jerry/module-import-04.mjs\ntests/jerry/module-import-05.mjs\ntests/jerry/module-import-06.mjs\ntests/jerry/module-import-07.mjs\ntests/jerry/module-import-global.mjs\ntests/jerry/module-namespace-01.mjs\ntests/jerry/module-namespace-02.mjs\ntests/jerry/module-namespace-03.mjs\ntests/jerry/module-namespace-04.mjs\ntests/jerry/module-source-name-export.mjs\ntests/jerry/module-source-name.mjs\ntests/jerry/regexp-dotAll.js\ntests/jerry/regression-test-issue-2842.mjs\ntests/jerry/regression-test-issue-3812.js\ntests/jerry/regression-test-issue-3866.js\ntests/jerry/regression-test-issue-3893.js\ntests/jerry/regression-test-issue-4138.js\ntests/jerry/regression-test-issue-4139.js\ntests/jerry/regression-test-issue-4432.js\ntests/jerry/string-raw.js\ntests/jerry/tagged-template-literal.js\n"
  },
  {
    "path": "tests/test262-excludelist.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<excludeList>\n  <!-- Uncategorized failing tests -->\n  <test id=\"built-ins/Array/prototype/splice/property-traps-order-with-species.js\"><reason></reason></test>\n  <test id=\"built-ins/Function/prototype/toString/class-declaration-explicit-ctor.js\"><reason></reason></test>\n  <test id=\"built-ins/Function/prototype/toString/class-expression-explicit-ctor.js\"><reason></reason></test>\n  <test id=\"built-ins/Function/prototype/toString/well-known-intrinsic-object-functions.js\"><reason></reason></test>\n  <test id=\"built-ins/GeneratorFunction/instance-yield-expr-in-param.js\"><reason></reason></test>\n  <test id=\"built-ins/GeneratorPrototype/return/from-state-completed.js\"><reason></reason></test>\n  <test id=\"built-ins/Number/prototype/toExponential/return-values.js\"><reason></reason></test>\n  <test id=\"built-ins/Number/prototype/toFixed/exactness.js\"><reason></reason></test>\n  <test id=\"built-ins/Number/prototype/toPrecision/exponential.js\"><reason></reason></test>\n  <test id=\"built-ins/Proxy/preventExtensions/trap-is-undefined-target-is-proxy.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/matchAll/regexp-is-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/normalize/form-is-not-valid-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/normalize/length.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/normalize/name.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/normalize/normalize.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/normalize/return-abrupt-from-form.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/normalize/return-abrupt-from-this.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/normalize/return-normalized-string-from-coerced-form.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/normalize/return-normalized-string-using-default-parameter.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/normalize/return-normalized-string.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/toLocaleLowerCase/Final_Sigma_U180E.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/toLocaleLowerCase/special_casing_conditional.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/toLowerCase/Final_Sigma_U180E.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/toLowerCase/special_casing_conditional.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-function.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js\"><reason></reason></test>\n  <test id=\"language/eval-code/direct/non-definable-function-with-function.js\"><reason></reason></test>\n  <test id=\"language/eval-code/direct/non-definable-function-with-variable.js\"><reason></reason></test>\n  <test id=\"language/eval-code/direct/non-definable-global-function.js\"><reason></reason></test>\n  <test id=\"language/eval-code/direct/non-definable-global-generator.js\"><reason></reason></test>\n  <test id=\"language/eval-code/direct/non-definable-global-var.js\"><reason></reason></test>\n  <test id=\"language/eval-code/direct/var-env-func-init-global-update-configurable.js\"><reason></reason></test>\n  <test id=\"language/eval-code/direct/var-env-gloabl-lex-strict-caller.js\"><reason></reason></test>\n  <test id=\"language/eval-code/direct/var-env-global-lex-strict-source.js\"><reason></reason></test>\n  <test id=\"language/eval-code/direct/var-env-lower-lex-strict-caller.js\"><reason></reason></test>\n  <test id=\"language/eval-code/direct/var-env-lower-lex-strict-source.js\"><reason></reason></test>\n  <test id=\"language/eval-code/indirect/non-definable-function-with-function.js\"><reason></reason></test>\n  <test id=\"language/eval-code/indirect/non-definable-function-with-variable.js\"><reason></reason></test>\n  <test id=\"language/eval-code/indirect/non-definable-global-function.js\"><reason></reason></test>\n  <test id=\"language/eval-code/indirect/non-definable-global-generator.js\"><reason></reason></test>\n  <test id=\"language/eval-code/indirect/non-definable-global-var.js\"><reason></reason></test>\n  <test id=\"language/eval-code/indirect/var-env-func-init-global-new.js\"><reason></reason></test>\n  <test id=\"language/eval-code/indirect/var-env-func-init-global-update-configurable.js\"><reason></reason></test>\n  <test id=\"language/eval-code/indirect/var-env-var-init-global-new.js\"><reason></reason></test>\n  <test id=\"language/expressions/arrow-function/param-dflt-yield-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/S11.13.1_A5_T1.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/S11.13.1_A5_T2.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/S11.13.1_A5_T3.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/S11.13.1_A5_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/S11.13.1_A5_T5.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/S11.13.1_A6_T1.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/S11.13.1_A6_T2.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/S11.13.1_A6_T3.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/S11.13.1_A7_T1.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/S11.13.1_A7_T2.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/S11.13.1_A7_T3.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/destructuring/iterator-destructuring-property-reference-target-evaluation-order.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/destructuring/keyed-destructuring-property-reference-target-evaluation-order.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/eval-spread-empty-leading.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/eval-spread-empty-trailing.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/eval-spread.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/class-name-ident-let-escaped.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/class-name-ident-let.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/class-name-ident-static-escaped.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/class-name-ident-static.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/class-name-ident-yield-escaped.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/class-name-ident-yield.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/name.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/S11.13.2_A7.10_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/S11.13.2_A7.11_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/S11.13.2_A7.1_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/S11.13.2_A7.2_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/S11.13.2_A7.3_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/S11.13.2_A7.4_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/S11.13.2_A7.5_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/S11.13.2_A7.6_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/S11.13.2_A7.7_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/S11.13.2_A7.8_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/S11.13.2_A7.9_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/import.meta/distinct-for-each-module.js\"><reason></reason></test>\n  <test id=\"language/expressions/object/method-definition/early-errors-object-async-method-duplicate-parameters.js\"><reason></reason></test>\n  <test id=\"language/expressions/object/method-definition/early-errors-object-method-async-lineterminator.js\"><reason></reason></test>\n  <test id=\"language/expressions/object/method-definition/early-errors-object-method-duplicate-parameters.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-decrement/S11.3.2_A5_T1.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-decrement/S11.3.2_A5_T2.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-decrement/S11.3.2_A5_T3.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-decrement/S11.3.2_A5_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-decrement/S11.3.2_A5_T5.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-decrement/S11.3.2_A6_T3.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-increment/S11.3.1_A5_T1.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-increment/S11.3.1_A5_T2.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-increment/S11.3.1_A5_T3.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-increment/S11.3.1_A5_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-increment/S11.3.1_A5_T5.js\"><reason></reason></test>\n  <test id=\"language/expressions/postfix-increment/S11.3.1_A6_T3.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-decrement/S11.4.5_A5_T1.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-decrement/S11.4.5_A5_T2.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-decrement/S11.4.5_A5_T3.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-decrement/S11.4.5_A5_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-decrement/S11.4.5_A5_T5.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-decrement/S11.4.5_A6_T3.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-increment/S11.4.4_A5_T1.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-increment/S11.4.4_A5_T2.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-increment/S11.4.4_A5_T3.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-increment/S11.4.4_A5_T4.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-increment/S11.4.4_A5_T5.js\"><reason></reason></test>\n  <test id=\"language/expressions/prefix-increment/S11.4.4_A6_T3.js\"><reason></reason></test>\n  <test id=\"language/expressions/super/call-proto-not-ctor.js\"><reason></reason></test>\n  <test id=\"language/expressions/super/prop-dot-cls-ref-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/super/prop-dot-obj-ref-non-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/super/prop-dot-obj-ref-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/super/prop-expr-cls-ref-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/super/prop-expr-obj-key-err.js\"><reason></reason></test>\n  <test id=\"language/expressions/super/prop-expr-obj-ref-non-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/super/prop-expr-obj-ref-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/tagged-template/invalid-escape-sequences.js\"><reason></reason></test>\n  <test id=\"language/expressions/yield/star-return-is-null.js\"><reason></reason></test>\n  <test id=\"language/expressions/yield/star-throw-is-null.js\"><reason></reason></test>\n  <test id=\"language/expressions/arrow-function/unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/expressions/arrow-function/unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/target-super-computed-reference-null.js\"><reason></reason></test>\n  <test id=\"language/expressions/assignment/target-super-identifier-reference-null.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-arrow-function/unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-arrow-function/unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-function/named-unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-function/named-unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-function/nameless-unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-function/nameless-unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/named-unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/named-unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/super-access-from-arrow-func-on-field.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/syntax/early-errors/class-heritage-array-literal-arrow-heritage.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/syntax/early-errors/class-heritage-array-literal-async-arrow-heritage.js\"><reason></reason></test>\n  <test id=\"language/expressions/delete/super-property-null-base.js\"><reason></reason></test>\n  <test id=\"language/expressions/function/unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/expressions/function/unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/expressions/generators/unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/expressions/generators/unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/expressions/in/private-field-in-nested.js\"><reason></reason></test>\n  <test id=\"language/expressions/object/__proto__-permitted-dup-shorthand.js\"><reason></reason></test>\n  <test id=\"language/expressions/object/cpn-obj-lit-computed-property-name-from-await-expression.js\"><reason></reason></test>\n  <test id=\"language/expressions/template-literal/invalid-legacy-octal-escape-sequence-8.js\"><reason></reason></test>\n  <test id=\"language/expressions/template-literal/invalid-legacy-octal-escape-sequence-9.js\"><reason></reason></test>\n  <test id=\"language/identifier-resolution/assign-to-global-undefined.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-10.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-10.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-10.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-10.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-11.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-11.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-11.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-11.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-12.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-12.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-12.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-12.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-13.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-13.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-13.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-13.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-14.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-14.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-14.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-14.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-5.2.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-5.2.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-5.2.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-5.2.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-6.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-6.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-6.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-6.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-6.1.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-6.1.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-6.1.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-6.1.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-7.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-7.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-7.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-7.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-8.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-8.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-8.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-8.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-9.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-9.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-9.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/part-unicode-9.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-10.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-10.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-10.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-10.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-11.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-11.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-11.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-11.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-12.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-12.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-12.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-12.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-13.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-13.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-13.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-13.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-14.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-14.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-14.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-14.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-5.2.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-5.2.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-5.2.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-5.2.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-6.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-6.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-6.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-6.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-6.1.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-6.1.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-6.1.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-6.1.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-7.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-7.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-7.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-7.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-8.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-8.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-8.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-8.0.0.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-9.0.0-class-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-9.0.0-class.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-9.0.0-escaped.js\"><reason></reason></test>\n  <test id=\"language/identifiers/start-unicode-9.0.0.js\"><reason></reason></test>\n  <test id=\"language/import/json-extensibility-array.js\"><reason></reason></test>\n  <test id=\"language/import/json-extensibility-object.js\"><reason></reason></test>\n  <test id=\"language/import/json-idempotency.js\"><reason></reason></test>\n  <test id=\"language/import/json-value-array.js\"><reason></reason></test>\n  <test id=\"language/import/json-value-boolean.js\"><reason></reason></test>\n  <test id=\"language/import/json-value-null.js\"><reason></reason></test>\n  <test id=\"language/import/json-value-number.js\"><reason></reason></test>\n  <test id=\"language/import/json-value-object.js\"><reason></reason></test>\n  <test id=\"language/import/json-value-string.js\"><reason></reason></test>\n  <test id=\"language/import/json-via-namespace.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-octal-escape-sequence-prologue-strict.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-non-octal-escape-sequence-1-strict-explicit-pragma.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-non-octal-escape-sequence-2-strict-explicit-pragma.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-non-octal-escape-sequence-3-strict-explicit-pragma.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-non-octal-escape-sequence-4-strict-explicit-pragma.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-non-octal-escape-sequence-5-strict-explicit-pragma.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-non-octal-escape-sequence-6-strict-explicit-pragma.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-non-octal-escape-sequence-7-strict-explicit-pragma.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-non-octal-escape-sequence-8-strict-explicit-pragma.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-non-octal-escape-sequence-8-strict.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-non-octal-escape-sequence-9-strict-explicit-pragma.js\"><reason></reason></test>\n  <test id=\"language/literals/string/legacy-non-octal-escape-sequence-9-strict.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-cls-anon.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-cls-name-meth.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-cls-named.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-expr-cls-anon.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-expr-cls-name-meth.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-expr-cls-named.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-expr-err-get-value.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-expr-fn-anon.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-expr-fn-named.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-expr-gen-anon.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-expr-gen-named.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-export-dflt-expr-in.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-gtbndng-indirect-trlng-comma.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-gtbndng-indirect-update-as.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-rqstd-abrupt.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-rqstd-once.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-rqstd-order.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-self-once.js\"><reason></reason></test>\n  <test id=\"language/module-code/export-star-as-dflt.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-iee-bndng-cls.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-iee-bndng-const.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-iee-bndng-fun.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-iee-bndng-gen.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-iee-bndng-let.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-iee-bndng-var.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-iee-iee-cycle.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-iee-star-cycle.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-iee-trlng-comma.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-cls.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-const.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-dflt-cls.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-dflt-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-dflt-fun-anon.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-dflt-fun-named.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-dflt-gen-anon.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-dflt-gen-named.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-dflt-named.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-dflt-star.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-fun.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-gen.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-let.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-trlng-comma.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-bndng-var.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-id-name.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-iee-cycle.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-named-star-cycle.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-once.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-same-global.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-ambiguous.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-as-props-dflt-skip.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-binding.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-equality.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-id-name.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-iee-cycle.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-props-circular.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-props-dflt-keep-indirect.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-props-dflt-keep-local.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-props-dflt-skip.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-props-nrml.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-star-star-cycle.js\"><reason></reason></test>\n  <test id=\"language/module-code/instn-uniq-env-rec.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/Symbol.iterator.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/Symbol.toStringTag.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/define-own-property.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/delete-exported-init.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/delete-exported-uninit.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/delete-non-exported.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/enumerate-binding-uninit.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-nested-namespace-dflt-skip.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-nested-namespace-props-nrml.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-own-property-str-found-init.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-own-property-str-found-uninit.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-own-property-str-not-found.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-own-property-sym.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-prototype-of.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-str-found-init.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-str-found-uninit.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-str-initialize.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-str-not-found.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-str-update.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-sym-found.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/get-sym-not-found.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/has-property-str-found-init.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/has-property-str-found-uninit.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/has-property-str-not-found.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/has-property-sym-found.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/has-property-sym-not-found.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/is-extensible.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/object-hasOwnProperty-binding-uninit.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/object-keys-binding-uninit.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/object-propertyIsEnumerable-binding-uninit.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/own-property-keys-binding-types.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/own-property-keys-sort.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/prevent-extensions.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/set-prototype-of-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/set-prototype-of.js\"><reason></reason></test>\n  <test id=\"language/module-code/namespace/internals/set.js\"><reason></reason></test>\n  <test id=\"language/module-code/parse-err-hoist-lex-fun.js\"><reason></reason></test>\n  <test id=\"language/module-code/parse-err-hoist-lex-gen.js\"><reason></reason></test>\n  <test id=\"language/module-code/early-dup-top-function-async-generator.js\"><reason></reason></test>\n  <test id=\"language/module-code/early-dup-top-function-async.js\"><reason></reason></test>\n  <test id=\"language/module-code/early-dup-top-function-generator.js\"><reason></reason></test>\n  <test id=\"language/module-code/early-dup-top-function.js\"><reason></reason></test>\n  <test id=\"language/module-code/eval-gtbndng-indirect-faux-assertion.js\"><reason></reason></test>\n  <test id=\"language/module-code/export-expname-binding-index.js\"><reason></reason></test>\n  <test id=\"language/module-code/export-expname-binding-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/export-expname-from-binding-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/export-expname-from-star-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/export-expname-from-star.js\"><reason></reason></test>\n  <test id=\"language/module-code/export-expname-from-string-binding.js\"><reason></reason></test>\n  <test id=\"language/module-code/export-expname-from-string-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/export-expname-from-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/export-expname-import-string-binding.js\"><reason></reason></test>\n  <test id=\"language/module-code/import-assertion-empty.js\"><reason></reason></test>\n  <test id=\"language/module-code/import-assertion-key-identifiername.js\"><reason></reason></test>\n  <test id=\"language/module-code/import-assertion-key-string-double.js\"><reason></reason></test>\n  <test id=\"language/module-code/import-assertion-key-string-single.js\"><reason></reason></test>\n  <test id=\"language/module-code/import-assertion-many.js\"><reason></reason></test>\n  <test id=\"language/module-code/import-assertion-newlines.js\"><reason></reason></test>\n  <test id=\"language/module-code/import-assertion-trlng-comma.js\"><reason></reason></test>\n  <test id=\"language/module-code/import-assertion-value-string-double.js\"><reason></reason></test>\n  <test id=\"language/module-code/import-assertion-value-string-single.js\"><reason></reason></test>\n  <test id=\"language/statements/async-function/let-newline-await-in-async-function.js\"><reason></reason></test>\n  <test id=\"language/statements/class/class-name-ident-let-escaped.js\"><reason></reason></test>\n  <test id=\"language/statements/class/class-name-ident-let.js\"><reason></reason></test>\n  <test id=\"language/statements/class/class-name-ident-static-escaped.js\"><reason></reason></test>\n  <test id=\"language/statements/class/class-name-ident-static.js\"><reason></reason></test>\n  <test id=\"language/statements/class/class-name-ident-yield-escaped.js\"><reason></reason></test>\n  <test id=\"language/statements/class/class-name-ident-yield.js\"><reason></reason></test>\n  <test id=\"language/statements/class/constructor-inferred-observable-iteration.js\"><reason></reason></test>\n  <test id=\"language/statements/class/super/in-constructor-superproperty-evaluation.js\"><reason></reason></test>\n  <test id=\"language/statements/do-while/cptn-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/do-while/cptn-normal.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/cptn-decl-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/cptn-decl-itr.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/cptn-decl-skip-itr.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/cptn-decl-zero-itr.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/cptn-expr-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/cptn-expr-itr.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/cptn-expr-skip-itr.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/cptn-expr-zero-itr.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/head-lhs-let.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/let-block-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/let-identifier-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/scope-body-lex-open.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/scope-head-lex-close.js\"><reason></reason></test>\n  <test id=\"language/statements/for-in/scope-head-lex-open.js\"><reason></reason></test>\n  <test id=\"language/statements/for-of/cptn-decl-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/for-of/cptn-decl-itr.js\"><reason></reason></test>\n  <test id=\"language/statements/for-of/cptn-decl-no-itr.js\"><reason></reason></test>\n  <test id=\"language/statements/for-of/cptn-expr-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/for-of/cptn-expr-itr.js\"><reason></reason></test>\n  <test id=\"language/statements/for-of/cptn-expr-no-itr.js\"><reason></reason></test>\n  <test id=\"language/statements/for-of/let-block-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/for-of/let-identifier-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/for-of/scope-body-lex-open.js\"><reason></reason></test>\n  <test id=\"language/statements/for-of/scope-head-lex-close.js\"><reason></reason></test>\n  <test id=\"language/statements/for/cptn-decl-expr-iter.js\"><reason></reason></test>\n  <test id=\"language/statements/for/cptn-decl-expr-no-iter.js\"><reason></reason></test>\n  <test id=\"language/statements/for/cptn-expr-expr-iter.js\"><reason></reason></test>\n  <test id=\"language/statements/for/cptn-expr-expr-no-iter.js\"><reason></reason></test>\n  <test id=\"language/statements/for/head-init-expr-check-empty-inc-empty-completion.js\"><reason></reason></test>\n  <test id=\"language/statements/for/head-init-var-check-empty-inc-empty-completion.js\"><reason></reason></test>\n  <test id=\"language/statements/for/let-block-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/for/let-identifier-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/for/scope-body-lex-open.js\"><reason></reason></test>\n  <test id=\"language/statements/if/cptn-else-false-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/if/cptn-else-false-nrml.js\"><reason></reason></test>\n  <test id=\"language/statements/if/cptn-else-true-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/if/cptn-else-true-nrml.js\"><reason></reason></test>\n  <test id=\"language/statements/if/cptn-no-else-false.js\"><reason></reason></test>\n  <test id=\"language/statements/if/cptn-no-else-true-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/if/cptn-no-else-true-nrml.js\"><reason></reason></test>\n  <test id=\"language/statements/if/let-block-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/if/let-identifier-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/labeled/let-block-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/labeled/let-identifier-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/let/syntax/let-newline-yield-in-generator-function.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/cptn-a-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/cptn-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/cptn-b-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/cptn-b-final.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/cptn-dflt-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/cptn-dflt-b-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/cptn-dflt-b-final.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/cptn-dflt-final.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/cptn-no-dflt-match-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/cptn-no-dflt-match-final.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/cptn-no-dflt-no-match.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-function.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js\"><reason></reason></test>\n  <test id=\"language/statements/try/cptn-catch-empty-break.js\"><reason></reason></test>\n  <test id=\"language/statements/try/cptn-catch-empty-continue.js\"><reason></reason></test>\n  <test id=\"language/statements/try/cptn-catch-finally-empty-break.js\"><reason></reason></test>\n  <test id=\"language/statements/try/cptn-catch-finally-empty-continue.js\"><reason></reason></test>\n  <test id=\"language/statements/try/cptn-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/try/cptn-finally-empty-break.js\"><reason></reason></test>\n  <test id=\"language/statements/try/cptn-finally-empty-continue.js\"><reason></reason></test>\n  <test id=\"language/statements/try/cptn-finally-from-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/try/cptn-finally-skip-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/try/cptn-finally-wo-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/try/cptn-try.js\"><reason></reason></test>\n  <test id=\"language/statements/try/scope-catch-block-lex-open.js\"><reason></reason></test>\n  <test id=\"language/statements/variable/binding-resolution.js\"><reason></reason></test>\n  <test id=\"language/statements/while/cptn-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/while/cptn-iter.js\"><reason></reason></test>\n  <test id=\"language/statements/while/cptn-no-iter.js\"><reason></reason></test>\n  <test id=\"language/statements/while/let-block-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/while/let-identifier-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/with/cptn-abrupt-empty.js\"><reason></reason></test>\n  <test id=\"language/statements/with/cptn-nrml.js\"><reason></reason></test>\n  <test id=\"language/statements/with/let-block-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/with/let-identifier-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/async-function/unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/statements/async-function/unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/statements/async-generator/unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/statements/async-generator/unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/private-method-double-initialisation-get-and-set.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/private-method-double-initialisation-get.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/private-method-double-initialisation-set.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/privatefieldset-evaluation-order-1.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/privatefieldset-evaluation-order-2.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/privatefieldset-evaluation-order-3.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/privatefieldset-typeerror-10.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/privatefieldset-typeerror-11.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/privatefieldset-typeerror-6.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/privatefieldset-typeerror-7.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/privatefieldset-typeerror-8.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/privatefieldset-typeerror-9.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/super-access-from-arrow-func-on-field.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/syntax/early-errors/class-heritage-array-literal-arrow-heritage.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/syntax/early-errors/class-heritage-array-literal-async-arrow-heritage.js\"><reason></reason></test>\n  <test id=\"language/statements/class/private-non-static-getter-static-setter-early-error.js\"><reason></reason></test>\n  <test id=\"language/statements/class/private-non-static-setter-static-getter-early-error.js\"><reason></reason></test>\n  <test id=\"language/statements/class/private-static-getter-non-static-setter-early-error.js\"><reason></reason></test>\n  <test id=\"language/statements/class/private-static-setter-non-static-getter-early-error.js\"><reason></reason></test>\n  <test id=\"language/statements/for-await-of/head-lhs-async.js\"><reason></reason></test>\n  <test id=\"language/statements/for-of/head-lhs-async-parens.js\"><reason></reason></test>\n  <test id=\"language/statements/function/unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/statements/function/unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/statements/generators/unscopables-with-in-nested-fn.js\"><reason></reason></test>\n  <test id=\"language/statements/generators/unscopables-with.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/scope-lex-async-function.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/scope-lex-async-generator.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/scope-lex-generator.js\"><reason></reason></test>\n  <test id=\"language/statements/try/completion-values.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-em-quad.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-em-space.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-en-quad.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-en-space.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-figure-space.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-four-per-em-space.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-hair-space.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-ideographic-space.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-medium-mathematical-space.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-nnbsp.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-ogham-space.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-punctuation-space.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-six-per-em-space.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-thin-space.js\"><reason></reason></test>\n  <test id=\"language/white-space/after-regular-expression-literal-three-per-em-space.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/forEach/callbackfn-resize-arraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/map/callbackfn-resize-arraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/reverse/call-with-boolean.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/some/callbackfn-resize-arraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/sort/call-with-primitive.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/sort/precise-comparefn-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/sort/precise-getter-decreases-length.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/sort/precise-getter-deletes-successor.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/sort/precise-getter-pops-elements.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/sort/precise-prototype-accessors.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/sort/precise-prototype-element.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/toString/non-callable-join-string-tag.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/implicit-infinity-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/custom-proto-access-resizes-buffer-invalid-by-length.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/custom-proto-access-resizes-buffer-invalid-by-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/custom-proto-access-resizes-buffer-valid-by-length.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/custom-proto-access-resizes-buffer-valid-by-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/byteLength/resizable-array-buffer-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/byteLength/resizable-array-buffer-fixed.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/byteOffset/resizable-array-buffer-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/byteOffset/resizable-array-buffer-fixed.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/getBigInt64/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/getBigUint64/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/getFloat32/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/getFloat64/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/getInt16/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/getInt32/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/getInt8/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/getUint16/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/getUint32/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/getUint8/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/setBigInt64/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/setBigUint64/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/setFloat32/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/setFloat64/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/setInt16/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/setInt32/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/setInt8/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/setUint16/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/setUint32/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/DataView/prototype/setUint8/resizable-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/Error/cause_abrupt.js\"><reason></reason></test>\n  <test id=\"built-ins/Error/cause_property.js\"><reason></reason></test>\n  <test id=\"built-ins/Error/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/is-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/unregister/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Function/internals/Call/class-ctor-realm.js\"><reason></reason></test>\n  <test id=\"built-ins/Function/prototype/bind/instance-length-tointeger.js\"><reason></reason></test>\n  <test id=\"built-ins/NativeErrors/AggregateError/cause-property.js\"><reason></reason></test>\n  <test id=\"built-ins/NativeErrors/cause_property_native_error.js\"><reason></reason></test>\n  <test id=\"built-ins/Object/freeze/proxy-with-defineProperty-handler.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/length/define-own-prop-length-coercion-order-set.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/Symbol.unscopables/value.js\"><reason></reason></test>\n  <test id=\"built-ins/Object/property-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Object/seal/proxy-with-defineProperty-handler.js\"><reason></reason></test>\n  <test id=\"built-ins/Object/seal/seal-finalizationregistry.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/all/resolve-element-function-property-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/allSettled/reject-element-function-property-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/allSettled/resolve-element-function-property-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/any/reject-element-function-property-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/executor-function-property-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/property-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/reject-function-property-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/resolve-function-property-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Proxy/revocable/revocation-function-property-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Reflect/Symbol.toStringTag.js\"><reason></reason></test>\n  <test id=\"built-ins/Reflect/apply/arguments-list-is-not-array-like.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/duplicate-flags.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Cypro_Minoan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Old_Uyghur.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Tangsa.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Toto.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Vithkuqi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Cypro_Minoan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Old_Uyghur.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tangsa.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Toto.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Vithkuqi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/strings/Basic_Emoji.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/strings/Emoji_Keycap_Sequence.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/strings/Emoji_Test.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Flag_Sequence.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Modifier_Sequence.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_Tag_Sequence.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/strings/RGI_Emoji_ZWJ_Sequence.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/flags/coercion-hasIndices.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/flags/get-order.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/flags/rethrow.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/flags/return-order.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/flags/this-val-regexp.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/split/this-value-tostring-error.js\"><reason></reason></test>\n  <!-- END - Uncategorized failing tests -->\n\n  <!-- AnnexB - Additional ECMAScript Features for Web Browsers\n       https://www.ecma-international.org/ecma-262/11.0/#sec-additional-ecmascript-features-for-web-browsers\n  -->\n  <test id=\"annexB/built-ins/Function/createdynfn-html-close-comment-body.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/Function/createdynfn-html-close-comment-params.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/Function/createdynfn-html-open-comment-body.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/Function/createdynfn-html-open-comment-params.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/Function/createdynfn-no-line-terminator-html-close-comment-body.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/anchor/B.2.3.2.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/anchor/attr-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/anchor/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/anchor/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/anchor/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/anchor/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/big/B.2.3.3.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/big/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/big/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/big/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/big/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/blink/B.2.3.4.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/blink/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/blink/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/blink/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/blink/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/bold/B.2.3.5.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/bold/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/bold/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/bold/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/bold/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fixed/B.2.3.6.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fixed/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fixed/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fixed/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fixed/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontcolor/B.2.3.7.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontcolor/attr-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontcolor/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontcolor/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontcolor/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontcolor/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontsize/B.2.3.8.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontsize/attr-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontsize/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontsize/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontsize/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/fontsize/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/italics/B.2.3.9.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/italics/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/italics/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/italics/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/italics/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/link/B.2.3.10.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/link/attr-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/link/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/link/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/link/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/link/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/small/B.2.3.11.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/small/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/small/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/small/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/small/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/strike/B.2.3.12.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/strike/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/strike/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/strike/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/strike/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/sub/B.2.3.13.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/sub/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/sub/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/sub/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/sub/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/sup/B.2.3.14.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/sup/length.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/sup/name.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/sup/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/sup/this-val-tostring-err.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/Object/is/emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/index/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/index/this-cross-realm-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/index/this-not-regexp-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/index/this-subclass-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/input/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/input/this-cross-realm-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/input/this-not-regexp-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/input/this-subclass-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/lastMatch/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-cross-realm-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-not-regexp-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/lastMatch/this-subclass-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/lastParen/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/lastParen/this-cross-realm-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/lastParen/this-not-regexp-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/lastParen/this-subclass-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/leftContext/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/leftContext/this-cross-realm-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/leftContext/this-not-regexp-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/leftContext/this-subclass-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/rightContext/prop-desc.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/rightContext/this-cross-realm-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/rightContext/this-not-regexp-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/legacy-accessors/rightContext/this-subclass-constructor.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/prototype/compile/this-cross-realm-instance.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/prototype/compile/this-subclass-instance.js\"><reason></reason></test>\n  <test id=\"annexB/language/comments/multi-line-html-close.js\"><reason></reason></test>\n  <test id=\"annexB/language/comments/single-line-html-close-asi.js\"><reason></reason></test>\n  <test id=\"annexB/language/comments/single-line-html-close-unicode-separators.js\"><reason></reason></test>\n  <test id=\"annexB/language/comments/single-line-html-close.js\"><reason></reason></test>\n  <test id=\"annexB/language/comments/single-line-html-open.js\"><reason></reason></test>\n  <test id=\"annexB/language/eval-code/indirect/global-block-decl-eval-global-init.js\"><reason></reason></test>\n  <test id=\"annexB/language/eval-code/indirect/global-if-decl-else-decl-a-eval-global-init.js\"><reason></reason></test>\n  <test id=\"annexB/language/eval-code/indirect/global-if-decl-else-decl-b-eval-global-init.js\"><reason></reason></test>\n  <test id=\"annexB/language/eval-code/indirect/global-if-decl-else-stmt-eval-global-init.js\"><reason></reason></test>\n  <test id=\"annexB/language/eval-code/indirect/global-if-decl-no-else-eval-global-init.js\"><reason></reason></test>\n  <test id=\"annexB/language/eval-code/indirect/global-if-stmt-else-decl-eval-global-init.js\"><reason></reason></test>\n  <test id=\"annexB/language/eval-code/indirect/global-switch-case-eval-global-init.js\"><reason></reason></test>\n  <test id=\"annexB/language/eval-code/indirect/global-switch-dflt-eval-global-init.js\"><reason></reason></test>\n  <test id=\"annexB/language/function-code/block-decl-func-skip-arguments.js\"><reason></reason></test>\n  <test id=\"annexB/language/function-code/block-decl-nested-blocks-with-fun-decl.js\"><reason></reason></test>\n  <test id=\"annexB/language/statements/for-in/nonstrict-initializer.js\"><reason></reason></test>\n  <test id=\"annexB/language/expressions/coalesce/emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/language/expressions/logical-assignment/emulates-undefined-coalesce.js\"><reason></reason></test>\n  <test id=\"annexB/language/expressions/strict-does-not-equals/emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/language/expressions/strict-equals/emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/language/statements/class/subclass/superclass-prototype-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/language/statements/switch/emulates-undefined.js\"><reason></reason></test>\n  <!-- END AnnexB - Additional ECMAScript Features for Web Browsers -->\n\n  <!-- ECMAScript Internationalization API\n       https://ecma-international.org/publications/standards/Ecma-402.htm\n  -->\n  <test id=\"intl402/BigInt/prototype/toLocaleString/de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/BigInt/prototype/toLocaleString/default-options-object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/BigInt/prototype/toLocaleString/en-US.js\"><reason></reason></test>\n  <test id=\"intl402/BigInt/prototype/toLocaleString/returns-same-results-as-NumberFormat.js\"><reason></reason></test>\n  <test id=\"intl402/BigInt/prototype/toLocaleString/taint-Intl-NumberFormat.js\"><reason></reason></test>\n  <test id=\"intl402/BigInt/prototype/toLocaleString/throws-same-exceptions-as-NumberFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/constructor-options-throwing-getters.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/default-options-object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/ignore-invalid-unicode-ext-values.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/instance-proto-and-extensible.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/legacy-regexp-statics-not-modified.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/length.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/missing-unicode-ext-value-defaults-to-true.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/name.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/numeric-and-caseFirst.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/bound-to-collator-instance.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/canonically-equivalent-strings.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/compare-function-builtin.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/compare-function-length.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/compare-function-name.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/length.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/name.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/non-normative-basic.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/non-normative-phonebook.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/non-normative-sensitivity.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/constructor/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/constructor/value.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/resolvedOptions/basic.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/resolvedOptions/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/resolvedOptions/length.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/resolvedOptions/name.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/resolvedOptions/order.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/resolvedOptions/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/this-value-collator-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/this-value-not-collator.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/toStringTag/toString-changed-tag.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/toStringTag/toString-removed-tag.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/toStringTag/toString.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/toStringTag/toStringTag.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/subclassing.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/supportedLocalesOf/basic.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/supportedLocalesOf/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/supportedLocalesOf/length.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/supportedLocalesOf/name.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/supportedLocalesOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/supportedLocalesOf/taint-Object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/taint-Object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/test-option-ignorePunctuation.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/test-option-localeMatcher.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/test-option-numeric-and-caseFirst.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/test-option-sensitivity.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/test-option-usage.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/this-value-ignored.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/unicode-ext-seq-in-private-tag.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/unicode-ext-seq-with-attribute.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/unicode-ext-value-collation.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/usage-de.js\"><reason></reason></test>\n  <test id=\"intl402/Date/prototype/returns-same-results-as-DateTimeFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Date/prototype/taint-Intl-DateTimeFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Date/prototype/throws-same-exceptions-as-DateTimeFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Date/prototype/toLocaleString/default-options-object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/casing-numbering-system-calendar-options.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-calendar-numberingSystem-order.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-default-value.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-calendar-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-dateStyle-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-dateStyle-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-dayPeriod-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-dayPeriod-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-numberingSystem-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-order-dayPeriod.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-order-fractionalSecondDigits.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-order-timedate-style.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-order.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-throwing-getters-dayPeriod.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-throwing-getters-fractionalSecondDigits.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-throwing-getters-timedate-style.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-throwing-getters.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-timeStyle-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-timeStyle-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-toobject.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/date-time-options.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/default-options-object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/ignore-invalid-unicode-ext-values.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/instance-proto-and-extensible.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/legacy-regexp-statics-not-modified.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/length.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/name.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/numbering-system-calendar-options.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/constructor/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/constructor/value.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/bound-to-datetimeformat-instance.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/date-constructor-not-called.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/dayPeriod-long-en.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/dayPeriod-narrow-en.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/dayPeriod-short-en.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/format-function-builtin.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/format-function-length.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/format-function-name.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/fractionalSecondDigits.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/length.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/name.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/proleptic-gregorian-calendar.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/related-year-zh.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/taint-Object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/throws-value-non-finite.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/time-clip-near-time-boundaries.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/time-clip-to-integer.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/timedatestyle-en.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/argument-date-string.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/argument-near-time-boundaries.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/argument-to-integer.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/argument-tonumber-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/date-is-infinity-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/date-is-nan-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/date-undefined-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/date-x-greater-than-y-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/en-US.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/fractionalSecondDigits.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/length.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/name.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/this-bad-object.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/this-is-not-object-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/argument-date-string.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/argument-near-time-boundaries.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/argument-to-integer.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/argument-tonumber-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/date-is-infinity-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/date-is-nan-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/date-undefined-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/date-x-greater-than-y-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/en-US.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/fractionalSecondDigits.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/length.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/name.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/pattern-on-calendar.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/this-bad-object.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/this-is-not-object-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/date-constructor-not-called.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/date-is-infinity-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/date-is-nan-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/dayPeriod-long-en.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/dayPeriod-narrow-en.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/dayPeriod-short-en.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/formatToParts.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/fractionalSecondDigits.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/length.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/main.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/name.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/pattern-on-calendar.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/related-year-zh.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/related-year.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/return-abrupt-tonumber-date.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/this-has-not-internal-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/this-is-not-object-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/time-clip-near-time-boundaries.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/time-clip-to-integer.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/basic.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle-dateStyle.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle-default.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle-timeStyle.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/length.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/name.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/order-dayPeriod.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/order-fractionalSecondDigits.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/order-style.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/order.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/resolved-locale-with-hc-unicode.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/this-value-datetimeformat-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/this-value-not-datetimeformat.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/toStringTag/toString-changed-tag.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/toStringTag/toString-removed-tag.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/toStringTag/toString.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/toStringTag/toStringTag.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/required-date-time-formats.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/subclassing.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/supportedLocalesOf/basic.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/supportedLocalesOf/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/supportedLocalesOf/length.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/supportedLocalesOf/name.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/supportedLocalesOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/supportedLocalesOf/taint-Object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/taint-Object-prototype-date-time-components.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/taint-Object-prototype-dayPeriod.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/taint-Object-prototype-fractionalSecondDigits.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/taint-Object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/test-option-date-time-components.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/test-option-formatMatcher.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/test-option-hour12.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/test-option-localeMatcher.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/this-value-ignored.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/timezone-canonicalized.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/timezone-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/timezone-utc.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/ctor-custom-get-prototype-poison-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/ctor-custom-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/ctor-default-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/instance-extensible.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/length.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/locales-invalid-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/locales-length-poison-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/locales-length-tolength-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/locales-symbol-length.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/name.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-fallback-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-fallback-invalid-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-fallback-toString-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-fallback-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-localeMatcher-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-localeMatcher-invalid-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-localeMatcher-toString-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-localeMatcher-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-null-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-random-properties-unchecked.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-style-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-style-invalid-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-style-toString-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-style-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-type-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-type-invalid-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-type-toString-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-type-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/proto.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/Symbol.toStringTag.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/resolvedOptions/default-option-values.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/resolvedOptions/length.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/resolvedOptions/name.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/resolvedOptions/option-fallback.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/resolvedOptions/option-style.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/resolvedOptions/option-type.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/resolvedOptions/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/resolvedOptions/return-object.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/resolvedOptions/this-not-object-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/resolvedOptions/this-object-lacks-internal-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/undefined-newtarget-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DurationFormat/prototype/prototype_attributes.js\"><reason></reason></test>\n  <test id=\"intl402/DurationFormat/prototype/toStringTag.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/Locale-object.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/canonicalized-tags.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/canonicalized-unicode-ext-seq.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/complex-language-subtag-replacement.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/complex-region-subtag-replacement.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/descriptor.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/duplicates.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/elements-not-reordered.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/error-cases.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/get-locale.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/getCanonicalLocales.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/grandfathered.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/has-property.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/invalid-tags.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/length.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/locales-is-not-a-string.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/main.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/name.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/non-iana-canon.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/overriden-arg-length.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/overriden-push.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/preferred-grandfathered.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/preferred-variant.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/returned-object-is-an-array.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/returned-object-is-mutable.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/to-string.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/transformed-ext-canonical.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/transformed-ext-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/transformed-ext-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-calendar.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-col-strength.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-measurement-system.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-region.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-subdivision.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-timezone.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-yes-to-true.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/unicode-ext-key-with-digit.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/getCanonicalLocales/weird-cases.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/proto.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/locales-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/locales-valid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/newtarget-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-localeMatcher-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-order.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-style-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-style-valid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-throwing-getters.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-toobject-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-toobject.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-type-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-type-valid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/subclassing.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/length.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/name.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/prototype.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/supportedLocalesOf/basic.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/supportedLocalesOf/branding.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/supportedLocalesOf/length.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/supportedLocalesOf/locales-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/supportedLocalesOf/name.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/supportedLocalesOf/options-localeMatcher-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/supportedLocalesOf/options-null.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/supportedLocalesOf/options-toobject.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/supportedLocalesOf/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/supportedLocalesOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/supportedLocalesOf/result-type.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/instance/extensibility.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/instance/prototype.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/constructor/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/branding.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/en-us-default.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/en-us-disjunction.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/en-us-narrow.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/en-us-short.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/en-us-unit.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/es-es-long.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/es-es-narrow.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/es-es-short.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/iterable-getiterator-throw.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/iterable-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/iterable-iteratorclose.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/iterable-iteratorstep-throw.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/iterable-iteratorvalue-throw.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/iterable-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/iterable.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/length.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/name.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/format/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/branding.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/en-us-default.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/en-us-disjunction.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/en-us-narrow.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/en-us-short.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/en-us-unit.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/es-es-long.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/es-es-narrow.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/es-es-short.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/iterable-getiterator-throw.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/iterable-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/iterable-iteratorclose.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/iterable-iteratorstep-throw.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/iterable-iteratorvalue-throw.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/iterable-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/iterable.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/length.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/name.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/formatToParts/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/resolvedOptions/branding.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/resolvedOptions/caching.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/resolvedOptions/length.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/resolvedOptions/name.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/resolvedOptions/order.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/resolvedOptions/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/resolvedOptions/type.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/toStringTag/toString.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/prototype/toStringTag/toStringTag.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/canonicalize-locale-list-take-locale.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-apply-options-canonicalizes-twice.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-getter-order.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-locale-object.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-newtarget-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-non-iana-canon.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-calendar-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-calendar-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-canonicalized.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-casefirst-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-casefirst-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-collation-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-collation-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-hourcycle-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-hourcycle-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-language-grandfathered.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-language-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-language-valid-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-language-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-numberingsystem-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-numberingsystem-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-numeric-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-numeric-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-region-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-region-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-script-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-script-valid-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-script-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-options-throwing-getters.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-parse-twice.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-tag-tostring.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-tag.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-unicode-ext-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/constructor-unicode-ext-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/extensions-grandfathered.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/extensions-private.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/function-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/getters-grandfathered.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/getters-missing.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/getters.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/instance-extensibility.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/instance.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/invalid-tag-throws-boolean.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/invalid-tag-throws-null.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/invalid-tag-throws-number.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/invalid-tag-throws-symbol.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/invalid-tag-throws-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/invalid-tag-throws.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/length.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/likely-subtags-grandfathered.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/likely-subtags.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/baseName/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/baseName/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/baseName/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/calendar/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/calendar/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/calendar/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/caseFirst/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/caseFirst/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/caseFirst/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/collation/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/collation/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/collation/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/constructor/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/hourCycle/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/hourCycle/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/hourCycle/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/language/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/language/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/language/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/maximize/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/maximize/length.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/maximize/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/maximize/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/minimize/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/minimize/length.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/minimize/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/minimize/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/minimize/removing-likely-subtags-first-adds-likely-subtags.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/numberingSystem/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/numberingSystem/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/numberingSystem/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/numeric/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/numeric/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/numeric/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/region/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/region/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/region/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/script/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/script/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/script/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/toString/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/toString/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/toStringTag/toString-removed-tag.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/toStringTag/toString.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/toStringTag/toStringTag.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/subclassing.js\"><reason></reason></test>\n  <test id=\"intl402/Number/prototype/toLocaleString/default-options-object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/Number/prototype/toLocaleString/returns-same-results-as-NumberFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Number/prototype/toLocaleString/taint-Intl-NumberFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Number/prototype/toLocaleString/throws-same-exceptions-as-NumberFormat.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/casing-numbering-system-options.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-compactDisplay-compact.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-compactDisplay-no-compact.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-default-value.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-locales-arraylike.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-locales-get-tostring.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-locales-hasproperty.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-locales-string.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-locales-toobject.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-notation.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-numberingSystem-order.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-options-numberingSystem-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-options-throwing-getters.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-options-throwing-getters-rounding-increment.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-options-throwing-getters-rounding-priority.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-options-throwing-getters-trailing-zero-display.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-options-toobject.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-order.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-roundingIncrement-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-roundingIncrement.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-signDisplay.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-trailingZeroDisplay-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-trailingZeroDisplay.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-unit.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-unitDisplay.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/currency-code-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/currency-code-well-formed.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/currency-digits.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/currencyDisplay-unit.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/default-minimum-singificant-digits.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/default-options-object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/dft-currency-mnfd-range-check-mxfd.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/fraction-digit-options-read-once.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/ignore-invalid-unicode-ext-values.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/instance-proto-and-extensible.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/legacy-regexp-statics-not-modified.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/length.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/name.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/numbering-system-options.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/constructor/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/constructor/value.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/bound-to-numberformat-instance.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/default-value.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/engineering-scientific-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/engineering-scientific-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/engineering-scientific-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/engineering-scientific-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/engineering-scientific-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-fraction-digits-precision.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-fraction-digits.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-function-builtin.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-function-length.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-function-name.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-negative-numbers.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-non-finite-numbers.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-1.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-10.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-100.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-1000.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-2.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-20.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-200.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-2000.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-25.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-250.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-2500.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-5.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-50.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-500.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-increment-5000.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-priority-auto.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-priority-less-precision.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-priority-more-precision.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-significant-digits-precision.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-significant-digits.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/length.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/name.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/notation-compact-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/notation-compact-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/notation-compact-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/notation-compact-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/notation-compact-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/numbering-systems.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/percent-formatter.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-currency-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-currency-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-currency-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-currency-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-rounding.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/this-value-not-numberformat.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/unit-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/unit-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/unit-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/unit-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/unit-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/units-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/units.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/useGrouping-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/useGrouping-en-IN.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/useGrouping-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/useGrouping-extended-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/useGrouping-extended-en-IN.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/useGrouping-extended-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/value-arg-coerced-to-number.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/value-decimal-string.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/value-tonumber.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRange/argument-to-Intlmathematicalvalue-throws.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRange/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRange/en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRange/invoked-as-func.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRange/length.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRange/name.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRange/nan-arguments-throws.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRange/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRange/pt-PT.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRange/undefined-arguments-throws.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRange/x-greater-than-y-throws.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRangeToParts/argument-to-Intlmathematicalvalue-throws.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRangeToParts/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRangeToParts/en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRangeToParts/invoked-as-func.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRangeToParts/length.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRangeToParts/name.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRangeToParts/nan-arguments-throws.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRangeToParts/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRangeToParts/undefined-arguments-throws.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatRangeToParts/x-greater-than-y-throws.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/default-parameter.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/engineering-scientific-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/engineering-scientific-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/engineering-scientific-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/engineering-scientific-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/engineering-scientific-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/length.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/main.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/name.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/notation-compact-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/notation-compact-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/notation-compact-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/notation-compact-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/notation-compact-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/percent-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-currency-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-currency-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-currency-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-currency-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-currency-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/this-value-not-numberformat.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/unit-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/unit-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/unit-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/unit-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/unit-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/unit.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/value-tonumber.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/resolvedOptions/basic.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/resolvedOptions/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/resolvedOptions/compactDisplay.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/resolvedOptions/length.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/resolvedOptions/name.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/resolvedOptions/order.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/resolvedOptions/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/resolvedOptions/this-value-not-numberformat.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/this-value-numberformat-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/toStringTag/configurable.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/toStringTag/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/significant-digits-options-get-sequence.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/style-unit.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/subclassing.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/supportedLocalesOf/basic.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/supportedLocalesOf/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/supportedLocalesOf/length.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/supportedLocalesOf/name.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/supportedLocalesOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/supportedLocalesOf/taint-Object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/taint-Object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/test-option-currency.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/test-option-currencyDisplay.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/test-option-localeMatcher.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/test-option-roundingPriority.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/test-option-style.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/test-option-useGrouping.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/test-option-useGrouping-extended.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/this-value-ignored.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/throws-for-currency-style-without-currency-option.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/can-be-subclassed.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/constructor-options-throwing-getters.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/default-options-object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/internals.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/length.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/name.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/bind.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/builtins.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/constructor/main.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/constructor/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/properties.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/prototype.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/resolvedOptions/builtins.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/resolvedOptions/length.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/resolvedOptions/name.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/resolvedOptions/order.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/resolvedOptions/pluralCategories.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/resolvedOptions/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/resolvedOptions/properties.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/select/length.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/select/name.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/select/non-finite.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/select/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/select/tainting.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/selectRange/argument-tonumber-throws.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/selectRange/default-en-us.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/selectRange/invoked-as-func.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/selectRange/length.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/selectRange/name.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/selectRange/nan-arguments-throws.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/selectRange/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/selectRange/undefined-arguments-throws.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/selectRange/x-greater-than-y-throws.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/toStringTag/toString-changed-tag.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/toStringTag/toString-removed-tag.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/toStringTag/toString.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/prototype/toStringTag/toStringTag.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/supportedLocalesOf/arguments.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/supportedLocalesOf/length.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/supportedLocalesOf/main.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/supportedLocalesOf/name.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/supportedLocalesOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/supportedLocalesOf/supportedLocalesOf.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/undefined-newtarget-throws.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/locales-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/locales-valid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/newtarget-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-localeMatcher-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-numberingSystem-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-numberingSystem-valid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-numeric-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-numeric-valid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-order.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-proto.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-style-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-style-valid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-throwing-getters.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-toobject-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-toobject.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/subclassing.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/length.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/name.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/prototype.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/supportedLocalesOf/basic.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/supportedLocalesOf/branding.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/supportedLocalesOf/length.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/supportedLocalesOf/locales-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/supportedLocalesOf/name.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-localeMatcher-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-null.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-toobject.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/supportedLocalesOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/supportedLocalesOf/result-type.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/instance/extensibility.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/instance/prototype.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/constructor/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/branding.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/en-us-numeric-always.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/en-us-numeric-auto.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/en-us-style-short.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/length.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/name.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/pl-pl-style-long.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/pl-pl-style-narrow.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/pl-pl-style-short.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/unit-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/unit-plural.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/value-non-finite.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/value-symbol.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/format/value-tonumber.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/branding.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/en-us-numeric-always.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/en-us-numeric-auto.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/en-us-style-short.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/length.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/name.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/pl-pl-style-long.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/pl-pl-style-narrow.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/pl-pl-style-short.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/result-type.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/unit-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/unit-plural.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/value-non-finite.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/value-symbol.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/formatToParts/value-tonumber.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/resolvedOptions/branding.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/resolvedOptions/caching.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/resolvedOptions/length.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/resolvedOptions/name.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/resolvedOptions/order.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/resolvedOptions/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/resolvedOptions/type.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/toStringTag/toString.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/prototype/toStringTag/toStringTag.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/locales-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/locales-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/newtarget-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-granularity-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-granularity-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-localeMatcher-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-order.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-throwing-getters.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-toobject-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-toobject.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-valid-combinations.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/subclassing.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/length.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/name.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/prototype.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/basic.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/length.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/locales-empty.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/locales-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/locales-specific.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/name.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/options-localeMatcher-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/options-null.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/options-toobject.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/supportedLocalesOf/result-type.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/instance/extensibility.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/instance/prototype.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/constructor/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/resolvedOptions/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/resolvedOptions/caching.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/resolvedOptions/length.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/resolvedOptions/name.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/resolvedOptions/order.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/resolvedOptions/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/resolvedOptions/type-without-lbs.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/length.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/name.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/segment-grapheme-iterable.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/segment-grapheme.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/segment-sentence-iterable.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/segment-sentence.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/segment-tostring.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/segment-word-iterable.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/segment-word.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/toStringTag/toString.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/toStringTag/toStringTag.js\"><reason></reason></test>\n  <test id=\"intl402/String/prototype/localeCompare/default-options-object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/String/prototype/localeCompare/returns-same-results-as-Collator.js\"><reason></reason></test>\n  <test id=\"intl402/String/prototype/localeCompare/taint-Intl-Collator.js\"><reason></reason></test>\n  <test id=\"intl402/String/prototype/localeCompare/throws-same-exceptions-as-Collator.js\"><reason></reason></test>\n  <test id=\"intl402/String/prototype/toLocaleLowerCase/special_casing_Azeri.js\"><reason></reason></test>\n  <test id=\"intl402/String/prototype/toLocaleLowerCase/special_casing_Lithuanian.js\"><reason></reason></test>\n  <test id=\"intl402/String/prototype/toLocaleLowerCase/special_casing_Turkish.js\"><reason></reason></test>\n  <test id=\"intl402/String/prototype/toLocaleUpperCase/special_casing_Azeri.js\"><reason></reason></test>\n  <test id=\"intl402/String/prototype/toLocaleUpperCase/special_casing_Lithuanian.js\"><reason></reason></test>\n  <test id=\"intl402/String/prototype/toLocaleUpperCase/special_casing_Turkish.js\"><reason></reason></test>\n  <test id=\"intl402/constructors-string-and-single-element-array.js\"><reason></reason></test>\n  <test id=\"intl402/constructors-taint-Object-prototype-2.js\"><reason></reason></test>\n  <test id=\"intl402/constructors-taint-Object-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/default-locale-is-canonicalized.js\"><reason></reason></test>\n  <test id=\"intl402/default-locale-is-supported.js\"><reason></reason></test>\n  <test id=\"intl402/fallback-locales-are-supported.js\"><reason></reason></test>\n  <test id=\"intl402/language-tags-canonicalized.js\"><reason></reason></test>\n  <test id=\"intl402/language-tags-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/language-tags-valid.js\"><reason></reason></test>\n  <test id=\"intl402/language-tags-with-underscore.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-consistent-with-resolvedOptions.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-default-locale-and-zxx-locale.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-duplicate-elements-removed.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-empty-and-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-locales-arg-coered-to-object.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-locales-arg-empty-array.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-returned-array-elements-are-not-frozen.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-taint-Array-2.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-taint-Array.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-test-option-localeMatcher.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-throws-if-element-not-string-or-object.js\"><reason></reason></test>\n  <test id=\"intl402/supportedLocalesOf-unicode-extensions-ignored.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/prototype/compare/compare-function-property-order.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-no-instanceof.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-style-conflict.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-timeZoneName-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/constructor-options-timeZoneName-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/intl-legacy-constructed-symbol-on-unwrap.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/intl-legacy-constructed-symbol.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/format-function-property-order.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/no-instanceof.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/temporal-objects-resolved-time-zone.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/format/temporal-objects-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/date-same-returns-single-date.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/temporal-objects-resolved-time-zone.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRange/temporal-objects-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/date-same-returns-single-date.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-resolved-time-zone.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatRangeToParts/temporal-objects-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-resolved-time-zone.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/prototype/resolvedOptions/no-instanceof.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-getoptionsobject.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-languagedisplay-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-languagedisplay-invalid-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-languagedisplay-toString-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/options-languagedisplay-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/of/type-calendar-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/of/type-calendar-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/of/type-datetimefield-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/of/type-datetimefield-valid.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/prototype/resolvedOptions/option-languagedisplay.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/calendars-accepted-by-DateTimeFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/calendars-accepted-by-DisplayNames.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/calendars.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/coerced-to-string.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/collations-accepted-by-Collator.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/collations.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/currencies-accepted-by-DisplayNames.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/currencies-accepted-by-NumberFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/currencies.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/invalid-key.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/length.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/name.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-DateTimeFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-NumberFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/numberingSystems-accepted-by-RelativeTimeFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/numberingSystems-with-simple-digit-mappings.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/numberingSystems.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/timeZones-accepted-by-DateTimeFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/timeZones.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/units-accepted-by-NumberFormat.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/supportedValuesOf/units.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/toStringTag/toString.js\"><reason></reason></test>\n  <test id=\"intl402/Intl/toStringTag/toStringTag.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/options-getoptionsobject.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/calendars/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/calendars/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/calendars/output-array.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/calendars/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/collations/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/collations/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/collations/output-array-values.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/collations/output-array.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/collations/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/hourCycles/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/hourCycles/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/hourCycles/output-array-values.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/hourCycles/output-array.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/hourCycles/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/numberingSystems/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/numberingSystems/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/numberingSystems/output-array.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/numberingSystems/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/textInfo/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/textInfo/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/textInfo/output-object-keys.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/textInfo/output-object.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/textInfo/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/timeZones/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/timeZones/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/timeZones/output-array-sorted.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/timeZones/output-array.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/timeZones/output-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/timeZones/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/weekInfo/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/weekInfo/name.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/weekInfo/output-object-keys.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/weekInfo/output-object.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/prototype/weekInfo/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/reject-duplicate-variants-in-tlang.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/reject-duplicate-variants.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-no-instanceof.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-options-roundingMode-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-options-throwing-getters-rounding-mode.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/constructor-signDisplay-negative.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/intl-legacy-constructed-symbol-on-unwrap.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/intl-legacy-constructed-symbol.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-function-property-order.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-mode-ceil.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-mode-expand.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-mode-floor.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-mode-half-ceil.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-mode-half-even.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-mode-half-expand.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-mode-half-floor.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-mode-half-trunc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/format-rounding-mode-trunc.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/no-instanceof.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-negative-currency-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-negative-currency-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-negative-currency-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-negative-currency-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-negative-currency-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-negative-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-negative-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-negative-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-negative-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/format/signDisplay-negative-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-currency-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-currency-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-currency-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-currency-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-currency-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-de-DE.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-en-US.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-ja-JP.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-ko-KR.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-zh-TW.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/resolvedOptions/no-instanceof.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/prototype/resolvedOptions/roundingMode.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-getoptionsobject.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-granularity-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-granularity-toString-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-localeMatcher-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-localeMatcher-toString-abrupt-throws.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-localeMatcher-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/options-null.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/ctor-custom-get-prototype-poison-throws.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/ctor-custom-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/ctor-default-prototype.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/Symbol.toStringTag.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/breakable-input.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/index-throws.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/iswordlike.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/length.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/name.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/one-index.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/out-of-bound-index.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/unbreakable-input.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/word-iswordlike.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/containing/zero-index.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/nested-next.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/next-inside-next.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/prototype/segment/next-mix-with-containing.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/from/basic.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/dateAdd/date-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/dateFromFields/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/dateUntil/argument-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/day/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/dayOfWeek/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/dayOfYear/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/daysInMonth/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/daysInWeek/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/daysInYear/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/era/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/era/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/era/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/era/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/era/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/era/length.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/era/name.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/era/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/era/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/eraYear/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/eraYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/eraYear/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/eraYear/builtin.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/eraYear/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/eraYear/length.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/eraYear/name.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/eraYear/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/eraYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/inLeapYear/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/month/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/monthCode/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/monthDayFromFields/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/monthsInYear/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/weekOfYear/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/year/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Calendar/prototype/yearMonthFromFields/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Duration/prototype/add/relativeto-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Duration/prototype/round/relativeto-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Duration/prototype/subtract/relativeto-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Duration/prototype/total/relativeto-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Instant/prototype/toLocaleString/locales-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Instant/prototype/toLocaleString/options-conflict.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Instant/prototype/toLocaleString/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Now/zonedDateTime/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/compare/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/from/basic.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/from/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/equals/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/era/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/era/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/eraYear/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/eraYear/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/eraYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/since/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/toLocaleString/locales-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/toLocaleString/options-conflict.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/toLocaleString/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/toLocaleString/resolved-time-zone.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/toLocaleString/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDate/prototype/until/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/compare/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/from/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/equals/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/era/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/era/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/eraYear/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/eraYear/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/eraYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/since/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/toLocaleString/locales-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/toLocaleString/options-conflict.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/toLocaleString/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/toLocaleString/resolved-time-zone.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/toLocaleString/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/until/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainDateTime/prototype/withPlainDate/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainMonthDay/from/basic.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainMonthDay/prototype/equals/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainMonthDay/prototype/toLocaleString/locales-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainMonthDay/prototype/toLocaleString/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainMonthDay/prototype/toLocaleString/resolved-time-zone.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainMonthDay/prototype/toLocaleString/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainMonthDay/prototype/toPlainDate/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainTime/prototype/toLocaleString/locales-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainTime/prototype/toLocaleString/options-conflict.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainTime/prototype/toLocaleString/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainTime/prototype/toLocaleString/resolved-time-zone.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainTime/prototype/toLocaleString/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainTime/prototype/toPlainDateTime/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainTime/prototype/toZonedDateTime/plaindate-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/compare/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/from/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/equals/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/era/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/era/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/eraYear/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/eraYear/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/eraYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/since/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/toLocaleString/locales-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/toLocaleString/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/toLocaleString/resolved-time-zone.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/toLocaleString/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/PlainYearMonth/prototype/until/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/TimeZone/basic.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/TimeZone/from/argument-invalid.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/TimeZone/from/argument-object.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/TimeZone/from/argument-valid.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/TimeZone/prototype/getInstantFor/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/instant-string.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/TimeZone/prototype/getOffsetStringFor/instant-string.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/TimeZone/prototype/getPlainDateTimeFor/instant-string.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/TimeZone/prototype/getPossibleInstantsFor/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/compare/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/from/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/equals/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/era/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/era/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/era/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/era/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/era/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/era/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/eraYear/branding.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/eraYear/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/eraYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/eraYear/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/eraYear/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/eraYear/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/eraYear/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/since/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/toLocaleString/locales-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/toLocaleString/options-conflict.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/toLocaleString/options-undefined.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/until/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"intl402/Temporal/ZonedDateTime/prototype/withPlainDate/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <!-- END ECMAScript Internationalization API -->\n\n  <!-- ESNext stage 3 proposals: class fields, private methods and static class features\n       features: [class-fields-public, class-fields-private, class-static-fields-public, class-static-fields-private, class-static-methods-private, class-methods-private]\n       https://github.com/tc39/proposal-class-fields\n       https://github.com/tc39/proposal-private-methods\n       http://github.com/tc39/proposal-static-class-features\n  -->\n  <test id=\"built-ins/Function/prototype/toString/private-method-class-expression.js\"><reason></reason></test>\n  <test id=\"built-ins/Function/prototype/toString/private-method-class-statement.js\"><reason></reason></test>\n  <test id=\"built-ins/Function/prototype/toString/private-static-method-class-expression.js\"><reason></reason></test>\n  <test id=\"built-ins/Function/prototype/toString/private-static-method-class-statement.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/class-name-static-initializer-anonymous.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/class-name-static-initializer-default-export.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method/yield-promise-reject-next.js\"><reason></reason></test>\n  <!-- END - ESNext stage 3 proposals: class fields, private methods and static class features -->\n\n  <!-- ESNext stage 3 proposal: top level await\n       features: [top-level-await]\n       https://github.com/tc39/proposal-top-level-await\n  -->\n  <test id=\"language/module-code/top-level-await/await-awaits-thenable-not-callable.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-awaits-thenables-that-throw.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-awaits-thenables.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-dynamic-import-rejection.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-dynamic-import-resolution.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-expr-new-expr-reject.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-expr-reject-throws.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-expr-resolution.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-void-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/dynamic-import-rejection.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/dynamic-import-resolution.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/if-await-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/module-async-import-async-resolution-ticks.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/module-import-rejection-body.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/module-import-rejection-tick.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/module-import-rejection.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/module-import-resolution.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/module-import-unwrapped.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/module-self-import-async-resolution-ticks.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/module-sync-import-async-resolution-ticks.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/await-expr-dyn-import.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/block-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/catch-parameter.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/export-var-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-in-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-of-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-block-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/if-expr-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/top-level-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/try-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/typeof-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/void-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/while-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/top-level-ticks-2.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/top-level-ticks.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/void-await-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/while-dynamic-evaluation.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/dfs-invariant.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/new-await-parens.js\"><reason></reason></test>\n  <!-- END - ESNext stage 3 proposal: top level await -->\n\n  <!-- ESNext stage 3 proposal: RegExp match indices\n       features: [regexp-match-indices]\n       https://github.com/tc39/proposal-top-level-await\n  -->\n  <test id=\"annexB/built-ins/RegExp/match-indices/indices-groups-object.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-array-element.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-array-matched.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-array-non-unicode-match.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-array-properties.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-array-unicode-match.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-array-unicode-property-names.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-array-unmatched.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-array.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-groups-object-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-groups-object-unmatched.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-groups-object.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-groups-properties.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-property.js\"><reason></reason></test>\n  <!-- END - ESNext stage 3 proposal: RegExp match indices -->\n\n  <!-- ESNext stage 3 proposal: Atomics.waitAsync\n       features: [Atomics.waitAsync] (also needs ES2017 feature: [Atomics])\n       https://github.com/tc39/proposal-atomics-wait-async\n  -->\n  <test id=\"built-ins/Atomics/waitAsync/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/false-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/good-views.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/nan-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/negative-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/negative-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/non-bigint64-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/non-shared-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/not-a-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/not-an-object-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/null-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/null-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/null-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/object-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/object-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/out-of-range-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/true-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/true-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/undefined-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/undefined-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/undefined-index-defaults-to-zero-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/value-not-equal-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/was-woken-before-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/descriptor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/false-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/good-views.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/is-function.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/nan-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/negative-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/negative-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/non-int32-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/non-shared-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/not-a-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/not-an-object-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/null-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/null-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/null-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/object-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/object-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/out-of-range-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-ok.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-timed-out.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/returns-result-object-value-is-string-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/returns-result-object-value-is-string-timed-out.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-index-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-value-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-value-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/true-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/true-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/undefined-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/undefined-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/undefined-index-defaults-to-zero-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/validate-arraytype-before-index-coercion.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/validate-arraytype-before-timeout-coercion.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/validate-arraytype-before-value-coercion.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/value-not-equal-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/was-woken-before-timeout.js\"><reason></reason></test>\n  <!-- END - ESNext stage 3 proposal: Atomics.waitAsync -->\n\n  <!-- ESNext stage 3 proposal: Hashbang Grammar\n       features: [hashbang]\n       https://github.com/tc39/proposal-hashbang\n  -->\n  <test id=\"language/comments/hashbang/eval-indirect.js\"><reason></reason></test>\n  <test id=\"language/comments/hashbang/eval.js\"><reason></reason></test>\n  <test id=\"language/comments/hashbang/line-terminator-carriage-return.js\"><reason></reason></test>\n  <test id=\"language/comments/hashbang/line-terminator-line-separator.js\"><reason></reason></test>\n  <test id=\"language/comments/hashbang/line-terminator-paragraph-separator.js\"><reason></reason></test>\n  <test id=\"language/comments/hashbang/module.js\"><reason></reason></test>\n  <test id=\"language/comments/hashbang/no-line-separator.js\"><reason></reason></test>\n  <test id=\"language/comments/hashbang/not-empty.js\"><reason></reason></test>\n  <test id=\"language/comments/hashbang/use-strict.js\"><reason></reason></test>\n  <!-- END - ESNext stage 3 proposal: Hashbang Grammar -->\n\n  <!-- ESNext stage 4 proposal: String.prototype.replaceAll\n       features: [String.prototype.replaceAll]\n       https://github.com/tc39/proposal-string-replaceall\n  -->\n  <test id=\"annexB/built-ins/String/prototype/replaceAll/custom-replacer-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/String/prototype/replaceAll/searchValue-replacer-RegExp-call.js\"><reason></reason></test>\n  <!-- END - ESNext stage 4 proposal: String.prototype.replaceAll -->\n\n  <!-- ESNext stage 4 proposal: WeakRefs\n       features: [WeakRef, FinalizationRegistry]\n       https://github.com/tc39/proposal-weakrefs\n  -->\n  <test id=\"built-ins/FinalizationRegistry/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/gc-has-one-chance-to-call-cleanupCallback.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/instance-extensible.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/length.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/name.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/newtarget-prototype-is-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/proto.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype-from-newtarget-abrupt.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype-from-newtarget-custom.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype-from-newtarget.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/Symbol.toStringTag.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/callback-not-callable-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/cleanup-prevented-with-reference.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/cleanup-prevented-with-unregister.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/custom-this.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/holdings-multiple-values.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/length.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/name.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/reentrancy.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/return-undefined-with-gc.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/return-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/this-does-not-have-internal-cells-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/this-not-object-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/proto.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/custom-this.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/holdings-any-value-type.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/holdings-same-as-target.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/length.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/name.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/return-undefined-register-itself.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/return-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/target-not-object-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/this-does-not-have-internal-target-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/this-not-object-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/unregisterToken-not-object-or-undefined-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/unregisterToken-same-as-holdings-and-target.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/unregisterToken-same-as-holdings.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/register/unregisterToken-same-as-target.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/unregister/custom-this.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/unregister/length.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/unregister/name.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/unregister/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/unregister/this-does-not-have-internal-cells-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/unregister/this-not-object-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/unregister/unregister-cleaned-up-cell.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/unregister/unregister.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/unregister/unregisterToken-not-object-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/returns-new-object-from-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/target-not-callable-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/undefined-newtarget-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/unnaffected-by-poisoned-cleanupCallback.js\"><reason></reason></test>\n  <test id=\"built-ins/WeakRef/prototype/deref/gc-cleanup-not-prevented-with-wr-deref.js\"><reason></reason></test>\n  <test id=\"built-ins/WeakRef/prototype/deref/this-does-not-have-internal-target-throws.js\"><reason></reason></test>\n  <!-- END - ESNext stage 4 proposal: WeakRefs -->\n\n  <!-- ES2015: Proper Tail Call (PTC) Optimization\n       features: [tail-call-optimization]\n  -->\n  <test id=\"language/expressions/call/tco-call-args.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-cross-realm-class-construct.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-cross-realm-class-derived-construct.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-cross-realm-fun-call.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-cross-realm-fun-construct.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-member-args.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-non-eval-function-dynamic.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-non-eval-function.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-non-eval-global.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-non-eval-with.js\"><reason></reason></test>\n  <test id=\"language/expressions/coalesce/tco-pos-null.js\"><reason></reason></test>\n  <test id=\"language/expressions/coalesce/tco-pos-undefined.js\"><reason></reason></test>\n  <test id=\"language/expressions/comma/tco-final.js\"><reason></reason></test>\n  <test id=\"language/expressions/conditional/tco-cond.js\"><reason></reason></test>\n  <test id=\"language/expressions/conditional/tco-pos.js\"><reason></reason></test>\n  <test id=\"language/expressions/logical-and/tco-right.js\"><reason></reason></test>\n  <test id=\"language/expressions/logical-or/tco-right.js\"><reason></reason></test>\n  <test id=\"language/expressions/tagged-template/tco-call.js\"><reason></reason></test>\n  <test id=\"language/expressions/tagged-template/tco-member.js\"><reason></reason></test>\n  <test id=\"language/expressions/tco-pos.js\"><reason></reason></test>\n  <test id=\"language/statements/block/tco-stmt-list.js\"><reason></reason></test>\n  <test id=\"language/statements/block/tco-stmt.js\"><reason></reason></test>\n  <test id=\"language/statements/do-while/tco-body.js\"><reason></reason></test>\n  <test id=\"language/statements/for/tco-const-body.js\"><reason></reason></test>\n  <test id=\"language/statements/for/tco-let-body.js\"><reason></reason></test>\n  <test id=\"language/statements/for/tco-lhs-body.js\"><reason></reason></test>\n  <test id=\"language/statements/for/tco-var-body.js\"><reason></reason></test>\n  <test id=\"language/statements/if/tco-else-body.js\"><reason></reason></test>\n  <test id=\"language/statements/if/tco-if-body.js\"><reason></reason></test>\n  <test id=\"language/statements/labeled/tco.js\"><reason></reason></test>\n  <test id=\"language/statements/return/tco.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/tco-case-body-dflt.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/tco-case-body.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/tco-dftl-body.js\"><reason></reason></test>\n  <test id=\"language/statements/try/tco-catch-finally.js\"><reason></reason></test>\n  <test id=\"language/statements/try/tco-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/try/tco-finally.js\"><reason></reason></test>\n  <test id=\"language/statements/while/tco-body.js\"><reason></reason></test>\n  <!-- END - ES2015: Proper Tail Call (PTC) Optimization -->\n\n  <!-- ES2017: Shared Memory and Atomics\n       features: [Atomics]\n       https://github.com/tc39/ecmascript_sharedmem\n  -->\n  <test id=\"built-ins/Atomics/isLockFree/expected-return-value.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/bigint/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/bigint/non-bigint64-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/bigint/non-shared-bufferdata-count-evaluation-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/bigint/non-shared-bufferdata-index-evaluation-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/bigint/non-shared-bufferdata-non-shared-int-views-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/bigint/notify-all-on-loc.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/bigint/null-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/count-defaults-to-infinity-missing.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/count-defaults-to-infinity-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/count-symbol-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/count-tointeger-throws-then-wake-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/negative-count.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/negative-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/non-int32-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/non-shared-bufferdata-count-evaluation-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/non-shared-bufferdata-index-evaluation-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/non-shared-bufferdata-non-shared-int-views-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/non-shared-int-views.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/non-views.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/not-a-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/not-an-object-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-all-on-loc.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-all.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-in-order-one-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-in-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-one.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-renotify-noop.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-two.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-with-no-agents-waiting.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-with-no-matching-agents-waiting.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/null-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/out-of-range-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/symbol-for-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/undefined-index-defaults-to-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/validate-arraytype-before-count-coercion.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/validate-arraytype-before-index-coercion.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/cannot-suspend-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/false-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/nan-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/negative-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/negative-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/non-bigint64-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/non-shared-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/null-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/out-of-range-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/waiterlist-order-of-operations-is-fifo.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/was-woken-before-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/cannot-suspend-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/false-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/good-views.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/nan-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/negative-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/negative-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/non-int32-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/non-shared-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/not-a-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/not-an-object-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/null-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/null-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/null-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/object-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/object-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/out-of-range-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/poisoned-object-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/poisoned-object-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-index-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-value-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-value-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/true-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/true-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/undefined-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/undefined-index-defaults-to-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/validate-arraytype-before-index-coercion.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/validate-arraytype-before-timeout-coercion.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/validate-arraytype-before-value-coercion.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/wait-index-value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/waiterlist-order-of-operations-is-fifo.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/was-woken-before-timeout.js\"><reason></reason></test>\n\n  <!-- ES2017: Shared Memory and Atomics\n       features: [SharedArrayBuffer]\n       https://github.com/tc39/ecmascript_sharedmem\n  -->\n  <test id=\"built-ins/Atomics/notify/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/bigint/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/bigint/notify-all-on-loc.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/count-defaults-to-infinity-missing.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/count-defaults-to-infinity-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/count-symbol-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/count-tointeger-throws-then-wake-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/negative-count.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/negative-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/non-shared-int-views.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/non-views.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-all-on-loc.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-all.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-in-order-one-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-in-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-one.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-renotify-noop.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-two.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-with-no-agents-waiting.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-with-no-matching-agents-waiting.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/out-of-range-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/symbol-for-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/undefined-index-defaults-to-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/cannot-suspend-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/false-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/nan-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/negative-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/negative-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/non-bigint64-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/out-of-range-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/waiterlist-order-of-operations-is-fifo.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/was-woken-before-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/cannot-suspend-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/false-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/nan-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/negative-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/negative-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/null-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/null-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/object-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/object-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/out-of-range-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/poisoned-object-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/poisoned-object-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-index-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-value-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-value-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/true-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/true-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/undefined-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/undefined-index-defaults-to-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/wait-index-value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/waiterlist-order-of-operations-is-fifo.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/was-woken-before-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/bad-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/false-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/nan-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/negative-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/negative-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/non-bigint64-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/null-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/null-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/object-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/object-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/out-of-range-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/true-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/true-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/undefined-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/undefined-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/undefined-index-defaults-to-zero-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/value-not-equal-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/was-woken-before-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/false-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/implicit-infinity-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/nan-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/negative-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/negative-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/non-int32-typedarray-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/null-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/null-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/object-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/object-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/out-of-range-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-ok.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-timed-out.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/returns-result-object-value-is-string-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/returns-result-object-value-is-string-timed-out.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-index-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-index-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-timeout-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-value-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-value-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/true-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/true-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/undefined-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/undefined-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/undefined-index-defaults-to-zero-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/validate-arraytype-before-index-coercion.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/validate-arraytype-before-timeout-coercion.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/validate-arraytype-before-value-coercion.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/value-not-equal-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/was-woken-before-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/typedarray-backed-by-sharedarraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/ctors/buffer-arg/typedarray-backed-by-sharedarraybuffer.js\"><reason></reason></test>\n  <!-- END - ES2017: Shared Memory and Atomics -->\n\n  <!-- ES2018: RegExp Lookbehind Assertions\n       features: [regexp-lookbehind]\n       https://github.com/tc39/proposal-regexp-lookbehind\n  -->\n  <test id=\"built-ins/RegExp/lookBehind/alternations.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/back-references-to-captures.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/back-references.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/captures-negative.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/captures.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/do-not-backtrack.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/greedy-loop.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/misc.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/mutual-recursive.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/negative.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/nested-lookaround.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/simple-fixed-length.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/sliced-strings.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/start-of-line.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/sticky.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/variable-length.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/lookBehind/word-boundary.js\"><reason></reason></test>\n  <!-- END - ES2018: RegExp Lookbehind Assertions -->\n\n  <!-- ES2018: RegExp named capture groups\n       features: [regexp-named-groups]\n       https://github.com/tc39/proposal-regexp-named-groups\n  -->\n  <test id=\"annexB/built-ins/RegExp/match-indices/indices-groups-object.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/named-groups/groups-object.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/named-groups/non-unicode-malformed-lookbehind.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/RegExp/named-groups/non-unicode-malformed.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-groups-object-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-groups-object-unmatched.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-groups-object.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/match-indices/indices-groups-properties.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/functional-replace-global.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/functional-replace-non-global.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/groups-object-subclass-sans.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/groups-object-subclass.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/groups-object-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/groups-object-unmatched.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/groups-object.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/groups-properties.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/lookbehind.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/non-unicode-match.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/non-unicode-property-names-valid.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/non-unicode-property-names.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/non-unicode-references.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/string-replace-escaped.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/string-replace-get.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/string-replace-missing.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/string-replace-numbered.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/string-replace-unclosed.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/string-replace-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/unicode-match.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/unicode-property-names-valid.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/unicode-property-names.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/named-groups/unicode-references.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/Symbol.replace/named-groups-fn.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/Symbol.replace/named-groups.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/Symbol.replace/poisoned-stdlib.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/Symbol.replace/result-coerce-groups-err.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/Symbol.replace/result-coerce-groups-prop-err.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/Symbol.replace/result-coerce-groups-prop.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/Symbol.replace/result-coerce-groups.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/Symbol.replace/result-get-groups-err.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/Symbol.replace/result-get-groups-prop-err.js\"><reason></reason></test>\n  <test id=\"language/literals/regexp/named-groups/forward-reference.js\"><reason></reason></test>\n  <!-- END - ES2018: RegExp named capture groups -->\n\n  <!-- ES2018 - RegExp Unicode Property Escapes\n       features: [regexp-unicode-property-escapes]\n       https://github.com/tc39/proposal-regexp-unicode-property-escapes\n  -->\n  <test id=\"built-ins/RegExp/property-escapes/character-class.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/ASCII.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/ASCII_Hex_Digit.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Alphabetic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Any.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Assigned.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Bidi_Control.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Bidi_Mirrored.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Case_Ignorable.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Cased.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Changes_When_Casefolded.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Changes_When_Casemapped.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Changes_When_Lowercased.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Changes_When_NFKC_Casefolded.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Changes_When_Titlecased.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Changes_When_Uppercased.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Dash.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Default_Ignorable_Code_Point.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Deprecated.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Diacritic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Emoji.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Emoji_Component.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Emoji_Modifier.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Emoji_Modifier_Base.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Emoji_Presentation.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Extended_Pictographic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Extender.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Cased_Letter.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Close_Punctuation.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Connector_Punctuation.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Control.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Currency_Symbol.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Dash_Punctuation.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Decimal_Number.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Enclosing_Mark.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Final_Punctuation.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Format.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Initial_Punctuation.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Letter.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Letter_Number.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Line_Separator.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Lowercase_Letter.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Mark.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Math_Symbol.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Modifier_Letter.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Modifier_Symbol.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Nonspacing_Mark.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Number.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Open_Punctuation.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Other.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Other_Letter.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Other_Number.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Other_Punctuation.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Other_Symbol.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Paragraph_Separator.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Private_Use.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Punctuation.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Separator.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Space_Separator.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Spacing_Mark.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Surrogate.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Symbol.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Titlecase_Letter.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Unassigned.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/General_Category_-_Uppercase_Letter.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Grapheme_Base.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Grapheme_Extend.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Hex_Digit.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/IDS_Binary_Operator.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/IDS_Trinary_Operator.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/ID_Continue.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/ID_Start.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Ideographic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Join_Control.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Logical_Order_Exception.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Lowercase.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Math.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Noncharacter_Code_Point.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Pattern_Syntax.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Pattern_White_Space.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Quotation_Mark.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Radical.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Regional_Indicator.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Adlam.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Ahom.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Anatolian_Hieroglyphs.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Arabic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Armenian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Avestan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Balinese.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Bamum.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Bassa_Vah.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Batak.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Bengali.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Bhaiksuki.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Bopomofo.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Brahmi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Braille.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Buginese.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Buhid.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Canadian_Aboriginal.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Carian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Caucasian_Albanian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Chakma.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Cham.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Cherokee.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Chorasmian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Common.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Coptic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Cuneiform.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Cypriot.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Cyrillic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Deseret.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Devanagari.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Dives_Akuru.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Dogra.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Duployan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Egyptian_Hieroglyphs.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Elbasan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Elymaic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Ethiopic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Georgian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Glagolitic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Gothic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Grantha.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Greek.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Gujarati.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Gunjala_Gondi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Gurmukhi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Han.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Hangul.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Hanifi_Rohingya.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Hanunoo.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Hatran.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Hebrew.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Hiragana.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Imperial_Aramaic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Inherited.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Inscriptional_Pahlavi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Inscriptional_Parthian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Javanese.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Kaithi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Kannada.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Katakana.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Kayah_Li.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Kharoshthi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Khitan_Small_Script.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Khmer.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Khojki.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Khudawadi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Lao.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Latin.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Lepcha.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Limbu.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Linear_A.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Linear_B.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Lisu.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Lycian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Lydian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Mahajani.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Makasar.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Malayalam.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Mandaic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Manichaean.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Marchen.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Masaram_Gondi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Medefaidrin.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Meetei_Mayek.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Mende_Kikakui.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Meroitic_Cursive.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Meroitic_Hieroglyphs.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Miao.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Modi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Mongolian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Mro.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Multani.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Myanmar.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Nabataean.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Nandinagari.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_New_Tai_Lue.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Newa.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Nko.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Nushu.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Nyiakeng_Puachue_Hmong.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Ogham.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Ol_Chiki.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Old_Hungarian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Old_Italic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Old_North_Arabian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Old_Permic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Old_Persian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Old_Sogdian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Old_South_Arabian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Old_Turkic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Oriya.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Osage.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Osmanya.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Pahawh_Hmong.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Palmyrene.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Pau_Cin_Hau.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Phags_Pa.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Phoenician.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Psalter_Pahlavi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Rejang.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Runic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Samaritan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Saurashtra.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Sharada.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Shavian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Siddham.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_SignWriting.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Sinhala.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Sogdian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Sora_Sompeng.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Soyombo.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Sundanese.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Syloti_Nagri.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Syriac.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Tagalog.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Tagbanwa.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Tai_Le.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Tai_Tham.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Tai_Viet.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Takri.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Tamil.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Tangut.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Telugu.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Thaana.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Thai.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Tibetan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Tifinagh.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Tirhuta.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Ugaritic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Vai.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Wancho.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Warang_Citi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Yezidi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Yi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_-_Zanabazar_Square.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Adlam.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Ahom.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Anatolian_Hieroglyphs.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Arabic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Armenian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Avestan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Balinese.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Bamum.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Bassa_Vah.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Batak.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Bengali.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Bhaiksuki.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Bopomofo.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Brahmi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Braille.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Buginese.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Buhid.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Canadian_Aboriginal.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Carian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Caucasian_Albanian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Chakma.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Cham.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Cherokee.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Chorasmian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Common.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Coptic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Cuneiform.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Cypriot.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Cyrillic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Deseret.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Devanagari.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Dives_Akuru.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Dogra.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Duployan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Egyptian_Hieroglyphs.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Elbasan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Elymaic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Ethiopic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Georgian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Glagolitic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Gothic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Grantha.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Greek.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Gujarati.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Gunjala_Gondi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Gurmukhi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Han.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Hangul.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Hanifi_Rohingya.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Hanunoo.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Hatran.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Hebrew.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Hiragana.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Imperial_Aramaic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Inherited.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Inscriptional_Pahlavi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Inscriptional_Parthian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Javanese.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Kaithi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Kannada.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Katakana.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Kayah_Li.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Kharoshthi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Khitan_Small_Script.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Khmer.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Khojki.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Khudawadi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Lao.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Latin.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Lepcha.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Limbu.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Linear_A.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Linear_B.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Lisu.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Lycian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Lydian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Mahajani.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Makasar.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Malayalam.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Mandaic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Manichaean.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Marchen.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Masaram_Gondi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Medefaidrin.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Meetei_Mayek.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Mende_Kikakui.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Meroitic_Cursive.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Meroitic_Hieroglyphs.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Miao.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Modi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Mongolian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Mro.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Multani.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Myanmar.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Nabataean.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Nandinagari.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_New_Tai_Lue.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Newa.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Nko.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Nushu.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Nyiakeng_Puachue_Hmong.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Ogham.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Ol_Chiki.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Old_Hungarian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Old_Italic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Old_North_Arabian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Old_Permic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Old_Persian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Old_Sogdian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Old_South_Arabian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Old_Turkic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Oriya.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Osage.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Osmanya.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Pahawh_Hmong.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Palmyrene.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Pau_Cin_Hau.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Phags_Pa.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Phoenician.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Psalter_Pahlavi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Rejang.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Runic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Samaritan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Saurashtra.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Sharada.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Shavian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Siddham.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_SignWriting.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Sinhala.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Sogdian.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Sora_Sompeng.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Soyombo.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Sundanese.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Syloti_Nagri.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Syriac.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tagalog.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tagbanwa.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tai_Le.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tai_Tham.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tai_Viet.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Takri.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tamil.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tangut.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Telugu.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Thaana.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Thai.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tibetan.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tifinagh.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Tirhuta.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Ugaritic.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Vai.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Wancho.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Warang_Citi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Yezidi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Yi.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Script_Extensions_-_Zanabazar_Square.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Sentence_Terminal.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Soft_Dotted.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Terminal_Punctuation.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Unified_Ideograph.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Uppercase.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/Variation_Selector.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/White_Space.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/XID_Continue.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/property-escapes/generated/XID_Start.js\"><reason></reason></test>\n  <!-- END - ES2018 - RegExp Unicode Property Escapes -->\n\n  <!-- ES2018: Rest/Spread Properties\n       features: [object-rest, object-spread]\n       https://github.com/tc39/proposal-object-rest-spread\n  -->\n  <!-- END - ES2018: Rest/Spread Properties -->\n\n  <!-- ES2020: Dynamic Import\n       features: [dynamic-import]\n       https://github.com/tc39/proposal-dynamic-import\n  -->\n  <test id=\"language/expressions/dynamic-import/assignment-expression/additive-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/array-literal.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/arrow-function.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/await-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/await-identifier.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/call-expr-arguments.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/call-expr-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/call-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/cover-call-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/cover-parenthesized-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/identifier.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/import-meta.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/lhs-assign-operator-assign-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr-nostrict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/logical-and-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/logical-or-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/member-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/new-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/object-literal.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/tagged-function-call.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/ternary.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/this.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/yield-assign-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/yield-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/assignment-expression/yield-identifier.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/await-import-evaluation.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-await-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-await-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-block-import-catch-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-block-labeled-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-do-while-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-else-import-catch-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-function-import-catch-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-if-import-catch-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-while-import-catch-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/top-level-import-catch-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/custom-primitive.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-export-dflt-cls-anon.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-export-dflt-cls-name-meth.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-export-dflt-cls-named.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-export-dflt-expr-cls-anon.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-export-dflt-expr-cls-name-meth.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-export-dflt-expr-cls-named.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-export-dflt-expr-fn-anon.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-export-dflt-expr-fn-named.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-export-dflt-expr-gen-anon.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-export-dflt-expr-gen-named.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-export-dflt-expr-in.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-rqstd-once.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-self-once-module.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/eval-self-once-script.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/for-await-resolution-and-error-agen.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/for-await-resolution-and-error.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/imported-self-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/indirect-resolution.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-Symbol-toStringTag.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-define-own-property.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-no-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-no-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-extensible.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-direct.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-indirect.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-props-nrml.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-found-init.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-not-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-get-own-property-sym.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-get-str-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-get-str-not-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-get-sym-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-get-sym-not-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-has-property-str-found-init.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-has-property-str-not-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-has-property-sym-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-has-property-sym-not-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-no-iterator.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-own-property-keys-sort.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-object.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-reflect.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-prop-descs.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-prototype.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-set-no-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-set-prototype-of-null.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-set-prototype-of.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-set-same-values-no-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-set-same-values-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/await-ns-set-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/default-property-not-set-own.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-Symbol-toStringTag.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-define-own-property.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-no-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-no-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-extensible.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-direct.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-indirect.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-props-nrml.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-found-init.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-not-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-sym.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-get-str-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-get-str-not-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-not-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-found-init.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-not-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-not-found.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-no-iterator.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-own-property-keys-sort.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-object.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-reflect.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-prop-descs.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-prototype.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-set-no-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of-null.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-no-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/namespace/promise-then-ns-set-strict.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/reuse-namespace-object-from-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/reuse-namespace-object-from-script.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/reuse-namespace-object.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/update-to-dynamic-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage-from-eval.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-import-then-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-import-then-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-arrow-import-then-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-await-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-await-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-await-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-await-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-await-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-await-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-await-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-return-await-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-return-await-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-return-await-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-function-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-block-import-then-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-block-import-then-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-block-import-then-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-block-import-then-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-do-while-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-do-while-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-do-while-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-do-while-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-else-import-then-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-else-import-then-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-else-import-then-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-else-import-then-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-function-import-then-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-function-import-then-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-function-import-then-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-function-import-then-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-braceless-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-braceless-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-braceless-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-braceless-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-import-then-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-import-then-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-import-then-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-if-import-then-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-while-import-then-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-while-import-then-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-while-import-then-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-while-import-then-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/syntax-nested-block-labeled-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/syntax-nested-block-labeled-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/syntax-nested-block-labeled-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/top-level-import-then-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/top-level-import-then-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/top-level-import-then-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/top-level-import-then-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-dynamic-import-rejection.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/await-dynamic-import-resolution.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/dynamic-import-rejection.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/dynamic-import-resolution.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/await-expr-dyn-import.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/catch-parameter.js\"><reason></reason></test>\n  <test id=\"language/module-code/verify-dfs.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-assert-enumeration-abrupt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-assert-enumeration.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-assert-non-object.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-assert-undefined.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-assert-value-abrupt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-assert-value-non-string.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-await-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-await-ident.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-evaluation-abrupt-return.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-evaluation-abrupt-throw.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-evaluation-sequence.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-get-assert-error.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-in.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-non-object.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-trailing-comma-fulfill.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-trailing-comma-reject.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-yield-expr.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/2nd-param-yield-ident-valid.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-arrow-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-arrow-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-function-await-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-function-await-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-function-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-function-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-block-labeled-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-block-labeled-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-block-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-block-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-do-while-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-do-while-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-else-braceless-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-else-braceless-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-else-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-else-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-function-return-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-function-return-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-function-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-function-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-if-braceless-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-if-braceless-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-if-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-if-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-while-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-while-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-with-expression-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-with-expression-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-with-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/nested-with-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/top-level-trailing-comma-first.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/syntax/valid/top-level-trailing-comma-second.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/trailing-comma-fulfill.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/trailing-comma-reject.js\"><reason></reason></test>\n  <!-- END - ES2020: Dynamic Import -->\n\n  <!-- ES2018: Asynchronous Iteration\n       features: [async-iteration]\n       https://github.com/tc39/proposal-async-iteration\n   -->\n  <test id=\"built-ins/AsyncGeneratorFunction/instance-await-expr-in-param.js\"><reason></reason></test>\n  <test id=\"built-ins/AsyncGeneratorFunction/instance-yield-expr-in-param.js\"><reason></reason></test>\n  <test id=\"built-ins/AsyncGeneratorPrototype/next/request-queue-await-order.js\"><reason></reason></test>\n  <test id=\"built-ins/AsyncGeneratorPrototype/next/request-queue-promise-resolve-order.js\"><reason></reason></test>\n  <test id=\"built-ins/AsyncGeneratorPrototype/return/return-state-completed.js\"><reason></reason></test>\n  <test id=\"built-ins/AsyncGeneratorPrototype/return/return-suspendedStart-promise.js\"><reason></reason></test>\n  <test id=\"built-ins/AsyncGeneratorPrototype/return/return-suspendedYield-promise.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/return-undefined-with-gc.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/prototype/cleanupSome/return-undefined.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js\"><reason></reason></test>\n  <test id=\"language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/named-yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/named-yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/named-yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/yield-star-getiter-async-return-method-is-null.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/yield-star-getiter-async-throw-method-is-null.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/yield-thenable-create-resolving-functions-reject.js\"><reason></reason></test>\n  <test id=\"language/expressions/async-generator/yield-thenable-create-resolving-functions-resolve.js\"><reason></reason></test>\n  <test id=\"language/expressions/await/for-await-of-interleaved.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/async-gen-method-static/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/async-gen-method-static/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/async-gen-method-static/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/async-gen-method/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/async-gen-method/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-await-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-typeerror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-urierror.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-script-code-target.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-ambiguous-import.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-circular.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/for-await-resolution-and-error-agen.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-await-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update-dflt.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-script-code-host-resolves-module-code.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-is-call-expression-square-brackets.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-returns-thenable.js\"><reason></reason></test>\n  <test id=\"language/expressions/dynamic-import/usage/nested-async-gen-return-await-specifier-tostring.js\"><reason></reason></test>\n  <test id=\"language/expressions/object/method-definition/async-gen-yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/expressions/object/method-definition/async-gen-yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/expressions/object/method-definition/async-gen-yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-nested.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-null.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js\"><reason></reason></test>\n  <test id=\"language/module-code/top-level-await/syntax/for-await-await-expr-this.js\"><reason></reason></test>\n  <test id=\"language/statements/async-generator/return-undefined-implicit-and-explicit.js\"><reason></reason></test>\n  <test id=\"language/statements/async-generator/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/async-generator/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/statements/async-generator/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/statements/async-generator/yield-return-then-getter-ticks.js\"><reason></reason></test>\n  <test id=\"language/statements/async-generator/yield-star-return-then-getter-ticks.js\"><reason></reason></test>\n  <test id=\"language/statements/class/async-gen-method-static/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/class/async-gen-method-static/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/statements/class/async-gen-method-static/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/statements/class/async-gen-method/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/statements/class/async-gen-method/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method-static/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method/yield-promise-reject-next-for-await-of-async-iterator.js\"><reason></reason></test>\n  <test id=\"language/statements/class/elements/async-gen-private-method/yield-promise-reject-next.js\"><reason></reason></test>\n  <test id=\"language/statements/for-await-of/let-block-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/for-await-of/let-identifier-with-newline.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js\"><reason></reason></test>\n  <test id=\"language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js\"><reason></reason></test>\n  <!-- END - ES2018: Asynchronous Iteration -->\n\n  <!-- Missing test262 support in JerryScript REPL - missing $262 object\n       https://github.com/tc39/test262/blob/main/INTERPRETING.md#host-defined-functions\n  -->\n  <test id=\"annexB/built-ins/Array/from/iterator-method-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/match/custom-matcher-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/matchAll/custom-matcher-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/replace/custom-replacer-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/replaceAll/custom-replacer-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/search/custom-searcher-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/String/prototype/split/custom-splitter-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/built-ins/TypedArrayConstructors/from/iterator-method-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/language/expressions/assignment/dstr/array-pattern-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/language/expressions/assignment/dstr/object-pattern-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/language/expressions/yield/star-iterable-return-emulates-undefined-throws-when-called.js\"><reason></reason></test>\n  <test id=\"annexB/language/expressions/yield/star-iterable-throw-emulates-undefined-throws-when-called.js\"><reason></reason></test>\n  <test id=\"annexB/language/statements/class/subclass/superclass-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/language/statements/const/dstr/array-pattern-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/language/statements/const/dstr/object-pattern-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"annexB/language/statements/for-of/iterator-close-return-emulates-undefined-throws-when-called.js\"><reason></reason></test>\n  <test id=\"annexB/language/statements/function/default-parameters-emulates-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/bigint/notify-all-on-loc.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/count-defaults-to-infinity-missing.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/count-defaults-to-infinity-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/negative-count.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-all-on-loc.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-all.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-in-order-one-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-in-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-one.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-renotify-noop.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-two.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-with-no-agents-waiting.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-with-no-matching-agents-waiting.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/notify-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/undefined-index-defaults-to-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/nan-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/waiterlist-order-of-operations-is-fifo.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/was-woken-before-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/good-views.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/nan-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/null-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/object-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/poisoned-object-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-index-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/symbol-for-value-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/true-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/undefined-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/undefined-index-defaults-to-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/wait-index-value-not-equal.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/waiterlist-order-of-operations-is-fifo.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/was-woken-before-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/good-views.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/nan-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/null-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/object-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/poisoned-object-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-index-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/symbol-for-value-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/true-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/undefined-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/undefined-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/undefined-index-defaults-to-zero-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/value-not-equal-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/was-woken-before-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/false-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/good-views.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/nan-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/negative-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-no-operation.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-add.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-and.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-compareExchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-exchange.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-or.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-store.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-sub.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/no-spurious-wakeup-on-xor.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/null-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/object-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/poisoned-object-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-index-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-timeout-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/symbol-for-value-throws-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/true-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/undefined-for-timeout-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/undefined-for-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/undefined-index-defaults-to-zero-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/value-not-equal-agent.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/waiterlist-block-indexedposition-wake.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/was-woken-before-timeout.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/gc-has-one-chance-to-call-cleanupCallback.js\"><reason></reason></test>\n  <test id=\"built-ins/FinalizationRegistry/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"intl402/Collator/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"intl402/DateTimeFormat/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"intl402/DisplayNames/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"intl402/ListFormat/constructor/constructor/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"intl402/Locale/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"intl402/NumberFormat/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"intl402/PluralRules/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"intl402/RelativeTimeFormat/constructor/constructor/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"intl402/Segmenter/constructor/constructor/proto-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/eval-realm-indirect.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-cross-realm-class-construct.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-cross-realm-class-derived-construct.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-cross-realm-fun-call.js\"><reason></reason></test>\n  <test id=\"language/expressions/call/tco-cross-realm-fun-construct.js\"><reason></reason></test>\n  <test id=\"language/global-code/script-decl-func-err-non-configurable.js\"><reason></reason></test>\n  <test id=\"language/global-code/script-decl-func-err-non-extensible.js\"><reason></reason></test>\n  <test id=\"language/global-code/script-decl-func.js\"><reason></reason></test>\n  <test id=\"language/global-code/script-decl-lex-deletion.js\"><reason></reason></test>\n  <test id=\"language/global-code/script-decl-lex.js\"><reason></reason></test>\n  <test id=\"language/global-code/script-decl-var-err.js\"><reason></reason></test>\n  <!-- Missing test262 support in JerryScript REPL - missing $262 object -->\n\n  <!-- No longer valid tests: since ECMAScript v11 GetIterator operator should be performed\n       before accessing \"resolve\" property\n  -->\n  <test id=\"built-ins/Promise/all/invoke-resolve-get-error.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/all/resolve-non-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/allSettled/invoke-resolve-get-error.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/allSettled/resolve-non-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/any/invoke-resolve-get-error.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/any/resolve-non-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/race/invoke-resolve-get-error.js\"><reason></reason></test>\n  <test id=\"built-ins/Promise/race/resolve-non-callable.js\"><reason></reason></test>\n\n  <!-- Missing test262 support in JerryScript REPL - missing $262.detachArrayBuffer function\n       https://github.com/tc39/test262/blob/main/INTERPRETING.md#host-defined-functions\n  -->\n  <test id=\"built-ins/Atomics/notify/bigint/null-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/notify/null-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/bigint/null-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/wait/null-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/bigint/null-bufferdata-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Atomics/waitAsync/null-bufferdata-throws.js\"><reason></reason></test>\n  <!-- END - Missing test262 support in JerryScript REPL - missing $262.detachArrayBuffer function -->\n\n  <!-- Missing $test262.IsHTMLDDA support\n  -->\n  <test id=\"annexB/language/statements/for-await-of/iterator-close-return-emulates-undefined-throws-when-called.js\"><reason></reason></test>\n  <!-- END - Missing $test262.IsHTMLDDA support -->\n\n  <!-- ESNext: Array/TypedArray prototype findLast and findLastIndex\n       https://github.com/tc39/proposal-array-find-from-last\n  -->\n  <test id=\"built-ins/Array/prototype/findLast/array-altered-during-loop.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/call-with-boolean.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/callbackfn-resize-arraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/predicate-call-parameters.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/predicate-call-this-non-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/predicate-call-this-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/predicate-called-for-each-array-property.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/predicate-not-called-on-empty-array.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/return-abrupt-from-predicate-call.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/return-abrupt-from-property.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/return-abrupt-from-this-length.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/return-found-value-predicate-result-is-true.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLast/return-undefined-if-predicate-returns-false-value.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/array-altered-during-loop.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/call-with-boolean.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/callbackfn-resize-arraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/predicate-call-parameters.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/predicate-call-this-non-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/predicate-call-this-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/predicate-called-for-each-array-property.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/predicate-not-called-on-empty-array.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/return-abrupt-from-predicate-call.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/return-abrupt-from-property.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/return-abrupt-from-this-length.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/return-index-predicate-result-is-true.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findLastIndex/return-negative-one-if-predicate-returns-false-value.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/BigInt/get-length-ignores-length-prop.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-changes-value.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-parameters.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-this-non-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/BigInt/predicate-call-this-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/BigInt/predicate-may-detach-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/BigInt/predicate-not-called-on-empty-array.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/BigInt/return-abrupt-from-predicate-call.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/BigInt/return-found-value-predicate-result-is-true.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/BigInt/return-undefined-if-predicate-returns-false-value.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/callbackfn-resize.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/get-length-ignores-length-prop.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/invoked-as-func.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/invoked-as-method.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/length.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/name.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/predicate-call-changes-value.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/predicate-call-parameters.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/predicate-call-this-non-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/predicate-call-this-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/predicate-may-detach-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/predicate-not-called-on-empty-array.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/return-abrupt-from-predicate-call.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/return-found-value-predicate-result-is-true.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLast/return-undefined-if-predicate-returns-false-value.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/BigInt/get-length-ignores-length-prop.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-changes-value.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-parameters.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-this-non-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-call-this-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-may-detach-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/BigInt/predicate-not-called-on-empty-array.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/BigInt/return-abrupt-from-predicate-call.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/BigInt/return-index-predicate-result-is-true.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/BigInt/return-negative-one-if-predicate-returns-false-value.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/callbackfn-resize.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/get-length-ignores-length-prop.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/invoked-as-func.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/invoked-as-method.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/length.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/name.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/predicate-call-changes-value.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/predicate-call-parameters.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/predicate-call-this-non-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/predicate-call-this-strict.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/predicate-may-detach-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/predicate-not-called-on-empty-array.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/return-abrupt-from-predicate-call.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/return-index-predicate-result-is-true.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findLastIndex/return-negative-one-if-predicate-returns-false-value.js\"><reason></reason></test>\n  <!-- END - ESNext: Array prototype findLast and findLastIndex -->\n\n  <!-- ESNext: Resizable and growable ArrayBuffer\n       https://github.com/tc39/proposal-resizablearraybuffer\n  -->\n  <test id=\"built-ins/ArrayBuffer/options-maxbytelength-diminuitive.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/options-maxbytelength-excessive.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/options-maxbytelength-negative.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/options-maxbytelength-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/options-maxbytelength-poisoned.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/options-maxbytelength-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/options-non-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/byteLength/detached-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/maxByteLength/detached-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/maxByteLength/invoked-as-accessor.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/maxByteLength/invoked-as-func.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/maxByteLength/length.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/maxByteLength/name.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/maxByteLength/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/maxByteLength/return-maxbytelength-non-resizable.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/maxByteLength/return-maxbytelength-resizable.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/maxByteLength/this-has-no-arraybufferdata-internal.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/maxByteLength/this-is-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/maxByteLength/this-is-sharedarraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resizable/detached-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resizable/invoked-as-accessor.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resizable/invoked-as-func.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resizable/length.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resizable/name.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resizable/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resizable/return-resizable.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resizable/this-has-no-arraybufferdata-internal.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resizable/this-is-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resizable/this-is-sharedarraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/descriptor.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/extensible.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/length.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/name.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/new-length-excessive.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/new-length-negative.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/new-length-non-number.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/nonconstructor.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/resize-grow.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/resize-same-size-zero-explicit.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/resize-same-size-zero-implicit.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/resize-same-size.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/resize-shrink-zero-explicit.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/resize-shrink-zero-implicit.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/resize-shrink.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/this-is-detached.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/this-is-not-arraybuffer-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/this-is-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/resize/this-is-not-resizable-arraybuffer-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/descriptor.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/extensible.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/from-fixed-to-larger.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/from-fixed-to-same.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/from-fixed-to-smaller.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/from-fixed-to-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/from-resizable-to-larger.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/from-resizable-to-same.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/from-resizable-to-smaller.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/from-resizable-to-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/length.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/name.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/new-length-excessive.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/new-length-non-number.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/nonconstructor.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/this-is-detached.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/this-is-not-arraybuffer-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ArrayBuffer/prototype/transfer/this-is-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/every/callbackfn-resize-arraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/filter/callbackfn-resize-arraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/find/callbackfn-resize-arraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/Array/prototype/findIndex/callbackfn-resize-arraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/at/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/at/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/byteLength/BigInt/resizable-array-buffer-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/byteLength/BigInt/resizable-array-buffer-fixed.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/byteLength/resizable-array-buffer-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/byteLength/resizable-array-buffer-fixed.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/byteOffset/BigInt/resizable-array-buffer-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/byteOffset/BigInt/resizable-array-buffer-fixed.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/byteOffset/resizable-array-buffer-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/byteOffset/resizable-array-buffer-fixed.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/copyWithin/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/entries/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/entries/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/every/BigInt/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/every/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/every/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/every/callbackfn-resize.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/every/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/fill/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/filter/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/filter/callbackfn-resize.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/filter/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/find/BigInt/predicate-may-detach-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/find/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/find/callbackfn-resize.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/find/predicate-may-detach-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/find/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findIndex/BigInt/predicate-may-detach-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findIndex/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findIndex/callbackfn-resize.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findIndex/predicate-may-detach-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/findIndex/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/forEach/BigInt/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/forEach/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/forEach/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/forEach/callbackfn-resize.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/forEach/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/includes/BigInt/detached-buffer-during-fromIndex-returns-false-for-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/includes/BigInt/detached-buffer-during-fromIndex-returns-true-for-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/includes/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/includes/detached-buffer-during-fromIndex-returns-false-for-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/includes/detached-buffer-during-fromIndex-returns-true-for-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/includes/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/indexOf/BigInt/detached-buffer-during-fromIndex-returns-minus-one-for-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/indexOf/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/indexOf/detached-buffer-during-fromIndex-returns-minus-one-for-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/indexOf/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/join/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/join/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/keys/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/keys/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/lastIndexOf/BigInt/detached-buffer-during-fromIndex-returns-minus-one-for-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/lastIndexOf/BigInt/detached-buffer-during-fromIndex-returns-minus-one-for-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/lastIndexOf/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/lastIndexOf/detached-buffer-during-fromIndex-returns-minus-one-for-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/lastIndexOf/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/length/BigInt/resizable-array-buffer-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/length/BigInt/resizable-array-buffer-fixed.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/length/resizable-array-buffer-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/length/resizable-array-buffer-fixed.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/map/BigInt/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/map/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/map/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/map/callbackfn-resize.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/map/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/reduce/BigInt/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/reduce/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/reduce/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/reduce/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/reduceRight/BigInt/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/reduceRight/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/reduceRight/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/reduceRight/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/reverse/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/reverse/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-resized.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-target-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-resized.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/set/typedarray-arg-target-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/slice/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/slice/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/some/BigInt/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/some/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/some/callbackfn-detachbuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/some/callbackfn-resize.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/some/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/sort/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/sort/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/toLocaleString/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/toLocaleString/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/values/BigInt/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArray/prototype/values/return-abrupt-from-this-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-different-type.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/ctors/typedarray-arg/out-of-bounds-when-species-retrieved-same-type.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-not-configurable-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex-desc-not-configurable-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/GetOwnProperty/BigInt/index-prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/GetOwnProperty/index-prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/HasProperty/resizable-array-buffer-fixed.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-resizable-array-buffer-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/OwnPropertyKeys/integer-indexes-resizable-array-buffer-fixed.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-minus-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-not-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-detached-buffer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/Set/key-is-minus-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/Set/key-is-not-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/Set/key-is-out-of-bounds.js\"><reason></reason></test>\n  <test id=\"built-ins/TypedArrayConstructors/internals/Set/tonumber-value-detached-buffer.js\"><reason></reason></test>\n  <!-- END - ESNext: Resizable and growable ArrayBuffer -->\n\n  <!-- ESNext: RegExp hasIndicies\n       https://tc39.es/proposal-regexp-match-indices/#sec-get-regexp.prototype.hasIndices\n  -->\n  <test id=\"built-ins/RegExp/prototype/hasIndices/cross-realm.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/hasIndices/length.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/hasIndices/name.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/hasIndices/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/hasIndices/this-val-invalid-obj.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/hasIndices/this-val-non-obj.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/hasIndices/this-val-regexp-prototype.js\"><reason></reason></test>\n  <test id=\"built-ins/RegExp/prototype/hasIndices/this-val-regexp.js\"><reason></reason></test>\n  <!-- END - ESNext: RegExp hasIndicies -->\n\n  <!-- ESNext: Shadow Realm\n       https://github.com/tc39/proposal-shadowrealm\n  -->\n  <test id=\"built-ins/ShadowRealm/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/descriptor.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/extensibility.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/instance-extensibility.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/instance.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/length.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/name.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/proto.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/Symbol.toStringTag.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/descriptor.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/errors-from-the-other-realm-is-wrapped-into-a-typeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/globalthis-available-properties.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/globalthis-config-only-properties.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/globalthis-orginary-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/length.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/name.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/nested-realms.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/no-conditional-strict-mode.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/not-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/proto.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/returns-primitive-values.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/returns-proxy-callable-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/returns-symbol-values.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/throws-error-from-ctor-realm.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/throws-syntaxerror-on-bad-syntax.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/throws-typeerror-if-evaluation-resolves-to-non-primitive.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/throws-when-argument-is-not-a-string.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/validates-realm-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-arguments-are-wrapped-into-the-inner-realm-extended.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-arguments-are-wrapped-into-the-inner-realm.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-from-return-values-share-no-identity.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-multiple-different-realms-nested.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-multiple-different-realms.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-observing-their-scopes.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-proto-from-caller-realm.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-proxied-observes-boundary.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-throws-typeerror-from-caller-realm.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-throws-typeerror-on-exceptional-exit.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-throws-typeerror-on-non-primitive-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-function-throws-typeerror-on-non-primitive-returns.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-functions-accepts-callable-objects.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-functions-can-resolve-callable-returns.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-functions-new-wrapping-on-each-evaluation.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-functions-share-no-properties-extended.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/evaluate/wrapped-functions-share-no-properties.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/descriptor.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/exportName-tostring.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/import-value.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/length.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/name.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/not-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/proto.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/specifier-tostring.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/throws-if-import-value-does-not-exist.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/throws-typeerror-import-syntax-error.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/throws-typeerror-import-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/importValue/validates-realm-object.js\"><reason></reason></test>\n  <test id=\"built-ins/ShadowRealm/prototype/proto.js\"><reason></reason></test>\n  <!-- END - ESNext: Shadow Realm -->\n\n  <!-- ES2021: Shared Array Buffer -->\n  <test id=\"built-ins/SharedArrayBuffer/options-maxbytelength-diminuitive.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/options-maxbytelength-excessive.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/options-maxbytelength-negative.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/options-maxbytelength-object.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/options-maxbytelength-poisoned.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/options-maxbytelength-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/options-non-object.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/descriptor.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/extensible.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/grow-larger-size.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/grow-same-size.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/grow-smaller-size.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/length.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/name.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/new-length-excessive.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/new-length-negative.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/new-length-non-number.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/nonconstructor.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/this-is-not-arraybuffer-object.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/this-is-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/grow/this-is-not-resizable-arraybuffer-object.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/growable/invoked-as-accessor.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/growable/invoked-as-func.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/growable/length.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/growable/name.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/growable/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/growable/return-growable.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/growable/this-has-no-arraybufferdata-internal.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/growable/this-is-arraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/growable/this-is-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/maxByteLength/invoked-as-accessor.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/maxByteLength/invoked-as-func.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/maxByteLength/length.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/maxByteLength/name.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/maxByteLength/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/maxByteLength/return-maxbytelength-growable.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/maxByteLength/return-maxbytelength-non-growable.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/maxByteLength/this-has-no-arraybufferdata-internal.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/maxByteLength/this-is-arraybuffer.js\"><reason></reason></test>\n  <test id=\"built-ins/SharedArrayBuffer/prototype/maxByteLength/this-is-not-object.js\"><reason></reason></test>\n  <!-- END - ES2021: Shared Array Buffer -->\n\n  <!-- ESNext: Temporal built-in object\n       https://github.com/tc39/proposal-temporal\n  -->\n  <test id=\"built-ins/Temporal/Calendar/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/calendar-object-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/calendar-object-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/calendar-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/calendar-string-builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/calendar-string-not-builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/from/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/missing-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/add-days.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/add-months-weeks.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/add-months.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/add-weeks-days.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/add-weeks.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/add-years-months-days.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/add-years-months.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/add-years-weeks.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/add-years.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/argument-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/balance-smaller-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/date-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/duration-argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/throw-range-error-from-ToTemporalDate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/throw-range-error-from-ToTemporalDuration.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateAdd/throw-type-error-from-GetOptionsObject.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/fields-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/throw-type-error-from-GetOptionsObject.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/throws-range-error.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/throws-type-error.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-month-day-need-constrain.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-month-day.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-monthCode-day-need-constrain.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-monthCode-day.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/argument-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/argument-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/largest-unit-day.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/largest-unit-month.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/largest-unit-week.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/largest-unit-year.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/no-options.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/throws-range-error-ToLargestTemporalUnit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/throws-range-error-ToTemporalDate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dateUntil/throws-type-error-GetOptionsObject.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/date-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/date.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/month-day.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/day/throw-range-error-ToTemporalDate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/plain-date.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfWeek/throw-range-error-ToTemporalDate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/plain-date.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/dayOfYear/throw-range-error-ToTemporalDate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/plain-date-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/plain-date.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInMonth/throw-range-error-ToTemporalDate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/date-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/date.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInWeek/throw-range-error-ToTemporalDate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/plain-date-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/plain-date.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/daysInYear/throw-range-error-ToTemporalDate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/argument-iterable-not-array.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/argument-throws-duplicate-keys.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/argument-throws-invalid-keys.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/long-input.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/non-string-element-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/repeated-throw.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/fields/reverse.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/id/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/inLeapYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/mergeFields/arguments-empty-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/mergeFields/arguments-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/mergeFields/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/mergeFields/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/mergeFields/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/mergeFields/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/mergeFields/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/mergeFields/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/date-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/date.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/month-day-throw-type-error.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/throw-range-error-ToTemporalDate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/month/year-month.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/date-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/date.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/month-day.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/throw-range-error-ToTemporalDate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthCode/year-month.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthDayFromFields/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthDayFromFields/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthDayFromFields/fields-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthDayFromFields/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthDayFromFields/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthDayFromFields/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthDayFromFields/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthDayFromFields/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthDayFromFields/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthDayFromFields/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthDayFromFields/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/monthsInYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/toJSON/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/toJSON/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/toJSON/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/toJSON/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/toJSON/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/toString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/toString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/toString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/toString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/toString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/toString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/cross-year.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/weekOfYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/date-time.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/date.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/throw-range-error-ToTemporalDate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/year/year-month.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/yearMonthFromFields/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/yearMonthFromFields/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/yearMonthFromFields/fields-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/yearMonthFromFields/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/yearMonthFromFields/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/yearMonthFromFields/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/yearMonthFromFields/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/yearMonthFromFields/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/yearMonthFromFields/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/yearMonthFromFields/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Calendar/prototype/yearMonthFromFields/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/calendar-dateadd-called-with-plaindate-instance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-propertybag-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-string-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-string-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-string-zoneddatetime-wrong-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-string-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-sub-minute-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-undefined-throw-on-calendar-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/compare/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/days-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/fractional-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/argument-existing-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/argument-non-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/negative-inifinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/string-with-skipped-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/from/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/hours-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/microseconds-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/milliseconds-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/minutes-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/months-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/nanoseconds-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/abs/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/abs/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/abs/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/abs/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/abs/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/abs/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/abs/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/balance-negative-result.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/calendar-dateadd-called-with-options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/calendar-dateadd-called-with-plaindate-instance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-string-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-string-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-string-zoneddatetime-wrong-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-string-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-sub-minute-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/add/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/blank/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/blank/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/days/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/days/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/hours/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/hours/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/microseconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/microseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/milliseconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/milliseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/minutes/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/minutes/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/months/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/months/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/nanoseconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/nanoseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/negated/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/negated/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/negated/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/negated/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/negated/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/negated/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/negated/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/balance-negative-result.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/calendar-dateadd-called-with-plaindate-instance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/dateuntil-field.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/largestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-string-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-string-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-string-zoneddatetime-wrong-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-string-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-sub-minute-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-undefined-throw-on-calendar-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/round-negative-result.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/smallestunit-disallowed-units-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/smallestunit-plurals-accepted-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/smallestunit-string-shorthand-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/round/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/seconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/seconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/sign/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/sign/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/balance-negative-result.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/calendar-dateadd-called-with-options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/calendar-dateadd-called-with-plaindate-instance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-string-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-string-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-string-zoneddatetime-wrong-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-string-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-sub-minute-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/subtract/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toJSON/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toJSON/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toJSON/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toJSON/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toJSON/negative-components.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toJSON/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toJSON/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toLocaleString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toLocaleString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toLocaleString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toLocaleString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toLocaleString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toLocaleString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/blank-duration-precision.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/fractionalseconddigits-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/negative-components.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/precision.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/smallestunit-valid-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/toString/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/balance-negative-result.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/calendar-dateadd-called-with-plaindate-instance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/dateuntil-field.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/options-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-string-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-string-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-string-zoneddatetime-wrong-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-string-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-sub-minute-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-undefined-throw-on-calendar-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/unit-disallowed-units-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/unit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/unit-plurals-accepted-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/unit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/unit-string-shorthand-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/total/unit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/valueOf/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/valueOf/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/valueOf/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/valueOf/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/valueOf/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/valueOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/weeks/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/weeks/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/with/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/with/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/with/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/with/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/with/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/with/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/with/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/with/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/with/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/with/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/with/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/years/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/prototype/years/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/seconds-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/weeks-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Duration/years-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/argument.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/compare/argument-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/compare/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/compare/instant-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/compare/instant-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/compare/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/compare/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/compare/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/compare/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/from/argument-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/from/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/from/instant-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/from/instant-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/from/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/from/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/from/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/from/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/from/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/from/timezone-custom.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMicroseconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMicroseconds/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMicroseconds/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMicroseconds/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMicroseconds/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMicroseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMicroseconds/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMilliseconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMilliseconds/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMilliseconds/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMilliseconds/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMilliseconds/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMilliseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochMilliseconds/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochNanoseconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochNanoseconds/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochNanoseconds/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochNanoseconds/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochNanoseconds/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochNanoseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochNanoseconds/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochSeconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochSeconds/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochSeconds/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochSeconds/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochSeconds/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochSeconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/fromEpochSeconds/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/result-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/add/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochMicroseconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochMicroseconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochMicroseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochMilliseconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochMilliseconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochMilliseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochNanoseconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochNanoseconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochNanoseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochSeconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochSeconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/epochSeconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/equals/argument-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/equals/argument-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/equals/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/equals/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/equals/instant-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/equals/instant-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/equals/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/equals/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/equals/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/equals/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/options-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/smallestunit-disallowed-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/smallestunit-string-shorthand.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/round/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/argument-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/instant-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/instant-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/largestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/since/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/result-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/subtract/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toJSON/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toJSON/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toJSON/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toJSON/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toJSON/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toJSON/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toJSON/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toJSON/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toJSON/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toLocaleString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toLocaleString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toLocaleString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toLocaleString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toLocaleString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toLocaleString/options-conflict.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toLocaleString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toLocaleString/return-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/fractionalseconddigits-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/precision.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/smallestunit-valid-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/timezone-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toString/timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toStringTag/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTime/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTime/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTime/plain-custom-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTime/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/argument-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/instant-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/instant-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/largestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/until/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/valueOf/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/valueOf/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/valueOf/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/valueOf/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/valueOf/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Instant/prototype/valueOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/instant/extensible.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/instant/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/instant/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/instant/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/instant/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/instant/return-value-distinct.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/instant/return-value-prototype.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/instant/return-value-value.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDate/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDate/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDate/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDate/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDate/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDate/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDate/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDate/toPlainDate-override.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateISO/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateISO/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateISO/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateISO/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateISO/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateISO/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/calendar-function.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/calendar-object-fail-call-tostring.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/calendar-object-fail-get-calendar.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/calendar-object-fail-has-calendar.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/calendar-object-fail-has-nested-calendar.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/calendar-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/extensible.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/return-value.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/time-zone-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-getoffsetnanosecondsfor-invocation.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-getoffsetnanosecondsfor-non-method.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-getoffsetnanosecondsfor-not-a-number.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-getoffsetnanosecondsfor-poisoned.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-getoffsetnanosecondsfor-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-object-fail-call-tostring.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-object-fail-get-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-object-fail-has-nested-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-object-fail-has-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTime/timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/extensible.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/return-value.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/time-zone-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-getoffsetnanosecondsfor-invocation.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-getoffsetnanosecondsfor-non-method.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-getoffsetnanosecondsfor-not-a-number.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-getoffsetnanosecondsfor-poisoned.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-getoffsetnanosecondsfor-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-call-tostring.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-get-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-has-nested-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-object-fail-has-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainDateTimeISO/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainTimeISO/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainTimeISO/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainTimeISO/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainTimeISO/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainTimeISO/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainTimeISO/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainTimeISO/timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/plainTimeISO/toPlainTime-override.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/timeZone/extensible.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/timeZone/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/timeZone/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/timeZone/new-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/timeZone/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/timeZone/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/timeZone/return-value.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/toStringTag/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/toStringTag/string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/calendar-function.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/calendar-object-fail-call-tostring.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/calendar-object-fail-get-calendar.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/calendar-object-fail-has-calendar.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/calendar-object-fail-has-nested-calendar.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/calendar-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/extensible.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/time-zone-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-call-tostring.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-get-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-has-nested-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/timezone-object-fail-has-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/timezone-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTime/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/extensible.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/time-zone-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-call-tostring.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-get-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-has-nested-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/timezone-object-fail-has-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/timezone-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/calendar-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/argument-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/argument-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/calendar.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/compare/use-internal-slots.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/argument-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/argument-plaindate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/argument-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/argument-string-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/limits.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/options-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/from/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/limits.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/missing-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/argument-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/balance-smaller-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/limits.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/options-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/add/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/calendar/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/calendar/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/day/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/day/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/day/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/dayOfWeek/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/dayOfWeek/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/dayOfWeek/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/dayOfYear/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/dayOfYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/dayOfYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/daysInMonth/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/daysInMonth/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/daysInWeek/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/daysInWeek/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/daysInWeek/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/daysInYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/daysInYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/argument-object-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/argument-object-valid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/argument-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/argument-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/calendar-call-different.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/calendar-call-same.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/calendar-no-call.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/equals/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/getISOFields/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/getISOFields/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/getISOFields/field-names.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/getISOFields/field-prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/getISOFields/field-traversal-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/getISOFields/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/getISOFields/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/getISOFields/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/getISOFields/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/inLeapYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/inLeapYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/month/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/month/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/month/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/monthCode/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/monthCode/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/monthsInYear/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/monthsInYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/monthsInYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/argument-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/calendar-dateadd-called-with-plaindate-instance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/calendar-id-match.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/calendar-mismatch.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/largestunit-default.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/largestunit-higher-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/largestunit-smallestunit-mismatch.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/options-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/since/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/argument-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/balance-smaller-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/limits.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/options-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/subtract/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toJSON/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toJSON/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toJSON/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toJSON/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toJSON/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toJSON/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toLocaleString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toLocaleString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toLocaleString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toLocaleString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toLocaleString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toLocaleString/options-conflict.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toLocaleString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toLocaleString/return-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/plaintime-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/time-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainDateTime/time-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/calendar-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainMonthDay/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/calendar-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toPlainYearMonth/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/calendarname-always.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/calendarname-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/calendarname-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/calendarname-never.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/calendarname-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/calendarname-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/calendar-dateadd-called-with-options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/plaintime-argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/plaintime-argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/plaintime-argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/plaintime-argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/plaintime-argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/plaintime-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/argument-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/calendar-dateadd-called-with-plaindate-instance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/calendar-id-match.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/calendar-mismatch.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/days-in-month.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/days-in-year.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/largestunit-default.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/largestunit-higher-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/largestunit-smallestunit-mismatch.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/options-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/until/weeks-months.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/valueOf/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/valueOf/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/valueOf/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/valueOf/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/valueOf/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/valueOf/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/valueOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/weekOfYear/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/weekOfYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/weekOfYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/calendar-merge-fields-returns-primitive.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/copies-merge-fields-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/options-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/plaindatelike-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/with/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/withCalendar/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/withCalendar/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/withCalendar/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/withCalendar/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/withCalendar/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/withCalendar/missing-argument.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/withCalendar/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/withCalendar/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/withCalendar/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/withCalendar/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/year/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/year/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDate/prototype/year/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/calendar-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/argument-plaindate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/compare/use-internal-slots.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/argument-plaindate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/parser.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/from/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/hour-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/microsecond-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/millisecond-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/minute-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/missing-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/nanosecond-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/argument-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/add/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/calendar/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/calendar/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/day/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/day/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/day/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/dayOfWeek/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/dayOfWeek/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/dayOfYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/dayOfYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/daysInMonth/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/daysInMonth/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/daysInWeek/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/daysInWeek/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/daysInYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/daysInYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/argument-plaindate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/argument-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/equals/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/getISOFields/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/getISOFields/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/getISOFields/field-names.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/getISOFields/field-prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/getISOFields/field-traversal-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/getISOFields/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/getISOFields/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/getISOFields/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/getISOFields/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/hour/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/hour/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/inLeapYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/inLeapYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/microsecond/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/microsecond/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/millisecond/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/millisecond/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/minute/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/minute/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/month/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/month/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/month/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/monthCode/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/monthCode/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/monthsInYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/monthsInYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/nanosecond/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/nanosecond/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/smallestunit-disallowed-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/smallestunit-string-shorthand.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/round/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/second/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/second/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/argument-plaindate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/balance-negative-duration.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/calendar-dateadd-called-with-plaindate-instance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/calendar-dateuntil-called-with-copy-of-options.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/calendar-dateuntil-called-with-plaindate-calendar.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/largestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/round-negative-duration.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/since/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/argument-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/subtract/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toJSON/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toJSON/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toJSON/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toJSON/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toJSON/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toJSON/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toLocaleString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toLocaleString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toLocaleString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toLocaleString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toLocaleString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toLocaleString/options-conflict.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toLocaleString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toLocaleString/return-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainDate/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainDate/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainDate/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainDate/limits.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainDate/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainDate/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainDate/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainMonthDay/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainTime/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toPlainYearMonth/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/calendarname-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/fractionalseconddigits-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-valid-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toString/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/calendar-dateadd-called-with-options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/disambiguation-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/disambiguation-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/disambiguation-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/plain-custom-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/argument-plaindate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/balance-negative-duration.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/balance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/calendar-dateadd-called-with-plaindate-instance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/calendar-dateuntil-called-with-copy-of-options.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/calendar-dateuntil-called-with-plaindate-calendar.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/largestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/round-negative-duration.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/until/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/valueOf/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/valueOf/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/valueOf/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/valueOf/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/valueOf/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/valueOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/weekOfYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/weekOfYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/calendar-merge-fields-returns-primitive.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/copies-merge-fields-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/with/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withCalendar/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withCalendar/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withCalendar/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withCalendar/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withCalendar/missing-argument.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withCalendar/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withCalendar/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withCalendar/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withCalendar/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainDate/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/plaintime-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/withPlainTime/time-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/year/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/year/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/prototype/year/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainDateTime/second-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/calendar-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/calendar-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/fields-leap-day.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/fields-missing-properties.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/fields-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/fields-plainmonthday.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/fields-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/options-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/overflow.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/from/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/missing-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/calendar/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/calendar/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/day/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/day/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/day/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/day/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/argument-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/calendars.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/equals/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/getISOFields/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/getISOFields/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/getISOFields/field-names.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/getISOFields/field-prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/getISOFields/field-traversal-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/getISOFields/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/getISOFields/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/getISOFields/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/getISOFields/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/month/unsupported.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/monthCode/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/monthCode/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/monthCode/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toJSON/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toJSON/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toJSON/calendarname.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toJSON/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toJSON/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toJSON/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toJSON/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toLocaleString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/argument-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/calendar-merge-fields-returns-primitive.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/copies-merge-fields-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/limits.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-always.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-auto.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-never.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/toString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/valueOf/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/valueOf/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/valueOf/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/valueOf/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/valueOf/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/valueOf/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/valueOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/calendar-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/calendar-merge-fields-returns-primitive.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/copies-merge-fields-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/options-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/prototype/with/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainMonthDay/refisoyear-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/plaintime-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/compare/use-internal-slots.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/argument-string-with-calendar.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/plaintime-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/from/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/hour-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/microsecond-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/millisecond-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/minute-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/nanosecond-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/argument-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/add/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/calendar/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/calendar/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/argument-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/plaintime-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/equals/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/getISOFields/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/getISOFields/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/getISOFields/field-names.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/getISOFields/field-prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/getISOFields/field-traversal-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/getISOFields/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/getISOFields/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/getISOFields/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/getISOFields/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/hour/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/hour/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/microsecond/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/microsecond/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/millisecond/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/millisecond/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/minute/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/minute/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/nanosecond/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/nanosecond/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/smallestunit-disallowed-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/smallestunit-string-shorthand.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/round/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/second/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/second/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/largestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/plaintime-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/since/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/argument-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/subtract/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toJSON/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toJSON/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toJSON/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toJSON/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toJSON/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toJSON/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toLocaleString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toLocaleString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toLocaleString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toLocaleString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toLocaleString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toLocaleString/options-conflict.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toLocaleString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toLocaleString/return-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toPlainDateTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/smallestunit-valid-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toString/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-primitive.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/calendar-dateadd-called-with-options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/plaindate-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/largestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/plaintime-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/until/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/valueOf/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/valueOf/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/valueOf/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/valueOf/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/valueOf/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/valueOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/argument-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/options-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/plaintimelike-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/prototype/with/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainTime/second-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/calendar-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/calendar-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/compare/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/compare/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/compare/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/compare/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/compare/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/compare/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/compare/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/compare/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/compare/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/compare/use-internal-slots.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/from/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/missing-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/argument-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/calendar-arguments-extra-options.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/calendar-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/calendar-daysinmonth-wrong-value.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/add/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/calendar/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/calendar/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/daysInMonth/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/daysInMonth/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/daysInYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/daysInYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/equals/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/equals/argument-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/equals/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/equals/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/equals/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/equals/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/equals/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/equals/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/equals/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/equals/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/equals/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/getISOFields/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/getISOFields/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/getISOFields/field-names.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/getISOFields/field-prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/getISOFields/field-traversal-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/getISOFields/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/getISOFields/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/getISOFields/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/getISOFields/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/inLeapYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/inLeapYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/month/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/month/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/month/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/monthCode/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/monthCode/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/monthsInYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/monthsInYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/arguments-casting.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/arguments-missing-throws.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/calendar-dateadd-called-with-plaindate-instance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/largestunit-disallowed-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/largestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/mixed-calendar-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/negation.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/options-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/roundingincrement-as-expected.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/smallestunit-disallowed-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/since/symmetry.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/argument-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/argument-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/calendar-arguments-extra-options.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/calendar-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/calendar-daysinmonth-wrong-value.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/negative-infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/subtract/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toJSON/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toJSON/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toJSON/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toJSON/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toJSON/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toJSON/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toLocaleString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/argument-not-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/calendar-merge-fields-returns-primitive.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/copies-merge-fields-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/limits.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toString/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/toString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/calendar-dateadd-called-with-plaindate-instance.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/largestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/until/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/valueOf/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/valueOf/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/valueOf/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/valueOf/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/valueOf/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/valueOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/calendar-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/calendar-merge-fields-returns-primitive.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/copies-merge-fields-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/order-of-operations.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/with/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/year/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/year/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/prototype/year/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/PlainYearMonth/refisoday-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/argument-object-invalid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/argument-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/argument-primitive.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/argument-valid.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/from/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/missing-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-not-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-plaindate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/calendar-dateadd-called-with-options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/disambiguation-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/disambiguation-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/disambiguation-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getInstantFor/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getNextTransition/argument-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getNextTransition/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getNextTransition/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getNextTransition/instant-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getNextTransition/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getNextTransition/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getNextTransition/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getNextTransition/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-not-absolute.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/argument-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/instant-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetNanosecondsFor/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-not-absolute-getOffsetNanosecondsFor-override.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-not-absolute.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/argument-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/instant-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getOffsetStringFor/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-not-absolute-getOffsetNanosecondsFor-override.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-not-absolute.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/argument-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/calendar-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/custom-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/instant-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/instant-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/pre-epoch.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-not-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-plaindate.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPossibleInstantsFor/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPreviousTransition/argument-zoneddatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPreviousTransition/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPreviousTransition/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPreviousTransition/instant-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPreviousTransition/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPreviousTransition/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPreviousTransition/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/getPreviousTransition/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/id/no-toString.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/id/plain-custom-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/id/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toJSON/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toJSON/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toJSON/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toJSON/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toJSON/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toJSON/tostring-call.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toJSON/tostring-undefined-custom.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toJSON/tostring-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/TimeZone/prototype/toString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/calendar-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/zoneddatetime-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/compare/zoneddatetime-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/disambiguation-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/disambiguation-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/disambiguation-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/offset-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/offset-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/offset-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/zoneddatetime-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/zoneddatetime-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/from/zoneddatetime-sub-minute-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/missing-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/add/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/calendar/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/calendar/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/day/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/day/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/day/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/day/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/day/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/day/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/day/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/day/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfWeek/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfWeek/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfWeek/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfWeek/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfWeek/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfWeek/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfYear/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfYear/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfYear/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/dayOfYear/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInMonth/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInMonth/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInMonth/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInMonth/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInMonth/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInMonth/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInWeek/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInWeek/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInWeek/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInWeek/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInWeek/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInWeek/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInYear/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInYear/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInYear/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/daysInYear/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochMicroseconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochMicroseconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochMicroseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochMilliseconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochMilliseconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochMilliseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochNanoseconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochNanoseconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochNanoseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochSeconds/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochSeconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/epochSeconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/sub-minute-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/zoneddatetime-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/equals/zoneddatetime-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/field-names.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/field-prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/field-traversal-order.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/getISOFields/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hour/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hour/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hour/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hour/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hour/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hour/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hour/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hoursInDay/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hoursInDay/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hoursInDay/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hoursInDay/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hoursInDay/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hoursInDay/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/hoursInDay/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/inLeapYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/inLeapYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/inLeapYear/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/inLeapYear/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/inLeapYear/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/inLeapYear/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/microsecond/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/microsecond/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/microsecond/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/microsecond/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/microsecond/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/microsecond/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/microsecond/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/microsecond/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/millisecond/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/millisecond/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/millisecond/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/millisecond/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/millisecond/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/millisecond/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/millisecond/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/millisecond/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/minute/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/minute/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/minute/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/minute/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/minute/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/minute/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/minute/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/month/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/month/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/month/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/month/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/month/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/month/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/month/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthCode/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthCode/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthCode/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthCode/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthCode/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthCode/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthsInYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthsInYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthsInYear/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthsInYear/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthsInYear/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/monthsInYear/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/nanosecond/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/nanosecond/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/nanosecond/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/nanosecond/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/nanosecond/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/nanosecond/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/nanosecond/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offset/basic.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offset/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offset/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offset/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offset/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offset/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offset/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offsetNanoseconds/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offsetNanoseconds/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offsetNanoseconds/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offsetNanoseconds/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offsetNanoseconds/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/offsetNanoseconds/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/calendar-dateadd-called-with-options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/dateadd-options.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/div-zero.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/smallestunit-disallowed-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/smallestunit-string-shorthand.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/round/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/second/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/second/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/second/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/second/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/second/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/second/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/second/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/argument-propertybag-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/calendar-dateuntil-called-with-copy-of-options.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/largestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/sub-minute-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/zoneddatetime-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/since/zoneddatetime-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/calendar-dateadd-called-with-options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/startOfDay/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/argument-string-negative-fractional-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/non-integer-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/subtract/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/timeZone/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/timeZone/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toInstant/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toInstant/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toInstant/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toInstant/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toInstant/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toInstant/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toJSON/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/options-conflict.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/return-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/plain-custom-timezone.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/calendar-result.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainMonthDay/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-arguments.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/calendar-result.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toPlainYearMonth/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/fractionalseconddigits-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/offset-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/offset-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/offset-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-valid-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/timezonename-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/timezonename-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/toString/timezonename-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/argument-propertybag-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/calendar-dateuntil-called-with-copy-of-options.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/calendar-dateuntil-called-with-singular-largestunit.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/largestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/largestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/largestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/largestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/roundingincrement-nan.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/roundingincrement-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/roundingincrement-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/roundingincrement-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/roundingincrement-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/roundingmode-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/roundingmode-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/roundingmode-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/smallestunit-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/smallestunit-plurals-accepted.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/smallestunit-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/smallestunit-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/sub-minute-offset.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/zoneddatetime-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/until/zoneddatetime-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/valueOf/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/valueOf/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/valueOf/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/valueOf/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/valueOf/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/valueOf/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/weekOfYear/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/weekOfYear/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/weekOfYear/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/weekOfYear/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/weekOfYear/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/weekOfYear/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/calendar-merge-fields-returns-primitive.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/copies-merge-fields-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/disambiguation-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/disambiguation-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/disambiguation-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/offset-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/offset-property-sub-minute.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/offset-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/offset-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/overflow-invalid-string.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/overflow-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/overflow-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/read-time-fields-before-datefromfields.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/receiver-offset-broken.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/with/timezone-getpossibleinstantsfor-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withCalendar/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withCalendar/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withCalendar/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withCalendar/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withCalendar/missing-argument.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withCalendar/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withCalendar/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withCalendar/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withCalendar/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-plaindatetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/calendar-dateadd-called-with-options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/calendar-fields-iterable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/infinity-throws-rangeerror.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-string-with-utc-designator.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-zoneddatetime-balance-negative-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-zoneddatetime-negative-epochnanoseconds.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/calendar-dateadd-called-with-options-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/calendar-temporal-object.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/plaintime-propertybag-no-time-units.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/time-undefined.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/builtin.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/length.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/name.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/not-a-constructor.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/subclassing-ignored.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-multiple-offsets.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/year/branding.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/year/calendar-returns-infinity.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/year/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/year/timezone-getoffsetnanosecondsfor-non-integer.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/year/timezone-getoffsetnanosecondsfor-not-callable.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/year/timezone-getoffsetnanosecondsfor-out-of-range.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/prototype/year/timezone-getoffsetnanosecondsfor-wrong-type.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/ZonedDateTime/timezone-string-datetime.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/getOwnPropertyNames.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/keys.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/toStringTag/prop-desc.js\"><reason></reason></test>\n  <test id=\"built-ins/Temporal/toStringTag/string.js\"><reason></reason></test>\n  <!-- END - ESNext: Tempolar built-in object -->\n\n  <!-- Compound assignment related tests -->\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js\"><reason></reason></test>\n  <test id=\"language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js\"><reason></reason></test>\n  <!-- END - Compound assignment related tests -->\n\n  <!-- Computed property name related tests -->\n  <test id=\"language/statements/class/cpn-class-decl-accessors-computed-property-name-from-await-expression.js\"><reason></reason></test>\n  <test id=\"language/statements/class/cpn-class-decl-computed-property-name-from-await-expression.js\"><reason></reason></test>\n  <test id=\"language/statements/class/cpn-class-decl-fields-computed-property-name-from-await-expression.js\"><reason></reason></test>\n  <test id=\"language/statements/class/cpn-class-decl-fields-methods-computed-property-name-from-await-expression.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-await-expression.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/cpn-class-expr-computed-property-name-from-await-expression.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/cpn-class-expr-fields-computed-property-name-from-await-expression.js\"><reason></reason></test>\n  <test id=\"language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-await-expression.js\"><reason></reason></test>\n  <!-- END - Computed property name related tests -->\n</excludeList>\n"
  },
  {
    "path": "tests/unit-core/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required (VERSION 3.10)\nproject (unit-core C)\n\nif (NOT IS_ABSOLUTE ${FEATURE_PROFILE})\n  set(FEATURE_PROFILE \"${CMAKE_SOURCE_DIR}/jerry-core/profiles/${FEATURE_PROFILE}.profile\")\nendif()\n\nif(${FEATURE_PROFILE} STREQUAL \"${CMAKE_SOURCE_DIR}/jerry-core/profiles/minimal.profile\")\n  message(FATAL_ERROR \"minimal profile isn't supported in unit-core\")\nendif()\n\n# Unit tests main modules\nset(SOURCE_UNIT_TEST_MAIN_MODULES\n  test-abort.c\n  test-api-binary-operations-arithmetics.c\n  test-api-binary-operations-comparisons.c\n  test-api-binary-operations-instanceof.c\n  test-api-errortype.c\n  test-api-functiontype.c\n  test-api-iteratortype.c\n  test-api-object-property-names.c\n  test-api-objecttype.c\n  test-api-promise.c\n  test-api-property.c\n  test-api-set-and-clear-error-flag.c\n  test-api-strings.c\n  test-api-value-type.c\n  test-api.c\n  test-arraybuffer.c\n  test-backtrace.c\n  test-bigint.c\n  test-container.c\n  test-container-operation.c\n  test-context-data.c\n  test-dataview.c\n  test-date-helpers.c\n  test-external-string.c\n  test-from-property-descriptor.c\n  test-get-own-property.c\n  test-has-property.c\n  test-internal-properties.c\n  test-is-eval-code.c\n  test-jmem.c\n  test-json.c\n  test-lit-char-helpers.c\n  test-literal-storage.c\n  test-mem-stats.c\n  test-module-dynamic.c\n  test-module-import-meta.c\n  test-module.c\n  test-native-callback-nested.c\n  test-native-instanceof.c\n  test-native-pointer.c\n  test-newtarget.c\n  test-number-converter.c\n  test-number-to-int32.c\n  test-number-to-string.c\n  test-objects-foreach.c\n  test-poolman.c\n  test-promise-callback.c\n  test-promise.c\n  test-proxy.c\n  test-realm.c\n  test-regexp-dotall-unicode.c\n  test-error-callback.c\n  test-regexp.c\n  test-regression-3588.c\n  test-source-name.c\n  test-script-user-value.c\n  test-snapshot.c\n  test-source-info.c\n  test-special-proxy.c\n  test-string-to-number.c\n  test-stringbuilder.c\n  test-strings.c\n  test-symbol.c\n  test-to-integer.c\n  test-to-length.c\n  test-to-property-descriptor.c\n  test-typedarray.c\n  test-unicode.c\n  test-vm-exec-stop.c\n  test-vm-throw.c\n)\n\n# jerry_heap_stats_t.size == 0 if system allocator is used.\nif(JERRY_SYSTEM_ALLOCATOR)\n  list(REMOVE_ITEM SOURCE_UNIT_TEST_MAIN_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/test-mem-stats.c)\nendif()\n\n# Unit tests declaration\nadd_custom_target(unittests-core)\n\nforeach(SOURCE_UNIT_TEST_MAIN ${SOURCE_UNIT_TEST_MAIN_MODULES})\n  get_filename_component(TARGET_NAME ${SOURCE_UNIT_TEST_MAIN} NAME_WE)\n  set(TARGET_NAME unit-${TARGET_NAME})\n\n  add_executable(${TARGET_NAME} ${SOURCE_UNIT_TEST_MAIN})\n  target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDE_CORE_PRIVATE})\n  set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS \"${LINKER_FLAGS_COMMON}\")\n  set_property(TARGET ${TARGET_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY \"${CMAKE_BINARY_DIR}/tests\")\n  target_link_libraries(${TARGET_NAME} jerry-core jerry-port)\n\n  add_dependencies(unittests-core ${TARGET_NAME})\nendforeach()\n"
  },
  {
    "path": "tests/unit-core/test-abort.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic jerry_value_t\ncallback_func (const jerry_call_info_t *call_info_p, const jerry_value_t args_p[], const jerry_length_t args_count)\n{\n  JERRY_UNUSED (call_info_p);\n  JERRY_UNUSED (args_p);\n  JERRY_UNUSED (args_count);\n\n  jerry_value_t value = jerry_string_sz (\"Abort run!\");\n  value = jerry_throw_abort (value, true);\n  return value;\n} /* callback_func */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global = jerry_current_realm ();\n  jerry_value_t callback_name = jerry_string_sz (\"callback\");\n  jerry_value_t func = jerry_function_external (callback_func);\n  jerry_value_t res = jerry_object_set (global, callback_name, func);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n\n  jerry_value_free (res);\n  jerry_value_free (func);\n  jerry_value_free (callback_name);\n  jerry_value_free (global);\n\n  const jerry_char_t inf_loop_code_src1[] = TEST_STRING_LITERAL (\"while(true) {\\n\"\n                                                                 \"  with ({}) {\\n\"\n                                                                 \"    try {\\n\"\n                                                                 \"      callback();\\n\"\n                                                                 \"    } catch (e) {\\n\"\n                                                                 \"    } finally {\\n\"\n                                                                 \"    }\\n\"\n                                                                 \"  }\\n\"\n                                                                 \"}\");\n\n  jerry_value_t parsed_code_val = jerry_parse (inf_loop_code_src1, sizeof (inf_loop_code_src1) - 1, NULL);\n\n  TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n  res = jerry_run (parsed_code_val);\n\n  TEST_ASSERT (jerry_value_is_abort (res));\n\n  jerry_value_free (res);\n  jerry_value_free (parsed_code_val);\n\n  const jerry_char_t inf_loop_code_src2[] = TEST_STRING_LITERAL (\"function f() {\"\n                                                                 \"  while(true) {\\n\"\n                                                                 \"    with ({}) {\\n\"\n                                                                 \"      try {\\n\"\n                                                                 \"        callback();\\n\"\n                                                                 \"      } catch (e) {\\n\"\n                                                                 \"      } finally {\\n\"\n                                                                 \"      }\\n\"\n                                                                 \"    }\\n\"\n                                                                 \"  }\"\n                                                                 \"}\\n\"\n                                                                 \"function g() {\\n\"\n                                                                 \"  for (a in { x:5 })\\n\"\n                                                                 \"    f();\\n\"\n                                                                 \"}\\n\"\n                                                                 \"\\n\"\n                                                                 \"with({})\\n\"\n                                                                 \" f();\\n\");\n\n  parsed_code_val = jerry_parse (inf_loop_code_src2, sizeof (inf_loop_code_src2) - 1, NULL);\n\n  TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n  res = jerry_run (parsed_code_val);\n\n  TEST_ASSERT (jerry_value_is_abort (res));\n\n  jerry_value_free (res);\n  jerry_value_free (parsed_code_val);\n\n  /* Test flag overwrites. */\n  jerry_value_t value = jerry_string_sz (\"Error description\");\n  TEST_ASSERT (!jerry_value_is_abort (value));\n  TEST_ASSERT (!jerry_value_is_exception (value));\n\n  value = jerry_throw_abort (value, true);\n  TEST_ASSERT (jerry_value_is_abort (value));\n  TEST_ASSERT (jerry_value_is_exception (value));\n\n  value = jerry_throw_value (value, true);\n  TEST_ASSERT (!jerry_value_is_abort (value));\n  TEST_ASSERT (jerry_value_is_exception (value));\n\n  value = jerry_throw_abort (value, true);\n  TEST_ASSERT (jerry_value_is_abort (value));\n  TEST_ASSERT (jerry_value_is_exception (value));\n\n  jerry_value_free (value);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-binary-operations-arithmetics.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\n#define T(op, lhs, rhs, res) \\\n  {                          \\\n    op, lhs, rhs, res        \\\n  }\n\n#define T_NAN(op, lhs, rhs) \\\n  {                         \\\n    op, lhs, rhs            \\\n  }\n\n#define T_ERR(op, lsh, rhs) T_NAN (op, lsh, rhs)\n\n#define T_ARI(lhs, rhs)                                                                                       \\\n  T_NAN (JERRY_BIN_OP_SUB, lhs, rhs), T_NAN (JERRY_BIN_OP_MUL, lhs, rhs), T_NAN (JERRY_BIN_OP_DIV, lhs, rhs), \\\n    T_NAN (JERRY_BIN_OP_REM, lhs, rhs)\n\ntypedef struct\n{\n  jerry_binary_op_t op;\n  jerry_value_t lhs;\n  jerry_value_t rhs;\n  jerry_value_t expected;\n} test_entry_t;\n\ntypedef struct\n{\n  jerry_binary_op_t op;\n  jerry_value_t lhs;\n  jerry_value_t rhs;\n} test_nan_entry_t;\n\ntypedef test_nan_entry_t test_error_entry_t;\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t obj1 = jerry_eval ((jerry_char_t *) \"o={x:1};o\", 9, JERRY_PARSE_NO_OPTS);\n  jerry_value_t obj2 = jerry_eval ((jerry_char_t *) \"o={x:1};o\", 9, JERRY_PARSE_NO_OPTS);\n  jerry_value_t err1 = jerry_throw_sz (JERRY_ERROR_SYNTAX, \"error\");\n\n  test_nan_entry_t test_nans[] = {\n    /* Testing addition (+) */\n    T_NAN (JERRY_BIN_OP_ADD, jerry_number (3.1), jerry_undefined ()),\n    T_NAN (JERRY_BIN_OP_ADD, jerry_undefined (), jerry_undefined ()),\n    T_NAN (JERRY_BIN_OP_ADD, jerry_undefined (), jerry_null ()),\n\n    /* Testing subtraction (-), multiplication (*), division (/), remainder (%) */\n    T_ARI (jerry_number (3.1), jerry_undefined ()),\n    T_ARI (jerry_string_sz (\"foo\"), jerry_string_sz (\"bar\")),\n    T_ARI (jerry_string_sz (\"foo\"), jerry_undefined ()),\n    T_ARI (jerry_string_sz (\"foo\"), jerry_null ()),\n    T_ARI (jerry_string_sz (\"foo\"), jerry_number (5.0)),\n    T_ARI (jerry_undefined (), jerry_string_sz (\"foo\")),\n    T_ARI (jerry_null (), jerry_string_sz (\"foo\")),\n    T_ARI (jerry_number (5.0), jerry_string_sz (\"foo\")),\n    T_ARI (jerry_undefined (), jerry_undefined ()),\n    T_ARI (jerry_undefined (), jerry_null ()),\n    T_ARI (jerry_null (), jerry_undefined ()),\n    T_ARI (jerry_value_copy (obj1), jerry_value_copy (obj1)),\n    T_ARI (jerry_value_copy (obj1), jerry_value_copy (obj2)),\n    T_ARI (jerry_value_copy (obj2), jerry_value_copy (obj1)),\n    T_ARI (jerry_value_copy (obj2), jerry_undefined ()),\n    T_ARI (jerry_value_copy (obj1), jerry_string_sz (\"foo\")),\n    T_ARI (jerry_value_copy (obj1), jerry_null ()),\n    T_ARI (jerry_value_copy (obj1), jerry_boolean (true)),\n    T_ARI (jerry_value_copy (obj1), jerry_boolean (false)),\n    T_ARI (jerry_value_copy (obj1), jerry_number (5.0)),\n\n    /* Testing division (/) */\n    T_NAN (JERRY_BIN_OP_DIV, jerry_boolean (false), jerry_boolean (false)),\n    T_NAN (JERRY_BIN_OP_DIV, jerry_number (0.0), jerry_number (0.0)),\n    T_NAN (JERRY_BIN_OP_DIV, jerry_null (), jerry_null ()),\n\n    /* Testing remainder (%) */\n    T_NAN (JERRY_BIN_OP_REM, jerry_boolean (true), jerry_boolean (false)),\n    T_NAN (JERRY_BIN_OP_REM, jerry_boolean (false), jerry_boolean (false)),\n    T_NAN (JERRY_BIN_OP_REM, jerry_number (0.0), jerry_number (0.0)),\n    T_NAN (JERRY_BIN_OP_REM, jerry_null (), jerry_null ()),\n  };\n\n  for (uint32_t idx = 0; idx < sizeof (test_nans) / sizeof (test_nan_entry_t); idx++)\n  {\n    jerry_value_t result = jerry_binary_op (test_nans[idx].op, test_nans[idx].lhs, test_nans[idx].rhs);\n    TEST_ASSERT (jerry_value_is_number (result));\n\n    double num = jerry_value_as_number (result);\n\n    TEST_ASSERT (num != num);\n\n    jerry_value_free (test_nans[idx].lhs);\n    jerry_value_free (test_nans[idx].rhs);\n    jerry_value_free (result);\n  }\n\n  test_entry_t tests[] = {\n    /* Testing addition (+) */\n    T (JERRY_BIN_OP_ADD, jerry_number (5.0), jerry_number (5.0), jerry_number (10.0)),\n    T (JERRY_BIN_OP_ADD, jerry_number (3.1), jerry_number (10), jerry_number (13.1)),\n    T (JERRY_BIN_OP_ADD, jerry_number (3.1), jerry_boolean (true), jerry_number (4.1)),\n    T (JERRY_BIN_OP_ADD, jerry_string_sz (\"foo\"), jerry_string_sz (\"bar\"), jerry_string_sz (\"foobar\")),\n    T (JERRY_BIN_OP_ADD, jerry_string_sz (\"foo\"), jerry_undefined (), jerry_string_sz (\"fooundefined\")),\n    T (JERRY_BIN_OP_ADD, jerry_string_sz (\"foo\"), jerry_null (), jerry_string_sz (\"foonull\")),\n    T (JERRY_BIN_OP_ADD, jerry_string_sz (\"foo\"), jerry_number (5.0), jerry_string_sz (\"foo5\")),\n\n    T (JERRY_BIN_OP_ADD, jerry_null (), jerry_null (), jerry_number (0.0)),\n    T (JERRY_BIN_OP_ADD, jerry_boolean (true), jerry_boolean (true), jerry_number (2.0)),\n    T (JERRY_BIN_OP_ADD, jerry_boolean (true), jerry_boolean (false), jerry_number (1.0)),\n    T (JERRY_BIN_OP_ADD, jerry_boolean (false), jerry_boolean (true), jerry_number (1.0)),\n    T (JERRY_BIN_OP_ADD, jerry_boolean (false), jerry_boolean (false), jerry_number (0.0)),\n    T (JERRY_BIN_OP_ADD,\n       jerry_value_copy (obj1),\n       jerry_value_copy (obj1),\n       jerry_string_sz (\"[object Object][object Object]\")),\n    T (JERRY_BIN_OP_ADD,\n       jerry_value_copy (obj1),\n       jerry_value_copy (obj2),\n       jerry_string_sz (\"[object Object][object Object]\")),\n    T (JERRY_BIN_OP_ADD,\n       jerry_value_copy (obj2),\n       jerry_value_copy (obj1),\n       jerry_string_sz (\"[object Object][object Object]\")),\n    T (JERRY_BIN_OP_ADD, jerry_value_copy (obj1), jerry_null (), jerry_string_sz (\"[object Object]null\")),\n    T (JERRY_BIN_OP_ADD, jerry_value_copy (obj1), jerry_undefined (), jerry_string_sz (\"[object Object]undefined\")),\n    T (JERRY_BIN_OP_ADD, jerry_value_copy (obj1), jerry_boolean (true), jerry_string_sz (\"[object Object]true\")),\n    T (JERRY_BIN_OP_ADD, jerry_value_copy (obj1), jerry_boolean (false), jerry_string_sz (\"[object Object]false\")),\n    T (JERRY_BIN_OP_ADD, jerry_value_copy (obj1), jerry_number (5.0), jerry_string_sz (\"[object Object]5\")),\n    T (JERRY_BIN_OP_ADD, jerry_value_copy (obj1), jerry_string_sz (\"foo\"), jerry_string_sz (\"[object Object]foo\")),\n\n    /* Testing subtraction (-) */\n    T (JERRY_BIN_OP_SUB, jerry_number (5.0), jerry_number (5.0), jerry_number (0.0)),\n    T (JERRY_BIN_OP_SUB, jerry_number (3.1), jerry_number (10), jerry_number (-6.9)),\n    T (JERRY_BIN_OP_SUB, jerry_number (3.1), jerry_boolean (true), jerry_number (2.1)),\n    T (JERRY_BIN_OP_SUB, jerry_boolean (true), jerry_boolean (true), jerry_number (0.0)),\n    T (JERRY_BIN_OP_SUB, jerry_boolean (true), jerry_boolean (false), jerry_number (1.0)),\n    T (JERRY_BIN_OP_SUB, jerry_boolean (false), jerry_boolean (true), jerry_number (-1.0)),\n    T (JERRY_BIN_OP_SUB, jerry_boolean (false), jerry_boolean (false), jerry_number (0.0)),\n    T (JERRY_BIN_OP_SUB, jerry_null (), jerry_null (), jerry_number (-0.0)),\n\n    /* Testing multiplication (*) */\n    T (JERRY_BIN_OP_MUL, jerry_number (5.0), jerry_number (5.0), jerry_number (25.0)),\n    T (JERRY_BIN_OP_MUL, jerry_number (3.1), jerry_number (10), jerry_number (31)),\n    T (JERRY_BIN_OP_MUL, jerry_number (3.1), jerry_boolean (true), jerry_number (3.1)),\n    T (JERRY_BIN_OP_MUL, jerry_boolean (true), jerry_boolean (true), jerry_number (1.0)),\n    T (JERRY_BIN_OP_MUL, jerry_boolean (true), jerry_boolean (false), jerry_number (0.0)),\n    T (JERRY_BIN_OP_MUL, jerry_boolean (false), jerry_boolean (true), jerry_number (0.0)),\n    T (JERRY_BIN_OP_MUL, jerry_boolean (false), jerry_boolean (false), jerry_number (0.0)),\n    T (JERRY_BIN_OP_MUL, jerry_null (), jerry_null (), jerry_number (0.0)),\n\n    /* Testing division (/) */\n    T (JERRY_BIN_OP_DIV, jerry_number (5.0), jerry_number (5.0), jerry_number (1.0)),\n    T (JERRY_BIN_OP_DIV, jerry_number (3.1), jerry_number (10), jerry_number (0.31)),\n    T (JERRY_BIN_OP_DIV, jerry_number (3.1), jerry_boolean (true), jerry_number (3.1)),\n    T (JERRY_BIN_OP_DIV, jerry_boolean (true), jerry_boolean (true), jerry_number (1.0)),\n    T (JERRY_BIN_OP_DIV, jerry_boolean (true), jerry_boolean (false), jerry_infinity (false)),\n    T (JERRY_BIN_OP_DIV, jerry_boolean (false), jerry_boolean (true), jerry_number (0.0)),\n\n    /* Testing remainder (%) */\n    T (JERRY_BIN_OP_REM, jerry_number (5.0), jerry_number (5.0), jerry_number (0.0)),\n    T (JERRY_BIN_OP_REM, jerry_number (5.0), jerry_number (2.0), jerry_number (1.0)),\n    T (JERRY_BIN_OP_REM, jerry_number (3.1), jerry_number (10), jerry_number (3.1)),\n    T (JERRY_BIN_OP_REM, jerry_number (3.1), jerry_boolean (true), jerry_number (0.10000000000000009)),\n    T (JERRY_BIN_OP_REM, jerry_boolean (true), jerry_boolean (true), jerry_number (0.0)),\n    T (JERRY_BIN_OP_REM, jerry_boolean (false), jerry_boolean (true), jerry_number (0.0)),\n\n  };\n\n  for (uint32_t idx = 0; idx < sizeof (tests) / sizeof (test_entry_t); idx++)\n  {\n    jerry_value_t result = jerry_binary_op (tests[idx].op, tests[idx].lhs, tests[idx].rhs);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n\n    jerry_value_t equals = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, result, tests[idx].expected);\n    TEST_ASSERT (jerry_value_is_boolean (equals) && jerry_value_is_true (equals));\n    jerry_value_free (equals);\n\n    jerry_value_free (tests[idx].lhs);\n    jerry_value_free (tests[idx].rhs);\n    jerry_value_free (tests[idx].expected);\n    jerry_value_free (result);\n  }\n\n  jerry_value_t obj3 = jerry_eval ((jerry_char_t *) \"o={valueOf:function(){throw 5}};o\", 33, JERRY_PARSE_NO_OPTS);\n\n  test_error_entry_t error_tests[] = {\n    /* Testing addition (+) */\n    T_ERR (JERRY_BIN_OP_ADD, jerry_value_copy (err1), jerry_value_copy (err1)),\n    T_ERR (JERRY_BIN_OP_ADD, jerry_value_copy (err1), jerry_undefined ()),\n    T_ERR (JERRY_BIN_OP_ADD, jerry_undefined (), jerry_value_copy (err1)),\n\n    /* Testing subtraction (-), multiplication (*), division (/), remainder (%) */\n    T_ARI (jerry_value_copy (err1), jerry_value_copy (err1)),\n    T_ARI (jerry_value_copy (err1), jerry_undefined ()),\n    T_ARI (jerry_undefined (), jerry_value_copy (err1)),\n\n    /* Testing addition (+) */\n    T_ERR (JERRY_BIN_OP_ADD, jerry_value_copy (obj3), jerry_undefined ()),\n    T_ERR (JERRY_BIN_OP_ADD, jerry_value_copy (obj3), jerry_null ()),\n    T_ERR (JERRY_BIN_OP_ADD, jerry_value_copy (obj3), jerry_boolean (true)),\n    T_ERR (JERRY_BIN_OP_ADD, jerry_value_copy (obj3), jerry_boolean (false)),\n    T_ERR (JERRY_BIN_OP_ADD, jerry_value_copy (obj3), jerry_value_copy (obj2)),\n    T_ERR (JERRY_BIN_OP_ADD, jerry_value_copy (obj3), jerry_string_sz (\"foo\")),\n\n    /* Testing subtraction (-), multiplication (*), division (/), remainder (%) */\n    T_ARI (jerry_value_copy (obj3), jerry_undefined ()),\n    T_ARI (jerry_value_copy (obj3), jerry_null ()),\n    T_ARI (jerry_value_copy (obj3), jerry_boolean (true)),\n    T_ARI (jerry_value_copy (obj3), jerry_boolean (false)),\n    T_ARI (jerry_value_copy (obj3), jerry_value_copy (obj2)),\n    T_ARI (jerry_value_copy (obj3), jerry_string_sz (\"foo\")),\n  };\n\n  for (uint32_t idx = 0; idx < sizeof (error_tests) / sizeof (test_error_entry_t); idx++)\n  {\n    jerry_value_t result = jerry_binary_op (tests[idx].op, error_tests[idx].lhs, error_tests[idx].rhs);\n    TEST_ASSERT (jerry_value_is_exception (result));\n    jerry_value_free (error_tests[idx].lhs);\n    jerry_value_free (error_tests[idx].rhs);\n    jerry_value_free (result);\n  }\n\n  jerry_value_free (obj1);\n  jerry_value_free (obj2);\n  jerry_value_free (obj3);\n  jerry_value_free (err1);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-binary-operations-comparisons.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\n#define T(op, lhs, rhs, res) \\\n  {                          \\\n    op, lhs, rhs, res        \\\n  }\n\ntypedef struct\n{\n  jerry_binary_op_t op;\n  jerry_value_t lhs;\n  jerry_value_t rhs;\n  bool expected;\n} test_entry_t;\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t obj1 = jerry_eval ((const jerry_char_t *) \"o={x:1};o\", 9, JERRY_PARSE_NO_OPTS);\n  jerry_value_t obj2 = jerry_eval ((const jerry_char_t *) \"o={x:1};o\", 9, JERRY_PARSE_NO_OPTS);\n  jerry_value_t err1 = jerry_throw_sz (JERRY_ERROR_SYNTAX, \"error\");\n\n  test_entry_t tests[] = {\n    /* Testing strict equal comparison */\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_number (5.0), jerry_number (5.0), true),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_number (3.1), jerry_number (10), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_number (3.1), jerry_undefined (), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_number (3.1), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_string_sz (\"example string\"), jerry_string_sz (\"example string\"), true),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_string_sz (\"example string\"), jerry_undefined (), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_string_sz (\"example string\"), jerry_null (), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_string_sz (\"example string\"), jerry_number (5.0), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_undefined (), jerry_undefined (), true),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_undefined (), jerry_null (), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_null (), jerry_null (), true),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_boolean (true), jerry_boolean (true), true),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_boolean (true), jerry_boolean (false), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_boolean (false), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_boolean (false), jerry_boolean (false), true),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_value_copy (obj1), jerry_value_copy (obj1), true),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_value_copy (obj1), jerry_value_copy (obj2), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_value_copy (obj2), jerry_value_copy (obj1), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_value_copy (obj1), jerry_null (), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_value_copy (obj1), jerry_undefined (), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_value_copy (obj1), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_value_copy (obj1), jerry_boolean (false), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_value_copy (obj1), jerry_number (5.0), false),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_value_copy (obj1), jerry_string_sz (\"example string\"), false),\n\n    /* Testing equal comparison */\n    T (JERRY_BIN_OP_EQUAL, jerry_number (5.0), jerry_number (5.0), true),\n    T (JERRY_BIN_OP_EQUAL, jerry_number (3.1), jerry_number (10), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_number (3.1), jerry_undefined (), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_number (3.1), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_string_sz (\"example string\"), jerry_string_sz (\"example string\"), true),\n    T (JERRY_BIN_OP_EQUAL, jerry_string_sz (\"example string\"), jerry_undefined (), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_string_sz (\"example string\"), jerry_null (), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_string_sz (\"example string\"), jerry_number (5.0), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_undefined (), jerry_undefined (), true),\n    T (JERRY_BIN_OP_EQUAL, jerry_undefined (), jerry_null (), true),\n    T (JERRY_BIN_OP_EQUAL, jerry_null (), jerry_null (), true),\n    T (JERRY_BIN_OP_EQUAL, jerry_boolean (true), jerry_boolean (true), true),\n    T (JERRY_BIN_OP_EQUAL, jerry_boolean (true), jerry_boolean (false), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_boolean (false), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_boolean (false), jerry_boolean (false), true),\n    T (JERRY_BIN_OP_EQUAL, jerry_value_copy (obj1), jerry_value_copy (obj1), true),\n    T (JERRY_BIN_OP_EQUAL, jerry_value_copy (obj1), jerry_value_copy (obj2), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_value_copy (obj2), jerry_value_copy (obj1), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_value_copy (obj1), jerry_null (), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_value_copy (obj1), jerry_undefined (), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_value_copy (obj1), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_value_copy (obj1), jerry_boolean (false), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_value_copy (obj1), jerry_number (5.0), false),\n    T (JERRY_BIN_OP_EQUAL, jerry_value_copy (obj1), jerry_string_sz (\"example string\"), false),\n\n    /* Testing less comparison */\n    T (JERRY_BIN_OP_LESS, jerry_number (5.0), jerry_number (5.0), false),\n    T (JERRY_BIN_OP_LESS, jerry_number (3.1), jerry_number (10), true),\n    T (JERRY_BIN_OP_LESS, jerry_number (3.1), jerry_undefined (), false),\n    T (JERRY_BIN_OP_LESS, jerry_number (3.1), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_LESS, jerry_string_sz (\"1\"), jerry_string_sz (\"2\"), true),\n    T (JERRY_BIN_OP_LESS, jerry_string_sz (\"1\"), jerry_undefined (), false),\n    T (JERRY_BIN_OP_LESS, jerry_string_sz (\"1\"), jerry_null (), false),\n    T (JERRY_BIN_OP_LESS, jerry_string_sz (\"1\"), jerry_number (5.0), true),\n    T (JERRY_BIN_OP_LESS, jerry_undefined (), jerry_undefined (), false),\n    T (JERRY_BIN_OP_LESS, jerry_undefined (), jerry_null (), false),\n    T (JERRY_BIN_OP_LESS, jerry_null (), jerry_null (), false),\n    T (JERRY_BIN_OP_LESS, jerry_boolean (true), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_LESS, jerry_boolean (true), jerry_boolean (false), false),\n    T (JERRY_BIN_OP_LESS, jerry_boolean (false), jerry_boolean (true), true),\n    T (JERRY_BIN_OP_LESS, jerry_boolean (false), jerry_boolean (false), false),\n\n    /* Testing less or equal comparison */\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_number (5.0), jerry_number (5.0), true),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_number (5.1), jerry_number (5.0), false),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_number (3.1), jerry_number (10), true),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_number (3.1), jerry_undefined (), false),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_number (3.1), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_string_sz (\"1\"), jerry_string_sz (\"2\"), true),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_string_sz (\"1\"), jerry_string_sz (\"1\"), true),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_string_sz (\"1\"), jerry_undefined (), false),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_string_sz (\"1\"), jerry_null (), false),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_string_sz (\"1\"), jerry_number (5.0), true),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_string_sz (\"5.0\"), jerry_number (5.0), true),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_undefined (), jerry_undefined (), false),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_undefined (), jerry_null (), false),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_null (), jerry_null (), true),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_boolean (true), jerry_boolean (true), true),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_boolean (true), jerry_boolean (false), false),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_boolean (false), jerry_boolean (true), true),\n    T (JERRY_BIN_OP_LESS_EQUAL, jerry_boolean (false), jerry_boolean (false), true),\n\n    /* Testing greater comparison */\n    T (JERRY_BIN_OP_GREATER, jerry_number (5.0), jerry_number (5.0), false),\n    T (JERRY_BIN_OP_GREATER, jerry_number (10), jerry_number (3.1), true),\n    T (JERRY_BIN_OP_GREATER, jerry_number (3.1), jerry_undefined (), false),\n    T (JERRY_BIN_OP_GREATER, jerry_number (3.1), jerry_boolean (true), true),\n    T (JERRY_BIN_OP_GREATER, jerry_string_sz (\"2\"), jerry_string_sz (\"1\"), true),\n    T (JERRY_BIN_OP_GREATER, jerry_string_sz (\"1\"), jerry_string_sz (\"2\"), false),\n    T (JERRY_BIN_OP_GREATER, jerry_string_sz (\"1\"), jerry_undefined (), false),\n    T (JERRY_BIN_OP_GREATER, jerry_string_sz (\"1\"), jerry_null (), true),\n    T (JERRY_BIN_OP_GREATER, jerry_number (5.0), jerry_string_sz (\"1\"), true),\n    T (JERRY_BIN_OP_GREATER, jerry_undefined (), jerry_undefined (), false),\n    T (JERRY_BIN_OP_GREATER, jerry_undefined (), jerry_null (), false),\n    T (JERRY_BIN_OP_GREATER, jerry_null (), jerry_null (), false),\n    T (JERRY_BIN_OP_GREATER, jerry_boolean (true), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_GREATER, jerry_boolean (true), jerry_boolean (false), true),\n    T (JERRY_BIN_OP_GREATER, jerry_boolean (false), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_GREATER, jerry_boolean (false), jerry_boolean (false), false),\n\n    /* Testing greater or equal comparison */\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_number (5.0), jerry_number (5.0), true),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_number (5.0), jerry_number (5.1), false),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_number (10), jerry_number (3.1), true),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_number (3.1), jerry_undefined (), false),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_number (3.1), jerry_boolean (true), true),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_string_sz (\"2\"), jerry_string_sz (\"1\"), true),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_string_sz (\"1\"), jerry_string_sz (\"1\"), true),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_string_sz (\"1\"), jerry_undefined (), false),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_string_sz (\"1\"), jerry_null (), true),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_number (5.0), jerry_string_sz (\"1\"), true),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_string_sz (\"5.0\"), jerry_number (5.0), true),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_undefined (), jerry_undefined (), false),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_undefined (), jerry_null (), false),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_null (), jerry_null (), true),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_boolean (true), jerry_boolean (true), true),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_boolean (true), jerry_boolean (false), true),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_boolean (false), jerry_boolean (true), false),\n    T (JERRY_BIN_OP_GREATER_EQUAL, jerry_boolean (false), jerry_boolean (false), true),\n  };\n\n  for (uint32_t idx = 0; idx < sizeof (tests) / sizeof (test_entry_t); idx++)\n  {\n    jerry_value_t result = jerry_binary_op (tests[idx].op, tests[idx].lhs, tests[idx].rhs);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n    TEST_ASSERT (jerry_value_is_true (result) == tests[idx].expected);\n    jerry_value_free (tests[idx].lhs);\n    jerry_value_free (tests[idx].rhs);\n    jerry_value_free (result);\n  }\n\n  test_entry_t error_tests[] = {\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_value_copy (err1), jerry_value_copy (err1), true),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_value_copy (err1), jerry_undefined (), true),\n    T (JERRY_BIN_OP_STRICT_EQUAL, jerry_undefined (), jerry_value_copy (err1), true),\n  };\n\n  for (uint32_t idx = 0; idx < sizeof (error_tests) / sizeof (test_entry_t); idx++)\n  {\n    jerry_value_t result = jerry_binary_op (tests[idx].op, error_tests[idx].lhs, error_tests[idx].rhs);\n    TEST_ASSERT (jerry_value_is_exception (result) == error_tests[idx].expected);\n    jerry_value_free (error_tests[idx].lhs);\n    jerry_value_free (error_tests[idx].rhs);\n    jerry_value_free (result);\n  }\n\n  jerry_value_free (obj1);\n  jerry_value_free (obj2);\n  jerry_value_free (err1);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-binary-operations-instanceof.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\n#define T(lhs, rhs, res) \\\n  {                      \\\n    lhs, rhs, res        \\\n  }\n\ntypedef struct\n{\n  jerry_value_t lhs;\n  jerry_value_t rhs;\n  bool expected;\n} test_entry_t;\n\nstatic jerry_value_t\nmy_constructor (const jerry_call_info_t *call_info_p, /**< call information */\n                const jerry_value_t argv[], /**< arguments */\n                const jerry_length_t argc) /**< number of arguments */\n{\n  (void) call_info_p;\n  (void) argv;\n  (void) argc;\n  return jerry_undefined ();\n} /* my_constructor */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t base_obj = jerry_object ();\n  jerry_value_t constructor = jerry_function_external (my_constructor);\n\n  jerry_value_t no_proto_instance_val = jerry_construct (constructor, NULL, 0);\n\n  jerry_value_t prototype_str = jerry_string_sz (\"prototype\");\n  jerry_value_t res = jerry_object_set (constructor, prototype_str, base_obj);\n  jerry_value_free (prototype_str);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  jerry_value_free (res);\n\n  jerry_value_t instance_val = jerry_construct (constructor, NULL, 0);\n\n  jerry_value_t error = jerry_throw_value (base_obj, false);\n\n  test_entry_t bool_tests[] = { T (jerry_value_copy (instance_val), jerry_value_copy (constructor), true),\n                                T (jerry_value_copy (no_proto_instance_val), jerry_value_copy (constructor), false),\n                                T (jerry_value_copy (base_obj), jerry_value_copy (constructor), false) };\n\n  for (uint32_t idx = 0; idx < sizeof (bool_tests) / sizeof (test_entry_t); idx++)\n  {\n    jerry_value_t result = jerry_binary_op (JERRY_BIN_OP_INSTANCEOF, bool_tests[idx].lhs, bool_tests[idx].rhs);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n    TEST_ASSERT (jerry_value_is_true (result) == bool_tests[idx].expected);\n    jerry_value_free (bool_tests[idx].lhs);\n    jerry_value_free (bool_tests[idx].rhs);\n    jerry_value_free (result);\n  }\n\n  test_entry_t error_tests[] = { T (jerry_value_copy (constructor), jerry_value_copy (instance_val), true),\n                                 T (jerry_undefined (), jerry_value_copy (constructor), true),\n                                 T (jerry_value_copy (instance_val), jerry_undefined (), true),\n                                 T (jerry_value_copy (instance_val), jerry_value_copy (base_obj), true),\n                                 T (jerry_value_copy (error), jerry_value_copy (constructor), true),\n                                 T (jerry_value_copy (instance_val), jerry_value_copy (error), true),\n                                 T (jerry_string_sz (\"\"), jerry_string_sz (\"\"), true),\n                                 T (jerry_string_sz (\"\"), jerry_number (5.0), true),\n                                 T (jerry_number (5.0), jerry_string_sz (\"\"), true),\n                                 T (jerry_array (1), jerry_array (1), true),\n                                 T (jerry_array (1), jerry_object (), true),\n                                 T (jerry_object (), jerry_array (1), true),\n                                 T (jerry_null (), jerry_object (), true),\n                                 T (jerry_object (), jerry_string_sz (\"\"), true) };\n\n  for (uint32_t idx = 0; idx < sizeof (error_tests) / sizeof (test_entry_t); idx++)\n  {\n    jerry_value_t result = jerry_binary_op (JERRY_BIN_OP_INSTANCEOF, error_tests[idx].lhs, error_tests[idx].rhs);\n    TEST_ASSERT (jerry_value_is_exception (result) == error_tests[idx].expected);\n    jerry_value_free (error_tests[idx].lhs);\n    jerry_value_free (error_tests[idx].rhs);\n    jerry_value_free (result);\n  }\n\n  jerry_value_free (base_obj);\n  jerry_value_free (constructor);\n  jerry_value_free (error);\n  jerry_value_free (instance_val);\n  jerry_value_free (no_proto_instance_val);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-errortype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_error_t errors[] = { JERRY_ERROR_COMMON, JERRY_ERROR_EVAL, JERRY_ERROR_RANGE, JERRY_ERROR_REFERENCE,\n                             JERRY_ERROR_SYNTAX, JERRY_ERROR_TYPE, JERRY_ERROR_URI };\n\n  for (size_t idx = 0; idx < sizeof (errors) / sizeof (errors[0]); idx++)\n  {\n    jerry_value_t error_obj = jerry_throw_sz (errors[idx], \"test\");\n    TEST_ASSERT (jerry_value_is_exception (error_obj));\n    TEST_ASSERT (jerry_error_type (error_obj) == errors[idx]);\n\n    error_obj = jerry_exception_value (error_obj, true);\n\n    TEST_ASSERT (jerry_error_type (error_obj) == errors[idx]);\n\n    jerry_value_free (error_obj);\n  }\n\n  jerry_value_t test_values[] = {\n    jerry_number (11),\n    jerry_string_sz (\"message\"),\n    jerry_boolean (true),\n    jerry_object (),\n  };\n\n  for (size_t idx = 0; idx < sizeof (test_values) / sizeof (test_values[0]); idx++)\n  {\n    jerry_error_t error_type = jerry_error_type (test_values[idx]);\n    TEST_ASSERT (error_type == JERRY_ERROR_NONE);\n    jerry_value_free (test_values[idx]);\n  }\n\n  char test_source[] = \"\\xF0\\x9D\\x84\\x9E\";\n\n  jerry_value_t result = jerry_parse ((const jerry_char_t *) test_source, sizeof (test_source) - 1, NULL);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  TEST_ASSERT (jerry_error_type (result) == JERRY_ERROR_SYNTAX);\n\n  jerry_value_free (result);\n\n  char test_invalid_error[] = \"Object.create(Error.prototype)\";\n  result = jerry_eval ((const jerry_char_t *) test_invalid_error, sizeof (test_invalid_error) - 1, JERRY_PARSE_NO_OPTS);\n  TEST_ASSERT (!jerry_value_is_exception (result) && jerry_value_is_object (result));\n  TEST_ASSERT (jerry_error_type (result) == JERRY_ERROR_NONE);\n\n  jerry_value_free (result);\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-functiontype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\ntypedef struct\n{\n  jerry_function_type_t type_info;\n  jerry_value_t value;\n  bool active;\n  bool is_async;\n} test_entry_t;\n\n#define ENTRY(TYPE, VALUE)   \\\n  {                          \\\n    TYPE, VALUE, true, false \\\n  }\n#define ENTRY_IF(TYPE, VALUE, FEATURE, ASYNC)           \\\n  {                                                     \\\n    TYPE, VALUE, jerry_feature_enabled (FEATURE), ASYNC \\\n  }\n#define EVALUATE(BUFF) (jerry_eval ((BUFF), sizeof ((BUFF)) - 1, JERRY_PARSE_NO_OPTS))\nstatic jerry_value_t\ntest_ext_function (const jerry_call_info_t *call_info_p, /**< call information */\n                   const jerry_value_t args_p[], /**< array of arguments */\n                   const jerry_length_t args_cnt) /**< number of arguments */\n{\n  (void) call_info_p;\n  (void) args_p;\n  (void) args_cnt;\n  return jerry_boolean (true);\n} /* test_ext_function */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t arrow_function[] = \"_ => 5\";\n  const jerry_char_t async_arrow_function[] = \"async _ => 5\";\n  const jerry_char_t generator_function[] = \"function *f() {}; f\";\n  const jerry_char_t async_generator_function[] = \"async function *f() {}; f\";\n  const jerry_char_t getter_function[] = \"Object.getOwnPropertyDescriptor({get a(){}}, 'a').get\";\n  const jerry_char_t setter_function[] = \"Object.getOwnPropertyDescriptor({set a(b){}}, 'a').set\";\n  const jerry_char_t method_function[] = \"Object.getOwnPropertyDescriptor({a(){}}, 'a').value\";\n\n  const jerry_char_t builtin_function[] = \"Object\";\n  const jerry_char_t simple_function[] = \"function f() {}; f\";\n  const jerry_char_t bound_function[] = \"function f() {}; f.bind(1,2)\";\n\n  test_entry_t entries[] = {\n    ENTRY (JERRY_FUNCTION_TYPE_NONE, jerry_number (-33.0)),\n    ENTRY (JERRY_FUNCTION_TYPE_NONE, jerry_boolean (true)),\n    ENTRY (JERRY_FUNCTION_TYPE_NONE, jerry_undefined ()),\n    ENTRY (JERRY_FUNCTION_TYPE_NONE, jerry_null ()),\n    ENTRY (JERRY_FUNCTION_TYPE_NONE, jerry_string_sz (\"foo\")),\n    ENTRY (JERRY_FUNCTION_TYPE_NONE, jerry_throw_sz (JERRY_ERROR_TYPE, \"error\")),\n\n    ENTRY (JERRY_FUNCTION_TYPE_NONE, jerry_object ()),\n    ENTRY (JERRY_FUNCTION_TYPE_NONE, jerry_array (10)),\n\n    ENTRY_IF (JERRY_FUNCTION_TYPE_ARROW, EVALUATE (arrow_function), JERRY_FEATURE_SYMBOL, false),\n    ENTRY_IF (JERRY_FUNCTION_TYPE_ARROW, EVALUATE (async_arrow_function), JERRY_FEATURE_SYMBOL, true),\n    ENTRY_IF (JERRY_FUNCTION_TYPE_GENERATOR, EVALUATE (generator_function), JERRY_FEATURE_SYMBOL, false),\n    ENTRY_IF (JERRY_FUNCTION_TYPE_GENERATOR, EVALUATE (async_generator_function), JERRY_FEATURE_SYMBOL, true),\n    ENTRY_IF (JERRY_FUNCTION_TYPE_GENERIC, EVALUATE (method_function), JERRY_FEATURE_SYMBOL, false),\n    ENTRY (JERRY_FUNCTION_TYPE_GENERIC, EVALUATE (builtin_function)),\n    ENTRY (JERRY_FUNCTION_TYPE_GENERIC, EVALUATE (simple_function)),\n    ENTRY (JERRY_FUNCTION_TYPE_BOUND, EVALUATE (bound_function)),\n    ENTRY (JERRY_FUNCTION_TYPE_GENERIC, jerry_function_external (test_ext_function)),\n    ENTRY (JERRY_FUNCTION_TYPE_ACCESSOR, EVALUATE (getter_function)),\n    ENTRY (JERRY_FUNCTION_TYPE_ACCESSOR, EVALUATE (setter_function)),\n  };\n\n  for (size_t idx = 0; idx < sizeof (entries) / sizeof (entries[0]); idx++)\n  {\n    jerry_function_type_t type_info = jerry_function_type (entries[idx].value);\n    TEST_ASSERT (!entries[idx].active\n                 || (type_info == entries[idx].type_info\n                     && jerry_value_is_async_function (entries[idx].value) == entries[idx].is_async));\n    jerry_value_free (entries[idx].value);\n  }\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-iteratortype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\ntypedef struct\n{\n  jerry_iterator_type_t type_info;\n  jerry_value_t value;\n  bool active;\n} test_entry_t;\n\n#define ENTRY(TYPE, VALUE) \\\n  {                        \\\n    TYPE, VALUE, true      \\\n  }\n#define ENTRY_IF(TYPE, VALUE, FEATURE)           \\\n  {                                              \\\n    TYPE, VALUE, jerry_feature_enabled (FEATURE) \\\n  }\n#define EVALUATE(BUFF) (jerry_eval ((BUFF), sizeof ((BUFF)) - 1, JERRY_PARSE_NO_OPTS))\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t array_iterator_keys[] = \"[1, 2, 3].keys()\";\n  const jerry_char_t array_iterator_values[] = \"[1, 2, 3].values()\";\n  const jerry_char_t array_iterator_entries[] = \"[1, 2, 3].entries()\";\n  const jerry_char_t array_iterator_symbol_iterator[] = \"([1, 2, 3])[Symbol.iterator]()\";\n\n  const jerry_char_t typedarray_iterator_keys[] = \"new Uint8Array([1, 2, 3]).keys()\";\n  const jerry_char_t typedarray_iterator_values[] = \"new Uint8Array([1, 2, 3]).values()\";\n  const jerry_char_t typedarray_iterator_entries[] = \"new Uint8Array([1, 2, 3]).entries()\";\n  const jerry_char_t typedarray_iterator_symbol_iterator[] = \"new Uint8Array([1, 2, 3])[Symbol.iterator]()\";\n\n  const jerry_char_t string_symbol_iterator[] = \"('foo')[Symbol.iterator]()\";\n\n  const jerry_char_t map_iterator_keys[] = \"new Map([1, 2, 3].entries()).keys()\";\n  const jerry_char_t map_iterator_values[] = \"new Map([1, 2, 3].entries()).values()\";\n  const jerry_char_t map_iterator_entries[] = \"new Map([1, 2, 3].entries()).entries()\";\n  const jerry_char_t map_iterator_symbol_iterator[] = \"new Map([1, 2, 3].entries())[Symbol.iterator]()\";\n\n  const jerry_char_t set_iterator_keys[] = \"new Set([1, 2, 3]).keys()\";\n  const jerry_char_t set_iterator_values[] = \"new Set([1, 2, 3]).values()\";\n  const jerry_char_t set_iterator_entries[] = \"new Set([1, 2, 3]).entries()\";\n  const jerry_char_t set_iterator_symbol_iterator[] = \"new Set([1, 2, 3])[Symbol.iterator]()\";\n\n  test_entry_t entries[] = {\n    ENTRY (JERRY_ITERATOR_TYPE_NONE, jerry_number (-33.0)),\n    ENTRY (JERRY_ITERATOR_TYPE_NONE, jerry_boolean (true)),\n    ENTRY (JERRY_ITERATOR_TYPE_NONE, jerry_undefined ()),\n    ENTRY (JERRY_ITERATOR_TYPE_NONE, jerry_null ()),\n    ENTRY (JERRY_ITERATOR_TYPE_NONE, jerry_string_sz (\"foo\")),\n    ENTRY (JERRY_ITERATOR_TYPE_NONE, jerry_throw_sz (JERRY_ERROR_TYPE, \"error\")),\n\n    ENTRY (JERRY_ITERATOR_TYPE_NONE, jerry_object ()),\n    ENTRY (JERRY_ITERATOR_TYPE_NONE, jerry_array (10)),\n\n    ENTRY_IF (JERRY_ITERATOR_TYPE_ARRAY, EVALUATE (array_iterator_keys), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_ARRAY, EVALUATE (array_iterator_values), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_ARRAY, EVALUATE (array_iterator_entries), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_ARRAY, EVALUATE (array_iterator_symbol_iterator), JERRY_FEATURE_SYMBOL),\n\n    ENTRY_IF (JERRY_ITERATOR_TYPE_ARRAY, EVALUATE (typedarray_iterator_keys), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_ARRAY, EVALUATE (typedarray_iterator_values), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_ARRAY, EVALUATE (typedarray_iterator_entries), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_ARRAY, EVALUATE (typedarray_iterator_symbol_iterator), JERRY_FEATURE_SYMBOL),\n\n    ENTRY_IF (JERRY_ITERATOR_TYPE_STRING, EVALUATE (string_symbol_iterator), JERRY_FEATURE_SYMBOL),\n\n    ENTRY_IF (JERRY_ITERATOR_TYPE_MAP, EVALUATE (map_iterator_keys), JERRY_FEATURE_MAP),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_MAP, EVALUATE (map_iterator_values), JERRY_FEATURE_MAP),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_MAP, EVALUATE (map_iterator_entries), JERRY_FEATURE_MAP),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_MAP, EVALUATE (map_iterator_symbol_iterator), JERRY_FEATURE_MAP),\n\n    ENTRY_IF (JERRY_ITERATOR_TYPE_SET, EVALUATE (set_iterator_keys), JERRY_FEATURE_SET),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_SET, EVALUATE (set_iterator_values), JERRY_FEATURE_SET),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_SET, EVALUATE (set_iterator_entries), JERRY_FEATURE_SET),\n    ENTRY_IF (JERRY_ITERATOR_TYPE_SET, EVALUATE (set_iterator_symbol_iterator), JERRY_FEATURE_SET),\n  };\n\n  for (size_t idx = 0; idx < sizeof (entries) / sizeof (entries[0]); idx++)\n  {\n    jerry_iterator_type_t type_info = jerry_iterator_type (entries[idx].value);\n    TEST_ASSERT (!entries[idx].active || type_info == entries[idx].type_info);\n    jerry_value_free (entries[idx].value);\n  }\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-object-property-names.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic const char *prop_names[] = { \"val1\", \"val2\", \"val3\", \"val4\", \"val5\", \"37\", \"symbol\" };\n\nstatic jerry_char_t buffer[256] = { 0 };\n\nstatic void\ncreate_and_set_property (const jerry_value_t object, const char *prop_name)\n{\n  jerry_value_t jprop_name = jerry_string_sz (prop_name);\n  jerry_value_t ret_val = jerry_object_set (object, jprop_name, jerry_undefined ());\n\n  jerry_value_free (jprop_name);\n  jerry_value_free (ret_val);\n} /* create_and_set_property */\n\nstatic void\ncompare_prop_name (const jerry_value_t object, const char *prop_name, uint32_t idx)\n{\n  jerry_value_t name = jerry_object_get_index (object, idx);\n  TEST_ASSERT (jerry_value_is_string (name) || jerry_value_is_number (name));\n  if (jerry_value_is_string (name))\n  {\n    jerry_size_t name_size = jerry_string_size (name, JERRY_ENCODING_CESU8);\n    TEST_ASSERT (name_size < sizeof (buffer));\n    jerry_size_t ret_size = jerry_string_to_buffer (name, JERRY_ENCODING_CESU8, buffer, sizeof (buffer));\n    TEST_ASSERT (name_size == ret_size);\n    buffer[name_size] = '\\0';\n    TEST_ASSERT (strcmp ((const char *) buffer, prop_name) == 0);\n  }\n  else\n  {\n    TEST_ASSERT ((int) jerry_value_as_number (name) == atoi (prop_name));\n  }\n\n  jerry_value_free (name);\n} /* compare_prop_name */\n\nstatic void\ndefine_property (const jerry_value_t object,\n                 const char *prop_name,\n                 jerry_property_descriptor_t *prop_desc_p,\n                 bool is_symbol)\n{\n  jerry_value_t jname = jerry_string_sz (prop_name);\n  jerry_value_t ret_val;\n  if (is_symbol)\n  {\n    jerry_value_t symbol = jerry_symbol_with_description (jname);\n    ret_val = jerry_object_define_own_prop (object, symbol, prop_desc_p);\n    jerry_value_free (symbol);\n  }\n  else\n  {\n    ret_val = jerry_object_define_own_prop (object, jname, prop_desc_p);\n  }\n\n  jerry_value_free (jname);\n  jerry_value_free (ret_val);\n} /* define_property */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t error_value = jerry_object_property_names (jerry_undefined (), JERRY_PROPERTY_FILTER_ALL);\n  TEST_ASSERT (jerry_value_is_exception (error_value) && jerry_error_type (error_value) == JERRY_ERROR_TYPE);\n  jerry_value_free (error_value);\n\n  jerry_value_t test_object = jerry_object ();\n  create_and_set_property (test_object, prop_names[0]);\n  create_and_set_property (test_object, prop_names[1]);\n\n  jerry_value_t names;\n\n  jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n  prop_desc.flags |= (JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_WRITABLE_DEFINED\n                      | JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_ENUMERABLE_DEFINED);\n\n  // Test enumerable - non-enumerable filter\n  define_property (test_object, prop_names[2], &prop_desc, false);\n  names =\n    jerry_object_property_names (test_object, JERRY_PROPERTY_FILTER_ALL | JERRY_PROPERTY_FILTER_EXCLUDE_NON_ENUMERABLE);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 2);\n  jerry_value_free (names);\n  names = jerry_object_property_names (test_object, JERRY_PROPERTY_FILTER_ALL);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 3);\n  compare_prop_name (names, prop_names[2], 2);\n  jerry_value_free (names);\n  prop_desc.flags |= JERRY_PROP_IS_ENUMERABLE;\n\n  // Test configurable - non-configurable filter\n  prop_desc.flags &= (uint16_t) ~JERRY_PROP_IS_CONFIGURABLE;\n  define_property (test_object, prop_names[3], &prop_desc, false);\n  names = jerry_object_property_names (test_object,\n                                       JERRY_PROPERTY_FILTER_ALL | JERRY_PROPERTY_FILTER_EXCLUDE_NON_CONFIGURABLE);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 3);\n  jerry_value_free (names);\n  names = jerry_object_property_names (test_object, JERRY_PROPERTY_FILTER_ALL);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 4);\n  compare_prop_name (names, prop_names[3], 3);\n  jerry_value_free (names);\n  prop_desc.flags |= JERRY_PROP_IS_CONFIGURABLE;\n\n  // Test writable - non-writable filter\n  prop_desc.flags &= (uint16_t) ~JERRY_PROP_IS_WRITABLE;\n  define_property (test_object, prop_names[4], &prop_desc, false);\n  names =\n    jerry_object_property_names (test_object, JERRY_PROPERTY_FILTER_ALL | JERRY_PROPERTY_FILTER_EXCLUDE_NON_WRITABLE);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 4);\n  jerry_value_free (names);\n  names = jerry_object_property_names (test_object, JERRY_PROPERTY_FILTER_ALL);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 5);\n  compare_prop_name (names, prop_names[4], 4);\n  jerry_value_free (names);\n  prop_desc.flags |= JERRY_PROP_IS_WRITABLE;\n\n  // Test all property filter\n  names = jerry_object_property_names (test_object, JERRY_PROPERTY_FILTER_ALL);\n  jerry_length_t array_len = jerry_array_length (names);\n  TEST_ASSERT (array_len == (uint32_t) 5);\n\n  for (uint32_t i = 0; i < array_len; i++)\n  {\n    compare_prop_name (names, prop_names[i], i);\n  }\n\n  jerry_value_free (names);\n\n  // Test number and string index exclusion\n  define_property (test_object, prop_names[5], &prop_desc, false);\n  names = jerry_object_property_names (test_object,\n                                       JERRY_PROPERTY_FILTER_ALL | JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS\n                                         | JERRY_PROPERTY_FILTER_INTEGER_INDICES_AS_NUMBER);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 1);\n  compare_prop_name (names, prop_names[5], 0);\n  jerry_value_free (names);\n  names = jerry_object_property_names (test_object,\n                                       JERRY_PROPERTY_FILTER_ALL | JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 5);\n  jerry_value_free (names);\n\n  // Test prototype chain traversion\n  names = jerry_object_property_names (test_object, JERRY_PROPERTY_FILTER_ALL);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 6);\n  jerry_value_free (names);\n  names = jerry_object_property_names (test_object,\n                                       JERRY_PROPERTY_FILTER_ALL | JERRY_PROPERTY_FILTER_TRAVERSE_PROTOTYPE_CHAIN);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 18);\n  jerry_value_free (names);\n\n  // Test symbol exclusion\n  define_property (test_object, prop_names[6], &prop_desc, true);\n  names = jerry_object_property_names (test_object, JERRY_PROPERTY_FILTER_ALL | JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 6);\n  jerry_value_free (names);\n  names = jerry_object_property_names (test_object, JERRY_PROPERTY_FILTER_ALL);\n  TEST_ASSERT (jerry_array_length (names) == (uint32_t) 7);\n  jerry_value_free (names);\n\n  jerry_property_descriptor_free (&prop_desc);\n  jerry_value_free (test_object);\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-objecttype.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\ntypedef struct\n{\n  jerry_object_type_t type_info;\n  jerry_value_t value;\n  bool active;\n} test_entry_t;\n\n#define ENTRY(TYPE, VALUE) \\\n  {                        \\\n    TYPE, VALUE, true      \\\n  }\n#define ENTRY_IF(TYPE, VALUE, FEATURE)           \\\n  {                                              \\\n    TYPE, VALUE, jerry_feature_enabled (FEATURE) \\\n  }\n#define EVALUATE(BUFF) (jerry_eval ((BUFF), sizeof ((BUFF)) - 1, JERRY_PARSE_NO_OPTS))\n#define PARSE(OPTS)    (jerry_parse ((const jerry_char_t *) \"\", 0, (OPTS)))\nstatic jerry_value_t\ntest_ext_function (const jerry_call_info_t *call_info_p, /**< call information */\n                   const jerry_value_t args_p[], /**< array of arguments */\n                   const jerry_length_t args_cnt) /**< number of arguments */\n{\n  (void) call_info_p;\n  (void) args_p;\n  (void) args_cnt;\n  return jerry_boolean (true);\n} /* test_ext_function */\n\nstatic jerry_object_type_t\ntest_namespace (const jerry_parse_options_t module_parse_options) /** module options */\n{\n  jerry_value_t module = jerry_parse ((const jerry_char_t *) \"\", 0, &module_parse_options);\n  jerry_value_t module_linked = jerry_module_link (module, NULL, NULL);\n  jerry_object_type_t namespace = jerry_module_namespace (module);\n  jerry_value_free (module_linked);\n  jerry_value_free (module);\n  return namespace;\n} /* test_namespace */\n\nstatic jerry_value_t\ntest_dataview (void)\n{\n  jerry_value_t arraybuffer = jerry_arraybuffer (10);\n  jerry_value_t dataview = jerry_dataview (arraybuffer, 0, 4);\n\n  jerry_value_free (arraybuffer);\n\n  return dataview;\n} /* test_dataview */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const jerry_char_t proxy_object[] = \"new Proxy({}, {})\";\n  const jerry_char_t typedarray_object[] = \"new Uint8Array()\";\n  const jerry_char_t container_object[] = \"new Map()\";\n  const jerry_char_t iterator_object[] = \"[1, 2, 3].values()\";\n  const jerry_char_t arrow_function[] = \"_ => 5\";\n  const jerry_char_t async_arrow_function[] = \"async _ => 5\";\n  const jerry_char_t generator_function[] = \"function *f() {}; f\";\n  const jerry_char_t async_generator_function[] = \"async function *f() {}; f\";\n  const jerry_char_t getter_function[] = \"Object.getOwnPropertyDescriptor({get a(){}}, 'a').get\";\n  const jerry_char_t setter_function[] = \"Object.getOwnPropertyDescriptor({set a(b){}}, 'a').set\";\n  const jerry_char_t method_function[] = \"Object.getOwnPropertyDescriptor({a(){}}, 'a').value\";\n\n  const jerry_char_t symbol_object[] = \"new Object(Symbol('foo'))\";\n  const jerry_char_t generator_object[] = \"function *f() { yield 5 }; f()\";\n  const jerry_char_t bigint_object[] = \"Object(5n)\";\n\n  const jerry_char_t builtin_function[] = \"Object\";\n  const jerry_char_t simple_function[] = \"function f() {}; f\";\n  const jerry_char_t bound_function[] = \"function f() {}; f.bind(1,2)\";\n  const jerry_char_t mapped_arguments[] = \"function f(a, b) { return arguments; }; f()\";\n  const jerry_char_t unmapped_arguments[] = \"function f(a, b) {'use strict'; return arguments; }; f()\";\n  const jerry_char_t boolean_object[] = \"new Boolean(true)\";\n  const jerry_char_t date_object[] = \"new Date()\";\n  const jerry_char_t number_object[] = \"new Number(5)\";\n  const jerry_char_t regexp_object[] = \"new RegExp()\";\n  const jerry_char_t string_object[] = \"new String('foo')\";\n  const jerry_char_t weak_ref_object[] = \"new WeakRef({})\";\n  const jerry_char_t error_object[] = \"new Error()\";\n\n  jerry_parse_options_t module_parse_options;\n  module_parse_options.options = JERRY_PARSE_MODULE;\n\n  test_entry_t entries[] = {\n    ENTRY (JERRY_OBJECT_TYPE_NONE, jerry_number (-33.0)),\n    ENTRY (JERRY_OBJECT_TYPE_NONE, jerry_boolean (true)),\n    ENTRY (JERRY_OBJECT_TYPE_NONE, jerry_undefined ()),\n    ENTRY (JERRY_OBJECT_TYPE_NONE, jerry_null ()),\n    ENTRY (JERRY_OBJECT_TYPE_NONE, jerry_string_sz (\"foo\")),\n    ENTRY (JERRY_OBJECT_TYPE_NONE, jerry_throw_sz (JERRY_ERROR_TYPE, \"error\")),\n\n    ENTRY (JERRY_OBJECT_TYPE_GENERIC, jerry_object ()),\n    ENTRY_IF (JERRY_OBJECT_TYPE_MODULE_NAMESPACE, test_namespace (module_parse_options), JERRY_FEATURE_MODULE),\n    ENTRY (JERRY_OBJECT_TYPE_ARRAY, jerry_array (10)),\n\n    ENTRY_IF (JERRY_OBJECT_TYPE_PROXY, EVALUATE (proxy_object), JERRY_FEATURE_PROXY),\n    ENTRY_IF (JERRY_OBJECT_TYPE_TYPEDARRAY, EVALUATE (typedarray_object), JERRY_FEATURE_TYPEDARRAY),\n    ENTRY_IF (JERRY_OBJECT_TYPE_CONTAINER, EVALUATE (container_object), JERRY_FEATURE_MAP),\n    ENTRY_IF (JERRY_OBJECT_TYPE_ITERATOR, EVALUATE (iterator_object), JERRY_FEATURE_SYMBOL),\n\n    ENTRY (JERRY_OBJECT_TYPE_SCRIPT, PARSE (NULL)),\n    ENTRY_IF (JERRY_OBJECT_TYPE_MODULE, PARSE (&module_parse_options), JERRY_FEATURE_MODULE),\n    ENTRY (JERRY_OBJECT_TYPE_PROMISE, jerry_promise ()),\n    ENTRY_IF (JERRY_OBJECT_TYPE_DATAVIEW, test_dataview (), JERRY_FEATURE_DATAVIEW),\n    ENTRY_IF (JERRY_OBJECT_TYPE_FUNCTION, EVALUATE (arrow_function), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_OBJECT_TYPE_FUNCTION, EVALUATE (async_arrow_function), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_OBJECT_TYPE_FUNCTION, EVALUATE (generator_function), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_OBJECT_TYPE_FUNCTION, EVALUATE (async_generator_function), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_OBJECT_TYPE_FUNCTION, EVALUATE (method_function), JERRY_FEATURE_SYMBOL),\n    ENTRY (JERRY_OBJECT_TYPE_FUNCTION, EVALUATE (builtin_function)),\n    ENTRY (JERRY_OBJECT_TYPE_FUNCTION, EVALUATE (simple_function)),\n    ENTRY (JERRY_OBJECT_TYPE_FUNCTION, EVALUATE (bound_function)),\n    ENTRY (JERRY_OBJECT_TYPE_FUNCTION, jerry_function_external (test_ext_function)),\n    ENTRY (JERRY_OBJECT_TYPE_FUNCTION, EVALUATE (getter_function)),\n    ENTRY (JERRY_OBJECT_TYPE_FUNCTION, EVALUATE (setter_function)),\n    ENTRY_IF (JERRY_OBJECT_TYPE_ERROR, EVALUATE (error_object), JERRY_FEATURE_ERROR_MESSAGES),\n    ENTRY_IF (JERRY_OBJECT_TYPE_ARRAYBUFFER, jerry_arraybuffer (10), JERRY_FEATURE_TYPEDARRAY),\n\n    ENTRY (JERRY_OBJECT_TYPE_ARGUMENTS, EVALUATE (mapped_arguments)),\n    ENTRY (JERRY_OBJECT_TYPE_ARGUMENTS, EVALUATE (unmapped_arguments)),\n    ENTRY (JERRY_OBJECT_TYPE_BOOLEAN, EVALUATE (boolean_object)),\n    ENTRY (JERRY_OBJECT_TYPE_DATE, EVALUATE (date_object)),\n    ENTRY (JERRY_OBJECT_TYPE_NUMBER, EVALUATE (number_object)),\n    ENTRY (JERRY_OBJECT_TYPE_REGEXP, EVALUATE (regexp_object)),\n    ENTRY (JERRY_OBJECT_TYPE_STRING, EVALUATE (string_object)),\n    ENTRY_IF (JERRY_OBJECT_TYPE_SYMBOL, EVALUATE (symbol_object), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_OBJECT_TYPE_GENERATOR, EVALUATE (generator_object), JERRY_FEATURE_SYMBOL),\n    ENTRY_IF (JERRY_OBJECT_TYPE_BIGINT, EVALUATE (bigint_object), JERRY_FEATURE_BIGINT),\n    ENTRY_IF (JERRY_OBJECT_TYPE_WEAKREF, EVALUATE (weak_ref_object), JERRY_FEATURE_WEAKREF),\n  };\n\n  for (size_t idx = 0; idx < sizeof (entries) / sizeof (entries[0]); idx++)\n  {\n    jerry_object_type_t type_info = jerry_object_type (entries[idx].value);\n\n    TEST_ASSERT (!entries[idx].active || type_info == entries[idx].type_info);\n    jerry_value_free (entries[idx].value);\n  }\n\n  if (jerry_feature_enabled (JERRY_FEATURE_REALM))\n  {\n    jerry_value_t new_realm = jerry_realm ();\n    jerry_object_type_t new_realm_object_type = jerry_object_type (new_realm);\n    TEST_ASSERT (new_realm_object_type == JERRY_OBJECT_TYPE_GENERIC);\n\n    jerry_value_t old_realm = jerry_set_realm (new_realm);\n    jerry_object_type_t old_realm_object_type = jerry_object_type (old_realm);\n    TEST_ASSERT (old_realm_object_type == JERRY_OBJECT_TYPE_GENERIC);\n\n    jerry_set_realm (old_realm);\n\n    jerry_value_free (new_realm);\n  }\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-promise.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic void\ntest_promise_resolve_success (void)\n{\n  jerry_value_t my_promise = jerry_promise ();\n\n  // A created promise has an undefined promise result by default and a pending state\n  {\n    jerry_value_t promise_result = jerry_promise_result (my_promise);\n    TEST_ASSERT (jerry_value_is_undefined (promise_result));\n\n    jerry_promise_state_t promise_state = jerry_promise_state (my_promise);\n    TEST_ASSERT (promise_state == JERRY_PROMISE_STATE_PENDING);\n\n    jerry_value_free (promise_result);\n  }\n\n  jerry_value_t resolve_value = jerry_object ();\n  {\n    jerry_value_t obj_key = jerry_string_sz (\"key_one\");\n    jerry_value_t set_result = jerry_object_set (resolve_value, obj_key, jerry_number (3));\n    TEST_ASSERT (jerry_value_is_boolean (set_result) && (jerry_value_is_true (set_result)));\n    jerry_value_free (set_result);\n    jerry_value_free (obj_key);\n  }\n\n  // A resolved promise should have the result of from the resolve call and a fulfilled state\n  {\n    jerry_value_t resolve_result = jerry_promise_resolve (my_promise, resolve_value);\n\n    // Release \"old\" value of resolve.\n    jerry_value_free (resolve_value);\n\n    jerry_value_t promise_result = jerry_promise_result (my_promise);\n    {\n      TEST_ASSERT (jerry_value_is_object (promise_result));\n      jerry_value_t obj_key = jerry_string_sz (\"key_one\");\n      jerry_value_t get_result = jerry_object_get (promise_result, obj_key);\n      TEST_ASSERT (jerry_value_is_number (get_result));\n      TEST_ASSERT (jerry_value_as_number (get_result) == 3.0);\n\n      jerry_value_free (get_result);\n      jerry_value_free (obj_key);\n    }\n\n    jerry_promise_state_t promise_state = jerry_promise_state (my_promise);\n    TEST_ASSERT (promise_state == JERRY_PROMISE_STATE_FULFILLED);\n\n    jerry_value_free (promise_result);\n\n    jerry_value_free (resolve_result);\n  }\n\n  // Resolvind a promise again does not change the result/state\n  {\n    jerry_value_t resolve_result = jerry_promise_reject (my_promise, jerry_number (50));\n\n    jerry_value_t promise_result = jerry_promise_result (my_promise);\n    {\n      TEST_ASSERT (jerry_value_is_object (promise_result));\n      jerry_value_t obj_key = jerry_string_sz (\"key_one\");\n      jerry_value_t get_result = jerry_object_get (promise_result, obj_key);\n      TEST_ASSERT (jerry_value_is_number (get_result));\n      TEST_ASSERT (jerry_value_as_number (get_result) == 3.0);\n\n      jerry_value_free (get_result);\n      jerry_value_free (obj_key);\n    }\n\n    jerry_promise_state_t promise_state = jerry_promise_state (my_promise);\n    TEST_ASSERT (promise_state == JERRY_PROMISE_STATE_FULFILLED);\n\n    jerry_value_free (promise_result);\n\n    jerry_value_free (resolve_result);\n  }\n\n  jerry_value_free (my_promise);\n} /* test_promise_resolve_success */\n\nstatic void\ntest_promise_resolve_fail (void)\n{\n  jerry_value_t my_promise = jerry_promise ();\n\n  // A created promise has an undefined promise result by default and a pending state\n  {\n    jerry_value_t promise_result = jerry_promise_result (my_promise);\n    TEST_ASSERT (jerry_value_is_undefined (promise_result));\n\n    jerry_promise_state_t promise_state = jerry_promise_state (my_promise);\n    TEST_ASSERT (promise_state == JERRY_PROMISE_STATE_PENDING);\n\n    jerry_value_free (promise_result);\n  }\n\n  // A resolved promise should have the result of from the resolve call and a fulfilled state\n  {\n    jerry_value_t error_obj = jerry_error_sz (JERRY_ERROR_TYPE, \"resolve_fail\");\n    jerry_value_t resolve_result = jerry_promise_reject (my_promise, error_obj);\n    jerry_value_free (error_obj);\n\n    jerry_value_t promise_result = jerry_promise_result (my_promise);\n    // The error is not throw that's why it is only an error object.\n    TEST_ASSERT (jerry_value_is_object (promise_result));\n    TEST_ASSERT (jerry_error_type (promise_result) == JERRY_ERROR_TYPE);\n\n    jerry_promise_state_t promise_state = jerry_promise_state (my_promise);\n    TEST_ASSERT (promise_state == JERRY_PROMISE_STATE_REJECTED);\n\n    jerry_value_free (promise_result);\n\n    jerry_value_free (resolve_result);\n  }\n\n  // Resolvind a promise again does not change the result/state\n  {\n    jerry_value_t resolve_result = jerry_promise_resolve (my_promise, jerry_number (50));\n\n    jerry_value_t promise_result = jerry_promise_result (my_promise);\n    TEST_ASSERT (jerry_value_is_object (promise_result));\n    TEST_ASSERT (jerry_error_type (promise_result) == JERRY_ERROR_TYPE);\n\n    jerry_promise_state_t promise_state = jerry_promise_state (my_promise);\n    TEST_ASSERT (promise_state == JERRY_PROMISE_STATE_REJECTED);\n\n    jerry_value_free (promise_result);\n\n    jerry_value_free (resolve_result);\n  }\n\n  jerry_value_free (my_promise);\n} /* test_promise_resolve_fail */\n\nstatic void\ntest_promise_from_js (void)\n{\n  const jerry_char_t test_source[] = \"(new Promise(function(rs, rj) { rs(30); })).then(function(v) { return v + 1; })\";\n\n  jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n\n  jerry_value_t res = jerry_run (parsed_code_val);\n  TEST_ASSERT (jerry_value_is_promise (res));\n\n  TEST_ASSERT (jerry_promise_state (res) == JERRY_PROMISE_STATE_PENDING);\n\n  jerry_value_t run_result = jerry_run_jobs ();\n  TEST_ASSERT (jerry_value_is_undefined (run_result));\n  jerry_value_free (run_result);\n\n  TEST_ASSERT (jerry_promise_state (res) == JERRY_PROMISE_STATE_FULFILLED);\n  jerry_value_t promise_result = jerry_promise_result (res);\n  TEST_ASSERT (jerry_value_is_number (promise_result));\n  TEST_ASSERT (jerry_value_as_number (promise_result) == 31.0);\n\n  jerry_value_free (promise_result);\n  jerry_value_free (res);\n  jerry_value_free (parsed_code_val);\n} /* test_promise_from_js */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  test_promise_resolve_fail ();\n  test_promise_resolve_success ();\n\n  test_promise_from_js ();\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-property.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Test: init property descriptor */\n  jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n  TEST_ASSERT (prop_desc.flags == JERRY_PROP_NO_OPTS);\n  TEST_ASSERT (jerry_value_is_undefined (prop_desc.value));\n  TEST_ASSERT (jerry_value_is_undefined (prop_desc.getter));\n  TEST_ASSERT (jerry_value_is_undefined (prop_desc.setter));\n\n  /* Test: define own properties */\n  jerry_value_t global_obj_val = jerry_current_realm ();\n  jerry_value_t prop_name = jerry_string_sz (\"my_defined_property\");\n  prop_desc.flags |= JERRY_PROP_IS_VALUE_DEFINED;\n  prop_desc.value = jerry_value_copy (prop_name);\n  jerry_value_t res = jerry_object_define_own_prop (global_obj_val, prop_name, &prop_desc);\n  TEST_ASSERT (jerry_value_is_boolean (res) && jerry_value_is_true (res));\n  jerry_value_free (res);\n  jerry_property_descriptor_free (&prop_desc);\n\n  /* Test: define own property with error */\n  prop_desc = jerry_property_descriptor ();\n  prop_desc.flags |= JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_SHOULD_THROW;\n  prop_desc.value = jerry_number (3.14);\n  res = jerry_object_define_own_prop (global_obj_val, prop_name, &prop_desc);\n  TEST_ASSERT (jerry_value_is_exception (res));\n  jerry_value_free (res);\n  jerry_property_descriptor_free (&prop_desc);\n\n  /* Test: test define own property failure without throw twice */\n  prop_desc = jerry_property_descriptor ();\n  prop_desc.flags |= JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_GET_DEFINED;\n  res = jerry_object_define_own_prop (prop_name, prop_name, &prop_desc);\n  TEST_ASSERT (jerry_value_is_boolean (res) && !jerry_value_is_true (res));\n  jerry_value_free (res);\n  res = jerry_object_define_own_prop (global_obj_val, prop_name, &prop_desc);\n  TEST_ASSERT (jerry_value_is_boolean (res) && !jerry_value_is_true (res));\n  jerry_value_free (res);\n  jerry_property_descriptor_free (&prop_desc);\n\n  /* Test: get own property descriptor */\n  prop_desc = jerry_property_descriptor ();\n  jerry_value_t is_ok = jerry_object_get_own_prop (global_obj_val, prop_name, &prop_desc);\n  TEST_ASSERT (jerry_value_is_boolean (is_ok) && jerry_value_is_true (is_ok));\n  jerry_value_free (is_ok);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED);\n  TEST_ASSERT (jerry_value_is_string (prop_desc.value));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_WRITABLE));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_ENUMERABLE));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_GET_DEFINED));\n  TEST_ASSERT (jerry_value_is_undefined (prop_desc.getter));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_SET_DEFINED));\n  TEST_ASSERT (jerry_value_is_undefined (prop_desc.setter));\n  jerry_property_descriptor_free (&prop_desc);\n\n  if (jerry_feature_enabled (JERRY_FEATURE_PROXY))\n  {\n    /* Note: update this test when the internal method is implemented */\n    jerry_value_t target = jerry_object ();\n    jerry_value_t handler = jerry_object ();\n    jerry_value_t proxy = jerry_proxy (target, handler);\n\n    jerry_value_free (target);\n    jerry_value_free (handler);\n    is_ok = jerry_object_get_own_prop (proxy, prop_name, &prop_desc);\n    TEST_ASSERT (jerry_value_is_boolean (is_ok) && !jerry_value_is_true (is_ok));\n    jerry_value_free (is_ok);\n    jerry_value_free (proxy);\n  }\n\n  jerry_value_free (prop_name);\n\n  /* Test: define and get own property descriptor */\n  prop_desc.flags |= JERRY_PROP_IS_ENUMERABLE;\n  prop_name = jerry_string_sz (\"enumerable-property\");\n  res = jerry_object_define_own_prop (global_obj_val, prop_name, &prop_desc);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_boolean (res));\n  TEST_ASSERT (jerry_value_is_true (res));\n  jerry_value_free (res);\n  jerry_property_descriptor_free (&prop_desc);\n  is_ok = jerry_object_get_own_prop (global_obj_val, prop_name, &prop_desc);\n  TEST_ASSERT (jerry_value_is_boolean (is_ok) && jerry_value_is_true (is_ok));\n  jerry_value_free (is_ok);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_WRITABLE));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE));\n\n  jerry_value_free (prop_name);\n  jerry_value_free (global_obj_val);\n\n  /* Test: define own property descriptor error */\n  prop_desc = jerry_property_descriptor ();\n  prop_desc.flags |= JERRY_PROP_IS_VALUE_DEFINED;\n  prop_desc.value = jerry_number (11);\n\n  jerry_value_t obj_val = jerry_object ();\n  prop_name = jerry_string_sz (\"property_key\");\n  res = jerry_object_define_own_prop (obj_val, prop_name, &prop_desc);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  jerry_value_free (res);\n\n  jerry_value_free (prop_desc.value);\n  prop_desc.value = jerry_number (22);\n  res = jerry_object_define_own_prop (obj_val, prop_name, &prop_desc);\n  TEST_ASSERT (jerry_value_is_exception (res));\n  jerry_value_free (res);\n\n  jerry_value_free (prop_name);\n  jerry_value_free (obj_val);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-set-and-clear-error-flag.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic void\ncompare_str (jerry_value_t value, const char *str_p, size_t str_len)\n{\n  jerry_size_t size = jerry_string_size (value, JERRY_ENCODING_CESU8);\n  TEST_ASSERT (str_len == size);\n  JERRY_VLA (jerry_char_t, str_buff, size);\n  jerry_string_to_buffer (value, JERRY_ENCODING_CESU8, str_buff, size);\n  TEST_ASSERT (!memcmp (str_p, str_buff, str_len));\n} /* compare_str */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t obj_val = jerry_object ();\n  obj_val = jerry_throw_value (obj_val, true);\n  jerry_value_t err_val = jerry_value_copy (obj_val);\n\n  obj_val = jerry_exception_value (err_val, true);\n\n  TEST_ASSERT (obj_val != err_val);\n  jerry_value_free (err_val);\n  jerry_value_free (obj_val);\n\n  const char pterodactylus[] = \"Pterodactylus\";\n  const size_t pterodactylus_size = sizeof (pterodactylus) - 1;\n\n  jerry_value_t str = jerry_string_sz (pterodactylus);\n  jerry_value_t error = jerry_throw_value (str, true);\n  str = jerry_exception_value (error, true);\n\n  compare_str (str, pterodactylus, pterodactylus_size);\n  jerry_value_free (str);\n\n  str = jerry_string_sz (pterodactylus);\n  error = jerry_throw_value (str, false);\n  jerry_value_free (str);\n  str = jerry_exception_value (error, true);\n\n  compare_str (str, pterodactylus, pterodactylus_size);\n  jerry_value_free (str);\n\n  str = jerry_string_sz (pterodactylus);\n  error = jerry_throw_abort (str, true);\n  str = jerry_exception_value (error, true);\n\n  compare_str (str, pterodactylus, pterodactylus_size);\n  jerry_value_free (str);\n\n  str = jerry_string_sz (pterodactylus);\n  error = jerry_throw_abort (str, false);\n  jerry_value_free (str);\n  str = jerry_exception_value (error, true);\n\n  compare_str (str, pterodactylus, pterodactylus_size);\n  jerry_value_free (str);\n\n  str = jerry_string_sz (pterodactylus);\n  error = jerry_throw_value (str, true);\n  error = jerry_throw_abort (error, true);\n  TEST_ASSERT (jerry_value_is_abort (error));\n  str = jerry_exception_value (error, true);\n\n  compare_str (str, pterodactylus, pterodactylus_size);\n  jerry_value_free (str);\n\n  str = jerry_string_sz (pterodactylus);\n  error = jerry_throw_value (str, true);\n  jerry_value_t error2 = jerry_throw_abort (error, false);\n  TEST_ASSERT (jerry_value_is_abort (error2));\n  jerry_value_free (error);\n  str = jerry_exception_value (error2, true);\n\n  compare_str (str, pterodactylus, pterodactylus_size);\n  jerry_value_free (str);\n\n  double test_num = 3.1415926;\n  jerry_value_t num = jerry_number (test_num);\n  jerry_value_t num2 = jerry_throw_value (num, false);\n  TEST_ASSERT (jerry_value_is_exception (num2));\n  jerry_value_free (num);\n  num2 = jerry_exception_value (num2, true);\n  TEST_ASSERT (jerry_value_as_number (num2) == test_num);\n  jerry_value_free (num2);\n\n  num = jerry_number (test_num);\n  num2 = jerry_throw_value (num, true);\n  TEST_ASSERT (jerry_value_is_exception (num2));\n  num2 = jerry_exception_value (num2, true);\n  TEST_ASSERT (jerry_value_as_number (num2) == test_num);\n  jerry_value_free (num2);\n\n  num = jerry_number (test_num);\n  num2 = jerry_throw_value (num, false);\n  TEST_ASSERT (jerry_value_is_exception (num2));\n  jerry_value_free (num);\n  jerry_value_t num3 = jerry_throw_value (num2, false);\n  TEST_ASSERT (jerry_value_is_exception (num3));\n  jerry_value_free (num2);\n  num2 = jerry_exception_value (num3, true);\n  TEST_ASSERT (jerry_value_as_number (num2) == test_num);\n  jerry_value_free (num2);\n\n  num = jerry_number (test_num);\n  num2 = jerry_throw_value (num, true);\n  TEST_ASSERT (jerry_value_is_exception (num2));\n  num3 = jerry_throw_value (num2, true);\n  TEST_ASSERT (jerry_value_is_exception (num3));\n  num2 = jerry_exception_value (num3, true);\n  TEST_ASSERT (jerry_value_as_number (num2) == test_num);\n  jerry_value_free (num2);\n\n  num = jerry_number (test_num);\n  error = jerry_throw_abort (num, true);\n  TEST_ASSERT (jerry_value_is_abort (error));\n  num2 = jerry_throw_value (error, true);\n  TEST_ASSERT (jerry_value_is_exception (num2));\n  num = jerry_exception_value (num2, true);\n  TEST_ASSERT (jerry_value_as_number (num) == test_num);\n  jerry_value_free (num);\n\n  num = jerry_number (test_num);\n  error = jerry_throw_abort (num, false);\n  jerry_value_free (num);\n  TEST_ASSERT (jerry_value_is_abort (error));\n  num2 = jerry_throw_value (error, true);\n  TEST_ASSERT (jerry_value_is_exception (num2));\n  num = jerry_exception_value (num2, true);\n  TEST_ASSERT (jerry_value_as_number (num) == test_num);\n  jerry_value_free (num);\n\n  num = jerry_number (test_num);\n  error = jerry_throw_abort (num, true);\n  TEST_ASSERT (jerry_value_is_abort (error));\n  num2 = jerry_throw_value (error, false);\n  jerry_value_free (error);\n  TEST_ASSERT (jerry_value_is_exception (num2));\n  num = jerry_exception_value (num2, true);\n  TEST_ASSERT (jerry_value_as_number (num) == test_num);\n  jerry_value_free (num);\n\n  num = jerry_number (test_num);\n  error = jerry_throw_abort (num, false);\n  jerry_value_free (num);\n  TEST_ASSERT (jerry_value_is_abort (error));\n  num2 = jerry_throw_value (error, false);\n  jerry_value_free (error);\n  TEST_ASSERT (jerry_value_is_exception (num2));\n  num = jerry_exception_value (num2, true);\n  TEST_ASSERT (jerry_value_as_number (num) == test_num);\n  jerry_value_free (num);\n\n  jerry_value_t value = jerry_number (42);\n  value = jerry_exception_value (value, true);\n  jerry_value_free (value);\n\n  value = jerry_number (42);\n  jerry_value_t value2 = jerry_exception_value (value, false);\n  jerry_value_free (value);\n  jerry_value_free (value2);\n\n  value = jerry_number (42);\n  error = jerry_throw_value (value, true);\n  error = jerry_throw_value (error, true);\n  jerry_value_free (error);\n\n  value = jerry_number (42);\n  error = jerry_throw_abort (value, true);\n  error = jerry_throw_abort (error, true);\n  jerry_value_free (error);\n\n  value = jerry_number (42);\n  error = jerry_throw_value (value, true);\n  error2 = jerry_throw_value (error, false);\n  jerry_value_free (error);\n  jerry_value_free (error2);\n\n  value = jerry_number (42);\n  error = jerry_throw_abort (value, true);\n  error2 = jerry_throw_abort (error, false);\n  jerry_value_free (error);\n  jerry_value_free (error2);\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-strings.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic bool\nstrict_equals (jerry_value_t a, /**< the first string to compare */\n               jerry_value_t b) /**< the second string to compare */\n{\n  const jerry_char_t is_equal_src[] = \"var isEqual = function(a, b) { return (a === b); }; isEqual\";\n  jerry_value_t is_equal_fn_val = jerry_eval (is_equal_src, sizeof (is_equal_src) - 1, JERRY_PARSE_NO_OPTS);\n  TEST_ASSERT (!jerry_value_is_exception (is_equal_fn_val));\n  jerry_value_t args[2] = { a, b };\n  jerry_value_t res = jerry_call (is_equal_fn_val, jerry_undefined (), args, 2);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_boolean (res));\n  bool is_strict_equal = jerry_value_is_true (res);\n  jerry_value_free (res);\n  jerry_value_free (is_equal_fn_val);\n  return is_strict_equal;\n} /* strict_equals */\n\nint\nmain (void)\n{\n  jerry_size_t sz, utf8_sz, cesu8_sz;\n  jerry_value_t args[2];\n\n  TEST_INIT ();\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Test corner case for jerry_string_to_char_buffer */\n  args[0] = jerry_string_sz (\"\");\n  sz = jerry_string_size (args[0], JERRY_ENCODING_CESU8);\n  TEST_ASSERT (sz == 0);\n  jerry_value_free (args[0]);\n\n  /* Test create_jerry_string_from_utf8 with 4-byte long unicode sequences,\n   * test string: 'str: {DESERET CAPITAL LETTER LONG I}'\n   */\n  char *utf8_bytes_p = \"\\x73\\x74\\x72\\x3a \\xf0\\x90\\x90\\x80\";\n  char *cesu8_bytes_p = \"\\x73\\x74\\x72\\x3a \\xed\\xa0\\x81\\xed\\xb0\\x80\";\n  args[0] = jerry_string ((jerry_char_t *) utf8_bytes_p, (jerry_size_t) strlen (utf8_bytes_p), JERRY_ENCODING_UTF8);\n  args[1] = jerry_string ((jerry_char_t *) cesu8_bytes_p, (jerry_size_t) strlen (cesu8_bytes_p), JERRY_ENCODING_CESU8);\n\n  /* These sizes must be equal */\n  utf8_sz = jerry_string_size (args[0], JERRY_ENCODING_CESU8);\n  cesu8_sz = jerry_string_size (args[1], JERRY_ENCODING_CESU8);\n\n  JERRY_VLA (jerry_char_t, string_from_utf8, utf8_sz);\n  JERRY_VLA (jerry_char_t, string_from_cesu8, cesu8_sz);\n\n  jerry_string_to_buffer (args[0], JERRY_ENCODING_CESU8, string_from_utf8, utf8_sz);\n  jerry_string_to_buffer (args[1], JERRY_ENCODING_CESU8, string_from_cesu8, cesu8_sz);\n\n  TEST_ASSERT (utf8_sz == cesu8_sz);\n\n  TEST_ASSERT (!memcmp (string_from_utf8, string_from_cesu8, utf8_sz));\n  jerry_value_free (args[0]);\n  jerry_value_free (args[1]);\n\n  /* Test jerry_string_to_buffer, test string: 'str: {DESERET CAPITAL LETTER LONG I}' */\n  utf8_bytes_p = \"\\x73\\x74\\x72\\x3a \\xf0\\x90\\x90\\x80\";\n  cesu8_bytes_p = \"\\x73\\x74\\x72\\x3a \\xed\\xa0\\x81\\xed\\xb0\\x80\";\n  args[0] = jerry_string ((jerry_char_t *) utf8_bytes_p, (jerry_size_t) strlen (utf8_bytes_p), JERRY_ENCODING_UTF8);\n  args[1] = jerry_string ((jerry_char_t *) cesu8_bytes_p, (jerry_size_t) strlen (cesu8_bytes_p), JERRY_ENCODING_CESU8);\n\n  /* Test that the strings are equal / ensure hashes are equal */\n  TEST_ASSERT (strict_equals (args[0], args[1]));\n\n  /* These sizes must be equal */\n  utf8_sz = jerry_string_size (args[0], JERRY_ENCODING_UTF8);\n  cesu8_sz = jerry_string_size (args[1], JERRY_ENCODING_UTF8);\n\n  TEST_ASSERT (utf8_sz == cesu8_sz && utf8_sz > 0);\n\n  JERRY_VLA (jerry_char_t, string_from_utf8_string, utf8_sz);\n  JERRY_VLA (jerry_char_t, string_from_cesu8_string, cesu8_sz);\n\n  jerry_string_to_buffer (args[0], JERRY_ENCODING_UTF8, string_from_utf8_string, utf8_sz);\n  jerry_string_to_buffer (args[1], JERRY_ENCODING_UTF8, string_from_cesu8_string, cesu8_sz);\n\n  TEST_ASSERT (!memcmp (string_from_utf8_string, string_from_cesu8_string, utf8_sz));\n  jerry_value_free (args[0]);\n  jerry_value_free (args[1]);\n\n  /* Test string: 'str: {MATHEMATICAL FRAKTUR SMALL F}{MATHEMATICAL FRAKTUR SMALL G}' */\n  utf8_bytes_p = \"\\x73\\x74\\x72\\x3a \\xf0\\x9d\\x94\\xa3 \\xf0\\x9d\\x94\\xa4\";\n  args[0] = jerry_string ((jerry_char_t *) utf8_bytes_p, (jerry_size_t) strlen (utf8_bytes_p), JERRY_ENCODING_UTF8);\n\n  cesu8_sz = jerry_string_size (args[0], JERRY_ENCODING_CESU8);\n  utf8_sz = jerry_string_size (args[0], JERRY_ENCODING_UTF8);\n\n  TEST_ASSERT (jerry_string_length (args[0]) == 10);\n  TEST_ASSERT (cesu8_sz != utf8_sz);\n  TEST_ASSERT (utf8_sz == 14 && cesu8_sz == 18);\n\n  JERRY_VLA (char, test_string, utf8_sz);\n\n  TEST_ASSERT (jerry_string_to_buffer (args[0], JERRY_ENCODING_UTF8, (jerry_char_t *) test_string, utf8_sz) == 14);\n  TEST_ASSERT (!strncmp (test_string, utf8_bytes_p, utf8_sz));\n\n  jerry_value_free (args[0]);\n\n  /* Test string: 'str: {DESERET CAPITAL LETTER LONG I}' */\n  cesu8_bytes_p = \"\\x73\\x74\\x72\\x3a \\xed\\xa0\\x81\\xed\\xb0\\x80\";\n  args[0] = jerry_string ((jerry_char_t *) cesu8_bytes_p, (jerry_size_t) strlen (cesu8_bytes_p), JERRY_ENCODING_CESU8);\n\n  cesu8_sz = jerry_string_size (args[0], JERRY_ENCODING_CESU8);\n  utf8_sz = jerry_string_size (args[0], JERRY_ENCODING_UTF8);\n\n  TEST_ASSERT (jerry_string_length (args[0]) == 7);\n  TEST_ASSERT (cesu8_sz != utf8_sz);\n  TEST_ASSERT (utf8_sz == 9 && cesu8_sz == 11);\n\n  jerry_value_free (args[0]);\n\n  /* Test string: 'price: 10{EURO SIGN}' */\n  utf8_bytes_p = \"\\x70\\x72\\x69\\x63\\x65\\x3a \\x31\\x30\\xe2\\x82\\xac\";\n  args[0] = jerry_string ((jerry_char_t *) utf8_bytes_p, (jerry_size_t) strlen (utf8_bytes_p), JERRY_ENCODING_UTF8);\n\n  cesu8_sz = jerry_string_size (args[0], JERRY_ENCODING_CESU8);\n  utf8_sz = jerry_string_size (args[0], JERRY_ENCODING_UTF8);\n\n  TEST_ASSERT (jerry_string_length (args[0]) == 10);\n  TEST_ASSERT (cesu8_sz == utf8_sz);\n  TEST_ASSERT (utf8_sz == 12);\n  jerry_value_free (args[0]);\n\n  /* Test string: '3' */\n  {\n    jerry_value_t test_str = jerry_string_sz (\"3\");\n    char result_string[1] = { 'E' };\n    jerry_size_t copied_utf8 =\n      jerry_string_to_buffer (test_str, JERRY_ENCODING_UTF8, (jerry_char_t *) result_string, sizeof (result_string));\n    TEST_ASSERT (copied_utf8 == 1);\n    TEST_ASSERT (result_string[0] == '3');\n\n    result_string[0] = 'E';\n    jerry_size_t copied =\n      jerry_string_to_buffer (test_str, JERRY_ENCODING_CESU8, (jerry_char_t *) result_string, sizeof (result_string));\n    TEST_ASSERT (copied == 1);\n    TEST_ASSERT (result_string[0] == '3');\n\n    jerry_value_free (test_str);\n  }\n\n  /* Test jerry_string_substr */\n  {\n    jerry_value_t test_str = jerry_string_sz (\"Hello World!\");\n    jerry_value_t expected_str = jerry_string_sz (\"Hello\");\n\n    // Read the string into a byte buffer.\n    jerry_value_t sub_str = jerry_string_substr (test_str, 0, 5);\n\n    TEST_ASSERT (!strict_equals (sub_str, test_str));\n    TEST_ASSERT (strict_equals (sub_str, expected_str));\n\n    jerry_value_free (sub_str);\n    jerry_value_free (expected_str);\n    jerry_value_free (test_str);\n  }\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api-value-type.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\ntypedef struct\n{\n  jerry_type_t type_info;\n  jerry_value_t value;\n} test_entry_t;\n\n#define ENTRY(TYPE, VALUE) \\\n  {                        \\\n    TYPE, VALUE            \\\n  }\n\nstatic jerry_value_t\ntest_ext_function (const jerry_call_info_t *call_info_p, /**< call information */\n                   const jerry_value_t args_p[], /**< array of arguments */\n                   const jerry_length_t args_cnt) /**< number of arguments */\n{\n  (void) call_info_p;\n  (void) args_p;\n  (void) args_cnt;\n  return jerry_boolean (true);\n} /* test_ext_function */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const char test_eval_function[] = \"function demo(a) { return a + 1; }; demo\";\n\n  test_entry_t entries[] = {\n    ENTRY (JERRY_TYPE_NUMBER, jerry_number (-33.0)),\n    ENTRY (JERRY_TYPE_NUMBER, jerry_number (3)),\n    ENTRY (JERRY_TYPE_NUMBER, jerry_nan ()),\n    ENTRY (JERRY_TYPE_NUMBER, jerry_infinity (false)),\n    ENTRY (JERRY_TYPE_NUMBER, jerry_infinity (true)),\n\n    ENTRY (JERRY_TYPE_BOOLEAN, jerry_boolean (true)),\n    ENTRY (JERRY_TYPE_BOOLEAN, jerry_boolean (false)),\n\n    ENTRY (JERRY_TYPE_UNDEFINED, jerry_undefined ()),\n\n    ENTRY (JERRY_TYPE_OBJECT, jerry_object ()),\n    ENTRY (JERRY_TYPE_OBJECT, jerry_array (10)),\n    ENTRY (JERRY_TYPE_EXCEPTION, jerry_throw_sz (JERRY_ERROR_TYPE, \"error\")),\n\n    ENTRY (JERRY_TYPE_NULL, jerry_null ()),\n\n    ENTRY (JERRY_TYPE_FUNCTION,\n           jerry_eval ((jerry_char_t *) test_eval_function, sizeof (test_eval_function) - 1, JERRY_PARSE_NO_OPTS)),\n    ENTRY (JERRY_TYPE_FUNCTION, jerry_function_external (test_ext_function)),\n\n    ENTRY (JERRY_TYPE_STRING, jerry_string_sz (test_eval_function)),\n    ENTRY (JERRY_TYPE_STRING, jerry_string_sz (\"\")),\n  };\n\n  for (size_t idx = 0; idx < sizeof (entries) / sizeof (entries[0]); idx++)\n  {\n    jerry_type_t type_info = jerry_value_type (entries[idx].value);\n\n    TEST_ASSERT (type_info != JERRY_TYPE_NONE);\n    TEST_ASSERT (type_info == entries[idx].type_info);\n\n    jerry_value_free (entries[idx].value);\n  }\n\n  jerry_value_t symbol_desc_value = jerry_string_sz (\"foo\");\n  jerry_value_t symbol_value = jerry_symbol_with_description (symbol_desc_value);\n  jerry_type_t type_info = jerry_value_type (symbol_value);\n\n  TEST_ASSERT (type_info != JERRY_TYPE_NONE);\n  TEST_ASSERT (type_info == JERRY_TYPE_SYMBOL);\n\n  jerry_value_free (symbol_value);\n  jerry_value_free (symbol_desc_value);\n\n  if (jerry_feature_enabled (JERRY_FEATURE_BIGINT))\n  {\n    /* Check simple bigint value type */\n    uint64_t digits_buffer[2] = { 1, 0 };\n    jerry_value_t value_bigint = jerry_bigint (digits_buffer, 2, false);\n    jerry_type_t value_type_info = jerry_value_type (value_bigint);\n\n    TEST_ASSERT (value_type_info != JERRY_TYPE_NONE);\n    TEST_ASSERT (value_type_info == JERRY_TYPE_BIGINT);\n\n    jerry_value_free (value_bigint);\n\n    /* Check bigint wrapped in object type */\n    jerry_char_t object_bigint_src[] = \"Object(5n)\";\n    jerry_value_t object_bigint = jerry_eval (object_bigint_src, sizeof (object_bigint_src) - 1, JERRY_PARSE_NO_OPTS);\n    TEST_ASSERT (!jerry_value_is_exception (object_bigint));\n\n    jerry_type_t object_type_info = jerry_value_type (object_bigint);\n\n    TEST_ASSERT (object_type_info != JERRY_TYPE_NONE);\n    TEST_ASSERT (object_type_info == JERRY_TYPE_OBJECT);\n\n    jerry_value_free (object_bigint);\n  }\n\n  if (jerry_feature_enabled (JERRY_FEATURE_REALM))\n  {\n    jerry_value_t new_realm = jerry_realm ();\n    jerry_value_t old_realm = jerry_set_realm (new_realm);\n\n    jerry_type_t new_realm_type = jerry_value_type (new_realm);\n    TEST_ASSERT (new_realm_type == JERRY_TYPE_OBJECT);\n\n    jerry_value_t new_realm_this = jerry_realm_this (new_realm);\n    jerry_type_t new_realm_this_type = jerry_value_type (new_realm_this);\n    TEST_ASSERT (new_realm_this_type == JERRY_TYPE_OBJECT);\n    jerry_value_free (new_realm_this);\n\n    jerry_type_t old_realm_type = jerry_value_type (old_realm);\n    TEST_ASSERT (old_realm_type == JERRY_TYPE_OBJECT);\n\n    jerry_value_free (new_realm);\n\n    jerry_value_t old_realm_this = jerry_realm_this (old_realm);\n    jerry_type_t old_realm_this_type = jerry_value_type (old_realm_this);\n    TEST_ASSERT (old_realm_this_type == JERRY_TYPE_OBJECT);\n    jerry_value_free (old_realm_this);\n\n    /* Restore the old realm as per docs */\n    jerry_set_realm (old_realm);\n  }\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-api.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nconst jerry_char_t test_source[] =\n  TEST_STRING_LITERAL (\"function assert (arg) { \"\n                       \"  if (!arg) { \"\n                       \"    throw Error('Assert failed');\"\n                       \"  } \"\n                       \"} \"\n                       \"this.t = 1; \"\n                       \"function f () { \"\n                       \"return this.t; \"\n                       \"} \"\n                       \"this.foo = f; \"\n                       \"this.bar = function (a) { \"\n                       \"return a + t; \"\n                       \"}; \"\n                       \"function A () { \"\n                       \"this.t = 12; \"\n                       \"} \"\n                       \"this.A = A; \"\n                       \"this.a = new A (); \"\n                       \"function call_external () { \"\n                       \"  return this.external ('1', true); \"\n                       \"} \"\n                       \"function call_throw_test() { \"\n                       \"  var catched = false; \"\n                       \"  try { \"\n                       \"    this.throw_test(); \"\n                       \"  } catch (e) { \"\n                       \"    catched = true; \"\n                       \"    assert(e.name == 'TypeError'); \"\n                       \"    assert(e.message == 'error'); \"\n                       \"  } \"\n                       \"  assert(catched); \"\n                       \"} \"\n                       \"function throw_reference_error() { \"\n                       \" throw new ReferenceError ();\"\n                       \"} \"\n                       \"p = {'alpha':32, 'bravo':false, 'charlie':{}, 'delta':123.45, 'echo':'foobar'};\"\n                       \"np = {}; Object.defineProperty (np, 'foxtrot', { \"\n                       \"get: function() { throw 'error'; }, enumerable: true }) \");\n\nbool test_api_is_free_callback_was_called = false;\n\nstatic jerry_value_t\nhandler (const jerry_call_info_t *call_info_p, /**< call information */\n         const jerry_value_t args_p[], /**< arguments list */\n         const jerry_length_t args_cnt) /**< arguments length */\n{\n  char buffer[32];\n  jerry_size_t sz;\n\n  printf (\"ok %u %u %p %u\\n\",\n          (unsigned int) call_info_p->function,\n          (unsigned int) call_info_p->this_value,\n          (void *) args_p,\n          (unsigned int) args_cnt);\n\n  TEST_ASSERT (args_cnt == 2);\n\n  TEST_ASSERT (jerry_value_is_string (args_p[0]));\n  sz = jerry_string_size (args_p[0], JERRY_ENCODING_CESU8);\n  TEST_ASSERT (sz == 1);\n  sz = jerry_string_to_buffer (args_p[0], JERRY_ENCODING_CESU8, (jerry_char_t *) buffer, sz);\n  TEST_ASSERT (sz == 1);\n  TEST_ASSERT (!strncmp (buffer, \"1\", (size_t) sz));\n\n  TEST_ASSERT (jerry_value_is_boolean (args_p[1]));\n\n  return jerry_string_sz (\"string from handler\");\n} /* handler */\n\nstatic jerry_value_t\nhandler_throw_test (const jerry_call_info_t *call_info_p, /**< call information */\n                    const jerry_value_t args_p[], /**< arguments list */\n                    const jerry_length_t args_cnt) /**< arguments length */\n{\n  printf (\"ok %u %u %p %u\\n\",\n          (unsigned int) call_info_p->function,\n          (unsigned int) call_info_p->this_value,\n          (void *) args_p,\n          (unsigned int) args_cnt);\n\n  return jerry_throw_sz (JERRY_ERROR_TYPE, \"error\");\n} /* handler_throw_test */\n\nstatic void\nhandler_construct_1_freecb (void *native_p, /**< native pointer */\n                            jerry_object_native_info_t *info_p) /**< native info */\n{\n  TEST_ASSERT ((uintptr_t) native_p == (uintptr_t) 0x0000000000000000ull);\n  TEST_ASSERT (info_p->free_cb == handler_construct_1_freecb);\n  printf (\"ok object free callback\\n\");\n\n  test_api_is_free_callback_was_called = true;\n} /* handler_construct_1_freecb */\n\nstatic void\nhandler_construct_2_freecb (void *native_p, /**< native pointer */\n                            jerry_object_native_info_t *info_p) /**< native info */\n{\n  TEST_ASSERT ((uintptr_t) native_p == (uintptr_t) 0x0012345678abcdefull);\n  TEST_ASSERT (info_p->free_cb == handler_construct_2_freecb);\n  printf (\"ok object free callback\\n\");\n\n  test_api_is_free_callback_was_called = true;\n} /* handler_construct_2_freecb */\n\n/**\n * The name of the jerry_object_native_info_t struct.\n */\n#define JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE(c_type) _jerry_object_native_info_##c_type\n\n/**\n * Define a native pointer's type based on the C type and free callback.\n */\n#define JERRY_DEFINE_NATIVE_HANDLE_INFO(c_type, native_free_cb)                           \\\n  static const jerry_object_native_info_t JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (c_type) = { \\\n    .free_cb = (jerry_object_native_free_cb_t) native_free_cb,                            \\\n    .number_of_references = 0,                                                            \\\n    .offset_of_references = 0,                                                            \\\n  }\n\nJERRY_DEFINE_NATIVE_HANDLE_INFO (bind1, handler_construct_1_freecb);\nJERRY_DEFINE_NATIVE_HANDLE_INFO (bind2, handler_construct_2_freecb);\nJERRY_DEFINE_NATIVE_HANDLE_INFO (bind3, NULL);\n\nstatic jerry_value_t\nhandler_construct (const jerry_call_info_t *call_info_p, /**< call information */\n                   const jerry_value_t args_p[], /**< arguments list */\n                   const jerry_length_t args_cnt) /**< arguments length */\n{\n  printf (\"ok construct %u %u %p %u\\n\",\n          (unsigned int) call_info_p->function,\n          (unsigned int) call_info_p->this_value,\n          (void *) args_p,\n          (unsigned int) args_cnt);\n\n  TEST_ASSERT (jerry_value_is_object (call_info_p->this_value));\n\n  TEST_ASSERT (args_cnt == 1);\n  TEST_ASSERT (jerry_value_is_boolean (args_p[0]));\n  TEST_ASSERT (jerry_value_is_true (args_p[0]));\n\n  jerry_value_t this_value = call_info_p->this_value;\n  jerry_value_t field_name = jerry_string_sz (\"value_field\");\n  jerry_value_t res = jerry_object_set (this_value, field_name, args_p[0]);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_true (res));\n  jerry_value_free (res);\n  jerry_value_free (field_name);\n\n  /* Set a native pointer. */\n  jerry_object_set_native_ptr (this_value, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind1), NULL);\n\n  /* Check that the native pointer was set. */\n  TEST_ASSERT (jerry_object_has_native_ptr (this_value, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind1)));\n  void *ptr = jerry_object_get_native_ptr (this_value, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind1));\n  TEST_ASSERT (ptr == NULL);\n\n  /* Set a second native pointer. */\n  jerry_object_set_native_ptr (this_value, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind2), (void *) 0x0012345678abcdefull);\n\n  /* Check that a second native pointer was set. */\n  TEST_ASSERT (jerry_object_has_native_ptr (this_value, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind2)));\n  ptr = jerry_object_get_native_ptr (this_value, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind2));\n  TEST_ASSERT ((uintptr_t) ptr == (uintptr_t) 0x0012345678abcdefull);\n\n  /* Check that the first native pointer is still set. */\n  TEST_ASSERT (jerry_object_has_native_ptr (this_value, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind1)));\n  ptr = jerry_object_get_native_ptr (this_value, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind1));\n  TEST_ASSERT (ptr == NULL);\n  return jerry_boolean (true);\n} /* handler_construct */\n\n/**\n * Extended Magic Strings\n */\n#define JERRY_MAGIC_STRING_ITEMS                                     \\\n  JERRY_MAGIC_STRING_DEF (GLOBAL, global)                            \\\n  JERRY_MAGIC_STRING_DEF (GREEK_ZERO_SIGN, \\xed\\xa0\\x80\\xed\\xb6\\x8a) \\\n  JERRY_MAGIC_STRING_DEF (CONSOLE, console)\n\n#define JERRY_MAGIC_STRING_DEF(NAME, STRING) static const char jerry_magic_string_ex_##NAME[] = #STRING;\n\nJERRY_MAGIC_STRING_ITEMS\n\n#undef JERRY_MAGIC_STRING_DEF\n\nconst jerry_length_t magic_string_lengths[] = {\n#define JERRY_MAGIC_STRING_DEF(NAME, STRING) (jerry_length_t) (sizeof (jerry_magic_string_ex_##NAME) - 1u),\n\n  JERRY_MAGIC_STRING_ITEMS\n\n#undef JERRY_MAGIC_STRING_DEF\n};\n\nconst jerry_char_t *magic_string_items[] = {\n#define JERRY_MAGIC_STRING_DEF(NAME, STRING) (const jerry_char_t *) jerry_magic_string_ex_##NAME,\n\n  JERRY_MAGIC_STRING_ITEMS\n\n#undef JERRY_MAGIC_STRING_DEF\n};\n\nstatic bool foreach (const jerry_value_t name, /**< field name */\n                     const jerry_value_t value, /**< field value */\n                     void *user_data) /**< user data */\n{\n  char str_buf_p[128];\n  jerry_size_t sz =\n    jerry_string_to_buffer (name, JERRY_ENCODING_CESU8, (jerry_char_t *) str_buf_p, sizeof (str_buf_p) - 1);\n  str_buf_p[sz] = '\\0';\n\n  TEST_ASSERT (!strncmp ((const char *) user_data, \"user_data\", 9));\n  TEST_ASSERT (sz > 0);\n\n  if (!strncmp (str_buf_p, \"alpha\", (size_t) sz))\n  {\n    TEST_ASSERT (jerry_value_is_number (value));\n    TEST_ASSERT (jerry_value_as_number (value) == 32.0);\n    return true;\n  }\n  else if (!strncmp (str_buf_p, \"bravo\", (size_t) sz))\n  {\n    TEST_ASSERT (jerry_value_is_boolean (value));\n    TEST_ASSERT (jerry_value_is_true (value) == false);\n    TEST_ASSERT (jerry_value_is_false (value));\n    return true;\n  }\n  else if (!strncmp (str_buf_p, \"charlie\", (size_t) sz))\n  {\n    TEST_ASSERT (jerry_value_is_object (value));\n    return true;\n  }\n  else if (!strncmp (str_buf_p, \"delta\", (size_t) sz))\n  {\n    TEST_ASSERT (jerry_value_is_number (value));\n    TEST_ASSERT (jerry_value_as_number (value) == 123.45);\n    return true;\n  }\n  else if (!strncmp (str_buf_p, \"echo\", (size_t) sz))\n  {\n    TEST_ASSERT (jerry_value_is_string (value));\n    jerry_size_t echo_sz =\n      jerry_string_to_buffer (value, JERRY_ENCODING_CESU8, (jerry_char_t *) str_buf_p, sizeof (str_buf_p) - 1);\n    str_buf_p[echo_sz] = '\\0';\n    TEST_ASSERT (!strncmp (str_buf_p, \"foobar\", (size_t) echo_sz));\n    return true;\n  }\n\n  TEST_ASSERT (false);\n  return false;\n} /* foreach */\n\nstatic bool\nforeach_exception (const jerry_value_t name, /**< field name */\n                   const jerry_value_t value, /**< field value */\n                   void *user_data) /**< user data */\n{\n  JERRY_UNUSED (value);\n  JERRY_UNUSED (user_data);\n  char str_buf_p[128];\n  jerry_size_t sz =\n    jerry_string_to_buffer (name, JERRY_ENCODING_CESU8, (jerry_char_t *) str_buf_p, sizeof (str_buf_p) - 1);\n  str_buf_p[sz] = '\\0';\n\n  if (!strncmp (str_buf_p, \"foxtrot\", (size_t) sz))\n  {\n    TEST_ASSERT (false);\n  }\n\n  return true;\n} /* foreach_exception */\n\nstatic bool\nforeach_subset (const jerry_value_t name, /**< field name */\n                const jerry_value_t value, /**< field value */\n                void *user_data) /**< user data */\n{\n  JERRY_UNUSED (name);\n  JERRY_UNUSED (value);\n  int *count_p = (int *) (user_data);\n\n  if (*count_p == 3)\n  {\n    return false;\n  }\n  (*count_p)++;\n  return true;\n} /* foreach_subset */\n\nstatic jerry_value_t\nget_property (const jerry_value_t obj_val, /**< object value */\n              const char *str_p) /**< property name */\n{\n  jerry_value_t prop_name_val = jerry_string_sz (str_p);\n  jerry_value_t ret_val = jerry_object_get (obj_val, prop_name_val);\n  jerry_value_free (prop_name_val);\n  return ret_val;\n} /* get_property */\n\nstatic jerry_value_t\nset_property (const jerry_value_t obj_val, /**< object value */\n              const char *str_p, /**< property name */\n              const jerry_value_t val) /**< value to set */\n{\n  jerry_value_t prop_name_val = jerry_string_sz (str_p);\n  jerry_value_t ret_val = jerry_object_set (obj_val, prop_name_val, val);\n  jerry_value_free (prop_name_val);\n  return ret_val;\n} /* set_property */\n\nstatic void\ntest_syntax_error (const char *script_p, /**< source code to run */\n                   const jerry_parse_options_t *options_p, /**< additional parsing options */\n                   const char *error_message_p, /**< error message */\n                   bool run_script) /**< run script before checking the error message */\n{\n  jerry_value_t result_val = jerry_parse ((const jerry_char_t *) script_p, strlen (script_p), options_p);\n\n  if (run_script)\n  {\n    TEST_ASSERT (!jerry_value_is_exception (result_val));\n    jerry_value_t script_val = result_val;\n\n    result_val = jerry_run (script_val);\n    jerry_value_free (script_val);\n  }\n\n  TEST_ASSERT (jerry_value_is_exception (result_val));\n  result_val = jerry_exception_value (result_val, true);\n\n  jerry_value_t err_str_val = jerry_value_to_string (result_val);\n  jerry_size_t err_str_size = jerry_string_size (err_str_val, JERRY_ENCODING_CESU8);\n  jerry_char_t err_str_buf[256];\n\n  TEST_ASSERT (err_str_size <= sizeof (err_str_buf));\n  TEST_ASSERT (err_str_size == strlen (error_message_p));\n\n  TEST_ASSERT (jerry_string_to_buffer (err_str_val, JERRY_ENCODING_CESU8, err_str_buf, err_str_size) == err_str_size);\n\n  jerry_value_free (err_str_val);\n  jerry_value_free (result_val);\n  TEST_ASSERT (memcmp ((char *) err_str_buf, error_message_p, err_str_size) == 0);\n} /* test_syntax_error */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  bool is_ok;\n  jerry_size_t sz, cesu8_sz;\n  jerry_length_t cesu8_length;\n  jerry_value_t val_t, val_foo, val_bar, val_A, val_A_prototype, val_a, val_a_foo, val_value_field, val_p, val_np;\n  jerry_value_t val_call_external;\n  jerry_value_t global_obj_val, obj_val;\n  jerry_value_t external_func_val, external_construct_val;\n  jerry_value_t throw_test_handler_val;\n  jerry_value_t parsed_code_val, proto_val, prim_val;\n  jerry_value_t res, args[2];\n  double number_val;\n  char buffer[32];\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n\n  res = jerry_run (parsed_code_val);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  jerry_value_free (res);\n  jerry_value_free (parsed_code_val);\n\n  global_obj_val = jerry_current_realm ();\n\n  /* Get global.boo (non-existing field) */\n  val_t = get_property (global_obj_val, \"boo\");\n  TEST_ASSERT (!jerry_value_is_exception (val_t));\n  TEST_ASSERT (jerry_value_is_undefined (val_t));\n\n  /* Get global.t */\n  val_t = get_property (global_obj_val, \"t\");\n  TEST_ASSERT (!jerry_value_is_exception (val_t));\n  TEST_ASSERT (jerry_value_is_number (val_t) && jerry_value_as_number (val_t) == 1.0);\n  jerry_value_free (val_t);\n\n  /* Get global.foo */\n  val_foo = get_property (global_obj_val, \"foo\");\n  TEST_ASSERT (!jerry_value_is_exception (val_foo));\n  TEST_ASSERT (jerry_value_is_object (val_foo));\n\n  /* Call foo (4, 2) */\n  args[0] = jerry_number (4);\n  args[1] = jerry_number (2);\n  res = jerry_call (val_foo, jerry_undefined (), args, 2);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_number (res) && jerry_value_as_number (res) == 1.0);\n  jerry_value_free (res);\n\n  /* Get global.bar */\n  val_bar = get_property (global_obj_val, \"bar\");\n  TEST_ASSERT (!jerry_value_is_exception (val_bar));\n  TEST_ASSERT (jerry_value_is_object (val_bar));\n\n  /* Call bar (4, 2) */\n  res = jerry_call (val_bar, jerry_undefined (), args, 2);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_number (res) && jerry_value_as_number (res) == 5.0);\n  jerry_value_free (res);\n  jerry_value_free (val_bar);\n\n  /* Set global.t = \"abcd\" */\n  jerry_value_free (args[0]);\n  args[0] = jerry_string_sz (\"abcd\");\n  res = set_property (global_obj_val, \"t\", args[0]);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_true (res));\n  jerry_value_free (res);\n\n  /* Call foo (4, 2) */\n  res = jerry_call (val_foo, jerry_undefined (), args, 2);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_string (res));\n  sz = jerry_string_size (res, JERRY_ENCODING_CESU8);\n  TEST_ASSERT (sz == 4);\n  sz = jerry_string_to_buffer (res, JERRY_ENCODING_CESU8, (jerry_char_t *) buffer, sz);\n  TEST_ASSERT (sz == 4);\n  jerry_value_free (res);\n  TEST_ASSERT (!strncmp (buffer, \"abcd\", (size_t) sz));\n  jerry_value_free (args[0]);\n  jerry_value_free (args[1]);\n\n  /* Get global.A */\n  val_A = get_property (global_obj_val, \"A\");\n  TEST_ASSERT (!jerry_value_is_exception (val_A));\n  TEST_ASSERT (jerry_value_is_object (val_A));\n\n  /* Get A.prototype */\n  is_ok = jerry_value_is_constructor (val_A);\n  TEST_ASSERT (is_ok);\n  val_A_prototype = get_property (val_A, \"prototype\");\n  TEST_ASSERT (!jerry_value_is_exception (val_A_prototype));\n  TEST_ASSERT (jerry_value_is_object (val_A_prototype));\n  jerry_value_free (val_A);\n\n  /* Set A.prototype.foo = global.foo */\n  res = set_property (val_A_prototype, \"foo\", val_foo);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_true (res));\n  jerry_value_free (res);\n  jerry_value_free (val_A_prototype);\n  jerry_value_free (val_foo);\n\n  /* Get global.a */\n  val_a = get_property (global_obj_val, \"a\");\n  TEST_ASSERT (!jerry_value_is_exception (val_a));\n  TEST_ASSERT (jerry_value_is_object (val_a));\n\n  /* Get a.t */\n  res = get_property (val_a, \"t\");\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_number (res) && jerry_value_as_number (res) == 12.0);\n  jerry_value_free (res);\n\n  /* foreach properties */\n  val_p = get_property (global_obj_val, \"p\");\n  is_ok = jerry_object_foreach (val_p, foreach, (void *) \"user_data\");\n  TEST_ASSERT (is_ok);\n\n  /* break foreach at third element */\n  int count = 0;\n  is_ok = jerry_object_foreach (val_p, foreach_subset, &count);\n  TEST_ASSERT (is_ok);\n  TEST_ASSERT (count == 3);\n  jerry_value_free (val_p);\n\n  /* foreach with throw test */\n  val_np = get_property (global_obj_val, \"np\");\n  is_ok = !jerry_object_foreach (val_np, foreach_exception, NULL);\n  TEST_ASSERT (is_ok);\n  jerry_value_free (val_np);\n\n  /* Get a.foo */\n  val_a_foo = get_property (val_a, \"foo\");\n  TEST_ASSERT (!jerry_value_is_exception (val_a_foo));\n  TEST_ASSERT (jerry_value_is_object (val_a_foo));\n\n  /* Call a.foo () */\n  res = jerry_call (val_a_foo, val_a, NULL, 0);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_number (res) && jerry_value_as_number (res) == 12.0);\n  jerry_value_free (res);\n  jerry_value_free (val_a_foo);\n\n  jerry_value_free (val_a);\n\n  /* Create native handler bound function object and set it to 'external' variable */\n  external_func_val = jerry_function_external (handler);\n  TEST_ASSERT (jerry_value_is_function (external_func_val) && jerry_value_is_constructor (external_func_val));\n\n  res = set_property (global_obj_val, \"external\", external_func_val);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_true (res));\n  jerry_value_free (external_func_val);\n\n  /* Call 'call_external' function that should call external function created above */\n  val_call_external = get_property (global_obj_val, \"call_external\");\n  TEST_ASSERT (!jerry_value_is_exception (val_call_external));\n  TEST_ASSERT (jerry_value_is_object (val_call_external));\n  res = jerry_call (val_call_external, global_obj_val, NULL, 0);\n  jerry_value_free (val_call_external);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_string (res));\n  sz = jerry_string_size (res, JERRY_ENCODING_CESU8);\n  TEST_ASSERT (sz == 19);\n  sz = jerry_string_to_buffer (res, JERRY_ENCODING_CESU8, (jerry_char_t *) buffer, sz);\n  TEST_ASSERT (sz == 19);\n  jerry_value_free (res);\n  TEST_ASSERT (!strncmp (buffer, \"string from handler\", (size_t) sz));\n\n  /* Create native handler bound function object and set it to 'external_construct' variable */\n  external_construct_val = jerry_function_external (handler_construct);\n  TEST_ASSERT (jerry_value_is_function (external_construct_val) && jerry_value_is_constructor (external_construct_val));\n\n  res = set_property (global_obj_val, \"external_construct\", external_construct_val);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_true (res));\n  jerry_value_free (res);\n\n  /* Call external function created above, as constructor */\n  args[0] = jerry_boolean (true);\n  res = jerry_construct (external_construct_val, args, 1);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_object (res));\n  val_value_field = get_property (res, \"value_field\");\n\n  /* Get 'value_field' of constructed object */\n  TEST_ASSERT (!jerry_value_is_exception (val_value_field));\n  TEST_ASSERT (jerry_value_is_boolean (val_value_field) && jerry_value_is_true (val_value_field));\n  jerry_value_free (val_value_field);\n  jerry_value_free (external_construct_val);\n\n  TEST_ASSERT (jerry_object_has_native_ptr (res, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind2)));\n  void *ptr = jerry_object_get_native_ptr (res, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind2));\n  TEST_ASSERT ((uintptr_t) ptr == (uintptr_t) 0x0012345678abcdefull);\n\n  /* Passing NULL for info_p is allowed. */\n  TEST_ASSERT (!jerry_object_has_native_ptr (res, NULL));\n  jerry_object_set_native_ptr (res, NULL, (void *) 0x0012345678abcdefull);\n\n  TEST_ASSERT (jerry_object_has_native_ptr (res, NULL));\n  ptr = jerry_object_get_native_ptr (res, NULL);\n  TEST_ASSERT ((uintptr_t) ptr == (uintptr_t) 0x0012345678abcdefull);\n\n  jerry_value_free (res);\n\n  /* Test: It is ok to set native pointer's free callback as NULL. */\n  jerry_value_t obj_freecb = jerry_object ();\n  jerry_object_set_native_ptr (obj_freecb, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind3), (void *) 0x1234);\n\n  jerry_value_free (obj_freecb);\n\n  /* Test: Throwing exception from native handler. */\n  throw_test_handler_val = jerry_function_external (handler_throw_test);\n  TEST_ASSERT (jerry_value_is_function (throw_test_handler_val));\n\n  res = set_property (global_obj_val, \"throw_test\", throw_test_handler_val);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_true (res));\n  jerry_value_free (res);\n  jerry_value_free (throw_test_handler_val);\n\n  val_t = get_property (global_obj_val, \"call_throw_test\");\n  TEST_ASSERT (!jerry_value_is_exception (val_t));\n  TEST_ASSERT (jerry_value_is_object (val_t));\n\n  res = jerry_call (val_t, global_obj_val, NULL, 0);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  jerry_value_free (val_t);\n  jerry_value_free (res);\n\n  /* Test: Unhandled exception in called function */\n  val_t = get_property (global_obj_val, \"throw_reference_error\");\n  TEST_ASSERT (!jerry_value_is_exception (val_t));\n  TEST_ASSERT (jerry_value_is_object (val_t));\n\n  res = jerry_call (val_t, global_obj_val, NULL, 0);\n\n  TEST_ASSERT (jerry_value_is_exception (res));\n  jerry_value_free (val_t);\n\n  /* 'res' should contain exception object */\n  res = jerry_exception_value (res, true);\n  TEST_ASSERT (jerry_value_is_object (res));\n  jerry_value_free (res);\n\n  /* Test: Call of non-function */\n  obj_val = jerry_object ();\n  res = jerry_call (obj_val, global_obj_val, NULL, 0);\n  TEST_ASSERT (jerry_value_is_exception (res));\n\n  /* 'res' should contain exception object */\n  res = jerry_exception_value (res, true);\n  TEST_ASSERT (jerry_value_is_object (res));\n  jerry_value_free (res);\n\n  jerry_value_free (obj_val);\n\n  /* Test: Unhandled exception in function called, as constructor */\n  val_t = get_property (global_obj_val, \"throw_reference_error\");\n  TEST_ASSERT (!jerry_value_is_exception (val_t));\n  TEST_ASSERT (jerry_value_is_object (val_t));\n\n  res = jerry_construct (val_t, NULL, 0);\n  TEST_ASSERT (jerry_value_is_exception (res));\n  jerry_value_free (val_t);\n\n  /* 'res' should contain exception object */\n  res = jerry_exception_value (res, true);\n  TEST_ASSERT (jerry_value_is_object (res));\n  jerry_value_free (res);\n\n  /* Test: Call of non-function as constructor */\n  obj_val = jerry_object ();\n  res = jerry_construct (obj_val, NULL, 0);\n  TEST_ASSERT (jerry_value_is_exception (res));\n\n  /* 'res' should contain exception object */\n  res = jerry_exception_value (res, true);\n  TEST_ASSERT (jerry_value_is_object (res));\n  jerry_value_free (res);\n\n  jerry_value_free (obj_val);\n\n  /* Test: Array Object API */\n  jerry_value_t array_obj_val = jerry_array (10);\n  TEST_ASSERT (jerry_value_is_array (array_obj_val));\n  TEST_ASSERT (jerry_array_length (array_obj_val) == 10);\n\n  jerry_value_t v_in = jerry_number (10.5);\n  res = jerry_object_set_index (array_obj_val, 5, v_in);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_boolean (res) && jerry_value_is_true (res));\n  jerry_value_free (res);\n  jerry_value_t v_out = jerry_object_get_index (array_obj_val, 5);\n\n  TEST_ASSERT (jerry_value_is_number (v_out) && jerry_value_as_number (v_out) == 10.5);\n\n  jerry_object_delete_index (array_obj_val, 5);\n  jerry_value_t v_und = jerry_object_get_index (array_obj_val, 5);\n\n  TEST_ASSERT (jerry_value_is_undefined (v_und));\n\n  jerry_value_free (v_in);\n  jerry_value_free (v_out);\n  jerry_value_free (v_und);\n  jerry_value_free (array_obj_val);\n\n  /* Test: object keys */\n  res = jerry_object_keys (global_obj_val);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_array (res));\n  TEST_ASSERT (jerry_array_length (res) == 15);\n  jerry_value_free (res);\n\n  /* Test: jerry_value_to_primitive */\n  obj_val = jerry_eval ((jerry_char_t *) \"new String ('hello')\", 20, JERRY_PARSE_NO_OPTS);\n  TEST_ASSERT (!jerry_value_is_exception (obj_val));\n  TEST_ASSERT (jerry_value_is_object (obj_val));\n  TEST_ASSERT (!jerry_value_is_string (obj_val));\n  prim_val = jerry_value_to_primitive (obj_val);\n  TEST_ASSERT (!jerry_value_is_exception (prim_val));\n  TEST_ASSERT (jerry_value_is_string (prim_val));\n  jerry_value_free (prim_val);\n\n  /* Test: jerry_object_proto */\n  proto_val = jerry_object_proto (jerry_undefined ());\n  TEST_ASSERT (jerry_value_is_exception (proto_val));\n  jerry_value_t error = jerry_exception_value (proto_val, true);\n  TEST_ASSERT (jerry_error_type (error) == JERRY_ERROR_TYPE);\n  jerry_value_free (error);\n\n  proto_val = jerry_object_proto (obj_val);\n  TEST_ASSERT (!jerry_value_is_exception (proto_val));\n  TEST_ASSERT (jerry_value_is_object (proto_val));\n  jerry_value_free (proto_val);\n  jerry_value_free (obj_val);\n\n  if (jerry_feature_enabled (JERRY_FEATURE_PROXY))\n  {\n    jerry_value_t target = jerry_object ();\n    jerry_value_t proxy_handler = jerry_object ();\n    jerry_value_t proxy = jerry_proxy (target, proxy_handler);\n    jerry_value_t obj_proto = jerry_eval ((jerry_char_t *) \"Object.prototype\", 16, JERRY_PARSE_NO_OPTS);\n\n    jerry_value_free (target);\n    jerry_value_free (proxy_handler);\n    proto_val = jerry_object_proto (proxy);\n    TEST_ASSERT (!jerry_value_is_exception (proto_val));\n    TEST_ASSERT (proto_val == obj_proto);\n    jerry_value_free (proto_val);\n    jerry_value_free (obj_proto);\n    jerry_value_free (proxy);\n  }\n\n  /* Test: jerry_object_set_proto */\n  obj_val = jerry_object ();\n  res = jerry_object_set_proto (obj_val, jerry_null ());\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_boolean (res));\n  TEST_ASSERT (jerry_value_is_true (res));\n\n  jerry_value_t new_proto = jerry_object ();\n  res = jerry_object_set_proto (obj_val, new_proto);\n  jerry_value_free (new_proto);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_boolean (res));\n  TEST_ASSERT (jerry_value_is_true (res));\n  proto_val = jerry_object_proto (obj_val);\n  TEST_ASSERT (!jerry_value_is_exception (proto_val));\n  TEST_ASSERT (jerry_value_is_object (proto_val));\n  jerry_value_free (proto_val);\n  jerry_value_free (obj_val);\n\n  if (jerry_feature_enabled (JERRY_FEATURE_PROXY))\n  {\n    jerry_value_t target = jerry_object ();\n    jerry_value_t proxy_handler = jerry_object ();\n    jerry_value_t proxy = jerry_proxy (target, proxy_handler);\n    new_proto = jerry_eval ((jerry_char_t *) \"Function.prototype\", 18, JERRY_PARSE_NO_OPTS);\n\n    res = jerry_object_set_proto (proxy, new_proto);\n    TEST_ASSERT (!jerry_value_is_exception (res));\n    jerry_value_t target_proto = jerry_object_proto (target);\n    TEST_ASSERT (target_proto == new_proto);\n\n    jerry_value_free (target);\n    jerry_value_free (proxy_handler);\n    jerry_value_free (proxy);\n    jerry_value_free (new_proto);\n    jerry_value_free (target_proto);\n  }\n\n  /* Test: eval */\n  const jerry_char_t eval_code_src1[] = \"(function () { return 123; })\";\n  val_t = jerry_eval (eval_code_src1, sizeof (eval_code_src1) - 1, JERRY_PARSE_STRICT_MODE);\n  TEST_ASSERT (!jerry_value_is_exception (val_t));\n  TEST_ASSERT (jerry_value_is_object (val_t));\n  TEST_ASSERT (jerry_value_is_function (val_t));\n\n  res = jerry_call (val_t, jerry_undefined (), NULL, 0);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_number (res) && jerry_value_as_number (res) == 123.0);\n  jerry_value_free (res);\n\n  jerry_value_free (val_t);\n\n  /* cleanup. */\n  jerry_value_free (global_obj_val);\n\n  /* Test: run gc. */\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n\n  /* Test: spaces */\n  const jerry_char_t eval_code_src2[] = \"\\x0a \\x0b \\x0c \\xc2\\xa0 \\xe2\\x80\\xa8 \\xe2\\x80\\xa9 \\xef\\xbb\\xbf 4321\";\n  val_t = jerry_eval (eval_code_src2, sizeof (eval_code_src2) - 1, JERRY_PARSE_STRICT_MODE);\n  TEST_ASSERT (!jerry_value_is_exception (val_t));\n  TEST_ASSERT (jerry_value_is_number (val_t) && jerry_value_as_number (val_t) == 4321.0);\n  jerry_value_free (val_t);\n\n  /* Test: number */\n  val_t = jerry_number (6.25);\n  number_val = jerry_value_as_number (val_t);\n  TEST_ASSERT (number_val * 3 == 18.75);\n  jerry_value_free (val_t);\n\n  val_t = jerry_infinity (true);\n  number_val = jerry_value_as_number (val_t);\n  TEST_ASSERT (number_val * 3 == number_val && number_val != 0.0);\n  jerry_value_free (val_t);\n\n  val_t = jerry_nan ();\n  number_val = jerry_value_as_number (val_t);\n  TEST_ASSERT (number_val != number_val);\n  jerry_value_free (val_t);\n\n  /* Test: create function */\n  jerry_value_t script_source = jerry_string_sz (\"  return 5 +  a+\\nb+c\");\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_ARGUMENT_LIST;\n  parse_options.argument_list = jerry_string_sz (\"a , b,c\");\n\n  jerry_value_t func_val = jerry_parse_value (script_source, &parse_options);\n\n  TEST_ASSERT (!jerry_value_is_exception (func_val));\n\n  jerry_value_free (parse_options.argument_list);\n  jerry_value_free (script_source);\n\n  jerry_value_t func_args[3] = { jerry_number (4), jerry_number (6), jerry_number (-2) };\n\n  val_t = jerry_call (func_val, func_args[0], func_args, 3);\n  number_val = jerry_value_as_number (val_t);\n  TEST_ASSERT (number_val == 13.0);\n\n  jerry_value_free (val_t);\n  jerry_value_free (func_val);\n\n  parse_options.options = JERRY_PARSE_HAS_ARGUMENT_LIST;\n  parse_options.argument_list = jerry_null ();\n\n  func_val = jerry_parse ((const jerry_char_t *) \"\", 0, &parse_options);\n  jerry_value_free (parse_options.argument_list);\n\n  TEST_ASSERT (jerry_value_is_exception (func_val) && jerry_error_type (func_val) == JERRY_ERROR_TYPE);\n  jerry_value_free (func_val);\n\n  script_source = jerry_number (4.5);\n  func_val = jerry_parse_value (script_source, NULL);\n  jerry_value_free (script_source);\n\n  TEST_ASSERT (jerry_value_is_exception (func_val) && jerry_error_type (func_val) == JERRY_ERROR_TYPE);\n  jerry_value_free (func_val);\n\n  jerry_cleanup ();\n\n  TEST_ASSERT (test_api_is_free_callback_was_called);\n\n  /* Test: jerry_exception_value */\n  {\n    jerry_init (JERRY_INIT_EMPTY);\n    jerry_value_t num_val = jerry_number (123);\n    num_val = jerry_throw_value (num_val, true);\n    TEST_ASSERT (jerry_value_is_exception (num_val));\n    jerry_value_t num2_val = jerry_exception_value (num_val, false);\n    TEST_ASSERT (jerry_value_is_exception (num_val));\n    TEST_ASSERT (!jerry_value_is_exception (num2_val));\n    double num = jerry_value_as_number (num2_val);\n    TEST_ASSERT (num == 123);\n    num2_val = jerry_exception_value (num_val, true);\n    TEST_ASSERT (!jerry_value_is_exception (num2_val));\n    num = jerry_value_as_number (num2_val);\n    TEST_ASSERT (num == 123);\n    jerry_value_free (num2_val);\n    jerry_cleanup ();\n  }\n\n  {\n    jerry_init (JERRY_INIT_EMPTY);\n    const jerry_char_t scoped_src_p[] = \"let a; this.b = 5\";\n    jerry_value_t parse_result = jerry_parse (scoped_src_p, sizeof (scoped_src_p) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n    jerry_value_free (parse_result);\n\n    parse_result = jerry_parse (scoped_src_p, sizeof (scoped_src_p) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n\n    jerry_value_t run_result = jerry_run (parse_result);\n    TEST_ASSERT (!jerry_value_is_exception (run_result));\n    jerry_value_free (run_result);\n\n    /* Should be a syntax error due to redeclaration. */\n    run_result = jerry_run (parse_result);\n    TEST_ASSERT (jerry_value_is_exception (run_result));\n    jerry_value_free (run_result);\n    jerry_value_free (parse_result);\n\n    /* The variable should have no effect on parsing. */\n    parse_result = jerry_parse (scoped_src_p, sizeof (scoped_src_p) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n    jerry_value_free (parse_result);\n\n    /* The already existing global binding should not affect a new lexical binding */\n    const jerry_char_t scoped_src2_p[] = \"let b = 6; this.b + b\";\n    parse_result = jerry_parse (scoped_src2_p, sizeof (scoped_src2_p) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n    run_result = jerry_run (parse_result);\n    TEST_ASSERT (jerry_value_is_number (run_result));\n    TEST_ASSERT (jerry_value_as_number (run_result) == 11);\n    jerry_value_free (run_result);\n    jerry_value_free (parse_result);\n\n    /* Check restricted global property */\n    const jerry_char_t scoped_src3_p[] = \"let undefined;\";\n    parse_result = jerry_parse (scoped_src3_p, sizeof (scoped_src3_p) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n    run_result = jerry_run (parse_result);\n    TEST_ASSERT (jerry_value_is_exception (run_result));\n    TEST_ASSERT (jerry_error_type (run_result) == JERRY_ERROR_SYNTAX);\n    jerry_value_free (run_result);\n    jerry_value_free (parse_result);\n\n    jerry_value_t global_obj = jerry_current_realm ();\n    jerry_value_t prop_name = jerry_string_sz (\"foo\");\n\n    jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n    prop_desc.flags |= JERRY_PROP_IS_VALUE_DEFINED;\n    prop_desc.value = jerry_number (5.2);\n\n    jerry_value_t define_result = jerry_object_define_own_prop (global_obj, prop_name, &prop_desc);\n    TEST_ASSERT (jerry_value_is_boolean (define_result) && jerry_value_is_true (define_result));\n    jerry_value_free (define_result);\n\n    jerry_property_descriptor_free (&prop_desc);\n    jerry_value_free (prop_name);\n    jerry_value_free (global_obj);\n\n    const jerry_char_t scoped_src4_p[] = \"let foo;\";\n    parse_result = jerry_parse (scoped_src4_p, sizeof (scoped_src4_p) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n    run_result = jerry_run (parse_result);\n    TEST_ASSERT (jerry_value_is_exception (run_result));\n    TEST_ASSERT (jerry_error_type (run_result) == JERRY_ERROR_SYNTAX);\n    jerry_value_free (run_result);\n    jerry_value_free (parse_result);\n\n    if (jerry_feature_enabled (JERRY_FEATURE_REALM))\n    {\n      const jerry_char_t proxy_src_p[] = \"new Proxy({}, { getOwnPropertyDescriptor() { throw 42.1 }})\";\n      jerry_value_t proxy = jerry_eval (proxy_src_p, sizeof (proxy_src_p) - 1, JERRY_PARSE_NO_OPTS);\n      TEST_ASSERT (jerry_value_is_object (proxy));\n      jerry_value_t new_realm_value = jerry_realm ();\n\n      jerry_value_t set_realm_this_result = jerry_realm_set_this (new_realm_value, proxy);\n      TEST_ASSERT (jerry_value_is_boolean (set_realm_this_result) && jerry_value_is_true (set_realm_this_result));\n      jerry_value_free (set_realm_this_result);\n\n      jerry_value_t old_realm = jerry_set_realm (new_realm_value);\n\n      const jerry_char_t scoped_src5_p[] = \"let a;\";\n      parse_result = jerry_parse (scoped_src5_p, sizeof (scoped_src5_p) - 1, NULL);\n      TEST_ASSERT (!jerry_value_is_exception (parse_result));\n      run_result = jerry_run (parse_result);\n      TEST_ASSERT (jerry_value_is_exception (run_result));\n      jerry_value_t error_value = jerry_exception_value (run_result, false);\n      TEST_ASSERT (jerry_value_is_number (error_value) && jerry_value_as_number (error_value) == 42.1);\n      jerry_value_free (error_value);\n      jerry_value_free (run_result);\n      jerry_value_free (parse_result);\n\n      jerry_set_realm (old_realm);\n\n      jerry_value_free (new_realm_value);\n      jerry_value_free (proxy);\n\n      const jerry_char_t proxy_src2_p[] = \"new Proxy(Object.defineProperty({}, 'b', {value: 5.2}), {})\";\n      proxy = jerry_eval (proxy_src2_p, sizeof (proxy_src2_p) - 1, JERRY_PARSE_NO_OPTS);\n      TEST_ASSERT (jerry_value_is_object (proxy));\n      new_realm_value = jerry_realm ();\n\n      set_realm_this_result = jerry_realm_set_this (new_realm_value, proxy);\n      TEST_ASSERT (jerry_value_is_boolean (set_realm_this_result) && jerry_value_is_true (set_realm_this_result));\n      jerry_value_free (set_realm_this_result);\n\n      old_realm = jerry_set_realm (new_realm_value);\n\n      const jerry_char_t scoped_src6_p[] = \"let b;\";\n      parse_result = jerry_parse (scoped_src6_p, sizeof (scoped_src6_p) - 1, NULL);\n      TEST_ASSERT (!jerry_value_is_exception (parse_result));\n      run_result = jerry_run (parse_result);\n      TEST_ASSERT (jerry_value_is_exception (run_result));\n      TEST_ASSERT (jerry_value_is_exception (run_result));\n      TEST_ASSERT (jerry_error_type (run_result) == JERRY_ERROR_SYNTAX);\n      jerry_value_free (run_result);\n      jerry_value_free (parse_result);\n\n      jerry_set_realm (old_realm);\n\n      jerry_value_free (new_realm_value);\n      jerry_value_free (proxy);\n    }\n\n    jerry_cleanup ();\n  }\n\n  /* Test: parser error location */\n  if (jerry_feature_enabled (JERRY_FEATURE_ERROR_MESSAGES))\n  {\n    jerry_init (JERRY_INIT_SHOW_OPCODES);\n\n    test_syntax_error (\"b = 'hello';\\nvar a = (;\",\n                       NULL,\n                       \"SyntaxError: Unexpected end of input [<anonymous>:2:10]\",\n                       false);\n\n    parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n    parse_options.source_name = jerry_string_sz (\"filename.js\");\n\n    test_syntax_error (\"b = 'hello';\\nvar a = (;\",\n                       &parse_options,\n                       \"SyntaxError: Unexpected end of input [filename.js:2:10]\",\n                       false);\n\n    test_syntax_error (\"eval(\\\"var b;\\\\nfor (,); \\\");\",\n                       &parse_options,\n                       \"SyntaxError: Unexpected end of input [<eval>:2:6]\",\n                       true);\n\n    parse_options.options |= JERRY_PARSE_HAS_START;\n    parse_options.start_line = 10;\n    parse_options.start_column = 20;\n\n    test_syntax_error (\"for (var a in []\",\n                       &parse_options,\n                       \"SyntaxError: Expected ')' token [filename.js:10:36]\",\n                       false);\n\n    jerry_value_free (parse_options.source_name);\n    jerry_cleanup ();\n  }\n\n  /* External Magic String */\n  jerry_init (JERRY_INIT_SHOW_OPCODES);\n\n  uint32_t num_magic_string_items = (uint32_t) (sizeof (magic_string_items) / sizeof (jerry_char_t *));\n  jerry_register_magic_strings (magic_string_items, num_magic_string_items, magic_string_lengths);\n\n  const jerry_char_t ms_code_src[] = \"var global = {}; var console = [1]; var process = 1;\";\n  parsed_code_val = jerry_parse (ms_code_src, sizeof (ms_code_src) - 1, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n\n  res = jerry_run (parsed_code_val);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  jerry_value_free (res);\n  jerry_value_free (parsed_code_val);\n\n  /* call jerry_string_sz functions which will returns with the registered external magic strings */\n  args[0] = jerry_string_sz (\"console\");\n  args[1] = jerry_string_sz (\"\\xed\\xa0\\x80\\xed\\xb6\\x8a\"); /**< greek zero sign */\n\n  cesu8_length = jerry_string_length (args[0]);\n  cesu8_sz = jerry_string_size (args[0], JERRY_ENCODING_CESU8);\n\n  JERRY_VLA (char, string_console, cesu8_sz);\n  jerry_string_to_buffer (args[0], JERRY_ENCODING_CESU8, (jerry_char_t *) string_console, cesu8_sz);\n\n  TEST_ASSERT (!strncmp (string_console, \"console\", cesu8_sz));\n  TEST_ASSERT (cesu8_length == 7);\n  TEST_ASSERT (cesu8_length == cesu8_sz);\n\n  jerry_value_free (args[0]);\n\n  const jerry_char_t test_magic_str_access_src[] = \"'console'.charAt(6) == 'e'\";\n  res = jerry_eval (test_magic_str_access_src, sizeof (test_magic_str_access_src) - 1, JERRY_PARSE_NO_OPTS);\n  TEST_ASSERT (jerry_value_is_boolean (res));\n  TEST_ASSERT (jerry_value_is_true (res));\n\n  jerry_value_free (res);\n\n  cesu8_length = jerry_string_length (args[1]);\n  cesu8_sz = jerry_string_size (args[1], JERRY_ENCODING_CESU8);\n\n  JERRY_VLA (char, string_greek_zero_sign, cesu8_sz);\n  jerry_string_to_buffer (args[1], JERRY_ENCODING_CESU8, (jerry_char_t *) string_greek_zero_sign, cesu8_sz);\n\n  TEST_ASSERT (!strncmp (string_greek_zero_sign, \"\\xed\\xa0\\x80\\xed\\xb6\\x8a\", cesu8_sz));\n  TEST_ASSERT (cesu8_length == 2);\n  TEST_ASSERT (cesu8_sz == 6);\n\n  jerry_value_free (args[1]);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-arraybuffer.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\n/**\n * Register a JavaScript value in the global object.\n */\nstatic void\nregister_js_value (const char *name_p, /**< name of the function */\n                   jerry_value_t value) /**< JS value */\n{\n  jerry_value_t global_obj_val = jerry_current_realm ();\n\n  jerry_value_t name_val = jerry_string_sz (name_p);\n  jerry_value_t result_val = jerry_object_set (global_obj_val, name_val, value);\n  TEST_ASSERT (jerry_value_is_boolean (result_val));\n\n  jerry_value_free (name_val);\n  jerry_value_free (global_obj_val);\n\n  jerry_value_free (result_val);\n} /* register_js_value */\n\nstatic jerry_value_t\nassert_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                const jerry_value_t args_p[], /**< function arguments */\n                const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  JERRY_UNUSED (call_info_p);\n\n  if (args_cnt > 0 && jerry_value_is_true (args_p[0]))\n  {\n    return jerry_boolean (true);\n  }\n\n  if (args_cnt > 1 && jerry_value_is_string (args_p[1]))\n  {\n    jerry_length_t utf8_sz = jerry_string_size (args_p[1], JERRY_ENCODING_CESU8);\n    TEST_ASSERT (utf8_sz <= 127); /* 127 is the expected max assert fail message size. */\n    JERRY_VLA (char, string_from_utf8, utf8_sz + 1);\n    string_from_utf8[utf8_sz] = 0;\n\n    jerry_string_to_buffer (args_p[1], JERRY_ENCODING_CESU8, (jerry_char_t *) string_from_utf8, utf8_sz);\n\n    printf (\"JS assert: %s\\n\", string_from_utf8);\n  }\n\n  TEST_ASSERT (false);\n} /* assert_handler */\n\n/**\n * Test ArrayBuffer 'read' api call with various offset values.\n */\nstatic void\ntest_read_with_offset (uint8_t offset) /**< offset for buffer read. */\n{\n  const jerry_char_t eval_arraybuffer_src[] =\n    TEST_STRING_LITERAL (\"var array = new Uint8Array (15);\"\n                         \"for (var i = 0; i < array.length; i++) { array[i] = i * 2; };\"\n                         \"array.buffer\");\n  jerry_value_t arraybuffer =\n    jerry_eval (eval_arraybuffer_src, sizeof (eval_arraybuffer_src) - 1, JERRY_PARSE_STRICT_MODE);\n\n  TEST_ASSERT (!jerry_value_is_exception (arraybuffer));\n  TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n  TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == 15);\n\n  uint8_t buffer[20];\n  memset (buffer, 120, 20);\n\n  /* Try to copy more than the target buffer size. */\n  jerry_length_t copied = jerry_arraybuffer_read (arraybuffer, offset, buffer, 20);\n  TEST_ASSERT (copied == (jerry_length_t) (15 - offset));\n\n  for (uint8_t i = 0; i < copied; i++)\n  {\n    TEST_ASSERT (buffer[i] == (i + offset) * 2);\n  }\n  TEST_ASSERT (buffer[15 - offset] == 120);\n\n  jerry_value_free (arraybuffer);\n} /* test_read_with_offset */\n\n/**\n * Test ArrayBuffer 'write' api call with various offset values.\n */\nstatic void\ntest_write_with_offset (uint8_t offset) /**< offset for buffer write. */\n{\n  {\n    jerry_value_t offset_val = jerry_number (offset);\n    register_js_value (\"offset\", offset_val);\n    jerry_value_free (offset_val);\n  }\n\n  const jerry_char_t eval_arraybuffer_src[] = \"var array = new Uint8Array (15); array.buffer\";\n  jerry_value_t arraybuffer =\n    jerry_eval (eval_arraybuffer_src, sizeof (eval_arraybuffer_src) - 1, JERRY_PARSE_STRICT_MODE);\n\n  TEST_ASSERT (!jerry_value_is_exception (arraybuffer));\n  TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n  TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == 15);\n\n  uint8_t buffer[20];\n\n  for (uint8_t i = 0; i < 20; i++)\n  {\n    buffer[i] = (uint8_t) (i * 3);\n  }\n\n  /* Intentionally copy more than the allowed space. */\n  jerry_length_t copied = jerry_arraybuffer_write (arraybuffer, offset, buffer, 20);\n  TEST_ASSERT (copied == (jerry_length_t) (15 - offset));\n\n  const jerry_char_t eval_test_arraybuffer[] = TEST_STRING_LITERAL (\n    \"for (var i = 0; i < offset; i++)\"\n    \"{\"\n    \"  assert (array[i] == 0, 'offset check for: ' + i + ' was: ' + array[i] + ' should be: 0');\"\n    \"};\"\n    \"for (var i = offset; i < array.length; i++)\"\n    \"{\"\n    \"  var expected = (i - offset) * 3;\"\n    \"  assert (array[i] == expected, 'calc check for: ' + i + ' was: ' + array[i] + ' should be: ' + expected);\"\n    \"};\"\n    \"assert (array[15] === undefined, 'ArrayBuffer out of bounds index should return undefined value');\");\n  jerry_value_t res = jerry_eval (eval_test_arraybuffer, sizeof (eval_test_arraybuffer) - 1, JERRY_PARSE_STRICT_MODE);\n  jerry_value_free (res);\n  jerry_value_free (arraybuffer);\n} /* test_write_with_offset */\n\nstatic int allocate_mode = 0;\nstatic int allocate_count = 0;\nstatic int free_count = 0;\n\nstatic uint8_t *\ntest_allocate_cb (jerry_arraybuffer_type_t buffer_type, /**< type of the array buffer object */\n                  uint32_t buffer_size, /**< size of the requested buffer */\n                  void **buffer_user_p, /**< [in/out] user pointer assigned to the array buffer object */\n                  void *user_p) /**< user pointer passed to jerry_arraybuffer_set_allocation_callbacks */\n{\n  TEST_ASSERT (buffer_type == JERRY_ARRAYBUFFER_TYPE_ARRAYBUFFER);\n  TEST_ASSERT (user_p == (void *) &allocate_mode);\n\n  if (*buffer_user_p != NULL)\n  {\n    TEST_ASSERT (*buffer_user_p == (void *) &allocate_count);\n    TEST_ASSERT (buffer_size == 20);\n    allocate_count++;\n    *buffer_user_p = (void *) &free_count;\n  }\n  else\n  {\n    *buffer_user_p = (void *) &allocate_mode;\n  }\n  return (uint8_t *) malloc (buffer_size);\n} /* test_allocate_cb */\n\nstatic void\ntest_free_cb (jerry_arraybuffer_type_t buffer_type, /**< type of the array buffer object */\n              uint8_t *buffer_p, /**< pointer to the allocated buffer */\n              uint32_t buffer_size, /**< size of the allocated buffer */\n              void *buffer_user_p, /**< user pointer assigned to the array buffer object */\n              void *user_p) /**< user pointer passed to jerry_arraybuffer_set_allocation_callbacks */\n{\n  TEST_ASSERT (buffer_type == JERRY_ARRAYBUFFER_TYPE_ARRAYBUFFER);\n  TEST_ASSERT (user_p == (void *) &allocate_mode);\n\n  if (buffer_user_p == NULL)\n  {\n    TEST_ASSERT (buffer_size == 15);\n    free_count++;\n  }\n  else if (buffer_user_p == (void *) &free_count)\n  {\n    TEST_ASSERT (buffer_size == 20);\n    free_count++;\n  }\n  else\n  {\n    TEST_ASSERT (buffer_user_p == (void *) &allocate_mode);\n  }\n\n  free (buffer_p);\n} /* test_free_cb */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_TYPEDARRAY))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"ArrayBuffer is disabled!\\n\");\n    jerry_cleanup ();\n    return 0;\n  }\n\n  jerry_arraybuffer_heap_allocation_limit (4);\n  jerry_arraybuffer_allocator (test_allocate_cb, test_free_cb, (void *) &allocate_mode);\n\n  jerry_value_t function_val = jerry_function_external (assert_handler);\n  register_js_value (\"assert\", function_val);\n  jerry_value_free (function_val);\n\n  /* Test array buffer queries */\n  {\n    const jerry_char_t eval_arraybuffer_src[] = \"new ArrayBuffer (10)\";\n    jerry_value_t eval_arraybuffer =\n      jerry_eval (eval_arraybuffer_src, sizeof (eval_arraybuffer_src) - 1, JERRY_PARSE_STRICT_MODE);\n    TEST_ASSERT (!jerry_value_is_exception (eval_arraybuffer));\n    TEST_ASSERT (jerry_value_is_arraybuffer (eval_arraybuffer));\n    TEST_ASSERT (jerry_arraybuffer_size (eval_arraybuffer) == 10);\n    jerry_value_free (eval_arraybuffer);\n  }\n\n  /* Test array buffer creation */\n  {\n    const uint32_t length = 15;\n    jerry_value_t arraybuffer = jerry_arraybuffer (length);\n    TEST_ASSERT (!jerry_value_is_exception (arraybuffer));\n    TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n    TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == length);\n    jerry_value_free (arraybuffer);\n  }\n\n  /* Test array buffer read operations */\n  for (uint8_t i = 0; i < 15; i++)\n  {\n    test_read_with_offset (i);\n  }\n\n  /* Test zero length ArrayBuffer read */\n  {\n    const uint32_t length = 0;\n    jerry_value_t arraybuffer = jerry_arraybuffer (length);\n    TEST_ASSERT (!jerry_value_is_exception (arraybuffer));\n    TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n    TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == length);\n\n    uint8_t data[20];\n    memset (data, 11, 20);\n\n    jerry_length_t bytes_read = jerry_arraybuffer_read (arraybuffer, 0, data, 20);\n    TEST_ASSERT (bytes_read == 0);\n\n    for (int i = 0; i < 20; i++)\n    {\n      TEST_ASSERT (data[i] == 11);\n    }\n\n    jerry_value_free (arraybuffer);\n  }\n\n  /* Test array buffer write operations */\n  for (uint8_t i = 0; i < 15; i++)\n  {\n    test_write_with_offset (i);\n  }\n\n  /* Test zero length ArrayBuffer write */\n  {\n    const uint32_t length = 0;\n    jerry_value_t arraybuffer = jerry_arraybuffer (length);\n    TEST_ASSERT (!jerry_value_is_exception (arraybuffer));\n    TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n    TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == length);\n\n    uint8_t data[20];\n    memset (data, 11, 20);\n\n    jerry_length_t bytes_written = jerry_arraybuffer_write (arraybuffer, 0, data, 20);\n    TEST_ASSERT (bytes_written == 0);\n\n    jerry_value_free (arraybuffer);\n  }\n\n  /* Test zero length external ArrayBuffer */\n  {\n    const uint32_t length = 0;\n    jerry_value_t arraybuffer = jerry_arraybuffer_external (NULL, length, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (arraybuffer));\n    TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n    TEST_ASSERT (jerry_arraybuffer_is_detachable (arraybuffer));\n    TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == length);\n\n    uint8_t data[20];\n    memset (data, 11, 20);\n\n    jerry_length_t bytes_written = jerry_arraybuffer_write (arraybuffer, 0, data, 20);\n    TEST_ASSERT (bytes_written == 0);\n\n    jerry_value_free (arraybuffer);\n  }\n\n  /* Test ArrayBuffer with buffer allocated externally */\n  {\n    const uint32_t buffer_size = 15;\n    const uint8_t base_value = 51;\n\n    uint8_t *buffer_p = (uint8_t *) malloc (buffer_size);\n    memset (buffer_p, base_value, buffer_size);\n\n    jerry_value_t arrayb = jerry_arraybuffer_external (buffer_p, buffer_size, NULL);\n    uint8_t new_value = 123;\n    jerry_length_t copied = jerry_arraybuffer_write (arrayb, 0, &new_value, 1);\n    TEST_ASSERT (copied == 1);\n    TEST_ASSERT (buffer_p[0] == new_value);\n    TEST_ASSERT (jerry_arraybuffer_size (arrayb) == buffer_size);\n\n    for (uint32_t i = 1; i < buffer_size; i++)\n    {\n      TEST_ASSERT (buffer_p[i] == base_value);\n    }\n\n    JERRY_VLA (uint8_t, test_buffer, buffer_size);\n    jerry_length_t read = jerry_arraybuffer_read (arrayb, 0, test_buffer, buffer_size);\n    TEST_ASSERT (read == buffer_size);\n    TEST_ASSERT (test_buffer[0] == new_value);\n\n    for (uint32_t i = 1; i < buffer_size; i++)\n    {\n      TEST_ASSERT (test_buffer[i] == base_value);\n    }\n\n    TEST_ASSERT (jerry_value_is_arraybuffer (arrayb));\n    jerry_value_free (arrayb);\n  }\n\n  /* Test ArrayBuffer external memory map/unmap */\n  {\n    const uint32_t buffer_size = 20;\n\n    jerry_value_t input_buffer = jerry_arraybuffer_external (NULL, buffer_size, (void *) &allocate_count);\n    register_js_value (\"input_buffer\", input_buffer);\n    jerry_value_free (input_buffer);\n\n    const jerry_char_t eval_arraybuffer_src[] = TEST_STRING_LITERAL (\"var array = new Uint8Array(input_buffer);\"\n                                                                     \"for (var i = 0; i < array.length; i++)\"\n                                                                     \"{\"\n                                                                     \"  array[i] = i * 2;\"\n                                                                     \"};\"\n                                                                     \"array.buffer\");\n    jerry_value_t buffer =\n      jerry_eval (eval_arraybuffer_src, sizeof (eval_arraybuffer_src) - 1, JERRY_PARSE_STRICT_MODE);\n\n    TEST_ASSERT (!jerry_value_is_exception (buffer));\n    TEST_ASSERT (jerry_value_is_arraybuffer (buffer));\n    TEST_ASSERT (jerry_arraybuffer_size (buffer) == 20);\n\n    uint8_t *const data = jerry_arraybuffer_data (buffer);\n\n    TEST_ASSERT (data != NULL);\n\n    /* test memory read */\n    for (int i = 0; i < 20; i++)\n    {\n      TEST_ASSERT (data[i] == (uint8_t) (i * 2));\n    }\n\n    /* \"upload\" new data */\n    double sum = 0;\n    for (int i = 0; i < 20; i++)\n    {\n      data[i] = (uint8_t) (i * 3);\n      sum += data[i];\n    }\n\n    const jerry_char_t eval_test_arraybuffer[] = TEST_STRING_LITERAL (\n      \"var sum = 0;\"\n      \"for (var i = 0; i < array.length; i++)\"\n      \"{\"\n      \"  var expected = i * 3;\"\n      \"  assert(array[i] == expected, 'Array at index ' + i + ' was: ' + array[i] + ' should be: ' + expected);\"\n      \"  sum += array[i]\"\n      \"};\"\n      \"sum\");\n    jerry_value_t res = jerry_eval (eval_test_arraybuffer, sizeof (eval_test_arraybuffer) - 1, JERRY_PARSE_STRICT_MODE);\n    TEST_ASSERT (jerry_value_is_number (res));\n    TEST_ASSERT (jerry_value_as_number (res) == sum);\n    jerry_value_free (res);\n\n    jerry_value_free (buffer);\n  }\n\n  /* Test internal ArrayBuffer detach */\n  {\n    const uint32_t length = 4;\n    jerry_value_t arraybuffer = jerry_arraybuffer (length);\n    TEST_ASSERT (jerry_arraybuffer_has_buffer (arraybuffer));\n    TEST_ASSERT (!jerry_value_is_exception (arraybuffer));\n    TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n    TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == length);\n    TEST_ASSERT (jerry_arraybuffer_is_detachable (arraybuffer));\n\n    jerry_value_t res = jerry_arraybuffer_detach (arraybuffer);\n    TEST_ASSERT (!jerry_arraybuffer_has_buffer (arraybuffer));\n    TEST_ASSERT (!jerry_value_is_exception (res));\n    TEST_ASSERT (jerry_arraybuffer_data (arraybuffer) == NULL);\n    TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == 0);\n    TEST_ASSERT (!jerry_arraybuffer_is_detachable (arraybuffer));\n\n    jerry_value_free (res);\n    jerry_value_free (arraybuffer);\n  }\n\n  /* Test external ArrayBuffer detach */\n  {\n    const uint32_t length = 64;\n    jerry_value_t arraybuffer = jerry_arraybuffer_external (NULL, length, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (arraybuffer));\n    TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n    TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == length);\n    TEST_ASSERT (!jerry_arraybuffer_has_buffer (arraybuffer));\n\n    uint8_t buf[1] = { 1 };\n    TEST_ASSERT (jerry_arraybuffer_write (arraybuffer, 0, buf, 1) == 1);\n    TEST_ASSERT (jerry_arraybuffer_has_buffer (arraybuffer));\n    TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == length);\n    TEST_ASSERT (jerry_arraybuffer_is_detachable (arraybuffer));\n\n    jerry_value_t res = jerry_arraybuffer_detach (arraybuffer);\n    TEST_ASSERT (!jerry_value_is_exception (res));\n    TEST_ASSERT (jerry_arraybuffer_data (arraybuffer) == NULL);\n    TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == 0);\n    TEST_ASSERT (!jerry_arraybuffer_has_buffer (arraybuffer));\n    TEST_ASSERT (!jerry_arraybuffer_is_detachable (arraybuffer));\n\n    jerry_value_free (res);\n    jerry_value_free (arraybuffer);\n  }\n\n  /* Test ArrayBuffer created in ECMAScript */\n  for (int i = 0; i < 3; i++)\n  {\n    const jerry_char_t source[] = TEST_STRING_LITERAL (\"new ArrayBuffer(64)\");\n    jerry_value_t arraybuffer = jerry_eval (source, sizeof (source) - 1, JERRY_PARSE_NO_OPTS);\n    TEST_ASSERT (!jerry_value_is_exception (arraybuffer));\n    TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n    TEST_ASSERT (!jerry_arraybuffer_has_buffer (arraybuffer));\n\n    if (i == 0)\n    {\n      uint8_t buf[2] = { 2, 3 };\n      TEST_ASSERT (jerry_arraybuffer_write (arraybuffer, 63, buf, 2) == 1);\n    }\n    else if (i == 1)\n    {\n      uint8_t buf[2] = { 1, 1 };\n      TEST_ASSERT (jerry_arraybuffer_read (arraybuffer, 63, buf, 2) == 1);\n      TEST_ASSERT (buf[0] == 0 && buf[1] == 1);\n    }\n    else\n    {\n      uint8_t *buffer_p = jerry_arraybuffer_data (arraybuffer);\n      TEST_ASSERT (buffer_p != NULL);\n    }\n\n    TEST_ASSERT (jerry_arraybuffer_has_buffer (arraybuffer));\n\n    jerry_value_free (arraybuffer);\n  }\n\n  jerry_cleanup ();\n\n  TEST_ASSERT (allocate_count == 1);\n  TEST_ASSERT (free_count == 2);\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-backtrace.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic jerry_value_t\nbacktrace_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                   const jerry_value_t args_p[], /**< argument list */\n                   const jerry_length_t args_count) /**< argument count */\n{\n  JERRY_UNUSED (call_info_p);\n\n  uint32_t max_depth = 0;\n\n  if (args_count >= 1 && jerry_value_is_number (args_p[0]))\n  {\n    max_depth = (uint32_t) jerry_value_as_number (args_p[0]);\n  }\n\n  return jerry_backtrace (max_depth);\n} /* backtrace_handler */\n\nstatic void\ncompare_string (jerry_value_t left_value, /* string value */\n                const char *right_p) /* string to compare */\n{\n  jerry_char_t buffer[64];\n  size_t length = strlen (right_p);\n\n  TEST_ASSERT (length <= sizeof (buffer));\n  TEST_ASSERT (jerry_value_is_string (left_value));\n  TEST_ASSERT (jerry_string_size (left_value, JERRY_ENCODING_CESU8) == length);\n\n  TEST_ASSERT (jerry_string_to_buffer (left_value, JERRY_ENCODING_CESU8, buffer, sizeof (buffer)) == length);\n  TEST_ASSERT (memcmp (buffer, right_p, length) == 0);\n} /* compare_string */\n\nstatic const jerry_value_t *handler_args_p;\nstatic int frame_index;\n\nstatic bool\nbacktrace_callback (jerry_frame_t *frame_p, /* frame information */\n                    void *user_p) /* user data */\n{\n  TEST_ASSERT ((void *) handler_args_p == user_p);\n  TEST_ASSERT (jerry_frame_type (frame_p) == JERRY_BACKTRACE_FRAME_JS);\n\n  const jerry_frame_location_t *location_p = jerry_frame_location (frame_p);\n  const jerry_value_t *function_p = jerry_frame_callee (frame_p);\n  const jerry_value_t *this_p = jerry_frame_this (frame_p);\n\n  TEST_ASSERT (location_p != NULL);\n  TEST_ASSERT (function_p != NULL);\n  TEST_ASSERT (this_p != NULL);\n\n  compare_string (location_p->source_name, \"capture_test.js\");\n\n  ++frame_index;\n\n  if (frame_index == 1)\n  {\n    TEST_ASSERT (!jerry_frame_is_strict (frame_p));\n    TEST_ASSERT (location_p->line == 2);\n    TEST_ASSERT (location_p->column == 3);\n    TEST_ASSERT (handler_args_p[0] == *function_p);\n    TEST_ASSERT (handler_args_p[1] == *this_p);\n    return true;\n  }\n\n  if (frame_index == 2)\n  {\n    TEST_ASSERT (jerry_frame_is_strict (frame_p));\n    TEST_ASSERT (location_p->line == 7);\n    TEST_ASSERT (location_p->column == 6);\n    TEST_ASSERT (handler_args_p[2] == *function_p);\n    TEST_ASSERT (jerry_value_is_undefined (*this_p));\n    return true;\n  }\n\n  jerry_value_t global = jerry_current_realm ();\n\n  TEST_ASSERT (frame_index == 3);\n  TEST_ASSERT (!jerry_frame_is_strict (frame_p));\n  TEST_ASSERT (location_p->line == 11);\n  TEST_ASSERT (location_p->column == 3);\n  TEST_ASSERT (handler_args_p[3] == *function_p);\n  TEST_ASSERT (global == *this_p);\n\n  jerry_value_free (global);\n  return false;\n} /* backtrace_callback */\n\nstatic bool\nasync_backtrace_callback (jerry_frame_t *frame_p, /* frame information */\n                          void *user_p) /* user data */\n{\n  TEST_ASSERT ((void *) handler_args_p == user_p);\n  TEST_ASSERT (jerry_frame_type (frame_p) == JERRY_BACKTRACE_FRAME_JS);\n\n  const jerry_frame_location_t *location_p = jerry_frame_location (frame_p);\n  const jerry_value_t *function_p = jerry_frame_callee (frame_p);\n\n  TEST_ASSERT (location_p != NULL);\n  TEST_ASSERT (function_p != NULL);\n\n  compare_string (location_p->source_name, \"async_capture_test.js\");\n\n  ++frame_index;\n\n  if (frame_index == 1)\n  {\n    TEST_ASSERT (jerry_frame_is_strict (frame_p));\n    TEST_ASSERT (location_p->line == 3);\n    TEST_ASSERT (location_p->column == 3);\n    TEST_ASSERT (handler_args_p[0] == *function_p);\n    return true;\n  }\n\n  TEST_ASSERT (frame_index == 2);\n  TEST_ASSERT (!jerry_frame_is_strict (frame_p));\n  TEST_ASSERT (location_p->line == 8);\n  TEST_ASSERT (location_p->column == 3);\n  TEST_ASSERT (handler_args_p[1] == *function_p);\n  return true;\n} /* async_backtrace_callback */\n\nstatic bool\nclass_backtrace_callback (jerry_frame_t *frame_p, /* frame information */\n                          void *user_p) /* user data */\n{\n  TEST_ASSERT ((void *) handler_args_p == user_p);\n  TEST_ASSERT (jerry_frame_type (frame_p) == JERRY_BACKTRACE_FRAME_JS);\n\n  const jerry_frame_location_t *location_p = jerry_frame_location (frame_p);\n  const jerry_value_t *function_p = jerry_frame_callee (frame_p);\n\n  TEST_ASSERT (location_p != NULL);\n  TEST_ASSERT (function_p != NULL);\n\n  compare_string (location_p->source_name, \"class_capture_test.js\");\n\n  ++frame_index;\n\n  if (frame_index == 1)\n  {\n    TEST_ASSERT (jerry_frame_is_strict (frame_p));\n    TEST_ASSERT (location_p->line == 3);\n    TEST_ASSERT (location_p->column == 14);\n    return false;\n  }\n\n  TEST_ASSERT (frame_index == 2);\n  TEST_ASSERT (jerry_frame_is_strict (frame_p));\n  TEST_ASSERT (location_p->line == 2);\n  TEST_ASSERT (location_p->column == 7);\n  return false;\n} /* class_backtrace_callback */\n\nstatic jerry_value_t\ncapture_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                 const jerry_value_t args_p[], /**< argument list */\n                 const jerry_length_t args_count) /**< argument count */\n{\n  JERRY_UNUSED (call_info_p);\n\n  TEST_ASSERT (args_count == 0 || args_count == 2 || args_count == 4);\n  TEST_ASSERT (args_count == 0 || frame_index == 0);\n\n  jerry_backtrace_cb_t callback = backtrace_callback;\n\n  if (args_count == 0)\n  {\n    callback = class_backtrace_callback;\n  }\n  else if (args_count == 2)\n  {\n    callback = async_backtrace_callback;\n  }\n\n  handler_args_p = args_p;\n  jerry_backtrace_capture (callback, (void *) args_p);\n\n  TEST_ASSERT (args_count == 0 || frame_index == (args_count == 4 ? 3 : 2));\n\n  return jerry_undefined ();\n} /* capture_handler */\n\nstatic bool\nglobal_backtrace_callback (jerry_frame_t *frame_p, /* frame information */\n                           void *user_p) /* user data */\n{\n  TEST_ASSERT (user_p != NULL && frame_index == 0);\n  frame_index++;\n\n  const jerry_value_t *function_p = jerry_frame_callee (frame_p);\n  jerry_value_t *result_p = ((jerry_value_t *) user_p);\n\n  TEST_ASSERT (function_p != NULL);\n  jerry_value_free (*result_p);\n  *result_p = jerry_value_copy (*function_p);\n  return true;\n} /* global_backtrace_callback */\n\nstatic jerry_value_t\nglobal_capture_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                        const jerry_value_t args_p[], /**< argument list */\n                        const jerry_length_t args_count) /**< argument count */\n{\n  JERRY_UNUSED (call_info_p);\n  JERRY_UNUSED (args_p);\n  JERRY_UNUSED (args_count);\n\n  jerry_value_t result = jerry_undefined ();\n  jerry_backtrace_capture (global_backtrace_callback, &result);\n\n  TEST_ASSERT (jerry_value_is_object (result));\n  return result;\n} /* global_capture_handler */\n\nstatic void\nregister_callback (jerry_external_handler_t handler_p, /**< callback function */\n                   char *name_p) /**< name of the function */\n{\n  jerry_value_t global = jerry_current_realm ();\n\n  jerry_value_t func = jerry_function_external (handler_p);\n  jerry_value_t name = jerry_string_sz (name_p);\n  jerry_value_t result = jerry_object_set (global, name, func);\n  TEST_ASSERT (!jerry_value_is_exception (result));\n\n  jerry_value_free (result);\n  jerry_value_free (name);\n  jerry_value_free (func);\n\n  jerry_value_free (global);\n} /* register_callback */\n\nstatic jerry_value_t\nrun (const char *source_name_p, /**< source name */\n     const char *source_p) /**< source code */\n{\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (source_name_p);\n\n  jerry_value_t code = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), &parse_options);\n  jerry_value_free (parse_options.source_name);\n  TEST_ASSERT (!jerry_value_is_exception (code));\n\n  jerry_value_t result = jerry_run (code);\n  jerry_value_free (code);\n\n  return result;\n} /* run */\n\nstatic void\ncompare (jerry_value_t array, /**< array */\n         uint32_t index, /**< item index */\n         const char *str) /**< string to compare */\n{\n  jerry_char_t buf[64];\n\n  size_t len = strlen (str);\n\n  TEST_ASSERT (len < sizeof (buf));\n\n  jerry_value_t value = jerry_object_get_index (array, index);\n\n  TEST_ASSERT (!jerry_value_is_exception (value) && jerry_value_is_string (value));\n\n  TEST_ASSERT (jerry_string_size (value, JERRY_ENCODING_CESU8) == len);\n\n  jerry_size_t str_len = jerry_string_to_buffer (value, JERRY_ENCODING_CESU8, buf, (jerry_size_t) len);\n  TEST_ASSERT (str_len == len);\n\n  jerry_value_free (value);\n\n  TEST_ASSERT (memcmp (buf, str, len) == 0);\n} /* compare */\n\nstatic void\ntest_get_backtrace_api_call (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  register_callback (backtrace_handler, \"backtrace\");\n  register_callback (capture_handler, \"capture\");\n\n  const char *source_p = (\"function f() {\\n\"\n                          \"  return backtrace(0);\\n\"\n                          \"}\\n\"\n                          \"\\n\"\n                          \"function g() {\\n\"\n                          \"  return f();\\n\"\n                          \"}\\n\"\n                          \"\\n\"\n                          \"function h() {\\n\"\n                          \"  return g();\\n\"\n                          \"}\\n\"\n                          \"\\n\"\n                          \"h();\\n\");\n\n  jerry_value_t backtrace = run (\"something.js\", source_p);\n\n  TEST_ASSERT (!jerry_value_is_exception (backtrace) && jerry_value_is_array (backtrace));\n\n  TEST_ASSERT (jerry_array_length (backtrace) == 4);\n\n  compare (backtrace, 0, \"something.js:2:3\");\n  compare (backtrace, 1, \"something.js:6:3\");\n  compare (backtrace, 2, \"something.js:10:3\");\n  compare (backtrace, 3, \"something.js:13:1\");\n\n  jerry_value_free (backtrace);\n\n  /* Depth set to 2 this time. */\n\n  source_p = (\"function f() {\\n\"\n              \"  1; return backtrace(2);\\n\"\n              \"}\\n\"\n              \"\\n\"\n              \"function g() {\\n\"\n              \"  return f();\\n\"\n              \"}\\n\"\n              \"\\n\"\n              \"function h() {\\n\"\n              \"  return g();\\n\"\n              \"}\\n\"\n              \"\\n\"\n              \"h();\\n\");\n\n  backtrace = run (\"something_else.js\", source_p);\n\n  TEST_ASSERT (!jerry_value_is_exception (backtrace) && jerry_value_is_array (backtrace));\n\n  TEST_ASSERT (jerry_array_length (backtrace) == 2);\n\n  compare (backtrace, 0, \"something_else.js:2:6\");\n  compare (backtrace, 1, \"something_else.js:6:3\");\n\n  jerry_value_free (backtrace);\n\n  /* Test frame capturing. */\n\n  frame_index = 0;\n  source_p = (\"var o = { f:function() {\\n\"\n              \"  return capture(o.f, o, g, h);\\n\"\n              \"} }\\n\"\n              \"\\n\"\n              \"function g() {\\n\"\n              \"  'use strict';\\n\"\n              \"  1; return o.f();\\n\"\n              \"}\\n\"\n              \"\\n\"\n              \"function h() {\\n\"\n              \"  return g();\\n\"\n              \"}\\n\"\n              \"\\n\"\n              \"h();\\n\");\n\n  jerry_value_t result = run (\"capture_test.js\", source_p);\n\n  TEST_ASSERT (jerry_value_is_undefined (result));\n  jerry_value_free (result);\n\n  TEST_ASSERT (frame_index == 3);\n\n  /* Test async frame capturing. */\n  source_p = \"async function f() {}\";\n  result = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), JERRY_PARSE_NO_OPTS);\n\n  if (!jerry_value_is_exception (result))\n  {\n    jerry_value_free (result);\n\n    frame_index = 0;\n    source_p = (\"function f() {\\n\"\n                \"  'use strict';\\n\"\n                \"  return capture(f, g);\\n\"\n                \"}\\n\"\n                \"\\n\"\n                \"async function g() {\\n\"\n                \"  await 0;\\n\"\n                \"  return f();\\n\"\n                \"}\\n\"\n                \"\\n\"\n                \"g();\\n\");\n\n    result = run (\"async_capture_test.js\", source_p);\n\n    TEST_ASSERT (jerry_value_is_promise (result));\n    jerry_value_free (result);\n\n    TEST_ASSERT (frame_index == 0);\n\n    result = jerry_run_jobs ();\n    TEST_ASSERT (!jerry_value_is_exception (result));\n\n    TEST_ASSERT (frame_index == 2);\n  }\n  else\n  {\n    TEST_ASSERT (jerry_error_type (result) == JERRY_ERROR_SYNTAX);\n  }\n\n  jerry_value_free (result);\n\n  /* Test class initializer frame capturing. */\n  source_p = \"class C {}\";\n  result = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), JERRY_PARSE_NO_OPTS);\n\n  if (!jerry_value_is_exception (result))\n  {\n    jerry_value_free (result);\n\n    frame_index = 0;\n    source_p = (\"class C {\\n\"\n                \"  a = capture();\\n\"\n                \"  static b = capture();\\n\"\n                \"}\\n\"\n                \"new C;\\n\");\n\n    result = run (\"class_capture_test.js\", source_p);\n\n    TEST_ASSERT (!jerry_value_is_exception (result));\n    TEST_ASSERT (frame_index == 2);\n  }\n  else\n  {\n    TEST_ASSERT (jerry_error_type (result) == JERRY_ERROR_SYNTAX);\n  }\n\n  jerry_value_free (result);\n\n  register_callback (global_capture_handler, \"global_capture\");\n\n  frame_index = 0;\n\n  source_p = \"global_capture()\";\n\n  jerry_value_t code = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), NULL);\n  TEST_ASSERT (!jerry_value_is_exception (code));\n\n  result = jerry_run (code);\n\n  jerry_value_t compare_value = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, result, code);\n  TEST_ASSERT (jerry_value_is_true (compare_value));\n\n  jerry_value_free (compare_value);\n  jerry_value_free (result);\n  jerry_value_free (code);\n\n  jerry_cleanup ();\n} /* test_get_backtrace_api_call */\n\nstatic void\ntest_exception_backtrace (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const char *source = (\"function f() {\\n\"\n                        \"  undef_reference;\\n\"\n                        \"}\\n\"\n                        \"\\n\"\n                        \"function g() {\\n\"\n                        \"  return f();\\n\"\n                        \"}\\n\"\n                        \"\\n\"\n                        \"g();\\n\");\n\n  jerry_value_t error = run (\"bad.js\", source);\n\n  TEST_ASSERT (jerry_value_is_exception (error));\n\n  error = jerry_exception_value (error, true);\n\n  TEST_ASSERT (jerry_value_is_object (error));\n\n  jerry_value_t name = jerry_string_sz (\"stack\");\n  jerry_value_t backtrace = jerry_object_get (error, name);\n\n  jerry_value_free (name);\n  jerry_value_free (error);\n\n  TEST_ASSERT (!jerry_value_is_exception (backtrace) && jerry_value_is_array (backtrace));\n\n  TEST_ASSERT (jerry_array_length (backtrace) == 3);\n\n  compare (backtrace, 0, \"bad.js:2:3\");\n  compare (backtrace, 1, \"bad.js:6:3\");\n  compare (backtrace, 2, \"bad.js:9:1\");\n\n  jerry_value_free (backtrace);\n\n  jerry_cleanup ();\n} /* test_exception_backtrace */\n\nstatic void\ntest_large_line_count (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const char *source = (\"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n                        \"g();\\n\");\n\n  jerry_value_t error = run (\"bad.js\", source);\n\n  TEST_ASSERT (jerry_value_is_exception (error));\n\n  error = jerry_exception_value (error, true);\n\n  TEST_ASSERT (jerry_value_is_object (error));\n\n  jerry_value_t name = jerry_string_sz (\"stack\");\n  jerry_value_t backtrace = jerry_object_get (error, name);\n\n  jerry_value_free (name);\n  jerry_value_free (error);\n\n  TEST_ASSERT (!jerry_value_is_exception (backtrace) && jerry_value_is_array (backtrace));\n\n  TEST_ASSERT (jerry_array_length (backtrace) == 1);\n\n  compare (backtrace, 0, \"bad.js:385:1\");\n\n  jerry_value_free (backtrace);\n\n  jerry_cleanup ();\n} /* test_large_line_count */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  TEST_ASSERT (jerry_feature_enabled (JERRY_FEATURE_LINE_INFO));\n\n  test_get_backtrace_api_call ();\n  test_exception_backtrace ();\n  test_large_line_count ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-bigint.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nint\nmain (void)\n{\n  if (!jerry_feature_enabled (JERRY_FEATURE_BIGINT))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Bigint support is disabled!\\n\");\n    return 0;\n  }\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t string = jerry_string_sz (\"0xfffffff1fffffff2fffffff3\");\n  TEST_ASSERT (!jerry_value_is_exception (string));\n\n  jerry_value_t bigint = jerry_value_to_bigint (string);\n  jerry_value_free (string);\n\n  TEST_ASSERT (!jerry_value_is_exception (bigint));\n  TEST_ASSERT (jerry_value_is_bigint (bigint));\n\n  string = jerry_value_to_string (bigint);\n  TEST_ASSERT (!jerry_value_is_exception (string));\n\n  static jerry_char_t str_buffer[64];\n  const char *expected_string_p = \"79228162256009920505775652851\";\n\n  jerry_size_t size = jerry_string_to_buffer (string, JERRY_ENCODING_CESU8, str_buffer, sizeof (str_buffer));\n  TEST_ASSERT (size == strlen (expected_string_p));\n  TEST_ASSERT (memcmp (str_buffer, expected_string_p, size) == 0);\n  jerry_value_free (string);\n\n  TEST_ASSERT (jerry_bigint_digit_count (bigint) == 2);\n\n  uint64_t digits_buffer[4];\n  bool sign;\n\n  memset (digits_buffer, 0xff, sizeof (digits_buffer));\n  sign = true;\n  jerry_bigint_to_digits (bigint, digits_buffer, 0, &sign);\n  TEST_ASSERT (sign == false);\n  TEST_ASSERT (digits_buffer[0] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[1] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[2] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[3] == ~((uint64_t) 0));\n\n  memset (digits_buffer, 0xff, sizeof (digits_buffer));\n  sign = true;\n  jerry_bigint_to_digits (bigint, digits_buffer, 1, &sign);\n  TEST_ASSERT (sign == false);\n  TEST_ASSERT (digits_buffer[0] == 0xfffffff2fffffff3ull);\n  TEST_ASSERT (digits_buffer[1] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[2] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[3] == ~((uint64_t) 0));\n\n  memset (digits_buffer, 0xff, sizeof (digits_buffer));\n  sign = true;\n  jerry_bigint_to_digits (bigint, digits_buffer, 2, &sign);\n  TEST_ASSERT (sign == false);\n  TEST_ASSERT (digits_buffer[0] == 0xfffffff2fffffff3ull);\n  TEST_ASSERT (digits_buffer[1] == 0xfffffff1ull);\n  TEST_ASSERT (digits_buffer[2] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[3] == ~((uint64_t) 0));\n\n  memset (digits_buffer, 0xff, sizeof (digits_buffer));\n  sign = true;\n  jerry_bigint_to_digits (bigint, digits_buffer, 3, &sign);\n  TEST_ASSERT (sign == false);\n  TEST_ASSERT (digits_buffer[0] == 0xfffffff2fffffff3ull);\n  TEST_ASSERT (digits_buffer[1] == 0xfffffff1ull);\n  TEST_ASSERT (digits_buffer[2] == 0);\n  TEST_ASSERT (digits_buffer[3] == ~((uint64_t) 0));\n\n  memset (digits_buffer, 0xff, sizeof (digits_buffer));\n  jerry_bigint_to_digits (bigint, digits_buffer, 4, NULL);\n  TEST_ASSERT (digits_buffer[0] == 0xfffffff2fffffff3ull);\n  TEST_ASSERT (digits_buffer[1] == 0xfffffff1ull);\n  TEST_ASSERT (digits_buffer[2] == 0);\n  TEST_ASSERT (digits_buffer[3] == 0);\n\n  jerry_value_free (bigint);\n\n  digits_buffer[0] = 0;\n  digits_buffer[1] = 0;\n  digits_buffer[2] = 0;\n  /* Sign of zero value is always positive, even if we set negative. */\n  bigint = jerry_bigint (digits_buffer, 3, true);\n  TEST_ASSERT (jerry_value_is_bigint (bigint));\n  TEST_ASSERT (jerry_bigint_digit_count (bigint) == 0);\n\n  memset (digits_buffer, 0xff, sizeof (digits_buffer));\n  sign = true;\n  jerry_bigint_to_digits (bigint, digits_buffer, 2, &sign);\n  TEST_ASSERT (sign == false);\n  TEST_ASSERT (digits_buffer[0] == 0);\n  TEST_ASSERT (digits_buffer[1] == 0);\n  TEST_ASSERT (digits_buffer[2] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[3] == ~((uint64_t) 0));\n\n  jerry_value_free (bigint);\n\n  digits_buffer[0] = 1;\n  digits_buffer[1] = 0;\n  digits_buffer[2] = 0;\n  digits_buffer[3] = 0;\n  bigint = jerry_bigint (digits_buffer, 4, true);\n  TEST_ASSERT (jerry_value_is_bigint (bigint));\n  TEST_ASSERT (jerry_bigint_digit_count (bigint) == 1);\n\n  memset (digits_buffer, 0xff, sizeof (digits_buffer));\n  sign = false;\n  jerry_bigint_to_digits (bigint, digits_buffer, 1, &sign);\n  TEST_ASSERT (sign == true);\n  TEST_ASSERT (digits_buffer[0] == 1);\n  TEST_ASSERT (digits_buffer[1] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[2] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[3] == ~((uint64_t) 0));\n\n  memset (digits_buffer, 0xff, sizeof (digits_buffer));\n  sign = false;\n  jerry_bigint_to_digits (bigint, digits_buffer, 2, &sign);\n  TEST_ASSERT (sign == true);\n  TEST_ASSERT (digits_buffer[0] == 1);\n  TEST_ASSERT (digits_buffer[1] == 0);\n  TEST_ASSERT (digits_buffer[2] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[3] == ~((uint64_t) 0));\n\n  jerry_value_free (bigint);\n\n  digits_buffer[0] = 0;\n  digits_buffer[1] = 1;\n  digits_buffer[2] = 0;\n  digits_buffer[3] = 0;\n  bigint = jerry_bigint (digits_buffer, 4, true);\n  TEST_ASSERT (jerry_value_is_bigint (bigint));\n  TEST_ASSERT (jerry_bigint_digit_count (bigint) == 2);\n\n  memset (digits_buffer, 0xff, sizeof (digits_buffer));\n  sign = false;\n  jerry_bigint_to_digits (bigint, digits_buffer, 1, &sign);\n  TEST_ASSERT (sign == true);\n  TEST_ASSERT (digits_buffer[0] == 0);\n  TEST_ASSERT (digits_buffer[1] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[2] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[3] == ~((uint64_t) 0));\n\n  memset (digits_buffer, 0xff, sizeof (digits_buffer));\n  sign = false;\n  jerry_bigint_to_digits (bigint, digits_buffer, 2, &sign);\n  TEST_ASSERT (sign == true);\n  TEST_ASSERT (digits_buffer[0] == 0);\n  TEST_ASSERT (digits_buffer[1] == 1);\n  TEST_ASSERT (digits_buffer[2] == ~((uint64_t) 0));\n  TEST_ASSERT (digits_buffer[3] == ~((uint64_t) 0));\n\n  memset (digits_buffer, 0xff, sizeof (digits_buffer));\n  sign = false;\n  jerry_bigint_to_digits (bigint, digits_buffer, 3, &sign);\n  TEST_ASSERT (sign == true);\n  TEST_ASSERT (digits_buffer[0] == 0);\n  TEST_ASSERT (digits_buffer[1] == 1);\n  TEST_ASSERT (digits_buffer[2] == 0);\n  TEST_ASSERT (digits_buffer[3] == ~((uint64_t) 0));\n\n  jerry_value_free (bigint);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-common.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef TEST_COMMON_H\n#define TEST_COMMON_H\n\n#include <math.h>\n#include <setjmp.h>\n#include <stdarg.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"jerryscript-port.h\"\n\n#define JERRY_UNUSED(x) ((void) (x))\n\n#define TEST_ASSERT(x)                                           \\\n  do                                                             \\\n  {                                                              \\\n    if (JERRY_UNLIKELY (!(x)))                                   \\\n    {                                                            \\\n      jerry_log (JERRY_LOG_LEVEL_ERROR,                          \\\n                 \"TEST: Assertion '%s' failed at %s(%s):%lu.\\n\", \\\n                 #x,                                             \\\n                 __FILE__,                                       \\\n                 __func__,                                       \\\n                 (unsigned long) __LINE__);                      \\\n      jerry_port_fatal (JERRY_FATAL_FAILED_ASSERTION);           \\\n    }                                                            \\\n  } while (0)\n\n#define TEST_ASSERT_STR(EXPECTED, RESULT)                          \\\n  do                                                               \\\n  {                                                                \\\n    const char* __expected = (const char*) (EXPECTED);             \\\n    const char* __result = (const char*) (RESULT);                 \\\n    if (strcmp (__expected, __result) != 0)                        \\\n    {                                                              \\\n      jerry_log (JERRY_LOG_LEVEL_ERROR,                            \\\n                 \"TEST: String comparison failed at %s(%s):%lu.\\n\" \\\n                 \" Expected: '%s'\\n Got: '%s'\\n\",                  \\\n                 __FILE__,                                         \\\n                 __func__,                                         \\\n                 (unsigned long) __LINE__,                         \\\n                 __expected,                                       \\\n                 __result);                                        \\\n      jerry_port_fatal (JERRY_FATAL_FAILED_ASSERTION);             \\\n    }                                                              \\\n  } while (0)\n\n/**\n * Test initialization statement that should be included\n * at the beginning of main function in every unit test.\n */\n#define TEST_INIT()                              \\\n  do                                             \\\n  {                                              \\\n    union                                        \\\n    {                                            \\\n      double d;                                  \\\n      unsigned u;                                \\\n    } now = { .d = jerry_port_current_time () }; \\\n    srand (now.u);                               \\\n  } while (0)\n\n/**\n * Dummy macro to enable the breaking of long string literals into multiple\n * substrings on separate lines. (Style checker doesn't allow it without putting\n * the whole literal into parentheses but the compiler warns about parenthesized\n * string constants.)\n */\n#define TEST_STRING_LITERAL(x) x\n\n#endif /* !TEST_COMMON_H */\n"
  },
  {
    "path": "tests/unit-core/test-container-operation.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_MAP) || !jerry_feature_enabled (JERRY_FEATURE_SET)\n      || !jerry_feature_enabled (JERRY_FEATURE_WEAKMAP) || !jerry_feature_enabled (JERRY_FEATURE_WEAKSET))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Containers are disabled!\\n\");\n    jerry_cleanup ();\n    return 0;\n  }\n\n  // Map container tests\n  jerry_value_t map = jerry_container (JERRY_CONTAINER_TYPE_MAP, NULL, 0);\n  TEST_ASSERT (jerry_container_type (map) == JERRY_CONTAINER_TYPE_MAP);\n\n  jerry_value_t key_str = jerry_string_sz (\"number\");\n  jerry_value_t number = jerry_number (10);\n  jerry_value_t args[2] = { key_str, number };\n  jerry_value_t result = jerry_container_op (JERRY_CONTAINER_OP_SET, map, args, 2);\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_GET, map, &key_str, 1);\n  TEST_ASSERT (jerry_value_as_number (result) == 10);\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_HAS, map, &key_str, 1);\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_SIZE, map, NULL, 0);\n  TEST_ASSERT (jerry_value_as_number (result) == 1);\n  jerry_value_free (result);\n\n  key_str = jerry_string_sz (\"number2\");\n  number = jerry_number (11);\n  jerry_value_t args2[2] = { key_str, number };\n  result = jerry_container_op (JERRY_CONTAINER_OP_SET, map, args2, 2);\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_SIZE, map, NULL, 0);\n  TEST_ASSERT (jerry_value_as_number (result) == 2);\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_DELETE, map, &key_str, 1);\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_SIZE, map, NULL, 0);\n  TEST_ASSERT (jerry_value_as_number (result) == 1);\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_CLEAR, map, NULL, 0);\n  TEST_ASSERT (jerry_value_is_undefined (result));\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_SIZE, map, NULL, 0);\n  TEST_ASSERT (jerry_value_as_number (result) == 0);\n  jerry_value_free (result);\n\n  // Set container tests\n  number = jerry_number (10);\n  jerry_value_t set = jerry_container (JERRY_CONTAINER_TYPE_SET, NULL, 0);\n  TEST_ASSERT (jerry_container_type (set) == JERRY_CONTAINER_TYPE_SET);\n  result = jerry_container_op (JERRY_CONTAINER_OP_ADD, set, &number, 1);\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_HAS, set, &number, 1);\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_SIZE, set, NULL, 0);\n  TEST_ASSERT (jerry_value_as_number (result) == 1);\n  jerry_value_free (result);\n\n  number = jerry_number (11);\n  result = jerry_container_op (JERRY_CONTAINER_OP_ADD, set, &number, 1);\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_SIZE, set, NULL, 0);\n  TEST_ASSERT (jerry_value_as_number (result) == 2);\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_DELETE, set, &number, 1);\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_SIZE, set, NULL, 0);\n  TEST_ASSERT (jerry_value_as_number (result) == 1);\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_CLEAR, set, NULL, 0);\n  TEST_ASSERT (jerry_value_is_undefined (result));\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_SIZE, set, NULL, 0);\n  TEST_ASSERT (jerry_value_as_number (result) == 0);\n  jerry_value_free (result);\n  jerry_value_free (set);\n\n  // WeakMap contanier tests\n  number = jerry_number (10);\n  jerry_value_t weak_map = jerry_container (JERRY_CONTAINER_TYPE_WEAKMAP, NULL, 0);\n  TEST_ASSERT (jerry_container_type (weak_map) == JERRY_CONTAINER_TYPE_WEAKMAP);\n\n  jerry_value_t obj = jerry_object ();\n  number = jerry_number (10);\n  jerry_value_t args4[2] = { obj, number };\n  result = jerry_container_op (JERRY_CONTAINER_OP_SET, weak_map, args4, 2);\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_HAS, weak_map, &obj, 1);\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_DELETE, weak_map, &obj, 1);\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n  jerry_value_free (weak_map);\n\n  // WeakSet contanier tests,\n  jerry_value_t weak_set = jerry_container (JERRY_CONTAINER_TYPE_WEAKSET, NULL, 0);\n  TEST_ASSERT (jerry_container_type (weak_set) == JERRY_CONTAINER_TYPE_WEAKSET);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_ADD, weak_set, &obj, 1);\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_HAS, weak_set, &obj, 1);\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  result = jerry_container_op (JERRY_CONTAINER_OP_DELETE, weak_set, &obj, 1);\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n  jerry_value_free (weak_set);\n\n  // container is not a object\n  jerry_value_t empty_val = jerry_undefined ();\n  result = jerry_container_op (JERRY_CONTAINER_OP_SET, empty_val, args, 2);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  // arguments is a error\n  const char *const error_message_p = \"Random error.\";\n  jerry_value_t error_val = jerry_throw_sz (JERRY_ERROR_RANGE, error_message_p);\n  jerry_value_t args3[2] = { error_val, error_val };\n  result = jerry_container_op (JERRY_CONTAINER_OP_SET, map, args3, 2);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n  jerry_value_free (error_val);\n  jerry_value_free (map);\n\n  jerry_value_free (key_str);\n  jerry_value_free (number);\n  jerry_value_free (obj);\n  jerry_cleanup ();\n  return 0;\n\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-container.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic int global_counter;\n\nstatic void\nnative_free_callback (void *native_p, /**< native pointer */\n                      jerry_object_native_info_t *info_p) /**< native info */\n{\n  TEST_ASSERT (native_p == (void *) &global_counter);\n  TEST_ASSERT (info_p->free_cb == native_free_callback);\n  global_counter++;\n} /* native_free_callback */\n\nstatic const jerry_object_native_info_t native_info = {\n  .free_cb = native_free_callback,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic jerry_value_t\ncreate_array_from_container_handler (const jerry_call_info_t *call_info_p,\n                                     const jerry_value_t args_p[],\n                                     const jerry_length_t args_count)\n{\n  JERRY_UNUSED (call_info_p);\n\n  if (args_count < 2)\n  {\n    return jerry_undefined ();\n  }\n\n  bool is_key_value_pairs = false;\n  jerry_value_t result = jerry_container_to_array (args_p[0], &is_key_value_pairs);\n\n  TEST_ASSERT (is_key_value_pairs == jerry_value_is_true (args_p[1]));\n  return result;\n} /* create_array_from_container_handler */\n\nstatic void\nrun_eval (const char *source_p)\n{\n  jerry_value_t result = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);\n\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n} /* run_eval */\n\nstatic void\nrun_eval_error (const char *source_p)\n{\n  jerry_value_t result = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);\n  jerry_value_free (result);\n} /* run_eval_error */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_MAP) || !jerry_feature_enabled (JERRY_FEATURE_SET)\n      || !jerry_feature_enabled (JERRY_FEATURE_WEAKMAP) || !jerry_feature_enabled (JERRY_FEATURE_WEAKSET))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Containers are disabled!\\n\");\n    jerry_cleanup ();\n    return 0;\n  }\n\n  jerry_value_t instance_check;\n  jerry_value_t global = jerry_current_realm ();\n  jerry_value_t map_str = jerry_string_sz (\"Map\");\n  jerry_value_t set_str = jerry_string_sz (\"Set\");\n  jerry_value_t weakmap_str = jerry_string_sz (\"WeakMap\");\n  jerry_value_t weakset_str = jerry_string_sz (\"WeakSet\");\n  jerry_value_t global_map = jerry_object_get (global, map_str);\n  jerry_value_t global_set = jerry_object_get (global, set_str);\n  jerry_value_t global_weakmap = jerry_object_get (global, weakmap_str);\n  jerry_value_t global_weakset = jerry_object_get (global, weakset_str);\n\n  jerry_value_t function = jerry_function_external (create_array_from_container_handler);\n  jerry_value_t name = jerry_string_sz (\"create_array_from_container\");\n  jerry_value_t res = jerry_object_set (global, name, function);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n\n  jerry_value_free (res);\n  jerry_value_free (name);\n  jerry_value_free (function);\n\n  jerry_value_free (global);\n\n  jerry_value_free (map_str);\n  jerry_value_free (set_str);\n  jerry_value_free (weakmap_str);\n  jerry_value_free (weakset_str);\n\n  jerry_value_t empty_map = jerry_container (JERRY_CONTAINER_TYPE_MAP, NULL, 0);\n  TEST_ASSERT (jerry_container_type (empty_map) == JERRY_CONTAINER_TYPE_MAP);\n  instance_check = jerry_binary_op (JERRY_BIN_OP_INSTANCEOF, empty_map, global_map);\n  TEST_ASSERT (jerry_value_is_true (instance_check));\n  jerry_value_free (instance_check);\n  jerry_value_free (global_map);\n  jerry_value_free (empty_map);\n\n  jerry_value_t empty_set = jerry_container (JERRY_CONTAINER_TYPE_SET, NULL, 0);\n  TEST_ASSERT (jerry_container_type (empty_set) == JERRY_CONTAINER_TYPE_SET);\n  instance_check = jerry_binary_op (JERRY_BIN_OP_INSTANCEOF, empty_set, global_set);\n  TEST_ASSERT (jerry_value_is_true (instance_check));\n  jerry_value_free (instance_check);\n  jerry_value_free (global_set);\n  jerry_value_free (empty_set);\n\n  jerry_value_t empty_weakmap = jerry_container (JERRY_CONTAINER_TYPE_WEAKMAP, NULL, 0);\n  TEST_ASSERT (jerry_container_type (empty_weakmap) == JERRY_CONTAINER_TYPE_WEAKMAP);\n  instance_check = jerry_binary_op (JERRY_BIN_OP_INSTANCEOF, empty_weakmap, global_weakmap);\n  TEST_ASSERT (jerry_value_is_true (instance_check));\n  jerry_value_free (instance_check);\n  jerry_value_free (global_weakmap);\n  jerry_value_free (empty_weakmap);\n\n  jerry_value_t empty_weakset = jerry_container (JERRY_CONTAINER_TYPE_WEAKSET, NULL, 0);\n  TEST_ASSERT (jerry_container_type (empty_weakset) == JERRY_CONTAINER_TYPE_WEAKSET);\n  instance_check = jerry_binary_op (JERRY_BIN_OP_INSTANCEOF, empty_weakset, global_weakset);\n  TEST_ASSERT (jerry_value_is_true (instance_check));\n  jerry_value_free (instance_check);\n  jerry_value_free (global_weakset);\n  jerry_value_free (empty_weakset);\n\n  const jerry_char_t source[] = TEST_STRING_LITERAL (\"(function () {\\n\"\n                                                     \"  var o1 = {}\\n\"\n                                                     \"  var o2 = {}\\n\"\n                                                     \"  var o3 = {}\\n\"\n                                                     \"  var wm = new WeakMap()\\n\"\n                                                     \"  wm.set(o1, o2)\\n\"\n                                                     \"  wm.set(o2, o3)\\n\"\n                                                     \"  return o3\\n\"\n                                                     \"})()\\n\");\n  jerry_value_t result = jerry_eval (source, sizeof (source) - 1, JERRY_PARSE_NO_OPTS);\n  TEST_ASSERT (jerry_value_is_object (result));\n\n  jerry_object_set_native_ptr (result, &native_info, (void *) &global_counter);\n  jerry_value_free (result);\n\n  global_counter = 0;\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (global_counter == 1);\n\n  run_eval (\"function assert(v) {\\n\"\n            \"  if(v !== true)\\n\"\n            \"    throw 'Assertion failed!'\\n\"\n            \"}\");\n\n  run_eval (\"function test_values(arr1, arr2) {\\n\"\n            \"  assert(Array.isArray(arr1));\\n\"\n            \"  assert(arr1.length == arr2.length);\\n\"\n            \"  for(let i = 0; i < arr1.length; i++) {\\n\"\n            \"    assert(arr1[i] === arr2[i]);\\n\"\n            \"  }\\n\"\n            \"}\\n\");\n\n  run_eval (\"var map = new Map();\\n\"\n            \"map.set(1, 3.14);\\n\"\n            \"map.set(2, true);\\n\"\n            \"map.set(3, 'foo');\\n\"\n            \"var set = new Set();\\n\"\n            \"set.add(3.14);\\n\"\n            \"set.add(true);\\n\"\n            \"set.add('foo');\\n\"\n            \"var obj = { x:3, y:'foo'};\\n\"\n            \"var b_int = 1n;\\n\"\n            \"var obj_bint_map = new Map();\\n\"\n            \"obj_bint_map.set(1, obj);\\n\"\n            \"obj_bint_map.set(2, b_int);\\n\");\n\n  run_eval (\"var result = create_array_from_container(map, true);\\n\"\n            \"test_values(result, [1, 3.14, 2, true, 3, 'foo']);\");\n\n  run_eval (\"var result = create_array_from_container(set, false);\\n\"\n            \"test_values(result, [3.14, true, 'foo']);\");\n\n  run_eval (\"var result = create_array_from_container(map.entries(), true);\\n\"\n            \"test_values(result, [1, 3.14, 2, true, 3, 'foo']);\");\n\n  run_eval (\"var result = create_array_from_container(map.keys(), false);\\n\"\n            \"test_values(result, [1, 2, 3,]);\");\n\n  run_eval (\"var result = create_array_from_container(map.values(), false);\\n\"\n            \"test_values(result, [3.14, true, 'foo']);\");\n\n  run_eval (\"var result = create_array_from_container(obj_bint_map, true)\\n\"\n            \"test_values(result, [1, obj, 2, b_int]);\");\n\n  run_eval (\"var map = new Map();\\n\"\n            \"map.set(1, 1);\\n\"\n            \"var iter = map.entries();\\n\"\n            \"iter.next();\\n\"\n            \"var result = create_array_from_container(iter, true);\\n\"\n            \"assert(Array.isArray(result));\\n\"\n            \"assert(result.length == 0);\");\n\n  run_eval (\"var ws = new WeakSet();\\n\"\n            \"var foo = {};\\n\"\n            \"var bar = {};\\n\"\n            \"ws.add(foo);\\n\"\n            \"ws.add(bar);\\n\"\n            \"var result = create_array_from_container(ws, false);\\n\"\n            \"test_values(result, [foo, bar]);\\n\");\n\n  run_eval (\"var ws = new WeakMap();\\n\"\n            \"var foo = {};\\n\"\n            \"var bar = {};\\n\"\n            \"ws.set(foo, 37);\\n\"\n            \"ws.set(bar, 'asd');\\n\"\n            \"var result = create_array_from_container(ws, true);\\n\"\n            \"test_values(result, [foo, 37, bar, 'asd']);\\n\");\n\n  run_eval_error (\"var iter = null;\\n\"\n                  \"var result = create_array_from_container(iter, false);\\n\"\n                  \"assert(result instanceof Error);\");\n\n  run_eval_error (\"var iter = 3;\\n\"\n                  \"var result = create_array_from_container(iter, false);\\n\"\n                  \"assert(result instanceof Error);\");\n\n  run_eval_error (\"var iter = [3.14, true, 'foo'].entries();\\n\"\n                  \"var result = create_array_from_container(iter, false);\\n\"\n                  \"assert(result instanceof Error);\");\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-context-data.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic bool test_context_data1_new_called = false;\nstatic bool test_context_data2_new_called = false;\nstatic bool test_context_data3_new_called = false;\nstatic bool test_context_data4_new_called = false;\nstatic bool test_context_data1_free_called = false;\nstatic bool test_context_data2_free_called = false;\nstatic bool test_context_data4_free_called = false;\nstatic bool test_context_data1_finalize_called = false;\nstatic bool test_context_data4_finalize_called = false;\n\n/* Context item 1 */\nconst char *string1 = \"item1\";\n\nstatic void\ntest_context_data1_new (void *user_data_p)\n{\n  test_context_data1_new_called = true;\n  *((const char **) user_data_p) = string1;\n} /* test_context_data1_new */\n\nstatic void\ntest_context_data1_free (void *user_data_p)\n{\n  test_context_data1_free_called = true;\n  TEST_ASSERT ((*(const char **) user_data_p) == string1);\n  TEST_ASSERT (!test_context_data1_finalize_called);\n} /* test_context_data1_free */\n\nstatic void\ntest_context_data1_finalize (void *user_data_p)\n{\n  TEST_ASSERT (test_context_data1_free_called);\n  TEST_ASSERT (!test_context_data1_finalize_called);\n  TEST_ASSERT ((*(const char **) user_data_p) == string1);\n  test_context_data1_finalize_called = true;\n} /* test_context_data1_finalize */\n\nstatic const jerry_context_data_manager_t manager1 = { .init_cb = test_context_data1_new,\n                                                       .deinit_cb = test_context_data1_free,\n                                                       .finalize_cb = test_context_data1_finalize,\n                                                       .bytes_needed = sizeof (const char *) };\n\n/* Context item 2 */\nconst char *string2 = \"item2\";\n\nstatic void\ntest_context_data2_new (void *user_data_p)\n{\n  test_context_data2_new_called = true;\n  *((const char **) user_data_p) = string2;\n} /* test_context_data2_new */\n\nstatic void\ntest_context_data2_free (void *user_data_p)\n{\n  test_context_data2_free_called = true;\n  TEST_ASSERT ((*(const char **) user_data_p) == string2);\n} /* test_context_data2_free */\n\nstatic const jerry_context_data_manager_t manager2 = { .init_cb = test_context_data2_new,\n                                                       .deinit_cb = test_context_data2_free,\n                                                       .bytes_needed = sizeof (const char *) };\n\n/* Context item 3 */\n\nstatic void\ntest_context_data3_new (void *user_data_p)\n{\n  JERRY_UNUSED (user_data_p);\n  test_context_data3_new_called = true;\n} /* test_context_data3_new */\n\nstatic const jerry_context_data_manager_t manager3 = {\n  .init_cb = test_context_data3_new,\n  /* NULL is allowed: */\n  .deinit_cb = NULL,\n  .finalize_cb = NULL,\n  .bytes_needed = 0,\n};\n\n/* Context item 4 */\n\nstatic void\ntest_context_data4_new (void *user_data_p)\n{\n  test_context_data4_new_called = true;\n  TEST_ASSERT (user_data_p == NULL);\n} /* test_context_data4_new */\n\nstatic void\ntest_context_data4_free (void *user_data_p)\n{\n  test_context_data4_free_called = true;\n  TEST_ASSERT (user_data_p == NULL);\n  TEST_ASSERT (!test_context_data4_finalize_called);\n} /* test_context_data4_free */\n\nstatic void\ntest_context_data4_finalize (void *user_data_p)\n{\n  TEST_ASSERT (!test_context_data4_finalize_called);\n  test_context_data4_finalize_called = true;\n  TEST_ASSERT (user_data_p == NULL);\n} /* test_context_data4_finalize */\n\nstatic const jerry_context_data_manager_t manager4 = { .init_cb = test_context_data4_new,\n                                                       .deinit_cb = test_context_data4_free,\n                                                       .finalize_cb = test_context_data4_finalize,\n                                                       .bytes_needed = 0 };\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  TEST_ASSERT (!strcmp (*((const char **) jerry_context_data (&manager1)), \"item1\"));\n  TEST_ASSERT (!strcmp (*((const char **) jerry_context_data (&manager2)), \"item2\"));\n  TEST_ASSERT (jerry_context_data (&manager3) == NULL);\n  TEST_ASSERT (jerry_context_data (&manager4) == NULL);\n\n  TEST_ASSERT (test_context_data1_new_called);\n  TEST_ASSERT (test_context_data2_new_called);\n  TEST_ASSERT (test_context_data3_new_called);\n  TEST_ASSERT (test_context_data4_new_called);\n\n  TEST_ASSERT (!test_context_data1_free_called);\n  TEST_ASSERT (!test_context_data2_free_called);\n  TEST_ASSERT (!test_context_data4_free_called);\n\n  jerry_cleanup ();\n\n  TEST_ASSERT (test_context_data1_free_called);\n  TEST_ASSERT (test_context_data2_free_called);\n  TEST_ASSERT (test_context_data4_free_called);\n\n  TEST_ASSERT (test_context_data1_finalize_called);\n  TEST_ASSERT (test_context_data4_finalize_called);\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-dataview.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nint\nmain (void)\n{\n  if (!jerry_feature_enabled (JERRY_FEATURE_DATAVIEW))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"DataView support is disabled!\\n\");\n    return 0;\n  }\n\n  /* DataView builtin requires the TypedArray builtin */\n  TEST_ASSERT (jerry_feature_enabled (JERRY_FEATURE_TYPEDARRAY));\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Test accessors */\n  jerry_value_t arraybuffer = jerry_arraybuffer (16);\n  jerry_value_t view1 = jerry_dataview (arraybuffer, 0, 16);\n  TEST_ASSERT (!jerry_value_is_exception (view1));\n  TEST_ASSERT (jerry_value_is_dataview (view1));\n\n  jerry_length_t byteOffset = 0;\n  jerry_length_t byteLength = 0;\n  ;\n  jerry_value_t internal_buffer = jerry_dataview_buffer (view1, &byteOffset, &byteLength);\n  TEST_ASSERT (jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, internal_buffer, arraybuffer));\n  TEST_ASSERT (byteOffset == 0);\n  TEST_ASSERT (byteLength == 16);\n  jerry_value_free (internal_buffer);\n\n  jerry_value_t view2 = jerry_dataview (arraybuffer, 12, 4);\n  TEST_ASSERT (!jerry_value_is_exception (view1));\n  TEST_ASSERT (jerry_value_is_dataview (view2));\n  internal_buffer = jerry_dataview_buffer (view2, &byteOffset, &byteLength);\n  TEST_ASSERT (jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, internal_buffer, arraybuffer));\n  TEST_ASSERT (byteOffset == 12);\n  TEST_ASSERT (byteLength == 4);\n  jerry_value_free (internal_buffer);\n\n  /* Test invalid construction */\n  jerry_value_t empty_object = jerry_object ();\n  jerry_value_t view3 = jerry_dataview (empty_object, 20, 10);\n  TEST_ASSERT (jerry_value_is_exception (view3));\n  jerry_value_t error_obj = jerry_exception_value (view3, true);\n  TEST_ASSERT (jerry_error_type (error_obj) == JERRY_ERROR_TYPE);\n  jerry_value_free (error_obj);\n  jerry_value_free (empty_object);\n\n  jerry_value_t view4 = jerry_dataview (arraybuffer, 20, 10);\n  TEST_ASSERT (jerry_value_is_exception (view3));\n  error_obj = jerry_exception_value (view4, true);\n  TEST_ASSERT (jerry_error_type (error_obj) == JERRY_ERROR_RANGE);\n  jerry_value_free (error_obj);\n\n  /* Test getting/setting values */\n  jerry_value_t global_obj = jerry_current_realm ();\n  jerry_value_t view1_str = jerry_string_sz (\"view1\");\n  jerry_value_t view2_str = jerry_string_sz (\"view2\");\n  TEST_ASSERT (jerry_object_set (global_obj, view1_str, view1));\n  TEST_ASSERT (jerry_object_set (global_obj, view2_str, view2));\n\n  jerry_value_free (view1_str);\n  jerry_value_free (view2_str);\n  jerry_value_free (global_obj);\n\n  const jerry_char_t set_src[] = \"view1.setInt16 (12, 255)\";\n  TEST_ASSERT (jerry_value_is_undefined (jerry_eval (set_src, sizeof (set_src) - 1, JERRY_PARSE_NO_OPTS)));\n\n  const jerry_char_t get_src[] = \"view2.getInt16 (0)\";\n  TEST_ASSERT (jerry_value_as_number (jerry_eval (get_src, sizeof (get_src) - 1, JERRY_PARSE_NO_OPTS)) == 255);\n\n  const jerry_char_t get_src_little_endian[] = \"view2.getInt16 (0, true)\";\n  TEST_ASSERT (\n    jerry_value_as_number (jerry_eval (get_src_little_endian, sizeof (get_src_little_endian) - 1, JERRY_PARSE_NO_OPTS))\n    == -256);\n\n  /* Cleanup */\n  jerry_value_free (view2);\n  jerry_value_free (view1);\n  jerry_value_free (arraybuffer);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-date-helpers.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-builtin-helpers.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n#include \"test-common.h\"\n\n#define MS_PER_DAY  ((ecma_number_t) 86400000)\n#define MS_PER_YEAR ((ecma_number_t) 365 * MS_PER_DAY)\n#define START_OF_GREGORIAN_CALENDAR                                                           \\\n  ((ecma_number_t) (-1970 * MS_PER_YEAR - (1970 / 4) * MS_PER_DAY + (1970 / 100) * MS_PER_DAY \\\n                    - (1970 / 400) * MS_PER_DAY - MS_PER_DAY))\n\n/**\n * Unit test's main function.\n */\nint\nmain (void)\n{\n  /* int ecma_date_year_from_time (time) */\n\n  TEST_ASSERT (ecma_date_year_from_time (0) == 1970);\n  TEST_ASSERT (ecma_date_year_from_time (0) == 1970);\n  TEST_ASSERT (ecma_date_year_from_time (MS_PER_DAY) == 1970);\n  TEST_ASSERT (ecma_date_year_from_time ((MS_PER_DAY) * (ecma_number_t) 365 - 1) == 1970);\n  TEST_ASSERT (ecma_date_year_from_time (MS_PER_DAY * (ecma_number_t) 365) == 1971);\n  TEST_ASSERT (ecma_date_year_from_time (MS_PER_DAY * (ecma_number_t) (365 * (2015 - 1970))) == 2014);\n  TEST_ASSERT (ecma_date_year_from_time (MS_PER_DAY * (ecma_number_t) (365.25 * (2015 - 1970))) == 2015);\n  TEST_ASSERT (ecma_date_year_from_time (-MS_PER_YEAR) == 1969);\n  TEST_ASSERT (ecma_date_year_from_time (-1970 * MS_PER_YEAR) == 1);\n  TEST_ASSERT (ecma_date_year_from_time (START_OF_GREGORIAN_CALENDAR) == 0);\n  TEST_ASSERT (ecma_date_year_from_time (START_OF_GREGORIAN_CALENDAR - 1) == -1);\n  TEST_ASSERT (ecma_date_year_from_time (START_OF_GREGORIAN_CALENDAR - 3 * MS_PER_YEAR) == -3);\n\n  /* int ecma_date_month_from_time  (time) */\n\n  TEST_ASSERT (ecma_date_month_from_time (START_OF_GREGORIAN_CALENDAR) == 0);\n  TEST_ASSERT (ecma_date_month_from_time (0) == 0);\n  TEST_ASSERT (ecma_date_month_from_time (-MS_PER_DAY) == 11);\n  TEST_ASSERT (ecma_date_month_from_time (31 * MS_PER_DAY) == 1);\n\n  /* int ecma_date_date_from_time  (time) */\n\n  TEST_ASSERT (ecma_date_date_from_time (START_OF_GREGORIAN_CALENDAR) == 1);\n  TEST_ASSERT (ecma_date_date_from_time (0) == 1);\n  TEST_ASSERT (ecma_date_date_from_time (-MS_PER_DAY) == 31);\n  TEST_ASSERT (ecma_date_date_from_time (31 * MS_PER_DAY) == 1);\n\n  /* int ecma_date_week_day (ecma_number_t time) */\n\n  /* FIXME: Implement */\n\n  /* ecma_number_t ecma_date_utc (time) */\n\n  /* FIXME: Implement */\n\n  /* ecma_number_t ecma_date_hour_from_time (time) */\n\n  TEST_ASSERT (ecma_date_hour_from_time (START_OF_GREGORIAN_CALENDAR) == 0);\n  TEST_ASSERT (ecma_date_hour_from_time (0) == 0);\n  TEST_ASSERT (ecma_date_hour_from_time (-MS_PER_DAY) == 0);\n  TEST_ASSERT (ecma_date_hour_from_time (-1) == 23);\n\n  /* ecma_number_t ecma_date_min_from_time (time) */\n\n  TEST_ASSERT (ecma_date_min_from_time (START_OF_GREGORIAN_CALENDAR) == 0);\n  TEST_ASSERT (ecma_date_min_from_time (0) == 0);\n  TEST_ASSERT (ecma_date_min_from_time (-MS_PER_DAY) == 0);\n  TEST_ASSERT (ecma_date_min_from_time (-1) == 59);\n\n  /* ecma_number_t ecma_date_sec_from_time (time) */\n\n  TEST_ASSERT (ecma_date_sec_from_time (START_OF_GREGORIAN_CALENDAR) == 0);\n  TEST_ASSERT (ecma_date_sec_from_time (0) == 0);\n  TEST_ASSERT (ecma_date_sec_from_time (-MS_PER_DAY) == 0);\n  TEST_ASSERT (ecma_date_sec_from_time (-1) == 59);\n\n  /* ecma_number_t ecma_date_ms_from_time (time) */\n\n  TEST_ASSERT (ecma_date_ms_from_time (START_OF_GREGORIAN_CALENDAR) == 0);\n  TEST_ASSERT (ecma_date_ms_from_time (0) == 0);\n  TEST_ASSERT (ecma_date_ms_from_time (-MS_PER_DAY) == 0);\n  TEST_ASSERT (ecma_date_ms_from_time (-1) == 999);\n\n  /* ecma_number_t ecma_date_make_time (hour, min, sec, ms) */\n\n  /* FIXME: Implement */\n\n  /* ecma_number_t ecma_date_make_day (year, month, date) */\n\n  TEST_ASSERT (ecma_date_make_day (1970, 0, 1) == 0LL);\n  TEST_ASSERT (ecma_date_make_day (1970, -1, 1) == -2678400000LL);\n  TEST_ASSERT (ecma_date_make_day (1970, 0, 2.5) == 86400000LL);\n  TEST_ASSERT (ecma_date_make_day (1970, 1, 35) == 5616000000LL);\n  TEST_ASSERT (ecma_date_make_day (1970, 13, 35) == 37152000000LL);\n  TEST_ASSERT (ecma_date_make_day (2016, 2, 1) == 1456790400000LL);\n  TEST_ASSERT (ecma_date_make_day (2016, 8, 31) == 1475280000000LL);\n  TEST_ASSERT (ecma_date_make_day (2016, 9, 1) == 1475280000000LL);\n\n  /* ecma_number_t ecma_date_make_date (day, time) */\n\n  /* FIXME: Implement */\n\n  /* ecma_number_t ecma_date_time_clip (year) */\n\n  /* FIXME: Implement */\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-error-callback.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic bool error_object_created_callback_is_running = false;\nstatic int error_object_created_callback_count = 0;\n\nstatic void\nerror_object_created_callback (const jerry_value_t error_object_t, /**< new error object */\n                               void *user_p) /**< user pointer */\n{\n  TEST_ASSERT (!error_object_created_callback_is_running);\n  TEST_ASSERT (user_p == (void *) &error_object_created_callback_count);\n\n  error_object_created_callback_is_running = true;\n  error_object_created_callback_count++;\n\n  jerry_value_t name = jerry_string_sz (\"message\");\n  jerry_value_t message = jerry_string_sz (\"Replaced message!\");\n\n  jerry_value_t result = jerry_object_set (error_object_t, name, message);\n  TEST_ASSERT (jerry_value_is_boolean (result) && jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  /* This SyntaxError must not trigger a recusrsive call of the this callback. */\n  const char *source_p = \"Syntax Error in JS!\";\n  result = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);\n  TEST_ASSERT (jerry_value_is_exception (result));\n\n  jerry_value_free (result);\n  jerry_value_free (message);\n  jerry_value_free (name);\n\n  error_object_created_callback_is_running = false;\n} /* error_object_created_callback */\n\nstatic void\nrun_test (const char *source_p)\n{\n  /* Run the code 5 times. */\n  for (int i = 0; i < 5; i++)\n  {\n    jerry_value_t result = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);\n    TEST_ASSERT (jerry_value_is_boolean (result) && jerry_value_is_true (result));\n    jerry_value_free (result);\n  }\n} /* run_test */\n\n/**\n * Unit test's main function.\n */\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_error_on_created (error_object_created_callback, (void *) &error_object_created_callback_count);\n\n  run_test (\"var result = false\\n\"\n            \"try {\\n\"\n            \"  ref_error;\\n\"\n            \"} catch(e) {\\n\"\n            \"  result = (e.message === 'Replaced message!')\\n\"\n            \"}\\n\"\n            \"result\\n\");\n\n  run_test (\"var error = new Error()\\n\"\n            \"error.message === 'Replaced message!'\\n\");\n\n  jerry_value_free (jerry_error_sz (JERRY_ERROR_COMMON, \"Message\"));\n\n  TEST_ASSERT (error_object_created_callback_count == 11);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-external-string.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic int free_count = 0;\n\nstatic const char *external_1 = \"External string! External string! External string! External string!\";\nstatic const char *external_2 = \"Object\";\nstatic const char *external_3 = \"x!?:s\";\nstatic const char *external_4 = \"Object property external string! Object property external string!\";\n\nstatic void\nexternal_string_free_callback_1 (jerry_char_t *string_p, /**< string pointer */\n                                 jerry_size_t string_size, /**< size of the string */\n                                 void *user_p) /**< user pointer */\n{\n  TEST_ASSERT ((const char *) string_p == external_1);\n  TEST_ASSERT (string_size == strlen (external_1));\n  TEST_ASSERT (user_p == NULL);\n  free_count++;\n} /* external_string_free_callback_1 */\n\nstatic void\nexternal_string_free_callback_2 (jerry_char_t *string_p, /**< string pointer */\n                                 jerry_size_t string_size, /**< size of the string */\n                                 void *user_p) /**< user pointer */\n{\n  TEST_ASSERT ((const char *) string_p == external_2);\n  TEST_ASSERT (string_size == strlen (external_2));\n  TEST_ASSERT (user_p == (void *) &free_count);\n  free_count++;\n} /* external_string_free_callback_2 */\n\nstatic void\nexternal_string_free_callback_3 (jerry_char_t *string_p, /**< string pointer */\n                                 jerry_size_t string_size, /**< size of the string */\n                                 void *user_p) /**< user pointer */\n{\n  TEST_ASSERT ((const char *) string_p == external_3);\n  TEST_ASSERT (string_size == strlen (external_3));\n  TEST_ASSERT (user_p == (void *) string_p);\n  free_count++;\n} /* external_string_free_callback_3 */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  bool is_external;\n\n  /* Test external callback calls. */\n  jerry_string_external_on_free (external_string_free_callback_1);\n  jerry_value_t external_string = jerry_string_external_sz (external_1, NULL);\n  TEST_ASSERT (free_count == 0);\n  TEST_ASSERT (jerry_string_user_ptr (external_string, &is_external) == NULL);\n  TEST_ASSERT (is_external);\n  TEST_ASSERT (jerry_string_user_ptr (external_string, NULL) == NULL);\n  jerry_value_free (external_string);\n  TEST_ASSERT (free_count == 1);\n\n  jerry_string_external_on_free (NULL);\n  external_string = jerry_string_external_sz (external_1, (void *) &free_count);\n  TEST_ASSERT (free_count == 1);\n  TEST_ASSERT (jerry_string_user_ptr (external_string, &is_external) == (void *) &free_count);\n  TEST_ASSERT (is_external);\n  TEST_ASSERT (jerry_string_user_ptr (external_string, NULL) == (void *) &free_count);\n  jerry_value_free (external_string);\n  TEST_ASSERT (free_count == 1);\n\n  jerry_string_external_on_free (external_string_free_callback_2);\n  external_string = jerry_string_external_sz (external_2, (void *) &free_count);\n  TEST_ASSERT (free_count == 2);\n  TEST_ASSERT (jerry_string_user_ptr (external_string, &is_external) == NULL);\n  TEST_ASSERT (!is_external);\n  jerry_value_free (external_string);\n  TEST_ASSERT (free_count == 2);\n\n  jerry_string_external_on_free (NULL);\n  external_string = jerry_string_external_sz (external_2, (void *) &free_count);\n  TEST_ASSERT (free_count == 2);\n  TEST_ASSERT (jerry_string_user_ptr (external_string, &is_external) == NULL);\n  TEST_ASSERT (!is_external);\n  jerry_value_free (external_string);\n  TEST_ASSERT (free_count == 2);\n\n  jerry_string_external_on_free (external_string_free_callback_3);\n  external_string = jerry_string_external_sz (external_3, (void *) external_3);\n  TEST_ASSERT (free_count == 3);\n  TEST_ASSERT (jerry_string_user_ptr (external_string, &is_external) == NULL);\n  TEST_ASSERT (!is_external);\n  jerry_value_free (external_string);\n  TEST_ASSERT (free_count == 3);\n\n  jerry_string_external_on_free (NULL);\n  external_string = jerry_string_external_sz (external_3, (void *) external_3);\n  TEST_ASSERT (free_count == 3);\n  TEST_ASSERT (jerry_string_user_ptr (external_string, &is_external) == NULL);\n  TEST_ASSERT (!is_external);\n  jerry_value_free (external_string);\n  TEST_ASSERT (free_count == 3);\n\n  /* Test string comparison. */\n  jerry_string_external_on_free (external_string_free_callback_1);\n  external_string = jerry_string_external_sz (external_1, NULL);\n  jerry_value_t other_string = jerry_string_sz (external_1);\n\n  jerry_value_t result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, external_string, other_string);\n  TEST_ASSERT (jerry_value_is_boolean (result));\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, external_string, external_string);\n  TEST_ASSERT (jerry_value_is_boolean (result));\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  TEST_ASSERT (free_count == 3);\n  jerry_value_free (external_string);\n  TEST_ASSERT (free_count == 4);\n  jerry_value_free (other_string);\n\n  /* Test getting string. */\n  jerry_string_external_on_free (external_string_free_callback_1);\n  external_string = jerry_string_external_sz (external_1, NULL);\n  size_t length = strlen (external_1);\n\n  TEST_ASSERT (jerry_value_is_string (external_string));\n  TEST_ASSERT (jerry_string_size (external_string, JERRY_ENCODING_CESU8) == length);\n  TEST_ASSERT (jerry_string_length (external_string) == length);\n\n  jerry_char_t buf[128];\n  jerry_string_to_buffer (external_string, JERRY_ENCODING_CESU8, buf, sizeof (buf));\n  TEST_ASSERT (memcmp (buf, external_1, length) == 0);\n\n  TEST_ASSERT (free_count == 4);\n  jerry_value_free (external_string);\n  TEST_ASSERT (free_count == 5);\n\n  /* Test property access. */\n  jerry_string_external_on_free (NULL);\n  external_string = jerry_string_external_sz (external_4, NULL);\n  other_string = jerry_string_sz (external_4);\n\n  jerry_value_t obj = jerry_object ();\n  result = jerry_object_set (obj, external_string, other_string);\n  TEST_ASSERT (jerry_value_is_boolean (result));\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  jerry_value_t get_result = jerry_object_get (obj, other_string);\n  TEST_ASSERT (jerry_value_is_string (get_result));\n\n  result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, get_result, external_string);\n  jerry_value_free (get_result);\n  TEST_ASSERT (jerry_value_is_boolean (result));\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  result = jerry_object_set (obj, other_string, external_string);\n  TEST_ASSERT (jerry_value_is_boolean (result));\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  get_result = jerry_object_get (obj, external_string);\n  TEST_ASSERT (jerry_value_is_string (get_result));\n\n  result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, get_result, other_string);\n  jerry_value_free (get_result);\n  TEST_ASSERT (jerry_value_is_boolean (result));\n  TEST_ASSERT (jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  jerry_value_free (obj);\n  jerry_value_free (external_string);\n  jerry_value_free (other_string);\n\n  external_string = jerry_boolean (true);\n  TEST_ASSERT (jerry_string_user_ptr (external_string, &is_external) == NULL);\n  TEST_ASSERT (!is_external);\n  jerry_value_free (external_string);\n\n  external_string = jerry_object ();\n  TEST_ASSERT (jerry_string_user_ptr (external_string, &is_external) == NULL);\n  TEST_ASSERT (!is_external);\n  jerry_value_free (external_string);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-from-property-descriptor.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t object = jerry_object ();\n  jerry_value_t prop_name = jerry_string_sz (\"length\");\n  jerry_value_t value = jerry_boolean (true);\n\n  TEST_ASSERT (jerry_object_set (object, prop_name, prop_name));\n  TEST_ASSERT (jerry_object_has (object, prop_name));\n  TEST_ASSERT (jerry_object_has_own (object, prop_name));\n\n  jerry_property_descriptor_t prop_desc;\n  TEST_ASSERT (jerry_object_get_own_prop (object, prop_name, &prop_desc));\n\n  jerry_value_t from_object = jerry_property_descriptor_to_object (&prop_desc);\n\n  prop_name = jerry_string_sz (\"value\");\n  value = jerry_object_get (from_object, prop_name);\n  TEST_ASSERT (value == prop_desc.value);\n\n  prop_name = jerry_string_sz (\"writable\");\n  value = jerry_object_get (from_object, prop_name);\n  TEST_ASSERT (jerry_value_is_true (value) == ((prop_desc.flags & JERRY_PROP_IS_WRITABLE) != 0));\n\n  prop_name = jerry_string_sz (\"enumerable\");\n  value = jerry_object_get (from_object, prop_name);\n  TEST_ASSERT (jerry_value_is_true (value) == ((prop_desc.flags & JERRY_PROP_IS_ENUMERABLE) != 0));\n\n  prop_name = jerry_string_sz (\"configurable\");\n  value = jerry_object_get (from_object, prop_name);\n  TEST_ASSERT (jerry_value_is_true (value) == ((prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE) != 0));\n\n  jerry_value_free (object);\n  jerry_value_free (prop_name);\n  jerry_value_free (value);\n  jerry_value_free (from_object);\n  jerry_property_descriptor_free (&prop_desc);\n\n  prop_desc.flags = JERRY_PROP_IS_CONFIGURABLE;\n  from_object = jerry_property_descriptor_to_object (&prop_desc);\n  TEST_ASSERT (jerry_value_is_exception (from_object));\n  jerry_value_free (from_object);\n\n  prop_desc.flags = JERRY_PROP_IS_ENUMERABLE;\n  from_object = jerry_property_descriptor_to_object (&prop_desc);\n  TEST_ASSERT (jerry_value_is_exception (from_object));\n  jerry_value_free (from_object);\n\n  prop_desc.flags = JERRY_PROP_IS_WRITABLE;\n  from_object = jerry_property_descriptor_to_object (&prop_desc);\n  TEST_ASSERT (jerry_value_is_exception (from_object));\n  jerry_value_free (from_object);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-get-own-property.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic jerry_value_t\ncreate_object (const char *source_p) /**< source script */\n{\n  jerry_value_t result = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);\n  TEST_ASSERT (jerry_value_is_object (result));\n  return result;\n} /* create_object */\n\nstatic void\ncompare_string (jerry_value_t value, /**< value to compare */\n                const char *string_p) /**< expected value */\n{\n  jerry_char_t string_buffer[64];\n\n  TEST_ASSERT (jerry_value_is_string (value));\n\n  size_t size = strlen (string_p);\n  TEST_ASSERT (size <= sizeof (string_buffer));\n  TEST_ASSERT (size == jerry_string_size (value, JERRY_ENCODING_CESU8));\n\n  jerry_string_to_buffer (value, JERRY_ENCODING_CESU8, string_buffer, (jerry_size_t) size);\n  TEST_ASSERT (memcmp (string_p, string_buffer, size) == 0);\n} /* compare_string */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t pp_string = jerry_string_sz (\"pp\");\n  jerry_value_t qq_string = jerry_string_sz (\"qq\");\n  jerry_value_t rr_string = jerry_string_sz (\"rr\");\n\n  jerry_value_t object = create_object (\"'use strict';\\n\"\n                                        \"({ pp:'A', get qq() { return 'B' } })\");\n\n  jerry_value_t result = jerry_object_find_own (object, pp_string, object, NULL);\n  compare_string (result, \"A\");\n  jerry_value_free (result);\n\n  bool found = false;\n  result = jerry_object_find_own (object, pp_string, object, &found);\n  compare_string (result, \"A\");\n  TEST_ASSERT (found);\n  jerry_value_free (result);\n\n  result = jerry_object_find_own (object, qq_string, object, NULL);\n  compare_string (result, \"B\");\n  jerry_value_free (result);\n\n  found = false;\n  result = jerry_object_find_own (object, qq_string, object, &found);\n  compare_string (result, \"B\");\n  TEST_ASSERT (found);\n  jerry_value_free (result);\n\n  result = jerry_object_find_own (object, rr_string, object, NULL);\n  TEST_ASSERT (jerry_value_is_undefined (result));\n  jerry_value_free (result);\n\n  found = true;\n  result = jerry_object_find_own (object, rr_string, object, &found);\n  TEST_ASSERT (jerry_value_is_undefined (result));\n  TEST_ASSERT (!found);\n  jerry_value_free (result);\n\n  jerry_value_free (object);\n\n  object = create_object (\"'use strict';\\n\"\n                          \"Object.create({ pp:'Found!' })\\n\");\n\n  found = true;\n  /* Does not check prototype. */\n  result = jerry_object_find_own (object, pp_string, object, &found);\n  TEST_ASSERT (jerry_value_is_undefined (result));\n  TEST_ASSERT (!found);\n  jerry_value_free (result);\n\n  jerry_value_free (object);\n\n  object = create_object (\"'use strict';\\n\"\n                          \"var obj = Object.create({ get pp() { return this.qq } })\\n\"\n                          \"Object.defineProperty(obj, 'qq', { value: 'Prop' })\\n\"\n                          \"obj\");\n  jerry_value_t prototype = jerry_object_proto (object);\n\n  TEST_ASSERT (jerry_value_is_object (prototype));\n  found = false;\n  result = jerry_object_find_own (prototype, pp_string, object, &found);\n  compare_string (result, \"Prop\");\n  TEST_ASSERT (found);\n  jerry_value_free (result);\n\n  jerry_value_free (prototype);\n  jerry_value_free (object);\n\n  /* Error cases. */\n  jerry_value_t invalid_arg = jerry_null ();\n  object = jerry_object ();\n\n  found = true;\n  result = jerry_object_find_own (invalid_arg, pp_string, object, &found);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  TEST_ASSERT (!found);\n  jerry_value_free (result);\n\n  result = jerry_object_find_own (object, pp_string, invalid_arg, NULL);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  found = true;\n  result = jerry_object_find_own (object, invalid_arg, object, &found);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  TEST_ASSERT (!found);\n  jerry_value_free (result);\n\n  jerry_value_free (object);\n  jerry_value_free (invalid_arg);\n\n  if (jerry_feature_enabled (JERRY_FEATURE_PROXY))\n  {\n    object = create_object (\"'use strict';\\n\"\n                            \"var proxy = new Proxy({}, {\\n\"\n                            \"    get: function(target, prop, receiver) {\\n\"\n                            \"        if (prop === 'qq') return\\n\"\n                            \"        return receiver[prop]\\n\"\n                            \"    }\\n\"\n                            \"})\\n\"\n                            \"var obj = Object.create(proxy)\\n\"\n                            \"Object.defineProperty(obj, 'pp', { value: 'Prop' })\\n\"\n                            \"obj\");\n\n    prototype = jerry_object_proto (object);\n    found = false;\n    result = jerry_object_find_own (prototype, pp_string, object, &found);\n    compare_string (result, \"Prop\");\n    TEST_ASSERT (found);\n    jerry_value_free (result);\n\n    found = false;\n    result = jerry_object_find_own (prototype, qq_string, object, &found);\n    TEST_ASSERT (jerry_value_is_undefined (result));\n    TEST_ASSERT (found);\n    jerry_value_free (result);\n\n    jerry_value_free (prototype);\n    jerry_value_free (object);\n\n    object = create_object (\"'use strict';\\n\"\n                            \"(new Proxy({}, {\\n\"\n                            \"    get: function(target, prop, receiver) {\\n\"\n                            \"        throw 'Error'\\n\"\n                            \"    }\\n\"\n                            \"}))\\n\");\n\n    found = false;\n    result = jerry_object_find_own (object, qq_string, object, &found);\n    TEST_ASSERT (jerry_value_is_exception (result));\n    TEST_ASSERT (found);\n    jerry_value_free (result);\n\n    jerry_value_free (object);\n  }\n\n  object = create_object (\"'use strict'\\n\"\n                          \"var sym = Symbol();\\n\"\n                          \"({ pp:sym, [sym]:'Prop' })\");\n\n  found = false;\n  jerry_value_t symbol = jerry_object_find_own (object, pp_string, object, &found);\n  TEST_ASSERT (jerry_value_is_symbol (symbol));\n  TEST_ASSERT (found);\n\n  found = false;\n  result = jerry_object_find_own (object, symbol, object, &found);\n  compare_string (result, \"Prop\");\n  TEST_ASSERT (found);\n  jerry_value_free (result);\n\n  jerry_value_free (symbol);\n  jerry_value_free (object);\n\n  jerry_value_free (pp_string);\n  jerry_value_free (qq_string);\n  jerry_value_free (rr_string);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-has-property.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic void\nassert_boolean_and_release (jerry_value_t result, bool expected)\n{\n  TEST_ASSERT (jerry_value_is_boolean (result));\n  TEST_ASSERT (jerry_value_is_true (result) == expected);\n  jerry_value_free (result);\n} /* assert_boolean_and_release */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t object = jerry_object ();\n  jerry_value_t prop_name = jerry_string_sz (\"something\");\n  jerry_value_t prop_value = jerry_boolean (true);\n  jerry_value_t proto_object = jerry_object ();\n\n  /* Assert that an empty object does not have the property in question */\n  assert_boolean_and_release (jerry_object_has (object, prop_name), false);\n  assert_boolean_and_release (jerry_object_has_own (object, prop_name), false);\n\n  assert_boolean_and_release (jerry_object_set_proto (object, proto_object), true);\n\n  /* If the object has a prototype, that still means it doesn't have the property */\n  assert_boolean_and_release (jerry_object_has (object, prop_name), false);\n  assert_boolean_and_release (jerry_object_has_own (object, prop_name), false);\n\n  assert_boolean_and_release (jerry_object_set (proto_object, prop_name, prop_value), true);\n\n  /* After setting the property on the prototype, it must be there, but not on the object */\n  assert_boolean_and_release (jerry_object_has (object, prop_name), true);\n  assert_boolean_and_release (jerry_object_has_own (object, prop_name), false);\n\n  TEST_ASSERT (jerry_value_is_true (jerry_object_delete (proto_object, prop_name)));\n  assert_boolean_and_release (jerry_object_set (object, prop_name, prop_value), true);\n\n  /* After relocating the property onto the object, it must be there */\n  assert_boolean_and_release (jerry_object_has (object, prop_name), true);\n  assert_boolean_and_release (jerry_object_has_own (object, prop_name), true);\n\n  jerry_value_free (object);\n  jerry_value_free (prop_name);\n  jerry_value_free (prop_value);\n  jerry_value_free (proto_object);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-internal-properties.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t object = jerry_object ();\n\n  jerry_value_t prop_name_1 = jerry_string_sz (\"foo\");\n  jerry_value_t prop_name_2 = jerry_string_sz (\"non_hidden_prop\");\n  jerry_value_t prop_name_3;\n\n  jerry_value_t prop_name_3_desc = jerry_string_sz (\"bar\");\n  prop_name_3 = jerry_symbol_with_description (prop_name_3_desc);\n  jerry_value_free (prop_name_3_desc);\n\n  jerry_value_t internal_prop_name_1 = jerry_string_sz (\"hidden_foo\");\n  jerry_value_t internal_prop_name_2 = jerry_string_sz (\"hidden_prop\");\n  jerry_value_t internal_prop_name_3;\n\n  jerry_value_t internal_prop_name_3_desc = jerry_string_sz (\"bar\");\n  internal_prop_name_3 = jerry_symbol_with_description (internal_prop_name_3_desc);\n  jerry_value_free (internal_prop_name_3_desc);\n\n  jerry_value_t prop_value_1 = jerry_number (5.5);\n  jerry_value_t prop_value_2 = jerry_number (6.5);\n  jerry_value_t prop_value_3 = jerry_number (7.5);\n\n  jerry_value_t internal_prop_value_1 = jerry_number (8.5);\n  jerry_value_t internal_prop_value_2 = jerry_number (9.5);\n  jerry_value_t internal_prop_value_3 = jerry_number (10.5);\n\n  /* Test the normal [[Set]] method */\n  bool set_result_1 = jerry_object_set (object, prop_name_1, prop_value_1);\n  bool set_result_2 = jerry_object_set (object, prop_name_2, prop_value_2);\n  bool set_result_3 = jerry_object_set (object, prop_name_3, prop_value_3);\n\n  TEST_ASSERT (set_result_1);\n  TEST_ASSERT (set_result_2);\n  TEST_ASSERT (set_result_3);\n\n  /* Test the internal [[Set]] method */\n  bool set_internal_result_1 = jerry_object_set_internal (object, internal_prop_name_1, internal_prop_value_1);\n  bool set_internal_result_2 = jerry_object_set_internal (object, internal_prop_name_2, internal_prop_value_2);\n  bool set_internal_result_3 = jerry_object_set_internal (object, internal_prop_name_3, internal_prop_value_3);\n\n  TEST_ASSERT (set_internal_result_1);\n  TEST_ASSERT (set_internal_result_2);\n  TEST_ASSERT (set_internal_result_3);\n\n  /* Test the normal [[Has]] method. */\n  jerry_value_t has_result_1 = jerry_object_has (object, prop_name_1);\n  jerry_value_t has_result_2 = jerry_object_has (object, prop_name_2);\n  jerry_value_t has_result_3 = jerry_object_has (object, prop_name_3);\n  jerry_value_t has_result_4 = jerry_object_has (object, internal_prop_name_1);\n  jerry_value_t has_result_5 = jerry_object_has (object, internal_prop_name_2);\n  jerry_value_t has_result_6 = jerry_object_has (object, internal_prop_name_3);\n\n  TEST_ASSERT (jerry_value_is_boolean (has_result_1) && jerry_value_is_true (has_result_1));\n  TEST_ASSERT (jerry_value_is_boolean (has_result_2) && jerry_value_is_true (has_result_2));\n  TEST_ASSERT (jerry_value_is_boolean (has_result_3) && jerry_value_is_true (has_result_3));\n  TEST_ASSERT (jerry_value_is_boolean (has_result_4) && !jerry_value_is_true (has_result_4));\n  TEST_ASSERT (jerry_value_is_boolean (has_result_5) && !jerry_value_is_true (has_result_5));\n  TEST_ASSERT (jerry_value_is_boolean (has_result_6) && !jerry_value_is_true (has_result_6));\n\n  jerry_value_free (has_result_1);\n  jerry_value_free (has_result_2);\n  jerry_value_free (has_result_3);\n  jerry_value_free (has_result_4);\n  jerry_value_free (has_result_5);\n  jerry_value_free (has_result_6);\n\n  /* Test the internal [[Has]] method. */\n  bool has_internal_result_1 = jerry_object_has_internal (object, prop_name_1);\n  bool has_internal_result_2 = jerry_object_has_internal (object, prop_name_2);\n  bool has_internal_result_3 = jerry_object_has_internal (object, prop_name_3);\n  bool has_internal_result_4 = jerry_object_has_internal (object, internal_prop_name_1);\n  bool has_internal_result_5 = jerry_object_has_internal (object, internal_prop_name_2);\n  bool has_internal_result_6 = jerry_object_has_internal (object, internal_prop_name_3);\n\n  TEST_ASSERT (!has_internal_result_1);\n  TEST_ASSERT (!has_internal_result_2);\n  TEST_ASSERT (!has_internal_result_3);\n  TEST_ASSERT (has_internal_result_4);\n  TEST_ASSERT (has_internal_result_5);\n  TEST_ASSERT (has_internal_result_6);\n\n  /* Test the normal [[Get]] method. */\n  jerry_value_t get_result_1 = jerry_object_get (object, prop_name_1);\n  jerry_value_t get_result_2 = jerry_object_get (object, prop_name_2);\n  jerry_value_t get_result_3 = jerry_object_get (object, prop_name_3);\n  jerry_value_t get_result_4 = jerry_object_get (object, internal_prop_name_1);\n  jerry_value_t get_result_5 = jerry_object_get (object, internal_prop_name_2);\n  jerry_value_t get_result_6 = jerry_object_get (object, internal_prop_name_3);\n\n  TEST_ASSERT (jerry_value_is_number (get_result_1) && jerry_value_as_number (get_result_1) == 5.5);\n  TEST_ASSERT (jerry_value_is_number (get_result_2) && jerry_value_as_number (get_result_2) == 6.5);\n  TEST_ASSERT (jerry_value_is_number (get_result_3) && jerry_value_as_number (get_result_3) == 7.5);\n  TEST_ASSERT (jerry_value_is_undefined (get_result_4));\n  TEST_ASSERT (jerry_value_is_undefined (get_result_5));\n  TEST_ASSERT (jerry_value_is_undefined (get_result_6));\n\n  jerry_value_free (get_result_1);\n  jerry_value_free (get_result_2);\n  jerry_value_free (get_result_3);\n  jerry_value_free (get_result_4);\n  jerry_value_free (get_result_5);\n  jerry_value_free (get_result_6);\n\n  /* Test the internal [[Get]] method. */\n  jerry_value_t get_internal_result_1 = jerry_object_get_internal (object, prop_name_1);\n  jerry_value_t get_internal_result_2 = jerry_object_get_internal (object, prop_name_2);\n  jerry_value_t get_internal_result_3 = jerry_object_get_internal (object, prop_name_3);\n  jerry_value_t get_internal_result_4 = jerry_object_get_internal (object, internal_prop_name_1);\n  jerry_value_t get_internal_result_5 = jerry_object_get_internal (object, internal_prop_name_2);\n  jerry_value_t get_internal_result_6 = jerry_object_get_internal (object, internal_prop_name_3);\n\n  TEST_ASSERT (jerry_value_is_undefined (get_internal_result_1));\n  TEST_ASSERT (jerry_value_is_undefined (get_internal_result_2));\n  TEST_ASSERT (jerry_value_is_undefined (get_internal_result_3));\n  TEST_ASSERT (jerry_value_is_number (get_internal_result_4) && jerry_value_as_number (get_internal_result_4) == 8.5);\n  TEST_ASSERT (jerry_value_is_number (get_internal_result_5) && jerry_value_as_number (get_internal_result_5) == 9.5);\n  TEST_ASSERT (jerry_value_is_number (get_internal_result_6) && jerry_value_as_number (get_internal_result_6) == 10.5);\n\n  jerry_value_free (get_internal_result_1);\n  jerry_value_free (get_internal_result_2);\n  jerry_value_free (get_internal_result_3);\n  jerry_value_free (get_internal_result_4);\n  jerry_value_free (get_internal_result_5);\n  jerry_value_free (get_internal_result_6);\n\n  /* Test the normal [[Delete]] method. */\n  jerry_value_t delete_result_1 = jerry_object_delete (object, prop_name_1);\n  jerry_value_t delete_result_2 = jerry_object_delete (object, prop_name_2);\n  jerry_value_t delete_result_3 = jerry_object_delete (object, prop_name_3);\n  jerry_value_t delete_result_4 = jerry_object_delete (object, internal_prop_name_1);\n  jerry_value_t delete_result_5 = jerry_object_delete (object, internal_prop_name_2);\n  jerry_value_t delete_result_6 = jerry_object_delete (object, internal_prop_name_3);\n\n  TEST_ASSERT (jerry_value_is_true (delete_result_1));\n  TEST_ASSERT (jerry_value_is_true (delete_result_2));\n  TEST_ASSERT (jerry_value_is_true (delete_result_3));\n  TEST_ASSERT (jerry_value_is_true (delete_result_4));\n  TEST_ASSERT (jerry_value_is_true (delete_result_5));\n  TEST_ASSERT (jerry_value_is_true (delete_result_6));\n\n  jerry_value_t has_after_delete_result_1 = jerry_object_has (object, prop_name_1);\n  jerry_value_t has_after_delete_result_2 = jerry_object_has (object, prop_name_2);\n  jerry_value_t has_after_delete_result_3 = jerry_object_has (object, prop_name_3);\n  bool has_after_delete_result_4 = jerry_object_has_internal (object, internal_prop_name_1);\n  bool has_after_delete_result_5 = jerry_object_has_internal (object, internal_prop_name_2);\n  bool has_after_delete_result_6 = jerry_object_has_internal (object, internal_prop_name_3);\n\n  TEST_ASSERT (jerry_value_is_boolean (has_after_delete_result_1) && !jerry_value_is_true (has_after_delete_result_1));\n  TEST_ASSERT (jerry_value_is_boolean (has_after_delete_result_2) && !jerry_value_is_true (has_after_delete_result_2));\n  TEST_ASSERT (jerry_value_is_boolean (has_after_delete_result_3) && !jerry_value_is_true (has_after_delete_result_3));\n  TEST_ASSERT (has_after_delete_result_4);\n  TEST_ASSERT (has_after_delete_result_5);\n  TEST_ASSERT (has_after_delete_result_6);\n\n  jerry_value_free (has_after_delete_result_1);\n  jerry_value_free (has_after_delete_result_2);\n  jerry_value_free (has_after_delete_result_3);\n\n  /* Test the internal [[Delete]] method. */\n  bool delete_internal_result_4 = jerry_object_delete_internal (object, internal_prop_name_1);\n  bool delete_internal_result_5 = jerry_object_delete_internal (object, internal_prop_name_2);\n  bool delete_internal_result_6 = jerry_object_delete_internal (object, internal_prop_name_3);\n\n  TEST_ASSERT (delete_internal_result_4);\n  TEST_ASSERT (delete_internal_result_5);\n  TEST_ASSERT (delete_internal_result_6);\n\n  bool has_after_internal_delete_result_1 = jerry_object_has_internal (object, internal_prop_name_1);\n  bool has_after_internal_delete_result_2 = jerry_object_has_internal (object, internal_prop_name_2);\n  bool has_after_internal_delete_result_3 = jerry_object_has_internal (object, internal_prop_name_3);\n\n  TEST_ASSERT (!has_after_internal_delete_result_1);\n  TEST_ASSERT (!has_after_internal_delete_result_2);\n  TEST_ASSERT (!has_after_internal_delete_result_3);\n\n  /* Cleanup */\n  jerry_value_free (prop_value_3);\n  jerry_value_free (prop_value_2);\n  jerry_value_free (prop_value_1);\n\n  jerry_value_free (prop_name_3);\n  jerry_value_free (prop_name_2);\n  jerry_value_free (prop_name_1);\n\n  jerry_value_free (internal_prop_value_3);\n  jerry_value_free (internal_prop_value_2);\n  jerry_value_free (internal_prop_value_1);\n\n  jerry_value_free (internal_prop_name_3);\n  jerry_value_free (internal_prop_name_2);\n  jerry_value_free (internal_prop_name_1);\n\n  jerry_value_free (object);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-is-eval-code.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic jerry_value_t\ncheck_eval (const jerry_call_info_t *call_info_p, /**< call information */\n            const jerry_value_t args_p[], /**< arguments list */\n            const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n\n  TEST_ASSERT (args_cnt == 2 && jerry_function_is_dynamic (args_p[0]) == jerry_value_is_true (args_p[1]));\n  return jerry_boolean (true);\n} /* check_eval */\n\nstatic void\ntest_parse (const char *source_p, /**< source code */\n            jerry_parse_options_t *options_p) /**< options passed to jerry_parse */\n{\n  jerry_value_t parse_result = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), options_p);\n  TEST_ASSERT (!jerry_value_is_exception (parse_result));\n  TEST_ASSERT (!jerry_function_is_dynamic (parse_result));\n\n  jerry_value_t result;\n\n  if (options_p->options & JERRY_PARSE_HAS_ARGUMENT_LIST)\n  {\n    jerry_value_t this_value = jerry_undefined ();\n    result = jerry_call (parse_result, this_value, NULL, 0);\n    jerry_value_free (this_value);\n  }\n  else if (options_p->options & JERRY_PARSE_MODULE)\n  {\n    result = jerry_module_link (parse_result, NULL, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n    jerry_value_free (result);\n    result = jerry_module_evaluate (parse_result);\n  }\n  else\n  {\n    result = jerry_run (parse_result);\n  }\n\n  TEST_ASSERT (!jerry_value_is_exception (result));\n\n  jerry_value_free (parse_result);\n  jerry_value_free (result);\n} /* test_parse */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_object_value = jerry_current_realm ();\n\n  jerry_value_t function_value = jerry_function_external (check_eval);\n  jerry_value_t function_name_value = jerry_string_sz (\"check_eval\");\n  jerry_value_free (jerry_object_set (global_object_value, function_name_value, function_value));\n\n  jerry_value_free (function_name_value);\n  jerry_value_free (function_value);\n  jerry_value_free (global_object_value);\n\n  jerry_parse_options_t parse_options;\n  const char *source_p = TEST_STRING_LITERAL (\"eval('check_eval(function() {}, true)')\\n\"\n                                              \"check_eval(function() {}, false)\");\n\n  parse_options.options = JERRY_PARSE_NO_OPTS;\n  test_parse (source_p, &parse_options);\n\n  if (jerry_feature_enabled (JERRY_FEATURE_MODULE))\n  {\n    parse_options.options = JERRY_PARSE_MODULE;\n    test_parse (source_p, &parse_options);\n  }\n\n  parse_options.options = JERRY_PARSE_HAS_ARGUMENT_LIST;\n  parse_options.argument_list = jerry_string_sz (\"\");\n  test_parse (source_p, &parse_options);\n  jerry_value_free (parse_options.argument_list);\n\n  parse_options.options = JERRY_PARSE_NO_OPTS;\n  source_p = TEST_STRING_LITERAL (\"check_eval(new Function('a', 'return a'), true)\");\n  test_parse (source_p, &parse_options);\n\n  source_p = TEST_STRING_LITERAL (\"check_eval(function() {}, true)\");\n  jerry_value_free (jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), JERRY_PARSE_NO_OPTS));\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-jmem.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-init-finalize.h\"\n\n#include \"jmem.h\"\n#include \"test-common.h\"\n\n#define BASIC_SIZE (64)\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jmem_init ();\n  ecma_init ();\n\n  {\n    uint8_t *block1_p = (uint8_t *) jmem_heap_alloc_block (BASIC_SIZE);\n    uint8_t *block2_p = (uint8_t *) jmem_heap_alloc_block (BASIC_SIZE);\n    uint8_t *block3_p = (uint8_t *) jmem_heap_alloc_block (BASIC_SIZE);\n\n    /* [block1 64] [block2 64] [block3 64] [...] */\n\n    for (uint8_t i = 0; i < BASIC_SIZE; i++)\n    {\n      block2_p[i] = i;\n    }\n\n    /* Realloc by moving */\n    block2_p = jmem_heap_realloc_block (block2_p, BASIC_SIZE, BASIC_SIZE * 2);\n\n    /* [block1 64] [free 64] [block3 64] [block2 128] [...] */\n\n    for (uint8_t i = 0; i < BASIC_SIZE; i++)\n    {\n      TEST_ASSERT (block2_p[i] == i);\n    }\n\n    for (uint8_t i = BASIC_SIZE; i < BASIC_SIZE * 2; i++)\n    {\n      block2_p[i] = i;\n    }\n\n    uint8_t *block4_p = (uint8_t *) jmem_heap_alloc_block (BASIC_SIZE * 2);\n\n    /* [block1 64] [free 64] [block3 64] [block2 128] [block4 128] [...] */\n\n    jmem_heap_free_block (block3_p, BASIC_SIZE);\n\n    /* [block1 64] [free 128] [block2 128] [block4 128] [...] */\n\n    /* Realloc by extending front */\n    block2_p = (uint8_t *) jmem_heap_realloc_block (block2_p, BASIC_SIZE * 2, BASIC_SIZE * 3);\n\n    /* [block1 64] [free 64] [block2 192] [block4 128] [...] */\n\n    for (uint8_t i = 0; i < BASIC_SIZE * 2; i++)\n    {\n      TEST_ASSERT (block2_p[i] == i);\n    }\n\n    /* Shrink */\n    block2_p = (uint8_t *) jmem_heap_realloc_block (block2_p, BASIC_SIZE * 3, BASIC_SIZE);\n\n    /* [block1 64] [free 64] [block2 64] [free 128] [block4 128] [...] */\n\n    for (uint8_t i = 0; i < BASIC_SIZE; i++)\n    {\n      TEST_ASSERT (block2_p[i] == i);\n    }\n\n    for (uint8_t i = 0; i < BASIC_SIZE; i++)\n    {\n      block1_p[i] = i;\n    }\n\n    /* Grow in place */\n    block1_p = (uint8_t *) jmem_heap_realloc_block (block1_p, BASIC_SIZE, BASIC_SIZE * 2);\n\n    /* [block1 128] [block2 64] [free 128] [block4 128] [...] */\n\n    for (uint8_t i = 0; i < BASIC_SIZE; i++)\n    {\n      TEST_ASSERT (block1_p[i] == i);\n    }\n\n    jmem_heap_free_block (block1_p, BASIC_SIZE * 2);\n    jmem_heap_free_block (block2_p, BASIC_SIZE);\n    jmem_heap_free_block (block4_p, BASIC_SIZE * 2);\n  }\n\n  ecma_finalize ();\n  jmem_finalize ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-json.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic jerry_value_t\ncustom_to_json (const jerry_call_info_t *call_info_p, /**< call information */\n                const jerry_value_t args_p[], /**< arguments list */\n                const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n  JERRY_UNUSED (args_p);\n  JERRY_UNUSED (args_cnt);\n\n  return jerry_throw_sz (JERRY_ERROR_URI, \"Error\");\n} /* custom_to_json */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  {\n    /* JSON.parse check */\n    const jerry_char_t data[] = \"{\\\"name\\\": \\\"John\\\", \\\"age\\\": 5}\";\n    jerry_value_t parsed_json = jerry_json_parse (data, sizeof (data) - 1);\n\n    /* Check \"name\" property values */\n    jerry_value_t name_key = jerry_string_sz (\"name\");\n\n    jerry_value_t has_name = jerry_object_has (parsed_json, name_key);\n    TEST_ASSERT (jerry_value_is_true (has_name));\n    jerry_value_free (has_name);\n\n    jerry_value_t name_value = jerry_object_get (parsed_json, name_key);\n    TEST_ASSERT (jerry_value_is_string (name_value) == true);\n\n    jerry_size_t name_size = jerry_string_size (name_value, JERRY_ENCODING_CESU8);\n    TEST_ASSERT (name_size == 4);\n    JERRY_VLA (jerry_char_t, name_data, name_size + 1);\n    jerry_size_t copied = jerry_string_to_buffer (name_value, JERRY_ENCODING_CESU8, name_data, name_size);\n    name_data[name_size] = '\\0';\n\n    jerry_value_free (name_value);\n\n    TEST_ASSERT (copied == name_size);\n    TEST_ASSERT_STR (\"John\", name_data);\n    jerry_value_free (name_key);\n\n    /* Check \"age\" property values */\n    jerry_value_t age_key = jerry_string_sz (\"age\");\n\n    jerry_value_t has_age = jerry_object_has (parsed_json, age_key);\n    TEST_ASSERT (jerry_value_is_true (has_age));\n    jerry_value_free (has_age);\n\n    jerry_value_t age_value = jerry_object_get (parsed_json, age_key);\n    TEST_ASSERT (jerry_value_is_number (age_value) == true);\n    TEST_ASSERT (jerry_value_as_number (age_value) == 5.0);\n\n    jerry_value_free (age_value);\n    jerry_value_free (age_key);\n\n    jerry_value_free (parsed_json);\n  }\n\n  /* JSON.parse cesu-8 / utf-8 encoded string */\n  {\n    jerry_char_t cesu8[] = \"{\\\"ch\\\": \\\"\\xED\\xA0\\x83\\xED\\xB2\\x9F\\\"}\";\n    jerry_char_t utf8[] = \"{\\\"ch\\\": \\\"\\xF0\\x90\\xB2\\x9F\\\"}\";\n\n    jerry_value_t parsed_cesu8 = jerry_json_parse (cesu8, sizeof (cesu8) - 1);\n    jerry_value_t parsed_utf8 = jerry_json_parse (utf8, sizeof (utf8) - 1);\n\n    jerry_value_t key = jerry_string_sz (\"ch\");\n    jerry_value_t char_cesu8 = jerry_object_get (parsed_cesu8, key);\n    jerry_value_t char_utf8 = jerry_object_get (parsed_utf8, key);\n    jerry_value_free (key);\n\n    TEST_ASSERT (jerry_value_to_boolean (jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, char_cesu8, char_utf8)));\n    jerry_value_free (char_cesu8);\n    jerry_value_free (char_utf8);\n    jerry_value_free (parsed_cesu8);\n    jerry_value_free (parsed_utf8);\n  }\n\n  /* JSON.parse error checks */\n  {\n    jerry_value_t parsed_json = jerry_json_parse ((const jerry_char_t *) \"\", 0);\n    TEST_ASSERT (jerry_value_is_exception (parsed_json));\n    TEST_ASSERT (jerry_error_type (parsed_json) == JERRY_ERROR_SYNTAX);\n    jerry_value_free (parsed_json);\n  }\n\n  {\n    jerry_value_t parsed_json = jerry_json_parse ((const jerry_char_t *) \"-\", 1);\n    TEST_ASSERT (jerry_value_is_exception (parsed_json));\n    TEST_ASSERT (jerry_error_type (parsed_json) == JERRY_ERROR_SYNTAX);\n    jerry_value_free (parsed_json);\n  }\n\n  /* JSON.stringify check */\n  {\n    jerry_value_t obj = jerry_object ();\n    /* Fill \"obj\" with data */\n    {\n      jerry_value_t name_key = jerry_string_sz (\"name\");\n      jerry_value_t name_value = jerry_string_sz (\"John\");\n      jerry_value_t name_set = jerry_object_set (obj, name_key, name_value);\n      TEST_ASSERT (!jerry_value_is_exception (name_set));\n      TEST_ASSERT (jerry_value_is_boolean (name_set));\n      TEST_ASSERT (jerry_value_is_true (name_set));\n      jerry_value_free (name_key);\n      jerry_value_free (name_value);\n      jerry_value_free (name_set);\n    }\n    {\n      jerry_value_t age_key = jerry_string_sz (\"age\");\n      jerry_value_t age_value = jerry_number (32);\n      jerry_value_t age_set = jerry_object_set (obj, age_key, age_value);\n      TEST_ASSERT (!jerry_value_is_exception (age_set));\n      TEST_ASSERT (jerry_value_is_boolean (age_set));\n      TEST_ASSERT (jerry_value_is_true (age_set));\n      jerry_value_free (age_key);\n      jerry_value_free (age_value);\n      jerry_value_free (age_set);\n    }\n\n    jerry_value_t json_string = jerry_json_stringify (obj);\n    TEST_ASSERT (jerry_value_is_string (json_string));\n\n    jerry_value_free (obj);\n\n    const char check_value[] = \"{\\\"name\\\":\\\"John\\\",\\\"age\\\":32}\";\n    jerry_size_t json_size = jerry_string_size (json_string, JERRY_ENCODING_CESU8);\n    TEST_ASSERT (json_size == strlen (check_value));\n    JERRY_VLA (jerry_char_t, json_data, json_size + 1);\n    jerry_string_to_buffer (json_string, JERRY_ENCODING_CESU8, json_data, json_size);\n    json_data[json_size] = '\\0';\n\n    TEST_ASSERT_STR (check_value, json_data);\n\n    jerry_value_free (json_string);\n  }\n\n  /* Custom \"toJSON\" invocation test */\n  {\n    jerry_value_t obj = jerry_object ();\n    /* Fill \"obj\" with data */\n    {\n      jerry_value_t name_key = jerry_string_sz (\"toJSON\");\n      jerry_value_t name_value = jerry_function_external (custom_to_json);\n      jerry_value_t name_set = jerry_object_set (obj, name_key, name_value);\n      TEST_ASSERT (!jerry_value_is_exception (name_set));\n      TEST_ASSERT (jerry_value_is_boolean (name_set));\n      TEST_ASSERT (jerry_value_is_true (name_set));\n      jerry_value_free (name_key);\n      jerry_value_free (name_value);\n      jerry_value_free (name_set);\n    }\n\n    jerry_value_t json_string = jerry_json_stringify (obj);\n    TEST_ASSERT (jerry_value_is_exception (json_string));\n    TEST_ASSERT (jerry_error_type (json_string) == JERRY_ERROR_URI);\n\n    jerry_value_free (json_string);\n    jerry_value_free (obj);\n  }\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-lit-char-helpers.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-helpers.h\"\n#include \"ecma-init-finalize.h\"\n\n#include \"js-parser-internal.h\"\n#include \"lit-char-helpers.h\"\n#include \"lit-strings.h\"\n#include \"test-common.h\"\n\nstatic lit_code_point_t\nlexer_hex_to_character (const uint8_t *source_p) /**< current source position */\n{\n  lit_code_point_t result = 0;\n\n  do\n  {\n    uint32_t byte = *source_p++;\n\n    result <<= 4;\n\n    if (byte >= LIT_CHAR_0 && byte <= LIT_CHAR_9)\n    {\n      result += byte - LIT_CHAR_0;\n    }\n    else\n    {\n      byte = LEXER_TO_ASCII_LOWERCASE (byte);\n      if (byte >= LIT_CHAR_LOWERCASE_A && byte <= LIT_CHAR_LOWERCASE_F)\n      {\n        result += byte - (LIT_CHAR_LOWERCASE_A - 10);\n      }\n      else\n      {\n        return UINT32_MAX;\n      }\n    }\n  } while (*source_p);\n\n  return result;\n} /* lexer_hex_to_character */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jmem_init ();\n  ecma_init ();\n\n  const uint8_t _1_byte_long1[] = \"007F\";\n  const uint8_t _1_byte_long2[] = \"0000\";\n  const uint8_t _1_byte_long3[] = \"0065\";\n\n  const uint8_t _2_byte_long1[] = \"008F\";\n  const uint8_t _2_byte_long2[] = \"00FF\";\n  const uint8_t _2_byte_long3[] = \"07FF\";\n\n  const uint8_t _3_byte_long1[] = \"08FF\";\n  const uint8_t _3_byte_long2[] = \"0FFF\";\n  const uint8_t _3_byte_long3[] = \"FFFF\";\n\n  const uint8_t _6_byte_long1[] = \"10000\";\n  const uint8_t _6_byte_long2[] = \"10FFFF\";\n\n  size_t length;\n\n  /* Test 1-byte-long unicode sequences. */\n  length = lit_code_point_get_cesu8_length (lexer_hex_to_character (_1_byte_long1));\n  TEST_ASSERT (length == 1);\n\n  length = lit_code_point_get_cesu8_length (lexer_hex_to_character (_1_byte_long2));\n  TEST_ASSERT (length == 1);\n\n  length = lit_code_point_get_cesu8_length (lexer_hex_to_character (_1_byte_long3));\n  TEST_ASSERT (length == 1);\n\n  /* Test 2-byte-long unicode sequences. */\n  length = lit_code_point_get_cesu8_length (lexer_hex_to_character (_2_byte_long1));\n  TEST_ASSERT (length == 2);\n\n  length = lit_code_point_get_cesu8_length (lexer_hex_to_character (_2_byte_long2));\n  TEST_ASSERT (length == 2);\n\n  length = lit_code_point_get_cesu8_length (lexer_hex_to_character (_2_byte_long3));\n  TEST_ASSERT (length == 2);\n\n  /* Test 3-byte-long unicode sequences. */\n  length = lit_code_point_get_cesu8_length (lexer_hex_to_character (_3_byte_long1));\n  TEST_ASSERT (length == 3);\n\n  length = lit_code_point_get_cesu8_length (lexer_hex_to_character (_3_byte_long2));\n  TEST_ASSERT (length == 3);\n\n  length = lit_code_point_get_cesu8_length (lexer_hex_to_character (_3_byte_long3));\n  TEST_ASSERT (length == 3);\n\n  length = lit_code_point_get_cesu8_length (lexer_hex_to_character (_6_byte_long1));\n  TEST_ASSERT (length == 6);\n\n  length = lit_code_point_get_cesu8_length (lexer_hex_to_character (_6_byte_long2));\n  TEST_ASSERT (length == 6);\n\n  ecma_finalize ();\n  jmem_finalize ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-literal-storage.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-helpers.h\"\n#include \"ecma-literal-storage.h\"\n\n#include \"test-common.h\"\n\n/* Iterations count. */\n#define test_iters 64\n\n/* Subiterations count. */\n#define test_sub_iters 64\n\n/* Max characters in a string. */\n#define max_characters_in_string 256\n\nstatic void\ngenerate_string (lit_utf8_byte_t *str, lit_utf8_size_t len)\n{\n  static const lit_utf8_byte_t bytes[] = \"!@#$%^&*()_+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789\";\n  static const lit_utf8_size_t length = (lit_utf8_size_t) (sizeof (bytes) - 1);\n  for (lit_utf8_size_t i = 0; i < len; ++i)\n  {\n    str[i] = bytes[(unsigned long) rand () % length];\n  }\n} /* generate_string */\n\nstatic ecma_number_t\ngenerate_number (void)\n{\n  ecma_number_t num = ((ecma_number_t) rand () / 32767.0);\n  if (rand () % 2)\n  {\n    num = -num;\n  }\n  int power = rand () % 30;\n  while (power-- > 0)\n  {\n    num *= 10;\n  }\n  return num;\n} /* generate_number */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  const lit_utf8_byte_t *ptrs[test_sub_iters];\n  ecma_number_t numbers[test_sub_iters];\n  lit_utf8_byte_t strings[test_sub_iters][max_characters_in_string + 1];\n  lit_utf8_size_t lengths[test_sub_iters];\n\n  jmem_init ();\n\n  for (uint32_t i = 0; i < test_iters; i++)\n  {\n    memset (numbers, 0, sizeof (ecma_number_t) * test_sub_iters);\n    memset (lengths, 0, sizeof (lit_utf8_size_t) * test_sub_iters);\n    memset (ptrs, 0, sizeof (lit_utf8_byte_t *) * test_sub_iters);\n\n    for (uint32_t j = 0; j < test_sub_iters; j++)\n    {\n      int type = rand () % 3;\n      if (type == 0)\n      {\n        lengths[j] = (lit_utf8_size_t) (rand () % max_characters_in_string + 1);\n        generate_string (strings[j], lengths[j]);\n        ecma_find_or_create_literal_string (strings[j], lengths[j], false);\n        strings[j][lengths[j]] = '\\0';\n        ptrs[j] = strings[j];\n        TEST_ASSERT (ptrs[j]);\n      }\n      else if (type == 1)\n      {\n        lit_magic_string_id_t msi = (lit_magic_string_id_t) (rand () % LIT_NON_INTERNAL_MAGIC_STRING__COUNT);\n        ptrs[j] = lit_get_magic_string_utf8 (msi);\n        TEST_ASSERT (ptrs[j]);\n        lengths[j] = (lit_utf8_size_t) lit_zt_utf8_string_size (ptrs[j]);\n        ecma_find_or_create_literal_string (ptrs[j], lengths[j], false);\n      }\n      else\n      {\n        ecma_number_t num = generate_number ();\n        lengths[j] = ecma_number_to_utf8_string (num, strings[j], max_characters_in_string);\n        ecma_find_or_create_literal_number (num);\n      }\n    }\n\n    /* Add empty string. */\n    ecma_find_or_create_literal_string (NULL, 0, false);\n\n    for (uint32_t j = 0; j < test_sub_iters; j++)\n    {\n      ecma_value_t lit1;\n      ecma_value_t lit2;\n      if (ptrs[j])\n      {\n        lit1 = ecma_find_or_create_literal_string (ptrs[j], lengths[j], false);\n        lit2 = ecma_find_or_create_literal_string (ptrs[j], lengths[j], false);\n        TEST_ASSERT (ecma_is_value_string (lit1));\n        TEST_ASSERT (ecma_is_value_string (lit2));\n        TEST_ASSERT (lit1 == lit2);\n      }\n      else\n      {\n        lit1 = ecma_find_or_create_literal_number (numbers[j]);\n        lit2 = ecma_find_or_create_literal_number (numbers[j]);\n        TEST_ASSERT (ecma_is_value_number (lit1));\n        TEST_ASSERT (ecma_is_value_number (lit2));\n        TEST_ASSERT (lit1 == lit2);\n      }\n    }\n\n    /* Check empty string exists. */\n    TEST_ASSERT (ecma_find_or_create_literal_string (NULL, 0, false) != JMEM_CP_NULL);\n  }\n\n  ecma_finalize_lit_storage ();\n  jmem_finalize ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-mem-stats.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nint\nmain (void)\n{\n  if (!jerry_feature_enabled (JERRY_FEATURE_HEAP_STATS))\n  {\n    return 0;\n  }\n  const jerry_char_t test_source[] = TEST_STRING_LITERAL (\"var a = 'hello';\"\n                                                          \"var b = 'world';\"\n                                                          \"var c = a + ' ' + b;\");\n\n  jerry_init (JERRY_INIT_EMPTY);\n  jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n\n  jerry_value_t res = jerry_run (parsed_code_val);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n\n  jerry_heap_stats_t stats;\n  memset (&stats, 0, sizeof (stats));\n  bool get_stats_ret = jerry_heap_stats (&stats);\n  TEST_ASSERT (get_stats_ret);\n  TEST_ASSERT (stats.version == 1);\n  TEST_ASSERT (stats.size == 524280);\n\n  TEST_ASSERT (!jerry_heap_stats (NULL));\n\n  jerry_value_free (res);\n  jerry_value_free (parsed_code_val);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-module-dynamic.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic int mode = 0;\nstatic jerry_value_t global_user_value;\n\nstatic jerry_value_t\nglobal_assert (const jerry_call_info_t *call_info_p, /**< call information */\n               const jerry_value_t args_p[], /**< arguments list */\n               const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n\n  TEST_ASSERT (args_cnt == 1 && jerry_value_is_true (args_p[0]));\n  return jerry_boolean (true);\n} /* global_assert */\n\nstatic void\nregister_assert (void)\n{\n  jerry_value_t global_object_value = jerry_current_realm ();\n\n  jerry_value_t function_value = jerry_function_external (global_assert);\n  jerry_value_t function_name_value = jerry_string_sz (\"assert\");\n  jerry_value_t result_value = jerry_object_set (global_object_value, function_name_value, function_value);\n\n  jerry_value_free (function_name_value);\n  jerry_value_free (function_value);\n  jerry_value_free (global_object_value);\n\n  TEST_ASSERT (jerry_value_is_true (result_value));\n  jerry_value_free (result_value);\n} /* register_assert */\n\nstatic void\ncompare_specifier (jerry_value_t specifier, /* string value */\n                   int id) /* module id */\n{\n  jerry_char_t string[] = \"XX_module.mjs\";\n\n  TEST_ASSERT (id >= 1 && id <= 99 && string[0] == 'X' && string[1] == 'X');\n\n  string[0] = (jerry_char_t) ((id / 10) + '0');\n  string[1] = (jerry_char_t) ((id % 10) + '0');\n\n  jerry_size_t length = (jerry_size_t) (sizeof (string) - 1);\n  jerry_char_t buffer[sizeof (string) - 1];\n\n  TEST_ASSERT (jerry_value_is_string (specifier));\n  TEST_ASSERT (jerry_string_size (specifier, JERRY_ENCODING_CESU8) == length);\n\n  TEST_ASSERT (jerry_string_to_buffer (specifier, JERRY_ENCODING_CESU8, buffer, length) == length);\n  TEST_ASSERT (memcmp (buffer, string, length) == 0);\n} /* compare_specifier */\n\nstatic jerry_value_t\nmodule_import_callback (const jerry_value_t specifier, /* string value */\n                        const jerry_value_t user_value, /* user value assigned to the script */\n                        void *user_p) /* user pointer */\n{\n  TEST_ASSERT (user_p == (void *) &mode);\n\n  if (mode != 3)\n  {\n    jerry_value_t compare_value = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, user_value, global_user_value);\n\n    TEST_ASSERT (jerry_value_is_true (compare_value));\n    jerry_value_free (compare_value);\n  }\n\n  switch (mode)\n  {\n    case 0:\n    {\n      compare_specifier (specifier, 1);\n      return jerry_throw_sz (JERRY_ERROR_RANGE, \"Err01\");\n    }\n    case 1:\n    {\n      compare_specifier (specifier, 2);\n      return jerry_null ();\n    }\n    case 2:\n    {\n      compare_specifier (specifier, 3);\n\n      jerry_value_t promise_value = jerry_promise ();\n      /* Normally this should be a namespace object. */\n      jerry_value_t object_value = jerry_object ();\n      jerry_promise_resolve (promise_value, object_value);\n      jerry_value_free (object_value);\n      return promise_value;\n    }\n    case 3:\n    {\n      compare_specifier (specifier, 28);\n\n      TEST_ASSERT (jerry_value_is_object (user_value));\n      jerry_value_t property_name = jerry_string_sz (\"MyProp1\");\n      jerry_value_t result = jerry_object_get (user_value, property_name);\n      TEST_ASSERT (jerry_value_is_number (result) && jerry_value_as_number (result) == 3.5);\n      jerry_value_free (result);\n      jerry_value_free (property_name);\n      return jerry_undefined ();\n    }\n  }\n\n  TEST_ASSERT (mode == 4 || mode == 5);\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE;\n\n  jerry_value_t parse_result_value = jerry_parse ((const jerry_char_t *) \"\", 0, &parse_options);\n  TEST_ASSERT (!jerry_value_is_exception (parse_result_value));\n\n  jerry_value_t result_value = jerry_module_link (parse_result_value, NULL, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (result_value));\n  jerry_value_free (result_value);\n\n  if (mode == 4)\n  {\n    result_value = jerry_module_evaluate (parse_result_value);\n    TEST_ASSERT (!jerry_value_is_exception (result_value));\n    jerry_value_free (result_value);\n  }\n\n  return parse_result_value;\n} /* module_import_callback */\n\nstatic void\nrun_script (const char *source_p, /* source code */\n            jerry_parse_options_t *parse_options_p, /* parse options */\n            bool release_user_value) /* release user value */\n{\n  jerry_value_t parse_result_value;\n\n  parse_result_value = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), parse_options_p);\n  TEST_ASSERT (!jerry_value_is_exception (parse_result_value));\n\n  if (release_user_value)\n  {\n    jerry_value_free (parse_options_p->user_value);\n    jerry_heap_gc (JERRY_GC_PRESSURE_HIGH);\n  }\n\n  jerry_value_t result_value;\n  if (parse_options_p->options & JERRY_PARSE_MODULE)\n  {\n    result_value = jerry_module_link (parse_result_value, NULL, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (result_value));\n    jerry_value_free (result_value);\n\n    result_value = jerry_module_evaluate (parse_result_value);\n  }\n  else\n  {\n    result_value = jerry_run (parse_result_value);\n  }\n\n  jerry_value_free (parse_result_value);\n\n  TEST_ASSERT (!jerry_value_is_exception (result_value));\n  jerry_value_free (result_value);\n\n  result_value = jerry_run_jobs ();\n  TEST_ASSERT (!jerry_value_is_exception (result_value));\n  jerry_value_free (result_value);\n} /* run_script */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_MODULE))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Module is disabled!\\n\");\n    jerry_cleanup ();\n    return 0;\n  }\n\n  register_assert ();\n  jerry_module_on_import (module_import_callback, (void *) &mode);\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_NO_OPTS;\n\n  if (jerry_feature_enabled (JERRY_FEATURE_ERROR_MESSAGES))\n  {\n    run_script (\"var expected_message = 'Module cannot be instantiated'\", &parse_options, false);\n  }\n  else\n  {\n    run_script (\"var expected_message = ''\", &parse_options, false);\n  }\n\n  global_user_value = jerry_object ();\n  const char *source_p = TEST_STRING_LITERAL (\"import('01_module.mjs').then(\\n\"\n                                              \"  function(resolve) { assert(false) },\\n\"\n                                              \"  function(reject) {\\n\"\n                                              \"    assert(reject instanceof RangeError\\n\"\n                                              \"           && reject.message === 'Err01')\\n\"\n                                              \"  }\\n\"\n                                              \")\");\n\n  mode = 0;\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  parse_options.user_value = global_user_value;\n  run_script (source_p, &parse_options, false);\n  jerry_value_free (global_user_value);\n\n  global_user_value = jerry_null ();\n  source_p = TEST_STRING_LITERAL (\"var src = \\\"import('02_module.mjs').then(\\\\\\n\"\n                                  \"  function(resolve) { assert(false) },\\\\\\n\"\n                                  \"  function(reject) {\\\\\\n\"\n                                  \"    assert(reject instanceof RangeError\\\\\\n\"\n                                  \"           && reject.message === expected_message)\\\\\\n\"\n                                  \"  }\\\\\\n\"\n                                  \")\\\"\\n\"\n                                  \"eval('eval(src)')\");\n\n  mode = 1;\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  parse_options.user_value = global_user_value;\n  run_script (source_p, &parse_options, false);\n  jerry_value_free (global_user_value);\n\n  global_user_value = jerry_number (5.6);\n  source_p = TEST_STRING_LITERAL (\"function f() {\\n\"\n                                  \"  return function () {\\n\"\n                                  \"    return import('03_module.mjs')\\n\"\n                                  \"  }\\n\"\n                                  \"}\\n\"\n                                  \"export var a = f()().then(\\n\"\n                                  \"  function(resolve) { assert(typeof resolve == 'object') },\\n\"\n                                  \"  function(reject) { assert(false) }\\n\"\n                                  \")\");\n\n  mode = 2;\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE | JERRY_PARSE_MODULE;\n  parse_options.user_value = global_user_value;\n  run_script (source_p, &parse_options, false);\n  jerry_value_free (global_user_value);\n\n  global_user_value = jerry_string_sz (\"Any string...\");\n  source_p = TEST_STRING_LITERAL (\"var src = \\\"import('02_module.mjs').then(\\\\\\n\"\n                                  \"  function(resolve) { assert(typeof resolve == 'object') },\\\\\\n\"\n                                  \"  function(reject) { assert(false) }\\\\\\n\"\n                                  \")\\\"\\n\"\n                                  \"function f() {\\n\"\n                                  \"  eval('(function() { return eval(src) })()')\\n\"\n                                  \"}\\n\"\n                                  \"f()\\n\");\n\n  for (int i = 0; i < 2; i++)\n  {\n    mode = 3;\n    parse_options.options = JERRY_PARSE_HAS_USER_VALUE | (i == 1 ? JERRY_PARSE_MODULE : 0);\n    parse_options.user_value = jerry_object ();\n    jerry_value_t property_name = jerry_string_sz (\"MyProp1\");\n    jerry_value_t property_value = jerry_number (3.5);\n    jerry_value_t result = jerry_object_set (parse_options.user_value, property_name, property_value);\n    TEST_ASSERT (jerry_value_is_true (result));\n    jerry_value_free (result);\n    jerry_value_free (property_value);\n    jerry_value_free (property_name);\n\n    source_p = TEST_STRING_LITERAL (\"import('28_module.mjs')\");\n    run_script (source_p, &parse_options, true);\n  }\n\n  mode = 4;\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  parse_options.user_value = global_user_value;\n  run_script (source_p, &parse_options, false);\n  jerry_value_free (global_user_value);\n\n  global_user_value = jerry_function_external (global_assert);\n  source_p = TEST_STRING_LITERAL (\"var src = \\\"import('02_module.mjs').then(\\\\\\n\"\n                                  \"  function(resolve) { assert(false) },\\\\\\n\"\n                                  \"  function(reject) {\\\\\\n\"\n                                  \"    assert(reject instanceof RangeError\\\\\\n\"\n                                  \"           && reject.message === expected_message)\\\\\\n\"\n                                  \"  }\\\\\\n\"\n                                  \")\\\"\\n\"\n                                  \"export function f() {\\n\"\n                                  \"  eval('(function() { return eval(src) })()')\\n\"\n                                  \"}\\n\"\n                                  \"f()\\n\");\n\n  mode = 5;\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE | JERRY_PARSE_MODULE;\n  parse_options.user_value = global_user_value;\n  run_script (source_p, &parse_options, false);\n  jerry_value_free (global_user_value);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-module-import-meta.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic int counter = 0;\nstatic jerry_value_t global_module_value;\n\nstatic jerry_value_t\nglobal_assert (const jerry_call_info_t *call_info_p, /**< call information */\n               const jerry_value_t args_p[], /**< arguments list */\n               const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n\n  TEST_ASSERT (args_cnt == 1 && jerry_value_is_true (args_p[0]));\n  return jerry_boolean (true);\n} /* global_assert */\n\nstatic void\nregister_assert (void)\n{\n  jerry_value_t global_object_value = jerry_current_realm ();\n\n  jerry_value_t function_value = jerry_function_external (global_assert);\n  jerry_value_t function_name_value = jerry_string_sz (\"assert\");\n  jerry_value_t result_value = jerry_object_set (global_object_value, function_name_value, function_value);\n\n  jerry_value_free (function_name_value);\n  jerry_value_free (function_value);\n  jerry_value_free (global_object_value);\n\n  TEST_ASSERT (jerry_value_is_true (result_value));\n  jerry_value_free (result_value);\n} /* register_assert */\n\nstatic void\nmodule_import_meta_callback (const jerry_value_t module, /**< module */\n                             const jerry_value_t meta_object, /**< import.meta object */\n                             void *user_p) /**< user pointer */\n{\n  TEST_ASSERT (user_p == (void *) &counter);\n  TEST_ASSERT (module == global_module_value);\n\n  jerry_value_t property_name_value = jerry_string_sz (\"prop\");\n  jerry_value_t result_value = jerry_object_set (meta_object, property_name_value, property_name_value);\n  jerry_value_free (result_value);\n  jerry_value_free (property_name_value);\n\n  counter++;\n} /* module_import_meta_callback */\n\nstatic void\ntest_syntax_error (const char *source_p, /**< source code */\n                   const jerry_parse_options_t *options_p) /**< parse options */\n{\n  jerry_value_t result_value = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), options_p);\n  TEST_ASSERT (jerry_value_is_exception (result_value) && jerry_error_type (result_value) == JERRY_ERROR_SYNTAX);\n  jerry_value_free (result_value);\n} /* test_syntax_error */\n\nstatic void\nrun_module (const char *source_p, /* source code */\n            jerry_parse_options_t *parse_options_p) /* parse options */\n{\n  global_module_value = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), parse_options_p);\n  TEST_ASSERT (!jerry_value_is_exception (global_module_value));\n\n  jerry_value_t result_value = jerry_module_link (global_module_value, NULL, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (result_value));\n  jerry_value_free (result_value);\n\n  result_value = jerry_module_evaluate (global_module_value);\n\n  jerry_value_free (global_module_value);\n\n  TEST_ASSERT (!jerry_value_is_exception (result_value));\n  jerry_value_free (result_value);\n} /* run_module */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_MODULE))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Module is disabled!\\n\");\n    jerry_cleanup ();\n    return 0;\n  }\n\n  register_assert ();\n  jerry_module_on_import_meta (module_import_meta_callback, (void *) &counter);\n\n  /* Syntax errors. */\n  test_syntax_error (\"import.meta\", NULL);\n  test_syntax_error (\"var a = import.meta\", NULL);\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_MODULE;\n\n  test_syntax_error (\"import.m\\\\u0065ta\", &parse_options);\n  test_syntax_error (\"import.invalid\", &parse_options);\n\n  counter = 0;\n\n  run_module (TEST_STRING_LITERAL (\"assert(typeof import.meta === 'object')\\n\"), &parse_options);\n\n  run_module (TEST_STRING_LITERAL (\"assert(Object.getPrototypeOf(import.meta) === null)\\n\"), &parse_options);\n\n  run_module (TEST_STRING_LITERAL (\"var meta = import.meta\\n\"\n                                   \"assert(import.meta === meta)\\n\"\n                                   \"assert(import.meta === meta)\\n\"\n                                   \"function f() {\\n\"\n                                   \"  assert(import.meta === meta)\\n\"\n                                   \"}\\n\"\n                                   \"f()\\n\"),\n              &parse_options);\n\n  run_module (TEST_STRING_LITERAL (\"import.meta.x = 5.5\\n\"\n                                   \"assert(import.meta.x === 5.5)\\n\"),\n              &parse_options);\n\n  run_module (TEST_STRING_LITERAL (\"assert(import.meta.prop === 'prop')\\n\"\n                                   \"function f() {\\n\"\n                                   \"  import.meta.prop = 6.25\\n\"\n                                   \"  import.meta.prop2 = 's'\\n\"\n                                   \"\\n\"\n                                   \"  return function() {\\n\"\n                                   \"    assert(import.meta.prop === 6.25)\\n\"\n                                   \"    assert(import.meta.prop2 === 's')\\n\"\n                                   \"  }\\n\"\n                                   \"}\\n\"\n                                   \"f()()\\n\"),\n              &parse_options);\n\n  TEST_ASSERT (counter == 5);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-module.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <string.h>\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic void\ncompare_specifier (jerry_value_t specifier, /* string value */\n                   int id) /* module id */\n{\n  jerry_char_t string[] = \"XX_module.mjs\";\n\n  TEST_ASSERT (id >= 1 && id <= 99 && string[0] == 'X' && string[1] == 'X');\n\n  string[0] = (jerry_char_t) ((id / 10) + '0');\n  string[1] = (jerry_char_t) ((id % 10) + '0');\n\n  jerry_size_t length = (jerry_size_t) (sizeof (string) - 1);\n  jerry_char_t buffer[sizeof (string) - 1];\n\n  TEST_ASSERT (jerry_value_is_string (specifier));\n  TEST_ASSERT (jerry_string_size (specifier, JERRY_ENCODING_CESU8) == length);\n\n  TEST_ASSERT (jerry_string_to_buffer (specifier, JERRY_ENCODING_CESU8, buffer, length) == length);\n  TEST_ASSERT (memcmp (buffer, string, length) == 0);\n} /* compare_specifier */\n\nstatic void\ncompare_property (jerry_value_t namespace_object, /**< namespace object */\n                  const char *name_p, /**< property name */\n                  double expected_value) /**< property value (number for simplicity) */\n{\n  jerry_value_t name = jerry_string_sz (name_p);\n  jerry_value_t result = jerry_object_get (namespace_object, name);\n\n  TEST_ASSERT (jerry_value_is_number (result));\n  TEST_ASSERT (jerry_value_as_number (result) == expected_value);\n\n  jerry_value_free (result);\n  jerry_value_free (name);\n} /* compare_property */\n\nstatic jerry_value_t\ncreate_module (int id) /**< module id */\n{\n  jerry_parse_options_t module_parse_options;\n  module_parse_options.options = JERRY_PARSE_MODULE;\n\n  jerry_value_t result;\n\n  if (id == 0)\n  {\n    jerry_char_t source[] = \"export var a = 7\";\n\n    result = jerry_parse (source, sizeof (source) - 1, &module_parse_options);\n  }\n  else\n  {\n    jerry_char_t source[] = \"export {a} from 'XX_module.mjs'\";\n\n    TEST_ASSERT (id >= 1 && id <= 99 && source[17] == 'X' && source[18] == 'X');\n\n    source[17] = (jerry_char_t) ((id / 10) + '0');\n    source[18] = (jerry_char_t) ((id % 10) + '0');\n\n    result = jerry_parse (source, sizeof (source) - 1, &module_parse_options);\n  }\n\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  return result;\n} /* create_module */\n\nstatic int counter = 0;\nstatic jerry_value_t module;\n\nstatic jerry_value_t\nresolve_callback1 (const jerry_value_t specifier, /**< module specifier */\n                   const jerry_value_t referrer, /**< parent module */\n                   void *user_p) /**< user data */\n{\n  TEST_ASSERT (user_p == (void *) &module);\n  TEST_ASSERT (referrer == module);\n  compare_specifier (specifier, 1);\n\n  counter++;\n  return counter == 1 ? jerry_number (7) : jerry_object ();\n} /* resolve_callback1 */\n\nstatic jerry_value_t prev_module;\nstatic bool terminate_with_error;\n\nstatic jerry_value_t\nresolve_callback2 (const jerry_value_t specifier, /**< module specifier */\n                   const jerry_value_t referrer, /**< parent module */\n                   void *user_p) /**< user data */\n{\n  TEST_ASSERT (prev_module == referrer);\n  TEST_ASSERT (user_p == NULL);\n\n  compare_specifier (specifier, ++counter);\n\n  if (counter >= 32)\n  {\n    if (terminate_with_error)\n    {\n      return jerry_throw_sz (JERRY_ERROR_RANGE, \"Module not found\");\n    }\n\n    return create_module (0);\n  }\n\n  prev_module = create_module (counter + 1);\n  return prev_module;\n} /* resolve_callback2 */\n\nstatic jerry_value_t\nresolve_callback3 (const jerry_value_t specifier, /**< module specifier */\n                   const jerry_value_t referrer, /**< parent module */\n                   void *user_p) /**< user data */\n{\n  (void) specifier;\n  (void) referrer;\n  (void) user_p;\n\n  TEST_ASSERT (false);\n} /* resolve_callback3 */\n\nstatic jerry_value_t\nnative_module_evaluate (const jerry_value_t native_module) /**< native module */\n{\n  ++counter;\n\n  TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_EVALUATING);\n\n  jerry_value_t exp_val = jerry_string_sz (\"exp\");\n  jerry_value_t other_exp_val = jerry_string_sz (\"other_exp\");\n  /* The native module has no such export. */\n  jerry_value_t no_exp_val = jerry_string_sz (\"no_exp\");\n\n  jerry_value_t result = jerry_native_module_get (native_module, exp_val);\n  TEST_ASSERT (jerry_value_is_undefined (result));\n  jerry_value_free (result);\n\n  result = jerry_native_module_get (native_module, other_exp_val);\n  TEST_ASSERT (jerry_value_is_undefined (result));\n  jerry_value_free (result);\n\n  result = jerry_native_module_get (native_module, no_exp_val);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  TEST_ASSERT (jerry_error_type (result) == JERRY_ERROR_REFERENCE);\n  jerry_value_free (result);\n\n  jerry_value_t export = jerry_number (3.5);\n  result = jerry_native_module_set (native_module, exp_val, export);\n  TEST_ASSERT (jerry_value_is_boolean (result) && jerry_value_is_true (result));\n  jerry_value_free (result);\n  jerry_value_free (export);\n\n  export = jerry_string_sz (\"str\");\n  result = jerry_native_module_set (native_module, other_exp_val, export);\n  TEST_ASSERT (jerry_value_is_boolean (result) && jerry_value_is_true (result));\n  jerry_value_free (result);\n  jerry_value_free (export);\n\n  result = jerry_native_module_set (native_module, no_exp_val, no_exp_val);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  TEST_ASSERT (jerry_error_type (result) == JERRY_ERROR_REFERENCE);\n  jerry_value_free (result);\n\n  result = jerry_native_module_get (native_module, exp_val);\n  TEST_ASSERT (jerry_value_is_number (result) && jerry_value_as_number (result) == 3.5);\n  jerry_value_free (result);\n\n  result = jerry_native_module_get (native_module, other_exp_val);\n  TEST_ASSERT (jerry_value_is_string (result));\n  jerry_value_free (result);\n\n  jerry_value_free (exp_val);\n  jerry_value_free (other_exp_val);\n  jerry_value_free (no_exp_val);\n\n  if (counter == 4)\n  {\n    ++counter;\n    return jerry_throw_sz (JERRY_ERROR_COMMON, \"Ooops!\");\n  }\n\n  return jerry_undefined ();\n} /* native_module_evaluate */\n\nstatic jerry_value_t\nresolve_callback4 (const jerry_value_t specifier, /**< module specifier */\n                   const jerry_value_t referrer, /**< parent module */\n                   void *user_p) /**< user data */\n{\n  (void) specifier;\n  (void) referrer;\n\n  ++counter;\n\n  jerry_value_t exports[2] = { jerry_string_sz (\"exp\"), jerry_string_sz (\"other_exp\") };\n\n  jerry_value_t native_module = jerry_native_module (native_module_evaluate, exports, 2);\n  TEST_ASSERT (!jerry_value_is_exception (native_module));\n\n  jerry_value_free (exports[0]);\n  jerry_value_free (exports[1]);\n\n  *((jerry_value_t *) user_p) = jerry_value_copy (native_module);\n  return native_module;\n} /* resolve_callback4 */\n\nstatic void\nmodule_state_changed (jerry_module_state_t new_state, /**< new state of the module */\n                      const jerry_value_t module_val, /**< a module whose state is changed */\n                      const jerry_value_t value, /**< value argument */\n                      void *user_p) /**< user pointer */\n{\n  TEST_ASSERT (jerry_module_state (module_val) == new_state);\n  TEST_ASSERT (module_val == module);\n  TEST_ASSERT (user_p == (void *) &counter);\n\n  ++counter;\n\n  switch (counter)\n  {\n    case 1:\n    case 3:\n    {\n      TEST_ASSERT (new_state == JERRY_MODULE_STATE_LINKED);\n      TEST_ASSERT (jerry_value_is_undefined (value));\n      break;\n    }\n    case 2:\n    {\n      TEST_ASSERT (new_state == JERRY_MODULE_STATE_EVALUATED);\n      TEST_ASSERT (jerry_value_is_number (value) && jerry_value_as_number (value) == 33.5);\n      break;\n    }\n    default:\n    {\n      TEST_ASSERT (counter == 4);\n      TEST_ASSERT (new_state == JERRY_MODULE_STATE_ERROR);\n      TEST_ASSERT (jerry_value_is_number (value) && jerry_value_as_number (value) == -5.5);\n      break;\n    }\n  }\n} /* module_state_changed */\n\nstatic jerry_value_t\nresolve_callback5 (const jerry_value_t specifier, /**< module specifier */\n                   const jerry_value_t referrer, /**< parent module */\n                   void *user_p) /**< user data */\n{\n  (void) specifier;\n  (void) user_p;\n\n  /* This circular reference is valid. However, import resolving triggers\n   * a SyntaxError, because the module does not export a default binding. */\n  return referrer;\n} /* resolve_callback5 */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_MODULE))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Module is disabled!\\n\");\n    jerry_cleanup ();\n    return 0;\n  }\n\n  jerry_value_t number = jerry_number (5);\n  jerry_value_t object = jerry_object ();\n\n  jerry_value_t result = jerry_module_link (number, resolve_callback1, NULL);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  result = jerry_module_link (object, resolve_callback1, NULL);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  module = create_module (1);\n\n  /* After an error, module must remain in unlinked mode. */\n  result = jerry_module_link (module, resolve_callback1, (void *) &module);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  TEST_ASSERT (counter == 1);\n  jerry_value_free (result);\n\n  result = jerry_module_link (module, resolve_callback1, (void *) &module);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  TEST_ASSERT (counter == 2);\n  jerry_value_free (result);\n\n  prev_module = module;\n  counter = 0;\n  terminate_with_error = true;\n  result = jerry_module_link (module, resolve_callback2, NULL);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  TEST_ASSERT (counter == 32);\n  jerry_value_free (result);\n\n  /* The successfully resolved modules is kept around in unlinked state. */\n  jerry_heap_gc (JERRY_GC_PRESSURE_HIGH);\n\n  counter = 31;\n  terminate_with_error = false;\n  result = jerry_module_link (module, resolve_callback2, NULL);\n  TEST_ASSERT (jerry_value_is_boolean (result) && jerry_value_is_true (result));\n  TEST_ASSERT (counter == 32);\n  jerry_value_free (result);\n\n  TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_LINKED);\n  TEST_ASSERT (jerry_module_request_count (module) == 1);\n  result = jerry_module_request (module, 0);\n  TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_LINKED);\n  jerry_value_free (result);\n\n  jerry_value_free (module);\n\n  module = create_module (1);\n\n  prev_module = module;\n  counter = 0;\n  terminate_with_error = false;\n  result = jerry_module_link (module, resolve_callback2, NULL);\n  TEST_ASSERT (jerry_value_is_boolean (result) && jerry_value_is_true (result));\n  TEST_ASSERT (counter == 32);\n  jerry_value_free (result);\n  jerry_value_free (module);\n\n  TEST_ASSERT (jerry_module_state (number) == JERRY_MODULE_STATE_INVALID);\n\n  jerry_parse_options_t module_parse_options;\n  module_parse_options.options = JERRY_PARSE_MODULE;\n\n  jerry_char_t source1[] = TEST_STRING_LITERAL (\"import a from '16_module.mjs'\\n\"\n                                                \"export * from '07_module.mjs'\\n\"\n                                                \"export * from '44_module.mjs'\\n\"\n                                                \"import * as b from '36_module.mjs'\\n\");\n  module = jerry_parse (source1, sizeof (source1) - 1, &module_parse_options);\n  TEST_ASSERT (!jerry_value_is_exception (module));\n  TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_UNLINKED);\n\n  TEST_ASSERT (jerry_module_request_count (number) == 0);\n  TEST_ASSERT (jerry_module_request_count (module) == 4);\n\n  result = jerry_module_request (object, 0);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  result = jerry_module_request (module, 0);\n  compare_specifier (result, 16);\n  jerry_value_free (result);\n\n  result = jerry_module_request (module, 1);\n  compare_specifier (result, 7);\n  jerry_value_free (result);\n\n  result = jerry_module_request (module, 2);\n  compare_specifier (result, 44);\n  jerry_value_free (result);\n\n  result = jerry_module_request (module, 3);\n  compare_specifier (result, 36);\n  jerry_value_free (result);\n\n  result = jerry_module_request (module, 4);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  jerry_value_free (module);\n\n  result = jerry_module_namespace (number);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  jerry_char_t source2[] = TEST_STRING_LITERAL (\"export let a = 6\\n\"\n                                                \"export let b = 8.5\\n\");\n  module = jerry_parse (source2, sizeof (source2) - 1, &module_parse_options);\n  TEST_ASSERT (!jerry_value_is_exception (module));\n  TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_UNLINKED);\n\n  result = jerry_module_link (module, resolve_callback3, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_LINKED);\n\n  result = jerry_module_evaluate (module);\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_EVALUATED);\n\n  result = jerry_module_namespace (module);\n  TEST_ASSERT (jerry_value_is_object (result));\n  compare_property (result, \"a\", 6);\n  compare_property (result, \"b\", 8.5);\n  jerry_value_free (result);\n\n  jerry_value_free (module);\n\n  module = jerry_native_module (NULL, &object, 1);\n  TEST_ASSERT (jerry_value_is_exception (module));\n  jerry_value_free (module);\n\n  module = jerry_native_module (NULL, NULL, 0);\n  TEST_ASSERT (!jerry_value_is_exception (module));\n  TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_UNLINKED);\n\n  result = jerry_native_module_get (object, number);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  result = jerry_native_module_set (module, number, number);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  jerry_value_free (module);\n\n  /* Valid identifier. */\n  jerry_value_t export = jerry_string_sz (\"\\xed\\xa0\\x83\\xed\\xb2\\x80\");\n\n  module = jerry_native_module (NULL, &export, 1);\n  TEST_ASSERT (!jerry_value_is_exception (module));\n  TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_UNLINKED);\n\n  result = jerry_module_link (module, NULL, NULL);\n  TEST_ASSERT (jerry_value_is_boolean (result) && jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  result = jerry_module_evaluate (module);\n  TEST_ASSERT (jerry_value_is_undefined (result));\n  jerry_value_free (result);\n\n  jerry_value_free (module);\n  jerry_value_free (export);\n\n  /* Invalid identifiers. */\n  export = jerry_string_sz (\"a+\");\n  module = jerry_native_module (NULL, &export, 1);\n  TEST_ASSERT (jerry_value_is_exception (module));\n  jerry_value_free (module);\n  jerry_value_free (export);\n\n  export = jerry_string_sz (\"\\xed\\xa0\\x80\");\n  module = jerry_native_module (NULL, &export, 1);\n  TEST_ASSERT (jerry_value_is_exception (module));\n  jerry_value_free (module);\n  jerry_value_free (export);\n\n  counter = 0;\n\n  for (int i = 0; i < 2; i++)\n  {\n    jerry_char_t source3[] = TEST_STRING_LITERAL (\n      \"import {exp, other_exp as other} from 'native.js'\\n\"\n      \"import * as namespace from 'native.js'\\n\"\n      \"if (exp !== 3.5 || other !== 'str') { throw 'Assertion failed!' }\\n\"\n      \"if (namespace.exp !== 3.5 || namespace.other_exp !== 'str') { throw 'Assertion failed!' }\\n\");\n    module = jerry_parse (source3, sizeof (source3) - 1, &module_parse_options);\n    TEST_ASSERT (!jerry_value_is_exception (module));\n    TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_UNLINKED);\n\n    jerry_value_t native_module;\n\n    result = jerry_module_link (module, resolve_callback4, (void *) &native_module);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n    jerry_value_free (result);\n\n    TEST_ASSERT (counter == i * 2 + 1);\n    TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_LINKED);\n    TEST_ASSERT (jerry_module_state (native_module) == JERRY_MODULE_STATE_LINKED);\n\n    result = jerry_module_evaluate (module);\n\n    if (i == 0)\n    {\n      TEST_ASSERT (!jerry_value_is_exception (result));\n      TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_EVALUATED);\n      TEST_ASSERT (jerry_module_state (native_module) == JERRY_MODULE_STATE_EVALUATED);\n      TEST_ASSERT (counter == 2);\n    }\n    else\n    {\n      TEST_ASSERT (jerry_value_is_exception (result));\n      TEST_ASSERT (jerry_module_state (module) == JERRY_MODULE_STATE_ERROR);\n      TEST_ASSERT (jerry_module_state (native_module) == JERRY_MODULE_STATE_ERROR);\n      TEST_ASSERT (counter == 5);\n    }\n\n    jerry_value_free (result);\n    jerry_value_free (module);\n    jerry_value_free (native_module);\n  }\n\n  jerry_value_free (object);\n  jerry_value_free (number);\n\n  counter = 0;\n  jerry_module_on_state_changed (module_state_changed, (void *) &counter);\n\n  jerry_char_t source4[] = TEST_STRING_LITERAL (\"33.5\\n\");\n  module = jerry_parse (source4, sizeof (source4) - 1, &module_parse_options);\n\n  result = jerry_module_link (module, NULL, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  result = jerry_module_evaluate (module);\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  jerry_value_free (module);\n\n  jerry_char_t source5[] = TEST_STRING_LITERAL (\"throw -5.5\\n\");\n  module = jerry_parse (source5, sizeof (source5) - 1, &module_parse_options);\n\n  result = jerry_module_link (module, NULL, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  result = jerry_module_evaluate (module);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  jerry_value_free (module);\n\n  jerry_module_on_state_changed (NULL, NULL);\n\n  TEST_ASSERT (counter == 4);\n\n  jerry_char_t source6[] = TEST_STRING_LITERAL (\"import a from 'self'\\n\");\n  module = jerry_parse (source6, sizeof (source6) - 1, &module_parse_options);\n\n  result = jerry_module_link (module, resolve_callback5, NULL);\n  TEST_ASSERT (jerry_value_is_exception (result) && jerry_error_type (result) == JERRY_ERROR_SYNTAX);\n  jerry_value_free (result);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-native-callback-nested.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic void\nnative_cb2 (void)\n{\n  jerry_value_t array = jerry_array (100);\n  jerry_value_free (array);\n} /* native_cb2 */\n\nstatic const jerry_object_native_info_t native_info2 = {\n  .free_cb = (jerry_object_native_free_cb_t) native_cb2,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic void\nnative_cb (void)\n{\n  jerry_value_t array = jerry_array (100);\n\n  jerry_object_set_native_ptr (array, &native_info2, NULL);\n\n  jerry_value_free (array);\n} /* native_cb */\n\nstatic const jerry_object_native_info_t native_info = {\n  .free_cb = (jerry_object_native_free_cb_t) native_cb,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t obj = jerry_object ();\n\n  jerry_object_set_native_ptr (obj, &native_info, NULL);\n  jerry_value_free (obj);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-native-instanceof.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic const char instanceof_source[] = \"var x = function(o, c) {return (o instanceof c);}; x\";\n\nstatic jerry_value_t\nexternal_function (const jerry_call_info_t *call_info_p, const jerry_value_t args_p[], const jerry_size_t args_count)\n{\n  (void) call_info_p;\n  (void) args_p;\n  (void) args_count;\n\n  return jerry_undefined ();\n} /* external_function */\n\nstatic void\ntest_instanceof (jerry_value_t instanceof, jerry_value_t constructor)\n{\n  jerry_value_t instance = jerry_construct (constructor, NULL, 0);\n  jerry_value_t args[2] = { instance, constructor };\n\n  jerry_value_t undefined = jerry_undefined ();\n  jerry_value_t result = jerry_call (instanceof, undefined, args, 2);\n  jerry_value_free (undefined);\n\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  TEST_ASSERT (jerry_value_is_boolean (result));\n\n  TEST_ASSERT (jerry_value_is_true (result));\n\n  jerry_value_free (instance);\n  jerry_value_free (result);\n} /* test_instanceof */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t instanceof = jerry_eval ((jerry_char_t *) instanceof_source, sizeof (instanceof_source) - 1, true);\n\n  /* Test for a native-backed function. */\n  jerry_value_t constructor = jerry_function_external (external_function);\n\n  test_instanceof (instanceof, constructor);\n  jerry_value_free (constructor);\n\n  /* Test for a JS constructor. */\n  jerry_value_t global = jerry_current_realm ();\n  jerry_value_t object_name = jerry_string_sz (\"Object\");\n  constructor = jerry_object_get (global, object_name);\n  jerry_value_free (object_name);\n  jerry_value_free (global);\n\n  test_instanceof (instanceof, constructor);\n  jerry_value_free (constructor);\n\n  jerry_value_free (instanceof);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-native-pointer.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic int global_int = 4;\nstatic void *global_p = (void *) &global_int;\nstatic int global_counter = 0;\n\nstatic void\nnative_free_callback (void *native_p, /**< native pointer */\n                      jerry_object_native_info_t *info_p) /**< native info */\n{\n  (void) native_p;\n  TEST_ASSERT (info_p->free_cb == native_free_callback);\n  global_counter++;\n} /* native_free_callback */\n\nstatic const jerry_object_native_info_t native_info_1 = {\n  .free_cb = native_free_callback,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic const jerry_object_native_info_t native_info_2 = {\n  .free_cb = NULL,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic const jerry_object_native_info_t native_info_3 = {\n  .free_cb = NULL,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\ntypedef struct\n{\n  uint32_t check_before;\n  jerry_value_t a;\n  jerry_value_t b;\n  jerry_value_t c;\n  uint32_t check_after;\n} test_references_t;\n\nstatic test_references_t test_references1;\nstatic test_references_t test_references2;\nstatic test_references_t test_references3;\nstatic test_references_t test_references4;\nstatic int call_count = 0;\n\nstatic void\nnative_references_free_callback (void *native_p, /**< native pointer */\n                                 jerry_object_native_info_t *info_p) /**< native info */\n{\n  test_references_t *refs_p = (test_references_t *) native_p;\n\n  TEST_ASSERT ((refs_p == &test_references1 && test_references1.check_before == 0x12345678)\n               || (refs_p == &test_references2 && test_references2.check_before == 0x87654321)\n               || (refs_p == &test_references3 && test_references3.check_before == 0x12344321));\n  TEST_ASSERT (refs_p->check_before == refs_p->check_after);\n\n  uint32_t check = refs_p->check_before;\n\n  jerry_native_ptr_free (native_p, info_p);\n\n  TEST_ASSERT (jerry_value_is_undefined (refs_p->a));\n  TEST_ASSERT (jerry_value_is_undefined (refs_p->b));\n  TEST_ASSERT (jerry_value_is_undefined (refs_p->c));\n  TEST_ASSERT (refs_p->check_before == check);\n  TEST_ASSERT (refs_p->check_after == check);\n\n  call_count++;\n} /* native_references_free_callback */\n\nstatic const jerry_object_native_info_t native_info_4 = {\n  .free_cb = native_references_free_callback,\n  .number_of_references = 3,\n  .offset_of_references = (uint16_t) offsetof (test_references_t, a),\n};\n\nstatic void\ninit_references (test_references_t *refs_p, /**< native pointer */\n                 uint32_t check) /**< value for memory check */\n{\n  /* Memory garbage */\n  refs_p->check_before = check;\n  refs_p->a = 1;\n  refs_p->b = 2;\n  refs_p->c = 3;\n  refs_p->check_after = check;\n\n  jerry_native_ptr_init ((void *) refs_p, &native_info_4);\n\n  TEST_ASSERT (jerry_value_is_undefined (refs_p->a));\n  TEST_ASSERT (jerry_value_is_undefined (refs_p->b));\n  TEST_ASSERT (jerry_value_is_undefined (refs_p->c));\n  TEST_ASSERT (refs_p->check_before == check);\n  TEST_ASSERT (refs_p->check_after == check);\n} /* init_references */\n\nstatic void\nset_references (test_references_t *refs_p, /**< native pointer */\n                jerry_value_t value1, /**< first value to be set */\n                jerry_value_t value2, /**< second value to be set */\n                jerry_value_t value3) /**< third value to be set */\n{\n  jerry_native_ptr_set (&refs_p->a, value1);\n  jerry_native_ptr_set (&refs_p->b, value2);\n  jerry_native_ptr_set (&refs_p->c, value3);\n\n  TEST_ASSERT (jerry_value_is_object (value1) ? jerry_value_is_object (refs_p->a) : jerry_value_is_string (refs_p->a));\n  TEST_ASSERT (jerry_value_is_object (value2) ? jerry_value_is_object (refs_p->b) : jerry_value_is_string (refs_p->b));\n  TEST_ASSERT (jerry_value_is_object (value3) ? jerry_value_is_object (refs_p->c) : jerry_value_is_string (refs_p->c));\n} /* set_references */\n\nstatic void\ncheck_native_info (jerry_value_t object_value, /**< object value */\n                   const jerry_object_native_info_t *native_info_p, /**< native info */\n                   void *expected_pointer_p) /**< expected pointer */\n{\n  TEST_ASSERT (jerry_object_has_native_ptr (object_value, native_info_p));\n  void *native_pointer_p = jerry_object_get_native_ptr (object_value, native_info_p);\n  TEST_ASSERT (native_pointer_p == expected_pointer_p);\n} /* check_native_info */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t object_value = jerry_object ();\n\n  jerry_object_set_native_ptr (object_value, &native_info_1, global_p);\n  jerry_object_set_native_ptr (object_value, &native_info_2, NULL);\n\n  check_native_info (object_value, &native_info_1, global_p);\n  check_native_info (object_value, &native_info_2, NULL);\n\n  jerry_value_free (object_value);\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_HIGH);\n  TEST_ASSERT (global_counter == 1);\n  global_counter = 0;\n\n  object_value = jerry_object ();\n\n  jerry_object_set_native_ptr (object_value, &native_info_1, global_p);\n  jerry_object_set_native_ptr (object_value, &native_info_2, NULL);\n\n  TEST_ASSERT (jerry_object_delete_native_ptr (object_value, &native_info_1));\n\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_1));\n  check_native_info (object_value, &native_info_2, NULL);\n\n  TEST_ASSERT (!jerry_object_delete_native_ptr (object_value, &native_info_1));\n\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_1));\n  check_native_info (object_value, &native_info_2, NULL);\n\n  TEST_ASSERT (jerry_object_delete_native_ptr (object_value, &native_info_2));\n\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_1));\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_2));\n\n  jerry_object_set_native_ptr (object_value, &native_info_1, NULL);\n\n  check_native_info (object_value, &native_info_1, NULL);\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_2));\n\n  jerry_object_set_native_ptr (object_value, &native_info_2, global_p);\n\n  check_native_info (object_value, &native_info_1, NULL);\n  check_native_info (object_value, &native_info_2, global_p);\n\n  jerry_object_set_native_ptr (object_value, &native_info_1, global_p);\n\n  check_native_info (object_value, &native_info_1, global_p);\n  check_native_info (object_value, &native_info_2, global_p);\n\n  TEST_ASSERT (jerry_object_delete_native_ptr (object_value, &native_info_1));\n  TEST_ASSERT (jerry_object_delete_native_ptr (object_value, &native_info_2));\n\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_1));\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_2));\n\n  jerry_object_set_native_ptr (object_value, &native_info_1, global_p);\n  jerry_object_set_native_ptr (object_value, &native_info_2, NULL);\n  jerry_object_set_native_ptr (object_value, &native_info_3, global_p);\n\n  check_native_info (object_value, &native_info_1, global_p);\n  check_native_info (object_value, &native_info_2, NULL);\n  check_native_info (object_value, &native_info_3, global_p);\n\n  TEST_ASSERT (jerry_object_delete_native_ptr (object_value, &native_info_1));\n  TEST_ASSERT (jerry_object_delete_native_ptr (object_value, &native_info_2));\n  TEST_ASSERT (jerry_object_delete_native_ptr (object_value, &native_info_3));\n\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_1));\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_2));\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_3));\n\n  jerry_object_set_native_ptr (object_value, &native_info_1, NULL);\n  jerry_object_set_native_ptr (object_value, &native_info_2, global_p);\n  jerry_object_set_native_ptr (object_value, &native_info_3, NULL);\n\n  check_native_info (object_value, &native_info_1, NULL);\n  check_native_info (object_value, &native_info_2, global_p);\n  check_native_info (object_value, &native_info_3, NULL);\n\n  /* Reversed delete order. */\n  TEST_ASSERT (jerry_object_delete_native_ptr (object_value, &native_info_3));\n  TEST_ASSERT (jerry_object_delete_native_ptr (object_value, &native_info_2));\n  TEST_ASSERT (jerry_object_delete_native_ptr (object_value, &native_info_1));\n\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_1));\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_2));\n  TEST_ASSERT (!jerry_object_has_native_ptr (object_value, &native_info_3));\n\n  /* Test value references */\n  jerry_value_t string1_value = jerry_string_sz (\"String1\");\n  jerry_value_t string2_value = jerry_string_sz (\"String2\");\n\n  jerry_value_t object1_value = jerry_object ();\n  jerry_value_t object2_value = jerry_object ();\n\n  init_references (&test_references1, 0x12345678);\n  init_references (&test_references2, 0x87654321);\n\n  jerry_object_set_native_ptr (object1_value, &native_info_4, (void *) &test_references1);\n  jerry_object_set_native_ptr (object2_value, &native_info_4, (void *) &test_references2);\n\n  /* Assign values (cross reference between object1 and object2). */\n  set_references (&test_references1, string1_value, object2_value, string2_value);\n  set_references (&test_references2, string2_value, object1_value, string1_value);\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_HIGH);\n\n  /* Reassign values. */\n  set_references (&test_references1, object2_value, string2_value, string1_value);\n  set_references (&test_references2, object1_value, string1_value, string2_value);\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_HIGH);\n\n  jerry_value_free (object1_value);\n  jerry_value_free (object2_value);\n\n  object1_value = jerry_object ();\n  object2_value = jerry_object ();\n\n  init_references (&test_references3, 0x12344321);\n\n  /* Assign the same native pointer to multiple objects. */\n  jerry_object_set_native_ptr (object1_value, &native_info_4, (void *) &test_references3);\n  jerry_object_set_native_ptr (object2_value, &native_info_4, (void *) &test_references3);\n\n  set_references (&test_references3, object1_value, object2_value, string1_value);\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_HIGH);\n\n  init_references (&test_references4, 0x87655678);\n\n  /* Re-assign reference */\n  jerry_object_set_native_ptr (object1_value, &native_info_4, (void *) &test_references4);\n\n  set_references (&test_references4, string1_value, string2_value, string1_value);\n\n  jerry_object_set_native_ptr (object1_value, &native_info_4, NULL);\n\n  jerry_native_ptr_free ((void *) &test_references4, &native_info_4);\n\n  /* Calling jerry_native_ptr_init with test_references4 is optional here. */\n\n  jerry_object_set_native_ptr (object1_value, &native_info_4, (void *) &test_references4);\n\n  set_references (&test_references4, string2_value, string1_value, string2_value);\n\n  TEST_ASSERT (jerry_object_delete_native_ptr (object1_value, &native_info_4));\n\n  jerry_native_ptr_free ((void *) &test_references4, &native_info_4);\n\n  jerry_value_free (object1_value);\n  jerry_value_free (object2_value);\n\n  /* Delete references */\n  for (int i = 0; i < 3; i++)\n  {\n    object1_value = jerry_object ();\n\n    jerry_object_set_native_ptr (object1_value, NULL, global_p);\n    jerry_object_set_native_ptr (object1_value, &native_info_4, (void *) &test_references4);\n    jerry_object_set_native_ptr (object1_value, &native_info_2, global_p);\n    set_references (&test_references4, string1_value, string2_value, object1_value);\n\n    jerry_heap_gc (JERRY_GC_PRESSURE_HIGH);\n\n    if (i == 1)\n    {\n      TEST_ASSERT (jerry_object_delete_native_ptr (object1_value, NULL));\n    }\n    else if (i == 2)\n    {\n      TEST_ASSERT (jerry_object_delete_native_ptr (object1_value, &native_info_2));\n    }\n\n    TEST_ASSERT (jerry_object_delete_native_ptr (object1_value, &native_info_4));\n    jerry_native_ptr_free ((void *) &test_references4, &native_info_4);\n    jerry_value_free (object1_value);\n  }\n\n  jerry_value_free (string1_value);\n  jerry_value_free (string2_value);\n\n  jerry_value_free (object_value);\n\n  jerry_cleanup ();\n\n  TEST_ASSERT (global_counter == 0);\n  TEST_ASSERT (call_count == 3);\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-newtarget.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\n/**\n * Register a JavaScript function in the global object.\n */\nstatic jerry_value_t\nregister_js_function (const char *name_p, /**< name of the function */\n                      jerry_external_handler_t handler_p) /**< function callback */\n{\n  jerry_value_t global_obj_val = jerry_current_realm ();\n\n  jerry_value_t function_val = jerry_function_external (handler_p);\n  jerry_value_t function_name_val = jerry_string_sz (name_p);\n  jerry_value_t result_val = jerry_object_set (global_obj_val, function_name_val, function_val);\n\n  jerry_value_free (function_name_val);\n  jerry_value_free (global_obj_val);\n\n  jerry_value_free (result_val);\n\n  return function_val;\n} /* register_js_function */\n\nenum\n{\n  TEST_ID_SIMPLE_CONSTRUCT = 1,\n  TEST_ID_SIMPLE_CALL = 2,\n  TEST_ID_CONSTRUCT_AND_CALL_SUB = 3,\n};\n\nstatic jerry_value_t\nconstruct_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                   const jerry_value_t args_p[], /**< function arguments */\n                   const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  JERRY_UNUSED (args_p);\n\n  if (args_cnt != 1 || !jerry_value_is_number (args_p[0]))\n  {\n    TEST_ASSERT (0 && \"Invalid arguments for demo method\");\n  }\n\n  int test_id = (int) jerry_value_as_number (args_p[0]);\n\n  switch (test_id)\n  {\n    case TEST_ID_SIMPLE_CONSTRUCT:\n    {\n      /* Method was called with \"new\": new.target should be equal to the function object. */\n      jerry_value_t target = call_info_p->new_target;\n      TEST_ASSERT (!jerry_value_is_undefined (target));\n      TEST_ASSERT (target == call_info_p->function);\n      break;\n    }\n    case TEST_ID_SIMPLE_CALL:\n    {\n      /* Method was called directly without \"new\": new.target should be equal undefined. */\n      jerry_value_t target = call_info_p->new_target;\n      TEST_ASSERT (jerry_value_is_undefined (target));\n      TEST_ASSERT (target != call_info_p->function);\n      break;\n    }\n    case TEST_ID_CONSTRUCT_AND_CALL_SUB:\n    {\n      /* Method was called with \"new\": new.target should be equal to the function object. */\n      jerry_value_t target = call_info_p->new_target;\n      TEST_ASSERT (!jerry_value_is_undefined (target));\n      TEST_ASSERT (target == call_info_p->function);\n\n      /* Calling a function should hide the old \"new.target\". */\n      jerry_value_t sub_arg = jerry_number (TEST_ID_SIMPLE_CALL);\n      jerry_value_t func_call_result;\n\n      func_call_result = jerry_call (call_info_p->function, call_info_p->this_value, &sub_arg, 1);\n      TEST_ASSERT (!jerry_value_is_exception (func_call_result));\n      TEST_ASSERT (jerry_value_is_undefined (func_call_result));\n      break;\n    }\n\n    default:\n    {\n      TEST_ASSERT (0 && \"Incorrect test ID\");\n      break;\n    }\n  }\n\n  return jerry_undefined ();\n} /* construct_handler */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t demo_func = register_js_function (\"Demo\", construct_handler);\n\n  {\n    jerry_value_t test_arg = jerry_number (TEST_ID_SIMPLE_CONSTRUCT);\n    jerry_value_t constructed = jerry_construct (demo_func, &test_arg, 1);\n    TEST_ASSERT (!jerry_value_is_exception (constructed));\n    TEST_ASSERT (jerry_value_is_object (constructed));\n    jerry_value_free (test_arg);\n    jerry_value_free (constructed);\n  }\n\n  {\n    jerry_value_t test_arg = jerry_number (TEST_ID_SIMPLE_CALL);\n    jerry_value_t this_arg = jerry_undefined ();\n    jerry_value_t constructed = jerry_call (demo_func, this_arg, &test_arg, 1);\n    TEST_ASSERT (jerry_value_is_undefined (constructed));\n    jerry_value_free (constructed);\n    jerry_value_free (constructed);\n    jerry_value_free (test_arg);\n  }\n\n  {\n    jerry_value_t test_arg = jerry_number (TEST_ID_CONSTRUCT_AND_CALL_SUB);\n    jerry_value_t constructed = jerry_construct (demo_func, &test_arg, 1);\n    TEST_ASSERT (!jerry_value_is_exception (constructed));\n    TEST_ASSERT (jerry_value_is_object (constructed));\n    jerry_value_free (test_arg);\n    jerry_value_free (constructed);\n  }\n\n  {\n    static const jerry_char_t test_source[] = TEST_STRING_LITERAL (\"new Demo (1)\");\n\n    jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n\n    jerry_value_t res = jerry_run (parsed_code_val);\n    TEST_ASSERT (!jerry_value_is_exception (res));\n\n    jerry_value_free (res);\n    jerry_value_free (parsed_code_val);\n  }\n\n  {\n    static const jerry_char_t test_source[] = TEST_STRING_LITERAL (\"Demo (2)\");\n\n    jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n\n    jerry_value_t res = jerry_run (parsed_code_val);\n    TEST_ASSERT (!jerry_value_is_exception (res));\n\n    jerry_value_free (res);\n    jerry_value_free (parsed_code_val);\n  }\n\n  {\n    static const jerry_char_t test_source[] = TEST_STRING_LITERAL (\"function base(arg) { new Demo (arg); };\"\n                                                                   \"base (1);\"\n                                                                   \"new base(1);\"\n                                                                   \"new base(3);\");\n\n    jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n\n    jerry_value_t res = jerry_run (parsed_code_val);\n    TEST_ASSERT (!jerry_value_is_exception (res));\n\n    jerry_value_free (res);\n    jerry_value_free (parsed_code_val);\n  }\n\n  jerry_value_free (demo_func);\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-number-converter.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\n// basic toUint32 tester method\nstatic void\ntest_to_uint32 (double input, uint32_t test_number)\n{\n  jerry_value_t number_val = jerry_number (input);\n  uint32_t uint_number = jerry_value_as_uint32 (number_val);\n  TEST_ASSERT (uint_number == test_number);\n  jerry_value_free (number_val);\n} /* test_to_uint32 */\n\n// basic toInt32 tester method\nstatic void\ntest_to_int32 (double input, int32_t test_number)\n{\n  jerry_value_t number_val = jerry_number (input);\n  int32_t int_number = jerry_value_as_int32 (number_val);\n  TEST_ASSERT (int_number == test_number);\n  jerry_value_free (number_val);\n} /* test_to_int32 */\n\n// basic toInteger tester method\nstatic void\ntest_to_interger (double input, double test_number)\n{\n  jerry_value_t number_val = jerry_number (input);\n  double double_number = jerry_value_as_integer (number_val);\n  TEST_ASSERT (double_number == test_number);\n  jerry_value_free (number_val);\n} /* test_to_interger */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  // few toUint32 test-cases\n  test_to_uint32 (1.0, 1);\n  test_to_uint32 (0.0, 0);\n  test_to_uint32 (NAN, 0);\n  test_to_uint32 (-NAN, 0);\n  test_to_uint32 (INFINITY, 0);\n  test_to_uint32 (-INFINITY, 0);\n  test_to_uint32 (0.1, 0);\n  test_to_uint32 (-0.1, 0);\n  test_to_uint32 (1.1, 1);\n  test_to_uint32 (-1.1, 4294967295);\n  test_to_uint32 (4294967295, 4294967295);\n  test_to_uint32 (-4294967295, 1);\n  test_to_uint32 (4294967296, 0);\n  test_to_uint32 (-4294967296, 0);\n  test_to_uint32 (4294967297, 1);\n  test_to_uint32 (-4294967297, 4294967295);\n\n  // few toint32 test-cases\n  test_to_int32 (1.0, 1);\n  test_to_int32 (0.0, 0);\n  test_to_int32 (NAN, 0);\n  test_to_int32 (-NAN, 0);\n  test_to_int32 (INFINITY, 0);\n  test_to_int32 (-INFINITY, 0);\n  test_to_int32 (0.1, 0);\n  test_to_int32 (-0.1, 0);\n  test_to_int32 (1.1, 1);\n  test_to_int32 (-1.1, -1);\n  test_to_int32 (4294967295, -1);\n  test_to_int32 (-4294967295, 1);\n  test_to_int32 (4294967296, 0);\n  test_to_int32 (-4294967296, 0);\n  test_to_int32 (4294967297, 1);\n  test_to_int32 (-4294967297, -1);\n  test_to_int32 (2147483648, -2147483648);\n  test_to_int32 (-2147483648, -2147483648);\n  test_to_int32 (2147483647, 2147483647);\n  test_to_int32 (-2147483647, -2147483647);\n  test_to_int32 (-2147483649, 2147483647);\n  test_to_int32 (2147483649, -2147483647);\n\n  // few toInteger test-cases\n  test_to_interger (1.0, 1.0);\n  test_to_interger (0.0, 0.0);\n  test_to_interger (NAN, 0);\n  test_to_interger (-NAN, 0);\n  test_to_interger (INFINITY, INFINITY);\n  test_to_interger (-INFINITY, -INFINITY);\n  test_to_interger (0.1, 0);\n  test_to_interger (-0.1, -0);\n  test_to_interger (1.1, 1);\n  test_to_interger (-1.1, -1);\n  test_to_interger (4294967295, 4294967295);\n  test_to_interger (-4294967295, -4294967295);\n  test_to_interger (4294967295, 4294967295);\n  test_to_interger (-4294967296, -4294967296);\n  test_to_interger (4294967297, 4294967297);\n  test_to_interger (-4294967297, -4294967297);\n\n  // few test-cases which return with error\n  jerry_value_t error_val = jerry_throw_sz (JERRY_ERROR_TYPE, \"error\");\n  double number = jerry_value_as_integer (error_val);\n  jerry_value_free (error_val);\n  TEST_ASSERT (number == 0);\n\n  error_val = jerry_symbol_with_description (error_val);\n  number = jerry_value_as_integer (error_val);\n  TEST_ASSERT (number == 0);\n  jerry_value_free (error_val);\n\n  error_val =\n    jerry_eval ((const jerry_char_t *) \"({ valueOf() { throw new TypeError('foo')}})\", 44, JERRY_PARSE_NO_OPTS);\n  number = jerry_value_as_integer (error_val);\n  TEST_ASSERT (number == 0);\n  jerry_value_free (error_val);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-number-to-int32.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n#include \"test-common.h\"\n\ntypedef struct\n{\n  ecma_number_t num;\n  uint32_t uint32_num;\n} uint32_test_case_t;\n\ntypedef struct\n{\n  ecma_number_t num;\n  int32_t int32_num;\n} int32_test_case_t;\n\n/**\n * Unit test's main function.\n */\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  const uint32_test_case_t test_cases_uint32[] = {\n#define TEST_CASE(num, uint32) { num, uint32 }\n    TEST_CASE (1.0, 1),\n    TEST_CASE (0.0, 0),\n    TEST_CASE (NAN, 0),\n    TEST_CASE (-NAN, 0),\n    TEST_CASE (INFINITY, 0),\n    TEST_CASE (-INFINITY, 0),\n    TEST_CASE (0.1, 0),\n    TEST_CASE (-0.1, 0),\n    TEST_CASE (1.1, 1),\n    TEST_CASE (-1.1, 4294967295),\n    TEST_CASE (4294967295, 4294967295),\n    TEST_CASE (-4294967295, 1),\n    TEST_CASE (4294967296, 0),\n    TEST_CASE (-4294967296, 0),\n    TEST_CASE (4294967297, 1),\n    TEST_CASE (-4294967297, 4294967295)\n#undef TEST_CASE\n  };\n\n  for (uint32_t i = 0; i < sizeof (test_cases_uint32) / sizeof (test_cases_uint32[0]); i++)\n  {\n    TEST_ASSERT (ecma_number_to_uint32 (test_cases_uint32[i].num) == test_cases_uint32[i].uint32_num);\n  }\n\n  int32_test_case_t test_cases_int32[] = {\n#define TEST_CASE(num, int32) { num, int32 }\n    TEST_CASE (1.0, 1),\n    TEST_CASE (0.0, 0),\n    TEST_CASE (NAN, 0),\n    TEST_CASE (-NAN, 0),\n    TEST_CASE (INFINITY, 0),\n    TEST_CASE (-INFINITY, 0),\n    TEST_CASE (0.1, 0),\n    TEST_CASE (-0.1, 0),\n    TEST_CASE (1.1, 1),\n    TEST_CASE (-1.1, -1),\n    TEST_CASE (4294967295, -1),\n    TEST_CASE (-4294967295, 1),\n    TEST_CASE (4294967296, 0),\n    TEST_CASE (-4294967296, 0),\n    TEST_CASE (4294967297, 1),\n    TEST_CASE (-4294967297, -1),\n    TEST_CASE (2147483648, -2147483648),\n    TEST_CASE (-2147483648, -2147483648),\n    TEST_CASE (2147483647, 2147483647),\n    TEST_CASE (-2147483647, -2147483647),\n    TEST_CASE (-2147483649, 2147483647),\n    TEST_CASE (2147483649, -2147483647)\n#undef TEST_CASE\n  };\n\n  for (uint32_t i = 0; i < sizeof (test_cases_int32) / sizeof (test_cases_int32[0]); i++)\n  {\n    TEST_ASSERT (ecma_number_to_int32 (test_cases_int32[i].num) == test_cases_int32[i].int32_num);\n  }\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-number-to-string.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n#include \"test-common.h\"\n\n/**\n * Unit test's main function.\n */\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  const lit_utf8_byte_t *strings[] = {\n    (const lit_utf8_byte_t *) \"1\",         (const lit_utf8_byte_t *) \"0.5\",      (const lit_utf8_byte_t *) \"12345\",\n    (const lit_utf8_byte_t *) \"12345.123\", (const lit_utf8_byte_t *) \"1e-45\",    (const lit_utf8_byte_t *) \"-2.5e+38\",\n    (const lit_utf8_byte_t *) \"NaN\",       (const lit_utf8_byte_t *) \"Infinity\", (const lit_utf8_byte_t *) \"-Infinity\",\n    (const lit_utf8_byte_t *) \"0\",         (const lit_utf8_byte_t *) \"0\",\n  };\n\n  const ecma_number_t nums[] = { (ecma_number_t) 1.0,       (ecma_number_t) 0.5,      (ecma_number_t) 12345.0,\n                                 (ecma_number_t) 12345.123, (ecma_number_t) 1.0e-45,  (ecma_number_t) -2.5e+38,\n                                 (ecma_number_t) NAN,       (ecma_number_t) INFINITY, (ecma_number_t) -INFINITY,\n                                 (ecma_number_t) + 0.0,     (ecma_number_t) -0.0 };\n\n  for (uint32_t i = 0; i < sizeof (nums) / sizeof (nums[0]); i++)\n  {\n    lit_utf8_byte_t str[64];\n\n    lit_utf8_size_t str_size = ecma_number_to_utf8_string (nums[i], str, sizeof (str));\n\n    if (strncmp ((char *) str, (char *) strings[i], str_size) != 0)\n    {\n      return 1;\n    }\n  }\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-objects-foreach.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic bool\ncount_objects (jerry_value_t object, void *user_arg)\n{\n  (void) object;\n  TEST_ASSERT (user_arg != NULL);\n\n  int *counter = (int *) user_arg;\n\n  (*counter)++;\n  return true;\n} /* count_objects */\n\nstatic void\ntest_container (void)\n{\n  jerry_value_t global = jerry_current_realm ();\n  jerry_value_t map_str = jerry_string_sz (\"Map\");\n  jerry_value_t map_result = jerry_object_get (global, map_str);\n  jerry_type_t type = jerry_value_type (map_result);\n\n  jerry_value_free (map_result);\n  jerry_value_free (map_str);\n  jerry_value_free (global);\n\n  /* If there is no Map function this is not an es.next profile build, skip this test case. */\n  if (type != JERRY_TYPE_FUNCTION)\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Container based test is disabled!\\n\");\n    return;\n  }\n\n  {\n    /* Create a \"DEMO\" array which will be used for the Map below. */\n    const char array_str[] = \"var DEMO = [[1, 2], [3, 4]]; DEMO\";\n    jerry_value_t array = jerry_eval ((const jerry_char_t *) array_str, sizeof (array_str) - 1, 0);\n    TEST_ASSERT (jerry_value_is_object (array));\n    TEST_ASSERT (!jerry_value_is_exception (array));\n    jerry_value_free (array);\n  }\n\n  const char eval_str[] = \"new Map (DEMO)\";\n  {\n    /* Make sure that the Map and it's prototype object/function is initialized. */\n    jerry_value_t result = jerry_eval ((const jerry_char_t *) eval_str, sizeof (eval_str) - 1, 0);\n    TEST_ASSERT (jerry_value_is_object (result));\n    TEST_ASSERT (!jerry_value_is_exception (result));\n    jerry_value_free (result);\n  }\n\n  /* Do a bit of cleaning to clear up old objects. */\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n\n  /* Get the number of iterable objects. */\n  int start_count = 0;\n  jerry_foreach_live_object (count_objects, &start_count);\n\n  /* Create another map. */\n  jerry_value_t result = jerry_eval ((const jerry_char_t *) eval_str, sizeof (eval_str) - 1, 0);\n\n  /* Remove any old/unused objects. */\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n\n  /* Get the current number of objects. */\n  int end_count = 0;\n  jerry_foreach_live_object (count_objects, &end_count);\n\n  /* As only one Map was created the number of available iterable objects should be incremented only by one. */\n  TEST_ASSERT (end_count > start_count);\n  TEST_ASSERT ((end_count - start_count) == 1);\n\n  jerry_value_free (result);\n} /* test_container */\n\nstatic void\ntest_internal_prop (void)\n{\n  /* Make sure that the object is initialized in the engine. */\n  jerry_value_t object_dummy = jerry_object ();\n\n  /* Get the number of iterable objects. */\n  int before_object_count = 0;\n  jerry_foreach_live_object (count_objects, &before_object_count);\n\n  jerry_value_t object = jerry_object ();\n\n  /* After creating the object, the number of objects is incremented by one. */\n  int after_object_count = 0;\n  {\n    jerry_foreach_live_object (count_objects, &after_object_count);\n\n    TEST_ASSERT (after_object_count > before_object_count);\n    TEST_ASSERT ((after_object_count - before_object_count) == 1);\n  }\n\n  jerry_value_t internal_prop_name = jerry_string_sz (\"hidden_foo\");\n  jerry_value_t internal_prop_object = jerry_object ();\n  bool internal_result = jerry_object_set_internal (object, internal_prop_name, internal_prop_object);\n  TEST_ASSERT (internal_result == true);\n  jerry_value_free (internal_prop_name);\n  jerry_value_free (internal_prop_object);\n\n  /* After adding an internal property object, the number of object is incremented by one. */\n  {\n    int after_internal_count = 0;\n    jerry_foreach_live_object (count_objects, &after_internal_count);\n\n    TEST_ASSERT (after_internal_count > after_object_count);\n    TEST_ASSERT ((after_internal_count - after_object_count) == 1);\n  }\n\n  jerry_value_free (object);\n  jerry_value_free (object_dummy);\n} /* test_internal_prop */\n\nstatic int test_data = 1;\n\nstatic void\nfree_test_data (void *native_p, /**< native pointer */\n                jerry_object_native_info_t *info_p) /**< native info */\n{\n  TEST_ASSERT ((int *) native_p == &test_data);\n  TEST_ASSERT (info_p->free_cb == free_test_data);\n} /* free_test_data */\n\nstatic const jerry_object_native_info_t test_info = {\n  .free_cb = free_test_data,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic const jerry_char_t strict_equal_source[] = \"var x = function(a, b) {return a === b;}; x\";\n\nstatic bool\nfind_test_object_by_data (const jerry_value_t candidate, void *object_data_p, void *context_p)\n{\n  if (object_data_p == &test_data)\n  {\n    *((jerry_value_t *) context_p) = jerry_value_copy (candidate);\n    return false;\n  }\n  return true;\n} /* find_test_object_by_data */\n\nstatic bool\nfind_test_object_by_property (const jerry_value_t candidate, void *context_p)\n{\n  jerry_value_t *args_p = (jerry_value_t *) context_p;\n  jerry_value_t result = jerry_object_has (candidate, args_p[0]);\n\n  bool has_property = (!jerry_value_is_exception (result) && jerry_value_is_true (result));\n\n  /* If the object has the desired property, store a new reference to it in args_p[1]. */\n  if (has_property)\n  {\n    args_p[1] = jerry_value_copy (candidate);\n  }\n\n  jerry_value_free (result);\n\n  /* Stop iterating if we've found our object. */\n  return !has_property;\n} /* find_test_object_by_property */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_STRICT_MODE;\n\n  /* Render strict-equal as a function. */\n  jerry_value_t parse_result = jerry_parse (strict_equal_source, sizeof (strict_equal_source) - 1, &parse_options);\n  TEST_ASSERT (!jerry_value_is_exception (parse_result));\n  jerry_value_t strict_equal = jerry_run (parse_result);\n  TEST_ASSERT (!jerry_value_is_exception (strict_equal));\n  jerry_value_free (parse_result);\n\n  /* Create an object and associate some native data with it. */\n  jerry_value_t object = jerry_object ();\n  jerry_object_set_native_ptr (object, &test_info, &test_data);\n\n  /* Retrieve the object by its native pointer. */\n\n  jerry_value_t found_object;\n  TEST_ASSERT (jerry_foreach_live_object_with_info (&test_info, find_test_object_by_data, &found_object));\n  jerry_value_t args[2] = { object, found_object };\n\n  /* Assert that the correct object was retrieved. */\n  jerry_value_t undefined = jerry_undefined ();\n  jerry_value_t strict_equal_result = jerry_call (strict_equal, undefined, args, 2);\n  TEST_ASSERT (jerry_value_is_boolean (strict_equal_result) && jerry_value_is_true (strict_equal_result));\n  jerry_value_free (strict_equal_result);\n  jerry_value_free (found_object);\n  jerry_value_free (object);\n\n  /* Collect garbage. */\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n\n  /* Attempt to retrieve the object by its native pointer again. */\n  TEST_ASSERT (!jerry_foreach_live_object_with_info (&test_info, find_test_object_by_data, &found_object));\n\n  /* Create an object and set a property on it. */\n  object = jerry_object ();\n  jerry_value_t property_name = jerry_string_sz (\"xyzzy\");\n  jerry_value_t property_value = jerry_number (42);\n  jerry_value_free (jerry_object_set (object, property_name, property_value));\n  jerry_value_free (property_value);\n\n  /* Retrieve the object by the presence of its property, placing it at args[1]. */\n  args[0] = property_name;\n  TEST_ASSERT (jerry_foreach_live_object (find_test_object_by_property, args));\n\n  /* Assert that the right object was retrieved and release both the original reference to it and the retrieved one. */\n  args[0] = object;\n  strict_equal_result = jerry_call (strict_equal, undefined, args, 2);\n  TEST_ASSERT (jerry_value_is_boolean (strict_equal_result) && jerry_value_is_true (strict_equal_result));\n  jerry_value_free (strict_equal_result);\n  jerry_value_free (args[0]);\n  jerry_value_free (args[1]);\n\n  /* Collect garbage. */\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n\n  /* Attempt to retrieve the object by the presence of its property again. */\n  args[0] = property_name;\n  TEST_ASSERT (!jerry_foreach_live_object (find_test_object_by_property, args));\n\n  jerry_value_free (property_name);\n  jerry_value_free (undefined);\n  jerry_value_free (strict_equal);\n\n  test_container ();\n  test_internal_prop ();\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-poolman.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for pool manager.\n */\n\n#include <stdbool.h>\n#include <stdint.h>\n#include <string.h>\n\n#include \"jmem.h\"\n\n#define JMEM_ALLOCATOR_INTERNAL\n#include \"jmem-allocator-internal.h\"\n#include \"test-common.h\"\n\n/* Iterations count. */\nconst uint32_t test_iters = 1024;\n\n/* Subiterations count. */\n#define TEST_MAX_SUB_ITERS 1024\n#define TEST_CHUNK_SIZE    8\n\nuint8_t *ptrs[TEST_MAX_SUB_ITERS];\nuint8_t data[TEST_MAX_SUB_ITERS][TEST_CHUNK_SIZE];\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jmem_init ();\n\n  for (uint32_t i = 0; i < test_iters; i++)\n  {\n    const size_t subiters = ((size_t) rand () % TEST_MAX_SUB_ITERS) + 1;\n\n    for (size_t j = 0; j < subiters; j++)\n    {\n      ptrs[j] = (uint8_t *) jmem_pools_alloc (TEST_CHUNK_SIZE);\n\n      if (ptrs[j] != NULL)\n      {\n        for (size_t k = 0; k < TEST_CHUNK_SIZE; k++)\n        {\n          ptrs[j][k] = (uint8_t) (rand () % 256);\n        }\n\n        memcpy (data[j], ptrs[j], TEST_CHUNK_SIZE);\n      }\n    }\n\n    /* jmem_heap_print (false); */\n\n    for (size_t j = 0; j < subiters; j++)\n    {\n      if (rand () % 256 == 0)\n      {\n        jmem_pools_collect_empty ();\n      }\n\n      if (ptrs[j] != NULL)\n      {\n        TEST_ASSERT (!memcmp (data[j], ptrs[j], TEST_CHUNK_SIZE));\n\n        jmem_pools_free (ptrs[j], TEST_CHUNK_SIZE);\n      }\n    }\n  }\n\n#ifdef JMEM_STATS\n  jmem_heap_stats_print ();\n#endif /* JMEM_STATS */\n\n  jmem_finalize ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-promise-callback.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\n/* Note: RS = ReSolve, RJ = ReJect */\ntypedef enum\n{\n  C = JERRY_PROMISE_EVENT_CREATE, /**< same as JERRY_PROMISE_CALLBACK_CREATE with undefined value */\n  RS = JERRY_PROMISE_EVENT_RESOLVE, /**< same as JERRY_PROMISE_CALLBACK_RESOLVE */\n  RJ = JERRY_PROMISE_EVENT_REJECT, /**< same as JERRY_PROMISE_CALLBACK_REJECT */\n  RSF = JERRY_PROMISE_EVENT_RESOLVE_FULFILLED, /**< same as JERRY_PROMISE_EVENT_RESOLVE_FULFILLED */\n  RJF = JERRY_PROMISE_EVENT_REJECT_FULFILLED, /**< same as JERRY_PROMISE_EVENT_REJECT_FULFILLED */\n  RWH = JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER, /**< same as JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER */\n  CHA = JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED, /**< same as JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED */\n  BR = JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB, /**< same as JERRY_PROMISE_CALLBACK_BEFORE_REACTION_JOB */\n  AR = JERRY_PROMISE_EVENT_AFTER_REACTION_JOB, /**< same as JERRY_PROMISE_CALLBACK_AFTER_REACTION_JOB */\n  A = JERRY_PROMISE_EVENT_ASYNC_AWAIT, /**< same as JERRY_PROMISE_CALLBACK_ASYNC_AWAIT */\n  BRS = JERRY_PROMISE_EVENT_ASYNC_BEFORE_RESOLVE, /**< same as JERRY_PROMISE_CALLBACK_ASYNC_BEFORE_RESOLVE */\n  BRJ = JERRY_PROMISE_EVENT_ASYNC_BEFORE_REJECT, /**< same as JERRY_PROMISE_CALLBACK_ASYNC_BEFORE_REJECT */\n  ARS = JERRY_PROMISE_EVENT_ASYNC_AFTER_RESOLVE, /**< same as JERRY_PROMISE_CALLBACK_ASYNC_AFTER_RESOLVE */\n  ARJ = JERRY_PROMISE_EVENT_ASYNC_AFTER_REJECT, /**< same as JERRY_PROMISE_CALLBACK_ASYNC_AFTER_REJECT */\n  CP = UINT8_MAX - 1, /**< same as JERRY_PROMISE_CALLBACK_CREATE with Promise value */\n  E = UINT8_MAX, /**< marks the end of the event list */\n} jerry_promise_callback_event_abbreviations_t;\n\nstatic int user;\nstatic const uint8_t *next_event_p;\n\nstatic void\npromise_callback (jerry_promise_event_type_t event_type, /**< event type */\n                  const jerry_value_t object, /**< target object */\n                  const jerry_value_t value, /**< optional argument */\n                  void *user_p) /**< user pointer passed to the callback */\n{\n  TEST_ASSERT (user_p == (void *) &user);\n\n  switch (event_type)\n  {\n    case JERRY_PROMISE_EVENT_CREATE:\n    {\n      TEST_ASSERT (jerry_value_is_promise (object));\n      if (jerry_value_is_undefined (value))\n      {\n        break;\n      }\n\n      TEST_ASSERT (jerry_value_is_promise (value));\n      TEST_ASSERT (*next_event_p++ == CP);\n      return;\n    }\n    case JERRY_PROMISE_EVENT_RESOLVE:\n    case JERRY_PROMISE_EVENT_REJECT:\n    case JERRY_PROMISE_EVENT_RESOLVE_FULFILLED:\n    case JERRY_PROMISE_EVENT_REJECT_FULFILLED:\n    case JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER:\n    {\n      TEST_ASSERT (jerry_value_is_promise (object));\n      break;\n    }\n    case JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED:\n    case JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB:\n    case JERRY_PROMISE_EVENT_AFTER_REACTION_JOB:\n    {\n      TEST_ASSERT (jerry_value_is_promise (object));\n      TEST_ASSERT (jerry_value_is_undefined (value));\n      break;\n    }\n    case JERRY_PROMISE_EVENT_ASYNC_AWAIT:\n    {\n      TEST_ASSERT (jerry_value_is_object (object));\n      TEST_ASSERT (jerry_value_is_promise (value));\n      break;\n    }\n    default:\n    {\n      TEST_ASSERT (event_type == JERRY_PROMISE_EVENT_ASYNC_BEFORE_RESOLVE\n                   || event_type == JERRY_PROMISE_EVENT_ASYNC_BEFORE_REJECT\n                   || event_type == JERRY_PROMISE_EVENT_ASYNC_AFTER_RESOLVE\n                   || event_type == JERRY_PROMISE_EVENT_ASYNC_AFTER_REJECT);\n      TEST_ASSERT (jerry_value_is_object (object));\n      break;\n    }\n  }\n\n  TEST_ASSERT (*next_event_p++ == (uint8_t) event_type);\n} /* promise_callback */\n\nstatic void\nrun_eval (const uint8_t *event_list_p, /**< event list */\n          const char *source_p) /**< source code */\n{\n  next_event_p = event_list_p;\n\n  jerry_value_t result = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);\n\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  result = jerry_run_jobs ();\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n\n  TEST_ASSERT (*next_event_p == UINT8_MAX);\n} /* run_eval */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  /* The test system enables this feature when Promises are enabled. */\n  TEST_ASSERT (jerry_feature_enabled (JERRY_FEATURE_PROMISE_CALLBACK));\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_promise_event_filter_t filters =\n    (JERRY_PROMISE_EVENT_FILTER_CREATE | JERRY_PROMISE_EVENT_FILTER_RESOLVE | JERRY_PROMISE_EVENT_FILTER_REJECT\n     | JERRY_PROMISE_EVENT_FILTER_ERROR | JERRY_PROMISE_EVENT_FILTER_REACTION_JOB\n     | JERRY_PROMISE_EVENT_FILTER_ASYNC_MAIN | JERRY_PROMISE_EVENT_FILTER_ASYNC_REACTION_JOB);\n\n  jerry_promise_on_event (filters, promise_callback, (void *) &user);\n\n  /* Test promise creation. */\n  static uint8_t events1[] = { C, C, C, E };\n\n  run_eval (events1,\n            \"'use strict'\\n\"\n            \"new Promise((res, rej) => {})\\n\"\n            \"new Promise((res, rej) => {})\\n\"\n            \"new Promise((res, rej) => {})\\n\");\n\n  /* Test then call. */\n  static uint8_t events2[] = { C, CP, E };\n\n  run_eval (events2,\n            \"'use strict'\\n\"\n            \"var promise = new Promise((res, rej) => {})\\n\"\n            \"promise.then(() => {}, () => {})\\n\");\n\n  /* Test then call with extended Promise. */\n  static uint8_t events3[] = { C, C, E };\n\n  run_eval (events3,\n            \"'use strict'\\n\"\n            \"var P = class extends Promise {}\\n\"\n            \"var promise = new P((res, rej) => {})\\n\"\n            \"promise.then(() => {})\\n\");\n\n  /* Test resolve and reject calls. */\n  static uint8_t events4[] = { C, C, RS, RJ, RWH, E };\n\n  run_eval (events4,\n            \"'use strict'\\n\"\n            \"var resolve\\n\"\n            \"var reject\\n\"\n            \"new Promise((res, rej) => resolve = res)\\n\"\n            \"new Promise((res, rej) => reject = rej)\\n\"\n            \"resolve(1)\\n\"\n            \"reject(1)\\n\");\n\n  /* Test then and resolve calls. */\n  static uint8_t events5[] = { C, CP, RS, BR, RS, AR, E };\n\n  run_eval (events5,\n            \"'use strict'\\n\"\n            \"var resolve\\n\"\n            \"var promise = new Promise((res, rej) => resolve = res)\\n\"\n            \"promise.then(() => {})\\n\"\n            \"resolve(1)\\n\");\n\n  /* Test resolve and then calls. */\n  static uint8_t events6[] = { C, RS, CP, BR, RS, AR, E };\n\n  run_eval (events6,\n            \"'use strict'\\n\"\n            \"var promise = new Promise((res, rej) => res(1))\\n\"\n            \"promise.then(() => {})\\n\");\n\n  /* Test Promise.resolve. */\n  static uint8_t events7[] = { C, RS, CP, BR, RS, AR, E };\n\n  run_eval (events7, \"Promise.resolve(4).then(() => {})\\n\");\n\n  /* Test Promise.reject. */\n  static uint8_t events8[] = { C, RJ, RWH, CP, CHA, BR, RJ, RWH, AR, E };\n\n  run_eval (events8, \"Promise.reject(4).catch(() => { throw 'Error' })\\n\");\n\n  /* Test Promise.race without resolve */\n  static uint8_t events9[] = { C, C, C, CP, CP, E };\n\n  run_eval (events9,\n            \"'use strict'\\n\"\n            \"var p1 = new Promise((res, rej) => {})\\n\"\n            \"var p2 = new Promise((res, rej) => {})\\n\"\n            \"Promise.race([p1,p2])\\n\");\n\n  /* Test Promise.race with resolve. */\n  static uint8_t events10[] = { C, RS, C, RJ, RWH, C, CP, CP, CHA, BR, RS, RS, AR, BR, RJF, RS, AR, E };\n\n  run_eval (events10,\n            \"'use strict'\\n\"\n            \"var p1 = new Promise((res, rej) => res(1))\\n\"\n            \"var p2 = new Promise((res, rej) => rej(1))\\n\"\n            \"Promise.race([p1,p2])\\n\");\n\n  /* Test Promise.all without resolve. */\n  static uint8_t events11[] = { C, C, C, CP, CP, E };\n\n  run_eval (events11,\n            \"'use strict'\\n\"\n            \"var p1 = new Promise((res, rej) => {})\\n\"\n            \"var p2 = new Promise((res, rej) => {})\\n\"\n            \"Promise.all([p1,p2])\\n\");\n\n  /* Test Promise.all with resolve. */\n  static uint8_t events12[] = { C, RS, C, RJ, RWH, C, CP, CP, CHA, BR, RS, AR, BR, RJ, RWH, RS, AR, E };\n\n  run_eval (events12,\n            \"'use strict'\\n\"\n            \"var p1 = new Promise((res, rej) => res(1))\\n\"\n            \"var p2 = new Promise((res, rej) => rej(1))\\n\"\n            \"Promise.all([p1,p2])\\n\");\n\n  /* Test async function. */\n  static uint8_t events13[] = { C, RS, E };\n\n  run_eval (events13,\n            \"'use strict'\\n\"\n            \"async function f() {}\\n\"\n            \"f()\\n\");\n\n  /* Test await with resolved Promise. */\n  static uint8_t events14[] = { C, RS, A, C, BRS, RS, ARS, E };\n\n  run_eval (events14,\n            \"'use strict'\\n\"\n            \"async function f(p) { await p }\\n\"\n            \"f(Promise.resolve(1))\\n\");\n\n  /* Test await with non-Promise value. */\n  static uint8_t events15[] = { C, RS, A, C, BRS, C, RS, A, ARS, BRS, RS, ARS, E };\n\n  run_eval (events15,\n            \"'use strict'\\n\"\n            \"async function f(p) { await p; await 'X' }\\n\"\n            \"f(Promise.resolve(1))\\n\");\n\n  /* Test await with rejected Promise. */\n  static uint8_t events16[] = { C, RJ, RWH, A, CHA, C, BRJ, C, RS, RS, ARJ, E };\n\n  run_eval (events16,\n            \"'use strict'\\n\"\n            \"async function f(p) { try { await p; } catch (e) { Promise.resolve(1) } }\\n\"\n            \"f(Promise.reject(1))\\n\");\n\n  /* Test async generator function. */\n  static uint8_t events17[] = { C, RS, C, A, BRS, RS, ARS, E };\n\n  run_eval (events17,\n            \"'use strict'\\n\"\n            \"async function *f(p) { await p; return 4 }\\n\"\n            \"f(Promise.resolve(1)).next()\\n\");\n\n  /* Test yield* operation. */\n  static uint8_t events18[] = { C, C, RS, A, BRS, C, RS, A, ARS, BRS, RS, ARS, E };\n\n  run_eval (events18,\n            \"'use strict'\\n\"\n            \"async function *f(p) { yield 1 }\\n\"\n            \"async function *g() { yield* f() }\\n\"\n            \"g().next()\\n\");\n\n  /* Test multiple fulfill operations. */\n  static uint8_t events19[] = { C, RS, RSF, RJF, E };\n\n  run_eval (events19,\n            \"'use strict'\\n\"\n            \"var resolve, reject\\n\"\n            \"var p1 = new Promise((res, rej) => { resolve = res, reject = rej })\\n\"\n            \"resolve(1)\\n\"\n            \"resolve(2)\\n\"\n            \"reject(3)\\n\");\n\n  /* Test multiple fulfill operations. */\n  static uint8_t events20[] = { C, RJ, RWH, RSF, RJF, E };\n\n  run_eval (events20,\n            \"'use strict'\\n\"\n            \"var resolve, reject\\n\"\n            \"var p1 = new Promise((res, rej) => { resolve = res, reject = rej })\\n\"\n            \"reject(1)\\n\"\n            \"resolve(2)\\n\"\n            \"reject(3)\\n\");\n\n  /* Test catch handler added later is reported only once. */\n  static uint8_t events21[] = { C, RJ, RWH, CP, CHA, CP, CP, BR, RS, AR, BR, RS, AR, BR, RS, AR, E };\n\n  run_eval (events21,\n            \"'use strict'\\n\"\n            \"var rej = Promise.reject(4)\\n\"\n            \"rej.catch(() => {})\\n\"\n            \"rej.catch(() => {})\\n\"\n            \"rej.catch(() => {})\\n\");\n\n  /* Test catch handler added later is reported only once. */\n  static uint8_t events22[] = { C, RJ, RWH, A, CHA, C, BRJ, A, ARJ, BRJ, RJ, RWH, ARJ, E };\n\n  run_eval (events22,\n            \"'use strict'\\n\"\n            \"async function f(p) { try { await p; } catch(e) { await p; } }\"\n            \"f(Promise.reject(4))\\n\");\n\n  /* Test chained then. */\n  static uint8_t events23[] = { C, RJ, RWH, CP, CHA, CP, BR, RJ, AR, BR, RS, AR, E };\n\n  run_eval (events23,\n            \"'use strict'\\n\"\n            \"var p = Promise.reject(0)\\n\"\n            \"p.then(() => {}).catch(() => {})\\n\");\n\n  /* Test disabled filters. */\n  jerry_promise_on_event (JERRY_PROMISE_EVENT_FILTER_DISABLE, promise_callback, (void *) &user);\n\n  static uint8_t events24[] = { E };\n\n  run_eval (events24,\n            \"'use strict'\\n\"\n            \"async function f(p) { await p }\"\n            \"f(Promise.resolve(1))\\n\");\n\n  /* Test filtered events. */\n  filters = JERRY_PROMISE_EVENT_FILTER_REACTION_JOB | JERRY_PROMISE_EVENT_FILTER_ASYNC_REACTION_JOB;\n  jerry_promise_on_event (filters, promise_callback, (void *) &user);\n\n  static uint8_t events25[] = { BR, AR, BRS, ARS, E };\n\n  run_eval (events25,\n            \"'use strict'\\n\"\n            \"async function f(p) { await p }\"\n            \"f(Promise.resolve(1).then(() => {}))\\n\");\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-promise.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic const jerry_char_t test_source[] = TEST_STRING_LITERAL (\"var p1 = create_promise1();\"\n                                                               \"var p2 = create_promise2();\"\n                                                               \"p1.then(function(x) { \"\n                                                               \"  assert(x==='resolved'); \"\n                                                               \"}); \"\n                                                               \"p2.catch(function(x) { \"\n                                                               \"  assert(x==='rejected'); \"\n                                                               \"}); \");\n\nstatic int count_in_assert = 0;\nstatic jerry_value_t my_promise1;\nstatic jerry_value_t my_promise2;\nstatic const char s1[] = \"resolved\";\nstatic const char s2[] = \"rejected\";\n\nstatic jerry_value_t\ncreate_promise1_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                         const jerry_value_t args_p[], /**< arguments list */\n                         const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n  JERRY_UNUSED (args_p);\n  JERRY_UNUSED (args_cnt);\n\n  jerry_value_t ret = jerry_promise ();\n  my_promise1 = jerry_value_copy (ret);\n\n  return ret;\n} /* create_promise1_handler */\n\nstatic jerry_value_t\ncreate_promise2_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                         const jerry_value_t args_p[], /**< arguments list */\n                         const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n  JERRY_UNUSED (args_p);\n  JERRY_UNUSED (args_cnt);\n\n  jerry_value_t ret = jerry_promise ();\n  my_promise2 = jerry_value_copy (ret);\n\n  return ret;\n} /* create_promise2_handler */\n\nstatic jerry_value_t\nassert_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                const jerry_value_t args_p[], /**< function arguments */\n                const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  JERRY_UNUSED (call_info_p);\n\n  count_in_assert++;\n\n  if (args_cnt == 1 && jerry_value_is_true (args_p[0]))\n  {\n    return jerry_boolean (true);\n  }\n  else\n  {\n    TEST_ASSERT (false);\n  }\n} /* assert_handler */\n\n/**\n * Register a JavaScript function in the global object.\n */\nstatic void\nregister_js_function (const char *name_p, /**< name of the function */\n                      jerry_external_handler_t handler_p) /**< function callback */\n{\n  jerry_value_t global_obj_val = jerry_current_realm ();\n\n  jerry_value_t function_val = jerry_function_external (handler_p);\n  jerry_value_t function_name_val = jerry_string_sz (name_p);\n  jerry_value_t result_val = jerry_object_set (global_obj_val, function_name_val, function_val);\n\n  jerry_value_free (function_name_val);\n  jerry_value_free (function_val);\n  jerry_value_free (global_obj_val);\n\n  jerry_value_free (result_val);\n} /* register_js_function */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  register_js_function (\"create_promise1\", create_promise1_handler);\n  register_js_function (\"create_promise2\", create_promise2_handler);\n  register_js_function (\"assert\", assert_handler);\n\n  jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n\n  jerry_value_t res = jerry_run (parsed_code_val);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n\n  jerry_value_free (res);\n  jerry_value_free (parsed_code_val);\n\n  /* Test jerry_promise and jerry_value_is_promise. */\n  TEST_ASSERT (jerry_value_is_promise (my_promise1));\n  TEST_ASSERT (jerry_value_is_promise (my_promise2));\n\n  TEST_ASSERT (count_in_assert == 0);\n\n  /* Test jerry_resolve_or_reject_promise. */\n  jerry_value_t str_resolve = jerry_string_sz (s1);\n  jerry_value_t str_reject = jerry_string_sz (s2);\n\n  jerry_promise_resolve (my_promise1, str_resolve);\n  jerry_promise_reject (my_promise2, str_reject);\n\n  /* The resolve/reject function should be invalid after the promise has the result. */\n  jerry_promise_resolve (my_promise2, str_resolve);\n  jerry_promise_reject (my_promise1, str_reject);\n\n  /* Run the jobqueue. */\n  res = jerry_run_jobs ();\n\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (count_in_assert == 2);\n\n  jerry_value_free (my_promise1);\n  jerry_value_free (my_promise2);\n  jerry_value_free (str_resolve);\n  jerry_value_free (str_reject);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-proxy.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\n/** Test in Proxy on C side. Equivalent test code in JS:\n\nvar demo = 0.0;\n\nvar target = {};\nvar handler = {\n    get: function (target, name, recv) {\n        assert (typeof (target) === 'object');\n        assert (name === 'value');\n        assert (typeof (recv) === 'object');\n        return demo++;\n    }\n\n    set: function (target, name, value, recv) {\n        assert (typeof (target) === 'object');\n        assert (name === 'value');\n        assert (typeof (recv) === 'object');\n        demo = 55;\n        return demo;\n    }\n};\n\nvar pdemo = new Proxy(target, handler);\n\nassert (pdemo.value === 1.0);\nassert (pdemo.value === 1.0);\nassert (pdemo.value === 2.0);\n\npdemo.value = 55;\n\nassert (pdemo.value === 56);\n\npdemo.value = 12;\n\nassert (pdemo.value === 13);\n */\n\nstatic int demo_value = 0;\n\nstatic jerry_value_t\nhandler_get (const jerry_call_info_t *call_info_p, /**< call information */\n             const jerry_value_t args_p[], /**< function arguments */\n             const jerry_length_t args_count) /**< number of function arguments */\n{\n  JERRY_UNUSED (call_info_p);\n\n  TEST_ASSERT (args_count == 3);\n  TEST_ASSERT (jerry_value_is_object (args_p[0])); /* target */\n  TEST_ASSERT (jerry_value_is_string (args_p[1])); /* P */\n  TEST_ASSERT (jerry_value_is_object (args_p[2])); /* receiver */\n\n  const char expected[] = \"value\";\n  char buffer[10];\n  jerry_size_t copied = jerry_string_to_buffer (args_p[1], JERRY_ENCODING_CESU8, (jerry_char_t *) buffer, 10);\n\n  TEST_ASSERT (copied == 5);\n  TEST_ASSERT (strncmp (expected, buffer, 5) == 0);\n\n  demo_value++;\n\n  return jerry_number (demo_value);\n} /* handler_get */\n\nstatic jerry_value_t\nhandler_set (const jerry_call_info_t *call_info_p, /**< call information */\n             const jerry_value_t args_p[], /**< function arguments */\n             const jerry_length_t args_count) /**< number of function arguments */\n{\n  JERRY_UNUSED (call_info_p);\n  JERRY_UNUSED (args_p);\n  JERRY_UNUSED (args_count);\n\n  TEST_ASSERT (args_count == 4);\n  TEST_ASSERT (jerry_value_is_object (args_p[0])); /* target */\n  TEST_ASSERT (jerry_value_is_string (args_p[1])); /* P */\n  TEST_ASSERT (jerry_value_is_number (args_p[2])); /* V */\n  TEST_ASSERT (jerry_value_is_object (args_p[3])); /* receiver */\n\n  const char expected[] = \"value\";\n  char buffer[10];\n  jerry_size_t copied = jerry_string_to_buffer (args_p[1], JERRY_ENCODING_CESU8, (jerry_char_t *) buffer, 10);\n\n  TEST_ASSERT (copied == 5);\n  TEST_ASSERT (strncmp (expected, buffer, 5) == 0);\n\n  TEST_ASSERT (jerry_value_is_number (args_p[2]));\n  demo_value = (int) jerry_value_as_number (args_p[2]);\n\n  return jerry_number (demo_value);\n} /* handler_set */\n\nstatic void\nset_property (jerry_value_t target, /**< target object */\n              const char *name_p, /**< name of the property */\n              jerry_value_t value) /**< value of the property */\n{\n  jerry_value_t name_val = jerry_string_sz (name_p);\n  jerry_value_t result_val = jerry_object_set (target, name_val, value);\n\n  TEST_ASSERT (jerry_value_is_boolean (result_val));\n  TEST_ASSERT (jerry_value_is_true (result_val));\n  jerry_value_free (name_val);\n} /* set_property */\n\nstatic jerry_value_t\nget_property (jerry_value_t target, /**< target object */\n              const char *name_p) /**< name of the property */\n{\n  jerry_value_t name_val = jerry_string_sz (name_p);\n  jerry_value_t result_val = jerry_object_get (target, name_val);\n\n  TEST_ASSERT (!jerry_value_is_exception (result_val));\n  jerry_value_free (name_val);\n  return result_val;\n} /* get_property */\n\nstatic void\nset_function (jerry_value_t target, /**< target object */\n              const char *name_p, /**< name of the function */\n              jerry_external_handler_t handler_p) /**< function callback */\n{\n  jerry_value_t function_val = jerry_function_external (handler_p);\n  set_property (target, name_p, function_val);\n  jerry_value_free (function_val);\n} /* set_function */\n\nstruct test_data\n{\n  int value;\n};\n\nstatic void\nproxy_native_freecb (void *native_p, /**< native pointer */\n                     jerry_object_native_info_t *info_p) /**< native info */\n{\n  TEST_ASSERT (native_p != NULL);\n  TEST_ASSERT (info_p->free_cb == proxy_native_freecb);\n  struct test_data *data_p = (struct test_data *) native_p;\n  data_p->value = -1;\n} /* proxy_native_freecb */\n\nstatic const jerry_object_native_info_t proxy_native_info = {\n  .free_cb = proxy_native_freecb,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic jerry_value_t\nproxy_native_handler_get (const jerry_call_info_t *call_info_p, /**< call information */\n                          const jerry_value_t args_p[], /**< function arguments */\n                          const jerry_length_t args_count) /**< number of function arguments */\n{\n  JERRY_UNUSED (call_info_p);\n  TEST_ASSERT (args_count == 3);\n\n  /* 3rd argument (Receiver) should be the Proxy here. */\n  jerry_value_t receiver = args_p[2];\n  TEST_ASSERT (jerry_value_is_proxy (receiver));\n\n  /* Check if proxy has the native ptr. */\n  TEST_ASSERT (jerry_object_has_native_ptr (receiver, &proxy_native_info));\n  struct test_data *native_p = jerry_object_get_native_ptr (receiver, &proxy_native_info);\n  TEST_ASSERT (native_p != NULL);\n\n  native_p->value <<= 1;\n  return jerry_number (native_p->value);\n} /* proxy_native_handler_get */\n\n/**\n * Test Proxy with added native object.\n */\nstatic void\ntest_proxy_native (void)\n{\n  jerry_value_t handler = jerry_object ();\n  set_function (handler, \"get\", proxy_native_handler_get);\n\n  jerry_value_t target = jerry_object ();\n  jerry_value_t proxy = jerry_proxy (target, handler);\n\n  struct test_data *data = (struct test_data *) malloc (sizeof (struct test_data));\n  data->value = 2;\n  jerry_object_set_native_ptr (proxy, &proxy_native_info, data);\n\n  /* Call: proxy[10] */\n  jerry_value_t result_for_10 = jerry_object_get_index (proxy, 10);\n  TEST_ASSERT (jerry_value_is_number (result_for_10));\n  TEST_ASSERT (jerry_value_as_number (result_for_10) == 4.0);\n\n  /* Call: proxy[5] */\n  data->value = 8;\n  jerry_value_t result_for_5 = jerry_object_get_index (proxy, 5);\n  TEST_ASSERT (jerry_value_is_number (result_for_5));\n  TEST_ASSERT (jerry_value_as_number (result_for_5) == 16.0);\n\n  jerry_value_free (handler);\n  jerry_value_free (target);\n  jerry_value_free (proxy);\n} /* test_proxy_native */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_PROXY))\n  {\n    printf (\"Skipping test, Proxy not enabled\\n\");\n    return 0;\n  }\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t handler = jerry_object ();\n  {\n    set_function (handler, \"get\", handler_get);\n    set_function (handler, \"set\", handler_set);\n  }\n\n  jerry_value_t target = jerry_object ();\n  jerry_value_t proxy = jerry_proxy (target, handler);\n  {\n    jerry_value_t global = jerry_current_realm ();\n    set_property (global, \"pdemo\", proxy);\n    jerry_value_free (global);\n  }\n\n  const jerry_char_t get_value_src[] = TEST_STRING_LITERAL (\"pdemo.value\");\n  jerry_value_t parsed_get_code_val = jerry_parse (get_value_src, sizeof (get_value_src) - 1, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (parsed_get_code_val));\n\n  {\n    jerry_value_t res = jerry_run (parsed_get_code_val);\n    TEST_ASSERT (jerry_value_is_number (res));\n    TEST_ASSERT (jerry_value_as_number (res) == 1.0);\n    jerry_value_free (res);\n  }\n\n  {\n    jerry_value_t res = get_property (proxy, \"value\");\n    TEST_ASSERT (jerry_value_is_number (res));\n    TEST_ASSERT (jerry_value_as_number (res) == 2.0);\n    jerry_value_free (res);\n  }\n\n  {\n    jerry_value_t res = jerry_run (parsed_get_code_val);\n    TEST_ASSERT (jerry_value_is_number (res));\n    TEST_ASSERT (jerry_value_as_number (res) == 3.0);\n    jerry_value_free (res);\n  }\n\n  const jerry_char_t set_value_src[] = TEST_STRING_LITERAL (\"pdemo.value = 55\");\n  jerry_value_t parsed_set_code_val = jerry_parse (set_value_src, sizeof (set_value_src) - 1, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (parsed_set_code_val));\n\n  {\n    jerry_value_t res = jerry_run (parsed_set_code_val);\n    TEST_ASSERT (jerry_value_is_number (res));\n    TEST_ASSERT (jerry_value_as_number (res) == 55);\n    jerry_value_free (res);\n  }\n\n  {\n    jerry_value_t res = jerry_run (parsed_get_code_val);\n    TEST_ASSERT (jerry_value_is_number (res));\n    TEST_ASSERT (jerry_value_as_number (res) == 56);\n    jerry_value_free (res);\n  }\n\n  {\n    jerry_value_t new_value = jerry_number (12);\n    set_property (proxy, \"value\", new_value);\n    jerry_value_free (new_value);\n  }\n\n  {\n    jerry_value_t res = get_property (proxy, \"value\");\n    TEST_ASSERT (jerry_value_is_number (res));\n    TEST_ASSERT (jerry_value_as_number (res) == 13.0);\n    jerry_value_free (res);\n  }\n\n  jerry_value_free (parsed_set_code_val);\n  jerry_value_free (parsed_get_code_val);\n  jerry_value_free (proxy);\n  jerry_value_free (target);\n  jerry_value_free (handler);\n\n  {\n    const jerry_char_t has_value_src[] = TEST_STRING_LITERAL (\"new Proxy({}, {\\n\"\n                                                              \"  has: function(target, key) { throw 33 }\\n\"\n                                                              \"})\");\n    jerry_value_t parsed_has_code_val = jerry_parse (has_value_src, sizeof (has_value_src) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parsed_has_code_val));\n\n    jerry_value_t res = jerry_run (parsed_has_code_val);\n    jerry_value_free (parsed_has_code_val);\n    TEST_ASSERT (jerry_value_is_proxy (res));\n\n    jerry_value_t name = jerry_string_sz (\"key\");\n    TEST_ASSERT (jerry_value_is_string (name));\n    jerry_value_t property = jerry_object_has (res, name);\n    jerry_value_free (name);\n    jerry_value_free (res);\n\n    TEST_ASSERT (jerry_value_is_exception (property));\n    property = jerry_exception_value (property, true);\n    TEST_ASSERT (jerry_value_as_number (property) == 33);\n    jerry_value_free (property);\n  }\n\n  target = jerry_object ();\n  handler = jerry_object ();\n  proxy = jerry_proxy (target, handler);\n\n  {\n    jerry_value_t res = jerry_proxy_target (proxy);\n    TEST_ASSERT (res == target);\n    jerry_value_free (res);\n\n    res = jerry_proxy_handler (proxy);\n    TEST_ASSERT (res == handler);\n    jerry_value_free (res);\n\n    res = jerry_proxy_target (target);\n    TEST_ASSERT (jerry_value_is_exception (res));\n    res = jerry_exception_value (res, true);\n    TEST_ASSERT (jerry_error_type (res) == JERRY_ERROR_TYPE);\n    jerry_value_free (res);\n\n    res = jerry_proxy_handler (handler);\n    TEST_ASSERT (jerry_value_is_exception (res));\n    res = jerry_exception_value (res, true);\n    TEST_ASSERT (jerry_error_type (res) == JERRY_ERROR_TYPE);\n    jerry_value_free (res);\n  }\n\n  jerry_value_free (proxy);\n  jerry_value_free (handler);\n  jerry_value_free (target);\n\n  test_proxy_native ();\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-realm.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic void\ncreate_number_property (jerry_value_t object_value, /**< object value */\n                        char *name_p, /**< name */\n                        double number) /**< value */\n{\n  jerry_value_t name_value = jerry_string_sz (name_p);\n  jerry_value_t number_value = jerry_number (number);\n  jerry_value_t result_value = jerry_object_set (object_value, name_value, number_value);\n  TEST_ASSERT (!jerry_value_is_exception (result_value));\n\n  jerry_value_free (result_value);\n  jerry_value_free (number_value);\n  jerry_value_free (name_value);\n} /* create_number_property */\n\nstatic double\nget_number_property (jerry_value_t object_value, /**< object value */\n                     char *name_p) /**< name */\n{\n  jerry_value_t name_value = jerry_string_sz (name_p);\n  jerry_value_t result_value = jerry_object_get (object_value, name_value);\n  TEST_ASSERT (!jerry_value_is_exception (result_value));\n  TEST_ASSERT (jerry_value_is_number (result_value));\n\n  double result = jerry_value_as_number (result_value);\n\n  jerry_value_free (result_value);\n  jerry_value_free (name_value);\n  return result;\n} /* get_number_property */\n\nstatic double\neval_and_get_number (char *script_p) /**< script source */\n{\n  jerry_value_t result_value;\n  result_value = jerry_eval ((const jerry_char_t *) script_p, strlen (script_p), JERRY_PARSE_NO_OPTS);\n\n  TEST_ASSERT (jerry_value_is_number (result_value));\n  double result = jerry_value_as_number (result_value);\n  jerry_value_free (result_value);\n  return result;\n} /* eval_and_get_number */\n\nstatic void\ncheck_type_error (jerry_value_t result_value) /**< result value */\n{\n  TEST_ASSERT (jerry_value_is_exception (result_value));\n  result_value = jerry_exception_value (result_value, true);\n  TEST_ASSERT (jerry_error_type (result_value) == JERRY_ERROR_TYPE);\n  jerry_value_free (result_value);\n} /* check_type_error */\n\nstatic void\ncheck_array_prototype (jerry_value_t realm_value, jerry_value_t result_value)\n{\n  jerry_value_t name_value = jerry_string_sz (\"Array\");\n  jerry_value_t array_value = jerry_object_get (realm_value, name_value);\n  TEST_ASSERT (jerry_value_is_object (array_value));\n  jerry_value_free (name_value);\n\n  name_value = jerry_string_sz (\"prototype\");\n  jerry_value_t prototype_value = jerry_object_get (array_value, name_value);\n  TEST_ASSERT (jerry_value_is_object (prototype_value));\n  jerry_value_free (name_value);\n  jerry_value_free (array_value);\n\n  jerry_value_t compare_value = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, result_value, prototype_value);\n  jerry_value_free (prototype_value);\n\n  TEST_ASSERT (jerry_value_is_boolean (compare_value) && jerry_value_is_true (compare_value));\n  jerry_value_free (compare_value);\n} /* check_array_prototype */\n\n/**\n * Unit test's main function.\n */\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_value = jerry_current_realm ();\n  jerry_value_t result_value = jerry_realm_this (global_value);\n  TEST_ASSERT (global_value == result_value);\n  jerry_value_free (global_value);\n\n  jerry_value_t number_value = jerry_number (3);\n  check_type_error (jerry_realm_this (number_value));\n  jerry_value_free (number_value);\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_REALM))\n  {\n    printf (\"Skipping test, Realms not enabled\\n\");\n    return 0;\n  }\n\n  jerry_value_t realm_value = jerry_realm ();\n\n  create_number_property (global_value, \"a\", 3.5);\n  create_number_property (global_value, \"b\", 7.25);\n  create_number_property (realm_value, \"a\", -1.25);\n  create_number_property (realm_value, \"b\", -6.75);\n\n  TEST_ASSERT (eval_and_get_number (\"a\") == 3.5);\n\n  result_value = jerry_set_realm (realm_value);\n  TEST_ASSERT (result_value == global_value);\n  TEST_ASSERT (eval_and_get_number (\"a\") == -1.25);\n\n  result_value = jerry_set_realm (global_value);\n  TEST_ASSERT (result_value == realm_value);\n  TEST_ASSERT (eval_and_get_number (\"b\") == 7.25);\n\n  result_value = jerry_set_realm (realm_value);\n  TEST_ASSERT (result_value == global_value);\n  TEST_ASSERT (eval_and_get_number (\"b\") == -6.75);\n\n  result_value = jerry_set_realm (global_value);\n  TEST_ASSERT (result_value == realm_value);\n\n  jerry_value_t object_value = jerry_object ();\n  check_type_error (jerry_set_realm (object_value));\n  jerry_value_free (object_value);\n\n  number_value = jerry_number (5);\n  check_type_error (jerry_set_realm (number_value));\n  jerry_value_free (number_value);\n\n  jerry_value_free (global_value);\n  jerry_value_free (realm_value);\n\n  realm_value = jerry_realm ();\n\n  result_value = jerry_realm_this (realm_value);\n  TEST_ASSERT (result_value == realm_value);\n  jerry_value_free (result_value);\n\n  result_value = jerry_set_realm (realm_value);\n  TEST_ASSERT (!jerry_value_is_exception (result_value));\n  object_value = jerry_object ();\n  jerry_set_realm (result_value);\n\n  number_value = jerry_number (7);\n  check_type_error (jerry_realm_set_this (realm_value, number_value));\n  check_type_error (jerry_realm_set_this (number_value, object_value));\n  jerry_value_free (number_value);\n\n  result_value = jerry_realm_set_this (realm_value, object_value);\n  TEST_ASSERT (jerry_value_is_boolean (result_value) && jerry_value_is_true (result_value));\n  jerry_value_free (result_value);\n\n  create_number_property (object_value, \"x\", 7.25);\n  create_number_property (object_value, \"y\", 1.25);\n\n  result_value = jerry_set_realm (realm_value);\n  TEST_ASSERT (!jerry_value_is_exception (result_value));\n  TEST_ASSERT (eval_and_get_number (\"var z = -5.5; x + this.y\") == 8.5);\n  jerry_set_realm (result_value);\n\n  TEST_ASSERT (get_number_property (object_value, \"z\") == -5.5);\n\n  result_value = jerry_realm_this (realm_value);\n  TEST_ASSERT (result_value == object_value);\n  jerry_value_free (result_value);\n\n  jerry_value_free (object_value);\n  jerry_value_free (realm_value);\n\n  if (jerry_feature_enabled (JERRY_FEATURE_PROXY))\n  {\n    /* Check property creation. */\n    jerry_value_t handler_value = jerry_object ();\n    jerry_value_t target_value = jerry_realm ();\n    jerry_value_t proxy_value = jerry_proxy (target_value, handler_value);\n\n    jerry_realm_set_this (target_value, proxy_value);\n    jerry_value_free (proxy_value);\n    jerry_value_free (handler_value);\n\n    jerry_value_t old_realm_value = jerry_set_realm (target_value);\n    TEST_ASSERT (!jerry_value_is_exception (old_realm_value));\n    TEST_ASSERT (eval_and_get_number (\"var z = 1.5; z\") == 1.5);\n    jerry_set_realm (old_realm_value);\n\n    TEST_ASSERT (get_number_property (target_value, \"z\") == 1.5);\n    jerry_value_free (target_value);\n\n    /* Check isExtensible error. */\n\n    const char *script_p = \"new Proxy({}, { isExtensible: function() { throw 42.5 } })\";\n    proxy_value = jerry_eval ((const jerry_char_t *) script_p, strlen (script_p), JERRY_PARSE_NO_OPTS);\n    TEST_ASSERT (!jerry_value_is_exception (proxy_value) && jerry_value_is_object (proxy_value));\n\n    target_value = jerry_realm ();\n    jerry_realm_set_this (target_value, proxy_value);\n    jerry_value_free (proxy_value);\n\n    old_realm_value = jerry_set_realm (target_value);\n    TEST_ASSERT (!jerry_value_is_exception (old_realm_value));\n    script_p = \"var z = 1.5\";\n    result_value = jerry_eval ((const jerry_char_t *) script_p, strlen (script_p), JERRY_PARSE_NO_OPTS);\n    jerry_set_realm (old_realm_value);\n    jerry_value_free (target_value);\n\n    TEST_ASSERT (jerry_value_is_exception (result_value));\n    result_value = jerry_exception_value (result_value, true);\n    TEST_ASSERT (jerry_value_is_number (result_value) && jerry_value_as_number (result_value) == 42.5);\n    jerry_value_free (result_value);\n  }\n\n  realm_value = jerry_realm ();\n\n  result_value = jerry_set_realm (realm_value);\n  TEST_ASSERT (!jerry_value_is_exception (result_value));\n\n  const char *script_p = \"global2 = global1 - 1; Object.getPrototypeOf([])\";\n  jerry_value_t script_value = jerry_parse ((const jerry_char_t *) script_p, strlen (script_p), NULL);\n\n  TEST_ASSERT (!jerry_value_is_exception (script_value));\n  jerry_set_realm (result_value);\n\n  /* Script is compiled in another realm. */\n  create_number_property (realm_value, \"global1\", 7.5);\n  result_value = jerry_run (script_value);\n  TEST_ASSERT (!jerry_value_is_exception (result_value));\n\n  check_array_prototype (realm_value, result_value);\n\n  jerry_value_free (result_value);\n  jerry_value_free (script_value);\n\n  TEST_ASSERT (get_number_property (realm_value, \"global2\") == 6.5);\n\n  jerry_value_free (realm_value);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-regexp-dotall-unicode.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nint\nmain (void)\n{\n  TEST_INIT ();\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t undefined_this_arg = jerry_undefined ();\n  char pattern2[] = \"\\\\u{61}.\\\\u{62}\";\n\n  uint16_t flags = JERRY_REGEXP_FLAG_DOTALL | JERRY_REGEXP_FLAG_UNICODE | JERRY_REGEXP_FLAG_STICKY;\n  jerry_value_t regex_obj = jerry_regexp_sz (pattern2, flags);\n  TEST_ASSERT (jerry_value_is_object (regex_obj));\n\n  const jerry_char_t func_src2[] = \"return [regex.exec('a\\\\nb'), regex.dotAll, regex.sticky, regex.unicode ];\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_ARGUMENT_LIST;\n  parse_options.argument_list = jerry_string_sz (\"regex\");\n\n  jerry_value_t func_val = jerry_parse (func_src2, sizeof (func_src2) - 1, &parse_options);\n  jerry_value_free (parse_options.argument_list);\n\n  jerry_value_t res = jerry_call (func_val, undefined_this_arg, &regex_obj, 1);\n  jerry_value_t regex_res = jerry_object_get_index (res, 0);\n  jerry_value_t regex_res_str = jerry_object_get_index (regex_res, 0);\n  jerry_value_t is_dotall = jerry_object_get_index (res, 1);\n  jerry_value_t is_sticky = jerry_object_get_index (res, 2);\n  jerry_value_t is_unicode = jerry_object_get_index (res, 3);\n\n  jerry_size_t str_size = jerry_string_size (regex_res_str, JERRY_ENCODING_CESU8);\n  JERRY_VLA (jerry_char_t, res_buff, str_size);\n  jerry_size_t res_size = jerry_string_to_buffer (regex_res_str, JERRY_ENCODING_CESU8, res_buff, str_size);\n\n  const char expected_result[] = \"a\\nb\";\n  TEST_ASSERT (res_size == (sizeof (expected_result) - 1));\n  TEST_ASSERT (strncmp (expected_result, (const char *) res_buff, res_size) == 0);\n  TEST_ASSERT (jerry_value_is_true (is_dotall));\n  TEST_ASSERT (jerry_value_is_true (is_sticky));\n  TEST_ASSERT (jerry_value_is_true (is_unicode));\n\n  jerry_value_free (regex_obj);\n  jerry_value_free (res);\n  jerry_value_free (func_val);\n  jerry_value_free (regex_res);\n  jerry_value_free (regex_res_str);\n  jerry_value_free (is_dotall);\n  jerry_value_free (is_sticky);\n  jerry_value_free (is_unicode);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-regexp.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nint\nmain (void)\n{\n  TEST_INIT ();\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global_obj_val = jerry_current_realm ();\n\n  char pattern[] = \"[^.]+\";\n  uint16_t flags = JERRY_REGEXP_FLAG_GLOBAL | JERRY_REGEXP_FLAG_MULTILINE;\n  jerry_value_t regex_obj = jerry_regexp_sz (pattern, flags);\n  TEST_ASSERT (jerry_value_is_object (regex_obj));\n\n  const jerry_char_t func_src[] = \"return [regex.exec('something.domain.com'), regex.multiline, regex.global];\";\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_ARGUMENT_LIST;\n  parse_options.argument_list = jerry_string_sz (\"regex\");\n\n  jerry_value_t func_val = jerry_parse (func_src, sizeof (func_src) - 1, &parse_options);\n  jerry_value_free (parse_options.argument_list);\n\n  jerry_value_t res = jerry_call (func_val, global_obj_val, &regex_obj, 1);\n  jerry_value_t regex_res = jerry_object_get_index (res, 0);\n  jerry_value_t regex_res_str = jerry_object_get_index (regex_res, 0);\n  jerry_value_t is_multiline = jerry_object_get_index (res, 1);\n  jerry_value_t is_global = jerry_object_get_index (res, 2);\n\n  const char expected_result[] = \"something\";\n  jerry_size_t str_size = jerry_string_size (regex_res_str, JERRY_ENCODING_CESU8);\n  TEST_ASSERT (str_size == (sizeof (expected_result) - 1));\n\n  JERRY_VLA (jerry_char_t, res_buff, str_size);\n  jerry_size_t res_size = jerry_string_to_buffer (regex_res_str, JERRY_ENCODING_CESU8, res_buff, str_size);\n\n  TEST_ASSERT (res_size == str_size);\n  TEST_ASSERT (strncmp (expected_result, (const char *) res_buff, res_size) == 0);\n  TEST_ASSERT (jerry_value_is_true (is_multiline));\n  TEST_ASSERT (jerry_value_is_true (is_global));\n\n  jerry_value_free (regex_obj);\n  jerry_value_free (res);\n  jerry_value_free (func_val);\n  jerry_value_free (regex_res);\n  jerry_value_free (regex_res_str);\n  jerry_value_free (is_multiline);\n  jerry_value_free (is_global);\n  jerry_value_free (global_obj_val);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-regression-3588.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\n/**\n * Empty constructor\n */\nstatic jerry_value_t\nconstruct_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                   const jerry_value_t args_p[], /**< function arguments */\n                   const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  JERRY_UNUSED (call_info_p);\n\n  TEST_ASSERT (args_cnt == 1);\n  TEST_ASSERT (jerry_value_as_number (args_p[0]) == 1.0);\n\n  return jerry_undefined ();\n} /* construct_handler */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  {\n    jerry_value_t global_obj_val = jerry_current_realm ();\n\n    jerry_value_t function_val = jerry_function_external (construct_handler);\n    jerry_value_t function_name_val = jerry_string_sz (\"Demo\");\n    jerry_value_t result_val = jerry_object_set (global_obj_val, function_name_val, function_val);\n    TEST_ASSERT (!jerry_value_is_exception (result_val));\n    TEST_ASSERT (jerry_value_is_true (result_val));\n    jerry_value_free (result_val);\n    jerry_value_free (function_name_val);\n    jerry_value_free (global_obj_val);\n    jerry_value_free (function_val);\n  }\n\n  {\n    static const jerry_char_t test_source[] =\n      TEST_STRING_LITERAL (\"class Sub1 extends Demo { constructor () { super (1); } };\"\n                           \"new Sub1 ()\");\n\n    jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n\n    jerry_value_t result = jerry_run (parsed_code_val);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n\n    jerry_value_free (result);\n    jerry_value_free (parsed_code_val);\n  }\n\n  {\n    static const jerry_char_t test_source[] = TEST_STRING_LITERAL (\"class Sub2 extends Demo { };\"\n                                                                   \"new Sub2 (1)\");\n\n    jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n\n    jerry_value_t result = jerry_run (parsed_code_val);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n\n    jerry_value_free (result);\n    jerry_value_free (parsed_code_val);\n  }\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-script-user-value.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic jerry_value_t user_values[4];\n\n#define USER_VALUES_SIZE (sizeof (user_values) / sizeof (jerry_value_t))\n\nstatic void\ntest_parse (const char *source_p, /**< source code */\n            jerry_parse_options_t *options_p, /**< options passed to jerry_parse */\n            bool run_code) /**< run the code after parsing */\n{\n  for (size_t i = 0; i < USER_VALUES_SIZE; i++)\n  {\n    options_p->user_value = user_values[i];\n\n    jerry_value_t result = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), options_p);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n\n    if (run_code)\n    {\n      jerry_value_t parse_result = result;\n      result = jerry_run (result);\n      jerry_value_free (parse_result);\n      TEST_ASSERT (!jerry_value_is_exception (result));\n    }\n\n    jerry_value_t user_value = jerry_source_user_value (result);\n    jerry_value_t compare_value = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, user_value, user_values[i]);\n\n    TEST_ASSERT (jerry_value_is_true (compare_value));\n\n    jerry_value_free (compare_value);\n    jerry_value_free (user_value);\n    jerry_value_free (result);\n  }\n} /* test_parse */\n\nstatic void\ntest_parse_function (const char *source_p, /**< source code */\n                     jerry_parse_options_t *options_p, /**< options passed to jerry_parse */\n                     bool run_code) /**< run the code after parsing */\n{\n  options_p->options |= JERRY_PARSE_HAS_ARGUMENT_LIST;\n  options_p->argument_list = jerry_string_sz (\"\");\n\n  for (size_t i = 0; i < USER_VALUES_SIZE; i++)\n  {\n    options_p->user_value = user_values[i];\n\n    jerry_value_t result = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), options_p);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n\n    if (run_code)\n    {\n      jerry_value_t parse_result = result;\n      jerry_value_t this_value = jerry_undefined ();\n      result = jerry_call (result, this_value, NULL, 0);\n      jerry_value_free (parse_result);\n      jerry_value_free (this_value);\n      TEST_ASSERT (!jerry_value_is_exception (result));\n    }\n\n    jerry_value_t user_value = jerry_source_user_value (result);\n    jerry_value_t compare_value = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, user_value, user_values[i]);\n\n    TEST_ASSERT (jerry_value_is_true (compare_value));\n\n    jerry_value_free (compare_value);\n    jerry_value_free (user_value);\n    jerry_value_free (result);\n  }\n\n  jerry_value_free (options_p->argument_list);\n} /* test_parse_function */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  user_values[0] = jerry_object ();\n  user_values[1] = jerry_null ();\n  user_values[2] = jerry_number (5.5);\n  user_values[3] = jerry_string_sz (\"AnyString...\");\n\n  jerry_parse_options_t parse_options;\n  const char *source_p = TEST_STRING_LITERAL (\"\");\n\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse (source_p, &parse_options, false);\n  test_parse_function (source_p, &parse_options, false);\n\n  if (jerry_feature_enabled (JERRY_FEATURE_MODULE))\n  {\n    parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_USER_VALUE;\n    test_parse (source_p, &parse_options, false);\n  }\n\n  source_p = TEST_STRING_LITERAL (\"function f() { }\\n\"\n                                  \"f\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse (source_p, &parse_options, true);\n\n  source_p = TEST_STRING_LITERAL (\"function f() { return function() {} }\\n\"\n                                  \"f()\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse (source_p, &parse_options, true);\n\n  source_p = TEST_STRING_LITERAL (\"return function() {}\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse_function (source_p, &parse_options, true);\n\n  source_p = TEST_STRING_LITERAL (\"(class {})\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse (source_p, &parse_options, true);\n\n  source_p = TEST_STRING_LITERAL (\"eval('function f() {}')\\n\"\n                                  \"f\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse (source_p, &parse_options, true);\n\n  source_p = TEST_STRING_LITERAL (\"eval('function f() { return eval(\\\\'(function () {})\\\\') }')\\n\"\n                                  \"f()\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse (source_p, &parse_options, true);\n\n  source_p = TEST_STRING_LITERAL (\"eval('function f() {}')\\n\"\n                                  \"return f\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse_function (source_p, &parse_options, true);\n\n  source_p = TEST_STRING_LITERAL (\"eval('function f() { return eval(\\\\'(function () {})\\\\') }')\\n\"\n                                  \"return f()\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse_function (source_p, &parse_options, true);\n\n  source_p = TEST_STRING_LITERAL (\"function f() {}\\n\"\n                                  \"f.bind(1)\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse (source_p, &parse_options, true);\n\n  source_p = TEST_STRING_LITERAL (\"function f() {}\\n\"\n                                  \"f.bind(1).bind(2, 3)\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse (source_p, &parse_options, true);\n\n  source_p = TEST_STRING_LITERAL (\"function f() {}\\n\"\n                                  \"return f.bind(1)\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse_function (source_p, &parse_options, true);\n\n  source_p = TEST_STRING_LITERAL (\"function f() {}\\n\"\n                                  \"return f.bind(1).bind(2, 3)\");\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE;\n  test_parse_function (source_p, &parse_options, true);\n\n  for (size_t i = 0; i < USER_VALUES_SIZE; i++)\n  {\n    jerry_value_t result = jerry_source_user_value (user_values[i]);\n    TEST_ASSERT (jerry_value_is_undefined (result));\n    jerry_value_free (result);\n  }\n\n  for (size_t i = 0; i < USER_VALUES_SIZE; i++)\n  {\n    jerry_value_free (user_values[i]);\n  }\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-snapshot.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\n/**\n * Maximum size of snapshots buffer\n */\n#define SNAPSHOT_BUFFER_SIZE (256)\n\n/**\n * Maximum size of literal buffer\n */\n#define LITERAL_BUFFER_SIZE (256)\n\n/**\n * Magic strings\n */\nstatic const jerry_char_t *magic_strings[] = { (const jerry_char_t *) \" \",      (const jerry_char_t *) \"a\",\n                                               (const jerry_char_t *) \"b\",      (const jerry_char_t *) \"c\",\n                                               (const jerry_char_t *) \"from\",   (const jerry_char_t *) \"func\",\n                                               (const jerry_char_t *) \"string\", (const jerry_char_t *) \"snapshot\" };\n\n/**\n * Magic string lengths\n */\nstatic const jerry_length_t magic_string_lengths[] = { 1, 1, 1, 1, 4, 4, 6, 8 };\n\nstatic void\ntest_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_size, uint32_t exec_snapshot_flags)\n{\n  char string_data[32];\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_register_magic_strings (magic_strings,\n                                sizeof (magic_string_lengths) / sizeof (jerry_length_t),\n                                magic_string_lengths);\n\n  jerry_value_t res = jerry_exec_snapshot (snapshot_p, snapshot_size, 0, exec_snapshot_flags, NULL);\n\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_string (res));\n  jerry_size_t sz = jerry_string_size (res, JERRY_ENCODING_CESU8);\n  TEST_ASSERT (sz == 20);\n  sz = jerry_string_to_buffer (res, JERRY_ENCODING_CESU8, (jerry_char_t *) string_data, sz);\n  TEST_ASSERT (sz == 20);\n  jerry_value_free (res);\n  TEST_ASSERT (!strncmp (string_data, \"string from snapshot\", (size_t) sz));\n\n  jerry_cleanup ();\n} /* test_exec_snapshot */\n\nstatic void\ntest_static_snapshot (void)\n{\n  if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))\n  {\n    static uint32_t snapshot_buffer[SNAPSHOT_BUFFER_SIZE];\n    const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL (\"function func(a, b, c) {\"\n                                                                 \"  c = 'snapshot';\"\n                                                                 \"  return arguments[0] + ' ' + b + ' ' + arguments[2];\"\n                                                                 \"};\"\n                                                                 \"func('string', 'from');\");\n\n    jerry_init (JERRY_INIT_EMPTY);\n    jerry_register_magic_strings (magic_strings,\n                                  sizeof (magic_string_lengths) / sizeof (jerry_length_t),\n                                  magic_string_lengths);\n\n    jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n\n    jerry_value_t generate_result =\n      jerry_generate_snapshot (parse_result, JERRY_SNAPSHOT_SAVE_STATIC, snapshot_buffer, SNAPSHOT_BUFFER_SIZE);\n    jerry_value_free (parse_result);\n\n    TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result));\n\n    size_t snapshot_size = (size_t) jerry_value_as_number (generate_result);\n    jerry_value_free (generate_result);\n\n    /* Static snapshots are not supported by default. */\n    jerry_value_t exec_result = jerry_exec_snapshot (snapshot_buffer, snapshot_size, 0, 0, NULL);\n    TEST_ASSERT (jerry_value_is_exception (exec_result));\n    jerry_value_free (exec_result);\n\n    jerry_cleanup ();\n\n    test_exec_snapshot (snapshot_buffer, snapshot_size, JERRY_SNAPSHOT_EXEC_ALLOW_STATIC);\n  }\n} /* test_static_snapshot */\n\nstatic void\ntest_merge_snapshot (void)\n{\n  if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))\n  {\n    static uint32_t snapshot_buffer_0[SNAPSHOT_BUFFER_SIZE];\n    static uint32_t snapshot_buffer_1[SNAPSHOT_BUFFER_SIZE];\n    size_t snapshot_sizes[2];\n    static uint32_t merged_snapshot_buffer[SNAPSHOT_BUFFER_SIZE];\n\n    const jerry_char_t code_to_snapshot1[] = \"var a = 'hello'; 123\";\n\n    jerry_init (JERRY_INIT_EMPTY);\n\n    jerry_value_t parse_result = jerry_parse (code_to_snapshot1, sizeof (code_to_snapshot1) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n\n    jerry_value_t generate_result = jerry_generate_snapshot (parse_result, 0, snapshot_buffer_0, SNAPSHOT_BUFFER_SIZE);\n    jerry_value_free (parse_result);\n\n    TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result));\n\n    snapshot_sizes[0] = (size_t) jerry_value_as_number (generate_result);\n    jerry_value_free (generate_result);\n\n    jerry_cleanup ();\n\n    const jerry_char_t code_to_snapshot2[] = \"var b = 'hello'; 456\";\n\n    jerry_init (JERRY_INIT_EMPTY);\n\n    parse_result = jerry_parse (code_to_snapshot2, sizeof (code_to_snapshot2) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n\n    generate_result = jerry_generate_snapshot (parse_result, 0, snapshot_buffer_1, SNAPSHOT_BUFFER_SIZE);\n    jerry_value_free (parse_result);\n\n    TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result));\n\n    snapshot_sizes[1] = (size_t) jerry_value_as_number (generate_result);\n    jerry_value_free (generate_result);\n\n    jerry_cleanup ();\n\n    jerry_init (JERRY_INIT_EMPTY);\n\n    const char *error_p;\n    const uint32_t *snapshot_buffers[2];\n\n    snapshot_buffers[0] = snapshot_buffer_0;\n    snapshot_buffers[1] = snapshot_buffer_1;\n\n    static uint32_t snapshot_buffer_0_bck[SNAPSHOT_BUFFER_SIZE];\n    static uint32_t snapshot_buffer_1_bck[SNAPSHOT_BUFFER_SIZE];\n\n    memcpy (snapshot_buffer_0_bck, snapshot_buffer_0, SNAPSHOT_BUFFER_SIZE);\n    memcpy (snapshot_buffer_1_bck, snapshot_buffer_1, SNAPSHOT_BUFFER_SIZE);\n\n    size_t merged_size = jerry_merge_snapshots (snapshot_buffers,\n                                                snapshot_sizes,\n                                                2,\n                                                merged_snapshot_buffer,\n                                                SNAPSHOT_BUFFER_SIZE,\n                                                &error_p);\n\n    jerry_cleanup ();\n\n    TEST_ASSERT (0 == memcmp (snapshot_buffer_0_bck, snapshot_buffer_0, SNAPSHOT_BUFFER_SIZE));\n    TEST_ASSERT (0 == memcmp (snapshot_buffer_1_bck, snapshot_buffer_1, SNAPSHOT_BUFFER_SIZE));\n\n    jerry_init (JERRY_INIT_EMPTY);\n\n    jerry_value_t res = jerry_exec_snapshot (merged_snapshot_buffer, merged_size, 0, 0, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (res));\n    TEST_ASSERT (jerry_value_as_number (res) == 123);\n    jerry_value_free (res);\n\n    res = jerry_exec_snapshot (merged_snapshot_buffer, merged_size, 1, 0, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (res));\n    TEST_ASSERT (jerry_value_as_number (res) == 456);\n    jerry_value_free (res);\n\n    jerry_cleanup ();\n  }\n} /* test_merge_snapshot */\n\nstatic void\ntest_save_literals (void)\n{\n  if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE))\n  {\n    /* C format generation */\n    jerry_init (JERRY_INIT_EMPTY);\n\n    static jerry_char_t literal_buffer_c[LITERAL_BUFFER_SIZE];\n    static uint32_t literal_snapshot_buffer[SNAPSHOT_BUFFER_SIZE];\n    static const jerry_char_t code_for_c_format[] = \"var object = { aa:'fo\\\" o\\\\n \\\\\\\\', Bb:'max', aaa:'xzy0' };\";\n\n    jerry_value_t parse_result = jerry_parse (code_for_c_format, sizeof (code_for_c_format) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n\n    jerry_value_t generate_result =\n      jerry_generate_snapshot (parse_result, 0, literal_snapshot_buffer, SNAPSHOT_BUFFER_SIZE);\n    jerry_value_free (parse_result);\n\n    TEST_ASSERT (!jerry_value_is_exception (generate_result));\n    TEST_ASSERT (jerry_value_is_number (generate_result));\n\n    size_t snapshot_size = (size_t) jerry_value_as_number (generate_result);\n    jerry_value_free (generate_result);\n\n    const size_t lit_c_buf_sz = jerry_get_literals_from_snapshot (literal_snapshot_buffer,\n                                                                  snapshot_size,\n                                                                  literal_buffer_c,\n                                                                  LITERAL_BUFFER_SIZE,\n                                                                  true);\n    TEST_ASSERT (lit_c_buf_sz == 239);\n\n    static const char *expected_c_format = (\"jerry_length_t literal_count = 5;\\n\\n\"\n                                            \"jerry_char_t *literals[5] =\\n\"\n                                            \"{\\n\"\n                                            \"  \\\"Bb\\\",\\n\"\n                                            \"  \\\"aa\\\",\\n\"\n                                            \"  \\\"aaa\\\",\\n\"\n                                            \"  \\\"xzy0\\\",\\n\"\n                                            \"  \\\"fo\\\\\\\" o\\\\x0A \\\\\\\\\\\"\\n\"\n                                            \"};\\n\\n\"\n                                            \"jerry_length_t literal_sizes[5] =\\n\"\n                                            \"{\\n\"\n                                            \"  2 /* Bb */,\\n\"\n                                            \"  2 /* aa */,\\n\"\n                                            \"  3 /* aaa */,\\n\"\n                                            \"  4 /* xzy0 */,\\n\"\n                                            \"  8 /* fo\\\" o\\n \\\\ */\\n\"\n                                            \"};\\n\");\n\n    TEST_ASSERT (!strncmp ((char *) literal_buffer_c, expected_c_format, lit_c_buf_sz));\n\n    /* List format generation */\n    static jerry_char_t literal_buffer_list[LITERAL_BUFFER_SIZE];\n    const size_t lit_list_buf_sz = jerry_get_literals_from_snapshot (literal_snapshot_buffer,\n                                                                     snapshot_size,\n                                                                     literal_buffer_list,\n                                                                     LITERAL_BUFFER_SIZE,\n                                                                     false);\n    TEST_ASSERT (lit_list_buf_sz == 34);\n    TEST_ASSERT (\n      !strncmp ((char *) literal_buffer_list, \"2 Bb\\n2 aa\\n3 aaa\\n4 xzy0\\n8 fo\\\" o\\n \\\\\\n\", lit_list_buf_sz));\n\n    jerry_cleanup ();\n  }\n} /* test_save_literals */\n\nstatic void\ntest_function_snapshot (void)\n{\n  if (!jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) || !jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))\n  {\n    return;\n  }\n\n  const jerry_init_flag_t flags = JERRY_INIT_EMPTY;\n  static uint32_t function_snapshot_buffer[SNAPSHOT_BUFFER_SIZE];\n\n  const jerry_char_t code_to_snapshot[] = \"return a + b\";\n\n  jerry_init (flags);\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_ARGUMENT_LIST;\n  parse_options.argument_list = jerry_string_sz (\"a, b\");\n\n  jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, &parse_options);\n  TEST_ASSERT (!jerry_value_is_exception (parse_result));\n\n  jerry_value_t generate_result =\n    jerry_generate_snapshot (parse_result, 0, function_snapshot_buffer, SNAPSHOT_BUFFER_SIZE);\n  jerry_value_free (parse_result);\n  jerry_value_free (parse_options.argument_list);\n\n  TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result));\n\n  size_t function_snapshot_size = (size_t) jerry_value_as_number (generate_result);\n  jerry_value_free (generate_result);\n\n  jerry_cleanup ();\n\n  jerry_init (flags);\n\n  jerry_value_t function_obj = jerry_exec_snapshot (function_snapshot_buffer,\n                                                    function_snapshot_size,\n                                                    0,\n                                                    JERRY_SNAPSHOT_EXEC_LOAD_AS_FUNCTION,\n                                                    NULL);\n\n  TEST_ASSERT (!jerry_value_is_exception (function_obj));\n  TEST_ASSERT (jerry_value_is_function (function_obj));\n\n  jerry_value_t this_val = jerry_undefined ();\n  jerry_value_t args[2];\n  args[0] = jerry_number (1.0);\n  args[1] = jerry_number (2.0);\n\n  jerry_value_t res = jerry_call (function_obj, this_val, args, 2);\n\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_number (res));\n  double num = jerry_value_as_number (res);\n  TEST_ASSERT (num == 3);\n\n  jerry_value_free (args[0]);\n  jerry_value_free (args[1]);\n  jerry_value_free (res);\n  jerry_value_free (function_obj);\n\n  jerry_cleanup ();\n} /* test_function_snapshot */\n\nstatic void\narguments_test_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_size, uint32_t exec_snapshot_flags)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n  jerry_value_t res = jerry_exec_snapshot (snapshot_p, snapshot_size, 0, exec_snapshot_flags, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_number (res));\n  double raw_value = jerry_value_as_number (res);\n  TEST_ASSERT (raw_value == 15);\n  jerry_value_free (res);\n\n  jerry_cleanup ();\n} /* arguments_test_exec_snapshot */\n\nstatic void\ntest_function_arguments_snapshot (void)\n{\n  if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))\n  {\n    static uint32_t arguments_snapshot_buffer[SNAPSHOT_BUFFER_SIZE];\n\n    const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL (\"function f(a,b,c) {\"\n                                                                 \"  arguments[0]++;\"\n                                                                 \"  arguments[1]++;\"\n                                                                 \"  arguments[2]++;\"\n                                                                 \"  return a + b + c;\"\n                                                                 \"}\"\n                                                                 \"f(3,4,5);\");\n    jerry_init (JERRY_INIT_EMPTY);\n\n    jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n\n    jerry_value_t generate_result =\n      jerry_generate_snapshot (parse_result, 0, arguments_snapshot_buffer, SNAPSHOT_BUFFER_SIZE);\n    jerry_value_free (parse_result);\n\n    TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result));\n\n    size_t snapshot_size = (size_t) jerry_value_as_number (generate_result);\n    jerry_value_free (generate_result);\n\n    jerry_cleanup ();\n\n    arguments_test_exec_snapshot (arguments_snapshot_buffer, snapshot_size, 0);\n    arguments_test_exec_snapshot (arguments_snapshot_buffer, snapshot_size, JERRY_SNAPSHOT_EXEC_COPY_DATA);\n  }\n} /* test_function_arguments_snapshot */\n\nstatic void\ntest_snapshot_with_user (void)\n{\n  if (jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))\n  {\n    static uint32_t snapshot_buffer[SNAPSHOT_BUFFER_SIZE];\n\n    const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL (\"function f() {}\\n\"\n                                                                 \"f\");\n    jerry_init (JERRY_INIT_EMPTY);\n\n    jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (parse_result));\n\n    jerry_value_t generate_result = jerry_generate_snapshot (parse_result, 0, snapshot_buffer, SNAPSHOT_BUFFER_SIZE);\n    jerry_value_free (parse_result);\n\n    TEST_ASSERT (!jerry_value_is_exception (generate_result) && jerry_value_is_number (generate_result));\n\n    size_t snapshot_size = (size_t) jerry_value_as_number (generate_result);\n    jerry_value_free (generate_result);\n\n    for (int i = 0; i < 3; i++)\n    {\n      jerry_exec_snapshot_option_values_t snapshot_exec_options;\n\n      if (i == 0)\n      {\n        snapshot_exec_options.user_value = jerry_object ();\n      }\n      else if (i == 1)\n      {\n        snapshot_exec_options.user_value = jerry_number (-3.5);\n      }\n      else\n      {\n        snapshot_exec_options.user_value = jerry_string_sz (\"AnyString...\");\n      }\n\n      jerry_value_t result = jerry_exec_snapshot (snapshot_buffer,\n                                                  snapshot_size,\n                                                  0,\n                                                  JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE,\n                                                  &snapshot_exec_options);\n\n      TEST_ASSERT (!jerry_value_is_exception (result) && jerry_value_is_function (result));\n\n      jerry_value_t user_value = jerry_source_user_value (result);\n      jerry_value_free (result);\n\n      result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, user_value, snapshot_exec_options.user_value);\n\n      TEST_ASSERT (jerry_value_is_true (result));\n\n      jerry_value_free (result);\n      jerry_value_free (user_value);\n      jerry_value_free (snapshot_exec_options.user_value);\n    }\n\n    jerry_cleanup ();\n  }\n} /* test_snapshot_with_user */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  test_static_snapshot ();\n\n  test_merge_snapshot ();\n\n  test_save_literals ();\n\n  test_function_snapshot ();\n\n  test_function_arguments_snapshot ();\n\n  test_snapshot_with_user ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-source-info.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic void\ncompare_string (jerry_value_t left_string, /**< left string */\n                const char *right_string_p) /**< right string */\n{\n  size_t size = strlen (right_string_p);\n  uint8_t buffer[64];\n\n  TEST_ASSERT (size == jerry_string_size (left_string, JERRY_ENCODING_CESU8));\n  TEST_ASSERT (size < sizeof (buffer));\n  TEST_ASSERT (jerry_string_to_buffer (left_string, JERRY_ENCODING_CESU8, buffer, (jerry_size_t) size) == size);\n  TEST_ASSERT (memcmp (buffer, right_string_p, size) == 0);\n} /* compare_string */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_FUNCTION_TO_STRING))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Source code is not stored!\\n\");\n    jerry_cleanup ();\n    return 0;\n  }\n\n  jerry_value_t value = jerry_null ();\n  jerry_source_info_t *source_info_p = jerry_source_info (value);\n  TEST_ASSERT (source_info_p == NULL);\n  jerry_source_info_free (source_info_p);\n  jerry_value_free (value);\n\n  value = jerry_object ();\n  source_info_p = jerry_source_info (value);\n  TEST_ASSERT (source_info_p == NULL);\n  jerry_source_info_free (source_info_p);\n  jerry_value_free (value);\n\n  jerry_parse_options_t parse_options;\n  const char *source_p = TEST_STRING_LITERAL (\"var a = 6\");\n\n  value = jerry_parse ((jerry_char_t *) source_p, strlen (source_p), NULL);\n  source_info_p = jerry_source_info (value);\n  TEST_ASSERT (source_info_p != NULL);\n  TEST_ASSERT (source_info_p->enabled_fields == JERRY_SOURCE_INFO_HAS_SOURCE_CODE);\n  compare_string (source_info_p->source_code, source_p);\n  TEST_ASSERT (jerry_value_is_undefined (source_info_p->function_arguments));\n  TEST_ASSERT (source_info_p->source_range_start == 0);\n  TEST_ASSERT (source_info_p->source_range_length == 0);\n  jerry_source_info_free (source_info_p);\n  jerry_value_free (value);\n\n  if (jerry_feature_enabled (JERRY_FEATURE_MODULE))\n  {\n    parse_options.options = JERRY_PARSE_MODULE;\n\n    value = jerry_parse ((jerry_char_t *) source_p, strlen (source_p), &parse_options);\n\n    jerry_value_t result = jerry_module_link (value, NULL, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n    jerry_value_free (result);\n\n    source_info_p = jerry_source_info (value);\n    TEST_ASSERT (source_info_p != NULL);\n    TEST_ASSERT (source_info_p->enabled_fields == JERRY_SOURCE_INFO_HAS_SOURCE_CODE);\n    compare_string (source_info_p->source_code, source_p);\n    TEST_ASSERT (jerry_value_is_undefined (source_info_p->function_arguments));\n    TEST_ASSERT (source_info_p->source_range_start == 0);\n    TEST_ASSERT (source_info_p->source_range_length == 0);\n    jerry_source_info_free (source_info_p);\n\n    result = jerry_module_evaluate (value);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n    jerry_value_free (result);\n\n    /* Byte code is released after a successful evaluation. */\n    source_info_p = jerry_source_info (value);\n    TEST_ASSERT (source_info_p == NULL);\n    jerry_source_info_free (source_info_p);\n    jerry_value_free (value);\n  }\n\n  source_p = TEST_STRING_LITERAL (\"( function f() {} )\");\n\n  value = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);\n  source_info_p = jerry_source_info (value);\n  TEST_ASSERT (source_info_p != NULL);\n  TEST_ASSERT (source_info_p->enabled_fields\n               == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE | JERRY_SOURCE_INFO_HAS_SOURCE_RANGE));\n  compare_string (source_info_p->source_code, source_p);\n  TEST_ASSERT (jerry_value_is_undefined (source_info_p->function_arguments));\n  TEST_ASSERT (source_info_p->source_range_start == 2);\n  TEST_ASSERT (source_info_p->source_range_length == 15);\n  jerry_source_info_free (source_info_p);\n  jerry_value_free (value);\n\n  source_p = TEST_STRING_LITERAL (\"new Function('a', 'b', 'return 0;')\");\n\n  value = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);\n  source_info_p = jerry_source_info (value);\n  TEST_ASSERT (source_info_p != NULL);\n  TEST_ASSERT (source_info_p->enabled_fields\n               == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE | JERRY_SOURCE_INFO_HAS_FUNCTION_ARGUMENTS));\n  compare_string (source_info_p->source_code, \"return 0;\");\n  compare_string (source_info_p->function_arguments, \"a,b\");\n  TEST_ASSERT (source_info_p->source_range_start == 0);\n  TEST_ASSERT (source_info_p->source_range_length == 0);\n  jerry_source_info_free (source_info_p);\n  jerry_value_free (value);\n\n  source_p = TEST_STRING_LITERAL (\"(new Function('a = ( function() { } )', 'return a;'))()\");\n\n  value = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);\n  source_info_p = jerry_source_info (value);\n  TEST_ASSERT (source_info_p != NULL);\n  TEST_ASSERT (source_info_p->enabled_fields\n               == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE | JERRY_SOURCE_INFO_HAS_SOURCE_RANGE));\n  compare_string (source_info_p->source_code, \"a = ( function() { } )\");\n  TEST_ASSERT (jerry_value_is_undefined (source_info_p->function_arguments));\n  TEST_ASSERT (source_info_p->source_range_start == 6);\n  TEST_ASSERT (source_info_p->source_range_length == 14);\n  jerry_source_info_free (source_info_p);\n  jerry_value_free (value);\n\n  source_p = TEST_STRING_LITERAL (\"(function f(a) { return 7 }).bind({})\");\n\n  value = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);\n  source_info_p = jerry_source_info (value);\n  TEST_ASSERT (source_info_p != NULL);\n  TEST_ASSERT (source_info_p->enabled_fields\n               == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE | JERRY_SOURCE_INFO_HAS_SOURCE_RANGE));\n  compare_string (source_info_p->source_code, source_p);\n  TEST_ASSERT (jerry_value_is_undefined (source_info_p->function_arguments));\n  TEST_ASSERT (source_info_p->source_range_start == 1);\n  TEST_ASSERT (source_info_p->source_range_length == 26);\n  jerry_source_info_free (source_info_p);\n  jerry_value_free (value);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-source-name.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic jerry_value_t\nsource_name_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                     const jerry_value_t args_p[], /**< argument list */\n                     const jerry_length_t args_count) /**< argument count */\n{\n  (void) call_info_p;\n\n  jerry_value_t undefined_value = jerry_undefined ();\n  jerry_value_t source_name = jerry_source_name (args_count > 0 ? args_p[0] : undefined_value);\n  jerry_value_free (undefined_value);\n\n  return source_name;\n} /* source_name_handler */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_LINE_INFO))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"Line info support is disabled!\\n\");\n    return 0;\n  }\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global = jerry_current_realm ();\n\n  /* Register the \"sourceName\" method. */\n  {\n    jerry_value_t func = jerry_function_external (source_name_handler);\n    jerry_value_t name = jerry_string_sz (\"sourceName\");\n    jerry_value_t result = jerry_object_set (global, name, func);\n    jerry_value_free (result);\n    jerry_value_free (name);\n    jerry_value_free (func);\n  }\n\n  jerry_value_free (global);\n\n  jerry_parse_options_t parse_options;\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n\n  const char *source_1 = (\"function f1 () {\\n\"\n                          \"  if (sourceName() !== 'demo1.js') return false; \\n\"\n                          \"  if (sourceName(f1) !== 'demo1.js') return false; \\n\"\n                          \"  if (sourceName(5) !== '<anonymous>') return false; \\n\"\n                          \"  return f1; \\n\"\n                          \"} \\n\"\n                          \"f1();\");\n\n  parse_options.source_name = jerry_string_sz (\"demo1.js\");\n\n  jerry_value_t program = jerry_parse ((const jerry_char_t *) source_1, strlen (source_1), &parse_options);\n  TEST_ASSERT (!jerry_value_is_exception (program));\n\n  jerry_value_t run_result = jerry_run (program);\n  TEST_ASSERT (!jerry_value_is_exception (run_result));\n  TEST_ASSERT (jerry_value_is_object (run_result));\n\n  jerry_value_t source_name_value = jerry_source_name (run_result);\n  jerry_value_t compare_result =\n    jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, source_name_value, parse_options.source_name);\n  TEST_ASSERT (jerry_value_is_true (compare_result));\n\n  jerry_value_free (compare_result);\n  jerry_value_free (source_name_value);\n  jerry_value_free (parse_options.source_name);\n\n  jerry_value_free (run_result);\n  jerry_value_free (program);\n\n  const char *source_2 = (\"function f2 () { \\n\"\n                          \"  if (sourceName() !== 'demo2.js') return false; \\n\"\n                          \"  if (sourceName(f2) !== 'demo2.js') return false; \\n\"\n                          \"  if (sourceName(f1) !== 'demo1.js') return false; \\n\"\n                          \"  if (sourceName(Object.prototype) !== '<anonymous>') return false; \\n\"\n                          \"  if (sourceName(Function) !== '<anonymous>') return false; \\n\"\n                          \"  return f2; \\n\"\n                          \"} \\n\"\n                          \"f2(); \\n\");\n\n  parse_options.source_name = jerry_string_sz (\"demo2.js\");\n\n  program = jerry_parse ((const jerry_char_t *) source_2, strlen (source_2), &parse_options);\n  TEST_ASSERT (!jerry_value_is_exception (program));\n\n  run_result = jerry_run (program);\n  TEST_ASSERT (!jerry_value_is_exception (run_result));\n  TEST_ASSERT (jerry_value_is_object (run_result));\n\n  source_name_value = jerry_source_name (run_result);\n  compare_result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, source_name_value, parse_options.source_name);\n  TEST_ASSERT (jerry_value_is_true (compare_result));\n\n  jerry_value_free (compare_result);\n  jerry_value_free (source_name_value);\n  jerry_value_free (parse_options.source_name);\n\n  jerry_value_free (run_result);\n  jerry_value_free (program);\n  if (jerry_feature_enabled (JERRY_FEATURE_MODULE))\n  {\n    jerry_value_t anon = jerry_string_sz (\"<anonymous>\");\n    const char *source_3 = \"\";\n\n    parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;\n    parse_options.source_name = jerry_string_sz (\"demo3.js\");\n\n    program = jerry_parse ((const jerry_char_t *) source_3, strlen (source_3), &parse_options);\n    TEST_ASSERT (!jerry_value_is_exception (program));\n\n    source_name_value = jerry_source_name (program);\n    compare_result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, source_name_value, parse_options.source_name);\n    TEST_ASSERT (jerry_value_is_true (compare_result));\n\n    jerry_value_free (compare_result);\n    jerry_value_free (source_name_value);\n\n    run_result = jerry_module_link (program, NULL, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (run_result));\n\n    source_name_value = jerry_source_name (run_result);\n    compare_result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, source_name_value, anon);\n    TEST_ASSERT (jerry_value_is_true (compare_result));\n\n    jerry_value_free (compare_result);\n    jerry_value_free (source_name_value);\n    jerry_value_free (run_result);\n\n    run_result = jerry_module_evaluate (program);\n    TEST_ASSERT (!jerry_value_is_exception (run_result));\n\n    source_name_value = jerry_source_name (run_result);\n    compare_result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, source_name_value, anon);\n    TEST_ASSERT (jerry_value_is_true (compare_result));\n\n    jerry_value_free (compare_result);\n    jerry_value_free (source_name_value);\n    jerry_value_free (run_result);\n    jerry_value_free (program);\n    jerry_value_free (parse_options.source_name);\n  }\n  const char *source_4 = (\"function f(){} \\n\"\n                          \"f.bind().bind();\");\n\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"demo4.js\");\n\n  program = jerry_parse ((const jerry_char_t *) source_4, strlen (source_4), &parse_options);\n  TEST_ASSERT (!jerry_value_is_exception (program));\n\n  run_result = jerry_run (program);\n  TEST_ASSERT (!jerry_value_is_exception (run_result));\n  TEST_ASSERT (jerry_value_is_object (run_result));\n\n  source_name_value = jerry_source_name (run_result);\n  compare_result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, source_name_value, parse_options.source_name);\n  TEST_ASSERT (jerry_value_is_true (compare_result));\n  jerry_value_free (compare_result);\n\n  jerry_value_free (source_name_value);\n  jerry_value_free (parse_options.source_name);\n  jerry_value_free (run_result);\n  jerry_value_free (program);\n\n  const char *source_5 = \"\";\n\n  parse_options.options = JERRY_PARSE_HAS_USER_VALUE | JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.user_value = jerry_object ();\n  parse_options.source_name = jerry_string_sz (\"demo5.js\");\n\n  program = jerry_parse ((const jerry_char_t *) source_5, strlen (source_5), &parse_options);\n  TEST_ASSERT (!jerry_value_is_exception (program));\n\n  source_name_value = jerry_source_name (program);\n  compare_result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, source_name_value, parse_options.source_name);\n  TEST_ASSERT (jerry_value_is_true (compare_result));\n\n  jerry_value_free (source_name_value);\n  jerry_value_free (compare_result);\n  jerry_value_free (parse_options.user_value);\n  jerry_value_free (parse_options.source_name);\n  jerry_value_free (program);\n\n  const char *source_6 = \"(class {})\";\n\n  parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;\n  parse_options.source_name = jerry_string_sz (\"demo6.js\");\n\n  program = jerry_parse ((const jerry_char_t *) source_6, strlen (source_6), &parse_options);\n  if (!jerry_value_is_exception (program))\n  {\n    source_name_value = jerry_source_name (program);\n    compare_result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, source_name_value, parse_options.source_name);\n    TEST_ASSERT (jerry_value_is_true (compare_result));\n\n    jerry_value_free (source_name_value);\n    jerry_value_free (compare_result);\n  }\n\n  jerry_value_free (parse_options.source_name);\n  jerry_value_free (program);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-special-proxy.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic jerry_value_t\ncreate_special_proxy_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                              const jerry_value_t args_p[], /**< argument list */\n                              const jerry_length_t args_count) /**< argument count */\n{\n  JERRY_UNUSED (call_info_p);\n\n  if (args_count < 2)\n  {\n    return jerry_undefined ();\n  }\n\n  return jerry_proxy_custom (args_p[0], args_p[1], JERRY_PROXY_SKIP_RESULT_VALIDATION);\n} /* create_special_proxy_handler */\n\nstatic void\nrun_eval (const char *source_p)\n{\n  jerry_value_t result = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);\n\n  TEST_ASSERT (!jerry_value_is_exception (result));\n  jerry_value_free (result);\n} /* run_eval */\n\n/**\n * Unit test's main function.\n */\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_PROXY))\n  {\n    printf (\"Skipping test, Proxy not enabled\\n\");\n    return 0;\n  }\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t global = jerry_current_realm ();\n\n  jerry_value_t function = jerry_function_external (create_special_proxy_handler);\n  jerry_value_t name = jerry_string_sz (\"create_special_proxy\");\n  jerry_value_t result = jerry_object_set (global, name, function);\n  TEST_ASSERT (!jerry_value_is_exception (result));\n\n  jerry_value_free (result);\n  jerry_value_free (name);\n  jerry_value_free (function);\n\n  jerry_value_free (global);\n\n  run_eval (\"function assert (v) {\\n\"\n            \"  if (v !== true)\\n\"\n            \"     throw 'Assertion failed!'\\n\"\n            \"}\");\n\n  /* These tests fail unless JERRY_PROXY_SKIP_RESULT_VALIDATION is set. */\n\n  run_eval (\"var o = {}\\n\"\n            \"Object.preventExtensions(o)\\n\"\n            \"var proxy = create_special_proxy(o, {\\n\"\n            \"  getPrototypeOf(target) { return Array.prototype }\\n\"\n            \"})\\n\"\n            \"assert(Object.getPrototypeOf(proxy) === Array.prototype)\");\n\n  run_eval (\"var o = {}\\n\"\n            \"Object.preventExtensions(o)\\n\"\n            \"var proxy = create_special_proxy(o, {\\n\"\n            \"  setPrototypeOf(target, proto) { return true }\\n\"\n            \"})\\n\"\n            \"Object.setPrototypeOf(proxy, Array.prototype)\");\n\n  run_eval (\"var o = {}\\n\"\n            \"var proxy = create_special_proxy(o, {\\n\"\n            \"  isExtensible(target) { return false }\\n\"\n            \"})\\n\"\n            \"assert(Object.isExtensible(proxy) === false)\");\n\n  run_eval (\"var o = {}\\n\"\n            \"var proxy = create_special_proxy(o, {\\n\"\n            \"  preventExtensions(target) { return true }\\n\"\n            \"})\\n\"\n            \"Object.preventExtensions(proxy)\");\n\n  run_eval (\"var o = {}\\n\"\n            \"Object.defineProperty(o, 'prop', { value:4, enumerable:true })\\n\"\n            \"var proxy = create_special_proxy(o, {\\n\"\n            \"  getOwnPropertyDescriptor(target, key) {\\n\"\n            \"    return { value:5, configurable:true, writable:true }\\n\"\n            \"  }\\n\"\n            \"})\\n\"\n            \"var desc = Object.getOwnPropertyDescriptor(proxy, 'prop')\\n\"\n            \"assert(desc.value === 5)\\n\"\n            \"assert(desc.configurable === true)\\n\"\n            \"assert(desc.enumerable === false)\\n\"\n            \"assert(desc.writable === true)\\n\");\n\n  run_eval (\"var o = {}\\n\"\n            \"Object.defineProperty(o, 'prop', { get() {} })\\n\"\n            \"var proxy = create_special_proxy(o, {\\n\"\n            \"  defineProperty(target, key, descriptor) { return true }\\n\"\n            \"})\\n\"\n            \"Object.defineProperty(proxy, 'prop', { value:5 })\");\n\n  run_eval (\"var o = {}\\n\"\n            \"Object.defineProperty(o, 'prop', { value:4 })\\n\"\n            \"var proxy = create_special_proxy(o, {\\n\"\n            \"  has(target, key) { return false }\\n\"\n            \"})\\n\"\n            \"assert(!Reflect.has(proxy, 'prop'))\");\n\n  run_eval (\"var o = {}\\n\"\n            \"Object.defineProperty(o, 'prop', { value:4 })\\n\"\n            \"var proxy = create_special_proxy(o, {\\n\"\n            \"  get(target, key) { return 5 }\\n\"\n            \"})\\n\"\n            \"assert(proxy.prop === 5)\");\n\n  run_eval (\"var o = {}\\n\"\n            \"Object.defineProperty(o, 'prop', { value:4 })\\n\"\n            \"var proxy = create_special_proxy(o, {\\n\"\n            \"  set(target, key, value) { return true }\\n\"\n            \"})\\n\"\n            \"proxy.prop = 8\");\n\n  run_eval (\"var o = {}\\n\"\n            \"Object.defineProperty(o, 'prop', { value:4 })\\n\"\n            \"var proxy = create_special_proxy(o, {\\n\"\n            \"  deleteProperty(target, key) { return true }\\n\"\n            \"})\\n\"\n            \"assert(delete proxy.prop)\");\n\n  run_eval (\"var o = {}\\n\"\n            \"Object.defineProperty(o, 'prop', { value:4 })\\n\"\n            \"var proxy = create_special_proxy(o, {\\n\"\n            \"  ownKeys(target) { return [] }\\n\"\n            \"})\\n\"\n            \"Object.keys(proxy)\");\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-string-to-number.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n\n#include \"test-common.h\"\n\n/**\n * Unit test's main function.\n */\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  const jerry_char_t *strings[] = {\n    (const jerry_char_t *) \"1\",         (const jerry_char_t *) \"0.5\",       (const jerry_char_t *) \"12345\",\n    (const jerry_char_t *) \"1e-45\",     (const jerry_char_t *) \"-2.5e+38\",  (const jerry_char_t *) \"-2.5e38\",\n    (const jerry_char_t *) \"- 2.5e+38\", (const jerry_char_t *) \"-2 .5e+38\", (const jerry_char_t *) \"-2. 5e+38\",\n    (const jerry_char_t *) \"-2.5e+ 38\", (const jerry_char_t *) \"-2.5 e+38\", (const jerry_char_t *) \"-2.5e +38\",\n    (const jerry_char_t *) \"NaN\",       (const jerry_char_t *) \"abc\",       (const jerry_char_t *) \"   Infinity  \",\n    (const jerry_char_t *) \"-Infinity\", (const jerry_char_t *) \"0\",         (const jerry_char_t *) \"0\",\n  };\n\n  const ecma_number_t nums[] = { (ecma_number_t) 1.0,       (ecma_number_t) 0.5,      (ecma_number_t) 12345.0,\n                                 (ecma_number_t) 1.0e-45,   (ecma_number_t) -2.5e+38, (ecma_number_t) -2.5e+38,\n                                 (ecma_number_t) NAN,       (ecma_number_t) NAN,      (ecma_number_t) NAN,\n                                 (ecma_number_t) NAN,       (ecma_number_t) NAN,      (ecma_number_t) NAN,\n                                 (ecma_number_t) NAN,       (ecma_number_t) NAN,      (ecma_number_t) INFINITY,\n                                 (ecma_number_t) -INFINITY, (ecma_number_t) + 0.0,    (ecma_number_t) -0.0 };\n\n  for (uint32_t i = 0; i < sizeof (nums) / sizeof (nums[0]); i++)\n  {\n    ecma_number_t num = ecma_utf8_string_to_number (strings[i], lit_zt_utf8_string_size (strings[i]), 0);\n\n    if (num != nums[i] && (!ecma_number_is_nan (num) || !ecma_number_is_nan (nums[i])))\n    {\n      return 1;\n    }\n  }\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-stringbuilder.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-helpers.h\"\n#include \"ecma-init-finalize.h\"\n\n#include \"lit-char-helpers.h\"\n#include \"lit-strings.h\"\n#include \"test-common.h\"\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jmem_init ();\n  ecma_init ();\n\n  {\n    static const lit_utf8_byte_t string_data[] = \"A simple string\";\n\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    ecma_stringbuilder_append_raw (&builder, string_data, sizeof (string_data) - 1);\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    ecma_string_t *str_p = ecma_new_ecma_string_from_ascii (string_data, sizeof (string_data) - 1);\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (str_p);\n  }\n\n  {\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    ecma_stringbuilder_append_magic (&builder, LIT_MAGIC_STRING_STRING);\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    ecma_string_t *str_p = ecma_get_magic_string (LIT_MAGIC_STRING_STRING);\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n  }\n\n  {\n    static const lit_utf8_byte_t string_data[] = \"a\";\n\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_LOWERCASE_A);\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    ecma_string_t *str_p = ecma_new_ecma_string_from_ascii (string_data, sizeof (string_data) - 1);\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (str_p);\n  }\n\n  {\n    static const lit_utf8_byte_t string_data[] = \"A simple string\";\n    ecma_string_t *str_p = ecma_new_ecma_string_from_ascii (string_data, sizeof (string_data) - 1);\n\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    ecma_stringbuilder_append (&builder, str_p);\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (str_p);\n  }\n\n  {\n    ecma_string_t *str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n  }\n\n  {\n    static const lit_utf8_byte_t string_data[] = \"abc\";\n\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_LOWERCASE_A);\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_LOWERCASE_B);\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_LOWERCASE_C);\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    ecma_string_t *str_p = ecma_new_ecma_string_from_ascii (string_data, sizeof (string_data) - 1);\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (str_p);\n  }\n\n  {\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_1);\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_2);\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_3);\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    ecma_string_t *str_p = ecma_new_ecma_string_from_uint32 (123);\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (str_p);\n  }\n\n  {\n    static const lit_utf8_byte_t string_data[] = \"abc\";\n    ecma_string_t *uint_str_p = ecma_new_ecma_string_from_uint32 (234);\n\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_1);\n    ecma_stringbuilder_append_raw (&builder, string_data, sizeof (string_data) - 1);\n    ecma_stringbuilder_append (&builder, uint_str_p);\n    ecma_stringbuilder_append_magic (&builder, LIT_MAGIC_STRING_STRING);\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    static const lit_utf8_byte_t expected_data[] = \"1abc234string\";\n    ecma_string_t *str_p = ecma_new_ecma_string_from_ascii (expected_data, sizeof (expected_data) - 1);\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (str_p);\n  }\n\n  {\n    static const lit_utf8_byte_t string_data[] = \"abc\";\n    ecma_string_t *uint_str_p = ecma_new_ecma_string_from_uint32 (234);\n\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_1);\n    ecma_stringbuilder_append_raw (&builder, string_data, sizeof (string_data) - 1);\n    ecma_stringbuilder_append (&builder, uint_str_p);\n    ecma_stringbuilder_append_magic (&builder, LIT_MAGIC_STRING_STRING);\n    /* Test that we do not leak. */\n    ecma_stringbuilder_destroy (&builder);\n  }\n\n  {\n    static const lit_utf8_byte_t string_data[] = \"abcdefghijklmnop\";\n    const size_t count = UINT16_MAX / (sizeof (string_data) - 1) + 1;\n\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    for (size_t i = 0; i < count; i++)\n    {\n      ecma_stringbuilder_append_raw (&builder, string_data, sizeof (string_data) - 1);\n    }\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    ecma_string_t *expected_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n    for (size_t i = 0; i < count; i++)\n    {\n      expected_p =\n        ecma_append_chars_to_string (expected_p, string_data, sizeof (string_data) - 1, sizeof (string_data) - 1);\n    }\n\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, expected_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (expected_p);\n  }\n\n  {\n    static const lit_utf8_byte_t string_data[] = \"abc\";\n    ecma_string_t *uint_str_p = ecma_new_ecma_string_from_uint32 (234);\n\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    ecma_stringbuilder_append_char (&builder, LIT_CHAR_1);\n    ecma_stringbuilder_append_raw (&builder, string_data, sizeof (string_data) - 1);\n\n    ecma_string_t *another_string = ecma_new_ecma_string_from_ascii (string_data, sizeof (string_data) - 1);\n\n    ecma_stringbuilder_append (&builder, uint_str_p);\n    ecma_stringbuilder_append_magic (&builder, LIT_MAGIC_STRING_STRING);\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    static const lit_utf8_byte_t expected_data[] = \"1abc234string\";\n    ecma_string_t *str_p = ecma_new_ecma_string_from_ascii (expected_data, sizeof (expected_data) - 1);\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (str_p);\n    ecma_deref_ecma_string (another_string);\n  }\n\n  {\n    static const lit_utf8_byte_t string_data[] = \"abc\";\n    ecma_string_t *uint_str_p = ecma_new_ecma_string_from_uint32 (234);\n\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (uint_str_p);\n    ecma_stringbuilder_append_raw (&builder, string_data, sizeof (string_data) - 1);\n    ecma_stringbuilder_append_magic (&builder, LIT_MAGIC_STRING_STRING);\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    static const lit_utf8_byte_t expected_data[] = \"234abcstring\";\n    ecma_string_t *str_p = ecma_new_ecma_string_from_ascii (expected_data, sizeof (expected_data) - 1);\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (str_p);\n  }\n\n  {\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create ();\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    ecma_string_t *str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (str_p);\n  }\n\n  {\n    ecma_string_t *str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (str_p);\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (str_p);\n  }\n\n  {\n    ecma_string_t *str_p = ecma_get_magic_string (LIT_MAGIC_STRING_STRING);\n    ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (str_p);\n    ecma_string_t *result_p = ecma_stringbuilder_finalize (&builder);\n\n    TEST_ASSERT (ecma_compare_ecma_strings (result_p, str_p));\n    ecma_deref_ecma_string (result_p);\n    ecma_deref_ecma_string (str_p);\n  }\n\n  ecma_finalize ();\n  jmem_finalize ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-strings.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"ecma-helpers.h\"\n#include \"ecma-init-finalize.h\"\n\n#include \"lit-strings.h\"\n#include \"test-common.h\"\n\n/* Iterations count. */\n#define test_iters (1024)\n\n/* Sub iterations count. */\n#define test_subiters (128)\n\n/* Max bytes in string. */\n#define max_bytes_in_string      (65 * 1024)\n#define max_code_units_in_string (max_bytes_in_string)\n\ntypedef enum\n{\n  CESU8_ANY_SIZE,\n  CESU8_ONE_BYTE,\n  CESU8_TWO_BYTES,\n  CESU8_THREE_BYTES,\n} utf8_char_size;\n\nstatic lit_utf8_size_t\ngenerate_cesu8_char (utf8_char_size char_size, lit_utf8_byte_t *buf)\n{\n  TEST_ASSERT (char_size >= 0 && char_size <= LIT_CESU8_MAX_BYTES_IN_CODE_UNIT);\n  lit_code_point_t code_point = (lit_code_point_t) rand ();\n\n  if (char_size == 1)\n  {\n    code_point %= LIT_UTF8_1_BYTE_CODE_POINT_MAX;\n  }\n  else if (char_size == 2)\n  {\n    code_point =\n      LIT_UTF8_2_BYTE_CODE_POINT_MIN + code_point % (LIT_UTF8_2_BYTE_CODE_POINT_MAX - LIT_UTF8_2_BYTE_CODE_POINT_MIN);\n  }\n  else if (char_size == 3)\n  {\n    code_point =\n      LIT_UTF8_3_BYTE_CODE_POINT_MIN + code_point % (LIT_UTF8_3_BYTE_CODE_POINT_MAX - LIT_UTF8_3_BYTE_CODE_POINT_MIN);\n  }\n  else\n  {\n    code_point %= LIT_UTF8_3_BYTE_CODE_POINT_MAX;\n  }\n\n  if (code_point >= LIT_UTF16_HIGH_SURROGATE_MIN && code_point <= LIT_UTF16_LOW_SURROGATE_MAX)\n  {\n    code_point = LIT_UTF16_HIGH_SURROGATE_MIN - 1;\n  }\n\n  return lit_code_unit_to_utf8 ((ecma_char_t) code_point, buf);\n} /* generate_cesu8_char */\n\nstatic lit_utf8_size_t\ngenerate_cesu8_string (lit_utf8_byte_t *buf_p, lit_utf8_size_t buf_size)\n{\n  lit_utf8_size_t length = 0;\n\n  lit_utf8_size_t size = 0;\n  while (size < buf_size)\n  {\n    const utf8_char_size char_size =\n      (((buf_size - size) > LIT_CESU8_MAX_BYTES_IN_CODE_UNIT) ? CESU8_ANY_SIZE : (utf8_char_size) (buf_size - size));\n\n    lit_utf8_size_t bytes_generated = generate_cesu8_char (char_size, buf_p);\n\n    TEST_ASSERT (lit_is_valid_cesu8_string (buf_p, bytes_generated));\n\n    size += bytes_generated;\n    buf_p += bytes_generated;\n    length++;\n  }\n\n  TEST_ASSERT (size == buf_size);\n\n  return length;\n} /* generate_cesu8_string */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jmem_init ();\n  ecma_init ();\n\n  lit_utf8_byte_t cesu8_string[max_bytes_in_string];\n  ecma_char_t code_units[max_code_units_in_string];\n  const lit_utf8_byte_t *saved_positions[max_code_units_in_string];\n\n  for (int i = 0; i < test_iters; i++)\n  {\n    lit_utf8_size_t cesu8_string_size = (i == 0) ? 0 : (lit_utf8_size_t) (rand () % max_bytes_in_string);\n    lit_utf8_size_t length = generate_cesu8_string (cesu8_string, cesu8_string_size);\n\n    ecma_string_t *char_collection_string_p = ecma_new_ecma_string_from_utf8 (cesu8_string, cesu8_string_size);\n    lit_utf8_size_t char_collection_len = ecma_string_get_length (char_collection_string_p);\n    TEST_ASSERT (char_collection_len == length);\n    ecma_deref_ecma_string (char_collection_string_p);\n\n    TEST_ASSERT (lit_utf8_string_length (cesu8_string, cesu8_string_size) == length);\n\n    const lit_utf8_byte_t *curr_p = cesu8_string;\n    const lit_utf8_byte_t *end_p = cesu8_string + cesu8_string_size;\n\n    lit_utf8_size_t calculated_length = 0;\n    lit_utf8_size_t code_units_count = 0;\n\n    while (curr_p < end_p)\n    {\n      code_units[code_units_count] = lit_cesu8_peek_next (curr_p);\n      saved_positions[code_units_count] = curr_p;\n      code_units_count++;\n      calculated_length++;\n\n      lit_utf8_incr (&curr_p);\n    }\n\n    TEST_ASSERT (length == calculated_length);\n\n    if (code_units_count > 0)\n    {\n      for (int j = 0; j < test_subiters; j++)\n      {\n        lit_utf8_size_t index = (lit_utf8_size_t) rand () % code_units_count;\n        curr_p = saved_positions[index];\n        TEST_ASSERT (lit_cesu8_peek_next (curr_p) == code_units[index]);\n      }\n    }\n\n    curr_p = (lit_utf8_byte_t *) end_p;\n    while (curr_p > cesu8_string)\n    {\n      TEST_ASSERT (code_units_count > 0);\n      calculated_length--;\n      TEST_ASSERT (code_units[calculated_length] == lit_cesu8_peek_prev (curr_p));\n      lit_utf8_decr (&curr_p);\n    }\n\n    TEST_ASSERT (calculated_length == 0);\n\n    while (curr_p < end_p)\n    {\n      ecma_char_t code_unit = lit_cesu8_read_next (&curr_p);\n      TEST_ASSERT (code_unit == code_units[calculated_length]);\n      calculated_length++;\n    }\n\n    TEST_ASSERT (length == calculated_length);\n\n    while (curr_p > cesu8_string)\n    {\n      TEST_ASSERT (code_units_count > 0);\n      calculated_length--;\n      TEST_ASSERT (code_units[calculated_length] == lit_cesu8_read_prev (&curr_p));\n    }\n\n    TEST_ASSERT (calculated_length == 0);\n  }\n\n  /* Overlong-encoded code point */\n  lit_utf8_byte_t invalid_cesu8_string_1[] = { 0xC0, 0x82 };\n  TEST_ASSERT (!lit_is_valid_cesu8_string (invalid_cesu8_string_1, sizeof (invalid_cesu8_string_1)));\n\n  /* Overlong-encoded code point */\n  lit_utf8_byte_t invalid_cesu8_string_2[] = { 0xE0, 0x80, 0x81 };\n  TEST_ASSERT (!lit_is_valid_cesu8_string (invalid_cesu8_string_2, sizeof (invalid_cesu8_string_2)));\n\n  /* Pair of surrogates: 0xD901 0xDFF0 which encode Unicode character 0x507F0 */\n  lit_utf8_byte_t invalid_cesu8_string_3[] = { 0xED, 0xA4, 0x81, 0xED, 0xBF, 0xB0 };\n  TEST_ASSERT (lit_is_valid_cesu8_string (invalid_cesu8_string_3, sizeof (invalid_cesu8_string_3)));\n\n  /* Isolated high surrogate 0xD901 */\n  lit_utf8_byte_t valid_utf8_string_1[] = { 0xED, 0xA4, 0x81 };\n  TEST_ASSERT (lit_is_valid_cesu8_string (valid_utf8_string_1, sizeof (valid_utf8_string_1)));\n\n  lit_utf8_byte_t res_buf[3];\n  lit_utf8_size_t res_size;\n\n  res_size = lit_code_unit_to_utf8 (0x73, res_buf);\n  TEST_ASSERT (res_size == 1);\n  TEST_ASSERT (res_buf[0] == 0x73);\n\n  res_size = lit_code_unit_to_utf8 (0x41A, res_buf);\n  TEST_ASSERT (res_size == 2);\n  TEST_ASSERT (res_buf[0] == 0xD0);\n  TEST_ASSERT (res_buf[1] == 0x9A);\n\n  res_size = lit_code_unit_to_utf8 (0xD7FF, res_buf);\n  TEST_ASSERT (res_size == 3);\n  TEST_ASSERT (res_buf[0] == 0xED);\n  TEST_ASSERT (res_buf[1] == 0x9F);\n  TEST_ASSERT (res_buf[2] == 0xBF);\n\n  /* Ascii string */\n  lit_utf8_byte_t utf8_string_ascii[] = { 'G', 'o', 'o', 'd', 'b', 'y', 'e' };\n  TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_ascii, sizeof (utf8_string_ascii), true));\n\n  /* Control character */\n  lit_utf8_byte_t utf8_string_control[] = { 0x00 };\n  TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_control, sizeof (utf8_string_control), true));\n\n  /* 3 byte characters */\n  lit_utf8_byte_t utf8_string_3byte[] = { 0xe4, 0xbd, 0xa0, 0xe5, 0xa5, 0xbd, 0xe4, 0xb8, 0x96, 0xe7, 0x95, 0x8c };\n  TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_3byte, sizeof (utf8_string_3byte), true));\n\n  /* 4 byte characters */\n  lit_utf8_byte_t utf8_string_4byte[] = { 0xf0, 0x90, 0x80, 0x80, 0xf0, 0x9f, 0xa7, 0xbf };\n  TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_4byte, sizeof (utf8_string_4byte), true));\n\n  /* Invalid continuation byte */\n  lit_utf8_byte_t utf8_string_invalid[] = { 0xa0 };\n  TEST_ASSERT (!lit_is_valid_utf8_string (utf8_string_invalid, sizeof (utf8_string_invalid), true));\n\n  /* Isolated high surrogate */\n  lit_utf8_byte_t utf8_string_high[] = { 0xed, 0xa0, 0x80 };\n  TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_high, sizeof (utf8_string_high), true));\n\n  /* Isolated low surrogate */\n  lit_utf8_byte_t utf8_string_low[] = { 0xed, 0xbf, 0xbf };\n  TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_low, sizeof (utf8_string_low), true));\n\n  /* Correct pair of surrogates in strict*/\n  lit_utf8_byte_t utf8_string_surrogates_strict[] = { 0xed, 0xa0, 0x80, 0xed, 0xbf, 0xbf };\n  TEST_ASSERT (!lit_is_valid_utf8_string (utf8_string_surrogates_strict, sizeof (utf8_string_surrogates_strict), true));\n\n  /* Correct pair of surrogates*/\n  lit_utf8_byte_t utf8_string_surrogates[] = { 0xed, 0xa0, 0x80, 0xed, 0xbf, 0xbf };\n  TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_surrogates, sizeof (utf8_string_surrogates), false));\n\n  ecma_finalize ();\n  jmem_finalize ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-symbol.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\n/* foo string */\n#define STRING_FOO (\"foo\")\n\n/* bar string */\n#define STRING_BAR (\"bar\")\n\n/* Symbol(bar) desciptive string */\n#define SYMBOL_DESCIPTIVE_STRING_BAR \"Symbol(bar)\"\n\n/* bar string desciption */\n#define SYMBOL_DESCIPTION_BAR \"bar\"\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t object = jerry_object ();\n\n  /* Test for that each symbol is unique independently from their descriptor strings */\n  jerry_value_t symbol_desc_1 = jerry_string_sz (STRING_FOO);\n  jerry_value_t symbol_desc_2 = jerry_string_sz (STRING_FOO);\n\n  jerry_value_t symbol_1 = jerry_symbol_with_description (symbol_desc_1);\n  TEST_ASSERT (!jerry_value_is_exception (symbol_1));\n  TEST_ASSERT (jerry_value_is_symbol (symbol_1));\n\n  jerry_value_t symbol_2 = jerry_symbol_with_description (symbol_desc_2);\n  TEST_ASSERT (!jerry_value_is_exception (symbol_2));\n  TEST_ASSERT (jerry_value_is_symbol (symbol_2));\n\n  /* The descriptor strings are no longer needed */\n  jerry_value_free (symbol_desc_1);\n  jerry_value_free (symbol_desc_2);\n\n  jerry_value_t value_1 = jerry_number (1);\n  jerry_value_t value_2 = jerry_number (2);\n\n  jerry_value_t result_val = jerry_object_set (object, symbol_1, value_1);\n  TEST_ASSERT (jerry_value_is_boolean (result_val));\n  TEST_ASSERT (jerry_value_is_true (jerry_object_has (object, symbol_1)));\n  TEST_ASSERT (jerry_value_is_true (jerry_object_has_own (object, symbol_1)));\n\n  result_val = jerry_object_set (object, symbol_2, value_2);\n  TEST_ASSERT (jerry_value_is_boolean (result_val));\n  TEST_ASSERT (jerry_value_is_true (jerry_object_has (object, symbol_2)));\n  TEST_ASSERT (jerry_value_is_true (jerry_object_has_own (object, symbol_2)));\n\n  jerry_value_t get_value_1 = jerry_object_get (object, symbol_1);\n  TEST_ASSERT (jerry_value_as_number (get_value_1) == jerry_value_as_number (value_1));\n  jerry_value_free (get_value_1);\n\n  jerry_value_t get_value_2 = jerry_object_get (object, symbol_2);\n  TEST_ASSERT (jerry_value_as_number (get_value_2) == jerry_value_as_number (value_2));\n  jerry_value_free (get_value_2);\n\n  /* Test delete / has_{own}_property */\n  TEST_ASSERT (jerry_value_is_true (jerry_object_delete (object, symbol_1)));\n  TEST_ASSERT (!jerry_value_is_true (jerry_object_has (object, symbol_1)));\n  TEST_ASSERT (!jerry_value_is_true (jerry_object_has_own (object, symbol_1)));\n\n  jerry_value_free (value_1);\n  jerry_value_free (symbol_1);\n\n  /* Test {get, define}_own_property_descriptor */\n  jerry_property_descriptor_t prop_desc;\n  TEST_ASSERT (jerry_object_get_own_prop (object, symbol_2, &prop_desc));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED);\n  TEST_ASSERT (value_2 == prop_desc.value);\n  TEST_ASSERT (jerry_value_as_number (value_2) == jerry_value_as_number (prop_desc.value));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_WRITABLE);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_GET_DEFINED));\n  TEST_ASSERT (jerry_value_is_undefined (prop_desc.getter));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_SET_DEFINED));\n  TEST_ASSERT (jerry_value_is_undefined (prop_desc.setter));\n  jerry_property_descriptor_free (&prop_desc);\n\n  /* Modify the descriptor fields */\n  prop_desc = jerry_property_descriptor ();\n  jerry_value_t value_3 = jerry_string_sz (STRING_BAR);\n\n  prop_desc.flags |= JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE_DEFINED\n                     | JERRY_PROP_IS_CONFIGURABLE_DEFINED;\n  prop_desc.value = jerry_value_copy (value_3);\n  TEST_ASSERT (jerry_value_is_true (jerry_object_define_own_prop (object, symbol_2, &prop_desc)));\n  jerry_property_descriptor_free (&prop_desc);\n\n  /* Check the modified fields */\n  TEST_ASSERT (jerry_object_get_own_prop (object, symbol_2, &prop_desc));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED);\n  TEST_ASSERT (value_3 == prop_desc.value);\n  TEST_ASSERT (jerry_value_is_string (prop_desc.value));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_WRITABLE_DEFINED);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_WRITABLE));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE_DEFINED);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_ENUMERABLE));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_GET_DEFINED));\n  TEST_ASSERT (jerry_value_is_undefined (prop_desc.getter));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_SET_DEFINED));\n  TEST_ASSERT (jerry_value_is_undefined (prop_desc.setter));\n  jerry_property_descriptor_free (&prop_desc);\n\n  jerry_value_free (value_3);\n  jerry_value_free (value_2);\n  jerry_value_free (symbol_2);\n  jerry_value_free (object);\n\n  /* Test creating symbol with a symbol description */\n  jerry_value_t empty_symbol_desc = jerry_string_sz (\"\");\n\n  jerry_value_t empty_symbol = jerry_symbol_with_description (empty_symbol_desc);\n  TEST_ASSERT (!jerry_value_is_exception (empty_symbol));\n  TEST_ASSERT (jerry_value_is_symbol (empty_symbol));\n\n  jerry_value_free (empty_symbol_desc);\n\n  jerry_value_t symbol_symbol = jerry_symbol_with_description (empty_symbol);\n  TEST_ASSERT (!jerry_value_is_symbol (symbol_symbol));\n  TEST_ASSERT (jerry_value_is_exception (symbol_symbol));\n\n  jerry_value_t error_obj = jerry_exception_value (symbol_symbol, true);\n\n  TEST_ASSERT (jerry_error_type (error_obj) == JERRY_ERROR_TYPE);\n\n  jerry_value_free (error_obj);\n  jerry_value_free (empty_symbol);\n\n  /* Test symbol to string operation with symbol argument */\n  jerry_value_t bar_symbol_desc = jerry_string_sz (STRING_BAR);\n\n  jerry_value_t bar_symbol = jerry_symbol_with_description (bar_symbol_desc);\n  TEST_ASSERT (!jerry_value_is_exception (bar_symbol));\n  TEST_ASSERT (jerry_value_is_symbol (bar_symbol));\n\n  jerry_value_free (bar_symbol_desc);\n\n  jerry_value_t bar_symbol_string = jerry_symbol_descriptive_string (bar_symbol);\n  TEST_ASSERT (jerry_value_is_string (bar_symbol_string));\n\n  jerry_size_t bar_symbol_string_size = jerry_string_size (bar_symbol_string, JERRY_ENCODING_CESU8);\n  TEST_ASSERT (bar_symbol_string_size == (sizeof (SYMBOL_DESCIPTIVE_STRING_BAR) - 1));\n  JERRY_VLA (jerry_char_t, str_buff, bar_symbol_string_size);\n\n  jerry_string_to_buffer (bar_symbol_string, JERRY_ENCODING_CESU8, str_buff, bar_symbol_string_size);\n  TEST_ASSERT (memcmp (str_buff, SYMBOL_DESCIPTIVE_STRING_BAR, sizeof (SYMBOL_DESCIPTIVE_STRING_BAR) - 1) == 0);\n\n  jerry_value_free (bar_symbol_string);\n\n  /* Test symbol get description operation with string description */\n  bar_symbol_string = jerry_symbol_description (bar_symbol);\n  TEST_ASSERT (jerry_value_is_string (bar_symbol_string));\n\n  bar_symbol_string_size = jerry_string_size (bar_symbol_string, JERRY_ENCODING_CESU8);\n  TEST_ASSERT (bar_symbol_string_size == (sizeof (SYMBOL_DESCIPTION_BAR) - 1));\n\n  jerry_string_to_buffer (bar_symbol_string, JERRY_ENCODING_CESU8, str_buff, bar_symbol_string_size);\n  TEST_ASSERT (memcmp (str_buff, STRING_BAR, sizeof (SYMBOL_DESCIPTION_BAR) - 1) == 0);\n\n  jerry_value_free (bar_symbol_string);\n  jerry_value_free (bar_symbol);\n\n  /* Test symbol get description operation with undefined description */\n  jerry_value_t undefined_value = jerry_undefined ();\n  jerry_value_t undefined_symbol = jerry_symbol_with_description (undefined_value);\n  jerry_value_free (undefined_value);\n  TEST_ASSERT (!jerry_value_is_exception (bar_symbol));\n  TEST_ASSERT (jerry_value_is_symbol (bar_symbol));\n\n  undefined_value = jerry_symbol_description (undefined_symbol);\n  TEST_ASSERT (jerry_value_is_undefined (undefined_value));\n  jerry_value_free (undefined_value);\n  jerry_value_free (undefined_symbol);\n\n  /* Test symbol to string operation with non-symbol argument */\n  jerry_value_t null_value = jerry_null ();\n  jerry_value_t to_string_value = jerry_symbol_descriptive_string (null_value);\n  TEST_ASSERT (jerry_value_is_exception (to_string_value));\n\n  error_obj = jerry_exception_value (to_string_value, true);\n\n  TEST_ASSERT (jerry_error_type (error_obj) == JERRY_ERROR_TYPE);\n\n  jerry_value_free (error_obj);\n  jerry_value_free (null_value);\n\n  const jerry_char_t obj_src[] = \"\"\n                                 \"({\"\n                                 \"  [Symbol.asyncIterator]: 1,\"\n                                 \"  [Symbol.hasInstance]: 2,\"\n                                 \"  [Symbol.isConcatSpreadable]: 3,\"\n                                 \"  [Symbol.iterator]: 4,\"\n                                 \"  [Symbol.match]: 5,\"\n                                 \"  [Symbol.replace]: 6,\"\n                                 \"  [Symbol.search]: 7,\"\n                                 \"  [Symbol.species]: 8,\"\n                                 \"  [Symbol.split]: 9,\"\n                                 \"  [Symbol.toPrimitive]: 10,\"\n                                 \"  [Symbol.toStringTag]: 11,\"\n                                 \"  [Symbol.unscopables]: 12,\"\n                                 \"  [Symbol.matchAll]: 13,\"\n                                 \"})\";\n\n  const char *symbols[] = {\n    \"asyncIterator\", \"hasInstance\", \"isConcatSpreadable\", \"iterator\",    \"match\",       \"replace\",  \"search\",\n    \"species\",       \"split\",       \"toPrimitive\",        \"toStringTag\", \"unscopables\", \"matchAll\",\n  };\n\n  jerry_value_t obj = jerry_eval (obj_src, sizeof (obj_src) - 1, JERRY_PARSE_NO_OPTS);\n  TEST_ASSERT (jerry_value_is_object (obj));\n\n  jerry_value_t global_obj = jerry_current_realm ();\n  jerry_value_t symbol_str = jerry_string_sz (\"Symbol\");\n  jerry_value_t builtin_symbol = jerry_object_get (global_obj, symbol_str);\n  TEST_ASSERT (jerry_value_is_object (builtin_symbol));\n\n  double expected = 1.0;\n  uint32_t prop_index = 0;\n\n  for (jerry_well_known_symbol_t id = JERRY_SYMBOL_ASYNC_ITERATOR; id <= JERRY_SYMBOL_MATCH_ALL;\n       id++, expected++, prop_index++)\n  {\n    jerry_value_t well_known_symbol = jerry_symbol (id);\n\n    jerry_value_t prop_str = jerry_string_sz (symbols[prop_index]);\n    jerry_value_t current_global_symbol = jerry_object_get (builtin_symbol, prop_str);\n    jerry_value_free (prop_str);\n\n    jerry_value_t relation = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, well_known_symbol, current_global_symbol);\n\n    TEST_ASSERT (jerry_value_is_boolean (relation) && jerry_value_is_true (relation));\n\n    jerry_value_free (relation);\n\n    jerry_value_t prop_result_wn = jerry_object_get (obj, well_known_symbol);\n    jerry_value_t prop_result_global = jerry_object_get (obj, current_global_symbol);\n\n    TEST_ASSERT (jerry_value_is_number (prop_result_wn));\n    double number_wn = jerry_value_as_number (prop_result_wn);\n    TEST_ASSERT (number_wn == expected);\n\n    TEST_ASSERT (jerry_value_is_number (prop_result_global));\n    double number_global = jerry_value_as_number (prop_result_global);\n    TEST_ASSERT (number_global == expected);\n\n    jerry_value_free (prop_result_global);\n    jerry_value_free (prop_result_wn);\n    jerry_value_free (current_global_symbol);\n    jerry_value_free (well_known_symbol);\n  }\n\n  jerry_value_free (builtin_symbol);\n\n  /* Deletion of the 'Symbol' builtin makes the well-known symbols unaccessible from JS context\n     but the symbols still can be obtained via 'jerry_symbol' */\n  const jerry_char_t deleter_src[] = \"delete Symbol\";\n\n  jerry_value_t deleter = jerry_eval (deleter_src, sizeof (deleter_src) - 1, JERRY_PARSE_NO_OPTS);\n  TEST_ASSERT (jerry_value_is_boolean (deleter) && jerry_value_is_true (deleter));\n  jerry_value_free (deleter);\n\n  builtin_symbol = jerry_object_get (global_obj, symbol_str);\n  TEST_ASSERT (jerry_value_is_undefined (builtin_symbol));\n  jerry_value_free (builtin_symbol);\n\n  expected = 1.0;\n  prop_index = 0;\n\n  for (jerry_well_known_symbol_t id = JERRY_SYMBOL_ASYNC_ITERATOR; id <= JERRY_SYMBOL_MATCH_ALL;\n       id++, expected++, prop_index++)\n  {\n    jerry_value_t well_known_symbol = jerry_symbol (id);\n    jerry_value_t prop_result_wn = jerry_object_get (obj, well_known_symbol);\n\n    TEST_ASSERT (jerry_value_is_number (prop_result_wn));\n    double number_wn = jerry_value_as_number (prop_result_wn);\n    TEST_ASSERT (number_wn == expected);\n\n    jerry_value_free (prop_result_wn);\n    jerry_value_free (well_known_symbol);\n  }\n\n  jerry_well_known_symbol_t invalid_symbol = (jerry_well_known_symbol_t) (JERRY_SYMBOL_MATCH_ALL + 1);\n  jerry_value_t invalid_well_known_symbol = jerry_symbol (invalid_symbol);\n  TEST_ASSERT (jerry_value_is_undefined (invalid_well_known_symbol));\n  jerry_value_free (invalid_well_known_symbol);\n\n  invalid_symbol = (jerry_well_known_symbol_t) (JERRY_SYMBOL_ASYNC_ITERATOR - 1);\n  invalid_well_known_symbol = jerry_symbol (invalid_symbol);\n  TEST_ASSERT (jerry_value_is_undefined (invalid_well_known_symbol));\n  jerry_value_free (invalid_well_known_symbol);\n\n  jerry_value_free (symbol_str);\n  jerry_value_free (global_obj);\n  jerry_value_free (obj);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-to-integer.c",
    "content": "/*\n * Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"ecma-conversion.h\"\n#include \"ecma-errors.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-init-finalize.h\"\n\n#include \"jcontext.h\"\n#include \"lit-globals.h\"\n#include \"test-common.h\"\n\n/**\n * Unit test's main function.\n */\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jmem_init ();\n  ecma_init ();\n\n  ecma_number_t num;\n\n  ecma_value_t int_num = ecma_make_int32_value (123);\n\n  ecma_number_t result = ecma_op_to_integer (int_num, &num);\n\n  ecma_free_value (int_num);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (num == 123);\n\n  /* 2 */\n  ecma_value_t error = ecma_raise_standard_error (JERRY_ERROR_TYPE, ECMA_ERR_INVALID_ARRAY_LENGTH);\n\n  result = ecma_op_to_integer (error, &num);\n\n  jcontext_release_exception ();\n\n  TEST_ASSERT (ECMA_IS_VALUE_ERROR (result));\n\n  /* 3 */\n  ecma_value_t nan = ecma_make_nan_value ();\n\n  result = ecma_op_to_integer (nan, &num);\n\n  ecma_free_value (nan);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (num == 0);\n\n  /* 4 */\n  /* -0 */\n  ecma_value_t negative_zero = ecma_make_number_value (-0.0f);\n\n  result = ecma_op_to_integer (negative_zero, &num);\n\n  ecma_free_value (negative_zero);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (1.0f / num == ecma_number_make_infinity (true));\n\n  /* +0 */\n  ecma_value_t positive_zero = ecma_make_number_value (+0.0f);\n\n  result = ecma_op_to_integer (positive_zero, &num);\n\n  ecma_free_value (positive_zero);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (1.0f / num == ecma_number_make_infinity (false));\n\n  /* -infinity */\n  ecma_value_t negative_infinity = ecma_make_number_value (ecma_number_make_infinity (true));\n\n  result = ecma_op_to_integer (negative_infinity, &num);\n\n  ecma_free_value (negative_infinity);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (num == ecma_number_make_infinity (true));\n\n  /* +infinity */\n  ecma_value_t positive_infinity = ecma_make_number_value (ecma_number_make_infinity (false));\n\n  result = ecma_op_to_integer (positive_infinity, &num);\n\n  ecma_free_value (positive_infinity);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (num == ecma_number_make_infinity (false));\n\n  /* 5 */\n  ecma_value_t floor_val = ecma_make_number_value (3.001f);\n\n  result = ecma_op_to_integer (floor_val, &num);\n\n  ecma_free_value (floor_val);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (num == 3);\n\n  ecma_value_t floor2 = ecma_make_number_value (-26.5973);\n\n  result = ecma_op_to_integer (floor2, &num);\n\n  ecma_free_value (floor2);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (num == -26);\n\n  ecma_finalize ();\n  jmem_finalize ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-to-length.c",
    "content": "/*\n * Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript-types.h\"\n#include \"jerryscript.h\"\n\n#include \"ecma-conversion.h\"\n#include \"ecma-errors.h\"\n#include \"ecma-exceptions.h\"\n#include \"ecma-globals.h\"\n#include \"ecma-helpers-number.h\"\n#include \"ecma-helpers.h\"\n#include \"ecma-init-finalize.h\"\n\n#include \"jcontext.h\"\n#include \"lit-globals.h\"\n#include \"test-common.h\"\n\n/**\n * Unit test's main function.\n */\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jmem_init ();\n  ecma_init ();\n\n  ecma_length_t num;\n\n  ecma_value_t int_num = ecma_make_int32_value (123);\n\n  ecma_value_t result = ecma_op_to_length (int_num, &num);\n\n  ecma_free_value (int_num);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (num == 123);\n\n  /* 1, 3 */\n  ecma_value_t error_throw = ecma_raise_standard_error (JERRY_ERROR_TYPE, ECMA_ERR_INVALID_ARRAY_LENGTH);\n\n  result = ecma_op_to_length (error_throw, &num);\n\n  jcontext_release_exception ();\n\n  TEST_ASSERT (ECMA_IS_VALUE_ERROR (result));\n\n  /* zero */\n  ecma_value_t zero = ecma_make_int32_value (0);\n\n  result = ecma_op_to_length (zero, &num);\n\n  ecma_free_value (zero);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (num == 0);\n\n  /* negative */\n  ecma_value_t negative = ecma_make_number_value (-26.5973f);\n\n  result = ecma_op_to_length (negative, &num);\n\n  ecma_free_value (negative);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (num == 0);\n\n  /* +infinity */\n  ecma_value_t positive_infinity = ecma_make_number_value (ecma_number_make_infinity (false));\n\n  result = ecma_op_to_length (positive_infinity, &num);\n\n  ecma_free_value (positive_infinity);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT ((ecma_number_t) num == ECMA_NUMBER_MAX_SAFE_INTEGER);\n\n  /* -infinity */\n  ecma_value_t negative_infinity = ecma_make_number_value (ecma_number_make_infinity (true));\n\n  result = ecma_op_to_length (negative_infinity, &num);\n\n  ecma_free_value (negative_infinity);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (num == 0);\n\n  /* NaN */\n  ecma_value_t nan = ecma_make_nan_value ();\n\n  result = ecma_op_to_length (nan, &num);\n\n  ecma_free_value (nan);\n\n  TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));\n  TEST_ASSERT (num == 0);\n\n  ecma_finalize ();\n  jmem_finalize ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-to-property-descriptor.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic jerry_value_t\ncreate_property_descriptor (const char *script_p) /**< source code */\n{\n  jerry_value_t result = jerry_eval ((const jerry_char_t *) script_p, strlen (script_p), 0);\n  TEST_ASSERT (jerry_value_is_object (result));\n  return result;\n} /* create_property_descriptor */\n\nstatic void\ncheck_attribute (jerry_value_t attribute, /**< attribute to be checked */\n                 jerry_value_t object, /**< original object */\n                 const char *name_p) /**< name of the attribute */\n{\n  jerry_value_t prop_name = jerry_string_sz (name_p);\n  jerry_value_t value = jerry_object_get (object, prop_name);\n\n  if (jerry_value_is_undefined (value))\n  {\n    TEST_ASSERT (jerry_value_is_null (attribute));\n  }\n  else\n  {\n    jerry_value_t result = jerry_binary_op (JERRY_BIN_OP_STRICT_EQUAL, attribute, value);\n    TEST_ASSERT (jerry_value_is_true (result));\n    jerry_value_free (result);\n  }\n\n  jerry_value_free (value);\n  jerry_value_free (prop_name);\n} /* check_attribute */\n\nstatic jerry_property_descriptor_t\nto_property_descriptor (jerry_value_t object /**< object */)\n{\n  jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n\n  jerry_value_t result = jerry_property_descriptor_from_object (object, &prop_desc);\n  TEST_ASSERT (jerry_value_is_boolean (result) && jerry_value_is_true (result));\n  jerry_value_free (result);\n\n  return prop_desc;\n} /* to_property_descriptor */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Next test. */\n  const char *source_p = \"({ value:'X', writable:true, enumerable:true, configurable:true })\";\n  jerry_value_t object = create_property_descriptor (source_p);\n\n  jerry_property_descriptor_t prop_desc = to_property_descriptor (object);\n\n  check_attribute (prop_desc.value, object, \"value\");\n\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_GET_DEFINED));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_SET_DEFINED));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_WRITABLE_DEFINED);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_WRITABLE);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE_DEFINED);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE);\n\n  jerry_value_free (object);\n  jerry_property_descriptor_free (&prop_desc);\n\n  /* Next test. */\n  source_p = \"({ writable:false, configurable:true })\";\n  object = create_property_descriptor (source_p);\n\n  prop_desc = to_property_descriptor (object);\n\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_GET_DEFINED));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_SET_DEFINED));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_WRITABLE_DEFINED);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_WRITABLE));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_ENUMERABLE_DEFINED));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE);\n\n  jerry_value_free (object);\n  jerry_property_descriptor_free (&prop_desc);\n\n  /* Next test. */\n  /* Note: the 'set' property is defined, and it has a value of undefined.\n   *       This is different from not having a 'set' property. */\n  source_p = \"({ get: function() {}, set:undefined, configurable:true })\";\n  object = create_property_descriptor (source_p);\n\n  prop_desc = to_property_descriptor (object);\n\n  check_attribute (prop_desc.getter, object, \"get\");\n  check_attribute (prop_desc.setter, object, \"set\");\n\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_WRITABLE_DEFINED));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_GET_DEFINED);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_SET_DEFINED);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_ENUMERABLE_DEFINED));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE);\n\n  jerry_value_free (object);\n  jerry_property_descriptor_free (&prop_desc);\n\n  /* Next test. */\n  source_p = \"({ get: undefined, enumerable:false })\";\n  object = create_property_descriptor (source_p);\n\n  prop_desc = to_property_descriptor (object);\n\n  check_attribute (prop_desc.getter, object, \"get\");\n\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_WRITABLE_DEFINED));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_GET_DEFINED);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_SET_DEFINED));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE_DEFINED);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_ENUMERABLE));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED));\n\n  jerry_value_free (object);\n  jerry_property_descriptor_free (&prop_desc);\n\n  /* Next test. */\n  source_p = \"({ set: function(v) {}, enumerable:true, configurable:false })\";\n  object = create_property_descriptor (source_p);\n\n  prop_desc = to_property_descriptor (object);\n\n  check_attribute (prop_desc.setter, object, \"set\");\n\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_WRITABLE_DEFINED));\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_GET_DEFINED));\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_SET_DEFINED);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE_DEFINED);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE);\n  TEST_ASSERT (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED);\n  TEST_ASSERT (!(prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE));\n\n  jerry_value_free (object);\n  jerry_property_descriptor_free (&prop_desc);\n\n  /* Next test. */\n  source_p = \"({ get: function(v) {}, writable:true })\";\n  object = create_property_descriptor (source_p);\n  jerry_value_t result = jerry_property_descriptor_from_object (object, &prop_desc);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n  jerry_value_free (object);\n\n  /* Next test. */\n  object = jerry_null ();\n  result = jerry_property_descriptor_from_object (object, &prop_desc);\n  TEST_ASSERT (jerry_value_is_exception (result));\n  jerry_value_free (result);\n  jerry_value_free (object);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-typedarray.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <stdio.h>\n\n#include \"jerryscript-port.h\"\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\n/**\n * Type to describe test cases.\n */\ntypedef struct\n{\n  jerry_typedarray_type_t typedarray_type; /**< what kind of TypedArray */\n  char *constructor_name; /**< JS constructor name for TypedArray */\n  uint32_t element_count; /**< number of elements for the TypedArray */\n  uint32_t bytes_per_element; /**< bytes per elment of the given typedarray_type */\n} test_entry_t;\n\n/**\n * Register a JavaScript value in the global object.\n */\nstatic void\nregister_js_value (const char *name_p, /**< name of the function */\n                   jerry_value_t value) /**< function callback */\n{\n  jerry_value_t global_obj_val = jerry_current_realm ();\n\n  jerry_value_t name_val = jerry_string_sz (name_p);\n  jerry_value_t result_val = jerry_object_set (global_obj_val, name_val, value);\n\n  jerry_value_free (name_val);\n  jerry_value_free (global_obj_val);\n\n  jerry_value_free (result_val);\n} /* register_js_value */\n\nstatic jerry_value_t\nassert_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                const jerry_value_t args_p[], /**< function arguments */\n                const jerry_length_t args_cnt) /**< number of function arguments */\n{\n  JERRY_UNUSED (call_info_p);\n\n  if (jerry_value_is_true (args_p[0]))\n  {\n    return jerry_boolean (true);\n  }\n  else\n  {\n    if (args_cnt > 1 && jerry_value_is_string (args_p[1]))\n    {\n      jerry_char_t utf8_string[128];\n      jerry_size_t copied =\n        jerry_string_to_buffer (args_p[1], JERRY_ENCODING_UTF8, utf8_string, sizeof (utf8_string) - 1);\n      utf8_string[copied] = '\\0';\n\n      printf (\"JS assert: %s\\n\", utf8_string);\n    }\n    TEST_ASSERT (false);\n  }\n} /* assert_handler */\n\n/**\n * Do simple TypedArray property validation.\n */\nstatic void\ntest_typedarray_info (jerry_value_t typedarray, /**< target TypedArray to query */\n                      jerry_typedarray_type_t typedarray_type, /**< expected TypedArray type */\n                      jerry_length_t element_count, /**< expected element count */\n                      jerry_length_t bytes_per_element) /**< bytes per element for the given type */\n{\n  TEST_ASSERT (!jerry_value_is_exception (typedarray));\n  TEST_ASSERT (jerry_value_is_typedarray (typedarray));\n  TEST_ASSERT (jerry_typedarray_type (typedarray) == typedarray_type);\n  TEST_ASSERT (jerry_typedarray_length (typedarray) == element_count);\n\n  jerry_length_t byte_length = (uint32_t) -1;\n  jerry_length_t byte_offset = (uint32_t) -1;\n  jerry_value_t arraybuffer = jerry_typedarray_buffer (typedarray, &byte_offset, &byte_length);\n  TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n\n  TEST_ASSERT (byte_length == element_count * bytes_per_element);\n  TEST_ASSERT (byte_offset == 0);\n\n  jerry_value_free (arraybuffer);\n} /* test_typedarray_info */\n\n/**\n * Test construction of TypedArrays and validate properties.\n */\nstatic void\ntest_typedarray_queries (test_entry_t test_entries[]) /**< test cases */\n{\n  jerry_value_t global_obj_val = jerry_current_realm ();\n\n  for (uint32_t i = 0; test_entries[i].constructor_name != NULL; i++)\n  {\n    /* Create TypedArray via construct call */\n    {\n      jerry_value_t prop_name = jerry_string_sz (test_entries[i].constructor_name);\n      jerry_value_t prop_value = jerry_object_get (global_obj_val, prop_name);\n      TEST_ASSERT (!jerry_value_is_exception (prop_value));\n      jerry_value_t length_arg = jerry_number (test_entries[i].element_count);\n\n      jerry_value_t typedarray = jerry_construct (prop_value, &length_arg, 1);\n\n      jerry_value_free (prop_name);\n      jerry_value_free (prop_value);\n      jerry_value_free (length_arg);\n\n      test_typedarray_info (typedarray,\n                            test_entries[i].typedarray_type,\n                            test_entries[i].element_count,\n                            test_entries[i].bytes_per_element);\n      jerry_value_free (typedarray);\n    }\n\n    /* Create TypedArray via api call */\n    {\n      jerry_value_t typedarray = jerry_typedarray (test_entries[i].typedarray_type, test_entries[i].element_count);\n      test_typedarray_info (typedarray,\n                            test_entries[i].typedarray_type,\n                            test_entries[i].element_count,\n                            test_entries[i].bytes_per_element);\n      jerry_value_free (typedarray);\n    }\n  }\n\n  jerry_value_free (global_obj_val);\n} /* test_typedarray_queries */\n\n/**\n * Test value at given position in the buffer based on TypedArray type.\n */\nstatic void\ntest_buffer_value (uint64_t value, /**< value to test for */\n                   const void *buffer, /**< buffer to read value from */\n                   uint32_t start_offset, /**< start offset of the value */\n                   jerry_typedarray_type_t typedarray_type, /**< type of TypedArray */\n                   uint32_t bytes_per_element) /**< bytes per element for the given type */\n{\n  uint32_t offset = start_offset / bytes_per_element;\n\n#define TEST_VALUE_AT(TYPE, BUFFER, OFFSET, VALUE) TEST_ASSERT (((TYPE *) BUFFER)[OFFSET] == (TYPE) (VALUE))\n\n  switch (typedarray_type)\n  {\n    case JERRY_TYPEDARRAY_UINT8:\n      TEST_VALUE_AT (uint8_t, buffer, offset, value);\n      break;\n    case JERRY_TYPEDARRAY_INT8:\n      TEST_VALUE_AT (int8_t, buffer, offset, value);\n      break;\n    case JERRY_TYPEDARRAY_UINT16:\n      TEST_VALUE_AT (uint16_t, buffer, offset, value);\n      break;\n    case JERRY_TYPEDARRAY_INT16:\n      TEST_VALUE_AT (int16_t, buffer, offset, value);\n      break;\n    case JERRY_TYPEDARRAY_UINT32:\n      TEST_VALUE_AT (uint32_t, buffer, offset, value);\n      break;\n    case JERRY_TYPEDARRAY_INT32:\n      TEST_VALUE_AT (int32_t, buffer, offset, value);\n      break;\n    case JERRY_TYPEDARRAY_FLOAT32:\n      TEST_VALUE_AT (float, buffer, offset, value);\n      break;\n    case JERRY_TYPEDARRAY_FLOAT64:\n      TEST_VALUE_AT (double, buffer, offset, value);\n      break;\n    case JERRY_TYPEDARRAY_BIGINT64:\n      TEST_VALUE_AT (int64_t, buffer, offset, value);\n      break;\n    case JERRY_TYPEDARRAY_BIGUINT64:\n      TEST_VALUE_AT (uint64_t, buffer, offset, value);\n      break;\n\n    case JERRY_TYPEDARRAY_UINT8CLAMPED:\n    {\n      int64_t signed_value = (int64_t) value;\n      uint8_t expected = (uint8_t) value;\n\n      /* clamp the value if required*/\n      if (signed_value > 0xFF)\n      {\n        expected = 0xFF;\n      }\n      else if (signed_value < 0)\n      {\n        expected = 0;\n      }\n\n      TEST_VALUE_AT (uint8_t, buffer, offset, expected);\n      break;\n    }\n    default:\n      TEST_ASSERT (false);\n      break;\n  }\n\n#undef TEST_VALUE_AT\n} /* test_buffer_value */\n\nstatic void\ntest_typedarray_complex_creation (test_entry_t test_entries[], /**< test cases */\n                                  bool use_external_buffer) /**< run tests using arraybuffer with external memory */\n{\n  const uint32_t arraybuffer_size = 256;\n\n  for (uint32_t i = 0; test_entries[i].constructor_name != NULL; i++)\n  {\n    const uint32_t offset = 8;\n    uint32_t element_count = test_entries[i].element_count;\n    uint32_t bytes_per_element = test_entries[i].bytes_per_element;\n    uint8_t *buffer_p = NULL;\n\n    /* new %TypedArray% (buffer, offset, length); */\n    jerry_value_t typedarray;\n    {\n      jerry_value_t arraybuffer;\n\n      if (use_external_buffer)\n      {\n        buffer_p = (uint8_t *) jerry_heap_alloc (arraybuffer_size);\n        arraybuffer = jerry_arraybuffer_external (buffer_p, arraybuffer_size, NULL);\n      }\n      else\n      {\n        arraybuffer = jerry_arraybuffer (arraybuffer_size);\n      }\n\n      jerry_value_t js_offset = jerry_number (offset);\n      jerry_value_t js_element_count = jerry_number (element_count);\n\n      register_js_value (\"expected_offset\", js_offset);\n      register_js_value (\"expected_length\", js_element_count);\n\n      typedarray =\n        jerry_typedarray_with_buffer_span (test_entries[i].typedarray_type, arraybuffer, offset, element_count);\n      TEST_ASSERT (!jerry_value_is_exception (typedarray));\n\n      jerry_value_free (js_offset);\n      jerry_value_free (js_element_count);\n      jerry_value_free (arraybuffer);\n    }\n\n    register_js_value (\"array\", typedarray);\n\n    const jerry_char_t test_exptected_src[] =\n      TEST_STRING_LITERAL (\"assert (array.length == expected_length,\"\n                           \"        'expected length: ' + expected_length + ' got: ' + array.length);\"\n                           \"assert (array.byteOffset == expected_offset);\");\n    jerry_value_t result = jerry_eval (test_exptected_src, sizeof (test_exptected_src) - 1, JERRY_PARSE_STRICT_MODE);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n    jerry_value_free (result);\n\n    const jerry_char_t set_element_src[] = TEST_STRING_LITERAL (\"array[0] = 0x11223344n\");\n\n    /* crop the last 'n' character */\n    size_t src_length = sizeof (set_element_src) - 2;\n\n    if (test_entries[i].typedarray_type >= JERRY_TYPEDARRAY_BIGINT64)\n    {\n      /* use the last 'n' character */\n      src_length++;\n    }\n\n    result = jerry_eval (set_element_src, src_length, JERRY_PARSE_STRICT_MODE);\n    TEST_ASSERT (!jerry_value_is_exception (result));\n    jerry_value_free (result);\n\n    {\n      jerry_length_t byte_length = 0;\n      jerry_length_t byte_offset = 0;\n      jerry_value_t buffer = jerry_typedarray_buffer (typedarray, &byte_offset, &byte_length);\n      TEST_ASSERT (byte_length == element_count * bytes_per_element);\n      TEST_ASSERT (byte_offset == offset);\n\n      JERRY_VLA (uint8_t, test_buffer, arraybuffer_size);\n\n      jerry_typedarray_type_t type = jerry_typedarray_type (typedarray);\n      jerry_value_t read_count = jerry_arraybuffer_read (buffer, 0, test_buffer, offset + byte_length);\n      TEST_ASSERT (read_count == offset + byte_length);\n      test_buffer_value (0x11223344, test_buffer, offset, type, bytes_per_element);\n\n      if (use_external_buffer)\n      {\n        test_buffer_value (0x11223344, buffer_p, offset, type, bytes_per_element);\n        TEST_ASSERT (memcmp (buffer_p, test_buffer, offset + byte_length) == 0);\n      }\n\n      jerry_value_free (buffer);\n    }\n\n    jerry_value_free (typedarray);\n  }\n} /* test_typedarray_complex_creation */\n\n/**\n * Test get/set/delete property by index.\n */\nstatic void\ntest_property_by_index (test_entry_t test_entries[])\n{\n  int test_int_numbers[5] = { -5, -70, 13, 0, 56 };\n  double test_double_numbers[5] = { -83.153, -35.15, 0, 13.1, 89.8975 };\n  uint8_t test_uint_numbers[5] = { 83, 15, 36, 0, 43 };\n  uint64_t test_uint64_numbers[5] = { 83, 0, 1, UINT32_MAX, UINT64_MAX };\n  int64_t test_int64_numbers[5] = { INT64_MAX, INT64_MIN, 0, INT32_MAX, INT32_MIN };\n\n  for (uint32_t i = 0; test_entries[i].constructor_name != NULL; i++)\n  {\n    jerry_value_t test_number;\n    uint32_t test_numbers_length = sizeof (test_int_numbers) / sizeof (int);\n    jerry_value_t typedarray = jerry_typedarray (test_entries[i].typedarray_type, test_numbers_length);\n    jerry_typedarray_type_t type = jerry_typedarray_type (typedarray);\n\n    jerry_value_t set_result;\n    jerry_value_t get_result;\n\n    switch (type)\n    {\n      case JERRY_TYPEDARRAY_INT8:\n      case JERRY_TYPEDARRAY_INT16:\n      case JERRY_TYPEDARRAY_INT32:\n      {\n        for (uint8_t j = 0; j < test_numbers_length; j++)\n        {\n          test_number = jerry_number (test_int_numbers[j]);\n          TEST_ASSERT (jerry_value_is_false (jerry_object_delete_index (typedarray, j)));\n          set_result = jerry_object_set_index (typedarray, j, test_number);\n          get_result = jerry_object_get_index (typedarray, j);\n\n          TEST_ASSERT (jerry_value_is_boolean (set_result));\n          TEST_ASSERT (jerry_value_is_true (set_result));\n          TEST_ASSERT (jerry_value_is_false (jerry_object_delete_index (typedarray, j)));\n          TEST_ASSERT (jerry_value_as_number (get_result) == test_int_numbers[j]);\n\n          jerry_value_free (test_number);\n          jerry_value_free (set_result);\n          jerry_value_free (get_result);\n        }\n        break;\n      }\n      case JERRY_TYPEDARRAY_FLOAT32:\n      case JERRY_TYPEDARRAY_FLOAT64:\n      {\n        for (uint8_t j = 0; j < test_numbers_length; j++)\n        {\n          test_number = jerry_number (test_double_numbers[j]);\n          TEST_ASSERT (jerry_value_is_false (jerry_object_delete_index (typedarray, j)));\n          set_result = jerry_object_set_index (typedarray, j, test_number);\n          get_result = jerry_object_get_index (typedarray, j);\n\n          TEST_ASSERT (jerry_value_is_boolean (set_result));\n          TEST_ASSERT (jerry_value_is_true (set_result));\n          TEST_ASSERT (jerry_value_is_false (jerry_object_delete_index (typedarray, j)));\n\n          double epsilon = pow (10, -5);\n          double get_abs = fabs (jerry_value_as_number (get_result) - test_double_numbers[j]);\n          TEST_ASSERT (get_abs < epsilon);\n\n          jerry_value_free (test_number);\n          jerry_value_free (set_result);\n          jerry_value_free (get_result);\n\n          /* Testing positive and negative infinity */\n          for (uint8_t k = 0; k < 2; k++)\n          {\n            jerry_value_t inf = jerry_infinity (k);\n            jerry_value_t set_inf = jerry_object_set_index (typedarray, 0, inf);\n            TEST_ASSERT (jerry_value_is_boolean (set_inf));\n            TEST_ASSERT (jerry_value_is_true (set_inf));\n            jerry_value_t get_inf = jerry_object_get_index (typedarray, 0);\n            TEST_ASSERT (isinf (jerry_value_as_number (get_inf)));\n\n            jerry_value_free (inf);\n            jerry_value_free (set_inf);\n            jerry_value_free (get_inf);\n          }\n        }\n        break;\n      }\n      case JERRY_TYPEDARRAY_BIGINT64:\n      {\n        for (uint8_t j = 0; j < test_numbers_length; j++)\n        {\n          test_number = jerry_bigint ((uint64_t *) &test_int64_numbers[j], 1, true);\n          TEST_ASSERT (jerry_value_is_false (jerry_object_delete_index (typedarray, j)));\n          set_result = jerry_object_set_index (typedarray, j, test_number);\n          get_result = jerry_object_get_index (typedarray, j);\n\n          TEST_ASSERT (jerry_value_is_boolean (set_result));\n          TEST_ASSERT (jerry_value_is_true (set_result));\n          TEST_ASSERT (jerry_value_is_false (jerry_object_delete_index (typedarray, j)));\n          int64_t get_number;\n          bool sign;\n          jerry_bigint_to_digits (get_result, (uint64_t *) &get_number, 1, &sign);\n\n          TEST_ASSERT (sign ? get_number : -get_number == test_int64_numbers[j]);\n\n          jerry_value_free (test_number);\n          jerry_value_free (set_result);\n          jerry_value_free (get_result);\n        }\n        break;\n      }\n      case JERRY_TYPEDARRAY_BIGUINT64:\n      {\n        for (uint8_t j = 0; j < test_numbers_length; j++)\n        {\n          test_number = jerry_bigint (&test_uint64_numbers[j], 1, false);\n          TEST_ASSERT (jerry_value_is_false (jerry_object_delete_index (typedarray, j)));\n          set_result = jerry_object_set_index (typedarray, j, test_number);\n          get_result = jerry_object_get_index (typedarray, j);\n\n          TEST_ASSERT (jerry_value_is_boolean (set_result));\n          TEST_ASSERT (jerry_value_is_true (set_result));\n          TEST_ASSERT (jerry_value_is_false (jerry_object_delete_index (typedarray, j)));\n          uint64_t get_number;\n          bool sign;\n          jerry_bigint_to_digits (get_result, &get_number, 1, &sign);\n\n          TEST_ASSERT (get_number == test_uint64_numbers[j]);\n\n          jerry_value_free (test_number);\n          jerry_value_free (set_result);\n          jerry_value_free (get_result);\n        }\n        break;\n      }\n      default:\n      {\n        for (uint8_t j = 0; j < test_numbers_length; j++)\n        {\n          test_number = jerry_number (test_uint_numbers[j]);\n          TEST_ASSERT (jerry_value_is_false (jerry_object_delete_index (typedarray, j)));\n          set_result = jerry_object_set_index (typedarray, j, test_number);\n          get_result = jerry_object_get_index (typedarray, j);\n\n          TEST_ASSERT (jerry_value_is_boolean (set_result));\n          TEST_ASSERT (jerry_value_is_true (set_result));\n          TEST_ASSERT (jerry_value_is_false (jerry_object_delete_index (typedarray, j)));\n          TEST_ASSERT (jerry_value_as_number (get_result) == test_uint_numbers[j]);\n\n          jerry_value_free (test_number);\n          jerry_value_free (set_result);\n          jerry_value_free (get_result);\n        }\n        break;\n      }\n    }\n\n    jerry_value_t set_undefined = jerry_object_set_index (typedarray, 100, jerry_number (50));\n\n    if (type == JERRY_TYPEDARRAY_BIGINT64 || type == JERRY_TYPEDARRAY_BIGUINT64)\n    {\n      TEST_ASSERT (jerry_value_is_exception (set_undefined));\n    }\n    else\n    {\n      TEST_ASSERT (jerry_value_is_boolean (set_undefined) && !jerry_value_is_true (set_undefined));\n    }\n\n    jerry_value_t get_undefined = jerry_object_get_index (typedarray, 100);\n\n    if (type == JERRY_TYPEDARRAY_BIGINT64 || type == JERRY_TYPEDARRAY_BIGUINT64)\n    {\n      TEST_ASSERT (jerry_value_is_exception (set_undefined));\n    }\n    else\n    {\n      TEST_ASSERT (jerry_value_is_undefined (get_undefined));\n    }\n\n    TEST_ASSERT (jerry_value_is_undefined (get_undefined));\n    jerry_value_free (set_undefined);\n    jerry_value_free (get_undefined);\n    jerry_value_free (typedarray);\n  }\n} /* test_property_by_index */\n\nstatic void\ntest_detached_arraybuffer (void)\n{\n  static jerry_typedarray_type_t types[] = {\n    JERRY_TYPEDARRAY_UINT8,   JERRY_TYPEDARRAY_UINT8CLAMPED, JERRY_TYPEDARRAY_INT8,      JERRY_TYPEDARRAY_UINT16,\n    JERRY_TYPEDARRAY_INT16,   JERRY_TYPEDARRAY_UINT32,       JERRY_TYPEDARRAY_INT32,     JERRY_TYPEDARRAY_FLOAT32,\n    JERRY_TYPEDARRAY_FLOAT64, JERRY_TYPEDARRAY_BIGINT64,     JERRY_TYPEDARRAY_BIGUINT64,\n  };\n\n  /* Creating an TypedArray for a detached array buffer with a given length/offset is invalid */\n  {\n    const uint32_t length = 1;\n    uint8_t *buffer_p = (uint8_t *) jerry_heap_alloc (length);\n    jerry_value_t arraybuffer = jerry_arraybuffer_external (buffer_p, length, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (arraybuffer));\n    TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n    TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == length);\n\n    TEST_ASSERT (jerry_arraybuffer_is_detachable (arraybuffer));\n\n    jerry_value_t res = jerry_arraybuffer_detach (arraybuffer);\n    TEST_ASSERT (!jerry_value_is_exception (res));\n    jerry_value_free (res);\n\n    TEST_ASSERT (!jerry_arraybuffer_is_detachable (arraybuffer));\n\n    for (size_t idx = 0; idx < (sizeof (types) / sizeof (types[0])); idx++)\n    {\n      jerry_value_t typedarray = jerry_typedarray_with_buffer_span (types[idx], arraybuffer, 0, 4);\n      TEST_ASSERT (jerry_value_is_exception (typedarray));\n      TEST_ASSERT (jerry_error_type (typedarray) == JERRY_ERROR_TYPE);\n      jerry_value_free (typedarray);\n    }\n\n    jerry_value_free (arraybuffer);\n  }\n\n  /* Creating an TypedArray for a detached array buffer without length/offset is valid */\n  {\n    const uint32_t length = 1;\n    uint8_t *buffer_p = (uint8_t *) jerry_heap_alloc (length);\n    jerry_value_t arraybuffer = jerry_arraybuffer_external (buffer_p, length, NULL);\n    TEST_ASSERT (!jerry_value_is_exception (arraybuffer));\n    TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));\n    TEST_ASSERT (jerry_arraybuffer_size (arraybuffer) == length);\n\n    TEST_ASSERT (jerry_arraybuffer_is_detachable (arraybuffer));\n\n    jerry_value_t res = jerry_arraybuffer_detach (arraybuffer);\n    TEST_ASSERT (!jerry_value_is_exception (res));\n    jerry_value_free (res);\n\n    TEST_ASSERT (!jerry_arraybuffer_is_detachable (arraybuffer));\n\n    for (size_t idx = 0; idx < (sizeof (types) / sizeof (types[0])); idx++)\n    {\n      jerry_value_t typedarray = jerry_typedarray_with_buffer (types[idx], arraybuffer);\n      TEST_ASSERT (jerry_value_is_exception (typedarray));\n      TEST_ASSERT (jerry_error_type (typedarray) == JERRY_ERROR_TYPE);\n      jerry_value_free (typedarray);\n    }\n\n    jerry_value_free (arraybuffer);\n  }\n} /* test_detached_arraybuffer */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  if (!jerry_feature_enabled (JERRY_FEATURE_TYPEDARRAY))\n  {\n    jerry_log (JERRY_LOG_LEVEL_ERROR, \"TypedArray is disabled!\\n\");\n    jerry_cleanup ();\n    return 0;\n  }\n\n  jerry_value_t function_val = jerry_function_external (assert_handler);\n  register_js_value (\"assert\", function_val);\n  jerry_value_free (function_val);\n\n  test_entry_t test_entries[] = {\n#define TEST_ENTRY(TYPE, CONSTRUCTOR, COUNT, BYTES_PER_ELEMENT) { TYPE, CONSTRUCTOR, COUNT, BYTES_PER_ELEMENT }\n\n    TEST_ENTRY (JERRY_TYPEDARRAY_UINT8, \"Uint8Array\", 12, 1),\n    TEST_ENTRY (JERRY_TYPEDARRAY_UINT8CLAMPED, \"Uint8ClampedArray\", 12, 1),\n    TEST_ENTRY (JERRY_TYPEDARRAY_INT8, \"Int8Array\", 12, 1),\n    TEST_ENTRY (JERRY_TYPEDARRAY_UINT16, \"Uint16Array\", 12, 2),\n    TEST_ENTRY (JERRY_TYPEDARRAY_INT16, \"Int16Array\", 12, 2),\n    TEST_ENTRY (JERRY_TYPEDARRAY_UINT16, \"Uint16Array\", 12, 2),\n    TEST_ENTRY (JERRY_TYPEDARRAY_INT32, \"Int32Array\", 12, 4),\n    TEST_ENTRY (JERRY_TYPEDARRAY_UINT32, \"Uint32Array\", 12, 4),\n    TEST_ENTRY (JERRY_TYPEDARRAY_FLOAT32, \"Float32Array\", 12, 4),\n    /* TODO: add check if the float64 is supported */\n    TEST_ENTRY (JERRY_TYPEDARRAY_FLOAT64, \"Float64Array\", 12, 8),\n    TEST_ENTRY (JERRY_TYPEDARRAY_BIGINT64, \"BigInt64Array\", 12, 8),\n    TEST_ENTRY (JERRY_TYPEDARRAY_BIGUINT64, \"BigUint64Array\", 12, 8),\n\n    TEST_ENTRY (JERRY_TYPEDARRAY_INVALID, NULL, 0, 0)\n#undef TEST_ENTRY\n  };\n\n  /* Test TypedArray queries */\n  test_typedarray_queries (test_entries);\n\n  /* Test TypedArray operations in js */\n  {\n    const uint32_t element_count = 14;\n\n    jerry_value_t array = jerry_typedarray (JERRY_TYPEDARRAY_UINT8, element_count);\n\n    {\n      uint8_t expected_value = 42;\n      JERRY_VLA (uint8_t, expected_data, element_count);\n      memset (expected_data, expected_value, element_count);\n\n      jerry_length_t byte_length;\n      jerry_length_t offset;\n      jerry_value_t buffer = jerry_typedarray_buffer (array, &offset, &byte_length);\n      TEST_ASSERT (byte_length == element_count);\n      jerry_length_t written = jerry_arraybuffer_write (buffer, offset, expected_data, element_count);\n      TEST_ASSERT (written == element_count);\n      jerry_value_free (buffer);\n\n      jerry_value_t js_element_count = jerry_number (element_count);\n      jerry_value_t js_expected_value = jerry_number (expected_value);\n\n      register_js_value (\"array\", array);\n      register_js_value (\"expected_length\", js_element_count);\n      register_js_value (\"expected_value\", js_expected_value);\n\n      jerry_value_free (js_element_count);\n      jerry_value_free (js_expected_value);\n    }\n\n    /* Check read and to write */\n    const jerry_char_t eval_src[] = TEST_STRING_LITERAL (\n      \"assert (array.length == expected_length, 'expected length: ' + expected_length + ' got: ' + array.length);\"\n      \"for (var i = 0; i < array.length; i++)\"\n      \"{\"\n      \"  assert (array[i] == expected_value);\"\n      \"  array[i] = i;\"\n      \"};\");\n    jerry_value_t result = jerry_eval (eval_src, sizeof (eval_src) - 1, JERRY_PARSE_STRICT_MODE);\n\n    TEST_ASSERT (!jerry_value_is_exception (result));\n    jerry_value_free (result);\n\n    /* Check write results */\n    {\n      jerry_length_t byte_length;\n      jerry_length_t offset;\n      jerry_value_t buffer = jerry_typedarray_buffer (array, &offset, &byte_length);\n      TEST_ASSERT (byte_length == element_count);\n\n      JERRY_VLA (uint8_t, result_data, element_count);\n\n      jerry_length_t read_count = jerry_arraybuffer_read (buffer, offset, result_data, byte_length);\n      TEST_ASSERT (read_count == byte_length);\n\n      for (uint8_t i = 0; i < read_count; i++)\n      {\n        TEST_ASSERT (result_data[i] == i);\n      }\n\n      jerry_value_free (buffer);\n    }\n\n    jerry_value_free (array);\n  }\n\n  test_typedarray_complex_creation (test_entries, false);\n  test_typedarray_complex_creation (test_entries, true);\n\n  test_property_by_index (test_entries);\n\n  /* test invalid things */\n  {\n    jerry_value_t values[] = {\n      jerry_number (11),\n      jerry_boolean (false),\n      jerry_string_sz (\"test\"),\n      jerry_object (),\n      jerry_null (),\n      jerry_arraybuffer (16),\n      jerry_error_sz (JERRY_ERROR_TYPE, \"error\"),\n      jerry_undefined (),\n      jerry_promise (),\n    };\n\n    for (size_t idx = 0; idx < sizeof (values) / sizeof (values[0]); idx++)\n    {\n      /* A non-TypedArray object should not be regarded a TypedArray. */\n      bool is_typedarray = jerry_value_is_typedarray (values[idx]);\n      TEST_ASSERT (is_typedarray == false);\n\n      /* JERRY_TYPEDARRAY_INVALID should be returned for non-TypedArray objects */\n      jerry_typedarray_type_t type = jerry_typedarray_type (values[idx]);\n      TEST_ASSERT (type == JERRY_TYPEDARRAY_INVALID);\n\n      /* Zero should be returned for non-TypedArray objects */\n      jerry_length_t length = jerry_typedarray_length (values[idx]);\n      TEST_ASSERT (length == 0);\n\n      /**\n       * Getting the ArrayBuffer from a non-TypedArray object(s) should return an error\n       * and should not modify the output parameter values.\n       */\n      {\n        jerry_length_t offset = 22;\n        jerry_length_t byte_count = 23;\n        jerry_value_t error = jerry_typedarray_buffer (values[idx], &offset, &byte_count);\n        TEST_ASSERT (jerry_value_is_exception (error));\n        TEST_ASSERT (offset == 22);\n        TEST_ASSERT (byte_count == 23);\n        jerry_value_free (error);\n      }\n\n      /**\n       * Creating a TypedArray from a non-ArrayBuffer should result an error.\n       */\n      if (!jerry_value_is_arraybuffer (values[idx]))\n      {\n        jerry_value_t error = jerry_typedarray_with_buffer (JERRY_TYPEDARRAY_UINT8, values[idx]);\n        TEST_ASSERT (jerry_value_is_exception (error));\n        jerry_value_free (error);\n      }\n\n      jerry_value_free (values[idx]);\n    }\n  }\n\n  test_detached_arraybuffer ();\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-unicode.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"test-common.h\"\n\nstatic bool\ntest_syntax_error (char *script_p) /**< script */\n{\n  jerry_value_t parse_result = jerry_parse ((const jerry_char_t *) script_p, strlen (script_p), NULL);\n\n  bool result = false;\n\n  if (jerry_value_is_exception (parse_result))\n  {\n    result = true;\n    TEST_ASSERT (jerry_error_type (parse_result) == JERRY_ERROR_SYNTAX);\n  }\n\n  jerry_value_free (parse_result);\n  return result;\n} /* test_syntax_error */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  if (!test_syntax_error (\"\\\\u{61}\"))\n  {\n    TEST_ASSERT (!test_syntax_error (\"\\xF0\\x90\\xB2\\x80: break \\\\u{10C80}\"));\n    /* The \\u surrogate pairs are ignored. The \\u{hex} form must be used. */\n    TEST_ASSERT (test_syntax_error (\"\\xF0\\x90\\xB2\\x80: break \\\\ud803\\\\udc80\"));\n    /* The utf8 code point and the cesu8 surrogate pair must match. */\n    TEST_ASSERT (!test_syntax_error (\"\\xF0\\x90\\xB2\\x80: break \\xed\\xa0\\x83\\xed\\xb2\\x80\"));\n\n    TEST_ASSERT (!test_syntax_error (\"$\\xF0\\x90\\xB2\\x80$: break $\\\\u{10C80}$\"));\n    TEST_ASSERT (test_syntax_error (\"$\\xF0\\x90\\xB2\\x80$: break $\\\\ud803\\\\udc80$\"));\n    TEST_ASSERT (!test_syntax_error (\"$\\xF0\\x90\\xB2\\x80$: break $\\xed\\xa0\\x83\\xed\\xb2\\x80$\"));\n  }\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-vm-exec-stop.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic jerry_value_t\nvm_exec_stop_callback (void *user_p)\n{\n  int *int_p = (int *) user_p;\n\n  if (*int_p > 0)\n  {\n    (*int_p)--;\n\n    return jerry_undefined ();\n  }\n\n  return jerry_string_sz (\"Abort script\");\n} /* vm_exec_stop_callback */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  /* Test stopping an infinite loop. */\n  if (!jerry_feature_enabled (JERRY_FEATURE_VM_EXEC_STOP))\n  {\n    return 0;\n  }\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  int countdown = 6;\n  jerry_halt_handler (16, vm_exec_stop_callback, &countdown);\n\n  const jerry_char_t inf_loop_code_src1[] = \"while(true) {}\";\n  jerry_value_t parsed_code_val = jerry_parse (inf_loop_code_src1, sizeof (inf_loop_code_src1) - 1, NULL);\n\n  TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n  jerry_value_t res = jerry_run (parsed_code_val);\n  TEST_ASSERT (countdown == 0);\n\n  TEST_ASSERT (jerry_value_is_exception (res));\n\n  jerry_value_free (res);\n  jerry_value_free (parsed_code_val);\n\n  /* A more complex example. Although the callback error is captured\n   * by the catch block, it is automatically thrown again. */\n\n  /* We keep the callback function, only the countdown is reset. */\n  countdown = 6;\n\n  const jerry_char_t inf_loop_code_src2[] = TEST_STRING_LITERAL (\"function f() { while (true) ; }\\n\"\n                                                                 \"try { f(); } catch(e) {}\");\n\n  parsed_code_val = jerry_parse (inf_loop_code_src2, sizeof (inf_loop_code_src2) - 1, NULL);\n\n  TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n  res = jerry_run (parsed_code_val);\n  TEST_ASSERT (countdown == 0);\n\n  /* The result must have an error flag which proves that\n   * the error is thrown again inside the catch block. */\n  TEST_ASSERT (jerry_value_is_exception (res));\n\n  jerry_value_free (res);\n  jerry_value_free (parsed_code_val);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-core/test-vm-throw.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"config.h\"\n#include \"test-common.h\"\n\nstatic int mode = 0;\nstatic int counter = 0;\n\nstatic void\nvm_throw_callback (const jerry_value_t error_value, /**< captured error */\n                   void *user_p) /**< user pointer */\n{\n  TEST_ASSERT (user_p == (void *) &mode);\n  counter++;\n\n  switch (mode)\n  {\n    case 0:\n    {\n      TEST_ASSERT (counter == 1);\n      TEST_ASSERT (jerry_value_is_number (error_value) && jerry_value_as_number (error_value) == -5.6);\n      break;\n    }\n    case 1:\n    {\n      TEST_ASSERT (counter == 1);\n      TEST_ASSERT (jerry_value_is_null (error_value));\n      break;\n    }\n    case 2:\n    {\n      jerry_char_t string_buf[2];\n      jerry_size_t size = sizeof (string_buf);\n\n      string_buf[0] = '\\0';\n      string_buf[1] = '\\0';\n\n      TEST_ASSERT (counter >= 1 && counter <= 3);\n      TEST_ASSERT (jerry_value_is_string (error_value));\n      TEST_ASSERT (jerry_string_size (error_value, JERRY_ENCODING_CESU8) == size);\n      TEST_ASSERT (jerry_string_to_buffer (error_value, JERRY_ENCODING_CESU8, string_buf, size) == size);\n      TEST_ASSERT (string_buf[0] == 'e' && string_buf[1] == (char) ('0' + counter));\n      break;\n    }\n    case 3:\n    {\n      TEST_ASSERT (counter == 1);\n      TEST_ASSERT (jerry_error_type (error_value) == JERRY_ERROR_RANGE);\n      break;\n    }\n    case 4:\n    {\n      TEST_ASSERT (mode == 4);\n      TEST_ASSERT (counter >= 1 && counter <= 2);\n\n      jerry_error_t error = (counter == 1) ? JERRY_ERROR_REFERENCE : JERRY_ERROR_TYPE;\n      TEST_ASSERT (jerry_error_type (error_value) == error);\n      break;\n    }\n    case 5:\n    case 6:\n    {\n      TEST_ASSERT (counter >= 1 && counter <= 2);\n      TEST_ASSERT (jerry_value_is_false (error_value));\n      break;\n    }\n    default:\n    {\n      TEST_ASSERT (mode == 8 || mode == 9);\n      TEST_ASSERT (counter == 1);\n      TEST_ASSERT (jerry_value_is_true (error_value));\n      break;\n    }\n  }\n} /* vm_throw_callback */\n\nstatic jerry_value_t\nnative_handler (const jerry_call_info_t *call_info_p, /**< call info */\n                const jerry_value_t args_p[], /**< arguments */\n                const jerry_length_t args_count) /**< arguments length */\n{\n  (void) call_info_p;\n  (void) args_p;\n  TEST_ASSERT (args_count == 0);\n\n  if (mode == 7)\n  {\n    jerry_value_t result = jerry_throw_sz (JERRY_ERROR_COMMON, \"Error!\");\n\n    TEST_ASSERT (!jerry_exception_is_captured (result));\n    jerry_exception_allow_capture (result, false);\n    TEST_ASSERT (jerry_exception_is_captured (result));\n    return result;\n  }\n\n  jerry_char_t source[] = TEST_STRING_LITERAL (\"throw false\");\n  jerry_value_t result = jerry_eval (source, sizeof (source) - 1, JERRY_PARSE_NO_OPTS);\n\n  TEST_ASSERT (jerry_exception_is_captured (result));\n\n  if (mode == 6)\n  {\n    jerry_exception_allow_capture (result, true);\n    TEST_ASSERT (!jerry_exception_is_captured (result));\n  }\n  return result;\n} /* native_handler */\n\nstatic void\ndo_eval (const char *script_p, /**< script to evaluate */\n         bool should_throw) /**< script throws an error */\n{\n  jerry_value_t result = jerry_eval ((const jerry_char_t *) script_p, strlen (script_p), JERRY_PARSE_NO_OPTS);\n  TEST_ASSERT (jerry_value_is_exception (result) == should_throw);\n  jerry_value_free (result);\n} /* do_eval */\n\nint\nmain (void)\n{\n  TEST_INIT ();\n\n  /* Test stopping an infinite loop. */\n  if (!jerry_feature_enabled (JERRY_FEATURE_VM_THROW))\n  {\n    return 0;\n  }\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_on_throw (vm_throw_callback, (void *) &mode);\n\n  mode = 0;\n  counter = 0;\n  do_eval (TEST_STRING_LITERAL (\"throw -5.6\"), true);\n  TEST_ASSERT (counter == 1);\n\n  mode = 1;\n  counter = 0;\n  do_eval (TEST_STRING_LITERAL (\"function f() { throw null }\\n\"\n                                \"function g() { f() }\\n\"\n                                \"g()\\n\"),\n           true);\n  TEST_ASSERT (counter == 1);\n\n  mode = 2;\n  counter = 0;\n  do_eval (TEST_STRING_LITERAL (\"function f() { throw 'e1' }\\n\"\n                                \"function g() { try { f() } catch (e) { throw 'e2' } }\\n\"\n                                \"try { g() } catch (e) { throw 'e3' }\\n\"),\n           true);\n  TEST_ASSERT (counter == 3);\n\n  mode = 3;\n  counter = 0;\n  do_eval (TEST_STRING_LITERAL (\"function f() { throw new RangeError() }\\n\"\n                                \"function g() { try { f() } finally { } }\\n\"\n                                \"try { g() } finally { }\\n\"),\n           true);\n  TEST_ASSERT (counter == 1);\n\n  mode = 4;\n  counter = 0;\n  do_eval (TEST_STRING_LITERAL (\"function f() { unresolved }\\n\"\n                                \"function g() { try { f() } finally { null.member } }\\n\"\n                                \"try { g() } finally { }\\n\"),\n           true);\n  TEST_ASSERT (counter == 2);\n\n  /* Native functions may trigger the call twice: */\n  jerry_value_t global_object_value = jerry_current_realm ();\n  jerry_value_t function_value = jerry_function_external (native_handler);\n  jerry_value_t function_name_value = jerry_string_sz (\"native\");\n\n  jerry_value_free (jerry_object_set (global_object_value, function_name_value, function_value));\n  jerry_value_free (function_name_value);\n  jerry_value_free (function_value);\n  jerry_value_free (global_object_value);\n\n  mode = 5;\n  counter = 0;\n  do_eval (TEST_STRING_LITERAL (\"native()\\n\"), true);\n  TEST_ASSERT (counter == 1);\n\n  mode = 6;\n  counter = 0;\n  do_eval (TEST_STRING_LITERAL (\"native()\\n\"), true);\n  TEST_ASSERT (counter == 2);\n\n  mode = 7;\n  counter = 0;\n  do_eval (TEST_STRING_LITERAL (\"native()\\n\"), true);\n  TEST_ASSERT (counter == 0);\n\n  /* Built-in functions should not trigger the call twice: */\n  mode = 8;\n  counter = 0;\n  do_eval (TEST_STRING_LITERAL (\"function f() { eval('eval(\\\\'throw true\\\\')') }\\n\"\n                                \"f()\\n\"),\n           true);\n  TEST_ASSERT (counter == 1);\n\n  mode = 9;\n  counter = 0;\n  do_eval (TEST_STRING_LITERAL (\"function f() { [1].map(function() { throw true }) }\\n\"\n                                \"f()\\n\"),\n           true);\n  TEST_ASSERT (counter == 1);\n\n  jerry_value_t value = jerry_object ();\n  TEST_ASSERT (!jerry_exception_is_captured (value));\n  jerry_exception_allow_capture (value, false);\n  TEST_ASSERT (!jerry_exception_is_captured (value));\n  jerry_value_free (value);\n\n  jerry_cleanup ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-doc/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required (VERSION 3.10)\nproject (unit-doc C)\nfind_package(PythonInterp REQUIRED)\n\nset(GEN_DOCTEST \"${CMAKE_SOURCE_DIR}/tools/gen-doctest.py\")\nset(DOC_FILES\n  \"${CMAKE_SOURCE_DIR}/docs/00.GETTING-STARTED.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/01.CONFIGURATION.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/02.API-REFERENCE.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/03.API-EXAMPLE.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/04.INTERNALS.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/05.PORT-API.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/06.REFERENCE-COUNTING.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/07.DEBUGGER.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/08.CODING-STANDARDS.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/09.EXT-REFERENCE-ARG.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/10.EXT-REFERENCE-HANDLER.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/11.EXT-REFERENCE-AUTORELEASE.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/12.EXT-REFERENCE-MODULE.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/13.DEBUGGER-TRANSPORT.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/14.EXT-REFERENCE-HANDLE-SCOPE.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/15.MODULE-SYSTEM.md\"\n  \"${CMAKE_SOURCE_DIR}/docs/16.MIGRATION-GUIDE.md\"\n)\n\nif(NOT (${CMAKE_C_COMPILER_ID} STREQUAL MSVC))\n  set(COMPILE_FLAGS_DOCTEST \"-Wno-unused-parameter -Wno-unused-function -Wno-unused-variable\")\nendif()\n\n\n# Dry run of the doctest generator: analyze MarkDown files and get the list of\n# file names that will be generated. This allows the definition of proper\n# dependencies between the MarkDown files and the generated sources.\nexecute_process(\n  COMMAND ${PYTHON_EXECUTABLE} ${GEN_DOCTEST} --dry -d ${CMAKE_CURRENT_BINARY_DIR} ${DOC_FILES}\n  OUTPUT_VARIABLE DOCTEST_OUTPUT\n  RESULT_VARIABLE GEN_DOCTEST_RESULT\n)\nif(NOT GEN_DOCTEST_RESULT EQUAL 0)\n  message(FATAL_ERROR \"failed to get doctest file list\")\nendif()\n\n# Process the output of the doctest generator: collect sources that must be\n# compiled, compiled+linked, or compiled+linked+executed into separate lists.\nset(DOCTEST_COMPILE \"\")\nset(DOCTEST_LINK \"\")\nset(DOCTEST_RUN \"\")\n\nstring(REPLACE \"\\n\" \";\" DOCTEST_LIST \"${DOCTEST_OUTPUT}\")\nforeach(DOCTEST_ELEMENT IN LISTS DOCTEST_LIST)\n  if(NOT (\"${DOCTEST_ELEMENT}\" STREQUAL \"\"))\n    separate_arguments(DOCTEST_ELEMENT)\n    list(GET DOCTEST_ELEMENT 0 DOCTEST_ACTION)\n    list(GET DOCTEST_ELEMENT 1 DOCTEST_NAME)\n    string(TOUPPER ${DOCTEST_ACTION} DOCTEST_ACTION)\n\n    set(DOCTEST_${DOCTEST_ACTION} ${DOCTEST_${DOCTEST_ACTION}} ${DOCTEST_NAME})\n  endif()\nendforeach()\n\n# Disable 02.API-REFERENCE-create-context.c on Windows, because there is no pthread on it.\nif(\"${PLATFORM}\" STREQUAL \"WINDOWS\")\n  list(REMOVE_ITEM DOCTEST_COMPILE ${CMAKE_CURRENT_BINARY_DIR}/02.API-REFERENCE-create-context.c)\nendif()\n\n# Disable 11.EXT-REFERENCE-AUTORELEASE.c if compiler is MSVC, because MSVC doesn't support cleanup attribute.\nif(USING_MSVC)\n  list(REMOVE_ITEM DOCTEST_COMPILE ${CMAKE_CURRENT_BINARY_DIR}/11.EXT-REFERENCE-AUTORELEASE.c)\nendif()\n\n# Add custom command to run doctest generator if any of the MarkDown sources\n# changes.\nadd_custom_command(\n  COMMAND ${PYTHON_EXECUTABLE} ${GEN_DOCTEST} -d ${CMAKE_CURRENT_BINARY_DIR} ${DOC_FILES}\n  DEPENDS ${GEN_DOCTEST} ${DOC_FILES}\n  OUTPUT ${DOCTEST_COMPILE} ${DOCTEST_LINK} ${DOCTEST_RUN}\n  COMMENT \"Generating doctests\"\n)\n\n# Add custom target to trigger the custom command above. Targets below can/must\n# depend on this one so that the custom command gets executed only once.\nadd_custom_target(all-doc-files DEPENDS ${DOCTEST_COMPILE} ${DOCTEST_LINK} ${DOCTEST_RUN})\n\n# Process compile-only doctests: add them to a dummy library\n# (named libcompile-doc-tests.a) to trigger compilation.\nif(NOT (\"${DOCTEST_COMPILE}\" STREQUAL \"\"))\n  add_library(compile-doc-tests ${DOCTEST_COMPILE})\n  add_dependencies(compile-doc-tests all-doc-files)\n  target_link_libraries(compile-doc-tests jerry-ext jerry-core jerry-port)\n  set_property(TARGET compile-doc-tests APPEND_STRING PROPERTY COMPILE_FLAGS \"${COMPILE_FLAGS_DOCTEST}\")\nendif()\n\nmacro(doctest_add_executables NAME_PREFIX)\n  foreach(DOCTEST_NAME ${ARGN})\n    get_filename_component(TARGET_NAME ${DOCTEST_NAME} NAME)\n    string(REGEX REPLACE \"\\\\.[^.]*$\" \"\" TARGET_NAME ${TARGET_NAME})\n    set(TARGET_NAME ${NAME_PREFIX}-${TARGET_NAME})\n\n    add_executable(${TARGET_NAME} ${DOCTEST_NAME})\n    add_dependencies(${TARGET_NAME} all-doc-files)\n    set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS \"${COMPILE_FLAGS_DOCTEST}\")\n    set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS \"${LINKER_FLAGS_COMMON}\")\n    set_property(TARGET ${TARGET_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY \"${CMAKE_BINARY_DIR}/tests\")\n    target_link_libraries(${TARGET_NAME} jerry-ext jerry-core jerry-port)\n  endforeach()\nendmacro()\n\n# Process link-only doctests: create an executable from each (named link-doc-*)\ndoctest_add_executables(\"link-doc\" ${DOCTEST_LINK})\n\n# Process \"full-fledged\" doctests: create an executable from each (named\n# unit-doc-*). Their name prefix (unit-) ensures that the unit test runner\n# script will treat them like any other unit test, i.e., executed them.\ndoctest_add_executables(\"unit-doc\" ${DOCTEST_RUN})\n"
  },
  {
    "path": "tests/unit-ext/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required (VERSION 3.10)\nproject (unit-ext C)\n\nset(INCLUDE_UNIT_EXT ${CMAKE_CURRENT_SOURCE_DIR})\n\n# Unit tests main modules\nset(SOURCE_UNIT_TEST_EXT_MODULES\n  test-ext-arg.c\n  test-ext-autorelease.c\n  test-ext-handle-scope-escape.c\n  test-ext-handle-scope-handle-prelist-escape.c\n  test-ext-handle-scope-handle-prelist.c\n  test-ext-handle-scope-nested.c\n  test-ext-handle-scope-remove.c\n  test-ext-handle-scope-root.c\n  test-ext-handle-scope.c\n  test-ext-method-register.c\n  test-ext-module-canonical.c\n  test-ext-module-empty.c\n)\n\n# Disable test-ext-autorelease.c if compiler is MSVC, because MSVC doesn't support cleanup attribute.\nif(USING_MSVC)\n  list(REMOVE_ITEM SOURCE_UNIT_TEST_EXT_MODULES test-ext-autorelease.c)\nendif()\n\n# Unit tests declaration\nadd_custom_target(unittests-ext)\n\nforeach(SOURCE_UNIT_TEST_EXT ${SOURCE_UNIT_TEST_EXT_MODULES})\n  get_filename_component(TARGET_NAME ${SOURCE_UNIT_TEST_EXT} NAME_WE)\n  set(TARGET_NAME unit-${TARGET_NAME})\n\n  add_executable(${TARGET_NAME} ${SOURCE_UNIT_TEST_EXT})\n  set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS \"${LINKER_FLAGS_COMMON}\")\n  set_property(TARGET ${TARGET_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY \"${CMAKE_BINARY_DIR}/tests\")\n\n  target_link_libraries(${TARGET_NAME} jerry-ext jerry-core jerry-port)\n\n  add_dependencies(unittests-ext ${TARGET_NAME})\nendforeach()\n\nset(UNIT_TEST_EXT_DIRS\n  module\n)\n\nforeach(UNIT_TEST_EXT_DIR ${UNIT_TEST_EXT_DIRS})\n  add_subdirectory(${UNIT_TEST_EXT_DIR})\nendforeach()\n"
  },
  {
    "path": "tests/unit-ext/module/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required (VERSION 3.10)\nset(JERRYX_MODULE_UNITTEST_NAME unit-test-jerry-module)\nproject (${JERRYX_MODULE_UNITTEST_NAME} C)\n\nset(JERRYX_MODULE_UNIT_TEST_SOURCES\n  jerry-module-test.c\n  my-broken-module.c\n  my-custom-module.c\n)\n\nif (FEATURE_INIT_FINI)\n  set(DEFINES_JERRYX_MODULE_UNITTEST ${DEFINES_JERRYX_MODULE_UNITTEST} ENABLE_INIT_FINI)\nendif()\n\nadd_executable(${JERRYX_MODULE_UNITTEST_NAME} ${JERRYX_MODULE_UNIT_TEST_SOURCES})\nset_property(TARGET ${JERRYX_MODULE_UNITTEST_NAME} PROPERTY LINK_FLAGS \"${LINKER_FLAGS_COMMON}\")\nset_property(TARGET ${JERRYX_MODULE_UNITTEST_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY \"${CMAKE_BINARY_DIR}/tests\")\ntarget_link_libraries(${JERRYX_MODULE_UNITTEST_NAME} jerry-ext jerry-core jerry-port)\ntarget_include_directories(${JERRYX_MODULE_UNITTEST_NAME} PRIVATE ${INCLUDE_UNIT_EXT})\n"
  },
  {
    "path": "tests/unit-ext/module/jerry-module-test.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <string.h>\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/module.h\"\n#include \"test-common.h\"\n\n/* Load a module. */\nconst char eval_string1[] = \"require ('my_custom_module').number_value;\";\n\n/* Load a module using a different resolver. */\nconst char eval_string2[] = \"require ('differently-handled-module');\";\n\n/* Load a broken module using the built-in resolver. */\nconst char eval_string3[] = \"(function() {\"\n                            \"  var theError;\"\n                            \"  try {\"\n                            \"    require ('my_broken_module');\"\n                            \"  } catch (anError) {\"\n                            \"    theError = anError;\"\n                            \"  }\"\n                            \"  return (((theError.message === 'Module on_resolve () must not be NULL') &&\"\n                            \"    (theError.moduleName === 'my_broken_module') &&\"\n                            \"    (theError instanceof TypeError)) ? 1 : 0);\"\n                            \"}) ();\";\n\n/* Load a non-existent module. */\nconst char eval_string4[] = \"(function() {\"\n                            \"  var theError;\"\n                            \"  try {\"\n                            \"    require ('some_missing_module_xyzzy');\"\n                            \"  } catch (anError) {\"\n                            \"    theError = anError;\"\n                            \"  }\"\n                            \"  return (((theError.message === 'Module not found') &&\"\n                            \"    (theError.moduleName === 'some_missing_module_xyzzy')) ? 1 : 0);\"\n                            \"}) ();\";\n\n/* Make sure the result of a module load is cached. */\nconst char eval_string5[] = \"(function() {\"\n                            \"  var x = require('cache-check');\"\n                            \"  var y = require('cache-check');\"\n                            \"  return x === y ? 1 : 0;\"\n                            \"}) ();\";\n\n/* Make sure the result of a module load is removed from the cache. */\nconst char eval_string6[] = \"(function() {\"\n                            \"  var x = require('cache-check');\"\n                            \"  clear_require_cache('cache-check');\"\n                            \"  var y = require('cache-check');\"\n                            \"  return x !== y ? 1 : 0;\"\n                            \"}) ();\";\n\n/* Make sure the entire cache is cleared. */\nconst char eval_string7[] = \"(function() {\"\n                            \"  var x = require('cache-check');\"\n                            \"  clear_require_cache(undefined);\"\n                            \"  var y = require('cache-check');\"\n                            \"  return x !== y ? 1 : 0;\"\n                            \"}) ();\";\n\n/* Make sure the entire cache is cleared. */\nconst char eval_string8[] =\n  \"(function() {\"\n  \"  var custom_module = require ('my_custom_module');\"\n  \"  custom_module.call_function_with_callback(function(){\"\n  \"    throw '12312391238219423914832091480921834028130948213904812093849023814902183490218394082190348'\"\n  \"  });\"\n  \"}) ();\";\n\n/*\n * Define a resolver for a module named \"differently-handled-module\" to check that custom resolvers work.\n */\nstatic bool\nresolve_differently_handled_module (const jerry_value_t name, jerry_value_t *result)\n{\n  jerry_size_t name_size = jerry_string_size (name, JERRY_ENCODING_UTF8);\n  JERRY_VLA (jerry_char_t, name_string, name_size);\n  jerry_string_to_buffer (name, JERRY_ENCODING_UTF8, name_string, name_size);\n\n  if (!strncmp ((char *) name_string, \"differently-handled-module\", name_size))\n  {\n    (*result) = jerry_number (29);\n    return true;\n  }\n  return false;\n} /* resolve_differently_handled_module */\n\nstatic jerryx_module_resolver_t differently_handled_module_resolver = { NULL, resolve_differently_handled_module };\n\n/*\n * Define module \"cache-check\" via its own resolver as an empty object. Since objects are accessible only via references\n * we can strictly compare the object returned on subsequent attempts at loading \"cache-check\" with the object returned\n * on the first attempt and establish that the two are in fact the same object - which in turn shows that caching works.\n */\nstatic bool\ncache_check (const jerry_value_t name, jerry_value_t *result)\n{\n  jerry_size_t name_size = jerry_string_size (name, JERRY_ENCODING_UTF8);\n  JERRY_VLA (jerry_char_t, name_string, name_size);\n  jerry_string_to_buffer (name, JERRY_ENCODING_UTF8, name_string, name_size);\n\n  if (!strncmp ((char *) name_string, \"cache-check\", name_size))\n  {\n    (*result) = jerry_object ();\n    return true;\n  }\n  return false;\n} /* cache_check */\n\nstatic jerryx_module_resolver_t cache_check_resolver = { NULL, cache_check };\n\nstatic const jerryx_module_resolver_t *resolvers[3] = { &jerryx_module_native_resolver,\n                                                        &differently_handled_module_resolver,\n                                                        &cache_check_resolver };\n\nstatic jerry_value_t\nhandle_clear_require_cache (const jerry_call_info_t *call_info_p,\n                            const jerry_value_t args_p[],\n                            const jerry_length_t args_count)\n{\n  (void) call_info_p;\n  (void) args_count;\n\n  TEST_ASSERT (args_count == 1);\n  jerryx_module_clear_cache (args_p[0], resolvers, 3);\n\n  return 0;\n} /* handle_clear_require_cache */\n\nstatic jerry_value_t\nhandle_require (const jerry_call_info_t *call_info_p, const jerry_value_t args_p[], const jerry_length_t args_count)\n{\n  (void) call_info_p;\n  (void) args_count;\n\n  jerry_value_t return_value = 0;\n\n  TEST_ASSERT (args_count == 1);\n  return_value = jerryx_module_resolve (args_p[0], resolvers, 3);\n\n  return return_value;\n} /* handle_require */\n\nstatic void\nassert_number (jerry_value_t js_value, double expected_result)\n{\n  TEST_ASSERT (!jerry_value_is_exception (js_value));\n  TEST_ASSERT (jerry_value_as_number (js_value) == expected_result);\n} /* assert_number */\n\nstatic jerry_value_t\neval_string (const char *the_string)\n{\n  return jerry_eval ((const jerry_char_t *) the_string, strlen (the_string), JERRY_PARSE_STRICT_MODE);\n} /* eval_string */\n\nstatic void\neval_one (const char *the_string, double expected_result)\n{\n  jerry_value_t js_eval_result =\n    jerry_eval ((const jerry_char_t *) the_string, strlen (the_string), JERRY_PARSE_STRICT_MODE);\n  assert_number (js_eval_result, expected_result);\n  jerry_value_free (js_eval_result);\n} /* eval_one */\n\n#ifndef ENABLE_INIT_FINI\nextern void my_broken_module_register (void);\nextern void my_custom_module_register (void);\n#endif /* !ENABLE_INIT_FINI */\n\nint\nmain (int argc, char **argv)\n{\n  (void) argc;\n  (void) argv;\n  jerry_value_t js_global = 0, js_function = 0, js_property_name = 0;\n  jerry_value_t res;\n\n#ifndef ENABLE_INIT_FINI\n  my_broken_module_register ();\n  my_custom_module_register ();\n#endif /* !ENABLE_INIT_FINI */\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  js_global = jerry_current_realm ();\n\n  js_function = jerry_function_external (handle_require);\n  js_property_name = jerry_string_sz (\"require\");\n  res = jerry_object_set (js_global, js_property_name, js_function);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_boolean (res) && jerry_value_is_true (res));\n  jerry_value_free (res);\n  jerry_value_free (js_property_name);\n  jerry_value_free (js_function);\n\n  js_function = jerry_function_external (handle_clear_require_cache);\n  js_property_name = jerry_string_sz (\"clear_require_cache\");\n  res = jerry_object_set (js_global, js_property_name, js_function);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (jerry_value_is_boolean (res) && jerry_value_is_true (res));\n  jerry_value_free (res);\n  jerry_value_free (js_property_name);\n  jerry_value_free (js_function);\n\n  jerry_value_free (js_global);\n\n  eval_one (eval_string1, 42);\n  eval_one (eval_string2, 29);\n  eval_one (eval_string3, 1);\n  eval_one (eval_string4, 1);\n  eval_one (eval_string5, 1);\n  eval_one (eval_string6, 1);\n  eval_one (eval_string7, 1);\n\n  jerry_value_t val_err = eval_string (eval_string8);\n  TEST_ASSERT (jerry_value_is_exception (val_err));\n  jerry_value_free (val_err);\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/module/my-broken-module.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/module.h\"\n\n#define MODULE_NAME my_broken_module\n\n/*\n * A broken module to test that the loader complains about the absence of on_resolve ()\n */\nJERRYX_NATIVE_MODULE (MODULE_NAME, NULL)\n"
  },
  {
    "path": "tests/unit-ext/module/my-custom-module.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/module.h\"\n\n#define MODULE_NAME my_custom_module\n\nstatic void\njobject_set_property_jval (jerry_value_t jobj, const char *name, jerry_value_t value)\n{\n  jerry_value_t prop_name = jerry_string_sz (name);\n  jerry_value_t ret_val = jerry_object_set (jobj, prop_name, value);\n  jerry_value_free (prop_name);\n  jerry_value_free (ret_val);\n} /* jobject_set_property_jval */\n\nstatic jerry_value_t\ncall_function_with_callback (const jerry_call_info_t *call_info_p,\n                             const jerry_value_t jargv[],\n                             const jerry_length_t jargc)\n{\n  (void) jargc;\n  jerry_value_t jval_func = jargv[0];\n  return jerry_call (jval_func, call_info_p->this_value, NULL, 0);\n} /* call_function_with_callback */\n\nstatic jerry_value_t\nmy_custom_module_on_resolve (void)\n{\n  jerry_value_t mymodule = jerry_object ();\n  jerry_value_t val = jerry_number (42);\n  jobject_set_property_jval (mymodule, \"number_value\", val);\n  jerry_value_free (val);\n\n  jerry_value_t jfunc = jerry_function_external (call_function_with_callback);\n  jobject_set_property_jval (mymodule, \"call_function_with_callback\", jfunc);\n  jerry_value_free (jfunc);\n\n  return mymodule;\n} /* my_custom_module_on_resolve */\n\nJERRYX_NATIVE_MODULE (MODULE_NAME, my_custom_module_on_resolve)\n"
  },
  {
    "path": "tests/unit-ext/test-common.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef TEST_COMMON_H\n#define TEST_COMMON_H\n\n#include \"jerryscript-port.h\"\n\n#define ARRAY_SIZE(array) ((unsigned long) (sizeof (array) / sizeof ((array)[0])))\n\n#define JERRY_UNUSED(x) ((void) (x))\n\n#define TEST_ASSERT(x)                                           \\\n  do                                                             \\\n  {                                                              \\\n    if (!(x))                                                    \\\n    {                                                            \\\n      jerry_log (JERRY_LOG_LEVEL_ERROR,                          \\\n                 \"TEST: Assertion '%s' failed at %s(%s):%lu.\\n\", \\\n                 #x,                                             \\\n                 __FILE__,                                       \\\n                 __func__,                                       \\\n                 (unsigned long) __LINE__);                      \\\n      jerry_port_fatal (JERRY_FATAL_FAILED_ASSERTION);           \\\n    }                                                            \\\n  } while (0)\n\n#define TEST_STRING_LITERAL(x) x\n\n#endif /* !TEST_COMMON_H */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-arg.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for jerry-ext/args.\n */\n\n#include <string.h>\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/arg.h\"\n#include \"test-common.h\"\n\nstatic const jerry_char_t test_source[] =\n  TEST_STRING_LITERAL (\"var arg1 = true;\"\n                       \"var arg2 = 10.5;\"\n                       \"var arg3 = 'abc';\"\n                       \"var arg4 = function foo() {};\"\n                       \"test_validator1(arg1, arg2, arg3, arg4);\"\n                       \"arg1 = new Boolean(true);\"\n                       \"arg3 = new String('abc');\"\n                       \"test_validator1(arg1, arg2, arg3);\"\n                       \"test_validator1(arg1, arg2, '');\"\n                       \"arg2 = new Number(10.5);\"\n                       \"test_validator1(arg1, arg2, arg3);\"\n                       \"test_validator1(arg1, 10.5, 'abcdef');\"\n                       \"test_validator3(arg1, arg1);\"\n                       \"test_validator3(arg1);\"\n                       \"test_validator3();\"\n                       \"test_validator3(undefined, undefined);\"\n                       \"var obj_a = new MyObjectA();\"\n                       \"var obj_b = new MyObjectB();\"\n                       \"test_validator2.call(obj_a, 5);\"\n                       \"test_validator2.call(obj_b, 5);\"\n                       \"test_validator2.call(obj_a, 1);\"\n                       \"var obj1 = {prop1:true, prop2:'1.5'};\"\n                       \"test_validator_prop1(obj1);\"\n                       \"test_validator_prop2(obj1);\"\n                       \"test_validator_prop2();\"\n                       \"var obj2 = {prop1:true};\"\n                       \"Object.defineProperty(obj2, 'prop2', {\"\n                       \"  get: function() { throw new TypeError('prop2 error') }\"\n                       \"});\"\n                       \"test_validator_prop3(obj2);\"\n                       \"test_validator_int1(-1000, 1000, 128, -1000, 1000, -127,\"\n                       \"                    -1000, 4294967297, 65536, -2200000000, 4294967297, -2147483647);\"\n                       \"test_validator_int2(-1.5, -1.5, -1.5, 1.5, 1.5, 1.5, Infinity, -Infinity, 300.5, 300.5);\"\n                       \"test_validator_int3(NaN);\"\n                       \"var arr = [1, 2];\"\n                       \"test_validator_array1(arr);\"\n                       \"test_validator_array1();\"\n                       \"test_validator_array2(arr);\"\n                       \"test_validator_restore(false, 3.0);\"\n                       \"test_validator_restore(3.0, false);\");\n\nstatic const jerry_object_native_info_t thing_a_info = {\n  .free_cb = NULL,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic const jerry_object_native_info_t thing_b_info = {\n  .free_cb = NULL,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\ntypedef struct\n{\n  int x;\n} my_type_a_t;\n\ntypedef struct\n{\n  bool x;\n} my_type_b_t;\n\nstatic my_type_a_t my_thing_a;\nstatic my_type_b_t my_thing_b;\n\nstatic int validator1_count = 0;\nstatic int validator2_count = 0;\nstatic int validator3_count = 0;\nstatic int validator_int_count = 0;\nstatic int validator_prop_count = 0;\nstatic int validator_array_count = 0;\nstatic int validator_restore_count = 0;\n\n/**\n * The handler should have following arguments:\n *   this: Ignore.\n *   arg1: Bool.\n *   arg2: Number. It must be strict primitive number.\n *   arg3: String.\n *   arg4: function. It is an optional argument.\n *\n */\nstatic jerry_value_t\ntest_validator1_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                         const jerry_value_t args_p[], /**< arguments list */\n                         const jerry_length_t args_cnt) /**< arguments length */\n{\n  bool arg1;\n  double arg2 = 0.0;\n  char arg3[5] = \"1234\";\n  jerry_value_t arg4 = jerry_undefined ();\n\n  jerryx_arg_t mapping[] = { /* ignore this */\n                             jerryx_arg_ignore (),\n                             /* 1st argument should be boolean */\n                             jerryx_arg_boolean (&arg1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n                             /* 2nd argument should be strict number */\n                             jerryx_arg_number (&arg2, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),\n                             /* 3th argument should be string */\n                             jerryx_arg_string (arg3, 5, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n                             /* 4th argument should be function, and it is optional */\n                             jerryx_arg_function (&arg4, JERRYX_ARG_OPTIONAL)\n  };\n\n  jerry_value_t is_ok =\n    jerryx_arg_transform_this_and_args (call_info_p->this_value, args_p, args_cnt, mapping, ARRAY_SIZE (mapping));\n\n  if (validator1_count == 0)\n  {\n    TEST_ASSERT (!jerry_value_is_exception (is_ok));\n    TEST_ASSERT (arg1);\n    TEST_ASSERT (arg2 == 10.5);\n    TEST_ASSERT (strcmp (arg3, \"abc\") == 0);\n    TEST_ASSERT (jerry_value_is_function (arg4));\n  }\n  else if (validator1_count == 1)\n  {\n    TEST_ASSERT (!jerry_value_is_exception (is_ok));\n    TEST_ASSERT (arg1);\n    TEST_ASSERT (arg2 == 10.5);\n    TEST_ASSERT (strcmp (arg3, \"abc\") == 0);\n    TEST_ASSERT (jerry_value_is_undefined (arg4));\n  }\n  else if (validator1_count == 2)\n  {\n    TEST_ASSERT (!jerry_value_is_exception (is_ok));\n    TEST_ASSERT (arg1);\n    TEST_ASSERT (arg2 == 10.5);\n    TEST_ASSERT (strcmp (arg3, \"\") == 0);\n    TEST_ASSERT (jerry_value_is_undefined (arg4));\n  }\n  else\n  {\n    TEST_ASSERT (jerry_value_is_exception (is_ok));\n  }\n\n  jerry_value_free (is_ok);\n  jerry_value_free (arg4);\n  validator1_count++;\n\n  return jerry_undefined ();\n} /* test_validator1_handler */\n\n/**\n * The JS argument should be number, whose value is equal with the extra_info .\n */\nstatic jerry_value_t\nmy_custom_transform (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */\n                     const jerryx_arg_t *c_arg_p) /**< the native arg */\n{\n  jerry_value_t js_arg = jerryx_arg_js_iterator_pop (js_arg_iter_p);\n  jerry_value_t to_number = jerry_value_to_number (js_arg);\n\n  if (jerry_value_is_exception (to_number))\n  {\n    jerry_value_free (to_number);\n\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"It can not be converted to a number.\");\n  }\n\n  int expected_num = (int) c_arg_p->extra_info;\n  int get_num = (int) jerry_value_as_number (to_number);\n\n  if (get_num != expected_num)\n  {\n    return jerry_throw_sz (JERRY_ERROR_TYPE, \"Number value is not expected.\");\n  }\n\n  return jerry_undefined ();\n} /* my_custom_transform */\n\n/**\n * The handler should have following arguments:\n *   this: with native pointer whose type is bind_a_info.\n *   arg1: should pass the custom tranform function.\n */\nstatic jerry_value_t\ntest_validator2_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                         const jerry_value_t args_p[], /**< arguments list */\n                         const jerry_length_t args_cnt) /**< arguments length */\n{\n  my_type_a_t *thing_p;\n\n  jerryx_arg_t mapping[] = { /* this should has native pointer, whose type is thing_a_info */\n                             jerryx_arg_native_pointer ((void **) &thing_p, &thing_a_info, JERRYX_ARG_REQUIRED),\n                             /* custom tranform function */\n                             jerryx_arg_custom (NULL, 5, my_custom_transform)\n  };\n\n  jerry_value_t is_ok =\n    jerryx_arg_transform_this_and_args (call_info_p->this_value, args_p, args_cnt, mapping, ARRAY_SIZE (mapping));\n\n  if (validator2_count == 0)\n  {\n    TEST_ASSERT (!jerry_value_is_exception (is_ok));\n    TEST_ASSERT (thing_p == &my_thing_a);\n    TEST_ASSERT (thing_p->x == 1);\n  }\n  else\n  {\n    TEST_ASSERT (jerry_value_is_exception (is_ok));\n  }\n\n  jerry_value_free (is_ok);\n  validator2_count++;\n\n  return jerry_undefined ();\n} /* test_validator2_handler */\n\n/**\n * The handler should have following arguments:\n *   arg1: Bool. It is an optional argument.\n *\n */\nstatic jerry_value_t\ntest_validator3_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                         const jerry_value_t args_p[], /**< arguments list */\n                         const jerry_length_t args_cnt) /**< arguments length */\n{\n  bool arg1 = false;\n  bool arg2 = false;\n\n  jerryx_arg_t mapping[] = {\n    /* ignore this */\n    jerryx_arg_ignore (),\n    /* 1th argument should be boolean, and it is optional */\n    jerryx_arg_boolean (&arg1, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL),\n    /* 2nd argument should be boolean, and it is optional */\n    jerryx_arg_boolean (&arg2, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL),\n  };\n\n  jerry_value_t is_ok =\n    jerryx_arg_transform_this_and_args (call_info_p->this_value, args_p, args_cnt, mapping, ARRAY_SIZE (mapping));\n\n  if (validator3_count == 0)\n  {\n    TEST_ASSERT (!jerry_value_is_exception (is_ok));\n    TEST_ASSERT (arg1);\n    TEST_ASSERT (arg2);\n  }\n  else if (validator3_count == 1)\n  {\n    TEST_ASSERT (!jerry_value_is_exception (is_ok));\n    TEST_ASSERT (arg1);\n    /* arg2 must be unchanged */\n    TEST_ASSERT (!arg2);\n  }\n  else if (validator3_count == 2)\n  {\n    TEST_ASSERT (!jerry_value_is_exception (is_ok));\n    /* arg1 must be unchanged */\n    TEST_ASSERT (!arg1);\n    /* arg2 must be unchanged */\n    TEST_ASSERT (!arg2);\n  }\n  else if (validator3_count == 3)\n  {\n    TEST_ASSERT (!jerry_value_is_exception (is_ok));\n    /* arg1 must be unchanged */\n    TEST_ASSERT (!arg1);\n    /* arg2 must be unchanged */\n    TEST_ASSERT (!arg2);\n  }\n\n  jerry_value_free (is_ok);\n  validator3_count++;\n\n  return jerry_undefined ();\n} /* test_validator3_handler */\n\n/**\n * Calling jerryx_arg_transform_object_properties directly.\n */\nstatic jerry_value_t\ntest_validator_prop1_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                              const jerry_value_t args_p[], /**< arguments list */\n                              const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n  JERRY_UNUSED (args_cnt);\n\n  bool native1 = false;\n  double native2 = 0;\n  double native3 = 3;\n\n  const char *name_p[] = { \"prop1\", \"prop2\", \"prop3\" };\n\n  jerryx_arg_t mapping[] = { jerryx_arg_boolean (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n                             jerryx_arg_number (&native2, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n                             jerryx_arg_number (&native3, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL) };\n\n  jerry_value_t is_ok = jerryx_arg_transform_object_properties (args_p[0],\n                                                                (const jerry_char_t **) name_p,\n                                                                ARRAY_SIZE (name_p),\n                                                                mapping,\n                                                                ARRAY_SIZE (mapping));\n\n  TEST_ASSERT (!jerry_value_is_exception (is_ok));\n  TEST_ASSERT (native1);\n  TEST_ASSERT (native2 == 1.5);\n  TEST_ASSERT (native3 == 3);\n\n  validator_prop_count++;\n\n  return jerry_undefined ();\n} /* test_validator_prop1_handler */\n\n/**\n * Calling jerryx_arg_transform_object_properties indirectly by\n * using jerryx_arg_object_properties.\n */\nstatic jerry_value_t\ntest_validator_prop2_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                              const jerry_value_t args_p[], /**< arguments list */\n                              const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n\n  bool native1 = false;\n  double native2 = 0;\n  double native3 = 3;\n\n  jerryx_arg_object_props_t prop_info;\n\n  const char *name_p[] = { \"prop1\", \"prop2\", \"prop3\" };\n\n  jerryx_arg_t prop_mapping[] = { jerryx_arg_boolean (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n                                  jerryx_arg_number (&native2, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n                                  jerryx_arg_number (&native3, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL) };\n\n  prop_info.name_p = (const jerry_char_t **) name_p;\n  prop_info.name_cnt = 3;\n  prop_info.c_arg_p = prop_mapping;\n  prop_info.c_arg_cnt = 3;\n\n  jerryx_arg_t mapping[] = {\n    jerryx_arg_object_properties (&prop_info, JERRYX_ARG_OPTIONAL),\n  };\n\n  jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, mapping, ARRAY_SIZE (mapping));\n\n  TEST_ASSERT (!jerry_value_is_exception (is_ok));\n\n  if (validator_prop_count == 1)\n  {\n    TEST_ASSERT (native1);\n    TEST_ASSERT (native2 == 1.5);\n    TEST_ASSERT (native3 == 3);\n  }\n\n  validator_prop_count++;\n\n  return jerry_undefined ();\n} /* test_validator_prop2_handler */\n\nstatic jerry_value_t\ntest_validator_prop3_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                              const jerry_value_t args_p[], /**< arguments list */\n                              const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n  JERRY_UNUSED (args_cnt);\n\n  bool native1 = false;\n  bool native2 = true;\n\n  const char *name_p[] = { \"prop1\", \"prop2\" };\n\n  jerryx_arg_t mapping[] = {\n    jerryx_arg_boolean (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_boolean (&native2, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n  };\n\n  jerry_value_t is_ok = jerryx_arg_transform_object_properties (args_p[0],\n                                                                (const jerry_char_t **) name_p,\n                                                                ARRAY_SIZE (name_p),\n                                                                mapping,\n                                                                ARRAY_SIZE (mapping));\n\n  TEST_ASSERT (jerry_value_is_exception (is_ok));\n  TEST_ASSERT (!native1);\n  TEST_ASSERT (native2);\n\n  validator_prop_count++;\n  jerry_value_free (is_ok);\n\n  return jerry_undefined ();\n} /* test_validator_prop3_handler */\n\n/*\n * args_p[0-2] are uint8, args_p[3-5] are int8, args_p[6-8] are uint32, args_p[9-11] are int32.\n */\nstatic jerry_value_t\ntest_validator_int1_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                             const jerry_value_t args_p[], /**< arguments list */\n                             const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n\n  uint8_t num0, num1, num2;\n  int8_t num3, num4, num5;\n  uint32_t num6, num7, num8;\n  int32_t num9, num10, num11;\n\n  jerryx_arg_t mapping[] = {\n    jerryx_arg_uint8 (&num0, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_uint8 (&num1, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_uint8 (&num2, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num3, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num4, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num5, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_uint32 (&num6, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_uint32 (&num7, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_uint32 (&num8, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int32 (&num9, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int32 (&num10, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int32 (&num11, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED)\n  };\n\n  jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, mapping, ARRAY_SIZE (mapping));\n\n  TEST_ASSERT (!jerry_value_is_exception (is_ok));\n  TEST_ASSERT (num0 == 0);\n  TEST_ASSERT (num1 == 255);\n  TEST_ASSERT (num2 == 128);\n  TEST_ASSERT (num3 == -128);\n  TEST_ASSERT (num4 == 127);\n  TEST_ASSERT (num5 == -127);\n  TEST_ASSERT (num6 == 0);\n  TEST_ASSERT (num7 == 4294967295);\n  TEST_ASSERT (num8 == 65536);\n  TEST_ASSERT (num9 == -2147483648);\n  TEST_ASSERT (num10 == 2147483647);\n  TEST_ASSERT (num11 == -2147483647);\n\n  jerry_value_free (is_ok);\n  validator_int_count++;\n\n  return jerry_undefined ();\n} /* test_validator_int1_handler */\n\nstatic jerry_value_t\ntest_validator_int2_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                             const jerry_value_t args_p[], /**< arguments list */\n                             const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n\n  int8_t num0, num1, num2, num3, num4, num5, num6, num7, num8, num9;\n  num8 = 123;\n  num9 = 123;\n\n  jerryx_arg_t mapping[] = {\n    jerryx_arg_int8 (&num0, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num1, JERRYX_ARG_FLOOR, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num2, JERRYX_ARG_CEIL, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num3, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num4, JERRYX_ARG_FLOOR, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num5, JERRYX_ARG_CEIL, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num6, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num7, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num8, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n    jerryx_arg_int8 (&num9, JERRYX_ARG_ROUND, JERRYX_ARG_NO_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n  };\n\n  jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, mapping, ARRAY_SIZE (mapping));\n\n  TEST_ASSERT (jerry_value_is_exception (is_ok));\n  TEST_ASSERT (num0 == -2);\n  TEST_ASSERT (num1 == -2);\n  TEST_ASSERT (num2 == -1);\n  TEST_ASSERT (num3 == 2);\n  TEST_ASSERT (num4 == 1);\n  TEST_ASSERT (num5 == 2);\n  TEST_ASSERT (num6 == 127);\n  TEST_ASSERT (num7 == -128);\n  TEST_ASSERT (num8 == 127);\n  TEST_ASSERT (num9 == 123);\n\n  jerry_value_free (is_ok);\n  validator_int_count++;\n\n  return jerry_undefined ();\n} /* test_validator_int2_handler */\n\nstatic jerry_value_t\ntest_validator_int3_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                             const jerry_value_t args_p[], /**< arguments list */\n                             const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n\n  int8_t num0;\n\n  jerryx_arg_t mapping[] = {\n    jerryx_arg_int8 (&num0, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n  };\n\n  jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, mapping, ARRAY_SIZE (mapping));\n\n  TEST_ASSERT (jerry_value_is_exception (is_ok));\n\n  jerry_value_free (is_ok);\n  validator_int_count++;\n\n  return jerry_undefined ();\n} /* test_validator_int3_handler */\n\nstatic jerry_value_t\ntest_validator_array1_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                               const jerry_value_t args_p[], /**< arguments list */\n                               const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n\n  double native1 = 0;\n  double native2 = 0;\n  double native3 = 0;\n\n  jerryx_arg_array_items_t arr_info;\n\n  jerryx_arg_t item_mapping[] = { jerryx_arg_number (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n                                  jerryx_arg_number (&native2, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n                                  jerryx_arg_number (&native3, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL) };\n\n  arr_info.c_arg_p = item_mapping;\n  arr_info.c_arg_cnt = 3;\n\n  jerryx_arg_t mapping[] = {\n    jerryx_arg_array (&arr_info, JERRYX_ARG_OPTIONAL),\n  };\n\n  jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, mapping, ARRAY_SIZE (mapping));\n\n  TEST_ASSERT (!jerry_value_is_exception (is_ok));\n\n  if (validator_array_count == 0)\n  {\n    TEST_ASSERT (native1 == 1);\n    TEST_ASSERT (native2 == 2);\n    TEST_ASSERT (native3 == 0);\n  }\n\n  validator_array_count++;\n\n  return jerry_undefined ();\n} /* test_validator_array1_handler */\n\nstatic jerry_value_t\ntest_validator_array2_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                               const jerry_value_t args_p[], /**< arguments list */\n                               const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n  JERRY_UNUSED (args_cnt);\n\n  double native1 = 0;\n  bool native2 = false;\n\n  jerryx_arg_t item_mapping[] = { jerryx_arg_number (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n                                  jerryx_arg_boolean (&native2, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED) };\n\n  jerry_value_t is_ok = jerryx_arg_transform_array (args_p[0], item_mapping, ARRAY_SIZE (item_mapping));\n\n  TEST_ASSERT (jerry_value_is_exception (is_ok));\n  TEST_ASSERT (native1 == 1);\n  TEST_ASSERT (!native2);\n\n  validator_array_count++;\n  jerry_value_free (is_ok);\n\n  return jerry_undefined ();\n} /* test_validator_array2_handler */\n\n/**\n * This validator is designed to test the\n * jerryx_arg_js_iterator_restore function.  We'll introduce a union\n * type to hold a bool or double and a transform function that will\n * look for this type.  Then, we'll call the handler with two\n * parameters, one bool and one double and see if we correctly build\n * the union types for each parameter.  To check that the code protects\n * against backing up too far, when the check for the double fails,\n * we'll \"restore\" the stack three times; this shouldn't break\n * anything.\n */\n/*\n * This enumeration type specifies the kind of thing held in the union.\n */\ntypedef enum\n{\n  DOUBLE_VALUE,\n  BOOL_VALUE\n} union_type_t;\n\n/*\n * This struct holds either a boolean or double in a union and has a\n * second field that describes the type held in the union.\n */\ntypedef struct\n{\n  union_type_t type_of_value;\n  union\n  {\n    double double_field;\n    bool bool_field;\n  } value;\n} double_or_bool_t;\n\n/**\n * This creates a jerryx_arg_t that can be used like any\n * of the installed functions, like jerryx_arg_bool().\n */\n#define jerryx_arg_double_or_bool_t(value_ptr, coerce_or_not, optional_or_not, last_parameter)                 \\\n  jerryx_arg_custom (                                                                                          \\\n    value_ptr,                                                                                                 \\\n    (uintptr_t)                                                                                                \\\n      & ((uintptr_t[]){ (uintptr_t) coerce_or_not, (uintptr_t) optional_or_not, (uintptr_t) last_parameter }), \\\n    jerry_arg_to_double_or_bool_t)\n/*\n * This function is the argument validator used in the above macro called\n * jerryx_arg_double_or_bool. It calls jerryx_arg_js_iterator_restore()\n * more times than it should to ensure that calling that function too\n * often doesn't cause an error.\n */\nstatic jerry_value_t\njerry_arg_to_double_or_bool_t (jerryx_arg_js_iterator_t *js_arg_iter_p, const jerryx_arg_t *c_arg_p)\n{\n  /* c_arg_p has two fields: dest, which is a pointer to the data that\n   * gets filled in, and extra_info, which contains the flags used to\n   * control coercion and optional-ness, respectively. For this test,\n   * we added an extra flag that tells us that we're working on the\n   * last parameter; when we know it's the last parameter, we'll \"restore\"\n   * the stack more times than there are actual stack values to ensure\n   * that the restore function doesn't produce an error. */\n  double_or_bool_t *destination = c_arg_p->dest;\n  uintptr_t *extra_info = (uintptr_t *) (c_arg_p->extra_info);\n  jerryx_arg_t conversion_function;\n  jerry_value_t conversion_result;\n  jerry_value_t restore_result;\n  bool last_parameter = (extra_info[2] == 1);\n\n  validator_restore_count++;\n\n  conversion_function = jerryx_arg_number ((double *) (&(destination->value.double_field)),\n                                           (jerryx_arg_coerce_t) extra_info[0],\n                                           JERRYX_ARG_OPTIONAL);\n  conversion_result = conversion_function.func (js_arg_iter_p, &conversion_function);\n  if (!jerry_value_is_exception (conversion_result))\n  {\n    if (last_parameter)\n    {\n      /* The stack is only two parameters high, but we want to ensure that\n       * excessive calls will not result in aberrant behavior... */\n      jerryx_arg_js_iterator_restore (js_arg_iter_p);\n      jerryx_arg_js_iterator_restore (js_arg_iter_p);\n      jerryx_arg_js_iterator_restore (js_arg_iter_p);\n      restore_result = jerryx_arg_js_iterator_restore (js_arg_iter_p);\n      TEST_ASSERT (jerry_value_is_undefined (restore_result));\n    }\n\n    destination->type_of_value = DOUBLE_VALUE;\n    return conversion_result;\n  }\n\n  jerryx_arg_js_iterator_restore (js_arg_iter_p);\n\n  conversion_function = jerryx_arg_boolean ((bool *) (&(destination->value.bool_field)),\n                                            (jerryx_arg_coerce_t) extra_info[0],\n                                            (jerryx_arg_optional_t) extra_info[1]);\n\n  jerry_value_free (conversion_result);\n  conversion_result = conversion_function.func (js_arg_iter_p, &conversion_function);\n  if (!jerry_value_is_exception (conversion_result))\n  {\n    if (last_parameter)\n    {\n      /* The stack is only two parameters high, but we want to ensure that\n       * excessive calls will not result in aberrant behavior... */\n      jerryx_arg_js_iterator_restore (js_arg_iter_p);\n      jerryx_arg_js_iterator_restore (js_arg_iter_p);\n      jerryx_arg_js_iterator_restore (js_arg_iter_p);\n      restore_result = jerryx_arg_js_iterator_restore (js_arg_iter_p);\n      TEST_ASSERT (jerry_value_is_undefined (restore_result));\n    }\n\n    destination->type_of_value = BOOL_VALUE;\n    return conversion_result;\n  }\n\n  /* Fall through indicates that whatever they gave us, it wasn't\n   * one of the types we were expecting... */\n  jerry_value_free (conversion_result);\n  return jerry_throw_sz (JERRY_ERROR_TYPE, \"double_or_bool-type error.\");\n} /* jerry_arg_to_double_or_bool_t */\n\n/**\n * This validator expects two parameters, one a bool and one a double -- the\n * order doesn't matter (so we'll call it twice with the orders reversed).\n */\nstatic jerry_value_t\ntest_validator_restore_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                                const jerry_value_t args_p[], /**< arguments list */\n                                const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (call_info_p);\n\n  double_or_bool_t arg1;\n  double_or_bool_t arg2;\n\n  jerryx_arg_t item_mapping[] = { jerryx_arg_double_or_bool_t (&arg1, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED, 0),\n                                  jerryx_arg_double_or_bool_t (&arg2, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED, 1) };\n\n  jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, item_mapping, ARRAY_SIZE (item_mapping));\n\n  TEST_ASSERT (!jerry_value_is_exception (is_ok));\n\n  /* We are going to call this with [false, 3.0] and [3.0, false] parameters... */\n  bool arg1_is_false = (arg1.type_of_value == BOOL_VALUE && arg1.value.bool_field == false);\n  bool arg1_is_three = (arg1.type_of_value == DOUBLE_VALUE && arg1.value.double_field == 3.0);\n  bool arg2_is_false = (arg2.type_of_value == BOOL_VALUE && arg2.value.bool_field == false);\n  bool arg2_is_three = (arg2.type_of_value == DOUBLE_VALUE && arg2.value.double_field == 3.0);\n  TEST_ASSERT ((arg1_is_false && arg2_is_three) || (arg1_is_three && arg2_is_false));\n\n  jerry_value_free (is_ok);\n\n  return jerry_undefined ();\n} /* test_validator_restore_handler */\n\nstatic void\ntest_utf8_string (void)\n{\n  /* test string: 'str: {DESERET CAPITAL LETTER LONG I}' */\n  jerry_value_t str = jerry_string_sz (\"\\x73\\x74\\x72\\x3a \\xed\\xa0\\x81\\xed\\xb0\\x80\");\n  char expect_utf8_buf[] = \"\\x73\\x74\\x72\\x3a \\xf0\\x90\\x90\\x80\";\n  size_t buf_len = sizeof (expect_utf8_buf) - 1;\n  JERRY_VLA (char, buf, buf_len + 1);\n\n  jerryx_arg_t mapping[] = {\n    jerryx_arg_utf8_string (buf, (uint32_t) buf_len + 1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),\n  };\n\n  jerry_value_t is_ok = jerryx_arg_transform_args (&str, 1, mapping, ARRAY_SIZE (mapping));\n\n  TEST_ASSERT (!jerry_value_is_exception (is_ok));\n  TEST_ASSERT (!strcmp (buf, expect_utf8_buf));\n\n  jerry_value_free (str);\n} /* test_utf8_string */\n\nstatic jerry_value_t\ncreate_object_a_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                         const jerry_value_t args_p[], /**< arguments list */\n                         const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (args_p);\n  JERRY_UNUSED (args_cnt);\n\n  TEST_ASSERT (jerry_value_is_object (call_info_p->this_value));\n\n  my_thing_a.x = 1;\n  jerry_object_set_native_ptr (call_info_p->this_value, &thing_a_info, &my_thing_a);\n\n  return jerry_boolean (true);\n} /* create_object_a_handler */\n\nstatic jerry_value_t\ncreate_object_b_handler (const jerry_call_info_t *call_info_p, /**< call information */\n                         const jerry_value_t args_p[], /**< arguments list */\n                         const jerry_length_t args_cnt) /**< arguments length */\n{\n  JERRY_UNUSED (args_p);\n  JERRY_UNUSED (args_cnt);\n\n  TEST_ASSERT (jerry_value_is_object (call_info_p->this_value));\n\n  my_thing_b.x = false;\n  jerry_object_set_native_ptr (call_info_p->this_value, &thing_b_info, &my_thing_b);\n\n  return jerry_boolean (true);\n} /* create_object_b_handler */\n\n/**\n * Register a JavaScript function in the global object.\n */\nstatic void\nregister_js_function (const char *name_p, /**< name of the function */\n                      jerry_external_handler_t handler_p) /**< function callback */\n{\n  jerry_value_t global_obj_val = jerry_current_realm ();\n\n  jerry_value_t function_val = jerry_function_external (handler_p);\n  jerry_value_t function_name_val = jerry_string_sz (name_p);\n  jerry_value_t result_val = jerry_object_set (global_obj_val, function_name_val, function_val);\n\n  jerry_value_free (function_name_val);\n  jerry_value_free (function_val);\n  jerry_value_free (global_obj_val);\n\n  jerry_value_free (result_val);\n} /* register_js_function */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  test_utf8_string ();\n\n  register_js_function (\"test_validator1\", test_validator1_handler);\n  register_js_function (\"test_validator2\", test_validator2_handler);\n  register_js_function (\"test_validator3\", test_validator3_handler);\n  register_js_function (\"test_validator_int1\", test_validator_int1_handler);\n  register_js_function (\"test_validator_int2\", test_validator_int2_handler);\n  register_js_function (\"test_validator_int3\", test_validator_int3_handler);\n  register_js_function (\"MyObjectA\", create_object_a_handler);\n  register_js_function (\"MyObjectB\", create_object_b_handler);\n  register_js_function (\"test_validator_prop1\", test_validator_prop1_handler);\n  register_js_function (\"test_validator_prop2\", test_validator_prop2_handler);\n  register_js_function (\"test_validator_prop3\", test_validator_prop3_handler);\n  register_js_function (\"test_validator_array1\", test_validator_array1_handler);\n  register_js_function (\"test_validator_array2\", test_validator_array2_handler);\n  register_js_function (\"test_validator_restore\", test_validator_restore_handler);\n\n  jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);\n  TEST_ASSERT (!jerry_value_is_exception (parsed_code_val));\n\n  jerry_value_t res = jerry_run (parsed_code_val);\n  TEST_ASSERT (!jerry_value_is_exception (res));\n  TEST_ASSERT (validator1_count == 5);\n  TEST_ASSERT (validator2_count == 3);\n  TEST_ASSERT (validator_prop_count == 4);\n  TEST_ASSERT (validator_int_count == 3);\n  TEST_ASSERT (validator_array_count == 3);\n  TEST_ASSERT (validator_restore_count == 4);\n\n  jerry_value_free (res);\n  jerry_value_free (parsed_code_val);\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-autorelease.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for jerry-ext/autorelease.\n */\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/autorelease.h\"\n#include \"test-common.h\"\n\nstatic int native_free_cb_call_count;\n\nstatic void\nnative_free_cb (void *native_p, /**< native pointer */\n                jerry_object_native_info_t *info_p) /**< native info */\n{\n  (void) native_p;\n  (void) info_p;\n  ++native_free_cb_call_count;\n} /* native_free_cb */\n\nstatic const jerry_object_native_info_t native_info = {\n  .free_cb = native_free_cb,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic jerry_value_t\ncreate_object (void)\n{\n  jerry_value_t obj = jerry_object ();\n  jerry_object_set_native_ptr (obj, &native_info, NULL);\n  return obj;\n} /* create_object */\n\nstatic void\ntest_autorelease_val (void)\n{\n  JERRYX_AR_VALUE_T obj = create_object ();\n  (void) obj;\n} /* test_autorelease_val */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  native_free_cb_call_count = 0;\n  test_autorelease_val ();\n  jerry_heap_gc (JERRY_GC_PRESSURE_HIGH);\n  TEST_ASSERT (native_free_cb_call_count == 1);\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-handle-scope-escape.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for jerry-ext/handle-scope.\n */\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/handle-scope.h\"\n#include \"test-common.h\"\n\nstatic int native_free_cb_call_count;\n\nstatic void\nnative_free_cb (void *native_p, /**< native pointer */\n                jerry_object_native_info_t *info_p) /**< native info */\n{\n  (void) native_p;\n  (void) info_p;\n  ++native_free_cb_call_count;\n} /* native_free_cb */\n\nstatic const jerry_object_native_info_t native_info = {\n  .free_cb = native_free_cb,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic jerry_value_t\ncreate_object (void)\n{\n  jerryx_escapable_handle_scope scope;\n  jerryx_open_escapable_handle_scope (&scope);\n  jerry_value_t obj = jerryx_create_handle (jerry_object ());\n  jerry_object_set_native_ptr (obj, &native_info, NULL);\n\n  // If leaves `escaped` uninitialized, there will be a style error on linux thrown by compiler\n  jerry_value_t escaped = 0;\n  jerryx_escape_handle (scope, obj, &escaped);\n  TEST_ASSERT (scope->prelist_handle_count == 0);\n  TEST_ASSERT (scope->handle_ptr == NULL);\n\n  jerryx_close_handle_scope (scope);\n  return escaped;\n} /* create_object */\n\nstatic void\ntest_handle_scope_val (void)\n{\n  jerryx_handle_scope scope;\n  jerryx_open_handle_scope (&scope);\n  jerry_value_t obj = create_object ();\n  (void) obj;\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == 0);\n\n  jerryx_close_handle_scope (scope);\n} /* test_handle_scope_val */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  native_free_cb_call_count = 0;\n  test_handle_scope_val ();\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == 1);\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-handle-scope-handle-prelist-escape.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for jerry-ext/handle-scope-handle-prelist-escape.\n *\n * Tests escaping jerry value that holds on scope's prelist.\n */\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/handle-scope.h\"\n#include \"test-common.h\"\n\nstatic size_t native_free_cb_call_count;\nstatic const size_t handle_count = JERRYX_HANDLE_PRELIST_SIZE + 1;\n\nstatic void\nnative_free_cb (void *native_p, /**< native pointer */\n                jerry_object_native_info_t *info_p) /**< native info */\n{\n  (void) native_p;\n  (void) info_p;\n  ++native_free_cb_call_count;\n} /* native_free_cb */\n\nstatic const jerry_object_native_info_t native_info = {\n  .free_cb = native_free_cb,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic jerry_value_t\ncreate_object (void)\n{\n  jerryx_escapable_handle_scope scope;\n  jerryx_open_escapable_handle_scope (&scope);\n\n  jerry_value_t obj;\n  for (size_t idx = 0; idx < handle_count; idx++)\n  {\n    obj = jerryx_create_handle (jerry_object ());\n    jerry_object_set_native_ptr (obj, &native_info, NULL);\n  }\n\n  // If leaves `escaped` uninitialized, there will be a style error on linux thrown by compiler\n  jerry_value_t escaped = 0;\n  jerryx_escape_handle (scope, obj, &escaped);\n  TEST_ASSERT (scope->prelist_handle_count == JERRYX_HANDLE_PRELIST_SIZE);\n\n  jerryx_close_handle_scope (scope);\n  return escaped;\n} /* create_object */\n\nstatic void\ntest_handle_scope_val (void)\n{\n  jerryx_handle_scope scope;\n  jerryx_open_handle_scope (&scope);\n  jerry_value_t obj = create_object ();\n  (void) obj;\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == (handle_count - 1));\n\n  jerryx_close_handle_scope (scope);\n} /* test_handle_scope_val */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  native_free_cb_call_count = 0;\n  test_handle_scope_val ();\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == handle_count);\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-handle-scope-handle-prelist.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for jerry-ext/handle-scope-handle-prelist.\n *\n * Tests escaping jerry value that holds on scope's handle heap.\n */\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/handle-scope.h\"\n#include \"test-common.h\"\n\nstatic size_t native_free_cb_call_count;\nstatic const size_t handle_count = JERRYX_HANDLE_PRELIST_SIZE * 2;\n\nstatic void\nnative_free_cb (void *native_p, /**< native pointer */\n                jerry_object_native_info_t *info_p) /**< native info */\n{\n  (void) native_p;\n  (void) info_p;\n  ++native_free_cb_call_count;\n} /* native_free_cb */\n\nstatic const jerry_object_native_info_t native_info = {\n  .free_cb = native_free_cb,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic jerry_value_t\ncreate_object (void)\n{\n  jerryx_escapable_handle_scope scope;\n  jerryx_open_escapable_handle_scope (&scope);\n\n  jerry_value_t obj;\n  for (size_t idx = 0; idx < handle_count; idx++)\n  {\n    obj = jerryx_create_handle (jerry_object ());\n    jerry_object_set_native_ptr (obj, &native_info, NULL);\n  }\n\n  // If leaves `escaped` uninitialized, there will be a style error on linux thrown by compiler\n  jerry_value_t escaped = 0;\n  jerryx_escape_handle (scope, obj, &escaped);\n  TEST_ASSERT (scope->prelist_handle_count == JERRYX_HANDLE_PRELIST_SIZE);\n\n  jerryx_close_handle_scope (scope);\n  return escaped;\n} /* create_object */\n\nstatic void\ntest_handle_scope_val (void)\n{\n  jerryx_handle_scope scope;\n  jerryx_open_handle_scope (&scope);\n  jerry_value_t obj = create_object ();\n  (void) obj;\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == (handle_count - 1));\n\n  jerryx_close_handle_scope (scope);\n} /* test_handle_scope_val */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  native_free_cb_call_count = 0;\n  test_handle_scope_val ();\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == handle_count);\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-handle-scope-nested.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for jerry-ext/handle-scope.\n *\n * Tests escaping jerry value that passed from scopes which are created on heap.\n * Also reallocates scopes for one times to test if reallocation works.\n */\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/handle-scope.h\"\n#include \"test-common.h\"\n\nstatic int native_free_cb_call_count;\n\nstatic void\nnative_free_cb (void *native_p, /**< native pointer */\n                jerry_object_native_info_t *info_p) /**< native info */\n{\n  (void) native_p;\n  (void) info_p;\n  ++native_free_cb_call_count;\n} /* native_free_cb */\n\nstatic const jerry_object_native_info_t native_info = {\n  .free_cb = native_free_cb,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic jerry_value_t\ncreate_object_nested (int times)\n{\n  jerryx_escapable_handle_scope scope;\n  jerryx_open_escapable_handle_scope (&scope);\n\n  jerry_value_t obj;\n  if (times == 0)\n  {\n    obj = jerryx_create_handle (jerry_object ());\n    jerry_object_set_native_ptr (obj, &native_info, NULL);\n  }\n  else\n  {\n    obj = create_object_nested (times - 1);\n  }\n  TEST_ASSERT (jerryx_handle_scope_get_current () == scope);\n\n  // If leaves `escaped` uninitialized, there will be a style error on linux thrown by compiler\n  jerry_value_t escaped = 0;\n  jerryx_handle_scope_status status = jerryx_escape_handle (scope, obj, &escaped);\n  TEST_ASSERT (status == jerryx_handle_scope_ok);\n  TEST_ASSERT (scope->prelist_handle_count == 0);\n  TEST_ASSERT (scope->handle_ptr == NULL);\n\n  jerryx_close_handle_scope (scope);\n  return escaped;\n} /* create_object_nested */\n\nstatic void\ntest_handle_scope_val (void)\n{\n  jerryx_handle_scope scope;\n  jerryx_open_handle_scope (&scope);\n\n  for (int idx = 0; idx < 2; ++idx)\n  {\n    jerry_value_t obj = create_object_nested (JERRYX_SCOPE_PRELIST_SIZE * 2);\n    (void) obj;\n  }\n\n  TEST_ASSERT (jerryx_handle_scope_get_current () == scope);\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == 0);\n\n  jerryx_close_handle_scope (scope);\n} /* test_handle_scope_val */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  native_free_cb_call_count = 0;\n  test_handle_scope_val ();\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == 2);\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-handle-scope-remove.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for jerry-ext/handle-scope.\n */\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/handle-scope.h\"\n#include \"test-common.h\"\n\nstatic int native_free_cb_call_count;\n\nstatic void\nnative_free_cb (void *native_p, /**< native pointer */\n                jerry_object_native_info_t *info_p) /**< native info */\n{\n  (void) native_p;\n  (void) info_p;\n  ++native_free_cb_call_count;\n} /* native_free_cb */\n\nstatic const jerry_object_native_info_t native_info = {\n  .free_cb = native_free_cb,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic jerry_value_t\ncreate_object (void)\n{\n  jerryx_escapable_handle_scope scope;\n  jerryx_open_escapable_handle_scope (&scope);\n  jerry_value_t obj = jerryx_create_handle (jerry_object ());\n  jerry_object_set_native_ptr (obj, &native_info, NULL);\n\n  // If leaves `escaped` uninitialized, there will be a style error on linux thrown by compiler\n  jerry_value_t escaped = 0;\n  jerryx_remove_handle (scope, obj, &escaped);\n  TEST_ASSERT (scope->prelist_handle_count == 0);\n  TEST_ASSERT (scope->handle_ptr == NULL);\n\n  jerryx_close_handle_scope (scope);\n  return escaped;\n} /* create_object */\n\nstatic void\ntest_handle_scope_val (void)\n{\n  jerryx_handle_scope scope;\n  jerryx_open_handle_scope (&scope);\n  jerry_value_t obj = create_object ();\n  (void) obj;\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == 0);\n\n  jerryx_close_handle_scope (scope);\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == 0);\n\n  jerry_value_free (obj);\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == 1);\n} /* test_handle_scope_val */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  native_free_cb_call_count = 0;\n  test_handle_scope_val ();\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-handle-scope-root.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for jerry-ext/handle-scope.\n */\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/handle-scope.h\"\n#include \"test-common.h\"\n\nstatic int native_free_cb_call_count;\nstatic int reusing_times = 10;\n\nstatic void\nnative_free_cb (void *native_p, /**< native pointer */\n                jerry_object_native_info_t *info_p) /**< native info */\n{\n  (void) native_p;\n  (void) info_p;\n  ++native_free_cb_call_count;\n} /* native_free_cb */\n\nstatic const jerry_object_native_info_t native_info = {\n  .free_cb = native_free_cb,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic jerry_value_t\ncreate_object (void)\n{\n  jerry_value_t obj = jerry_object ();\n  jerry_object_set_native_ptr (obj, &native_info, NULL);\n  return obj;\n} /* create_object */\n\nstatic void\ntest_handle_scope_val (void)\n{\n  jerryx_escapable_handle_scope root = jerryx_handle_scope_get_root ();\n  // root handle scope should always be reusable after close\n  for (int i = 0; i < reusing_times; ++i)\n  {\n    jerry_value_t obj = jerryx_create_handle (create_object ());\n    (void) obj;\n    jerryx_close_handle_scope (root);\n    jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n    TEST_ASSERT (native_free_cb_call_count == (i + 1));\n  }\n} /* test_handle_scope_val */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  native_free_cb_call_count = 0;\n  test_handle_scope_val ();\n\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == reusing_times);\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-handle-scope.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for jerry-ext/handle-scope.\n */\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/handle-scope.h\"\n#include \"test-common.h\"\n\nstatic int native_free_cb_call_count;\n\nstatic void\nnative_free_cb (void *native_p, /**< native pointer */\n                jerry_object_native_info_t *info_p) /**< native info */\n{\n  (void) native_p;\n  (void) info_p;\n  ++native_free_cb_call_count;\n} /* native_free_cb */\n\nstatic const jerry_object_native_info_t native_info = {\n  .free_cb = native_free_cb,\n  .number_of_references = 0,\n  .offset_of_references = 0,\n};\n\nstatic jerry_value_t\ncreate_object (void)\n{\n  jerry_value_t obj = jerry_object ();\n  jerry_object_set_native_ptr (obj, &native_info, NULL);\n  return obj;\n} /* create_object */\n\nstatic void\ntest_handle_scope_val (void)\n{\n  jerryx_handle_scope scope;\n  jerryx_open_handle_scope (&scope);\n  jerry_value_t obj = jerryx_create_handle (create_object ());\n  (void) obj;\n  jerryx_close_handle_scope (scope);\n} /* test_handle_scope_val */\n\nint\nmain (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  native_free_cb_call_count = 0;\n  test_handle_scope_val ();\n  jerry_heap_gc (JERRY_GC_PRESSURE_LOW);\n  TEST_ASSERT (native_free_cb_call_count == 1);\n\n  jerry_cleanup ();\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-method-register.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for jerry-ext/handler property registration\n */\n\n#include <string.h>\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/properties.h\"\n#include \"test-common.h\"\n\nstatic jerry_value_t\nmethod_hello (const jerry_call_info_t *call_info_p, /**< call information */\n              const jerry_value_t jargv[], /**< arguments */\n              const jerry_length_t jargc) /**< number of arguments */\n{\n  (void) call_info_p;\n  (void) jargv;\n  return jerry_number (jargc);\n} /* method_hello */\n\n/**\n * Helper method to create a non-configurable property on an object\n */\nstatic void\nfreeze_property (jerry_value_t target_obj, /**< target object */\n                 const char *target_prop) /**< target property name */\n{\n  // \"freeze\" property\n  jerry_property_descriptor_t prop_desc = jerry_property_descriptor ();\n  prop_desc.flags |= JERRY_PROP_IS_CONFIGURABLE_DEFINED;\n\n  jerry_value_t prop_name = jerry_string_sz (target_prop);\n  jerry_value_t return_value = jerry_object_define_own_prop (target_obj, prop_name, &prop_desc);\n  TEST_ASSERT (jerry_value_is_boolean (return_value));\n  jerry_value_free (return_value);\n  jerry_value_free (prop_name);\n\n  jerry_property_descriptor_free (&prop_desc);\n} /* freeze_property */\n\n/**\n * Test registration of various property values.\n */\nstatic void\ntest_simple_registration (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t target_object = jerry_object ();\n\n  // Test simple registration\n  jerryx_property_entry methods[] = {\n    JERRYX_PROPERTY_FUNCTION (\"hello\", method_hello),  JERRYX_PROPERTY_NUMBER (\"my_number\", 42.5),\n    JERRYX_PROPERTY_STRING_SZ (\"my_str\", \"super_str\"), JERRYX_PROPERTY_STRING (\"my_str_sz\", \"super_str\", 6),\n    JERRYX_PROPERTY_BOOLEAN (\"my_bool\", true),         JERRYX_PROPERTY_BOOLEAN (\"my_bool_false\", false),\n    JERRYX_PROPERTY_UNDEFINED (\"my_non_value\"),        JERRYX_PROPERTY_LIST_END (),\n  };\n\n  jerryx_register_result register_result = jerryx_set_properties (target_object, methods);\n\n  TEST_ASSERT (register_result.registered == 7);\n  TEST_ASSERT (jerry_value_is_undefined (register_result.result));\n\n  jerryx_release_property_entry (methods, register_result);\n  jerry_value_free (register_result.result);\n\n  jerry_value_t global_obj = jerry_current_realm ();\n  jerry_object_set_sz (global_obj, \"test\", target_object);\n  jerry_value_free (target_object);\n  jerry_value_free (global_obj);\n\n  {\n    const char *test_A = \"test.my_number\";\n    jerry_value_t result = jerry_eval ((const jerry_char_t *) test_A, strlen (test_A), 0);\n    TEST_ASSERT (jerry_value_is_number (result));\n    TEST_ASSERT (jerry_value_as_number (result) == 42.5);\n    jerry_value_free (result);\n  }\n\n  {\n    const char *test_A = \"test.my_str_sz === 'super_'\";\n    jerry_value_t result = jerry_eval ((const jerry_char_t *) test_A, strlen (test_A), 0);\n    TEST_ASSERT (jerry_value_is_boolean (result));\n    TEST_ASSERT (jerry_value_is_true (result));\n    jerry_value_free (result);\n  }\n\n  {\n    const char *test_A = \"test.my_str === 'super_str'\";\n    jerry_value_t result = jerry_eval ((const jerry_char_t *) test_A, strlen (test_A), 0);\n    TEST_ASSERT (jerry_value_is_boolean (result));\n    TEST_ASSERT (jerry_value_is_true (result));\n    jerry_value_free (result);\n  }\n\n  {\n    const char *test_A = \"test.my_bool\";\n    jerry_value_t result = jerry_eval ((const jerry_char_t *) test_A, strlen (test_A), 0);\n    TEST_ASSERT (jerry_value_is_boolean (result));\n    TEST_ASSERT (jerry_value_is_true (result));\n    jerry_value_free (result);\n  }\n\n  {\n    const char *test_A = \"test.my_bool_false\";\n    jerry_value_t result = jerry_eval ((const jerry_char_t *) test_A, strlen (test_A), 0);\n    TEST_ASSERT (jerry_value_is_boolean (result));\n    TEST_ASSERT (jerry_value_is_true (result) == false);\n    jerry_value_free (result);\n  }\n\n  {\n    const char *test_A = \"test.my_non_value\";\n    jerry_value_t result = jerry_eval ((const jerry_char_t *) test_A, strlen (test_A), 0);\n    TEST_ASSERT (jerry_value_is_undefined (result));\n    jerry_value_free (result);\n  }\n\n  {\n    const char *test_A = \"test.hello(33, 42, 2);\";\n    jerry_value_t result = jerry_eval ((const jerry_char_t *) test_A, strlen (test_A), 0);\n    TEST_ASSERT (jerry_value_is_number (result));\n    TEST_ASSERT ((uint32_t) jerry_value_as_number (result) == 3u);\n    jerry_value_free (result);\n  }\n\n  {\n    const char *test_A = \"test.hello();\";\n    jerry_value_t result = jerry_eval ((const jerry_char_t *) test_A, strlen (test_A), 0);\n    TEST_ASSERT (jerry_value_is_number (result));\n    TEST_ASSERT ((uint32_t) jerry_value_as_number (result) == 0u);\n    jerry_value_free (result);\n  }\n\n  jerry_cleanup ();\n} /* test_simple_registration */\n\n/**\n * Test registration error.\n *\n * Trying to register a property which is already a non-configurable property\n * should result in an error.\n */\nstatic void\ntest_error_setvalue (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const char *target_prop = \"test_err\";\n  jerry_value_t global_obj = jerry_current_realm ();\n  freeze_property (global_obj, target_prop);\n\n  jerry_value_t new_object = jerry_object ();\n  jerry_value_t set_result = jerry_object_set_sz (global_obj, target_prop, new_object);\n  TEST_ASSERT (jerry_value_is_exception (set_result));\n\n  jerry_value_free (set_result);\n  jerry_value_free (new_object);\n  jerry_value_free (global_obj);\n\n  jerry_cleanup ();\n} /* test_error_setvalue */\n\n/**\n * Test registration error with jerryx_set_properties.\n *\n * Trying to register a property which is already a non-configurable property\n * should result in an error.\n */\nstatic void\ntest_error_single_function (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const char *target_prop = \"test_err\";\n  jerry_value_t target_object = jerry_object ();\n  freeze_property (target_object, target_prop);\n\n  jerryx_property_entry methods[] = {\n    JERRYX_PROPERTY_FUNCTION (target_prop, method_hello), // This registration should fail\n    JERRYX_PROPERTY_LIST_END (),\n  };\n\n  jerryx_register_result register_result = jerryx_set_properties (target_object, methods);\n\n  TEST_ASSERT (register_result.registered == 0);\n  TEST_ASSERT (jerry_value_is_exception (register_result.result));\n  jerryx_release_property_entry (methods, register_result);\n  jerry_value_free (register_result.result);\n\n  jerry_value_free (target_object);\n\n  jerry_cleanup ();\n} /* test_error_single_function */\n\n/**\n * Test to see if jerryx_set_properties exits at the first error.\n */\nstatic void\ntest_error_multiple_functions (void)\n{\n  jerry_init (JERRY_INIT_EMPTY);\n\n  const char *prop_ok = \"prop_ok\";\n  const char *prop_err = \"prop_err\";\n  const char *prop_not = \"prop_not\";\n  jerry_value_t target_object = jerry_object ();\n  freeze_property (target_object, prop_err);\n\n  jerryx_property_entry methods[] = {\n    JERRYX_PROPERTY_FUNCTION (prop_ok, method_hello), // This registration is ok\n    JERRYX_PROPERTY_FUNCTION (prop_err, method_hello), // This registration should fail\n    JERRYX_PROPERTY_FUNCTION (prop_not, method_hello), // This registration is not done\n    JERRYX_PROPERTY_LIST_END (),\n  };\n\n  jerryx_register_result register_result = jerryx_set_properties (target_object, methods);\n\n  TEST_ASSERT (register_result.registered == 1);\n  TEST_ASSERT (jerry_value_is_exception (register_result.result));\n\n  jerryx_release_property_entry (methods, register_result);\n  jerry_value_free (register_result.result);\n\n  {\n    // Test if property \"prop_ok\" is correctly registered.\n    jerry_value_t prop_ok_val = jerry_string_sz (prop_ok);\n    jerry_value_t prop_ok_exists = jerry_object_has_own (target_object, prop_ok_val);\n    TEST_ASSERT (jerry_value_is_true (prop_ok_exists));\n    jerry_value_free (prop_ok_exists);\n\n    // Try calling the method\n    jerry_value_t prop_ok_func = jerry_object_get (target_object, prop_ok_val);\n    TEST_ASSERT (jerry_value_is_function (prop_ok_func) == true);\n    jerry_value_t args[2] = {\n      jerry_number (22),\n      jerry_number (-3),\n    };\n    jerry_size_t args_cnt = sizeof (args) / sizeof (jerry_value_t);\n    jerry_value_t func_result = jerry_call (prop_ok_func, jerry_undefined (), args, args_cnt);\n    TEST_ASSERT (jerry_value_is_number (func_result) == true);\n    TEST_ASSERT ((uint32_t) jerry_value_as_number (func_result) == 2u);\n    jerry_value_free (func_result);\n    for (jerry_size_t idx = 0; idx < args_cnt; idx++)\n    {\n      jerry_value_free (args[idx]);\n    }\n    jerry_value_free (prop_ok_func);\n    jerry_value_free (prop_ok_val);\n  }\n\n  {\n    // The \"prop_err\" should exist - as it was \"freezed\" - but it should not be a function\n    jerry_value_t prop_err_val = jerry_string_sz (prop_err);\n    jerry_value_t prop_err_exists = jerry_object_has_own (target_object, prop_err_val);\n    TEST_ASSERT (jerry_value_is_true (prop_err_exists));\n    jerry_value_free (prop_err_exists);\n\n    jerry_value_t prop_err_func = jerry_value_is_function (prop_err_val);\n    TEST_ASSERT (jerry_value_is_function (prop_err_func) == false);\n    jerry_value_free (prop_err_val);\n  }\n\n  { // The \"prop_not\" is not available on the target object\n    jerry_value_t prop_not_val = jerry_string_sz (prop_not);\n    jerry_value_t prop_not_exists = jerry_object_has_own (target_object, prop_not_val);\n    TEST_ASSERT (jerry_value_is_true (prop_not_exists) == false);\n    jerry_value_free (prop_not_exists);\n    jerry_value_free (prop_not_val);\n  }\n\n  jerry_value_free (target_object);\n\n  jerry_cleanup ();\n} /* test_error_multiple_functions */\n\nint\nmain (void)\n{\n  test_simple_registration ();\n  test_error_setvalue ();\n  test_error_single_function ();\n  test_error_multiple_functions ();\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-module-canonical.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <string.h>\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/module.h\"\n#include \"test-common.h\"\n\n#define ACTUAL_NAME \"alice\"\n#define ALIAS_NAME  \"bob\"\n\nstatic jerry_value_t\nget_canonical_name (const jerry_value_t name)\n{\n  jerry_size_t name_size = jerry_string_size (name, JERRY_ENCODING_CESU8);\n  JERRY_VLA (jerry_char_t, name_string, name_size + 1);\n  jerry_string_to_buffer (name, JERRY_ENCODING_CESU8, name_string, name_size);\n  name_string[name_size] = 0;\n\n  if (!strcmp ((char *) name_string, ACTUAL_NAME))\n  {\n    return jerry_value_copy (name);\n  }\n  else if (!strcmp ((char *) name_string, ALIAS_NAME))\n  {\n    return jerry_string_sz (ACTUAL_NAME);\n  }\n  else\n  {\n    return jerry_undefined ();\n  }\n} /* get_canonical_name */\n\nstatic bool\nresolve (const jerry_value_t canonical_name, jerry_value_t *result)\n{\n  jerry_size_t name_size = jerry_string_size (canonical_name, JERRY_ENCODING_CESU8);\n  JERRY_VLA (jerry_char_t, name_string, name_size + 1);\n  jerry_string_to_buffer (canonical_name, JERRY_ENCODING_CESU8, name_string, name_size);\n  name_string[name_size] = 0;\n\n  if (!strcmp ((char *) name_string, ACTUAL_NAME))\n  {\n    *result = jerry_object ();\n    return true;\n  }\n  return false;\n} /* resolve */\n\nstatic const jerryx_module_resolver_t canonical_test = { .get_canonical_name_p = get_canonical_name,\n                                                         .resolve_p = resolve };\n\n#define TEST_VALUE 95.0\n\nint\nmain (int argc, char **argv)\n{\n  (void) argc;\n  (void) argv;\n\n  const jerryx_module_resolver_t *resolver = &canonical_test;\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  jerry_value_t actual_name = jerry_string_sz (ACTUAL_NAME);\n  jerry_value_t alias_name = jerry_string_sz (ALIAS_NAME);\n\n  /* It's important that we resolve by the non-canonical name first. */\n  jerry_value_t result2 = jerryx_module_resolve (alias_name, &resolver, 1);\n  jerry_value_t result1 = jerryx_module_resolve (actual_name, &resolver, 1);\n  jerry_value_free (actual_name);\n  jerry_value_free (alias_name);\n\n  /* An elaborate way of doing strict equal - set a property on one object and it \"magically\" appears on the other. */\n  jerry_value_t prop_name = jerry_string_sz (\"something\");\n  jerry_value_t prop_value = jerry_number (TEST_VALUE);\n  jerry_value_free (jerry_object_set (result1, prop_name, prop_value));\n  jerry_value_free (prop_value);\n\n  prop_value = jerry_object_get (result2, prop_name);\n  TEST_ASSERT (jerry_value_as_number (prop_value) == TEST_VALUE);\n  jerry_value_free (prop_value);\n\n  jerry_value_free (prop_name);\n  jerry_value_free (result1);\n  jerry_value_free (result2);\n\n  jerry_cleanup ();\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-ext/test-ext-module-empty.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include <string.h>\n\n#include \"jerryscript.h\"\n\n#include \"jerryscript-ext/module.h\"\n#include \"test-common.h\"\n\nint\nmain (int argc, char **argv)\n{\n  (void) argc;\n  (void) argv;\n  jerry_char_t buffer[256];\n  jerry_size_t bytes_copied;\n  const jerryx_module_resolver_t *resolver = &jerryx_module_native_resolver;\n  jerry_value_t module_name;\n\n  jerry_init (JERRY_INIT_EMPTY);\n\n  /* Attempt to load a non-existing module. */\n  module_name = jerry_string_sz (\"some-unknown-module-name\");\n  jerry_value_t module = jerryx_module_resolve (module_name, &resolver, 1);\n  jerry_value_free (module_name);\n\n  TEST_ASSERT (jerry_value_is_exception (module));\n\n  /* Retrieve the error message. */\n  module = jerry_exception_value (module, true);\n  jerry_value_t prop_name = jerry_string_sz (\"message\");\n  jerry_value_t prop = jerry_object_get (module, prop_name);\n\n  /* Assert that the error message is a string with specific contents. */\n  TEST_ASSERT (jerry_value_is_string (prop));\n\n  bytes_copied = jerry_string_to_buffer (prop, JERRY_ENCODING_UTF8, buffer, sizeof (buffer));\n  buffer[bytes_copied] = 0;\n  TEST_ASSERT (!strcmp ((const char *) buffer, \"Module not found\"));\n\n  /* Release the error message property name and value. */\n  jerry_value_free (prop);\n  jerry_value_free (prop_name);\n\n  /* Retrieve the moduleName property. */\n  prop_name = jerry_string_sz (\"moduleName\");\n  prop = jerry_object_get (module, prop_name);\n\n  /* Assert that the moduleName property is a string containing the requested module name. */\n  TEST_ASSERT (jerry_value_is_string (prop));\n\n  bytes_copied = jerry_string_to_buffer (prop, JERRY_ENCODING_UTF8, buffer, sizeof (buffer));\n  buffer[bytes_copied] = 0;\n  TEST_ASSERT (!strcmp ((const char *) buffer, \"some-unknown-module-name\"));\n\n  /* Release everything. */\n  jerry_value_free (prop);\n  jerry_value_free (prop_name);\n  jerry_value_free (module);\n\n  return 0;\n} /* main */\n"
  },
  {
    "path": "tests/unit-math/CMakeLists.txt",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ncmake_minimum_required (VERSION 3.10)\nproject (unit-math C)\n\n# Unit tests main modules\nset(SOURCE_UNIT_TEST_MAIN_MODULES\n  test-math.c\n)\n\n# Unit tests declaration\nadd_custom_target(unittests-math)\n\nforeach(SOURCE_UNIT_TEST_MAIN ${SOURCE_UNIT_TEST_MAIN_MODULES})\n  get_filename_component(TARGET_NAME ${SOURCE_UNIT_TEST_MAIN} NAME_WE)\n  set(TARGET_NAME unit-${TARGET_NAME})\n\n  add_executable(${TARGET_NAME} ${SOURCE_UNIT_TEST_MAIN})\n  set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS \"${LINKER_FLAGS_COMMON}\")\n  set_property(TARGET ${TARGET_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY \"${CMAKE_BINARY_DIR}/tests\")\n  if(\"${PLATFORM}\" STREQUAL \"DARWIN\")\n    set_property(TARGET ${TARGET_NAME} PROPERTY COMPILE_OPTIONS \"-Wno-literal-range\")\n  endif()\n\n  target_link_libraries(${TARGET_NAME} jerry-math)\n\n  add_dependencies(unittests-math ${TARGET_NAME})\nendforeach()\n"
  },
  {
    "path": "tests/unit-math/test-math.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Unit test for jerry-math\n */\n\n#include <math.h>\n#include <stdbool.h>\n#include <stdint.h>\n#include <stdio.h>\n\nstatic bool passed = true;\n\nstatic void\ncheck_int (const char *expr, int computed, int expected)\n{\n  printf (\"%s = %d [expected=%d] \", expr, computed, expected);\n\n  bool result = computed == expected;\n  printf (\"%s\\n\", result ? \"PASS\" : \"FAIL\");\n\n  passed &= result;\n} /* check_int */\n\ntypedef union\n{\n  double value;\n  uint64_t bits64;\n  uint32_t bits32[2];\n} double_bits_t;\n\nstatic void\ncheck_double (const char *expr, double computed, double expected)\n{\n  double_bits_t computed_bits;\n  double_bits_t expected_bits;\n\n  computed_bits.value = computed;\n  expected_bits.value = expected;\n\n  printf (\"%s = 0x%08x%08x [expected=0x%08x%08x] \",\n          expr,\n          (unsigned int) computed_bits.bits32[1],\n          (unsigned int) computed_bits.bits32[0],\n          (unsigned int) expected_bits.bits32[1],\n          (unsigned int) expected_bits.bits32[0]);\n\n  bool result;\n  if (isnan (computed) && isnan (expected))\n  {\n    result = true;\n  }\n  else\n  {\n    int64_t diff = (int64_t) (computed_bits.bits64 - expected_bits.bits64);\n    if (diff < 0)\n    {\n      diff = -diff;\n    }\n\n    if (diff <= 1) /* tolerate 1 bit of differene in the last place */\n    {\n      result = true;\n      if (diff != 0)\n      {\n        printf (\"APPROX \");\n      }\n    }\n    else\n    {\n      result = false;\n    }\n  }\n  printf (\"%s\\n\", result ? \"PASS\" : \"FAIL\");\n\n  passed &= result;\n} /* check_double */\n\nint\nmain (void)\n{\n#define INF INFINITY\n#include \"test-math.inc.h\"\n\n  return passed ? 0 : 1;\n} /* main */\n"
  },
  {
    "path": "tests/unit-math/test-math.inc.h",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* This file is automatically generated by the gen-test-math.sh script.\n * Do not edit! */\n\ncheck_double (\"acos (0.0)\", acos (0.0), 1.57079632679489655800E+00);\ncheck_double (\"acos (-0.0)\", acos (-0.0), 1.57079632679489655800E+00);\ncheck_double (\"acos (1.0)\", acos (1.0), 0.00000000000000000000E+00);\ncheck_double (\"acos (-1.0)\", acos (-1.0), 3.14159265358979311600E+00);\ncheck_double (\"acos (0.5)\", acos (0.5), 1.04719755119659785336E+00);\ncheck_double (\"acos (-0.5)\", acos (-0.5), 2.09439510239319570672E+00);\ncheck_double (\"acos (INFINITY)\", acos (INFINITY), NAN);\ncheck_double (\"acos (-INFINITY)\", acos (-INFINITY), NAN);\ncheck_double (\"acos (NAN)\", acos (NAN), NAN);\ncheck_double (\"acos (6.9e-18)\", acos (6.9e-18), 1.57079632679489655800E+00);\ncheck_double (\"acos (-6.9e-18)\", acos (-6.9e-18), 1.57079632679489655800E+00);\ncheck_double (\"acos (7.0e-18)\", acos (7.0e-18), 1.57079632679489655800E+00);\ncheck_double (\"acos (-7.0e-18)\", acos (-7.0e-18), 1.57079632679489655800E+00);\ncheck_double (\"acos (7.4e-9)\", acos (7.4e-9), 1.57079631939489661185E+00);\ncheck_double (\"acos (-7.4e-9)\", acos (-7.4e-9), 1.57079633419489672619E+00);\ncheck_double (\"acos (7.5e-9)\", acos (7.5e-9), 1.57079631929489660358E+00);\ncheck_double (\"acos (-7.5e-9)\", acos (-7.5e-9), 1.57079633429489651242E+00);\ncheck_double (\"acos (0.1)\", acos (0.1), 1.47062890563333681371E+00);\ncheck_double (\"acos (-0.1)\", acos (-0.1), 1.67096374795645652434E+00);\ncheck_double (\"acos (0.4)\", acos (0.4), 1.15927948072740849561E+00);\ncheck_double (\"acos (-0.4)\", acos (-0.4), 1.98231317286238462039E+00);\ncheck_double (\"acos (0.6)\", acos (0.6), 9.27295218001612298053E-01);\ncheck_double (\"acos (-0.6)\", acos (-0.6), 2.21429743558818081794E+00);\ncheck_double (\"acos (0.99)\", acos (0.99), 1.41539473324427289569E-01);\ncheck_double (\"acos (-0.99)\", acos (-0.99), 3.00005318026536604847E+00);\ncheck_double (\"acos (1.1)\", acos (1.1), NAN);\ncheck_double (\"acos (-1.1)\", acos (-1.1), NAN);\ncheck_double (\"acos (0.7)\", acos (0.7), 7.95398830184143590394E-01);\ncheck_double (\"asin (0.0)\", asin (0.0), 0.00000000000000000000E+00);\ncheck_double (\"asin (-0.0)\", asin (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"asin (1.0)\", asin (1.0), 1.57079632679489655800E+00);\ncheck_double (\"asin (-1.0)\", asin (-1.0), -1.57079632679489655800E+00);\ncheck_double (\"asin (0.5)\", asin (0.5), 5.23598775598298926681E-01);\ncheck_double (\"asin (-0.5)\", asin (-0.5), -5.23598775598298926681E-01);\ncheck_double (\"asin (0.98)\", asin (0.98), 1.37046148447177684737E+00);\ncheck_double (\"asin (-0.98)\", asin (-0.98), -1.37046148447177684737E+00);\ncheck_double (\"asin (INFINITY)\", asin (INFINITY), NAN);\ncheck_double (\"asin (-INFINITY)\", asin (-INFINITY), NAN);\ncheck_double (\"asin (NAN)\", asin (NAN), NAN);\ncheck_double (\"asin (6.9e-18)\", asin (6.9e-18), 6.90000000000000026253E-18);\ncheck_double (\"asin (-6.9e-18)\", asin (-6.9e-18), -6.90000000000000026253E-18);\ncheck_double (\"asin (7.0e-18)\", asin (7.0e-18), 6.99999999999999973042E-18);\ncheck_double (\"asin (-7.0e-18)\", asin (-7.0e-18), -6.99999999999999973042E-18);\ncheck_double (\"asin (7.4e-9)\", asin (7.4e-9), 7.40000000000000008865E-09);\ncheck_double (\"asin (-7.4e-9)\", asin (-7.4e-9), -7.40000000000000008865E-09);\ncheck_double (\"asin (7.5e-9)\", asin (7.5e-9), 7.49999999999999932974E-09);\ncheck_double (\"asin (-7.5e-9)\", asin (-7.5e-9), -7.49999999999999932974E-09);\ncheck_double (\"asin (0.1)\", asin (0.1), 1.00167421161559799803E-01);\ncheck_double (\"asin (-0.1)\", asin (-0.1), -1.00167421161559799803E-01);\ncheck_double (\"asin (0.4)\", asin (0.4), 4.11516846067488062388E-01);\ncheck_double (\"asin (-0.4)\", asin (-0.4), -4.11516846067488062388E-01);\ncheck_double (\"asin (0.6)\", asin (0.6), 6.43501108793284370968E-01);\ncheck_double (\"asin (-0.6)\", asin (-0.6), -6.43501108793284370968E-01);\ncheck_double (\"asin (0.97)\", asin (0.97), 1.32523080927960457132E+00);\ncheck_double (\"asin (-0.97)\", asin (-0.97), -1.32523080927960457132E+00);\ncheck_double (\"asin (0.99)\", asin (0.99), 1.42925685347046926843E+00);\ncheck_double (\"asin (-0.99)\", asin (-0.99), -1.42925685347046926843E+00);\ncheck_double (\"asin (1.1)\", asin (1.1), NAN);\ncheck_double (\"asin (-1.1)\", asin (-1.1), NAN);\ncheck_double (\"asin (0.7)\", asin (0.7), 7.75397496610752967605E-01);\ncheck_double (\"atan (0.0)\", atan (0.0), 0.00000000000000000000E+00);\ncheck_double (\"atan (-0.0)\", atan (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"atan (7.0 / 16.0)\", atan (7.0 / 16.0), 4.12410441597387322776E-01);\ncheck_double (\"atan (-7.0 / 16.0)\", atan (-7.0 / 16.0), -4.12410441597387322776E-01);\ncheck_double (\"atan (11.0 / 16.0)\", atan (11.0 / 16.0), 6.02287346134964152178E-01);\ncheck_double (\"atan (-11.0 / 16.0)\", atan (-11.0 / 16.0), -6.02287346134964152178E-01);\ncheck_double (\"atan (19.0 / 16.0)\", atan (19.0 / 16.0), 8.70903457075652975838E-01);\ncheck_double (\"atan (-19.0 / 16.0)\", atan (-19.0 / 16.0), -8.70903457075652975838E-01);\ncheck_double (\"atan (39.0 / 16.0)\", atan (39.0 / 16.0), 1.18147960496175574718E+00);\ncheck_double (\"atan (-39.0 / 16.0)\", atan (-39.0 / 16.0), -1.18147960496175574718E+00);\ncheck_double (\"atan (1.0)\", atan (1.0), 7.85398163397448278999E-01);\ncheck_double (\"atan (-1.0)\", atan (-1.0), -7.85398163397448278999E-01);\ncheck_double (\"atan (INFINITY)\", atan (INFINITY), 1.57079632679489655800E+00);\ncheck_double (\"atan (-INFINITY)\", atan (-INFINITY), -1.57079632679489655800E+00);\ncheck_double (\"atan (NAN)\", atan (NAN), NAN);\ncheck_double (\"atan (6.9 / 16.0)\", atan (6.9 / 16.0), 4.07152520941509277197E-01);\ncheck_double (\"atan (-6.9 / 16.0)\", atan (-6.9 / 16.0), -4.07152520941509277197E-01);\ncheck_double (\"atan (7.1 / 16.0)\", atan (7.1 / 16.0), 4.17644283240569735849E-01);\ncheck_double (\"atan (-7.1 / 16.0)\", atan (-7.1 / 16.0), -4.17644283240569735849E-01);\ncheck_double (\"atan (10.9 / 16.0)\", atan (10.9 / 16.0), 5.98030920656102416011E-01);\ncheck_double (\"atan (-10.9 / 16.0)\", atan (-10.9 / 16.0), -5.98030920656102416011E-01);\ncheck_double (\"atan (11.1 / 16.0)\", atan (11.1 / 16.0), 6.06519005615576589641E-01);\ncheck_double (\"atan (-11.1 / 16.0)\", atan (-11.1 / 16.0), -6.06519005615576589641E-01);\ncheck_double (\"atan (18.9 / 16.0)\", atan (18.9 / 16.0), 8.68302259886018612534E-01);\ncheck_double (\"atan (-18.9 / 16.0)\", atan (-18.9 / 16.0), -8.68302259886018612534E-01);\ncheck_double (\"atan (19.1 / 16.0)\", atan (19.1 / 16.0), 8.73488683179258762479E-01);\ncheck_double (\"atan (-19.1 / 16.0)\", atan (-19.1 / 16.0), -8.73488683179258762479E-01);\ncheck_double (\"atan (38.9 / 16.0)\", atan (38.9 / 16.0), 1.18057723083411603149E+00);\ncheck_double (\"atan (-38.9 / 16.0)\", atan (-38.9 / 16.0), -1.18057723083411603149E+00);\ncheck_double (\"atan (39.1 / 16.0)\", atan (39.1 / 16.0), 1.18237802686613768799E+00);\ncheck_double (\"atan (-39.1 / 16.0)\", atan (-39.1 / 16.0), -1.18237802686613768799E+00);\ncheck_double (\"atan (0.99)\", atan (0.99), 7.80373080066635860241E-01);\ncheck_double (\"atan (-0.99)\", atan (-0.99), -7.80373080066635860241E-01);\ncheck_double (\"atan (1.1)\", atan (1.1), 8.32981266674431730657E-01);\ncheck_double (\"atan (-1.1)\", atan (-1.1), -8.32981266674431730657E-01);\ncheck_double (\"atan (7.37e+19)\", atan (7.37e+19), 1.57079632679489655800E+00);\ncheck_double (\"atan (-7.37e+19)\", atan (-7.37e+19), -1.57079632679489655800E+00);\ncheck_double (\"atan (7.38e+19)\", atan (7.38e+19), 1.57079632679489655800E+00);\ncheck_double (\"atan (-7.38e+19)\", atan (-7.38e+19), -1.57079632679489655800E+00);\ncheck_double (\"atan (0.7)\", atan (0.7), 6.10725964389208564320E-01);\ncheck_double (\"atan2 (NAN, NAN)\", atan2 (NAN, NAN), NAN);\ncheck_double (\"atan2 (0.0, NAN)\", atan2 (0.0, NAN), NAN);\ncheck_double (\"atan2 (-0.0, NAN)\", atan2 (-0.0, NAN), NAN);\ncheck_double (\"atan2 (1.0, NAN)\", atan2 (1.0, NAN), NAN);\ncheck_double (\"atan2 (-1.0, NAN)\", atan2 (-1.0, NAN), NAN);\ncheck_double (\"atan2 (INFINITY, NAN)\", atan2 (INFINITY, NAN), NAN);\ncheck_double (\"atan2 (-INFINITY, NAN)\", atan2 (-INFINITY, NAN), NAN);\ncheck_double (\"atan2 (NAN, 0.0)\", atan2 (NAN, 0.0), NAN);\ncheck_double (\"atan2 (NAN, -0.0)\", atan2 (NAN, -0.0), NAN);\ncheck_double (\"atan2 (NAN, 1.0)\", atan2 (NAN, 1.0), NAN);\ncheck_double (\"atan2 (NAN, -1.0)\", atan2 (NAN, -1.0), NAN);\ncheck_double (\"atan2 (NAN, INFINITY)\", atan2 (NAN, INFINITY), NAN);\ncheck_double (\"atan2 (NAN, -INFINITY)\", atan2 (NAN, -INFINITY), NAN);\ncheck_double (\"atan2 (0.0, 0.0)\", atan2 (0.0, 0.0), 0.00000000000000000000E+00);\ncheck_double (\"atan2 (0.0, -0.0)\", atan2 (0.0, -0.0), 3.14159265358979311600E+00);\ncheck_double (\"atan2 (-0.0, 0.0)\", atan2 (-0.0, 0.0), -0.00000000000000000000E+00);\ncheck_double (\"atan2 (-0.0, -0.0)\", atan2 (-0.0, -0.0), -3.14159265358979311600E+00);\ncheck_double (\"atan2 (0.0, 1.0)\", atan2 (0.0, 1.0), 0.00000000000000000000E+00);\ncheck_double (\"atan2 (0.0, -1.0)\", atan2 (0.0, -1.0), 3.14159265358979311600E+00);\ncheck_double (\"atan2 (0.0, INFINITY)\", atan2 (0.0, INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"atan2 (0.0, -INFINITY)\", atan2 (0.0, -INFINITY), 3.14159265358979311600E+00);\ncheck_double (\"atan2 (-0.0, 1.0)\", atan2 (-0.0, 1.0), -0.00000000000000000000E+00);\ncheck_double (\"atan2 (-0.0, -1.0)\", atan2 (-0.0, -1.0), -3.14159265358979311600E+00);\ncheck_double (\"atan2 (-0.0, INFINITY)\", atan2 (-0.0, INFINITY), -0.00000000000000000000E+00);\ncheck_double (\"atan2 (-0.0, -INFINITY)\", atan2 (-0.0, -INFINITY), -3.14159265358979311600E+00);\ncheck_double (\"atan2 (1.0, 0.0)\", atan2 (1.0, 0.0), 1.57079632679489655800E+00);\ncheck_double (\"atan2 (1.0, -0.0)\", atan2 (1.0, -0.0), 1.57079632679489655800E+00);\ncheck_double (\"atan2 (INFINITY, 0.0)\", atan2 (INFINITY, 0.0), 1.57079632679489655800E+00);\ncheck_double (\"atan2 (INFINITY, -0.0)\", atan2 (INFINITY, -0.0), 1.57079632679489655800E+00);\ncheck_double (\"atan2 (-1.0, 0.0)\", atan2 (-1.0, 0.0), -1.57079632679489655800E+00);\ncheck_double (\"atan2 (-1.0, -0.0)\", atan2 (-1.0, -0.0), -1.57079632679489655800E+00);\ncheck_double (\"atan2 (-INFINITY, 0.0)\", atan2 (-INFINITY, 0.0), -1.57079632679489655800E+00);\ncheck_double (\"atan2 (-INFINITY, -0.0)\", atan2 (-INFINITY, -0.0), -1.57079632679489655800E+00);\ncheck_double (\"atan2 (1.0, INFINITY)\", atan2 (1.0, INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"atan2 (-1.0, INFINITY)\", atan2 (-1.0, INFINITY), -0.00000000000000000000E+00);\ncheck_double (\"atan2 (1.0, -INFINITY)\", atan2 (1.0, -INFINITY), 3.14159265358979311600E+00);\ncheck_double (\"atan2 (-1.0, -INFINITY)\", atan2 (-1.0, -INFINITY), -3.14159265358979311600E+00);\ncheck_double (\"atan2 (INFINITY, INFINITY)\", atan2 (INFINITY, INFINITY), 7.85398163397448278999E-01);\ncheck_double (\"atan2 (INFINITY, -INFINITY)\", atan2 (INFINITY, -INFINITY), 2.35619449019234483700E+00);\ncheck_double (\"atan2 (-INFINITY, INFINITY)\", atan2 (-INFINITY, INFINITY), -7.85398163397448278999E-01);\ncheck_double (\"atan2 (-INFINITY, -INFINITY)\", atan2 (-INFINITY, -INFINITY), -2.35619449019234483700E+00);\ncheck_double (\"atan2 (INFINITY, 1.0)\", atan2 (INFINITY, 1.0), 1.57079632679489655800E+00);\ncheck_double (\"atan2 (INFINITY, -1.0)\", atan2 (INFINITY, -1.0), 1.57079632679489655800E+00);\ncheck_double (\"atan2 (-INFINITY, 1.0)\", atan2 (-INFINITY, 1.0), -1.57079632679489655800E+00);\ncheck_double (\"atan2 (-INFINITY, -1.0)\", atan2 (-INFINITY, -1.0), -1.57079632679489655800E+00);\ncheck_double (\"atan2 (0.7, 1.0)\", atan2 (0.7, 1.0), 6.10725964389208564320E-01);\ncheck_double (\"atan2 (-0.7, 1.0)\", atan2 (-0.7, 1.0), -6.10725964389208564320E-01);\ncheck_double (\"atan2 (0.7, -1.0)\", atan2 (0.7, -1.0), 2.53086668920058466270E+00);\ncheck_double (\"atan2 (-0.7, -1.0)\", atan2 (-0.7, -1.0), -2.53086668920058466270E+00);\ncheck_double (\"atan2 (0.4, 0.0003)\", atan2 (0.4, 0.0003), 1.57004632693552159672E+00);\ncheck_double (\"atan2 (1.4, -0.93)\", atan2 (1.4, -0.93), 2.15714876682378431383E+00);\ncheck_double (\"acosh (0.0)\", acosh (0.0), -NAN);\ncheck_double (\"acosh (-0.0)\", acosh (-0.0), -NAN);\ncheck_double (\"acosh (1.0)\", acosh (1.0), 0.00000000000000000000E+00);\ncheck_double (\"acosh (-1.0)\", acosh (-1.0), -NAN);\ncheck_double (\"acosh (INFINITY)\", acosh (INFINITY), INF);\ncheck_double (\"acosh (-INFINITY)\", acosh (-INFINITY), -NAN);\ncheck_double (\"acosh (NAN)\", acosh (NAN), NAN);\ncheck_double (\"acosh (7.08e+02)\", acosh (7.08e+02), 7.25559077551410425144E+00);\ncheck_double (\"acosh (7.10e+02)\", acosh (7.10e+02), 7.25841165466159132791E+00);\ncheck_double (\"acosh (-7.40e+02)\", acosh (-7.40e+02), -NAN);\ncheck_double (\"acosh (-7.50e+02)\", acosh (-7.50e+02), -NAN);\ncheck_double (\"acosh (0.34)\", acosh (0.34), -NAN);\ncheck_double (\"acosh (-0.34)\", acosh (-0.34), -NAN);\ncheck_double (\"acosh (0.35)\", acosh (0.35), -NAN);\ncheck_double (\"acosh (-0.35)\", acosh (-0.35), -NAN);\ncheck_double (\"acosh (1.03)\", acosh (1.03), 2.44340698822827606662E-01);\ncheck_double (\"acosh (-1.03)\", acosh (-1.03), -NAN);\ncheck_double (\"acosh (1.04)\", acosh (1.04), 2.81908289054146887764E-01);\ncheck_double (\"acosh (-1.04)\", acosh (-1.04), -NAN);\ncheck_double (\"acosh (3.72e-09)\", acosh (3.72e-09), -NAN);\ncheck_double (\"acosh (-3.72e-09)\", acosh (-3.72e-09), -NAN);\ncheck_double (\"acosh (3.73e-09)\", acosh (3.73e-09), -NAN);\ncheck_double (\"acosh (-3.73e-09)\", acosh (-3.73e-09), -NAN);\ncheck_double (\"acosh (2.0)\", acosh (2.0), 1.31695789692481679545E+00);\ncheck_double (\"acosh (3.0)\", acosh (3.0), 1.76274717403908609548E+00);\ncheck_double (\"acosh (0.7)\", acosh (0.7), -NAN);\ncheck_double (\"acosh (38.0)\", acosh (38.0), 4.33056016511402308566E+00);\ncheck_double (\"asinh (0.0)\", asinh (0.0), 0.00000000000000000000E+00);\ncheck_double (\"asinh (-0.0)\", asinh (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"asinh (1.0)\", asinh (1.0), 8.81373587019543047738E-01);\ncheck_double (\"asinh (-1.0)\", asinh (-1.0), -8.81373587019543047738E-01);\ncheck_double (\"asinh (INFINITY)\", asinh (INFINITY), INF);\ncheck_double (\"asinh (-INFINITY)\", asinh (-INFINITY), -INF);\ncheck_double (\"asinh (NAN)\", asinh (NAN), NAN);\ncheck_double (\"asinh (7.08e+02)\", asinh (7.08e+02), 7.25559177299247970439E+00);\ncheck_double (\"asinh (7.10e+02)\", asinh (7.10e+02), 7.25841264652828410675E+00);\ncheck_double (\"asinh (-7.40e+02)\", asinh (-7.40e+02), -7.29979782329546722508E+00);\ncheck_double (\"asinh (-7.50e+02)\", asinh (-7.50e+02), -7.31322083153444957304E+00);\ncheck_double (\"asinh (0.34)\", asinh (0.34), 3.33768351645882199730E-01);\ncheck_double (\"asinh (-0.34)\", asinh (-0.34), -3.33768351645882199730E-01);\ncheck_double (\"asinh (0.35)\", asinh (0.35), 3.43221555085943930141E-01);\ncheck_double (\"asinh (-0.35)\", asinh (-0.35), -3.43221555085943930141E-01);\ncheck_double (\"asinh (1.03)\", asinh (1.03), 9.02428495530461671770E-01);\ncheck_double (\"asinh (-1.03)\", asinh (-1.03), -9.02428495530461671770E-01);\ncheck_double (\"asinh (1.04)\", asinh (1.04), 9.09376928017844976537E-01);\ncheck_double (\"asinh (-1.04)\", asinh (-1.04), -9.09376928017844976537E-01);\ncheck_double (\"asinh (3.72e-09)\", asinh (3.72e-09), 3.71999999999999997526E-09);\ncheck_double (\"asinh (-3.72e-09)\", asinh (-3.72e-09), -3.71999999999999997526E-09);\ncheck_double (\"asinh (3.73e-09)\", asinh (3.73e-09), 3.73000000000000014752E-09);\ncheck_double (\"asinh (-3.73e-09)\", asinh (-3.73e-09), -3.73000000000000014752E-09);\ncheck_double (\"asinh (2.0)\", asinh (2.0), 1.44363547517881030124E+00);\ncheck_double (\"asinh (3.0)\", asinh (3.0), 1.81844645923206682525E+00);\ncheck_double (\"asinh (0.7)\", asinh (0.7), 6.52666566082355736889E-01);\ncheck_double (\"asinh (38.0)\", asinh (38.0), 4.33090642553643068169E+00);\ncheck_double (\"atanh (0.0)\", atanh (0.0), 0.00000000000000000000E+00);\ncheck_double (\"atanh (-0.0)\", atanh (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"atanh (1.0)\", atanh (1.0), INF);\ncheck_double (\"atanh (-1.0)\", atanh (-1.0), -INF);\ncheck_double (\"atanh (INFINITY)\", atanh (INFINITY), -NAN);\ncheck_double (\"atanh (-INFINITY)\", atanh (-INFINITY), -NAN);\ncheck_double (\"atanh (NAN)\", atanh (NAN), NAN);\ncheck_double (\"atanh (7.08e+02)\", atanh (7.08e+02), -NAN);\ncheck_double (\"atanh (7.10e+02)\", atanh (7.10e+02), -NAN);\ncheck_double (\"atanh (-7.40e+02)\", atanh (-7.40e+02), -NAN);\ncheck_double (\"atanh (-7.50e+02)\", atanh (-7.50e+02), -NAN);\ncheck_double (\"atanh (0.34)\", atanh (0.34), 3.54092528962242913959E-01);\ncheck_double (\"atanh (-0.34)\", atanh (-0.34), -3.54092528962242913959E-01);\ncheck_double (\"atanh (0.35)\", atanh (0.35), 3.65443754271396137323E-01);\ncheck_double (\"atanh (-0.35)\", atanh (-0.35), -3.65443754271396137323E-01);\ncheck_double (\"atanh (1.03)\", atanh (1.03), -NAN);\ncheck_double (\"atanh (-1.03)\", atanh (-1.03), -NAN);\ncheck_double (\"atanh (1.04)\", atanh (1.04), -NAN);\ncheck_double (\"atanh (-1.04)\", atanh (-1.04), -NAN);\ncheck_double (\"atanh (3.72e-09)\", atanh (3.72e-09), 3.71999999999999997526E-09);\ncheck_double (\"atanh (-3.72e-09)\", atanh (-3.72e-09), -3.71999999999999997526E-09);\ncheck_double (\"atanh (3.73e-09)\", atanh (3.73e-09), 3.73000000000000014752E-09);\ncheck_double (\"atanh (-3.73e-09)\", atanh (-3.73e-09), -3.73000000000000014752E-09);\ncheck_double (\"atanh (2.0)\", atanh (2.0), -NAN);\ncheck_double (\"atanh (3.0)\", atanh (3.0), -NAN);\ncheck_double (\"atanh (0.7)\", atanh (0.7), 8.67300527694053080552E-01);\ncheck_double (\"atanh (38.0)\", atanh (38.0), -NAN);\ncheck_double (\"ceil (0.0)\", ceil (0.0), 0.00000000000000000000E+00);\ncheck_double (\"ceil (-0.0)\", ceil (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"ceil (INFINITY)\", ceil (INFINITY), INF);\ncheck_double (\"ceil (-INFINITY)\", ceil (-INFINITY), -INF);\ncheck_double (\"ceil (NAN)\", ceil (NAN), NAN);\ncheck_double (\"ceil (3.14)\", ceil (3.14), 4.00000000000000000000E+00);\ncheck_double (\"ceil (-3.14)\", ceil (-3.14), -3.00000000000000000000E+00);\ncheck_double (\"ceil (3.72e-09)\", ceil (3.72e-09), 1.00000000000000000000E+00);\ncheck_double (\"ceil (-3.72e-09)\", ceil (-3.72e-09), -0.00000000000000000000E+00);\ncheck_double (\"ceil (7.37e+19)\", ceil (7.37e+19), 7.37000000000000000000E+19);\ncheck_double (\"ceil (-7.37e+19)\", ceil (-7.37e+19), -7.37000000000000000000E+19);\ncheck_double (\"exp (0.0)\", exp (0.0), 1.00000000000000000000E+00);\ncheck_double (\"exp (-0.0)\", exp (-0.0), 1.00000000000000000000E+00);\ncheck_double (\"exp (1.0)\", exp (1.0), 2.71828182845904509080E+00);\ncheck_double (\"exp (-1.0)\", exp (-1.0), 3.67879441171442334024E-01);\ncheck_double (\"exp (INFINITY)\", exp (INFINITY), INF);\ncheck_double (\"exp (-INFINITY)\", exp (-INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"exp (NAN)\", exp (NAN), NAN);\ncheck_double (\"exp (7.08e+02)\", exp (7.08e+02), 3.02338314427605515848E+307);\ncheck_double (\"exp (7.10e+02)\", exp (7.10e+02), INF);\ncheck_double (\"exp (-7.40e+02)\", exp (-7.40e+02), 4.19955798965059562550E-322);\ncheck_double (\"exp (-7.50e+02)\", exp (-7.50e+02), 0.00000000000000000000E+00);\ncheck_double (\"exp (0.34)\", exp (0.34), 1.40494759056359375116E+00);\ncheck_double (\"exp (-0.34)\", exp (-0.34), 7.11770322762609652933E-01);\ncheck_double (\"exp (0.35)\", exp (0.35), 1.41906754859325712204E+00);\ncheck_double (\"exp (-0.35)\", exp (-0.35), 7.04688089718713439602E-01);\ncheck_double (\"exp (1.03)\", exp (1.03), 2.80106583469907910455E+00);\ncheck_double (\"exp (-1.03)\", exp (-1.03), 3.57006960569147380191E-01);\ncheck_double (\"exp (1.04)\", exp (1.04), 2.82921701435155981130E+00);\ncheck_double (\"exp (-1.04)\", exp (-1.04), 3.53454681958780159157E-01);\ncheck_double (\"exp (3.72e-09)\", exp (3.72e-09), 1.00000000372000008575E+00);\ncheck_double (\"exp (-3.72e-09)\", exp (-3.72e-09), 9.99999996280000025273E-01);\ncheck_double (\"exp (3.73e-09)\", exp (3.73e-09), 1.00000000373000008658E+00);\ncheck_double (\"exp (-3.73e-09)\", exp (-3.73e-09), 9.99999996270000024445E-01);\ncheck_double (\"exp (2.0)\", exp (2.0), 7.38905609893065040694E+00);\ncheck_double (\"exp (3.0)\", exp (3.0), 2.00855369231876679237E+01);\ncheck_double (\"exp (0.7)\", exp (0.7), 2.01375270747047663278E+00);\ncheck_double (\"exp (38.0)\", exp (38.0), 3.18559317571137560000E+16);\ncheck_double (\"expm1 (0.0)\", expm1 (0.0), 0.00000000000000000000E+00);\ncheck_double (\"expm1 (-0.0)\", expm1 (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"expm1 (1.0)\", expm1 (1.0), 1.71828182845904531284E+00);\ncheck_double (\"expm1 (-1.0)\", expm1 (-1.0), -6.32120558828557665976E-01);\ncheck_double (\"expm1 (INFINITY)\", expm1 (INFINITY), INF);\ncheck_double (\"expm1 (-INFINITY)\", expm1 (-INFINITY), -1.00000000000000000000E+00);\ncheck_double (\"expm1 (NAN)\", expm1 (NAN), NAN);\ncheck_double (\"expm1 (7.08e+02)\", expm1 (7.08e+02), 3.02338314427605515848E+307);\ncheck_double (\"expm1 (7.095e+02)\", expm1 (7.095e+02), 1.35498631931463283283E+308);\ncheck_double (\"expm1 (7.10e+02)\", expm1 (7.10e+02), INF);\ncheck_double (\"expm1 (-7.40e+02)\", expm1 (-7.40e+02), -1.00000000000000000000E+00);\ncheck_double (\"expm1 (-7.50e+02)\", expm1 (-7.50e+02), -1.00000000000000000000E+00);\ncheck_double (\"expm1 (0.34)\", expm1 (0.34), 4.04947590563593806667E-01);\ncheck_double (\"expm1 (-0.34)\", expm1 (-0.34), -2.88229677237390291555E-01);\ncheck_double (\"expm1 (0.35)\", expm1 (0.35), 4.19067548593257233058E-01);\ncheck_double (\"expm1 (-0.35)\", expm1 (-0.35), -2.95311910281286560398E-01);\ncheck_double (\"expm1 (1.03)\", expm1 (1.03), 1.80106583469907910455E+00);\ncheck_double (\"expm1 (-1.03)\", expm1 (-1.03), -6.42993039430852619809E-01);\ncheck_double (\"expm1 (1.04)\", expm1 (1.04), 1.82921701435155958926E+00);\ncheck_double (\"expm1 (-1.04)\", expm1 (-1.04), -6.46545318041219840843E-01);\ncheck_double (\"expm1 (3.72e-09)\", expm1 (3.72e-09), 3.72000000691919994955E-09);\ncheck_double (\"expm1 (-3.72e-09)\", expm1 (-3.72e-09), -3.71999999308080000097E-09);\ncheck_double (\"expm1 (3.73e-09)\", expm1 (3.73e-09), 3.73000000695645013275E-09);\ncheck_double (\"expm1 (-3.73e-09)\", expm1 (-3.73e-09), -3.72999999304355016230E-09);\ncheck_double (\"expm1 (2.0)\", expm1 (2.0), 6.38905609893065040694E+00);\ncheck_double (\"expm1 (3.0)\", expm1 (3.0), 1.90855369231876679237E+01);\ncheck_double (\"expm1 (0.7)\", expm1 (0.7), 1.01375270747047641073E+00);\ncheck_double (\"expm1 (38.0)\", expm1 (38.0), 3.18559317571137560000E+16);\ncheck_double (\"fabs (0.0)\", fabs (0.0), 0.00000000000000000000E+00);\ncheck_double (\"fabs (-0.0)\", fabs (-0.0), 0.00000000000000000000E+00);\ncheck_double (\"fabs (1.0)\", fabs (1.0), 1.00000000000000000000E+00);\ncheck_double (\"fabs (-1.0)\", fabs (-1.0), 1.00000000000000000000E+00);\ncheck_double (\"fabs (INFINITY)\", fabs (INFINITY), INF);\ncheck_double (\"fabs (-INFINITY)\", fabs (-INFINITY), INF);\ncheck_double (\"fabs (NAN)\", fabs (NAN), NAN);\ncheck_double (\"fabs (3.14)\", fabs (3.14), 3.14000000000000012434E+00);\ncheck_double (\"fabs (-3.14)\", fabs (-3.14), 3.14000000000000012434E+00);\ncheck_double (\"fabs (0.7)\", fabs (0.7), 6.99999999999999955591E-01);\ncheck_double (\"fabs (-0.7)\", fabs (-0.7), 6.99999999999999955591E-01);\ncheck_double (\"fabs (3.72e-09)\", fabs (3.72e-09), 3.71999999999999997526E-09);\ncheck_double (\"fabs (-3.72e-09)\", fabs (-3.72e-09), 3.71999999999999997526E-09);\ncheck_double (\"fabs (7.37e+19)\", fabs (7.37e+19), 7.37000000000000000000E+19);\ncheck_double (\"fabs (-7.37e+19)\", fabs (-7.37e+19), 7.37000000000000000000E+19);\ncheck_double (\"floor (0.0)\", floor (0.0), 0.00000000000000000000E+00);\ncheck_double (\"floor (-0.0)\", floor (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"floor (INFINITY)\", floor (INFINITY), INF);\ncheck_double (\"floor (-INFINITY)\", floor (-INFINITY), -INF);\ncheck_double (\"floor (NAN)\", floor (NAN), NAN);\ncheck_double (\"floor (3.14)\", floor (3.14), 3.00000000000000000000E+00);\ncheck_double (\"floor (-3.14)\", floor (-3.14), -4.00000000000000000000E+00);\ncheck_double (\"floor (3.72e-09)\", floor (3.72e-09), 0.00000000000000000000E+00);\ncheck_double (\"floor (-3.72e-09)\", floor (-3.72e-09), -1.00000000000000000000E+00);\ncheck_double (\"floor (7.37e+19)\", floor (7.37e+19), 7.37000000000000000000E+19);\ncheck_double (\"floor (-7.37e+19)\", floor (-7.37e+19), -7.37000000000000000000E+19);\ncheck_double (\"fmod (0.0, 0.0)\", fmod (0.0, 0.0), -NAN);\ncheck_double (\"fmod (0.0, -0.0)\", fmod (0.0, -0.0), -NAN);\ncheck_double (\"fmod (-0.0, 0.0)\", fmod (-0.0, 0.0), -NAN);\ncheck_double (\"fmod (-0.0, -0.0)\", fmod (-0.0, -0.0), -NAN);\ncheck_double (\"fmod (0.0, 3.0)\", fmod (0.0, 3.0), 0.00000000000000000000E+00);\ncheck_double (\"fmod (0.0, -3.0)\", fmod (0.0, -3.0), 0.00000000000000000000E+00);\ncheck_double (\"fmod (-0.0, 3.0)\", fmod (-0.0, 3.0), -0.00000000000000000000E+00);\ncheck_double (\"fmod (-0.0, -3.0)\", fmod (-0.0, -3.0), -0.00000000000000000000E+00);\ncheck_double (\"fmod (0.0, INFINITY)\", fmod (0.0, INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"fmod (0.0, -INFINITY)\", fmod (0.0, -INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"fmod (-0.0, INFINITY)\", fmod (-0.0, INFINITY), -0.00000000000000000000E+00);\ncheck_double (\"fmod (-0.0, -INFINITY)\", fmod (-0.0, -INFINITY), -0.00000000000000000000E+00);\ncheck_double (\"fmod (0.0, NAN)\", fmod (0.0, NAN), NAN);\ncheck_double (\"fmod (-0.0, NAN)\", fmod (-0.0, NAN), NAN);\ncheck_double (\"fmod (3.0, 0.0)\", fmod (3.0, 0.0), -NAN);\ncheck_double (\"fmod (3.0, -0.0)\", fmod (3.0, -0.0), -NAN);\ncheck_double (\"fmod (-3.0, 0.0)\", fmod (-3.0, 0.0), -NAN);\ncheck_double (\"fmod (-3.0, -0.0)\", fmod (-3.0, -0.0), -NAN);\ncheck_double (\"fmod (3.0, 3.0)\", fmod (3.0, 3.0), 0.00000000000000000000E+00);\ncheck_double (\"fmod (3.0, -3.0)\", fmod (3.0, -3.0), 0.00000000000000000000E+00);\ncheck_double (\"fmod (-3.0, 3.0)\", fmod (-3.0, 3.0), -0.00000000000000000000E+00);\ncheck_double (\"fmod (-3.0, -3.0)\", fmod (-3.0, -3.0), -0.00000000000000000000E+00);\ncheck_double (\"fmod (3.0, INFINITY)\", fmod (3.0, INFINITY), 3.00000000000000000000E+00);\ncheck_double (\"fmod (3.0, -INFINITY)\", fmod (3.0, -INFINITY), 3.00000000000000000000E+00);\ncheck_double (\"fmod (-3.0, INFINITY)\", fmod (-3.0, INFINITY), -3.00000000000000000000E+00);\ncheck_double (\"fmod (-3.0, -INFINITY)\", fmod (-3.0, -INFINITY), -3.00000000000000000000E+00);\ncheck_double (\"fmod (3.0, NAN)\", fmod (3.0, NAN), NAN);\ncheck_double (\"fmod (-3.0, NAN)\", fmod (-3.0, NAN), NAN);\ncheck_double (\"fmod (INFINITY, 0.0)\", fmod (INFINITY, 0.0), -NAN);\ncheck_double (\"fmod (INFINITY, -0.0)\", fmod (INFINITY, -0.0), -NAN);\ncheck_double (\"fmod (-INFINITY, 0.0)\", fmod (-INFINITY, 0.0), -NAN);\ncheck_double (\"fmod (-INFINITY, -0.0)\", fmod (-INFINITY, -0.0), -NAN);\ncheck_double (\"fmod (INFINITY, 3.0)\", fmod (INFINITY, 3.0), -NAN);\ncheck_double (\"fmod (INFINITY, -3.0)\", fmod (INFINITY, -3.0), -NAN);\ncheck_double (\"fmod (-INFINITY, 3.0)\", fmod (-INFINITY, 3.0), -NAN);\ncheck_double (\"fmod (-INFINITY, -3.0)\", fmod (-INFINITY, -3.0), -NAN);\ncheck_double (\"fmod (INFINITY, INFINITY)\", fmod (INFINITY, INFINITY), -NAN);\ncheck_double (\"fmod (INFINITY, -INFINITY)\", fmod (INFINITY, -INFINITY), -NAN);\ncheck_double (\"fmod (-INFINITY, INFINITY)\", fmod (-INFINITY, INFINITY), -NAN);\ncheck_double (\"fmod (-INFINITY, -INFINITY)\", fmod (-INFINITY, -INFINITY), -NAN);\ncheck_double (\"fmod (INFINITY, NAN)\", fmod (INFINITY, NAN), NAN);\ncheck_double (\"fmod (-INFINITY, NAN)\", fmod (-INFINITY, NAN), NAN);\ncheck_double (\"fmod (NAN, 0.0)\", fmod (NAN, 0.0), NAN);\ncheck_double (\"fmod (NAN, -0.0)\", fmod (NAN, -0.0), NAN);\ncheck_double (\"fmod (NAN, 3.0)\", fmod (NAN, 3.0), NAN);\ncheck_double (\"fmod (NAN, -3.0)\", fmod (NAN, -3.0), NAN);\ncheck_double (\"fmod (NAN, INFINITY)\", fmod (NAN, INFINITY), NAN);\ncheck_double (\"fmod (NAN, -INFINITY)\", fmod (NAN, -INFINITY), NAN);\ncheck_double (\"fmod (NAN, NAN)\", fmod (NAN, NAN), NAN);\ncheck_double (\"fmod (3.0, 1.0)\", fmod (3.0, 1.0), 0.00000000000000000000E+00);\ncheck_double (\"fmod (3.0, -1.0)\", fmod (3.0, -1.0), 0.00000000000000000000E+00);\ncheck_double (\"fmod (-3.0, 1.0)\", fmod (-3.0, 1.0), -0.00000000000000000000E+00);\ncheck_double (\"fmod (-3.0, -1.0)\", fmod (-3.0, -1.0), -0.00000000000000000000E+00);\ncheck_double (\"fmod (6.5, 2.3)\", fmod (6.5, 2.3), 1.90000000000000035527E+00);\ncheck_double (\"fmod (6.5, -2.3)\", fmod (6.5, -2.3), 1.90000000000000035527E+00);\ncheck_double (\"fmod (-6.5, 2.3)\", fmod (-6.5, 2.3), -1.90000000000000035527E+00);\ncheck_double (\"fmod (-6.5, -2.3)\", fmod (-6.5, -2.3), -1.90000000000000035527E+00);\ncheck_int (\"isfinite (0.0)\", isfinite (0.0), 1);\ncheck_int (\"isfinite (-0.0)\", isfinite (-0.0), 1);\ncheck_int (\"isfinite (1.0)\", isfinite (1.0), 1);\ncheck_int (\"isfinite (-1.0)\", isfinite (-1.0), 1);\ncheck_int (\"isfinite (INFINITY)\", isfinite (INFINITY), 0);\ncheck_int (\"isfinite (-INFINITY)\", isfinite (-INFINITY), 0);\ncheck_int (\"isfinite (NAN)\", isfinite (NAN), 0);\ncheck_int (\"isfinite (3.14)\", isfinite (3.14), 1);\ncheck_int (\"isfinite (-3.14)\", isfinite (-3.14), 1);\ncheck_int (\"isfinite (0.7)\", isfinite (0.7), 1);\ncheck_int (\"isfinite (-0.7)\", isfinite (-0.7), 1);\ncheck_int (\"isfinite (3.72e-09)\", isfinite (3.72e-09), 1);\ncheck_int (\"isfinite (-3.72e-09)\", isfinite (-3.72e-09), 1);\ncheck_int (\"isfinite (7.37e+19)\", isfinite (7.37e+19), 1);\ncheck_int (\"isfinite (-7.37e+19)\", isfinite (-7.37e+19), 1);\ncheck_int (\"isinf (0.0)\", isinf (0.0), 0);\ncheck_int (\"isinf (-0.0)\", isinf (-0.0), 0);\ncheck_int (\"isinf (1.0)\", isinf (1.0), 0);\ncheck_int (\"isinf (-1.0)\", isinf (-1.0), 0);\ncheck_int (\"isinf (INFINITY)\", isinf (INFINITY), 1);\ncheck_int (\"isinf (-INFINITY)\", isinf (-INFINITY), -1);\ncheck_int (\"isinf (NAN)\", isinf (NAN), 0);\ncheck_int (\"isinf (3.14)\", isinf (3.14), 0);\ncheck_int (\"isinf (-3.14)\", isinf (-3.14), 0);\ncheck_int (\"isinf (0.7)\", isinf (0.7), 0);\ncheck_int (\"isinf (-0.7)\", isinf (-0.7), 0);\ncheck_int (\"isinf (3.72e-09)\", isinf (3.72e-09), 0);\ncheck_int (\"isinf (-3.72e-09)\", isinf (-3.72e-09), 0);\ncheck_int (\"isinf (7.37e+19)\", isinf (7.37e+19), 0);\ncheck_int (\"isinf (-7.37e+19)\", isinf (-7.37e+19), 0);\ncheck_int (\"isnan (0.0)\", isnan (0.0), 0);\ncheck_int (\"isnan (-0.0)\", isnan (-0.0), 0);\ncheck_int (\"isnan (1.0)\", isnan (1.0), 0);\ncheck_int (\"isnan (-1.0)\", isnan (-1.0), 0);\ncheck_int (\"isnan (INFINITY)\", isnan (INFINITY), 0);\ncheck_int (\"isnan (-INFINITY)\", isnan (-INFINITY), 0);\ncheck_int (\"isnan (NAN)\", isnan (NAN), 1);\ncheck_int (\"isnan (3.14)\", isnan (3.14), 0);\ncheck_int (\"isnan (-3.14)\", isnan (-3.14), 0);\ncheck_int (\"isnan (0.7)\", isnan (0.7), 0);\ncheck_int (\"isnan (-0.7)\", isnan (-0.7), 0);\ncheck_int (\"isnan (3.72e-09)\", isnan (3.72e-09), 0);\ncheck_int (\"isnan (-3.72e-09)\", isnan (-3.72e-09), 0);\ncheck_int (\"isnan (7.37e+19)\", isnan (7.37e+19), 0);\ncheck_int (\"isnan (-7.37e+19)\", isnan (-7.37e+19), 0);\ncheck_double (\"log (0.0)\", log (0.0), -INF);\ncheck_double (\"log (-0.0)\", log (-0.0), -INF);\ncheck_double (\"log (1.0)\", log (1.0), 0.00000000000000000000E+00);\ncheck_double (\"log (-1.0)\", log (-1.0), NAN);\ncheck_double (\"log (INFINITY)\", log (INFINITY), INF);\ncheck_double (\"log (-INFINITY)\", log (-INFINITY), NAN);\ncheck_double (\"log (NAN)\", log (NAN), NAN);\ncheck_double (\"log (M_E)\", log (M_E), 1.00000000000000000000E+00);\ncheck_double (\"log (1.0 / M_E)\", log (1.0 / M_E), -1.00000000000000000000E+00);\ncheck_double (\"log (2)\", log (2), 6.93147180559945286227E-01);\ncheck_double (\"log (10)\", log (10), 2.30258509299404590109E+00);\ncheck_double (\"log (0.7)\", log (0.7), -3.56674943938732447180E-01);\ncheck_double (\"log (2.22e-308)\", log (2.22e-308), -7.08398701446281847893E+02);\ncheck_double (\"log (2.23e-308)\", log (2.23e-308), -7.08394207056694085622E+02);\ncheck_double (\"log (0.17)\", log (0.17), -1.77195684193187519284E+00);\ncheck_double (\"log (0.18)\", log (0.18), -1.71479842809192661868E+00);\ncheck_double (\"log (1999.0)\", log (1999.0), 7.60040233450039970364E+00);\ncheck_double (\"log (2000.0)\", log (2000.0), 7.60090245954208221235E+00);\ncheck_double (\"log (2001.0)\", log (2001.0), 7.60140233458373337783E+00);\ncheck_double (\"log1p (0.0)\", log1p (0.0), 0.00000000000000000000E+00);\ncheck_double (\"log1p (-0.0)\", log1p (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"log1p (1.0)\", log1p (1.0), 6.93147180559945286227E-01);\ncheck_double (\"log1p (-1.0)\", log1p (-1.0), -INF);\ncheck_double (\"log1p (INFINITY)\", log1p (INFINITY), INF);\ncheck_double (\"log1p (-INFINITY)\", log1p (-INFINITY), -NAN);\ncheck_double (\"log1p (NAN)\", log1p (NAN), NAN);\ncheck_double (\"log1p (M_E)\", log1p (M_E), 1.31326168751822280889E+00);\ncheck_double (\"log1p (1.0 / M_E)\", log1p (1.0 / M_E), 3.13261687518222864401E-01);\ncheck_double (\"log1p (2)\", log1p (2), 1.09861228866810978211E+00);\ncheck_double (\"log1p (10)\", log1p (10), 2.39789527279837066942E+00);\ncheck_double (\"log1p (0.7)\", log1p (0.7), 5.30628251062170375185E-01);\ncheck_double (\"log1p (2.22e-308)\", log1p (2.22e-308), 2.22000000000000013467E-308);\ncheck_double (\"log1p (2.23e-308)\", log1p (2.23e-308), 2.23000000000000010412E-308);\ncheck_double (\"log1p (0.17)\", log1p (0.17), 1.57003748809664750441E-01);\ncheck_double (\"log1p (0.18)\", log1p (0.18), 1.65514438477573383457E-01);\ncheck_double (\"log1p (1999.0)\", log1p (1999.0), 7.60090245954208221235E+00);\ncheck_double (\"log1p (2000.0)\", log1p (2000.0), 7.60140233458373337783E+00);\ncheck_double (\"log1p (2001.0)\", log1p (2001.0), 7.60190195987516581511E+00);\ncheck_double (\"log2 (0.0)\", log2 (0.0), -INF);\ncheck_double (\"log2 (-0.0)\", log2 (-0.0), -INF);\ncheck_double (\"log2 (1.0)\", log2 (1.0), 0.00000000000000000000E+00);\ncheck_double (\"log2 (-1.0)\", log2 (-1.0), NAN);\ncheck_double (\"log2 (INFINITY)\", log2 (INFINITY), INF);\ncheck_double (\"log2 (-INFINITY)\", log2 (-INFINITY), NAN);\ncheck_double (\"log2 (NAN)\", log2 (NAN), NAN);\ncheck_double (\"log2 (M_E)\", log2 (M_E), 1.44269504088896338700E+00);\ncheck_double (\"log2 (1.0 / M_E)\", log2 (1.0 / M_E), -1.44269504088896338700E+00);\ncheck_double (\"log2 (2)\", log2 (2), 1.00000000000000000000E+00);\ncheck_double (\"log2 (10)\", log2 (10), 3.32192809488736218171E+00);\ncheck_double (\"log2 (0.7)\", log2 (0.7), -5.14573172829758340718E-01);\ncheck_double (\"log2 (2.22e-308)\", log2 (2.22e-308), -1.02200329354873224474E+03);\ncheck_double (\"log2 (2.23e-308)\", log2 (2.23e-308), -1.02199680951516199912E+03);\ncheck_double (\"log2 (0.17)\", log2 (0.17), -2.55639334852438526724E+00);\ncheck_double (\"log2 (0.18)\", log2 (0.18), -2.47393118833241221211E+00);\ncheck_double (\"log2 (1999.0)\", log2 (1999.0), 1.09650627567446274924E+01);\ncheck_double (\"log2 (2000.0)\", log2 (2000.0), 1.09657842846620869892E+01);\ncheck_double (\"log2 (2001.0)\", log2 (2001.0), 1.09665054519057409976E+01);\ncheck_double (\"log10 (0.0)\", log10 (0.0), -INF);\ncheck_double (\"log10 (-0.0)\", log10 (-0.0), -INF);\ncheck_double (\"log10 (1.0)\", log10 (1.0), 0.00000000000000000000E+00);\ncheck_double (\"log10 (-1.0)\", log10 (-1.0), NAN);\ncheck_double (\"log10 (INFINITY)\", log10 (INFINITY), INF);\ncheck_double (\"log10 (-INFINITY)\", log10 (-INFINITY), NAN);\ncheck_double (\"log10 (NAN)\", log10 (NAN), NAN);\ncheck_double (\"log10 (M_E)\", log10 (M_E), 4.34294481903251816668E-01);\ncheck_double (\"log10 (1.0 / M_E)\", log10 (1.0 / M_E), -4.34294481903251816668E-01);\ncheck_double (\"log10 (2)\", log10 (2), 3.01029995663981198017E-01);\ncheck_double (\"log10 (10)\", log10 (10), 1.00000000000000000000E+00);\ncheck_double (\"log10 (0.7)\", log10 (0.7), -1.54901959985743187254E-01);\ncheck_double (\"log10 (2.22e-308)\", log10 (2.22e-308), -3.07653647025549389582E+02);\ncheck_double (\"log10 (2.23e-308)\", log10 (2.23e-308), -3.07651695136951843779E+02);\ncheck_double (\"log10 (0.17)\", log10 (0.17), -7.69551078621726003526E-01);\ncheck_double (\"log10 (0.18)\", log10 (0.18), -7.44727494896693986703E-01);\ncheck_double (\"log10 (1999.0)\", log10 (1999.0), 3.30081279411811712166E+00);\ncheck_double (\"log10 (2000.0)\", log10 (2000.0), 3.30102999566398125353E+00);\ncheck_double (\"log10 (2001.0)\", log10 (2001.0), 3.30124708863621130206E+00);\ncheck_double (\"pow (0.0, 0.0)\", pow (0.0, 0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (0.0, -0.0)\", pow (0.0, -0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (-0.0, 0.0)\", pow (-0.0, 0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (-0.0, -0.0)\", pow (-0.0, -0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (0.0, 1.0)\", pow (0.0, 1.0), 0.00000000000000000000E+00);\ncheck_double (\"pow (0.0, -1.0)\", pow (0.0, -1.0), INF);\ncheck_double (\"pow (-0.0, 1.0)\", pow (-0.0, 1.0), -0.00000000000000000000E+00);\ncheck_double (\"pow (-0.0, -1.0)\", pow (-0.0, -1.0), -INF);\ncheck_double (\"pow (0.0, INFINITY)\", pow (0.0, INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"pow (0.0, -INFINITY)\", pow (0.0, -INFINITY), INF);\ncheck_double (\"pow (-0.0, INFINITY)\", pow (-0.0, INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"pow (-0.0, -INFINITY)\", pow (-0.0, -INFINITY), INF);\ncheck_double (\"pow (0.0, NAN)\", pow (0.0, NAN), NAN);\ncheck_double (\"pow (-0.0, NAN)\", pow (-0.0, NAN), NAN);\ncheck_double (\"pow (1.0, 0.0)\", pow (1.0, 0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (1.0, -0.0)\", pow (1.0, -0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (-1.0, 0.0)\", pow (-1.0, 0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (-1.0, -0.0)\", pow (-1.0, -0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (1.0, 1.0)\", pow (1.0, 1.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (1.0, -1.0)\", pow (1.0, -1.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (-1.0, 1.0)\", pow (-1.0, 1.0), -1.00000000000000000000E+00);\ncheck_double (\"pow (-1.0, -1.0)\", pow (-1.0, -1.0), -1.00000000000000000000E+00);\ncheck_double (\"pow (1.0, INFINITY)\", pow (1.0, INFINITY), 1.00000000000000000000E+00);\ncheck_double (\"pow (1.0, -INFINITY)\", pow (1.0, -INFINITY), 1.00000000000000000000E+00);\ncheck_double (\"pow (-1.0, INFINITY)\", pow (-1.0, INFINITY), 1.00000000000000000000E+00);\ncheck_double (\"pow (-1.0, -INFINITY)\", pow (-1.0, -INFINITY), 1.00000000000000000000E+00);\ncheck_double (\"pow (1.0, NAN)\", pow (1.0, NAN), 1.00000000000000000000E+00);\ncheck_double (\"pow (-1.0, NAN)\", pow (-1.0, NAN), NAN);\ncheck_double (\"pow (INFINITY, 0.0)\", pow (INFINITY, 0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (INFINITY, -0.0)\", pow (INFINITY, -0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (-INFINITY, 0.0)\", pow (-INFINITY, 0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (-INFINITY, -0.0)\", pow (-INFINITY, -0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (INFINITY, 1.0)\", pow (INFINITY, 1.0), INF);\ncheck_double (\"pow (INFINITY, -1.0)\", pow (INFINITY, -1.0), 0.00000000000000000000E+00);\ncheck_double (\"pow (-INFINITY, 1.0)\", pow (-INFINITY, 1.0), -INF);\ncheck_double (\"pow (-INFINITY, -1.0)\", pow (-INFINITY, -1.0), -0.00000000000000000000E+00);\ncheck_double (\"pow (INFINITY, INFINITY)\", pow (INFINITY, INFINITY), INF);\ncheck_double (\"pow (INFINITY, -INFINITY)\", pow (INFINITY, -INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"pow (-INFINITY, INFINITY)\", pow (-INFINITY, INFINITY), INF);\ncheck_double (\"pow (-INFINITY, -INFINITY)\", pow (-INFINITY, -INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"pow (INFINITY, NAN)\", pow (INFINITY, NAN), NAN);\ncheck_double (\"pow (-INFINITY, NAN)\", pow (-INFINITY, NAN), NAN);\ncheck_double (\"pow (NAN, 0.0)\", pow (NAN, 0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (NAN, -0.0)\", pow (NAN, -0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (NAN, 1.0)\", pow (NAN, 1.0), NAN);\ncheck_double (\"pow (NAN, -1.0)\", pow (NAN, -1.0), NAN);\ncheck_double (\"pow (NAN, INFINITY)\", pow (NAN, INFINITY), NAN);\ncheck_double (\"pow (NAN, -INFINITY)\", pow (NAN, -INFINITY), NAN);\ncheck_double (\"pow (NAN, NAN)\", pow (NAN, NAN), NAN);\ncheck_double (\"pow (0.9, INFINITY)\", pow (0.9, INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"pow (0.9, -INFINITY)\", pow (0.9, -INFINITY), INF);\ncheck_double (\"pow (-0.9, INFINITY)\", pow (-0.9, INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"pow (-0.9, -INFINITY)\", pow (-0.9, -INFINITY), INF);\ncheck_double (\"pow (1.1, INFINITY)\", pow (1.1, INFINITY), INF);\ncheck_double (\"pow (1.1, -INFINITY)\", pow (1.1, -INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"pow (-1.1, INFINITY)\", pow (-1.1, INFINITY), INF);\ncheck_double (\"pow (-1.1, -INFINITY)\", pow (-1.1, -INFINITY), 0.00000000000000000000E+00);\ncheck_double (\"pow (0.0, 2.0)\", pow (0.0, 2.0), 0.00000000000000000000E+00);\ncheck_double (\"pow (0.0, -2.0)\", pow (0.0, -2.0), INF);\ncheck_double (\"pow (-0.0, 2.0)\", pow (-0.0, 2.0), 0.00000000000000000000E+00);\ncheck_double (\"pow (-0.0, -2.0)\", pow (-0.0, -2.0), INF);\ncheck_double (\"pow (0.0, 3.0)\", pow (0.0, 3.0), 0.00000000000000000000E+00);\ncheck_double (\"pow (0.0, -3.0)\", pow (0.0, -3.0), INF);\ncheck_double (\"pow (-0.0, 3.0)\", pow (-0.0, 3.0), -0.00000000000000000000E+00);\ncheck_double (\"pow (-0.0, -3.0)\", pow (-0.0, -3.0), -INF);\ncheck_double (\"pow (0.0, 3.14)\", pow (0.0, 3.14), 0.00000000000000000000E+00);\ncheck_double (\"pow (0.0, -3.14)\", pow (0.0, -3.14), INF);\ncheck_double (\"pow (-0.0, 3.14)\", pow (-0.0, 3.14), 0.00000000000000000000E+00);\ncheck_double (\"pow (-0.0, -3.14)\", pow (-0.0, -3.14), INF);\ncheck_double (\"pow (1.0, 3.14)\", pow (1.0, 3.14), 1.00000000000000000000E+00);\ncheck_double (\"pow (1.0, -3.14)\", pow (1.0, -3.14), 1.00000000000000000000E+00);\ncheck_double (\"pow (-1.0, 3.14)\", pow (-1.0, 3.14), -NAN);\ncheck_double (\"pow (-1.0, -3.14)\", pow (-1.0, -3.14), -NAN);\ncheck_double (\"pow (3.14, 0.0)\", pow (3.14, 0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (3.14, -0.0)\", pow (3.14, -0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (-3.14, 0.0)\", pow (-3.14, 0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (-3.14, -0.0)\", pow (-3.14, -0.0), 1.00000000000000000000E+00);\ncheck_double (\"pow (3.14, 1.0)\", pow (3.14, 1.0), 3.14000000000000012434E+00);\ncheck_double (\"pow (3.14, -1.0)\", pow (3.14, -1.0), 3.18471337579617819191E-01);\ncheck_double (\"pow (-3.14, 1.0)\", pow (-3.14, 1.0), -3.14000000000000012434E+00);\ncheck_double (\"pow (-3.14, -1.0)\", pow (-3.14, -1.0), -3.18471337579617819191E-01);\ncheck_double (\"pow (3.14, 2.0)\", pow (3.14, 2.0), 9.85960000000000036380E+00);\ncheck_double (\"pow (3.14, -2.0)\", pow (3.14, -2.0), 1.01423992859750899953E-01);\ncheck_double (\"pow (-3.14, 2.0)\", pow (-3.14, 2.0), 9.85960000000000036380E+00);\ncheck_double (\"pow (-3.14, -2.0)\", pow (-3.14, -2.0), 1.01423992859750899953E-01);\ncheck_double (\"pow (3.14, 3.0)\", pow (3.14, 3.0), 3.09591440000000019950E+01);\ncheck_double (\"pow (3.14, -3.0)\", pow (3.14, -3.0), 3.23006346687104775595E-02);\ncheck_double (\"pow (-3.14, 3.0)\", pow (-3.14, 3.0), -3.09591440000000019950E+01);\ncheck_double (\"pow (-3.14, -3.0)\", pow (-3.14, -3.0), -3.23006346687104775595E-02);\ncheck_double (\"pow (3.14, 3.14)\", pow (3.14, 3.14), 3.63378388801747078674E+01);\ncheck_double (\"pow (3.14, -3.14)\", pow (3.14, -3.14), 2.75195231972252124519E-02);\ncheck_double (\"pow (-3.14, 3.14)\", pow (-3.14, 3.14), -NAN);\ncheck_double (\"pow (-3.14, -3.14)\", pow (-3.14, -3.14), -NAN);\ncheck_double (\"pow (INFINITY, 2.0)\", pow (INFINITY, 2.0), INF);\ncheck_double (\"pow (INFINITY, -2.0)\", pow (INFINITY, -2.0), 0.00000000000000000000E+00);\ncheck_double (\"pow (-INFINITY, 2.0)\", pow (-INFINITY, 2.0), INF);\ncheck_double (\"pow (-INFINITY, -2.0)\", pow (-INFINITY, -2.0), 0.00000000000000000000E+00);\ncheck_double (\"pow (INFINITY, 3.0)\", pow (INFINITY, 3.0), INF);\ncheck_double (\"pow (INFINITY, -3.0)\", pow (INFINITY, -3.0), 0.00000000000000000000E+00);\ncheck_double (\"pow (-INFINITY, 3.0)\", pow (-INFINITY, 3.0), -INF);\ncheck_double (\"pow (-INFINITY, -3.0)\", pow (-INFINITY, -3.0), -0.00000000000000000000E+00);\ncheck_double (\"pow (INFINITY, 3.14)\", pow (INFINITY, 3.14), INF);\ncheck_double (\"pow (INFINITY, -3.14)\", pow (INFINITY, -3.14), 0.00000000000000000000E+00);\ncheck_double (\"pow (-INFINITY, 3.14)\", pow (-INFINITY, 3.14), INF);\ncheck_double (\"pow (-INFINITY, -3.14)\", pow (-INFINITY, -3.14), 0.00000000000000000000E+00);\ncheck_double (\"pow (0.7, 1.2)\", pow (0.7, 1.2), 6.51804940566386381562E-01);\ncheck_double (\"sqrt (0.0)\", sqrt (0.0), 0.00000000000000000000E+00);\ncheck_double (\"sqrt (-0.0)\", sqrt (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"sqrt (1.0)\", sqrt (1.0), 1.00000000000000000000E+00);\ncheck_double (\"sqrt (-1.0)\", sqrt (-1.0), -NAN);\ncheck_double (\"sqrt (INFINITY)\", sqrt (INFINITY), INF);\ncheck_double (\"sqrt (-INFINITY)\", sqrt (-INFINITY), -NAN);\ncheck_double (\"sqrt (NAN)\", sqrt (NAN), NAN);\ncheck_double (\"sqrt (0.7)\", sqrt (0.7), 8.36660026534075562665E-01);\ncheck_double (\"sqrt (2)\", sqrt (2), 1.41421356237309514547E+00);\ncheck_double (\"sqrt (10)\", sqrt (10), 3.16227766016837952279E+00);\ncheck_double (\"sqrt (2.22e-308)\", sqrt (2.22e-308), 1.48996644257513405066E-154);\ncheck_double (\"sqrt (2.23e-308)\", sqrt (2.23e-308), 1.49331845230680803391E-154);\ncheck_double (\"sqrt (3.72e-09)\", sqrt (3.72e-09), 6.09918027279076225416E-05);\ncheck_double (\"sqrt (7.37e+19)\", sqrt (7.37e+19), 8.58487041253390121460E+09);\ncheck_double (\"sqrt (2209)\", sqrt (2209), 4.70000000000000000000E+01);\ncheck_double (\"sqrt (4)\", sqrt (4), 2.00000000000000000000E+00);\ncheck_double (\"sqrt (0.25)\", sqrt (0.25), 5.00000000000000000000E-01);\ncheck_double (\"sqrt (6642.25)\", sqrt (6642.25), 8.15000000000000000000E+01);\ncheck_double (\"sqrt (15239.9025)\", sqrt (15239.9025), 1.23450000000000002842E+02);\ncheck_double (\"cbrt (0.0)\", cbrt (0.0), 0.00000000000000000000E+00);\ncheck_double (\"cbrt (-0.0)\", cbrt (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"cbrt (1.0)\", cbrt (1.0), 1.00000000000000000000E+00);\ncheck_double (\"cbrt (-1.0)\", cbrt (-1.0), -1.00000000000000000000E+00);\ncheck_double (\"cbrt (INFINITY)\", cbrt (INFINITY), INF);\ncheck_double (\"cbrt (-INFINITY)\", cbrt (-INFINITY), -INF);\ncheck_double (\"cbrt (NAN)\", cbrt (NAN), NAN);\ncheck_double (\"cbrt (0.7)\", cbrt (0.7), 8.87904001742600645919E-01);\ncheck_double (\"cbrt (2)\", cbrt (2), 1.25992104989487319067E+00);\ncheck_double (\"cbrt (10)\", cbrt (10), 2.15443469003188381450E+00);\ncheck_double (\"cbrt (2.22e-308)\", cbrt (2.22e-308), 2.81050475771047639693E-103);\ncheck_double (\"cbrt (2.23e-308)\", cbrt (2.23e-308), 2.81471841433133404618E-103);\ncheck_double (\"cbrt (3.72e-09)\", cbrt (3.72e-09), 1.54946217899915657419E-03);\ncheck_double (\"cbrt (7.37e+19)\", cbrt (7.37e+19), 4.19265534205965511501E+06);\ncheck_double (\"cbrt (2209)\", cbrt (2209), 1.30236256766892157799E+01);\ncheck_double (\"cbrt (4)\", cbrt (4), 1.58740105196819958344E+00);\ncheck_double (\"cbrt (0.25)\", cbrt (0.25), 6.29960524947436595333E-01);\ncheck_double (\"cbrt (6642.25)\", cbrt (6642.25), 1.87977155063238647870E+01);\ncheck_double (\"cbrt (15239.9025)\", cbrt (15239.9025), 2.47929038511971775449E+01);\ncheck_double (\"cbrt (3)\", cbrt (3), 1.44224957030740830177E+00);\ncheck_double (\"cbrt (9)\", cbrt (9), 2.08008382305190409056E+00);\ncheck_double (\"cbrt (-17.87)\", cbrt (-17.87), -2.61441695192974155049E+00);\ncheck_double (\"cbrt (-8941)\", cbrt (-8941), -2.07552848589356599973E+01);\ncheck_double (\"sin (0.0)\", sin (0.0), 0.00000000000000000000E+00);\ncheck_double (\"sin (-0.0)\", sin (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"sin (1.0)\", sin (1.0), 8.41470984807896504876E-01);\ncheck_double (\"sin (-1.0)\", sin (-1.0), -8.41470984807896504876E-01);\ncheck_double (\"sin (INFINITY)\", sin (INFINITY), -NAN);\ncheck_double (\"sin (-INFINITY)\", sin (-INFINITY), -NAN);\ncheck_double (\"sin (NAN)\", sin (NAN), NAN);\ncheck_double (\"sin (M_PI)\", sin (M_PI), 1.22464679914735320717E-16);\ncheck_double (\"sin (-M_PI)\", sin (-M_PI), -1.22464679914735320717E-16);\ncheck_double (\"sin (2.0 * M_PI)\", sin (2.0 * M_PI), -2.44929359829470641435E-16);\ncheck_double (\"sin (-2.0 * M_PI)\", sin (-2.0 * M_PI), 2.44929359829470641435E-16);\ncheck_double (\"sin (M_PI / 2.0)\", sin (M_PI / 2.0), 1.00000000000000000000E+00);\ncheck_double (\"sin (-M_PI / 2.0)\", sin (-M_PI / 2.0), -1.00000000000000000000E+00);\ncheck_double (\"sin (M_PI / 3.0)\", sin (M_PI / 3.0), 8.66025403784438596588E-01);\ncheck_double (\"sin (-M_PI / 3.0)\", sin (-M_PI / 3.0), -8.66025403784438596588E-01);\ncheck_double (\"sin (M_PI / 4.0)\", sin (M_PI / 4.0), 7.07106781186547461715E-01);\ncheck_double (\"sin (-M_PI / 4.0)\", sin (-M_PI / 4.0), -7.07106781186547461715E-01);\ncheck_double (\"sin (M_PI / 6.0)\", sin (M_PI / 6.0), 4.99999999999999944489E-01);\ncheck_double (\"sin (-M_PI / 6.0)\", sin (-M_PI / 6.0), -4.99999999999999944489E-01);\ncheck_double (\"sin (M_PI * 2.0 / 3.0)\", sin (M_PI * 2.0 / 3.0), 8.66025403784438707611E-01);\ncheck_double (\"sin (-M_PI * 2.0 / 3.0)\", sin (-M_PI * 2.0 / 3.0), -8.66025403784438707611E-01);\ncheck_double (\"sin (M_PI * 5.0 / 6.0)\", sin (M_PI * 5.0 / 6.0), 4.99999999999999944489E-01);\ncheck_double (\"sin (-M_PI * 5.0 / 6.0)\", sin (-M_PI * 5.0 / 6.0), -4.99999999999999944489E-01);\ncheck_double (\"sin (6.9e-18)\", sin (6.9e-18), 6.90000000000000026253E-18);\ncheck_double (\"sin (-6.9e-18)\", sin (-6.9e-18), -6.90000000000000026253E-18);\ncheck_double (\"sin (7.0e-18)\", sin (7.0e-18), 6.99999999999999973042E-18);\ncheck_double (\"sin (-7.0e-18)\", sin (-7.0e-18), -6.99999999999999973042E-18);\ncheck_double (\"sin (7.4e-9)\", sin (7.4e-9), 7.40000000000000008865E-09);\ncheck_double (\"sin (-7.4e-9)\", sin (-7.4e-9), -7.40000000000000008865E-09);\ncheck_double (\"sin (7.5e-9)\", sin (7.5e-9), 7.49999999999999932974E-09);\ncheck_double (\"sin (-7.5e-9)\", sin (-7.5e-9), -7.49999999999999932974E-09);\ncheck_double (\"sin (0.2)\", sin (0.2), 1.98669330795061216399E-01);\ncheck_double (\"sin (-0.2)\", sin (-0.2), -1.98669330795061216399E-01);\ncheck_double (\"sin (0.4)\", sin (0.4), 3.89418342308650522465E-01);\ncheck_double (\"sin (-0.4)\", sin (-0.4), -3.89418342308650522465E-01);\ncheck_double (\"sin (0.7)\", sin (0.7), 6.44217687237691016833E-01);\ncheck_double (\"sin (-0.7)\", sin (-0.7), -6.44217687237691016833E-01);\ncheck_double (\"sin (0.8)\", sin (0.8), 7.17356090899522791382E-01);\ncheck_double (\"sin (-0.8)\", sin (-0.8), -7.17356090899522791382E-01);\ncheck_double (\"sin (3.0)\", sin (3.0), 1.41120008059867213523E-01);\ncheck_double (\"sin (-3.0)\", sin (-3.0), -1.41120008059867213523E-01);\ncheck_double (\"sin (4.0)\", sin (4.0), -7.56802495307928202450E-01);\ncheck_double (\"sin (-4.0)\", sin (-4.0), 7.56802495307928202450E-01);\ncheck_double (\"sin (6.0)\", sin (6.0), -2.79415498198925860152E-01);\ncheck_double (\"sin (-6.0)\", sin (-6.0), 2.79415498198925860152E-01);\ncheck_double (\"sin (7.0)\", sin (7.0), 6.56986598718789061024E-01);\ncheck_double (\"sin (-7.0)\", sin (-7.0), -6.56986598718789061024E-01);\ncheck_double (\"cos (0.0)\", cos (0.0), 1.00000000000000000000E+00);\ncheck_double (\"cos (-0.0)\", cos (-0.0), 1.00000000000000000000E+00);\ncheck_double (\"cos (1.0)\", cos (1.0), 5.40302305868139765010E-01);\ncheck_double (\"cos (-1.0)\", cos (-1.0), 5.40302305868139765010E-01);\ncheck_double (\"cos (INFINITY)\", cos (INFINITY), -NAN);\ncheck_double (\"cos (-INFINITY)\", cos (-INFINITY), -NAN);\ncheck_double (\"cos (NAN)\", cos (NAN), NAN);\ncheck_double (\"cos (M_PI)\", cos (M_PI), -1.00000000000000000000E+00);\ncheck_double (\"cos (-M_PI)\", cos (-M_PI), -1.00000000000000000000E+00);\ncheck_double (\"cos (2.0 * M_PI)\", cos (2.0 * M_PI), 1.00000000000000000000E+00);\ncheck_double (\"cos (-2.0 * M_PI)\", cos (-2.0 * M_PI), 1.00000000000000000000E+00);\ncheck_double (\"cos (M_PI / 2.0)\", cos (M_PI / 2.0), 6.12323399573676603587E-17);\ncheck_double (\"cos (-M_PI / 2.0)\", cos (-M_PI / 2.0), 6.12323399573676603587E-17);\ncheck_double (\"cos (M_PI / 3.0)\", cos (M_PI / 3.0), 5.00000000000000111022E-01);\ncheck_double (\"cos (-M_PI / 3.0)\", cos (-M_PI / 3.0), 5.00000000000000111022E-01);\ncheck_double (\"cos (M_PI / 4.0)\", cos (M_PI / 4.0), 7.07106781186547572737E-01);\ncheck_double (\"cos (-M_PI / 4.0)\", cos (-M_PI / 4.0), 7.07106781186547572737E-01);\ncheck_double (\"cos (M_PI / 6.0)\", cos (M_PI / 6.0), 8.66025403784438707611E-01);\ncheck_double (\"cos (-M_PI / 6.0)\", cos (-M_PI / 6.0), 8.66025403784438707611E-01);\ncheck_double (\"cos (M_PI * 2.0 / 3.0)\", cos (M_PI * 2.0 / 3.0), -4.99999999999999777955E-01);\ncheck_double (\"cos (-M_PI * 2.0 / 3.0)\", cos (-M_PI * 2.0 / 3.0), -4.99999999999999777955E-01);\ncheck_double (\"cos (M_PI * 5.0 / 6.0)\", cos (M_PI * 5.0 / 6.0), -8.66025403784438707611E-01);\ncheck_double (\"cos (-M_PI * 5.0 / 6.0)\", cos (-M_PI * 5.0 / 6.0), -8.66025403784438707611E-01);\ncheck_double (\"cos (6.9e-18)\", cos (6.9e-18), 1.00000000000000000000E+00);\ncheck_double (\"cos (-6.9e-18)\", cos (-6.9e-18), 1.00000000000000000000E+00);\ncheck_double (\"cos (7.0e-18)\", cos (7.0e-18), 1.00000000000000000000E+00);\ncheck_double (\"cos (-7.0e-18)\", cos (-7.0e-18), 1.00000000000000000000E+00);\ncheck_double (\"cos (7.4e-9)\", cos (7.4e-9), 1.00000000000000000000E+00);\ncheck_double (\"cos (-7.4e-9)\", cos (-7.4e-9), 1.00000000000000000000E+00);\ncheck_double (\"cos (7.5e-9)\", cos (7.5e-9), 1.00000000000000000000E+00);\ncheck_double (\"cos (-7.5e-9)\", cos (-7.5e-9), 1.00000000000000000000E+00);\ncheck_double (\"cos (0.2)\", cos (0.2), 9.80066577841241626246E-01);\ncheck_double (\"cos (-0.2)\", cos (-0.2), 9.80066577841241626246E-01);\ncheck_double (\"cos (0.4)\", cos (0.4), 9.21060994002885102816E-01);\ncheck_double (\"cos (-0.4)\", cos (-0.4), 9.21060994002885102816E-01);\ncheck_double (\"cos (0.7)\", cos (0.7), 7.64842187284488495003E-01);\ncheck_double (\"cos (-0.7)\", cos (-0.7), 7.64842187284488495003E-01);\ncheck_double (\"cos (0.8)\", cos (0.8), 6.96706709347165387136E-01);\ncheck_double (\"cos (-0.8)\", cos (-0.8), 6.96706709347165387136E-01);\ncheck_double (\"cos (3.0)\", cos (3.0), -9.89992496600445415211E-01);\ncheck_double (\"cos (-3.0)\", cos (-3.0), -9.89992496600445415211E-01);\ncheck_double (\"cos (4.0)\", cos (4.0), -6.53643620863611940486E-01);\ncheck_double (\"cos (-4.0)\", cos (-4.0), -6.53643620863611940486E-01);\ncheck_double (\"cos (6.0)\", cos (6.0), 9.60170286650365967240E-01);\ncheck_double (\"cos (-6.0)\", cos (-6.0), 9.60170286650365967240E-01);\ncheck_double (\"cos (7.0)\", cos (7.0), 7.53902254343304600859E-01);\ncheck_double (\"cos (-7.0)\", cos (-7.0), 7.53902254343304600859E-01);\ncheck_double (\"tan (0.0)\", tan (0.0), 0.00000000000000000000E+00);\ncheck_double (\"tan (-0.0)\", tan (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"tan (1.0)\", tan (1.0), 1.55740772465490229237E+00);\ncheck_double (\"tan (-1.0)\", tan (-1.0), -1.55740772465490229237E+00);\ncheck_double (\"tan (INFINITY)\", tan (INFINITY), -NAN);\ncheck_double (\"tan (-INFINITY)\", tan (-INFINITY), -NAN);\ncheck_double (\"tan (NAN)\", tan (NAN), NAN);\ncheck_double (\"tan (M_PI)\", tan (M_PI), -1.22464679914735320717E-16);\ncheck_double (\"tan (-M_PI)\", tan (-M_PI), 1.22464679914735320717E-16);\ncheck_double (\"tan (2.0 * M_PI)\", tan (2.0 * M_PI), -2.44929359829470641435E-16);\ncheck_double (\"tan (-2.0 * M_PI)\", tan (-2.0 * M_PI), 2.44929359829470641435E-16);\ncheck_double (\"tan (M_PI / 2.0)\", tan (M_PI / 2.0), 1.63312393531953700000E+16);\ncheck_double (\"tan (-M_PI / 2.0)\", tan (-M_PI / 2.0), -1.63312393531953700000E+16);\ncheck_double (\"tan (M_PI / 3.0)\", tan (M_PI / 3.0), 1.73205080756887674909E+00);\ncheck_double (\"tan (-M_PI / 3.0)\", tan (-M_PI / 3.0), -1.73205080756887674909E+00);\ncheck_double (\"tan (M_PI / 4.0)\", tan (M_PI / 4.0), 9.99999999999999888978E-01);\ncheck_double (\"tan (-M_PI / 4.0)\", tan (-M_PI / 4.0), -9.99999999999999888978E-01);\ncheck_double (\"tan (M_PI / 6.0)\", tan (M_PI / 6.0), 5.77350269189625731059E-01);\ncheck_double (\"tan (-M_PI / 6.0)\", tan (-M_PI / 6.0), -5.77350269189625731059E-01);\ncheck_double (\"tan (M_PI * 2.0 / 3.0)\", tan (M_PI * 2.0 / 3.0), -1.73205080756887830340E+00);\ncheck_double (\"tan (-M_PI * 2.0 / 3.0)\", tan (-M_PI * 2.0 / 3.0), 1.73205080756887830340E+00);\ncheck_double (\"tan (M_PI * 5.0 / 6.0)\", tan (M_PI * 5.0 / 6.0), -5.77350269189625731059E-01);\ncheck_double (\"tan (-M_PI * 5.0 / 6.0)\", tan (-M_PI * 5.0 / 6.0), 5.77350269189625731059E-01);\ncheck_double (\"tan (3.7e-9)\", tan (3.7e-9), 3.70000000000000004433E-09);\ncheck_double (\"tan (-3.7e-9)\", tan (-3.7e-9), -3.70000000000000004433E-09);\ncheck_double (\"tan (3.8e-9)\", tan (3.8e-9), 3.80000000000000011259E-09);\ncheck_double (\"tan (-3.8e-9)\", tan (-3.8e-9), -3.80000000000000011259E-09);\ncheck_double (\"tan (0.6)\", tan (0.6), 6.84136808341692326252E-01);\ncheck_double (\"tan (-0.6)\", tan (-0.6), -6.84136808341692326252E-01);\ncheck_double (\"tan (0.7)\", tan (0.7), 8.42288380463079411342E-01);\ncheck_double (\"tan (-0.7)\", tan (-0.7), -8.42288380463079411342E-01);\ncheck_double (\"tan (3.0)\", tan (3.0), -1.42546543074277803909E-01);\ncheck_double (\"tan (-3.0)\", tan (-3.0), 1.42546543074277803909E-01);\ncheck_double (\"tan (4.0)\", tan (4.0), 1.15782128234957748525E+00);\ncheck_double (\"tan (-4.0)\", tan (-4.0), -1.15782128234957748525E+00);\ncheck_double (\"tan (6.0)\", tan (6.0), -2.91006191384749146600E-01);\ncheck_double (\"tan (-6.0)\", tan (-6.0), 2.91006191384749146600E-01);\ncheck_double (\"tan (7.0)\", tan (7.0), 8.71447982724318781500E-01);\ncheck_double (\"tan (-7.0)\", tan (-7.0), -8.71447982724318781500E-01);\ncheck_double (\"cosh (0.0)\", cosh (0.0), 1.00000000000000000000E+00);\ncheck_double (\"cosh (-0.0)\", cosh (-0.0), 1.00000000000000000000E+00);\ncheck_double (\"cosh (1.0)\", cosh (1.0), 1.54308063481524371241E+00);\ncheck_double (\"cosh (-1.0)\", cosh (-1.0), 1.54308063481524371241E+00);\ncheck_double (\"cosh (INFINITY)\", cosh (INFINITY), INF);\ncheck_double (\"cosh (-INFINITY)\", cosh (-INFINITY), INF);\ncheck_double (\"cosh (NAN)\", cosh (NAN), NAN);\ncheck_double (\"cosh (M_PI)\", cosh (M_PI), 1.15919532755215186626E+01);\ncheck_double (\"cosh (-M_PI)\", cosh (-M_PI), 1.15919532755215186626E+01);\ncheck_double (\"cosh (2.0 * M_PI)\", cosh (2.0 * M_PI), 2.67746761483748173305E+02);\ncheck_double (\"cosh (-2.0 * M_PI)\", cosh (-2.0 * M_PI), 2.67746761483748173305E+02);\ncheck_double (\"cosh (M_PI / 2.0)\", cosh (M_PI / 2.0), 2.50917847865805665464E+00);\ncheck_double (\"cosh (-M_PI / 2.0)\", cosh (-M_PI / 2.0), 2.50917847865805665464E+00);\ncheck_double (\"cosh (M_PI / 3.0)\", cosh (M_PI / 3.0), 1.60028685770238610075E+00);\ncheck_double (\"cosh (-M_PI / 3.0)\", cosh (-M_PI / 3.0), 1.60028685770238610075E+00);\ncheck_double (\"cosh (M_PI / 4.0)\", cosh (M_PI / 4.0), 1.32460908925200571140E+00);\ncheck_double (\"cosh (-M_PI / 4.0)\", cosh (-M_PI / 4.0), 1.32460908925200571140E+00);\ncheck_double (\"cosh (M_PI / 6.0)\", cosh (M_PI / 6.0), 1.14023832107642886236E+00);\ncheck_double (\"cosh (-M_PI / 6.0)\", cosh (-M_PI / 6.0), 1.14023832107642886236E+00);\ncheck_double (\"cosh (M_PI * 2.0 / 3.0)\", cosh (M_PI * 2.0 / 3.0), 4.12183605386995388642E+00);\ncheck_double (\"cosh (-M_PI * 2.0 / 3.0)\", cosh (-M_PI * 2.0 / 3.0), 4.12183605386995388642E+00);\ncheck_double (\"cosh (M_PI * 5.0 / 6.0)\", cosh (M_PI * 5.0 / 6.0), 6.89057236497588299073E+00);\ncheck_double (\"cosh (-M_PI * 5.0 / 6.0)\", cosh (-M_PI * 5.0 / 6.0), 6.89057236497588299073E+00);\ncheck_double (\"cosh (6.9e-18)\", cosh (6.9e-18), 1.00000000000000000000E+00);\ncheck_double (\"cosh (-6.9e-18)\", cosh (-6.9e-18), 1.00000000000000000000E+00);\ncheck_double (\"cosh (7.0e-18)\", cosh (7.0e-18), 1.00000000000000000000E+00);\ncheck_double (\"cosh (-7.0e-18)\", cosh (-7.0e-18), 1.00000000000000000000E+00);\ncheck_double (\"cosh (7.4e-9)\", cosh (7.4e-9), 1.00000000000000000000E+00);\ncheck_double (\"cosh (-7.4e-9)\", cosh (-7.4e-9), 1.00000000000000000000E+00);\ncheck_double (\"cosh (7.5e-9)\", cosh (7.5e-9), 1.00000000000000000000E+00);\ncheck_double (\"cosh (-7.5e-9)\", cosh (-7.5e-9), 1.00000000000000000000E+00);\ncheck_double (\"cosh (0.2)\", cosh (0.2), 1.02006675561907589334E+00);\ncheck_double (\"cosh (-0.2)\", cosh (-0.2), 1.02006675561907589334E+00);\ncheck_double (\"cosh (0.4)\", cosh (0.4), 1.08107237183845472650E+00);\ncheck_double (\"cosh (-0.4)\", cosh (-0.4), 1.08107237183845472650E+00);\ncheck_double (\"cosh (0.7)\", cosh (0.7), 1.25516900563094302434E+00);\ncheck_double (\"cosh (-0.7)\", cosh (-0.7), 1.25516900563094302434E+00);\ncheck_double (\"cosh (0.8)\", cosh (0.8), 1.33743494630484471841E+00);\ncheck_double (\"cosh (-0.8)\", cosh (-0.8), 1.33743494630484471841E+00);\ncheck_double (\"cosh (3.0)\", cosh (3.0), 1.00676619957777653269E+01);\ncheck_double (\"cosh (-3.0)\", cosh (-3.0), 1.00676619957777653269E+01);\ncheck_double (\"cosh (4.0)\", cosh (4.0), 2.73082328360164865444E+01);\ncheck_double (\"cosh (-4.0)\", cosh (-4.0), 2.73082328360164865444E+01);\ncheck_double (\"cosh (6.0)\", cosh (6.0), 2.01715636122455890700E+02);\ncheck_double (\"cosh (-6.0)\", cosh (-6.0), 2.01715636122455890700E+02);\ncheck_double (\"cosh (7.0)\", cosh (7.0), 5.48317035155212124664E+02);\ncheck_double (\"cosh (-7.0)\", cosh (-7.0), 5.48317035155212124664E+02);\ncheck_double (\"sinh (0.0)\", sinh (0.0), 0.00000000000000000000E+00);\ncheck_double (\"sinh (-0.0)\", sinh (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"sinh (1.0)\", sinh (1.0), 1.17520119364380137839E+00);\ncheck_double (\"sinh (-1.0)\", sinh (-1.0), -1.17520119364380137839E+00);\ncheck_double (\"sinh (INFINITY)\", sinh (INFINITY), INF);\ncheck_double (\"sinh (-INFINITY)\", sinh (-INFINITY), -INF);\ncheck_double (\"sinh (NAN)\", sinh (NAN), NAN);\ncheck_double (\"sinh (M_PI)\", sinh (M_PI), 1.15487393572577463630E+01);\ncheck_double (\"sinh (-M_PI)\", sinh (-M_PI), -1.15487393572577463630E+01);\ncheck_double (\"sinh (2.0 * M_PI)\", sinh (2.0 * M_PI), 2.67744894041016436859E+02);\ncheck_double (\"sinh (-2.0 * M_PI)\", sinh (-2.0 * M_PI), -2.67744894041016436859E+02);\ncheck_double (\"sinh (M_PI / 2.0)\", sinh (M_PI / 2.0), 2.30129890230729472478E+00);\ncheck_double (\"sinh (-M_PI / 2.0)\", sinh (-M_PI / 2.0), -2.30129890230729472478E+00);\ncheck_double (\"sinh (M_PI / 3.0)\", sinh (M_PI / 3.0), 1.24936705052397512006E+00);\ncheck_double (\"sinh (-M_PI / 3.0)\", sinh (-M_PI / 3.0), -1.24936705052397512006E+00);\ncheck_double (\"sinh (M_PI / 4.0)\", sinh (M_PI / 4.0), 8.68670961486009529651E-01);\ncheck_double (\"sinh (-M_PI / 4.0)\", sinh (-M_PI / 4.0), -8.68670961486009529651E-01);\ncheck_double (\"sinh (M_PI / 6.0)\", sinh (M_PI / 6.0), 5.47853473888039732564E-01);\ncheck_double (\"sinh (-M_PI / 6.0)\", sinh (-M_PI / 6.0), -5.47853473888039732564E-01);\ncheck_double (\"sinh (M_PI * 2.0 / 3.0)\", sinh (M_PI * 2.0 / 3.0), 3.99869134279982052504E+00);\ncheck_double (\"sinh (-M_PI * 2.0 / 3.0)\", sinh (-M_PI * 2.0 / 3.0), -3.99869134279982052504E+00);\ncheck_double (\"sinh (M_PI * 5.0 / 6.0)\", sinh (M_PI * 5.0 / 6.0), 6.81762330412654371514E+00);\ncheck_double (\"sinh (-M_PI * 5.0 / 6.0)\", sinh (-M_PI * 5.0 / 6.0), -6.81762330412654371514E+00);\ncheck_double (\"sinh (6.9e-18)\", sinh (6.9e-18), 6.90000000000000026253E-18);\ncheck_double (\"sinh (-6.9e-18)\", sinh (-6.9e-18), -6.90000000000000026253E-18);\ncheck_double (\"sinh (7.0e-18)\", sinh (7.0e-18), 6.99999999999999973042E-18);\ncheck_double (\"sinh (-7.0e-18)\", sinh (-7.0e-18), -6.99999999999999973042E-18);\ncheck_double (\"sinh (7.4e-9)\", sinh (7.4e-9), 7.40000000000000008865E-09);\ncheck_double (\"sinh (-7.4e-9)\", sinh (-7.4e-9), -7.40000000000000008865E-09);\ncheck_double (\"sinh (7.5e-9)\", sinh (7.5e-9), 7.49999999999999932974E-09);\ncheck_double (\"sinh (-7.5e-9)\", sinh (-7.5e-9), -7.49999999999999932974E-09);\ncheck_double (\"sinh (0.2)\", sinh (0.2), 2.01336002541093989082E-01);\ncheck_double (\"sinh (-0.2)\", sinh (-0.2), -2.01336002541093989082E-01);\ncheck_double (\"sinh (0.4)\", sinh (0.4), 4.10752325802815509981E-01);\ncheck_double (\"sinh (-0.4)\", sinh (-0.4), -4.10752325802815509981E-01);\ncheck_double (\"sinh (0.7)\", sinh (0.7), 7.58583701839533497413E-01);\ncheck_double (\"sinh (-0.7)\", sinh (-0.7), -7.58583701839533497413E-01);\ncheck_double (\"sinh (0.8)\", sinh (0.8), 8.88105982187623044233E-01);\ncheck_double (\"sinh (-0.8)\", sinh (-0.8), -8.88105982187623044233E-01);\ncheck_double (\"sinh (3.0)\", sinh (3.0), 1.00178749274099025968E+01);\ncheck_double (\"sinh (-3.0)\", sinh (-3.0), -1.00178749274099025968E+01);\ncheck_double (\"sinh (4.0)\", sinh (4.0), 2.72899171971277532123E+01);\ncheck_double (\"sinh (-4.0)\", sinh (-4.0), -2.72899171971277532123E+01);\ncheck_double (\"sinh (6.0)\", sinh (6.0), 2.01713157370279219549E+02);\ncheck_double (\"sinh (-6.0)\", sinh (-6.0), -2.01713157370279219549E+02);\ncheck_double (\"sinh (7.0)\", sinh (7.0), 5.48316123273246489589E+02);\ncheck_double (\"sinh (-7.0)\", sinh (-7.0), -5.48316123273246489589E+02);\ncheck_double (\"tanh (0.0)\", tanh (0.0), 0.00000000000000000000E+00);\ncheck_double (\"tanh (-0.0)\", tanh (-0.0), -0.00000000000000000000E+00);\ncheck_double (\"tanh (1.0)\", tanh (1.0), 7.61594155955764851029E-01);\ncheck_double (\"tanh (-1.0)\", tanh (-1.0), -7.61594155955764851029E-01);\ncheck_double (\"tanh (INFINITY)\", tanh (INFINITY), 1.00000000000000000000E+00);\ncheck_double (\"tanh (-INFINITY)\", tanh (-INFINITY), -1.00000000000000000000E+00);\ncheck_double (\"tanh (NAN)\", tanh (NAN), NAN);\ncheck_double (\"tanh (M_PI)\", tanh (M_PI), 9.96272076220749980280E-01);\ncheck_double (\"tanh (-M_PI)\", tanh (-M_PI), -9.96272076220749980280E-01);\ncheck_double (\"tanh (2.0 * M_PI)\", tanh (2.0 * M_PI), 9.99993025339610652757E-01);\ncheck_double (\"tanh (-2.0 * M_PI)\", tanh (-2.0 * M_PI), -9.99993025339610652757E-01);\ncheck_double (\"tanh (M_PI / 2.0)\", tanh (M_PI / 2.0), 9.17152335667274387632E-01);\ncheck_double (\"tanh (-M_PI / 2.0)\", tanh (-M_PI / 2.0), -9.17152335667274387632E-01);\ncheck_double (\"tanh (M_PI / 3.0)\", tanh (M_PI / 3.0), 7.80714435359267655556E-01);\ncheck_double (\"tanh (-M_PI / 3.0)\", tanh (-M_PI / 3.0), -7.80714435359267655556E-01);\ncheck_double (\"tanh (M_PI / 4.0)\", tanh (M_PI / 4.0), 6.55794202632672407205E-01);\ncheck_double (\"tanh (-M_PI / 4.0)\", tanh (-M_PI / 4.0), -6.55794202632672407205E-01);\ncheck_double (\"tanh (M_PI / 6.0)\", tanh (M_PI / 6.0), 4.80472778156451563181E-01);\ncheck_double (\"tanh (-M_PI / 6.0)\", tanh (-M_PI / 6.0), -4.80472778156451563181E-01);\ncheck_double (\"tanh (M_PI * 2.0 / 3.0)\", tanh (M_PI * 2.0 / 3.0), 9.70123821165930766419E-01);\ncheck_double (\"tanh (-M_PI * 2.0 / 3.0)\", tanh (-M_PI * 2.0 / 3.0), -9.70123821165930766419E-01);\ncheck_double (\"tanh (M_PI * 5.0 / 6.0)\", tanh (M_PI * 5.0 / 6.0), 9.89413207352682011475E-01);\ncheck_double (\"tanh (-M_PI * 5.0 / 6.0)\", tanh (-M_PI * 5.0 / 6.0), -9.89413207352682011475E-01);\ncheck_double (\"tanh (6.9e-18)\", tanh (6.9e-18), 6.90000000000000026253E-18);\ncheck_double (\"tanh (-6.9e-18)\", tanh (-6.9e-18), -6.90000000000000026253E-18);\ncheck_double (\"tanh (7.0e-18)\", tanh (7.0e-18), 6.99999999999999973042E-18);\ncheck_double (\"tanh (-7.0e-18)\", tanh (-7.0e-18), -6.99999999999999973042E-18);\ncheck_double (\"tanh (7.4e-9)\", tanh (7.4e-9), 7.40000000000000008865E-09);\ncheck_double (\"tanh (-7.4e-9)\", tanh (-7.4e-9), -7.40000000000000008865E-09);\ncheck_double (\"tanh (7.5e-9)\", tanh (7.5e-9), 7.49999999999999932974E-09);\ncheck_double (\"tanh (-7.5e-9)\", tanh (-7.5e-9), -7.49999999999999932974E-09);\ncheck_double (\"tanh (0.2)\", tanh (0.2), 1.97375320224904005073E-01);\ncheck_double (\"tanh (-0.2)\", tanh (-0.2), -1.97375320224904005073E-01);\ncheck_double (\"tanh (0.4)\", tanh (0.4), 3.79948962255224897966E-01);\ncheck_double (\"tanh (-0.4)\", tanh (-0.4), -3.79948962255224897966E-01);\ncheck_double (\"tanh (0.7)\", tanh (0.7), 6.04367777117163496037E-01);\ncheck_double (\"tanh (-0.7)\", tanh (-0.7), -6.04367777117163496037E-01);\ncheck_double (\"tanh (0.8)\", tanh (0.8), 6.64036770267849019156E-01);\ncheck_double (\"tanh (-0.8)\", tanh (-0.8), -6.64036770267849019156E-01);\ncheck_double (\"tanh (3.0)\", tanh (3.0), 9.95054753686730464324E-01);\ncheck_double (\"tanh (-3.0)\", tanh (-3.0), -9.95054753686730464324E-01);\ncheck_double (\"tanh (4.0)\", tanh (4.0), 9.99329299739067034025E-01);\ncheck_double (\"tanh (-4.0)\", tanh (-4.0), -9.99329299739067034025E-01);\ncheck_double (\"tanh (6.0)\", tanh (6.0), 9.99987711650795585427E-01);\ncheck_double (\"tanh (-6.0)\", tanh (-6.0), -9.99987711650795585427E-01);\ncheck_double (\"tanh (7.0)\", tanh (7.0), 9.99998336943944687860E-01);\ncheck_double (\"tanh (-7.0)\", tanh (-7.0), -9.99998336943944687860E-01);\n"
  },
  {
    "path": "third-party/valgrind/memcheck.h",
    "content": "\n/*\n   ----------------------------------------------------------------\n\n   Notice that the following BSD-style license applies to this one\n   file (memcheck.h) only.  The rest of Valgrind is licensed under the\n   terms of the GNU General Public License, version 2, unless\n   otherwise indicated.  See the COPYING file in the source\n   distribution for details.\n\n   ----------------------------------------------------------------\n\n   This file is part of MemCheck, a heavyweight Valgrind tool for\n   detecting memory errors.\n\n   Copyright (C) 2000-2011 Julian Seward.  All rights reserved.\n\n   Redistribution and use in source and binary forms, with or without\n   modification, are permitted provided that the following conditions\n   are met:\n\n   1. Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n\n   2. The origin of this software must not be misrepresented; you must \n      not claim that you wrote the original software.  If you use this \n      software in a product, an acknowledgment in the product \n      documentation would be appreciated but is not required.\n\n   3. Altered source versions must be plainly marked as such, and must\n      not be misrepresented as being the original software.\n\n   4. The name of the author may not be used to endorse or promote \n      products derived from this software without specific prior written \n      permission.\n\n   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\n   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\n   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n   ----------------------------------------------------------------\n\n   Notice that the above BSD-style license applies to this one file\n   (memcheck.h) only.  The entire rest of Valgrind is licensed under\n   the terms of the GNU General Public License, version 2.  See the\n   COPYING file in the source distribution for details.\n\n   ---------------------------------------------------------------- \n*/\n\n\n#ifndef __MEMCHECK_H\n#define __MEMCHECK_H\n\n\n/* This file is for inclusion into client (your!) code.\n\n   You can use these macros to manipulate and query memory permissions\n   inside your own programs.\n\n   See comment near the top of valgrind.h on how to use them.\n*/\n\n#include \"valgrind.h\"\n\n/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !! \n   This enum comprises an ABI exported by Valgrind to programs\n   which use client requests.  DO NOT CHANGE THE ORDER OF THESE\n   ENTRIES, NOR DELETE ANY -- add new ones at the end. */\ntypedef\n   enum { \n      VG_USERREQ__MAKE_MEM_NOACCESS = VG_USERREQ_TOOL_BASE('M','C'),\n      VG_USERREQ__MAKE_MEM_UNDEFINED,\n      VG_USERREQ__MAKE_MEM_DEFINED,\n      VG_USERREQ__DISCARD,\n      VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,\n      VG_USERREQ__CHECK_MEM_IS_DEFINED,\n      VG_USERREQ__DO_LEAK_CHECK,\n      VG_USERREQ__COUNT_LEAKS,\n\n      VG_USERREQ__GET_VBITS,\n      VG_USERREQ__SET_VBITS,\n\n      VG_USERREQ__CREATE_BLOCK,\n\n      VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE,\n\n      /* Not next to VG_USERREQ__COUNT_LEAKS because it was added later. */\n      VG_USERREQ__COUNT_LEAK_BLOCKS,\n\n      /* This is just for memcheck's internal use - don't use it */\n      _VG_USERREQ__MEMCHECK_RECORD_OVERLAP_ERROR \n         = VG_USERREQ_TOOL_BASE('M','C') + 256\n   } Vg_MemCheckClientRequest;\n\n\n\n/* Client-code macros to manipulate the state of memory. */\n\n/* Mark memory at _qzz_addr as unaddressable for _qzz_len bytes. */\n#define VALGRIND_MAKE_MEM_NOACCESS(_qzz_addr,_qzz_len)           \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \\\n                            VG_USERREQ__MAKE_MEM_NOACCESS,       \\\n                            (_qzz_addr), (_qzz_len), 0, 0, 0)\n      \n/* Similarly, mark memory at _qzz_addr as addressable but undefined\n   for _qzz_len bytes. */\n#define VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr,_qzz_len)          \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \\\n                            VG_USERREQ__MAKE_MEM_UNDEFINED,      \\\n                            (_qzz_addr), (_qzz_len), 0, 0, 0)\n\n/* Similarly, mark memory at _qzz_addr as addressable and defined\n   for _qzz_len bytes. */\n#define VALGRIND_MAKE_MEM_DEFINED(_qzz_addr,_qzz_len)            \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \\\n                            VG_USERREQ__MAKE_MEM_DEFINED,        \\\n                            (_qzz_addr), (_qzz_len), 0, 0, 0)\n\n/* Similar to VALGRIND_MAKE_MEM_DEFINED except that addressability is\n   not altered: bytes which are addressable are marked as defined,\n   but those which are not addressable are left unchanged. */\n#define VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(_qzz_addr,_qzz_len)     \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,              \\\n                            VG_USERREQ__MAKE_MEM_DEFINED_IF_ADDRESSABLE, \\\n                            (_qzz_addr), (_qzz_len), 0, 0, 0)\n\n/* Create a block-description handle.  The description is an ascii\n   string which is included in any messages pertaining to addresses\n   within the specified memory range.  Has no other effect on the\n   properties of the memory range. */\n#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len, _qzz_desc)\t   \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,        \\\n                            VG_USERREQ__CREATE_BLOCK,              \\\n                            (_qzz_addr), (_qzz_len), (_qzz_desc),  \\\n                            0, 0)\n\n/* Discard a block-description-handle. Returns 1 for an\n   invalid handle, 0 for a valid handle. */\n#define VALGRIND_DISCARD(_qzz_blkindex)                          \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,      \\\n                            VG_USERREQ__DISCARD,                 \\\n                            0, (_qzz_blkindex), 0, 0, 0)\n\n\n/* Client-code macros to check the state of memory. */\n\n/* Check that memory at _qzz_addr is addressable for _qzz_len bytes.\n   If suitable addressibility is not established, Valgrind prints an\n   error message and returns the address of the first offending byte.\n   Otherwise it returns zero. */\n#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len)      \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                             \\\n                            VG_USERREQ__CHECK_MEM_IS_ADDRESSABLE,  \\\n                            (_qzz_addr), (_qzz_len), 0, 0, 0)\n\n/* Check that memory at _qzz_addr is addressable and defined for\n   _qzz_len bytes.  If suitable addressibility and definedness are not\n   established, Valgrind prints an error message and returns the\n   address of the first offending byte.  Otherwise it returns zero. */\n#define VALGRIND_CHECK_MEM_IS_DEFINED(_qzz_addr,_qzz_len)        \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                           \\\n                            VG_USERREQ__CHECK_MEM_IS_DEFINED,    \\\n                            (_qzz_addr), (_qzz_len), 0, 0, 0)\n\n/* Use this macro to force the definedness and addressibility of an\n   lvalue to be checked.  If suitable addressibility and definedness\n   are not established, Valgrind prints an error message and returns\n   the address of the first offending byte.  Otherwise it returns\n   zero. */\n#define VALGRIND_CHECK_VALUE_IS_DEFINED(__lvalue)                \\\n   VALGRIND_CHECK_MEM_IS_DEFINED(                                \\\n      (volatile unsigned char *)&(__lvalue),                     \\\n                      (unsigned long)(sizeof (__lvalue)))\n\n\n/* Do a full memory leak check (like --leak-check=full) mid-execution. */\n#define VALGRIND_DO_LEAK_CHECK                                   \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK,   \\\n                                    0, 0, 0, 0, 0)\n\n/* Same as VALGRIND_DO_LEAK_CHECK but only showing the entries for\n   which there was an increase in leaked bytes or leaked nr of blocks\n   since the previous leak search. */\n#define VALGRIND_DO_ADDED_LEAK_CHECK                            \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK,  \\\n                                    0, 1, 0, 0, 0)\n\n/* Same as VALGRIND_DO_ADDED_LEAK_CHECK but showing entries with\n   increased or decreased leaked bytes/blocks since previous leak\n   search. */\n#define VALGRIND_DO_CHANGED_LEAK_CHECK                          \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK,  \\\n                                    0, 2, 0, 0, 0)\n\n/* Do a summary memory leak check (like --leak-check=summary) mid-execution. */\n#define VALGRIND_DO_QUICK_LEAK_CHECK                             \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DO_LEAK_CHECK,   \\\n                                    1, 0, 0, 0, 0)\n\n/* Return number of leaked, dubious, reachable and suppressed bytes found by\n   all previous leak checks.  They must be lvalues.  */\n#define VALGRIND_COUNT_LEAKS(leaked, dubious, reachable, suppressed)     \\\n   /* For safety on 64-bit platforms we assign the results to private\n      unsigned long variables, then assign these to the lvalues the user\n      specified, which works no matter what type 'leaked', 'dubious', etc\n      are.  We also initialise '_qzz_leaked', etc because\n      VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as\n      defined. */                                                        \\\n   {                                                                     \\\n    unsigned long _qzz_leaked    = 0, _qzz_dubious    = 0;               \\\n    unsigned long _qzz_reachable = 0, _qzz_suppressed = 0;               \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(                                     \\\n                               VG_USERREQ__COUNT_LEAKS,                  \\\n                               &_qzz_leaked, &_qzz_dubious,              \\\n                               &_qzz_reachable, &_qzz_suppressed, 0);    \\\n    leaked     = _qzz_leaked;                                            \\\n    dubious    = _qzz_dubious;                                           \\\n    reachable  = _qzz_reachable;                                         \\\n    suppressed = _qzz_suppressed;                                        \\\n   }\n\n/* Return number of leaked, dubious, reachable and suppressed bytes found by\n   all previous leak checks.  They must be lvalues.  */\n#define VALGRIND_COUNT_LEAK_BLOCKS(leaked, dubious, reachable, suppressed) \\\n   /* For safety on 64-bit platforms we assign the results to private\n      unsigned long variables, then assign these to the lvalues the user\n      specified, which works no matter what type 'leaked', 'dubious', etc\n      are.  We also initialise '_qzz_leaked', etc because\n      VG_USERREQ__COUNT_LEAKS doesn't mark the values returned as\n      defined. */                                                        \\\n   {                                                                     \\\n    unsigned long _qzz_leaked    = 0, _qzz_dubious    = 0;               \\\n    unsigned long _qzz_reachable = 0, _qzz_suppressed = 0;               \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(                                     \\\n                               VG_USERREQ__COUNT_LEAK_BLOCKS,            \\\n                               &_qzz_leaked, &_qzz_dubious,              \\\n                               &_qzz_reachable, &_qzz_suppressed, 0);    \\\n    leaked     = _qzz_leaked;                                            \\\n    dubious    = _qzz_dubious;                                           \\\n    reachable  = _qzz_reachable;                                         \\\n    suppressed = _qzz_suppressed;                                        \\\n   }\n\n\n/* Get the validity data for addresses [zza..zza+zznbytes-1] and copy it\n   into the provided zzvbits array.  Return values:\n      0   if not running on valgrind\n      1   success\n      2   [previously indicated unaligned arrays;  these are now allowed]\n      3   if any parts of zzsrc/zzvbits are not addressable.\n   The metadata is not copied in cases 0, 2 or 3 so it should be\n   impossible to segfault your system by using this call.\n*/\n#define VALGRIND_GET_VBITS(zza,zzvbits,zznbytes)                \\\n    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                \\\n                                    VG_USERREQ__GET_VBITS,      \\\n                                    (const char*)(zza),         \\\n                                    (char*)(zzvbits),           \\\n                                    (zznbytes), 0, 0)\n\n/* Set the validity data for addresses [zza..zza+zznbytes-1], copying it\n   from the provided zzvbits array.  Return values:\n      0   if not running on valgrind\n      1   success\n      2   [previously indicated unaligned arrays;  these are now allowed]\n      3   if any parts of zza/zzvbits are not addressable.\n   The metadata is not copied in cases 0, 2 or 3 so it should be\n   impossible to segfault your system by using this call.\n*/\n#define VALGRIND_SET_VBITS(zza,zzvbits,zznbytes)                \\\n    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                \\\n                                    VG_USERREQ__SET_VBITS,      \\\n                                    (const char*)(zza),         \\\n                                    (const char*)(zzvbits),     \\\n                                    (zznbytes), 0, 0 )\n\n#endif\n\n"
  },
  {
    "path": "third-party/valgrind/valgrind.h",
    "content": "/* -*- c -*-\n   ----------------------------------------------------------------\n\n   Notice that the following BSD-style license applies to this one\n   file (valgrind.h) only.  The rest of Valgrind is licensed under the\n   terms of the GNU General Public License, version 2, unless\n   otherwise indicated.  See the COPYING file in the source\n   distribution for details.\n\n   ----------------------------------------------------------------\n\n   This file is part of Valgrind, a dynamic binary instrumentation\n   framework.\n\n   Copyright (C) 2000-2011 Julian Seward.  All rights reserved.\n\n   Redistribution and use in source and binary forms, with or without\n   modification, are permitted provided that the following conditions\n   are met:\n\n   1. Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n\n   2. The origin of this software must not be misrepresented; you must \n      not claim that you wrote the original software.  If you use this \n      software in a product, an acknowledgment in the product \n      documentation would be appreciated but is not required.\n\n   3. Altered source versions must be plainly marked as such, and must\n      not be misrepresented as being the original software.\n\n   4. The name of the author may not be used to endorse or promote \n      products derived from this software without specific prior written \n      permission.\n\n   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\n   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\n   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n   ----------------------------------------------------------------\n\n   Notice that the above BSD-style license applies to this one file\n   (valgrind.h) only.  The entire rest of Valgrind is licensed under\n   the terms of the GNU General Public License, version 2.  See the\n   COPYING file in the source distribution for details.\n\n   ---------------------------------------------------------------- \n*/\n\n\n/* This file is for inclusion into client (your!) code.\n\n   You can use these macros to manipulate and query Valgrind's \n   execution inside your own programs.\n\n   The resulting executables will still run without Valgrind, just a\n   little bit more slowly than they otherwise would, but otherwise\n   unchanged.  When not running on valgrind, each client request\n   consumes very few (eg. 7) instructions, so the resulting performance\n   loss is negligible unless you plan to execute client requests\n   millions of times per second.  Nevertheless, if that is still a\n   problem, you can compile with the NVALGRIND symbol defined (gcc\n   -DNVALGRIND) so that client requests are not even compiled in.  */\n\n#ifndef __VALGRIND_H\n#define __VALGRIND_H\n\n\n/* ------------------------------------------------------------------ */\n/* VERSION NUMBER OF VALGRIND                                         */\n/* ------------------------------------------------------------------ */\n\n/* Specify Valgrind's version number, so that user code can\n   conditionally compile based on our version number.  Note that these\n   were introduced at version 3.6 and so do not exist in version 3.5\n   or earlier.  The recommended way to use them to check for \"version\n   X.Y or later\" is (eg)\n\n#if defined(__VALGRIND_MAJOR__) && defined(__VALGRIND_MINOR__)   \\\n    && (__VALGRIND_MAJOR__ > 3                                   \\\n        || (__VALGRIND_MAJOR__ == 3 && __VALGRIND_MINOR__ >= 6))\n*/\n#define __VALGRIND_MAJOR__    3\n#define __VALGRIND_MINOR__    6\n\n\n#include <stdarg.h>\n\n/* Nb: this file might be included in a file compiled with -ansi.  So\n   we can't use C++ style \"//\" comments nor the \"asm\" keyword (instead\n   use \"__asm__\"). */\n\n/* Derive some tags indicating what the target platform is.  Note\n   that in this file we're using the compiler's CPP symbols for\n   identifying architectures, which are different to the ones we use\n   within the rest of Valgrind.  Note, __powerpc__ is active for both\n   32 and 64-bit PPC, whereas __powerpc64__ is only active for the\n   latter (on Linux, that is).\n\n   Misc note: how to find out what's predefined in gcc by default:\n   gcc -Wp,-dM somefile.c\n*/\n#undef PLAT_x86_darwin\n#undef PLAT_amd64_darwin\n#undef PLAT_x86_win32\n#undef PLAT_x86_linux\n#undef PLAT_amd64_linux\n#undef PLAT_ppc32_linux\n#undef PLAT_ppc64_linux\n#undef PLAT_arm_linux\n#undef PLAT_s390x_linux\n\n\n#if defined(__APPLE__) && defined(__i386__)\n#  define PLAT_x86_darwin 1\n#elif defined(__APPLE__) && defined(__x86_64__)\n#  define PLAT_amd64_darwin 1\n#elif defined(__MINGW32__) || defined(__CYGWIN32__) \\\n      || (defined(_WIN32) && defined(_M_IX86))\n#  define PLAT_x86_win32 1\n#elif defined(__linux__) && defined(__i386__)\n#  define PLAT_x86_linux 1\n#elif defined(__linux__) && defined(__x86_64__)\n#  define PLAT_amd64_linux 1\n#elif defined(__linux__) && defined(__powerpc__) && !defined(__powerpc64__)\n#  define PLAT_ppc32_linux 1\n#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__)\n#  define PLAT_ppc64_linux 1\n#elif defined(__linux__) && defined(__arm__)\n#  define PLAT_arm_linux 1\n#elif defined(__linux__) && defined(__s390__) && defined(__s390x__)\n#  define PLAT_s390x_linux 1\n#else\n/* If we're not compiling for our target platform, don't generate\n   any inline asms.  */\n#  if !defined(NVALGRIND)\n#    define NVALGRIND 1\n#  endif\n#endif\n\n\n/* ------------------------------------------------------------------ */\n/* ARCHITECTURE SPECIFICS for SPECIAL INSTRUCTIONS.  There is nothing */\n/* in here of use to end-users -- skip to the next section.           */\n/* ------------------------------------------------------------------ */\n\n/*\n * VALGRIND_DO_CLIENT_REQUEST(): a statement that invokes a Valgrind client\n * request. Accepts both pointers and integers as arguments.\n *\n * VALGRIND_DO_CLIENT_REQUEST_STMT(): a statement that invokes a Valgrind\n * client request that does not return a value.\n\n * VALGRIND_DO_CLIENT_REQUEST_EXPR(): a C expression that invokes a Valgrind\n * client request and whose value equals the client request result.  Accepts\n * both pointers and integers as arguments.  Note that such calls are not\n * necessarily pure functions -- they may have side effects.\n */\n\n#define VALGRIND_DO_CLIENT_REQUEST(_zzq_rlval, _zzq_default,            \\\n                                   _zzq_request, _zzq_arg1, _zzq_arg2,  \\\n                                   _zzq_arg3, _zzq_arg4, _zzq_arg5)     \\\n  do { (_zzq_rlval) = VALGRIND_DO_CLIENT_REQUEST_EXPR((_zzq_default),   \\\n                        (_zzq_request), (_zzq_arg1), (_zzq_arg2),       \\\n                        (_zzq_arg3), (_zzq_arg4), (_zzq_arg5)); } while (0)\n\n#define VALGRIND_DO_CLIENT_REQUEST_STMT(_zzq_request, _zzq_arg1,        \\\n                           _zzq_arg2,  _zzq_arg3, _zzq_arg4, _zzq_arg5) \\\n  do { (void) VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                        \\\n                    (_zzq_request), (_zzq_arg1), (_zzq_arg2),           \\\n                    (_zzq_arg3), (_zzq_arg4), (_zzq_arg5)); } while (0)\n\n#if defined(NVALGRIND)\n\n/* Define NVALGRIND to completely remove the Valgrind magic sequence\n   from the compiled code (analogous to NDEBUG's effects on\n   assert()) */\n#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \\\n        _zzq_default, _zzq_request,                               \\\n        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \\\n      (_zzq_default)\n\n#else  /* ! NVALGRIND */\n\n/* The following defines the magic code sequences which the JITter\n   spots and handles magically.  Don't look too closely at them as\n   they will rot your brain.\n\n   The assembly code sequences for all architectures is in this one\n   file.  This is because this file must be stand-alone, and we don't\n   want to have multiple files.\n\n   For VALGRIND_DO_CLIENT_REQUEST, we must ensure that the default\n   value gets put in the return slot, so that everything works when\n   this is executed not under Valgrind.  Args are passed in a memory\n   block, and so there's no intrinsic limit to the number that could\n   be passed, but it's currently five.\n   \n   The macro args are: \n      _zzq_rlval    result lvalue\n      _zzq_default  default value (result returned when running on real CPU)\n      _zzq_request  request code\n      _zzq_arg1..5  request params\n\n   The other two macros are used to support function wrapping, and are\n   a lot simpler.  VALGRIND_GET_NR_CONTEXT returns the value of the\n   guest's NRADDR pseudo-register and whatever other information is\n   needed to safely run the call original from the wrapper: on\n   ppc64-linux, the R2 value at the divert point is also needed.  This\n   information is abstracted into a user-visible type, OrigFn.\n\n   VALGRIND_CALL_NOREDIR_* behaves the same as the following on the\n   guest, but guarantees that the branch instruction will not be\n   redirected: x86: call *%eax, amd64: call *%rax, ppc32/ppc64:\n   branch-and-link-to-r11.  VALGRIND_CALL_NOREDIR is just text, not a\n   complete inline asm, since it needs to be combined with more magic\n   inline asm stuff to be useful.\n*/\n\n/* ------------------------- x86-{linux,darwin} ---------------- */\n\n#if defined(PLAT_x86_linux)  ||  defined(PLAT_x86_darwin)  \\\n    ||  (defined(PLAT_x86_win32) && defined(__GNUC__))\n\ntypedef\n   struct { \n      unsigned int nraddr; /* where's the code? */\n   }\n   OrigFn;\n\n#define __SPECIAL_INSTRUCTION_PREAMBLE                            \\\n                     \"roll $3,  %%edi ; roll $13, %%edi\\n\\t\"      \\\n                     \"roll $29, %%edi ; roll $19, %%edi\\n\\t\"\n\n#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \\\n        _zzq_default, _zzq_request,                               \\\n        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \\\n  __extension__                                                   \\\n  ({volatile unsigned int _zzq_args[6];                           \\\n    volatile unsigned int _zzq_result;                            \\\n    _zzq_args[0] = (unsigned int)(_zzq_request);                  \\\n    _zzq_args[1] = (unsigned int)(_zzq_arg1);                     \\\n    _zzq_args[2] = (unsigned int)(_zzq_arg2);                     \\\n    _zzq_args[3] = (unsigned int)(_zzq_arg3);                     \\\n    _zzq_args[4] = (unsigned int)(_zzq_arg4);                     \\\n    _zzq_args[5] = (unsigned int)(_zzq_arg5);                     \\\n    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* %EDX = client_request ( %EAX ) */         \\\n                     \"xchgl %%ebx,%%ebx\"                          \\\n                     : \"=d\" (_zzq_result)                         \\\n                     : \"a\" (&_zzq_args[0]), \"0\" (_zzq_default)    \\\n                     : \"cc\", \"memory\"                             \\\n                    );                                            \\\n    _zzq_result;                                                  \\\n  })\n\n#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \\\n  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \\\n    volatile unsigned int __addr;                                 \\\n    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* %EAX = guest_NRADDR */                    \\\n                     \"xchgl %%ecx,%%ecx\"                          \\\n                     : \"=a\" (__addr)                              \\\n                     :                                            \\\n                     : \"cc\", \"memory\"                             \\\n                    );                                            \\\n    _zzq_orig->nraddr = __addr;                                   \\\n  }\n\n#define VALGRIND_CALL_NOREDIR_EAX                                 \\\n                     __SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* call-noredir *%EAX */                     \\\n                     \"xchgl %%edx,%%edx\\n\\t\"\n#endif /* PLAT_x86_linux || PLAT_x86_darwin || (PLAT_x86_win32 && __GNUC__) */\n\n/* ------------------------- x86-Win32 ------------------------- */\n\n#if defined(PLAT_x86_win32) && !defined(__GNUC__)\n\ntypedef\n   struct { \n      unsigned int nraddr; /* where's the code? */\n   }\n   OrigFn;\n\n#if defined(_MSC_VER)\n\n#define __SPECIAL_INSTRUCTION_PREAMBLE                            \\\n                     __asm rol edi, 3  __asm rol edi, 13          \\\n                     __asm rol edi, 29 __asm rol edi, 19\n\n#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \\\n        _zzq_default, _zzq_request,                               \\\n        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \\\n    valgrind_do_client_request_expr((uintptr_t)(_zzq_default),    \\\n        (uintptr_t)(_zzq_request), (uintptr_t)(_zzq_arg1),        \\\n        (uintptr_t)(_zzq_arg2), (uintptr_t)(_zzq_arg3),           \\\n        (uintptr_t)(_zzq_arg4), (uintptr_t)(_zzq_arg5))\n\nstatic __inline uintptr_t\nvalgrind_do_client_request_expr(uintptr_t _zzq_default, uintptr_t _zzq_request,\n                                uintptr_t _zzq_arg1, uintptr_t _zzq_arg2,\n                                uintptr_t _zzq_arg3, uintptr_t _zzq_arg4,\n                                uintptr_t _zzq_arg5)\n{\n    volatile uintptr_t _zzq_args[6];\n    volatile unsigned int _zzq_result;\n    _zzq_args[0] = (uintptr_t)(_zzq_request);\n    _zzq_args[1] = (uintptr_t)(_zzq_arg1);\n    _zzq_args[2] = (uintptr_t)(_zzq_arg2);\n    _zzq_args[3] = (uintptr_t)(_zzq_arg3);\n    _zzq_args[4] = (uintptr_t)(_zzq_arg4);\n    _zzq_args[5] = (uintptr_t)(_zzq_arg5);\n    __asm { __asm lea eax, _zzq_args __asm mov edx, _zzq_default\n            __SPECIAL_INSTRUCTION_PREAMBLE\n            /* %EDX = client_request ( %EAX ) */\n            __asm xchg ebx,ebx\n            __asm mov _zzq_result, edx\n    }\n    return _zzq_result;\n}\n\n#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \\\n  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \\\n    volatile unsigned int __addr;                                 \\\n    __asm { __SPECIAL_INSTRUCTION_PREAMBLE                        \\\n            /* %EAX = guest_NRADDR */                             \\\n            __asm xchg ecx,ecx                                    \\\n            __asm mov __addr, eax                                 \\\n    }                                                             \\\n    _zzq_orig->nraddr = __addr;                                   \\\n  }\n\n#define VALGRIND_CALL_NOREDIR_EAX ERROR\n\n#else\n#error Unsupported compiler.\n#endif\n\n#endif /* PLAT_x86_win32 */\n\n/* ------------------------ amd64-{linux,darwin} --------------- */\n\n#if defined(PLAT_amd64_linux)  ||  defined(PLAT_amd64_darwin)\n\ntypedef\n   struct { \n      unsigned long long int nraddr; /* where's the code? */\n   }\n   OrigFn;\n\n#define __SPECIAL_INSTRUCTION_PREAMBLE                            \\\n                     \"rolq $3,  %%rdi ; rolq $13, %%rdi\\n\\t\"      \\\n                     \"rolq $61, %%rdi ; rolq $51, %%rdi\\n\\t\"\n\n#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \\\n        _zzq_default, _zzq_request,                               \\\n        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \\\n    __extension__                                                 \\\n    ({ volatile unsigned long long int _zzq_args[6];              \\\n    volatile unsigned long long int _zzq_result;                  \\\n    _zzq_args[0] = (unsigned long long int)(_zzq_request);        \\\n    _zzq_args[1] = (unsigned long long int)(_zzq_arg1);           \\\n    _zzq_args[2] = (unsigned long long int)(_zzq_arg2);           \\\n    _zzq_args[3] = (unsigned long long int)(_zzq_arg3);           \\\n    _zzq_args[4] = (unsigned long long int)(_zzq_arg4);           \\\n    _zzq_args[5] = (unsigned long long int)(_zzq_arg5);           \\\n    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* %RDX = client_request ( %RAX ) */         \\\n                     \"xchgq %%rbx,%%rbx\"                          \\\n                     : \"=d\" (_zzq_result)                         \\\n                     : \"a\" (&_zzq_args[0]), \"0\" (_zzq_default)    \\\n                     : \"cc\", \"memory\"                             \\\n                    );                                            \\\n    _zzq_result;                                                  \\\n    })\n\n#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \\\n  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \\\n    volatile unsigned long long int __addr;                       \\\n    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* %RAX = guest_NRADDR */                    \\\n                     \"xchgq %%rcx,%%rcx\"                          \\\n                     : \"=a\" (__addr)                              \\\n                     :                                            \\\n                     : \"cc\", \"memory\"                             \\\n                    );                                            \\\n    _zzq_orig->nraddr = __addr;                                   \\\n  }\n\n#define VALGRIND_CALL_NOREDIR_RAX                                 \\\n                     __SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* call-noredir *%RAX */                     \\\n                     \"xchgq %%rdx,%%rdx\\n\\t\"\n#endif /* PLAT_amd64_linux || PLAT_amd64_darwin */\n\n/* ------------------------ ppc32-linux ------------------------ */\n\n#if defined(PLAT_ppc32_linux)\n\ntypedef\n   struct { \n      unsigned int nraddr; /* where's the code? */\n   }\n   OrigFn;\n\n#define __SPECIAL_INSTRUCTION_PREAMBLE                            \\\n                     \"rlwinm 0,0,3,0,0  ; rlwinm 0,0,13,0,0\\n\\t\"  \\\n                     \"rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\\n\\t\"\n\n#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \\\n        _zzq_default, _zzq_request,                               \\\n        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \\\n                                                                  \\\n    __extension__                                                 \\\n  ({         unsigned int  _zzq_args[6];                          \\\n             unsigned int  _zzq_result;                           \\\n             unsigned int* _zzq_ptr;                              \\\n    _zzq_args[0] = (unsigned int)(_zzq_request);                  \\\n    _zzq_args[1] = (unsigned int)(_zzq_arg1);                     \\\n    _zzq_args[2] = (unsigned int)(_zzq_arg2);                     \\\n    _zzq_args[3] = (unsigned int)(_zzq_arg3);                     \\\n    _zzq_args[4] = (unsigned int)(_zzq_arg4);                     \\\n    _zzq_args[5] = (unsigned int)(_zzq_arg5);                     \\\n    _zzq_ptr = _zzq_args;                                         \\\n    __asm__ volatile(\"mr 3,%1\\n\\t\" /*default*/                    \\\n                     \"mr 4,%2\\n\\t\" /*ptr*/                        \\\n                     __SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* %R3 = client_request ( %R4 ) */           \\\n                     \"or 1,1,1\\n\\t\"                               \\\n                     \"mr %0,3\"     /*result*/                     \\\n                     : \"=b\" (_zzq_result)                         \\\n                     : \"b\" (_zzq_default), \"b\" (_zzq_ptr)         \\\n                     : \"cc\", \"memory\", \"r3\", \"r4\");               \\\n    _zzq_result;                                                  \\\n    })\n\n#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \\\n  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \\\n    unsigned int __addr;                                          \\\n    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* %R3 = guest_NRADDR */                     \\\n                     \"or 2,2,2\\n\\t\"                               \\\n                     \"mr %0,3\"                                    \\\n                     : \"=b\" (__addr)                              \\\n                     :                                            \\\n                     : \"cc\", \"memory\", \"r3\"                       \\\n                    );                                            \\\n    _zzq_orig->nraddr = __addr;                                   \\\n  }\n\n#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \\\n                     __SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* branch-and-link-to-noredir *%R11 */       \\\n                     \"or 3,3,3\\n\\t\"\n#endif /* PLAT_ppc32_linux */\n\n/* ------------------------ ppc64-linux ------------------------ */\n\n#if defined(PLAT_ppc64_linux)\n\ntypedef\n   struct { \n      unsigned long long int nraddr; /* where's the code? */\n      unsigned long long int r2;  /* what tocptr do we need? */\n   }\n   OrigFn;\n\n#define __SPECIAL_INSTRUCTION_PREAMBLE                            \\\n                     \"rotldi 0,0,3  ; rotldi 0,0,13\\n\\t\"          \\\n                     \"rotldi 0,0,61 ; rotldi 0,0,51\\n\\t\"\n\n#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \\\n        _zzq_default, _zzq_request,                               \\\n        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \\\n                                                                  \\\n  __extension__                                                   \\\n  ({         unsigned long long int  _zzq_args[6];                \\\n             unsigned long long int  _zzq_result;                 \\\n             unsigned long long int* _zzq_ptr;                    \\\n    _zzq_args[0] = (unsigned long long int)(_zzq_request);        \\\n    _zzq_args[1] = (unsigned long long int)(_zzq_arg1);           \\\n    _zzq_args[2] = (unsigned long long int)(_zzq_arg2);           \\\n    _zzq_args[3] = (unsigned long long int)(_zzq_arg3);           \\\n    _zzq_args[4] = (unsigned long long int)(_zzq_arg4);           \\\n    _zzq_args[5] = (unsigned long long int)(_zzq_arg5);           \\\n    _zzq_ptr = _zzq_args;                                         \\\n    __asm__ volatile(\"mr 3,%1\\n\\t\" /*default*/                    \\\n                     \"mr 4,%2\\n\\t\" /*ptr*/                        \\\n                     __SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* %R3 = client_request ( %R4 ) */           \\\n                     \"or 1,1,1\\n\\t\"                               \\\n                     \"mr %0,3\"     /*result*/                     \\\n                     : \"=b\" (_zzq_result)                         \\\n                     : \"b\" (_zzq_default), \"b\" (_zzq_ptr)         \\\n                     : \"cc\", \"memory\", \"r3\", \"r4\");               \\\n    _zzq_result;                                                  \\\n  })\n\n#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \\\n  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \\\n    unsigned long long int __addr;                                \\\n    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* %R3 = guest_NRADDR */                     \\\n                     \"or 2,2,2\\n\\t\"                               \\\n                     \"mr %0,3\"                                    \\\n                     : \"=b\" (__addr)                              \\\n                     :                                            \\\n                     : \"cc\", \"memory\", \"r3\"                       \\\n                    );                                            \\\n    _zzq_orig->nraddr = __addr;                                   \\\n    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* %R3 = guest_NRADDR_GPR2 */                \\\n                     \"or 4,4,4\\n\\t\"                               \\\n                     \"mr %0,3\"                                    \\\n                     : \"=b\" (__addr)                              \\\n                     :                                            \\\n                     : \"cc\", \"memory\", \"r3\"                       \\\n                    );                                            \\\n    _zzq_orig->r2 = __addr;                                       \\\n  }\n\n#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                   \\\n                     __SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* branch-and-link-to-noredir *%R11 */       \\\n                     \"or 3,3,3\\n\\t\"\n\n#endif /* PLAT_ppc64_linux */\n\n/* ------------------------- arm-linux ------------------------- */\n\n#if defined(PLAT_arm_linux)\n\ntypedef\n   struct { \n      unsigned int nraddr; /* where's the code? */\n   }\n   OrigFn;\n\n#define __SPECIAL_INSTRUCTION_PREAMBLE                            \\\n            \"mov r12, r12, ror #3  ; mov r12, r12, ror #13 \\n\\t\"  \\\n            \"mov r12, r12, ror #29 ; mov r12, r12, ror #19 \\n\\t\"\n\n#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                          \\\n        _zzq_default, _zzq_request,                               \\\n        _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \\\n                                                                  \\\n  __extension__                                                   \\\n  ({volatile unsigned int  _zzq_args[6];                          \\\n    volatile unsigned int  _zzq_result;                           \\\n    _zzq_args[0] = (unsigned int)(_zzq_request);                  \\\n    _zzq_args[1] = (unsigned int)(_zzq_arg1);                     \\\n    _zzq_args[2] = (unsigned int)(_zzq_arg2);                     \\\n    _zzq_args[3] = (unsigned int)(_zzq_arg3);                     \\\n    _zzq_args[4] = (unsigned int)(_zzq_arg4);                     \\\n    _zzq_args[5] = (unsigned int)(_zzq_arg5);                     \\\n    __asm__ volatile(\"mov r3, %1\\n\\t\" /*default*/                 \\\n                     \"mov r4, %2\\n\\t\" /*ptr*/                     \\\n                     __SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* R3 = client_request ( R4 ) */             \\\n                     \"orr r10, r10, r10\\n\\t\"                      \\\n                     \"mov %0, r3\"     /*result*/                  \\\n                     : \"=r\" (_zzq_result)                         \\\n                     : \"r\" (_zzq_default), \"r\" (&_zzq_args[0])    \\\n                     : \"cc\",\"memory\", \"r3\", \"r4\");                \\\n    _zzq_result;                                                  \\\n  })\n\n#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                       \\\n  { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \\\n    unsigned int __addr;                                          \\\n    __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* R3 = guest_NRADDR */                      \\\n                     \"orr r11, r11, r11\\n\\t\"                      \\\n                     \"mov %0, r3\"                                 \\\n                     : \"=r\" (__addr)                              \\\n                     :                                            \\\n                     : \"cc\", \"memory\", \"r3\"                       \\\n                    );                                            \\\n    _zzq_orig->nraddr = __addr;                                   \\\n  }\n\n#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                    \\\n                     __SPECIAL_INSTRUCTION_PREAMBLE               \\\n                     /* branch-and-link-to-noredir *%R4 */        \\\n                     \"orr r12, r12, r12\\n\\t\"\n\n#endif /* PLAT_arm_linux */\n\n/* ------------------------ s390x-linux ------------------------ */\n\n#if defined(PLAT_s390x_linux)\n\ntypedef\n  struct {\n     unsigned long long int nraddr; /* where's the code? */\n  }\n  OrigFn;\n\n/* __SPECIAL_INSTRUCTION_PREAMBLE will be used to identify Valgrind specific\n * code. This detection is implemented in platform specific toIR.c\n * (e.g. VEX/priv/guest_s390_decoder.c).\n */\n#define __SPECIAL_INSTRUCTION_PREAMBLE                           \\\n                     \"lr 15,15\\n\\t\"                              \\\n                     \"lr 1,1\\n\\t\"                                \\\n                     \"lr 2,2\\n\\t\"                                \\\n                     \"lr 3,3\\n\\t\"\n\n#define __CLIENT_REQUEST_CODE \"lr 2,2\\n\\t\"\n#define __GET_NR_CONTEXT_CODE \"lr 3,3\\n\\t\"\n#define __CALL_NO_REDIR_CODE  \"lr 4,4\\n\\t\"\n\n#define VALGRIND_DO_CLIENT_REQUEST_EXPR(                         \\\n       _zzq_default, _zzq_request,                               \\\n       _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)    \\\n  __extension__                                                  \\\n ({volatile unsigned long long int _zzq_args[6];                 \\\n   volatile unsigned long long int _zzq_result;                  \\\n   _zzq_args[0] = (unsigned long long int)(_zzq_request);        \\\n   _zzq_args[1] = (unsigned long long int)(_zzq_arg1);           \\\n   _zzq_args[2] = (unsigned long long int)(_zzq_arg2);           \\\n   _zzq_args[3] = (unsigned long long int)(_zzq_arg3);           \\\n   _zzq_args[4] = (unsigned long long int)(_zzq_arg4);           \\\n   _zzq_args[5] = (unsigned long long int)(_zzq_arg5);           \\\n   __asm__ volatile(/* r2 = args */                              \\\n                    \"lgr 2,%1\\n\\t\"                               \\\n                    /* r3 = default */                           \\\n                    \"lgr 3,%2\\n\\t\"                               \\\n                    __SPECIAL_INSTRUCTION_PREAMBLE               \\\n                    __CLIENT_REQUEST_CODE                        \\\n                    /* results = r3 */                           \\\n                    \"lgr %0, 3\\n\\t\"                              \\\n                    : \"=d\" (_zzq_result)                         \\\n                    : \"a\" (&_zzq_args[0]), \"0\" (_zzq_default)    \\\n                    : \"cc\", \"2\", \"3\", \"memory\"                   \\\n                   );                                            \\\n   _zzq_result;                                                  \\\n })\n\n#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval)                      \\\n { volatile OrigFn* _zzq_orig = &(_zzq_rlval);                   \\\n   volatile unsigned long long int __addr;                       \\\n   __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE               \\\n                    __GET_NR_CONTEXT_CODE                        \\\n                    \"lgr %0, 3\\n\\t\"                              \\\n                    : \"=a\" (__addr)                              \\\n                    :                                            \\\n                    : \"cc\", \"3\", \"memory\"                        \\\n                   );                                            \\\n   _zzq_orig->nraddr = __addr;                                   \\\n }\n\n#define VALGRIND_CALL_NOREDIR_R1                                 \\\n                    __SPECIAL_INSTRUCTION_PREAMBLE               \\\n                    __CALL_NO_REDIR_CODE\n\n#endif /* PLAT_s390x_linux */\n\n/* Insert assembly code for other platforms here... */\n\n#endif /* NVALGRIND */\n\n\n/* ------------------------------------------------------------------ */\n/* PLATFORM SPECIFICS for FUNCTION WRAPPING.  This is all very        */\n/* ugly.  It's the least-worst tradeoff I can think of.               */\n/* ------------------------------------------------------------------ */\n\n/* This section defines magic (a.k.a appalling-hack) macros for doing\n   guaranteed-no-redirection macros, so as to get from function\n   wrappers to the functions they are wrapping.  The whole point is to\n   construct standard call sequences, but to do the call itself with a\n   special no-redirect call pseudo-instruction that the JIT\n   understands and handles specially.  This section is long and\n   repetitious, and I can't see a way to make it shorter.\n\n   The naming scheme is as follows:\n\n      CALL_FN_{W,v}_{v,W,WW,WWW,WWWW,5W,6W,7W,etc}\n\n   'W' stands for \"word\" and 'v' for \"void\".  Hence there are\n   different macros for calling arity 0, 1, 2, 3, 4, etc, functions,\n   and for each, the possibility of returning a word-typed result, or\n   no result.\n*/\n\n/* Use these to write the name of your wrapper.  NOTE: duplicates\n   VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h.  NOTE also: inserts\n   the default behaviour equivalance class tag \"0000\" into the name.\n   See pub_tool_redir.h for details -- normally you don't need to\n   think about this, though. */\n\n/* Use an extra level of macroisation so as to ensure the soname/fnname\n   args are fully macro-expanded before pasting them together. */\n#define VG_CONCAT4(_aa,_bb,_cc,_dd) _aa##_bb##_cc##_dd\n\n#define I_WRAP_SONAME_FNNAME_ZU(soname,fnname)                    \\\n   VG_CONCAT4(_vgw00000ZU_,soname,_,fnname)\n\n#define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname)                    \\\n   VG_CONCAT4(_vgw00000ZZ_,soname,_,fnname)\n\n/* Use this macro from within a wrapper function to collect the\n   context (address and possibly other info) of the original function.\n   Once you have that you can then use it in one of the CALL_FN_\n   macros.  The type of the argument _lval is OrigFn. */\n#define VALGRIND_GET_ORIG_FN(_lval)  VALGRIND_GET_NR_CONTEXT(_lval)\n\n/* Derivatives of the main macros below, for calling functions\n   returning void. */\n\n#define CALL_FN_v_v(fnptr)                                        \\\n   do { volatile unsigned long _junk;                             \\\n        CALL_FN_W_v(_junk,fnptr); } while (0)\n\n#define CALL_FN_v_W(fnptr, arg1)                                  \\\n   do { volatile unsigned long _junk;                             \\\n        CALL_FN_W_W(_junk,fnptr,arg1); } while (0)\n\n#define CALL_FN_v_WW(fnptr, arg1,arg2)                            \\\n   do { volatile unsigned long _junk;                             \\\n        CALL_FN_W_WW(_junk,fnptr,arg1,arg2); } while (0)\n\n#define CALL_FN_v_WWW(fnptr, arg1,arg2,arg3)                      \\\n   do { volatile unsigned long _junk;                             \\\n        CALL_FN_W_WWW(_junk,fnptr,arg1,arg2,arg3); } while (0)\n\n#define CALL_FN_v_WWWW(fnptr, arg1,arg2,arg3,arg4)                \\\n   do { volatile unsigned long _junk;                             \\\n        CALL_FN_W_WWWW(_junk,fnptr,arg1,arg2,arg3,arg4); } while (0)\n\n#define CALL_FN_v_5W(fnptr, arg1,arg2,arg3,arg4,arg5)             \\\n   do { volatile unsigned long _junk;                             \\\n        CALL_FN_W_5W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5); } while (0)\n\n#define CALL_FN_v_6W(fnptr, arg1,arg2,arg3,arg4,arg5,arg6)        \\\n   do { volatile unsigned long _junk;                             \\\n        CALL_FN_W_6W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5,arg6); } while (0)\n\n#define CALL_FN_v_7W(fnptr, arg1,arg2,arg3,arg4,arg5,arg6,arg7)   \\\n   do { volatile unsigned long _junk;                             \\\n        CALL_FN_W_7W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5,arg6,arg7); } while (0)\n\n/* ------------------------- x86-{linux,darwin} ---------------- */\n\n#if defined(PLAT_x86_linux)  ||  defined(PLAT_x86_darwin)\n\n/* These regs are trashed by the hidden call.  No need to mention eax\n   as gcc can already see that, plus causes gcc to bomb. */\n#define __CALLER_SAVED_REGS /*\"eax\"*/ \"ecx\", \"edx\"\n\n/* These CALL_FN_ macros assume that on x86-linux, sizeof(unsigned\n   long) == 4. */\n\n#define CALL_FN_W_v(lval, orig)                                   \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[1];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      __asm__ volatile(                                           \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_W(lval, orig, arg1)                             \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[2];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      __asm__ volatile(                                           \\\n         \"subl $12, %%esp\\n\\t\"                                    \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $16, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      __asm__ volatile(                                           \\\n         \"subl $8, %%esp\\n\\t\"                                     \\\n         \"pushl 8(%%eax)\\n\\t\"                                     \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $16, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[4];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      __asm__ volatile(                                           \\\n         \"subl $4, %%esp\\n\\t\"                                     \\\n         \"pushl 12(%%eax)\\n\\t\"                                    \\\n         \"pushl 8(%%eax)\\n\\t\"                                     \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $16, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[5];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      __asm__ volatile(                                           \\\n         \"pushl 16(%%eax)\\n\\t\"                                    \\\n         \"pushl 12(%%eax)\\n\\t\"                                    \\\n         \"pushl 8(%%eax)\\n\\t\"                                     \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $16, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[6];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      __asm__ volatile(                                           \\\n         \"subl $12, %%esp\\n\\t\"                                    \\\n         \"pushl 20(%%eax)\\n\\t\"                                    \\\n         \"pushl 16(%%eax)\\n\\t\"                                    \\\n         \"pushl 12(%%eax)\\n\\t\"                                    \\\n         \"pushl 8(%%eax)\\n\\t\"                                     \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $32, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[7];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      __asm__ volatile(                                           \\\n         \"subl $8, %%esp\\n\\t\"                                     \\\n         \"pushl 24(%%eax)\\n\\t\"                                    \\\n         \"pushl 20(%%eax)\\n\\t\"                                    \\\n         \"pushl 16(%%eax)\\n\\t\"                                    \\\n         \"pushl 12(%%eax)\\n\\t\"                                    \\\n         \"pushl 8(%%eax)\\n\\t\"                                     \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $32, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7)                            \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[8];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      __asm__ volatile(                                           \\\n         \"subl $4, %%esp\\n\\t\"                                     \\\n         \"pushl 28(%%eax)\\n\\t\"                                    \\\n         \"pushl 24(%%eax)\\n\\t\"                                    \\\n         \"pushl 20(%%eax)\\n\\t\"                                    \\\n         \"pushl 16(%%eax)\\n\\t\"                                    \\\n         \"pushl 12(%%eax)\\n\\t\"                                    \\\n         \"pushl 8(%%eax)\\n\\t\"                                     \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $32, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7,arg8)                       \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[9];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      __asm__ volatile(                                           \\\n         \"pushl 32(%%eax)\\n\\t\"                                    \\\n         \"pushl 28(%%eax)\\n\\t\"                                    \\\n         \"pushl 24(%%eax)\\n\\t\"                                    \\\n         \"pushl 20(%%eax)\\n\\t\"                                    \\\n         \"pushl 16(%%eax)\\n\\t\"                                    \\\n         \"pushl 12(%%eax)\\n\\t\"                                    \\\n         \"pushl 8(%%eax)\\n\\t\"                                     \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $32, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7,arg8,arg9)                  \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[10];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      __asm__ volatile(                                           \\\n         \"subl $12, %%esp\\n\\t\"                                    \\\n         \"pushl 36(%%eax)\\n\\t\"                                    \\\n         \"pushl 32(%%eax)\\n\\t\"                                    \\\n         \"pushl 28(%%eax)\\n\\t\"                                    \\\n         \"pushl 24(%%eax)\\n\\t\"                                    \\\n         \"pushl 20(%%eax)\\n\\t\"                                    \\\n         \"pushl 16(%%eax)\\n\\t\"                                    \\\n         \"pushl 12(%%eax)\\n\\t\"                                    \\\n         \"pushl 8(%%eax)\\n\\t\"                                     \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $48, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \\\n                                  arg7,arg8,arg9,arg10)           \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[11];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      _argvec[10] = (unsigned long)(arg10);                       \\\n      __asm__ volatile(                                           \\\n         \"subl $8, %%esp\\n\\t\"                                     \\\n         \"pushl 40(%%eax)\\n\\t\"                                    \\\n         \"pushl 36(%%eax)\\n\\t\"                                    \\\n         \"pushl 32(%%eax)\\n\\t\"                                    \\\n         \"pushl 28(%%eax)\\n\\t\"                                    \\\n         \"pushl 24(%%eax)\\n\\t\"                                    \\\n         \"pushl 20(%%eax)\\n\\t\"                                    \\\n         \"pushl 16(%%eax)\\n\\t\"                                    \\\n         \"pushl 12(%%eax)\\n\\t\"                                    \\\n         \"pushl 8(%%eax)\\n\\t\"                                     \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $48, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \\\n                                  arg6,arg7,arg8,arg9,arg10,      \\\n                                  arg11)                          \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[12];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      _argvec[10] = (unsigned long)(arg10);                       \\\n      _argvec[11] = (unsigned long)(arg11);                       \\\n      __asm__ volatile(                                           \\\n         \"subl $4, %%esp\\n\\t\"                                     \\\n         \"pushl 44(%%eax)\\n\\t\"                                    \\\n         \"pushl 40(%%eax)\\n\\t\"                                    \\\n         \"pushl 36(%%eax)\\n\\t\"                                    \\\n         \"pushl 32(%%eax)\\n\\t\"                                    \\\n         \"pushl 28(%%eax)\\n\\t\"                                    \\\n         \"pushl 24(%%eax)\\n\\t\"                                    \\\n         \"pushl 20(%%eax)\\n\\t\"                                    \\\n         \"pushl 16(%%eax)\\n\\t\"                                    \\\n         \"pushl 12(%%eax)\\n\\t\"                                    \\\n         \"pushl 8(%%eax)\\n\\t\"                                     \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $48, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \\\n                                  arg6,arg7,arg8,arg9,arg10,      \\\n                                  arg11,arg12)                    \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[13];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      _argvec[10] = (unsigned long)(arg10);                       \\\n      _argvec[11] = (unsigned long)(arg11);                       \\\n      _argvec[12] = (unsigned long)(arg12);                       \\\n      __asm__ volatile(                                           \\\n         \"pushl 48(%%eax)\\n\\t\"                                    \\\n         \"pushl 44(%%eax)\\n\\t\"                                    \\\n         \"pushl 40(%%eax)\\n\\t\"                                    \\\n         \"pushl 36(%%eax)\\n\\t\"                                    \\\n         \"pushl 32(%%eax)\\n\\t\"                                    \\\n         \"pushl 28(%%eax)\\n\\t\"                                    \\\n         \"pushl 24(%%eax)\\n\\t\"                                    \\\n         \"pushl 20(%%eax)\\n\\t\"                                    \\\n         \"pushl 16(%%eax)\\n\\t\"                                    \\\n         \"pushl 12(%%eax)\\n\\t\"                                    \\\n         \"pushl 8(%%eax)\\n\\t\"                                     \\\n         \"pushl 4(%%eax)\\n\\t\"                                     \\\n         \"movl (%%eax), %%eax\\n\\t\"  /* target->%eax */            \\\n         VALGRIND_CALL_NOREDIR_EAX                                \\\n         \"addl $48, %%esp\\n\"                                      \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#endif /* PLAT_x86_linux || PLAT_x86_darwin */\n\n/* ------------------------ amd64-{linux,darwin} --------------- */\n\n#if defined(PLAT_amd64_linux)  ||  defined(PLAT_amd64_darwin)\n\n/* ARGREGS: rdi rsi rdx rcx r8 r9 (the rest on stack in R-to-L order) */\n\n/* These regs are trashed by the hidden call. */\n#define __CALLER_SAVED_REGS /*\"rax\",*/ \"rcx\", \"rdx\", \"rsi\",       \\\n                            \"rdi\", \"r8\", \"r9\", \"r10\", \"r11\"\n\n/* This is all pretty complex.  It's so as to make stack unwinding\n   work reliably.  See bug 243270.  The basic problem is the sub and\n   add of 128 of %rsp in all of the following macros.  If gcc believes\n   the CFA is in %rsp, then unwinding may fail, because what's at the\n   CFA is not what gcc \"expected\" when it constructs the CFIs for the\n   places where the macros are instantiated.\n\n   But we can't just add a CFI annotation to increase the CFA offset\n   by 128, to match the sub of 128 from %rsp, because we don't know\n   whether gcc has chosen %rsp as the CFA at that point, or whether it\n   has chosen some other register (eg, %rbp).  In the latter case,\n   adding a CFI annotation to change the CFA offset is simply wrong.\n\n   So the solution is to get hold of the CFA using\n   __builtin_dwarf_cfa(), put it in a known register, and add a\n   CFI annotation to say what the register is.  We choose %rbp for\n   this (perhaps perversely), because:\n\n   (1) %rbp is already subject to unwinding.  If a new register was\n       chosen then the unwinder would have to unwind it in all stack\n       traces, which is expensive, and\n\n   (2) %rbp is already subject to precise exception updates in the\n       JIT.  If a new register was chosen, we'd have to have precise\n       exceptions for it too, which reduces performance of the\n       generated code.\n\n   However .. one extra complication.  We can't just whack the result\n   of __builtin_dwarf_cfa() into %rbp and then add %rbp to the\n   list of trashed registers at the end of the inline assembly\n   fragments; gcc won't allow %rbp to appear in that list.  Hence\n   instead we need to stash %rbp in %r15 for the duration of the asm,\n   and say that %r15 is trashed instead.  gcc seems happy to go with\n   that.\n\n   Oh .. and this all needs to be conditionalised so that it is\n   unchanged from before this commit, when compiled with older gccs\n   that don't support __builtin_dwarf_cfa.  Furthermore, since\n   this header file is freestanding, it has to be independent of\n   config.h, and so the following conditionalisation cannot depend on\n   configure time checks.\n\n   Although it's not clear from\n   'defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)',\n   this expression excludes Darwin.\n   .cfi directives in Darwin assembly appear to be completely\n   different and I haven't investigated how they work.\n\n   For even more entertainment value, note we have to use the\n   completely undocumented __builtin_dwarf_cfa(), which appears to\n   really compute the CFA, whereas __builtin_frame_address(0) claims\n   to but actually doesn't.  See\n   https://bugs.kde.org/show_bug.cgi?id=243270#c47\n*/\n#if defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)\n#  define __FRAME_POINTER                                         \\\n      ,\"r\"(__builtin_dwarf_cfa())\n#  define VALGRIND_CFI_PROLOGUE                                   \\\n      \"movq %%rbp, %%r15\\n\\t\"                                     \\\n      \"movq %2, %%rbp\\n\\t\"                                        \\\n      \".cfi_remember_state\\n\\t\"                                   \\\n      \".cfi_def_cfa rbp, 0\\n\\t\"\n#  define VALGRIND_CFI_EPILOGUE                                   \\\n      \"movq %%r15, %%rbp\\n\\t\"                                     \\\n      \".cfi_restore_state\\n\\t\"\n#else\n#  define __FRAME_POINTER\n#  define VALGRIND_CFI_PROLOGUE\n#  define VALGRIND_CFI_EPILOGUE\n#endif\n\n\n/* These CALL_FN_ macros assume that on amd64-linux, sizeof(unsigned\n   long) == 8. */\n\n/* NB 9 Sept 07.  There is a nasty kludge here in all these CALL_FN_\n   macros.  In order not to trash the stack redzone, we need to drop\n   %rsp by 128 before the hidden call, and restore afterwards.  The\n   nastyness is that it is only by luck that the stack still appears\n   to be unwindable during the hidden call - since then the behaviour\n   of any routine using this macro does not match what the CFI data\n   says.  Sigh.\n\n   Why is this important?  Imagine that a wrapper has a stack\n   allocated local, and passes to the hidden call, a pointer to it.\n   Because gcc does not know about the hidden call, it may allocate\n   that local in the redzone.  Unfortunately the hidden call may then\n   trash it before it comes to use it.  So we must step clear of the\n   redzone, for the duration of the hidden call, to make it safe.\n\n   Probably the same problem afflicts the other redzone-style ABIs too\n   (ppc64-linux); but for those, the stack is\n   self describing (none of this CFI nonsense) so at least messing\n   with the stack pointer doesn't give a danger of non-unwindable\n   stack. */\n\n#define CALL_FN_W_v(lval, orig)                                   \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[1];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $128,%%rsp\\n\\t\"                                    \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $128,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_W(lval, orig, arg1)                             \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[2];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $128,%%rsp\\n\\t\"                                    \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $128,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $128,%%rsp\\n\\t\"                                    \\\n         \"movq 16(%%rax), %%rsi\\n\\t\"                              \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $128,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[4];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $128,%%rsp\\n\\t\"                                    \\\n         \"movq 24(%%rax), %%rdx\\n\\t\"                              \\\n         \"movq 16(%%rax), %%rsi\\n\\t\"                              \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $128,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[5];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $128,%%rsp\\n\\t\"                                    \\\n         \"movq 32(%%rax), %%rcx\\n\\t\"                              \\\n         \"movq 24(%%rax), %%rdx\\n\\t\"                              \\\n         \"movq 16(%%rax), %%rsi\\n\\t\"                              \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $128,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[6];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $128,%%rsp\\n\\t\"                                    \\\n         \"movq 40(%%rax), %%r8\\n\\t\"                               \\\n         \"movq 32(%%rax), %%rcx\\n\\t\"                              \\\n         \"movq 24(%%rax), %%rdx\\n\\t\"                              \\\n         \"movq 16(%%rax), %%rsi\\n\\t\"                              \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $128,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[7];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $128,%%rsp\\n\\t\"                                    \\\n         \"movq 48(%%rax), %%r9\\n\\t\"                               \\\n         \"movq 40(%%rax), %%r8\\n\\t\"                               \\\n         \"movq 32(%%rax), %%rcx\\n\\t\"                              \\\n         \"movq 24(%%rax), %%rdx\\n\\t\"                              \\\n         \"movq 16(%%rax), %%rsi\\n\\t\"                              \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $128,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7)                            \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[8];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $136,%%rsp\\n\\t\"                                    \\\n         \"pushq 56(%%rax)\\n\\t\"                                    \\\n         \"movq 48(%%rax), %%r9\\n\\t\"                               \\\n         \"movq 40(%%rax), %%r8\\n\\t\"                               \\\n         \"movq 32(%%rax), %%rcx\\n\\t\"                              \\\n         \"movq 24(%%rax), %%rdx\\n\\t\"                              \\\n         \"movq 16(%%rax), %%rsi\\n\\t\"                              \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $8, %%rsp\\n\"                                       \\\n         \"addq $136,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7,arg8)                       \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[9];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $128,%%rsp\\n\\t\"                                    \\\n         \"pushq 64(%%rax)\\n\\t\"                                    \\\n         \"pushq 56(%%rax)\\n\\t\"                                    \\\n         \"movq 48(%%rax), %%r9\\n\\t\"                               \\\n         \"movq 40(%%rax), %%r8\\n\\t\"                               \\\n         \"movq 32(%%rax), %%rcx\\n\\t\"                              \\\n         \"movq 24(%%rax), %%rdx\\n\\t\"                              \\\n         \"movq 16(%%rax), %%rsi\\n\\t\"                              \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $16, %%rsp\\n\"                                      \\\n         \"addq $128,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7,arg8,arg9)                  \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[10];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $136,%%rsp\\n\\t\"                                    \\\n         \"pushq 72(%%rax)\\n\\t\"                                    \\\n         \"pushq 64(%%rax)\\n\\t\"                                    \\\n         \"pushq 56(%%rax)\\n\\t\"                                    \\\n         \"movq 48(%%rax), %%r9\\n\\t\"                               \\\n         \"movq 40(%%rax), %%r8\\n\\t\"                               \\\n         \"movq 32(%%rax), %%rcx\\n\\t\"                              \\\n         \"movq 24(%%rax), %%rdx\\n\\t\"                              \\\n         \"movq 16(%%rax), %%rsi\\n\\t\"                              \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $24, %%rsp\\n\"                                      \\\n         \"addq $136,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \\\n                                  arg7,arg8,arg9,arg10)           \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[11];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      _argvec[10] = (unsigned long)(arg10);                       \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $128,%%rsp\\n\\t\"                                    \\\n         \"pushq 80(%%rax)\\n\\t\"                                    \\\n         \"pushq 72(%%rax)\\n\\t\"                                    \\\n         \"pushq 64(%%rax)\\n\\t\"                                    \\\n         \"pushq 56(%%rax)\\n\\t\"                                    \\\n         \"movq 48(%%rax), %%r9\\n\\t\"                               \\\n         \"movq 40(%%rax), %%r8\\n\\t\"                               \\\n         \"movq 32(%%rax), %%rcx\\n\\t\"                              \\\n         \"movq 24(%%rax), %%rdx\\n\\t\"                              \\\n         \"movq 16(%%rax), %%rsi\\n\\t\"                              \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $32, %%rsp\\n\"                                      \\\n         \"addq $128,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \\\n                                  arg7,arg8,arg9,arg10,arg11)     \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[12];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      _argvec[10] = (unsigned long)(arg10);                       \\\n      _argvec[11] = (unsigned long)(arg11);                       \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $136,%%rsp\\n\\t\"                                    \\\n         \"pushq 88(%%rax)\\n\\t\"                                    \\\n         \"pushq 80(%%rax)\\n\\t\"                                    \\\n         \"pushq 72(%%rax)\\n\\t\"                                    \\\n         \"pushq 64(%%rax)\\n\\t\"                                    \\\n         \"pushq 56(%%rax)\\n\\t\"                                    \\\n         \"movq 48(%%rax), %%r9\\n\\t\"                               \\\n         \"movq 40(%%rax), %%r8\\n\\t\"                               \\\n         \"movq 32(%%rax), %%rcx\\n\\t\"                              \\\n         \"movq 24(%%rax), %%rdx\\n\\t\"                              \\\n         \"movq 16(%%rax), %%rsi\\n\\t\"                              \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $40, %%rsp\\n\"                                      \\\n         \"addq $136,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \\\n                                arg7,arg8,arg9,arg10,arg11,arg12) \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[13];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      _argvec[10] = (unsigned long)(arg10);                       \\\n      _argvec[11] = (unsigned long)(arg11);                       \\\n      _argvec[12] = (unsigned long)(arg12);                       \\\n      __asm__ volatile(                                           \\\n         VALGRIND_CFI_PROLOGUE                                    \\\n         \"subq $128,%%rsp\\n\\t\"                                    \\\n         \"pushq 96(%%rax)\\n\\t\"                                    \\\n         \"pushq 88(%%rax)\\n\\t\"                                    \\\n         \"pushq 80(%%rax)\\n\\t\"                                    \\\n         \"pushq 72(%%rax)\\n\\t\"                                    \\\n         \"pushq 64(%%rax)\\n\\t\"                                    \\\n         \"pushq 56(%%rax)\\n\\t\"                                    \\\n         \"movq 48(%%rax), %%r9\\n\\t\"                               \\\n         \"movq 40(%%rax), %%r8\\n\\t\"                               \\\n         \"movq 32(%%rax), %%rcx\\n\\t\"                              \\\n         \"movq 24(%%rax), %%rdx\\n\\t\"                              \\\n         \"movq 16(%%rax), %%rsi\\n\\t\"                              \\\n         \"movq 8(%%rax), %%rdi\\n\\t\"                               \\\n         \"movq (%%rax), %%rax\\n\\t\"  /* target->%rax */            \\\n         VALGRIND_CALL_NOREDIR_RAX                                \\\n         \"addq $48, %%rsp\\n\"                                      \\\n         \"addq $128,%%rsp\\n\\t\"                                    \\\n         VALGRIND_CFI_EPILOGUE                                    \\\n         : /*out*/   \"=a\" (_res)                                  \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS, \"r15\"   \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#endif /* PLAT_amd64_linux || PLAT_amd64_darwin */\n\n/* ------------------------ ppc32-linux ------------------------ */\n\n#if defined(PLAT_ppc32_linux)\n\n/* This is useful for finding out about the on-stack stuff:\n\n   extern int f9  ( int,int,int,int,int,int,int,int,int );\n   extern int f10 ( int,int,int,int,int,int,int,int,int,int );\n   extern int f11 ( int,int,int,int,int,int,int,int,int,int,int );\n   extern int f12 ( int,int,int,int,int,int,int,int,int,int,int,int );\n\n   int g9 ( void ) {\n      return f9(11,22,33,44,55,66,77,88,99);\n   }\n   int g10 ( void ) {\n      return f10(11,22,33,44,55,66,77,88,99,110);\n   }\n   int g11 ( void ) {\n      return f11(11,22,33,44,55,66,77,88,99,110,121);\n   }\n   int g12 ( void ) {\n      return f12(11,22,33,44,55,66,77,88,99,110,121,132);\n   }\n*/\n\n/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */\n\n/* These regs are trashed by the hidden call. */\n#define __CALLER_SAVED_REGS                                       \\\n   \"lr\", \"ctr\", \"xer\",                                            \\\n   \"cr0\", \"cr1\", \"cr2\", \"cr3\", \"cr4\", \"cr5\", \"cr6\", \"cr7\",        \\\n   \"r0\", \"r2\", \"r3\", \"r4\", \"r5\", \"r6\", \"r7\", \"r8\", \"r9\", \"r10\",   \\\n   \"r11\", \"r12\", \"r13\"\n\n/* These CALL_FN_ macros assume that on ppc32-linux, \n   sizeof(unsigned long) == 4. */\n\n#define CALL_FN_W_v(lval, orig)                                   \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[1];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_W(lval, orig, arg1)                             \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[2];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      _argvec[2] = (unsigned long)arg2;                           \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 4,8(11)\\n\\t\"                                        \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[4];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      _argvec[2] = (unsigned long)arg2;                           \\\n      _argvec[3] = (unsigned long)arg3;                           \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 4,8(11)\\n\\t\"                                        \\\n         \"lwz 5,12(11)\\n\\t\"                                       \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[5];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      _argvec[2] = (unsigned long)arg2;                           \\\n      _argvec[3] = (unsigned long)arg3;                           \\\n      _argvec[4] = (unsigned long)arg4;                           \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 4,8(11)\\n\\t\"                                        \\\n         \"lwz 5,12(11)\\n\\t\"                                       \\\n         \"lwz 6,16(11)\\n\\t\"  /* arg4->r6 */                       \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[6];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      _argvec[2] = (unsigned long)arg2;                           \\\n      _argvec[3] = (unsigned long)arg3;                           \\\n      _argvec[4] = (unsigned long)arg4;                           \\\n      _argvec[5] = (unsigned long)arg5;                           \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 4,8(11)\\n\\t\"                                        \\\n         \"lwz 5,12(11)\\n\\t\"                                       \\\n         \"lwz 6,16(11)\\n\\t\"  /* arg4->r6 */                       \\\n         \"lwz 7,20(11)\\n\\t\"                                       \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[7];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      _argvec[2] = (unsigned long)arg2;                           \\\n      _argvec[3] = (unsigned long)arg3;                           \\\n      _argvec[4] = (unsigned long)arg4;                           \\\n      _argvec[5] = (unsigned long)arg5;                           \\\n      _argvec[6] = (unsigned long)arg6;                           \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 4,8(11)\\n\\t\"                                        \\\n         \"lwz 5,12(11)\\n\\t\"                                       \\\n         \"lwz 6,16(11)\\n\\t\"  /* arg4->r6 */                       \\\n         \"lwz 7,20(11)\\n\\t\"                                       \\\n         \"lwz 8,24(11)\\n\\t\"                                       \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7)                            \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[8];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      _argvec[2] = (unsigned long)arg2;                           \\\n      _argvec[3] = (unsigned long)arg3;                           \\\n      _argvec[4] = (unsigned long)arg4;                           \\\n      _argvec[5] = (unsigned long)arg5;                           \\\n      _argvec[6] = (unsigned long)arg6;                           \\\n      _argvec[7] = (unsigned long)arg7;                           \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 4,8(11)\\n\\t\"                                        \\\n         \"lwz 5,12(11)\\n\\t\"                                       \\\n         \"lwz 6,16(11)\\n\\t\"  /* arg4->r6 */                       \\\n         \"lwz 7,20(11)\\n\\t\"                                       \\\n         \"lwz 8,24(11)\\n\\t\"                                       \\\n         \"lwz 9,28(11)\\n\\t\"                                       \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7,arg8)                       \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[9];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      _argvec[2] = (unsigned long)arg2;                           \\\n      _argvec[3] = (unsigned long)arg3;                           \\\n      _argvec[4] = (unsigned long)arg4;                           \\\n      _argvec[5] = (unsigned long)arg5;                           \\\n      _argvec[6] = (unsigned long)arg6;                           \\\n      _argvec[7] = (unsigned long)arg7;                           \\\n      _argvec[8] = (unsigned long)arg8;                           \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 4,8(11)\\n\\t\"                                        \\\n         \"lwz 5,12(11)\\n\\t\"                                       \\\n         \"lwz 6,16(11)\\n\\t\"  /* arg4->r6 */                       \\\n         \"lwz 7,20(11)\\n\\t\"                                       \\\n         \"lwz 8,24(11)\\n\\t\"                                       \\\n         \"lwz 9,28(11)\\n\\t\"                                       \\\n         \"lwz 10,32(11)\\n\\t\" /* arg8->r10 */                      \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7,arg8,arg9)                  \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[10];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      _argvec[2] = (unsigned long)arg2;                           \\\n      _argvec[3] = (unsigned long)arg3;                           \\\n      _argvec[4] = (unsigned long)arg4;                           \\\n      _argvec[5] = (unsigned long)arg5;                           \\\n      _argvec[6] = (unsigned long)arg6;                           \\\n      _argvec[7] = (unsigned long)arg7;                           \\\n      _argvec[8] = (unsigned long)arg8;                           \\\n      _argvec[9] = (unsigned long)arg9;                           \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"addi 1,1,-16\\n\\t\"                                       \\\n         /* arg9 */                                               \\\n         \"lwz 3,36(11)\\n\\t\"                                       \\\n         \"stw 3,8(1)\\n\\t\"                                         \\\n         /* args1-8 */                                            \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 4,8(11)\\n\\t\"                                        \\\n         \"lwz 5,12(11)\\n\\t\"                                       \\\n         \"lwz 6,16(11)\\n\\t\"  /* arg4->r6 */                       \\\n         \"lwz 7,20(11)\\n\\t\"                                       \\\n         \"lwz 8,24(11)\\n\\t\"                                       \\\n         \"lwz 9,28(11)\\n\\t\"                                       \\\n         \"lwz 10,32(11)\\n\\t\" /* arg8->r10 */                      \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"addi 1,1,16\\n\\t\"                                        \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \\\n                                  arg7,arg8,arg9,arg10)           \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[11];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      _argvec[2] = (unsigned long)arg2;                           \\\n      _argvec[3] = (unsigned long)arg3;                           \\\n      _argvec[4] = (unsigned long)arg4;                           \\\n      _argvec[5] = (unsigned long)arg5;                           \\\n      _argvec[6] = (unsigned long)arg6;                           \\\n      _argvec[7] = (unsigned long)arg7;                           \\\n      _argvec[8] = (unsigned long)arg8;                           \\\n      _argvec[9] = (unsigned long)arg9;                           \\\n      _argvec[10] = (unsigned long)arg10;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"addi 1,1,-16\\n\\t\"                                       \\\n         /* arg10 */                                              \\\n         \"lwz 3,40(11)\\n\\t\"                                       \\\n         \"stw 3,12(1)\\n\\t\"                                        \\\n         /* arg9 */                                               \\\n         \"lwz 3,36(11)\\n\\t\"                                       \\\n         \"stw 3,8(1)\\n\\t\"                                         \\\n         /* args1-8 */                                            \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 4,8(11)\\n\\t\"                                        \\\n         \"lwz 5,12(11)\\n\\t\"                                       \\\n         \"lwz 6,16(11)\\n\\t\"  /* arg4->r6 */                       \\\n         \"lwz 7,20(11)\\n\\t\"                                       \\\n         \"lwz 8,24(11)\\n\\t\"                                       \\\n         \"lwz 9,28(11)\\n\\t\"                                       \\\n         \"lwz 10,32(11)\\n\\t\" /* arg8->r10 */                      \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"addi 1,1,16\\n\\t\"                                        \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \\\n                                  arg7,arg8,arg9,arg10,arg11)     \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[12];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      _argvec[2] = (unsigned long)arg2;                           \\\n      _argvec[3] = (unsigned long)arg3;                           \\\n      _argvec[4] = (unsigned long)arg4;                           \\\n      _argvec[5] = (unsigned long)arg5;                           \\\n      _argvec[6] = (unsigned long)arg6;                           \\\n      _argvec[7] = (unsigned long)arg7;                           \\\n      _argvec[8] = (unsigned long)arg8;                           \\\n      _argvec[9] = (unsigned long)arg9;                           \\\n      _argvec[10] = (unsigned long)arg10;                         \\\n      _argvec[11] = (unsigned long)arg11;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"addi 1,1,-32\\n\\t\"                                       \\\n         /* arg11 */                                              \\\n         \"lwz 3,44(11)\\n\\t\"                                       \\\n         \"stw 3,16(1)\\n\\t\"                                        \\\n         /* arg10 */                                              \\\n         \"lwz 3,40(11)\\n\\t\"                                       \\\n         \"stw 3,12(1)\\n\\t\"                                        \\\n         /* arg9 */                                               \\\n         \"lwz 3,36(11)\\n\\t\"                                       \\\n         \"stw 3,8(1)\\n\\t\"                                         \\\n         /* args1-8 */                                            \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 4,8(11)\\n\\t\"                                        \\\n         \"lwz 5,12(11)\\n\\t\"                                       \\\n         \"lwz 6,16(11)\\n\\t\"  /* arg4->r6 */                       \\\n         \"lwz 7,20(11)\\n\\t\"                                       \\\n         \"lwz 8,24(11)\\n\\t\"                                       \\\n         \"lwz 9,28(11)\\n\\t\"                                       \\\n         \"lwz 10,32(11)\\n\\t\" /* arg8->r10 */                      \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"addi 1,1,32\\n\\t\"                                        \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \\\n                                arg7,arg8,arg9,arg10,arg11,arg12) \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[13];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)arg1;                           \\\n      _argvec[2] = (unsigned long)arg2;                           \\\n      _argvec[3] = (unsigned long)arg3;                           \\\n      _argvec[4] = (unsigned long)arg4;                           \\\n      _argvec[5] = (unsigned long)arg5;                           \\\n      _argvec[6] = (unsigned long)arg6;                           \\\n      _argvec[7] = (unsigned long)arg7;                           \\\n      _argvec[8] = (unsigned long)arg8;                           \\\n      _argvec[9] = (unsigned long)arg9;                           \\\n      _argvec[10] = (unsigned long)arg10;                         \\\n      _argvec[11] = (unsigned long)arg11;                         \\\n      _argvec[12] = (unsigned long)arg12;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"addi 1,1,-32\\n\\t\"                                       \\\n         /* arg12 */                                              \\\n         \"lwz 3,48(11)\\n\\t\"                                       \\\n         \"stw 3,20(1)\\n\\t\"                                        \\\n         /* arg11 */                                              \\\n         \"lwz 3,44(11)\\n\\t\"                                       \\\n         \"stw 3,16(1)\\n\\t\"                                        \\\n         /* arg10 */                                              \\\n         \"lwz 3,40(11)\\n\\t\"                                       \\\n         \"stw 3,12(1)\\n\\t\"                                        \\\n         /* arg9 */                                               \\\n         \"lwz 3,36(11)\\n\\t\"                                       \\\n         \"stw 3,8(1)\\n\\t\"                                         \\\n         /* args1-8 */                                            \\\n         \"lwz 3,4(11)\\n\\t\"   /* arg1->r3 */                       \\\n         \"lwz 4,8(11)\\n\\t\"                                        \\\n         \"lwz 5,12(11)\\n\\t\"                                       \\\n         \"lwz 6,16(11)\\n\\t\"  /* arg4->r6 */                       \\\n         \"lwz 7,20(11)\\n\\t\"                                       \\\n         \"lwz 8,24(11)\\n\\t\"                                       \\\n         \"lwz 9,28(11)\\n\\t\"                                       \\\n         \"lwz 10,32(11)\\n\\t\" /* arg8->r10 */                      \\\n         \"lwz 11,0(11)\\n\\t\"  /* target->r11 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"addi 1,1,32\\n\\t\"                                        \\\n         \"mr %0,3\"                                                \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#endif /* PLAT_ppc32_linux */\n\n/* ------------------------ ppc64-linux ------------------------ */\n\n#if defined(PLAT_ppc64_linux)\n\n/* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */\n\n/* These regs are trashed by the hidden call. */\n#define __CALLER_SAVED_REGS                                       \\\n   \"lr\", \"ctr\", \"xer\",                                            \\\n   \"cr0\", \"cr1\", \"cr2\", \"cr3\", \"cr4\", \"cr5\", \"cr6\", \"cr7\",        \\\n   \"r0\", \"r2\", \"r3\", \"r4\", \"r5\", \"r6\", \"r7\", \"r8\", \"r9\", \"r10\",   \\\n   \"r11\", \"r12\", \"r13\"\n\n/* These CALL_FN_ macros assume that on ppc64-linux, sizeof(unsigned\n   long) == 8. */\n\n#define CALL_FN_W_v(lval, orig)                                   \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+0];                        \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1] = (unsigned long)_orig.r2;                       \\\n      _argvec[2] = (unsigned long)_orig.nraddr;                   \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\" /* restore tocptr */                      \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_W(lval, orig, arg1)                             \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+1];                        \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\" /* restore tocptr */                      \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+2];                        \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      _argvec[2+2] = (unsigned long)arg2;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld   4, 16(11)\\n\\t\" /* arg2->r4 */                      \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\" /* restore tocptr */                      \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+3];                        \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      _argvec[2+2] = (unsigned long)arg2;                         \\\n      _argvec[2+3] = (unsigned long)arg3;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld   4, 16(11)\\n\\t\" /* arg2->r4 */                      \\\n         \"ld   5, 24(11)\\n\\t\" /* arg3->r5 */                      \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\" /* restore tocptr */                      \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+4];                        \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      _argvec[2+2] = (unsigned long)arg2;                         \\\n      _argvec[2+3] = (unsigned long)arg3;                         \\\n      _argvec[2+4] = (unsigned long)arg4;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld   4, 16(11)\\n\\t\" /* arg2->r4 */                      \\\n         \"ld   5, 24(11)\\n\\t\" /* arg3->r5 */                      \\\n         \"ld   6, 32(11)\\n\\t\" /* arg4->r6 */                      \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\" /* restore tocptr */                      \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+5];                        \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      _argvec[2+2] = (unsigned long)arg2;                         \\\n      _argvec[2+3] = (unsigned long)arg3;                         \\\n      _argvec[2+4] = (unsigned long)arg4;                         \\\n      _argvec[2+5] = (unsigned long)arg5;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld   4, 16(11)\\n\\t\" /* arg2->r4 */                      \\\n         \"ld   5, 24(11)\\n\\t\" /* arg3->r5 */                      \\\n         \"ld   6, 32(11)\\n\\t\" /* arg4->r6 */                      \\\n         \"ld   7, 40(11)\\n\\t\" /* arg5->r7 */                      \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\" /* restore tocptr */                      \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+6];                        \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      _argvec[2+2] = (unsigned long)arg2;                         \\\n      _argvec[2+3] = (unsigned long)arg3;                         \\\n      _argvec[2+4] = (unsigned long)arg4;                         \\\n      _argvec[2+5] = (unsigned long)arg5;                         \\\n      _argvec[2+6] = (unsigned long)arg6;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld   4, 16(11)\\n\\t\" /* arg2->r4 */                      \\\n         \"ld   5, 24(11)\\n\\t\" /* arg3->r5 */                      \\\n         \"ld   6, 32(11)\\n\\t\" /* arg4->r6 */                      \\\n         \"ld   7, 40(11)\\n\\t\" /* arg5->r7 */                      \\\n         \"ld   8, 48(11)\\n\\t\" /* arg6->r8 */                      \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\" /* restore tocptr */                      \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7)                            \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+7];                        \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      _argvec[2+2] = (unsigned long)arg2;                         \\\n      _argvec[2+3] = (unsigned long)arg3;                         \\\n      _argvec[2+4] = (unsigned long)arg4;                         \\\n      _argvec[2+5] = (unsigned long)arg5;                         \\\n      _argvec[2+6] = (unsigned long)arg6;                         \\\n      _argvec[2+7] = (unsigned long)arg7;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld   4, 16(11)\\n\\t\" /* arg2->r4 */                      \\\n         \"ld   5, 24(11)\\n\\t\" /* arg3->r5 */                      \\\n         \"ld   6, 32(11)\\n\\t\" /* arg4->r6 */                      \\\n         \"ld   7, 40(11)\\n\\t\" /* arg5->r7 */                      \\\n         \"ld   8, 48(11)\\n\\t\" /* arg6->r8 */                      \\\n         \"ld   9, 56(11)\\n\\t\" /* arg7->r9 */                      \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\" /* restore tocptr */                      \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7,arg8)                       \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+8];                        \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      _argvec[2+2] = (unsigned long)arg2;                         \\\n      _argvec[2+3] = (unsigned long)arg3;                         \\\n      _argvec[2+4] = (unsigned long)arg4;                         \\\n      _argvec[2+5] = (unsigned long)arg5;                         \\\n      _argvec[2+6] = (unsigned long)arg6;                         \\\n      _argvec[2+7] = (unsigned long)arg7;                         \\\n      _argvec[2+8] = (unsigned long)arg8;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld   4, 16(11)\\n\\t\" /* arg2->r4 */                      \\\n         \"ld   5, 24(11)\\n\\t\" /* arg3->r5 */                      \\\n         \"ld   6, 32(11)\\n\\t\" /* arg4->r6 */                      \\\n         \"ld   7, 40(11)\\n\\t\" /* arg5->r7 */                      \\\n         \"ld   8, 48(11)\\n\\t\" /* arg6->r8 */                      \\\n         \"ld   9, 56(11)\\n\\t\" /* arg7->r9 */                      \\\n         \"ld  10, 64(11)\\n\\t\" /* arg8->r10 */                     \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\" /* restore tocptr */                      \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7,arg8,arg9)                  \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+9];                        \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      _argvec[2+2] = (unsigned long)arg2;                         \\\n      _argvec[2+3] = (unsigned long)arg3;                         \\\n      _argvec[2+4] = (unsigned long)arg4;                         \\\n      _argvec[2+5] = (unsigned long)arg5;                         \\\n      _argvec[2+6] = (unsigned long)arg6;                         \\\n      _argvec[2+7] = (unsigned long)arg7;                         \\\n      _argvec[2+8] = (unsigned long)arg8;                         \\\n      _argvec[2+9] = (unsigned long)arg9;                         \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"addi 1,1,-128\\n\\t\"  /* expand stack frame */            \\\n         /* arg9 */                                               \\\n         \"ld  3,72(11)\\n\\t\"                                       \\\n         \"std 3,112(1)\\n\\t\"                                       \\\n         /* args1-8 */                                            \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld   4, 16(11)\\n\\t\" /* arg2->r4 */                      \\\n         \"ld   5, 24(11)\\n\\t\" /* arg3->r5 */                      \\\n         \"ld   6, 32(11)\\n\\t\" /* arg4->r6 */                      \\\n         \"ld   7, 40(11)\\n\\t\" /* arg5->r7 */                      \\\n         \"ld   8, 48(11)\\n\\t\" /* arg6->r8 */                      \\\n         \"ld   9, 56(11)\\n\\t\" /* arg7->r9 */                      \\\n         \"ld  10, 64(11)\\n\\t\" /* arg8->r10 */                     \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\\n\\t\" /* restore tocptr */                  \\\n         \"addi 1,1,128\"     /* restore frame */                   \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \\\n                                  arg7,arg8,arg9,arg10)           \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+10];                       \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      _argvec[2+2] = (unsigned long)arg2;                         \\\n      _argvec[2+3] = (unsigned long)arg3;                         \\\n      _argvec[2+4] = (unsigned long)arg4;                         \\\n      _argvec[2+5] = (unsigned long)arg5;                         \\\n      _argvec[2+6] = (unsigned long)arg6;                         \\\n      _argvec[2+7] = (unsigned long)arg7;                         \\\n      _argvec[2+8] = (unsigned long)arg8;                         \\\n      _argvec[2+9] = (unsigned long)arg9;                         \\\n      _argvec[2+10] = (unsigned long)arg10;                       \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"addi 1,1,-128\\n\\t\"  /* expand stack frame */            \\\n         /* arg10 */                                              \\\n         \"ld  3,80(11)\\n\\t\"                                       \\\n         \"std 3,120(1)\\n\\t\"                                       \\\n         /* arg9 */                                               \\\n         \"ld  3,72(11)\\n\\t\"                                       \\\n         \"std 3,112(1)\\n\\t\"                                       \\\n         /* args1-8 */                                            \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld   4, 16(11)\\n\\t\" /* arg2->r4 */                      \\\n         \"ld   5, 24(11)\\n\\t\" /* arg3->r5 */                      \\\n         \"ld   6, 32(11)\\n\\t\" /* arg4->r6 */                      \\\n         \"ld   7, 40(11)\\n\\t\" /* arg5->r7 */                      \\\n         \"ld   8, 48(11)\\n\\t\" /* arg6->r8 */                      \\\n         \"ld   9, 56(11)\\n\\t\" /* arg7->r9 */                      \\\n         \"ld  10, 64(11)\\n\\t\" /* arg8->r10 */                     \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\\n\\t\" /* restore tocptr */                  \\\n         \"addi 1,1,128\"     /* restore frame */                   \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \\\n                                  arg7,arg8,arg9,arg10,arg11)     \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+11];                       \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      _argvec[2+2] = (unsigned long)arg2;                         \\\n      _argvec[2+3] = (unsigned long)arg3;                         \\\n      _argvec[2+4] = (unsigned long)arg4;                         \\\n      _argvec[2+5] = (unsigned long)arg5;                         \\\n      _argvec[2+6] = (unsigned long)arg6;                         \\\n      _argvec[2+7] = (unsigned long)arg7;                         \\\n      _argvec[2+8] = (unsigned long)arg8;                         \\\n      _argvec[2+9] = (unsigned long)arg9;                         \\\n      _argvec[2+10] = (unsigned long)arg10;                       \\\n      _argvec[2+11] = (unsigned long)arg11;                       \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"addi 1,1,-144\\n\\t\"  /* expand stack frame */            \\\n         /* arg11 */                                              \\\n         \"ld  3,88(11)\\n\\t\"                                       \\\n         \"std 3,128(1)\\n\\t\"                                       \\\n         /* arg10 */                                              \\\n         \"ld  3,80(11)\\n\\t\"                                       \\\n         \"std 3,120(1)\\n\\t\"                                       \\\n         /* arg9 */                                               \\\n         \"ld  3,72(11)\\n\\t\"                                       \\\n         \"std 3,112(1)\\n\\t\"                                       \\\n         /* args1-8 */                                            \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld   4, 16(11)\\n\\t\" /* arg2->r4 */                      \\\n         \"ld   5, 24(11)\\n\\t\" /* arg3->r5 */                      \\\n         \"ld   6, 32(11)\\n\\t\" /* arg4->r6 */                      \\\n         \"ld   7, 40(11)\\n\\t\" /* arg5->r7 */                      \\\n         \"ld   8, 48(11)\\n\\t\" /* arg6->r8 */                      \\\n         \"ld   9, 56(11)\\n\\t\" /* arg7->r9 */                      \\\n         \"ld  10, 64(11)\\n\\t\" /* arg8->r10 */                     \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\\n\\t\" /* restore tocptr */                  \\\n         \"addi 1,1,144\"     /* restore frame */                   \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \\\n                                arg7,arg8,arg9,arg10,arg11,arg12) \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3+12];                       \\\n      volatile unsigned long _res;                                \\\n      /* _argvec[0] holds current r2 across the call */           \\\n      _argvec[1]   = (unsigned long)_orig.r2;                     \\\n      _argvec[2]   = (unsigned long)_orig.nraddr;                 \\\n      _argvec[2+1] = (unsigned long)arg1;                         \\\n      _argvec[2+2] = (unsigned long)arg2;                         \\\n      _argvec[2+3] = (unsigned long)arg3;                         \\\n      _argvec[2+4] = (unsigned long)arg4;                         \\\n      _argvec[2+5] = (unsigned long)arg5;                         \\\n      _argvec[2+6] = (unsigned long)arg6;                         \\\n      _argvec[2+7] = (unsigned long)arg7;                         \\\n      _argvec[2+8] = (unsigned long)arg8;                         \\\n      _argvec[2+9] = (unsigned long)arg9;                         \\\n      _argvec[2+10] = (unsigned long)arg10;                       \\\n      _argvec[2+11] = (unsigned long)arg11;                       \\\n      _argvec[2+12] = (unsigned long)arg12;                       \\\n      __asm__ volatile(                                           \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"std 2,-16(11)\\n\\t\"  /* save tocptr */                   \\\n         \"ld   2,-8(11)\\n\\t\"  /* use nraddr's tocptr */           \\\n         \"addi 1,1,-144\\n\\t\"  /* expand stack frame */            \\\n         /* arg12 */                                              \\\n         \"ld  3,96(11)\\n\\t\"                                       \\\n         \"std 3,136(1)\\n\\t\"                                       \\\n         /* arg11 */                                              \\\n         \"ld  3,88(11)\\n\\t\"                                       \\\n         \"std 3,128(1)\\n\\t\"                                       \\\n         /* arg10 */                                              \\\n         \"ld  3,80(11)\\n\\t\"                                       \\\n         \"std 3,120(1)\\n\\t\"                                       \\\n         /* arg9 */                                               \\\n         \"ld  3,72(11)\\n\\t\"                                       \\\n         \"std 3,112(1)\\n\\t\"                                       \\\n         /* args1-8 */                                            \\\n         \"ld   3, 8(11)\\n\\t\"  /* arg1->r3 */                      \\\n         \"ld   4, 16(11)\\n\\t\" /* arg2->r4 */                      \\\n         \"ld   5, 24(11)\\n\\t\" /* arg3->r5 */                      \\\n         \"ld   6, 32(11)\\n\\t\" /* arg4->r6 */                      \\\n         \"ld   7, 40(11)\\n\\t\" /* arg5->r7 */                      \\\n         \"ld   8, 48(11)\\n\\t\" /* arg6->r8 */                      \\\n         \"ld   9, 56(11)\\n\\t\" /* arg7->r9 */                      \\\n         \"ld  10, 64(11)\\n\\t\" /* arg8->r10 */                     \\\n         \"ld  11, 0(11)\\n\\t\"  /* target->r11 */                   \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11                  \\\n         \"mr 11,%1\\n\\t\"                                           \\\n         \"mr %0,3\\n\\t\"                                            \\\n         \"ld 2,-16(11)\\n\\t\" /* restore tocptr */                  \\\n         \"addi 1,1,144\"     /* restore frame */                   \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"r\" (&_argvec[2])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#endif /* PLAT_ppc64_linux */\n\n/* ------------------------- arm-linux ------------------------- */\n\n#if defined(PLAT_arm_linux)\n\n/* These regs are trashed by the hidden call. */\n#define __CALLER_SAVED_REGS \"r0\", \"r1\", \"r2\", \"r3\",\"r4\",\"r14\"\n\n/* These CALL_FN_ macros assume that on arm-linux, sizeof(unsigned\n   long) == 4. */\n\n#define CALL_FN_W_v(lval, orig)                                   \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[1];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      __asm__ volatile(                                           \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"mov %0, r0\\n\"                                           \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_W(lval, orig, arg1)                             \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[2];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"mov %0, r0\\n\"                                           \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\",  __CALLER_SAVED_REGS         \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WW(lval, orig, arg1,arg2)                       \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[3];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r1, [%1, #8] \\n\\t\"                                  \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"mov %0, r0\\n\"                                           \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3)                 \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[4];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r1, [%1, #8] \\n\\t\"                                  \\\n         \"ldr r2, [%1, #12] \\n\\t\"                                 \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"mov %0, r0\\n\"                                           \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4)           \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[5];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r1, [%1, #8] \\n\\t\"                                  \\\n         \"ldr r2, [%1, #12] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #16] \\n\\t\"                                 \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"mov %0, r0\"                                             \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5)        \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[6];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #20] \\n\\t\"                                 \\\n         \"push {r0} \\n\\t\"                                         \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r1, [%1, #8] \\n\\t\"                                  \\\n         \"ldr r2, [%1, #12] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #16] \\n\\t\"                                 \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"add sp, sp, #4 \\n\\t\"                                    \\\n         \"mov %0, r0\"                                             \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6)   \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[7];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #20] \\n\\t\"                                 \\\n         \"ldr r1, [%1, #24] \\n\\t\"                                 \\\n         \"push {r0, r1} \\n\\t\"                                     \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r1, [%1, #8] \\n\\t\"                                  \\\n         \"ldr r2, [%1, #12] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #16] \\n\\t\"                                 \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"add sp, sp, #8 \\n\\t\"                                    \\\n         \"mov %0, r0\"                                             \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7)                            \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[8];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #20] \\n\\t\"                                 \\\n         \"ldr r1, [%1, #24] \\n\\t\"                                 \\\n         \"ldr r2, [%1, #28] \\n\\t\"                                 \\\n         \"push {r0, r1, r2} \\n\\t\"                                 \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r1, [%1, #8] \\n\\t\"                                  \\\n         \"ldr r2, [%1, #12] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #16] \\n\\t\"                                 \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"add sp, sp, #12 \\n\\t\"                                   \\\n         \"mov %0, r0\"                                             \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7,arg8)                       \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[9];                          \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #20] \\n\\t\"                                 \\\n         \"ldr r1, [%1, #24] \\n\\t\"                                 \\\n         \"ldr r2, [%1, #28] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #32] \\n\\t\"                                 \\\n         \"push {r0, r1, r2, r3} \\n\\t\"                             \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r1, [%1, #8] \\n\\t\"                                  \\\n         \"ldr r2, [%1, #12] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #16] \\n\\t\"                                 \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"add sp, sp, #16 \\n\\t\"                                   \\\n         \"mov %0, r0\"                                             \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,   \\\n                                 arg7,arg8,arg9)                  \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[10];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #20] \\n\\t\"                                 \\\n         \"ldr r1, [%1, #24] \\n\\t\"                                 \\\n         \"ldr r2, [%1, #28] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #32] \\n\\t\"                                 \\\n         \"ldr r4, [%1, #36] \\n\\t\"                                 \\\n         \"push {r0, r1, r2, r3, r4} \\n\\t\"                         \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r1, [%1, #8] \\n\\t\"                                  \\\n         \"ldr r2, [%1, #12] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #16] \\n\\t\"                                 \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"add sp, sp, #20 \\n\\t\"                                   \\\n         \"mov %0, r0\"                                             \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6,  \\\n                                  arg7,arg8,arg9,arg10)           \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[11];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      _argvec[10] = (unsigned long)(arg10);                       \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #40] \\n\\t\"                                 \\\n         \"push {r0} \\n\\t\"                                         \\\n         \"ldr r0, [%1, #20] \\n\\t\"                                 \\\n         \"ldr r1, [%1, #24] \\n\\t\"                                 \\\n         \"ldr r2, [%1, #28] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #32] \\n\\t\"                                 \\\n         \"ldr r4, [%1, #36] \\n\\t\"                                 \\\n         \"push {r0, r1, r2, r3, r4} \\n\\t\"                         \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r1, [%1, #8] \\n\\t\"                                  \\\n         \"ldr r2, [%1, #12] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #16] \\n\\t\"                                 \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"add sp, sp, #24 \\n\\t\"                                   \\\n         \"mov %0, r0\"                                             \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \\\n                                  arg6,arg7,arg8,arg9,arg10,      \\\n                                  arg11)                          \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[12];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      _argvec[10] = (unsigned long)(arg10);                       \\\n      _argvec[11] = (unsigned long)(arg11);                       \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #40] \\n\\t\"                                 \\\n         \"ldr r1, [%1, #44] \\n\\t\"                                 \\\n         \"push {r0, r1} \\n\\t\"                                     \\\n         \"ldr r0, [%1, #20] \\n\\t\"                                 \\\n         \"ldr r1, [%1, #24] \\n\\t\"                                 \\\n         \"ldr r2, [%1, #28] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #32] \\n\\t\"                                 \\\n         \"ldr r4, [%1, #36] \\n\\t\"                                 \\\n         \"push {r0, r1, r2, r3, r4} \\n\\t\"                         \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r1, [%1, #8] \\n\\t\"                                  \\\n         \"ldr r2, [%1, #12] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #16] \\n\\t\"                                 \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"add sp, sp, #28 \\n\\t\"                                   \\\n         \"mov %0, r0\"                                             \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\",__CALLER_SAVED_REGS           \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,       \\\n                                  arg6,arg7,arg8,arg9,arg10,      \\\n                                  arg11,arg12)                    \\\n   do {                                                           \\\n      volatile OrigFn        _orig = (orig);                      \\\n      volatile unsigned long _argvec[13];                         \\\n      volatile unsigned long _res;                                \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                   \\\n      _argvec[1] = (unsigned long)(arg1);                         \\\n      _argvec[2] = (unsigned long)(arg2);                         \\\n      _argvec[3] = (unsigned long)(arg3);                         \\\n      _argvec[4] = (unsigned long)(arg4);                         \\\n      _argvec[5] = (unsigned long)(arg5);                         \\\n      _argvec[6] = (unsigned long)(arg6);                         \\\n      _argvec[7] = (unsigned long)(arg7);                         \\\n      _argvec[8] = (unsigned long)(arg8);                         \\\n      _argvec[9] = (unsigned long)(arg9);                         \\\n      _argvec[10] = (unsigned long)(arg10);                       \\\n      _argvec[11] = (unsigned long)(arg11);                       \\\n      _argvec[12] = (unsigned long)(arg12);                       \\\n      __asm__ volatile(                                           \\\n         \"ldr r0, [%1, #40] \\n\\t\"                                 \\\n         \"ldr r1, [%1, #44] \\n\\t\"                                 \\\n         \"ldr r2, [%1, #48] \\n\\t\"                                 \\\n         \"push {r0, r1, r2} \\n\\t\"                                 \\\n         \"ldr r0, [%1, #20] \\n\\t\"                                 \\\n         \"ldr r1, [%1, #24] \\n\\t\"                                 \\\n         \"ldr r2, [%1, #28] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #32] \\n\\t\"                                 \\\n         \"ldr r4, [%1, #36] \\n\\t\"                                 \\\n         \"push {r0, r1, r2, r3, r4} \\n\\t\"                         \\\n         \"ldr r0, [%1, #4] \\n\\t\"                                  \\\n         \"ldr r1, [%1, #8] \\n\\t\"                                  \\\n         \"ldr r2, [%1, #12] \\n\\t\"                                 \\\n         \"ldr r3, [%1, #16] \\n\\t\"                                 \\\n         \"ldr r4, [%1] \\n\\t\"  /* target->r4 */                    \\\n         VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4                   \\\n         \"add sp, sp, #32 \\n\\t\"                                   \\\n         \"mov %0, r0\"                                             \\\n         : /*out*/   \"=r\" (_res)                                  \\\n         : /*in*/    \"0\" (&_argvec[0])                            \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS          \\\n      );                                                          \\\n      lval = (__typeof__(lval)) _res;                             \\\n   } while (0)\n\n#endif /* PLAT_arm_linux */\n\n/* ------------------------- s390x-linux ------------------------- */\n\n#if defined(PLAT_s390x_linux)\n\n/* Similar workaround as amd64 (see above), but we use r11 as frame\n   pointer and save the old r11 in r7. r11 might be used for\n   argvec, therefore we copy argvec in r1 since r1 is clobbered\n   after the call anyway.  */\n#if defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)\n#  define __FRAME_POINTER                                         \\\n      ,\"d\"(__builtin_dwarf_cfa())\n#  define VALGRIND_CFI_PROLOGUE                                   \\\n      \".cfi_remember_state\\n\\t\"                                   \\\n      \"lgr 1,%1\\n\\t\" /* copy the argvec pointer in r1 */          \\\n      \"lgr 7,11\\n\\t\"                                              \\\n      \"lgr 11,%2\\n\\t\"                                             \\\n      \".cfi_def_cfa r11, 0\\n\\t\"\n#  define VALGRIND_CFI_EPILOGUE                                   \\\n      \"lgr 11, 7\\n\\t\"                                             \\\n      \".cfi_restore_state\\n\\t\"\n#else\n#  define __FRAME_POINTER\n#  define VALGRIND_CFI_PROLOGUE                                   \\\n      \"lgr 1,%1\\n\\t\"\n#  define VALGRIND_CFI_EPILOGUE\n#endif\n\n\n\n\n/* These regs are trashed by the hidden call. Note that we overwrite\n   r14 in s390_irgen_noredir (VEX/priv/guest_s390_irgen.c) to give the\n   function a proper return address. All others are ABI defined call\n   clobbers. */\n#define __CALLER_SAVED_REGS \"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"14\", \\\n                           \"f0\",\"f1\",\"f2\",\"f3\",\"f4\",\"f5\",\"f6\",\"f7\"\n\n\n#define CALL_FN_W_v(lval, orig)                                  \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long  _argvec[1];                        \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-160\\n\\t\"                                      \\\n         \"lg 1, 0(1)\\n\\t\"  /* target->r1 */                      \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,160\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"d\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"7\"     \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n/* The call abi has the arguments in r2-r6 and stack */\n#define CALL_FN_W_W(lval, orig, arg1)                            \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[2];                         \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-160\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,160\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"7\"     \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n#define CALL_FN_W_WW(lval, orig, arg1, arg2)                     \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[3];                         \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      _argvec[2] = (unsigned long)arg2;                          \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-160\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 3,16(1)\\n\\t\"                                        \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,160\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"7\"     \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n#define CALL_FN_W_WWW(lval, orig, arg1, arg2, arg3)              \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[4];                         \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      _argvec[2] = (unsigned long)arg2;                          \\\n      _argvec[3] = (unsigned long)arg3;                          \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-160\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 3,16(1)\\n\\t\"                                        \\\n         \"lg 4,24(1)\\n\\t\"                                        \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,160\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"7\"     \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n#define CALL_FN_W_WWWW(lval, orig, arg1, arg2, arg3, arg4)       \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[5];                         \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      _argvec[2] = (unsigned long)arg2;                          \\\n      _argvec[3] = (unsigned long)arg3;                          \\\n      _argvec[4] = (unsigned long)arg4;                          \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-160\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 3,16(1)\\n\\t\"                                        \\\n         \"lg 4,24(1)\\n\\t\"                                        \\\n         \"lg 5,32(1)\\n\\t\"                                        \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,160\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"7\"     \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n#define CALL_FN_W_5W(lval, orig, arg1, arg2, arg3, arg4, arg5)   \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[6];                         \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      _argvec[2] = (unsigned long)arg2;                          \\\n      _argvec[3] = (unsigned long)arg3;                          \\\n      _argvec[4] = (unsigned long)arg4;                          \\\n      _argvec[5] = (unsigned long)arg5;                          \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-160\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 3,16(1)\\n\\t\"                                        \\\n         \"lg 4,24(1)\\n\\t\"                                        \\\n         \"lg 5,32(1)\\n\\t\"                                        \\\n         \"lg 6,40(1)\\n\\t\"                                        \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,160\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"6\",\"7\" \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n#define CALL_FN_W_6W(lval, orig, arg1, arg2, arg3, arg4, arg5,   \\\n                     arg6)                                       \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[7];                         \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      _argvec[2] = (unsigned long)arg2;                          \\\n      _argvec[3] = (unsigned long)arg3;                          \\\n      _argvec[4] = (unsigned long)arg4;                          \\\n      _argvec[5] = (unsigned long)arg5;                          \\\n      _argvec[6] = (unsigned long)arg6;                          \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-168\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 3,16(1)\\n\\t\"                                        \\\n         \"lg 4,24(1)\\n\\t\"                                        \\\n         \"lg 5,32(1)\\n\\t\"                                        \\\n         \"lg 6,40(1)\\n\\t\"                                        \\\n         \"mvc 160(8,15), 48(1)\\n\\t\"                              \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,168\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"6\",\"7\" \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n#define CALL_FN_W_7W(lval, orig, arg1, arg2, arg3, arg4, arg5,   \\\n                     arg6, arg7)                                 \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[8];                         \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      _argvec[2] = (unsigned long)arg2;                          \\\n      _argvec[3] = (unsigned long)arg3;                          \\\n      _argvec[4] = (unsigned long)arg4;                          \\\n      _argvec[5] = (unsigned long)arg5;                          \\\n      _argvec[6] = (unsigned long)arg6;                          \\\n      _argvec[7] = (unsigned long)arg7;                          \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-176\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 3,16(1)\\n\\t\"                                        \\\n         \"lg 4,24(1)\\n\\t\"                                        \\\n         \"lg 5,32(1)\\n\\t\"                                        \\\n         \"lg 6,40(1)\\n\\t\"                                        \\\n         \"mvc 160(8,15), 48(1)\\n\\t\"                              \\\n         \"mvc 168(8,15), 56(1)\\n\\t\"                              \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,176\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"6\",\"7\" \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n#define CALL_FN_W_8W(lval, orig, arg1, arg2, arg3, arg4, arg5,   \\\n                     arg6, arg7 ,arg8)                           \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[9];                         \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      _argvec[2] = (unsigned long)arg2;                          \\\n      _argvec[3] = (unsigned long)arg3;                          \\\n      _argvec[4] = (unsigned long)arg4;                          \\\n      _argvec[5] = (unsigned long)arg5;                          \\\n      _argvec[6] = (unsigned long)arg6;                          \\\n      _argvec[7] = (unsigned long)arg7;                          \\\n      _argvec[8] = (unsigned long)arg8;                          \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-184\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 3,16(1)\\n\\t\"                                        \\\n         \"lg 4,24(1)\\n\\t\"                                        \\\n         \"lg 5,32(1)\\n\\t\"                                        \\\n         \"lg 6,40(1)\\n\\t\"                                        \\\n         \"mvc 160(8,15), 48(1)\\n\\t\"                              \\\n         \"mvc 168(8,15), 56(1)\\n\\t\"                              \\\n         \"mvc 176(8,15), 64(1)\\n\\t\"                              \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,184\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"6\",\"7\" \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n#define CALL_FN_W_9W(lval, orig, arg1, arg2, arg3, arg4, arg5,   \\\n                     arg6, arg7 ,arg8, arg9)                     \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[10];                        \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      _argvec[2] = (unsigned long)arg2;                          \\\n      _argvec[3] = (unsigned long)arg3;                          \\\n      _argvec[4] = (unsigned long)arg4;                          \\\n      _argvec[5] = (unsigned long)arg5;                          \\\n      _argvec[6] = (unsigned long)arg6;                          \\\n      _argvec[7] = (unsigned long)arg7;                          \\\n      _argvec[8] = (unsigned long)arg8;                          \\\n      _argvec[9] = (unsigned long)arg9;                          \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-192\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 3,16(1)\\n\\t\"                                        \\\n         \"lg 4,24(1)\\n\\t\"                                        \\\n         \"lg 5,32(1)\\n\\t\"                                        \\\n         \"lg 6,40(1)\\n\\t\"                                        \\\n         \"mvc 160(8,15), 48(1)\\n\\t\"                              \\\n         \"mvc 168(8,15), 56(1)\\n\\t\"                              \\\n         \"mvc 176(8,15), 64(1)\\n\\t\"                              \\\n         \"mvc 184(8,15), 72(1)\\n\\t\"                              \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,192\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"6\",\"7\" \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n#define CALL_FN_W_10W(lval, orig, arg1, arg2, arg3, arg4, arg5,  \\\n                     arg6, arg7 ,arg8, arg9, arg10)              \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[11];                        \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      _argvec[2] = (unsigned long)arg2;                          \\\n      _argvec[3] = (unsigned long)arg3;                          \\\n      _argvec[4] = (unsigned long)arg4;                          \\\n      _argvec[5] = (unsigned long)arg5;                          \\\n      _argvec[6] = (unsigned long)arg6;                          \\\n      _argvec[7] = (unsigned long)arg7;                          \\\n      _argvec[8] = (unsigned long)arg8;                          \\\n      _argvec[9] = (unsigned long)arg9;                          \\\n      _argvec[10] = (unsigned long)arg10;                        \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-200\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 3,16(1)\\n\\t\"                                        \\\n         \"lg 4,24(1)\\n\\t\"                                        \\\n         \"lg 5,32(1)\\n\\t\"                                        \\\n         \"lg 6,40(1)\\n\\t\"                                        \\\n         \"mvc 160(8,15), 48(1)\\n\\t\"                              \\\n         \"mvc 168(8,15), 56(1)\\n\\t\"                              \\\n         \"mvc 176(8,15), 64(1)\\n\\t\"                              \\\n         \"mvc 184(8,15), 72(1)\\n\\t\"                              \\\n         \"mvc 192(8,15), 80(1)\\n\\t\"                              \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,200\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"6\",\"7\" \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n#define CALL_FN_W_11W(lval, orig, arg1, arg2, arg3, arg4, arg5,  \\\n                     arg6, arg7 ,arg8, arg9, arg10, arg11)       \\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[12];                        \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      _argvec[2] = (unsigned long)arg2;                          \\\n      _argvec[3] = (unsigned long)arg3;                          \\\n      _argvec[4] = (unsigned long)arg4;                          \\\n      _argvec[5] = (unsigned long)arg5;                          \\\n      _argvec[6] = (unsigned long)arg6;                          \\\n      _argvec[7] = (unsigned long)arg7;                          \\\n      _argvec[8] = (unsigned long)arg8;                          \\\n      _argvec[9] = (unsigned long)arg9;                          \\\n      _argvec[10] = (unsigned long)arg10;                        \\\n      _argvec[11] = (unsigned long)arg11;                        \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-208\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 3,16(1)\\n\\t\"                                        \\\n         \"lg 4,24(1)\\n\\t\"                                        \\\n         \"lg 5,32(1)\\n\\t\"                                        \\\n         \"lg 6,40(1)\\n\\t\"                                        \\\n         \"mvc 160(8,15), 48(1)\\n\\t\"                              \\\n         \"mvc 168(8,15), 56(1)\\n\\t\"                              \\\n         \"mvc 176(8,15), 64(1)\\n\\t\"                              \\\n         \"mvc 184(8,15), 72(1)\\n\\t\"                              \\\n         \"mvc 192(8,15), 80(1)\\n\\t\"                              \\\n         \"mvc 200(8,15), 88(1)\\n\\t\"                              \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,208\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"6\",\"7\" \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n#define CALL_FN_W_12W(lval, orig, arg1, arg2, arg3, arg4, arg5,  \\\n                     arg6, arg7 ,arg8, arg9, arg10, arg11, arg12)\\\n   do {                                                          \\\n      volatile OrigFn        _orig = (orig);                     \\\n      volatile unsigned long _argvec[13];                        \\\n      volatile unsigned long _res;                               \\\n      _argvec[0] = (unsigned long)_orig.nraddr;                  \\\n      _argvec[1] = (unsigned long)arg1;                          \\\n      _argvec[2] = (unsigned long)arg2;                          \\\n      _argvec[3] = (unsigned long)arg3;                          \\\n      _argvec[4] = (unsigned long)arg4;                          \\\n      _argvec[5] = (unsigned long)arg5;                          \\\n      _argvec[6] = (unsigned long)arg6;                          \\\n      _argvec[7] = (unsigned long)arg7;                          \\\n      _argvec[8] = (unsigned long)arg8;                          \\\n      _argvec[9] = (unsigned long)arg9;                          \\\n      _argvec[10] = (unsigned long)arg10;                        \\\n      _argvec[11] = (unsigned long)arg11;                        \\\n      _argvec[12] = (unsigned long)arg12;                        \\\n      __asm__ volatile(                                          \\\n         VALGRIND_CFI_PROLOGUE                                   \\\n         \"aghi 15,-216\\n\\t\"                                      \\\n         \"lg 2, 8(1)\\n\\t\"                                        \\\n         \"lg 3,16(1)\\n\\t\"                                        \\\n         \"lg 4,24(1)\\n\\t\"                                        \\\n         \"lg 5,32(1)\\n\\t\"                                        \\\n         \"lg 6,40(1)\\n\\t\"                                        \\\n         \"mvc 160(8,15), 48(1)\\n\\t\"                              \\\n         \"mvc 168(8,15), 56(1)\\n\\t\"                              \\\n         \"mvc 176(8,15), 64(1)\\n\\t\"                              \\\n         \"mvc 184(8,15), 72(1)\\n\\t\"                              \\\n         \"mvc 192(8,15), 80(1)\\n\\t\"                              \\\n         \"mvc 200(8,15), 88(1)\\n\\t\"                              \\\n         \"mvc 208(8,15), 96(1)\\n\\t\"                              \\\n         \"lg 1, 0(1)\\n\\t\"                                        \\\n         VALGRIND_CALL_NOREDIR_R1                                \\\n         \"lgr %0, 2\\n\\t\"                                         \\\n         \"aghi 15,216\\n\\t\"                                       \\\n         VALGRIND_CFI_EPILOGUE                                   \\\n         : /*out*/   \"=d\" (_res)                                 \\\n         : /*in*/    \"a\" (&_argvec[0]) __FRAME_POINTER           \\\n         : /*trash*/ \"cc\", \"memory\", __CALLER_SAVED_REGS,\"6\",\"7\" \\\n      );                                                         \\\n      lval = (__typeof__(lval)) _res;                            \\\n   } while (0)\n\n\n#endif /* PLAT_s390x_linux */\n\n\n/* ------------------------------------------------------------------ */\n/* ARCHITECTURE INDEPENDENT MACROS for CLIENT REQUESTS.               */\n/*                                                                    */\n/* ------------------------------------------------------------------ */\n\n/* Some request codes.  There are many more of these, but most are not\n   exposed to end-user view.  These are the public ones, all of the\n   form 0x1000 + small_number.\n\n   Core ones are in the range 0x00000000--0x0000ffff.  The non-public\n   ones start at 0x2000.\n*/\n\n/* These macros are used by tools -- they must be public, but don't\n   embed them into other programs. */\n#define VG_USERREQ_TOOL_BASE(a,b) \\\n   ((unsigned int)(((a)&0xff) << 24 | ((b)&0xff) << 16))\n#define VG_IS_TOOL_USERREQ(a, b, v) \\\n   (VG_USERREQ_TOOL_BASE(a,b) == ((v) & 0xffff0000))\n\n/* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !! \n   This enum comprises an ABI exported by Valgrind to programs\n   which use client requests.  DO NOT CHANGE THE ORDER OF THESE\n   ENTRIES, NOR DELETE ANY -- add new ones at the end. */\ntypedef\n   enum { VG_USERREQ__RUNNING_ON_VALGRIND  = 0x1001,\n          VG_USERREQ__DISCARD_TRANSLATIONS = 0x1002,\n\n          /* These allow any function to be called from the simulated\n             CPU but run on the real CPU.  Nb: the first arg passed to\n             the function is always the ThreadId of the running\n             thread!  So CLIENT_CALL0 actually requires a 1 arg\n             function, etc. */\n          VG_USERREQ__CLIENT_CALL0 = 0x1101,\n          VG_USERREQ__CLIENT_CALL1 = 0x1102,\n          VG_USERREQ__CLIENT_CALL2 = 0x1103,\n          VG_USERREQ__CLIENT_CALL3 = 0x1104,\n\n          /* Can be useful in regression testing suites -- eg. can\n             send Valgrind's output to /dev/null and still count\n             errors. */\n          VG_USERREQ__COUNT_ERRORS = 0x1201,\n\n          /* Allows a string (gdb monitor command) to be passed to the tool\n             Used for interaction with vgdb/gdb */\n          VG_USERREQ__GDB_MONITOR_COMMAND = 0x1202,\n\n          /* These are useful and can be interpreted by any tool that\n             tracks malloc() et al, by using vg_replace_malloc.c. */\n          VG_USERREQ__MALLOCLIKE_BLOCK = 0x1301,\n          VG_USERREQ__RESIZEINPLACE_BLOCK = 0x130b,\n          VG_USERREQ__FREELIKE_BLOCK   = 0x1302,\n          /* Memory pool support. */\n          VG_USERREQ__CREATE_MEMPOOL   = 0x1303,\n          VG_USERREQ__DESTROY_MEMPOOL  = 0x1304,\n          VG_USERREQ__MEMPOOL_ALLOC    = 0x1305,\n          VG_USERREQ__MEMPOOL_FREE     = 0x1306,\n          VG_USERREQ__MEMPOOL_TRIM     = 0x1307,\n          VG_USERREQ__MOVE_MEMPOOL     = 0x1308,\n          VG_USERREQ__MEMPOOL_CHANGE   = 0x1309,\n          VG_USERREQ__MEMPOOL_EXISTS   = 0x130a,\n\n          /* Allow printfs to valgrind log. */\n          /* The first two pass the va_list argument by value, which\n             assumes it is the same size as or smaller than a UWord,\n             which generally isn't the case.  Hence are deprecated.\n             The second two pass the vargs by reference and so are\n             immune to this problem. */\n          /* both :: char* fmt, va_list vargs (DEPRECATED) */\n          VG_USERREQ__PRINTF           = 0x1401,\n          VG_USERREQ__PRINTF_BACKTRACE = 0x1402,\n          /* both :: char* fmt, va_list* vargs */\n          VG_USERREQ__PRINTF_VALIST_BY_REF = 0x1403,\n          VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF = 0x1404,\n\n          /* Stack support. */\n          VG_USERREQ__STACK_REGISTER   = 0x1501,\n          VG_USERREQ__STACK_DEREGISTER = 0x1502,\n          VG_USERREQ__STACK_CHANGE     = 0x1503,\n\n          /* Wine support */\n          VG_USERREQ__LOAD_PDB_DEBUGINFO = 0x1601,\n\n          /* Querying of debug info. */\n          VG_USERREQ__MAP_IP_TO_SRCLOC = 0x1701,\n\n          /* Disable/enable error reporting level.  Takes a single\n             Word arg which is the delta to this thread's error\n             disablement indicator.  Hence 1 disables or further\n             disables errors, and -1 moves back towards enablement.\n             Other values are not allowed. */\n          VG_USERREQ__CHANGE_ERR_DISABLEMENT = 0x1801\n   } Vg_ClientRequest;\n\n#if !defined(__GNUC__)\n#  define __extension__ /* */\n#endif\n\n\n/* Returns the number of Valgrinds this code is running under.  That\n   is, 0 if running natively, 1 if running under Valgrind, 2 if\n   running under Valgrind which is running under another Valgrind,\n   etc. */\n#define RUNNING_ON_VALGRIND                                           \\\n    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* if not */,         \\\n                                    VG_USERREQ__RUNNING_ON_VALGRIND,  \\\n                                    0, 0, 0, 0, 0)                    \\\n\n\n/* Discard translation of code in the range [_qzz_addr .. _qzz_addr +\n   _qzz_len - 1].  Useful if you are debugging a JITter or some such,\n   since it provides a way to make sure valgrind will retranslate the\n   invalidated area.  Returns no value. */\n#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len)              \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DISCARD_TRANSLATIONS,  \\\n                                    _qzz_addr, _qzz_len, 0, 0, 0)\n\n\n/* These requests are for getting Valgrind itself to print something.\n   Possibly with a backtrace.  This is a really ugly hack.  The return value\n   is the number of characters printed, excluding the \"**<pid>** \" part at the\n   start and the backtrace (if present). */\n\n#if defined(__GNUC__) || defined(__INTEL_COMPILER)\n/* Modern GCC will optimize the static routine out if unused,\n   and unused attribute will shut down warnings about it.  */\nstatic int VALGRIND_PRINTF(const char *format, ...)\n   __attribute__((format(__printf__, 1, 2), __unused__));\n#endif\nstatic int\n#if defined(_MSC_VER)\n__inline\n#endif\nVALGRIND_PRINTF(const char *format, ...)\n{\n#if defined(NVALGRIND)\n   return 0;\n#else /* NVALGRIND */\n#if defined(_MSC_VER)\n   uintptr_t _qzz_res;\n#else\n   unsigned long _qzz_res;\n#endif\n   va_list vargs;\n   va_start(vargs, format);\n#if defined(_MSC_VER)\n   _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,\n                              VG_USERREQ__PRINTF_VALIST_BY_REF,\n                              (uintptr_t)format,\n                              (uintptr_t)&vargs,\n                              0, 0, 0);\n#else\n   _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,\n                              VG_USERREQ__PRINTF_VALIST_BY_REF,\n                              (unsigned long)format,\n                              (unsigned long)&vargs, \n                              0, 0, 0);\n#endif\n   va_end(vargs);\n   return (int)_qzz_res;\n#endif /* NVALGRIND */\n}\n\n#if defined(__GNUC__) || defined(__INTEL_COMPILER)\nstatic int VALGRIND_PRINTF_BACKTRACE(const char *format, ...)\n   __attribute__((format(__printf__, 1, 2), __unused__));\n#endif\nstatic int\n#if defined(_MSC_VER)\n__inline\n#endif\nVALGRIND_PRINTF_BACKTRACE(const char *format, ...)\n{\n#if defined(NVALGRIND)\n   return 0;\n#else /* NVALGRIND */\n#if defined(_MSC_VER)\n   uintptr_t _qzz_res;\n#else\n   unsigned long _qzz_res;\n#endif\n   va_list vargs;\n   va_start(vargs, format);\n#if defined(_MSC_VER)\n   _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,\n                              VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,\n                              (uintptr_t)format,\n                              (uintptr_t)&vargs,\n                              0, 0, 0);\n#else\n   _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,\n                              VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,\n                              (unsigned long)format,\n                              (unsigned long)&vargs, \n                              0, 0, 0);\n#endif\n   va_end(vargs);\n   return (int)_qzz_res;\n#endif /* NVALGRIND */\n}\n\n\n/* These requests allow control to move from the simulated CPU to the\n   real CPU, calling an arbitary function.\n   \n   Note that the current ThreadId is inserted as the first argument.\n   So this call:\n\n     VALGRIND_NON_SIMD_CALL2(f, arg1, arg2)\n\n   requires f to have this signature:\n\n     Word f(Word tid, Word arg1, Word arg2)\n\n   where \"Word\" is a word-sized type.\n\n   Note that these client requests are not entirely reliable.  For example,\n   if you call a function with them that subsequently calls printf(),\n   there's a high chance Valgrind will crash.  Generally, your prospects of\n   these working are made higher if the called function does not refer to\n   any global variables, and does not refer to any libc or other functions\n   (printf et al).  Any kind of entanglement with libc or dynamic linking is\n   likely to have a bad outcome, for tricky reasons which we've grappled\n   with a lot in the past.\n*/\n#define VALGRIND_NON_SIMD_CALL0(_qyy_fn)                          \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,       \\\n                                    VG_USERREQ__CLIENT_CALL0,     \\\n                                    _qyy_fn,                      \\\n                                    0, 0, 0, 0)\n\n#define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1)                    \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,            \\\n                                    VG_USERREQ__CLIENT_CALL1,          \\\n                                    _qyy_fn,                           \\\n                                    _qyy_arg1, 0, 0, 0)\n\n#define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2)         \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,            \\\n                                    VG_USERREQ__CLIENT_CALL2,          \\\n                                    _qyy_fn,                           \\\n                                    _qyy_arg1, _qyy_arg2, 0, 0)\n\n#define VALGRIND_NON_SIMD_CALL3(_qyy_fn, _qyy_arg1, _qyy_arg2, _qyy_arg3) \\\n    VALGRIND_DO_CLIENT_REQUEST_EXPR(0 /* default return */,             \\\n                                    VG_USERREQ__CLIENT_CALL3,           \\\n                                    _qyy_fn,                            \\\n                                    _qyy_arg1, _qyy_arg2,               \\\n                                    _qyy_arg3, 0)\n\n\n/* Counts the number of errors that have been recorded by a tool.  Nb:\n   the tool must record the errors with VG_(maybe_record_error)() or\n   VG_(unique_error)() for them to be counted. */\n#define VALGRIND_COUNT_ERRORS                                     \\\n    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(                    \\\n                               0 /* default return */,            \\\n                               VG_USERREQ__COUNT_ERRORS,          \\\n                               0, 0, 0, 0, 0)\n\n/* Several Valgrind tools (Memcheck, Massif, Helgrind, DRD) rely on knowing\n   when heap blocks are allocated in order to give accurate results.  This\n   happens automatically for the standard allocator functions such as\n   malloc(), calloc(), realloc(), memalign(), new, new[], free(), delete,\n   delete[], etc.\n\n   But if your program uses a custom allocator, this doesn't automatically\n   happen, and Valgrind will not do as well.  For example, if you allocate\n   superblocks with mmap() and then allocates chunks of the superblocks, all\n   Valgrind's observations will be at the mmap() level and it won't know that\n   the chunks should be considered separate entities.  In Memcheck's case,\n   that means you probably won't get heap block overrun detection (because\n   there won't be redzones marked as unaddressable) and you definitely won't\n   get any leak detection.\n\n   The following client requests allow a custom allocator to be annotated so\n   that it can be handled accurately by Valgrind.\n\n   VALGRIND_MALLOCLIKE_BLOCK marks a region of memory as having been allocated\n   by a malloc()-like function.  For Memcheck (an illustrative case), this\n   does two things:\n\n   - It records that the block has been allocated.  This means any addresses\n     within the block mentioned in error messages will be\n     identified as belonging to the block.  It also means that if the block\n     isn't freed it will be detected by the leak checker.\n\n   - It marks the block as being addressable and undefined (if 'is_zeroed' is\n     not set), or addressable and defined (if 'is_zeroed' is set).  This\n     controls how accesses to the block by the program are handled.\n   \n   'addr' is the start of the usable block (ie. after any\n   redzone), 'sizeB' is its size.  'rzB' is the redzone size if the allocator\n   can apply redzones -- these are blocks of padding at the start and end of\n   each block.  Adding redzones is recommended as it makes it much more likely\n   Valgrind will spot block overruns.  `is_zeroed' indicates if the memory is\n   zeroed (or filled with another predictable value), as is the case for\n   calloc().\n   \n   VALGRIND_MALLOCLIKE_BLOCK should be put immediately after the point where a\n   heap block -- that will be used by the client program -- is allocated.\n   It's best to put it at the outermost level of the allocator if possible;\n   for example, if you have a function my_alloc() which calls\n   internal_alloc(), and the client request is put inside internal_alloc(),\n   stack traces relating to the heap block will contain entries for both\n   my_alloc() and internal_alloc(), which is probably not what you want.\n\n   For Memcheck users: if you use VALGRIND_MALLOCLIKE_BLOCK to carve out\n   custom blocks from within a heap block, B, that has been allocated with\n   malloc/calloc/new/etc, then block B will be *ignored* during leak-checking\n   -- the custom blocks will take precedence.\n\n   VALGRIND_FREELIKE_BLOCK is the partner to VALGRIND_MALLOCLIKE_BLOCK.  For\n   Memcheck, it does two things:\n\n   - It records that the block has been deallocated.  This assumes that the\n     block was annotated as having been allocated via\n     VALGRIND_MALLOCLIKE_BLOCK.  Otherwise, an error will be issued.\n\n   - It marks the block as being unaddressable.\n\n   VALGRIND_FREELIKE_BLOCK should be put immediately after the point where a\n   heap block is deallocated.\n\n   VALGRIND_RESIZEINPLACE_BLOCK informs a tool about reallocation. For\n   Memcheck, it does four things:\n\n   - It records that the size of a block has been changed.  This assumes that\n     the block was annotated as having been allocated via\n     VALGRIND_MALLOCLIKE_BLOCK.  Otherwise, an error will be issued.\n\n   - If the block shrunk, it marks the freed memory as being unaddressable.\n\n   - If the block grew, it marks the new area as undefined and defines a red\n     zone past the end of the new block.\n\n   - The V-bits of the overlap between the old and the new block are preserved.\n\n   VALGRIND_RESIZEINPLACE_BLOCK should be put after allocation of the new block\n   and before deallocation of the old block.\n\n   In many cases, these three client requests will not be enough to get your\n   allocator working well with Memcheck.  More specifically, if your allocator\n   writes to freed blocks in any way then a VALGRIND_MAKE_MEM_UNDEFINED call\n   will be necessary to mark the memory as addressable just before the zeroing\n   occurs, otherwise you'll get a lot of invalid write errors.  For example,\n   you'll need to do this if your allocator recycles freed blocks, but it\n   zeroes them before handing them back out (via VALGRIND_MALLOCLIKE_BLOCK).\n   Alternatively, if your allocator reuses freed blocks for allocator-internal\n   data structures, VALGRIND_MAKE_MEM_UNDEFINED calls will also be necessary.\n\n   Really, what's happening is a blurring of the lines between the client\n   program and the allocator... after VALGRIND_FREELIKE_BLOCK is called, the\n   memory should be considered unaddressable to the client program, but the\n   allocator knows more than the rest of the client program and so may be able\n   to safely access it.  Extra client requests are necessary for Valgrind to\n   understand the distinction between the allocator and the rest of the\n   program.\n\n   Ignored if addr == 0.\n*/\n#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed)          \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MALLOCLIKE_BLOCK,       \\\n                                    addr, sizeB, rzB, is_zeroed, 0)\n\n/* See the comment for VALGRIND_MALLOCLIKE_BLOCK for details.\n   Ignored if addr == 0.\n*/\n#define VALGRIND_RESIZEINPLACE_BLOCK(addr, oldSizeB, newSizeB, rzB)     \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__RESIZEINPLACE_BLOCK,    \\\n                                    addr, oldSizeB, newSizeB, rzB, 0)\n\n/* See the comment for VALGRIND_MALLOCLIKE_BLOCK for details.\n   Ignored if addr == 0.\n*/\n#define VALGRIND_FREELIKE_BLOCK(addr, rzB)                              \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__FREELIKE_BLOCK,         \\\n                                    addr, rzB, 0, 0, 0)\n\n/* Create a memory pool. */\n#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed)             \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CREATE_MEMPOOL,   \\\n                                    pool, rzB, is_zeroed, 0, 0)\n\n/* Destroy a memory pool. */\n#define VALGRIND_DESTROY_MEMPOOL(pool)                            \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DESTROY_MEMPOOL,  \\\n                                    pool, 0, 0, 0, 0)\n\n/* Associate a piece of memory with a memory pool. */\n#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size)                  \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_ALLOC,    \\\n                                    pool, addr, size, 0, 0)\n\n/* Disassociate a piece of memory from a memory pool. */\n#define VALGRIND_MEMPOOL_FREE(pool, addr)                         \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_FREE,     \\\n                                    pool, addr, 0, 0, 0)\n\n/* Disassociate any pieces outside a particular range. */\n#define VALGRIND_MEMPOOL_TRIM(pool, addr, size)                   \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_TRIM,     \\\n                                    pool, addr, size, 0, 0)\n\n/* Resize and/or move a piece associated with a memory pool. */\n#define VALGRIND_MOVE_MEMPOOL(poolA, poolB)                       \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MOVE_MEMPOOL,     \\\n                                    poolA, poolB, 0, 0, 0)\n\n/* Resize and/or move a piece associated with a memory pool. */\n#define VALGRIND_MEMPOOL_CHANGE(pool, addrA, addrB, size)         \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_CHANGE,   \\\n                                    pool, addrA, addrB, size, 0)\n\n/* Return 1 if a mempool exists, else 0. */\n#define VALGRIND_MEMPOOL_EXISTS(pool)                             \\\n    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                  \\\n                               VG_USERREQ__MEMPOOL_EXISTS,        \\\n                               pool, 0, 0, 0, 0)\n\n/* Mark a piece of memory as being a stack. Returns a stack id. */\n#define VALGRIND_STACK_REGISTER(start, end)                       \\\n    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                  \\\n                               VG_USERREQ__STACK_REGISTER,        \\\n                               start, end, 0, 0, 0)\n\n/* Unmark the piece of memory associated with a stack id as being a\n   stack. */\n#define VALGRIND_STACK_DEREGISTER(id)                             \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STACK_DEREGISTER, \\\n                                    id, 0, 0, 0, 0)\n\n/* Change the start and end address of the stack id. */\n#define VALGRIND_STACK_CHANGE(id, start, end)                     \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STACK_CHANGE,     \\\n                                    id, start, end, 0, 0)\n\n/* Load PDB debug info for Wine PE image_map. */\n#define VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta)     \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__LOAD_PDB_DEBUGINFO, \\\n                                    fd, ptr, total_size, delta, 0)\n\n/* Map a code address to a source file name and line number.  buf64\n   must point to a 64-byte buffer in the caller's address space.  The\n   result will be dumped in there and is guaranteed to be zero\n   terminated.  If no info is found, the first byte is set to zero. */\n#define VALGRIND_MAP_IP_TO_SRCLOC(addr, buf64)                    \\\n    (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0,                  \\\n                               VG_USERREQ__MAP_IP_TO_SRCLOC,      \\\n                               addr, buf64, 0, 0, 0)\n\n/* Disable error reporting for this thread.  Behaves in a stack like\n   way, so you can safely call this multiple times provided that\n   VALGRIND_ENABLE_ERROR_REPORTING is called the same number of times\n   to re-enable reporting.  The first call of this macro disables\n   reporting.  Subsequent calls have no effect except to increase the\n   number of VALGRIND_ENABLE_ERROR_REPORTING calls needed to re-enable\n   reporting.  Child threads do not inherit this setting from their\n   parents -- they are always created with reporting enabled. */\n#define VALGRIND_DISABLE_ERROR_REPORTING                                \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CHANGE_ERR_DISABLEMENT, \\\n                                    1, 0, 0, 0, 0)\n\n/* Re-enable error reporting, as per comments on\n   VALGRIND_DISABLE_ERROR_REPORTING. */\n#define VALGRIND_ENABLE_ERROR_REPORTING                                 \\\n    VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CHANGE_ERR_DISABLEMENT, \\\n                                    -1, 0, 0, 0, 0)\n\n#undef PLAT_x86_darwin\n#undef PLAT_amd64_darwin\n#undef PLAT_x86_win32\n#undef PLAT_x86_linux\n#undef PLAT_amd64_linux\n#undef PLAT_ppc32_linux\n#undef PLAT_ppc64_linux\n#undef PLAT_arm_linux\n#undef PLAT_s390x_linux\n\n#endif   /* __VALGRIND_H */\n"
  },
  {
    "path": "tools/amalgam.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport fnmatch\nimport json\nimport logging\nimport os\nimport re\nimport shutil\n\nROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nJERRY_CORE = os.path.join(ROOT_DIR, 'jerry-core')\nJERRY_PORT = os.path.join(ROOT_DIR, 'jerry-port')\nJERRY_MATH = os.path.join(ROOT_DIR, 'jerry-math')\nJERRY_EXT = os.path.join(ROOT_DIR, 'jerry-ext')\n\n\nclass Amalgamator:\n    # pylint: disable=too-many-instance-attributes\n\n    _RE_INCLUDE = re.compile(r'\\s*#include (\"|<)(.*?)(\"|>)\\n$')\n\n    def __init__(self, h_files, extra_includes=(), remove_includes=(), add_lineinfo=False):\n        self._h_files = h_files\n        self._extra_includes = extra_includes\n        self._remove_includes = remove_includes\n        self._add_lineinfo = add_lineinfo\n        self._last_builtin = None\n        self._processed = []\n        self._output = []\n        # The copyright will be loaded from the first input file\n        self._copyright = {'lines': [], 'loaded': False}\n\n    def _process_non_include(self, line, file_level):\n        # Special case #2: Builtin include header name usage\n        if line.strip() == \"#include BUILTIN_INC_HEADER_NAME\":\n            assert self._last_builtin is not None, 'No previous BUILTIN_INC_HEADER_NAME definition'\n            logging.debug('[%d] Detected usage of BUILTIN_INC_HEADER_NAME, including: \"%s\"',\n                          file_level, self._last_builtin)\n            self.add_file(self._h_files[self._last_builtin])\n            # return from the function as we have processed the included file\n            return\n\n        # Special case #1: Builtin include header name definition\n        if line.startswith('#define BUILTIN_INC_HEADER_NAME '):\n            # the line is in this format: #define BUILTIN_INC_HEADER_NAME \"<filename>\"\n            self._last_builtin = line.split('\"', 2)[1]\n            logging.debug('[%d] Detected definition of BUILTIN_INC_HEADER_NAME: \"%s\"', file_level, self._last_builtin)\n\n        # the line is not anything special, just push it into the output\n        self._output.append(line)\n\n    def _emit_lineinfo(self, line_number, filename):\n        if not self._add_lineinfo:\n            return\n\n        normalized_path = repr(os.path.normpath(filename))[1:-1]\n        line_info = f'#line {line_number} \"{normalized_path}\"\\n'\n\n        if self._output and self._output[-1].startswith('#line'):\n            # Avoid emitting multiple line infos in sequence, just overwrite the last one\n            self._output[-1] = line_info\n        else:\n            self._output.append(line_info)\n\n    def add_file(self, filename, file_level=0):\n        if os.path.basename(filename) in self._processed:\n            logging.warning('Tried to to process an already processed file: \"%s\"', filename)\n            return\n\n        if not file_level:\n            logging.debug('Adding file: \"%s\"', filename)\n\n        file_level += 1\n\n        # mark the start of the new file in the output\n        self._emit_lineinfo(1, filename)\n\n        line_idx = 0\n        with open(filename, 'r', encoding='utf8') as input_file:\n            in_copyright = False\n            for line in input_file:\n                line_idx += 1\n\n                if not in_copyright and line.startswith('/* Copyright '):\n                    in_copyright = True\n                    if not self._copyright['loaded']:\n                        self._copyright['lines'].append(line)\n                    continue\n\n                if in_copyright:\n                    if not self._copyright['loaded']:\n                        self._copyright['lines'].append(line)\n\n                    if line.strip().endswith('*/'):\n                        in_copyright = False\n                        self._copyright['loaded'] = True\n                        # emit a line info so the line numbering can be tracked correctly\n                        self._emit_lineinfo(line_idx + 1, filename)\n\n                    continue\n\n                # check if the line is an '#include' line\n                match = self._RE_INCLUDE.match(line)\n                if not match:\n                    # the line is not a header\n                    self._process_non_include(line, file_level)\n                    continue\n\n                if match.group(1) == '<':\n                    # found a \"global\" include\n                    self._output.append(line)\n                    continue\n\n                name = match.group(2)\n\n                if name in self._remove_includes:\n                    logging.debug('[%d] Removing include line (%s:%d): %s',\n                                  file_level, filename, line_idx, line.strip())\n                    # emit a line info so the line numbering can be tracked correctly\n                    self._emit_lineinfo(line_idx + 1, filename)\n                    continue\n\n                if name not in self._h_files:\n                    logging.warning('[%d] Include not found (%s:%d): \"%s\"', file_level, filename, line_idx, name)\n                    self._output.append(line)\n                    continue\n\n                if name in self._processed:\n                    logging.debug('[%d] Already included: \"%s\"', file_level, name)\n                    # emit a line info so the line numbering can be tracked correctly\n                    self._emit_lineinfo(line_idx + 1, filename)\n                    continue\n\n                logging.debug('[%d] Including: \"%s\"', file_level, self._h_files[name])\n                self.add_file(self._h_files[name], file_level)\n\n                # mark the continuation of the current file in the output\n                self._emit_lineinfo(line_idx + 1, filename)\n\n                if not name.endswith('.inc.h'):\n                    # if the included file is not a \"*.inc.h\" file mark it as processed\n                    self._processed.append(name)\n\n        file_level -= 1\n        if not filename.endswith('.inc.h'):\n            self._processed.append(os.path.basename(filename))\n\n    def write_output(self, out_fp):\n        for line in self._copyright['lines']:\n            out_fp.write(line)\n\n        for include in self._extra_includes:\n            out_fp.write(f'#include \"{include}\"\\n')\n\n        for line in self._output:\n            out_fp.write(line)\n\n\ndef match_files(base_dir, pattern):\n    \"\"\"\n    Return the files matching the given pattern.\n\n    :param base_dir: directory to search in\n    :param pattern: file pattern to use\n    :returns generator: the generator which iterates the matching file names\n    \"\"\"\n    for path, _, files in os.walk(base_dir):\n        for name in files:\n            if fnmatch.fnmatch(name, pattern):\n                yield os.path.join(path, name)\n\n\ndef collect_files(base_dir, pattern):\n    \"\"\"\n    Collect files in the provided base directory given a file pattern.\n    Will collect all files in the base dir recursively.\n\n    :param base_dir: directory to search in\n    :param pattern: file pattern to use\n    :returns dictionary: a dictionary file base name -> file path mapping\n    \"\"\"\n    name_mapping = {}\n    for fname in match_files(base_dir, pattern):\n        name = os.path.basename(fname)\n\n        if name in name_mapping:\n            logging.warning('Duplicate name detected: \"%s\" and \"%s\"', fname, name_mapping[name])\n            continue\n\n        name_mapping[name] = fname\n\n    return name_mapping\n\n\ndef amalgamate(base_dir, input_files=(), output_file=None,\n               append_c_files=False, remove_includes=(), extra_includes=(),\n               add_lineinfo=False):\n    \"\"\"\n    :param input_files: Main input source/header files\n    :param output_file: Output source/header file\n    :param append_c_files: Enable auto inclusion of c files under the base-dir\n    :param add_lineinfo: Enable #line macro insertion into the generated sources\n    \"\"\"\n    logging.debug('Starting merge with args: %s', json.dumps(locals(), indent=4, sort_keys=True))\n\n    h_files = collect_files(base_dir, '*.h')\n    c_files = collect_files(base_dir, '*.c')\n\n    for name in remove_includes:\n        c_files.pop(name, '')\n        h_files.pop(name, '')\n\n    amalgam = Amalgamator(h_files, extra_includes, remove_includes, add_lineinfo)\n    for input_file in input_files:\n        amalgam.add_file(input_file)\n\n    if append_c_files:\n        # if the input file is in the C files list it should be removed to avoid\n        # double inclusion of the file\n        for input_file in input_files:\n            input_name = os.path.basename(input_file)\n            c_files.pop(input_name, '')\n\n        # Add the C files in reverse order to make sure that builtins are\n        # not at the beginning.\n        for fname in sorted(c_files.values(), reverse=True):\n            amalgam.add_file(fname)\n\n    with open(output_file, 'w', encoding='utf8') as output:\n        amalgam.write_output(output)\n\n\ndef amalgamate_jerry_core(output_dir):\n    amalgamate(\n        base_dir=JERRY_CORE,\n        input_files=[\n            os.path.join(JERRY_CORE, 'api', 'jerryscript.c'),\n            # Add the global built-in by default to include some common items\n            # to avoid problems with common built-in headers\n            os.path.join(JERRY_CORE, 'ecma', 'builtin-objects', 'ecma-builtins.c'),\n        ],\n        output_file=os.path.join(output_dir, 'jerryscript.c'),\n        append_c_files=True,\n        remove_includes=[\n            'jerryscript.h',\n            'jerryscript-compiler.h',\n            'jerryscript-core.h',\n            'jerryscript-debugger.h',\n            'jerryscript-debugger-transport.h',\n            'jerryscript-port.h',\n            'jerryscript-snapshot.h',\n            'config.h',\n        ],\n        extra_includes=['jerryscript.h'],\n    )\n\n    amalgamate(\n        base_dir=JERRY_CORE,\n        input_files=[\n            os.path.join(JERRY_CORE, 'include', 'jerryscript.h'),\n            os.path.join(JERRY_CORE, 'include', 'jerryscript-port.h'),\n            os.path.join(JERRY_CORE, 'include', 'jerryscript-debugger-transport.h'),\n        ],\n        output_file=os.path.join(output_dir, 'jerryscript.h'),\n        remove_includes=['config.h'],\n        extra_includes=['jerryscript-config.h'],\n    )\n\n    shutil.copyfile(os.path.join(JERRY_CORE, 'config.h'),\n                    os.path.join(output_dir, 'jerryscript-config.h'))\n\n\ndef amalgamate_jerry_port(output_dir):\n    amalgamate(\n        base_dir=JERRY_PORT,\n        output_file=os.path.join(output_dir, 'jerryscript-port.c'),\n        append_c_files=True,\n        remove_includes=[\n            'jerryscript-port.h',\n        ],\n        extra_includes=[\n            'jerryscript.h',\n        ],\n    )\n\n\ndef amalgamate_jerry_ext(output_dir):\n    amalgamate(\n        base_dir=JERRY_EXT,\n        input_files=[\n            os.path.join(JERRY_EXT, 'arg', 'arg.c'),\n            os.path.join(JERRY_EXT, 'arg', 'arg-js-iterator-helper.c'),\n            os.path.join(JERRY_EXT, 'arg', 'arg-transform-functions.c'),\n            os.path.join(JERRY_EXT, 'handle-scope', 'handle-scope.c'),\n            os.path.join(JERRY_EXT, 'handle-scope', 'handle-scope-allocator.c'),\n            os.path.join(JERRY_EXT, 'module', 'module.c'),\n            os.path.join(JERRY_EXT, 'util', 'handlers.c'),\n            os.path.join(JERRY_EXT, 'util', 'print.c'),\n            os.path.join(JERRY_EXT, 'util', 'properties.c'),\n            os.path.join(JERRY_EXT, 'util', 'repl.c'),\n            os.path.join(JERRY_EXT, 'util', 'sources.c'),\n            os.path.join(JERRY_EXT, 'util', 'test262.c'),\n        ],\n        output_file=os.path.join(output_dir, 'jerryscript-ext.c'),\n        append_c_files=True,\n        remove_includes=[\n            'jerryscript.h',\n            'jerryscript-port.h',\n            'jerryscript-types.h',\n            'jerryscript-core.h',\n            'jerryscript-debugger.h',\n            'jerryscript-debugger-transport.h',\n            'jerryscript-ext/arg.h',\n            'jerryscript-ext/debugger.h',\n            'jerryscript-ext/handlers.h',\n            'jerryscript-ext/handle-scope.h',\n            'jerryscript-ext/print.h',\n            'jerryscript-ext/properties.h',\n            'jerryscript-ext/module.h',\n            'jerryscript-ext/repl.h',\n            'jerryscript-ext/sources.h',\n            'jerryscript-ext/test262.h',\n        ],\n        extra_includes=[\n            'jerryscript.h',\n            'jerryscript-ext.h',\n        ],\n    )\n\n    amalgamate(\n        base_dir=JERRY_EXT,\n        input_files=[\n            os.path.join(JERRY_EXT, 'common', 'jext-common.h'),\n            os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'arg.h'),\n            os.path.join(JERRY_EXT, 'arg', 'arg-internal.h'),\n            os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'arg.impl.h'),\n            os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'handlers.h'),\n            os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'handle-scope.h'),\n            os.path.join(JERRY_EXT, 'handle-scope', 'handle-scope-internal.h'),\n            os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'module.h'),\n            os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'print.h'),\n            os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'properties.h'),\n            os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'repl.h'),\n            os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'sources.h'),\n            os.path.join(JERRY_EXT, 'include', 'jerryscript-ext', 'test262.h'),\n        ],\n        output_file=os.path.join(output_dir, 'jerryscript-ext.h'),\n        remove_includes=[\n            'jerryscript.h',\n            'jerryscript-port.h',\n            'jerryscript-types.h',\n            'jerryscript-ext/handle-scope.h'\n        ],\n        extra_includes=[\n            'jerryscript.h',\n        ],\n    )\n\n\ndef amalgamate_jerry_math(output_dir):\n    amalgamate(\n        base_dir=JERRY_MATH,\n        output_file=os.path.join(output_dir, 'jerryscript-math.c'),\n        append_c_files=True,\n    )\n\n    shutil.copyfile(os.path.join(JERRY_MATH, 'include', 'math.h'),\n                    os.path.join(output_dir, 'math.h'))\n\ndef main():\n    parser = argparse.ArgumentParser(description='Generate amalgamated sources.')\n    parser.add_argument('--jerry-core', action='store_true',\n                        help='amalgamate jerry-core files')\n    parser.add_argument('--jerry-port', action='store_true',\n                        help='amalgamate jerry-port files')\n    parser.add_argument('--jerry-math', action='store_true',\n                        help='amalgamate jerry-math files')\n    parser.add_argument('--jerry-ext', action='store_true',\n                        help='amalgamate jerry-ext files')\n    parser.add_argument('--output-dir', metavar='DIR', default='amalgam',\n                        help='output dir (default: %(default)s)')\n    parser.add_argument('--verbose', '-v', action='store_true',\n                        help='increase verbosity')\n\n    args = parser.parse_args()\n\n    if args.verbose:\n        logging.basicConfig(level=logging.DEBUG)\n\n    try:\n        os.makedirs(args.output_dir)\n    except os.error:\n        pass\n\n    if args.jerry_core:\n        amalgamate_jerry_core(args.output_dir)\n\n    if args.jerry_port:\n        amalgamate_jerry_port(args.output_dir)\n\n    if args.jerry_math:\n        amalgamate_jerry_math(args.output_dir)\n\n    if args.jerry_ext:\n        amalgamate_jerry_ext(args.output_dir)\n\n\n\nif __name__ == '__main__':\n    main()\n"
  },
  {
    "path": "tools/apt-get-install-deps.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nif [ \"$(whoami)\" != \"root\" ]; then\n    SUDO=sudo\nfi\n\n${SUDO} apt-get update -q\n${SUDO} apt-get install -q -y \\\n    make cmake \\\n    gcc gcc-multilib \\\n    doxygen \\\n    cppcheck clang-format-10 python pylint python-serial\n"
  },
  {
    "path": "tools/apt-get-install-qemu-arm.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nif [ \"$(whoami)\" != \"root\" ]; then\n    SUDO=sudo\nfi\n\n${SUDO} apt-get update -q\n${SUDO} apt-get install -q -y \\\n    gcc-arm-linux-gnueabihf libc6-dev-armhf-cross \\\n    qemu-user-static\n"
  },
  {
    "path": "tools/babel/.babelrc",
    "content": "{\n  \"plugins\": [\n    \"@babel/plugin-transform-function-name\",\n    \"@babel/plugin-proposal-object-rest-spread\",\n    \"@babel/plugin-transform-block-scoping\",\n    \"@babel/plugin-transform-destructuring\",\n    \"@babel/plugin-transform-block-scoped-functions\",\n    \"@babel/plugin-transform-unicode-regex\",\n    \"@babel/plugin-transform-sticky-regex\",\n    \"@babel/plugin-transform-spread\",\n    \"@babel/plugin-transform-parameters\",\n    \"@babel/plugin-transform-object-super\",\n    \"@babel/plugin-transform-new-target\",\n    \"@babel/plugin-transform-literals\",\n    \"@babel/plugin-transform-instanceof\"\n  ]\n}\n"
  },
  {
    "path": "tools/babel/README.md",
    "content": "# Converting incompatible features with Babel\nTo run ES6 sources with JerryScript that use unsupported language features, you can use Babel to transpile your code, which will output a semantically equivalent source file, where the unsupported features are replaced with ES5.1 code.\nBabel is a JavaScript compiler that is used to convert ES2015+ code into a backward-compatible version. You can find more information [here](https://babeljs.io/).\n\n## Example\n\n```javascript\n//Before\nconst fn = () => 1;\n\n//After conversion\n\nvar fn = function fn() {\n  return 1;\n};\n```\n## Table of Contents\n* **[Getting ready](#getting-ready)**\n  * Installing node.js and npm\n* **[Using babel](#using-babel)**\n* **[Missing features/Polyfill](#missing-features)**\n\n## Getting ready [](#getting-ready)\n\n### 1. **Node.js and npm**\n\nStart by updating the packages with\n\n`$ sudo apt update`\n\nInstall `nodejs` using the apt package manager\n\n`$ sudo apt install nodejs`\n\nCheck the version of **node.js** to verify that it installed\n\n```bash\n$ nodejs --version\nOutput: v8.10.0\n```\n\nNext up is installing **npm** with the following command\n\n`$ sudo apt install npm`\n\nVerify installation by typing:\n\n```bash\n$ npm --version\nOutput: 6.10.2\n```\n\n### 2. Using babel [](#using-babel)\n\nAssuming you're in the tools/babel folder,\n\n`$ sudo npm install`\n\nAfter installing the dependencies it is ready to use.\n\nPlace the files/directories you want transpiled to the babel folder and run\n\n`$ npm run transpile [name of input file/directory] [(OPTIONAL)name of output file/directory]`\n\nIf you want to use the same name, then only give the name once."
  },
  {
    "path": "tools/babel/package.json",
    "content": "{\n  \"name\": \"jerryscript\",\n  \"description\": \"Ultra-lightweight JavaScript engine for the Internet of Things.\",\n  \"scripts\": {\n    \"transpile\": \"scripty\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/jerryscript-project/jerryscript.git\"\n  },\n  \"license\": \"Apache-2.0\",\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.4.4\",\n    \"@babel/core\": \"^7.4.5\",\n    \"@babel/plugin-proposal-object-rest-spread\": \"^7.5.5\",\n    \"@babel/plugin-transform-block-scoped-functions\": \"^7.2.0\",\n    \"@babel/plugin-transform-block-scoping\": \"^7.4.4\",\n    \"@babel/plugin-transform-destructuring\": \"^7.4.4\",\n    \"@babel/plugin-transform-function-name\": \"^7.4.4\",\n    \"@babel/plugin-transform-instanceof\": \"^7.2.0\",\n    \"@babel/plugin-transform-literals\": \"^7.2.0\",\n    \"@babel/plugin-transform-new-target\": \"^7.4.4\",\n    \"@babel/plugin-transform-object-super\": \"^7.2.0\",\n    \"@babel/plugin-transform-parameters\": \"^7.4.4\",\n    \"@babel/plugin-transform-spread\": \"^7.2.2\",\n    \"@babel/plugin-transform-sticky-regex\": \"^7.2.0\",\n    \"@babel/plugin-transform-unicode-regex\": \"^7.4.4\",\n    \"scripty\": \"^1.9.1\"\n  }\n}\n"
  },
  {
    "path": "tools/babel/scripts/transpile.sh",
    "content": "#!/usr/bin/env bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nif [[ \"$#\" -gt 2 || \"$#\" -lt 1 ]]; then\n  echo \"Usage: $0 input [output]\"\n  echo \"* input: name of input directory/file\"\n  echo \"* output: name of output directory/file (same as input if not given)\"\n  exit 1\nfi\n\nif [[ ! -d $1 && ! -f $1 ]]; then\n  echo \"Error: $1 is not a file or directory\"\n  exit 1\nfi\n\nFLAG='--out-file'\nif [[ -d $1 ]]; then\n  FLAG='--out-dir'\nfi\n\nif [[ \"$#\" -eq 1 ]]; then\n  ./node_modules/.bin/babel $1 $FLAG $1 --verbose\nelse\n  ./node_modules/.bin/babel $1 $FLAG $2 --verbose\nfi\n"
  },
  {
    "path": "tools/brew-install-deps.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nbrew update\n\nPKGS=\"\n    cmake\n    cppcheck clang-format-10\n    \"\n\nfor pkg in $PKGS\ndo\n    if ! ( brew list -1 | grep -q \"^${pkg}\\$\" )\n    then\n        brew install $pkg\n    fi\ndone\n"
  },
  {
    "path": "tools/build.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport multiprocessing\nimport os\nimport shutil\nimport subprocess\nimport sys\nimport settings\n\ndef default_toolchain():\n    # We don't have default toolchain on Windows and os.uname() isn't supported.\n    if sys.platform == 'win32':\n        return None\n\n    (sysname, _, _, _, machine) = os.uname()\n    toolchain = os.path.join(settings.PROJECT_DIR,\n                             'cmake',\n                             f'toolchain_{sysname.lower()}_{machine.lower()}.cmake')\n    return toolchain if os.path.isfile(toolchain) else None\n\ndef get_arguments():\n    devhelp_preparser = argparse.ArgumentParser(add_help=False)\n    devhelp_preparser.add_argument('--devhelp', action='store_true', default=False,\n                                   help='show help with all options '\n                                        '(including those, which are useful for developers only)')\n\n    devhelp_arguments, args = devhelp_preparser.parse_known_args()\n    if devhelp_arguments.devhelp:\n        args.append('--devhelp')\n\n    def devhelp(helpstring):\n        return helpstring if devhelp_arguments.devhelp else argparse.SUPPRESS\n\n    parser = argparse.ArgumentParser(parents=[devhelp_preparser], epilog=\"\"\"\n        This tool is a thin wrapper around cmake and make to help build the\n        project easily. All the real build logic is in the CMakeLists.txt files.\n        For most of the options, the defaults are also defined there.\n        \"\"\")\n\n    buildgrp = parser.add_argument_group('general build options')\n    buildgrp.add_argument('--arch', metavar='OPT', default='',\n                          help='Specify architecture if supported by cmake generator. (default: %(default)s)')\n    buildgrp.add_argument('--builddir', metavar='DIR', default=os.path.join(settings.PROJECT_DIR, 'build'),\n                          help='specify build directory (default: %(default)s)')\n    buildgrp.add_argument('--clean', action='store_true', default=False,\n                          help='clean build')\n    buildgrp.add_argument('--cmake-param', metavar='OPT', action='append', default=[],\n                          help='add custom argument to CMake')\n    buildgrp.add_argument('--compile-flag', metavar='OPT', action='append', default=[],\n                          help='add custom compile flag')\n    buildgrp.add_argument('--build-type', metavar='TYPE', default='MinSizeRel',\n                          help='set build type (default: %(default)s)')\n    buildgrp.add_argument('--debug', dest='build_type', action='store_const', const='Debug', default=argparse.SUPPRESS,\n                          help='debug build (alias for --build-type %(const)s)')\n    buildgrp.add_argument('--install', metavar='DIR', nargs='?', default=None, const=False,\n                          help='install after build (default: don\\'t install; '\n                               'default directory if install: OS-specific)')\n    buildgrp.add_argument('-j', '--jobs', metavar='N', type=int, default=multiprocessing.cpu_count() + 1,\n                          help='number of parallel build jobs (default: %(default)s)')\n    buildgrp.add_argument('--link-lib', metavar='OPT', action='append', default=[],\n                          help='add custom library to be linked')\n    buildgrp.add_argument('--linker-flag', metavar='OPT', action='append', default=[],\n                          help='add custom linker flag')\n    buildgrp.add_argument('--amalgam', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                          help='enable amalgamated build (%(choices)s)')\n    buildgrp.add_argument('--lto', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                          help='enable link-time optimizations (%(choices)s)')\n    buildgrp.add_argument('--static-crt', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                          help='enable msvc static CRT (%(choices)s)')\n    buildgrp.add_argument('--shared-libs', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                          help='enable building of shared libraries (%(choices)s)')\n    buildgrp.add_argument('--strip', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                          help='strip release binaries (%(choices)s)')\n    buildgrp.add_argument('--toolchain', metavar='FILE', default=default_toolchain(),\n                          help='specify toolchain file (default: %(default)s)')\n    buildgrp.add_argument('-v', '--verbose', action='store_const', const='ON',\n                          help='increase verbosity')\n\n    compgrp = parser.add_argument_group('optional components')\n    compgrp.add_argument('--doctests', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('build doctests (%(choices)s)'))\n    compgrp.add_argument('--jerry-cmdline', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='build jerry command line tool (%(choices)s)')\n    compgrp.add_argument('--jerry-cmdline-snapshot', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='build snapshot command line tool (%(choices)s)')\n    compgrp.add_argument('--jerry-cmdline-test', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('build test version of the jerry command line tool (%(choices)s)'))\n    compgrp.add_argument('--libfuzzer', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('build jerry with libfuzzer support (%(choices)s)'))\n    compgrp.add_argument('--jerry-ext', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='build jerry-ext (%(choices)s)')\n    compgrp.add_argument('--jerry-math', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='build and use jerry-math (%(choices)s)')\n    compgrp.add_argument('--jerry-port', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='build default jerry port implementation (%(choices)s)')\n    compgrp.add_argument('--unittests', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('build unittests (%(choices)s)'))\n\n    coregrp = parser.add_argument_group('jerry-core options')\n    coregrp.add_argument('--cpointer-32bit', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable 32 bit compressed pointers (%(choices)s)')\n    coregrp.add_argument('--error-messages', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable error messages (%(choices)s)')\n    coregrp.add_argument('--external-context', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable external context (%(choices)s)')\n    coregrp.add_argument('--jerry-debugger', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable the jerry debugger (%(choices)s)')\n    coregrp.add_argument('--js-parser', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable js-parser (%(choices)s)')\n    coregrp.add_argument('--function-to-string', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable function toString (%(choices)s)')\n    coregrp.add_argument('--line-info', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='provide line info (%(choices)s)')\n    coregrp.add_argument('--logging', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable logging (%(choices)s)')\n    coregrp.add_argument('--mem-heap', metavar='SIZE', type=int,\n                         help='size of memory heap (in kilobytes)')\n    coregrp.add_argument('--gc-limit', metavar='SIZE', type=int,\n                         help='memory usage limit to trigger garbage collection (in bytes)')\n    coregrp.add_argument('--stack-limit', metavar='SIZE', type=int,\n                         help='maximum stack usage (in kilobytes)')\n    coregrp.add_argument('--gc-mark-limit', metavar='SIZE', type=int,\n                         help='maximum depth of recursion during GC mark phase')\n    coregrp.add_argument('--mem-stats', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('enable memory statistics (%(choices)s)'))\n    coregrp.add_argument('--mem-stress-test', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('enable mem-stress test (%(choices)s)'))\n    coregrp.add_argument('--profile', metavar='FILE',\n                         help='specify profile file')\n    coregrp.add_argument('--promise-callback', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable promise callback (%(choices)s)')\n    coregrp.add_argument('--regexp-strict-mode', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('enable regexp strict mode (%(choices)s)'))\n    coregrp.add_argument('--show-opcodes', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('enable parser byte-code dumps (%(choices)s)'))\n    coregrp.add_argument('--show-regexp-opcodes', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('enable regexp byte-code dumps (%(choices)s)'))\n    coregrp.add_argument('--snapshot-exec', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable executing snapshot files (%(choices)s)')\n    coregrp.add_argument('--snapshot-save', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable saving snapshot files (%(choices)s)')\n    coregrp.add_argument('--system-allocator', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable system allocator (%(choices)s)')\n    coregrp.add_argument('--valgrind', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('enable Valgrind support (%(choices)s)'))\n    coregrp.add_argument('--vm-exec-stop', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable VM execution stop callback (%(choices)s)')\n    coregrp.add_argument('--vm-throw', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help='enable VM throw callback (%(choices)s)')\n\n    maingrp = parser.add_argument_group('jerry-main options')\n    maingrp.add_argument('--link-map', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('enable the generation of link map for jerry command line tool (%(choices)s)'))\n    maingrp.add_argument('--compile-commands', metavar='X', choices=['ON', 'OFF'], type=str.upper,\n                         help=devhelp('enable the generation of compile_commands.json (%(choices)s)'))\n\n    arguments = parser.parse_args(args)\n    if arguments.devhelp:\n        parser.print_help()\n        sys.exit(0)\n\n    return arguments\n\ndef generate_build_options(arguments):\n    build_options = []\n\n    def build_options_append(cmakeopt, cliarg):\n        if cliarg:\n            build_options.append(f'-D{cmakeopt}={cliarg}')\n\n    # general build options\n    build_options_append('CMAKE_BUILD_TYPE', arguments.build_type)\n    build_options_append('EXTERNAL_COMPILE_FLAGS', ' '.join(arguments.compile_flag))\n    build_options_append('EXTERNAL_LINK_LIBS', ' '.join(arguments.link_lib))\n    build_options_append('EXTERNAL_LINKER_FLAGS', ' '.join(arguments.linker_flag))\n    build_options_append('ENABLE_AMALGAM', arguments.amalgam)\n    build_options_append('ENABLE_LTO', arguments.lto)\n    build_options_append('BUILD_SHARED_LIBS', arguments.shared_libs)\n    build_options_append('ENABLE_STATIC_CRT', arguments.static_crt)\n    build_options_append('ENABLE_STRIP', arguments.strip)\n    build_options_append('CMAKE_TOOLCHAIN_FILE', arguments.toolchain)\n    build_options_append('CMAKE_VERBOSE_MAKEFILE', arguments.verbose)\n\n    # optional components\n    build_options_append('DOCTESTS', arguments.doctests)\n    build_options_append('JERRY_CMDLINE', arguments.jerry_cmdline)\n    build_options_append('JERRY_CMDLINE_SNAPSHOT', arguments.jerry_cmdline_snapshot)\n    build_options_append('JERRY_CMDLINE_TEST', arguments.jerry_cmdline_test)\n    build_options_append('JERRY_LIBFUZZER', arguments.libfuzzer)\n    build_options_append('JERRY_EXT', arguments.jerry_ext)\n    build_options_append('JERRY_MATH', arguments.jerry_math)\n    build_options_append('JERRY_PORT', arguments.jerry_port)\n    build_options_append('UNITTESTS', arguments.unittests)\n\n    # jerry-core options\n    build_options_append('JERRY_CPOINTER_32_BIT', arguments.cpointer_32bit)\n    build_options_append('JERRY_ERROR_MESSAGES', arguments.error_messages)\n    build_options_append('JERRY_EXTERNAL_CONTEXT', arguments.external_context)\n    build_options_append('JERRY_DEBUGGER', arguments.jerry_debugger)\n    build_options_append('JERRY_PARSER', arguments.js_parser)\n    build_options_append('JERRY_FUNCTION_TO_STRING', arguments.function_to_string)\n    build_options_append('JERRY_LINE_INFO', arguments.line_info)\n    build_options_append('JERRY_LOGGING', arguments.logging)\n    build_options_append('JERRY_GLOBAL_HEAP_SIZE', arguments.mem_heap)\n    build_options_append('JERRY_GC_LIMIT', arguments.gc_limit)\n    build_options_append('JERRY_STACK_LIMIT', arguments.stack_limit)\n    build_options_append('JERRY_MEM_STATS', arguments.mem_stats)\n    build_options_append('JERRY_MEM_GC_BEFORE_EACH_ALLOC', arguments.mem_stress_test)\n    build_options_append('JERRY_PROFILE', arguments.profile)\n    build_options_append('JERRY_PROMISE_CALLBACK', arguments.promise_callback)\n    build_options_append('JERRY_REGEXP_STRICT_MODE', arguments.regexp_strict_mode)\n    build_options_append('JERRY_PARSER_DUMP_BYTE_CODE', arguments.show_opcodes)\n    build_options_append('JERRY_REGEXP_DUMP_BYTE_CODE', arguments.show_regexp_opcodes)\n    build_options_append('JERRY_SNAPSHOT_EXEC', arguments.snapshot_exec)\n    build_options_append('JERRY_SNAPSHOT_SAVE', arguments.snapshot_save)\n    build_options_append('JERRY_SYSTEM_ALLOCATOR', arguments.system_allocator)\n    build_options_append('JERRY_VALGRIND', arguments.valgrind)\n    build_options_append('JERRY_VM_HALT', arguments.vm_exec_stop)\n    build_options_append('JERRY_VM_THROW', arguments.vm_throw)\n\n    if arguments.gc_mark_limit is not None:\n        build_options.append(f'-DJERRY_GC_MARK_LIMIT={arguments.gc_mark_limit}')\n\n    # jerry-main options\n    build_options_append('ENABLE_LINK_MAP', arguments.link_map)\n    build_options_append('ENABLE_COMPILE_COMMANDS', arguments.compile_commands)\n\n    # general build options (final step)\n    if arguments.cmake_param:\n        build_options.extend(arguments.cmake_param)\n\n    return build_options\n\ndef configure_output_dir(arguments):\n    if not os.path.isabs(arguments.builddir):\n        arguments.builddir = os.path.join(settings.PROJECT_DIR, arguments.builddir)\n\n    if arguments.clean and os.path.exists(arguments.builddir):\n        shutil.rmtree(arguments.builddir)\n\n    if not os.path.exists(arguments.builddir):\n        os.makedirs(arguments.builddir)\n\ndef configure_jerry(arguments):\n    configure_output_dir(arguments)\n\n    build_options = generate_build_options(arguments)\n\n    cmake_cmd = ['cmake', '-B' + arguments.builddir, '-H' + settings.PROJECT_DIR]\n\n    if arguments.arch:\n        cmake_cmd.append('-A' + arguments.arch)\n\n    if arguments.install:\n        cmake_cmd.append(f'-DCMAKE_INSTALL_PREFIX={arguments.install}')\n\n    cmake_cmd.extend(build_options)\n\n    return subprocess.call(cmake_cmd)\n\ndef make_jerry(arguments):\n    make_cmd = ['cmake', '--build', arguments.builddir, '--config', arguments.build_type]\n    env = dict(os.environ)\n    env['CMAKE_BUILD_PARALLEL_LEVEL'] = str(arguments.jobs)\n    env['MAKEFLAGS'] = f'-j{arguments.jobs}'  # Workaround for CMake < 3.12\n    with subprocess.Popen(make_cmd, env=env) as proc:\n        proc.wait()\n        return proc.returncode\n\ndef install_jerry(arguments):\n    install_target = 'INSTALL' if os.path.exists(os.path.join(arguments.builddir, 'Jerry.sln')) else 'install'\n    make_cmd = ['cmake', '--build', arguments.builddir, '--config', arguments.build_type, '--target', install_target]\n    return subprocess.call(make_cmd)\n\ndef print_result(ret):\n    print('=' * 30)\n    if ret:\n        print(f'Build failed with exit code: {ret}')\n    else:\n        print('Build succeeded!')\n    print('=' * 30)\n\ndef main():\n    arguments = get_arguments()\n\n    ret = configure_jerry(arguments)\n\n    if not ret:\n        ret = make_jerry(arguments)\n\n    if not ret and arguments.install is not None:\n        ret = install_jerry(arguments)\n\n    print_result(ret)\n    sys.exit(ret)\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "tools/check-cppcheck.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nif [[ \"$OSTYPE\" == \"linux\"* ]]; then\n  CPPCHECK_JOBS=${CPPCHECK_JOBS:=$(nproc)}\nelif [[ \"$OSTYPE\" == \"darwin\"* ]]; then\n  CPPCHECK_JOBS=${CPPCHECK_JOBS:=$(sysctl -n hw.ncpu)}\nelse\n  CPPCHECK_JOBS=${CPPCHECK_JOBS:=1}\nfi\n\nJERRY_CORE_DIRS=`find jerry-core -type d`\nJERRY_EXT_DIRS=`find jerry-ext -type d`\nJERRY_PORT_DIRS=`find jerry-port -type d`\nJERRY_MATH_DIRS=`find jerry-math -type d`\n\n\nINCLUDE_DIRS=()\nfor DIR in $JERRY_CORE_DIRS $JERRY_EXT_DIRS $JERRY_PORT_DIRS $JERRY_MATH_DIRS\ndo\n  INCLUDE_DIRS=(\"${INCLUDE_DIRS[@]}\" \"-I$DIR\")\ndone\n\ncppcheck -j$CPPCHECK_JOBS --force \\\n  --language=c --std=c99 \\\n  --quiet \\\n  -D'JERRY_LIKELY(x)=(x)' \\\n  -D'JERRY_UNLIKELY(x)=(x)' \\\n  --enable=warning,style,performance,portability,information \\\n  --template=\"{file}:{line}: {severity}({id}): {message}\" \\\n  --error-exitcode=1 \\\n  --inline-suppr \\\n  --exitcode-suppressions=tools/cppcheck/suppressions-list \\\n  --suppressions-list=tools/cppcheck/suppressions-list \\\n  \"${INCLUDE_DIRS[@]}\" \\\n  jerry-core jerry-ext jerry-port jerry-math jerry-main tests/unit-*\n"
  },
  {
    "path": "tools/check-doxygen.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ndoxygen 2>&1 >/dev/null \\\n  | grep -Pv \"^\\/.+\\.h:\\d+: warning: Member .+ \\(function\\) of group \\w+ is not documented.$\" \\\n  | grep -Pv \"^\\/.+\\.h:\\d+: warning: documented empty return type of \\w+$\" \\\n  | grep -Pv \"^\\/.+\\.h:\\d+: warning: argument '.+' from the argument list of .+ has multiple @param documentation sections$\" \\\n  | head -n 1000 | tee doxygen.log\nif [ -s doxygen.log ]\nthen\n  EXIT=1\nelse\n  EXIT=0\nfi\nrm -f doxygen.log\nexit $EXIT\n"
  },
  {
    "path": "tools/check-format.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport multiprocessing\nimport subprocess\nfrom os import path\nfrom glob import glob\nimport sys\nimport re\n\nfrom settings import PROJECT_DIR\n\nRE_CLANG_FORMAT_VERSION = re.compile(\n    r\".*clang-format version (?P<version>\\d{2})\\.\")\nRE_DIRECTIVE_COMMENT = re.compile(r\"^#\\s*(else|endif)$\", re.MULTILINE)\nRE_FUNCTION_NAME_COMMENT = re.compile(\n    r\"^\\}(?!(?:\\s\\/\\*\\s\\w+\\s\\*\\/$|\\s?\\w*;))\", re.MULTILINE)\n\nCLANG_FORMAT_MIN_VERSION = 15\n\nFOLDERS = [\"jerry-core\",\n           \"jerry-ext\",\n           \"jerry-port\",\n           \"jerry-math\",\n           \"jerry-main\",\n           \"tests/unit-core\",\n           \"tests/unit-ext\",\n           \"tests/unit-math\"]\n\n\ndef get_arguments():\n    parser = argparse.ArgumentParser()\n    parser.add_argument('--fix', action='store_true', dest='fix',\n                        help='fix source code stlye')\n    parser.add_argument('--clang-format', dest='clang_format', default=f'clang-format-{CLANG_FORMAT_MIN_VERSION}',\n                        help='path to clang-format executable')\n\n    script_args = parser.parse_args()\n    return script_args\n\n\ndef check_clang_format(args, source_file_name):\n    cmd = [args.clang_format]\n\n    if args.fix:\n        cmd.append('-i')\n    else:\n        cmd.extend(['--dry-run', '--Werror'])\n\n    cmd.append(source_file_name)\n\n    with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc:\n        _, error = proc.communicate()\n\n        if proc.returncode == 0:\n            return 0\n\n        print(error.decode('utf8'))\n\n    return 1\n\n\ndef check_comments(regexps, source_file_name):\n    failed = 0\n\n    with open(source_file_name, encoding='utf-8') as source_file:\n        data = source_file.read()\n\n        for regexp in regexps:\n            for match in re.finditer(regexp, data):\n                failed += 1\n                print(\"Invalid/Missing comment in %s:%d\" %\n                      (source_file_name, data.count('\\n', 0, match.start()) + 1))\n\n    return 1 if failed else 0\n\n\ndef run_pass(pool, process, process_args):\n    return sum(pool.starmap(process, process_args))\n\n\ndef check_clang_format_version(args):\n    try:\n        out = subprocess.check_output([args.clang_format, '--version'])\n        match = RE_CLANG_FORMAT_VERSION.match(out.decode('utf8'))\n\n        if match and int(match.group('version')) >= CLANG_FORMAT_MIN_VERSION:\n            return 0\n    except OSError:\n        pass\n\n    return 1\n\n\ndef main(args):\n    if check_clang_format_version(args) != 0:\n        print(f\"clang-format >= {CLANG_FORMAT_MIN_VERSION} is not installed.\")\n        return 1\n\n    with multiprocessing.Pool() as pool:\n        failed = 0\n\n        for folder in FOLDERS:\n            # pylint: disable=unexpected-keyword-arg\n            files = sum(([glob(path.join(PROJECT_DIR, folder, f\"**/*.{e}\"), recursive=True)\n                          for e in ['c', 'h']]), [])\n\n            failed += run_pass(pool, check_clang_format,\n                               [(args, sourece_file) for sourece_file in files])\n            failed += run_pass(pool, check_comments,\n                               [([RE_DIRECTIVE_COMMENT, RE_FUNCTION_NAME_COMMENT], sourece_file) for sourece_file in\n                                files])\n\n        return 1 if failed else 0\n\n\nif __name__ == \"__main__\":\n    sys.exit(main(get_arguments()))\n"
  },
  {
    "path": "tools/check-license.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport io\nimport os\nimport re\nimport sys\nimport settings\n\nLICENSE = re.compile(\n    r'((#|//|\\*) Copyright .*\\n'\n    r')+\\s?\\2\\n'\n    r'\\s?\\2 Licensed under the Apache License, Version 2.0 \\(the \"License\"\\);\\n'\n    r'\\s?\\2 you may not use this file except in compliance with the License.\\n'\n    r'\\s?\\2 You may obtain a copy of the License at\\n'\n    r'\\s?\\2\\n'\n    r'\\s?\\2     http://www.apache.org/licenses/LICENSE-2.0\\n'\n    r'\\s?\\2\\n'\n    r'\\s?\\2 Unless required by applicable law or agreed to in writing, software\\n'\n    r'\\s?\\2 distributed under the License is distributed on an \"AS IS\" BASIS\\n'\n    r'\\s?\\2 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n'\n    r'\\s?\\2 See the License for the specific language governing permissions and\\n'\n    r'\\s?\\2 limitations under the License.\\n'\n)\n\nINCLUDE_DIRS = [\n    'cmake',\n    'jerry-core',\n    'jerry-ext',\n    'jerry-math',\n    'jerry-main',\n    'jerry-port',\n    'targets',\n    'tests',\n    'tools',\n]\n\nEXCLUDE_DIRS = [\n    'targets/esp8266',\n    os.path.relpath(settings.TEST262_TEST_SUITE_DIR, settings.PROJECT_DIR),\n]\n\nEXTENSIONS = [\n    '.c',\n    '.cpp',\n    '.h',\n    '.S',\n    '.js',\n    '.py',\n    '.sh',\n    '.tcl',\n    '.cmake',\n]\n\n\ndef main():\n    is_ok = True\n\n    for dname in INCLUDE_DIRS:\n        for root, _, files in os.walk(dname):\n            if any(root.startswith(exclude) for exclude in EXCLUDE_DIRS):\n                continue\n            for fname in files:\n                if any(fname.endswith(ext) for ext in EXTENSIONS):\n                    fpath = os.path.join(root, fname)\n                    with io.open(fpath, 'r', errors='ignore', encoding='utf8') as curr_file:\n                        if not LICENSE.search(curr_file.read()):\n                            print(f'{fpath}: incorrect license')\n                            is_ok = False\n\n    if not is_ok:\n        sys.exit(1)\n\n\nif __name__ == '__main__':\n    main()\n"
  },
  {
    "path": "tools/check-pylint.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nTERM_NORMAL='\\033[0m'\nTERM_RED='\\033[1;31m'\n\npylint --version &>/dev/null\nif [ $? -ne 0 ]\nthen\n    echo -e \"${TERM_RED}Can't run check-pylint because pylint isn't installed.${TERM_NORMAL}\\n\"\n    exit 1\nfi\n\nfind ./tools ./jerry-debugger -name \"*.py\" \\\n    | xargs pylint --rcfile=tools/pylint/pylintrc\n"
  },
  {
    "path": "tools/check-signed-off.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# Usage\nfunction print_usage\n{\n echo \"Usage: $0 [--help] [--tolerant] [--gh-actions]\"\n}\n\nfunction print_help\n{\n echo \"$0: Check Signed-off-by message of the latest commit\"\n echo \"\"\n print_usage\n echo \"\"\n echo \"Optional arguments:\"\n echo \"  --help            print this help message\"\n echo \"  --tolerant        check the existence of the message only but don't\"\n echo \"                    require the name and email address to match the author\"\n echo \"                    of the commit\"\n echo \"  --gh-actions      perform check in tolerant mode if on GitHub-Actions and not\"\n echo \"                    checking a pull request, perform strict check otherwise\"\n echo \"\"\n echo \"The last line of every commit message must follow the form of:\"\n echo \"'JerryScript-DCO-1.0-Signed-off-by: NAME EMAIL', where NAME and EMAIL must\"\n echo \"match the name and email address of the author of the commit (unless in\"\n echo \"tolerant mode).\"\n}\n\n# Processing command line\nTOLERANT=\"no\"\nwhile [ \"$#\" -gt 0 ]\ndo\n if [ \"$1\" == \"--help\" ]\n then\n  print_help\n  exit 0\n elif [ \"$1\" == \"--tolerant\" ]\n then\n  TOLERANT=\"yes\"\n  shift\n elif [ \"$1\" == \"--gh-actions\" ]\n then\n  if [ \"$GITHUB_EVENT_NAME\" == \"\" ]\n  then\n   echo -e \"\\e[1;33mWarning! GitHub-Actions-tolerant mode requested but not running on GitHub-Actions! \\e[0m\"\n  elif [ \"$GITHUB_EVENT_NAME\" == \"pull_request\" ]\n  then\n   TOLERANT=\"no\"\n  else\n   TOLERANT=\"yes\"\n  fi\n  shift\n else\n  print_usage\n  exit 1\n fi\ndone\n\n# Determining latest commit\nparent_hashes=(`git show -s --format=%p HEAD | head -1`)\n\nif [ \"${#parent_hashes[@]}\" -eq 1 ]\nthen\n commit_hash=`git show -s --format=%h HEAD | head -1`\nelif [ \"${#parent_hashes[@]}\" -eq 2 ]\nthen\n commit_hash=${parent_hashes[1]}\nelse\n echo \"$0: cannot handle commit with ${#parent_hashes[@]} parents ${parent_hashes[@]}\"\n exit 1\nfi\n\n# Checking the last line\nactual_signed_off_by_line=`git show -s --format=%B $commit_hash | sed '/^$/d' | tr -d '\\015' | tail -n 1`\n\nif [ \"$TOLERANT\" == \"no\" ]\nthen\n author_name=`git show -s --format=%an $commit_hash`\n author_email=`git show -s --format=%ae $commit_hash`\n required_signed_off_by_line=\"JerryScript-DCO-1.0-Signed-off-by: $author_name $author_email\"\n\n if [ \"$actual_signed_off_by_line\" != \"$required_signed_off_by_line\" ]\n then\n  echo -e \"\\e[1;33mSigned-off-by message is incorrect. The following line should be at the end of the $commit_hash commit's message: '$required_signed_off_by_line'. \\e[0m\"\n  exit 1\n fi\nelse\n  echo -e \"\\e[1;33mWarning! The name and email address of the author of the $commit_hash commit is not checked in tolerant mode! \\e[0m\"\n  if echo \"$actual_signed_off_by_line\" | grep -q -v '^JerryScript-DCO-1.0-Signed-off-by:'\n  then\n   echo -e \"\\e[1;33mSigned-off-by message is incorrect. The following line should be at the end of the $commit_hash commit's message: '$required_signed_off_by_line'. \\e[0m\"\n   exit 1\n  fi\nfi\n\nexit 0\n"
  },
  {
    "path": "tools/check-sonarqube.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nif [[ \"${TRAVIS_REPO_SLUG}\" == \"jerryscript-project/jerryscript\"\n  && ${TRAVIS_BRANCH} == \"master\"\n  && ${TRAVIS_EVENT_TYPE} == \"push\" ]]\nthen\n  git fetch --unshallow\n  build-wrapper-linux-x86-64 --out-dir bw-output \\\n    ./tools/build.py --error-messages=on \\\n                     --jerry-cmdline-snapshot=on \\\n                     --jerry-debugger=on \\\n                     --line-info=on \\\n                     --mem-stats=on \\\n                     --profile=es.next \\\n                     --snapshot-save=on \\\n                     --snapshot-exec=on \\\n                     --valgrind=on \\\n                     --vm-exec-stop=on\n  sonar-scanner -Dsonar.projectVersion=\"${TRAVIS_COMMIT}\"\nelse\n  # SonarQube analysis works only on the master branch.\n  # Ensure the build works with the options used for the analysis.\n  ./tools/build.py --error-messages=on \\\n                   --jerry-cmdline-snapshot=on \\\n                   --jerry-debugger=on \\\n                   --line-info=on \\\n                   --mem-stats=on \\\n                   --profile=es.next \\\n                   --snapshot-save=on \\\n                   --snapshot-exec=on \\\n                   --valgrind=on \\\n                   --vm-exec-stop=on\nfi\n"
  },
  {
    "path": "tools/check-strings.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nMAGIC_STRINGS_GEN=\"tools/gen-strings.py\"\nMAGIC_STRINGS_INC_H=\"jerry-core/lit/lit-magic-strings.inc.h\"\nECMA_ERROR_MESSAGES_INC_H=\"jerry-core/ecma/base/ecma-error-messages.inc.h\"\nPARSER_ERROR_MESSAGES_INC_H=\"jerry-core/parser/js/parser-error-messages.inc.h\"\nMAGIC_STRINGS_TEMP=$(mktemp lit-magic-strings.inc.h.XXXXXXXXXX)\nECMA_ERROR_MESSAGES_TEMP=$(mktemp ecma-error-messages.inc.h.XXXXXXXXXX)\nPARSER_ERROR_MESSAGES_TEMP=$(mktemp parser-error-messages.inc.h.XXXXXXXXXX)\n\ncp $MAGIC_STRINGS_INC_H \"$MAGIC_STRINGS_TEMP\"\ncp $ECMA_ERROR_MESSAGES_INC_H \"$ECMA_ERROR_MESSAGES_TEMP\"\ncp $PARSER_ERROR_MESSAGES_INC_H \"$PARSER_ERROR_MESSAGES_TEMP\"\n$MAGIC_STRINGS_GEN\nDIFF_RESULT=$?\n\nif [ $DIFF_RESULT -eq 0 ]\nthen\n  diff -q $MAGIC_STRINGS_INC_H \"$MAGIC_STRINGS_TEMP\"\n  DIFF_RESULT=$?\n  if [ $DIFF_RESULT -ne 0 ]\n  then\n    echo -e \"\\e[1;33m$MAGIC_STRINGS_INC_H must be re-generated. Run $MAGIC_STRINGS_GEN\\e[0m\"\n    exit $DIFF_RESULT\n  fi\n  diff -q $ECMA_ERROR_MESSAGES_INC_H \"$ECMA_ERROR_MESSAGES_TEMP\"\n  DIFF_RESULT=$?\n  if [ $DIFF_RESULT -ne 0 ]\n  then\n    echo -e \"\\e[1;33m$ECMA_ERROR_MESSAGES_INC_H must be re-generated. Run $MAGIC_STRINGS_GEN\\e[0m\"\n    exit $DIFF_RESULT\n  fi\n  diff -q $PARSER_ERROR_MESSAGES_INC_H \"$PARSER_ERROR_MESSAGES_TEMP\"\n  DIFF_RESULT=$?\n  if [ $DIFF_RESULT -ne 0 ]\n  then\n    echo -e \"\\e[1;33m$PARSER_ERROR_MESSAGES_INC_H must be re-generated. Run $MAGIC_STRINGS_GEN\\e[0m\"\n    exit $DIFF_RESULT\n  fi\nfi\nmv \"$MAGIC_STRINGS_TEMP\" $MAGIC_STRINGS_INC_H\nmv \"$ECMA_ERROR_MESSAGES_TEMP\" $ECMA_ERROR_MESSAGES_INC_H\nmv \"$PARSER_ERROR_MESSAGES_TEMP\" $PARSER_ERROR_MESSAGES_INC_H\n\nexit $DIFF_RESULT\n"
  },
  {
    "path": "tools/cppcheck/suppressions-list",
    "content": "ConfigurationNotChecked:jerry-core/*.inc.h\narrayIndexOutOfBoundsCond:jerry-core/*.c\nautoVariables:jerry-core/*.c\nconstParameter:jerry-core/*.c\nconstParameter:jerry-ext/*.c\nconstParameter:jerry-math/*.c\nconstParameter:tests/unit-core/*.c\nduplicateValueTernary:jerry-core/*.c\nincorrectStringBooleanError:tests/unit-core/test-newtarget.c\nintegerOverflowCond:jerry-math/*.c\ninvalidFunctionArg:tests/unit-math/test-math.inc.h\ninvalidPointerCast:jerry-math/*.c\nknownConditionTrueFalse:jerry-core/*.c\nknownConditionTrueFalse:jerry-math/*.c\nnegativeIndex:jerry-core/*.c\nnullPointerArithmetic:jerry-core/parser/js/js-parser-line-info-create.c:572\nnullPointerArithmetic:jerry-core/parser/js/js-scanner-util.c:2345\nnullPointerArithmeticRedundantCheck:jerry-core/*.c\nnullPointerRedundantCheck:jerry-core/*.c\nnullPointerRedundantCheck:jerry-ext/*.c\nnullPointerRedundantCheck:jerry-main/*.c\nnullPointerRedundantCheck:tests/unit-core/*.c\noppositeInnerCondition:jerry-core/*.c\nredundantAssignment:jerry-core/*.c\nredundantAssignment:tests/unit-core/test-container-operation.c:129\nredundantInitialization:jerry-core/*.c\nredundantInitialization:tests/unit-core/test-from-property-descriptor.c:42\nshiftNegative:jerry-core/*.c\nshiftNegative:jerry-math/*.c\nshiftNegativeLHS:jerry-math/*.c\nshiftTooManyBits:jerry-core/*.c\nshiftTooManyBitsSigned:jerry-math/*.c\nsignConversionCond:jerry-core/*.c\nuninitvar:tests/unit-core/test-api-objecttype.c:119\nunmatchedSuppression:jerry-core/*.inc.h\nunreadVariable:jerry-core/*.c\nunreadVariable:jerry-port/*.c\nunusedStructMember:jerry-ext/arg/arg-transform-functions.c\nunusedStructMember:jerry-main/*.c\nunusedStructMember:tests/unit-core/*.c\nvariableScope:jerry-math/*.c\nwrongmathcall:tests/unit-math/test-math.inc.h\nzerodivcond:jerry-core/*.c\n"
  },
  {
    "path": "tools/gen-doctest.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport fileinput\nimport os\nimport re\nimport shlex\nimport sys\n\n\nclass DoctestExtractor:\n    \"\"\"\n    An extractor to process Markdown files and find doctests inside.\n    \"\"\"\n\n    def __init__(self, outdir, dry):\n        \"\"\"\n        :param outdir: path to the directory where to write the found doctests.\n        :param dry: if True, don't create the doctest files but print the file\n            names only.\n        \"\"\"\n        self._outdir = outdir\n        self._dry = dry\n\n        # Attributes actually initialized by process()\n        self._infile = None\n        self._outname_base = None\n        self._outname_cnt = None\n\n    def _warning(self, message, lineno):\n        \"\"\"\n        Print a warning to the standard error.\n\n        :param message: a description of the problem.\n        :param lineno: the location that triggered the warning.\n        \"\"\"\n        print(f'{self._infile}:{lineno}: {message}', file=sys.stderr)\n\n    def _process_decl(self, params):\n        \"\"\"\n        Process a doctest declaration (`[doctest]: # (name=\"test.c\", ...)`).\n\n        :param params: the parameter string of the declaration (the string\n            between the parentheses).\n        :return: a tuple of a dictionary (of keys and values taken from the\n            `params` string) and the line number of the declaration.\n        \"\"\"\n        tokens = list(shlex.shlex(params))\n\n        decl = {}\n        for i in range(0, len(tokens), 4):\n            if i + 2 >= len(tokens) or tokens[i + 1] != '=' or (i + 3 < len(tokens) and tokens[i + 3] != ','):\n                self._warning('incorrect parameter list for test (key=\"value\", ...)', fileinput.filelineno())\n                decl = {}\n                break\n            decl[tokens[i]] = tokens[i + 2].strip('\\'\"')\n\n        if 'name' not in decl:\n            decl['name'] = f'{self._outname_base}{self._outname_cnt}.c'\n            self._outname_cnt += 1\n\n        if 'test' not in decl:\n            decl['test'] = 'run'\n\n        return decl, fileinput.filelineno()\n\n    def _process_code_start(self):\n        \"\"\"\n        Process the beginning of a fenced code block (` ```c `).\n\n        :return: a tuple of a list (of the first line(s) of the doctest) and the\n            line number of the start of the code block.\n        \"\"\"\n        return [f'#line {fileinput.filelineno() + 1} \"{self._infile}\"\\n'], fileinput.filelineno()\n\n    def _process_code_end(self, decl, code):\n        \"\"\"\n        Process the end of a fenced code block (` ``` `).\n\n        :param decl: the dictionary of the declaration parameters.\n        :param code: the list of lines of the doctest.\n        \"\"\"\n        outname = os.path.join(self._outdir, decl['name']).replace('\\\\', '/')\n        action = decl['test']\n        if self._dry:\n            print(f'{action} {outname}')\n        else:\n            with open(outname, 'w', encoding='utf8') as outfile:\n                outfile.writelines(code)\n\n    def process(self, infile):\n        \"\"\"\n        Find doctests in a Markdown file and process them according to the\n        constructor parameters.\n\n        :param infile: path to the input file.\n        \"\"\"\n        self._infile = infile\n        self._outname_base = os.path.splitext(os.path.basename(infile))[0]\n        self._outname_cnt = 1\n\n        mode = 'TEXT'\n        decl, decl_lineno = {}, 0\n        code, code_lineno = [], 0\n\n        for line in fileinput.input(infile):\n            decl_match = re.match(r'^\\[doctest\\]:\\s+#\\s+\\((.*)\\)\\s*$', line)\n            nl_match = re.match(r'^\\s*$', line)\n            start_match = re.match(r'^```c\\s*$', line)\n            end_match = re.match(r'^```\\s*', line)\n\n            if mode == 'TEXT':\n                if decl_match is not None:\n                    decl, decl_lineno = self._process_decl(decl_match.group(1))\n                    mode = 'NL'\n            elif mode == 'NL':\n                if decl_match is not None:\n                    self._warning('test without code block', decl_lineno)\n                    decl, decl_lineno = self._process_decl(decl_match.group(1))\n                elif start_match is not None:\n                    code, code_lineno = self._process_code_start()\n                    mode = 'CODE'\n                elif nl_match is None:\n                    self._warning('test without code block', decl_lineno)\n                    mode = 'TEXT'\n            elif mode == 'CODE':\n                if end_match is not None:\n                    self._process_code_end(decl, code)\n                    mode = 'TEXT'\n                else:\n                    code.append(line)\n\n        if mode == 'NL':\n            self._warning('test without code block', decl_lineno)\n        elif mode == 'CODE':\n            self._warning('unterminated code block', code_lineno)\n\n\ndef main():\n    parser = argparse.ArgumentParser(description='Markdown doctest extractor', epilog=\"\"\"\n        The tool extracts specially marked fenced C code blocks from the input Markdown files\n        and writes them to the file system. The annotations recognized by the tool are special\n        but valid Markdown links/comments that must be added before the fenced code blocks:\n        `[doctest]: # (name=\"test.c\", ...)`. For now, two parameters are valid:\n        `name` determines the filename for the extracted code block (overriding the default\n        auto-numbered naming scheme), and `test` determines the test action to be performed on\n        the extracted code (valid options are \"compile\", \"link\", and the default \"run\").\n        \"\"\")\n    parser.add_argument('-d', '--dir', metavar='NAME', default=os.getcwd(),\n                        help='output directory name (default: %(default)s)')\n    parser.add_argument('--dry', action='store_true',\n                        help='don\\'t generate files but print file names that would be generated '\n                             'and what test action to perform on them')\n    parser.add_argument('file', nargs='+',\n                        help='input Markdown file(s)')\n    args = parser.parse_args()\n\n    extractor = DoctestExtractor(args.dir, args.dry)\n    for mdfile in args.file:\n        extractor.process(mdfile)\n\n\nif __name__ == '__main__':\n    main()\n"
  },
  {
    "path": "tools/gen-strings.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ntry:\n    from configparser import ConfigParser\nexcept ImportError:\n    from ConfigParser import ConfigParser\n\nimport argparse\nimport fileinput\nimport json\nimport os\nimport re\nimport subprocess\nimport sys\n\nfrom settings import FORMAT_SCRIPT, PROJECT_DIR\nfrom gen_c_source import LICENSE\n\nMAGIC_STRINGS_INI = os.path.join(PROJECT_DIR, 'jerry-core', 'lit', 'lit-magic-strings.ini')\nMAGIC_STRINGS_INC_H = os.path.join(PROJECT_DIR, 'jerry-core', 'lit', 'lit-magic-strings.inc.h')\n\nECMA_ERRORS_INI = os.path.join(PROJECT_DIR, 'jerry-core', 'ecma', 'base', 'ecma-error-messages.ini')\nECMA_ERRORS_INC_H = os.path.join(PROJECT_DIR, 'jerry-core', 'ecma', 'base', 'ecma-error-messages.inc.h')\n\nPARSER_ERRORS_INI = os.path.join(PROJECT_DIR, 'jerry-core', 'parser', 'js', 'parser-error-messages.ini')\nPARSER_ERRORS_INC_H = os.path.join(PROJECT_DIR, 'jerry-core', 'parser', 'js', 'parser-error-messages.inc.h')\n\nLIMIT_MAGIC_STR_LENGTH = 255\n\n\ndef debug_dump(obj):\n    def deepcopy(obj):\n        if isinstance(obj, (list, tuple)):\n            return [deepcopy(e) for e in obj]\n        if isinstance(obj, set):\n            return [repr(e) for e in obj]\n        if isinstance(obj, dict):\n            return {repr(k): deepcopy(e) for k, e in obj.items()}\n        return obj\n\n    return json.dumps(deepcopy(obj), indent=4)\n\n\ndef read_magic_string_defs(debug, ini_path, item_name):\n    # Read the `jerry-core/lit/lit-magic-strings.ini` file and returns the magic\n    # string definitions found therein in the form of\n    #   [LIT_MAGIC_STRINGS]\n    #   LIT_MAGIC_STRING_xxx = \"vvv\"\n    #   ...\n    # as\n    #   [('LIT_MAGIC_STRING_xxx', 'vvv'), ...]\n    # sorted by length and alpha.\n    ini_parser = ConfigParser()\n    ini_parser.optionxform = str  # case sensitive options (magic string IDs)\n    ini_parser.read(ini_path)\n\n    defs = [(str_ref, json.loads(str_value) if str_value != '' else '')\n            for str_ref, str_value in ini_parser.items(item_name)]\n    defs = sorted(defs, key=lambda ref_value: (len(ref_value[1]), ref_value[1]))\n\n    if len(defs[-1][1]) > LIMIT_MAGIC_STR_LENGTH:\n        for str_ref, str_value in [x for x in defs if len(x[1]) > LIMIT_MAGIC_STR_LENGTH]:\n            print(f\"error: The maximum allowed magic string size is \"\n                  f\"{LIMIT_MAGIC_STR_LENGTH} but {str_ref} is {len(str_value)} long.\")\n        sys.exit(1)\n\n    if debug:\n        print(f'debug: magic string definitions: {debug_dump(defs)}')\n\n    return defs\n\n\ndef extract_magic_string_refs(debug, pattern, inc_h_filename):\n    results = {}\n\n    def process_line(fname, lnum, line, guard_stack, pattern):\n        # Build `results` dictionary as\n        #   results['LIT_MAGIC_STRING_xxx'][('!defined (CONFIG_DISABLE_yyy_BUILTIN)', ...)]\n        #       = [('zzz.c', 123), ...]\n        # meaning that the given literal is referenced under the given guards at\n        # the listed (file, line number) locations.\n        exception_list = [f'{pattern}_DEF',\n                          f'{pattern}_FIRST_STRING_WITH_SIZE',\n                          f'{pattern}_LENGTH_LIMIT',\n                          f'{pattern}__COUNT']\n\n        for str_ref in re.findall(f'{pattern}_[a-zA-Z0-9_]+', line):\n            if str_ref in exception_list:\n                continue\n\n            guard_set = set()\n            for guards in guard_stack:\n                guard_set.update(guards)\n\n            guard_tuple = tuple(sorted(guard_set))\n\n            if str_ref not in results:\n                results[str_ref] = {}\n            str_guards = results[str_ref]\n\n            if guard_tuple not in str_guards:\n                str_guards[guard_tuple] = []\n            file_list = str_guards[guard_tuple]\n\n            file_list.append((fname, lnum))\n\n    def process_guard(guard):\n        # Transform `#ifndef MACRO` to `#if !defined (MACRO)` and\n        # `#ifdef MACRO` to `#if defined (MACRO)` to enable or-ing/and-ing the\n        # conditions later on.\n        if guard.startswith('ndef '):\n            guard = guard.replace('ndef ', '!defined (', 1) + ')'\n        elif guard.startswith('def '):\n            guard = guard.replace('def ', 'defined (', 1) + ')'\n        return guard\n\n    def process_file(fname, pattern):\n        # Builds `guard_stack` list for each line of a file as\n        #   [['!defined (CONFIG_DISABLE_yyy_BUILTIN)', ...], ...]\n        # meaning that all the listed guards (conditionals) have to hold for the\n        # line to be kept by the preprocessor.\n        guard_stack = []\n\n        for line in fileinput.input(fname):\n            if_match = re.match('^ *# *if(.*)', line)\n            elif_match = re.match('^ *# *elif(.*)', line)\n            else_match = re.match('^ *# *else', line)\n            endif_match = re.match('^ *# *endif', line)\n            if if_match is not None:\n                guard_stack.append([process_guard(if_match.group(1))])\n            elif elif_match is not None:\n                guards = guard_stack[-1]\n                guards[-1] = f'!({guards[-1].strip()})'\n                guards.append(process_guard(elif_match.group(1)))\n            elif else_match is not None:\n                guards = guard_stack[-1]\n                guards[-1] = f'!({guards[-1].strip()})'\n            elif endif_match is not None:\n                guard_stack.pop()\n\n            lnum = fileinput.filelineno()\n            process_line(fname, lnum, line, guard_stack, pattern)\n\n        if guard_stack:\n            print(f'warning: {fname}: unbalanced preprocessor conditional '\n                  f'directives (analysis finished with no closing `#endif` '\n                  f'for {guard_stack})')\n\n    for root, _, files in os.walk(os.path.join(PROJECT_DIR, 'jerry-core')):\n        for fname in files:\n            if (fname.endswith('.c') or fname.endswith('.h')) \\\n                    and fname != inc_h_filename:\n                process_file(os.path.join(root, fname), pattern)\n\n    if debug:\n        print(f'debug: magic string references: {debug_dump(results)}')\n\n    return results\n\n\ndef calculate_magic_string_guards(defs, uses, debug=False):\n    extended_defs = []\n\n    for str_ref, str_value in defs:\n        if str_ref not in uses:\n            print(f'warning: unused magic string {str_ref}')\n            continue\n\n        # Calculate the most compact guard, i.e., if a magic string is\n        # referenced under various guards, keep the one that is more generic.\n        # E.g.,\n        # guard1 = A and B and C and D and E and F\n        # guard2 = A and B and C\n        # then guard1 or guard2 == guard2.\n        guards = [set(guard_tuple) for guard_tuple in sorted(uses[str_ref].keys())]\n        for i, guard_i in enumerate(guards):\n            if guard_i is None:\n                continue\n            for guard in guard_i.copy():\n                neg_guard = \"!(\" + guard[1:] + \")\"\n                for guard_j in guards:\n                    if guard_j is not None and neg_guard in guard_j:\n                        guard_i.remove(guard)\n            for j, guard_j in enumerate(guards):\n                if j == i or guard_j is None:\n                    continue\n                if guard_i < guard_j:\n                    guards[j] = None\n        guards = {tuple(sorted(guard)) for guard in guards if guard is not None}\n\n        extended_defs.append((str_ref, str_value, guards))\n\n    if debug:\n        print(f'debug: magic string definitions (with guards): {debug_dump(extended_defs)}')\n\n    return extended_defs\n\n\ndef guards_to_str(guards):\n    return ' \\\\\\n|| '.join(' && '.join(g.strip() for g in sorted(guard))\n                           for guard in sorted(guards))\n\n\ndef generate_header(gen_file, ini_path):\n    header = f\"\"\"{LICENSE}\n\n/* This file is automatically generated by the {os.path.basename(__file__)} script\n * from {os.path.basename(ini_path)}. Do not edit! */\n\"\"\"\n    print(header, file=gen_file)\n\n\ndef generate_magic_string_defs(gen_file, defs, def_macro):\n    last_guards = set([()])\n    for str_ref, str_value, guards in defs:\n        if last_guards != guards:\n            if () not in last_guards:\n                print(f'#endif /* {guards_to_str(last_guards)} */', file=gen_file)\n            if () not in guards:\n                print(f'#if {guards_to_str(guards)}', file=gen_file)\n\n        print(f'{def_macro} ({str_ref}, {json.dumps(str_value)})', file=gen_file)\n\n        last_guards = guards\n\n    if () not in last_guards:\n        print(f'#endif /* {guards_to_str(last_guards)} */', file=gen_file)\n\n\ndef generate_first_magic_strings(gen_file, defs, with_size_macro):\n    print(file=gen_file)  # empty line separator\n\n    max_size = len(defs[-1][1])\n    for size in range(max_size + 1):\n        last_guards = set([()])\n        for str_ref, str_value, guards in defs:\n            if len(str_value) >= size:\n                if () not in guards and () in last_guards:\n                    print(f'#if {guards_to_str(guards)}', file=gen_file)\n                elif () not in guards and () not in last_guards:\n                    if guards == last_guards:\n                        continue\n                    print(f'#elif {guards_to_str(guards)}', file=gen_file)\n                elif () in guards and () not in last_guards:\n                    print(f'#else /* !({guards_to_str(last_guards)}) */', file=gen_file)\n\n                print(f'{with_size_macro} ({size}, {str_ref})', file=gen_file)\n\n                if () in guards:\n                    break\n\n                last_guards = guards\n\n        if () not in last_guards:\n            print(f'#endif /* {guards_to_str(last_guards)} */', file=gen_file)\n\n\ndef generate_magic_strings(args, ini_path, item_name, pattern, inc_h_path, def_macro, with_size_macro=None):\n    defs = read_magic_string_defs(args.debug, ini_path, item_name)\n    uses = extract_magic_string_refs(args.debug, pattern, os.path.basename(inc_h_path))\n\n    extended_defs = calculate_magic_string_guards(defs, uses, debug=args.debug)\n\n    with open(inc_h_path, 'w', encoding='utf8') as gen_file:\n        generate_header(gen_file, ini_path)\n        generate_magic_string_defs(gen_file, extended_defs, def_macro)\n        if with_size_macro:\n            generate_first_magic_strings(gen_file, extended_defs, with_size_macro)\n\n\ndef main():\n    parser = argparse.ArgumentParser(description='lit-magic-strings.inc.h generator')\n    parser.add_argument('--debug', action='store_true', help='enable debug output')\n    args = parser.parse_args()\n\n    generate_magic_strings(args,\n                           MAGIC_STRINGS_INI,\n                           'LIT_MAGIC_STRINGS',\n                           'LIT_MAGIC_STRING',\n                           MAGIC_STRINGS_INC_H,\n                           'LIT_MAGIC_STRING_DEF',\n                           'LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE')\n\n    generate_magic_strings(args,\n                           ECMA_ERRORS_INI,\n                           'ECMA_ERROR_MESSAGES',\n                           'ECMA_ERR',\n                           ECMA_ERRORS_INC_H,\n                           'ECMA_ERROR_DEF')\n\n    generate_magic_strings(args,\n                           PARSER_ERRORS_INI,\n                           'PARSER_ERR_MSG',\n                           'PARSER_ERR',\n                           PARSER_ERRORS_INC_H,\n                           'PARSER_ERROR_DEF')\n\n    subprocess.call([FORMAT_SCRIPT, '--fix'])\n\n\nif __name__ == '__main__':\n    main()\n"
  },
  {
    "path": "tools/gen-test-math.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nmake -C tools/unit-tests build\ntools/unit-tests/gen-test-math >tests/unit-math/test-math.inc.h\nmake -C tools/unit-tests clean\n"
  },
  {
    "path": "tools/gen-unicode.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport csv\nimport itertools\nimport os\nimport re\nimport warnings\n\nfrom gen_c_source import LICENSE, format_code\nfrom settings import PROJECT_DIR\n\n\nUNICODE_DATA_FILE = 'UnicodeData.txt'\nSPECIAL_CASING_FILE = 'SpecialCasing.txt'\nDERIVED_PROPS_FILE = 'DerivedCoreProperties.txt'\nPROP_LIST_FILE = 'PropList.txt'\nCASE_FOLDING_FILE = 'CaseFolding.txt'\n\nRANGES_C_SOURCE = os.path.join(PROJECT_DIR, 'jerry-core/lit/lit-unicode-ranges.inc.h')\nRANGES_SUP_C_SOURCE = os.path.join(PROJECT_DIR, 'jerry-core/lit/lit-unicode-ranges-sup.inc.h')\nCONVERSIONS_C_SOURCE = os.path.join(PROJECT_DIR, 'jerry-core/lit/lit-unicode-conversions.inc.h')\nCONVERSIONS_SUP_C_SOURCE = os.path.join(PROJECT_DIR, 'jerry-core/lit/lit-unicode-conversions-sup.inc.h')\nFOLDING_C_SOURCE = os.path.join(PROJECT_DIR, 'jerry-core/lit/lit-unicode-folding.inc.h')\nFOLDING_SUP_C_SOURCE = os.path.join(PROJECT_DIR, 'jerry-core/lit/lit-unicode-folding-sup.inc.h')\n\nUNICODE_PLANE_TYPE_BASIC = 0\nUNICODE_PLANE_TYPE_SUPPLEMENTARY = 1\n\n# common code generation\n\nclass UnicodeBasicSource:\n    # pylint: disable=too-many-instance-attributes\n    def __init__(self, filepath, character_type=\"uint16_t\", length_type=\"uint8_t\"):\n        self._filepath = filepath\n        self._header = [LICENSE, \"\"]\n        self._data = []\n        self._table_name_suffix = \"\"\n        self.character_type = character_type\n        self.length_type = length_type\n\n        self._range_table_types = [self.character_type,\n                                   self.length_type,\n                                   self.character_type]\n        self._range_table_names = [\"interval_starts\",\n                                   \"interval_lengths\",\n                                   \"chars\"]\n        self._range_table_descriptions = [\"Character interval starting points for\",\n                                          \"Character interval lengths for\",\n                                          \"Non-interval characters for\"]\n\n        self._conversion_range_types = [self.character_type,\n                                        self.length_type]\n        self._conversion_range_names = [\"ranges\",\n                                        \"range_lengths\"]\n\n    def complete_header(self, completion):\n        self._header.append(completion)\n        self._header.append(\"\")  # for an extra empty line\n\n    def add_whitepace_range(self, category, categorizer, units):\n        self.add_range(category, categorizer.create_tables(units))\n\n    def add_range(self, category, tables):\n        idx = 0\n        for table in tables:\n            self.add_table(table,\n                           f\"/**\\n * {self._range_table_descriptions[idx]} {category}.\\n */\",\n                           self._range_table_types[idx],\n                           category,\n                           self._range_table_names[idx])\n            idx += 1\n\n    def add_conversion_range(self, category, tables, descriptions):\n        self.add_named_conversion_range(category, tables, self._conversion_range_names, descriptions)\n\n    def add_named_conversion_range(self, category, tables, table_names, descriptions):\n        idx = 0\n        for table in tables:\n            self.add_table(table,\n                           descriptions[idx],\n                           self._conversion_range_types[idx],\n                           category,\n                           table_names[idx])\n            idx += 1\n\n    def add_table(self, table, description, table_type, category, table_name):\n        if table and sum(table) != 0:\n            self._data.append(description)\n            self._data.append(f\"static const {table_type} lit_unicode_{category.lower()}\"\n                              f\"{'_' + table_name if table_name else ''}{self._table_name_suffix}\"\n                              f\"[] JERRY_ATTR_CONST_DATA =\")\n            self._data.append(\"{\")\n            self._data.append(format_code(table, 1, 6 if self._table_name_suffix else 4))\n            self._data.append(\"};\")\n            self._data.append(\"\")  # for an extra empty line\n\n    def generate(self):\n        with open(self._filepath, 'w', encoding='utf8') as generated_source:\n            generated_source.write(\"\\n\".join(self._header))\n            generated_source.write(\"\\n\".join(self._data))\n\n\nclass UnicodeSupplementarySource(UnicodeBasicSource):\n    def __init__(self, filepath):\n        UnicodeBasicSource.__init__(self, filepath, \"uint32_t\", \"uint16_t\")\n        self._table_name_suffix = \"_sup\"\n\n    def add_whitepace_range(self, category, categorizer, units):\n        self.add_range(category, categorizer.create_tables(units))\n\nclass UnicodeBasicCategorizer:\n    def __init__(self):\n        self._length_limit = 0xff\n        self.extra_id_continue_units = set([0x200C, 0x200D])\n\n    #pylint: disable=no-self-use\n    def in_range(self, i):\n        return 0x80 <= i < 0x10000\n\n    def _group_ranges(self, units):\n        \"\"\"\n        Convert an increasing list of integers into a range list\n        :return: List of ranges.\n        \"\"\"\n        for _, group in itertools.groupby(enumerate(units), lambda q: (q[1] - q[0])):\n            group = list(group)\n            yield group[0][1], group[-1][1]\n\n    def create_tables(self, units):\n        \"\"\"\n        Split list of ranges into intervals and single char lists.\n        :return: A tuple containing the following info:\n            - list of interval starting points\n            - list of interval lengths\n            - list of single chars\n        \"\"\"\n\n        interval_sps = []\n        interval_lengths = []\n        chars = []\n\n        for element in self._group_ranges(units):\n            interval_length = element[1] - element[0]\n            if interval_length == 0:\n                chars.append(element[0])\n            elif interval_length > self._length_limit:\n                for i in range(element[0], element[1], self._length_limit + 1):\n                    length = min(self._length_limit, element[1] - i)\n                    interval_sps.append(i)\n                    interval_lengths.append(length)\n            else:\n                interval_sps.append(element[0])\n                interval_lengths.append(interval_length)\n\n        return interval_sps, interval_lengths, chars\n\n    def read_units(self, file_path, categories, subcategories=None):\n        \"\"\"\n        Read the Unicode Derived Core Properties file and extract the ranges\n        for the given categories.\n\n        :param file_path: Path to the Unicode \"DerivedCoreProperties.txt\" file.\n        :param categories: A list of category strings to extract from the Unicode file.\n        :param subcategories: A list of subcategory strings to restrict categories.\n        :return: A dictionary each string from the :param categories: is a key and for each\n                key list of code points are stored.\n        \"\"\"\n        # Create a dictionary in the format: { category[0]: [ ], ..., category[N]: [ ] }\n        units = {}\n        for category in categories:\n            units[category] = []\n\n        # Formats to match:\n        #  <HEX>     ; <category> #\n        #  <HEX>..<HEX>     ; <category> # <subcategory>\n        matcher = r\"(?P<start>[\\dA-F]+)(?:\\.\\.(?P<end>[\\dA-F]+))?\\s+; (?P<category>[\\w]+) # (?P<subcategory>[\\w&]{2})\"\n\n        with open(file_path, \"r\", encoding='utf8') as src_file:\n            for line in src_file:\n                match = re.match(matcher, line)\n\n                if (match\n                        and match.group(\"category\") in categories\n                        and (not subcategories or match.group(\"subcategory\") in subcategories)):\n                    start = int(match.group(\"start\"), 16)\n                    # if no \"end\" found use the \"start\"\n                    end = int(match.group(\"end\") or match.group(\"start\"), 16)\n\n                    matching_code_points = [\n                        code_point for code_point in range(start, end + 1) if self.in_range(code_point)\n                    ]\n\n                    units[match.group(\"category\")].extend(matching_code_points)\n\n        return units\n\n    def read_case_mappings(self, unicode_data_file, special_casing_file):\n        \"\"\"\n        Read the corresponding unicode values of lower and upper case letters and store these in tables.\n\n        :param unicode_data_file: Contains the default case mappings (one-to-one mappings).\n        :param special_casing_file: Contains additional informative case mappings that are either not one-to-one\n                                    or which are context-sensitive.\n        :return: Upper and lower case mappings.\n        \"\"\"\n\n        lower_case_mapping = {}\n        upper_case_mapping = {}\n\n        # Add one-to-one mappings\n        with open(unicode_data_file, encoding='utf8') as unicode_data:\n            reader = csv.reader(unicode_data, delimiter=';')\n\n            for line in reader:\n                letter_id = int(line[0], 16)\n\n                if not self.in_range(letter_id):\n                    continue\n\n                capital_letter = line[12]\n                small_letter = line[13]\n\n                if capital_letter:\n                    upper_case_mapping[letter_id] = parse_unicode_sequence(capital_letter)\n\n                if small_letter:\n                    lower_case_mapping[letter_id] = parse_unicode_sequence(small_letter)\n\n        # Update the conversion tables with the special cases\n        with open(special_casing_file, encoding='utf8') as special_casing:\n            reader = csv.reader(special_casing, delimiter=';')\n\n            for line in reader:\n                # Skip comment sections and empty lines\n                if not line or line[0].startswith('#'):\n                    continue\n\n                # Replace '#' character with empty string\n                for idx, fragment in enumerate(line):\n                    if fragment.find('#') >= 0:\n                        line[idx] = ''\n\n                letter_id = int(line[0], 16)\n                condition_list = line[4]\n\n                if not self.in_range(letter_id) or condition_list:\n                    continue\n\n                original_letter = parse_unicode_sequence(line[0])\n                small_letter = parse_unicode_sequence(line[1])\n                capital_letter = parse_unicode_sequence(line[3])\n\n                if small_letter != original_letter:\n                    lower_case_mapping[letter_id] = small_letter\n                if capital_letter != original_letter:\n                    upper_case_mapping[letter_id] = capital_letter\n\n        return lower_case_mapping, upper_case_mapping\n\nclass UnicodeSupplementaryCategorizer(UnicodeBasicCategorizer):\n    def __init__(self):\n        UnicodeBasicCategorizer.__init__(self)\n        self._length_limit = 0xffff\n        self.extra_id_continue_units = set()\n\n    def in_range(self, i):\n        return i >= 0x10000\n\ndef generate_ranges(script_args, plane_type):\n    if plane_type == UNICODE_PLANE_TYPE_SUPPLEMENTARY:\n        c_source = UnicodeSupplementarySource(RANGES_SUP_C_SOURCE)\n        categorizer = UnicodeSupplementaryCategorizer()\n    else:\n        c_source = UnicodeBasicSource(RANGES_C_SOURCE)\n        categorizer = UnicodeBasicCategorizer()\n\n    header_completion = [f\"/* This file is automatically generated by the {os.path.basename(__file__)} script\",\n                         f\" * from {DERIVED_PROPS_FILE}. Do not edit! */\",\n                         \"\"]\n\n    c_source.complete_header(\"\\n\".join(header_completion))\n\n    derived_props_path = os.path.join(script_args.unicode_dir, DERIVED_PROPS_FILE)\n    units = categorizer.read_units(derived_props_path, [\"ID_Start\", \"ID_Continue\"])\n\n    units[\"ID_Continue\"] = sorted(set(units[\"ID_Continue\"]).union(categorizer.extra_id_continue_units)\n                                  - set(units[\"ID_Start\"]))\n\n    for category, unit in units.items():\n        c_source.add_range(category, categorizer.create_tables(unit))\n\n    prop_list_path = os.path.join(script_args.unicode_dir, PROP_LIST_FILE)\n\n    white_space_units = categorizer.read_units(prop_list_path, [\"White_Space\"], [\"Zs\"])[\"White_Space\"]\n\n    c_source.add_whitepace_range(\"White_Space\", categorizer, white_space_units)\n\n    c_source.generate()\n\n\n# functions for unicode conversions\n\ndef make_char(hex_val):\n    \"\"\"\n    Create a unicode character from a hex value\n\n    :param hex_val: Hex value of the character.\n    :return: Unicode character corresponding to the value.\n    \"\"\"\n\n    try:\n        return unichr(hex_val)\n    except NameError:\n        return chr(hex_val)\n\n\ndef parse_unicode_sequence(raw_data):\n    \"\"\"\n    Parse unicode sequence from raw data.\n\n    :param raw_data: Contains the unicode sequence which needs to parse.\n    :return: The parsed unicode sequence.\n    \"\"\"\n\n    result = ''\n\n    for unicode_char in raw_data.split(' '):\n        if unicode_char == '':\n            continue\n\n        # Convert it to unicode code point (from hex value without 0x prefix)\n        hex_val = int(unicode_char, 16)\n        result += make_char(hex_val)\n\n    return result\n\ndef extract_ranges(letter_case, reverse_letter_case=None):\n    \"\"\"\n    Extract ranges from case mappings\n    (the second param is optional, if it's not empty, a range will contains bidirectional conversions only).\n\n    :param letter_id: An integer, representing the unicode code point of the character.\n    :param letter_case: case mappings dictionary which contains the conversions.\n    :param reverse_letter_case: Comparable case mapping table which contains the return direction of the conversion.\n    :return: A table with the start points and their mapped value, and another table with the lengths of the ranges.\n    \"\"\"\n\n    in_range = False\n    range_position = -1\n    ranges = []\n    range_lengths = []\n\n    for letter_id in sorted(letter_case.keys()):\n        prev_letter_id = letter_id - 1\n\n        # One-way conversions\n        if reverse_letter_case is None:\n            if len(letter_case[letter_id]) > 1:\n                in_range = False\n                continue\n\n            if prev_letter_id not in letter_case or len(letter_case[prev_letter_id]) > 1:\n                in_range = False\n                continue\n\n        # Two way conversions\n        else:\n            if not is_bidirectional_conversion(letter_id, letter_case, reverse_letter_case):\n                in_range = False\n                continue\n\n            if not is_bidirectional_conversion(prev_letter_id, letter_case, reverse_letter_case):\n                in_range = False\n                continue\n\n        conv_distance = calculate_conversion_distance(letter_case, letter_id)\n        prev_conv_distance = calculate_conversion_distance(letter_case, prev_letter_id)\n\n        if conv_distance != prev_conv_distance:\n            in_range = False\n            continue\n\n        if in_range:\n            range_lengths[range_position] += 1\n        else:\n            in_range = True\n            range_position += 1\n\n            # Add the start point of the range and its mapped value\n            ranges.extend([prev_letter_id, ord(letter_case[prev_letter_id])])\n            range_lengths.append(2)\n\n    # Remove all ranges from the case mapping table.\n    for idx in range(0, len(ranges), 2):\n        range_length = range_lengths[idx // 2]\n\n        for incr in range(range_length):\n            del letter_case[ranges[idx] + incr]\n            if reverse_letter_case is not None:\n                del reverse_letter_case[ranges[idx + 1] + incr]\n\n    return ranges, range_lengths\n\n\ndef extract_character_pair_ranges(letter_case, reverse_letter_case):\n    \"\"\"\n    Extract two or more character pairs from the case mapping tables.\n\n    :param letter_case: case mappings dictionary which contains the conversions.\n    :param reverse_letter_case: Comparable case mapping table which contains the return direction of the conversion.\n    :return: A table with the start points, and another table with the lengths of the ranges.\n    \"\"\"\n\n    start_points = []\n    lengths = []\n    in_range = False\n    element_counter = -1\n\n    for letter_id in sorted(letter_case.keys()):\n        # Only extract character pairs\n        if not is_bidirectional_conversion(letter_id, letter_case, reverse_letter_case):\n            in_range = False\n            continue\n\n        if ord(letter_case[letter_id]) == letter_id + 1:\n            prev_letter_id = letter_id - 2\n\n            if not is_bidirectional_conversion(prev_letter_id, letter_case, reverse_letter_case):\n                in_range = False\n\n            if in_range:\n                lengths[element_counter] += 2\n            else:\n                element_counter += 1\n                start_points.append(letter_id)\n                lengths.append(2)\n                in_range = True\n\n        else:\n            in_range = False\n\n    # Remove all found case mapping from the conversion tables after the scanning method\n    for idx, letter_id in enumerate(start_points):\n        conv_length = lengths[idx]\n\n        for incr in range(0, conv_length, 2):\n            del letter_case[letter_id + incr]\n            del reverse_letter_case[letter_id + 1 + incr]\n\n    return start_points, lengths\n\n\ndef extract_character_pairs(letter_case, reverse_letter_case):\n    \"\"\"\n    Extract character pairs. Check that two unicode value are also a mapping value of each other.\n\n    :param letter_case: case mappings dictionary which contains the conversions.\n    :param reverse_letter_case: Comparable case mapping table which contains the return direction of the conversion.\n    :return: A table with character pairs.\n    \"\"\"\n\n    character_pairs = []\n\n    for letter_id in sorted(letter_case.keys()):\n        if is_bidirectional_conversion(letter_id, letter_case, reverse_letter_case):\n            mapped_value = letter_case[letter_id]\n            character_pairs.extend([letter_id, ord(mapped_value)])\n\n            # Remove character pairs from case mapping tables\n            del letter_case[letter_id]\n            del reverse_letter_case[ord(mapped_value)]\n\n    return character_pairs\n\n\ndef extract_special_ranges(letter_case):\n    \"\"\"\n    Extract special ranges. It contains start points of one-to-two letter case ranges\n    where the second character is always the same.\n\n    :param letter_case: case mappings dictionary which contains the conversions.\n\n    :return: A table with the start points and their mapped values, and a table with the lengths of the ranges.\n    \"\"\"\n\n    special_ranges = []\n    special_range_lengths = []\n\n    range_position = -1\n\n    for letter_id in sorted(letter_case.keys()):\n        mapped_value = letter_case[letter_id]\n\n        if len(mapped_value) != 2:\n            continue\n\n        prev_letter_id = letter_id - 1\n\n        if prev_letter_id not in letter_case:\n            in_range = False\n            continue\n\n        prev_mapped_value = letter_case[prev_letter_id]\n\n        if len(prev_mapped_value) != 2:\n            continue\n\n        if prev_mapped_value[1] != mapped_value[1]:\n            continue\n\n        if (ord(prev_mapped_value[0]) - prev_letter_id) != (ord(mapped_value[0]) - letter_id):\n            in_range = False\n            continue\n\n        if in_range:\n            special_range_lengths[range_position] += 1\n        else:\n            range_position += 1\n            in_range = True\n\n            special_ranges.extend([prev_letter_id, ord(prev_mapped_value[0]), ord(prev_mapped_value[1])])\n            special_range_lengths.append(1)\n\n    # Remove special ranges from the conversion table\n    for idx in range(0, len(special_ranges), 3):\n        range_length = special_range_lengths[idx // 3]\n        letter_id = special_ranges[idx]\n\n        for incr in range(range_length):\n            del letter_case[special_ranges[idx] + incr]\n\n    return special_ranges, special_range_lengths\n\n\ndef extract_conversions(letter_case):\n    \"\"\"\n    Extract conversions. It provide the full (or remained) case mappings from the table.\n    The counter table contains the information of how much one-to-one, one-to-two or one-to-three mappings\n    exists successively in the conversion table.\n\n    :return: A table with conversions, and a table with counters.\n    \"\"\"\n\n    unicodes = [[], [], []]\n    unicode_lengths = [0, 0, 0]\n\n    # 1 to 1 byte\n    for letter_id in sorted(letter_case.keys()):\n        mapped_value = letter_case[letter_id]\n\n        if len(mapped_value) != 1:\n            continue\n\n        unicodes[0].extend([letter_id, ord(mapped_value)])\n        del letter_case[letter_id]\n\n    # 1 to 2 bytes\n    for letter_id in sorted(letter_case.keys()):\n        mapped_value = letter_case[letter_id]\n\n        if len(mapped_value) != 2:\n            continue\n\n        unicodes[1].extend([letter_id, ord(mapped_value[0]), ord(mapped_value[1])])\n        del letter_case[letter_id]\n\n    # 1 to 3 bytes\n    for letter_id in sorted(letter_case.keys()):\n        mapped_value = letter_case[letter_id]\n\n        if len(mapped_value) != 3:\n            continue\n\n        unicodes[2].extend([letter_id, ord(mapped_value[0]), ord(mapped_value[1]), ord(mapped_value[2])])\n        del letter_case[letter_id]\n\n    unicode_lengths = [int(len(unicodes[0]) / 2), int(len(unicodes[1]) / 3), int(len(unicodes[2]) / 4)]\n\n    return list(itertools.chain.from_iterable(unicodes)), unicode_lengths\n\n\ndef is_bidirectional_conversion(letter_id, letter_case, reverse_letter_case):\n    \"\"\"\n    Check that two unicode value are also a mapping value of each other.\n\n    :param letter_id: An integer, representing the unicode code point of the character.\n    :param other_case_mapping: Comparable case mapping table which possible contains\n                               the return direction of the conversion.\n    :return: True, if it's a reverible conversion, false otherwise.\n    \"\"\"\n\n    if letter_id not in letter_case:\n        return False\n\n    # Check one-to-one mapping\n    mapped_value = letter_case[letter_id]\n    if len(mapped_value) > 1:\n        return False\n\n    # Check two way conversions\n    mapped_value_id = ord(mapped_value)\n\n    if mapped_value_id not in reverse_letter_case or len(reverse_letter_case[mapped_value_id]) > 1:\n        return False\n\n    if ord(reverse_letter_case[mapped_value_id]) != letter_id:\n        return False\n\n    return True\n\n\ndef calculate_conversion_distance(letter_case, letter_id):\n    \"\"\"\n    Calculate the distance between the unicode character and its mapped value\n    (only needs and works with one-to-one mappings).\n\n    :param letter_case: case mappings dictionary which contains the conversions.\n    :param letter_id: An integer, representing the unicode code point of the character.\n    :return: The conversion distance.\n    \"\"\"\n\n    if letter_id not in letter_case or len(letter_case[letter_id]) > 1:\n        return None\n\n    return ord(letter_case[letter_id]) - letter_id\n\n\ndef generate_conversions(script_args, plane_type):\n    if plane_type == UNICODE_PLANE_TYPE_SUPPLEMENTARY:\n        c_source = UnicodeSupplementarySource(CONVERSIONS_SUP_C_SOURCE)\n        categorizer = UnicodeSupplementaryCategorizer()\n    else:\n        c_source = UnicodeBasicSource(CONVERSIONS_C_SOURCE)\n        categorizer = UnicodeBasicCategorizer()\n\n    header_completion = [f\"/* This file is automatically generated by the {os.path.basename(__file__)} script\",\n                         f\" * from {UNICODE_DATA_FILE} and {SPECIAL_CASING_FILE} files. Do not edit! */\",\n                         \"\"]\n\n    c_source.complete_header(\"\\n\".join(header_completion))\n\n    unicode_data_path = os.path.join(script_args.unicode_dir, UNICODE_DATA_FILE)\n    special_casing_path = os.path.join(script_args.unicode_dir, SPECIAL_CASING_FILE)\n\n    # Read the corresponding unicode values of lower and upper case letters and store these in tables\n    lower_case, upper_case = categorizer.read_case_mappings(unicode_data_path, special_casing_path)\n\n    c_source.add_conversion_range(\"character_case\",\n                                  extract_ranges(lower_case, upper_case),\n                                  [(\"/* Contains start points of character case ranges \"\n                                    \"(these are bidirectional conversions). */\"),\n                                   \"/* Interval lengths of start points in `character_case_ranges` table. */\"])\n    c_source.add_conversion_range(\"character_pair\",\n                                  extract_character_pair_ranges(lower_case, upper_case),\n                                  [\"/* Contains the start points of bidirectional conversion ranges. */\",\n                                   \"/* Interval lengths of start points in `character_pair_ranges` table. */\"])\n\n    c_source.add_table(extract_character_pairs(lower_case, upper_case),\n                       \"/* Contains lower/upper case bidirectional conversion pairs. */\",\n                       c_source.character_type,\n                       \"character_pairs\",\n                       \"\")\n\n    c_source.add_conversion_range(\"upper_case_special\",\n                                  extract_special_ranges(upper_case),\n                                  [(\"/* Contains start points of one-to-two uppercase ranges where the \"\n                                    \"second character\\n\"\n                                    \" * is always the same.\\n\"\n                                    \" */\"),\n                                   \"/* Interval lengths for start points in `upper_case_special_ranges` table. */\"])\n\n    c_source.add_conversion_range(\"lower_case\",\n                                  extract_ranges(lower_case),\n                                  [\"/* Contains start points of lowercase ranges. */\",\n                                   \"/* Interval lengths for start points in `lower_case_ranges` table. */\"])\n\n    c_source.add_named_conversion_range(\"lower_case\",\n                                        extract_conversions(lower_case),\n                                        [\"conversions\", \"conversion_counters\"],\n                                        [(\"/* The remaining lowercase conversions. The lowercase variant can \"\n                                          \"be one-to-three character long. */\"),\n                                         (\"/* Number of one-to-one, one-to-two, and one-to-three lowercase \"\n                                          \"conversions. */\")])\n\n    c_source.add_named_conversion_range(\"upper_case\",\n                                        extract_conversions(upper_case),\n                                        [\"conversions\", \"conversion_counters\"],\n                                        [(\"/* The remaining uppercase conversions. The uppercase variant can \"\n                                          \"be one-to-three character long. */\"),\n                                         (\"/* Number of one-to-one, one-to-two, and one-to-three uppercase \"\n                                          \"conversions. */\")])\n\n    if lower_case:\n        warnings.warn('Not all elements extracted from the lowercase table!')\n    if upper_case:\n        warnings.warn('Not all elements extracted from the uppercase table!')\n\n    c_source.generate()\n\n\ndef generate_folding(script_args, plane_type):\n    if plane_type == UNICODE_PLANE_TYPE_SUPPLEMENTARY:\n        c_source = UnicodeSupplementarySource(FOLDING_SUP_C_SOURCE)\n        categorizer = UnicodeSupplementaryCategorizer()\n    else:\n        c_source = UnicodeBasicSource(FOLDING_C_SOURCE)\n        categorizer = UnicodeBasicCategorizer()\n\n    header_completion = [f\"/* This file is automatically generated by the {os.path.basename(__file__)} script\",\n                         f\" * from the {CASE_FOLDING_FILE} file. Do not edit! */\",\n                         \"\"]\n\n    c_source.complete_header(\"\\n\".join(header_completion))\n\n    unicode_data_path = os.path.join(script_args.unicode_dir, UNICODE_DATA_FILE)\n    special_casing_path = os.path.join(script_args.unicode_dir, SPECIAL_CASING_FILE)\n    case_folding_path = os.path.join(script_args.unicode_dir, CASE_FOLDING_FILE)\n\n    # Read the corresponding unicode values of lower and upper case letters and store these in tables\n    lower_case, upper_case = categorizer.read_case_mappings(unicode_data_path, special_casing_path)\n\n    folding = {}\n\n    with open(case_folding_path, 'r', encoding='utf8') as case_folding:\n        case_folding_re = re.compile(r'(?P<code_point>[^;]*);\\s*(?P<type>[^;]*);\\s*(?P<folding>[^;]*);')\n        for line in case_folding:\n            match = case_folding_re.match(line)\n            if match and match.group('type') in ('S', 'C'):\n                code_point = int(match.group('code_point'), 16)\n\n                if categorizer.in_range(code_point):\n                    folding[code_point] = parse_unicode_sequence(match.group('folding'))\n\n    should_to_upper = []\n    should_skip_to_lower = []\n\n    for code_point in lower_case:\n        if code_point not in folding:\n            should_skip_to_lower.append(code_point)\n\n    for code_point, folded in folding.items():\n        if lower_case.get(code_point, make_char(code_point)) != folded:\n            should_to_upper.append(code_point)\n\n            if upper_case.get(code_point, '') == folded:\n                should_skip_to_lower.append(code_point)\n\n    c_source.add_range('folding_skip_to_lower', categorizer.create_tables(should_skip_to_lower))\n    c_source.add_range('folding_to_upper', categorizer.create_tables(should_to_upper))\n\n    c_source.generate()\n\n\n# entry point\n\n\ndef main():\n    parser = argparse.ArgumentParser(description='lit-unicode-{conversions,ranges}-{sup}.inc.h generator',\n                                     epilog='''\n                                        The input data must be retrieved from\n                                        http://www.unicode.org/Public/<VERSION>/ucd/UCD.zip.\n                                        The last known good version is 13.0.0.\n                                        ''')\n    def check_dir(path):\n        if not os.path.isdir(path) or not os.access(path, os.R_OK):\n            raise argparse.ArgumentTypeError(f'The {path} directory does not exist or is not readable!')\n        return path\n\n    parser.add_argument('--unicode-dir', metavar='DIR', action='store', required=True,\n                        type=check_dir, help='specify the unicode data directory')\n\n    script_args = parser.parse_args()\n\n    generate_ranges(script_args, UNICODE_PLANE_TYPE_BASIC)\n    generate_ranges(script_args, UNICODE_PLANE_TYPE_SUPPLEMENTARY)\n    generate_conversions(script_args, UNICODE_PLANE_TYPE_BASIC)\n    generate_conversions(script_args, UNICODE_PLANE_TYPE_SUPPLEMENTARY)\n    generate_folding(script_args, UNICODE_PLANE_TYPE_BASIC)\n    # There are currently no code points in the supplementary planes that require special folding\n    # generate_folding(script_args, UNICODE_PLANE_TYPE_SUPPLEMENTARY)\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "tools/gen_c_source.py",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\nLICENSE = \"\"\"/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\"\"\"\n\n\ndef format_code(code, indent, digit_number=4):\n    def regroup(list_to_group, num):\n        return [list_to_group[i:i+num] for i in range(0, len(list_to_group), num)]\n\n    def hex_format(char, padding):\n        if isinstance(char, str):\n            char = ord(char)\n\n        return f\"{char:#0{padding + 2}x}\"\n\n    lines = []\n\n    nums_per_line = 10\n    width = nums_per_line * (digit_number + 4)\n    # convert all characters to hex format\n    converted_code = [hex_format(char, digit_number) for char in code]\n    # 10 hex number per line\n    for line in regroup(\", \".join(converted_code), width):\n        lines.append(('  ' * indent) + line.strip())\n    return \"\\n\".join(lines)\n"
  },
  {
    "path": "tools/heaplimit_measure.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport json\nimport os\nimport subprocess\nimport sys\n\nTOOLS_PATH = os.path.dirname(os.path.realpath(__file__))\nBASE_PATH = os.path.join(TOOLS_PATH, '..')\n\nFLAG_CLEAN = '--clean'\nFLAG_DEBUG = '--debug'\nFLAG_HEAPLIMIT = '--mem-heap'\nJERRY_BUILDER = os.path.join(BASE_PATH, 'tools', 'build.py')\nJERRY_BIN = os.path.join(BASE_PATH, 'build', 'bin', 'jerry')\nTEST_DIR = os.path.join(BASE_PATH, 'tests')\n\n\ndef get_args():\n    \"\"\" Parse input arguments. \"\"\"\n    desc = 'Finds the smallest possible JerryHeap size without failing to run the given js file'\n    parser = argparse.ArgumentParser(description=desc)\n    parser.add_argument('testfile')\n    parser.add_argument('--heapsize', type=int, default=512,\n                        help='set the limit of the first heapsize (default: %(default)d)')\n    parser.add_argument('--buildtype', choices=['release', 'debug'], default='release',\n                        help='select build type (default: %(default)s)')\n\n    script_args = parser.parse_args()\n\n    return script_args\n\n\ndef check_files(opts):\n    files = [JERRY_BUILDER, opts.testfile]\n    for _file in files:\n        if not os.path.isfile(_file):\n            sys.exit(f\"File not found: {_file}\")\n\n\ndef build_bin(heapsize, opts):\n    \"\"\" Run tools/build.py script \"\"\"\n    command = [\n        JERRY_BUILDER,\n        FLAG_CLEAN,\n        FLAG_HEAPLIMIT,\n        str(heapsize)\n    ]\n\n    if opts.buildtype == 'debug':\n        command.append(FLAG_DEBUG)\n\n    print(f\"Building JerryScript with: {' '.join(command)}\")\n    subprocess.check_output(command)\n\n\ndef run_test(opts):\n    \"\"\" Run the testfile to get the exitcode. \"\"\"\n    try:\n        testfile = os.path.abspath(opts.testfile)\n        run_cmd = [JERRY_BIN, testfile]\n        # check output will raise an error if the exit code is not 0\n        subprocess.check_output(run_cmd, cwd=TEST_DIR)\n    except subprocess.CalledProcessError as err:\n        return err.returncode\n\n    return 0\n\n\ndef heap_limit(opts):\n    \"\"\" Find the minimal size of jerryheap to pass \"\"\"\n    goodheap = opts.heapsize\n    lowheap = 0\n    hiheap = opts.heapsize\n\n    while lowheap < hiheap:\n        build_bin(hiheap, opts)\n        assert os.path.isfile(JERRY_BIN), 'Jerry binary file does not exists'\n\n        exitcode = run_test(opts)\n        if exitcode != 0:\n            lowheap = hiheap\n            hiheap = (lowheap + goodheap) // 2\n        else:\n            goodheap = hiheap\n            hiheap = (lowheap + hiheap) // 2\n\n    return {\n        'testfile': opts.testfile,\n        'heaplimit to pass': goodheap\n    }\n\n\ndef main(options):\n    check_files(options)\n    result = heap_limit(options)\n    print(json.dumps(result, indent=4))\n\n\nif __name__ == \"__main__\":\n    main(get_args())\n"
  },
  {
    "path": "tools/js2c.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#  This file converts ./js/*.js to a C-array in ./source/jerry-targetjs.h file\n\nimport argparse\nimport glob\nimport os\nimport re\n\nfrom gen_c_source import LICENSE, format_code\n\n\nHEADER = '''#ifndef JERRY_TARGETJS_H\n#define JERRY_TARGETJS_H\n'''\n\nFOOTER = '''\n#endif\n'''\n\nNATIVE_STRUCT = '''\nstruct js_source_all {\n  const char* name;\n  const char* source;\n  const int length;\n};\n\n#define DECLARE_JS_CODES \\\\\nstruct js_source_all js_codes[] = \\\\\n{ \\\\'''\n\n\ndef extract_name(path):\n    special_chars = re.compile(r'[-\\\\?\\'\".]')\n    return special_chars.sub('_', os.path.splitext(os.path.basename(path))[0])\n\n\ndef reduce_code(code):\n    code = re.sub(r\"/\\*.*?\\*/\", \"\", code, flags=re.DOTALL)  # remove all occurance streamed comments\n    code = re.sub(r\"//.*?\\n\", \"\", code)  # remove all occurance singleline comments\n    code = re.sub('\\n+', '\\n', re.sub('\\n +', '\\n', code))  # remove white spaces\n    return code\n\n\ndef js_to_native_code(path, name, build_type):\n    with open(path, 'r', encoding='utf8') as js_source:\n        code = js_source.read()\n\n    if build_type != 'debug':\n        code = reduce_code(code)\n\n    data = format_code(code, 1, 2)\n\n    native_code = f\"\"\"const static char {name}_n[] = \"{name}\";\nconst static char {name}_s[] =\n{{\n{data}\n}};\nconst static int {name}_l = {len(code)};\n\"\"\"\n\n    return native_code\n\n\ndef main():\n    parser = argparse.ArgumentParser(description=\"js2c\")\n    parser.add_argument('--build-type', help='build type', default='release', choices=['release', 'debug'])\n    parser.add_argument('--ignore', help='files to ignore', dest='ignore_files', default=[], action='append')\n    parser.add_argument('--no-main',\n                        help=\"don't require a 'main.js' file\",\n                        dest='main',\n                        action='store_false',\n                        default=True)\n    parser.add_argument('--js-source',\n                        dest='js_source_path',\n                        default='./js',\n                        help='Source directory of JavaScript files\" (default: %(default)s)')\n    parser.add_argument('--dest',\n                        dest='output_path',\n                        default='./source',\n                        help=\"Destination directory of 'jerry-targetjs.h' (default: %(default)s)\")\n\n    script_args = parser.parse_args()\n\n    gen_line = f\"/* This file is generated by {os.path.basename(__file__)}. Please do not modify. */\"\n\n    gen_output = [LICENSE, \"\", gen_line, \"\", HEADER]\n    gen_structs = [NATIVE_STRUCT]\n\n    if script_args.main:\n        gen_structs.append('  { main_n, main_s, main_l }, \\\\')\n\n    files = glob.glob(os.path.join(script_args.js_source_path, '*.js'))\n\n    for path in files:\n        if os.path.basename(path) not in script_args.ignore_files:\n            name = extract_name(path)\n            gen_output.append(js_to_native_code(path, name, script_args.build_type))\n            if name != 'main':\n                gen_structs.append(f'  {{ {name}_n, {name}_s, {name}_l }}, \\\\')\n\n    gen_structs.append('  { NULL, NULL, 0 } \\\\\\n};')\n\n    gen_output.append(\"\\n\".join(gen_structs))\n    gen_output.append(FOOTER)\n\n    with open(os.path.join(script_args.output_path, 'jerry-targetjs.h'), 'w', encoding='utf8') as gen_file:\n        gen_file.write(\"\\n\".join(gen_output))\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "tools/mem-stats-measure.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nJERRY=$1\nTEST=$2\n\nMEM_PEAK=`$JERRY $TEST --mem-stats | grep \"Peak allocated =\" | awk '{print $4}'`\n\necho $MEM_PEAK\n"
  },
  {
    "path": "tools/perf.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nITERS=\"$1\"\nENGINE=\"$2\"\nBENCHMARK=\"$3\"\nPRINT_MIN=\"$4\"\nOS=`uname -s | tr [:upper:] [:lower:]`\n\nif [ \"$OS\" == \"darwin\" ]\nthen\n  time_regexp='s/user[ \t]*\\([0-9]*\\)m\\([0-9.]*\\)s/\\1 \\2/g'\nelse\n  time_regexp='s/user[ \\t]*\\([0-9]*\\)m\\([0-9.]*\\)s/\\1 \\2/g'\nfi\n\nperf_values=$( (( for i in `seq 1 1 $ITERS`; do time $ENGINE \"$BENCHMARK\"; if [ $? -ne 0 ]; then exit 1; fi; done ) 2>&1 ) | \\\n               grep user | \\\n               sed \"$time_regexp\" | \\\n               awk '{ print ($1 * 60 + $2); }';\n               if [ ${PIPESTATUS[0]} -ne 0 ]; then exit 1; fi; );\n\nif [ \"$PRINT_MIN\" == \"-min\" ]\nthen\n  perf_values=$( echo \"$perf_values\" | \\\n                 awk \"BEGIN {\n                        min_v = -1;\n                      }\n                      {\n                        if (min_v == -1 || $1 < min_v) {\n                          min_v = $1;\n                        }\n                      }\n                      END {\n                        print min_v\n                      }\" || exit 1;\n               );\n  calc_status=$?\nelse\n  perf_values=$( echo \"$perf_values\" | \\\n                 awk \"BEGIN {\n                        n = 0\n                      }\n                      {\n                        n++\n                        a[n] = \\$1\n                      }\n                      END {\n                        #\n                        # Values of 99% quantiles of two-sided t-distribution for given number of degrees of freedom\n                        #\n                        t_gamma_n_m1 [1]  = 63.657\n                        t_gamma_n_m1 [2]  = 9.9248\n                        t_gamma_n_m1 [3]  = 5.8409\n                        t_gamma_n_m1 [4]  = 4.6041\n                        t_gamma_n_m1 [5]  = 4.0321\n                        t_gamma_n_m1 [6]  = 3.7074\n                        t_gamma_n_m1 [7]  = 3.4995\n                        t_gamma_n_m1 [8]  = 3.3554\n                        t_gamma_n_m1 [9]  = 3.2498\n                        t_gamma_n_m1 [10] = 3.1693\n                        t_gamma_n_m1 [11] = 3.1058\n                        t_gamma_n_m1 [12] = 3.0545\n                        t_gamma_n_m1 [13] = 3.0123\n                        t_gamma_n_m1 [14] = 2.9768\n                        t_gamma_n_m1 [15] = 2.9467\n                        t_gamma_n_m1 [16] = 2.9208\n                        t_gamma_n_m1 [17] = 2.8982\n                        t_gamma_n_m1 [18] = 2.8784\n                        t_gamma_n_m1 [19] = 2.8609\n                        t_gamma_n_m1 [20] = 2.8453\n                        t_gamma_n_m1 [21] = 2.8314\n                        t_gamma_n_m1 [22] = 2.8188\n                        t_gamma_n_m1 [23] = 2.8073\n                        t_gamma_n_m1 [24] = 2.7969\n                        t_gamma_n_m1 [25] = 2.7874\n                        t_gamma_n_m1 [26] = 2.7787\n                        t_gamma_n_m1 [27] = 2.7707\n                        t_gamma_n_m1 [28] = 2.7633\n                        t_gamma_n_m1 [29] = 2.7564\n                        t_gamma_n_m1 [30] = 2.75\n                        t_gamma_n_m1 [31] = 2.744\n                        t_gamma_n_m1 [32] = 2.7385\n                        t_gamma_n_m1 [33] = 2.7333\n                        t_gamma_n_m1 [34] = 2.7284\n                        t_gamma_n_m1 [35] = 2.7238\n                        t_gamma_n_m1 [36] = 2.7195\n                        t_gamma_n_m1 [37] = 2.7154\n                        t_gamma_n_m1 [38] = 2.7116\n                        t_gamma_n_m1 [39] = 2.7079\n                        t_gamma_n_m1 [40] = 2.7045\n                        t_gamma_n_m1 [41] = 2.7012\n                        t_gamma_n_m1 [42] = 2.6981\n                        t_gamma_n_m1 [43] = 2.6951\n                        t_gamma_n_m1 [44] = 2.6923\n                        t_gamma_n_m1 [45] = 2.6896\n                        t_gamma_n_m1 [46] = 2.687\n                        t_gamma_n_m1 [47] = 2.6846\n                        t_gamma_n_m1 [48] = 2.6822\n                        t_gamma_n_m1 [49] = 2.68\n                        t_gamma_n_m1 [50] = 2.6778\n\n                        #\n                        # Sort array of measurements\n                        #\n                        for (i = 2; i <= n; i++) {\n                          j = i\n                          k = a [j]\n                          while (j > 1 && a [j - 1] > k) {\n                            a [j] = a [j - 1]\n                            j--\n                          }\n                          a [j] = k\n                        }\n\n                        #\n                        # Remove 20% of lowest and 20% of highest values\n                        #\n                        n_20_percent = int (n / 5)\n\n                        for (i = 1; i <= n_20_percent; i++) {\n                          delete a[n]\n                          n--\n                        }\n\n                        for (i = 1; i <= n - n_20_percent; i++) {\n                          a[i] = a[i + n_20_percent]\n                        }\n\n                        n -= n_20_percent\n\n                        #\n                        # Calculate average\n                        #\n                        sum = 0\n                        for (i = 1; i <= n; i++) {\n                          sum += a[i]\n                        }\n\n                        avg = sum / n\n\n                        if (n > 1) {\n                          if (n - 1 <= 50) {\n                            t_coef = t_gamma_n_m1 [n - 1]\n                          } else {\n                            # For greater degrees of freedom, values of corresponding quantiles\n                            # are insignificantly less than the value.\n                            #\n                            # For example, the value for infinite number of freedoms is 2.5758\n                            #\n                            # So, to reduce table size, we take this, greater value,\n                            # overestimating inaccuracy for no more than 4%.\n                            #\n                            t_coef = t_gamma_n_m1 [50]\n                          }\n\n                          #\n                          # Calculate inaccuracy estimation\n                          #\n                          sum_delta_squares = 0\n                          for (i = 1; i <= n; i++) {\n                            sum_delta_squares += (avg - a[i]) ^ 2\n                          }\n\n                          delta = t_coef * sqrt (sum_delta_squares / (n * (n - 1)))\n\n                          print avg, delta\n                        } else {\n                          print avg\n                        }\n                      }\n                      \" || exit 1;\n               );\n  calc_status=$?\nfi\n\necho \"$perf_values\"\n\nif [ $? -ne 0 ];\nthen\n  exit 1;\nfi;\n"
  },
  {
    "path": "tools/pylint/pylintrc",
    "content": "[MASTER]\n\n# Specify a configuration file.\n#rcfile=\n\n# Python code to execute, usually for sys.path manipulation such as\n# pygtk.require().\n#init-hook=\n\n# Add files or directories to the blacklist. They should be base names, not\n# paths.\nignore=CVS\n\n# Pickle collected data for later comparisons.\npersistent=yes\n\n# List of plugins (as comma separated values of python modules names) to load,\n# usually to register additional checkers.\nload-plugins=\n\n# Use multiple processes to speed up Pylint.\njobs=1\n\n# Allow loading of arbitrary C extensions. Extensions are imported into the\n# active Python interpreter and may run arbitrary code.\nunsafe-load-any-extension=no\n\n# A comma-separated list of package or module names from where C extensions may\n# be loaded. Extensions are loading into the active Python interpreter and may\n# run arbitrary code\nextension-pkg-whitelist=\n\n# Allow optimization of some AST trees. This will activate a peephole AST\n# optimizer, which will apply various small optimizations. For instance, it can\n# be used to obtain the result of joining multiple strings with the addition\n# operator. Joining a lot of strings can lead to a maximum recursion error in\n# Pylint and this flag can prevent that. It has one side effect, the resulting\n# AST will be different than the one from reality.\noptimize-ast=no\n\n\n[MESSAGES CONTROL]\n\n# Only show warnings with the listed confidence levels. Leave empty to show\n# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED\nconfidence=\n\n# Enable the message, report, category or checker with the given id(s). You can\n# either give multiple identifier separated by comma (,) or put this option\n# multiple time. See also the \"--disable\" option for examples.\n#enable=\n\n# Disable the message, report, category or checker with the given id(s). You\n# can either give multiple identifiers separated by comma (,) or put this\n# option multiple times (only on the command line, not in the configuration\n# file where it should appear only once).You can also use \"--disable=all\" to\n# disable everything first and then reenable specific checks. For example, if\n# you want to run only the similarities checker, you can use \"--disable=all\n# --enable=similarities\". If you want to run only the classes checker, but have\n# no Warning level messages displayed, use\"--disable=all --enable=classes\n# --disable=W\"\ndisable=\n    missing-docstring,\n\n[REPORTS]\n\n# Set the output format. Available formats are text, parseable, colorized, msvs\n# (visual studio) and html. You can also give a reporter class, eg\n# mypackage.mymodule.MyReporterClass.\noutput-format=text\n\n# Put messages in a separate file for each module / package specified on the\n# command line instead of printing them on stdout. Reports (if any) will be\n# written in a file name \"pylint_global.[txt|html]\".\nfiles-output=no\n\n# Tells whether to display a full report or only the messages\nreports=no\n\n# Python expression which should return a note less than 10 (10 is the highest\n# note). You have access to the variables errors warning, statement which\n# respectively contain the number of errors / warnings messages and the total\n# number of statements analyzed. This is used by the global evaluation report\n# (RP0004).\nevaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)\n\n# Template used to display messages. This is a python new-style format string\n# used to format the message information. See doc for all details\n#msg-template=\n\n\n[TYPECHECK]\n\n# Tells whether missing members accessed in mixin class should be ignored. A\n# mixin class is detected if its name ends with \"mixin\" (case insensitive).\nignore-mixin-members=yes\n\n# List of module names for which member attributes should not be checked\n# (useful for modules/projects where namespaces are manipulated during runtime\n# and thus existing member attributes cannot be deduced by static analysis. It\n# supports qualified module names, as well as Unix pattern matching.\nignored-modules=\n\n# List of classes names for which member attributes should not be checked\n# (useful for classes with attributes dynamically set). This supports can work\n# with qualified names.\nignored-classes=\n\n# List of members which are set dynamically and missed by pylint inference\n# system, and so shouldn't trigger E1101 when accessed. Python regular\n# expressions are accepted.\ngenerated-members=\n\n\n[FORMAT]\n\n# Maximum number of characters on a single line.\nmax-line-length=120\n\n# Regexp for a line that is allowed to be longer than the limit.\nignore-long-lines=^\\s*(# )?<?https?://\\S+>?$\n\n# Allow the body of an if to be on the same line as the test if there is no\n# else.\nsingle-line-if-stmt=no\n\n# List of optional constructs for which whitespace checking is disabled. `dict-\n# separator` is used to allow tabulation in dicts, etc.: {1  : 1,\\n222: 2}.\n# `trailing-comma` allows a space between comma and closing bracket: (a, ).\n# `empty-line` allows space-only lines.\nno-space-check=trailing-comma,dict-separator\n\n# Maximum number of lines in a module\nmax-module-lines=2000\n\n# String used as indentation unit. This is usually \"    \" (4 spaces) or \"\\t\" (1\n# tab).\nindent-string='    '\n\n# Number of spaces of indent required inside a hanging  or continued line.\nindent-after-paren=4\n\n# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.\nexpected-line-ending-format=\n\n\n[MISCELLANEOUS]\n\n# List of note tags to take in consideration, separated by a comma.\nnotes=FIXME,XXX,TODO\n\n\n[SPELLING]\n\n# Spelling dictionary name. Available dictionaries: none. To make it working\n# install python-enchant package.\nspelling-dict=\n\n# List of comma separated words that should not be checked.\nspelling-ignore-words=\n\n# A path to a file that contains private dictionary; one word per line.\nspelling-private-dict-file=\n\n# Tells whether to store unknown words to indicated private dictionary in\n# --spelling-private-dict-file option instead of raising a message.\nspelling-store-unknown-words=no\n\n\n[VARIABLES]\n\n# Tells whether we should check for unused import in __init__ files.\ninit-import=no\n\n# A regular expression matching the name of dummy variables (i.e. expectedly\n# not used).\ndummy-variables-rgx=_$|dummy\n\n# List of additional names supposed to be defined in builtins. Remember that\n# you should avoid to define new builtins when possible.\nadditional-builtins=\n\n# List of strings which can identify a callback function by name. A callback\n# name must start or end with one of those strings.\ncallbacks=cb_,_cb\n\n\n[BASIC]\n\n# List of builtins function names that should not be used, separated by a comma\nbad-functions=map,filter,input\n\n# Good variable names which should always be accepted, separated by a comma\ngood-names=i,j,k,ex,Run,_\n\n# Bad variable names which should always be refused, separated by a comma\nbad-names=foo,bar,baz,toto,tutu,tata\n\n# Colon-delimited sets of names that determine each other's naming style when\n# the name regexes allow several styles.\nname-group=\n\n# Include a hint for the correct naming format with invalid-name\ninclude-naming-hint=no\n\n# Regular expression matching correct function names\nfunction-rgx=[a-z_][a-z0-9_]{2,30}$\n\n# Naming hint for function names\nfunction-name-hint=[a-z_][a-z0-9_]{2,30}$\n\n# Regular expression matching correct variable names\nvariable-rgx=[a-z_][a-z0-9_]{2,30}$\n\n# Naming hint for variable names\nvariable-name-hint=[a-z_][a-z0-9_]{2,30}$\n\n# Regular expression matching correct constant names\nconst-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$\n\n# Naming hint for constant names\nconst-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$\n\n# Regular expression matching correct attribute names\nattr-rgx=[a-z_][a-z0-9_]{2,30}$\n\n# Naming hint for attribute names\nattr-name-hint=[a-z_][a-z0-9_]{2,30}$\n\n# Regular expression matching correct argument names\nargument-rgx=[a-z_][a-z0-9_]{2,30}$\n\n# Naming hint for argument names\nargument-name-hint=[a-z_][a-z0-9_]{2,30}$\n\n# Regular expression matching correct class attribute names\nclass-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$\n\n# Naming hint for class attribute names\nclass-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$\n\n# Regular expression matching correct inline iteration names\ninlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$\n\n# Naming hint for inline iteration names\ninlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$\n\n# Regular expression matching correct class names\nclass-rgx=[A-Z_][a-zA-Z0-9]+$\n\n# Naming hint for class names\nclass-name-hint=[A-Z_][a-zA-Z0-9]+$\n\n# Regular expression matching correct module names\nmodule-rgx=(([a-z_][a-z0-9_-]*)|([A-Z][a-zA-Z0-9]+))$\n\n# Naming hint for module names\nmodule-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$\n\n# Regular expression matching correct method names\nmethod-rgx=[a-z_][a-z0-9_]{2,30}$\n\n# Naming hint for method names\nmethod-name-hint=[a-z_][a-z0-9_]{2,30}$\n\n# Regular expression which should only match function or class names that do\n# not require a docstring.\nno-docstring-rgx=^_\n\n# Minimum line length for functions/classes that require docstrings, shorter\n# ones are exempt.\ndocstring-min-length=-1\n\n\n[ELIF]\n\n# Maximum number of nested blocks for function / method body\nmax-nested-blocks=7\n\n\n[LOGGING]\n\n# Logging modules to check that the string format arguments are in logging\n# function parameter format\nlogging-modules=logging\n\n\n[SIMILARITIES]\n\n# Minimum lines number of a similarity.\nmin-similarity-lines=4\n\n# Ignore comments when computing similarities.\nignore-comments=yes\n\n# Ignore docstrings when computing similarities.\nignore-docstrings=yes\n\n# Ignore imports when computing similarities.\nignore-imports=no\n\n\n[DESIGN]\n\n# Maximum number of arguments for function / method\nmax-args=10\n\n# Argument names that match this expression will be ignored. Default to name\n# with leading underscore\nignored-argument-names=_.*\n\n# Maximum number of locals for function / method body\nmax-locals=20\n\n# Maximum number of return / yield for function / method body\nmax-returns=6\n\n# Maximum number of branch for function / method body\nmax-branches=25\n\n# Maximum number of statements in function / method body\nmax-statements=75\n\n# Maximum number of parents for a class (see R0901).\nmax-parents=7\n\n# Maximum number of attributes for a class (see R0902).\nmax-attributes=10\n\n# Minimum number of public methods for a class (see R0903).\nmin-public-methods=0\n\n# Maximum number of public methods for a class (see R0904).\nmax-public-methods=25\n\n# Maximum number of boolean expressions in a if statement\nmax-bool-expr=5\n\n\n[IMPORTS]\n\n# Deprecated modules which should not be used, separated by a comma\ndeprecated-modules=regsub,TERMIOS,Bastion,rexec\n\n# Create a graph of every (i.e. internal and external) dependencies in the\n# given file (report RP0402 must not be disabled)\nimport-graph=\n\n# Create a graph of external dependencies in the given file (report RP0402 must\n# not be disabled)\next-import-graph=\n\n# Create a graph of internal dependencies in the given file (report RP0402 must\n# not be disabled)\nint-import-graph=\n\n\n[CLASSES]\n\n# List of method names used to declare (i.e. assign) instance attributes.\ndefining-attr-methods=__init__,__new__,setUp\n\n# List of valid names for the first argument in a class method.\nvalid-classmethod-first-arg=cls\n\n# List of valid names for the first argument in a metaclass class method.\nvalid-metaclass-classmethod-first-arg=mcs\n\n# List of member names, which should be excluded from the protected access\n# warning.\nexclude-protected=_asdict,_fields,_replace,_source,_make\n\n\n[EXCEPTIONS]\n\n# Exceptions that will emit a warning when being caught. Defaults to\n# \"Exception\"\novergeneral-exceptions=Exception\n"
  },
  {
    "path": "tools/rss-measure.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nJERRY=$1\nTEST=$2\nSLEEP=0.1\nOS=`uname -s | tr [:upper:] [:lower:]`\n\nRss_OUT=\"\"\n\nfunction collect_entry()\n{\n  OUT_NAME=\"$1_OUT\";\n  OUT=$OUT_NAME;\n\n  if [ \"$OS\" == \"darwin\" ]\n  then\n    SUM=`ps -o rss $PID | grep [0-9]`\n  else\n    SUM=$(grep -o -e \"^[0-9a-f][0-9a-f]*.*\" -e \"^Rss.*\" /proc/$PID/smaps 2>/dev/null | grep -A 1 -- \"r[w-]-p \" | grep \"^Rss\"|awk '{s += $2;} END {print s;}')\n  fi;\n\n  if [ \"$SUM\" != \"\" ];\n  then\n    eval \"$OUT=\\\"\\$$OUT $SUM\\\\n\\\"\";\n  fi;\n}\n\nfunction print_entry()\n{\n  OUT_NAME=\"$1_OUT\";\n  OUT=$OUT_NAME;\n\n  eval \"echo -e \\\"\\$$OUT\\\"\" | awk -v entry=\"$1\" '{ if ($1 != \"\") { n += 1; if ($1 > max) { max = $1; } } } END { if (n == 0) { exit; }; printf \"%d\\n\",  max; }';\n}\n\nfunction run_test()\n{\n  $JERRY $TEST &\n  PID=$!\n\n  while kill -0 \"$PID\" > /dev/null 2>&1;\n  do\n    collect_entry Rss\n\n    sleep $SLEEP\n  done\n\n  wait \"$PID\" || exit 1\n}\n\nrun_test\n\nprint_entry Rss\n"
  },
  {
    "path": "tools/run-mem-stats-test.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# Choosing table or semicolon-separated output mode\nif [ \"$1\" == \"-d\" ]\nthen\n  TABLE=\"no\"\n  PRINT_TEST_NAME_AWK_SCRIPT='{printf \"%s;\", $1}'\n  PRINT_TOTAL_AWK_SCRIPT='{printf \"%d;%d;%d\\n\", $1, $2, $3 * 1024}'\n\n  shift\nelse\n  PRINT_TEST_NAME_AWK_SCRIPT='{printf \"%30s\", $1}'\n  PRINT_TOTAL_AWK_SCRIPT='{printf \"%25d%25d%25d\\n\", $1, $2, $3 * 1024}'\n  TABLE=\"yes\"\nfi\n\nfunction fail_msg\n{\n  echo \"$1\"\n  exit 1\n}\n\n# Engine\n\n# Check if the specified build supports memory statistics options\nfunction is_mem_stats_build\n{\n  [ -x \"$1\" ] || fail_msg \"Engine '$1' is not executable\"\n\n  tmpfile=`mktemp`\n  \"$1\" --mem-stats $tmpfile 2>&1 | grep -- \"Ignoring JERRY_INIT_MEM_STATS flag because of !JMEM_STATS configuration.\" 2>&1 > /dev/null\n  code=$?\n  rm $tmpfile\n\n  return $code\n}\n\nJERRY=\"$1\"\nshift\nis_mem_stats_build \"$JERRY\" || fail_msg \"First engine specified should be built without memory statistics support\"\n\nJERRY_MEM_STATS=\"$1\"\nshift\nis_mem_stats_build \"$JERRY_MEM_STATS\" && fail_msg \"Second engine specified should be built with memory statistics support\"\n\n# Benchmarks list\nBENCHMARKS=\"\"\n\nwhile [ $# -ne 0 ]\ndo\n  BENCHMARKS=\"$BENCHMARKS $1\"\n  shift\ndone\n\n# Running\nif [ \"$TABLE\" == \"yes\" ]\nthen\n  awk 'BEGIN {printf \"%30s%25s%25s%25s\\n\", \"Test name\", \"Peak Heap (parser)\", \"Peak Heap (execution)\", \"Maximum RSS\"}'\n  echo\nfi\n\nfor bench in $BENCHMARKS\ndo\n  test=`basename $bench .js`\n\n  echo \"$test\" | awk \"$PRINT_TEST_NAME_AWK_SCRIPT\"\n  MEM_STATS=$(\"$JERRY_MEM_STATS\" --mem-stats --mem-stats-separate $bench | grep -e \"Peak allocated =\" | grep -o \"[0-9]*\")\n  RSS=$(./tools/rss-measure.sh \"$JERRY\" $bench | tail -n 1 | grep -o \"[0-9]*\")\n  echo $MEM_STATS $RSS | xargs | awk \"$PRINT_TOTAL_AWK_SCRIPT\"\ndone\n"
  },
  {
    "path": "tools/run-perf-test.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\ntrap \"exit 2\" INT\n\nfunction pr_err() {\n  echo -e \"\\e[91mError: $@\\e[39m\"\n}\n\nfunction exit_err() {\n  pr_err $@\n\n  exit 1\n}\n\n# Check if the specified build supports memory statistics options\nfunction is_mem_stats_build() {\n  [ -x \"$1\" ] || fail_msg \"Engine '$1' is not executable\"\n\n  tmpfile=`mktemp`\n  \"$1\" --mem-stats $tmpfile 2>&1 | grep -- \"Ignoring JERRY_INIT_MEM_STATS flag because of !JMEM_STATS configuration.\" 2>&1 > /dev/null\n  code=$?\n  rm $tmpfile\n\n  return $code\n}\n\nUSAGE=\"Usage:\\n    tools/run-perf-test.sh OLD_ENGINE NEW_ENGINE REPEATS TIMEOUT BENCH_FOLDER [-m result-file-name.md]\"\n\nif [ \"$#\" -lt 5 ]\nthen\n  echo -e \"${USAGE}\"\n  exit_err \"Argument number mismatch...\"\nfi\n\nENGINE_OLD=\"$1\"\nENGINE_NEW=\"$2\"\nREPEATS=\"$3\"\nTIMEOUT=\"$4\"\nBENCH_FOLDER=\"$5\"\nOUTPUT_FORMAT=\"$6\"\nOUTPUT_FILE=\"$7\"\n\nif [ \"$#\" -gt 5 ]\nthen\n  if [ \"${OUTPUT_FORMAT}\" != \"-m\" ]\n  then\n    exit_err \"Please, use '-m result-file-name.md' as last arguments\"\n  fi\n  if [ -z \"${OUTPUT_FILE}\" ]\n  then\n    exit_err \"Missing md file name. Please, define the filename. Ex.: '-m result-file-name.md'\"\n  fi\n\n  rm -rf \"${OUTPUT_FILE}\"\nfi\n\nif [ \"${REPEATS}\" -lt 1 ]\nthen\n  exit_err \"REPEATS must be greater than 0\"\nfi\n\nif [ \"${TIMEOUT}\" -lt 1 ]\nthen\n  exit_err \"TIMEOUT must be greater than 0\"\nfi\n\nperf_n=0\nmem_n=0\n\nperf_rel_mult=1.0\nperf_rel_inaccuracy_tmp=0\nmem_rel_mult=1.0\nmem_rel_inaccuracy_tmp=\"-1\"\n\n# Unicode \"figure space\" character\nFIGURE_SPACE=$(echo -e -n \"\\xE2\\x80\\x87\")\n\n# Unicode \"approximately equal\" character\nAPPROXIMATELY_EQUAL=$(echo -n -e \"\\xE2\\x89\\x88\")\n\nfunction run-compare()\n{\n  COMMAND=$1\n  PRE=$2\n  TEST=$3\n  PRECISION=$4\n  UNIT=$5\n\n  ABS_FP_FMT=\"%$((PRECISION + 4)).$((PRECISION))f$UNIT\"\n  REL_FP_FMT=\"%0.3f\"\n  REL_SHOW_PLUS_SIGN_FP_FMT=\"%+0.3f\"\n\n  OLD=$(timeout \"${TIMEOUT}\" ${COMMAND} \"${ENGINE_OLD}\" \"${TEST}\") || return 1\n  NEW=$(timeout \"${TIMEOUT}\" ${COMMAND} \"${ENGINE_NEW}\" \"${TEST}\") || return 1\n\n  #check result\n  ! $OLD || ! $NEW || return 1\n\n  OLD_value=$(echo \"$OLD \" | cut -d ' ' -f 1)\n  OLD_inaccuracy=$(echo \"$OLD \" | cut -d ' ' -f 2)\n\n  NEW_value=$(echo \"$NEW \" | cut -d ' ' -f 1)\n  NEW_inaccuracy=$(echo \"$NEW \" | cut -d ' ' -f 2)\n\n  #calc relative speedup\n  eval \"rel_mult=\\$${PRE}_rel_mult\"\n\n  rel=$(echo \"${OLD_value}\" \"${NEW_value}\" | awk '{ print $2 / $1; }')\n\n  #increment n\n  ((${PRE}_n++))\n\n  #calc percent to display\n  PERCENT=$(echo \"$rel\" | awk '{print (1.0 - $1) * 100; }')\n\n  if [[ \"$OLD_inaccuracy\" != \"\" && \"$NEW_inaccuracy\" != \"\" ]]\n  then\n    DIFF=$(printf \"$ABS_FP_FMT -> $ABS_FP_FMT\" $OLD_value $NEW_value)\n    rel_inaccuracy=$(echo \"$OLD_value $OLD_inaccuracy $NEW_value $NEW_inaccuracy\" | \\\n                     awk \"{\n                            OLD_value=\\$1\n                            OLD_inaccuracy=\\$2\n                            NEW_value=\\$3\n                            NEW_inaccuracy=\\$4\n\n                            rel_inaccuracy = (NEW_value / OLD_value) * sqrt ((OLD_inaccuracy / OLD_value) ^ 2 + (NEW_inaccuracy / NEW_value) ^ 2)\n                            if (rel_inaccuracy < 0) {\n                              rel_inaccuracy = -rel_inaccuracy\n                            }\n\n                            print rel_inaccuracy\n                          }\")\n    PERCENT_inaccuracy=$(echo \"$rel_inaccuracy\" | awk '{ print $1 * 100.0 }')\n\n    ext=$(echo \"$PERCENT $PERCENT_inaccuracy\" | \\\n                awk \"{\n                       PERCENT=\\$1\n                       PERCENT_inaccuracy=\\$2\n\n                       if (PERCENT > 0.0 && PERCENT > PERCENT_inaccuracy) {\n                         print \\\"[+]\\\"\n                       } else if (PERCENT < 0 && -PERCENT > PERCENT_inaccuracy) {\n                         print \\\"[-]\\\"\n                       } else {\n                         print \\\"[$APPROXIMATELY_EQUAL]\\\"\n                       }\n                     }\")\n\n    if [[ $rel_inaccuracy_tmp -lt 0 ]]\n    then\n      return 1\n    fi\n\n    eval \"rel_inaccuracy_tmp=\\$${PRE}_rel_inaccuracy_tmp\"\n\n    rel_inaccuracy_tmp=$(echo \"$rel $rel_inaccuracy $rel_inaccuracy_tmp\" | \\\n                         awk \"{\n                                rel=\\$1\n                                rel_inaccuracy=\\$2\n                                rel_inaccuracy_tmp=\\$3\n                                print rel_inaccuracy_tmp + (rel_inaccuracy / rel) ^ 2\n                              }\")\n\n    eval \"${PRE}_rel_inaccuracy_tmp=\\$rel_inaccuracy_tmp\"\n\n    PERCENT=$(printf \"%8s %11s\" $(printf \"$REL_SHOW_PLUS_SIGN_FP_FMT%%\" $PERCENT) $(printf \"(+-$REL_FP_FMT%%)\" $PERCENT_inaccuracy))\n    PERCENT=\"$PERCENT : $ext\"\n\n    if [ \"${OUTPUT_FORMAT}\" == \"-m\" ]\n    then\n      WIDTH=42\n      MD_DIFF=$(printf \"%s%s\" \"$DIFF\" \"$(printf \"%$(($WIDTH - ${#DIFF}))s\")\")\n      MD_PERCENT=$(printf \"%s%s\" \"$(printf \"%$(($WIDTH - ${#PERCENT}))s\")\" \"$PERCENT\")\n\n      MD_FORMAT=\"\\`%s\\`<br>\\`%s\\`\"\n    fi\n\n    CONSOLE_FORMAT=\"%20s : %19s\"\n  else\n    ext=\"\"\n\n    if [[ \"$OLD_inaccuracy\" != \"\" || \"$NEW_inaccuracy\" != \"\" ]]\n    then\n      return 1;\n    fi\n\n    DIFF=$(printf \"$ABS_FP_FMT -> $ABS_FP_FMT\" $OLD_value $NEW_value)\n    PERCENT=$(printf \"$REL_SHOW_PLUS_SIGN_FP_FMT%%\" $PERCENT)\n\n    if [ \"${OUTPUT_FORMAT}\" == \"-m\" ]\n    then\n      WIDTH=20\n      MD_DIFF=$(printf \"%s%s\" \"$DIFF\" \"$(printf \"%$(($WIDTH - ${#DIFF}))s\")\")\n      MD_PERCENT=$(printf \"%s%s\" \"$(printf \"%$(($WIDTH - ${#PERCENT}))s\")\" \"$PERCENT\")\n\n      MD_FORMAT=\"\\`%s\\`<br>\\`%s\\`\"\n    fi\n\n    CONSOLE_FORMAT=\"%14s : %8s\"\n  fi\n\n  rel_mult=$(echo \"$rel_mult\" \"$rel\" | awk '{print $1 * $2;}')\n\n  eval \"${PRE}_rel_mult=\\$rel_mult\"\n\n  if [ \"${OUTPUT_FORMAT}\" == \"-m\" ]\n  then\n    printf \"$MD_FORMAT\" \"$MD_DIFF\" \"$MD_PERCENT\" | sed \"s/ /$FIGURE_SPACE/g\" >> \"${OUTPUT_FILE}\"\n  fi\n\n  printf \"$CONSOLE_FORMAT\" \"$DIFF\" \"$PERCENT\"\n}\n\nfunction run-test()\n{\n  TEST=$1\n\n  # print only filename\n  if [ \"${OUTPUT_FORMAT}\" == \"-m\" ]\n  then\n    printf \"%s | \" \"${TEST##*/}\" >> \"${OUTPUT_FILE}\"\n  fi\n\n  printf \"%50s | \" \"${TEST##*/}\"\n\n  if [ \"$IS_MEM_STAT\" -ne 0 ]\n  then\n    run-compare \"./tools/mem-stats-measure.sh\"      \"mem\"   \"${TEST}\" 0   || return 1\n  else\n    run-compare \"./tools/rss-measure.sh\"      \"mem\"   \"${TEST}\" 0 k || return 1\n  fi\n\n  if [ \"${OUTPUT_FORMAT}\" == \"-m\" ]\n  then\n    printf \" | \" >> \"${OUTPUT_FILE}\"\n  fi\n\n  printf \" | \"\n  run-compare \"./tools/perf.sh ${REPEATS}\"  \"perf\"  \"${TEST}\" 3 s || return 1\n\n  if [ \"${OUTPUT_FORMAT}\" == \"-m\" ]\n  then\n    printf \"\\n\" >> \"${OUTPUT_FILE}\"\n  fi\n\n  printf \"\\n\"\n}\n\nfunction run-suite()\n{\n  FOLDER=$1\n\n  for BENCHMARK in ${FOLDER}/*.js\n  do\n    run-test \"${BENCHMARK}\" 2> /dev/null || printf \"<FAILED>\\n\" \"${BENCHMARK}\";\n  done\n}\n\ndate\n\nis_mem_stats_build \"${ENGINE_OLD}\" || is_mem_stats_build \"${ENGINE_NEW}\"\nIS_MEM_STAT=$?\n\nif [ \"${OUTPUT_FORMAT}\" == \"-m\" ]\nthen\n  if [ \"$IS_MEM_STAT\" -ne 0 ]\n  then\n    echo \"Benchmark | Peak alloc.<br>(+ is better) | Perf<br>(+ is better)\" >> \"${OUTPUT_FILE}\"\n  else\n    echo \"Benchmark | RSS<br>(+ is better) | Perf<br>(+ is better)\" >> \"${OUTPUT_FILE}\"\n  fi\n  echo \"---------: | --------- | ---------\" >> \"${OUTPUT_FILE}\"\nfi\n\nif [ \"$IS_MEM_STAT\" -ne 0 ]\nthen\n  printf \"%50s | %25s | %35s\\n\" \"Benchmark\" \"Peak alloc.(+ is better)\" \"Perf(+ is better)\"\nelse\n  printf \"%50s | %25s | %35s\\n\" \"Benchmark\" \"RSS(+ is better)\" \"Perf(+ is better)\"\nfi\n\nrun-suite \"${BENCH_FOLDER}\"\n\nmem_rel_gmean=$(echo \"$mem_rel_mult\" \"$mem_n\" | awk '{print $1 ^ (1.0 / $2);}')\nmem_percent_gmean=$(echo \"$mem_rel_gmean\" | awk '{print (1.0 - $1) * 100;}')\nif [[ $mem_rel_inaccuracy_tmp != \"-1\" ]]\nthen\n  exit_err \"Incorrect inaccuracy calculation for memory consumption geometric mean\"\nfi\n\nperf_rel_gmean=$(echo \"$perf_rel_mult\" \"$perf_n\" | awk '{print $1 ^ (1.0 / $2);}')\nperf_percent_gmean=$(echo \"$perf_rel_gmean\" | awk '{print (1.0 - $1) * 100;}')\nif [[ \"$perf_rel_inaccuracy_tmp\" == \"-1\" ]]\nthen\n  exit_err \"Incorrect inaccuracy calculation for performance geometric mean\"\nelse\n  perf_percent_inaccuracy=$(echo \"$perf_rel_gmean $perf_rel_inaccuracy_tmp $perf_n\" | \\\n                            awk \"{\n                                   perf_rel_gmean=\\$1\n                                   perf_rel_inaccuracy_tmp=\\$2\n                                   perf_n=\\$3\n\n                                   print 100.0 * (perf_rel_gmean ^ (1.0 / perf_n) * sqrt (perf_rel_inaccuracy_tmp) / perf_n)\n                                 }\")\n  perf_ext=$(echo \"$perf_percent_gmean $perf_percent_inaccuracy\" | \\\n             awk \"{\n                    perf_percent_gmean=\\$1\n                    perf_percent_inaccuracy=\\$2\n\n                    if (perf_percent_gmean > 0.0 && perf_percent_gmean > perf_percent_inaccuracy) {\n                      print \\\"[+]\\\"\n                    } else if (perf_percent_gmean < 0 && -perf_percent_gmean > perf_percent_inaccuracy) {\n                      print \\\"[-]\\\"\n                    } else {\n                      print \\\"[$APPROXIMATELY_EQUAL]\\\"\n                    }\n                  }\")\n  perf_percent_inaccuracy=$(printf \"(+-%0.3f%%) : $perf_ext\" $perf_percent_inaccuracy)\nfi\n\ngmean_label_text=\"Geometric mean:\"\n\nif [ \"${OUTPUT_FORMAT}\" == \"-m\" ]\nthen\n  mem_percent_gmean_text=$(printf \"RSS reduction: \\`%0.3f%%\\`\" \"$mem_percent_gmean\")\n  perf_percent_gmean_text=$(printf \"Speed up: \\`%0.3f%% %s\\`\" \"$perf_percent_gmean\" \"$perf_percent_inaccuracy\")\n  printf \"%s | %s | %s\\n\" \"$gmean_label_text\" \"$mem_percent_gmean_text\" \"$perf_percent_gmean_text\" >> \"${OUTPUT_FILE}\"\nfi\n\nmem_percent_gmean_text=$(printf \"RSS reduction: %0.3f%%\" \"$mem_percent_gmean\")\nperf_percent_gmean_text=$(printf \"Speed up: %0.3f%% %s\" \"$perf_percent_gmean\" \"$perf_percent_inaccuracy\")\nprintf \"%50s | %25s | %51s\\n\" \"$gmean_label_text\" \"$mem_percent_gmean_text\" \"$perf_percent_gmean_text\"\n\ndate\n"
  },
  {
    "path": "tools/run-tests.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport collections\nimport hashlib\nimport os\nimport platform\nimport subprocess\nimport sys\nimport settings\n\nfrom runners import util\nfrom runners.util import TERM_NORMAL, TERM_YELLOW, TERM_BLUE, TERM_RED\n\nOUTPUT_DIR = os.path.join(settings.PROJECT_DIR, 'build', 'tests')\n\nOptions = collections.namedtuple('Options', ['name', 'build_args', 'test_args', 'skip'])\nOptions.__new__.__defaults__ = ([], [], False)\n\ndef skip_if(condition, desc):\n    return desc if condition else False\n\nOPTIONS_COMMON = ['--lto=off', '--function-to-string=on']\nOPTIONS_PROFILE_MIN = ['--profile=minimal']\nOPTIONS_STACK_LIMIT = ['--stack-limit=96']\nOPTIONS_GC_MARK_LIMIT = ['--gc-mark-limit=16']\nOPTIONS_MEM_STRESS = ['--mem-stress-test=on']\nOPTIONS_DEBUG = ['--debug']\nOPTIONS_SNAPSHOT = ['--snapshot-save=on', '--snapshot-exec=on', '--jerry-cmdline-snapshot=on']\nOPTIONS_UNITTESTS = ['--unittests=on', '--jerry-cmdline=off', '--error-messages=on',\n                     '--snapshot-save=on', '--snapshot-exec=on', '--vm-exec-stop=on',\n                     '--vm-throw=on', '--line-info=on', '--mem-stats=on', '--promise-callback=on']\nOPTIONS_DOCTESTS = ['--doctests=on', '--jerry-cmdline=off', '--error-messages=on',\n                    '--snapshot-save=on', '--snapshot-exec=on', '--vm-exec-stop=on']\nOPTIONS_PROMISE_CALLBACK = ['--promise-callback=on']\n\n# Test options for unittests\nJERRY_UNITTESTS_OPTIONS = [\n    Options('doctests',\n            OPTIONS_COMMON + OPTIONS_DOCTESTS + OPTIONS_PROMISE_CALLBACK),\n    Options('unittests',\n            OPTIONS_COMMON + OPTIONS_UNITTESTS),\n    Options('unittests-init-fini',\n            OPTIONS_COMMON + OPTIONS_UNITTESTS\n            + ['--cmake-param=-DFEATURE_INIT_FINI=ON']),\n    Options('unittests-math',\n            OPTIONS_COMMON + OPTIONS_UNITTESTS + ['--jerry-math=on']),\n]\n\n# Test options for jerry-tests\nJERRY_TESTS_OPTIONS = [\n    Options('jerry_tests',\n            OPTIONS_COMMON +  OPTIONS_STACK_LIMIT + OPTIONS_GC_MARK_LIMIT + OPTIONS_MEM_STRESS),\n    Options('jerry_tests-snapshot',\n            OPTIONS_COMMON + OPTIONS_SNAPSHOT + OPTIONS_STACK_LIMIT + OPTIONS_GC_MARK_LIMIT,\n            ['--snapshot']),\n    Options('jerry_tests-cpointer_32bit',\n            OPTIONS_COMMON + OPTIONS_STACK_LIMIT + OPTIONS_GC_MARK_LIMIT\n            + ['--cpointer-32bit=on', '--mem-heap=1024']),\n    Options('jerry_tests-external_context',\n            OPTIONS_COMMON + OPTIONS_STACK_LIMIT + OPTIONS_GC_MARK_LIMIT\n            + ['--external-context=on']),\n]\n\n# Test options for test262\nTEST262_TEST_SUITE_OPTIONS = [\n    Options('test262',\n            OPTIONS_COMMON + ['--line-info=on', '--error-messages=on', '--mem-heap=20480']),\n]\n\n# Test options for jerry-debugger\nDEBUGGER_TEST_OPTIONS = [\n    Options('jerry_debugger_tests',\n            ['--jerry-debugger=on'])\n]\n\n# Test options for buildoption-test\nJERRY_BUILDOPTIONS = [\n    Options('buildoption_test-lto',\n            ['--lto=on']),\n    Options('buildoption_test-error_messages',\n            ['--error-messages=on']),\n    Options('buildoption_test-logging',\n            ['--logging=on']),\n    Options('buildoption_test-amalgam',\n            ['--amalgam=on']),\n    Options('buildoption_test-valgrind',\n            ['--valgrind=on']),\n    Options('buildoption_test-mem_stats',\n            ['--mem-stats=on']),\n    Options('buildoption_test-show_opcodes',\n            ['--show-opcodes=on']),\n    Options('buildoption_test-show_regexp_opcodes',\n            ['--show-regexp-opcodes=on']),\n    Options('buildoption_test-cpointer_32bit',\n            ['--compile-flag=-m32', '--cpointer-32bit=on', '--system-allocator=on'],\n            skip=skip_if(\n                platform.system() != 'Linux' or (platform.machine() != 'i386' and platform.machine() != 'x86_64'),\n                '-m32 is only supported on x86[-64]-linux')\n           ),\n    Options('buildoption_test-jerry_math',\n            ['--jerry-math=on']),\n    Options('buildoption_test-no_lcache_prophashmap',\n            ['--compile-flag=-DJERRY_LCACHE=0', '--compile-flag=-DJERRY_PROPERTY_HASHMAP=0']),\n    Options('buildoption_test-external_context',\n            ['--external-context=on']),\n    Options('buildoption_test-shared_libs',\n            ['--shared-libs=on'],\n            skip=skip_if((sys.platform == 'win32'), 'Not yet supported, link failure on Windows')),\n    Options('buildoption_test-cmdline_test',\n            ['--jerry-cmdline-test=on'],\n            skip=skip_if((sys.platform == 'win32'), 'rand() can\\'t be overriden on Windows (benchmarking.c)')),\n    Options('buildoption_test-cmdline_snapshot',\n            ['--jerry-cmdline-snapshot=on']),\n    Options('buildoption_test-recursion_limit',\n            OPTIONS_STACK_LIMIT),\n    Options('buildoption_test-gc-mark_limit',\n            OPTIONS_GC_MARK_LIMIT),\n    Options('buildoption_test-jerry-debugger',\n            ['--jerry-debugger=on']),\n    Options('buildoption_test-module-off',\n            ['--compile-flag=-DJERRY_MODULE_SYSTEM=0', '--lto=off']),\n    Options('buildoption_test-builtin-proxy-off',\n            ['--compile-flag=-DJERRY_BUILTIN_PROXY=0']),\n]\n\ndef get_arguments():\n    parser = argparse.ArgumentParser()\n    parser.add_argument('--toolchain', metavar='FILE',\n                        help='Add toolchain file')\n    parser.add_argument('-q', '--quiet', action='store_true',\n                        help='Only print out failing tests')\n    parser.add_argument('--buildoptions', metavar='LIST',\n                        help='Add a comma separated list of extra build options to each test')\n    parser.add_argument('--skip-list', metavar='LIST',\n                        help='Add a comma separated list of patterns of the excluded JS-tests')\n    parser.add_argument('--outdir', metavar='DIR', default=OUTPUT_DIR,\n                        help='Specify output directory (default: %(default)s)')\n    parser.add_argument('--check-signed-off', metavar='TYPE', nargs='?',\n                        choices=['strict', 'tolerant', 'gh-actions'], const='strict',\n                        help='Run signed-off check (%(choices)s; default type if not given: %(const)s)')\n    parser.add_argument('--check-cppcheck', action='store_true',\n                        help='Run cppcheck')\n    parser.add_argument('--check-doxygen', action='store_true',\n                        help='Run doxygen')\n    parser.add_argument('--check-pylint', action='store_true',\n                        help='Run pylint')\n    parser.add_argument('--check-format', action='store_true',\n                        help='Run format check')\n    parser.add_argument('--check-license', action='store_true',\n                        help='Run license check')\n    parser.add_argument('--check-strings', action='store_true',\n                        help='Run \"magic string source code generator should be executed\" check')\n    parser.add_argument('--build-config', type=str, default=None,\n                        help='Build config, when not specified, auto detect it')\n    parser.add_argument('--build-debug', action='store_true',\n                        help='Build debug version jerryscript')\n    parser.add_argument('--run-check-timeout', type=int, default=30 * 60,\n                        help='Specify run_check timeout, default to 30 minutes, unit: second')\n    parser.add_argument('--jerry-debugger', action='store_true',\n                        help='Run jerry-debugger tests')\n    parser.add_argument('--jerry-tests', action='store_true',\n                        help='Run jerry-tests')\n    parser.add_argument('--test262', default=False, const='default',\n                        nargs='?', choices=['default', 'all', 'update'],\n                        help='Run test262 - default: all tests except excludelist, ' +\n                        'all: all tests, update: all tests and update excludelist')\n    parser.add_argument('--test262-test-list', metavar='LIST',\n                        help='Add a comma separated list of tests or directories to run in test262 test suite')\n    parser.add_argument('--unittests', action='store_true',\n                        help='Run unittests (including doctests)')\n    parser.add_argument('--buildoption-test', action='store_true',\n                        help='Run buildoption-test')\n    parser.add_argument('--all', '--precommit', action='store_true',\n                        help='Run all tests')\n\n    if len(sys.argv) == 1:\n        parser.print_help()\n        sys.exit(1)\n\n    script_args = parser.parse_args()\n\n    return script_args\n\nBINARY_CACHE = {}\n\ndef report_command(cmd_type, cmd, env=None):\n    sys.stderr.write(f'{TERM_BLUE}{cmd_type}{TERM_NORMAL}\\n')\n    if env is not None:\n        sys.stderr.write(''.join(f'{TERM_BLUE}{var}={val!r} \\\\{TERM_NORMAL}\\n'\n                                 for var, val in sorted(env.items())))\n    sys.stderr.write(f\"{TERM_BLUE}\" +\n                     f\" \\\\{TERM_NORMAL}\\n\\t{TERM_BLUE}\".join(cmd) +\n                     f\"{TERM_NORMAL}\\n\")\n    sys.stderr.flush()\n\ndef report_skip(job):\n    sys.stderr.write(f'{TERM_YELLOW}Skipping: {job.name}')\n    if job.skip:\n        sys.stderr.write(f' ({job.skip})')\n    sys.stderr.write(f'{TERM_NORMAL}\\n')\n    sys.stderr.flush()\n\ndef create_binary(job, options):\n    build_args = job.build_args[:]\n    build_dir_path = os.path.join(options.outdir, job.name)\n    if options.build_debug:\n        build_args.extend(OPTIONS_DEBUG)\n        build_dir_path = os.path.join(options.outdir, job.name + '-debug')\n    if options.buildoptions:\n        for option in options.buildoptions.split(','):\n            if option not in build_args:\n                build_args.append(option)\n\n    build_cmd = util.get_python_cmd_prefix()\n    build_cmd.append(settings.BUILD_SCRIPT)\n    build_cmd.extend(build_args)\n\n    build_cmd.append(f'--builddir={build_dir_path}')\n\n    install_dir_path = os.path.join(build_dir_path, 'local')\n    build_cmd.append(f'--install={install_dir_path}')\n\n    if options.toolchain:\n        build_cmd.append(f'--toolchain={options.toolchain}')\n\n    report_command('Build command:', build_cmd)\n\n    binary_key = tuple(sorted(build_args))\n    if binary_key in BINARY_CACHE:\n        ret, build_dir_path = BINARY_CACHE[binary_key]\n        sys.stderr.write(f'(skipping: already built at {build_dir_path} with returncode {ret})\\n')\n        sys.stderr.flush()\n        return ret, build_dir_path\n\n    try:\n        subprocess.check_output(build_cmd)\n        ret = 0\n    except subprocess.CalledProcessError as err:\n        print(err.output.decode(\"utf8\"))\n        ret = err.returncode\n\n    BINARY_CACHE[binary_key] = (ret, build_dir_path)\n    return ret, build_dir_path\n\ndef get_binary_path(build_dir_path):\n    executable_extension = '.exe' if sys.platform == 'win32' else ''\n    return os.path.join(build_dir_path, 'local', 'bin', 'jerry' + executable_extension)\n\ndef hash_binary(bin_path):\n    blocksize = 65536\n    hasher = hashlib.sha1()\n    with open(bin_path, 'rb') as bin_file:\n        buf = bin_file.read(blocksize)\n        while buf:\n            hasher.update(buf)\n            buf = bin_file.read(blocksize)\n    return hasher.hexdigest()\n\ndef iterate_test_runner_jobs(jobs, options):\n    tested_paths = set()\n    tested_hashes = {}\n\n    for job in jobs:\n        ret_build, build_dir_path = create_binary(job, options)\n        if ret_build:\n            yield job, ret_build, None\n\n        if build_dir_path in tested_paths:\n            sys.stderr.write(f'(skipping: already tested with {build_dir_path})\\n')\n            sys.stderr.flush()\n            continue\n        tested_paths.add(build_dir_path)\n\n        bin_path = get_binary_path(build_dir_path)\n        bin_hash = hash_binary(bin_path)\n\n        if bin_hash in tested_hashes:\n            sys.stderr.write(f'(skipping: already tested with equivalent {tested_hashes[bin_hash]})\\n')\n            sys.stderr.flush()\n            continue\n        tested_hashes[bin_hash] = build_dir_path\n\n        test_cmd = util.get_python_cmd_prefix()\n        test_cmd.extend([settings.TEST_RUNNER_SCRIPT, '--engine', bin_path])\n\n        yield job, ret_build, test_cmd\n\ndef run_check(options, runnable, env=None):\n    report_command('Test command:', runnable, env=env)\n\n    if env is not None:\n        full_env = dict(os.environ)\n        full_env.update(env)\n        env = full_env\n\n    with subprocess.Popen(runnable, env=env) as proc:\n        try:\n            proc.wait(timeout=options.run_check_timeout)\n        except subprocess.TimeoutExpired:\n            proc.kill()\n            return -1\n        return proc.returncode\n\ndef run_jerry_debugger_tests(options):\n    ret_build = ret_test = 0\n    for job in DEBUGGER_TEST_OPTIONS:\n        ret_build, build_dir_path = create_binary(job, options)\n        if ret_build:\n            print(f\"\\n{TERM_RED}Build failed{TERM_NORMAL}\\n\")\n            break\n\n        for channel in [\"websocket\", \"rawpacket\"]:\n            for test_file in os.listdir(settings.DEBUGGER_TESTS_DIR):\n                if test_file.endswith(\".cmd\"):\n                    test_case, _ = os.path.splitext(test_file)\n                    test_case_path = os.path.join(settings.DEBUGGER_TESTS_DIR, test_case)\n                    test_cmd = [\n                        settings.DEBUGGER_TEST_RUNNER_SCRIPT,\n                        get_binary_path(build_dir_path),\n                        channel,\n                        settings.DEBUGGER_CLIENT_SCRIPT,\n                        os.path.relpath(test_case_path, settings.PROJECT_DIR)\n                    ]\n\n                    if job.test_args:\n                        test_cmd.extend(job.test_args)\n\n                    ret_test |= run_check(options, test_cmd)\n\n    return ret_build | ret_test\n\ndef run_jerry_tests(options):\n    ret_build = ret_test = 0\n    for job, ret_build, test_cmd in iterate_test_runner_jobs(JERRY_TESTS_OPTIONS, options):\n        if ret_build:\n            break\n\n        test_cmd.append('--test-dir')\n        test_cmd.append(settings.JERRY_TESTS_DIR)\n\n        if options.quiet:\n            test_cmd.append(\"-q\")\n\n        skip_list = []\n\n        if job.name == 'jerry_tests-snapshot':\n            with open(settings.SNAPSHOT_TESTS_SKIPLIST, 'r', encoding='utf8') as snapshot_skip_list:\n                for line in snapshot_skip_list:\n                    skip_list.append(line.rstrip())\n\n        if options.skip_list:\n            skip_list.append(options.skip_list)\n\n        if skip_list:\n            test_cmd.append(\"--skip-list=\" + \",\".join(skip_list))\n\n        if job.test_args:\n            test_cmd.extend(job.test_args)\n\n        ret_test |= run_check(options, test_cmd, env=dict(TZ='UTC'))\n\n    return ret_build | ret_test\n\ndef run_test262_test_suite(options):\n    ret_build = ret_test = 0\n\n    jobs = TEST262_TEST_SUITE_OPTIONS\n\n    for job in jobs:\n        ret_build, build_dir_path = create_binary(job, options)\n        if ret_build:\n            print(f\"\\n{TERM_RED}Build failed{TERM_NORMAL}\\n\")\n            break\n\n        test_cmd = util.get_python_cmd_prefix() + [\n            settings.TEST262_RUNNER_SCRIPT,\n            '--engine', get_binary_path(build_dir_path),\n            '--test262-object',\n            '--test-dir', settings.TEST262_TEST_SUITE_DIR,\n            '--mode', options.test262\n        ]\n\n        if job.test_args:\n            test_cmd.extend(job.test_args)\n\n        if options.test262_test_list:\n            test_cmd.append('--test262-test-list')\n            test_cmd.append(options.test262_test_list)\n\n        ret_test |= run_check(options, test_cmd, env=dict(TZ='America/Los_Angeles'))\n\n    return ret_build | ret_test\n\ndef run_unittests(options):\n    ret_build = ret_test = 0\n    for job in JERRY_UNITTESTS_OPTIONS:\n        if job.skip:\n            report_skip(job)\n            continue\n        ret_build, build_dir_path = create_binary(job, options)\n        if ret_build:\n            print(f\"\\n{TERM_RED}Build failed{TERM_NORMAL}\\n\")\n            break\n\n        build_config = options.build_config\n        if build_config is None:\n            if sys.platform == 'win32':\n                if options.build_debug:\n                    build_config = \"Debug\"\n                else:\n                    build_config = \"MinSizeRel\"\n            else:\n                build_config = \"\"\n\n\n        ret_test |= run_check(\n            options,\n            util.get_python_cmd_prefix() +\n            [settings.UNITTEST_RUNNER_SCRIPT] +\n            [os.path.join(build_dir_path, 'tests', build_config)] +\n            ([\"-q\"] if options.quiet else [])\n        )\n\n    return ret_build | ret_test\n\ndef run_buildoption_test(options):\n    for job in JERRY_BUILDOPTIONS:\n        if job.skip:\n            report_skip(job)\n            continue\n\n        ret, _ = create_binary(job, options)\n        if ret:\n            print(f\"\\n{TERM_RED}Build failed{TERM_NORMAL}\\n\")\n            break\n\n    return ret\n\nCheck = collections.namedtuple('Check', ['enabled', 'runner', 'arg'])\n\ndef main(options):\n    util.setup_stdio()\n    checks = [\n        Check(options.check_signed_off, run_check, [settings.SIGNED_OFF_SCRIPT]\n              + {'tolerant': ['--tolerant'], 'gh-actions': ['--gh-actions']}.get(options.check_signed_off, [])),\n        Check(options.check_cppcheck, run_check, [settings.CPPCHECK_SCRIPT]),\n        Check(options.check_doxygen, run_check, [settings.DOXYGEN_SCRIPT]),\n        Check(options.check_pylint, run_check, [settings.PYLINT_SCRIPT]),\n        Check(options.check_format, run_check, [settings.FORMAT_SCRIPT]),\n        Check(options.check_license, run_check, [settings.LICENSE_SCRIPT]),\n        Check(options.check_strings, run_check, [settings.STRINGS_SCRIPT]),\n        Check(options.jerry_debugger, run_jerry_debugger_tests, None),\n        Check(options.jerry_tests, run_jerry_tests, None),\n        Check(options.test262, run_test262_test_suite, None),\n        Check(options.unittests, run_unittests, None),\n        Check(options.buildoption_test, run_buildoption_test, None),\n    ]\n\n    for check in checks:\n        if check.enabled or options.all:\n            if check.arg is None:\n                ret = check.runner(options)\n            else:\n                ret = check.runner(options, check.arg)\n            if ret:\n                sys.exit(ret)\n\nif __name__ == \"__main__\":\n    main(get_arguments())\n"
  },
  {
    "path": "tools/runners/run-benchmarks.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nENGINE=$1\n\nfunction run ()\n{\n    echo \"Running test: $1.js\"\n        ./tools/perf.sh 5 $ENGINE ./tests/benchmarks/$1.js\n        ./tools/rss-measure.sh $ENGINE ./tests/benchmarks/$1.js\n}\n\necho \"Running Sunspider:\"\n#run jerry/sunspider/3d-morph // too fast\nrun jerry/sunspider/bitops-3bit-bits-in-byte\nrun jerry/sunspider/bitops-bits-in-byte\nrun jerry/sunspider/bitops-bitwise-and\nrun jerry/sunspider/controlflow-recursive\nrun jerry/sunspider/math-cordic\nrun jerry/sunspider/math-partial-sums\nrun jerry/sunspider/math-spectral-norm\n\necho \"Running Jerry:\"\nrun jerry/cse\nrun jerry/cse_loop\nrun jerry/cse_ready_loop\nrun jerry/empty_loop\nrun jerry/function_loop\nrun jerry/loop_arithmetics_10kk\nrun jerry/loop_arithmetics_1kk\n\necho \"Running UBench:\"\nrun ubench/function-closure\nrun ubench/function-empty\nrun ubench/function-correct-args\nrun ubench/function-excess-args\nrun ubench/function-missing-args\nrun ubench/function-sum\nrun ubench/loop-empty-resolve\nrun ubench/loop-empty\nrun ubench/loop-sum\n\n\n"
  },
  {
    "path": "tools/runners/run-debugger-test.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nJERRY=$1\nCHANNEL=$2\nDEBUGGER_CLIENT=$3\nTEST_CASE=$4\nCLIENT_ARGS=\"\"\n\nTERM_NORMAL='\\033[0m'\nTERM_RED='\\033[1;31m'\nTERM_GREEN='\\033[1;32m'\n\nif [[ $TEST_CASE == *\"client_source\"* ]]; then\n  START_DEBUG_SERVER=\"${JERRY} --start-debug-server --debug-channel ${CHANNEL} --debugger-wait-source &\"\n  if [[ $TEST_CASE == *\"client_source_multiple\"* ]]; then\n    CLIENT_ARGS=\"--client-source ${TEST_CASE}_2.js ${TEST_CASE}_1.js\"\n  else\n    CLIENT_ARGS=\"--client-source ${TEST_CASE}.js\"\n  fi\nelse\n  START_DEBUG_SERVER=\"${JERRY} ${TEST_CASE}.js --start-debug-server --debug-channel ${CHANNEL} &\"\nfi\n\necho \"$START_DEBUG_SERVER\"\neval \"$START_DEBUG_SERVER\"\nJERRY_PID=$!\nsleep 1s\n\nRESULT_TEMP=`mktemp ${TEST_CASE}.out.XXXXXXXXXX`\n\n(cat \"${TEST_CASE}.cmd\" | ${DEBUGGER_CLIENT} --channel ${CHANNEL} --non-interactive ${CLIENT_ARGS}) >${RESULT_TEMP} 2>&1\n\nif [[ $TEST_CASE == *\"restart\"* ]]; then\n  CONTINUE_CASE=$(sed \"s/restart/continue/g\" <<< \"$TEST_CASE\")\n  (cat \"${CONTINUE_CASE}.cmd\" | ${DEBUGGER_CLIENT} --channel ${CHANNEL} --non-interactive ${CLIENT_ARGS}) >>${RESULT_TEMP} 2>&1\nfi\n\ndiff -U0 ${TEST_CASE}.expected ${RESULT_TEMP}\nSTATUS_CODE=$?\n\nrm -f ${RESULT_TEMP}\n\nwait $JERRY_PID\nJERRY_EXIT_CODE=$?\nif [ ${STATUS_CODE} -ne 0 ] || [ ${JERRY_EXIT_CODE} -gt 1 ]\nthen\n  echo -e \"${TERM_RED}FAIL: ${TEST_CASE}${TERM_NORMAL}\\n\"\nelse\n  echo -e \"${TERM_GREEN}PASS: ${TEST_CASE}${TERM_NORMAL}\\n\"\nfi\n\nexit ${STATUS_CODE}\n"
  },
  {
    "path": "tools/runners/run-test-suite-test262.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport os\nimport re\nimport subprocess\nimport sys\n\nimport util\n\ndef get_arguments():\n    execution_runtime = os.environ.get('RUNTIME', '')\n    parser = argparse.ArgumentParser()\n    parser.add_argument('--runtime', metavar='FILE', default=execution_runtime,\n                        help='Execution runtime (e.g. qemu)')\n    parser.add_argument('--engine', metavar='FILE', required=True,\n                        help='JerryScript binary to run tests with')\n    parser.add_argument('--test262-object', action='store_true', default=False,\n                        help='JerryScript engine create test262 object')\n    parser.add_argument('--test-dir', metavar='DIR', required=True,\n                        help='Directory contains test262 test suite')\n    group = parser.add_mutually_exclusive_group(required=True)\n    parser.add_argument('--test262-test-list', metavar='LIST',\n                        help='Add a comma separated list of tests or directories to run in test262 test suite')\n    group.add_argument('--mode', default=False, const='default',\n                       nargs='?', choices=['default', 'all', 'update'],\n                       help='Run test262 - default: all tests except excludelist, ' +\n                       'all: all tests, update: all tests and update excludelist')\n\n    args = parser.parse_args()\n\n    args.test_dir = os.path.join(args.test_dir, 'esnext')\n    args.test262_harness_dir = os.path.abspath(os.path.dirname(__file__))\n    args.test262_git_hash = '00f682e7467bd5cb0e5b1f02a7d26420f450aee0'\n    args.excludelist_path = os.path.join('tests', 'test262-excludelist.xml')\n\n    return args\n\n\ndef prepare_test262_test_suite(args):\n    if os.path.isdir(os.path.join(args.test_dir, '.git')):\n        return 0\n\n    return_code = subprocess.call(['git', 'clone', '--no-checkout', '--config', 'core.autocrlf=false',\n                                   'https://github.com/tc39/test262.git', args.test_dir])\n    if return_code:\n        print('Cloning test262 repository failed.')\n        return return_code\n\n    return_code = subprocess.call(['git', 'checkout', args.test262_git_hash], cwd=args.test_dir)\n    assert not return_code, 'Cloning test262 repository failed - invalid git revision.'\n\n    return 0\n\ndef update_exclude_list(args):\n    print(\"=== Summary - updating excludelist ===\\n\")\n    passing_tests = set()\n    failing_tests = set()\n    new_passing_tests = set()\n    with open(os.path.join(os.path.dirname(args.engine), 'test262.report'), 'r', encoding='utf8') as report_file:\n        for line in report_file:\n            match = re.match('(=== )?(.*) (?:failed|passed) in (?:non-strict|strict)', line)\n            if match:\n                (unexpected, test) = match.groups()\n                test = test.replace('\\\\', '/')\n                if unexpected:\n                    failing_tests.add(test + '.js')\n                else:\n                    passing_tests.add(test + '.js')\n\n    # Tests pass in strict-mode but fail in non-strict-mode (or vice versa) should be considered as failures\n    passing_tests = passing_tests - failing_tests\n\n    with open(args.excludelist_path, 'r+', encoding='utf8', errors='ignore') as exclude_file:\n        lines = exclude_file.readlines()\n        exclude_file.seek(0)\n        exclude_file.truncate()\n\n        # Skip the last line \"</excludeList>\" to be able to insert new failing tests.\n        for line in lines[:-1]:\n            match = re.match(r\"  <test id=\\\"(\\S*)\\\">\", line)\n            if match:\n                test = match.group(1)\n                if test in failing_tests:\n                    failing_tests.remove(test)\n                    exclude_file.write(line)\n                elif test in passing_tests:\n                    new_passing_tests.add(test)\n                else:\n                    exclude_file.write(line)\n            else:\n                exclude_file.write(line)\n\n        if failing_tests:\n            print(\"New failing tests added to the excludelist\")\n            for test in sorted(failing_tests):\n                exclude_file.write('  <test id=\"' + test + '\"><reason></reason></test>\\n')\n                print(\"  \" + test)\n            print(\"\")\n\n        exclude_file.write('</excludeList>\\n')\n\n    if new_passing_tests:\n        print(\"New passing tests removed from the excludelist\")\n        for test in sorted(new_passing_tests):\n            print(\"  \" + test)\n        print(\"\")\n\n    if failing_tests or new_passing_tests:\n        print(\"Excludelist was updated succesfully.\")\n        return 1\n\n    print(\"Excludelist was already up-to-date.\")\n    return 0\n\n\ndef main(args):\n    util.setup_stdio()\n    return_code = prepare_test262_test_suite(args)\n    if return_code:\n        return return_code\n\n    if sys.platform == 'win32':\n        original_timezone = util.get_timezone()\n        util.set_sighdl_to_reset_timezone(original_timezone)\n        util.set_timezone('Pacific Standard Time')\n\n    command = (args.runtime + ' ' + args.engine).strip()\n    if args.test262_object:\n        command += ' --test262-object'\n\n    kwargs = {}\n    kwargs['errors'] = 'ignore'\n\n    test262_harness_path = os.path.join(args.test262_harness_dir, 'test262-harness.py')\n\n    test262_command = util.get_python_cmd_prefix() + \\\n                      [test262_harness_path,\n                       '--command', command,\n                       '--tests', args.test_dir,\n                       '--summary']\n\n    if 'excludelist_path' in args and args.mode == 'default':\n        test262_command.extend(['--exclude-list', args.excludelist_path])\n\n    if args.test262_test_list:\n        test262_command.extend(args.test262_test_list.split(','))\n\n    with subprocess.Popen(test262_command, universal_newlines=True, stdout=subprocess.PIPE, **kwargs) as proc:\n\n        return_code = 1\n        with open(os.path.join(os.path.dirname(args.engine), 'test262.report'), 'w', encoding='utf8') as output_file:\n            counter = 0\n            summary_found = False\n            summary_end_found = False\n            while True:\n                output = proc.stdout.readline()\n                if not output:\n                    break\n                output_file.write(output)\n\n                if output.startswith('=== Summary ==='):\n                    summary_found = True\n                    print('')\n\n                if summary_found:\n                    if not summary_end_found:\n                        print(output, end='')\n                        if not output.strip():\n                            summary_end_found = True\n                    if 'All tests succeeded' in output:\n                        return_code = 0\n                elif re.search('in (non-)?strict mode', output):\n                    counter += 1\n                    if (counter % 100) == 0:\n                        print(\".\", end='')\n                    if (counter % 5000) == 0:\n                        print(f\" Executed {counter} tests.\")\n\n        proc.wait()\n\n    if sys.platform == 'win32':\n        util.set_timezone(original_timezone)\n\n    if args.mode == 'update':\n        return_code = update_exclude_list(args)\n\n    return return_code\n\n\nif __name__ == \"__main__\":\n    sys.exit(main(get_arguments()))\n"
  },
  {
    "path": "tools/runners/run-test-suite.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport os\nimport subprocess\nimport sys\n\nimport util\n\ndef get_args():\n    execution_runtime = os.environ.get('RUNTIME')\n    parser = argparse.ArgumentParser()\n    parser.add_argument('-q', '--quiet', action='store_true',\n                        help='Only print out failing tests')\n    parser.add_argument('--runtime', metavar='FILE', default=execution_runtime,\n                        help='Execution runtime (e.g. qemu)')\n    parser.add_argument('--engine', metavar='FILE',\n                        help='JerryScript binary to run tests with')\n    parser.add_argument('--test-list', metavar='FILE',\n                        help='File contains test paths to run')\n    parser.add_argument('--skip-list', metavar='LIST',\n                        help='Add a comma separated list of patterns of the excluded JS-tests')\n    parser.add_argument('--test-dir', metavar='DIR',\n                        help='Directory contains tests to run')\n    parser.add_argument('--snapshot', action='store_true',\n                        help='Snapshot test')\n\n    script_args = parser.parse_args()\n    if script_args.skip_list:\n        script_args.skip_list = script_args.skip_list.split(',')\n    else:\n        script_args.skip_list = []\n\n    return script_args\n\n\ndef get_tests(test_dir, test_list, skip_list):\n    tests = []\n    if test_dir:\n        tests = []\n        for root, _, files in os.walk(test_dir):\n            for test_file in files:\n                if test_file.endswith('.js') or test_file.endswith('.mjs'):\n                    tests.extend([os.path.join(root, test_file)])\n\n    if test_list:\n        dirname = os.path.dirname(test_list)\n        with open(test_list, \"r\", encoding='utf8') as test_list_fd:\n            for test in test_list_fd:\n                tests.append(os.path.join(dirname, test.rstrip()))\n\n    tests.sort()\n\n    def filter_tests(test):\n        for skipped in skip_list:\n            if os.path.normpath(skipped) in os.path.normpath(test):\n                return False\n        return True\n\n    return [test for test in tests if filter_tests(test)]\n\n\ndef execute_test_command(test_cmd):\n    kwargs = {}\n    kwargs['encoding'] = 'unicode_escape'\n    kwargs['errors'] = 'ignore'\n    with subprocess.Popen(test_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,\n                          universal_newlines=True, **kwargs) as process:\n        stdout, _ = process.communicate()\n        return process.returncode, stdout\n\n\ndef main(args):\n    util.setup_stdio()\n    tests = get_tests(args.test_dir, args.test_list, args.skip_list)\n    total = len(tests)\n    if total == 0:\n        print(\"No test to execute.\")\n        return 1\n\n    if sys.platform == 'win32':\n        original_timezone = util.get_timezone()\n        util.set_sighdl_to_reset_timezone(original_timezone)\n        util.set_timezone('UTC')\n\n    if args.snapshot:\n        passed = run_snapshot_tests(args, tests)\n    else:\n        passed = run_normal_tests(args, tests)\n\n    if sys.platform == 'win32':\n        util.set_timezone(original_timezone)\n\n    failed = total - passed\n\n    summary_list = [os.path.relpath(args.engine)]\n    if args.snapshot:\n        summary_list.append('--snapshot')\n    if args.test_dir:\n        summary_list.append(os.path.relpath(args.test_dir))\n    if args.test_list:\n        summary_list.append(os.path.relpath(args.test_list))\n    util.print_test_summary(' '.join(summary_list), total, passed, failed)\n\n    return bool(failed)\n\n\ndef run_normal_tests(args, tests):\n    test_cmd = util.get_platform_cmd_prefix()\n    if args.runtime:\n        test_cmd.append(args.runtime)\n    test_cmd.extend([args.engine, '--call-on-exit', '__checkAsync'])\n\n    total = len(tests)\n    tested = 0\n    passed = 0\n    for test in tests:\n        tested += 1\n        test_path = os.path.relpath(test)\n        is_expected_to_fail = os.path.join(os.path.sep, 'fail', '') in test\n\n        test_argument = []\n        if test.endswith('.mjs'):\n            test_argument.extend(['-m'])\n\n        (returncode, stdout) = execute_test_command(test_cmd + test_argument + [test])\n\n        if (returncode == 0 and not is_expected_to_fail) or (returncode == 1 and is_expected_to_fail):\n            passed += 1\n            if not args.quiet:\n                passed_string = f\"PASS{' (XFAIL)' if is_expected_to_fail else ''}\"\n                util.print_test_result(tested, total, True, passed_string, test_path)\n        else:\n            passed_string = f\"FAIL{' (XPASS)' if returncode == 0 and is_expected_to_fail else ''} ({returncode})\"\n            util.print_test_result(tested, total, False, passed_string, test_path)\n            print(\"================================================\")\n            print(stdout)\n            print(\"================================================\")\n\n    return passed\n\n\ndef run_snapshot_tests(args, tests):\n    execute_snapshot_cmd = util.get_platform_cmd_prefix()\n    generate_snapshot_cmd = util.get_platform_cmd_prefix()\n    if args.runtime:\n        execute_snapshot_cmd.append(args.runtime)\n        generate_snapshot_cmd.append(args.runtime)\n\n    execute_snapshot_cmd.extend([args.engine, '--exec-snapshot', 'js.snapshot'])\n    execute_snapshot_cmd.extend(['--call-on-exit', '__checkAsync'])\n\n    # engine: jerry[.exe] -> snapshot generator: jerry-snapshot[.exe]\n    engine = os.path.splitext(args.engine)\n    generate_snapshot_cmd.append(engine[0] + '-snapshot' + engine[1])\n    generate_snapshot_cmd.append('generate')\n\n    total = len(tests)\n    tested = 0\n    passed = 0\n    for test in tests:\n        tested += 1\n        test_path = os.path.relpath(test)\n        is_expected_to_fail = os.path.join(os.path.sep, 'fail', '') in test\n        (returncode, stdout) = execute_test_command(generate_snapshot_cmd + [test])\n\n        if (returncode == 0) or (returncode == 1 and is_expected_to_fail):\n            if not args.quiet:\n                passed_string = 'PASS' + (' (XFAIL)' if returncode else '')\n                util.print_test_result(tested, total, True, passed_string, test_path, True)\n        else:\n            util.print_test_result(tested, total, False, f'FAIL ({returncode})', test_path, True)\n            print(\"================================================\")\n            print(stdout)\n            print(\"================================================\")\n\n        if returncode:\n            if is_expected_to_fail:\n                passed += 1\n            continue\n\n        (returncode, stdout) = execute_test_command(execute_snapshot_cmd)\n        os.remove('js.snapshot')\n\n        if (returncode == 0 and not is_expected_to_fail) or (returncode == 1 and is_expected_to_fail):\n            passed += 1\n            if not args.quiet:\n                passed_string = f\"PASS{' (XFAIL)' if is_expected_to_fail else ''}\"\n                util.print_test_result(tested, total, True, passed_string, test_path, False)\n        else:\n            passed_string = f\"FAIL{' (XPASS)' if returncode == 0 and is_expected_to_fail else ''} ({returncode})\"\n            util.print_test_result(tested, total, False, passed_string, test_path, False)\n            print(\"================================================\")\n            print(stdout)\n            print(\"================================================\")\n\n    return passed\n\n\nif __name__ == \"__main__\":\n    sys.exit(main(get_args()))\n"
  },
  {
    "path": "tools/runners/run-unittests.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport glob\nimport os\nimport subprocess\nimport sys\n\nimport util\n\n\ndef get_arguments():\n    runtime = os.environ.get('RUNTIME')\n    parser = argparse.ArgumentParser()\n    parser.add_argument('-q', '--quiet', action='store_true',\n                        help='Only print out failing tests')\n    parser.add_argument('--runtime', metavar='FILE', default=runtime,\n                        help='Execution runtime (e.g. qemu)')\n    parser.add_argument('path',\n                        help='Path of test binaries')\n\n    script_args = parser.parse_args()\n    return script_args\n\n\ndef get_unittests(path):\n    unittests = []\n    files = glob.glob(os.path.join(path, 'unit-*'))\n    for testfile in files:\n        if os.path.isfile(testfile) and os.access(testfile, os.X_OK):\n            if sys.platform != 'win32' or testfile.endswith(\".exe\"):\n                unittests.append(testfile)\n    unittests.sort()\n    return unittests\n\n\ndef main(args):\n    util.setup_stdio()\n    unittests = get_unittests(args.path)\n    total = len(unittests)\n    if total == 0:\n        print(\"%s: no unit-* test to execute\", args.path)\n        return 1\n\n    test_cmd = [args.runtime] if args.runtime else []\n\n    tested = 0\n    passed = 0\n    failed = 0\n    for test in unittests:\n        tested += 1\n        test_path = os.path.relpath(test)\n        try:\n            subprocess.check_output(test_cmd + [test], stderr=subprocess.STDOUT, universal_newlines=True)\n            passed += 1\n            if not args.quiet:\n                util.print_test_result(tested, total, True, 'PASS', test_path)\n        except subprocess.CalledProcessError as err:\n            failed += 1\n            util.print_test_result(tested, total, False, f'FAIL ({err.returncode})', test_path)\n            print(\"================================================\")\n            print(err.output)\n            print(\"================================================\")\n\n    util.print_test_summary(os.path.join(os.path.relpath(args.path), \"unit-*\"), total, passed, failed)\n\n    if failed > 0:\n        return 1\n    return 0\n\n\nif __name__ == \"__main__\":\n    sys.exit(main(get_arguments()))\n"
  },
  {
    "path": "tools/runners/test262-harness.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\n# This file is based on work under the following copyright and permission notice:\n# https://github.com/test262-utils/test262-harness-py/blob/master/src/test262.py\n\n# license of test262.py:\n# Copyright 2009 the Sputnik authors.  All rights reserved.\n# This code is governed by the BSD license found in the LICENSE file.\n# This is derived from sputnik.py, the Sputnik console test runner,\n# with elements from packager.py, which is separately\n# copyrighted. TODO: Refactor so there is less duplication between\n# test262.py and packager.py.\n\n# license of _packager.py:\n# Copyright (c) 2012 Ecma International.  All rights reserved.\n# This code is governed by the BSD license found in the LICENSE file.\n\n\nimport logging\nimport argparse\nimport os\nfrom os import path\nimport platform\nimport re\nimport subprocess\nimport sys\nimport tempfile\nimport xml.dom.minidom\nfrom collections import Counter\n\nimport signal\nimport multiprocessing\n\nimport util\n\n# The timeout of each test case\nTEST262_CASE_TIMEOUT = 180\n\nTEST_RE = re.compile(r\"(?P<test1>.*)\\/\\*---(?P<header>.+)---\\*\\/(?P<test2>.*)\", re.DOTALL)\nYAML_INCLUDES_RE = re.compile(r\"includes:\\s+\\[(?P<includes>.+)\\]\")\nYAML_FLAGS_RE = re.compile(r\"flags:\\s+\\[(?P<flags>.+)\\]\")\nYAML_NEGATIVE_RE = re.compile(r\"negative:.*phase:\\s+(?P<phase>\\w+).*type:\\s+(?P<type>\\w+)\", re.DOTALL)\n\nclass Test262Error(Exception):\n    def __init__(self, message):\n        Exception.__init__(self)\n        self.message = message\n\n\ndef report_error(error_string):\n    raise Test262Error(error_string)\n\n\ndef build_options():\n    result = argparse.ArgumentParser()\n    result.add_argument(\"--command\", default=None,\n                        help=\"The command-line to run\")\n    result.add_argument(\"--tests\", default=path.abspath('.'),\n                        help=\"Path to the tests\")\n    result.add_argument(\"--exclude-list\", default=None,\n                        help=\"Path to the excludelist.xml file\")\n    result.add_argument(\"--cat\", default=False, action=\"store_true\",\n                        help=\"Print packaged test code that would be run\")\n    result.add_argument(\"--summary\", default=False, action=\"store_true\",\n                        help=\"Print summary after running tests\")\n    result.add_argument(\"--full-summary\", default=False, action=\"store_true\",\n                        help=\"Print summary and test output after running tests\")\n    result.add_argument(\"--strict_only\", default=False, action=\"store_true\",\n                        help=\"Test only strict mode\")\n    result.add_argument(\"--non_strict_only\", default=False, action=\"store_true\",\n                        help=\"Test only non-strict mode\")\n    result.add_argument(\"--unmarked_default\", default=\"both\",\n                        help=\"default mode for tests of unspecified strictness\")\n    result.add_argument(\"-j\", \"--job-count\", default=None, action=\"store\", type=int,\n                        help=\"Number of parallel test jobs to run. In case of '0' cpu count is used.\")\n    result.add_argument(\"--logname\", help=\"Filename to save stdout to\")\n    result.add_argument(\"--loglevel\", default=\"warning\",\n                        help=\"sets log level to debug, info, warning, error, or critical\")\n    result.add_argument(\"--print-handle\", default=\"print\",\n                        help=\"Command to print from console\")\n    result.add_argument(\"--list-includes\", default=False, action=\"store_true\",\n                        help=\"List includes required by tests\")\n    result.add_argument(\"--module-flag\", default=\"-m\",\n                        help=\"List includes required by tests\")\n    result.add_argument(\"test_list\", nargs='*', default=None)\n    return result\n\n\ndef validate_options(options):\n    if not options.command:\n        report_error(\"A --command must be specified.\")\n    if not path.exists(options.tests):\n        report_error(f\"Couldn't find test path '{options.tests}'\")\n\n\ndef is_windows():\n    actual_platform = platform.system()\n    return actual_platform in ('Windows', 'Microsoft')\n\n\nclass TempFile:\n\n    def __init__(self, suffix=\"\", prefix=\"tmp\", text=False):\n        self.suffix = suffix\n        self.prefix = prefix\n        self.text = text\n        self.file_desc = None\n        self.name = None\n        self.is_closed = False\n        self.open_file()\n\n    def open_file(self):\n        (self.file_desc, self.name) = tempfile.mkstemp(\n            suffix=self.suffix,\n            prefix=self.prefix,\n            text=self.text)\n\n    def write(self, string):\n        os.write(self.file_desc, string.encode('utf8', 'ignore'))\n\n    def read(self):\n        with open(self.name, \"r\", newline='', encoding='utf8', errors='ignore') as file_desc:\n            return file_desc.read()\n\n    def close(self):\n        if not self.is_closed:\n            self.is_closed = True\n            os.close(self.file_desc)\n\n    def dispose(self):\n        try:\n            self.close()\n            os.unlink(self.name)\n        except OSError as os_error:\n            logging.error(\"Error disposing temp file: %s\", os_error)\n\n\nclass TestResult:\n\n    def __init__(self, exit_code, stdout, stderr, case):\n        self.exit_code = exit_code\n        self.stdout = stdout\n        self.stderr = stderr\n        self.case = case\n\n    def report_outcome(self, long_format):\n        name = self.case.get_name()\n        mode = self.case.get_mode()\n\n        if self.exit_code not in (0, 1):\n            sys.stderr.write(f\"==={name} failed in {mode} with negative:{self.case.get_negative_type()}===\\n\")\n            self.write_output(sys.stderr)\n\n        if self.has_unexpected_outcome():\n            if self.case.is_negative():\n                print(f\"=== {name} passed in {mode}, but was expected to fail ===\")\n                print(f\"--- expected error: {self.case.get_negative_type()} ---\\n\")\n            else:\n                if long_format:\n                    print(f\"=== {name} failed in {mode} ===\")\n                else:\n                    print(f\"{name} in {mode}: \")\n            self.write_output(sys.stdout)\n            if long_format:\n                print(\"===\")\n        elif self.case.is_negative():\n            print(f\"{name} failed in {mode} as expected\")\n        else:\n            print(f\"{name} passed in {mode}\")\n\n    def write_output(self, target):\n        out = self.stdout.strip()\n        if out:\n            target.write(f\"--- output --- \\n {out}\")\n        error = self.stderr.strip()\n        if error:\n            target.write(f\"--- errors ---  \\n {error}\")\n\n        target.write(f\"\\n--- exit code: {self.exit_code} ---\\n\")\n\n    def has_failed(self):\n        return self.exit_code != 0\n\n    def async_has_failed(self):\n        return 'Test262:AsyncTestComplete' not in self.stdout\n\n    def has_unexpected_outcome(self):\n        if self.case.is_negative():\n            return not (self.has_failed() and self.case.negative_match(self.get_error_output()))\n\n        if self.case.is_async_test():\n            return self.async_has_failed() or self.has_failed()\n\n        return self.has_failed()\n\n    def get_error_output(self):\n        if self.stderr:\n            return self.stderr\n        return self.stdout\n\n\nclass TestCase:\n\n    def __init__(self, suite, name, full_path, strict_mode, command_template, module_flag):\n        self.suite = suite\n        self.name = name\n        self.full_path = full_path\n        self.strict_mode = strict_mode\n        self.command_template = command_template\n        self.module_flag = module_flag\n        self.test_record = {}\n        self.parse_test_record()\n        self.validate()\n\n    def parse_test_record(self):\n        with open(self.full_path, \"r\", newline='', encoding='utf8', errors='ignore') as file_desc:\n            full_test = file_desc.read()\n\n        match = TEST_RE.search(full_test)\n        header = match.group(\"header\")\n        self.test = match.group(\"test1\") + match.group(\"test2\")\n\n        match = YAML_INCLUDES_RE.search(header)\n\n        if match:\n            self.test_record[\"includes\"] = [inc.strip() for inc in match.group(\"includes\").split(\",\") if inc]\n\n        match = YAML_FLAGS_RE.search(header)\n        self.test_record[\"flags\"] = [flag.strip() for flag in match.group(\"flags\").split(\",\") if flag] if match else []\n\n        match = YAML_NEGATIVE_RE.search(header)\n        if match:\n            self.test_record[\"negative\"] = {\n                \"phase\" : match.group(\"phase\"),\n                \"type\" : match.group(\"type\")\n            }\n\n    def negative_match(self, stderr):\n        neg = re.compile(self.get_negative_type())\n        return re.search(neg, stderr)\n\n    def get_negative(self):\n        if not self.is_negative():\n            return None\n        return self.test_record[\"negative\"]\n\n    def get_negative_type(self):\n        negative = self.get_negative()\n        if isinstance(negative, dict) and \"type\" in negative:\n            return negative[\"type\"]\n        return negative\n\n    def get_negative_phase(self):\n        negative = self.get_negative()\n        return negative and \"phase\" in negative and negative[\"phase\"]\n\n    def get_name(self):\n        return path.join(*self.name)\n\n    def get_mode(self):\n        if self.strict_mode:\n            return \"strict mode\"\n        return \"non-strict mode\"\n\n    def get_path(self):\n        return self.name\n\n    def is_negative(self):\n        return 'negative' in self.test_record\n\n    def is_only_strict(self):\n        return 'onlyStrict' in self.test_record[\"flags\"]\n\n    def is_no_strict(self):\n        return 'noStrict' in self.test_record[\"flags\"] or self.is_raw()\n\n    def is_raw(self):\n        return 'raw' in self.test_record[\"flags\"]\n\n    def is_async_test(self):\n        return 'async' in self.test_record[\"flags\"] or '$DONE' in self.test\n\n    def is_module(self):\n        return 'module' in self.test_record[\"flags\"]\n\n    def get_include_list(self):\n        if self.test_record.get('includes'):\n            return self.test_record['includes']\n        return []\n\n    def get_additional_includes(self):\n        return '\\n'.join([self.suite.get_include(include) for include in self.get_include_list()])\n\n    def get_source(self):\n        if self.is_raw():\n            return self.test\n\n        source = self.suite.get_include(\"sta.js\") + \\\n            self.suite.get_include(\"assert.js\")\n\n        if self.is_async_test():\n            source = source + \\\n                self.suite.get_include(\"timer.js\") + \\\n                self.suite.get_include(\"doneprintHandle.js\").replace(\n                    'print', self.suite.print_handle)\n\n        source = source + \\\n            self.get_additional_includes() + \\\n            self.test + '\\n'\n\n        if self.get_negative_phase() == \"early\":\n            source = (\"throw 'Expected an early error, but code was executed.';\\n\" +\n                      source)\n\n        if self.strict_mode:\n            source = '\"use strict\";\\nvar strict_mode = true;\\n' + source\n        else:\n            # add comment line so line numbers match in both strict and non-strict version\n            source = '//\"no strict\";\\nvar strict_mode = false;\\n' + source\n\n        return source\n\n    @staticmethod\n    def instantiate_template(template, params):\n        def get_parameter(match):\n            key = match.group(1)\n            return params.get(key, match.group(0))\n\n        return re.sub(r\"\\{\\{(\\w+)\\}\\}\", get_parameter, template)\n\n    @staticmethod\n    def execute(command):\n        if is_windows():\n            args = f'{command}'\n        else:\n            args = command.split(\" \")\n        stdout = TempFile(prefix=\"test262-out-\")\n        stderr = TempFile(prefix=\"test262-err-\")\n        try:\n            logging.info(\"exec: %s\", str(args))\n            with subprocess.Popen(\n                args,\n                shell=False,\n                stdout=stdout.file_desc,\n                stderr=stderr.file_desc\n            ) as process:\n                try:\n                    code = process.wait(timeout=TEST262_CASE_TIMEOUT)\n                except subprocess.TimeoutExpired:\n                    process.kill()\n                out = stdout.read()\n                err = stderr.read()\n        finally:\n            stdout.dispose()\n            stderr.dispose()\n        return (code, out, err)\n\n    def run_test_in(self, tmp):\n        tmp.write(self.get_source())\n        tmp.close()\n\n        if self.is_module():\n            arg = self.module_flag + ' ' + tmp.name\n        else:\n            arg = tmp.name\n\n        command = TestCase.instantiate_template(self.command_template, {\n            'path': arg\n        })\n\n        (code, out, err) = TestCase.execute(command)\n        return TestResult(code, out, err, self)\n\n    def run(self):\n        tmp = TempFile(suffix=\".js\", prefix=\"test262-\")\n        try:\n            result = self.run_test_in(tmp)\n        finally:\n            tmp.dispose()\n        return result\n\n    def print_source(self):\n        print(self.get_source())\n\n    def validate(self):\n        flags = self.test_record.get(\"flags\")\n        phase = self.get_negative_phase()\n\n        if phase not in [None, False, \"parse\", \"early\", \"runtime\", \"resolution\"]:\n            raise TypeError(\"Invalid value for negative phase: \" + phase)\n\n        if not flags:\n            return\n\n        if 'raw' in flags:\n            if 'noStrict' in flags:\n                raise TypeError(\"The `raw` flag implies the `noStrict` flag\")\n            if 'onlyStrict' in flags:\n                raise TypeError(\n                    \"The `raw` flag is incompatible with the `onlyStrict` flag\")\n            if self.get_include_list():\n                raise TypeError(\n                    \"The `raw` flag is incompatible with the `includes` tag\")\n\n\ndef pool_init():\n    \"\"\"Ignore CTRL+C in the worker process.\"\"\"\n    signal.signal(signal.SIGINT, signal.SIG_IGN)\n\n\ndef test_case_run_process(case):\n    return case.run()\n\n\nclass ProgressIndicator:\n\n    def __init__(self, count):\n        self.count = count\n        self.succeeded = 0\n        self.failed = 0\n        self.failed_tests = []\n\n    def has_run(self, result):\n        result.report_outcome(True)\n        if result.has_unexpected_outcome():\n            self.failed += 1\n            self.failed_tests.append(result)\n        else:\n            self.succeeded += 1\n\n\ndef percent_format(partial, total):\n    return f\"{partial} test{'s' if partial > 1 else ''} ({(100.0 * partial)/total:.1f}%)\"\n\n\nclass TestSuite:\n\n    def __init__(self, options):\n        self.test_root = path.join(options.tests, 'test')\n        self.lib_root = path.join(options.tests, 'harness')\n        self.strict_only = options.strict_only\n        self.non_strict_only = options.non_strict_only\n        self.unmarked_default = options.unmarked_default\n        self.print_handle = options.print_handle\n        self.include_cache = {}\n        self.exclude_list_path = options.exclude_list\n        self.module_flag = options.module_flag\n        self.logf = None\n\n    def _load_excludes(self):\n        if self.exclude_list_path and os.path.exists(self.exclude_list_path):\n            xml_document = xml.dom.minidom.parse(self.exclude_list_path)\n            xml_tests = xml_document.getElementsByTagName(\"test\")\n            return {x.getAttribute(\"id\") for x in xml_tests}\n\n        return set()\n\n    def validate(self):\n        if not path.exists(self.test_root):\n            report_error(\"No test repository found\")\n        if not path.exists(self.lib_root):\n            report_error(\"No test library found\")\n\n    @staticmethod\n    def is_hidden(test_path):\n        return test_path.startswith('.') or test_path == 'CVS'\n\n    @staticmethod\n    def is_test_case(test_path):\n        return test_path.endswith('.js') and not test_path.endswith('_FIXTURE.js')\n\n    @staticmethod\n    def should_run(rel_path, tests):\n        if not tests:\n            return True\n        for test in tests:\n            if os.path.normpath(test) in os.path.normpath(rel_path):\n                return True\n        return False\n\n    def get_include(self, name):\n        if not name in self.include_cache:\n            static = path.join(self.lib_root, name)\n            if path.exists(static):\n                with open(static, encoding='utf8', errors='ignore') as file_desc:\n                    contents = file_desc.read()\n                    contents = re.sub(r'\\r\\n', '\\n', contents)\n                    self.include_cache[name] = contents + \"\\n\"\n            else:\n                report_error(\"Can't find: \" + static)\n        return self.include_cache[name]\n\n    def enumerate_tests(self, tests, command_template):\n        exclude_list = self._load_excludes()\n\n        logging.info(\"Listing tests in %s\", self.test_root)\n        cases = []\n        for root, dirs, files in os.walk(self.test_root):\n            for hidden_dir in [x for x in dirs if self.is_hidden(x)]:\n                dirs.remove(hidden_dir)\n            dirs.sort()\n            for test_path in filter(TestSuite.is_test_case, sorted(files)):\n                full_path = path.join(root, test_path)\n                if full_path.startswith(self.test_root):\n                    rel_path = full_path[len(self.test_root)+1:]\n                else:\n                    logging.warning(\"Unexpected path %s\", full_path)\n                    rel_path = full_path\n                if self.should_run(rel_path, tests):\n                    basename = path.basename(full_path)[:-3]\n                    name = rel_path.split(path.sep)[:-1] + [basename]\n                    if rel_path in exclude_list:\n                        print('Excluded: ' + rel_path)\n                    else:\n                        if not self.non_strict_only:\n                            strict_case = TestCase(self, name, full_path, True, command_template, self.module_flag)\n                            if not strict_case.is_no_strict():\n                                if strict_case.is_only_strict() or self.unmarked_default in ['both', 'strict']:\n                                    cases.append(strict_case)\n                        if not self.strict_only:\n                            non_strict_case = TestCase(self, name, full_path, False, command_template, self.module_flag)\n                            if not non_strict_case.is_only_strict():\n                                if non_strict_case.is_no_strict() or self.unmarked_default in ['both', 'non_strict']:\n                                    cases.append(non_strict_case)\n        logging.info(\"Done listing tests\")\n        return cases\n\n    def print_summary(self, progress, logfile):\n\n        def write(string):\n            if logfile:\n                self.logf.write(string + \"\\n\")\n            print(string)\n\n        print(\"\")\n        write(\"=== Summary ===\")\n        count = progress.count\n        succeeded = progress.succeeded\n        failed = progress.failed\n        write(f\" - Ran {count} test{'s' if count > 1 else ''}\")\n        if progress.failed == 0:\n            write(\" - All tests succeeded\")\n        else:\n            write(\" - Passed \" + percent_format(succeeded, count))\n            write(\" - Failed \" + percent_format(failed, count))\n            positive = [c for c in progress.failed_tests if not c.case.is_negative()]\n            negative = [c for c in progress.failed_tests if c.case.is_negative()]\n            if positive:\n                print(\"\")\n                write(\"Failed Tests\")\n                for result in positive:\n                    write(f\"  {result.case.get_name()} in {result.case.get_mode()}\")\n            if negative:\n                print(\"\")\n                write(\"Expected to fail but passed ---\")\n                for result in negative:\n                    write(f\"  {result.case.get_name()} in {result.case.get_mode()}\")\n\n    def print_failure_output(self, progress, logfile):\n        for result in progress.failed_tests:\n            if logfile:\n                self.write_log(result)\n            print(\"\")\n            result.report_outcome(False)\n\n    def run(self, command_template, tests, print_summary, full_summary, logname, job_count=1):\n        if not \"{{path}}\" in command_template:\n            command_template += \" {{path}}\"\n        cases = self.enumerate_tests(tests, command_template)\n        if not cases:\n            report_error(\"No tests to run\")\n        progress = ProgressIndicator(len(cases))\n        if logname:\n            self.logf = open(logname, \"w\", encoding='utf8', errors='ignore')  # pylint: disable=consider-using-with\n\n        if job_count == 1:\n            for case in cases:\n                result = case.run()\n                if logname:\n                    self.write_log(result)\n                progress.has_run(result)\n        else:\n            if job_count == 0:\n                job_count = None # uses multiprocessing.cpu_count()\n\n            with multiprocessing.Pool(processes=job_count, initializer=pool_init) as pool:\n                for result in pool.imap(test_case_run_process, cases):\n                    if logname:\n                        self.write_log(result)\n                    progress.has_run(result)\n\n        if print_summary:\n            self.print_summary(progress, logname)\n            if full_summary:\n                self.print_failure_output(progress, logname)\n            else:\n                print(\"\")\n                print(\"Use --full-summary to see output from failed tests\")\n        print(\"\")\n        return progress.failed\n\n    def write_log(self, result):\n        name = result.case.get_name()\n        mode = result.case.get_mode()\n        if result.has_unexpected_outcome():\n            if result.case.is_negative():\n                self.logf.write(\n                    f\"=== {name} passed in {mode}, but was expected to fail === \\n\")\n                self.logf.write(f\"--- expected error: {result.case.GetNegativeType()} ---\\n\")\n                result.write_output(self.logf)\n            else:\n                self.logf.write(f\"=== {name} failed in {mode} === \\n\")\n                result.write_output(self.logf)\n            self.logf.write(\"===\\n\")\n        elif result.case.is_negative():\n            self.logf.write(f\"{name} failed in {mode} as expected \\n\")\n        else:\n            self.logf.write(f\"{name} passed in {mode} \\n\")\n\n    def print_source(self, tests):\n        cases = self.enumerate_tests(tests, \"\")\n        if cases:\n            cases[0].print_source()\n\n    def list_includes(self, tests):\n        cases = self.enumerate_tests(tests, \"\")\n        includes_dict = Counter()\n        for case in cases:\n            includes = case.get_include_list()\n            includes_dict.update(includes)\n\n        print(includes_dict)\n\n\ndef main():\n    util.setup_stdio()\n    code = 0\n    parser = build_options()\n    options = parser.parse_args()\n    args = options.test_list\n    validate_options(options)\n\n    test_suite = TestSuite(options)\n\n    test_suite.validate()\n    if options.loglevel == 'debug':\n        logging.basicConfig(level=logging.DEBUG)\n    elif options.loglevel == 'info':\n        logging.basicConfig(level=logging.INFO)\n    elif options.loglevel == 'warning':\n        logging.basicConfig(level=logging.WARNING)\n    elif options.loglevel == 'error':\n        logging.basicConfig(level=logging.ERROR)\n    elif options.loglevel == 'critical':\n        logging.basicConfig(level=logging.CRITICAL)\n\n    if options.cat:\n        test_suite.print_source(args)\n    elif options.list_includes:\n        test_suite.list_includes(args)\n    else:\n        code = test_suite.run(options.command, args,\n                              options.summary or options.full_summary,\n                              options.full_summary,\n                              options.logname,\n                              options.job_count)\n    return code\n\n\nif __name__ == '__main__':\n    try:\n        sys.exit(main())\n    except Test262Error as exception:\n        print(f\"Error: {exception.message}\")\n        sys.exit(1)\n"
  },
  {
    "path": "tools/runners/util.py",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport codecs\nimport signal\nimport subprocess\nimport sys\n\nif sys.platform == 'win32':\n    TERM_NORMAL = ''\n    TERM_RED = ''\n    TERM_GREEN = ''\n    TERM_YELLOW = ''\n    TERM_BLUE = ''\nelse:\n    TERM_NORMAL = '\\033[0m'\n    TERM_RED = '\\033[1;31m'\n    TERM_GREEN = '\\033[1;32m'\n    TERM_YELLOW = '\\033[1;33m'\n    TERM_BLUE = '\\033[1;34m'\n\n\ndef set_timezone(timezone):\n    assert sys.platform == 'win32', \"set_timezone is Windows only function\"\n    subprocess.call(['cmd', '/S', '/C', 'tzutil', '/s', timezone])\n\n\ndef set_timezone_and_exit(timezone):\n    assert sys.platform == 'win32', \"set_timezone_and_exit is Windows only function\"\n    set_timezone(timezone)\n    sys.exit(1)\n\n\ndef get_timezone():\n    assert sys.platform == 'win32', \"get_timezone is Windows only function\"\n    return subprocess.check_output(['cmd', '/S', '/C', 'tzutil', '/g'], universal_newlines=True)\n\n\ndef set_sighdl_to_reset_timezone(timezone):\n    assert sys.platform == 'win32', \"install_signal_handler_to_restore_timezone is Windows only function\"\n    signal.signal(signal.SIGINT, lambda signal, frame: set_timezone_and_exit(timezone))\n\n\n# This is for not lost data on 'win32' with python 'print'.\n# When use python subprocess call another script on win32, output with\n# 'utf-8' encoding, that's the same like linux platform; but when\n# call the python script in 'cmd.exe' shell, we have to output in 'native' encoding.\ndef setup_stdio():\n    # For tty using native encoding, otherwise (pipe) use 'utf-8'\n    encoding = sys.stdout.encoding if sys.stdout.isatty() else 'utf-8'\n    # Always override it to avoid encode error\n    sys.stdout = codecs.getwriter(encoding)(sys.stdout.buffer, 'xmlcharrefreplace')\n    sys.stderr = codecs.getwriter(encoding)(sys.stderr.buffer, 'xmlcharrefreplace')\n\n\ndef print_test_summary(summary_string, total, passed, failed):\n    print(f\"\\n[summary] {summary_string}\\n\")\n    print(f\"TOTAL: {total}\")\n    print(f\"{TERM_GREEN}PASS: {passed}{TERM_NORMAL}\")\n    print(f\"{TERM_RED}FAIL: {failed}{TERM_NORMAL}\\n\")\n\n    success_color = TERM_GREEN if passed == total else TERM_RED\n    print(f\"{success_color}Success: {passed*100/total}{TERM_NORMAL}\")\n\n\ndef print_test_result(tested, total, is_passed, passed_string, test_path, is_snapshot_generation=None):\n    if is_snapshot_generation is None:\n        snapshot_string = ''\n    elif is_snapshot_generation:\n        snapshot_string = ' (generate snapshot)'\n    else:\n        snapshot_string = ' (execute snapshot)'\n\n    color = TERM_GREEN if is_passed else TERM_RED\n    print(f\"[{tested:>4}/{total:>4}] {color}{passed_string}: {test_path}{snapshot_string}{TERM_NORMAL}\")\n\n\ndef get_platform_cmd_prefix():\n    if sys.platform == 'win32':\n        return ['cmd', '/S', '/C']\n    return []\n\n\ndef get_python_cmd_prefix():\n    # python script doesn't have execute permission on github actions windows runner\n    return [sys.executable or 'python']\n"
  },
  {
    "path": "tools/settings.py",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom os import path\n\nTOOLS_DIR = path.dirname(path.abspath(__file__))\nPROJECT_DIR = path.normpath(path.join(TOOLS_DIR, '..'))\nDEBUGGER_TESTS_DIR = path.join(PROJECT_DIR, 'tests/debugger')\nJERRY_TESTS_DIR = path.join(PROJECT_DIR, 'tests/jerry')\nTEST262_TEST_SUITE_DIR = path.join(PROJECT_DIR, 'tests/test262')\nSNAPSHOT_TESTS_SKIPLIST = path.join(PROJECT_DIR, 'tests/snapshot-tests-skiplist.txt')\n\nBUILD_SCRIPT = path.join(TOOLS_DIR, 'build.py')\nCPPCHECK_SCRIPT = path.join(TOOLS_DIR, 'check-cppcheck.sh')\nDEBUGGER_CLIENT_SCRIPT = path.join(PROJECT_DIR, 'jerry-debugger/jerry_client.py')\nDEBUGGER_TEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-debugger-test.sh')\nDOXYGEN_SCRIPT = path.join(TOOLS_DIR, 'check-doxygen.sh')\nLICENSE_SCRIPT = path.join(TOOLS_DIR, 'check-license.py')\nSTRINGS_SCRIPT = path.join(TOOLS_DIR, 'check-strings.sh')\nPYLINT_SCRIPT = path.join(TOOLS_DIR, 'check-pylint.sh')\nSIGNED_OFF_SCRIPT = path.join(TOOLS_DIR, 'check-signed-off.sh')\nTEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-test-suite.py')\nTEST262_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-test-suite-test262.py')\nFORMAT_SCRIPT = path.join(TOOLS_DIR, 'check-format.py')\nUNITTEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-unittests.py')\n"
  },
  {
    "path": "tools/unit-tests/Makefile",
    "content": "# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nCC=gcc\nLDFLAGS=-lm\n\nGENS=gen-test-math\n\n.PHONY: build\nbuild: $(GENS)\n\n.PHONY: clean\nclean:\n\trm -f $(GENS)\n\ngen-test-math: gen-test-math.c\n\t$(CC) $< -o $@ $(LDFLAGS)\n"
  },
  {
    "path": "tools/unit-tests/gen-test-math.c",
    "content": "/* Copyright JS Foundation and other contributors, http://js.foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Unit test generator for jerry-math.\n * To be compiled separately from the rest of jerry and to be linked to a trusted libm.\n * Its output should be redirected to test-math.inc.h.\n *\n * Example:\n * gcc gen-test-math.c -o gen-test-math -lm\n * ./gen-test-math >test-math.inc.h\n */\n\n#include <math.h>\n#include <stdio.h>\n\n#define GEN_INT_TEST(EXPR) printf(\"check_int (\\\"%s\\\", %s, %d);\\n\", #EXPR, #EXPR, EXPR);\n#define GEN_DBL_TEST(EXPR) printf(\"check_double (\\\"%s\\\", %s, %.20E);\\n\", #EXPR, #EXPR, EXPR);\n\nint\nmain (int argc, char **args)\n{\n  printf (\"/* Copyright JS Foundation and other contributors, http://js.foundation\\n\"\n          \" *\\n\"\n          \" * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n\"\n          \" * you may not use this file except in compliance with the License.\\n\"\n          \" * You may obtain a copy of the License at\\n\"\n          \" *\\n\"\n          \" *     http://www.apache.org/licenses/LICENSE-2.0\\n\"\n          \" *\\n\"\n          \" * Unless required by applicable law or agreed to in writing, software\\n\"\n          \" * distributed under the License is distributed on an \\\"AS IS\\\" BASIS\\n\"\n          \" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n\"\n          \" * See the License for the specific language governing permissions and\\n\"\n          \" * limitations under the License.\\n\"\n          \" */\\n\"\n          \"\\n\"\n          \"/* This file is automatically generated by the gen-test-math.sh script.\\n\"\n          \" * Do not edit! */\\n\"\n          \"\\n\");\n\n  /* acos tests */\n  GEN_DBL_TEST (acos (0.0));\n  GEN_DBL_TEST (acos (-0.0));\n  GEN_DBL_TEST (acos (1.0));\n  GEN_DBL_TEST (acos (-1.0));\n  GEN_DBL_TEST (acos (0.5));\n  GEN_DBL_TEST (acos (-0.5));\n  GEN_DBL_TEST (acos (INFINITY));\n  GEN_DBL_TEST (acos (-INFINITY));\n  GEN_DBL_TEST (acos (NAN));\n  GEN_DBL_TEST (acos (6.9e-18));\n  GEN_DBL_TEST (acos (-6.9e-18));\n  GEN_DBL_TEST (acos (7.0e-18));\n  GEN_DBL_TEST (acos (-7.0e-18));\n  GEN_DBL_TEST (acos (7.4e-9));\n  GEN_DBL_TEST (acos (-7.4e-9));\n  GEN_DBL_TEST (acos (7.5e-9));\n  GEN_DBL_TEST (acos (-7.5e-9));\n  GEN_DBL_TEST (acos (0.1));\n  GEN_DBL_TEST (acos (-0.1));\n  GEN_DBL_TEST (acos (0.4));\n  GEN_DBL_TEST (acos (-0.4));\n  GEN_DBL_TEST (acos (0.6));\n  GEN_DBL_TEST (acos (-0.6));\n  GEN_DBL_TEST (acos (0.99));\n  GEN_DBL_TEST (acos (-0.99));\n  GEN_DBL_TEST (acos (1.1));\n  GEN_DBL_TEST (acos (-1.1));\n  GEN_DBL_TEST (acos (0.7));\n\n  /* asin tests*/\n  GEN_DBL_TEST (asin (0.0));\n  GEN_DBL_TEST (asin (-0.0));\n  GEN_DBL_TEST (asin (1.0));\n  GEN_DBL_TEST (asin (-1.0));\n  GEN_DBL_TEST (asin (0.5));\n  GEN_DBL_TEST (asin (-0.5));\n  GEN_DBL_TEST (asin (0.98));\n  GEN_DBL_TEST (asin (-0.98));\n  GEN_DBL_TEST (asin (INFINITY));\n  GEN_DBL_TEST (asin (-INFINITY));\n  GEN_DBL_TEST (asin (NAN));\n  GEN_DBL_TEST (asin (6.9e-18));\n  GEN_DBL_TEST (asin (-6.9e-18));\n  GEN_DBL_TEST (asin (7.0e-18));\n  GEN_DBL_TEST (asin (-7.0e-18));\n  GEN_DBL_TEST (asin (7.4e-9));\n  GEN_DBL_TEST (asin (-7.4e-9));\n  GEN_DBL_TEST (asin (7.5e-9));\n  GEN_DBL_TEST (asin (-7.5e-9));\n  GEN_DBL_TEST (asin (0.1));\n  GEN_DBL_TEST (asin (-0.1));\n  GEN_DBL_TEST (asin (0.4));\n  GEN_DBL_TEST (asin (-0.4));\n  GEN_DBL_TEST (asin (0.6));\n  GEN_DBL_TEST (asin (-0.6));\n  GEN_DBL_TEST (asin (0.97));\n  GEN_DBL_TEST (asin (-0.97));\n  GEN_DBL_TEST (asin (0.99));\n  GEN_DBL_TEST (asin (-0.99));\n  GEN_DBL_TEST (asin (1.1));\n  GEN_DBL_TEST (asin (-1.1));\n  GEN_DBL_TEST (asin (0.7));\n\n  /* atan tests*/\n  GEN_DBL_TEST (atan (0.0));\n  GEN_DBL_TEST (atan (-0.0));\n  GEN_DBL_TEST (atan (7.0 / 16.0));\n  GEN_DBL_TEST (atan (-7.0 / 16.0));\n  GEN_DBL_TEST (atan (11.0 / 16.0));\n  GEN_DBL_TEST (atan (-11.0 / 16.0));\n  GEN_DBL_TEST (atan (19.0 / 16.0));\n  GEN_DBL_TEST (atan (-19.0 / 16.0));\n  GEN_DBL_TEST (atan (39.0 / 16.0));\n  GEN_DBL_TEST (atan (-39.0 / 16.0));\n  GEN_DBL_TEST (atan (1.0));\n  GEN_DBL_TEST (atan (-1.0));\n  GEN_DBL_TEST (atan (INFINITY));\n  GEN_DBL_TEST (atan (-INFINITY));\n  GEN_DBL_TEST (atan (NAN));\n  GEN_DBL_TEST (atan (6.9 / 16.0));\n  GEN_DBL_TEST (atan (-6.9 / 16.0));\n  GEN_DBL_TEST (atan (7.1 / 16.0));\n  GEN_DBL_TEST (atan (-7.1 / 16.0));\n  GEN_DBL_TEST (atan (10.9 / 16.0));\n  GEN_DBL_TEST (atan (-10.9 / 16.0));\n  GEN_DBL_TEST (atan (11.1 / 16.0));\n  GEN_DBL_TEST (atan (-11.1 / 16.0));\n  GEN_DBL_TEST (atan (18.9 / 16.0));\n  GEN_DBL_TEST (atan (-18.9 / 16.0));\n  GEN_DBL_TEST (atan (19.1 / 16.0));\n  GEN_DBL_TEST (atan (-19.1 / 16.0));\n  GEN_DBL_TEST (atan (38.9 / 16.0));\n  GEN_DBL_TEST (atan (-38.9 / 16.0));\n  GEN_DBL_TEST (atan (39.1 / 16.0));\n  GEN_DBL_TEST (atan (-39.1 / 16.0));\n  GEN_DBL_TEST (atan (0.99));\n  GEN_DBL_TEST (atan (-0.99));\n  GEN_DBL_TEST (atan (1.1));\n  GEN_DBL_TEST (atan (-1.1));\n  GEN_DBL_TEST (atan (7.37e+19));\n  GEN_DBL_TEST (atan (-7.37e+19));\n  GEN_DBL_TEST (atan (7.38e+19));\n  GEN_DBL_TEST (atan (-7.38e+19));\n  GEN_DBL_TEST (atan (0.7));\n\n  /* atan2 tests*/\n  GEN_DBL_TEST (atan2 (NAN, NAN));\n  GEN_DBL_TEST (atan2 (0.0, NAN));\n  GEN_DBL_TEST (atan2 (-0.0, NAN));\n  GEN_DBL_TEST (atan2 (1.0, NAN));\n  GEN_DBL_TEST (atan2 (-1.0, NAN));\n  GEN_DBL_TEST (atan2 (INFINITY, NAN));\n  GEN_DBL_TEST (atan2 (-INFINITY, NAN));\n  GEN_DBL_TEST (atan2 (NAN, 0.0));\n  GEN_DBL_TEST (atan2 (NAN, -0.0));\n  GEN_DBL_TEST (atan2 (NAN, 1.0));\n  GEN_DBL_TEST (atan2 (NAN, -1.0));\n  GEN_DBL_TEST (atan2 (NAN, INFINITY));\n  GEN_DBL_TEST (atan2 (NAN, -INFINITY));\n  GEN_DBL_TEST (atan2 (0.0, 0.0));\n  GEN_DBL_TEST (atan2 (0.0, -0.0));\n  GEN_DBL_TEST (atan2 (-0.0, 0.0));\n  GEN_DBL_TEST (atan2 (-0.0, -0.0));\n  GEN_DBL_TEST (atan2 (0.0, 1.0));\n  GEN_DBL_TEST (atan2 (0.0, -1.0));\n  GEN_DBL_TEST (atan2 (0.0, INFINITY));\n  GEN_DBL_TEST (atan2 (0.0, -INFINITY));\n  GEN_DBL_TEST (atan2 (-0.0, 1.0));\n  GEN_DBL_TEST (atan2 (-0.0, -1.0));\n  GEN_DBL_TEST (atan2 (-0.0, INFINITY));\n  GEN_DBL_TEST (atan2 (-0.0, -INFINITY));\n  GEN_DBL_TEST (atan2 (1.0, 0.0));\n  GEN_DBL_TEST (atan2 (1.0, -0.0));\n  GEN_DBL_TEST (atan2 (INFINITY, 0.0));\n  GEN_DBL_TEST (atan2 (INFINITY, -0.0));\n  GEN_DBL_TEST (atan2 (-1.0, 0.0));\n  GEN_DBL_TEST (atan2 (-1.0, -0.0));\n  GEN_DBL_TEST (atan2 (-INFINITY, 0.0));\n  GEN_DBL_TEST (atan2 (-INFINITY, -0.0));\n  GEN_DBL_TEST (atan2 (1.0, INFINITY));\n  GEN_DBL_TEST (atan2 (-1.0, INFINITY));\n  GEN_DBL_TEST (atan2 (1.0, -INFINITY));\n  GEN_DBL_TEST (atan2 (-1.0, -INFINITY));\n  GEN_DBL_TEST (atan2 (INFINITY, INFINITY));\n  GEN_DBL_TEST (atan2 (INFINITY, -INFINITY));\n  GEN_DBL_TEST (atan2 (-INFINITY, INFINITY));\n  GEN_DBL_TEST (atan2 (-INFINITY, -INFINITY));\n  GEN_DBL_TEST (atan2 (INFINITY, 1.0));\n  GEN_DBL_TEST (atan2 (INFINITY, -1.0));\n  GEN_DBL_TEST (atan2 (-INFINITY, 1.0));\n  GEN_DBL_TEST (atan2 (-INFINITY, -1.0));\n  GEN_DBL_TEST (atan2 (0.7, 1.0));\n  GEN_DBL_TEST (atan2 (-0.7, 1.0));\n  GEN_DBL_TEST (atan2 (0.7, -1.0));\n  GEN_DBL_TEST (atan2 (-0.7, -1.0));\n  GEN_DBL_TEST (atan2 (0.4, 0.0003));\n  GEN_DBL_TEST (atan2 (1.4, -0.93));\n\n  /* acosh tests */\n  GEN_DBL_TEST (acosh (0.0));\n  GEN_DBL_TEST (acosh (-0.0));\n  GEN_DBL_TEST (acosh (1.0));\n  GEN_DBL_TEST (acosh (-1.0));\n  GEN_DBL_TEST (acosh (INFINITY));\n  GEN_DBL_TEST (acosh (-INFINITY));\n  GEN_DBL_TEST (acosh (NAN));\n  GEN_DBL_TEST (acosh (7.08e+02));\n  GEN_DBL_TEST (acosh (7.10e+02));\n  GEN_DBL_TEST (acosh (-7.40e+02));\n  GEN_DBL_TEST (acosh (-7.50e+02));\n  GEN_DBL_TEST (acosh (0.34));\n  GEN_DBL_TEST (acosh (-0.34));\n  GEN_DBL_TEST (acosh (0.35));\n  GEN_DBL_TEST (acosh (-0.35));\n  GEN_DBL_TEST (acosh (1.03));\n  GEN_DBL_TEST (acosh (-1.03));\n  GEN_DBL_TEST (acosh (1.04));\n  GEN_DBL_TEST (acosh (-1.04));\n  GEN_DBL_TEST (acosh (3.72e-09));\n  GEN_DBL_TEST (acosh (-3.72e-09));\n  GEN_DBL_TEST (acosh (3.73e-09));\n  GEN_DBL_TEST (acosh (-3.73e-09));\n  GEN_DBL_TEST (acosh (2.0));\n  GEN_DBL_TEST (acosh (3.0));\n  GEN_DBL_TEST (acosh (0.7));\n  GEN_DBL_TEST (acosh (38.0));\n\n  /* asinh tests */\n  GEN_DBL_TEST (asinh (0.0));\n  GEN_DBL_TEST (asinh (-0.0));\n  GEN_DBL_TEST (asinh (1.0));\n  GEN_DBL_TEST (asinh (-1.0));\n  GEN_DBL_TEST (asinh (INFINITY));\n  GEN_DBL_TEST (asinh (-INFINITY));\n  GEN_DBL_TEST (asinh (NAN));\n  GEN_DBL_TEST (asinh (7.08e+02));\n  GEN_DBL_TEST (asinh (7.10e+02));\n  GEN_DBL_TEST (asinh (-7.40e+02));\n  GEN_DBL_TEST (asinh (-7.50e+02));\n  GEN_DBL_TEST (asinh (0.34));\n  GEN_DBL_TEST (asinh (-0.34));\n  GEN_DBL_TEST (asinh (0.35));\n  GEN_DBL_TEST (asinh (-0.35));\n  GEN_DBL_TEST (asinh (1.03));\n  GEN_DBL_TEST (asinh (-1.03));\n  GEN_DBL_TEST (asinh (1.04));\n  GEN_DBL_TEST (asinh (-1.04));\n  GEN_DBL_TEST (asinh (3.72e-09));\n  GEN_DBL_TEST (asinh (-3.72e-09));\n  GEN_DBL_TEST (asinh (3.73e-09));\n  GEN_DBL_TEST (asinh (-3.73e-09));\n  GEN_DBL_TEST (asinh (2.0));\n  GEN_DBL_TEST (asinh (3.0));\n  GEN_DBL_TEST (asinh (0.7));\n  GEN_DBL_TEST (asinh (38.0));\n\n  /* atanh tests */\n  GEN_DBL_TEST (atanh (0.0));\n  GEN_DBL_TEST (atanh (-0.0));\n  GEN_DBL_TEST (atanh (1.0));\n  GEN_DBL_TEST (atanh (-1.0));\n  GEN_DBL_TEST (atanh (INFINITY));\n  GEN_DBL_TEST (atanh (-INFINITY));\n  GEN_DBL_TEST (atanh (NAN));\n  GEN_DBL_TEST (atanh (7.08e+02));\n  GEN_DBL_TEST (atanh (7.10e+02));\n  GEN_DBL_TEST (atanh (-7.40e+02));\n  GEN_DBL_TEST (atanh (-7.50e+02));\n  GEN_DBL_TEST (atanh (0.34));\n  GEN_DBL_TEST (atanh (-0.34));\n  GEN_DBL_TEST (atanh (0.35));\n  GEN_DBL_TEST (atanh (-0.35));\n  GEN_DBL_TEST (atanh (1.03));\n  GEN_DBL_TEST (atanh (-1.03));\n  GEN_DBL_TEST (atanh (1.04));\n  GEN_DBL_TEST (atanh (-1.04));\n  GEN_DBL_TEST (atanh (3.72e-09));\n  GEN_DBL_TEST (atanh (-3.72e-09));\n  GEN_DBL_TEST (atanh (3.73e-09));\n  GEN_DBL_TEST (atanh (-3.73e-09));\n  GEN_DBL_TEST (atanh (2.0));\n  GEN_DBL_TEST (atanh (3.0));\n  GEN_DBL_TEST (atanh (0.7));\n  GEN_DBL_TEST (atanh (38.0));\n\n  /* ceil tests */\n  GEN_DBL_TEST (ceil (0.0));\n  GEN_DBL_TEST (ceil (-0.0));\n  GEN_DBL_TEST (ceil (INFINITY));\n  GEN_DBL_TEST (ceil (-INFINITY));\n  GEN_DBL_TEST (ceil (NAN));\n  GEN_DBL_TEST (ceil (3.14));\n  GEN_DBL_TEST (ceil (-3.14));\n  GEN_DBL_TEST (ceil (3.72e-09));\n  GEN_DBL_TEST (ceil (-3.72e-09));\n  GEN_DBL_TEST (ceil (7.37e+19));\n  GEN_DBL_TEST (ceil (-7.37e+19));\n\n  /* copysign tests */\n  /* SKIPPED: not publicly declared in jerry-math\n  GEN_DBL_TEST (copysign (0.0, 0.0));\n  GEN_DBL_TEST (copysign (0.0, -0.0));\n  GEN_DBL_TEST (copysign (-0.0, 0.0));\n  GEN_DBL_TEST (copysign (-0.0, -0.0));\n  GEN_DBL_TEST (copysign (0.0, 1.0));\n  GEN_DBL_TEST (copysign (0.0, -1.0));\n  GEN_DBL_TEST (copysign (-0.0, 1.0));\n  GEN_DBL_TEST (copysign (-0.0, -1.0));\n  GEN_DBL_TEST (copysign (0.0, INFINITY));\n  GEN_DBL_TEST (copysign (0.0, -INFINITY));\n  GEN_DBL_TEST (copysign (-0.0, INFINITY));\n  GEN_DBL_TEST (copysign (-0.0, -INFINITY));\n  GEN_DBL_TEST (copysign (0.0, NAN));\n  GEN_DBL_TEST (copysign (-0.0, NAN));\n  GEN_DBL_TEST (copysign (1.0, 0.0));\n  GEN_DBL_TEST (copysign (1.0, -0.0));\n  GEN_DBL_TEST (copysign (-1.0, 0.0));\n  GEN_DBL_TEST (copysign (-1.0, -0.0));\n  GEN_DBL_TEST (copysign (1.0, 1.0));\n  GEN_DBL_TEST (copysign (1.0, -1.0));\n  GEN_DBL_TEST (copysign (-1.0, 1.0));\n  GEN_DBL_TEST (copysign (-1.0, -1.0));\n  GEN_DBL_TEST (copysign (1.0, INFINITY));\n  GEN_DBL_TEST (copysign (1.0, -INFINITY));\n  GEN_DBL_TEST (copysign (-1.0, INFINITY));\n  GEN_DBL_TEST (copysign (-1.0, -INFINITY));\n  GEN_DBL_TEST (copysign (1.0, NAN));\n  GEN_DBL_TEST (copysign (-1.0, NAN));\n  GEN_DBL_TEST (copysign (INFINITY, 0.0));\n  GEN_DBL_TEST (copysign (INFINITY, -0.0));\n  GEN_DBL_TEST (copysign (-INFINITY, 0.0));\n  GEN_DBL_TEST (copysign (-INFINITY, -0.0));\n  GEN_DBL_TEST (copysign (INFINITY, 1.0));\n  GEN_DBL_TEST (copysign (INFINITY, -1.0));\n  GEN_DBL_TEST (copysign (-INFINITY, 1.0));\n  GEN_DBL_TEST (copysign (-INFINITY, -1.0));\n  GEN_DBL_TEST (copysign (INFINITY, INFINITY));\n  GEN_DBL_TEST (copysign (INFINITY, -INFINITY));\n  GEN_DBL_TEST (copysign (-INFINITY, INFINITY));\n  GEN_DBL_TEST (copysign (-INFINITY, -INFINITY));\n  GEN_DBL_TEST (copysign (INFINITY, NAN));\n  GEN_DBL_TEST (copysign (-INFINITY, NAN));\n  GEN_DBL_TEST (copysign (NAN, 0.0));\n  GEN_DBL_TEST (copysign (NAN, -0.0));\n  GEN_DBL_TEST (copysign (NAN, 1.0));\n  GEN_DBL_TEST (copysign (NAN, -1.0));\n  GEN_DBL_TEST (copysign (NAN, INFINITY));\n  GEN_DBL_TEST (copysign (NAN, -INFINITY));\n  GEN_DBL_TEST (copysign (NAN, NAN));\n  GEN_DBL_TEST (copysign (3.14, -1.0));\n  GEN_DBL_TEST (copysign (-3.14, 1.0));\n  GEN_DBL_TEST (copysign (1.0, -3.14));\n  GEN_DBL_TEST (copysign (-1.0, 3.14));\n  */\n\n  /* exp tests */\n  GEN_DBL_TEST (exp (0.0));\n  GEN_DBL_TEST (exp (-0.0));\n  GEN_DBL_TEST (exp (1.0));\n  GEN_DBL_TEST (exp (-1.0));\n  GEN_DBL_TEST (exp (INFINITY));\n  GEN_DBL_TEST (exp (-INFINITY));\n  GEN_DBL_TEST (exp (NAN));\n  GEN_DBL_TEST (exp (7.08e+02));\n  GEN_DBL_TEST (exp (7.10e+02));\n  GEN_DBL_TEST (exp (-7.40e+02));\n  GEN_DBL_TEST (exp (-7.50e+02));\n  GEN_DBL_TEST (exp (0.34));\n  GEN_DBL_TEST (exp (-0.34));\n  GEN_DBL_TEST (exp (0.35));\n  GEN_DBL_TEST (exp (-0.35));\n  GEN_DBL_TEST (exp (1.03));\n  GEN_DBL_TEST (exp (-1.03));\n  GEN_DBL_TEST (exp (1.04));\n  GEN_DBL_TEST (exp (-1.04));\n  GEN_DBL_TEST (exp (3.72e-09));\n  GEN_DBL_TEST (exp (-3.72e-09));\n  GEN_DBL_TEST (exp (3.73e-09));\n  GEN_DBL_TEST (exp (-3.73e-09));\n  GEN_DBL_TEST (exp (2.0));\n  GEN_DBL_TEST (exp (3.0));\n  GEN_DBL_TEST (exp (0.7));\n  GEN_DBL_TEST (exp (38.0));\n\n  /* expm1 tests */\n  GEN_DBL_TEST (expm1 (0.0));\n  GEN_DBL_TEST (expm1 (-0.0));\n  GEN_DBL_TEST (expm1 (1.0));\n  GEN_DBL_TEST (expm1 (-1.0));\n  GEN_DBL_TEST (expm1 (INFINITY));\n  GEN_DBL_TEST (expm1 (-INFINITY));\n  GEN_DBL_TEST (expm1 (NAN));\n  GEN_DBL_TEST (expm1 (7.08e+02));\n  GEN_DBL_TEST (expm1 (7.095e+02));\n  GEN_DBL_TEST (expm1 (7.10e+02));\n  GEN_DBL_TEST (expm1 (-7.40e+02));\n  GEN_DBL_TEST (expm1 (-7.50e+02));\n  GEN_DBL_TEST (expm1 (0.34));\n  GEN_DBL_TEST (expm1 (-0.34));\n  GEN_DBL_TEST (expm1 (0.35));\n  GEN_DBL_TEST (expm1 (-0.35));\n  GEN_DBL_TEST (expm1 (1.03));\n  GEN_DBL_TEST (expm1 (-1.03));\n  GEN_DBL_TEST (expm1 (1.04));\n  GEN_DBL_TEST (expm1 (-1.04));\n  GEN_DBL_TEST (expm1 (3.72e-09));\n  GEN_DBL_TEST (expm1 (-3.72e-09));\n  GEN_DBL_TEST (expm1 (3.73e-09));\n  GEN_DBL_TEST (expm1 (-3.73e-09));\n  GEN_DBL_TEST (expm1 (2.0));\n  GEN_DBL_TEST (expm1 (3.0));\n  GEN_DBL_TEST (expm1 (0.7));\n  GEN_DBL_TEST (expm1 (38.0));\n\n  /* fabs tests */\n  GEN_DBL_TEST (fabs (0.0));\n  GEN_DBL_TEST (fabs (-0.0));\n  GEN_DBL_TEST (fabs (1.0));\n  GEN_DBL_TEST (fabs (-1.0));\n  GEN_DBL_TEST (fabs (INFINITY));\n  GEN_DBL_TEST (fabs (-INFINITY));\n  GEN_DBL_TEST (fabs (NAN));\n  GEN_DBL_TEST (fabs (3.14));\n  GEN_DBL_TEST (fabs (-3.14));\n  GEN_DBL_TEST (fabs (0.7));\n  GEN_DBL_TEST (fabs (-0.7));\n  GEN_DBL_TEST (fabs (3.72e-09));\n  GEN_DBL_TEST (fabs (-3.72e-09));\n  GEN_DBL_TEST (fabs (7.37e+19));\n  GEN_DBL_TEST (fabs (-7.37e+19));\n\n  /* floor tests */\n  GEN_DBL_TEST (floor (0.0));\n  GEN_DBL_TEST (floor (-0.0));\n  GEN_DBL_TEST (floor (INFINITY));\n  GEN_DBL_TEST (floor (-INFINITY));\n  GEN_DBL_TEST (floor (NAN));\n  GEN_DBL_TEST (floor (3.14));\n  GEN_DBL_TEST (floor (-3.14));\n  GEN_DBL_TEST (floor (3.72e-09));\n  GEN_DBL_TEST (floor (-3.72e-09));\n  GEN_DBL_TEST (floor (7.37e+19));\n  GEN_DBL_TEST (floor (-7.37e+19));\n\n  /* fmod tests */\n  GEN_DBL_TEST (fmod (0.0, 0.0));\n  GEN_DBL_TEST (fmod (0.0, -0.0));\n  GEN_DBL_TEST (fmod (-0.0, 0.0));\n  GEN_DBL_TEST (fmod (-0.0, -0.0));\n  GEN_DBL_TEST (fmod (0.0, 3.0));\n  GEN_DBL_TEST (fmod (0.0, -3.0));\n  GEN_DBL_TEST (fmod (-0.0, 3.0));\n  GEN_DBL_TEST (fmod (-0.0, -3.0));\n  GEN_DBL_TEST (fmod (0.0, INFINITY));\n  GEN_DBL_TEST (fmod (0.0, -INFINITY));\n  GEN_DBL_TEST (fmod (-0.0, INFINITY));\n  GEN_DBL_TEST (fmod (-0.0, -INFINITY));\n  GEN_DBL_TEST (fmod (0.0, NAN));\n  GEN_DBL_TEST (fmod (-0.0, NAN));\n  GEN_DBL_TEST (fmod (3.0, 0.0));\n  GEN_DBL_TEST (fmod (3.0, -0.0));\n  GEN_DBL_TEST (fmod (-3.0, 0.0));\n  GEN_DBL_TEST (fmod (-3.0, -0.0));\n  GEN_DBL_TEST (fmod (3.0, 3.0));\n  GEN_DBL_TEST (fmod (3.0, -3.0));\n  GEN_DBL_TEST (fmod (-3.0, 3.0));\n  GEN_DBL_TEST (fmod (-3.0, -3.0));\n  GEN_DBL_TEST (fmod (3.0, INFINITY));\n  GEN_DBL_TEST (fmod (3.0, -INFINITY));\n  GEN_DBL_TEST (fmod (-3.0, INFINITY));\n  GEN_DBL_TEST (fmod (-3.0, -INFINITY));\n  GEN_DBL_TEST (fmod (3.0, NAN));\n  GEN_DBL_TEST (fmod (-3.0, NAN));\n  GEN_DBL_TEST (fmod (INFINITY, 0.0));\n  GEN_DBL_TEST (fmod (INFINITY, -0.0));\n  GEN_DBL_TEST (fmod (-INFINITY, 0.0));\n  GEN_DBL_TEST (fmod (-INFINITY, -0.0));\n  GEN_DBL_TEST (fmod (INFINITY, 3.0));\n  GEN_DBL_TEST (fmod (INFINITY, -3.0));\n  GEN_DBL_TEST (fmod (-INFINITY, 3.0));\n  GEN_DBL_TEST (fmod (-INFINITY, -3.0));\n  GEN_DBL_TEST (fmod (INFINITY, INFINITY));\n  GEN_DBL_TEST (fmod (INFINITY, -INFINITY));\n  GEN_DBL_TEST (fmod (-INFINITY, INFINITY));\n  GEN_DBL_TEST (fmod (-INFINITY, -INFINITY));\n  GEN_DBL_TEST (fmod (INFINITY, NAN));\n  GEN_DBL_TEST (fmod (-INFINITY, NAN));\n  GEN_DBL_TEST (fmod (NAN, 0.0));\n  GEN_DBL_TEST (fmod (NAN, -0.0));\n  GEN_DBL_TEST (fmod (NAN, 3.0));\n  GEN_DBL_TEST (fmod (NAN, -3.0));\n  GEN_DBL_TEST (fmod (NAN, INFINITY));\n  GEN_DBL_TEST (fmod (NAN, -INFINITY));\n  GEN_DBL_TEST (fmod (NAN, NAN));\n  GEN_DBL_TEST (fmod (3.0, 1.0));\n  GEN_DBL_TEST (fmod (3.0, -1.0));\n  GEN_DBL_TEST (fmod (-3.0, 1.0));\n  GEN_DBL_TEST (fmod (-3.0, -1.0));\n  GEN_DBL_TEST (fmod (6.5, 2.3));\n  GEN_DBL_TEST (fmod (6.5, -2.3));\n  GEN_DBL_TEST (fmod (-6.5, 2.3));\n  GEN_DBL_TEST (fmod (-6.5, -2.3));\n\n  /* isfinite tests */\n  GEN_INT_TEST (isfinite (0.0));\n  GEN_INT_TEST (isfinite (-0.0));\n  GEN_INT_TEST (isfinite (1.0));\n  GEN_INT_TEST (isfinite (-1.0));\n  GEN_INT_TEST (isfinite (INFINITY));\n  GEN_INT_TEST (isfinite (-INFINITY));\n  GEN_INT_TEST (isfinite (NAN));\n  GEN_INT_TEST (isfinite (3.14));\n  GEN_INT_TEST (isfinite (-3.14));\n  GEN_INT_TEST (isfinite (0.7));\n  GEN_INT_TEST (isfinite (-0.7));\n  GEN_INT_TEST (isfinite (3.72e-09));\n  GEN_INT_TEST (isfinite (-3.72e-09));\n  GEN_INT_TEST (isfinite (7.37e+19));\n  GEN_INT_TEST (isfinite (-7.37e+19));\n\n  /* isinf tests */\n  GEN_INT_TEST (isinf (0.0));\n  GEN_INT_TEST (isinf (-0.0));\n  GEN_INT_TEST (isinf (1.0));\n  GEN_INT_TEST (isinf (-1.0));\n  GEN_INT_TEST (isinf (INFINITY));\n  GEN_INT_TEST (isinf (-INFINITY));\n  GEN_INT_TEST (isinf (NAN));\n  GEN_INT_TEST (isinf (3.14));\n  GEN_INT_TEST (isinf (-3.14));\n  GEN_INT_TEST (isinf (0.7));\n  GEN_INT_TEST (isinf (-0.7));\n  GEN_INT_TEST (isinf (3.72e-09));\n  GEN_INT_TEST (isinf (-3.72e-09));\n  GEN_INT_TEST (isinf (7.37e+19));\n  GEN_INT_TEST (isinf (-7.37e+19));\n\n  /* isnan tests */\n  GEN_INT_TEST (isnan (0.0));\n  GEN_INT_TEST (isnan (-0.0));\n  GEN_INT_TEST (isnan (1.0));\n  GEN_INT_TEST (isnan (-1.0));\n  GEN_INT_TEST (isnan (INFINITY));\n  GEN_INT_TEST (isnan (-INFINITY));\n  GEN_INT_TEST (isnan (NAN));\n  GEN_INT_TEST (isnan (3.14));\n  GEN_INT_TEST (isnan (-3.14));\n  GEN_INT_TEST (isnan (0.7));\n  GEN_INT_TEST (isnan (-0.7));\n  GEN_INT_TEST (isnan (3.72e-09));\n  GEN_INT_TEST (isnan (-3.72e-09));\n  GEN_INT_TEST (isnan (7.37e+19));\n  GEN_INT_TEST (isnan (-7.37e+19));\n\n  /* log tests */\n  GEN_DBL_TEST (log (0.0));\n  GEN_DBL_TEST (log (-0.0));\n  GEN_DBL_TEST (log (1.0));\n  GEN_DBL_TEST (log (-1.0));\n  GEN_DBL_TEST (log (INFINITY));\n  GEN_DBL_TEST (log (-INFINITY));\n  GEN_DBL_TEST (log (NAN));\n  GEN_DBL_TEST (log (M_E));\n  GEN_DBL_TEST (log (1.0 / M_E));\n  GEN_DBL_TEST (log (2));\n  GEN_DBL_TEST (log (10));\n  GEN_DBL_TEST (log (0.7));\n  GEN_DBL_TEST (log (2.22e-308));\n  GEN_DBL_TEST (log (2.23e-308));\n  GEN_DBL_TEST (log (0.17));\n  GEN_DBL_TEST (log (0.18));\n  GEN_DBL_TEST (log (1999.0));\n  GEN_DBL_TEST (log (2000.0));\n  GEN_DBL_TEST (log (2001.0));\n\n  /* log1p tests */\n  GEN_DBL_TEST (log1p (0.0));\n  GEN_DBL_TEST (log1p (-0.0));\n  GEN_DBL_TEST (log1p (1.0));\n  GEN_DBL_TEST (log1p (-1.0));\n  GEN_DBL_TEST (log1p (INFINITY));\n  GEN_DBL_TEST (log1p (-INFINITY));\n  GEN_DBL_TEST (log1p (NAN));\n  GEN_DBL_TEST (log1p (M_E));\n  GEN_DBL_TEST (log1p (1.0 / M_E));\n  GEN_DBL_TEST (log1p (2));\n  GEN_DBL_TEST (log1p (10));\n  GEN_DBL_TEST (log1p (0.7));\n  GEN_DBL_TEST (log1p (2.22e-308));\n  GEN_DBL_TEST (log1p (2.23e-308));\n  GEN_DBL_TEST (log1p (0.17));\n  GEN_DBL_TEST (log1p (0.18));\n  GEN_DBL_TEST (log1p (1999.0));\n  GEN_DBL_TEST (log1p (2000.0));\n  GEN_DBL_TEST (log1p (2001.0));\n\n  /* log2 tests */\n  GEN_DBL_TEST (log2 (0.0));\n  GEN_DBL_TEST (log2 (-0.0));\n  GEN_DBL_TEST (log2 (1.0));\n  GEN_DBL_TEST (log2 (-1.0));\n  GEN_DBL_TEST (log2 (INFINITY));\n  GEN_DBL_TEST (log2 (-INFINITY));\n  GEN_DBL_TEST (log2 (NAN));\n  GEN_DBL_TEST (log2 (M_E));\n  GEN_DBL_TEST (log2 (1.0 / M_E));\n  GEN_DBL_TEST (log2 (2));\n  GEN_DBL_TEST (log2 (10));\n  GEN_DBL_TEST (log2 (0.7));\n  GEN_DBL_TEST (log2 (2.22e-308));\n  GEN_DBL_TEST (log2 (2.23e-308));\n  GEN_DBL_TEST (log2 (0.17));\n  GEN_DBL_TEST (log2 (0.18));\n  GEN_DBL_TEST (log2 (1999.0));\n  GEN_DBL_TEST (log2 (2000.0));\n  GEN_DBL_TEST (log2 (2001.0));\n\n  /* log10 tests */\n  GEN_DBL_TEST (log10 (0.0));\n  GEN_DBL_TEST (log10 (-0.0));\n  GEN_DBL_TEST (log10 (1.0));\n  GEN_DBL_TEST (log10 (-1.0));\n  GEN_DBL_TEST (log10 (INFINITY));\n  GEN_DBL_TEST (log10 (-INFINITY));\n  GEN_DBL_TEST (log10 (NAN));\n  GEN_DBL_TEST (log10 (M_E));\n  GEN_DBL_TEST (log10 (1.0 / M_E));\n  GEN_DBL_TEST (log10 (2));\n  GEN_DBL_TEST (log10 (10));\n  GEN_DBL_TEST (log10 (0.7));\n  GEN_DBL_TEST (log10 (2.22e-308));\n  GEN_DBL_TEST (log10 (2.23e-308));\n  GEN_DBL_TEST (log10 (0.17));\n  GEN_DBL_TEST (log10 (0.18));\n  GEN_DBL_TEST (log10 (1999.0));\n  GEN_DBL_TEST (log10 (2000.0));\n  GEN_DBL_TEST (log10 (2001.0));\n\n  /* pow tests */\n  GEN_DBL_TEST (pow (0.0, 0.0));\n  GEN_DBL_TEST (pow (0.0, -0.0));\n  GEN_DBL_TEST (pow (-0.0, 0.0));\n  GEN_DBL_TEST (pow (-0.0, -0.0));\n  GEN_DBL_TEST (pow (0.0, 1.0));\n  GEN_DBL_TEST (pow (0.0, -1.0));\n  GEN_DBL_TEST (pow (-0.0, 1.0));\n  GEN_DBL_TEST (pow (-0.0, -1.0));\n  GEN_DBL_TEST (pow (0.0, INFINITY));\n  GEN_DBL_TEST (pow (0.0, -INFINITY));\n  GEN_DBL_TEST (pow (-0.0, INFINITY));\n  GEN_DBL_TEST (pow (-0.0, -INFINITY));\n  GEN_DBL_TEST (pow (0.0, NAN));\n  GEN_DBL_TEST (pow (-0.0, NAN));\n  GEN_DBL_TEST (pow (1.0, 0.0));\n  GEN_DBL_TEST (pow (1.0, -0.0));\n  GEN_DBL_TEST (pow (-1.0, 0.0));\n  GEN_DBL_TEST (pow (-1.0, -0.0));\n  GEN_DBL_TEST (pow (1.0, 1.0));\n  GEN_DBL_TEST (pow (1.0, -1.0));\n  GEN_DBL_TEST (pow (-1.0, 1.0));\n  GEN_DBL_TEST (pow (-1.0, -1.0));\n  GEN_DBL_TEST (pow (1.0, INFINITY));\n  GEN_DBL_TEST (pow (1.0, -INFINITY));\n  GEN_DBL_TEST (pow (-1.0, INFINITY));\n  GEN_DBL_TEST (pow (-1.0, -INFINITY));\n  GEN_DBL_TEST (pow (1.0, NAN));\n  GEN_DBL_TEST (pow (-1.0, NAN));\n  GEN_DBL_TEST (pow (INFINITY, 0.0));\n  GEN_DBL_TEST (pow (INFINITY, -0.0));\n  GEN_DBL_TEST (pow (-INFINITY, 0.0));\n  GEN_DBL_TEST (pow (-INFINITY, -0.0));\n  GEN_DBL_TEST (pow (INFINITY, 1.0));\n  GEN_DBL_TEST (pow (INFINITY, -1.0));\n  GEN_DBL_TEST (pow (-INFINITY, 1.0));\n  GEN_DBL_TEST (pow (-INFINITY, -1.0));\n  GEN_DBL_TEST (pow (INFINITY, INFINITY));\n  GEN_DBL_TEST (pow (INFINITY, -INFINITY));\n  GEN_DBL_TEST (pow (-INFINITY, INFINITY));\n  GEN_DBL_TEST (pow (-INFINITY, -INFINITY));\n  GEN_DBL_TEST (pow (INFINITY, NAN));\n  GEN_DBL_TEST (pow (-INFINITY, NAN));\n  GEN_DBL_TEST (pow (NAN, 0.0));\n  GEN_DBL_TEST (pow (NAN, -0.0));\n  GEN_DBL_TEST (pow (NAN, 1.0));\n  GEN_DBL_TEST (pow (NAN, -1.0));\n  GEN_DBL_TEST (pow (NAN, INFINITY));\n  GEN_DBL_TEST (pow (NAN, -INFINITY));\n  GEN_DBL_TEST (pow (NAN, NAN));\n  GEN_DBL_TEST (pow (0.9, INFINITY));\n  GEN_DBL_TEST (pow (0.9, -INFINITY));\n  GEN_DBL_TEST (pow (-0.9, INFINITY));\n  GEN_DBL_TEST (pow (-0.9, -INFINITY));\n  GEN_DBL_TEST (pow (1.1, INFINITY));\n  GEN_DBL_TEST (pow (1.1, -INFINITY));\n  GEN_DBL_TEST (pow (-1.1, INFINITY));\n  GEN_DBL_TEST (pow (-1.1, -INFINITY));\n  GEN_DBL_TEST (pow (0.0, 2.0));\n  GEN_DBL_TEST (pow (0.0, -2.0));\n  GEN_DBL_TEST (pow (-0.0, 2.0));\n  GEN_DBL_TEST (pow (-0.0, -2.0));\n  GEN_DBL_TEST (pow (0.0, 3.0));\n  GEN_DBL_TEST (pow (0.0, -3.0));\n  GEN_DBL_TEST (pow (-0.0, 3.0));\n  GEN_DBL_TEST (pow (-0.0, -3.0));\n  GEN_DBL_TEST (pow (0.0, 3.14));\n  GEN_DBL_TEST (pow (0.0, -3.14));\n  GEN_DBL_TEST (pow (-0.0, 3.14));\n  GEN_DBL_TEST (pow (-0.0, -3.14));\n  GEN_DBL_TEST (pow (1.0, 3.14));\n  GEN_DBL_TEST (pow (1.0, -3.14));\n  GEN_DBL_TEST (pow (-1.0, 3.14));\n  GEN_DBL_TEST (pow (-1.0, -3.14));\n  GEN_DBL_TEST (pow (3.14, 0.0));\n  GEN_DBL_TEST (pow (3.14, -0.0));\n  GEN_DBL_TEST (pow (-3.14, 0.0));\n  GEN_DBL_TEST (pow (-3.14, -0.0));\n  GEN_DBL_TEST (pow (3.14, 1.0));\n  GEN_DBL_TEST (pow (3.14, -1.0));\n  GEN_DBL_TEST (pow (-3.14, 1.0));\n  GEN_DBL_TEST (pow (-3.14, -1.0));\n  GEN_DBL_TEST (pow (3.14, 2.0));\n  GEN_DBL_TEST (pow (3.14, -2.0));\n  GEN_DBL_TEST (pow (-3.14, 2.0));\n  GEN_DBL_TEST (pow (-3.14, -2.0));\n  GEN_DBL_TEST (pow (3.14, 3.0));\n  GEN_DBL_TEST (pow (3.14, -3.0));\n  GEN_DBL_TEST (pow (-3.14, 3.0));\n  GEN_DBL_TEST (pow (-3.14, -3.0));\n  GEN_DBL_TEST (pow (3.14, 3.14));\n  GEN_DBL_TEST (pow (3.14, -3.14));\n  GEN_DBL_TEST (pow (-3.14, 3.14));\n  GEN_DBL_TEST (pow (-3.14, -3.14));\n  GEN_DBL_TEST (pow (INFINITY, 2.0));\n  GEN_DBL_TEST (pow (INFINITY, -2.0));\n  GEN_DBL_TEST (pow (-INFINITY, 2.0));\n  GEN_DBL_TEST (pow (-INFINITY, -2.0));\n  GEN_DBL_TEST (pow (INFINITY, 3.0));\n  GEN_DBL_TEST (pow (INFINITY, -3.0));\n  GEN_DBL_TEST (pow (-INFINITY, 3.0));\n  GEN_DBL_TEST (pow (-INFINITY, -3.0));\n  GEN_DBL_TEST (pow (INFINITY, 3.14));\n  GEN_DBL_TEST (pow (INFINITY, -3.14));\n  GEN_DBL_TEST (pow (-INFINITY, 3.14));\n  GEN_DBL_TEST (pow (-INFINITY, -3.14));\n  GEN_DBL_TEST (pow (0.7, 1.2));\n\n  /* scalbn tests */\n  /* SKIPPED: not publicly declared in jerry-math\n  GEN_DBL_TEST (scalbn (0.0, 0));\n  GEN_DBL_TEST (scalbn (-0.0, 0));\n  GEN_DBL_TEST (scalbn (0.0, 1));\n  GEN_DBL_TEST (scalbn (0.0, -1));\n  GEN_DBL_TEST (scalbn (-0.0, 1));\n  GEN_DBL_TEST (scalbn (-0.0, -1));\n  GEN_DBL_TEST (scalbn (1.0, 0));\n  GEN_DBL_TEST (scalbn (-1.0, 0));\n  GEN_DBL_TEST (scalbn (1.0, 1));\n  GEN_DBL_TEST (scalbn (1.0, -1));\n  GEN_DBL_TEST (scalbn (-1.0, 1));\n  GEN_DBL_TEST (scalbn (-1.0, -1));\n  GEN_DBL_TEST (scalbn (INFINITY, 0));\n  GEN_DBL_TEST (scalbn (-INFINITY, 0));\n  GEN_DBL_TEST (scalbn (INFINITY, 1));\n  GEN_DBL_TEST (scalbn (INFINITY, -1));\n  GEN_DBL_TEST (scalbn (-INFINITY, 1));\n  GEN_DBL_TEST (scalbn (-INFINITY, -1));\n  GEN_DBL_TEST (scalbn (NAN, 0));\n  GEN_DBL_TEST (scalbn (NAN, 1));\n  GEN_DBL_TEST (scalbn (NAN, -1));\n  GEN_DBL_TEST (scalbn (3.14, -1));\n  GEN_DBL_TEST (scalbn (-3.14, 1));\n  GEN_DBL_TEST (scalbn (0.7, 4));\n  GEN_DBL_TEST (scalbn (0.7, -4));\n  GEN_DBL_TEST (scalbn (-0.7, 4));\n  GEN_DBL_TEST (scalbn (-0.7, -4));\n  GEN_DBL_TEST (scalbn (0.8, 5));\n  GEN_DBL_TEST (scalbn (0.8, -5));\n  GEN_DBL_TEST (scalbn (-0.8, 5));\n  GEN_DBL_TEST (scalbn (-0.8, -5));\n  GEN_DBL_TEST (scalbn (5.55e-18, 49999));\n  GEN_DBL_TEST (scalbn (5.55e-18, 50000));\n  GEN_DBL_TEST (scalbn (5.55e-18, 50001));\n  GEN_DBL_TEST (scalbn (1.0, -49999));\n  GEN_DBL_TEST (scalbn (1.0, -50000));\n  GEN_DBL_TEST (scalbn (1.0, -50001));\n  */\n\n  /* sqrt tests */\n  GEN_DBL_TEST (sqrt (0.0));\n  GEN_DBL_TEST (sqrt (-0.0));\n  GEN_DBL_TEST (sqrt (1.0));\n  GEN_DBL_TEST (sqrt (-1.0));\n  GEN_DBL_TEST (sqrt (INFINITY));\n  GEN_DBL_TEST (sqrt (-INFINITY));\n  GEN_DBL_TEST (sqrt (NAN));\n  GEN_DBL_TEST (sqrt (0.7));\n  GEN_DBL_TEST (sqrt (2));\n  GEN_DBL_TEST (sqrt (10));\n  GEN_DBL_TEST (sqrt (2.22e-308));\n  GEN_DBL_TEST (sqrt (2.23e-308));\n  GEN_DBL_TEST (sqrt (3.72e-09));\n  GEN_DBL_TEST (sqrt (7.37e+19));\n  GEN_DBL_TEST (sqrt (2209));\n  GEN_DBL_TEST (sqrt (4));\n  GEN_DBL_TEST (sqrt (0.25));\n  GEN_DBL_TEST (sqrt (6642.25));\n  GEN_DBL_TEST (sqrt (15239.9025));\n\n  /* cbrt tests */\n  GEN_DBL_TEST (cbrt (0.0));\n  GEN_DBL_TEST (cbrt (-0.0));\n  GEN_DBL_TEST (cbrt (1.0));\n  GEN_DBL_TEST (cbrt (-1.0));\n  GEN_DBL_TEST (cbrt (INFINITY));\n  GEN_DBL_TEST (cbrt (-INFINITY));\n  GEN_DBL_TEST (cbrt (NAN));\n  GEN_DBL_TEST (cbrt (0.7));\n  GEN_DBL_TEST (cbrt (2));\n  GEN_DBL_TEST (cbrt (10));\n  GEN_DBL_TEST (cbrt (2.22e-308));\n  GEN_DBL_TEST (cbrt (2.23e-308));\n  GEN_DBL_TEST (cbrt (3.72e-09));\n  GEN_DBL_TEST (cbrt (7.37e+19));\n  GEN_DBL_TEST (cbrt (2209));\n  GEN_DBL_TEST (cbrt (4));\n  GEN_DBL_TEST (cbrt (0.25));\n  GEN_DBL_TEST (cbrt (6642.25));\n  GEN_DBL_TEST (cbrt (15239.9025));\n  GEN_DBL_TEST (cbrt (3));\n  GEN_DBL_TEST (cbrt (9));\n  GEN_DBL_TEST (cbrt (-17.87));\n  GEN_DBL_TEST (cbrt (-8941));\n\n  /* sin tests */\n  GEN_DBL_TEST (sin (0.0));\n  GEN_DBL_TEST (sin (-0.0));\n  GEN_DBL_TEST (sin (1.0));\n  GEN_DBL_TEST (sin (-1.0));\n  GEN_DBL_TEST (sin (INFINITY));\n  GEN_DBL_TEST (sin (-INFINITY));\n  GEN_DBL_TEST (sin (NAN));\n  GEN_DBL_TEST (sin (M_PI));\n  GEN_DBL_TEST (sin (-M_PI));\n  GEN_DBL_TEST (sin (2.0 * M_PI));\n  GEN_DBL_TEST (sin (-2.0 * M_PI));\n  GEN_DBL_TEST (sin (M_PI / 2.0));\n  GEN_DBL_TEST (sin (-M_PI / 2.0));\n  GEN_DBL_TEST (sin (M_PI / 3.0));\n  GEN_DBL_TEST (sin (-M_PI / 3.0));\n  GEN_DBL_TEST (sin (M_PI / 4.0));\n  GEN_DBL_TEST (sin (-M_PI / 4.0));\n  GEN_DBL_TEST (sin (M_PI / 6.0));\n  GEN_DBL_TEST (sin (-M_PI / 6.0));\n  GEN_DBL_TEST (sin (M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (sin (-M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (sin (M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (sin (-M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (sin (6.9e-18));\n  GEN_DBL_TEST (sin (-6.9e-18));\n  GEN_DBL_TEST (sin (7.0e-18));\n  GEN_DBL_TEST (sin (-7.0e-18));\n  GEN_DBL_TEST (sin (7.4e-9));\n  GEN_DBL_TEST (sin (-7.4e-9));\n  GEN_DBL_TEST (sin (7.5e-9));\n  GEN_DBL_TEST (sin (-7.5e-9));\n  GEN_DBL_TEST (sin (0.2));\n  GEN_DBL_TEST (sin (-0.2));\n  GEN_DBL_TEST (sin (0.4));\n  GEN_DBL_TEST (sin (-0.4));\n  GEN_DBL_TEST (sin (0.7));\n  GEN_DBL_TEST (sin (-0.7));\n  GEN_DBL_TEST (sin (0.8));\n  GEN_DBL_TEST (sin (-0.8));\n  GEN_DBL_TEST (sin (3.0));\n  GEN_DBL_TEST (sin (-3.0));\n  GEN_DBL_TEST (sin (4.0));\n  GEN_DBL_TEST (sin (-4.0));\n  GEN_DBL_TEST (sin (6.0));\n  GEN_DBL_TEST (sin (-6.0));\n  GEN_DBL_TEST (sin (7.0));\n  GEN_DBL_TEST (sin (-7.0));\n\n  /* cos tests */\n  GEN_DBL_TEST (cos (0.0));\n  GEN_DBL_TEST (cos (-0.0));\n  GEN_DBL_TEST (cos (1.0));\n  GEN_DBL_TEST (cos (-1.0));\n  GEN_DBL_TEST (cos (INFINITY));\n  GEN_DBL_TEST (cos (-INFINITY));\n  GEN_DBL_TEST (cos (NAN));\n  GEN_DBL_TEST (cos (M_PI));\n  GEN_DBL_TEST (cos (-M_PI));\n  GEN_DBL_TEST (cos (2.0 * M_PI));\n  GEN_DBL_TEST (cos (-2.0 * M_PI));\n  GEN_DBL_TEST (cos (M_PI / 2.0));\n  GEN_DBL_TEST (cos (-M_PI / 2.0));\n  GEN_DBL_TEST (cos (M_PI / 3.0));\n  GEN_DBL_TEST (cos (-M_PI / 3.0));\n  GEN_DBL_TEST (cos (M_PI / 4.0));\n  GEN_DBL_TEST (cos (-M_PI / 4.0));\n  GEN_DBL_TEST (cos (M_PI / 6.0));\n  GEN_DBL_TEST (cos (-M_PI / 6.0));\n  GEN_DBL_TEST (cos (M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (cos (-M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (cos (M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (cos (-M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (cos (6.9e-18));\n  GEN_DBL_TEST (cos (-6.9e-18));\n  GEN_DBL_TEST (cos (7.0e-18));\n  GEN_DBL_TEST (cos (-7.0e-18));\n  GEN_DBL_TEST (cos (7.4e-9));\n  GEN_DBL_TEST (cos (-7.4e-9));\n  GEN_DBL_TEST (cos (7.5e-9));\n  GEN_DBL_TEST (cos (-7.5e-9));\n  GEN_DBL_TEST (cos (0.2));\n  GEN_DBL_TEST (cos (-0.2));\n  GEN_DBL_TEST (cos (0.4));\n  GEN_DBL_TEST (cos (-0.4));\n  GEN_DBL_TEST (cos (0.7));\n  GEN_DBL_TEST (cos (-0.7));\n  GEN_DBL_TEST (cos (0.8));\n  GEN_DBL_TEST (cos (-0.8));\n  GEN_DBL_TEST (cos (3.0));\n  GEN_DBL_TEST (cos (-3.0));\n  GEN_DBL_TEST (cos (4.0));\n  GEN_DBL_TEST (cos (-4.0));\n  GEN_DBL_TEST (cos (6.0));\n  GEN_DBL_TEST (cos (-6.0));\n  GEN_DBL_TEST (cos (7.0));\n  GEN_DBL_TEST (cos (-7.0));\n\n  /* tan tests */\n  GEN_DBL_TEST (tan (0.0));\n  GEN_DBL_TEST (tan (-0.0));\n  GEN_DBL_TEST (tan (1.0));\n  GEN_DBL_TEST (tan (-1.0));\n  GEN_DBL_TEST (tan (INFINITY));\n  GEN_DBL_TEST (tan (-INFINITY));\n  GEN_DBL_TEST (tan (NAN));\n  GEN_DBL_TEST (tan (M_PI));\n  GEN_DBL_TEST (tan (-M_PI));\n  GEN_DBL_TEST (tan (2.0 * M_PI));\n  GEN_DBL_TEST (tan (-2.0 * M_PI));\n  GEN_DBL_TEST (tan (M_PI / 2.0));\n  GEN_DBL_TEST (tan (-M_PI / 2.0));\n  GEN_DBL_TEST (tan (M_PI / 3.0));\n  GEN_DBL_TEST (tan (-M_PI / 3.0));\n  GEN_DBL_TEST (tan (M_PI / 4.0));\n  GEN_DBL_TEST (tan (-M_PI / 4.0));\n  GEN_DBL_TEST (tan (M_PI / 6.0));\n  GEN_DBL_TEST (tan (-M_PI / 6.0));\n  GEN_DBL_TEST (tan (M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (tan (-M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (tan (M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (tan (-M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (tan (3.7e-9));\n  GEN_DBL_TEST (tan (-3.7e-9));\n  GEN_DBL_TEST (tan (3.8e-9));\n  GEN_DBL_TEST (tan (-3.8e-9));\n  GEN_DBL_TEST (tan (0.6));\n  GEN_DBL_TEST (tan (-0.6));\n  GEN_DBL_TEST (tan (0.7));\n  GEN_DBL_TEST (tan (-0.7));\n  GEN_DBL_TEST (tan (3.0));\n  GEN_DBL_TEST (tan (-3.0));\n  GEN_DBL_TEST (tan (4.0));\n  GEN_DBL_TEST (tan (-4.0));\n  GEN_DBL_TEST (tan (6.0));\n  GEN_DBL_TEST (tan (-6.0));\n  GEN_DBL_TEST (tan (7.0));\n  GEN_DBL_TEST (tan (-7.0));\n\n    /* cosh tests */\n  GEN_DBL_TEST (cosh (0.0));\n  GEN_DBL_TEST (cosh (-0.0));\n  GEN_DBL_TEST (cosh (1.0));\n  GEN_DBL_TEST (cosh (-1.0));\n  GEN_DBL_TEST (cosh (INFINITY));\n  GEN_DBL_TEST (cosh (-INFINITY));\n  GEN_DBL_TEST (cosh (NAN));\n  GEN_DBL_TEST (cosh (M_PI));\n  GEN_DBL_TEST (cosh (-M_PI));\n  GEN_DBL_TEST (cosh (2.0 * M_PI));\n  GEN_DBL_TEST (cosh (-2.0 * M_PI));\n  GEN_DBL_TEST (cosh (M_PI / 2.0));\n  GEN_DBL_TEST (cosh (-M_PI / 2.0));\n  GEN_DBL_TEST (cosh (M_PI / 3.0));\n  GEN_DBL_TEST (cosh (-M_PI / 3.0));\n  GEN_DBL_TEST (cosh (M_PI / 4.0));\n  GEN_DBL_TEST (cosh (-M_PI / 4.0));\n  GEN_DBL_TEST (cosh (M_PI / 6.0));\n  GEN_DBL_TEST (cosh (-M_PI / 6.0));\n  GEN_DBL_TEST (cosh (M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (cosh (-M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (cosh (M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (cosh (-M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (cosh (6.9e-18));\n  GEN_DBL_TEST (cosh (-6.9e-18));\n  GEN_DBL_TEST (cosh (7.0e-18));\n  GEN_DBL_TEST (cosh (-7.0e-18));\n  GEN_DBL_TEST (cosh (7.4e-9));\n  GEN_DBL_TEST (cosh (-7.4e-9));\n  GEN_DBL_TEST (cosh (7.5e-9));\n  GEN_DBL_TEST (cosh (-7.5e-9));\n  GEN_DBL_TEST (cosh (0.2));\n  GEN_DBL_TEST (cosh (-0.2));\n  GEN_DBL_TEST (cosh (0.4));\n  GEN_DBL_TEST (cosh (-0.4));\n  GEN_DBL_TEST (cosh (0.7));\n  GEN_DBL_TEST (cosh (-0.7));\n  GEN_DBL_TEST (cosh (0.8));\n  GEN_DBL_TEST (cosh (-0.8));\n  GEN_DBL_TEST (cosh (3.0));\n  GEN_DBL_TEST (cosh (-3.0));\n  GEN_DBL_TEST (cosh (4.0));\n  GEN_DBL_TEST (cosh (-4.0));\n  GEN_DBL_TEST (cosh (6.0));\n  GEN_DBL_TEST (cosh (-6.0));\n  GEN_DBL_TEST (cosh (7.0));\n  GEN_DBL_TEST (cosh (-7.0));\n\n  /* sinh tests */\n  GEN_DBL_TEST (sinh (0.0));\n  GEN_DBL_TEST (sinh (-0.0));\n  GEN_DBL_TEST (sinh (1.0));\n  GEN_DBL_TEST (sinh (-1.0));\n  GEN_DBL_TEST (sinh (INFINITY));\n  GEN_DBL_TEST (sinh (-INFINITY));\n  GEN_DBL_TEST (sinh (NAN));\n  GEN_DBL_TEST (sinh (M_PI));\n  GEN_DBL_TEST (sinh (-M_PI));\n  GEN_DBL_TEST (sinh (2.0 * M_PI));\n  GEN_DBL_TEST (sinh (-2.0 * M_PI));\n  GEN_DBL_TEST (sinh (M_PI / 2.0));\n  GEN_DBL_TEST (sinh (-M_PI / 2.0));\n  GEN_DBL_TEST (sinh (M_PI / 3.0));\n  GEN_DBL_TEST (sinh (-M_PI / 3.0));\n  GEN_DBL_TEST (sinh (M_PI / 4.0));\n  GEN_DBL_TEST (sinh (-M_PI / 4.0));\n  GEN_DBL_TEST (sinh (M_PI / 6.0));\n  GEN_DBL_TEST (sinh (-M_PI / 6.0));\n  GEN_DBL_TEST (sinh (M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (sinh (-M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (sinh (M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (sinh (-M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (sinh (6.9e-18));\n  GEN_DBL_TEST (sinh (-6.9e-18));\n  GEN_DBL_TEST (sinh (7.0e-18));\n  GEN_DBL_TEST (sinh (-7.0e-18));\n  GEN_DBL_TEST (sinh (7.4e-9));\n  GEN_DBL_TEST (sinh (-7.4e-9));\n  GEN_DBL_TEST (sinh (7.5e-9));\n  GEN_DBL_TEST (sinh (-7.5e-9));\n  GEN_DBL_TEST (sinh (0.2));\n  GEN_DBL_TEST (sinh (-0.2));\n  GEN_DBL_TEST (sinh (0.4));\n  GEN_DBL_TEST (sinh (-0.4));\n  GEN_DBL_TEST (sinh (0.7));\n  GEN_DBL_TEST (sinh (-0.7));\n  GEN_DBL_TEST (sinh (0.8));\n  GEN_DBL_TEST (sinh (-0.8));\n  GEN_DBL_TEST (sinh (3.0));\n  GEN_DBL_TEST (sinh (-3.0));\n  GEN_DBL_TEST (sinh (4.0));\n  GEN_DBL_TEST (sinh (-4.0));\n  GEN_DBL_TEST (sinh (6.0));\n  GEN_DBL_TEST (sinh (-6.0));\n  GEN_DBL_TEST (sinh (7.0));\n  GEN_DBL_TEST (sinh (-7.0));\n\n  /* tanh tests */\n  GEN_DBL_TEST (tanh (0.0));\n  GEN_DBL_TEST (tanh (-0.0));\n  GEN_DBL_TEST (tanh (1.0));\n  GEN_DBL_TEST (tanh (-1.0));\n  GEN_DBL_TEST (tanh (INFINITY));\n  GEN_DBL_TEST (tanh (-INFINITY));\n  GEN_DBL_TEST (tanh (NAN));\n  GEN_DBL_TEST (tanh (M_PI));\n  GEN_DBL_TEST (tanh (-M_PI));\n  GEN_DBL_TEST (tanh (2.0 * M_PI));\n  GEN_DBL_TEST (tanh (-2.0 * M_PI));\n  GEN_DBL_TEST (tanh (M_PI / 2.0));\n  GEN_DBL_TEST (tanh (-M_PI / 2.0));\n  GEN_DBL_TEST (tanh (M_PI / 3.0));\n  GEN_DBL_TEST (tanh (-M_PI / 3.0));\n  GEN_DBL_TEST (tanh (M_PI / 4.0));\n  GEN_DBL_TEST (tanh (-M_PI / 4.0));\n  GEN_DBL_TEST (tanh (M_PI / 6.0));\n  GEN_DBL_TEST (tanh (-M_PI / 6.0));\n  GEN_DBL_TEST (tanh (M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (tanh (-M_PI * 2.0 / 3.0));\n  GEN_DBL_TEST (tanh (M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (tanh (-M_PI * 5.0 / 6.0));\n  GEN_DBL_TEST (tanh (6.9e-18));\n  GEN_DBL_TEST (tanh (-6.9e-18));\n  GEN_DBL_TEST (tanh (7.0e-18));\n  GEN_DBL_TEST (tanh (-7.0e-18));\n  GEN_DBL_TEST (tanh (7.4e-9));\n  GEN_DBL_TEST (tanh (-7.4e-9));\n  GEN_DBL_TEST (tanh (7.5e-9));\n  GEN_DBL_TEST (tanh (-7.5e-9));\n  GEN_DBL_TEST (tanh (0.2));\n  GEN_DBL_TEST (tanh (-0.2));\n  GEN_DBL_TEST (tanh (0.4));\n  GEN_DBL_TEST (tanh (-0.4));\n  GEN_DBL_TEST (tanh (0.7));\n  GEN_DBL_TEST (tanh (-0.7));\n  GEN_DBL_TEST (tanh (0.8));\n  GEN_DBL_TEST (tanh (-0.8));\n  GEN_DBL_TEST (tanh (3.0));\n  GEN_DBL_TEST (tanh (-3.0));\n  GEN_DBL_TEST (tanh (4.0));\n  GEN_DBL_TEST (tanh (-4.0));\n  GEN_DBL_TEST (tanh (6.0));\n  GEN_DBL_TEST (tanh (-6.0));\n  GEN_DBL_TEST (tanh (7.0));\n  GEN_DBL_TEST (tanh (-7.0));\n} /* main */\n"
  },
  {
    "path": "tools/update-webpage.sh",
    "content": "#!/bin/bash\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nif [ $# -ne 1 ]; then\n  echo \"Please, specify your gh-pages clone directory: update-webpage <gh-pages clone dir>\"\n  exit 1\nfi\n\ngh_pages_dir=$1\ndocs_dir=`dirname $(readlink -f $0)`\"/../docs\"\n\nGETTING_STARTED_MD=\"00.GETTING-STARTED.md\"\nCONFIGURATION_MD=\"01.CONFIGURATION.md\"\nAPI_REFERENCE_MD=\"02.API-REFERENCE.md\"\nAPI_EXAMPLES_MD=\"03.API-EXAMPLE.md\"\nINTERNALS_MD=\"04.INTERNALS.md\"\nPORT_API_MD=\"05.PORT-API.md\"\nREFERENCE_COUNTING_MD=\"06.REFERENCE-COUNTING.md\"\nDEBUGGER_MD=\"07.DEBUGGER.md\"\nCODING_STANDARDS_MD=\"08.CODING-STANDARDS.md\"\nEXT_REFERENCE_ARG_MD=\"09.EXT-REFERENCE-ARG.md\"\nEXT_REFERENCE_HANDLER_MD=\"10.EXT-REFERENCE-HANDLER.md\"\nEXT_REFERENCE_AUTORELEASE_MD=\"11.EXT-REFERENCE-AUTORELEASE.md\"\nEXT_REFERENCE_MODULE_MD=\"12.EXT-REFERENCE-MODULE.md\"\nDEBUGGER_TRANSPORT_MD=\"13.DEBUGGER-TRANSPORT.md\"\nEXT_REFERENCE_HANDLE_SCOPE_MD=\"14.EXT-REFERENCE-HANDLE-SCOPE.md\"\nMODULE_SYSTEM_MD=\"15.MODULE-SYSTEM.md\"\nMIGRATION_GUIDE_MD=\"16.MIGRATION-GUIDE.md\"\n\ndeclare -A titles\n\ntitles[$GETTING_STARTED_MD]=\"Getting Started\"\ntitles[$CONFIGURATION_MD]=\"Configuration\"\ntitles[$API_REFERENCE_MD]=\"API Reference\"\ntitles[$API_EXAMPLES_MD]=\"API Examples\"\ntitles[$INTERNALS_MD]=\"Internals\"\ntitles[$PORT_API_MD]=\"Port API\"\ntitles[$REFERENCE_COUNTING_MD]=\"Reference Counting\"\ntitles[$DEBUGGER_MD]=\"Debugger\"\ntitles[$CODING_STANDARDS_MD]=\"Coding Standards\"\ntitles[$EXT_REFERENCE_ARG_MD]=\"'Extension API: Argument Validation'\"\ntitles[$EXT_REFERENCE_HANDLER_MD]=\"'Extension API: External Function Handlers'\"\ntitles[$EXT_REFERENCE_AUTORELEASE_MD]=\"'Extension API: Autorelease Values'\"\ntitles[$EXT_REFERENCE_MODULE_MD]=\"'Extension API: Module Support'\"\ntitles[$DEBUGGER_TRANSPORT_MD]=\"'Debugger Transport'\"\ntitles[$EXT_REFERENCE_HANDLE_SCOPE_MD]=\"'Extension API: Handle Scope'\"\ntitles[$MODULE_SYSTEM_MD]=\"'Module System (EcmaScript2015)'\"\ntitles[$MIGRATION_GUIDE_MD]=\"Migration Guide\"\n\nfor docfile in $docs_dir/*.md; do\n  docfile_base=`basename $docfile`\n\n  permalink=`echo $docfile_base | cut -d'.' -f 2 | tr '[:upper:]' '[:lower:]'`\n  missing_title=`echo $permalink | tr '-' ' '`\n\n  # the first three documents belong to the navigation bar\n  category=$([[ $docfile_base =~ ^0[0-3] ]] && echo \"navbar\" || echo \"documents\")\n\n  # generate appropriate header for each *.md\n  echo \"---\"                                             >  $gh_pages_dir/$docfile_base\n  echo \"layout: page\"                                    >> $gh_pages_dir/$docfile_base\n  echo \"title: ${titles[$docfile_base]:-$missing_title}\" >> $gh_pages_dir/$docfile_base\n  echo \"category: ${category}\"                           >> $gh_pages_dir/$docfile_base\n  echo \"permalink: /$permalink/\"                         >> $gh_pages_dir/$docfile_base\n  echo \"---\"                                             >> $gh_pages_dir/$docfile_base\n  echo                                                   >> $gh_pages_dir/$docfile_base\n  echo \"* toc\"                                           >> $gh_pages_dir/$docfile_base\n  echo \"{:toc}\"                                          >> $gh_pages_dir/$docfile_base\n  echo                                                   >> $gh_pages_dir/$docfile_base\n\n  # the file itself removing underscores inside links\n  gawk \\\n  '\n  !/\\[.*\\]\\(#/ {\n    print $0\n  }\n\n  /\\[.*\\]\\(#/ {\n    link_start_pos = index($0, \"](#\");\n    line_beg = substr($0, 1, link_start_pos+2);\n    line_remain = substr($0, link_start_pos+3);\n    link_end_pos = index(line_remain, \")\")\n    link = substr(line_remain, 1, link_end_pos-1);\n    line_end = substr(line_remain, link_end_pos)\n\n    printf \"%s%s%s\\n\", line_beg, link, line_end\n  }\n  ' $docfile                                             >> $gh_pages_dir/$docfile_base\n\n  # fix image links\n  sed -i -r -e 's/^!\\[.*\\]\\(/&{{ site.github.url }}\\//' $gh_pages_dir/$docfile_base\n  sed -i -r -e 's/^!\\[.*\\]\\(\\{\\{ site\\.github\\.url \\}\\}\\/img.*$/&{: class=\"thumbnail center-block img-responsive\" }/' $gh_pages_dir/$docfile_base\n\n  # turn filenames into permalinks\n  sed -i -r -e 's/docs\\/[0-9]+\\.(.*)\\.md/\\L\\1/g' $gh_pages_dir/$docfile_base\n\n  # replace span tags to div\n  sed -i 's/<span class=/<div class=/g' $gh_pages_dir/$docfile_base\n  sed -i 's/<\\/span>/<\\/div>/g' $gh_pages_dir/$docfile_base\n\n  # remove table header separators\n  sed -i '/^| ---/d' $gh_pages_dir/$docfile_base\n\n  # update images\n  cp -Ru $docs_dir/img $gh_pages_dir\ndone\n"
  },
  {
    "path": "tools/version.py",
    "content": "#!/usr/bin/env python\n\n# Copyright JS Foundation and other contributors, http://js.foundation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport os\nimport re\nimport settings\n\n\ndef main():\n    parser = argparse.ArgumentParser(\n        description='Display version of JerryScript',\n        epilog=\"\"\"\n            Extract version information from sources without relying on\n            compiler or preprocessor features.\n            \"\"\"\n    )\n    _ = parser.parse_args()\n\n    with open(os.path.join(settings.PROJECT_DIR, 'jerry-core', 'include', 'jerryscript.h'), 'r',\n              encoding='utf8') as header:\n        version = {}\n        version_re = re.compile(r'\\s*#define\\s+JERRY_API_(?P<key>MAJOR|MINOR|PATCH)_VERSION\\s+(?P<value>\\S+)')\n        for line in header:\n            match = version_re.match(line)\n            if match:\n                version[match.group('key')] = match.group('value')\n\n    print(f'{version[\"MAJOR\"]}.{version[\"MINOR\"]}.{version[\"PATCH\"]}')\n\n\nif __name__ == \"__main__\":\n    main()\n"
  }
]